diff --git a/app/controllers/contests_controller.rb b/app/controllers/contests_controller.rb index 0f16a81c6..14395ac0b 100644 --- a/app/controllers/contests_controller.rb +++ b/app/controllers/contests_controller.rb @@ -33,15 +33,6 @@ class ContestsController < ApplicationController if params[:contest_sort_type].present? case params[:contest_sort_type] when '0' - unless @offset == 0 - @contests = @contests.offset(@offset).limit(@limit).all.reverse - else - limit = @contest_count % @limit - limit = @limit if limit == 0 - @contests = @contests.offset(@offset).limit(limit).all.reverse - end - @s_state = 0 - when '1' unless @offset == 0 @contests = @contests.reorder('contests.commit').offset(@offset).limit(@limit).all.reverse else @@ -49,6 +40,15 @@ class ContestsController < ApplicationController limit = @limit if limit == 0 @contests = @contests.reorder('contests.commit').offset(@offset).limit(limit).all.reverse end + @s_state = 0 + when '1' + unless @offset == 0 + @contests = @contests.reorder('contests.created_on').offset(@offset).limit(@limit).all.reverse + else + limit = @contest_count % @limit + limit = @limit if limit == 0 + @contests = @contests.reorder('contests.created_on').offset(@offset).limit(limit).all.reverse + end @s_state = 1 when '2' unless @offset == 0 @@ -62,11 +62,11 @@ class ContestsController < ApplicationController end else unless @offset == 0 - @contests = @contests.reorder('contests.commit').offset(@offset).limit(@limit).all.reverse + @contests = @contests.reorder('contests.created_on').offset(@offset).limit(@limit).all.reverse else limit = @contest_count % @limit limit = @limit if limit == 0 - @contests = @contests.reorder('contests.commit').offset(@offset).limit(limit).all.reverse + @contests = @contests.reorder('contests.created_on').offset(@offset).limit(limit).all.reverse end @s_state = 1 end diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 730546aa6..ee57935f1 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -138,6 +138,17 @@ class ProjectsController < ApplicationController @project_count = @projects_all.count @project_pages = Paginator.new @project_count, per_page_option, params['page'] +#gcm activity count + + @project_activity_count=Hash.new + + @projects_all.each do |project| + @project_activity_count[project.id]=0 + end + + @project_activity_count=get_project_activity @projects_all,@project_activity_count + +#gcm end case params[:project_sort_type] when '0' @@ -149,6 +160,14 @@ class ProjectsController < ApplicationController when '2' @projects = @projects_all.order("watchers_count desc") @s_type = 2 + + #gcm + when '3' + #@projects=desc_sort_course_by_avtivity(@project_activity_count_array,@project_all_array) + @projects=handle_project @projects_all,@project_activity_count + @s_type = 3 + @projects = @projects[@project_pages.offset, @project_pages.per_page] + else @projects = @projects = @projects_all.order("grade desc") @s_type = 1 @@ -193,122 +212,16 @@ class ProjectsController < ApplicationController @project_count = @projects_all.count @project_pages = Paginator.new @project_count, per_page_option, params['page'] -#gcm activity count + #gcm activity count @project_activity_count=Hash.new - + #count initialize @projects_all.each do |project| @project_activity_count[project.id]=0 end - @project_ids=@project_activity_count.keys() - - days = Setting.activity_days_default.to_i - date_to ||= Date.today + 1 - date_from = date_to - days-1.years -#approach 1 -=begin - - @projects_all.each do |project| - #issue_count - issues=Issue.where("project_id=?",project.id) - issue_count=0 - issues.each do |issue| - issue_count+=issue.journals.count - end - - #repository_count - repositories=Repository.where("project_id=?",project.id) - repository_count=0 - repositories.each do |repository| - repository_count+=repository.changesets.count - end - - #news_count - news_count=News.where("project_id=?",project.id).count - #document_count - document_count=Document.where("project_id=?",project.id).count - #file_count - file_count=Attachment.where("container_type='Project' AND container_id=?",project.id).count - - #message_count - boards=Board.where("project_id=?",project.id) - message_count=0 - boards.each do |board| - message_count+=board.messages.count - end - - #time_entry_count - time_entry_count=TimeEntry.where("project_id=?",project.id).count - - #sum - @project_activity_count[project.id.to_s]=issue_count+repository_count+news_count+document_count+file_count+message_count+time_entry_count - - end -=end -#gcm - -#gcm approach 2 - - #issue_count - Issue.where(project_id: @project_ids).where("updated_on>?",date_from).each do |issue| -# @project_activity_count[issue.project_id.to_s]+=1 - @project_activity_count[issue.project_id]+=issue.journals.where("created_on>?",date_from).count - end - - #repository_count - Repository.where(project_id: @project_ids).each do |repository| -# @project_activity_count[repository.project_id.to_s]+=1 - @project_activity_count[repository.project_id]+=repository.changesets.where("committed_on>?",date_from).count - end - - - #news_count - News.where(project_id: @project_ids).where("created_on>?",date_from).each do |news| - @project_activity_count[news.project_id]+=1 - end - - #document_count - Document.where(project_id: @project_ids).where("created_on>?",date_from).each do |document| - @project_activity_count[document.project_id]+=1 - end - - #file_count - Attachment.where(container_id: @project_ids).where("container_type='Project' AND created_on>?",date_from).each do |attachment| - @project_activity_count[attachment.container_id]+=1 - end - - #message_count - Board.where(project_id: @project_ids).each do |board| -# @project_activity_count[board.project_id]+=1 - @project_activity_count[board.project_id]+=board.messages.where("updated_on>?",date_from).count - end - - #time_entry_count - TimeEntry.where(project_id: @project_ids).where("updated_on>?",date_from).each do |timeentry| - @project_activity_count[timeentry.project_id]+=1 - end - - #feedbackc_count - JournalsForMessage.where(jour_id: @project_ids).each do |jourformess| - @project_activity_count[jourformess.jour_id]+=1 - end - - #@project_activity_count!=0 - @project_all_array=[] - i=0; - @projects_all.each do |project| - id=project.id - @project_all_array[i]=project - if @project_activity_count[id]==0 - @project_activity_count[id]=1 - end - i=i+1 - end - - @project_activity_count_array=@project_activity_count.values() - -#gcm end + #@project_activity_count=get_project_activity @projects_all,@project_activity_count + #gcm end case params[:project_sort_type] @@ -316,26 +229,48 @@ class ProjectsController < ApplicationController @projects = @projects_all.order("created_on desc") @s_type = 0 @projects = @projects.offset(@project_pages.offset).limit(@project_pages.per_page) + + #gcm + @project_activity_count=get_project_activity @projects,@project_activity_count + #gcmend + when '1' @projects = @projects_all.order("course_ac_para desc") @s_type = 1 @projects = @projects.offset(@project_pages.offset).limit(@project_pages.per_page) + + #gcm + @project_activity_count=get_project_activity @projects,@project_activity_count + #gcmend + when '2' @projects = @projects_all.order("watchers_count desc") @s_type = 2 @projects = @projects.offset(@project_pages.offset).limit(@project_pages.per_page) + #gcm + @project_activity_count=get_project_activity @projects,@project_activity_count + #gcmend + #gcm when '3' - @projects=desc_sort_course_by_avtivity(@project_ids,@project_activity_count_array,@project_all_array) + + #gcm + @project_activity_count=get_project_activity @projects_all,@project_activity_count + #gcmend + + @projects=handle_project @projects_all,@project_activity_count @s_type = 3 @projects = @projects[@project_pages.offset, @project_pages.per_page] - #gcmend - else @s_type = 0 @projects = @projects_all.order("created_on desc") @projects = @projects.offset(@project_pages.offset).limit(@project_pages.per_page) + + #gcm + @project_activity_count=get_project_activity @projects,@project_activity_count + #gcmend + end respond_to do |format| @@ -354,17 +289,76 @@ class ProjectsController < ApplicationController end end +#gcm def search #modified by nie project_type = params[:project_type].to_i projects_all = (project_type.eql? Project::ProjectType_course) ? Project.course_entities : Project.project_entities @projects = projects_all.visible - @projects = @projects.visible.like(params[:name]) if params[:name].present? - @offset, @limit = api_offset_and_limit({:limit => 10}) - @project_count = @projects.visible.count - @project_pages = Paginator.new @project_count, @limit, params['page'] - @offset ||= @project_pages.offset - @projects = @projects.visible.offset(@offset).limit(@limit).all + @projects_all = @projects.visible.like(params[:name]) if params[:name].present? + + @project_count = @projects_all.count + @project_pages = Paginator.new @project_count, per_page_option, params['page'] + + #gcm activity count + + @project_activity_count=Hash.new + # count initialize + @projects_all.each do |project| + @project_activity_count[project.id]=0 + end + + #@project_activity_count=get_project_activity @projects_all,@project_activity_count + + #gcm end + + + case params[:project_sort_type] + when '0' + @projects = @projects_all.order("created_on desc") + @s_type = 0 + @projects = @projects.offset(@project_pages.offset).limit(@project_pages.per_page) + + #gcm + @project_activity_count=get_project_activity @projects,@project_activity_count + #gcmend + + when '1' + @projects = @projects_all.order("course_ac_para desc") + @s_type = 1 + @projects = @projects.offset(@project_pages.offset).limit(@project_pages.per_page) + + #gcm + @project_activity_count=get_project_activity @projects,@project_activity_count + #gcmend + + when '2' + @projects = @projects_all.order("watchers_count desc") + @s_type = 2 + @projects = @projects.offset(@project_pages.offset).limit(@project_pages.per_page) + + #gcm + @project_activity_count=get_project_activity @projects,@project_activity_count + #gcmend + + when '3' + #@projects=desc_sort_course_by_avtivity(@project_activity_count_array,@project_all_array) + @project_activity_count=get_project_activity @projects_all,@project_activity_count_array #gcm + @projects=handle_project @projects_all,@project_activity_count + @s_type = 3 + @projects = @projects[@project_pages.offset, @project_pages.per_page] + + else + @s_type = 0 + @projects = @projects_all.order("created_on desc") + @projects = @projects.offset(@project_pages.offset).limit(@project_pages.per_page) + + #gcm + @project_activity_count=get_project_activity @projects,@project_activity_count + #gcmend + + end + respond_to do |format| format.html { render :layout => 'base' @@ -384,6 +378,38 @@ class ProjectsController < ApplicationController } end end +#gcmend + + # def search + # #modified by nie + # project_type = params[:project_type].to_i + # projects_all = (project_type.eql? Project::ProjectType_course) ? Project.course_entities : Project.project_entities + # @projects = projects_all.visible + # @projects = @projects.visible.like(params[:name]) if params[:name].present? + # @offset, @limit = api_offset_and_limit({:limit => 10}) + # @project_count = @projects.visible.count + # @project_pages = Paginator.new @project_count, @limit, params['page'] + # @offset ||= @project_pages.offset + # @projects = @projects.visible.offset(@offset).limit(@limit).all + # respond_to do |format| + # format.html { + # render :layout => 'base' + # scope = Project + # unless params[:closed] + # scope = scope.active + # end + # } + # format.api { + # # @offset, @limit = api_offset_and_limit + # # @project_count = Project.visible.count + # # @projects = Project.visible.offset(@offset).limit(@limit).order('lft').all + # } + # format.atom { + # projects = Project.visible.order('created_on DESC').limit(Setting.feeds_limit.to_i).all + # render_feed(projects, :title => "#{Setting.app_title}: #{l(:label_project_latest)}") + # } + # end + # end # added by fq def new_join @@ -1018,7 +1044,93 @@ class ProjectsController < ApplicationController end end - def desc_sort_course_by_avtivity(ids,activity_count,projects) + + + #gcm + def get_project_activity projects,activities + @project_ids=activities.keys() + + days = Setting.activity_days_default.to_i + date_to ||= Date.today + 1 + date_from = date_to - days-1.years + + #issue_count + Issue.where(project_id: @project_ids).where("updated_on>?",date_from).each do |issue| +# activities[issue.project_id.to_s]+=1 + activities[issue.project_id]+=issue.journals.where("created_on>?",date_from).count + end + + #repository_count + Repository.where(project_id: @project_ids).each do |repository| +# activities[repository.project_id.to_s]+=1 + activities[repository.project_id]+=repository.changesets.where("committed_on>?",date_from).count + end + + + #news_count + News.where(project_id: @project_ids).where("created_on>?",date_from).each do |news| + activities[news.project_id]+=1 + end + + #document_count + Document.where(project_id: @project_ids).where("created_on>?",date_from).each do |document| + activities[document.project_id]+=1 + end + + #file_count + Attachment.where(container_id: @project_ids, container_type: Project).where("created_on>?",date_from).each do |attachment| + activities[attachment.container_id]+=1 + end + + #message_count + Board.where(project_id: @project_ids).each do |board| +# activities[board.project_id]+=1 + activities[board.project_id]+=board.messages.where("updated_on>?",date_from).count + end + + #time_entry_count + TimeEntry.where(project_id: @project_ids).where("updated_on>?",date_from).each do |timeentry| + activities[timeentry.project_id]+=1 + end + + #feedbackc_count + JournalsForMessage.where(jour_id: @project_ids, jour_type: Project).each do |jourformess| + activities[jourformess.jour_id]+=1 + end + + #activities!=0 + i=0; + projects.each do |project| + id=project.id + if activities[id]==0 + activities[id]=1 + end + end + + return activities + end + #gcmend + + #gcm + def handle_project projects,activities + project_activity_count_array=activities.values() + + project_array=[] + i=0; + projects.each do |project| + project_array[i]=project + i=i+1 + end + + projects=desc_sort_course_by_avtivity(project_activity_count_array,project_array) + + return projects + end + #gcmend + + + #gcm + def desc_sort_course_by_avtivity(activity_count,projects) return projects if activity_count.size<2 (activity_count.size-2).downto(0) do |i| (0..i).each do |j| @@ -1029,20 +1141,7 @@ class ProjectsController < ApplicationController end end return projects - - - - # len=activity_count.length - # for i in 0...(len-1) do - # for j in 0...(len-i-1) do - # if activity_count[j]>activity_count[j+1] do - # count_temp=activity_count[j] - - # activity_count[j]=activity_count[j+1] - # activity_count[j+1]=count_temp - # end - # end - # end -#desc_sort_course_by_avtivity(@project_ids,@project_activity_count_array,@projects_all) end + #gcmend + end diff --git a/app/controllers/school_controller.rb b/app/controllers/school_controller.rb index 9ef935cf7..5b405a27a 100644 --- a/app/controllers/school_controller.rb +++ b/app/controllers/school_controller.rb @@ -2,14 +2,49 @@ class SchoolController < ApplicationController before_filter :require_admin, :only => :upload_logo - def upload_logo + def upload + uploaded_io = params[:logo] + school_id = 0 + schools = School.where("name = ?", params[:school]) + schools.each do |s| + school_id = s.id + end + + unless uploaded_io.nil? + File.open(Rails.root.join('public', 'images', 'school', school_id.to_s+'.png'), 'wb') do |file| + file.write(uploaded_io.read) + end + + s1 = School.find(school_id) + s1.logo_link = '/images/school/'+school_id.to_s+'.png' + s1.save + + + end + end + + def upload_logo + end def index end + + def get_province + @provinces = School.find_by_sql("select distinct province from schools") + + options = "" + + @provinces.each do |p| + options << "" + end + + render :text => options + + end def get_options @school = School.where("province = ?", params[:province]) diff --git a/app/controllers/softapplications_controller.rb b/app/controllers/softapplications_controller.rb index 9cc940bdd..281f6216d 100644 --- a/app/controllers/softapplications_controller.rb +++ b/app/controllers/softapplications_controller.rb @@ -8,6 +8,30 @@ class SoftapplicationsController < ApplicationController def index @softapplications = Softapplication.all + #new added fenyefunction + @limit = 5 + @softapplication_count = @softapplications.count + @softapplication_pages = Paginator.new @softapplication_count, @limit, params['page'] + @offset ||= @softapplication_pages.offset + #@softapplications = @softapplications[@offset,@limit] + #new added end + + #new added sort + if params[:softapplication_sort_type].present? + case params[:softapplication_sort_type] + when '0' + @softapplications = @softapplications[@offset, @limit] + @s_state = 0 + when '1' + @softapplications = @softapplications.sort { |x, y| y[:created_at] <=> x[:created_at]}[@offset, @limit] + @s_state = 1 + end + else + @softapplications = @softapplications.sort { |x, y| y[:created_at] <=> x[:created_at]}[@offset, @limit] + @s_state = 1 + end + #new added end + respond_to do |format| format.html # index.html.erb format.json { render json: @softapplications } @@ -16,8 +40,25 @@ class SoftapplicationsController < ApplicationController # GET /softapplications/1 # GET /softapplications/1.json + + def percent_of(num, percent) + num.to_f / percent.to_f * 100.0 + end + def show @softapplication = Softapplication.find(params[:id]) + # 打分统计 + stars_reates = @softapplication. + rates(:quality) + stars_reates_count = stars_reates.count == 0 ? 1 : stars_reates.count + stars_status = stars_reates.select("stars, count(*) as scount"). + group("stars") + + @stars_status_map = Hash.new(0.0) + stars_status.each do |star_status| + @stars_status_map["star#{star_status.stars.to_i}".to_sym] = + percent_of(star_status.scount, stars_reates_count).to_s + "%" + end @jours = @softapplication.journals_for_messages.order('created_on DESC') @image_results = [] @softapplication.attachments.each do |f| diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index 5e8eef074..c662c44f7 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -39,8 +39,36 @@ class WelcomeController < ApplicationController @courseCount = Project.course_entities.count @teacherCount = User.teacher.count @studentCount = User.student.count + @logoLink = logolink() end + + + def logolink() + id = params[:school_id] + logo_link = "" + if id.nil? and User.current.user_extensions.school.nil? + logo_link = '/images/transparent.png' + else + if id == "0" + logo_link = '/images/transparent.png' + else + if id.nil? + if School.find(User.current.user_extensions.school.id).logo_link.nil? + logo_link = '/images/transparent.png' + else + logo_link = School.find(User.current.user_extensions.school.id).logo_link + end + else + logo_link = School.find(id).logo_link + + end + end + end + return logo_link + end + + def contest end diff --git a/app/helpers/contests_helper.rb b/app/helpers/contests_helper.rb index cb4d6a0f7..36f2351cb 100644 --- a/app/helpers/contests_helper.rb +++ b/app/helpers/contests_helper.rb @@ -62,12 +62,12 @@ module ContestsHelper content = ''.html_safe case state when 0 - content << content_tag('li', link_to(l(:label_sort_by_active), {controller: 'contests', action: 'index' ,:contest_sort_type => '1'})) - content << content_tag('li', link_to(l(:label_sort_by_time), {controller: 'contests', action: 'index' ,:contest_sort_type => '0'}, :class=>"selected"), :class=>"selected") + content << content_tag('li', link_to(l(:label_sort_by_time), {controller: 'contests', action: 'index' ,:contest_sort_type => '1'})) + content << content_tag('li', link_to(l(:label_sort_by_active), {controller: 'contests', action: 'index' ,:contest_sort_type => '0'}, :class=>"selected"), :class=>"selected") when 1 - content << content_tag('li', link_to(l(:label_sort_by_active), {controller: 'contests', action: 'index' ,:contest_sort_type => '1'}, :class=>"selected"), :class=>"selected") - content << content_tag('li', link_to(l(:label_sort_by_time), {controller: 'contests', action: 'index' ,:contest_sort_type => '0'})) + content << content_tag('li', link_to(l(:label_sort_by_time), {controller: 'contests', action: 'index' ,:contest_sort_type => '1'}, :class=>"selected"), :class=>"selected") + content << content_tag('li', link_to(l(:label_sort_by_active), {controller: 'contests', action: 'index' ,:contest_sort_type => '0'})) end content = content_tag('ul', content) content_tag('div', content, :class => "tabs") diff --git a/app/helpers/softapplications_helper.rb b/app/helpers/softapplications_helper.rb index e3cb6410d..fe78e9875 100644 --- a/app/helpers/softapplications_helper.rb +++ b/app/helpers/softapplications_helper.rb @@ -1,2 +1,18 @@ module SoftapplicationsHelper + def sort_softapplication(state) + content = ''.html_safe + case state + when 0 + content << content_tag('li', link_to(l(:label_sort_by_time), {controller: 'softapplications', action: 'index' ,:softapplication_sort_type => '1'})) + content << content_tag('li', link_to(l(:label_sort_by_active), {controller: 'softapplications', action: 'index' ,:softapplication_sort_type => '0'}, :class=>"selected"), :class=>"selected") + + when 1 + content << content_tag('li', link_to(l(:label_sort_by_time), {controller: 'softapplications', action: 'index' ,:softapplication_sort_type => '1'}, :class=>"selected"), :class=>"selected") + content << content_tag('li', link_to(l(:label_sort_by_active), {controller: 'softapplications', action: 'index' ,:softapplication_sort_type => '0'})) + end + content = content_tag('ul', content) + content_tag('div', content, :class => "tabs") + end end + + diff --git a/app/helpers/user_score_helper.rb b/app/helpers/user_score_helper.rb index 5b455a01b..43ee05db8 100644 --- a/app/helpers/user_score_helper.rb +++ b/app/helpers/user_score_helper.rb @@ -54,57 +54,111 @@ module UserScoreHelper watcher_count = Watcher.where("watchable_type = 'principal' AND watchable_id = ?", user.id).count end + + + def calculate_skill_count(user) - praise_count = 0 - tread_count = 0 + praise_count_l0 = 0 + praise_count_l1 = 0 + praise_count_l2 = 0 + tread_count_l0 = 0 + tread_count_l1 = 0 + tread_count_l2 = 0 issues = Issue.where('author_id = ?', user.id) issues.each do |i| - ptcs = PraiseTreadCache.where('object_id = ?', i.id) - ptcs.each do |p| - praise_count = praise_count + p.praise_num - tread_count = tread_count + p.tread_num + pts = PraiseTread.where('praise_tread_object_id = ?', i.id) + pts.each do |p| + templevel = calculate_level(User.find(p.user_id)) + + if templevel.to_i == 0 + if p.praise_or_tread == 1 + praise_count_l0 = praise_count_l0 + 1 + else + tread_count_l0 = tread_count_l0 + 1 + end + end + if templevel.to_i == 1 + if p.praise_or_tread == 1 + praise_count_l1 = praise_count_l1 + 1 + else + tread_count_l1 = tread_count_l1 + 1 + end + end + if templevel.to_i == 2 + if p.praise_or_tread == 1 + praise_count_l2 = praise_count_l2 + 1 + else + tread_count_l2 + tread_count_l2 + 1 + end + end end end + + + bids = Bid.where('author_id = ?', user.id) bids.each do |b| - ptcs = PraiseTreadCache.where('object_id = ?', b.id) + ptcs = PraiseTread.where('praise_tread_object_id = ?', b.id) ptcs.each do |p| - praise_count = praise_count + p.praise_num - tread_count = tread_count + p.tread_num + templevel = calculate_level(User.find(p.user_id)) + + if templevel.to_i == 0 + if p.praise_or_tread == 1 + praise_count_l0 = praise_count_l0 + 1 + else + tread_count_l0 = tread_count_l0 + 1 + end + end + if templevel.to_i == 1 + if p.praise_or_tread == 1 + praise_count_l1 = praise_count_l1 + 1 + else + tread_count_l1 = tread_count_l1 + 1 + end + end + if templevel.to_i == 2 + if p.praise_or_tread == 1 + praise_count_l2 = praise_count_l2 + 1 + else + tread_count_l2 + tread_count_l2 + 1 + end + end end end contests = Contest.where('author_id = ?', user.id) contests.each do |c| - ptcs = PraiseTreadCache.where('object_id = ?', c.id) + ptcs = PraiseTread.where('praise_tread_object_id = ?', c.id) ptcs.each do |p| - praise_count = praise_count + p.praise_num - tread_count = tread_count + p.tread_num + templevel = calculate_level(User.find(p.user_id)) + + if templevel.to_i == 0 + if p.praise_or_tread == 1 + praise_count_l0 = praise_count_l0 + 1 + else + tread_count_l0 = tread_count_l0 + 1 + end + end + if templevel.to_i == 1 + if p.praise_or_tread == 1 + praise_count_l1 = praise_count_l1 + 1 + else + tread_count_l1 = tread_count_l1 + 1 + end + end + if templevel.to_i == 2 + if p.praise_or_tread == 1 + praise_count_l2 = praise_count_l2 + 1 + else + tread_count_l2 + tread_count_l2 + 1 + end + end end end - level = calculate_level(user) - - skill_score = 0 - - if level == 0 - skill_score = praise_count - 0.5 * tread_count - end - if level == 1 - skill_score = 2 * praise_count - 1.5 * tread_count - end - if level == 2 - skill_socre = 3 * praise_count - 2.5 * tread_count - end - if level == 3 - skill_socre = 4 * praise_count - 3.5 * tread_count - end - if level == 4 - skill_socre = 5 * praise_count - 4.5 * tread_count - end # case level # when 0 skill_score = praise_count - 0.5 * tread_count @@ -114,12 +168,19 @@ module UserScoreHelper # when 4 skill_socre = 5 * praise_count - 4.5 * tread_count # end - + skill_score = 2 * praise_count_l0.to_f + 3 * praise_count_l1.to_f + 4 * praise_count_l2.to_f + - 1 * tread_count_l0.to_f - 1.5 * tread_count_l1.to_f - 2 * tread_count_l2.to_f tread_user_count = PraiseTread.where('praise_or_tread = ? AND user_id = ?', 0, user.id).count - skill_score = skill_score - 0.5 * tread_user_count - + skill_score = skill_score.to_f - tread_user_count.to_f + + + + + + + return skill_score @@ -135,7 +196,7 @@ module UserScoreHelper issues.each do |i| ptcs = PraiseTreadCache.where('object_id = ?', i.id) ptcs.each do |p| - if p.praise_num > max_praise_num + if p.praise_num.to_i > max_praise_num.to_i max_praise_num = p.praise_num end end @@ -145,7 +206,7 @@ module UserScoreHelper bids.each do |b| ptcs = PraiseTreadCache.where('object_id = ?', b.id) ptcs.each do |p| - if p.praise_num > max_praise_num + if p.praise_num.to_i > max_praise_num.to_i max_praise_num = p.praise_num end end @@ -155,7 +216,7 @@ module UserScoreHelper contests.each do |c| ptcs = PraiseTreadCache.where('object_id = ?', c.id) ptcs.each do |p| - if p.praise_num > max_praise_num + if p.praise_num.to_i > max_praise_num.to_i max_praise_num = p.praise_num end end diff --git a/app/views/contests/_contest_list.html.erb b/app/views/contests/_contest_list.html.erb index fb3ddd115..6ffac831e 100644 --- a/app/views/contests/_contest_list.html.erb +++ b/app/views/contests/_contest_list.html.erb @@ -13,7 +13,7 @@ diff --git a/app/views/contests/_list_softapplications.html.erb b/app/views/contests/_list_softapplications.html.erb index eb179718a..9b99b675c 100644 --- a/app/views/contests/_list_softapplications.html.erb +++ b/app/views/contests/_list_softapplications.html.erb @@ -14,7 +14,7 @@
diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb index 98befd091..7552b9941 100644 --- a/app/views/files/index.html.erb +++ b/app/views/files/index.html.erb @@ -1,4 +1,132 @@ + + <%=(@project.project_type == 1) ? t(:label_user_course) : t(:label_project) %>资源共享区 @@ -88,9 +216,7 @@
- <%= l(:label_contests_reward_method) %><%= contest.budget%> + <%= l(:label_contests_reward_method) %>:  <%= contest.budget%>
简介: - <%= c_softapplication.softapplication.description %> + <%= c_softapplication.softapplication.description.truncate(90, omission: '...') %>
<% @preTags = %w|预设A 预设B 预设C 预设D 预设E 预设Z | %> -
<%#需要交由浏览器异步刷新,或者一次连表查询,n+1 查询问题搞不定%> - <%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"}%> -
+ <%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"}%>
diff --git a/app/views/layouts/_base_footer.html.erb b/app/views/layouts/_base_footer.html.erb index 5ef65ed72..9df56ee2f 100644 --- a/app/views/layouts/_base_footer.html.erb +++ b/app/views/layouts/_base_footer.html.erb @@ -1,31 +1,31 @@
-
diff --git a/app/views/layouts/_base_softapplication_index_top_content.html.erb b/app/views/layouts/_base_softapplication_index_top_content.html.erb new file mode 100644 index 000000000..93b177b99 --- /dev/null +++ b/app/views/layouts/_base_softapplication_index_top_content.html.erb @@ -0,0 +1,22 @@ +
+ + + + + + + + + + + +
创新竞赛社区<%= l(:label_user_location) %> : + +
<%=link_to request.host()+"/softapplications", :controller=>'softapplications', :action=>'index' %><%=link_to l(:field_homepage), home_path %> > + <%=link_to l(:label_contest_softapplication), :controller=>'softapplications', :action=>'index' %> +
+
\ No newline at end of file diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index 341c050d7..58f684009 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -108,22 +108,23 @@ -

