This commit is contained in:
z9hang 2014-08-21 14:57:05 +08:00
commit 9ae553bace
33 changed files with 424 additions and 193 deletions

View File

@ -79,7 +79,7 @@ class AttachmentsController < ApplicationController
else
candown = @attachment.is_public == 1
end
if candown || User.current.admin?
if candown || User.current.admin? || User.current.id == @attachment.author_id
@attachment.increment_download
if stale?(:etag => @attachment.digest)

View File

@ -488,6 +488,11 @@ class BidsController < ApplicationController
if @bid.homework_type
@homework = HomeworkAttach.new
if @bid.proportion
teacher_proportion = @bid.proportion * 1.0 / 100
else
teacher_proportion = 1.0
end
#@homework_list = @bid.homeworks
#增加作业按评分排序,
#@homework_list = @bid.homeworks.eager_load(:rate_averages, :user, :attachments).order('seems_rateable_cached_ratings.avg DESC').order("#{HomeworkAttach.table_name}.created_at ASC")
@ -495,7 +500,7 @@ class BidsController < ApplicationController
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = #{@bid.author_id}) AS t_score,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id <> #{@bid.author_id}) AS s_score
FROM homework_attaches WHERE bid_id = #{@bid.id} ORDER BY
(CASE WHEN t_score IS NULL THEN 0 ELSE t_score * #{@bid.proportion * 1.0 / 100} END + CASE WHEN s_score IS NULL THEN 0 ELSE s_score * #{1 - @bid.proportion * 1.0 / 100} END) DESC,created_at ASC")
(CASE WHEN t_score IS NULL THEN 0 ELSE t_score * #{teacher_proportion} END + CASE WHEN s_score IS NULL THEN 0 ELSE s_score * #{1 - teacher_proportion} END) DESC,created_at ASC")
if params[:student_id].present?
@temp = []
@homework_list.each do |pro|

View File

@ -38,6 +38,17 @@ class FilesController < ApplicationController
@isproject = true
@containers = [ Project.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@project.id)]
@containers += @project.versions.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").all.sort
all_attachments = []
@containers.each do |container|
all_attachments += container.attachments
end
@limit = 10
@feedback_count = all_attachments.count
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
@offset ||= @feedback_pages.offset
@curse_attachments = all_attachments[@offset, @limit]
render :layout => !request.xhr?
elsif params[:course_id]
@isproject = false
@ -67,6 +78,18 @@ class FilesController < ApplicationController
else
@containers = [ Course.includes(:attachments).reorder("#{Attachment.table_name}.created_on desc").find(@course.id)]
end
all_attachments = []
@containers.each do |container|
all_attachments += container.attachments
end
@limit = 10
@feedback_count = all_attachments.count
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
@offset ||= @feedback_pages.offset
@curse_attachments = all_attachments[@offset, @limit]
render :layout => 'base_courses'
end
end

View File

@ -103,7 +103,11 @@ class MessagesController < ApplicationController
# Edit a message
def edit
(render_403; return false) unless @message.editable_by?(User.current)
if @project
(render_403; return false) unless @message.editable_by?(User.current)
else
(render_403; return false) unless @message.course_editable_by?(User.current)
end
@message.safe_attributes = params[:message]
if request.post? && @message.save
attachments = Attachment.attach_files(@message, params[:attachments])
@ -124,7 +128,11 @@ class MessagesController < ApplicationController
# Delete a messages
def destroy
(render_403; return false) unless @message.destroyable_by?(User.current)
if @project
(render_403; return false) unless @message.destroyable_by?(User.current)
else
(render_403; return false) unless @message.course_destroyable_by?(User.current)
end
r = @message.to_param
@message.destroy
# modify by nwb

View File

@ -403,21 +403,35 @@ class ProjectsController < ApplicationController
#Ended by young
def feedback
page = params[:page]
@page = params[:page]
@page = @page.to_i
# Find the page of the requested reply
@jours = @project.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
@limit = 10
if params[:r] && page.nil?
offset = @jours.count(:conditions => ["#{JournalsForMessage.table_name}.id > ?", params[:r].to_i])
page = 1 + offset / @limit
@limit = 3
offset = @jours.count(:conditions => ["#{JournalsForMessage.table_name}.id > ?", params[:r].to_i])
page = 1 + offset / @limit
if params[:r] && @page.nil?
@page = page
end
puts @page
if @page < 0
@page = 1
end
if @page > page
@page = page
end
@feedback_count = @jours.count
@feedback_pages = Paginator.new @feedback_count, @limit, page
@feedback_pages = Paginator.new @feedback_count, @limit, @page
@offset ||= @feedback_pages.offset
@jour = @jours[@offset, @limit]
@state = false
@base_courses_tag = @project.project_type
respond_to do |format|
format.html{render :layout => 'base_courses' if @base_courses_tag==1}
format.api

View File

@ -88,7 +88,44 @@ class WordsController < ApplicationController
#format.api { render_api_ok }
end
end
def destroyJournal
@journalP=JournalsForMessage.find(params[:object_id])
@journalP.destroy
@page = params[:page]
@page = @page.to_i
@project = Project.find params[:project_id]
# Find the page of the requested reply
@jours = @project.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
@limit = 3
offset = @jours.count(:conditions => ["#{JournalsForMessage.table_name}.id > ?", params[:r].to_i])
page = 1 + offset / @limit
if params[:r] && @page.nil?
@page = page
end
if @page < 0
@page = 1
end
if @page > page
@page = page
end
@feedback_count = @jours.count
@feedback_pages = Paginator.new @feedback_count, @limit, @page
@offset ||= @feedback_pages.offset
@jour = @jours[@offset, @limit]
@state = false
@base_courses_tag = @project.project_type
respond_to do |format|
format.js
end
end
def new
@jour = JournalsForMessage.find(params[:journal_id]) if params[:journal_id]
if @jour

View File

@ -29,9 +29,9 @@ class Attachment < ActiveRecord::Base
include UserScoreHelper
validates_presence_of :filename, :author
validates_length_of :filename, :maximum => 255
validates_length_of :disk_filename, :maximum => 255
validates_length_of :description, :maximum => 255
validates_length_of :filename, :maximum => 254
validates_length_of :disk_filename, :maximum => 254
validates_length_of :description, :maximum => 254
validate :validate_max_file_size

View File

@ -127,6 +127,14 @@ class Message < ActiveRecord::Base
board.course
end
def course_editable_by?(usr)
usr && usr.logged? && (usr.allowed_to?(:edit_messages, course) || (self.author == usr && usr.allowed_to?(:edit_own_messages, course)))
end
def course_destroyable_by?(usr)
usr && usr.logged? && (usr.allowed_to?(:delete_messages, course) || (self.author == usr && usr.allowed_to?(:delete_own_messages, course)))
end
def editable_by?(usr)
usr && usr.logged? && (usr.allowed_to?(:edit_messages, project) || (self.author == usr && usr.allowed_to?(:edit_own_messages, project)))
end

View File

@ -0,0 +1,32 @@
<% id = "course_resources_ul_" + obj.id.to_s%>
<ul class="messages-for-user-reply" id = '<%= id %>' >
<%= form_for "tag_for_save",:remote=>true,:header=>"Accept: application/javascript",:url=>tag_path,
:update => "tags_show",
:complete => "$(\"#put-tag-form-#{obj.class}-#{obj.id}\").hide();" do |f| %>
<%= f.text_field :name ,:id => "name",:size=>"28",:require=>true,:maxlength => Setting.tags_max_length,:minlength=>Setting.tags_min_length,:style=>"width: 100px;"%>
<%= f.text_field :object_id,:value=> obj.id,:style=>"display:none"%>
<%= f.text_field :object_flag,:value=> object_flag,:style=>"display:none"%>
<%= f.submit l(:button_project_tags_add),:class => "small" %>
<div class='hidden'>
<% preTags = @preTags.nil? ? [] : @preTags %>
<% preTags.each do |tag|%>
<%= link_to tag, "
javascript:(function(){
var $tagInputVal = $('#put-tag-form-"+obj.class.to_s+"-"+obj.id.to_s+"').find('#name');
var tagArr = [];
tagArr = tagArr.concat( $tagInputVal[0].value.split(',') );
tagArr = tagArr.concat('"+tag.to_s+"');
tagArr = cleanArray(tagArr);
$tagInputVal.val(tagArr.join(','));
})();
"
%>
<% end%>
</div>
<%#= link_to_function l(:button_cancel), "$(\"#put-tag-form-#{obj.class}-#{obj.id}\").hide();"%>
<% end %>
<%# journal.children.each do |reply|%>
<%#= render :partial => "journal_reply_items", :locals => {:reply => reply, :journal => journal, :m_reply_id => reply} %>
<%# end %>
</ul>

View File

@ -1,8 +1,8 @@
<% if @events_by_day != nil && @events_by_day.size >0 %>
<div class="content-title-top-avtive">
<!-- <h3><%= @author.nil? ? l(:label_activity) : l(:label_user_activity, link_to_user(@author)).html_safe %></h3> -->
<!-- <h3><%#= @author.nil? ? l(:label_activity) : l(:label_user_activity, link_to_user(@author)).html_safe %></h3> -->
<p class="subtitle">
<%= l(:label_date_from_to, :start => format_date(@date_from), :end => format_date(@date_to - 1)) %>
<%#= l(:label_date_from_to, :start => format_date(@date_from), :end => format_date(@date_to - 1)) %>
</p>
<% @events_by_day.keys.sort.reverse.each do |day| %>
@ -29,7 +29,7 @@
<%= l(:label_new_activity) %> </span>
<%= link_to "#{eventToLanguageCourse(e.event_type, @course)}: "<< format_activity_title(e.event_title), (e.event_type.eql?("attachment")&&e.container.kind_of?(Course)) ? course_files_path(e.container) : e.event_url %>
<%= link_to "#{eventToLanguageCourse(e.event_type, @course)}: "<< format_activity_title(e.event_title), (e.event_type.eql?("attachment")&&e.container.kind_of?(Course)) ? course_files_path(e.container) : e.event_url,:style => "word-break:break-all;" %>
</td>
</tr>
<tr>

View File

@ -25,60 +25,70 @@
</tr>
</thead>
<tbody>
<% @containers.each do |container| %>
<% next if container.attachments.empty? -%>
<% if container.is_a?(Version) -%>
<tr>
<%# @containers.each do |container| %>
<%# next if container.attachments.empty? -%>
<%# if container.is_a?(Version) -%>
<!--<tr>
<th colspan="5" align="left" style="line-height: 30px; font-size: 14px; ">
<%= link_to(h(container), {:controller => 'versions', :action => 'show', :id => container}, :class => "icon icon-package", :style => "color: #666666;") %>
<%#= link_to(h(container), {:controller => 'versions', :action => 'show', :id => container}, :class => "icon icon-package", :style => "color: #666666;") %>
</th>
</tr>
<% end -%>
<% container.attachments.each do |file| %>
<%if file.is_public == 0 && !User.current.member_of_course?(@course)%>
<%next%>
<%end%>
<tr class="file <%= cycle("odd", "odd") %>">
<td class="filename" style="font-size: 13px; "><%= link_to_attachment file, :download => true, :title => file.filename+"\n"+file.description.to_s, :style => "width: 230px; overflow: hidden; white-space: nowrap;text-overflow: ellipsis;" %></td>
<!-- <td class="created_on"><%#= format_time(file.created_on) %></td> -->
<td class="filesize"><%= number_to_human_size(file.filesize) %></td>
<td class="attach_type">
<span id="attach_type_id_label<%= file.id %>" style="white-space:nowrap;"><%= file.attachmentstype.typeName unless file.attachmentstype.nil? %></span>
</tr>-->
<%# end -%>
<% if @curse_attachments != nil %>
<% @curse_attachments.each do |file| %>
<%if file.is_public == 0 && !User.current.member_of_course?(@course)%>
<%next%>
<%end%>
<tr class="file <%= cycle("odd", "odd") %>">
<td class="filename" style="font-size: 13px; "><%= link_to_attachment file, :download => true, :title => file.filename+"\n"+file.description.to_s, :style => "width: 230px; overflow: hidden; white-space: nowrap;text-overflow: ellipsis;" %></td>
<!-- <td class="created_on"><%#= format_time(file.created_on) %></td> -->
<td class="filesize"><%= number_to_human_size(file.filesize) %></td>
<td class="attach_type">
<span id="attach_type_id_label<%= file.id %>" style="white-space:nowrap;"><%= file.attachmentstype.typeName unless file.attachmentstype.nil? %></span>
<span id="attach_type_id_edit<%= file.id %>" style="white-space:nowrap;">
<%= render :partial => 'attachments/course_type_edit', :locals => {:attachmenttypes => attachmenttypes, :attachment => file, :contentype => selContentType} %>
</span>
</td>
<td class="content_type"><%= file.show_suffix_type %></td>
<td class="field_file_dense">
<span id="field_file_dense_id_label<%= file.id %>" style="white-space:nowrap;"><%= file.file_dense_str %></span>
&nbsp;
</td>
<td class="content_type"><%= file.show_suffix_type %></td>
<td class="field_file_dense">
<span id="field_file_dense_id_label<%= file.id %>" style="white-space:nowrap;"><%= file.file_dense_str %></span>
&nbsp;
<span id="field_file_dense_id_edit<%= file.id %>" style="white-space:nowrap;">
<%= render :partial => 'course_file_dense_edit', :locals => {:file_dense_list => file.file_dense_list,
:attachment => file} %>
</span>
</td>
<td class="downloads"><%= file.downloads %></td>
<!-- <td class="digest" width="300px"><%= file.description %></td> -->
<td align="center">
<%= link_to(image_tag('delete.png'), attachment_path(file),
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %>
</td>
</tr>
<tr>
<td class='description' colspan="6">
<div class="tags_area">
<%# @preTags = %w|预设A 预设B 预设C 预设D 预设E 预设Z | %>
<%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"} %>
<div class="tags_gradint"></div>
</div>
<div class="read-more hidden"><a href="javascript:void(0);" onclick="readmore(this);"> 更多 </a></div>
</td>
</tr>
<% end -%>
<% reset_cycle %>
</td>
<td class="downloads"><%= file.downloads %></td>
<!-- <td class="digest" width="300px"><%= file.description %></td> -->
<td align="center">
<%= link_to(image_tag('delete.png'), attachment_path(file),
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %>
</td>
</tr>
<tr>
<td class='description' colspan="6">
<div class="tags_area">
<%# @preTags = %w|预设A 预设B 预设C 预设D 预设E 预设Z | %>
<%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"} %>
<div class="tags_gradint"></div>
</div>
<div class="read-more hidden"><a href="javascript:void(0);" onclick="readmore(this);"> 更多 </a></div>
</td>
</tr>
<% end -%>
<% end %>
<%# reset_cycle %>
<%# end -%>
<!-- %= h downloadAll(@containers) % -->
<!-- %= link_to "download all file", (downloadAll(@containers)) % -->
</tbody>
</table>
<!--分页-->
<div class="pagination" style="float:left;">
<ul>
<%= pagination_links_full @feedback_pages %>
</ul>
</div>

View File

@ -25,16 +25,17 @@
</tr>
</thead>
<tbody>
<% @containers.each do |container| %>
<% next if container.attachments.empty? -%>
<% if container.is_a?(Version) -%>
<tr>
<%# @containers.each do |container| %>
<%# next if container.attachments.empty? -%>
<%# if container.is_a?(Version) -%>
<!--tr>
<th colspan="5" align="left" style="line-height: 30px; font-size: 14px; ">
<%= link_to(h(container), {:controller => 'versions', :action => 'show', :id => container}, :class => "icon icon-package", :style => "color: #666666;") %>
<%#= link_to(h(container), {:controller => 'versions', :action => 'show', :id => container}, :class => "icon icon-package", :style => "color: #666666;") %>
</th>
</tr>
<% end -%>
<% container.attachments.each do |file| %>
</tr-->
<%# end -%>
<% if @curse_attachments != nil %>
<% @curse_attachments.each do |file| %>
<%if file.is_public == 0 && !User.current.member_of?(@project)%>
<%next%>
<%end%>
@ -75,10 +76,17 @@
</td>
</tr>
<% end -%>
<% reset_cycle %>
<%# reset_cycle %>
<% end -%>
<!-- %= h downloadAll(@containers) % -->
<!-- %= link_to "download all file", (downloadAll(@containers)) % -->
</tbody>
</table>
<!--分页-->
<div class="pagination" style="float:left;">
<ul>
<%= pagination_links_full @feedback_pages %>
</ul>
</div>

View File

@ -10,7 +10,7 @@
<span><%=l(:label_organizers)%></span>
<span class="footer_text_link"><%= link_to l(:label_organizers_information),"http://www.nudt.edu.cn/ArticleShow.asp?ID=47",:target=>"_blank"%></span>
<span class="footer_text_link"><%= link_to l(:label_organizers_information_institute), "http://www.nudt.edu.cn/ArticleShow.asp?ID=41", :target => "_blank" %></span>
<span id="copyright"><%=l(:label_copyright)%>@2007~2014</span>
<span id="copyright"><%=l(:label_copyright)%>©2007~2014</span>
<span id="contact_us" class="footer_text_link"><%= link_to l(:label_contact_us),"http://" + Setting.host_name + "/projects/2/member", :target=>"_blank" %></span>
<span id="record"class="footer_text_link"><%= link_to l(:label_record),"http://www.miibeian.gov.cn/", :target => "_blank" %></span>

View File

@ -44,6 +44,13 @@
<% if User.current.user_extensions && [UserExtensions::TEACHER, UserExtensions::STUDENT].include?(User.current.user_extensions.identity) -%>
<% hasCourse=true%>
<% _bool=false %>
<% User.current.courses.each do |course| %>
<% if !course_endTime_timeout?(course) %>
<% _bool=true %>
<% end %>
<% end %>
<% if _bool %>
<li id="course_loggedas_li" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;"><%=link_to l(:label_my_course), {:controller => 'users', :action => 'user_courses', id: User.current.id} %>
<ul class="course_sub_menu">
<% User.current.courses.each do |course| %>
@ -53,11 +60,14 @@
<% end %>
</ul>
</li>
<% end %>
<% end -%>
<% end %>
<li id="project_loggedas_li" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;"><%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.project_domain} %>
<% if User.current.projects.count>0 %>
<li id="project_loggedas_li" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
<%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.project_domain} %>
<% if hasCourse %>
<ul class="project_sub_menu" style="top: 35px">
<% else %>
@ -65,9 +75,10 @@
<% end %>
<% User.current.projects.each do |project| %>
<li><%= link_to project.name.truncate(10, omission: '...'), {:controller => 'projects', :action => 'show',id: project.id, host: Setting.project_domain } %></li>
<% end %>
<% end %>
</ul>
</li>
<% end %>
<li style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;"><%=link_to l(:label_user_edit), {:controller => 'my', :action=> 'account', host: Setting.user_domain}%>
</li>
</ul>

View File

@ -148,7 +148,7 @@
"编辑",
{:action => 'edit', :id => message},
:title => l(:button_edit)
) if message.editable_by?(User.current) %>
) if message.course_editable_by?(User.current) %>
<%= link_to(
#image_tag('delete.png'),
"删除",
@ -156,7 +156,7 @@
:method => :post,
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete)
) if message.destroyable_by?(User.current) %>
) if message.course_destroyable_by?(User.current) %>
</div></td>
</tr>
<tr>

