commit
01fed2eab9
@ -0,0 +1,9 @@
|
||||
module OwnerTypeHelper
|
||||
MEMO = 1
|
||||
FORUM = 2
|
||||
MESSAGE = 3
|
||||
NEWS = 4
|
||||
COMMENT = 5
|
||||
BID = 6
|
||||
JOURNALSFORMESSAGE = 7
|
||||
end
|
@ -1,27 +0,0 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class CommentObserver < ActiveRecord::Observer
|
||||
def after_create(comment)
|
||||
if comment.commented.is_a?(News) && Setting.notified_events.include?('news_comment_added')
|
||||
##by senluo
|
||||
thread3=Thread.new do
|
||||
Mailer.news_comment_added(comment).deliver
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -1,25 +0,0 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class DocumentObserver < ActiveRecord::Observer
|
||||
def after_create(document)
|
||||
##by senluo
|
||||
thread2=Thread.new do
|
||||
Mailer.document_added(document).deliver if Setting.notified_events.include?('document_added')
|
||||
end
|
||||
end
|
||||
end
|
@ -1,8 +0,0 @@
|
||||
class ForumObserver < ActiveRecord::Observer
|
||||
# def after_create(forum)
|
||||
# Thread.start do
|
||||
# Mailer.forum_add(forum).deliver if Setting.notified_events.include?('forum_add')
|
||||
# end
|
||||
#
|
||||
# end
|
||||
end
|
@ -1,9 +1,7 @@
|
||||
# Added by young
|
||||
class JournalsForMessageObserver < ActiveRecord::Observer
|
||||
def after_create(journals_for_message)
|
||||
thread1 = Thread.start do
|
||||
Mailer.journals_for_message_add(User.current, journals_for_message).deliver
|
||||
end
|
||||
Mailer.run.journals_for_message_add(User.current, journals_for_message)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1,8 +0,0 @@
|
||||
class MemoObserver < ActiveRecord::Observer
|
||||
def after_create(memo)
|
||||
|
||||
thread1=Thread.new do
|
||||
Mailer.forum_message_added(memo).deliver if Setting.notified_events.include?('forum_message_added')
|
||||
end
|
||||
end
|
||||
end
|
@ -1,25 +0,0 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class MessageObserver < ActiveRecord::Observer
|
||||
def after_create(message)
|
||||
##by senluo
|
||||
thread5=Thread.new do
|
||||
Mailer.message_posted(message).deliver if Setting.notified_events.include?('message_posted')
|
||||
end
|
||||
end
|
||||
end
|
@ -1,25 +0,0 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class NewsObserver < ActiveRecord::Observer
|
||||
def after_create(news)
|
||||
##by senluo
|
||||
thread6=Thread.new do
|
||||
Mailer.news_added(news).deliver if Setting.notified_events.include?('news_added')
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,18 @@
|
||||
class ZipPack < ActiveRecord::Base
|
||||
# attr_accessible :title, :body
|
||||
|
||||
def self.packed?(bid_id, user_id, digests)
|
||||
zip_pack = ZipPack.where(homework_id: bid_id, user_id: user_id).first
|
||||
return false unless zip_pack && zip_pack.digests == digests
|
||||
zip_pack
|
||||
end
|
||||
|
||||
def file_valid?
|
||||
return false unless File.exist?(self.file_path)
|
||||
Trustie::Utils.digest(self.file_path) == self.file_digest
|
||||
end
|
||||
|
||||
def digests
|
||||
self.file_digests.split(',').sort
|
||||
end
|
||||
end
|
@ -0,0 +1,7 @@
|
||||
<% if !@save_flag && @save_message %>
|
||||
$("#error_show").html("<%= @save_message.join(', ') %>");
|
||||
<% elsif @message && @message != "" %>
|
||||
$("#error_show").html("<%= @message.html_safe %>");
|
||||
<% else %>
|
||||
closeModal();
|
||||
<% end %>
|
@ -1,3 +1,4 @@
|
||||
<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
|
||||
<%= labelled_form_for @bid do |f| %>
|
||||
<%= render :partial => 'new_homework_form', :locals => { :bid => @bid, :bid_id => "edit_bid_#{@bid.id}"} %>
|
||||
<%= render :partial => 'new_homework_form', :locals => { :bid => @bid, :bid_id => "edit_bid_#{@bid.id}",:f=>f,:edit_mode => true} %>
|
||||
<% end %>
|
@ -1,3 +1,4 @@
|
||||
<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
|
||||
<%= labelled_form_for @homework, :url => {:controller => 'bids', :action => 'create_homework',:course_id => "#{params[:id] || params[:course_id]}"} do |f| %>
|
||||
<%= render :partial => 'bids/new_homework_form', :locals => { :bid => @homework,:bid_id => "new_bid" } %>
|
||||
<%= render :partial => 'bids/new_homework_form', :locals => { :bid => @homework,:bid_id => "new_bid",:f => f,:edit_mode => false } %>
|
||||
<% end %>
|
@ -0,0 +1,58 @@
|
||||
|
||||
<div class="re_con_top">
|
||||
<p class="f_l c_blue f_b f_14">共有 <%= all_attachments.count%> 个资源</p>
|
||||
<p class="f_r" style="color: #808080">
|
||||
<% if order == "asc" %>
|
||||
按 <%= link_to "时间",params.merge(:sort=>"created_on:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"created_on"} %> /
|
||||
<%= link_to "下载次数",params.merge(:sort=>"downloads:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"downloads"} %> /
|
||||
<%= link_to "引用次数",params.merge(:sort=>"quotes:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"quotes"} %> 排序
|
||||
<% else %>
|
||||
按 <%= link_to "时间",params.merge(:sort=>"created_on:asc"),:class => "f_b c_grey" ,:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"created_on"} %> /
|
||||
<%= link_to "下载次数",params.merge(:sort=>"downloads:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"downloads"} %> /
|
||||
<%= link_to "引用次数",params.merge(:sort=>"quotes:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"quotes"} %> 排序
|
||||
<% end %>
|
||||
</p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="for_img_thumbnails">
|
||||
<% project_attachments.each do |file| %>
|
||||
<div class="re_con_box">
|
||||
<div class="">
|
||||
<%= link_to_attachment file, :download => true,:text => truncate(file.filename,length: 35, omission: '...'), :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "c_dblue f_14 f_b f_l" %>
|
||||
<% if User.current.logged? %>
|
||||
<% if (manage_allowed || file.author_id == User.current.id) && project_contains_attachment?(project,file) %>
|
||||
<%= link_to(l(:label_slected_to_other_project),quote_resource_show_project_project_file_path(project,file),:class => "f_l re_select",:remote => true) if has_project?(User.current,file) %>
|
||||
|
||||
<% if manage_allowed && file.container_id == project.id && file.container_type == "Project" %>
|
||||
<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=>"f_l re_open",:method => :post %>
|
||||
</span>
|
||||
<% else %>
|
||||
<!-- <#%= link_to (file.is_public? ? "公开":"私有"),"javascript:void(0)",:class=>"f_l re_open" %> -->
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= link_to(l(:label_slected_to_project),quote_resource_show_project_project_file_path(project,file),:class => "f_l re_select",:remote => true) if has_project?(User.current,file) %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="">
|
||||
<p class="f_l c_grey02 font">文件大小:<%= number_to_human_size(file.filesize) %></p>
|
||||
<%= link_to( l(:button_delete), attachment_path(file),
|
||||
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "f_r re_de") if manage_allowed && file.container_id == project.id && file.container_type == "Project"%>
|
||||
<p class="f_r c_grey02" ><%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %> | 下载<%= file.downloads %> | 引用<%= file.quotes.nil? ? 0:file.quotes %> </p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="tag_h">
|
||||
<%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "10"} %>
|
||||
<%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "10"} %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div><!---re_con_box end-->
|
||||
<% end %>
|
||||
</div>
|
||||
<ul class="wlist">
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
@ -0,0 +1,65 @@
|
||||
|
||||
<div class="project_r_h">
|
||||
<h2 class="project_h2"><%= l(:lable_file_sharingarea) %></h2>
|
||||
</div>
|
||||
|
||||
<!--<%#= stylesheet_link_tag 'resource', :media => 'all' %> -->
|
||||
<script>
|
||||
function show_upload()
|
||||
{
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show_project',:locals => {:project => project}) %>');
|
||||
showModal('ajax-modal', '513px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'><a href='javascript:void(0)' onclick='closeModal()'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>")
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("popbox_polls");
|
||||
}
|
||||
|
||||
function closeModal()
|
||||
{
|
||||
hideModal($("#popbox_upload"));
|
||||
}
|
||||
|
||||
function presscss(id)
|
||||
{
|
||||
if(id == "incourse")
|
||||
{
|
||||
$('#incourse').attr("class", "re_schbtn b_dblue");
|
||||
$('#insite').attr("class", "re_schbtn b_lblue");
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#incourse').attr("class", "re_schbtn b_lblue");
|
||||
$('#insite').attr("class", "re_schbtn b_dblue");
|
||||
}
|
||||
}
|
||||
function buttoncss()
|
||||
{
|
||||
$('#incourse').attr("class", "re_schbtn b_lblue");
|
||||
$('#insite').attr("class", "re_schbtn b_lblue");
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<div class="container">
|
||||
<div class="resource"><!--资源库内容开始--->
|
||||
<div class="re_top">
|
||||
<%= form_tag( search_project_project_files_path(@project), method: 'get',:class => "re_search f_l",:remote=>true) do %>
|
||||
<%= text_field_tag 'name', params[:name], name: "name", :class => 're_schbox',:style=>"padding: 0px"%>
|
||||
<%= submit_tag "课内搜索", :class => "re_schbtn b_lblue",:name => "incourse",:id => "incourse", :onmouseover => "presscss('incourse')",:onmouseout =>"buttoncss()" %>
|
||||
<%= submit_tag "全站搜索", :class => "re_schbtn b_lblue",:name => "insite",:id => "insite",:onmouseover => "presscss('insite')",:onmouseout =>"buttoncss()" %>
|
||||
<% end %>
|
||||
<% manage_allowed = User.current.allowed_to?(:manage_files, @project) %>
|
||||
<% if manage_allowed %> <!-- show_window('light','fade','20%','35%')-->
|
||||
<a href="javascript:void(0)" class="re_fabu f_r b_lblue" onclick="show_upload();">上传资源</a>
|
||||
<% end %>
|
||||
</div><!---re_top end-->
|
||||
<div class="cl"></div>
|
||||
|
||||
<div class="re_con" id="course_list">
|
||||
<%= render :partial => 'project_file_list',:locals => {project: @project,all_attachments: @all_attachments,sort:@sort,order:@order,project_attachments:@obj_attachments,:manage_allowed => manage_allowed} %>
|
||||
</div><!---re_con end-->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<% html_title(l(:label_attachment_plural)) -%>
|
@ -0,0 +1,31 @@
|
||||
<div id="popbox_upload" style="margin-top: -30px;margin-left: -20px;margin-right: -10px;">
|
||||
<div class="upload_con">
|
||||
<h2>将此课件引入我的资源库</h2>
|
||||
<% if error == '403' %>
|
||||
<div class="upload_box">
|
||||
<div style="color: red;">您没有权限引用此资源</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="upload_box">
|
||||
<div id="error_show" style="color: red;"></div>
|
||||
<%= form_tag attach_relations_path,
|
||||
method: :post,
|
||||
remote: true,
|
||||
id: "relation_file_form" do %>
|
||||
<%= hidden_field_tag(:file_id, file.id) %>
|
||||
<%= content_tag('div', projects_check_box_tags('projects[project][]', User.current.projects,project,file), :id => 'projects')%>
|
||||
<a id="submit_quote" href="javascript:void(0)" class="blue_btn fl c_white" onclick="submit_quote();">引 用</a><a href="javascript:void(0)" class="blue_btn grey_btn fl c_white" onclick="closeModal();">取 消</a>
|
||||
<% end -%>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function submit_quote()
|
||||
{
|
||||
$('#submit_quote').parent().submit();
|
||||
}
|
||||
</script>
|
@ -0,0 +1,29 @@
|
||||
|
||||
<div id="popbox_upload" class="box_h3 mb10" style="margin-top: -30px">
|
||||
<div class="upload_con">
|
||||
<h2><%= l(:label_upload_files)%></h2>
|
||||
<div class="upload_box">
|
||||
<%= error_messages_for 'attachment' %>
|
||||
<div id="network_issue" style="color: red; display: none;"><%= l(:label_file_upload_error_messages)%></div>
|
||||
|
||||
<%= form_tag(project_files_path(project), :multipart => true,:remote => !ie8?,:name=>"upload_form") do %>
|
||||
<!-- <label style="margin-top:3px;"><#%= l(:label_file_upload)%></label> -->
|
||||
<%= render :partial => 'attachement_list',:locals => {:project => project} %>
|
||||
<div class="cl"></div>
|
||||
<a href="javascript:void(0);" class=" fr grey_btn mr40" onclick="closeModal();"><%= l(:button_cancel)%></a>
|
||||
<a id="submit_resource" href="javascript:void(0);" class="blue_btn fr" onclick="submit_resource();"><%= l(:button_confirm)%></a>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<% content_for :header_tags do %>
|
||||
<%= javascript_include_tag 'attachments' %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function submit_resource()
|
||||
{
|
||||
$('#submit_resource').parent().submit();
|
||||
}
|
||||
</script>
|
@ -1,35 +1,33 @@
|
||||
<%if @addTag%>
|
||||
<% if @obj_flag == '3'%>
|
||||
|
||||
$('#tags_show_issue').html('<%= escape_javascript(render :partial => 'tags/tag_name',
|
||||
<% if @addTag%>
|
||||
<% if @obj_flag == '3'%>
|
||||
$('#tags_show_issue').html('<%= escape_javascript(render :partial => 'tags/tag_name',
|
||||
:locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>');
|
||||
//$('#put-tag-form-issue').hide();
|
||||
$('#name-issue').val("");
|
||||
<% elsif @obj_flag == '6'%>
|
||||
$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty();
|
||||
$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/tag_name',
|
||||
//$('#put-tag-form-issue').hide();
|
||||
$('#name-issue').val("");
|
||||
<% elsif @obj_flag == '6'%>
|
||||
$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty();
|
||||
$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/tag_name',
|
||||
:locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>');
|
||||
$("#put-tag-form- <%=@obj.class%>- <%=@obj.id%>").hide();
|
||||
$("#put-tag-form-<%=@obj.class%>-<%=@obj.id%> #name").val("");
|
||||
<% else %>
|
||||
|
||||
$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_name',
|
||||
$("#put-tag-form- <%=@obj.class%>- <%=@obj.id%>").hide();
|
||||
$("#put-tag-form-<%=@obj.class%>-<%=@obj.id%> #name").val("");
|
||||
<% else %>
|
||||
$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_name',
|
||||
:locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>');
|
||||
$('#tags_show').html('<%=render_attachments_tag_save(@project, nil)%>');
|
||||
$('#put-tag-form #name').val("");
|
||||
//$('#put-tag-form').hide();
|
||||
<% end %>
|
||||
<%else%>
|
||||
$('#tags_show').html('<%=render_attachments_tag_save(@project, nil)%>');
|
||||
$('#put-tag-form #name').val("");
|
||||
//$('#put-tag-form').hide();
|
||||
<% end %>
|
||||
<% else %>
|
||||
$("#attachments_fields").children().remove();
|
||||
$("#upload_file_count").text("未上传文件");
|
||||
$('#upload_file_div').slideToggle('slow');
|
||||
<%if @project%>
|
||||
$("#all_browse_div").html('<%= j(render partial: "show_all_attachment")%>');
|
||||
<%elsif @course%>
|
||||
$("#all_browse_div").html('<%= j(render partial: "course_show_all_attachment")%>');
|
||||
closeModal();
|
||||
$("#resource_list").html('<%= j(render partial: "course_file" ,locals: {course: @course}) %>');
|
||||
<%end%>
|
||||
<% if @project%>
|
||||
closeModal();
|
||||
$("#resource_list").html('<%= j(render partial: "project_file_new" ,locals: {project: @project}) %>');
|
||||
<%elsif @course%>
|
||||
closeModal();
|
||||
$("#resource_list").html('<%= j(render partial: "course_file" ,locals: {course: @course}) %>');
|
||||
<% end %>
|
||||
<% end %>
|
||||
$(document).ready(img_thumbnails);
|
||||
|
||||
|
@ -0,0 +1,11 @@
|
||||
<% if @can_quote %>
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show_quote_resource_project',:locals => {:project => @project,:file => @file,:error => ''}) %>');
|
||||
<% else %>
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show_quote_resource_project',:locals => {:project => @project,:file => @file,:error => '403'}) %>');
|
||||
<% end %>
|
||||
|
||||
showModal('ajax-modal', '513px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'><a href='javascript:void(0)' onclick='closeModal()'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("popbox_polls");
|
@ -0,0 +1 @@
|
||||
$("#course_list").html("<%= escape_javascript(render :partial => 'project_file_list',:locals => {project: @project,all_attachments: @result,sort:@sort,order:@order,project_attachments:@searched_attach,:manage_allowed => User.current.allowed_to?(:manage_files, @project)})%>");
|
@ -1,27 +1,15 @@
|
||||
#!/usr/bin/env ruby
|
||||
#coding=utf-8
|
||||
|
||||
require 'rubygems'
|
||||
require 'rufus-scheduler'
|
||||
|
||||
#users = User.where("mail_notification = 'week' or mail_notification = 'day'")
|
||||
|
||||
scheduler = Rufus::Scheduler.new
|
||||
scheduler.cron('0 0 * * 1') do
|
||||
users = User.where("mail_notification = 'week'")
|
||||
users.each do |user|
|
||||
#Rails.logger.info "send mail to #{user.show_name}(#{user.mail}) at #{Time.now}"
|
||||
Thread.start do
|
||||
Mailer.send_for_user_activities(user, Date.today, 7).deliver
|
||||
end
|
||||
end
|
||||
end
|
||||
scheduler.cron('0 0 * * *') do
|
||||
users = User.where("mail_notification = 'day'")
|
||||
users.each do |user|
|
||||
#Rails.logger.info "send mail to #{user.show_name}(#{user.mail}) at #{Time.now}"
|
||||
Thread.start do
|
||||
Mailer.send_for_user_activities(user, Date.today, 1).deliver
|
||||
end
|
||||
end
|
||||
end
|
||||
## 移入crontab
|
||||
|
||||
# scheduler = Rufus::Scheduler.new
|
||||
#
|
||||
# #每天18:00发送当天的邮件汇总
|
||||
# scheduler.cron('0 18 * * *') do
|
||||
# users = User.where(mail_notification: 'day')
|
||||
# users.each do |user|
|
||||
# mailer = Mailer.send_for_user_activities(user, Date.today, 1)
|
||||
# mailer.deliver if mailer
|
||||
# end
|
||||
# end
|
||||
|
@ -0,0 +1,8 @@
|
||||
class ChnageMailNotificationWeekToDay < ActiveRecord::Migration
|
||||
def up
|
||||
User.where(mail_notification: 'week').update_all(mail_notification: 'day')
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
@ -0,0 +1,22 @@
|
||||
class CreateDelayedJobs < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :delayed_jobs, force: true do |table|
|
||||
table.integer :priority, default: 0, null: false # Allows some jobs to jump to the front of the queue
|
||||
table.integer :attempts, default: 0, null: false # Provides for retries, but still fail eventually.
|
||||
table.text :handler, null: false # YAML-encoded string of the object that will do work
|
||||
table.text :last_error # reason for last failure (See Note below)
|
||||
table.datetime :run_at # When to run. Could be Time.zone.now for immediately, or sometime in the future.
|
||||
table.datetime :locked_at # Set when a client is working on this object
|
||||
table.datetime :failed_at # Set when all retries have failed (actually, by default, the record is deleted instead)
|
||||
table.string :locked_by # Who is working on this object (if locked)
|
||||
table.string :queue # The name of the queue this job is in
|
||||
table.timestamps null: true
|
||||
end
|
||||
|
||||
add_index :delayed_jobs, [:priority, :run_at], name: "delayed_jobs_priority"
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :delayed_jobs
|
||||
end
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
class AddDelayjobEnabledToSettings < ActiveRecord::Migration
|
||||
def change
|
||||
Setting.create(name: 'delayjob_enabled', value: 1 )
|
||||
end
|
||||
end
|
@ -0,0 +1,14 @@
|
||||
class CreateZipPacks < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :zip_packs do |t|
|
||||
t.integer :user_id
|
||||
t.integer :homework_id
|
||||
t.string :file_digest
|
||||
t.string :file_path
|
||||
t.integer :pack_times, default: 1
|
||||
t.integer :pack_size, default: 0
|
||||
t.string :file_digests
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue