Fossil: Check-in [9280c58260]

Fossil SCM

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

Overview
Comment:Import ideas from @tontyna proposal on fossil forum. Also fix the column sort order
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | repolist-theme
Files: files | file ages | folders
SHA3-256:9280c58260fa0b0f2ce0e19ae84ffe0fd524d1d3ac24ae66b5ef391f7fe2472a
User & Date: milouse 2018-11-15 09:31:14
Context
2018-12-05
09:05
Merge trunk check-in: cc074a1442 user: milouse tags: repolist-theme
2018-11-15
09:31
Import ideas from @tontyna proposal on fossil forum. Also fix the column sort order check-in: 9280c58260 user: milouse tags: repolist-theme
2018-11-14
17:12
Fix last merge (repolist columns were broken). check-in: c77c0dc695 user: milouse tags: repolist-theme
Changes

Changes to src/repolist.c.

70
71
72
73
74
75
76



































77
78
79
80
81
82
83
...
121
122
123
124
125
126
127





128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145

146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
  if( sqlite3_step(pStmt)==SQLITE_ROW ){
    pRepo->zProjDesc = fossil_strdup((char*)sqlite3_column_text(pStmt,0));
  }
  sqlite3_finalize(pStmt);
  sqlite3_close(db);
  pRepo->isValid = 1;
}




































