alan 10 years ago
commit 0af8c1cc38

@ -8,23 +8,26 @@ class AvatarController < ApplicationController
# Make sure that API users get used to set this content type # Make sure that API users get used to set this content type
# as it won't trigger Rails' automatic parsing of the request body for parameters # as it won't trigger Rails' automatic parsing of the request body for parameters
unless request.content_type == 'application/octet-stream' unless request.content_type == 'application/octet-stream'
render :nothing => true, :status => 406 @source_type = params[:source_type]
return
end
unless request.raw_post.nil?
@source_type = params[:source_type]
@source_id = params[:source_id] @source_id = params[:source_id]
@temp_file = request.raw_post @temp_file = params[:avatar][:image]
if @temp_file.size > 0 @image_file = @temp_file.original_filename
if @temp_file.respond_to?(:original_filename) else
@image_file = @temp_file.original_filename unless request.raw_post.nil?
#image_file.force_encoding("UTF-8") if filename.respond_to?(:force_encoding) @source_type = params[:source_type]
else @source_id = params[:source_id]
@image_file=params[:filename] @temp_file = request.raw_post
end if @temp_file.size > 0
if @temp_file.respond_to?(:original_filename)
@image_file = @temp_file.original_filename
#image_file.force_encoding("UTF-8") if filename.respond_to?(:force_encoding)
else
@image_file=params[:filename]
end
end
end end
end end
if @temp_file && (@temp_file.size > 0) if @temp_file && (@temp_file.size > 0)
diskfile=disk_filename(@source_type,@source_id) diskfile=disk_filename(@source_type,@source_id)
@urlfile='/' << File.join("images","avatars",avatar_directory(@source_type),avatar_filename(@source_id,@image_file)) @urlfile='/' << File.join("images","avatars",avatar_directory(@source_type),avatar_filename(@source_id,@image_file))
@ -61,6 +64,10 @@ class AvatarController < ApplicationController
image.compress(300) image.compress(300)
respond_to do |format| respond_to do |format|
format.json{
render :inline => "#{@urlfile.to_s}?#{Time.now.to_i}",:content_type => 'text/html'
return
}
format.js format.js
format.api { format.api {
if saved if saved

@ -5,6 +5,7 @@ class CoursesController < ApplicationController
helper :activities helper :activities
helper :members helper :members
helper :words helper :words
helper :attachments
before_filter :auth_login1, :only => [:show, :feedback] before_filter :auth_login1, :only => [:show, :feedback]
menu_item :overview menu_item :overview

@ -58,7 +58,7 @@ class IssuesController < ApplicationController
def index def index
retrieve_query retrieve_query
sort_init(@query.sort_criteria.empty? ? [['updated_on', 'desc']] : @query.sort_criteria) sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria)
sort_update(@query.sortable_columns) sort_update(@query.sortable_columns)
@query.sort_criteria = sort_criteria.to_a @query.sort_criteria = sort_criteria.to_a
@ -387,7 +387,7 @@ class IssuesController < ApplicationController
def retrieve_previous_and_next_issue_ids def retrieve_previous_and_next_issue_ids
retrieve_query_from_session retrieve_query_from_session
if @query if @query
sort_init(@query.sort_criteria.empty? ? [['updated_on', 'desc']] : @query.sort_criteria) sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria)
sort_update(@query.sortable_columns, 'issues_index_sort') sort_update(@query.sortable_columns, 'issues_index_sort')
limit = 500 limit = 500
issue_ids = @query.issue_ids(:order => sort_clause, :limit => (limit + 1), :include => [:assigned_to, :tracker, :priority, :category, :fixed_version]) issue_ids = @query.issue_ids(:order => sort_clause, :limit => (limit + 1), :include => [:assigned_to, :tracker, :priority, :category, :fixed_version])

@ -1770,8 +1770,7 @@ module ApplicationHelper
def get_memo def get_memo
@new_memo = Memo.new @new_memo = Memo.new
#@new_memo.subject = "有什么想说的,尽管来咆哮吧~~" @public_forum = Forum.find(1) rescue ActiveRecord::RecordNotFound
@public_forum = Forum.find(1)
end end
#获取用户未过期的课程 #获取用户未过期的课程

@ -32,6 +32,8 @@ class Token < ActiveRecord::Base
token = Token.get_token_from_user(user, 'autologin') token = Token.get_token_from_user(user, 'autologin')
unless token unless token
token = Token.create(:user => user, :action => 'autologin') token = Token.create(:user => user, :action => 'autologin')
else
token.update_attribute(:created_on, Time.now)
end end
token token
end end

