public function indexAction()
 {
     $content = Bootstrap::row();
     $panel = Bootstrap::panel('My profile');
     $form = BootstrapUI::form()->horizontal(3)->add(Bootstrap::textfield('username', $this->getUser('username'), 'username')->required())->add(Bootstrap::textfield('first_name', $this->getUser('first_name'), 'first name'))->add(Bootstrap::textfield('last_name', $this->getUser('last_name'), 'last name'))->add(Bootstrap::textfield('password', null, 'password')->type('password'))->add(Bootstrap::textfield('password2', null, 'password again')->type('password'))->add(BootstrapUI::select2('timezone', 'time zone', Timezone::$timezones, $this->getUser('timezone')))->addSubmit('Update');
     $panel->content($form);
     $content->add(6, $panel, 3);
     return View::create('base')->with('title', 'My profile')->with('content', $content);
 }
 public static function getLoginForm()
 {
     $container = Bootstrap::container();
     $panel = Bootstrap::panel('Login into ' . Request::hostName())->color('blue');
     $r = Url::controller() == 'index' && Url::action() == 'index' ? '/dashboard/first' : Request::uri();
     $form = BootstrapUI::form(Url::href(''))->add(Bootstrap::hiddenfield('r', base64_encode($r)))->add(Bootstrap::textfield('username', Cookie::get('username'))->placeholder('username')->required())->add(Bootstrap::textfield('pass')->type('password')->placeholder('password')->required())->addSubmit('Login');
     $panel->content($form);
     $container->add(Bootstrap::row()->add(4, $panel, 4))->setAttribute('style', 'margin-top: 20px');
     return $container;
 }
 public function indexAction()
 {
     $calculationInProgress = Status::isCalculationInProgress();
     $elements = array();
     $user = Session::get('user');
     // Check for currently ongoing calculation
     if ($calculationInProgress) {
         $alert = Bootstrap::alert('<img src="' . Url::link('img/alert.png') . '" /> Data calculation is in progress! Reports might be slower then usual! Status: ' . Status::getCalculationStatus())->color('warning')->dismissable();
         $elements[] = $alert;
     }
     $title = Bootstrap::h(1, 'Welcome ' . ($this->getUser('first_name') === null ? $this->getUser('username') : $this->getUser('first_name')))->secondaryText('Your timezone is <a href="' . Url::href('profile') . '">' . $user['timezone'] . '</a>, ' . Timezone::date($user['timezone'], 'M dS, H:i:s'));
     $elements[] = Bootstrap::row()->add(12, $title);
     // last reports row
     $row = Bootstrap::row();
     $minutes = 15;
     $panel = Bootstrap::panel("Reports per minute in last {$minutes} minutes", new Chart\RequestsPerSecond($minutes))->color('blue');
     $row->add(4, $panel);
     $panel = Bootstrap::panel("Problematic apps in last {$minutes} minutes", new Chart\ProblematicApps($minutes))->color('blue');
     $row->add(4, $panel);
     $panel = Bootstrap::panel("Problematic brands in last {$minutes} minutes", new Chart\ProblematicBrands($minutes))->color('blue');
     $row->add(4, $panel);
     $elements[] = $row;
     // quick reports
     $row = Bootstrap::row();
     // quick links
     $listGroup = Bootstrap::listGroup();
     foreach (Menu::getReportLinks() as $url => $text) {
         $listGroup->addLink($url, $text);
     }
     $row->add(4, Bootstrap::panel('Quick links', $listGroup));
     // countries
     $panel = Bootstrap::panel("Reports from countries in last {$minutes} minutes", new Chart\ProblematicCountries($minutes))->color('blue');
     $row->add(4, $panel);
     // OS versions
     $panel = Bootstrap::panel("OS and version in last {$minutes} minutes", new Chart\ProblematicOsVersions($minutes))->color('blue');
     $row->add(4, $panel);
     $elements[] = $row;
     $dashboardDaysCacheKey = "DashboardDays-last-10-days-offset-0min";
     if (!$calculationInProgress || Cache::has($dashboardDaysCacheKey)) {
         // dahsboard last 10 days
         $row = Bootstrap::row();
         $row->add(12, Bootstrap::panel('Number of crash reports in last 10 days', new Chart\DashboardDays(10))->color('blue'));
         $elements[] = $row;
     }
     return View::create('base')->with('title', 'Dashboard')->with('content', $elements);
 }
 public function packageAction()
 {
     $content = array();
     $panel = Bootstrap::panel('Filter')->collapsible(true);
     $form = BootstrapUI::form()->horizontal()->add(Bootstrap::textfield('name', null, 'name'))->addSubmit('Filter');
     $panel->content($form);
     $content[] = Bootstrap::row()->add(12, $panel);
     return View::create('base')->with('title', 'Package reports')->with('content', $content);
 }
 /**
  * Show the page to add new user
  */
 public function addUserAction()
 {
     $title = 'Add new user';
     $content = array(Bootstrap::row()->add(8, \Bootstrap::h(1, $title), 2));
     $content[] = Bootstrap::row()->add(8, Bootstrap::panel('New user', $this->getUserForm())->color('blue'), 2);
     return View::create('base')->with('title', $title)->with('content', $content);
 }
