svn commit: r308 - trunk/mapbender/http/php/mod_renameGUI.php
uli at osgeo.org
uli at osgeo.org
Tue May 16 06:11:18 EDT 2006
Author: uli
Date: 2006-05-16 10:11:17+0000
New Revision: 308
Modified:
trunk/mapbender/http/php/mod_renameGUI.php
Log:
db_prep_query included
Modified: trunk/mapbender/http/php/mod_renameGUI.php
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/php/mod_renameGUI.php?view=diff&rev=308&p1=trunk/mapbender/http/php/mod_renameGUI.php&p2=trunk/mapbender/http/php/mod_renameGUI.php&r1=307&r2=308
==============================================================================
--- trunk/mapbender/http/php/mod_renameGUI.php (original)
+++ trunk/mapbender/http/php/mod_renameGUI.php 2006-05-16 10:11:17+0000
@@ -18,11 +18,12 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
session_start();
-import_request_variables("PG");
-require_once("../php/mb_validateSession.php");
require_once("../../conf/mapbender.conf");
-$con = db_connect($DBSERVER,$OWNER,$PW);
+$con = db_connect(DBSERVER,OWNER,PW);
db_select_db(DB,$con);
+import_request_variables("PG");
+require_once("../php/mb_validateSession.php");
+$self = $PHP_SELF . "?".SID."&guiID=".$_REQUEST["guiID"]."&elementID=".$_REQUEST["elementID"];
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
@@ -80,78 +81,69 @@
function validate_rename(){
- if(document.form1.newGuiName.value == ""){
- alert("Please enter a GUI name!");
- document.form1.newGuiName.focus();
- }
- else{
-
- // gui name already taken?
- var taken = false;
- for (var i=0; i<document.form1.guiList.options.length; i++){
- if(document.form1.guiList.options[i].text == document.form1.newGuiName.value){
- alert("GUI name already taken!");
- taken = true;
- }
- }
-
- if (!taken){
- var ind = document.form1.guiList.selectedIndex;
- // check if any gui is selected
- if(ind > -1){
- var permission = confirm("rename '" + document.form1.guiList.options[ind].text + "' to '" + document.form1.newGuiName.value + "' ?");
- if(permission == true){
- document.form1.rename.value = 1;
- document.form1.submit();
- }
- }
- else
- {
- alert("Please select a GUI!");
- }
- }
- }
+ if(document.form1.newGuiName.value == ""){
+ alert("Please enter a GUI name!");
+ document.form1.newGuiName.focus();
+ }
+ else{
+ // gui name already taken?
+ var taken = false;
+ for (var i=0; i<document.form1.guiList.options.length; i++){
+ if(document.form1.guiList.options[i].text == document.form1.newGuiName.value){
+ alert("GUI name already taken!");
+ taken = true;
+ }
+ }
+ if (!taken){
+ var ind = document.form1.guiList.selectedIndex;
+ // check if any gui is selected
+ if(ind > -1){
+ var permission = confirm("rename '" + document.form1.guiList.options[ind].text + "' to '" + document.form1.newGuiName.value + "' ?");
+ if(permission == true){
+ document.form1.rename.value = 1;
+ document.form1.submit();
+ }
+ }
+ else{
+ alert("Please select a GUI!");
+ }
+ }
+ }
}
function validate_copy(){
- if(document.form1.newGuiName.value == ""){
- alert("Please enter a GUI name!");
- document.form1.newGuiName.focus();
- }
- else{
-
- // gui name already taken?
- var taken = false;
- for (var i=0; i<document.form1.guiList.options.length; i++){
- if(document.form1.guiList.options[i].text == document.form1.newGuiName.value){
- alert("GUI name already taken!");
- taken = true;
- }
- }
-
- if (!taken){
- var ind = document.form1.guiList.selectedIndex;
- // check if any gui is selected
- if(ind > -1){
- var permission = confirm("copy '" + document.form1.guiList.options[ind].text + "' to '" + document.form1.newGuiName.value + "' ?");
- if(permission == true){
- document.form1.copy.value = 1;
- document.form1.submit();
- }
- }
- else
- {
- alert("Please select a GUI!");
- }
- }
- }
+ if(document.form1.newGuiName.value == ""){
+ alert("Please enter a GUI name!");
+ document.form1.newGuiName.focus();
+ }
+ else{
+ // gui name already taken?
+ var taken = false;
+ for (var i=0; i<document.form1.guiList.options.length; i++){
+ if(document.form1.guiList.options[i].text == document.form1.newGuiName.value){
+ alert("GUI name already taken!");
+ taken = true;
+ }
+ }
+ if (!taken){
+ var ind = document.form1.guiList.selectedIndex;
+ // check if any gui is selected
+ if(ind > -1){
+ var permission = confirm("copy '" + document.form1.guiList.options[ind].text + "' to '" + document.form1.newGuiName.value + "' ?");
+ if(permission == true){
+ document.form1.copy.value = 1;
+ document.form1.submit();
+ }
+ }
+ else{
+ alert("Please select a GUI!");
+ }
+ }
+ }
}
</script>
</head>
<body onLoad='document.form1.newGuiName.focus()'>
-<!--<form name='form1' action="<?php $PHP_SELF ?>" method="POST">-->
-<!--<form name='form1' action='" . $PHP_SELF . "?".SID."' method='post'>;-->
-
<?php
require_once("../classes/class_administration.php");
@@ -176,34 +168,35 @@
$admin = new administration();
$ownguis = $admin->getGuisByOwner($_SESSION["mb_user_id"]);
-echo "<form name='form1' action='" . $PHP_SELF . "?".SID."' method='post'>";
+echo "<form name='form1' action='" . $self ."' method='post'>";
if(count($ownguis)>0){
-$sql = "SELECT * FROM gui WHERE gui_id IN (";
-for($i=0; $i<count($ownguis); $i++){
- if($i>0){ $sql .= ",";}
- $sql .= "'".$ownguis[$i]."'";
- }
-$sql .= ") ORDER BY gui_name";
-$res = db_query($sql);
-$count=0;
-
-while($row = db_fetch_array($res)){
- $gui_id[$count]=$row["gui_id"];
- $count++;
-}
-
-
+ $sql = "SELECT * FROM gui WHERE gui_id IN (";
+ $v = array();
+ $t = array();
+ for($i=0; $i<count($ownguis); $i++){
+ if($i>0){ $sql .= ",";}
+ $sql .= "$".($i+1);
+ array_push($v,$ownguis[$i]);
+ array_push($t,'s');
+ }
+ $sql .= ") ORDER BY gui_name";
+ $res = db_prep_query($sql,$v,$t);
+ $count=0;
+ while($row = db_fetch_array($res)){
+ $gui_id[$count]=$row["gui_id"];
+ $count++;
+ }
echo "<select class='guiList' size='20' name='guiList' onchange='document.form1.guiList.value = this.value;submit();'>";
for ($i=0; $i<$count;$i++){
- echo "<option value='".$gui_id[$i]."' ";
- if($guiList && $guiList == $gui_id[$i]){
- echo "selected";
- }
- echo ">".$gui_id[$i]."</option>";
+ echo "<option value='".$gui_id[$i]."' ";
+ if($guiList && $guiList == $gui_id[$i]){
+ echo "selected";
+ }
+ echo ">".$gui_id[$i]."</option>";
}
-
echo "</select><br><br><br>";
-}else{
+}
+else{
echo "There are no guis owned by this user.";
}
More information about the Mapbender_commits
mailing list