Code

Added Permit Deny field s
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 16 Jun 2005 08:25:51 +0000 (08:25 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 16 Jun 2005 08:25:51 +0000 (08:25 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@732 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_phoneGeneric.inc
plugins/admin/systems/phonesettings.tpl

index 14a467dec0c2541260003561f2af9bd439193fae..b400f0b2f339d12852323073819dfaaa079333ba 100644 (file)
@@ -26,6 +26,8 @@ class phoneGeneric extends plugin
   var $goFonAuth        = "";
   var $goFonSecret      = "";
   var $goFonInkeys      = "";
+  var $goFonPermit      = array();
+  var $goFonDeny        = array();
   var $goFonOutkey      = "";
   var $goFonTrunk       = "";
   var $goFonAccountCode = "";
@@ -36,7 +38,7 @@ class phoneGeneric extends plugin
   var $attributes= array("cn", "description", "macAddress", "ipHostNumber"
                          ,"goFonType","goFonDmtfMode","goFonHost","goFonDefaultIP",
                           "goFonQualify","goFonAuth","goFonSecret","goFonInkeys","goFonOutkey",
-                          "goFonTrunk","goFonAccountCode","goFonMSN","selected_categorie" 
+                          "goFonTrunk","goFonAccountCode","goFonMSN","selected_categorie","goFonPermit","goFonDeny" 
                          );
 
   /* this array defines which attributes are schown / saved for the different type of phones */ 
@@ -46,7 +48,7 @@ class phoneGeneric extends plugin
                              "1"=>array("cn", "description", "macAddress", "ipHostNumber",
                                   "goFonType","goFonHost","goFonDefaultIP",
                                   "goFonQualify","goFonAuth","goFonSecret","goFonInkeys","goFonOutkey",
-                                  "goFonTrunk","goFonAccountCode","selected_categorie"),
+                                  "goFonTrunk","goFonAccountCode","selected_categorie","goFonPermit","goFonDeny"),
                              "2"=>array("cn", "description", "macAddress", "ipHostNumber","goFonMSN"));
   
 
@@ -69,19 +71,28 @@ class phoneGeneric extends plugin
       $this->selected_categorie = 2;
     }elseif($this->goFonAccountCode != ""){
       $this->selected_categorie = 1 ;
+    
+      if(isset($this->attrs['goFonPermit']['count'])){
+        unset ($this->attrs['goFonPermit']['count']);
+        $this->goFonPermit=$this->attrs['goFonPermit'];
+      }  
+     
+      if(isset($this->attrs['goFonDeny']['count'])){
+        unset ($this->attrs['goFonDeny']['count'])   ;
+        $this->goFonDeny=$this->attrs['goFonDeny'];
+      } 
+
     } else {
       $this->selected_categorie = 0;
     }
-    
-    
-
     /* Save dn for later references */
     $this->orig_dn= $this->dn;
   }
 
   function execute()
   {
-  
   
     /* Do we represent a valid phone? */
     if (!$this->is_account && $this->parent == NULL){
@@ -90,6 +101,65 @@ class phoneGeneric extends plugin
       return($display);
     }
 
+    /* handle Permit Add*/
+    if(isset($_POST['goFonPermitAdd'])){
+      if(isset($_POST['goFonPermitNew'])){
+        if(is_string($this->goFonPermit)){
+          $this->goFonPermit=array();
+        }
+        $new = $_POST['goFonPermitNew'];
+        if(strlen($new)> 1) {
+          $this->goFonPermit[]= $new;
+        }
+      }
+    }
+      
+    /* handle Deny Add*/
+    if(isset($_POST['goFonDenyAdd'])){
+      if(isset($_POST['goFonDenyNew'])){
+        if(is_string($this->goFonDeny)){
+          $this->goFonDeny=array();
+        }
+        $new = $_POST['goFonDenyNew'];
+        if(strlen($new)> 1) {
+          $this->goFonDeny[]= $new;
+        }
+      }
+    }
+
+    /* Handle Permit Deletion*/
+    if(isset($_POST['goFonPermitDel'])){
+      if(isset($_POST['goFonPermitS'])){
+        if(is_string($this->goFonPermit)){
+          $this->goFonPermit=array();
+        }
+        $new = $_POST['goFonPermitS'];
+        $tmp = array_flip($this->goFonPermit);
+        unset($tmp[$new]);
+        $this->goFonPermit=array();
+        foreach(array_flip($tmp) as $tm){
+          $this->goFonPermit[]=$tm;
+        }
+      }
+    }
+
+
+    /* Handle Permit Deletion*/
+    if(isset($_POST['goFonDenyDel'])){
+      if(isset($_POST['goFonDenyS'])){
+        if(is_string($this->goFonDeny)){
+          $this->goFonDeny=array();
+        }
+        $new = $_POST['goFonDenyS'];
+        $tmp = array_flip($this->goFonDeny);
+        unset($tmp[$new]);
+        $this->goFonDeny=array();
+        foreach(array_flip($tmp) as $tm){
+          $this->goFonDeny[]=$tm;
+        }
+      }
+    }
+  
     /* Fill templating stuff */
     $smarty= get_smarty();
     $smarty->assign("bases", $this->config->idepartments);
@@ -261,7 +331,7 @@ class phoneGeneric extends plugin
       }
       $this->attrs= $attrs;
     }
