From ea8e010c1df42e531cc28da6f31e586e89ee6c64 Mon Sep 17 00:00:00 2001
From: andi <andi@splitbrain.org>
Date: Sat, 5 Feb 2005 20:14:09 +0100
Subject: [PATCH] summary check

darcs-hash:20050205191409-9977f-8060d41d72f5a905ffffa9ae0513f41bd3df9947.gz
---
 inc/html.php |  6 +++---
 script.js    | 16 ++++++++++++++++
 style.css    | 23 ++++++++++++++++-------
 3 files changed, 35 insertions(+), 10 deletions(-)

diff --git a/inc/html.php b/inc/html.php
index 6da31045a..0255670e3 100644
--- a/inc/html.php
+++ b/inc/html.php
@@ -1044,7 +1044,7 @@ function html_edit($text=null,$include='edit'){ //FIXME: include needed?
     </tr>
     <tr>
       <td colspan="3">
-        <textarea name="wikitext" id="wikitext" <?=$ro?> cols="80" rows="10" class="edit" onchange="textChanged = true;" tabindex="1"><?="\n".formText($text)?></textarea>
+        <textarea name="wikitext" id="wikitext" <?=$ro?> cols="80" rows="10" class="edit" onchange="textChanged = true;" onkeyup="summaryCheck();" tabindex="1"><?="\n".formText($text)?></textarea>
       </td>
     </tr>
     <tr>
@@ -1058,7 +1058,7 @@ function html_edit($text=null,$include='edit'){ //FIXME: include needed?
       <td>
       <?if($wr){?>
         <?=$lang['summary']?>:
-        <input type="text" class="edit" name="summary" size="50" value="<?=formText($SUM)?>" tabindex="2" />
+        <input type="text" class="edit" name="summary" id="summary" size="50" onkeyup="summaryCheck();" value="<?=formText($SUM)?>" tabindex="2" />
       <?}?>
       </td>
       <td align="right">
@@ -1153,4 +1153,4 @@ function html_debug(){
   print '</body></html>';
 }
 
-?>
+?>
\ No newline at end of file
diff --git a/script.js b/script.js
index 239f94b07..db22d32b1 100644
--- a/script.js
+++ b/script.js
@@ -30,6 +30,22 @@ function escapeQuotes(text) {
   return text;
 }
 
+/**
+ * Checks if a summary was entered - if not the style is changed
+ *
+ * @author Andreas Gohr <andi@splitbrain.org>
+ */
+function summaryCheck(){
+  if(document.getElementById){
+    var sum = document.getElementById('summary');
+    if(sum.value == ''){
+      sum.className='missing';
+    }else{
+      sum.className='edit';
+    }
+  }
+}
+
 /**
  * This function generates the actual toolbar buttons with localized text
  * we use it to avoid creating the toolbar where javascript is not enabled
diff --git a/style.css b/style.css
index ab730dbdc..93c7c3341 100644
--- a/style.css
+++ b/style.css
@@ -1,4 +1,3 @@
-
 body {
   font: 80% "Lucida Grande", Verdana, Lucida, Helvetica, Arial, sans-serif;
   background-color: White;
@@ -89,6 +88,19 @@ input.edit {
   display: inline;
 }
 
+input.missing {
+  font-size: 100%;
+  border: 1px solid #8cacbb;
+  height: 22px ! important;
+  max-height: 22px ! important;
+  min-height: 22px ! important;
+  color: Black;
+  background-color: #ffcccc;
+  vertical-align: middle;
+  padding: 1px;
+  display: inline;
+}
+
 input.button {
   border: 1px solid #8cacbb;  
   color: Black;
@@ -153,24 +165,21 @@ span.user{
 }
 
 div.error{
-  background: transparent url(images/error.png) 0.5em 0px no-repeat;
-  background-color: #ff6666;
+  background: #ff6666; url(images/error.png) 0.5em 0px no-repeat;
   font-size: 90%;
   margin: 0px;
   padding-left: 3em;
 }
 
 div.info{
-  background: transparent url(images/info.png) 0.5em 0px no-repeat;
-  background-color: #ffff66;
+  background: #ffff66; url(images/info.png) 0.5em 0px no-repeat;
   font-size: 90%;
   margin: 0;
   padding-left: 3em;
 }
 
 div.success{
-  background: transparent url(images/thumbup.gif) 0.5em 0px no-repeat;
-  background-color: #66ff66;
+  background: #66ff66; url(images/thumbup.gif) 0.5em 0px no-repeat;
   font-size: 90%;
   margin: 0;
   padding-left: 3em;
-- 
GitLab