Revision: 29499
          http://sourceforge.net/p/bibdesk/svn/29499
Author:   hofman
Date:     2025-08-30 17:34:51 +0000 (Sat, 30 Aug 2025)
Log Message:
-----------
Handle input actions in download page by submitting post forms. Receive actions 
in custom bibdesk protocol and download manager. No need to make download 
manager available to javascript.

Modified Paths:
--------------
    trunk/bibdesk/BDSKBibDeskProtocol.m
    trunk/bibdesk/BDSKDownloadManager.h
    trunk/bibdesk/BDSKDownloadManager.m
    trunk/bibdesk/BDSKWebView.m
    trunk/bibdesk/de.lproj/WebGroupDownloads.html
    trunk/bibdesk/en.lproj/WebGroupDownloads.html
    trunk/bibdesk/fr.lproj/WebGroupDownloads.html

Modified: trunk/bibdesk/BDSKBibDeskProtocol.m
===================================================================
--- trunk/bibdesk/BDSKBibDeskProtocol.m 2025-08-29 21:49:43 UTC (rev 29498)
+++ trunk/bibdesk/BDSKBibDeskProtocol.m 2025-08-30 17:34:51 UTC (rev 29499)
@@ -98,8 +98,27 @@
             welcomeHTMLData = [[self 
HTMLDataUsingTemplateFile:@"WebGroupStartPage" usingObject:[BDSKWebParser 
class]] copy];
         [self loadData:welcomeHTMLData MIMEType:@"text/html"];
     } else if ([DOWNLOADS_SPECIFIER isCaseInsensitiveEqual:resourceSpecifier]) 
{
-        NSData *data = [self HTMLDataUsingTemplateFile:@"WebGroupDownloads" 
usingObject:[BDSKDownloadManager sharedManager]];
-        [self loadData:data MIMEType:@"text/html"];
+        if ([[request HTTPBody] length]) {
+            NSString *action = [[NSString alloc] initWithData:[request 
HTTPBody] encoding:NSUTF8StringEncoding];
+            NSUInteger i = [action rangeOfString:@"&"].location;
+            if (i != NSNotFound)
+                action = [action substringToIndex:i];
+            i = [action rangeOfString:@"="].location;
+            if (i != NSNotFound) {
+                NSInteger value = [[action substringFromIndex:i + 1] 
integerValue];
+                action = [action substringToIndex:i];
+                [[BDSKDownloadManager sharedManager] performAction:action 
withValue:value];
+            }
+            // redirect to clear the body, so a reload won't resubmit
+            NSURLResponse *response = [[NSURLResponse alloc] 
initWithURL:theURL MIMEType:@"text/html" expectedContentLength:-1 
textEncodingName:nil];
+            NSMutableURLRequest *redirectRequest = [request mutableCopy];
+            [redirectRequest setHTTPBody:nil];
+            [client URLProtocol:self wasRedirectedToRequest:redirectRequest 
redirectResponse:response];
+            [client URLProtocolDidFinishLoading:self];
+        } else {
+            NSData *data = [self 
HTMLDataUsingTemplateFile:@"WebGroupDownloads" usingObject:[BDSKDownloadManager 
sharedManager]];
+            [self loadData:data MIMEType:@"text/html"];
+        }
     } else if ([resourceSpecifier 
hasCaseInsensitivePrefix:FILEICON_SPECIFIER]) {
         NSString *extension = [[resourceSpecifier 
substringFromIndex:[FILEICON_SPECIFIER length]] 
stringByRemovingPercentEncoding];
         NSImage *icon = [[NSWorkspace sharedWorkspace] 
iconForFileType:extension];
@@ -125,7 +144,8 @@
         // when there's no "//" the URL we get has percent escapes including 
in particular the # character, which would we don't want
         NSString *URLString = [NSString stringWithFormat:@"%@://%@", 
BDSKBibDeskScheme, [resourceSpecifier stringByRemovingPercentEncoding]];
         NSURLResponse *response = [[NSURLResponse alloc] initWithURL:theURL 
MIMEType:@"text/html" expectedContentLength:-1 textEncodingName:nil];
-        NSURLRequest *redirectRequest = [[NSURLRequest alloc] 
initWithURL:[NSURL URLWithStringByNormalizingPercentEscapes:URLString]];
+        NSMutableURLRequest *redirectRequest = [request mutableCopy];
+        [redirectRequest setURL:[NSURL 
URLWithStringByNormalizingPercentEscapes:URLString]];
         [client URLProtocol:self wasRedirectedToRequest:redirectRequest 
redirectResponse:response];
         [client URLProtocolDidFinishLoading:self];
     } else if ([HELP_SPECIFIER isCaseInsensitiveEqual:[theURL host]]) {

Modified: trunk/bibdesk/BDSKDownloadManager.h
===================================================================
--- trunk/bibdesk/BDSKDownloadManager.h 2025-08-29 21:49:43 UTC (rev 29498)
+++ trunk/bibdesk/BDSKDownloadManager.h 2025-08-30 17:34:51 UTC (rev 29499)
@@ -49,7 +49,6 @@
 
 @interface BDSKDownloadManager : NSObject <WebDownloadDelegate> {
     NSMutableArray *downloads;
-    NSInteger modification;
 }
 
 @property (class, nonatomic, readonly) BDSKDownloadManager *sharedManager;
@@ -56,15 +55,10 @@
 
 @property (nonatomic, readonly) NSArray *downloads;
 
-@property (nonatomic) BOOL removeFinishedDownloads;
-@property (nonatomic) BOOL removeFailedDownloads;
+@property (nonatomic, readonly) BOOL removeFinishedDownloads, 
removeFailedDownloads;
 
-@property (nonatomic, readonly) NSInteger modification;
+- (void)performAction:(NSString *)action withValue:(NSInteger)value;
 
-- (void)clear;
-- (void)cancel:(NSUInteger)uniqueID;
-- (void)remove:(NSUInteger)uniqueID;
-
 - (void)addDownload:(id)download;
 
 @end

Modified: trunk/bibdesk/BDSKDownloadManager.m
===================================================================
--- trunk/bibdesk/BDSKDownloadManager.m 2025-08-29 21:49:43 UTC (rev 29498)
+++ trunk/bibdesk/BDSKDownloadManager.m 2025-08-30 17:34:51 UTC (rev 29499)
@@ -61,7 +61,7 @@
 
 @implementation BDSKDownloadManager
 
-@synthesize downloads, modification;
+@synthesize downloads;
 @dynamic removeFinishedDownloads, removeFailedDownloads;
 
 + (BDSKDownloadManager *)sharedManager {
@@ -83,22 +83,13 @@
     return [[NSUserDefaults standardUserDefaults] 
boolForKey:BDSKRemoveFinishedDownloadsKey];
 }
 
-- (void)setRemoveFinishedDownloads:(BOOL)flag {
-   [[NSUserDefaults standardUserDefaults] setBool:flag 
forKey:BDSKRemoveFinishedDownloadsKey];
-}
-
 - (BOOL)removeFailedDownloads {
     return [[NSUserDefaults standardUserDefaults] 
boolForKey:BDSKRemoveFailedDownloadsKey];
 }
 
-- (void)setRemoveFailedDownloads:(BOOL)flag {
-   [[NSUserDefaults standardUserDefaults] setBool:flag 
forKey:BDSKRemoveFailedDownloadsKey];
-}
-
 - (void)addDownload:(id)download {
     [download setDelegate:self];
     [downloads addObject:[[BDSKWebDownload alloc] initWithDownload:download 
URL:[[download originalRequest] URL]]];
-    ++modification;
 }
 
 - (BDSKWebDownload *)webDownloadForDownload:(id)download {
@@ -117,53 +108,26 @@
     return nil;
 }
 
-- (void)clear {
-    BOOL didRemove = NO;
-    NSUInteger i = [downloads count];
-    while (i--) {
-        if ([[downloads objectAtIndex:i] status] != 
BDSKDownloadStatusDownloading) {
-            [downloads removeObjectAtIndex:i];
-            didRemove = YES;
+- (void)performAction:(NSString *)action withValue:(NSInteger)value {
+    if ([action isEqualToString:@"cancel"]) {
+        [[self downloadWithUniqueID:value] cancel];
+    } else if ([action isEqualToString:@"remove"]) {
+        BDSKWebDownload *webDownload = [self downloadWithUniqueID:value];
+        if (webDownload)
+            [downloads removeObject:webDownload];
+    } else if ([action isEqualToString:@"clear"]) {
+        NSUInteger i = [downloads count];
+        while (i--) {
+            if ([[downloads objectAtIndex:i] status] != 
BDSKDownloadStatusDownloading)
+                [downloads removeObjectAtIndex:i];
         }
+    } else if ([action isEqualToString:@"removeFinished"]) {
+        [[NSUserDefaults standardUserDefaults] setBool:value 
forKey:BDSKRemoveFinishedDownloadsKey];
+    } else if ([action isEqualToString:@"removeFailed"]) {
+        [[NSUserDefaults standardUserDefaults] setBool:value 
forKey:BDSKRemoveFailedDownloadsKey];
     }
-    if (didRemove)
-        ++modification;
 }
 
-- (void)cancel:(NSUInteger)uniqueID {
-    [[self downloadWithUniqueID:uniqueID] cancel];
-}
-
-- (void)remove:(NSUInteger)uniqueID {
-    BDSKWebDownload *webDownload = [self downloadWithUniqueID:uniqueID];
-    if (webDownload) {
-        [downloads removeObject:webDownload];
-        ++modification;
-    }
-}
-
-+ (NSString *)webScriptNameForSelector:(SEL)aSelector {
-    NSString *name = nil;
-    if (aSelector == @selector(cancel:))
-        name = @"cancel";
-    else if (aSelector == @selector(remove:))
-        name = @"remove";
-    return name;
-}
- 
-+ (BOOL)isSelectorExcludedFromWebScript:(SEL)aSelector {
-    return (aSelector != @selector(clear) && aSelector != @selector(cancel:) 
&& aSelector != @selector(remove:));
-}
- 
-+ (BOOL)isKeyExcludedFromWebScript:(const char *)aKey {
-    return 0 != strcmp(aKey, "removeFinishedDownloads") && 0 != strcmp(aKey, 
"removeFailedDownloads") && 0 != strcmp(aKey, "modification");
-}
-
-// This is necessary for web scripting to check the key for exposure, 
otherwise it will only check the ivar names instead
-- (NSArray *)attributeKeys {
-    return @[@"removeFinishedDownloads", @"removeFailedDownloads", 
@"modification"];
-}
-
 - (NSString *)fontFamilyName { return [[NSFont systemFontOfSize:0.0] 
familyName]; }
 
 #pragma mark NSURLDownload delegate protocol
@@ -170,7 +134,6 @@
 
 - (void)downloadDidBegin:(NSURLDownload *)download {
     [downloads addObject:[[BDSKWebDownload alloc] initWithDownload:download 
URL:[[download request] URL]]];
-    ++modification;
 }
 
 - (void)downloadDidFinish:(id)download {
@@ -179,7 +142,6 @@
     
     if ([[NSUserDefaults standardUserDefaults] 
boolForKey:BDSKRemoveFinishedDownloadsKey] && webDownload)
         [downloads removeObject:webDownload];
-    ++modification;
 }
 
 - (void)download:(NSURLDownload *)download didFailWithError:(NSError *)error {
@@ -188,7 +150,6 @@
     
     if ([[NSUserDefaults standardUserDefaults] 
boolForKey:BDSKRemoveFailedDownloadsKey] && webDownload)
         [downloads removeObject:webDownload];
-    ++modification;
     
     if ([[error domain] isEqualToString:NSURLErrorDomain] && [error code] == 
NSURLErrorCancelled)
         return;
@@ -242,7 +203,6 @@
     
     if ([[NSUserDefaults standardUserDefaults] 
boolForKey:BDSKRemoveFailedDownloadsKey] && webDownload)
         [downloads removeObject:webDownload];
-    ++modification;
     
     if ([[error domain] isEqualToString:NSURLErrorDomain] && [error code] == 
NSURLErrorCancelled)
         return;

Modified: trunk/bibdesk/BDSKWebView.m
===================================================================
--- trunk/bibdesk/BDSKWebView.m 2025-08-29 21:49:43 UTC (rev 29498)
+++ trunk/bibdesk/BDSKWebView.m 2025-08-30 17:34:51 UTC (rev 29499)
@@ -499,10 +499,6 @@
         [self webView:sender setTitle:title];
 }
 
-- (void)webView:(WebView *)sender didClearWindowObject:(WebScriptObject 
*)windowObject forFrame:(WebFrame *)frame {
-    [windowObject setValue:[BDSKDownloadManager sharedManager] 
forKey:@"downloads"];
-}
-
 #pragma mark WebPolicyDelegate protocol
 
 - (void)webView:(WebView *)sender decidePolicyForMIMEType:(NSString *)type 
request:(NSURLRequest *)request frame:(WebFrame *)frame 
decisionListener:(id<WebPolicyDecisionListener>)listener {

Modified: trunk/bibdesk/de.lproj/WebGroupDownloads.html
===================================================================
--- trunk/bibdesk/de.lproj/WebGroupDownloads.html       2025-08-29 21:49:43 UTC 
(rev 29498)
+++ trunk/bibdesk/de.lproj/WebGroupDownloads.html       2025-08-30 17:34:51 UTC 
(rev 29499)
@@ -10,6 +10,7 @@
                * { margin: 0px; padding: 0px; }
         body { font-family: "<$fontFamilyName/>", sans-serif; font-size: 13px; 
padding: 0px; }
                h1 { font-size: 16px; margin: 10px; color: #999; }
+        form { margin: 0px; padding: 0px; display:inline; }
                .downloads { width: 100%; border-width: 0px 0px 1px 0px; 
border-spacing: 0px; border-style: solid; border-color: #999; }
                .icon { margin: 2px; width: 32px; height: 32px; }
                .source { font-size: 12px; margin-left: 1em; }
@@ -17,7 +18,7 @@
                .button { margin-right: 10px; float: right; }
                .clear { margin: 10px; }
                .prefs { font-size: 12px; }
-               .prefs input { margin: 0.5em 0.5em 0.5em 10px;  }
+               .prefs input[id] { margin: 0.5em 0.5em 0.5em 10px;  }
         tr:nth-of-type(odd) { background-color: #f5f5f5; }
                a { text-decoration: none; }
                a:hover { text-decoration: underline; }
@@ -24,72 +25,70 @@
                a:active { color: #900; }
                a:visited { color: #909; }
        </style>
-       <script language="javascript">
-
-function clearDownloads() {
-       downloads.clear();
-       location.reload();
-}
-
-function cancelDownload(id) {
-       downloads.cancel(id);
-       location.reload();
-}
-
-function removeDownload(id) {
-       downloads.remove(id);
-       location.reload();
-}
-
-       </script>
        </head>
-    <body onload="setInterval('if (downloads.modification != <$modification/>) 
{ location.reload() }',1000)">
-
+    <body onload="setTimeout('location.reload()',5000)">
+        
                <$downloads?>
-               <form>
-                       <table class="downloads" id="downloads">
-                               <$downloads>
-                               <tr>
-                                       <td width="36">
-                                               <img class="icon" 
src="bibdesk:fileicon:<$fileURL?><$fileURL.pathExtension/><?$fileURL?><$URL.pathExtension/></$fileURL?>"
 />
-                                       </td>
-                                       <td>
-                                               <$fileURL?>
-                                               <a 
href="<$fileURL/>"><$fileName/></a>
-                                               <?$fileURL?>
-                                               <$fileName/>
-                                               </$fileURL?>
+        <table class="downloads" id="downloads">
+            <$downloads>
+            <tr>
+                <td width="36">
+                    <img class="icon" 
src="bibdesk:fileicon:<$fileURL?><$fileURL.pathExtension/><?$fileURL?><$URL.pathExtension/></$fileURL?>"
 />
+                </td>
+                <td>
+                    <$fileURL?>
+                    <a href="<$fileURL/>"><$fileName/></a>
+                    <?$fileURL?>
+                    <$fileName/>
+                    </$fileURL?>
 <!-- Localize text -->
-                                               <a class="source" 
href="<$URL/>">(Quelle)</a>
-                                               <br />
-                                               <span class="status">
+                    <a class="source" href="<$URL/>">(Quelle)</a>
+                    <br />
+                    <span class="status">
 <!-- Localize text -->
-                                               <$status=0?>Herunterladen 
<?$status=1?>abgeschlossen<?$status=2?>fehlgeschlagen</$status?>
-                                               </span>
-                                       </td>
-                                       <td>
-<!-- Localize values and titles -->
+                    <$status=0?>Herunterladen 
<?$status=1?>abgeschlossen<?$status=2?>fehlgeschlagen</$status?>
+                    </span>
+                </td>
+                <td>
+                    <form action="" method="post">
                                                <$status=0?>
-                                               <input class="button" 
type="button" value="Abbrechen" title="Herunterladen abbrechen" 
onClick="cancelDownload(<$uniqueID/>)" />
+<!-- Localize value and title -->
+                                               <input class="button" 
type="submit" value="Abbrechen" title="Herunterladen abbrechen" />
+                        <input type="hidden" name="cancel" 
value="<$uniqueID/>" />
                                                <?$status?>
-                                               <input class="button" 
type="button" value="Entfernen" title="Download entfernen" 
onClick="removeDownload(<$uniqueID/>)" />
+<!-- Localize value and title -->
+                                               <input class="button" 
type="submit" value="Entfernen" title="Download entfernen" />
+                        <input type="hidden" name="remove" 
value="<$uniqueID/>" />
                                                </$status?>
-                                       </td>
-                               </tr>
-                               </$downloads>
-                       </table>
+                    </form>
+                </td>
+            </tr>
+            </$downloads>
+        </table>
+        <form action="" method="post">
 <!-- Localize value and title -->
-                       <input class="clear" type="button" value="Löschen" 
title="Entfernen Sie alle abgeschlossenen und fehlgeschlagenen Downloads" 
onClick="clearDownloads()" />
+                       <input class="clear" type="submit" value="Löschen" 
title="Entfernen Sie alle abgeschlossenen und fehlgeschlagenen Downloads" />
+            <input type="hidden" name="clear" value="0" />
                </form>
                <?$downloads?>
 <!-- Localize text -->
                <h1>Keine Downloads</h1>
                </$downloads?>
-               <form class="prefs">
+        <p>
+        <form class="prefs" action="" method="post">
+            <input id="finished" type="checkbox" name="removeFinished" 
value="1" onchangek="this.form.submit()" 
<$removeFinishedDownloads?>checked</$removeFinishedDownloads?> />
 <!-- Localize text -->
-               <input type="checkbox" id="finished" 
onClick="downloads.removeFinishedDownloads = this.checked" 
<$removeFinishedDownloads?>checked</$removeFinishedDownloads?> /><label 
for="finished">Fertige Downloads automatisch entfernen</label><br />
-               <input type="checkbox" id="failed" 
onClick="downloads.removeFailedDownloads = this.checked" 
<$removeFailedDownloads?>checked</$removeFailedDownloads?> /><label 
for="failed">Fehlgeschlagene Downloads automatisch entfernen</label>
+            <label for="finished">Fertige Downloads automatisch 
entfernen</label>
+            <input type="hidden" name="removeFinished" value="0" />
+        </form>
+        <br />
+        <form class="prefs" action="" method="post">
+            <input id="failed" type="checkbox" name="removeFailed" value="1" 
onchangek="this.form.submit()" 
<$removeFailedDownloads?>checked</$removeFailedDownloads?> />
+<!-- Localize text -->
+            <label for="failed">Fehlgeschlagene Downloads automatisch 
entfernen</label>
+            <input type="hidden" name="removeFailed" value="0" />
                </form>
+        </p>
                
        </body>
 </html>

Modified: trunk/bibdesk/en.lproj/WebGroupDownloads.html
===================================================================
--- trunk/bibdesk/en.lproj/WebGroupDownloads.html       2025-08-29 21:49:43 UTC 
(rev 29498)
+++ trunk/bibdesk/en.lproj/WebGroupDownloads.html       2025-08-30 17:34:51 UTC 
(rev 29499)
@@ -11,6 +11,7 @@
                body { font-family: "<$fontFamilyName/>", sans-serif; 
font-size: 13px; padding: 0px; }
                h1 { font-size: 16px; margin: 10px; color: #999; }
                .downloads { width: 100%; border-width: 0px 0px 1px 0px; 
border-spacing: 0px; border-style: solid; border-color: #999; }
+        form { margin: 0px; padding: 0px; display:inline; }
                .icon { margin: 2px; width: 32px; height: 32px; }
                .source { font-size: 12px; margin-left: 1em; }
                .status { font-size: 11px; }
@@ -17,7 +18,7 @@
                .button { margin-right: 10px; float: right; }
                .clear { margin: 10px; }
                .prefs { font-size: 12px; }
-               .prefs input { margin: 0.5em 0.5em 0.5em 10px;  }
+        .prefs input[id] { margin: 0.5em 0.5em 0.5em 10px; }
         tr:nth-of-type(odd) { background-color: #f5f5f5; }
                a { text-decoration: none; }
                a:hover { text-decoration: underline; }
@@ -24,72 +25,70 @@
                a:active { color: #900; }
                a:visited { color: #909; }
        </style>
-       <script language="javascript">
-
-function clearDownloads() {
-       downloads.clear();
-       location.reload();
-}
-
-function cancelDownload(id) {
-       downloads.cancel(id);
-       location.reload();
-}
-
-function removeDownload(id) {
-       downloads.remove(id);
-       location.reload();
-}
-
-       </script>
        </head>
-    <body onload="setInterval('if (downloads.modification != <$modification/>) 
{ location.reload() }',1000)">
-
-               <$downloads?>
-               <form>
-                       <table class="downloads" id="downloads">
-                               <$downloads>
-                               <tr>
-                                       <td width="36">
-                                               <img class="icon" 
src="bibdesk:fileicon:<$fileURL?><$fileURL.pathExtension/><?$fileURL?><$URL.pathExtension/></$fileURL?>"
 />
-                                       </td>
-                                       <td>
-                                               <$fileURL?>
-                                               <a 
href="<$fileURL/>"><$fileName/></a>
-                                               <?$fileURL?>
-                                               <$fileName/>
-                                               </$fileURL?>
+    <body onload="setTimeout('location.reload()',5000)">
+        
+        <$downloads?>
+        <table class="downloads" id="downloads">
+            <$downloads>
+            <tr>
+                <td width="36">
+                    <img class="icon" 
src="bibdesk:fileicon:<$fileURL?><$fileURL.pathExtension/><?$fileURL?><$URL.pathExtension/></$fileURL?>"
 />
+                </td>
+                <td>
+                    <$fileURL?>
+                    <a href="<$fileURL/>"><$fileName/></a>
+                    <?$fileURL?>
+                    <$fileName/>
+                    </$fileURL?>
 <!-- Localize text -->
-                                               <a class="source" 
href="<$URL/>">(Source)</a>
-                                               <br />
-                                               <span class="status">
+                    <a class="source" href="<$URL/>">(Source)</a>
+                    <br />
+                    <span class="status">
 <!-- Localize text -->
-                                               
<$status=0?>Downloading<?$status=1?>Finished<?$status=2?>Failed</$status?>
-                                               </span>
-                                       </td>
-                                       <td>
-<!-- Localize values and titles -->
-                                               <$status=0?>
-                                               <input class="button" 
type="button" value="Cancel" title="Cancel download" 
onClick="cancelDownload(<$uniqueID/>)" />
-                                               <?$status?>
-                                               <input class="button" 
type="button" value="Remove" title="Remove download" 
onClick="removeDownload(<$uniqueID/>)" />
+                    
<$status=0?>Downloading<?$status=1?>Finished<?$status=2?>Failed</$status?>
+                    </span>
+                </td>
+                <td>
+                    <form action="" method="post">
+                        <$status=0?>
+<!-- Localize value and title -->
+                        <input class="button" type="submit" value="Cancel" 
title="Cancel download" />
+                        <input type="hidden" name="cancel" 
value="<$uniqueID/>" />
+                        <?$status?>
+<!-- Localize value and title -->
+                        <input class="button" type="submit" value="Remove" 
title="Remove download" />
+                        <input type="hidden" name="remove" 
value="<$uniqueID/>" />
                                                </$status?>
-                                       </td>
-                               </tr>
-                               </$downloads>
-                       </table>
-<!-- Localize value and title -->
-                       <input class="clear" type="button" value="Clear" 
title="Remove all finished and failed downloads" onClick="clearDownloads()" />
-               </form>
+                    </form>
+                </td>
+            </tr>
+            </$downloads>
+        </table>
+<!-- Localze value and title -->
+        <form action="" method="post">
+                       <input class="clear" type="submit" value="Clear" 
title="Remove all finished and failed downloads" />
+            <input type="hidden" name="clear" value="0" />
+        </form>
                <?$downloads?>
 <!-- Localize text -->
                <h1>No Downloads</h1>
                </$downloads?>
-               <form class="prefs">
+        <p>
+        <form class="prefs" action="" method="post">
+            <input class="prefs" id="finished" type="checkbox" 
name="removeFinished" value="1" onchange="this.form.submit()" 
<$removeFinishedDownloads?>checked</$removeFinishedDownloads?> />
 <!-- Localize text -->
-               <input type="checkbox" id="finished" 
onClick="downloads.removeFinishedDownloads = this.checked" 
<$removeFinishedDownloads?>checked</$removeFinishedDownloads?> /><label 
for="finished">Automatically remove finished downloads</label><br />
-               <input type="checkbox" id="failed" 
onClick="downloads.removeFailedDownloads = this.checked" 
<$removeFailedDownloads?>checked</$removeFailedDownloads?> /><label 
for="failed">Automatically remove failed downloads</label>
+            <label for="finished">Automatically remove finished 
downloads</label>
+            <input type="hidden" name="removeFinished" value="0" />
+        </form>
+        <br />
+        <form class="prefs" action="" method="post">
+            <input id="failed" type="checkbox" name="removeFailed" value="1" 
onchange="this.form.submit()" 
<$removeFailedDownloads?>checked</$removeFailedDownloads?> />
+<!-- Localize text -->
+            <label for="failed">Automatically remove failed downloads</label>
+            <input type="hidden" name="removeFailed" value="0" />
                </form>
+        </p>
                
        </body>
 </html>

Modified: trunk/bibdesk/fr.lproj/WebGroupDownloads.html
===================================================================
--- trunk/bibdesk/fr.lproj/WebGroupDownloads.html       2025-08-29 21:49:43 UTC 
(rev 29498)
+++ trunk/bibdesk/fr.lproj/WebGroupDownloads.html       2025-08-30 17:34:51 UTC 
(rev 29499)
@@ -10,6 +10,7 @@
                * { margin: 0px; padding: 0px; }
         body { font-family: "<$fontFamilyName/>", sans-serif; font-size: 13px; 
padding: 0px; }
                h1 { font-size: 16px; margin: 10px; color: #999; }
+        form { margin: 0px; padding: 0px; display:inline; }
                .downloads { width: 100%; border-width: 0px 0px 1px 0px; 
border-spacing: 0px; border-style: solid; border-color: #999; }
                .icon { margin: 2px; width: 32px; height: 32px; }
                .source { font-size: 12px; margin-left: 1em; }
@@ -17,7 +18,7 @@
                .button { margin-right: 10px; float: right; }
                .clear { margin: 10px; }
                .prefs { font-size: 12px; }
-               .prefs input { margin: 0.5em 0.5em 0.5em 10px;  }
+        .prefs input[id] { margin: 0.5em 0.5em 0.5em 10px;  }
         tr:nth-of-type(odd) { background-color: #f5f5f5; }
                a { text-decoration: none; }
                a:hover { text-decoration: underline; }
@@ -24,72 +25,70 @@
                a:active { color: #900; }
                a:visited { color: #909; }
        </style>
-       <script language="javascript">
-
-function clearDownloads() {
-       downloads.clear();
-       location.reload();
-}
-
-function cancelDownload(id) {
-       downloads.cancel(id);
-       location.reload();
-}
-
-function removeDownload(id) {
-       downloads.remove(id);
-       location.reload();
-}
-
-       </script>
        </head>
-    <body onload="setInterval('if (downloads.modification != <$modification/>) 
{ location.reload() }',1000)">
-
+    <body onload="setTimeout('location.reload()',5000)">
+        
                <$downloads?>
-               <form>
-                       <table class="downloads" id="downloads">
-                               <$downloads>
-                               <tr>
-                                       <td width="36">
-                                               <img class="icon" 
src="bibdesk:fileicon:<$fileURL?><$fileURL.pathExtension/><?$fileURL?><$URL.pathExtension/></$fileURL?>"
 />
-                                       </td>
-                                       <td>
-                                               <$fileURL?>
-                                               <a 
href="<$fileURL/>"><$fileName/></a>
-                                               <?$fileURL?>
-                                               <$fileName/>
-                                               </$fileURL?>
+        <table class="downloads" id="downloads">
+            <$downloads>
+            <tr>
+                <td width="36">
+                    <img class="icon" 
src="bibdesk:fileicon:<$fileURL?><$fileURL.pathExtension/><?$fileURL?><$URL.pathExtension/></$fileURL?>"
 />
+                </td>
+                <td>
+                    <$fileURL?>
+                    <a href="<$fileURL/>"><$fileName/></a>
+                    <?$fileURL?>
+                    <$fileName/>
+                    </$fileURL?>
 <!-- Localize text -->
-                                               <a class="source" 
href="<$URL/>">(Source)</a>
-                                               <br />
-                                               <span class="status">
+                    <a class="source" href="<$URL/>">(Source)</a>
+                    <br />
+                    <span class="status">
 <!-- Localize text -->
-                                               
<$status=0?>T&eacute;l&eacute;chargement en 
cours<?$status=1?>Termin&eacute;<?$status=2?>&Eacute;chec</$status?>
-                                               </span>
-                                       </td>
-                                       <td>
+                    <$status=0?>T&eacute;l&eacute;chargement en 
cours<?$status=1?>Termin&eacute;<?$status=2?>&Eacute;chec</$status?>
+                    </span>
+                </td>
+                <td>
+                    <form action="" method="post">
+                                               <$status=0?>
 <!-- Localize values and titles -->
-                                               <$status=0?>
-                                               <input class="button" 
type="button" value="Annuler" title="Annuler le t&eacute;l&eacute;chargement" 
onClick="cancelDownload(<$uniqueID/>)" />
+                                               <input class="button" 
type="submit" value="Annuler" title="Annuler le t&eacute;l&eacute;chargement" />
+                        <input type="hidden" name="cancel" 
value="<$uniqueID/>" />
                                                <?$status?>
-                                               <input class="button" 
type="button" value="Supprimer" title="Supprimer le 
t&eacute;l&eacute;chargement" onClick="removeDownload(<$uniqueID/>)" />
+<!-- Localize values and titles -->
+                                               <input class="button" 
type="submit" value="Supprimer" title="Supprimer le 
t&eacute;l&eacute;chargement" />
+                        <input type="hidden" name="remove" 
value="<$uniqueID/>" />
                                                </$status?>
-                                       </td>
-                               </tr>
-                               </$downloads>
-                       </table>
+                    </form>
+                </td>
+            </tr>
+            </$downloads>
+        </table>
+        <form action="" method="post">
 <!-- Localize value and title -->
-                       <input class="clear" type="button" value="Effacer" 
title="Supprimer tous les t&eacute;l&eacute;chargements termin&eacute;s et 
annul&eacute;s" onClick="clearDownloads()" />
+                       <input class="clear" type="submit" value="Effacer" 
title="Supprimer tous les t&eacute;l&eacute;chargements termin&eacute;s et 
annul&eacute;s" />
+            <input type="hidden" name="clear" value="0" />
                </form>
                <?$downloads?>
 <!-- Localize text -->
                <h1>Pas de t&eacute;l&eacute;chargement</h1>
                </$downloads?>
-               <form class="prefs">
+        <p>
+        <form class="prefs" action="" method="post">
+            <input id="finished" type="checkbox" type="hidden" 
name="removeFinished" value="1" onchange="this.form.submit()" 
<$removeFinishedDownloads?>checked</$removeFinishedDownloads?> />
 <!-- Localize text -->
-               <input type="checkbox" id="finished" 
onClick="downloads.removeFinishedDownloads = this.checked" 
<$removeFinishedDownloads?>checked</$removeFinishedDownloads?> /><label 
for="finished">Effacer automatiquement les t&eacute;l&eacute;chargements 
termin&eacute;s</label><br />
-               <input type="checkbox" id="failed" 
onClick="downloads.removeFailedDownloads = this.checked" 
<$removeFailedDownloads?>checked</$removeFailedDownloads?> /><label 
for="failed">Effacer automatiquement les t&eacute;l&eacute;chargements qui ont 
&eacute;chou&eacute;</label>
+            <label for="finished">Effacer automatiquement les 
t&eacute;l&eacute;chargements termin&eacute;s</label>
+            <input type="hidden" name="removeFinished" value="0" />
+        </form>
+        <br />
+        <form class="prefs" action="" method="post">
+            <input id="failed" type="checkbox" name="removeFailed" value="1" 
onchange="this.form.submit()" 
<$removeFailedDownloads?>checked</$removeFailedDownloads?> />
+<!-- Localize text -->
+            <label for="failed">Effacer automatiquement les 
t&eacute;l&eacute;chargements qui ont &eacute;chou&eacute;</label>
+            <input type="hidden" name="removeFailed" value="0" />
                </form>
+        </p>
                
        </body>
 </html>

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

Reply via email to