var comments_length; function send_cancel_teach_comment(form, root){ // Проверить комментарий // Отправить if (CKEDITOR.instances.comment_sent_text.getData()){ $('[name=sent_comment_progress]').show(); $('[name='+form+']').find('[name=comment_sent_text]').val(CKEDITOR.instances.comment_sent_text.getData()); $.ajax({ type: 'POST', url: '/courses/send_cancel_teach_comment', data: $('[name='+form+']').serialize(), success: function(data){ if(data['code'] == '1'){ $('[name=sent_comment_progress]').hide(); document.forms[form].reset(); $('[name="comment_for_user_id"]').val($('[name=USER_ID]').val()); $('[name=comment_for_theme_id]').val($('[name=THEME_ID]').val()); CKEDITOR.instances.comment_sent_text.setData(''); reload_lesson_comments(data['data']); $('[name='+$('#'+root).attr('sketch_place')+']').html('') } } }); } else { show_system_message('Введите текст сообщения') } } function send_accept_teach_comment(form, root){ // Проверить комментарий // Отправить $('[name=sent_comment_progress]').show(); $('[name='+form+']').find('[name=comment_sent_text]').val(CKEDITOR.instances.comment_sent_text.getData()); $.ajax({ type: 'POST', url: '/courses/send_accept_teach_comment', data: $('[name=' + form + ']').serialize(), success: function (data) { if (data['code'] == '1') { $('[name=sent_comment_progress]').hide(); document.forms[form].reset(); $('[name="comment_for_user_id"]').val($('[name=USER_ID]').val()); $('[name=comment_for_theme_id]').val($('[name=THEME_ID]').val()); CKEDITOR.instances.comment_sent_text.setData(''); reload_lesson_comments(data['data']); $('[name=' + $('#' + root).attr('sketch_place') + ']').html('') } } }); } function write_comment(block, data){ var message; var user_status; var reply; if (data['replies'].length==0){ reply = '' } else { reply = '' + '
' + '
'; } if (data['files'].length > 0 && !data['closed']){ message = '
' } else { message = ''; } if (data['owner_type'] == 'U'){ user_status = '' } else if (data['owner_type'] == 'T'){ user_status = '' } else if (data['owner_type'] == 'M'){ user_status = '' } else if (data['owner_type'] == 'S'){ user_status = '' } else if (data['owner_type'] == 'A'){ user_status = '' } var avatar; if (data['closed']){ avatar = '' } else { avatar = ''+ ''+ '' } var head; if (data['closed']){ head = '
'+ '' + 'КОММЕНТАРИЙ УДАЛЕН' + ''+ '
' } else { head = '
'+ '' + '' + data['owner'] + '' + '' + user_status + ''+ '  '+ data['date']+ '
' } var reply_button; if (data['closed']){ reply_button = '' } else { if ( data['owner_id'] == $('[name=REQUEST_USER_ID]').val() ){ reply_button = '' + ' Удалить' } else { reply_button = ' Ответить' } } var text; if (data['closed']){ text = '