@ -7,8 +7,7 @@
:id => nil, :id => nil,
:class => 'upload_file', :class => 'upload_file',
:size => "1", :size => "1",
:multiple => false, :multiple => true,
:onchange => 'addInputAvatar(this);',
:data => { :data => {
:max_file_size => Setting.attachment_max_size.to_i.kilobytes, :max_file_size => Setting.attachment_max_size.to_i.kilobytes,
:max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)), :max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
@ -22,6 +21,6 @@
} %> } %>
<!--</span>--> <!--</span>-->
<% content_for :header_tags do %> <% content_for :header_tags do %>
<%= javascript_include_tag 'avatars' %> <%= javascript_include_tag 'jq-upload/jquery.ui.widget', 'jq-upload/jquery.iframe-transport', 'jq-upload/jquery.fileupload', 'jq-upload/upload' %>
<% end %> <% end %>
<div class="cl"></div> <div class="cl"></div>

@ -1,4 +1,4 @@
var imgSpan = $('#avatar_image'); var imgSpan = jQuery('#avatar_image');
imgSpan.attr({"src":'<%= "#{@urlfile.to_s}?#{Time.now.to_i}" %>'}); imgSpan.attr({"src":'<%= "#{@urlfile.to_s}?#{Time.now.to_i}" %>'});

@ -56,7 +56,7 @@
</p> </p>
<p class="stats"> <p class="stats">
<%= content_tag('span', "#{garble @course.members.count}", :class => "info") %> <%= content_tag('span', "#{garble @course.members.count}", :class => "info") %>
<%= content_tag('span', l(:label_x_member, :count => memberCount(@course))) %> <%= content_tag('span', l(:label_x_member, :count => @course.members.count)) %>
</p> </p>
<!--gcm--> <!--gcm-->

@ -21,6 +21,7 @@
<br /> <br />
<%= l :label_activity_time %> <%= format_activity_day(day) %>&nbsp;<%= format_time(e.event_datetime, false) %> <%= l :label_activity_time %> <%= format_activity_day(day) %>&nbsp;<%= format_time(e.event_datetime, false) %>
</p> </p>
<%= link_to_attachments_course(e) if e.is_a?(News) %>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
</div><!--课程动态 end--> </div><!--课程动态 end-->
@ -49,4 +50,4 @@
<ul class="wlist"> <ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%> <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul> </ul>
<div class="cl"></div> <div class="cl"></div>

@ -39,13 +39,21 @@
</div> </div>
<% end %> <% end %>
<%# --版本库被设置成私有、module中设置不显示、没有创建版本库 三种情况不显示-- %> <%# --版本库被设置成私有、module中设置不显示、没有创建版本库 三种情况不显示-- %>
<% unless @project.hidden_repo || @project.enabled_modules.where("name = 'repository'").empty? || @project.repositories.count == 0 %> <% unless @project.enabled_modules.where("name = 'repository'").empty? || @project.repositories.count == 0 %>
<div class="subNav"> <% if @project.hidden_repo || !@project.is_public? %>
<%= link_to l(:project_module_repository), {:controller => 'repositories', :action => 'show', :id => @project.id}, :class => "f14 c_blue02" %> <% if User.current.member_of?(@project) %>
<a class="subnav_num">(<%= @project.repositories.count %>)</a> <div class="subNav">
</div> <%= link_to l(:project_module_repository), {:controller => 'repositories', :action => 'show', :id => @project.id}, :class => "f14 c_blue02" %>
<% end %><!--meny end --> <a class="subnav_num">(<%= @project.repositories.count %>)</a>
</div>
<% end %>
<% else %>
<div class="subNav">
<%= link_to l(:project_module_repository), {:controller => 'repositories', :action => 'show', :id => @project.id}, :class => "f14 c_blue02" %>
<a class="subnav_num">(<%= @project.repositories.count %>)</a>
</div>
<% end %>
<% end %>
<!-- more --> <!-- more -->
<div class="subNav subNav_jiantou" onclick="$('#navContent').toggle(500);" id="expand_tools_expand"><%= l(:label_project_more) %></div> <div class="subNav subNav_jiantou" onclick="$('#navContent').toggle(500);" id="expand_tools_expand"><%= l(:label_project_more) %></div>
<ul class="navContent" id="navContent"> <ul class="navContent" id="navContent">

