Fossil

Check-in [c8f121c7]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Further adjustments to the timeline control format.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | timelineMods
Files: files | file ages | folders
SHA1:c8f121c7c8f27c656bfb0d1e69d60fb0103ce507
User & Date: drh 2015-02-06 21:38:22
Context
2015-02-06
21:39
Reorder and revise the /timeline submenu controls for a more natural presentation. check-in: f76cfaca user: drh tags: trunk
21:38
Further adjustments to the timeline control format. Closed-Leaf check-in: c8f121c7 user: drh tags: timelineMods
19:35
Minor revisions to the timeline controls to permit for easier reading. check-in: 7d20d72a user: mistachkin tags: timelineMods
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/style.c.

43
44
45
46
47
48
49
50

51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
...
244
245
246
247
248
249
250
251

252
253
254
255
256

257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273

274
275
276
277
278

279
280
281
282
283
284
285

286
287
288
289
290

291
292
293
294
295
296
297
...
497
498
499
500
501
502
503



504

505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527

528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
...
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
  const char *zTitle;
  const char *zLink;         /* Jump to this link when button is pressed */
} aSubmenu[30];
static int nSubmenu = 0;     /* Number of buttons */
static struct SubmenuCtrl {
  const char *zName;         /* Form query parameter */
  const char *zLabel;        /* Label.  Might be NULL for FF_MULTI */
  int eType;                 /* FF_ENTRY, FF_CKBOX, FF_MULTI */

  int iSize;                 /* Width for FF_ENTRY.  Count for FF_MULTI */
  const char **azChoice;     /* value/display pairs for FF_MULTI */
  const char *zFalse;        /* FF_BINARY label when false */
} aSubmenuCtrl[20];
static int nSubmenuCtrl = 0;
#define FF_ENTRY  1
#define FF_CKBOX  2
#define FF_MULTI  3
#define FF_BINARY 4

/*
** Remember that the header has been generated.  The footer is omitted
** if an error occurs before the header.
*/
static int headerHasBeenGenerated = 0;

................................................................................
  aSubmenu[nSubmenu].zLink = vmprintf(zLink, ap);
  va_end(ap);
  nSubmenu++;
}
void style_submenu_entry(
  const char *zName,       /* Query parameter name */
  const char *zLabel,      /* Label before the entry box */
  int iSize                /* Size of the entry box */

){
  assert( nSubmenuCtrl < ArraySize(aSubmenuCtrl) );
  aSubmenuCtrl[nSubmenuCtrl].zName = zName;
  aSubmenuCtrl[nSubmenuCtrl].zLabel = zLabel;
  aSubmenuCtrl[nSubmenuCtrl].iSize = iSize;

  aSubmenuCtrl[nSubmenuCtrl].eType = FF_ENTRY;
  nSubmenuCtrl++;
}
void style_submenu_checkbox(
  const char *zName,       /* Query parameter name */
  const char *zLabel       /* Label before the checkbox */
){
  assert( nSubmenuCtrl < ArraySize(aSubmenuCtrl) );
  aSubmenuCtrl[nSubmenuCtrl].zName = zName;
  aSubmenuCtrl[nSubmenuCtrl].zLabel = zLabel;
  aSubmenuCtrl[nSubmenuCtrl].eType = FF_CKBOX;
  nSubmenuCtrl++;
}
void style_submenu_binary(
  const char *zName,       /* Query parameter name */
  const char *zTrue,       /* Label to show when parameter is true */
  const char *zFalse       /* Label to show when the parameter is false */

){
  assert( nSubmenuCtrl < ArraySize(aSubmenuCtrl) );
  aSubmenuCtrl[nSubmenuCtrl].zName = zName;
  aSubmenuCtrl[nSubmenuCtrl].zLabel = zTrue;
  aSubmenuCtrl[nSubmenuCtrl].zFalse = zFalse;

  aSubmenuCtrl[nSubmenuCtrl].eType = FF_BINARY;
  nSubmenuCtrl++;
}
void style_submenu_multichoice(
  const char *zName,       /* Query parameter name */
  int nChoice,             /* Number of options */
  const char **azChoice    /* value/display pairs.  2*nChoice entries */

){
  assert( nSubmenuCtrl < ArraySize(aSubmenuCtrl) );
  aSubmenuCtrl[nSubmenuCtrl].zName = zName;
  aSubmenuCtrl[nSubmenuCtrl].iSize = nChoice;
  aSubmenuCtrl[nSubmenuCtrl].azChoice = azChoice;

  aSubmenuCtrl[nSubmenuCtrl].eType = FF_MULTI;
  nSubmenuCtrl++;
}


