Fossil SCM

Use an HTML5 color chooser dialog in the check-in comment editor.

drh 2017-12-06 15:37 trunk
Commit f8bc3ce8c71424352b507fcc2e93ff0e405c431499af4f8d208f07a8d908d9c0
2 files changed +35 -18 +68 -154
+35 -18
--- src/event.c
+++ src/event.c
@@ -343,28 +343,39 @@
343343
** WEBPAGE: technoteedit
344344
** WEBPAGE: eventedit
345345
**
346346
** Revise or create a technical note (formerly called an "event").
347347
**
348
-** Parameters:
348
+** Required query parameter:
349349
**
350
-** name=ID Hex hash ID of the tech-note. If omitted, a new
350
+** name=ID Hex hash ID of the technote. If omitted, a new
351351
** tech-note is created.
352
+**
353
+** POST parameters from the "Cancel", "Preview", or "Submit" buttons:
354
+**
355
+** w=TEXT Complete text of the technote.
356
+** t=TEXT Time of the technote on the timeline (ISO 8601)
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
352362
*/
353363
void eventedit_page(void){
354364
char *zTag;
355365
int rid = 0;
356366
Blob event;
357367
const char *zId;
358368
int n;
359369
const char *z;
360
- char *zBody = (char*)P("w");
361
- char *zETime = (char*)P("t");
362
- const char *zComment = P("c");
363
- const char *zTags = P("g");
364
- const char *zClr;
365
- const char *zMimetype = P("mimetype");
370
+ char *zBody = (char*)P("w"); /* Text of the technote */
371
+ char *zETime = (char*)P("t"); /* Date this technote appears */
372
+ const char *zComment = P("c"); /* Timeline comment */
373
+ const char *zTags = P("g"); /* Tags added to this technote */
374
+ const char *zClrFlag = ""; /* "checked" for bg color */
375
+ const char *zClr; /* Name of the background color */
376
+ const char *zMimetype = P("mimetype"); /* Mimetype of zBody */
366377
int isNew = 0;
367378
368379
if( zBody ){
369380
zBody = mprintf("%s", zBody);
370381
}
@@ -407,13 +418,14 @@
407418
zClr = db_text("", "SELECT bgcolor FROM event WHERE objid=%d", rid);
408419
}else{
409420
zClr = "";
410421
isNew = 1;
411422
}
412
- zClr = PD("clr",zClr);
413
- if( fossil_strcmp(zClr,"##")==0 ) zClr = PD("cclr","");
414
-
423
+ if( P("newclr") ){
424
+ zClr = PD("clr",zClr);
425
+ if( zClr[0] ) zClrFlag = " checked";
426
+ }
415427
416428
/* If editing an existing event, extract the key fields to use as
417429
** a starting point for the edit.
418430
*/
419431
if( rid
@@ -442,21 +454,22 @@
442454
}
443455
zETime = db_text(0, "SELECT coalesce(datetime(%Q),datetime('now'))", zETime);
444456
if( P("submit")!=0 && (zBody!=0 && zComment!=0) ){
445457
login_verify_csrf_secret();
446458
if ( !event_commit_common(rid, zId, zBody, zETime,
447
- zMimetype, zComment, zTags, zClr) ){
459
+ zMimetype, zComment, zTags,
460
+ zClrFlag[0] ? zClr : 0) ){
448461
style_header("Error");
449462
@ Internal error: Fossil tried to make an invalid artifact for
450463
@ the edited technote.
451464
style_footer();
452465
return;
453466
}
454
- cgi_redirectf("technote?name=%T", zId);
467
+ cgi_redirectf("%R/technote?name=%T", zId);
455468
}
456469
if( P("cancel")!=0 ){
457
- cgi_redirectf("technote?name=%T", zId);
470
+ cgi_redirectf("%R/technote?name=%T", zId);
458471
return;
459472
}
460473
if( zBody==0 ){
461474
zBody = mprintf("Insert new content here...");
462475
}
@@ -468,11 +481,11 @@
468481
if( P("preview")!=0 ){
469482
Blob com;
470483
@ <p><b>Timeline comment preview:</b></p>
471484
@ <blockquote>
472485
@ <table border="0">
473
- if( zClr && zClr[0] ){
486
+ if( zClrFlag[0] && zClr && zClr[0] ){
474487
@ <tr><td style="background-color: %h(zClr);">
475488
}else{
476489
@ <tr><td>
477490
}
478491
blob_zero(&com);
@@ -509,11 +522,13 @@
509522
@ rows="3" wrap="virtual">%h(zComment)</textarea>
510523
@ </td></tr>
511524
512525
@ <tr><th align="right" valign="top">Timeline Background Color:</th>
513526
@ <td valign="top">
514
- render_color_chooser(0, zClr, 0, "clr", "cclr");
527
+ @ <input type='checkbox' name='newclr'%s(zClrFlag) />
528
+ @ Use custom color: \
529
+ @ <input type='color' name='clr' value='%s(zClr[0]?zClr:"#c0f0ff")'>
515530
@ </td></tr>
516531
517532
@ <tr><th align="right" valign="top">Tags:</th>
518533
@ <td valign="top">
519534
@ <input type="text" name="g" size="40" value="%h(zTags)" />
@@ -529,13 +544,15 @@
529544
@ <textarea name="w" class="technoteedit" cols="80"
530545
@ rows="%d(n)" wrap="virtual">%h(zBody)</textarea>
531546
@ </td></tr>
532547
533548
@ <tr><td colspan="2">
534
- @ <input type="submit" name="preview" value="Preview Your Changes" />
535
- @ <input type="submit" name="submit" value="Apply These Changes" />
536549
@ <input type="submit" name="cancel" value="Cancel" />
550
+ @ <input type="submit" name="preview" value="Preview" />
551
+ if( P("preview") ){
552
+ @ <input type="submit" name="submit" value="Submit" />
553
+ }
537554
@ </td></tr></table>
538555
@ </div></form>
539556
style_footer();
540557
}
541558
542559
--- src/event.c
+++ src/event.c
@@ -343,28 +343,39 @@
343 ** WEBPAGE: technoteedit
344 ** WEBPAGE: eventedit
345 **
346 ** Revise or create a technical note (formerly called an "event").
347 **
348 ** Parameters:
349 **
350 ** name=ID Hex hash ID of the tech-note. If omitted, a new
351 ** tech-note is created.
 
 
 
 
 
 
 
 
 
 
352 */
353 void eventedit_page(void){
354 char *zTag;
355 int rid = 0;
356 Blob event;
357 const char *zId;
358 int n;
359 const char *z;
360 char *zBody = (char*)P("w");
361 char *zETime = (char*)P("t");
362 const char *zComment = P("c");
363 const char *zTags = P("g");
364 const char *zClr;
365 const char *zMimetype = P("mimetype");
 
366 int isNew = 0;
367
368 if( zBody ){
369 zBody = mprintf("%s", zBody);
370 }
@@ -407,13 +418,14 @@
407 zClr = db_text("", "SELECT bgcolor FROM event WHERE objid=%d", rid);
408 }else{
409 zClr = "";
410 isNew = 1;
411 }
412 zClr = PD("clr",zClr);
413 if( fossil_strcmp(zClr,"##")==0 ) zClr = PD("cclr","");
414
 
415
416 /* If editing an existing event, extract the key fields to use as
417 ** a starting point for the edit.
418 */
419 if( rid
@@ -442,21 +454,22 @@
442 }
443 zETime = db_text(0, "SELECT coalesce(datetime(%Q),datetime('now'))", zETime);
444 if( P("submit")!=0 && (zBody!=0 && zComment!=0) ){
445 login_verify_csrf_secret();
446 if ( !event_commit_common(rid, zId, zBody, zETime,
447 zMimetype, zComment, zTags, zClr) ){
 
448 style_header("Error");
449 @ Internal error: Fossil tried to make an invalid artifact for
450 @ the edited technote.
451 style_footer();
452 return;
453 }
454 cgi_redirectf("technote?name=%T", zId);
455 }
456 if( P("cancel")!=0 ){
457 cgi_redirectf("technote?name=%T", zId);
458 return;
459 }
460 if( zBody==0 ){
461 zBody = mprintf("Insert new content here...");
462 }
@@ -468,11 +481,11 @@
468 if( P("preview")!=0 ){
469 Blob com;
470 @ <p><b>Timeline comment preview:</b></p>
471 @ <blockquote>
472 @ <table border="0">
473 if( zClr && zClr[0] ){
474 @ <tr><td style="background-color: %h(zClr);">
475 }else{
476 @ <tr><td>
477 }
478 blob_zero(&com);
@@ -509,11 +522,13 @@
509 @ rows="3" wrap="virtual">%h(zComment)</textarea>
510 @ </td></tr>
511
512 @ <tr><th align="right" valign="top">Timeline Background Color:</th>
513 @ <td valign="top">
514 render_color_chooser(0, zClr, 0, "clr", "cclr");
 
 
515 @ </td></tr>
516
517 @ <tr><th align="right" valign="top">Tags:</th>
518 @ <td valign="top">
519 @ <input type="text" name="g" size="40" value="%h(zTags)" />
@@ -529,13 +544,15 @@
529 @ <textarea name="w" class="technoteedit" cols="80"
530 @ rows="%d(n)" wrap="virtual">%h(zBody)</textarea>
531 @ </td></tr>
532
533 @ <tr><td colspan="2">
534 @ <input type="submit" name="preview" value="Preview Your Changes" />
535 @ <input type="submit" name="submit" value="Apply These Changes" />
536 @ <input type="submit" name="cancel" value="Cancel" />
 
 
 
 
537 @ </td></tr></table>
538 @ </div></form>
539 style_footer();
540 }
541
542
--- src/event.c
+++ src/event.c
@@ -343,28 +343,39 @@
343 ** WEBPAGE: technoteedit
344 ** WEBPAGE: eventedit
345 **
346 ** Revise or create a technical note (formerly called an "event").
347 **
348 ** Required query parameter:
349 **
350 ** name=ID Hex hash ID of the technote. If omitted, a new
351 ** tech-note is created.
352 **
353 ** POST parameters from the "Cancel", "Preview", or "Submit" buttons:
354 **
355 ** w=TEXT Complete text of the technote.
356 ** t=TEXT Time of the technote on the timeline (ISO 8601)
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;
367 const char *zId;
368 int n;
369 const char *z;
370 char *zBody = (char*)P("w"); /* Text of the technote */
371 char *zETime = (char*)P("t"); /* Date this technote appears */
372 const char *zComment = P("c"); /* Timeline comment */
373 const char *zTags = P("g"); /* Tags added to this technote */
374 const char *zClrFlag = ""; /* "checked" for bg color */
375 const char *zClr; /* Name of the background color */
376 const char *zMimetype = P("mimetype"); /* Mimetype of zBody */
377 int isNew = 0;
378
379 if( zBody ){
380 zBody = mprintf("%s", zBody);
381 }
@@ -407,13 +418,14 @@
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 zClr = PD("clr",zClr);
425 if( zClr[0] ) zClrFlag = " checked";
426 }
427
428 /* If editing an existing event, extract the key fields to use as
429 ** a starting point for the edit.
430 */
431 if( rid
@@ -442,21 +454,22 @@
454 }
455 zETime = db_text(0, "SELECT coalesce(datetime(%Q),datetime('now'))", zETime);
456 if( P("submit")!=0 && (zBody!=0 && zComment!=0) ){
457 login_verify_csrf_secret();
458 if ( !event_commit_common(rid, zId, zBody, zETime,
459 zMimetype, zComment, zTags,
460 zClrFlag[0] ? zClr : 0) ){
461 style_header("Error");
462 @ Internal error: Fossil tried to make an invalid artifact for
463 @ the edited technote.
464 style_footer();
465 return;
466 }
467 cgi_redirectf("%R/technote?name=%T", zId);
468 }
469 if( P("cancel")!=0 ){
470 cgi_redirectf("%R/technote?name=%T", zId);
471 return;
472 }
473 if( zBody==0 ){
474 zBody = mprintf("Insert new content here...");
475 }
@@ -468,11 +481,11 @@
481 if( P("preview")!=0 ){
482 Blob com;
483 @ <p><b>Timeline comment preview:</b></p>
484 @ <blockquote>
485 @ <table border="0">
486 if( zClrFlag[0] && zClr && zClr[0] ){
487 @ <tr><td style="background-color: %h(zClr);">
488 }else{
489 @ <tr><td>
490 }
491 blob_zero(&com);
@@ -509,11 +522,13 @@
522 @ rows="3" wrap="virtual">%h(zComment)</textarea>
523 @ </td></tr>
524
525 @ <tr><th align="right" valign="top">Timeline Background Color:</th>
526 @ <td valign="top">
527 @ <input type='checkbox' name='newclr'%s(zClrFlag) />
528 @ Use custom color: \
529 @ <input type='color' name='clr' value='%s(zClr[0]?zClr:"#c0f0ff")'>
530 @ </td></tr>
531
532 @ <tr><th align="right" valign="top">Tags:</th>
533 @ <td valign="top">
534 @ <input type="text" name="g" size="40" value="%h(zTags)" />
@@ -529,13 +544,15 @@
544 @ <textarea name="w" class="technoteedit" cols="80"
545 @ rows="%d(n)" wrap="virtual">%h(zBody)</textarea>
546 @ </td></tr>
547
548 @ <tr><td colspan="2">
 
 
549 @ <input type="submit" name="cancel" value="Cancel" />
550 @ <input type="submit" name="preview" value="Preview" />
551 if( P("preview") ){
552 @ <input type="submit" name="submit" value="Submit" />
553 }
554 @ </td></tr></table>
555 @ </div></form>
556 style_footer();
557 }
558
559
+68 -154
--- src/info.c
+++ src/info.c
@@ -1236,11 +1236,11 @@
12361236
"SELECT filename.name, datetime(event.mtime,toLocal()),"
12371237
" coalesce(event.ecomment,event.comment),"
12381238
" coalesce(event.euser,event.user),"
12391239
" b.uuid, mlink.mperm,"
12401240
" coalesce((SELECT value FROM tagxref"
1241
- " WHERE tagid=%d AND tagtype>0 AND rid=mlink.mid),'trunk'),"
1241
+ " WHERE tagid=%d AND tagtype>0 AND rid=mlink.mid),'trunk'),"
12421242
" a.size"
12431243
" FROM mlink, filename, event, blob a, blob b"
12441244
" WHERE filename.fnid=mlink.fnid"
12451245
" AND event.objid=mlink.mid"
12461246
" AND a.rid=mlink.fid"
@@ -2177,11 +2177,12 @@
21772177
if( strcmp(zModAction,"approve")==0 ){
21782178
moderation_approve(rid);
21792179
}
21802180
}
21812181
zTktTitle = db_table_has_column("repository", "ticket", "title" )
2182
- ? db_text("(No title)", "SELECT title FROM ticket WHERE tkt_uuid=%Q", zTktName)
2182
+ ? db_text("(No title)",
2183
+ "SELECT title FROM ticket WHERE tkt_uuid=%Q", zTktName)
21832184
: 0;
21842185
style_header("Ticket Change Details");
21852186
style_submenu_element("Raw", "%R/artifact/%s", zUuid);
21862187
style_submenu_element("History", "%R/tkthistory/%s", zTktName);
21872188
style_submenu_element("Page", "%R/tktview/%t", zTktName);
@@ -2320,131 +2321,10 @@
23202321
{
23212322
artifact_page();
23222323
}
23232324
}
23242325
2325
-/*
2326
-** Generate HTML that will present the user with a selection of
2327
-** potential background colors for timeline entries.
2328
-*/
2329
-void render_color_chooser(
2330
- int fPropagate, /* Default value for propagation */
2331
- const char *zDefaultColor, /* The current default color */
2332
- const char *zIdPropagate, /* ID of form element checkbox. NULL for none */
2333
- const char *zId, /* The ID of the form element */
2334
- const char *zIdCustom /* ID of text box for custom color */
2335
-){
2336
- static const struct SampleColors {
2337
- const char *zCName;
2338
- const char *zColor;
2339
- } aColor[] = {
2340
- { "(none)", "" },
2341
- { "#f2dcdc", 0 },
2342
- { "#bde5d6", 0 },
2343
- { "#a0a0a0", 0 },
2344
- { "#b0b0b0", 0 },
2345
- { "#c0c0c0", 0 },
2346
- { "#d0d0d0", 0 },
2347
- { "#e0e0e0", 0 },
2348
-
2349
- { "#c0fff0", 0 },
2350
- { "#c0f0ff", 0 },
2351
- { "#d0c0ff", 0 },
2352
- { "#ffc0ff", 0 },
2353
- { "#ffc0d0", 0 },
2354
- { "#fff0c0", 0 },
2355
- { "#f0ffc0", 0 },
2356
- { "#c0ffc0", 0 },
2357
-
2358
- { "#a8d3c0", 0 },
2359
- { "#a8c7d3", 0 },
2360
- { "#aaa8d3", 0 },
2361
- { "#cba8d3", 0 },
2362
- { "#d3a8bc", 0 },
2363
- { "#d3b5a8", 0 },
2364
- { "#d1d3a8", 0 },
2365
- { "#b1d3a8", 0 },
2366
-
2367
- { "#8eb2a1", 0 },
2368
- { "#8ea7b2", 0 },
2369
- { "#8f8eb2", 0 },
2370
- { "#ab8eb2", 0 },
2371
- { "#b28e9e", 0 },
2372
- { "#b2988e", 0 },
2373
- { "#b0b28e", 0 },
2374
- { "#95b28e", 0 },
2375
-
2376
- { "#80d6b0", 0 },
2377
- { "#80bbd6", 0 },
2378
- { "#8680d6", 0 },
2379
- { "#c680d6", 0 },
2380
- { "#d680a6", 0 },
2381
- { "#d69b80", 0 },
2382
- { "#d1d680", 0 },
2383
- { "#91d680", 0 },
2384
-
2385
-
2386
- { "custom", "##" },
2387
- };
2388
- int nColor = count(aColor)-1;
2389
- int stdClrFound = 0;
2390
- int i;
2391
-
2392
- if( zIdPropagate ){
2393
- @ <div><label>
2394
- if( fPropagate ){
2395
- @ <input type="checkbox" name="%s(zIdPropagate)" checked="checked" />
2396
- }else{
2397
- @ <input type="checkbox" name="%s(zIdPropagate)" />
2398
- }
2399
- @ Propagate color to descendants</label></div>
2400
- }
2401
- @ <table border="0" cellpadding="0" cellspacing="1" class="colorpicker">
2402
- @ <tr>
2403
- for(i=0; i<nColor; i++){
2404
- const char *zClr = aColor[i].zColor;
2405
- if( zClr==0 ) zClr = aColor[i].zCName;
2406
- if( zClr[0] ){
2407
- @ <td style="background-color: %h(zClr);">
2408
- }else{
2409
- @ <td>
2410
- }
2411
- @ <label>
2412
- if( fossil_strcmp(zDefaultColor, zClr)==0 ){
2413
- @ <input type="radio" name="%s(zId)" value="%h(zClr)"
2414
- @ checked="checked" />
2415
- stdClrFound=1;
2416
- }else{
2417
- @ <input type="radio" name="%s(zId)" value="%h(zClr)" />
2418
- }
2419
- @ %h(aColor[i].zCName)</label></td>
2420
- if( (i%8)==7 && i+1<nColor ){
2421
- @ </tr><tr>
2422
- }
2423
- }
2424
- @ </tr><tr>
2425
- if( stdClrFound ){
2426
- @ <td colspan="6"><label>
2427
- @ <input type="radio" name="%s(zId)" value="%h(aColor[nColor].zColor)"
2428
- @ onclick="gebi('%s(zIdCustom)').select();" />
2429
- }else{
2430
- @ <td style="background-color: %h(zDefaultColor);" colspan="6"><label>
2431
- @ <input type="radio" name="%s(zId)" value="%h(aColor[nColor].zColor)"
2432
- @ checked="checked" onclick="gebi('%s(zIdCustom)').select();" />
2433
- }
2434
- @ %h(aColor[i].zCName)</label>&nbsp;
2435
- @ <input type="text" name="%s(zIdCustom)"
2436
- @ id="%s(zIdCustom)" class="checkinUserColor"
2437
- @ value="%h(stdClrFound?"":zDefaultColor)"
2438
- @ onfocus="this.form.elements['%s(zId)'][%d(nColor)].checked = true;"
2439
- @ onload="this.blur();"
2440
- @ onblur="this.parentElement.style.backgroundColor = this.value ? ('#'+this.value.replace('#','')) : '';" />
2441
- @ </td>
2442
- @ </tr>
2443
- @ </table>
2444
-}
2445
-
24462326
/*
24472327
** Do a comment comparison.
24482328
**
24492329
** + Leading and trailing whitespace are ignored.
24502330
** + \r\n characters compare equal to \n
@@ -2598,41 +2478,61 @@
25982478
return db_int(0, "SELECT datetime(%Q) NOT NULL", zDate);
25992479
}
26002480
26012481
/*
26022482
** WEBPAGE: ci_edit
2603
-** URL: /ci_edit?r=RID&c=NEWCOMMENT&u=NEWUSER
2604
-**
2605
-** Present a dialog for updating properties of a check-in.
2606
-**
2607
-** * The check-in user
2608
-** * The check-in comment
2609
-** * The check-in time and date
2610
-** * The background color.
2611
-** * Add and remove tags
2483
+**
2484
+** Edit a check-in. (Check-ins are immutable and do not really change.
2485
+** This page really creates supplemental tags that affect the display
2486
+** of the check-in.)
2487
+**
2488
+** Query parmeters:
2489
+**
2490
+** rid=INTEGER Record ID of the check-in to edit (REQUIRED)
2491
+**
2492
+** POST parameters after pressing "Perview", "Cancel", or "Apply":
2493
+**
2494
+** c=TEXT New check-in comment
2495
+** u=TEXT New user name
2496
+** newclr Apply a background color
2497
+** clr=TEXT New background color (only if newclr)
2498
+** pclr Propagate new background color (only if newclr)
2499
+** dt=TEXT New check-in date/time (ISO8610 format)
2500
+** newtag Add a new tag to the check-in
2501
+** tagname=TEXT Name of the new tag to be added (only if newtag)
2502
+** newbr Put the check-in on a new branch
2503
+** brname=TEXT Name of the new branch (only if newbr)
2504
+** close Close this check-in
2505
+** hide Hide this check-in
2506
+** cNNN Cancel tag with tagid=NNN
2507
+**
2508
+** cancel Cancel the edit. Return to the check-in view
2509
+** preview Show a preview of the edited check-in comment
2510
+** apply Apply changes
26122511
*/
26132512
void ci_edit_page(void){
26142513
int rid;
26152514
const char *zComment; /* Current comment on the check-in */
26162515
const char *zNewComment; /* Revised check-in comment */
26172516
const char *zUser; /* Current user for the check-in */
26182517
const char *zNewUser; /* Revised user */
26192518
const char *zDate; /* Current date of the check-in */
26202519
const char *zNewDate; /* Revised check-in date */
2621
- const char *zColor;
2622
- const char *zNewColor;
2623
- const char *zNewTagFlag;
2624
- const char *zNewTag;
2625
- const char *zNewBrFlag;
2626
- const char *zNewBranch;
2627
- const char *zCloseFlag;
2628
- const char *zHideFlag;
2520
+ const char *zNewColorFlag; /* "checked" if "Change color" is checked */
2521
+ const char *zColor; /* Current background color */
2522
+ const char *zNewColor; /* Revised background color */
2523
+ const char *zNewTagFlag; /* "checked" if "Add tag" is checked */
2524
+ const char *zNewTag; /* Name of the new tag */
2525
+ const char *zNewBrFlag; /* "checked" if "New branch" is checked */
2526
+ const char *zNewBranch; /* Name of the new branch */
2527
+ const char *zCloseFlag; /* "checked" if "Close" is checked */
2528
+ const char *zHideFlag; /* "checked" if "Hide" is checked */
26292529
int fPropagateColor; /* True if color propagates before edit */
26302530
int fNewPropagateColor; /* True if color propagates after edit */
26312531
int fHasHidden = 0; /* True if hidden tag already set */
26322532
int fHasClosed = 0; /* True if closed tag already set */
2633
- const char *zChngTime = 0; /* Value of chngtime= query param, if any */
2533
+ const char *zChngTime = 0; /* Value of chngtime= query param, if any */
26342534
char *zUuid;
26352535
Blob comment;
26362536
char *zBranchName = 0;
26372537
Stmt q;
26382538
@@ -2642,11 +2542,11 @@
26422542
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
26432543
zComment = db_text(0, "SELECT coalesce(ecomment,comment)"
26442544
" FROM event WHERE objid=%d", rid);
26452545
if( zComment==0 ) fossil_redirect_home();
26462546
if( P("cancel") ){
2647
- cgi_redirectf("ci?name=%s", zUuid);
2547
+ cgi_redirectf("%R/ci/%S", zUuid);
26482548
}
26492549
if( g.perm.Setup ) zChngTime = P("chngtime");
26502550
zNewComment = PD("c",zComment);
26512551
zUser = db_text(0, "SELECT coalesce(euser,user)"
26522552
" FROM event WHERE objid=%d", rid);
@@ -2657,17 +2557,15 @@
26572557
if( zDate==0 ) fossil_redirect_home();
26582558
zNewDate = PDT("dt",zDate);
26592559
zColor = db_text("", "SELECT bgcolor"
26602560
" FROM event WHERE objid=%d", rid);
26612561
zNewColor = PDT("clr",zColor);
2662
- if( fossil_strcmp(zNewColor,"##")==0 ){
2663
- zNewColor = PT("clrcust");
2664
- }
26652562
fPropagateColor = db_int(0, "SELECT tagtype FROM tagxref"
26662563
" WHERE rid=%d AND tagid=%d",
26672564
rid, TAG_BGCOLOR)==2;
26682565
fNewPropagateColor = P("clr")!=0 ? P("pclr")!=0 : fPropagateColor;
2566
+ zNewColorFlag = P("newclr") ? " checked" : "";
26692567
zNewTagFlag = P("newtag") ? " checked" : "";
26702568
zNewTag = PDT("tagname","");
26712569
zNewBrFlag = P("newbr") ? " checked" : "";
26722570
zNewBranch = PDT("brname","");
26732571
zCloseFlag = P("close") ? " checked" : "";
@@ -2679,15 +2577,17 @@
26792577
login_verify_csrf_secret();
26802578
blob_zero(&ctrl);
26812579
zNow = date_in_standard_format(zChngTime ? zChngTime : "now");
26822580
blob_appendf(&ctrl, "D %s\n", zNow);
26832581
init_newtags();
2684
- if( zNewColor[0]
2582
+ if( zNewColorFlag[0]
2583
+ && zNewColor[0]
26852584
&& (fPropagateColor!=fNewPropagateColor
26862585
|| fossil_strcmp(zColor,zNewColor)!=0)
2687
- ) add_color(zNewColor,fNewPropagateColor);
2688
- if( zNewColor[0]==0 && zColor[0]!=0 ) cancel_color();
2586
+ ){
2587
+ add_color(zNewColor,fNewPropagateColor);
2588
+ }
26892589
if( comment_compare(zComment,zNewComment)==0 ) add_comment(zNewComment);
26902590
if( fossil_strcmp(zDate,zNewDate)!=0 ) add_date(zNewDate);
26912591
if( fossil_strcmp(zUser,zNewUser)!=0 ) add_user(zNewUser);
26922592
db_prepare(&q,
26932593
"SELECT tag.tagid, tagname FROM tagxref, tag"
@@ -2705,11 +2605,11 @@
27052605
if( zHideFlag[0] ) hide_branch();
27062606
if( zCloseFlag[0] ) close_leaf(rid);
27072607
if( zNewTagFlag[0] && zNewTag[0] ) add_tag(zNewTag);
27082608
if( zNewBrFlag[0] && zNewBranch[0] ) change_branch(rid,zNewBranch);
27092609
apply_newtags(&ctrl, rid, zUuid);
2710
- cgi_redirectf("ci?name=%s", zUuid);
2610
+ cgi_redirectf("%R/ci/%S", zUuid);
27112611
}
27122612
blob_zero(&comment);
27132613
blob_append(&comment, zNewComment, -1);
27142614
zUuid[10] = 0;
27152615
style_header("Edit Check-in [%s]", zUuid);
@@ -2738,12 +2638,14 @@
27382638
Blob suffix;
27392639
int nTag = 0;
27402640
@ <b>Preview:</b>
27412641
@ <blockquote>
27422642
@ <table border=0>
2743
- if( zNewColor && zNewColor[0] ){
2643
+ if( zNewColorFlag[0] && zNewColor && zNewColor[0] ){
27442644
@ <tr><td style="background-color: %h(zNewColor);">
2645
+ }else if( zColor[0] ){
2646
+ @ <tr><td style="background-color: %h(zColor);">
27452647
}else{
27462648
@ <tr><td>
27472649
}
27482650
@ %!W(blob_str(&comment))
27492651
blob_zero(&suffix);
@@ -2800,13 +2702,23 @@
28002702
@ <td valign="top">
28012703
@ <input type="text" name="chngtime" size="20" value="%h(zChngTime)" />
28022704
@ </td></tr>
28032705
}
28042706
2805
- @ <tr><th align="right" valign="top">Background Color:</th>
2707
+ @ <tr><th align="right" valign="top">Background&nbsp;Color:</th>
28062708
@ <td valign="top">
2807
- render_color_chooser(fNewPropagateColor, zNewColor, "pclr", "clr", "clrcust");
2709
+ @ <div><label><input type='checkbox' name='newclr'%s(zNewColorFlag) />
2710
+ @ Change background color: \
2711
+ @ <input type='color' name='clr'\
2712
+ @ value='%s(zNewColor[0]?zNewColor:"#808080")'></label></div>
2713
+ @ <div><label>
2714
+ if( fNewPropagateColor ){
2715
+ @ <input type="checkbox" name="pclr" checked="checked" />
2716
+ }else{
2717
+ @ <input type="checkbox" name="pclr" />
2718
+ }
2719
+ @ Propagate color to descendants</label></div>
28082720
@ </td></tr>
28092721
28102722
@ <tr><th align="right" valign="top">Tags:</th>
28112723
@ <td valign="top">
28122724
@ <label><input type="checkbox" id="newtag" name="newtag"%s(zNewTagFlag) />
@@ -2898,13 +2810,15 @@
28982810
}
28992811
if( zBranchName ) fossil_free(zBranchName);
29002812
29012813
29022814
@ <tr><td colspan="2">
2815
+ @ <input type="submit" name="cancel" value="Cancel" />
29032816
@ <input type="submit" name="preview" value="Preview" />
2904
- @ <input type="submit" name="apply" value="Apply Changes" />
2905
- @ <input type="submit" name="cancel" value="Cancel" />
2817
+ if( P("preview") ){
2818
+ @ <input type="submit" name="apply" value="Apply Changes" />
2819
+ }
29062820
@ </td></tr>
29072821
@ </table>
29082822
@ </div></form>
29092823
style_footer();
29102824
}
29112825
--- src/info.c
+++ src/info.c
@@ -1236,11 +1236,11 @@
1236 "SELECT filename.name, datetime(event.mtime,toLocal()),"
1237 " coalesce(event.ecomment,event.comment),"
1238 " coalesce(event.euser,event.user),"
1239 " b.uuid, mlink.mperm,"
1240 " coalesce((SELECT value FROM tagxref"
1241 " WHERE tagid=%d AND tagtype>0 AND rid=mlink.mid),'trunk'),"
1242 " a.size"
1243 " FROM mlink, filename, event, blob a, blob b"
1244 " WHERE filename.fnid=mlink.fnid"
1245 " AND event.objid=mlink.mid"
1246 " AND a.rid=mlink.fid"
@@ -2177,11 +2177,12 @@
2177 if( strcmp(zModAction,"approve")==0 ){
2178 moderation_approve(rid);
2179 }
2180 }
2181 zTktTitle = db_table_has_column("repository", "ticket", "title" )
2182 ? db_text("(No title)", "SELECT title FROM ticket WHERE tkt_uuid=%Q", zTktName)
 
