// POST EDIT //
function whenCompletedCommentsEdit(){
var post_main_obj = document.getElementById( 'post-id-' + comm_id );
var post_box_top = _get_obj_toppos( post_main_obj );
if ( post_box_top )
{
scroll( 0, post_box_top - 70 );
}
};
function ajax_post_edit( с_id )
{
if ( ! c_cache[ с_id ] || c_cache[ с_id ] == '' )
{
c_cache[ с_id ] = document.getElementById( 'post-id-'+с_id ).innerHTML;
}
var ajax = new dle_ajax();
comm_id = с_id;
ajax.onShow ('');
var varsString = "";
ajax.setVar("id", с_id);
ajax.setVar("action", "edit");
ajax.requestFile = dle_root + "engine/forum/ajax/editpost.php";
ajax.method = 'GET';
ajax.element = 'post-id-'+с_id;
ajax.onCompletion = whenCompletedCommentsEdit;
ajax.sendAJAX(varsString);
return false;
}
function ajax_cancel_post_edit( c_id )
{
if ( n_cache[ c_id ] != "" )
{
document.getElementById( 'post-id-'+c_id ).innerHTML = c_cache[ c_id ];
}
return false;
};
// POST SAVE //
function whenCompletedSavePost(){
c_cache[ comm_edit_id ] = '';
}
function ajax_save_post_edit( c_id )
{
var ajax = new dle_ajax();
comm_edit_id = c_id;
ajax.onShow ('');
var comm_txt = ajax.encodeVAR( document.getElementById('edit-post-'+c_id).value );
var varsString = "post_text=" + comm_txt;
ajax.setVar("id", c_id);
ajax.setVar("action", "save");
ajax.requestFile = dle_root + "engine/forum/ajax/editpost.php";
ajax.method = 'POST';
ajax.element = 'post-id-'+c_id;
ajax.onCompletion = whenCompletedSavePost;
ajax.sendAJAX(varsString);
return false;
};
// ADD POST //
function doAddPost(){
var form = document.getElementById('dle-comments-form');
var post_ajax = new dle_ajax();
closeall();
if (form.post_text.value == '' || form.post_text.value == '')
{
alert ( dle_req_field );
return false;
}
post_ajax.onShow ('');
var varsString = "topic_id=" + form.topic_id.value;
post_ajax.setVar("forum_id", post_ajax.encodeVAR(form.forum_id.value));
post_ajax.setVar("topic_title", post_ajax.encodeVAR(form.topic_title.value));
post_ajax.setVar("post_id", post_ajax.encodeVAR(form.post_id.value));
post_ajax.setVar("post_text", post_ajax.encodeVAR(form.post_text.value));
post_ajax.setVar("name", post_ajax.encodeVAR(form.name.value));
post_ajax.setVar("mail", post_ajax.encodeVAR(form.mail.value));
post_ajax.setVar("skin", dle_skin);
if ( form.sec_code ) {
post_ajax.setVar("sec_code", form.sec_code.value);
}
post_ajax.requestFile = dle_root + "engine/forum/ajax/addpost.php";
post_ajax.method = 'POST';
post_ajax.add_html = true;
post_ajax.execute = true;
post_ajax.element = 'ajax-post';
post_ajax.sendAJAX(varsString);
form.comments.value = '';
}
// DEL POST //
function postDelete(url){
var agree=confirm( 'Вы действительно хотите удалить это сообщение?' );
if (agree)
document.location=url;
};
// DEL TOPIC //
function topicDelete(url){
var agree=confirm( 'Вы действительно хотите удалить эту тему?' );
if (agree)
document.location=url;
};
// TOPIC //
function TopicMenu( tid, forum_url ){
var menu=new Array();
menu[0]='Подписка на тему';
menu[1]='Сообщить другу';
menu[2]='Версия для печати';
return menu;
};
// FORUM //
function ForumMenu( fid, moderation, forum_url ){
var menu=new Array();
if (moderation){
menu[0]='Показать все скрытые темы';
menu[1]='Пересчитать все в форуме';
}
menu[3]='Активные темы';
menu[4]='Темы без ответов';
return menu;
};
// POST EDIT MENU //
function PostEditMenu( pid, forum_url ){
var menu=new Array();
menu[0]='' + menu_short + '';
menu[1]='' + menu_full + '';
return menu;
};
// USER MENU //
function FUserMenu( url, m_id, group, forum_url ){
var menu=new Array();
menu[0]='' + menu_profile + '';
menu[1]='' + menu_send + '';
menu[2]='Найти темы пользователя';
if (group == '1') {
menu[3]='' + menu_uedit + '';
}
return menu;
};
// WARN //
function FWarn(action, user_id, post_id, forum_id)
{
var cause = prompt("Введите причину", "");
if (cause)
{
var ajax = new dle_ajax();
ajax.onShow ('');
var varsString = "user_id=" + user_id;
ajax.setVar("skin", dle_skin);
ajax.setVar("action", action);
ajax.setVar("forum_id", forum_id);
ajax.setVar("post_id", post_id);
ajax.setVar("cause", ajax.encodeVAR(cause));
ajax.requestFile = dle_root + "engine/forum/ajax/warn.php";
ajax.method = 'POST';
ajax.element = 'warn-' + post_id;
ajax.sendAJAX(varsString);
}
return false;
};
function FRep(action, user_id, post_id, forum_id)
{
var cause = prompt("Введите причину", "");
if (cause)
{
var ajax = new dle_ajax();
ajax.onShow ('');
var varsString = "user_id=" + user_id;
ajax.setVar("skin", dle_skin);
ajax.setVar("action", action);
ajax.setVar("forum_id", forum_id);
ajax.setVar("post_id", post_id);
ajax.setVar("cause", ajax.encodeVAR(cause));
ajax.requestFile = dle_root + "engine/forum/ajax/reputation.php";
ajax.method = 'POST';
ajax.element = 'rep-' + post_id;
ajax.sendAJAX(varsString);
}
return false;
};
function navigation(pages_count, url)
{
var page = prompt("Перейти к странице", "");
if (page)
{
if (pages_count >= page)
{
window.location.href = url + page;
}
}
}
function PostLink(link)
{
url = window.location;
var enterCause = prompt("Копирование прямой ссылки", url + "#post-" + link);
}
function select_id( sid )
{
var saved = new Array();
var clean = new Array();
var add = 1;
tmp = document.modform.selected_id.value;
if( tmp != "" )
{
saved = tmp.split(",");
}
for( i = 0 ; i < saved.length; i++ )
{
if ( saved[i] != "" )
{
if ( saved[i] == sid )
{
add = 0;
}
else
{
clean[clean.length] = saved[i];
}
}
}
if ( add )
{
clean[ clean.length ] = sid;
}
newvalue = clean.join(',');
document.modform.selected_id.value = newvalue;
}
function ShowHide( name, open ){
if (document.getElementById( name ).style.display != "none")
{
document.getElementById( name ).style.display = "none";
}
else
{
document.getElementById( name ).style.display = "";
}
if (open)
{
document.getElementById( name ).style.display = "";
}
}
function anti_flood( time ){
alert( 'System Anti-Flood: ' + time );
return false;