diff --git a/.gitignore b/.gitignore index 163982b7c..29bd2c4fd 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ /db/schema.rb /Gemfile.lock /lib/plugins/acts_as_versioned/test/debug.log +/config/configuration.yml diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 131c72c8c..ecc7a8d91 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -165,6 +165,31 @@ class Mailer < ActionMailer::Base :subject => l(:mail_subject_reminder, :count => issues.size, :days => days) end + #缺陷到期邮件通知 + def issue_expire issue + #@issues = issues + #s = l(:text_issue_expire,:issue => "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}") + #puts s + "////" + issue.assigned_to.mail + #@issues_url = url_for(:controller => 'issues', :action => 'show',:id => issue.id) + #mail :to => issue.assigned_to.mail, + # :subject => s + issue_id = issue.project_index + redmine_headers 'Project' => issue.project.identifier, + 'Issue-Id' => issue_id, + 'Issue-Author' => issue.author.login + redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to + message_id issue + @author = issue.author + @issue = issue + @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue) + recipients = issue.recipients + cc = issue.watcher_recipients - recipients + mail :to => recipients, + :cc => cc, + :subject => "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}" + end + + # Builds a Mail::Message object used to email users belonging to the added document's project. # # Example: @@ -541,6 +566,35 @@ class Mailer < ActionMailer::Base end end + #缺陷到期后发送邮件提示 + def mail_issue + threads = [] + issues = Issue.where("done_ratio <> 100 && closed_on is null && due_date is not null") + issues.each do |issue| + thread = Thread.start do + while true + cur_issue = Issue.find issue.id + if cur_issue.done_ratio == 100 || cur_issue.closed_on != nil + break + end + if Time.now < Time.parse(cur_issue.due_date.to_s) + #休眠一个小时。。。 + sleep 3600 + else + #发邮件 + puts issue.id.to_s + Mailer.issue_expire(issue).deliver + #Mailer.issue_add(issue).deliver + break + end + end + end + threads << thread + end + puts threads.count.to_s + threads + end + private # Appends a Redmine header field (name is prepended with 'X-Redmine-') @@ -571,4 +625,6 @@ class Mailer < ActionMailer::Base def mylogger Rails.logger end + + end diff --git a/app/views/bids/_homework_list.html.erb b/app/views/bids/_homework_list.html.erb index b58f918df..2009d1252 100644 --- a/app/views/bids/_homework_list.html.erb +++ b/app/views/bids/_homework_list.html.erb @@ -106,7 +106,7 @@ 提交文件:  <% if is_evaluation || is_teacher%> - <%= link_to "打包下载", :controller => "zipdown", :action => "download_user_homework",:homework => homework%> + <%= link_to "打包下载", :controller => "zipdown", :action => "download_user_homework",:homework => homework, :remote => true%> <% else %> 未开启互评功能作业不允许下载 <% end %> diff --git a/app/views/homework_attach/new.html.erb b/app/views/homework_attach/new.html.erb index 6f5c56c5a..d05dfb735 100644 --- a/app/views/homework_attach/new.html.erb +++ b/app/views/homework_attach/new.html.erb @@ -35,6 +35,10 @@

描      述  : + + <%= f.text_area "description", :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;" %>

diff --git a/app/views/layouts/base_users.html.erb b/app/views/layouts/base_users.html.erb index 45d76a57c..aa0e66ed8 100644 --- a/app/views/layouts/base_users.html.erb +++ b/app/views/layouts/base_users.html.erb @@ -93,30 +93,30 @@ - <% messages_count = @user.messages.count %> - <% messages_score = messages_count * 0.05%> - <% finall_messages_score = messages_score %> + <%# messages_count = @user.messages.count %> + <%# messages_score = messages_count * 0.05%> + <%# finall_messages_score = messages_score %> - <% journals_count = @user.journals.count %> - <% journals_score = journals_count * 0.1 %> - <% user_changesets_count = @user.changesets.count %> - <% user_changesets_score = user_changesets_count * 0.3 %> - <% finall_user_project_score = journals_score + user_changesets_score %> + <%# journals_count = @user.journals.count %> + <%# journals_score = journals_count * 0.1 %> + <%# user_changesets_count = @user.changesets.count %> + <%# user_changesets_score = user_changesets_count * 0.3 %> + <%# finall_user_project_score = journals_score + user_changesets_score %> - <% journals_for_messages_count = @user.journals_messages.count %> - <% activities_count = @user.activities.count %> - <% journals_for_messages_score = journals_for_messages_count * 0.05 %> - <% activities_score = activities_count * 0.2 %> - <% finall_activity_score = journals_for_messages_score + activities_score %> + <%# journals_for_messages_count = @user.journals_messages.count %> + <%# activities_count = @user.activities.count %> + <%# journals_for_messages_score = journals_for_messages_count * 0.05 %> + <%# activities_score = activities_count * 0.2 %> + <%# finall_activity_score = journals_for_messages_score + activities_score %> - <% news_count = @user.news.count %> - <% news_score = news_count * 0.1 %> - <% wiki_contents_count = @user.wiki_contents.count %> - <% wiki_contents_score = wiki_contents_count * 0.1 %> - <% comments_count = @user.comments.count %> - <% comments_score = comments_count * 0.1 %> - <% finall_influence_score = news_score + wiki_contents_score + comments_score %> - <% finall_user_score = finall_messages_score + finall_user_project_score + finall_activity_score + finall_influence_score %> + <%# news_count = @user.news.count %> + <%# news_score = news_count * 0.1 %> + <%# wiki_contents_count = @user.wiki_contents.count %> + <%# wiki_contents_score = wiki_contents_count * 0.1 %> + <%# comments_count = @user.comments.count %> + <%# comments_score = comments_count * 0.1 %> + <%# finall_influence_score = news_score + wiki_contents_score + comments_score %> + <%# finall_user_score = finall_messages_score + finall_user_project_score + finall_activity_score + finall_influence_score %> diff --git a/app/views/memos/show.html.erb b/app/views/memos/show.html.erb index 830f18d85..2c3248d06 100644 --- a/app/views/memos/show.html.erb +++ b/app/views/memos/show.html.erb @@ -7,7 +7,7 @@
-

+