@ -168,6 +168,7 @@ function cookieget(n)
<div class="side_title"><a title="<%= l(:label_feedback) %>" class="close_btn"><span><%= l(:label_feedback) %></span></a></div> <div class="side_title"><a title="<%= l(:label_feedback) %>" class="close_btn"><span><%= l(:label_feedback) %></span></a></div>
<div class="side_center"> <div class="side_center">
<div class="custom_service"> <div class="custom_service">
<% if @public_forum %>
<% get_memo %> <% get_memo %>
<%= form_for(@new_memo, :url => create_feedback_forum_path(@public_forum)) do |f| %> <%= form_for(@new_memo, :url => create_feedback_forum_path(@public_forum)) do |f| %>
<%= f.text_area :subject,:id=>"subject", :class => "opnionText", :placeholder => l(:label_feedback_tips) %> <%= f.text_area :subject,:id=>"subject", :class => "opnionText", :placeholder => l(:label_feedback_tips) %>
@ -176,6 +177,7 @@ function cookieget(n)
<label class="c_grey">您还能输入<span id="textCount" class="c_orange">50</span>个字符</label> <label class="c_grey">您还能输入<span id="textCount" class="c_orange">50</span>个字符</label>
<a href="javascript:void(0);" class="opnionButton" style=" color:#fff;" id="" onclick="f_submit();"><%= l(:label_submit)%></a> <a href="javascript:void(0);" class="opnionButton" style=" color:#fff;" id="" onclick="f_submit();"><%= l(:label_submit)%></a>
<% end %> <% end %>
<% end %>
</div> </div>
<div class="msgserver"> <div class="msgserver">
<a href="http://user.trustie.net/users/34/user_newfeedback" style="color: #15BCCF;"><%= l(:label_technical_support) %>白&nbsp;&nbsp;&nbsp;羽</a> <a href="http://user.trustie.net/users/34/user_newfeedback" style="color: #15BCCF;"><%= l(:label_technical_support) %>白&nbsp;&nbsp;&nbsp;羽</a>

@ -3,7 +3,6 @@
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>升级浏览器</title> <title>升级浏览器</title>
<script src="jquery-1.8.3-ui-1.9.2-ujs-2.0.3.js" type="text/javascript"></script>
<style type="text/css"> <style type="text/css">
body{ font-size:12px; font-family:"微软雅黑","宋体"; background: #F2F2F2; font-style:normal;} body{ font-size:12px; font-family:"微软雅黑","宋体"; background: #F2F2F2; font-style:normal;}
.update{ border-bottom:1px solid #d7d7d7; color:#fea254; text-align:center; width:100%; font-size:10px; height:30px; background:#fdffd9; padding:2px 0;z-index:1000;} .update{ border-bottom:1px solid #d7d7d7; color:#fea254; text-align:center; width:100%; font-size:10px; height:30px; background:#fdffd9; padding:2px 0;z-index:1000;}

@ -44,6 +44,7 @@
<span class="g-arr-down"></span> <span class="g-arr-down"></span>
</div> </div>
<span class="fl"><%= l(:label_create_time)%><%= format_time(news.created_on)%></span> <span class="fl"><%= l(:label_create_time)%><%= format_time(news.created_on)%></span>
<%= link_to_attachments_course news %>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
</div><!--problem_main end--> </div><!--problem_main end-->

@ -75,7 +75,7 @@
<% unless judge_main_repository(@project) %> <% unless judge_main_repository(@project) %>
<li> <li>
<label class="label02"><%=l(:field_repository_is_default)%></label> <label class="label02"><%=l(:field_repository_is_default)%></label>
<%= f.check_box :is_default, :label => "" %></p> <%= f.check_box :is_default, :label => "", :no_label => true %></p>
</li> </li>
<% end %> <% end %>
<li > <li >

@ -112,8 +112,8 @@
<%= l(:label_latest_revision_plural) %> <%= l(:label_latest_revision_plural) %>
</h3> </h3>
<%= render :partial => 'revisions', <%= render :partial => 'revisions',
:locals => {:project => @project, :path => @path, :locals => {:project => @project, :path => @path,
:revisions => @changesets, :entry => nil} %> :revisions => @changesets, :entry => nil} %>
<% end %> <% end %>
<p style="padding-top: 10px;"> <p style="padding-top: 10px;">
<% has_branches = (!@repository.branches.nil? && @repository.branches.length > 0) <% has_branches = (!@repository.branches.nil? && @repository.branches.length > 0)

@ -683,4 +683,4 @@
}); });
}); });
</script> </script>
<% html_title(l(:label_activity)) -%> <% html_title(l(:label_activity)) -%>

