update smarteditor

This commit is contained in:
Amberstone 2024-09-22 15:53:38 +09:00
parent 3302649c3c
commit 6145459b5d
Signed by: amber
GPG key ID: 094B0E55F98D8BF1
37 changed files with 6429 additions and 7953 deletions

View file

@ -1,10 +1,8 @@
function get_editor_wr_content()
{
function get_editor_wr_content() {
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_IR", [""]);
oEditors.getById["wr_content"].exec("PASTE_HTML", [content]);

View file

@ -12,7 +12,7 @@
bUseVerticalResizer: true,
bUseModeChanger: true,
bSkipXssFilter: true,
aAdditionalFontList : editorAdditionalFontList,
aAdditionalFontList: editorAdditionalFontList,
fOnBeforeUnload: function () {
// unload
}

View file

@ -30,7 +30,7 @@ function editor_html($id, $content, $is_dhtml_editor = true)
if ($is_dhtml_editor && $js) {
$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";
$result = sql_query($sql);

View file

@ -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
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 = {};
/**
* @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
*/
nhn.husky.EZCreator = new (function(){
nhn.husky.EZCreator = new (function () {
this.nBlockerCount = 0;
this.createInIFrame = function(htOptions){
if(arguments.length == 1){
this.createInIFrame = function (htOptions) {
if (arguments.length == 1) {
var oAppRef = htOptions.oAppRef;
var elPlaceHolder = htOptions.elPlaceHolder;
var sSkinURI = htOptions.sSkinURI;
@ -34,7 +34,7 @@ nhn.husky.EZCreator = new (function(){
var fOnAppLoad = htOptions.fOnAppLoad;
var bUseBlocker = htOptions.bUseBlocker;
var htParams = htOptions.htParams || null;
}else{
} else {
// for backward compatibility only
var oAppRef = arguments[0];
var elPlaceHolder = arguments[1];
@ -45,30 +45,30 @@ nhn.husky.EZCreator = new (function(){
var htParams = arguments[6];
}
if(bUseBlocker) nhn.husky.EZCreator.showBlocker();
if (bUseBlocker) nhn.husky.EZCreator.showBlocker();
var attachEvent = function(elNode, sEvent, fHandler){
if(elNode.addEventListener){
var attachEvent = function (elNode, sEvent, fHandler) {
if (elNode.addEventListener) {
elNode.addEventListener(sEvent, fHandler, false);
}else{
elNode.attachEvent("on"+sEvent, fHandler);
} else {
elNode.attachEvent("on" + sEvent, fHandler);
}
}
if(!elPlaceHolder){
if (!elPlaceHolder) {
alert("Placeholder is required!");
return;
}
if(typeof(elPlaceHolder) != "object")
if (typeof (elPlaceHolder) != "object")
elPlaceHolder = document.getElementById(elPlaceHolder);
var elIFrame, nEditorWidth, nEditorHeight;
try{
try {
elIFrame = document.createElement("<IFRAME frameborder=0 scrolling=no>");
}catch(e){
} catch (e) {
elIFrame = document.createElement("IFRAME");
elIFrame.setAttribute("frameborder", "0");
elIFrame.setAttribute("scrolling", "no");
@ -78,25 +78,25 @@ nhn.husky.EZCreator = new (function(){
elIFrame.style.height = "1px";
elPlaceHolder.parentNode.insertBefore(elIFrame, elPlaceHolder.nextSibling);
attachEvent(elIFrame, "load", function(){
attachEvent(elIFrame, "load", function () {
fCreator = elIFrame.contentWindow[fCreator] || elIFrame.contentWindow.createSEditor2;
// top.document.title = ((new Date())-window.STime);
// window.STime = new Date();
// top.document.title = ((new Date())-window.STime);
// window.STime = new Date();
try{
try {
nEditorWidth = elIFrame.contentWindow.document.body.scrollWidth || "500px";
nEditorHeight = elIFrame.contentWindow.document.body.scrollHeight + 12;
elIFrame.style.width = "100%";
elIFrame.style.height = nEditorHeight+ "px";
elIFrame.style.height = nEditorHeight + "px";
elIFrame.contentWindow.document.body.style.margin = "0";
}catch(e){
} catch (e) {
nhn.husky.EZCreator.hideBlocker(true);
elIFrame.style.border = "5px solid red";
elIFrame.style.width = "500px";
elIFrame.style.height = "500px";
alert("Failed to access "+sSkinURI);
alert("Failed to access " + sSkinURI);
return;
}
@ -106,22 +106,22 @@ nhn.husky.EZCreator = new (function(){
oApp.elPlaceHolder = elPlaceHolder;
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();
});
// window.STime = new Date();
// window.STime = new Date();
elIFrame.src = sSkinURI;
this.elIFrame = elIFrame;
};
this.showBlocker = function(){
if(this.nBlockerCount<1){
this.showBlocker = function () {
if (this.nBlockerCount < 1) {
var elBlocker = document.createElement("DIV");
elBlocker.style.position = "absolute";
elBlocker.style.top = 0;
@ -134,18 +134,18 @@ nhn.husky.EZCreator = new (function(){
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.hideBlocker = function(bForce){
if(!bForce){
if(--this.nBlockerCount > 0) return;
this.hideBlocker = function (bForce) {
if (!bForce) {
if (--this.nBlockerCount > 0) return;
}
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";
}
})();

View file

@ -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
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
function createSEditor2(elIRField, htParams, elSeAppContainer){
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 는 지원하지 않습니다.)";
function createSEditor2(elIRField, htParams, elSeAppContainer) {
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 는 지원하지 않습니다.)";
return;
}
var elAppContainer = (elSeAppContainer || jindo.$("smart_editor2"));
var elEditingArea = jindo.$$.getSingle("DIV.husky_seditor_editing_area_container", elAppContainer);
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 oTextArea = jindo.$$.getSingle("TEXTAREA.se2_input_text", elEditingArea);
if(!htParams){
if (!htParams) {
htParams = {};
htParams.fOnBeforeUnload = null;
}
@ -37,32 +37,32 @@ function createSEditor2(elIRField, htParams, elSeAppContainer){
htParams.I18N_LOCALE = htParams.I18N_LOCALE || "ko_KR";
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());
if(htParams.bSkipXssFilter !== true){
if (htParams.bSkipXssFilter !== true) {
// 보안 필터링 플러그인 (TODO:소스분리 및 블랙리스트 옵션 추가)
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,
$ON_REGISTER_CONVERTERS : function() {
var fXssFilter = jindo.$Fn(function(sHtml){
_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 () {
var fXssFilter = jindo.$Fn(function (sHtml) {
return sHtml.replace(this._rxFilter, "");
}, this).bind();
this.oApp.exec("ADD_CONVERTER",["HTMLSrc_TO_IR", fXssFilter]);
this.oApp.exec("ADD_CONVERTER",["IR_TO_DB", fXssFilter]);
this.oApp.exec("ADD_CONVERTER", ["HTMLSrc_TO_IR", fXssFilter]);
this.oApp.exec("ADD_CONVERTER", ["IR_TO_DB", fXssFilter]);
}
});
}
var htDimension = {
nMinHeight:205,
nMinWidth:parseInt(elIRField.style.minWidth, 10)||570,
nHeight:elIRField.style.height||elIRField.offsetHeight,
nWidth:elIRField.style.width||elIRField.offsetWidth
nMinHeight: 205,
nMinWidth: parseInt(elIRField.style.minWidth, 10) || 570,
nHeight: elIRField.style.height || elIRField.offsetHeight,
nWidth: elIRField.style.width || elIRField.offsetWidth
};
var htConversionMode = {
bUseVerticalResizer : htParams.bUseVerticalResizer,
bUseModeChanger : htParams.bUseModeChanger
bUseVerticalResizer: htParams.bUseVerticalResizer,
bUseModeChanger: htParams.bUseModeChanger
};
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_TableEditor(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)); // 사진
}
@ -113,7 +113,7 @@ function createSEditor2(elIRField, htParams, elSeAppContainer){
oEditor.registerPlugin(new nhn.husky.SE2M_QuickEditor_Common(elAppContainer)); // 퀵에디터 공통(표, 이미지)
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));
}

View file

@ -26,17 +26,17 @@ nhn.husky.SE2M_Configuration = nhn.husky.SE2M_Configuration || {};
* CSS LazyLoad를 위한 경로
*/
nhn.husky.SE2M_Configuration.SE2B_CSSLoader = {
sCSSBaseURI : "css"
sCSSBaseURI: "css"
};
/**
* 편집영역 설정
*/
nhn.husky.SE2M_Configuration.SE_EditingAreaManager = {
sCSSBaseURI : "css", // smart_editor2_inputarea.html 파일의 상대경로
sBlankPageURL : "smart_editor2_inputarea.html",
sBlankPageURL_EmulateIE7 : "smart_editor2_inputarea_ie8.html",
aAddtionalEmulateIE7 : [] // IE8 default 사용, IE9 ~ 선택적 사용
sCSSBaseURI: "css", // smart_editor2_inputarea.html 파일의 상대경로
sBlankPageURL: "smart_editor2_inputarea.html",
sBlankPageURL_EmulateIE7: "smart_editor2_inputarea_ie8.html",
aAddtionalEmulateIE7: [] // IE8 default 사용, IE9 ~ 선택적 사용
};
/**
@ -49,37 +49,37 @@ nhn.husky.SE2M_Configuration.SE_EditingAreaManager = {
* sTitleElementId : 제목에 해당하는 input 요소의 id.
*/
nhn.husky.SE2M_Configuration.SE2M_Accessibility = {
ed_nonce : (typeof parent.ed_nonce !='undefined') ? parent.ed_nonce : '',
sBeforeElementId : '',
sNextElementId : '',
sTitleElementId : ''
ed_nonce: (typeof parent.ed_nonce != 'undefined') ? parent.ed_nonce : '',
sBeforeElementId: '',
sNextElementId: '',
sTitleElementId: ''
};
/**
* 링크 기능 옵션
*/
nhn.husky.SE2M_Configuration.SE2M_Hyperlink = {
bAutolink : true // 자동링크기능 사용여부(기본값:true)
bAutolink: true // 자동링크기능 사용여부(기본값:true)
};
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 = {
bUseRecentColor : false
bUseRecentColor: false
};
nhn.husky.SE2B_Customize_ToolBar = jindo.$Class(/** @lends nhn.husky.SE2B_Customize_ToolBar */{
name : "SE2B_Customize_ToolBar",
name: "SE2B_Customize_ToolBar",
/**
* @constructs
* @param {Object} oAppContainer 에디터를 구성하는 컨테이너
*/
$init : function(oAppContainer) {
$init: function (oAppContainer) {
this._assignHTMLElements(oAppContainer);
},
$BEFORE_MSG_APP_READY : function(){
$BEFORE_MSG_APP_READY: function () {
this._addEventMoreButton();
},
@ -88,7 +88,7 @@ nhn.husky.SE2B_Customize_ToolBar = jindo.$Class(/** @lends nhn.husky.SE2B_Custom
* @description DOM엘리먼트를 수집하는 메소드
* @param {Object} oAppContainer 툴바 포함 에디터를 감싸고 있는 div 엘리먼트
*/
_assignHTMLElements : function(oAppContainer) {
_assignHTMLElements: function (oAppContainer) {
this.oAppContainer = oAppContainer;
this.elTextToolBarArea = jindo.$$.getSingle("div.se2_tool");
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");
},
_addEventMoreButton : function (){
_addEventMoreButton: function () {
this.oApp.registerBrowserEvent(this.elTextMoreButton, "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]);
weEvent.stop();
},
$ON_TOGGLE_EXPAND_VIEW : function(){
if(!this.welTextMoreButtonParent.hasClass("active")){
$ON_TOGGLE_EXPAND_VIEW: function () {
if (!this.welTextMoreButtonParent.hasClass("active")) {
this.oApp.exec("SHOW_EXPAND_VIEW");
} else {
this.oApp.exec("HIDE_EXPAND_VIEW");
}
},
$ON_CHANGE_EDITING_MODE : function(sMode){
if(sMode != "WYSIWYG"){
this.elTextMoreButton.disabled =true;
$ON_CHANGE_EDITING_MODE: function (sMode) {
if (sMode != "WYSIWYG") {
this.elTextMoreButton.disabled = true;
this.welTextMoreButtonParent.removeClass("active");
this.oApp.exec("HIDE_EXPAND_VIEW");
}else{
this.elTextMoreButton.disabled =false;
} else {
this.elTextMoreButton.disabled = false;
}
},
$AFTER_SHOW_ACTIVE_LAYER : function(){
$AFTER_SHOW_ACTIVE_LAYER: function () {
this.oApp.exec("HIDE_EXPAND_VIEW");
},
$AFTER_SHOW_DIALOG_LAYER : function(){
$AFTER_SHOW_DIALOG_LAYER: function () {
this.oApp.exec("HIDE_EXPAND_VIEW");
},
$ON_SHOW_EXPAND_VIEW : function(){
$ON_SHOW_EXPAND_VIEW: function () {
this.welTextMoreButtonParent.addClass("active");
this.elMoreLayer.style.display = "block";
},
$ON_HIDE_EXPAND_VIEW : function(){
$ON_HIDE_EXPAND_VIEW: function () {
this.welTextMoreButtonParent.removeClass("active");
this.elMoreLayer.style.display = "none";
},
@ -147,8 +147,8 @@ nhn.husky.SE2B_Customize_ToolBar = jindo.$Class(/** @lends nhn.husky.SE2B_Custom
* CHANGE_EDITING_MODE모드 이후에 호출되어야 .
* WYSIWYG 모드가 활성화되기 전에 호출이 되면 APPLY_FONTCOLOR에서 에러 발생.
*/
$ON_RESET_TOOLBAR : function(){
if(this.oApp.getEditingMode() !== "WYSIWYG"){
$ON_RESET_TOOLBAR: function () {
if (this.oApp.getEditingMode() !== "WYSIWYG") {
return;
}
//스펠체크 닫기

View file

@ -27,10 +27,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* @pluginDesc 에디터를 싸고 있는 iframe 사이즈 조절을 담당하는 플러그인
*/
nhn.husky.SE_OuterIFrameControl = $Class({
name : "SE_OuterIFrameControl",
oResizeGrip : null,
name: "SE_OuterIFrameControl",
oResizeGrip: null,
$init : function(oAppContainer){
$init: function (oAppContainer) {
// page up, page down, home, end, left, up, right, down
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);
if(this.oResizeGrip){
if (this.oResizeGrip) {
this.$FnKeyDown.attach(this.oResizeGrip, "keydown");
}
//마우스 이벤트
if(!!jindo.$Agent().navigator().ie){
if (!!jindo.$Agent().navigator().ie) {
this.$FnMouseDown = $Fn(this._mousedown, this);
this.$FnMouseMove = $Fn(this._mousemove, this);
this.$FnMouseMove_Parent = $Fn(this._mousemove_parent, this);
this.$FnMouseUp = $Fn(this._mouseup, this);
if(this.oResizeGrip){
if (this.oResizeGrip) {
this.$FnMouseDown.attach(this.oResizeGrip, "mousedown");
}
}
},
_assignHTMLObjects : function(oAppContainer){
_assignHTMLObjects: function (oAppContainer) {
oAppContainer = jindo.$(oAppContainer) || document;
this.oResizeGrip = cssquery.getSingle(".husky_seditor_editingArea_verticalResizer", oAppContainer);
@ -64,36 +64,36 @@ nhn.husky.SE_OuterIFrameControl = $Class({
this.welIFrame = $Element(this.elIFrame);
},
$ON_MSG_APP_READY : function(){
$ON_MSG_APP_READY: function () {
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", []);
},
$ON_SE_FIT_IFRAME : function(){
this.elIFrame.style.height = document.body.offsetHeight+"px";
$ON_SE_FIT_IFRAME: function () {
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", []);
},
_keydown : function(oEvent){
_keydown: function (oEvent) {
var oKeyInfo = oEvent.key();
// 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("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", []);
oEvent.stop();
}
},
_mousedown : function(oEvent){
_mousedown: function (oEvent) {
this.iStartHeight = oEvent.pos().clientY;
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]);
},
_mousemove : function(oEvent){
_mousemove: function (oEvent) {
var iHeightChange = oEvent.pos().clientY - this.iStartHeight;
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);
this.oApp.exec("RESIZE_EDITING_AREA_BY", [0, iHeightChange]);
},
_mouseup : function(oEvent){
_mouseup: function (oEvent) {
this.$FnMouseMove.detach(document, "mousemove");
this.$FnMouseMove_Parent.detach(parent.document, "mousemove");
this.$FnMouseUp.detach(document, "mouseup");

View file

@ -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
nhn.husky.SE_ToolbarToggler = $Class({
name : "SE_ToolbarToggler",
bUseToolbar : true,
name: "SE_ToolbarToggler",
bUseToolbar: true,
$init : function(oAppContainer, bUseToolbar){
$init: function (oAppContainer, bUseToolbar) {
this._assignHTMLObjects(oAppContainer, bUseToolbar);
},
_assignHTMLObjects : function(oAppContainer, bUseToolbar){
_assignHTMLObjects: function (oAppContainer, bUseToolbar) {
oAppContainer = jindo.$(oAppContainer) || document;
this.toolbarArea = cssquery.getSingle(".se2_tool", oAppContainer);
//설정이 없거나, 사용하겠다고 표시한 경우 block 처리
if( typeof(bUseToolbar) == 'undefined' || bUseToolbar === true){
if (typeof (bUseToolbar) == 'undefined' || bUseToolbar === true) {
this.toolbarArea.style.display = "block";
}else{
} else {
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", []]);
},
$ON_SE_TOGGLE_TOOLBAR : function(){
this.toolbarArea.style.display = (this.toolbarArea.style.display == "none")?"block":"none";
$ON_SE_TOGGLE_TOOLBAR: function () {
this.toolbarArea.style.display = (this.toolbarArea.style.display == "none") ? "block" : "none";
this.oApp.exec("MSG_EDITING_AREA_SIZE_CHANGED", []);
}
});

View file

@ -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
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
* @name husky_SE2B_Lang_en_US.js
* @ unescape
*/
var oMessageMap_en_US = {
'SE_EditingAreaManager.onExit' : 'Contents have been changed.',
'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_FindReplace.keywordMissing' : 'Enter the word you wish to find.',
'SE_FindReplace.keywordNotFound' : 'The word does not exist.',
'SE_FindReplace.replaceAllResultP1' : 'A total of ',
'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.replaceKeywordNotFound' : 'No word to change.',
'SE_LineHeight.invalidLineHeight' : 'Incorrect value.',
'SE_Footnote.defaultText' : 'Enter footnote details.',
'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_FontNameWithLayerUI.sSampleText' : 'ABCD'
'SE_EditingAreaManager.onExit': 'Contents have been changed.',
'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_FindReplace.keywordMissing': 'Enter the word you wish to find.',
'SE_FindReplace.keywordNotFound': 'The word does not exist.',
'SE_FindReplace.replaceAllResultP1': 'A total of ',
'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.replaceKeywordNotFound': 'No word to change.',
'SE_LineHeight.invalidLineHeight': 'Incorrect value.',
'SE_Footnote.defaultText': 'Enter footnote details.',
'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_FontNameWithLayerUI.sSampleText': 'ABCD'
};

View file

@ -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
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
* @name husky_SE2B_Lang_ja_JP.js
* @ unescape
*/
var oMessageMap_ja_JP = {
'SE_EditingAreaManager.onExit' : '内容が変更されました。',
'SE_Color.invalidColorCode' : 'カラーコードを正しく入力してください。 \n\n 例) #000000, #FF0000, #FFFFFF, #ffffff, ffffff',
'SE_Hyperlink.invalidURL' : '入力したURLが正しくありません。',
'SE_FindReplace.keywordMissing' : 'お探しの単語を入力してください。',
'SE_FindReplace.keywordNotFound' : 'お探しの単語がありません。',
'SE_FindReplace.replaceAllResultP1' : '一致する内容が計',
'SE_FindReplace.replaceAllResultP2' : '件変わりました。',
'SE_FindReplace.notSupportedBrowser' : '現在ご使用中のブラウザーではご利用いただけない機能です。\n\nご不便をおかけしまして申し訳ございません。',
'SE_FindReplace.replaceKeywordNotFound' : '変更される単語がありません。',
'SE_LineHeight.invalidLineHeight' : '誤った値です。',
'SE_Footnote.defaultText' : '脚注内容を入力してください。',
'SE.failedToLoadFlash' : 'フラッシュが遮断されているため、この機能は使用できません。',
'SE2M_EditingModeChanger.confirmTextMode' : 'テキストモードに切り換えると、作成された内容は維持されますが、\n\nフォント等の編集効果と画像等の添付内容が消えることになります。\n\n切り換えますか',
'SE2M_FontNameWithLayerUI.sSampleText' : 'あいうえお'
'SE_EditingAreaManager.onExit': '内容が変更されました。',
'SE_Color.invalidColorCode': 'カラーコードを正しく入力してください。 \n\n 例) #000000, #FF0000, #FFFFFF, #ffffff, ffffff',
'SE_Hyperlink.invalidURL': '入力したURLが正しくありません。',
'SE_FindReplace.keywordMissing': 'お探しの単語を入力してください。',
'SE_FindReplace.keywordNotFound': 'お探しの単語がありません。',
'SE_FindReplace.replaceAllResultP1': '一致する内容が計',
'SE_FindReplace.replaceAllResultP2': '件変わりました。',
'SE_FindReplace.notSupportedBrowser': '現在ご使用中のブラウザーではご利用いただけない機能です。\n\nご不便をおかけしまして申し訳ございません。',
'SE_FindReplace.replaceKeywordNotFound': '変更される単語がありません。',
'SE_LineHeight.invalidLineHeight': '誤った値です。',
'SE_Footnote.defaultText': '脚注内容を入力してください。',
'SE.failedToLoadFlash': 'フラッシュが遮断されているため、この機能は使用できません。',
'SE2M_EditingModeChanger.confirmTextMode': 'テキストモードに切り換えると、作成された内容は維持されますが、\n\nフォント等の編集効果と画像等の添付内容が消えることになります。\n\n切り換えますか',
'SE2M_FontNameWithLayerUI.sSampleText': 'あいうえお'
};

View file

@ -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
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
* @name husky_SE2B_Lang_ko_KR.js
* @ unescape
*/
var oMessageMap = {
'SE_EditingAreaManager.onExit' : '내용이 변경되었습니다.',
'SE_Color.invalidColorCode' : '색상 코드를 올바르게 입력해 주세요. \n\n 예) #000000, #FF0000, #FFFFFF, #ffffff, ffffff',
'SE_Hyperlink.invalidURL' : '입력하신 URL이 올바르지 않습니다.',
'SE_FindReplace.keywordMissing' : '찾으실 단어를 입력해 주세요.',
'SE_FindReplace.keywordNotFound' : '찾으실 단어가 없습니다.',
'SE_FindReplace.replaceAllResultP1' : '일치하는 내용이 총 ',
'SE_FindReplace.replaceAllResultP2' : '건 바뀌었습니다.',
'SE_FindReplace.notSupportedBrowser' : '현재 사용하고 계신 브라우저에서는 사용하실수 없는 기능입니다.\n\n이용에 불편을 드려 죄송합니다.',
'SE_FindReplace.replaceKeywordNotFound' : '바뀔 단어가 없습니다',
'SE_LineHeight.invalidLineHeight' : '잘못된 값입니다.',
'SE_Footnote.defaultText' : '각주내용을 입력해 주세요',
'SE.failedToLoadFlash' : '플래시가 차단되어 있어 해당 기능을 사용할 수 없습니다.',
'SE2M_EditingModeChanger.confirmTextMode' : '텍스트 모드로 전환하면 작성된 내용은 유지되나, \n\n글꼴 등의 편집효과와 이미지 등의 첨부내용이 모두 사라지게 됩니다.\n\n전환하시겠습니까?',
'SE2M_FontNameWithLayerUI.sSampleText' : '가나다라'
'SE_EditingAreaManager.onExit': '내용이 변경되었습니다.',
'SE_Color.invalidColorCode': '색상 코드를 올바르게 입력해 주세요. \n\n 예) #000000, #FF0000, #FFFFFF, #ffffff, ffffff',
'SE_Hyperlink.invalidURL': '입력하신 URL이 올바르지 않습니다.',
'SE_FindReplace.keywordMissing': '찾으실 단어를 입력해 주세요.',
'SE_FindReplace.keywordNotFound': '찾으실 단어가 없습니다.',
'SE_FindReplace.replaceAllResultP1': '일치하는 내용이 총 ',
'SE_FindReplace.replaceAllResultP2': '건 바뀌었습니다.',
'SE_FindReplace.notSupportedBrowser': '현재 사용하고 계신 브라우저에서는 사용하실수 없는 기능입니다.\n\n이용에 불편을 드려 죄송합니다.',
'SE_FindReplace.replaceKeywordNotFound': '바뀔 단어가 없습니다',
'SE_LineHeight.invalidLineHeight': '잘못된 값입니다.',
'SE_Footnote.defaultText': '각주내용을 입력해 주세요',
'SE.failedToLoadFlash': '플래시가 차단되어 있어 해당 기능을 사용할 수 없습니다.',
'SE2M_EditingModeChanger.confirmTextMode': '텍스트 모드로 전환하면 작성된 내용은 유지되나, \n\n글꼴 등의 편집효과와 이미지 등의 첨부내용이 모두 사라지게 됩니다.\n\n전환하시겠습니까?',
'SE2M_FontNameWithLayerUI.sSampleText': '가나다라'
};

View file

@ -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
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
* @name husky_SE2B_Lang_zh_CN.js
* @ unescape
*/
var oMessageMap_zh_CN = {
'SE_EditingAreaManager.onExit' : '内容有了变化。',
'SE_Color.invalidColorCode' : '请你输入正确的色相代码。 \n\n 例) #000000, #FF0000, #FFFFFF, #ffffff, ffffff',
'SE_Hyperlink.invalidURL' : '你输入的URL不符条件。',
'SE_FindReplace.keywordMissing' : '请你输入要找的词汇。',
'SE_FindReplace.keywordNotFound' : '没有词汇符合条件。',
'SE_FindReplace.replaceAllResultP1' : '符合条件的内容改编为',
'SE_FindReplace.replaceAllResultP2' : '件',
'SE_FindReplace.notSupportedBrowser' : '这是你现在使用的浏览器不可支持的功能。\n\n麻烦你很道歉。',
'SE_FindReplace.replaceKeywordNotFound' : '没有词汇要改变。',
'SE_LineHeight.invalidLineHeight' : '这是有问题的值。',
'SE_Footnote.defaultText' : '请你输入脚注内容。',
'SE.failedToLoadFlash' : 'flash被隔绝不能使用该功能。',
'SE2M_EditingModeChanger.confirmTextMode' : '转换为text模式就能维持制作内容\n\n但字体等编辑效果和图像等附件内容都会消失。\n\n你还要继续吗',
'SE2M_FontNameWithLayerUI.sSampleText' : 'ABCD'
'SE_EditingAreaManager.onExit': '内容有了变化。',
'SE_Color.invalidColorCode': '请你输入正确的色相代码。 \n\n 例) #000000, #FF0000, #FFFFFF, #ffffff, ffffff',
'SE_Hyperlink.invalidURL': '你输入的URL不符条件。',
'SE_FindReplace.keywordMissing': '请你输入要找的词汇。',
'SE_FindReplace.keywordNotFound': '没有词汇符合条件。',
'SE_FindReplace.replaceAllResultP1': '符合条件的内容改编为',
'SE_FindReplace.replaceAllResultP2': '件',
'SE_FindReplace.notSupportedBrowser': '这是你现在使用的浏览器不可支持的功能。\n\n麻烦你很道歉。',
'SE_FindReplace.replaceKeywordNotFound': '没有词汇要改变。',
'SE_LineHeight.invalidLineHeight': '这是有问题的值。',
'SE_Footnote.defaultText': '请你输入脚注内容。',
'SE.failedToLoadFlash': 'flash被隔绝不能使用该功能。',
'SE2M_EditingModeChanger.confirmTextMode': '转换为text模式就能维持制作内容\n\n但字体等编辑效果和图像等附件内容都会消失。\n\n你还要继续吗',
'SE2M_FontNameWithLayerUI.sSampleText': 'ABCD'
};

View file

@ -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
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
* @name husky_SE2B_Lang_zh_TW.js
* @ unescape
*/
var oMessageMap_zh_TW = {
'SE_EditingAreaManager.onExit' : '內容已被更改。',
'SE_Color.invalidColorCode' : '請輸入正確的顔色代碼。\n\n例子#000000, #FF0000, #FFFFFF, #ffffff, ffffff',
'SE_Hyperlink.invalidURL' : '輸錯URL',
'SE_FindReplace.keywordMissing' : '請輸入要查詢的單詞。',
'SE_FindReplace.keywordNotFound' : '要查詢的單詞不存在。',
'SE_FindReplace.replaceAllResultP1' : '一致的內容總有',
'SE_FindReplace.replaceAllResultP2' : '件已被更改。',
'SE_FindReplace.notSupportedBrowser' : '當前的浏覽器上無法使用此功能。\n\n很抱歉給你添麻煩了。',
'SE_FindReplace.replaceKeywordNotFound' : '要更改的詞彙不存在。',
'SE_LineHeight.invalidLineHeight' : '爲有錯誤的值。',
'SE_Footnote.defaultText' : '請輸入注腳內容。',
'SE.failedToLoadFlash' : 'Flash被屏蔽導致無法使用此功能。',
'SE2M_EditingModeChanger.confirmTextMode' : '如轉換爲文本模式,雖然維持已寫成的內容,\n\n但字號等編輯效果和圖像等附加內容都會被消失。\n\n是否轉換',
'SE2M_FontNameWithLayerUI.sSampleText' : 'ABCD'
'SE_EditingAreaManager.onExit': '內容已被更改。',
'SE_Color.invalidColorCode': '請輸入正確的顔色代碼。\n\n例子#000000, #FF0000, #FFFFFF, #ffffff, ffffff',
'SE_Hyperlink.invalidURL': '輸錯URL',
'SE_FindReplace.keywordMissing': '請輸入要查詢的單詞。',
'SE_FindReplace.keywordNotFound': '要查詢的單詞不存在。',
'SE_FindReplace.replaceAllResultP1': '一致的內容總有',
'SE_FindReplace.replaceAllResultP2': '件已被更改。',
'SE_FindReplace.notSupportedBrowser': '當前的浏覽器上無法使用此功能。\n\n很抱歉給你添麻煩了。',
'SE_FindReplace.replaceKeywordNotFound': '要更改的詞彙不存在。',
'SE_LineHeight.invalidLineHeight': '爲有錯誤的值。',
'SE_Footnote.defaultText': '請輸入注腳內容。',
'SE.failedToLoadFlash': 'Flash被屏蔽導致無法使用此功能。',
'SE2M_EditingModeChanger.confirmTextMode': '如轉換爲文本模式,雖然維持已寫成的內容,\n\n但字號等編輯效果和圖像等附加內容都會被消失。\n\n是否轉換',
'SE2M_FontNameWithLayerUI.sSampleText': 'ABCD'
};

File diff suppressed because one or more lines are too long

View file

@ -6,23 +6,23 @@
*/
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"]);
},
$LOCAL_BEFORE_FIRST : function(sMsg){
if(!!this.oPopupMgr){ return; }
$LOCAL_BEFORE_FIRST: function (sMsg) {
if (!!this.oPopupMgr) { return; }
// Popup Manager에서 사용할 param
this.htPopupOption = {
oApp : this.oApp,
sName : this.name,
bScroll : false,
sProperties : "",
sUrl : ""
oApp: this.oApp,
sName: this.name,
bScroll: false,
sProperties: "",
sUrl: ""
};
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.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);
@ -47,7 +47,7 @@ nhn.husky.SE2M_AttachQuickPhoto = jindo.$Class({
* 서비스별로 팝업에 parameter를 추가하여 URL을 생성하는 함수
* nhn.husky.SE2M_AttachQuickPhoto.prototype.makePopupURL로 덮어써서 사용하시면 .
*/
makePopupURL : function(){
makePopupURL: function () {
//var sPopupUrl = "./photo_uploader/popup/photo_uploader.html";
var sPopupUrl = "./photo_uploader/popup/index.html";
return sPopupUrl;
@ -56,35 +56,35 @@ nhn.husky.SE2M_AttachQuickPhoto = jindo.$Class({
/**
* 팝업에서 호출되는 메세지.
*/
$ON_SET_PHOTO : function(aPhotoData){
$ON_SET_PHOTO: function (aPhotoData) {
var sContents,
aPhotoInfo,
htData;
if( !aPhotoData ){
if (!aPhotoData) {
return;
}
try{
try {
sContents = "";
for(var i = 0; i <aPhotoData.length; i++){
for (var i = 0; i < aPhotoData.length; i++) {
htData = aPhotoData[i];
if(!htData.sAlign){
if (!htData.sAlign) {
htData.sAlign = "";
}
aPhotoInfo = {
sName : htData.sFileName || "",
sOriginalImageURL : htData.sFileURL,
bNewLine : htData.bNewLine || false
sName: htData.sFileName || "",
sOriginalImageURL: htData.sFileURL,
bNewLine: htData.bNewLine || false
};
sContents += this._getPhotoTag(aPhotoInfo);
}
this.oApp.exec("PASTE_HTML", [sContents]); // 위즐 첨부 파일 부분 확인
}catch(e){
} catch (e) {
// upload시 error발생에 대해서 skip함
return false;
}
@ -93,10 +93,10 @@ nhn.husky.SE2M_AttachQuickPhoto = jindo.$Class({
/**
* @use 일반 포토 tag 생성
*/
_getPhotoTag : function(htPhotoInfo){
_getPhotoTag: function (htPhotoInfo) {
// id와 class는 썸네일과 연관이 많습니다. 수정시 썸네일 영역도 Test
var sTag = '<img src="{=sOriginalImageURL}" title="{=sName}" >';
if(htPhotoInfo.bNewLine){
if (htPhotoInfo.bNewLine) {
sTag += '<br style="clear:both;">';
}
sTag = jindo.$Template(sTag).process(htPhotoInfo);

View file

@ -17,6 +17,7 @@
font-size: inherit;
direction: inherit;
}
.fileinput-button span {
display: none;
}

View file

@ -14,15 +14,18 @@
.fileupload-buttonbar .toggle {
margin-bottom: 5px;
}
.progress-animated .progress-bar,
.progress-animated .bar {
background: url("../img/progressbar.gif") !important;
filter: none;
}
.fileupload-process {
float: right;
display: none;
}
.fileupload-processing .fileupload-process,
.files .processing .preview {
display: block;
@ -31,25 +34,30 @@
background: url("../img/loading.gif") center no-repeat;
background-size: contain;
}
.files audio,
.files video {
max-width: 300px;
}
@media (max-width: 767px) {
.fileupload-buttonbar .toggle,
.files .toggle,
.files .btn span {
display: none;
}
.files .name {
width: 80px;
word-wrap: break-word;
}
.files audio,
.files video {
max-width: 80px;
}
.files img,
.files canvas {
max-width: 100%;

View file

@ -14,6 +14,7 @@
position: relative;
overflow: hidden;
}
.fileinput-button input {
position: absolute;
top: 0;

View file

@ -10,90 +10,210 @@
* http://www.opensource.org/licenses/MIT
*/
body {margin:0;padding:0;overflow-x:hidden}
body,input,textarea,select,button,table{font-family:'돋움',Dotum,Helvetica,sans-serif;font-size:12px}
#pop_header{height:26px;padding:14px 0 0 20px;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;
body {
margin: 0;
padding: 0;
overflow-x: hidden
}
.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;
body,
input,
textarea,
select,
button,
table {
font-family: '돋움', Dotum, Helvetica, sans-serif;
font-size: 12px
}
.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;
#pop_header {
height: 26px;
padding: 14px 0 0 20px;
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 {
display: inline-block;
margin-bottom: 0;
font-weight: 400;
text-align: center;
vertical-align: middle;
cursor: pointer;
background-image: none;
border: 1px solid transparent;
white-space: nowrap;
padding: 6px 12px;
font-size: 12px;
line-height: 1.42857143;
border-radius: 4px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
display: inline-block;
margin-bottom: 0;
font-weight: 400;
text-align: center;
vertical-align: middle;
cursor: pointer;
background-image: none;
border: 1px solid transparent;
white-space: nowrap;
padding: 6px 12px;
font-size: 12px;
line-height: 1.42857143;
border-radius: 4px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.btn-success {
color: #fff;
background-color: #5cb85c;
border-color: #4cae4c;
color: #fff;
background-color: #5cb85c;
border-color: #4cae4c;
}
.btn:hover, .btn:focus {
color: #333;
text-decoration: none;
.btn:hover,
.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;
background-color: #47a447;
border-color: #398439;
.btn-success:hover,
.btn-success:focus,
.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}

View file

@ -55,12 +55,8 @@
<!-- The Iframe Transport is required for browsers without support for XHR file uploads -->
<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 -->
<script src="./js/jquery.fileupload.js?v=210625-1329"></script>
<script src="./js/basic.js?v=210625-1329"></script>
</body>

View file

@ -87,7 +87,7 @@ jQuery(function ($) {
if (!preload && !othis.filter.test(file.type)) {
var agent = navigator.userAgent.toLowerCase();
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();
alert(msg);
return true;

View file

@ -163,7 +163,7 @@
if (data.context) {
data.context.each(function (index) {
var file = files[index] ||
{error: 'Empty file upload result'};
{ error: 'Empty file upload result' };
deferred = that._addFinishedDeferreds();
that._transition($(this)).done(
function () {
@ -407,7 +407,7 @@
'DownloadURL',
[type, name, url].join(':')
);
} catch (ignore) {}
} catch (ignore) { }
});
},

View file

@ -253,7 +253,7 @@
processData: false,
contentType: false,
cache: false,
container_el : null //사용자추가
container_el: null //사용자추가
},
// A list of options that require reinitializing event listeners and/or
@ -303,7 +303,7 @@
if ($.type(options.formData) === 'object') {
formData = [];
$.each(options.formData, function (name, value) {
formData.push({name: name, value: value});
formData.push({ name: name, value: value });
});
return formData;
}
@ -377,14 +377,14 @@
// property calculated accordingly:
this._trigger(
'progress',
$.Event('progress', {delegatedEvent: e}),
$.Event('progress', { delegatedEvent: e }),
data
);
// Trigger a global progress event for all current file uploads,
// including ajax calls queued for sequential file uploads:
this._trigger(
'progressall',
$.Event('progressall', {delegatedEvent: e}),
$.Event('progressall', { delegatedEvent: e }),
this._progress
);
}
@ -645,7 +645,7 @@
data.jqXHR = this.jqXHR =
(that._trigger(
'submit',
$.Event('submit', {delegatedEvent: e}),
$.Event('submit', { delegatedEvent: e }),
this
) !== false) && that._onSend(e, this);
}
@ -875,7 +875,7 @@
jqXHR = jqXHR || (
((aborted || that._trigger(
'send',
$.Event('send', {delegatedEvent: e}),
$.Event('send', { delegatedEvent: e }),
options
) === false) &&
that._getXHRPromise(false, options.context, aborted)) ||
@ -961,8 +961,7 @@
i,
j = 0;
if ( options.limit_filesLength && filesLength > options.limit_filesLength)
{
if (options.limit_filesLength && filesLength > options.limit_filesLength) {
filesLength = options.limit_filesLength; //사용자추가
}
@ -987,7 +986,7 @@
} else if (!options.singleFileUploads && limitSize) {
fileSet = [];
paramNameSet = [];
console.log( filesLength );
console.log(filesLength);
for (i = 0; i < filesLength; i = i + 1) {
batchSize += files[i].size + overhead;
if (i + 1 === filesLength ||
@ -1009,7 +1008,7 @@
data.originalFiles = files;
$.each(fileSet || files, function (index, element) {
if( filesLength <= index) return true; //사용자 추가
if (filesLength <= index) return true; //사용자 추가
var newData = $.extend({}, data);
newData.files = fileSet ? element : [element];
newData.paramName = paramNameSet[index];
@ -1018,7 +1017,7 @@
that._addConvenienceMethods(e, newData);
result = that._trigger(
'add',
$.Event('add', {delegatedEvent: e}),
$.Event('add', { delegatedEvent: e }),
newData
);
return result;
@ -1152,7 +1151,7 @@
// If the files property is not available, the browser does not
// support the File API and we add a pseudo File object with
// 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) {
// File normalization for Safari 4 and Firefox 3:
$.each(files, function (index, file) {
@ -1191,7 +1190,7 @@
}
if (that._trigger(
'change',
$.Event('change', {delegatedEvent: e}),
$.Event('change', { delegatedEvent: e }),
data
) !== false) {
that._onAdd(e, data);
@ -1202,7 +1201,7 @@
_onPaste: function (e) {
var items = e.originalEvent && e.originalEvent.clipboardData &&
e.originalEvent.clipboardData.items,
data = {files: []};
data = { files: [] };
if (items && items.length) {
$.each(items, function (index, item) {
var file = item.getAsFile && item.getAsFile();
@ -1212,7 +1211,7 @@
});
if (this._trigger(
'paste',
$.Event('paste', {delegatedEvent: e}),
$.Event('paste', { delegatedEvent: e }),
data
) !== false) {
this._onAdd(e, data);
@ -1231,7 +1230,7 @@
data.files = files;
if (that._trigger(
'drop',
$.Event('drop', {delegatedEvent: e}),
$.Event('drop', { delegatedEvent: e }),
data
) !== false) {
that._onAdd(e, data);
@ -1246,7 +1245,7 @@
if (dataTransfer && $.inArray('Files', dataTransfer.types) !== -1 &&
this._trigger(
'dragover',
$.Event('dragover', {delegatedEvent: e})
$.Event('dragover', { delegatedEvent: e })
) !== false) {
e.preventDefault();
dataTransfer.dropEffect = 'copy';
@ -1270,7 +1269,7 @@
});
*/
//var othis = this;
if( $.support.xhrFileUpload ) {
if ($.support.xhrFileUpload) {
this._on(this.options.fileInput, {
change: this._onChange
});
@ -1279,17 +1278,17 @@
$swf_target.swfupload({
//upload_url: "upload.php",
upload_url: this.options.url,
file_post_name : "files",
file_size_limit : "10 MB",
file_post_name: "files",
file_size_limit: "10 MB",
file_upload_limit: 0,
file_queue_limit : this.options.limit_filesLength,
file_types : "*.jpeg; *.bmp; *.png; *.jpg; *.gif; *.webp",
file_types_description : "Image Files (JPG, JPEG, PNG, BMP, GIF, WEBP)",
flash_url : "./swfupload/swfupload.swf",
button_placeholder : this.options.fileInput[0],
button_width : "100%",
button_height : "100%",
button_window_mode : "transparent"
file_queue_limit: this.options.limit_filesLength,
file_types: "*.jpeg; *.bmp; *.png; *.jpg; *.gif; *.webp",
file_types_description: "Image Files (JPG, JPEG, PNG, BMP, GIF, WEBP)",
flash_url: "./swfupload/swfupload.swf",
button_placeholder: this.options.fileInput[0],
button_width: "100%",
button_height: "100%",
button_window_mode: "transparent"
});
}
}

View file

@ -95,7 +95,7 @@
completeCallback(
200,
'success',
{'iframe': response}
{ 'iframe': response }
);
// Fix for IE endless progress bar activity bug
// (happens on form submits to iframe targets):

View file

@ -17,61 +17,61 @@
// Browser globals:
factory(jQuery);
}
}(function( $, undefined ) {
}(function ($, undefined) {
var uuid = 0,
var uuid = 0,
slice = Array.prototype.slice,
_cleanData = $.cleanData;
$.cleanData = function( elems ) {
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
$.cleanData = function (elems) {
for (var i = 0, elem; (elem = elems[i]) != null; i++) {
try {
$( elem ).triggerHandler( "remove" );
$(elem).triggerHandler("remove");
// 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,
// proxiedPrototype allows the provided prototype to remain unmodified
// so that it can be used as a mixin for multiple widgets (#8876)
proxiedPrototype = {},
namespace = name.split( "." )[ 0 ];
namespace = name.split(".")[0];
name = name.split( "." )[ 1 ];
name = name.split(".")[1];
fullName = namespace + "-" + name;
if ( !prototype ) {
if (!prototype) {
prototype = base;
base = $.Widget;
}
// create selector for plugin
$.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
return !!$.data( elem, fullName );
$.expr[":"][fullName.toLowerCase()] = function (elem) {
return !!$.data(elem, fullName);
};
$[ namespace ] = $[ namespace ] || {};
existingConstructor = $[ namespace ][ name ];
constructor = $[ namespace ][ name ] = function( options, element ) {
$[namespace] = $[namespace] || {};
existingConstructor = $[namespace][name];
constructor = $[namespace][name] = function (options, element) {
// allow instantiation without "new" keyword
if ( !this._createWidget ) {
return new constructor( options, element );
if (!this._createWidget) {
return new constructor(options, element);
}
// allow instantiation without initializing for simple inheritance
// must use "new" keyword (the code above always passes args)
if ( arguments.length ) {
this._createWidget( options, element );
if (arguments.length) {
this._createWidget(options, element);
}
};
// extend with the existing constructor to carry over any static properties
$.extend( constructor, existingConstructor, {
$.extend(constructor, existingConstructor, {
version: prototype.version,
// copy the object used to create the prototype in case we need to
// redefine the widget later
_proto: $.extend( {}, prototype ),
_proto: $.extend({}, prototype),
// track widgets that inherit from this widget in case this widget is
// redefined after a widget inherits from it
_childConstructors: []
@ -81,20 +81,20 @@ $.widget = function( name, base, prototype ) {
// 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
// inheriting from
basePrototype.options = $.widget.extend( {}, basePrototype.options );
$.each( prototype, function( prop, value ) {
if ( !$.isFunction( value ) ) {
proxiedPrototype[ prop ] = value;
basePrototype.options = $.widget.extend({}, basePrototype.options);
$.each(prototype, function (prop, value) {
if (!$.isFunction(value)) {
proxiedPrototype[prop] = value;
return;
}
proxiedPrototype[ prop ] = (function() {
var _super = function() {
return base.prototype[ prop ].apply( this, arguments );
proxiedPrototype[prop] = (function () {
var _super = function () {
return base.prototype[prop].apply(this, arguments);
},
_superApply = function( args ) {
return base.prototype[ prop ].apply( this, args );
_superApply = function (args) {
return base.prototype[prop].apply(this, args);
};
return function() {
return function () {
var __super = this._super,
__superApply = this._superApply,
returnValue;
@ -102,7 +102,7 @@ $.widget = function( name, base, prototype ) {
this._super = _super;
this._superApply = _superApply;
returnValue = value.apply( this, arguments );
returnValue = value.apply(this, arguments);
this._super = __super;
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
// always use the name + a colon as the prefix, e.g., draggable:start
// 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
// the new version of this widget. We're essentially trying to replace one
// level in the prototype chain.
if ( existingConstructor ) {
$.each( existingConstructor._childConstructors, function( i, child ) {
if (existingConstructor) {
$.each(existingConstructor._childConstructors, function (i, child) {
var childPrototype = child.prototype;
// redefine the child widget using the same prototype that was
// 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
// so the old child constructors can be garbage collected
delete existingConstructor._childConstructors;
} else {
base._childConstructors.push( constructor );
base._childConstructors.push(constructor);
}
$.widget.bridge( name, constructor );
};
$.widget.bridge(name, constructor);
};
$.widget.extend = function( target ) {
var input = slice.call( arguments, 1 ),
$.widget.extend = function (target) {
var input = slice.call(arguments, 1),
inputIndex = 0,
inputLength = input.length,
key,
value;
for ( ; inputIndex < inputLength; inputIndex++ ) {
for ( key in input[ inputIndex ] ) {
value = input[ inputIndex ][ key ];
if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
for (; inputIndex < inputLength; inputIndex++) {
for (key in input[inputIndex]) {
value = input[inputIndex][key];
if (input[inputIndex].hasOwnProperty(key) && value !== undefined) {
// Clone objects
if ( $.isPlainObject( value ) ) {
target[ key ] = $.isPlainObject( target[ key ] ) ?
$.widget.extend( {}, target[ key ], value ) :
if ($.isPlainObject(value)) {
target[key] = $.isPlainObject(target[key]) ?
$.widget.extend({}, target[key], value) :
// Don't extend strings, arrays, etc. with objects
$.widget.extend( {}, value );
$.widget.extend({}, value);
// Copy everything else by reference
} else {
target[ key ] = value;
target[key] = value;
}
}
}
}
return target;
};
};
$.widget.bridge = function( name, object ) {
$.widget.bridge = function (name, object) {
var fullName = object.prototype.widgetFullName || name;
$.fn[ name ] = function( options ) {
$.fn[name] = function (options) {
var isMethodCall = typeof options === "string",
args = slice.call( arguments, 1 ),
args = slice.call(arguments, 1),
returnValue = this;
// allow multiple hashes to be passed on init
options = !isMethodCall && args.length ?
$.widget.extend.apply( null, [ options ].concat(args) ) :
$.widget.extend.apply(null, [options].concat(args)) :
options;
if ( isMethodCall ) {
this.each(function() {
if (isMethodCall) {
this.each(function () {
var methodValue,
instance = $.data( this, fullName );
if ( !instance ) {
return $.error( "cannot call methods on " + name + " prior to initialization; " +
"attempted to call method '" + options + "'" );
instance = $.data(this, fullName);
if (!instance) {
return $.error("cannot call methods on " + name + " prior to initialization; " +
"attempted to call method '" + options + "'");
}
if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
return $.error( "no such method '" + options + "' for " + name + " widget instance" );
if (!$.isFunction(instance[options]) || options.charAt(0) === "_") {
return $.error("no such method '" + options + "' for " + name + " widget instance");
}
methodValue = instance[ options ].apply( instance, args );
if ( methodValue !== instance && methodValue !== undefined ) {
methodValue = instance[options].apply(instance, args);
if (methodValue !== instance && methodValue !== undefined) {
returnValue = methodValue && methodValue.jquery ?
returnValue.pushStack( methodValue.get() ) :
returnValue.pushStack(methodValue.get()) :
methodValue;
return false;
}
});
} else {
this.each(function() {
var instance = $.data( this, fullName );
if ( instance ) {
instance.option( options || {} )._init();
this.each(function () {
var instance = $.data(this, fullName);
if (instance) {
instance.option(options || {})._init();
} else {
$.data( this, fullName, new object( options, this ) );
$.data(this, fullName, new object(options, this));
}
});
}
return returnValue;
};
};
};
$.Widget = function( /* options, element */ ) {};
$.Widget._childConstructors = [];
$.Widget = function ( /* options, element */) { };
$.Widget._childConstructors = [];
$.Widget.prototype = {
$.Widget.prototype = {
widgetName: "widget",
widgetEventPrefix: "",
defaultElement: "<div>",
@ -230,39 +230,39 @@ $.Widget.prototype = {
// callbacks
create: null
},
_createWidget: function( options, element ) {
element = $( element || this.defaultElement || this )[ 0 ];
this.element = $( element );
_createWidget: function (options, element) {
element = $(element || this.defaultElement || this)[0];
this.element = $(element);
this.uuid = uuid++;
this.eventNamespace = "." + this.widgetName + this.uuid;
this.options = $.widget.extend( {},
this.options = $.widget.extend({},
this.options,
this._getCreateOptions(),
options );
options);
this.bindings = $();
this.hoverable = $();
this.focusable = $();
if ( element !== this ) {
$.data( element, this.widgetFullName, this );
this._on( true, this.element, {
remove: function( event ) {
if ( event.target === element ) {
if (element !== this) {
$.data(element, this.widgetFullName, this);
this._on(true, this.element, {
remove: function (event) {
if (event.target === element) {
this.destroy();
}
}
});
this.document = $( element.style ?
this.document = $(element.style ?
// element within the document
element.ownerDocument :
// element is window or document
element.document || element );
this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
element.document || element);
this.window = $(this.document[0].defaultView || this.document[0].parentWindow);
}
this._create();
this._trigger( "create", null, this._getCreateEventData() );
this._trigger("create", null, this._getCreateEventData());
this._init();
},
_getCreateOptions: $.noop,
@ -270,230 +270,230 @@ $.Widget.prototype = {
_create: $.noop,
_init: $.noop,
destroy: function() {
destroy: function () {
this._destroy();
// we can probably remove the unbind calls in 2.0
// all event bindings should go through this._on()
this.element
.unbind( this.eventNamespace )
.unbind(this.eventNamespace)
// 1.9 BC for #7810
// TODO remove dual storage
.removeData( this.widgetName )
.removeData( this.widgetFullName )
.removeData(this.widgetName)
.removeData(this.widgetFullName)
// support: jquery <1.6.3
// http://bugs.jquery.com/ticket/9413
.removeData( $.camelCase( this.widgetFullName ) );
.removeData($.camelCase(this.widgetFullName));
this.widget()
.unbind( this.eventNamespace )
.removeAttr( "aria-disabled" )
.unbind(this.eventNamespace)
.removeAttr("aria-disabled")
.removeClass(
this.widgetFullName + "-disabled " +
"ui-state-disabled" );
"ui-state-disabled");
// clean up events and states
this.bindings.unbind( this.eventNamespace );
this.hoverable.removeClass( "ui-state-hover" );
this.focusable.removeClass( "ui-state-focus" );
this.bindings.unbind(this.eventNamespace);
this.hoverable.removeClass("ui-state-hover");
this.focusable.removeClass("ui-state-focus");
},
_destroy: $.noop,
widget: function() {
widget: function () {
return this.element;
},
option: function( key, value ) {
option: function (key, value) {
var options = key,
parts,
curOption,
i;
if ( arguments.length === 0 ) {
if (arguments.length === 0) {
// 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: ___ } }
options = {};
parts = key.split( "." );
parts = key.split(".");
key = parts.shift();
if ( parts.length ) {
curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
for ( i = 0; i < parts.length - 1; i++ ) {
curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
curOption = curOption[ parts[ i ] ];
if (parts.length) {
curOption = options[key] = $.widget.extend({}, this.options[key]);
for (i = 0; i < parts.length - 1; i++) {
curOption[parts[i]] = curOption[parts[i]] || {};
curOption = curOption[parts[i]];
}
key = parts.pop();
if ( arguments.length === 1 ) {
return curOption[ key ] === undefined ? null : curOption[ key ];
if (arguments.length === 1) {
return curOption[key] === undefined ? null : curOption[key];
}
curOption[ key ] = value;
curOption[key] = value;
} else {
if ( arguments.length === 1 ) {
return this.options[ key ] === undefined ? null : this.options[ key ];
if (arguments.length === 1) {
return this.options[key] === undefined ? null : this.options[key];
}
options[ key ] = value;
options[key] = value;
}
}
this._setOptions( options );
this._setOptions(options);
return this;
},
_setOptions: function( options ) {
_setOptions: function (options) {
var key;
for ( key in options ) {
this._setOption( key, options[ key ] );
for (key in options) {
this._setOption(key, options[key]);
}
return this;
},
_setOption: function( key, value ) {
this.options[ key ] = value;
_setOption: function (key, value) {
this.options[key] = value;
if ( key === "disabled" ) {
if (key === "disabled") {
this.widget()
.toggleClass( this.widgetFullName + "-disabled ui-state-disabled", !!value )
.attr( "aria-disabled", value );
this.hoverable.removeClass( "ui-state-hover" );
this.focusable.removeClass( "ui-state-focus" );
.toggleClass(this.widgetFullName + "-disabled ui-state-disabled", !!value)
.attr("aria-disabled", value);
this.hoverable.removeClass("ui-state-hover");
this.focusable.removeClass("ui-state-focus");
}
return this;
},
enable: function() {
return this._setOption( "disabled", false );
enable: function () {
return this._setOption("disabled", false);
},
disable: function() {
return this._setOption( "disabled", true );
disable: function () {
return this._setOption("disabled", true);
},
_on: function( suppressDisabledCheck, element, handlers ) {
_on: function (suppressDisabledCheck, element, handlers) {
var delegateElement,
instance = this;
// no suppressDisabledCheck flag, shuffle arguments
if ( typeof suppressDisabledCheck !== "boolean" ) {
if (typeof suppressDisabledCheck !== "boolean") {
handlers = element;
element = suppressDisabledCheck;
suppressDisabledCheck = false;
}
// no element argument, shuffle and use this.element
if ( !handlers ) {
if (!handlers) {
handlers = element;
element = this.element;
delegateElement = this.widget();
} else {
// accept selectors, DOM elements
element = delegateElement = $( element );
this.bindings = this.bindings.add( element );
element = delegateElement = $(element);
this.bindings = this.bindings.add(element);
}
$.each( handlers, function( event, handler ) {
$.each(handlers, function (event, handler) {
function handlerProxy() {
// allow widgets to customize the disabled handling
// - disabled as an array instead of boolean
// - disabled class as method for disabling individual parts
if ( !suppressDisabledCheck &&
( instance.options.disabled === true ||
$( this ).hasClass( "ui-state-disabled" ) ) ) {
if (!suppressDisabledCheck &&
(instance.options.disabled === true ||
$(this).hasClass("ui-state-disabled"))) {
return;
}
return ( typeof handler === "string" ? instance[ handler ] : handler )
.apply( instance, arguments );
return (typeof handler === "string" ? instance[handler] : handler)
.apply(instance, arguments);
}
// copy the guid so direct unbinding works
if ( typeof handler !== "string" ) {
if (typeof handler !== "string") {
handlerProxy.guid = handler.guid =
handler.guid || handlerProxy.guid || $.guid++;
}
var match = event.match( /^(\w+)\s*(.*)$/ ),
var match = event.match(/^(\w+)\s*(.*)$/),
eventName = match[1] + instance.eventNamespace,
selector = match[2];
if ( selector ) {
delegateElement.delegate( selector, eventName, handlerProxy );
if (selector) {
delegateElement.delegate(selector, eventName, handlerProxy);
} else {
element.bind( eventName, handlerProxy );
element.bind(eventName, handlerProxy);
}
});
},
_off: function( element, eventName ) {
eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) + this.eventNamespace;
element.unbind( eventName ).undelegate( eventName );
_off: function (element, eventName) {
eventName = (eventName || "").split(" ").join(this.eventNamespace + " ") + this.eventNamespace;
element.unbind(eventName).undelegate(eventName);
},
_delay: function( handler, delay ) {
_delay: function (handler, delay) {
function handlerProxy() {
return ( typeof handler === "string" ? instance[ handler ] : handler )
.apply( instance, arguments );
return (typeof handler === "string" ? instance[handler] : handler)
.apply(instance, arguments);
}
var instance = this;
return setTimeout( handlerProxy, delay || 0 );
return setTimeout(handlerProxy, delay || 0);
},
_hoverable: function( element ) {
this.hoverable = this.hoverable.add( element );
this._on( element, {
mouseenter: function( event ) {
$( event.currentTarget ).addClass( "ui-state-hover" );
_hoverable: function (element) {
this.hoverable = this.hoverable.add(element);
this._on(element, {
mouseenter: function (event) {
$(event.currentTarget).addClass("ui-state-hover");
},
mouseleave: function( event ) {
$( event.currentTarget ).removeClass( "ui-state-hover" );
mouseleave: function (event) {
$(event.currentTarget).removeClass("ui-state-hover");
}
});
},
_focusable: function( element ) {
this.focusable = this.focusable.add( element );
this._on( element, {
focusin: function( event ) {
$( event.currentTarget ).addClass( "ui-state-focus" );
_focusable: function (element) {
this.focusable = this.focusable.add(element);
this._on(element, {
focusin: function (event) {
$(event.currentTarget).addClass("ui-state-focus");
},
focusout: function( event ) {
$( event.currentTarget ).removeClass( "ui-state-focus" );
focusout: function (event) {
$(event.currentTarget).removeClass("ui-state-focus");
}
});
},
_trigger: function( type, event, data ) {
_trigger: function (type, event, data) {
var prop, orig,
callback = this.options[ type ];
callback = this.options[type];
data = data || {};
event = $.Event( event );
event.type = ( type === this.widgetEventPrefix ?
event = $.Event(event);
event.type = (type === this.widgetEventPrefix ?
type :
this.widgetEventPrefix + type ).toLowerCase();
this.widgetEventPrefix + type).toLowerCase();
// the original event may come from any element
// 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
orig = event.originalEvent;
if ( orig ) {
for ( prop in orig ) {
if ( !( prop in event ) ) {
event[ prop ] = orig[ prop ];
if (orig) {
for (prop in orig) {
if (!(prop in event)) {
event[prop] = orig[prop];
}
}
}
this.element.trigger( event, data );
return !( $.isFunction( callback ) &&
callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
event.isDefaultPrevented() );
this.element.trigger(event, data);
return !($.isFunction(callback) &&
callback.apply(this.element[0], [event].concat(data)) === false ||
event.isDefaultPrevented());
}
};
};
$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
$.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
if ( typeof options === "string" ) {
$.each({ show: "fadeIn", hide: "fadeOut" }, function (method, defaultEffect) {
$.Widget.prototype["_" + method] = function (element, options, callback) {
if (typeof options === "string") {
options = { effect: options };
}
var hasOptions,
@ -503,28 +503,28 @@ $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
defaultEffect :
options.effect || defaultEffect;
options = options || {};
if ( typeof options === "number" ) {
if (typeof options === "number") {
options = { duration: options };
}
hasOptions = !$.isEmptyObject( options );
hasOptions = !$.isEmptyObject(options);
options.complete = callback;
if ( options.delay ) {
element.delay( options.delay );
if (options.delay) {
element.delay(options.delay);
}
if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
element[ method ]( options );
} else if ( effectName !== method && element[ effectName ] ) {
element[ effectName ]( options.duration, options.easing, callback );
if (hasOptions && $.effects && $.effects.effect[effectName]) {
element[method](options);
} else if (effectName !== method && element[effectName]) {
element[effectName](options.duration, options.easing, callback);
} else {
element.queue(function( next ) {
$( this )[ method ]();
if ( callback ) {
callback.call( element[ 0 ] );
element.queue(function (next) {
$(this)[method]();
if (callback) {
callback.call(element[0]);
}
next();
});
}
};
});
});
}));

View file

@ -165,13 +165,13 @@ class Services_JSON
function utf162utf8($utf16)
{
// 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');
}
$bytes = (ord($utf16[0]) << 8) | ord($utf16[1]);
switch(true) {
switch (true) {
case ((0x7F & $bytes) == $bytes):
// this case should never be reached, because we are in ASCII range
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
@ -209,11 +209,11 @@ class Services_JSON
function utf82utf16($utf8)
{
// 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');
}
switch($this->strlen8($utf8)) {
switch ($this->strlen8($utf8)) {
case 1:
// this case should never be reached, because we are in ASCII range
// 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 == 0x5C:
// double quote, slash, slosh
$ascii .= '\\'.$var[$c];
$ascii .= '\\' . $var[$c];
break;
case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
@ -349,7 +349,7 @@ class Services_JSON
case (($ord_var_c & 0xE0) == 0xC0):
// characters U-00000080 - U-000007FF, mask 110XXXXX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
if ($c+1 >= $strlen_var) {
if ($c + 1 >= $strlen_var) {
$c += 1;
$ascii .= '?';
break;
@ -362,33 +362,39 @@ class Services_JSON
break;
case (($ord_var_c & 0xF0) == 0xE0):
if ($c+2 >= $strlen_var) {
if ($c + 2 >= $strlen_var) {
$c += 2;
$ascii .= '?';
break;
}
// characters U-00000800 - U-0000FFFF, mask 1110XXXX
// 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 + 2]));
@ord($var[$c + 2])
);
$c += 2;
$utf16 = $this->utf82utf16($char);
$ascii .= sprintf('\u%04s', bin2hex($utf16));
break;
case (($ord_var_c & 0xF8) == 0xF0):
if ($c+3 >= $strlen_var) {
if ($c + 3 >= $strlen_var) {
$c += 3;
$ascii .= '?';
break;
}
// characters U-00010000 - U-001FFFFF, mask 11110XXX
// 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 + 2]),
ord($var[$c + 3]));
ord($var[$c + 3])
);
$c += 3;
$utf16 = $this->utf82utf16($char);
$ascii .= sprintf('\u%04s', bin2hex($utf16));
@ -397,42 +403,48 @@ class Services_JSON
case (($ord_var_c & 0xFC) == 0xF8):
// characters U-00200000 - U-03FFFFFF, mask 111110XX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
if ($c+4 >= $strlen_var) {
if ($c + 4 >= $strlen_var) {
$c += 4;
$ascii .= '?';
break;
}
$char = pack('C*', $ord_var_c,
$char = pack(
'C*',
$ord_var_c,
ord($var[$c + 1]),
ord($var[$c + 2]),
ord($var[$c + 3]),
ord($var[$c + 4]));
ord($var[$c + 4])
);
$c += 4;
$utf16 = $this->utf82utf16($char);
$ascii .= sprintf('\u%04s', bin2hex($utf16));
break;
case (($ord_var_c & 0xFE) == 0xFC):
if ($c+5 >= $strlen_var) {
if ($c + 5 >= $strlen_var) {
$c += 5;
$ascii .= '?';
break;
}
// characters U-04000000 - U-7FFFFFFF, mask 1111110X
// 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 + 2]),
ord($var[$c + 3]),
ord($var[$c + 4]),
ord($var[$c + 5]));
ord($var[$c + 5])
);
$c += 5;
$utf16 = $this->utf82utf16($char);
$ascii .= sprintf('\u%04s', bin2hex($utf16));
break;
}
}
return '"'.$ascii.'"';
return '"' . $ascii . '"';
case 'array':
/*
@ -455,12 +467,14 @@ class Services_JSON
// treat as a JSON object
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_values($var));
array_values($var)
);
foreach($properties as $property) {
if(Services_JSON::isError($property)) {
foreach ($properties as $property) {
if (Services_JSON::isError($property)) {
return $property;
}
}
@ -471,8 +485,8 @@ class Services_JSON
// treat it like a regular array
$elements = array_map(array($this, '_encode'), $var);
foreach($elements as $element) {
if(Services_JSON::isError($element)) {
foreach ($elements as $element) {
if (Services_JSON::isError($element)) {
return $element;
}
}
@ -491,22 +505,24 @@ class Services_JSON
return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS)
? 'null'
: new Services_JSON_Error(class_name($var).
: new Services_JSON_Error(class_name($var) .
" toJSON returned an object with a toJSON method.");
}
return $this->_encode( $recode );
return $this->_encode($recode);
}
$vars = get_object_vars($var);
$properties = array_map(array($this, 'name_value'),
$properties = array_map(
array($this, 'name_value'),
array_keys($vars),
array_values($vars));
array_values($vars)
);
foreach($properties as $property) {
if(Services_JSON::isError($property)) {
foreach ($properties as $property) {
if (Services_JSON::isError($property)) {
return $property;
}
}
@ -516,7 +532,7 @@ class Services_JSON
default:
return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS)
? '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);
if(Services_JSON::isError($encoded_value)) {
if (Services_JSON::isError($encoded_value)) {
return $encoded_value;
}
@ -604,9 +620,9 @@ class Services_JSON
// return (float)$str;
// Return float or int, as appropriate
return ((float)$str == (integer)$str)
? (integer)$str
: (float)$str;
return ((float) $str == (integer) $str)
? (integer) $str
: (float) $str;
} elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) {
// 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 == '\\/':
if (($delim == '"' && $substr_chrs_c_2 != '\\\'') ||
($delim == "'" && $substr_chrs_c_2 != '\\"')) {
if (
($delim == '"' && $substr_chrs_c_2 != '\\\'') ||
($delim == "'" && $substr_chrs_c_2 != '\\"')
) {
$utf8 .= $chrs[++$c];
}
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,
'delim' => false));
'delim' => false
));
$chrs = $this->substr8($str, 1, -1);
$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]));
//print("Found start of string at {$c}\n");
} elseif (($chrs[$c] == $top['delim']) &&
} elseif (
($chrs[$c] == $top['delim']) &&
($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
// we know that it's not escaped becase there is _not_ an
// odd number of backslashes at the end of the string so far
array_pop($stk);
//print("Found end of string at {$c}: ".$this->substr8($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n");
} elseif (($chrs[$c] == '[') &&
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
} elseif (
($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
array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false));
//print("Found start of array at {$c}\n");
@ -813,8 +837,10 @@ class Services_JSON
array_pop($stk);
//print("Found end of array at {$c}: ".$this->substr8($chrs, $top['where'], (1 + $c - $top['where']))."\n");
} elseif (($chrs[$c] == '{') &&
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
} elseif (
($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
array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false));
//print("Found start of object at {$c}\n");
@ -824,8 +850,10 @@ class Services_JSON
array_pop($stk);
//print("Found end of object at {$c}: ".$this->substr8($chrs, $top['where'], (1 + $c - $top['where']))."\n");
} elseif (($substr_chrs_c_2 == '/*') &&
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
} elseif (
($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
array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false));
$c++;
@ -864,8 +892,10 @@ class Services_JSON
{
if (class_exists('pear')) {
return PEAR::isError($data, $code);
} elseif (is_object($data) && (get_class($data) == 'services_json_error' ||
is_subclass_of($data, 'services_json_error'))) {
} elseif (
is_object($data) && (get_class($data) == 'services_json_error' ||
is_subclass_of($data, 'services_json_error'))
) {
return true;
}
@ -877,12 +907,12 @@ class Services_JSON
* @param string
* @return integer length
*/
function strlen8( $str )
function strlen8($str)
{
if ( $this->_mb_strlen ) {
return mb_strlen( $str, "8bit" );
if ($this->_mb_strlen) {
return mb_strlen($str, "8bit");
}
return strlen( $str );
return strlen($str);
}
/**
@ -892,15 +922,15 @@ class Services_JSON
* @param integer length
* @return integer length
*/
function substr8( $string, $start, $length=false )
function substr8($string, $start, $length = false)
{
if ( $length === false ) {
$length = $this->strlen8( $string ) - $start;
if ($length === false) {
$length = $this->strlen8($string) - $start;
}
if ( $this->_mb_substr ) {
return mb_substr( $string, $start, $length, "8bit" );
if ($this->_mb_substr) {
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
{
function Services_JSON_Error($message = 'unknown error', $code = null,
$mode = null, $options = null, $userinfo = null)
{
function Services_JSON_Error(
$message = 'unknown error',
$code = null,
$mode = null,
$options = null,
$userinfo = null
) {
parent::PEAR_Error($message, $code, $mode, $options, $userinfo);
}
}
@ -923,9 +957,13 @@ if (class_exists('PEAR_Error')) {
*/
class Services_JSON_Error
{
function Services_JSON_Error($message = 'unknown error', $code = null,
$mode = null, $options = null, $userinfo = null)
{
function Services_JSON_Error(
$message = 'unknown error',
$code = null,
$mode = null,
$options = null,
$userinfo = null
) {
}
}

View file

@ -30,9 +30,10 @@ class UploadHandler
"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:
// http://php.net/manual/en/features.file-upload.errors.php
@ -58,9 +59,9 @@ class UploadHandler
);
$this->options = array(
'script_url' => $this->get_full_url().'/',
'upload_dir' => dirname($this->get_server_var('SCRIPT_FILENAME')).'/files/',
'upload_url' => $this->get_full_url().'/files/',
'script_url' => $this->get_full_url() . '/',
'upload_dir' => dirname($this->get_server_var('SCRIPT_FILENAME')) . '/files/',
'upload_url' => $this->get_full_url() . '/files/',
'user_dirs' => false,
'mkdir_mode' => 0755,
'param_name' => 'files',
@ -179,14 +180,15 @@ class UploadHandler
}
}
protected function initialize() {
protected function initialize()
{
switch ($this->get_server_var('REQUEST_METHOD')) {
case 'OPTIONS':
case 'HEAD':
$this->head();
break;
case 'GET':
if( isset($_GET['del']) && $_GET['del'] ){
if (isset($_GET['del']) && $_GET['del']) {
$this->delete();
} else {
$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;
return
($https ? 'https://' : 'http://').
(!empty($_SERVER['REMOTE_USER']) ? $_SERVER['REMOTE_USER'].'@' : '').
(isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ($_SERVER['SERVER_NAME'].
($https ? 'https://' : 'http://') .
(!empty($_SERVER['REMOTE_USER']) ? $_SERVER['REMOTE_USER'] . '@' : '') .
(isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ($_SERVER['SERVER_NAME'] .
($https && $_SERVER['SERVER_PORT'] === 443 ||
$_SERVER['SERVER_PORT'] === 80 ? '' : ':'.$_SERVER['SERVER_PORT']))).
substr($_SERVER['SCRIPT_NAME'],0, strrpos($_SERVER['SCRIPT_NAME'], '/'));
$_SERVER['SERVER_PORT'] === 80 ? '' : ':' . $_SERVER['SERVER_PORT']))) .
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;
if(session_id() == '') {
if (session_id() == '') {
@session_start();
}
$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']) {
return $this->get_user_id(false).'/';
return $this->get_user_id(false) . '/';
}
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 : '';
if (empty($version)) {
$version_path = '';
} else {
$version_dir = @$this->options['image_versions'][$version]['upload_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()
.$version_path.$file_name;
return $this->options['upload_dir'] . $this->get_user_path()
. $version_path . $file_name;
}
protected function get_query_separator($url) {
protected function get_query_separator($url)
{
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']) {
$url = $this->options['script_url']
.$this->get_query_separator($this->options['script_url'])
.$this->get_singular_param_name()
.'='.rawurlencode($file_name);
. $this->get_query_separator($this->options['script_url'])
. $this->get_singular_param_name()
. '=' . rawurlencode($file_name);
if ($version) {
$url .= '&version='.rawurlencode($version);
$url .= '&version=' . rawurlencode($version);
}
return $url.'&download=1';
return $url . '&download=1';
}
if (empty($version)) {
$version_path = '';
} else {
$version_url = @$this->options['image_versions'][$version]['upload_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()
.$version_path.rawurlencode($file_name);
return $this->options['upload_url'] . $this->get_user_path()
. $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']
.$this->get_query_separator($this->options['script_url'])
.$this->get_singular_param_name()
.'='.rawurlencode($file->name);
. $this->get_query_separator($this->options['script_url'])
. $this->get_singular_param_name()
. '=' . rawurlencode($file->name);
$file->deleteType = $this->options['delete_type'];
if ($file->deleteType !== 'DELETE') {
$file->deleteUrl .= '&_method=DELETE';
@ -293,14 +302,16 @@ class UploadHandler
// Fix for overflowing signed 32 bit integers,
// 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) {
$size += 2.0 * (PHP_INT_MAX + 1);
}
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 (version_compare(PHP_VERSION, '5.3.0') >= 0) {
clearstatcache(true, $file_path);
@ -311,7 +322,8 @@ class UploadHandler
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);
if (is_file($file_path) && $file_name[0] !== '.') {
return true;
@ -319,7 +331,8 @@ class UploadHandler
return false;
}
protected function get_file_object($file_name) {
protected function get_file_object($file_name)
{
if ($this->is_valid_file_object($file_name)) {
$file = new \stdClass();
$file->name = iconv('UTF-8', 'UTF-8//IGNORE', $file_name);
@ -330,10 +343,10 @@ class UploadHandler
$file->width = $img_width_height[0];
$file->height = $img_width_height[1];
$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 (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,
$version
);
@ -346,7 +359,8 @@ class UploadHandler
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();
if (!is_dir($upload_dir)) {
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'));
}
protected function get_error_message($error) {
protected function get_error_message($error)
{
return array_key_exists($error, $this->error_messages) ?
$this->error_messages[$error] : $error;
}
function get_config_bytes($val) {
function get_config_bytes($val)
{
$val = trim($val);
$val_strlen = strlen($val)-1;
$val_strlen = strlen($val) - 1;
$last = isset($val[$val_strlen]) ? strtolower($val[$val_strlen]) : '';
$bytes = (int) preg_replace('/[^0-9]/', '', $val);
switch($last) {
switch ($last) {
case 'g':
$bytes *= 1024;
case 'm':
@ -383,7 +400,8 @@ class UploadHandler
return $this->fix_integer_overflow($bytes);
}
protected function validate($uploaded_file, $file, $error, $index) {
protected function validate($uploaded_file, $file, $error, $index)
{
if ($error) {
$file->error = $this->get_error_message($error);
return false;
@ -406,22 +424,27 @@ class UploadHandler
} else {
$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->error = $this->get_error_message('max_file_size');
return false;
}
if ($this->options['min_file_size'] &&
$file_size < $this->options['min_file_size']) {
if (
$this->options['min_file_size'] &&
$file_size < $this->options['min_file_size']
) {
$file->error = $this->get_error_message('min_file_size');
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']) &&
// 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');
return false;
}
@ -429,8 +452,10 @@ class UploadHandler
$max_height = @$this->options['max_height'];
$min_width = @$this->options['min_width'];
$min_height = @$this->options['min_height'];
if (($max_width || $max_height || $min_width || $min_height)
&& preg_match($this->options['image_file_types'], $file->name)) {
if (
($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);
}
@ -455,13 +480,15 @@ class UploadHandler
return true;
}
protected function upcount_name_callback($matches) {
protected function upcount_name_callback($matches)
{
$index = isset($matches[1]) ? intval($matches[1]) + 1 : 1;
$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(
'/(?:(?: \(([\d]+)\))?(\.[^.]+))?$/',
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) {
while(is_dir($this->get_upload_path($name))) {
protected function get_unique_filename($file_path, $name, $size, $type, $error, $index, $content_range)
{
while (is_dir($this->get_upload_path($name))) {
$name = $this->upcount_name($name);
}
$content_range_byte = isset($content_range[1]) ? (int) $content_range[1] : 0;
// Keep an existing filename if this is part of a chunked upload:
$uploaded_bytes = $this->fix_integer_overflow($content_range_byte);
while(is_file($this->get_upload_path($name))) {
if ($uploaded_bytes === $this->get_file_size(
$this->get_upload_path($name))) {
while (is_file($this->get_upload_path($name))) {
if (
$uploaded_bytes === $this->get_file_size(
$this->get_upload_path($name)
)
) {
break;
}
$name = $this->upcount_name($name);
@ -488,7 +519,8 @@ class UploadHandler
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
// into different directories or replacing hidden system files.
// Also remove control characters and spaces (\x00..\x20) around the filename:
@ -498,12 +530,14 @@ class UploadHandler
$name = str_replace('.', '-', microtime(true));
}
// Add missing file extension for known image types:
if (strpos($name, '.') === false &&
preg_match('/^image\/(gif|jpe?g|png|webp)/', $type, $matches)) {
$name .= '.'.$matches[1];
if (
strpos($name, '.') === false &&
preg_match('/^image\/(gif|jpe?g|png|webp)/', $type, $matches)
) {
$name .= '.' . $matches[1];
}
if (function_exists('exif_imagetype') && $file_path) {
switch(@exif_imagetype($file_path)){
switch (@exif_imagetype($file_path)) {
case IMAGETYPE_JPEG:
$extensions = array('jpg', 'jpeg');
break;
@ -531,7 +565,8 @@ class UploadHandler
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(
$file_path,
$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]
}
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);
if (!empty($version)) {
$version_dir = $this->get_upload_path(null, $version);
if (!is_dir($version_dir)) {
mkdir($version_dir, $this->options['mkdir_mode'], true);
}
$new_file_path = $version_dir.'/'.$file_name;
$new_file_path = $version_dir . '/' . $file_name;
} else {
$new_file_path = $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) {
$this->gd_destroy_image_object($file_path);
$this->image_objects[$file_path] = $func($file_path);
@ -569,17 +607,20 @@ class UploadHandler
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->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];
return $image && imagedestroy($image);
}
protected function gd_imageflip($image, $mode) {
protected function gd_imageflip($image, $mode)
{
if (function_exists('imageflip')) {
return imageflip($image, $mode);
}
@ -621,7 +662,8 @@ class UploadHandler
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')) {
return false;
}
@ -678,7 +720,8 @@ class UploadHandler
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')) {
error_log('Function not found: imagecreatetruecolor');
return false;
@ -719,10 +762,12 @@ class UploadHandler
!empty($options['no_cache'])
);
$image_oriented = false;
if (!empty($options['auto_orient']) && $this->gd_orient_image(
if (
!empty($options['auto_orient']) && $this->gd_orient_image(
$file_path,
$src_img
)) {
)
) {
$image_oriented = true;
$src_img = $this->gd_get_image_object(
$file_path,
@ -794,7 +839,8 @@ class UploadHandler
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) {
$this->imagick_destroy_image_object($file_path);
$image = new \Imagick();
@ -809,17 +855,20 @@ class UploadHandler
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->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];
return $image && $image->destroy();
}
protected function imagick_orient_image($image) {
protected function imagick_orient_image($image)
{
$orientation = $image->getImageOrientation();
$background = new \ImagickPixel('none');
switch ($orientation) {
@ -853,7 +902,8 @@ class UploadHandler
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) =
$this->get_scaled_image_file_paths($file_name, $version);
$image = $this->imagick_get_image_object(
@ -933,11 +983,12 @@ class UploadHandler
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) =
$this->get_scaled_image_file_paths($file_name, $version);
$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 ($file_path !== $new_file_path) {
return copy($file_path, $new_file_path);
@ -946,9 +997,9 @@ class UploadHandler
}
$cmd = $this->options['convert_bin'];
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'])) {
$cmd .= ' -auto-orient';
}
@ -956,19 +1007,19 @@ class UploadHandler
// Handle animated GIFs:
$cmd .= ' -coalesce';
if (empty($options['crop'])) {
$cmd .= ' -resize '.escapeshellarg($resize.'>');
$cmd .= ' -resize ' . escapeshellarg($resize . '>');
} else {
$cmd .= ' -resize '.escapeshellarg($resize.'^');
$cmd .= ' -resize ' . escapeshellarg($resize . '^');
$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):
$cmd .= ' +repage';
}
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);
if ($error) {
error_log(implode('\n', $output));
@ -977,7 +1028,8 @@ class UploadHandler
return true;
}
protected function get_image_size($file_path) {
protected function get_image_size($file_path)
{
if ($this->options['image_library']) {
if (extension_loaded('imagick')) {
$image = new \Imagick();
@ -994,7 +1046,7 @@ class UploadHandler
}
if ($this->options['image_library'] === 2) {
$cmd = $this->options['identify_bin'];
$cmd .= ' -ping '.escapeshellarg($file_path);
$cmd .= ' -ping ' . escapeshellarg($file_path);
exec($cmd, $output, $error);
if (!$error && !empty($output)) {
// 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);
}
protected function create_scaled_image($file_name, $version, $options) {
protected function create_scaled_image($file_name, $version, $options)
{
if ($this->options['image_library'] === 2) {
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);
}
protected function destroy_image_object($file_path) {
protected function destroy_image_object($file_path)
{
if ($this->options['image_library'] && extension_loaded('imagick')) {
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)) {
return false;
}
@ -1039,12 +1094,13 @@ class UploadHandler
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();
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 (!empty($version)) {
$file->{$version.'Url'} = $this->get_download_url(
$file->{$version . 'Url'} = $this->get_download_url(
$file->name,
$version
);
@ -1057,26 +1113,29 @@ class UploadHandler
}
if (count($failed_versions)) {
$file->error = $this->get_error_message('image_resize')
.' ('.implode(', ', $failed_versions).')';
. ' (' . implode(', ', $failed_versions) . ')';
}
// Free memory:
$this->destroy_image_object($file_path);
}
protected function get_microtime(){
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
protected function get_microtime()
{
list($usec, $sec) = explode(" ", microtime());
return ((float) $usec + (float) $sec);
}
protected function get_file_passname(){
$tmp_name = $this->get_user_id().$_SERVER['REMOTE_ADDR'];
protected function get_file_passname()
{
$tmp_name = $this->get_user_id() . $_SERVER['REMOTE_ADDR'];
$tmp_name = md5(sha1($tmp_name));
return $tmp_name;
}
protected function reprocessImage($file_path, $callback)
{
if( ! $file_path ) return;
if (!$file_path)
return;
// Extracting mime type using getimagesize
try {
@ -1123,18 +1182,19 @@ class UploadHandler
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->oriname = $this->get_file_name($uploaded_file, $name, $size, $type, $error, $index, $content_range);
$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->size = $this->fix_integer_overflow(intval($size));
$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');
return $file;
}
@ -1170,7 +1230,8 @@ class UploadHandler
$file_size = $this->get_file_size($file_path, $append_file);
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) {
}
@ -1181,11 +1242,11 @@ class UploadHandler
$this->files[] = $file->name;
if( $this->options['is_resize'] ){
if ($this->options['is_resize']) {
$resize_options = array(
'max_width'=>$this->options['resize_max_width'],
'max_height'=>$this->options['resize_max_height'],
'jpeg_quality'=>$this->options['resize_jpeg_compress'],
'max_width' => $this->options['resize_max_width'],
'max_height' => $this->options['resize_max_height'],
'jpeg_quality' => $this->options['resize_jpeg_compress'],
'auto_orient' => true,
);
@ -1198,7 +1259,7 @@ class UploadHandler
$file->width = $image_width_height[0];
$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);
}
} else { //로빈아빠님이 알려주심, 이미지 업로드 체크
@ -1218,7 +1279,8 @@ class UploadHandler
return $file;
}
protected function readfile($file_path) {
protected function readfile($file_path)
{
$file_size = $this->get_file_size($file_path);
$chunk_size = $this->options['readfile_chunk_size'];
if ($chunk_size && $file_size > $chunk_size) {
@ -1234,26 +1296,30 @@ class UploadHandler
return readfile($file_path);
}
protected function body($str) {
protected function body($str)
{
echo $str;
}
protected function header($str) {
protected function header($str)
{
header($str);
}
protected function get_server_var($id) {
protected function get_server_var($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) {
$json = json_encode($content);
$redirect = isset($_REQUEST['redirect']) ?
stripslashes($_REQUEST['redirect']) : null;
if ($redirect) {
$this->header('Location: '.sprintf($redirect, rawurlencode($json)));
$this->header('Location: ' . sprintf($redirect, rawurlencode($json)));
return;
}
$this->head();
@ -1261,7 +1327,7 @@ class UploadHandler
$files = isset($content[$this->options['param_name']]) ?
$content[$this->options['param_name']] : null;
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
));
}
@ -1271,20 +1337,24 @@ class UploadHandler
return $content;
}
protected function get_version_param() {
protected function get_version_param()
{
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);
}
protected function get_file_name_param() {
protected function get_file_name_param()
{
$name = $this->get_singular_param_name();
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']]) ?
$_GET[$this->options['param_name']] : array();
foreach ($params as $key => $value) {
@ -1293,7 +1363,8 @@ class UploadHandler
return $params;
}
protected function get_file_type($file_path) {
protected function get_file_type($file_path)
{
switch (strtolower(pathinfo($file_path, PATHINFO_EXTENSION))) {
case 'jpeg':
case 'jpg':
@ -1309,7 +1380,8 @@ class UploadHandler
}
}
protected function download() {
protected function download()
{
switch ($this->options['download_via_php']) {
case 1:
$redirect_header = null;
@ -1329,7 +1401,7 @@ class UploadHandler
}
if ($redirect_header) {
return $this->header(
$redirect_header.': '.$this->get_download_url(
$redirect_header . ': ' . $this->get_download_url(
$file_name,
$this->get_version_param(),
true
@ -1341,17 +1413,18 @@ class UploadHandler
$this->header('X-Content-Type-Options: nosniff');
if (!preg_match($this->options['inline_file_types'], $file_name)) {
$this->header('Content-Type: application/octet-stream');
$this->header('Content-Disposition: attachment; filename="'.$file_name.'"');
$this->header('Content-Disposition: attachment; filename="' . $file_name . '"');
} else {
$this->header('Content-Type: '.$this->get_file_type($file_path));
$this->header('Content-Disposition: inline; filename="'.$file_name.'"');
$this->header('Content-Type: ' . $this->get_file_type($file_path));
$this->header('Content-Disposition: inline; filename="' . $file_name . '"');
}
$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('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->readfile($file_path);
}
protected function send_content_type_header() {
protected function send_content_type_header()
{
$this->header('Vary: Accept');
if (strpos($this->get_server_var('HTTP_ACCEPT'), 'application/json') !== false) {
$this->header('Content-type: application/json');
@ -1360,17 +1433,19 @@ class UploadHandler
}
}
protected function send_access_control_headers() {
$this->header('Access-Control-Allow-Origin: '.$this->options['access_control_allow_origin']);
protected function send_access_control_headers()
{
$this->header('Access-Control-Allow-Origin: ' . $this->options['access_control_allow_origin']);
$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: '
.implode(', ', $this->options['access_control_allow_methods']));
. implode(', ', $this->options['access_control_allow_methods']));
$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('Cache-Control: no-store, no-cache, must-revalidate');
$this->header('Content-Disposition: inline; filename="files.json"');
@ -1382,7 +1457,8 @@ class UploadHandler
$this->send_content_type_header();
}
public function get($print_response = true) {
public function get($print_response = true)
{
//보안 이슈로 인해 사용하지 않습니다.
/*
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') {
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 */
$file_names = $this->get_file_names_params();
if (empty($file_names)) {
$file_names = array($this->get_file_name_param());
}
$response = array();
foreach($file_names as $file_name) {
if( substr($file_name, 0 , 32) != $this->get_file_passname() ) continue; //session_id() 와 비교하여 틀리면 지우지 않음
foreach ($file_names as $file_name) {
if (substr($file_name, 0, 32) != $this->get_file_passname())
continue; //session_id() 와 비교하여 틀리면 지우지 않음
$file_path = $this->get_upload_path($file_name);
$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);
}
if ($success) {
foreach($this->options['image_versions'] as $version => $options) {
foreach ($this->options['image_versions'] as $version => $options) {
if (!empty($version)) {
$file = $this->get_upload_path($file_name, $version);
if (is_file($file)) {

View file

@ -11,11 +11,12 @@
*/
include_once("./_common.php");
if( !function_exists('json_encode') ) {
if (!function_exists('json_encode')) {
@include_once("./JSON.php");
function json_encode($data) {
function json_encode($data)
{
$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);
$data_dir = G5_DATA_PATH.'/editor/'.$ym.'/';
$data_url = G5_DATA_URL.'/editor/'.$ym.'/';
$data_dir = G5_DATA_PATH . '/editor/' . $ym . '/';
$data_url = G5_DATA_URL . '/editor/' . $ym . '/';
@mkdir($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');
}
$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;
}
if( $is_editor_upload ) {
if ($is_editor_upload) {
run_event('smarteditor_photo_upload', $data_dir, $data_url);
@ -49,12 +50,12 @@ if( $is_editor_upload ) {
'upload_url' => $data_url,
// 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
'image_versions' => array()
'image_versions' => []
);
$upload_handler = new UploadHandler($options);
} else {
echo json_encode(array('files'=>array('0'=>array('error'=>'정상적인 업로드가 아닙니다.'))));
echo json_encode(array('files' => array('0' => array('error' => $_GET['_nonce']))));
exit;
}

View file

@ -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 = "&nbsp;";
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 = "&nbsp;";
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);
}
};

View file

@ -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);
};
}

View file

@ -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);

View file

@ -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;
}
}
};
}