Fossil

Check-in [32d9be6d]
Login

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

Overview
Comment:Improved page titles when editing wiki about branches, checkins, and tags. Honor the wiki-about flag.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | describe-objects-using-wiki
Files: files | file ages | folders
SHA3-256: 32d9be6d719b60d10e97909d78bd4e4ce4272309221e84494ca6cba40f91eb50
User & Date: drh 2018-12-30 23:27:26
Wiki:describe-objects-using-wiki
Context
2018-12-31
00:00
Better titles for the /wiki page for associated wiki. check-in: 57443202 user: drh tags: describe-objects-using-wiki
2018-12-30
23:27
Improved page titles when editing wiki about branches, checkins, and tags. Honor the wiki-about flag. check-in: 32d9be6d user: drh tags: describe-objects-using-wiki
21:37
Add more linkage between the speicially named wiki pages and various objects. check-in: 42327c67 user: drh tags: describe-objects-using-wiki
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/info.c.

814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
        const char *zDate = db_column_text(&q2, 2);
        if( zUser==0 || zUser[0]==0 ) zUser = "unknown";
        @ <tr><th>Received&nbsp;From:</th>
        @ <td>%h(zUser) @ %h(zIpAddr) on %s(zDate)</td></tr>
      }
      db_finalize(&q2);
    }
    if( g.perm.WrWiki ){
      @ <tr><th>Edit&nbsp;Wiki:</th>
      @ <td>%z(href("%R/wikiedit?name=checkin/%s",zUuid))this checkin</a>
      @ %b(&wiki_edit_links)</td>
    }
    if( g.perm.Hyperlink ){
      @ <tr><th>Other&nbsp;Links:</th>
      @   <td>







|







814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
        const char *zDate = db_column_text(&q2, 2);
        if( zUser==0 || zUser[0]==0 ) zUser = "unknown";
        @ <tr><th>Received&nbsp;From:</th>
        @ <td>%h(zUser) @ %h(zIpAddr) on %s(zDate)</td></tr>
      }
      db_finalize(&q2);
    }
    if( g.perm.WrWiki && db_get_boolean("wiki-about",1) ){
      @ <tr><th>Edit&nbsp;Wiki:</th>
      @ <td>%z(href("%R/wikiedit?name=checkin/%s",zUuid))this checkin</a>
      @ %b(&wiki_edit_links)</td>
    }
    if( g.perm.Hyperlink ){
      @ <tr><th>Other&nbsp;Links:</th>
      @   <td>

Changes to src/setup.c.

936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
  if( !g.perm.Setup ){
    login_needed(0);
    return;
  }

  style_header("Wiki Configuration");
  db_begin_transaction();
  @ <form action="%s(g.zTop)/setup_config" method="post"><div>
  login_insert_csrf_secret();
  @ <input type="submit"  name="submit" value="Apply Changes" /></p>
  @ <hr />
  onoff_attribute("Associate Wiki Pages With Branches, Tags, or Checkins",
                  "wiki-about", "wiki-about", 1, 0);
  @ <p>
  @ Associate wiki pages with branches, tags, or checkins, based on







|







936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
  if( !g.perm.Setup ){
    login_needed(0);
    return;
  }

  style_header("Wiki Configuration");
  db_begin_transaction();
  @ <form action="%s(g.zTop)/setup_wiki" method="post"><div>
  login_insert_csrf_secret();
  @ <input type="submit"  name="submit" value="Apply Changes" /></p>
  @ <hr />
  onoff_attribute("Associate Wiki Pages With Branches, Tags, or Checkins",
                  "wiki-about", "wiki-about", 1, 0);
  @ <p>
  @ Associate wiki pages with branches, tags, or checkins, based on

Changes to src/wiki.c.

577
578
579
580
581
582
583


584




















585
586
587
588
589
590
591
....
1528
1529
1530
1531
1532
1533
1534

1535
1536
1537
1538
1539
1540
1541
    cgi_redirectf("wiki?name=%T", zPageName);
    return;
  }
  if( zBody==0 ){
    zBody = mprintf("<i>Empty Page</i>");
  }
  style_set_current_page("%T?name=%T", g.zPath, zPageName);


  style_header("Edit: %s", zPageName);




















  if( rid && !isSandbox && g.perm.ApndWiki ){
    if( g.perm.Attach ){
      style_submenu_element("Attach",
           "%s/attachadd?page=%T&from=%s/wiki%%3fname=%T",
           g.zTop, zPageName, g.zTop, zPageName);
    }
    style_submenu_element("Append", "%s/wikiappend?name=%T&mimetype=%s",
................................................................................
int wiki_render_associated(
  const char *zPrefix,   /* "branch", "tag", or "checkin" */
  const char *zName,     /* Name of the object */
  unsigned int mFlags    /* Zero or more WIKIASSOC_* flags */
){
  int rid;
  Manifest *pWiki;

  rid = db_int(0,
    "SELECT rid FROM tagxref"
    " WHERE tagid=(SELECT tagid FROM tag WHERE tagname='wiki-%q/%q')"
    " ORDER BY mtime DESC LIMIT 1",
    zPrefix, zName
  );
  if( rid==0 ) return 0;







>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>







577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
....
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
    cgi_redirectf("wiki?name=%T", zPageName);
    return;
  }
  if( zBody==0 ){
    zBody = mprintf("<i>Empty Page</i>");
  }
  style_set_current_page("%T?name=%T", g.zPath, zPageName);

  if( db_get_boolean("wiki-about",1)==0 ){
    style_header("Edit: %s", zPageName);
  }else
  if( sqlite3_strglob("checkin/*", zPageName)==0 
   && db_exists("SELECT 1 FROM blob WHERE uuid=%Q",zPageName+8)
  ){
    style_header("Notes About Checkin %S", zPageName + 8);
    style_submenu_element("Checkin Timeline","%R/timeline?f=%s",zPageName + 8);
    style_submenu_element("Checkin Info","%R/info/%s",zPageName + 8);
  }else
  if( sqlite3_strglob("branch/*", zPageName)==0 ){
    style_header("Notes About Branch %h", zPageName + 7);
    style_submenu_element("Branch Timeline","%R/timeline?r=%t",zPageName + 7);
  }else
  if( sqlite3_strglob("tag/*", zPageName)==0 ){
    style_header("Notes About Tag %h", zPageName + 4);
    style_submenu_element("Tag Timeline","%R/timeline?t=%t",zPageName + 4);
  }
  else{
    style_header("Edit: %s", zPageName);
  }

  if( rid && !isSandbox && g.perm.ApndWiki ){
    if( g.perm.Attach ){
      style_submenu_element("Attach",
           "%s/attachadd?page=%T&from=%s/wiki%%3fname=%T",
           g.zTop, zPageName, g.zTop, zPageName);
    }
    style_submenu_element("Append", "%s/wikiappend?name=%T&mimetype=%s",
................................................................................
int wiki_render_associated(
  const char *zPrefix,   /* "branch", "tag", or "checkin" */
  const char *zName,     /* Name of the object */
  unsigned int mFlags    /* Zero or more WIKIASSOC_* flags */
){
  int rid;
  Manifest *pWiki;
  if( !db_get_boolean("wiki-about",1) ) return 0;
  rid = db_int(0,
    "SELECT rid FROM tagxref"
    " WHERE tagid=(SELECT tagid FROM tag WHERE tagname='wiki-%q/%q')"
    " ORDER BY mtime DESC LIMIT 1",
    zPrefix, zName
  );
  if( rid==0 ) return 0;