-
+    
     /* Write back to ldap */
     $ldap= $this->config->get_ldap_link();
     if ($this->orig_dn == 'new'){
@@ -280,7 +350,6 @@ class phoneGeneric extends plugin
       $this->handle_post_events("modify");
     }
     show_ldap_error($ldap->get_error());
-
     /* Optionally execute a command after we're done */
     $this->postcreate();
   }
index aec9e83338bdef31d4043643fb3e9a3a67c03c5f..271a25f6d3ca37003875e3756b7141f1ed7bfb09 100644 (file)
@@ -2,30 +2,34 @@
 
 <table width="100%" cellpadding=10>
        <tr>
-               <td>
+               <td width="40%">
                        <table width="100%">
                        <tr>
-                               <td width="25%">
+                               <td>
                                        {t}Phone category{/t}{$staticAddress}
                                </td>
-                               <td >
+                               <td>
                                        <select size="1" name="selected_categorie" title="{t}Choose a phone type{/t}" style="width:200px;" onchange="mainform.submit();">
                                                {html_options options=$categories selected=$selected_categorie}
                                        </select>
                                        <input type="submit" value="{t}refresh{/t}" name="refresh">
                                </td>
-                        </tr>
                        </table>
                </td>
+               <td>
+               </td>
        </tr>
+
+{if $selected_categorie eq '0'}
+       
        <tr>
                <td>
-                       <table width="100%">
+                       <table  width="100%">
                         <tr>
                                <td width="25%">
                                        {t}Phone type{/t}{$staticAddress}
                                </td>
-                               <td >
+                               <td>
                                        <select size="1" name="goFonType" title="{t}Choose a phone type{/t}" style="width:200px;" {$goFonTypeUSED}>
                                                {html_options options=$goFonTypes selected=$goFonType}
                                        </select>
                        </tr>
                        </table>
                </td>
-               <td valign="top">
-                       <table width="100%">
-                               <tr>
-                                       <td width="25%">
-                                               {t}Authtype{/t}
-                                       </td>
-                                       <td>
-                                               <select size="1" name="goFonAuth" title="{t}Choose a phone type{/t}" style="width:200px;" {$goFonAuthUSED}>
-                                                       {html_options options=$goFonAuths selected=$goFonAuth}
-                                               </select>
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>    
-                                                {t}GoFonSecret{/t}     
-                                       </td>
-                                       <td>
-                                               <input style="width:200px" name="goFonSecret" value="{$goFonSecret}" {$goFonSecretUSED}>
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>
-                                                {t}GoFonInkeys{/t}
-                                       </td>
-                                       <td>
-                                               <input style="width:200px" name="goFonInkeys" value="{$goFonInkeys}" {$goFonInkeysUSED}>
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>
-                                                {t}GoFonOutKeys{/t}
-                                       </td>
-                                       <td>
-                                               <input style="width:200px" name="goFonOutkey" value="{$goFonOutkey}" {$goFonOutkeyUSED}>
-                                       </td>
-                               </tr>
-                       </table>
+               <td>
                </td>
-       </tr>
+        </tr>
+</table>
+{/if}
+
+{if $selected_categorie eq '1'}
+               
        <tr>
-       <td>
-               <table width="100%">
+               <td>
+                       <table width="100%">
+                        <tr>
+                               <td width="25%">
+                                       {t}Phone type{/t}{$staticAddress}
+                               </td>
+                               <td >
+                                       <select size="1" name="goFonType" title="{t}Choose a phone type{/t}" style="width:200px;" {$goFonTypeUSED}>
+                                               {html_options options=$goFonTypes selected=$goFonType}
+                                       </select>
+                               </td>
+                        </tr>
+                       <tr>
+                               <td >
+                                       {t}Default IP{/t}
+                               </td>
+                               <td>
+                                       <input style="width:200px" name="goFonDefaultIP" value="{$goFonDefaultIP}" {$goFonDefaultIPUSED}>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td >
+                                       {t}Qualify{/t}
+                               </td>
+                               <td>
+                                       <input style="width:200px" name="goFonQualify" value="{$goFonQualify}" {$goFonQualifyUSED}>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td colspan=2>
+                                       &nbsp;                                  
+                               </td>
+                       </tr>
                        <tr>
                                <td width="25%">
