customer_showncimageform.phtml
4.54 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<!--
/**
* Anc_Image_CustomerController::showncimageformAction() template
* @var $this anc_image/galleriesmanager (Anc_Image_Block_Galleriesmanager)
*
* @package anc_image
* @anc_image_eingabetyp -- Formular bzw ansicht im Frontend im Warenkorb beim Produkt konfigurieren
* @copy Grundlage: Magento18/app/design/frontend/base/default/template/catalog/product/view/options/type/text.phtml
* @since 20140416
* @author netz.coop eG*
*/
-->
<?php
$ncimage = $this->getCallNcImage();
$path = Mage::helper('anc_image/ncimage')->getNcImagePath($ncimage->getId(), 'relative', 'original');
// $ncimage_data = mcImagick::getData(Mage::getBaseDir().$path);
$ncimage_data = mcImagick::getData(Mage::helper('anc_lib/ncfilepath')->getThisMagentoInstallationPath().$path);
$dropzone_id = 'ancimage-dropzone-id';
$ancnote_id = '#ancnote';
?>
<form action="<?php echo $this->getUrl('ancimage/customer/showNcImageForm', array('id'=>$ncimage->getId())); ?>" id="ancimage-customer_showNcImageForm">
<div class="anctable showncimageform">
<div id="ancnote"></div>
<div class="ancimage" >
<div id="<?php echo $dropzone_id; ?>" class="dropzone ancimage-dropzone">
<div class="preview-database-image">
<?php if($path):?>
<img src="<?php echo DS.$path; ?>" />
<?php endif; ?>
</div>
</div>
</div>
<div class="fileinfos anctablerow">
<div class="label">Dateiinfos:</div>
<div class="value">Breite: <?php echo $ncimage_data['width']?> px - Höhe: <?php echo $ncimage_data['height']; ?> px - Dateigröße: <?php echo mcFile::binary_multiples($ncimage_data['size']); ?> </div>
</div>
<div class="name anctablerow">
<div class="label">Name:</div>
<div class="value"><input name="name" type="text" size="30" maxlength="30" value="<?php echo $ncimage->getName(); ?>" /></div>
</div>
<div class="comment anctablerow">
<div class="label">Kommentar:</div>
<div class="value"><textarea name="comment" cols="50" rows="5" ><?php echo $ncimage->getComment(); ?></textarea></div>
</div>
<div class="anctablerow buttons">
<div class="label"></div>
<div class="value">
<?php $buttonTitle = 'lösche Datei'; ?>
<input class="button delete" title="<?php echo $this->__($buttonTitle) ?>" type="submit" value="<?php echo $this->__($buttonTitle) ?>" />
<?php $buttonTitle = 'speichern'; ?>
<input class="button save" title="<?php echo $this->__($buttonTitle) ?>" type="submit" value="<?php echo $this->__($buttonTitle) ?>" />
</div>
</div>
<script type="text/javascript">
jQuery('.buttons > .delete').unbind("click").click(function(e){
e.preventDefault();
jQuery.ajax({ // create an AJAX call...
url: '<?php echo $this->getUrl('ancimage/customer/deleteNcImage', array('id'=>$ncimage->getId())); ?>', // the file to call
success: function(rep) { // on success..
var reponse = jQuery.parseJSON( rep );
jQuery('#ancnote').append(reponse.message);
jQuery('#ancnote').addClass('anc-error');
jQuery('#ancimage-customer_showNcImageForm').hide();
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(data) {
jQuery(this).html(data);
// damit die gallerie auch klickbar ist
loadNcImageIntoFormThumbnailButton();
Anc_Image_Type.customerGallerysimplePrettyPhoto();
},
};
jQuery.ajax(gallery_ajaxData);
}
});
});
</script>
</div>
</form>
<script type="text/javascript">
jQuery(document).ready(function($) {
var dropzone_params = {
url: "<?php echo $this->getUrl('ancimage/customer/uploadImage', array('id'=> $ncimage->getId())) ?>",
dictDefaultMessage: '',
success: function(file, rep) {
var reponse = jQuery.parseJSON( rep );
this.removeAllFiles();
jQuery('#<?php echo $dropzone_id; ?> > .preview-database-image').append('<img src="'+reponse.path+'" />');
}
};
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() {
loadNcImageIntoFormThumbnailButton();
},
};
Anc_Image_Type.droppableFile(
jQuery(" #<?php echo $dropzone_id; ?>"),
dropzone_params,
null,
jQuery(" <?php echo $ancnote_id; ?>"),
gallery_ajaxData,
false
);
});
</script>