2183 : 0;
2184 style_header("Ticket Change Details");
2185 style_submenu_element("Raw", "%R/artifact/%s", zUuid);
2186 style_submenu_element("History", "%R/tkthistory/%s", zTktName);
2187 style_submenu_element("Page", "%R/tktview/%t", zTktName);
@@ -2320,131 +2321,10 @@
2320 {
2321 artifact_page();
2322 }
2323 }
2324
2325 /*
2326 ** Generate HTML that will present the user with a selection of
2327 ** potential background colors for timeline entries.
2328 */
2329 void render_color_chooser(
2330 int fPropagate, /* Default value for propagation */
2331 const char *zDefaultColor, /* The current default color */
2332 const char *zIdPropagate, /* ID of form element checkbox. NULL for none */
2333 const char *zId, /* The ID of the form element */
2334 const char *zIdCustom /* ID of text box for custom color */
2335 ){
2336 static const struct SampleColors {
2337 const char *zCName;
2338 const char *zColor;
2339 } aColor[] = {
2340 { "(none)", "" },
2341 { "#f2dcdc", 0 },
2342 { "#bde5d6", 0 },
2343 { "#a0a0a0", 0 },
2344 { "#b0b0b0", 0 },
2345 { "#c0c0c0", 0 },
2346 { "#d0d0d0", 0 },
2347 { "#e0e0e0", 0 },
2348
2349 { "#c0fff0", 0 },
2350 { "#c0f0ff", 0 },
2351 { "#d0c0ff", 0 },
2352 { "#ffc0ff", 0 },
2353 { "#ffc0d0", 0 },
2354 { "#fff0c0", 0 },
2355 { "#f0ffc0", 0 },
2356 { "#c0ffc0", 0 },
2357
2358 { "#a8d3c0", 0 },
2359 { "#a8c7d3", 0 },
2360 { "#aaa8d3", 0 },
2361 { "#cba8d3", 0 },
2362 { "#d3a8bc", 0 },
2363 { "#d3b5a8", 0 },
2364 { "#d1d3a8", 0 },
2365 { "#b1d3a8", 0 },
2366
2367 { "#8eb2a1", 0 },
2368 { "#8ea7b2", 0 },
2369 { "#8f8eb2", 0 },
2370 { "#ab8eb2", 0 },
2371 { "#b28e9e", 0 },
2372 { "#b2988e", 0 },
2373 { "#b0b28e", 0 },
2374 { "#95b28e", 0 },
2375
2376 { "#80d6b0", 0 },
2377 { "#80bbd6", 0 },
2378 { "#8680d6", 0 },
2379 { "#c680d6", 0 },
2380 { "#d680a6", 0 },
2381 { "#d69b80", 0 },
2382 { "#d1d680", 0 },
2383 { "#91d680", 0 },
2384
2385
2386 { "custom", "##" },
2387 };
2388 int nColor = count(aColor)-1;
2389 int stdClrFound = 0;
2390 int i;
2391
2392 if( zIdPropagate ){
2393 @ <div><label>
2394 if( fPropagate ){
2395 @ <input type="checkbox" name="%s(zIdPropagate)" checked="checked" />
2396 }else{
2397 @ <input type="checkbox" name="%s(zIdPropagate)" />
2398 }
2399 @ Propagate color to descendants</label></div>
2400 }
2401 @ <table border="0" cellpadding="0" cellspacing="1" class="colorpicker">
2402 @ <tr>
2403 for(i=0; i<nColor; i++){
2404 const char *zClr = aColor[i].zColor;
2405 if( zClr==0 ) zClr = aColor[i].zCName;
2406 if( zClr[0] ){
2407 @ <td style="background-color: %h(zClr);">
2408 }else{
2409 @ <td>
2410 }
2411 @ <label>
2412 if( fossil_strcmp(zDefaultColor, zClr)==0 ){
2413 @ <input type="radio" name="%s(zId)" value="%h(zClr)"
2414 @ checked="checked" />
2415 stdClrFound=1;
2416 }else{
2417 @ <input type="radio" name="%s(zId)" value="%h(zClr)" />
2418 }
2419 @ %h(aColor[i].zCName)</label></td>
2420 if( (i%8)==7 && i+1<nColor ){
2421 @ </tr><tr>
2422 }
2423 }
2424 @ </tr><tr>
2425 if( stdClrFound ){
2426 @ <td colspan="6"><label>
2427 @ <input type="radio" name="%s(zId)" value="%h(aColor[nColor].zColor)"
2428 @ onclick="gebi('%s(zIdCustom)').select();" />
2429 }else{
2430 @ <td style="background-color: %h(zDefaultColor);" colspan="6"><label>
2431 @ <input type="radio" name="%s(zId)" value="%h(aColor[nColor].zColor)"
2432 @ checked="checked" onclick="gebi('%s(zIdCustom)').select();" />
2433 }
2434 @ %h(aColor[i].zCName)</label>&nbsp;
2435 @ <input type="text" name="%s(zIdCustom)"
2436 @ id="%s(zIdCustom)" class="checkinUserColor"
2437 @ value="%h(stdClrFound?"":zDefaultColor)"
2438 @ onfocus="this.form.elements['%s(zId)'][%d(nColor)].checked = true;"
2439 @ onload="this.blur();"
2440 @ onblur="this.parentElement.style.backgroundColor = this.value ? ('#'+this.value.replace('#','')) : '';" />
2441 @ </td>
2442 @ </tr>
2443 @ </table>
2444 }
2445
2446 /*
2447 ** Do a comment comparison.
2448 **
2449 ** + Leading and trailing whitespace are ignored.
2450 ** + \r\n characters compare equal to \n
@@ -2598,41 +2478,61 @@
2598 return db_int(0, "SELECT datetime(%Q) NOT NULL", zDate);
2599 }
2600
2601 /*
2602 ** WEBPAGE: ci_edit
2603 ** URL: /ci_edit?r=RID&c=NEWCOMMENT&u=NEWUSER
2604 **
2605 ** Present a dialog for updating properties of a check-in.
2606 **
2607 ** * The check-in user
2608 ** * The check-in comment
2609 ** * The check-in time and date
2610 ** * The background color.
2611 ** * Add and remove tags
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2612 */
2613 void ci_edit_page(void){
2614 int rid;
2615 const char *zComment; /* Current comment on the check-in */
2616 const char *zNewComment; /* Revised check-in comment */
2617 const char *zUser; /* Current user for the check-in */
2618 const char *zNewUser; /* Revised user */
2619 const char *zDate; /* Current date of the check-in */
2620 const char *zNewDate; /* Revised check-in date */
2621 const char *zColor;
2622 const char *zNewColor;
2623 const char *zNewTagFlag;
2624 const char *zNewTag;
2625 const char *zNewBrFlag;
2626 const char *zNewBranch;
2627 const char *zCloseFlag;
2628 const char *zHideFlag;
 
2629 int fPropagateColor; /* True if color propagates before edit */
2630 int fNewPropagateColor; /* True if color propagates after edit */
2631 int fHasHidden = 0; /* True if hidden tag already set */
2632 int fHasClosed = 0; /* True if closed tag already set */
2633 const char *zChngTime = 0; /* Value of chngtime= query param, if any */
2634 char *zUuid;
2635 Blob comment;
2636 char *zBranchName = 0;
2637 Stmt q;
2638
@@ -2642,11 +2542,11 @@
2642 zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
2643 zComment = db_text(0, "SELECT coalesce(ecomment,comment)"
2644 " FROM event WHERE objid=%d", rid);
2645 if( zComment==0 ) fossil_redirect_home();
2646 if( P("cancel") ){
2647 cgi_redirectf("ci?name=%s", zUuid);
2648 }
2649 if( g.perm.Setup ) zChngTime = P("chngtime");
2650 zNewComment = PD("c",zComment);
2651 zUser = db_text(0, "SELECT coalesce(euser,user)"
2652 " FROM event WHERE objid=%d", rid);
@@ -2657,17 +2557,15 @@
2657 if( zDate==0 ) fossil_redirect_home();
2658 zNewDate = PDT("dt",zDate);
2659 zColor = db_text("", "SELECT bgcolor"
2660 " FROM event WHERE objid=%d", rid);
2661 zNewColor = PDT("clr",zColor);
2662 if( fossil_strcmp(zNewColor,"##")==0 ){
2663 zNewColor = PT("clrcust");
2664 }
2665 fPropagateColor = db_int(0, "SELECT tagtype FROM tagxref"
2666 " WHERE rid=%d AND tagid=%d",
2667 rid, TAG_BGCOLOR)==2;
2668 fNewPropagateColor = P("clr")!=0 ? P("pclr")!=0 : fPropagateColor;
 
2669 zNewTagFlag = P("newtag") ? " checked" : "";
2670 zNewTag = PDT("tagname","");
2671 zNewBrFlag = P("newbr") ? " checked" : "";
2672 zNewBranch = PDT("brname","");
2673 zCloseFlag = P("close") ? " checked" : "";
@@ -2679,15 +2577,17 @@
2679 login_verify_csrf_secret();
2680 blob_zero(&ctrl);
2681 zNow = date_in_standard_format(zChngTime ? zChngTime : "now");
2682 blob_appendf(&ctrl, "D %s\n", zNow);
2683 init_newtags();
2684 if( zNewColor[0]
 
2685 && (fPropagateColor!=fNewPropagateColor
2686 || fossil_strcmp(zColor,zNewColor)!=0)
2687 ) add_color(zNewColor,fNewPropagateColor);
2688 if( zNewColor[0]==0 && zColor[0]!=0 ) cancel_color();
 
2689 if( comment_compare(zComment,zNewComment)==0 ) add_comment(zNewComment);
2690 if( fossil_strcmp(zDate,zNewDate)!=0 ) add_date(zNewDate);
2691 if( fossil_strcmp(zUser,zNewUser)!=0 ) add_user(zNewUser);
2692 db_prepare(&q,
2693 "SELECT tag.tagid, tagname FROM tagxref, tag"
@@ -2705,11 +2605,11 @@
2705 if( zHideFlag[0] ) hide_branch();
2706 if( zCloseFlag[0] ) close_leaf(rid);
2707 if( zNewTagFlag[0] && zNewTag[0] ) add_tag(zNewTag);
2708 if( zNewBrFlag[0] && zNewBranch[0] ) change_branch(rid,zNewBranch);
2709 apply_newtags(&ctrl, rid, zUuid);
2710 cgi_redirectf("ci?name=%s", zUuid);
2711 }
2712 blob_zero(&comment);
2713 blob_append(&comment, zNewComment, -1);
2714 zUuid[10] = 0;
2715 style_header("Edit Check-in [%s]", zUuid);
@@ -2738,12 +2638,14 @@
2738 Blob suffix;
2739 int nTag = 0;
2740 @ <b>Preview:</b>
2741 @ <blockquote>
2742 @ <table border=0>
2743 if( zNewColor && zNewColor[0] ){
2744 @ <tr><td style="background-color: %h(zNewColor);">
 
 
2745 }else{
2746 @ <tr><td>
2747 }
2748 @ %!W(blob_str(&comment))
2749 blob_zero(&suffix);
@@ -2800,13 +2702,23 @@
2800 @ <td valign="top">
2801 @ <input type="text" name="chngtime" size="20" value="%h(zChngTime)" />
2802 @ </td></tr>
2803 }
2804
2805 @ <tr><th align="right" valign="top">Background Color:</th>
2806 @ <td valign="top">
2807 render_color_chooser(fNewPropagateColor, zNewColor, "pclr", "clr", "clrcust");
 
 
 
 
 
 
 
 
 
 
2808 @ </td></tr>
2809
2810 @ <tr><th align="right" valign="top">Tags:</th>
2811 @ <td valign="top">
2812 @ <label><input type="checkbox" id="newtag" name="newtag"%s(zNewTagFlag) />
@@ -2898,13 +2810,15 @@
2898 }
2899 if( zBranchName ) fossil_free(zBranchName);
2900
2901
2902 @ <tr><td colspan="2">
 
