﻿/*-------------------------------------------------------------------------
* Comment Service Write Ajax Methods
*
* DEPENDENCIES
*  - jquery.js
*
* Created by:   Marc Simkin
* Date Created: 07-Jul-2008
* Notes:
*      24-Sep-2009: Marc Simkin - Updated for Commenting 2.0 also renamed file.
*
*------------------------------------------------------------------------*/

function px_cw_createWriteProxy(ajaxUrl) {
    commentWriteProxy = new serviceProxy(ajaxUrl);
}

function px_cw_saveComment(comment, succeededCallback, errorCallback) {
    //CommentSaveStatus SaveComment(CommentAction comment);

    var data = {
        comment: comment
    };

    commentWriteProxy.invoke("SaveComment", data, succeededCallback, errorCallback);
}

function px_cw_reportComment(contentKeyInfo, commentId, succeededCallback, errorCallback) {
    //void ReportComment(ContentKeyData2 contentKeyInfo, string commentId);

    var data = {
        contentKeyInfo: contentKeyInfo,
        commentId: commentId
    };

    commentWriteProxy.invoke("ReportComment", data, succeededCallback, errorCallback);
}

function px_cw_incrementAgreeForComment(contentKeyInfo, commentId, succeededCallback, errorCallback) {
    //int IncrementAgreeForComment(ContentKeyData2 contentKeyInfo, string commentId);

    var data = {
        contentKeyInfo: contentKeyInfo,
        commentId: commentId
    };

    commentWriteProxy.invoke("IncrementAgreeForComment", data, succeededCallback, errorCallback);
}


function px_wr_incrementDisagreeForComment(contentKeyInfo, commentId, succeededCallback, errorCallback) {
    //int IncrementDisagreeForComment(ContentKeyData2 contentKeyInfo, string commentId);

    var data = {
        contentKeyInfo: contentKeyInfo,
        commentId: commentId
    };

    commentWriteProxy.invoke("IncrementDisagreeForComment", data, succeededCallback, errorCallback);
}


function px_cw_validateComment(comment, succeededCallback, errorCallback) {
    //CommentValidation2 ValidateComment(CommentAction comment);

    var data = {
        comment: comment
    };

    commentWriteProxy.invoke("ValidateComment", data, succeededCallback, errorCallback);
}


// constants/definations

var commentWriteProxy = null;

// end of CommentWriteProxy.js