Merge branch 'yuanke' into develop

Conflicts:
	Gemfile
	public/stylesheets/new_user.css
This commit is contained in:
huang 2016-05-13 11:39:01 +08:00
commit 7759670fa1
15 changed files with 221 additions and 40 deletions

View File

@ -1,11 +1,13 @@
source 'https://rubygems.org/'
### 这里执行bundle config mirror.https://rubygems.org https://gems.ruby-china.org 切换到ruby-china源
### 这里执行bundle config mirror.https://rubygems.org https://gems.ruby-china.org 切换到ruby-china源
unless RUBY_PLATFORM =~ /w32/
# unix-like only
gem 'iconv'
end
gem 'certified'
gem 'wechat',path: 'lib/wechat'
gem 'grack', path:'lib/grack'
gem 'gitlab', path: 'lib/gitlab-cli'

View File

@ -123,6 +123,7 @@ class StudentWorkController < ApplicationController
#-1 默认值 0全部正确并结束 2 超时 -2 编译错误
resultObj[:status] = -1
resultObj[:results] = result["results"].first #本次测试结果
result["error_msg"] = result["error_msg"][0..2047]
resultObj[:error_msg] = result["error_msg"] #编译错误时的信息
#该状态用于存入CodeTests

View File

@ -5,7 +5,7 @@ PATH
rack (~> 1.5.1)
GEM
remote: https://ruby.taobao.org/
remote: https://rubygems.org/
specs:
byebug (4.0.5)
columnize (= 0.9.0)

View File

@ -118,6 +118,59 @@ class Kindeditor::AssetsController < ApplicationController
@result[:file_list] = @file_list
render :text => @result.to_json
end
#在KE里面复制粘贴的时候 把图片下载到服务器上
def uploadpic
picStr = params["pic"]
picArry = picStr.split("|")
#图片存放目录
dirPath = "public/files/uploads/image/"
dirDate = Time.now.strftime('%Y%m')
unless Dir.exist?("public")
Dir.mkdir("public")
end
unless Dir.exist?("public/files")
Dir.mkdir("public/files")
end
unless Dir.exist?("public/files/uploads")
Dir.mkdir("public/files/uploads")
end
unless Dir.exist?("public/files/uploads/image")
Dir.mkdir("public/files/uploads/image")
end
unless Dir.exist?(dirPath+dirDate)
Dir.mkdir(dirPath+dirDate)
end
fileStr = ""
picArry.each_with_index do |picUrl,index|
imgBaseName = File.basename(picUrl)
tmpImgType = imgBaseName.split(".").last.split("?")[0]
# 仅支持如下图片格式:bmp,jpeg,jpg,png,gif,BMP,JPEG,JPG,PNG,GIF
fileType = tmpImgType.match("gif|jpg|jpeg|png|bmp|BMP|JPEG|JPG|PNG|GIF")
fileName = fileType.nil? ? Time.now.to_i.to_s+index.to_s : Time.now.to_i.to_s+index.to_s+"."+fileType[0]
# fileType = File.basename(picurl).split(".").last[0..2]
# fileName = Time.now.to_i.to_s+index.to_s
fileDir = dirPath + dirDate + "/"+fileName
#重点!!
begin
File.open(fileDir,'wb'){ |f| f.write(open(picUrl).read) }
fileDir = fileDir.split("public")[1]
rescue
fileDir = picUrl
end
fileStr = fileStr+fileDir + "|"
end
render :text =>fileStr
end
private
def show_error(msg)

View File

@ -2,5 +2,6 @@ Rails.application.routes.draw do
namespace :kindeditor do
post "/upload" => "assets#create"
get "/filemanager" => "assets#list"
get "/uploadpic" => "assets#uploadpic"
end
end

View File

