PageRenderTime 58ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/osj-osj2duser_level_permissionsedit.php

http://osjobber.googlecode.com/
PHP | 568 lines | 447 code | 57 blank | 64 comment | 70 complexity | c06326a09e3278b85df03ec7ef205762 MD5 | raw file
Possible License(s): LGPL-2.1, AGPL-1.0
  1. <?php
  2. define("EW_PAGE_ID", "edit", TRUE); // Page ID
  3. define("EW_TABLE_NAME", 'osj-user_level_permissions', TRUE);
  4. ?>
  5. <?php
  6. session_start(); // Initialize session data
  7. ob_start(); // Turn on output buffering
  8. ?>
  9. <?php include "osj-ewcfg50.php" ?>
  10. <?php include "osj-ewmysql50.php" ?>
  11. <?php include "osj-phpfn50.php" ?>
  12. <?php include "osj-osj2duser_level_permissionsinfo.php" ?>
  13. <?php include "osj-userfn50.php" ?>
  14. <?php include "osj-osj2dusersinfo.php" ?>
  15. <?php
  16. header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
  17. header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // Always modified
  18. header("Cache-Control: private, no-store, no-cache, must-revalidate"); // HTTP/1.1
  19. header("Cache-Control: post-check=0, pre-check=0", false);
  20. header("Pragma: no-cache"); // HTTP/1.0
  21. ?>
  22. <?php
  23. // Open connection to the database
  24. $conn = ew_Connect();
  25. ?>
  26. <?php
  27. $Security = new cAdvancedSecurity();
  28. ?>
  29. <?php
  30. if (!$Security->IsLoggedIn()) $Security->AutoLogin();
  31. $Security->LoadCurrentUserLevel('osj-user_level_permissions');
  32. if (!$Security->CanAdmin()) {
  33. $Security->SaveLastUrl();
  34. Page_Terminate("osj-login.php");
  35. }
  36. ?>
  37. <?php
  38. // Common page loading event (in userfn*.php)
  39. Page_Loading();
  40. ?>
  41. <?php
  42. // Page load event, used in current page
  43. Page_Load();
  44. ?>
  45. <?php
  46. $osj2Duser_level_permissions->Export = @$_GET["export"]; // Get export parameter
  47. $sExport = $osj2Duser_level_permissions->Export; // Get export parameter, used in header
  48. $sExportFile = $osj2Duser_level_permissions->TableVar; // Get export file, used in header
  49. ?>
  50. <?php
  51. // Load key from QueryString
  52. if (@$_GET["user_level_id"] <> "") {
  53. $osj2Duser_level_permissions->user_level_id->setQueryStringValue($_GET["user_level_id"]);
  54. }
  55. if (@$_GET["user_level_table_name"] <> "") {
  56. $osj2Duser_level_permissions->user_level_table_name->setQueryStringValue($_GET["user_level_table_name"]);
  57. }
  58. // Create form object
  59. $objForm = new cFormObj();
  60. if (@$_POST["a_edit"] <> "") {
  61. $osj2Duser_level_permissions->CurrentAction = $_POST["a_edit"]; // Get action code
  62. LoadFormValues(); // Get form values
  63. } else {
  64. $osj2Duser_level_permissions->CurrentAction = "I"; // Default action is display
  65. }
  66. // Check if valid key
  67. if ($osj2Duser_level_permissions->user_level_id->CurrentValue == "") Page_Terminate($osj2Duser_level_permissions->getReturnUrl()); // Invalid key, exit
  68. if ($osj2Duser_level_permissions->user_level_table_name->CurrentValue == "") Page_Terminate($osj2Duser_level_permissions->getReturnUrl()); // Invalid key, exit
  69. switch ($osj2Duser_level_permissions->CurrentAction) {
  70. case "I": // Get a record to display
  71. if (!LoadRow()) { // Load Record based on key
  72. $_SESSION[EW_SESSION_MESSAGE] = "No records found"; // No record found
  73. Page_Terminate($osj2Duser_level_permissions->getReturnUrl()); // Return to caller
  74. }
  75. break;
  76. Case "U": // Update
  77. $osj2Duser_level_permissions->SendEmail = TRUE; // Send email on update success
  78. if (EditRow()) { // Update Record based on key
  79. $_SESSION[EW_SESSION_MESSAGE] = "Update successful"; // Update success
  80. Page_Terminate($osj2Duser_level_permissions->getReturnUrl()); // Return to caller
  81. } else {
  82. RestoreFormValues(); // Restore form values if update failed
  83. }
  84. }
  85. // Render the record
  86. $osj2Duser_level_permissions->RowType = EW_ROWTYPE_EDIT; // Render as edit
  87. RenderRow();
  88. ?>
  89. <?php include "osj-header.php" ?>
  90. <script type="text/javascript">
  91. <!--
  92. var EW_PAGE_ID = "edit"; // Page id
  93. var EW_SHOW_HIGHLIGHT = "Show highlight";
  94. var EW_HIDE_HIGHLIGHT = "Hide highlight";
  95. //-->
  96. </script>
  97. <script type="text/javascript">
  98. <!--
  99. function ew_ValidateForm(fobj) {
  100. if (fobj.a_confirm && fobj.a_confirm.value == "F")
  101. return true;
  102. var i, elm, aelm, infix;
  103. var rowcnt = (fobj.key_count) ? Number(fobj.key_count.value) : 1;
  104. for (i=0; i<rowcnt; i++) {
  105. infix = (fobj.key_count) ? String(i+1) : "";
  106. elm = fobj.elements["x" + infix + "_user_level_id"];
  107. if (elm && !ew_HasValue(elm)) {
  108. if (!ew_OnError(elm, "Please enter required field - user level id"))
  109. return false;
  110. }
  111. elm = fobj.elements["x" + infix + "_user_level_table_name"];
  112. if (elm && !ew_HasValue(elm)) {
  113. if (!ew_OnError(elm, "Please enter required field - Permission To Do..."))
  114. return false;
  115. }
  116. elm = fobj.elements["x" + infix + "_user_level_permission"];
  117. if (elm && !ew_HasValue(elm)) {
  118. if (!ew_OnError(elm, "Please enter required field - Permission Level"))
  119. return false;
  120. }
  121. }
  122. return true;
  123. }
  124. //-->
  125. </script>
  126. <script type="text/javascript">
  127. <!--
  128. var ew_DHTMLEditors = [];
  129. //-->
  130. </script>
  131. <script type="text/javascript">
  132. <!--
  133. // js for Popup Calendar
  134. //-->
  135. </script>
  136. <script type="text/javascript">
  137. <!--
  138. var ew_MultiPagePage = "Page"; // multi-page Page Text
  139. var ew_MultiPageOf = "of"; // multi-page Of Text
  140. var ew_MultiPagePrev = "Prev"; // multi-page Prev Text
  141. var ew_MultiPageNext = "Next"; // multi-page Next Text
  142. //-->
  143. </script>
  144. <script language="JavaScript" type="text/javascript">
  145. <!--
  146. // Write your client script here, no need to add script tags.
  147. // To include another .js script, use:
  148. // ew_ClientScriptInclude("my_javascript.js");
  149. //-->
  150. </script>
  151. <p><span class="phpmaker">Edit TABLE: User Permissions<br><br><a href="<?php echo $osj2Duser_level_permissions->getReturnUrl() ?>">Go Back</a></span></p>
  152. <?php
  153. if (@$_SESSION[EW_SESSION_MESSAGE] <> "") {
  154. ?>
  155. <p><span class="ewmsg"><?php echo $_SESSION[EW_SESSION_MESSAGE] ?></span></p>
  156. <?php
  157. $_SESSION[EW_SESSION_MESSAGE] = ""; // Clear message
  158. }
  159. ?>
  160. <form name="fosj2Duser_level_permissionsedit" id="fosj2Duser_level_permissionsedit" action="osj-osj2duser_level_permissionsedit.php" method="post" onSubmit="return ew_ValidateForm(this);">
  161. <p>
  162. <input type="hidden" name="a_edit" id="a_edit" value="U">
  163. <table class="ewTable">
  164. <tr class="ewTableRow">
  165. <td class="ewTableHeader">user level id<span class='ewmsg'>&nbsp;*</span></td>
  166. <td<?php echo $osj2Duser_level_permissions->user_level_id->CellAttributes() ?>><span id="cb_x_user_level_id">
  167. <div<?php echo $osj2Duser_level_permissions->user_level_id->ViewAttributes() ?>><?php echo $osj2Duser_level_permissions->user_level_id->EditValue ?></div>
  168. <input type="hidden" name="x_user_level_id" id="x_user_level_id" value="<?php echo ew_HtmlEncode($osj2Duser_level_permissions->user_level_id->CurrentValue) ?>">
  169. </span></td>
  170. </tr>
  171. <tr class="ewTableAltRow">
  172. <td class="ewTableHeader">Permission To Do...<span class='ewmsg'>&nbsp;*</span></td>
  173. <td<?php echo $osj2Duser_level_permissions->user_level_table_name->CellAttributes() ?>><span id="cb_x_user_level_table_name">
  174. <div<?php echo $osj2Duser_level_permissions->user_level_table_name->ViewAttributes() ?>><?php echo $osj2Duser_level_permissions->user_level_table_name->EditValue ?></div>
  175. <input type="hidden" name="x_user_level_table_name" id="x_user_level_table_name" value="<?php echo ew_HtmlEncode($osj2Duser_level_permissions->user_level_table_name->CurrentValue) ?>">
  176. </span></td>
  177. </tr>
  178. <tr class="ewTableRow">
  179. <td class="ewTableHeader">Permission Level<span class='ewmsg'>&nbsp;*</span></td>
  180. <td<?php echo $osj2Duser_level_permissions->user_level_permission->CellAttributes() ?>><span id="cb_x_user_level_permission">
  181. <select id="x_user_level_permission" name="x_user_level_permission"<?php echo $osj2Duser_level_permissions->user_level_permission->EditAttributes() ?>>
  182. <!--option value="">Please Select</option-->
  183. <?php
  184. if (is_array($osj2Duser_level_permissions->user_level_permission->EditValue)) {
  185. $arwrk = $osj2Duser_level_permissions->user_level_permission->EditValue;
  186. $rowswrk = count($arwrk);
  187. for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
  188. $selwrk = (strval($osj2Duser_level_permissions->user_level_permission->CurrentValue) == strval($arwrk[$rowcntwrk][0])) ? " selected" : "";
  189. ?>
  190. <option value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?>>
  191. <?php echo $arwrk[$rowcntwrk][1] ?>
  192. </option>
  193. <?php
  194. }
  195. }
  196. ?>
  197. </select>
  198. </span></td>
  199. </tr>
  200. </table>
  201. <p>
  202. <input type="submit" name="btnAction" id="btnAction" value=" Edit ">
  203. </form>
  204. <script language="JavaScript" type="text/javascript">
  205. <!--
  206. // Write your table-specific startup script here
  207. // document.write("page loaded");
  208. //-->
  209. </script>
  210. <?php include "osj-footer.php" ?>
  211. <?php
  212. // If control is passed here, simply terminate the page without redirect
  213. Page_Terminate();
  214. // -----------------------------------------------------------------
  215. // Subroutine Page_Terminate
  216. // - called when exit page
  217. // - clean up connection and objects
  218. // - if url specified, redirect to url, otherwise end response
  219. function Page_Terminate($url = "") {
  220. global $conn;
  221. // Page unload event, used in current page
  222. Page_Unload();
  223. // Global page unloaded event (in userfn*.php)
  224. Page_Unloaded();
  225. // Close Connection
  226. $conn->Close();
  227. // Go to url if specified
  228. if ($url <> "") {
  229. ob_end_clean();
  230. header("Location: $url");
  231. }
  232. exit();
  233. }
  234. ?>
  235. <?php
  236. // Load form values
  237. function LoadFormValues() {
  238. // Load from form
  239. global $objForm, $osj2Duser_level_permissions;
  240. $osj2Duser_level_permissions->user_level_id->setFormValue($objForm->GetValue("x_user_level_id"));
  241. $osj2Duser_level_permissions->user_level_table_name->setFormValue($objForm->GetValue("x_user_level_table_name"));
  242. $osj2Duser_level_permissions->user_level_permission->setFormValue($objForm->GetValue("x_user_level_permission"));
  243. }
  244. // Restore form values
  245. function RestoreFormValues() {
  246. global $osj2Duser_level_permissions;
  247. $osj2Duser_level_permissions->user_level_id->CurrentValue = $osj2Duser_level_permissions->user_level_id->FormValue;
  248. $osj2Duser_level_permissions->user_level_table_name->CurrentValue = $osj2Duser_level_permissions->user_level_table_name->FormValue;
  249. $osj2Duser_level_permissions->user_level_permission->CurrentValue = $osj2Duser_level_permissions->user_level_permission->FormValue;
  250. }
  251. ?>
  252. <?php
  253. // Load row based on key values
  254. function LoadRow() {
  255. global $conn, $Security, $osj2Duser_level_permissions;
  256. $sFilter = $osj2Duser_level_permissions->SqlKeyFilter();
  257. if (!is_numeric($osj2Duser_level_permissions->user_level_id->CurrentValue)) {
  258. return FALSE; // Invalid key, exit
  259. }
  260. $sFilter = str_replace("@user_level_id@", ew_AdjustSql($osj2Duser_level_permissions->user_level_id->CurrentValue), $sFilter); // Replace key value
  261. $sFilter = str_replace("@user_level_table_name@", ew_AdjustSql($osj2Duser_level_permissions->user_level_table_name->CurrentValue), $sFilter); // Replace key value
  262. // Call Row Selecting event
  263. $osj2Duser_level_permissions->Row_Selecting($sFilter);
  264. // Load sql based on filter
  265. $osj2Duser_level_permissions->CurrentFilter = $sFilter;
  266. $sSql = $osj2Duser_level_permissions->SQL();
  267. if ($rs = $conn->Execute($sSql)) {
  268. if ($rs->EOF) {
  269. $LoadRow = FALSE;
  270. } else {
  271. $LoadRow = TRUE;
  272. $rs->MoveFirst();
  273. LoadRowValues($rs); // Load row values
  274. // Call Row Selected event
  275. $osj2Duser_level_permissions->Row_Selected($rs);
  276. }
  277. $rs->Close();
  278. } else {
  279. $LoadRow = FALSE;
  280. }
  281. return $LoadRow;
  282. }
  283. // Load row values from recordset
  284. function LoadRowValues(&$rs) {
  285. global $osj2Duser_level_permissions;
  286. $osj2Duser_level_permissions->user_level_id->setDbValue($rs->fields('user_level_id'));
  287. $osj2Duser_level_permissions->user_level_table_name->setDbValue($rs->fields('user_level_table_name'));
  288. $osj2Duser_level_permissions->user_level_permission->setDbValue($rs->fields('user_level_permission'));
  289. }
  290. ?>
  291. <?php
  292. // Render row values based on field settings
  293. function RenderRow() {
  294. global $conn, $Security, $osj2Duser_level_permissions;
  295. // Call Row Rendering event
  296. $osj2Duser_level_permissions->Row_Rendering();
  297. // Common render codes for all row types
  298. // user_level_id
  299. $osj2Duser_level_permissions->user_level_id->CellCssStyle = "";
  300. $osj2Duser_level_permissions->user_level_id->CellCssClass = "";
  301. // user_level_table_name
  302. $osj2Duser_level_permissions->user_level_table_name->CellCssStyle = "";
  303. $osj2Duser_level_permissions->user_level_table_name->CellCssClass = "";
  304. // user_level_permission
  305. $osj2Duser_level_permissions->user_level_permission->CellCssStyle = "";
  306. $osj2Duser_level_permissions->user_level_permission->CellCssClass = "";
  307. if ($osj2Duser_level_permissions->RowType == EW_ROWTYPE_VIEW) { // View row
  308. } elseif ($osj2Duser_level_permissions->RowType == EW_ROWTYPE_ADD) { // Add row
  309. } elseif ($osj2Duser_level_permissions->RowType == EW_ROWTYPE_EDIT) { // Edit row
  310. // user_level_id
  311. $osj2Duser_level_permissions->user_level_id->EditCustomAttributes = "";
  312. if (!is_null($osj2Duser_level_permissions->user_level_id->CurrentValue)) {
  313. $sSqlWrk = "SELECT `user_level_name` FROM `osj-user_level` WHERE `user_level_id` = " . ew_AdjustSql($osj2Duser_level_permissions->user_level_id->CurrentValue) . "";
  314. $sSqlWrk .= " ORDER BY `user_level_name` Asc";
  315. $rswrk = $conn->Execute($sSqlWrk);
  316. if ($rswrk) {
  317. if (!$rswrk->EOF) {
  318. $osj2Duser_level_permissions->user_level_id->EditValue = $rswrk->fields('user_level_name');
  319. }
  320. $rswrk->Close();
  321. } else {
  322. $osj2Duser_level_permissions->user_level_id->EditValue = $osj2Duser_level_permissions->user_level_id->CurrentValue;
  323. }
  324. } else {
  325. $osj2Duser_level_permissions->user_level_id->EditValue = NULL;
  326. }
  327. $osj2Duser_level_permissions->user_level_id->CssStyle = "";
  328. $osj2Duser_level_permissions->user_level_id->CssClass = "";
  329. $osj2Duser_level_permissions->user_level_id->ViewCustomAttributes = "";
  330. // user_level_table_name
  331. $osj2Duser_level_permissions->user_level_table_name->EditCustomAttributes = "";
  332. if (!is_null($osj2Duser_level_permissions->user_level_table_name->CurrentValue)) {
  333. switch ($osj2Duser_level_permissions->user_level_table_name->CurrentValue) {
  334. case "osj-applications":
  335. $osj2Duser_level_permissions->user_level_table_name->EditValue = "Applications";
  336. break;
  337. case "osj-applications":
  338. $osj2Duser_level_permissions->user_level_table_name->EditValue = "Applications";
  339. break;
  340. case "osj-posts":
  341. $osj2Duser_level_permissions->user_level_table_name->EditValue = "Postings";
  342. break;
  343. case "osj-resumes":
  344. $osj2Duser_level_permissions->user_level_table_name->EditValue = "Resumes";
  345. break;
  346. case "osj-users":
  347. $osj2Duser_level_permissions->user_level_table_name->EditValue = "Users";
  348. break;
  349. case "osj-user_detail":
  350. $osj2Duser_level_permissions->user_level_table_name->EditValue = "User Detail Page";
  351. break;
  352. case "osj-user_level":
  353. $osj2Duser_level_permissions->user_level_table_name->EditValue = "User Levels";
  354. break;
  355. case "osj-user_level_permissions":
  356. $osj2Duser_level_permissions->user_level_table_name->EditValue = "User Permission Levels";
  357. break;
  358. default:
  359. $osj2Duser_level_permissions->user_level_table_name->EditValue = $osj2Duser_level_permissions->user_level_table_name->CurrentValue;
  360. }
  361. } else {
  362. $osj2Duser_level_permissions->user_level_table_name->EditValue = NULL;
  363. }
  364. $osj2Duser_level_permissions->user_level_table_name->CssStyle = "";
  365. $osj2Duser_level_permissions->user_level_table_name->CssClass = "";
  366. $osj2Duser_level_permissions->user_level_table_name->ViewCustomAttributes = "";
  367. // user_level_permission
  368. $osj2Duser_level_permissions->user_level_permission->EditCustomAttributes = "";
  369. $arwrk = array();
  370. $arwrk[] = array("0", "No Permission");
  371. $arwrk[] = array("1", "Add Only");
  372. $arwrk[] = array("2", "Delete Only");
  373. $arwrk[] = array("4", "Edit Only");
  374. $arwrk[] = array("8", "View Only");
  375. $arwrk[] = array("5", "Add/Edit");
  376. $arwrk[] = array("3", "Add/Delete");
  377. $arwrk[] = array("7", "Add/Edit/Delete");
  378. $arwrk[] = array("6", "Edit/Delete");
  379. $arwrk[] = array("9", "View/Add");
  380. $arwrk[] = array("11", "View/Add/Delete");
  381. $arwrk[] = array("12", "View/Edit");
  382. $arwrk[] = array("10", "View/Delete");
  383. $arwrk[] = array("14", "View/Edit/Delete");
  384. $arwrk[] = array("13", "View/Add/Edit");
  385. $arwrk[] = array("15", "View/Add/Edit/Delete");
  386. array_unshift($arwrk, array("", "Please Select"));
  387. $osj2Duser_level_permissions->user_level_permission->EditValue = $arwrk;
  388. } elseif ($osj2Duser_level_permissions->RowType == EW_ROWTYPE_SEARCH) { // Search row
  389. }
  390. // Call Row Rendered event
  391. $osj2Duser_level_permissions->Row_Rendered();
  392. }
  393. ?>
  394. <?php
  395. // Update record based on key values
  396. function EditRow() {
  397. global $conn, $Security, $osj2Duser_level_permissions;
  398. $sFilter = $osj2Duser_level_permissions->SqlKeyFilter();
  399. if (!is_numeric($osj2Duser_level_permissions->user_level_id->CurrentValue)) {
  400. return FALSE;
  401. }
  402. $sFilter = str_replace("@user_level_id@", ew_AdjustSql($osj2Duser_level_permissions->user_level_id->CurrentValue), $sFilter); // Replace key value
  403. $sFilter = str_replace("@user_level_table_name@", ew_AdjustSql($osj2Duser_level_permissions->user_level_table_name->CurrentValue), $sFilter); // Replace key value
  404. $osj2Duser_level_permissions->CurrentFilter = $sFilter;
  405. $sSql = $osj2Duser_level_permissions->SQL();
  406. $conn->raiseErrorFn = 'ew_ErrorFn';
  407. $rs = $conn->Execute($sSql);
  408. $conn->raiseErrorFn = '';
  409. if ($rs === FALSE)
  410. return FALSE;
  411. if ($rs->EOF) {
  412. $EditRow = FALSE; // Update Failed
  413. } else {
  414. // Save old values
  415. $rsold =& $rs->fields;
  416. $rsnew = array();
  417. // Field user_level_id
  418. // Field user_level_table_name
  419. // Field user_level_permission
  420. $osj2Duser_level_permissions->user_level_permission->SetDbValueDef($osj2Duser_level_permissions->user_level_permission->CurrentValue, 0);
  421. $rsnew['user_level_permission'] =& $osj2Duser_level_permissions->user_level_permission->DbValue;
  422. // Call Row Updating event
  423. $bUpdateRow = $osj2Duser_level_permissions->Row_Updating($rsold, $rsnew);
  424. if ($bUpdateRow) {
  425. $conn->raiseErrorFn = 'ew_ErrorFn';
  426. $EditRow = $conn->Execute($osj2Duser_level_permissions->UpdateSQL($rsnew));
  427. $conn->raiseErrorFn = '';
  428. } else {
  429. if ($osj2Duser_level_permissions->CancelMessage <> "") {
  430. $_SESSION[EW_SESSION_MESSAGE] = $osj2Duser_level_permissions->CancelMessage;
  431. $osj2Duser_level_permissions->CancelMessage = "";
  432. } else {
  433. $_SESSION[EW_SESSION_MESSAGE] = "Update cancelled";
  434. }
  435. $EditRow = FALSE;
  436. }
  437. }
  438. // Call Row Updated event
  439. if ($EditRow) {
  440. $osj2Duser_level_permissions->Row_Updated($rsold, $rsnew);
  441. }
  442. if ($EditRow) {
  443. WriteAuditTrailOnEdit($rsold, $rsnew);
  444. }
  445. $rs->Close();
  446. return $EditRow;
  447. }
  448. ?>
  449. <?php
  450. // Write Audit Trail start/end for grid update
  451. function WriteAuditTrailDummy($typ) {
  452. $table = 'osj-user_level_permissions';
  453. // Write Audit Trail
  454. $filePfx = "log";
  455. $curDate = date("Y/m/d");
  456. $curTime = date("H:i:s");
  457. $id = ew_ScriptName();
  458. $user = CurrentUserID();
  459. $action = $typ;
  460. ew_WriteAuditTrail($filePfx, $curDate, $curTime, $id, $user, $action, $table, "", "", "", "");
  461. }
  462. ?>
  463. <?php
  464. // Write Audit Trail (edit page)
  465. function WriteAuditTrailOnEdit(&$rsold, &$rsnew) {
  466. global $osj2Duser_level_permissions;
  467. $table = 'osj-user_level_permissions';
  468. // Get key value
  469. $key = "";
  470. if ($key <> "") $key .= EW_COMPOSITE_KEY_SEPARATOR;
  471. $key .= $rsold['user_level_id'];
  472. if ($key <> "") $key .= EW_COMPOSITE_KEY_SEPARATOR;
  473. $key .= $rsold['user_level_table_name'];
  474. // Write Audit Trail
  475. $filePfx = "log";
  476. $curDate = date("Y/m/d");
  477. $curTime = date("H:i:s");
  478. $id = ew_ScriptName();
  479. $user = CurrentUserID();
  480. $action = "U";
  481. foreach (array_keys($rsnew) as $fldname) {
  482. if ($osj2Duser_level_permissions->fields[$fldname]->FldDataType <> EW_DATATYPE_BLOB) { // Ignore Blob Field
  483. if ($osj2Duser_level_permissions->fields[$fldname]->FldDataType == EW_DATATYPE_MEMO) { // DateTime Field
  484. $modified = (ew_FormatDateTime($rsold[$fldname], 0) <> ew_FormatDateTime($rsnew[$fldname], 0));
  485. } else {
  486. $modified = ($rsold[$fldname] <> $rsnew[$fldname]);
  487. }
  488. if ($modified) {
  489. if ($osj2Duser_level_permissions->fields[$fldname]->FldDataType == EW_DATATYPE_MEMO) { // Memo Field
  490. $oldvalue = "<MEMO>";
  491. $newvalue = "<MEMO>";
  492. } else {
  493. $oldvalue = $rsold[$fldname];
  494. $newvalue = $rsnew[$fldname];
  495. }
  496. ew_WriteAuditTrail($filePfx, $curDate, $curTime, $id, $user, $action, $table, $fldname, $key, $oldvalue, $newvalue);
  497. }
  498. }
  499. }
  500. }
  501. ?>
  502. <?php
  503. // Page Load event
  504. function Page_Load() {
  505. //echo "Page Load";
  506. }
  507. // Page Unload event
  508. function Page_Unload() {
  509. //echo "Page Unload";
  510. }
  511. ?>