| <?php | 
| include_once "/Account/User.php"; | 
| include_once "/db/DBOper.php"; | 
| include_once "/Common/Logging.php"; | 
| include_once "/Common/CommFunc.php"; | 
| include_once "/language/lang.php"; | 
|   | 
| \Logging\CreateLogging("serverops.gameVersionEdit.php"); | 
|   | 
| $Permission = \User\Permission::P_OPSGameVersion; | 
| $channel = $_SESSION['spid']; | 
| $user = new \User\User($_SESSION['UserAccount']); | 
| if (!$user->HavePermission($Permission)) { | 
|     exit; | 
| } | 
|   | 
| $opType = $_GET["opType"]; | 
| $BranchNum = intval($_GET["BranchNum"]); | 
| $BranchName = $_GET["BranchName"]; | 
| $Version = $_GET["Version"]; | 
|   | 
| $editInfo = array(); | 
| $pageTitle = "内容版本 - 添加"; | 
| if ($opType == "upd") { | 
|     $pageTitle = "内容版本 - 编辑"; | 
|     $find = array("Channel" => $channel, "BranchNum" => $BranchNum, "Version" => $Version); | 
|     DBOper\FindOne("GameVersion", $find, $editInfo, null, false); | 
| } | 
|   | 
| $stateNameInfo = array(); | 
| DBOper\Find( | 
|     "GameVersionState", | 
|     array("Channel" => $channel, "BranchNum" => $BranchNum), | 
|     $versionStateArray | 
| ); | 
|   | 
| // echo "_GET:" . print_r($_GET, true); | 
| // echo "editInfo:" . print_r($editInfo, true); | 
|   | 
| ?> | 
|   | 
| <html> | 
|   | 
| <head> | 
|     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | 
|     <title><?php echo $pageTitle; ?></title> | 
|     <link rel="stylesheet" type="text/css" href="/css/tableform.css"> | 
| </head> | 
|   | 
| <body> | 
|     <center> | 
|         <p><b><?php echo $pageTitle; ?></b></P> | 
|     </center> | 
|     <hr /> | 
|     <form action="gameVersion.php" method="post"> | 
|         <table id="tt" class="formTable"> | 
|             <tr> | 
|                 <td class="formTableTDName">渠道: </td> | 
|                 <td class="formTableTDValue"> | 
|                     <?php echo $channel; ?> | 
|                 </td> | 
|             </tr> | 
|             <tr> | 
|                 <td class="formTableTDName">所属分支编号: </td> | 
|                 <td class="formTableTDValue"> | 
|                     <input type="number" name="BranchNum" id="BranchNum" value="<?php echo $BranchNum ?>" readonly /> | 
|                 </td> | 
|             </tr> | 
|             <tr> | 
|                 <td class="formTableTDName">所属分支名称: </td> | 
|                 <td class="formTableTDValue"> | 
|                     <?php echo $BranchName; ?> | 
|                 </td> | 
|             </tr> | 
|             <tr> | 
|                 <td class="formTableTDName">版本号: </td> | 
|                 <td class="formTableTDValue"> | 
|                     <input type="input" name="Version" id="Version" value="<?php echo array_key_exists("Version", $editInfo)  ? $editInfo["Version"] : "" ?>" placeholder="如 1.0.1" /> | 
|                     <?php | 
|                     if ($opType == "upd") { | 
|                         echo "<input type='hidden' name='SrcVersion' value='" . $editInfo["Version"] . "'/>"; | 
|                     } | 
|                     ?> | 
|                 </td> | 
|             </tr> | 
|             <tr> | 
|                 <td class="formTableTDName">版本状态: </td> | 
|                 <td class="formTableTDValue"> | 
|                     <select name="VersionState" id="VersionState"> | 
|                         <?php | 
|                         $VersionState = array_key_exists("VersionState", $editInfo) ? $editInfo["VersionState"] : ""; | 
|                         foreach ($versionStateArray as $stateInfo) { | 
|                             echo "<option value=\"" . $stateInfo["VersionState"] . "\""; | 
|                             if ($VersionState == $stateInfo["VersionState"]) { | 
|                                 echo " selected"; | 
|                             } | 
|                             echo ">" . $stateInfo["StateName"] . "</option>"; | 
|                         } | 
|                         ?> | 
|                     </select> | 
|                 </td> | 
|             </tr> | 
|             <tr> | 
|                 <td class="formTableTDName">强更地址: </td> | 
|                 <td class="formTableTDValue"> | 
|                     <input type="input" name="ForceDownUrl" id="ForceDownUrl" value="<?php echo array_key_exists("ForceDownUrl", $editInfo)  ? $editInfo["ForceDownUrl"] : "" ?>" size="100" placeholder="可选,如果需要强更则输入强更地址" /> | 
|                 </td> | 
|             </tr> | 
|             <tr> | 
|                 <td class="formTableTDName"></td> | 
|                 <td class="formTableTDValue"> | 
|                     <input type="submit" name="submit" align="center" value="提交" onclick="return CheckSubmit()" /> | 
|                 </td> | 
|             </tr> | 
|             <input type="hidden" name="opType" id="opType" value="<?php echo $opType ?>" /> | 
|         </table> | 
|     </form> | 
|   | 
|     <script type="text/javascript"> | 
|         function CheckSubmit() { | 
|             if (!document.getElementById("Version").value) { | 
|                 alert("请输入版本号!"); | 
|                 document.getElementById('Version').focus(); | 
|                 return false; | 
|             } | 
|             var ForceDownUrl = document.getElementById("ForceDownUrl").value; | 
|             if (ForceDownUrl && ForceDownUrl.substr(0, 4) != "http") { | 
|                 alert("强更地址必须以“http”开头!"); | 
|                 document.getElementById('ForceDownUrl').focus(); | 
|                 return false; | 
|             } | 
|             return true; | 
|         } | 
|     </script> | 
| </body> | 
|   | 
| </html> |