+

<% unless User.current.user_extensions.school.nil? %> - <%= l(:field_occupation) %> *<%= select_tag "province", options_from_collection_for_select(School.find_by_sql("select distinct province from schools"), :province, :province, User.current.user_extensions.school.province), :onclick => "get_options(this.value)" %> - - - - - + + <%= l(:field_occupation) %> * + + + + + - <% else %> - <%= l(:field_occupation) %> *<%= select_tag "province", options_from_collection_for_select(School.find_by_sql("select distinct province from schools"), :province, :province), :onclick => "get_options(this.value)" %> + + <%= l(:field_occupation) %> * + + + - - <% end %>

@@ -131,6 +132,18 @@

学校列表

+
+
    + <% @ss = School.find_by_sql("select distinct province from schools") %> + <% @ss.each do |s| %> +
  • + <%= s.province %> + +
  • + <% end %> +
+
+
    diff --git a/app/views/projects/_course.html.erb b/app/views/projects/_course.html.erb index 33d222145..d65df0530 100644 --- a/app/views/projects/_course.html.erb +++ b/app/views/projects/_course.html.erb @@ -52,7 +52,7 @@

    - <%= content_tag('span', link_to("#{@project_activity_count[@project.id]}", member_project_path(@project)), :class => "info") %> + <%= content_tag('span', link_to("#{@project_activity_count[@project.id]}", project_path(@project)), :class => "info") %> <%= content_tag('span', l(:label_x_activity, :count => @project_activity_count[@project.id])) %>

    diff --git a/app/views/school/index.html.erb b/app/views/school/index.html.erb index c9fca54aa..31bbc587f 100644 --- a/app/views/school/index.html.erb +++ b/app/views/school/index.html.erb @@ -1,4 +1,22 @@ <% port = ":3000" if Rails.env.development? %> + + + - -
    - + <%= image_tag(@logoLink, size:'75x75') %> - <% if params[:school_id].nil? and User.current.user_extensions.school.nil? %> - <%= image_tag '/images/transparent.png', size: "75x75" %> - <% else%> - <% if params[:school_id] == "0" %> - <%= image_tag '/images/transparent.png', size: "75x75" %> - <% else %> - <% if params[:school_id].nil? %> - <% if School.find(User.current.user_extensions.school.id).logo_link.nil? %> - <%= image_tag '/images/transparent.png', size: "75x75" %> +
    +
    +
    + <% if params[:school_id].nil? and User.current.user_extensions.school.nil? %> + <% else%> + <% if params[:school_id] == "0" %> + <% else %> + <% if params[:school_id].nil? %> + <%= School.find(User.current.user_extensions.school.id).name %> +
    <% else %> - <%= image_tag(School.find(User.current.user_extensions.school.id).logo_link, size: "75x75") %> + <%= School.find(params[:school_id]).name %> +
    <% end %> -
    - <% else %> - <%= image_tag(School.find(params[:school_id]).logo_link, size: "75x75") %> -
    <% end %> - <% end %> - <% end %> -
    -
    - - - <% if params[:school_id].nil? and User.current.user_extensions.school.nil? %> - <% else%> - <% if params[:school_id] == "0" %> - <% else %> - <% if params[:school_id].nil? %> - - <%= School.find(User.current.user_extensions.school.id).name %> -
    - <% else %> - <%= School.find(params[:school_id]).name %> -
    - <% end %> - <% end %> - <% end %> -
    + <% end %> <%= l(:label_welcome_trustie) %><%= l(:label_welcome_trustie_course) %> <% if params[:school_id].nil? and User.current.user_extensions.school.nil? %> - , <%= l(:label_welcome_trustie_course_description) %> + , <%= l(:label_welcome_trustie_course_description) %> <% else %> <% if params[:school_id] == "0" %> - , <%= l(:label_welcome_trustie_course_description) %> + , <%= l(:label_welcome_trustie_course_description) %> <% end %> <% end %> -
    - -
    +
    + +
