Example #1
0
function CreateCommentForm($backto, $top_id, $message_id, $commune_id, $om, $page = 0, $action = 'Create.post', $mod, $adv = 0, $draft_id = 0, $attachedfiles_session = '')
{
    global $session;
    session_start();
    commune::RestoreMarkedAttach($message_id);
    $objResponse = new xajaxResponse();
    if ($action == 'Create.post') {
        // Комментируем сообщение.
        $objResponse->assign($backto, 'style.position', 'static');
        $objResponse->assign($backto, 'innerHTML', __commPrntCommentForm($commune_id, $om, $page, $action, $top_id, NULL, $message_id, NULL, NULL, !$page ? 'Topic' : NULL, $mod));
    } else {
        // Выводим форму с атрибутами сообщения.
        $objResponse->assign($backto, 'style.position', 'static');
        $objResponse->assign($backto, 'innerHTML', __commPrntCommentForm($commune_id, $om, $page, $action, $top_id, $message_id, NULL, NULL, NULL, !$page ? 'Topic' : NULL, $mod, 0, $draft_id));
    }
    $objResponse->script(" var editMsg = document.getElementById('{$backto}');\n    if(__commLastOpenedForm!=editMsg) {\n      try { \n        if(!__commLastOpenedForm) {\n          var ___acf = document.getElementById('idAlertedCommentForm');\n          if(___acf && ___acf.parentNode)\n            __commLastOpenedForm = ___acf.parentNode;\n        }\n        __commLastOpenedForm.innerHTML = ''; __commLastOpenedForm.style.position='absolute'; \n      } catch(e) {}\n    }\n    __commLastOpenedForm  = editMsg;\n    __commLastOpenedForm.action = '{$action}';\n\t\n\tpoll.init('Commune', document.getElementById('" . $backto . "'), " . commune::POLL_ANSWERS_MAX . ", '" . $_SESSION['CommunePoll_Sess'] . "');\n\tif (document.getElementById('question')) maxChars('question', 'polls_error', " . commune::POLL_QUESTION_CHARS_MAX . ");\n\teditMsg.scrollIntoView(true);\n\t//new mAttach(document.getElementById('files_block'), " . (commune::MAX_FILES - $adv) . ");\n        //mA = new mAttach2(document.getElementById('files_block'), " . (commune::MAX_FILES - $adv) . ", {p:'btn-add', m:'btn-del', nv:true});\n  ");
    $js = "var attachedfiles_list = new Array();\n";
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/attachedfiles.php';
    $attachedfiles = new attachedfiles($attachedfiles_session);
    $attachedfiles_tmpcomm_files = commune::getAttachedFiles($message_id);
    if ($attachedfiles_tmpcomm_files) {
        $attachedfiles_comm_files = array();
        foreach ($attachedfiles_tmpcomm_files as $attachedfiles_comm_file) {
            $attachedfiles_comm_files[] = $attachedfiles_comm_file;
        }
        $attachedfiles->setFiles($attachedfiles_comm_files);
    }
    $attachedfiles_files = $attachedfiles->getFiles();
    if ($attachedfiles_files) {
        $n = 0;
        foreach ($attachedfiles_files as $attachedfiles_file) {
            $js .= "attachedfiles_list[{$n}] = new Object;\n";
            $js .= "attachedfiles_list[{$n}].id = '" . md5($attachedfiles_file['id']) . "';\n";
            $js .= "attachedfiles_list[{$n}].name = '{$attachedfiles_file['orig_name']}';\n";
            $js .= "attachedfiles_list[{$n}].path = '" . WDCPREFIX . "/{$attachedfiles_file['path']}{$attachedfiles_file['name']}';\n";
            $js .= "attachedfiles_list[{$n}].size = '" . ConvertBtoMB($attachedfiles_file['size']) . "';\n";
            $js .= "attachedfiles_list[{$n}].type = '{$attachedfiles_file['type']}';\n";
            ++$n;
        }
    }
    $js .= "attachedFiles.init('attachedfiles', \n                               '" . $attachedfiles->getSession() . "',\n                               attachedfiles_list, \n                               '" . commune::MAX_FILES . "',\n                               '" . commune::MAX_FILE_SIZE . "',\n                               '" . implode(', ', $GLOBALS['disallowed_array']) . "',\n                               'commune',\n                               '" . get_uid(false) . "'\n                            );";
    $objResponse->script($js);
    $objResponse->call('initWysiwyg');
    $objResponse->call('tawlTextareaInit');
    if ($action != 'Create.post') {
        $objResponse->script('DraftInit(4);');
    }
    return $objResponse;
}
Example #2
0
            <div id="warnreason-<?php 
echo $top['id'];
?>
" style="display: none">&nbsp;</div>
            
            
            
            <div id="idEditCommentForm_<?php 
echo $top['id'];
?>
" style="margin-bottom:20px">
                <a name="errorp"></a>
                <a name="op"></a>   
                <?php 
if (isset($alert)) {
    echo __commPrntCommentForm($commune_id, $om, 0, 'Edit.post', $top['id'], $msg_id, $msg_id, $_POST, $alert, 'Topic', $mod);
}
?>
            </div>
        </div>
            
        <div class="b-post__foot b-post__foot_clear_both">
            <?php 
if ($site === 'Topic') {
    ?>
                <?php 
    if (!commune::isBannedCommune($mod)) {
        include TPL_COMMUNE_PATH . '/admin_bar.php';
    }
    ?>
                <div class="b-free-share">