From: hickert Date: Mon, 10 Oct 2005 08:25:31 +0000 (+0000) Subject: Added new faiPackage dialog X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=9d65c6803ac680caf592ba298056a301965fd4d5;p=gosa.git Added new faiPackage dialog git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1541 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/admin/fai/class_faiPackageNew.inc b/plugins/admin/fai/class_faiPackageNew.inc new file mode 100644 index 000000000..45ca89db0 --- /dev/null +++ b/plugins/admin/fai/class_faiPackageNew.inc @@ -0,0 +1,190 @@ + "Eins ist toll", "zwei" => "Zwei ist noch besser"); + + /* attribute list for save action */ + var $ignore_account = TRUE; + var $attributes = array(); + var $objectclasses = array(); + + var $mirrors = array(); // The possible mirror,release and section combinations + var $servers = array(); // All available server + var $sections = array(); // All sections + var $releases = array(); // Releases + + var $FAIdebianRelease = ""; // The selected release + var $FAIdebianSection = array(); // selected section + var $FAIdebianMirror = ""; // selected mirror + + + var $obj; + + function faiPackageNew ($config, $dn= NULL,$mirrors,$servers,$sections,$releases) + { + plugin::plugin ($config, $dn); + $this->mirrors = $mirrors; + $this->servers = $servers; + $this->sections = $sections; + $this->releases = $releases; + + foreach($this->sections as $sec){ + $this->sections[$sec] =false; + } + } + + function execute() + { + /* Fill templating stuff */ + $smarty = get_smarty(); + $display = ""; + + // reset grayout options + $disableRelease = false; + $disableMirror = false; + $disableContinue = false; + $disableSection = false; + + /* Post handling for Section, Release and Mirror Setup */ + if(isset($_POST['SetRepository'])){ + if((isset($_POST['FAIdebianReleaseS']))&&(!empty($_POST['FAIdebianReleaseS']))){ + $this->FAIdebianRelease = $_POST['FAIdebianReleaseS']; + } + if((isset($_POST['FAIdebianMirrorS']))&&(!empty($_POST['FAIdebianMirrorS']))){ + $this->FAIdebianMirror = $_POST['FAIdebianMirrorS']; + } + + foreach($this->sections as $sec => $val){ + if(isset($_POST[$sec])){ + $this->sections[$sec]=true; + $this->FAIdebianSection[$sec]=$sec; + }else{ + $this->sections[$sec]=false; + } + } + + } + + /* Grayout settings */ + if(empty($this->FAIdebianRelease)){ + $disableSection = $disableMirror = $disableContinue = true; + }elseif(empty($this->FAIdebianSection)){ + $disableRelease = $disableMirror = $disableContinue = true; + }elseif(empty($this->FAIdebianMirror)){ + $disableRelease = $disableSection = $disableContinue = true; + }else{ + $disableRelease = $disableSection = true; + } + + /* check servers matching release and section settings */ + $availableServer = array(); + foreach($this->mirrors as $mir){ + if($mir['release'] == $this->FAIdebianRelease){ + $pass = true; + foreach($this->FAIdebianSection as $sec){ + if($sec != $mir['section']){ + $pass = false; + } + if($pass){ + $availableServer[$mir['mirror']]=$mir['mirror']; + } + } + } + } + + /* If no servers matching the settings, allow setting release and section again */ + if(($disableMirror==false)&&(count($availableServer)==0)){ + $this->FAIdebianRelease = $this->FAIdebianMirror = ""; + $this->FAIdebianSection = array(); + $disableSection = $disableMirror = $disableContinue = true; + $disableRelease = false; + } + + /* Create checkboxes for the avaliable sections */ + $strsec = ""; + foreach($this->sections as $sec => $val){ + + /* Only add this section if it is supported by the selected release */ + $goon = false; + foreach($this->mirrors as $mir){ + + /* Is there a release with this section ? */ + if((($mir['release'] == $this->FAIdebianRelease )&&($mir['section'] == $sec))){ + $goon = true; + } + } + + if($goon){ + if($this->sections[$sec] == true ){ + $chk = " checked "; + }else{ + $chk = ""; + } + + /* Add disabled if needed */ + if($disableSection){ + $strsec .= ""; + }else{ + $strsec .= ""; + } + } + } + $strsec .= "
".$sec."".$sec."
"; + + /* Add --- to mirror selectbox if it is empty */ + if(count($availableServer)==0){ + $availableServer=array("---"); + } + + /* Tell smarty the grayout settigs */ + $smarty->assign("ReleaseACL" , ""); + $smarty->assign("MirrorACL" , ""); + $smarty->assign("ContinueACL" , ""); + $smarty->assign("SectionACL" , ""); + + if($disableContinue){ + $smarty->assign("ContinueACL"," disabled "); + } + if($disableRelease){ + $smarty->assign("ReleaseACL"," disabled "); + } + if($disableMirror){ + $smarty->assign("MirrorACL"," disabled "); + } + if($disableSection){ + $smarty->assign("SectionACL"," disabled "); + } + + $smarty->assign("mirrors" ,$availableServer); + $smarty->assign("mirror" ,$this->FAIdebianMirror); + $smarty->assign("releases",$this->releases); + $smarty->assign("release" ,$this->FAIdebianRelease); + $smarty->assign("sections",$strsec); + $smarty->assign("section" ,$this->FAIdebianSection); + + $display.= $smarty->fetch(get_template_path('faiPackageNew.tpl', TRUE)); + return($display); + } + + /* Save data to object */ + function save_object() + { + } + + /* Check supplied data */ + function check() + { + $message= array(); + return ($message); + } + + function save() + { + } +} +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/plugins/admin/fai/faiPackageNew.tpl b/plugins/admin/fai/faiPackageNew.tpl new file mode 100644 index 000000000..f4d007908 --- /dev/null +++ b/plugins/admin/fai/faiPackageNew.tpl @@ -0,0 +1,63 @@ +
+ {t}Repository settings{/t} +
+
+

+{t}To add packages to your package list you have to setup the repository settings first.{/t} +
+{t}Packages may be stored on different servers called mirrors. These mirrors have different types of releases (for example woody/sarge), which finaly 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 prefered release then the section and finally the mirror.{/t} +
+
+

+ + + + + + + + + + + + + +
+

+ : +

+
+ +
+

{t}Sections for this release{/t} :

+ +
+ {$sections} +
+

:

+
+ + +
+

  +

+ +
+ + +
+ +