Code

Added patch from 2.5
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 23 Jan 2007 11:20:22 +0000 (11:20 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 23 Jan 2007 11:20:22 +0000 (11:20 +0000)
>Author: cajus
>Date: 2007-01-11 13:02:46 +0100 (Thu, 11 Jan 2007)
>New Revision: 5739
>
>Removed:
>   branches/2.5/plugins/admin/fai/class_faiPackageNew.inc
>   branches/2.5/plugins/admin/fai/faiPackageNew.tpl
>Modified:
>   branches/2.5/plugins/admin/fai/class_faiPackage.inc
>Log:
>Removed in between dialog. It's more or less useless

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5594 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/fai/class_faiPackage.inc
plugins/admin/fai/class_faiPackageNew.inc [deleted file]
plugins/admin/fai/faiPackageNew.tpl [deleted file]

index 144d965803406e29d5348092e0035a52b09fdeb9..c3b84bfe1d63a60b8d17d66c5e44b92695ac33a2 100644 (file)
@@ -177,35 +177,25 @@ class faiPackage extends plugin
 
     $smarty->assign( "FAIinstallMethods", $this->FAIinstallMethods );
 
-    if((!$this->is_account)&&(!$this->newDialogShown)){
-
-      if($this->dialog==NULL){
-        $this->dialog = new faiPackageNew($this->config, $this->dn,$this->mirrors,$this->servers,$this->sections,$this->releases);
-        $this->is_dialog =true;
+    if(!$this->is_account){
+
+      /* Assemble release name */
+      $tmp= preg_replace('/,ou=fai,ou=configs,ou=systems,.*$/', '', $_SESSION['faifilter']['branch']);
+      $tmp= preg_replace('/ou=/', '', $tmp);
+      $rev= array_reverse(split(',', $tmp));
+      $this->FAIdebianRelease= "";
+      foreach ($rev as $part){
+        $this->FAIdebianRelease.= "/$part";
       }
+      $this->FAIdebianRelease= preg_replace('#^/#', '', $this->FAIdebianRelease);
 
-      /* Assign posible changes, for mirror combinations */
-      $this->dialog->save_object();
+      /* Assemble sections */
+      $repos= $this->getServerInfos();
+      $this->FAIdebianSection= $repos[$this->FAIdebianRelease];
+      $this->FAIdebianSection= array_unique($this->FAIdebianSection);
 
       /* Assign Repository settings*/ 
-      if(isset($_POST['SaveObjectNew'])){
-        $obj = $this->dialog->save();
-
-        $this->FAIdebianSection = $obj['FAIdebianSection'];
-        $this->FAIdebianRelease = $obj['FAIdebianRelease'];
-
-        unset($this->dialog);
-        $this->dialog         = false;
-        $this->is_dialog      = false;
-        $this->newDialogShown = true;
-        $this->is_account     = true;
-      }
-
-      /* Draw dialog */
-      if($this->dialog){
-        $display=$this->dialog->execute();
-        return($display); 
-      }
+      $this->is_account     = true;
     }
 
     /* Assign variables */
@@ -214,7 +204,7 @@ class faiPackage extends plugin
     }
 
     /* Generate package list */
-    $this->list=$this->genPkgs();
+    $this->list= $this->genPkgs();
 
     /* + was pressed to open the package dialog */
     if(isset($_POST['Addpkg']) && $this->acl_is_writeable("FAIpackage")){
@@ -545,6 +535,32 @@ class faiPackage extends plugin
             "FAIdebianRelease"  => _("Release")."&nbsp;("._("Readonly").")")
           ));
   }
+
+  function getServerInfos()
+  {
+    $ret = array();
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(objectClass=FAIrepositoryServer)",array("*"));
+    while($attrs = $ldap->fetch()){
+      if(isset($attrs['FAIrepository'])){
+        for($i =0 ; $i < $attrs['FAIrepository']['count']; $i++){
+          $obj = $attrs['FAIrepository'][$i];
+          $tmp = split("\|",$obj);
+          if(count($tmp)==4){
+            foreach(split(",",$tmp[3]) as $sec){
+              if(!empty($sec)){
+                $ret[$tmp[2]][] =  $sec;
+              }
+            }
+          }
+        }
+      }
+    }
+    return($ret);
+  }
+
+
 }
 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
