diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb index ee95277ce..811b19ad6 100644 --- a/app/controllers/homework_attach_controller.rb +++ b/app/controllers/homework_attach_controller.rb @@ -473,8 +473,10 @@ class HomeworkAttachController < ApplicationController #保存评论 @is_comprehensive_evaluation = @is_teacher ? 1 : (@is_anonymous_comments ? 2 : 3) #判断当前评论是老师评论?匿评?留言 - if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != "" #有没有留言 - @homework.addjours User.current.id, params[:new_form][:user_message],0,@is_comprehensive_evaluation + if params[:new_form] && params[:new_form][:user_message] #有没有留言 + @homework.addjours(User.current.id, params[:new_form][:user_message],0,@is_comprehensive_evaluation) if @is_teacher + else + @homework.addjours User.current.id, "",0,@is_comprehensive_evaluation if @is_teacher end @teacher_stars = @stars_reates.where("is_teacher_score = 1") #老师评分列表 diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb index c1695e384..94a5a8194 100644 --- a/app/controllers/zipdown_controller.rb +++ b/app/controllers/zipdown_controller.rb @@ -180,6 +180,8 @@ class ZipdownController < ApplicationController def zipping(zip_name_refer, files_paths, output_path, is_attachment=false, not_exist_file=[]) + ic = Iconv.new('GBK//IGNORE', 'UTF-8//IGNORE') + rename_zipfile = zip_name_refer ||= "#{Time.now.to_i.to_s}.zip" zipfile_name = "#{output_path}/#{rename_zipfile}" Zip.unicode_names = true @@ -187,8 +189,9 @@ class ZipdownController < ApplicationController Dir.mkdir(File.dirname(zipfile_name)) unless File.exist?(File.dirname(zipfile_name)) Zip::File.open(zipfile_name, Zip::File::CREATE) do |zipfile| files_paths.each do |filename| - rename_file = File.basename(filename) - rename_file = filename_to_real( File.basename(filename)) if is_attachment + rename_file = ic.iconv( (File.basename(filename)) ).to_s + rename_file = ic.iconv( filename_to_real( File.basename(filename))).to_s if is_attachment + begin zipfile.add(rename_file, filename) rescue Exception => e diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index fed074bdb..3feb49547 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -329,7 +329,7 @@ module ApplicationHelper imagesize = attachment.thumbnail(:size => "50*50") imagepath = named_attachment_path(attachment, attachment.filename) if imagesize - link_to image_tag(thumbnail_path(attachment,"50")), + link_to image_tag(thumbnail_path(attachment), height: '73', width: '100'), imagepath, :title => attachment.filename else diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index 396501862..0a6944e3b 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -56,7 +56,7 @@ class JournalsForMessage < ActiveRecord::Base has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy - validates :notes, presence: true + validates :notes, presence: true, if: :is_homework_jour? after_create :act_as_activity #huang after_create :reset_counters! after_destroy :reset_counters! @@ -88,6 +88,10 @@ class JournalsForMessage < ActiveRecord::Base self.find(message_id).destroy # self.destroy_all "id = #{message_id}" end + + def is_homework_jour? + self.jour_type != "HomeworkAttach" + end def reference_user User.find(reply_id) diff --git a/app/views/files/_course_file.html.erb b/app/views/files/_course_file.html.erb index 7b2acd875..1769b1a45 100644 --- a/app/views/files/_course_file.html.erb +++ b/app/views/files/_course_file.html.erb @@ -62,11 +62,11 @@

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

<% end %> diff --git a/app/views/homework_attach/_review.html.erb b/app/views/homework_attach/_review.html.erb index 1666d8a43..921f16c8e 100644 --- a/app/views/homework_attach/_review.html.erb +++ b/app/views/homework_attach/_review.html.erb @@ -36,7 +36,8 @@ <% end %>
-

<%= textilizable jour.nil? ? "" : jour.notes%>

+ <% notes = textilizable(jour.nil? ? "" : jour.notes)%> + <%= notes.empty? ? "

".html_safe : notes%> <% unless jour.nil? %> <% ids = 'project_respond_form_'+ jour.id.to_s%> diff --git a/app/views/homework_attach/new.html.erb b/app/views/homework_attach/new.html.erb index 8697ff7ab..cf182716e 100644 --- a/app/views/homework_attach/new.html.erb +++ b/app/views/homework_attach/new.html.erb @@ -72,7 +72,7 @@ <%= f.text_field "name", :required => true, :size => 60, :class => "w430 bo", :maxlength => 254, :placeholder => "作品名称", :onkeyup => "regexName();" %>

-

+

<%= f.text_area "description", :class => "w620", :maxlength => 3000, :style => "width:430px", :placeholder => "最多3000个汉字", :onkeyup => "regexDescription();"%> -
- +

-

- -

- <%= render :partial => 'attachments/form' %> -

+
+

+    添加附件    :

+
+ <%= render :partial => 'attachments/form' %> +
+

diff --git a/app/views/layouts/_join_exit_project.html.erb b/app/views/layouts/_join_exit_project.html.erb index 67744e4b8..9cd376c60 100644 --- a/app/views/layouts/_join_exit_project.html.erb +++ b/app/views/layouts/_join_exit_project.html.erb @@ -1,15 +1,24 @@
- - <% if ( !(User.current.member_of? @project) && User.current.login?) %> + + <% if !User.current.member_of?(@project) && User.current.login? && !User.current.admin %> <%= watcher_link_for_project(@project, User.current) %> <% end %> - <% if ( !(User.current.member_of? @project) && User.current.login?) %> + <% if !User.current.member_of?(@project) && User.current.login? && !User.current.admin %> <%= join_in_project_link(@project, User.current) %> <% end %> - + <% if User.current.admin? || User.current.allowed_to?({:controller => 'projects', :action => 'settings'}, @project) %> <%= link_to "#{l(:button_configure)}".html_safe, settings_project_path(@project), :class => "pr_join_a" %> + <% end %> + + <% if (User.current.login? && User.current.member_of?(@project) && Member.where(:user_id => User.current.id, :project_id => @project.id).first.roles.first.to_s.include?("Manager")) || User.current.admin? %> <%= link_to "#{text}".html_safe,"javascript:void(0)" ,:onClick => "show_window();", :class => "pr_join_a",:id => "setting_project_type"%> <% end %> + + <% if (User.current.member_of? @project) && User.current.login? && + Member.where(:user_id => User.current.id, :project_id => @project.id).first.roles.first.to_s != "Manager" %> + <%= exit_project_link(@project) %> + <% end %> +
diff --git a/app/views/memos/_topic_form.html.erb b/app/views/memos/_topic_form.html.erb index a18402acf..3ce8cdf9a 100644 --- a/app/views/memos/_topic_form.html.erb +++ b/app/views/memos/_topic_form.html.erb @@ -1,9 +1,9 @@ <%= labelled_form_for(@memo, :url => forum_memos_path) do |f| %> -
+
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>

<%= f.text_field :subject, :required => true, :size => 95 %>

-

<%= f.kindeditor :content, :required => true %>

+

<%= f.kindeditor :content,:width=>'99%', :required => true %>


diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index 5ddea4e60..077bccdad 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -1,131 +1,162 @@ -<%= call_hook(:view_repositories_show_contextual, { :repository => @repository, :project => @project }) %> +<%= call_hook(:view_repositories_show_contextual, {:repository => @repository, :project => @project}) %>

版本库

-
+
<%= render :partial => 'breadcrumbs', - :locals => { :path => @path, :kind => 'dir', :revision => @rev } %> + :locals => {:path => @path, :kind => 'dir', :revision => @rev} %> <%= render :partial => 'navigation' %> -
+
+
-

<%if @repository.type.to_s=="Repository::Git"%> - <%= @repos_url%> - <%else %> - <%=h @repository.url %> +

+ <% if @repository.type.to_s=="Repository::Git" %> + <%= @repos_url %> + <% else %> + <%= h @repository.url %> <% end %>

-

- (<%= l(:label_all_revisions) %><%= @repositories.sort.collect {|repo| + +

+ (<%= l(:label_all_revisions) %><%= @repositories.sort.collect { |repo| link_to h(repo.name), {:controller => 'repositories', :action => 'show', :id => @project, :repository_id => repo.identifier_param, :rev => nil, :path => nil}, - :class => 'repository' + (repo == @repository ? ' selected' : '') , - :class => "mb10 word_break c_orange"}.join(' | ').html_safe %>) + :class => 'repository' + (repo == @repository ? ' selected' : ''), + :class => "mb10 break_word c_orange" }.join(' | ').html_safe %>)

-

项目代码请设置好正确的编码方式(utf-8),否则中文会出现乱码

-

建立版本库文件夹,打开命令行执行如下:

-
-
-

git init

-

git add *

-

git commit -m "first commit"

-

git remote add origin - http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git -

-

git config http.postBuffer 524288000 #设置本地post缓存为500MB

-

git push -u origin master:master

-
-
-

已经有本地库,还没有配置远程地址,打开命令行执行如下:

-
-
-

git remote add origin http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git

-

git add .

-

git commit -m "first commit"

-

git config http.postBuffer 524288000 #设置本地post缓存为500MB

-

git push -u origin master:master

-
-
-

已有远程地址,创建一个远程分支,并切换到该分支,打开命令行执行如下:

-
-
-

git clone http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git

-

git push

-

git checkout -b branch_name

-

git push origin branch_name

-
-
-

从网上获取别人的开源版本库,转交到trustie网站上,打开命令行执行如下:

