Fossil SCM
Make the new button on the transfer setup page use the selected sync flags. Move the button to the bottom of the content and add some explanatory text and a warning message.
Commit
bfcdc23b7232e84a5fd18fd00a140e1cf68b9e1c
Parent
bf45c30d1d2f220…
1 file changed
+28
-12
+28
-12
| --- src/xfersetup.c | ||
| +++ src/xfersetup.c | ||
| @@ -31,23 +31,49 @@ | ||
| 31 | 31 | if( !g.perm.Setup ){ |
| 32 | 32 | login_needed(); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | style_header("Transfer Setup"); |
| 36 | + | |
| 37 | + @ <table border="0" cellspacing="20"> | |
| 38 | + setup_menu_entry("Common", "xfersetup_com", | |
| 39 | + "Common TH1 code run before all transfer request processing."); | |
| 40 | + setup_menu_entry("Push", "xfersetup_push", | |
| 41 | + "Specific TH1 code to run after \"push\" transfer requests."); | |
| 42 | + setup_menu_entry("Commit", "xfersetup_commit", | |
| 43 | + "Specific TH1 code to run after processing a commit."); | |
| 44 | + setup_menu_entry("Ticket", "xfersetup_ticket", | |
| 45 | + "Specific TH1 code to run after processing a ticket change."); | |
| 46 | + @ </table> | |
| 47 | + | |
| 36 | 48 | url_parse(0, 0); |
| 37 | - if (g.urlProtocol){ | |
| 49 | + if( g.urlProtocol ){ | |
| 50 | + unsigned syncFlags; | |
| 38 | 51 | const char *zSync; |
| 52 | + char *zWarning; | |
| 39 | 53 | |
| 40 | 54 | if( db_get_boolean("dont-push", 0) ){ |
| 55 | + syncFlags = SYNC_PULL; | |
| 41 | 56 | zSync = "Pull"; |
| 57 | + zWarning = 0; | |
| 42 | 58 | }else{ |
| 59 | + syncFlags = SYNC_PUSH | SYNC_PULL; | |
| 43 | 60 | zSync = "Synchronize"; |
| 61 | + zWarning = mprintf("WARNING: Pushing to \"%s\" is enabled.", | |
| 62 | + g.urlCanonical); | |
| 44 | 63 | } |
| 45 | 64 | if( P("sync") ){ |
| 46 | 65 | user_select(); |
| 47 | 66 | url_enable_proxy(0); |
| 48 | - client_sync(SYNC_PUSH|SYNC_PULL, 0, 0); | |
| 67 | + client_sync(syncFlags, 0, 0); | |
| 68 | + } | |
| 69 | + @ <p>Press the %h(zSync) button below to synchronize the local repository | |
| 70 | + @ now. This may be useful when testing the various transfer scripts.</p> | |
| 71 | + @ | |
| 72 | + if( zWarning ){ | |
| 73 | + @ <big><b>%h(zWarning)</b></big> | |
| 74 | + free(zWarning); | |
| 49 | 75 | } |
| 50 | 76 | @ |
| 51 | 77 | @ <blockquote> |
| 52 | 78 | @ <form method="post" action="%s(g.zTop)/%s(g.zPath)"><div> |
| 53 | 79 | login_insert_csrf_secret(); |
| @@ -55,20 +81,10 @@ | ||
| 55 | 81 | @ </div></form> |
| 56 | 82 | @ </blockquote> |
| 57 | 83 | @ |
| 58 | 84 | } |
| 59 | 85 | |
| 60 | - @ <table border="0" cellspacing="20"> | |
| 61 | - setup_menu_entry("Common", "xfersetup_com", | |
| 62 | - "Common TH1 code run before all transfer request processing."); | |
| 63 | - setup_menu_entry("Push", "xfersetup_push", | |
| 64 | - "Specific TH1 code to run after \"push\" transfer requests."); | |
| 65 | - setup_menu_entry("Commit", "xfersetup_commit", | |
| 66 | - "Specific TH1 code to run after processing a commit."); | |
| 67 | - setup_menu_entry("Ticket", "xfersetup_ticket", | |
| 68 | - "Specific TH1 code to run after processing a ticket change."); | |
| 69 | - @ </table> | |
| 70 | 86 | style_footer(); |
| 71 | 87 | } |
| 72 | 88 | |
| 73 | 89 | /* |
| 74 | 90 | ** Common implementation for the transfer setup editor pages. |
| 75 | 91 |
| --- src/xfersetup.c | |
| +++ src/xfersetup.c | |
| @@ -31,23 +31,49 @@ | |
| 31 | if( !g.perm.Setup ){ |
| 32 | login_needed(); |
| 33 | } |
| 34 | |
| 35 | style_header("Transfer Setup"); |
| 36 | url_parse(0, 0); |
| 37 | if (g.urlProtocol){ |
| 38 | const char *zSync; |
| 39 | |
| 40 | if( db_get_boolean("dont-push", 0) ){ |
| 41 | zSync = "Pull"; |
| 42 | }else{ |
| 43 | zSync = "Synchronize"; |
| 44 | } |
| 45 | if( P("sync") ){ |
| 46 | user_select(); |
| 47 | url_enable_proxy(0); |
| 48 | client_sync(SYNC_PUSH|SYNC_PULL, 0, 0); |
| 49 | } |
| 50 | @ |
| 51 | @ <blockquote> |
| 52 | @ <form method="post" action="%s(g.zTop)/%s(g.zPath)"><div> |
| 53 | login_insert_csrf_secret(); |
| @@ -55,20 +81,10 @@ | |
| 55 | @ </div></form> |
| 56 | @ </blockquote> |
| 57 | @ |
| 58 | } |
| 59 | |
| 60 | @ <table border="0" cellspacing="20"> |
| 61 | setup_menu_entry("Common", "xfersetup_com", |
| 62 | "Common TH1 code run before all transfer request processing."); |
| 63 | setup_menu_entry("Push", "xfersetup_push", |
| 64 | "Specific TH1 code to run after \"push\" transfer requests."); |
| 65 | setup_menu_entry("Commit", "xfersetup_commit", |
| 66 | "Specific TH1 code to run after processing a commit."); |
| 67 | setup_menu_entry("Ticket", "xfersetup_ticket", |
| 68 | "Specific TH1 code to run after processing a ticket change."); |
| 69 | @ </table> |
| 70 | style_footer(); |
| 71 | } |
| 72 | |
| 73 | /* |
| 74 | ** Common implementation for the transfer setup editor pages. |
| 75 |
| --- src/xfersetup.c | |
| +++ src/xfersetup.c | |
| @@ -31,23 +31,49 @@ | |
| 31 | if( !g.perm.Setup ){ |
| 32 | login_needed(); |
| 33 | } |
| 34 | |
| 35 | style_header("Transfer Setup"); |
| 36 | |
| 37 | @ <table border="0" cellspacing="20"> |
| 38 | setup_menu_entry("Common", "xfersetup_com", |
| 39 | "Common TH1 code run before all transfer request processing."); |
| 40 | setup_menu_entry("Push", "xfersetup_push", |
| 41 | "Specific TH1 code to run after \"push\" transfer requests."); |
| 42 | setup_menu_entry("Commit", "xfersetup_commit", |
| 43 | "Specific TH1 code to run after processing a commit."); |
| 44 | setup_menu_entry("Ticket", "xfersetup_ticket", |
| 45 | "Specific TH1 code to run after processing a ticket change."); |
| 46 | @ </table> |
| 47 | |
| 48 | url_parse(0, 0); |
| 49 | if( g.urlProtocol ){ |
| 50 | unsigned syncFlags; |
| 51 | const char *zSync; |
| 52 | char *zWarning; |
| 53 | |
| 54 | if( db_get_boolean("dont-push", 0) ){ |
| 55 | syncFlags = SYNC_PULL; |
| 56 | zSync = "Pull"; |
| 57 | zWarning = 0; |
| 58 | }else{ |
| 59 | syncFlags = SYNC_PUSH | SYNC_PULL; |
| 60 | zSync = "Synchronize"; |
| 61 | zWarning = mprintf("WARNING: Pushing to \"%s\" is enabled.", |
| 62 | g.urlCanonical); |
| 63 | } |
| 64 | if( P("sync") ){ |
| 65 | user_select(); |
| 66 | url_enable_proxy(0); |
| 67 | client_sync(syncFlags, 0, 0); |
| 68 | } |
| 69 | @ <p>Press the %h(zSync) button below to synchronize the local repository |
| 70 | @ now. This may be useful when testing the various transfer scripts.</p> |
| 71 | @ |
| 72 | if( zWarning ){ |
| 73 | @ <big><b>%h(zWarning)</b></big> |
| 74 | free(zWarning); |
| 75 | } |
| 76 | @ |
| 77 | @ <blockquote> |
| 78 | @ <form method="post" action="%s(g.zTop)/%s(g.zPath)"><div> |
| 79 | login_insert_csrf_secret(); |
| @@ -55,20 +81,10 @@ | |
| 81 | @ </div></form> |
| 82 | @ </blockquote> |
| 83 | @ |
| 84 | } |
| 85 | |
| 86 | style_footer(); |
| 87 | } |
| 88 | |
| 89 | /* |
| 90 | ** Common implementation for the transfer setup editor pages. |
| 91 |