[Mapbender-commits] r2258 - in branches/nimix_dev/http: javascripts
php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Fri Mar 14 12:49:41 EDT 2008
Author: nimix
Date: 2008-03-14 12:49:40 -0400 (Fri, 14 Mar 2008)
New Revision: 2258
Modified:
branches/nimix_dev/http/javascripts/mod_addWMSfromfilteredList_ajax.php
branches/nimix_dev/http/php/mod_addWMSfromfilteredList_server.php
Log:
add element var to select gui to display, 3 db buttons (gui, group, all)
Modified: branches/nimix_dev/http/javascripts/mod_addWMSfromfilteredList_ajax.php
===================================================================
--- branches/nimix_dev/http/javascripts/mod_addWMSfromfilteredList_ajax.php 2008-03-14 13:42:49 UTC (rev 2257)
+++ branches/nimix_dev/http/javascripts/mod_addWMSfromfilteredList_ajax.php 2008-03-14 16:49:40 UTC (rev 2258)
@@ -56,9 +56,14 @@
try{if(option_gui){}}catch(e){option_all='1';};
try{if(option_db){}}catch(e){option_all='1';};
try{if(capabilitiesInput){}}catch(e){capabilitiesInput='0';};
+try{if(gui_list){}}catch(e){gui_list='gui,gui1'};
+var guis = gui_list.split(",");
+if(gui_list==='')
+ guis = [];
+
var global_source = "capabilities"; // "capabilities" || "db"
-var phpUrl = "../php/mod_addWMSfromfilteredList_server.php<?php echo $urlParameters;?>";
+var phpUrl = "../php/mod_addWMSfromfilteredList_server.php?<?php echo $urlParameters;?>";
// ----------------- Load service --------------------
@@ -110,10 +115,12 @@
}
function getWMSByGUI(guiId) {
+ if(guiId=="")
+ return getAllWMS();
imageOn();
window.opener.mb_ajax_json(phpUrl, {"command":"getWMSByGUI", "guiId":guiId}, function (json, status) {
imageOff();
- displayWMS(json.wms, guiId);
+ displayWMS(json.wms);
});
}
@@ -253,7 +260,16 @@
for (var i = 0; i < guiArray.length; i++) {
var onClick = "getWMSByGUI('" + guiArray[i].id + "')";
- addRow("resultTableBody", guiArray[i].name, guiArray[i].description, onClick);
+ if(guis.length>0){
+ for(var j=0; j < guis.length; j++){
+ if(guiArray[i].id==guis[j]){
+ addRow("resultTableBody", guiArray[i].name, guiArray[i].description, onClick);
+ break;
+ }
+ }
+ }
+ else
+ addRow("resultTableBody", guiArray[i].name, guiArray[i].description, onClick);
}
}
else {
@@ -261,14 +277,14 @@
}
}
-function displayWMS (wmsArray, guiId) {
+function displayWMS (wmsArray) {
if (wmsArray.length > 0) {
setTableHeader(selectWmsText, wmsNameText, wmsAbstractText);
for (var i = 0; i < wmsArray.length; i++) {
- if (global_source == "db" && typeof(guiId) !== "undefined" ) {
- var onClick = "mod_addWMSfromDB('" + guiId + "', '" + wmsArray[i].id + "')";
+ if (global_source == "db" && typeof(wmsArray[i].guiId) !== "undefined" ) {
+ var onClick = "mod_addWMSfromDB('" + wmsArray[i].guiId + "', '" + wmsArray[i].id + "')";
}
else {
var onClick = "mod_addWMSfromfilteredList('" + wmsArray[i].getCapabilitiesUrl + "', '" + wmsArray[i].version + "')";
@@ -291,7 +307,7 @@
<tr>
<td>Capabilities - URL:</td>
<td><input type="text" id="CapURL" name="CapURL"/></td>
- <td><input type="button" value="Hinzufügen" onclick="mod_addWmsfromURL();"></td>
+ <td><input type="button" value="add" onclick="mod_addWmsfromURL();"></td>
</tr>
</table>
</form>
@@ -299,10 +315,12 @@
<form name='addWMSForm'>
<table border='0' cellpadding='3' rules='rows'>
<tr>
- <td><input type='button' class='wms_button' name='button_all' id='button_all' value='all wms' onclick='setSource("capabilities");getAllWMS()'></td>
+ <td><input type='button' class='wms_button' name='button_all' id='button_all' value='all wms' onclick='setSource("capabilities");getWMSByGUI(gui_list)'></td>
<td><input type='button' class='wms_button' name='button_group' id='button_group' value='group' onclick = 'setSource("capabilities");getGroups()'></td>
<td><input type='button' class='wms_button' name='button_gui' id='button_gui' value='gui' onclick = 'setSource("capabilities");getGUIs()'></td>
- <td><input type='button' class='wms_button' name='button_db' id='button_db' value='db' onclick = 'setSource("db");getGUIs()'></td>
+ <td><input type='button' class='wms_button' name='button_dbGui' id='button_dbGui' value='gui db' onclick = 'setSource("db");getGUIs()'></td>
+ <td><input type='button' class='wms_button' name='button_dbGroup' id='button_dbGroup' value='group db' onclick = 'setSource("db");getGroups()'></td>
+ <td><input type='button' class='wms_button' name='button_dbAll' id='button_dbAll' value='all wms db' onclick = 'setSource("db");getWMSByGUI(gui_list)'></td>
</tr>
</table>
</form>
Modified: branches/nimix_dev/http/php/mod_addWMSfromfilteredList_server.php
===================================================================
--- branches/nimix_dev/http/php/mod_addWMSfromfilteredList_server.php 2008-03-14 13:42:49 UTC (rev 2257)
+++ branches/nimix_dev/http/php/mod_addWMSfromfilteredList_server.php 2008-03-14 16:49:40 UTC (rev 2258)
@@ -76,7 +76,7 @@
else if ($command == "getAllWMS") {
$resultObj["wms"] = array();
- $sql = "SELECT DISTINCT wms.wms_id, wms.wms_title, gettext($1, wms.wms_abstract) as wms_abstract, wms.wms_getcapabilities, wms.wms_version ";
+ $sql = "SELECT wms.wms_id, wms.wms_title, gettext($1, wms.wms_abstract) as wms_abstract, wms.wms_getcapabilities, wms.wms_version, MIN(gui_wms.fkey_gui_id) ";
$sql .= "FROM wms, gui_wms ";
$sql .= "WHERE wms.wms_id = gui_wms.fkey_wms_id AND gui_wms.fkey_gui_id IN (";
$v = array($_SESSION["mb_lang"]);
@@ -90,41 +90,52 @@
array_push($v, $guiIdArray[$i]);
array_push($t, "s");
}
- $sql .= ") ORDER BY wms_title";
+ $sql .= ") GROUP BY wms.wms_id, wms.wms_title, wms_abstract, wms.wms_getcapabilities, wms.wms_version ";
+ $sql .= "ORDER BY wms_title ";
$res = db_prep_query($sql,$v,$t);
while ($row = db_fetch_array($res)) {
- $resultArray = array("id" => $row["wms_id"], "title" => $row["wms_title"], "abstract" => $row["wms_abstract"], "getCapabilitiesUrl" => $row["wms_getcapabilities"], "version" => $row["wms_version"]);
+ $resultArray = array("id" => $row["wms_id"], "title" => $row["wms_title"], "abstract" => $row["wms_abstract"], "getCapabilitiesUrl" => $row["wms_getcapabilities"], "version" => $row["wms_version"], "guiId" => $row["fkey_gui_id"]);
array_push($resultObj["wms"], $resultArray);
}
}
else if ($command == "getWMSByGroup") {
$resultObj["wms"] = array();
- $sql = "SELECT DISTINCT wms_id, wms_title, gettext($1, wms_abstract) as wms_abstract, wms_getcapabilities, wms_version ";
+ $sql = "SELECT wms_id, wms_title, gettext($1, wms_abstract) as wms_abstract, wms_getcapabilities, wms_version, MIN(gui_wms.fkey_gui_id) ";
$sql .= "FROM wms, gui_wms, gui_mb_group ";
- $sql .= "WHERE wms.wms_id = gui_wms.fkey_wms_id AND gui_wms.fkey_gui_id = gui_mb_group.fkey_gui_id AND gui_mb_group.fkey_mb_group_id = $2";
+ $sql .= "WHERE wms.wms_id = gui_wms.fkey_wms_id AND gui_wms.fkey_gui_id = gui_mb_group.fkey_gui_id AND gui_mb_group.fkey_mb_group_id = $2 ";
+ $sql .= "GROUP BY wms_id, wms_title, wms_abstract, wms_getcapabilities, wms_version ";
$v = array($_SESSION["mb_lang"], $groupId);
$t = array("s", "i");
$res = db_prep_query($sql, $v, $t);
while ($row = db_fetch_array($res)) {
- $resultArray = array("id" => $row["wms_id"], "title" => $row["wms_title"], "abstract" => $row["wms_abstract"], "getCapabilitiesUrl" => $row["wms_getcapabilities"], "version" => $row["wms_version"]);
+ $resultArray = array("id" => $row["wms_id"], "title" => $row["wms_title"], "abstract" => $row["wms_abstract"], "getCapabilitiesUrl" => $row["wms_getcapabilities"], "version" => $row["wms_version"], "guiId" => $row["fkey_gui_id"]);
array_push($resultObj["wms"], $resultArray);
}
}
else if ($command == "getWMSByGUI") {
$resultObj["wms"] = array();
- $sql = "SELECT DISTINCT wms_id, wms_title, gettext($1, wms_abstract) as wms_abstract, wms_getcapabilities, wms_version ";
- $sql .= "FROM wms, gui_wms WHERE wms.wms_id = gui_wms.fkey_wms_id AND fkey_gui_id = $2";
- $v = array($_SESSION["mb_lang"], $guiId);
- $t = array("s", "s");
+ $sql = "SELECT wms_id, wms_title, gettext($1, wms_abstract) as wms_abstract, wms_getcapabilities, wms_version, MIN(fkey_gui_id) ";
+ $sql .= "FROM wms, gui_wms WHERE wms.wms_id = gui_wms.fkey_wms_id AND fkey_gui_id IN (";
+ $v = array($_SESSION["mb_lang"]);
+ $t = array("s");
+ $s = array();
+ $guiIds = split(",",$guiId);
+ for($i=0;$i<count($guiIds);$i++){
+ array_push($v, $guiIds[$i]);
+ array_push($t, 's');
+ array_push($s, "$".strval($i+2));
+ }
+ $sql .= implode(",",$s).") ";
+ $sql .= "GROUP BY wms_id, wms_title, wms_abstract, wms_getcapabilities, wms_version";
$res = db_prep_query($sql, $v, $t);
while ($row = db_fetch_array($res)) {
- $resultArray = array("id" => $row["wms_id"], "title" => $row["wms_title"], "abstract" => $row["wms_abstract"], "getCapabilitiesUrl" => $row["wms_getcapabilities"], "version" => $row["wms_version"]);
+ $resultArray = array("id" => $row["wms_id"], "title" => $row["wms_title"], "abstract" => $row["wms_abstract"], "getCapabilitiesUrl" => $row["wms_getcapabilities"], "version" => $row["wms_version"], "guiId" => $row["fkey_gui_id"]);
array_push($resultObj["wms"], $resultArray);
}
}
More information about the Mapbender_commits
mailing list