Fossil SCM

When editing a technote via HTTP GET request (e.g., an Edit link, as opposed to POST form submission), retain the previous version's custom color by default.

stephan 2019-11-18 07:29 trunk
Commit 346e9e97608893d28901b5fffc6d171944e0fc3597c4bdc78adcbdd26f1b9560
1 file changed +13
+13
--- src/event.c
+++ src/event.c
@@ -357,10 +357,14 @@
357357
** c=TEXT Timeline comment
358358
** g=TEXT Tags associated with this technote
359359
** mimetype=TEXT Mimetype for w= text
360360
** newclr Use a background color
361361
** clr=TEXT Background color to use if newclr
362
+**
363
+** For GET requests, when editing an existing technote newclr and clr
364
+** are implied if a custom color has been set on the previous version
365
+** of the technote.
362366
*/
363367
void eventedit_page(void){
364368
char *zTag;
365369
int rid = 0;
366370
Blob event;
@@ -414,10 +418,19 @@
414418
}
415419
416420
/* Figure out the color */
417421
if( rid ){
418422
zClr = db_text("", "SELECT bgcolor FROM event WHERE objid=%d", rid);
423
+ if( zClr && zClr[0] ){
424
+ const char * zRequestMethod = P("REQUEST_METHOD");
425
+ if(zRequestMethod && 'G'==zRequestMethod[0]){
426
+ /* Apply saved color by defaut for GET requests
427
+ ** (e.g., an Edit menu link).
428
+ */
429
+ zClrFlag = " checked";
430
+ }
431
+ }
419432
}else{
420433
zClr = "";
421434
isNew = 1;
422435
}
423436
if( P("newclr") ){
424437
--- src/event.c
+++ src/event.c
@@ -357,10 +357,14 @@
357 ** c=TEXT Timeline comment
358 ** g=TEXT Tags associated with this technote
359 ** mimetype=TEXT Mimetype for w= text
360 ** newclr Use a background color
361 ** clr=TEXT Background color to use if newclr
 
 
 
 
362 */
363 void eventedit_page(void){
364 char *zTag;
365 int rid = 0;
366 Blob event;
@@ -414,10 +418,19 @@
414 }
415
416 /* Figure out the color */
417 if( rid ){
418 zClr = db_text("", "SELECT bgcolor FROM event WHERE objid=%d", rid);
 
 
 
 
 
 
 
 
 
419 }else{
420 zClr = "";
421 isNew = 1;
422 }
423 if( P("newclr") ){
424
--- src/event.c
+++ src/event.c
@@ -357,10 +357,14 @@
357 ** c=TEXT Timeline comment
358 ** g=TEXT Tags associated with this technote
359 ** mimetype=TEXT Mimetype for w= text
360 ** newclr Use a background color
361 ** clr=TEXT Background color to use if newclr
362 **
363 ** For GET requests, when editing an existing technote newclr and clr
364 ** are implied if a custom color has been set on the previous version
365 ** of the technote.
366 */
367 void eventedit_page(void){
368 char *zTag;
369 int rid = 0;
370 Blob event;
@@ -414,10 +418,19 @@
418 }
419
420 /* Figure out the color */
421 if( rid ){
422 zClr = db_text("", "SELECT bgcolor FROM event WHERE objid=%d", rid);
423 if( zClr && zClr[0] ){
424 const char * zRequestMethod = P("REQUEST_METHOD");
425 if(zRequestMethod && 'G'==zRequestMethod[0]){
426 /* Apply saved color by defaut for GET requests
427 ** (e.g., an Edit menu link).
428 */
429 zClrFlag = " checked";
430 }
431 }
432 }else{
433 zClr = "";
434 isNew = 1;
435 }
436 if( P("newclr") ){
437

Keyboard Shortcuts

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