Merge branch 'ouyangxuhua' into szzh

This commit is contained in:
ouyangxuhua 2016-02-23 16:17:40 +08:00
commit e65c189913
44 changed files with 394 additions and 284 deletions

View File

@ -26,7 +26,7 @@ class FilesController < ApplicationController
before_filter :authorize, :except => [:create,:getattachtype,:quote_resource_show,:search,:searchone4reload,:search_project,:quote_resource_show_project,
:search_tag_attachment,:subfield_upload_file,:search_org_subfield_tag_attachment,
:search_tag_attachment,:quote_resource_show_org_subfield,:find_org_subfield_attache,
:search_files_in_subfield,:upload_files_menu]
:search_files_in_subfield,:upload_files_menu,:file_hidden,:republish_file]
helper :sort
include SortHelper
@ -96,6 +96,33 @@ class FilesController < ApplicationController
end
end
def file_hidden
@file = Attachment.find params[:id]
@course = Course.find params[:course_id]
respond_to do |format|
format.js
end
end
def republish_file
@file = Attachment.find params[:id]
@course = Course.find params[:course_id]
if params[:publish_time]
unless params[:publish_time] == ""
@file.publish_time = params[:publish_time]
end
end
if @file.publish_time > Date.today
@file.is_publish = 0
else
@file.is_publish = 1
end
@file.save
respond_to do |format|
format.js
end
end
def search_project
sort = ""
@sort = ""
@ -488,6 +515,23 @@ class FilesController < ApplicationController
if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added')
Mailer.run.attachments_added(attachments[:files])
end
if !attachments.empty? && attachments[:files]
attachments[:files].each do |attachment|
if params[:publish_time]
if params[:publish_time] == ""
attachment.publish_time = Date.today
else
attachment.publish_time = params[:publish_time]
end
else
attachment.publish_time = Date.today
end
if attachment.publish_time > Date.today
attachment.is_publish = 0
end
attachment.save
end
end
if params[:course_attachment_type] && params[:course_attachment_type].is_a?(Array)
params[:course_attachment_type].each do |type|
tag_name = get_tag_name_by_type_number type

View File

@ -30,7 +30,8 @@ class OrgSubfieldsController < ApplicationController
if params[:id]
@organization = Organization.find(params[:id])
else
@organization = Organization.where("domain=?",request.subdomain).first
domain = Secdomain.where("subname=?", request.subdomain).first
@organization = Organization.find(domain.pid)
end
@org_subfield = OrgSubfield.find_by_sql("select distinct org_subfields.* from org_subfields,"+
"subfield_subdomain_dirs where org_subfields.id = subfield_subdomain_dirs.org_subfield_id and "+

View File

@ -139,7 +139,7 @@ class OrganizationsController < ApplicationController
end
def check_uniq_domain
@is_exist = (Organization.where("domain=?", params[:org_domain]).count > 0)
@is_exist = (Secdomain.where("subname=?",params[:org_domain]).count > 0)
end
def find_organization
@ -322,7 +322,12 @@ class OrganizationsController < ApplicationController
def agree_apply_subdomain
@organization = Organization.find(params[:organization_id])
OrgMessage.find(params[:act_id]).update_attribute(:viewed, 1)
@organization.update_attribute(:domain, params[:org_domain])
if Secdomain.where("pid=? and sub_type=2",@organization.id).count > 0
domain = Secdomain.where("pid=? and sub_type=2",params[:organization_id]).first
Secdomain.update(domain.id, :subname => params[:org_domain])
else
Secdomain.create(:sub_type => 2, :pid => params[:organization_id], :subname => params[:org_domain])
end
if OrgMessage.where("message_type='AgreeApplySubdomain' and organization_id=#{@organization.id} and content=?",params[:org_domain]).count == 0
OrgMessage.create(:user_id => params[:user_id], :organization_id => @organization.id, :message_type => 'AgreeApplySubdomain', :message_id => @organization.id, :sender_id => User.current.id, :viewed => 0, :content => params[:org_domain])
end

View File

@ -98,14 +98,22 @@ class StudentWorkController < ApplicationController
elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的
if @homework.homework_type == 3
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
if pro.nil?
@stundet_works = []
else
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
end
else
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
end
elsif @homework.homework_detail_manual.comment_status == 2 #学生 && 开启匿评 看到匿评列表
if @homework.homework_type == 3
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
my_work = @homework.student_works.where(:id => pro.student_work_id)
if pro.nil?
my_work = []
else
my_work = @homework.student_works.where(:id => pro.student_work_id)
end
else
my_work = @homework.student_works.where(:user_id => User.current.id)
end
@ -113,7 +121,11 @@ class StudentWorkController < ApplicationController
elsif @homework.homework_detail_manual.comment_status == 3 #学生 && 关闭匿评 未提交作品之前列表为空,提交了作品看到所有的
if @homework.homework_type == 3
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
if pro.nil?
my_work = []
else
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
end
else
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
end
@ -134,14 +146,22 @@ class StudentWorkController < ApplicationController
elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的
if @homework.homework_type == 3
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
if pro.nil?
@stundet_works = []
else
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
end
else
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
end
elsif @homework.homework_detail_manual.comment_status == 2 #学生 && 开启匿评 看到匿评列表
if @homework.homework_type == 3
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
my_work = @homework.student_works.where(:id => pro.student_work_id)
if pro.nil?
my_work = []
else
my_work = @homework.student_works.where(:id => pro.student_work_id)
end
else
my_work = @homework.student_works.where(:user_id => User.current.id)
end
@ -149,7 +169,11 @@ class StudentWorkController < ApplicationController
elsif @homework.homework_detail_manual.comment_status == 3 #学生 && 关闭匿评 未提交作品之前列表为空,提交了作品看到所有的
if @homework.homework_type == 3
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
if pro.nil?
my_work = []
else
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
end
else
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
end

View File

@ -2144,22 +2144,22 @@ class UsersController < ApplicationController
if(params[:type].blank? || params[:type] == "1") #全部
if User.current.id.to_i == params[:id].to_i
user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源
@attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
@attachments = Attachment.where("(author_id = #{params[:id]} and is_publish = 1 and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1)").order("created_on desc")
else
user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #Ta的资源库的话应该是他上传的公开资源 加上 他加入的所有我可见课程里的公开资源
@attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 " +
@attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 and is_publish = 1 " +
"and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) " +
"or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
"or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1)").order("created_on desc")
end
elsif params[:type] == "2" #课程资源
if User.current.id.to_i == params[:id].to_i
user_course_ids = User.current.courses.map { |c| c.id}
@attachments = Attachment.where("(author_id = #{params[:id]} and container_type = 'Course') or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')})) ").order("created_on desc")
@attachments = Attachment.where("(author_id = #{params[:id]} and container_type = 'Course' and is_publish = 1) or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1) ").order("created_on desc")
else
user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #如果课程私有资源,那么要看这个资源的课程是不是在 这个user的所有我可见的课程中
@attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 and container_type = 'Course')"+
"or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
@attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 and container_type = 'Course' and is_publish = 1)"+
"or (container_type = 'Course' and is_public = 1 and is_publish = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
end
elsif params[:type] == "3" #项目资源
if User.current.id.to_i == params[:id].to_i

