Changes On Branch side-by-side-edit
Not logged in

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

Changes In Branch side-by-side-edit Excluding Merge-Ins

This is equivalent to a diff from 42f4d14771 to 396eceb9e4

2012-04-30
09:33
When sided by side make the text area small so it will always fit in the column. After page loaded enlarge the text area with Javascript. But leave a little room (40px) as a margin between the two columns. This insurers that side by side always succeeds. Leaf check-in: 396eceb9e4 user: renez tags: side-by-side-edit
2012-04-29
16:54
Remove appropriate "ckout:" records from the config table when closing a checkout. Do not attempt to modify the repository with "ckout:" records if the repository is read-only. check-in: 02051489a0 user: drh tags: trunk
13:07
Put wrap="virtual" back in textarea Increase the height of the textarea to the height of the preview div. check-in: ead316f3f7 user: renez tags: side-by-side-edit
04:54
Create new branch named "side-by-side-edit" check-in: 68a8a7e925 user: renez tags: side-by-side-edit
2012-04-28
22:42
Add the "fossil all changes" command to show all check-outs with uncommitted changes. Also add the "fossil all list --ckout" option to show all current checkouts rather than all repositories. check-in: 42f4d14771 user: drh tags: trunk
18:55
Change the name of the auto-enable-hyperlinks setting to auto-hyperlink and make it available via the "fossil setting" command. <b>Note:</b> when upgrading through this change, if you formerly had auto-hyperlink turned off, you will have to turn it off again since the name has changed. It defaults to on. check-in: cb5db7598f user: drh tags: trunk

Changes to src/cgi.c.

812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
    g.zIpAddr = mprintf("%s", z);
  }

  len = atoi(PD("CONTENT_LENGTH", "0"));
  g.zContentType = zType = P("CONTENT_TYPE");
  if( len>0 && zType ){
    blob_zero(&g.cgiIn);
    if( fossil_strcmp(zType,"application/x-www-form-urlencoded")==0 
         || strncmp(zType,"multipart/form-data",19)==0 ){
      z = fossil_malloc( len+1 );
      len = fread(z, 1, len, g.httpIn);
      z[len] = 0;
      if( zType[0]=='a' ){
        add_param_list(z, '&');
      }else{







|







812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
    g.zIpAddr = mprintf("%s", z);
  }

  len = atoi(PD("CONTENT_LENGTH", "0"));
  g.zContentType = zType = P("CONTENT_TYPE");
  if( len>0 && zType ){
    blob_zero(&g.cgiIn);
    if( strncmp(zType,"application/x-www-form-urlencoded",33)==0 
         || strncmp(zType,"multipart/form-data",19)==0 ){
      z = fossil_malloc( len+1 );
      len = fread(z, 1, len, g.httpIn);
      z[len] = 0;
      if( zType[0]=='a' ){
        add_param_list(z, '&');
      }else{

Changes to src/wiki.c.

256
257
258
259
260
261
262

263
264
265
266
267
268
269
  int rid = 0;
  int isSandbox;
  Blob wiki;
  Manifest *pWiki = 0;
  const char *zPageName;
  char *zHtmlPageName;
  int n;

  const char *z;
  char *zBody = (char*)P("w");

  if( zBody ){
    zBody = mprintf("%s", zBody);
  }
  login_check_credentials();







>







256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
  int rid = 0;
  int isSandbox;
  Blob wiki;
  Manifest *pWiki = 0;
  const char *zPageName;
  char *zHtmlPageName;
  int n;
  int ss;
  const char *z;
  char *zBody = (char*)P("w");

  if( zBody ){
    zBody = mprintf("%s", zBody);
  }
  login_check_credentials();
334
335
336
337
338
339
340









341
342
343
344
345
346
347

348
349
350
351
352
353










354
355
356



357



358
359

360

361
362


363

















































































































364
365
366
























367
368
369
370
371
372
373
    return;
  }
  if( zBody==0 ){
    zBody = mprintf("<i>Empty Page</i>");
  }
  zHtmlPageName = mprintf("Edit: %s", zPageName);
  style_header(zHtmlPageName);









  if( P("preview")!=0 ){
    blob_zero(&wiki);
    blob_append(&wiki, zBody, -1);
    @ Preview:<hr />
    wiki_convert(&wiki, 0, 0);
    @ <hr />
    blob_reset(&wiki);

  }
  for(n=2, z=zBody; z[0]; z++){
    if( z[0]=='\n' ) n++;
  }
  if( n<20 ) n = 20;
  if( n>40 ) n = 40;










  @ <form method="post" action="%s(g.zTop)/wikiedit"><div>
  login_insert_csrf_secret();
  @ <input type="hidden" name="name" value="%h(zPageName)" />



  @ <textarea name="w" class="wikiedit" cols="80" 



  @  rows="%d(n)" wrap="virtual">%h(zBody)</textarea>
  @ <br />

  @ <input type="submit" name="preview" value="Preview Your Changes" />

  @ <input type="submit" name="submit" value="Apply These Changes" />
  @ <input type="submit" name="cancel" value="Cancel" />


  @ </div></form>

















































































































  manifest_destroy(pWiki);
  style_footer();
}

























/*
** WEBPAGE: wikinew
** URL /wikinew
**
** Prompt the user to enter the name of a new wiki page.  Then redirect
** to the wikiedit screen for that new page.







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






>
>
>
>
>
>
>
>
>
>
|


>
>
>
|
>
>
>
|

>
|
>


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



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







335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
    return;
  }
  if( zBody==0 ){
    zBody = mprintf("<i>Empty Page</i>");
  }
  zHtmlPageName = mprintf("Edit: %s", zPageName);
  style_header(zHtmlPageName);
  ss = 0;
  if(P("ss")) ss = atoi(P("ss"));
  if( P("ssb")!=0 ){
      ss= ss ? 0 : 1;
  }
  if(ss){
    blob_zero(&wiki);
    blob_append(&wiki, zBody, -1);
  } else {
    if( P("preview")!=0 ){
      blob_zero(&wiki);
      blob_append(&wiki, zBody, -1);
      @ Preview:<hr />
      wiki_convert(&wiki, 0, 0);
      @ <hr />
      blob_reset(&wiki);
    }
  }
  for(n=2, z=zBody; z[0]; z++){
    if( z[0]=='\n' ) n++;
  }
  if( n<20 ) n = 20;
  if( n>40 ) n = 40;

  if(ss){
    @ <div id="twocolumns" style="width: 100%%;overflow:hidden">
    @ <div id="colright" style="display:block;float:right;width:50%%;">
    @ <div><h3>Preview</h3></div><div id="previewdiv">
    wiki_convert(&wiki, 0, 0);
    blob_reset(&wiki);
    @ </div></div>
    @ <div id="colleft" style="width:50%%;">
  }
  @ <form method="POST" action="%s(g.zTop)/wikiedit">
  login_insert_csrf_secret();
  @ <input type="hidden" name="name" value="%h(zPageName)" />
  @ <div>  <input type="submit" id="ssb" name="ssb" value="Toggle Side-by-side" />
  @ </div><input type="hidden" name="ss" value="%d(ss)" />
  if(ss){
    @ <textarea id="w" name="w" class="wikiedit" cols="20" rows="5"
  } else {
    @ <textarea id="w" name="w" class="wikiedit" cols="60" rows="%d(n)"
  }
  @   wrap="virtual">%h(zBody)</textarea>
  @ <br />
  if(!ss){
    @ <input type="submit" name="preview" value="Preview Your Changes" />
  }
  @ <input type="submit" name="submit" value="Apply These Changes" />
  @ <input type="submit" name="cancel" value="Cancel" />
  @ </form>
  if(ss){
    @ </div>
    @ <script type='text/javascript'>
    @ function ajax(u,a,cb,errcb){
    @   var _url = u;
    @   var _method ='POST';
    @   var _async = a;
    @   var _userCallback = cb ;
    @   var _defError = function(s,t){ alert('Ajax err('+s+') : '+t);} ;
    @   var _errorCallback = errcb === undefined ? _defError : errcb;
    @ 
    @   var _starting; 
    @   var _request = false; 
    @   var _debug = false; 
    @   var _busy = function(){
    @                 return (0 < _request.readyState && 4 > _request.readyState);
    @               } 
    @   
    @  if (window.XMLHttpRequest){ // Non-IE browsers
    @     _request = new XMLHttpRequest();
    @    } else if (window.ActiveXObject) { // IE
    @     try {
    @       _request = new ActiveXObject("Msxml2.XMLHTTP");
    @     } catch(e) {
    @       try {
    @         _request = new ActiveXObject("Microsoft.XMLHTTP");
    @       } catch(E) {
    @         _request = false;
    @       }
    @     }
    @   } else {
    @     _request = false;
    @     _errrorCallback(-1,'Ajax not available!');
    @   }
    @   var _callback =function(){
    @     if(4 == _request.readyState){
    @       if(200 == _request.status) {
    @         if(_debug){
    @           var _ending = new Date();
    @           var sec = (_ending.getTime() - _starting.getTime())/1000;
    @           alert(sec+" seconds. Callback with text\n "+_request.responseText);
    @         }
    @         _userCallback(_request.responseText,_request.responseXML);
    @       } else {
    @         _errorCallback(_request.status,_request.status);
    @       }
    @     }
    @   }
    @   this.abort = function(){ if(_busy()) {_request.abort(); } }
    @   this.setDebug = function(onOff){ _debug = onOff;} 
    @   this.setMethod = function(onOff){ _method = onOff ? 'POST' : 'GET' ; }
    @   this.setUrl = function(u){ _url = u; }
    @   this.setAsync = function(onOff){ _async = onOff; }
    @   this.send = function(data){
    @     if(_debug) alert("in send function\nurl: "+_url
    @           +"\nmethode "+_method
    @           +"\nAsync "+_async
    @           //+"\ndata "+data
    @         );
    @     if(_busy()){
    @       if(_debug) alert('call in progress');
    @       return 1;
    @     }
    @     try {
    @       _starting = new Date();
    @       _request.open(_method,_url,_async)
    @       if(_async)
    @         _request.onreadystatechange = _callback;
    @       _request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    @       _request.send(data);
    @       if(!_async){
    @         _callback();
    @         return _request.status;
    @       }
    @     } catch (e) {
    @       _request.abort();
    @     }
    @   }
    @ }
    @ x = new ajax("%s(g.zTop)/wikipreview",true,cb)
    @ //x.setDebug(true)
    @ 
    @ var sto  = 10000
    @ window.ta = document.getElementById('w')
    @ window.ta.onkeydown= changed; 
    @ window.onload = pageLoaded
    @ window.prvw = document.getElementById('previewdiv')
    @ window.isChanged
    @ function cb(text,xml){
    @   window.prvw.innerHTML = text;
    @   return true;
    @ }
    @ function preview(){
    @   if(window.isChanged){
    @     window.isChanged =0
    @     x.send("w="+encodeURIComponent(window.ta.value))
    @   }
    @   setTimeout(preview,sto)
    @ }
    @ function pageLoaded(e){
    @   if( window.ta.offsetWidth<window.prvw.offsetWidth ){
    @     window.ta.style.width=(window.prvw.offsetWidth-40)+"px"
    @   }
    @   if( window.ta.offsetHeight<window.prvw.offsetHeight ){
    @     window.ta.style.height=window.prvw.offsetHeight+"px"
    @   }
    @   window.isChanged =0
    @   setTimeout(preview,sto)
    @ }
    @ function changed(e){
    @   window.isChanged++
    @   return true
    @ }
    @ </script>
  }
  manifest_destroy(pWiki);
  style_footer();
}

/*
** WEBPAGE: wikipreview
** URL: /wikipreview
**
** render the contents of w
** for use with Ajax. This is NOT
** a complete web-page!
*/
void wikipreview_page(void){
  Blob wiki;
  char *zBody = (char*)P("w");
  if( zBody ){
    zBody = mprintf("%s", zBody);
  }
  login_check_credentials();
  if( zBody==0 ){
    zBody = mprintf("<i>Empty Page</i>");
  }
  blob_zero(&wiki);
  blob_append(&wiki, zBody, -1);
  wiki_convert(&wiki, 0, 0);
  blob_reset(&wiki);
}

/*
** WEBPAGE: wikinew
** URL /wikinew
**
** Prompt the user to enter the name of a new wiki page.  Then redirect
** to the wikiedit screen for that new page.