+ Versions 1.2 inserts images in existing replaceable image objects (available in the template) before adding them at the end of the document, the old way.
Versions 1.1 allows you to include the study date in the images' captions.
diff --git a/Reporter/html/style.css b/Reporter/html/style.css
index 0b546ad..8d357d8 100644
--- a/Reporter/html/style.css
+++ b/Reporter/html/style.css
@@ -34,6 +34,11 @@ h1 {
margin-top: 40px;
}
+h2 {
+ margin-left: 20px;
+ margin-top: 20px;
+}
+
.text {
margin: 5px 20px 5px 20px;
}
diff --git a/Worklists/Resources/Info.plist b/Worklists/Resources/Info.plist
index 568cc03..d43aa51 100644
--- a/Worklists/Resources/Info.plist
+++ b/Worklists/Resources/Info.plist
@@ -15,10 +15,14 @@
CFBundleSignature
????
CFBundleShortVersionString
-
1.0.5
+
1.1.0
NSPrincipalClass
WorklistsPlugin
pluginType
-
Other
+
Database
+
MenuTitles
+
+ Temporarily disable Worklists refresh
+
diff --git a/Worklists/Sources/Worklist.mm b/Worklists/Sources/Worklist.mm
index 45f7d3c..8190c74 100644
--- a/Worklists/Sources/Worklist.mm
+++ b/Worklists/Sources/Worklist.mm
@@ -180,7 +180,7 @@ - (void)setProperties:(NSDictionary*)properties {
if (ti != -1) {
if (!self.refreshTimer || _refreshTimer.timeInterval != ti)
- self.refreshTimer = [NSTimer scheduledTimerWithTimeInterval:ti target:[WorklistsNonretainingTimerInvoker invokerWithTarget:self selector:@selector(initiateRefresh)] selector:@selector(fire:) userInfo:nil repeats:YES];
+ self.refreshTimer = [NSTimer scheduledTimerWithTimeInterval:ti target:[WorklistsNonretainingTimerInvoker invokerWithTarget:self selector:@selector(_timedInitiateRefresh:)] selector:@selector(fire:) userInfo:nil repeats:YES];
[_refreshTimer fire];
} else {
self.refreshTimer = nil;
@@ -541,6 +541,12 @@ - (void)_threadRefresh {
}
}
+- (void)_timedInitiateRefresh:(NSTimer*)timer {
+ if ([[WorklistsPlugin instance] refreshDisabled])
+ return;
+ [self initiateRefresh];
+}
+
- (void)initiateRefresh {
[self performSelectorInBackground:@selector(_threadRefresh) withObject:nil];
}
diff --git a/Worklists/Sources/WorklistsPlugin.h b/Worklists/Sources/WorklistsPlugin.h
index d627e87..00a52df 100644
--- a/Worklists/Sources/WorklistsPlugin.h
+++ b/Worklists/Sources/WorklistsPlugin.h
@@ -23,10 +23,14 @@ extern NSString* const WorklistAlbumIDsDefaultsKey;
NSMutableDictionary* _worklistObjs;
NSMutableDictionary* _errors;
NSTimer* _urlSyncTimer;
+ NSMenuItem* _pluginMenuItem;
+ BOOL _refreshDisabled;
+ NSTimer* _refreshReenableTimer;
}
@property(readonly,retain) NSArrayController* worklists;
@property(readonly,retain) NSTimer* urlSyncTimer;
+@property(readonly) BOOL refreshDisabled;
+ (WorklistsPlugin*)instance;
diff --git a/Worklists/Sources/WorklistsPlugin.mm b/Worklists/Sources/WorklistsPlugin.mm
index ccc4bf4..8c82ffc 100644
--- a/Worklists/Sources/WorklistsPlugin.mm
+++ b/Worklists/Sources/WorklistsPlugin.mm
@@ -20,6 +20,7 @@
#import
#import
#import
+#import
@interface WorklistsArrayController : NSArrayController
@@ -36,6 +37,7 @@ @implementation WorklistsPlugin
@synthesize worklists = _worklists;
@synthesize urlSyncTimer = _urlSyncTimer;
+@synthesize refreshDisabled = _refreshDisabled;
static WorklistsPlugin* WorklistsPluginInstance = nil;
static NSString* const Worklists = @"Worklists";
@@ -83,7 +85,9 @@ - (void)dealloc {
[NSUserDefaultsController.sharedUserDefaultsController removeObserver:self];
[NSNotificationCenter.defaultCenter removeObserver:self];
+
self.urlSyncTimer = nil;
+ [_refreshReenableTimer release];
[_cachePath release];
[_worklistObjs release];
@@ -99,43 +103,42 @@ - (void)initPlugin {
[PreferencesWindowController addPluginPaneWithResourceNamed:@"WorklistsPreferences" inBundle:[NSBundle bundleForClass:[self class]] withTitle:Worklists image:image];
Method method;
- IMP imp;
+ //IMP imp;
Class BrowserControllerClass = [BrowserController class];
method = class_getInstanceMethod(BrowserControllerClass, @selector(tableView:willDisplayCell:forTableColumn:row:));
if (!method) [NSException raise:NSGenericException format:@"bad OsiriX version"];
- imp = method_getImplementation(method);
- class_addMethod(BrowserControllerClass, @selector(_Worklists_BrowserController_tableView:willDisplayCell:forTableColumn:row:), imp, method_getTypeEncoding(method));
+ class_addMethod(BrowserControllerClass, @selector(_Worklists_BrowserController_tableView:willDisplayCell:forTableColumn:row:), method_getImplementation(method), method_getTypeEncoding(method));
method_setImplementation(method, class_getMethodImplementation([self class], @selector(_Worklists_BrowserController_tableView:willDisplayCell:forTableColumn:row:)));
method = class_getInstanceMethod(BrowserControllerClass, @selector(tableView:validateDrop:proposedRow:proposedDropOperation:));
if (!method) [NSException raise:NSGenericException format:@"bad OsiriX version"];
- imp = method_getImplementation(method);
- class_addMethod(BrowserControllerClass, @selector(_Worklists_BrowserController_tableView:validateDrop:proposedRow:proposedDropOperation:), imp, method_getTypeEncoding(method));
+ class_addMethod(BrowserControllerClass, @selector(_Worklists_BrowserController_tableView:validateDrop:proposedRow:proposedDropOperation:), method_getImplementation(method), method_getTypeEncoding(method));
method_setImplementation(method, class_getMethodImplementation([self class], @selector(_Worklists_BrowserController_tableView:validateDrop:proposedRow:proposedDropOperation:)));
method = class_getInstanceMethod(BrowserControllerClass, @selector(tableView:toolTipForCell:rect:tableColumn:row:mouseLocation:));
if (!method) [NSException raise:NSGenericException format:@"bad OsiriX version"];
- imp = method_getImplementation(method);
- class_addMethod(BrowserControllerClass, @selector(_Worklists_BrowserController_tableView:toolTipForCell:rect:tableColumn:row:mouseLocation:), imp, method_getTypeEncoding(method));
+ class_addMethod(BrowserControllerClass, @selector(_Worklists_BrowserController_tableView:toolTipForCell:rect:tableColumn:row:mouseLocation:), method_getImplementation(method), method_getTypeEncoding(method));
method_setImplementation(method, class_getMethodImplementation([self class], @selector(_Worklists_BrowserController_tableView:toolTipForCell:rect:tableColumn:row:mouseLocation:)));
method = class_getInstanceMethod(BrowserControllerClass, @selector(menuWillOpen:));
if (!method) [NSException raise:NSGenericException format:@"bad OsiriX version"];
- imp = method_getImplementation(method);
- class_addMethod(BrowserControllerClass, @selector(_Worklists_BrowserController_menuWillOpen:), imp, method_getTypeEncoding(method));
+ class_addMethod(BrowserControllerClass, @selector(_Worklists_BrowserController_menuWillOpen:), method_getImplementation(method), method_getTypeEncoding(method));
method_setImplementation(method, class_getMethodImplementation([self class], @selector(_Worklists_BrowserController_menuWillOpen:)));
method = class_getInstanceMethod(BrowserControllerClass, @selector(outlineView:willDisplayCell:forTableColumn:item:));
if (!method) [NSException raise:NSGenericException format:@"bad OsiriX version"];
- imp = method_getImplementation(method);
- class_addMethod(BrowserControllerClass, @selector(_Worklists_BrowserController_outlineView:willDisplayCell:forTableColumn:item:), imp, method_getTypeEncoding(method));
+ class_addMethod(BrowserControllerClass, @selector(_Worklists_BrowserController_outlineView:willDisplayCell:forTableColumn:item:), method_getImplementation(method), method_getTypeEncoding(method));
method_setImplementation(method, class_getMethodImplementation([self class], @selector(_Worklists_BrowserController_outlineView:willDisplayCell:forTableColumn:item:)));
-}
-
-- (long)filterImage:(NSString*)menuName {
- return 0;
+
+ Class PluginManagerClass = [PluginManager class];
+
+ method = class_getClassMethod(PluginManagerClass, @selector(setMenus::::));
+ if (!method) [NSException raise:NSGenericException format:@"bad OsiriX version"];
+ class_addMethod(object_getClass(PluginManagerClass), @selector(_Worklists_PluginManager_setMenus::::), method_getImplementation(method), method_getTypeEncoding(method));
+ method_setImplementation(method, method_getImplementation(class_getClassMethod([self class], @selector(_Worklists_PluginManager_setMenus::::))));
+
}
- (void)observeValueForKeyPath:(NSString*)keyPath ofObject:(id)object change:(NSDictionary*)change context:(void*)context {
@@ -285,6 +288,38 @@ + (void)refreshAlbumsForDatabase:(DicomDatabase*)db {
[BrowserController.currentBrowser refreshAlbums];
}
+- (void)updateMenuItem {
+ [_pluginMenuItem setState:(_refreshDisabled? NSOnState : NSOffState)];
+}
+
+- (long)filterImage:(NSString*)menuName {
+ if (_refreshDisabled) {
+ [_refreshReenableTimer invalidate];
+ _refreshReenableTimer = nil;
+ _refreshDisabled = NO;
+ [self updateMenuItem];
+ } else {
+ NSAlert* alert = [NSAlert alertWithMessageText:NSLocalizedString(@"Worklists won't be refreshed for the next 60 minutes.", nil) defaultButton:nil alternateButton:NSLocalizedString(@"Cancel", nil) otherButton:nil informativeTextWithFormat:NSLocalizedString(@"After 60 minutes, worklists will automatically start refreshing again, but you can use this menu item to re-enable worklists when you're done.", nil)];
+ [alert beginSheetModalForWindow:nil modalDelegate:self didEndSelector:@selector(_disableRefreshSheetDidEnd:returnCode:contextInfo:) contextInfo:nil];
+ }
+
+ return 0;
+}
+
+- (void)_disableRefreshSheetDidEnd:(NSAlert*)alert returnCode:(NSInteger)returnCode contextInfo:(void*)contextInfo {
+ if (returnCode == NSOKButton) {
+ _refreshDisabled = YES;
+ [self updateMenuItem];
+ _refreshReenableTimer = [NSTimer scheduledTimerWithTimeInterval:3600 target:[WorklistsNonretainingTimerInvoker invokerWithTarget:self selector:@selector(_timedReenableRefresh:)] selector:@selector(fire:) userInfo:nil repeats:NO];
+ }
+}
+
+- (void)_timedReenableRefresh:(NSTimer*)timer {
+ _refreshReenableTimer = nil;
+ _refreshDisabled = NO;
+ [self updateMenuItem];
+}
+
#pragma mark BrowserController
- (void)_BrowserController:(BrowserController*)bc tableView:(NSTableView*)table willDisplayCell:(PrettyCell*)cell forTableColumn:(NSTableColumn*)column row:(NSInteger)row {
@@ -456,6 +491,33 @@ - (void)_Worklists_BrowserController_outlineView:(NSOutlineView*)outlineView wil
[WorklistsPluginInstance _BrowserController:(id)self outlineView:outlineView willDisplayCell:cell forTableColumn:column item:item];
}
+- (void)_PluginManager_setMenus:(NSMenu*)filtersMenu :(NSMenu*)roisMenu :(NSMenu*)othersMenu :(NSMenu*)dbMenu {
+ NSBundle* bundle = [NSBundle bundleForClass:[self class]];
+
+ _pluginMenuItem = nil;
+
+ for (NSMenuItem* mi in dbMenu.itemArray) {
+ if (mi.representedObject) { // we recently started setting the NSMenuItem's representedObject to the plugin's NSBundle instance
+ if (mi.representedObject != bundle)
+ continue;
+ } else // previously, the only way to identify the menus was by their title
+ if (![mi.title isEqualToString:@"Temporarily disable Worklists refresh"])
+ continue;
+
+ // mi is our menu item
+ _pluginMenuItem = mi;
+
+ break; // we don't have other menu items
+ }
+
+ [self updateMenuItem];
+}
+
++ (void)_Worklists_PluginManager_setMenus:(NSMenu*)filtersMenu :(NSMenu*)roisMenu :(NSMenu*)othersMenu :(NSMenu*)dbMenu {
+ [self _Worklists_PluginManager_setMenus:filtersMenu :roisMenu :othersMenu :dbMenu];
+ [WorklistsPluginInstance _PluginManager_setMenus:filtersMenu :roisMenu :othersMenu :dbMenu];
+}
+
@end