customer_galleriesmanager.phtml 5.7 KB
<script type="text/javascript">


	function loadNcTextIntoFormThumbnailButton() {
		console.log('loadNcTextIntoFormThumbnailButton');
		jQuery('.anc_text_choose').unbind("click").click(function(e) {
			e.preventDefault();
			
			loadNcTextIntoForm(jQuery(this).data('site'), jQuery(this).data('anc_text_id'));
		});
	}
	function loadNcTextIntoForm(param_url, param_id) {
		
		console.log(param_url);
		console.log(param_id);
		console.log('loadNcTextIntoForm');
//		ajax_gettextinfo(param_id);
		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 Texte</h1></div>
					<div class="anctext-customer_galleriesmanager-content" id="anctext-customer_galleriesmanager-form-content">

						<input type="hidden" onchange="opConfig.reloadPrice()" id="anc_text_id" data-info="toll" class="data-anc_text_id" name="data-anc_text_id_options" value="<?php echo ''; ?>" />
						<input type="hidden" onchange="opConfig.reloadPrice()" id="anc_customer_id" class="data-anc_customer_id" name="data-anc_customer_id_options" value="<?php echo ''; ?>" />
						<input type="hidden" onchange="opConfig.reloadPrice()" id="anc_admin_id" class="data-anc_admin_id" name="data-anc_admin_id_options" value="<?php echo ''; ?>" />
						<input type="hidden" onchange="opConfig.reloadPrice()" id="ncalbum_id" class="data-ncalbum_id" name="data-anc_admin_id_options" value="<?php echo ''; ?>" />
						<input type="hidden" onchange="opConfig.reloadPrice()" id="used_byitem_id" class="data-used_byitem_id" name="data-used_byitem_id_options" value="<?php echo ''; ?>" />
						<input type="hidden" onchange="opConfig.reloadPrice()" id="ordered" class="data-ordered" name="data-ordered_options" value="<?php echo ''; ?>" />

					</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/createText', array()) ?>",
							dictDefaultMessage: 'Text erstellen',
							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+'/');
							},
						};
 jQuery('div.wrapper div.page div.main-container.col2-right-layout div.main div.col-main div.anctext-customer_galleriesmanager div.col2-set div.col-2 div.anctext-customer_galleries.anc-menu-box div#accordion.anc-menu-box-content.ui-accordion.ui-widget.ui-helper-reset div#ui-id-2.anc-menu-box-content-subcontent.ui-accordion-content.ui-helper-reset.ui-widget-content.ui-corner-bottom.ui-accordion-content-active div.anctext-customer_galleriesown div.anctext-gallerie-subheader div.anctext-gallerie-subheader-category').append('<div id="createtext" ><a class="anc_text_choose" href="#" data-site="<?php echo Mage::getBaseUrl ();?>anctext/customer/showNcTextForm/id/0/">Text erstellen</a></div>');
//						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>