View File

@ -30,13 +30,14 @@
border-bottom: 1px dashed rgb(204, 204, 204);
}
.memo-content {
width: 82%;
padding: 1%;
margin: 1%;
margin-bottom: 40px;
background-color: #F6F6F6;
white-space: normal;
/*word-break: break-all; */
word-wrap: break-word;
word-break: break-all;
/*word-wrap: break-word;*/
}
.memo-timestamp {
position: absolute;
@ -155,10 +156,10 @@
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete)
) if message.destroyable_by?(User.current) %>
</div></td>
</div>
</td>
</tr>
<tr>
<td class="comments">
<div class="wiki" style="width: 100%;word-break: break-all;">
<%= textAreailizable message,:content,:attachments => message.attachments %>

View File

@ -5,7 +5,7 @@
</div>
<div class="box tabular">
<p><%= f.text_field :title, :required => true, :size => 60, :style => "width:488px;" %></p>
<!-- <p style="margin-left:-10px;"><%= f.text_area :summary, :cols => 60, :rows => 2, :style => "width:490px;margin-left:10px;" %></p> -->
<!-- <p style="margin-left:-10px;"><%#= f.text_area :summary, :cols => 60, :rows => 2, :style => "width:490px;margin-left:10px;" %></p> -->
<p><%= f.text_area :description, :required => true, :cols => 60, :rows => 11, :class => 'wiki-edit', :style => "width:490px;" %></p>
<p id="attachments_form" style="margin-left:-10px;"><label style="padding-right: 15px;"><%= l(:label_attachment_plural) %></label><%= render :partial => 'attachments/form', :locals => {:container => @news} %></p>
</div>

