This commit is contained in:
z9hang 2014-05-13 19:24:58 +08:00
commit fcc5f220ce
27 changed files with 512 additions and 1175 deletions

View File

@ -0,0 +1,6 @@
#资源类型编辑control
class AttachmentTypeEditController < ApplicationController
def index
end
end

View File

@ -19,8 +19,8 @@ class FilesController < ApplicationController
layout 'base_projects'#by young layout 'base_projects'#by young
menu_item :files menu_item :files
before_filter :find_project_by_project_id before_filter :find_project_by_project_id#, :except => [:getattachtype]
before_filter :authorize before_filter :authorize, :except => [:getattachtype]
helper :sort helper :sort
include SortHelper include SortHelper
@ -62,7 +62,8 @@ class FilesController < ApplicationController
redirect_to project_files_path(@project) redirect_to project_files_path(@project)
end end
def showbyattachtype # 返回制定资源类型的资源列表
def getattachtype
sort_init 'created_on', 'desc' sort_init 'created_on', 'desc'
sort_update 'created_on' => "#{Attachment.table_name}.created_on", sort_update 'created_on' => "#{Attachment.table_name}.created_on",
'filename' => "#{Attachment.table_name}.filename", 'filename' => "#{Attachment.table_name}.filename",
@ -72,10 +73,11 @@ class FilesController < ApplicationController
@containers = [ Project.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@project.id)] #modify by Long Jun @containers = [ Project.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@project.id)] #modify by Long Jun
@containers += @project.versions.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").all.sort @containers += @project.versions.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").all.sort
if @project.project_type == 1 @attachtype = params[:type].to_i
render :layout => 'base_courses' @contenttype = params[:contentType].to_s
else
render :layout => !request.xhr? respond_to do |format|
format.js
end end
end end
end end

View File

@ -198,7 +198,7 @@ class ProjectsController < ApplicationController
@project_type = params[:project_type] @project_type = params[:project_type]
@school_id = params[:school_id] @school_id = params[:school_id]
per_page_option = 10 per_page_option = 10
if @school_id == "0" or @school.nil? if @school_id == "0" or @school_id.nil?
@projects_all = Project.active.visible. @projects_all = Project.active.visible.
joins("LEFT JOIN #{ProjectStatus.table_name} ON #{Project.table_name}.id = #{ProjectStatus.table_name}.project_id"). joins("LEFT JOIN #{ProjectStatus.table_name} ON #{Project.table_name}.id = #{ProjectStatus.table_name}.project_id").
where("#{Project.table_name}.project_type = ? ", Project::ProjectType_course) where("#{Project.table_name}.project_type = ? ", Project::ProjectType_course)

View File

@ -44,9 +44,22 @@ module FilesHelper
File.new(zipfile_name,'w+') File.new(zipfile_name,'w+')
end end
def browseByCategory # 判断指定的资源时候符合类型
isCategoryBrowser = 1 def isTypeOk(attachment, type, contentType)
#isCategoryBrowser result = false
if type != 0
if attachment.attachtype == type
result = true
end
else
result = true
end
if result
if contentType != l(:attachment_all) && contentType != attachment.suffix_type
result = false
end
end
result
end end

View File

@ -62,33 +62,33 @@ module ProjectsHelper
content_tag('div', content, :class => "tabs_enterprise") content_tag('div', content, :class => "tabs_enterprise")
end end
def sort_course(state, project_type) def sort_course(state, project_type, school_id)
content = ''.html_safe content = ''.html_safe
case state case state
when 0 when 0
content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type), :class=>"selected"), :class=>"selected") content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type), :school_id => school_id, :class=>"selected"), :class=>"selected")
content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type))) content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type, :school_id => school_id)))
# content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type))) # content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type)))
content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type))) content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type, :school_id => school_id)))
when 1 when 1
content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type))) content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type, :school_id => school_id)))
content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type), :class=>"selected"), :class=>"selected") content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type, :school_id => school_id), :class=>"selected"), :class=>"selected")
# content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type))) # content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type)))
content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type))) content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type, :school_id => school_id)))
when 2 when 2
content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type))) content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type, :school_id => school_id)))
content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type))) content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type, :school_id => school_id)))
# content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type), :class=>"selected"), :class=>"selected") # content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type), :class=>"selected"), :class=>"selected")
content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type))) content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type, :school_id => school_id)))
#gcm #gcm
when 3 when 3
content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type))) content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type, :school_id => school_id)))
content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type))) content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type, :school_id => school_id)))
# content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type))) # content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type)))
content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type), :class=>"selected"), :class=>"selected") content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type, :school_id => school_id), :class=>"selected"), :class=>"selected")
end end
#gcmend #gcmend

View File

@ -154,6 +154,12 @@ module WelcomeHelper
sort_course_by_hot limit sort_course_by_hot limit
end end
def find_all_new_hot_course limit = 9
#sort_project_by_hot_rails 1, 'course_ac_para DESC', limit
time_now = Time.new.strftime("%Y");
Project.visible.joins(:project_status).where("#{Project.table_name}.project_type = ? and #{Project.table_name}.created_on like '%#{time_now}%'", 1).order("course_ac_para DESC").limit(limit).all
end
def find_all_hot_bid def find_all_hot_bid
sort_bid_by_hot sort_bid_by_hot
end end

View File

@ -66,6 +66,30 @@ class Attachment < ActiveRecord::Base
copy copy
end end
#获取资源的后缀类型
def suffix_type
childArr = self.filename.split('.')
suffix = '*'
if childArr.length > 1
suffix = childArr[childArr.length-1]
end
suffix
end
#获取用来显示的后缀名称
def show_suffix_type
suffix = 'other'
temp = self.suffix_type.downcase
if self.attachmentstype.suffixArr.include?(temp)
suffix = temp
end
suffix
end
def suffixArr
@@SuffixArr
end
def validate_max_file_size def validate_max_file_size
if @temp_file && self.filesize > Setting.attachment_max_size.to_i.kilobytes if @temp_file && self.filesize > Setting.attachment_max_size.to_i.kilobytes
errors.add(:base, l(:error_attachment_too_big, :max_size => Setting.attachment_max_size.to_i.kilobytes)) errors.add(:base, l(:error_attachment_too_big, :max_size => Setting.attachment_max_size.to_i.kilobytes))

View File

@ -1,4 +1,11 @@
class Attachmentstype < ActiveRecord::Base class Attachmentstype < ActiveRecord::Base
attr_accessible :typeId, :typeName attr_accessible :typeId, :typeName
has_many :attachments, :foreign_key => "attachtype",:primary_key => "id" has_many :attachments, :foreign_key => "attachtype",:primary_key => "id"
# 当前使用的文件内容分类列表
@@SuffixArr = ['pdf','zip','doc','docx','rar','txt','jpg','bmp','xls','xlsx']
def suffixArr
@@SuffixArr
end
end end

View File

@ -63,7 +63,7 @@ class Mailer < ActionMailer::Base
# Mailer.issue_add(issue).deliver => sends an email to issue recipients # Mailer.issue_add(issue).deliver => sends an email to issue recipients
def issue_add(issue) def issue_add(issue)
redmine_headers 'Project' => issue.project.identifier, redmine_headers 'Project' => issue.project.identifier,
'Issue-Id' => issue.id, 'Issue-Id' => (issue.project.issues.index(issue).to_i + 1).to_s,
'Issue-Author' => issue.author.login 'Issue-Author' => issue.author.login
redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to
message_id issue message_id issue
@ -85,7 +85,7 @@ class Mailer < ActionMailer::Base
def issue_edit(journal) def issue_edit(journal)
issue = journal.journalized.reload issue = journal.journalized.reload
redmine_headers 'Project' => issue.project.identifier, redmine_headers 'Project' => issue.project.identifier,
'Issue-Id' => issue.id, 'Issue-Id' => (issue.project.issues.index(issue).to_i + 1).to_s,
'Issue-Author' => issue.author.login 'Issue-Author' => issue.author.login
redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to
message_id journal message_id journal