View File

@ -746,7 +746,7 @@ module CoursesHelper
return[] unless course
result = []
course.attachments.each do |attachment|
if attachment.is_public? || User.current.member_of_course?(course) || User.current.admin?
if attachment.is_public? ||User.current == attachment.author ||User.current.allowed_to?(:as_teacher,Course.find(attachment.container_id))|| (User.current.member_of_course?(course) && attachment.is_publish == 1) || User.current.admin?
result << attachment
end
end

View File

@ -123,7 +123,8 @@ module FilesHelper
attachments.each do |attachment|
if attachment.is_public? ||
(attachment.container_type == "Project" && User.current.member_of?(attachment.project)) ||
(attachment.container_type == "Course" && User.current.member_of_course?(Course.find(attachment.container_id)))||
(attachment.container_type == "Course" && User.current.allowed_to?(:as_teacher,Course.find(attachment.container_id)))||
(attachment.container_type == "Course" && User.current.member_of_course?(Course.find(attachment.container_id)) && attachment.is_publish == 1)||
attachment.author_id == User.current.id ||
attachment.container_type == "OrgSubfield"
result << attachment

View File

@ -1,16 +1,3 @@
<style type="text/css">
/*回复框*/
.ReplyToMessageInputContainer .ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;}
.ReplyToMessageInputContainer .ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;}
.ReplyToMessageInputContainer .ke-toolbar-icon-url{background-image:url( /images/public_icon.png )}
.ReplyToMessageInputContainer .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;}
.ReplyToMessageInputContainer .ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;}
.ReplyToMessageInputContainer .ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}
.ReplyToMessageInputContainer .ke-outline{border:none;}
.ReplyToMessageInputContainer .ke-inline-block{display: none;}
.ReplyToMessageInputContainer .ke-container{float:left;}
</style>
<div class="ReplyToMessageContainer borderBottomNone"id="reply_to_message_<%= reply.id%>">
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= reply.id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %></div>
<div class="ReplyToMessageInputContainer mb10">

View File

@ -2,18 +2,6 @@
<%= import_ke(enable_at: true, prettify: false, init_activity: true) %>
<% end %>
<style type="text/css">
/*回复框*/
.homepagePostReplyInputContainer .ke-toolbar {display: none; width: 400px; border: none; background: none; padding: 0px 0px;}
.homepagePostReplyInputContainer .ke-toolbar-icon {line-height: 26px; font-size: 14px; padding-left: 26px;}
.homepagePostReplyInputContainer .ke-toolbar-icon-url {background-image: url("/images/public_icon.png")}
.homepagePostReplyInputContainer .ke-outline {padding: 0px 0px; line-height: 26px; font-size: 14px;}
.homepagePostReplyInputContainer .ke-icon-emoticons {background-position: 0px -671px; width: 50px; height: 26px;}
.homepagePostReplyInputContainer .ke-icon-emoticons:hover {background-position: -79px -671px; width: 50px; height: 26px;}
.homepagePostReplyInputContainer .ke-outline {border: none;}
.homepagePostReplyInputContainer .ke-inline-block {display: none;}
.homepagePostReplyInputContainer .ke-container {float: left;}
</style>
<div id="user_homework_list">
<% homework_commons.each do |homework_common|%>
<script type="text/javascript">

View File

@ -139,6 +139,6 @@
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("anonymos");
}
$("#time").click(select);
$("#term").click(select);
//$("#time").click(select);
//$("#term").click(select);
</script>

View File

