getParameter("mapurl"); $layerName = $ajaxResponse->getParameter("layerName"); $legendUrl = $ajaxResponse->getParameter("legendUrl"); $wmsId = $ajaxResponse->getParameter("wmsId"); if(!$mapurl){ $ajaxResponse->setSuccess(false); $ajaxResponse->setMessage('mapURL not set'); $ajaxResponse->send(); } /* if(!$legendurl){ $ajaxResponse->setSuccess(false); $ajaxResponse->setMessage('legendURL not set'); $ajaxResponse->send(); } */ if (!$wmsId) { $ajaxResponse->setSuccess(false); $ajaxResponse->setMessage('wmsId not set'); $ajaxResponse->send(); } if (!$layerName) { $ajaxResponse->setSuccess(false); $ajaxResponse->setMessage('layerName not set'); $ajaxResponse->send(); } switch ($ajaxResponse->getMethod()) { case "saveLayerPreview": $con = new connector(); $admin = new administration(); $mapImage = $con->load($mapurl); if (!$mapImage) { $ajaxResponse->setSuccess(false); $ajaxResponse->setMessage('Could not save preview: Unable to load map image.'); $ajaxResponse->send(); } $admin->saveFile($layerPreviewMapFileName,$mapImage); if ($legendUrl) { $legendImage = $con->load($legendUrl); if (!$legendImage) { $ajaxResponse->setSuccess(false); $ajaxResponse->setMessage('Could not save preview: Unable to load map image.'); $ajaxResponse->send(); } $admin->saveFile($layerPreviewLegendFileName,$legendImage); } else { $legendUrl = null; } $updateSQL = <<setSuccess(false); $ajaxResponse->setMessage("could not insert/Update layerPreview into db: ". pg_last_error()); } break; default: $ajaxResponse->setSuccess(false); $ajaxResponse->setMessage("invalid method"); } $ajaxResponse->send(); ?>