Exemple #1
0
 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;
 }
 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;
 }
Exemple #3
0
 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;
 }