Revision: 29204
http://sourceforge.net/p/bibdesk/svn/29204
Author: hofman
Date: 2025-04-26 15:52:14 +0000 (Sat, 26 Apr 2025)
Log Message:
-----------
set record schema from recordSyntax option. Allow setting recordSyntax for SRU
in UI. Enable some fields for SRU.
Modified Paths:
--------------
trunk/bibdesk/BDSKSRUGroupServer.h
trunk/bibdesk/BDSKSRUGroupServer.m
trunk/bibdesk/BDSKSearchGroupSheetController.m
trunk/bibdesk/BDSKServerInfo.m
trunk/bibdesk/Base.lproj/BDSKSearchGroupSheet.xib
Modified: trunk/bibdesk/BDSKSRUGroupServer.h
===================================================================
--- trunk/bibdesk/BDSKSRUGroupServer.h 2025-04-26 15:29:41 UTC (rev 29203)
+++ trunk/bibdesk/BDSKSRUGroupServer.h 2025-04-26 15:52:14 UTC (rev 29204)
@@ -58,6 +58,7 @@
NSString *errorMessage;
}
+@property (class, nonatomic, readonly) NSArray *supportedRecordSyntaxes;
@end
NS_ASSUME_NONNULL_END
Modified: trunk/bibdesk/BDSKSRUGroupServer.m
===================================================================
--- trunk/bibdesk/BDSKSRUGroupServer.m 2025-04-26 15:29:41 UTC (rev 29203)
+++ trunk/bibdesk/BDSKSRUGroupServer.m 2025-04-26 15:52:14 UTC (rev 29204)
@@ -86,6 +86,8 @@
return self;
}
++ (NSArray *)supportedRecordSyntaxes { return @[@"marcxml", @"dc", @"mods"]; }
+
#pragma mark URLs
- (NSURLComponents *)baseURLComponents {
Modified: trunk/bibdesk/BDSKSearchGroupSheetController.m
===================================================================
--- trunk/bibdesk/BDSKSearchGroupSheetController.m 2025-04-26 15:29:41 UTC
(rev 29203)
+++ trunk/bibdesk/BDSKSearchGroupSheetController.m 2025-04-26 15:52:14 UTC
(rev 29204)
@@ -39,6 +39,7 @@
#import "BDSKSearchGroupSheetController.h"
#import "BDSKSearchGroup.h"
#import "BDSKZoomGroupServer.h"
+#import "BDSKSRUGroupServer.h"
#import "BDSKServerInfo.h"
#import "BDSKSearchGroupServerManager.h"
#import "NSString_BDSKExtensions.h"
@@ -100,6 +101,13 @@
}
- (void)changeOptions {
+ while ([syntaxPopup numberOfItems] > 1)
+ [syntaxPopup removeItemAtIndex:1];
+ if ([[self type] isEqualToString:BDSKSearchGroupZoom])
+ [syntaxPopup addItemsWithTitles:[BDSKZoomGroupServer
supportedRecordSyntaxes]];
+ else if ([[self type] isEqualToString:BDSKSearchGroupSRU])
+ [syntaxPopup addItemsWithTitles:[BDSKSRUGroupServer
supportedRecordSyntaxes]];
+
NSString *value = [serverInfo recordSyntax];
if (value == nil) {
[syntaxPopup selectItemAtIndex:0];
@@ -146,8 +154,6 @@
name = DEFAULT_SERVER_NAME;
}
- [syntaxPopup addItemsWithTitles:[BDSKZoomGroupServer
supportedRecordSyntaxes]];
-
[self reloadServersSelectingServerNamed:name];
[self changeOptions];
@@ -348,8 +354,10 @@
- (NSString *)type { return [serverInfo type] ?: BDSKSearchGroupEntrez; }
- (void)setType:(NSString *)newType {
- if ([newType isEqualToString:[serverInfo type]] == NO)
+ if ([newType isEqualToString:[serverInfo type]] == NO) {
[serverInfo setType:newType];
+ [self changeOptions];
+ }
}
- (NSInteger)typeTag {
Modified: trunk/bibdesk/BDSKServerInfo.m
===================================================================
--- trunk/bibdesk/BDSKServerInfo.m 2025-04-26 15:29:41 UTC (rev 29203)
+++ trunk/bibdesk/BDSKServerInfo.m 2025-04-26 15:52:14 UTC (rev 29204)
@@ -192,13 +192,10 @@
[[self type] isEqualToString:[(BDSKServerInfo *)other type]] == NO ||
isEqualOrBothNil([self database], [other database]) == NO)
isEqual = NO;
- else if ([self isZoom])
+ else if ([self isZoom] || [self isSRU])
isEqual = isEqualOrBothNil([self host], [other host]) &&
isEqualOrBothNil([self port], [(BDSKServerInfo *)other
port]) &&
isEqualOrBothEmpty(options, [(BDSKServerInfo *)other
options]);
- else if ([self isSRU])
- isEqual = isEqualOrBothNil([self host], [other host]) &&
- isEqualOrBothNil([self port], [(BDSKServerInfo *)other
port]);
else if ([self isISI])
isEqual = isEqualOrBothEmpty(options, [(BDSKServerInfo *)other
options]);
return isEqual;
@@ -211,7 +208,7 @@
hash = prime * hash + [[self host] hash];
hash = prime * hash + [[self port] hash];
}
- if ([self isZoom] || [self isISI]) {
+ if ([self isZoom] || [self isSRU] || [self isISI]) {
if ([options count])
hash = prime * hash + [options hash];
}
@@ -224,13 +221,9 @@
[info setValue:[self type] forKey:TYPE_KEY];
[info setValue:[self name] forKey:NAME_KEY];
[info setValue:[self database] forKey:DATABASE_KEY];
- if ([self isZoom]) {
+ if ([self isZoom] || [self isSRU]) {
[info setValue:[self host] forKey:HOST_KEY];
[info setValue:[self port] forKey:PORT_KEY];
- [info setValue:[self options] forKey:OPTIONS_KEY];
- } else if ([self isSRU]) {
- [info setValue:[self host] forKey:HOST_KEY];
- [info setValue:[self port] forKey:PORT_KEY];
} else if ([self isISI] && [options count] > 0) {
[info setValue:[self options] forKey:OPTIONS_KEY];
}
@@ -373,10 +366,15 @@
}];
if ([query count])
[components setPercentEncodedQuery:[query
componentsJoinedByString:@"&"]];
+ } else if ([self isSRU]) {
+ NSMutableArray *query = [NSMutableArray arrayWithObject:@"type=sru"];
+ [options enumerateKeysAndObjectsUsingBlock:^(NSString *key, NSString
*value, BOOL *stop){
+ if ([key isEqualToString:USERNAME_KEY] == NO)
+ [query addObject:[NSString stringWithFormat:@"%@=%@", key,
[value stringByAddingPercentEscapesForQueryTerm]]];
+ }];
+ [components setPercentEncodedQuery:[query
componentsJoinedByString:@"&"]];
} else if ([self isISI] && [self isLite]) {
[components setPercentEncodedQuery:@"lite=1"];
- } else if ([self isSRU]) {
- [components setPercentEncodedQuery:@"type=sru"];
}
NSURL *url = [components URL];
return url;
Modified: trunk/bibdesk/Base.lproj/BDSKSearchGroupSheet.xib
===================================================================
--- trunk/bibdesk/Base.lproj/BDSKSearchGroupSheet.xib 2025-04-26 15:29:41 UTC
(rev 29203)
+++ trunk/bibdesk/Base.lproj/BDSKSearchGroupSheet.xib 2025-04-26 15:52:14 UTC
(rev 29204)
@@ -215,7 +215,7 @@
<accessibilityConnection
property="title" destination="275" id="528"/>
<action selector="selectSyntax:"
target="-2" id="285"/>
<binding destination="-2"
name="enabled" keyPath="editable" id="470"/>
- <binding destination="-2"
name="enabled2" keyPath="zoom" previousBinding="470" id="471">
+ <binding destination="-2"
name="enabled2" keyPath="zoomOrSRU" previousBinding="470" id="OoG-ed-vKz">
<dictionary key="options">
<integer
key="NSMultipleValuesPlaceholder" value="-1"/>
<integer
key="NSNoSelectionPlaceholder" value="-1"/>
@@ -223,7 +223,7 @@
<integer
key="NSNullPlaceholder" value="-1"/>
</dictionary>
</binding>
- <binding destination="-2"
name="hidden" keyPath="zoom" previousBinding="471" id="946">
+ <binding destination="-2"
name="hidden" keyPath="zoomOrSRU" previousBinding="OoG-ed-vKz" id="CR4-3V-vAv">
<dictionary key="options">
<string
key="NSValueTransformerName">NSNegateBoolean</string>
</dictionary>
@@ -276,15 +276,8 @@
<connections>
<accessibilityConnection
property="title" destination="191" id="525"/>
<binding destination="-2"
name="enabled" keyPath="editable" id="468"/>
- <binding destination="569"
name="value" keyPath="selection.port" id="578">
+ <binding destination="-2"
name="enabled2" keyPath="zoomOrSRU" previousBinding="468" id="ShO-ZW-JH7">
<dictionary key="options">
- <integer
key="NSConditionallySetsEditable" value="0"/>
- <string
key="NSNullPlaceholder">Port</string>
- <integer
key="NSValidatesImmediately" value="1"/>
- </dictionary>
- </binding>
- <binding destination="-2"
name="enabled2" keyPath="zoom" previousBinding="468" id="979">
- <dictionary key="options">
<integer
key="NSMultipleValuesPlaceholder" value="-1"/>
<integer
key="NSNoSelectionPlaceholder" value="-1"/>
<integer
key="NSNotApplicablePlaceholder" value="-1"/>
@@ -291,11 +284,18 @@
<integer
key="NSNullPlaceholder" value="-1"/>
</dictionary>
</binding>
- <binding destination="-2"
name="hidden" keyPath="zoomOrSRU" previousBinding="979" id="zmn-bc-vkQ">
+ <binding destination="-2"
name="hidden" keyPath="zoomOrSRU" previousBinding="ShO-ZW-JH7" id="szp-hH-uho">
<dictionary key="options">
<string
key="NSValueTransformerName">NSNegateBoolean</string>
</dictionary>
</binding>
+ <binding destination="569"
name="value" keyPath="selection.port" id="578">
+ <dictionary key="options">
+ <integer
key="NSConditionallySetsEditable" value="0"/>
+ <string
key="NSNullPlaceholder">Port</string>
+ <integer
key="NSValidatesImmediately" value="1"/>
+ </dictionary>
+ </binding>
<outlet property="nextKeyView"
destination="201" id="293"/>
</connections>
</textField>
@@ -376,15 +376,8 @@
<connections>
<accessibilityConnection
property="title" destination="196" id="524"/>
<binding destination="-2"
name="enabled" keyPath="editable" id="480"/>
- <binding destination="569"
name="value" keyPath="selection.host" id="576">
+ <binding destination="-2"
name="enabled2" keyPath="zoomOrSRU" previousBinding="480" id="niH-KC-ox0">
<dictionary key="options">
- <integer
key="NSConditionallySetsEditable" value="0"/>
- <string
key="NSNullPlaceholder">Host Address</string>
- <integer
key="NSValidatesImmediately" value="1"/>
- </dictionary>
- </binding>
- <binding destination="-2"
name="enabled2" keyPath="zoom" previousBinding="480" id="977">
- <dictionary key="options">
<integer
key="NSMultipleValuesPlaceholder" value="-1"/>
<integer
key="NSNoSelectionPlaceholder" value="-1"/>
<integer
key="NSNotApplicablePlaceholder" value="-1"/>
@@ -391,11 +384,18 @@
<integer
key="NSNullPlaceholder" value="-1"/>
</dictionary>
</binding>
- <binding destination="-2"
name="hidden" keyPath="zoomOrSRU" previousBinding="977" id="XIN-vT-kNF">
+ <binding destination="-2"
name="hidden" keyPath="zoomOrSRU" previousBinding="niH-KC-ox0" id="XB0-uM-FgW">
<dictionary key="options">
<string
key="NSValueTransformerName">NSNegateBoolean</string>
</dictionary>
</binding>
+ <binding destination="569"
name="value" keyPath="selection.host" id="576">
+ <dictionary key="options">
+ <integer
key="NSConditionallySetsEditable" value="0"/>
+ <string
key="NSNullPlaceholder">Host Address</string>
+ <integer
key="NSValidatesImmediately" value="1"/>
+ </dictionary>
+ </binding>
<outlet property="nextKeyView"
destination="198" id="212"/>
</connections>
</textField>
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit