Fossil

Check-in [5cd9597428]
Login

Check-in [5cd9597428]

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

Overview
Comment:Added style.css page that get's from the repo or uses a built in style.css. Removed static formatting in header/footer, replaced with divs, spans and ids which the style.css can totally control. The default style.css is simple, uses blue colors from timeline date area. Fixed minor bug on setup_ulist where it would display footer at top.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5cd959742854ddf2fcd21f4a8b0be5099954f16e
User & Date: jnc 2007-09-24 04:37:18.000
Context
2007-09-24
06:53
Added support for a user defined diff command, which if set (fossil config diff-command), is run by default. The user can give a -i flag to run the internal diff command regardless of user defined diff command setting. Removed command tkdiff, no longer needed. Made the config remove message a bit more clear, when removing a config setting, it states it has been removed instead of telling you it's undefined. ... (check-in: c82fb61775 user: jnc tags: trunk)
04:37
Added style.css page that get's from the repo or uses a built in style.css. Removed static formatting in header/footer, replaced with divs, spans and ids which the style.css can totally control. The default style.css is simple, uses blue colors from timeline date area. Fixed minor bug on setup_ulist where it would display footer at top. ... (check-in: 5cd9597428 user: jnc tags: trunk)
01:38
Some elements moved to correct order in wiki AllowedMarkup array. Removed hardcoded link in resolveHyperlink and also made it handle outside links, such as http, ftp, mailto, etc... When looking for valid HTML codes, I changed isalpha to isalnum so that H1, H2, etc... would be recognized. Better code for setting inital checkout db entry. ... (check-in: 55dc2abc60 user: jnc tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/setup.c.
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
**
** Show a list of users.  Clicking on any user jumps to the edit
** screen for that user.
*/
void setup_ulist(void){
  Stmt s;
  
  style_footer();
  login_check_credentials();
  if( !g.okSetup ){
    login_needed();
    return;
  }

  style_submenu_element("Add", "Add User", "setup_uedit");







<







77
78
79
80
81
82
83

84
85
86
87
88
89
90
**
** Show a list of users.  Clicking on any user jumps to the edit
** screen for that user.
*/
void setup_ulist(void){
  Stmt s;
  

  login_check_credentials();
  if( !g.okSetup ){
    login_needed();
    return;
  }

  style_submenu_element("Add", "Add User", "setup_uedit");
Changes to src/style.c.
1
2
3
4
5
6
7
8
9
/*
** Copyright (c) 2006 D. Richard Hipp
**
** This program is free software; you can redistribute it and/or
** modify it under the terms of the GNU General Public
** License version 2 as published by the Free Software Foundation.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of

|







1
2
3
4
5
6
7
8
9
/*
** Copyright (c) 2006,2007 D. Richard Hipp
**
** This program is free software; you can redistribute it and/or
** modify it under the terms of the GNU General Public
** License version 2 as published by the Free Software Foundation.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
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
119

120
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
void style_header(const char *zTitle){
  const char *zLogInOut = "Logout";
  login_check_credentials();
  @ <html>
  @ <head>
  @ <title>%s(zTitle)</title>
  @ <link rel="alternate" type="application/rss+xml" title="RSS Feed" href="%s(g.zBaseURL)/timeline.rss">

  @ </head>
  @ <body bgcolor="white">
  @ <hr size="1">
  @ <table border="0" cellpadding="0" cellspacing="0" width="100%%">
  @ <tr><td valign="top" align="left">
  @ <big><big><b>%s(zTitle)</b></big></big><br>

  if( g.zLogin==0 ){
    @ <small>not logged in</small>
    zLogInOut = "Login";
  }else{
    @ <small>logged in as %h(g.zLogin)</small>
  }
  @ </td><td valign="top" align="right">

  @ <a href="%s(g.zBaseURL)/index">Home</a>
  if( g.okRead ){
    @ | <a href="%s(g.zBaseURL)/leaves">Leaves</a>
    @ | <a href="%s(g.zBaseURL)/timeline">Timeline</a>
  }
  if( g.okRdWiki ){
    @ | <a href="%s(g.zBaseURL)/wiki">Wiki</a>
  }
#if 0
  @ | <font color="#888888">Search</font>
  @ | <font color="#888888">Ticket</font>
  @ | <font color="#888888">Reports</font>
#endif
  if( g.okSetup ){
    @ | <a href="%s(g.zBaseURL)/setup">Setup</a>
  }
  if( !g.noPswd ){
    @ | <a href="%s(g.zBaseURL)/login">%s(zLogInOut)</a>
  }


  if( nSubmenu>0 ){
    int i;
    @ <br>
    qsort(aSubmenu, nSubmenu, sizeof(aSubmenu[0]), submenuCompare);
    for(i=0; i<nSubmenu; i++){
      struct Submenu *p = &aSubmenu[i];
      char *zTail = i<nSubmenu-1 ? " | " : "";
      if( p->zLink==0 ){
        @ <font color="#888888">%h(p->zLabel)</font> %s(zTail)

      }else{
        @ <a href="%T(p->zLink)">%h(p->zLabel)</a> %s(zTail)

      }
    }
  }
  @ </td></tr></table>
  @ <hr size="1">
  g.cgiPanic = 1;
}

/*
** Draw the footer at the bottom of the page.
*/
void style_footer(void){

  @ <hr>
  @ <p align="left"><font size="1">
  @ Fossil version %s(MANIFEST_VERSION) %s(MANIFEST_DATE)
  @ </font></p>
}

/*
** WEBPAGE: index
** WEBPAGE: home
** WEBPAGE: not_found
*/
void page_index(void){
  char *zHome = db_get("homepage", 0);
  if( zHome ){
    g.zExtra = zHome;
    g.okRdWiki = 1;
    wiki_page();
  }else{
    style_header("Main Title Page");
    @ No homepage configured for this server
    style_footer();
  }
}




































































































































/*
** WEBPAGE: test_env
*/
void page_test_env(void){
  style_header("Environment Test");
  cgi_print_all();
  style_footer();
}







>

|
<
<
<
|
>

|


|

|
>



















>
>


<





|
>

|
>



|
|







>
|
|

|



















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









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
119
120
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
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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
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
298
299
300
void style_header(const char *zTitle){
  const char *zLogInOut = "Logout";
  login_check_credentials();
  @ <html>
  @ <head>
  @ <title>%s(zTitle)</title>
  @ <link rel="alternate" type="application/rss+xml" title="RSS Feed" href="%s(g.zBaseURL)/timeline.rss">
  @ <link rel="stylesheet" href="%s(g.zBaseURL)/style.css" type="text/css" media="screen">
  @ </head>
  @ <body>



  @ <div id="page-title">%s(zTitle)</div>
  @ <div id="login-status">
  if( g.zLogin==0 ){
    @ not logged in
    zLogInOut = "Login";
  }else{
    @ logged in as %h(g.zLogin)
  }
  @ </div>
  @ <div id="main-menu">
  @ <a href="%s(g.zBaseURL)/index">Home</a>
  if( g.okRead ){
    @ | <a href="%s(g.zBaseURL)/leaves">Leaves</a>
    @ | <a href="%s(g.zBaseURL)/timeline">Timeline</a>
  }
  if( g.okRdWiki ){
    @ | <a href="%s(g.zBaseURL)/wiki">Wiki</a>
  }
#if 0
  @ | <font color="#888888">Search</font>
  @ | <font color="#888888">Ticket</font>
  @ | <font color="#888888">Reports</font>
#endif
  if( g.okSetup ){
    @ | <a href="%s(g.zBaseURL)/setup">Setup</a>
  }
  if( !g.noPswd ){
    @ | <a href="%s(g.zBaseURL)/login">%s(zLogInOut)</a>
  }
  @ </div>
  @ <div id="sub-menu">
  if( nSubmenu>0 ){
    int i;

    qsort(aSubmenu, nSubmenu, sizeof(aSubmenu[0]), submenuCompare);
    for(i=0; i<nSubmenu; i++){
      struct Submenu *p = &aSubmenu[i];
      char *zTail = i<nSubmenu-1 ? " | " : "";
      if( p->zLink==0 ){
        @ <span class="label">%h(p->zLabel)</span>
        @ <span class="tail">%s(zTail)</span>
      }else{
        @ <a class="label" href="%T(p->zLink)">%h(p->zLabel)</a>
        @ <span class="tail">%s(zTail)</span>
      }
    }
  }
  @ </div>
  @ <div id="page">
  g.cgiPanic = 1;
}

/*
** Draw the footer at the bottom of the page.
*/
void style_footer(void){
  /* end the <div id="page"> from style_header() */
  @ </div>
  @ <div id="style-footer">
  @ Fossil version %s(MANIFEST_VERSION) %s(MANIFEST_DATE)
  @ </div>
}

/*
** WEBPAGE: index
** WEBPAGE: home
** WEBPAGE: not_found
*/
void page_index(void){
  char *zHome = db_get("homepage", 0);
  if( zHome ){
    g.zExtra = zHome;
    g.okRdWiki = 1;
    wiki_page();
  }else{
    style_header("Main Title Page");
    @ No homepage configured for this server
    style_footer();
  }
}

/*
** TODO: COPIED FROM WIKI.C... BAD
*/
/*
** Create a fake replicate of the "vfile" table as a TEMP table
** using the manifest identified by manid.
*/
static void style_create_fake_vfile(int manid){
  static const char zVfileDef[] = 
    @ CREATE TEMP TABLE vfile(
    @   id INTEGER PRIMARY KEY,     -- ID of the checked out file
    @   vid INTEGER REFERENCES blob, -- The version this file is part of.
    @   chnged INT DEFAULT 0,       -- 0:unchnged 1:edited 2:m-chng 3:m-add
    @   deleted BOOLEAN DEFAULT 0,  -- True if deleted 
    @   rid INTEGER,                -- Originally from this repository record
    @   mrid INTEGER,               -- Based on this record due to a merge
    @   pathname TEXT,              -- Full pathname
    @   UNIQUE(pathname,vid)
    @ );
    ;
  db_multi_exec(zVfileDef);
  load_vfile_from_rid(manid);
}


/*
** WEBPAGE: style.css
*/
void page_style_css(void){
  Stmt q;
  int id = 0;
  int rid = 0;
  int chnged = 0;
  char *zPathname = 0;
  char *z;
  
  cgi_set_content_type("text/css");

  login_check_credentials();
  if( !g.localOpen ){
    int headid = db_int(0,
       "SELECT cid FROM plink ORDER BY mtime DESC LIMIT 1"
    );
    style_create_fake_vfile(headid);
  }
  
  db_prepare(&q,
     "SELECT id, rid, chnged, pathname FROM vfile"
     " WHERE (pathname='style.css' OR pathname LIKE '%%/style.css')"
     "   AND NOT deleted"
  );
  if( db_step(&q)==SQLITE_ROW ){
    id = db_column_int(&q, 0);
    rid = db_column_int(&q, 1);
    chnged = db_column_int(&q, 2);
    if( chnged || rid==0 ){
      zPathname = db_column_malloc(&q, 3);
    }
  }
  db_finalize(&q);
  if( id ){
    Blob src;
    blob_zero(&src);
    if( zPathname ){
      zPathname = mprintf("%s/%z", g.zLocalRoot, zPathname);
      blob_read_from_file(&src, zPathname);
      free(zPathname);
    }else{
      content_get(rid, &src);
    }

    z = blob_str(&src);
    @ %s(z)
  }else{
    /* No CSS file found, use our own */
    /*
    ** Selector order: tags, ids, classes, other
    ** Content order: margin, borders, padding, fonts, colors, other 
    ** Note: Once things are finialize a bit we can collapse this and
    **       make it much smaller, if necessary. Right now, it's verbose
    **       but easy to edit.
    */
    @ body {
    @   margin: 0px;
    @   padding: 0px;
    @   background-color: white;
    @ }
    @ #page-title {
    @   padding: 10px 10px 10px 10px;
    @   font-size: 2em;
    @   font-weight: bold;
    @   background-color: #d0d9f4;
    @ }
    @ #login-status {
    @   padding: 0px 10px 10px 0px;
    @   font-size: 0.9em;
    @   text-align: right;
    @   background-color: #d0d9f4;
    @   position: absolute;
    @   top: 10;
    @   right: 0;
    @ }
    @ #main-menu {
    @   border-top: 2px solid #a0b5f4;
    @   padding: 3px 10px 1px 0px;
    @   font-size: 0.9em;
    @   text-align: center;
    @   background-color: #d0d9f4;
    @ }
    @ #sub-menu {
    @   border-bottom: 2px solid #a0b5f4;
    @   padding: 3px 10px 3px 0px;
    @   font-size: 0.9em;
    @   text-align: center;
    @   background-color: #d0d9f4;
    @ }
    @ #main-menu a:visited, #sub-menu a:visited {
    @   color: blue;
    @ }
    @ #page {
    @   padding: 10px 20px 10px 20px;
    @ }
    @ #style-footer { 
    @   font-size: 0.8em; 
    @   margin-top: 12px;
    @   padding-top: 5px;
    @   border-top: 1px solid black; 
    @ }
  }
}

/*
** WEBPAGE: test_env
*/
void page_test_env(void){
  style_header("Environment Test");
  cgi_print_all();
  style_footer();
}