Code

Added a red border to entries that have a not valid mac address
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 17 Apr 2007 06:56:27 +0000 (06:56 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 17 Apr 2007 06:56:27 +0000 (06:56 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6060 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/addons/gotomasses/class_gotomasses.inc
plugins/addons/gotomasses/contents.tpl

index a8230776f8aad1208e5f1a077a762390f0128261..09e80b8e89414eec28567d86b2768faf03550514 100644 (file)
@@ -82,7 +82,7 @@ class gotomasses extends plugin
 
     /* Add a new empty entry to the list */ 
     if(isset($_POST['add_new_entry'])){
-      $this->contents[] = array("MAC" => "", "OG" => "");
+      $this->contents[] = array("MAC" => "", "OG" => "","VALID_MAC" => FALSE);
     }
 
     /* Call parent execute */
@@ -145,7 +145,7 @@ class gotomasses extends plugin
         $mac = preg_replace("/(,|;).*$/","",$str);
 
         if(!empty($og) || !empty($mac)){
-          $this->contents[] = array("MAC" => $mac , "OG" => $og);
+          $this->contents[] = array("MAC" => $mac , "OG" => $og,"VALID_MAC" => is_mac($mac));
         }
       }
       fclose($fp);
@@ -159,7 +159,7 @@ class gotomasses extends plugin
         $mac = preg_replace("/(,|;).*$/","",$str);
 
         if(!empty($og) || !empty($mac)){
-          $this->contents[] = array("MAC" => $mac , "OG" => $og);
+          $this->contents[] = array("MAC" => $mac , "OG" => $og, "VALID_MAC" => is_mac($mac));
         }
       }
     }
@@ -195,7 +195,8 @@ class gotomasses extends plugin
       $ogs = $this->get_object_groups();
       foreach($this->contents as $id => $data){
         if(isset($_POST['mac_'.$id])){
-          $this->contents[$id]['MAC'] = $_POST['mac_'.$id];
+          $this->contents[$id]['MAC']       = $_POST['mac_'.$id];
+          $this->contents[$id]['VALID_MAC'] = is_mac($_POST['mac_'.$id]);
         }
         if(isset($_POST['og_'.$id]) && in_array_ics($_POST['og_'.$id],$ogs)){
           $this->contents[$id]['OG'] = $_POST['og_'.$id];
index f2d108f58839f293092818d36354909bc7a5fcc1..de4f1e9f4e5462a7d6d0b8e5f06b0e816d07a10d 100644 (file)
 <p>&nbsp;</p>
        <table summary="" width="100%" class="contentboxb" cellspacing=0>
                <tr>
-                       <td>
+                       <td style='width:40px'>
                                <b>{t}No.{/t}</b>
                        </td>
-                       <td>
+                       <td style='width:200px'>
                                <b>{t}Mac address{/t}</b>
                        </td>
-                       <td>
+                       <td>&nbsp;
+                       </td>
+                       <td style='width:40%;'>
                                <b>{t}Object group{/t}</b>
                        </td>
-                       <td style='text-align:right'>
+                       <td style='text-align:right ; width:20%;'>
                                <b>{t}Options{/t}</b>
                        </td>
                </tr>
                        <td>
                                {$key+1}
                        </td>
+
+                       {if !$contents.$key.VALID_MAC}
+                       <td  style='background-color: #FF0000;' >
+                       {else}
+                       <td>
+                       {/if}
+                               <input name='mac_{$key}' type='text' value='{$contents.$key.MAC}' style='width:200px'>
+                       </td>
                        <td>
-                               <input name='mac_{$key}' type='text' value='{$contents.$key.MAC}'>
                        </td>
                        <td>
                                <select name='og_{$key}' title='{t}Select object group{/t}'>
@@ -74,6 +83,9 @@
                        <td>
                                &nbsp;- 
                        </td>
+                       <td>
+                               &nbsp;- 
+                       </td>
                        <td style='text-align:right'>
                                <input type='submit' name='add_new_entry' value='{t}New entry{/t}'>
                        </td>