| 1 | <?php |
|---|
| 2 | /* |
|---|
| 3 | $Rev$ | $LastChangedBy$ |
|---|
| 4 | $LastChangedDate$ |
|---|
| 5 | +-------------------------------------------------------------------------+ |
|---|
| 6 | | Copyright (c) 2004 - 2007, Kreotek LLC | |
|---|
| 7 | | All rights reserved. | |
|---|
| 8 | +-------------------------------------------------------------------------+ |
|---|
| 9 | | | |
|---|
| 10 | | Redistribution and use in source and binary forms, with or without | |
|---|
| 11 | | modification, are permitted provided that the following conditions are | |
|---|
| 12 | | met: | |
|---|
| 13 | | | |
|---|
| 14 | | - Redistributions of source code must retain the above copyright | |
|---|
| 15 | | notice, this list of conditions and the following disclaimer. | |
|---|
| 16 | | | |
|---|
| 17 | | - Redistributions in binary form must reproduce the above copyright | |
|---|
| 18 | | notice, this list of conditions and the following disclaimer in the | |
|---|
| 19 | | documentation and/or other materials provided with the distribution. | |
|---|
| 20 | | | |
|---|
| 21 | | - Neither the name of Kreotek LLC nor the names of its contributore may | |
|---|
| 22 | | be used to endorse or promote products derived from this software | |
|---|
| 23 | | without specific prior written permission. | |
|---|
| 24 | | | |
|---|
| 25 | | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
|---|
| 26 | | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
|---|
| 27 | | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A | |
|---|
| 28 | | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
|---|
| 29 | | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
|---|
| 30 | | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
|---|
| 31 | | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
|---|
| 32 | | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
|---|
| 33 | | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
|---|
| 34 | | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
|---|
| 35 | | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
|---|
| 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 | }//end while |
|---|
| 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 }//end function |
|---|
| 108 | |
|---|
| 109 | }//end class |
|---|
| 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 | ?> |
|---|