var candleWindow; var buttonCandle; var candleForm; Ext.onReady(function () { newCandleWindow = function (config) { this.width = 600; this.height = 245; this.title = "Eine Gedenkkerze für Anna Urban entzünden"; this.closeAction = 'hide'; Ext.apply(this,config); newCandleWindow.superclass.constructor.call(this); }; function startAnimation() { Shadowbox.open({ content: 'templates/aspetos/candle/aspetos.swf?imageSource=/images/cache/candleAnimation_246629.jpg&url=javascript:Shadowbox.close()', player: 'swf', title: 'Trauerkerze für Anna Urban', width: 640, height: 480 }); return true; } Ext.extend(newCandleWindow,Ext.Window,{ onActionComplete : function (f, a){ if(a && a.result && a.result.success) { //var path = window.location.pathname; //path = path.substring(0, path.lastIndexOf('/') + 1); candleWindow.enable(); if (a.result.errors.errorMsg.length>0) { Ext.MessageBox.alert('Fehler',a.result.errors.errorMsg); } else { Ext.slide.msg('Gedenkkerze entzündet','Vielen Dank für das Entzünden der Gedenkkerze'); candleForm.reset(); candleWindow.hide(); candleStore.load(); startAnimation(); this.onCapthaCandleChange(); } //window.location = path; // Change this path to redirect to your path //window.location.reload( false ); } }, onActionFailed : function(f,a){ this.onCapthaCandleChange(); candleForm = this.newBookCandlePanel.getForm(); candleWindow.enable(); Ext.MessageBox.alert('Fehler',a.result.errors.errorMsg); if (a.result.errors.id){ var myf = candleForm.findField(a.result.errors.id); if(myf){ myf.focus(); } } //Do Action when Login Failed }, onCapthaCandleChange : function(){ var captchaURL = this.captchaURL; var curr = Ext.get('activateCodeImgCandle'); curr.slideOut('b', {callback: function(){ Ext.get( 'activateCodeImgCandle' ).dom.src= captchaURL+new Date().getTime(); curr.slideIn('t'); }},this); }, initComponent : function () { this.submitUrl = 'jsReturn.php'; this.captchaURL = 'templates/captcha/CaptchaSecurityImages.php?width=160&height=80&characters=4&t='; var source = this.captchaURL+new Date().getTime(); var boxCaptcha = new Ext.BoxComponent({ columnWidth:0.35, autoEl: { tag: 'div', id: 'candleActivationCode', children: [ { html:'Code:' }, { tag:'img', id: 'activateCodeImgCandle', title : 'Zum Neuladen bitte anklicken', src: source } ] }, listeners : { 'click' : function () { alert('test'); } } }); boxCaptcha.on('render',function (){ var curr = Ext.get('activateCodeImgCandle'); curr.on('click',this.onCapthaCandleChange,this); },this); this.newBookCandlePanel = new Ext.form.FormPanel({ frame:true, //height: 100, width: 600, labelWidth: 115, monitorValid:true, region : 'center', id: 'newBookCandlePanel', baseParams : { type: 'saveBookEntry', bookId: 246629 }, bodyStyle:'padding:10px', buttons : [ { id: 'btnSend', text : 'Kerze entzünden', handler: onSubmit }, { id: 'btnClose', text : 'Schließen', handler: myClose } ], items: [ { layout : 'column', items : [ { layout : 'form', columnWidth:.65, layoutConfig: { labelSeparator: '' }, items : [ { id: 'entryNameCandle', fieldLabel: 'Ihr Name', name: 'name', xtype: 'textfield', maxLength: 35, maxLengthText: 'Bitte verwenden Sie 35 oder weniger Zeichen.', //allowBlank: false, anchor:'90%' }, { id: 'emailCandle', fieldLabel: 'Ihre E-Mail (optional)', name: 'email', xtype: 'textfield', maxLength: 100, maxLengthText: 'Bitte verwenden Sie 500 oder weniger Zeichen.', anchor:'90%' }, { id: 'entryAnniversaryReminderCandle', name: 'anniversaryReminderCandle', xtype:'checkbox', hideLabel: true, boxLabel:'JA, ich möchte jährlich am Todestag per E-Mail erinnert werden, meiner Lieben zu gedenken.', checked: false, disabled: false, height: 40 }, { id: 'captchaCodeCandle', fieldLabel: 'Code von rechts', name: 'code', xtype : 'textfield', anchor:'50%' }, { html: '
Das Entzünden von Gedenkkerzen ist kostenlos!' } ] }, boxCaptcha ] } ] ,listeners: { 'actioncomplete': { fn: this.onActionComplete, scope: this }, 'actionfailed': { fn: this.onActionFailed, scope: this } } ,url: this.submitUrl }); candleForm = this.newBookCandlePanel.getForm(); function onSubmit() { candleWindow.disable(); candleForm.submit({ //reset : true }); }; function myClose() { candleForm.reset(); candleWindow.hide(); }; this.layout = "border"; this.items = [ this.newBookCandlePanel ]; newCandleWindow.superclass.initComponent.call(this); } }); candleWindow = new newCandleWindow(); buttonCandle = Ext.get('btnNewBookCandle246629'); buttonCandle.on('click', function(){ candleWindow.show(); }); //loginwindow.show(); });