summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 90cb0cb)
raw | patch | inline | side by side (parent: 90cb0cb)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 11 Jan 2007 12:02:46 +0000 (12:02 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 11 Jan 2007 12:02:46 +0000 (12:02 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@5539 594d385d-05f5-0310-b6e9-bd551577e9d8
plugins/admin/fai/class_faiPackage.inc | patch | blob | history | |
plugins/admin/fai/class_faiPackageNew.inc | [deleted file] | patch | blob | history |
plugins/admin/fai/faiPackageNew.tpl | [deleted file] | patch | blob | history |
index 4dd7ef61f431cfd652150a17dc4e4efe7ed0bbc8..2768e8b404d86118edf2d6182ca40c7d19047aa4 100644 (file)
$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 */
}
/* Generate package list */
- $this->list=$this->genPkgs();
+ $this->list= $this->genPkgs();
/* + was pressed to open the package dialog */
if(isset($_POST['Addpkg'])){
$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
+++ /dev/null
@@ -1,151 +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
+++ /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>
-
- <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">
-</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>
-