@ -4,18 +4,6 @@
<%= javascript_include_tag 'blog' %>
<% end %>
<style type="text/css">
/*回复框*/
div.ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;}
span.ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;}
span.ke-toolbar-icon-url{background-image:url("/images/public_icon.png")}
div.ke-toolbar .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;}
span.ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;}
span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}
div.ke-toolbar .ke-outline{border:none;}
.ke-inline-block{display: none;}
div.ke-container{float:left;}
</style>
<script type="text/javascript">
$(function(){
$("#RSide").removeAttr("id");

View File

@ -1,79 +1,8 @@
<% delete_allowed = User.current.allowed_to?(:manage_files, course) %>
<% curse_attachments.each do |file| %>
<% if file.is_public? || User.current.member_of_course?(course) || User.current.admin? %>
<div class="resources mt10"><!--资源库内容开始--->
<div class="homepagePostBrief">
<div class="homepagePostPortrait">
<%= link_to image_tag(url_to_avatar(file.author), :width => 50, :height => 50), user_path(file.author) %>
</div>
<div class="homepagePostDes">
<div class="homepagePostTitle break_word mt-4">
<%= link_to truncate(file.filename,length: 35, omission: '...'),
download_named_attachment_path(file.id, file.filename),
:title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkBlue f_14 f_b" %>
<%= file_preview_eye(file, class: 'preview') %>
<span id="image_private_<%= file.id%>">
<% if file.is_public? == false%>
<span class="img_private ml5">私有</span>
<%end %>
</span>
</div>
<div class="mt5">
<span class="fontGrey2 mr15 fl">上传时间:<%= format_time(file.created_on)%></span>
<% if file.tag_list.length > 0%>
<span class="fontGrey2 fl mr15">上传类型:<%= file.tag_list[0] %></span>
<% end %>
<p class="f_l mb5 fontGrey2">文件大小:<%= number_to_human_size(file.filesize) %></p>
<p class="fl ml15 fontGrey2">下载<%= file.downloads%>&nbsp;&nbsp;|&nbsp;&nbsp;引用<%= file.quotes.nil? ? 0:file.quotes %> </p>
</div>
<div class="cl"></div>
<div class="tag_h">
<!-- container_type = 1 代表是课程里的资源 -->
<%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
<%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
</div>
<div class="homepagePostSetting">
<ul>
<li class="homepagePostSettingIcon">
<% if User.current.logged? %>
<% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %>
<% if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" %>
<ul class="homepagePostSettiongText">
<li><%= link_to("发&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %></li>
<li><%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %></li>
<% if @course.is_public? %>
<li>
<span id="is_public_<%= file.id %>">
<%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"postOptionLink",:method => :post %>
</span>
</li>
<%end%>
<li>
<%= link_to( '删除资源', attachment_path(file),
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" && file.destroyable %>
</li>
</ul>
<% end %>
<%else%>
<ul class="resourceSendO">
<li><%= link_to("发&nbsp;&nbsp;送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %></li>
</ul>
<% end %>
<% end %>
</li>
</ul>
</div>
<div class="cl"></div>
</div>
<div class="cl"></div>
</div>
</div>
<div id="resource_detail_<%=file.id %>">
<%=render :partial=>'files/resource_detail',:locals => {:file => file} %>
</div>
<% else %>
<div class="re_con_box"><span class='fr mr10 pr_join_span '><%= file.filename %>是私有资源</span></div>
<% end %>

View File

@ -0,0 +1,55 @@
<script src="/javascripts/i18n/jquery.ui.datepicker-zh-CN.js" type="text/javascript"></script>
<span class="uploadText mb10" style="margin-top: -20px;">发布设置</span>
<!--<div class="resourcePopupClose"> <a href="javascript:void(0);" class="resourceClose"></a></div>-->
<%= form_tag(republish_file_course_file_path(@course,@file), :multipart => true,:remote => !ie8?,:name=>"upload_form") do %>
<div class="mb10">
<label class="fl c_dark f14" style="margin-top: 4px;">延迟发布:</label>
<div class="calendar_div fl">
<input type="text" name="publish_time" id="attachment_publish_time" placeholder="发布日期" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%=@file.publish_time %>">
<%#= calendar_for('attachment_publish_time')%>
</div>
<span class="fl c_red" style="margin-top: 4px;" id="publish_time_notice"></span>
<div class="cl"></div>
</div>
<!--<div class="mt15"> <span class="f14 fontGrey3 mr10">延迟发布:</span>
<input type="text" name="" placeholder="请输入0-50数值" class="markInput" />
</div>-->
<div>
<div class="courseSendSubmit"><a href="javascript:void(0);" onclick="submit_republish_file()" class="sendSourceText" id="submit_file">确定</a></div>
<div class="courseSendCancel"><a href="javascript:void(0);" onclick="hideModal()" class="sendSourceText linkGrey6">取消</a></div>
</div>
<% end %>
<div class="cl"></div>
<script>
function regex_publish_time()
{
var myDate = new Date();
if($.trim($("#attachment_publish_time").val()) == "")
{
$("#publish_time_notice").text("发布日期不能为空");
return false;
} else{
var publish_time = Date.parse($("#attachment_publish_time").val());
if(Date.parse(formate_date(myDate)) > publish_time)
{
$("#publish_time_notice").text("发布日期不能小于当前日期");
return false;
}
else
{
$("#publish_time_notice").text("");
return true;
}
}
}
function submit_republish_file()
{
if(regex_publish_time()) {
$('#submit_file').parent().parent().submit();
}
}
$(function(){
var datepickerOptions={dateFormat: 'yy-mm-dd', firstDay: 0, showOn: 'button', buttonImageOnly: true, buttonImage: '/images/public_icon.png', showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true};
$('#attachment_publish_time').datepicker(datepickerOptions);
});
</script>

View File

@ -0,0 +1,77 @@
<% delete_allowed = User.current.allowed_to?(:manage_files, @course) %>
<div class="resources mt10"><!--资源库内容开始--->
<div class="homepagePostBrief">
<div class="homepagePostPortrait">
<%= link_to image_tag(url_to_avatar(file.author), :width => 50, :height => 50), user_path(file.author) %>
</div>
<div class="homepagePostDes">
<div class="homepagePostTitle break_word mt-4">
<%= link_to truncate(file.filename,length: 35, omission: '...'),
download_named_attachment_path(file.id, file.filename),
:title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkBlue f_14 f_b" %>
<%= file_preview_eye(file, class: 'preview') %>
<span id="image_private_<%= file.id%>">
<% if file.is_public? == false%>
<span class="img_private ml5">私有</span>
<%end %>
</span>
<% if file.is_publish == 0 %>
<span class="grey_homework_btn_cir ml5"><%=file.publish_time %>&nbsp;&nbsp;0点发布</span>
<% end %>
</div>
<div class="mt5">
<span class="fontGrey2 mr15 fl">上传时间:<%= format_time(file.created_on)%></span>
<% if file.tag_list.length > 0%>
<span class="fontGrey2 fl mr15">上传类型:<%= file.tag_list[0] %></span>
<% end %>
<p class="f_l mb5 fontGrey2">文件大小:<%= number_to_human_size(file.filesize) %></p>
<p class="fl ml15 fontGrey2">下载<%= file.downloads%>&nbsp;&nbsp;|&nbsp;&nbsp;引用<%= file.quotes.nil? ? 0:file.quotes %> </p>
</div>
<div class="cl"></div>
<div class="tag_h">
<!-- container_type = 1 代表是课程里的资源 -->
<%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
<%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
</div>
<div class="homepagePostSetting">
<ul>
<li class="homepagePostSettingIcon">
<% if User.current.logged? %>
<% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %>
<% if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" %>
<ul class="homepagePostSettiongText">
<li><%= link_to("发&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %></li>
<li><%= link_to '延期发布',file_hidden_course_file_path(@course,file),:class => "postOptionLink",:remote=>true %></li>
<li><%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %></li>
<% if @course.is_public? %>
<li>
<span id="is_public_<%= file.id %>">
<%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"postOptionLink",:method => :post %>
</span>
</li>
<%end%>
<li>
<%= link_to( '删除资源', attachment_path(file),
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" && file.destroyable %>
</li>
</ul>
<% end %>
<%else%>
<ul class="resourceSendO">
<li><%= link_to("发&nbsp;&nbsp;送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %></li>
</ul>
<% end %>
<% end %>
</li>
</ul>
</div>
<div class="cl"></div>
</div>
<div class="cl"></div>
</div>
</div>

View File

@ -1,3 +1,4 @@
<script src="/javascripts/i18n/jquery.ui.datepicker-zh-CN.js" type="text/javascript"></script>
<div id="popbox_upload" class="mb10" style="margin-top: -30px;color:#15bccf; font-size:16px;">
<div class="upload_con">
<h2 style="text-align: center"><%= l(:label_upload_files)%></h2>
@ -21,10 +22,20 @@
<%= render :partial => 'files/new_style_attachment_list',:locals => {:container => course} %>
</div>
<div class="cl"></div>
<a href="javascript:void(0);" class=" fr grey_btn mr40" onclick="hideModal();"><%= l(:button_cancel)%></a>
<!--<a id="submit_resource" href="javascript:void(0);" class="blue_btn fr" onclick="submit_resource();"><%#= l(:button_confirm)%></a>-->
<%= submit_tag '确定',:onclick=>'submit_resource();',:onfocus=>'this.blur()',:id=>'submit_resource',:class=>'sendSourceText fr' %>
<% if User.current.allowed_to?(:as_teacher,course) %>
<div class="mb5">
<label class="fl c_dark f14" style="margin-top: 4px;">延迟发布:</label>
<div class="calendar_div fl">
<input type="text" name="publish_time" id="attachment_publish_time" placeholder="发布日期(可选)" class="InputBox fl W120 calendar_input" readonly="readonly">
<%#= calendar_for('attachment_publish_time')%>
</div>
<span class="fl c_red f12" style="margin-top: 4px;" id="publish_time_notice"></span>
<div class="cl"></div>
</div>
<% end %>
<a href="javascript:void(0);" class=" fr courseSendCancel mr40" onclick="hideModal();"><%= l(:button_cancel)%></a>
<a id="submit_resource" href="javascript:void(0);" class="c_white courseSendSubmit fr" onclick="submit_course_resource();"><%= l(:button_confirm)%></a>
<%#= submit_tag '确定',:onclick=>'submit_course_resource();',:onfocus=>'this.blur()',:id=>'submit_resource',:class=>'sendSourceText fr' %>
<% end %>
</div>
@ -35,8 +46,39 @@
</div>
<script>
function submit_resource()
function regex_publish_time()
{
$('#submit_resource').parent().submit();
var myDate = new Date();
if($.trim($("#attachment_publish_time").val()) == "")
{
return true;
} else{
var publish_time = Date.parse($("#attachment_publish_time").val());
if(Date.parse(formate_date(myDate)) > publish_time)
{
$("#publish_time_notice").text("发布日期不能小于当前日期");
return false;
}
else
{
$("#publish_time_notice").text("");
return true;
}
}
}
function submit_course_resource()
{
<% if User.current.allowed_to?(:as_teacher,course) %>
if(regex_publish_time()) {
$('#submit_resource').parent().submit();
}
<% else %>
$('#submit_resource').parent().submit();
<% end %>
}
$(function(){
var datepickerOptions={dateFormat: 'yy-mm-dd', firstDay: 0, showOn: 'button', buttonImageOnly: true, buttonImage: '/images/public_icon.png', showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true};
$('#attachment_publish_time').datepicker(datepickerOptions);
});
</script>

View File

@ -0,0 +1,6 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'files/hidden_file',:locals => {:course => @course,:course_attachment_type => 1}) %>');
showModal('ajax-modal', '311px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal()' style='margin-left: 280px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("popbox_polls");

View File

@ -0,0 +1,2 @@
hideModal();
$("#resource_detail_<%=@file.id %>").html("<%= escape_javascript(render :partial=>'files/resource_detail',:locals => {:file => @file}) %>")

View File

@ -1,18 +1,7 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: true,init_activity: true) %>
<% end %>
<style type="text/css">
/*回复框*/
/*div.ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;}*/
/*span.ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;}*/
/*span.ke-toolbar-icon-url{background-image:url( /images/public_icon.png )}*/
/*div.ke-toolbar .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;}*/
/*span.ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;}*/
/*span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}*/
/*div.ke-toolbar .ke-outline{border:none;}*/
/*.ke-inline-block{display: none;}*/
/*div.ke-container{float:left;}*/
</style>
<script>
$(function(){
$("#RSide").removeAttr("id");

View File

@ -44,14 +44,14 @@
</li>
<% if User.current.logged? %>
<li class="navOrgMenu fr" id="orgUser" style="cursor:pointer;">
<%= link_to image_tag(url_to_avatar(User.current),:width => '23',:height => '23'), user_path(User.current),:alt => '用户头像', :target => '_blank',:style=>'border-radius:3px; vertical-align:top; margin-top:3px; display:inline-block; margin-right:3px;' %>
<%= link_to User.current, user_path(User.current),:id => "orgUserName",:class => 'fontGrey2 f14 mr5',:target => '_blank' %>
<%= link_to "退出",logout_organization_path(@organization), :class =>"menuGrey", :method => 'post', :rel => "nofollow" %>
<%= link_to image_tag(url_to_avatar(User.current),:width => '23',:height => '23'), request.local? ? user_path(User.current):("https://www.trustie.net/users/" + User.current.id.to_s),:alt => '用户头像', :target => '_blank',:style=>'border-radius:3px; vertical-align:top; margin-top:3px; display:inline-block; margin-right:3px;' %>
<%= link_to User.current, (request.local? || request.subdomain.blank?) ? user_path(User.current):("https://www.trustie.net/users/" + User.current.id.to_s),:id => "orgUserName",:class => 'fontGrey2 f14 mr5',:target => '_blank' %>
<%= link_to "退出",(request.local? || request.subdomain.nil?) ? signout_path():"https://www.trustie.net/logout", :class =>"menuGrey", :method => 'post', :rel => "nofollow" %>
</li>
<!--<li class="navOrgMenu fr"><%#=link_to User.current, user_path(User.current), :class => "linkGrey8 f14" %></li>-->
<% else %>
<li class="navOrgMenu fr"><a href="<%= signin_path(:login=>true) %>" class="linkGrey8 f14">登录</a></li>
<li class="navOrgMenu fr"><a href="<%= signin_path(:login=>false) %>" class="linkGrey8 f14 mr15">注册</a></li>
<li class="navOrgMenu fr"><a href="<%= (request.local? || request.subdomain.nil?) ? signin_path(:login=>true):'https://www.trustie.net/login?login=true' %>" class="linkGrey8 f14">登录</a></li>
<li class="navOrgMenu fr"><a href="<%= (request.local? || request.subdomain.nil?) ? signin_path(:login=>false):'https://www.trustie.net/login?login=false' %>" class="linkGrey8 f14 mr15">注册</a></li>
<% end %>
</ul>
<!--<div class="navHomepageProfile">

View File

@ -1,15 +1,3 @@
<style type="text/css">
/*回复框*/
.ReplyToMessageInputContainer .ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;}
.ReplyToMessageInputContainer .ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;}
.ReplyToMessageInputContainer .ke-toolbar-icon-url{background-image:url( /images/public_icon.png )}
.ReplyToMessageInputContainer .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;}
.ReplyToMessageInputContainer .ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;}
.ReplyToMessageInputContainer .ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}
.ReplyToMessageInputContainer .ke-outline{border:none;}
.ReplyToMessageInputContainer .ke-inline-block{display: none;}
.ReplyToMessageInputContainer .ke-container{float:left;}
</style>
<div class="ReplyToMessageContainer borderBottomNone" id="reply_to_message_<%= reply.id%>">
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= reply.id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %></div>

View File

@ -3,18 +3,6 @@
<%= javascript_include_tag "create_kindeditor" %>
<% end %>
<style type="text/css">
/*回复框*/
/*.homepagePostReplyInputContainer .ke-toolbar {display: none; width: 400px; border: none; background: none; padding: 0px 0px;}*/
/*.homepagePostReplyInputContainer .ke-toolbar-icon {line-height: 26px; font-size: 14px; padding-left: 26px;}*/
/*.homepagePostReplyInputContainer .ke-toolbar-icon-url {background-image: url(/images/public_icon.png)}*/
/*.homepagePostReplyInputContainer .ke-outline {padding: 0px 0px; line-height: 26px; font-size: 14px;}*/
/*.homepagePostReplyInputContainer .ke-icon-emoticons {background-position: 0px -671px; width: 50px; height: 26px;}*/
/*.homepagePostReplyInputContainer .ke-icon-emoticons:hover {background-position: -79px -671px; width: 50px; height: 26px;}*/
/*.homepagePostReplyInputContainer .ke-outline {border: none;}*/
/*.homepagePostReplyInputContainer .ke-inline-block {display: none;}*/
/*.homepagePostReplyInputContainer .ke-container {float: left;}*/
</style>
<% if newss%>
<% newss.each do |news| %>
<script>

View File

@ -3,18 +3,6 @@
<%= javascript_include_tag "create_kindeditor" %>
<% end %>
<style type="text/css">
/*回复框*/
/*.homepagePostReplyInputContainer .ke-toolbar {display: none; width: 400px; border: none; background: none; padding: 0px 0px;}*/
/*.homepagePostReplyInputContainer .ke-toolbar-icon {line-height: 26px; font-size: 14px; padding-left: 26px;}*/
/*.homepagePostReplyInputContainer .ke-toolbar-icon-url {background-image: url(/images/public_icon.png)}*/
/*.homepagePostReplyInputContainer .ke-outline {padding: 0px 0px; line-height: 26px; font-size: 14px;}*/
/*.homepagePostReplyInputContainer .ke-icon-emoticons {background-position: 0px -671px; width: 50px; height: 26px;}*/
/*.homepagePostReplyInputContainer .ke-icon-emoticons:hover {background-position: -79px -671px; width: 50px; height: 26px;}*/
/*.homepagePostReplyInputContainer .ke-outline {border: none;}*/
/*.homepagePostReplyInputContainer .ke-inline-block {display: none;}*/
/*.homepagePostReplyInputContainer .ke-container {float: left;}*/
</style>
<% if all_news %>
<% all_news.each do |news| %>
<script>

View File

@ -1,16 +1,3 @@
<style type="text/css">
/*回复框*/
.ReplyToMessageInputContainer .ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;}
.ReplyToMessageInputContainer .ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;}
.ReplyToMessageInputContainer .ke-toolbar-icon-url{background-image:url( /images/public_icon.png )}
.ReplyToMessageInputContainer .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;}
.ReplyToMessageInputContainer .ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;}
.ReplyToMessageInputContainer .ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}
.ReplyToMessageInputContainer .ke-outline{border:none;}
.ReplyToMessageInputContainer .ke-inline-block{display: none;}
.ReplyToMessageInputContainer .ke-container{float:left;}
</style>
<div class="ReplyToMessageContainer borderBottomNone"id="reply_to_message_<%= reply.id%>">
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= reply.id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %></div>
<div class="ReplyToMessageInputContainer mb10">

