From 5d77b9ebc85c3b26899ca2daa8d7a308ecc69634 Mon Sep 17 00:00:00 2001 From: cajus Date: Thu, 11 Jan 2007 12:02:46 +0000 Subject: [PATCH] Removed in between dialog. It's more or less useless git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@5539 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/admin/fai/class_faiPackage.inc | 68 ++++++---- plugins/admin/fai/class_faiPackageNew.inc | 151 ---------------------- plugins/admin/fai/faiPackageNew.tpl | 53 -------- 3 files changed, 42 insertions(+), 230 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 4dd7ef61f..2768e8b40 100644 --- a/plugins/admin/fai/class_faiPackage.inc +++ b/plugins/admin/fai/class_faiPackage.inc @@ -186,35 +186,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 */ @@ -223,7 +213,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'])){ @@ -587,6 +577,32 @@ class faiPackage extends plugin $this->cn = $_POST['cn']; } } + + 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 b3330346b..000000000 --- a/plugins/admin/fai/class_faiPackageNew.inc +++ /dev/null @@ -1,151 +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