Fossil

Check-in [8ffd32c2b7]
Login

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

Overview
Comment:Add the ability to edit the CSS for all pages in the Setup menu. Other miscellaneous changes toward getting ticketing to work.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 8ffd32c2b7ff83e4d4071d0ad785c67311433d1c
User & Date: drh 2007-10-28 20:52:52.000
Context
2007-10-28
21:09
Fixes to the rendering of <verbatim> and <nowiki> ... (check-in: e75f9a2ab4 user: drh tags: trunk)
20:52
Add the ability to edit the CSS for all pages in the Setup menu. Other miscellaneous changes toward getting ticketing to work. ... (check-in: 8ffd32c2b7 user: drh tags: trunk)
2007-10-27
13:52
Fix the hyperlink to wiki so that it uses a query parameter for the wiki page name. ... (check-in: 421a1e1fa4 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/setup.c.
65
66
67
68
69
70
71


72
73
74
75
76
77
78
    "Grant privileges to individual users.");
  setup_menu_entry("Access", "setup_access",
    "Control access settings.");
  setup_menu_entry("Configuration", "setup_config",
    "Configure the WWW components of the repository");
  setup_menu_entry("Tickets", "tktsetup",
    "Configure the trouble-ticketing system for this repository");


  @ </dl>

  style_footer();
}

/*
** WEBPAGE: setup_ulist







>
>







65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
    "Grant privileges to individual users.");
  setup_menu_entry("Access", "setup_access",
    "Control access settings.");
  setup_menu_entry("Configuration", "setup_config",
    "Configure the WWW components of the repository");
  setup_menu_entry("Tickets", "tktsetup",
    "Configure the trouble-ticketing system for this repository");
  setup_menu_entry("CSS", "editcss",
    "Edit the Cascading Style Sheet used by all pages of this repository");
  @ </dl>

  style_footer();
}

/*
** WEBPAGE: setup_ulist
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561


















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

  style_header("WWW Configuration");
  db_begin_transaction();
  @ <form action="%s(g.zBaseURL)/setup_config" method="POST">

  @ <hr />

  entry_attribute("Project Name", 60, "project-name", "pn", "");
  @ <p>Give your project a name so visitors know what this site is about.
  @ The project name will also be used as the RSS feed title.</p>

  @ <hr />

  textarea_attribute("Project Description", 5, 60, "project-description", "pd", "");
  @ <p>Describe your project. This will be used in page headers for search
  @ engines as well as a short RSS description.</p>

  @ <hr />
  @ <p><input type="submit"  name="submit" value="Apply Changes"></p>
  @ </form>
  db_end_transaction(0);
  style_footer();
}

























<

<



<

<



<






>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
538
539
540
541
542
543
544

545

546
547
548

549

550
551
552

553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
  if( !g.okSetup ){
    login_needed();
  }

  style_header("WWW Configuration");
  db_begin_transaction();
  @ <form action="%s(g.zBaseURL)/setup_config" method="POST">

  @ <hr />

  entry_attribute("Project Name", 60, "project-name", "pn", "");
  @ <p>Give your project a name so visitors know what this site is about.
  @ The project name will also be used as the RSS feed title.</p>

  @ <hr />

  textarea_attribute("Project Description", 5, 60, "project-description", "pd", "");
  @ <p>Describe your project. This will be used in page headers for search
  @ engines as well as a short RSS description.</p>

  @ <hr />
  @ <p><input type="submit"  name="submit" value="Apply Changes"></p>
  @ </form>
  db_end_transaction(0);
  style_footer();
}

/*
** WEBPAGE: editcss
*/
void setup_editcss(void){
  login_check_credentials();
  if( !g.okSetup ){
    login_needed();
  }
  style_header("Edit CSS");
  @ <form action="%s(g.zBaseURL)/editcss" method="POST">
  @ Edit the CSS:<br />
  textarea_attribute("", 40, 80, "css", "css", zDefaultCSS);
  @ <br />
  @ <input type="submit" name="submit" value="Apply Changes">
  @ </form>
  style_footer();
}
Changes to src/style.c.
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
  /* end the <div id="page"> from style_header() */
  @ </div>
  @ <div id="style-footer">
  @ Fossil version %s(MANIFEST_VERSION) %s(MANIFEST_DATE)
  @ </div>
}


















































































/*
** WEBPAGE: style.css
*/
void page_style_css(void){
  char *zCSS = 0;

  cgi_set_content_type("text/css");
  zCSS = db_get("css",0);
  if( zCSS ){
    cgi_append_content(zCSS, -1);
  }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: 1.8em;
    @   font-weight: bold;
    @   background-color: #6a7ec7;
    @   color: #0a1e67;
    @ }
    @ #login-status {
    @   padding: 0px 10px 10px 0px;
    @   font-size: 0.9em;
    @   text-align: right;
    @   background-color: #6a7ec7;
    @   color: white;
    @   position: absolute;
    @   top: 10;
    @   right: 0;
    @ }
    @ #main-menu {
    @   padding: 5px 10px 5px 10px;
    @   font-size: 0.9em;
    @   font-weight: bold;
    @   text-align: center;
    @   letter-spacing: 1px;
    @   background-color: #414f84;
    @   color: white;
    @ }
    @ #sub-menu {
    @   padding: 3px 10px 3px 0px;
    @   font-size: 0.9em;
    @   text-align: center;
    @   background-color: #414f84;
    @   color: white;
    @ }
    @ #main-menu a, #main-menu a:visited, #sub-menu a, #sub-menu a:visited {
    @   padding: 3px 10px 3px 10px;
    @   color: white;
    @ }
    @ #main-menu a:hover, #sub-menu a:hover {
    @   color: #414f84;
    @   background-color: white;
    @ }
    @ #page {
    @   padding: 10px 20px 10px 20px;
    @ }
    @ #style-footer {
    @   font-size: 0.8em;
    @   margin-top: 12px;
    @   padding: 5px 10px 5px 10px;
    @   text-align: right;
    @   background-color: #414f84;
    @   color: white;
    @ }
    @ table.label-value th {
    @   text-align: right;
    @   vertical-align: top;
    @ }
    @ div.section-title {
    @   margin-bottom: 0px;
    @   padding: 1px 1px 1px 1px;
    @   font-size: 1.2em;
    @   font-weight: bold;
    @   background-color: #6a7ec7;
    @   color: #0a1e67;
    @ }
  }
}

/*
** WEBPAGE: test_env
*/
void page_test_env(void){







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












<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







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
  /* end the <div id="page"> from style_header() */
  @ </div>
  @ <div id="style-footer">
  @ Fossil version %s(MANIFEST_VERSION) %s(MANIFEST_DATE)
  @ </div>
}

/*
** The default Cascading Style Sheet.
**
** 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.
*/
const char zDefaultCSS[] = 
@ body {
@   margin: 0px;
@   padding: 0px;
@   background-color: white;
@ }
@ #page-title {
@   padding: 10px 10px 10px 10px;
@   font-size: 1.8em;
@   font-weight: bold;
@   background-color: #6a7ec7;
@   color: #0a1e67;
@ }
@ #login-status {
@   padding: 0px 10px 10px 0px;
@   font-size: 0.9em;
@   text-align: right;
@   background-color: #6a7ec7;
@   color: white;
@   position: absolute;
@   top: 10;
@   right: 0;
@ }
@ #main-menu {
@   padding: 5px 10px 5px 10px;
@   font-size: 0.9em;
@   font-weight: bold;
@   text-align: center;
@   letter-spacing: 1px;
@   background-color: #414f84;
@   color: white;
@ }
@ #sub-menu {
@   padding: 3px 10px 3px 0px;
@   font-size: 0.9em;
@   text-align: center;
@   background-color: #414f84;
@   color: white;
@ }
@ #main-menu a, #main-menu a:visited, #sub-menu a, #sub-menu a:visited {
@   padding: 3px 10px 3px 10px;
@   color: white;
@ }
@ #main-menu a:hover, #sub-menu a:hover {
@   color: #414f84;
@   background-color: white;
@ }
@ #page {
@   padding: 10px 20px 10px 20px;
@ }
@ #style-footer {
@   font-size: 0.8em;
@   margin-top: 12px;
@   padding: 5px 10px 5px 10px;
@   text-align: right;
@   background-color: #414f84;
@   color: white;
@ }
@ table.label-value th {
@   text-align: right;
@   vertical-align: top;
@ }
@ div.section-title {
@   margin-bottom: 0px;
@   padding: 1px 1px 1px 1px;
@   font-size: 1.2em;
@   font-weight: bold;
@   background-color: #6a7ec7;
@   color: #0a1e67;
@ }
;