View File

@ -164,6 +164,14 @@ class Project < ActiveRecord::Base
@attachmenttypes = Attachmentstype.find(:all, :conditions => ["#{Attachmentstype.table_name}.typeId= ?",self.attachmenttype ]) @attachmenttypes = Attachmentstype.find(:all, :conditions => ["#{Attachmentstype.table_name}.typeId= ?",self.attachmenttype ])
end end
# 获取资源后缀名列表
def contenttypes
attachmenttypes
if @attachmenttypes.length >0
@attachmenttypes.last().suffixArr
end
end
#自定义验证 #自定义验证
def validation def validation
if !class_period.match([0-9]) if !class_period.match([0-9])

View File

@ -13,7 +13,7 @@
<% if attachmenttypes.any? %> <% if attachmenttypes.any? %>
<p> <label for="attachment_type"><%=l(:attachment_type)%></label> <p> <label for="attachment_type"><%=l(:attachment_type)%></label>
<%= select_tag "attachment_type", content_tag('option', '') + <%= select_tag "attachment_type",
options_from_collection_for_select(attachmenttypes, "id", options_from_collection_for_select(attachmenttypes, "id",
"typeName") %> "typeName") %>
</p> </p>

View File

@ -0,0 +1,64 @@
<% delete_allowed = User.current.allowed_to?(:manage_files, @project) %>
<% edit_allowed = User.current.allowed_to?(:manage_files, @project) %>
<ul id="all_browse_ul">
<table class="list files" id="ver-zebra" >
<colgroup>
<col class="vzebra-odd" />
<col class="vzebra-even" />
<col class="vzebra-odd" />
<col class="vzebra-even" />
<col class="vzebra-odd" />
</colgroup>
<thead><tr>
<%= sort_header_tag('filename', :caption => l(:field_filename), :scope =>"col" , :id => "vzebra-adventure")%>
<%= 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")%>
<%= sort_header_tag('attach_type', :caption => l(:attachment_browse), :default_order => 'desc', :scope =>"col", :id=> "vzebra-attachmenttype")%>
<%= sort_header_tag('content_type', :caption => l(:attachment_sufix_browse), :default_order => 'desc', :scope =>"col", :id=> "vzebra-contenttype")%>
<%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope =>"col", :id => "vzebra-action") %>
<%= sort_header_tag('operation', :caption => "", :scope =>"col", :id => "vzebra-children") %>
<!-- <%= sort_header_tag('description', :caption => l(:field_description)) %> -->
</tr></thead>
<tbody>
<% @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;") %>
</th>
</tr>
<% end -%>
<% container.attachments.each do |file| %>
<tr class="file <%= cycle("odd", "odd") %>">
<td class="filename" style="font-size: 13px; width: 240px; "><%= 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"><%= file.attachmentstype.typeName %></td>
<td class="content_type"><%= file.show_suffix_type %></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="5">
<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 %>
<% end -%>
<!-- %= h downloadAll(@containers) % -->
<!-- %= link_to "download all file", (downloadAll(@containers)) % -->
</tbody>
</table>
</ul>

View File

@ -1,421 +0,0 @@
<!-- <h3> --><!-- %=l(:label_attachment_plural)%></h3 -->
<%isCategoryBrowser=true%>
<% selAttachType =1%>
<% attachmenttypes = @project.attachmenttypes %>
<style>
#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;
}
#ver-zebra1, .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-zebra1 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-zebra1 td
{
padding: 8px 15px;
border-right: 1px solid #fff;
border-left: 1px solid #fff;
color: #669;
}
#ver-zebra1 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: 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;
}
#ver-zebra1 #vzebra-adventure, #ver-zebra #vzebra-children
{
background: #ffffff;
border-bottom: 1px solid #c8d4fd;
}
#ver-zebra1 #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;
}
</style>
<span class="borad-title"><%=(@project.project_type == 1) ? t(:label_user_course) : t(:label_project) %>资源共享区</span>
<div class="content-title-top">
<%#= link_to(l(:label_attachment_new), 'javascript:void(0);', :onclick=>"$('#file_buttons').slideToggle();", :class => 'icon icon-add') if User.current.allowed_to?(:manage_files, @project) %>
<div class="clearfix"></div>
<div id="file_buttons" class="nhidden">
<%#= link_to('上传文件', new_project_file_path(@project), :class => 'icon m5p5 button_submit') if User.current.allowed_to?(:manage_files, @project) %>
<%= link_to( l(:label_upload_files), 'javascript:void(0);', :class => 'icon m5p5 button_submit', :onclick => "$('#relation_file_div').slideUp();$('#upload_file_div').slideToggle('slow');") if User.current.allowed_to?(:manage_files, @project) %>
<%= link_to(l(:label_relation_files), 'javascript:void(0);', :onclick => "$('#upload_file_div').slideUp();$('#relation_file_div').slideToggle();", :class => 'icon m5p5 button_submit') if User.current.allowed_to?(:manage_files, @project) %>
<% if attachmenttypes.any? %>
<label for="attachment_browse"><%=l(:attachment_browse)%></label>
<%= select_tag "attachment_browse", content_tag('option', '') +options_from_collection_for_select(attachmenttypes, "id", "typeName"),
:onchange=>"attachmenttypes_search(this.value)"%>
<% end %>
<div id="upload_file_div" class="relation_file_div hidden" >
<%= render :partial => 'new', locals: {project: @project}%>
</div>
<div id="relation_file_div" class="relation_file_div hidden" >
<fieldset>
<legend>搜索</legend>
<%= form_tag(
attachments_autocomplete_path(:format => 'js'),
:remote => true,
:method => :post) do %>
<%= label_tag(:attach_search, "按关键字搜索:") %>
<%= text_field_tag(:attach_search) %>
<%#= submit_tag("Search") %>
<% end -%>
<%= form_tag attach_relation_path(:format => 'js'),
method: :post,
remote: true,
id:"relation_file_form",
:class => 'hidden' do %>
<%= hidden_field_tag(:class_name, 'Project') %>
<%= hidden_field_tag(:class_id, params[:project_id]) %>
<div id="relation_file" >
</div>
<div class="kclearfix" style='margin-top: 10px;' >
<%= submit_tag(l(:button_add)) -%>
</div>
<% end -%>
</fieldset>
<div class="line_under" style="margin:20px 0px;"></div>
</div>
</div>
</div>
<%= javascript_tag "observeSearchfield('attach_search', null, '#{ escape_javascript attachments_autocomplete_path(:project_id => @project.id, :format => 'js') }')" %>
<% delete_allowed = User.current.allowed_to?(:manage_files, @project) %>
<%if !isCategoryBrowser%>
<div id="all_browse_div" class="all_browse_div" >
<ul id="all_browse_ul">
<table class="list files" id="ver-zebra" >
<colgroup>
<col class="vzebra-odd" />
<col class="vzebra-even" />
<col class="vzebra-odd" />
<col class="vzebra-even" />
<col class="vzebra-odd" />
</colgroup>
<thead><tr>
<%= sort_header_tag('filename', :caption => l(:field_filename), :scope =>"col" , :id => "vzebra-adventure")%>
<%= 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")%>
<%= sort_header_tag('attach_type', :caption => l(:attachment_type), :default_order => 'desc', :scope =>"col", :id=> "vzebra-attachmenttype")%>
<%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope =>"col", :id => "vzebra-action") %>
<%= sort_header_tag('operation', :caption => "", :scope =>"col", :id => "vzebra-children") %>
<!-- <%= sort_header_tag('description', :caption => l(:field_description)) %> -->
</tr></thead>
<tbody>
<% @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;") %>
</th>
</tr>
<% end -%>
<% container.attachments.each do |file| %>
<tr class="file <%= cycle("odd", "odd") %>">
<td class="filename" style="font-size: 13px; width: 240px; "><%= 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"><%= file.attachmentstype.typeName %></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="5">
<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 %>
<% end -%>
<!-- %= h downloadAll(@containers) % -->
<!-- %= link_to "download all file", (downloadAll(@containers)) % -->
</tbody>
</table>
</ul>
</div>
<%else%>
<div id="catarory_browse_div" class="catarory_browse_div" >
<ul id="catarory_browse_ul">
<table class="list files" id="ver-zebra1" >
<colgroup>
<col class="vzebra-odd" />
<col class="vzebra-even" />
<col class="vzebra-odd" />
<col class="vzebra-even" />
<col class="vzebra-odd" />
</colgroup>
<thead><tr>
<%= sort_header_tag('filename', :caption => l(:field_filename), :scope =>"col" , :id => "vzebra-adventure")%>
<%= 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")%>
<%= sort_header_tag('attach_type', :caption => l(:attachment_type), :default_order => 'desc', :scope =>"col", :id=> "vzebra-attachmenttype")%>
<%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope =>"col", :id => "vzebra-action") %>
<%= sort_header_tag('operation', :caption => "", :scope =>"col", :id => "vzebra-children") %>
<!-- <%= sort_header_tag('description', :caption => l(:field_description)) %> -->
</tr></thead>
<tbody>
<% @containers.each do |container| %>
<% next if container.attachments.empty? -%>
<% container.attachments.each do |file| %>
<% if file.attachtype==selAttachType%>
<tr class="file <%= cycle("odd", "odd") %>">
<td class="filename" style="font-size: 13px; width: 240px; "><%= 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"><%= file.attachmentstype.typeName %></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="5">
<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>
</ul>
</div>
<%end%>
<% html_title(l(:label_attachment_plural)) -%>
<script type='text/javascript'>
var slideHeight = 29;
function readmore (aNode) {
// console.log(aNode)
// var $td_tags_area = $(aNode).parent().parent();
var $td_tags_area = $(aNode).parent().parent().parent().parent();
var $tags_area = $td_tags_area.find('.tags_area')
var $tags_gradint = $td_tags_area.find('.tags_gradint')
var $read_more = $td_tags_area.find('.read-more')
var $read_more_a = $td_tags_area.find('.read-more a')
var $tags = $td_tags_area.find('#tags')
var $icona = $td_tags_area.find('.tags_icona')
var slideHeight = 20; //px
var defHeight = $tags.height();
var curHeight = $tags_area.height();
if (curHeight == slideHeight) {
$tags_area.animate({
height: defHeight
}, 'normal');
$read_more_a.html('隐藏');
$icona.html('<%=image_tag "/images/sidebar/minus.png"%>')
$tags_gradint.fadeOut();
}else{
$tags_area.animate({
height: slideHeight
}, 'normal');
$read_more_a.html('更多');
$icona.html('<%=image_tag "/images/sidebar/add.png"%>')
$tags_gradint.fadeIn();
};
}
$(function () {
var slideHeight = 20; //px
var defHeight = $('.tags_area').height();
if (defHeight >= slideHeight) {
$('.tags_area').css('height', slideHeight +'px');
};
});
</script>
<%inited=false%>
<script type="text/javascript">
function attachmenttypes_search(value){
$.ajax({
<%if inited%>
<% @isCategoryBrowser=!isCategoryBrowser%>
<%@selAttachType=value%>
<%= render :partial => 'index', locals: {isCategoryBrowser:@isCategoryBrowser,selAttachType:@selAttachType} %>
<%end%>
<%inited = true%>
/*type :"POST",
url :'/files/showbyattachtype/'+encodeURIComponent(value),
data :'text',
success: function(data){
$('#catarory_browse_div').slideUp();
$('#all_browse_div').slideToggle();
$("#").html(data);
} */
}
)
}
</script>

View File

@ -0,0 +1,66 @@
<% selAttachType =@attachtype %>
<% selContentType =@contenttype %>
<% delete_allowed = User.current.allowed_to?(:manage_files, @project) %>
<% edit_allowed = User.current.allowed_to?(:manage_files, @project) %>
<div id="catarory_browse_div" class="catarory_browse_div">
<ul id="catarory_browse_ul">
<table class="list files" id="ver-zebra1">
<colgroup>
<col class="vzebra-odd"/>
<col class="vzebra-even"/>
<col class="vzebra-odd"/>
<col class="vzebra-even"/>
<col class="vzebra-odd"/>
</colgroup>
<thead>
<tr>
<%= sort_header_tag('filename', :caption => l(:field_filename), :scope => "col", :id => "vzebra-adventure") %>
<%= 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") %>
<%= sort_header_tag('attach_type', :caption => l(:attachment_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-attachmenttype") %>
<%= sort_header_tag('content_type', :caption => l(:attachment_sufix_browse), :default_order => 'desc', :scope =>"col", :id=> "vzebra-contenttype")%>
<%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope => "col", :id => "vzebra-action") %>
<%= sort_header_tag('operation', :caption => "", :scope => "col", :id => "vzebra-children") %>
<!-- <%= sort_header_tag('description', :caption => l(:field_description)) %> -->
</tr>
</thead>
<tbody>
<% @containers.each do |container| %>
<% next if container.attachments.empty? -%>
<% container.attachments.each do |file| %>
<% if isTypeOk(file,selAttachType,selContentType) %>
<tr class="file <%= cycle("odd", "odd") %>">
<td class="filename" style="font-size: 13px; width: 240px; "><%= 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"><%= file.attachmentstype.typeName %></td>
<td class="content_type"><%= file.show_suffix_type %></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="5">
<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>
</ul>
</div>

View File

@ -0,0 +1,5 @@
<% if @attachtype==0 && @contenttype==l(:attachment_all)%>
$("#all_browse_div").html('<%= j(render partial: "show_all_attachment")%>');
<%else%>
$("#all_browse_div").html('<%= j(render partial: "sort_by_attachtypel")%>');
<%end%>

View File

@ -1,7 +1,6 @@
<!-- <h3> --><!-- %=l(:label_attachment_plural)%></h3 --> <!-- <h3> --><!-- %=l(:label_attachment_plural)%></h3 -->
<%isCategoryBrowser=false%>
<% selAttachType =1%>
<% attachmenttypes = @project.attachmenttypes %> <% attachmenttypes = @project.attachmenttypes %>
<% sufixtypes = @project.contenttypes %>
<style> <style>
#ver-zebra, .file_table_des #ver-zebra, .file_table_des
{ {
@ -185,10 +184,17 @@
<%= link_to(l(:label_relation_files), 'javascript:void(0);', :onclick => "$('#upload_file_div').slideUp();$('#relation_file_div').slideToggle();", :class => 'icon m5p5 button_submit') if User.current.allowed_to?(:manage_files, @project) %> <%= link_to(l(:label_relation_files), 'javascript:void(0);', :onclick => "$('#upload_file_div').slideUp();$('#relation_file_div').slideToggle();", :class => 'icon m5p5 button_submit') if User.current.allowed_to?(:manage_files, @project) %>
<% if attachmenttypes.any? %> <% if attachmenttypes.any? %>
<label for="attachment_browse"><%=l(:attachment_browse)%></label> &nbsp; &nbsp; &nbsp;
<%= select_tag "attachment_browse", content_tag('option', '') +options_from_collection_for_select(attachmenttypes, "id", "typeName"), <label for="attachment_browse_label"><%=l(:attachment_browse)%></label>
:onchange=>"attachmenttypes_search(this.value)"%> <%= select_tag "attachment_browse", content_tag('option',l(:attachment_all)) +options_from_collection_for_select(attachmenttypes, "id", "typeName"),
:onchange=>"attachmenttypes_searchex(this.value)"%>
<% end %> <% end %>
<% if sufixtypes.any? %>
&nbsp;
<label for="attach_sufix_browse_label"><%=l(:attachment_sufix_browse)%></label>
<%= select_tag "attach_sufix_browse", content_tag('option', l(:attachment_all)) +options_for_select(sufixtypes),
:onchange=>"attachment_contenttypes_searchex(this.value)"%>
<% end %>
<div id="upload_file_div" class="relation_file_div hidden" > <div id="upload_file_div" class="relation_file_div hidden" >
<%= render :partial => 'new', locals: {project: @project}%> <%= render :partial => 'new', locals: {project: @project}%>
@ -200,8 +206,8 @@
attachments_autocomplete_path(:format => 'js'), attachments_autocomplete_path(:format => 'js'),
:remote => true, :remote => true,
:method => :post) do %> :method => :post) do %>
<%= label_tag(:attach_search, "按关键字搜索:") %> <%= label_tag(:atext_field_tagttach_search, "按关键字搜索:") %>
<%= text_field_tag(:attach_search) %> <%= (:attach_search) %>
<%#= submit_tag("Search") %> <%#= submit_tag("Search") %>
<% end -%> <% end -%>
<%= form_tag attach_relation_path(:format => 'js'), <%= form_tag attach_relation_path(:format => 'js'),
@ -228,128 +234,10 @@
<% delete_allowed = User.current.allowed_to?(:manage_files, @project) %> <% delete_allowed = User.current.allowed_to?(:manage_files, @project) %>
<%if !isCategoryBrowser%>
<div id="all_browse_div" class="all_browse_div" > <div id="all_browse_div" class="all_browse_div" >
<ul id="all_browse_ul"> <%= render :partial => 'show_all_attachment'%>
<table class="list files" id="ver-zebra" >
<colgroup>
<col class="vzebra-odd" />
<col class="vzebra-even" />
<col class="vzebra-odd" />
<col class="vzebra-even" />
<col class="vzebra-odd" />
</colgroup>
<thead><tr>
<%= sort_header_tag('filename', :caption => l(:field_filename), :scope =>"col" , :id => "vzebra-adventure")%>
<%= 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")%>
<%= sort_header_tag('attach_type', :caption => l(:attachment_type), :default_order => 'desc', :scope =>"col", :id=> "vzebra-attachmenttype")%>
<%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope =>"col", :id => "vzebra-action") %>
<%= sort_header_tag('operation', :caption => "", :scope =>"col", :id => "vzebra-children") %>
<!-- <%= sort_header_tag('description', :caption => l(:field_description)) %> -->
</tr></thead>
<tbody>
<% @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;") %>
</th>
</tr>
<% end -%>
<% container.attachments.each do |file| %>
<tr class="file <%= cycle("odd", "odd") %>">
<td class="filename" style="font-size: 13px; width: 240px; "><%= 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"><%= file.attachmentstype.typeName %></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="5">
<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 %>
<% end -%>
<!-- %= h downloadAll(@containers) % -->
<!-- %= link_to "download all file", (downloadAll(@containers)) % -->
</tbody>
</table>
</ul>
</div> </div>
<%else%>
<div id="catarory_browse_div" class="catarory_browse_div" >
<ul id="catarory_browse_ul">
<table class="list files" id="ver-zebra1" >
<colgroup>
<col class="vzebra-odd" />
<col class="vzebra-even" />
<col class="vzebra-odd" />
<col class="vzebra-even" />
<col class="vzebra-odd" />
</colgroup>
<thead><tr>
<%= sort_header_tag('filename', :caption => l(:field_filename), :scope =>"col" , :id => "vzebra-adventure")%>
<%= 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")%>
<%= sort_header_tag('attach_type', :caption => l(:attachment_type), :default_order => 'desc', :scope =>"col", :id=> "vzebra-attachmenttype")%>
<%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope =>"col", :id => "vzebra-action") %>
<%= sort_header_tag('operation', :caption => "", :scope =>"col", :id => "vzebra-children") %>
<!-- <%= sort_header_tag('description', :caption => l(:field_description)) %> -->
</tr></thead>
<tbody>
<% @containers.each do |container| %>
<% next if container.attachments.empty? -%>
<% container.attachments.each do |file| %>
<% if file.attachtype==selAttachType%>
<tr class="file <%= cycle("odd", "odd") %>">
<td class="filename" style="font-size: 13px; width: 240px; "><%= 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"><%= file.attachmentstype.typeName %></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="5">
<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>
</ul>
</div>
<%end%>
<% html_title(l(:label_attachment_plural)) -%> <% html_title(l(:label_attachment_plural)) -%>
<script type='text/javascript'> <script type='text/javascript'>
@ -396,18 +284,37 @@
</script> </script>
<%inited=false%>
<script type="text/javascript">
function attachmenttypes_search(value){
$.ajax({
<%if inited%>
<% @isCategoryBrowser=!isCategoryBrowser%>
<%@selAttachType=value%>
<%= render :partial => 'new', locals: {isCategoryBrowser:@isCategoryBrowser,selAttachType:@selAttachType} %>
<%end%>
<%inited = true%>
}
) <script type="text/javascript">
function attachmenttypes_searchex(value) {
$.ajax({
url: '<%=getattachtype_project_files_path(project_id: @project)%>' + '?type='
+ encodeURIComponent(value) + "&contentType=" + $('#attach_sufix_browse').val(),
type: "POST"
}).complete(function (xhr, textStatus) {
if (textStatus == 'success') {
eval(xhr.responseText);
} else if (textStatus == 'error') {
alert('error');
}
});
}
function attachment_contenttypes_searchex(value) {
$.ajax({
url: '<%=getattachtype_project_files_path(project_id: @project)%>' + '?type='
+ $('#attachment_browse').val() + "&contentType=" + encodeURIComponent(value),
type: "POST"
}).complete(function (xhr, textStatus) {
if (textStatus == 'success') {
eval(xhr.responseText);
} else if (textStatus == 'error') {
alert('error');
}
;
});
} }
</script> </script>

View File

