| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 |
require_once("include/session.php"); |
|---|
| 40 |
|
|---|
| 41 |
|
|---|
| 42 |
class choiceList{ |
|---|
| 43 |
var $db; |
|---|
| 44 |
|
|---|
| 45 |
function choiceList($db){ |
|---|
| 46 |
$this->db = $db; |
|---|
| 47 |
} |
|---|
| 48 |
|
|---|
| 49 |
|
|---|
| 50 |
function deleteList($listname){ |
|---|
| 51 |
$querystatement="DELETE FROM choices WHERE listname=\"".$listname."\" "; |
|---|
| 52 |
$queryresult=$this->db->query($querystatement); |
|---|
| 53 |
|
|---|
| 54 |
echo "ok"; |
|---|
| 55 |
} |
|---|
| 56 |
|
|---|
| 57 |
|
|---|
| 58 |
function addToList($listname,$value){ |
|---|
| 59 |
$querystatement="INSERT INTO choices (listname,thevalue) VALUES(\"".$listname."\",\"".$value."\") "; |
|---|
| 60 |
$queryresult=$this->db->query($querystatement); |
|---|
| 61 |
|
|---|
| 62 |
echo "ok"; |
|---|
| 63 |
} |
|---|
| 64 |
|
|---|
| 65 |
|
|---|
| 66 |
function displayList($queryresult,$blankvalue){ |
|---|
| 67 |
while($therecord=$this->db->fetchArray($queryresult)){ |
|---|
| 68 |
$display=$therecord["thevalue"]; |
|---|
| 69 |
$theclass=""; |
|---|
| 70 |
if($therecord["thevalue"]==""){ |
|---|
| 71 |
$display="<".$blankvalue.">"; |
|---|
| 72 |
$theclass=" class=\"choiceListBlank\" "; |
|---|
| 73 |
} |
|---|
| 74 |
?><option value="<?php echo $therecord["thevalue"]?>" <?php echo $theclass?>><?php echo $display?></option><?php |
|---|
| 75 |
} |
|---|
| 76 |
|
|---|
| 77 |
} |
|---|
| 78 |
|
|---|
| 79 |
function displayBox($listname,$blankvalue,$listid){ |
|---|
| 80 |
$blankvalue = str_replace("<","",$blankvalue); |
|---|
| 81 |
$blankvalue = str_replace(">","",$blankvalue); |
|---|
| 82 |
|
|---|
| 83 |
$querystatement = "SELECT thevalue FROM choices WHERE listname=\"".$listname."\" ORDER BY thevalue;"; |
|---|
| 84 |
$queryresult = $this->db->query($querystatement); |
|---|
| 85 |
?> |
|---|
| 86 |
<p id="MLListP"> |
|---|
| 87 |
<select id="MLlist" name="MLList" size="12" onchange="updateML(this)"> |
|---|
| 88 |
<?php $this->displayList($queryresult,$blankvalue)?> |
|---|
| 89 |
</select> |
|---|
| 90 |
</p> |
|---|
| 91 |
<p id="MLAddDelP"> |
|---|
| 92 |
<input type="button" id="MLDelete" name="MLDelete" value="delete" class="Buttons" disabled onclick="delML()" /><br/> |
|---|
| 93 |
<input type="button" id="MLInsert" name="MLInsert" value="insert" class="Buttons" onclick="insertML()"/> |
|---|
| 94 |
</p> |
|---|
| 95 |
<p id="MLAddTextP"> |
|---|
| 96 |
<input name="MLaddedit" id="MLaddedit" type="text"/> |
|---|
| 97 |
<input name="MLblankvalue" id="MLblankvalue" type="hidden" value="<?php echo $blankvalue?>"/> |
|---|
| 98 |
</p> |
|---|
| 99 |
<p id="MLAddP"> |
|---|
| 100 |
<input type="button" id="MLaddeditbutton" name="MLaddeditbutton" value="add" class="Buttons" onclick="addeditML('<?php echo $blankvalue?>')" /> |
|---|
| 101 |
</p> |
|---|
| 102 |
<p id="MLStatus" class="small"> </p> |
|---|
| 103 |
<div align="right"> |
|---|
| 104 |
<input type="button" id="MLok" name="MLok" value="ok" class="Buttons" style="width:75px;" onclick="clickOK('<?php echo APP_PATH?>','<?php echo $listid?>','<?php echo $listname?>')"/> |
|---|
| 105 |
<input type="button" id="MLcancel" name="MLcancel" value="cancel" class="Buttons" style="width:75px;" onclick="closeBox('<?php echo $listid?>');"/> |
|---|
| 106 |
</div> |
|---|
| 107 |
<?php } |
|---|
| 108 |
|
|---|
| 109 |
} |
|---|
| 110 |
|
|---|
| 111 |
|
|---|
| 112 |
|
|---|
| 113 |
|
|---|
| 114 |
|
|---|
| 115 |
|
|---|
| 116 |
if(!isset($_GET["cm"])) |
|---|
| 117 |
$_GET["cm"]="shw"; |
|---|
| 118 |
|
|---|
| 119 |
if(!isset($_GET["ln"])) |
|---|
| 120 |
$_GET["ln"]="shippingmethod"; |
|---|
| 121 |
|
|---|
| 122 |
if(!isset($_GET["bv"])) |
|---|
| 123 |
$_GET["bv"]="none"; |
|---|
| 124 |
|
|---|
| 125 |
$theList = new choiceList($db); |
|---|
| 126 |
|
|---|
| 127 |
switch($_GET["cm"]){ |
|---|
| 128 |
case "shw": |
|---|
| 129 |
$theList->displayBox($_GET["ln"],$_GET["bv"],$_GET["lid"]); |
|---|
| 130 |
break; |
|---|
| 131 |
case "del": |
|---|
| 132 |
$theList->deleteList($_GET["ln"]); |
|---|
| 133 |
break; |
|---|
| 134 |
case "add": |
|---|
| 135 |
$theList->addToList($_GET["ln"],$_GET["val"]); |
|---|
| 136 |
break; |
|---|
| 137 |
} |
|---|
| 138 |
|
|---|
| 139 |
?> |
|---|