本文整理汇总了PHP中Traceback_uri函数的典型用法代码示例。如果您正苦于以下问题:PHP Traceback_uri函数的具体用法?PHP Traceback_uri怎么用?PHP Traceback_uri使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Traceback_uri函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Output
public function Output()
{
$V = "";
/* If this is a POST, then process the request. */
$groupname = GetParm('groupname', PARM_TEXT);
if (!empty($groupname)) {
try {
/* @var $userDao UserDao */
$userDao = $GLOBALS['container']->get('dao.user');
$groupId = $userDao->addGroup($groupname);
$userDao->addGroupMembership($groupId, Auth::getUserId());
$text = _("Group");
$text1 = _("added");
$this->vars['message'] = "{$text} {$groupname} {$text1}.";
} catch (Exception $e) {
$this->vars['message'] = $e->getMessage();
}
}
/* Build HTML form */
$text = _("Add a Group");
$V .= "<h4>{$text}</h4>\n";
$V .= "<form name='formy' method='POST' action=" . Traceback_uri() . "?mod=group_add>\n";
$Val = htmlentities(GetParm('groupname', PARM_TEXT), ENT_QUOTES);
$text = _("Enter the groupname:");
$V .= "{$text}\n";
$V .= "<input type='text' value='{$Val}' name='groupname' size=20>\n";
$text = _("Add");
$V .= "<input type='submit' value='{$text}'>\n";
$V .= "</form>\n";
return $V;
}
示例2: handle
/**
* @brief Allow user to change their account settings (users db table).
* If the user is an Admin, they can change settings for any user.\n
* This is called in the following circumstances:\n
* 1) User clicks on Admin > Edit User Account\n
* 2) User has chosen a user to edit from the 'userid' select list \n
* 3) User hit submit to update user data\n
*/
protected function handle(Request $request)
{
/* Is the session owner an admin? */
$user_pk = Auth::getUserId();
$SessionUserRec = $this->GetUserRec($user_pk);
$SessionIsAdmin = $this->IsSessionAdmin($SessionUserRec);
$user_pk_to_modify = intval($request->get('user_pk'));
if (!($SessionIsAdmin or empty($user_pk_to_modify) or $user_pk == $user_pk_to_modify)) {
$vars['content'] = _("Your request is not valid.");
return $this->render('include/base.html.twig', $this->mergeWithDefault($vars));
}
$vars = array('refreshUri' => Traceback_uri() . "?mod=" . self::NAME);
/* If this is a POST (the submit button was clicked), then process the request. */
$BtnText = $request->get('UpdateBtn');
if (!empty($BtnText)) {
/* Get the form data to in an associated array */
$UserRec = $this->CreateUserRec($request, "");
$rv = $this->UpdateUser($UserRec, $SessionIsAdmin);
if (empty($rv)) {
// Successful db update
$vars['message'] = "User {$UserRec['user_name']} updated.";
/* Reread the user record as update verification */
$UserRec = $this->CreateUserRec($request, $UserRec['user_pk']);
} else {
$vars['message'] = $rv;
}
} else {
$NewUserpk = intval($request->get('newuser'));
$UserRec = empty($NewUserpk) ? $this->CreateUserRec($request, $user_pk) : $this->CreateUserRec($request, $NewUserpk);
}
/* display the edit form with the requested user data */
$vars = array_merge($vars, $this->DisplayForm($UserRec, $SessionIsAdmin));
$vars['userId'] = $UserRec['user_pk'];
return $this->render('user_edit.html.twig', $this->mergeWithDefault($vars));
}
示例3: handle
/**
* @param Request $request
* @return Response
*/
protected function handle(Request $request)
{
$vars['URI'] = Traceback_uri();
$this->renderer->clearTemplateCache();
$this->renderer->clearCacheFiles();
return $this->render('upload_instructions.html.twig', $this->mergeWithDefault($vars));
}
示例4: handle
/**
* @param Request $request
* @return Response
*/
protected function handle(Request $request)
{
$userId = Auth::getUserId();
$vars = array();
/** @var UserDao $userDao */
$userDao = $this->getObject('dao.user');
$groupMap = $userDao->getDeletableAdminGroupMap($userId, $_SESSION[Auth::USER_LEVEL]);
$groupId = $request->get('grouppk');
if (!empty($groupId)) {
try {
$userDao->deleteGroup($groupId);
$vars['message'] = _("Group") . ' ' . $groupMap[$groupId] . ' ' . _("deleted") . '.';
unset($groupMap[$groupId]);
} catch (\Exception $e) {
$vars['message'] = $e->getMessage();
}
}
if (empty($groupMap)) {
$vars['content'] = _("You have no groups you can delete.");
return $this->render('include/base.html.twig', $this->mergeWithDefault($vars));
}
$vars['groupMap'] = $groupMap;
$vars['uri'] = Traceback_uri() . "?mod=group_delete";
$vars['groupMap'] = $groupMap;
return $this->render('admin_group_delete.html.twig', $this->mergeWithDefault($vars));
}
示例5: Output
/**
* \brief Generate the text for this plugin.
*/
function Output()
{
global $PG_CONN;
global $SysConf;
if ($this->State != PLUGIN_STATE_READY) {
return;
}
$user_pk = $SysConf['auth']['UserId'];
/* Get array of groups that this user is an admin of */
$GroupArray = GetGroupArray($user_pk);
$V = "";
/* If this is a POST, then process the request. */
$Group = GetParm('grouppk', PARM_TEXT);
if (!empty($Group)) {
$rc = DeleteGroup($Group);
if (empty($rc)) {
/* Need to refresh the screen */
$text = _("Group");
$text1 = _("Deleted");
$V .= displayMessage("{$text} {$GroupArray[$Group]} {$text1}.");
} else {
$V .= displayMessage($rc);
}
}
/* Build HTML form */
$text = _("Delete a Group");
$V .= "<h4>{$text}</h4>\n";
$V .= "<form name='formy' method='POST' action=" . Traceback_uri() . "?mod=group_delete>\n";
/* Get array of users */
$UserArray = Table2Array('user_pk', 'user_name', 'users');
/* Remove from $GroupArray any active users. A user must always have a group by the same name */
foreach ($GroupArray as $group_fk => $group_name) {
if (array_search($group_name, $UserArray)) {
unset($GroupArray[$group_fk]);
}
}
if (empty($GroupArray)) {
$text = _("You have no groups you can delete.");
echo "<p>{$text}<p>";
return;
}
reset($GroupArray);
if (empty($group_pk)) {
$group_pk = key($GroupArray);
}
$text = _("Select the group to delete: \n");
$V .= "{$text}";
/*** Display group select list, on change request new page with group= in url ***/
$V .= Array2SingleSelect($GroupArray, "grouppk", $group_pk, false, false);
$text = _("Delete");
$V .= "<input type='submit' value='{$text}'>\n";
$V .= "</form>\n";
if (!$this->OutputToStdout) {
return $V;
}
print "{$V}";
return;
}
示例6: handle
/**
* @param Request $request
* @return Response
*/
protected function handle(Request $request)
{
/* Get array of groups that this user is an admin of */
$groupsWhereUserIsAdmin = GetGroupArray(Auth::getUserId());
if (empty($groupsWhereUserIsAdmin)) {
$text = _("You have no permission to manage any group.");
return $this->render('include/base.html.twig', $this->mergeWithDefault(array('content' => $text)));
}
$folder_pk = intval($request->get('folder'));
$upload_pk = intval($request->get('upload'));
$perm_upload_pk = intval($request->get('permupk'));
$perm = intval($request->get('perm'));
$newgroup = intval($request->get('newgroup'));
$newperm = intval($request->get('newperm'));
$public_perm = $request->get('public', -1);
/* @var $folderDao FolderDao */
$folderDao = $this->getObject('dao.folder');
$root_folder_pk = $folderDao->getRootFolder(Auth::getUserId())->getId();
if (empty($folder_pk)) {
$folder_pk = $root_folder_pk;
}
$UploadList = FolderListUploads_perm($folder_pk, Auth::PERM_WRITE);
if (empty($upload_pk) && !empty($UploadList)) {
$upload_pk = $UploadList[0]['upload_pk'];
}
if (!empty($perm_upload_pk)) {
$this->uploadPermDao->updatePermissionId($perm_upload_pk, $perm);
} else {
if (!empty($newgroup) && !empty($newperm)) {
$this->insertPermission($newgroup, $upload_pk, $newperm, $UploadList);
$newperm = $newgroup = 0;
} else {
if ($public_perm >= 0) {
$this->uploadPermDao->setPublicPermission($upload_pk, $public_perm);
}
}
}
$vars = array('folderStructure' => $folderDao->getFolderStructure($root_folder_pk), 'groupArray' => $groupsWhereUserIsAdmin, 'uploadId' => $upload_pk, 'folderId' => $folder_pk, 'baseUri' => Traceback_uri() . '?mod=upload_permissions', 'newPerm' => $newperm, 'newGroup' => $newgroup, 'uploadList' => $UploadList, 'permNames' => $GLOBALS['PERM_NAMES']);
if (!empty($UploadList)) {
$vars['publicPerm'] = $this->uploadPermDao->getPublicPermission($upload_pk);
$permGroups = $this->uploadPermDao->getPermissionGroups($upload_pk);
$vars['permGroups'] = $permGroups;
$additableGroups = array(0 => '-- select group --');
foreach ($groupsWhereUserIsAdmin as $gId => $gName) {
if (!array_key_exists($gId, $permGroups)) {
$additableGroups[$gId] = $gName;
}
}
$vars['additableGroups'] = $additableGroups;
}
$vars['gumJson'] = json_encode($this->getGroupMembers($groupsWhereUserIsAdmin));
if (!empty($upload_pk)) {
$vars['permNamesWithReuse'] = $this->getPermNamesWithReuse($upload_pk);
}
return $this->render('upload_permissions.html.twig', $this->mergeWithDefault($vars));
}
示例7: handle
/**
* @param Request $request
* @return Response
*/
protected function handle(Request $request)
{
$show = $request->get('show');
if ($show == 'licensebrowser') {
return $this->render("getting_started_licensebrowser.html.twig");
}
$login = _("Login");
if (empty($_SESSION['User']) && plugin_find_id("auth") >= 0) {
$login = "<a href='" . Traceback_uri() . "?mod=auth'>{$login}</a>";
}
$vars = array('login' => $login, 'SiteURI' => Traceback_uri());
return $this->render('getting_started.html.twig', $this->mergeWithDefault($vars));
}
示例8: handle
/**
* @param Request $request
* @return Response
*/
protected function handle(Request $request)
{
$folderId = intval($request->get('folder'));
if (empty($folderId)) {
$folderId = FolderGetTop();
}
$uploadId = intval($request->get('upload'));
$agents = $request->get('agents') ?: '';
if (!empty($uploadId) && !empty($agents) && is_array($agents)) {
$rc = $this->agentsAdd($uploadId, $agents, $request);
if (empty($rc)) {
$status = GetRunnableJobList();
$scheduler_msg = empty($status) ? _("Is the scheduler running? ") : '';
$url = Traceback_uri() . "?mod=showjobs&upload={$uploadId}";
$text = _("Your jobs have been added to job queue.");
$linkText = _("View Jobs");
$msg = "{$scheduler_msg}" . "{$text} <a href=\"{$url}\">{$linkText}</a>";
$vars['message'] = $msg;
} else {
$text = _("Scheduling of Agent(s) failed: ");
$vars['message'] = $text . $rc;
}
}
$vars['uploadScript'] = ActiveHTTPscript("Uploads");
$vars['agentScript'] = ActiveHTTPscript("Agents");
$vars['folderId'] = $folderId;
$vars['folderListOptions'] = FolderListOption(-1, 0, 1, $folderId);
$vars['folderListUploads'] = FolderListUploads_perm($folderId, Auth::PERM_WRITE);
$vars['baseUri'] = Traceback_uri();
$vars['uploadId'] = $uploadId;
$parmAgentList = MenuHook::getAgentPluginNames("ParmAgents");
$out = '<ol>';
$parmAgentFoots = '';
foreach ($parmAgentList as $parmAgent) {
$agent = plugin_find($parmAgent);
$out .= "<br/><b>" . $agent->AgentName . ":</b><br/>";
$out .= $agent->renderContent($vars);
$parmAgentFoots .= $agent->renderFoot($vars);
}
$out .= '</ol>';
$vars['out'] = $out;
$vars['outFoot'] = '<script language="javascript"> ' . $parmAgentFoots . '</script>';
return $this->render('agent_adder.html.twig', $this->mergeWithDefault($vars));
}
示例9: handle
protected function handle(Request $request)
{
$groupId = Auth::getGroupId();
$uploadIds = $request->get('uploads') ?: array();
$uploadIds[] = intval($request->get('upload'));
$addUploads = array();
foreach ($uploadIds as $uploadId) {
if (empty($uploadId)) {
continue;
}
try {
$addUploads[$uploadId] = $this->getUpload($uploadId, $groupId);
} catch (Exception $e) {
return $this->flushContent($e->getMessage());
}
}
$folderId = $request->get('folder');
if (!empty($folderId)) {
/* @var $folderDao FolderDao */
$folderDao = $this->getObject('dao.folder');
$folderUploads = $folderDao->getFolderUploads($folderId, $groupId);
foreach ($folderUploads as $uploadProgress) {
$addUploads[$uploadProgress->getId()] = $uploadProgress;
}
}
if (empty($addUploads)) {
return $this->flushContent(_('No upload selected'));
}
$upload = array_pop($addUploads);
try {
list($jobId, $jobQueueId) = $this->getJobAndJobqueue($groupId, $upload, $addUploads);
} catch (Exception $ex) {
return $this->flushContent($ex->getMessage());
}
$vars = array('jqPk' => $jobQueueId, 'downloadLink' => Traceback_uri() . "?mod=download&report=" . $jobId, 'reportType' => $this->outputFormat);
$text = sprintf(_("Generating " . $this->outputFormat . " report for '%s'"), $upload->getFilename());
$vars['content'] = "<h2>" . $text . "</h2>";
$content = $this->renderer->loadTemplate("report.html.twig")->render($vars);
$message = '<h3 id="jobResult"></h3>';
$request->duplicate(array('injectedMessage' => $message, 'injectedFoot' => $content, 'mod' => 'showjobs'))->overrideGlobals();
$showJobsPlugin = \plugin_find('showjobs');
$showJobsPlugin->OutputOpen();
return $showJobsPlugin->getResponse();
}
示例10: Output
/**
* \brief Display the loaded menu and plugins.
*/
public function Output()
{
global $Plugins;
global $PG_CONN;
$UploadPk = GetParm("upload", PARM_INTEGER);
$Agent = GetParm("agent", PARM_STRING);
if (empty($UploadPk) || empty($Agent)) {
return new Response('missing parameter', Response::HTTP_BAD_REQUEST, array('Content-type' => 'text/plain'));
}
$sql = "SELECT upload_pk, upload_filename FROM upload WHERE upload_pk = '{$UploadPk}'";
$result = pg_query($PG_CONN, $sql);
DBCheckResult($result, $sql, __FILE__, __LINE__);
if (pg_num_rows($result) < 1) {
$errMsg = __FILE__ . ":" . __LINE__ . " " . _("Upload") . " " . $UploadPk . " " . _("not found");
return new Response($errMsg, Response::HTTP_BAD_REQUEST, array('Content-type' => 'text/plain'));
}
$UploadRow = pg_fetch_assoc($result);
$ShortName = $UploadRow['upload_filename'];
pg_free_result($result);
$user_pk = Auth::getUserId();
$group_pk = Auth::getGroupId();
$job_pk = JobAddJob($user_pk, $group_pk, $ShortName, $UploadPk);
$Dependencies = array();
$P =& $Plugins[plugin_find_id($Agent)];
$rv = $P->AgentAdd($job_pk, $UploadPk, $ErrorMsg, $Dependencies);
if ($rv <= 0) {
$text = _("Scheduling of Agent(s) failed: ");
return new Response($text . $rv . $ErrorMsg, Response::HTTP_BAD_REQUEST, array('Content-type' => 'text/plain'));
}
/** check if the scheudler is running */
$status = GetRunnableJobList();
$scheduler_msg = "";
if (empty($status)) {
$scheduler_msg .= _("Is the scheduler running? ");
}
$URL = Traceback_uri() . "?mod=showjobs&upload={$UploadPk}";
/* Need to refresh the screen */
$text = _("Your jobs have been added to job queue.");
$LinkText = _("View Jobs");
$msg = "{$scheduler_msg}" . "{$text} <a href={$URL}>{$LinkText}</a>";
$this->vars['message'] = $msg;
return new Response($msg, Response::HTTP_OK, array('Content-type' => 'text/plain'));
}
示例11: getArrayArrayData
private function getArrayArrayData($groupId, $canEdit)
{
$sql = "SELECT rf_pk,rf_shortname,rf_fullname,rf_text,rf_url,marydone FROM license_candidate WHERE group_fk=\$1";
/** @var DbManager */
$dbManager = $this->getObject('db.manager');
$dbManager->prepare($stmt = __METHOD__, $sql);
$res = $dbManager->execute($stmt, array($groupId));
$aaData = array();
while ($row = $dbManager->fetchArray($res)) {
$aData = array(htmlentities($row['rf_shortname']), htmlentities($row['rf_fullname']), '<div style="overflow-y:scroll;max-height:150px;margin:0;">' . nl2br(htmlentities($row['rf_text'])) . '</div>', htmlentities($row['rf_url']), $this->bool2checkbox($dbManager->booleanFromDb($row['marydone'])));
if ($canEdit) {
$link = Traceback_uri() . '?mod=' . Traceback_parm() . '&rf=' . $row['rf_pk'];
$edit = '<a href="' . $link . '"><img border="0" src="images/button_edit.png"></a>';
array_unshift($aData, $edit);
}
$aaData[] = $aData;
}
$dbManager->freeResult($res);
return $aaData;
}
示例12: Output
/**
* \brief This function returns the FOSSology logo and
* Folder Navigation bar
*/
function Output()
{
if ($this->State != PLUGIN_STATE_READY) {
return 0;
}
$V = "";
global $Plugins;
switch ($this->OutputType) {
case "XML":
break;
case "HTML":
/* Load the logo image */
$Uri = Traceback_uri();
$V .= "<center><a href='http://fossology.org' target='_top'><img alt='FOSSology' title='FOSSology' src='{$Uri}images/fossology-logo.gif' align=absmiddle border=0></a></center><br>\n";
$V .= FolderListScript();
$V .= "<small><center>";
$text = _("Expand");
$V .= "<a href='javascript:Expand();'>{$text}</a> |";
$text = _("Collapse");
$V .= "<a href='javascript:Collapse();'>{$text}</a> |";
$text = _("Refresh");
$V .= "<a href='" . Traceback() . "'>{$text}</a>";
$V .= "</center></small>";
$V .= "<P>\n";
/* Display the tree */
$V .= "<form>\n";
$V .= FolderListDiv(-1, 0);
$V .= "</form>\n";
break;
case "Text":
break;
default:
break;
}
if (!$this->OutputToStdout) {
return $V;
}
print "{$V}";
return;
}
示例13: LicenseList
/**
* \brief Build the input form
*
* \param $namestr - license family name
* \param $filter - marydone value requested
*
* \return The input form as a string
*/
function LicenseList($namestr, $filter)
{
global $PG_CONN;
$ob = "";
// output buffer
// look at all
if ($namestr == "All") {
$where = "";
} else {
$where = "where rf_shortname like '" . pg_escape_string($namestr) . "' ";
}
// $filter is one of these: "All", "done", "notdone"
if ($filter != "all") {
if (empty($where)) {
$where .= "where ";
} else {
$where .= " and ";
}
if ($filter == "done") {
$where .= " marydone=true";
}
if ($filter == "notdone") {
$where .= " marydone=false";
}
}
$sql = "select * from ONLY license_ref {$where} order by rf_shortname";
$result = pg_query($PG_CONN, $sql);
DBCheckResult($result, $sql, __FILE__, __LINE__);
// print simple message if we have no results
if (pg_num_rows($result) == 0) {
$text = _("No licenses matching the filter");
$text1 = _("and name pattern");
$text2 = _("were found");
$ob .= "<br>{$text} ({$filter}) {$text1} ({$namestr}) {$text2}.<br>";
pg_free_result($result);
return $ob;
}
$plural = pg_num_rows($result) == 1 ? "" : "s";
$ob .= pg_num_rows($result) . " license{$plural} found.";
//$ob .= "<table style='border: thin dotted gray'>";
$ob .= "<table rules='rows' cellpadding='3'>";
$ob .= "<tr>";
$text = _("Edit");
$ob .= "<th>{$text}</th>";
$text = _("Checked");
$ob .= "<th>{$text}</th>";
$text = _("Shortname");
$ob .= "<th>{$text}</th>";
$text = _("Fullname");
$ob .= "<th>{$text}</th>";
$text = _("Text");
$ob .= "<th>{$text}</th>";
$text = _("URL");
$ob .= "<th>{$text}</th>";
$ob .= "</tr>";
$lineno = 0;
while ($row = pg_fetch_assoc($result)) {
if ($lineno++ % 2) {
$style = "style='background-color:lavender'";
} else {
$style = "";
}
$ob .= "<tr {$style}>";
// Edit button brings up full screen edit of all license_ref fields
$ob .= "<td align=center><a href='";
$ob .= Traceback_uri();
$ob .= "?mod=" . $this->Name . "&rf_pk={$row['rf_pk']}" . "&req_marydone={$_REQUEST['req_marydone']}&req_shortname={$_REQUEST['req_shortname']}' >" . "<img border=0 src='" . Traceback_uri() . "images/button_edit.png'></a></td>";
$marydone = $row['marydone'] == 't' ? "Yes" : "No";
$text = _("{$marydone}");
$ob .= "<td align=center>{$text}</td>";
$ob .= "<td>{$row['rf_shortname']}</td>";
$ob .= "<td>{$row['rf_fullname']}</td>";
$vetext = htmlspecialchars($row['rf_text']);
$ob .= "<td><textarea readonly=readonly rows=3 cols=40>{$vetext}</textarea></td> ";
$ob .= "<td>{$row['rf_url']}</td>";
$ob .= "</tr>";
}
pg_free_result($result);
$ob .= "</table>";
return $ob;
}
示例14: Output
function Output()
{
if ($this->State != PLUGIN_STATE_READY) {
return 0;
}
$V = "";
$Page = "";
$UploadPk = GetParm('upload', PARM_INTEGER);
if (empty($UploadPk)) {
$UploadPk = -1;
} else {
$UploadPerm = GetUploadPerm($UploadPk);
if ($UploadPerm < PERM_WRITE) {
$text = _("Permission Denied");
echo "<h2>{$text}<h2>";
return;
}
}
switch ($this->OutputType) {
case "XML":
break;
case "HTML":
// micro menus
$V .= menu_to_1html(menu_find($this->Name, $MenuDepth), 0);
/* Process any actions */
if (@$_SESSION['UserLevel'] >= PLUGIN_DB_WRITE) {
$jq_pk = GetParm("jobid", PARM_INTEGER);
$Action = GetParm("action", PARM_STRING);
$UploadPk = GetParm("upload", PARM_INTEGER);
if (!empty($UploadPk)) {
$UploadPerm = GetUploadPerm($UploadPk);
if ($UploadPerm < PERM_WRITE) {
$text = _("Permission Denied");
echo "<h2>{$text}<h2>";
return;
}
}
$Page = GetParm('page', PARM_INTEGER);
if (empty($Page)) {
$Page = 0;
}
$jqtype = GetParm("jqtype", PARM_STRING);
$ThisURL = Traceback_uri() . "?mod=" . $this->Name . "&upload={$UploadPk}";
$Job = GetParm('job', PARM_INTEGER);
switch ($Action) {
case 'pause':
if (empty($jq_pk)) {
break;
}
$Command = "pause {$jq_pk}";
$rv = fo_communicate_with_scheduler($Command, $response_from_scheduler, $error_info);
if ($rv == false) {
$V .= _("Unable to pause job.") . " " . $response_from_scheduler . $error_info;
}
echo "<script type=\"text/javascript\"> window.location.replace(\"{$ThisURL}\"); </script>";
break;
case 'restart':
if (empty($jq_pk)) {
break;
}
$Command = "restart {$jq_pk}";
$rv = fo_communicate_with_scheduler($Command, $response_from_scheduler, $error_info);
if ($rv == false) {
$V .= _("Unable to restart job.") . " " . $response_from_scheduler . $error_info;
}
echo "<script type=\"text/javascript\"> window.location.replace(\"{$ThisURL}\"); </script>";
break;
case 'cancel':
if (empty($jq_pk)) {
break;
}
$Msg = "\"" . _("Killed by") . " " . @$_SESSION['User'] . "\"";
$Command = "kill {$jq_pk} {$Msg}";
$rv = fo_communicate_with_scheduler($Command, $response_from_scheduler, $error_info);
if ($rv == false) {
$V .= _("Unable to cancel job.") . $response_from_scheduler . $error_info;
}
echo "<script type=\"text/javascript\"> window.location.replace(\"{$ThisURL}\"); </script>";
break;
default:
break;
}
}
if (!empty($Job)) {
$V .= $this->ShowJobDB($Job);
} else {
if ($UploadPk) {
$upload_pks = array($UploadPk);
$Jobs = $this->Uploads2Jobs($upload_pks, $Page);
} else {
$Jobs = $this->MyJobs($this->nhours);
}
$JobsInfo = $this->GetJobInfo($Jobs, $Page);
/* Sort jobs by job_pk (so most recent comes out first) */
usort($JobsInfo, "CompareJobsInfo");
$V .= $this->Show($JobsInfo, $Page);
}
break;
case "Text":
break;
//.........这里部分代码省略.........
示例15: Output
/**
* \brief Generate the text for this plugin.
*/
public function Output()
{
$V = "";
/* If this is a POST, then process the request. */
$uploadpk = GetParm('upload', PARM_INTEGER);
if (!empty($uploadpk)) {
$rc = $this->Delete($uploadpk);
if (empty($rc)) {
/* Need to refresh the screen */
$URL = Traceback_uri() . "?mod=showjobs&upload={$uploadpk} ";
$LinkText = _("View Jobs");
$text = _("Deletion added to job queue.");
$msg = "{$text} <a href={$URL}>{$LinkText}</a>";
$V .= displayMessage($msg);
} else {
$text = _("Deletion Scheduling failed: ");
$V .= DisplayMessage($text . $rc);
}
}
/* Create the AJAX (Active HTTP) javascript for doing the reply
and showing the response. */
$V .= ActiveHTTPscript("Uploads");
$V .= "<script language='javascript'>\n";
$V .= "function Uploads_Reply()\n";
$V .= " {\n";
$V .= " if ((Uploads.readyState==4) && (Uploads.status==200))\n";
$V .= " {\n";
/* Remove all options */
//$V.= " document.formy.upload.innerHTML = Uploads.responseText;\n";
$V .= " document.getElementById('uploaddiv').innerHTML = '<BR><select name=\\'upload\\' size=\\'10\\'>' + Uploads.responseText + '</select><P />';\n";
/* Add new options */
$V .= " }\n";
$V .= " }\n";
$V .= "</script>\n";
/* Build HTML form */
$V .= "<form name='formy' method='post'>\n";
// no url = this url
$text = _("Select the uploaded file to");
$text1 = _("delete");
$V .= "{$text} <em>{$text1}</em>\n";
$V .= "<ul>\n";
$text = _("This will");
$text1 = _("delete");
$text2 = _("the upload file!");
$V .= "<li>{$text} <em>{$text1}</em> {$text2}\n";
$text = _("Be very careful with your selection since you can delete a lot of work!\n");
$V .= "<li>{$text}";
$text = _("All analysis only associated with the deleted upload file will also be deleted.\n");
$V .= "<li>{$text}";
$text = _("THERE IS NO UNDELETE. When you select something to delete, it will be removed from the database and file repository.\n");
$V .= "<li>{$text}";
$V .= "</ul>\n";
$text = _("Select the uploaded file to delete:");
$V .= "<P>{$text}<P>\n";
$V .= "<ol>\n";
$text = _("Select the folder containing the file to delete: ");
$V .= "<li>{$text}";
$V .= "<select name='folder' ";
$V .= "onLoad='Uploads_Get((\"" . Traceback_uri() . "?mod=upload_options&folder=-1' ";
$V .= "onChange='Uploads_Get(\"" . Traceback_uri() . "?mod=upload_options&folder=\" + this.value)'>\n";
$root_folder_pk = GetUserRootFolder();
$V .= FolderListOption($root_folder_pk, 0);
$V .= "</select><P />\n";
$text = _("Select the uploaded project to delete:");
$V .= "<li>{$text}";
$V .= "<div id='uploaddiv'>\n";
$V .= "<BR><select name='upload' size='10'>\n";
$List = FolderListUploads_perm($root_folder_pk, Auth::PERM_WRITE);
foreach ($List as $L) {
$V .= "<option value='" . $L['upload_pk'] . "'>";
$V .= htmlentities($L['name']);
if (!empty($L['upload_desc'])) {
$V .= " (" . htmlentities($L['upload_desc']) . ")";
}
if (!empty($L['upload_ts'])) {
$V .= " :: " . substr($L['upload_ts'], 0, 19);
}
$V .= "</option>\n";
}
$V .= "</select><P />\n";
$V .= "</div>\n";
$V .= "</ol>\n";
$text = _("Delete");
$V .= "<input type='submit' value='{$text}!'>\n";
$V .= "</form>\n";
return $V;
}