Beispiel #6
0
Output::set_title("System Information");
Output::add_stylesheet(LINK_ABS . "faults/comment.css");
MainTemplate::set_subtitle("View updates and report faults");
$faults = Faults::get(NULL, Session::get_id());
foreach ($faults as $fault) {
    $title = "<b>Fault ID: DIGI_" . $fault->get_id() . " </b><small>Assigned to: " . $fault->get_real_assignedto($fault->get_assignedto()) . "</small><span class=\"pull-right label label-" . $fault->get_panel_class() . "\">" . $fault->get_real_status() . "</span>";
    $footer = "<a data-toggle=\"modal\" href=\"#add-comment\" class=\"btn btn-primary btn-xs new-comment\" data-dps-id=" . $fault->get_id() . ">Add Comment</a>";
    if (Comments::get_fault_comments($fault->get_id()) != 0) {
        $footer .= "<span class=\"pull-right\"><a class=\"accordion-toggle\" data-toggle=\"collapse\" href=\"#collapse-" . $fault->get_id() . "\">" . Bootstrap::glyphicon("plus") . "</a></span></div><div id=\"collapse-" . $fault->get_id() . "\" class=\"panel-collapse collapse\"><div class=\"panel-body\">";
        $comments = Comments::get_by_fault($fault->get_id());
        foreach ($comments as $comment) {
            if ($comment->get_author() == -1) {
                $footer .= "<div class=\"row\">\r\n\t\t\t\t\t\t<div class=\"col-md-6 col-md-offset-3\"><hr></div>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t<div class=\"row\">\r\n\t\t\t\t\t\t\t  \r\n\t\t\t\t\t\t\t  <div class=\"col-md-8 col-md-offset-2 system-comment\"><b style=\"color: #f0ad4e;\">System:</b> " . $comment->get_comment() . "<br><span>" . $comment->get_postdate() . "</span></div>\t\r\n\t\t\t\t</div>\r\n\t\t\t\t<div class=\"row\">\r\n\t\t\t\t\t\t<div class=\"col-md-6 col-md-offset-3\"><hr></div>\r\n\t\t\t\t\t\t</div>";
            } else {
                if ($comment->get_author() == $fault->get_author()) {
                    $footer .= "\r\n\t\t    \t<div class=\"panel panel-default\">\r\n\t\t\t\t\t<div class=\"panel-body\">\r\n\t\t\t\t\t\t" . $comment->get_comment() . "\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div class=\"panel-footer\"><span class=\"glyphicon glyphicon-time fault-time\" aria-hidden=\"true\"></span>" . $comment->get_postdate() . "<span class=\"glyphicon glyphicon-user fault-user\" aria-hidden=\"true\"></span>" . $comment->get_real_author($comment->get_author()) . "<span class=\"label label-success\">Customer</span></div>\r\n\t\t\t\t</div>\r\n\t\t\t\t";
                } else {
                    $footer .= "\t\t    \t<div class=\"panel panel-default\">\r\n\t\t\t\t\t<div class=\"panel-body\">\r\n\t\t\t\t\t\t" . $comment->get_comment() . "\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div class=\"panel-footer\"><span class=\"glyphicon glyphicon-time fault-time\" aria-hidden=\"true\"></span>" . $comment->get_postdate() . "<span class=\"glyphicon glyphicon-user fault-user\" aria-hidden=\"true\"></span>" . $comment->get_real_author($comment->get_author()) . "<span class=\"label label-danger\">Developer</span></div>\r\n\t\t\t\t</div>";
                }
            }
        }
        $footer .= "</div>";
    }
    $body = "<p><i>Submitted by: <b>" . $fault->get_real_author($fault->get_author()) . "</b> on: <b>" . $fault->get_postdate() . "</b></i><hr></p>\r\n\t<p>" . $fault->get_content() . "</p>";
    echo Bootstrap::panel($fault->get_panel_class(), $body, $title, $footer);
}
$title = "<span id=\"comment-status-title\">Add a comment to the fault DIGI_</span>";
$body = "<form role=\"form\">\r\n  <div class=\"form-group\">\r\n  \t<input type=\"hidden\" class=\"fault-comment-id\">\r\n    <textarea class=\"form-control fault-comment-value\" rows=\"3\"></textarea>\r\n  </div>\r\n  <div class=\"form-group\">\r\n  <button type=\"submit\" class=\"btn btn-primary confirm-fault-comment\">Add Comment</button>\r\n  <a href=\"#\" data-dismiss=\"modal\" class=\"btn btn-default\">Cancel</a>\r\n  </div>\r\n</form>";
echo Bootstrap::modal("add-comment", $body, $title);
echo "<script>\r\n\t\$('.new-comment').click(function() {\r\n\t\t\$('#comment-status-title').html('Add a comment to the fault DIGI_');\r\n\t\t\$('#comment-status-title').append(\$(this).attr('data-dps-id'));\r\n\t\t\$('.fault-comment-id').val(\$(this).attr('data-dps-id'));\r\n\t});\r\n\t\$('.confirm-fault-comment').click(function() {\r\n\t\t\$.ajax({\r\n\t\t\turl: '" . LINK_ABS . "ajax/add-update-comment.php',\r\n\t\t\tdata: 'faultid='+\$('.fault-comment-id').val()+'&comment='+\$('.fault-comment-value').val(),\r\n\t\t\ttype: 'POST',\r\n\t\t\terror: function(xhr,text,error) {\r\n\t\t\t\tvalue = \$.parseJSON(xhr.responseText);\r\n\t\t\t\talert(value.error);\r\n\t\t\t},\r\n\t\t\tsuccess: function(data,text,xhr) {\r\n\t\t\t\twindow.location.reload(true); \r\n\t\t\t}\r\n\t\t});\r\n\t});\r\n</script>";
 public function viewAction()
 {
     $id = Url::getVar(1);
     // todo: ubaciti ovo u cache i odatle cupat van
     $cacheKey = "report-{$id}";
     $crash = CrashArchive::fetchOne($id);
     if ($crash === false) {
         Application::throwError(404, 'Can not find crash report ' . $id);
     }
     $title = "Crash Report #{$id}";
     $content = array();
     $panel = Bootstrap::panel($title)->color('blue')->addHeaderElement(Bootstrap::button('Back')->setAttribute('onclick', 'window.history.back()')->color('red')->size('xs'));
     $table = Bootstrap::table();
     $table->column('id', '')->column('value', '');
     // time
     $table->row(array('id' => 'time', 'value' => Misc::userDate('Y-m-d H:i:s', $crash->created_at) . ' (' . $this->user['timezone'] . ')'));
     // package
     $e = $crash->getPackage();
     $v = $crash->getPackageVersion();
     $table->row(array('id' => 'package and version', 'value' => implode(' ', array($e !== null ? "{$this->getSearchLink('package_id', $e->id, $e->name)} {$this->getLabel($e->total)}" : 'unknown', $v !== null ? "{$this->getSearchLink('package_version_id', $v->id, $v->value)} {$this->getLabel($v->total)}" : 'unknown'))));
     // device
     $value = '';
     $e = $crash->getBrand();
     if ($e === null) {
         $value .= 'unknown brand<br/>';
     } else {
         $value .= "{$this->getSearchLink('brand_id', $e->id, $e->name)} {$this->getLabel($e->total)}<br/>";
     }
     $e = $crash->getPhoneModel();
     if ($e === null) {
         $value .= 'unknown phone model<br/>';
     } else {
         $value .= "{$this->getSearchLink('model_id', $e->id, $e->name)} {$this->getLabel($e->total)}<br/>";
     }
     $table->row(array('id' => 'device', 'value' => substr($value, 0, -5)));
     // product
     $e = $crash->getProduct();
     if ($e !== null) {
         $table->row(array('id' => 'product name', 'value' => "{$this->getSearchLink('product_id', $e->id, $e->name)} {$this->getLabel($e->total)}"));
     }
     // os
     $e = $crash->getOsVersion();
     $table->row(array('id' => 'OS', 'value' => $e === null ? 'unknown' : "{$this->getSearchLink('os_version_id', $e->id, "{$e->os} {$e->name}")} {$this->getLabel($e->total)}"));
     // user comment
     if ($crash->user_comment !== null && trim($crash->user_comment) != '') {
         $table->row(array('id' => 'user comment', 'value' => $crash->user_comment));
     }
     // user email
     if ($crash->user_email !== null && trim($crash->user_email) != '') {
         $table->row(array('id' => 'user email', 'value' => $crash->user_email));
     }
     // app lifetime
     if ($crash->user_app_start_date !== null && $crash->user_crash_date !== null) {
         $table->row(array('id' => 'app lifetime', 'value' => "{$crash->user_app_start_date}<br/>{$crash->user_crash_date} (duration: {$this->duration($crash->user_app_start_date, $crash->user_crash_date)})"));
     }
     // memory usage
     $table->row(array('id' => 'available / total memory size', 'value' => Convert::bytesToString($crash->available_mem_size) . ' / ' . Convert::bytesToString($crash->total_mem_size)));
     // country
     if ($crash->country_id !== null) {
         $country = Country::fetchOne($crash->country_id);
         $table->row(array('id' => 'country', 'value' => "<img src=\"" . Url::link("img/flag/{$country->tld}.png") . "\" /> <a href=\"" . Url::href('reports', 'search', array('country_id' => $crash->country_id)) . "\">{$country->country} (" . strtoupper($country->tld) . ")</a> " . Bootstrap::label($country->total)->color('red')));
     }
     // provider
     if ($crash->provider_id !== null) {
         $e = Provider::fetchOne($crash->provider_id);
         $table->row(array('id' => 'internet provider', 'value' => "{$this->getSearchLink('provider_id', $e->id, $e->name)} {$this->getLabel($e->total)}"));
     }
     $metas = $crash->getMetas();
     $toTabs = array();
     foreach ($metas as $key => $value) {
         if ($key != 'stack_trace') {
             if (strpos(trim($value), "\n") === false) {
                 $table->row(array('id' => str_replace('_', ' ', $key), 'value' => trim($value) == '' ? '<em>empty</em>' : $value));
             } else {
                 $toTabs[] = $key;
             }
         }
     }
     $toTabsUnknown = array();
     $unknownMetas = $crash->getUnknownMetas();
     foreach ($unknownMetas as $key => $value) {
         if (strpos(trim($value), "\n") === false) {
             $table->row(array('id' => str_replace('_', ' ', $key), 'value' => (trim($value) == '' ? '<em>empty</em>' : $value) . ' ' . Bootstrap::label('unknown meta')->color('lightblue')));
         } else {
             $toTabsUnknown[] = $key;
         }
     }
     if ($crash->stack_trace_id !== null) {
         $table->row(array('id' => 'find reports with this stack trace', 'value' => Bootstrap::anchor(\Bootstrap::icon('search'), Url::href('reports', 'search', array('stack_trace_id' => $crash->stack_trace_id)))->asButton()->color('red')->size('xs')));
     }
     $panel->content($table);
     $content[] = Bootstrap::row()->add(12, $panel);
     $tabs = Bootstrap::nav();
     if (isset($metas['stack_trace'])) {
         $tabs->addLink('stack trace', "<pre class=\"text-danger\">{$metas['stack_trace']}</pre>");
     } else {
         if ($crash->stack_trace_id !== null) {
             $stackTrace = Stack\Trace::fetchOne($crash->stack_trace_id);
             $tabs->addLink('stack trace summary', "<pre class=\"text-danger\">{$stackTrace->summary}</pre>");
         }
     }
     if (sizeof($toTabs) > 0) {
         foreach ($toTabs as $key) {
             $tabs->addLink(str_replace('_', ' ', $key), "<pre>{$metas[$key]}</pre>");
         }
     }
     if (sizeof($toTabsUnknown) > 0) {
         foreach ($toTabsUnknown as $key) {
             $tabs->addLink(str_replace('_', ' ', $key) . ' ' . Bootstrap::label('?')->color('lightblue'), "<pre>{$unknownMetas[$key]}</pre>");
         }
     }
     if ($tabs->count() > 0) {
         $content[] = Bootstrap::row()->add(12, $tabs);
     }
     if ($crash->stack_trace_id !== null) {
         $content[] = Bootstrap::row()->add(12, Bootstrap::panel('This error count per day', new Chart\StackTracesPerDay($crash->stack_trace_id, 30))->color('red'));
     }
     return View::create('base')->with('title', $title)->with('content', $content);
 }