@ -1,421 +0,0 @@
<!-- <h3> --><!-- %=l(:label_attachment_plural)%></h3 -->
<%isCategoryBrowser=false%>
<% selAttachType =1%>
<% attachmenttypes = @project.attachmenttypes %>
<style>
#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;
}
#ver-zebra1, .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-zebra1 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-zebra1 td
{
padding: 8px 15px;
border-right: 1px solid #fff;
border-left: 1px solid #fff;
color: #669;
}
#ver-zebra1 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: 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;
}
#ver-zebra1 #vzebra-adventure, #ver-zebra #vzebra-children
{
background: #ffffff;
border-bottom: 1px solid #c8d4fd;
}
#ver-zebra1 #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;
}
</style>
<span class="borad-title"><%=(@project.project_type == 1) ? t(:label_user_course) : t(:label_project) %>资源共享区</span>
<div class="content-title-top">
<%#= link_to(l(:label_attachment_new), 'javascript:void(0);', :onclick=>"$('#file_buttons').slideToggle();", :class => 'icon icon-add') if User.current.allowed_to?(:manage_files, @project) %>
<div class="clearfix"></div>
<div id="file_buttons" class="nhidden">
<%#= link_to('上传文件', new_project_file_path(@project), :class => 'icon m5p5 button_submit') if User.current.allowed_to?(:manage_files, @project) %>
<%= link_to( l(:label_upload_files), 'javascript:void(0);', :class => 'icon m5p5 button_submit', :onclick => "$('#relation_file_div').slideUp();$('#upload_file_div').slideToggle('slow');") if User.current.allowed_to?(:manage_files, @project) %>
<%= link_to(l(:label_relation_files), 'javascript:void(0);', :onclick => "$('#upload_file_div').slideUp();$('#relation_file_div').slideToggle();", :class => 'icon m5p5 button_submit') if User.current.allowed_to?(:manage_files, @project) %>
<% if attachmenttypes.any? %>
<label for="attachment_browse"><%=l(:attachment_browse)%></label>
<%= select_tag "attachment_browse", content_tag('option', '') +options_from_collection_for_select(attachmenttypes, "id", "typeName"),
:onchange=>"attachmenttypes_search(this.value)"%>
<% end %>
<div id="upload_file_div" class="relation_file_div hidden" >
<%= render :partial => 'new', locals: {project: @project}%>
</div>
<div id="relation_file_div" class="relation_file_div hidden" >
<fieldset>
<legend>搜索</legend>
<%= form_tag(
attachments_autocomplete_path(:format => 'js'),
:remote => true,
:method => :post) do %>
<%= label_tag(:attach_search, "按关键字搜索:") %>
<%= text_field_tag(:attach_search) %>
<%#= submit_tag("Search") %>
<% end -%>
<%= form_tag attach_relation_path(:format => 'js'),
method: :post,
remote: true,
id:"relation_file_form",
:class => 'hidden' do %>
<%= hidden_field_tag(:class_name, 'Project') %>
<%= hidden_field_tag(:class_id, params[:project_id]) %>
<div id="relation_file" >
</div>
<div class="kclearfix" style='margin-top: 10px;' >
<%= submit_tag(l(:button_add)) -%>
</div>
<% end -%>
</fieldset>
<div class="line_under" style="margin:20px 0px;"></div>
</div>
</div>
</div>
<%= javascript_tag "observeSearchfield('attach_search', null, '#{ escape_javascript attachments_autocomplete_path(:project_id => @project.id, :format => 'js') }')" %>
<% delete_allowed = User.current.allowed_to?(:manage_files, @project) %>
<%if !isCategoryBrowser%>
<div id="all_browse_div" class="all_browse_div" >
<ul id="all_browse_ul">
<table class="list files" id="ver-zebra" >
<colgroup>
<col class="vzebra-odd" />
<col class="vzebra-even" />
<col class="vzebra-odd" />
<col class="vzebra-even" />
<col class="vzebra-odd" />
</colgroup>
<thead><tr>
<%= sort_header_tag('filename', :caption => l(:field_filename), :scope =>"col" , :id => "vzebra-adventure")%>
<%= 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")%>
<%= sort_header_tag('attach_type', :caption => l(:attachment_type), :default_order => 'desc', :scope =>"col", :id=> "vzebra-attachmenttype")%>
<%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope =>"col", :id => "vzebra-action") %>
<%= sort_header_tag('operation', :caption => "", :scope =>"col", :id => "vzebra-children") %>
<!-- <%= sort_header_tag('description', :caption => l(:field_description)) %> -->
</tr></thead>
<tbody>
<% @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;") %>
</th>
</tr>
<% end -%>
<% container.attachments.each do |file| %>
<tr class="file <%= cycle("odd", "odd") %>">
<td class="filename" style="font-size: 13px; width: 240px; "><%= 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"><%= file.attachmentstype.typeName %></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="5">
<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 %>
<% end -%>
<!-- %= h downloadAll(@containers) % -->
<!-- %= link_to "download all file", (downloadAll(@containers)) % -->
</tbody>
</table>
</ul>
</div>
<%else%>
<div id="catarory_browse_div" class="catarory_browse_div" >
<ul id="catarory_browse_ul">
<table class="list files" id="ver-zebra1" >
<colgroup>
<col class="vzebra-odd" />
<col class="vzebra-even" />
<col class="vzebra-odd" />
<col class="vzebra-even" />
<col class="vzebra-odd" />
</colgroup>
<thead><tr>
<%= sort_header_tag('filename', :caption => l(:field_filename), :scope =>"col" , :id => "vzebra-adventure")%>
<%= 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")%>
<%= sort_header_tag('attach_type', :caption => l(:attachment_type), :default_order => 'desc', :scope =>"col", :id=> "vzebra-attachmenttype")%>
<%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope =>"col", :id => "vzebra-action") %>
<%= sort_header_tag('operation', :caption => "", :scope =>"col", :id => "vzebra-children") %>
<!-- <%= sort_header_tag('description', :caption => l(:field_description)) %> -->
</tr></thead>
<tbody>
<% @containers.each do |container| %>
<% next if container.attachments.empty? -%>
<% container.attachments.each do |file| %>
<% if file.attachtype==selAttachType%>
<tr class="file <%= cycle("odd", "odd") %>">
<td class="filename" style="font-size: 13px; width: 240px; "><%= 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"><%= file.attachmentstype.typeName %></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="5">
<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>
</ul>
</div>
<%end%>
<% html_title(l(:label_attachment_plural)) -%>
<script type='text/javascript'>
var slideHeight = 29;
function readmore (aNode) {
// console.log(aNode)
// var $td_tags_area = $(aNode).parent().parent();
var $td_tags_area = $(aNode).parent().parent().parent().parent();
var $tags_area = $td_tags_area.find('.tags_area')
var $tags_gradint = $td_tags_area.find('.tags_gradint')
var $read_more = $td_tags_area.find('.read-more')
var $read_more_a = $td_tags_area.find('.read-more a')
var $tags = $td_tags_area.find('#tags')
var $icona = $td_tags_area.find('.tags_icona')
var slideHeight = 20; //px
var defHeight = $tags.height();
var curHeight = $tags_area.height();
if (curHeight == slideHeight) {
$tags_area.animate({
height: defHeight
}, 'normal');
$read_more_a.html('隐藏');
$icona.html('<%=image_tag "/images/sidebar/minus.png"%>')
$tags_gradint.fadeOut();
}else{
$tags_area.animate({
height: slideHeight
}, 'normal');
$read_more_a.html('更多');
$icona.html('<%=image_tag "/images/sidebar/add.png"%>')
$tags_gradint.fadeIn();
};
}
$(function () {
var slideHeight = 20; //px
var defHeight = $('.tags_area').height();
if (defHeight >= slideHeight) {
$('.tags_area').css('height', slideHeight +'px');
};
});
</script>
<%inited=false%>
<script type="text/javascript">
function attachmenttypes_search(value){
$.ajax({
<%if inited%>
<% @isCategoryBrowser=!isCategoryBrowser%>
<%@selAttachType=value%>
<%= render :partial => 'index', locals: {isCategoryBrowser:@isCategoryBrowser,selAttachType:@selAttachType} %>
<%end%>
<%inited = true%>
/*type :"POST",
url :'/files/showbyattachtype/'+encodeURIComponent(value),
data :'text',
success: function(data){
$('#catarory_browse_div').slideUp();
$('#all_browse_div').slideToggle();
$("#").html(data);
} */
}
)
}
</script>

