/**
 *
 */
function churchresource__ajax()
{
    include_once "churchresource_db.php";
    $module = new CTChurchResourceModule("churchresource");
    $ajax = new CTAjaxHandler($module);
    $ajax->addFunction("delException", "administer bookings");
    $ajax->addFunction("delBooking", "edit masterdata");
    drupal_json_output($ajax->call());
}
function churchcal__ajax()
{
    include_once CHURCHCAL . "/churchcal_db.php";
    $module = new CTChurchCalModule("churchcal");
    $ajax = new CTAjaxHandler($module);
    $ajax->addFunction("getCalEvents", "view");
    $ajax->addFunction("getCalPerCategory", "view");
    $ajax->addFunction("getAbsents", "view");
    $ajax->addFunction("getMyServices", "view", "churchservice");
    $ajax->addFunction("getBirthdays", "view");
    $ajax->addFunction("deleteCategory", "view");
    $ajax->addFunction("updateEvent", "view");
    $ajax->addFunction("createEvent", "view");
    $ajax->addFunction("getShares", "view");
    $ajax->addFunction("saveShares", "view");
    $ajax->addFunction("getResource", "view", "churchresource");
    $ajax->addFunction("getAllowedGroups", "view", "churchdb");
    $ajax->addFunction("getAllowedPersons", "view", "churchdb");
    $ajax->addFunction("saveCategory", "view");
    $ajax->addFunction("delAddition", "view");
    $ajax->addFunction("deleteEvent", "view");
    // not ready
    $ajax->addFunction("moveCSEvent");
    drupal_json_output($ajax->call());
}
/**
 * churchservice ajax
 */
function churchservice_ajax()
{
    include_once "churchservice_db.php";
    $module = new CTChurchServiceModule("churchservice");
    $ajax = new CTAjaxHandler($module);
    $ajax->addFunction("pollForNews", "view");
    $ajax->addFunction("getNewEventData", "view");
    $ajax->addFunction("getAllEventData", "view");
    $ajax->addFunction("getPersonByGroupIds", "view");
    $ajax->addFunction("saveEvent", "edit events");
    $ajax->addFunction("deleteEvent", "edit events");
    // Facts
    $ajax->addFunction("getAllFacts", "view facts || edit facts");
    $ajax->addFunction("saveFact", "edit facts");
    $ajax->addFunction("deleteService");
    $ajax->addFunction("editService");
    $ajax->addFunction("addOrRemoveServiceToEvent");
    drupal_json_output($ajax->call());
}