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. Note: 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 812 g.zIpAddr = mprintf("%s", z); 813 813 } 814 814 815 815 len = atoi(PD("CONTENT_LENGTH", "0")); 816 816 g.zContentType = zType = P("CONTENT_TYPE"); 817 817 if( len>0 && zType ){ 818 818 blob_zero(&g.cgiIn); 819 - if( fossil_strcmp(zType,"application/x-www-form-urlencoded")==0 819 + if( strncmp(zType,"application/x-www-form-urlencoded",33)==0 820 820 || strncmp(zType,"multipart/form-data",19)==0 ){ 821 821 z = fossil_malloc( len+1 ); 822 822 len = fread(z, 1, len, g.httpIn); 823 823 z[len] = 0; 824 824 if( zType[0]=='a' ){ 825 825 add_param_list(z, '&'); 826 826 }else{
Changes to src/wiki.c.
256 256 int rid = 0; 257 257 int isSandbox; 258 258 Blob wiki; 259 259 Manifest *pWiki = 0; 260 260 const char *zPageName; 261 261 char *zHtmlPageName; 262 262 int n; 263 + int ss; 263 264 const char *z; 264 265 char *zBody = (char*)P("w"); 265 266 266 267 if( zBody ){ 267 268 zBody = mprintf("%s", zBody); 268 269 } 269 270 login_check_credentials(); ................................................................................ 334 335 return; 335 336 } 336 337 if( zBody==0 ){ 337 338 zBody = mprintf("<i>Empty Page</i>"); 338 339 } 339 340 zHtmlPageName = mprintf("Edit: %s", zPageName); 340 341 style_header(zHtmlPageName); 341 - if( P("preview")!=0 ){ 342 + ss = 0; 343 + if(P("ss")) ss = atoi(P("ss")); 344 + if( P("ssb")!=0 ){ 345 + ss= ss ? 0 : 1; 346 + } 347 + if(ss){ 342 348 blob_zero(&wiki); 343 349 blob_append(&wiki, zBody, -1); 344 - @ Preview:<hr /> 345 - wiki_convert(&wiki, 0, 0); 346 - @ <hr /> 347 - blob_reset(&wiki); 350 + } else { 351 + if( P("preview")!=0 ){ 352 + blob_zero(&wiki); 353 + blob_append(&wiki, zBody, -1); 354 + @ Preview:<hr /> 355 + wiki_convert(&wiki, 0, 0); 356 + @ <hr /> 357 + blob_reset(&wiki); 358 + } 348 359 } 349 360 for(n=2, z=zBody; z[0]; z++){ 350 361 if( z[0]=='\n' ) n++; 351 362 } 352 363 if( n<20 ) n = 20; 353 364 if( n>40 ) n = 40; 354 - @ <form method="post" action="%s(g.zTop)/wikiedit"><div> 365 + 366 + if(ss){ 367 + @ <div id="twocolumns" style="width: 100%%;overflow:hidden"> 368 + @ <div id="colright" style="display:block;float:right;width:50%%;"> 369 + @ <div><h3>Preview</h3></div><div id="previewdiv"> 370 + wiki_convert(&wiki, 0, 0); 371 + blob_reset(&wiki); 372 + @ </div></div> 373 + @ <div id="colleft" style="width:50%%;"> 374 + } 375 + @ <form method="POST" action="%s(g.zTop)/wikiedit"> 355 376 login_insert_csrf_secret(); 356 377 @ <input type="hidden" name="name" value="%h(zPageName)" /> 357 - @ <textarea name="w" class="wikiedit" cols="80" 358 - @ rows="%d(n)" wrap="virtual">%h(zBody)</textarea> 378 + @ <div> <input type="submit" id="ssb" name="ssb" value="Toggle Side-by-side" /> 379 + @ </div><input type="hidden" name="ss" value="%d(ss)" /> 380 + if(ss){ 381 + @ <textarea id="w" name="w" class="wikiedit" cols="20" rows="5" 382 + } else { 383 + @ <textarea id="w" name="w" class="wikiedit" cols="60" rows="%d(n)" 384 + } 385 + @ wrap="virtual">%h(zBody)</textarea> 359 386 @ <br /> 360 - @ <input type="submit" name="preview" value="Preview Your Changes" /> 387 + if(!ss){ 388 + @ <input type="submit" name="preview" value="Preview Your Changes" /> 389 + } 361 390 @ <input type="submit" name="submit" value="Apply These Changes" /> 362 391 @ <input type="submit" name="cancel" value="Cancel" /> 363 - @ </div></form> 392 + @ </form> 393 + if(ss){ 394 + @ </div> 395 + @ <script type='text/javascript'> 396 + @ function ajax(u,a,cb,errcb){ 397 + @ var _url = u; 398 + @ var _method ='POST'; 399 + @ var _async = a; 400 + @ var _userCallback = cb ; 401 + @ var _defError = function(s,t){ alert('Ajax err('+s+') : '+t);} ; 402 + @ var _errorCallback = errcb === undefined ? _defError : errcb; 403 + @ 404 + @ var _starting; 405 + @ var _request = false; 406 + @ var _debug = false; 407 + @ var _busy = function(){ 408 + @ return (0 < _request.readyState && 4 > _request.readyState); 409 + @ } 410 + @ 411 + @ if (window.XMLHttpRequest){ // Non-IE browsers 412 + @ _request = new XMLHttpRequest(); 413 + @ } else if (window.ActiveXObject) { // IE 414 + @ try { 415 + @ _request = new ActiveXObject("Msxml2.XMLHTTP"); 416 + @ } catch(e) { 417 + @ try { 418 + @ _request = new ActiveXObject("Microsoft.XMLHTTP"); 419 + @ } catch(E) { 420 + @ _request = false; 421 + @ } 422 + @ } 423 + @ } else { 424 + @ _request = false; 425 + @ _errrorCallback(-1,'Ajax not available!'); 426 + @ } 427 + @ var _callback =function(){ 428 + @ if(4 == _request.readyState){ 429 + @ if(200 == _request.status) { 430 + @ if(_debug){ 431 + @ var _ending = new Date(); 432 + @ var sec = (_ending.getTime() - _starting.getTime())/1000; 433 + @ alert(sec+" seconds. Callback with text\n "+_request.responseText); 434 + @ } 435 + @ _userCallback(_request.responseText,_request.responseXML); 436 + @ } else { 437 + @ _errorCallback(_request.status,_request.status); 438 + @ } 439 + @ } 440 + @ } 441 + @ this.abort = function(){ if(_busy()) {_request.abort(); } } 442 + @ this.setDebug = function(onOff){ _debug = onOff;} 443 + @ this.setMethod = function(onOff){ _method = onOff ? 'POST' : 'GET' ; } 444 + @ this.setUrl = function(u){ _url = u; } 445 + @ this.setAsync = function(onOff){ _async = onOff; } 446 + @ this.send = function(data){ 447 + @ if(_debug) alert("in send function\nurl: "+_url 448 + @ +"\nmethode "+_method 449 + @ +"\nAsync "+_async 450 + @ //+"\ndata "+data 451 + @ ); 452 + @ if(_busy()){ 453 + @ if(_debug) alert('call in progress'); 454 + @ return 1; 455 + @ } 456 + @ try { 457 + @ _starting = new Date(); 458 + @ _request.open(_method,_url,_async) 459 + @ if(_async) 460 + @ _request.onreadystatechange = _callback; 461 + @ _request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 462 + @ _request.send(data); 463 + @ if(!_async){ 464 + @ _callback(); 465 + @ return _request.status; 466 + @ } 467 + @ } catch (e) { 468 + @ _request.abort(); 469 + @ } 470 + @ } 471 + @ } 472 + @ x = new ajax("%s(g.zTop)/wikipreview",true,cb) 473 + @ //x.setDebug(true) 474 + @ 475 + @ var sto = 10000 476 + @ window.ta = document.getElementById('w') 477 + @ window.ta.onkeydown= changed; 478 + @ window.onload = pageLoaded 479 + @ window.prvw = document.getElementById('previewdiv') 480 + @ window.isChanged 481 + @ function cb(text,xml){ 482 + @ window.prvw.innerHTML = text; 483 + @ return true; 484 + @ } 485 + @ function preview(){ 486 + @ if(window.isChanged){ 487 + @ window.isChanged =0 488 + @ x.send("w="+encodeURIComponent(window.ta.value)) 489 + @ } 490 + @ setTimeout(preview,sto) 491 + @ } 492 + @ function pageLoaded(e){ 493 + @ if( window.ta.offsetWidth<window.prvw.offsetWidth ){ 494 + @ window.ta.style.width=(window.prvw.offsetWidth-40)+"px" 495 + @ } 496 + @ if( window.ta.offsetHeight<window.prvw.offsetHeight ){ 497 + @ window.ta.style.height=window.prvw.offsetHeight+"px" 498 + @ } 499 + @ window.isChanged =0 500 + @ setTimeout(preview,sto) 501 + @ } 502 + @ function changed(e){ 503 + @ window.isChanged++ 504 + @ return true 505 + @ } 506 + @ </script> 507 + } 364 508 manifest_destroy(pWiki); 365 509 style_footer(); 366 510 } 511 + 512 +/* 513 +** WEBPAGE: wikipreview 514 +** URL: /wikipreview 515 +** 516 +** render the contents of w 517 +** for use with Ajax. This is NOT 518 +** a complete web-page! 519 +*/ 520 +void wikipreview_page(void){ 521 + Blob wiki; 522 + char *zBody = (char*)P("w"); 523 + if( zBody ){ 524 + zBody = mprintf("%s", zBody); 525 + } 526 + login_check_credentials(); 527 + if( zBody==0 ){ 528 + zBody = mprintf("<i>Empty Page</i>"); 529 + } 530 + blob_zero(&wiki); 531 + blob_append(&wiki, zBody, -1); 532 + wiki_convert(&wiki, 0, 0); 533 + blob_reset(&wiki); 534 +} 367 535 368 536 /* 369 537 ** WEBPAGE: wikinew 370 538 ** URL /wikinew 371 539 ** 372 540 ** Prompt the user to enter the name of a new wiki page. Then redirect 373 541 ** to the wikiedit screen for that new page.