View File

@ -30,7 +30,7 @@
</table> </table>
<% end %> <% end %>
</div> </div>
<%= sort_course(@s_type, @project_type)%> <%= sort_course(@s_type, @project_type, @school_id)%>
<div id="projects-index"> <div id="projects-index">
<%= render_project_hierarchy(@projects)%> <%= render_project_hierarchy(@projects)%>

View File

@ -1,197 +1,204 @@
<%= stylesheet_link_tag 'welcome' %> <%= stylesheet_link_tag 'welcome' %>
<%= javascript_include_tag 'welcome' %> <%= javascript_include_tag 'welcome' %>
<script type="text/javascript" language="javascript" xmlns="http://www.w3.org/1999/html" <script type="text/javascript" language="javascript" xmlns="http://www.w3.org/1999/html"
xmlns="http://www.w3.org/1999/html"> xmlns="http://www.w3.org/1999/html" xmlns="http://www.w3.org/1999/html">
$(function(){ $(function(){
$("#main").find("a").attr("target", "_blank"); $("#main").find("a").attr("target", "_blank");
}); });
// 给主页用户弹新页面 // 给主页用户弹新页面
$(document).ready(function($) { $(document).ready(function($) {
$("#loggedas").find("a").attr("target", "_blank"); $("#loggedas").find("a").attr("target", "_blank");
//$("#content .tabs_new~ .pagination").find("a").removeAttr("target"); //$("#content .tabs_new~ .pagination").find("a").removeAttr("target");
}); });
</script> </script>
<div class='top_bar'> <div class='top_bar'>
<div id="identifier-pannel" style="display:none"> <div id="identifier-pannel" style="display:none">
<%= image_tag '/images/qrweixin.jpg', size: '150x150', alt: 'trustie', class: "weixin" %> <%= image_tag '/images/qrweixin.jpg', size: '150x150', alt: 'trustie', class: "weixin" %>
<div class="weixin-content">微信扫码</div> <div class="weixin-content">微信扫码</div>
</div> </div>
<div class="main-content-bar"> <div class="main-content-bar">
<div style="float: left"> <div style="float: left">
<%= image_tag(@logoLink, size:'75x75') %> <%= image_tag(@logoLink, size:'75x75') %>
</div> </div>
<div class="course welcome_left" > <div class="course welcome_left" >
<br /> <br />
<span class="font_welcome_school"> <% if params[:school_id].nil? and User.current.user_extensions.school.nil? %> <span class="font_welcome_school"> <% if params[:school_id].nil? and User.current.user_extensions.school.nil? %>
<% else%> <% else%>
<% if params[:school_id] == "0" %> <% if params[:school_id] == "0" %>
<% else %> <% else %>
<% if params[:school_id].nil? %> <% if params[:school_id].nil? %>
<%= link_to School.find(User.current.user_extensions.school.id).name, options={:action => 'course',:school_id => User.current.user_extensions.school.id}, html_options={:class => 'font_welcome_school',:method => 'get'}%> <%= link_to School.find(User.current.user_extensions.school.id).name, options={:action => 'course',:school_id => User.current.user_extensions.school.id}, html_options={:class => 'font_welcome_school',:method => 'get'}%>
<br /> <br />
<% else %> <% else %>
<%= link_to School.find(params[:school_id]).name ,options={:action => 'course',:school_id => params[:school_id]}, html_options={:class => 'font_welcome_school',:method => 'get'}%> <%= link_to School.find(params[:school_id]).name ,options={:action => 'course',:school_id => params[:school_id]}, html_options={:class => 'font_welcome_school',:method => 'get'}%>
<br /> <br />
<% end %> <% end %>
<% end %> <% end %>
<% end %> </span> <% end %> </span>
<span class="font_welcome_trustie"><%= l(:label_welcome_trustie) %><%= l(:label_welcome_trustie_course) %> </span> <span class="font_welcome_trustie"><%= l(:label_welcome_trustie) %><%= l(:label_welcome_trustie_course) %> </span>
<% if params[:school_id].nil? and User.current.user_extensions.school.nil? %> <% if params[:school_id].nil? and User.current.user_extensions.school.nil? %>
<span class="font_welcome_tdescription">, <%= l(:label_welcome_trustie_course_description) %></span> <span class="font_welcome_tdescription">, <%= l(:label_welcome_trustie_course_description) %></span>
<% else %> <% else %>
<% if params[:school_id] == "0" %> <% if params[:school_id] == "0" %>
<span class="font_welcome_tdescription">, <%= l(:label_welcome_trustie_course_description) %></span> <span class="font_welcome_tdescription">, <%= l(:label_welcome_trustie_course_description) %></span>
<% end %> <% end %>
<% end %> <% end %>
</div> </div>
<div class="search-bar"> <div class="search-bar">
<%= render :partial => "search_project", :locals => {:project_type => Project::ProjectType_course}%> <%= render :partial => "search_project", :locals => {:project_type => Project::ProjectType_course}%>
</div> </div>
<div style="clear: both;"></div> <div style="clear: both;"></div>
</div> </div>
</div> </div>
<div style="clear:both"></div> <div style="clear:both"></div>
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject"> <div id="J_Slide" class="d-p-index-box d-p-index-hotproject">
<h3><strong>新开课程</strong></h3> <h3><strong>新开课程</strong></h3>
<span><%= link_to "更多>>", {:controller => 'projects', :action => 'course', :project_type => 1, :school_id => params[:school_id]} %></span> <% if(find_miracle_course(10, 7,params[:school_id]).map.count == 0) %>
<div class="d-p-projectlist-box"> <span><%= link_to "更多>>", {:controller => 'projects', :action => 'course', :project_type => 1, :school_id => nil} %></span>
<ul class="d-p-projectlist"> <div class="d-p-projectlist-box">
<ul class="d-p-projectlist">
</ul> </ul>
<ul class="d-p-projectlist">
<ul class="d-p-projectlist"> <h1></h1>
<% if(find_miracle_course(10, 7,params[:school_id]).map.count == 0) %> <p id="errorExplanation">
<h1></h1> 该学校未开设任何课程,您可以查看其他学校课程
<p id="errorExplanation"> </p>
该学校未开设任何课程,您可以查看其他学校课程 <h1></h1>
</p> <% find_all_new_hot_course(9).map do |project| %>
<h1></h1> <li class='<%= cycle("odd", "even") %>' title=<%=project.description.to_s%>>
<% find_all_hot_course(9).map do |project| %> <div class='avatar'>
<li class='<%= cycle("odd", "even") %>' title=<%=project.description.to_s%>> <%= image_tag(get_course_avatar(project), :class => "avatar-4") %>
<div class='avatar'> </div>
<%= image_tag(get_course_avatar(project), :class => "avatar-4") %> <!-- 上左下右 -->
</div> <div class='desc_item' >
<!-- 上左下右 --> <span class=''>
<div class='desc_item text_nowrap' > <% course = Course.find_by_extra(project.identifier)%>
[<%= get_course_term project %>] <% if(course.school == nil) %>
<%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
(<%= link_to "#{studentCount(project)}人", project_member_path(project, :role => 2) ,:course =>'1' %>) <% else %>
<% files_count = (project.attachments.count.to_i+Version.joins(:project).where("projects.id=#{project.id}").count.to_i).to_s %> <%= course.school.name.try(:gsub, /(.+)$/, '\1:') %>
(<%=link_to "#{files_count}份", project_files_path(project) %>资料) <% end %>
</div> </span>
<div class='desc_item' > <span class='font_bolder'>
<span class=''> <%= link_to(course.try(:teacher).try(:name), user_path(course.teacher)) %>
<% course = Course.find_by_extra(project.identifier)%>
<% if(course.school == nil) %>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<% else %>
<%= course.school.name.try(:gsub, /(.+)$/, '\1:') %>
<% end %>
</span>
<span class='font_bolder'>
<%= link_to(course.try(:teacher).try(:name), user_path(course.teacher)) %>
<%#=course.try(:teacher).try(:name)%>
</span>
</div>
<!-- <div class='desc_item' style="">
<span class='font_lighter' title=<%#=project.description.to_s%>><%#=project.description.truncate(25, omission: '...')%></span>
</div> -->
<div class='join_course_link'>
<% if !course_endTime_timeout?(project)%>
<div >
<%= join_in_course(project, User.current)%>
</div>
<% end %>
</div>
</li>
<% end %>
<% else %>
<% find_miracle_course(10, 7,params[:school_id]).map do |project| %>
<li class='<%= cycle("odd", "even") %>' title=<%=project.description.to_s%>>
<div class='avatar'>
<%= image_tag(get_course_avatar(project), :class => "avatar-4") %>
</div>
<!-- 上左下右 -->
<div class='desc_item text_nowrap' >
[<%= get_course_term project %>]
<%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%>
(<%= link_to "#{studentCount(project)}人", project_member_path(project, :role => 2) ,:course =>'1' %>)
<% files_count = (project.attachments.count.to_i+Version.joins(:project).where("projects.id=#{project.id}").count.to_i).to_s %>
(<%=link_to "#{files_count}份", project_files_path(project) %>资料)
</div>
<div class='desc_item' >
<span class=''>
<% course = Course.find_by_extra(project.identifier) %>
<%= course.school.name.try(:gsub, /(.+)$/, '\1:') %>
</span>
<span class='font_bolder'>
<%= link_to(course.try(:teacher).try(:name), user_path(course.teacher)) %>
<%#=course.try(:teacher).try(:name)%> <%#=course.try(:teacher).try(:name)%>
</span> </span>
</div> </div>
<!-- <div class='desc_item' style=""> <div class='desc_item text_nowrap' style="width: 310px;">
<span class='font_lighter' title=<%#=project.description.to_s%>><%#=project.description.truncate(25, omission: '...')%></span> [<%= get_course_term project %>]
</div> --> <%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%>
<div class='join_course_link'> (<%= link_to "#{studentCount(project)}人", project_member_path(project, :role => 2) ,:course =>'1' %>)
<% if !course_endTime_timeout?(project)%> <% files_count = (project.attachments.count.to_i+Version.joins(:project).where("projects.id=#{project.id}").count.to_i).to_s %>
<div > (<%=link_to "#{files_count}份", project_files_path(project) %>资料)
<%= join_in_course(project, User.current)%> </div>
</div> <!-- <div class='desc_item' style="">
<% end %> <span class='font_lighter' title=<%#=project.description.to_s%>><%#=project.description.truncate(25, omission: '...')%></span>
</div> </div> -->
</li> <div>
<% end; reset_cycle %> <% if !course_endTime_timeout?(project)%>
<div >
<%= new_watcher_link(project, User.current)%>
</div>
<% end %>
</div>
</li>
<% end %> <% end %>
</ul> </ul>
</div> </div>
<% else %>
<span><%= link_to "更多>>", {:controller => 'projects', :action => 'course', :project_type => 1, :school_id => params[:school_id]} %></span>
<div class="d-p-projectlist-box">
<ul class="d-p-projectlist">
</ul>
<ul class="d-p-projectlist">
<% find_miracle_course(10, 7,params[:school_id]).map do |project| %>
<li class='<%= cycle("odd", "even") %>' title=<%=project.description.to_s%>>
<div class='avatar'>
<%= image_tag(get_course_avatar(project), :class => "avatar-4") %>
</div>
<!-- 上左下右 -->
<div class='desc_item' >
<span class=''>
<% course = Course.find_by_extra(project.identifier) %>
<%= course.school.name.try(:gsub, /(.+)$/, '\1:') %>
</span>
<span class='font_bolder'>
<%= link_to(course.try(:teacher).try(:name), user_path(course.teacher)) %>
<%#=course.try(:teacher).try(:name)%>
</span>
</div>
<div class='desc_item text_nowrap' style="width: 310px;">
[<%= get_course_term project %>]
<%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%>
(<%= link_to "#{studentCount(project)}人", project_member_path(project, :role => 2) ,:course =>'1' %>)
<% files_count = (project.attachments.count.to_i+Version.joins(:project).where("projects.id=#{project.id}").count.to_i).to_s %>
(<%=link_to "#{files_count}份", project_files_path(project) %>资料)
</div>
<!-- <div class='desc_item' style="">
<span class='font_lighter' title=<%#=project.description.to_s%>><%#=project.description.truncate(25, omission: '...')%></span>
</div> -->
<div class='join_course_link'>
<% if !course_endTime_timeout?(project)%>
<div >
<%= join_in_course(project, User.current)%>
</div>
<% end %>
</div>
</li>
<% end; reset_cycle %>
</ul>
</div>
<% end %>
</div> </div>
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject" style="float: right;"> <div id="J_Slide" class="d-p-index-box d-p-index-hotproject" style="float: right;">
<h3 style="padding-bottom:0px ;margin-left: 5px; color: #e8770d;"> <h3 style="padding-bottom:0px ;margin-left: 5px; color: #e8770d;">
<strong>问题和反馈动态</strong> <strong>问题和反馈动态</strong>
<%= link_to "我要提问" , newbie_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%> <%= link_to "我要提问" , newbie_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%>
<%= link_to "我要反馈" , suggestion_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%> <%= link_to "我要反馈" , suggestion_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%>
</h3> </h3>
<span style="margin-top: -20px;float: right; display: block;"><%= link_to "更多>>", forums_path %></span> <span style="margin-top: -20px;float: right; display: block;"><%= link_to "更多>>", forums_path %></span>
<div class="d-p-projectlist-box"> <div class="d-p-projectlist-box">
<ul class="d-p-projectlist"> <ul class="d-p-projectlist">
<% find_new_forum_topics(10).each do |topic|%> <% find_new_forum_topics(10).each do |topic|%>
<li class="message-brief-intro" style="min-height: 65px; line-height:2em; "> <li class="message-brief-intro" style="min-height: 65px; line-height:2em; ">
<div style="display: inline-block; width: 100%;"> <div style="display: inline-block; width: 100%;">
<span class="memo_activity" style="color:gray; display: inline-block; margin-bottom:6px; background: url('/images/list-icon.png') no-repeat scroll ;background-position: left center;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="memo_activity" style="color:gray; display: inline-block; margin-bottom:6px; background: url('/images/list-icon.png') no-repeat scroll ;background-position: left center;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<%= 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;" %> <%= 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;" %>
</span> </span>
<br> <br>
<span style="margin-left: 24px; color: rgb(172, 174, 177); white-space: nowrap; font-size:9pt !important;;"><%= l(:field_updated_on) %><%=time_tag_welcome(topic_last_time topic)%>前</span> <span style="margin-left: 24px; color: rgb(172, 174, 177); white-space: nowrap; font-size:9pt !important;;"><%= l(:field_updated_on) %><%=time_tag_welcome(topic_last_time topic)%>前</span>
<span style="margin-left: 8px; margin-bottom: 0px; color: rgb(172, 174, 177) !important; white-space: nowrap;"> <span style="margin-left: 8px; margin-bottom: 0px; color: rgb(172, 174, 177) !important; white-space: nowrap;">
由&nbsp;<%= link_to topic.author ? topic.author : 'Anonymous', user_path(topic.author_id), :style => "font-size: 9pt !important; color: rgb(17, 102, 173);" %>&nbsp;发表 由&nbsp;<%= link_to topic.author ? topic.author : 'Anonymous', user_path(topic.author_id), :style => "font-size: 9pt !important; color: rgb(17, 102, 173);" %>&nbsp;发表
</span> </span>
<span style="float: right; color: rgb(172, 174, 177); white-space: nowrap; font-size:9pt !important;;">回复(<%= link_to (topic.parent ? topic.parent.replies_count : topic.replies_count), topic.event_url %>)</span> <span style="float: right; color: rgb(172, 174, 177); white-space: nowrap; font-size:9pt !important;;">回复(<%= link_to (topic.parent ? topic.parent.replies_count : topic.replies_count), topic.event_url %>)</span>
</div> </div>
</li> </li>
<% end %> <% end %>
</ul> </ul>
</div> </div>
</div> </div>
<div class="clearfix"></div> <div class="clearfix"></div>
<div class="hidden" style="width:100%;"> <div class="hidden" style="width:100%;">
<div style="width:600px;margin:0px auto;margin-top:80px;"> <div style="width:600px;margin:0px auto;margin-top:80px;">
<table style="width:600px;font-size:15px; color: #e8770d;"> <table style="width:600px;font-size:15px; color: #e8770d;">
<tr> <tr>
<td><strong>当前网站状态</strong></td> <td><strong>当前网站状态</strong></td>
<td>活跃课程: <%=@courseCount%></td> <td>活跃课程: <%=@courseCount%></td>
<td>高校: 2个</td> <td>高校: 2个</td>
<td>教师: <%=@teacherCount%> 名</td> <td>教师: <%=@teacherCount%> 名</td>
<td>学生: <%=@studentCount%> 名<td> <td>学生: <%=@studentCount%> 名<td>
</tr> </tr>
</table> </table>
</div> </div>
</div> </div>

