Fossil

Diff
Login

Diff

Differences From Artifact [e4c236d7a2]:

To Artifact [30b6c2143f]:


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
** Generate javascript code that records the parents and children
** of the version rid.
*/
static int save_parentage_javascript(int rid, Blob *pOut){
  const char *zSep;
  Stmt q;

  db_prepare(&q, "SELECT pid FROM plink WHERE cid=%d AND isprim!=0", rid);
  zSep = "";
  blob_appendf(pOut, "parentof[\"m%d\"] = [", rid);
  while( db_step(&q)==SQLITE_ROW ){
    int pid = db_column_int(&q, 0);
    blob_appendf(pOut, "%s\"m%d\"", zSep, pid);
    zSep = ",";
  }
  db_finalize(&q);
  blob_appendf(pOut, "];\n");
  db_prepare(&q, "SELECT cid FROM plink WHERE pid=%d AND isprim!=0", rid);
  zSep = "";
  blob_appendf(pOut, "childof[\"m%d\"] = [", rid);
  while( db_step(&q)==SQLITE_ROW ){
    int pid = db_column_int(&q, 0);
    blob_appendf(pOut, "%s\"m%d\"", zSep, pid);
    zSep = ",";
  }







|









|







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
** Generate javascript code that records the parents and children
** of the version rid.
*/
static int save_parentage_javascript(int rid, Blob *pOut){
  const char *zSep;
  Stmt q;

  db_prepare(&q, "SELECT pid FROM plink WHERE cid=%d", rid);
  zSep = "";
  blob_appendf(pOut, "parentof[\"m%d\"] = [", rid);
  while( db_step(&q)==SQLITE_ROW ){
    int pid = db_column_int(&q, 0);
    blob_appendf(pOut, "%s\"m%d\"", zSep, pid);
    zSep = ",";
  }
  db_finalize(&q);
  blob_appendf(pOut, "];\n");
  db_prepare(&q, "SELECT cid FROM plink WHERE pid=%d", rid);
  zSep = "";
  blob_appendf(pOut, "childof[\"m%d\"] = [", rid);
  while( db_step(&q)==SQLITE_ROW ){
    int pid = db_column_int(&q, 0);
    blob_appendf(pOut, "%s\"m%d\"", zSep, pid);
    zSep = ",";
  }
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
  blob_reset(&scriptInit);
  @ function setall(value){
  @   for(var x in parentof){
  @     setone(x,value);
  @   }
  @ }
  @ function setone(id, onoff){

  @   var w = document.getElementById(id);
  @   if( onoff==1 ){
  @     w.style.color = "#000000";

  @   }else{
  @     w.style.color = "#a0a0a0";

  @   }
  @ }
  @ function xin(id) {
  @   setall(0);
  @   setone(id,1);
  @   set_children(id);
  @   set_parents(id);
  @ }
  @ function xout(id) {
  @   setall(1);
  @ }
  @ function set_parents(id){

  @   if( parentof[id]==null ) return;
  @   for(var x in parentof[id]){
  @     var pid = parentof[id][x];
  @     setone(pid,1);
  @     set_parents(pid);

  @   }
  @ }
  @ function set_children(id){

  @   if( childof[id]==null ) return;
  @   for(var x in childof[id]){
  @     var cid = childof[id][x];
  @     setone(cid,1);
  @     set_children(cid);

  @   }
  @ }
  @ function hilite(id) {
  @   var x = document.getElementById(id);
  @   x.style.backgroundColor = "#e0e0ff";
  @ }
  @ function unhilite(id) {







>

|
|
>

|
>












>
|
|
|
|
|
>



>
|
|
|
|
|
>







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
  blob_reset(&scriptInit);
  @ function setall(value){
  @   for(var x in parentof){
  @     setone(x,value);
  @   }
  @ }
  @ function setone(id, onoff){
  @   if( parentof[id]==null ) return 0;
  @   var w = document.getElementById(id);
  @   var clr = onoff==1 ? "#000000" : "#a0a0a0";
  @   if( w.style.color==clr ){
  @     return 0
  @   }else{
  @     w.style.color = clr
  @     return 1
  @   }
  @ }
  @ function xin(id) {
  @   setall(0);
  @   setone(id,1);
  @   set_children(id);
  @   set_parents(id);
  @ }
  @ function xout(id) {
  @   setall(1);
  @ }
  @ function set_parents(id){
  @   var plist = parentof[id];
  @   if( plist==null ) return;
  @   for(var x in plist){
  @     var pid = plist[x];
  @     if( setone(pid,1)==1 ){
  @       set_parents(pid);
  @     }
  @   }
  @ }
  @ function set_children(id){
  @   var clist = childof[id];
  @   if( clist==null ) return;
  @   for(var x in clist){
  @     var cid = clist[x];
  @     if( setone(cid,1)==1 ){
  @       set_children(cid);
  @     }
  @   }
  @ }
  @ function hilite(id) {
  @   var x = document.getElementById(id);
  @   x.style.backgroundColor = "#e0e0ff";
  @ }
  @ function unhilite(id) {