diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index c54a419cb..6507b3178 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -21,29 +21,32 @@ class CoursesController < ApplicationController before_filter :toggleCourse, only: [:finishcourse, :restartcourse] before_filter :require_login, :only => [:join, :unjoin] - before_filter :allow_join, :only => [:join] + #before_filter :allow_join, :only => [:join] def join if User.current.logged? - course = Course.find(params[:object_id]) - unless User.current.member_of_course? course - if params[:course_password] == course.password - members = [] - members << Member.new(:role_ids => [10], :user_id => User.current.id) - course.members << members - StudentsForCourse.create(:student_id => User.current.id, :course_id => params[:object_id]) - @state = 0 - else - @state = 1 - end + course = Course.find_by_id params[:object_id] + if course + @state = 4 else - @state = 3 + unless (allow_join && User.current.member_of_course?(course)) + if params[:course_password] == course.password + members = [] + members << Member.new(:role_ids => [10], :user_id => User.current.id) + course.members << members + StudentsForCourse.create(:student_id => User.current.id, :course_id => params[:object_id]) + @state = 0 + else + @state = 1 + end + else + @state = 3 + end end else - @state = 4 + @state = 5 end respond_to do |format| - # format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}} format.js { render :partial => 'set_join', :locals => {:user => User.current, :course => Course.find(params[:object_id]), :object_id => params[:object_id]} } end rescue Exception => e diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 89ad42c17..313afa1c7 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -113,7 +113,7 @@ class FilesController < ApplicationController end if order_by.count == 1 - sort += "#{Attachment.table_name}.#{attribute} desc " + sort += "#{Attachment.table_name}.#{attribute} asc " elsif order_by.count == 2 sort += "#{Attachment.table_name}.#{attribute} #{order_by[1]} " end diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index c9550add3..0c1f65317 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -113,7 +113,7 @@ class RepositoriesController < ApplicationController @root_path=RepositoriesHelper::ROOT_PATH @repository_name=User.current.login.to_s+"/"+params[:repository][:identifier]+".git" @project_path=@root_path+"htdocs/"+@repository_name - @repository_tag=params[:repository][:upassword] + @repository_tag=params[:repository][:upassword] || params[:repository][:password] @repo_name=User.current.login.to_s+"_"+params[:repository][:identifier] logger.info "htpasswd -mb "+@root_path+"user.passwd "+@repo_name+": "+@repository_tag logger.info "the value of create repository"+@root_path+": "+@repository_name+": "+@project_path+": "+@repo_name diff --git a/app/views/common/403.html b/app/views/common/403.html index 39df9d70e..826d43067 100644 --- a/app/views/common/403.html +++ b/app/views/common/403.html @@ -31,8 +31,8 @@ a:hover{ } 没有访问权限!建议您

diff --git a/app/views/common/404.html b/app/views/common/404.html index f4ec0e8f0..ce92d7e4c 100644 --- a/app/views/common/404.html +++ b/app/views/common/404.html @@ -31,8 +31,8 @@ a:hover{ } 页面不见了!建议您

diff --git a/app/views/courses/_join_private_course.html.erb b/app/views/courses/_join_private_course.html.erb index 60223922f..2d36e2ece 100644 --- a/app/views/courses/_join_private_course.html.erb +++ b/app/views/courses/_join_private_course.html.erb @@ -1,60 +1,75 @@ - - + + + + + 快速进入课程通道 + + + + + +
+
+
+

快速进入课程通道

+

只要持有课程ID和密码,就课快速加入所在课程。课程页面搜索不到的私有课程只能从此通道进入哦!

-
- 密码   : - <%= text_field_tag 'course_password', nil, :style=>'width:80%'%> +
+ <%= form_tag({:controller => 'courses', + :action => 'join'}, + :remote => true, + :method => :post, + :id => 'new-watcher-form') do %> + + <% end%>
+
+
+ + -

- <%= submit_tag l(:label_new_join), :name => nil, :class => "bid_btn", :onclick => "hideModal(this);" %> - <%= submit_tag l(:button_cancel), :name => nil, :class => "bid_btn", :onclick => "hideModal(this);", :type => 'button' %> -