- -<% messages_count = @user.messages.count %> -<% messages_score = messages_count * 0.05%> -<% finall_messages_score = messages_score %> +<%# messages_count = @user.messages.count %> +<%# messages_score = messages_count * 0.05%> +<%# finall_messages_score = messages_score %> -<% journals_count = @user.journals.count %> -<% journals_score = journals_count * 0.1 %> -<% user_changesets_count = @user.changesets.count %> -<% user_changesets_score = user_changesets_count * 0.3 %> -<% finall_user_project_score = journals_score + user_changesets_score %> +<%# journals_count = @user.journals.count %> +<%# journals_score = journals_count * 0.1 %> +<%# user_changesets_count = @user.changesets.count %> +<%# user_changesets_score = user_changesets_count * 0.3 %> +<%# finall_user_project_score = journals_score + user_changesets_score %> -<% journals_for_messages_count = @user.journals_messages.count %> -<% activities_count = @user.activities.count %> -<% journals_for_messages_score = journals_for_messages_count * 0.05 %> -<% activities_score = activities_count * 0.2 %> -<% finall_activity_score = journals_for_messages_score + activities_score %> +<%# journals_for_messages_count = @user.journals_messages.count %> +<%# activities_count = @user.activities.count %> +<%# journals_for_messages_score = journals_for_messages_count * 0.05 %> +<%# activities_score = activities_count * 0.2 %> +<%# finall_activity_score = journals_for_messages_score + activities_score %> -<% news_count = @user.news.count %> -<% news_score = news_count * 0.1 %> -<% wiki_contents_count = @user.wiki_contents.count %> -<% wiki_contents_score = wiki_contents_count * 0.1 %> -<% comments_count = @user.comments.count %> -<% comments_score = comments_count * 0.1 %> -<% finall_influence_score = news_score + wiki_contents_score + comments_score %> -<% finall_user_score = finall_messages_score + finall_user_project_score + finall_activity_score + finall_influence_score %> +<%# news_count = @user.news.count %> +<%# news_score = news_count * 0.1 %> +<%# wiki_contents_count = @user.wiki_contents.count %> +<%# wiki_contents_score = wiki_contents_count * 0.1 %> +<%# comments_count = @user.comments.count %> +<%# comments_score = comments_count * 0.1 %> +<%# finall_influence_score = news_score + wiki_contents_score + comments_score %> +<%# finall_user_score = finall_messages_score + finall_user_project_score + finall_activity_score + finall_influence_score %>
<%= l(:label_user_score) %>
= <%= l(:label_user_score_of_collaboration) %> + <%= l(:label_user_score_of_influence) %> + <%= l(:label_user_score_of_skill)%> + <%= l(:label_user_score_of_active) %>
- +
= <%= format("%.2f" ,@user.user_score_attr.collaboration.nil? ? 0:@user.user_score_attr.collaboration).to_i %> + <%= format("%.2f" , @user.user_score_attr.influence.nil? ? 0:@user.user_score_attr.influence ).to_i %> + <%= format("%.2f" , @user.user_score_attr.skill.nil? ? 0:@user.user_score_attr.skill).to_i %> + <%= format("%.2f" , @user.user_score_attr.active.nil? ? 0:@user.user_score_attr.active).to_i %>
= <%= format("%.2f" ,@user.user_score_attr.total_score.nil? ? 0:@user.user_score_attr.total_score).to_i %>
diff --git a/app/views/users/_show_new_score.html.erb b/app/views/users/_show_new_score.html.erb index fddca46ac..e9ca499f4 100644 --- a/app/views/users/_show_new_score.html.erb +++ b/app/views/users/_show_new_score.html.erb @@ -1,28 +1,28 @@ -<% messages_count = @user.messages.count %> -<% messages_score = messages_count * 0.05%> -<% finall_messages_score = messages_score %> +<%# messages_count = @user.messages.count %> +<%# messages_score = messages_count * 0.05%> +<%# finall_messages_score = messages_score %> -<% journals_count = @user.journals.count %> -<% journals_score = journals_count * 0.1 %> -<% user_changesets_count = @user.changesets.count %> -<% user_changesets_score = user_changesets_count * 0.3 %> -<% finall_user_project_score = journals_score + user_changesets_score %> +<%# journals_count = @user.journals.count %> +<%# journals_score = journals_count * 0.1 %> +<%# user_changesets_count = @user.changesets.count %> +<%# user_changesets_score = user_changesets_count * 0.3 %> +<%# finall_user_project_score = journals_score + user_changesets_score %> -<% journals_for_messages_count = @user.journals_messages.count %> -<% activities_count = @user.activities.count %> -<% journals_for_messages_score = journals_for_messages_count * 0.05 %> -<% activities_score = activities_count * 0.2 %> -<% finall_activity_score = journals_for_messages_score + activities_score %> +<%# journals_for_messages_count = @user.journals_messages.count %> +<%# activities_count = @user.activities.count %> +<%# journals_for_messages_score = journals_for_messages_count * 0.05 %> +<%# activities_score = activities_count * 0.2 %> +<%# finall_activity_score = journals_for_messages_score + activities_score %> -<% news_count = @user.news.count %> -<% news_score = news_count * 0.1 %> -<% wiki_contents_count = @user.wiki_contents.count %> -<% wiki_contents_score = wiki_contents_count * 0.1 %> -<% comments_count = @user.comments.count %> -<% comments_score = comments_count * 0.1 %> -<% finall_influence_score = news_score + wiki_contents_score + comments_score %> -<% finall_user_score = finall_messages_score + finall_user_project_score + finall_activity_score + finall_influence_score %> +<%# news_count = @user.news.count %> +<%# news_score = news_count * 0.1 %> +<%# wiki_contents_count = @user.wiki_contents.count %> +<%# wiki_contents_score = wiki_contents_count * 0.1 %> +<%# comments_count = @user.comments.count %> +<%# comments_score = comments_count * 0.1 %> +<%# finall_influence_score = news_score + wiki_contents_score + comments_score %> +<%# finall_user_score = finall_messages_score + finall_user_project_score + finall_activity_score + finall_influence_score %>

