function get_project_log_table($project_id) { global $user; global $num_hours; global $log_url; global $ma_url; print "<tr><th>Time</th><th>Message</th><th>Member</th></tr>"; $entries = get_log_entries_for_context($log_url, $user, CS_CONTEXT_TYPE::PROJECT, $project_id, $num_hours); if (is_array($entries) && count($entries) > 0) { usort($entries, 'compare_log_entries'); $entry_member_names = lookup_member_names_for_rows($ma_url, $user, $entries, LOGGING_TABLE_FIELDNAME::USER_ID); foreach ($entries as $entry) { $message = $entry[LOGGING_TABLE_FIELDNAME::MESSAGE]; $time = dateUIFormat($entry[LOGGING_TABLE_FIELDNAME::EVENT_TIME]); $member_id = $entry[LOGGING_TABLE_FIELDNAME::USER_ID]; $member_name = $entry_member_names[$member_id]; // error_log("ENTRY = " . print_r($entry, true)); // If the MA or other authority took the action, then there is no name and no user so don't show the project-member page if ($member_name == "NONE") { print "<tr><td>{$time}</td><td>{$message}</td><td>{$member_name}</td></tr>\n"; } else { print "<tr><td>{$time}</td><td>{$message}</td><td><a href=\"project-member.php?project_id=" . $project_id . "&member_id={$member_id}\">{$member_name}</a></td></tr>\n"; } } } else { print "<tr><td></td><td><i>No messages.</i></td><td></td></tr>\n"; } }
// OUT OF OR IN CONNECTION WITH THE WORK OR THE USE OR OTHER DEALINGS // IN THE WORK. //---------------------------------------------------------------------- require_once "user.php"; require_once "sr_client.php"; require_once "sr_constants.php"; require_once "pa_client.php"; require_once "pa_constants.php"; require_once 'rq_client.php'; require_once "sa_client.php"; require_once "cs_client.php"; require_once "proj_slice_member.php"; include "services.php"; if (isset($expired_projects) && count($expired_projects) > 0) { print "<h2>Expired Projects</h2>\n"; $lead_names = lookup_member_names_for_rows($ma_url, $user, $expired_projects, PA_PROJECT_TABLE_FIELDNAME::LEAD_ID); print "\n<table>\n"; print "<tr><th>Project Name</th><th>Project Lead</th><th>Purpose</th><th>Slice Count</th>" . "</tr>\n"; // name, lead_id, purpose foreach ($expired_projects as $project) { $project_id = $project[PA_PROJECT_TABLE_FIELDNAME::PROJECT_ID]; $handle_req_str = ""; if ($user->isAllowed(PA_ACTION::ADD_PROJECT_MEMBER, CS_CONTEXT_TYPE::PROJECT, $project_id)) { if (array_key_exists($project_id, $project_request_map)) { $reqcnt = count($project_request_map[$project_id]); } else { $reqcnt = 0; } // error_log("REQCNT " . print_r($reqcnt, true) . " " . $project_id); if ($reqcnt == 0) { $handle_req_str = "";
foreach ($my_slice_objects as $slice) { $slice_id = $slice[SA_SLICE_TABLE_FIELDNAME::SLICE_ID]; $expired = $slice[SA_SLICE_TABLE_FIELDNAME::EXPIRED]; if (convert_boolean($expired)) { $expired_slices[$slice_id] = $slice; } else { $unexpired_slices[$slice_id] = $slice; } } $unexpired_slice_owner_names = array(); if (count($unexpired_slices) > 0) { $unexpired_slice_owner_names = lookup_member_names_for_rows($ma_url, $user, $unexpired_slices, SA_SLICE_TABLE_FIELDNAME::OWNER_ID); } $expired_slice_owner_names = array(); if (count($expired_slices) > 0) { $expired_slice_owner_names = lookup_member_names_for_rows($ma_url, $user, $expired_slices, SA_SLICE_TABLE_FIELDNAME::OWNER_ID); } $my_slice_objects = $unexpired_slices; $slice_owner_names = $unexpired_slice_owner_names; if (count($my_slice_objects) > 0) { $base_url = relative_url("slicecred.php?"); $slice_base_url = relative_url("slice.php?"); $listres_base_url = relative_url("listresources.php?"); $resource_base_url = relative_url("slice-add-resources-jacks.php?"); $delete_sliver_base_url = relative_url("confirm-sliverdelete.php?"); //separate slices for which $user is lead $lead_slices = array(); $nonlead_slices = array(); foreach ($my_slice_objects as $slice) { if ($slice['owner_id'] === $user->account_id) { $lead_slices[] = $slice;
print "<p><i>Please do not try to join arbitrary projects. Abuse of\n this functionality may result in revocation of your GENI account.\n </i></p>"; /* datatables.net (for sortable/searchable tables) */ echo '<script type="text/javascript">'; echo '$(document).ready( function () {'; echo ' $(\'#projects\').DataTable({paging: false});'; echo '} );'; echo '</script>'; print "<table id=\"projects\" class=\"display\">\n"; print "<thead>\n"; print "<tr><th>Project</th><th>Purpose</th><th>Project Lead</th><th>Join</th></tr>\n"; $jointhis_url = "join-this-project.php?project_id="; $project_details = lookup_project_details($sa_url, $user, $pids); usort($project_details, "project_name_compare"); // error_log("PROJ_DETAILS = " . print_r($project_details, true)); $ma_url = get_first_service_of_type(SR_SERVICE_TYPE::MEMBER_AUTHORITY); $member_names = lookup_member_names_for_rows($ma_url, $user, $project_details, PA_PROJECT_TABLE_FIELDNAME::LEAD_ID); // error_log("MEMBER_DETAILS = " . print_r($member_names, true)); print "</thead><tbody>\n"; foreach ($project_details as $project) { // $project = lookup_project($sa_url, $user, $project_id); $expired = $project[PA_PROJECT_TABLE_FIELDNAME::EXPIRED]; if (convert_boolean($expired)) { continue; } print "<tr><td>"; print $project[PA_PROJECT_TABLE_FIELDNAME::PROJECT_NAME]; print "</td><td>"; print $project[PA_PROJECT_TABLE_FIELDNAME::PROJECT_PURPOSE]; print "</td><td>"; $lead_id = $project[PA_PROJECT_TABLE_FIELDNAME::LEAD_ID]; $leadname = $member_names[$lead_id];
$_SESSION['lasterror'] = "Slice not specified to edit"; relative_redirect("dashboard.php#slices"); } if (!isset($project_id) || $project_id == '' || $project_id == 'none') { error_log("Project ID not set"); $_SESSION['lasterror'] = "No project specified for editting slice membership"; relative_redirect("slice.php?slice_id={$slice_id}"); } // Get current list of members $current_members = get_slice_members($sa_url, $user, $slice_id); //foreach($current_members as $cm) { // error_log("CM = " . print_r($cm, true)); //} // Get list of all members of project $all_project_members = get_project_members($sa_url, $user, $project_id); $all_project_member_names = lookup_member_names_for_rows($ma_url, $user, $all_project_members, PA_PROJECT_MEMBER_TABLE_FIELDNAME::MEMBER_ID); $all_project_member_ids = array(); foreach ($all_project_members as $apm) { // error_log("APM = " . print_r($apm, true)); $all_project_member_ids[] = $apm[PA_PROJECT_MEMBER_TABLE_FIELDNAME::MEMBER_ID]; } $all_project_member_details = lookup_member_details($ma_url, $user, $all_project_member_ids); //foreach($all_project_member_details as $apmd) { // error_log("APMD = " . print_r($apmd, true)); //} $disabled = "disabled = " . '"' . "disabled" . '"'; $edit_members_disabled = ""; if (!$user->isAllowed(SA_ACTION::ADD_SLICE_MEMBER, CS_CONTEXT_TYPE::SLICE, $slice_id) || $in_lockdown_mode) { $edit_members_disabled = $disabled; $_SESSION['lasterror'] = "User has no privileges to edit slice '" . $slice_name . "'."; relative_redirect("slice.php?slice_id={$slice_id}");
* * If not, redirect to home page. *------------------------------------------------------------ */ $user_is_project_member = false; foreach ($members as $m) { if ($user->account_id == $m[MA_MEMBER_TABLE_FIELDNAME::MEMBER_ID]) { $user_is_project_member = true; break; } } if (!$user_is_project_member) { $_SESSION['lasterror'] = 'User has no privileges to view project ' . $project_name; relative_redirect('home.php'); } $member_names = lookup_member_names_for_rows($ma_url, $user, $members, MA_MEMBER_TABLE_FIELDNAME::MEMBER_ID); //error_log("members = " . print_r($members, true)); $num_members = count($members); $reqs = null; if ($user->isAllowed(PA_ACTION::ADD_PROJECT_MEMBER, CS_CONTEXT_TYPE::PROJECT, $project_id)) { $reqs = get_pending_requests_for_user($sa_url, $user, $user->account_id, CS_CONTEXT_TYPE::PROJECT, $project_id); } $log_url = get_first_service_of_type(SR_SERVICE_TYPE::LOGGING_SERVICE); $actdisabled = ''; if ($expired === True) { $actdisabled = $disabled; } show_header('GENI Portal: Projects', true, true); ?> <script src='cards.js'></script>
//print "<tr><td class='label'><b>Slice Owner</b></td><td><a href=$slice_own_url>$slice_owner_name</a> <a href='mailto:$owner_email'>e-mail</a></td></tr>\n"; print "</table>\n"; // --- ?> <h2 id="recent_actions">Recent Slice Actions</h2> <table> <tr> <th>Time</th> <th>Message</th> <th>Member</th> <?php $log_url = get_first_service_of_type(SR_SERVICE_TYPE::LOGGING_SERVICE); $entries = get_log_entries_for_context($log_url, $user, CS_CONTEXT_TYPE::SLICE, $slice_id); $entry_member_names = lookup_member_names_for_rows($ma_url, $user, $entries, LOGGING_TABLE_FIELDNAME::USER_ID); usort($entries, 'compare_log_entries'); foreach ($entries as $entry) { $message = $entry[LOGGING_TABLE_FIELDNAME::MESSAGE]; $time = dateUIFormat($entry[LOGGING_TABLE_FIELDNAME::EVENT_TIME]); $member_id = $entry[LOGGING_TABLE_FIELDNAME::USER_ID]; $member_name = $entry_member_names[$member_id]; // error_log("ENTRY = " . print_r($entry, true)); // print "<tr><td>$time</td><td>$message</td><td><a href=\"slice-member.php?slice_id=" . $slice_id . "&member_id=$member_id\">$member_name</a></td></tr>\n"; // FIXME: Want a mailto link print "<tr><td>{$time}</td><td>{$message}</td><td>{$member_name}</td></tr>\n"; } ?> </table>
function setup_jacks_slice_context() { global $user; global $slice; global $slice_id; global $slice_name; global $ma_url; global $sa_url; global $all_ams; global $slice_ams; global $slice_urn; global $slice_expiration; // Set globals for variables used in slice jacks page later global $owner_email; global $slice_date_expiration; global $member_names; global $slice_creation; global $slice_desc; global $slice_owner_name; global $members; unset($slice); include "tool-lookupids.php"; if (!isset($sa_url)) { $sa_url = get_first_service_of_type(SR_SERVICE_TYPE::SLICE_AUTHORITY); } if (!isset($ma_url)) { $ma_url = get_first_service_of_type(SR_SERVICE_TYPE::MEMBER_AUTHORITY); } if (isset($slice)) { $slice_name = $slice[SA_ARGUMENT::SLICE_NAME]; // error_log("SLICE = " . print_r($slice, true)); $slice_desc = $slice[SA_ARGUMENT::SLICE_DESCRIPTION]; $slice_creation_db = $slice[SA_ARGUMENT::CREATION]; $slice_creation = dateUIFormat($slice_creation_db); $slice_expiration_db = $slice[SA_ARGUMENT::EXPIRATION]; $slice_expiration = dateUIFormat($slice_expiration_db); $slice_date_expiration = dateOnlyUIFormat($slice_expiration_db); $slice_urn = $slice[SA_ARGUMENT::SLICE_URN]; $slice_owner_id = $slice[SA_ARGUMENT::OWNER_ID]; $owner = $user->fetchMember($slice_owner_id); $slice_owner_name = $owner->prettyName(); $owner_email = $owner->email(); $project_name = $project[PA_PROJECT_TABLE_FIELDNAME::PROJECT_NAME]; //error_log("slice project_name result: $project_name\n"); // Fill in members of slice member table $members = get_slice_members($sa_url, $user, $slice_id); $member_names = lookup_member_names_for_rows($ma_url, $user, $members, SA_SLICE_MEMBER_TABLE_FIELDNAME::MEMBER_ID); //find only ams that slice has resources on $slivers = lookup_sliver_info_by_slice($sa_url, $user, $slice_urn); //find aggregates to be able to return just am_id $all_aggs = get_services_of_type(SR_SERVICE_TYPE::AGGREGATE_MANAGER); $aggs_with_resources = array(); //do the comparison and find ams foreach ($slivers as $sliver) { foreach ($all_aggs as $agg) { if ($sliver[SA_SLIVER_INFO_TABLE_FIELDNAME::SLIVER_INFO_AGGREGATE_URN] == $agg[SR_TABLE_FIELDNAME::SERVICE_URN]) { $aggs_with_resources[] = $agg[SR_TABLE_FIELDNAME::SERVICE_ID]; break; } } } //return unique ids $slice_ams = array_unique($aggs_with_resources, SORT_REGULAR); // Now restore the array to a numerically ordered array because // array_unique preserves keys, so it could turn into, in effect, a // dictionary. $slice_ams = array_values($slice_ams); } else { print "Unable to load slice<br/>\n"; $_SESSION['lasterror'] = "Unable to load slice"; relative_redirect("home.php"); exit; } if (!isset($all_ams)) { $am_list = get_services_of_type(SR_SERVICE_TYPE::AGGREGATE_MANAGER); $all_ams = array(); foreach ($am_list as $am) { $single_am = array(); $service_id = $am[SR_TABLE_FIELDNAME::SERVICE_ID]; $single_am['name'] = $am[SR_TABLE_FIELDNAME::SERVICE_NAME]; $single_am['url'] = $am[SR_TABLE_FIELDNAME::SERVICE_URL]; $single_am['urn'] = $am[SR_TABLE_FIELDNAME::SERVICE_URN]; $all_ams[$service_id] = $single_am; } } }