Permalink
Browse files

bg color to left, added initial multi-plot page

  • Loading branch information...
1 parent 87754fd commit 8a1f498913cbee9562822e4306086b6f42b04591 @ofosho committed Dec 2, 2010
View
@@ -51,6 +51,7 @@
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
+ numWins = 0;
var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask],
contentView = [theWindow contentView];
@@ -71,8 +72,8 @@
// add vertical splitter (entire page) to contentview
[contentView addSubview:verticalSplitter];
+ [self createMenu];
[theWindow orderFront:self];
- [CPMenu setMenuBarVisible:YES];
}
- (void)initNotifications
{
@@ -108,27 +109,52 @@
}
- (@action)openIssueInNewWindow:(id)sender
{
- var newWindow = [[CPWindow alloc] initWithContentRect:CGRectMake(100, 100, 800, 600) styleMask:CPTitledWindowMask|CPClosableWindowMask|CPMiniaturizableWindowMask|CPResizableWindowMask];
- [newWindow setMinSize:CGSizeMake(300, 300)];
+ var newWindow = [[CPWindow alloc] initWithContentRect:CGRectMake(100, 100, 800, 600) styleMask:CPTitledWindowMask|CPClosableWindowMask|CPMiniaturizableWindowMask|CPResizableWindowMask];
+ [newWindow setMinSize:CGSizeMake(300, 300)];
var platformWindow = [[CPPlatformWindow alloc] initWithContentRect:CGRectMake(100, 100, 800, 600)];
[newWindow setPlatformWindow:platformWindow];
[newWindow setFullBridge:YES];
- var contentView = [newWindow contentView],
- webViewWin = [[CPWebViewFix alloc] initWithFrame:[contentView bounds]];
+ var contentView = [newWindow contentView],
+ webViewWin = [[CPWebViewFix alloc] initWithFrame:[contentView bounds]];
- [webViewWin setAutoresizingMask:CPViewWidthSizable|CPViewHeightSizable];
- [contentView addSubview:webViewWin];
+ [webViewWin setAutoresizingMask:CPViewWidthSizable|CPViewHeightSizable];
+ [contentView addSubview:webViewWin];
[webViewWin setScrollMode:CPWebViewScrollAppKit];
- [newWindow orderFront:self];
- [newWindow setDelegate:webViewWin];
+ [newWindow orderFront:self];
+ [newWindow setDelegate:webViewWin];
var i = [[tableView selectedRowIndexes] firstIndex];
var row = [[listDS objsToDisplay] objectAtIndex:i];
[webViewWin setMainFrameURL:@"php/tradeReport.php?group="+[row objectForKey:"Folder"]+"&file="+[row objectForKey:"Name"]];
- [newWindow setTitle:@"File:"+[row objectForKey:"Name"]];
+}
+- (@action)openIssuesInNewWindow
+{
+ var platformWin = [[CPPlatformWindow alloc] init];
+ var indices = [tableView selectedRowIndexes];
+ var index = [indices firstIndex];
+ for(var i=0;i < [indices count];i++){
+ var newWindow = [[CPWindow alloc] initWithContentRect:CGRectMake(300*i, 20, 300, 300) styleMask:CPTitledWindowMask|CPClosableWindowMask|CPMiniaturizableWindowMask|CPResizableWindowMask];
+ [newWindow setMinSize:CGSizeMake(300, 300)];
+ [newWindow setPlatformWindow:platformWin];
+
+ var contentView = [newWindow contentView],
+ webViewWin = [[CPWebViewFix alloc] initWithFrame:[contentView bounds]];
+
+ [webViewWin setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
+ [contentView addSubview:webViewWin];
+ [webViewWin setScrollMode:CPWebViewScrollAppKit];
+
+ [newWindow orderFront:self];
+ [newWindow setDelegate:webViewWin];
+
+ var row = [[listDS objsToDisplay] objectAtIndex:index];
+ [webViewWin setMainFrameURL:@"php/tradeReport.php?group="+[row objectForKey:"Folder"]+"&file="+[row objectForKey:"Name"]];
+ [newWindow setTitle:[row objectForKey:"Name"]];
+ index = [indices indexGreaterThanIndex:index];
+ }
}
- (void)tableViewSelectionDidChange:(CPNotification)aNotification
{
@@ -198,6 +224,17 @@
[scrollView setDocumentView:tableView];
[tableView reloadData];
}
+- (void)createMenu
+{
+ [CPMenu setMenuBarVisible:YES];
+ var theMenu = [[CPApplication sharedApplication] mainMenu];
+ var plotAllMenuItem = [[CPMenuItem alloc] initWithTitle:@"Plot All" action:@selector(openIssuesInNewWindow) keyEquivalent:nil];
+ [theMenu insertItem:plotAllMenuItem atIndex: 0];
+
+ [theMenu removeItemAtIndex:[theMenu indexOfItemWithTitle: @"New" ]];
+ [theMenu removeItemAtIndex:[theMenu indexOfItemWithTitle: @"Open"]];
+ [theMenu removeItemAtIndex:[theMenu indexOfItemWithTitle: @"Save"]];
+}
- (void)createGroupView
{
groupScrollView = [[CPScrollView alloc] initWithFrame:CGRectMake(0, 50, CGRectGetWidth([leftView bounds]), CGRectGetHeight([leftView bounds])-50)];
@@ -211,6 +248,7 @@
[groupView setDelegate:self];
[groupView setDataSource:groupDS];
[groupView setAllowsEmptySelection:NO];
+ [groupView setBackgroundColor:[CPColor colorWithHexString:@"EBF3F5"]];
var column = [[CPTableColumn alloc] initWithIdentifier:groupColId];
[column setWidth:220.0];
@@ -219,7 +257,6 @@
[groupView addTableColumn:column];
[groupView setColumnAutoresizingStyle:CPTableViewLastColumnOnlyAutoresizingStyle];
[groupView setRowHeight:26.0];
- [groupView setSelectionHighlightStyle:CPTableViewSelectionHighlightStyleSourceList];
[groupScrollView setDocumentView:groupView];
}
@@ -276,6 +313,7 @@
//create left/right views
leftView = [[CPView alloc] initWithFrame:CGRectMake(0, 0, 200, CGRectGetHeight([verticalSplitter bounds]))];
+ [leftView setBackgroundColor:[CPColor colorWithHexString:@"CCDDDD"]];
rightView = [[CPView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth([verticalSplitter bounds]) - 200, CGRectGetHeight([verticalSplitter bounds]))];
[rightView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable ];
View
No changes.
No changes.
No changes.
No changes.
View
@@ -45,29 +45,41 @@ function perms2string($perms){
(($perms & 0x0200) ? 'T' : '-'));
return $info;
}
-
- $curdir = $_GET['group'];
- $dir_iterator = new RecursiveDirectoryIterator("../files/" . $_GET['group']);
- $iterator = new RecursiveIteratorIterator($dir_iterator, RecursiveIteratorIterator::SELF_FIRST);
-
- $files = Array();
- foreach ($iterator as $file) {
- if($file->isFile()){
- if(substr($file, strrpos($file, '.') + 1) == "csv"){
- $temp = Array();
- $temp['Name'] = basename($file->getFileName(),'.csv');
- $temp['Folder'] = $curdir;
- $temp['Owner'] = (string)$file->getOwner();
- $temp['Group'] = (string)$file->getGroup();
- $temp['Size'] = (string)$file->getSize();
- $temp['Modified'] = date("F j, Y, g:i a",$file->getMTime());
- $temp['Permissions'] = perms2string($file->getPerms());
- $files[] = $temp;
+ function directoryToArray($directory, $recursive=true) {
+ $array_items = array();
+ if ($handle = opendir($directory)) {
+ while (false !== ($file = readdir($handle))) {
+ if ($file != "." && $file != "..") {
+ if (is_dir($directory. "/" . $file)) {
+ $curdir = $file;
+ if($recursive) {
+ $array_items = array_merge($array_items, directoryToArray($directory. "/" . $file, $recursive));
+ }
+ //Code to include directories in output
+ //$file = $directory . "/" . $file;
+ //$array_items[] = preg_replace("/\/\//si", "/", $file);
+ } else {
+ $file = new SplFileInfo($directory . "/" . $file);
+ if(substr($file, strrpos($file, '.') + 1) == "csv"){
+ $temp = Array();
+ $temp['Name'] = basename($file->getFileName(),'.csv');
+ $temp['Folder'] = basename($file->getPathInfo());
+ $temp['Owner'] = (string)$file->getOwner();
+ $temp['Group'] = (string)$file->getGroup();
+ $temp['Size'] = (string)$file->getSize();
+ $temp['Modified'] = date("F j, Y, g:i a",$file->getMTime());
+ $temp['Permissions'] = perms2string($file->getPerms());
+ $array_items[] = $temp;
+ }
+ }
+ }
}
+ closedir($handle);
}
- else
- $curdir = $file->getFilename();
+ return $array_items;
}
+
+ $files = directoryToArray("../files/". $_GET['group']);
echo json_encode($files);
?>

0 comments on commit 8a1f498

Please sign in to comment.