-
-
-

git remote add trustie - http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git -

-

git add .

-

git commit -m "first commit"

-

git config http.postBuffer 524288000 #设置本地post缓存为500MB

-

git push -u trustie master:master

-

李海提供

+
+ +
+
+
+

项目代码请设置好正确的编码方式(utf-8),否则中文会出现乱码

-<% if !@entries.nil? && authorize_for('repositories', 'browse') %> - <%= render :partial => 'dir_list' %> -<% end %> +

建立版本库文件夹,打开命令行执行如下:

+
+
+

git init

+ +

git add *

+ +

git commit -m "first commit"

+ +

git remote add origin + http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git +

+ +

git config http.postBuffer 524288000 #设置本地post缓存为500MB

+ +

git push -u origin master:master

+
+ +
+

已经有本地库,还没有配置远程地址,打开命令行执行如下:

+
+
+

git remote add origin http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git

+ +

git add .

+ +

git commit -m "first commit"

-<%= render_properties(@properties) %> -<% if authorize_for('repositories', 'revisions') %> - <% if @changesets && !@changesets.empty? %> -

- <%= l(:label_latest_revision_plural) %> -

- <%= render :partial => 'revisions', - :locals => {:project => @project, :path => @path, - :revisions => @changesets, :entry => nil }%> +

git config http.postBuffer 524288000 #设置本地post缓存为500MB

+ +

git push -u origin master:master

+
+ +
+

已有远程地址,创建一个远程分支,并切换到该分支,打开命令行执行如下:

+
+
+

git clone http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git

+ +

git push

+ +

git checkout -b branch_name

+ +

git push origin branch_name

+
+ +
+

从网上获取别人的开源版本库,转交到trustie网站上,打开命令行执行如下:

+
+
+

git remote add trustie + http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git +

+ +

git add .

+ +

git commit -m "first commit"

+ +

git config http.postBuffer 524288000 #设置本地post缓存为500MB

+ +

git push -u trustie master:master

+ +

李海提供

+
+
+ <% if !@entries.nil? && authorize_for('repositories', 'browse') %> + <%= render :partial => 'dir_list' %> <% end %> -

- <% has_branches = (!@repository.branches.nil? && @repository.branches.length > 0) - sep = '' %> - <% if @repository.supports_all_revisions? && @path.blank? %> - <%= link_to l(:label_view_all_revisions), {:action => 'revisions', :id => @project, - :repository_id => @repository.identifier_param}, - :class => "orange_u_btn" %> - <% sep = '|' %> + + <%= render_properties(@properties) %> + <% if authorize_for('repositories', 'revisions') %> + <% if @changesets && !@changesets.empty? %> +

+ <%= l(:label_latest_revision_plural) %> +

+ <%= render :partial => 'revisions', + :locals => {:project => @project, :path => @path, + :revisions => @changesets, :entry => nil} %> <% end %> - <% if @repository.supports_directory_revisions? && ( has_branches || !@path.blank? || !@rev.blank? ) %> - <%= sep %> - <%= link_to l(:label_view_revisions), - {:action => 'changes', - :path => to_path_param(@path), - :id => @project, - :repository_id => @repository.identifier_param, - :rev => @rev}, - :class => "orange_u_btn" %> +

+ <% has_branches = (!@repository.branches.nil? && @repository.branches.length > 0) + sep = '' %> + <% if @repository.supports_all_revisions? && @path.blank? %> + <%= link_to l(:label_view_all_revisions), {:action => 'revisions', :id => @project, + :repository_id => @repository.identifier_param}, + :class => "orange_u_btn" %> + <% sep = '|' %> + <% end %> + <% if @repository.supports_directory_revisions? && (has_branches || !@path.blank? || !@rev.blank?) %> + <%= sep %> + <%= link_to l(:label_view_revisions), + {:action => 'changes', + :path => to_path_param(@path), + :id => @project, + :repository_id => @repository.identifier_param, + :rev => @rev}, + :class => "orange_u_btn" %> + <% end %> +

+ <% if @repository.supports_all_revisions? %> + <% content_for :header_tags do %> + <%= auto_discovery_link_tag( + :atom, params.merge( + {:format => 'atom', :action => 'revisions', + :id => @project, :page => nil, :key => User.current.rss_key})) %> + <% end %> <% end %> -

- <% if @repository.supports_all_revisions? %> - <% content_for :header_tags do %> - <%= auto_discovery_link_tag( - :atom, params.merge( - {:format => 'atom', :action => 'revisions', - :id => @project, :page => nil, :key => User.current.rss_key})) %> - <% end %> <% end %> -<% end %> - -

查看如何提交代码: - <%= link_to(l(:label_how_commit_code_chinese), ch_usage_path, :class => "c_blue") %> - <%= link_to('English', en_usage_path, :class => "c_blue") %> -

