summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a870a3c)
raw | patch | inline | side by side (parent: a870a3c)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 6 Oct 2005 07:57:56 +0000 (07:57 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 6 Oct 2005 07:57:56 +0000 (07:57 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1497 594d385d-05f5-0310-b6e9-bd551577e9d8
plugins/admin/fai/class_faiPackageEntry.inc | [new file with mode: 0644] | patch | blob |
plugins/admin/fai/faiPackageEntry.tpl | [new file with mode: 0644] | patch | blob |
diff --git a/plugins/admin/fai/class_faiPackageEntry.inc b/plugins/admin/fai/class_faiPackageEntry.inc
--- /dev/null
@@ -0,0 +1,173 @@
+<?php
+
+class faiPackageEntry 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 $strID = "";
+
+ var $buffer = array();
+ var $categories = array();
+ var $searchStr = "*";
+
+ /* Array with available class names */
+ var $FAIAllclasses = array();
+
+ function faiPackageEntry ($config, $dn= NULL,$strID=false)
+ {
+ plugin::plugin ($config, $dn);
+ $this->strID = $strID;
+
+ }
+
+ function execute()
+ {
+ /* Fill templating stuff */
+ $smarty = get_smarty();
+ $display = "";
+
+ $divlist = new divlist("PackageEntry");
+ $divlist->SetSummary(_("This list displays all assigned package names for this repository settings."));
+ $divlist->SetEntriesPerPage(20);
+ $divlist->SetHeader(array(array("string"=>" "),
+ array("string"=>"Name"),
+ array("string"=>"Version"),
+ array("string"=>"Description")));
+
+ if(isset($_GET['search'])){
+ $this->searchStr= $_GET['search']."*";
+ }
+
+ $pkgs = $this->genPkgs();
+ foreach($pkgs as $cat => $entries){
+ if(!isset($this->categories[$cat])){
+ $this->categories[$cat] = false;
+ }
+ if(isset($_POST['chkchange'])){
+ $this->searchStr = $_POST['searchStr'];
+ if(isset($_POST['CAT'.$cat])){
+ $this->categories[$cat]=true;
+ }else{
+ $this->categories[$cat]=false;
+ }
+ }
+
+ }
+
+ $CHKS = "<table><tr><td><input type='hidden' value='chkchange' name='chkchange'>";
+ foreach($this->categories as $cat => $selected){
+ if($selected){
+ $CHKS .="<input type='checkbox' value='1' name='CAT".$cat."' checked> ".$cat." ";
+ }else{
+ $CHKS .="<input type='checkbox' value='1' name='CAT".$cat."'> ".$cat." ";
+ }
+ }
+ $CHKS .= "<br><input type='submit' name='refresh0' value='"._("refresh")."'> </td></tr></table>";
+
+ $packages = array();
+ foreach($this->categories as $cat => $use){
+ if($use){
+ $packages = array_merge($packages,$pkgs[$cat]);
+ }
+ }
+/*
+ foreach($_POST as $name => $value){
+ if(preg_match("/^wasonpage_/i",$name)){
+ $name = preg_replace("/^wasonpage_/","",$name);
+ if(isset($_POST['use_'.$name])){
+ print "was checked";
+ }
+ }
+
+ }
+
+*/
+ foreach($packages as $pkg){
+ if(preg_match("/^".str_replace("*",".*",$this->searchStr)."/i",$pkg[0])){
+ $chkbox = "<input type='checkbox' value='1' name='use_".base64_encode($pkg[0])."'>
+ <input type='hidden' value='1' name='wasonpage_".base64_encode($pkg[0])."'>";
+ $divlist->AddEntry(array(array("string"=>$chkbox),
+ array("string"=>$pkg[0]),
+ array("string"=>$pkg[1]),
+ array("string"=>$pkg[3])));
+ }
+ }
+
+ $smarty->assign("CHKS" , $CHKS);
+ $smarty->assign("searchStr" , $this->searchStr);
+ $smarty->assign("faihead" , "");
+ $smarty->assign("failist" , $divlist->DrawList());
+ $smarty->assign("infoimage" , get_template_path('images/info.png'));
+ $smarty->assign("launchimage" , get_template_path('images/launch.png'));
+ $smarty->assign("alphabet" , generate_alphabet());
+ $smarty->assign("apply" , apply_filter(TRUE));
+ $smarty->assign("search_image" , get_template_path('images/search.png'));
+
+ $display.= $smarty->fetch(get_template_path('faiPackageEntry.tpl', TRUE));
+ return($display);
+ }
+
+ /* Save data to object */
+ function save_object()
+ {
+ }
+
+ /* Check supplied data */
+ function check()
+ {
+ $message= array();
+ return ($message);
+ }
+
+ function save()
+ {
+ $tmp = array();
+ foreach($this->FAIAllclasses as $class => $obj){
+ if($obj['status']==true){
+ $tmp[$class]=$class;
+ }
+ }
+ return($tmp);
+ }
+
+ /* Generate listbox friendly SubObject list
+ */
+ function genPkgs(){
+ /* Generate a list off available packages for this mirror, section and release
+ */
+ $strID = $this->strID; // This var contains the path to the parsed package file
+
+ /* Open the packelist */
+ $fp = fopen($strID,"r");
+ $a_ret = array();
+ /* Only read this file if it wasn't read before */
+ if(!isset($this->buffer[$strID])){
+ $str = "";
+ /* Parse every line and create an array */
+ while(!feof($fp)){
+ $str= fgets($fp,512);
+ $stra= split("\|",$str);
+ if(count($stra)==4){
+ $a_ret[$stra[2]][] = $stra;
+ }
+ }
+
+ /* Save our Data, to avoid reading it again */
+ $this->buffer[$strID]=$a_ret;
+ return($a_ret);
+ }else{
+ return $this->buffer[$strID];
+ }
+ }
+
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/fai/faiPackageEntry.tpl b/plugins/admin/fai/faiPackageEntry.tpl
--- /dev/null
@@ -0,0 +1,68 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
+<tr>
+ <td style="vertical-align:top;width:600px">
+ <div class="contentboxh">
+ <p class="contentboxh">
+ {t}List of available packages{/t}
+ </p>
+ </div>
+ <div class="contentboxb">
+ {$faihead}
+ </div>
+ <div style='height:4px;'>
+ </div>
+ <div class="contentboxb" style="border-top:1px solid #B0B0B0;">
+ {$failist}
+ <input type=hidden name="edit_helper">
+ </div>
+ </td>
+ <td style="vertical-align:top;">
+ <div class="contentboxh">
+ <p class="contentboxh">
+ <img src="{$infoimage}" align="right" alt="[i]">{t}Information{/t}
+ </p>
+ </div>
+ <div class="contentboxb">
+ <p class="contentboxb">
+ {t}This menu allows you to select multiple packages to add them to the currently edited package list.{/t}
+ </p>
+ </div>
+ <br>
+ <div class="contentboxh">
+ <p class="contentboxh">
+ <img src="{$launchimage}" align="right" alt="[F]">
+ {t}Filters{/t}
+ </p>
+ </div>
+ <div class="contentboxb">
+ <table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
+ {$alphabet}
+ </table>
+ </div>
+ <div class="contentboxb">
+ {$CHKS}
+ </div>
+ <div class="contentboxb">
+ <table summary="" style="width:100%;">
+ <tr>
+ <td>
+ <LABEL for "regex">
+ <img alt="{t}Display objects matching{/t}" src="{$search_image}" align=middle title='{t}Display objects matching{/t}'>
+ </LABEL>
+ </td>
+ <td width="99%">
+ <input type='text' name='searchStr' maxlength='20' style='width:99%' value='{$searchStr}' id='filter'
+ title='{t}Regular expression for matching object names{/t}' onChange="mainform.submit()">
+ </td>
+ </tr>
+ </table>
+ {$apply}
+ </div>
+ </td>
+</tr>
+</table>
+<div align="right" style="align:right;">
+ <input name="SaveSubObject" value="Use" type="submit">
+ <input name="CancelSubObject" value="Cancel" type="submit">
+</div>
+<input type="hidden" name="ignore">