View File

@ -17,6 +17,7 @@
最后编辑:<%= User.find(EditorOfDocument.where("org_document_comment_id =?", document.id).order("created_at desc").first.editor_id).realname %>
</div>
<% end %>
<div class="cl"></div>
<!-- <%# if defined?(home_id) %>
<div style="float:right;">最后编辑:<%#= User.find() %></div>
<%# end %>-->

View File

@ -28,7 +28,7 @@
<li class="orgListStatus">新增</li>
<li class="orgListStatus"><%= field.field_type == "Post" ? "帖子" : "资源" %></li>
<li class="orgListUser hidden">
<% if @organization.domain %>
<% if Secdomain.where("sub_type=2 and pid=?", @organization.id).count > 0 %>
<div id="sub_dir_show_<%= field.id %>" ondblclick="edit_dir('#sub_dir_show_<%= field.id %>','#sub_dir_edit_<%= field.id %>');" style="cursor:pointer;background-color:#fffce6;color: #0d90c3;" title="双击可编辑">
<%= field.subfield_subdomain_dir.nil? ? '未设置': field.subfield_subdomain_dir.name %>
</div>

View File

@ -27,6 +27,7 @@
}
</script>
<% domain = Secdomain.where("sub_type=2 and pid=?", @organization.id).first %>
<div class="homepageRightBanner">
<div class="NewsBannerName">配置</div>
</div>
@ -53,12 +54,12 @@
<div class="orgRow mb10"><span class="ml10">组织描述:</span><textarea type="text" name="organization[description]" class="orgDes" id="org_desc" placeholder="最多3000个汉字或6000个英文字符"><%= @organization.description%></textarea>
<div class="cl"></div>
</div>
<div style="margin-left: 80px " id="check_desc_hint"></div>
<div style="margin-left: 80px " id="check_desc_hint"></div>
<div class="orgRow mb10"><span class="ml10">组织URL</span>
<div class="w607 fr">http//
<input type="text" name="organization[domain]" id="domain" value="<%= @organization.domain%>" class="orgUrlInput" />
<input type="text" name="organization[domain]" id="domain" value="<%= domain.nil? ? '' : domain.subname %>" class="orgUrlInput" />
.trustie.net<a href="javascript:void(0);" class="linkBlue ml15" style="text-decoration:underline;" onclick="apply_subdomain(<%= @organization.id %>,$('#domain').val());">申请</a>
<% if @organization.domain.present? and OrgMessage.where("organization_id=? and message_type='ApplySubdomain'", @organization.id).order("updated_at desc").first.content == @organization.domain %>
<% if domain.present? and OrgMessage.where("organization_id=? and message_type='ApplySubdomain'", @organization.id).order("updated_at desc").first.content == domain.subname %>
<span>(已批准)</span>
<% elsif OrgMessage.where("organization_id=? and message_type='ApplySubdomain'", @organization.id).count > 0 %>
<span>(您申请了子域名<%= OrgMessage.where("organization_id=? and message_type='ApplySubdomain'", @organization.id).order("updated_at desc").first.content %>,还未批准)</span>
@ -127,8 +128,8 @@
<input type="text" id="subfield_name" name="name" placeholder="栏目名称" class="orgAddSearch mb10" />
<div class="mb5">
<p class="fontGrey3"><span class="fb">域名目录</span>用户自定义url可选</p>
<% if @organization.domain %>
<span class="fl"><%= @organization.domain %>.trustie.net/</span><input class="fl personalUrl ml3" type="text" name="sub_dir">
<% if domain %>
<span class="fl"><%= domain.subname %>.trustie.net/</span><input class="fl personalUrl ml3" type="text" name="sub_dir">
<% else %>
<span class="fl">您还没有子域名,请先在左侧信息栏申请子域名</span>
<% end %>