2903 @ <input type="submit" name="preview" value="Preview" />
2904 @ <input type="submit" name="apply" value="Apply Changes" />
2905 @ <input type="submit" name="cancel" value="Cancel" />
 
2906 @ </td></tr>
2907 @ </table>
2908 @ </div></form>
2909 style_footer();
2910 }
2911
--- src/info.c
+++ src/info.c
@@ -1236,11 +1236,11 @@
1236 "SELECT filename.name, datetime(event.mtime,toLocal()),"
1237 " coalesce(event.ecomment,event.comment),"
1238 " coalesce(event.euser,event.user),"
1239 " b.uuid, mlink.mperm,"
1240 " coalesce((SELECT value FROM tagxref"
1241 " WHERE tagid=%d AND tagtype>0 AND rid=mlink.mid),'trunk'),"
1242 " a.size"
1243 " FROM mlink, filename, event, blob a, blob b"
1244 " WHERE filename.fnid=mlink.fnid"
1245 " AND event.objid=mlink.mid"
1246 " AND a.rid=mlink.fid"
@@ -2177,11 +2177,12 @@
2177 if( strcmp(zModAction,"approve")==0 ){
2178 moderation_approve(rid);
2179 }
2180 }
2181 zTktTitle = db_table_has_column("repository", "ticket", "title" )
2182 ? db_text("(No title)",
2183 "SELECT title FROM ticket WHERE tkt_uuid=%Q", zTktName)
2184 : 0;
2185 style_header("Ticket Change Details");
2186 style_submenu_element("Raw", "%R/artifact/%s", zUuid);
2187 style_submenu_element("History", "%R/tkthistory/%s", zTktName);
2188 style_submenu_element("Page", "%R/tktview/%t", zTktName);
@@ -2320,131 +2321,10 @@
2321 {
2322 artifact_page();
2323 }
2324 }
2325
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2326 /*
2327 ** Do a comment comparison.
2328 **
2329 ** + Leading and trailing whitespace are ignored.
2330 ** + \r\n characters compare equal to \n
@@ -2598,41 +2478,61 @@
2478 return db_int(0, "SELECT datetime(%Q) NOT NULL", zDate);
2479 }
2480
2481 /*
2482 ** WEBPAGE: ci_edit
2483 **
2484 ** Edit a check-in. (Check-ins are immutable and do not really change.
2485 ** This page really creates supplemental tags that affect the display
2486 ** of the check-in.)
2487 **
2488 ** Query parmeters:
2489 **
2490 ** rid=INTEGER Record ID of the check-in to edit (REQUIRED)
2491 **
2492 ** POST parameters after pressing "Perview", "Cancel", or "Apply":
2493 **
2494 ** c=TEXT New check-in comment
2495 ** u=TEXT New user name
2496 ** newclr Apply a background color
2497 ** clr=TEXT New background color (only if newclr)
2498 ** pclr Propagate new background color (only if newclr)
2499 ** dt=TEXT New check-in date/time (ISO8610 format)
2500 ** newtag Add a new tag to the check-in
2501 ** tagname=TEXT Name of the new tag to be added (only if newtag)
2502 ** newbr Put the check-in on a new branch
2503 ** brname=TEXT Name of the new branch (only if newbr)
2504 ** close Close this check-in
2505 ** hide Hide this check-in
2506 ** cNNN Cancel tag with tagid=NNN
2507 **
2508 ** cancel Cancel the edit. Return to the check-in view
2509 ** preview Show a preview of the edited check-in comment
2510 ** apply Apply changes
2511 */
2512 void ci_edit_page(void){
2513 int rid;
2514 const char *zComment; /* Current comment on the check-in */
2515 const char *zNewComment; /* Revised check-in comment */
2516 const char *zUser; /* Current user for the check-in */
2517 const char *zNewUser; /* Revised user */
2518 const char *zDate; /* Current date of the check-in */
2519 const char *zNewDate; /* Revised check-in date */
2520 const char *zNewColorFlag; /* "checked" if "Change color" is checked */
2521 const char *zColor; /* Current background color */
2522 const char *zNewColor; /* Revised background color */
2523 const char *zNewTagFlag; /* "checked" if "Add tag" is checked */
2524 const char *zNewTag; /* Name of the new tag */
2525 const char *zNewBrFlag; /* "checked" if "New branch" is checked */
2526 const char *zNewBranch; /* Name of the new branch */
2527 const char *zCloseFlag; /* "checked" if "Close" is checked */
2528 const char *zHideFlag; /* "checked" if "Hide" is checked */
2529 int fPropagateColor; /* True if color propagates before edit */
2530 int fNewPropagateColor; /* True if color propagates after edit */
2531 int fHasHidden = 0; /* True if hidden tag already set */
2532 int fHasClosed = 0; /* True if closed tag already set */
2533 const char *zChngTime = 0; /* Value of chngtime= query param, if any */
2534 char *zUuid;
2535 Blob comment;
2536 char *zBranchName = 0;
2537 Stmt q;
2538
@@ -2642,11 +2542,11 @@
2542 zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
2543 zComment = db_text(0, "SELECT coalesce(ecomment,comment)"
2544 " FROM event WHERE objid=%d", rid);
2545 if( zComment==0 ) fossil_redirect_home();
2546 if( P("cancel") ){
2547 cgi_redirectf("%R/ci/%S", zUuid);
2548 }
2549 if( g.perm.Setup ) zChngTime = P("chngtime");
2550 zNewComment = PD("c",zComment);
2551 zUser = db_text(0, "SELECT coalesce(euser,user)"
2552 " FROM event WHERE objid=%d", rid);
@@ -2657,17 +2557,15 @@
2557 if( zDate==0 ) fossil_redirect_home();
2558 zNewDate = PDT("dt",zDate);
2559 zColor = db_text("", "SELECT bgcolor"
2560 " FROM event WHERE objid=%d", rid);
2561 zNewColor = PDT("clr",zColor);
 
 
 
2562 fPropagateColor = db_int(0, "SELECT tagtype FROM tagxref"
2563 " WHERE rid=%d AND tagid=%d",
2564 rid, TAG_BGCOLOR)==2;
2565 fNewPropagateColor = P("clr")!=0 ? P("pclr")!=0 : fPropagateColor;
2566 zNewColorFlag = P("newclr") ? " checked" : "";
2567 zNewTagFlag = P("newtag") ? " checked" : "";
2568 zNewTag = PDT("tagname","");
2569 zNewBrFlag = P("newbr") ? " checked" : "";
2570 zNewBranch = PDT("brname","");
2571 zCloseFlag = P("close") ? " checked" : "";
@@ -2679,15 +2577,17 @@
2577 login_verify_csrf_secret();
2578 blob_zero(&ctrl);
2579 zNow = date_in_standard_format(zChngTime ? zChngTime : "now");
2580 blob_appendf(&ctrl, "D %s\n", zNow);
2581 init_newtags();
2582 if( zNewColorFlag[0]
2583 && zNewColor[0]
2584 && (fPropagateColor!=fNewPropagateColor
2585 || fossil_strcmp(zColor,zNewColor)!=0)
2586 ){
2587 add_color(zNewColor,fNewPropagateColor);
2588 }
2589 if( comment_compare(zComment,zNewComment)==0 ) add_comment(zNewComment);
2590 if( fossil_strcmp(zDate,zNewDate)!=0 ) add_date(zNewDate);
2591 if( fossil_strcmp(zUser,zNewUser)!=0 ) add_user(zNewUser);
2592 db_prepare(&q,
2593 "SELECT tag.tagid, tagname FROM tagxref, tag"
@@ -2705,11 +2605,11 @@
2605 if( zHideFlag[0] ) hide_branch();
2606 if( zCloseFlag[0] ) close_leaf(rid);
2607 if( zNewTagFlag[0] && zNewTag[0] ) add_tag(zNewTag);
2608 if( zNewBrFlag[0] && zNewBranch[0] ) change_branch(rid,zNewBranch);
2609 apply_newtags(&ctrl, rid, zUuid);
2610 cgi_redirectf("%R/ci/%S", zUuid);
2611 }
2612 blob_zero(&comment);
2613 blob_append(&comment, zNewComment, -1);
2614 zUuid[10] = 0;
2615 style_header("Edit Check-in [%s]", zUuid);
@@ -2738,12 +2638,14 @@
2638 Blob suffix;
2639 int nTag = 0;
2640 @ <b>Preview:</b>
2641 @ <blockquote>
2642 @ <table border=0>
2643 if( zNewColorFlag[0] && zNewColor && zNewColor[0] ){
2644 @ <tr><td style="background-color: %h(zNewColor);">
2645 }else if( zColor[0] ){
2646 @ <tr><td style="background-color: %h(zColor);">
2647 }else{
2648 @ <tr><td>
2649 }
2650 @ %!W(blob_str(&comment))
2651 blob_zero(&suffix);
@@ -2800,13 +2702,23 @@
2702 @ <td valign="top">
2703 @ <input type="text" name="chngtime" size="20" value="%h(zChngTime)" />
2704 @ </td></tr>
2705 }
2706
2707 @ <tr><th align="right" valign="top">Background&nbsp;Color:</th>
2708 @ <td valign="top">
2709 @ <div><label><input type='checkbox' name='newclr'%s(zNewColorFlag) />
2710 @ Change background color: \
2711 @ <input type='color' name='clr'\
2712 @ value='%s(zNewColor[0]?zNewColor:"#808080")'></label></div>
2713 @ <div><label>
2714 if( fNewPropagateColor ){
2715 @ <input type="checkbox" name="pclr" checked="checked" />
2716 }else{
2717 @ <input type="checkbox" name="pclr" />
2718 }
2719 @ Propagate color to descendants</label></div>
2720 @ </td></tr>
2721
2722 @ <tr><th align="right" valign="top">Tags:</th>
2723 @ <td valign="top">
2724 @ <label><input type="checkbox" id="newtag" name="newtag"%s(zNewTagFlag) />
@@ -2898,13 +2810,15 @@
2810 }
2811 if( zBranchName ) fossil_free(zBranchName);
2812
2813
2814 @ <tr><td colspan="2">
2815 @ <input type="submit" name="cancel" value="Cancel" />
2816 @ <input type="submit" name="preview" value="Preview" />
2817 if( P("preview") ){
2818 @ <input type="submit" name="apply" value="Apply Changes" />
2819 }
2820 @ </td></tr>
2821 @ </table>
2822 @ </div></form>
2823 style_footer();
2824 }
2825

Keyboard Shortcuts

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