@ -3,8 +3,7 @@
// for (var property in myObject) {
// s = s + "\n "+property +": " + myObject[property] ;
// }
// alert(s);
//}
// alert(s)
/*******************************************************************************
* KindEditor - WYSIWYG HTML Editor for Internet
* Copyright (C) 2006-2013 kindsoft.net
@ -3788,6 +3787,7 @@ _extend(KEdit, KWidget, {
} else {
val = body.innerHTML;
}
//yk
if (self.beforeGetHtml) {
val = self.beforeGetHtml(val);
}
@ -5994,7 +5994,24 @@ _plugin('core', function(K) {
html = html.replace(/\n/g, '<br />$&');
}
}
self.insertHtml(html, true);
// var kePasteContainer = document.getElementById("ke_paste");
// if (kePasteContainer == null) {
// kePasteContainer = document.createElement("div");
// kePasteContainer.id = "ke_paste";
// var last=document.body.lastChild;//得到页面的最后个元素
// document.body.insertBefore(kePasteContainer,last);//在得到的最后元素之前插入
// }
// kePasteContainer.innerHTML = html;
// $("#ke_paste").hide();
//
// var imglist = $("#ke_paste").find("img");
//
// if (imglist.length > 0){
// df(self);
// }
self.insertHtml(html, true);
df(self);
}
K(doc.body).bind('paste', function(e){
if (self.pasteType === 0) {

View File

@ -1,8 +1,8 @@
// Generated by CoffeeScript 1.9.0
/*
paste.js is an interface to read data ( text / image ) from clipboard in different browsers. It also contains several hacks.
https://github.com/layerssss/paste.js
paste.js is an interface to read data ( text / image ) from clipboard in different browsers. It also contains several hacks.
https://github.com/layerssss/paste.js
*/
(function() {
@ -279,7 +279,7 @@ https://github.com/layerssss/paste.js
}
//firefox问题处理因为采用了 pastableContenteditable 模式,故只需要删除默认的粘贴
if ($(img).attr('src').startsWith('data:image/')) {
_results.push($(img).remove());
_results.push($(img).remove());
};
}
return _results;
@ -307,23 +307,23 @@ function enablePasteImg(_editor) {
$(nodeBody).pastableContenteditable();
dataURItoBlob = function(dataURI) {
// convert base64/URLEncoded data component to raw binary data held in a string
var byteString;
if (dataURI.split(',')[0].indexOf('base64') >= 0)
byteString = atob(dataURI.split(',')[1]);
else
byteString = unescape(dataURI.split(',')[1]);
// convert base64/URLEncoded data component to raw binary data held in a string
var byteString;
if (dataURI.split(',')[0].indexOf('base64') >= 0)
byteString = atob(dataURI.split(',')[1]);
else
byteString = unescape(dataURI.split(',')[1]);
// separate out the mime component
var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];
// separate out the mime component
var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];
// write the bytes of the string to a typed array
var ia = new Uint8Array(byteString.length);
for (var i = 0; i < byteString.length; i++) {
ia[i] = byteString.charCodeAt(i);
}
// write the bytes of the string to a typed array
var ia = new Uint8Array(byteString.length);
for (var i = 0; i < byteString.length; i++) {
ia[i] = byteString.charCodeAt(i);
}
return new Blob([ia], {type:mimeString});
return new Blob([ia], {type:mimeString});
};
$(nodeBody).on('pasteImage', function(ev, data) {
@ -337,18 +337,104 @@ function enablePasteImg(_editor) {
data.append("imgFile",blob, "imageFilename.png");
console.log(data);
$.ajax({
url: '/kindeditor/upload?dir=image',
contentType: false,
type: 'POST',
data: data,
processData: false,
success: function(data) {
console.log(data);
editor.exec('insertimage', JSON.parse(data).url);
}
url: '/kindeditor/upload?dir=image',
contentType: false,
type: 'POST',
data: data,
processData: false,
success: function(data) {
console.log(data);
editor.exec('insertimage', JSON.parse(data).url);
}
});
}
});
return;
};
//复制粘贴时把远程图片上传到服务器
function df(myself) {
// var img = $("#ke_paste").find("img");
var currele = document.activeElement;
var img = $(currele).contents().find("img");
var piccount = 0;
var sstr = "";
$(img).each(function (i) {
var that = $(this);
if(that.attr("src")) {
if (that.attr("src").indexOf("http://") >= 0 || that.attr("src").indexOf("https://") >= 0) {
piccount++;
if (i == $(img).length - 1)
sstr += that.attr("src");
else
sstr += that.attr("src") + "|";
}
}
});
uploadpic(sstr,myself);
}
function keShadow(myself)
{
var keShadowContainer = document.getElementById("ke_shadow");
if (keShadowContainer == null) {
keShadowContainer = document.createElement("div");
keShadowContainer.id = "ke_shadow";
keShadowContainer.innerHTML = "<div class='ui-widget-overlay' z-index: 1001;'></div>";
$("#ajax-modal").after(keShadowContainer);
}
var tWidth = document.body.scrollWidth;
var tHeight = document.body.scrollHeight;
$(".ui-widget-overlay").css("width", tWidth);
$(".ui-widget-overlay").css("height", tHeight);
$("#ke_shadow").show();
myself.readonly();
}
function uploadpic(piclist,myself) {
if (piclist.length == 0) return false;
$.ajax({
url: "/kindeditor/uploadpic",
data:{"pic":piclist},
type: "GET",
beforeSend: function () {
// $("#ajax-indicator span").text("图片上传中请稍等...");
keShadow(myself);
},
success: function (msg) {
if (msg !== "") {
var str = new Array();
str = msg.split('|');
var currele = document.activeElement;
var img = $(currele).contents().find("img");
var tIndex = 0;
$(img).each(function (i) {
var that = $(this);
if(that.attr("src")){
if (that.attr("src").indexOf("http://") >= 0 || that.attr("src").indexOf("https://") >= 0) {
that.attr("src", str[tIndex]);
that.attr("data-ke-src", str[tIndex]);
//非视频
if(!(that.parent().attr("class") && that.parent().attr("class") == "mediaIcobox" )) {
that.parent().attr("href", str[tIndex]);
that.parent().attr("data-ke-src", str[tIndex]);
}
tIndex = tIndex + 1;
}
}
});
}
// $("#ajax-indicator span").text("载入中...");
$("#ke_shadow").hide();
myself.readonly(false);
}
}).fail(function(xhr, status){
// $("#ajax-indicator span").text("载入中...");
$("#ke_shadow").hide();
myself.readonly(false);
return;
});
}