/*
** WEBPAGE: style.css
*/
void page_style_css(void){
  char *zCSS = 0;

  cgi_set_content_type("text/css");
  zCSS = db_get("css",0);
  if( zCSS ){
    cgi_append_content(zCSS, -1);
  }else{



    cgi_append_content(zDefaultCSS, -1);









































































  }
}

/*
** WEBPAGE: test_env
*/
void page_test_env(void){
Changes to src/subscript.c.
23
24
25
26
27
28
29
30
31
32





















33
34
35
36
37
38
39
**
** This file contains an implementation of the "subscript" interpreter.
**
** Subscript attempts to be an extremely light-weight scripting
** language.  It contains the barest of bare essentials.  It is
** stack-based and forth-like.  Everything is in a single global
** namespace.  There is only a single datatype of zero-terminated
** string.  The stack is of fixed, limited depth.  The hash table
** is of a limited and fixed size.
**





















** This module attempts to be completely self-contained so that it can
** be portable to other projects.
*/
#include "config.h"
#include "subscript.h"
#include <assert.h>








|


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







23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
**
** This file contains an implementation of the "subscript" interpreter.
**
** Subscript attempts to be an extremely light-weight scripting
** language.  It contains the barest of bare essentials.  It is
** stack-based and forth-like.  Everything is in a single global
** namespace.  There is only a single datatype of zero-terminated
** string.  The stack is of fixed, limited depth.  The symbal table
** is of a limited and fixed size.
**
** TOKENS:
**
**      *  All tokens are separated from each other by whitespace.
**      *  Leading and trailing whitespace is ignored.
**      *  Text within nested {...} is a single string token.  The outermost
**         curly braces are not part of the token.
**      *  An identifier with a leading "/" is a string token.
**      *  A token that looks like a number is a string token.
**      *  An identifier token is called a "verb".
**
** PROCESSING:
**
**      *  The input is divided into tokens.  Whitespace is discarded.
**         String and verb tokens are passed into the engine.
**      *  String tokens are pushed onto the stack.
**      *  If a verb token corresponds to a procedure, that procedure is
**         run.  The procedure might use, pop, or pull elements from 
**         the stack.
**      *  If a verb token corresponds to a variable, the value of that
**         variable is pushed onto the stack.
**
** This module attempts to be completely self-contained so that it can
** be portable to other projects.
*/
#include "config.h"
#include "subscript.h"
#include <assert.h>

288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
    return SBS_ERROR;
  }
  p->aStack[p->nStack++] = *pVal;
  return SBS_OK;
}

/*
** Destroy an underscore interpreter
*/
void SbS_Destroy(struct Subscript *p){
  int i;
  sbs_hash_reset(&p->symTab);
  for(i=0; i<p->nStack; i++){
    sbs_value_reset(&p->aStack[i]);
  }







|







309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
    return SBS_ERROR;
  }
  p->aStack[p->nStack++] = *pVal;
  return SBS_OK;
}

/*
** Destroy an subscript interpreter
*/
void SbS_Destroy(struct Subscript *p){
  int i;
  sbs_hash_reset(&p->symTab);
  for(i=0; i<p->nStack; i++){
    sbs_value_reset(&p->aStack[i]);
  }
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
  sbs_store(&p->symTab, pTos->u.str.z, pTos->u.str.size, pNos);
  sbs_value_reset(pTos);
  return 0;
}


/*
** Create a new underscore interpreter
*/
struct Subscript *SbS_Create(void){
  Subscript *p;

  p = malloc( sizeof(*p) );
  if( p ){
    memset(p, 0, sizeof(*p));







|







533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
  sbs_store(&p->symTab, pTos->u.str.z, pTos->u.str.size, pNos);
  sbs_value_reset(pTos);
  return 0;
}


/*
** Create a new subscript interpreter
*/
struct Subscript *SbS_Create(void){
  Subscript *p;