/*
** Compare two submenu items for sorting purposes
................................................................................
          @ <a class="label" href="%h(p->zLink)">%h(p->zLabel)</a>
        }
      }
    }
    if( nSubmenuCtrl>0 ){
      for(i=0; i<nSubmenuCtrl; i++){
        const char *zQPN = aSubmenuCtrl[i].zName;



        cgi_tag_query_parameter(zQPN);

        switch( aSubmenuCtrl[i].eType ){
          case FF_ENTRY: {
            cgi_printf(
               "<span class='submenuctrl'>"
               "%h%s<input type='text' name='%s' size='%d' "
               "value='%h'></span>\n",
               aSubmenuCtrl[i].zLabel,
               aSubmenuCtrl[i].zLabel ? ":&nbsp;" : "",
               zQPN,
               aSubmenuCtrl[i].iSize,
               PD(zQPN,"")
            );
            break;
          }
          case FF_CKBOX: {
            cgi_printf(
               "<span class='submenuctrl'>"
               "%h%s<input type='checkbox' name='%s'%s "
               "onchange='gebi(\"f01\").submit();'></span>\n",
               aSubmenuCtrl[i].zLabel,
               aSubmenuCtrl[i].zLabel ? ":&nbsp;" : "",
               zQPN,
               PB(zQPN) ? " checked":""

            );
            break;
          }
          case FF_MULTI: {
            int j;
            const char *zVal = P(zQPN);
            cgi_printf(
               "<select class='submenuctrl' size='1' name='%s' "
               "onchange='gebi(\"f01\").submit();'>\n",
               zQPN
            );
            for(j=0; j<aSubmenuCtrl[i].iSize*2; j+=2){
              const char *zQPV = aSubmenuCtrl[i].azChoice[j];
              cgi_printf(
                "<option value='%h'%s>%h</option>\n",
                zQPV,
                fossil_strcmp(zVal,zQPV)==0 ? " selected" : "",
................................................................................
            }
            @ </select>
            break;
          }
          case FF_BINARY: {
            int isTrue = PB(zQPN);
            cgi_printf(
               "<select class='submenuctrl' size='1' name='%s' "
               "onchange='gebi(\"f01\").submit();'>\n",
               zQPN
            );
            cgi_printf(
              "<option value='1'%s>%h</option>\n",
              isTrue ? " selected":"", aSubmenuCtrl[i].zLabel
            );
            cgi_printf(
              "<option value='0'%s>%h</option>\n",







|
>
|





<
|
|







 







|
>





>



<
<
<
<
<
<
<
<
<
<



|
>





>






|
>





>







 







>
>
>
|
>




|
|

<


|
<
<
<
<
<
<
<
<
<
<
<
<
>







|

|







 







|

|







43
44
45
46
47
48
49
50
51
52
53
54
55
56
57

58
59
60
61
62
63
64
65
66
...
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261










262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
...
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511

512
513
514












515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
...
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
  const char *zTitle;
  const char *zLink;         /* Jump to this link when button is pressed */
} aSubmenu[30];
static int nSubmenu = 0;     /* Number of buttons */
static struct SubmenuCtrl {
  const char *zName;         /* Form query parameter */
  const char *zLabel;        /* Label.  Might be NULL for FF_MULTI */
  unsigned char eType;       /* FF_ENTRY, FF_MULTI, FF_BINARY */
  unsigned char isDisabled;  /* True if this control is grayed out */
  short int iSize;           /* Width for FF_ENTRY.  Count for FF_MULTI */
  const char **azChoice;     /* value/display pairs for FF_MULTI */
  const char *zFalse;        /* FF_BINARY label when false */
} aSubmenuCtrl[20];
static int nSubmenuCtrl = 0;
#define FF_ENTRY  1

