Fossil

Check-in [50698a3c]
Login

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

Overview
Comment:On the flat /dir webpage, automatically adjust the number of columns based on the screen width.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | mobile
Files: files | file ages | folders
SHA3-256:50698a3c277ae7cb2ad55736a64404785fb0f8f3591c92f43048731fdaeec866
User & Date: drh 2018-08-20 17:31:51
Context
2018-08-20
17:51
Add automatic columnation of the capabilities in the /setup_uedit screen. check-in: 4f4956f8 user: drh tags: mobile
17:31
On the flat /dir webpage, automatically adjust the number of columns based on the screen width. check-in: 50698a3c user: drh tags: mobile
16:06
Simple changes to the default CSS and Header that seem to help Fossil work better on mobile by avoiding menu wraps. check-in: 5fb04081 user: drh tags: mobile
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/browse.c.

119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
...
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
...
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
**    type=TYPE        TYPE=flat: use this display
**                     TYPE=tree: use the /tree display instead
*/
void page_dir(void){
  char *zD = fossil_strdup(P("name"));
  int nD = zD ? strlen(zD)+1 : 0;
  int mxLen;
  int nCol, nRow;
  int cnt, i;
  char *zPrefix;
  Stmt q;
  const char *zCI = P("ci");
  int rid = 0;
  char *zUuid = 0;
  Blob dirname;
................................................................................

  /* Generate a multi-column table listing the contents of zD[]
  ** directory.
  */
  mxLen = db_int(12, "SELECT max(length(x)) FROM localfiles /*scan*/");
  cnt = db_int(0, "SELECT count(*) FROM localfiles /*scan*/");
  if( mxLen<12 ) mxLen = 12;
  nCol = 100/mxLen;
  if( nCol<1 ) nCol = 1;
  if( nCol>5 ) nCol = 5;
  nRow = (cnt+nCol-1)/nCol;
  db_prepare(&q, "SELECT x, u FROM localfiles ORDER BY x /*scan*/");

  @ <table class="browser"><tr><td class="browser"><ul class="browser">
  i = 0;
  while( db_step(&q)==SQLITE_ROW ){
    const char *zFN;
    if( i==nRow ){
      @ </ul></td><td class="browser"><ul class="browser">
      i = 0;
    }
    i++;
    zFN = db_column_text(&q, 0);
    if( zFN[0]=='/' ){
      zFN++;
      @ <li class="dir">%z(href("%s%T",zSubdirLink,zFN))%h(zFN)</a></li>
    }else{
      const char *zLink;
      if( zCI ){
................................................................................
        zLink = href("%R/finfo?name=%T%T",zPrefix,zFN);
      }
      @ <li class="%z(fileext_class(zFN))">%z(zLink)%h(zFN)</a></li>
    }
  }
  db_finalize(&q);
  manifest_destroy(pM);
  @ </ul></td></tr></table>

  /* If the directory contains a readme file, then display its content below
  ** the list of files
  */
  db_prepare(&q,
    "SELECT x, u FROM localfiles"
    " WHERE x COLLATE nocase IN"







<







 







<
<
<
<

>
|
<


<
<
<
<
<







 







|







119
120
121
122
123
124
125

126
127
128
129
130
131
132
...
268
269
270
271
272
273
274




275
276
277

278
279





280
281
282
283
284
285
286
...
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
**    type=TYPE        TYPE=flat: use this display
**                     TYPE=tree: use the /tree display instead
*/
void page_dir(void){
  char *zD = fossil_strdup(P("name"));
  int nD = zD ? strlen(zD)+1 : 0;
  int mxLen;

  int cnt, i;
  char *zPrefix;
  Stmt q;
  const char *zCI = P("ci");
  int rid = 0;
  char *zUuid = 0;
  Blob dirname;
................................................................................

  /* Generate a multi-column table listing the contents of zD[]
  ** directory.
  */
  mxLen = db_int(12, "SELECT max(length(x)) FROM localfiles /*scan*/");
  cnt = db_int(0, "SELECT count(*) FROM localfiles /*scan*/");
  if( mxLen<12 ) mxLen = 12;




  db_prepare(&q, "SELECT x, u FROM localfiles ORDER BY x /*scan*/");
  @ <div class="columns" style="column-width: %d(mxLen)ex;">
  @ <ul class="browser">

  while( db_step(&q)==SQLITE_ROW ){
    const char *zFN;





    zFN = db_column_text(&q, 0);
    if( zFN[0]=='/' ){
      zFN++;
      @ <li class="dir">%z(href("%s%T",zSubdirLink,zFN))%h(zFN)</a></li>
    }else{
      const char *zLink;
      if( zCI ){
................................................................................
        zLink = href("%R/finfo?name=%T%T",zPrefix,zFN);
      }
      @ <li class="%z(fileext_class(zFN))">%z(zLink)%h(zFN)</a></li>
    }
  }
  db_finalize(&q);
  manifest_destroy(pM);
  @ </ul></div>

  /* If the directory contains a readme file, then display its content below
  ** the list of files
  */
  db_prepare(&q,
    "SELECT x, u FROM localfiles"
    " WHERE x COLLATE nocase IN"

Changes to src/default_css.txt.

182
183
184
185
186
187
188
189

190
191
192
193
194
195



196
197
198
199
200
201
202
}
span.infoTag {
  font-weight: bold;
}
span.wikiTagCancelled {
  text-decoration: line-through;
}
table.browser {

  width: 100%;
  border: 0;
}
td.browser {
  width: 24%;
  vertical-align: top;



}
.filetree {
  margin: 1em 0;
  line-height: 1.5;
}
.filetree > ul {
  display: inline-block;







|
>
|
<

|
|
|
>
>
>







182
183
184
185
186
187
188
189
190
191

192
193
194
195
196
197
198
199
200
201
202
203
204
205
}
span.infoTag {
  font-weight: bold;
}
span.wikiTagCancelled {
  text-decoration: line-through;
}
div.columns {
  padding: 2em;
  max-width: 1000px;

}
div.columns ul {
  margin: 0;
  padding: 0;
}
div.columns ul li:first-child {
  margin-top:0px;
}
.filetree {
  margin: 1em 0;
  line-height: 1.5;
}
.filetree > ul {
  display: inline-block;