-                                       {t}permit / deny {/t}
+                                       {t}Authtype{/t}
+                               </td>
+                               <td>
+                                       <select size="1" name="goFonAuth" title="{t}Choose a phone type{/t}" style="width:200px;" {$goFonAuthUSED}>
+                                               {html_options options=$goFonAuths selected=$goFonAuth}
+                                       </select>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td>    
+                                        {t}GoFonSecret{/t}     
                                </td>
                                <td>
-                                       <input name="notsetyet">
+                                       <input style="width:200px" name="goFonSecret" value="{$goFonSecret}" {$goFonSecretUSED}>
                                </td>
                        </tr>
                        <tr>
                                <td>
-                                       {t}AccountCode {/t}
-        </td>
-        <td>
-                                       <input style="width:200px" name="goFonAccountCode" value="{$goFonAccountCode}" {$goFonAccountCodeUSED}>
+                                        {t}GoFonInkeys{/t}
+                               </td>
+                               <td>
+                                       <input style="width:200px" name="goFonInkeys" value="{$goFonInkeys}" {$goFonInkeysUSED}>
                                </td>
                        </tr>
-               </table>
-       </td>
+                       <tr>
+                               <td>
+                                        {t}GoFonOutKeys{/t}
+                               </td>
+                               <td>
+                                       <input style="width:200px" name="goFonOutkey" value="{$goFonOutkey}" {$goFonOutkeyUSED}>
+                               </td>
+                       </tr>
+                       <tr>
+                <td colspan=2>
+                                       &nbsp;
+                </td>
+            </tr>
+            <tr>
+                <td>
+                    {t}AccountCode {/t}
+                </td>
+                <td>
+                    <input style="width:200px" name="goFonAccountCode" value="{$goFonAccountCode}" {$goFonAccountCodeUSED}>
+                </td>
+            </tr>
+            <tr>
+                <td width="25%">
+                    {t}Trunk several calls{/t}
+                </td>
+                <td>
+                     <select size="1" name="goFonTrunk" title="{t}Choose a phone type{/t}" style="width:200px;" {$goFonTrunkUSED}>
+                        {html_options options=$goFonTrunks selected=$goFonTrunk}
+                     </select>
+                 </td>
+            </tr>
+
+                       </table>
+               </td>
+               <td valign="top">
+                        <table width="100%">
+               <tr>
+                    <td width="25%" align="left" valign="top">
+                        {t}Hosts that are allowed to connect{/t}
+                    </td>
+                    <td style="vertical-align:top;">
+                        <select style="width:300px; height:80px;" name="goFonPermitS" size=15
+                            multiple title="{t}List of alternative mail addresses{/t}">
+                            {html_options values=$goFonPermit output=$goFonPermit}
+                            <option disabled></option>
+                        </select>
+                        <br>
+                            <input name="goFonPermitNew" size=30 align="middle" maxlength="65" value="">
+                        <input type=submit value="{t}Add{/t}" name="goFonPermitAdd"
+                        <input type=submit value="{t}Delete{/t}" name="goFonPermitDel"
+                                               <br><br>
+                    </td>
+                </tr>
+                               <tr>
+                    <td width="25%" align="left" valign="top">
+                        {t}Hosts that are not allowed to connect{/t}
+                    </td>
+                    <td style="vertical-align:top;">
+                        <select style="width:300px; height:80px;" name="goFonDenyS" size=15
+                            multiple title="{t}List of alternative mail addresses{/t}">
+                            {html_options values=$goFonDeny output=$goFonDeny}
+                            <option disabled></option>
+                        </select>
+                        <br>
+                            <input name="goFonDenyNew" size=30 align="middle" maxlength="65" value="">
+                        <input type=submit value="{t}Add{/t}" name="goFonDenyAdd"
+                        <input type=submit value="{t}Delete{/t}" name="goFonDenyDel"
+                    </td>
+                </table>
+               </td>
+    </td>
+    </tr>
+</table>
+{/if}
+
+{if $selected_categorie eq '2'}
+       <tr>
                <td>
                        <table width="100%">
                                <tr>
                                        <td width="25%">
-                                               {t}Trunk several calls{/t}
-                                       </td>
-                                       <td>
-                                               <select size="1" name="goFonTrunk" title="{t}Choose a phone type{/t}" style="width:200px;" {$goFonTrunkUSED}>
-                                                       {html_options options=$goFonTrunks selected=$goFonTrunk}
-                                               </select>
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>
                                                {t}MSN{/t}
                                        </td>
                                        <td>
                                </tr>
                        </table>
                </td>
+               <td>
+                       &nbsp;
+               </td>
        </tr>
 </table>
+{/if}