1 <?php
3 class ConfigManagementListing extends management
4 {
6 private $base = "";
8 private $distributionSelector = NULL;
9 private $releaseSelector = NULL;
12 function __construct($config, $ui)
13 {
14 // Set storage points - We do not have any - We just create a fake list which lists all items
15 $this->storagePoints = array("");
16 $this->rebuildListing();
18 $this->distributionSelector = new ItemSelector(array('cn=root'=>'root'),"cn=root","cn=root");
19 $this->releaseSelector = new ItemSelector(array('cn=root'=>'root'),"cn=root","cn=root");
20 }
22 function save_object()
23 {
24 $this->distributionSelector->update();
25 $this->releaseSelector->update();
26 }
28 function getSelectedDistribution()
29 {
30 return($this->distributionSelector->getBase());
31 }
33 function getSelectedRelease()
34 {
35 return($this->releaseSelector->getBase());
36 }
38 function setDistribution($base)
39 {
40 $this->distributionSelector->setBase($base);
41 }
43 function setDistributions($distributions)
44 {
45 $this->distributionSelector->setBases($distributions);
46 $this->distributionSelector->update(TRUE);
47 }
49 function setRelease($base)
50 {
51 $this->releaseSelector->setBase($base);
52 }
54 function setReleases($releases)
55 {
56 $this->releaseSelector->setBases($releases);
57 $this->releaseSelector->update(TRUE);
58 }
60 function renderList()
61 {
62 session::set('DEVICE_ITEMS', array());
64 $filter = $this->getFilter();
65 $headpage = $this->getHeadpage();
66 $headpage->update();
67 $smarty = get_smarty();
69 $smarty->assign("DISTRIBUTION", $this->distributionSelector->render());
70 $smarty->assign("RELEASE", $this->releaseSelector->render());
71 $display = $headpage->render();
72 return($this->getHeader().$display);
74 }
77 function rebuildListing()
78 {
79 // Build filter
80 if (session::global_is_set(get_class($this)."_filter")){
81 $filter= session::global_get(get_class($this)."_filter");
82 } else {
83 $filter = new filter(get_template_path("DeviceConfig-filter.xml", true));
84 $filter->setObjectStorage($this->storagePoints);
85 }
86 $this->setFilter($filter);
88 // Load service xml file and fill in placeholders
89 $contents = file_get_contents(get_template_path("DeviceConfig-list.xml", true));
90 $contents = preg_replace("/%ITEMS%/", "", $contents);
91 $headpage = new listing($contents,TRUE);
92 $headpage->setBase($this->base);
93 $headpage->setFilter($filter);
95 parent::__construct($this->config, $this->ui, "services", $headpage);
96 }
97 }
99 ?>