function cleanform() { document.adminForm.task.value='cancel'; document.adminForm.submit(); } function set_watch() { if(0==0) { document.getElementById('watch_email_div').removeAttribute('style'); } else { submit_watch(); } } function submit_watch() { var url='index.php?option=com_mconsult&controller=posts&task=submit_watch'; var param='id='+document.adminForm.top.value+'&email='+document.getElementById('watch_email').value; processAjax(param,url,set_submit_watch); } function set_submit_watch(ajax) { document.getElementById('watch_email_div').setAttribute('style','display:none'); alert('Byl jste úspěšně přihlášen ke sledování tématu'); } function set_unwatch() { var url='index.php?option=com_mconsult&controller=posts&task=submit_unwatch'; var param='id='+document.adminForm.top.value; processAjax(param,url,set_submit_unwatch); } function set_submit_unwatch(ajax) { document.getElementById('set_watch').removeAttribute('style'); document.getElementById('set_unwatch').setAttribute('style','display:none'); alert('Byl jste úspěšně odhlášen ze sledování tématu'); } function toggle_bann(id) { if(confirm('Opravdu chcete zakázat/povolit tohoto uživatele?')) { new Request.JSON({ 'url':'index.php?option=com_mconsult&controller=posts&task=toggle_bann', 'method':'post', 'data':'id='+id+'&bann_period='+document.id('bann_period_'+id).getElement('option:selected').value, 'onSuccess':function(json,text) { if(json.state==1) { document.getElementById('bann_user_href_'+id).removeChild(document.getElementById('bann_user_href_'+id).firstChild); document.id('bann_period_'+id).destroy(); } else { alert(json.error); } } }).send(); } } function edit(id) { new Request.JSON({ 'url':'index.php?option=com_mconsult&controller=posts&task=get_detail', 'method':'post', 'data':'id='+id, 'onSuccess':function(json,texts) { window.location.hash='form'; document.id('save_draft').setStyle('display','none'); WFEditor.setContent('text',json.post.text); document.id('username_td').set('text',json.post.username); document.getElementById('parent_id').value=json.post.parent_id; document.getElementById('top').value=json.post.top; document.getElementById('id').value=json.post.id; } }).send(); } function validate_captcha() { var url='index.php?option=com_mconsult&controller=posts&task=validateCaptcha'; var params='captcha='+document.adminForm.captcha.value; processAjax(params,url,do_validation); } function do_validation(ajax) { var xml=ajax.responseXML; if(xml.getElementsByTagName('valid')[0].firstChild.nodeValue=='0') { document.getElementById('captcha_img').src='index.php?option=com_mconsult&controller=posts&task=getCaptchaImg&rnd='+Math.random(); alert('Prosím zkontrolujte si ověřovací kód'); } else { create_preloader(); document.adminForm.task.value="save"; document.adminForm.submit(); } } function set_like_it(id) { var url='index.php?option=com_mconsult&controller=posts&task=set_like_it'; var param='id='+id; processAjax(param,url,function(ajax) { var xml=ajax.responseXML; if(xml.getElementsByTagName('error').length>0) { alert(xml.getElementsByTagName('error')[0].firstChild.nodeValue); } else { var div=document.getElementById('like_div_'+xml.getElementsByTagName('id')[0].firstChild.nodeValue); div.innerHTML=xml.getElementsByTagName('cnt')[0].firstChild.nodeValue; document.getElementById('like_img_'+xml.getElementsByTagName('id')[0].firstChild.nodeValue).src="/poradna/plugins/editors/jce/tiny_mce/plugins/emotions/img/emotions.gif"; div.setAttribute('rel',xml.getElementsByTagName('like_msg')[0].firstChild.nodeValue); div.store('tip:text',div.rel); } }); } function set_not_like_it(id) { var url='index.php?option=com_mconsult&controller=posts&task=set_not_like_it'; var param='id='+id; processAjax(param,url,function(ajax) { var xml=ajax.responseXML; if(xml.getElementsByTagName('error').length>0) { alert(xml.getElementsByTagName('error')[0].firstChild.nodeValue); } else { var div=document.getElementById('dont_like_div_'+xml.getElementsByTagName('id')[0].firstChild.nodeValue); div.innerHTML=xml.getElementsByTagName('cnt')[0].firstChild.nodeValue; document.getElementById('dont_like_img_'+xml.getElementsByTagName('id')[0].firstChild.nodeValue).src="/poradna/plugins/editors/jce/tiny_mce/plugins/emotions/img/smiley-frown.gif"; div.setAttribute('rel',xml.getElementsByTagName('like_msg')[0].firstChild.nodeValue); div.store('tip:text',div.rel); } }); } function check_nick(nick) { var url='index.php?option=com_mconsult&controller=posts&task=check_nick'; var param='nick='+nick; processAjax(param,url,function(ajax) { var xml=ajax.responseXML; if(xml.getElementsByTagName('state')[0].firstChild.nodeValue==1) { alert('Toto jméno nemůžete použít - odpovídá jménu registrovaného uživatele'); document.adminForm.nick.value=""; document.adminForm.nick.focus(); return false; } }); } function toggle_lock(id) { new Request.JSON({ 'url':'index.php?option=com_mconsult&controller=posts&task=toggle_lock', 'data':'id='+id, 'method':'post', 'onSuccess':function(json,text) { if(json.state==1) { document.getElementById('lock_theme').removeChild(document.getElementById('lock_theme').firstChild); document.getElementById('lock_theme').appendChild(document.createTextNode(json.link_text)); if(json.locked==1) { document.getElementById('mc_post').setAttribute('style','display:none'); document.getElementById('locked_msg').removeAttribute('style'); } else { document.getElementById('mc_post').removeAttribute('style'); document.getElementById('locked_msg').setAttribute('style','display:none'); } } else { alert(json.error); } } }).send(); } function add_to_favourites(id) { new Request.JSON({ 'url':'index.php?option=com_mconsult&controller=posts&task=add_to_favourites', 'data':'id='+id, 'method':'post', 'onSuccess':function(json,text) { if(json.state==1) { document.getElementById('add_to_favourites_span').parentNode.removeChild(document.getElementById('add_to_favourites_span')); alert('Příspěvek byl úspěšně přidán mezi oblíbené'); } else { alert(json.error); } } }).send(); } function toggle_state(id) { new Request.JSON({ 'url':'index.php?option=com_mconsult&controller=posts&task=edit_state', 'method':'post', 'data':'id='+id, 'onSuccess':function(json,text) { if(json.state==1) { document.id('edit_state').set('html',json.text); alert('U příspěvku byl úspěšně změněn stav'); } else { alert(json.error); } } }).send(); } function require_post_auth(id) { new Request.JSON({ 'url':'index.php?option=com_mconsult&controller=posts&task=require_post_auth', 'method':'post', 'data':'id='+id, 'onSuccess':function(json,text) { if(json.state==1) { alert('Autorizace příspěvku byla úspěšně odeslána'); document.id('edit_state').set('text','Publikovat téma'); } else { alert(json.error); } } }).send(); } function remove_theme(id) { if(confirm('Opravdu chcete vymazat tento příspěvek')) { window.location.href='https://www.mojestarosti.cz/poradna/index.php?option=com_mconsult&controller=posts&task=remove&id='+id; } } function remove_post(id) { if(confirm('Opravdu chcete vymazat tento příspěvek')) { window.location.href='https://www.mojestarosti.cz/poradna/index.php?option=com_mconsult&controller=posts&task=removeItem&id='+id; } }