View File

@ -62,7 +62,7 @@
<% if has_commit%>
<li><%= link_to l(:label_statistical_results), statistics_result_poll_path(poll.id), :class => "pollsbtn fr mr10"%></li>
<%else%>
<li class="pollsbtn fr mr10 pollsbtn_grey">统计结果</li>
<li class="pollsbtn fr mr10 pollsbtn_grey" title="请先提交问卷再查看统计结果">统计结果</li>
<%end%>
<% end %>
<% end%>

View File

@ -35,18 +35,7 @@
})
})
</script>
<style type="text/css">
/*回复框*/
/*div.ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;}*/
/*span.ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;}*/
/*span.ke-toolbar-icon-url{background-image:url( /images/public_icon.png )}*/
/*div.ke-toolbar .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;}*/
/*span.ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;}*/
/*span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}*/
/*div.ke-toolbar .ke-outline{border:none;}*/
/*.ke-inline-block{display: none;}*/
/*div.ke-container{float:left;}*/
</style>
<% unless forge_acts.empty? %>
<% forge_acts.each do |activity| -%>
<script>

View File

@ -60,31 +60,6 @@
<% end %>
<<<<<<< HEAD
<%= labelled_form_for :repository, @repository, :url =>project_repositories_path(@project),:html => {:id => 'repository-form',:method=>"post"} do |f| %>
<div id="pro_st_edit_ku" class="pro_st_edit_ku">
<ul>
<li >
<label class="label02"><%=l(:label_scm)%></label>
<%= label_tag('repository_scm',
options_for_select(["Git"],@repository.class.name.demodulize),
:data => {:remote => true, :method => 'get'})%>
<% if @repository && ! @repository.class.scm_available %>
<span class="c_grey"><%= l(:text_scm_command_not_available) %></span>
<% end %>
</li>
<% unless judge_main_repository(@project) %>
<li>
<label class="label02"><%=l(:field_repository_is_default)%></label>
<%= f.check_box :is_default, :label => "", :no_label => true %></p>
</li>
<% end %>
<li >
<label class="label02"><span class="c_red">*</span><%=l(:label_repository_name)%></label>
<%= f.text_field :identifier, :disabled =>@repository.nil? || @repository.identifier_frozen? ? true:false,:label=>"", :no_label => true %>
<% unless @repository.identifier_frozen? %>
<span class="c_grey"><%=l(:text_length_between,:min=>1,:max=>254)<<l(:text_project_identifier_info) %></span>
=======
<% if @project.repositories.any? %>
<%= render :partial => 'projects/settings/rep_gitlab', :locals => {:project => @project, :ip => "ip", :project_path_cut => "project_path_cut" } %>
<%#= render :partial => 'projects/settings/rep_forge', :locals => {:project => @project, :ip => "ip", :project_path_cut => "project_path_cut" } %>
@ -109,7 +84,6 @@
<td class="w360" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" ><%=h truncate(repository.url,:length=>10) %></td>
<% end %>
</tr>
>>>>>>> develop
<% end %>
</tbody>
</table>

