Code

Udpated Comments
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 19 Mar 2007 14:41:42 +0000 (14:41 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 19 Mar 2007 14:41:42 +0000 (14:41 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5823 594d385d-05f5-0310-b6e9-bd551577e9d8

include/sieve/class_sieveElement_Comment.inc
include/sieve/templates/element_comment.tpl

index bad1dce113a80a9b8715f3cf13b6046070aa5f2e..197b3211a9f1ea262280551fb4fedba996400736 100644 (file)
@@ -5,6 +5,7 @@ class sieve_comment
 {
   var $data = "";
   var $object_id= -1;
+  var $small  = TRUE;
 
   function get_sieve_script_part()
   {
@@ -16,7 +17,7 @@ class sieve_comment
     $this->object_id = $object_id;
 
     if($data == NULL){
-      $data = array('ELEMENTS' => array(array('class' => "quoted-string" ,"text" => _("Your comment here"))));
+      $data = array('ELEMENTS' => array(array('class' => "quoted-string" ,"text" => "/*"._("Your comment here")."*/")));
     }
 
     foreach($data['ELEMENTS'] as $node){
@@ -35,12 +36,17 @@ class sieve_comment
       $cm = stripslashes( $_POST['comment_'.$this->object_id]);
       $this->data = "/*".$cm."*/";
     }
+  
+    if(isset($_POST['toggle_small_'.$this->object_id])){
+      $this->small = !$this->small;
+    }
   }
 
   function execute()
   {
     $smarty = get_smarty();
     $smarty->assign("ID", $this->object_id);
+    $smarty->assign("Small", $this->small);
     $object_container = $smarty->fetch(get_template_path("templates/object_container.tpl",TRUE,dirname(__FILE__)));
     $Comment = $this->data;
 
@@ -51,6 +57,10 @@ class sieve_comment
       $Comment = preg_replace("#^\/\*#","",$Comment);
       $Comment = preg_replace("#\*\/$#","",$Comment);
     }
+
+    if($this->small){
+      $Comment = nl2br($Comment);
+    }
  
     /* Create html object */ 
     $smarty = get_smarty();
index 6a52d04e98481b1ec341f52a7a9a1f9467d456e8..c08743922f28b35c9f9404fc354dc17e62bfba8f 100644 (file)
@@ -3,10 +3,21 @@
                <td>
                        <b>{t}Comment{/t}</b>
                </td>
+               <td style='text-align: right;'>
+                       {if $Small}
+                               <input type='submit' name='toggle_small_{$ID}' value='{t}Edit{/t}'>     
+                       {else}
+                               <input type='submit' name='toggle_small_{$ID}' value='{t}Close{/t}'>    
+                       {/if}
+               </td>
        </tr>
        <tr>
-               <td style='padding-left:20px;'>
-                       <textarea  name='comment_{$ID}' style='width:100%;height:30px'>{$Comment}</textarea>
+               <td style='padding-left:20px;' colspan=2>
+               {if $Small}
+                       {$Comment}
+               {else}
+                       <textarea  name='comment_{$ID}' style='width:100%;height:80px'>{$Comment}</textarea>
+               {/if}
                </td>
        </tr>
 </table>