|
reSIProcate/repro
9694
|
00001 <?php 00002 require('reprofunctions.php'); 00003 dbgSquirt("============= Edit Resource ==============="); 00004 dbgSquirt("GET --" . dbgShowFile($_GET)); 00005 00006 $result = checkCookies($forceLogin,$error,FALSE); 00007 if (!($result) || $forceLogin) { 00008 // we got an error back that occurred while checkCookies was being run, 00009 // or authentication failed. Either way, bounce them back to the login screen 00010 header("Location: http://" . $_SERVER['HTTP_HOST'] . 00011 dirname($_SERVER['PHP_SELF']) . 00012 "/index.php?error=$error"); 00013 exit; 00014 } 00015 $username = $_COOKIE['user']; 00016 00017 $bounceURL = "Location: http://" . $_SERVER['HTTP_HOST'] . 00018 dirname($_SERVER['PHP_SELF']) . "/userhome.php?error="; 00019 00020 // this page is only entered via GET's 00021 // all of these should be set all the time, even though they might be 00022 // empty... if they aren't set, something is strange about how we got to this 00023 // page 00024 if (!isset($_GET['resourceId']) || !isset($_GET['aor']) || 00025 !isset($_GET['forwardType']) || !isset($_GET['forward']) || 00026 !isset($_GET['voicemail'])) { 00027 header($bounceURL . "Information missing in request to modify a resource. Please try again. If this error reoccurs, please contact an administrator."); 00028 exit(); 00029 } 00030 00031 $resourceId = $_GET['resourceId']; 00032 $aor = $_GET['aor']; 00033 $forwardType = $_GET['forwardType']; 00034 $forward = $_GET['forward']; 00035 $voicemail = $_GET['voicemail']; 00036 00037 // make sure resourceId isn't blank. Other fields could be blank 00038 if (empty($resourceId)) { 00039 header($bounceURL . "Information missing in request to modify a resource. Please try again. If this error reoccurs, please contact an administrator."); 00040 exit(); 00041 } 00042 00043 ?> 00044 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 00045 <!-- 00046 System: Repro 00047 File: editresource.php 00048 Purpose: display the current information for a resource. Allow an 00049 authenticated user to edit that information. 00050 Author: S. Chanin 00051 --> 00052 <html> 00053 <head> 00054 <link rel="stylesheet" type="text/css" href="repro_style.css" /> 00055 <title></title> 00056 <script type="text/javascript"> 00057 <!-- 00058 function disableForward() { 00059 document.resourceForm.forward.value = "" 00060 document.resourceForm.forward.disabled = true 00061 } 00062 00063 function enableForward() { 00064 document.resourceForm.forward.disabled = false 00065 } 00066 //--> 00067 </script> 00068 </head> 00069 00070 <body> 00071 <h1 class="title">Repro</h1> 00072 <h1>Edit Resource</h1> 00073 <hr /> 00074 00075 <?php 00076 // if we've looped back due to an error, show the message 00077 if (isset($_GET["error"]) && !empty($_GET['error'])) { 00078 echo '<p class="error">' . $_GET["error"] . "</p>\n"; 00079 } 00080 ?> 00081 00082 <form method="POST" action="savemodifiedresource.php" name="resourceForm" id="resourceForm"> 00083 <table> 00084 <input type="hidden" name="resourceId" id="resourceId" value="<?php echo $resourceId ?>"/> 00085 <tr> 00086 <td>Address</td> 00087 <td><input type="text" name="aor" id="aor" value="<?php echo $aor ?>"/></td> 00088 </tr> 00089 <tr> 00090 <td>Forward</td> 00091 <td><input type="radio" name="forwardType" id="forwardType" value="Yes" 00092 onclick="enableForward()" 00093 <?php if ("Y" == $forwardType || "" == $forwardType) 00094 echo 'checked="checked"'; ?> 00095 >Yes</td></tr> 00096 <tr><td> </td> 00097 <td><input type="radio" name="forwardType" id="forwardType" value="No" 00098 onclick="disableForward()" 00099 <?php if ("N" == $forwardType) echo 'checked="checked"'; ?> 00100 >No</td></tr> 00101 <tr><td>Forward Address</td> 00102 <td><input type="text" name="forward" id="forward" value="<?php echo $forward; ?>"/> 00103 </td> 00104 </tr> 00105 <tr> 00106 <td>Voicemail</td> 00107 <td><input type="text" name="voicemail" id="voicemail" value="<?php echo $voicemail; ?>"/></td> 00108 </tr> 00109 <tr> 00110 <td> </td> 00111 <td> 00112 <input type="submit" name="submit" id="submit" value="Save" /> 00113 <input type="submit" name="submit" id="submit" value="Cancel" /> 00114 </td> 00115 </tr> 00116 </table> 00117 00118 <?php 00119 // if forwardType is "N" we also need to disable the forward address box 00120 if ("N" == $forwardType) { 00121 ?> 00122 <script type="text/javascript"> 00123 <!-- 00124 disableForward() 00125 //--> 00126 </script> 00127 <?php 00128 } 00129 ?> 00130 00131 </form> 00132 00133 <br /><hr /> 00134 <a href="userhome.php">Return to User Home</a><br /> 00135 <a href="logout.php">Logout</a><br /> 00136 <br /> 00137 00138 </body> 00139 </html>
1.7.5.1