function create_project() { global $airavataclient; $project = new Project(); $project->owner = $_SESSION['username']; $project->name = $_POST['project-name']; $project->description = $_POST['project-description']; $projectId = null; try { $projectId = $airavataclient->createProject($project); if ($projectId) { print_success_message("<p>Project {$_POST['project-name']} created!</p>" . '<p>You will be redirected to the summary page shortly, or you can <a href="project_summary.php?projId=' . $projectId . '">go directly</a> to the project summary page.</p>'); redirect('project_summary.php?projId=' . $projectId); } else { print_error_message("Error creating project {$_POST['project-name']}!"); } } catch (InvalidRequestException $ire) { print_error_message('InvalidRequestException!<br><br>' . $ire->getMessage()); } catch (AiravataClientException $ace) { print_error_message('AiravataClientException!<br><br>' . $ace->getMessage()); } catch (AiravataSystemException $ase) { print_error_message('AiravataSystemException!<br><br>' . $ase->getMessage()); } return $projectId; }
function update_project($projectId, $updatedProject) { global $airavataclient; try { $airavataclient->updateProject($projectId, $updatedProject); print_success_message('Project updated! Click <a href="project_summary.php?projId=' . $projectId . '">here</a> to view the project summary.'); } catch (InvalidRequestException $ire) { print_error_message('InvalidRequestException!<br><br>' . $ire->getMessage()); } catch (ProjectNotFoundException $pnfe) { print_error_message('ProjectNotFoundException!<br><br>' . $pnfe->getMessage()); } catch (AiravataClientException $ace) { print_error_message('AiravataClientException!<br><br>' . $ace->getMessage()); } catch (AiravataSystemException $ase) { print_error_message('AiravataSystemException!<br><br>' . $ase->getMessage()); } }
print_error_message('The username you entered is already in use. Please select another.'); } else { if (strlen($username) < 3) { print_error_message('Username should be more than three characters long!'); } else { if ($password != $confirm_password) { print_error_message('The passwords that you entered do not match!'); } elseif (!isset($first_name)) { print_error_message('First name is required.'); } elseif (!isset($last_name)) { print_error_message('Last name is required.'); } elseif (!isset($email)) { print_error_message('Email address is required.'); } else { $idStore->add_user($username, $password, $first_name, $last_name, $email, $organization, $address, $country, $telephone, $mobile, $im, $url); print_success_message('New user created!'); redirect('login.php'); } } } } ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?> " method="post" role="form"> <div class="form-group required"><label class="control-label">Username</label> <div><input class="form-control" id="username" minlength="3" maxlength="30" name="username" placeholder="Username" required="required" title="" type="text"/></div>
<h3> Login <small> <small> (Not registered? <a href="create_account.php">Create account</a>)</small> </small> </h3> <?php if (form_submitted()) { $username = $_POST['username']; $password = $_POST['password']; try { if (id_matches_db($username, $password)) { store_id_in_session($username); print_success_message('Login successful! You will be redirected to your home page shortly.'); redirect('index.php'); } else { print_error_message('Invalid username or password. Please try again.'); } } catch (Exception $ex) { print_error_message('Invalid username or password. Please try again.'); } } ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?> " method="post" role="form">
$organization = $_POST['organization']; $address = $_POST['address']; $country = $_POST['country']; $telephone = $_POST['telephone']; $mobile = $_POST['mobile']; $im = $_POST['im']; $url = $_POST['url']; if (!isset($first_name)) { print_error_message('First name is required.'); } elseif (!isset($last_name)) { print_error_message('Last name is required.'); } elseif (!isset($email)) { print_error_message('Email address is required.'); } else { $idStore->update_user_profile($_SESSION['username'], $first_name, $last_name, $email, $organization, $address, $country, $telephone, $mobile, $im, $url); print_success_message('User profile updated successfully'); } } $profile = $idStore->get_user_profile($_SESSION['username']); ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?> " method="post" role="form"> <div class="form-group required"><label class="control-label">E-mail</label> <div><input class="form-control" id="email" name="email" placeholder="E-mail" required="required" title="" type="email" value="<?php echo $profile['email_address']; ?>
?> <div class="container" style="max-width: 750px;"> <h1>Create a new experiment</h1> <?php if (isset($_POST['save']) || isset($_POST['launch'])) { $expId = create_experiment(); if (isset($_POST['launch']) && $expId) { launch_experiment($expId); } else { print_success_message("<p>Experiment {$_POST['experiment-name']} created!</p>" . '<p>You will be redirected to the summary page shortly, or you can <a href="experiment_summary.php?expId=' . $expId . '">go directly</a> to experiment summary page.</p>'); redirect('experiment_summary.php?expId=' . $expId); } } //$transport->close(); ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?> " method="post" role="form" enctype="multipart/form-data"> <?php if (isset($_POST['continue'])) {
<div class="container"> <?php if (id_in_session()) { $columnClass = 'col-md-4'; echo '<h1>Welcome, ' . $_SESSION['username'] . '!</h1>'; if ($_SESSION['username'] == 'admin1') { try { open_tokens_file($tokenFilePath); } catch (Exception $e) { print_error_message($e->getMessage()); } if (isset($_GET['tokenId'])) { try { write_new_token($_GET['tokenId']); print_success_message('Received new XSEDE token ' . $tokenFile->tokenId . '! Click <a href="' . $req_url . '?gatewayName=' . $gatewayName . '&email=' . $email . '&portalUserName='******'username'] . '">here</a> to fetch a new token.'); } catch (Exception $e) { print_error_message($e->getMessage()); } } else { echo '<p><small>Community token currently set to ' . $tokenFile->tokenId . '. Click <a href="' . $req_url . '?gatewayName=' . $gatewayName . '&email=' . $email . '&portalUserName='******'username'] . '">here</a> to fetch a new token.</small></p>'; } } else { /* temporarily remove to avoid confusion during XSEDE tutorial if (isset($_SESSION['tokenId'])) { echo '<p><small>XSEDE token currently active. All experiments launched during this session will use your personal allocation.</small></p>'; } elseif(!isset($_GET['tokenId']) && !isset($_SESSION['tokenId'])) {
/** * Cancel the experiment with the given ID * @param $expId */ function cancel_experiment($expId) { global $airavataclient; try { $airavataclient->terminateExperiment($expId); print_success_message("Experiment canceled!"); } catch (InvalidRequestException $ire) { print_error_message('<p>There was a problem canceling the experiment. Please try again later or submit a bug report using the link in the Help menu.</p>' . '<p>InvalidRequestException: ' . $ire->getMessage() . '</p>'); } catch (ExperimentNotFoundException $enf) { print_error_message('<p>There was a problem canceling the experiment. Please try again later or submit a bug report using the link in the Help menu.</p>' . '<p>ExperimentNotFoundException: ' . $enf->getMessage() . '</p>'); } catch (AiravataClientException $ace) { print_error_message('<p>There was a problem canceling the experiment. Please try again later or submit a bug report using the link in the Help menu.</p>' . '<p>AiravataClientException: ' . $ace->getMessage() . '</p>'); } catch (AiravataSystemException $ase) { print_error_message('<p>There was a problem canceling the experiment. Please try again later or submit a bug report using the link in the Help menu.</p>' . '<p>AiravataSystemException: ' . $ase->getMessage() . '</p>'); } catch (TTransportException $tte) { print_error_message('<p>There was a problem canceling the experiment. Please try again later or submit a bug report using the link in the Help menu.</p>' . '<p>TTransportException: ' . $tte->getMessage() . '</p>'); } catch (Exception $e) { print_error_message('<p>There was a problem canceling the experiment. Please try again later or submit a bug report using the link in the Help menu.</p>' . '<p>Exception: ' . $e->getMessage() . '</p>'); } }