/*
** Generate a web-page that lists all repositories located under the
** g.zRepositoryName directory and return non-zero.
**
** For the special case when g.zRepositoryName is a non-chroot-jail "/",
** compose the list using the "repo:" entries in the global_config
................................................................................
    blob_init(&base, g.zRepositoryName, -1);
    sqlite3_open(":memory:", &g.db);
    db_multi_exec("CREATE TABLE sfile(pathname TEXT);");
    db_multi_exec("CREATE TABLE vfile(pathname);");
    vfile_scan(&base, blob_size(&base), 0, 0, 0);
    db_multi_exec("DELETE FROM sfile WHERE pathname NOT GLOB '*[^/].fossil'");
    allRepo = 0;





  }
  const char *zHeader = skin_get("header");
  const char *zFooter = skin_get("footer");
  const char *zStyle = skin_get("css");
  Th_Store("title", "Repository List");
  Th_Store("project_name", "Fossil");
  Th_Store("project_description", "");
  Th_Store("logo_image_url", "data:image/gif;base64,R0lGODlhSABIAPQAAFWBlV+Im2OLnWqQonGWpnSYqH+gr4qotpSwvJ+4w6rAyrTH0LjK0r/P18nX3dTf5N/n6+Lj4uLq7env8fD09vT3+P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH+NCBJbWFnZSBnZW5lcmF0ZWQgYnkgRVNQIEdob3N0c2NyaXB0IChkZXZpY2U9cG5tcmF3KQoALAAAAABIAEgAAAX+oCWK0WieaGpKCiEwaizPdC02BqADQWX/wGBjsCs6gsgkalhsKpTQICTXdEavNEV1+8R6T5DClvstWxqBMdmMTajHXTYUMaZuG/L5dvCwVx95SQ5VBXhaahOBSERNCBMQRWlNikEPaow6C00GlECDbzoIlkUJnT+QoAVnTXimNphqDYc7ia41DaA6YjsDtj+7uTulvjUTksEAR8Q1EMegvcs2zcHD0cXAiNZAs1vV2jMTAwsTdIQ+3zQ50BMLBmkFCufoMqgA83o68vdAx7X7P6N0/AvCbSCQA7wMilDgTwUmTgMfTGiAYEaROPsgDBgiY4KRgSwWFGiIIiAAfff+Ghw4sKCiioCqbCizlaNVyR0LbDzwZgphTBSoetg4sDOnq0MQgBoDgHFGAgQGUCrCxdTEhBwBWlqAAKhj0gMGBsyk5BEAxK2SBoCtoMVlCi2qHiT1xUjENB1uACBA9XNEhXJNbeV9UOFYgYBXQ50oN0Cqq7IPyvHgKmwpAKMW8gKYay3Hp8kWAvbSpCNpQJvWjFEtMLdCkaTlOO1C/Y0t7SJGdw3iE43CDzsuKyAkqsjxCAk/Zp21oCCwhbFRDnyp1zeGKCyWymCasSDBA+lX3JU5BC1GBQMInAPxyDNKBSLgVTgYYMDABJJBNOGPolEBZxVcGVBdEAa05wVeM7jzBsB+Qxl3BSMFODgKdDb89Z8ZmlWkQAMoUaWeDBUUMGAZZemgABEBICDPIR+qEGIAF7LBzQKSZCUCaS2mgBBtctwFwAA+RjUKjzJoQmQSy50wQAHHcGiHWKX9UNiRBAnXFRg8UPXjDWltmaADCtTHIBINFOCAgaRBoGUtFSwAH4UmOIDQDm5dsYACCeQZ4yGAPEAEBBU8IKgFExjHFiwBwKlEBRTltZEJfI5wYhXoNdDQfJHEE4iWhy2kw5UavWHAEdwcQGUZWlYVqQkqvXGnAQo44KAcfu5gaj4vdVffrgmMaUoFmuUwokIokPNOjMQma0EIADs=");
  Th_Store("home", "/");
  Th_Store("index_page", "/");
  Th_Store("current_page", "repolist");
  Th_Store("release_version", RELEASE_VERSION);
  Th_Store("manifest_version", MANIFEST_VERSION);
  Th_Store("manifest_date", MANIFEST_DATE);
  Th_Store("compiler_name", COMPILER_NAME);
  @ <!DOCTYPE html>
  @ <html>
  @ <head>

  @ <base href="%s(g.zBaseURL)/" />
  @ <meta name="viewport" content="width=device-width, initial-scale=1.0">
  @ <style type="text/css">
  Th_Render(zStyle);
  @ </style>
  @ <title>Repository List</title>
  @ </head>
  @ <body>
  Th_Render(zHeader);
  @ <div class="content">
  n = db_int(0, "SELECT count(*) FROM sfile");
  if( n>0 ){
    Stmt q;
    double rNow;
    @ <table border="0" class="sortable" data-init-sort="1" \
    @ data-column-types="tntnk"><thead>
    @ <tr><th>Filename</th><th width="20"></th>
    @ <th>Project Name</th><th width="20"></th>
    @ <th>Description</th><th width="20"></th>
    @ <th>Last Modified</th></tr></thead><tbody>
    db_prepare(&q, "SELECT pathname"
                   " FROM sfile ORDER BY pathname COLLATE nocase;");
    rNow = db_double(0, "SELECT julianday('now')");







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>
>
>




|
<
<
<
<
<
<
<
<
<
<



>





|









|







70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
...
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172










173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
  if( sqlite3_step(pStmt)==SQLITE_ROW ){
    pRepo->zProjDesc = fossil_strdup((char*)sqlite3_column_text(pStmt,0));
  }
  sqlite3_finalize(pStmt);
  sqlite3_close(db);
  pRepo->isValid = 1;
}

/*
** Initialize the default TH1 skin variables.
** Similar to style_init_th1_vars() in style.c but with
** special treatment of variables unavailable in the repolist.
*/
void repo_list_init_th1_vars(void){
  Th_Store("nonce", style_nonce());
  /* undefined when run via `fossil test-list-page */
  if( g.zBaseURL ) {
    Th_Store("home", g.zTop);
    Th_Store("baseurl", g.zBaseURL);
    Th_Store("secureurl", login_wants_https_redirect() ? g.zHttpsURL : g.zBaseURL);
  }else{
    Th_Store("home", "/");
    Th_Store("baseurl", "/");
    Th_Store("secureurl", "/");
  }
  /* fixed values since not available in repolist's g.db */
  Th_Store("title", "Fossil Repositories");
  Th_Store("project_name", "Fossil");
  Th_Store("project_description", "");
  Th_Store("index_page", "/");
  Th_Store("current_page", "repolist");
  Th_Store("csrf_token", g.zCsrfToken);
  Th_Store("release_version", RELEASE_VERSION);
  Th_Store("manifest_version", MANIFEST_VERSION);
  Th_Store("manifest_date", MANIFEST_DATE);
  Th_Store("compiler_name", COMPILER_NAME);
  /* repolist can't get neither logo nor css from its g.db */
  Th_Store("stylesheet_url", "");
  Th_Store("background_image_url", "");
  /* supply the fossil logo  */
  Th_Store("logo_image_url", "data:image/gif;base64,R0lGODlhSABIAPQAAFWBlV+Im2OLnWqQonGWpnSYqH+gr4qotpSwvJ+4w6rAyrTH0LjK0r/P18nX3dTf5N/n6+Lj4uLq7env8fD09vT3+P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH+NCBJbWFnZSBnZW5lcmF0ZWQgYnkgRVNQIEdob3N0c2NyaXB0IChkZXZpY2U9cG5tcmF3KQoALAAAAABIAEgAAAX+oCWK0WieaGpKCiEwaizPdC02BqADQWX/wGBjsCs6gsgkalhsKpTQICTXdEavNEV1+8R6T5DClvstWxqBMdmMTajHXTYUMaZuG/L5dvCwVx95SQ5VBXhaahOBSERNCBMQRWlNikEPaow6C00GlECDbzoIlkUJnT+QoAVnTXimNphqDYc7ia41DaA6YjsDtj+7uTulvjUTksEAR8Q1EMegvcs2zcHD0cXAiNZAs1vV2jMTAwsTdIQ+3zQ50BMLBmkFCufoMqgA83o68vdAx7X7P6N0/AvCbSCQA7wMilDgTwUmTgMfTGiAYEaROPsgDBgiY4KRgSwWFGiIIiAAfff+Ghw4sKCiioCqbCizlaNVyR0LbDzwZgphTBSoetg4sDOnq0MQgBoDgHFGAgQGUCrCxdTEhBwBWlqAAKhj0gMGBsyk5BEAxK2SBoCtoMVlCi2qHiT1xUjENB1uACBA9XNEhXJNbeV9UOFYgYBXQ50oN0Cqq7IPyvHgKmwpAKMW8gKYay3Hp8kWAvbSpCNpQJvWjFEtMLdCkaTlOO1C/Y0t7SJGdw3iE43CDzsuKyAkqsjxCAk/Zp21oCCwhbFRDnyp1zeGKCyWymCasSDBA+lX3JU5BC1GBQMInAPxyDNKBSLgVTgYYMDABJJBNOGPolEBZxVcGVBdEAa05wVeM7jzBsB+Qxl3BSMFODgKdDb89Z8ZmlWkQAMoUaWeDBUUMGAZZemgABEBICDPIR+qEGIAF7LBzQKSZCUCaS2mgBBtctwFwAA+RjUKjzJoQmQSy50wQAHHcGiHWKX9UNiRBAnXFRg8UPXjDWltmaADCtTHIBINFOCAgaRBoGUtFSwAH4UmOIDQDm5dsYACCeQZ4yGAPEAEBBU8IKgFExjHFiwBwKlEBRTltZEJfI5wYhXoNdDQfJHEE4iWhy2kw5UavWHAEdwcQGUZWlYVqQkqvXGnAQo44KAcfu5gaj4vdVffrgmMaUoFmuUwokIokPNOjMQma0EIADs=");
}

