public function testFileSizeToStr() { $this->assertTrue(MiscHelpers::fileSizeToStr(512) == '512 byte(s)'); $this->assertTrue(MiscHelpers::fileSizeToStr(1024) == '1 KB'); $this->assertTrue(MiscHelpers::fileSizeToStr(2 * 1024 * 1024) == '2 MB'); $this->assertTrue(MiscHelpers::fileSizeToStr(5 * 1024 * 1024 * 1024) == '5 GB'); }
<div class="span-18 last"> <div class="box"> <ul class="daemon-status-list"> <li class="daemon-status-list-item loud"><div class="list-item-label">File Name:</div><?php echo CHtml::encode($model->srcfilename); ?> </li> <li class="daemon-status-list-item loud"><div class="list-item-label">File Size:</div><?php echo CHtml::encode(MiscHelpers::fileSizeToStr($model->filesize)); ?> </li> <li class="daemon-status-list-item loud"><div class="list-item-label">MD5 Hash:</div><?php echo CHtml::encode($model->md5); ?> </li> <li class="daemon-status-list-item"><?php echo CHtml::link('Download Entire ZIP Archive', array('crashReport/download', 'id' => $model->id)); ?> </li> </ul> </div> </div> <div class="span-18 last"> <div class="quiet">You can also download individual files contained in this crash report archive:</div> <!-- Grid view --> <?php $this->widget('zii.widgets.grid.CGridView', array('dataProvider' => $model->searchFileItems(), 'selectableRows' => null, 'columns' => array(array('name' => 'filename', 'type' => 'raw', 'value' => 'CHtml::link($data->filename, array(\'crashReport/extractFile\', \'name\'=>$data->filename, \'rpt\'=>$data->crashreport_id))'), 'description')));
?> <div class="span-27 last detail-group-caption">Sender Info:</div> <?php $this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array(array('name' => 'geo_location', 'type' => 'text', 'value' => CrashReport::geoIdToCountryName($model->geo_location)), 'ipaddress', 'emailfrom', 'description'))); ?> <div class="span-27 last detail-group-caption">Exception Info:</div> <?php $text = $model->exception_thread_id != 0 ? '0x' . dechex($model->exception_thread_id) : null; $exceptionThread = $model->getExceptionThread(); if ($exceptionThread) { $link = CHtml::link(CHtml::encode('View Stack Trace'), array('crashReport/view', 'id' => $model->id, 'tab' => 'Threads', 'thread' => $exceptionThread->id)); $text .= ' ' . $link; } $this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('exception_type', array('name' => 'exceptionaddress', 'type' => 'text', 'value' => $model->exceptionaddress != 0 ? '0x' . base_convert($model->exceptionaddress, 10, 16) : null), array('name' => 'exception_code', 'type' => 'text', 'value' => $model->exception_code != 0 ? '0x' . base_convert($model->exception_code, 10, 16) : null), 'exe_image', 'exceptionmodule', array('name' => 'exceptionmodulebase', 'type' => 'text', 'value' => $model->exceptionmodulebase != 0 ? '0x' . base_convert($model->exceptionmodulebase, 10, 16) : null), array('name' => 'exception_thread_id', 'type' => 'raw', 'value' => $text)))); ?> <div class="span-27 last detail-group-caption">Machine Info:</div> <?php $this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('os_name_reg', 'os_ver_mdmp', array('name' => 'os_is_64bit', 'type' => 'text', 'value' => $model->getOsBittnessStr()), 'product_type', 'cpu_architecture', 'cpu_count'))); ?> <div class="span-27 last detail-group-caption">Resource Usage Info:</div> <?php $this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array(array('name' => 'memory_usage_kbytes', 'type' => 'raw', 'value' => $model->memory_usage_kbytes != null ? MiscHelpers::fileSizeToStr($model->memory_usage_kbytes * 1024) : null), 'open_handle_count', 'gui_resource_count')));
if ($model->statuschange) { echo '<div class="bug-change-status"><ul>'; if (isset($model->statuschange->status)) { echo '<li>Status: ' . Lookup::item('BugStatus', $model->statuschange->status); } if (isset($model->statuschange->merged_into)) { echo '<li>Merged into bug: ' . CHtml::link($model->statuschange->merged_into, array('bug/view', 'id' => $model->statuschange->merged_into)); } if (isset($model->statuschange->priority)) { echo '<li>Priority: ' . Lookup::item('BugPriority', $model->statuschange->priority); } if (isset($model->statuschange->reproducability)) { echo '<li>Reproducibility: ' . Lookup::item('BugReproducability', $model->statuschange->reproducability); } if (isset($model->statuschange->assigned_to)) { if ($model->statuschange->assigned_to >= 0) { echo '<li>Owner: ' . (isset($model->statuschange->owner) ? CHtml::encode($model->statuschange->owner->username) : 'user was deleted'); } else { echo '<li>Owner: nobody'; } } echo '</ul></div>'; } foreach ($model->attachments as $attachment) { echo '<div class="bug-change-attach">' . CHtml::image(Yii::app()->baseUrl . '/images/file.png') . 'File attached: ' . CHtml::link(CHtml::encode($attachment->filename), array('bug/downloadAttachment', 'id' => $attachment->id)) . ' (' . MiscHelpers::fileSizeToStr($attachment->filesize) . ')' . '</div>'; } ?> </div>
<?php if (Yii::app()->user->checkAccess('pperm_browse_debug_info', array('project_id' => Yii::app()->user->getCurProjectId()))) { ?> <div class="span-9 loud prepend-top"> <div class="digest-pane" style="height:240px;"> <div class="subheader" title="Displays how many debug info files were uploaded for this project">Debug Info Totals (All Versions)</div> <ul class="totals"> <li> <?php $totalFileSize = 0; $percentOfDiskQuota = 0; $fileCount = Yii::app()->user->getCurProject()->getDebugInfoCount($totalFileSize, $percentOfDiskQuota); $percentOfDiskQuotaStr = sprintf("%.0f", $percentOfDiskQuota); echo $fileCount . ' files (' . MiscHelpers::fileSizeToStr($totalFileSize); if ($percentOfDiskQuota > 0) { echo ', ' . $percentOfDiskQuotaStr . '% of disk quota'; } echo ')'; ?> <?php $this->widget('zii.widgets.jui.CJuiProgressBar', array('value' => $percentOfDiskQuota, 'options' => array(), 'htmlOptions' => array('style' => 'height:20px;margin:5px'))); ?> </li> </ul> </div> </div> <div class="span-18 last prepend-top">
$this->widget('zii.widgets.grid.CGridView', array('dataProvider' => $dataProvider, 'selectableRows' => null, 'columns' => array(array('class' => 'CCheckBoxColumn', 'id' => 'DeleteRows', 'selectableRows' => 2), array('name' => 'id', 'cssClassExpression' => '"column-right-align"'), array('name' => 'filename', 'type' => 'raw', 'value' => 'CHtml::link($data->filename, \'view/\'.$data->id)'), array('header' => 'Size', 'name' => 'filesize', 'value' => 'MiscHelpers::fileSizeToStr($data->filesize)', 'cssClassExpression' => '"column-right-align"'), array('header' => 'Status', 'name' => 'status', 'value' => '$data->getStatusStr()', 'cssClassExpression' => '$data->status==DebugInfo::STATUS_INVALID?"status-invalid":""'), array('name' => 'guid', 'value' => '(isset($data->guid) && substr($data->guid, 0, 4)!="tmp_")?$data->guid:"n/a"'), array('name' => 'dateuploaded', 'value' => 'date("d/m/y H:i", $data->dateuploaded)')))); ?> </div> <?php echo CHtml::endForm(); ?> </div> <div class="span-27 last footnote"> <?php $curVer = ""; $totalFileSize = 0; $percentOfQuota = 0; $count = Yii::app()->user->getCurProject()->getDebugInfoCount($totalFileSize, $percentOfQuota); $totalFileSizeStr = MiscHelpers::fileSizeToStr($totalFileSize); $percentOfQuotaStr = sprintf("%.0f", $percentOfQuota); echo "This project contains total {$totalFileSizeStr} in {$count} file(s)"; if ($percentOfQuota >= 0) { echo " ({$percentOfQuotaStr}% of disc quota)."; } ?> </div> <?php $script = <<<SCRIPT \$(":checkbox").live('click', function(e) {\t \tvar totalSelected = 0; \t\$("input[name='DeleteRows\\[\\]']").each(function() {if(\$(this).attr('checked')) totalSelected++;});
<!-- Actions Toolbar --> <div class="span-18 last"> <div class="div_actions"> <?php echo CHtml::form(); ?> <?php echo CHtml::hiddenField('id', $model->id); ?> <?php echo CHtml::link('Download File', $this->createUrl('/debugInfo/download', array('id' => $model->id))); ?> <?php echo CHtml::link('Delete File', $this->createUrl('/debugInfo/delete', array('id' => $model->id))); ?> <?php echo CHtml::endForm(); ?> </div> </div> <!-- Detail View --> <div class="span-18 last"> <?php $this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array(array('name' => 'dateuploaded', 'type' => 'text', 'value' => date("d/m/y H:i", $model->dateuploaded)), 'filename', array('name' => 'status', 'type' => 'text', 'value' => $model->getStatusStr()), array('name' => 'filesize', 'type' => 'raw', 'value' => CHtml::encode(MiscHelpers::fileSizeToStr($model->filesize))), array('name' => 'guid', 'type' => 'text', 'value' => substr($model->guid, 0, 4) != "tmp_" ? $model->guid : "n/a"), 'md5'))); ?>