mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-29 23:32:54 +09:00
Enhanced filebox to add multiple attributes per image and also improved the filebox controlled used for widgets to add multiple images at the same time if you set the parameter allow_multiple=Y
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9929 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
c424fdbceb
commit
41a5b57344
11 changed files with 305 additions and 59 deletions
|
|
@ -182,7 +182,8 @@ function doFillWidgetVars() {
|
|||
jQuery('.filebox')
|
||||
.each(function(){
|
||||
var $this = jQuery(this);
|
||||
var src = $this.siblings('input').eq(0).val();
|
||||
var src = $this.siblings('input').eq(0).val().split(',');
|
||||
|
||||
if (src) $this.trigger('filebox.selected', [src]);
|
||||
})
|
||||
}
|
||||
|
|
@ -206,13 +207,47 @@ jQuery(document).ready(function($){
|
|||
return this.nodeName.toLowerCase() != 'input';
|
||||
})
|
||||
.remove();
|
||||
var htmlCode = "";
|
||||
if(src instanceof Object ) {
|
||||
for(var i=0;i<src.length;i++){
|
||||
if(src[i].id) {
|
||||
htmlCode += '<img src="'+src[i].id+'" alt="" style="border: 1px solid #ccc; padding: 5px; max-height: 200px; max-width: 200px;"><button class="filebox_del text" type="button">'+xe.lang.cmd_delete+'</button>';
|
||||
if(i==0) $(this).siblings('input').val(src[i].id);
|
||||
else {
|
||||
var aux = $(this).siblings('input').val();
|
||||
$(this).siblings('input').val(aux+","+src[i].id);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(src[i]){
|
||||
htmlCode += '<img src="'+src[i]+'" alt="" style="border: 1px solid #ccc; padding: 5px; max-height: 200px; max-width: 200px;"><button class="filebox_del text" type="button">'+xe.lang.cmd_delete+'</button>';
|
||||
if(i==0) $(this).siblings('input').val(src[i]);
|
||||
else {
|
||||
var aux = $(this).siblings('input').val();
|
||||
$(this).siblings('input').val(aux+","+src[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
htmlCode = '<img src="'+src+'" alt="" style="border: 1px solid #ccc; padding: 5px; max-height: 200px; max-width: 200px;"> <button class="filebox_del text" type="button">'+xe.lang.cmd_delete+'</button>';
|
||||
$(this).siblings('input').val(src);
|
||||
}
|
||||
$(this).before(htmlCode);
|
||||
|
||||
$(this).before('<img src="'+src+'" alt="" style="border: 1px solid #ccc; padding: 5px; max-height: 200px; max-width: 200px;"> <button class="filebox_del text" type="button">'+xe.lang.cmd_delete+'</button>');
|
||||
|
||||
$(this).siblings('input').val(src);
|
||||
|
||||
|
||||
$('.filebox_del').bind('click', function(){
|
||||
$(this).siblings('input').val('');
|
||||
var filename = $(this).prev('img').attr("src");
|
||||
var files = $(this).siblings('input').val().split(",");
|
||||
var newInput = "";
|
||||
for(var i=0;i<files.length;i++){
|
||||
if(files[i] != filename) {
|
||||
if(!newInput.length) newInput = files[i];
|
||||
else newInput += ","+files[i];
|
||||
}
|
||||
}
|
||||
$(this).siblings('input').val(newInput);
|
||||
$(this).prev('img').remove();
|
||||
$(this).remove();
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue