コード例 #1
0
ファイル: ClientPage.php プロジェクト: progden/testswarm
 protected function initContent()
 {
     $this->setTitle('Client');
     $error = $this->getAction()->getError();
     $data = $this->getAction()->getData();
     $html = '';
     if ($error) {
         $html .= html_tag('div', array('class' => 'alert alert-error'), $error['info']);
     }
     if (!isset($data['info'])) {
         return $html;
     }
     $info = $data['info'];
     $displayInfo = $info['uaData']['displayInfo'];
     $this->setSubTitle('#' . $info['id']);
     $html .= '<h3>Information</h3>' . '<div class="row">' . '<div class="span2">' . BrowserInfo::buildIconHtml($displayInfo) . '</div>' . '<div class="span10">' . '<table class="table table-striped">' . '<tbody>' . '<tr><th>Name</th><td>' . html_tag('a', array('href' => $info['viewUrl']), $info['name']) . '</td></tr>' . '<tr><th>UA ID</th><td>' . '<code>' . htmlspecialchars($info['uaID']) . '</code>' . '<tr><th>User-Agent</th><td>' . '<tt>' . htmlspecialchars($info['uaRaw']) . '</tt>' . '</td></tr>' . '<tr><th>Session age</th><td>' . number_format(intval($info['sessionAge'])) . 's' . '</td></tr>' . '<tr><th>Connected</th><td>' . self::getPrettyDateHtml($info, 'connected') . '</td></tr>' . '<tr><th>Last ping</th><td>' . self::getPrettyDateHtml($info, 'pinged') . '</td></tr>' . '</tbody></table>' . '</div>' . '</div>';
     $html .= '<h3>Log</h3>';
     if (!$data['results']) {
         $html .= '<div class="alert alert-info">Client has no run log.</div>';
     } else {
         $html .= '<table class="table table-striped">' . '<thead><tr><th>Result</th><th>Project</th></th><th>Run</th><th>Status</th>' . '<tbody>';
         foreach ($data['results'] as $run) {
             $html .= '<tr>' . '<td>' . html_tag('a', array('href' => $run['viewUrl']), '#' . $run['id']) . '</td>' . '<td>' . ($run['project'] ? html_tag('a', array('href' => $run['project']['viewUrl']), $run['project']['display_title']) : '-') . '</td>' . '<td>' . ($run['job'] && $run['run'] ? html_tag('a', array('href' => $run['job']['viewUrl']), $run['job']['nameText'] . ' / ' . $run['run']['name']) : '<em>Job has been deleted</em>') . '</td>' . JobPage::getJobStatusHtmlCell($run['status']) . '</tr>';
         }
         $html .= '</tbody></table>';
     }
     return $html;
 }
コード例 #2
0
ファイル: ResultPage.php プロジェクト: namminammi/testswarm
 protected function initContent()
 {
     $request = $this->getContext()->getRequest();
     $resultsID = $request->getInt('item');
     $this->setTitle('Run result');
     $this->setRobots('noindex,nofollow');
     $this->bodyScripts[] = swarmpath('js/result.js');
     $error = $this->getAction()->getError();
     $data = $this->getAction()->getData();
     $html = '';
     if ($error) {
         $html .= html_tag('div', array('class' => 'alert alert-error'), $error['info']);
         return $html;
     }
     $this->setSubTitle('#' . $data['info']['id']);
     if ($data['job']) {
         $html = '<p><em>' . html_tag_open('a', array('href' => $data['job']['url'], 'title' => 'Back to Job #' . $data['job']['id'])) . '&laquo Back to Job #' . $data['job']['id'] . '</a>' . '</em></p>';
     } else {
         $html = '<p><em>Run #' . $data['info']['runID'] . ' has been deleted. Job info unavailable.</em></p>';
     }
     if ($data['otherRuns']) {
         $html .= '<table class="table table-bordered swarm-results"><thead>' . JobPage::getUaHtmlHeader($data['otherRuns']['userAgents']) . '</thead><tbody>' . JobPage::getUaRunsHtmlRows($data['otherRuns']['runs'], $data['otherRuns']['userAgents']) . '</tbody></table>';
     }
     $html .= '<h3>Information</h3>' . '<table class="table table-striped">' . '<tbody>' . '<tr><th>Run</th><td>' . ($data['job'] ? html_tag('a', array('href' => $data['job']['url']), 'Job #' . $data['job']['id']) . ' / ' : '') . 'Run #' . htmlspecialchars($data['info']['runID']) . '</td></tr>' . '<tr><th>Client</th><td>' . html_tag('a', array('href' => $data['client']['viewUrl']), 'Client #' . $data['info']['clientID']) . ' / ' . htmlspecialchars($data['client']['name']) . '</td></tr>' . '<tr><th>UA ID</th><td>' . '<code>' . htmlspecialchars($data['client']['uaID']) . '</code>' . '<tr><th>User-Agent</th><td>' . '<tt>' . htmlspecialchars($data['client']['uaRaw']) . '</tt>' . '</td></tr>' . '<tr><th>Run time</th><td>' . (isset($data['info']['runTime']) ? number_format(intval($data['info']['runTime'])) . 's' : '?') . '</td></tr>' . '<tr><th>Status</th><td>' . htmlspecialchars($data['info']['status']) . '</td></tr>' . '<tr><th>Started</th><td>' . self::getPrettyDateHtml($data['info'], 'started') . '</td></tr>' . (isset($data['info']['savedLocalFormatted']) ? '<tr><th>Saved</th><td>' . self::getPrettyDateHtml($data['info'], 'saved') . '</td></tr>' : '') . '</tbody></table>';
     $html .= '<h3>Results</h3>' . '<p class="swarm-toollinks">' . html_tag('a', array('href' => swarmpath('index.php') . '?' . http_build_query(array('action' => 'result', 'item' => $data['info']['id'], 'raw' => '')), 'target' => '_blank', 'class' => 'swarm-popuplink'), 'Open in new window') . '</p>' . html_tag('iframe', array('src' => swarmpath('index.php') . '?' . http_build_query(array('action' => 'result', 'item' => $data['info']['id'], 'raw' => '')), 'width' => '100%', 'class' => 'swarm-result-frame'));
     return $html;
 }
コード例 #3
0
ファイル: ResultPage.php プロジェクト: rhodblinkbox/testswarm
 protected function initContent()
 {
     $request = $this->getContext()->getRequest();
     $resultsID = $request->getInt('item');
     $this->setTitle('Run result');
     $this->setRobots('noindex,nofollow');
     $this->bodyScripts[] = swarmpath('js/result.js');
     $error = $this->getAction()->getError();
     $data = $this->getAction()->getData();
     $html = '';
     if ($error) {
         $html .= html_tag('div', array('class' => 'alert alert-error'), $error['info']);
         return $html;
     }
     $this->setSubTitle('#' . $data['resultInfo']['id']);
     if ($data['job']) {
         $html = '<p><em>' . html_tag_open('a', array('href' => $data['job']['url'], 'title' => 'Back to Job #' . $data['job']['id'])) . '&laquo Back to Job #' . $data['job']['id'] . '</a>' . '</em></p>';
     } else {
         $html = '<p><em>Run #' . $data['resultInfo']['runID'] . ' has been deleted. Job info unavailable.</em></p>';
     }
     if ($data['otherRuns']) {
         $html .= '<table class="table table-bordered swarm-results"><thead>' . JobPage::getUaHtmlHeader($data['otherRuns']['userAgents']) . '</thead><tbody>' . JobPage::getUaRunsHtmlRows($data['otherRuns']['runs'], $data['otherRuns']['userAgents']) . '</tbody></table>';
     }
     $html .= '<h3>Information</h3>' . '<table class="table table-striped">' . '<colgroup><col class="span2"/><col/></colgroup>' . '<tbody>' . '<tr><th>Run</th><td>' . ($data['job'] ? html_tag('a', array('href' => $data['job']['url']), 'Job #' . $data['job']['id']) . ' / ' : '') . 'Run #' . htmlspecialchars($data['resultInfo']['runID']) . '</td></tr>' . '<tr><th>Client</th><td>' . html_tag('a', array('href' => $data['client']['userUrl']), $data['client']['userName']) . ' / Client #' . htmlspecialchars($data['resultInfo']['clientID']) . '</td></tr>' . ($data['client']['deviceName'] !== null ? '<tr><th>Device name</th><td>' . $data['client']['deviceName'] . ' / ' . html_tag('a', array('target' => '_blank', 'href' => 'http://wiki.blinkbox.local/wiki/index.php?profile=default&search=' . htmlspecialchars($data['client']['deviceName'])), 'search for ' . $data['client']['deviceName'] . ' on blinkbox wiki') . '</td></tr>' : '') . '<tr><th>User-Agent</th><td>' . '<code>' . htmlspecialchars($data['client']['uaID']) . '</code><br/>' . 'Raw: <br><code>' . htmlspecialchars($data['client']['userAgent']) . '</code><br/>' . html_tag('a', array('target' => '_blank', 'href' => 'http://wiki.blinkbox.local/wiki/index.php?profile=default&search=' . htmlspecialchars($data['client']['userAgent'])), 'search for this user agent on blinkbox wiki') . '</td></tr>' . '<tr><th>Run time</th><td>' . (isset($data['resultInfo']['runTime']) ? number_format(intval($data['resultInfo']['runTime'])) . 's' : '?') . '</td></tr>' . '<tr><th>Status</th><td>' . htmlspecialchars($data['resultInfo']['status']) . '</td></tr>' . '<tr><th>Total</th><td>' . htmlspecialchars($data['resultInfo']['total']) . '</td></tr>' . '<tr><th>Fail</th><td>' . htmlspecialchars($data['resultInfo']['fail']) . '</td></tr>' . '<tr><th>Error</th><td>' . htmlspecialchars($data['resultInfo']['error']) . '</td></tr>' . '<tr><th>Started</th><td>' . self::getPrettyDateHtml($data['resultInfo'], 'started') . '</td></tr>' . (isset($data['resultInfo']['savedLocalFormatted']) ? '<tr><th>Saved</th><td>' . self::getPrettyDateHtml($data['resultInfo'], 'saved') . '</td></tr>' : '') . '<tr><th>Results size</th><td>' . 'compressed: ' . self::formatBytes($data['resultInfo']['reportHtmlCompressedSize']) . ' / uncompressed: ' . self::formatBytes($data['resultInfo']['reportHtmlSize']) . ' / ratio: ' . $data['resultInfo']['reportHtmlCompressionRatio'] . '%' . '</td></tr>' . '</tbody></table>';
     $html .= '<h3>Results</h3>' . '<p class="swarm-toollinks">' . html_tag('a', array('href' => swarmpath('index.php') . '?' . http_build_query(array('action' => 'result', 'item' => $data['resultInfo']['id'], 'raw' => '')), 'target' => '_blank', 'class' => 'swarm-popuplink'), 'Open in new window') . '</p>' . html_tag('iframe', array('src' => swarmpath('index.php') . '?' . http_build_query(array('action' => 'result', 'item' => $data['resultInfo']['id'], 'raw' => '')), 'width' => '100%', 'class' => 'swarm-result-frame'));
     return $html;
 }
コード例 #4
0
ファイル: JobHolder.php プロジェクト: Thingee/openstack-org
 function JobDetailsPage()
 {
     $job_id = intval($this->request->param('JOB_ID'));
     $job = JobPage::get()->byID($job_id);
     if ($job) {
         return $this->renderWith(array('JobDetail', 'Page'), $job);
     }
     return $this->httpError(404, 'Sorry that Job could not be found!.');
 }
コード例 #5
0
ファイル: ProjectsPage.php プロジェクト: TestArmada/admiral
 protected function initContent()
 {
     $this->setTitle('Projects');
     $projects = $this->getAction()->getData();
     $html = '<blockquote><p>Below is an overview of all registered projects,' . ' sorted alphabetically by name.</p></blockquote>' . '<table class="table table-striped">' . '<thead><tr>' . '<th>Project name</th>' . '<th class="span4">Latest job</th>' . '</tr></thead>' . '<tbody>';
     foreach ($projects as $project) {
         $job = $project['job'];
         $html .= '<tr>' . '<td><a href="' . htmlspecialchars(swarmpath("project/{$project['id']}")) . '">' . htmlspecialchars($project['displayTitle']) . '</a></td>';
         if (!$job) {
             $html .= '<td>N/A</td>';
         } else {
             $html .= '<td class="swarm-status-cell swarm-jobstatus-cell"><div class="swarm-status swarm-status-' . $job['summary'] . '">' . JobPage::getStatusIconHtml($job['summary']) . html_tag('a', array('href' => $job['info']['viewUrl'], 'title' => $job['info']['nameText']), 'Job #' . $job['info']['id']) . '</div></td>';
         }
         $html .= '</tr>';
     }
     $html .= '</tbody></table>';
     return $html;
 }
コード例 #6
0
ファイル: ProjectPage.php プロジェクト: TestArmada/admiral
 protected function initContent()
 {
     $this->setTitle("Project");
     $html = "";
     $error = $this->getAction()->getError();
     $data = $this->getAction()->getData();
     if ($error) {
         $html .= html_tag("div", array("class" => "alert alert-error"), $error["info"]);
         return $html;
     }
     $this->setSubTitle($data['info']['display_title']);
     $info = array();
     if ($data['info']['site_url']) {
         $info[] = 'Homepage: ' . html_tag('a', array('href' => $data['info']['site_url']), parse_url($data['info']['site_url'], PHP_URL_HOST) ?: $data['info']['site_url']);
     }
     $info[] = 'Created: ' . self::getPrettyDateHtml($data['info'], 'created');
     $info[] = 'Last updated: ' . self::getPrettyDateHtml($data['info'], 'updated');
     $html .= '<div class="well well-small">' . implode(' <span class="muted">|</span> ', $info) . '</div>';
     if (!count($data['jobs'])) {
         $html .= '<div class="alert alert-info">No jobs found.</div>';
     } else {
         $html .= '<h2>Jobs</h2><ul class="pager">';
         if ($data['pagination']['prev']) {
             $html .= '<li class="previous">' . html_tag_open('a', array('href' => $data['pagination']['prev']['viewUrl'])) . '&larr;&nbsp;Previous</a></li>';
         } else {
             $html .= '<li class="previous disabled" title="No previous page"><a href="#">&larr;&nbsp;Previous</a></span>';
         }
         if ($data['pagination']['next']) {
             $html .= '<li class="next">' . html_tag_open('a', array('href' => $data['pagination']['next']['viewUrl'])) . 'Next&nbsp;&rarr;</a></li>';
         } else {
             $html .= '<li class="next disabled" title="No next page"><a href="#">Next&nbsp;&rarr;</a></span>';
         }
         $html .= '</ul>';
         $html .= '<table class="table table-bordered swarm-results">';
         $html .= '<thead>';
         $html .= JobPage::getUaHtmlHeader($data['userAgents']);
         $html .= '</thead><tbody>';
         foreach ($data['jobs'] as $job) {
             $html .= JobPage::getJobHtmlRow($job, $data['userAgents']);
         }
         $html .= '</tbody></table>';
     }
     return $html;
 }
コード例 #7
0
ファイル: JobManager.php プロジェクト: Thingee/openstack-org
 /**
  * @param array $data
  * @return IJob
  */
 public function addJob(array $data)
 {
     $this_var = $this;
     $validator_factory = $this->validator_factory;
     $repository = $this->jobs_repository;
     $factory = $this->factory;
     return $this->tx_manager->transaction(function () use($this_var, $factory, $validator_factory, $data, $repository) {
         $validator = $validator_factory->buildValidatorForJob($data);
         if ($validator->fails()) {
             throw new EntityValidationException($validator->messages());
         }
         $job = new JobPage();
         $job->registerMainInfo($factory->buildJobMainInfo($data));
         $job->registerPostedDate($data['posted_date']);
         $locations = $factory->buildJobLocations($data);
         $job->clearLocations();
         foreach ($locations as $location) {
             $job->addLocation($location);
         }
         $job_id = $repository->add($job);
         return $job_id;
     });
 }