@@ -201,31 +101,6 @@
-

问题和反馈动态 diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index 7a241981a..e41260de1 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -1,22 +1,11 @@ <%= stylesheet_link_tag 'welcome' %> - - -
-
- - - - - - - - -






- -
-
- -
+

diff --git a/config/locales/zh.yml b/config/locales/zh.yml index f4b6fe0ce..15cd1dca4 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1425,7 +1425,7 @@ zh: label_has_praisers: 赞(%{count}) label_has_watchers: 关注(%{count}) label_has_fans: 粉丝(%{count}) - label_coursefile_sharingarea: 课程资源共享区 + label_coursefile_sharingarea: 课程文件共享专区 #modify by men label_x_has_fans: zero: 粉丝(%{count}) @@ -1547,7 +1547,6 @@ zh: label_sort_by_time: 按时间排序 label_sort_by_active: 按活跃度排序 label_sort_by_influence: 按影响力排序 - label_sort_by_activity: 按动态数排序 label_bids_published: 发布于 label_bids_published_ago: 之前 label_welcome_trustie: Trustie @@ -1668,7 +1667,7 @@ zh: label_public_info: (打钩为公开,不打钩则不公开,若不公开,仅项目成员可见该项目。) label_course_view_student: 查看其他课程 label_course_student: 学生 - label_homework: 课程实践 + label_homework: 课程作业 label_course_file: 资源库 #资料共享 label_stores_index: 资源搜索 label_course_new_homework: 新建作业 @@ -1716,11 +1715,6 @@ zh: zero: 份资料 one: 份资料 other: 份资料 -#added by gcm - label_x_activity: - zero: 个动态 - one: 个动态 - other: 个动态 @@ -1765,13 +1759,13 @@ zh: label_has_been: 已经被 label_course_userd_by: 个课程引用 - - label_school_all: 中国高校 - - role_of_course: 课程角色 label_student: 学生 + #added by Wen + label_school_all: 中国高校 + + label_project_grade: 项目得分 label_user_grade: 个人得分 label_user_for_project_grade: 个人得分 @@ -1829,8 +1823,7 @@ zh: label_sumbit_empty: 搜索内容不能为空 #add by linchun (竞赛相关) - label_upload_files: 上传资源 - label_relation_files: 关联已有资源 + label_upload_files: 上传文件 label_upload_softwarepackage: 上传软件包 label_upload_cuttingphoto: 上传截图 label_contests_reward_method: 奖励方式 @@ -1869,8 +1862,19 @@ zh: label_add_contest_succeed_fail: 添加失败,该应用已参赛. label_no_ftapplication: 暂无应用 label_edit_softapplication: 修改应用 + label_contest_delete: 删除竞赛 + label_softapplication_list: 应用列表 + + label_coursefile_sharingarea: 课程资源共享区 + label_sort_by_activity: 按动态数排序 + label_homework: 课程实践 + label_x_activity: + zero: 个动态 + one: 个动态 + other: 个动态 + label_school_all: 中国高校 + label_upload_files: 上传资源 + label_relation_files: 关联已有资源 label_contest_settings: 配置竞赛 label_contest_delete: 删除竞赛 - - - + \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 3c4510be9..cfbcbe746 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -581,6 +581,9 @@ RedmineApp::Application.routes.draw do #######confusing######## post 'school/get_options/:province', :to => 'school#get_options' get 'school/get_options/:province', :to => 'school#get_options' + + post 'school/get_province', :to => 'school#get_province' + get 'school/get_province', :to => 'school#get_province' post 'school/get_schoollist/:province', :to => 'school#get_schoollist' get 'school/get_schoollist/:province', :to => 'school#get_schoollist' @@ -588,6 +591,8 @@ RedmineApp::Application.routes.draw do post 'school/search_school/', :to => 'school#search_school' get 'school/search_school/', :to => 'school#search_school' + post 'school/upload', :to => 'school#upload' + ######added by nie match 'tags/show_projects_tags',:to => 'tags#show_projects_tags' ########### added by liuping diff --git a/db/migrate/20140428013546_change_default_logo_for_school.rb b/db/migrate/20140428013546_change_default_logo_for_school.rb new file mode 100644 index 000000000..e3abe0c18 --- /dev/null +++ b/db/migrate/20140428013546_change_default_logo_for_school.rb @@ -0,0 +1,15 @@ +class ChangeDefaultLogoForSchool < ActiveRecord::Migration + def up + execute <<-SQL + UPDATE schools SET logo_link = '/images/school/default.png' + WHERE id <> 117 + SQL + end + + def down + execute <<-SQL + UPDATE schools SET logo_link = '/images/transparent.png' + WHERE id <> 117 + SQL + end +end diff --git a/db/schema.rb b/db/schema.rb index 2f88265cd..fe23a1caa 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 => 20140424072458) do +ActiveRecord::Schema.define(:version => 20140428013546) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -23,15 +23,6 @@ ActiveRecord::Schema.define(:version => 20140424072458) do 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 "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 "attachments", :force => true do |t| t.integer "container_id" t.string "container_type", :limit => 30 @@ -71,20 +62,6 @@ ActiveRecord::Schema.define(:version => 20140424072458) do add_index "auth_sources", ["id", "type"], :name => "index_auth_sources_on_id_and_type" - create_table "bak_mentioned", :primary_key => "Id", :force => true do |t| - t.string "this_real_name", :limit => 1000 - t.integer "is_mentioned_in" - t.string "context", :limit => 2000 - end - - add_index "bak_mentioned", ["this_real_name", "is_mentioned_in"], :name => "name_mention", :length => {"this_real_name"=>900, "is_mentioned_in"=>nil} - add_index "bak_mentioned", ["this_real_name"], :name => "this_real_name" - add_index "bak_mentioned", ["this_real_name"], :name => "this_real_name_2" - add_index "bak_mentioned", ["this_real_name"], :name => "this_real_name_3", :length => {"this_real_name"=>900} - add_index "bak_mentioned", ["this_real_name"], :name => "this_real_name_4" - add_index "bak_mentioned", ["this_real_name"], :name => "this_real_name_5" - add_index "bak_mentioned", ["this_real_name"], :name => "this_real_name_6" - create_table "biding_projects", :force => true do |t| t.integer "project_id" t.integer "bid_id" @@ -124,11 +101,6 @@ ActiveRecord::Schema.define(:version => 20140424072458) do add_index "boards", ["last_message_id"], :name => "index_boards_on_last_message_id" add_index "boards", ["project_id"], :name => "boards_project_id" - create_table "categories", :primary_key => "Id", :force => true do |t| - t.integer "proj_id", :default => 0, :null => false - t.text "proj_categories" - end - create_table "changes", :force => true do |t| t.integer "changeset_id", :null => false t.string "action", :limit => 1, :default => "", :null => false @@ -293,14 +265,6 @@ ActiveRecord::Schema.define(:version => 20140424072458) do add_index "documents", ["created_on"], :name => "index_documents_on_created_on" add_index "documents", ["project_id"], :name => "documents_project_id" - create_table "eco_projects", :force => true do |t| - t.integer "proj_id", :default => 0, :null => false - t.integer "eco_proj_id" - t.datetime "date_collected" - end - - add_index "eco_projects", ["proj_id"], :name => "proj_id" - create_table "enabled_modules", :force => true do |t| t.integer "project_id" t.string "name", :null => false @@ -322,137 +286,6 @@ ActiveRecord::Schema.define(:version => 20140424072458) 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 "events", :primary_key => "event_id", :force => true do |t| - t.string "job_name" - t.datetime "event_time" - t.string "event_type", :limit => 20 - end - - create_table "fm_article", :force => true do |t| - t.integer "proj_id", :default => 0, :null => false - t.text "article_title", :limit => 16777215 - t.text "article_link", :limit => 16777215 - t.text "article_time", :limit => 16777215 - t.datetime "date_collected" - end - - add_index "fm_article", ["proj_id"], :name => "proj_id" - - create_table "fm_bugtracker_link", :force => true do |t| - t.integer "proj_id", :default => 0, :null => false - t.text "description", :limit => 16777215 - t.datetime "date_collected" - end - - add_index "fm_bugtracker_link", ["proj_id"], :name => "proj_id" - - create_table "fm_datametric_link", :force => true do |t| - t.integer "proj_id", :default => 0, :null => false - t.text "description", :limit => 16777215 - t.datetime "date_collected" - end - - add_index "fm_datametric_link", ["proj_id"], :name => "proj_id" - - create_table "fm_dependency_link", :force => true do |t| - t.integer "proj_id", :default => 0, :null => false - t.text "description", :limit => 16777215 - t.datetime "date_collected" - end - - add_index "fm_dependency_link", ["proj_id"], :name => "proj_id" - - create_table "fm_download_link", :force => true do |t| - t.integer "proj_id", :default => 0, :null => false - t.text "download_link", :limit => 16777215 - t.datetime "date_collected" - end - - add_index "fm_download_link", ["proj_id"], :name => "proj_id" - - create_table "fm_heartbeat", :force => true do |t| - t.integer "proj_id", :default => 0, :null => false - t.float "popularity_score", :limit => 12 - t.float "vitality_score", :limit => 12 - t.integer "subscription" - t.integer "voting_score" - t.integer "voting_count" - t.datetime "date_collected" - end - - add_index "fm_heartbeat", ["proj_id"], :name => "proj_id" - - create_table "fm_license", :force => true do |t| - t.integer "proj_id", :default => 0, :null => false - t.text "description", :limit => 16777215 - t.datetime "date_collected" - end - - add_index "fm_license", ["proj_id"], :name => "proj_id" - - create_table "fm_mailinglist_link", :force => true do |t| - t.integer "proj_id", :default => 0, :null => false - t.text "description", :limit => 16777215 - t.datetime "date_collected" - end - - add_index "fm_mailinglist_link", ["proj_id"], :name => "proj_id" - - create_table "fm_operating_system", :force => true do |t| - t.integer "proj_id", :default => 0, :null => false - t.text "description", :limit => 16777215 - t.datetime "date_collected" - end - - add_index "fm_operating_system", ["proj_id"], :name => "proj_id" - - create_table "fm_programming_language", :force => true do |t| - t.integer "proj_id", :default => 0, :null => false - t.text "description", :limit => 16777215 - t.datetime "date_collected" - end - - add_index "fm_programming_language", ["proj_id"], :name => "proj_id" - - create_table "fm_project_spotlight", :force => true do |t| - t.integer "proj_id", :default => 0, :null => false - t.text "description", :limit => 16777215 - t.text "project_name", :limit => 16777215 - t.text "project_spotlight_link", :limit => 16777215 - t.datetime "date_collected" - end - - add_index "fm_project_spotlight", ["proj_id"], :name => "proj_id" - - create_table "fm_release", :force => true do |t| - t.integer "proj_id", :default => 0, :null => false - t.text "description", :limit => 16777215 - t.text "release_version", :limit => 16777215 - t.text "release_time", :limit => 16777215 - t.text "release_tag", :limit => 16777215 - t.datetime "date_collected" - end - - add_index "fm_release", ["proj_id"], :name => "proj_id" - - create_table "fm_submit", :force => true do |t| - t.integer "proj_id", :default => 0, :null => false - t.text "submitter", :limit => 16777215 - t.text "submitter_link", :limit => 16777215 - t.text "submit_time", :limit => 16777215 - t.datetime "date_collected" - end - - add_index "fm_submit", ["proj_id"], :name => "proj_id" - - create_table "fm_summary", :force => true do |t| - t.integer "proj_id", :default => 0, :null => false - t.text "description", :limit => 16777215 - t.datetime "date_collected" - end - - add_index "fm_summary", ["proj_id"], :name => "proj_id" - create_table "forums", :force => true do |t| t.string "name", :null => false t.string "description", :default => "" @@ -685,22 +518,6 @@ ActiveRecord::Schema.define(:version => 20140424072458) do 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 "ohloh_tagged", :force => true do |t| - t.integer "proj_id", :default => 0, :null => false - t.string "description", :limit => 100, :null => false - t.datetime "date_collected" - end - - add_index "ohloh_tagged", ["proj_id"], :name => "proj_id" - create_table "open_id_authentication_associations", :force => true do |t| t.integer "issued" t.integer "lifetime" @@ -716,19 +533,6 @@ ActiveRecord::Schema.define(:version => 20140424072458) do 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 "praise_tread_caches", :force => true do |t| t.integer "object_id", :null => false t.string "object_type" @@ -808,23 +612,6 @@ ActiveRecord::Schema.define(:version => 20140424072458) do 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_memos", :force => true do |t| - t.integer "osp_id", :null => false - t.integer "parent_id" - t.string "subject", :null => false - t.text "content", :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 - end - create_table "repositories", :force => true do |t| t.integer "project_id", :default => 0, :null => false t.string "url", :default => "", :null => false @@ -983,22 +770,6 @@ ActiveRecord::Schema.define(:version => 20140424072458) do add_index "tokens", ["user_id"], :name => "index_tokens_on_user_id" add_index "tokens", ["value"], :name => "tokens_value", :unique => true - create_table "tprojects", :force => true do |t| - t.string "name", :limit => 1000, :default => "0" - t.text "description", :limit => 16777215 - t.string "commit_count", :limit => 100, :default => "0" - t.string "code_line", :limit => 100 - t.string "last_commit_time", :limit => 100 - t.string "url", :limit => 1000 - t.datetime "date_collected" - t.string "created_at", :limit => 100 - t.string "updated_at", :limit => 100 - t.integer "proj_id", :null => false - t.string "user_count", :limit => 100 - end - - add_index "tprojects", ["proj_id"], :name => "proj_id" - create_table "trackers", :force => true do |t| t.string "name", :limit => 30, :default => "", :null => false t.boolean "is_in_chlog", :default => false, :null => false diff --git a/public/images/school/default.png b/public/images/school/default.png new file mode 100644 index 000000000..a6475f70d Binary files /dev/null and b/public/images/school/default.png differ diff --git a/public/javascripts/welcome.js b/public/javascripts/welcome.js new file mode 100644 index 000000000..a0166bb3f --- /dev/null +++ b/public/javascripts/welcome.js @@ -0,0 +1,64 @@ +(function () { + window.onload = function(){ + function fixedBar(id, options){ + var ele = document.getElementById(id); + if(!ele) return; + if(/msie (\d+\.\d+)/i.test(navigator.userAgent)){ + var pageHeight=window.innerHeight; + var d=document; + if(typeof pageHeight!="number"){ + if(document.compatMode=="CSS1Compat"){ + pageHeight=document.documentElement.clientHeight; + }else{ + pageHeight=document.body.clientHeight; + } + } + var ieScrollTop=window.pageYOffset || d.documentElement.scrollTop || d.body.scrollTop; + if(options.addclass) ele.className = options.addclass; + ele.style.position= 'absolute'; + + if(options.show){ + ele.style.top = 0 + "px"; + ele.style.display= 'block'; + } + + window.attachEvent('onscroll' , function (){ + + var ieScrollTop=window.pageYOffset || d.documentElement.scrollTop || d.body.scrollTop; + + ele.style.top = 0 + "px"; + if(options.autoHidden){ + if(ieScrollTop==0){ + ele.style.display="none"; + }else{ + ele.style.display="block"; + } + } + }); + }else{ + var ele = document.getElementById(id); + if(typeof pageHeight!="number"){ + if(document.compatMode=="CSS1Compat"){ + pageHeight=document.documentElement.clientHeight; + }else{ + pageHeight=document.body.clientHeight; + } + } + if(options.show) ele.style.display= 'block'; + ele.style.top = 0 +'px'; + window.addEventListener('scroll',function (){ + if(options.autoHidden){ + if(baidu.page.getScrollTop()==0){ + ele.style.display="none"; + }else{ + ele.style.display="block"; + } + } + },false); + } + } + + fixedBar('backTopBtn' , {autoHidden: true, top : 186}); + fixedBar('identifier-pannel' , {autoHidden: false , top : 956 , show : true}); + } +})(); \ No newline at end of file diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 36a8a61ca..5425f1826 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -624,7 +624,7 @@ ul.tool li{list-style-type:none; font-family: Tahoma,"Microsoft YaHei"; font-weight: bold; font-size: 20px; - color:#FF9900; + color:#e8770d; } .font_welcome_Cdescription{ diff --git a/public/stylesheets/nyan.css b/public/stylesheets/nyan.css index 6ac1966a4..85751a088 100644 --- a/public/stylesheets/nyan.css +++ b/public/stylesheets/nyan.css @@ -235,7 +235,7 @@ body { top: 200px; } #WOpenWindow .school_list{ - width:1000px; + width: 900px; line-height: 20px; } @@ -257,6 +257,12 @@ body { } #WOpenWindow .content{ width: 1000px; + height: 220px; + overflow: scroll; +} + +#WOpenWindow .pcontent{ + } diff --git a/public/themes/redpenny-master/stylesheets/application.css b/public/themes/redpenny-master/stylesheets/application.css index 306d6d113..b73123590 100644 --- a/public/themes/redpenny-master/stylesheets/application.css +++ b/public/themes/redpenny-master/stylesheets/application.css @@ -2247,130 +2247,4 @@ ul.messages-for-user-reply li { .footer_text_link{ margin: 0px 5px; } -/*gcm*/ - -#ver-zebra, .file_table_des -{ - font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif; - font-size: 12px; - margin: 5px 10px; - width: 98%; - text-align: left; - border-collapse: collapse; - line-height: 20px; - font-size: 14px; -} -#ver-zebra th -{ - font-size: 14px; - font-weight: normal; - padding: 12px 15px; - border-right: 1px solid #fff; - border-left: 1px solid #fff; - color: #039; - text-align: left; -} -#ver-zebra td -{ - padding: 8px 15px; - border-right: 1px solid #fff; - border-left: 1px solid #fff; - color: #669; -} -#ver-zebra td.description { - background-color: white; - padding: 0px; - margin: 0px auto; -} -div.tags_area { - padding: 2px 10px 10px 10px; - margin: 0px; - margin-bottom: 10px; - /*border-bottom: 1px dashed #CCCCCC;*/ - overflow: hidden; - position: relative; -} -.tags_gradint { -} -.read-more{ - padding: 5px; - border-top: 4px double #ddd; - background: #fff; - color: #333; -} -.read-more a{ - padding-right: 22px; - background: url() no-repeat 100% 50%; - font-weight: bold; - text-decoration: none; -} -.read-more a:hover{ - color: #000; -} -.vzebra-odd -{ - background: #eff2ff; -} -.vzebra-even -{ - background: #e8edff; -} -#ver-zebra #vzebra-adventure, #ver-zebra #vzebra-children -{ - background: #ffffff; - border-bottom: 1px solid #c8d4fd; -} -#ver-zebra #vzebra-comedy, #ver-zebra #vzebra-action -{ - background: #ffffff; - border-bottom: 1px solid #d6dfff; -} -.filename{ - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; -} -div.pagination{ - margin: 10px 0px; - height: 1.5em; - text-align: left; - font-size: 13px; -} -.m5p5{ - display: inline-block; - height: auto; - color: white !important; - margin: 8px; - padding: 3px 7px; -} -.m5p5:hover { - text-decoration: none; - /*padding-bottom: 3px;*/ - /*border-bottom: 1px solid #666666;*/ - border-radius: 4px; - border: 1px solid #15bccf; - box-shadow: 3px 3px 3px #666666; -} -.relation_file_div{ - margin: 0px 25px; -} -.relation_file_div fieldset{ - margin: 0px 0px; - padding: 10px; - border-radius: 5px; - transition: all 2s linear 1s; -} -.relation_file_div input#attach_search:focus{ - border: 1px solid #1B95C6; - box-shadow: 0px 0px 4px #1B95C6; - width: 200px; -} -.relation_file_div input#attach_search{ - width: 150px; - outline: none; - border-radius: 5px; - -webkit-transition: 1s width; - -moz-transition : 1s width; - -o-transition : 1s width; - transition : 1s width; -} \ No newline at end of file +/*gcm*/ \ No newline at end of file