<%= l(:label_user_score) %>

diff --git a/app/views/zipdown/file_not_fond.js.erb b/app/views/zipdown/file_not_fond.js.erb new file mode 100644 index 000000000..28b6d886f --- /dev/null +++ b/app/views/zipdown/file_not_fond.js.erb @@ -0,0 +1 @@ +alert("对不起,这个文件暂时不能下载。 "); \ No newline at end of file diff --git a/app/views/zipdown/no_file_dowmload.js.erb b/app/views/zipdown/no_file_dowmload.js.erb new file mode 100644 index 000000000..372da5ac5 --- /dev/null +++ b/app/views/zipdown/no_file_dowmload.js.erb @@ -0,0 +1 @@ +alert('<%=l(:no_file_dowmload)%>'); \ No newline at end of file diff --git a/config/initializers/task.rb b/config/initializers/task.rb new file mode 100644 index 000000000..f42741864 --- /dev/null +++ b/config/initializers/task.rb @@ -0,0 +1,4 @@ +#Mailer.mail_issue.each do |t| +# t.join +#end + diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 3b0c49029..439661a27 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1134,6 +1134,7 @@ zh: text_zoom_in: 放大 text_zoom_out: 缩小 text_applied_project: "用户 %{id} 申请加入项目 %{project}" + text_issue_expire: "分配给您的任务%{issue}即将到期" default_role_manager: 管理人员 default_role_developer: 开发人员 diff --git a/plugins/redmine_ckeditor/assets/javascripts/application.js b/plugins/redmine_ckeditor/assets/javascripts/application.js index 03752bc9c..b5679d111 100644 --- a/plugins/redmine_ckeditor/assets/javascripts/application.js +++ b/plugins/redmine_ckeditor/assets/javascripts/application.js @@ -1,992 +1,992 @@ /* -Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ + Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved. + For licensing, see LICENSE.html or http://ckeditor.com/license + */ (function(){if(window.CKEDITOR&&window.CKEDITOR.dom)return;window.CKEDITOR||(window.CKEDITOR=function(){var a={timestamp:"E0LB",version:"4.3.2",revision:"ba625e6",rnd:Math.floor(900*Math.random())+100,_:{pending:[]},status:"unloaded",basePath:function(){var b=window.CKEDITOR_BASEPATH||"";if(!b)for(var d=document.getElementsByTagName("script"),a=0;a=0;o--)if(n[o].priority<=m){n.splice(o+1,0,j);return{removeListener:i}}n.unshift(j)}return{removeListener:i}}, -once:function(){var b=arguments[1];arguments[1]=function(d){d.removeListener();return b.apply(this,arguments)};return this.on.apply(this,arguments)},capture:function(){CKEDITOR.event.useCapture=1;var b=this.on.apply(this,arguments);CKEDITOR.event.useCapture=0;return b},fire:function(){var b=0,d=function(){b=1},a=0,h=function(){a=1};return function(m,j,i){var n=e(this)[m],m=b,r=a;b=a=0;if(n){var o=n.listeners;if(o.length)for(var o=o.slice(0),u,f=0;f=0&&a.listeners.splice(h,1)}},removeAllListeners:function(){var b=e(this),d;for(d in b)delete b[d]},hasListeners:function(b){return(b=e(this)[b])&&b.listeners.length>0}}}()); -CKEDITOR.editor||(CKEDITOR.editor=function(){CKEDITOR._.pending.push([this,arguments]);CKEDITOR.event.call(this)},CKEDITOR.editor.prototype.fire=function(a,e){a in{instanceReady:1,loaded:1}&&(this[a]=true);return CKEDITOR.event.prototype.fire.call(this,a,e,this)},CKEDITOR.editor.prototype.fireOnce=function(a,e){a in{instanceReady:1,loaded:1}&&(this[a]=true);return CKEDITOR.event.prototype.fireOnce.call(this,a,e,this)},CKEDITOR.event.implementOn(CKEDITOR.editor.prototype)); -CKEDITOR.env||(CKEDITOR.env=function(){var a=navigator.userAgent.toLowerCase(),e=window.opera,b={ie:a.indexOf("trident/")>-1,opera:!!e&&e.version,webkit:a.indexOf(" applewebkit/")>-1,air:a.indexOf(" adobeair/")>-1,mac:a.indexOf("macintosh")>-1,quirks:document.compatMode=="BackCompat"&&(!document.documentMode||document.documentMode<10),mobile:a.indexOf("mobile")>-1,iOS:/(ipad|iphone|ipod)/.test(a),isCustomDomain:function(){if(!this.ie)return false;var d=document.domain,b=window.location.hostname;return d!= -b&&d!="["+b+"]"},secure:location.protocol=="https:"};b.gecko=navigator.product=="Gecko"&&!b.webkit&&!b.opera&&!b.ie;if(b.webkit)a.indexOf("chrome")>-1?b.chrome=true:b.safari=true;var c=0;if(b.ie){c=b.quirks||!document.documentMode?parseFloat(a.match(/msie (\d+)/)[1]):document.documentMode;b.ie9Compat=c==9;b.ie8Compat=c==8;b.ie7Compat=c==7;b.ie6Compat=c<7||b.quirks}if(b.gecko){var d=a.match(/rv:([\d\.]+)/);if(d){d=d[1].split(".");c=d[0]*1E4+(d[1]||0)*100+(d[2]||0)*1}}b.opera&&(c=parseFloat(e.version())); -b.air&&(c=parseFloat(a.match(/ adobeair\/(\d+)/)[1]));b.webkit&&(c=parseFloat(a.match(/ applewebkit\/(\d+)/)[1]));b.version=c;b.isCompatible=b.iOS&&c>=534||!b.mobile&&(b.ie&&c>6||b.gecko&&c>=10801||b.opera&&c>=9.5||b.air&&c>=1||b.webkit&&c>=522||false);b.hidpi=window.devicePixelRatio>=2;b.needsBrFiller=b.gecko||b.webkit||b.ie&&c>10;b.needsNbspFiller=b.ie&&c<11;b.cssClass="cke_browser_"+(b.ie?"ie":b.gecko?"gecko":b.opera?"opera":b.webkit?"webkit":"unknown");if(b.quirks)b.cssClass=b.cssClass+" cke_browser_quirks"; -if(b.ie){b.cssClass=b.cssClass+(" cke_browser_ie"+(b.quirks||b.version<7?"6":b.version));if(b.quirks)b.cssClass=b.cssClass+" cke_browser_iequirks"}if(b.gecko)if(c<10900)b.cssClass=b.cssClass+" cke_browser_gecko18";else if(c<=11E3)b.cssClass=b.cssClass+" cke_browser_gecko19";if(b.air)b.cssClass=b.cssClass+" cke_browser_air";if(b.iOS)b.cssClass=b.cssClass+" cke_browser_ios";if(b.hidpi)b.cssClass=b.cssClass+" cke_hidpi";return b}()); -"unloaded"==CKEDITOR.status&&function(){CKEDITOR.event.implementOn(CKEDITOR);CKEDITOR.loadFullCore=function(){if(CKEDITOR.status!="basic_ready")CKEDITOR.loadFullCore._load=1;else{delete CKEDITOR.loadFullCore;var a=document.createElement("script");a.type="text/javascript";a.src=CKEDITOR.basePath+"ckeditor.js";document.getElementsByTagName("head")[0].appendChild(a)}};CKEDITOR.loadFullCoreTimeout=0;CKEDITOR.add=function(a){(this._.pending||(this._.pending=[])).push(a)};(function(){CKEDITOR.domReady(function(){var a= -CKEDITOR.loadFullCore,e=CKEDITOR.loadFullCoreTimeout;if(a){CKEDITOR.status="basic_ready";a&&a._load?a():e&&setTimeout(function(){CKEDITOR.loadFullCore&&CKEDITOR.loadFullCore()},e*1E3)}})})();CKEDITOR.status="basic_loaded"}();CKEDITOR.dom={}; -(function(){var a=[],e=CKEDITOR.env.gecko?"-moz-":CKEDITOR.env.webkit?"-webkit-":CKEDITOR.env.opera?"-o-":CKEDITOR.env.ie?"-ms-":"";CKEDITOR.on("reset",function(){a=[]});CKEDITOR.tools={arrayCompare:function(b,a){if(!b&&!a)return true;if(!b||!a||b.length!=a.length)return false;for(var d=0;d"+a+""):d.push('');return d.join("")},htmlEncode:function(b){return(""+b).replace(/&/g,"&").replace(/>/g,">").replace(//g,">")},htmlDecodeAttr:function(b){return b.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">")},getNextNumber:function(){var b=0;return function(){return++b}}(),getNextId:function(){return"cke_"+this.getNextNumber()},override:function(b,a){var d=a(b);d.prototype=b.prototype;return d},setTimeout:function(b,a,d,g,e){e||(e=window);d||(d=e);return e.setTimeout(function(){g?b.apply(d,[].concat(g)): -b.apply(d)},a||0)},trim:function(){var b=/(?:^[ \t\n\r]+)|(?:[ \t\n\r]+$)/g;return function(a){return a.replace(b,"")}}(),ltrim:function(){var b=/^[ \t\n\r]+/g;return function(a){return a.replace(b,"")}}(),rtrim:function(){var b=/[ \t\n\r]+$/g;return function(a){return a.replace(b,"")}}(),indexOf:function(b,a){if(typeof a=="function")for(var d=0,g=b.length;d=0?b[d]:null},bind:function(b,a){return function(){return b.apply(a,arguments)}},createClass:function(b){var a=b.$,d=b.base,g=b.privates||b._,e=b.proto,b=b.statics;!a&&(a=function(){d&&this.base.apply(this,arguments)});if(g)var m=a,a=function(){var d=this._||(this._={}),a;for(a in g){var b=g[a];d[a]=typeof b=="function"?CKEDITOR.tools.bind(b,this):b}m.apply(this,arguments)};if(d){a.prototype=this.prototypedCopy(d.prototype);a.prototype.constructor=a;a.base= -d;a.baseProto=d.prototype;a.prototype.base=function(){this.base=d.prototype.base;d.apply(this,arguments);this.base=arguments.callee}}e&&this.extend(a.prototype,e,true);b&&this.extend(a,b,true);return a},addFunction:function(b,c){return a.push(function(){return b.apply(c||this,arguments)})-1},removeFunction:function(b){a[b]=null},callFunction:function(b){var c=a[b];return c&&c.apply(window,Array.prototype.slice.call(arguments,1))},cssLength:function(){var a=/^-?\d+\.?\d*px$/,c;return function(d){c= -CKEDITOR.tools.trim(d+"")+"px";return a.test(c)?c:d||""}}(),convertToPx:function(){var a;return function(c){if(!a){a=CKEDITOR.dom.element.createFromHtml('
',CKEDITOR.document);CKEDITOR.document.getBody().append(a)}if(!/%$/.test(c)){a.setStyle("width",c);return a.$.clientWidth}return c}}(),repeat:function(a,c){return Array(c+1).join(a)},tryThese:function(){for(var a,c=0,d=arguments.length;c8)&&e)a=e+":"+a;return new CKEDITOR.dom.nodeList(this.$.getElementsByTagName(a))},getHead:function(){var a=this.$.getElementsByTagName("head")[0];return a= -a?new CKEDITOR.dom.element(a):this.getDocumentElement().append(new CKEDITOR.dom.element("head"),true)},getBody:function(){return new CKEDITOR.dom.element(this.$.body)},getDocumentElement:function(){return new CKEDITOR.dom.element(this.$.documentElement)},getWindow:function(){return new CKEDITOR.dom.window(this.$.parentWindow||this.$.defaultView)},write:function(a){this.$.open("text/html","replace");CKEDITOR.env.ie&&(a=a.replace(/(?:^\s*]*?>)|^/i,'$&\n