コード例 #8
0
ファイル: job.php プロジェクト: pamalite/yel
    if (!empty($url_elements[count($url_elements) - 1])) {
        $job_id = $url_elements[count($url_elements) - 1];
    } else {
        $job_id = $url_elements[count($url_elements) - 2];
    }
    $pos = stripos($job_id, '?');
    if ($pos !== false) {
        $job_id = substr($job_id, 0, $pos);
    }
}
// 2. Generate page
$search = '';
if (isset($_SESSION['yel']['member']) && !empty($_SESSION['yel']['member']['id']) && !empty($_SESSION['yel']['member']['sid']) && !empty($_SESSION['yel']['member']['hash'])) {
    $job_page = new JobPage($_SESSION['yel']['member'], $job_id, $criteria);
} else {
    $job_page = new JobPage(NULL, $job_id, $criteria);
}
if (isset($_SESSION['yel']['employee']) && !empty($_SESSION['yel']['employee']['uid']) || !empty($_SESSION['yel']['employee']['id']) || !empty($_SESSION['yel']['employee']['sid']) || !empty($_SESSION['yel']['employee']['hash'])) {
    $job_page->is_employee_viewing();
}
$criteria = array('columns' => 'jobs.title, jobs.alternate_employer, employers.name', 'joins' => 'employers ON employers.id = jobs.employer', 'match' => 'jobs.id = ' . $job_id, 'limit' => '1');
$job = new Job();
$result = $job->find($criteria);
$job_title = !is_null($result[0]['title']) ? $result[0]['title'] : 'Unknown Job';
$employer = !is_null($result[0]['name']) ? $result[0]['name'] : 'Unknown Employer';
if (!is_null($result[0]['alternate_employer'])) {
    $employer = $result[0]['alternate_employer'];
}
$show_popup = '';
$buffer_id = '';
$action_response = -1;
コード例 #9
0
ファイル: ClientsPage.php プロジェクト: namminammi/testswarm
 /**
  * @param Array $data Details data from ClientsAction
  * @return string: HTML
  */
 protected function showDetails($data)
 {
     $html = '<div class="row">';
     foreach ($data['clients'] as $client) {
         $displayInfo = $client['uaData']['displayInfo'];
         $html .= '<div class="span4 swarm-client"><div class="well">' . '<div class="swarm-client-icon">' . BrowserInfo::buildIconHtml($displayInfo, array('wrap' => false)) . '</div>' . '<div class="swarm-client-info">' . '<p class="swarm-client-title">' . htmlspecialchars($displayInfo['title']) . '</p>' . '<table class="table table-condensed">' . '<tbody>' . '<tr><th>Last ping</th><td>' . self::getPrettyDateHtml($client, 'pinged') . '</td></tr>' . '<tr><th>Run</th>' . (!$client['lastResult'] ? '<td><span class="muted">Waiting for runs...</span></td>' : '<td class="swarm-status-' . $client['lastResult']['status'] . '">' . html_tag_open('a', array('href' => $client['lastResult']['viewUrl'])) . htmlspecialchars("#{$client['lastResult']['id']}") . ' ' . JobPage::getStatusIconHtml($client['lastResult']['status']) . '</a></td>') . '</tr>' . '<tr><th>Connected</th><td>' . self::getPrettyDateHtml($client, 'connected') . '</td></tr>' . '</tbody>' . '</table>' . '</div>' . '<div class="clearfix"><a href="' . htmlspecialchars($client['viewUrl']) . '" class="pull-right">Details &raquo;</a></div>' . '</div></div>';
     }
     return $html . '</div>';
 }
コード例 #10
0
ファイル: JobFactory.php プロジェクト: Thingee/openstack-org
 /**
  * @param IJobRegistrationRequest $request
  * @return IJob
  */
 public function buildJob(IJobRegistrationRequest $request)
 {
     $job = new JobPage();
     $job->JobPostedDate = $request->PostDate;
     $job->JobCompany = $request->CompanyName;
     $job->JobCompany = $request->CompanyName;
     $job->ExpirationDate = $request->ExpirationDate;
     $job->Content = $request->Description;
     $job->Title = $request->Title;
     $job->JobMoreInfoLink = $request->Url;
     $job->JobInstructions2Apply = $request->Instructions2Apply;
     $job->LocationType = $request->LocationType;
     foreach ($request->getLocations() as $location) {
         $job->addLocation($location);
     }
     return $job;
 }