+ +

查看如何提交代码: + <%= link_to(l(:label_how_commit_code_chinese), ch_usage_path, :class => "c_blue") %> + <%= link_to('English', en_usage_path, :class => "c_blue") %> + +

<% content_for :header_tags do %> - <%= stylesheet_link_tag "scm" %> + <%= stylesheet_link_tag "scm" %> <% end %> <% html_title(l(:label_repository)) -%> diff --git a/app/views/welcome/contest.html.erb b/app/views/welcome/contest.html.erb index fa23f3843..201afe574 100644 --- a/app/views/welcome/contest.html.erb +++ b/app/views/welcome/contest.html.erb @@ -256,60 +256,143 @@ <% end %>
+<% if @contest_notifications.count < 5%> +
+

+ <%=l(:label_issue_feedback_activities)%> + <%= link_to l(:label_my_question), newbie_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%> + <%= link_to l(:label_my_feedback), suggestion_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%> +

+ <%= link_to l(:label_more_information), forums_path %> +
+ +
+
-
-

<%=l(:label_current_attendingcontest_work)%>

-
- <% if Softapplication.count > 0%> -
- <% find_all_hot_softapplication.map do |softapplication| break if(softapplication == find_all_hot_softapplication[5]) %> - -
  • -
    - <%= image_tag('/images/app1.png')%> -
    -
    - <%= link_to(softapplication.name, softapplication_path(softapplication.id), :class => "d-g-blue d-p-project-name", :title => "#{softapplication.name}", :target => "_blank") %> -
    - -
    +
    +

    <%=l(:label_current_attendingcontest_work)%>

    +
    + <% if Softapplication.count > 0%> +
    + <% find_all_hot_softapplication.map do |softapplication| break if(softapplication == find_all_hot_softapplication[5]) %> + +
  • +
    + <%= image_tag('/images/app1.png')%> +
    +
    + <%= link_to(softapplication.name, softapplication_path(softapplication.id), :class => "d-g-blue d-p-project-name", :title => "#{softapplication.name}", :target => "_blank") %> +
    + +
    > <%=softapplication.description.to_s.truncate(50, omission: '...')%> -

    +

  • -
    +
    <%=l(:label_release_time)%>:  <%=format_time softapplication.created_at %> -
    +
    - - <% end; reset_cycle %> + + <% end; reset_cycle %> -
    - <% else %> -

    +

    + <% else %> +

    <%= l(:label_no_ftapplication) %>

    - <% end %> - - + <% end %> + + +<% else %> +
    +

    <%=l(:label_current_attendingcontest_work)%>

    +
    + <% if Softapplication.count > 0%> +
    + <% find_all_hot_softapplication.map do |softapplication| break if(softapplication == find_all_hot_softapplication[5]) %> + +
  • +
    + <%= image_tag('/images/app1.png')%> +
    +
    + <%= link_to(softapplication.name, softapplication_path(softapplication.id), :class => "d-g-blue d-p-project-name", :title => "#{softapplication.name}", :target => "_blank") %> +
    + +
    + > + <%=softapplication.description.to_s.truncate(50, omission: '...')%> + +

    -
    -

    - <%=l(:label_issue_feedback_activities)%> - <%= link_to l(:label_my_question), newbie_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%> - <%= link_to l(:label_my_feedback), suggestion_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%> -

    - <%= link_to l(:label_more_information), forums_path %> -
    -
      - <% find_new_forum_topics(9 - @contest_notifications.count).each do |topic|%> -
    • -
      +
      + + <%=l(:label_release_time)%>:  + <%=format_time softapplication.created_at %> + +
      + +
    • + <% end; reset_cycle %> + +
    + <% else %> +

    + <%= l(:label_no_ftapplication) %> +

    + <% end %> +
    +
  • + + + +
    +

    + <%=l(:label_issue_feedback_activities)%> + <%= link_to l(:label_my_question), newbie_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%> + <%= link_to l(:label_my_feedback), suggestion_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%> +

    + <%= link_to l(:label_more_information), forums_path %> +
    +
      + <% find_new_forum_topics(9 - @contest_notifications.count).each do |topic|%> +
    • +
            <%= link_to '['+topic.forum.name + ']',forum_path(topic.forum),:class => 'memo_Bar_title' %> <%= link_to topic.subject.truncate(30, omission: '...'), topic.event_url, :class => "gray" , :style => "font-size: 10pt !important;" %> @@ -333,11 +416,15 @@
    - - <% end %> - -
    -
    + + <% end %> + +
    + +<% end%> + + +
    diff --git a/app/views/welcome/course.html.erb b/app/views/welcome/course.html.erb index 5c57a5ba1..cbceec2c7 100644 --- a/app/views/welcome/course.html.erb +++ b/app/views/welcome/course.html.erb @@ -57,7 +57,6 @@