From 3b08adfc6852f39ef402db2efe3ee0dfebd7019c Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Sun, 27 Dec 2015 23:24:21 +0800 Subject: [PATCH 01/57] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E4=BF=AE=E6=94=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 6 ++ app/views/files/_course_file.html.erb | 80 +++++++++----- app/views/files/_course_list.html.erb | 147 ++++++++++++++------------ public/images/hwork_icon.png | Bin 0 -> 7386 bytes public/stylesheets/courses.css | 3 + public/stylesheets/public.css | 10 +- 6 files changed, 152 insertions(+), 94 deletions(-) create mode 100644 public/images/hwork_icon.png diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index c4bbc4ebb..db7b85fdb 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2586,6 +2586,12 @@ module ApplicationHelper end end + def file_preview_eye(file, html_options={}) + if %w(pdf pptx doc docx xls xlsx).any?{|x| file.filename.downcase.end_with?(x)} + link_to '', download_named_attachment_path(file.id, file.filename, preview: true),html_options + end + end + #将文本内的/n转换为
def text_format text text.gsub("&","&").gsub("<","<").gsub(">",">").gsub("\n","
").html_safe diff --git a/app/views/files/_course_file.html.erb b/app/views/files/_course_file.html.erb index a0cb419b2..b3371eefe 100644 --- a/app/views/files/_course_file.html.erb +++ b/app/views/files/_course_file.html.erb @@ -1,4 +1,9 @@ + -
-
-
- <%= form_tag( search_course_files_path(@course), method: 'get',:class => "re_search f_l",:remote=>true) do %> - <%= text_field_tag 'name', params[:name], name: "name", :class => 're_schbox',:style=>"padding: 0px"%> - <%= submit_tag "课内搜索", :class => "re_schbtn b_lblue",:name => "incourse",:id => "incourse", :onmouseover => "presscss('incourse')",:onmouseout =>"buttoncss()" %> - <%= submit_tag "全站搜索", :class => "re_schbtn b_lblue",:name => "insite",:id => "insite",:onmouseover => "presscss('insite')",:onmouseout =>"buttoncss()" %> - <% end %> - <% if is_course_teacher(User.current,@course) || (@course.publish_resource==1 && User.current.member_of_course?(@course) ) %> - -

- 上传: - 课件 |  - 软件 |  - 媒体 |  - 代码 |  - 论文 |  - 其他 -

+
+
+
资源库
+ +
+
+
+ <%= form_tag( search_course_files_path(@course), method: 'get',:class => "re_search",:remote=>true) do %> + <%= text_field_tag 'name', params[:name], name: "name", :class => 'researchBox fl',:style=>"padding: 0px"%> + <%= submit_tag "课内搜索", :class => "blueBtn mr5 fl",:name => "incourse",:id => "incourse" %> + <%= submit_tag "全站搜索", :class => "blueBtn mr5 fl",:name => "insite",:id => "insite" %> + <% if is_course_teacher(User.current,@course) || (@course.publish_resource==1 && User.current.member_of_course?(@course) ) %> + + <% end %> <% end %> -
-
-
- <%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} %> -
+ + +
+
+

共有 <%= @all_attachments.count%> 个资源

+

+ <% if @order == "asc" %> + 按 <%= link_to "时间",params.merge(:sort=>"created_on:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"created_on"} %> /  + <%= link_to "下载次数",params.merge(:sort=>"downloads:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"downloads"} %> /  + <%= link_to "引用次数",params.merge(:sort=>"quotes:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"quotes"} %> 排序 + <% else %> + 按 <%= link_to "时间",params.merge(:sort=>"created_on:asc"),:class => "f_b c_grey" ,:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"created_on"} %> /  + <%= link_to "下载次数",params.merge(:sort=>"downloads:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"downloads"} %>  /  + <%= link_to "引用次数",params.merge(:sort=>"quotes:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"quotes"} %> 排序 + <% end %> +

+
+
+
+ <%= render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => @course,:tag_name => @tag_name}%> +
+
+ + <%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} %> +
<% html_title(l(:label_attachment_plural)) -%> \ No newline at end of file diff --git a/app/views/files/_course_list.html.erb b/app/views/files/_course_list.html.erb index f04d70577..2426d49f9 100644 --- a/app/views/files/_course_list.html.erb +++ b/app/views/files/_course_list.html.erb @@ -1,79 +1,88 @@ +
<% delete_allowed = User.current.allowed_to?(:manage_files, course) %> -
-

共有 <%= all_attachments.count%> 个资源

-

- <% if order == "asc" %> - 按 <%= link_to "时间",params.merge(:sort=>"created_on:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"created_on"} %> /  - <%= link_to "下载次数",params.merge(:sort=>"downloads:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"downloads"} %> /  - <%= link_to "引用次数",params.merge(:sort=>"quotes:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"quotes"} %> 排序 - <% else %> - 按 <%= link_to "时间",params.merge(:sort=>"created_on:asc"),:class => "f_b c_grey" ,:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"created_on"} %> /  - <%= link_to "下载次数",params.merge(:sort=>"downloads:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"downloads"} %>  /  - <%= link_to "引用次数",params.merge(:sort=>"quotes:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"quotes"} %> 排序 - <% end %> -

-
-
- -
- <%= render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => course,:tag_name => @tag_name}%> -
-
- -
<% curse_attachments.each do |file| %> <% if file.is_public? || User.current.member_of_course?(course) || User.current.admin? %> -
-
- <%= link_to truncate(file.filename,length: 35, omission: '...'), - download_named_attachment_path(file.id, file.filename), - :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "c_dblue f_14 f_b f_l" %> - <% if User.current.logged? %> - <% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %> - <%= link_to("选入我的其他课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select c_lorange",:remote => true) if has_course?(User.current,file) %> +
+
+
+ <%= link_to image_tag(url_to_avatar(file.author), :width => 50, :height => 50), user_path(file.author) %> +
+
+
+ + <%= file.author.realname.blank? ? file.author.login : file.author.realname %> + + <% if file.container_type == 'Course' && file.container_id==course.id%> + TO <%= course.name%> | 资源库
+ <%else%> + 上传了资源 + <%end %> +
+ <%= link_to truncate(file.filename,length: 35, omission: '...'), + download_named_attachment_path(file.id, file.filename), + :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkBlue f_14 f_b" %> + <%= file_preview_eye(file, class: 'preview') %> + <% if file.is_public? == false%> + 私有 + <%end %> +
+
+ 上传时间:<%= format_date(file.created_on)%> + 上传类型:<%= %> +

文件大小:<%= number_to_human_size(file.filesize) %>

+

下载<%= file.downloads%>  |  引用<%= file.quotes.nil? ? 0:file.quotes %>

