Browse files

[NEW] #37 Configurable trace list dropdown

  • Loading branch information...
1 parent 7358644 commit 395b69c04f904f387806f641ad072b91ce96c205 @jokkedk committed Oct 27, 2010
Showing with 15 additions and 3 deletions.
  1. +10 −0 config.php
  2. +3 −2 library/FileHandler.php
  3. +2 −1 templates/index.phtml
View
10 config.php
@@ -39,6 +39,16 @@ class Webgrind_Config extends Webgrind_MasterConfig {
//static $fileUrlFormat = 'txmt://open/?url=file://%1$s&line=%2$d'; // Textmate
//static $fileUrlFormat = 'file://%1$s'; // ?
+ /**
+ * format of the trace drop down list
+ * default is: invokeurl (tracefile_name) [tracefile_size]
+ * the following options will be replaced:
+ * %i - invoked url
+ * %f - trace file name
+ * %s - size of trace file
+ * %m - modified time of file name (in dateFormat specified above)
+ */
+ static $traceFileListFormat = '%i (%f) [%s]';
#########################
View
5 library/FileHandler.php
@@ -145,9 +145,10 @@ private function getPrepFiles($format, $dir){
public function getTraceList(){
$result = array();
foreach($this->files as $fileName=>$file){
- $result[] = array('filename' => $fileName,
+ $result[] = array('filename' => $fileName,
'invokeUrl' => str_replace($_SERVER['DOCUMENT_ROOT'].'/', '', $file['invokeUrl']),
- 'filesize' => $file['filesize']
+ 'filesize' => $file['filesize'],
+ 'mtime' => date(Webgrind_Config::$dateFormat, $file['mtime'])
);
}
return $result;
View
3 templates/index.phtml
@@ -295,7 +295,8 @@
<select id="dataFile" name="dataFile" style="width:200px">
<option value="0">Auto (newest)</option>
<?php foreach(Webgrind_FileHandler::getInstance()->getTraceList() as $trace):?>
- <option value="<?php echo $trace['filename']?>"><?php echo $trace['invokeUrl']?> (<?php echo $trace['filename']?>) [<?php echo $trace['filesize']?>]</option>
+ <!-- <option value="<?php echo $trace['filename']?>"><?php echo $trace['invokeUrl']?> (<?php echo $trace['filename']?>) [<?php echo $trace['filesize']?>]</option> -->
+ <option value="<?php echo $trace['filename']?>"><?php echo str_replace(array('%i','%f','%s','%m'),array($trace['invokeUrl'],$trace['filename'],$trace['filesize'],$trace['mtime']),Webgrind_Config::$traceFileListFormat); ?></option>
<?php endforeach;?>
</select>
<img class="list_reload" src="img/reload.png" onclick="reloadFilelist()">

0 comments on commit 395b69c

Please sign in to comment.