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.

mistachkin 2013-10-18 00:33 tkt-change-hook
Commit bfcdc23b7232e84a5fd18fd00a140e1cf68b9e1c
1 file changed +28 -12
+28 -12
--- src/xfersetup.c
+++ src/xfersetup.c
@@ -31,23 +31,49 @@
3131
if( !g.perm.Setup ){
3232
login_needed();
3333
}
3434
3535
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
+
3648
url_parse(0, 0);
37
- if (g.urlProtocol){
49
+ if( g.urlProtocol ){
50
+ unsigned syncFlags;
3851
const char *zSync;
52
+ char *zWarning;
3953
4054
if( db_get_boolean("dont-push", 0) ){
55
+ syncFlags = SYNC_PULL;
4156
zSync = "Pull";
57
+ zWarning = 0;
4258
}else{
59
+ syncFlags = SYNC_PUSH | SYNC_PULL;
4360
zSync = "Synchronize";
61
+ zWarning = mprintf("WARNING: Pushing to \"%s\" is enabled.",
62
+ g.urlCanonical);
4463
}
4564
if( P("sync") ){
4665
user_select();
4766
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);
4975
}
5076
@
5177
@ <blockquote>
5278
@ <form method="post" action="%s(g.zTop)/%s(g.zPath)"><div>
5379
login_insert_csrf_secret();
@@ -55,20 +81,10 @@
5581
@ </div></form>
5682
@ </blockquote>
5783
@
5884
}
5985
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>
7086
style_footer();
7187
}
7288
7389
/*
7490
** Common implementation for the transfer setup editor pages.
7591
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button