View File

@ -38,18 +38,7 @@
})
})
</script>
<style type="text/css">
/*回复框*/
/*div.ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;}*/
/*span.ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;}*/
/*span.ke-toolbar-icon-url{background-image:url( "/images/public_icon.png" )}*/
/*div.ke-toolbar .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;}*/
/*span.ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;}*/
/*span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}*/
/*div.ke-toolbar .ke-outline{border:none;}*/
/*.ke-inline-block{display: none;}*/
/*div.ke-container{float:left;}*/
</style>
<% user_activities.each do |user_activity|
if user_activities %>
<script>

View File

@ -2,18 +2,7 @@
<%= import_ke(enable_at: true, prettify: false, init_activity: true) %>
<%#= javascript_include_tag "init_KindEditor","user" %>
<% end %>
<style type="text/css">
/*回复框*/
/*.homepagePostReplyInputContainer .ke-toolbar {display: none; width: 400px; border: none; background: none; padding: 0px 0px;}*/
/*.homepagePostReplyInputContainer .ke-toolbar-icon {line-height: 26px; font-size: 14px; padding-left: 26px;}*/
/*.homepagePostReplyInputContainer .ke-toolbar-icon-url {background-image: url(/images/public_icon.png)}*/
/*.homepagePostReplyInputContainer .ke-outline {padding: 0px 0px; line-height: 26px; font-size: 14px;}*/
/*.homepagePostReplyInputContainer .ke-icon-emoticons {background-position: 0px -671px; width: 50px; height: 26px;}*/
/*.homepagePostReplyInputContainer .ke-icon-emoticons:hover {background-position: -79px -671px; width: 50px; height: 26px;}*/
/*.homepagePostReplyInputContainer .ke-outline {border: none;}*/
/*.homepagePostReplyInputContainer .ke-inline-block {display: none;}*/
/*.homepagePostReplyInputContainer .ke-container {float: left;}*/
</style>
<%if jours %>
<% jours.each do |jour|%>
<% unless jour.private == 1 && (!User.current || (User.current && jour.jour_id != User.current.id && jour.user_id != User.current.id)) %>

