<?php if ($offline != "") { ?> <input name="offline" type="hidden" value="offline"> <?php } ?> <input type="hidden" name="workflowid" value="<?php echo $workflowid; ?> " /> </form> <span id="error" class="small"> </span> <?php if (!$authentication || get_page_acccess_level() <= $min_run_level) { ?> <input id="prev" type="button" value="Start Over" onclick="prevStep();"/> <?php } if ($finished) { ?> <input id="next" type="button" value="Finished" onclick="nextStep();" /> <?php } else { ?> <input id="next" type="button" value="Results" onclick="nextStep();" /> <?php } ?> <div class="spacer"></div>
* All rights reserved. This program and the accompanying materials * are made available under the terms of the * University of Illinois/NCSA Open Source License * which accompanies this distribution, and is available at * http://opensource.ncsa.illinois.edu/license.html */ // Check login require "common.php"; if ($authentication) { open_database(); if (!check_login()) { header("Location: index.php"); close_database(); exit; } if (get_page_acccess_level() > $min_run_level) { header("Location: history.php"); close_database(); exit; } close_database(); } ?> <!DOCTYPE html> <html> <head> <title>EBI Sites</title> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" /> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <link rel="stylesheet" type="text/css" href="sites.css" /> <script type="text/javascript" src="jquery-1.7.2.min.js"></script>
function print_entry($id, $table, $readonly) { global $pdo; global $sections; $edit = false; if ($readonly) { if ($sections[$table]['level']['show'] < get_page_acccess_level() && ($table != "users" || $id != get_userid())) { #header("Location: index.php"); die("no access"); } if ($sections[$table]['level']['edit'] >= get_page_acccess_level() || $table == "users" && $id == get_userid()) { $edit = true; } } else { if ($sections[$table]['level']['edit'] < get_page_acccess_level() && ($table != "users" || $id != get_userid())) { #header("Location: index.php"); die("no access"); } } # update database $msg = ""; if (!$readonly && isset($_REQUEST['action']) && $_REQUEST['action'] == "update") { $msg = editor_update($id, $table); } # print navigation print_prev_next($id, $table, $edit); if ($readonly) { $disabled = "disabled"; } else { $disabled = ""; } # get the row from the database (this can be empty) $result = $pdo->query("SELECT * FROM {$table} WHERE id={$id};"); if (!$result) { die('Invalid query : ' . error_database()); } $row = $result->fetch(PDO::FETCH_ASSOC); $result->closeCursor(); # check access_level if (is_array($row) && array_key_exists('access_level', $row) && $row['access_level'] != "" && $row['access_level'] != "-1") { if (get_acccess_level() > $row['access_level']) { header("Location: index.php"); return; } } if (!$readonly) { print "<form method=\"post\" action=\"edit.php\">\n"; print "<input name=\"table\" type=\"hidden\" value=\"{$table}\"/>\n"; print "<input name=\"id\" type=\"hidden\" value=\"{$id}\"/>\n"; } print "<div class=\"tbl\" id=\"editor\">\n"; foreach (column_names($table) as $key => $type) { if ($key == "id") { $fancykey = $key; } else { $fancykey = ucwords(str_replace("_", " ", str_replace("_id", "", $key))); } if (is_array($row) && array_key_exists($key, $row)) { $val = $row[$key]; } else { $val = ""; } if (substr($val, 0, 4) == "http") { $fancykey = "<a href=\"{$val}\">{$fancykey}</a>"; } print "<div class=\"row\">\n"; if ($key == "id") { if ($id == -1) { $val = "new entry"; } print "<div class=\"key\">{$fancykey}</div>\n"; print "<div class=\"val\"><input name=\"{$key}\" type=\"text\" disabled value=\"{$val}\"/></div>\n"; } else { if ($key == "created_at") { if ($id == -1) { $val = 'now'; print "<input name=\"u_{$key}\" type=\"hidden\" value=\"{$val}\"/>\n"; } print "<div class=\"key\">{$fancykey}</div>\n"; print "<div class=\"val\"><input name=\"{$key}\" type=\"text\" disabled value=\"{$val}\"/></div>\n"; } else { if ($key == "updated_at") { if ($id != -1) { print "<input name=\"u_{$key}\" type=\"hidden\" value=\"{$val}\"/>\n"; } print "<div class=\"key\">{$fancykey}</div>\n"; print "<div class=\"val\"><input name=\"{$key}\" type=\"text\" disabled value=\"{$val}\"/></div>\n"; } else { if ($key == "site_id") { print "<div class=\"key\">{$fancykey}</div>\n"; print "<div class=\"val\">\n"; print_sites_options("n_{$key}", $val, $readonly); print "</div>\n"; } else { if ($key == "model_id") { print "<div class=\"key\">{$fancykey}</div>\n"; print "<div class=\"val\">\n"; print_models_options("n_{$key}", $val, $readonly); print "</div>\n"; } else { if ($key == "user_id" || $key == "created_user_id" || $key == "updated_user_id") { print "<div class=\"key\">{$fancykey}</div>\n"; print "<div class=\"val\">\n"; print_users_options("n_{$key}", $val, $readonly); print "</div>\n"; } else { if ($key == "machine_id") { print "<div class=\"key\">{$fancykey}</div>\n"; print "<div class=\"val\">\n"; print_machines_options("n_{$key}", $val, $readonly); print "</div>\n"; } else { if ($key == "format_id") { print "<div class=\"key\">{$fancykey}</div>\n"; print "<div class=\"val\">\n"; print_formats_options("n_{$key}", $val, $readonly); print "</div>\n"; } else { if ($key == "citation_id") { print "<div class=\"key\">{$fancykey}</div>\n"; print "<div class=\"val\">\n"; print_citations_options("n_{$key}", $val, $readonly); print "</div>\n"; } else { if ($key == "specie_id") { print "<div class=\"key\">{$fancykey}</div>\n"; print "<div class=\"val\">\n"; print_species_options("n_{$key}", $val, $readonly); print "</div>\n"; } else { if ($key == "variable_id") { print "<div class=\"key\">{$fancykey}</div>\n"; print "<div class=\"val\">\n"; print_variables_options("n_{$key}", $val, $readonly); print "</div>\n"; } else { if ($key == "treatment_id") { print "<div class=\"key\">{$fancykey}</div>\n"; print "<div class=\"val\">\n"; print_treatments_options("n_{$key}", $val, $readonly); print "</div>\n"; } else { if ($key == "cultivar_id") { print "<div class=\"key\">{$fancykey}</div>\n"; print "<div class=\"val\">\n"; print_cultivars_options("n_{$key}", $val, $readonly); print "</div>\n"; } else { if ($key == "page_access_level") { if (get_page_acccess_level() == 1) { $sel_readonly = $readonly; } else { $sel_readonly = true; } print "<div class=\"key\">{$fancykey}</div>\n"; print "<div class=\"val\">\n"; print_select_array_options("n_{$key}", $val, $sel_readonly, array("1" => "Administrator", "2" => "Manager", "3" => "Creator", "4" => "Viewer")); print "</div>\n"; } else { if ($key == "access_level") { if (get_page_acccess_level() == 1 || $val == "" || $val == "-1") { $sel_readonly = $readonly; } else { $sel_readonly = true; } print "<div class=\"key\">{$fancykey}</div>\n"; print "<div class=\"val\">\n"; print_select_array_options("n_{$key}", $val, $sel_readonly, array("1" => "Restricted", "2" => "Internal EBI & Collaborators", "3" => "Creator", "4" => "Viewer")); print "</div>\n"; } else { if ($key == "salt") { if ($id == -1) { $val = uniqid("", true); print "<input name=\"s_{$key}\" type=\"hidden\" value=\"{$val}\"/>\n"; } else { print "<input name=\"s_{$key}\" type=\"hidden\" value=\"{$val}\"/>\n"; } print "<div class=\"key\">{$fancykey}</div>\n"; print "<div class=\"val\"><input name=\"s_{$key}\" type=\"text\" disabled value=\"{$val}\"/></div>\n"; } else { if ($key == "crypted_password") { print "<div class=\"key\">{$fancykey}</div>\n"; print "<div class=\"val\"><input name=\"p_{$key}\" type=\"password\" {$disabled} value=\"\"/></div>\n"; } else { if (stristr($type, "text")) { print "<div class=\"key\">{$fancykey}</div>\n"; print "<div class=\"val\"><textarea name=\"s_{$key}\" rows=\"10\" {$disabled}>{$val}</textarea></div>\n"; } else { if (stristr($type, "tinyint")) { print "<div class=\"key\">{$fancykey}</div>\n"; print "<div class=\"val\" style=\"width: auto;\"><input name=\"b_{$key}\" type=\"checkbox\" style=\"width: auto;\" {$disabled}"; if ($val == 1) { print " checked"; } print "/></div>\n"; } else { print "<div class=\"key\">{$fancykey}</div>\n"; print "<div class=\"val\"><input name=\"s_{$key}\" type=\"text\" {$disabled} value=\"{$val}\"/></div>\n"; } } } } } } } } } } } } } } } } } } } print "</div>\n"; } if (!$readonly) { print "<div class=\"row\">\n"; print "<div class=\"key\"><input name=\"action\" type=\"submit\" value=\"update\"/></div>\n"; print "<div class=\"val\"></div>\n"; print "</div>\n"; } print "</div>\n"; if (!$readonly) { print "</form>\n"; } return $msg; }
</div> <div id="output"> <h2>Execution Status <span id="workflows"></span></h2> <div class="table"> <div class="row"> <div class="header">ID</div> <div class="header">Site Name</div> <div class="header">Model Name</div> <div class="header">Model Type</div> <div class="header">Start Date</div> <div class="header">End Date</div> <div class="header">Started</div> <div class="header">Finished</div> <?php if (check_login() && get_page_acccess_level() <= $min_delete_level) { ?> <div class="header">Delete</div> <?php } ?> </div> </div> </div> <div id="footer"><?php echo get_footer(); ?> </div> </div> </body>
# find the table $table = isset($_REQUEST['table']) ? $_REQUEST['table'] : ""; $section = $sections[$table]; if (empty($section)) { header("Location: index.php"); die("Invalid table."); } # what is the current id if (isset($_REQUEST['id'])) { $id = $_REQUEST['id']; } else { header("Location: index.php"); die('need an id'); } # Make sure we can get here. if ($sections[$table]['level']['edit'] < get_page_acccess_level() && ($table != "users" || $id != get_userid())) { #header("Location: {$matches[1]}/index.php"); die("Not authorized. " . get_userid()); } # print top print_header($table); print_menu($section); # print form to edit entry $msg = print_entry($id, $table, false); # list files associated if ($section['files']) { $tmp = show_files($id, $table, false); if ($msg == "") { $msg = $tmp; } else { if ($tmp != "") {
* Copyright (c) 2012 University of Illinois, NCSA. * All rights reserved. This program and the accompanying materials * are made available under the terms of the * University of Illinois/NCSA Open Source License * which accompanies this distribution, and is available at * http://opensource.ncsa.illinois.edu/license.html */ // Check login require "common.php"; open_database(); if (!check_login()) { close_database(); header("Location: history.php"); exit; } if (get_page_acccess_level() > $min_delete_level) { header("Location: history.php"); close_database(); exit; } // runid if (!isset($_REQUEST['workflowid'])) { close_database(); die("Need a workflowid."); } $workflowid = $_REQUEST['workflowid']; ?> <!DOCTYPE html> <html> <head> <title>PEcAn Delete</title>
<?php require "common.php"; # find the table $table = isset($_REQUEST['table']) ? $_REQUEST['table'] : ""; $section = $sections[$table]; if (empty($section)) { #header("Location: index.php"); die("Invalid table."); } # Make sure we can get here. if (get_page_acccess_level() > $section['level']['show']) { #header("Location: index.php"); die("Not authorized."); } # print top print_header($table); print_menu($section); # create query to show things $msg = print_list($table, $sections[$table]['list']); # print footer of html print_footer($msg);