diff options
author | Tom N Harris <tnharris@whoopdedo.org> | 2007-07-05 23:54:47 +0200 |
---|---|---|
committer | Tom N Harris <tnharris@whoopdedo.org> | 2007-07-05 23:54:47 +0200 |
commit | 8fe3bb00af38a1790e3c2b30eb655fec12e19653 (patch) | |
tree | e0a489dd7b8792290197db1d6ecf0729eed0d6c6 | |
parent | c662a49af623eec4bf6db7067994e2b1aac0f72c (diff) | |
download | rpg-8fe3bb00af38a1790e3c2b30eb655fec12e19653.tar.gz rpg-8fe3bb00af38a1790e3c2b30eb655fec12e19653.tar.bz2 |
correct hilighting of empty summary on preview
darcs-hash:20070705215447-6942e-d3e1124a3cfec6661a7077bc0d9707b156bc2313.gz
-rw-r--r-- | inc/html.php | 15 | ||||
-rw-r--r-- | lib/scripts/edit.js | 1 |
2 files changed, 15 insertions, 1 deletions
diff --git a/inc/html.php b/inc/html.php index 7c7d78ee7..ea71df199 100644 --- a/inc/html.php +++ b/inc/html.php @@ -1047,13 +1047,25 @@ function html_edit($text=null,$include='edit'){ //FIXME: include needed? }else{ $text = rawWiki($ID,$REV); } + $check = md5($text); + $mod = false; }else{ //try to load a pagetemplate $data = array($ID); $text = trigger_event('HTML_PAGE_FROMTEMPLATE',$data,'pageTemplate',true); + $check = md5(''); + $mod = $text!==''; } }else{ $pr = true; //preview mode + if (isset($_REQUEST['changecheck'])) { + $check = $_REQUEST['changecheck']; + $mod = md5($text)!==$check; + } else { + // Why? Assume default text is unmodified. + $check = md5($text); + $mod = false; + } } $wr = $INFO['writable']; @@ -1084,7 +1096,7 @@ function html_edit($text=null,$include='edit'){ //FIXME: include needed? <?php if($wr){?> <script type="text/javascript" charset="utf-8"><!--//--><![CDATA[//><!-- <?php /* sets changed to true when previewed */?> - textChanged = <?php ($pr) ? print 'true' : print 'false' ?>; + textChanged = <?php ($mod) ? print 'true' : print 'false' ?>; //--><!]]></script> <span id="spell__action"></span> <div id="spell__suggest"></div> @@ -1099,6 +1111,7 @@ function html_edit($text=null,$include='edit'){ //FIXME: include needed? <input type="hidden" name="date" value="<?php echo $DATE?>" /> <input type="hidden" name="prefix" value="<?php echo formText($PRE)?>" /> <input type="hidden" name="suffix" value="<?php echo formText($SUF)?>" /> + <input type="hidden" name="changecheck" value="<?php echo $check?>" /> </div> <textarea name="wikitext" id="wiki__text" <?php echo $ro?> cols="80" rows="10" class="edit" tabindex="1"><?php echo "\n".formText($text)?></textarea> diff --git a/lib/scripts/edit.js b/lib/scripts/edit.js index 19e31e2ad..ff32c9676 100644 --- a/lib/scripts/edit.js +++ b/lib/scripts/edit.js @@ -409,6 +409,7 @@ function initChangeCheck(msg){ var summary = document.getElementById('edit__summary'); addEvent(summary, 'change', summaryCheck); addEvent(summary, 'keyup', summaryCheck); + if (textChanged) summaryCheck(); // set focus edit_text.focus(); |