View File

@ -1,7 +1,7 @@
.ke-content {
font-size: 12px;
font: 14px/1.5 "sans serif",tahoma,verdana,helvetica;font-family: ΢ÈíÑźÚ, ËÎÌå;
font-family:Tahoma;
font: 14px/1.5 "sans serif",tahoma,verdana,helvetica;font-family: ΢<EFBFBD><EFBFBD><EFBFBD>ź<EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
font-family:Tahoma;
}
.ke-content pre {
font-size:9pt;
@ -48,4 +48,8 @@
.ke-content blockquote {margin:15px 10px;border:2px solid #eee;padding:5px 5px 5px 35px;background:#f4f5f7 url('../img/blockquote.gif') no-repeat left top;color:#060;font-size:9pt;}
span.at {color:#269ac9;}
span.at a{color:#269ac9;text-decoration: none;}
span.at a{color:#269ac9;text-decoration: none;}
/*yk*/
.ke-content ol li{list-style-type: decimal;margin-left: 20px;}
.ke-content ul li{list-style-type: disc;margin-left: 20px;}

View File

@ -353,3 +353,4 @@ KindEditor.plugin('paste', function(K) {
return;
});

View File

@ -283,7 +283,7 @@ KindEditor.plugin('table', function(K) {
for (var i = 0; i < rows; i++) {
html += '<tr>';
for (var j = 0; j < cols; j++) {
html += '<td style="border:solid windowtext 1.0px; text-overflow:inherit;overflow: hidden;white-space: nowrap" >' + (K.IE ? '&nbsp;' : '<br />') + '</td>';
html += '<td style="text-overflow:inherit;overflow: hidden;white-space: nowrap" >' + (K.IE ? '&nbsp;' : '<br />') + '</td>';
}
html += '</tr>';
}

View File

@ -31,7 +31,7 @@ function sd_create_editor(params){
//params.toolbar_container.hide();
sd_check_editor_form_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea});
if(this.isEmpty()) {
this.edit.html("<span id='hint' style='color: #999999; font-size: 12px'>我要回复</span>");
this.edit.html("<span id='hint' style='color:#999999;font-size:12px;'>我要回复</span>");
}
//params.toolbar_container.hide();
$('#reply_image_' + id).addClass('imageFuzzy');
@ -78,7 +78,7 @@ function sd_create_editor(params){
//reset height
paramsHeight = paramsHeight == undefined ? params.kindutil.removeUnit(this.height) : paramsHeight;
edit.iframe.height(paramsHeight);
edit.html("<span id='hint' style='color: #999999; font-size: 12px'>我要回复</span>");
edit.html("<span id='hint' style='color:#999999;font-size:12px;'>我要回复</span>");
this.resize(null,paramsHeight);// Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight)+ paramsHeight , paramsHeight)
// params.toolbar_container.hide();
if(typeof enableAt === 'function'){

View File

@ -134,12 +134,14 @@ a.postTypeGrey:hover {color:#269ac9;}
.homepagePostDes {float:left; width:655px; margin-left:15px;}
.homepagePostTo {font-size:14px; color:#484848; margin-bottom:5px;}
.homepagePostTitle {font-size:14px; color:#484848; margin-bottom:5px; font-weight:bold;}
.homepagePostTitle td,.homepagePostTitle tr {border: 1px solid; border-color: inherit;}
.homepagePostSubmitContainer {height:25px; margin-top: 8px; margin-bottom: 5px;}
.homepagePostSubmit {font-size:14px; color:#888888; border:1px solid #dddddd; background-color:#eaeaea; float:left; margin-right:20px; padding:0px 10px;}
.homepagePostSubmit:hover {background-color:#d8d8d8;}
.homepagePostIntro {font-size:14px; color:#484848;overflow:hidden;}
.homepagePostIntro ol li{list-style-type: decimal;margin-left: 20px;}
.homepagePostIntro ul li{list-style-type: disc;margin-left: 20px;}
.homepagePostIntro td,.homepagePostIntro tr {border: 1px solid; border-color: inherit;}
.homepagePostDeadline {font-size:12px; color:#888888; float:left; margin-top: 2px;}
.homepagePostDate {font-size:12px; color:#888888;margin-bottom: 5px;}
@ -181,6 +183,7 @@ a.postOptionLink2:hover {color:#ffffff; background-color:#269ac9;}
.homepagePostReplyContent {font-size:12px; color:#484848; margin-bottom:12px;}
.homepagePostReplyContent ol li{list-style-type: decimal;margin-left: 20px;}
.homepagePostReplyContent ul li{list-style-type: disc;margin-left: 20px;}
.homepagePostReplyContent td,.homepagePostReplyContent tr {border: 1px solid; border-color: inherit;}
.table_maxWidth table {max-width: 642px;}
.homepagePostProjectState {width:52px; height:20px; line-height:20px; border-radius:1px; background-color:#28be6c; color:#ffffff; text-align:center; vertical-align:middle; font-size:12px; display:inline-block; margin-left:5px;}
.homepagePostAssignTo {float:left; font-size:14px; color:#269ac9;}
@ -1120,6 +1123,9 @@ a.link_file_a2{ background:url(../images/pic_file.png) 0 -15px no-repeat; paddin
.postDetailTitle {width:580px; max-width:580px; margin-bottom:5px;}
.postDetailDes {width:580px; max-width:580px; margin-bottom:6px; color:#888888;display:block;overflow:hidden;word-break:keep-all;text-overflow:ellipsis;}
.postDetailDes p,div,em{word-break: break-all;word-wrap: break-word;}
.postDetailDes ol li{list-style-type: decimal;margin-left: 20px;}
.postDetailDes ul li{list-style-type: disc;margin-left: 20px;}
.postDetailDes td,.homepagePostReplyContent tr {border: 1px solid; border-color: inherit;}
.homepagePostIntro p,.homepagePostIntro div,.homepagePostIntro em, .homepagePostIntro span{text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: break-word !important; line-height: 18px !important;}
.postDetailCreater {color:#888888; font-size:12px; float:left; margin-right:25px;}
.postDetailDate {color:#888888; font-size:12px; float:left;}

View File

@ -680,7 +680,11 @@ a.postTypeGrey:hover {color:#269ac9;}
.homepagePostReply {width:720px; margin:0px auto; background-color:#f1f1f1; margin-top:10px;}
.homepagePostReplyBanner {width:718px; height:33px; border:1px solid #e4e4e4; line-height:33px; vertical-align:middle; font-size:12px; color:#888888; position: relative;}
.homepagePostIntro ol li{list-style-type: decimal;margin-left: 20px;}
.homepagePostIntro ul li{list-style-type: disc;margin-left: 20px;}.borderBottomNone {border-bottom:none !important;}
.homepagePostIntro ul li{list-style-type: disc;margin-left: 20px;}
.borderBottomNone {border-bottom:none !important;}
.homepagePostIntro td,.homepagePostIntro tr {border: 1px solid; border-color: inherit;}
.homepagePostReplyBanner {width:718px; height:33px; border:1px solid #e4e4e4; line-height:33px; vertical-align:middle; font-size:12px; color:#888888;}
.borderBottomNone {border-bottom:none !important;}
.topBorder {border-top: 1px solid #e4e4e4;}
div.minHeight48{min-height: 48px;}
.homepagePostReplyBannerCount{width:255px; display:inline-block; margin-left:15px;}

View File

@ -973,6 +973,7 @@ a:hover.Reply_pic{border:1px solid #64bdd9;}
}
.homepagePostIntro ol li{list-style-type: decimal;margin-left: 20px;}
.homepagePostIntro ul li{list-style-type: disc;margin-left: 20px;}
.homepagePostIntro td,.homepagePostIntro tr {border: 1px solid; border-color: inherit;}
.topBorder {
border-top: 1px solid #E4E4E4;
}
@ -1111,6 +1112,9 @@ a:hover.BlueCirBtnMini{ background:#269ac9; color:#fff;}
.postDetailTitle {width:580px; max-width:580px; margin-bottom:5px;}
.postDetailDes {width:580px; max-width:580px; margin-bottom:6px; color:#888888;display:block;overflow:hidden;word-break:keep-all;text-overflow:ellipsis;}
.postDetailDes p,div,em{word-break: break-all;word-wrap: break-word;}
.postDetailDes ol li{list-style-type: decimal;margin-left: 20px;}
.postDetailDes ul li{list-style-type: disc;margin-left: 20px;}
.postDetailDes td,.homepagePostReplyContent tr {border: 1px solid; border-color: inherit;}
.homepagePostIntro p,.homepagePostIntro div,.homepagePostIntro em, .homepagePostIntro span{text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: break-word !important; line-height: 18px !important;}
.postDetailCreater {color:#888888; font-size:12px; float:left; margin-right:25px;}
.postDetailDate {color:#888888; font-size:12px; float:left;}

View File

@ -605,6 +605,7 @@ a.postTypeGrey:hover {color:#269ac9;}
.homepagePostIntro {font-size:14px; color:#484848;overflow:hidden;}
.homepagePostIntro ol li{list-style-type: decimal;margin-left: 20px;}
.homepagePostIntro ul li{list-style-type: disc;margin-left: 20px;}
.homepagePostIntro td,.homepagePostIntro tr {border: 1px solid; border-color: inherit;}
.homepagePostDeadline {font-size:12px; color:#888888; float:left; margin-top: 2px;}
.homepagePostDate {font-size:12px; color:#888888;margin-bottom: 5px;}
.homepagePostReplyBanner {width:708px; height:33px; border:1px solid #e4e4e4; line-height:33px; vertical-align:middle; font-size:12px; color:#888888; position: relative;}
@ -640,6 +641,7 @@ a.postReplyCancel:hover {color:#ffffff;}
.homepagePostReplyContent {font-size:12px; color:#484848; margin-bottom:12px;}
.homepagePostReplyContent ol li{list-style-type: decimal;margin-left: 20px;}
.homepagePostReplyContent ul li{list-style-type: disc;margin-left: 20px;}
.homepagePostReplyContent td,.homepagePostReplyContent tr {border: 1px solid; border-color: inherit;}
.table_maxWidth table {max-width: 642px;}
.homepagePostProjectState {width:42px; height:20px; line-height:20px; border-radius:1px; background-color:#28be6c; color:#ffffff; text-align:center; vertical-align:middle; font-size:12px; display:inline-block; margin-left:5px;}
.homepagePostAssignTo {float:left; font-size:14px; color:#15bccf;}
@ -976,8 +978,8 @@ a.resourcesTypeUser {background:url(images/homepage_icon.png) -178px -453px no-r
.AgreementTxt{text-indent:2em; margin-bottom:15px;}
.AgreementImg{ margin:0px auto;}
.list_style ol li{list-style-type: decimal;margin-left: 20px;}
.list_style ul li{list-style-type: disc;margin-left: 20px;}
.list_style ol li{list-style-type:decimal; margin-left:20px;}
.list_style ul li{list-style-type:disc; margin-left:20px;}
/* @功能 定义 */
span.at {color:#269ac9;}