﻿/*-------------------------------------------------------------------------
* Comment Service Ajax Methods
*
* DEPENDENCIES
*  - jquery.js
*
* Created by:   Marc Simkin
* Date Created: 07-Jul-2008
* Notes:
*      22-Sep-2009: Marc Simkin - Updated for Commenting 2.0 also renamed file.
*
*------------------------------------------------------------------------*/

function px_cr_createReadProxy(ajaxUrl) {
    commentReadProxy = new serviceProxy(ajaxUrl);
}

function px_cr_getCommentCountsOfList(contentList, succeededCallback, errorCallback) {
    //NameValuePair[] GetCommentCountsOfList(ContentDataListItem2[] contentList);
    var data = { contentList: contentList };
    commentReadProxy.invoke("GetCommentCountsOfList", data, succeededCallback, errorCallback);
}
function px_cr_getDisplayCommentCount(contentKeyInfo, succeededCallback, errorCallback) {
    //int GetDisplayCommentCount(ContentKeyData2 ContentKeyInfo);
    var data = { contentKeyInfo: contentKeyInfo };
    commentReadProxy.invoke("GetCommentCount", data, succeededCallback, errorCallback);
}

function px_cr_getCommentPage(contentKeyInfo, pageSize, pageNumber, sortDirection, succeededCallback, errorCallback) {
    //ContentComment2[] GetCommentPage(ContentKeyData2 ContentKeyInfo, int PageSize, int PageNumber, SortDirections sortDirection);

    var data = {
        ContentKeyInfo: contentKeyInfo,
        PageSize: pageSize,
        PageNumber: pageNumber,
        sortDirection: sortDirection
    };

    commentReadProxy.invoke("GetCommentPage", data, succeededCallback, errorCallback);
}

// constants/definations

var UserType = { Guest: 0, Registered: 1, TVGStaff: 2, Facebook: 4 };
var CommentActionType = { Save: 1, Validate: 2 };
var SortDirections = { CreateTimeAscRN: 1, CreateTimeDescRN: 2, AgreeCountAscRN: 3, AgreeCountDescRN: 4 }
var commentReadProxy = null;

// end of CommentReadProxy.js