//$wmc = new wmc();
$resultObj = array();
//obj structure in session for acceptedTou (see class_tou.php):
//acceptedTou {
//		wms [100,101,112],
//		wfs [12,34]
//		}
switch ($ajaxResponse->getMethod()) {
    case 'checkAcceptedTou':
        $result = $touObject->check($ajaxResponse->getParameter("serviceType"), $ajaxResponse->getParameter("serviceId"));
        $ajaxResponse->setResult($result['accepted']);
        //1 or 0
        $ajaxResponse->setMessage(_mb($result['message']));
        $ajaxResponse->setSuccess(true);
        break;
    case 'setAcceptedTou':
        $serviceType = $ajaxResponse->getParameter("serviceType");
        $serviceId = $ajaxResponse->getParameter("serviceId");
        $result = $touObject->set($ajaxResponse->getParameter("serviceType"), $ajaxResponse->getParameter("serviceId"));
        $ajaxResponse->setResult($result['setTou']);
        //1 or 0
        $ajaxResponse->setMessage(_mb($result['message']));
        $ajaxResponse->setSuccess(true);
        break;
        // Invalid command
    // Invalid command
    default:
        $ajaxResponse->setMessage(_mb("No method specified."));
        $ajaxResponse->setSuccess(false);
}
$ajaxResponse->send();
        $touHeader = $resourceSymbol . " <a href='../php/mod_showMetadata.php?resource=wms&layout=tabs&id=" . $WMS['id'] . "&languageCode=" . $languageCode . "' target='_blank'>" . $WMS['title'] . "</a><br>";
        if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {
            $mapbenderProtocol = "https://";
            $mapbenderBaseUrl = "https://" . $hostName;
        } else {
            $mapbenderProtocol = "http://";
            $mapbenderBaseUrl = "http://" . $hostName;
        }
        $touServiceConnector = new connector($mapbenderProtocol . "localhost" . $_SERVER['SCRIPT_NAME'] . "/../../php/mod_getServiceDisclaimer.php?resource=wms&id=" . $WMS['id'] . "&languageCode=" . $languageCode . "&asTable=true");
        $touForWMS = $touServiceConnector->file;
        //add only those who have no special tou defined -
        if ($touForWMS != '') {
            $tou .= $touHeader . $touForWMS;
        }
        //set the tou to be accepted - TODO maybe do this after the button which deletes the message window - from a ajax request.
        $classTou->set('wms', $WMS['id']);
    }
}
if ($tou != "") {
    $tou = _mb("The configuration, which should be loaded, consists of different services which have the following terms of use:") . "<br>" . $tou;
}
$resultObj["wmcTou"]["message"] = $tou;
#$resultObj["wmcTou"]["message"] = "Terms of Use";
//
// Output
//
// Check if session WMC module is loaded
$sql = "SELECT COUNT(e_id) AS i FROM gui_element WHERE fkey_gui_id = \$1 AND e_id = \$2";
$v = array(Mapbender::session()->get("mb_user_gui"), "sessionWmc");
$t = array("s", "s");
$res = db_prep_query($sql, $v, $t);