View File

@ -10,5 +10,6 @@ if Dir.glob(File.join(vendor_plugins_dir, "*")).any?
exit 1 exit 1
end end
# Initialize the rails application # Initialize the rails application
RedmineApp::Application.initialize! RedmineApp::Application.initialize!

View File

@ -132,8 +132,10 @@ en:
actionview_instancetag_blank_option: Please select actionview_instancetag_blank_option: Please select
attachment_browse: 'Attachment Browse' attachment_all: "All"
attachment_type: 'Attachment Type' attachment_browse: "Attachment Content Browse"
attachment_sufix_browse: "Attachment Type Browse"
attachment_type: "Attachment Type"
general_text_No: 'No' general_text_No: 'No'
general_text_Yes: 'Yes' general_text_Yes: 'Yes'
general_text_no: 'no' general_text_no: 'no'

View File

@ -140,7 +140,9 @@ zh:
actionview_instancetag_blank_option: 请选择 actionview_instancetag_blank_option: 请选择
attachment_browse: '分类浏览' attachment_all: "全部"
attachment_sufix_browse: "文件类型"
attachment_browse: "内容类型"
attachment_type: '资源分类' attachment_type: '资源分类'
general_text_No: '否' general_text_No: '否'
general_text_Yes: '是' general_text_Yes: '是'

