Skip to content

Commit fb86daf

Browse files
committed
update ueditor
1 parent 18203b5 commit fb86daf

File tree

10 files changed

+61
-41
lines changed

10 files changed

+61
-41
lines changed

publiccms-parent/publiccms-core/src/main/java/com/publiccms/controller/admin/sys/UeditorAdminController.java

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
@Controller
4848
@RequestMapping("ueditor")
4949
public class UeditorAdminController extends AbstractUeditorController {
50-
50+
5151
/**
5252
* @param site
5353
* @return view name
@@ -137,8 +137,8 @@ public Map<String, Object> uploadScraw(@RequestAttribute SysSite site, @SessionA
137137
return getResultMap(false, e.getMessage());
138138
}
139139
} else {
140-
return getResultMap(false,
141-
LanguagesUtils.getMessage(CommonConstants.applicationContext, localeResolver.resolveLocale(request), "verify.notEmpty.file"));
140+
return getResultMap(false, LanguagesUtils.getMessage(CommonConstants.applicationContext,
141+
localeResolver.resolveLocale(request), "verify.notEmpty.file"));
142142
}
143143

144144
}
@@ -153,12 +153,13 @@ public Map<String, Object> uploadScraw(@RequestAttribute SysSite site, @SessionA
153153
@ResponseBody
154154
public Map<String, Object> catchimage(@RequestAttribute SysSite site, @SessionAttribute SysUser admin,
155155
HttpServletRequest request) {
156-
try (CloseableHttpClient httpclient = HttpClients.custom().setDefaultRequestConfig(Constants.defaultRequestConfig)
157-
.build()) {
158-
String[] files = request.getParameterValues(FIELD_NAME + "[]");
159-
if (CommonUtils.notEmpty(files)) {
160-
List<Map<String, Object>> list = new ArrayList<>();
161-
for (String image : files) {
156+
157+
String[] files = request.getParameterValues(FIELD_NAME + "[]");
158+
if (CommonUtils.notEmpty(files)) {
159+
List<Map<String, Object>> list = new ArrayList<>();
160+
for (String image : files) {
161+
try (CloseableHttpClient httpclient = HttpClients.custom().setDefaultRequestConfig(Constants.defaultRequestConfig)
162+
.build()) {
162163
HttpGet httpget = new HttpGet(image);
163164
CloseableHttpResponse response = httpclient.execute(httpget);
164165
HttpEntity entity = response.getEntity();
@@ -191,26 +192,32 @@ public Map<String, Object> catchimage(@RequestAttribute SysSite site, @SessionAt
191192
map.put("url", fileName);
192193
map.put("source", image);
193194
list.add(map);
195+
} else {
196+
Map<String, Object> result = getResultMap(false,
197+
LanguagesUtils.getMessage(CommonConstants.applicationContext,
198+
localeResolver.resolveLocale(request), "verify.custom.fileType"));
199+
list.add(result);
194200
}
195201
}
196202
EntityUtils.consume(entity);
203+
} catch (Exception e) {
204+
log.error(e.getMessage(), e);
205+
Map<String, Object> result = getResultMap(false, LanguagesUtils.getMessage(CommonConstants.applicationContext,
206+
localeResolver.resolveLocale(request), "message.error"));
207+
list.add(result);
197208
}
198-
if (list.isEmpty()) {
199-
return getResultMap(false, LanguagesUtils.getMessage(CommonConstants.applicationContext, localeResolver.resolveLocale(request),
200-
"verify.notEmpty.file"));
201-
} else {
202-
Map<String, Object> map = getResultMap();
203-
map.put("list", list);
204-
return map;
205-
}
209+
}
210+
if (list.isEmpty()) {
211+
return getResultMap(false, LanguagesUtils.getMessage(CommonConstants.applicationContext,
212+
localeResolver.resolveLocale(request), "verify.notEmpty.file"));
206213
} else {
207-
return getResultMap(false, LanguagesUtils.getMessage(CommonConstants.applicationContext, localeResolver.resolveLocale(request),
208-
"verify.notEmpty.file"));
214+
Map<String, Object> map = getResultMap();
215+
map.put("list", list);
216+
return map;
209217
}
210-
} catch (Exception e) {
211-
log.error(e.getMessage(), e);
212-
return getResultMap(false,
213-
LanguagesUtils.getMessage(CommonConstants.applicationContext, localeResolver.resolveLocale(request), "verify.notEmpty.file"));
218+
} else {
219+
return getResultMap(false, LanguagesUtils.getMessage(CommonConstants.applicationContext,
220+
localeResolver.resolveLocale(request), "verify.notEmpty.file"));
214221
}
215222
}
216223

publiccms-parent/publiccms/src/main/resources/templates/admin/cmsFileBackup/list.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@
6464
<td>${a.creationTime?datetime}</td>
6565
<td><@t.fileSize a.size/></td>
6666
<td class="wrap">
67-
<a href="cmsFileBackup/recycle?type=${type!}&paths=${filePath?url}&_csrf=<@tools.csrfToken admin=true/>" class="btnText green" title="<@t.page 'confirm.recycle'/>" target="ajaxTodo"><i class="icon-reply icon-large"></i><@t.page 'button.recycle'/></a>
67+
<#if !a.directory>
68+
<a href="cmsFileBackup/recycle?type=${type!}&paths=${filePath?url}&_csrf=<@tools.csrfToken admin=true/>" class="btnText green" title="<@t.page 'confirm.recycle'/>" target="ajaxTodo"><i class="icon-reply icon-large"></i><@t.page 'button.recycle'/></a>
69+
</#if>
6870
<#if editableSubfix?seq_contains(a.fileName?keep_after_last('.')?lower_case)>
6971
<a href="cmsFileBackup/content?type=${type!}&path=${filePath?url}" class="edit btnText blue" target="navTab" rel="cmsWebBackup/content:${filePath}" title="${a.fileName}"><i class="icon-eye-open"></i><@t.page 'button.view'/></a>
7072
</#if>

publiccms-parent/publiccms/src/main/webapp/resource/plugins/ueditor/dialogs/video/video.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
}
2828

2929
.alignBar .algnLabel{
30-
float:left;
3130
height: 20px;
3231
line-height: 20px;
3332
}

publiccms-parent/publiccms/src/main/webapp/resource/plugins/ueditor/dialogs/video/video.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
<div class="alignBar">
2121
<label class="algnLabel"><var id="lang_input_autoplay"></var></label>
2222
<input id="autoplay" name="autoplay" type="checkbox" value="autoplay"/>
23+
<label class="algnLabel"><var id="lang_input_loop"></var></label>
24+
<input id="loop" name="autoplay" type="checkbox" value="loop"/>
2325
</div>
2426
<div id="tabBodys" class="tabbody">
2527
<div id="video" class="panel focus">

publiccms-parent/publiccms/src/main/webapp/resource/plugins/ueditor/dialogs/video/video.js

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,12 @@
7777
/* 初始化视频标签 */
7878
function initVideo(){
7979
createAlignButton( ["videoFloat", "upload_alignment"] );
80-
addUrlChangeListener($G("videoUrl"), $G("posterUrl"), $G("autoplay"));
80+
addUrlChangeListener($G("videoUrl"), $G("posterUrl"), $G("autoplay"), $G("loop"));
8181
addOkListener();
8282

8383
//编辑视频时初始化相关信息
8484
(function(){
85-
var img = editor.selection.getRange().getClosedNode(),url,poster,autoplay;
85+
var img = editor.selection.getRange().getClosedNode(),url,poster,autoplay,loop;
8686
if(img && img.className){
8787
var hasFakedClass = (img.className == "edui-faked-video"),
8888
hasUploadClass = img.className.indexOf("edui-upload-video")!=-1;
@@ -92,6 +92,7 @@
9292
$G("videoWidth").value = img.width;
9393
$G("videoHeight").value = img.height;
9494
$G("autoplay").checked = autoplay = img.getAttribute("autoplay")||false;
95+
$G("loop").checked = loop = img.getAttribute("loop")||false;
9596
var align = domUtils.getComputedStyle(img,"float"),
9697
parentAlign = domUtils.getComputedStyle(img.parentNode,"text-align");
9798
updateAlignButton(parentAlign==="center"?"center":align);
@@ -100,7 +101,7 @@
100101
isModifyUploadVideo = false;
101102
}
102103
}
103-
createPreviewVideo(url,poster,autoplay);
104+
createPreviewVideo(url,poster,autoplay,loop);
104105
})();
105106
}
106107

