/** * @namespace Diese Klasse liefert HTML-formatierte Seiten und Aktionen für den * Support zurück. * @author Jan Kossick, jankossick@online.de * @version 2.0 */ var Support = { /** * Zeigt Informationen an. * @param {Object} data Ein Objekt mit den Attributen js, css, main und * side. */ message : function(data) { if(typeof data.content != 'undefined') { // nur sidebar try { //der IE<9 spinnt sonst rum jQuery('#support_css').append(data.css); } catch(ex) {} jQuery('#side .content').empty().append(data.content); } else { //alles try { //der IE<9 spinnt sonst rum jQuery('#support_css').empty().append(data.css); } catch(ex) {} if(typeof data.main != 'undefined') jQuery('#main .content').empty().append(data.main); if(typeof data.side != 'undefined') jQuery('#side .content').empty().append(data.side); } eval(data.js); }, /** * Lädt eine HTML-Seite mit Informationen über YourBash. */ infos : function() { jQuery.post("ajax", { "action": "get_support_infos" }, this.message, "json" ); }, /** * Lädt eine HTML-Seite mit Unterstützungsmäglichkeiten für YourBash. */ support : function() { jQuery.post("ajax", { "action": "get_support_support" }, this.message, "json" ); }, /** * Lädt eine HTML-Seite mit dem Impressum. */ impressum : function() { jQuery.post("ajax", { "action":"get_support_impressum" }, this.message, "json" ); }, /** * Lädt eine HTML-Seite mit dem Feedbackformular. * @param {String} vorlage Eine Textvorlage fürs Feedback. */ feedback : function(vorlage) { if(typeof vorlage == 'undefined') vorlage = ""; jQuery.post("ajax", { "action": "get_support_feedback", "text": vorlage }, this.message, "json" ); }, /** * Übermittelt das Feedback und lädt den Status der Übermittlung. * @param {String} data Serialisierte Formulardaten. */ feedbackSend : function(data) { jQuery.post("ajax", data, this.message, "json"); }, /** * Lädt eine HTML-Seite um einen Yourbash zu erstellen. */ yourbashCreate : function() { jQuery.post("ajax", { "action":"get_support_yourbashcreate" }, this.message, "json" ); }, /** * Übermittelt Daten zur Erstellung eines Yourbashs. * @param {Object} form Das Formular mit den zu sendenden Daten. */ yourbashCreateSend : function(form) { jQuery(form).ajaxSubmit({ dataType: 'json', type: 'post', success: Support.message }); }, /** * Lädt eine HTML-Seite um Yourbashs zu aktualisieren. * @param {String} key Der Schlüssel der Yourbashs. * @param {String} email Die E-Mail der Yourbashs. */ yourbashUpdate : function(a, b) { jQuery.post("ajax", { "action": "get_support_yourbashupdate", 'a': a, 'b': b }, this.message, "json" ); }, /** * Übermittelt Daten zur Aktualisierung eines Yourbashs. * @param {Object} form Das Formular mit den zu sendenden Daten. */ yourbashUpdateSend : function(form, data) { if(typeof data == 'undefined') data = {}; data.captcha_code = jQuery('input[name="captcha_code"]').val(); jQuery(form).ajaxSubmit({ data: data, dataType: 'json', type: 'post', success: Support.yourbashUpdateSendReturn }); }, /** * Verarbeitet die Änderung eines Yourbashs. */ yourbashUpdateSendReturn : function(d) { // Ausgabe var o = { headline : '', message : '' }; // Farben zurücksetzen jQuery('#'+d.domId+' input').css('background-color', 'auto'); //Fehler if(d.success == false) { switch(d.error) { case 'CAPTCHA': jQuery(".captcha").attr("src", "securimage/securimage_show.php?" + Math.random()); jQuery('input[name=\"captcha_code\"]').css('background-color', '#fda').focus(); o.headline = 'Captcha falsch'; o.message = 'Die Eingabe der Captcha-Abfrage stimmte nicht.'; break; case 'HACK': jQuery('#main .content').empty(); jQuery('#side .content').empty(); o.headline = 'Das war ein Hackversuch'; o.message = 'Noch zwei weitere, und Dein Rechner explodiert.'; break; case 'ADDRESS': jQuery('#'+d.domId+' input[name="address"]').css('background-color', '#fda').focus(); o.headline = 'Adresse inkorrekt'; o.message = 'Bitte gebe eine korrekte Adresse ein.'; break; case 'TITLE': jQuery('#'+d.domId+' input[name="title"]').css('background-color', '#fda').focus(); o.headline = 'Titel fehlt'; o.message = 'Bitte gebe einen Titel ein.'; break; case 'TEXT': jQuery('#'+d.domId+' textarea[name="text"]').css('background-color', '#fda').focus(); o.headline = 'Beschreibung fehlt'; o.message = 'Bitte gebe eine Beschreibung ein.'; break; default: o.headline = 'Unbekannter Fehler'; o.message = 'Bitte versuche es später noch einmal.'; } jQuery('#side .content').html( "

" + o.headline + "

" + "

" + o.message + "

" ); } else { // wenn gelöscht, Yourbash aus Liste entfernen if(d.erased == 1) { jQuery('#'+d.domId).remove(); } else { // wenn neu angelegt, dann DOM id ändern if(d.neu == 1) { // DOM id jQuery('#'+d.domId).attr('id', 'yb'+d.id); d.domId = 'yb'+d.id; // new nach id umwandeln und Attribut tauschen jQuery('#'+d.domId+' input[name="new"]').attr('value', d.id).attr('name', 'id'); } // Enabled/Disabled if(d.enabled == 1) { jQuery('#'+d.domId+' .yourbash_content').removeClass('inactive'); jQuery('#'+d.domId+' .visible').removeClass('active').addClass('inactive').attr('value', 'Deaktivieren'); } else { jQuery('#'+d.domId+' .yourbash_content').addClass('inactive'); jQuery('#'+d.domId+' .visible').removeClass('inactive').addClass('active').attr('value', 'Aktivieren'); } // Bild jQuery('#'+d.domId+' .yb_img').attr('src', '/img/id/'+d.imageId+'.png'); // Vorschau var date = new Date(); date.setMySQLDate(d.date) Events.DateStart = date; Events.DateEnd = new Date(Date.parse(Events.DateStart)+1*60*1000); Info.yourbash(d.id, Support.message); } } }, /** * Lädt eine HTML-Seite um einen Doodle zu erstellen. */ doodleCreate : function() { jQuery.post("ajax", { "action":"get_info_doodlecreate" }, this.message, "json" ); }, /** * Übermittelt Daten zur Erstellung eines Doodles und lädt eine HTML-Seite * mit dem Status. */ doodleCreateSend : function(data) { jQuery.post("ajax", data, this.message, "json"); }, /** * Lädt eine HTML-Seite um einen Doodle zu aktualisieren. */ doodleUpdate : function(akey) { jQuery.post("ajax", { "action": "get_info_doodleupdate", 'akey': akey }, this.message, "json" ); }, /** * Übermittelt Daten zur Aktualisierung eines Doodles und lädt eine * HTML-Seite mit dem Status. */ doodleUpdateSend : function(data) { jQuery.post("ajax", data, this.message, "json"); } };