/* * zde jsou fce pro pridani a odebrani blogera z profilu * fce pro zobrazovani blogeru v pravym panelu jsou v bloggers.js */ Event.onDOMReady(function() { // tlacitkum pro pridani a odebrani blogera nastavim obsluznou fci var buttons = $$('a.blogger-button'); buttons.each(function(button) { Event.observe(button,'click', function(event) { button.up('p').down('img.loading').style.display = 'inline'; if(button.hasClassName('add')) { xajax_addBlogger(button.id); } if(button.hasClassName('remove')) { xajax_removeBlogger(button.id); } Event.stop(event); }); }); // tlacitko pro smazani blogu vyvola okynko pro potvrzeni var button = $('blog-delete-button'); if(button) { Event.observe(button, 'click', function(event) { if(! deleteBlogConfirm()) { Event.stop(event); } }); } }); /* * vola se pomoci Ajaxu po pridani/odebrani blogera do/z profilu */ function bloggerDone(objid) { var buttons = $$('a.blogger-button'); buttons.invoke('toggle'); $(objid).up('p').down('img.loading').style.display = 'none'; } /* * funkce pro praci s formularem pro pridani a editaci blogu */ var blog_errors = { 'errors': 'There are following mistakes in the form, please fix them:', 'missing-title': 'Title not specified', 'missing-blog': 'Text not specified' }; var blog_delete_msg = 'Do you realy want to delete this blog? This action is unrevertible!'; /* * kontrola zakladnich povinnych prvku formulare */ function checkBlogForm() { var ok = true; var error = ""; // povinna pole var reqs = ['title', 'blog']; for(i = 0; i < reqs.length; i++) { var req = reqs[i]; var value = $F('blog-' + req).trim(); if(value == '') { ok = false; error += '\n' + blog_errors['missing-' + req]; } } if(! ok) { alert(blog_errors['errors'] + error); return false; } return true; } /* * overeni pro smazani blogu */ function deleteBlogConfirm() { return confirm(blog_delete_msg); }