[Mapbender-commits] r2548 - trunk/mapbender/http/php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Mon Jun 23 12:46:52 EDT 2008
Author: christoph
Date: 2008-06-23 12:46:49 -0400 (Mon, 23 Jun 2008)
New Revision: 2548
Removed:
trunk/mapbender/http/php/mb_listWMCs.php
Log:
Deleted: trunk/mapbender/http/php/mb_listWMCs.php
===================================================================
--- trunk/mapbender/http/php/mb_listWMCs.php 2008-06-23 16:21:08 UTC (rev 2547)
+++ trunk/mapbender/http/php/mb_listWMCs.php 2008-06-23 16:46:49 UTC (rev 2548)
@@ -1,201 +0,0 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/mb_listWMCs.php
-# Copyright (C) 2002 CCGIS
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# 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");
-require_once(dirname(__FILE__) . "/../classes/class_administration.php");
-require_once(dirname(__FILE__) . "/../classes/class_wmc.php");
-
-$gui_id = $_SESSION["mb_user_gui"];
-$user_id = $_SESSION["mb_user_id"];
-
-$action = $_GET["action"];
-$wmcId = $_GET["wmc_id"];
-
-$delWmcId = $_POST["del_wmc_id"];
-$clientFilename = $_FILES['local_wmc_filename']['tmp_name'];
-
-?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
- <head>
- <meta http-equiv="cache-control" content="no-cache">
- <meta http-equiv="pragma" content="no-cache">
- <meta http-equiv="expires" content="0">
- <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET;?>">
- <title>Select web map contect document from list</title>
- </head>
- <body>
- <form name='delete_wmc' action='<?php echo $self; ?>' method='POST'>
- <input type='hidden' id='delete_wmc' name='del_wmc_id' value ='' >
- </form>
-
-<?php
-function mb_listWMCs($wmcIdArray, $form_target){
- $display = "<h2 style='font-family: Arial, Helvetica, sans-serif; color: #808080;background-color: White;'><font align='left' color='#000000'>load WMC from list</font></h2>";
- $display .= "<table width='90%' style='font-family: Arial, Helvetica, sans-serif;font-size : 12px;color: #808080;' border='1' cellpadding='3' rules='rows'><tr style='background-color:#F0F0F0;' width='80px'><td ><b>WMC name</b></td><td><b>last update</b></td><td colspan=5></td></tr>";
-
- if (count($wmcIdArray) > 0) {
- $v = array();
- $t = array();
-
- $wmcIdList = "";
- for ($i = 0; $i < count($wmcIdArray); $i++){
- if ($i > 0){
- $wmcIdList .= ",";
- }
- $wmcIdList .= "$".($i+1);
- array_push($v, $wmcIdArray[$i]);
- array_push($t, 's');
- }
- $sql_list_wmcs = "SELECT DISTINCT wmc_id, wmc_title, wmc_timestamp FROM mb_user_wmc ";
- $sql_list_wmcs .= "WHERE wmc_id IN (" . $wmcIdList . ") ";
- $sql_list_wmcs .= "ORDER BY wmc_timestamp DESC";
-
- $res_list_wmcs = db_prep_query($sql_list_wmcs, $v, $t);
- while($row = db_fetch_array($res_list_wmcs)){
- $this_id = $row["wmc_id"];
- $this_title = $row["wmc_title"];
- $this_timestamp = date("M d Y H:i:s", $row["wmc_timestamp"]);
-
- $display .= "<tr onmouseover='this.style.backgroundColor = \"#F08080\"' onmouseout='this.style.backgroundColor = \"#ffffff\"'>";
- $display .= "<td>".$this_title."</td>";
- $display .= "<td>".$this_timestamp. "</td>";
- $display .= "<td><a href=\"" . $form_target . "&action=load&wmc_id=".$this_id."\"><img src=\"../img/button_gray/wmc_load.png\" title=\"load this WMC\" border=0></a></td>";
- $display .= "<td><a href=\"" . $form_target . "&action=merge&wmc_id=".$this_id."\"><img src=\"../img/button_gray/wmc_merge.png\" title=\"merge WMC\" border=0></a></td>";
- $display .= "<td><a href=\"" . $form_target . "&action=append&wmc_id=".$this_id."\"><img src=\"../img/button_gray/wmc_append.png\" title=\"append WMC\" border=0></a></td>";
- $display .= "<td><a href='../javascripts/mod_displayWmc.php?wmc_id=".$this_id."' target = '_blank'><img src=\"../img/button_gray/wmc_xml.png\" title=\"display WMC XML\" border=0></a></td>";
- $display .= "<td><a href=\"" . $form_target . "&action=delete&wmc_id=".$this_id."\"><img src=\"../img/button_gray/del.png\" title=\"delete this WMC\" border=0></a></td>";
- $display .= "</tr>";
- }
- }
- else{
- $display .= "<tr><td>There are no WMCs availiable</td></tr>";
- }
- $display .= "</table>";
-
- return $display;
-}
-
-function getTarget($gui_id) {
- $sql = "SELECT e_requires, e_target FROM gui_element WHERE e_id = 'loadwmc' AND fkey_gui_id = $1";
- $v = array($gui_id);
- $t = array("s");
- $res = db_prep_query($sql, $v, $t);
- $cnt = 0;
- while($row = db_fetch_array($res)){
- $e_target = $row["e_target"];
- $e_require = $row["e_requires"];
- $cnt++;
- }
- if ($cnt > 1) {
- $e = new mb_exception("listWMCs: e_id 'loadwmc' not unique in GUI '" . $gui_id . "'!");
- }
-
- $targetArray = explode(",", $e_target);
- if (in_array('mapframe1', $targetArray)) {
- return 'mapframe1';
- }
- else {
- return trim($targetArray[0]);
- }
-}
-
-function loadFile($filename) {
- $handle = fopen($filename, "r");
- $cnt = 0;
- while (!feof($handle)) {
- $buffer .= fgets($handle, 4096);
- }
- fclose ($handle);
- return $buffer;
-}
-
-$admin = new administration();
-$wmcIdArray = $admin->getWmcByOwner($user_id);
-
-// wmc is being deleted
-if (!empty($delWmcId)) {
- $result = $admin->deleteWmc($delWmcId, $user_id);
- if (!$result) {
- echo "<script language='javascript'>";
- echo "alert('WMC could not be deleted!');";
- echo "</script>";
- }
-}
-// wmc is being loaded from file
-elseif ($clientFilename) {
- $serverFilename = "../tmp/wmc" . time() . ".xml";
- copy($clientFilename, $serverFilename);
-
- $wmc = new wmc();
- $wmc->createObjFromWMC_xml(loadFile($serverFilename));
-
- $mytarget = getTarget($gui_id);
- $js = $wmc->createJsObjFromWMC("window.opener.", $mytarget, "load");
- echo "<script language='javascript'>";
- echo $js;
- if ($wmc->getTitle()) {
- $title = "'" . $wmc->getTitle() . "' ";
- }
- echo "alert(\"WMC " . $title . ": load successful.\");\n";
- echo "window.close();";
- echo "</script>";
-}
-
-// load a WMC from file
-?>
-<h2 style='font-family: Arial, Helvetica, sans-serif; color: #808080;background-color: White;'><font align='left' color='#000000'>load WMC from file</font></h2>
-<form enctype="multipart/form-data" action="<?php echo $self;?>" method=POST target="_self">
-<input type='file' name='local_wmc_filename'>
-<input type='submit' value='load'>
-</form>
-<?php
-
-// load a WMC from list
-echo mb_listWMCs($wmcIdArray, $self);
-
-if ($wmcId && in_array($wmcId, $wmcIdArray)){
- if ($action == "delete") {
- echo "<script language='javascript'>";
- echo "value = confirm('Do you really want to delete this document?');";
- echo "if (value == true) {";
- echo "document.delete_wmc.del_wmc_id.value = '" . $wmcId . "';";
- echo "document.delete_wmc.submit();";
- echo "}";
- echo "</script>";
- }
- else if ($action == "append" || $action == "merge" || $action == "load") {
- $mytarget = getTarget($gui_id);
-
- $wmc = new wmc();
- $wmc->createObjFromWMC_id($wmcId);
- $js = $wmc->createJsObjFromWMC("window.opener.", $mytarget, $action);
-
- echo "<script language='javascript'>";
- echo $js;
- if ($wmc->getTitle()) {
- $title = "'" . $wmc->getTitle() . "' ";
- }
- echo "alert(\"WMC " . $title . ": " . $action . " successful.\");\n";
- echo "window.close();";
- echo "</script>";
- }
-}
-?>
-</body>
-</html>
\ No newline at end of file
More information about the Mapbender_commits
mailing list