#define FF_MULTI  2
#define FF_BINARY 3

/*
** Remember that the header has been generated.  The footer is omitted
** if an error occurs before the header.
*/
static int headerHasBeenGenerated = 0;

................................................................................
  aSubmenu[nSubmenu].zLink = vmprintf(zLink, ap);
  va_end(ap);
  nSubmenu++;
}
void style_submenu_entry(
  const char *zName,       /* Query parameter name */
  const char *zLabel,      /* Label before the entry box */
  int iSize,               /* Size of the entry box */
  int isDisabled           /* True if disabled */
){
  assert( nSubmenuCtrl < ArraySize(aSubmenuCtrl) );
  aSubmenuCtrl[nSubmenuCtrl].zName = zName;
  aSubmenuCtrl[nSubmenuCtrl].zLabel = zLabel;
  aSubmenuCtrl[nSubmenuCtrl].iSize = iSize;
  aSubmenuCtrl[nSubmenuCtrl].isDisabled = isDisabled;
  aSubmenuCtrl[nSubmenuCtrl].eType = FF_ENTRY;
  nSubmenuCtrl++;
}










void style_submenu_binary(
  const char *zName,       /* Query parameter name */
  const char *zTrue,       /* Label to show when parameter is true */
  const char *zFalse,      /* Label to show when the parameter is false */
  int isDisabled           /* True if this control is disabled */
){
  assert( nSubmenuCtrl < ArraySize(aSubmenuCtrl) );
  aSubmenuCtrl[nSubmenuCtrl].zName = zName;
  aSubmenuCtrl[nSubmenuCtrl].zLabel = zTrue;
  aSubmenuCtrl[nSubmenuCtrl].zFalse = zFalse;
  aSubmenuCtrl[nSubmenuCtrl].isDisabled = isDisabled;
  aSubmenuCtrl[nSubmenuCtrl].eType = FF_BINARY;
  nSubmenuCtrl++;
}
void style_submenu_multichoice(
  const char *zName,       /* Query parameter name */
  int nChoice,             /* Number of options */
  const char **azChoice,   /* value/display pairs.  2*nChoice entries */
  int isDisabled           /* True if this control is disabled */
){
  assert( nSubmenuCtrl < ArraySize(aSubmenuCtrl) );
  aSubmenuCtrl[nSubmenuCtrl].zName = zName;
  aSubmenuCtrl[nSubmenuCtrl].iSize = nChoice;
  aSubmenuCtrl[nSubmenuCtrl].azChoice = azChoice;
  aSubmenuCtrl[nSubmenuCtrl].isDisabled = isDisabled;
  aSubmenuCtrl[nSubmenuCtrl].eType = FF_MULTI;
  nSubmenuCtrl++;
}


