customer_galleriesmanager_1.phtml 3.86 KB
<script type="text/javascript">
	function loadNcTextIntoFormThumbnailButton() {
		jQuery('.anc_text_choose').unbind("click").click(function(e){
			e.preventDefault(); 					
			loadNcTextIntoForm(jQuery(this).data('site'));
		});				
	}
	function loadNcTextIntoForm(param_url) {
		jQuery(".anctext-customer_galleriesmanager * #anctext-customer_galleriesmanager-form-content").load(param_url, function() {

			jQuery('#anctext-customer_showNcTextFormDelete').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('.anctext-customer_galleriesmanager * #anctext-customer_galleriesmanager-form-content').html(response); // update the DIV
					}
				});
				return false; // cancel original event to prevent form submitting
			});																						
			jQuery('#anctext-customer_showNcTextForm').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('.anctext-customer_galleriesmanager * #anctext-customer_galleriesmanager-form-content').html(response); // update the DIV
					}
				});
				return false; // cancel original event to prevent form submitting
			});												
		});
	}
</script>
<div class="anctext-customer_galleriesmanager">
	<?php if(Mage::getSingleton('customer/session')->isLoggedIn()): ?>
		<div class="col2-set">
			<div class="col-1">
				<div class="anctext-customer_galleriesmanager-form">
					<div class="anctext-customer_galleriesmanager-main"><h1>Ihre Motive</h1></div>
					<div class="anctext-customer_galleriesmanager-content" id="anctext-customer_galleriesmanager-form-content"></div>				
				</div>
			</div>			
			<div class="col-2">
				<?php $dropzone_id = 'anctext-dropzone-id'.Mage::helper('anc_lib/data')->getElementIndexForId(); ?> 
				<?php $ancnote_id = 'ancnote-id'; ?>
				<?php echo $this->getLayout()
								->getBlockSingleton('anc_text/galleriesmanager')
								->setTemplate('anc/text/customer_galleries.phtml')
								->setSelectorIdDropzoneOwn($dropzone_id)
								->toHtml(); ?>
				<script type="text/javascript">
					
					
					
					
					
					
					
					
					jQuery(document).ready(function($) {
						var dropzone_params = {
							url: "<?php echo $this->getUrl('anctext/customer/uploadText', array()) ?>",
							dictDefaultMessage: 'Text hochladen',
							success: function() {	this.removeAllFiles();	}
						}
						var gallery_ajaxData = {
							url: "<?php echo $this->getUrl('anctext/customer/gallerysimple', array()) ?>  ul.gallery",
							context: jQuery(".anctext-customer_galleriesown > .anctext-gallerie-content > .anctext-gallerie-content-view"),
							success: function(reponse) { 
								// damit die gallerie auch klickbar ist
									loadNcTextIntoFormThumbnailButton();	
								// damit hochgeladenes Bild auch im Formular gleich angezeigt wird
									loadNcTextIntoForm('<?php echo $this->getUrl('anctext/customer/showNcTextForm', array())?>id/'+reponse.id+'/');
							},
						};						
						
						Anc_Text_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($) {
				loadNcTextIntoFormThumbnailButton();
			}); 			
		</script>	
	
	<?php else: ?>
		<h1>Bitte loggen Sie sich ein!</h1>
	<?php endif; ?>	
</div>