View File

@ -12,7 +12,7 @@
<%= ma.content %>
</li>
<li class="homepageHomeworkContentWarn fl">
<%=link_to (ma.organization.domain.nil? || (ma.organization.domain && ma.organization.domain != ma.content)) ? "同意申请":"申请已批准",
<%=link_to (Secdomain.where("sub_type=2 and pid=?", ma.organization.id).count == 0 || (Secdomain.where("sub_type=2 and pid=?", ma.organization.id).count > 0 && Secdomain.where("sub_type=2 and pid=?", ma.organization.id).first.subname != ma.content)) ? "同意申请":"申请已批准",
agree_apply_subdomain_organizations_path( :organization_id => ma.organization_id, :org_domain => ma.content, :user_id => ma.sender_id, :act_id => ma.id ),
:id => "agree_apply_subdomain_#{ma.id}",
:method => 'post',

View File

@ -22,12 +22,7 @@
</div>
<div class="orgWrap">
<div class="orgTitle">
<% if org.domain.nil? %>
<%= link_to org.name, organization_path(org), :class => 'f16 linkBlue' %>
<% else %>
<%= link_to org.name, organization_path(org), :class => 'f16 linkBlue' %>
<!--<a href="http://test.<%#= org.domain %>.trustie.net" class = 'f16 linkBlue'><%#= org.name %></a>-->
<% end %>
</div>
<div class="orgIntro"><%= org.description %></div>
<div class="postCreater">创建者:<%= link_to User.find(org.creator_id), user_path(org.creator_id), :class => 'linkGrey2', :target => '_blank' %></div>

View File

@ -9,7 +9,7 @@ class Subdomain
o = ::Secdomain.where(subname: request.subdomain).first
if(@opt[:sub])
if o && o.sub_type == 2 && request.path_parameters[:sub_dir_name] == 'news'
if o && o.sub_type == 2
request.path_parameters[:id] = o.pid
request.path_parameters[:controller] = 'org_subfields'
request.path_parameters[:action] = 'show'

View File

@ -695,6 +695,7 @@ RedmineApp::Application.routes.draw do
end
member do
match "quote_resource_show", :via => [:get]
get "file_hidden"
end
end
@ -1015,6 +1016,8 @@ RedmineApp::Application.routes.draw do
end
member do
match "quote_resource_show", :via => [:get]
get "file_hidden"
post "republish_file"
end
end
resources :memberships, :shallow => true, :controller => 'members', :only => [:index, :show, :new, :create, :update, :destroy] do

View File

@ -0,0 +1,19 @@
class UpdateCourseTerm < ActiveRecord::Migration
def up
count = Course.all.count / 30 + 2
transaction do
for i in 1 ... count do i
Course.page(i).per(30).each do |course|
if course.end_time.nil? && course.end_term.nil?
course.end_time = course.time
course.end_term = course.term
course.save
end
end
end
end
end
def down
end
end

View File

@ -0,0 +1,21 @@
class AddPublishToAttachments < ActiveRecord::Migration
def change
add_column :attachments, :is_publish, :integer, :default => 1
add_column :attachments, :publish_time, :date
=begin
count = Attachment.all.count / 30 + 2
transaction do
for i in 1 ... count do i
Attachment.page(i).per(30).each do |atta|
begin
atta.publish_time = atta.created_on.strftime('%d-%b-%Y')
atta.save
ensure
logger.error("===================>>container_id is null")
end
end
end
end
=end
end
end

View File

@ -0,0 +1,5 @@
class AddIndexToSecdomain < ActiveRecord::Migration
def change
add_index(:secdomains, :subname, unique: true)
end
end

View File

@ -0,0 +1,14 @@
class MoveDomainToSecdomain < ActiveRecord::Migration
def up
Secdomain.transaction do
#将组织中的子域名迁移至secdomains表
Organization.where("domain is not null").each do |org|
Secdomain.create(sub_type: 2, subname: org.domain, pid: org.id)
end
#remove_column :organizations, :domain
end
end
def down
end
end

View File

@ -0,0 +1,8 @@
class RemoveDomainFromOrganizations < ActiveRecord::Migration
def up
remove_column :organizations, :domain
end
def down
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20160202034530) do
ActiveRecord::Schema.define(:version => 20160220100507) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -1219,7 +1219,6 @@ ActiveRecord::Schema.define(:version => 20160202034530) do
create_table "org_members", :force => true do |t|
t.integer "user_id"
t.integer "organization_id"
t.string "role"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end

View File

@ -0,0 +1,11 @@
#coding=utf-8
namespace :resource_publish do
desc "start publish resource"
task :publish => :environment do
attachments = Attachment.where("publish_time = '#{Date.today}'")
attachments.each do |attachment|
attachment.update_column('is_publish', 1)
end
end
end

View File

@ -114,3 +114,5 @@ div.flash {margin-top :0px !important}
/*文本描述展开高度*/
.maxh360 {max-height: 810px;}
.lh18 { line-height: 18px;}
a.link_file_a2{ background:url(../images/pic_file.png) 0 -15px no-repeat; padding-left: 20px;}

View File

@ -255,6 +255,7 @@ a.bBlue {background-color:#3498db;}
a.bBlue:hover {background-color:#297fb8;}
a.submit_btn {border:1px solid #3498db; padding:3px 10px; border-radius:3px; color:#3498db;}
a.submit_btn:hover {background-color:#3498db; color:#ffffff;}
a.link_file_a2{ background:url(../images/pic_file.png) 0 -15px no-repeat; padding-left: 20px;}
/* commonBtn */
.grey_btn{ background:#d9d9d9; color:#656565;font-size:14px; font-weight:normal; text-align:center;padding:2px 10px;}