/*
** Compare two submenu items for sorting purposes
................................................................................
          @ <a class="label" href="%h(p->zLink)">%h(p->zLabel)</a>
        }
      }
    }
    if( nSubmenuCtrl>0 ){
      for(i=0; i<nSubmenuCtrl; i++){
        const char *zQPN = aSubmenuCtrl[i].zName;
        const char *zDisabled = " disabled";
        if( !aSubmenuCtrl[i].isDisabled ){
          zDisabled = "";
          cgi_tag_query_parameter(zQPN);
        }
        switch( aSubmenuCtrl[i].eType ){
          case FF_ENTRY: {
            cgi_printf(
               "<span class='submenuctrl'>"
               "&nbsp;%h<input type='text' name='%s' size='%d' "
               "value='%h'%s></span>\n",
               aSubmenuCtrl[i].zLabel,

               zQPN,
               aSubmenuCtrl[i].iSize,
               PD(zQPN,""),












               zDisabled
            );
            break;
          }
          case FF_MULTI: {
            int j;
            const char *zVal = P(zQPN);
            cgi_printf(
               "<select class='submenuctrl' size='1' name='%s'%s "
               "onchange='gebi(\"f01\").submit();'>\n",
               zQPN, zDisabled
            );
            for(j=0; j<aSubmenuCtrl[i].iSize*2; j+=2){
              const char *zQPV = aSubmenuCtrl[i].azChoice[j];
              cgi_printf(
                "<option value='%h'%s>%h</option>\n",
                zQPV,
                fossil_strcmp(zVal,zQPV)==0 ? " selected" : "",
................................................................................
            }
            @ </select>
            break;
          }
          case FF_BINARY: {
            int isTrue = PB(zQPN);
            cgi_printf(
               "<select class='submenuctrl' size='1' name='%s'%s "
               "onchange='gebi(\"f01\").submit();'>\n",
               zQPN, zDisabled
            );
            cgi_printf(
              "<option value='1'%s>%h</option>\n",
              isTrue ? " selected":"", aSubmenuCtrl[i].zLabel
            );
            cgi_printf(
              "<option value='0'%s>%h</option>\n",

Changes to src/timeline.c.

1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
....
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
....
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316

1317
1318
1319
1320
1321
1322
1323
....
1327
1328
1329
1330
1331
1332
1333
1334

1335
1336
1337
1338
1339
1340
1341
....
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558

1559
1560
1561
1562
1563
1564
1565
** on the timeline.
*/
static void timeline_y_submenu(void){
  static int i = 0;
  static const char *az[12];
  if( i==0 ){
    az[0] = "all";
    az[1] = "All Types";
    i = 2;
    if( g.perm.Read ){
      az[i++] = "ci";
      az[i++] = "Check-ins";
      az[i++] = "g";
      az[i++] = "Tags";
    }
................................................................................
    if( g.perm.RdWiki ){
      az[i++] = "w";
      az[i++] = "Wiki";
    }
    assert( i<=ArraySize(az) );
  }
  if( i>2 ){
    style_submenu_multichoice("y", i/2, az);
  }
}