View File

@ -19,7 +19,7 @@ RedmineApp::Application.routes.draw do
resources :no_uses resources :no_uses
delete 'no_uses', :to => 'no_uses#delete' delete 'no_uses', :to => 'no_uses#delete'
resources :apply_project_masters resources :apply_project_masters
delete 'apply_project_masters', :to => 'apply_project_masters#delete' delete 'apply_project_masters', :to => 'apply_project_masters#delete'
@ -299,7 +299,12 @@ RedmineApp::Application.routes.draw do
# issue form update # issue form update
match 'issues/update_form', :controller => 'issues', :action => 'update_form', :via => [:put, :post], :as => 'issue_form' match 'issues/update_form', :controller => 'issues', :action => 'update_form', :via => [:put, :post], :as => 'issue_form'
resources :files, :only => [:index, :new, :create,:showbyattachtype] resources :files, :only => [:index, :new, :create] do
collection do
match "getattachtype" , via: [:get, :post]
#match 'getattachtype/:attachtype', :to => 'files#getattachtype', via: [:get, :post]
end
end
resources :versions, :except => [:index, :show, :edit, :update, :destroy] do resources :versions, :except => [:index, :show, :edit, :update, :destroy] do
collection do collection do

View File

@ -4,6 +4,12 @@ class CreateAttachmentstypes < ActiveRecord::Migration
t.column :typeId, :integer, :null => false t.column :typeId, :integer, :null => false
t.column :typeName, :string, :limit =>50 t.column :typeName, :string, :limit =>50
end end
Attachmentstype.create(typeId:1,typeName:'源代码')
Attachmentstype.create(typeId:1,typeName:'课件')
Attachmentstype.create(typeId:1,typeName:'研究报告')
Attachmentstype.create(typeId:2,typeName:'源代码')
Attachmentstype.create(typeId:2,typeName:'课件')
Attachmentstype.create(typeId:2,typeName:'研究报告')
end end
def self.down def self.down

View File

@ -23,6 +23,15 @@ ActiveRecord::Schema.define(:version => 20140509020307) do
add_index "activities", ["user_id", "act_type"], :name => "index_activities_on_user_id_and_act_type" add_index "activities", ["user_id", "act_type"], :name => "index_activities_on_user_id_and_act_type"
add_index "activities", ["user_id"], :name => "index_activities_on_user_id" 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| create_table "attachments", :force => true do |t|
t.integer "container_id" t.integer "container_id"
t.string "container_type", :limit => 30 t.string "container_type", :limit => 30
@ -36,7 +45,7 @@ ActiveRecord::Schema.define(:version => 20140509020307) do
t.datetime "created_on" t.datetime "created_on"
t.string "description" t.string "description"
t.string "disk_directory" t.string "disk_directory"
t.integer "attachtype" t.integer "attachtype", :default => 1
end end
add_index "attachments", ["author_id"], :name => "index_attachments_on_author_id" add_index "attachments", ["author_id"], :name => "index_attachments_on_author_id"
@ -527,6 +536,14 @@ ActiveRecord::Schema.define(:version => 20140509020307) do
add_index "news", ["created_on"], :name => "index_news_on_created_on" add_index "news", ["created_on"], :name => "index_news_on_created_on"
add_index "news", ["project_id"], :name => "news_project_id" 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 "open_id_authentication_associations", :force => true do |t| create_table "open_id_authentication_associations", :force => true do |t|
t.integer "issued" t.integer "issued"
t.integer "lifetime" t.integer "lifetime"
@ -542,6 +559,19 @@ ActiveRecord::Schema.define(:version => 20140509020307) do
t.string "salt", :null => false t.string "salt", :null => false
end 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| create_table "praise_tread_caches", :force => true do |t|
t.integer "object_id", :null => false t.integer "object_id", :null => false
t.string "object_type" t.string "object_type"
@ -622,6 +652,24 @@ ActiveRecord::Schema.define(:version => 20140509020307) do
add_index "queries", ["project_id"], :name => "index_queries_on_project_id" add_index "queries", ["project_id"], :name => "index_queries_on_project_id"
add_index "queries", ["user_id"], :name => "index_queries_on_user_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
t.string "url"
end
create_table "repositories", :force => true do |t| create_table "repositories", :force => true do |t|
t.integer "project_id", :default => 0, :null => false t.integer "project_id", :default => 0, :null => false
t.string "url", :default => "", :null => false t.string "url", :default => "", :null => false