summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0b5894a)
raw | patch | inline | side by side (parent: 0b5894a)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 10 Oct 2005 08:25:31 +0000 (08:25 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 10 Oct 2005 08:25:31 +0000 (08:25 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1541 594d385d-05f5-0310-b6e9-bd551577e9d8
plugins/admin/fai/class_faiPackageNew.inc | [new file with mode: 0644] | patch | blob |
plugins/admin/fai/faiPackageNew.tpl | [new file with mode: 0644] | patch | blob |
diff --git a/plugins/admin/fai/class_faiPackageNew.inc b/plugins/admin/fai/class_faiPackageNew.inc
--- /dev/null
@@ -0,0 +1,190 @@
+<?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 $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 = "<table><tr>";
+ 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 .= "<td><input type='checkbox' name='".$sec."' disabled ".$chk.">".$sec."</td>";
+ }else{
+ $strsec .= "<td><input type='checkbox' name='".$sec."' ".$chk.">".$sec."</td>";
+ }
+ }
+ }
+ $strsec .= "</table>";
+
+ /* 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
--- /dev/null
@@ -0,0 +1,63 @@
+<div style="font-size: 18px;">
+ {t}Repository settings{/t}
+</div>
+<br>
+<p class="seperator">
+{t}To add packages to your package list you have to setup the repository settings first.{/t}
+<br>
+{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}
+<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 prefered release then the section and finally the mirror.{/t}</b>
+<br>
+<br>
+</p>
+<table>
+<tr>
+ <td height="30">
+ <h2>
+ <LABEL for="release">{t}Following releases are available{/t}</LABEL> :
+ </h2>
+ </td>
+ <td>
+ <select name="FAIdebianReleaseS" title="{t}Release{/t}" {$ReleaseACL}>
+ {html_options options=$releases selected=$release}
+ </select>
+ </td>
+</tr>
+<tr>
+ <td height="30">
+ <h2>{t}Sections for this release{/t} : </h2>
+
+ </td>
+ <td>
+ {$sections}
+ </td>
+</tr>
+<tr>
+ <td height="30">
+ <h2><LABEL for="mirror">{t}Matching mirrors{/t}</LABEL> : </h2>
+ </td>
+ <td>
+ <select name="FAIdebianMirrorS" title="{t}mirror{/t}" {$MirrorACL}>
+ {html_options options=$mirrors selected=$mirror}
+ </select>
+ <input type="submit" value="{t}set{/t}" name="SetRepository">
+ </td>
+</tr>
+</table>
+<p class="seperator">
+</p>
+
+<div align="right" style="align:right;">
+ <input name="SaveObjectNew" value="{t}Continue{/t}" type="submit" {$ContinueACL}>
+ <input name="edit_cancel" value="{t}Cancel{/t}" type="submit">
+</div>
+<input type="hidden" name="ignore">
+