+
+
+
+ + <%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %> + <%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %> +
+
+
    +
  • +
      +
    • 发送
    • + <% if User.current.logged? %> + <% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %> - <% if delete_allowed && file.container_id == @course.id && file.container_type == "Course" %> - <% if @course.is_public? %> - - <%= link_to (file.is_public? ? "公开":"私有"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"f_l re_open c_blue",:method => :post %> - - <% else %> - - 私有 - - <% end %> + <% if delete_allowed && file.container_id == @course.id && file.container_type == "Course" %> + <% if @course.is_public? %> +
    • + + <%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"postOptionLink",:method => :post %> + +
    • + <%else%> +
    • + + <%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"postOptionLink",:method => :post %> + +
    • + <%end%> +
    • 删除资源
    • + <% end %> + <% end %> + <% end %> - <% else %> - - <% end %> - <% else %> - <%= link_to("选入我的课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select c_lorange",:remote => true) if has_course?(User.current,file) %> - <% end %> - <%= file_preview_tag(file, class: 'f_l re_open') %> - <% else %> - <% end %> -
-
-
-

文件大小:<%= number_to_human_size(file.filesize) %>

- <%= link_to( l(:button_delete), attachment_path(file), - :data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "f_r re_de") if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course"%> -

<%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %>  |  下载<%= file.downloads %>  |  引用<%= file.quotes.nil? ? 0:file.quotes %>

-
-
-
- - <%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %> - <%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %> -
-
-
+ + + +
+
+
+
+
+
+
<% else %>
<%= file.filename %>是私有资源
<% end %> <% end %> + +
- -
+ + + + diff --git a/public/images/hwork_icon.png b/public/images/hwork_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..0b8b488de2e9bb7f96bc6e9b73f20205485cb8e6 GIT binary patch literal 7386 zcmbVR1z1#Fw+2KSNu^;(mF^t6k&HtBz4!m_bMHORdG^`oJny^K+Iz3P_Fnru(brWcC88(7!onie)KD?FetKYGVFL;9 zu4{}ZYtz>cI+Usz%Fq>t@&S23u@oV$_E3N(0^|TSfPx@??gLOD7S;_mxRDvkOh;Q9 z?26zA{lf73BHXUoSXe-LUpElg8HxhfLml8qS+?D#HZ}kpBFknfrX#51rVMq2YxsLW z4gGbE!2Zr)DF~aq902GmeJub1MS%dm2p6QMw684NZ*rxt>%Tq=umOI9pqypdemBZY zM<1Z<>H!6a@r&?*1%-qF;^O>5qGICWLc9QBK_OuQ!RuR`Pe@c+Ok7%60`SMhcCF0= z0+TjSQTs#J^_wi4BMRjvEg<0Ig3r?ri30iZAwAju zl%N9j1be{UP;gfy;Fm;@y{i{WmhIZo-PX{R!03 z`JbT(#9wGnlmYZ_d;hIqPa{7!sDJ^~)78rZd_8b5_Ft;pq?J9OAe5_zk*llApS`H> z=!$anbaZtCC>x3c?wP`o5LX}1`@i9Jbfh(ro+uC!4AoSTWxJNZ4~Ijfm4p?=)r5rv z6~)9wg@jbaBqfxkq(nufB!xw!loTb@{^Y8-g1rz>BbTDvkKG$ z?hS>gdAK3~zcpDJ{*Sf@s{W(AKe&*8v_(+uAGre8#t8fx*nb)5KR;c2&#&rVZhQUm zm*Yc`*WT`N?be~6QfIGcl&+?VqLJ_HRyJXVwQ6dgp7FvlUrS+A3hH~3EGs#biU4qr z-pv%&or$dig;~knhSGY`rjIG&LDlZyGhU*sgt@t+RrJZNlHLwzP$pw3ChzDvd_DSp zhVUsXl{!B2`l8Tya~rADc8K}3=#$?1BilCHuo!7G4YhCvv|RKMaD;GBXi)wta5Vi- zLoYg~Z7;|wrj@Kx*XzH*JOwfBI0Gl>`k%|=wxGR|Avv`VD%l6w@}jC*wuZV8jSiTd41r80E=6>$DL z)=Gd$i=wchn=krqH7&c~-2}c|z-M?XqP+ z*hyaw=VDATDxuHo)a?8%C6t#>9VwVPq@D z-tgS;mZ;yIWiEM^A=9;&1^5U|^m&`S4b7TBKZ2qND*`=4eJP4;#Aj_IE!pYzikP!} zvgG-ki}$HPl80msl<~+2?-rPBwHA?YM>PdF|hS(0^kJ@bzz2w5^aSHq5_43wurw_PI}b#p@J{jXf{R`B;1E^H86E z<-3X&Tnw$d`@G5bbaPbd^0NUS!=YgtJhuT|>^7ETzsyZac;l@@(ZakY!pm7C0sSdT z&wI%t0Xm`0L(8*PnQa_=PU;}=v)$J!U`q35m!M;{i?cN~o($iddx3UP*5+=OF=k#` z$8G1d=h1yj(_n4J$Tp?7)%!KYPIRBYFJ5e27T#mh3RL3Pe#tea>+?A*>Rrpr z{nwFGLL;p$O^F?wO+>7WbIIm)b+my_%@wlT8l2EJ?c`$G)d-FRY+27lSDEPs4X;u6 z1^&^^{QQyy@Abi?s`|`hGd)QS25Wwj!5^>g(vQ_VRCm~< zKVuY_W{ChjV2nu2$8aqKG`&BbeBMMi{-T_xsIW1tVBF%~;7Ig6qQZmcvUi(mSjEhC zW0-u_28&4|2X;p+{dab@T;o&yijKM#SEHz; zoBXOvaCz7fQ&wSiy_Zgz>{v5x;jH+}mYG)T8~G_!s&g+Rjo5eeBg}eQ6yHY`-{zwJ z{B!hsz{L5P5M(_ZQT3Mb&7Mf6so0n!)wWE|iK>vqTVpdN5W{nd+DS_MwL;(791FY# z_aE(_5G_6NlaHKZ?V6)=HtZt(k2Dd-#GBTe&+zB)U2{w~WFI45Z{1h*WC(0x(362G zDcT=mz;h*3jF_(-!?!~{+=BJFp}d%(#tO{S0hp(-HKA}F`i6{Pc*_4o#35PniKE$|N+n1canQj)KoNNE`HAL7hh|JPIMn4W} zf2b9oUav8HnEuU~gYD4o)A>^i3Fu^|kG)dL(A2bYiCIRJW}9J`pn@u4Q*!n`ElB6;Y{BnKAi4x`dkW* z*<81zNehShEROwSMg6p*Tr-Shc}oejcl5nN@cq=$9Sz6<8uy&#BsgdE!{zwcl+ToO z|Kx_~)?3_j9S7ECf4%!8Lg5FdwXh&BZO=v-n!zZ;TH2ZSruCFvdAxULZKjqhS?aV@ z$VQ4aL;*>EL@5;j;qSrhi2~*CtL-04E?ZK;0A9m>$Q)S(aR+F(q9yjK-uX)1{;g@) zT41Hu!24av5|rG`B?n}cE!_K#QcgtRjWFMfYI)$vXL%bzPSPI}mOHXjNqL~5$G%`6 zduu1T!khD=5{1E#AfdYIJiEx-VFn~I!x60-A+%>J^gxe+l2s4+S3jrNeeyPzr5(nn z&=PfW+9&&=Jo=!Osrg0O!xt_KYr08&ZEVA?-f5tZA)K#olFgVhV^3TpYwcJ6(AYhv zpt>(Y2{7<4XV4mg`M1#7ghUN@DsR~Nxv}jy7$xZ;7o-kWOQTQw7{(ZJcmPW+S1wHs zV{3dR5Jl6^RsyV&%1T#Y;PeUT0+!fGP4+SCV23rAV)~=O9(Codjih!J)BZ#sR`Xrq z%i3b_6+L0|2;Qk-R!5Y!bp~}3qB?72ceV_OaxnGrvnB5!L8|54yJ^xGbp9zKo}Bck z#m`oK$7)EpE%I6M7p0|$QXCJbfNQN4kyEUy&k;-6X83Kj9~bRP5};qBWgmLT8)?5e z4TWp8`>W#|1k|6WX<|#gLP)C!^?I-ZQun=`W-eQ^voCY?EqK$1XU9bYer{OHN7lOr z4_vqyDsw)^O($0=%5A3dg={H*X=JHU*N;jJ7!#Phts>&fY7q06>v#$z1>$t$mp znO-BWNj!7ysML-pDcHiipYvS-p^x%OhP~UXL1Ewy>p~R?k-kOt)X1NKvdgMHSt9(y z@$D8&p19B)rWewX*%!p4Qk425+z*!mnxLQzN9N7BMlPL3ylHjtTh~>;@oJ2Rm zJOEjUll0!No_4Om*#2Z&k&%tOZt^#DXLH{HbV9qh7bBkJL%7(zZuG3<*=2p6x?@qh zPSr9EN;+~re|po~&4$Y2d|*5zdBABOXseB*;rWVSB!y^^uJ-^%QsN+)F!^#%JiF+F zfSAQ8k6%WV5}%fMqgY=L-?P zcby-95y2zkzFRsPauTK_xp9Yxv(4yRKcGI@dG4Wm-tJCKRwKpO`Lxl^uYjKB&#nt8 z^%y+Bdff0MpuVj;>rXY@i%)XfHZL>Hj%&32EO2@yt$Uxn7R{SNOhz=`AzK1gUG~58 zH@vc|AN9_W#a)#V)z1A%Oo!^)$vHUFH-9kFZu)S0!9FcE@Set3NnmAtqi=$63if1*T^LHt=X<*ts!iU7k{$DM>qd2ykX281n0wcV=nq^O z<&efDN4gQ;(mts+c|XJ(%k{sAd%x}E{tl0yJ*O8ZPG$7pgI~yZhM%BKzFjG7GNq>Y zuKA20EWU#GwnP+pM1mSYi_LyR0|i)m!2NEm!Xv`CeR72>m(v4iLpljWUA<3^^g&bNA-z&8c&^4sa*I+JnPp1A8`GttN?nbv>^$T7pu z+6#jm^<&;fQO$1mm6?=pJ$FfJ8b9U-Vfn0%hzW6}3F6&-kZIK+*%Seb3T{S2j`XqTqGW)&^$!}46NjqDh!{yPjSM?&+yJpR{+`M{yWxq9X zqR+ylH=BpSRV~XWaal+1v4lJ6P6tCc!}yI|A+!!p$sXsiA07>rTh=klW&(Jm ztxm+|h6S7GkyK+(R`*)i>j*)JK8}s;djHZYJ=#bNa<=BHT8*KMKin^T`&$Y}1C6Zb zfbT-$%>wx`x3sm$eCjbhsVT(`g-RfW?4F8?a^14ruw4fW_N0oqGo|eNVNL+I&iY~2 z!=RaMblzufesb7{MDI6dzpq{$(a1RK{QpeG238o6#_gLnK9c2kG0x? zgMI^O9A8(AL!=8crF|6EDyhl48jHAUg00Kh+6{09u=N}CaDthogZvyhY(Zn!xoRhK z<~biU*AE$YZ{|tkv-IC6sCnwUPr@a_(mRdG2%;z&E%MHc6k6}(etzoX)^baVCDDBQ zHi5T$d5Bf33!Kbk-75_mTL%&yyy>_OTzOOiM#HoGo(x-U1=Q5`3|b zb{ri8bVE~%ZH${tvU05Jn{UfM+Rm6RtJB-L5i+^}D;1vHH|q~aQ>Sl~syrWHg0YXw z;Wj;W|M}ps0RKE$4>0fh{Y|D=E-vf1KS}wyH;yLMC&vriKDLyQepWs}b(Y zoE9vhy)w>93p+|Rv`#GD>|)QMp8bZde>CR1(Dxc3wE<#OEqi7V?>livu&bT+gkVzd znP?@^9g8w;M)kYPmzh~F@aK4O&xZ9cvb3oj`e9-m@DsAJdZi65pP zgbO3*MPAJj;y*d?Z1@>Fyv)@6xO^_R5>pZc6&!xF1z>KbXDR4v;mTe~FTCD!vi37hb;V%B>p7eHV$ z6PmOx8~mK*{#v0~Bu`5YDoJq4Ae|2xVNkk$F99Yf0-?(&_ZtN9%1E)+uOV#C=;}6vn{cRqO6rW!9`USg?Oul{5V!_IWME zwi{OLSKSNQpjLVeOSgeiG-jnXtIA63;l$9Hp@f4|VuP<(MQq1>`^}ji!TnY#g25sk ztiw*1Eg6#pI;Sn?1n|chR?XyWT9ZYYpwB^5C@I~0Ld=kj>E@o|hpvl*AFfWLXnB|Zd5`~XjFnCh{2 zZ0UEg6>jE}&Ka%vc`=5(o6_Vg_^g__Oz8VjcvyGbk?zr3Vnz%fIMpIj-*`=EL4RI! z(hJ__J`#?Idx-aiwQe;*K%6%t~Z z7iwkTIIryY45@_Uy!H84uwOPhG^^5<@Ik+ znM^!@G7FI2y7=L1ovV_hF?+XJEr?<5{ zDX0WXOH*>*2tzP2oHtOlv#FV>n3?IL@|bs()EFlIOv_vgE+Qc=9QS~r!V&l|BWpT_ z^is&WdjU#2HqdBmA_p%5-d-*ePF;g=CBO17$bvuexxeJYm;607wXq*v9@rWFp*y%O zfe6#1jr;Yih&Y3sJkq0DYY;MgaA)(4~@KlGu*1) z+?*CRD0+ATK_{uT$AwaQYkne(8W{LSMLznUa!YIwles>p! zKCLhkZT3vYN19LlN?|GL%%FFODE7ev$4m9Dr zE`2O~-6oF%?k5b4RdH(~e+ZY2O_Ub(c zYShU!!VTBsyh7euih&ojElE4yJsQ^{9`!Dww_v1|vb+h_Y%rST3-eGYl6|T0jn{uQ zoeq2nnD(oWGiHPcGWO9b$pdGWoL{)%Y9s-m)o-`sA+zj+1s_1&FNitKnA*{=yLGvy z#!*g#!iHcbkLFG{-YLsKF3eMS;=M#%#8qqrap5(Y%$q84m8M9yUiM`=o9~ z?~7^WtkW-|l1h;oi-T2H<6QXqXu#U9Jt03cN%=J?U4ffVB~xTVOI zrf%a{K3p=C-Hb~UnL8iHRq}TCshzrN2E18AomvA`1E0b9$?&=$EPmU$$aw(8mKyg; zq#gZ8c$)$@xv8XbmN#=1J9kw3N~!C0^+whUhkO0AP^6zv68x^|(U{raJN!T6%zr%q u`7epUpRj)lM}O1*(<$$f!MCfMv{)Q>Ue8I-Of>!a+o-9kt5Tt47y2KIa7rNn literal 0 HcmV?d00001 diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 463fc710a..baf5fefcb 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -1231,6 +1231,9 @@ div.disable_link {background-color: #c1c1c1 !important;} /*新课程资源库*/ .reCon{ margin:5px; width:710px;} .reTop{width:710px; height:40px; background:#eaeaea; padding:5px;} +.researchBox { width:240px; height:24px; border:1px solid #dddddd; color:#666666;} +.blueBtn{ width:60px; height:26px; color:#FFF; border:none; background-color:#269ac9; cursor:pointer; padding-left:0px; text-align:center;} +.blueBtn:hover {background-color:#298fbd;} /*问题状态图片*/ .issues{ background:url(../images/public_icon.png) -66px 5px no-repeat; width:18px; height:21px;} diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index d9f370c7d..394a0cb12 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -916,4 +916,12 @@ a.resourcesTypeUser {background:url(images/homepage_icon.png) -178px -453px no-r .list_style ul li{list-style-type: disc;margin-left: 20px;} /* @功能 定义 */ -span.at {color:#269ac9;} \ No newline at end of file +span.at {color:#269ac9;} + +/*20151217资源库Tim*/ +.preview {background:url(../images/hwork_icon.png) -75px -120px no-repeat; width:20px; height:20px; display:inline-block;} +.mediaIcon {background:url(../images/hwork_icon.png) -5px -160px no-repeat; padding-left:23px;} +.codeIcon {background:url(../images/hwork_icon.png) -78px -160px no-repeat; padding-left:23px;} +.othersIcon {background:url(../images/hwork_icon.png) -3px -210px no-repeat; padding-left:23px;} +.thesisIcon {background:url(../images/hwork_icon.png) -78px -212px no-repeat; padding-left:23px;} +.softwareIcon {background:url(../images/hwork_icon.png) -5px -254px no-repeat; padding-left:23px;} \ No newline at end of file From e35d2daa0a745dd7a5456ab45c14edb6d23e04f2 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Mon, 28 Dec 2015 16:19:30 +0800 Subject: [PATCH 02/57] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/files_controller.rb | 11 +- .../attachments/update_file_dense.js.erb | 9 +- app/views/files/_course_file.html.erb | 57 +++++----- app/views/files/_course_list.html.erb | 102 +++++++++--------- app/views/files/_tag_yun.html.erb | 4 +- app/views/files/index.html.erb | 16 ++- app/views/files/index.js.erb | 4 + app/views/files/search.js.erb | 7 +- app/views/files/search_tag_attachment.js.erb | 3 +- public/stylesheets/courses.css | 14 ++- 10 files changed, 137 insertions(+), 90 deletions(-) create mode 100644 app/views/files/index.js.erb diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 121cd3a42..5cbf1ab2f 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -745,7 +745,16 @@ class FilesController < ApplicationController q = "%#{@q.strip}%" @result = find_course_attache q,@course,sort @result = visable_attachemnts @result - @result = @result.select{|attachment| attachment.tag_list.include?(@tag_name)} unless @tag_name.blank? + if params[:other] + @result = @result.select{|attachment| + !attachment.tag_list.include?('课件') && + !attachment.tag_list.include?('软件') && + !attachment.tag_list.include?('媒体') && + !attachment.tag_list.include?('代码') && + !attachment.tag_list.include?('论文') } + else + @result = @result.select{|attachment| attachment.tag_list.include?(@tag_name)} unless @tag_name.blank? + end @searched_attach = paginateHelper @result,10 @tag_list = get_course_tag_list @course diff --git a/app/views/attachments/update_file_dense.js.erb b/app/views/attachments/update_file_dense.js.erb index d99481d08..110d3fc7c 100644 --- a/app/views/attachments/update_file_dense.js.erb +++ b/app/views/attachments/update_file_dense.js.erb @@ -1,2 +1,7 @@ -$("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "公开":"私有"), update_file_dense_attachments_path(:attachmentid=>@attachment.id,:newtype=>(@attachment.is_public? ? 0:1)), - :remote=>true,:class=>"f_l re_open",:method => :post) %>"); +$("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>@attachment.id,:newtype=>(@attachment.is_public? ? 0:1)), + :remote=>true,:class=>"postOptionLink",:method => :post) %>"); +<%if @attachment.is_public? %> + $("#image_private_<%= @attachment.id%>").html('') +<%else%> +$("#image_private_<%= @attachment.id%>").html('私有') +<%end%> \ No newline at end of file diff --git a/app/views/files/_course_file.html.erb b/app/views/files/_course_file.html.erb index b3371eefe..9513baab0 100644 --- a/app/views/files/_course_file.html.erb +++ b/app/views/files/_course_file.html.erb @@ -2,7 +2,7 @@ diff --git a/app/views/files/_tag_yun.html.erb b/app/views/files/_tag_yun.html.erb index 3d1ded552..f9c6c1666 100644 --- a/app/views/files/_tag_yun.html.erb +++ b/app/views/files/_tag_yun.html.erb @@ -8,12 +8,12 @@ <% tag_list.each do |k,v|%> <% if tag_name && tag_name == k%> - <%= k%>(<%= v%>) + <%= k%> x<%= v%> <% else%> <%= k%>(<%= v%>) + ondblclick="rename_tag($(this),'<%= k %>','',<%= 6 %>);"><%= k%> x<%= v%> <% end%> <% end%> <% end%> \ No newline at end of file diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb index 8b199ab4e..98c1cb684 100644 --- a/app/views/files/index.html.erb +++ b/app/views/files/index.html.erb @@ -1,12 +1,18 @@ -
+ <% if @container_type == 0 %> - <%= render :partial => 'project_file_new', locals: {project: @project} %> +
+ <%= render :partial => 'project_file_new', locals: {project: @project} %> +
<% elsif @container_type == 1 %> - <%= render :partial => 'course_file', locals: {course: @course} %> +
+ <%= render :partial => 'course_file', locals: {course: @course} %> +
<% elsif @container_type == 2 %> - <%= render :partial => 'files/subfield_files', locals: {org_subfield: @org_subfield} %> +
+ <%= render :partial => 'files/subfield_files', locals: {org_subfield: @org_subfield} %> +
<% end %> -
+ + <% end %> +
+
+<%= form_tag add_exist_file_to_org_user_path(user),:remote=>true,:id=>'orgs_list_form' do %> +
+
    + <% unless @orgs.empty? %> + <% @orgs.each do |org|%> +
  • + +
  • + <%end%> + <%end%> +
+
+
+
    + + + <%= render :partial => 'users/org_resources_subfield',:locals => {:subfield=>nil}%> + + + + + +
+
+
+
目标地址:
+
+ <%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %> +
+
+ 取消 +
+
+ <%end %> \ No newline at end of file diff --git a/app/views/users/_resource_share_for_project_popup.html.erb b/app/views/users/_resource_share_for_project_popup.html.erb index ba136899c..bdf4ef439 100644 --- a/app/views/users/_resource_share_for_project_popup.html.erb +++ b/app/views/users/_resource_share_for_project_popup.html.erb @@ -2,11 +2,12 @@
-
将资源发送至
+
将资源发送到
@@ -47,7 +48,7 @@ <%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %>
- +
<% end %> diff --git a/app/views/users/_resource_share_popup.html.erb b/app/views/users/_resource_share_popup.html.erb index 53fb6673b..b1f6270b0 100644 --- a/app/views/users/_resource_share_popup.html.erb +++ b/app/views/users/_resource_share_popup.html.erb @@ -7,6 +7,7 @@
@@ -47,7 +48,7 @@ <%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %> -
取消
+
取消
<% end %> diff --git a/app/views/users/add_exist_file_to_course.js.erb b/app/views/users/add_exist_file_to_course.js.erb index 95f7784f7..57fe9d42d 100644 --- a/app/views/users/add_exist_file_to_course.js.erb +++ b/app/views/users/add_exist_file_to_course.js.erb @@ -4,7 +4,7 @@ $("#resources_list").html('<%= escape_javascript( render :partial => 'resources_ $("#res_count").html(0); $("#checkboxAll").attr('checked',false); $("#res_all_count").html(<%= @atta_count%>); -closePopUp(); +hideModal(); alert("发送成功") <% else%> <% end %> \ No newline at end of file diff --git a/app/views/users/add_exist_file_to_project.js.erb b/app/views/users/add_exist_file_to_project.js.erb index 95f7784f7..57fe9d42d 100644 --- a/app/views/users/add_exist_file_to_project.js.erb +++ b/app/views/users/add_exist_file_to_project.js.erb @@ -4,7 +4,7 @@ $("#resources_list").html('<%= escape_javascript( render :partial => 'resources_ $("#res_count").html(0); $("#checkboxAll").attr('checked',false); $("#res_all_count").html(<%= @atta_count%>); -closePopUp(); +hideModal(); alert("发送成功") <% else%> <% end %> \ No newline at end of file diff --git a/app/views/users/change_org_subfield.js.erb b/app/views/users/change_org_subfield.js.erb new file mode 100644 index 000000000..e69de29bb diff --git a/app/views/users/search_user_course.js.erb b/app/views/users/search_user_course.js.erb index 2a0c98cad..f32ed521a 100644 --- a/app/views/users/search_user_course.js.erb +++ b/app/views/users/search_user_course.js.erb @@ -9,10 +9,10 @@ //$("#upload_box").css('left','').css('top',''); //$("#upload_box").html('<%#= escape_javascript( render :partial => "resource_share_popup" ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); //$("#upload_box").css('display','block'); -$("#ajax-modal").html('<%= escape_javascript( render :partial => 'resource_share_popup' ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); +$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_popup' ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); showModal('ajax-modal', '452px'); $('#ajax-modal').siblings().remove(); -$('#ajax-modal').before(""); +$('#ajax-modal').before(""); $('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().addClass("popbox").addClass("resourceUploadPopup"); $('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); diff --git a/app/views/users/search_user_org.js.erb b/app/views/users/search_user_org.js.erb new file mode 100644 index 000000000..94ac37968 --- /dev/null +++ b/app/views/users/search_user_org.js.erb @@ -0,0 +1,9 @@ +$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_orgs' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); +showModal('ajax-modal', '452px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before(""); +$('#ajax-modal').parent().css("top","").css("left",""); +$('#ajax-modal').parent().addClass("popbox").addClass("shareDP"); +$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); +var val = $("#search_org_input").val(); +$("#search_org_input").val("").focus().val(val); \ No newline at end of file diff --git a/app/views/users/search_user_project.js.erb b/app/views/users/search_user_project.js.erb index f38d9edc8..b99d36348 100644 --- a/app/views/users/search_user_project.js.erb +++ b/app/views/users/search_user_project.js.erb @@ -8,7 +8,7 @@ $("#ajax-modal").html('<%= escape_javascript( render :partial => 'resource_share_for_project_popup' ,:locals => {:projects=>@projects,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); showModal('ajax-modal', '452px'); $('#ajax-modal').siblings().remove(); -$('#ajax-modal').before(""); +$('#ajax-modal').before(""); $('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().addClass("resourceUploadPopup").addClass("popbox") $('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); diff --git a/app/views/users/user_resource.html.erb b/app/views/users/user_resource.html.erb index 418809917..09f8a998d 100644 --- a/app/views/users/user_resource.html.erb +++ b/app/views/users/user_resource.html.erb @@ -467,11 +467,17 @@ type: 'get', url: '<%= search_user_course_user_path(@user)%>' + '?send_id=' + id }); - } else { + } else if(sendType === '2') { $.ajax({ type: 'get', url: '<%= search_user_project_user_path(@user)%>' + '?send_id=' + id }); + }else if(sendType ==='3') + { + $.ajax({ + type: 'get', + url: '<%= search_user_org_user_path(@user)%>' + '?send_id=' + res_id + }); } }else{//如果是多个发送 if (sendType === '1'){ @@ -479,11 +485,16 @@ type: 'get', url: '<%= search_user_course_user_path(@user)%>' + '?'+ $("#resources_list_form").serialize() }); - }else{ + }else if(sendType === '2'){ $.ajax({ type: 'get', url: '<%= search_user_project_user_path(@user)%>' + '?' + $("#resources_list_form").serialize() }); + }else if(sendType === '3'){ + $.ajax({ + type: 'get', + url: '<%= search_user_org_user_path(User.current)%>' + '?'+$("#resources_list_form").serialize() + }); } } } @@ -521,5 +532,12 @@ }); } + function subfield_click(){ + var sendText = $("input[name='org_id']:checked").next().text(); + var orgDirection = "目标地址:" + var sendColumn = $("input[name='subfield']:checked").next().text(); + $(".orgDirection").text(orgDirection + sendText + " / " + sendColumn); + } + diff --git a/config/routes.rb b/config/routes.rb index 4121639c0..b9622c047 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -47,6 +47,7 @@ RedmineApp::Application.routes.draw do post 'join_project_menu' post 'join_projects' post 'logout' + get 'org_resources_subfield' end collection do get 'check_uniq' @@ -500,6 +501,7 @@ RedmineApp::Application.routes.draw do get "search_user_course" post "add_exist_file_to_course" post "add_exist_file_to_project" + post 'add_exist_file_to_org' get 'resource_preview' get 'rename_resource' get 'search_user_project' @@ -510,6 +512,8 @@ RedmineApp::Application.routes.draw do get 'store_selected_resource' get 'user_organizations' get 'search_user_orgs' + get 'search_user_org' #for send resource + # end end #resources :blogs diff --git a/db/migrate/20151229045505_create_attachment_histories.rb b/db/migrate/20151229045505_create_attachment_histories.rb new file mode 100644 index 000000000..21b599a96 --- /dev/null +++ b/db/migrate/20151229045505_create_attachment_histories.rb @@ -0,0 +1,24 @@ +class CreateAttachmentHistories < ActiveRecord::Migration + def change + create_table :attachment_histories do |t| + t.integer :container_id + t.string :container_type + t.string :filename , :default => "" + t.string :disk_filename, :default => "" + t.integer :filesize, :default => 0 + t.string :content_type, :default => "" + t.string :digest , :default => "",:limit=>40 + t.integer :downloads, :default => 0 + t.integer :author_id + t.datetime :created_on + t.string :description + t.string :disk_directory + t.integer :attachtype + t.integer :is_public + t.integer :copy_from + t.integer :quotes + t.integer :version + t.integer :version_id + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 8e946c493..8e9bff4e2 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20151218110033) do +ActiveRecord::Schema.define(:version => 20151229045505) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -80,6 +80,27 @@ ActiveRecord::Schema.define(:version => 20151218110033) do add_index "at_messages", ["user_id"], :name => "index_at_messages_on_user_id" + create_table "attachment_histories", :force => true do |t| + t.integer "container_id" + t.string "container_type" + t.string "filename", :default => "" + t.string "disk_filename", :default => "" + t.integer "filesize", :default => 0 + t.string "content_type", :default => "" + t.string "digest", :limit => 40, :default => "" + t.integer "downloads", :default => 0 + t.integer "author_id" + t.datetime "created_on" + t.string "description" + t.string "disk_directory" + t.integer "attachtype" + t.integer "is_public" + t.integer "copy_from" + t.integer "quotes" + t.integer "version" + t.integer "version_id" + end + create_table "attachments", :force => true do |t| t.integer "container_id" t.string "container_type", :limit => 30 @@ -97,6 +118,7 @@ ActiveRecord::Schema.define(:version => 20151218110033) do t.integer "is_public", :default => 1 t.integer "copy_from" t.integer "quotes" + t.integer "version", :default => 0 end add_index "attachments", ["author_id"], :name => "index_attachments_on_author_id" @@ -558,26 +580,23 @@ ActiveRecord::Schema.define(:version => 20151218110033) do add_index "documents", ["created_on"], :name => "index_documents_on_created_on" add_index "documents", ["project_id"], :name => "documents_project_id" - create_table "dts", :primary_key => "Num", :force => true do |t| - t.string "Defect", :limit => 50 - t.string "Category", :limit => 50 - t.string "File" - t.string "Method" - t.string "Module", :limit => 20 - t.string "Variable", :limit => 50 - t.integer "StartLine" - t.integer "IPLine" - t.string "IPLineCode", :limit => 200 - t.string "Judge", :limit => 15 - t.integer "Review", :limit => 1 + create_table "dts", :force => true do |t| + t.string "IPLineCode" t.string "Description" - t.text "PreConditions", :limit => 2147483647 - t.text "TraceInfo", :limit => 2147483647 - t.text "Code", :limit => 2147483647 + t.string "Num" + t.string "Variable" + t.string "TraceInfo" + t.string "Method" + t.string "File" + t.string "IPLine" + t.string "Review" + t.string "Category" + t.string "Defect" + t.string "PreConditions" + t.string "StartLine" t.integer "project_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "id", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "editor_of_documents", :force => true do |t| @@ -926,6 +945,16 @@ ActiveRecord::Schema.define(:version => 20151218110033) do add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id" + create_table "journal_details_copy", :force => true do |t| + t.integer "journal_id", :default => 0, :null => false + t.string "property", :limit => 30, :default => "", :null => false + t.string "prop_key", :limit => 30, :default => "", :null => false + t.text "old_value" + t.text "value" + end + + add_index "journal_details_copy", ["journal_id"], :name => "journal_details_journal_id" + create_table "journal_replies", :id => false, :force => true do |t| t.integer "journal_id" t.integer "user_id" diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 3d9fba942..8932f98a3 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -978,6 +978,15 @@ $(document).ready(function () { } }); +//点击发送资源弹出框中的组织,要更改选择栏目中的内容 +//@dom 选中的radio,值为org_id +function change_org_subfield(url){ + $.ajax({ + type:'get', + url:url + }) +} + //点击图片即显示大图 function showNormalImage(id) { var description_images=$('div#'+id).find("img"); @@ -1001,4 +1010,4 @@ $(function(){ var userId = $(this).attr('data-user-id'); $(window.location).attr('href', '/users/'+userId); }); -}); \ No newline at end of file +}); diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index 9b6f4f9fe..9df67452f 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -1392,3 +1392,19 @@ span.at {color:#269ac9;} .function{ background:url(../images/public_icon.png) -66px -70px no-repeat; width:18px; height:21px;} .weekly{ background:url(../images/public_icon.png) -66px -95px no-repeat; width:18px; height:21px;} +/*资源发送到org*/ +.shareDP {width:415px; height:auto; border:3px solid #269ac9; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:relative; z-index:1000;} +.shareArrow {background:url(../images/arrowList.png) -90px -108px no-repeat; display:inline-block; width:5px; height:10px; margin-right:3px;} +.sectionWrap {float:left; max-height:150px; margin-bottom:10px; overflow:auto; overflow-x:hidden; width:205px; min-height:150px; padding-top:5px; border:1px solid #dddddd;} +.columnWrap {float:left; max-height:155px; margin-bottom:10px; overflow:auto; overflow-x:hidden; width:178px; min-height:155px; border:1px solid #dddddd;} +.columnWrap li {padding-left:10px; color:#585858; line-height:20px;} +.columnWrap li:hover {background-color:#cccccc;} +.columnWrap span {width:150px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; display:inline-block; height:20px; vertical-align:top;} +.sectionRow:hover {background-color:#cccccc; cursor:pointer;} +.sectionContent {} +.sectionContent li {padding-left:10px; line-height:20px;} +.sectionContent li:hover {background-color:#cccccc;} +.sectionContent span {width:160px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; display:inline-block; height:20px; vertical-align:top;} +.orgDirection {width:392px; background-color:#f1f1f1; height:30px; vertical-align:middle; line-height:30px; color:#585858; padding-left:10px;} +.orgSendSearch {border:1px solid #dddddd; outline:none; width:262px; height:22px; padding-left:10px; float:left;} + diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index 394a0cb12..c0336ddcd 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -408,23 +408,35 @@ a:hover.search_btn{ background: #0fa9bb;} /*发送资源弹窗*/ /*.resourceShareContainer {width:100%; height:100%; background:#666; filter:alpha(opacity=50); opacity:0.5; -moz-opacity:0.5; position:absolute; left:0; top:0; z-index:-999;}*/ -.resourceSharePopup {width:300px; height:auto; border:3px solid #269ac9; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-150px; z-index:1000;} -.sendText {font-size:16px; color:#269ac9; line-height:16px; padding-top:20px; width:100px; display:inline-block; font-weight:bold;} +/*发送资源弹窗*/ +/*.resourceShareContainer {width:100%; height:100%; background:#666; filter:alpha(opacity=50); opacity:0.5; -moz-opacity:0.5; position:absolute; left:0; top:0; z-index:-999;}*/ +/*.resourceSharePopup {width:300px; height:auto; border:3px solid #15bccf; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-150px; z-index:1000;}*/ +.resourceSharePopup {width:300px; height:auto; border:3px solid #269ac9 !important; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-150px; z-index:1000;} +.sendText {font-size:16px; color:#269ac9; line-height:16px; padding-top:20px; width:110px; display:inline-block; font-weight: bold;} .resourcesSendTo {float:left; height:20px; margin-top:15px;} +.boxContainer {height:33px; line-height:33px; position:relative} .resourcesSendType {border:1px solid #e6e6e6; width:60px; height:24px; outline:none; font-size:14px; color:#888888;} .resourcePopupClose {width:20px; height:20px; display:inline-block; float:right;} .resourceClose {background:url(images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000;} .resourcesSearchBox {border:1px solid #e6e6e6; width:225px; height:25px; background-color:#ffffff; margin-top:12px; margin-bottom:15px;} .searchResourcePopup {border:none; outline:none; background-color:#ffffff; width:184px; height:25px; padding-left:10px; display:inline-block; float:left;} -.courseSend {width:260px; height:15px; line-height:15px; margin-bottom:10px;} +.searchIconPopup{width:31px; height:25px; background-color:#ffffff; background:url(../images/homepage_icon.png) 5px -394px no-repeat; display:inline-block; float:left; cursor: pointer;} +.searchIconPopup:hover {background:url(../images/homepage_icon.png) 5px -420px no-repeat;} +.courseSend {width:390px; height:15px; line-height:15px; margin-bottom:10px;display:block;white-space:nowrap;} .courseSendCheckbox {padding:0px; margin:0px; width:12px; height:12px; margin-right:10px; display:inline-block; margin-top:2px;} -.sendCourseName {font-size:12px; color:#5f6060;} -.courseSendSubmit {width:50px; height:25px; line-height:25px; text-align:center; vertical-align:middle; background-color:#269ac9; margin-right:25px; float:left;} +.sendCourseName {font-size:12px; color:#5f6060;display:inline-block} +.courseSendSubmit {width:50px; height:25px; line-height:25px; text-align:center; vertical-align:middle; background-color:#269ac9; margin-right:25px; float:left;cursor: pointer;} .courseSendSubmit:hover {background-color:#297fb8;} .courseSendCancel {width:50px; height:25px; line-height:25px; text-align:center; vertical-align:middle; background-color:#c1c1c1; float:left} -.courseSendCancel:hover {background-color:#717171;} -.courseReferContainer {float:left; max-height:120px; overflow:scroll; overflow-x:hidden; margin-right:16px; margin-bottom:10px;} -a.sendSourceText {font-size:14px; color:#ffffff; display:block;} +.courseSendCancel:hover {background-color: #717171;} +a.sendSourceText {font-size:14px; color:#ffffff;} +input.sendSourceText {font-size:14px;color:#ffffff;background-color:#269ac9;cursor: pointer; outline: none; border: none; width: 50px; height: 25px;} +input.sendSourceText:hover {background-color:#297fb8;} +/*input.sendSourceText:hover {font-size:14px; color:#ffffff;}*/ +.resourcesSendTo {float:left; height:20px; margin-top:15px;} +.resourcesSendType {border:1px solid #e6e6e6; width:60px; height:24px; outline:none; font-size:14px; color:#888888;} +.courseReferContainer {float:left; max-height:120px;margin-right:16px;margin-bottom:10px; overflow:auto; overflow-x:hidden;} +.popbox{/* width:300px; *//* height:100px; */position:fixed !important;/* z-index:100; */left:50%;top:50%;margin:-100px 0 0 -150px; /* background:#fff; */ -moz-border-radius:5px; /* -webkit-border-radius:5px; */ /* border-radius:5px; */ /* box-shadow:0px 0px 8px #194a81; */ /* overflow:auto; */} /*上传资源弹窗*/ .resourceUploadPopup {width:400px; height:auto; border:3px solid #269ac9; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-200px; z-index:1000;} @@ -924,4 +936,19 @@ span.at {color:#269ac9;} .codeIcon {background:url(../images/hwork_icon.png) -78px -160px no-repeat; padding-left:23px;} .othersIcon {background:url(../images/hwork_icon.png) -3px -210px no-repeat; padding-left:23px;} .thesisIcon {background:url(../images/hwork_icon.png) -78px -212px no-repeat; padding-left:23px;} -.softwareIcon {background:url(../images/hwork_icon.png) -5px -254px no-repeat; padding-left:23px;} \ No newline at end of file +.softwareIcon {background:url(../images/hwork_icon.png) -5px -254px no-repeat; padding-left:23px;} + +.shareDP {width:415px; height:auto; border:3px solid #269ac9; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:relative; z-index:1000;} +.shareArrow {background:url(../images/arrowList.png) -90px -108px no-repeat; display:inline-block; width:5px; height:10px; margin-right:3px;} +.sectionWrap {float:left; max-height:150px; margin-bottom:10px; overflow:auto; overflow-x:hidden; width:205px; min-height:150px; padding-top:5px; border:1px solid #dddddd;} +.columnWrap {float:left; max-height:155px; margin-bottom:10px; overflow:auto; overflow-x:hidden; width:178px; min-height:155px; border:1px solid #dddddd;} +.columnWrap li {padding-left:10px; color:#585858; line-height:20px;} +.columnWrap li:hover {background-color:#cccccc;} +.columnWrap span {width:150px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; display:inline-block; height:20px; vertical-align:top;} +.sectionRow:hover {background-color:#cccccc; cursor:pointer;} +.sectionContent {} +.sectionContent li {padding-left:10px; line-height:20px;} +.sectionContent li:hover {background-color:#cccccc;} +.sectionContent span {width:160px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; display:inline-block; height:20px; vertical-align:top;} +.orgDirection {width:392px; background-color:#f1f1f1; height:30px; vertical-align:middle; line-height:30px; color:#585858; padding-left:10px;} +.orgSendSearch {border:1px solid #dddddd; outline:none; width:262px; height:22px; padding-left:10px; float:left;} \ No newline at end of file diff --git a/spec/factories/attachment_histories.rb b/spec/factories/attachment_histories.rb new file mode 100644 index 000000000..3348cbd33 --- /dev/null +++ b/spec/factories/attachment_histories.rb @@ -0,0 +1,6 @@ +# Read about factories at https://github.com/thoughtbot/factory_girl + +FactoryGirl.define do + factory :attachment_history do + end +end diff --git a/spec/models/attachment_history_spec.rb b/spec/models/attachment_history_spec.rb new file mode 100644 index 000000000..58e38025d --- /dev/null +++ b/spec/models/attachment_history_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe AttachmentHistory, :type => :model do + pending "add some examples to (or delete) #{__FILE__}" +end From 15cff47c9268f0389a0a7aa8fc215e5f7b897d0c Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Tue, 29 Dec 2015 17:13:48 +0800 Subject: [PATCH 07/57] =?UTF-8?q?1.=E8=BD=AC=E5=8F=91=E5=B8=96=E5=AD=90?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E5=BD=93=E7=BB=84=E7=BB=87=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E6=A0=8F=E7=9B=AE=E6=97=B6=EF=BC=8C=E7=BB=99?= =?UTF-8?q?=E5=87=BA=E6=8F=90=E7=A4=BA=EF=BC=9B=202.=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E6=96=87=E7=AB=A0=E7=9A=84=E9=99=84=E4=BB=B6=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=9C=A8=E7=BB=84=E7=BB=87=E5=8A=A8=E6=80=81/=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E6=96=87=E7=AB=A0=E5=88=97=E8=A1=A8=E4=B8=AD=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/organizations_controller.rb | 2 +- app/views/messages/_show_org_subfields.html.erb | 12 ++++++++---- app/views/organizations/_show_org_document.html.erb | 3 +++ 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index aba656750..466fbd8e3 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -14,7 +14,7 @@ class OrganizationsController < ApplicationController include PollHelper helper :user_score helper :journals - + helper :attachments # added by liuping 关注 helper :watchers diff --git a/app/views/messages/_show_org_subfields.html.erb b/app/views/messages/_show_org_subfields.html.erb index 659e1230e..cbd316ea4 100644 --- a/app/views/messages/_show_org_subfields.html.erb +++ b/app/views/messages/_show_org_subfields.html.erb @@ -2,10 +2,14 @@ <% if !org.nil? %> 组织:<%= org.name %> - <% org.org_subfields.where("field_type='Post'").each do |subfield| %> -
  • - -
  • + <% if org.org_subfields.where("field_type='Post'").count > 0 %> + <% org.org_subfields.where("field_type='Post'").each do |subfield| %> +
  • + +
  • + <% end %> + <% else %> +
  • 暂无资源栏目
  • <% end %> <% else %> 请在左侧选择组织 diff --git a/app/views/organizations/_show_org_document.html.erb b/app/views/organizations/_show_org_document.html.erb index 2b0f11cdd..25f6d5044 100644 --- a/app/views/organizations/_show_org_document.html.erb +++ b/app/views/organizations/_show_org_document.html.erb @@ -18,6 +18,9 @@ <%= document.content.html_safe %> <% end %> +
    + <%= link_to_attachments_course document, :author => false %> +
    From c425106d0b071eb329a5c2045026a01cec54897c Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Tue, 29 Dec 2015 17:26:45 +0800 Subject: [PATCH 08/57] =?UTF-8?q?=E7=9B=AE=E6=A0=87=E5=9C=B0=E5=9D=80?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_resource_share_for_orgs.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/_resource_share_for_orgs.html.erb b/app/views/users/_resource_share_for_orgs.html.erb index f35b2faec..222c8a6de 100644 --- a/app/views/users/_resource_share_for_orgs.html.erb +++ b/app/views/users/_resource_share_for_orgs.html.erb @@ -45,7 +45,7 @@
    -
    目标地址:
    +
    目标地址:
    <%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %>
    From 1103e7eab49ae1db16f64372944a62c660bca6c7 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Tue, 29 Dec 2015 17:38:59 +0800 Subject: [PATCH 09/57] find org where type is Resource --- app/controllers/users_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 4d8eaf2cb..af7a1ba9a 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -2027,11 +2027,11 @@ class UsersController < ApplicationController def search_user_org @user = User.current - if !params[:search].nil? + if !params[:search].nil? #发送到有栏目类型为资源的组织中 search = "%#{params[:search].to_s.strip.downcase}%" - @orgs = @user.organizations.where("name like ?", search) + @orgs = @user.organizations.where("name like ?", search).select{|org| OrgSubfield.where("organization_id = #{org.id} and field_type='Resource'").count > 0} else - @orgs = @user.organizations + @orgs = @user.organizations.select{|org| OrgSubfield.where("organization_id = #{org.id} and field_type='Resource'").count > 0} end @search = params[:search] #这里仅仅是传递需要发送的资源id From 659f322ca28921e7b026750f693422e980681833 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Tue, 29 Dec 2015 17:58:36 +0800 Subject: [PATCH 10/57] send resource to org --- app/controllers/users_controller.rb | 16 +++++++--------- .../users/_resource_share_for_orgs.html.erb | 2 ++ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index af7a1ba9a..0c1477865 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1617,12 +1617,12 @@ class UsersController < ApplicationController @flag = true if params[:send_id].present? send_id = params[:send_id] - subfield_id = params[:subfield_id] + subfield_id = params[:subfield] if subfield_id.nil? @flag = false end ori = Attachment.find_by_id(send_id) - unless org_id.nil? + unless subfield_id.nil? attach_copied_obj = ori.copy attach_copied_obj.tag_list.add(ori.tag_list) # tag关联 attach_copied_obj.container = OrgSubfield.find(subfield_id) @@ -1635,33 +1635,31 @@ class UsersController < ApplicationController end elsif params[:send_ids].present? send_ids = params[:send_ids].split(" ") - project_ids = params[:projects_ids] - if project_ids.nil? + subfield_id = params[:subfield] + if subfield_id.nil? @flag = false end send_ids.each do |send_id| ori = Attachment.find_by_id(send_id) - unless project_ids.nil? - project_ids.each do |project_id| + unless subfield_id.nil? next if ori.blank? attach_copied_obj = ori.copy attach_copied_obj.tag_list.add(ori.tag_list) # tag关联 - attach_copied_obj.container = Project.find(project_id) + attach_copied_obj.container = OrgSubfield.find(subfield_id) 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 attach_copied_obj.save - end end end else @flag=true end user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源 - @attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+ + @attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+ "or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc") @type = params[:type] @limit = 25 diff --git a/app/views/users/_resource_share_for_orgs.html.erb b/app/views/users/_resource_share_for_orgs.html.erb index 222c8a6de..e7ddbd6f5 100644 --- a/app/views/users/_resource_share_for_orgs.html.erb +++ b/app/views/users/_resource_share_for_orgs.html.erb @@ -19,6 +19,8 @@
    <%= form_tag add_exist_file_to_org_user_path(user),:remote=>true,:id=>'orgs_list_form' do %> + <%= hidden_field_tag(:send_id, send_id) %> + <%= hidden_field_tag(:send_ids, send_ids) %>
      <% unless @orgs.empty? %> From 1d0e6e1c5c47845f1d63f2bff492d981988dc1d2 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Wed, 30 Dec 2015 09:37:16 +0800 Subject: [PATCH 11/57] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=8F=91=E9=80=81?= =?UTF-8?q?=E8=B5=84=E6=BA=90=20=E4=BB=A5=E5=8F=8A=20=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=8F=91=E9=80=81=E8=B5=84=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 21 +++++++++----------- app/helpers/users_helper.rb | 2 ++ app/views/users/add_exist_file_to_org.js.erb | 10 ++++++++++ 3 files changed, 21 insertions(+), 12 deletions(-) create mode 100644 app/views/users/add_exist_file_to_org.js.erb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 0c1477865..3aa86946f 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -618,7 +618,7 @@ class UsersController < ApplicationController end if(params[:type].blank? || params[:type] == "1") #全部 user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源 - @attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+ + @attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+ "or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc") elsif params[:type] == "2" #课程资源 user_course_ids = User.current.courses.map { |c| c.id} @@ -1326,12 +1326,12 @@ class UsersController < ApplicationController if(params[:type].blank?|| params[:type] == "1") #全部 if User.current.id.to_i == params[:id].to_i user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源 - @attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+ + @attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+ "or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc") else user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #Ta的资源库的话,应该是他上传的公开资源 加上 他加入的所有我可见课程里的公开资源 @attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 " + - "and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) " + + "and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) " + "or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc") end elsif params[:type] == "2" #课程资源 @@ -1388,12 +1388,12 @@ class UsersController < ApplicationController if(params[:type].nil? || params[:type].blank? || params[:type] == "1" || params[:type] == 'all') #全部 if User.current.id.to_i == params[:id].to_i user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源 - @attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+ + @attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+ "or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc") else user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #Ta的资源库的话,应该是他上传的公开资源 加上 他加入的所有我可见课程里的公开资源 @attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 " + - "and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) " + + "and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) " + "or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc") end elsif params[:type] == "2" #课程资源 @@ -1529,7 +1529,7 @@ class UsersController < ApplicationController @flag = false end user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源 - @attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+ + @attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+ "or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc") @type = params[:type] @limit = 25 @@ -1597,7 +1597,7 @@ class UsersController < ApplicationController @flag=true end user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源 - @attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+ + @attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+ "or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc") @type = params[:type] @limit = 25 @@ -1673,9 +1673,6 @@ class UsersController < ApplicationController respond_to do |format| format.js end - respond_to do |format| - format.js - end end def change_org_subfield @@ -1894,12 +1891,12 @@ class UsersController < ApplicationController if(params[:type].blank? || params[:type] == "1") #全部 if User.current.id.to_i == params[:id].to_i user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源 - @attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+ + @attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+ "or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc") else user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #Ta的资源库的话,应该是他上传的公开资源 加上 他加入的所有我可见课程里的公开资源 @attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 " + - "and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) " + + "and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) " + "or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc") end elsif params[:type] == "2" #课程资源 diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 963284f7f..d1ab6661a 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -49,6 +49,8 @@ module UsersHelper '批改附件' when 'Principal' '用户资源' + when 'OrgSubfield' + '组织资源' end end diff --git a/app/views/users/add_exist_file_to_org.js.erb b/app/views/users/add_exist_file_to_org.js.erb new file mode 100644 index 000000000..57fe9d42d --- /dev/null +++ b/app/views/users/add_exist_file_to_org.js.erb @@ -0,0 +1,10 @@ +<% if @flag == true%> +$("#search_div").html('<%= escape_javascript( render :partial => 'resource_search_form',:locals => {:user=>@user,:type=>@type} ) %>'); +$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>'); +$("#res_count").html(0); +$("#checkboxAll").attr('checked',false); +$("#res_all_count").html(<%= @atta_count%>); +hideModal(); +alert("发送成功") +<% else%> +<% end %> \ No newline at end of file From aa87ef6f1b1fa0af00debb856643dfd31a71a99e Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 30 Dec 2015 09:40:15 +0800 Subject: [PATCH 12/57] =?UTF-8?q?=E8=A7=A3=E5=86=B3Chrome=E6=B5=8F?= =?UTF-8?q?=E8=A7=88=E5=99=A8=E7=AD=89=E6=AF=94=E7=BC=A9=E6=94=BE=E5=90=8E?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E9=94=99=E4=B9=B1=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/messages/_project_show.html.erb | 224 +++++++++++----------- 1 file changed, 113 insertions(+), 111 deletions(-) diff --git a/app/views/messages/_project_show.html.erb b/app/views/messages/_project_show.html.erb index bd2e3469a..a0a340a2a 100644 --- a/app/views/messages/_project_show.html.erb +++ b/app/views/messages/_project_show.html.erb @@ -92,132 +92,134 @@ showNormalImage('message_description_<%= @topic.id %>'); }); -
      -
      -
      - <%= link_to image_tag(url_to_avatar(@topic.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@topic.author) %> -
      -
      - <% if @topic.author.id == User.current.id%> - - <%end%> -
      - 主题: <%= @topic.subject%> +
      +
      +
      +
      + <%= link_to image_tag(url_to_avatar(@topic.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@topic.author) %>
      -
      +
      + <% if @topic.author.id == User.current.id%> + + <%end%> + +
      -
      - <% if @topic.try(:author).try(:realname) == ' ' %> - <%= link_to @topic.try(:author), user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> - <% else %> - <%= link_to @topic.try(:author).try(:realname), user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> - <% end %> -
      -
      <%= format_time( @topic.created_on)%>
      -
      -
      - <%= @topic.content.html_safe%> +
      + <% if @topic.try(:author).try(:realname) == ' ' %> + <%= link_to @topic.try(:author), user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> + <% else %> + <%= link_to @topic.try(:author).try(:realname), user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> + <% end %> +
      +
      <%= format_time( @topic.created_on)%>
      +
      +
      + <%= @topic.content.html_safe%> +
      +
      +
      + <%= link_to_attachments_course @topic, :author => false %> +
      -
      - <%= link_to_attachments_course @topic, :author => false %> -
      -
      -
      -
      - <% unless @replies.empty? %> -
      -
      回复(<%=@reply_count %>)
      -
      - -
      -
      - <% @replies.each_with_index do |reply,i| %> - -
      -
      - <%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %> -
      -
      -
      - <% if reply.try(:author).try(:realname) == ' ' %> - <%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> - <% else %> - <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> - <% end %> -
      -
      - <%= reply.content.html_safe%> +
      +
      + <% @replies.each_with_index do |reply,i| %> + +
      +
      + <%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
      -
      - <%= format_time(reply.created_on) %> - -
      -
      - <% end %> -
      - - <% end %> -
      - <% if !@topic.locked? && authorize_for('messages', 'reply') %> -
      - -
      -
      - <%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'message_form'} do |f| %> - <%= render :partial => 'form_project', :locals => {:f => f, :replying => true} %> - <%= link_to l(:button_cancel), "javascript:void(0)", :onclick => 'project_board_cancel_message_replay();', :class => "blue_btn grey_btn fr c_white mt10 mr5" %> - <%= link_to l(:button_submit), "javascript:void(0)", :onclick => 'project_board_submit_message_replay();', :class => "blue_btn fr c_white mt10", :style => "margin-left: 50px;" %> <% end %> +
      + + <% end %> +
      + <% if !@topic.locked? && authorize_for('messages', 'reply') %> +
      +
      +
      + <%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'message_form'} do |f| %> + <%= render :partial => 'form_project', :locals => {:f => f, :replying => true} %> + <%= link_to l(:button_cancel), "javascript:void(0)", :onclick => 'project_board_cancel_message_replay();', :class => "blue_btn grey_btn fr c_white mt10 mr5" %> + <%= link_to l(:button_submit), "javascript:void(0)", :onclick => 'project_board_submit_message_replay();', :class => "blue_btn fr c_white mt10", :style => "margin-left: 50px;" %> + <% end %> +
      +
      -
      - <% end %> + <% end %> +
      -
      \ No newline at end of file +
      From fd4d2910d0de9862e8e37efef740710d36b25148 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Wed, 30 Dec 2015 10:00:45 +0800 Subject: [PATCH 13/57] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=8F=91=E9=80=81?= =?UTF-8?q?=E8=B5=84=E6=BA=90=20=E4=BB=A5=E5=8F=8A=20=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=8F=91=E9=80=81=E8=B5=84=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/files/index.html.erb | 18 +++++++++++++++++- .../users/_resource_share_for_orgs.html.erb | 2 +- app/views/users/user_resource.html.erb | 14 ++++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb index 6db472cda..0010f0b4f 100644 --- a/app/views/files/index.html.erb +++ b/app/views/files/index.html.erb @@ -274,6 +274,19 @@ $this.bind('keyup click mousemove', reset); }); } + function check_des(event){ + if($(".sectionContent").find('input[type="radio"]:checked').length <= 0){ + event.preventDefault(); + $(".orgDirection").text('目标地址组织不能为空') + return false; + }else if($(".columnContent").find('input[type="radio"]:checked').length <= 0){ + event.preventDefault(); + $(".orgDirection").text('目标地址栏目不能为空') + return false; + }else{ + return true; + } + } <% if User.current.logged? %> var sendType = '1'; @@ -290,7 +303,10 @@ url: '<%= search_user_course_user_path(User.current)%>' + '?send_id=' + id }); }else if( lastSendType == '3'){//组织 - + $.ajax({ + type: 'get', + url: '<%= search_user_org_user_path(User.current)%>' + '?send_id=' + id + }); }else{ $.ajax({ type: 'get', diff --git a/app/views/users/_resource_share_for_orgs.html.erb b/app/views/users/_resource_share_for_orgs.html.erb index e7ddbd6f5..08405a347 100644 --- a/app/views/users/_resource_share_for_orgs.html.erb +++ b/app/views/users/_resource_share_for_orgs.html.erb @@ -49,7 +49,7 @@
      目标地址:
      - <%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %> + <%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();',:onclick=>"check_des(event);" %>
      取消 diff --git a/app/views/users/user_resource.html.erb b/app/views/users/user_resource.html.erb index 09f8a998d..b5928940a 100644 --- a/app/views/users/user_resource.html.erb +++ b/app/views/users/user_resource.html.erb @@ -41,6 +41,20 @@ function submit_files(){ $("#upload_form").submit(); } + + function check_des(event){ + if($(".sectionContent").find('input[type="radio"]:checked').length <= 0){ + event.preventDefault(); + $(".orgDirection").text('目标地址组织不能为空') + return false; + }else if($(".columnContent").find('input[type="radio"]:checked').length <= 0){ + event.preventDefault(); + $(".orgDirection").text('目标地址栏目不能为空') + return false; + }else{ + return true; + } + }
      资源库
      From 4f331d95c708e32388a7efd9319290f212c7064c Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 30 Dec 2015 10:08:59 +0800 Subject: [PATCH 14/57] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=AE=A8=E8=AE=BA?= =?UTF-8?q?=E5=8C=BA=E3=80=81=E9=A1=B9=E7=9B=AE=E8=AE=A8=E8=AE=BA=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E7=9A=84=E6=97=B6=E5=80=99=E6=98=BE=E7=A4=BA=E9=99=84?= =?UTF-8?q?=E4=BB=B6=E4=BF=A1=E6=81=AF=E4=B8=8D=E4=B8=80=E8=87=B4=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/attachments/_form_course.html.erb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/views/attachments/_form_course.html.erb b/app/views/attachments/_form_course.html.erb index 348c5339d..6d921903d 100644 --- a/app/views/attachments/_form_course.html.erb +++ b/app/views/attachments/_form_course.html.erb @@ -4,10 +4,10 @@ <% container.saved_attachments.each_with_index do |attachment, i| %> - <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%> - <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %> - <%= l(:field_is_public)%>: - <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false, :class => 'is_public_checkbox')%> + <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'upload_filename readonly', :readonly=>'readonly')%> + <%#= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %> + + <%#= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false, :class => 'is_public_checkbox')%> <%= link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') %> <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> @@ -17,10 +17,10 @@ <% container.attachments.each_with_index do |attachment, i| %> - <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%> - <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %> - <%= l(:field_is_public)%>: - <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false, :class => 'is_public_checkbox')%> + <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'upload_filename readonly', :readonly=>'readonly')%> + <%#= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %> + + <%#= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false, :class => 'is_public_checkbox')%> <%= link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') %> <%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %> From 90c63192e6baa3dd2c48ba115bc9d96dd19df501 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Wed, 30 Dec 2015 10:32:32 +0800 Subject: [PATCH 15/57] =?UTF-8?q?=E5=8E=86=E5=8F=B2=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/attachment.rb | 4 ++++ app/models/attachment_history.rb | 2 +- ...chment_histories_column_version_id_to_attachment_id.rb | 8 ++++++++ db/schema.rb | 4 ++-- 4 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 db/migrate/20151230022443_rename_attachment_histories_column_version_id_to_attachment_id.rb diff --git a/app/models/attachment.rb b/app/models/attachment.rb index ae23428f1..f08bcdddf 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -519,6 +519,10 @@ class Attachment < ActiveRecord::Base end end + #更新文件的版本 + def update_attchment_version + end + private # Physically deletes the file from the file system diff --git a/app/models/attachment_history.rb b/app/models/attachment_history.rb index 4ff1ddd0d..2160d242d 100644 --- a/app/models/attachment_history.rb +++ b/app/models/attachment_history.rb @@ -1,3 +1,3 @@ class AttachmentHistory < ActiveRecord::Base - belongs_to :attachment,foreign_key: 'attach_id' + belongs_to :attachment,foreign_key: 'attachment_id' end diff --git a/db/migrate/20151230022443_rename_attachment_histories_column_version_id_to_attachment_id.rb b/db/migrate/20151230022443_rename_attachment_histories_column_version_id_to_attachment_id.rb new file mode 100644 index 000000000..15d0837d3 --- /dev/null +++ b/db/migrate/20151230022443_rename_attachment_histories_column_version_id_to_attachment_id.rb @@ -0,0 +1,8 @@ +class RenameAttachmentHistoriesColumnVersionIdToAttachmentId < ActiveRecord::Migration + def up + rename_column :attachment_histories,:version_id,:attachment_id + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index 8e9bff4e2..374b44abf 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20151229045505) do +ActiveRecord::Schema.define(:version => 20151230022443) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -98,7 +98,7 @@ ActiveRecord::Schema.define(:version => 20151229045505) do t.integer "copy_from" t.integer "quotes" t.integer "version" - t.integer "version_id" + t.integer "attachment_id" end create_table "attachments", :force => true do |t| From 40bf109223a03fbd84345716b2e48e7dff8e4032 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Wed, 30 Dec 2015 10:34:37 +0800 Subject: [PATCH 16/57] =?UTF-8?q?=E7=BB=99=E8=B5=84=E6=BA=90=E6=A0=8F?= =?UTF-8?q?=E7=9B=AE=E5=A2=9E=E5=8A=A0board?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/board.rb | 1 + app/models/org_subfield.rb | 15 +++++++++++++++ config/locales/zh.yml | 1 + .../20151230015225_add_quotes_to_messages.rb | 4 ++++ ...0151230015410_add_org_subfield_id_to_boards.rb | 5 +++++ .../20151230015904_set_board_for_org_subfields.rb | 11 +++++++++++ db/schema.rb | 4 +++- 7 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20151230015225_add_quotes_to_messages.rb create mode 100644 db/migrate/20151230015410_add_org_subfield_id_to_boards.rb create mode 100644 db/migrate/20151230015904_set_board_for_org_subfields.rb diff --git a/app/models/board.rb b/app/models/board.rb index 67d59e599..b66719edf 100644 --- a/app/models/board.rb +++ b/app/models/board.rb @@ -19,6 +19,7 @@ class Board < ActiveRecord::Base include Redmine::SafeAttributes belongs_to :project,:touch => true belongs_to :course,:touch=>true + belongs_to :org_subfield, :touch => true has_many :topics, :class_name => 'Message', :conditions => "#{Message.table_name}.parent_id IS NULL", :order => "#{Message.table_name}.created_on DESC" has_many :messages, :dependent => :destroy, :order => "#{Message.table_name}.created_on DESC" belongs_to :last_message, :class_name => 'Message', :foreign_key => :last_message_id diff --git a/app/models/org_subfield.rb b/app/models/org_subfield.rb index 6a31203b0..0747114ca 100644 --- a/app/models/org_subfield.rb +++ b/app/models/org_subfield.rb @@ -4,7 +4,22 @@ class OrgSubfield < ActiveRecord::Base has_many :files has_many :org_subfield_messages, :dependent => :destroy has_many :messages, :through => :org_subfield_messages + has_many :boards, :dependent => :destroy acts_as_attachable + after_create :create_board_sync + # 创建资源栏目讨论区 + def create_board_sync + @board = self.boards.build + #self.name=" #{l(:label_borad_course) }" + @board.name = " #{l(:label_borad_org_subfield) }"#self.name + @board.description = self.name.to_s + @board.project_id = -1 + if @board.save + logger.debug "[OrgSubfield Model] ===> #{@board.to_json}" + else + logger.error "[OrgSubfield Model] ===> Auto create board when org_subfield saved, because #{@board.full_messages}" + end + end def project end diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 230532d71..e4a23373d 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1728,6 +1728,7 @@ zh: label_hot_project: '热门项目' label_borad_project: 项目讨论区 label_borad_course: 课程讨论区 + label_borad_org_subfield: 资源栏目讨论区 view_borad_course: 课程讨论 label_memo_create_succ: 发布成功 label_memo_create_fail: 发布失败 diff --git a/db/migrate/20151230015225_add_quotes_to_messages.rb b/db/migrate/20151230015225_add_quotes_to_messages.rb new file mode 100644 index 000000000..4e19725d5 --- /dev/null +++ b/db/migrate/20151230015225_add_quotes_to_messages.rb @@ -0,0 +1,4 @@ +class AddQuotesToMessages < ActiveRecord::Migration + def change + end +end diff --git a/db/migrate/20151230015410_add_org_subfield_id_to_boards.rb b/db/migrate/20151230015410_add_org_subfield_id_to_boards.rb new file mode 100644 index 000000000..853238813 --- /dev/null +++ b/db/migrate/20151230015410_add_org_subfield_id_to_boards.rb @@ -0,0 +1,5 @@ +class AddOrgSubfieldIdToBoards < ActiveRecord::Migration + def change + add_column :boards, :org_subfield_id, :integer + end +end diff --git a/db/migrate/20151230015904_set_board_for_org_subfields.rb b/db/migrate/20151230015904_set_board_for_org_subfields.rb new file mode 100644 index 000000000..cad6526a0 --- /dev/null +++ b/db/migrate/20151230015904_set_board_for_org_subfields.rb @@ -0,0 +1,11 @@ +# encoding: utf-8 +class SetBoardForOrgSubfields < ActiveRecord::Migration + def up + OrgSubfield.where("field_type='Post'").each do |field| + Board.create(:org_subfield_id => field.id, :name => "资源栏目讨论区", :project_id => -1, :description => field.name) + end + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index fab2d5700..925192317 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20151224090313) do +ActiveRecord::Schema.define(:version => 20151230015904) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -198,6 +198,7 @@ ActiveRecord::Schema.define(:version => 20151224090313) do t.integer "last_message_id" t.integer "parent_id" t.integer "course_id" + t.integer "org_subfield_id" end add_index "boards", ["last_message_id"], :name => "index_boards_on_last_message_id" @@ -1045,6 +1046,7 @@ ActiveRecord::Schema.define(:version => 20151224090313) do t.boolean "locked", :default => false t.integer "sticky", :default => 0 t.integer "reply_id" + t.integer "quotes" end add_index "messages", ["author_id"], :name => "index_messages_on_author_id" From 9348cc9c241a3bf0a2dfeb0163e3bd6b2008d970 Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 30 Dec 2015 15:22:26 +0800 Subject: [PATCH 17/57] =?UTF-8?q?=E7=BC=96=E7=A8=8B=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E5=8C=BF=E8=AF=84=E6=B7=BB=E5=8A=A0=E7=B3=BB=E7=BB=9F=E8=AF=84?= =?UTF-8?q?=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/student_work/_evaluation_title.html.erb | 6 ++++++ app/views/student_work/_evaluation_work.html.erb | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/app/views/student_work/_evaluation_title.html.erb b/app/views/student_work/_evaluation_title.html.erb index 7398dbee1..1e006a6a6 100644 --- a/app/views/student_work/_evaluation_title.html.erb +++ b/app/views/student_work/_evaluation_title.html.erb @@ -13,6 +13,12 @@ 时间 + <% if @homework.homework_type == 2%> +
    • + 系统 +
    • + <% end%> +
    • 我的评分
    • diff --git a/app/views/student_work/_evaluation_work.html.erb b/app/views/student_work/_evaluation_work.html.erb index db680cbec..e65d4f267 100644 --- a/app/views/student_work/_evaluation_work.html.erb +++ b/app/views/student_work/_evaluation_work.html.erb @@ -75,6 +75,13 @@ + <% if @homework.homework_type == 2%> + +
    • + <%= student_work.system_score.nil? ? "--" : format("%.1f",student_work.system_score)%> +
    • + <% end%> + <% my_score = student_work_score(student_work,User.current) %>
    • <%= my_score.nil? ? "--" : format("%.1f",my_score.score)%> From dcfe89c544edd943b344fe3060ced6f2f960ae41 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Wed, 30 Dec 2015 15:46:01 +0800 Subject: [PATCH 18/57] =?UTF-8?q?=E5=B8=96=E5=AD=90=E5=8F=91=E9=80=81?= =?UTF-8?q?=E5=88=B0=E7=BB=84=E7=BB=87=E8=B5=84=E6=BA=90=E6=A0=8F=E7=9B=AE?= =?UTF-8?q?=EF=BC=8C=E5=90=8C=E6=97=B6=E5=A2=9E=E5=8A=A0=E5=A2=9E=E5=88=A0?= =?UTF-8?q?=E6=9F=A5=E6=94=B9=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/messages_controller.rb | 43 +++- app/models/message.rb | 12 +- .../_org_subfield_message_edit.html.erb | 16 ++ app/views/boards/_org_subfield_new.html.erb | 74 +++++++ app/views/layouts/base_org.html.erb | 2 +- app/views/messages/_course_show.html.erb | 2 +- .../messages/_org_subfield_show.html.erb | 199 ++++++++++++++++++ app/views/messages/_project_show.html.erb | 2 +- app/views/messages/edit.html.erb | 12 ++ app/views/messages/reply.js.erb | 2 + app/views/messages/show.html.erb | 2 + .../organizations/_org_activities.html.erb | 6 +- .../_org_subfield_message.html.erb | 118 +++++++++++ .../org_subfield_message_edit.html.erb | 16 ++ config/routes.rb | 1 + public/javascripts/organization.js | 39 ++++ 16 files changed, 532 insertions(+), 14 deletions(-) create mode 100644 app/views/boards/_org_subfield_message_edit.html.erb create mode 100644 app/views/boards/_org_subfield_new.html.erb create mode 100644 app/views/messages/_org_subfield_show.html.erb create mode 100644 app/views/organizations/_org_subfield_message.html.erb create mode 100644 app/views/organizations/org_subfield_message_edit.html.erb create mode 100644 public/javascripts/organization.js diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 543521e0f..ae13b7e78 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -75,7 +75,7 @@ class MessagesController < ApplicationController @replies = paginateHelper messages_replies,10 @reply = Message.new(:subject => "RE: #{@message.subject}") render :action => "show", :layout => "base_courses"#by young - else + elsif @project @reply_pages = Paginator.new @reply_count, REPLIES_PER_PAGE, page @replies = @topic.children. includes(:author, :attachments, {:board => :project}). @@ -86,6 +86,18 @@ class MessagesController < ApplicationController @reply = Message.new(:subject => "RE: #{@message.subject}") render :action => "show", :layout => "base_projects"#by young + else + @reply_pages = Paginator.new @reply_count, REPLIES_PER_PAGE, page + @replies = @topic.children. + includes(:author, :attachments, {:board => :project}). + reorder("#{Message.table_name}.created_on DESC"). + limit(@reply_pages.per_page). + offset(@reply_pages.offset). + all + + @reply = Message.new(:subject => "RE: #{@message.subject}") + @organization = @org_subfield.organization + render :action => "show", :layout => "base_org"#by young end end @@ -248,7 +260,14 @@ class MessagesController < ApplicationController else respond_to do |format| format.html { - layout_file = @project ? 'base_projects' : 'base_courses' + if @project + layout_file = 'base_projects' + elsif @course + layout_file = 'base_courses' + elsif @org_subfield + @organization = @org_subfield.organization + layout_file = 'base_org' + end render :layout => layout_file } end @@ -287,6 +306,16 @@ class MessagesController < ApplicationController redirect_to course_board_url(@course, @board) end end + elsif @org_subfield + if params[:is_board] + redirect_to organization_path(:id => @org_subfield.organization_id, :org_subfield_id => @org_subfield.id) + else + if @message.parent + redirect_to board_message_url(@board, @message.parent, :r => r) + else + redirect_to organization_path(:id => @org_subfield.organization_id, :org_subfield_id => @org_subfield.id) + end + end end end @@ -319,18 +348,19 @@ class MessagesController < ApplicationController org_subfield_ids = params[:org_subfields] @message = Message.find(params[:id]) # @message.update_attribute(:updated_on, Time.now) - type = @message.board.course_id.nil? ? "Project":"Course" + # type = @message.board.course_id.nil? ? "Project":"Course" org_subfield_ids.each do |field_id| @message.quotes = @message.quotes.nil? ? 1 : (@message.quotes + 1) @message.save - mes = Message.create(:board_id => @message.board_id, :subject => @message.subject, :content => @message.content, :author_id => User.current.id, + board = OrgSubfield.find(field_id).boards.first + mes = Message.create(:board_id => board.id, :subject => @message.subject, :content => @message.content, :author_id => User.current.id, :created_on => Time.now, :updated_on => Time.now, :locked => @message.locked, :sticky => @message.sticky) @message.attachments.each do |attach| mes.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest, :downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype, :is_public => attach.is_public, :quotes => 0) end - OrgSubfieldMessage.create(:org_subfield_id => field_id.to_i, :message_id => mes.id, :message_type => type) + # OrgSubfieldMessage.create(:org_subfield_id => field_id.to_i, :message_id => mes.id, :message_type => type) # org_acts = OrgActivity.where("container_type='OrgSubfield' and container_id=? and org_act_type='Message' and org_act_id=?", field_id.to_i, @message.id) # if org_acts.all.size() > 0 # org_acts.first.update_attribute(:updated_at, Time.now) @@ -356,6 +386,9 @@ class MessagesController < ApplicationController @project = @board.project elsif @board.course_id @course = @board.course + else + @org_subfield = @board.org_subfield + @organization = @org_subfield end rescue ActiveRecord::RecordNotFound diff --git a/app/models/message.rb b/app/models/message.rb index 19531e270..dafdb767f 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -23,8 +23,8 @@ class Message < ActiveRecord::Base belongs_to :board,:touch => true belongs_to :author, :class_name => 'User', :foreign_key => 'author_id' has_many :praise_tread, as: :praise_tread_object, dependent: :destroy - has_many :org_subfield_messages, :dependent => :destroy - has_many :org_subfields, :through => :org_subfield_messages + # has_many :org_subfield_messages, :dependent => :destroy + # has_many :org_subfields, :through => :org_subfield_messages acts_as_tree :counter_cache => :replies_count, :order => "#{Message.table_name}.created_on ASC" acts_as_attachable @@ -150,6 +150,10 @@ class Message < ActiveRecord::Base usr && usr.logged? && (usr.allowed_to?(:edit_messages, course) || (self.author == usr && usr.allowed_to?(:edit_own_messages, course))) end + def org_subfield_editable_by?(usr) + usr && usr.logged? && usr.admin? && usr.admin_of_org?(self.board.org_subfield.organization) + 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 @@ -192,7 +196,7 @@ class Message < ActiveRecord::Base # Description def act_as_forge_activity # 如果project为空,那么就是课程相关的消息 - if !self.board.project.nil? && self.parent_id.nil? + if self.board.project_id != -1 && self.parent_id.nil? self.forge_acts << ForgeActivity.new(:user_id => self.author_id, :project_id => self.board.project.id) end @@ -227,7 +231,7 @@ class Message < ActiveRecord::Base end end end - else # 项目相关 + elsif self.project # 项目相关 if self.parent_id.nil? # 主贴 self.project.members.each do |m| if m.user_id != self.author_id diff --git a/app/views/boards/_org_subfield_message_edit.html.erb b/app/views/boards/_org_subfield_message_edit.html.erb new file mode 100644 index 000000000..ae22b225b --- /dev/null +++ b/app/views/boards/_org_subfield_message_edit.html.erb @@ -0,0 +1,16 @@ + +
      +
      +
      + 编辑帖子 +
      +
      + <%= render :partial => 'boards/org_subfield_new', + :locals => {:f => f, :edit_mode => edit_mode, :topic => topic, :org_subfield => org_subfield} %> +
      \ No newline at end of file diff --git a/app/views/boards/_org_subfield_new.html.erb b/app/views/boards/_org_subfield_new.html.erb new file mode 100644 index 000000000..7664c5c32 --- /dev/null +++ b/app/views/boards/_org_subfield_new.html.erb @@ -0,0 +1,74 @@ +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: true, prettify: false) %> +<% end %> + +<%= error_messages_for 'message' %> +
      +
      +
      +
      + +

      +
      + +
      + <%#= render :partial => 'course_new_topic', :locals => {:f => f, :topic => @message} %> + +
      +
      \ No newline at end of file diff --git a/app/views/layouts/base_org.html.erb b/app/views/layouts/base_org.html.erb index 808e80239..83bcb4dc9 100644 --- a/app/views/layouts/base_org.html.erb +++ b/app/views/layouts/base_org.html.erb @@ -13,7 +13,7 @@ <%= javascript_heads %> <%= heads_for_theme %> <%= stylesheet_link_tag 'pleft','prettify','jquery/jquery-ui-1.9.2','header','new_user','repository','courses','org' %> - <%= javascript_include_tag 'cookie','project', 'header','prettify','select_list_move','org'%> + <%= javascript_include_tag 'cookie','project', 'organization','header','prettify','select_list_move','org'%> <%= javascript_include_tag 'attachments' %> <%= call_hook :view_layouts_base_html_head %> diff --git a/app/views/messages/_course_show.html.erb b/app/views/messages/_course_show.html.erb index cc93d99b9..294f9b7d4 100644 --- a/app/views/messages/_course_show.html.erb +++ b/app/views/messages/_course_show.html.erb @@ -57,7 +57,7 @@ :data => {:confirm => l(:text_are_you_sure)}, :class => 'postOptionLink' ) if @message.course_destroyable_by?(User.current) %> - <%#= link_to "发送",messages_join_org_subfield_path(:message_id => @topic.id) , :remote=> true,:class => 'postOptionLink' %> + <%= link_to "发送",messages_join_org_subfield_path(:message_id => @topic.id) , :remote=> true,:class => 'postOptionLink' %>
    diff --git a/app/views/messages/_org_subfield_show.html.erb b/app/views/messages/_org_subfield_show.html.erb new file mode 100644 index 000000000..9eb082d33 --- /dev/null +++ b/app/views/messages/_org_subfield_show.html.erb @@ -0,0 +1,199 @@ +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false, init_activity: true) %> +<% end %> + + + + +
    +
    +
    + <%= link_to image_tag(url_to_avatar(@topic.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@topic.author) %> +
    +
    + <% if @topic.author.id == User.current.id%> + + <%end%> + +
    + +
    + <% if @topic.try(:author).try(:realname) == ' ' %> + <%= link_to @topic.try(:author), user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> + <% else %> + <%= link_to @topic.try(:author).try(:realname), user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> + <% end %> +
    +
    <%= format_time( @topic.created_on)%>
    +
    +
    + <%= @topic.content.html_safe%> +
    +
    +
    + <%= link_to_attachments_course @topic, :author => false %> +
    +
    +
    +
    +
    +
    + <% unless @replies.empty? %> +
    +
    回复(<%=@reply_count %>)
    +
    + +
    +
    + <% @replies.each_with_index do |reply,i| %> + +
    +
    + <%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %> +
    +
    +
    + <% if reply.try(:author).try(:realname) == ' ' %> + <%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> + <% else %> + <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> + <% end %> +
    +
    + <%= reply.content.html_safe%> +
    +
    + <%= format_time(reply.created_on) %> + +
    +

    +
    +
    +
    + <% end %> +
    + + <% end %> +
    + <% if !@topic.locked? && authorize_for_course('messages', 'reply') %> +
    + +
    +
    + <%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'message_form'} do |f| %> + <%= render :partial => 'form_course', :locals => {:f => f, :replying => true} %> + <%= link_to l(:button_cancel), "javascript:void(0)", :onclick => 'course_board_canel_message_replay();', :class => "blue_btn grey_btn fr c_white mt10 mr5" %> + <%= link_to l(:button_submit), "javascript:void(0)", :onclick => 'course_board_submit_message_replay();', :class => "blue_btn fr c_white mt10", :style => "margin-left: 50px;" %> + <% end %> +
    +
    +
    + <% end %> +
    +
    \ No newline at end of file diff --git a/app/views/messages/_project_show.html.erb b/app/views/messages/_project_show.html.erb index a0a340a2a..1cbd606ab 100644 --- a/app/views/messages/_project_show.html.erb +++ b/app/views/messages/_project_show.html.erb @@ -112,8 +112,8 @@ :data => {:confirm => l(:text_are_you_sure)}, :class => 'postOptionLink' ) if @message.destroyable_by?(User.current) %> - <%#= link_to "发送",messages_join_org_subfield_path(:message_id => @topic.id) , :remote=> true,:class => 'postOptionLink' %> +
  • <%= link_to "发送",messages_join_org_subfield_path(:message_id => @topic.id) , :remote=> true,:class => 'postOptionLink' %>
  • diff --git a/app/views/messages/edit.html.erb b/app/views/messages/edit.html.erb index 7543e16e2..6e54a88e1 100644 --- a/app/views/messages/edit.html.erb +++ b/app/views/messages/edit.html.erb @@ -22,6 +22,18 @@ <%= render :partial => 'boards/course_message_edit', :locals => {:f => f, :edit_mode => true, :topic => @message, :course => @message.course} %> <% end %> + +<% elsif @message.board.org_subfield %> + <%= form_for @message, { + :as => :message, + :url => {:action => 'edit'}, + :html => {:multipart => true, + :id => 'message-form', + :method => :post} + } do |f| %> + <%= render :partial => 'boards/org_subfield_message_edit', + :locals => {:f => f, :edit_mode => true, :topic => @message, :org_subfield => @message.board.org_subfield} %> + <% end %> <% end %>
    diff --git a/app/views/messages/reply.js.erb b/app/views/messages/reply.js.erb index 518479344..c0da5ab9b 100644 --- a/app/views/messages/reply.js.erb +++ b/app/views/messages/reply.js.erb @@ -2,5 +2,7 @@ $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/project_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>"); <%elsif @course%> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>"); +<% elsif @org_subfield %> + $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'organizations/org_subfield_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>"); <%end%> init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity"); \ No newline at end of file diff --git a/app/views/messages/show.html.erb b/app/views/messages/show.html.erb index 5996852ef..428c51f22 100644 --- a/app/views/messages/show.html.erb +++ b/app/views/messages/show.html.erb @@ -2,4 +2,6 @@ <%= render :partial => 'project_show', locals: {project: @project} %> <% elsif @course %> <%= render :partial => 'course_show', locals: {course: @course} %> +<% else %> + <%= render :partial => 'org_subfield_show', :locals => {:org_subfield => @org_subfield} %> <% end %> diff --git a/app/views/organizations/_org_activities.html.erb b/app/views/organizations/_org_activities.html.erb index e7a4f6afa..8bffb7c47 100644 --- a/app/views/organizations/_org_activities.html.erb +++ b/app/views/organizations/_org_activities.html.erb @@ -50,12 +50,14 @@ <% end %> <% end %> <% if act.container_type == 'OrgSubfield' %> - <% if act.org_act_type == 'Message' and act.org_act_id %> + <% if act.org_act_type == 'Message' and act.org_act_id and Message.where("id=#{act.org_act_id}").count > 0 %> <% message = Message.find(act.org_act_id) %> <% if !message.board.course_id.nil? %> <%= render :partial => 'org_course_message', :locals => {:activity => message,:user_activity_id =>act.id} %> - <% else %> + <% elsif message.board.project_id != -1 %> <%= render :partial => 'organizations/project_message', :locals => {:activity => message,:user_activity_id =>act.id} %> + <% elsif message.board.org_subfield_id %> + <%= render :partial => 'organizations/org_subfield_message', :locals => {:activity => message, :user_activity_id => act.id} %> <% end %> <% end %> <% end %> diff --git a/app/views/organizations/_org_subfield_message.html.erb b/app/views/organizations/_org_subfield_message.html.erb new file mode 100644 index 000000000..57c50486b --- /dev/null +++ b/app/views/organizations/_org_subfield_message.html.erb @@ -0,0 +1,118 @@ +
    +
    +
    + <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> +
    +
    +
    + <% if activity.try(:author).try(:realname) == ' ' %> + <%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %> + <% else %> + <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %> + <% end %> + TO + <%= link_to activity.board.org_subfield.name.to_s+" | 资源栏目讨论区",org_subfield_boards_path(activity.board.org_subfield), :class => "newsBlue ml15 mr5"%> + +
    +
    + <% if activity.parent_id.nil? %> + <%= link_to activity.subject.to_s.html_safe, board_message_path(activity.board,activity), :class=> "postGrey" + %> + <% else %> + <%= link_to activity.parent.subject.to_s.html_safe, board_message_path(activity.board,activity), :class=> "postGrey" + %> + <% end %> +
    +
    + 时间:<%= format_time(activity.created_on) %> +
    +
    +
    + <% if activity.parent_id.nil? %> + <%= activity.content.to_s.html_safe%> + <% else %> + <%= activity.parent.content.to_s.html_safe%> + <% end %> +
    +
    +
    + + +
    +
    +
    +
    + <% count = 0 %> + <% if activity.parent %> + <% count=activity.parent.children.count%> + <% else %> + <% count=activity.children.count%> + <% end %> +
    +
    +
    +
    回复( + <%=count %> + )
    +
    <%#=format_date(activity.updated_on)%>
    + <%if count>3 %> + + <% end %> +
    + + <% activity= activity.parent_id.nil? ? activity : activity.parent %> + <% replies_all_i = 0 %> + <% if count > 0 %> +
    +
      + <% activity.children.reorder("created_on desc").each do |reply| %> + + <% replies_all_i=replies_all_i+1 %> +
    • +
      + <%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33"), user_path(reply.author_id), :alt => "用户头像" %> +
      +
      +
      + <% if reply.try(:author).try(:realname) == ' ' %> + <%= link_to reply.try(:author), user_path(reply.author_id), :class => "newsBlue mr10 f14" %> + <% else %> + <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id), :class => "newsBlue mr10 f14" %> + <% end %> + <%= format_time(reply.created_on) %> +
      +
      + <%= reply.content.html_safe %>
      +
      +
      +
    • + <% end %> +
    +
    + <% end %> + +
    +
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
    +
    +
    + <%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%> + + + +
    + +
    +

    + <% end%> +
    +
    +
    +
    +
    + +
    +
    \ No newline at end of file diff --git a/app/views/organizations/org_subfield_message_edit.html.erb b/app/views/organizations/org_subfield_message_edit.html.erb new file mode 100644 index 000000000..caa389945 --- /dev/null +++ b/app/views/organizations/org_subfield_message_edit.html.erb @@ -0,0 +1,16 @@ + +
    +
    +
    + 编辑帖子 +
    +
    + <%= render :partial => 'boards/course_new', + :locals => {:f => f, :edit_mode => edit_mode, :topic => topic, :course => course} %> +
    \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index be9843a80..36e6dff59 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -84,6 +84,7 @@ RedmineApp::Application.routes.draw do match "quote_resource_show_org_subfield", :via => [:get] end end + resource :boards end resources :org_document_comments do diff --git a/public/javascripts/organization.js b/public/javascripts/organization.js new file mode 100644 index 000000000..e04a8b282 --- /dev/null +++ b/public/javascripts/organization.js @@ -0,0 +1,39 @@ +/** + * Created by ouyangxuhua on 2015/12/30. + */ +function submit_topic() +{ + if(regexTopicSubject() && regexTopicDescription()) + { + message_content_editor.sync(); + $("#message-form").submit(); + } +} + +function regexTopicSubject() { + var name = $("#message_subject").val(); + if(name.length ==0) + { + $("#subjectmsg").text("标题不能为空"); + $("#subjectmsg").css('color','#ff0000'); + $("#message_subject").focus(); + return false; + } + else if(name.length <= 255) + { + $("#subjectmsg").text("填写正确"); + $("#subjectmsg").css('color','#008000'); + return true; + } + else + { + $("#subjectmsg").text("标题超过255个字符"); + $("#subjectmsg").css('color','#ff0000'); + $("#message_subject").focus(); + return false; + } +} + +function reset_topic(){ + +} From e948c9430061981b14c66a41147f627d50021f3a Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 30 Dec 2015 15:49:16 +0800 Subject: [PATCH 19/57] =?UTF-8?q?=E5=9C=A8=E7=BA=BF=E6=B5=8B=E9=AA=8C?= =?UTF-8?q?=E7=9A=84=E5=A1=AB=E7=A9=BA=E9=A2=98=E6=9C=AA=E6=96=AD=E7=BD=91?= =?UTF-8?q?=E6=97=B6=E6=8A=A5=E7=BD=91=E7=BB=9C=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercise_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index 9c073afa8..444446ef4 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -450,7 +450,7 @@ class ExerciseController < ApplicationController if params[:answer_text].nil? || params[:answer_text].blank? #用户提交空答案,视作不作答 @percent = get_percent(@exercise,User.current) - render :json => {:text => ea.answer_text,:percent => format("%.2f", @percent)} + render :json => {:text => "",:percent => format("%.2f", @percent)} else #添加答案 ea = ExerciseAnswer.new @@ -476,7 +476,7 @@ class ExerciseController < ApplicationController # 用户提交空答案,视为删除答案 if ea.delete @percent = get_percent(@exercise,User.current) - render :json => {:text => ea.answer_text,:percent => format("%.2f", @percent)} + render :json => {:text => "",:percent => format("%.2f", @percent)} else render :json => {:text => "failure"} end From 077368f5971f82611eb9d7bd89d0242a93a1015b Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 30 Dec 2015 16:02:31 +0800 Subject: [PATCH 20/57] =?UTF-8?q?=E5=8C=BF=E8=AF=84=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E8=AF=84=E5=88=86=E6=98=BE=E7=A4=BA=EF=BC=8C?= =?UTF-8?q?=E5=AF=B9=E5=BA=94=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../student_work/_evaluation_title.html.erb | 48 +++++++++---------- .../student_work/_evaluation_work.html.erb | 12 ++--- public/stylesheets/public.css | 4 ++ 3 files changed, 34 insertions(+), 30 deletions(-) diff --git a/app/views/student_work/_evaluation_title.html.erb b/app/views/student_work/_evaluation_title.html.erb index 1e006a6a6..2ef5ee9af 100644 --- a/app/views/student_work/_evaluation_title.html.erb +++ b/app/views/student_work/_evaluation_title.html.erb @@ -1,25 +1,25 @@ -
      -
    • - 作品名称 - <% if @homework.homework_type != 3 %> - 姓名 - 学号 - <% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %> - 关联项目 - <% end %> -
    • - -
    • - 时间 -
    • - - <% if @homework.homework_type == 2%> -
    • - 系统 -
    • - <% end%> - -
    • - 我的评分 -
    • +
        +
      • + 作品名称 + <% if @homework.homework_type != 3 %> + 姓名 + 学号 + <% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %> + 关联项目 + <% end %> +
      • + +
      • + 时间 +
      • + + <% if @homework.homework_type == 2%> +
      • + 系统 +
      • + <% end%> + +
      • + 我的评分 +
      \ No newline at end of file diff --git a/app/views/student_work/_evaluation_work.html.erb b/app/views/student_work/_evaluation_work.html.erb index e65d4f267..cc346361e 100644 --- a/app/views/student_work/_evaluation_work.html.erb +++ b/app/views/student_work/_evaluation_work.html.erb @@ -6,16 +6,16 @@ <% pro = @homework.student_work_projects.where(:user_id => User.current.id).first %> <% is_my_work = pro && pro.student_work_id == student_work.id%> <% end %> -
    • +
      • <% if is_my_work%>
      • <%= image_tag(url_to_avatar(student_work.user),width:"40", height: "40") %>
      • -
      • +
      • <% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%>
        - <%= link_to student_work_name, student_work_path(student_work),:remote => true,:title => student_work_name, :class => "linkGrey f14 StudentName break_word width285"%> + <%= link_to student_work_name, student_work_path(student_work),:remote => true,:title => student_work_name, :class => "linkGrey f14 StudentName break_word w230"%>
      • @@ -40,9 +40,9 @@
      • <%= image_tag(url_to_avatar(""),width:"40", height: "40") %>
      • -
      • +
      • - <%= link_to "匿名的作品", student_work_path(student_work),:remote => true,:title => student_work_name, :class => "linkGrey f14 StudentName break_word width285"%> + <%= link_to "匿名的作品", student_work_path(student_work),:remote => true,:title => student_work_name, :class => "linkGrey f14 StudentName break_word w230"%>
      • @@ -83,7 +83,7 @@ <% end%> <% my_score = student_work_score(student_work,User.current) %> -
      • +
      • <%= my_score.nil? ? "--" : format("%.1f",my_score.score)%>
      • diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index 51f0be25d..cf741476e 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -135,12 +135,16 @@ h4{ font-size:14px; color:#3b3b3b;} .w100{width: 100px;} .w210{ width:210px;} .w150{ width:150px;} +.w230{width:230px !important;} +.w235{ width:235px !important;} .w280{ width:280px;} .w265{ width: 265px;} .w270{ width: 270px;} .w350 {width:350px;} .w362 {width:362px;} .w430{ width:470px;} +.w455{width:455px !important;} +.w465{width:465px !important;} .w520{ width:520px;} .w543{ width:543px;} .w557{ width:557px;} From 76b95fbf9374c936ef398b08ee48eadd30a86091 Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 30 Dec 2015 16:27:56 +0800 Subject: [PATCH 21/57] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=92=8C=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E7=9A=84=E8=AF=BE=E7=A8=8B=E7=AE=80=E4=BB=8B=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E5=8F=AF=E6=98=BE=E7=A4=BA20=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/course.js | 2 +- public/javascripts/project.js | 2 +- public/stylesheets/leftside.css | 2 +- public/stylesheets/leftside_new.css | 2 +- public/stylesheets/pleft.css | 2 +- public/stylesheets/user_leftside.css | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/public/javascripts/course.js b/public/javascripts/course.js index 5bfaccf30..a0bce3099 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -813,7 +813,7 @@ function hidden_atert_form(cur_page,cur_type) //当课程描述长度小于112px时,不显示更多按钮 $(function(){ - if($("#course_description_content").height()>112) + if($("#course_description_content").height()>400) { $("#lg-foot").show(); } diff --git a/public/javascripts/project.js b/public/javascripts/project.js index 24e864780..67fecaa3f 100644 --- a/public/javascripts/project.js +++ b/public/javascripts/project.js @@ -280,7 +280,7 @@ function submitComment() //当项目描述长度小于112px时,不显示更多按钮 $(function () { // alert($("#course_description_content").height()); - if ($("#course_description_content").height() > 112) { + if ($("#course_description_content").height() > 400) { $("#lg-foot").show(); } }); diff --git a/public/stylesheets/leftside.css b/public/stylesheets/leftside.css index 26976343e..aded204d2 100644 --- a/public/stylesheets/leftside.css +++ b/public/stylesheets/leftside.css @@ -45,7 +45,7 @@ a:hover.subnav_green{ background:#14ad5a;} /*简介*/ .project_intro{ width:220px; padding:10px; background:#fff; margin-top:10px; padding-top:5px; color:#6d6d6d; line-height:1.9;} -.course_description{max-height: 112px;overflow:hidden; word-break: break-all;word-wrap: break-word;} +.course_description{max-height: 420px;overflow:hidden; word-break: break-all;word-wrap: break-word;line-height: 20px;} .project_board_content{overflow: hidden;max-height: 212px;word-break: break-all;word-wrap: break-word;} .project_board_content1{overflow: hidden;max-height: 72px;word-break: break-all;word-wrap: break-word;} .course_description_none{max-height: none;} diff --git a/public/stylesheets/leftside_new.css b/public/stylesheets/leftside_new.css index 2f31a1f65..f7f0c139d 100644 --- a/public/stylesheets/leftside_new.css +++ b/public/stylesheets/leftside_new.css @@ -46,7 +46,7 @@ a:hover.subnav_green{ background:#14ad5a;} /*简介*/ .project_intro{ width:220px; padding:10px; background:#fff; margin-top:10px; padding-top:5px; color:#6d6d6d; line-height:1.9;} -.course_description{max-height: 112px;overflow:hidden; word-break: break-all;word-wrap: break-word;} +.course_description{max-height: 420px;overflow:hidden; word-break: break-all;word-wrap: break-word;line-height: 20px;} .course_description_none{max-height: none;} .lg-foot{ border:1px solid #e8eef2; color: #929598; text-align:center; width:220px; height:23px; cursor:pointer;} .lg-foot:hover{ color:#787b7e; border:1px solid #d4d4d4;} diff --git a/public/stylesheets/pleft.css b/public/stylesheets/pleft.css index 1ce12bdda..2cd51d5ec 100644 --- a/public/stylesheets/pleft.css +++ b/public/stylesheets/pleft.css @@ -48,7 +48,7 @@ a:hover.subnav_green{ background:#14ad5a;} /*简介*/ .project_intro{ width:220px; padding:10px; background:#fff; margin-top:10px; padding-top:5px; color:#6d6d6d; line-height:1.9;} -.course_description{max-height: 112px;overflow:hidden; word-break: break-all;word-wrap: break-word;} +.course_description{max-height: 420px;overflow:hidden; word-break: break-all;word-wrap: break-word;line-height: 20px;} .project_board_content{overflow: hidden;max-height: 212px;word-break: break-all;word-wrap: break-word;} .project_board_content1{overflow: hidden;max-height: 72px;word-break: break-all;word-wrap: break-word;} .course_description_none{max-height: none;} diff --git a/public/stylesheets/user_leftside.css b/public/stylesheets/user_leftside.css index c8dfbe316..c0ff7c8a2 100644 --- a/public/stylesheets/user_leftside.css +++ b/public/stylesheets/user_leftside.css @@ -46,7 +46,7 @@ a:hover.subnav_green{ background:#14ad5a;} /*简介*/ .project_intro{ width:220px; padding:10px; background:#fff; margin-top:10px; padding-top:5px; color:#6d6d6d; line-height:1.9;} -.course_description{max-height: 112px;overflow:hidden; word-break: break-all;word-wrap: break-word;} +.course_description{max-height: 420px;overflow:hidden; word-break: break-all;word-wrap: break-word;line-height: 20px;} .course_description_none{max-height: none;} .lg-foot{ border:1px solid #e8eef2; color: #929598; text-align:center; width:220px; height:23px; cursor:pointer;} .lg-foot:hover{ color:#787b7e; border:1px solid #d4d4d4;} From c16f99774b8102a90da4166590315bdf6a2fa727 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Wed, 30 Dec 2015 16:57:40 +0800 Subject: [PATCH 22/57] =?UTF-8?q?1.=E7=BB=84=E7=BB=87=E5=8F=B6=E5=BA=95?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E9=94=99=E8=AF=AF=E9=97=AE=E9=A2=98=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/_org_activities.html.erb | 15 ++------------- app/views/organizations/show.html.erb | 8 ++++---- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/app/views/organizations/_org_activities.html.erb b/app/views/organizations/_org_activities.html.erb index 8bffb7c47..b82bbb642 100644 --- a/app/views/organizations/_org_activities.html.erb +++ b/app/views/organizations/_org_activities.html.erb @@ -50,7 +50,7 @@ <% end %> <% end %> <% if act.container_type == 'OrgSubfield' %> - <% if act.org_act_type == 'Message' and act.org_act_id and Message.where("id=#{act.org_act_id}").count > 0 %> + <% if act.org_act_type == 'Message' and act.org_act_id %> <% message = Message.find(act.org_act_id) %> <% if !message.board.course_id.nil? %> <%= render :partial => 'org_course_message', :locals => {:activity => message,:user_activity_id =>act.id} %> @@ -62,21 +62,10 @@ <% end %> <% end %> <% end %> - - <%#= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%> - + <% end %> <% if org_act_count == 10 %> - <%= link_to "点击展开更多",organization_path(org,:page => page.to_i + 1, :show_homepage =>params[:show_homepage],:type => params[:type]),:id => "show_more_activities",:remote => "true",:class => "loadMore mt10 f_grey"%> <% end%> - +更新资源版本 + +
        +
        +
        当前版本 + + + +
        + <% unless @attachment_histories.empty? %> + +
        历史版本
        +
        + <% @attachment_histories.each do |history| %> + + + 版本号:<%= history.version %> + + + <% end %> +
        + <% end %> + +
        + <%= form_tag(upload_attachment_version_path, :multipart => true,:remote => !ie8?,:name=>"upload_form",:id=>'upload_form') do %> + <%= hidden_field_tag :old_attachment_id,@attachment.id %> +
        + + +
        +
        + + <%= render :partial => 'attachments/upload_attachment_new_version' %> +
        + + +
        +
        +
        (未选择文件)
        +
        您可以上传小于50MB的文件
        +
        +
        +
        +
        +
        + + <%= submit_tag '确定',:onclick=>'upload_attachment_version(event);',:onfocus=>'this.blur()',:id=>'upload_files_submit_btn',:class=>'sendSourceText' %> +
        + +
        + <% end %> +
        + \ No newline at end of file diff --git a/app/views/attachments/_upload_attachment_new_version.html.erb b/app/views/attachments/_upload_attachment_new_version.html.erb new file mode 100644 index 000000000..cd35535c0 --- /dev/null +++ b/app/views/attachments/_upload_attachment_new_version.html.erb @@ -0,0 +1,23 @@ + + + + + 选择文件 +<%= file_field_tag 'attachments[dummy][file]', + :id => '_file', + :class => ie8? ? '':'file_selector', + :multiple => true, + :onchange => 'addInputFiles(this,"'+'upload_files_submit_btn'+'");', + :style => ie8? ? '': 'display:none', + :data => { + :max_file_size => Setting.attachment_max_size.to_i.kilobytes, + :max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)), + :max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i, + :upload_path => uploads_path(:format => 'js',:old_attachment_id=>@attachment.id), + :description_placeholder => l(:label_optional_description), + :field_is_public => l(:field_is_public), + :are_you_sure => l(:text_are_you_sure), + :file_count => l(:label_file_count), + :lebel_file_uploding => l(:lebel_file_uploding), + :delete_all_files => l(:text_are_you_sure_all) + } %> diff --git a/app/views/attachments/attachment_versions.js.erb b/app/views/attachments/attachment_versions.js.erb new file mode 100644 index 000000000..4f3bf41c3 --- /dev/null +++ b/app/views/attachments/attachment_versions.js.erb @@ -0,0 +1,7 @@ +$("#ajax-modal").html('<%= escape_javascript( render :partial => 'attachments/show_attachment_history' )%>'); +showModal('ajax-modal', '452px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before(""); +$('#ajax-modal').parent().css("top","40%").css("left","46%"); +$('#ajax-modal').parent().addClass("resourceUploadPopup"); +$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); \ No newline at end of file diff --git a/app/views/attachments/upload.js.erb b/app/views/attachments/upload.js.erb index 970c5b22d..62db5ebfd 100644 --- a/app/views/attachments/upload.js.erb +++ b/app/views/attachments/upload.js.erb @@ -11,4 +11,5 @@ fileSpan.find('a.remove-upload') }) .off('click'); $('', { type: 'hidden', name: 'attachments[<%= j params[:attachment_id] %>][token]' } ).val('<%= j @attachment.token %>').appendTo(fileSpan); +$('',{type:'hidden',name:'attachments[<%= j params[:attachment_id] %>][attachment_id]'}).val('<%= @attachment.id %>').appendTo(fileSpan); <% end %> diff --git a/app/views/attachments/upload_attachment_version.js.erb b/app/views/attachments/upload_attachment_version.js.erb new file mode 100644 index 000000000..eb5559563 --- /dev/null +++ b/app/views/attachments/upload_attachment_version.js.erb @@ -0,0 +1,7 @@ +<% if @flag %> + hideModal(); + alert('更新成功') + $(".re_search").submit(); +<%else%> + $("#upload_file_count").html('(更新失败)') +<%end %> \ No newline at end of file diff --git a/app/views/files/_course_list.html.erb b/app/views/files/_course_list.html.erb index 0212ce8bd..653877260 100644 --- a/app/views/files/_course_list.html.erb +++ b/app/views/files/_course_list.html.erb @@ -42,7 +42,7 @@
      • <%= link_to("发       送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}')") %>
      • <% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %> <% if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" %> -
      • <%= link_to '更新版本','',:class => "postOptionLink",:remote=>true %>
      • +
      • <%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %>
      • <% if @course.is_public? %>
      • diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb index 0010f0b4f..383ea155e 100644 --- a/app/views/files/index.html.erb +++ b/app/views/files/index.html.erb @@ -487,6 +487,27 @@ } <%end %> + function show_attachments_history(){ + + } + + //更新文件版本 表单提交确认,原则是只能有一个更新文件 + function upload_attachment_version(event){ + if($("#upload_form").find('.upload_filename').length > 1){ + $("#upload_file_count").html('(只能上传一个更新文件)') + event.preventDefault(); + + return false; + }else if($("#upload_form").find('.upload_filename').length == 0){ + $("#upload_file_count").html('(请上传一个更新文件)') + event.preventDefault(); + + return false; + }else{ + $("#upload_form").submit(); + } + } + diff --git a/config/routes.rb b/config/routes.rb index b9622c047..5090eb03c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -805,6 +805,8 @@ RedmineApp::Application.routes.draw do # additional routes for having the file name at the end of url get 'attachments/:id/:filename', :to => 'attachments#show', :id => /\d+/, :filename => /.*/, :as => 'named_attachment' + get 'attachments/attachment_versions/:id',:to=>'attachments#attachment_versions',:as=>'attachments_versions' + post 'attachments/upload_attachment_version',:to=>'attachments#upload_attachment_version',:as=>'upload_attachment_version' get 'attachments/download/:id/:filename', :to => 'attachments#download', :id => /\d+/, :filename => /.*/, :as => 'download_named_attachment' get 'attachments/download/:id', :to => 'attachments#download', :id => /\d+/ get 'attachments/thumbnail/:id(/:size)', :to => 'attachments#thumbnail', :id => /\d+/, :size => /\d+/, :as => 'thumbnail' From 0ef00459418fb7ebb7208d82637ef3335ff119e6 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Wed, 30 Dec 2015 17:39:00 +0800 Subject: [PATCH 28/57] =?UTF-8?q?=E5=8F=91=E9=80=81=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E8=A6=81=E6=B7=BB=E5=8A=A0copy=5Ffrom?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 2 +- app/controllers/users_controller.rb | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 0a4b432ce..b29f6e2a1 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -212,7 +212,7 @@ class AttachmentsController < ApplicationController @history.version = @old_history.nil? ? 1 : @old_history.version + 1 @history.save #历史记录保存完毕 #将最新保存的记录 数据替换到 需要修改的文件记录 - @old_attachment.attributes = @attachment.attributes.dup.except("id","container_id","container_type") + @old_attachment.attributes = @attachment.attributes.dup.except("id","container_id","container_type","is_public") @old_attachment.save #删除当前记录 @attachment.delete diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 3aa86946f..ecd26870a 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1493,6 +1493,7 @@ class UsersController < ApplicationController attach_copied_obj.container = Course.find(id) attach_copied_obj.created_on = Time.now attach_copied_obj.author_id = User.current.id + attach_copied_obj.copy_from = ori.copy_from.nil? ? ori.id : ori.copy_from #发送要添加copy_from if attach_copied_obj.attachtype == nil attach_copied_obj.attachtype = 4 end @@ -1517,6 +1518,7 @@ class UsersController < ApplicationController attach_copied_obj.container = Course.find(id) attach_copied_obj.created_on = Time.now attach_copied_obj.author_id = User.current.id + attach_copied_obj.copy_from = ori.copy_from.nil? ? ori.id : ori.copy_from #发送要添加copy_from if attach_copied_obj.attachtype == nil attach_copied_obj.attachtype = 4 end @@ -1563,6 +1565,7 @@ class UsersController < ApplicationController attach_copied_obj.container = Project.find(project_id) attach_copied_obj.created_on = Time.now attach_copied_obj.author_id = User.current.id + attach_copied_obj.copy_from = ori.copy_from.nil? ? ori.id : ori.copy_from #发送要添加copy_from if attach_copied_obj.attachtype == nil attach_copied_obj.attachtype = 1 end @@ -1586,6 +1589,7 @@ class UsersController < ApplicationController attach_copied_obj.container = Project.find(project_id) attach_copied_obj.created_on = Time.now attach_copied_obj.author_id = User.current.id + attach_copied_obj.copy_from = ori.copy_from.nil? ? ori.id : ori.copy_from #发送要添加copy_from if attach_copied_obj.attachtype == nil attach_copied_obj.attachtype = 1 end @@ -1628,6 +1632,7 @@ class UsersController < ApplicationController attach_copied_obj.container = OrgSubfield.find(subfield_id) attach_copied_obj.created_on = Time.now attach_copied_obj.author_id = User.current.id + attach_copied_obj.copy_from = ori.copy_from.nil? ? ori.id : ori.copy_from #发送要添加copy_from if attach_copied_obj.attachtype == nil attach_copied_obj.attachtype = 1 end @@ -1649,6 +1654,7 @@ class UsersController < ApplicationController attach_copied_obj.container = OrgSubfield.find(subfield_id) attach_copied_obj.created_on = Time.now attach_copied_obj.author_id = User.current.id + attach_copied_obj.copy_from = ori.copy_from.nil? ? ori.id : ori.copy_from #发送要添加copy_from if attach_copied_obj.attachtype == nil attach_copied_obj.attachtype = 1 end From 29c720a8a4413bb0ed7cc8292174e22560eedfa6 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Wed, 30 Dec 2015 17:45:15 +0800 Subject: [PATCH 29/57] =?UTF-8?q?1.=E6=9D=83=E9=99=90=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/messages_controller.rb | 4 +++- app/views/messages/_show_org_subfields.html.erb | 2 +- app/views/organizations/_org_subfield_message.html.erb | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index ae13b7e78..e91b3f0db 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -231,8 +231,10 @@ class MessagesController < ApplicationController @isReply = false if @project (render_403; return false) unless @message.editable_by?(User.current) - else + elsif @course (render_403; return false) unless @message.course_editable_by?(User.current) + else + (render_403; return false) unless @message.org_subfield_editable_by?(User.current) end @message.safe_attributes = params[:message] diff --git a/app/views/messages/_show_org_subfields.html.erb b/app/views/messages/_show_org_subfields.html.erb index cbd316ea4..fcdac063f 100644 --- a/app/views/messages/_show_org_subfields.html.erb +++ b/app/views/messages/_show_org_subfields.html.erb @@ -9,7 +9,7 @@
      • <% end %> <% else %> -
      • 暂无资源栏目
      • +
      • 暂无帖子栏目
      • <% end %> <% else %> 请在左侧选择组织 diff --git a/app/views/organizations/_org_subfield_message.html.erb b/app/views/organizations/_org_subfield_message.html.erb index 57c50486b..e6bee8000 100644 --- a/app/views/organizations/_org_subfield_message.html.erb +++ b/app/views/organizations/_org_subfield_message.html.erb @@ -11,7 +11,7 @@ <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %> <% end %> TO - <%= link_to activity.board.org_subfield.name.to_s+" | 资源栏目讨论区",org_subfield_boards_path(activity.board.org_subfield), :class => "newsBlue ml15 mr5"%> + <%= link_to activity.board.org_subfield.name.to_s+" | 帖子栏目讨论区",org_subfield_boards_path(activity.board.org_subfield), :class => "newsBlue ml15 mr5"%>
    From c34127f21f73794ae38e44dabc40c8bef7603452 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Wed, 30 Dec 2015 18:04:04 +0800 Subject: [PATCH 30/57] =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=9A=84=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E9=99=90=E5=88=B6=E5=8A=A0=E5=A4=A7=20=E5=A6=82?= =?UTF-8?q?=E6=9E=9C=E6=96=87=E4=BB=B6=E6=9C=89=E4=BA=86=E5=8E=86=E5=8F=B2?= =?UTF-8?q?=E7=89=88=E6=9C=AC=20=E6=95=B0=E6=8D=AE=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E8=A2=AB=E5=88=A0=E9=99=A4=20=E5=A6=82?= =?UTF-8?q?=E6=9E=9C=E6=96=87=E4=BB=B6=E8=A2=AB=E5=8F=91=E9=80=81=E8=BF=87?= =?UTF-8?q?=EF=BC=8C=E6=88=96=E8=80=85=E6=9C=89=E4=BA=86=E5=8E=86=E5=8F=B2?= =?UTF-8?q?=E7=89=88=E6=9C=AC=EF=BC=8C=E7=A1=AC=E7=9B=98=E4=B8=8A=E7=9A=84?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=92=8C=E6=95=B0=E6=8D=AE=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E5=B0=B1=E4=B8=8D=E8=83=BD=E8=A2=AB=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/attachment.rb | 7 ++++++- app/views/files/_course_list.html.erb | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/models/attachment.rb b/app/models/attachment.rb index ae23428f1..b6253de7a 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -349,11 +349,16 @@ class Attachment < ActiveRecord::Base # Deletes the file from the file system if it's not referenced by other attachments def delete_from_disk - if Attachment.where("disk_filename = ? AND id <> ?", disk_filename, id).empty? + #资源存在,且历史记录为0 且 该资源没有存在任何拷贝才能删除资源 + if Attachment.where("disk_filename = ? AND id <> ?", disk_filename, id).empty? && self.attachment_histories.count == 0 && Attachment.where('copy_from = ?',self.id) .count == 0 delete_from_disk! end end + def destroyable + Attachment.where("disk_filename = ? AND id <> ?", disk_filename, id).empty? && self.attachment_histories.count == 0 && Attachment.where('copy_from = ?',self.id) .count == 0 + end + # Returns file's location on disk def diskfile File.join(self.class.storage_path, disk_directory.to_s, disk_filename.to_s) diff --git a/app/views/files/_course_list.html.erb b/app/views/files/_course_list.html.erb index 653877260..e2d321b51 100644 --- a/app/views/files/_course_list.html.erb +++ b/app/views/files/_course_list.html.erb @@ -52,7 +52,7 @@ <%end%>
  • <%= link_to( '删除资源', attachment_path(file), - :data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course"%> + :data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" && file.destroyable %>
  • <% end %> From a85a3339bbf2f2af474cbd49896156415e1f132f Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Wed, 30 Dec 2015 18:24:07 +0800 Subject: [PATCH 31/57] =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=9A=84=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E9=99=90=E5=88=B6=E5=8A=A0=E5=A4=A7=20=E5=A6=82?= =?UTF-8?q?=E6=9E=9C=E6=96=87=E4=BB=B6=E6=9C=89=E4=BA=86=E5=8E=86=E5=8F=B2?= =?UTF-8?q?=E7=89=88=E6=9C=AC=20=E6=95=B0=E6=8D=AE=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E8=A2=AB=E5=88=A0=E9=99=A4=20=E5=A6=82?= =?UTF-8?q?=E6=9E=9C=E6=96=87=E4=BB=B6=E8=A2=AB=E5=8F=91=E9=80=81=E8=BF=87?= =?UTF-8?q?=EF=BC=8C=E6=88=96=E8=80=85=E6=9C=89=E4=BA=86=E5=8E=86=E5=8F=B2?= =?UTF-8?q?=E7=89=88=E6=9C=AC=EF=BC=8C=E7=A1=AC=E7=9B=98=E4=B8=8A=E7=9A=84?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=92=8C=E6=95=B0=E6=8D=AE=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E5=B0=B1=E4=B8=8D=E8=83=BD=E8=A2=AB=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/attachment.rb | 3 ++- app/views/users/_resources_list.html.erb | 2 +- app/views/users/user_resource.html.erb | 9 +++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/models/attachment.rb b/app/models/attachment.rb index b6253de7a..4809bc643 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -355,8 +355,9 @@ class Attachment < ActiveRecord::Base end end + #有了历史记录的数据记录是不能被删除的。 def destroyable - Attachment.where("disk_filename = ? AND id <> ?", disk_filename, id).empty? && self.attachment_histories.count == 0 && Attachment.where('copy_from = ?',self.id) .count == 0 + Attachment.where("disk_filename = ? AND id <> ?", disk_filename, id).empty? && self.attachment_histories.count == 0 end # Returns file's location on disk diff --git a/app/views/users/_resources_list.html.erb b/app/views/users/_resources_list.html.erb index ef6397ec0..621efc902 100644 --- a/app/views/users/_resources_list.html.erb +++ b/app/views/users/_resources_list.html.erb @@ -7,7 +7,7 @@ <% attachments.each do |attach| %>
    • - +
    • diff --git a/app/views/users/user_resource.html.erb b/app/views/users/user_resource.html.erb index b5928940a..2f94e4401 100644 --- a/app/views/users/user_resource.html.erb +++ b/app/views/users/user_resource.html.erb @@ -308,10 +308,15 @@ //批量删除 function batch_delete(){ var data = $("#resources_list_form").serialize(); + if($("input[type=checkbox][data-has-history=Y]:checked").length != 0){ + alert("您只能删除没有历史记录的资源,请重新选择后再删除。"); + return; + } if($("input[type=checkbox][data-deleteble=N]:checked").length != 0){ alert("您只能删除自己上传的资源,请重新选择后再删除。"); return; } + if(data != "" && confirm('确认要删除这些资源吗?')) { $.post( '<%= user_resource_delete_user_path(@user)%>', @@ -455,6 +460,10 @@ line.children().css("background-color", 'white'); id = line.children().last().html(); user_id = line.children().eq(5).html(); + if(line.children().first().children().data('hasHistory') == 'Y'){ + alert('该资源存在历史版本,不能删除'); + return; + } if(user_id === '<%= User.current.id%>') { if (confirm('确定要删除资源"' + line.children().eq(1).children().attr('title').trim() + '"么?')) { $.ajax({ From c2578698f5551015704b08eca9658ee2bce0448f Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Wed, 30 Dec 2015 18:25:56 +0800 Subject: [PATCH 32/57] =?UTF-8?q?1.=E7=BB=84=E7=BB=87=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E6=9C=89=E6=9D=83=E9=99=90=E8=AE=BF=E9=97=AE=E5=B8=96?= =?UTF-8?q?=E5=AD=90=E8=B5=84=E6=BA=90=E6=A0=8F=E7=9B=AE=202.=E8=A7=A3?= =?UTF-8?q?=E5=86=B3=E7=BB=84=E7=BB=87=E9=A1=B5=E9=9D=A2=E4=B8=8B=E7=9A=84?= =?UTF-8?q?=E5=B8=96=E5=AD=90=E6=A0=B7=E5=BC=8F=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/messages/_org_subfield_show.html.erb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/messages/_org_subfield_show.html.erb b/app/views/messages/_org_subfield_show.html.erb index 9eb082d33..304694b39 100644 --- a/app/views/messages/_org_subfield_show.html.erb +++ b/app/views/messages/_org_subfield_show.html.erb @@ -7,6 +7,7 @@ $(function(){ $("#RSide").removeAttr("id"); $("#Container").css("width","1000px"); + $(".postRightContainer").css("margin-left", "0px"); }); -
      +
      <%= link_to image_tag(url_to_avatar(User.find(@document.creator_id)), :width => 45, :heigth => 45), user_path(@document.creator_id) %> diff --git a/public/stylesheets/org.css b/public/stylesheets/org.css index bcb50cfed..b37a38da0 100644 --- a/public/stylesheets/org.css +++ b/public/stylesheets/org.css @@ -70,7 +70,7 @@ a.linkGrey8:hover {color:#585858;} .org_login_list{ border:1px solid #eaeaea; background:#fff; padding-left:10px; padding-bottom:10px; padding-top:8px; width:60px; left:-53px; position:absolute; z-index:9999; line-height:2; box-shadow: 0px 2px 8px rgba(146, 153, 169, 0.5); margin-top: 30px;} #orgUserName {max-width:50px; overflow:hidden; white-space: nowrap; text-overflow: ellipsis; display:inline-block;} -.org_login_list a {color:#269ac9;} +.org_login_list a {color:#269ac9;} .orgListStatus {width:55px; float:left;} .reCon{ margin:5px; width:710px;} @@ -102,4 +102,5 @@ ul.wlist{ float:right; border-bottom:none; height:30px; margin-top:20px; } .sectionContent li:hover {background-color:#cccccc; cursor:pointer;} .sectionContent span {width:175px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; display:inline-block; height:18px; vertical-align:middle;}.popbox_polls{width:300px;height:100px;position:fixed !important;z-index:100;left:50%;top:50%;margin:-100px 0 0 -150px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; overflow:auto;} -.org_login_list a {color:#269ac9;} \ No newline at end of file +.org_login_list a {color:#269ac9;} +div.flash {margin-top :0px !important} \ No newline at end of file From ecd1cd60415cfd48ed89ffccf02966dcabab6ee0 Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 31 Dec 2015 11:06:59 +0800 Subject: [PATCH 36/57] =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=BA=93=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/schema.rb | 3945 ++++++++++++++++---------------- public/stylesheets/courses.css | 5 +- 2 files changed, 1973 insertions(+), 1977 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index 374b44abf..d6229f7e8 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,1976 +1,1969 @@ -# encoding: UTF-8 -# This file is auto-generated from the current state of the database. Instead -# of editing this file, please use the migrations feature of Active Record to -# incrementally modify your database, and then regenerate this schema definition. -# -# Note that this schema.rb definition is the authoritative source for your -# database schema. If you need to create the application database on another -# system, you should be using db:schema:load, not running all the migrations -# from scratch. The latter is a flawed and unsustainable approach (the more migrations -# you'll amass, the slower it'll run and the greater likelihood for issues). -# -# It's strongly recommended to check this file into your version control system. - -ActiveRecord::Schema.define(:version => 20151230022443) do - - create_table "activities", :force => true do |t| - t.integer "act_id", :null => false - t.string "act_type", :null => false - t.integer "user_id", :null => false - t.integer "activity_container_id" - t.string "activity_container_type", :default => "" - t.datetime "created_at" - end - - add_index "activities", ["act_id", "act_type"], :name => "index_activities_on_act_id_and_act_type" - add_index "activities", ["user_id", "act_type"], :name => "index_activities_on_user_id_and_act_type" - add_index "activities", ["user_id"], :name => "index_activities_on_user_id" - - create_table "activity_notifies", :force => true do |t| - t.integer "activity_container_id" - t.string "activity_container_type" - t.integer "activity_id" - t.string "activity_type" - t.integer "notify_to" - t.datetime "created_on" - t.integer "is_read" - end - - add_index "activity_notifies", ["activity_container_id", "activity_container_type"], :name => "index_an_activity_container_id" - add_index "activity_notifies", ["created_on"], :name => "index_an_created_on" - add_index "activity_notifies", ["notify_to"], :name => "index_an_notify_to" - - create_table "api_keys", :force => true do |t| - t.string "access_token" - t.datetime "expires_at" - t.integer "user_id" - t.boolean "active", :default => true - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "api_keys", ["access_token"], :name => "index_api_keys_on_access_token" - add_index "api_keys", ["user_id"], :name => "index_api_keys_on_user_id" - - create_table "applied_projects", :force => true do |t| - t.integer "project_id", :null => false - t.integer "user_id", :null => false - end - - create_table "apply_project_masters", :force => true do |t| - t.integer "user_id" - t.string "apply_type" - t.integer "apply_id" - t.integer "status" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "at_messages", :force => true do |t| - t.integer "user_id" - t.integer "at_message_id" - t.string "at_message_type" - t.boolean "viewed", :default => false - t.string "container_type" - t.integer "container_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "sender_id" - end - - add_index "at_messages", ["user_id"], :name => "index_at_messages_on_user_id" - - create_table "attachment_histories", :force => true do |t| - t.integer "container_id" - t.string "container_type" - t.string "filename", :default => "" - t.string "disk_filename", :default => "" - t.integer "filesize", :default => 0 - t.string "content_type", :default => "" - t.string "digest", :limit => 40, :default => "" - t.integer "downloads", :default => 0 - t.integer "author_id" - t.datetime "created_on" - t.string "description" - t.string "disk_directory" - t.integer "attachtype" - t.integer "is_public" - t.integer "copy_from" - t.integer "quotes" - t.integer "version" - t.integer "attachment_id" - end - - create_table "attachments", :force => true do |t| - t.integer "container_id" - t.string "container_type", :limit => 30 - t.string "filename", :default => "", :null => false - t.string "disk_filename", :default => "", :null => false - t.integer "filesize", :default => 0, :null => false - t.string "content_type", :default => "" - t.string "digest", :limit => 40, :default => "", :null => false - t.integer "downloads", :default => 0, :null => false - t.integer "author_id", :default => 0, :null => false - t.datetime "created_on" - t.string "description" - t.string "disk_directory" - t.integer "attachtype", :default => 1 - t.integer "is_public", :default => 1 - t.integer "copy_from" - t.integer "quotes" - t.integer "version", :default => 0 - end - - add_index "attachments", ["author_id"], :name => "index_attachments_on_author_id" - add_index "attachments", ["container_id", "container_type"], :name => "index_attachments_on_container_id_and_container_type" - add_index "attachments", ["created_on"], :name => "index_attachments_on_created_on" - - create_table "attachmentstypes", :force => true do |t| - t.integer "typeId", :null => false - t.string "typeName", :limit => 50 - end - - create_table "auth_sources", :force => true do |t| - t.string "type", :limit => 30, :default => "", :null => false - t.string "name", :limit => 60, :default => "", :null => false - t.string "host", :limit => 60 - t.integer "port" - t.string "account" - t.string "account_password", :default => "" - t.string "base_dn" - t.string "attr_login", :limit => 30 - t.string "attr_firstname", :limit => 30 - t.string "attr_lastname", :limit => 30 - t.string "attr_mail", :limit => 30 - t.boolean "onthefly_register", :default => false, :null => false - t.boolean "tls", :default => false, :null => false - t.string "filter" - t.integer "timeout" - end - - add_index "auth_sources", ["id", "type"], :name => "index_auth_sources_on_id_and_type" - - create_table "biding_projects", :force => true do |t| - t.integer "project_id" - t.integer "bid_id" - t.integer "user_id" - t.string "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "reward" - end - - create_table "bids", :force => true do |t| - t.string "name" - t.string "budget", :null => false - t.integer "author_id" - t.date "deadline" - t.text "description" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - t.integer "commit" - t.integer "reward_type" - t.integer "homework_type" - t.integer "parent_id" - t.string "password" - t.integer "is_evaluation" - t.integer "proportion", :default => 60 - t.integer "comment_status", :default => 0 - t.integer "evaluation_num", :default => 3 - t.integer "open_anonymous_evaluation", :default => 1 - end - - create_table "blog_comments", :force => true do |t| - t.integer "blog_id", :null => false - t.integer "parent_id" - t.string "title", :default => "", :null => false - t.text "content" - t.integer "author_id" - t.integer "comments_count", :default => 0, :null => false - t.integer "last_comment_id" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - t.boolean "locked", :default => false - t.integer "sticky", :default => 0 - t.integer "reply_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "blogs", :force => true do |t| - t.string "name", :default => "", :null => false - t.text "description" - t.integer "position", :default => 1 - t.integer "article_count", :default => 0, :null => false - t.integer "comments_count", :default => 0, :null => false - t.integer "last_comments_id" - t.integer "parent_id" - t.integer "author_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "boards", :force => true do |t| - t.integer "project_id", :null => false - t.string "name", :default => "", :null => false - t.string "description" - t.integer "position", :default => 1 - t.integer "topics_count", :default => 0, :null => false - t.integer "messages_count", :default => 0, :null => false - t.integer "last_message_id" - t.integer "parent_id" - t.integer "course_id" - end - - add_index "boards", ["last_message_id"], :name => "index_boards_on_last_message_id" - add_index "boards", ["project_id"], :name => "boards_project_id" - - create_table "bug_to_osps", :force => true do |t| - t.integer "osp_id" - t.integer "relative_memo_id" - t.string "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "changes", :force => true do |t| - t.integer "changeset_id", :null => false - t.string "action", :limit => 1, :default => "", :null => false - t.text "path", :null => false - t.text "from_path" - t.string "from_revision" - t.string "revision" - t.string "branch" - end - - add_index "changes", ["changeset_id"], :name => "changesets_changeset_id" - - create_table "changeset_parents", :id => false, :force => true do |t| - t.integer "changeset_id", :null => false - t.integer "parent_id", :null => false - end - - add_index "changeset_parents", ["changeset_id"], :name => "changeset_parents_changeset_ids" - add_index "changeset_parents", ["parent_id"], :name => "changeset_parents_parent_ids" - - create_table "changesets", :force => true do |t| - t.integer "repository_id", :null => false - t.string "revision", :null => false - t.string "committer" - t.datetime "committed_on", :null => false - t.text "comments" - t.date "commit_date" - t.string "scmid" - t.integer "user_id" - end - - add_index "changesets", ["committed_on"], :name => "index_changesets_on_committed_on" - add_index "changesets", ["repository_id", "revision"], :name => "changesets_repos_rev", :unique => true - add_index "changesets", ["repository_id", "scmid"], :name => "changesets_repos_scmid" - add_index "changesets", ["repository_id"], :name => "index_changesets_on_repository_id" - add_index "changesets", ["user_id"], :name => "index_changesets_on_user_id" - - create_table "changesets_issues", :id => false, :force => true do |t| - t.integer "changeset_id", :null => false - t.integer "issue_id", :null => false - end - - add_index "changesets_issues", ["changeset_id", "issue_id"], :name => "changesets_issues_ids", :unique => true - - create_table "code_review_assignments", :force => true do |t| - t.integer "issue_id" - t.integer "change_id" - t.integer "attachment_id" - t.string "file_path" - t.string "rev" - t.string "rev_to" - t.string "action_type" - t.integer "changeset_id" - end - - create_table "code_review_project_settings", :force => true do |t| - t.integer "project_id" - t.integer "tracker_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "updated_by" - t.boolean "hide_code_review_tab", :default => false - t.integer "auto_relation", :default => 1 - t.integer "assignment_tracker_id" - t.text "auto_assign" - t.integer "lock_version", :default => 0, :null => false - t.boolean "tracker_in_review_dialog", :default => false - end - - create_table "code_review_user_settings", :force => true do |t| - t.integer "user_id", :default => 0, :null => false - t.integer "mail_notification", :default => 0, :null => false - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "code_reviews", :force => true do |t| - t.integer "project_id" - t.integer "change_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "line" - t.integer "updated_by_id" - t.integer "lock_version", :default => 0, :null => false - t.integer "status_changed_from" - t.integer "status_changed_to" - t.integer "issue_id" - t.string "action_type" - t.string "file_path" - t.string "rev" - t.string "rev_to" - t.integer "attachment_id" - t.integer "file_count", :default => 0, :null => false - t.boolean "diff_all" - end - - create_table "comments", :force => true do |t| - t.string "commented_type", :limit => 30, :default => "", :null => false - t.integer "commented_id", :default => 0, :null => false - t.integer "author_id", :default => 0, :null => false - t.text "comments" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - end - - add_index "comments", ["author_id"], :name => "index_comments_on_author_id" - add_index "comments", ["commented_id", "commented_type"], :name => "index_comments_on_commented_id_and_commented_type" - - create_table "contest_notifications", :force => true do |t| - t.text "title" - t.text "content" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "contesting_projects", :force => true do |t| - t.integer "project_id" - t.string "contest_id" - t.integer "user_id" - t.string "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "reward" - end - - create_table "contesting_softapplications", :force => true do |t| - t.integer "softapplication_id" - t.integer "contest_id" - t.integer "user_id" - t.string "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "reward" - end - - create_table "contestnotifications", :force => true do |t| - t.integer "contest_id" - t.string "title" - t.string "summary" - t.text "description" - t.integer "author_id" - t.integer "notificationcomments_count" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "contests", :force => true do |t| - t.string "name" - t.string "budget", :default => "" - t.integer "author_id" - t.date "deadline" - t.string "description" - t.integer "commit" - t.string "password" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - end - - create_table "course_activities", :force => true do |t| - t.integer "user_id" - t.integer "course_id" - t.integer "course_act_id" - t.string "course_act_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "course_attachments", :force => true do |t| - t.string "filename" - t.string "disk_filename" - t.integer "filesize" - t.string "content_type" - t.string "digest" - t.integer "downloads" - t.string "author_id" - t.string "integer" - t.string "description" - t.string "disk_directory" - t.integer "attachtype" - t.integer "is_public" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "container_id", :default => 0 - end - - create_table "course_contributor_scores", :force => true do |t| - t.integer "course_id" - t.integer "user_id" - t.integer "message_num" - t.integer "message_reply_num" - t.integer "news_reply_num" - t.integer "resource_num" - t.integer "journal_num" - t.integer "journal_reply_num" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "total_score" - end - - create_table "course_groups", :force => true do |t| - t.string "name" - t.integer "course_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "course_infos", :force => true do |t| - t.integer "course_id" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "course_messages", :force => true do |t| - t.integer "user_id" - t.integer "course_id" - t.integer "course_message_id" - t.string "course_message_type" - t.integer "viewed" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "content" - t.integer "status" - end - - create_table "course_statuses", :force => true do |t| - t.integer "changesets_count" - t.integer "watchers_count" - t.integer "course_id" - t.float "grade", :default => 0.0 - t.integer "course_ac_para", :default => 0 - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "courses", :force => true do |t| - t.integer "tea_id" - t.string "name" - t.integer "state" - t.string "code" - t.integer "time" - t.string "extra" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "location" - t.string "term" - t.string "string" - t.string "password" - t.string "setup_time" - t.string "endup_time" - t.string "class_period" - t.integer "school_id" - t.text "description" - t.integer "status", :default => 1 - t.integer "attachmenttype", :default => 2 - t.integer "lft" - t.integer "rgt" - t.integer "is_public", :limit => 1, :default => 1 - t.integer "inherit_members", :limit => 1, :default => 1 - t.integer "open_student", :default => 0 - t.integer "outline", :default => 0 - t.integer "publish_resource", :default => 0 - t.integer "is_delete", :default => 0 - end - - create_table "custom_fields", :force => true do |t| - t.string "type", :limit => 30, :default => "", :null => false - t.string "name", :limit => 30, :default => "", :null => false - t.string "field_format", :limit => 30, :default => "", :null => false - t.text "possible_values" - t.string "regexp", :default => "" - t.integer "min_length", :default => 0, :null => false - t.integer "max_length", :default => 0, :null => false - t.boolean "is_required", :default => false, :null => false - t.boolean "is_for_all", :default => false, :null => false - t.boolean "is_filter", :default => false, :null => false - t.integer "position", :default => 1 - t.boolean "searchable", :default => false - t.text "default_value" - t.boolean "editable", :default => true - t.boolean "visible", :default => true, :null => false - t.boolean "multiple", :default => false - end - - add_index "custom_fields", ["id", "type"], :name => "index_custom_fields_on_id_and_type" - - create_table "custom_fields_projects", :id => false, :force => true do |t| - t.integer "custom_field_id", :default => 0, :null => false - t.integer "project_id", :default => 0, :null => false - end - - add_index "custom_fields_projects", ["custom_field_id", "project_id"], :name => "index_custom_fields_projects_on_custom_field_id_and_project_id", :unique => true - - create_table "custom_fields_trackers", :id => false, :force => true do |t| - t.integer "custom_field_id", :default => 0, :null => false - t.integer "tracker_id", :default => 0, :null => false - end - - add_index "custom_fields_trackers", ["custom_field_id", "tracker_id"], :name => "index_custom_fields_trackers_on_custom_field_id_and_tracker_id", :unique => true - - create_table "custom_values", :force => true do |t| - t.string "customized_type", :limit => 30, :default => "", :null => false - t.integer "customized_id", :default => 0, :null => false - t.integer "custom_field_id", :default => 0, :null => false - t.text "value" - end - - add_index "custom_values", ["custom_field_id"], :name => "index_custom_values_on_custom_field_id" - add_index "custom_values", ["customized_type", "customized_id"], :name => "custom_values_customized" - - create_table "delayed_jobs", :force => true do |t| - t.integer "priority", :default => 0, :null => false - t.integer "attempts", :default => 0, :null => false - t.text "handler", :null => false - t.text "last_error" - t.datetime "run_at" - t.datetime "locked_at" - t.datetime "failed_at" - t.string "locked_by" - t.string "queue" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority" - - create_table "discuss_demos", :force => true do |t| - t.string "title" - t.text "body" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "documents", :force => true do |t| - t.integer "project_id", :default => 0, :null => false - t.integer "category_id", :default => 0, :null => false - t.string "title", :limit => 60, :default => "", :null => false - t.text "description" - t.datetime "created_on" - t.integer "user_id", :default => 0 - t.integer "is_public", :default => 1 - end - - add_index "documents", ["category_id"], :name => "index_documents_on_category_id" - add_index "documents", ["created_on"], :name => "index_documents_on_created_on" - add_index "documents", ["project_id"], :name => "documents_project_id" - - create_table "dts", :force => true do |t| - t.string "IPLineCode" - t.string "Description" - t.string "Num" - t.string "Variable" - t.string "TraceInfo" - t.string "Method" - t.string "File" - t.string "IPLine" - t.string "Review" - t.string "Category" - t.string "Defect" - t.string "PreConditions" - t.string "StartLine" - t.integer "project_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "editor_of_documents", :force => true do |t| - t.integer "editor_id" - t.integer "org_document_comment_id" - t.datetime "created_at" - end - - create_table "enabled_modules", :force => true do |t| - t.integer "project_id" - t.string "name", :null => false - t.integer "course_id" - end - - add_index "enabled_modules", ["project_id"], :name => "enabled_modules_project_id" - - create_table "enumerations", :force => true do |t| - t.string "name", :limit => 30, :default => "", :null => false - t.integer "position", :default => 1 - t.boolean "is_default", :default => false, :null => false - t.string "type" - t.boolean "active", :default => true, :null => false - t.integer "project_id" - t.integer "parent_id" - t.string "position_name", :limit => 30 - end - - add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type" - add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id" - - create_table "exercise_answers", :force => true do |t| - t.integer "user_id" - t.integer "exercise_question_id" - t.integer "exercise_choice_id" - t.text "answer_text" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "exercise_choices", :force => true do |t| - t.integer "exercise_question_id" - t.text "choice_text" - t.integer "choice_position" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "exercise_questions", :force => true do |t| - t.text "question_title" - t.integer "question_type" - t.integer "question_number" - t.integer "exercise_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "question_score" - end - - create_table "exercise_standard_answers", :force => true do |t| - t.integer "exercise_question_id" - t.integer "exercise_choice_id" - t.text "answer_text" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "exercise_users", :force => true do |t| - t.integer "user_id" - t.integer "exercise_id" - t.integer "score" - t.datetime "start_at" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.datetime "end_at" - t.integer "status" - end - - create_table "exercises", :force => true do |t| - t.text "exercise_name" - t.text "exercise_description" - t.integer "course_id" - t.integer "exercise_status" - t.integer "user_id" - t.integer "time" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.datetime "publish_time" - t.datetime "end_time" - t.integer "show_result" - end - - create_table "first_pages", :force => true do |t| - t.string "web_title" - t.string "title" - t.text "description" - t.string "page_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "sort_type" - t.integer "image_width", :default => 107 - t.integer "image_height", :default => 63 - t.integer "show_course", :default => 1 - t.integer "show_contest", :default => 1 - end - - create_table "forge_activities", :force => true do |t| - t.integer "user_id" - t.integer "project_id" - t.integer "forge_act_id" - t.string "forge_act_type" - t.integer "org_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "forge_activities", ["forge_act_id"], :name => "index_forge_activities_on_forge_act_id" - - create_table "forge_messages", :force => true do |t| - t.integer "user_id" - t.integer "project_id" - t.integer "forge_message_id" - t.string "forge_message_type" - t.integer "viewed" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "secret_key" - t.integer "status" - end - - create_table "forums", :force => true do |t| - t.string "name", :null => false - t.text "description" - t.integer "topic_count", :default => 0 - t.integer "memo_count", :default => 0 - t.integer "last_memo_id", :default => 0 - t.integer "creator_id", :null => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "sticky" - t.integer "locked" - end - - create_table "groups_users", :id => false, :force => true do |t| - t.integer "group_id", :null => false - t.integer "user_id", :null => false - end - - add_index "groups_users", ["group_id", "user_id"], :name => "groups_users_ids", :unique => true - - create_table "homework_attaches", :force => true do |t| - t.integer "bid_id" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "reward" - t.string "name" - t.text "description" - t.integer "state" - t.integer "project_id", :default => 0 - t.float "score", :default => 0.0 - t.integer "is_teacher_score", :default => 0 - end - - add_index "homework_attaches", ["bid_id"], :name => "index_homework_attaches_on_bid_id" - - create_table "homework_commons", :force => true do |t| - t.string "name" - t.integer "user_id" - t.text "description" - t.date "publish_time" - t.date "end_time" - t.integer "homework_type", :default => 1 - t.string "late_penalty" - t.integer "course_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "teacher_priority", :default => 1 - t.integer "anonymous_comment", :default => 0 - end - - add_index "homework_commons", ["course_id", "id"], :name => "index_homework_commons_on_course_id_and_id" - - create_table "homework_detail_groups", :force => true do |t| - t.integer "homework_common_id" - t.integer "min_num" - t.integer "max_num" - t.integer "base_on_project" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "homework_detail_groups", ["homework_common_id"], :name => "index_homework_detail_groups_on_homework_common_id" - - create_table "homework_detail_manuals", :force => true do |t| - t.float "ta_proportion" - t.integer "comment_status" - t.date "evaluation_start" - t.date "evaluation_end" - t.integer "evaluation_num" - t.integer "absence_penalty", :default => 1 - t.integer "homework_common_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "homework_detail_programings", :force => true do |t| - t.string "language" - t.text "standard_code", :limit => 2147483647 - t.integer "homework_common_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.float "ta_proportion", :default => 0.1 - t.integer "question_id" - end - - create_table "homework_evaluations", :force => true do |t| - t.string "user_id" - t.string "homework_attach_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "homework_for_courses", :force => true do |t| - t.integer "course_id" - t.integer "bid_id" - end - - add_index "homework_for_courses", ["bid_id"], :name => "index_homework_for_courses_on_bid_id" - add_index "homework_for_courses", ["course_id"], :name => "index_homework_for_courses_on_course_id" - - create_table "homework_tests", :force => true do |t| - t.text "input" - t.text "output" - t.integer "homework_common_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "result" - t.text "error_msg" - end - - create_table "homework_users", :force => true do |t| - t.string "homework_attach_id" - t.string "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "invite_lists", :force => true do |t| - t.integer "project_id" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "mail" - end - - create_table "issue_categories", :force => true do |t| - t.integer "project_id", :default => 0, :null => false - t.string "name", :limit => 30, :default => "", :null => false - t.integer "assigned_to_id" - end - - add_index "issue_categories", ["assigned_to_id"], :name => "index_issue_categories_on_assigned_to_id" - add_index "issue_categories", ["project_id"], :name => "issue_categories_project_id" - - create_table "issue_relations", :force => true do |t| - t.integer "issue_from_id", :null => false - t.integer "issue_to_id", :null => false - t.string "relation_type", :default => "", :null => false - t.integer "delay" - end - - add_index "issue_relations", ["issue_from_id", "issue_to_id"], :name => "index_issue_relations_on_issue_from_id_and_issue_to_id", :unique => true - add_index "issue_relations", ["issue_from_id"], :name => "index_issue_relations_on_issue_from_id" - add_index "issue_relations", ["issue_to_id"], :name => "index_issue_relations_on_issue_to_id" - - create_table "issue_statuses", :force => true do |t| - t.string "name", :limit => 30, :default => "", :null => false - t.boolean "is_closed", :default => false, :null => false - t.boolean "is_default", :default => false, :null => false - t.integer "position", :default => 1 - t.integer "default_done_ratio" - end - - add_index "issue_statuses", ["is_closed"], :name => "index_issue_statuses_on_is_closed" - add_index "issue_statuses", ["is_default"], :name => "index_issue_statuses_on_is_default" - add_index "issue_statuses", ["position"], :name => "index_issue_statuses_on_position" - - create_table "issues", :force => true do |t| - t.integer "tracker_id", :null => false - t.integer "project_id", :null => false - t.string "subject", :default => "", :null => false - t.text "description" - t.date "due_date" - t.integer "category_id" - t.integer "status_id", :null => false - t.integer "assigned_to_id" - t.integer "priority_id", :null => false - t.integer "fixed_version_id" - t.integer "author_id", :null => false - t.integer "lock_version", :default => 0, :null => false - t.datetime "created_on" - t.datetime "updated_on" - t.date "start_date" - t.integer "done_ratio", :default => 0, :null => false - t.float "estimated_hours" - t.integer "parent_id" - t.integer "root_id" - t.integer "lft" - t.integer "rgt" - t.boolean "is_private", :default => false, :null => false - t.datetime "closed_on" - t.integer "project_issues_index" - end - - add_index "issues", ["assigned_to_id"], :name => "index_issues_on_assigned_to_id" - add_index "issues", ["author_id"], :name => "index_issues_on_author_id" - add_index "issues", ["category_id"], :name => "index_issues_on_category_id" - add_index "issues", ["created_on"], :name => "index_issues_on_created_on" - add_index "issues", ["fixed_version_id"], :name => "index_issues_on_fixed_version_id" - add_index "issues", ["priority_id"], :name => "index_issues_on_priority_id" - add_index "issues", ["project_id"], :name => "issues_project_id" - add_index "issues", ["root_id", "lft", "rgt"], :name => "index_issues_on_root_id_and_lft_and_rgt" - add_index "issues", ["status_id"], :name => "index_issues_on_status_id" - add_index "issues", ["tracker_id"], :name => "index_issues_on_tracker_id" - - create_table "join_in_competitions", :force => true do |t| - t.integer "user_id" - t.integer "competition_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "join_in_contests", :force => true do |t| - t.integer "user_id" - t.integer "bid_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "journal_details", :force => true do |t| - t.integer "journal_id", :default => 0, :null => false - t.string "property", :limit => 30, :default => "", :null => false - t.string "prop_key", :limit => 30, :default => "", :null => false - t.text "old_value" - t.text "value" - end - - add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id" - - create_table "journal_details_copy", :force => true do |t| - t.integer "journal_id", :default => 0, :null => false - t.string "property", :limit => 30, :default => "", :null => false - t.string "prop_key", :limit => 30, :default => "", :null => false - t.text "old_value" - t.text "value" - end - - add_index "journal_details_copy", ["journal_id"], :name => "journal_details_journal_id" - - create_table "journal_replies", :id => false, :force => true do |t| - t.integer "journal_id" - t.integer "user_id" - t.integer "reply_id" - end - - add_index "journal_replies", ["journal_id"], :name => "index_journal_replies_on_journal_id" - add_index "journal_replies", ["reply_id"], :name => "index_journal_replies_on_reply_id" - add_index "journal_replies", ["user_id"], :name => "index_journal_replies_on_user_id" - - create_table "journals", :force => true do |t| - t.integer "journalized_id", :default => 0, :null => false - t.string "journalized_type", :limit => 30, :default => "", :null => false - t.integer "user_id", :default => 0, :null => false - t.text "notes" - t.datetime "created_on", :null => false - t.boolean "private_notes", :default => false, :null => false - end - - add_index "journals", ["created_on"], :name => "index_journals_on_created_on" - add_index "journals", ["journalized_id", "journalized_type"], :name => "journals_journalized_id" - add_index "journals", ["journalized_id"], :name => "index_journals_on_journalized_id" - add_index "journals", ["user_id"], :name => "index_journals_on_user_id" - - create_table "journals_for_messages", :force => true do |t| - t.integer "jour_id" - t.string "jour_type" - t.integer "user_id" - t.text "notes" - t.integer "status" - t.integer "reply_id" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - t.string "m_parent_id" - t.boolean "is_readed" - t.integer "m_reply_count" - t.integer "m_reply_id" - t.integer "is_comprehensive_evaluation" - end - - create_table "kindeditor_assets", :force => true do |t| - t.string "asset" - t.integer "file_size" - t.string "file_type" - t.integer "owner_id" - t.string "asset_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "owner_type", :default => 0 - end - - create_table "member_roles", :force => true do |t| - t.integer "member_id", :null => false - t.integer "role_id", :null => false - t.integer "inherited_from" - end - - add_index "member_roles", ["member_id"], :name => "index_member_roles_on_member_id" - add_index "member_roles", ["role_id"], :name => "index_member_roles_on_role_id" - - create_table "members", :force => true do |t| - t.integer "user_id", :default => 0, :null => false - t.integer "project_id", :default => 0 - t.datetime "created_on" - t.boolean "mail_notification", :default => false, :null => false - t.integer "course_id", :default => -1 - t.integer "course_group_id", :default => 0 - end - - add_index "members", ["project_id"], :name => "index_members_on_project_id" - add_index "members", ["user_id", "project_id", "course_id"], :name => "index_members_on_user_id_and_project_id", :unique => true - add_index "members", ["user_id"], :name => "index_members_on_user_id" - - create_table "memo_messages", :force => true do |t| - t.integer "user_id" - t.integer "forum_id" - t.integer "memo_id" - t.string "memo_type" - t.integer "viewed" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "memos", :force => true do |t| - t.integer "forum_id", :null => false - t.integer "parent_id" - t.string "subject", :null => false - t.text "content", :null => false - t.integer "author_id", :null => false - t.integer "replies_count", :default => 0 - t.integer "last_reply_id" - t.boolean "lock", :default => false - t.boolean "sticky", :default => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "viewed_count", :default => 0 - end - - create_table "message_alls", :force => true do |t| - t.integer "user_id" - t.integer "message_id" - t.string "message_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "messages", :force => true do |t| - t.integer "board_id", :null => false - t.integer "parent_id" - t.string "subject", :default => "", :null => false - t.text "content" - t.integer "author_id" - t.integer "replies_count", :default => 0, :null => false - t.integer "last_reply_id" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - t.boolean "locked", :default => false - t.integer "sticky", :default => 0 - t.integer "reply_id" - end - - add_index "messages", ["author_id"], :name => "index_messages_on_author_id" - add_index "messages", ["board_id"], :name => "messages_board_id" - add_index "messages", ["created_on"], :name => "index_messages_on_created_on" - add_index "messages", ["last_reply_id"], :name => "index_messages_on_last_reply_id" - add_index "messages", ["parent_id"], :name => "messages_parent_id" - - create_table "news", :force => true do |t| - t.integer "project_id" - t.string "title", :limit => 60, :default => "", :null => false - t.string "summary", :default => "" - t.text "description" - t.integer "author_id", :default => 0, :null => false - t.datetime "created_on" - t.integer "comments_count", :default => 0, :null => false - t.integer "course_id" - t.integer "sticky", :default => 0 - end - - add_index "news", ["author_id"], :name => "index_news_on_author_id" - add_index "news", ["created_on"], :name => "index_news_on_created_on" - add_index "news", ["project_id"], :name => "news_project_id" - - create_table "no_uses", :force => true do |t| - t.integer "user_id", :null => false - t.string "no_use_type" - t.integer "no_use_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "notificationcomments", :force => true do |t| - t.string "notificationcommented_type" - t.integer "notificationcommented_id" - t.integer "author_id" - t.text "notificationcomments" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "onclick_times", :force => true do |t| - t.integer "user_id" - t.datetime "onclick_time" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "open_id_authentication_associations", :force => true do |t| - t.integer "issued" - t.integer "lifetime" - t.string "handle" - t.string "assoc_type" - t.binary "server_url" - t.binary "secret" - end - - create_table "open_id_authentication_nonces", :force => true do |t| - t.integer "timestamp", :null => false - t.string "server_url" - t.string "salt", :null => false - end - - create_table "open_source_projects", :force => true do |t| - t.string "name" - t.text "description" - t.integer "commit_count", :default => 0 - t.integer "code_line", :default => 0 - t.integer "users_count", :default => 0 - t.date "last_commit_time" - t.string "url" - t.date "date_collected" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "option_numbers", :force => true do |t| - t.integer "user_id" - t.integer "memo" - t.integer "messages_for_issues" - t.integer "issues_status" - t.integer "replay_for_message" - t.integer "replay_for_memo" - t.integer "follow" - t.integer "tread" - t.integer "praise_by_one" - t.integer "praise_by_two" - t.integer "praise_by_three" - t.integer "tread_by_one" - t.integer "tread_by_two" - t.integer "tread_by_three" - t.integer "changeset" - t.integer "document" - t.integer "attachment" - t.integer "issue_done_ratio" - t.integer "post_issue" - t.integer "score_type" - t.integer "total_score" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "project_id" - end - - create_table "org_activities", :force => true do |t| - t.integer "user_id" - t.integer "org_act_id" - t.string "org_act_type" - t.integer "container_id" - t.string "container_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "org_courses", :force => true do |t| - t.integer "organization_id" - t.integer "course_id" - t.datetime "created_at" - end - - create_table "org_document_comments", :force => true do |t| - t.text "title" - t.text "content" - t.integer "organization_id" - t.integer "creator_id" - t.integer "parent_id" - t.integer "reply_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.boolean "locked", :default => false - t.integer "sticky", :default => 0 - t.integer "org_subfield_id" - end - - create_table "org_member_roles", :force => true do |t| - t.integer "org_member_id" - t.integer "role_id" - end - - create_table "org_members", :force => true do |t| - t.integer "user_id" - t.integer "organization_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "org_projects", :force => true do |t| - t.integer "organization_id" - t.integer "project_id" - t.datetime "created_at" - end - - create_table "org_subfields", :force => true do |t| - t.integer "organization_id" - t.integer "priority" - t.string "name" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "field_type" - end - - create_table "organizations", :force => true do |t| - t.string "name" - t.text "description" - t.integer "creator_id" - t.integer "home_id" - t.string "domain" - t.boolean "is_public" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "phone_app_versions", :force => true do |t| - t.string "version" - t.text "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "poll_answers", :force => true do |t| - t.integer "poll_question_id" - t.text "answer_text" - t.integer "answer_position" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "poll_questions", :force => true do |t| - t.string "question_title" - t.integer "question_type" - t.integer "is_necessary" - t.integer "poll_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "question_number" - end - - create_table "poll_users", :force => true do |t| - t.integer "user_id" - t.integer "poll_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "poll_votes", :force => true do |t| - t.integer "user_id" - t.integer "poll_question_id" - t.integer "poll_answer_id" - t.text "vote_text" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "polls", :force => true do |t| - t.string "polls_name" - t.string "polls_type" - t.integer "polls_group_id" - t.integer "polls_status" - t.integer "user_id" - t.datetime "published_at" - t.datetime "closed_at" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.text "polls_description" - t.integer "show_result", :default => 1 - end - - create_table "praise_tread_caches", :force => true do |t| - t.integer "object_id", :null => false - t.string "object_type" - t.integer "praise_num" - t.integer "tread_num" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "praise_treads", :force => true do |t| - t.integer "user_id", :null => false - t.integer "praise_tread_object_id" - t.string "praise_tread_object_type" - t.integer "praise_or_tread" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "principal_activities", :force => true do |t| - t.integer "user_id" - t.integer "principal_id" - t.integer "principal_act_id" - t.string "principal_act_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "project_infos", :force => true do |t| - t.integer "project_id" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "project_scores", :force => true do |t| - t.string "project_id" - t.integer "score" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "issue_num", :default => 0 - t.integer "issue_journal_num", :default => 0 - t.integer "news_num", :default => 0 - t.integer "documents_num", :default => 0 - t.integer "changeset_num", :default => 0 - t.integer "board_message_num", :default => 0 - end - - create_table "project_statuses", :force => true do |t| - t.integer "changesets_count" - t.integer "watchers_count" - t.integer "project_id" - t.integer "project_type" - t.float "grade", :default => 0.0 - t.integer "course_ac_para", :default => 0 - end - - add_index "project_statuses", ["grade"], :name => "index_project_statuses_on_grade" - - create_table "projecting_softapplictions", :force => true do |t| - t.integer "user_id" - t.integer "softapplication_id" - t.integer "project_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "projects", :force => true do |t| - t.string "name", :default => "", :null => false - t.text "description" - t.string "homepage", :default => "" - t.boolean "is_public", :default => true, :null => false - t.integer "parent_id" - t.datetime "created_on" - t.datetime "updated_on" - t.string "identifier" - t.integer "status", :default => 1, :null => false - t.integer "lft" - t.integer "rgt" - t.boolean "inherit_members", :default => false, :null => false - t.integer "project_type" - t.boolean "hidden_repo", :default => false, :null => false - t.integer "attachmenttype", :default => 1 - t.integer "user_id" - t.integer "dts_test", :default => 0 - t.string "enterprise_name" - t.integer "organization_id" - t.integer "project_new_type" - t.integer "gpid" - t.integer "forked_from_project_id" - t.integer "forked_count" - t.integer "commits_count", :default => 0 - end - - add_index "projects", ["lft"], :name => "index_projects_on_lft" - add_index "projects", ["rgt"], :name => "index_projects_on_rgt" - - create_table "projects_trackers", :id => false, :force => true do |t| - t.integer "project_id", :default => 0, :null => false - t.integer "tracker_id", :default => 0, :null => false - end - - add_index "projects_trackers", ["project_id", "tracker_id"], :name => "projects_trackers_unique", :unique => true - add_index "projects_trackers", ["project_id"], :name => "projects_trackers_project_id" - - create_table "queries", :force => true do |t| - t.integer "project_id" - t.string "name", :default => "", :null => false - t.text "filters" - t.integer "user_id", :default => 0, :null => false - t.boolean "is_public", :default => false, :null => false - t.text "column_names" - t.text "sort_criteria" - t.string "group_by" - t.string "type" - end - - add_index "queries", ["project_id"], :name => "index_queries_on_project_id" - add_index "queries", ["user_id"], :name => "index_queries_on_user_id" - - create_table "relative_memo_to_open_source_projects", :force => true do |t| - t.integer "osp_id" - t.integer "relative_memo_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "relative_memos", :force => true do |t| - t.integer "osp_id" - t.integer "parent_id" - t.string "subject", :null => false - t.text "content", :limit => 16777215, :null => false - t.integer "author_id" - t.integer "replies_count", :default => 0 - t.integer "last_reply_id" - t.boolean "lock", :default => false - t.boolean "sticky", :default => false - t.boolean "is_quote", :default => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "viewed_count_crawl", :default => 0 - t.integer "viewed_count_local", :default => 0 - t.string "url" - t.string "username" - t.string "userhomeurl" - t.date "date_collected" - t.string "topic_resource" - end - - create_table "repositories", :force => true do |t| - t.integer "project_id", :default => 0, :null => false - t.string "url", :default => "", :null => false - t.string "login", :limit => 60, :default => "" - t.string "password", :default => "" - t.string "root_url", :default => "" - t.string "type" - t.string "path_encoding", :limit => 64 - t.string "log_encoding", :limit => 64 - t.text "extra_info" - t.string "identifier" - t.boolean "is_default", :default => false - t.boolean "hidden", :default => false - end - - add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id" - - create_table "rich_rich_files", :force => true do |t| - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "rich_file_file_name" - t.string "rich_file_content_type" - t.integer "rich_file_file_size" - t.datetime "rich_file_updated_at" - t.string "owner_type" - t.integer "owner_id" - t.text "uri_cache" - t.string "simplified_type", :default => "file" - end - - create_table "roles", :force => true do |t| - t.string "name", :limit => 30, :default => "", :null => false - t.integer "position", :default => 1 - t.boolean "assignable", :default => true - t.integer "builtin", :default => 0, :null => false - t.text "permissions" - t.string "issues_visibility", :limit => 30, :default => "default", :null => false - end - - create_table "schools", :force => true do |t| - t.string "name" - t.string "province" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "logo_link" - t.string "pinyin" - end - - create_table "seems_rateable_cached_ratings", :force => true do |t| - t.integer "cacheable_id", :limit => 8 - t.string "cacheable_type" - t.float "avg", :null => false - t.integer "cnt", :null => false - t.string "dimension" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "seems_rateable_rates", :force => true do |t| - t.integer "rater_id", :limit => 8 - t.integer "rateable_id" - t.string "rateable_type" - t.float "stars", :null => false - t.string "dimension" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "is_teacher_score", :default => 0 - end - - create_table "settings", :force => true do |t| - t.string "name", :default => "", :null => false - t.text "value" - t.datetime "updated_on" - end - - add_index "settings", ["name"], :name => "index_settings_on_name" - - create_table "shares", :force => true do |t| - t.date "created_on" - t.string "url" - t.string "title" - t.integer "share_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "project_id" - t.integer "user_id" - t.string "description" - end - - create_table "softapplications", :force => true do |t| - t.string "name" - t.text "description" - t.integer "app_type_id" - t.string "app_type_name" - t.string "android_min_version_available" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "contest_id" - t.integer "softapplication_id" - t.integer "is_public" - t.string "application_developers" - t.string "deposit_project_url" - t.string "deposit_project" - t.integer "project_id" - end - - create_table "student_work_projects", :force => true do |t| - t.integer "homework_common_id" - t.integer "student_work_id" - t.integer "project_id" - t.integer "user_id" - t.integer "is_leader" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "student_work_projects", ["homework_common_id"], :name => "index_student_work_projects_on_homework_common_id" - add_index "student_work_projects", ["project_id"], :name => "index_student_work_projects_on_project_id" - add_index "student_work_projects", ["student_work_id"], :name => "index_student_work_projects_on_student_work_id" - add_index "student_work_projects", ["user_id"], :name => "index_student_work_projects_on_user_id" - - create_table "student_work_tests", :force => true do |t| - t.integer "student_work_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "status", :default => 9 - t.text "results" - t.text "src" - end - - create_table "student_works", :force => true do |t| - t.string "name" - t.text "description", :limit => 2147483647 - t.integer "homework_common_id" - t.integer "user_id" - t.float "final_score" - t.float "teacher_score" - t.float "student_score" - t.float "teaching_asistant_score" - t.integer "project_id", :default => 0 - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "late_penalty", :default => 0 - t.integer "absence_penalty", :default => 0 - t.float "system_score", :default => 0.0 - t.boolean "is_test", :default => false - end - - add_index "student_works", ["homework_common_id", "user_id"], :name => "index_student_works_on_homework_common_id_and_user_id" - - create_table "student_works_evaluation_distributions", :force => true do |t| - t.integer "student_work_id" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "student_works_scores", :force => true do |t| - t.integer "student_work_id" - t.integer "user_id" - t.integer "score" - t.text "comment" - t.integer "reviewer_role" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "students_for_courses", :force => true do |t| - t.integer "student_id" - t.integer "course_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "students_for_courses", ["course_id"], :name => "index_students_for_courses_on_course_id" - add_index "students_for_courses", ["student_id"], :name => "index_students_for_courses_on_student_id" - - create_table "system_messages", :force => true do |t| - t.integer "user_id" - t.string "content" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.text "description" - t.string "subject" - end - - create_table "taggings", :force => true do |t| - t.integer "tag_id" - t.integer "taggable_id" - t.string "taggable_type" - t.integer "tagger_id" - t.string "tagger_type" - t.string "context", :limit => 128 - t.datetime "created_at" - end - - add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id" - add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context" - add_index "taggings", ["taggable_type"], :name => "index_taggings_on_taggable_type" - - create_table "tags", :force => true do |t| - t.string "name" - end - - create_table "teachers", :force => true do |t| - t.string "tea_name" - t.string "location" - t.integer "couurse_time" - t.integer "course_code" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "extra" - end - - create_table "time_entries", :force => true do |t| - t.integer "project_id", :null => false - t.integer "user_id", :null => false - t.integer "issue_id" - t.float "hours", :null => false - t.string "comments" - t.integer "activity_id", :null => false - t.date "spent_on", :null => false - t.integer "tyear", :null => false - t.integer "tmonth", :null => false - t.integer "tweek", :null => false - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false - end - - add_index "time_entries", ["activity_id"], :name => "index_time_entries_on_activity_id" - add_index "time_entries", ["created_on"], :name => "index_time_entries_on_created_on" - add_index "time_entries", ["issue_id"], :name => "time_entries_issue_id" - add_index "time_entries", ["project_id"], :name => "time_entries_project_id" - add_index "time_entries", ["user_id"], :name => "index_time_entries_on_user_id" - - create_table "tokens", :force => true do |t| - t.integer "user_id", :default => 0, :null => false - t.string "action", :limit => 30, :default => "", :null => false - t.string "value", :limit => 40, :default => "", :null => false - t.datetime "created_on", :null => false - end - - add_index "tokens", ["user_id"], :name => "index_tokens_on_user_id" - add_index "tokens", ["value"], :name => "tokens_value", :unique => true - - create_table "trackers", :force => true do |t| - t.string "name", :limit => 30, :default => "", :null => false - t.boolean "is_in_chlog", :default => false, :null => false - t.integer "position", :default => 1 - t.boolean "is_in_roadmap", :default => true, :null => false - t.integer "fields_bits", :default => 0 - end - - create_table "user_activities", :force => true do |t| - t.string "act_type" - t.integer "act_id" - t.string "container_type" - t.integer "container_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "user_id" - end - - create_table "user_extensions", :force => true do |t| - t.integer "user_id", :null => false - t.date "birthday" - t.string "brief_introduction" - t.integer "gender" - t.string "location" - t.string "occupation" - t.integer "work_experience" - t.integer "zip_code" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "technical_title" - t.integer "identity" - t.string "student_id" - t.string "teacher_realname" - t.string "student_realname" - t.string "location_city" - t.integer "school_id" - t.string "description", :default => "" - end - - create_table "user_feedback_messages", :force => true do |t| - t.integer "user_id" - t.integer "journals_for_message_id" - t.string "journals_for_message_type" - t.integer "viewed" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "user_grades", :force => true do |t| - t.integer "user_id", :null => false - t.integer "project_id", :null => false - t.float "grade", :default => 0.0 - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "user_grades", ["grade"], :name => "index_user_grades_on_grade" - add_index "user_grades", ["project_id"], :name => "index_user_grades_on_project_id" - add_index "user_grades", ["user_id"], :name => "index_user_grades_on_user_id" - - create_table "user_levels", :force => true do |t| - t.integer "user_id" - t.integer "level" - end - - create_table "user_preferences", :force => true do |t| - t.integer "user_id", :default => 0, :null => false - t.text "others" - t.boolean "hide_mail", :default => false - t.string "time_zone" - end - - add_index "user_preferences", ["user_id"], :name => "index_user_preferences_on_user_id" - - create_table "user_score_details", :force => true do |t| - t.integer "current_user_id" - t.integer "target_user_id" - t.string "score_type" - t.string "score_action" - t.integer "user_id" - t.integer "old_score" - t.integer "new_score" - t.integer "current_user_level" - t.integer "target_user_level" - t.integer "score_changeable_obj_id" - t.string "score_changeable_obj_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "user_scores", :force => true do |t| - t.integer "user_id", :null => false - t.integer "collaboration" - t.integer "influence" - t.integer "skill" - t.integer "active" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "user_statuses", :force => true do |t| - t.integer "changesets_count" - t.integer "watchers_count" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.float "grade", :default => 0.0 - end - - add_index "user_statuses", ["changesets_count"], :name => "index_user_statuses_on_changesets_count" - add_index "user_statuses", ["grade"], :name => "index_user_statuses_on_grade" - add_index "user_statuses", ["watchers_count"], :name => "index_user_statuses_on_watchers_count" - - create_table "users", :force => true do |t| - t.string "login", :default => "", :null => false - t.string "hashed_password", :limit => 40, :default => "", :null => false - t.string "firstname", :limit => 30, :default => "", :null => false - t.string "lastname", :default => "", :null => false - t.string "mail", :limit => 60, :default => "", :null => false - t.boolean "admin", :default => false, :null => false - t.integer "status", :default => 1, :null => false - t.datetime "last_login_on" - t.string "language", :limit => 5, :default => "" - t.integer "auth_source_id" - t.datetime "created_on" - t.datetime "updated_on" - t.string "type" - t.string "identity_url" - t.string "mail_notification", :default => "", :null => false - t.string "salt", :limit => 64 - t.integer "gid" - end - - add_index "users", ["auth_source_id"], :name => "index_users_on_auth_source_id" - add_index "users", ["id", "type"], :name => "index_users_on_id_and_type" - add_index "users", ["type"], :name => "index_users_on_type" - - create_table "versions", :force => true do |t| - t.integer "project_id", :default => 0, :null => false - t.string "name", :default => "", :null => false - t.string "description", :default => "" - t.date "effective_date" - t.datetime "created_on" - t.datetime "updated_on" - t.string "wiki_page_title" - t.string "status", :default => "open" - t.string "sharing", :default => "none", :null => false - end - - add_index "versions", ["project_id"], :name => "versions_project_id" - add_index "versions", ["sharing"], :name => "index_versions_on_sharing" - - create_table "visitors", :force => true do |t| - t.integer "user_id" - t.integer "master_id" - t.datetime "updated_on" - t.datetime "created_on" - end - - add_index "visitors", ["master_id"], :name => "index_visitors_master_id" - add_index "visitors", ["updated_on"], :name => "index_visitors_updated_on" - add_index "visitors", ["user_id"], :name => "index_visitors_user_id" - - create_table "watchers", :force => true do |t| - t.string "watchable_type", :default => "", :null => false - t.integer "watchable_id", :default => 0, :null => false - t.integer "user_id" - end - - add_index "watchers", ["user_id", "watchable_type"], :name => "watchers_user_id_type" - add_index "watchers", ["user_id"], :name => "index_watchers_on_user_id" - add_index "watchers", ["watchable_id", "watchable_type"], :name => "index_watchers_on_watchable_id_and_watchable_type" - - create_table "web_footer_companies", :force => true do |t| - t.string "name" - t.string "logo_size" - t.string "url" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "web_footer_oranizers", :force => true do |t| - t.string "name" - t.text "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "wiki_content_versions", :force => true do |t| - t.integer "wiki_content_id", :null => false - t.integer "page_id", :null => false - t.integer "author_id" - t.binary "data", :limit => 2147483647 - t.string "compression", :limit => 6, :default => "" - t.string "comments", :default => "" - t.datetime "updated_on", :null => false - t.integer "version", :null => false - end - - add_index "wiki_content_versions", ["updated_on"], :name => "index_wiki_content_versions_on_updated_on" - add_index "wiki_content_versions", ["wiki_content_id"], :name => "wiki_content_versions_wcid" - - create_table "wiki_contents", :force => true do |t| - t.integer "page_id", :null => false - t.integer "author_id" - t.text "text", :limit => 2147483647 - t.string "comments", :default => "" - t.datetime "updated_on", :null => false - t.integer "version", :null => false - end - - add_index "wiki_contents", ["author_id"], :name => "index_wiki_contents_on_author_id" - add_index "wiki_contents", ["page_id"], :name => "wiki_contents_page_id" - - create_table "wiki_pages", :force => true do |t| - t.integer "wiki_id", :null => false - t.string "title", :null => false - t.datetime "created_on", :null => false - t.boolean "protected", :default => false, :null => false - t.integer "parent_id" - end - - add_index "wiki_pages", ["parent_id"], :name => "index_wiki_pages_on_parent_id" - add_index "wiki_pages", ["wiki_id", "title"], :name => "wiki_pages_wiki_id_title" - add_index "wiki_pages", ["wiki_id"], :name => "index_wiki_pages_on_wiki_id" - - create_table "wiki_redirects", :force => true do |t| - t.integer "wiki_id", :null => false - t.string "title" - t.string "redirects_to" - t.datetime "created_on", :null => false - end - - add_index "wiki_redirects", ["wiki_id", "title"], :name => "wiki_redirects_wiki_id_title" - add_index "wiki_redirects", ["wiki_id"], :name => "index_wiki_redirects_on_wiki_id" - - create_table "wikis", :force => true do |t| - t.integer "project_id", :null => false - t.string "start_page", :null => false - t.integer "status", :default => 1, :null => false - end - - add_index "wikis", ["project_id"], :name => "wikis_project_id" - - create_table "workflows", :force => true do |t| - t.integer "tracker_id", :default => 0, :null => false - t.integer "old_status_id", :default => 0, :null => false - t.integer "new_status_id", :default => 0, :null => false - t.integer "role_id", :default => 0, :null => false - t.boolean "assignee", :default => false, :null => false - t.boolean "author", :default => false, :null => false - t.string "type", :limit => 30 - t.string "field_name", :limit => 30 - t.string "rule", :limit => 30 - end - - add_index "workflows", ["new_status_id"], :name => "index_workflows_on_new_status_id" - add_index "workflows", ["old_status_id"], :name => "index_workflows_on_old_status_id" - add_index "workflows", ["role_id", "tracker_id", "old_status_id"], :name => "wkfs_role_tracker_old_status" - add_index "workflows", ["role_id"], :name => "index_workflows_on_role_id" - - create_table "works_categories", :force => true do |t| - t.string "category" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "zip_packs", :force => true do |t| - t.integer "user_id" - t.integer "homework_id" - t.string "file_digest" - t.string "file_path" - t.integer "pack_times", :default => 1 - t.integer "pack_size", :default => 0 - t.text "file_digests" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - -end +# encoding: UTF-8 +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended to check this file into your version control system. + +ActiveRecord::Schema.define(:version => 20151230022443) do + + create_table "activities", :force => true do |t| + t.integer "act_id", :null => false + t.string "act_type", :null => false + t.integer "user_id", :null => false + t.integer "activity_container_id" + t.string "activity_container_type", :default => "" + t.datetime "created_at" + end + + add_index "activities", ["act_id", "act_type"], :name => "index_activities_on_act_id_and_act_type" + add_index "activities", ["user_id", "act_type"], :name => "index_activities_on_user_id_and_act_type" + add_index "activities", ["user_id"], :name => "index_activities_on_user_id" + + create_table "activity_notifies", :force => true do |t| + t.integer "activity_container_id" + t.string "activity_container_type" + t.integer "activity_id" + t.string "activity_type" + t.integer "notify_to" + t.datetime "created_on" + t.integer "is_read" + end + + add_index "activity_notifies", ["activity_container_id", "activity_container_type"], :name => "index_an_activity_container_id" + add_index "activity_notifies", ["created_on"], :name => "index_an_created_on" + add_index "activity_notifies", ["notify_to"], :name => "index_an_notify_to" + + create_table "api_keys", :force => true do |t| + t.string "access_token" + t.datetime "expires_at" + t.integer "user_id" + t.boolean "active", :default => true + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "api_keys", ["access_token"], :name => "index_api_keys_on_access_token" + add_index "api_keys", ["user_id"], :name => "index_api_keys_on_user_id" + + create_table "applied_projects", :force => true do |t| + t.integer "project_id", :null => false + t.integer "user_id", :null => false + end + + create_table "apply_project_masters", :force => true do |t| + t.integer "user_id" + t.string "apply_type" + t.integer "apply_id" + t.integer "status" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "at_messages", :force => true do |t| + t.integer "user_id" + t.integer "at_message_id" + t.string "at_message_type" + t.boolean "viewed", :default => false + t.string "container_type" + t.integer "container_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "sender_id" + end + + add_index "at_messages", ["user_id"], :name => "index_at_messages_on_user_id" + + create_table "attachment_histories", :force => true do |t| + t.integer "container_id" + t.string "container_type" + t.string "filename", :default => "" + t.string "disk_filename", :default => "" + t.integer "filesize", :default => 0 + t.string "content_type", :default => "" + t.string "digest", :limit => 40, :default => "" + t.integer "downloads", :default => 0 + t.integer "author_id" + t.datetime "created_on" + t.string "description" + t.string "disk_directory" + t.integer "attachtype" + t.integer "is_public" + t.integer "copy_from" + t.integer "quotes" + t.integer "version" + t.integer "attachment_id" + end + + create_table "attachments", :force => true do |t| + t.integer "container_id" + t.string "container_type", :limit => 30 + t.string "filename", :default => "", :null => false + t.string "disk_filename", :default => "", :null => false + t.integer "filesize", :default => 0, :null => false + t.string "content_type", :default => "" + t.string "digest", :limit => 40, :default => "", :null => false + t.integer "downloads", :default => 0, :null => false + t.integer "author_id", :default => 0, :null => false + t.datetime "created_on" + t.string "description" + t.string "disk_directory" + t.integer "attachtype", :default => 1 + t.integer "is_public", :default => 1 + t.integer "copy_from" + t.integer "quotes" + end + + add_index "attachments", ["author_id"], :name => "index_attachments_on_author_id" + add_index "attachments", ["container_id", "container_type"], :name => "index_attachments_on_container_id_and_container_type" + add_index "attachments", ["created_on"], :name => "index_attachments_on_created_on" + + create_table "attachmentstypes", :force => true do |t| + t.integer "typeId", :null => false + t.string "typeName", :limit => 50 + end + + create_table "auth_sources", :force => true do |t| + t.string "type", :limit => 30, :default => "", :null => false + t.string "name", :limit => 60, :default => "", :null => false + t.string "host", :limit => 60 + t.integer "port" + t.string "account" + t.string "account_password", :default => "" + t.string "base_dn" + t.string "attr_login", :limit => 30 + t.string "attr_firstname", :limit => 30 + t.string "attr_lastname", :limit => 30 + t.string "attr_mail", :limit => 30 + t.boolean "onthefly_register", :default => false, :null => false + t.boolean "tls", :default => false, :null => false + t.string "filter" + t.integer "timeout" + end + + add_index "auth_sources", ["id", "type"], :name => "index_auth_sources_on_id_and_type" + + create_table "biding_projects", :force => true do |t| + t.integer "project_id" + t.integer "bid_id" + t.integer "user_id" + t.string "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "reward" + end + + create_table "bids", :force => true do |t| + t.string "name" + t.string "budget", :null => false + t.integer "author_id" + t.date "deadline" + t.text "description" + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + t.integer "commit" + t.integer "reward_type" + t.integer "homework_type" + t.integer "parent_id" + t.string "password" + t.integer "is_evaluation" + t.integer "proportion", :default => 60 + t.integer "comment_status", :default => 0 + t.integer "evaluation_num", :default => 3 + t.integer "open_anonymous_evaluation", :default => 1 + end + + create_table "blog_comments", :force => true do |t| + t.integer "blog_id", :null => false + t.integer "parent_id" + t.string "title", :default => "", :null => false + t.text "content" + t.integer "author_id" + t.integer "comments_count", :default => 0, :null => false + t.integer "last_comment_id" + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + t.boolean "locked", :default => false + t.integer "sticky", :default => 0 + t.integer "reply_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "blogs", :force => true do |t| + t.string "name", :default => "", :null => false + t.text "description" + t.integer "position", :default => 1 + t.integer "article_count", :default => 0, :null => false + t.integer "comments_count", :default => 0, :null => false + t.integer "last_comments_id" + t.integer "parent_id" + t.integer "author_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "boards", :force => true do |t| + t.integer "project_id", :null => false + t.string "name", :default => "", :null => false + t.string "description" + t.integer "position", :default => 1 + t.integer "topics_count", :default => 0, :null => false + t.integer "messages_count", :default => 0, :null => false + t.integer "last_message_id" + t.integer "parent_id" + t.integer "course_id" + end + + add_index "boards", ["last_message_id"], :name => "index_boards_on_last_message_id" + add_index "boards", ["project_id"], :name => "boards_project_id" + + create_table "bug_to_osps", :force => true do |t| + t.integer "osp_id" + t.integer "relative_memo_id" + t.string "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "changes", :force => true do |t| + t.integer "changeset_id", :null => false + t.string "action", :limit => 1, :default => "", :null => false + t.text "path", :null => false + t.text "from_path" + t.string "from_revision" + t.string "revision" + t.string "branch" + end + + add_index "changes", ["changeset_id"], :name => "changesets_changeset_id" + + create_table "changeset_parents", :id => false, :force => true do |t| + t.integer "changeset_id", :null => false + t.integer "parent_id", :null => false + end + + add_index "changeset_parents", ["changeset_id"], :name => "changeset_parents_changeset_ids" + add_index "changeset_parents", ["parent_id"], :name => "changeset_parents_parent_ids" + + create_table "changesets", :force => true do |t| + t.integer "repository_id", :null => false + t.string "revision", :null => false + t.string "committer" + t.datetime "committed_on", :null => false + t.text "comments" + t.date "commit_date" + t.string "scmid" + t.integer "user_id" + end + + add_index "changesets", ["committed_on"], :name => "index_changesets_on_committed_on" + add_index "changesets", ["repository_id", "revision"], :name => "changesets_repos_rev", :unique => true + add_index "changesets", ["repository_id", "scmid"], :name => "changesets_repos_scmid" + add_index "changesets", ["repository_id"], :name => "index_changesets_on_repository_id" + add_index "changesets", ["user_id"], :name => "index_changesets_on_user_id" + + create_table "changesets_issues", :id => false, :force => true do |t| + t.integer "changeset_id", :null => false + t.integer "issue_id", :null => false + end + + add_index "changesets_issues", ["changeset_id", "issue_id"], :name => "changesets_issues_ids", :unique => true + + create_table "code_review_assignments", :force => true do |t| + t.integer "issue_id" + t.integer "change_id" + t.integer "attachment_id" + t.string "file_path" + t.string "rev" + t.string "rev_to" + t.string "action_type" + t.integer "changeset_id" + end + + create_table "code_review_project_settings", :force => true do |t| + t.integer "project_id" + t.integer "tracker_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "updated_by" + t.boolean "hide_code_review_tab", :default => false + t.integer "auto_relation", :default => 1 + t.integer "assignment_tracker_id" + t.text "auto_assign" + t.integer "lock_version", :default => 0, :null => false + t.boolean "tracker_in_review_dialog", :default => false + end + + create_table "code_review_user_settings", :force => true do |t| + t.integer "user_id", :default => 0, :null => false + t.integer "mail_notification", :default => 0, :null => false + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "code_reviews", :force => true do |t| + t.integer "project_id" + t.integer "change_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "line" + t.integer "updated_by_id" + t.integer "lock_version", :default => 0, :null => false + t.integer "status_changed_from" + t.integer "status_changed_to" + t.integer "issue_id" + t.string "action_type" + t.string "file_path" + t.string "rev" + t.string "rev_to" + t.integer "attachment_id" + t.integer "file_count", :default => 0, :null => false + t.boolean "diff_all" + end + + create_table "comments", :force => true do |t| + t.string "commented_type", :limit => 30, :default => "", :null => false + t.integer "commented_id", :default => 0, :null => false + t.integer "author_id", :default => 0, :null => false + t.text "comments" + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + end + + add_index "comments", ["author_id"], :name => "index_comments_on_author_id" + add_index "comments", ["commented_id", "commented_type"], :name => "index_comments_on_commented_id_and_commented_type" + + create_table "contest_notifications", :force => true do |t| + t.text "title" + t.text "content" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "contesting_projects", :force => true do |t| + t.integer "project_id" + t.string "contest_id" + t.integer "user_id" + t.string "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "reward" + end + + create_table "contesting_softapplications", :force => true do |t| + t.integer "softapplication_id" + t.integer "contest_id" + t.integer "user_id" + t.string "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "reward" + end + + create_table "contestnotifications", :force => true do |t| + t.integer "contest_id" + t.string "title" + t.string "summary" + t.text "description" + t.integer "author_id" + t.integer "notificationcomments_count" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "contests", :force => true do |t| + t.string "name" + t.string "budget", :default => "" + t.integer "author_id" + t.date "deadline" + t.string "description" + t.integer "commit" + t.string "password" + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + end + + create_table "course_activities", :force => true do |t| + t.integer "user_id" + t.integer "course_id" + t.integer "course_act_id" + t.string "course_act_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "course_attachments", :force => true do |t| + t.string "filename" + t.string "disk_filename" + t.integer "filesize" + t.string "content_type" + t.string "digest" + t.integer "downloads" + t.string "author_id" + t.string "integer" + t.string "description" + t.string "disk_directory" + t.integer "attachtype" + t.integer "is_public" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "container_id", :default => 0 + end + + create_table "course_contributor_scores", :force => true do |t| + t.integer "course_id" + t.integer "user_id" + t.integer "message_num" + t.integer "message_reply_num" + t.integer "news_reply_num" + t.integer "resource_num" + t.integer "journal_num" + t.integer "journal_reply_num" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "total_score" + end + + create_table "course_groups", :force => true do |t| + t.string "name" + t.integer "course_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "course_infos", :force => true do |t| + t.integer "course_id" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "course_messages", :force => true do |t| + t.integer "user_id" + t.integer "course_id" + t.integer "course_message_id" + t.string "course_message_type" + t.integer "viewed" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "content" + t.integer "status" + end + + create_table "course_statuses", :force => true do |t| + t.integer "changesets_count" + t.integer "watchers_count" + t.integer "course_id" + t.float "grade", :default => 0.0 + t.integer "course_ac_para", :default => 0 + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "courses", :force => true do |t| + t.integer "tea_id" + t.string "name" + t.integer "state" + t.string "code" + t.integer "time" + t.string "extra" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "location" + t.string "term" + t.string "string" + t.string "password" + t.string "setup_time" + t.string "endup_time" + t.string "class_period" + t.integer "school_id" + t.text "description" + t.integer "status", :default => 1 + t.integer "attachmenttype", :default => 2 + t.integer "lft" + t.integer "rgt" + t.integer "is_public", :limit => 1, :default => 1 + t.integer "inherit_members", :limit => 1, :default => 1 + t.integer "open_student", :default => 0 + t.integer "outline", :default => 0 + t.integer "publish_resource", :default => 0 + t.integer "is_delete", :default => 0 + end + + create_table "custom_fields", :force => true do |t| + t.string "type", :limit => 30, :default => "", :null => false + t.string "name", :limit => 30, :default => "", :null => false + t.string "field_format", :limit => 30, :default => "", :null => false + t.text "possible_values" + t.string "regexp", :default => "" + t.integer "min_length", :default => 0, :null => false + t.integer "max_length", :default => 0, :null => false + t.boolean "is_required", :default => false, :null => false + t.boolean "is_for_all", :default => false, :null => false + t.boolean "is_filter", :default => false, :null => false + t.integer "position", :default => 1 + t.boolean "searchable", :default => false + t.text "default_value" + t.boolean "editable", :default => true + t.boolean "visible", :default => true, :null => false + t.boolean "multiple", :default => false + end + + add_index "custom_fields", ["id", "type"], :name => "index_custom_fields_on_id_and_type" + + create_table "custom_fields_projects", :id => false, :force => true do |t| + t.integer "custom_field_id", :default => 0, :null => false + t.integer "project_id", :default => 0, :null => false + end + + add_index "custom_fields_projects", ["custom_field_id", "project_id"], :name => "index_custom_fields_projects_on_custom_field_id_and_project_id", :unique => true + + create_table "custom_fields_trackers", :id => false, :force => true do |t| + t.integer "custom_field_id", :default => 0, :null => false + t.integer "tracker_id", :default => 0, :null => false + end + + add_index "custom_fields_trackers", ["custom_field_id", "tracker_id"], :name => "index_custom_fields_trackers_on_custom_field_id_and_tracker_id", :unique => true + + create_table "custom_values", :force => true do |t| + t.string "customized_type", :limit => 30, :default => "", :null => false + t.integer "customized_id", :default => 0, :null => false + t.integer "custom_field_id", :default => 0, :null => false + t.text "value" + end + + add_index "custom_values", ["custom_field_id"], :name => "index_custom_values_on_custom_field_id" + add_index "custom_values", ["customized_type", "customized_id"], :name => "custom_values_customized" + + create_table "delayed_jobs", :force => true do |t| + t.integer "priority", :default => 0, :null => false + t.integer "attempts", :default => 0, :null => false + t.text "handler", :null => false + t.text "last_error" + t.datetime "run_at" + t.datetime "locked_at" + t.datetime "failed_at" + t.string "locked_by" + t.string "queue" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority" + + create_table "discuss_demos", :force => true do |t| + t.string "title" + t.text "body" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "documents", :force => true do |t| + t.integer "project_id", :default => 0, :null => false + t.integer "category_id", :default => 0, :null => false + t.string "title", :limit => 60, :default => "", :null => false + t.text "description" + t.datetime "created_on" + t.integer "user_id", :default => 0 + t.integer "is_public", :default => 1 + end + + add_index "documents", ["category_id"], :name => "index_documents_on_category_id" + add_index "documents", ["created_on"], :name => "index_documents_on_created_on" + add_index "documents", ["project_id"], :name => "documents_project_id" + + create_table "dts", :primary_key => "Num", :force => true do |t| + t.string "Defect", :limit => 50 + t.string "Category", :limit => 50 + t.string "File" + t.string "Method" + t.string "Module", :limit => 20 + t.string "Variable", :limit => 50 + t.integer "StartLine" + t.integer "IPLine" + t.string "IPLineCode", :limit => 200 + t.string "Judge", :limit => 15 + t.integer "Review", :limit => 1 + t.string "Description" + t.text "PreConditions", :limit => 2147483647 + t.text "TraceInfo", :limit => 2147483647 + t.text "Code", :limit => 2147483647 + t.integer "project_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "id", :null => false + end + + create_table "editor_of_documents", :force => true do |t| + t.integer "editor_id" + t.integer "org_document_comment_id" + t.datetime "created_at" + end + + create_table "enabled_modules", :force => true do |t| + t.integer "project_id" + t.string "name", :null => false + t.integer "course_id" + end + + add_index "enabled_modules", ["project_id"], :name => "enabled_modules_project_id" + + create_table "enumerations", :force => true do |t| + t.string "name", :limit => 30, :default => "", :null => false + t.integer "position", :default => 1 + t.boolean "is_default", :default => false, :null => false + t.string "type" + t.boolean "active", :default => true, :null => false + t.integer "project_id" + t.integer "parent_id" + t.string "position_name", :limit => 30 + end + + add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type" + add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id" + + create_table "exercise_answers", :force => true do |t| + t.integer "user_id" + t.integer "exercise_question_id" + t.integer "exercise_choice_id" + t.text "answer_text" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "exercise_choices", :force => true do |t| + t.integer "exercise_question_id" + t.text "choice_text" + t.integer "choice_position" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "exercise_questions", :force => true do |t| + t.text "question_title" + t.integer "question_type" + t.integer "question_number" + t.integer "exercise_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "question_score" + end + + create_table "exercise_standard_answers", :force => true do |t| + t.integer "exercise_question_id" + t.integer "exercise_choice_id" + t.text "answer_text" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "exercise_users", :force => true do |t| + t.integer "user_id" + t.integer "exercise_id" + t.integer "score" + t.datetime "start_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.datetime "end_at" + t.integer "status" + end + + create_table "exercises", :force => true do |t| + t.text "exercise_name" + t.text "exercise_description" + t.integer "course_id" + t.integer "exercise_status" + t.integer "user_id" + t.integer "time" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.datetime "publish_time" + t.datetime "end_time" + t.integer "show_result" + end + + create_table "first_pages", :force => true do |t| + t.string "web_title" + t.string "title" + t.text "description" + t.string "page_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "sort_type" + t.integer "image_width", :default => 107 + t.integer "image_height", :default => 63 + t.integer "show_course", :default => 1 + t.integer "show_contest", :default => 1 + end + + create_table "forge_activities", :force => true do |t| + t.integer "user_id" + t.integer "project_id" + t.integer "forge_act_id" + t.string "forge_act_type" + t.integer "org_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "forge_activities", ["forge_act_id"], :name => "index_forge_activities_on_forge_act_id" + + create_table "forge_messages", :force => true do |t| + t.integer "user_id" + t.integer "project_id" + t.integer "forge_message_id" + t.string "forge_message_type" + t.integer "viewed" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "secret_key" + t.integer "status" + end + + create_table "forums", :force => true do |t| + t.string "name", :null => false + t.text "description" + t.integer "topic_count", :default => 0 + t.integer "memo_count", :default => 0 + t.integer "last_memo_id", :default => 0 + t.integer "creator_id", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "sticky" + t.integer "locked" + end + + create_table "groups_users", :id => false, :force => true do |t| + t.integer "group_id", :null => false + t.integer "user_id", :null => false + end + + add_index "groups_users", ["group_id", "user_id"], :name => "groups_users_ids", :unique => true + + create_table "homework_attaches", :force => true do |t| + t.integer "bid_id" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "reward" + t.string "name" + t.text "description" + t.integer "state" + t.integer "project_id", :default => 0 + t.float "score", :default => 0.0 + t.integer "is_teacher_score", :default => 0 + end + + add_index "homework_attaches", ["bid_id"], :name => "index_homework_attaches_on_bid_id" + + create_table "homework_commons", :force => true do |t| + t.string "name" + t.integer "user_id" + t.text "description" + t.date "publish_time" + t.date "end_time" + t.integer "homework_type", :default => 1 + t.string "late_penalty" + t.integer "course_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "teacher_priority", :default => 1 + t.integer "anonymous_comment", :default => 0 + end + + add_index "homework_commons", ["course_id", "id"], :name => "index_homework_commons_on_course_id_and_id" + + create_table "homework_detail_groups", :force => true do |t| + t.integer "homework_common_id" + t.integer "min_num" + t.integer "max_num" + t.integer "base_on_project" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "homework_detail_groups", ["homework_common_id"], :name => "index_homework_detail_groups_on_homework_common_id" + + create_table "homework_detail_manuals", :force => true do |t| + t.float "ta_proportion" + t.integer "comment_status" + t.date "evaluation_start" + t.date "evaluation_end" + t.integer "evaluation_num" + t.integer "absence_penalty", :default => 1 + t.integer "homework_common_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "homework_detail_programings", :force => true do |t| + t.string "language" + t.text "standard_code", :limit => 2147483647 + t.integer "homework_common_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.float "ta_proportion", :default => 0.1 + t.integer "question_id" + end + + create_table "homework_evaluations", :force => true do |t| + t.string "user_id" + t.string "homework_attach_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "homework_for_courses", :force => true do |t| + t.integer "course_id" + t.integer "bid_id" + end + + add_index "homework_for_courses", ["bid_id"], :name => "index_homework_for_courses_on_bid_id" + add_index "homework_for_courses", ["course_id"], :name => "index_homework_for_courses_on_course_id" + + create_table "homework_tests", :force => true do |t| + t.text "input" + t.text "output" + t.integer "homework_common_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "result" + t.text "error_msg" + end + + create_table "homework_users", :force => true do |t| + t.string "homework_attach_id" + t.string "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "invite_lists", :force => true do |t| + t.integer "project_id" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "mail" + end + + create_table "issue_categories", :force => true do |t| + t.integer "project_id", :default => 0, :null => false + t.string "name", :limit => 30, :default => "", :null => false + t.integer "assigned_to_id" + end + + add_index "issue_categories", ["assigned_to_id"], :name => "index_issue_categories_on_assigned_to_id" + add_index "issue_categories", ["project_id"], :name => "issue_categories_project_id" + + create_table "issue_relations", :force => true do |t| + t.integer "issue_from_id", :null => false + t.integer "issue_to_id", :null => false + t.string "relation_type", :default => "", :null => false + t.integer "delay" + end + + add_index "issue_relations", ["issue_from_id", "issue_to_id"], :name => "index_issue_relations_on_issue_from_id_and_issue_to_id", :unique => true + add_index "issue_relations", ["issue_from_id"], :name => "index_issue_relations_on_issue_from_id" + add_index "issue_relations", ["issue_to_id"], :name => "index_issue_relations_on_issue_to_id" + + create_table "issue_statuses", :force => true do |t| + t.string "name", :limit => 30, :default => "", :null => false + t.boolean "is_closed", :default => false, :null => false + t.boolean "is_default", :default => false, :null => false + t.integer "position", :default => 1 + t.integer "default_done_ratio" + end + + add_index "issue_statuses", ["is_closed"], :name => "index_issue_statuses_on_is_closed" + add_index "issue_statuses", ["is_default"], :name => "index_issue_statuses_on_is_default" + add_index "issue_statuses", ["position"], :name => "index_issue_statuses_on_position" + + create_table "issues", :force => true do |t| + t.integer "tracker_id", :null => false + t.integer "project_id", :null => false + t.string "subject", :default => "", :null => false + t.text "description" + t.date "due_date" + t.integer "category_id" + t.integer "status_id", :null => false + t.integer "assigned_to_id" + t.integer "priority_id", :null => false + t.integer "fixed_version_id" + t.integer "author_id", :null => false + t.integer "lock_version", :default => 0, :null => false + t.datetime "created_on" + t.datetime "updated_on" + t.date "start_date" + t.integer "done_ratio", :default => 0, :null => false + t.float "estimated_hours" + t.integer "parent_id" + t.integer "root_id" + t.integer "lft" + t.integer "rgt" + t.boolean "is_private", :default => false, :null => false + t.datetime "closed_on" + t.integer "project_issues_index" + end + + add_index "issues", ["assigned_to_id"], :name => "index_issues_on_assigned_to_id" + add_index "issues", ["author_id"], :name => "index_issues_on_author_id" + add_index "issues", ["category_id"], :name => "index_issues_on_category_id" + add_index "issues", ["created_on"], :name => "index_issues_on_created_on" + add_index "issues", ["fixed_version_id"], :name => "index_issues_on_fixed_version_id" + add_index "issues", ["priority_id"], :name => "index_issues_on_priority_id" + add_index "issues", ["project_id"], :name => "issues_project_id" + add_index "issues", ["root_id", "lft", "rgt"], :name => "index_issues_on_root_id_and_lft_and_rgt" + add_index "issues", ["status_id"], :name => "index_issues_on_status_id" + add_index "issues", ["tracker_id"], :name => "index_issues_on_tracker_id" + + create_table "join_in_competitions", :force => true do |t| + t.integer "user_id" + t.integer "competition_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "join_in_contests", :force => true do |t| + t.integer "user_id" + t.integer "bid_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "journal_details", :force => true do |t| + t.integer "journal_id", :default => 0, :null => false + t.string "property", :limit => 30, :default => "", :null => false + t.string "prop_key", :limit => 30, :default => "", :null => false + t.text "old_value" + t.text "value" + end + + add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id" + + create_table "journal_replies", :id => false, :force => true do |t| + t.integer "journal_id" + t.integer "user_id" + t.integer "reply_id" + end + + add_index "journal_replies", ["journal_id"], :name => "index_journal_replies_on_journal_id" + add_index "journal_replies", ["reply_id"], :name => "index_journal_replies_on_reply_id" + add_index "journal_replies", ["user_id"], :name => "index_journal_replies_on_user_id" + + create_table "journals", :force => true do |t| + t.integer "journalized_id", :default => 0, :null => false + t.string "journalized_type", :limit => 30, :default => "", :null => false + t.integer "user_id", :default => 0, :null => false + t.text "notes" + t.datetime "created_on", :null => false + t.boolean "private_notes", :default => false, :null => false + end + + add_index "journals", ["created_on"], :name => "index_journals_on_created_on" + add_index "journals", ["journalized_id", "journalized_type"], :name => "journals_journalized_id" + add_index "journals", ["journalized_id"], :name => "index_journals_on_journalized_id" + add_index "journals", ["user_id"], :name => "index_journals_on_user_id" + + create_table "journals_for_messages", :force => true do |t| + t.integer "jour_id" + t.string "jour_type" + t.integer "user_id" + t.text "notes" + t.integer "status" + t.integer "reply_id" + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + t.string "m_parent_id" + t.boolean "is_readed" + t.integer "m_reply_count" + t.integer "m_reply_id" + t.integer "is_comprehensive_evaluation" + end + + create_table "kindeditor_assets", :force => true do |t| + t.string "asset" + t.integer "file_size" + t.string "file_type" + t.integer "owner_id" + t.string "asset_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "owner_type", :default => 0 + end + + create_table "member_roles", :force => true do |t| + t.integer "member_id", :null => false + t.integer "role_id", :null => false + t.integer "inherited_from" + end + + add_index "member_roles", ["member_id"], :name => "index_member_roles_on_member_id" + add_index "member_roles", ["role_id"], :name => "index_member_roles_on_role_id" + + create_table "members", :force => true do |t| + t.integer "user_id", :default => 0, :null => false + t.integer "project_id", :default => 0 + t.datetime "created_on" + t.boolean "mail_notification", :default => false, :null => false + t.integer "course_id", :default => -1 + t.integer "course_group_id", :default => 0 + end + + add_index "members", ["project_id"], :name => "index_members_on_project_id" + add_index "members", ["user_id", "project_id", "course_id"], :name => "index_members_on_user_id_and_project_id", :unique => true + add_index "members", ["user_id"], :name => "index_members_on_user_id" + + create_table "memo_messages", :force => true do |t| + t.integer "user_id" + t.integer "forum_id" + t.integer "memo_id" + t.string "memo_type" + t.integer "viewed" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "memos", :force => true do |t| + t.integer "forum_id", :null => false + t.integer "parent_id" + t.string "subject", :null => false + t.text "content", :null => false + t.integer "author_id", :null => false + t.integer "replies_count", :default => 0 + t.integer "last_reply_id" + t.boolean "lock", :default => false + t.boolean "sticky", :default => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "viewed_count", :default => 0 + end + + create_table "message_alls", :force => true do |t| + t.integer "user_id" + t.integer "message_id" + t.string "message_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "messages", :force => true do |t| + t.integer "board_id", :null => false + t.integer "parent_id" + t.string "subject", :default => "", :null => false + t.text "content" + t.integer "author_id" + t.integer "replies_count", :default => 0, :null => false + t.integer "last_reply_id" + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + t.boolean "locked", :default => false + t.integer "sticky", :default => 0 + t.integer "reply_id" + end + + add_index "messages", ["author_id"], :name => "index_messages_on_author_id" + add_index "messages", ["board_id"], :name => "messages_board_id" + add_index "messages", ["created_on"], :name => "index_messages_on_created_on" + add_index "messages", ["last_reply_id"], :name => "index_messages_on_last_reply_id" + add_index "messages", ["parent_id"], :name => "messages_parent_id" + + create_table "news", :force => true do |t| + t.integer "project_id" + t.string "title", :limit => 60, :default => "", :null => false + t.string "summary", :default => "" + t.text "description" + t.integer "author_id", :default => 0, :null => false + t.datetime "created_on" + t.integer "comments_count", :default => 0, :null => false + t.integer "course_id" + t.integer "sticky", :default => 0 + end + + add_index "news", ["author_id"], :name => "index_news_on_author_id" + add_index "news", ["created_on"], :name => "index_news_on_created_on" + add_index "news", ["project_id"], :name => "news_project_id" + + create_table "no_uses", :force => true do |t| + t.integer "user_id", :null => false + t.string "no_use_type" + t.integer "no_use_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "notificationcomments", :force => true do |t| + t.string "notificationcommented_type" + t.integer "notificationcommented_id" + t.integer "author_id" + t.text "notificationcomments" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "onclick_times", :force => true do |t| + t.integer "user_id" + t.datetime "onclick_time" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "open_id_authentication_associations", :force => true do |t| + t.integer "issued" + t.integer "lifetime" + t.string "handle" + t.string "assoc_type" + t.binary "server_url" + t.binary "secret" + end + + create_table "open_id_authentication_nonces", :force => true do |t| + t.integer "timestamp", :null => false + t.string "server_url" + t.string "salt", :null => false + end + + create_table "open_source_projects", :force => true do |t| + t.string "name" + t.text "description" + t.integer "commit_count", :default => 0 + t.integer "code_line", :default => 0 + t.integer "users_count", :default => 0 + t.date "last_commit_time" + t.string "url" + t.date "date_collected" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "option_numbers", :force => true do |t| + t.integer "user_id" + t.integer "memo" + t.integer "messages_for_issues" + t.integer "issues_status" + t.integer "replay_for_message" + t.integer "replay_for_memo" + t.integer "follow" + t.integer "tread" + t.integer "praise_by_one" + t.integer "praise_by_two" + t.integer "praise_by_three" + t.integer "tread_by_one" + t.integer "tread_by_two" + t.integer "tread_by_three" + t.integer "changeset" + t.integer "document" + t.integer "attachment" + t.integer "issue_done_ratio" + t.integer "post_issue" + t.integer "score_type" + t.integer "total_score" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "project_id" + end + + create_table "org_activities", :force => true do |t| + t.integer "user_id" + t.integer "org_act_id" + t.string "org_act_type" + t.integer "container_id" + t.string "container_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "org_courses", :force => true do |t| + t.integer "organization_id" + t.integer "course_id" + t.datetime "created_at" + end + + create_table "org_document_comments", :force => true do |t| + t.text "title" + t.text "content" + t.integer "organization_id" + t.integer "creator_id" + t.integer "parent_id" + t.integer "reply_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.boolean "locked", :default => false + t.integer "sticky", :default => 0 + t.integer "org_subfield_id" + end + + create_table "org_member_roles", :force => true do |t| + t.integer "org_member_id" + t.integer "role_id" + end + + create_table "org_members", :force => true do |t| + t.integer "user_id" + t.integer "organization_id" + t.string "role" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "org_projects", :force => true do |t| + t.integer "organization_id" + t.integer "project_id" + t.datetime "created_at" + end + + create_table "org_subfields", :force => true do |t| + t.integer "organization_id" + t.integer "priority" + t.string "name" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "field_type" + end + + create_table "organizations", :force => true do |t| + t.string "name" + t.text "description" + t.integer "creator_id" + t.integer "home_id" + t.string "domain" + t.boolean "is_public" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "phone_app_versions", :force => true do |t| + t.string "version" + t.text "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "poll_answers", :force => true do |t| + t.integer "poll_question_id" + t.text "answer_text" + t.integer "answer_position" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "poll_questions", :force => true do |t| + t.string "question_title" + t.integer "question_type" + t.integer "is_necessary" + t.integer "poll_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "question_number" + end + + create_table "poll_users", :force => true do |t| + t.integer "user_id" + t.integer "poll_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "poll_votes", :force => true do |t| + t.integer "user_id" + t.integer "poll_question_id" + t.integer "poll_answer_id" + t.text "vote_text" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "polls", :force => true do |t| + t.string "polls_name" + t.string "polls_type" + t.integer "polls_group_id" + t.integer "polls_status" + t.integer "user_id" + t.datetime "published_at" + t.datetime "closed_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.text "polls_description" + t.integer "show_result", :default => 1 + end + + create_table "praise_tread_caches", :force => true do |t| + t.integer "object_id", :null => false + t.string "object_type" + t.integer "praise_num" + t.integer "tread_num" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "praise_treads", :force => true do |t| + t.integer "user_id", :null => false + t.integer "praise_tread_object_id" + t.string "praise_tread_object_type" + t.integer "praise_or_tread" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "principal_activities", :force => true do |t| + t.integer "user_id" + t.integer "principal_id" + t.integer "principal_act_id" + t.string "principal_act_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "project_infos", :force => true do |t| + t.integer "project_id" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "project_scores", :force => true do |t| + t.string "project_id" + t.integer "score" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "issue_num", :default => 0 + t.integer "issue_journal_num", :default => 0 + t.integer "news_num", :default => 0 + t.integer "documents_num", :default => 0 + t.integer "changeset_num", :default => 0 + t.integer "board_message_num", :default => 0 + end + + create_table "project_statuses", :force => true do |t| + t.integer "changesets_count" + t.integer "watchers_count" + t.integer "project_id" + t.integer "project_type" + t.float "grade", :default => 0.0 + t.integer "course_ac_para", :default => 0 + end + + add_index "project_statuses", ["grade"], :name => "index_project_statuses_on_grade" + + create_table "projecting_softapplictions", :force => true do |t| + t.integer "user_id" + t.integer "softapplication_id" + t.integer "project_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "projects", :force => true do |t| + t.string "name", :default => "", :null => false + t.text "description" + t.string "homepage", :default => "" + t.boolean "is_public", :default => true, :null => false + t.integer "parent_id" + t.datetime "created_on" + t.datetime "updated_on" + t.string "identifier" + t.integer "status", :default => 1, :null => false + t.integer "lft" + t.integer "rgt" + t.boolean "inherit_members", :default => false, :null => false + t.integer "project_type" + t.boolean "hidden_repo", :default => false, :null => false + t.integer "attachmenttype", :default => 1 + t.integer "user_id" + t.integer "dts_test", :default => 0 + t.string "enterprise_name" + t.integer "organization_id" + t.integer "project_new_type" + t.integer "gpid" + t.integer "forked_from_project_id" + t.integer "forked_count" + t.integer "commits_count", :default => 0 + end + + add_index "projects", ["lft"], :name => "index_projects_on_lft" + add_index "projects", ["rgt"], :name => "index_projects_on_rgt" + + create_table "projects_trackers", :id => false, :force => true do |t| + t.integer "project_id", :default => 0, :null => false + t.integer "tracker_id", :default => 0, :null => false + end + + add_index "projects_trackers", ["project_id", "tracker_id"], :name => "projects_trackers_unique", :unique => true + add_index "projects_trackers", ["project_id"], :name => "projects_trackers_project_id" + + create_table "queries", :force => true do |t| + t.integer "project_id" + t.string "name", :default => "", :null => false + t.text "filters" + t.integer "user_id", :default => 0, :null => false + t.boolean "is_public", :default => false, :null => false + t.text "column_names" + t.text "sort_criteria" + t.string "group_by" + t.string "type" + end + + add_index "queries", ["project_id"], :name => "index_queries_on_project_id" + add_index "queries", ["user_id"], :name => "index_queries_on_user_id" + + create_table "relative_memo_to_open_source_projects", :force => true do |t| + t.integer "osp_id" + t.integer "relative_memo_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "relative_memos", :force => true do |t| + t.integer "osp_id" + t.integer "parent_id" + t.string "subject", :null => false + t.text "content", :limit => 16777215, :null => false + t.integer "author_id" + t.integer "replies_count", :default => 0 + t.integer "last_reply_id" + t.boolean "lock", :default => false + t.boolean "sticky", :default => false + t.boolean "is_quote", :default => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "viewed_count_crawl", :default => 0 + t.integer "viewed_count_local", :default => 0 + t.string "url" + t.string "username" + t.string "userhomeurl" + t.date "date_collected" + t.string "topic_resource" + end + + create_table "repositories", :force => true do |t| + t.integer "project_id", :default => 0, :null => false + t.string "url", :default => "", :null => false + t.string "login", :limit => 60, :default => "" + t.string "password", :default => "" + t.string "root_url", :default => "" + t.string "type" + t.string "path_encoding", :limit => 64 + t.string "log_encoding", :limit => 64 + t.text "extra_info" + t.string "identifier" + t.boolean "is_default", :default => false + t.boolean "hidden", :default => false + end + + add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id" + + create_table "rich_rich_files", :force => true do |t| + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "rich_file_file_name" + t.string "rich_file_content_type" + t.integer "rich_file_file_size" + t.datetime "rich_file_updated_at" + t.string "owner_type" + t.integer "owner_id" + t.text "uri_cache" + t.string "simplified_type", :default => "file" + end + + create_table "roles", :force => true do |t| + t.string "name", :limit => 30, :default => "", :null => false + t.integer "position", :default => 1 + t.boolean "assignable", :default => true + t.integer "builtin", :default => 0, :null => false + t.text "permissions" + t.string "issues_visibility", :limit => 30, :default => "default", :null => false + end + + create_table "schools", :force => true do |t| + t.string "name" + t.string "province" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "logo_link" + t.string "pinyin" + end + + create_table "seems_rateable_cached_ratings", :force => true do |t| + t.integer "cacheable_id", :limit => 8 + t.string "cacheable_type" + t.float "avg", :null => false + t.integer "cnt", :null => false + t.string "dimension" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "seems_rateable_rates", :force => true do |t| + t.integer "rater_id", :limit => 8 + t.integer "rateable_id" + t.string "rateable_type" + t.float "stars", :null => false + t.string "dimension" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "is_teacher_score", :default => 0 + end + + create_table "settings", :force => true do |t| + t.string "name", :default => "", :null => false + t.text "value" + t.datetime "updated_on" + end + + add_index "settings", ["name"], :name => "index_settings_on_name" + + create_table "shares", :force => true do |t| + t.date "created_on" + t.string "url" + t.string "title" + t.integer "share_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "project_id" + t.integer "user_id" + t.string "description" + end + + create_table "softapplications", :force => true do |t| + t.string "name" + t.text "description" + t.integer "app_type_id" + t.string "app_type_name" + t.string "android_min_version_available" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "contest_id" + t.integer "softapplication_id" + t.integer "is_public" + t.string "application_developers" + t.string "deposit_project_url" + t.string "deposit_project" + t.integer "project_id" + end + + create_table "student_work_projects", :force => true do |t| + t.integer "homework_common_id" + t.integer "student_work_id" + t.integer "project_id" + t.integer "user_id" + t.integer "is_leader" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "student_work_projects", ["homework_common_id"], :name => "index_student_work_projects_on_homework_common_id" + add_index "student_work_projects", ["project_id"], :name => "index_student_work_projects_on_project_id" + add_index "student_work_projects", ["student_work_id"], :name => "index_student_work_projects_on_student_work_id" + add_index "student_work_projects", ["user_id"], :name => "index_student_work_projects_on_user_id" + + create_table "student_work_tests", :force => true do |t| + t.integer "student_work_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "status", :default => 9 + t.text "results" + t.text "src" + end + + create_table "student_works", :force => true do |t| + t.string "name" + t.text "description", :limit => 2147483647 + t.integer "homework_common_id" + t.integer "user_id" + t.float "final_score" + t.float "teacher_score" + t.float "student_score" + t.float "teaching_asistant_score" + t.integer "project_id", :default => 0 + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "late_penalty", :default => 0 + t.integer "absence_penalty", :default => 0 + t.float "system_score", :default => 0.0 + t.boolean "is_test", :default => false + end + + add_index "student_works", ["homework_common_id", "user_id"], :name => "index_student_works_on_homework_common_id_and_user_id" + + create_table "student_works_evaluation_distributions", :force => true do |t| + t.integer "student_work_id" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "student_works_scores", :force => true do |t| + t.integer "student_work_id" + t.integer "user_id" + t.integer "score" + t.text "comment" + t.integer "reviewer_role" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "students_for_courses", :force => true do |t| + t.integer "student_id" + t.integer "course_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "students_for_courses", ["course_id"], :name => "index_students_for_courses_on_course_id" + add_index "students_for_courses", ["student_id"], :name => "index_students_for_courses_on_student_id" + + create_table "system_messages", :force => true do |t| + t.integer "user_id" + t.string "content" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.text "description" + t.string "subject" + end + + create_table "taggings", :force => true do |t| + t.integer "tag_id" + t.integer "taggable_id" + t.string "taggable_type" + t.integer "tagger_id" + t.string "tagger_type" + t.string "context", :limit => 128 + t.datetime "created_at" + end + + add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id" + add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context" + add_index "taggings", ["taggable_type"], :name => "index_taggings_on_taggable_type" + + create_table "tags", :force => true do |t| + t.string "name" + end + + create_table "teachers", :force => true do |t| + t.string "tea_name" + t.string "location" + t.integer "couurse_time" + t.integer "course_code" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "extra" + end + + create_table "time_entries", :force => true do |t| + t.integer "project_id", :null => false + t.integer "user_id", :null => false + t.integer "issue_id" + t.float "hours", :null => false + t.string "comments" + t.integer "activity_id", :null => false + t.date "spent_on", :null => false + t.integer "tyear", :null => false + t.integer "tmonth", :null => false + t.integer "tweek", :null => false + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false + end + + add_index "time_entries", ["activity_id"], :name => "index_time_entries_on_activity_id" + add_index "time_entries", ["created_on"], :name => "index_time_entries_on_created_on" + add_index "time_entries", ["issue_id"], :name => "time_entries_issue_id" + add_index "time_entries", ["project_id"], :name => "time_entries_project_id" + add_index "time_entries", ["user_id"], :name => "index_time_entries_on_user_id" + + create_table "tokens", :force => true do |t| + t.integer "user_id", :default => 0, :null => false + t.string "action", :limit => 30, :default => "", :null => false + t.string "value", :limit => 40, :default => "", :null => false + t.datetime "created_on", :null => false + end + + add_index "tokens", ["user_id"], :name => "index_tokens_on_user_id" + add_index "tokens", ["value"], :name => "tokens_value", :unique => true + + create_table "trackers", :force => true do |t| + t.string "name", :limit => 30, :default => "", :null => false + t.boolean "is_in_chlog", :default => false, :null => false + t.integer "position", :default => 1 + t.boolean "is_in_roadmap", :default => true, :null => false + t.integer "fields_bits", :default => 0 + end + + create_table "user_activities", :force => true do |t| + t.string "act_type" + t.integer "act_id" + t.string "container_type" + t.integer "container_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "user_id" + end + + create_table "user_extensions", :force => true do |t| + t.integer "user_id", :null => false + t.date "birthday" + t.string "brief_introduction" + t.integer "gender" + t.string "location" + t.string "occupation" + t.integer "work_experience" + t.integer "zip_code" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "technical_title" + t.integer "identity" + t.string "student_id" + t.string "teacher_realname" + t.string "student_realname" + t.string "location_city" + t.integer "school_id" + t.string "description", :default => "" + end + + create_table "user_feedback_messages", :force => true do |t| + t.integer "user_id" + t.integer "journals_for_message_id" + t.string "journals_for_message_type" + t.integer "viewed" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "user_grades", :force => true do |t| + t.integer "user_id", :null => false + t.integer "project_id", :null => false + t.float "grade", :default => 0.0 + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "user_grades", ["grade"], :name => "index_user_grades_on_grade" + add_index "user_grades", ["project_id"], :name => "index_user_grades_on_project_id" + add_index "user_grades", ["user_id"], :name => "index_user_grades_on_user_id" + + create_table "user_levels", :force => true do |t| + t.integer "user_id" + t.integer "level" + end + + create_table "user_preferences", :force => true do |t| + t.integer "user_id", :default => 0, :null => false + t.text "others" + t.boolean "hide_mail", :default => false + t.string "time_zone" + end + + add_index "user_preferences", ["user_id"], :name => "index_user_preferences_on_user_id" + + create_table "user_score_details", :force => true do |t| + t.integer "current_user_id" + t.integer "target_user_id" + t.string "score_type" + t.string "score_action" + t.integer "user_id" + t.integer "old_score" + t.integer "new_score" + t.integer "current_user_level" + t.integer "target_user_level" + t.integer "score_changeable_obj_id" + t.string "score_changeable_obj_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "user_scores", :force => true do |t| + t.integer "user_id", :null => false + t.integer "collaboration" + t.integer "influence" + t.integer "skill" + t.integer "active" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "user_statuses", :force => true do |t| + t.integer "changesets_count" + t.integer "watchers_count" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.float "grade", :default => 0.0 + end + + add_index "user_statuses", ["changesets_count"], :name => "index_user_statuses_on_changesets_count" + add_index "user_statuses", ["grade"], :name => "index_user_statuses_on_grade" + add_index "user_statuses", ["watchers_count"], :name => "index_user_statuses_on_watchers_count" + + create_table "users", :force => true do |t| + t.string "login", :default => "", :null => false + t.string "hashed_password", :limit => 40, :default => "", :null => false + t.string "firstname", :limit => 30, :default => "", :null => false + t.string "lastname", :default => "", :null => false + t.string "mail", :limit => 60, :default => "", :null => false + t.boolean "admin", :default => false, :null => false + t.integer "status", :default => 1, :null => false + t.datetime "last_login_on" + t.string "language", :limit => 5, :default => "" + t.integer "auth_source_id" + t.datetime "created_on" + t.datetime "updated_on" + t.string "type" + t.string "identity_url" + t.string "mail_notification", :default => "", :null => false + t.string "salt", :limit => 64 + t.integer "gid" + end + + add_index "users", ["auth_source_id"], :name => "index_users_on_auth_source_id" + add_index "users", ["id", "type"], :name => "index_users_on_id_and_type" + add_index "users", ["type"], :name => "index_users_on_type" + + create_table "versions", :force => true do |t| + t.integer "project_id", :default => 0, :null => false + t.string "name", :default => "", :null => false + t.string "description", :default => "" + t.date "effective_date" + t.datetime "created_on" + t.datetime "updated_on" + t.string "wiki_page_title" + t.string "status", :default => "open" + t.string "sharing", :default => "none", :null => false + end + + add_index "versions", ["project_id"], :name => "versions_project_id" + add_index "versions", ["sharing"], :name => "index_versions_on_sharing" + + create_table "visitors", :force => true do |t| + t.integer "user_id" + t.integer "master_id" + t.datetime "updated_on" + t.datetime "created_on" + end + + add_index "visitors", ["master_id"], :name => "index_visitors_master_id" + add_index "visitors", ["updated_on"], :name => "index_visitors_updated_on" + add_index "visitors", ["user_id"], :name => "index_visitors_user_id" + + create_table "watchers", :force => true do |t| + t.string "watchable_type", :default => "", :null => false + t.integer "watchable_id", :default => 0, :null => false + t.integer "user_id" + end + + add_index "watchers", ["user_id", "watchable_type"], :name => "watchers_user_id_type" + add_index "watchers", ["user_id"], :name => "index_watchers_on_user_id" + add_index "watchers", ["watchable_id", "watchable_type"], :name => "index_watchers_on_watchable_id_and_watchable_type" + + create_table "web_footer_companies", :force => true do |t| + t.string "name" + t.string "logo_size" + t.string "url" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "web_footer_oranizers", :force => true do |t| + t.string "name" + t.text "description" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "wiki_content_versions", :force => true do |t| + t.integer "wiki_content_id", :null => false + t.integer "page_id", :null => false + t.integer "author_id" + t.binary "data", :limit => 2147483647 + t.string "compression", :limit => 6, :default => "" + t.string "comments", :default => "" + t.datetime "updated_on", :null => false + t.integer "version", :null => false + end + + add_index "wiki_content_versions", ["updated_on"], :name => "index_wiki_content_versions_on_updated_on" + add_index "wiki_content_versions", ["wiki_content_id"], :name => "wiki_content_versions_wcid" + + create_table "wiki_contents", :force => true do |t| + t.integer "page_id", :null => false + t.integer "author_id" + t.text "text", :limit => 2147483647 + t.string "comments", :default => "" + t.datetime "updated_on", :null => false + t.integer "version", :null => false + end + + add_index "wiki_contents", ["author_id"], :name => "index_wiki_contents_on_author_id" + add_index "wiki_contents", ["page_id"], :name => "wiki_contents_page_id" + + create_table "wiki_pages", :force => true do |t| + t.integer "wiki_id", :null => false + t.string "title", :null => false + t.datetime "created_on", :null => false + t.boolean "protected", :default => false, :null => false + t.integer "parent_id" + end + + add_index "wiki_pages", ["parent_id"], :name => "index_wiki_pages_on_parent_id" + add_index "wiki_pages", ["wiki_id", "title"], :name => "wiki_pages_wiki_id_title" + add_index "wiki_pages", ["wiki_id"], :name => "index_wiki_pages_on_wiki_id" + + create_table "wiki_redirects", :force => true do |t| + t.integer "wiki_id", :null => false + t.string "title" + t.string "redirects_to" + t.datetime "created_on", :null => false + end + + add_index "wiki_redirects", ["wiki_id", "title"], :name => "wiki_redirects_wiki_id_title" + add_index "wiki_redirects", ["wiki_id"], :name => "index_wiki_redirects_on_wiki_id" + + create_table "wikis", :force => true do |t| + t.integer "project_id", :null => false + t.string "start_page", :null => false + t.integer "status", :default => 1, :null => false + end + + add_index "wikis", ["project_id"], :name => "wikis_project_id" + + create_table "workflows", :force => true do |t| + t.integer "tracker_id", :default => 0, :null => false + t.integer "old_status_id", :default => 0, :null => false + t.integer "new_status_id", :default => 0, :null => false + t.integer "role_id", :default => 0, :null => false + t.boolean "assignee", :default => false, :null => false + t.boolean "author", :default => false, :null => false + t.string "type", :limit => 30 + t.string "field_name", :limit => 30 + t.string "rule", :limit => 30 + end + + add_index "workflows", ["new_status_id"], :name => "index_workflows_on_new_status_id" + add_index "workflows", ["old_status_id"], :name => "index_workflows_on_old_status_id" + add_index "workflows", ["role_id", "tracker_id", "old_status_id"], :name => "wkfs_role_tracker_old_status" + add_index "workflows", ["role_id"], :name => "index_workflows_on_role_id" + + create_table "works_categories", :force => true do |t| + t.string "category" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "zip_packs", :force => true do |t| + t.integer "user_id" + t.integer "homework_id" + t.string "file_digest" + t.string "file_path" + t.integer "pack_times", :default => 1 + t.integer "pack_size", :default => 0 + t.text "file_digests" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + +end diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 0986bde24..84e1d6542 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -154,9 +154,12 @@ a.postReplyCancel:hover {color:#ffffff;} .homepagePostSetting ul li:hover ul {display:block;} .homepagePostSettingIcon {background:url(../images/homepage_icon.png) -93px -5px no-repeat; width:20px; height:20px;} .homepagePostSettiongText {width:85px; line-height:2; font-size:12px; color:#616060; background-color:#ffffff; border:1px solid #eaeaea; border-radius:3px; position:absolute; left:-68px; top:20px; padding:5px 0px; display:none;} +.resourceSendO {width:65px; line-height:2; font-size:12px; color:#616060; background-color:#ffffff; border:1px solid #eaeaea; border-radius:3px; position:absolute; left:-48px; top:20px; padding:2px 0px; display:none;} .homepagePostSettingIcon:hover {background:url(../images/homepage_icon.png) -93px -44px no-repeat;cursor: pointer} a.postOptionLink {color:#616060; display:block; width:55px; padding:0px 15px;} a.postOptionLink:hover {color:#ffffff; background-color:#269ac9;} +a.postOptionLink2 {color:#616060; display:block; width:35px; padding:0px 15px;} +a.postOptionLink2:hover {color:#ffffff; background-color:#269ac9;} .homepagePostReplyPortrait {float:left; width:33px;} .imageFuzzy {filter:alpha(opacity=50); -moz-opacity:0.5; -khtml-opacity:0.5;opacity: 0.5;} .homepagePostReplyDes {float:left; width:632px; margin-left:15px;} @@ -1238,7 +1241,7 @@ div.disable_link {background-color: #c1c1c1 !important;} /*新课程资源库*/ .reCon{ margin:5px; width:710px;} .reTop{width:710px; height:40px; background:#eaeaea; padding:5px;} -.researchBox { width:240px; height:24px; border:1px solid #dddddd; color:#666666;} +.researchBox { width:240px; height:24px; border:1px solid #dddddd; color:#666666; outline:none;} .blueBtn{ width:60px; height:26px; color:#FFF; border:none; background-color:#269ac9; cursor:pointer; padding-left:0px; text-align:center;} .blueBtn:hover {background-color:#298fbd;} From 20a03b23864eaf6aac9421fa06dff6f498a07fa6 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Thu, 31 Dec 2015 11:12:00 +0800 Subject: [PATCH 37/57] =?UTF-8?q?=E7=82=B9=E5=87=BB=E5=B1=95=E5=BC=80?= =?UTF-8?q?=E6=9B=B4=E5=A4=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/files/_course_list.html.erb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/views/files/_course_list.html.erb b/app/views/files/_course_list.html.erb index e2d321b51..310313c59 100644 --- a/app/views/files/_course_list.html.erb +++ b/app/views/files/_course_list.html.erb @@ -39,9 +39,10 @@
      • <% if User.current.logged? %> -
      • <%= link_to("发       送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}')") %>
      • + <% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %> <% if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" %> +
      • <%= link_to("发       送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}')") %>
      • <%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %>
      • <% if @course.is_public? %>
      • @@ -56,7 +57,10 @@
      • <% end %> + <%else %> +
      • <%= link_to("发  送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}')") %>
      • <% end %> + <% end %>
    • @@ -75,14 +79,10 @@ <% if curse_attachments.count == 10%> <% if params[:action] == 'search' %> -
      展开更多<%=link_to "", search_course_files_path({:course_id => course.id,:page => @obj_pages.nil? ? @feedback_pages.page + 1 : @obj_pages.page + 1}.merge(params)),:id => "more_attachments_link",:remote => "true",:class => "none" %>
      + <%=link_to "点击展开更多", search_course_files_path({:course_id => course.id,:page => @obj_pages.nil? ? @feedback_pages.page + 1 : @obj_pages.page + 1}.merge(params)),:id => "show_more_attachments",:remote => "true",:class => "loadMore mt10 f_grey" %> <%else%> -
      展开更多<%=link_to "", course_files_path({:course_id => course.id,:page => @obj_pages.nil? ? @feedback_pages.page + 1 : @obj_pages.page + 1}.merge(params)),:id => "more_attachments_link",:remote => "true",:class => "none" %>
      + <%=link_to "点击展开更多", course_files_path({:course_id => course.id,:page => @obj_pages.nil? ? @feedback_pages.page + 1 : @obj_pages.page + 1}.merge(params)),:id => "show_more_attachments",:remote => "true",:class => "loadMore mt10 f_grey" %> <%end%> <% end%> - + From ec631691e35b17a79c7eba3c85130e8d811a15a5 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 31 Dec 2015 11:12:09 +0800 Subject: [PATCH 38/57] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E5=92=8C=E8=AF=BE=E7=A8=8B=E9=85=8D=E7=BD=AE=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BB=93=E6=9D=9F=E5=AD=A6=E6=9C=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/courses_service.rb | 2 + app/views/courses/new.html.erb | 120 ++++++++++-------- app/views/courses/settings.html.erb | 40 +++--- config/locales/courses/en.yml | 2 +- config/locales/courses/zh.yml | 2 +- .../20151231012634_add_last_term_to_course.rb | 17 +++ db/schema.rb | 9 +- public/javascripts/course.js | 42 +++++- 8 files changed, 159 insertions(+), 75 deletions(-) create mode 100644 db/migrate/20151231012634_add_last_term_to_course.rb diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 5d60238bf..aabe1a921 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -196,6 +196,8 @@ class CoursesService @course.tea_id = current_user.id @course.term = params[:term] @course.time = params[:time] + @course.end_term = params[:end_term] + @course.end_time = params[:end_time] #@course.school_id = params[:occupation] @course.school_id = current_user.user_extensions.school_id @course.setup_time = params[:setup_time] diff --git a/app/views/courses/new.html.erb b/app/views/courses/new.html.erb index f1b917816..9875ec9b7 100644 --- a/app/views/courses/new.html.erb +++ b/app/views/courses/new.html.erb @@ -4,64 +4,82 @@
        <%= labelled_form_for @course do |f| %> -
      • - - - - - -
      • -
        -
      • - - - -
      • -
        -
      • - - <%= select_tag :time,options_for_select(course_time_option(@course.time),@course.time), {} %> - <%= select_tag :term,options_for_select(course_term_option,@course.term || cur_course_term),{} %> -
      • -
        -
      • - - - - 显示明码 - +
      • + + + + + +
      • - 学生或其他成员申请加入课程时候需要使用该口令,该口令可以由老师在课堂上公布。 - -
      • - - +
      • + + + +
      • - -
      • - - - (打钩为公开,不打钩则不公开,若不公开,仅课程成员可见该课程。) +
      • + + <%= select_tag :time,options_for_select(course_time_option(@course.time),@course.time), {} %> + <%= select_tag :term,options_for_select(course_term_option,@course.term || cur_course_term),{} %> + +
      • - -
      • - - - (打钩为"学生列表公开",不打钩为不公开,若不公开,则课程外部人员看不到学生列表) +
      • + + <%= select_tag :end_time,options_for_select(course_time_option(@course.end_time),@course.end_time), {} %> + <%= select_tag :end_term,options_for_select(course_term_option,@course.end_term || cur_course_term),{} %> + 仅针对跨越多个学期的班级,否则不用修改。 +
      • - -
      • +
      • + + + + 显示明码 + +
        + 学生或其他成员申请加入课程时候需要使用该口令,该口令可以由老师在课堂上公布。 +
      • +
      • + + +
        +
      • +
      • + + + (选中后课外用户可见该课程,否则仅对课内成员可见) +
        +
      • +
      • + + + (选中后课外用户可见学生列表,否则仅对课内成员可见) +
        +
      • +
      • id="course_publish_resource" name="course[publish_resource]" type="checkbox" /> - (打钩为"允许学生上传资源",不打钩为"不允许学生上传资源") + (选中后允许学生上传课程资源,否则不允许)
        -
      • -
      • - 提交 - <%= link_to "取消",user_activities_path(User.current.id),:class => "blue_btn grey_btn fl c_white"%> -
        -
      • + +
      • + 提交 + <%= link_to "取消",user_activities_path(User.current.id),:class => "blue_btn grey_btn fl c_white"%> +
        +
      • <% end%>
      -
      \ No newline at end of file +
      + \ No newline at end of file diff --git a/app/views/courses/settings.html.erb b/app/views/courses/settings.html.erb index ae6416c9d..23d0a2a3f 100644 --- a/app/views/courses/settings.html.erb +++ b/app/views/courses/settings.html.erb @@ -2,11 +2,11 @@

      <%= l(:label_course_modify_settings)%>

    @@ -50,6 +50,12 @@ <%= select_tag :term,options_for_select(course_term_option,@course.term || cur_course_term),{:id=>"term_selected"} %>
    +
  • + + <%= select_tag :end_time,options_for_select(course_time_option(@course.end_time),@course.end_time), {:id=>"end_time_selected"} %> + <%= select_tag :end_term,options_for_select(course_term_option,@course.end_term || cur_course_term),{:id=>"end_term_selected"} %> +
  • +
  • @@ -123,15 +129,17 @@
  • diff --git a/config/locales/courses/en.yml b/config/locales/courses/en.yml index fd8ba2366..20d9d112c 100644 --- a/config/locales/courses/en.yml +++ b/config/locales/courses/en.yml @@ -15,7 +15,7 @@ en: label_homework: Task label_course_news: 课程通知 label_main_teacher: 主讲教师 - label_course_term: 开课学期 + label_course_term: 开始学期 label_join_course: 加入 label_exit_course: exit course diff --git a/config/locales/courses/zh.yml b/config/locales/courses/zh.yml index 16d49ea1f..19b979d97 100644 --- a/config/locales/courses/zh.yml +++ b/config/locales/courses/zh.yml @@ -19,7 +19,7 @@ zh: label_course_news: 课程通知 label_course_mail_news_reply: 课程通知回复 label_main_teacher: 主讲教师 - label_course_term: 开课学期 + label_course_term: 开始学期 label_isuue_mail_status: 更新了issue状态! label_join_course: 加入 diff --git a/db/migrate/20151231012634_add_last_term_to_course.rb b/db/migrate/20151231012634_add_last_term_to_course.rb new file mode 100644 index 000000000..1b342eaaf --- /dev/null +++ b/db/migrate/20151231012634_add_last_term_to_course.rb @@ -0,0 +1,17 @@ +class AddLastTermToCourse < ActiveRecord::Migration + def change + add_column :courses, :end_time, :integer + add_column :courses, :end_term, :string + + count = Course.all.count / 30 + 2 + transaction do + for i in 1 ... count do + Course.page(i).per(30).each do |course| + course.end_time = course.time + course.end_term = course.term + course.save + end + end + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 72ca3c649..ec783d251 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20151229022049) do +ActiveRecord::Schema.define(:version => 20151231012634) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -198,6 +198,7 @@ ActiveRecord::Schema.define(:version => 20151229022049) do t.integer "last_message_id" t.integer "parent_id" t.integer "course_id" + t.integer "org_subfield_id" end add_index "boards", ["last_message_id"], :name => "index_boards_on_last_message_id" @@ -474,6 +475,8 @@ ActiveRecord::Schema.define(:version => 20151229022049) do t.integer "outline", :default => 0 t.integer "publish_resource", :default => 0 t.integer "is_delete", :default => 0 + t.integer "end_time" + t.string "end_term" end create_table "custom_fields", :force => true do |t| @@ -1643,10 +1646,6 @@ ActiveRecord::Schema.define(:version => 20151229022049) do t.string "extra" end - create_table "temp", :id => false, :force => true do |t| - t.integer "id", :default => 0, :null => false - end - create_table "time_entries", :force => true do |t| t.integer "project_id", :null => false t.integer "user_id", :null => false diff --git a/public/javascripts/course.js b/public/javascripts/course.js index a0bce3099..df04d857b 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -119,6 +119,46 @@ function regex_course_class_period() return false; } } +//验证开始学期和结束学期 +function regex_time_term(){ + var obj_time = document.getElementById("time"); + var obj_end_time = document.getElementById("end_time"); + var obj_term = document.getElementById("term"); + var obj_end_term = document.getElementById("end_term"); + var time = obj_time.options[obj_time.selectedIndex]; + var end_time = obj_end_time.options[obj_end_time.selectedIndex]; + var term = obj_term.options[obj_term.selectedIndex]; + var end_term = obj_end_term.options[obj_end_term.selectedIndex]; + if(time.value == end_time.value) { + if(set_term_val(term.value) > set_term_val(end_term.value)) { + $("#course_time_term_notice").html("开始学期不能晚于结束学期"); + $("#course_time_term_notice").show(); + return false; + } else { + $("#course_time_term_notice").html(""); + $("#course_time_term_notice").hide(); + return true; + } + } else if(time.value < end_time.value) { + $("#course_time_term_notice").html(""); + $("#course_time_term_notice").hide(); + return true; + } else { + $("#course_time_term_notice").html("开始学期不能晚于结束学期"); + $("#course_time_term_notice").show(); + return false; + } +} +//学期转换为数字 +function set_term_val(val) { + if(val == "春季学期"){ + return 1; + } else if(val == "夏季学期"){ + return 2; + } else if(val == "秋季学期"){ + return 3; + } +} //验证密码 function regex_course_password() { @@ -145,7 +185,7 @@ function regex_course_password() //提交新建课程 function submit_new_course() { - if(regex_course_name()&®ex_course_class_period()&®ex_course_password()) + if(regex_course_name()&®ex_course_class_period()&®ex_time_term()&®ex_course_password()) { $("#new_course").submit(); } From b059ab2428544fddf1c68920fe5fa195d46c3418 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Thu, 31 Dec 2015 11:13:44 +0800 Subject: [PATCH 39/57] schema.rb --- db/schema.rb | 257 ++++----------------------------------------------- 1 file changed, 20 insertions(+), 237 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index c337bb570..80d6a2a51 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,8 +11,7 @@ # # It's strongly recommended to check this file into your version control system. - -ActiveRecord::Schema.define(:version => 20151230022443) do +ActiveRecord::Schema.define(:version => 20151102090519) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -67,41 +66,6 @@ ActiveRecord::Schema.define(:version => 20151230022443) do t.datetime "updated_at", :null => false end - create_table "at_messages", :force => true do |t| - t.integer "user_id" - t.integer "at_message_id" - t.string "at_message_type" - t.boolean "viewed", :default => false - t.string "container_type" - t.integer "container_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "sender_id" - end - - add_index "at_messages", ["user_id"], :name => "index_at_messages_on_user_id" - - create_table "attachment_histories", :force => true do |t| - t.integer "container_id" - t.string "container_type" - t.string "filename", :default => "" - t.string "disk_filename", :default => "" - t.integer "filesize", :default => 0 - t.string "content_type", :default => "" - t.string "digest", :limit => 40, :default => "" - t.integer "downloads", :default => 0 - t.integer "author_id" - t.datetime "created_on" - t.string "description" - t.string "disk_directory" - t.integer "attachtype" - t.integer "is_public" - t.integer "copy_from" - t.integer "quotes" - t.integer "version" - t.integer "attachment_id" - end - create_table "attachments", :force => true do |t| t.integer "container_id" t.string "container_type", :limit => 30 @@ -119,7 +83,6 @@ ActiveRecord::Schema.define(:version => 20151230022443) do t.integer "is_public", :default => 1 t.integer "copy_from" t.integer "quotes" - t.integer "version", :default => 0 end add_index "attachments", ["author_id"], :name => "index_attachments_on_author_id" @@ -419,20 +382,6 @@ ActiveRecord::Schema.define(:version => 20151230022443) do t.integer "container_id", :default => 0 end - create_table "course_contributor_scores", :force => true do |t| - t.integer "course_id" - t.integer "user_id" - t.integer "message_num" - t.integer "message_reply_num" - t.integer "news_reply_num" - t.integer "resource_num" - t.integer "journal_num" - t.integer "journal_reply_num" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "total_score" - end - create_table "course_groups", :force => true do |t| t.string "name" t.integer "course_id" @@ -476,8 +425,8 @@ ActiveRecord::Schema.define(:version => 20151230022443) do t.string "code" t.integer "time" t.string "extra" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.string "location" t.string "term" t.string "string" @@ -487,16 +436,14 @@ ActiveRecord::Schema.define(:version => 20151230022443) do t.string "class_period" t.integer "school_id" t.text "description" - t.integer "status", :default => 1 - t.integer "attachmenttype", :default => 2 + t.integer "status", :default => 1 + t.integer "attachmenttype", :default => 2 t.integer "lft" t.integer "rgt" - t.integer "is_public", :limit => 1, :default => 1 - t.integer "inherit_members", :limit => 1, :default => 1 - t.integer "open_student", :default => 0 - t.integer "outline", :default => 0 - t.integer "publish_resource", :default => 0 - t.integer "is_delete", :default => 0 + t.integer "is_public", :limit => 1, :default => 1 + t.integer "inherit_members", :limit => 1, :default => 1 + t.integer "open_student", :default => 0 + t.integer "outline", :default => 0 end create_table "custom_fields", :force => true do |t| @@ -600,12 +547,6 @@ ActiveRecord::Schema.define(:version => 20151230022443) do t.datetime "updated_at", :null => false end - create_table "editor_of_documents", :force => true do |t| - t.integer "editor_id" - t.integer "org_document_comment_id" - t.datetime "created_at" - end - create_table "enabled_modules", :force => true do |t| t.integer "project_id" t.string "name", :null => false @@ -628,66 +569,6 @@ ActiveRecord::Schema.define(:version => 20151230022443) do add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type" add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id" - create_table "exercise_answers", :force => true do |t| - t.integer "user_id" - t.integer "exercise_question_id" - t.integer "exercise_choice_id" - t.text "answer_text" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "exercise_choices", :force => true do |t| - t.integer "exercise_question_id" - t.text "choice_text" - t.integer "choice_position" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "exercise_questions", :force => true do |t| - t.text "question_title" - t.integer "question_type" - t.integer "question_number" - t.integer "exercise_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "question_score" - end - - create_table "exercise_standard_answers", :force => true do |t| - t.integer "exercise_question_id" - t.integer "exercise_choice_id" - t.text "answer_text" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "exercise_users", :force => true do |t| - t.integer "user_id" - t.integer "exercise_id" - t.integer "score" - t.datetime "start_at" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.datetime "end_at" - t.integer "status" - end - - create_table "exercises", :force => true do |t| - t.text "exercise_name" - t.text "exercise_description" - t.integer "course_id" - t.integer "exercise_status" - t.integer "user_id" - t.integer "time" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.datetime "publish_time" - t.datetime "end_time" - t.integer "show_result" - end - create_table "first_pages", :force => true do |t| t.string "web_title" t.string "title" @@ -777,19 +658,6 @@ ActiveRecord::Schema.define(:version => 20151230022443) do t.integer "anonymous_comment", :default => 0 end - add_index "homework_commons", ["course_id", "id"], :name => "index_homework_commons_on_course_id_and_id" - - create_table "homework_detail_groups", :force => true do |t| - t.integer "homework_common_id" - t.integer "min_num" - t.integer "max_num" - t.integer "base_on_project" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "homework_detail_groups", ["homework_common_id"], :name => "index_homework_detail_groups_on_homework_common_id" - create_table "homework_detail_manuals", :force => true do |t| t.float "ta_proportion" t.integer "comment_status" @@ -1075,7 +943,6 @@ ActiveRecord::Schema.define(:version => 20151230022443) do t.boolean "locked", :default => false t.integer "sticky", :default => 0 t.integer "reply_id" - t.integer "quotes" end add_index "messages", ["author_id"], :name => "index_messages_on_author_id" @@ -1093,7 +960,6 @@ ActiveRecord::Schema.define(:version => 20151230022443) do t.datetime "created_on" t.integer "comments_count", :default => 0, :null => false t.integer "course_id" - t.integer "sticky", :default => 0 end add_index "news", ["author_id"], :name => "index_news_on_author_id" @@ -1179,69 +1045,10 @@ ActiveRecord::Schema.define(:version => 20151230022443) do t.integer "project_id" end - create_table "org_activities", :force => true do |t| - t.integer "user_id" - t.integer "org_act_id" - t.string "org_act_type" - t.integer "container_id" - t.string "container_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "org_courses", :force => true do |t| - t.integer "organization_id" - t.integer "course_id" - t.datetime "created_at" - end - - create_table "org_document_comments", :force => true do |t| - t.text "title" - t.text "content" - t.integer "organization_id" - t.integer "creator_id" - t.integer "parent_id" - t.integer "reply_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.boolean "locked", :default => false - t.integer "sticky", :default => 0 - t.integer "org_subfield_id" - end - - create_table "org_member_roles", :force => true do |t| - t.integer "org_member_id" - t.integer "role_id" - end - create_table "org_members", :force => true do |t| - t.integer "user_id" - t.integer "organization_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "org_projects", :force => true do |t| - t.integer "organization_id" - t.integer "project_id" - t.datetime "created_at" - end - - create_table "org_subfield_messages", :force => true do |t| - t.integer "org_subfield_id" - t.integer "message_id" - t.string "message_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "org_subfields", :force => true do |t| - t.integer "organization_id" - t.integer "priority" - t.string "name" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "field_type" + t.integer "user_id" + t.integer "organization_id" + t.string "role" end create_table "organizations", :force => true do |t| @@ -1377,30 +1184,27 @@ ActiveRecord::Schema.define(:version => 20151230022443) do end create_table "projects", :force => true do |t| - t.string "name", :default => "", :null => false + t.string "name", :default => "", :null => false t.text "description" - t.string "homepage", :default => "" - t.boolean "is_public", :default => true, :null => false + t.string "homepage", :default => "" + t.boolean "is_public", :default => true, :null => false t.integer "parent_id" t.datetime "created_on" t.datetime "updated_on" t.string "identifier" - t.integer "status", :default => 1, :null => false + t.integer "status", :default => 1, :null => false t.integer "lft" t.integer "rgt" - t.boolean "inherit_members", :default => false, :null => false + t.boolean "inherit_members", :default => false, :null => false t.integer "project_type" - t.boolean "hidden_repo", :default => false, :null => false - t.integer "attachmenttype", :default => 1 + t.boolean "hidden_repo", :default => false, :null => false + t.integer "attachmenttype", :default => 1 t.integer "user_id" - t.integer "dts_test", :default => 0 + t.integer "dts_test", :default => 0 t.string "enterprise_name" t.integer "organization_id" t.integer "project_new_type" t.integer "gpid" - t.integer "forked_from_project_id" - t.integer "forked_count" - t.integer "commits_count", :default => 0 end add_index "projects", ["lft"], :name => "index_projects_on_lft" @@ -1565,21 +1369,6 @@ ActiveRecord::Schema.define(:version => 20151230022443) do t.integer "project_id" end - create_table "student_work_projects", :force => true do |t| - t.integer "homework_common_id" - t.integer "student_work_id" - t.integer "project_id" - t.integer "user_id" - t.integer "is_leader" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "student_work_projects", ["homework_common_id"], :name => "index_student_work_projects_on_homework_common_id" - add_index "student_work_projects", ["project_id"], :name => "index_student_work_projects_on_project_id" - add_index "student_work_projects", ["student_work_id"], :name => "index_student_work_projects_on_student_work_id" - add_index "student_work_projects", ["user_id"], :name => "index_student_work_projects_on_user_id" - create_table "student_work_tests", :force => true do |t| t.integer "student_work_id" t.datetime "created_at", :null => false @@ -1607,8 +1396,6 @@ ActiveRecord::Schema.define(:version => 20151230022443) do t.boolean "is_test", :default => false end - add_index "student_works", ["homework_common_id", "user_id"], :name => "index_student_works_on_homework_common_id_and_user_id" - create_table "student_works_evaluation_distributions", :force => true do |t| t.integer "student_work_id" t.integer "user_id" @@ -1673,10 +1460,6 @@ ActiveRecord::Schema.define(:version => 20151230022443) do t.string "extra" end - create_table "temp", :id => false, :force => true do |t| - t.integer "id", :default => 0, :null => false - end - create_table "time_entries", :force => true do |t| t.integer "project_id", :null => false t.integer "user_id", :null => false From b380b515c6dfadf747bdcd5b724b62e7b1112e96 Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 31 Dec 2015 11:18:06 +0800 Subject: [PATCH 40/57] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=82=AE=E4=BB=B6?= =?UTF-8?q?=E6=A0=87=E9=A2=98=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/mailer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 737a1ea69..2e796b2bb 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -273,7 +273,7 @@ class Mailer < ActionMailer::Base @subject = " #{user.show_name}#{l(:label_day_mail_first)}#{total_count}#{l(:label_day_mail_last)}" mylogger.debug "Sent activity mail : #{user.mail} - #{has_content}" #有内容才发,没有不发 - mail :to => user.mail,:subject => subject if has_content + mail :to => user.mail,:subject => @subject if has_content end # 作业截止时间邮件提醒 From 2c5a4f8a13573ba4a40d9df9f56c72323727df01 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 31 Dec 2015 11:36:21 +0800 Subject: [PATCH 41/57] =?UTF-8?q?=E5=8F=91=E5=B8=83=E5=92=8C=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E4=BD=9C=E4=B8=9A=E6=97=B6=E7=9A=84=E5=90=AF=E7=94=A8?= =?UTF-8?q?=E5=8C=BF=E8=AF=84=E6=94=B9=E4=B8=BA=E7=A6=81=E7=94=A8=E5=8C=BF?= =?UTF-8?q?=E8=AF=84=EF=BC=8C=E9=BB=98=E8=AE=A4=E4=B8=8D=E9=80=89=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_common_controller.rb | 2 +- app/controllers/users_controller.rb | 2 +- app/views/users/_user_homework_form.html.erb | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 46362c2d3..d345fba5f 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -63,7 +63,7 @@ class HomeworkCommonController < ApplicationController end @homework.end_time = params[:homework_common][:end_time] || Time.now @homework.course_id = params[:course_id] - @homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment] : 1 + @homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment] : 0 homework_detail_manual = @homework.homework_detail_manual || HomeworkDetailManual.new if @homework.publish_time <= Date.today && homework_detail_manual.comment_status == 0 diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 78d8e2b46..85d42e189 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -522,7 +522,7 @@ class UsersController < ApplicationController else homework.publish_time = params[:homework_common][:publish_time] end - homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment] : 1 + homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment] : 0 homework.homework_type = params[:homework_type].to_i || 1 homework.late_penalty = 10 homework.teacher_priority = 1 diff --git a/app/views/users/_user_homework_form.html.erb b/app/views/users/_user_homework_form.html.erb index 29be69a23..d145dab90 100644 --- a/app/views/users/_user_homework_form.html.erb +++ b/app/views/users/_user_homework_form.html.erb @@ -5,9 +5,9 @@ @@ -53,8 +53,8 @@
    <% if !edit_mode || edit_mode && homework.homework_detail_manual.comment_status < 2 %>
    - - 启用匿评 + + 禁用匿评
    <% end %> From 63b7330cd874ba2f4125473b2f1e99083665cc9a Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 31 Dec 2015 11:39:00 +0800 Subject: [PATCH 42/57] =?UTF-8?q?=E9=82=AE=E4=BB=B6=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E6=A0=87=E9=A2=98=E4=B8=AD=E7=BB=9F=E8=AE=A1=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/mailer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 2e796b2bb..318de2942 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -155,7 +155,6 @@ class Mailer < ActionMailer::Base # 发送内容: 项目【缺陷,讨论区,新闻】,课程【通知,留言,新闻】, 贴吧, 个人留言 def send_for_user_activities(user, date_to, days) date_from = date_to - days.days - subject = "[ #{user.show_name}#{l(:label_day_mail)}]" date_from = "#{date_from} 17:59:59" date_to = "#{date_to} 17:59:59" # 生成token用于直接点击登录 @@ -270,6 +269,7 @@ class Mailer < ActionMailer::Base total_count = @issues.count + @issues_journals.count + @course_messages.count + @project_messages.count + @course_news.count + @course_news_comments.count + @project_news.count + @project_news_comments.count + @project_attachments.count + @course_journal_messages.count + @user_journal_messages.count + @project_journal_messages.count + @forums.count + @memos.count + @attachments.count + @bids.count + @wiki_contents.count + subject = "[ #{user.show_name}#{l(:label_day_mail_first)}#{total_count}#{l(:label_day_mail_last)}]" @subject = " #{user.show_name}#{l(:label_day_mail_first)}#{total_count}#{l(:label_day_mail_last)}" mylogger.debug "Sent activity mail : #{user.mail} - #{has_content}" #有内容才发,没有不发 From 2c7ef034cb65ca52efc817c96c187a8ef6dbb340 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Thu, 31 Dec 2015 12:27:31 +0800 Subject: [PATCH 43/57] =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=BA=93=E6=9B=B4?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 2 +- app/views/files/_course_list.html.erb | 24 ++++++++++--------- .../users/_resource_share_for_orgs.html.erb | 2 +- ..._resource_share_for_project_popup.html.erb | 2 +- .../users/_resource_share_popup.html.erb | 2 +- 5 files changed, 17 insertions(+), 15 deletions(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 86d4d3b52..36093f33b 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -202,7 +202,7 @@ class AttachmentsController < ApplicationController Attachment.transaction do @old_attachment = Attachment.find params[:old_attachment_id] #取出当前上传的文件 - @attachment = Attachment.find(params[:attachments]['1'][:attachment_id]) + @attachment = Attachment.find(params[:attachments ].first[1][:attachment_id]) #将需要修改的记录保存到历史记录 @history = AttachmentHistory.new @history.attributes = @old_attachment.attributes.dup.except("id") diff --git a/app/views/files/_course_list.html.erb b/app/views/files/_course_list.html.erb index 310313c59..08e23fb19 100644 --- a/app/views/files/_course_list.html.erb +++ b/app/views/files/_course_list.html.erb @@ -37,11 +37,12 @@
    • -
        - <% if User.current.logged? %> + <% if User.current.logged? %> + + <% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %> + <% if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" %> +
          - <% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %> - <% if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" %>
        • <%= link_to("发       送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}')") %>
        • <%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %>
        • <% if @course.is_public? %> @@ -55,14 +56,15 @@ <%= link_to( '删除资源', attachment_path(file), :data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" && file.destroyable %> +
        - <% end %> - <%else %> -
      • <%= link_to("发  送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}')") %>
      • - <% end %> - - <% end %> -
      + <% end %> + <%else%> +
        +
      • <%= link_to("发  送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}')") %>
      • +
      + <% end %> + <% end %>
    diff --git a/app/views/users/_resource_share_for_orgs.html.erb b/app/views/users/_resource_share_for_orgs.html.erb index 08405a347..9da439c8e 100644 --- a/app/views/users/_resource_share_for_orgs.html.erb +++ b/app/views/users/_resource_share_for_orgs.html.erb @@ -1,4 +1,4 @@ -
    +
    发送到
    diff --git a/app/views/users/_resource_share_popup.html.erb b/app/views/users/_resource_share_popup.html.erb index b1f6270b0..a12a02683 100644 --- a/app/views/users/_resource_share_popup.html.erb +++ b/app/views/users/_resource_share_popup.html.erb @@ -2,7 +2,7 @@
    -
    将资源发送至
    +
    发送到
    -
  • 新增
  • -
  • <%= field.field_type == "Post" ? "帖子":"资源" %>
  • - <%= link_to "删除",org_subfield_path(field), :method => 'delete',:remote => true, :confirm => "您确定删除吗?", :class => "linkBlue fr mr5" %> - 编辑 -
    +
  • <%= name %>
  • +
  • 默认
  • +
  • 默认
  • + <%= field.hide==0?"设为隐藏":"设为显示" %> +
    - <% end %> +<% end %> - \ No newline at end of file + } + + function hide(content, id){ + if (content.text() == '设为隐藏') + $.ajax({ + url: "/organizations/hide_org_subfield?org_subfield_id=" + id, + type: "post" + }); + else + $.ajax({ + url: "/organizations/show_org_subfield?org_subfield_id=" + id, + type: "post" + }); + } + \ No newline at end of file diff --git a/app/views/organizations/hide_org_subfield.js.erb b/app/views/organizations/hide_org_subfield.js.erb new file mode 100644 index 000000000..09ed3c280 --- /dev/null +++ b/app/views/organizations/hide_org_subfield.js.erb @@ -0,0 +1,2 @@ +$("#hide_<%= @org_subfield.id %>").text("设为显示"); +$("#org_subfield_<%= @org_subfield.id %>").css("display", "none"); \ No newline at end of file diff --git a/app/views/organizations/setting.html.erb b/app/views/organizations/setting.html.erb index 4fc20653a..3058d03a8 100644 --- a/app/views/organizations/setting.html.erb +++ b/app/views/organizations/setting.html.erb @@ -107,7 +107,8 @@
    - <%= render :partial => 'organizations/subfield_list', :locals => {:subfields => @organization.org_subfields } %> + <%= render :partial => 'organizations/subfield_list', :locals => {:default_fields => @organization.org_subfields.where("field_type='default'"), + :subfields => @organization.org_subfields.where("field_type != 'default'") } %>
    diff --git a/app/views/organizations/show.html.erb b/app/views/organizations/show.html.erb index a79271add..78fb12279 100644 --- a/app/views/organizations/show.html.erb +++ b/app/views/organizations/show.html.erb @@ -16,7 +16,7 @@ .homepagePostReplyInputContainer .ke-inline-block {display: none;} .homepagePostReplyInputContainer .ke-container {float: left;} -<% if params[:show_homepage].nil? %> +<% if params[:show_homepage].nil? and User.current.logged? %>
    <%= @org_subfield.nil? ? "最新动态":"#{@org_subfield.name}" %>
    <% if params[:org_subfield_id].nil? %> diff --git a/app/views/organizations/show_org_subfield.js.erb b/app/views/organizations/show_org_subfield.js.erb new file mode 100644 index 000000000..165b07afd --- /dev/null +++ b/app/views/organizations/show_org_subfield.js.erb @@ -0,0 +1,2 @@ +$("#hide_<%= @org_subfield.id %>").text("设为隐藏"); +$("#org_subfield_<%= @org_subfield.id %>").css("display", "block"); \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 9326ac61e..2d195f0d2 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -51,6 +51,8 @@ RedmineApp::Application.routes.draw do collection do get 'check_uniq' get 'autocomplete_search' + post 'hide_org_subfield' + post 'show_org_subfield' end resources :org_document_comments do member do diff --git a/db/migrate/20151231023235_add_hide_to_org_subfields.rb b/db/migrate/20151231023235_add_hide_to_org_subfields.rb new file mode 100644 index 000000000..57dd5cb68 --- /dev/null +++ b/db/migrate/20151231023235_add_hide_to_org_subfields.rb @@ -0,0 +1,5 @@ +class AddHideToOrgSubfields < ActiveRecord::Migration + def change + add_column :org_subfields, :hide, :integer, :default => 0 + end +end diff --git a/db/migrate/20151231023610_add_records_to_org_subfields.rb b/db/migrate/20151231023610_add_records_to_org_subfields.rb new file mode 100644 index 000000000..61fb760da --- /dev/null +++ b/db/migrate/20151231023610_add_records_to_org_subfields.rb @@ -0,0 +1,9 @@ +class AddRecordsToOrgSubfields < ActiveRecord::Migration + def change + Organization.all.each do |org| + OrgSubfield.create(:organization_id => org.id, :name => 'activity', :field_type => 'default') + OrgSubfield.create(:organization_id => org.id, :name => 'course', :field_type => 'default') + OrgSubfield.create(:organization_id => org.id, :name => 'project', :field_type => 'default') + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 72ca3c649..6e3a62182 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20151229022049) do +ActiveRecord::Schema.define(:version => 20151231023610) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -198,6 +198,7 @@ ActiveRecord::Schema.define(:version => 20151229022049) do t.integer "last_message_id" t.integer "parent_id" t.integer "course_id" + t.integer "org_subfield_id" end add_index "boards", ["last_message_id"], :name => "index_boards_on_last_message_id" @@ -1209,9 +1210,10 @@ ActiveRecord::Schema.define(:version => 20151229022049) do t.integer "organization_id" t.integer "priority" t.string "name" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.string "field_type" + t.integer "hide", :default => 0 end create_table "organizations", :force => true do |t| From 22be66f85ca7f016a4bb31497d0348ada31fe7cf Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Thu, 31 Dec 2015 14:00:33 +0800 Subject: [PATCH 46/57] =?UTF-8?q?=E8=AF=BE=E7=A8=8B/=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=B8=96=E5=AD=90=E4=B8=AD=EF=BC=8C=E7=94=A8=E6=88=B7=E5=9C=A8?= =?UTF-8?q?=E7=99=BB=E9=99=86=E6=83=85=E5=86=B5=E4=B8=8B=E5=8D=B3=E5=8F=AF?= =?UTF-8?q?=E5=8F=91=E9=80=81=E5=B8=96=E5=AD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/messages/_course_show.html.erb | 38 ++++++++++++----------- app/views/messages/_project_show.html.erb | 22 +++++++------ 2 files changed, 32 insertions(+), 28 deletions(-) diff --git a/app/views/messages/_course_show.html.erb b/app/views/messages/_course_show.html.erb index 294f9b7d4..c3278a209 100644 --- a/app/views/messages/_course_show.html.erb +++ b/app/views/messages/_course_show.html.erb @@ -37,28 +37,30 @@ <%= link_to image_tag(url_to_avatar(@topic.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@topic.author) %>
    - <% if @topic.author.id == User.current.id%> + <% if User.current.logged? %>
    - <% if @topic.author.id == User.current.id%> + <% if User.current.logged? %>