View File

@ -1,11 +1,10 @@
<%= error_messages_for @news %>
<div class="add_frame_header" >
<% str = @project ? l(:bale_news_notice) : l(:label_news_new) %>
<%= str %>
<%= @project ? l(:label_news_new) : l(:bale_news_notice) %>
</div>
<div class="box tabular">
<p><%= f.text_field :title, :required => true, :size => 60, :style => "width:488px;" %></p>
<!-- <p style="margin-left:-10px;"><%= f.text_area :summary, :cols => 60, :rows => 2, :style => "width:490px;margin-left:10px;" %></p> -->
<!-- <p style="margin-left:-10px;"><%#= f.text_area :summary, :cols => 60, :rows => 2, :style => "width:490px;margin-left:10px;" %></p> -->
<p><%= f.text_area :description, :required => true, :cols => 60, :rows => 11, :class => 'wiki-edit', :style => "width:490px;" %></p>
<p id="attachments_form" style="margin-left:-10px;"><label style="padding-right: 15px;"><%= l(:label_attachment_plural) %></label><%= render :partial => 'attachments/form', :locals => {:container => @news} %></p>
</div>

View File

@ -1,9 +1,9 @@
<!--<p><%= link_to_project(news.project) + ': ' unless @project %>
<table><tr><td><img src="/images/new/news.png" width="40" height="40"/></td><td><%= link_to h(news.title), news_path(news) %>
<%= "(#{l(:label_x_comments, :count => news.comments_count)})" if news.comments_count > 0 %>
<!--<p><%#= link_to_project(news.project) + ': ' unless @project %>
<table><tr><td><img src="/images/new/news.png" width="40" height="40"/></td><td><%#= link_to h(news.title), news_path(news) %>
<%#= "(#{l(:label_x_comments, :count => news.comments_count)})" if news.comments_count > 0 %>
<% unless news.summary.blank? %></td><td><span class="fontligher"><%=h news.summary %></span><% end %></td>
<td><span class="author"><%= authoring news.created_on, news.author %></span></td></tr></table></p>-->
<%# unless news.summary.blank? %></td><td><span class="fontligher"><%#=h news.summary %></span><%# end %></td>
<td><span class="author"><%#= authoring news.created_on, news.author %></span></td></tr></table></p>-->
<table width="660px" border="0" align="center">
<tr>

