コード例 #1
0
function ssu_add_input()
{
    global $db;
    $oResponse = new xajaxResponse();
    $sql_query = "INSERT IGNORE INTO " . TABLE_LINKS_ALIASES . " (link_url, link_alias) VALUES('/default_link/','/default_alias/')";
    $db->Execute($sql_query);
    $id = $db->insert_ID();
    if ($id !== 0) {
        $oResponse->prepend('linkBox', 'innerHTML', "\n\t\t\t\t<div id='link_{$id}' name='{$id}' class='editable links'>default_link</div>\n\t\t\t\t<div id='alias_{$id}' name='{$id}' class='editable aliases'>default_alias</div>\n\t\t\t\t<br class='clearBoth'/>");
        $oResponse->script('location.reload(true)');
        $oResponse->assign('message', 'innerHTML', "New record added");
    } else {
        $oResponse->assign('message', 'innerHTML', "No new record added!");
    }
    return $oResponse;
}
コード例 #2
0
/**
 * delete the current attachment
 * this function is registered in xajax
 * @param string $list_title title of current list
 * @param int $attachment_id id of this attachment
 * @param string $attachment_specifications specifications of the attachment 
 * @return xajaxResponse every xajax registered function needs to return this object
 */
function action_add_attachment($list_title, $attachment_id, $attachment_specifications)
{
    global $logging;
    global $user;
    global $user_start_time_array;
    $logging->info("USER_ACTION " . __METHOD__ . " (user="******", attachment_specifications={$attachment_specifications})");
    # store start time
    $user_start_time_array[__METHOD__] = microtime(TRUE);
    # create necessary objects
    $response = new xajaxResponse();
    $attachment_arrayrray = explode("|", $attachment_specifications);
    # decrease upload_attachment_id by 1
    $attachment_id += 1;
    $response->script("\$('#upload_attachment_id').html({$attachment_id}); ");
    # add new upload file to html
    $html_str = get_list_record_attachment($list_title, $attachment_id, $attachment_specifications);
    # todo: why does statement below not work????
    #    $response->script("$('#$td_id').html('$html_str' + $('#$td_id').html()); ");
    $response->prepend("attachments_container", "innerHTML", $html_str);
    # log total time for this function
    $logging->info(get_function_time_str(__METHOD__));
    return $response;
}
コード例 #3
0
ファイル: xajax.php プロジェクト: apexad/editsee
function updatePost($post_id, $mode = 'full', $content = 'not needed')
{
    $objResponse = new xajaxResponse();
    $project7 = new editsee_App();
    if ($project7->loggedIn()) {
        if ($post_id == 'new') {
            $post_div = 'new-post';
            $post['id'] = 'new';
            $post['content'] = 'enter your new post content here';
            if ($mode == 'page') {
                $objResponse->assign('posts', 'innerHTML', '');
            }
            $objResponse->prepend('posts', 'innerHTML', '<div id="new-post" class="post"></div>');
        } else {
            $result = $project7->db->_query($project7->post_select(" and id='" . $post_id . "'"));
            $post = $result->_fetch_assoc();
            $post['title'] = stripslashes($post['title']);
            $post['content'] = stripslashes($post['content']);
            $post_div = 'post-' . $post['id'];
            if ($mode == 'draft') {
                $result = $project7->db->_query("select title,content from " . $project7->db->get_table_prefix() . "post where draft='" . $post_id . "'");
                $draft = $result->_fetch_assoc();
                $post['title'] = stripslashes($draft['title']);
                $post['content'] = stripslashes($draft['content']);
            }
        }
        if ($mode == 'quick') {
            if ($_SESSION['in-quick' . $post_id] != 'yes') {
                $_SESSION['in-quick' . $post_id] = 'yes';
                ob_start();
                include 'includes/layout/quickedit.php';
                $quick_edit = ob_get_contents();
                ob_end_clean();
                $objResponse->assign('post-' . $post['id'], 'innerHTML', $quick_edit);
                $objResponse->script("mynicEditornew= new nicEditor({iconsPath : '" . str_replace('index.php', '', $_SERVER['SCRIPT_NAME']) . "includes/nicEdit/nicEditorIcons.gif',buttonList : [],uploadURI : 'http://" . $_SERVER['HTTP_HOST'] . "/nicUpload.php'}).panelInstance('post_content')");
            }
        } else {
            if ($mode == 'inquick') {
                $post['content'] = stripslashes($content);
            }
            if ($project7->is_page($post_id)) {
                $mode = 'page';
            }
            if ($mode == 'page') {
                $post_type = 'page';
            } else {
                $post_type = 'post';
            }
            $_SESSION['in-quick' . $post_id] = 'yes';
            ob_start();
            include 'includes/layout/newpost.php';
            $newpost = ob_get_contents();
            ob_end_clean();
            $objResponse->assign($post_div, 'innerHTML', $newpost);
            $objResponse->script("mynicEditornew = new nicEditor({iconsPath : '" . str_replace('index.php', '', $_SERVER['SCRIPT_NAME']) . "includes/nicEdit/nicEditorIcons.gif',fullPanel: true,uploadURI : 'http://" . $_SERVER['HTTP_HOST'] . "/nicUpload.php'}).panelInstance('post_content')");
            if ($project7->get_config('es_draft_save_time') == '') {
                $project7->update_config('es_draft_save_time', '60');
            }
        }
    } else {
        $objResponse->alert($project7->notLoggedIn());
    }
    return $objResponse;
}
コード例 #4
0
/**
 * @param type $op_id
 * @param type $from
 * @param type $isFeedback если true значит это отзыв из СБР, если false - мнение
 *
 * @return \xajaxResponse
 */
function AddOpComentForm($op_id, $from = 'frl', $isFeedback = false)
{
    $objResponse = new xajaxResponse();
    if ($isFeedback) {
        $prefix = 'feedback_';
    } else {
        $prefix = '';
    }
    $link_id = $prefix . 'comment_content_' . $op_id;
    $objResponse->script('opinionCloseAllForms()');
    $objResponse->script("\$('{$link_id}').setStyle('display', 'none');");
    $objResponse->prepend($prefix . 'comment_' . $op_id, 'innerHTML', opinions::printEditComForm($op_id, $from, $isFeedback));
    $objResponse->script("opinionCheckMaxLengthStart('coment', '" . $prefix . "edit_comm_{$op_id}'); window._opiLock = false;");
    $objResponse->script("opinionCheckMaxLengthUpdater('" . $prefix . "edit_comm_{$op_id}')");
    $objResponse->script("\$('" . $prefix . "comment_{$op_id}').setStyle('display', '')");
    return $objResponse;
}