Code

Starting move
[gosa.git] / gosa-core / plugins / admin / systems / class_divListRepositories.inc
1 <?php
3 class divListRepository extends MultiSelectWindow
4 {
5   /* CheckBoxes, to change default values modify $this->AddCheckBox */
6   var $parent             ;
7   var $ui                 ;
9   var $regex ="*";
11   function divListRepository ($config,$parent)
12   {
13     MultiSelectWindow::MultiSelectWindow($config,"Repository", "server");
14     
15     $this->parent       = $parent;
16     $this->ui           = get_userinfo();
18     $this->SetTitle("repositories");
19     $this->SetSummary(_("List of configured repositories."));
20     $this->SetInformation(_("This menu allows you to create, delete and edit repository settings."));
21     $this->EnableCloseButton(FALSE);
22     $this->EnableSaveButton(FALSE);
23     $this->AddHeader(array("string"=>_("Release"),"attach"=>"style='width:80px;'"));
24     $this->AddHeader(array("string"=>_("Sections")));
25     $this->AddHeader(array("string"=>_("Options"),"attach"=>"style='border-right:0px;width:55px;'"));
26     $this->AddRegex("regex",_("Regular expression for matching object names"),"*",TRUE);
27     $this->EnableAplhabet(TRUE);
28   }
30   function GenHeader()
31   {
32     if($this->parent->acl_is_createable()){
33       $this->SetListHeader("<input type=\"image\" src=\"images/fai_new_packages.png\" title=\""._("Add repository")."\"                 name=\"AddRepository\">");
34     }
35   }
37   function execute()
38   {
39     $this->ClearElementsList();
40     $this->GenHeader();
41   }
43   function setEntries($list)
44   {
45     $link   = "<a href='?plug=".$_GET['plug']."&amp;act=open_repository&amp;id=%s'>%s</a>";
46     $edit   = "<input type='image' value='%s' name='edit_%s'   src='images/edit.png'>&nbsp;";
48     /* Hide delete icon, if delete is not allowed */
49     if($this->parent->acl_is_removeable()){
50       $delete = "<input type='image' value='%s' name='delete_%s' src='images/edittrash.png'>";
51     }else{
52       $delete = "<img src='images/empty.png' alt='&nbsp;'>";
53     }
55     foreach($list as $name => $reps){
57       $str = " ";
58       if(preg_match("/".str_replace("*",".*",$this->regex)."/",$reps['Release'])){
59         foreach($reps['Sections'] as $sec){
60           $str.=$sec." ";
61         }
62         $this->AddElement(array(
63               array("string"=>sprintf($link,base64_encode($name),$name),"attach"=>"style='width:80px;'"),
64               array("string"=>sprintf($link,base64_encode($name),_("Sections")." :".$str)),
65               array("string"=>preg_replace("/%s/",base64_encode($name),$edit.$delete),"attach"=>"style='border-right:0px;width:55px;text-  align:right;'")
66               ));
67       }
68     }
70   }
72   function Save()
73   {
74     MultiSelectWindow :: Save();  
75   }
77   function save_object()
78   {
79     /* Save automatic created POSTs like regex, checkboxes */
80     MultiSelectWindow :: save_object();   
81   }
82 }
83 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
84 ?>