1var Login = new Class( 2{ 3 hReq: null, 4 5 options: 6 { 7 sidebox: 8 { 9 btLogin: null, // tlacitko ze sideboxu 10 btLogout: null, // tlacitko ze sideboxu 11 }, 12 form: // bind formulare 13 { 14 eContent: null, 15 eErrors: null, 16 btSubmit: null, 17 url: null, 18 onSuccess: function(){window.location.href = window.location.href;} 19 }, 20 21 hPopup: null 22 }, 23 24 initialize: function(opts) 25 { 26 Object.append(this.options, opts); 27 28 if(this.options.sidebox.btLogin!=null) this.iniSideboxLogin(); 29 if(this.options.sidebox.btLogout!=null) this.iniSideboxLogout(); 30 if(this.options.form.btSubmit!=null) this.iniFormLogin(); 31 }, 32 33 /** 34 * Zobrazeni login-formu v popupu 35 */ 36 iniSideboxLogin: function() 37 { 38 this.options.sidebox.btLogin.addEvent('click', function() 39 { 40 if(this.hReq == null) 41 { 42 this.hReq = new _ui.AjaxLoad.PopupHtml( 43 { 44 element: this.options.sidebox.btLogin, 45 url: this.options.sidebox.btLogin.get('href'), 46 onSuccess: function(response, hPopup, hReq) 47 { 48 if(response.html) 49 { 50 new _ui.ContentToggler( 51 { 52 element: hPopup.elWindow.getElement('#idForgetContent'), 53 toggler: hPopup.elWindow.getElement('#idForgetToggler') 54 }); 55 } 56 }, 57 hPopup: this.options.hPopup 58 }); 59 } 60 61 this.hReq.send(); 62 return false; 63 }.bind(this)); 64 }, 65 66 /** 67 * Logout uzivatele 68 */ 69 iniSideboxLogout: function() 70 { 71 this.options.sidebox.btLogout.addEvent('click', function() 72 { 73 if(this.hReq == null) 74 { 75 this.hReq = new _ui.AjaxLoad.PopupHtml( 76 { 77 element: this.options.sidebox.btLogout, 78 url: this.options.sidebox.btLogout.get('href'), 79 onSuccess: function(response, hPopup, hReq) 80 { 81 hPopup.showHtml('<div class="cms_confirm">Odhlášenà bylo úspÄÅ¡né<div>'); 82 hPopup.historyRemoveLast(); 83 window.location.href = window.location.href; 84 }, 85 hPopup: this.options.hPopup 86 }); 87 } 88 89 this.hReq.send(); 90 return false; 91 }.bind(this)); 92 }, 93 94 /** 95 * Prihlaseni pres formularem 96 */ 97 iniFormLogin: function() 98 { 99 if(this.options.form.onSuccess==null) 100 { 101 this.options.form.onSuccess = function(){window.location.href = window.location.href;}; 102 } 103 104 this.options.form.btSubmit.addEvent('click', function(event) 105 { 106 (function() 107 { 108 var form = this.options.form.btSubmit.getParent('form'); 109 if(!form || !form.hasClass('fv-haserrors')) 110 { 111 event.stopPropagation(); 112 113 new _ui.AjaxLoad( 114 { 115 element: this.options.form.eContent, 116 type: 'json', 117 url: this.options.form.url, 118 119 loadingOptions: 120 { 121 enabled: true, 122 bgColor: '#fff', 123 124 img: 125 { 126 enabled: true, 127 src: '/layout/img/ui/loading.gif', 128 size: {x: 32, y: 32}, 129 pos: {x: 'center', y: 'center'} 130 } 131 }, 132 133 onLoadStart: function() 134 { 135 this.options.form.eErrors.set('html', '<div class="cms_infobox">Äekejteâ¦</div>'); 136 }.bind(this), 137 onComplete: function(){}, 138 onSuccess: function(response) 139 { 140 this.options.form.eErrors.empty(); 141 if(response.json) 142 { 143 if(response.json.error) 144 { 145 this.options.form.eErrors.set('html', '<div class="cms_error">'+response.json.error_msg+'</div>'); 146 } 147 else 148 { 149 this.options.form.eErrors.set('html', '<div class="cms_confirm">PÅihlášenà bylo úspÄÅ¡né<div>'); 150 this.options.form.onSuccess(); 151 } 152 } 153 }.bind(this) 154 155 }).send({name: form.getElement('.login').get('value'), password: form.getElement('.pass').get('value')}); 156 } 157 }).delay(200, this); 158 159 return false; 160 }.bind(this)); 161 } 162});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.