-<% end %> diff --git a/app/views/courses/_set_join.js.erb b/app/views/courses/_set_join.js.erb index fb9b9924e..41ca263ce 100644 --- a/app/views/courses/_set_join.js.erb +++ b/app/views/courses/_set_join.js.erb @@ -12,7 +12,7 @@ alert("您已经加入了课程"); <% elsif @state == 4 %> alert("您已经的课程不存在"); - <% elsif @state == 4 %> + <% elsif @state == 5 %> alert("您还未登录"); <% else %> alert("未知错误,请稍后再试"); diff --git a/app/views/courses/join_private_courses.js.erb b/app/views/courses/join_private_courses.js.erb index 71c7e62b7..14a161907 100644 --- a/app/views/courses/join_private_courses.js.erb +++ b/app/views/courses/join_private_courses.js.erb @@ -1,3 +1,4 @@ $('#ajax-modal').html('<%= escape_javascript(render :partial => 'join_private_course') %>'); -showModal('ajax-modal', '400px'); -$('#ajax-modal').addClass('new-watcher'); \ No newline at end of file +showModal('ajax-modal', '510px'); +$('#ajax-modal').addClass('new-watcher'); +$('#ajax-modal').css('height','330px'); \ No newline at end of file diff --git a/app/views/files/_course_new.html.erb b/app/views/files/_course_new.html.erb index 960b2d399..88c33d865 100644 --- a/app/views/files/_course_new.html.erb +++ b/app/views/files/_course_new.html.erb @@ -1,6 +1,7 @@

<%=l(:label_attachment_new)%>

<% attachmenttypes = course.attachmenttypes %> <%= error_messages_for 'attachment' %> + <%= form_tag(course_files_path(course), :multipart => true,:remote => true,:method => :post,:name=>"upload_form", :class => "tabular") do %>

diff --git a/app/views/files/_course_show_all_attachment.html.erb b/app/views/files/_course_show_all_attachment.html.erb index 15ef36580..3ce583cb8 100644 --- a/app/views/files/_course_show_all_attachment.html.erb +++ b/app/views/files/_course_show_all_attachment.html.erb @@ -17,7 +17,7 @@ <%#= sort_header_tag('created_on', :caption => l(:label_date), :default_order => 'desc', :scope => "col", :id => "vzebra-comedy") %> <%= sort_header_tag('size', :caption => l(:field_filesize), :default_order => 'desc', :scope => "col", :id => "vzebra-children",:class => "tableth") %> <%= sort_header_tag('attach_type', :caption => l(:attachment_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-attachmenttype",:class => "tableth") %> - <%= sort_header_tag('content_type', :caption => l(:attachment_sufix_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-contenttype",:class => "tableth") %> + <%= content_tag('th', l(:attachment_sufix_browse), id: 'vzebra-contenttype', class: 'tableth', style: 'color: black')%> <%= sort_header_tag('field_file_dense', :caption => l(:field_file_dense), :default_order => 'desc', :scope => "col", :id => "vzebra-field_file_dense",:class => "tableth") %> <%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope => "col", :id => "vzebra-action",:class => "tableth") %> <%= sort_header_tag('operation', :caption => "", :scope => "col", :id => "vzebra-children",:class => "tableth") %> diff --git a/app/views/forums/_form.html.erb b/app/views/forums/_form.html.erb index 4679420f4..0db5a0f70 100644 --- a/app/views/forums/_form.html.erb +++ b/app/views/forums/_form.html.erb @@ -19,8 +19,11 @@

- <%= f.text_area :description, :required => true, :id => 'editor01' %> - +

+ <%= f.text_area :description, :required => true, :id => 'editor01' %> +

+ +

(<%= l(:label_forums_max_length) %>)

diff --git a/app/views/projects/settings/_repositories.html.erb b/app/views/projects/settings/_repositories.html.erb index f4b505065..eac6f85ce 100644 --- a/app/views/projects/settings/_repositories.html.erb +++ b/app/views/projects/settings/_repositories.html.erb @@ -4,10 +4,10 @@ - - - - + + + + @@ -37,7 +37,7 @@ <% end %> <% elsif repository.scm_name=="Git"%> <%if User.current.allowed_to?(:manage_repository, @project) %> - <%= link_to(l(:label_user_plural), committers_repository_path(repository), :class => 'icon icon-user') %> diff --git a/app/views/repositories/_form.html.erb b/app/views/repositories/_form.html.erb index 1fabf47c8..cc200ac5c 100644 --- a/app/views/repositories/_form.html.erb +++ b/app/views/repositories/_form.html.erb @@ -11,20 +11,31 @@

