From 259a2792ba5a0607b2dde1ef806d04b97d36be6f Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 28 Sep 2010 09:29:33 +0000 Subject: [PATCH] Updated Device Stuff -Added management list (which doesn't work right now) git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19825 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../goto/Config/DeviceConfig-filter.xml | 115 ++++ .../systems/goto/Config/DeviceConfig-list.tpl | 26 + .../systems/goto/Config/DeviceConfig-list.xml | 497 ++++++++++++++++++ .../goto/Config/class_DeviceConfig.inc | 131 ++++- 4 files changed, 765 insertions(+), 4 deletions(-) create mode 100644 gosa-plugins/goto/admin/systems/goto/Config/DeviceConfig-filter.xml create mode 100644 gosa-plugins/goto/admin/systems/goto/Config/DeviceConfig-list.tpl create mode 100644 gosa-plugins/goto/admin/systems/goto/Config/DeviceConfig-list.xml diff --git a/gosa-plugins/goto/admin/systems/goto/Config/DeviceConfig-filter.xml b/gosa-plugins/goto/admin/systems/goto/Config/DeviceConfig-filter.xml new file mode 100644 index 000000000..2ad58ebac --- /dev/null +++ b/gosa-plugins/goto/admin/systems/goto/Config/DeviceConfig-filter.xml @@ -0,0 +1,115 @@ + + + + + true + server + workstation + terminal + opsi + incoming + phone + printer + winworkstation + component + Device + auto + default + dn + objectClass + cn + description + gotoMode + FAIstate + FAIclass + macAddress + gotoLastUser + state + + + + default + + + SYSTEMS + (& + (|(objectClass=goServer) + (objectClass=gotoWorkstation) + (objectClass=device) + (objectClass=gotoTerminal) + (objectClass=goFonHardware) + (objectClass=ieee802Device) + (objectClass=gotoPrinter) + (objectClass=sambaSamAccount) + ) + (cn=$) + ) + + + + cn + 0.5 + 3 + + + + + all + + + SYSTEMS + (& + (|(objectClass=goServer) + (objectClass=gotoWorkstation) + (objectClass=gotoTerminal) + (objectClass=goFonHardware) + (objectClass=ieee802Device) + (objectClass=gotoPrinter) + (objectClass=sambaSamAccount) + (&(objectClass=goHard)(ou:dn:=%systemIncomingRDN)) + ) + (cn=$) + ) + + + + OPSIHOSTS + cn=$ + + + cn + 0.5 + 3 + + + + + + onlyOpsi + + + OPSIHOSTS + cn=$ + + + cn + 0.5 + 3 + + + + + incoming + + + SYSTEMS + (&(objectClass=goHard)(ou:dn:=%systemIncomingRDN)(cn=$)) + + + cn + 0.5 + 3 + + + + diff --git a/gosa-plugins/goto/admin/systems/goto/Config/DeviceConfig-list.tpl b/gosa-plugins/goto/admin/systems/goto/Config/DeviceConfig-list.tpl new file mode 100644 index 000000000..8823cdfa7 --- /dev/null +++ b/gosa-plugins/goto/admin/systems/goto/Config/DeviceConfig-list.tpl @@ -0,0 +1,26 @@ +
+ +
+

{$HEADLINE} {$SIZELIMIT}

+
+ + + + + + + + + + +
{$ROOT}{$BACK}{$HOME}{$RELOAD}{t}Base{/t} {$RELEASE}{$ACTIONS}{$FILTER}
+
+
+ + {$LIST} +
+ +
+ + + diff --git a/gosa-plugins/goto/admin/systems/goto/Config/DeviceConfig-list.xml b/gosa-plugins/goto/admin/systems/goto/Config/DeviceConfig-list.xml new file mode 100644 index 000000000..917521bb6 --- /dev/null +++ b/gosa-plugins/goto/admin/systems/goto/Config/DeviceConfig-list.xml @@ -0,0 +1,497 @@ + + + + + true + false + true + true + + + 1 + + + + device + Device + Device + images/lists/edit.png + + + + + FAKE_OC_OpsiHost + opsi + opsiGeneric + plugins/systems/images/select_winstation.png + + + + + FAKE_OC_NewWorkstation + workstation + workgeneric + plugins/systems/images/select_workstation.png[new] + + + + + goServer__IS_LOCKED + server + servgeneric + plugins/systems/images/select_server.png[locked] + + + + + gotoWorkstation__IS_LOCKED + workstation + workgeneric + plugins/systems/images/select_workstation.png[locked] + + + + + gotoTerminal__IS_LOCKED + terminal + termgeneric + plugins/systems/images/select_terminal.png[locked] + + + + + + FAKE_OC_NewTerminal + terminal + termgeneric + plugins/systems/images/select_terminal.png[new] + + + + + FAKE_OC_ArpNewDevice + incoming + ArpNewDevice + images/lists/element.png[new] + + + + + FAKE_OC_NewDevice + incoming + systemManagement + images/lists/element.png[new] + + + + + FAKE_OC_WorkstationTemplate + workstation + workgeneric + plugins/systems/images/select_default.png + + + + + FAKE_OC_TerminalTemplate + terminal + termgeneric + plugins/systems/images/select_default.png + + + + + FAKE_OC_winstation + winworkstation + wingeneric + plugins/systems/images/select_winstation.png + + + + + goServer + server + servgeneric + plugins/systems/images/select_server.png + + + + + gotoWorkstation + workstation + workgeneric + plugins/systems/images/select_workstation.png + + + + + gotoTerminal + terminal + termgeneric + plugins/systems/images/select_terminal.png + + + + + gotoPrinter + printer + printgeneric + plugins/systems/images/select_printer.png + + + + + goFonHardware + phone + phoneGeneric + plugins/systems/images/select_phone.png + + + + + ieee802Device + component + componentGeneric + plugins/systems/images/select_component.png + + + + + + |20px;c|||80px|170px;r| + + + %{filter:objectType(dn,objectClass)} + + + + %{filter:departmentLink(row,dn,description)} + 2 + + + + %{filter:objectType(dn,objectClass)} + + + + + cn + string + %{filter:filterLink(row,dn,"%s",cn,pid)} + true + + + + + description + string + %{filter:filterSystemDescription(row,dn,pid,state,description)} + true + + + + + description + string + %{filter:systemRelease(row,dn,"%s",objectClass,FAIclass)} + true + + + + + %{filter:actions(dn,row,objectClass)} + + +
+ + + + + sub + images/lists/element.png[new] + + + + new_device + entry + images/lists/edit.png + + Device + + + + new_goServer + entry + plugins/systems/images/select_server.png[new] + + servgeneric + + + + new_gotoWorkstation + entry + plugins/systems/images/select_workstation.png[new] + + workgeneric + + + + new_gotoTerminal + entry + plugins/systems/images/select_terminal.png[new] + + termgeneric + + + + new_gotoPrinter + entry + plugins/systems/images/select_printer.png[new] + + printgeneric + + + + new_goFonHardware + entry + plugins/systems/images/select_phone.png[new] + + phoneGeneric + + + + new_ieee802Device + entry + plugins/systems/images/select_component.png[new] + + componentGeneric + + + + new_FAKE_OC_OpsiHost + entry + plugins/systems/images/select_winstation.png[new] + + opsi + + + + + separator + + + + sub + images/rocket.png + + + + T_DaemonEvent_halt + DaemonEvent_halt + entry + images/lists/reload.png + + + + + T_DaemonEvent_reboot + DaemonEvent_reboot + entry + images/lists/reload.png + + + + + T_DaemonEvent_wakeup + DaemonEvent_wakeup + entry + images/lists/on.png + + + + + T_DaemonEvent_update + DaemonEvent_update + entry + plugins/goto/images/update.png + + + + + T_DaemonEvent_lock + DaemonEvent_lock + entry + images/lists/locked.png + + + + + T_DaemonEvent_activate + DaemonEvent_activate + entry + images/lists/unlocked.png + + + + + T_DaemonEvent_reinstall + DaemonEvent_reinstall + entry + plugins/goto/images/reinstall.png + + + + + + + + + + sub + plugins/systems/images/clock.png + + + + S_DaemonEvent_halt + DaemonEvent_halt + entry + images/lists/off.png + + + + + S_DaemonEvent_reboot + DaemonEvent_reboot + entry + images/lists/reload.png + + + + + S_DaemonEvent_wakeup + DaemonEvent_wakeup + entry + images/lists/on.png + + + + + S_DaemonEvent_update + DaemonEvent_update + entry + plugins/goto/images/update.png + + + + + S_DaemonEvent_lock + DaemonEvent_lock + entry + images/lists/locked.png + + + + + S_DaemonEvent_activate + DaemonEvent_activate + entry + images/lists/unlocked.png + + + + + S_DaemonEvent_reinstall + DaemonEvent_reinstall + entry + plugins/goto/images/reinstall.png + + + + + + + separator + + + + activateMultiple + DaemonEvent_activate + entry + images/lists/unlocked.png + + + + + remove + entry + images/lists/trash.png + + + + + exporter + + + + separator + + + + copypaste + + + + snapshot + + + + + + + + setPassword + entry + FAKE_OC_PWD_changeAble + images/lists/key.png + + + + + + createISO + entry + gotoWorkstation + FAIobject + plugins/systems/images/cdrom.png + workstation/workgeneric[createFAICD:w] + + + + + cp + copypaste + + + + edit + entry + images/lists/edit.png + + + + + snapshot + snapshot + + + + remove + entry + images/lists/trash.png + %acl[d] + + + + + +
diff --git a/gosa-plugins/goto/admin/systems/goto/Config/class_DeviceConfig.inc b/gosa-plugins/goto/admin/systems/goto/Config/class_DeviceConfig.inc index f080e1f32..7ae103d77 100644 --- a/gosa-plugins/goto/admin/systems/goto/Config/class_DeviceConfig.inc +++ b/gosa-plugins/goto/admin/systems/goto/Config/class_DeviceConfig.inc @@ -2,7 +2,7 @@ /*! \brief A GOsa plugin which generates a device configuration dialog */ -class DeviceConfig extends plugin +class DeviceConfig extends management { private $TemplateEngine = NULL; private $idToName = array(); @@ -11,7 +11,10 @@ class DeviceConfig extends plugin private $currentItem = array(); private $navigationList = NULL; - + public $pl_notify; + public $read_only; + + private $itemContainerSelector = NULL; /*! \brief Constructs the device configuration plugin * @param Config The GOsa configuration object. @@ -24,6 +27,10 @@ class DeviceConfig extends plugin $this->TemplateEngine->setTemplate('puppet.tpl'); $this->config = $config; + // Set storage points - We do not have any - We just create a fake list which lists all items + $this->storagePoints = array(""); + $this->itemContainerSelector = new releaseSelector(array('cn=root'=>''), 'cn=root', 'cn=root'); + $this->navigationList= new sortableListing(); $this->navigationList->setDeleteable(true); $this->navigationList->setEditable(true); @@ -33,7 +40,6 @@ class DeviceConfig extends plugin $this->navigationList->setAcl("rwcdm"); $this->navigationList->sortingEnabled(FALSE); - // CREATE Dummy entry $str = '{ @@ -130,9 +136,107 @@ class DeviceConfig extends plugin ); $this->setCurrentItem('root'); + $this->rebuildListing(); + } + + + /*! \brief Overridden render method of class mangement. + * this allows us to add a release selection box. + */ + function renderList() + { + $this->rebuildListing(); + $filter = $this->getFilter(); + $headpage = $this->getHeadpage(); + $this->itemContainerSelector->update(); + $headpage->setBase('test'); + $headpage->update(); + $smarty = get_smarty(); + $smarty->assign("RELEASE", $this->itemContainerSelector->render()); + $display = $headpage->render(); + return($this->getHeader().$display); + } + + + function getContainerList($array = NULL, $base = "") + { + $array = ($array == NULL)?$this->currentItemValues['root']: $array; + $ret = array('cn=root' => ''); + $name = $array['name']; + $ret["cn={$name}{$base}"] = $array['type']; + if(count($array['children'])){ + $base = ",cn={$name}{$base}"; + foreach($array['children'] as $subItem){ + $ret = array_merge($ret, $this->getContainerList($subItem, $base)); + } + } + return($ret); + } + + + function rebuildListing() + { + // Collect item container list to be able to render the fake-base selector + $this->itemContainerSelector->setBases($this->getContainerList()); + $this->itemContainerSelector->update(true); + +# print_a($this->getContainerList()); + + // Build filter + if (session::global_is_set(get_class($this)."_filter")){ + $filter= session::global_get(get_class($this)."_filter"); + } else { + $filter = new filter(get_template_path("goto/Config/DeviceConfig-filter.xml", true)); + $filter->setObjectStorage($this->storagePoints); + } + $this->setFilter($filter); + + + // Load service xml file and fill in placeholders + $contents =file_get_contents(get_template_path("goto/Config/DeviceConfig-list.xml", true)); +# $template = " +# +# instantNew_%s +# entry +# +# "; +# $serviceList = ""; +# +# // Sort entries by alphabet +# $list = array(); +# $services = $this->getAllUnusedServices(); +# foreach($services as $name => $desc){ +# $list[_($desc).$name] = $name; +# } +# ksort($list); +# +# // Create menu entries -> create -> services[] +# foreach($list as $name){ +# $desc = $services[$name]; +# $serviceList.= sprintf($template, $name,_($desc)); +# } +# +# if(!empty($serviceList)){ +# $serviceList = " +# +# sub +# images/lists/element.png[new] +# +# {$serviceList} +# +# "; +# +# } +# +# $contents = preg_replace("/%SERVICES%/",$serviceList, $contents); + $headpage = new listing($contents,TRUE); + $headpage->setFilter($filter); + + parent::__construct($this->config, $this->ui, "services", $headpage); } + /*! \brief Prepares an item list which can then be used in * sortableListings to display the items of this configuration. * @return Array Containing 'data' and 'lData' for a sortableListing. @@ -219,10 +323,12 @@ class DeviceConfig extends plugin } + + /*! \brief Renders the HTML content for the device-config plugin. * @return String The generated HTML code. */ - function execute() + function _execute() { $smarty = get_smarty(); @@ -277,5 +383,22 @@ class DeviceConfig extends plugin $this->setCurrentItem($item['name']); } } + + /*! \brief Forward plugin acls + */ + function set_acl_base($base) + { + $this->acl_base = $base; + } + + + /*! \brief Forward plugin acls + */ + function set_acl_category($category) + { + $this->acl_category = $category; + } + + function save(){} } ?> -- 2.30.2