@ -0,0 +1,9 @@
class ChangeAutologinFromSettings < ActiveRecord::Migration
def up
Setting.where(name: 'autologin').update_all(value: 60)
end
def down
Setting.where(name: 'autologin').update_all(value: 7)
end
end

@ -54,9 +54,9 @@ module RailsKindeditor
if(old_onload_#{random_name}) old_onload_#{random_name}(); if(old_onload_#{random_name}) old_onload_#{random_name}();
}" }"
else else
"KindEditor.ready(function(K){ "$(function(){KindEditor.ready(function(K){
#{editor_id}K.create('##{dom_id}', #{get_options(options).to_json}).loadPlugin('paste'); #{editor_id}K.create('##{dom_id}', #{get_options(options).to_json}).loadPlugin('paste');
});" });});"
end end
end end

@ -22,7 +22,7 @@ module Trustie
end end
end end
rescue Exception => e rescue Exception => e
logger.error "[Error] compress : ===> #{e}" Rails.logger.error "[Error] compress : ===> #{e}"
end end
end end

File diff suppressed because it is too large Load Diff

@ -578,7 +578,7 @@ function setupHeartBeat(){
function setupAjaxIndicator() { function setupAjaxIndicator() {
$('#ajax-indicator').bind('ajaxSend', function(event, xhr, settings) { $('#ajax-indicator').bind('ajaxSend', function(event, xhr, settings) {
if(settings && settings.url && settings.url.endsWith('account/heartbeat')){ if(settings && settings.url && settings.url.match(/account\/heartbeat$/)){
return; return;
} }
if ($('.ajax-loading').length === 0 && settings.contentType != 'application/octet-stream') { if ($('.ajax-loading').length === 0 && settings.contentType != 'application/octet-stream') {

@ -52,13 +52,14 @@ function ajaxUpload(file, fileSpan, inputEl) {
fileSpan.removeClass('ajax-loading'); fileSpan.removeClass('ajax-loading');
var form = fileSpan.parents('form'); var form = fileSpan.parents('form');
if (form.queue('upload').length == 0 && ajaxUpload.uploading == 0) { // if (form.queue('upload').length == 0 && ajaxUpload.uploading == 0) {
$('input:submit', form).removeAttr('disabled'); // $('input:submit', form).removeAttr('disabled');
} // }
form.dequeue('upload'); // form.dequeue('upload');
}); });
} }
var progressSpan = $('#upload_progressbar'); var progressSpan = $('#upload_progressbar');
progressSpan.progressbar(); progressSpan.progressbar();
fileSpan.addClass('ajax-waiting'); fileSpan.addClass('ajax-waiting');

File diff suppressed because it is too large Load Diff

@ -0,0 +1,217 @@
/*
* jQuery Iframe Transport Plugin 1.8.3
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2011, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/MIT
*/
/* global define, require, window, document */
(function (factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
// Register as an anonymous AMD module:
define(['jquery'], factory);
} else if (typeof exports === 'object') {
// Node/CommonJS:
factory(require('jquery'));
} else {
// Browser globals:
factory(window.jQuery);
}
}(function ($) {
'use strict';
// Helper variable to create unique names for the transport iframes:
var counter = 0;
// The iframe transport accepts four additional options:
// options.fileInput: a jQuery collection of file input fields
// options.paramName: the parameter name for the file form data,
// overrides the name property of the file input field(s),
// can be a string or an array of strings.
// options.formData: an array of objects with name and value properties,
// equivalent to the return data of .serializeArray(), e.g.:
// [{name: 'a', value: 1}, {name: 'b', value: 2}]
// options.initialIframeSrc: the URL of the initial iframe src,
// by default set to "javascript:false;"
$.ajaxTransport('iframe', function (options) {
if (options.async) {
// javascript:false as initial iframe src
// prevents warning popups on HTTPS in IE6:
/*jshint scripturl: true */
var initialIframeSrc = options.initialIframeSrc || 'javascript:false;',
/*jshint scripturl: false */
form,
iframe,
addParamChar;
return {
send: function (_, completeCallback) {
form = $('<form style="display:none;"></form>');
form.attr('accept-charset', options.formAcceptCharset);
addParamChar = /\?/.test(options.url) ? '&' : '?';
// XDomainRequest only supports GET and POST:
if (options.type === 'DELETE') {
options.url = options.url + addParamChar + '_method=DELETE';
options.type = 'POST';
} else if (options.type === 'PUT') {
options.url = options.url + addParamChar + '_method=PUT';
options.type = 'POST';
} else if (options.type === 'PATCH') {
options.url = options.url + addParamChar + '_method=PATCH';
options.type = 'POST';
}
// IE versions below IE8 cannot set the name property of
// elements that have already been added to the DOM,
// so we set the name along with the iframe HTML markup:
counter += 1;
iframe = $(
'<iframe src="' + initialIframeSrc +
'" name="iframe-transport-' + counter + '"></iframe>'
).bind('load', function () {
var fileInputClones,
paramNames = $.isArray(options.paramName) ?
options.paramName : [options.paramName];
iframe
.unbind('load')
.bind('load', function () {
var response;
// Wrap in a try/catch block to catch exceptions thrown
// when trying to access cross-domain iframe contents:
try {
response = iframe.contents();
// Google Chrome and Firefox do not throw an
// exception when calling iframe.contents() on
// cross-domain requests, so we unify the response:
if (!response.length || !response[0].firstChild) {
throw new Error();
}
} catch (e) {
response = undefined;
}
// The complete callback returns the
// iframe content document as response object:
completeCallback(
200,
'success',
{'iframe': response}
);
// Fix for IE endless progress bar activity bug
// (happens on form submits to iframe targets):
$('<iframe src="' + initialIframeSrc + '"></iframe>')
.appendTo(form);
window.setTimeout(function () {
// Removing the form in a setTimeout call
// allows Chrome's developer tools to display
// the response result
form.remove();
}, 0);
});
form
.prop('target', iframe.prop('name'))
.prop('action', options.url)
.prop('method', options.type);
if (options.formData) {
$.each(options.formData, function (index, field) {
$('<input type="hidden"/>')
.prop('name', field.name)
.val(field.value)
.appendTo(form);
});
}
if (options.fileInput && options.fileInput.length &&
options.type === 'POST') {
fileInputClones = options.fileInput.clone();
// Insert a clone for each file input field:
options.fileInput.after(function (index) {
return fileInputClones[index];
});
if (options.paramName) {
options.fileInput.each(function (index) {
$(this).prop(
'name',
paramNames[index] || options.paramName
);
});
}
// Appending the file input fields to the hidden form
// removes them from their original location:
form
.append(options.fileInput)
.prop('enctype', 'multipart/form-data')
// enctype must be set as encoding for IE:
.prop('encoding', 'multipart/form-data');
// Remove the HTML5 form attribute from the input(s):
options.fileInput.removeAttr('form');
}
form.submit();
// Insert the file input fields at their original location
// by replacing the clones with the originals:
if (fileInputClones && fileInputClones.length) {
options.fileInput.each(function (index, input) {
var clone = $(fileInputClones[index]);
// Restore the original name and form properties:
$(input)
.prop('name', clone.prop('name'))
.attr('form', clone.attr('form'));
clone.replaceWith(input);
});
}
});
form.append(iframe).appendTo(document.body);
},
abort: function () {
if (iframe) {
// javascript:false as iframe src aborts the request
// and prevents warning popups on HTTPS in IE6.
// concat is used to avoid the "Script URL" JSLint error:
iframe
.unbind('load')
.prop('src', initialIframeSrc);
}
if (form) {
form.remove();
}
}
};
}
});
// The iframe transport returns the iframe content document as response.
// The following adds converters from iframe to text, json, html, xml
// and script.
// Please note that the Content-Type for JSON responses has to be text/plain
// or text/html, if the browser doesn't include application/json in the
// Accept header, else IE will show a download dialog.
// The Content-Type for XML responses on the other hand has to be always
// application/xml or text/xml, so IE properly parses the XML response.
// See also
// https://github.com/blueimp/jQuery-File-Upload/wiki/Setup#content-type-negotiation
$.ajaxSetup({
converters: {
'iframe text': function (iframe) {
return iframe && $(iframe[0].body).text();
},
'iframe json': function (iframe) {
return iframe && $.parseJSON($(iframe[0].body).text());
},
'iframe html': function (iframe) {
return iframe && $(iframe[0].body).html();
},
'iframe xml': function (iframe) {
var xmlDoc = iframe && iframe[0];
return xmlDoc && $.isXMLDoc(xmlDoc) ? xmlDoc :
$.parseXML((xmlDoc.XMLDocument && xmlDoc.XMLDocument.xml) ||
$(xmlDoc.body).html());
},
'iframe script': function (iframe) {
return iframe && $.globalEval($(iframe[0].body).text());
}
}
});
}));

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…
Cancel
Save