<%= f.check_box :is_default, :label => :field_repository_is_default %>

-

<%= f.text_field :identifier, :required => true, :disabled => @repository.identifier_frozen?, - value:"#{User.current.id.to_s + '_' +Time.now.to_s.gsub(' ','_').gsub(':','').gsub('+','')}"%> +

+ <%= f.text_field :identifier, :required => true, :disabled => @repository.identifier_frozen?, + value:"#{User.current.id.to_s + '_' +Time.now.to_s.gsub(' ','_').gsub(':','').gsub('+','')}"%> <% unless @repository.identifier_frozen? %> - <%= l(:text_length_between, :min => 1, :max => Repository::IDENTIFIER_MAX_LENGTH) %> <%= l(:text_repository_identifier_info).html_safe %> + + <%= l(:text_length_between, :min => 1, :max => Repository::IDENTIFIER_MAX_LENGTH) %> + <%= l(:text_repository_identifier_info).html_safe %> <% end %>

-

<%= f.text_field :url, :size => 60, :required => true, :disabled => !@repository.safe_attribute?('url'), :id => "url_text_field" %> - <%= "#{l(:label_exist_repository_path)}" %> +

+ <%= f.text_field :url, :size => 60, :required => true, :disabled => !@repository.safe_attribute?('url'), :id => "url_text_field" %> + + <%= "#{l(:label_exist_repository_path)}" %> + +

+

+ <%= f.text_field :login, :size => 30 %> +

+

+ <%= f.password_field :password, :size => 30, :name => 'ignore', + :value => ((@repository.new_record? || @repository.password.blank?) ? '' : ('x'*15)), + :onfocus => "this.value=''; this.name='repository[password]';", + :onchange => "this.name='repository[password]';" %>

-

<%= f.text_field :login, :size => 30 %>

-

<%= f.password_field :password, :size => 30, :name => 'ignore', :value => ((@repository.new_record? || @repository.password.blank?) ? '' : ('x'*15)), - :onfocus => "this.value=''; this.name='repository[password]';", - :onchange => "this.name='repository[password]';" %>

diff --git a/app/views/tags/_tag.html.erb b/app/views/tags/_tag.html.erb index b20b383ef..405f8f2e3 100644 --- a/app/views/tags/_tag.html.erb +++ b/app/views/tags/_tag.html.erb @@ -12,10 +12,16 @@ #end%> <% if object_flag == '3' %> - <%= image_tag("/images/sidebar/tags.png") %> - <%= l(:label_tag) %>: + + <%= image_tag("/images/sidebar/tags.png") %> + + + <%= l(:label_tag) %>: + <% if User.current.logged? %> - <%= toggle_link (image_tag "/images/sidebar/add.png"), 'put-tag-form-issue', {:focus => 'name-issue'} %> + + <%= toggle_link (image_tag "/images/sidebar/add.png"), 'put-tag-form-issue', {:focus => 'name-issue'} %> + <% end %>

@@ -36,7 +42,9 @@ <% elsif object_flag == '6' %> <%#= image_tag("/images/sidebar/tags.png") %> - <%= 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? %> + <%= 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? %>    @@ -47,21 +55,24 @@ <%= render :partial => "courses/course_resources_html", :locals => {:obj => obj ,:object_flag => object_flag } %>
<% else %> - - <%= image_tag("/images/sidebar/tags.png") %> - <%= l(:label_tag) %>: - + + <%= image_tag("/images/sidebar/tags.png") %> + + + <%= l(:label_tag) %>: + <% if User.current.logged? %> - <%= toggle_link (image_tag "/images/sidebar/add.png"), 'put-tag-form', {:focus => 'tags_name'} %> + + <%= toggle_link (image_tag "/images/sidebar/add.png"), 'put-tag-form', {:focus => 'tags_name'} %> + <% end %> -
<%= render :partial => "tags/tag_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %>
<%= l(:field_identifier) %><%= l(:field_repository_is_default) %><%= l(:label_scm) %><%= l(:label_repository_path) %><%= l(:field_identifier) %><%= l(:field_repository_is_default) %><%= l(:label_scm) %><%= l(:label_repository_path) %>