View File

@ -1,4 +1,4 @@
<!-- <h3><%=l(:label_news_new)%></h3> -->
<!-- <h3><%#=l(:label_news_new)%></h3> -->
<% if @project %>
<%= labelled_form_for @news, :url => project_news_index_path(@project),
:html => {:id => 'news-form', :multipart => true} do |f| %>

View File

@ -36,7 +36,8 @@ function checkMaxLength() {
</script>
<!-- fq -->
<% reply_allow = JournalsForMessage.create_by_user? User.current %>
<h3><%= l(:label_user_response) %></h3>
@ -59,6 +60,8 @@ function checkMaxLength() {
</div>
<% end %>
<div style="clear: both;"></div>
<div id="project_feedback">
<% reply_allow = JournalsForMessage.create_by_user? User.current %>
<% if @jour.size >0 %>
<ul class="message-for-user">
<% for journal in @jour%>
@ -72,13 +75,20 @@ function checkMaxLength() {
<span>
<% if reply_allow %>
<%= link_to l(:label_projects_feedback_respond),'#',
{:focus => 'project_respond',
:onclick => "toggleAndSettingWordsVal($('##{id}'),
$('##{id} textarea'),
'#{l(:label_reply_plural)} #{journal.user.name}: ');
{:focus => 'project_respond',
:onclick => "toggleAndSettingWordsVal($('##{id}'),
$('##{id} textarea'),
'#{l(:label_reply_plural)} #{journal.user.name}: ');
return false;"} %>
<% end %>
</span>
<% if User.current.logged? %>
<% if journal.user_id==User.current.id|| User.current.admin? %>
<%= link_to(l(:button_delete),{:controller => 'words', :action => 'destroyJournal', :object_id => journal.id, :project_id=>@project.id, :page=>@page},
:remote => true, :title => l(:button_delete)) %>
<% end %>
<% end %>
</span>
</span>
<div style="clear: both;"></div>
<% if reply_allow %>
@ -99,4 +109,5 @@ function checkMaxLength() {
<ul>
<%= pagination_links_full @feedback_pages %>
</ul>
</div>
</div>

View File

@ -9,9 +9,30 @@
<div style="float: left; width: 600px; padding-top: 6px; margin-left: 8px"><%= softapplication.description.truncate(95, omission: '...') %></div>
<div style="float: left; width: 200px; margin-left: 70px; margin-top: -3px; line-height: 0.5em ">
<%contest = softapplication.contests.first%>
<!--<table width="100%" border="0">-->
<!--<tr>-->
<!--<td style="width: 70px; word-wrap: break-word; word-break: break-all"><%=l(:label_attendingcontestwork_belongs_contest)%></td>-->
<!--<td style="width: 100px; word-wrap: break-word; word-break: break-all">-->
<!--<%= contest ? link_to(contest.name.truncate(14, omission: '...'), show_attendingcontest_contest_path(contest), title: contest.name.to_s ) : '尚未加入竞赛'%>-->
<!--</td>-->
<!--</tr>-->
<!--<tr>-->
<!--<td style="width: 70px; word-wrap: break-word; word-break: break-all"><%=l(:label_attendingcontestwork_belongs_type)%></td>-->
<!--<td style="width: 100px; word-wrap: break-word; word-break: break-all">-->
<!--<%= softapplication.app_type_name %>-->
<!--</td>-->
<!--</tr>-->
<!--<tr>-->
<!--<td style="width: 70px; word-wrap: break-word; word-break: break-all"><%=l(:label_attendingcontestwork_adaptive_system)%></td>-->
<!--<td style="width: 100px; word-wrap: break-word; word-break: break-all">-->
<!--<%= softapplication.android_min_version_available %>-->
<!--</td>-->
<!--</tr>-->
<!--</table>-->
<p><%=l(:label_attendingcontestwork_belongs_contest)%><%= contest ? link_to(contest.name.truncate(14, omission: '...'), show_attendingcontest_contest_path(contest), title: contest.name.to_s ) : '尚未加入竞赛'%></p>
<p><%=l(:label_attendingcontestwork_belongs_type)%><%= softapplication.app_type_name.truncate(10, omission: '...') %></p>
<p><%=l(:label_attendingcontestwork_adaptive_system)%><%= softapplication.android_min_version_available %></p>
<p><%=l(:label_attendingcontestwork_belongs_type)%><%= softapplication.app_type_name.truncate(14, omission: '...') %></p>
<%strTitle = softapplication.android_min_version_available%>
<p><%=l(:label_attendingcontestwork_adaptive_system)%><lable title="<%= strTitle %>"><%= strTitle.truncate(10,omisiion:'...') %></lable></p>
</div>
<div style="padding-left: 53px">
<span><%=l(:label_attendingcontestwork_developers)%><%= softapplication.application_developers %></span>

View File

@ -3,51 +3,54 @@
<div style="height: auto; padding-bottom: 10px">
<tr>
<td colspan="2" valign="top" width="320">
</td>
<td>
<table width="100%" border="0">
<tr style="font-size: 18px">
<td colspan="2" valign="top"><strong><%= @softapplication.name %></strong></td>
<td style="font-size: 15px; padding-left: 0px">
<%= link_to '删除', softapplication_path(@softapplication), method: :delete, data: {confirm: '您确定要删除吗?'} if @softapplication.destroyable_by? User.current %>&nbsp;
<%= link_to '编辑', edit_softapplication_path(@softapplication), method: :get if @softapplication.destroyable_by? User.current %>
</td>
</tr>
<tr>
<td style="width: 570px; padding-left:40px; word-wrap: break-word; word-break: break-all"><%=l(:label_attendingcontestwork_belongs_type)%><%= @softapplication.app_type_name %></td>
<% contest = @softapplication.contests.first %>
<td style="width: 240px; word-wrap: break-word; word-break: break-all"><%=l(:label_attendingcontestwork_belongs_contest)%><%= contest ? link_to(contest.name, show_attendingcontest_contest_path(contest)) : '尚未加入竞赛' %></td>
</tr>
<tr>
<td style="padding-left: 40px"><%=l(:label_attendingcontestwork_release_person)%><%= @softapplication.user.name %></td>
<td><%=l(:label_attendingcontestwork_adaptive_system)%><%= @softapplication.android_min_version_available %></td>
</tr>
<tr>
<td style="padding-left: 40px">
<span><%=l(:label_attendingcontestwork_download)%></span>
<span>
<% options = {:author => true, :deletable => @softapplication.user.eql?(User.current)} %><%= render :partial => 'attachments/app_link', :locals => {:attachments => @app_items, :options => options} %>
</span>
</td>
<table width="100%" border="0">
<tr style="font-size: 18px">
<td valign="top"><strong><%= @softapplication.name %></strong></td>
<td style="font-size: 15px; padding-right: 0px" align="right">
<%= link_to '删除', softapplication_path(@softapplication), method: :delete, data: {confirm: '您确定要删除吗?'} if @softapplication.destroyable_by? User.current %>&nbsp;
<%= link_to '编辑', edit_softapplication_path(@softapplication), method: :get if @softapplication.destroyable_by? User.current %>
</td>
</tr>
</table>
</div>
<td><%=l(:label_attendingcontestwork_developers)%><%= @softapplication.application_developers %></td>
</tr>
<tr>
<td style="padding-left: 40px"><%=l(:label_attendingcontestwork_average_scores)%>: <%= rating_for @softapplication, :static => true, dimension: :quality, class: 'rateable div_inline' %></td>
<td><%=l(:label_attendingcontestwork_release_time)%><%=format_time @softapplication.created_at %></td>
</tr>
<tr>
<td style="padding-left: 40px">
<% if @project %>
<%=l(:label_attendingcontestwork_deposit_project)%><%= link_to "#@project", project_path(@project) %>
<% end %>
</td>
</tr>
</table>
</td>
</tr>
<div style="height: auto; padding-bottom: 10px">
<table width="100%" border="0">
<tr>
<td style="width: 70px; padding-left:40px; word-wrap: break-word; word-break: break-all"><%=l(:label_attendingcontestwork_belongs_type)%></td>
<td style="width: 400px; word-wrap: break-word; word-break: break-all"><%= @softapplication.app_type_name %></td>
<% contest = @softapplication.contests.first %>
<td style="width: 70px; word-wrap: break-word; word-break: break-all"><%=l(:label_attendingcontestwork_belongs_contest)%></td>
<td style="width: 400px; word-wrap: break-word; word-break: break-all"><%= contest ? link_to(contest.name, show_attendingcontest_contest_path(contest)) : '尚未加入竞赛' %></td>
</tr>
<tr>
<td style="width: 70px; padding-left:40px; word-wrap: break-word; word-break: break-all"><%=l(:label_attendingcontestwork_release_person)%></td>
<td style="width: 400px; word-wrap: break-word; word-break: break-all"><%= @softapplication.user.name %></td>
<td style="width: 70px; word-wrap: break-word; word-break: break-all"><%=l(:label_attendingcontestwork_adaptive_system)%></td>
<td style="width: 400px; word-wrap: break-word; word-break: break-all"><%= @softapplication.android_min_version_available %></td>
</tr>
<tr>
<td style="width: 70px; padding-left:40px; word-wrap: break-word; word-break: break-all"><%=l(:label_attendingcontestwork_download)%></td>
<td style="width: 400px; word-wrap: break-word; word-break: break-all">
<% options = {:author => true, :deletable => @softapplication.user.eql?(User.current)} %><%= render :partial => 'attachments/app_link', :locals => {:attachments => @app_items, :options => options} %>
</td>
<td style="width: 70px; word-wrap: break-word; word-break: break-all"><%=l(:label_attendingcontestwork_developers)%></td>
<td style="width: 400px; word-wrap: break-word; word-break: break-all"><%= @softapplication.application_developers %></td>
</tr>
<tr>
<td style="width: 70px; padding-left:40px; word-wrap: break-word; word-break: break-all"><%=l(:label_attendingcontestwork_average_scores)%></td>
<td style="width: 400px; word-wrap: break-word; word-break: break-all"><%= rating_for @softapplication, :static => true, dimension: :quality, class: 'rateable div_inline' %></td>
<td style="width: 70px; word-wrap: break-word; word-break: break-all"><%=l(:label_attendingcontestwork_release_time)%></td>
<td style="width: 400px; word-wrap: break-word; word-break: break-all"><%=format_time @softapplication.created_at %></td>
</tr>
<tr>
<td style="padding-left: 40px">
<% if @project %>
<%=l(:label_attendingcontestwork_deposit_project)%><%= link_to "#@project", project_path(@project) %>
<% end %>
</td>
</tr>
</table>
</div>
<div class="underline-contests_one"></div>
@ -56,7 +59,7 @@
<div style="font-size: 15px;"><%=l(:label_work_description)%></div>
</strong>
<div style="padding-top: 5px"><%= @softapplication.description %></div>
<div style="padding-top: 5px; padding-left:10px"><%= @softapplication.description %></div>
</div>
<div class="underline-contests_one"></div>

View File

@ -34,42 +34,18 @@
</div>
<% elsif object_flag == '6' %>
<span><%#= image_tag("/images/sidebar/tags.png") %></span>
<span><%#= image_tag("/images/sidebar/tags.png") %></span>
<span>
<%= link_to (image_tag "/images/sidebar/add.png"), 'javascript:void(0);', :class => "tags_icona", :onclick=>"$('#put-tag-form-#{obj.class}-#{obj.id}').toggle(); readmore(this);" if User.current.logged? %>
<%#= toggle_link (image_tag "/images/sidebar/add.png"), "put-tag-form-#{obj.class}-#{obj.id}", {:focus => "put-tag-form-#{obj.class}-#{obj.id} #name"} if User.current.logged? %>
<%#= toggle_link (image_tag "/images/sidebar/add.png"), "put-tag-form-#{obj.class}-#{obj.id}", {:focus => "put-tag-form-#{obj.class}-#{obj.id} #name"} if User.current.logged? %>
</span>
&nbsp;&nbsp;
<div id="tags_show-<%=obj.class%>-<%=obj.id%>" style="display:inline; ">
<%= render :partial => "tags/tag_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %>
</div>
<div id="put-tag-form-<%=obj.class%>-<%=obj.id%>" style="display: none">
<%= form_for "tag_for_save",:remote=>true,:header=>"Accept: application/javascript",:url=>tag_path,
:update => "tags_show",
:complete => "$(\"#put-tag-form-#{obj.class}-#{obj.id}\").hide();" do |f| %>
<%= f.text_field :name ,:id => "name",:size=>"28",:require=>true,:maxlength => Setting.tags_max_length,:minlength=>Setting.tags_min_length,:style=>"width: 100px;"%>
<%= f.text_field :object_id,:value=> obj.id,:style=>"display:none"%>
<%= f.text_field :object_flag,:value=> object_flag,:style=>"display:none"%>
<%= f.submit l(:button_project_tags_add),:class => "small" %>
<div class='hidden'>
<% preTags = @preTags.nil? ? [] : @preTags %>
<% preTags.each do |tag|%>
<%= link_to tag, "
javascript:(function(){
var $tagInputVal = $('#put-tag-form-"+obj.class.to_s+"-"+obj.id.to_s+"').find('#name');
var tagArr = [];
tagArr = tagArr.concat( $tagInputVal[0].value.split(',') );
tagArr = tagArr.concat('"+tag.to_s+"');
tagArr = cleanArray(tagArr);
$tagInputVal.val(tagArr.join(','));
})();
"
%>
<% end%>
</div>
<%#= link_to_function l(:button_cancel), "$(\"#put-tag-form-#{obj.class}-#{obj.id}\").hide();"%>
<% end %>
</div>
&nbsp;&nbsp;
<div id="tags_show-<%=obj.class%>-<%=obj.id%>" style="display:inline; ">
<%= render :partial => "tags/tag_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %>
</div>
<div id="put-tag-form-<%=obj.class%>-<%=obj.id%>" style="display: none;height: 100px;">
<%= render :partial => "courses/course_resources_html", :locals => {:obj => obj ,:object_flag => object_flag } %>
</div>
<% else %>
<span><%= image_tag("/images/sidebar/tags.png") %></span>

View File

@ -32,8 +32,9 @@
<tr>
<td colspan="2" width="580" style="word-break:break-all">
<p class="font_description">
<%= membership.course.short_description %>
</p></td>
<%= textilizable membership.course.short_description %>
</p>
</td>
</tr>
<tr>
<td>

View File

@ -6,11 +6,8 @@
<!-- 上左下右 -->
<div class='desc_item'>
<span class=''>
<% if (course.school == nil) %>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<% else %>
<%= link_to course.school.name.try(:gsub, /(.+)$/, '\1:'), options={:action => 'course', :school_id => course.school.id}, html_options={:method => 'get'} %>
<% end %>
<%= link_to(course.name.truncate(30, omission: '...')+":", course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %>
</span>
<span class='font_bolder'>
<%= link_to(course.try(:teacher).try(:realname), user_path(course.teacher)) %>
@ -19,7 +16,11 @@
</div>
<div class='desc_item text_nowrap'>
[<%= get_course_term course %>]
<%= link_to(course.name.truncate(30, omission: '...'), course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %>
<% if (course.school == nil) %>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<% else %>
<%= link_to course.school.name.try(:gsub, /(.+)$/, '\1'), options={:action => 'course', :school_id => course.school.id}, html_options={:method => 'get'} %>
<% end %>
(<%= course.members.count %>人)
<%# files_count = course.attachments.count.to_s %>
(<%= link_to "#{course.attachments.count.to_s}份", course_files_path(course) %>资料)

View File

@ -0,0 +1,50 @@
<% reply_allow = JournalsForMessage.create_by_user? User.current %>
<% if @jour.size >0 %>
<ul class="message-for-user">
<% for journal in @jour%>
<li id='word_li_<%=journal.id.to_s%>' class="outer-message-for-user">
<span class="portrait"><%= image_tag(url_to_avatar(journal.user), :class => "avatar") %></span>
<span class="body">
<span class="user"><%= link_to journal.user, user_path(journal.user)%></span>
<%= textilizable journal.notes%>
<span class="font_lighter"> <%= l :label_update_time %>: <%= format_time journal.created_on %></span>
<% id = 'project_respond_form_'+journal.id.to_s%>
<span>
<% if reply_allow %>
<%= link_to l(:label_projects_feedback_respond),'#',
{:focus => 'project_respond',
:onclick => "toggleAndSettingWordsVal($('##{id}'),
$('##{id} textarea'),
'#{l(:label_reply_plural)} #{journal.user.name}: ');
return false;"} %>
<% end %>
<% if User.current.logged? %>
<% if journal.user_id==User.current.id|| User.current.admin? %>
<%= link_to(l(:button_delete),{:controller => 'words', :action => 'destroyJournal', :object_id => journal.id, :project_id=>@project.id, :page=>@page},
:remote => true, :title => l(:button_delete)) %>
<% end %>
<% end %>
</span>
</span>
<div style="clear: both;"></div>
<% if reply_allow %>
<div id='<%= id %>' class="respond-form">
<%= render :partial => 'words/new_respond', :locals => {:journal => journal, :m_reply_id => journal} %>
</div>
<% end %>
<div style="clear: both;"></div>
<div>
<%= render :partial => "words/journal_reply", :locals => {:journal => journal } %>
</div>
</li>
<% end %>
</ul>
<% end %>
<div class="pagination" style="float:left;">
<ul>
<%= pagination_links_full(@feedback_pages,@feedback_count, :per_page_links => false){|text, parameters, options|
link_to text, project_feedback_path(@project,parameters.merge(:q => params[:q])) }%>
</ul>
</div>

View File

@ -0,0 +1,5 @@
<% if @journalP!=nil %>
//$(".message-for-user").children("#word_li_<%#=@journalP.id%>").remove();
$("#project_feedback").html("<%= escape_javascript(render :partial => 'words/feedback') %>");
<% end %>

View File

@ -652,6 +652,7 @@ RedmineApp::Application.routes.draw do
delete 'words/destroy', :to => 'words#destroy'
get 'words/more', :to => 'words#more'
get 'words/back', :to=> 'words#back'
get 'words/destroyJournal', :to => 'words#destroyJournal'
############## fq
post 'calls/create', :to => 'bids#create'
delete 'calls/destroy', :to => 'bids#destroy'
@ -746,6 +747,7 @@ RedmineApp::Application.routes.draw do
match 'words/add_brief_introdution', :controller => 'words', :action => 'add_brief_introdution'
Dir.glob File.expand_path("plugins/*", Rails.root) do |plugin_dir|
file = File.join(plugin_dir, "config/routes.rb")
if File.exists?(file)

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20140814062455) do
ActiveRecord::Schema.define(:version => 20140812065417) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -448,14 +448,14 @@ ActiveRecord::Schema.define(:version => 20140814062455) do
end
create_table "forums", :force => true do |t|
t.string "name", :null => false
t.text "description"
t.string "name", :null => false
t.string "description", :default => ""
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 "creator_id", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "groups_users", :id => false, :force => true do |t|

View File

@ -43,8 +43,13 @@ module Redmine
end
def attachments_visible?(user=User.current)
(respond_to?(:visible?) ? visible?(user) : true) &&
user.allowed_to?(self.class.attachable_options[:view_permission], self.project)
if self.respond_to?(:project)
(respond_to?(:visible?) ? visible?(user) : true) &&
user.allowed_to?(self.class.attachable_options[:view_permission], self.project)
else
return true
end
end
def attachments_deletable?(user=User.current)

View File

@ -46,8 +46,8 @@ review = issue.code_review
%>
<%= l(:label_revision) + " "%>
<%= link_to_revision(assignment.revision, repo) %>
<% elsif assignment.attachment %>
<%= link_to(assignment.attachment.filename, :controller => 'attachments', :action => 'show', :id => attachment.id) %>
<% elsif assignment.respond_to?("attachment") && assignment.attachment %>
<%= link_to(assignment.attachment.filename.to_s, :controller => 'attachments', :action => 'show', :id => assignment.attachment.id) %>
<% end %>
</td>
</tr>

View File

@ -107,7 +107,7 @@
<%
submit_url = url_for(:controller => 'code_review', :action => 'new', :id=>@project)
%>
<%= button_to_function l(:button_apply), "$('#review-form').load('#{submit_url}', $('#review_form').serialize2json())" %>
<%= button_to_function l(:label_button_ok), "$('#review-form').load('#{submit_url}', $('#review_form').serialize2json())" %>
<input type="button" value="<%=h l(:button_cancel) %> " onclick="javascript:hideForm();"/>
<%= preview_link({ :controller => 'code_review', :action => 'preview', :id => @project}, 'review_form') %>