/*
** WEBPAGE: timeline
**
** Query parameters:
................................................................................
                   href("%R/info/%s", zUuid), zUuid);
    if( d_rid ){
      if( p_rid ){
        /* If both p= and d= are set, we don't have the uuid of d yet. */
        zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", d_rid);
      }
    }
    style_submenu_entry("n",0,1);
    timeline_y_submenu();
    style_submenu_binary("v","With Files","Without Files");

  }else if( f_rid && g.perm.Read ){
    /* If f= is present, ignore all other parameters other than n= */
    char *zUuid;
    db_multi_exec(
       "CREATE TEMP TABLE IF NOT EXISTS ok(rid INTEGER PRIMARY KEY);"
       "INSERT INTO ok VALUES(%d);"
       "INSERT OR IGNORE INTO ok SELECT pid FROM plink WHERE cid=%d;"
................................................................................
    blob_append_sql(&sql, " AND event.objid IN ok");
    db_multi_exec("%s", blob_sql_text(&sql));
    if( useDividers ) timeline_add_dividers(0, f_rid);
    blob_appendf(&desc, "Parents and children of check-in ");
    zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", f_rid);
    blob_appendf(&desc, "%z[%S]</a>", href("%R/info/%s", zUuid), zUuid);
    tmFlags |= TIMELINE_DISJOINT;
    style_submenu_binary("v","With Files","Without Files");

    if( (tmFlags & TIMELINE_UNHIDE)==0 ){
      timeline_submenu(&url, "Unhide", "unhide", "", 0);
    }
  }else{
    /* Otherwise, a timeline based on a span of time */
    int n;
    const char *zEType = "timeline item";
................................................................................
        free(zDate);
      }
      if( zType[0]=='a' || zType[0]=='c' ){
        if( (tmFlags & TIMELINE_UNHIDE)==0 ){
          timeline_submenu(&url, "Unhide", "unhide", "", 0);
        }
      }
      style_submenu_entry("n",0,1);
      if( zUses==0 ) timeline_y_submenu();
      style_submenu_binary("v","With Files","Without Files");

    }
  }
  if( P("showsql") ){
    @ <blockquote>%h(blob_sql_text(&sql))</blockquote>
  }
  if( search_restrict(SRCH_CKIN)!=0 ){
    style_submenu_element("Search", 0, "%R/search?y=c");







|







 







|







 







|

|
>







 







|
>







 







|

|
>







1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
....
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
....
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
....
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
....
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
** on the timeline.
*/
static void timeline_y_submenu(void){
  static int i = 0;
  static const char *az[12];
  if( i==0 ){
    az[0] = "all";
    az[1] = "Any Type";
    i = 2;
    if( g.perm.Read ){
      az[i++] = "ci";
      az[i++] = "Check-ins";
      az[i++] = "g";
      az[i++] = "Tags";
    }
................................................................................
    if( g.perm.RdWiki ){
      az[i++] = "w";
      az[i++] = "Wiki";
    }
    assert( i<=ArraySize(az) );
  }
  if( i>2 ){
    style_submenu_multichoice("y", i/2, az, 0);
  }
}

/*
** WEBPAGE: timeline
**
** Query parameters:
................................................................................
                   href("%R/info/%s", zUuid), zUuid);
    if( d_rid ){
      if( p_rid ){
        /* If both p= and d= are set, we don't have the uuid of d yet. */
        zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", d_rid);
      }
    }
    style_submenu_entry("n","Max:",1,0);
    timeline_y_submenu();
    style_submenu_binary("v","With Files","Without Files",
                         zType[0]!='a' && zType[0]!='c');
  }else if( f_rid && g.perm.Read ){
    /* If f= is present, ignore all other parameters other than n= */
    char *zUuid;
    db_multi_exec(
       "CREATE TEMP TABLE IF NOT EXISTS ok(rid INTEGER PRIMARY KEY);"
       "INSERT INTO ok VALUES(%d);"
       "INSERT OR IGNORE INTO ok SELECT pid FROM plink WHERE cid=%d;"
................................................................................
    blob_append_sql(&sql, " AND event.objid IN ok");
    db_multi_exec("%s", blob_sql_text(&sql));
    if( useDividers ) timeline_add_dividers(0, f_rid);
    blob_appendf(&desc, "Parents and children of check-in ");
    zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", f_rid);
    blob_appendf(&desc, "%z[%S]</a>", href("%R/info/%s", zUuid), zUuid);
    tmFlags |= TIMELINE_DISJOINT;
    style_submenu_binary("v","With Files","Without Files",
                         zType[0]!='a' && zType[0]!='c');
    if( (tmFlags & TIMELINE_UNHIDE)==0 ){
      timeline_submenu(&url, "Unhide", "unhide", "", 0);
    }
  }else{
    /* Otherwise, a timeline based on a span of time */
    int n;
    const char *zEType = "timeline item";
................................................................................
        free(zDate);
      }
      if( zType[0]=='a' || zType[0]=='c' ){
        if( (tmFlags & TIMELINE_UNHIDE)==0 ){
          timeline_submenu(&url, "Unhide", "unhide", "", 0);
        }
      }
      style_submenu_entry("n","Max:",1,0);
      if( zUses==0 ) timeline_y_submenu();
      style_submenu_binary("v","With Files","Without Files",
                           zType[0]!='a' && zType[0]!='c');
    }
  }
  if( P("showsql") ){
    @ <blockquote>%h(blob_sql_text(&sql))</blockquote>
  }
  if( search_restrict(SRCH_CKIN)!=0 ){
    style_submenu_element("Search", 0, "%R/search?y=c");