  p = malloc( sizeof(*p) );
  if( p ){
    memset(p, 0, sizeof(*p));
Changes to src/tkt.c.
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
static void fetchOriginalValues(void){
  Blob sql;
  Stmt q;
  int i;
  char *zSep = "SELECT ";
  blob_zero(&sql);
  for(i=0; i<nField; i++){
    blob_appendf(&sql, "%s%s", zSep, azField[i]);
    zSep = ", ";
  }
  blob_appendf(" FROM ticket WHERE uuid=%Q", PD("name",""));
  db_prepare(&q, "%b", &sql);
  if( db_step(&q)==SQLITE_ROW ){
    for(i=0; i<nField; i++){
      azValue[i] = db_column_malloc(&q, i);







|







139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
static void fetchOriginalValues(void){
  Blob sql;
  Stmt q;
  int i;
  char *zSep = "SELECT ";
  blob_zero(&sql);
  for(i=0; i<nField; i++){
    blob_appendf(&sql, "%stkt_%s", zSep, azField[i]);
    zSep = ", ";
  }
  blob_appendf(" FROM ticket WHERE uuid=%Q", PD("name",""));
  db_prepare(&q, "%b", &sql);
  if( db_step(&q)==SQLITE_ROW ){
    for(i=0; i<nField; i++){
      azValue[i] = db_column_malloc(&q, i);
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
  };

  pInterp = SbS_Create();
  SbS_AddVerb(pInterp, "setfields", setFieldsCmd, 0);
  zConfig = db_get("ticket-config","");
  SbS_Eval(pInter, zConfig, -1);
  for(i=0; i<sizeof(aVerb)/sizeof(aVerb[0]); i++){

    SbS_AddVerb(pInterp, aVerb[i].zName, aVerb[i].xVerb, 0);

  }
  /* Extract appropriate template */
  return pInterp;
}

/*
** PAGE: tktnew
*/
void tktnew_page(void){
  struct Subscript *pInterp;
  const char *zPage;
  int nPage;

  tkt_screen_init(M_NEW);









  style_header("New Ticket");
  @ This will become a page for entering new tickets.
  style_footer();
}

/*
** PAGE: tktview
** URL: tktview?name=UUID
**
*/
void tktnew_page(void){
















  struct Subscript *pInterp;
  const char *zPage;
  int nPage;

  tkt_screen_init(M_NEW);









  style_header("New Ticket");
  @ This will become a page for entering new tickets.
  style_footer();
}
#endif







>
|
>














>
>
>
>
>
>
>
>
>










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




|
>
>
>
>
>
>
>
>
>
|




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
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
  };

  pInterp = SbS_Create();
  SbS_AddVerb(pInterp, "setfields", setFieldsCmd, 0);
  zConfig = db_get("ticket-config","");
  SbS_Eval(pInter, zConfig, -1);
  for(i=0; i<sizeof(aVerb)/sizeof(aVerb[0]); i++){
    if( flags & aVerb[i].mask ){
      SbS_AddVerb(pInterp, aVerb[i].zName, aVerb[i].xVerb, 0);
    }
  }
  /* Extract appropriate template */
  return pInterp;
}

/*
** PAGE: tktnew
*/
void tktnew_page(void){
  struct Subscript *pInterp;
  const char *zPage;
  int nPage;

  tkt_screen_init(M_NEW);
  if( P("submit")!=0 ){
    // * Construct the ticket artifact
    //    + Prefix
    //    + Field/Value pairs in sorted order
    //    + Suffix
    // * Register the artifact
    // * Update the ticket table
    // * redirect to the ticket viewer
  }
  style_header("New Ticket");
  @ This will become a page for entering new tickets.
  style_footer();
}

/*
** PAGE: tktview
** URL: tktview?name=UUID
**
*/
void tktedit_page(void){
  struct Subscript *pInterp;
  const char *zPage;
  int nPage;

  tkt_screen_init(M_VIEW);
  style_header("View Ticket");
  @ This will become a page for entering new tickets.
  style_footer();
}

/*
** PAGE: tktedit
** URL: tktedit?name=UUID
**
*/
void tktedit_page(void){
  struct Subscript *pInterp;
  const char *zPage;
  int nPage;

  tkt_screen_init(M_EDIT);
  if( P("submit") ){
    // * Construct ticket change artifact
    //   +  Prefix
    //   +  Modified field/value pairs in sorted order
    //   +  Suffix
    // * Register the artifact
    // * Update the ticket table
    // * redirect to the ticket viewer
  }
  style_header("Edit Ticket");
  @ This will become a page for entering new tickets.
  style_footer();
}
#endif