update smarteditor
This commit is contained in:
parent
3302649c3c
commit
6145459b5d
37 changed files with 6429 additions and 7953 deletions
|
|
@ -1,10 +1,8 @@
|
||||||
function get_editor_wr_content()
|
function get_editor_wr_content() {
|
||||||
{
|
|
||||||
return oEditors.getById['wr_content'].getIR();;
|
return oEditors.getById['wr_content'].getIR();;
|
||||||
}
|
}
|
||||||
|
|
||||||
function put_editor_wr_content(content)
|
function put_editor_wr_content(content) {
|
||||||
{
|
|
||||||
oEditors.getById["wr_content"].exec("SET_CONTENTS", [""]);
|
oEditors.getById["wr_content"].exec("SET_CONTENTS", [""]);
|
||||||
//oEditors.getById["wr_content"].exec("SET_IR", [""]);
|
//oEditors.getById["wr_content"].exec("SET_IR", [""]);
|
||||||
oEditors.getById["wr_content"].exec("PASTE_HTML", [content]);
|
oEditors.getById["wr_content"].exec("PASTE_HTML", [content]);
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
bUseVerticalResizer: true,
|
bUseVerticalResizer: true,
|
||||||
bUseModeChanger: true,
|
bUseModeChanger: true,
|
||||||
bSkipXssFilter: true,
|
bSkipXssFilter: true,
|
||||||
aAdditionalFontList : editorAdditionalFontList,
|
aAdditionalFontList: editorAdditionalFontList,
|
||||||
fOnBeforeUnload: function () {
|
fOnBeforeUnload: function () {
|
||||||
// unload
|
// unload
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ function editor_html($id, $content, $is_dhtml_editor = true)
|
||||||
|
|
||||||
if ($is_dhtml_editor && $js) {
|
if ($is_dhtml_editor && $js) {
|
||||||
$html .= "\n<script src=\"{$editor_url}/js/service/HuskyEZCreator.js\"></script>";
|
$html .= "\n<script src=\"{$editor_url}/js/service/HuskyEZCreator.js\"></script>";
|
||||||
$html .= "\n<script>let g5_editor_url = \"{$editor_url}\", oEditors = [], ed_nonce = \"{ft_nonce_create('smarteditor')}\";let editorAdditionalFontList = [";
|
$html .= "\n<script>var g5_editor_url = '" . $editor_url . "', oEditors = [], ed_nonce = '" . ft_nonce_create('smarteditor') . "', editorAdditionalFontList = [";
|
||||||
|
|
||||||
$sql = "SELECT * FROM {$g5['font_table']} ORDER BY font_name ASC";
|
$sql = "SELECT * FROM {$g5['font_table']} ORDER BY font_name ASC";
|
||||||
$result = sql_query($sql);
|
$result = sql_query($sql);
|
||||||
|
|
|
||||||
|
|
@ -15,18 +15,18 @@ You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
if(typeof window.nhn=='undefined') window.nhn = {};
|
if (typeof window.nhn == 'undefined') window.nhn = {};
|
||||||
if (!nhn.husky) nhn.husky = {};
|
if (!nhn.husky) nhn.husky = {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @fileOverview This file contains application creation helper function, which would load up an HTML(Skin) file and then execute a specified create function.
|
* @fileOverview This file contains application creation helper function, which would load up an HTML(Skin) file and then execute a specified create function.
|
||||||
* @name HuskyEZCreator.js
|
* @name HuskyEZCreator.js
|
||||||
*/
|
*/
|
||||||
nhn.husky.EZCreator = new (function(){
|
nhn.husky.EZCreator = new (function () {
|
||||||
this.nBlockerCount = 0;
|
this.nBlockerCount = 0;
|
||||||
|
|
||||||
this.createInIFrame = function(htOptions){
|
this.createInIFrame = function (htOptions) {
|
||||||
if(arguments.length == 1){
|
if (arguments.length == 1) {
|
||||||
var oAppRef = htOptions.oAppRef;
|
var oAppRef = htOptions.oAppRef;
|
||||||
var elPlaceHolder = htOptions.elPlaceHolder;
|
var elPlaceHolder = htOptions.elPlaceHolder;
|
||||||
var sSkinURI = htOptions.sSkinURI;
|
var sSkinURI = htOptions.sSkinURI;
|
||||||
|
|
@ -34,7 +34,7 @@ nhn.husky.EZCreator = new (function(){
|
||||||
var fOnAppLoad = htOptions.fOnAppLoad;
|
var fOnAppLoad = htOptions.fOnAppLoad;
|
||||||
var bUseBlocker = htOptions.bUseBlocker;
|
var bUseBlocker = htOptions.bUseBlocker;
|
||||||
var htParams = htOptions.htParams || null;
|
var htParams = htOptions.htParams || null;
|
||||||
}else{
|
} else {
|
||||||
// for backward compatibility only
|
// for backward compatibility only
|
||||||
var oAppRef = arguments[0];
|
var oAppRef = arguments[0];
|
||||||
var elPlaceHolder = arguments[1];
|
var elPlaceHolder = arguments[1];
|
||||||
|
|
@ -45,30 +45,30 @@ nhn.husky.EZCreator = new (function(){
|
||||||
var htParams = arguments[6];
|
var htParams = arguments[6];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(bUseBlocker) nhn.husky.EZCreator.showBlocker();
|
if (bUseBlocker) nhn.husky.EZCreator.showBlocker();
|
||||||
|
|
||||||
var attachEvent = function(elNode, sEvent, fHandler){
|
var attachEvent = function (elNode, sEvent, fHandler) {
|
||||||
if(elNode.addEventListener){
|
if (elNode.addEventListener) {
|
||||||
elNode.addEventListener(sEvent, fHandler, false);
|
elNode.addEventListener(sEvent, fHandler, false);
|
||||||
}else{
|
} else {
|
||||||
elNode.attachEvent("on"+sEvent, fHandler);
|
elNode.attachEvent("on" + sEvent, fHandler);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!elPlaceHolder){
|
if (!elPlaceHolder) {
|
||||||
alert("Placeholder is required!");
|
alert("Placeholder is required!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(typeof(elPlaceHolder) != "object")
|
if (typeof (elPlaceHolder) != "object")
|
||||||
elPlaceHolder = document.getElementById(elPlaceHolder);
|
elPlaceHolder = document.getElementById(elPlaceHolder);
|
||||||
|
|
||||||
var elIFrame, nEditorWidth, nEditorHeight;
|
var elIFrame, nEditorWidth, nEditorHeight;
|
||||||
|
|
||||||
|
|
||||||
try{
|
try {
|
||||||
elIFrame = document.createElement("<IFRAME frameborder=0 scrolling=no>");
|
elIFrame = document.createElement("<IFRAME frameborder=0 scrolling=no>");
|
||||||
}catch(e){
|
} catch (e) {
|
||||||
elIFrame = document.createElement("IFRAME");
|
elIFrame = document.createElement("IFRAME");
|
||||||
elIFrame.setAttribute("frameborder", "0");
|
elIFrame.setAttribute("frameborder", "0");
|
||||||
elIFrame.setAttribute("scrolling", "no");
|
elIFrame.setAttribute("scrolling", "no");
|
||||||
|
|
@ -78,25 +78,25 @@ nhn.husky.EZCreator = new (function(){
|
||||||
elIFrame.style.height = "1px";
|
elIFrame.style.height = "1px";
|
||||||
elPlaceHolder.parentNode.insertBefore(elIFrame, elPlaceHolder.nextSibling);
|
elPlaceHolder.parentNode.insertBefore(elIFrame, elPlaceHolder.nextSibling);
|
||||||
|
|
||||||
attachEvent(elIFrame, "load", function(){
|
attachEvent(elIFrame, "load", function () {
|
||||||
fCreator = elIFrame.contentWindow[fCreator] || elIFrame.contentWindow.createSEditor2;
|
fCreator = elIFrame.contentWindow[fCreator] || elIFrame.contentWindow.createSEditor2;
|
||||||
|
|
||||||
// top.document.title = ((new Date())-window.STime);
|
// top.document.title = ((new Date())-window.STime);
|
||||||
// window.STime = new Date();
|
// window.STime = new Date();
|
||||||
|
|
||||||
try{
|
try {
|
||||||
|
|
||||||
nEditorWidth = elIFrame.contentWindow.document.body.scrollWidth || "500px";
|
nEditorWidth = elIFrame.contentWindow.document.body.scrollWidth || "500px";
|
||||||
nEditorHeight = elIFrame.contentWindow.document.body.scrollHeight + 12;
|
nEditorHeight = elIFrame.contentWindow.document.body.scrollHeight + 12;
|
||||||
elIFrame.style.width = "100%";
|
elIFrame.style.width = "100%";
|
||||||
elIFrame.style.height = nEditorHeight+ "px";
|
elIFrame.style.height = nEditorHeight + "px";
|
||||||
elIFrame.contentWindow.document.body.style.margin = "0";
|
elIFrame.contentWindow.document.body.style.margin = "0";
|
||||||
}catch(e){
|
} catch (e) {
|
||||||
nhn.husky.EZCreator.hideBlocker(true);
|
nhn.husky.EZCreator.hideBlocker(true);
|
||||||
elIFrame.style.border = "5px solid red";
|
elIFrame.style.border = "5px solid red";
|
||||||
elIFrame.style.width = "500px";
|
elIFrame.style.width = "500px";
|
||||||
elIFrame.style.height = "500px";
|
elIFrame.style.height = "500px";
|
||||||
alert("Failed to access "+sSkinURI);
|
alert("Failed to access " + sSkinURI);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -106,22 +106,22 @@ nhn.husky.EZCreator = new (function(){
|
||||||
oApp.elPlaceHolder = elPlaceHolder;
|
oApp.elPlaceHolder = elPlaceHolder;
|
||||||
|
|
||||||
oAppRef[oAppRef.length] = oApp;
|
oAppRef[oAppRef.length] = oApp;
|
||||||
if(!oAppRef.getById) oAppRef.getById = {};
|
if (!oAppRef.getById) oAppRef.getById = {};
|
||||||
|
|
||||||
if(elPlaceHolder.id) oAppRef.getById[elPlaceHolder.id] = oApp;
|
if (elPlaceHolder.id) oAppRef.getById[elPlaceHolder.id] = oApp;
|
||||||
|
|
||||||
oApp.run({fnOnAppReady:fOnAppLoad});
|
oApp.run({ fnOnAppReady: fOnAppLoad });
|
||||||
|
|
||||||
// top.document.title += ", "+((new Date())-window.STime);
|
// top.document.title += ", "+((new Date())-window.STime);
|
||||||
nhn.husky.EZCreator.hideBlocker();
|
nhn.husky.EZCreator.hideBlocker();
|
||||||
});
|
});
|
||||||
// window.STime = new Date();
|
// window.STime = new Date();
|
||||||
elIFrame.src = sSkinURI;
|
elIFrame.src = sSkinURI;
|
||||||
this.elIFrame = elIFrame;
|
this.elIFrame = elIFrame;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.showBlocker = function(){
|
this.showBlocker = function () {
|
||||||
if(this.nBlockerCount<1){
|
if (this.nBlockerCount < 1) {
|
||||||
var elBlocker = document.createElement("DIV");
|
var elBlocker = document.createElement("DIV");
|
||||||
elBlocker.style.position = "absolute";
|
elBlocker.style.position = "absolute";
|
||||||
elBlocker.style.top = 0;
|
elBlocker.style.top = 0;
|
||||||
|
|
@ -134,18 +134,18 @@ nhn.husky.EZCreator = new (function(){
|
||||||
nhn.husky.EZCreator.elBlocker = elBlocker;
|
nhn.husky.EZCreator.elBlocker = elBlocker;
|
||||||
}
|
}
|
||||||
|
|
||||||
nhn.husky.EZCreator.elBlocker.style.height = Math.max(document.body.scrollHeight, document.body.clientHeight)+"px";
|
nhn.husky.EZCreator.elBlocker.style.height = Math.max(document.body.scrollHeight, document.body.clientHeight) + "px";
|
||||||
|
|
||||||
this.nBlockerCount++;
|
this.nBlockerCount++;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.hideBlocker = function(bForce){
|
this.hideBlocker = function (bForce) {
|
||||||
if(!bForce){
|
if (!bForce) {
|
||||||
if(--this.nBlockerCount > 0) return;
|
if (--this.nBlockerCount > 0) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.nBlockerCount = 0;
|
this.nBlockerCount = 0;
|
||||||
|
|
||||||
if(nhn.husky.EZCreator.elBlocker) nhn.husky.EZCreator.elBlocker.style.display = "none";
|
if (nhn.husky.EZCreator.elBlocker) nhn.husky.EZCreator.elBlocker.style.display = "none";
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
@ -15,20 +15,20 @@ You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
function createSEditor2(elIRField, htParams, elSeAppContainer){
|
function createSEditor2(elIRField, htParams, elSeAppContainer) {
|
||||||
if(!window.$Jindo){
|
if (!window.$Jindo) {
|
||||||
parent.document.body.innerHTML="진도 프레임웍이 필요합니다.<br>\n<a href='http://dev.naver.com/projects/jindo/download'>http://dev.naver.com/projects/jindo/download</a>에서 Jindo 1.5.3 버전의 jindo.min.js를 다운로드 받아 /js 폴더에 복사 해 주세요.\n(아직 Jindo 2 는 지원하지 않습니다.)";
|
parent.document.body.innerHTML = "진도 프레임웍이 필요합니다.<br>\n<a href='http://dev.naver.com/projects/jindo/download'>http://dev.naver.com/projects/jindo/download</a>에서 Jindo 1.5.3 버전의 jindo.min.js를 다운로드 받아 /js 폴더에 복사 해 주세요.\n(아직 Jindo 2 는 지원하지 않습니다.)";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var elAppContainer = (elSeAppContainer || jindo.$("smart_editor2"));
|
var elAppContainer = (elSeAppContainer || jindo.$("smart_editor2"));
|
||||||
var elEditingArea = jindo.$$.getSingle("DIV.husky_seditor_editing_area_container", elAppContainer);
|
var elEditingArea = jindo.$$.getSingle("DIV.husky_seditor_editing_area_container", elAppContainer);
|
||||||
var oWYSIWYGIFrame = jindo.$$.getSingle("IFRAME.se2_input_wysiwyg", elEditingArea);
|
var oWYSIWYGIFrame = jindo.$$.getSingle("IFRAME.se2_input_wysiwyg", elEditingArea);
|
||||||
var oIRTextarea = elIRField?elIRField:jindo.$$.getSingle("TEXTAREA.blind", elEditingArea);
|
var oIRTextarea = elIRField ? elIRField : jindo.$$.getSingle("TEXTAREA.blind", elEditingArea);
|
||||||
var oHTMLSrc = jindo.$$.getSingle("TEXTAREA.se2_input_htmlsrc", elEditingArea);
|
var oHTMLSrc = jindo.$$.getSingle("TEXTAREA.se2_input_htmlsrc", elEditingArea);
|
||||||
var oTextArea = jindo.$$.getSingle("TEXTAREA.se2_input_text", elEditingArea);
|
var oTextArea = jindo.$$.getSingle("TEXTAREA.se2_input_text", elEditingArea);
|
||||||
|
|
||||||
if(!htParams){
|
if (!htParams) {
|
||||||
htParams = {};
|
htParams = {};
|
||||||
htParams.fOnBeforeUnload = null;
|
htParams.fOnBeforeUnload = null;
|
||||||
}
|
}
|
||||||
|
|
@ -37,32 +37,32 @@ function createSEditor2(elIRField, htParams, elSeAppContainer){
|
||||||
htParams.I18N_LOCALE = htParams.I18N_LOCALE || "ko_KR";
|
htParams.I18N_LOCALE = htParams.I18N_LOCALE || "ko_KR";
|
||||||
|
|
||||||
var oEditor = new nhn.husky.HuskyCore(htParams);
|
var oEditor = new nhn.husky.HuskyCore(htParams);
|
||||||
oEditor.registerPlugin(new nhn.husky.CorePlugin(htParams?htParams.fOnAppLoad:null));
|
oEditor.registerPlugin(new nhn.husky.CorePlugin(htParams ? htParams.fOnAppLoad : null));
|
||||||
oEditor.registerPlugin(new nhn.husky.StringConverterManager());
|
oEditor.registerPlugin(new nhn.husky.StringConverterManager());
|
||||||
if(htParams.bSkipXssFilter !== true){
|
if (htParams.bSkipXssFilter !== true) {
|
||||||
// 보안 필터링 플러그인 (TODO:소스분리 및 블랙리스트 옵션 추가)
|
// 보안 필터링 플러그인 (TODO:소스분리 및 블랙리스트 옵션 추가)
|
||||||
oEditor.registerPlugin({
|
oEditor.registerPlugin({
|
||||||
_rxFilter:/<\/*(?:applet|b(?:ase|gsound|link)|embed|frame(?:set)?|i(?:frame|layer)|l(?:ayer|ink)|meta|object|s(?:cript|tyle)|title|xml)[^>]*?>/gi,
|
_rxFilter: /<\/*(?:applet|b(?:ase|gsound|link)|embed|frame(?:set)?|i(?:frame|layer)|l(?:ayer|ink)|meta|object|s(?:cript|tyle)|title|xml)[^>]*?>/gi,
|
||||||
$ON_REGISTER_CONVERTERS : function() {
|
$ON_REGISTER_CONVERTERS: function () {
|
||||||
var fXssFilter = jindo.$Fn(function(sHtml){
|
var fXssFilter = jindo.$Fn(function (sHtml) {
|
||||||
return sHtml.replace(this._rxFilter, "");
|
return sHtml.replace(this._rxFilter, "");
|
||||||
}, this).bind();
|
}, this).bind();
|
||||||
this.oApp.exec("ADD_CONVERTER",["HTMLSrc_TO_IR", fXssFilter]);
|
this.oApp.exec("ADD_CONVERTER", ["HTMLSrc_TO_IR", fXssFilter]);
|
||||||
this.oApp.exec("ADD_CONVERTER",["IR_TO_DB", fXssFilter]);
|
this.oApp.exec("ADD_CONVERTER", ["IR_TO_DB", fXssFilter]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var htDimension = {
|
var htDimension = {
|
||||||
nMinHeight:205,
|
nMinHeight: 205,
|
||||||
nMinWidth:parseInt(elIRField.style.minWidth, 10)||570,
|
nMinWidth: parseInt(elIRField.style.minWidth, 10) || 570,
|
||||||
nHeight:elIRField.style.height||elIRField.offsetHeight,
|
nHeight: elIRField.style.height || elIRField.offsetHeight,
|
||||||
nWidth:elIRField.style.width||elIRField.offsetWidth
|
nWidth: elIRField.style.width || elIRField.offsetWidth
|
||||||
};
|
};
|
||||||
|
|
||||||
var htConversionMode = {
|
var htConversionMode = {
|
||||||
bUseVerticalResizer : htParams.bUseVerticalResizer,
|
bUseVerticalResizer: htParams.bUseVerticalResizer,
|
||||||
bUseModeChanger : htParams.bUseModeChanger
|
bUseModeChanger: htParams.bUseModeChanger
|
||||||
};
|
};
|
||||||
|
|
||||||
var aAdditionalFontList = htParams.aAdditionalFontList;
|
var aAdditionalFontList = htParams.aAdditionalFontList;
|
||||||
|
|
@ -105,7 +105,7 @@ function createSEditor2(elIRField, htParams, elSeAppContainer){
|
||||||
oEditor.registerPlugin(new nhn.husky.SE2M_TableCreator(elAppContainer)); // 테이블 생성
|
oEditor.registerPlugin(new nhn.husky.SE2M_TableCreator(elAppContainer)); // 테이블 생성
|
||||||
oEditor.registerPlugin(new nhn.husky.SE2M_TableEditor(elAppContainer)); // 테이블 편집
|
oEditor.registerPlugin(new nhn.husky.SE2M_TableEditor(elAppContainer)); // 테이블 편집
|
||||||
oEditor.registerPlugin(new nhn.husky.SE2M_TableBlockStyler(elAppContainer)); // 테이블 스타일
|
oEditor.registerPlugin(new nhn.husky.SE2M_TableBlockStyler(elAppContainer)); // 테이블 스타일
|
||||||
if(nhn.husky.SE2M_AttachQuickPhoto){
|
if (nhn.husky.SE2M_AttachQuickPhoto) {
|
||||||
oEditor.registerPlugin(new nhn.husky.SE2M_AttachQuickPhoto(elAppContainer)); // 사진
|
oEditor.registerPlugin(new nhn.husky.SE2M_AttachQuickPhoto(elAppContainer)); // 사진
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -113,7 +113,7 @@ function createSEditor2(elIRField, htParams, elSeAppContainer){
|
||||||
oEditor.registerPlugin(new nhn.husky.SE2M_QuickEditor_Common(elAppContainer)); // 퀵에디터 공통(표, 이미지)
|
oEditor.registerPlugin(new nhn.husky.SE2M_QuickEditor_Common(elAppContainer)); // 퀵에디터 공통(표, 이미지)
|
||||||
|
|
||||||
oEditor.registerPlugin(new nhn.husky.SE2B_CSSLoader()); // CSS lazy load
|
oEditor.registerPlugin(new nhn.husky.SE2B_CSSLoader()); // CSS lazy load
|
||||||
if(window.frameElement){
|
if (window.frameElement) {
|
||||||
oEditor.registerPlugin(new nhn.husky.SE_OuterIFrameControl(elAppContainer, 100));
|
oEditor.registerPlugin(new nhn.husky.SE_OuterIFrameControl(elAppContainer, 100));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,17 +26,17 @@ nhn.husky.SE2M_Configuration = nhn.husky.SE2M_Configuration || {};
|
||||||
* CSS LazyLoad를 위한 경로
|
* CSS LazyLoad를 위한 경로
|
||||||
*/
|
*/
|
||||||
nhn.husky.SE2M_Configuration.SE2B_CSSLoader = {
|
nhn.husky.SE2M_Configuration.SE2B_CSSLoader = {
|
||||||
sCSSBaseURI : "css"
|
sCSSBaseURI: "css"
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 편집영역 설정
|
* 편집영역 설정
|
||||||
*/
|
*/
|
||||||
nhn.husky.SE2M_Configuration.SE_EditingAreaManager = {
|
nhn.husky.SE2M_Configuration.SE_EditingAreaManager = {
|
||||||
sCSSBaseURI : "css", // smart_editor2_inputarea.html 파일의 상대경로
|
sCSSBaseURI: "css", // smart_editor2_inputarea.html 파일의 상대경로
|
||||||
sBlankPageURL : "smart_editor2_inputarea.html",
|
sBlankPageURL: "smart_editor2_inputarea.html",
|
||||||
sBlankPageURL_EmulateIE7 : "smart_editor2_inputarea_ie8.html",
|
sBlankPageURL_EmulateIE7: "smart_editor2_inputarea_ie8.html",
|
||||||
aAddtionalEmulateIE7 : [] // IE8 default 사용, IE9 ~ 선택적 사용
|
aAddtionalEmulateIE7: [] // IE8 default 사용, IE9 ~ 선택적 사용
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -49,37 +49,37 @@ nhn.husky.SE2M_Configuration.SE_EditingAreaManager = {
|
||||||
* sTitleElementId : 제목에 해당하는 input 요소의 id.
|
* sTitleElementId : 제목에 해당하는 input 요소의 id.
|
||||||
*/
|
*/
|
||||||
nhn.husky.SE2M_Configuration.SE2M_Accessibility = {
|
nhn.husky.SE2M_Configuration.SE2M_Accessibility = {
|
||||||
ed_nonce : (typeof parent.ed_nonce !='undefined') ? parent.ed_nonce : '',
|
ed_nonce: (typeof parent.ed_nonce != 'undefined') ? parent.ed_nonce : '',
|
||||||
sBeforeElementId : '',
|
sBeforeElementId: '',
|
||||||
sNextElementId : '',
|
sNextElementId: '',
|
||||||
sTitleElementId : ''
|
sTitleElementId: ''
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 링크 기능 옵션
|
* 링크 기능 옵션
|
||||||
*/
|
*/
|
||||||
nhn.husky.SE2M_Configuration.SE2M_Hyperlink = {
|
nhn.husky.SE2M_Configuration.SE2M_Hyperlink = {
|
||||||
bAutolink : true // 자동링크기능 사용여부(기본값:true)
|
bAutolink: true // 자동링크기능 사용여부(기본값:true)
|
||||||
};
|
};
|
||||||
|
|
||||||
nhn.husky.SE2M_Configuration.Quote = {
|
nhn.husky.SE2M_Configuration.Quote = {
|
||||||
sImageBaseURL : 'http://static.se2.naver.com/static/img'
|
sImageBaseURL: 'http://static.se2.naver.com/static/img'
|
||||||
};
|
};
|
||||||
|
|
||||||
nhn.husky.SE2M_Configuration.SE2M_ColorPalette = {
|
nhn.husky.SE2M_Configuration.SE2M_ColorPalette = {
|
||||||
bUseRecentColor : false
|
bUseRecentColor: false
|
||||||
};
|
};
|
||||||
|
|
||||||
nhn.husky.SE2B_Customize_ToolBar = jindo.$Class(/** @lends nhn.husky.SE2B_Customize_ToolBar */{
|
nhn.husky.SE2B_Customize_ToolBar = jindo.$Class(/** @lends nhn.husky.SE2B_Customize_ToolBar */{
|
||||||
name : "SE2B_Customize_ToolBar",
|
name: "SE2B_Customize_ToolBar",
|
||||||
/**
|
/**
|
||||||
* @constructs
|
* @constructs
|
||||||
* @param {Object} oAppContainer 에디터를 구성하는 컨테이너
|
* @param {Object} oAppContainer 에디터를 구성하는 컨테이너
|
||||||
*/
|
*/
|
||||||
$init : function(oAppContainer) {
|
$init: function (oAppContainer) {
|
||||||
this._assignHTMLElements(oAppContainer);
|
this._assignHTMLElements(oAppContainer);
|
||||||
},
|
},
|
||||||
$BEFORE_MSG_APP_READY : function(){
|
$BEFORE_MSG_APP_READY: function () {
|
||||||
this._addEventMoreButton();
|
this._addEventMoreButton();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -88,7 +88,7 @@ nhn.husky.SE2B_Customize_ToolBar = jindo.$Class(/** @lends nhn.husky.SE2B_Custom
|
||||||
* @description DOM엘리먼트를 수집하는 메소드
|
* @description DOM엘리먼트를 수집하는 메소드
|
||||||
* @param {Object} oAppContainer 툴바 포함 에디터를 감싸고 있는 div 엘리먼트
|
* @param {Object} oAppContainer 툴바 포함 에디터를 감싸고 있는 div 엘리먼트
|
||||||
*/
|
*/
|
||||||
_assignHTMLElements : function(oAppContainer) {
|
_assignHTMLElements: function (oAppContainer) {
|
||||||
this.oAppContainer = oAppContainer;
|
this.oAppContainer = oAppContainer;
|
||||||
this.elTextToolBarArea = jindo.$$.getSingle("div.se2_tool");
|
this.elTextToolBarArea = jindo.$$.getSingle("div.se2_tool");
|
||||||
this.elTextMoreButton = jindo.$$.getSingle("button.se2_text_tool_more", this.elTextToolBarArea);
|
this.elTextMoreButton = jindo.$$.getSingle("button.se2_text_tool_more", this.elTextToolBarArea);
|
||||||
|
|
@ -97,48 +97,48 @@ nhn.husky.SE2B_Customize_ToolBar = jindo.$Class(/** @lends nhn.husky.SE2B_Custom
|
||||||
this.elMoreLayer = jindo.$$.getSingle("div.se2_sub_text_tool");
|
this.elMoreLayer = jindo.$$.getSingle("div.se2_sub_text_tool");
|
||||||
},
|
},
|
||||||
|
|
||||||
_addEventMoreButton : function (){
|
_addEventMoreButton: function () {
|
||||||
this.oApp.registerBrowserEvent(this.elTextMoreButton, "click", "EVENT_CLICK_EXPAND_VIEW");
|
this.oApp.registerBrowserEvent(this.elTextMoreButton, "click", "EVENT_CLICK_EXPAND_VIEW");
|
||||||
this.oApp.registerBrowserEvent(this.elMoreLayer, "click", "EVENT_CLICK_EXPAND_VIEW");
|
this.oApp.registerBrowserEvent(this.elMoreLayer, "click", "EVENT_CLICK_EXPAND_VIEW");
|
||||||
},
|
},
|
||||||
|
|
||||||
$ON_EVENT_CLICK_EXPAND_VIEW : function(weEvent){
|
$ON_EVENT_CLICK_EXPAND_VIEW: function (weEvent) {
|
||||||
this.oApp.exec("TOGGLE_EXPAND_VIEW", [this.elTextMoreButton]);
|
this.oApp.exec("TOGGLE_EXPAND_VIEW", [this.elTextMoreButton]);
|
||||||
weEvent.stop();
|
weEvent.stop();
|
||||||
},
|
},
|
||||||
|
|
||||||
$ON_TOGGLE_EXPAND_VIEW : function(){
|
$ON_TOGGLE_EXPAND_VIEW: function () {
|
||||||
if(!this.welTextMoreButtonParent.hasClass("active")){
|
if (!this.welTextMoreButtonParent.hasClass("active")) {
|
||||||
this.oApp.exec("SHOW_EXPAND_VIEW");
|
this.oApp.exec("SHOW_EXPAND_VIEW");
|
||||||
} else {
|
} else {
|
||||||
this.oApp.exec("HIDE_EXPAND_VIEW");
|
this.oApp.exec("HIDE_EXPAND_VIEW");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
$ON_CHANGE_EDITING_MODE : function(sMode){
|
$ON_CHANGE_EDITING_MODE: function (sMode) {
|
||||||
if(sMode != "WYSIWYG"){
|
if (sMode != "WYSIWYG") {
|
||||||
this.elTextMoreButton.disabled =true;
|
this.elTextMoreButton.disabled = true;
|
||||||
this.welTextMoreButtonParent.removeClass("active");
|
this.welTextMoreButtonParent.removeClass("active");
|
||||||
this.oApp.exec("HIDE_EXPAND_VIEW");
|
this.oApp.exec("HIDE_EXPAND_VIEW");
|
||||||
}else{
|
} else {
|
||||||
this.elTextMoreButton.disabled =false;
|
this.elTextMoreButton.disabled = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
$AFTER_SHOW_ACTIVE_LAYER : function(){
|
$AFTER_SHOW_ACTIVE_LAYER: function () {
|
||||||
this.oApp.exec("HIDE_EXPAND_VIEW");
|
this.oApp.exec("HIDE_EXPAND_VIEW");
|
||||||
},
|
},
|
||||||
|
|
||||||
$AFTER_SHOW_DIALOG_LAYER : function(){
|
$AFTER_SHOW_DIALOG_LAYER: function () {
|
||||||
this.oApp.exec("HIDE_EXPAND_VIEW");
|
this.oApp.exec("HIDE_EXPAND_VIEW");
|
||||||
},
|
},
|
||||||
|
|
||||||
$ON_SHOW_EXPAND_VIEW : function(){
|
$ON_SHOW_EXPAND_VIEW: function () {
|
||||||
this.welTextMoreButtonParent.addClass("active");
|
this.welTextMoreButtonParent.addClass("active");
|
||||||
this.elMoreLayer.style.display = "block";
|
this.elMoreLayer.style.display = "block";
|
||||||
},
|
},
|
||||||
|
|
||||||
$ON_HIDE_EXPAND_VIEW : function(){
|
$ON_HIDE_EXPAND_VIEW: function () {
|
||||||
this.welTextMoreButtonParent.removeClass("active");
|
this.welTextMoreButtonParent.removeClass("active");
|
||||||
this.elMoreLayer.style.display = "none";
|
this.elMoreLayer.style.display = "none";
|
||||||
},
|
},
|
||||||
|
|
@ -147,8 +147,8 @@ nhn.husky.SE2B_Customize_ToolBar = jindo.$Class(/** @lends nhn.husky.SE2B_Custom
|
||||||
* CHANGE_EDITING_MODE모드 이후에 호출되어야 함.
|
* CHANGE_EDITING_MODE모드 이후에 호출되어야 함.
|
||||||
* WYSIWYG 모드가 활성화되기 전에 호출이 되면 APPLY_FONTCOLOR에서 에러 발생.
|
* WYSIWYG 모드가 활성화되기 전에 호출이 되면 APPLY_FONTCOLOR에서 에러 발생.
|
||||||
*/
|
*/
|
||||||
$ON_RESET_TOOLBAR : function(){
|
$ON_RESET_TOOLBAR: function () {
|
||||||
if(this.oApp.getEditingMode() !== "WYSIWYG"){
|
if (this.oApp.getEditingMode() !== "WYSIWYG") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//스펠체크 닫기
|
//스펠체크 닫기
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
* @pluginDesc 에디터를 싸고 있는 iframe 사이즈 조절을 담당하는 플러그인
|
* @pluginDesc 에디터를 싸고 있는 iframe 사이즈 조절을 담당하는 플러그인
|
||||||
*/
|
*/
|
||||||
nhn.husky.SE_OuterIFrameControl = $Class({
|
nhn.husky.SE_OuterIFrameControl = $Class({
|
||||||
name : "SE_OuterIFrameControl",
|
name: "SE_OuterIFrameControl",
|
||||||
oResizeGrip : null,
|
oResizeGrip: null,
|
||||||
|
|
||||||
$init : function(oAppContainer){
|
$init: function (oAppContainer) {
|
||||||
// page up, page down, home, end, left, up, right, down
|
// page up, page down, home, end, left, up, right, down
|
||||||
this.aHeightChangeKeyMap = [-100, 100, 500, -500, -1, -10, 1, 10];
|
this.aHeightChangeKeyMap = [-100, 100, 500, -500, -1, -10, 1, 10];
|
||||||
|
|
||||||
|
|
@ -38,24 +38,24 @@ nhn.husky.SE_OuterIFrameControl = $Class({
|
||||||
|
|
||||||
//키보드 이벤트
|
//키보드 이벤트
|
||||||
this.$FnKeyDown = $Fn(this._keydown, this);
|
this.$FnKeyDown = $Fn(this._keydown, this);
|
||||||
if(this.oResizeGrip){
|
if (this.oResizeGrip) {
|
||||||
this.$FnKeyDown.attach(this.oResizeGrip, "keydown");
|
this.$FnKeyDown.attach(this.oResizeGrip, "keydown");
|
||||||
}
|
}
|
||||||
|
|
||||||
//마우스 이벤트
|
//마우스 이벤트
|
||||||
if(!!jindo.$Agent().navigator().ie){
|
if (!!jindo.$Agent().navigator().ie) {
|
||||||
this.$FnMouseDown = $Fn(this._mousedown, this);
|
this.$FnMouseDown = $Fn(this._mousedown, this);
|
||||||
this.$FnMouseMove = $Fn(this._mousemove, this);
|
this.$FnMouseMove = $Fn(this._mousemove, this);
|
||||||
this.$FnMouseMove_Parent = $Fn(this._mousemove_parent, this);
|
this.$FnMouseMove_Parent = $Fn(this._mousemove_parent, this);
|
||||||
this.$FnMouseUp = $Fn(this._mouseup, this);
|
this.$FnMouseUp = $Fn(this._mouseup, this);
|
||||||
|
|
||||||
if(this.oResizeGrip){
|
if (this.oResizeGrip) {
|
||||||
this.$FnMouseDown.attach(this.oResizeGrip, "mousedown");
|
this.$FnMouseDown.attach(this.oResizeGrip, "mousedown");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_assignHTMLObjects : function(oAppContainer){
|
_assignHTMLObjects: function (oAppContainer) {
|
||||||
oAppContainer = jindo.$(oAppContainer) || document;
|
oAppContainer = jindo.$(oAppContainer) || document;
|
||||||
|
|
||||||
this.oResizeGrip = cssquery.getSingle(".husky_seditor_editingArea_verticalResizer", oAppContainer);
|
this.oResizeGrip = cssquery.getSingle(".husky_seditor_editingArea_verticalResizer", oAppContainer);
|
||||||
|
|
@ -64,36 +64,36 @@ nhn.husky.SE_OuterIFrameControl = $Class({
|
||||||
this.welIFrame = $Element(this.elIFrame);
|
this.welIFrame = $Element(this.elIFrame);
|
||||||
},
|
},
|
||||||
|
|
||||||
$ON_MSG_APP_READY : function(){
|
$ON_MSG_APP_READY: function () {
|
||||||
this.oApp.exec("SE_FIT_IFRAME", []);
|
this.oApp.exec("SE_FIT_IFRAME", []);
|
||||||
},
|
},
|
||||||
|
|
||||||
$ON_MSG_EDITING_AREA_SIZE_CHANGED : function(){
|
$ON_MSG_EDITING_AREA_SIZE_CHANGED: function () {
|
||||||
this.oApp.exec("SE_FIT_IFRAME", []);
|
this.oApp.exec("SE_FIT_IFRAME", []);
|
||||||
},
|
},
|
||||||
|
|
||||||
$ON_SE_FIT_IFRAME : function(){
|
$ON_SE_FIT_IFRAME: function () {
|
||||||
this.elIFrame.style.height = document.body.offsetHeight+"px";
|
this.elIFrame.style.height = document.body.offsetHeight + "px";
|
||||||
},
|
},
|
||||||
|
|
||||||
$AFTER_RESIZE_EDITING_AREA_BY : function(ipWidthChange, ipHeightChange){
|
$AFTER_RESIZE_EDITING_AREA_BY: function (ipWidthChange, ipHeightChange) {
|
||||||
this.oApp.exec("SE_FIT_IFRAME", []);
|
this.oApp.exec("SE_FIT_IFRAME", []);
|
||||||
},
|
},
|
||||||
|
|
||||||
_keydown : function(oEvent){
|
_keydown: function (oEvent) {
|
||||||
var oKeyInfo = oEvent.key();
|
var oKeyInfo = oEvent.key();
|
||||||
|
|
||||||
// 33, 34: page up/down, 35,36: end/home, 37,38,39,40: left, up, right, down
|
// 33, 34: page up/down, 35,36: end/home, 37,38,39,40: left, up, right, down
|
||||||
if(oKeyInfo.keyCode >= 33 && oKeyInfo.keyCode <= 40){
|
if (oKeyInfo.keyCode >= 33 && oKeyInfo.keyCode <= 40) {
|
||||||
this.oApp.exec("MSG_EDITING_AREA_RESIZE_STARTED", []);
|
this.oApp.exec("MSG_EDITING_AREA_RESIZE_STARTED", []);
|
||||||
this.oApp.exec("RESIZE_EDITING_AREA_BY", [0, this.aHeightChangeKeyMap[oKeyInfo.keyCode-33]]);
|
this.oApp.exec("RESIZE_EDITING_AREA_BY", [0, this.aHeightChangeKeyMap[oKeyInfo.keyCode - 33]]);
|
||||||
this.oApp.exec("MSG_EDITING_AREA_RESIZE_ENDED", []);
|
this.oApp.exec("MSG_EDITING_AREA_RESIZE_ENDED", []);
|
||||||
|
|
||||||
oEvent.stop();
|
oEvent.stop();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_mousedown : function(oEvent){
|
_mousedown: function (oEvent) {
|
||||||
this.iStartHeight = oEvent.pos().clientY;
|
this.iStartHeight = oEvent.pos().clientY;
|
||||||
this.iStartHeightOffset = oEvent.pos().layerY;
|
this.iStartHeightOffset = oEvent.pos().layerY;
|
||||||
|
|
||||||
|
|
@ -107,17 +107,17 @@ nhn.husky.SE_OuterIFrameControl = $Class({
|
||||||
this.oApp.exec("MSG_EDITING_AREA_RESIZE_STARTED", [this.$FnMouseDown, this.$FnMouseMove, this.$FnMouseUp]);
|
this.oApp.exec("MSG_EDITING_AREA_RESIZE_STARTED", [this.$FnMouseDown, this.$FnMouseMove, this.$FnMouseUp]);
|
||||||
},
|
},
|
||||||
|
|
||||||
_mousemove : function(oEvent){
|
_mousemove: function (oEvent) {
|
||||||
var iHeightChange = oEvent.pos().clientY - this.iStartHeight;
|
var iHeightChange = oEvent.pos().clientY - this.iStartHeight;
|
||||||
this.oApp.exec("RESIZE_EDITING_AREA_BY", [0, iHeightChange]);
|
this.oApp.exec("RESIZE_EDITING_AREA_BY", [0, iHeightChange]);
|
||||||
},
|
},
|
||||||
|
|
||||||
_mousemove_parent : function(oEvent){
|
_mousemove_parent: function (oEvent) {
|
||||||
var iHeightChange = oEvent.pos().pageY - (this.welIFrame.offset().top + this.iStartHeight);
|
var iHeightChange = oEvent.pos().pageY - (this.welIFrame.offset().top + this.iStartHeight);
|
||||||
this.oApp.exec("RESIZE_EDITING_AREA_BY", [0, iHeightChange]);
|
this.oApp.exec("RESIZE_EDITING_AREA_BY", [0, iHeightChange]);
|
||||||
},
|
},
|
||||||
|
|
||||||
_mouseup : function(oEvent){
|
_mouseup: function (oEvent) {
|
||||||
this.$FnMouseMove.detach(document, "mousemove");
|
this.$FnMouseMove.detach(document, "mousemove");
|
||||||
this.$FnMouseMove_Parent.detach(parent.document, "mousemove");
|
this.$FnMouseMove_Parent.detach(parent.document, "mousemove");
|
||||||
this.$FnMouseUp.detach(document, "mouseup");
|
this.$FnMouseUp.detach(document, "mouseup");
|
||||||
|
|
|
||||||
|
|
@ -17,32 +17,32 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
// Sample plugin. Use CTRL+T to toggle the toolbar
|
// Sample plugin. Use CTRL+T to toggle the toolbar
|
||||||
nhn.husky.SE_ToolbarToggler = $Class({
|
nhn.husky.SE_ToolbarToggler = $Class({
|
||||||
name : "SE_ToolbarToggler",
|
name: "SE_ToolbarToggler",
|
||||||
bUseToolbar : true,
|
bUseToolbar: true,
|
||||||
|
|
||||||
$init : function(oAppContainer, bUseToolbar){
|
$init: function (oAppContainer, bUseToolbar) {
|
||||||
this._assignHTMLObjects(oAppContainer, bUseToolbar);
|
this._assignHTMLObjects(oAppContainer, bUseToolbar);
|
||||||
},
|
},
|
||||||
|
|
||||||
_assignHTMLObjects : function(oAppContainer, bUseToolbar){
|
_assignHTMLObjects: function (oAppContainer, bUseToolbar) {
|
||||||
oAppContainer = jindo.$(oAppContainer) || document;
|
oAppContainer = jindo.$(oAppContainer) || document;
|
||||||
|
|
||||||
this.toolbarArea = cssquery.getSingle(".se2_tool", oAppContainer);
|
this.toolbarArea = cssquery.getSingle(".se2_tool", oAppContainer);
|
||||||
|
|
||||||
//설정이 없거나, 사용하겠다고 표시한 경우 block 처리
|
//설정이 없거나, 사용하겠다고 표시한 경우 block 처리
|
||||||
if( typeof(bUseToolbar) == 'undefined' || bUseToolbar === true){
|
if (typeof (bUseToolbar) == 'undefined' || bUseToolbar === true) {
|
||||||
this.toolbarArea.style.display = "block";
|
this.toolbarArea.style.display = "block";
|
||||||
}else{
|
} else {
|
||||||
this.toolbarArea.style.display = "none";
|
this.toolbarArea.style.display = "none";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
$ON_MSG_APP_READY : function(){
|
$ON_MSG_APP_READY: function () {
|
||||||
this.oApp.exec("REGISTER_HOTKEY", ["ctrl+t", "SE_TOGGLE_TOOLBAR", []]);
|
this.oApp.exec("REGISTER_HOTKEY", ["ctrl+t", "SE_TOGGLE_TOOLBAR", []]);
|
||||||
},
|
},
|
||||||
|
|
||||||
$ON_SE_TOGGLE_TOOLBAR : function(){
|
$ON_SE_TOGGLE_TOOLBAR: function () {
|
||||||
this.toolbarArea.style.display = (this.toolbarArea.style.display == "none")?"block":"none";
|
this.toolbarArea.style.display = (this.toolbarArea.style.display == "none") ? "block" : "none";
|
||||||
this.oApp.exec("MSG_EDITING_AREA_SIZE_CHANGED", []);
|
this.oApp.exec("MSG_EDITING_AREA_SIZE_CHANGED", []);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -15,25 +15,25 @@ You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
if(typeof window.nhn=='undefined'){window.nhn = {};}
|
if (typeof window.nhn == 'undefined') { window.nhn = {}; }
|
||||||
/**
|
/**
|
||||||
* @fileOverview This file contains a message mapping(Korean), which is used to map the message code to the actual message
|
* @fileOverview This file contains a message mapping(Korean), which is used to map the message code to the actual message
|
||||||
* @name husky_SE2B_Lang_en_US.js
|
* @name husky_SE2B_Lang_en_US.js
|
||||||
* @ unescape
|
* @ unescape
|
||||||
*/
|
*/
|
||||||
var oMessageMap_en_US = {
|
var oMessageMap_en_US = {
|
||||||
'SE_EditingAreaManager.onExit' : 'Contents have been changed.',
|
'SE_EditingAreaManager.onExit': 'Contents have been changed.',
|
||||||
'SE_Color.invalidColorCode' : 'Enter the correct color code. \n\n ex) #000000, #FF0000, #FFFFFF, #ffffff, ffffff',
|
'SE_Color.invalidColorCode': 'Enter the correct color code. \n\n ex) #000000, #FF0000, #FFFFFF, #ffffff, ffffff',
|
||||||
'SE_Hyperlink.invalidURL' : 'You have entered an incorrect URL.',
|
'SE_Hyperlink.invalidURL': 'You have entered an incorrect URL.',
|
||||||
'SE_FindReplace.keywordMissing' : 'Enter the word you wish to find.',
|
'SE_FindReplace.keywordMissing': 'Enter the word you wish to find.',
|
||||||
'SE_FindReplace.keywordNotFound' : 'The word does not exist.',
|
'SE_FindReplace.keywordNotFound': 'The word does not exist.',
|
||||||
'SE_FindReplace.replaceAllResultP1' : 'A total of ',
|
'SE_FindReplace.replaceAllResultP1': 'A total of ',
|
||||||
'SE_FindReplace.replaceAllResultP2' : ' matching contents have been changed.',
|
'SE_FindReplace.replaceAllResultP2': ' matching contents have been changed.',
|
||||||
'SE_FindReplace.notSupportedBrowser' : 'Function cannot be used in the browser you are currently using. \n\nSorry for the inconvenience.',
|
'SE_FindReplace.notSupportedBrowser': 'Function cannot be used in the browser you are currently using. \n\nSorry for the inconvenience.',
|
||||||
'SE_FindReplace.replaceKeywordNotFound' : 'No word to change.',
|
'SE_FindReplace.replaceKeywordNotFound': 'No word to change.',
|
||||||
'SE_LineHeight.invalidLineHeight' : 'Incorrect value.',
|
'SE_LineHeight.invalidLineHeight': 'Incorrect value.',
|
||||||
'SE_Footnote.defaultText' : 'Enter footnote details.',
|
'SE_Footnote.defaultText': 'Enter footnote details.',
|
||||||
'SE.failedToLoadFlash' : 'The function cannot be used because flash has been blocked.',
|
'SE.failedToLoadFlash': 'The function cannot be used because flash has been blocked.',
|
||||||
'SE2M_EditingModeChanger.confirmTextMode' : 'The contents remain, but editing effects, including fonts, and attachments, \n\nsuch as images, will disappear when changed to text mode. \n\n Make changes?',
|
'SE2M_EditingModeChanger.confirmTextMode': 'The contents remain, but editing effects, including fonts, and attachments, \n\nsuch as images, will disappear when changed to text mode. \n\n Make changes?',
|
||||||
'SE2M_FontNameWithLayerUI.sSampleText' : 'ABCD'
|
'SE2M_FontNameWithLayerUI.sSampleText': 'ABCD'
|
||||||
};
|
};
|
||||||
|
|
@ -15,25 +15,25 @@ You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
if(typeof window.nhn=='undefined'){window.nhn = {};}
|
if (typeof window.nhn == 'undefined') { window.nhn = {}; }
|
||||||
/**
|
/**
|
||||||
* @fileOverview This file contains a message mapping(Korean), which is used to map the message code to the actual message
|
* @fileOverview This file contains a message mapping(Korean), which is used to map the message code to the actual message
|
||||||
* @name husky_SE2B_Lang_ja_JP.js
|
* @name husky_SE2B_Lang_ja_JP.js
|
||||||
* @ unescape
|
* @ unescape
|
||||||
*/
|
*/
|
||||||
var oMessageMap_ja_JP = {
|
var oMessageMap_ja_JP = {
|
||||||
'SE_EditingAreaManager.onExit' : '内容が変更されました。',
|
'SE_EditingAreaManager.onExit': '内容が変更されました。',
|
||||||
'SE_Color.invalidColorCode' : 'カラーコードを正しく入力してください。 \n\n 例) #000000, #FF0000, #FFFFFF, #ffffff, ffffff',
|
'SE_Color.invalidColorCode': 'カラーコードを正しく入力してください。 \n\n 例) #000000, #FF0000, #FFFFFF, #ffffff, ffffff',
|
||||||
'SE_Hyperlink.invalidURL' : '入力したURLが正しくありません。',
|
'SE_Hyperlink.invalidURL': '入力したURLが正しくありません。',
|
||||||
'SE_FindReplace.keywordMissing' : 'お探しの単語を入力してください。',
|
'SE_FindReplace.keywordMissing': 'お探しの単語を入力してください。',
|
||||||
'SE_FindReplace.keywordNotFound' : 'お探しの単語がありません。',
|
'SE_FindReplace.keywordNotFound': 'お探しの単語がありません。',
|
||||||
'SE_FindReplace.replaceAllResultP1' : '一致する内容が計',
|
'SE_FindReplace.replaceAllResultP1': '一致する内容が計',
|
||||||
'SE_FindReplace.replaceAllResultP2' : '件変わりました。',
|
'SE_FindReplace.replaceAllResultP2': '件変わりました。',
|
||||||
'SE_FindReplace.notSupportedBrowser' : '現在ご使用中のブラウザーではご利用いただけない機能です。\n\nご不便をおかけしまして申し訳ございません。',
|
'SE_FindReplace.notSupportedBrowser': '現在ご使用中のブラウザーではご利用いただけない機能です。\n\nご不便をおかけしまして申し訳ございません。',
|
||||||
'SE_FindReplace.replaceKeywordNotFound' : '変更される単語がありません。',
|
'SE_FindReplace.replaceKeywordNotFound': '変更される単語がありません。',
|
||||||
'SE_LineHeight.invalidLineHeight' : '誤った値です。',
|
'SE_LineHeight.invalidLineHeight': '誤った値です。',
|
||||||
'SE_Footnote.defaultText' : '脚注内容を入力してください。',
|
'SE_Footnote.defaultText': '脚注内容を入力してください。',
|
||||||
'SE.failedToLoadFlash' : 'フラッシュが遮断されているため、この機能は使用できません。',
|
'SE.failedToLoadFlash': 'フラッシュが遮断されているため、この機能は使用できません。',
|
||||||
'SE2M_EditingModeChanger.confirmTextMode' : 'テキストモードに切り換えると、作成された内容は維持されますが、\n\nフォント等の編集効果と画像等の添付内容が消えることになります。\n\n切り換えますか?',
|
'SE2M_EditingModeChanger.confirmTextMode': 'テキストモードに切り換えると、作成された内容は維持されますが、\n\nフォント等の編集効果と画像等の添付内容が消えることになります。\n\n切り換えますか?',
|
||||||
'SE2M_FontNameWithLayerUI.sSampleText' : 'あいうえお'
|
'SE2M_FontNameWithLayerUI.sSampleText': 'あいうえお'
|
||||||
};
|
};
|
||||||
|
|
@ -15,25 +15,25 @@ You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
if(typeof window.nhn=='undefined'){window.nhn = {};}
|
if (typeof window.nhn == 'undefined') { window.nhn = {}; }
|
||||||
/**
|
/**
|
||||||
* @fileOverview This file contains a message mapping(Korean), which is used to map the message code to the actual message
|
* @fileOverview This file contains a message mapping(Korean), which is used to map the message code to the actual message
|
||||||
* @name husky_SE2B_Lang_ko_KR.js
|
* @name husky_SE2B_Lang_ko_KR.js
|
||||||
* @ unescape
|
* @ unescape
|
||||||
*/
|
*/
|
||||||
var oMessageMap = {
|
var oMessageMap = {
|
||||||
'SE_EditingAreaManager.onExit' : '내용이 변경되었습니다.',
|
'SE_EditingAreaManager.onExit': '내용이 변경되었습니다.',
|
||||||
'SE_Color.invalidColorCode' : '색상 코드를 올바르게 입력해 주세요. \n\n 예) #000000, #FF0000, #FFFFFF, #ffffff, ffffff',
|
'SE_Color.invalidColorCode': '색상 코드를 올바르게 입력해 주세요. \n\n 예) #000000, #FF0000, #FFFFFF, #ffffff, ffffff',
|
||||||
'SE_Hyperlink.invalidURL' : '입력하신 URL이 올바르지 않습니다.',
|
'SE_Hyperlink.invalidURL': '입력하신 URL이 올바르지 않습니다.',
|
||||||
'SE_FindReplace.keywordMissing' : '찾으실 단어를 입력해 주세요.',
|
'SE_FindReplace.keywordMissing': '찾으실 단어를 입력해 주세요.',
|
||||||
'SE_FindReplace.keywordNotFound' : '찾으실 단어가 없습니다.',
|
'SE_FindReplace.keywordNotFound': '찾으실 단어가 없습니다.',
|
||||||
'SE_FindReplace.replaceAllResultP1' : '일치하는 내용이 총 ',
|
'SE_FindReplace.replaceAllResultP1': '일치하는 내용이 총 ',
|
||||||
'SE_FindReplace.replaceAllResultP2' : '건 바뀌었습니다.',
|
'SE_FindReplace.replaceAllResultP2': '건 바뀌었습니다.',
|
||||||
'SE_FindReplace.notSupportedBrowser' : '현재 사용하고 계신 브라우저에서는 사용하실수 없는 기능입니다.\n\n이용에 불편을 드려 죄송합니다.',
|
'SE_FindReplace.notSupportedBrowser': '현재 사용하고 계신 브라우저에서는 사용하실수 없는 기능입니다.\n\n이용에 불편을 드려 죄송합니다.',
|
||||||
'SE_FindReplace.replaceKeywordNotFound' : '바뀔 단어가 없습니다',
|
'SE_FindReplace.replaceKeywordNotFound': '바뀔 단어가 없습니다',
|
||||||
'SE_LineHeight.invalidLineHeight' : '잘못된 값입니다.',
|
'SE_LineHeight.invalidLineHeight': '잘못된 값입니다.',
|
||||||
'SE_Footnote.defaultText' : '각주내용을 입력해 주세요',
|
'SE_Footnote.defaultText': '각주내용을 입력해 주세요',
|
||||||
'SE.failedToLoadFlash' : '플래시가 차단되어 있어 해당 기능을 사용할 수 없습니다.',
|
'SE.failedToLoadFlash': '플래시가 차단되어 있어 해당 기능을 사용할 수 없습니다.',
|
||||||
'SE2M_EditingModeChanger.confirmTextMode' : '텍스트 모드로 전환하면 작성된 내용은 유지되나, \n\n글꼴 등의 편집효과와 이미지 등의 첨부내용이 모두 사라지게 됩니다.\n\n전환하시겠습니까?',
|
'SE2M_EditingModeChanger.confirmTextMode': '텍스트 모드로 전환하면 작성된 내용은 유지되나, \n\n글꼴 등의 편집효과와 이미지 등의 첨부내용이 모두 사라지게 됩니다.\n\n전환하시겠습니까?',
|
||||||
'SE2M_FontNameWithLayerUI.sSampleText' : '가나다라'
|
'SE2M_FontNameWithLayerUI.sSampleText': '가나다라'
|
||||||
};
|
};
|
||||||
|
|
@ -15,25 +15,25 @@ You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
if(typeof window.nhn=='undefined'){window.nhn = {};}
|
if (typeof window.nhn == 'undefined') { window.nhn = {}; }
|
||||||
/**
|
/**
|
||||||
* @fileOverview This file contains a message mapping(Korean), which is used to map the message code to the actual message
|
* @fileOverview This file contains a message mapping(Korean), which is used to map the message code to the actual message
|
||||||
* @name husky_SE2B_Lang_zh_CN.js
|
* @name husky_SE2B_Lang_zh_CN.js
|
||||||
* @ unescape
|
* @ unescape
|
||||||
*/
|
*/
|
||||||
var oMessageMap_zh_CN = {
|
var oMessageMap_zh_CN = {
|
||||||
'SE_EditingAreaManager.onExit' : '内容有了变化。',
|
'SE_EditingAreaManager.onExit': '内容有了变化。',
|
||||||
'SE_Color.invalidColorCode' : '请你输入正确的色相代码。 \n\n 例) #000000, #FF0000, #FFFFFF, #ffffff, ffffff',
|
'SE_Color.invalidColorCode': '请你输入正确的色相代码。 \n\n 例) #000000, #FF0000, #FFFFFF, #ffffff, ffffff',
|
||||||
'SE_Hyperlink.invalidURL' : '你输入的URL不符条件。',
|
'SE_Hyperlink.invalidURL': '你输入的URL不符条件。',
|
||||||
'SE_FindReplace.keywordMissing' : '请你输入要找的词汇。',
|
'SE_FindReplace.keywordMissing': '请你输入要找的词汇。',
|
||||||
'SE_FindReplace.keywordNotFound' : '没有词汇符合条件。',
|
'SE_FindReplace.keywordNotFound': '没有词汇符合条件。',
|
||||||
'SE_FindReplace.replaceAllResultP1' : '符合条件的内容改编为',
|
'SE_FindReplace.replaceAllResultP1': '符合条件的内容改编为',
|
||||||
'SE_FindReplace.replaceAllResultP2' : '件',
|
'SE_FindReplace.replaceAllResultP2': '件',
|
||||||
'SE_FindReplace.notSupportedBrowser' : '这是你现在使用的浏览器不可支持的功能。\n\n麻烦你很道歉。',
|
'SE_FindReplace.notSupportedBrowser': '这是你现在使用的浏览器不可支持的功能。\n\n麻烦你很道歉。',
|
||||||
'SE_FindReplace.replaceKeywordNotFound' : '没有词汇要改变。',
|
'SE_FindReplace.replaceKeywordNotFound': '没有词汇要改变。',
|
||||||
'SE_LineHeight.invalidLineHeight' : '这是有问题的值。',
|
'SE_LineHeight.invalidLineHeight': '这是有问题的值。',
|
||||||
'SE_Footnote.defaultText' : '请你输入脚注内容。',
|
'SE_Footnote.defaultText': '请你输入脚注内容。',
|
||||||
'SE.failedToLoadFlash' : 'flash被隔绝,不能使用该功能。',
|
'SE.failedToLoadFlash': 'flash被隔绝,不能使用该功能。',
|
||||||
'SE2M_EditingModeChanger.confirmTextMode' : '转换为text模式就能维持制作内容,\n\n但字体等编辑效果和图像等附件内容都会消失。\n\n你还要继续吗?',
|
'SE2M_EditingModeChanger.confirmTextMode': '转换为text模式就能维持制作内容,\n\n但字体等编辑效果和图像等附件内容都会消失。\n\n你还要继续吗?',
|
||||||
'SE2M_FontNameWithLayerUI.sSampleText' : 'ABCD'
|
'SE2M_FontNameWithLayerUI.sSampleText': 'ABCD'
|
||||||
};
|
};
|
||||||
|
|
@ -15,25 +15,25 @@ You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
if(typeof window.nhn=='undefined'){window.nhn = {};}
|
if (typeof window.nhn == 'undefined') { window.nhn = {}; }
|
||||||
/**
|
/**
|
||||||
* @fileOverview This file contains a message mapping(Korean), which is used to map the message code to the actual message
|
* @fileOverview This file contains a message mapping(Korean), which is used to map the message code to the actual message
|
||||||
* @name husky_SE2B_Lang_zh_TW.js
|
* @name husky_SE2B_Lang_zh_TW.js
|
||||||
* @ unescape
|
* @ unescape
|
||||||
*/
|
*/
|
||||||
var oMessageMap_zh_TW = {
|
var oMessageMap_zh_TW = {
|
||||||
'SE_EditingAreaManager.onExit' : '內容已被更改。',
|
'SE_EditingAreaManager.onExit': '內容已被更改。',
|
||||||
'SE_Color.invalidColorCode' : '請輸入正確的顔色代碼。\n\n例子)#000000, #FF0000, #FFFFFF, #ffffff, ffffff',
|
'SE_Color.invalidColorCode': '請輸入正確的顔色代碼。\n\n例子)#000000, #FF0000, #FFFFFF, #ffffff, ffffff',
|
||||||
'SE_Hyperlink.invalidURL' : '輸錯URL',
|
'SE_Hyperlink.invalidURL': '輸錯URL',
|
||||||
'SE_FindReplace.keywordMissing' : '請輸入要查詢的單詞。',
|
'SE_FindReplace.keywordMissing': '請輸入要查詢的單詞。',
|
||||||
'SE_FindReplace.keywordNotFound' : '要查詢的單詞不存在。',
|
'SE_FindReplace.keywordNotFound': '要查詢的單詞不存在。',
|
||||||
'SE_FindReplace.replaceAllResultP1' : '一致的內容總有',
|
'SE_FindReplace.replaceAllResultP1': '一致的內容總有',
|
||||||
'SE_FindReplace.replaceAllResultP2' : '件已被更改。',
|
'SE_FindReplace.replaceAllResultP2': '件已被更改。',
|
||||||
'SE_FindReplace.notSupportedBrowser' : '當前的浏覽器上無法使用此功能。\n\n很抱歉給你添麻煩了。',
|
'SE_FindReplace.notSupportedBrowser': '當前的浏覽器上無法使用此功能。\n\n很抱歉給你添麻煩了。',
|
||||||
'SE_FindReplace.replaceKeywordNotFound' : '要更改的詞彙不存在。',
|
'SE_FindReplace.replaceKeywordNotFound': '要更改的詞彙不存在。',
|
||||||
'SE_LineHeight.invalidLineHeight' : '爲有錯誤的值。',
|
'SE_LineHeight.invalidLineHeight': '爲有錯誤的值。',
|
||||||
'SE_Footnote.defaultText' : '請輸入注腳內容。',
|
'SE_Footnote.defaultText': '請輸入注腳內容。',
|
||||||
'SE.failedToLoadFlash' : 'Flash被屏蔽,導致無法使用此功能。',
|
'SE.failedToLoadFlash': 'Flash被屏蔽,導致無法使用此功能。',
|
||||||
'SE2M_EditingModeChanger.confirmTextMode' : '如轉換爲文本模式,雖然維持已寫成的內容,\n\n但字號等編輯效果和圖像等附加內容都會被消失。\n\n是否轉換?',
|
'SE2M_EditingModeChanger.confirmTextMode': '如轉換爲文本模式,雖然維持已寫成的內容,\n\n但字號等編輯效果和圖像等附加內容都會被消失。\n\n是否轉換?',
|
||||||
'SE2M_FontNameWithLayerUI.sSampleText' : 'ABCD'
|
'SE2M_FontNameWithLayerUI.sSampleText': 'ABCD'
|
||||||
};
|
};
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -6,23 +6,23 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
nhn.husky.SE2M_AttachQuickPhoto = jindo.$Class({
|
nhn.husky.SE2M_AttachQuickPhoto = jindo.$Class({
|
||||||
name : "SE2M_AttachQuickPhoto",
|
name: "SE2M_AttachQuickPhoto",
|
||||||
|
|
||||||
$init : function(){},
|
$init: function () { },
|
||||||
|
|
||||||
$ON_MSG_APP_READY : function(){
|
$ON_MSG_APP_READY: function () {
|
||||||
this.oApp.exec("REGISTER_UI_EVENT", ["photo_attach", "click", "ATTACHPHOTO_OPEN_WINDOW"]);
|
this.oApp.exec("REGISTER_UI_EVENT", ["photo_attach", "click", "ATTACHPHOTO_OPEN_WINDOW"]);
|
||||||
},
|
},
|
||||||
|
|
||||||
$LOCAL_BEFORE_FIRST : function(sMsg){
|
$LOCAL_BEFORE_FIRST: function (sMsg) {
|
||||||
if(!!this.oPopupMgr){ return; }
|
if (!!this.oPopupMgr) { return; }
|
||||||
// Popup Manager에서 사용할 param
|
// Popup Manager에서 사용할 param
|
||||||
this.htPopupOption = {
|
this.htPopupOption = {
|
||||||
oApp : this.oApp,
|
oApp: this.oApp,
|
||||||
sName : this.name,
|
sName: this.name,
|
||||||
bScroll : false,
|
bScroll: false,
|
||||||
sProperties : "",
|
sProperties: "",
|
||||||
sUrl : ""
|
sUrl: ""
|
||||||
};
|
};
|
||||||
this.oPopupMgr = nhn.husky.PopUpManager.getInstance(this.oApp);
|
this.oPopupMgr = nhn.husky.PopUpManager.getInstance(this.oApp);
|
||||||
},
|
},
|
||||||
|
|
@ -30,10 +30,10 @@ nhn.husky.SE2M_AttachQuickPhoto = jindo.$Class({
|
||||||
/**
|
/**
|
||||||
* 포토 웹탑 오픈
|
* 포토 웹탑 오픈
|
||||||
*/
|
*/
|
||||||
$ON_ATTACHPHOTO_OPEN_WINDOW : function(){
|
$ON_ATTACHPHOTO_OPEN_WINDOW: function () {
|
||||||
this.htPopupOption.sUrl = this.makePopupURL();
|
this.htPopupOption.sUrl = this.makePopupURL();
|
||||||
//this.htPopupOption.sProperties = "left=0,top=0,width=640,height=459,scrollbars=yes,location=no,status=0,resizable=no";
|
//this.htPopupOption.sProperties = "left=0,top=0,width=640,height=459,scrollbars=yes,location=no,status=0,resizable=no";
|
||||||
this.htPopupOption.sProperties = "left="+(screen.width-640)/2+", top="+(screen.height-459)/2+",width=640,height=459,scrollbars=yes,location=no,status=0,resizable=no";
|
this.htPopupOption.sProperties = "left=" + (screen.width - 640) / 2 + ", top=" + (screen.height - 459) / 2 + ",width=640,height=459,scrollbars=yes,location=no,status=0,resizable=no";
|
||||||
|
|
||||||
this.oPopupWindow = this.oPopupMgr.openWindow(this.htPopupOption);
|
this.oPopupWindow = this.oPopupMgr.openWindow(this.htPopupOption);
|
||||||
|
|
||||||
|
|
@ -47,7 +47,7 @@ nhn.husky.SE2M_AttachQuickPhoto = jindo.$Class({
|
||||||
* 서비스별로 팝업에 parameter를 추가하여 URL을 생성하는 함수
|
* 서비스별로 팝업에 parameter를 추가하여 URL을 생성하는 함수
|
||||||
* nhn.husky.SE2M_AttachQuickPhoto.prototype.makePopupURL로 덮어써서 사용하시면 됨.
|
* nhn.husky.SE2M_AttachQuickPhoto.prototype.makePopupURL로 덮어써서 사용하시면 됨.
|
||||||
*/
|
*/
|
||||||
makePopupURL : function(){
|
makePopupURL: function () {
|
||||||
//var sPopupUrl = "./photo_uploader/popup/photo_uploader.html";
|
//var sPopupUrl = "./photo_uploader/popup/photo_uploader.html";
|
||||||
var sPopupUrl = "./photo_uploader/popup/index.html";
|
var sPopupUrl = "./photo_uploader/popup/index.html";
|
||||||
return sPopupUrl;
|
return sPopupUrl;
|
||||||
|
|
@ -56,35 +56,35 @@ nhn.husky.SE2M_AttachQuickPhoto = jindo.$Class({
|
||||||
/**
|
/**
|
||||||
* 팝업에서 호출되는 메세지.
|
* 팝업에서 호출되는 메세지.
|
||||||
*/
|
*/
|
||||||
$ON_SET_PHOTO : function(aPhotoData){
|
$ON_SET_PHOTO: function (aPhotoData) {
|
||||||
var sContents,
|
var sContents,
|
||||||
aPhotoInfo,
|
aPhotoInfo,
|
||||||
htData;
|
htData;
|
||||||
|
|
||||||
if( !aPhotoData ){
|
if (!aPhotoData) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try{
|
try {
|
||||||
sContents = "";
|
sContents = "";
|
||||||
for(var i = 0; i <aPhotoData.length; i++){
|
for (var i = 0; i < aPhotoData.length; i++) {
|
||||||
htData = aPhotoData[i];
|
htData = aPhotoData[i];
|
||||||
|
|
||||||
if(!htData.sAlign){
|
if (!htData.sAlign) {
|
||||||
htData.sAlign = "";
|
htData.sAlign = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
aPhotoInfo = {
|
aPhotoInfo = {
|
||||||
sName : htData.sFileName || "",
|
sName: htData.sFileName || "",
|
||||||
sOriginalImageURL : htData.sFileURL,
|
sOriginalImageURL: htData.sFileURL,
|
||||||
bNewLine : htData.bNewLine || false
|
bNewLine: htData.bNewLine || false
|
||||||
};
|
};
|
||||||
|
|
||||||
sContents += this._getPhotoTag(aPhotoInfo);
|
sContents += this._getPhotoTag(aPhotoInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.oApp.exec("PASTE_HTML", [sContents]); // 위즐 첨부 파일 부분 확인
|
this.oApp.exec("PASTE_HTML", [sContents]); // 위즐 첨부 파일 부분 확인
|
||||||
}catch(e){
|
} catch (e) {
|
||||||
// upload시 error발생에 대해서 skip함
|
// upload시 error발생에 대해서 skip함
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -93,10 +93,10 @@ nhn.husky.SE2M_AttachQuickPhoto = jindo.$Class({
|
||||||
/**
|
/**
|
||||||
* @use 일반 포토 tag 생성
|
* @use 일반 포토 tag 생성
|
||||||
*/
|
*/
|
||||||
_getPhotoTag : function(htPhotoInfo){
|
_getPhotoTag: function (htPhotoInfo) {
|
||||||
// id와 class는 썸네일과 연관이 많습니다. 수정시 썸네일 영역도 Test
|
// id와 class는 썸네일과 연관이 많습니다. 수정시 썸네일 영역도 Test
|
||||||
var sTag = '<img src="{=sOriginalImageURL}" title="{=sName}" >';
|
var sTag = '<img src="{=sOriginalImageURL}" title="{=sName}" >';
|
||||||
if(htPhotoInfo.bNewLine){
|
if (htPhotoInfo.bNewLine) {
|
||||||
sTag += '<br style="clear:both;">';
|
sTag += '<br style="clear:both;">';
|
||||||
}
|
}
|
||||||
sTag = jindo.$Template(sTag).process(htPhotoInfo);
|
sTag = jindo.$Template(sTag).process(htPhotoInfo);
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
font-size: inherit;
|
font-size: inherit;
|
||||||
direction: inherit;
|
direction: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fileinput-button span {
|
.fileinput-button span {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,15 +14,18 @@
|
||||||
.fileupload-buttonbar .toggle {
|
.fileupload-buttonbar .toggle {
|
||||||
margin-bottom: 5px;
|
margin-bottom: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.progress-animated .progress-bar,
|
.progress-animated .progress-bar,
|
||||||
.progress-animated .bar {
|
.progress-animated .bar {
|
||||||
background: url("../img/progressbar.gif") !important;
|
background: url("../img/progressbar.gif") !important;
|
||||||
filter: none;
|
filter: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fileupload-process {
|
.fileupload-process {
|
||||||
float: right;
|
float: right;
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fileupload-processing .fileupload-process,
|
.fileupload-processing .fileupload-process,
|
||||||
.files .processing .preview {
|
.files .processing .preview {
|
||||||
display: block;
|
display: block;
|
||||||
|
|
@ -31,25 +34,30 @@
|
||||||
background: url("../img/loading.gif") center no-repeat;
|
background: url("../img/loading.gif") center no-repeat;
|
||||||
background-size: contain;
|
background-size: contain;
|
||||||
}
|
}
|
||||||
|
|
||||||
.files audio,
|
.files audio,
|
||||||
.files video {
|
.files video {
|
||||||
max-width: 300px;
|
max-width: 300px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 767px) {
|
@media (max-width: 767px) {
|
||||||
|
|
||||||
.fileupload-buttonbar .toggle,
|
.fileupload-buttonbar .toggle,
|
||||||
.files .toggle,
|
.files .toggle,
|
||||||
.files .btn span {
|
.files .btn span {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.files .name {
|
.files .name {
|
||||||
width: 80px;
|
width: 80px;
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
.files audio,
|
.files audio,
|
||||||
.files video {
|
.files video {
|
||||||
max-width: 80px;
|
max-width: 80px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.files img,
|
.files img,
|
||||||
.files canvas {
|
.files canvas {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fileinput-button input {
|
.fileinput-button input {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
|
|
||||||
|
|
@ -10,90 +10,210 @@
|
||||||
* http://www.opensource.org/licenses/MIT
|
* http://www.opensource.org/licenses/MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
body {margin:0;padding:0;overflow-x:hidden}
|
body {
|
||||||
body,input,textarea,select,button,table{font-family:'돋움',Dotum,Helvetica,sans-serif;font-size:12px}
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
#pop_header{height:26px;padding:14px 0 0 20px;border-bottom:1px solid #ededeb;background:#f4f4f3}
|
overflow-x: hidden
|
||||||
#pop_header h1{color:#333;font-size:14px;letter-spacing:-1px;margin:0;padding:0}
|
|
||||||
|
|
||||||
.content_container{padding:5px 10px}
|
|
||||||
|
|
||||||
.swfupload{OUTLINE-WIDTH: 0px; OUTLINE-STYLE: none; OUTLINE-COLOR: invert}
|
|
||||||
|
|
||||||
.pop_container .drag_area{overflow:hidden;overflow-y:auto;position:relative;width:100%;height:250px;margin-top:4px;border:1px solid #eceff2}
|
|
||||||
.pop_container .blind{visibility:hidden;position:absolute;line-height:0}
|
|
||||||
.pop_container .drag_area .bg{position:absolute;top:0;left:0;width:100%;height:250px;background: #fdfdfd url(../../../img/photoQuickPopup/bg_drag_image.png) 50% 50% no-repeat;}
|
|
||||||
.pop_container .drag_area .showbg{display:block}
|
|
||||||
.pop_container .drag_area .hidebg{display:none}
|
|
||||||
|
|
||||||
ul.sortable{margin:0;padding:0;*zoom:1}
|
|
||||||
ul.sortable:after{display:block;clear:both;content:""}
|
|
||||||
|
|
||||||
.sortable > li{
|
|
||||||
list-style:none;
|
|
||||||
float: left;
|
|
||||||
width: 110px;
|
|
||||||
height:110px;
|
|
||||||
overflow: hidden;
|
|
||||||
text-align: center;
|
|
||||||
margin: 4px 3px; border: 1px solid #DDDDDD;padding:1px; cursor: move;
|
|
||||||
background: #ffffff;
|
|
||||||
}
|
}
|
||||||
.sortable > li:hover, .sortable > li.ui-sortable-helper{border:2px solid #E58524;padding:0;}
|
|
||||||
|
|
||||||
.sortable > li > div{
|
body,
|
||||||
background: #f7f7f7;
|
input,
|
||||||
color:#808080;
|
textarea,
|
||||||
margin:0;
|
select,
|
||||||
font-size:11px;
|
button,
|
||||||
height:106px;
|
table {
|
||||||
width:100%;
|
font-family: '돋움', Dotum, Helvetica, sans-serif;
|
||||||
overflow: hidden;
|
font-size: 12px
|
||||||
white-space:nowrap;-o-text-overflow:ellipsis;text-overflow:ellipsis;
|
|
||||||
position:relative;
|
|
||||||
}
|
}
|
||||||
.sortable > li > div > img{margin:3px;}
|
|
||||||
.sortable > li > div .delete_img{position:absolute;top:0;right:0px;display:none}
|
#pop_header {
|
||||||
.sortable > li:hover > div .delete_img{display:block;cursor:pointer}
|
height: 26px;
|
||||||
.sortable > li.placeholder{
|
padding: 14px 0 0 20px;
|
||||||
border: dashed 2px #ccc;background-color:#FFF;padding:0;
|
border-bottom: 1px solid #ededeb;
|
||||||
|
background: #f4f4f3
|
||||||
|
}
|
||||||
|
|
||||||
|
#pop_header h1 {
|
||||||
|
color: #333;
|
||||||
|
font-size: 14px;
|
||||||
|
letter-spacing: -1px;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
.content_container {
|
||||||
|
padding: 5px 10px
|
||||||
|
}
|
||||||
|
|
||||||
|
.swfupload {
|
||||||
|
OUTLINE-WIDTH: 0px;
|
||||||
|
OUTLINE-STYLE: none;
|
||||||
|
OUTLINE-COLOR: invert
|
||||||
|
}
|
||||||
|
|
||||||
|
.pop_container .drag_area {
|
||||||
|
overflow: hidden;
|
||||||
|
overflow-y: auto;
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 250px;
|
||||||
|
margin-top: 4px;
|
||||||
|
border: 1px solid #eceff2
|
||||||
|
}
|
||||||
|
|
||||||
|
.pop_container .blind {
|
||||||
|
visibility: hidden;
|
||||||
|
position: absolute;
|
||||||
|
line-height: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
.pop_container .drag_area .bg {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 250px;
|
||||||
|
background: #fdfdfd url(../../../img/photoQuickPopup/bg_drag_image.png) 50% 50% no-repeat;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pop_container .drag_area .showbg {
|
||||||
|
display: block
|
||||||
|
}
|
||||||
|
|
||||||
|
.pop_container .drag_area .hidebg {
|
||||||
|
display: none
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.sortable {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
*zoom: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.sortable:after {
|
||||||
|
display: block;
|
||||||
|
clear: both;
|
||||||
|
content: ""
|
||||||
|
}
|
||||||
|
|
||||||
|
.sortable>li {
|
||||||
|
list-style: none;
|
||||||
|
float: left;
|
||||||
|
width: 110px;
|
||||||
|
height: 110px;
|
||||||
|
overflow: hidden;
|
||||||
|
text-align: center;
|
||||||
|
margin: 4px 3px;
|
||||||
|
border: 1px solid #DDDDDD;
|
||||||
|
padding: 1px;
|
||||||
|
cursor: move;
|
||||||
|
background: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sortable>li:hover,
|
||||||
|
.sortable>li.ui-sortable-helper {
|
||||||
|
border: 2px solid #E58524;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sortable>li>div {
|
||||||
|
background: #f7f7f7;
|
||||||
|
color: #808080;
|
||||||
|
margin: 0;
|
||||||
|
font-size: 11px;
|
||||||
|
height: 106px;
|
||||||
|
width: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
|
-o-text-overflow: ellipsis;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sortable>li>div>img {
|
||||||
|
margin: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sortable>li>div .delete_img {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0px;
|
||||||
|
display: none
|
||||||
|
}
|
||||||
|
|
||||||
|
.sortable>li:hover>div .delete_img {
|
||||||
|
display: block;
|
||||||
|
cursor: pointer
|
||||||
|
}
|
||||||
|
|
||||||
|
.sortable>li.placeholder {
|
||||||
|
border: dashed 2px #ccc;
|
||||||
|
background-color: #FFF;
|
||||||
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn {
|
.btn {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
background-image: none;
|
background-image: none;
|
||||||
border: 1px solid transparent;
|
border: 1px solid transparent;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
padding: 6px 12px;
|
padding: 6px 12px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
line-height: 1.42857143;
|
line-height: 1.42857143;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
-webkit-user-select: none;
|
-webkit-user-select: none;
|
||||||
-moz-user-select: none;
|
-moz-user-select: none;
|
||||||
-ms-user-select: none;
|
-ms-user-select: none;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-success {
|
.btn-success {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
background-color: #5cb85c;
|
background-color: #5cb85c;
|
||||||
border-color: #4cae4c;
|
border-color: #4cae4c;
|
||||||
}
|
}
|
||||||
.btn:hover, .btn:focus {
|
|
||||||
color: #333;
|
.btn:hover,
|
||||||
text-decoration: none;
|
.btn:focus {
|
||||||
|
color: #333;
|
||||||
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
.btn-success:hover, .btn-success:focus, .btn-success:active, .btn-success.active, .open .dropdown-toggle.btn-success {
|
|
||||||
color: #fff;
|
.btn-success:hover,
|
||||||
background-color: #47a447;
|
.btn-success:focus,
|
||||||
border-color: #398439;
|
.btn-success:active,
|
||||||
|
.btn-success.active,
|
||||||
|
.open .dropdown-toggle.btn-success {
|
||||||
|
color: #fff;
|
||||||
|
background-color: #47a447;
|
||||||
|
border-color: #398439;
|
||||||
|
}
|
||||||
|
|
||||||
|
.seletion_explain {
|
||||||
|
margin: 10px 0
|
||||||
|
}
|
||||||
|
|
||||||
|
.drag_explain {
|
||||||
|
position: relative;
|
||||||
|
height: 36px
|
||||||
|
}
|
||||||
|
|
||||||
|
.drag_explain p {
|
||||||
|
padding: 12px 0 0 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file_selet_group {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn_group {
|
||||||
|
text-align: center
|
||||||
}
|
}
|
||||||
.seletion_explain{margin:10px 0}
|
|
||||||
.drag_explain{position:relative;height:36px}
|
|
||||||
.drag_explain p {padding:12px 0 0 0;margin:0;}
|
|
||||||
.file_selet_group{position:absolute;top:0;right:0}
|
|
||||||
.btn_group{text-align:center}
|
|
||||||
|
|
@ -55,12 +55,8 @@
|
||||||
<!-- The Iframe Transport is required for browsers without support for XHR file uploads -->
|
<!-- The Iframe Transport is required for browsers without support for XHR file uploads -->
|
||||||
<script src="./js/jquery.iframe-transport.js"></script>
|
<script src="./js/jquery.iframe-transport.js"></script>
|
||||||
|
|
||||||
<script type="text/javascript" src="./swfupload/swfupload.js?v=210625-1329"></script>
|
|
||||||
<script type="text/javascript" src="./swfupload/jquery.swfupload.js?v=210625-1329"></script>
|
|
||||||
|
|
||||||
<!-- The basic File Upload plugin -->
|
<!-- The basic File Upload plugin -->
|
||||||
<script src="./js/jquery.fileupload.js?v=210625-1329"></script>
|
<script src="./js/jquery.fileupload.js?v=210625-1329"></script>
|
||||||
|
|
||||||
<script src="./js/basic.js?v=210625-1329"></script>
|
<script src="./js/basic.js?v=210625-1329"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ jQuery(function ($) {
|
||||||
if (!preload && !othis.filter.test(file.type)) {
|
if (!preload && !othis.filter.test(file.type)) {
|
||||||
var agent = navigator.userAgent.toLowerCase();
|
var agent = navigator.userAgent.toLowerCase();
|
||||||
var msg = '';
|
var msg = '';
|
||||||
msg = (agent.indexOf('trident') != -1 || agent.indexOf("msie") != -1)? "익스플로러 환경에서는 gif, png, jpg 파일만 \n전송할 수 있습니다.":"이미지만 허용합니다.";
|
msg = (agent.indexOf('trident') != -1 || agent.indexOf("msie") != -1) ? "익스플로러 환경에서는 gif, png, jpg 파일만 \n전송할 수 있습니다." : "이미지만 허용합니다.";
|
||||||
data.context.remove();
|
data.context.remove();
|
||||||
alert(msg);
|
alert(msg);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,7 @@
|
||||||
if (data.context) {
|
if (data.context) {
|
||||||
data.context.each(function (index) {
|
data.context.each(function (index) {
|
||||||
var file = files[index] ||
|
var file = files[index] ||
|
||||||
{error: 'Empty file upload result'};
|
{ error: 'Empty file upload result' };
|
||||||
deferred = that._addFinishedDeferreds();
|
deferred = that._addFinishedDeferreds();
|
||||||
that._transition($(this)).done(
|
that._transition($(this)).done(
|
||||||
function () {
|
function () {
|
||||||
|
|
@ -407,7 +407,7 @@
|
||||||
'DownloadURL',
|
'DownloadURL',
|
||||||
[type, name, url].join(':')
|
[type, name, url].join(':')
|
||||||
);
|
);
|
||||||
} catch (ignore) {}
|
} catch (ignore) { }
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -253,7 +253,7 @@
|
||||||
processData: false,
|
processData: false,
|
||||||
contentType: false,
|
contentType: false,
|
||||||
cache: false,
|
cache: false,
|
||||||
container_el : null //사용자추가
|
container_el: null //사용자추가
|
||||||
},
|
},
|
||||||
|
|
||||||
// A list of options that require reinitializing event listeners and/or
|
// A list of options that require reinitializing event listeners and/or
|
||||||
|
|
@ -303,7 +303,7 @@
|
||||||
if ($.type(options.formData) === 'object') {
|
if ($.type(options.formData) === 'object') {
|
||||||
formData = [];
|
formData = [];
|
||||||
$.each(options.formData, function (name, value) {
|
$.each(options.formData, function (name, value) {
|
||||||
formData.push({name: name, value: value});
|
formData.push({ name: name, value: value });
|
||||||
});
|
});
|
||||||
return formData;
|
return formData;
|
||||||
}
|
}
|
||||||
|
|
@ -377,14 +377,14 @@
|
||||||
// property calculated accordingly:
|
// property calculated accordingly:
|
||||||
this._trigger(
|
this._trigger(
|
||||||
'progress',
|
'progress',
|
||||||
$.Event('progress', {delegatedEvent: e}),
|
$.Event('progress', { delegatedEvent: e }),
|
||||||
data
|
data
|
||||||
);
|
);
|
||||||
// Trigger a global progress event for all current file uploads,
|
// Trigger a global progress event for all current file uploads,
|
||||||
// including ajax calls queued for sequential file uploads:
|
// including ajax calls queued for sequential file uploads:
|
||||||
this._trigger(
|
this._trigger(
|
||||||
'progressall',
|
'progressall',
|
||||||
$.Event('progressall', {delegatedEvent: e}),
|
$.Event('progressall', { delegatedEvent: e }),
|
||||||
this._progress
|
this._progress
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -645,7 +645,7 @@
|
||||||
data.jqXHR = this.jqXHR =
|
data.jqXHR = this.jqXHR =
|
||||||
(that._trigger(
|
(that._trigger(
|
||||||
'submit',
|
'submit',
|
||||||
$.Event('submit', {delegatedEvent: e}),
|
$.Event('submit', { delegatedEvent: e }),
|
||||||
this
|
this
|
||||||
) !== false) && that._onSend(e, this);
|
) !== false) && that._onSend(e, this);
|
||||||
}
|
}
|
||||||
|
|
@ -875,7 +875,7 @@
|
||||||
jqXHR = jqXHR || (
|
jqXHR = jqXHR || (
|
||||||
((aborted || that._trigger(
|
((aborted || that._trigger(
|
||||||
'send',
|
'send',
|
||||||
$.Event('send', {delegatedEvent: e}),
|
$.Event('send', { delegatedEvent: e }),
|
||||||
options
|
options
|
||||||
) === false) &&
|
) === false) &&
|
||||||
that._getXHRPromise(false, options.context, aborted)) ||
|
that._getXHRPromise(false, options.context, aborted)) ||
|
||||||
|
|
@ -961,8 +961,7 @@
|
||||||
i,
|
i,
|
||||||
j = 0;
|
j = 0;
|
||||||
|
|
||||||
if ( options.limit_filesLength && filesLength > options.limit_filesLength)
|
if (options.limit_filesLength && filesLength > options.limit_filesLength) {
|
||||||
{
|
|
||||||
filesLength = options.limit_filesLength; //사용자추가
|
filesLength = options.limit_filesLength; //사용자추가
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -987,7 +986,7 @@
|
||||||
} else if (!options.singleFileUploads && limitSize) {
|
} else if (!options.singleFileUploads && limitSize) {
|
||||||
fileSet = [];
|
fileSet = [];
|
||||||
paramNameSet = [];
|
paramNameSet = [];
|
||||||
console.log( filesLength );
|
console.log(filesLength);
|
||||||
for (i = 0; i < filesLength; i = i + 1) {
|
for (i = 0; i < filesLength; i = i + 1) {
|
||||||
batchSize += files[i].size + overhead;
|
batchSize += files[i].size + overhead;
|
||||||
if (i + 1 === filesLength ||
|
if (i + 1 === filesLength ||
|
||||||
|
|
@ -1009,7 +1008,7 @@
|
||||||
data.originalFiles = files;
|
data.originalFiles = files;
|
||||||
$.each(fileSet || files, function (index, element) {
|
$.each(fileSet || files, function (index, element) {
|
||||||
|
|
||||||
if( filesLength <= index) return true; //사용자 추가
|
if (filesLength <= index) return true; //사용자 추가
|
||||||
var newData = $.extend({}, data);
|
var newData = $.extend({}, data);
|
||||||
newData.files = fileSet ? element : [element];
|
newData.files = fileSet ? element : [element];
|
||||||
newData.paramName = paramNameSet[index];
|
newData.paramName = paramNameSet[index];
|
||||||
|
|
@ -1018,7 +1017,7 @@
|
||||||
that._addConvenienceMethods(e, newData);
|
that._addConvenienceMethods(e, newData);
|
||||||
result = that._trigger(
|
result = that._trigger(
|
||||||
'add',
|
'add',
|
||||||
$.Event('add', {delegatedEvent: e}),
|
$.Event('add', { delegatedEvent: e }),
|
||||||
newData
|
newData
|
||||||
);
|
);
|
||||||
return result;
|
return result;
|
||||||
|
|
@ -1152,7 +1151,7 @@
|
||||||
// If the files property is not available, the browser does not
|
// If the files property is not available, the browser does not
|
||||||
// support the File API and we add a pseudo File object with
|
// support the File API and we add a pseudo File object with
|
||||||
// the input value as name with path information removed:
|
// the input value as name with path information removed:
|
||||||
files = [{name: value.replace(/^.*\\/, '')}];
|
files = [{ name: value.replace(/^.*\\/, '') }];
|
||||||
} else if (files[0].name === undefined && files[0].fileName) {
|
} else if (files[0].name === undefined && files[0].fileName) {
|
||||||
// File normalization for Safari 4 and Firefox 3:
|
// File normalization for Safari 4 and Firefox 3:
|
||||||
$.each(files, function (index, file) {
|
$.each(files, function (index, file) {
|
||||||
|
|
@ -1191,7 +1190,7 @@
|
||||||
}
|
}
|
||||||
if (that._trigger(
|
if (that._trigger(
|
||||||
'change',
|
'change',
|
||||||
$.Event('change', {delegatedEvent: e}),
|
$.Event('change', { delegatedEvent: e }),
|
||||||
data
|
data
|
||||||
) !== false) {
|
) !== false) {
|
||||||
that._onAdd(e, data);
|
that._onAdd(e, data);
|
||||||
|
|
@ -1202,7 +1201,7 @@
|
||||||
_onPaste: function (e) {
|
_onPaste: function (e) {
|
||||||
var items = e.originalEvent && e.originalEvent.clipboardData &&
|
var items = e.originalEvent && e.originalEvent.clipboardData &&
|
||||||
e.originalEvent.clipboardData.items,
|
e.originalEvent.clipboardData.items,
|
||||||
data = {files: []};
|
data = { files: [] };
|
||||||
if (items && items.length) {
|
if (items && items.length) {
|
||||||
$.each(items, function (index, item) {
|
$.each(items, function (index, item) {
|
||||||
var file = item.getAsFile && item.getAsFile();
|
var file = item.getAsFile && item.getAsFile();
|
||||||
|
|
@ -1212,7 +1211,7 @@
|
||||||
});
|
});
|
||||||
if (this._trigger(
|
if (this._trigger(
|
||||||
'paste',
|
'paste',
|
||||||
$.Event('paste', {delegatedEvent: e}),
|
$.Event('paste', { delegatedEvent: e }),
|
||||||
data
|
data
|
||||||
) !== false) {
|
) !== false) {
|
||||||
this._onAdd(e, data);
|
this._onAdd(e, data);
|
||||||
|
|
@ -1231,7 +1230,7 @@
|
||||||
data.files = files;
|
data.files = files;
|
||||||
if (that._trigger(
|
if (that._trigger(
|
||||||
'drop',
|
'drop',
|
||||||
$.Event('drop', {delegatedEvent: e}),
|
$.Event('drop', { delegatedEvent: e }),
|
||||||
data
|
data
|
||||||
) !== false) {
|
) !== false) {
|
||||||
that._onAdd(e, data);
|
that._onAdd(e, data);
|
||||||
|
|
@ -1246,7 +1245,7 @@
|
||||||
if (dataTransfer && $.inArray('Files', dataTransfer.types) !== -1 &&
|
if (dataTransfer && $.inArray('Files', dataTransfer.types) !== -1 &&
|
||||||
this._trigger(
|
this._trigger(
|
||||||
'dragover',
|
'dragover',
|
||||||
$.Event('dragover', {delegatedEvent: e})
|
$.Event('dragover', { delegatedEvent: e })
|
||||||
) !== false) {
|
) !== false) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
dataTransfer.dropEffect = 'copy';
|
dataTransfer.dropEffect = 'copy';
|
||||||
|
|
@ -1270,7 +1269,7 @@
|
||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
//var othis = this;
|
//var othis = this;
|
||||||
if( $.support.xhrFileUpload ) {
|
if ($.support.xhrFileUpload) {
|
||||||
this._on(this.options.fileInput, {
|
this._on(this.options.fileInput, {
|
||||||
change: this._onChange
|
change: this._onChange
|
||||||
});
|
});
|
||||||
|
|
@ -1279,17 +1278,17 @@
|
||||||
$swf_target.swfupload({
|
$swf_target.swfupload({
|
||||||
//upload_url: "upload.php",
|
//upload_url: "upload.php",
|
||||||
upload_url: this.options.url,
|
upload_url: this.options.url,
|
||||||
file_post_name : "files",
|
file_post_name: "files",
|
||||||
file_size_limit : "10 MB",
|
file_size_limit: "10 MB",
|
||||||
file_upload_limit: 0,
|
file_upload_limit: 0,
|
||||||
file_queue_limit : this.options.limit_filesLength,
|
file_queue_limit: this.options.limit_filesLength,
|
||||||
file_types : "*.jpeg; *.bmp; *.png; *.jpg; *.gif; *.webp",
|
file_types: "*.jpeg; *.bmp; *.png; *.jpg; *.gif; *.webp",
|
||||||
file_types_description : "Image Files (JPG, JPEG, PNG, BMP, GIF, WEBP)",
|
file_types_description: "Image Files (JPG, JPEG, PNG, BMP, GIF, WEBP)",
|
||||||
flash_url : "./swfupload/swfupload.swf",
|
flash_url: "./swfupload/swfupload.swf",
|
||||||
button_placeholder : this.options.fileInput[0],
|
button_placeholder: this.options.fileInput[0],
|
||||||
button_width : "100%",
|
button_width: "100%",
|
||||||
button_height : "100%",
|
button_height: "100%",
|
||||||
button_window_mode : "transparent"
|
button_window_mode: "transparent"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@
|
||||||
completeCallback(
|
completeCallback(
|
||||||
200,
|
200,
|
||||||
'success',
|
'success',
|
||||||
{'iframe': response}
|
{ 'iframe': response }
|
||||||
);
|
);
|
||||||
// Fix for IE endless progress bar activity bug
|
// Fix for IE endless progress bar activity bug
|
||||||
// (happens on form submits to iframe targets):
|
// (happens on form submits to iframe targets):
|
||||||
|
|
|
||||||
|
|
@ -17,61 +17,61 @@
|
||||||
// Browser globals:
|
// Browser globals:
|
||||||
factory(jQuery);
|
factory(jQuery);
|
||||||
}
|
}
|
||||||
}(function( $, undefined ) {
|
}(function ($, undefined) {
|
||||||
|
|
||||||
var uuid = 0,
|
var uuid = 0,
|
||||||
slice = Array.prototype.slice,
|
slice = Array.prototype.slice,
|
||||||
_cleanData = $.cleanData;
|
_cleanData = $.cleanData;
|
||||||
$.cleanData = function( elems ) {
|
$.cleanData = function (elems) {
|
||||||
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
|
for (var i = 0, elem; (elem = elems[i]) != null; i++) {
|
||||||
try {
|
try {
|
||||||
$( elem ).triggerHandler( "remove" );
|
$(elem).triggerHandler("remove");
|
||||||
// http://bugs.jquery.com/ticket/8235
|
// http://bugs.jquery.com/ticket/8235
|
||||||
} catch( e ) {}
|
} catch (e) { }
|
||||||
}
|
}
|
||||||
_cleanData( elems );
|
_cleanData(elems);
|
||||||
};
|
};
|
||||||
|
|
||||||
$.widget = function( name, base, prototype ) {
|
$.widget = function (name, base, prototype) {
|
||||||
var fullName, existingConstructor, constructor, basePrototype,
|
var fullName, existingConstructor, constructor, basePrototype,
|
||||||
// proxiedPrototype allows the provided prototype to remain unmodified
|
// proxiedPrototype allows the provided prototype to remain unmodified
|
||||||
// so that it can be used as a mixin for multiple widgets (#8876)
|
// so that it can be used as a mixin for multiple widgets (#8876)
|
||||||
proxiedPrototype = {},
|
proxiedPrototype = {},
|
||||||
namespace = name.split( "." )[ 0 ];
|
namespace = name.split(".")[0];
|
||||||
|
|
||||||
name = name.split( "." )[ 1 ];
|
name = name.split(".")[1];
|
||||||
fullName = namespace + "-" + name;
|
fullName = namespace + "-" + name;
|
||||||
|
|
||||||
if ( !prototype ) {
|
if (!prototype) {
|
||||||
prototype = base;
|
prototype = base;
|
||||||
base = $.Widget;
|
base = $.Widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
// create selector for plugin
|
// create selector for plugin
|
||||||
$.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
|
$.expr[":"][fullName.toLowerCase()] = function (elem) {
|
||||||
return !!$.data( elem, fullName );
|
return !!$.data(elem, fullName);
|
||||||
};
|
};
|
||||||
|
|
||||||
$[ namespace ] = $[ namespace ] || {};
|
$[namespace] = $[namespace] || {};
|
||||||
existingConstructor = $[ namespace ][ name ];
|
existingConstructor = $[namespace][name];
|
||||||
constructor = $[ namespace ][ name ] = function( options, element ) {
|
constructor = $[namespace][name] = function (options, element) {
|
||||||
// allow instantiation without "new" keyword
|
// allow instantiation without "new" keyword
|
||||||
if ( !this._createWidget ) {
|
if (!this._createWidget) {
|
||||||
return new constructor( options, element );
|
return new constructor(options, element);
|
||||||
}
|
}
|
||||||
|
|
||||||
// allow instantiation without initializing for simple inheritance
|
// allow instantiation without initializing for simple inheritance
|
||||||
// must use "new" keyword (the code above always passes args)
|
// must use "new" keyword (the code above always passes args)
|
||||||
if ( arguments.length ) {
|
if (arguments.length) {
|
||||||
this._createWidget( options, element );
|
this._createWidget(options, element);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// extend with the existing constructor to carry over any static properties
|
// extend with the existing constructor to carry over any static properties
|
||||||
$.extend( constructor, existingConstructor, {
|
$.extend(constructor, existingConstructor, {
|
||||||
version: prototype.version,
|
version: prototype.version,
|
||||||
// copy the object used to create the prototype in case we need to
|
// copy the object used to create the prototype in case we need to
|
||||||
// redefine the widget later
|
// redefine the widget later
|
||||||
_proto: $.extend( {}, prototype ),
|
_proto: $.extend({}, prototype),
|
||||||
// track widgets that inherit from this widget in case this widget is
|
// track widgets that inherit from this widget in case this widget is
|
||||||
// redefined after a widget inherits from it
|
// redefined after a widget inherits from it
|
||||||
_childConstructors: []
|
_childConstructors: []
|
||||||
|
|
@ -81,20 +81,20 @@ $.widget = function( name, base, prototype ) {
|
||||||
// we need to make the options hash a property directly on the new instance
|
// we need to make the options hash a property directly on the new instance
|
||||||
// otherwise we'll modify the options hash on the prototype that we're
|
// otherwise we'll modify the options hash on the prototype that we're
|
||||||
// inheriting from
|
// inheriting from
|
||||||
basePrototype.options = $.widget.extend( {}, basePrototype.options );
|
basePrototype.options = $.widget.extend({}, basePrototype.options);
|
||||||
$.each( prototype, function( prop, value ) {
|
$.each(prototype, function (prop, value) {
|
||||||
if ( !$.isFunction( value ) ) {
|
if (!$.isFunction(value)) {
|
||||||
proxiedPrototype[ prop ] = value;
|
proxiedPrototype[prop] = value;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
proxiedPrototype[ prop ] = (function() {
|
proxiedPrototype[prop] = (function () {
|
||||||
var _super = function() {
|
var _super = function () {
|
||||||
return base.prototype[ prop ].apply( this, arguments );
|
return base.prototype[prop].apply(this, arguments);
|
||||||
},
|
},
|
||||||
_superApply = function( args ) {
|
_superApply = function (args) {
|
||||||
return base.prototype[ prop ].apply( this, args );
|
return base.prototype[prop].apply(this, args);
|
||||||
};
|
};
|
||||||
return function() {
|
return function () {
|
||||||
var __super = this._super,
|
var __super = this._super,
|
||||||
__superApply = this._superApply,
|
__superApply = this._superApply,
|
||||||
returnValue;
|
returnValue;
|
||||||
|
|
@ -102,7 +102,7 @@ $.widget = function( name, base, prototype ) {
|
||||||
this._super = _super;
|
this._super = _super;
|
||||||
this._superApply = _superApply;
|
this._superApply = _superApply;
|
||||||
|
|
||||||
returnValue = value.apply( this, arguments );
|
returnValue = value.apply(this, arguments);
|
||||||
|
|
||||||
this._super = __super;
|
this._super = __super;
|
||||||
this._superApply = __superApply;
|
this._superApply = __superApply;
|
||||||
|
|
@ -111,7 +111,7 @@ $.widget = function( name, base, prototype ) {
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
});
|
});
|
||||||
constructor.prototype = $.widget.extend( basePrototype, {
|
constructor.prototype = $.widget.extend(basePrototype, {
|
||||||
// TODO: remove support for widgetEventPrefix
|
// TODO: remove support for widgetEventPrefix
|
||||||
// always use the name + a colon as the prefix, e.g., draggable:start
|
// always use the name + a colon as the prefix, e.g., draggable:start
|
||||||
// don't prefix for widgets that aren't DOM-based
|
// don't prefix for widgets that aren't DOM-based
|
||||||
|
|
@ -127,100 +127,100 @@ $.widget = function( name, base, prototype ) {
|
||||||
// are inheriting from it and redefine all of them so that they inherit from
|
// are inheriting from it and redefine all of them so that they inherit from
|
||||||
// the new version of this widget. We're essentially trying to replace one
|
// the new version of this widget. We're essentially trying to replace one
|
||||||
// level in the prototype chain.
|
// level in the prototype chain.
|
||||||
if ( existingConstructor ) {
|
if (existingConstructor) {
|
||||||
$.each( existingConstructor._childConstructors, function( i, child ) {
|
$.each(existingConstructor._childConstructors, function (i, child) {
|
||||||
var childPrototype = child.prototype;
|
var childPrototype = child.prototype;
|
||||||
|
|
||||||
// redefine the child widget using the same prototype that was
|
// redefine the child widget using the same prototype that was
|
||||||
// originally used, but inherit from the new version of the base
|
// originally used, but inherit from the new version of the base
|
||||||
$.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto );
|
$.widget(childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto);
|
||||||
});
|
});
|
||||||
// remove the list of existing child constructors from the old constructor
|
// remove the list of existing child constructors from the old constructor
|
||||||
// so the old child constructors can be garbage collected
|
// so the old child constructors can be garbage collected
|
||||||
delete existingConstructor._childConstructors;
|
delete existingConstructor._childConstructors;
|
||||||
} else {
|
} else {
|
||||||
base._childConstructors.push( constructor );
|
base._childConstructors.push(constructor);
|
||||||
}
|
}
|
||||||
|
|
||||||
$.widget.bridge( name, constructor );
|
$.widget.bridge(name, constructor);
|
||||||
};
|
};
|
||||||
|
|
||||||
$.widget.extend = function( target ) {
|
$.widget.extend = function (target) {
|
||||||
var input = slice.call( arguments, 1 ),
|
var input = slice.call(arguments, 1),
|
||||||
inputIndex = 0,
|
inputIndex = 0,
|
||||||
inputLength = input.length,
|
inputLength = input.length,
|
||||||
key,
|
key,
|
||||||
value;
|
value;
|
||||||
for ( ; inputIndex < inputLength; inputIndex++ ) {
|
for (; inputIndex < inputLength; inputIndex++) {
|
||||||
for ( key in input[ inputIndex ] ) {
|
for (key in input[inputIndex]) {
|
||||||
value = input[ inputIndex ][ key ];
|
value = input[inputIndex][key];
|
||||||
if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
|
if (input[inputIndex].hasOwnProperty(key) && value !== undefined) {
|
||||||
// Clone objects
|
// Clone objects
|
||||||
if ( $.isPlainObject( value ) ) {
|
if ($.isPlainObject(value)) {
|
||||||
target[ key ] = $.isPlainObject( target[ key ] ) ?
|
target[key] = $.isPlainObject(target[key]) ?
|
||||||
$.widget.extend( {}, target[ key ], value ) :
|
$.widget.extend({}, target[key], value) :
|
||||||
// Don't extend strings, arrays, etc. with objects
|
// Don't extend strings, arrays, etc. with objects
|
||||||
$.widget.extend( {}, value );
|
$.widget.extend({}, value);
|
||||||
// Copy everything else by reference
|
// Copy everything else by reference
|
||||||
} else {
|
} else {
|
||||||
target[ key ] = value;
|
target[key] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return target;
|
return target;
|
||||||
};
|
};
|
||||||
|
|
||||||
$.widget.bridge = function( name, object ) {
|
$.widget.bridge = function (name, object) {
|
||||||
var fullName = object.prototype.widgetFullName || name;
|
var fullName = object.prototype.widgetFullName || name;
|
||||||
$.fn[ name ] = function( options ) {
|
$.fn[name] = function (options) {
|
||||||
var isMethodCall = typeof options === "string",
|
var isMethodCall = typeof options === "string",
|
||||||
args = slice.call( arguments, 1 ),
|
args = slice.call(arguments, 1),
|
||||||
returnValue = this;
|
returnValue = this;
|
||||||
|
|
||||||
// allow multiple hashes to be passed on init
|
// allow multiple hashes to be passed on init
|
||||||
options = !isMethodCall && args.length ?
|
options = !isMethodCall && args.length ?
|
||||||
$.widget.extend.apply( null, [ options ].concat(args) ) :
|
$.widget.extend.apply(null, [options].concat(args)) :
|
||||||
options;
|
options;
|
||||||
|
|
||||||
if ( isMethodCall ) {
|
if (isMethodCall) {
|
||||||
this.each(function() {
|
this.each(function () {
|
||||||
var methodValue,
|
var methodValue,
|
||||||
instance = $.data( this, fullName );
|
instance = $.data(this, fullName);
|
||||||
if ( !instance ) {
|
if (!instance) {
|
||||||
return $.error( "cannot call methods on " + name + " prior to initialization; " +
|
return $.error("cannot call methods on " + name + " prior to initialization; " +
|
||||||
"attempted to call method '" + options + "'" );
|
"attempted to call method '" + options + "'");
|
||||||
}
|
}
|
||||||
if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
|
if (!$.isFunction(instance[options]) || options.charAt(0) === "_") {
|
||||||
return $.error( "no such method '" + options + "' for " + name + " widget instance" );
|
return $.error("no such method '" + options + "' for " + name + " widget instance");
|
||||||
}
|
}
|
||||||
methodValue = instance[ options ].apply( instance, args );
|
methodValue = instance[options].apply(instance, args);
|
||||||
if ( methodValue !== instance && methodValue !== undefined ) {
|
if (methodValue !== instance && methodValue !== undefined) {
|
||||||
returnValue = methodValue && methodValue.jquery ?
|
returnValue = methodValue && methodValue.jquery ?
|
||||||
returnValue.pushStack( methodValue.get() ) :
|
returnValue.pushStack(methodValue.get()) :
|
||||||
methodValue;
|
methodValue;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.each(function() {
|
this.each(function () {
|
||||||
var instance = $.data( this, fullName );
|
var instance = $.data(this, fullName);
|
||||||
if ( instance ) {
|
if (instance) {
|
||||||
instance.option( options || {} )._init();
|
instance.option(options || {})._init();
|
||||||
} else {
|
} else {
|
||||||
$.data( this, fullName, new object( options, this ) );
|
$.data(this, fullName, new object(options, this));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return returnValue;
|
return returnValue;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
$.Widget = function( /* options, element */ ) {};
|
$.Widget = function ( /* options, element */) { };
|
||||||
$.Widget._childConstructors = [];
|
$.Widget._childConstructors = [];
|
||||||
|
|
||||||
$.Widget.prototype = {
|
$.Widget.prototype = {
|
||||||
widgetName: "widget",
|
widgetName: "widget",
|
||||||
widgetEventPrefix: "",
|
widgetEventPrefix: "",
|
||||||
defaultElement: "<div>",
|
defaultElement: "<div>",
|
||||||
|
|
@ -230,39 +230,39 @@ $.Widget.prototype = {
|
||||||
// callbacks
|
// callbacks
|
||||||
create: null
|
create: null
|
||||||
},
|
},
|
||||||
_createWidget: function( options, element ) {
|
_createWidget: function (options, element) {
|
||||||
element = $( element || this.defaultElement || this )[ 0 ];
|
element = $(element || this.defaultElement || this)[0];
|
||||||
this.element = $( element );
|
this.element = $(element);
|
||||||
this.uuid = uuid++;
|
this.uuid = uuid++;
|
||||||
this.eventNamespace = "." + this.widgetName + this.uuid;
|
this.eventNamespace = "." + this.widgetName + this.uuid;
|
||||||
this.options = $.widget.extend( {},
|
this.options = $.widget.extend({},
|
||||||
this.options,
|
this.options,
|
||||||
this._getCreateOptions(),
|
this._getCreateOptions(),
|
||||||
options );
|
options);
|
||||||
|
|
||||||
this.bindings = $();
|
this.bindings = $();
|
||||||
this.hoverable = $();
|
this.hoverable = $();
|
||||||
this.focusable = $();
|
this.focusable = $();
|
||||||
|
|
||||||
if ( element !== this ) {
|
if (element !== this) {
|
||||||
$.data( element, this.widgetFullName, this );
|
$.data(element, this.widgetFullName, this);
|
||||||
this._on( true, this.element, {
|
this._on(true, this.element, {
|
||||||
remove: function( event ) {
|
remove: function (event) {
|
||||||
if ( event.target === element ) {
|
if (event.target === element) {
|
||||||
this.destroy();
|
this.destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.document = $( element.style ?
|
this.document = $(element.style ?
|
||||||
// element within the document
|
// element within the document
|
||||||
element.ownerDocument :
|
element.ownerDocument :
|
||||||
// element is window or document
|
// element is window or document
|
||||||
element.document || element );
|
element.document || element);
|
||||||
this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
|
this.window = $(this.document[0].defaultView || this.document[0].parentWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
this._create();
|
this._create();
|
||||||
this._trigger( "create", null, this._getCreateEventData() );
|
this._trigger("create", null, this._getCreateEventData());
|
||||||
this._init();
|
this._init();
|
||||||
},
|
},
|
||||||
_getCreateOptions: $.noop,
|
_getCreateOptions: $.noop,
|
||||||
|
|
@ -270,230 +270,230 @@ $.Widget.prototype = {
|
||||||
_create: $.noop,
|
_create: $.noop,
|
||||||
_init: $.noop,
|
_init: $.noop,
|
||||||
|
|
||||||
destroy: function() {
|
destroy: function () {
|
||||||
this._destroy();
|
this._destroy();
|
||||||
// we can probably remove the unbind calls in 2.0
|
// we can probably remove the unbind calls in 2.0
|
||||||
// all event bindings should go through this._on()
|
// all event bindings should go through this._on()
|
||||||
this.element
|
this.element
|
||||||
.unbind( this.eventNamespace )
|
.unbind(this.eventNamespace)
|
||||||
// 1.9 BC for #7810
|
// 1.9 BC for #7810
|
||||||
// TODO remove dual storage
|
// TODO remove dual storage
|
||||||
.removeData( this.widgetName )
|
.removeData(this.widgetName)
|
||||||
.removeData( this.widgetFullName )
|
.removeData(this.widgetFullName)
|
||||||
// support: jquery <1.6.3
|
// support: jquery <1.6.3
|
||||||
// http://bugs.jquery.com/ticket/9413
|
// http://bugs.jquery.com/ticket/9413
|
||||||
.removeData( $.camelCase( this.widgetFullName ) );
|
.removeData($.camelCase(this.widgetFullName));
|
||||||
this.widget()
|
this.widget()
|
||||||
.unbind( this.eventNamespace )
|
.unbind(this.eventNamespace)
|
||||||
.removeAttr( "aria-disabled" )
|
.removeAttr("aria-disabled")
|
||||||
.removeClass(
|
.removeClass(
|
||||||
this.widgetFullName + "-disabled " +
|
this.widgetFullName + "-disabled " +
|
||||||
"ui-state-disabled" );
|
"ui-state-disabled");
|
||||||
|
|
||||||
// clean up events and states
|
// clean up events and states
|
||||||
this.bindings.unbind( this.eventNamespace );
|
this.bindings.unbind(this.eventNamespace);
|
||||||
this.hoverable.removeClass( "ui-state-hover" );
|
this.hoverable.removeClass("ui-state-hover");
|
||||||
this.focusable.removeClass( "ui-state-focus" );
|
this.focusable.removeClass("ui-state-focus");
|
||||||
},
|
},
|
||||||
_destroy: $.noop,
|
_destroy: $.noop,
|
||||||
|
|
||||||
widget: function() {
|
widget: function () {
|
||||||
return this.element;
|
return this.element;
|
||||||
},
|
},
|
||||||
|
|
||||||
option: function( key, value ) {
|
option: function (key, value) {
|
||||||
var options = key,
|
var options = key,
|
||||||
parts,
|
parts,
|
||||||
curOption,
|
curOption,
|
||||||
i;
|
i;
|
||||||
|
|
||||||
if ( arguments.length === 0 ) {
|
if (arguments.length === 0) {
|
||||||
// don't return a reference to the internal hash
|
// don't return a reference to the internal hash
|
||||||
return $.widget.extend( {}, this.options );
|
return $.widget.extend({}, this.options);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( typeof key === "string" ) {
|
if (typeof key === "string") {
|
||||||
// handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
|
// handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
|
||||||
options = {};
|
options = {};
|
||||||
parts = key.split( "." );
|
parts = key.split(".");
|
||||||
key = parts.shift();
|
key = parts.shift();
|
||||||
if ( parts.length ) {
|
if (parts.length) {
|
||||||
curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
|
curOption = options[key] = $.widget.extend({}, this.options[key]);
|
||||||
for ( i = 0; i < parts.length - 1; i++ ) {
|
for (i = 0; i < parts.length - 1; i++) {
|
||||||
curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
|
curOption[parts[i]] = curOption[parts[i]] || {};
|
||||||
curOption = curOption[ parts[ i ] ];
|
curOption = curOption[parts[i]];
|
||||||
}
|
}
|
||||||
key = parts.pop();
|
key = parts.pop();
|
||||||
if ( arguments.length === 1 ) {
|
if (arguments.length === 1) {
|
||||||
return curOption[ key ] === undefined ? null : curOption[ key ];
|
return curOption[key] === undefined ? null : curOption[key];
|
||||||
}
|
}
|
||||||
curOption[ key ] = value;
|
curOption[key] = value;
|
||||||
} else {
|
} else {
|
||||||
if ( arguments.length === 1 ) {
|
if (arguments.length === 1) {
|
||||||
return this.options[ key ] === undefined ? null : this.options[ key ];
|
return this.options[key] === undefined ? null : this.options[key];
|
||||||
}
|
}
|
||||||
options[ key ] = value;
|
options[key] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this._setOptions( options );
|
this._setOptions(options);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
_setOptions: function( options ) {
|
_setOptions: function (options) {
|
||||||
var key;
|
var key;
|
||||||
|
|
||||||
for ( key in options ) {
|
for (key in options) {
|
||||||
this._setOption( key, options[ key ] );
|
this._setOption(key, options[key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
_setOption: function( key, value ) {
|
_setOption: function (key, value) {
|
||||||
this.options[ key ] = value;
|
this.options[key] = value;
|
||||||
|
|
||||||
if ( key === "disabled" ) {
|
if (key === "disabled") {
|
||||||
this.widget()
|
this.widget()
|
||||||
.toggleClass( this.widgetFullName + "-disabled ui-state-disabled", !!value )
|
.toggleClass(this.widgetFullName + "-disabled ui-state-disabled", !!value)
|
||||||
.attr( "aria-disabled", value );
|
.attr("aria-disabled", value);
|
||||||
this.hoverable.removeClass( "ui-state-hover" );
|
this.hoverable.removeClass("ui-state-hover");
|
||||||
this.focusable.removeClass( "ui-state-focus" );
|
this.focusable.removeClass("ui-state-focus");
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
enable: function() {
|
enable: function () {
|
||||||
return this._setOption( "disabled", false );
|
return this._setOption("disabled", false);
|
||||||
},
|
},
|
||||||
disable: function() {
|
disable: function () {
|
||||||
return this._setOption( "disabled", true );
|
return this._setOption("disabled", true);
|
||||||
},
|
},
|
||||||
|
|
||||||
_on: function( suppressDisabledCheck, element, handlers ) {
|
_on: function (suppressDisabledCheck, element, handlers) {
|
||||||
var delegateElement,
|
var delegateElement,
|
||||||
instance = this;
|
instance = this;
|
||||||
|
|
||||||
// no suppressDisabledCheck flag, shuffle arguments
|
// no suppressDisabledCheck flag, shuffle arguments
|
||||||
if ( typeof suppressDisabledCheck !== "boolean" ) {
|
if (typeof suppressDisabledCheck !== "boolean") {
|
||||||
handlers = element;
|
handlers = element;
|
||||||
element = suppressDisabledCheck;
|
element = suppressDisabledCheck;
|
||||||
suppressDisabledCheck = false;
|
suppressDisabledCheck = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// no element argument, shuffle and use this.element
|
// no element argument, shuffle and use this.element
|
||||||
if ( !handlers ) {
|
if (!handlers) {
|
||||||
handlers = element;
|
handlers = element;
|
||||||
element = this.element;
|
element = this.element;
|
||||||
delegateElement = this.widget();
|
delegateElement = this.widget();
|
||||||
} else {
|
} else {
|
||||||
// accept selectors, DOM elements
|
// accept selectors, DOM elements
|
||||||
element = delegateElement = $( element );
|
element = delegateElement = $(element);
|
||||||
this.bindings = this.bindings.add( element );
|
this.bindings = this.bindings.add(element);
|
||||||
}
|
}
|
||||||
|
|
||||||
$.each( handlers, function( event, handler ) {
|
$.each(handlers, function (event, handler) {
|
||||||
function handlerProxy() {
|
function handlerProxy() {
|
||||||
// allow widgets to customize the disabled handling
|
// allow widgets to customize the disabled handling
|
||||||
// - disabled as an array instead of boolean
|
// - disabled as an array instead of boolean
|
||||||
// - disabled class as method for disabling individual parts
|
// - disabled class as method for disabling individual parts
|
||||||
if ( !suppressDisabledCheck &&
|
if (!suppressDisabledCheck &&
|
||||||
( instance.options.disabled === true ||
|
(instance.options.disabled === true ||
|
||||||
$( this ).hasClass( "ui-state-disabled" ) ) ) {
|
$(this).hasClass("ui-state-disabled"))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return ( typeof handler === "string" ? instance[ handler ] : handler )
|
return (typeof handler === "string" ? instance[handler] : handler)
|
||||||
.apply( instance, arguments );
|
.apply(instance, arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy the guid so direct unbinding works
|
// copy the guid so direct unbinding works
|
||||||
if ( typeof handler !== "string" ) {
|
if (typeof handler !== "string") {
|
||||||
handlerProxy.guid = handler.guid =
|
handlerProxy.guid = handler.guid =
|
||||||
handler.guid || handlerProxy.guid || $.guid++;
|
handler.guid || handlerProxy.guid || $.guid++;
|
||||||
}
|
}
|
||||||
|
|
||||||
var match = event.match( /^(\w+)\s*(.*)$/ ),
|
var match = event.match(/^(\w+)\s*(.*)$/),
|
||||||
eventName = match[1] + instance.eventNamespace,
|
eventName = match[1] + instance.eventNamespace,
|
||||||
selector = match[2];
|
selector = match[2];
|
||||||
if ( selector ) {
|
if (selector) {
|
||||||
delegateElement.delegate( selector, eventName, handlerProxy );
|
delegateElement.delegate(selector, eventName, handlerProxy);
|
||||||
} else {
|
} else {
|
||||||
element.bind( eventName, handlerProxy );
|
element.bind(eventName, handlerProxy);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_off: function( element, eventName ) {
|
_off: function (element, eventName) {
|
||||||
eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) + this.eventNamespace;
|
eventName = (eventName || "").split(" ").join(this.eventNamespace + " ") + this.eventNamespace;
|
||||||
element.unbind( eventName ).undelegate( eventName );
|
element.unbind(eventName).undelegate(eventName);
|
||||||
},
|
},
|
||||||
|
|
||||||
_delay: function( handler, delay ) {
|
_delay: function (handler, delay) {
|
||||||
function handlerProxy() {
|
function handlerProxy() {
|
||||||
return ( typeof handler === "string" ? instance[ handler ] : handler )
|
return (typeof handler === "string" ? instance[handler] : handler)
|
||||||
.apply( instance, arguments );
|
.apply(instance, arguments);
|
||||||
}
|
}
|
||||||
var instance = this;
|
var instance = this;
|
||||||
return setTimeout( handlerProxy, delay || 0 );
|
return setTimeout(handlerProxy, delay || 0);
|
||||||
},
|
},
|
||||||
|
|
||||||
_hoverable: function( element ) {
|
_hoverable: function (element) {
|
||||||
this.hoverable = this.hoverable.add( element );
|
this.hoverable = this.hoverable.add(element);
|
||||||
this._on( element, {
|
this._on(element, {
|
||||||
mouseenter: function( event ) {
|
mouseenter: function (event) {
|
||||||
$( event.currentTarget ).addClass( "ui-state-hover" );
|
$(event.currentTarget).addClass("ui-state-hover");
|
||||||
},
|
},
|
||||||
mouseleave: function( event ) {
|
mouseleave: function (event) {
|
||||||
$( event.currentTarget ).removeClass( "ui-state-hover" );
|
$(event.currentTarget).removeClass("ui-state-hover");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_focusable: function( element ) {
|
_focusable: function (element) {
|
||||||
this.focusable = this.focusable.add( element );
|
this.focusable = this.focusable.add(element);
|
||||||
this._on( element, {
|
this._on(element, {
|
||||||
focusin: function( event ) {
|
focusin: function (event) {
|
||||||
$( event.currentTarget ).addClass( "ui-state-focus" );
|
$(event.currentTarget).addClass("ui-state-focus");
|
||||||
},
|
},
|
||||||
focusout: function( event ) {
|
focusout: function (event) {
|
||||||
$( event.currentTarget ).removeClass( "ui-state-focus" );
|
$(event.currentTarget).removeClass("ui-state-focus");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_trigger: function( type, event, data ) {
|
_trigger: function (type, event, data) {
|
||||||
var prop, orig,
|
var prop, orig,
|
||||||
callback = this.options[ type ];
|
callback = this.options[type];
|
||||||
|
|
||||||
data = data || {};
|
data = data || {};
|
||||||
event = $.Event( event );
|
event = $.Event(event);
|
||||||
event.type = ( type === this.widgetEventPrefix ?
|
event.type = (type === this.widgetEventPrefix ?
|
||||||
type :
|
type :
|
||||||
this.widgetEventPrefix + type ).toLowerCase();
|
this.widgetEventPrefix + type).toLowerCase();
|
||||||
// the original event may come from any element
|
// the original event may come from any element
|
||||||
// so we need to reset the target on the new event
|
// so we need to reset the target on the new event
|
||||||
event.target = this.element[ 0 ];
|
event.target = this.element[0];
|
||||||
|
|
||||||
// copy original event properties over to the new event
|
// copy original event properties over to the new event
|
||||||
orig = event.originalEvent;
|
orig = event.originalEvent;
|
||||||
if ( orig ) {
|
if (orig) {
|
||||||
for ( prop in orig ) {
|
for (prop in orig) {
|
||||||
if ( !( prop in event ) ) {
|
if (!(prop in event)) {
|
||||||
event[ prop ] = orig[ prop ];
|
event[prop] = orig[prop];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.element.trigger( event, data );
|
this.element.trigger(event, data);
|
||||||
return !( $.isFunction( callback ) &&
|
return !($.isFunction(callback) &&
|
||||||
callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
|
callback.apply(this.element[0], [event].concat(data)) === false ||
|
||||||
event.isDefaultPrevented() );
|
event.isDefaultPrevented());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
|
$.each({ show: "fadeIn", hide: "fadeOut" }, function (method, defaultEffect) {
|
||||||
$.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
|
$.Widget.prototype["_" + method] = function (element, options, callback) {
|
||||||
if ( typeof options === "string" ) {
|
if (typeof options === "string") {
|
||||||
options = { effect: options };
|
options = { effect: options };
|
||||||
}
|
}
|
||||||
var hasOptions,
|
var hasOptions,
|
||||||
|
|
@ -503,28 +503,28 @@ $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
|
||||||
defaultEffect :
|
defaultEffect :
|
||||||
options.effect || defaultEffect;
|
options.effect || defaultEffect;
|
||||||
options = options || {};
|
options = options || {};
|
||||||
if ( typeof options === "number" ) {
|
if (typeof options === "number") {
|
||||||
options = { duration: options };
|
options = { duration: options };
|
||||||
}
|
}
|
||||||
hasOptions = !$.isEmptyObject( options );
|
hasOptions = !$.isEmptyObject(options);
|
||||||
options.complete = callback;
|
options.complete = callback;
|
||||||
if ( options.delay ) {
|
if (options.delay) {
|
||||||
element.delay( options.delay );
|
element.delay(options.delay);
|
||||||
}
|
}
|
||||||
if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
|
if (hasOptions && $.effects && $.effects.effect[effectName]) {
|
||||||
element[ method ]( options );
|
element[method](options);
|
||||||
} else if ( effectName !== method && element[ effectName ] ) {
|
} else if (effectName !== method && element[effectName]) {
|
||||||
element[ effectName ]( options.duration, options.easing, callback );
|
element[effectName](options.duration, options.easing, callback);
|
||||||
} else {
|
} else {
|
||||||
element.queue(function( next ) {
|
element.queue(function (next) {
|
||||||
$( this )[ method ]();
|
$(this)[method]();
|
||||||
if ( callback ) {
|
if (callback) {
|
||||||
callback.call( element[ 0 ] );
|
callback.call(element[0]);
|
||||||
}
|
}
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
}));
|
}));
|
||||||
|
|
|
||||||
|
|
@ -165,13 +165,13 @@ class Services_JSON
|
||||||
function utf162utf8($utf16)
|
function utf162utf8($utf16)
|
||||||
{
|
{
|
||||||
// oh please oh please oh please oh please oh please
|
// oh please oh please oh please oh please oh please
|
||||||
if($this->_mb_convert_encoding) {
|
if ($this->_mb_convert_encoding) {
|
||||||
return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
|
return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
|
||||||
}
|
}
|
||||||
|
|
||||||
$bytes = (ord($utf16[0]) << 8) | ord($utf16[1]);
|
$bytes = (ord($utf16[0]) << 8) | ord($utf16[1]);
|
||||||
|
|
||||||
switch(true) {
|
switch (true) {
|
||||||
case ((0x7F & $bytes) == $bytes):
|
case ((0x7F & $bytes) == $bytes):
|
||||||
// this case should never be reached, because we are in ASCII range
|
// this case should never be reached, because we are in ASCII range
|
||||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||||
|
|
@ -209,11 +209,11 @@ class Services_JSON
|
||||||
function utf82utf16($utf8)
|
function utf82utf16($utf8)
|
||||||
{
|
{
|
||||||
// oh please oh please oh please oh please oh please
|
// oh please oh please oh please oh please oh please
|
||||||
if($this->_mb_convert_encoding) {
|
if ($this->_mb_convert_encoding) {
|
||||||
return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
|
return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
|
||||||
}
|
}
|
||||||
|
|
||||||
switch($this->strlen8($utf8)) {
|
switch ($this->strlen8($utf8)) {
|
||||||
case 1:
|
case 1:
|
||||||
// this case should never be reached, because we are in ASCII range
|
// this case should never be reached, because we are in ASCII range
|
||||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||||
|
|
@ -338,7 +338,7 @@ class Services_JSON
|
||||||
case $ord_var_c == 0x2F:
|
case $ord_var_c == 0x2F:
|
||||||
case $ord_var_c == 0x5C:
|
case $ord_var_c == 0x5C:
|
||||||
// double quote, slash, slosh
|
// double quote, slash, slosh
|
||||||
$ascii .= '\\'.$var[$c];
|
$ascii .= '\\' . $var[$c];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
|
case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
|
||||||
|
|
@ -349,7 +349,7 @@ class Services_JSON
|
||||||
case (($ord_var_c & 0xE0) == 0xC0):
|
case (($ord_var_c & 0xE0) == 0xC0):
|
||||||
// characters U-00000080 - U-000007FF, mask 110XXXXX
|
// characters U-00000080 - U-000007FF, mask 110XXXXX
|
||||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||||
if ($c+1 >= $strlen_var) {
|
if ($c + 1 >= $strlen_var) {
|
||||||
$c += 1;
|
$c += 1;
|
||||||
$ascii .= '?';
|
$ascii .= '?';
|
||||||
break;
|
break;
|
||||||
|
|
@ -362,33 +362,39 @@ class Services_JSON
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (($ord_var_c & 0xF0) == 0xE0):
|
case (($ord_var_c & 0xF0) == 0xE0):
|
||||||
if ($c+2 >= $strlen_var) {
|
if ($c + 2 >= $strlen_var) {
|
||||||
$c += 2;
|
$c += 2;
|
||||||
$ascii .= '?';
|
$ascii .= '?';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// characters U-00000800 - U-0000FFFF, mask 1110XXXX
|
// characters U-00000800 - U-0000FFFF, mask 1110XXXX
|
||||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||||
$char = pack('C*', $ord_var_c,
|
$char = pack(
|
||||||
|
'C*',
|
||||||
|
$ord_var_c,
|
||||||
@ord($var[$c + 1]),
|
@ord($var[$c + 1]),
|
||||||
@ord($var[$c + 2]));
|
@ord($var[$c + 2])
|
||||||
|
);
|
||||||
$c += 2;
|
$c += 2;
|
||||||
$utf16 = $this->utf82utf16($char);
|
$utf16 = $this->utf82utf16($char);
|
||||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (($ord_var_c & 0xF8) == 0xF0):
|
case (($ord_var_c & 0xF8) == 0xF0):
|
||||||
if ($c+3 >= $strlen_var) {
|
if ($c + 3 >= $strlen_var) {
|
||||||
$c += 3;
|
$c += 3;
|
||||||
$ascii .= '?';
|
$ascii .= '?';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// characters U-00010000 - U-001FFFFF, mask 11110XXX
|
// characters U-00010000 - U-001FFFFF, mask 11110XXX
|
||||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||||
$char = pack('C*', $ord_var_c,
|
$char = pack(
|
||||||
|
'C*',
|
||||||
|
$ord_var_c,
|
||||||
ord($var[$c + 1]),
|
ord($var[$c + 1]),
|
||||||
ord($var[$c + 2]),
|
ord($var[$c + 2]),
|
||||||
ord($var[$c + 3]));
|
ord($var[$c + 3])
|
||||||
|
);
|
||||||
$c += 3;
|
$c += 3;
|
||||||
$utf16 = $this->utf82utf16($char);
|
$utf16 = $this->utf82utf16($char);
|
||||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||||
|
|
@ -397,42 +403,48 @@ class Services_JSON
|
||||||
case (($ord_var_c & 0xFC) == 0xF8):
|
case (($ord_var_c & 0xFC) == 0xF8):
|
||||||
// characters U-00200000 - U-03FFFFFF, mask 111110XX
|
// characters U-00200000 - U-03FFFFFF, mask 111110XX
|
||||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||||
if ($c+4 >= $strlen_var) {
|
if ($c + 4 >= $strlen_var) {
|
||||||
$c += 4;
|
$c += 4;
|
||||||
$ascii .= '?';
|
$ascii .= '?';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$char = pack('C*', $ord_var_c,
|
$char = pack(
|
||||||
|
'C*',
|
||||||
|
$ord_var_c,
|
||||||
ord($var[$c + 1]),
|
ord($var[$c + 1]),
|
||||||
ord($var[$c + 2]),
|
ord($var[$c + 2]),
|
||||||
ord($var[$c + 3]),
|
ord($var[$c + 3]),
|
||||||
ord($var[$c + 4]));
|
ord($var[$c + 4])
|
||||||
|
);
|
||||||
$c += 4;
|
$c += 4;
|
||||||
$utf16 = $this->utf82utf16($char);
|
$utf16 = $this->utf82utf16($char);
|
||||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (($ord_var_c & 0xFE) == 0xFC):
|
case (($ord_var_c & 0xFE) == 0xFC):
|
||||||
if ($c+5 >= $strlen_var) {
|
if ($c + 5 >= $strlen_var) {
|
||||||
$c += 5;
|
$c += 5;
|
||||||
$ascii .= '?';
|
$ascii .= '?';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// characters U-04000000 - U-7FFFFFFF, mask 1111110X
|
// characters U-04000000 - U-7FFFFFFF, mask 1111110X
|
||||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||||
$char = pack('C*', $ord_var_c,
|
$char = pack(
|
||||||
|
'C*',
|
||||||
|
$ord_var_c,
|
||||||
ord($var[$c + 1]),
|
ord($var[$c + 1]),
|
||||||
ord($var[$c + 2]),
|
ord($var[$c + 2]),
|
||||||
ord($var[$c + 3]),
|
ord($var[$c + 3]),
|
||||||
ord($var[$c + 4]),
|
ord($var[$c + 4]),
|
||||||
ord($var[$c + 5]));
|
ord($var[$c + 5])
|
||||||
|
);
|
||||||
$c += 5;
|
$c += 5;
|
||||||
$utf16 = $this->utf82utf16($char);
|
$utf16 = $this->utf82utf16($char);
|
||||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return '"'.$ascii.'"';
|
return '"' . $ascii . '"';
|
||||||
|
|
||||||
case 'array':
|
case 'array':
|
||||||
/*
|
/*
|
||||||
|
|
@ -455,12 +467,14 @@ class Services_JSON
|
||||||
|
|
||||||
// treat as a JSON object
|
// treat as a JSON object
|
||||||
if (is_array($var) && count($var) && (array_keys($var) !== range(0, count($var) - 1))) {
|
if (is_array($var) && count($var) && (array_keys($var) !== range(0, count($var) - 1))) {
|
||||||
$properties = array_map(array($this, 'name_value'),
|
$properties = array_map(
|
||||||
|
array($this, 'name_value'),
|
||||||
array_keys($var),
|
array_keys($var),
|
||||||
array_values($var));
|
array_values($var)
|
||||||
|
);
|
||||||
|
|
||||||
foreach($properties as $property) {
|
foreach ($properties as $property) {
|
||||||
if(Services_JSON::isError($property)) {
|
if (Services_JSON::isError($property)) {
|
||||||
return $property;
|
return $property;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -471,8 +485,8 @@ class Services_JSON
|
||||||
// treat it like a regular array
|
// treat it like a regular array
|
||||||
$elements = array_map(array($this, '_encode'), $var);
|
$elements = array_map(array($this, '_encode'), $var);
|
||||||
|
|
||||||
foreach($elements as $element) {
|
foreach ($elements as $element) {
|
||||||
if(Services_JSON::isError($element)) {
|
if (Services_JSON::isError($element)) {
|
||||||
return $element;
|
return $element;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -491,22 +505,24 @@ class Services_JSON
|
||||||
|
|
||||||
return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS)
|
return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS)
|
||||||
? 'null'
|
? 'null'
|
||||||
: new Services_JSON_Error(class_name($var).
|
: new Services_JSON_Error(class_name($var) .
|
||||||
" toJSON returned an object with a toJSON method.");
|
" toJSON returned an object with a toJSON method.");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->_encode( $recode );
|
return $this->_encode($recode);
|
||||||
}
|
}
|
||||||
|
|
||||||
$vars = get_object_vars($var);
|
$vars = get_object_vars($var);
|
||||||
|
|
||||||
$properties = array_map(array($this, 'name_value'),
|
$properties = array_map(
|
||||||
|
array($this, 'name_value'),
|
||||||
array_keys($vars),
|
array_keys($vars),
|
||||||
array_values($vars));
|
array_values($vars)
|
||||||
|
);
|
||||||
|
|
||||||
foreach($properties as $property) {
|
foreach ($properties as $property) {
|
||||||
if(Services_JSON::isError($property)) {
|
if (Services_JSON::isError($property)) {
|
||||||
return $property;
|
return $property;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -516,7 +532,7 @@ class Services_JSON
|
||||||
default:
|
default:
|
||||||
return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS)
|
return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS)
|
||||||
? 'null'
|
? 'null'
|
||||||
: new Services_JSON_Error(gettype($var)." can not be encoded as JSON string");
|
: new Services_JSON_Error(gettype($var) . " can not be encoded as JSON string");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -533,7 +549,7 @@ class Services_JSON
|
||||||
{
|
{
|
||||||
$encoded_value = $this->_encode($value);
|
$encoded_value = $this->_encode($value);
|
||||||
|
|
||||||
if(Services_JSON::isError($encoded_value)) {
|
if (Services_JSON::isError($encoded_value)) {
|
||||||
return $encoded_value;
|
return $encoded_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -604,9 +620,9 @@ class Services_JSON
|
||||||
// return (float)$str;
|
// return (float)$str;
|
||||||
|
|
||||||
// Return float or int, as appropriate
|
// Return float or int, as appropriate
|
||||||
return ((float)$str == (integer)$str)
|
return ((float) $str == (integer) $str)
|
||||||
? (integer)$str
|
? (integer) $str
|
||||||
: (float)$str;
|
: (float) $str;
|
||||||
|
|
||||||
} elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) {
|
} elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) {
|
||||||
// STRINGS RETURNED IN UTF-8 FORMAT
|
// STRINGS RETURNED IN UTF-8 FORMAT
|
||||||
|
|
@ -646,8 +662,10 @@ class Services_JSON
|
||||||
case $substr_chrs_c_2 == '\\\'':
|
case $substr_chrs_c_2 == '\\\'':
|
||||||
case $substr_chrs_c_2 == '\\\\':
|
case $substr_chrs_c_2 == '\\\\':
|
||||||
case $substr_chrs_c_2 == '\\/':
|
case $substr_chrs_c_2 == '\\/':
|
||||||
if (($delim == '"' && $substr_chrs_c_2 != '\\\'') ||
|
if (
|
||||||
($delim == "'" && $substr_chrs_c_2 != '\\"')) {
|
($delim == '"' && $substr_chrs_c_2 != '\\\'') ||
|
||||||
|
($delim == "'" && $substr_chrs_c_2 != '\\"')
|
||||||
|
) {
|
||||||
$utf8 .= $chrs[++$c];
|
$utf8 .= $chrs[++$c];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -721,9 +739,11 @@ class Services_JSON
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
array_push($stk, array('what' => SERVICES_JSON_SLICE,
|
array_push($stk, array(
|
||||||
|
'what' => SERVICES_JSON_SLICE,
|
||||||
'where' => 0,
|
'where' => 0,
|
||||||
'delim' => false));
|
'delim' => false
|
||||||
|
));
|
||||||
|
|
||||||
$chrs = $this->substr8($str, 1, -1);
|
$chrs = $this->substr8($str, 1, -1);
|
||||||
$chrs = $this->reduce_string($chrs);
|
$chrs = $this->reduce_string($chrs);
|
||||||
|
|
@ -793,17 +813,21 @@ class Services_JSON
|
||||||
array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs[$c]));
|
array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs[$c]));
|
||||||
//print("Found start of string at {$c}\n");
|
//print("Found start of string at {$c}\n");
|
||||||
|
|
||||||
} elseif (($chrs[$c] == $top['delim']) &&
|
} elseif (
|
||||||
|
($chrs[$c] == $top['delim']) &&
|
||||||
($top['what'] == SERVICES_JSON_IN_STR) &&
|
($top['what'] == SERVICES_JSON_IN_STR) &&
|
||||||
(($this->strlen8($this->substr8($chrs, 0, $c)) - $this->strlen8(rtrim($this->substr8($chrs, 0, $c), '\\'))) % 2 != 1)) {
|
(($this->strlen8($this->substr8($chrs, 0, $c)) - $this->strlen8(rtrim($this->substr8($chrs, 0, $c), '\\'))) % 2 != 1)
|
||||||
|
) {
|
||||||
// found a quote, we're in a string, and it's not escaped
|
// found a quote, we're in a string, and it's not escaped
|
||||||
// we know that it's not escaped becase there is _not_ an
|
// we know that it's not escaped becase there is _not_ an
|
||||||
// odd number of backslashes at the end of the string so far
|
// odd number of backslashes at the end of the string so far
|
||||||
array_pop($stk);
|
array_pop($stk);
|
||||||
//print("Found end of string at {$c}: ".$this->substr8($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n");
|
//print("Found end of string at {$c}: ".$this->substr8($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n");
|
||||||
|
|
||||||
} elseif (($chrs[$c] == '[') &&
|
} elseif (
|
||||||
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
|
($chrs[$c] == '[') &&
|
||||||
|
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))
|
||||||
|
) {
|
||||||
// found a left-bracket, and we are in an array, object, or slice
|
// found a left-bracket, and we are in an array, object, or slice
|
||||||
array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false));
|
array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false));
|
||||||
//print("Found start of array at {$c}\n");
|
//print("Found start of array at {$c}\n");
|
||||||
|
|
@ -813,8 +837,10 @@ class Services_JSON
|
||||||
array_pop($stk);
|
array_pop($stk);
|
||||||
//print("Found end of array at {$c}: ".$this->substr8($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
//print("Found end of array at {$c}: ".$this->substr8($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
||||||
|
|
||||||
} elseif (($chrs[$c] == '{') &&
|
} elseif (
|
||||||
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
|
($chrs[$c] == '{') &&
|
||||||
|
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))
|
||||||
|
) {
|
||||||
// found a left-brace, and we are in an array, object, or slice
|
// found a left-brace, and we are in an array, object, or slice
|
||||||
array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false));
|
array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false));
|
||||||
//print("Found start of object at {$c}\n");
|
//print("Found start of object at {$c}\n");
|
||||||
|
|
@ -824,8 +850,10 @@ class Services_JSON
|
||||||
array_pop($stk);
|
array_pop($stk);
|
||||||
//print("Found end of object at {$c}: ".$this->substr8($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
//print("Found end of object at {$c}: ".$this->substr8($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
||||||
|
|
||||||
} elseif (($substr_chrs_c_2 == '/*') &&
|
} elseif (
|
||||||
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
|
($substr_chrs_c_2 == '/*') &&
|
||||||
|
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))
|
||||||
|
) {
|
||||||
// found a comment start, and we are in an array, object, or slice
|
// found a comment start, and we are in an array, object, or slice
|
||||||
array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false));
|
array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false));
|
||||||
$c++;
|
$c++;
|
||||||
|
|
@ -864,8 +892,10 @@ class Services_JSON
|
||||||
{
|
{
|
||||||
if (class_exists('pear')) {
|
if (class_exists('pear')) {
|
||||||
return PEAR::isError($data, $code);
|
return PEAR::isError($data, $code);
|
||||||
} elseif (is_object($data) && (get_class($data) == 'services_json_error' ||
|
} elseif (
|
||||||
is_subclass_of($data, 'services_json_error'))) {
|
is_object($data) && (get_class($data) == 'services_json_error' ||
|
||||||
|
is_subclass_of($data, 'services_json_error'))
|
||||||
|
) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -877,12 +907,12 @@ class Services_JSON
|
||||||
* @param string
|
* @param string
|
||||||
* @return integer length
|
* @return integer length
|
||||||
*/
|
*/
|
||||||
function strlen8( $str )
|
function strlen8($str)
|
||||||
{
|
{
|
||||||
if ( $this->_mb_strlen ) {
|
if ($this->_mb_strlen) {
|
||||||
return mb_strlen( $str, "8bit" );
|
return mb_strlen($str, "8bit");
|
||||||
}
|
}
|
||||||
return strlen( $str );
|
return strlen($str);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -892,15 +922,15 @@ class Services_JSON
|
||||||
* @param integer length
|
* @param integer length
|
||||||
* @return integer length
|
* @return integer length
|
||||||
*/
|
*/
|
||||||
function substr8( $string, $start, $length=false )
|
function substr8($string, $start, $length = false)
|
||||||
{
|
{
|
||||||
if ( $length === false ) {
|
if ($length === false) {
|
||||||
$length = $this->strlen8( $string ) - $start;
|
$length = $this->strlen8($string) - $start;
|
||||||
}
|
}
|
||||||
if ( $this->_mb_substr ) {
|
if ($this->_mb_substr) {
|
||||||
return mb_substr( $string, $start, $length, "8bit" );
|
return mb_substr($string, $start, $length, "8bit");
|
||||||
}
|
}
|
||||||
return substr( $string, $start, $length );
|
return substr($string, $start, $length);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -909,9 +939,13 @@ if (class_exists('PEAR_Error')) {
|
||||||
|
|
||||||
class Services_JSON_Error extends PEAR_Error
|
class Services_JSON_Error extends PEAR_Error
|
||||||
{
|
{
|
||||||
function Services_JSON_Error($message = 'unknown error', $code = null,
|
function Services_JSON_Error(
|
||||||
$mode = null, $options = null, $userinfo = null)
|
$message = 'unknown error',
|
||||||
{
|
$code = null,
|
||||||
|
$mode = null,
|
||||||
|
$options = null,
|
||||||
|
$userinfo = null
|
||||||
|
) {
|
||||||
parent::PEAR_Error($message, $code, $mode, $options, $userinfo);
|
parent::PEAR_Error($message, $code, $mode, $options, $userinfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -923,9 +957,13 @@ if (class_exists('PEAR_Error')) {
|
||||||
*/
|
*/
|
||||||
class Services_JSON_Error
|
class Services_JSON_Error
|
||||||
{
|
{
|
||||||
function Services_JSON_Error($message = 'unknown error', $code = null,
|
function Services_JSON_Error(
|
||||||
$mode = null, $options = null, $userinfo = null)
|
$message = 'unknown error',
|
||||||
{
|
$code = null,
|
||||||
|
$mode = null,
|
||||||
|
$options = null,
|
||||||
|
$userinfo = null
|
||||||
|
) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,9 +30,10 @@ class UploadHandler
|
||||||
"image/bmp" => array("imagecreatefromwbmp", "imagewbmp")
|
"image/bmp" => array("imagecreatefromwbmp", "imagewbmp")
|
||||||
);
|
);
|
||||||
|
|
||||||
public function __construct($options = null, $initialize = true, $error_messages = null) {
|
public function __construct($options = null, $initialize = true, $error_messages = null)
|
||||||
|
{
|
||||||
|
|
||||||
$this->post_max_size = (defined('SMARTEDITOR_UPLOAD_SIZE_LIMIT') && SMARTEDITOR_UPLOAD_SIZE_LIMIT) ? SMARTEDITOR_UPLOAD_SIZE_LIMIT.'M' : ini_get('post_max_size');
|
$this->post_max_size = (defined('SMARTEDITOR_UPLOAD_SIZE_LIMIT') && SMARTEDITOR_UPLOAD_SIZE_LIMIT) ? SMARTEDITOR_UPLOAD_SIZE_LIMIT . 'M' : ini_get('post_max_size');
|
||||||
|
|
||||||
// PHP File Upload error message codes:
|
// PHP File Upload error message codes:
|
||||||
// http://php.net/manual/en/features.file-upload.errors.php
|
// http://php.net/manual/en/features.file-upload.errors.php
|
||||||
|
|
@ -58,9 +59,9 @@ class UploadHandler
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->options = array(
|
$this->options = array(
|
||||||
'script_url' => $this->get_full_url().'/',
|
'script_url' => $this->get_full_url() . '/',
|
||||||
'upload_dir' => dirname($this->get_server_var('SCRIPT_FILENAME')).'/files/',
|
'upload_dir' => dirname($this->get_server_var('SCRIPT_FILENAME')) . '/files/',
|
||||||
'upload_url' => $this->get_full_url().'/files/',
|
'upload_url' => $this->get_full_url() . '/files/',
|
||||||
'user_dirs' => false,
|
'user_dirs' => false,
|
||||||
'mkdir_mode' => 0755,
|
'mkdir_mode' => 0755,
|
||||||
'param_name' => 'files',
|
'param_name' => 'files',
|
||||||
|
|
@ -179,14 +180,15 @@ class UploadHandler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function initialize() {
|
protected function initialize()
|
||||||
|
{
|
||||||
switch ($this->get_server_var('REQUEST_METHOD')) {
|
switch ($this->get_server_var('REQUEST_METHOD')) {
|
||||||
case 'OPTIONS':
|
case 'OPTIONS':
|
||||||
case 'HEAD':
|
case 'HEAD':
|
||||||
$this->head();
|
$this->head();
|
||||||
break;
|
break;
|
||||||
case 'GET':
|
case 'GET':
|
||||||
if( isset($_GET['del']) && $_GET['del'] ){
|
if (isset($_GET['del']) && $_GET['del']) {
|
||||||
$this->delete();
|
$this->delete();
|
||||||
} else {
|
} else {
|
||||||
$this->get();
|
$this->get();
|
||||||
|
|
@ -205,83 +207,90 @@ class UploadHandler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function get_full_url() {
|
protected function get_full_url()
|
||||||
|
{
|
||||||
$https = !empty($_SERVER['HTTPS']) && strcasecmp($_SERVER['HTTPS'], 'on') === 0;
|
$https = !empty($_SERVER['HTTPS']) && strcasecmp($_SERVER['HTTPS'], 'on') === 0;
|
||||||
return
|
return
|
||||||
($https ? 'https://' : 'http://').
|
($https ? 'https://' : 'http://') .
|
||||||
(!empty($_SERVER['REMOTE_USER']) ? $_SERVER['REMOTE_USER'].'@' : '').
|
(!empty($_SERVER['REMOTE_USER']) ? $_SERVER['REMOTE_USER'] . '@' : '') .
|
||||||
(isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ($_SERVER['SERVER_NAME'].
|
(isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ($_SERVER['SERVER_NAME'] .
|
||||||
($https && $_SERVER['SERVER_PORT'] === 443 ||
|
($https && $_SERVER['SERVER_PORT'] === 443 ||
|
||||||
$_SERVER['SERVER_PORT'] === 80 ? '' : ':'.$_SERVER['SERVER_PORT']))).
|
$_SERVER['SERVER_PORT'] === 80 ? '' : ':' . $_SERVER['SERVER_PORT']))) .
|
||||||
substr($_SERVER['SCRIPT_NAME'],0, strrpos($_SERVER['SCRIPT_NAME'], '/'));
|
substr($_SERVER['SCRIPT_NAME'], 0, strrpos($_SERVER['SCRIPT_NAME'], '/'));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function get_user_id($is_add=true) {
|
protected function get_user_id($is_add = true)
|
||||||
|
{
|
||||||
global $member;
|
global $member;
|
||||||
|
|
||||||
if(session_id() == '') {
|
if (session_id() == '') {
|
||||||
@session_start();
|
@session_start();
|
||||||
}
|
}
|
||||||
|
|
||||||
$add_str = ($is_add && isset($member['mb_id']) && $member['mb_id']) ? $member['mb_id'] : '';
|
$add_str = ($is_add && isset($member['mb_id']) && $member['mb_id']) ? $member['mb_id'] : '';
|
||||||
return session_id().$add_str;
|
return session_id() . $add_str;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function get_user_path() {
|
protected function get_user_path()
|
||||||
|
{
|
||||||
if ($this->options['user_dirs']) {
|
if ($this->options['user_dirs']) {
|
||||||
return $this->get_user_id(false).'/';
|
return $this->get_user_id(false) . '/';
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function get_upload_path($file_name = null, $version = null) {
|
protected function get_upload_path($file_name = null, $version = null)
|
||||||
|
{
|
||||||
$file_name = $file_name ? $file_name : '';
|
$file_name = $file_name ? $file_name : '';
|
||||||
if (empty($version)) {
|
if (empty($version)) {
|
||||||
$version_path = '';
|
$version_path = '';
|
||||||
} else {
|
} else {
|
||||||
$version_dir = @$this->options['image_versions'][$version]['upload_dir'];
|
$version_dir = @$this->options['image_versions'][$version]['upload_dir'];
|
||||||
if ($version_dir) {
|
if ($version_dir) {
|
||||||
return $version_dir.$this->get_user_path().$file_name;
|
return $version_dir . $this->get_user_path() . $file_name;
|
||||||
}
|
}
|
||||||
$version_path = $version.'/';
|
$version_path = $version . '/';
|
||||||
}
|
}
|
||||||
return $this->options['upload_dir'].$this->get_user_path()
|
return $this->options['upload_dir'] . $this->get_user_path()
|
||||||
.$version_path.$file_name;
|
. $version_path . $file_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function get_query_separator($url) {
|
protected function get_query_separator($url)
|
||||||
|
{
|
||||||
return strpos($url, '?') === false ? '?' : '&';
|
return strpos($url, '?') === false ? '?' : '&';
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function get_download_url($file_name, $version = null, $direct = false) {
|
protected function get_download_url($file_name, $version = null, $direct = false)
|
||||||
|
{
|
||||||
if (!$direct && $this->options['download_via_php']) {
|
if (!$direct && $this->options['download_via_php']) {
|
||||||
$url = $this->options['script_url']
|
$url = $this->options['script_url']
|
||||||
.$this->get_query_separator($this->options['script_url'])
|
. $this->get_query_separator($this->options['script_url'])
|
||||||
.$this->get_singular_param_name()
|
. $this->get_singular_param_name()
|
||||||
.'='.rawurlencode($file_name);
|
. '=' . rawurlencode($file_name);
|
||||||
if ($version) {
|
if ($version) {
|
||||||
$url .= '&version='.rawurlencode($version);
|
$url .= '&version=' . rawurlencode($version);
|
||||||
}
|
}
|
||||||
return $url.'&download=1';
|
return $url . '&download=1';
|
||||||
}
|
}
|
||||||
if (empty($version)) {
|
if (empty($version)) {
|
||||||
$version_path = '';
|
$version_path = '';
|
||||||
} else {
|
} else {
|
||||||
$version_url = @$this->options['image_versions'][$version]['upload_url'];
|
$version_url = @$this->options['image_versions'][$version]['upload_url'];
|
||||||
if ($version_url) {
|
if ($version_url) {
|
||||||
return $version_url.$this->get_user_path().rawurlencode($file_name);
|
return $version_url . $this->get_user_path() . rawurlencode($file_name);
|
||||||
}
|
}
|
||||||
$version_path = rawurlencode($version).'/';
|
$version_path = rawurlencode($version) . '/';
|
||||||
}
|
}
|
||||||
return $this->options['upload_url'].$this->get_user_path()
|
return $this->options['upload_url'] . $this->get_user_path()
|
||||||
.$version_path.rawurlencode($file_name);
|
. $version_path . rawurlencode($file_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function set_additional_file_properties($file) {
|
protected function set_additional_file_properties($file)
|
||||||
|
{
|
||||||
$file->deleteUrl = $this->options['script_url']
|
$file->deleteUrl = $this->options['script_url']
|
||||||
.$this->get_query_separator($this->options['script_url'])
|
. $this->get_query_separator($this->options['script_url'])
|
||||||
.$this->get_singular_param_name()
|
. $this->get_singular_param_name()
|
||||||
.'='.rawurlencode($file->name);
|
. '=' . rawurlencode($file->name);
|
||||||
$file->deleteType = $this->options['delete_type'];
|
$file->deleteType = $this->options['delete_type'];
|
||||||
if ($file->deleteType !== 'DELETE') {
|
if ($file->deleteType !== 'DELETE') {
|
||||||
$file->deleteUrl .= '&_method=DELETE';
|
$file->deleteUrl .= '&_method=DELETE';
|
||||||
|
|
@ -293,14 +302,16 @@ class UploadHandler
|
||||||
|
|
||||||
// Fix for overflowing signed 32 bit integers,
|
// Fix for overflowing signed 32 bit integers,
|
||||||
// works for sizes up to 2^32-1 bytes (4 GiB - 1):
|
// works for sizes up to 2^32-1 bytes (4 GiB - 1):
|
||||||
protected function fix_integer_overflow($size) {
|
protected function fix_integer_overflow($size)
|
||||||
|
{
|
||||||
if ($size < 0) {
|
if ($size < 0) {
|
||||||
$size += 2.0 * (PHP_INT_MAX + 1);
|
$size += 2.0 * (PHP_INT_MAX + 1);
|
||||||
}
|
}
|
||||||
return $size;
|
return $size;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function get_file_size($file_path, $clear_stat_cache = false) {
|
protected function get_file_size($file_path, $clear_stat_cache = false)
|
||||||
|
{
|
||||||
if ($clear_stat_cache) {
|
if ($clear_stat_cache) {
|
||||||
if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
|
if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
|
||||||
clearstatcache(true, $file_path);
|
clearstatcache(true, $file_path);
|
||||||
|
|
@ -311,7 +322,8 @@ class UploadHandler
|
||||||
return $this->fix_integer_overflow(filesize($file_path));
|
return $this->fix_integer_overflow(filesize($file_path));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function is_valid_file_object($file_name) {
|
protected function is_valid_file_object($file_name)
|
||||||
|
{
|
||||||
$file_path = $this->get_upload_path($file_name);
|
$file_path = $this->get_upload_path($file_name);
|
||||||
if (is_file($file_path) && $file_name[0] !== '.') {
|
if (is_file($file_path) && $file_name[0] !== '.') {
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -319,7 +331,8 @@ class UploadHandler
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function get_file_object($file_name) {
|
protected function get_file_object($file_name)
|
||||||
|
{
|
||||||
if ($this->is_valid_file_object($file_name)) {
|
if ($this->is_valid_file_object($file_name)) {
|
||||||
$file = new \stdClass();
|
$file = new \stdClass();
|
||||||
$file->name = iconv('UTF-8', 'UTF-8//IGNORE', $file_name);
|
$file->name = iconv('UTF-8', 'UTF-8//IGNORE', $file_name);
|
||||||
|
|
@ -330,10 +343,10 @@ class UploadHandler
|
||||||
$file->width = $img_width_height[0];
|
$file->width = $img_width_height[0];
|
||||||
$file->height = $img_width_height[1];
|
$file->height = $img_width_height[1];
|
||||||
$file->url = $this->get_download_url($file->name);
|
$file->url = $this->get_download_url($file->name);
|
||||||
foreach($this->options['image_versions'] as $version => $options) {
|
foreach ($this->options['image_versions'] as $version => $options) {
|
||||||
if (!empty($version)) {
|
if (!empty($version)) {
|
||||||
if (is_file($this->get_upload_path($file_name, $version))) {
|
if (is_file($this->get_upload_path($file_name, $version))) {
|
||||||
$file->{$version.'Url'} = $this->get_download_url(
|
$file->{$version . 'Url'} = $this->get_download_url(
|
||||||
$file->name,
|
$file->name,
|
||||||
$version
|
$version
|
||||||
);
|
);
|
||||||
|
|
@ -346,7 +359,8 @@ class UploadHandler
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function get_file_objects($iteration_method = 'get_file_object') {
|
protected function get_file_objects($iteration_method = 'get_file_object')
|
||||||
|
{
|
||||||
$upload_dir = $this->get_upload_path();
|
$upload_dir = $this->get_upload_path();
|
||||||
if (!is_dir($upload_dir)) {
|
if (!is_dir($upload_dir)) {
|
||||||
return array();
|
return array();
|
||||||
|
|
@ -357,22 +371,25 @@ class UploadHandler
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function count_file_objects() {
|
protected function count_file_objects()
|
||||||
|
{
|
||||||
return count($this->get_file_objects('is_valid_file_object'));
|
return count($this->get_file_objects('is_valid_file_object'));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function get_error_message($error) {
|
protected function get_error_message($error)
|
||||||
|
{
|
||||||
return array_key_exists($error, $this->error_messages) ?
|
return array_key_exists($error, $this->error_messages) ?
|
||||||
$this->error_messages[$error] : $error;
|
$this->error_messages[$error] : $error;
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_config_bytes($val) {
|
function get_config_bytes($val)
|
||||||
|
{
|
||||||
$val = trim($val);
|
$val = trim($val);
|
||||||
$val_strlen = strlen($val)-1;
|
$val_strlen = strlen($val) - 1;
|
||||||
$last = isset($val[$val_strlen]) ? strtolower($val[$val_strlen]) : '';
|
$last = isset($val[$val_strlen]) ? strtolower($val[$val_strlen]) : '';
|
||||||
|
|
||||||
$bytes = (int) preg_replace('/[^0-9]/', '', $val);
|
$bytes = (int) preg_replace('/[^0-9]/', '', $val);
|
||||||
switch($last) {
|
switch ($last) {
|
||||||
case 'g':
|
case 'g':
|
||||||
$bytes *= 1024;
|
$bytes *= 1024;
|
||||||
case 'm':
|
case 'm':
|
||||||
|
|
@ -383,7 +400,8 @@ class UploadHandler
|
||||||
return $this->fix_integer_overflow($bytes);
|
return $this->fix_integer_overflow($bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function validate($uploaded_file, $file, $error, $index) {
|
protected function validate($uploaded_file, $file, $error, $index)
|
||||||
|
{
|
||||||
if ($error) {
|
if ($error) {
|
||||||
$file->error = $this->get_error_message($error);
|
$file->error = $this->get_error_message($error);
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -406,22 +424,27 @@ class UploadHandler
|
||||||
} else {
|
} else {
|
||||||
$file_size = $content_length;
|
$file_size = $content_length;
|
||||||
}
|
}
|
||||||
if ($this->options['max_file_size'] && (
|
if (
|
||||||
|
$this->options['max_file_size'] && (
|
||||||
$file_size > $this->options['max_file_size'] ||
|
$file_size > $this->options['max_file_size'] ||
|
||||||
$file->size > $this->options['max_file_size'])
|
$file->size > $this->options['max_file_size'])
|
||||||
) {
|
) {
|
||||||
$file->error = $this->get_error_message('max_file_size');
|
$file->error = $this->get_error_message('max_file_size');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ($this->options['min_file_size'] &&
|
if (
|
||||||
$file_size < $this->options['min_file_size']) {
|
$this->options['min_file_size'] &&
|
||||||
|
$file_size < $this->options['min_file_size']
|
||||||
|
) {
|
||||||
$file->error = $this->get_error_message('min_file_size');
|
$file->error = $this->get_error_message('min_file_size');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (is_int($this->options['max_number_of_files']) &&
|
if (
|
||||||
|
is_int($this->options['max_number_of_files']) &&
|
||||||
($this->count_file_objects() >= $this->options['max_number_of_files']) &&
|
($this->count_file_objects() >= $this->options['max_number_of_files']) &&
|
||||||
// Ignore additional chunks of existing files:
|
// Ignore additional chunks of existing files:
|
||||||
!is_file($this->get_upload_path($file->name))) {
|
!is_file($this->get_upload_path($file->name))
|
||||||
|
) {
|
||||||
$file->error = $this->get_error_message('max_number_of_files');
|
$file->error = $this->get_error_message('max_number_of_files');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -429,8 +452,10 @@ class UploadHandler
|
||||||
$max_height = @$this->options['max_height'];
|
$max_height = @$this->options['max_height'];
|
||||||
$min_width = @$this->options['min_width'];
|
$min_width = @$this->options['min_width'];
|
||||||
$min_height = @$this->options['min_height'];
|
$min_height = @$this->options['min_height'];
|
||||||
if (($max_width || $max_height || $min_width || $min_height)
|
if (
|
||||||
&& preg_match($this->options['image_file_types'], $file->name)) {
|
($max_width || $max_height || $min_width || $min_height)
|
||||||
|
&& preg_match($this->options['image_file_types'], $file->name)
|
||||||
|
) {
|
||||||
list($img_width, $img_height) = $this->get_image_size($uploaded_file);
|
list($img_width, $img_height) = $this->get_image_size($uploaded_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -455,13 +480,15 @@ class UploadHandler
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function upcount_name_callback($matches) {
|
protected function upcount_name_callback($matches)
|
||||||
|
{
|
||||||
$index = isset($matches[1]) ? intval($matches[1]) + 1 : 1;
|
$index = isset($matches[1]) ? intval($matches[1]) + 1 : 1;
|
||||||
$ext = isset($matches[2]) ? $matches[2] : '';
|
$ext = isset($matches[2]) ? $matches[2] : '';
|
||||||
return ' ('.$index.')'.$ext;
|
return ' (' . $index . ')' . $ext;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function upcount_name($name) {
|
protected function upcount_name($name)
|
||||||
|
{
|
||||||
return preg_replace_callback(
|
return preg_replace_callback(
|
||||||
'/(?:(?: \(([\d]+)\))?(\.[^.]+))?$/',
|
'/(?:(?: \(([\d]+)\))?(\.[^.]+))?$/',
|
||||||
array($this, 'upcount_name_callback'),
|
array($this, 'upcount_name_callback'),
|
||||||
|
|
@ -470,17 +497,21 @@ class UploadHandler
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function get_unique_filename($file_path, $name, $size, $type, $error, $index, $content_range) {
|
protected function get_unique_filename($file_path, $name, $size, $type, $error, $index, $content_range)
|
||||||
while(is_dir($this->get_upload_path($name))) {
|
{
|
||||||
|
while (is_dir($this->get_upload_path($name))) {
|
||||||
$name = $this->upcount_name($name);
|
$name = $this->upcount_name($name);
|
||||||
}
|
}
|
||||||
|
|
||||||
$content_range_byte = isset($content_range[1]) ? (int) $content_range[1] : 0;
|
$content_range_byte = isset($content_range[1]) ? (int) $content_range[1] : 0;
|
||||||
// Keep an existing filename if this is part of a chunked upload:
|
// Keep an existing filename if this is part of a chunked upload:
|
||||||
$uploaded_bytes = $this->fix_integer_overflow($content_range_byte);
|
$uploaded_bytes = $this->fix_integer_overflow($content_range_byte);
|
||||||
while(is_file($this->get_upload_path($name))) {
|
while (is_file($this->get_upload_path($name))) {
|
||||||
if ($uploaded_bytes === $this->get_file_size(
|
if (
|
||||||
$this->get_upload_path($name))) {
|
$uploaded_bytes === $this->get_file_size(
|
||||||
|
$this->get_upload_path($name)
|
||||||
|
)
|
||||||
|
) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$name = $this->upcount_name($name);
|
$name = $this->upcount_name($name);
|
||||||
|
|
@ -488,7 +519,8 @@ class UploadHandler
|
||||||
return $name;
|
return $name;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function trim_file_name($file_path, $name, $size, $type, $error, $index, $content_range) {
|
protected function trim_file_name($file_path, $name, $size, $type, $error, $index, $content_range)
|
||||||
|
{
|
||||||
// Remove path information and dots around the filename, to prevent uploading
|
// Remove path information and dots around the filename, to prevent uploading
|
||||||
// into different directories or replacing hidden system files.
|
// into different directories or replacing hidden system files.
|
||||||
// Also remove control characters and spaces (\x00..\x20) around the filename:
|
// Also remove control characters and spaces (\x00..\x20) around the filename:
|
||||||
|
|
@ -498,12 +530,14 @@ class UploadHandler
|
||||||
$name = str_replace('.', '-', microtime(true));
|
$name = str_replace('.', '-', microtime(true));
|
||||||
}
|
}
|
||||||
// Add missing file extension for known image types:
|
// Add missing file extension for known image types:
|
||||||
if (strpos($name, '.') === false &&
|
if (
|
||||||
preg_match('/^image\/(gif|jpe?g|png|webp)/', $type, $matches)) {
|
strpos($name, '.') === false &&
|
||||||
$name .= '.'.$matches[1];
|
preg_match('/^image\/(gif|jpe?g|png|webp)/', $type, $matches)
|
||||||
|
) {
|
||||||
|
$name .= '.' . $matches[1];
|
||||||
}
|
}
|
||||||
if (function_exists('exif_imagetype') && $file_path) {
|
if (function_exists('exif_imagetype') && $file_path) {
|
||||||
switch(@exif_imagetype($file_path)){
|
switch (@exif_imagetype($file_path)) {
|
||||||
case IMAGETYPE_JPEG:
|
case IMAGETYPE_JPEG:
|
||||||
$extensions = array('jpg', 'jpeg');
|
$extensions = array('jpg', 'jpeg');
|
||||||
break;
|
break;
|
||||||
|
|
@ -531,7 +565,8 @@ class UploadHandler
|
||||||
return $name;
|
return $name;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function get_file_name($file_path, $name, $size, $type, $error, $index, $content_range) {
|
protected function get_file_name($file_path, $name, $size, $type, $error, $index, $content_range)
|
||||||
|
{
|
||||||
return $this->get_unique_filename(
|
return $this->get_unique_filename(
|
||||||
$file_path,
|
$file_path,
|
||||||
$this->trim_file_name($file_path, $name, $size, $type, $error, $index, $content_range),
|
$this->trim_file_name($file_path, $name, $size, $type, $error, $index, $content_range),
|
||||||
|
|
@ -543,25 +578,28 @@ class UploadHandler
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function handle_form_data($file, $index) {
|
protected function handle_form_data($file, $index)
|
||||||
|
{
|
||||||
// Handle form data, e.g. $_REQUEST['description'][$index]
|
// Handle form data, e.g. $_REQUEST['description'][$index]
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function get_scaled_image_file_paths($file_name, $version) {
|
protected function get_scaled_image_file_paths($file_name, $version)
|
||||||
|
{
|
||||||
$file_path = $this->get_upload_path($file_name);
|
$file_path = $this->get_upload_path($file_name);
|
||||||
if (!empty($version)) {
|
if (!empty($version)) {
|
||||||
$version_dir = $this->get_upload_path(null, $version);
|
$version_dir = $this->get_upload_path(null, $version);
|
||||||
if (!is_dir($version_dir)) {
|
if (!is_dir($version_dir)) {
|
||||||
mkdir($version_dir, $this->options['mkdir_mode'], true);
|
mkdir($version_dir, $this->options['mkdir_mode'], true);
|
||||||
}
|
}
|
||||||
$new_file_path = $version_dir.'/'.$file_name;
|
$new_file_path = $version_dir . '/' . $file_name;
|
||||||
} else {
|
} else {
|
||||||
$new_file_path = $file_path;
|
$new_file_path = $file_path;
|
||||||
}
|
}
|
||||||
return array($file_path, $new_file_path);
|
return array($file_path, $new_file_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function gd_get_image_object($file_path, $func, $no_cache = false) {
|
protected function gd_get_image_object($file_path, $func, $no_cache = false)
|
||||||
|
{
|
||||||
if (empty($this->image_objects[$file_path]) || $no_cache) {
|
if (empty($this->image_objects[$file_path]) || $no_cache) {
|
||||||
$this->gd_destroy_image_object($file_path);
|
$this->gd_destroy_image_object($file_path);
|
||||||
$this->image_objects[$file_path] = $func($file_path);
|
$this->image_objects[$file_path] = $func($file_path);
|
||||||
|
|
@ -569,17 +607,20 @@ class UploadHandler
|
||||||
return $this->image_objects[$file_path];
|
return $this->image_objects[$file_path];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function gd_set_image_object($file_path, $image) {
|
protected function gd_set_image_object($file_path, $image)
|
||||||
|
{
|
||||||
$this->gd_destroy_image_object($file_path);
|
$this->gd_destroy_image_object($file_path);
|
||||||
$this->image_objects[$file_path] = $image;
|
$this->image_objects[$file_path] = $image;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function gd_destroy_image_object($file_path) {
|
protected function gd_destroy_image_object($file_path)
|
||||||
|
{
|
||||||
$image = @$this->image_objects[$file_path];
|
$image = @$this->image_objects[$file_path];
|
||||||
return $image && imagedestroy($image);
|
return $image && imagedestroy($image);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function gd_imageflip($image, $mode) {
|
protected function gd_imageflip($image, $mode)
|
||||||
|
{
|
||||||
if (function_exists('imageflip')) {
|
if (function_exists('imageflip')) {
|
||||||
return imageflip($image, $mode);
|
return imageflip($image, $mode);
|
||||||
}
|
}
|
||||||
|
|
@ -621,7 +662,8 @@ class UploadHandler
|
||||||
return $new_img;
|
return $new_img;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function gd_orient_image($file_path, $src_img) {
|
protected function gd_orient_image($file_path, $src_img)
|
||||||
|
{
|
||||||
if (!function_exists('exif_read_data')) {
|
if (!function_exists('exif_read_data')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -678,7 +720,8 @@ class UploadHandler
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function gd_create_scaled_image($file_name, $version, $options) {
|
protected function gd_create_scaled_image($file_name, $version, $options)
|
||||||
|
{
|
||||||
if (!function_exists('imagecreatetruecolor')) {
|
if (!function_exists('imagecreatetruecolor')) {
|
||||||
error_log('Function not found: imagecreatetruecolor');
|
error_log('Function not found: imagecreatetruecolor');
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -719,10 +762,12 @@ class UploadHandler
|
||||||
!empty($options['no_cache'])
|
!empty($options['no_cache'])
|
||||||
);
|
);
|
||||||
$image_oriented = false;
|
$image_oriented = false;
|
||||||
if (!empty($options['auto_orient']) && $this->gd_orient_image(
|
if (
|
||||||
|
!empty($options['auto_orient']) && $this->gd_orient_image(
|
||||||
$file_path,
|
$file_path,
|
||||||
$src_img
|
$src_img
|
||||||
)) {
|
)
|
||||||
|
) {
|
||||||
$image_oriented = true;
|
$image_oriented = true;
|
||||||
$src_img = $this->gd_get_image_object(
|
$src_img = $this->gd_get_image_object(
|
||||||
$file_path,
|
$file_path,
|
||||||
|
|
@ -794,7 +839,8 @@ class UploadHandler
|
||||||
return $success;
|
return $success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function imagick_get_image_object($file_path, $no_cache = false) {
|
protected function imagick_get_image_object($file_path, $no_cache = false)
|
||||||
|
{
|
||||||
if (empty($this->image_objects[$file_path]) || $no_cache) {
|
if (empty($this->image_objects[$file_path]) || $no_cache) {
|
||||||
$this->imagick_destroy_image_object($file_path);
|
$this->imagick_destroy_image_object($file_path);
|
||||||
$image = new \Imagick();
|
$image = new \Imagick();
|
||||||
|
|
@ -809,17 +855,20 @@ class UploadHandler
|
||||||
return $this->image_objects[$file_path];
|
return $this->image_objects[$file_path];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function imagick_set_image_object($file_path, $image) {
|
protected function imagick_set_image_object($file_path, $image)
|
||||||
|
{
|
||||||
$this->imagick_destroy_image_object($file_path);
|
$this->imagick_destroy_image_object($file_path);
|
||||||
$this->image_objects[$file_path] = $image;
|
$this->image_objects[$file_path] = $image;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function imagick_destroy_image_object($file_path) {
|
protected function imagick_destroy_image_object($file_path)
|
||||||
|
{
|
||||||
$image = @$this->image_objects[$file_path];
|
$image = @$this->image_objects[$file_path];
|
||||||
return $image && $image->destroy();
|
return $image && $image->destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function imagick_orient_image($image) {
|
protected function imagick_orient_image($image)
|
||||||
|
{
|
||||||
$orientation = $image->getImageOrientation();
|
$orientation = $image->getImageOrientation();
|
||||||
$background = new \ImagickPixel('none');
|
$background = new \ImagickPixel('none');
|
||||||
switch ($orientation) {
|
switch ($orientation) {
|
||||||
|
|
@ -853,7 +902,8 @@ class UploadHandler
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function imagick_create_scaled_image($file_name, $version, $options) {
|
protected function imagick_create_scaled_image($file_name, $version, $options)
|
||||||
|
{
|
||||||
list($file_path, $new_file_path) =
|
list($file_path, $new_file_path) =
|
||||||
$this->get_scaled_image_file_paths($file_name, $version);
|
$this->get_scaled_image_file_paths($file_name, $version);
|
||||||
$image = $this->imagick_get_image_object(
|
$image = $this->imagick_get_image_object(
|
||||||
|
|
@ -933,11 +983,12 @@ class UploadHandler
|
||||||
return $success && $image->writeImage($new_file_path);
|
return $success && $image->writeImage($new_file_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function imagemagick_create_scaled_image($file_name, $version, $options) {
|
protected function imagemagick_create_scaled_image($file_name, $version, $options)
|
||||||
|
{
|
||||||
list($file_path, $new_file_path) =
|
list($file_path, $new_file_path) =
|
||||||
$this->get_scaled_image_file_paths($file_name, $version);
|
$this->get_scaled_image_file_paths($file_name, $version);
|
||||||
$resize = @$options['max_width']
|
$resize = @$options['max_width']
|
||||||
.(empty($options['max_height']) ? '' : 'X'.$options['max_height']);
|
. (empty($options['max_height']) ? '' : 'X' . $options['max_height']);
|
||||||
if (!$resize && empty($options['auto_orient'])) {
|
if (!$resize && empty($options['auto_orient'])) {
|
||||||
if ($file_path !== $new_file_path) {
|
if ($file_path !== $new_file_path) {
|
||||||
return copy($file_path, $new_file_path);
|
return copy($file_path, $new_file_path);
|
||||||
|
|
@ -946,9 +997,9 @@ class UploadHandler
|
||||||
}
|
}
|
||||||
$cmd = $this->options['convert_bin'];
|
$cmd = $this->options['convert_bin'];
|
||||||
if (!empty($this->options['convert_params'])) {
|
if (!empty($this->options['convert_params'])) {
|
||||||
$cmd .= ' '.$this->options['convert_params'];
|
$cmd .= ' ' . $this->options['convert_params'];
|
||||||
}
|
}
|
||||||
$cmd .= ' '.escapeshellarg($file_path);
|
$cmd .= ' ' . escapeshellarg($file_path);
|
||||||
if (!empty($options['auto_orient'])) {
|
if (!empty($options['auto_orient'])) {
|
||||||
$cmd .= ' -auto-orient';
|
$cmd .= ' -auto-orient';
|
||||||
}
|
}
|
||||||
|
|
@ -956,19 +1007,19 @@ class UploadHandler
|
||||||
// Handle animated GIFs:
|
// Handle animated GIFs:
|
||||||
$cmd .= ' -coalesce';
|
$cmd .= ' -coalesce';
|
||||||
if (empty($options['crop'])) {
|
if (empty($options['crop'])) {
|
||||||
$cmd .= ' -resize '.escapeshellarg($resize.'>');
|
$cmd .= ' -resize ' . escapeshellarg($resize . '>');
|
||||||
} else {
|
} else {
|
||||||
$cmd .= ' -resize '.escapeshellarg($resize.'^');
|
$cmd .= ' -resize ' . escapeshellarg($resize . '^');
|
||||||
$cmd .= ' -gravity center';
|
$cmd .= ' -gravity center';
|
||||||
$cmd .= ' -crop '.escapeshellarg($resize.'+0+0');
|
$cmd .= ' -crop ' . escapeshellarg($resize . '+0+0');
|
||||||
}
|
}
|
||||||
// Make sure the page dimensions are correct (fixes offsets of animated GIFs):
|
// Make sure the page dimensions are correct (fixes offsets of animated GIFs):
|
||||||
$cmd .= ' +repage';
|
$cmd .= ' +repage';
|
||||||
}
|
}
|
||||||
if (!empty($options['convert_params'])) {
|
if (!empty($options['convert_params'])) {
|
||||||
$cmd .= ' '.$options['convert_params'];
|
$cmd .= ' ' . $options['convert_params'];
|
||||||
}
|
}
|
||||||
$cmd .= ' '.escapeshellarg($new_file_path);
|
$cmd .= ' ' . escapeshellarg($new_file_path);
|
||||||
exec($cmd, $output, $error);
|
exec($cmd, $output, $error);
|
||||||
if ($error) {
|
if ($error) {
|
||||||
error_log(implode('\n', $output));
|
error_log(implode('\n', $output));
|
||||||
|
|
@ -977,7 +1028,8 @@ class UploadHandler
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function get_image_size($file_path) {
|
protected function get_image_size($file_path)
|
||||||
|
{
|
||||||
if ($this->options['image_library']) {
|
if ($this->options['image_library']) {
|
||||||
if (extension_loaded('imagick')) {
|
if (extension_loaded('imagick')) {
|
||||||
$image = new \Imagick();
|
$image = new \Imagick();
|
||||||
|
|
@ -994,7 +1046,7 @@ class UploadHandler
|
||||||
}
|
}
|
||||||
if ($this->options['image_library'] === 2) {
|
if ($this->options['image_library'] === 2) {
|
||||||
$cmd = $this->options['identify_bin'];
|
$cmd = $this->options['identify_bin'];
|
||||||
$cmd .= ' -ping '.escapeshellarg($file_path);
|
$cmd .= ' -ping ' . escapeshellarg($file_path);
|
||||||
exec($cmd, $output, $error);
|
exec($cmd, $output, $error);
|
||||||
if (!$error && !empty($output)) {
|
if (!$error && !empty($output)) {
|
||||||
// image.jpg JPEG 1920x1080 1920x1080+0+0 8-bit sRGB 465KB 0.000u 0:00.000
|
// image.jpg JPEG 1920x1080 1920x1080+0+0 8-bit sRGB 465KB 0.000u 0:00.000
|
||||||
|
|
@ -1012,7 +1064,8 @@ class UploadHandler
|
||||||
return @getimagesize($file_path);
|
return @getimagesize($file_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function create_scaled_image($file_name, $version, $options) {
|
protected function create_scaled_image($file_name, $version, $options)
|
||||||
|
{
|
||||||
if ($this->options['image_library'] === 2) {
|
if ($this->options['image_library'] === 2) {
|
||||||
return $this->imagemagick_create_scaled_image($file_name, $version, $options);
|
return $this->imagemagick_create_scaled_image($file_name, $version, $options);
|
||||||
}
|
}
|
||||||
|
|
@ -1022,13 +1075,15 @@ class UploadHandler
|
||||||
return $this->gd_create_scaled_image($file_name, $version, $options);
|
return $this->gd_create_scaled_image($file_name, $version, $options);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function destroy_image_object($file_path) {
|
protected function destroy_image_object($file_path)
|
||||||
|
{
|
||||||
if ($this->options['image_library'] && extension_loaded('imagick')) {
|
if ($this->options['image_library'] && extension_loaded('imagick')) {
|
||||||
return $this->imagick_destroy_image_object($file_path);
|
return $this->imagick_destroy_image_object($file_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function is_valid_image_file($file_path) {
|
protected function is_valid_image_file($file_path)
|
||||||
|
{
|
||||||
if (!preg_match($this->options['image_file_types'], $file_path)) {
|
if (!preg_match($this->options['image_file_types'], $file_path)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -1039,12 +1094,13 @@ class UploadHandler
|
||||||
return $image_info && $image_info[0] && $image_info[1];
|
return $image_info && $image_info[0] && $image_info[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function handle_image_file($file_path, $file) {
|
protected function handle_image_file($file_path, $file)
|
||||||
|
{
|
||||||
$failed_versions = array();
|
$failed_versions = array();
|
||||||
foreach($this->options['image_versions'] as $version => $options) {
|
foreach ($this->options['image_versions'] as $version => $options) {
|
||||||
if ($this->create_scaled_image($file->name, $version, $options)) {
|
if ($this->create_scaled_image($file->name, $version, $options)) {
|
||||||
if (!empty($version)) {
|
if (!empty($version)) {
|
||||||
$file->{$version.'Url'} = $this->get_download_url(
|
$file->{$version . 'Url'} = $this->get_download_url(
|
||||||
$file->name,
|
$file->name,
|
||||||
$version
|
$version
|
||||||
);
|
);
|
||||||
|
|
@ -1057,26 +1113,29 @@ class UploadHandler
|
||||||
}
|
}
|
||||||
if (count($failed_versions)) {
|
if (count($failed_versions)) {
|
||||||
$file->error = $this->get_error_message('image_resize')
|
$file->error = $this->get_error_message('image_resize')
|
||||||
.' ('.implode(', ', $failed_versions).')';
|
. ' (' . implode(', ', $failed_versions) . ')';
|
||||||
}
|
}
|
||||||
// Free memory:
|
// Free memory:
|
||||||
$this->destroy_image_object($file_path);
|
$this->destroy_image_object($file_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function get_microtime(){
|
protected function get_microtime()
|
||||||
list($usec, $sec) = explode(" ",microtime());
|
{
|
||||||
return ((float)$usec + (float)$sec);
|
list($usec, $sec) = explode(" ", microtime());
|
||||||
|
return ((float) $usec + (float) $sec);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function get_file_passname(){
|
protected function get_file_passname()
|
||||||
$tmp_name = $this->get_user_id().$_SERVER['REMOTE_ADDR'];
|
{
|
||||||
|
$tmp_name = $this->get_user_id() . $_SERVER['REMOTE_ADDR'];
|
||||||
$tmp_name = md5(sha1($tmp_name));
|
$tmp_name = md5(sha1($tmp_name));
|
||||||
return $tmp_name;
|
return $tmp_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function reprocessImage($file_path, $callback)
|
protected function reprocessImage($file_path, $callback)
|
||||||
{
|
{
|
||||||
if( ! $file_path ) return;
|
if (!$file_path)
|
||||||
|
return;
|
||||||
|
|
||||||
// Extracting mime type using getimagesize
|
// Extracting mime type using getimagesize
|
||||||
try {
|
try {
|
||||||
|
|
@ -1123,18 +1182,19 @@ class UploadHandler
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function handle_file_upload($uploaded_file, $name, $size, $type, $error, $index = null, $content_range = null) {
|
protected function handle_file_upload($uploaded_file, $name, $size, $type, $error, $index = null, $content_range = null)
|
||||||
|
{
|
||||||
$file = new \stdClass();
|
$file = new \stdClass();
|
||||||
$file->oriname = $this->get_file_name($uploaded_file, $name, $size, $type, $error, $index, $content_range);
|
$file->oriname = $this->get_file_name($uploaded_file, $name, $size, $type, $error, $index, $content_range);
|
||||||
|
|
||||||
$filename_ext = pathinfo($name, PATHINFO_EXTENSION);
|
$filename_ext = pathinfo($name, PATHINFO_EXTENSION);
|
||||||
$file->name = $this->get_file_passname().'_'.str_replace(".", "_", $this->get_microtime()).".".$filename_ext;
|
$file->name = $this->get_file_passname() . '_' . str_replace(".", "_", $this->get_microtime()) . "." . $filename_ext;
|
||||||
|
|
||||||
//$file->name = iconv('UTF-8', 'UTF-8//IGNORE', utf8_encode($file->name));
|
//$file->name = iconv('UTF-8', 'UTF-8//IGNORE', utf8_encode($file->name));
|
||||||
$file->size = $this->fix_integer_overflow(intval($size));
|
$file->size = $this->fix_integer_overflow(intval($size));
|
||||||
$file->type = $type;
|
$file->type = $type;
|
||||||
|
|
||||||
if ( SMARTEDITOR_UPLOAD_IMG_CHECK && ! $this->reprocessImage($uploaded_file, null) ){
|
if (SMARTEDITOR_UPLOAD_IMG_CHECK && !$this->reprocessImage($uploaded_file, null)) {
|
||||||
$file->error = $this->get_error_message('accept_file_types');
|
$file->error = $this->get_error_message('accept_file_types');
|
||||||
return $file;
|
return $file;
|
||||||
}
|
}
|
||||||
|
|
@ -1170,7 +1230,8 @@ class UploadHandler
|
||||||
$file_size = $this->get_file_size($file_path, $append_file);
|
$file_size = $this->get_file_size($file_path, $append_file);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if(defined('G5_FILE_PERMISSION')) chmod($file_path, G5_FILE_PERMISSION);
|
if (defined('G5_FILE_PERMISSION'))
|
||||||
|
chmod($file_path, G5_FILE_PERMISSION);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1181,11 +1242,11 @@ class UploadHandler
|
||||||
|
|
||||||
$this->files[] = $file->name;
|
$this->files[] = $file->name;
|
||||||
|
|
||||||
if( $this->options['is_resize'] ){
|
if ($this->options['is_resize']) {
|
||||||
$resize_options = array(
|
$resize_options = array(
|
||||||
'max_width'=>$this->options['resize_max_width'],
|
'max_width' => $this->options['resize_max_width'],
|
||||||
'max_height'=>$this->options['resize_max_height'],
|
'max_height' => $this->options['resize_max_height'],
|
||||||
'jpeg_quality'=>$this->options['resize_jpeg_compress'],
|
'jpeg_quality' => $this->options['resize_jpeg_compress'],
|
||||||
'auto_orient' => true,
|
'auto_orient' => true,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -1198,7 +1259,7 @@ class UploadHandler
|
||||||
$file->width = $image_width_height[0];
|
$file->width = $image_width_height[0];
|
||||||
$file->height = $image_width_height[1];
|
$file->height = $image_width_height[1];
|
||||||
|
|
||||||
if( function_exists('run_replace') ){
|
if (function_exists('run_replace')) {
|
||||||
$file->url = run_replace('get_editor_upload_url', $file->url, $file_path, $file);
|
$file->url = run_replace('get_editor_upload_url', $file->url, $file_path, $file);
|
||||||
}
|
}
|
||||||
} else { //로빈아빠님이 알려주심, 이미지 업로드 체크
|
} else { //로빈아빠님이 알려주심, 이미지 업로드 체크
|
||||||
|
|
@ -1218,7 +1279,8 @@ class UploadHandler
|
||||||
return $file;
|
return $file;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function readfile($file_path) {
|
protected function readfile($file_path)
|
||||||
|
{
|
||||||
$file_size = $this->get_file_size($file_path);
|
$file_size = $this->get_file_size($file_path);
|
||||||
$chunk_size = $this->options['readfile_chunk_size'];
|
$chunk_size = $this->options['readfile_chunk_size'];
|
||||||
if ($chunk_size && $file_size > $chunk_size) {
|
if ($chunk_size && $file_size > $chunk_size) {
|
||||||
|
|
@ -1234,26 +1296,30 @@ class UploadHandler
|
||||||
return readfile($file_path);
|
return readfile($file_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function body($str) {
|
protected function body($str)
|
||||||
|
{
|
||||||
echo $str;
|
echo $str;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function header($str) {
|
protected function header($str)
|
||||||
|
{
|
||||||
header($str);
|
header($str);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function get_server_var($id) {
|
protected function get_server_var($id)
|
||||||
|
{
|
||||||
return isset($_SERVER[$id]) ? $_SERVER[$id] : '';
|
return isset($_SERVER[$id]) ? $_SERVER[$id] : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function generate_response($content, $print_response = true) {
|
protected function generate_response($content, $print_response = true)
|
||||||
|
{
|
||||||
if ($print_response) {
|
if ($print_response) {
|
||||||
$json = json_encode($content);
|
$json = json_encode($content);
|
||||||
|
|
||||||
$redirect = isset($_REQUEST['redirect']) ?
|
$redirect = isset($_REQUEST['redirect']) ?
|
||||||
stripslashes($_REQUEST['redirect']) : null;
|
stripslashes($_REQUEST['redirect']) : null;
|
||||||
if ($redirect) {
|
if ($redirect) {
|
||||||
$this->header('Location: '.sprintf($redirect, rawurlencode($json)));
|
$this->header('Location: ' . sprintf($redirect, rawurlencode($json)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$this->head();
|
$this->head();
|
||||||
|
|
@ -1261,7 +1327,7 @@ class UploadHandler
|
||||||
$files = isset($content[$this->options['param_name']]) ?
|
$files = isset($content[$this->options['param_name']]) ?
|
||||||
$content[$this->options['param_name']] : null;
|
$content[$this->options['param_name']] : null;
|
||||||
if ($files && is_array($files) && is_object($files[0]) && $files[0]->size) {
|
if ($files && is_array($files) && is_object($files[0]) && $files[0]->size) {
|
||||||
$this->header('Range: 0-'.(
|
$this->header('Range: 0-' . (
|
||||||
$this->fix_integer_overflow(intval($files[0]->size)) - 1
|
$this->fix_integer_overflow(intval($files[0]->size)) - 1
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
@ -1271,20 +1337,24 @@ class UploadHandler
|
||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function get_version_param() {
|
protected function get_version_param()
|
||||||
|
{
|
||||||
return isset($_GET['version']) ? basename(stripslashes($_GET['version'])) : null;
|
return isset($_GET['version']) ? basename(stripslashes($_GET['version'])) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function get_singular_param_name() {
|
protected function get_singular_param_name()
|
||||||
|
{
|
||||||
return substr($this->options['param_name'], 0, -1);
|
return substr($this->options['param_name'], 0, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function get_file_name_param() {
|
protected function get_file_name_param()
|
||||||
|
{
|
||||||
$name = $this->get_singular_param_name();
|
$name = $this->get_singular_param_name();
|
||||||
return isset($_GET[$name]) ? basename(stripslashes($_GET[$name])) : null;
|
return isset($_GET[$name]) ? basename(stripslashes($_GET[$name])) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function get_file_names_params() {
|
protected function get_file_names_params()
|
||||||
|
{
|
||||||
$params = isset($_GET[$this->options['param_name']]) ?
|
$params = isset($_GET[$this->options['param_name']]) ?
|
||||||
$_GET[$this->options['param_name']] : array();
|
$_GET[$this->options['param_name']] : array();
|
||||||
foreach ($params as $key => $value) {
|
foreach ($params as $key => $value) {
|
||||||
|
|
@ -1293,7 +1363,8 @@ class UploadHandler
|
||||||
return $params;
|
return $params;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function get_file_type($file_path) {
|
protected function get_file_type($file_path)
|
||||||
|
{
|
||||||
switch (strtolower(pathinfo($file_path, PATHINFO_EXTENSION))) {
|
switch (strtolower(pathinfo($file_path, PATHINFO_EXTENSION))) {
|
||||||
case 'jpeg':
|
case 'jpeg':
|
||||||
case 'jpg':
|
case 'jpg':
|
||||||
|
|
@ -1309,7 +1380,8 @@ class UploadHandler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function download() {
|
protected function download()
|
||||||
|
{
|
||||||
switch ($this->options['download_via_php']) {
|
switch ($this->options['download_via_php']) {
|
||||||
case 1:
|
case 1:
|
||||||
$redirect_header = null;
|
$redirect_header = null;
|
||||||
|
|
@ -1329,7 +1401,7 @@ class UploadHandler
|
||||||
}
|
}
|
||||||
if ($redirect_header) {
|
if ($redirect_header) {
|
||||||
return $this->header(
|
return $this->header(
|
||||||
$redirect_header.': '.$this->get_download_url(
|
$redirect_header . ': ' . $this->get_download_url(
|
||||||
$file_name,
|
$file_name,
|
||||||
$this->get_version_param(),
|
$this->get_version_param(),
|
||||||
true
|
true
|
||||||
|
|
@ -1341,17 +1413,18 @@ class UploadHandler
|
||||||
$this->header('X-Content-Type-Options: nosniff');
|
$this->header('X-Content-Type-Options: nosniff');
|
||||||
if (!preg_match($this->options['inline_file_types'], $file_name)) {
|
if (!preg_match($this->options['inline_file_types'], $file_name)) {
|
||||||
$this->header('Content-Type: application/octet-stream');
|
$this->header('Content-Type: application/octet-stream');
|
||||||
$this->header('Content-Disposition: attachment; filename="'.$file_name.'"');
|
$this->header('Content-Disposition: attachment; filename="' . $file_name . '"');
|
||||||
} else {
|
} else {
|
||||||
$this->header('Content-Type: '.$this->get_file_type($file_path));
|
$this->header('Content-Type: ' . $this->get_file_type($file_path));
|
||||||
$this->header('Content-Disposition: inline; filename="'.$file_name.'"');
|
$this->header('Content-Disposition: inline; filename="' . $file_name . '"');
|
||||||
}
|
}
|
||||||
$this->header('Content-Length: '.$this->get_file_size($file_path));
|
$this->header('Content-Length: ' . $this->get_file_size($file_path));
|
||||||
$this->header('Last-Modified: '.gmdate('D, d M Y H:i:s T', filemtime($file_path)));
|
$this->header('Last-Modified: ' . gmdate('D, d M Y H:i:s T', filemtime($file_path)));
|
||||||
$this->readfile($file_path);
|
$this->readfile($file_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function send_content_type_header() {
|
protected function send_content_type_header()
|
||||||
|
{
|
||||||
$this->header('Vary: Accept');
|
$this->header('Vary: Accept');
|
||||||
if (strpos($this->get_server_var('HTTP_ACCEPT'), 'application/json') !== false) {
|
if (strpos($this->get_server_var('HTTP_ACCEPT'), 'application/json') !== false) {
|
||||||
$this->header('Content-type: application/json');
|
$this->header('Content-type: application/json');
|
||||||
|
|
@ -1360,17 +1433,19 @@ class UploadHandler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function send_access_control_headers() {
|
protected function send_access_control_headers()
|
||||||
$this->header('Access-Control-Allow-Origin: '.$this->options['access_control_allow_origin']);
|
{
|
||||||
|
$this->header('Access-Control-Allow-Origin: ' . $this->options['access_control_allow_origin']);
|
||||||
$this->header('Access-Control-Allow-Credentials: '
|
$this->header('Access-Control-Allow-Credentials: '
|
||||||
.($this->options['access_control_allow_credentials'] ? 'true' : 'false'));
|
. ($this->options['access_control_allow_credentials'] ? 'true' : 'false'));
|
||||||
$this->header('Access-Control-Allow-Methods: '
|
$this->header('Access-Control-Allow-Methods: '
|
||||||
.implode(', ', $this->options['access_control_allow_methods']));
|
. implode(', ', $this->options['access_control_allow_methods']));
|
||||||
$this->header('Access-Control-Allow-Headers: '
|
$this->header('Access-Control-Allow-Headers: '
|
||||||
.implode(', ', $this->options['access_control_allow_headers']));
|
. implode(', ', $this->options['access_control_allow_headers']));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function head() {
|
public function head()
|
||||||
|
{
|
||||||
$this->header('Pragma: no-cache');
|
$this->header('Pragma: no-cache');
|
||||||
$this->header('Cache-Control: no-store, no-cache, must-revalidate');
|
$this->header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||||
$this->header('Content-Disposition: inline; filename="files.json"');
|
$this->header('Content-Disposition: inline; filename="files.json"');
|
||||||
|
|
@ -1382,7 +1457,8 @@ class UploadHandler
|
||||||
$this->send_content_type_header();
|
$this->send_content_type_header();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get($print_response = true) {
|
public function get($print_response = true)
|
||||||
|
{
|
||||||
//보안 이슈로 인해 사용하지 않습니다.
|
//보안 이슈로 인해 사용하지 않습니다.
|
||||||
/*
|
/*
|
||||||
if ($print_response && isset($_GET['download'])) {
|
if ($print_response && isset($_GET['download'])) {
|
||||||
|
|
@ -1402,7 +1478,8 @@ class UploadHandler
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public function post($print_response = true) {
|
public function post($print_response = true)
|
||||||
|
{
|
||||||
if (isset($_REQUEST['_method']) && $_REQUEST['_method'] === 'DELETE') {
|
if (isset($_REQUEST['_method']) && $_REQUEST['_method'] === 'DELETE') {
|
||||||
return $this->delete($print_response);
|
return $this->delete($print_response);
|
||||||
}
|
}
|
||||||
|
|
@ -1457,24 +1534,26 @@ class UploadHandler
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete($print_response = true) {
|
public function delete($print_response = true)
|
||||||
|
{
|
||||||
/* 보안 이슈 url을 참고 https://github.com/blueimp/jQuery-File-Upload/issues/2426 */
|
/* 보안 이슈 url을 참고 https://github.com/blueimp/jQuery-File-Upload/issues/2426 */
|
||||||
$file_names = $this->get_file_names_params();
|
$file_names = $this->get_file_names_params();
|
||||||
if (empty($file_names)) {
|
if (empty($file_names)) {
|
||||||
$file_names = array($this->get_file_name_param());
|
$file_names = array($this->get_file_name_param());
|
||||||
}
|
}
|
||||||
$response = array();
|
$response = array();
|
||||||
foreach($file_names as $file_name) {
|
foreach ($file_names as $file_name) {
|
||||||
if( substr($file_name, 0 , 32) != $this->get_file_passname() ) continue; //session_id() 와 비교하여 틀리면 지우지 않음
|
if (substr($file_name, 0, 32) != $this->get_file_passname())
|
||||||
|
continue; //session_id() 와 비교하여 틀리면 지우지 않음
|
||||||
$file_path = $this->get_upload_path($file_name);
|
$file_path = $this->get_upload_path($file_name);
|
||||||
$success = is_file($file_path) && $file_name[0] !== '.' && unlink($file_path);
|
$success = is_file($file_path) && $file_name[0] !== '.' && unlink($file_path);
|
||||||
|
|
||||||
if( function_exists('run_event') ){
|
if (function_exists('run_event')) {
|
||||||
run_event('delete_editor_file', $file_path, $success);
|
run_event('delete_editor_file', $file_path, $success);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($success) {
|
if ($success) {
|
||||||
foreach($this->options['image_versions'] as $version => $options) {
|
foreach ($this->options['image_versions'] as $version => $options) {
|
||||||
if (!empty($version)) {
|
if (!empty($version)) {
|
||||||
$file = $this->get_upload_path($file_name, $version);
|
$file = $this->get_upload_path($file_name, $version);
|
||||||
if (is_file($file)) {
|
if (is_file($file)) {
|
||||||
|
|
|
||||||
|
|
@ -11,11 +11,12 @@
|
||||||
*/
|
*/
|
||||||
include_once("./_common.php");
|
include_once("./_common.php");
|
||||||
|
|
||||||
if( !function_exists('json_encode') ) {
|
if (!function_exists('json_encode')) {
|
||||||
@include_once("./JSON.php");
|
@include_once("./JSON.php");
|
||||||
function json_encode($data) {
|
function json_encode($data)
|
||||||
|
{
|
||||||
$json = new Services_JSON();
|
$json = new Services_JSON();
|
||||||
return( $json->encode($data) );
|
return ($json->encode($data));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -23,23 +24,23 @@ if( !function_exists('json_encode') ) {
|
||||||
|
|
||||||
$ym = date('ym', G5_SERVER_TIME);
|
$ym = date('ym', G5_SERVER_TIME);
|
||||||
|
|
||||||
$data_dir = G5_DATA_PATH.'/editor/'.$ym.'/';
|
$data_dir = G5_DATA_PATH . '/editor/' . $ym . '/';
|
||||||
$data_url = G5_DATA_URL.'/editor/'.$ym.'/';
|
$data_url = G5_DATA_URL . '/editor/' . $ym . '/';
|
||||||
|
|
||||||
@mkdir($data_dir, G5_DIR_PERMISSION);
|
@mkdir($data_dir, G5_DIR_PERMISSION);
|
||||||
@chmod($data_dir, G5_DIR_PERMISSION);
|
@chmod($data_dir, G5_DIR_PERMISSION);
|
||||||
|
|
||||||
if(!function_exists('ft_nonce_is_valid')){
|
if (!function_exists('ft_nonce_is_valid')) {
|
||||||
include_once('../../../editor.lib.php');
|
include_once('../../../editor.lib.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
$is_editor_upload = false;
|
$is_editor_upload = false;
|
||||||
|
|
||||||
if( isset($_GET['_nonce']) && ft_nonce_is_valid( $_GET['_nonce'] , 'smarteditor' ) ){
|
if (isset($_GET['_nonce']) && ft_nonce_is_valid($_GET['_nonce'], 'smarteditor')) {
|
||||||
$is_editor_upload = true;
|
$is_editor_upload = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( $is_editor_upload ) {
|
if ($is_editor_upload) {
|
||||||
|
|
||||||
run_event('smarteditor_photo_upload', $data_dir, $data_url);
|
run_event('smarteditor_photo_upload', $data_dir, $data_url);
|
||||||
|
|
||||||
|
|
@ -49,12 +50,12 @@ if( $is_editor_upload ) {
|
||||||
'upload_url' => $data_url,
|
'upload_url' => $data_url,
|
||||||
// This option will disable creating thumbnail images and will not create that extra folder.
|
// This option will disable creating thumbnail images and will not create that extra folder.
|
||||||
// However, due to this, the images preview will not be displayed after upload
|
// However, due to this, the images preview will not be displayed after upload
|
||||||
'image_versions' => array()
|
'image_versions' => []
|
||||||
);
|
);
|
||||||
|
|
||||||
$upload_handler = new UploadHandler($options);
|
$upload_handler = new UploadHandler($options);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
echo json_encode(array('files'=>array('0'=>array('error'=>'정상적인 업로드가 아닙니다.'))));
|
echo json_encode(array('files' => array('0' => array('error' => $_GET['_nonce']))));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.8 KiB |
|
|
@ -1,203 +0,0 @@
|
||||||
/*
|
|
||||||
A simple class for displaying file information and progress
|
|
||||||
Note: This is a demonstration only and not part of SWFUpload.
|
|
||||||
Note: Some have had problems adapting this class in IE7. It may not be suitable for your application.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Constructor
|
|
||||||
// file is a SWFUpload file object
|
|
||||||
// targetID is the HTML element id attribute that the FileProgress HTML structure will be added to.
|
|
||||||
// Instantiating a new FileProgress object with an existing file will reuse/update the existing DOM elements
|
|
||||||
function FileProgress(file, targetID) {
|
|
||||||
this.fileProgressID = file.id;
|
|
||||||
|
|
||||||
this.opacity = 100;
|
|
||||||
this.height = 0;
|
|
||||||
|
|
||||||
|
|
||||||
this.fileProgressWrapper = document.getElementById(this.fileProgressID);
|
|
||||||
if (!this.fileProgressWrapper) {
|
|
||||||
this.fileProgressWrapper = document.createElement("div");
|
|
||||||
this.fileProgressWrapper.className = "progressWrapper";
|
|
||||||
this.fileProgressWrapper.id = this.fileProgressID;
|
|
||||||
|
|
||||||
this.fileProgressElement = document.createElement("div");
|
|
||||||
this.fileProgressElement.className = "progressContainer";
|
|
||||||
|
|
||||||
var progressCancel = document.createElement("a");
|
|
||||||
progressCancel.className = "progressCancel";
|
|
||||||
progressCancel.href = "#";
|
|
||||||
progressCancel.style.visibility = "hidden";
|
|
||||||
progressCancel.appendChild(document.createTextNode(" "));
|
|
||||||
|
|
||||||
var progressText = document.createElement("div");
|
|
||||||
progressText.className = "progressName";
|
|
||||||
progressText.appendChild(document.createTextNode(file.name));
|
|
||||||
|
|
||||||
var progressBar = document.createElement("div");
|
|
||||||
progressBar.className = "progressBarInProgress";
|
|
||||||
|
|
||||||
var progressStatus = document.createElement("div");
|
|
||||||
progressStatus.className = "progressBarStatus";
|
|
||||||
progressStatus.innerHTML = " ";
|
|
||||||
|
|
||||||
this.fileProgressElement.appendChild(progressCancel);
|
|
||||||
this.fileProgressElement.appendChild(progressText);
|
|
||||||
this.fileProgressElement.appendChild(progressStatus);
|
|
||||||
this.fileProgressElement.appendChild(progressBar);
|
|
||||||
|
|
||||||
this.fileProgressWrapper.appendChild(this.fileProgressElement);
|
|
||||||
|
|
||||||
document.getElementById(targetID).appendChild(this.fileProgressWrapper);
|
|
||||||
} else {
|
|
||||||
this.fileProgressElement = this.fileProgressWrapper.firstChild;
|
|
||||||
this.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.height = this.fileProgressWrapper.offsetHeight;
|
|
||||||
this.setTimer(null);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
FileProgress.prototype.setTimer = function (timer) {
|
|
||||||
this.fileProgressElement["FP_TIMER"] = timer;
|
|
||||||
};
|
|
||||||
FileProgress.prototype.getTimer = function (timer) {
|
|
||||||
return this.fileProgressElement["FP_TIMER"] || null;
|
|
||||||
};
|
|
||||||
|
|
||||||
FileProgress.prototype.reset = function () {
|
|
||||||
this.fileProgressElement.className = "progressContainer";
|
|
||||||
|
|
||||||
this.fileProgressElement.childNodes[2].innerHTML = " ";
|
|
||||||
this.fileProgressElement.childNodes[2].className = "progressBarStatus";
|
|
||||||
|
|
||||||
this.fileProgressElement.childNodes[3].className = "progressBarInProgress";
|
|
||||||
this.fileProgressElement.childNodes[3].style.width = "0%";
|
|
||||||
|
|
||||||
this.appear();
|
|
||||||
};
|
|
||||||
|
|
||||||
FileProgress.prototype.setProgress = function (percentage) {
|
|
||||||
this.fileProgressElement.className = "progressContainer green";
|
|
||||||
this.fileProgressElement.childNodes[3].className = "progressBarInProgress";
|
|
||||||
this.fileProgressElement.childNodes[3].style.width = percentage + "%";
|
|
||||||
|
|
||||||
this.appear();
|
|
||||||
};
|
|
||||||
FileProgress.prototype.setComplete = function () {
|
|
||||||
this.fileProgressElement.className = "progressContainer blue";
|
|
||||||
this.fileProgressElement.childNodes[3].className = "progressBarComplete";
|
|
||||||
this.fileProgressElement.childNodes[3].style.width = "";
|
|
||||||
|
|
||||||
var oSelf = this;
|
|
||||||
this.setTimer(setTimeout(function () {
|
|
||||||
oSelf.disappear();
|
|
||||||
}, 10000));
|
|
||||||
};
|
|
||||||
FileProgress.prototype.setError = function () {
|
|
||||||
this.fileProgressElement.className = "progressContainer red";
|
|
||||||
this.fileProgressElement.childNodes[3].className = "progressBarError";
|
|
||||||
this.fileProgressElement.childNodes[3].style.width = "";
|
|
||||||
|
|
||||||
var oSelf = this;
|
|
||||||
this.setTimer(setTimeout(function () {
|
|
||||||
oSelf.disappear();
|
|
||||||
}, 5000));
|
|
||||||
};
|
|
||||||
FileProgress.prototype.setCancelled = function () {
|
|
||||||
this.fileProgressElement.className = "progressContainer";
|
|
||||||
this.fileProgressElement.childNodes[3].className = "progressBarError";
|
|
||||||
this.fileProgressElement.childNodes[3].style.width = "";
|
|
||||||
|
|
||||||
var oSelf = this;
|
|
||||||
this.setTimer(setTimeout(function () {
|
|
||||||
oSelf.disappear();
|
|
||||||
}, 2000));
|
|
||||||
};
|
|
||||||
FileProgress.prototype.setStatus = function (status) {
|
|
||||||
this.fileProgressElement.childNodes[2].innerHTML = status;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Show/Hide the cancel button
|
|
||||||
FileProgress.prototype.toggleCancel = function (show, swfUploadInstance) {
|
|
||||||
this.fileProgressElement.childNodes[0].style.visibility = show ? "visible" : "hidden";
|
|
||||||
if (swfUploadInstance) {
|
|
||||||
var fileID = this.fileProgressID;
|
|
||||||
this.fileProgressElement.childNodes[0].onclick = function () {
|
|
||||||
swfUploadInstance.cancelUpload(fileID);
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
FileProgress.prototype.appear = function () {
|
|
||||||
if (this.getTimer() !== null) {
|
|
||||||
clearTimeout(this.getTimer());
|
|
||||||
this.setTimer(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.fileProgressWrapper.filters) {
|
|
||||||
try {
|
|
||||||
this.fileProgressWrapper.filters.item("DXImageTransform.Microsoft.Alpha").opacity = 100;
|
|
||||||
} catch (e) {
|
|
||||||
// If it is not set initially, the browser will throw an error. This will set it if it is not set yet.
|
|
||||||
this.fileProgressWrapper.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=100)";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.fileProgressWrapper.style.opacity = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.fileProgressWrapper.style.height = "";
|
|
||||||
|
|
||||||
this.height = this.fileProgressWrapper.offsetHeight;
|
|
||||||
this.opacity = 100;
|
|
||||||
this.fileProgressWrapper.style.display = "";
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
// Fades out and clips away the FileProgress box.
|
|
||||||
FileProgress.prototype.disappear = function () {
|
|
||||||
|
|
||||||
var reduceOpacityBy = 15;
|
|
||||||
var reduceHeightBy = 4;
|
|
||||||
var rate = 30; // 15 fps
|
|
||||||
|
|
||||||
if (this.opacity > 0) {
|
|
||||||
this.opacity -= reduceOpacityBy;
|
|
||||||
if (this.opacity < 0) {
|
|
||||||
this.opacity = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.fileProgressWrapper.filters) {
|
|
||||||
try {
|
|
||||||
this.fileProgressWrapper.filters.item("DXImageTransform.Microsoft.Alpha").opacity = this.opacity;
|
|
||||||
} catch (e) {
|
|
||||||
// If it is not set initially, the browser will throw an error. This will set it if it is not set yet.
|
|
||||||
this.fileProgressWrapper.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=" + this.opacity + ")";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.fileProgressWrapper.style.opacity = this.opacity / 100;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.height > 0) {
|
|
||||||
this.height -= reduceHeightBy;
|
|
||||||
if (this.height < 0) {
|
|
||||||
this.height = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.fileProgressWrapper.style.height = this.height + "px";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.height > 0 || this.opacity > 0) {
|
|
||||||
var oSelf = this;
|
|
||||||
this.setTimer(setTimeout(function () {
|
|
||||||
oSelf.disappear();
|
|
||||||
}, rate));
|
|
||||||
} else {
|
|
||||||
this.fileProgressWrapper.style.display = "none";
|
|
||||||
this.setTimer(null);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
@ -1,378 +0,0 @@
|
||||||
/*
|
|
||||||
@author romeojks (romeojks@gmail.com)
|
|
||||||
@version 0.1
|
|
||||||
@brief 파일 업로드 관련
|
|
||||||
*/
|
|
||||||
|
|
||||||
function swfUploadPreLoad() {
|
|
||||||
var self = this;
|
|
||||||
var loading = function () {
|
|
||||||
document.getElementById("divLoadingContent").style.display = "";
|
|
||||||
|
|
||||||
var longLoad = function () {
|
|
||||||
document.getElementById("divLoadingContent").style.display = "none";
|
|
||||||
document.getElementById("divLongLoading").style.display = "";
|
|
||||||
};
|
|
||||||
this.customSettings.loadingTimeout = setTimeout(function () {
|
|
||||||
longLoad.call(self)
|
|
||||||
},
|
|
||||||
15 * 1000
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
this.customSettings.loadingTimeout = setTimeout(function () {
|
|
||||||
loading.call(self);
|
|
||||||
},
|
|
||||||
1*1000
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function swfUploadLoaded() {
|
|
||||||
var self = this;
|
|
||||||
clearTimeout(this.customSettings.loadingTimeout);
|
|
||||||
document.getElementById("divLoadingContent").style.display = "none";
|
|
||||||
document.getElementById("divLongLoading").style.display = "none";
|
|
||||||
document.getElementById("divAlternateContent").style.display = "none";
|
|
||||||
}
|
|
||||||
|
|
||||||
function swfUploadLoadFailed() {
|
|
||||||
clearTimeout(this.customSettings.loadingTimeout);
|
|
||||||
document.getElementById("divLoadingContent").style.display = "none";
|
|
||||||
document.getElementById("divLongLoading").style.display = "none";
|
|
||||||
document.getElementById("divAlternateContent").style.display = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
function fileQueued(file) {
|
|
||||||
try {
|
|
||||||
var obj = document.getElementById(this.customSettings.fileListAreaID);
|
|
||||||
var filename = file.name;
|
|
||||||
|
|
||||||
if (filename.length > 20) {
|
|
||||||
filename = filename.substr(0,20) + "...";
|
|
||||||
};
|
|
||||||
|
|
||||||
var text = filename + " (대기중...)";
|
|
||||||
var value = last_bf_no + file.index;
|
|
||||||
var opt_obj = new Option(text, value, true, true);
|
|
||||||
obj.options[obj.options.length] = opt_obj;
|
|
||||||
} catch (ex) {
|
|
||||||
this.debug(ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function fileQueueError(file, errorCode, message) {
|
|
||||||
try {
|
|
||||||
switch (errorCode) {
|
|
||||||
case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED :
|
|
||||||
alert(message == 0 ? "더이상 업로드 할 수 없습니다." : (message == file_upload_limit ? file_upload_limit + "개 까지만 업로드 할 수 있습니다." : file_upload_limit + "개 까지만 업로드 할 수 있습니다.\n\n" + "현재 " + message + "개 남았습니다."));
|
|
||||||
break;
|
|
||||||
case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT :
|
|
||||||
alert("업로드 가능한 파일 용량(" + file_size_limit + ")을 초과했습니다.\n\n" + "File name: " + file.name + ", File size: " + getfilesize(file.size));
|
|
||||||
break;
|
|
||||||
case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE :
|
|
||||||
alert("파일 사이즈가 '0' 입니다.\n\n" + "File name: " + file.name + ", File size: " + getfilesize(file.size));
|
|
||||||
break;
|
|
||||||
case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE :
|
|
||||||
alert("파일 타입이 올바르지 않습니다.\n\n" + "File name: " + file.name + ", File size: " + getfilesize(file.size));
|
|
||||||
break;
|
|
||||||
default :
|
|
||||||
alert("Error Code: " + errorCode + ", File name: " + file.name + ", File size: " + getfilesize(file.size) + ", Message: " + message);
|
|
||||||
break;
|
|
||||||
};
|
|
||||||
} catch (ex) {
|
|
||||||
this.debug(ex);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function fileDialogComplete(numFilesSelected, numFilesQueued) {
|
|
||||||
try {
|
|
||||||
this.startUpload();
|
|
||||||
} catch (ex) {
|
|
||||||
this.debug(ex);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function uploadStart(file) {
|
|
||||||
try {
|
|
||||||
if ((sum_filesize + file.size) > getfilesize1(file_allsize_limit)) {
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
} catch (ex) {
|
|
||||||
this.debug(ex);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function uploadProgress(file, bytesLoaded, bytesTotal) {
|
|
||||||
try {
|
|
||||||
var obj = document.getElementById(this.customSettings.fileListAreaID);
|
|
||||||
var percent = Math.ceil((bytesLoaded / bytesTotal) * 100);
|
|
||||||
var filename = file.name;
|
|
||||||
|
|
||||||
if (filename.length > 20) {
|
|
||||||
filename = filename.substr(0,20) + "...";
|
|
||||||
};
|
|
||||||
|
|
||||||
var text = filename + " (" + percent + " %)";
|
|
||||||
var bf_position = last_bf_no + file.index;
|
|
||||||
|
|
||||||
obj.options[bf_position].text = text;
|
|
||||||
} catch (ex) {
|
|
||||||
this.debug(ex);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function uploadSuccess(file, serverData) {
|
|
||||||
try {
|
|
||||||
var obj = document.getElementById(this.customSettings.fileListAreaID);
|
|
||||||
var bf_position = last_bf_no + file.index;
|
|
||||||
var params = {
|
|
||||||
"bo_table" : bo_table,
|
|
||||||
"wr_id" : wr_id,
|
|
||||||
"w" : w,
|
|
||||||
"bf_position" : bf_position+1
|
|
||||||
};
|
|
||||||
|
|
||||||
var url = swfupload_path + "/get_file_info.php";
|
|
||||||
$.ajax({
|
|
||||||
type: 'post',
|
|
||||||
url: url,
|
|
||||||
data: params,
|
|
||||||
success : after_upload_success = function(req) {
|
|
||||||
var file = eval('('+req+')');
|
|
||||||
var file_size = (file.bf_filesize / 1024).toFixed(1);
|
|
||||||
var text = file.bf_source + " (" + getfilesize(file.bf_filesize) + ")";
|
|
||||||
var value = file.bf_no + "|" + file.bf_source + "|" + file.bf_file + "|" + file.bf_filesize + "|" + file.bf_width + "|" + file.bf_type;
|
|
||||||
obj.options[bf_position].text = text;
|
|
||||||
obj.options[bf_position].value = value;
|
|
||||||
eval("preview(file.bf_file)");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
sum_filesize = sum_filesize + file.size;
|
|
||||||
document.getElementById("uploader_status").innerHTML = "문서첨부제한 : " + getfilesize(sum_filesize) + " / " + file_allsize_limit + "<br />파일제한크기 : " + file_size_limit + " (허용확장자 : " + file_types_description + ")";
|
|
||||||
} catch (ex) {
|
|
||||||
this.debug(ex);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function uploadError(file, errorCode, message) {
|
|
||||||
try {
|
|
||||||
switch (errorCode) {
|
|
||||||
case SWFUpload.UPLOAD_ERROR.HTTP_ERROR :
|
|
||||||
alert("네트워크 에러가 발생하였습니다. 관리자에게 문의하세요.\n\n" + "File name: " + file.name);
|
|
||||||
break;
|
|
||||||
case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED :
|
|
||||||
alert("파일 업로드가 실패하였습니다.\n\n" + "File name: " + file.name + ", File size: " + getfilesize(file.size));
|
|
||||||
break;
|
|
||||||
case SWFUpload.UPLOAD_ERROR.IO_ERROR :
|
|
||||||
alert("입출력 에러가 발생하였습니다.\n\n" + "다른 프로그램에서 이 파일(" + file.name + ")을 사용중인지 확인하세요.");
|
|
||||||
break;
|
|
||||||
case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR :
|
|
||||||
alert("보안 에러가 발생하였습니다. 관리자에게 문의하세요.\n\n" + "File name: " + file.name);
|
|
||||||
break;
|
|
||||||
case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED :
|
|
||||||
alert("업로드 가능한 파일 용량(" + file_size_limit + ")을 초과했습니다.\n\n" + "File name: " + file.name + ", File size: " + getfilesize(file.size));
|
|
||||||
break;
|
|
||||||
case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED :
|
|
||||||
alert("업로드 가능한 총파일 용량(" + file_allsize_limit + ")을 초과했습니다.\n\n" + "File name: " + file.name + ", File size: " + getfilesize(file.size));
|
|
||||||
break;
|
|
||||||
case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED :
|
|
||||||
// If there aren't any files left (they were all cancelled) disable the cancel button
|
|
||||||
if (this.getStats().files_queued === 0) {
|
|
||||||
document.getElementById(this.customSettings.cancelButtonId).disabled = true;
|
|
||||||
};
|
|
||||||
break;
|
|
||||||
case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED :
|
|
||||||
break;
|
|
||||||
default :
|
|
||||||
alert("Error Code: " + errorCode + ", File name: " + file.name + ", File size: " + getfilesize(file.size) + ", Message: " + message);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} catch (ex) {
|
|
||||||
this.debug(ex);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function uploadComplete(file) {
|
|
||||||
/*if (this.getStats().files_queued === 0) {
|
|
||||||
document.getElementById(this.customSettings.cancelButtonId).disabled = true;
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
|
|
||||||
function getfilesize(size) {
|
|
||||||
if (!size) {
|
|
||||||
return "0 Byte";
|
|
||||||
};
|
|
||||||
if (size < 1024) {
|
|
||||||
return (size + " Byte");
|
|
||||||
} else if (size > 1024 && size < 1024 *1024) {
|
|
||||||
return (size / 1024).toFixed(1) + " KB";
|
|
||||||
} else {
|
|
||||||
return (size / (1024*1024)).toFixed(2) + " MB";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function getfilesize1(size) {
|
|
||||||
var file_size = size.split(" ");
|
|
||||||
if (!file_size[0]) {
|
|
||||||
return 0;
|
|
||||||
};
|
|
||||||
if (file_size[1] == "MB") {
|
|
||||||
return (file_size[0] * (1024*1024));
|
|
||||||
} else if (file_size[1] == "KB") {
|
|
||||||
return (file_size[0] * 1024);
|
|
||||||
} else {
|
|
||||||
return (file_size[0]);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function delete_file() {
|
|
||||||
try {
|
|
||||||
var obj = document.getElementById("uploaded_file_list");
|
|
||||||
var url = swfupload_path + "/file_delete.php";
|
|
||||||
for (var i=0; i<obj.options.length; i++) {
|
|
||||||
if (obj.options[i].selected == true) {
|
|
||||||
var file = get_file_info(obj.options[i].value);
|
|
||||||
var params = {
|
|
||||||
"bo_table" : bo_table,
|
|
||||||
"wr_id" : wr_id,
|
|
||||||
"bf_no" : file.bf_no,
|
|
||||||
"w" : w,
|
|
||||||
"board_file_path" : board_file_path
|
|
||||||
};
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
type: 'post',
|
|
||||||
url: url,
|
|
||||||
data: params,
|
|
||||||
success : eval("delete_file_complete")
|
|
||||||
});
|
|
||||||
|
|
||||||
sum_filesize = sum_filesize - file.bf_filesize;
|
|
||||||
document.getElementById("uploader_status").innerHTML = "문서첨부제한 : " + getfilesize(sum_filesize) + " / " + file_allsize_limit + "<br />파일제한크기 : " + file_size_limit + " (허용확장자 : " + file_types_description + ")";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
} catch (ex) {
|
|
||||||
this.debug(ex);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function delete_file_complete() {
|
|
||||||
try {
|
|
||||||
var obj = document.getElementById("uploaded_file_list");
|
|
||||||
for (var i=0; i<obj.options.length; i++) {
|
|
||||||
if (obj.options[i].selected == true) {
|
|
||||||
op = obj.options[i];
|
|
||||||
obj.removeChild(op);
|
|
||||||
last_bf_no--;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
if (obj.options.length) {
|
|
||||||
obj.options[obj.options.length-1].selected = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
eval("preview()");
|
|
||||||
} catch (ex) {
|
|
||||||
this.debug(ex);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function preview(thumb) {
|
|
||||||
try {
|
|
||||||
if (!thumb) {
|
|
||||||
var file = get_file_info(document.getElementById("uploaded_file_list").value);
|
|
||||||
var thumb = file.bf_file;
|
|
||||||
}
|
|
||||||
|
|
||||||
var pattern = /\.(jpg|png|gif|webp)$/i;
|
|
||||||
if (pattern.test(thumb)) {
|
|
||||||
var thumb_kind = "img";
|
|
||||||
} else {
|
|
||||||
var thumb_kind = "etc";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (thumb && thumb_kind == "img") {
|
|
||||||
document.getElementById("image_preview").innerHTML = "<img src=" + board_file_path + "/" + thumb + " width=" + thumb_width + " height=" + thumb_height + ">";
|
|
||||||
} else if (thumb && thumb_kind == "etc") {
|
|
||||||
document.getElementById("image_preview").innerHTML = "<img src=" + board_skin_path + "/img/icon_etc.gif" + " width=" + thumb_width + " height=" + thumb_height + ">";
|
|
||||||
} else {
|
|
||||||
document.getElementById("image_preview").innerHTML = "미리보기";
|
|
||||||
};
|
|
||||||
} catch (ex) {
|
|
||||||
this.debug(ex);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function file_to_editor() {
|
|
||||||
try {
|
|
||||||
var files_list = document.getElementById("uploaded_file_list");
|
|
||||||
var html = '';
|
|
||||||
|
|
||||||
if (!files_list.value) {
|
|
||||||
alert('파일을 선택해주세요.');
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
|
|
||||||
for (var i=0; i<files_list.options.length; i++) {
|
|
||||||
if (files_list.options[i].selected == true) {
|
|
||||||
var file = get_file_info(files_list.options[i].value);
|
|
||||||
var path = board_file_path + '/' + file.bf_file;
|
|
||||||
|
|
||||||
var pattern = /\.(jpg|png|gif|webp)$/i;
|
|
||||||
if (pattern.test(file.bf_file)) {
|
|
||||||
if (wr_id) {
|
|
||||||
html = "{이미지:" + file.bf_no + "}";
|
|
||||||
} else {
|
|
||||||
html = "{이미지:" + i + "}";
|
|
||||||
}
|
|
||||||
html2 = "<img src='"+path+"'>";
|
|
||||||
} else {
|
|
||||||
alert("이미지만 삽입 할 수 있습니다.");
|
|
||||||
//path = "download.php?bo_table=" + bo_table + "&filename=" + file.bf_file + "&filesource=" + file.bf_source + "";
|
|
||||||
//html += "<a href=\"" + path + "\">" + file.bf_source + "</a><br/>\n";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
insert_editor(html2);
|
|
||||||
} catch (ex) {
|
|
||||||
this.debug(ex);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function insert_editor(html) {
|
|
||||||
try {
|
|
||||||
ed_wr_content.insertContents(html);
|
|
||||||
/*
|
|
||||||
if (typeof(ed_wr_content) != "undefined")
|
|
||||||
if (geditor_wr_content.get_mode() == "WYSIWYG") {
|
|
||||||
document.getElementById("geditor_wr_content_frame").contentWindow.document.body.focus();
|
|
||||||
geditor_wr_content.get_range();
|
|
||||||
html = html + "<br />";
|
|
||||||
} else if (geditor_wr_content.get_mode() == "TEXT") {
|
|
||||||
html = html + "\n";
|
|
||||||
} else {
|
|
||||||
html = html + "<br />";
|
|
||||||
}
|
|
||||||
geditor_wr_content.insert_editor(html);
|
|
||||||
} else {
|
|
||||||
document.getElementById("wr_content").value += html + "\n";
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
} catch (ex) {
|
|
||||||
this.debug(ex);
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_file_info(val) {
|
|
||||||
try {
|
|
||||||
var arr = val.split('|');
|
|
||||||
var ret = {"bf_no":arr[0], "bf_source":arr[1], "bf_file":arr[2], "bf_filesize":arr[3], "bf_width":arr[4], "bf_type":arr[5]};
|
|
||||||
return ret;
|
|
||||||
} catch (ex) {
|
|
||||||
this.debug(ex);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,82 +0,0 @@
|
||||||
/*
|
|
||||||
* SWFUpload jQuery Plugin v1.0.0
|
|
||||||
*
|
|
||||||
* Copyright (c) 2009 Adam Royle
|
|
||||||
* Licensed under the MIT license.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
(function($){
|
|
||||||
|
|
||||||
var defaultHandlers = [
|
|
||||||
'swfupload_preload_handler',
|
|
||||||
'swfupload_load_failed_handler',
|
|
||||||
'swfupload_loaded_handler',
|
|
||||||
'file_dialog_start_handler',
|
|
||||||
'file_queued_handler',
|
|
||||||
'file_queue_error_handler',
|
|
||||||
'file_dialog_complete_handler',
|
|
||||||
'upload_resize_start_handler',
|
|
||||||
'upload_start_handler',
|
|
||||||
'upload_progress_handler',
|
|
||||||
'upload_error_handler',
|
|
||||||
'upload_success_handler',
|
|
||||||
'upload_complete_handler',
|
|
||||||
'mouse_click_handler',
|
|
||||||
'mouse_out_handler',
|
|
||||||
'mouse_over_handler',
|
|
||||||
'queue_complete_handler'
|
|
||||||
];
|
|
||||||
var additionalHandlers = [];
|
|
||||||
|
|
||||||
$.fn.swfupload = function(){
|
|
||||||
var args = $.makeArray(arguments);
|
|
||||||
return this.each(function(){
|
|
||||||
var swfu;
|
|
||||||
if (args.length == 1 && typeof(args[0]) == 'object') {
|
|
||||||
swfu = $(this).data('__swfu');
|
|
||||||
if (!swfu) {
|
|
||||||
var settings = args[0];
|
|
||||||
var $magicUploadControl = $(this);
|
|
||||||
var handlers = [];
|
|
||||||
$.merge(handlers, defaultHandlers);
|
|
||||||
$.merge(handlers, additionalHandlers);
|
|
||||||
$.each(handlers, function(i, v){
|
|
||||||
var eventName = v.replace(/_handler$/, '').replace(/_([a-z])/g, function(){ return arguments[1].toUpperCase(); });
|
|
||||||
settings[v] = function() {
|
|
||||||
var event = $.Event(eventName);
|
|
||||||
$magicUploadControl.trigger(event, $.makeArray(arguments));
|
|
||||||
return !event.isDefaultPrevented();
|
|
||||||
};
|
|
||||||
});
|
|
||||||
$(this).data('__swfu', new SWFUpload(settings));
|
|
||||||
}
|
|
||||||
} else if (args.length > 0 && typeof(args[0]) == 'string') {
|
|
||||||
var methodName = args.shift();
|
|
||||||
swfu = $(this).data('__swfu');
|
|
||||||
if (swfu && swfu[methodName]) {
|
|
||||||
swfu[methodName].apply(swfu, args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
$.swfupload = {
|
|
||||||
additionalHandlers: function() {
|
|
||||||
if (arguments.length === 0) {
|
|
||||||
return additionalHandlers.slice();
|
|
||||||
} else {
|
|
||||||
$(arguments).each(function(i, v){
|
|
||||||
$.merge(additionalHandlers, $.makeArray(v));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
defaultHandlers: function() {
|
|
||||||
return defaultHandlers.slice();
|
|
||||||
},
|
|
||||||
getInstance: function(el) {
|
|
||||||
return $(el).data('__swfu');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
})(jQuery);
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,99 +0,0 @@
|
||||||
/*
|
|
||||||
Queue Plug-in
|
|
||||||
|
|
||||||
Features:
|
|
||||||
*Adds a cancelQueue() method for cancelling the entire queue.
|
|
||||||
*All queued files are uploaded when startUpload() is called.
|
|
||||||
*If false is returned from uploadComplete then the queue upload is stopped.
|
|
||||||
If false is not returned (strict comparison) then the queue upload is continued.
|
|
||||||
*Adds a QueueComplete event that is fired when all the queued files have finished uploading.
|
|
||||||
Set the event handler with the queue_complete_handler setting.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
var SWFUpload;
|
|
||||||
if (typeof(SWFUpload) === "function") {
|
|
||||||
SWFUpload.queue = {};
|
|
||||||
|
|
||||||
SWFUpload.prototype.initSettings = (function (oldInitSettings) {
|
|
||||||
return function () {
|
|
||||||
if (typeof(oldInitSettings) === "function") {
|
|
||||||
oldInitSettings.call(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.queueSettings = {};
|
|
||||||
|
|
||||||
this.queueSettings.queue_cancelled_flag = false;
|
|
||||||
this.queueSettings.queue_upload_count = 0;
|
|
||||||
|
|
||||||
this.queueSettings.user_upload_complete_handler = this.settings.upload_complete_handler;
|
|
||||||
this.queueSettings.user_upload_start_handler = this.settings.upload_start_handler;
|
|
||||||
this.settings.upload_complete_handler = SWFUpload.queue.uploadCompleteHandler;
|
|
||||||
this.settings.upload_start_handler = SWFUpload.queue.uploadStartHandler;
|
|
||||||
|
|
||||||
this.settings.queue_complete_handler = this.settings.queue_complete_handler || null;
|
|
||||||
};
|
|
||||||
})(SWFUpload.prototype.initSettings);
|
|
||||||
|
|
||||||
SWFUpload.prototype.startUpload = function (fileID) {
|
|
||||||
this.queueSettings.queue_cancelled_flag = false;
|
|
||||||
this.callFlash("StartUpload", [fileID]);
|
|
||||||
};
|
|
||||||
|
|
||||||
SWFUpload.prototype.cancelQueue = function () {
|
|
||||||
this.queueSettings.queue_cancelled_flag = true;
|
|
||||||
this.stopUpload();
|
|
||||||
|
|
||||||
var stats = this.getStats();
|
|
||||||
while (stats.files_queued > 0) {
|
|
||||||
this.cancelUpload();
|
|
||||||
stats = this.getStats();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
SWFUpload.queue.uploadStartHandler = function (file) {
|
|
||||||
var returnValue;
|
|
||||||
if (typeof(this.queueSettings.user_upload_start_handler) === "function") {
|
|
||||||
returnValue = this.queueSettings.user_upload_start_handler.call(this, file);
|
|
||||||
}
|
|
||||||
|
|
||||||
// To prevent upload a real "FALSE" value must be returned, otherwise default to a real "TRUE" value.
|
|
||||||
returnValue = (returnValue === false) ? false : true;
|
|
||||||
|
|
||||||
this.queueSettings.queue_cancelled_flag = !returnValue;
|
|
||||||
|
|
||||||
return returnValue;
|
|
||||||
};
|
|
||||||
|
|
||||||
SWFUpload.queue.uploadCompleteHandler = function (file) {
|
|
||||||
var user_upload_complete_handler = this.queueSettings.user_upload_complete_handler;
|
|
||||||
var continueUpload;
|
|
||||||
|
|
||||||
if (file.filestatus === SWFUpload.FILE_STATUS.COMPLETE) {
|
|
||||||
this.queueSettings.queue_upload_count++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof(user_upload_complete_handler) === "function") {
|
|
||||||
continueUpload = (user_upload_complete_handler.call(this, file) === false) ? false : true;
|
|
||||||
} else if (file.filestatus === SWFUpload.FILE_STATUS.QUEUED) {
|
|
||||||
// If the file was stopped and re-queued don't restart the upload
|
|
||||||
continueUpload = false;
|
|
||||||
} else {
|
|
||||||
continueUpload = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (continueUpload) {
|
|
||||||
var stats = this.getStats();
|
|
||||||
if (stats.files_queued > 0 && this.queueSettings.queue_cancelled_flag === false) {
|
|
||||||
this.startUpload();
|
|
||||||
} else if (this.queueSettings.queue_cancelled_flag === false) {
|
|
||||||
console.debug('ydfsdfgsdfgsdfg');
|
|
||||||
this.queueEvent("queue_complete_handler", [this.queueSettings.queue_upload_count]);
|
|
||||||
this.queueSettings.queue_upload_count = 0;
|
|
||||||
} else {
|
|
||||||
this.queueSettings.queue_cancelled_flag = false;
|
|
||||||
this.queueSettings.queue_upload_count = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
Binary file not shown.
Loading…
Reference in a new issue