$ajaxResponse->setResult($resultObj); $ajaxResponse->setSuccess(true); } else { $ajaxResponse->setMessage(_mb("WMC could not be merged.")); $ajaxResponse->setSuccess(false); } break; // appends a WMC (returns JS code) // appends a WMC (returns JS code) case 'appendWmc': // generate a WMC for the current client state $currentWmc = new wmc(); $currentWmc->createFromJs($json->decode($ajaxResponse->getParameter("mapObject")), $ajaxResponse->getParameter("generalTitle"), $ajaxResponse->getParameter("extensionData")); // get the desired WMC from the database $wmcId = $ajaxResponse->getParameter("id"); $wmcXml = wmc::getDocument($wmcId); // merge the two WMCs $currentWmc->append($wmcXml); // load the merged WMC $jsArray = $currentWmc->toJavaScript(); if (is_array($jsArray) && count($jsArray) > 0) { $resultObj["javascript"] = $jsArray; $ajaxResponse->setResult($resultObj); $ajaxResponse->setSuccess(true); } else { $ajaxResponse->setMessage(_mb("WMC could not be appended.")); $ajaxResponse->setSuccess(false); } break; case 'setWMCPublic': $wmcId = $ajaxResponse->getParameter("id");
/** * Loads a WMC from the database. * * @param integer $wmc_id the ID of the WMC document in the database table "mb_user_wmc" */ function createFromDb($wmcId) { $doc = wmc::getDocument($wmcId); if ($doc === false) { return false; } $this->createObjFromWMC_xml($doc); $sql = "SELECT wmc_timestamp, wmc_title, wmc_public, srs, minx, miny, maxx, maxy " . "FROM mb_user_wmc WHERE wmc_serial_id = \$1 AND (fkey_user_id = \$2 OR wmc_public = 1)"; $v = array($wmcId, Mapbender::session()->get("mb_user_id")); $t = array("i", "i"); $res = db_prep_query($sql, $v, $t); if (db_error()) { return false; } if ($row = db_fetch_row($res)) { $this->wmc_id = $wmcId; $this->timestamp = $row[0]; $this->title = $row[1]; $this->public = $row[2]; $this->wmc_srs = $row[3]; $this->wmc_extent->minx = $row[4]; $this->wmc_extent->miny = $row[5]; $this->wmc_extent->maxx = $row[6]; $this->wmc_extent->maxy = $row[7]; return true; } return false; }
/** * selects the WMC for a given wmc_id. * * @param integer the wms id * @return string|boolean either the wmc as string or false when none exists * @deprecated */ function getWmcById($id) { $e = new mb_notice("administration->getWmcById is deprecated, use wmc->getDocument instead!"); $wmc = new wmc(); return $wmc->getDocument($id); }
# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. require_once dirname(__FILE__) . "/../php/mb_validateSession.php"; $wmc_id = $_GET["wmc_id"]; $download = $_GET["download"]; if ($wmc_id) { require_once dirname(__FILE__) . "/../classes/class_wmc.php"; $wmc = new wmc(); $wmc_gml = $wmc->getDocument($wmc_id); if ($wmc_gml) { //Display WMC // if "short open tags" is activated, the xml output is interpreted // as php, because the XML begins with "<?xml " if (ini_get("short_open_tag") == 1) { echo htmlentities($wmc_gml); $e = new mb_warning("'Allow short open tags' is 'On' in php.ini...you might want to turn it off to allow proper WMC display.'"); } else { if ($download == 'true') { header('Content-disposition: attachment; filename=mapbender_wmc.xml'); header("Content-type: application/xhtml+xml; charset=" . CHARSET); echo $wmc_gml; } else { header("Content-type: application/xhtml+xml; charset=" . CHARSET); echo $wmc_gml;