Typeadmin.js
3.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/**
* @package anc_image
* @since 20140416
* @copyright (c) netz.coop eG
* @author netz.coop eG
*/
//$.noConflict();
var Anc_Image_Typeadmin = {
"pastDraggable" : "",
/**
*
* @param element param_dropzone_element - welches die dropzone darstellen soll
* @param element param_input_element - optional - set input.value - bekommt die rückgabe id vom hochgeladenen bild
* @param string param_url_upload - url die das bild entgegen nimmt
* @param element param_note_element - rückgabe notiz (fehler, erfolgreich)
* @returns {undefined}
*/
"droppableFile" : function(param_dropzone_element, param_input_element, param_url_upload, param_note_element, param_url_simpleowngallery,param_secure) {
/**
* fnc teil der die dateien aus dem dateiexplorer entgegen nimmt
*/
param_dropzone_element.dropzone({
url: param_url_upload,
paramName: "file", // The name that will be used to transfer the file
maxFilesize: 50, // MB
maxFiles: 10,
params: { form_key : param_secure },
// maxfilesexceeded: function(file) { },
processing: function(file) {
jQuery(" button.button ").attr("disabled", "disabled");
param_note_element.append('<div>Bild wird hochgeladen. Bitte warten!</div>');
jQuery(" > .preview-database-image ", param_dropzone_element).remove();
jQuery(" > img ", param_dropzone_element).remove();
this.removeAllFiles();
},
init: function() {
this.on("complete", function (file) {
if (this.getUploadingFiles().length === 0 && this.getQueuedFiles().length === 0) {
// alert('file.width: '+file.width+' file.height: '+file.height);
}
});
this.on("success", function(file,rep) {
var reponse = jQuery.parseJSON( rep );
if(param_input_element) {
param_input_element.attr('value', reponse.id);
}
if(reponse.status === 'OK') {
var noteclass = 'anc-success';
jQuery(".anc-image-owngallery-content .anc-image-owngallery-content-view").load(param_url_simpleowngallery, function() {});
} else {
var noteclass = 'anc-error';
}
jQuery(" button.button ").attr("disabled", false);
jQuery(" div ", param_note_element).remove();
param_note_element.append('<div class="'+noteclass+'">'+reponse.message+'</div>');
});
}
});
// var droppable_opt = {
// accept:".anc-image-draggable",
// tolerance: 'touch',
//
// drop: function(typ, ui) {
// var currentDraggable = jQuery(ui.draggable).attr('id');
// jQuery(this).append(jQuery(ui.draggable).clone());
// if(param_input_element) {
// param_input_element.attr('value', ui.draggable.attr('id'));
// }
// jQuery(" > div ", param_dropzone_element).remove();
//
// //If there is an object prior to the current one
// if (this.pastDraggable != "") {
// jQuery("#" + this.pastDraggable).remove(); //Place past object into its original coordinate
// }
// this.pastDraggable = currentDraggable;
// },
// activate: function(typ, ui) {},
// deactivate: function(typ, ui) {},
// over: function(typ, ui) {},
// out: function(typ, ui) {
// jQuery(ui.draggable).remove(); // jQuery(this).droppable('option', 'accept', '.anc-image-draggable');
// },
// }
// param_dropzone_element.droppable(droppable_opt);
},
}