@@ -162,7 +163,8 @@
162163
url = $G('videoUrl').value,
163164
align = findFocus("videoFloat","name"),
164165
poster = $G('posterUrl').value,
165-
autoplay = $G('autoplay').checked ;
166+
autoplay = $G('autoplay').checked ,
167+
loop = $G('loop').checked ;
166168
if(!url) return false;
167169
if ( !checkNum( [width, height] ) ) return false;
168170
editor.execCommand('insertvideo', {
@@ -171,7 +173,8 @@
171173
height: height.value,
172174
align: align,
173175
poster : poster,
174-
autoplay : autoplay
176+
autoplay : autoplay,
177+
loop : loop
175178
}, isModifyUploadVideo ? 'upload':null);
176179
}
177180

@@ -183,6 +186,7 @@
183186
height = parseInt($G('upload_height').value, 10) || 480,
184187
align = findFocus("upload_alignment","name") || 'center',
185188
autoplay = $G('autoplay').checked,
189+
loop = $G('loop').checked,
186190
poster = $G('posterUrl').value;
187191
var imageList=[];
188192

@@ -224,7 +228,8 @@
224228
height:height,
225229
align:align,
226230
poster:poster,
227-
autoplay:autoplay
231+
autoplay:autoplay,
232+
loop:loop
228233
});
229234
autoplay=false;
230235
}
@@ -331,15 +336,18 @@
331336
* @param url
332337
* @param poster
333338
*/
334-
function addUrlChangeListener(url, poster, autoplay){
339+
function addUrlChangeListener(url, poster, autoplay, loop){
335340
url.addEventListener( "input", function () {
336-
createPreviewVideo( this.value, poster.value, autoplay.checked );
341+
createPreviewVideo( this.value, poster.value, autoplay.checked, loop.checked );
337342
}, false );
338343
poster.addEventListener( "input", function () {
339-
createPreviewVideo( url.value, this.value, autoplay.checked );
344+
createPreviewVideo( url.value, this.value, autoplay.checked, loop.checked );
340345
}, false );
341346
autoplay.addEventListener( "change", function () {
342-
createPreviewVideo( url.value, poster.value, this.checked);
347+
createPreviewVideo( url.value, poster.value, this.checked, loop.checked );
348+
}, false );
349+
loop.addEventListener( "change", function () {
350+
createPreviewVideo( url.value, poster.value, autoplay.checked, loop.checked );
343351
}, false );
344352
}
345353

@@ -348,7 +356,7 @@
348356
* @param url
349357
* @param poster
350358
*/
351-
function createPreviewVideo(url, poster , autoplay){
359+
function createPreviewVideo(url, poster, autoplay, loop){
352360
if ( !url )return;
353361

354362
var conUrl = convert_url(url);
@@ -358,7 +366,7 @@
358366
var ext = url.substr(url.lastIndexOf('.') + 1);
359367
if(ext == 'ogv') ext = 'ogg';
360368
$G("preview").innerHTML = '<div class="previewMsg"><span>'+lang.urlError+'</span></div>'+
361-
'<video class="previewVideo video-js" controls preload="none" ' + (poster ? ' poster="' + poster + '"': '') + (autoplay ? ' autoplay="' + autoplay + '"': '') +
369+
'<video class="previewVideo video-js" controls preload="none" ' + (poster ? ' poster="' + poster + '"': '') + (autoplay ? ' autoplay="' + autoplay + '"': '') + (loop ? ' loop="' + loop + '"': '') +
362370
' src="' + conUrl + '"' +
363371
' width="' + 420 + '"' +
364372
' height="' + 280 + '">' +

publiccms-parent/publiccms/src/main/webapp/resource/plugins/ueditor/lang/en/en.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ UE.I18N['en'] = {
358358
'lang_videoH':"Height",
359359
'lang_alignment':"Alignment",
360360
'lang_input_autoplay':"Auto play",
361+
'lang_input_loop':"loop",
361362
'lang_input_fileStatus':' No file uploaded!',
362363
'startUpload':{'style':"background:url(upload.png) no-repeat;"},
363364
'lang_videoLoading':" Loading...",

publiccms-parent/publiccms/src/main/webapp/resource/plugins/ueditor/lang/ja-jp/ja-jp.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ UE.I18N['ja-jp'] = {
352352
'lang_videoH':"高さ",
353353
'lang_alignment':"配置",
354354
'lang_input_autoplay':"オートプレイ",
355+
'lang_input_loop':"ループ",
355356
'lang_input_fileStatus':' ファイルをアップロードしていません',
356357
'startUpload':{'style':"background:url(upload.png) no-repeat;"},
357358
'lang_videoLoading':" ビデオの読み込み...",

publiccms-parent/publiccms/src/main/webapp/resource/plugins/ueditor/lang/zh-cn/zh-cn.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ UE.I18N['zh-cn'] = {
357357
'lang_videoH':"高度",
358358
'lang_alignment':"对齐方式",
359359
'lang_input_autoplay':"自动播放",
360+
'lang_input_loop':"循环",
360361
'lang_input_fileStatus':' 当前未上传文件',
361362
'startUpload':{'style':"background:url(upload.png) no-repeat;"},
362363
'lang_videoLoading':" 视频加载中……",
@@ -366,7 +367,6 @@ UE.I18N['zh-cn'] = {
366367
'lang_upload_height':"高度",
367368
'lang_upload_alignment':"对齐方式",
368369
'lang_format_advice':"建议使用mp4格式."
369-
370370
},
371371
'numError':"请输入正确的数值,如123,400",
372372
'floatLeft':"左浮动",

publiccms-parent/publiccms/src/main/webapp/resource/plugins/ueditor/ueditor.all.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

publiccms-parent/publiccms/src/main/webapp/resource/plugins/ueditor/ueditor.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@
414414
header: [],
415415
hr: ['class', 'noshade', 'size', 'style'],
416416
i: ['class', 'style'],
417-
img: ['src', 'alt', 'autoplay', 'poster', 'title', 'width', 'height', 'id', '_src', '_url', 'loadingclass', 'anchorname', 'class', 'data-latex', 'vspace', 'border' ,'word_img', 'style'],
417+
img: ['src', 'alt', 'autoplay', 'loop', 'poster', 'title', 'width', 'height', 'id', '_src', '_url', 'loadingclass', 'anchorname', 'class', 'data-latex', 'vspace', 'border' ,'word_img', 'style'],
418418
ins: ['datetime'],
419419
li: ['class', 'style' , '_src'],
420420
mark: [],

0 commit comments

Comments
 (0)