customer_galleriesmanager.phtml
3.88 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
93
94
<script type="text/javascript">
function loadNcImageIntoFormThumbnailButton() {
jQuery('.anc_image_choose').unbind("click").click(function(e){
e.preventDefault();
loadNcImageIntoForm(jQuery(this).data('site'));
});
}
function loadNcImageIntoForm(param_url) {
jQuery(".ancimage-customer_galleriesmanager * #ancimage-customer_galleriesmanager-form-content").load(param_url, function() {
jQuery('#ancimage-customer_showNcImageFormDelete').submit(function() { // catch the form's submit event
jQuery.ajax({ // create an AJAX call...
data: jQuery(this).serialize(), // get the form data
type: jQuery(this).attr('method'), // GET or POST
url: jQuery(this).attr('action'), // the file to call
success: function(response) { // on success..
jQuery('.ancimage-customer_galleriesmanager * #ancimage-customer_galleriesmanager-form-content').html(response); // update the DIV
}
});
return false; // cancel original event to prevent form submitting
});
jQuery('#ancimage-customer_showNcImageForm').submit(function() { // catch the form's submit event
jQuery.ajax({ // create an AJAX call...
data: jQuery(this).serialize(), // get the form data
type: jQuery(this).attr('method'), // GET or POST
url: jQuery(this).attr('action'), // the file to call
success: function(response) { // on success..
jQuery('.ancimage-customer_galleriesmanager * #ancimage-customer_galleriesmanager-form-content').html(response); // update the DIV
loadNcImageIntoForm(param_url)
}
});
return false; // cancel original event to prevent form submitting
});
});
}
</script>
<div class="ancimage-customer_galleriesmanager">
<?php if(Mage::getSingleton('customer/session')->isLoggedIn()): ?>
<div class="col2-set">
<div class="col-1">
<div class="ancimage-customer_galleriesmanager-form">
<div class="ancimage-customer_galleriesmanager-main"><h1>Ihre Motive</h1></div>
<div class="ancimage-customer_galleriesmanager-content" id="ancimage-customer_galleriesmanager-form-content"></div>
</div>
</div>
<div class="col-2">
<?php $dropzone_id = 'ancimage-dropzone-id'.Mage::helper('anc_lib/data')->getElementIndexForId(); ?>
<?php $ancnote_id = 'ancnote-id'; ?>
<?php echo $this->getLayout()
->getBlockSingleton('anc_image/galleriesmanager')
->setTemplate('anc/image/customer_galleries.phtml')
->setSelectorIdDropzoneOwn($dropzone_id)
->toHtml(); ?>
<script type="text/javascript">
jQuery(document).ready(function($) {
var dropzone_params = {
url: "<?php echo $this->getUrl('ancimage/customer/uploadImage', array()) ?>",
dictDefaultMessage: 'Bild hochladen',
success: function() { this.removeAllFiles(); }
}
var gallery_ajaxData = {
url: "<?php echo $this->getUrl('ancimage/customer/gallerysimple', array()) ?> ul.gallery",
context: jQuery(".ancimage-customer_galleriesown > .ancimage-gallerie-content > .ancimage-gallerie-content-view"),
success: function(reponse) {
// damit die gallerie auch klickbar ist
loadNcImageIntoFormThumbnailButton();
// damit hochgeladenes Bild auch im Formular gleich angezeigt wird
loadNcImageIntoForm('<?php echo $this->getUrl('ancimage/customer/showNcImageForm', array())?>id/'+reponse.id+'/');
},
};
Anc_Image_Type.droppableFile(
jQuery(" #<?php echo $dropzone_id; ?>"),
dropzone_params,
null,
jQuery(" #<?php echo $ancnote_id; ?>"),
gallery_ajaxData,
false
);
});
</script>
</div>
</div>
<script type="text/javascript">
jQuery(document).ready(function($) {
loadNcImageIntoFormThumbnailButton();
});
</script>
<?php else: ?>
<h1>Bitte loggen Sie sich ein!</h1>
<?php endif; ?>
</div>