diff --git a/plugins/admin/fai/class_faiPackageNew.inc b/plugins/admin/fai/class_faiPackageNew.inc
deleted file mode 100644 (file)
index 0791fe1..0000000
+++ /dev/null
@@ -1,152 +0,0 @@
-<?php
-
-class faiPackageNew extends plugin
-{
-  /* CLI vars */
-  var $cli_summary        = "Manage server basic objects";
-  var $cli_description    = "Some longer text\nfor help";
-  var $cli_parameters     = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* attribute list for save action */
-  var $ignore_account     = TRUE;
-  var $attributes         = array();
-  var $objectclasses      = array();
-  var $sections           = array(); // All sections
-  var $releases           = array(); // Releases 
-
-  var $FAIdebianRelease   = "";           // The selected release
-  var $FAIdebianSection   = array();      // selected section
-
-  var $obj;
-
-  function faiPackageNew ($config, $dn= NULL)
-  {
-    plugin::plugin ($config, $dn);
-  }
-
-  function execute()
-  {
-         /* Call parent execute */
-         plugin::execute();
-    $display = "";
-    $smarty = get_smarty(); 
-    $atr = $this->getServerInfos(); 
-
-    $releases= array();
-    foreach($atr as $release => $sections){
-      $releases[$release]=$release;
-    }
-    if(!empty($this->FAIdebianRelease)){
-      $sections = $atr[$this->FAIdebianRelease] ;
-    }else{
-      $sections = array();
-    }
-
-    /* Fill templating stuff */
-    if((empty($this->FAIdebianRelease))||(count($this->FAIdebianSection)==0)){
-      $smarty->assign("goon"," disabled ");
-    }else{
-      $smarty->assign("goon"," ");
-    }
-
-    $smarty->assign("releases"    ,$releases);
-    $smarty->assign("release" ,$this->FAIdebianRelease);
-    $smarty->assign("sections",$this->generateSections($sections));
-
-    $display.= $smarty->fetch(get_template_path('faiPackageNew.tpl', TRUE));
-    return($display);
-  }
-
-  function generateSections($secs)
-  {
-    $str = "";
-    if(is_array($secs)){
-      sort($secs);
-      $secs= array_unique($secs);
-      foreach($secs as $section){
-        if(in_array($section,$this->FAIdebianSection)){
-          $str .= "<input type='checkbox' value='".$section."' name='section_".$section."' checked>".$section."<br>";
-        }else{
-          $str .= "<input type='checkbox' value='".$section."' name='section_".$section."'>".$section."<br>";
-        }
-        $str .="<input type='hidden' name='wasOnPage_".$section."'>";
-      }
-    }
-    return($str); 
-  }
-
-  function getServerInfos()
-  {
-    $ret = array();
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(objectClass=FAIrepositoryServer)",array("*"));
-    while($attrs = $ldap->fetch()){
-      if(isset($attrs['FAIrepository'])){
-        for($i =0 ; $i < $attrs['FAIrepository']['count']; $i++){
-          $obj = $attrs['FAIrepository'][$i];
-          $tmp = split("\|",$obj);
-          if(count($tmp)==4){
-            foreach(split(",",$tmp[3]) as $sec){
-              if(!empty($sec)){
-                $ret[$tmp[2]][] =  $sec;
-              }
-            }
-          }
-        } 
-      }
-    }
-    return($ret);
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    /* Post handling for Section, Release  Setup */
-    if(isset($_POST['YesItIsPostedPackages'])){
-
-      if((isset($_POST['FAIdebianReleaseS']))&&(!empty($_POST['FAIdebianReleaseS']))){
-        $this->FAIdebianRelease = $_POST['FAIdebianReleaseS'];
-      }
-        
-      foreach($_POST as $name => $value){
-        if(preg_match("/wasOnPage_/",$name)){
-          $nm = preg_replace("/wasOnPage_/","",$name);
-          if(isset($_POST['section_'.$nm])){
-            $this->FAIdebianSection[$nm] = $nm; 
-          }else{
-            if(isset($this->FAIdebianSection[$nm])){
-              unset($this->FAIdebianSection[$nm]);
-            }
-          }
-        }
-      }
-    }
-    /* Remove all section that are not available at the currently selected server */ 
-    $atr = $this->getServerInfos();
-    foreach($this->FAIdebianSection as $section){
-      if(!in_array($section,$atr[$this->FAIdebianRelease])){
-        unset($this->FAIdebianSection[$section]);
-      }
-    }
-
-  }
-
-  /* Check supplied data */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    return ($message);
-  }
-
-  function save()
-  {
-    return(array("FAIdebianRelease"=>$this->FAIdebianRelease,"FAIdebianSection"=>$this->FAIdebianSection));
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/fai/faiPackageNew.tpl b/plugins/admin/fai/faiPackageNew.tpl
deleted file mode 100644 (file)
index ac6ecb2..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-<h1>{t}Repository settings{/t}</h1>
-<p class="seperator">
-{t}To add packages to your package list you have to setup the repository settings first.{/t}
-<br>
-{t}Packages are usually stored on different servers called mirrors. These mirrors have different types of releases (for example woody/sarge/etch), which finally contain packages sorted by section.{/t}
-<br>
-<br>
-{t}Section and release can't be changed in future dialogs, but the mirror can be changed by editing the entry.{/t}
-<br>
-<br>
-</p>
-<br>
-<p class="seperator"><b>
-{t}First select the preferred release, then the section and finally the mirror.{/t}</b>
-<br>
-<br>
-</p>
-<table summary="">
-<tr>
-       <td height="30">
-               <b><LABEL for="release">{t}Release{/t}</LABEL></b>
-       </td>
-       <td>
-               <select name="FAIdebianReleaseS" title="{t}Release{/t}" onChange='document.mainform.submit();'>
-                       {if $sections eq ""}
-                       <option value="">{t}please choose a release...{/t}</option>
-                       {/if}
-                       {html_options options=$releases selected=$release}
-               </select>
-               &nbsp;
-               <input type="submit" value="{t}Refresh{/t}" name="SetRepository">
-       </td>
-</tr>
-{if $sections ne ""}
-<tr>
-       <td style="vertical-align:top">
-        <b>{t}Sections for this release{/t}</b>
-       </td>
-       <td style="vertical-align:top">
-               {$sections} 
-       </td>
-</tr>
-{/if}
-</table>
-<input type="hidden" name="YesItIsPostedPackages" value="1">
-<p class="seperator" style="margin-bottom:5px">&nbsp;
-</p>
-
-<div align="right" style="align:right;">
-    <input name="SaveObjectNew" value="{t}Continue{/t}" type="submit" {if $sections eq ""}disabled{/if}>
-    <input name="edit_cancel" value="{t}Cancel{/t}" type="submit">
-</div>
-