/*
** Generate a web-page that lists all repositories located under the
** g.zRepositoryName directory and return non-zero.
**
** For the special case when g.zRepositoryName is a non-chroot-jail "/",
** compose the list using the "repo:" entries in the global_config
................................................................................
    blob_init(&base, g.zRepositoryName, -1);
    sqlite3_open(":memory:", &g.db);
    db_multi_exec("CREATE TABLE sfile(pathname TEXT);");
    db_multi_exec("CREATE TABLE vfile(pathname);");
    vfile_scan(&base, blob_size(&base), 0, 0, 0);
    db_multi_exec("DELETE FROM sfile WHERE pathname NOT GLOB '*[^/].fossil'");
    allRepo = 0;
  }
  /* use a skin, respect environment variable */
  const char *zSkin = fossil_getenv("FOSSIL_REPOLIST_SKIN");
  if( zSkin ){
    skin_use_alternative(zSkin);
  }
  const char *zHeader = skin_get("header");
  const char *zFooter = skin_get("footer");
  const char *zStyle = skin_get("css");
  repo_list_init_th1_vars();










  @ <!DOCTYPE html>
  @ <html>
  @ <head>
  @ <meta charset="utf-8">
  @ <base href="%s(g.zBaseURL)/" />
  @ <meta name="viewport" content="width=device-width, initial-scale=1.0">
  @ <style type="text/css">
  Th_Render(zStyle);
  @ </style>
  @ <title>Fossil Repositories</title>
  @ </head>
  @ <body>
  Th_Render(zHeader);
  @ <div class="content">
  n = db_int(0, "SELECT count(*) FROM sfile");
  if( n>0 ){
    Stmt q;
    double rNow;
    @ <table border="0" class="sortable" data-init-sort="1" \
    @ data-column-types="txtxxxk"><thead>
    @ <tr><th>Filename</th><th width="20"></th>
    @ <th>Project Name</th><th width="20"></th>
    @ <th>Description</th><th width="20"></th>
    @ <th>Last Modified</th></tr></thead><tbody>
    db_prepare(&q, "SELECT pathname"
                   " FROM sfile ORDER BY pathname COLLATE nocase;");
    rNow = db_double(0, "SELECT julianday('now')");