From ec0bde472f1cffbc3bff85e4ff4d4e65d6955301 Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 23 Jan 2007 11:20:22 +0000 Subject: [PATCH] Added patch from 2.5 >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 | 68 ++++++---- plugins/admin/fai/class_faiPackageNew.inc | 152 ---------------------- plugins/admin/fai/faiPackageNew.tpl | 53 -------- 3 files changed, 42 insertions(+), 231 deletions(-) delete mode 100644 plugins/admin/fai/class_faiPackageNew.inc delete mode 100644 plugins/admin/fai/faiPackageNew.tpl diff --git a/plugins/admin/fai/class_faiPackage.inc b/plugins/admin/fai/class_faiPackage.inc index 144d96580..c3b84bfe1 100644 --- a/plugins/admin/fai/class_faiPackage.inc +++ b/plugins/admin/fai/class_faiPackage.inc @@ -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")." ("._("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 index 0791fe11d..000000000 --- a/plugins/admin/fai/class_faiPackageNew.inc +++ /dev/null @@ -1,152 +0,0 @@ - "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 .= "".$section."
"; - }else{ - $str .= "".$section."
"; - } - $str .=""; - } - } - 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 index ac6ecb271..000000000 --- a/plugins/admin/fai/faiPackageNew.tpl +++ /dev/null @@ -1,53 +0,0 @@ -

{t}Repository settings{/t}

-

-{t}To add packages to your package list you have to setup the repository settings first.{/t} -
-{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} -
-
-{t}Section and release can't be changed in future dialogs, but the mirror can be changed by editing the entry.{/t} -
-
-

-
-

-{t}First select the preferred release, then the section and finally the mirror.{/t} -
-
-

- - - - - -{if $sections ne ""} - - - - -{/if} -
- - - -   - -
- {t}Sections for this release{/t} - - {$sections} -
- -

  -

- -
- - -
- -- 2.30.2