Fossil with Commonmark

Artifact [28f5412254]
Login

Artifact 28f5412254cae1133d0b515c9f1dcbe7907e7cb4:

Attachment "ci_edit-propagate.patch" to ticket [fcadf658ed] added by anonymous 2010-12-17 19:18:45.
Index: src/info.c
===================================================================
--- src/info.c
+++ src/info.c
@@ -1381,10 +1381,11 @@
 **     *  The check-in comment
 **     *  The background color.
 */
 void ci_edit_page(void){
   int rid;
+  int tagidBgColor;
   const char *zComment;         /* Current comment on the check-in */
   const char *zNewComment;      /* Revised check-in comment */
   const char *zUser;            /* Current user for the check-in */
   const char *zNewUser;         /* Revised user */
   const char *zDate;            /* Current date of the check-in */
@@ -1395,10 +1396,11 @@
   const char *zNewTag;
   const char *zNewBrFlag;
   const char *zNewBranch;
   const char *zCloseFlag;
   int fPropagateColor;
+  int fNewPropagateColor;
   char *zUuid;
   Blob comment;
   Stmt q;
   
   login_check_credentials();
@@ -1424,11 +1426,21 @@
                         "  FROM event WHERE objid=%d", rid);
   zNewColor = PD("clr",zColor);
   if( strcmp(zNewColor,"##")==0 ){
     zNewColor = P("clrcust");
   }
-  fPropagateColor = P("pclr")!=0;
+  tagidBgColor = tag_findid("bgcolor", 0);
+
+  fPropagateColor = 0;
+  if( tagidBgColor ){
+    fPropagateColor = db_int(0, "SELECT tagtype FROM tagxref WHERE rid=%d AND tagid=%d",
+                             rid, tagidBgColor) == 2; /* 2 = propagate */
+  }
+  fNewPropagateColor = P("pclr")!=0;
+
+  zColor = db_text("", "SELECT bgcolor"
+                        "  FROM event WHERE objid=%d", rid);
   zNewTagFlag = P("newtag") ? " checked" : "";
   zNewTag = PD("tagname","");
   zNewBrFlag = P("newbr") ? " checked" : "";
   zNewBranch = PD("brname","");
   zCloseFlag = P("close") ? " checked" : "";
@@ -1441,17 +1453,19 @@
     blob_zero(&ctrl);
     zDate = db_text(0, "SELECT datetime('now')");
     zDate[10] = 'T';
     blob_appendf(&ctrl, "D %s\n", zDate);
     db_multi_exec("CREATE TEMP TABLE newtags(tag UNIQUE, prefix, value)");
-    if( zNewColor[0] && strcmp(zColor,zNewColor)!=0 ){
+    if( zNewColor[0] && (strcmp(zColor,zNewColor)!=0 ||
+                         fPropagateColor!=fNewPropagateColor) ){
       char *zPrefix = "+";
-      if( fPropagateColor ){
+      if( fNewPropagateColor ){
         zPrefix = "*";
       }
       db_multi_exec("REPLACE INTO newtags VALUES('bgcolor',%Q,%Q)",
                     zPrefix, zNewColor);
+      fPropagateColor = fNewPropagateColor;
     }
     if( zNewColor[0]==0 && zColor[0]!=0 ){
       db_multi_exec("REPLACE INTO newtags VALUES('bgcolor','-',NULL)");
     }
     if( strcmp(zComment,zNewComment)!=0 ){