Code

Updated directory layout
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 10 Dec 2007 13:12:09 +0000 (13:12 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 10 Dec 2007 13:12:09 +0000 (13:12 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8073 594d385d-05f5-0310-b6e9-bd551577e9d8

209 files changed:
include/class_location.inc
plugins/admin/systems/ServiceAddDialog.tpl [deleted file]
plugins/admin/systems/class_ServiceAddDialog.inc [deleted file]
plugins/admin/systems/class_dhcpAdvanced.inc [deleted file]
plugins/admin/systems/class_dhcpGroup.inc [deleted file]
plugins/admin/systems/class_dhcpHost.inc [deleted file]
plugins/admin/systems/class_dhcpNetwork.inc [deleted file]
plugins/admin/systems/class_dhcpNewSectionDialog.inc [deleted file]
plugins/admin/systems/class_dhcpPool.inc [deleted file]
plugins/admin/systems/class_dhcpService.inc [deleted file]
plugins/admin/systems/class_dhcpSharedNetwork.inc [deleted file]
plugins/admin/systems/class_dhcpSubnet.inc [deleted file]
plugins/admin/systems/class_glpiAccount.inc [deleted file]
plugins/admin/systems/class_glpiAttachmentPool.inc [deleted file]
plugins/admin/systems/class_glpiDeviceManagement.inc [deleted file]
plugins/admin/systems/class_glpiManufacturer.inc [deleted file]
plugins/admin/systems/class_glpiPrinterAccount.inc [deleted file]
plugins/admin/systems/class_glpiPrinterCartridges.inc [deleted file]
plugins/admin/systems/class_glpiPrinterCartridgesEdit.inc [deleted file]
plugins/admin/systems/class_glpiSelectUser.inc [deleted file]
plugins/admin/systems/class_goCupsServer.inc [deleted file]
plugins/admin/systems/class_goFaxServer.inc [deleted file]
plugins/admin/systems/class_goFonServer.inc [deleted file]
plugins/admin/systems/class_goGlpiServer.inc [deleted file]
plugins/admin/systems/class_goImapServer.inc [deleted file]
plugins/admin/systems/class_goKioskService.inc [deleted file]
plugins/admin/systems/class_goKrbServer.inc [deleted file]
plugins/admin/systems/class_goLdapServer.inc [deleted file]
plugins/admin/systems/class_goLogDBServer.inc [deleted file]
plugins/admin/systems/class_goMailServer.inc [deleted file]
plugins/admin/systems/class_goNtpServer.inc [deleted file]
plugins/admin/systems/class_goService.inc [deleted file]
plugins/admin/systems/class_goShareServer.inc [deleted file]
plugins/admin/systems/class_goSpamServer.inc [deleted file]
plugins/admin/systems/class_goSpamServerRule.inc [deleted file]
plugins/admin/systems/class_goSyslogServer.inc [deleted file]
plugins/admin/systems/class_goTerminalServer.inc [deleted file]
plugins/admin/systems/class_goVirusServer.inc [deleted file]
plugins/admin/systems/class_gosaLogServer.inc [deleted file]
plugins/admin/systems/class_printerPPDDialog.inc [deleted file]
plugins/admin/systems/class_printerPPDSelectionDialog.inc [deleted file]
plugins/admin/systems/class_servDHCP.inc [deleted file]
plugins/admin/systems/class_servDNS.inc [deleted file]
plugins/admin/systems/class_servDNSeditZone.inc [deleted file]
plugins/admin/systems/class_servDNSeditZoneEntries.inc [deleted file]
plugins/admin/systems/class_servKolab.inc [deleted file]
plugins/admin/systems/class_servNfs.inc [deleted file]
plugins/admin/systems/class_servRepository.inc [deleted file]
plugins/admin/systems/class_servRepositorySetup.inc [deleted file]
plugins/admin/systems/class_termDNS.inc [deleted file]
plugins/admin/systems/dhcpNewSection.tpl [deleted file]
plugins/admin/systems/dhcp_advanced.tpl [deleted file]
plugins/admin/systems/dhcp_group.tpl [deleted file]
plugins/admin/systems/dhcp_host.tpl [deleted file]
plugins/admin/systems/dhcp_network.tpl [deleted file]
plugins/admin/systems/dhcp_pool.tpl [deleted file]
plugins/admin/systems/dhcp_service.tpl [deleted file]
plugins/admin/systems/dhcp_sharedNetwork.tpl [deleted file]
plugins/admin/systems/dhcp_subnet.tpl [deleted file]
plugins/admin/systems/glpi.tpl [deleted file]
plugins/admin/systems/glpiAttachmentEdit.tpl [deleted file]
plugins/admin/systems/glpiAttachmentPool.tpl [deleted file]
plugins/admin/systems/glpiDeviceManagement.tpl [deleted file]
plugins/admin/systems/glpiManufacturer.tpl [deleted file]
plugins/admin/systems/glpiManufacturerAdd.tpl [deleted file]
plugins/admin/systems/glpiPrinter.tpl [deleted file]
plugins/admin/systems/glpiPrinterCartridges.tpl [deleted file]
plugins/admin/systems/glpiPrinterCartridgesEdit.tpl [deleted file]
plugins/admin/systems/glpiSelectUser.tpl [deleted file]
plugins/admin/systems/glpi_devices.tpl [deleted file]
plugins/admin/systems/glpi_edit_cartridge_type.tpl [deleted file]
plugins/admin/systems/glpi_edit_os.tpl [deleted file]
plugins/admin/systems/glpi_edit_printer_type.tpl [deleted file]
plugins/admin/systems/glpi_edit_type.tpl [deleted file]
plugins/admin/systems/goCupsServer.tpl [deleted file]
plugins/admin/systems/goFaxServer.tpl [deleted file]
plugins/admin/systems/goFonServer.tpl [deleted file]
plugins/admin/systems/goGlpiServer.tpl [deleted file]
plugins/admin/systems/goImapServer.tpl [deleted file]
plugins/admin/systems/goKioskService.tpl [deleted file]
plugins/admin/systems/goKrbServer.tpl [deleted file]
plugins/admin/systems/goLdapServer.tpl [deleted file]
plugins/admin/systems/goLogDBServer.tpl [deleted file]
plugins/admin/systems/goMailServer.tpl [deleted file]
plugins/admin/systems/goNtpServer.tpl [deleted file]
plugins/admin/systems/goShareServer.tpl [deleted file]
plugins/admin/systems/goSpamServer.tpl [deleted file]
plugins/admin/systems/goSpamServerRule.tpl [deleted file]
plugins/admin/systems/goSyslogServer.tpl [deleted file]
plugins/admin/systems/goTerminalServer.tpl [deleted file]
plugins/admin/systems/goVirusServer.tpl [deleted file]
plugins/admin/systems/gosaLogServer.tpl [deleted file]
plugins/admin/systems/ppd/class_printerPPDDialog.inc [new file with mode: 0644]
plugins/admin/systems/ppd/class_printerPPDSelectionDialog.inc [new file with mode: 0644]
plugins/admin/systems/ppd/printerPPDDialog.tpl [new file with mode: 0644]
plugins/admin/systems/ppd/printerPPDSelectionDialog.tpl [new file with mode: 0644]
plugins/admin/systems/ppd/remove_ppd.tpl [new file with mode: 0644]
plugins/admin/systems/printerPPDDialog.tpl [deleted file]
plugins/admin/systems/printerPPDSelectionDialog.tpl [deleted file]
plugins/admin/systems/remove_dhcp.tpl [deleted file]
plugins/admin/systems/remove_glpi.tpl [deleted file]
plugins/admin/systems/remove_ppd.tpl [deleted file]
plugins/admin/systems/servDNSeditZoneEntries.tpl [deleted file]
plugins/admin/systems/servRepository.tpl [deleted file]
plugins/admin/systems/servRepositorySetup.tpl [deleted file]
plugins/admin/systems/servdhcp.tpl [deleted file]
plugins/admin/systems/servdns.tpl [deleted file]
plugins/admin/systems/servdnseditzone.tpl [deleted file]
plugins/admin/systems/services/ServiceAddDialog.tpl [new file with mode: 0644]
plugins/admin/systems/services/class_ServiceAddDialog.inc [new file with mode: 0644]
plugins/admin/systems/services/class_goService.inc [new file with mode: 0644]
plugins/admin/systems/services/cups/class_goCupsServer.inc [new file with mode: 0644]
plugins/admin/systems/services/cups/goCupsServer.tpl [new file with mode: 0644]
plugins/admin/systems/services/dhcp/class_dhcpAdvanced.inc [new file with mode: 0644]
plugins/admin/systems/services/dhcp/class_dhcpGroup.inc [new file with mode: 0644]
plugins/admin/systems/services/dhcp/class_dhcpHost.inc [new file with mode: 0644]
plugins/admin/systems/services/dhcp/class_dhcpNetwork.inc [new file with mode: 0644]
plugins/admin/systems/services/dhcp/class_dhcpNewSectionDialog.inc [new file with mode: 0644]
plugins/admin/systems/services/dhcp/class_dhcpPool.inc [new file with mode: 0644]
plugins/admin/systems/services/dhcp/class_dhcpService.inc [new file with mode: 0644]
plugins/admin/systems/services/dhcp/class_dhcpSharedNetwork.inc [new file with mode: 0644]
plugins/admin/systems/services/dhcp/class_dhcpSubnet.inc [new file with mode: 0644]
plugins/admin/systems/services/dhcp/class_servDHCP.inc [new file with mode: 0644]
plugins/admin/systems/services/dhcp/dhcpNewSection.tpl [new file with mode: 0644]
plugins/admin/systems/services/dhcp/dhcp_advanced.tpl [new file with mode: 0644]
plugins/admin/systems/services/dhcp/dhcp_group.tpl [new file with mode: 0644]
plugins/admin/systems/services/dhcp/dhcp_host.tpl [new file with mode: 0644]
plugins/admin/systems/services/dhcp/dhcp_network.tpl [new file with mode: 0644]
plugins/admin/systems/services/dhcp/dhcp_pool.tpl [new file with mode: 0644]
plugins/admin/systems/services/dhcp/dhcp_service.tpl [new file with mode: 0644]
plugins/admin/systems/services/dhcp/dhcp_sharedNetwork.tpl [new file with mode: 0644]
plugins/admin/systems/services/dhcp/dhcp_subnet.tpl [new file with mode: 0644]
plugins/admin/systems/services/dhcp/remove_dhcp.tpl [new file with mode: 0644]
plugins/admin/systems/services/dhcp/servdhcp.tpl [new file with mode: 0644]
plugins/admin/systems/services/dns/class_servDNS.inc [new file with mode: 0644]
plugins/admin/systems/services/dns/class_servDNSeditZone.inc [new file with mode: 0644]
plugins/admin/systems/services/dns/class_servDNSeditZoneEntries.inc [new file with mode: 0644]
plugins/admin/systems/services/dns/class_termDNS.inc [new file with mode: 0644]
plugins/admin/systems/services/dns/servDNSeditZoneEntries.tpl [new file with mode: 0644]
plugins/admin/systems/services/dns/servdns.tpl [new file with mode: 0644]
plugins/admin/systems/services/dns/servdnseditzone.tpl [new file with mode: 0644]
plugins/admin/systems/services/glpi/class_glpiAccount.inc [new file with mode: 0644]
plugins/admin/systems/services/glpi/class_glpiAttachmentPool.inc [new file with mode: 0644]
plugins/admin/systems/services/glpi/class_glpiDeviceManagement.inc [new file with mode: 0644]
plugins/admin/systems/services/glpi/class_glpiManufacturer.inc [new file with mode: 0644]
plugins/admin/systems/services/glpi/class_glpiPrinterAccount.inc [new file with mode: 0644]
plugins/admin/systems/services/glpi/class_glpiPrinterCartridges.inc [new file with mode: 0644]
plugins/admin/systems/services/glpi/class_glpiPrinterCartridgesEdit.inc [new file with mode: 0644]
plugins/admin/systems/services/glpi/class_glpiSelectUser.inc [new file with mode: 0644]
plugins/admin/systems/services/glpi/class_goGlpiServer.inc [new file with mode: 0644]
plugins/admin/systems/services/glpi/glpi.tpl [new file with mode: 0644]
plugins/admin/systems/services/glpi/glpiAttachmentEdit.tpl [new file with mode: 0644]
plugins/admin/systems/services/glpi/glpiAttachmentPool.tpl [new file with mode: 0644]
plugins/admin/systems/services/glpi/glpiDeviceManagement.tpl [new file with mode: 0644]
plugins/admin/systems/services/glpi/glpiManufacturer.tpl [new file with mode: 0644]
plugins/admin/systems/services/glpi/glpiManufacturerAdd.tpl [new file with mode: 0644]
plugins/admin/systems/services/glpi/glpiPrinter.tpl [new file with mode: 0644]
plugins/admin/systems/services/glpi/glpiPrinterCartridges.tpl [new file with mode: 0644]
plugins/admin/systems/services/glpi/glpiPrinterCartridgesEdit.tpl [new file with mode: 0644]
plugins/admin/systems/services/glpi/glpiSelectUser.tpl [new file with mode: 0644]
plugins/admin/systems/services/glpi/glpi_devices.tpl [new file with mode: 0644]
plugins/admin/systems/services/glpi/glpi_edit_cartridge_type.tpl [new file with mode: 0644]
plugins/admin/systems/services/glpi/glpi_edit_os.tpl [new file with mode: 0644]
plugins/admin/systems/services/glpi/glpi_edit_printer_type.tpl [new file with mode: 0644]
plugins/admin/systems/services/glpi/glpi_edit_type.tpl [new file with mode: 0644]
plugins/admin/systems/services/glpi/goGlpiServer.tpl [new file with mode: 0644]
plugins/admin/systems/services/glpi/remove_glpi.tpl [new file with mode: 0644]
plugins/admin/systems/services/gofax/class_goFaxServer.inc [new file with mode: 0644]
plugins/admin/systems/services/gofax/goFaxServer.tpl [new file with mode: 0644]
plugins/admin/systems/services/gofon/class_goFonServer.inc [new file with mode: 0644]
plugins/admin/systems/services/gofon/goFonServer.tpl [new file with mode: 0644]
plugins/admin/systems/services/imap/class_goImapServer.inc [new file with mode: 0644]
plugins/admin/systems/services/imap/goImapServer.tpl [new file with mode: 0644]
plugins/admin/systems/services/kerberos/class_goKrbServer.inc [new file with mode: 0644]
plugins/admin/systems/services/kerberos/goKrbServer.tpl [new file with mode: 0644]
plugins/admin/systems/services/kiosk/class_goKioskService.inc [new file with mode: 0644]
plugins/admin/systems/services/kiosk/goKioskService.tpl [new file with mode: 0644]
plugins/admin/systems/services/kolab/class_servKolab.inc [new file with mode: 0644]
plugins/admin/systems/services/kolab/servkolab.tpl [new file with mode: 0644]
plugins/admin/systems/services/ldap/class_goLdapServer.inc [new file with mode: 0644]
plugins/admin/systems/services/ldap/goLdapServer.tpl [new file with mode: 0644]
plugins/admin/systems/services/log/class_gosaLogServer.inc [new file with mode: 0644]
plugins/admin/systems/services/log/gosaLogServer.tpl [new file with mode: 0644]
plugins/admin/systems/services/mail/class_goMailServer.inc [new file with mode: 0644]
plugins/admin/systems/services/mail/goMailServer.tpl [new file with mode: 0644]
plugins/admin/systems/services/nfs/class_servNfs.inc [new file with mode: 0644]
plugins/admin/systems/services/nfs/servnfs.tpl [new file with mode: 0644]
plugins/admin/systems/services/ntp/class_goNtpServer.inc [new file with mode: 0644]
plugins/admin/systems/services/ntp/goNtpServer.tpl [new file with mode: 0644]
plugins/admin/systems/services/repository/class_servRepository.inc [new file with mode: 0644]
plugins/admin/systems/services/repository/class_servRepositorySetup.inc [new file with mode: 0644]
plugins/admin/systems/services/repository/servRepository.tpl [new file with mode: 0644]
plugins/admin/systems/services/repository/servRepositorySetup.tpl [new file with mode: 0644]
plugins/admin/systems/services/shares/class_goShareServer.inc [new file with mode: 0644]
plugins/admin/systems/services/shares/goShareServer.tpl [new file with mode: 0644]
plugins/admin/systems/services/spam/class_goSpamServer.inc [new file with mode: 0644]
plugins/admin/systems/services/spam/class_goSpamServerRule.inc [new file with mode: 0644]
plugins/admin/systems/services/spam/goSpamServer.tpl [new file with mode: 0644]
plugins/admin/systems/services/spam/goSpamServerRule.tpl [new file with mode: 0644]
plugins/admin/systems/services/syslog/class_goLogDBServer.inc [new file with mode: 0644]
plugins/admin/systems/services/syslog/class_goSyslogServer.inc [new file with mode: 0644]
plugins/admin/systems/services/syslog/goLogDBServer.tpl [new file with mode: 0644]
plugins/admin/systems/services/syslog/goSyslogServer.tpl [new file with mode: 0644]
plugins/admin/systems/services/terminal/class_goTerminalServer.inc [new file with mode: 0644]
plugins/admin/systems/services/terminal/goTerminalServer.tpl [new file with mode: 0644]
plugins/admin/systems/services/virus/class_goVirusServer.inc [new file with mode: 0644]
plugins/admin/systems/services/virus/goVirusServer.tpl [new file with mode: 0644]
plugins/admin/systems/servkolab.tpl [deleted file]
plugins/admin/systems/servnfs.tpl [deleted file]

index 4d638344333b69b1e0c1275372d9d1759805c2ed..dc17ec0be716c15ab1390f59e5adad7506e924d4 100644 (file)
@@ -172,83 +172,83 @@ $class_mapping= array(
                 "divListGroup" => "plugins/admin/groups/class_divListGroup.inc",
                 "groupManagement" => "plugins/admin/groups/class_groupManagement.inc",
                 "appgroup" => "plugins/admin/groups/class_groupApplication.inc",
-                "glpiAttachmentPool" => "plugins/admin/systems/class_glpiAttachmentPool.inc",
-                "gosaLogServer" => "plugins/admin/systems/class_gosaLogServer.inc",
-                "servdnseditZone" => "plugins/admin/systems/class_servDNSeditZone.inc",
-                "goTerminalServer" => "plugins/admin/systems/class_goTerminalServer.inc",
-                "goService" => "plugins/admin/systems/class_goService.inc",
                 "workstartup" => "plugins/admin/systems/class_workstationStartup.inc",
-                "dhcpSharedNetwork" => "plugins/admin/systems/class_dhcpSharedNetwork.inc",
-                "govirusserver" => "plugins/admin/systems/class_goVirusServer.inc",
                 "termtabs" => "plugins/admin/systems/tabs_terminal.inc",
                 "phonetabs" => "plugins/admin/systems/tabs_phone.inc",
                 "servtabs" => "plugins/admin/systems/tabs_server.inc",
-                "dhcpAdvanced" => "plugins/admin/systems/class_dhcpAdvanced.inc",
-                "servdns" => "plugins/admin/systems/class_servDNS.inc",
                 "workgeneric" => "plugins/admin/systems/class_workstationGeneric.inc",
-                "gospamserver" => "plugins/admin/systems/class_goSpamServer.inc",
-                "dhcpNetwork" => "plugins/admin/systems/class_dhcpNetwork.inc",
-                "dhcpPool" => "plugins/admin/systems/class_dhcpPool.inc",
                 "selectUserToPrinterDialog" => "plugins/admin/systems/class_selectUserToPrinterDialog.inc",
                 "wintabs" => "plugins/admin/systems/tabs_winstation.inc",
-                "goCupsServer" => "plugins/admin/systems/class_goCupsServer.inc",
                 "phoneGeneric" => "plugins/admin/systems/class_phoneGeneric.inc",
-                "glpiPrinterAccount" => "plugins/admin/systems/class_glpiPrinterAccount.inc",
-                "goMailServer" => "plugins/admin/systems/class_goMailServer.inc",
                 "ArpNewDevice" => "plugins/admin/systems/class_ArpNewDevice.inc",
-                "dhcpSubnet" => "plugins/admin/systems/class_dhcpSubnet.inc",
-                "goLogDBServer" => "plugins/admin/systems/class_goLogDBServer.inc",
+                "gosaLogServer" => "plugins/admin/systems/services/log/class_gosaLogServer.inc",
+                "servdnseditZone" => "plugins/admin/systems/services/dns/class_servDNSeditZone.inc",
+                "servdns" => "plugins/admin/systems/services/dns/class_servDNS.inc",
+                "termDNS" => "plugins/admin/systems/services/dns/class_termDNS.inc",
+                "servDNSeditZoneEntries" => "plugins/admin/systems/services/dns/class_servDNSeditZoneEntries.inc",
+                "glpiAttachmentPool" => "plugins/admin/systems/services/glpi/class_glpiAttachmentPool.inc",
+                "glpiPrinterAccount" => "plugins/admin/systems/services/glpi/class_glpiPrinterAccount.inc",
+                "glpiDeviceManagement" => "plugins/admin/systems/services/glpi/class_glpiDeviceManagement.inc",
+                "glpiSelectUser" => "plugins/admin/systems/services/glpi/class_glpiSelectUser.inc",
+                "goGlpiServer" => "plugins/admin/systems/services/glpi/class_goGlpiServer.inc",
+                "glpiPrinterCartridges" => "plugins/admin/systems/services/glpi/class_glpiPrinterCartridges.inc",
+                "glpiManufacturer" => "plugins/admin/systems/services/glpi/class_glpiManufacturer.inc",
+                "glpiAccount" => "plugins/admin/systems/services/glpi/class_glpiAccount.inc",
+                "glpiPrinterCartridgesEdit" => "plugins/admin/systems/services/glpi/class_glpiPrinterCartridgesEdit.inc",
+                "goLdapServer" => "plugins/admin/systems/services/ldap/class_goLdapServer.inc",
+                "servnfs" => "plugins/admin/systems/services/nfs/class_servNfs.inc",
+                "goService" => "plugins/admin/systems/services/class_goService.inc",
+                "goMailServer" => "plugins/admin/systems/services/mail/class_goMailServer.inc",
+                "goFonServer" => "plugins/admin/systems/services/gofon/class_goFonServer.inc",
+                "gospamserver" => "plugins/admin/systems/services/spam/class_goSpamServer.inc",
+                "goSpamServerRule" => "plugins/admin/systems/services/spam/class_goSpamServerRule.inc",
+                "goImapServer" => "plugins/admin/systems/services/imap/class_goImapServer.inc",
+                "goNtpServer" => "plugins/admin/systems/services/ntp/class_goNtpServer.inc",
+                "goShareServer" => "plugins/admin/systems/services/shares/class_goShareServer.inc",
+                "goFaxServer" => "plugins/admin/systems/services/gofax/class_goFaxServer.inc",
+                "govirusserver" => "plugins/admin/systems/services/virus/class_goVirusServer.inc",
+                "dhcpSharedNetwork" => "plugins/admin/systems/services/dhcp/class_dhcpSharedNetwork.inc",
+                "dhcpAdvanced" => "plugins/admin/systems/services/dhcp/class_dhcpAdvanced.inc",
+                "dhcpNetwork" => "plugins/admin/systems/services/dhcp/class_dhcpNetwork.inc",
+                "dhcpPool" => "plugins/admin/systems/services/dhcp/class_dhcpPool.inc",
+                "dhcpSubnet" => "plugins/admin/systems/services/dhcp/class_dhcpSubnet.inc",
+                "dhcpGroup" => "plugins/admin/systems/services/dhcp/class_dhcpGroup.inc",
+                "dhcpHost" => "plugins/admin/systems/services/dhcp/class_dhcpHost.inc",
+                "dhcpNewSectionDialog" => "plugins/admin/systems/services/dhcp/class_dhcpNewSectionDialog.inc",
+                "dhcpService" => "plugins/admin/systems/services/dhcp/class_dhcpService.inc",
+                "servdhcp" => "plugins/admin/systems/services/dhcp/class_servDHCP.inc",
+                "ServiceAddDialog" => "plugins/admin/systems/services/class_ServiceAddDialog.inc",
+                "goLogDBServer" => "plugins/admin/systems/services/syslog/class_goLogDBServer.inc",
+                "goSyslogServer" => "plugins/admin/systems/services/syslog/class_goSyslogServer.inc",
+                "servkolab" => "plugins/admin/systems/services/kolab/class_servKolab.inc",
+                "goCupsServer" => "plugins/admin/systems/services/cups/class_goCupsServer.inc",
+                "goTerminalServer" => "plugins/admin/systems/services/terminal/class_goTerminalServer.inc",
+                "goKioskService" => "plugins/admin/systems/services/kiosk/class_goKioskService.inc",
+                "servRepositorySetup" => "plugins/admin/systems/services/repository/class_servRepositorySetup.inc",
+                "servrepository" => "plugins/admin/systems/services/repository/class_servRepository.inc",
+                "goKrbServer" => "plugins/admin/systems/services/kerberos/class_goKrbServer.inc",
                 "baseSelectDialog" => "plugins/admin/systems/class_baseSelectDialog.inc",
-                "dhcpGroup" => "plugins/admin/systems/class_dhcpGroup.inc",
-                "glpiDeviceManagement" => "plugins/admin/systems/class_glpiDeviceManagement.inc",
                 "systems" => "plugins/admin/systems/class_systemManagement.inc",
-                "goNtpServer" => "plugins/admin/systems/class_goNtpServer.inc",
-                "goKrbServer" => "plugins/admin/systems/class_goKrbServer.inc",
-                "ServiceAddDialog" => "plugins/admin/systems/class_ServiceAddDialog.inc",
-                "goSyslogServer" => "plugins/admin/systems/class_goSyslogServer.inc",
-                "servRepositorySetup" => "plugins/admin/systems/class_servRepositorySetup.inc",
-                "goLdapServer" => "plugins/admin/systems/class_goLdapServer.inc",
-                "dhcpHost" => "plugins/admin/systems/class_dhcpHost.inc",
                 "divListSystem" => "plugins/admin/systems/class_divListSystem.inc",
                 "servgeneric" => "plugins/admin/systems/class_servGeneric.inc",
                 "worktabs" => "plugins/admin/systems/tabs_workstation.inc",
-                "goKioskService" => "plugins/admin/systems/class_goKioskService.inc",
                 "termservice" => "plugins/admin/systems/class_terminalService.inc",
                 "divListSystemService" => "plugins/admin/systems/class_divListSystemService.inc",
-                "goShareServer" => "plugins/admin/systems/class_goShareServer.inc",
                 "componentGeneric" => "plugins/admin/systems/class_componentGeneric.inc",
-                "goImapServer" => "plugins/admin/systems/class_goImapServer.inc",
-                "glpiSelectUser" => "plugins/admin/systems/class_glpiSelectUser.inc",
                 "workservice" => "plugins/admin/systems/class_workstationService.inc",
                 "termgeneric" => "plugins/admin/systems/class_terminalGeneric.inc",
-                "servrepository" => "plugins/admin/systems/class_servRepository.inc",
                 "printtabs" => "plugins/admin/systems/tabs_printers.inc",
                 "ArpNewDeviceTabs" => "plugins/admin/systems/tabs_arpnewdevice.inc",
-                "printerPPDDialog" => "plugins/admin/systems/class_printerPPDDialog.inc",
-                "dhcpNewSectionDialog" => "plugins/admin/systems/class_dhcpNewSectionDialog.inc",
                 "componenttabs" => "plugins/admin/systems/tabs_component.inc",
-                "goGlpiServer" => "plugins/admin/systems/class_goGlpiServer.inc",
-                "servkolab" => "plugins/admin/systems/class_servKolab.inc",
                 "divListRepository" => "plugins/admin/systems/class_divListRepositories.inc",
-                "goFonServer" => "plugins/admin/systems/class_goFonServer.inc",
-                "servnfs" => "plugins/admin/systems/class_servNfs.inc",
+                "printerPPDDialog" => "plugins/admin/systems/ppd/class_printerPPDDialog.inc",
+                "printerPPDSelectionDialog" => "plugins/admin/systems/ppd/class_printerPPDSelectionDialog.inc",
                 "wingeneric" => "plugins/admin/systems/class_winGeneric.inc",
-                "glpiPrinterCartridges" => "plugins/admin/systems/class_glpiPrinterCartridges.inc",
-                "glpiManufacturer" => "plugins/admin/systems/class_glpiManufacturer.inc",
-                "termDNS" => "plugins/admin/systems/class_termDNS.inc",
                 "termstartup" => "plugins/admin/systems/class_terminalStartup.inc",
                 "terminfo" => "plugins/admin/systems/class_terminalInfo.inc",
                 "printgeneric" => "plugins/admin/systems/class_printGeneric.inc",
-                "goFaxServer" => "plugins/admin/systems/class_goFaxServer.inc",
-                "printerPPDSelectionDialog" => "plugins/admin/systems/class_printerPPDSelectionDialog.inc",
-                "dhcpService" => "plugins/admin/systems/class_dhcpService.inc",
-                "servdhcp" => "plugins/admin/systems/class_servDHCP.inc",
-                "glpiAccount" => "plugins/admin/systems/class_glpiAccount.inc",
                 "ServerService" => "plugins/admin/systems/class_serverService.inc",
                 "SelectDeviceType" => "plugins/admin/systems/class_SelectDeviceType.inc",
-                "glpiPrinterCartridgesEdit" => "plugins/admin/systems/class_glpiPrinterCartridgesEdit.inc",
-                "servDNSeditZoneEntries" => "plugins/admin/systems/class_servDNSeditZoneEntries.inc",
-                "goSpamServerRule" => "plugins/admin/systems/class_goSpamServerRule.inc",
                 "aclroletab" => "plugins/admin/acl/tabs_acl_role.inc",
                 "acltab" => "plugins/admin/acl/tabs_acl.inc",
                 "aclManagement" => "plugins/admin/acl/class_aclManagement.inc",
diff --git a/plugins/admin/systems/ServiceAddDialog.tpl b/plugins/admin/systems/ServiceAddDialog.tpl
deleted file mode 100755 (executable)
index f055f33..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-<div style="height:5px">&nbsp;</div>
-<div style="font-size:18px;">
-       {t}Adding a new service to the current server{/t}
-</div>
-<br>
-<p class="seperator">
-{t}This dialog allows you to add new services to the currenty edited server object. The box below shows all available but not already used services.{/t}
-<br>
-<br>
-</p>
-{if $Services} 
-<br>
-<br>{t}Service to add{/t} &nbsp;
-       <select name="ServiceName" >
-               <option value="" >&nbsp;</option>
-               {html_options options=$Services }
-       </select>
-{else}
-       <br>
-       {t}All available services are already in use.{/t}
-       <br>
-{/if}
-<br>
-<br>
-<br>
-<p class="seperator">
-<div style="width:100%; text-align:right;padding-top:8px;padding-bottom:3px;">
-    <input type='submit' name='SaveServiceAdd' value='{t}Continue{/t}' {if !$Services} disabled {/if}>
-    &nbsp;
-    <input type='submit' name='CancelServiceAdd' value='{t}Cancel{/t}'>
-</div>
-
diff --git a/plugins/admin/systems/class_ServiceAddDialog.inc b/plugins/admin/systems/class_ServiceAddDialog.inc
deleted file mode 100644 (file)
index 47e9701..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-
-class ServiceAddDialog extends plugin{
-
-  var $cli_summary      = "This dialog is used to add services";
-  var $cli_description  = "Some longer text\nfor help";
-  var $cli_parameters   = array("config"=>"Config object" , "dn"=>"Object dn");
-
-  /* This plugin does not have any ocs */
-  var $objectclasses    = array();
-  var $parent           = NULL;
-
-  function ServiceAddDialog(&$config,$dn,$parent)
-  {
-    plugin::plugin($config);
-    $this->parent = $parent;
-  }
-
-  function execute()
-  {
-    $smarty = get_smarty();
-    $services = $this->parent->getAllUnusedServices();
-    natcasesort($services);
-    $smarty->assign("Services",$services);
-    return($smarty->fetch(get_template_path("ServiceAddDialog.tpl", TRUE,dirname(__FILE__))));
- }
-
-  function check(){ return array();}
-  function save_object(){;}
-  function save(){}
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_dhcpAdvanced.inc b/plugins/admin/systems/class_dhcpAdvanced.inc
deleted file mode 100644 (file)
index 43f5831..0000000
+++ /dev/null
@@ -1,146 +0,0 @@
-<?php
-/*
-  This code is part of GOsa (https://gosa.gonicus.de)
-  Copyright (C) 2003  Cajus Pollmeier
-
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This program is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; if not, write to the Free Software
-  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
-
-class dhcpAdvanced extends plugin
-{
-  /* Used attributes */
-  var $options= array();
-  var $statements= array();
-  var $show_advanced= FALSE;
-  var $autoStatements= array();
-  var $autoOptions= array();
-
-  /* attribute list for save action */
-  var $attributes= array();
-  var $objectclasses= array();
-
-  function dhcpAdvanced()
-  {
-    /* This is always an account */
-    $this->is_account= TRUE;
-    $this->setAutoStatements();
-    $this->setAutoOptions();
-  }
-
-  function execute()
-  {
-    /* Check for interaction */
-    if (isset($_POST['add_statement']) && $_POST['addstatement'] != ""){
-      $key= preg_replace('/^([a-z0-9-]+)\s(.*)$/', '\\1', get_post('addstatement'));
-      $val= preg_replace("/^$key\s*/", '', get_post('addstatement'));
-      $this->statements[$key]= $val;
-    }
-    if (isset($_POST['delete_statement']) && isset($_POST['dhcpstatements'])){
-      $key= preg_replace('/([a-z0-9-]+)\s(.*)$/', '\\1', get_post('dhcpstatements'));
-      if (in_array($key, $this->autoStatements)){
-        print_red(_("Can't delete automatic statements. Please use the fields above."));
-      } else {
-        unset($this->statements[$key]);        
-      }
-    }
-    if (isset($_POST['add_option']) && $_POST['addoption'] != ""){
-      $key= preg_replace('/^([a-z0-9-]+)\s(.*)$/', '\\1', get_post('addoption'));
-      $val= preg_replace("/^$key\s*/", '', get_post('addoption'));
-      $this->options[$key]= $val;
-    }
-    if (isset($_POST['delete_option']) && isset($_POST['dhcpoptions'])){
-      $key= preg_replace('/([a-z0-9-]+)\s(.*)$/', '\\1', get_post('dhcpoptions'));
-      if (in_array($key, $this->autoOptions)){
-        print_red(_("Can't delete automatic options. Please use the fields above."));
-      } else {
-        unset($this->options[$key]);   
-      }
-    }
-
-    $smarty= get_smarty();
-
-    /* Assign arrays */
-    $statements= array();
-    foreach ($this->statements as $key => $val){
-      if (in_array($key, $this->autoStatements)){
-        $statements[$key]= "$key $val ["._("automatic")."]";
-      } else {
-        $statements[$key]= "$key $val";
-      }
-    }
-    $smarty->assign("dhcpstatements", $statements);
-    $options= array();
-    foreach ($this->options as $key => $val){
-      if (in_array($key, $this->autoOptions)){
-        $options[$key]= "$key $val ["._("automatic")."]";
-      } else {
-        $options[$key]= "$key $val";
-      }
-    }
-    $smarty->assign("dhcpoptions", $options);
-
-    /* Show main page */
-    $smarty->assign("show_advanced", $this->show_advanced);
-    return ($smarty->fetch (get_template_path('dhcp_advanced.tpl', TRUE,dirname(__FILE__))));
-  }
-
-  function remove_from_parent()
-  {
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    if (isset($_POST['show_advanced'])){
-      $this->show_advanced= TRUE;
-    }
-    if (isset($_POST['hide_advanced'])){
-      $this->show_advanced= FALSE;
-    }
-  }
-
-
-  /* Check values */
-  function check()
-  {
-    /* Nothing to check here */
-    $message= array();
-    return $message;
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-  }
-
-
-  function setAutoOptions($addopt= array())
-  {
-    $options= array("routers", "domain-name", "domain-name-servers", "subnet-mask", "broadcast-address");
-    $this->autoOptions= array_merge($options, $addopt);
-  }
-
-
-  function setAutoStatements($addstat= array())
-  {
-    $statements= array("filename", "next-server", "get-lease-hostnames", "use-host-decl-names");
-    $this->autoStatements= array_merge($statements, $addstat);
-  }
-
-}
-
-?>
diff --git a/plugins/admin/systems/class_dhcpGroup.inc b/plugins/admin/systems/class_dhcpGroup.inc
deleted file mode 100644 (file)
index cbe987d..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-<?php
-/*
-  This code is part of GOsa (https://gosa.gonicus.de)
-  Copyright (C) 2003  Cajus Pollmeier
-
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This program is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; if not, write to the Free Software
-  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
-
-class dhcpGroup extends dhcpPlugin
-{
-  /* attribute list for save action */
-  var $objectclasses= array('top', 'dhcpGroup', 'dhcpOptions');
-
-  function dhcpGroup(&$attrs)
-  {
-    /* Load statements / options */
-    dhcpPlugin::dhcpPlugin($attrs);
-  }
-
-  function execute()
-  {
-    $smarty= get_smarty();
-    $smarty->assign("cn", $this->cn);
-
-    /* Show main page */
-    $display= $smarty->fetch (get_template_path('dhcp_group.tpl', TRUE)).$this->network->execute();
-
-    /* Merge arrays for advanced view */
-    $this->fix_options();
-    foreach (array("options", "statements") as $type){
-      $this->advanced->$type= $this->$type + $this->network->$type;
-    }
-
-    $display.= $this->advanced->execute();
-
-    /* Merge back for removals */
-    foreach (array("options", "statements") as $type){
-      $this->$type= $this->advanced->$type;
-      $this->network->$type= $this->advanced->$type;
-    }
-
-    /* Add footer */
-    $display.= "<div style='width:100%;text-align:right;margin-top:5px;'><input type=submit name='save_dhcp' value='"._("Save")."'>".
-               "&nbsp;<input type=submit name='cancel_dhcp' value='"._("Cancel")."'></div>";
-
-
-    return ($display);
-  }
-
-
-  function remove_from_parent()
-  {
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    /* Save cn */
-    if (isset($_POST['cn'])){
-      $this->cn= validate(get_post('cn'));
-    }
-
-    /* Handle global saving */
-    dhcpPlugin::save_object();
-  }
-
-
-  /* Check values */
-  function check()
-  {
-    $message= array();
-
-    $cache = $this->parent->dhcpObjectCache;
-
-    /* All required fields are set? */
-    if ($this->cn == ""){
-      $message[]= _("Required field 'Name' is not filled.");
-    }
-    if (!preg_match('/^[a-z0-9_-]*$/i', $this->cn)){
-      $message[]= _("Field 'Name' contains illegal characters.");
-    }
-
-    /* cn already used? */
-    if ($this->orig_cn != $this->cn || $this->new){
-
-      foreach($cache as $dn => $dummy){
-        if (preg_match("/^cn=".$this->cn.",/", $dn) && count($dummy)){
-          $message[]= _("The name for this host section is already used!");
-          break;
-        }
-      }
-    }
-
-    /* Check external plugins */
-    $net= $this->network->check();
-    $adv= $this->advanced->check();
-    $message= array_merge($message, $net, $adv);
-
-    return $message;
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    dhcpPlugin::save();
-    return ($this->attrs);
-  }
-
-
-}
-
-?>
diff --git a/plugins/admin/systems/class_dhcpHost.inc b/plugins/admin/systems/class_dhcpHost.inc
deleted file mode 100644 (file)
index e8aab5c..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-<?php
-/*
-  This code is part of GOsa (https://gosa.gonicus.de)
-  Copyright (C) 2003-2007 Cajus Pollmeier
-
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This program is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; if not, write to the Free Software
-  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
-
-class dhcpHost extends dhcpPlugin
-{
-  /* Used attributes */
-  var $dhcpHWAddress= "";
-  var $realGosaHost = FALSE;
-       
-  /* attribute list for save action */
-  var $objectclasses= array("top", "dhcpHost");
-
-  function dhcpHost($attrs,$host_exists_in_gosa = FALSE)
-  {
-    dhcpPlugin::dhcpPlugin($attrs);
-
-    /* Load attributes */
-    if (!$this->new){
-      $this->dhcpHWAddress= $attrs['dhcpHWAddress'][0];
-    }
-
-    $this->advanced->setAutoOptions(array("host-name"));
-    $this->advanced->setAutoStatements(array("fixed-address"));
-
-       $this->realGosaHost = $host_exists_in_gosa;
-  }
-
-  function execute()
-  {
-    $smarty= get_smarty();
-    $smarty->assign("cn", $this->cn);
-    $smarty->assign("dhcpHWAddress", preg_replace('/^[^ ]+ /', '', $this->dhcpHWAddress));
-    $smarty->assign("realGosaHost",$this->realGosaHost);
-
-    /* Create fixed address */
-    if (isset($this->statements['fixed-address'])){
-      $smarty->assign("fixedaddr", $this->statements['fixed-address']);
-    } else {
-      $smarty->assign("fixedaddr", "");
-    }
-
-    /* Prepare hw type selector */
-    $hwtype= preg_replace('/\s.*$/', '', $this->dhcpHWAddress);
-    $smarty->assign("hwtype", $hwtype);
-    $smarty->assign("hwtypes", array("ethernet" => _("Ethernet"),
-          "fddi" => _("FDDI"),
-          "token-ring" => _("Token Ring")));
-    /* Show main page */
-    $display= $smarty->fetch(get_template_path('dhcp_host.tpl', TRUE,dirname(__FILE__))).$this->network->execute();
-
-    /* Merge arrays for advanced view */
-    $this->fix_options();
-    foreach (array("options", "statements") as $type){
-      $this->advanced->$type= $this->$type + $this->network->$type;
-    }
-    $display.= $this->advanced->execute();
-
-    /* Merge back for removals */
-    foreach (array("options", "statements") as $type){
-      $this->$type= $this->advanced->$type;
-      $this->network->$type= $this->advanced->$type;
-    }
-
-    /* Add footer */
-    $display.= "<div style='width:100%;text-align:right;margin-top:5px;'><input type=submit name='save_dhcp' value='"._("Save")."'>".
-               "&nbsp;<input type=submit name='cancel_dhcp' value='"._("Cancel")."'></div>";
-
-
-    return ($display);
-  }
-
-
-  function remove_from_parent()
-  {
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    /* Save remaining attributes */
-    if (isset($_POST['dhcp_host_posted'])){
-
-      /* Assemble hwAddress */
-      if (isset($_POST['dhcpHWAddress'])){
-        $this->dhcpHWAddress= get_post('hwtype')." ".get_post('dhcpHWAddress');
-      }
-               
-      if(!$this->realGosaHost){
-        $this->cn= validate(get_post('cn'));
-      }
-
-      /* Save fixed address */
-      if(!$this->realGosaHost){
-        if ($_POST['fixedaddr'] != ""){
-          $this->statements['fixed-address']= get_post('fixedaddr');
-        } else {
-          unset ($this->statements['fixed-address']);
-        }
-      }
-      $this->options['host-name']= $this->cn;
-    }
-
-    dhcpPlugin::save_object();
-  }
-
-
-  /* Check values */
-  function check()
-  {
-    $message= array();
-
-    $cache = array();
-    if(isset($this->parent)){
-      $cache = $this->parent->dhcpObjectCache;
-    }
-  
-    /* All required fields are set? */
-    if ($this->cn == ""){
-      $message[]= _("Required field 'Name' is not filled.");
-    }
-
-    /* cn already used? */
-    if ($this->orig_cn != $this->cn || $this->new){
-      
-      foreach($cache as $dn => $dummy){
-        if (preg_match("/^cn=".$this->cn.",/", $dn) && count($dummy)){
-          $message[]= _("The name for this host section is already used!");
-          break;
-        }
-      }
-    }
-
-    /* Check syntax of MAC address */
-    $check= preg_replace('/^[^\s]*\s/', '', $this->dhcpHWAddress);
-    if (!preg_match('/^([0-9a-fA-F]{1,2}:){5}[0-9a-fA-F]{1,2}$/', $check)){
-      $message[]= _("The hardware address specified by you is not valid!");
-    }
-
-    /* Check external plugins */
-    $net= $this->network->check();
-    $adv= $this->advanced->check();
-    $message= array_merge($message, $net, $adv);
-
-    return $message;
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    dhcpPlugin::save();
-    if ($this->dhcpHWAddress != ""){
-      $this->attrs['dhcpHWAddress']= array($this->dhcpHWAddress);
-    } else {
-      $this->attrs['dhcpHWAddress']= array();
-    }
-
-    return ($this->attrs);
-  }
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_dhcpNetwork.inc b/plugins/admin/systems/class_dhcpNetwork.inc
deleted file mode 100644 (file)
index 1c3ced0..0000000
+++ /dev/null
@@ -1,226 +0,0 @@
-<?php
-/*
-  This code is part of GOsa (https://gosa.gonicus.de)
-  Copyright (C) 2004-2007  Cajus Pollmeier
-
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This program is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; if not, write to the Free Software
-  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
-
-class dhcpNetwork extends plugin
-{
-  /* Used attributes */
-  var $options= array();
-  var $statements= array();
-
-  /* attribute list for save action */
-  var $attributes= array();
-  var $objectclasses= array();
-
-  function dhcpNetwork()
-  {
-    /* This is always an account */
-    $this->is_account= TRUE;
-  }
-
-  function execute()
-  {
-    /* Check for iteraction */
-    if (isset($_POST['add_dns']) && $_POST['addserver'] != ""){
-      if (!preg_match('/^[0-9a-z.-]+$/', get_post('addserver'))){
-        print_red(_("The name of the DNS server your're going to add is not valid!"));
-      } else {
-        $servers= array();
-        if (isset($this->options['domain-name-servers'])){
-          foreach(split(",", $this->options['domain-name-servers']) as $val){
-            $servers[$val]= $val;
-          }
-        }
-        $servers[get_post('addserver')]= get_post('addserver');
-
-        $tmp= "";
-        foreach($servers as $val){
-          $tmp.= $val.",";
-        }
-        $this->options['domain-name-servers']= preg_replace('/,$/', '', $tmp);
-      }
-    }
-    if (isset($_POST['delete_dns']) && isset($_POST['dnsserver'])){
-      $tmp= preg_replace("/(\s*,\s*)?".get_post('dnsserver')."/i", '',
-          $this->options['domain-name-servers']);
-      $tmp= preg_replace("/(\s*)?,(\s*)?$/", '', $tmp);
-      if ($tmp != ""){
-        $this->options['domain-name-servers']= $tmp;
-      } else {
-        unset($this->options['domain-name-servers']);
-      }
-    }
-
-    /* Show main page */
-    $smarty= get_smarty();
-
-    /*
-     * Assemble options
-     */
-
-    /* Router */
-    if (isset($this->options['routers'])){
-      $smarty->assign("routers", $this->options['routers']);
-    } else {
-      $smarty->assign("routers", "");
-    }
-
-    /* DNS */
-    if (isset($this->options['domain-name'])){
-      $smarty->assign("domain", trim($this->options['domain-name'], '"'));
-    } else {
-      $smarty->assign("domain", "");
-    }
-    if (isset($this->options['domain-name-servers'])){
-      $servers= array();
-      foreach(split(",", $this->options['domain-name-servers']) as $val){
-        $servers[$val]= $val;
-      }
-      $smarty->assign("dnsservers", $servers);
-    } else {
-      $smarty->assign("dnsservers", "");
-    }
-
-    /* Netmask / Broadcast */
-    if (isset($this->options['subnet-mask'])){
-      $this->options['subnet-mask']= normalize_netmask($this->options['subnet-mask']);
-      $smarty->assign("subnet_mask", $this->options['subnet-mask']);
-    } else {
-      $smarty->assign("subnet_mask", "");
-    }
-    if (isset($this->options['broadcast-address'])){
-      $smarty->assign("broadcast_address", $this->options['broadcast-address']);
-    } else {
-      $smarty->assign("broadcast_address", "");
-    }
-
-    /* Boot stuff */
-    if (isset($this->statements['filename'])){
-      $smarty->assign("filename", trim($this->statements['filename'], '"'));
-    } else {
-      $smarty->assign("filename", "");
-    }
-    if (isset($this->statements['next-server'])){
-      $smarty->assign("nextserver", $this->statements['next-server']);
-    } else {
-      $smarty->assign("nextserver", "");
-    }
-
-    /* Set flags */
-    $smarty->assign("autohost", "");
-    if (isset($this->statements['get-lease-hostnames'])){
-      if (preg_match('/^(true|on|yes)$/', $this->statements['get-lease-hostnames'])){
-        $smarty->assign("autohost", "checked");
-      }
-    }
-    $smarty->assign("autohostdecl", "");
-    if (isset($this->statements['use-host-decl-names'])){
-      if (preg_match('/^(true|on|yes)$/', $this->statements['use-host-decl-names'])){
-        $smarty->assign("autohostdecl", "checked");
-      }
-    }
-
-    return $smarty->fetch(get_template_path('dhcp_network.tpl', TRUE,dirname(__FILE__)));
-  }
-
-  function remove_from_parent()
-  {
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    /* Only save, if we are "active" */
-    if (isset($_POST['routers'])){
-
-      /*
-       * Assemble options
-       */
-
-      /* Options */
-      foreach (array("routers" => "routers", "domain-name" => "domain", "subnet-mask" => "subnet_mask",
-                     "broadcast-address" => "broadcast_address") as $key => $val){
-
-        if ($_POST["$val"] == ''){
-          unset($this->options["$key"]);
-        } else {
-          $this->options["$key"]= get_post("$val");
-        }
-      }
-
-      /* Statements */
-      foreach (array("filename" => "filename", "next-server" => "nextserver") as $key => $val){
-        if ($_POST["$val"] == ''){
-          unset($this->statements["$key"]);
-        } else {
-    
-          /* Only quote filename values */
-          if(in_array($key,array("filename"))){
-            $this->statements["$key"]= '"'.get_post("$val").'"';
-          }else{
-            $this->statements["$key"]= get_post("$val");
-          }
-        }
-      }
-
-      /* Flags */
-      if (isset ($_POST['autohost'])){
-        $this->statements['get-lease-hostnames']= "true";
-      } else {
-        unset($this->statements['get-lease-hostnames']);
-      }
-      if (isset ($_POST['autohostdecl'])){
-        $this->statements['use-host-decl-names']= "on";
-      } else {
-        unset($this->statements['use-host-decl-names']);
-      }
-    }
-  }
-
-
-  /* Check values */
-  function check()
-  {
-    $message= array();
-
-    /* Check netmask and broadcast */
-    foreach(array("subnet-mask" => _("Netmask"), "broadcast-address" => _("Broadcast")) as $key => $typ){
-      if (!isset($this->options["$key"])){
-        continue;
-      }
-      $tmp= preg_replace('/^[^\s]+\s/', '', $this->options["$key"]);
-
-      if (!is_ip($tmp)){
-        $message[]= sprintf(_("Error in definition of '%s'!"), $typ);
-      }
-    }
-
-    return $message;
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-  }
-  
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_dhcpNewSectionDialog.inc b/plugins/admin/systems/class_dhcpNewSectionDialog.inc
deleted file mode 100644 (file)
index 756a978..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-<?php
-
-class dhcpNewSectionDialog extends plugin
-{
-  /* attribute list for save action */
-  var $ignore_account     = TRUE;
-  var $attributes         = array();
-  var $objectclasses      = array("whatever");
-
-  /* Mapping array */
-  var $types= array();
-  var $classtype= "";
-  var $sectionMap= array(  "dhcpService" => array("dhcpSharedNetwork", "dhcpSubnet", "dhcpGroup", "dhcpHost" /*, "dhcpClass"*/),
-                              #"dhcpClass" => array("dhcpSubClass"),
-                              "dhcpSubClass" => array(),
-                              "dhcpHost" => array(),
-                              "dhcpGroup" => array("dhcpHost"),
-                              "dhcpPool" => array(),
-                              "dhcpSubnet" => array("dhcpPool", "dhcpGroup", "dhcpHost" /*, "dhcpClass"*/),
-                              "dhcpSharedNetwork" => array("dhcpSubnet", "dhcpPool"));
-
-
-
-  function dhcpNewSectionDialog($type)
-  {
-    $this->types= array(  "dhcpService" => _("Global options"),
-                          /*"dhcpClass" => _("Class"),*/
-                          "dhcpSubClass" => _("Subclass"),
-                          "dhcpHost" => _("Host"),
-                          "dhcpGroup" => _("Group"),
-                          "dhcpPool" => _("Pool"),
-                          "dhcpSubnet" => _("Subnet"),
-                          "dhcpSharedNetwork" => _("Shared network"));
-
-    $this->classtype= $type;
-  }
-
-  function execute()
-  {
-    /* Fill templating stuff */
-    $smarty = get_smarty();
-    $display= "";
-
-    $sections= $this->sectionMap[$this->classtype];
-    $t_sections= array();
-    foreach ($sections as $section){
-      $t_sections[$section]= $this->types[$section]; 
-    }
-    asort($t_sections);
-    $ui = get_userinfo();
-    $smarty->assign("sections", $t_sections);
-    $display.= $smarty->fetch(get_template_path('dhcpNewSection.tpl', TRUE));
-    return($display);
-  }
-
-  /* Get posts and set class name 
-   */ 
-  function save_object()
-  {
-  }
-
-  /* Check given class name */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= "";
-    return ($message);
-  }
-
-
-  /* Return the class name */
-  function save()
-  {
-  }
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_dhcpPool.inc b/plugins/admin/systems/class_dhcpPool.inc
deleted file mode 100644 (file)
index 9e9821e..0000000
+++ /dev/null
@@ -1,191 +0,0 @@
-<?php
-/*
-  This code is part of GOsa (https://gosa.gonicus.de)
-  Copyright (C) 2003  Cajus Pollmeier
-
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This program is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; if not, write to the Free Software
-  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
-
-class dhcpPool extends dhcpPlugin
-{
-  /* Used attributes */
-  var $dhcpRange= "";
-  var $range_start= "";
-  var $range_stop= "";
-
-  /* attribute list for save action */
-  var $objectclasses= array('top', 'dhcpPool');
-
-  function dhcpPool($attrs)
-  {
-    dhcpPlugin::dhcpPlugin($attrs);
-
-    /* Load attributes */
-    if (!$this->new){
-      $this->dhcpRange= $attrs['dhcpRange'][0];
-      list($this->range_start, $this->range_stop)= preg_split('/\s+/', $this->dhcpRange);
-    }
-
-    $this->advanced->setAutoOptions(array("host-name"));
-    $this->advanced->setAutoStatements(array("fixed-address"));
-  }
-
-  function execute()
-  {
-    $smarty= get_smarty();
-    $smarty->assign("cn", $this->cn);
-    $smarty->assign("range_start", $this->range_start);
-    $smarty->assign("range_stop", $this->range_stop);
-
-    /* Show main page */
-    $display= $smarty->fetch(get_template_path('dhcp_pool.tpl', TRUE)).$this->network->execute();
-
-    /* Merge arrays for advanced view */
-    $this->fix_options();
-    foreach (array("options", "statements") as $type){
-      $this->advanced->$type= $this->$type + $this->network->$type;;
-    }
-
-    $display.= $this->advanced->execute();
-
-    /* Merge back for removals */
-    foreach (array("options", "statements") as $type){
-      $this->$type= $this->advanced->$type;
-      $this->network->$type= $this->advanced->$type;
-    }
-
-    /* Add footer */
-    $display.= "<div style='width:100%;text-align:right;margin-top:5px;'><input type=submit name='save_dhcp' value='"._("Save")."'>".
-               "&nbsp;<input type=submit name='cancel_dhcp' value='"._("Cancel")."'></div>";
-
-    return ($display);
-  }
-
-  function remove_from_parent()
-  {
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    if (isset($_POST['cn'])){
-      $this->cn= validate(get_post('cn'));
-      $this->range_start= validate(get_post('range_start'));
-      $this->range_stop= validate(get_post('range_stop'));
-    }
-
-    dhcpPlugin::save_object();
-
-    /* Move range to internal variable */
-    $this->dhcpRange= $this->range_start." ".$this->range_stop;
-  }
-
-
-  /* Check values */
-  function check()
-  {
-    $message= array();
-
-       $cache = $this->parent->dhcpObjectCache;
-
-    /* All required fields are set? */
-    if ($this->cn == ""){
-      $message[]= _("Required field 'Name' is not filled.");
-    }
-
-    /* cn already used? */
-    if ($this->orig_cn != $this->cn || $this->new){
-
-      foreach($cache as $dn => $dummy){
-        if (preg_match("/^cn=".$this->cn.",/", $dn) && count($dummy)){
-          $message[]= _("The name for this section is already used!");
-          break;
-        }
-      }
-    }
-
-    if ($this->dhcpRange == ""){
-      $message[]= _("Required field 'Range' is not filled.");
-    }
-
-    if (!is_ip($this->range_start) || !is_ip($this->range_stop)){
-      $message[]= _("Field 'Range' contains invalid IP addresses.");
-    }
-
-    if(!is_ip_range($this->range_start,$this->range_stop)){
-      $message[] = _("Field 'Range' contains invalid IP range.");
-    }
-
-    /* Check if range is in the network */
-    $dn= $this->dn;
-    while (preg_match('/,/', $dn)){
-      $type= $this->objectType($cache, $dn);
-
-      /* Check for subnet */
-      if ($type == 'dhcpSubnet'){
-        $network= $cache[$dn]['cn'][0];
-        $netmask= normalize_netmask($cache[$dn]['dhcpNetMask'][0]);
-        if (!is_in_network($network, $netmask, $this->range_start) ||
-            !is_in_network($network, $netmask, $this->range_stop)){
-          $message[] = _("'Range' is not inside the configured network.");
-        }
-      }
-
-      /* Stop if we've examined the service base object */
-      if ($type == 'dhcpService'){
-        break;
-      }
-      $dn= preg_replace('/^[^,]+,/', '', $dn);
-    }
-
-    /* Check external plugins */
-    $net= $this->network->check();
-    $adv= $this->advanced->check();
-    $message= array_merge($message, $net, $adv);
-
-    return $message;
-  }
-
-  /* Save to LDAP */
-  function save()
-  {
-    dhcpPlugin::save();
-    $this->attrs['dhcpRange']= array($this->dhcpRange);
-
-    return ($this->attrs);
-  }
-
-
-  function objectType($cache, $dn)
-  {
-    $type= "";
-    $types= array("dhcpService", "dhcpClass", "dhcpSubClass", "dhcpHost",
-                  "dhcpGroup", "dhcpPool", "dhcpSubnet", "dhcpSharedNetwork");
-
-    foreach ($cache[$dn]['objectClass'] as $oc){
-      if (in_array($oc, $types)){
-        $type= $oc;
-        break;
-      }
-    }
-
-    return ($type);
-  }
-
-  
-}
-
-?>
diff --git a/plugins/admin/systems/class_dhcpService.inc b/plugins/admin/systems/class_dhcpService.inc
deleted file mode 100644 (file)
index 57f76cc..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-<?php
-/*
-  This code is part of GOsa (https://gosa.gonicus.de)
-  Copyright (C) 2003-2007  Cajus Pollmeier
-
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This program is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; if not, write to the Free Software
-  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
-
-class dhcpService extends dhcpPlugin
-{
-  /* Used attributes */
-  var $dhcpPrimaryDN= "";
-  var $orig_dhcpPrimaryDN= "";
-  var $ddns_styles= array('none', 'interim', 'ad-hoc');
-
-  /* attribute list for save action */
-  var $objectclasses= array('top', 'dhcpService');
-
-
-  function dhcpService($attrs)
-  {
-    dhcpPlugin::dhcpPlugin($attrs);
-
-    /* Load statements / options */
-    if (!$this->new){
-      /* Load attributes */
-      $this->dhcpPrimaryDN= $attrs['dhcpPrimaryDN'][0];
-    } else {
-      /* We keep the parent dn here if it's new */
-      $this->statements['default-lease-time']= 600;
-      $this->statements['max-lease-time']= 1700;
-      $this->statements['authoritative']= TRUE;
-      $this->statements['ddns-update-style']= 'none';
-    }
-
-    $this->advanced->setAutoStatements(array("default-lease-time", "max-lease-time", "authoritative", "server-identifier", "ddns-update-style"));
-    $this->advanced->setAutoOptions(array("server-name"));
-
-    /* Save for later action */
-    $this->orig_dhcpPrimaryDN= $this->dhcpPrimaryDN;
-  }
-
-
-  function execute()
-  {
-    /* Show main page */
-    $smarty= get_smarty();
-
-    $smarty->assign('ddns_styles', $this->ddns_styles);
-    foreach (array('max_lease_time', 'default_lease_time', 'ddns_update_style') as $value){
-      if (isset($this->statements[preg_replace('/_/', '-', $value)])){
-        $smarty->assign("$value", $this->statements[preg_replace('/_/', '-', $value)]);
-      } else {
-        $smarty->assign("$value", "");
-      }
-    }
-
-    if (isset($this->statements['authoritative'])){
-      $smarty->assign("authoritative", "checked");
-    } else {
-      $smarty->assign("authoritative", "");
-    }
-
-    /* Show main page */
-    $display= $smarty->fetch(get_template_path('dhcp_service.tpl', TRUE)).$this->network->execute();
-
-    /* Merge arrays for advanced view */
-    $this->fix_options();
-    foreach (array("options", "statements") as $type){
-      $this->advanced->$type= $this->$type + $this->network->$type;;
-    }
-
-    $display.= $this->advanced->execute();
-
-    /* Merge back for removals */
-    foreach (array("options", "statements") as $type){
-      $this->$type= $this->advanced->$type;
-      $this->network->$type= $this->advanced->$type;
-    }
-
-    /* Add footer */
-    $display.= "<div style='width:100%;text-align:right;margin-top:5px;'><input type=submit name='save_dhcp' value='"._("Save")."'>".
-      "&nbsp;<input type=submit name='cancel_dhcp' value='"._("Cancel")."'></div>";
-
-
-    return ($display);
-
-  }
-
-  function remove_from_parent()
-  {
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    /* No need to save in the first time */
-    if (!isset($_POST['ddns_update_style'])){
-      return;
-    }
-
-    /* Save remaining attributes */
-    foreach (array('max_lease_time', 'default_lease_time', 'ddns_update_style') as $val){
-      $tval= preg_replace('/_/', '-', $val);
-      if ($_POST[$val] != ""){
-        $this->statements[$tval]= validate(get_post($val));
-      } else {
-        unset ($this->statements[$tval]);
-      }
-    }
-    if (isset($_POST['authoritative'])){
-      $this->statements['authoritative']= "";
-    } else {
-      unset($this->statements['authoritative']);
-    }
-
-    dhcpPlugin::save_object();
-  }
-
-
-  /* Check values */
-  function check()
-  {
-    $message= array();
-
-    if (!is_id($this->statements['default-lease-time'])){
-      $message[]= _('Default lease time needs to be numeric.');
-    }
-    if (!is_id($this->statements['max-lease-time'])){
-      $message[]= _('Maximum lease time needs to be numeric.');
-    }
-    if ($this->statements['default-lease-time'] > $this->statements['max-lease-time']){
-      $message[]= _('Default lease time needs to smaller than the maximum lease time.');
-    }
-
-    /* Check external plugins */
-    $net= $this->network->check();
-    $adv= $this->advanced->check();
-    $message= array_merge($message, $net, $adv);
-
-    return $message;
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    global $config;
-    $this->attrs= array();
-
-    /* Get and set server name */
-    $ldap= $config->get_ldap_link();
-    $ldap->cat($this->dhcpPrimaryDN, array('cn'));
-    $res= $ldap->fetch();
-    $server_name= $res['cn'][0];
-    
-    dhcpPlugin::save();
-
-    $this->attrs['dhcpPrimaryDN']= array($this->dhcpPrimaryDN);
-    $this->removeOption('server-name');
-#    $this->attrs['dhcpOption'][]= "server-name $server_name";
-
-    return ($this->attrs);
-  }
-  
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_dhcpSharedNetwork.inc b/plugins/admin/systems/class_dhcpSharedNetwork.inc
deleted file mode 100644 (file)
index 6e55b75..0000000
+++ /dev/null
@@ -1,188 +0,0 @@
-<?php
-/*
-  This code is part of GOsa (https://gosa.gonicus.de)
-  Copyright (C) 2003-2007 Cajus Pollmeier
-
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This program is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; if not, write to the Free Software
-  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
-
-class dhcpSharedNetwork extends dhcpPlugin
-{
-  /* attribute list for save action */
-  var $objectclasses= array('top', 'dhcpSharedNetwork');
-
-  function dhcpSharedNetwork($attrs)
-  {
-    dhcpPlugin::dhcpPlugin($attrs);
-
-    $this->advanced->setAutoStatements(array("server-identifier", "default-lease-time",
-          "max-lease-time", "min-lease-time", "authoritative", "deny-unknown-clients",
-          "deny-bootp", "deny-booting"));
-  }
-
-
-  function execute()
-  {
-    $smarty= get_smarty();
-
-    /* Fill template */
-    $smarty->assign ("cn", $this->cn);
-    foreach (array("server-identifier", "default-lease-time", "max-lease-time", "min-lease-time") as $attr){
-      if (isset($this->statements[$attr])){
-        $smarty->assign(preg_replace('/-/', '_', $attr), $this->statements[$attr]);
-      } else {
-        $smarty->assign(preg_replace('/-/', '_', $attr), "");
-      }
-    }
-    if (isset($this->statements["authoritative"])){
-      $smarty->assign("authoritative", "checked");
-    } else {
-      $smarty->assign("authoritative", "");
-    }
-    if (!isset($this->statements["deny unknown-clients"])){
-      $smarty->assign("allow_unknown_state", "checked");
-    } else {
-      $smarty->assign("allow_unknown_state", "");
-    }
-    if (!isset($this->statements["deny bootp"])){
-      $smarty->assign("allow_bootp_state", "checked");
-    } else {
-      $smarty->assign("allow_bootp_state", "");
-    }
-    if (!isset($this->statements["deny booting"])){
-      $smarty->assign("allow_booting_state", "checked");
-    } else {
-      $smarty->assign("allow_booting_state", "");
-    }
-
-    /* Show main page */
-    $display= $smarty->fetch(get_template_path('dhcp_sharedNetwork.tpl', TRUE)).$this->network->execute();
-
-    /* Merge arrays for advanced view */
-    $this->fix_options();
-    foreach (array("options", "statements") as $type){
-      $this->advanced->$type= $this->$type + $this->network->$type;
-    }
-
-    $display.= $this->advanced->execute();
-
-    /* Merge back for removals */
-    foreach (array("options", "statements") as $type){
-      $this->$type= $this->advanced->$type;
-      $this->network->$type= $this->advanced->$type;
-    }
-
-    /* Add footer */
-    $display.= "<div style='width:100%;text-align:right;margin-top:5px;'><input type=submit name='save_dhcp' value='"._("Save")."'>".
-               "&nbsp;<input type=submit name='cancel_dhcp' value='"._("Cancel")."'></div>";
-
-
-    return ($display);
-  }
-
-
-  function remove_from_parent()
-  {
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    if (isset($_POST['cn'])){
-      $this->cn= validate(get_post('cn'));
-      dhcpPlugin::save_object();
-
-      foreach (array("server-identifier", "default-lease-time",
-            "max-lease-time", "min-lease-time") as $attr){
-        if (isset($_POST[$attr]) && $_POST[$attr] != ""){
-          $this->statements[$attr]= get_post($attr);
-        } else {
-          unset($this->statements[$attr]);
-        }
-      }
-
-      if (isset($_POST["authoritative"])){
-        $this->statements["authoritative"]= "";
-      } else {
-        unset ($this->statements["authoritative"]);
-      }
-
-      foreach(array("unknown-clients", "bootp", "booting") as $name){
-        if (isset($_POST[$name])){
-          $this->statements["allow $name"]= "";
-          unset($this->statements["deny $name"]);
-        } else {
-          $this->statements["deny $name"]= "";
-          unset($this->statements["allow $name"]);
-        }
-      }
-    }
-  }
-
-
-  /* Check values */
-  function check()
-  {
-    $message= array();
-
-       $cache = $this->parent->dhcpObjectCache;
-
-    /* All required fields are set? */
-    if ($this->cn == ""){
-      $message[]= _("Required field 'Name' is not filled.");
-    }
-
-    /* Check lease times */
-    foreach (array("default-lease-time" => _("Default lease time"),
-          "max-lease-time" => _("Max. lease time"),
-          "min-lease-time" => _("Min. lease time")) as $key => $val){
-      if (isset($this->statements[$key]) && $this->statements[$key] != "" && 
-          !is_id($this->statements[$key])){
-        $message[]= sprintf(_("The value specified as '%s' is not numeric!"), $val);
-      }
-    }
-
-    /* cn already used? */
-    if ($this->orig_cn != $this->cn || $this->new){
-
-      foreach($cache as $dn => $dummy){
-        if (preg_match("/^cn=".$this->cn.",/", $dn) && count($dummy)){
-          $message[]= _("The name for this host section is already used!");
-          break;
-        }
-      }
-    }
-
-    /* Check external plugins */
-    $net= $this->network->check();
-    $adv= $this->advanced->check();
-    $message= array_merge($message, $net, $adv);
-
-    return $message;
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    dhcpPlugin::save();
-
-    return ($this->attrs);
-  }
-
-}
-
-?>
diff --git a/plugins/admin/systems/class_dhcpSubnet.inc b/plugins/admin/systems/class_dhcpSubnet.inc
deleted file mode 100644 (file)
index 8c2da41..0000000
+++ /dev/null
@@ -1,200 +0,0 @@
-<?php
-/*
-  This code is part of GOsa (https://gosa.gonicus.de)
-  Copyright (C) 2003-2007  Cajus Pollmeier
-
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This program is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; if not, write to the Free Software
-  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
-
-class dhcpSubnet extends dhcpPlugin
-{
-  /* Used attributes */
-  var $dhcpNetMask= 24;
-  var $dhcpRange= "";
-  var $range_start= "";
-  var $range_stop= "";
-  var $use_range= FALSE;
-
-  /* attribute list for save action */
-  var $objectclasses= array('top', 'dhcpSubnet', 'dhcpOptions');
-
-  function dhcpSubnet($attrs)
-  {
-    dhcpPlugin::dhcpPlugin($attrs);
-
-    if (!$this->new){
-      /* Load attributes */
-      foreach (array("dhcpNetMask", "dhcpRange") as $attr){
-        if (isset($attrs[$attr][0])){
-          $this->$attr= $attrs[$attr][0];
-        }
-      }
-      if (isset($attrs['dhcpRange']) && count($attrs['dhcpRange'])){
-        $this->use_range= TRUE;
-        list($this->range_start, $this->range_stop)= preg_split('/\s+/', $this->dhcpRange);
-      }
-    }
-
-    $this->dhcpNetMask= normalize_netmask($this->dhcpNetMask);
-  }
-
-
-  function execute()
-  {
-    $smarty= get_smarty();
-    $smarty->assign("cn", $this->cn);
-    $smarty->assign("dhcp_netmask", $this->dhcpNetMask);
-
-    /* Prepare range */
-    if ($this->use_range){
-      $smarty->assign("use_range", "checked");
-      $smarty->assign("range_disabled", "");
-    } else {
-      $smarty->assign("use_range", "");
-      $smarty->assign("range_disabled", "disabled");
-    }
-    $smarty->assign("range_start", $this->range_start);
-    $smarty->assign("range_stop", $this->range_stop);
-
-    /* Show main page */
-    $display= $smarty->fetch(get_template_path('dhcp_subnet.tpl', TRUE)).$this->network->execute();
-
-    /* Merge arrays for advanced view */
-    $this->fix_options();
-    foreach (array("options", "statements") as $type){
-      $this->advanced->$type= $this->$type + $this->network->$type;
-    }
-
-    $display.= $this->advanced->execute();
-
-    /* Merge back for removals */
-    foreach (array("options", "statements") as $type){
-      $this->$type= $this->advanced->$type;
-      $this->network->$type= $this->advanced->$type;
-    }
-
-    /* Add footer */
-    $display.= "<div style='width:100%;text-align:right;margin-top:5px;'><input type=submit name='save_dhcp' value='"._("Save")."'>".
-               "&nbsp;<input type=submit name='cancel_dhcp' value='"._("Cancel")."'></div>";
-
-    /* Show main page */
-    return $display;
-  }
-
-
-  function remove_from_parent()
-  {
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    if(isset($_POST['dhcp_subnet_posted'])){
-      if (isset($_POST['cn'])){
-        $this->cn= validate(get_post('cn'));
-      } 
-      if (isset($_POST['dhcp_netmask'])){
-        $this->dhcpNetMask= validate(get_post('dhcp_netmask'));
-      } 
-      if (isset($_POST['use_range'])){
-        $this->use_range= TRUE;
-        $this->range_start= validate(get_post('range_start'));
-        $this->range_stop= validate(get_post('range_stop'));
-      } else {
-        $this->use_range= FALSE;
-      }
-
-      /* Move range to internal variable */
-      $this->dhcpRange= $this->range_start." ".$this->range_stop;
-      dhcpPlugin::save_object();
-    }
-  }
-
-
-  /* Check values */
-  function check()
-  {
-    $message= array();
-
-    $cache = $this->parent->dhcpObjectCache;
-
-    /* All required fields are set? */
-    if ($this->cn == ""){
-      $message[]= _("Required field 'Network address' is not filled.");
-    }
-    if ($this->dhcpNetMask == ""){
-      $message[]= _("Required field 'Netmask' is not filled.");
-    }
-
-    /* cn already used? */
-    if ($this->orig_cn != $this->cn || $this->new){
-
-      foreach($cache as $dn => $dummy){
-        if (preg_match("/^cn=".$this->cn.",/", $dn) && count($dummy)){
-          $message[]= _("The name for this section is already used!");
-          break;
-        }
-      }
-    }
-
-    /* IP's? */
-    foreach(array('dhcpNetMask' => _("Netmask"), 'cn' => _("Network address"), 'range_start' => _("Range"), 'range_stop' => _("Range")) as $attr => $str){
-      if ($this->$attr != "" && !is_ip($this->$attr)){
-        $message[]= sprintf(_("The field '%s' contains an invalid IP address"), $str);
-      }
-    }
-
-    /* Check ip range */
-    if ($this->use_range){
-      if(!is_ip_range($this->range_start,$this->range_stop)){
-        $message[] = _("Field 'Range' contains invalid IP range.");
-      }
-
-      /* Check if range is in the network */
-      if (!is_in_network($this->cn, $this->dhcpNetMask, $this->range_start) ||
-          !is_in_network($this->cn, $this->dhcpNetMask, $this->range_stop)){
-        $message[] = _("'Range' is not inside the configured network.");
-      }
-    }
-
-    /* Check external plugins */
-    $net= $this->network->check();
-    $adv= $this->advanced->check();
-    $message= array_merge($message, $net, $adv);
-
-    return $message;
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    dhcpPlugin::save();
-
-    /* Move dn to the result */
-    $this->attrs['dhcpNetMask']= array(netmask_to_bits($this->dhcpNetMask));
-    if ($this->use_range && !empty($this->dhcpRange)){
-      $this->attrs['dhcpRange']= array($this->range_start." ".$this->range_stop);
-    } else {
-      $this->attrs['dhcpRange']= array();
-    }
-
-    return ($this->attrs);
-  }
-  
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_glpiAccount.inc b/plugins/admin/systems/class_glpiAccount.inc
deleted file mode 100644 (file)
index e641108..0000000
+++ /dev/null
@@ -1,806 +0,0 @@
-<?php
-
-class glpiAccount 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= FALSE;
-  var $attributes= array("ID","name","contact",
-      "tech_num","comments","date_mod","os","location","domain","network","contact_num",
-      "model","type","is_template","FK_glpi_enterprise","deleted");
-
-  var $ID                 ;       // Is set if this entry is edited 
-  var $name               = "";    // This should be the dn of this entry 
-  var $contact            = "";    // Empty
-    
-  var $comments           = "";    // Comment
-  
-  var $contact_num        = "";    // Contact person
-  var $tech_num           = "";    // Technical responsible person
-  
-  var $addUser            = "";    // This is used to remember if a dialog was opened for tech_num or contact_num 
-
-  var $date_mod           = "";    // Modification timestamp
-  var $os                 = 0;     // Operating system
-  var $location           = 0;     // Not used yet
-  var $domain             = 0;     // ? Set to 0
-  var $network            = 0;     // ? Set to 0 
-
-  var $model              = 0;     // ? Can't remember this, it isn't used in GOsa 
-  var $type               = 0;     // System type id
-  var $is_template        = 0;     // Used as template ?
-  var $FK_glpi_enterprise = 0;     // Manufacturer id
-  var $deleted            = "N";   // Deleted entries should have this set to Y
-
-  var $renameTypeDialog   = false;
-  var $renameOSDialog     = false;
-  var $select_type        ;
-  var $view_logged = FALSE;
-  
-  /* Not necessary, cause we use mysql databse */
-  var $objectclasses= array("whatever");
-
-  /* Used to remember if this was an account (simply: is this an edited entry) */
-  var $initially_was_account = false;
-
-  /* Remember current dialog */
-  var $edit_type            = false;
-  var $edit_os              = false;
-
-  var $data;
-  var $handle = NULL;               // Glpi class handle used to query database
-
-  var $cur_dialog = NULL;           // This contains the sub dialog handle
-
-  var $orig_dn;                     // To check if dn, has changed 
-  var $ui;                          // Some GOsa specific user informations 
-  
-  var $usedDevices      = array();  // Which devices are currently selected 
-  var $usedAttachments  = array();  // Used Attachments 
-
-  /* Contructor 
-     Sets default values and checks if we already have an existing glpi account
-   */
-  function glpiAccount (&$config, $dn= NULL, $parent= NULL)
-  {
-    plugin::plugin ($config, $dn, $parent);
-    $this->ui= get_userinfo();
-
-    /* Abort class construction, if no db is defined */
-    if(!isset($this->config->data['SERVERS']['GLPI'])){
-      return;
-    }
-
-    // Get informations about databse connection
-    $this->data = $this->config->data['SERVERS']['GLPI'];
-
-    // Abort if mysql extension is missing 
-    if(!is_callable("mysql_connect")){
-      return;
-    }
-
-    // Create handle of glpi class, and check if database connection is established 
-    $this->handle = new glpiDB($this->data['SERVER'],$this->data['LOGIN'],$this->data['PASSWORD'],$this->data['DB']);
-
-    if(!$this->handle->is_connected){
-      return;
-    } 
-
-    // If this dn is already used in database, then get all informations for this entry 
-    if($this->handle->is_account($this->dn)){
-      $this->is_account = true;
-      $tmp = ($this->handle->getComputerInformations($this->dn));
-
-      foreach(array("tech_num","os","FK_glpi_enterprise","type","comments","contact_num") as $attr){
-        $this->$attr = $tmp[0][$attr];
-      }
-      $this->usedDevices = $this->handle->getUsedDevices($tmp[0]['ID']);
-      $atts = $this->handle->getAssignAttachments($tmp[0]['ID']);
-      foreach($atts as $attachment){
-        
-        $this->usedAttachments[$attachment['FK_doc']]=$attachment['FK_doc']; 
-      }
-    }else{
-      $this->is_account = false;
-    }
-
-    /* set defaults */
-    $this->name                 = $this->dn;
-    $this->orig_dn              = $this->dn;
-    $this->initially_was_account = $this->is_account;
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","all/".get_class($this),$this->dn);
-    }
-
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-    $display= "";
-
-    /*  Assign smarty defaults 
-        To avoid undefined indexes, if there is an error with the glpi db
-     */ 
-    foreach(array("SystemTypes","SystemTypeKeys","Manufacturers",
-                  "OSs","TechnicalResponsibles","InstalledDevices","Attachments","AttachmentKeys",
-                  "OSKeys","OSs","ManufacturerKeys","InstalledDeviceKeys") as $attr){
-      $smarty->assign($attr,array());
-    }
-    foreach(array("type","FK_glpi_enterprise","os","tech_num","comments","contact_num","AttachmentsDiv") as $attr){
-      $smarty->assign($attr,"");
-    }
-
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translation) {
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-
-    /* Check if there is a glpi database server defined 
-      */
-    if(!isset($this->config->data['SERVERS']['GLPI'])){
-      print_red(_("There is no server with valid glpi database service."));
-      return($smarty->fetch(get_template_path('glpi.tpl', TRUE)));
-    }
-
-    $this->data = $this->config->data['SERVERS']['GLPI'];
-
-    /* Check if we can call mysql_connect 
-       If we can't, there is no the mysql-php extension
-     */
-    if(!is_callable("mysql_connect")){
-      print_red(_("Can't connect to glpi database, the php-mysql extension is missing."));
-      return($smarty->fetch(get_template_path('glpi.tpl', TRUE)));
-    }
-
-    $this->handle = new glpiDB($this->data['SERVER'],$this->data['LOGIN'],$this->data['PASSWORD'],$this->data['DB']);
-
-    /*  If handle == false, abort
-        Seems that the server, username and or password is wrong
-     */
-    if(!$this->handle->is_connected){
-      print_red(_("Can't connect to glpi database, check configuration twice."));
-      return($smarty->fetch(get_template_path('glpi.tpl', TRUE)));
-    } 
-
-    /*  All checks are ok
-        Lets handle Posts, templates etc below ...
-     */
-    
-    $users = $this->handle->getUsers();
-    $ldap= $this->config->get_ldap_link();
-    /* Check for Trading button Post
-     */
-    if(isset($_POST['Trading'])){
-      print_red(_("This feature is not implemented yet."));
-    }
-
-    /* Check for Software button Post
-     */
-    if(isset($_POST['Software'])){
-      print_red(_("This feature is not implemented yet."));
-    }
-
-    /* Check for Contract button Post
-     */
-    if(isset($_POST['Contracts'])){
-      print_red(_("This feature is not implemented yet."));
-    }
-    /* Add Device was requested, open new dialog
-     */
-    if((isset($_POST['AddDevice'])) && ($this->acl_is_writeable("Devices"))){
-      $this->dialog =true;
-      $this->cur_dialog = new glpiDeviceManagement($this->config,$this->dn,$this->usedDevices);
-    }
-
-    /* Attachment pool was closed with use
-     */
-    if(isset($_POST['UseAttachment']) && ($this->acl_is_writeable("Attachments"))){
-      if(count($this->cur_dialog->check())){
-        foreach($this->cur_dialog->check() as $msg){
-          print_red($msg);
-        }
-      }else{
-        $this->cur_dialog->save_object();
-        $this->usedAttachments = $this->cur_dialog->save();
-        $this->cur_dialog = false;
-        $this->edit_type = false; 
-      }
-    }
-   
-    /* Attachment pool was closed with abort
-     */ 
-    if(isset($_POST['AbortAttachment'])){
-      $this->cur_dialog = false;
-      $this->edit_type = false; 
-    }
-
-    /* Open Attachment pool to add/edit Attachments
-     */
-    if(isset($_POST['AddAttachment']) && ($this->acl_is_writeable("Attachments"))){
-      $this->cur_dialog = new glpiAttachmentPool($this->config,$this->dn,$this->usedAttachments);
-      $this->dialog = true;
-    }
-    
-    /* Remove Attachment fro this tab 
-     */
-    $once = true;
-    foreach($_POST as $name => $value){
-      if((preg_match("/^delAttachment_/",$name))&&($once) && $this->acl_is_writeable("Attachments")){
-        $once= false;
-        $name = preg_replace("/^delAttachment_/","",$name);
-        $entry = preg_replace("/_.*$/","",$name);
-        if(isset($this->usedAttachments[$entry])){
-          unset($this->usedAttachments[$entry]);
-        }
-      }
-    }
-    if((isset($_POST['RemoveAttachment']))&&(isset($_POST['Attachments'])) && ($this->acl_is_writeable("Attachments"))){
-      foreach($_POST['Attachments'] as $entry){
-        if(isset($this->usedAttachments[$entry])){
-          unset($this->usedAttachments[$entry]);
-        }
-      }
-    }
-
-    /* We have selected some devices and pressed use button 
-     */
-    if(isset($_POST['SelectDeviceSave']) && $this->acl_is_writeable("Devices")){
-      $this->cur_dialog->save_object();
-      $this->usedDevices= ($this->cur_dialog->getSelected());
-      $this->cur_dialog = false;
-      $this->dialog = false;
-      $this->edit_type=false;
-    }
-
-    /* Aborted Device selction 
-     */
-    if(isset($_POST['SelectDeviceCancel']) && ($this->acl_is_writeable("Devices"))){
-      $this->dialog = false;
-      $this->cur_dialog = false;
-      $this->edit_type=false;
-    }
-
-    /* System type management
-     */
-    if(isset($_POST['edit_type']) && $this->acl_is_writeable("type")){
-      $this->dialog = true;
-      $this->edit_type=true;
-    }
-
-    /* This closes the system type editing dialog
-     */
-    if(isset($_POST['close_edit_type']) && ($this->acl_is_writeable("type"))){
-      $this->edit_type=false;
-      $this->dialog = false;
-    }
-
-    if(isset($_POST['Rename_Cancel'])){
-      $this->renameTypeDialog = false;
-      $this->renameOSDialog = false;
-    }
-
-    /* This appends a new system to our sytem types
-     */
-    if((isset($_POST['add_type']))&&(!empty($_POST['type_string'])) && $this->acl_is_writeable("type")){
-      $attr = $this->handle->getSystemTypes();
-      if(in_array(trim($_POST['type_string']),$attr)){
-        print_red(_("Adding new sytem type failed, this system type name is already used.")) ;
-      }else{
-        $this->handle->addSystemType(trim($_POST['type_string']));  
-      }
-    }
-
-    /* Remove selected type from our system types list
-     */
-    if((isset($_POST['del_type']))&&(!empty($_POST['select_type'])) && $this->acl_is_writeable("type")){
-      $tmp = $this->handle->is_systemTypeUsed($_POST['select_type']);
-      if(count($tmp)){
-        $names = "";
-        foreach($tmp as $name){
-          $names .= ", ".$name;
-        }
-        $names = preg_replace("/^, /","",$names); 
-        $names = trim($names);
-        if(count($tmp) == 3){
-          $names .= " ...";
-        }
-        print_red(sprintf(_("You can't delete this system type, it is still in use by these system(s) '%s'"),$names));
-      }else{
-        $this->handle->removeSystemType($_POST['select_type']); 
-      } 
-    }
-
-    /* Rename selected system type to given string
-     */
-    if(isset($_POST['Rename_type_OK'])){
-      $attr = $this->handle->getSystemTypes();
-      if(in_array(trim($_POST['string']),$attr)){
-        print_red(_("Rename failed, this system type name is already used.")) ;
-      }else{
-        $this->renameTypeDialog = false;
-        $this->handle->updateSystemType($_POST['string'],trim($this->select_type));
-      }
-    }
-    
-  
-    if((isset($_POST['rename_type'])&&(!empty($_POST['select_type'])))||($this->renameTypeDialog)){
-      if(isset($_POST['select_type'])){
-        $this->select_type = $_POST['select_type'];
-      }
-      $this->renameTypeDialog = true;
-      $tmp = $this->handle->getSystemTypes();
-       
-      $smarty->assign("string",$tmp[$this->select_type]);
-      if(isset($_POST['string'])){
-        $smarty->assign("string",$_POST['string']);
-      }
-      $smarty->assign("Method","rename");
-      $display= $smarty->fetch(get_template_path('glpi_edit_type.tpl', TRUE));
-      return($display);
-    }
-
-    
-
-    /* Someone wants to edit the system types ... 
-       So, lets open a new dialog which provides some buttons to edit the types
-     */
-    if($this->edit_type){
-      $smarty->assign("Method","edit");
-      $smarty->assign("SystemTypes",            $this->handle->getSystemTypes());
-      $smarty->assign("SystemTypeKeys",         array_flip($this->handle->getSystemTypes()));
-      $display= $smarty->fetch(get_template_path('glpi_edit_type.tpl', TRUE));
-      return($display);
-    }
-
-    /* System os management
-     */
-    if(isset($_POST['edit_os']) && $this->acl_is_writeable("os")){
-      $this->dialog = true;
-      $this->edit_os=true;
-    }
-
-    /* Close Operating system dialog
-     */
-    if(isset($_POST['close_edit_os'])){
-      $this->edit_os=false;
-      $this->dialog = false;
-    }
-
-    /* Add new os to the db
-     */
-    if((isset($_POST['add_os']))&&(!empty($_POST['is_string']))  && $this->acl_is_writeable("os")){
-      $attr = $this->handle->getOSTypes();
-      if(in_array(trim($_POST['is_string']),$attr)){
-        print_red(_("Adding new operating system failed, specifed name is already used.")) ;
-      }else{
-        $this->handle->addOS(trim($_POST['is_string']));  
-      }
-    }
-
-    /* Delete selected os from list and db
-     */
-    if((isset($_POST['del_os']))&&(!empty($_POST['select_os']))  && $this->acl_is_writeable("os")){
-      $tmp = $this->handle->is_osUsed($_POST['select_os']);
-  
-      if(count($tmp)){
-
-        $names = "";
-        foreach($tmp as $name){
-          $names .= ", ".$name;
-        }
-        $names = preg_replace("/^, /","",$names);
-        $names = trim($names);
-        if(count($tmp) == 3){
-          $names .= " ...";
-        }
-        print_red(sprintf(_("You can't delete this operating system, it is still in use by these system(s) '%s'"),$names));
-
-      }else{
-        $this->handle->removeOS_byID($_POST['select_os']);  
-      }
-    }
-
-    /* Rename selected os to given string
-     */
-    if(isset($_POST['Rename_os_OK'])  && $this->acl_is_writeable("os")){
-      $attr = $this->handle->getOSTypes();
-      if(in_array(trim($_POST['string']),$attr)){
-        print_red(_("Updating operating system failed, specifed name is already used.")) ;
-      }else{
-        $this->handle->updateOS($_POST['string'],$this->select_type);
-        $this->renameOSDialog = false;
-      }
-    }
-    if((isset($_POST['rename_os'])&&(!empty($_POST['select_os'])))||($this->renameOSDialog)){
-      if(isset($_POST['select_os'])){
-        $this->select_type = $_POST['select_os'];
-      }
-      $this->renameOSDialog = true;
-      $tmp = $this->handle->getOSTypes();
-       
-      $smarty->assign("string",$tmp[$this->select_type]);
-      if(isset($_POST['string'])){
-        $smarty->assign("string",$_POST['string']);
-      }
-      $smarty->assign("Method","rename");
-      $display= $smarty->fetch(get_template_path('glpi_edit_os.tpl', TRUE));
-      return($display);
-    }
-
-    /* Open dialog to edit os types 
-     */
-    if($this->edit_os){
-      $smarty->assign("Method","edit");
-      $smarty->assign("OSs",            $this->handle->getOSTypes());
-      $smarty->assign("OSKeys",         array_flip($this->handle->getOSTypes()));
-      $display= $smarty->fetch(get_template_path('glpi_edit_os.tpl', TRUE));
-      return($display);
-    }
-
-
-
-    /* Show dialog to select a new contact person
-     * Select a contact person
-     */
-    if(isset($_POST['SelectContactPerson']) && $this->acl_is_writeable("contact_num")){
-      $this->addUser = "contact";
-      $this->cur_dialog= new glpiSelectUser($this->config,$this->dn,"user_tech_num");
-      $this->cur_dialog->set_acl_category(preg_replace("/\//","",$this->acl_category));
-      $this->cur_dialog->set_acl_base($this->dn);
-
-    }
-
-    /* Open dialog which allows to edit the manufacturers
-     */
-    if(isset($_POST['edit_manufacturer']) && $this->acl_is_writeable("FK_glpi_enterprise")){
-      $this->cur_dialog = new glpiManufacturer($this->config,$this->dn);
-      $this->dialog = true;
-    }
-
-    /* Close manufacturer editing dialog
-     */
-    if(isset($_POST['close_edit_manufacturer'])){
-      $this->dialog = false;
-      $this->cur_dialog = false;
-    }
-
-    /* Abort user selection
-     */
-    $smarty->assign("AbortSelectUser","SelectUserCancel");
-    if(isset($_POST['SelectUserCancel'])){
-      $this->dialog = false;
-      $this->addUser ="";
-      $this->cur_dialog = false;
-    }
-
-    /* Selecte technical responsible person
-     */
-    if(isset($_POST['SelectTechPerson']) && $this->acl_is_writeable("tech_num")){
-      $this->addUser ="tech";
-      $this->cur_dialog= new glpiSelectUser($this->config,$this->dn,"user_tech_num");
-      $this->cur_dialog->set_acl_category(preg_replace("/\//","",$this->acl_category));
-      $this->cur_dialog->set_acl_base($this->dn);
-    }
-
-    /* Technical responsible person selected*/
-    if(isset($_GET['act'])&&($_GET['act']=="user_tech_num")&&(strlen($_GET['id']) > 100)){
-      print_red(sprintf(_("Could not add the given user, the users dn is too long, only 100 characters are allowed here.")));
-
-    }elseif(isset($_GET['act'])&&($_GET['act']=="user_tech_num") && strlen($_GET['id'])){
-
-
-      /* Get posted id */
-      $id = base64_decode($_GET['id']);
-
-      /* Check if user is already created in glpi database */
-      if(!in_array($id,$users)){
-
-        /* If this user doesn't exists in glpi db, we must create him */
-        $ldap->cat($id, array('cn', 'mail', 'telephoneNumber'));
-        $atr = $ldap->fetch();
-        $tmp = array();
-        $use = array( "cn"              =>"name",
-            "mail"            =>"email",
-            "telephoneNumber" =>"phone");
-
-        /* Create array */
-        foreach($use as $gosa => $glpi){
-          if(isset($atr[$gosa])){
-            $tmp[$glpi]= $atr[$gosa][0];
-          }
-        }
-
-        /* Add this user */
-        $this->handle->addUser($tmp,$id);
-      }
-
-      /* Re-read users */
-      $users = ($this->handle->getUsers());
-
-      /* Get user */
-      $tmp = array_flip($users);
-      $id=$tmp[$id];
-
-      /* Use user id, close dialog */
-      if($this->addUser == "tech"){
-        $this->tech_num = $id;
-      }else{
-        $this->contact_num = $id;
-      }
-      $this->cur_dialog   = false;
-      $this->dialog= false;
-    }
-
-    /* if( cur_dialog != false || cur_dialog != NULL) 
-     * There is a dialog which wants to be displayed 
-     */
-    if(isset($this->cur_dialog) && is_object($this->cur_dialog)){
-      $this->cur_dialog->save_object();
-      $this->dialog=true;
-      $this->cur_dialog->parent = &$this;
-      return($this->cur_dialog->execute());
-    }else{
-      $this->dialog= false;
-    }
-
-    /* Assign smarty defaults */ 
-    foreach(array("SystemTypes","SystemTypeKeys","Manufacturers","OSs","TechnicalResponsibles","InstalledDevices","Attachments") as $attr){
-      $smarty->assign($attr,array());
-    }
-
-    /* Assign some vars to smarty 
-     */
-    foreach(array("type","FK_glpi_enterprise","os","tech_num","contact_num","Attachments","InstalledDevices") as $attr){
-      $smarty->assign($attr,"");
-    }
-
-    /* Do we need to flip is_account state? */
-    if(isset($_POST['modify_state'])){
-      if($this->is_account && $this->acl_is_removeable()){
-        $this->is_account= FALSE;
-      }elseif(!$this->is_account && $this->acl_is_createable()){
-        $this->is_account= TRUE;
-      }
-    }
-
-    /* Show tab dialog headers */
-    if ($this->is_account){
-      $display= $this->show_disable_header(_("Remove inventory"),
-          _("This device has inventory informations enabled. You can disable them by clicking below."));
-    } else {
-      $display= $this->show_enable_header(_("Add inventory"),
-          _("This device has inventory informations disabled. You can enable them by clicking below."));
-      return ($display);
-    }
-
-    /* Assign system types 
-     */
-    $smarty->assign("SystemTypeKeys",         array_flip($this->handle->getSystemTypes()));
-    $smarty->assign("SystemTypes",            $this->handle->getSystemTypes());
-    $smarty->assign("type",                   $this->type);
-
-    /* Assign os types
-     */
-    $smarty->assign("OSKeys",                 array_flip($this->handle->getOSTypes()));
-    $smarty->assign("OSs",                    $this->handle->getOSTypes());
-    $smarty->assign("os",                     $this->os);
-
-    /* Dispaly installed devices */
-    $smarty->assign("InstalledDevices"        ,$this->getDevices());
-    $smarty->assign("InstalledDeviceKeys"     ,array_flip($this->getDevices()));
-
-    /* Append manufacturers
-     */
-    $smarty->assign("ManufacturerKeys",       array_flip($this->handle->getEnterprises()));
-    $smarty->assign("Manufacturers",          $this->handle->getEnterprises());
-    $smarty->assign("FK_glpi_enterprise",     $this->FK_glpi_enterprise);
-
-    /* Assign used Attachments
-    */
-
-    $divlist = new divSelectBox("glpiAttachmentsList");
-    $divlist-> SetHeight(130); 
-    $atts = $this->getUsedAttachments(true);
-    $downlink = "<a href='get_attachment.php?id=%s' target='_blank'>%s</a>";
-    $del_link = "<input type='image' src='images/edittrash.png' name='delAttachment_%s'>";
-    foreach($atts as $id => $attachment){
-      $divlist->AddEntry
-          (
-        array(
-            array("string"=>$attachment['name']),
-            array("string"=>$attachment['mime']),
-            array("string"=>sprintf($downlink,$id,$attachment['filename'])),
-            array("string"=>sprintf($del_link,$attachment['ID']),"attach"=>"style='border-right:0px;'"),
-             )
-          );
-    }
-
-    $smarty->assign("AttachmentsDiv"          ,$divlist->DrawList());
-    /* Handle contact person 
-       Assign name ... to smarty, if set
-     */ 
-    if(isset($users[$this->contact_num])){
-      $ldap->cat($users[$this->contact_num], array('givenName', 'sn', 'uid'));
-      $tr = $ldap->fetch();
-      $str = "";
-      if(isset($tr['givenName'][0])){   $str .= $tr['givenName'][0]." ";      }
-      if(isset($tr['sn'][0])) {         $str .= $tr['sn'][0]." ";             }
-      if(isset($tr['uid'][0])){         $str .= "[".$tr['uid'][0]."]";        }
-      $smarty->assign("contact_num",               $str);
-    }else{
-      $smarty->assign("contact_num",               _("N/A"));
-    }
-
-    /* Handle tech person 
-       Assign name ... to smarty, if set
-     */ 
-    if(isset($users[$this->tech_num])){
-      $tr = $ldap->cat($users[$this->tech_num], array('givenName', 'sn', 'uid'));
-      $tr = $ldap->fetch();
-      $str = "";
-      if(isset($tr['givenName'][0])){   $str .= $tr['givenName'][0]." ";      }
-      if(isset($tr['sn'][0])) {         $str .= $tr['sn'][0]." ";             }
-      if(isset($tr['uid'][0])){         $str .= "[".$tr['uid'][0]."]";        }
-      $smarty->assign("tech_num",               $str);
-    }else{
-      $smarty->assign("tech_num",               _("N/A"));
-    }
-    $smarty->assign("comments",               $this->comments);
-
-    $display.= $smarty->fetch(get_template_path('glpi.tpl', TRUE));
-    return($display);
-  }
-
-  function remove_from_parent()
-  {
-    /* Cancel if there's nothing to do here */
-    if ((!$this->initially_was_account) || (!$this->acl_is_removeable())){
-      return;
-    }
-    if(function_exists("mysql_pconnect")){
-      $this->handle = new glpiDB($this->data['SERVER'],$this->data['LOGIN'],$this->data['PASSWORD'],$this->data['DB']);
-      if($this->initially_was_account){
-        $this->handle->removeComputerInformations($this->dn); 
-        new log("remove","undefined/".get_class($this),$this->dn);
-      }
-    }else{
-      print_red(_("Can't remove glpi account, while mysql extension is missing."));
-      new log("remove","undefined/".get_class($this),$this->dn,array(),_("Can't remove glpi account, while mysql extension is missing."));
-    }
-  
-  }
-
-  function getDevices(){
-    $ret = array();
-    foreach($this->usedDevices as $type => $entries){
-      foreach($entries as $ent){
-        if(isset($ent['designation'])){
-          $ret[] = $ent['designation']." [".$type."]";
-        }else{
-          $ret[] = $ent['name']." [".$type."]";
-        }
-      }
-    }
-    return($ret); 
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    if(!isset($_POST['glpi_tpl_posted'])) {
-      return ;
-    }
-    plugin::save_object();
-  }
-
-
-  /* Check supplied data */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    //    if($this->TechnicalResponsible == ""){
-    //      $message[] = _("Please select a technical responsible person for this entry.");
-    //    }
-
-    return ($message);
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    if($this->is_account){
-        $attrs = array();
-      $this->date_mod = date("Y-m-d H:i:s");
-      foreach($this->attributes as $attr){
-        $attrs[$attr] = $this->$attr;
-      }
-      $attrs['name'] = $this->dn;
-      unset($attrs['ID']);
-      $this->handle = new glpiDB($this->data['SERVER'],$this->data['LOGIN'],$this->data['PASSWORD'],$this->data['DB']);
-
-      /* check if we have to update, add */
-      if($this->initially_was_account&&$this->is_account){
-        $this->handle->updateComputerInformations($attrs,$this->orig_dn);
-        new log("modify","undefined/".get_class($this),$this->dn);
-      }elseif($this->is_account){
-        $this->handle->addComputerInformations($attrs,$this->dn);
-        new log("create","undefined/".get_class($this),$this->dn);
-      }
-      $tmp = $this->handle->getComputerInformations($this->dn);
-      $this->handle->addDevicesToComputer($this->usedDevices,$tmp[0]['ID']);
-    }
-  }
-
-
-  /* Return used attachments */
-  function getUsedAttachments($divlist = false)
-  {
-    $atts =$this->handle->getAttachments();
-    $ret = array();
-    foreach($atts as $entry){
-      if(in_array($entry['ID'],$this->usedAttachments)){
-        if($divlist){
-          $ret[$entry['ID']] = $entry;
-        }else{
-          $cm ="";
-          if(isset($entry['comment'])){
-            $cm=" [".$entry['comment']."]";
-          }
-          if(isset($entry['mime'])){
-            $cm.=" -".$entry['mime']."";
-          }
-
-          $ret[$entry['ID']]= $entry['name'].$cm;
-        }
-      }
-    }
-    return($ret);
-  }
-
-   /* Return plugin informations for acl handling */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("Glpi"),
-          "plDescription" => _("Inventory extension"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 20,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("workstation","terminal","component","server","phone") ,
-          "plProvidedAcls"=> array(
-          
-            "tech_num"            => _("Technical responsible"),
-            "comments"            => _("Comment"),
-            "os"                  => _("Operating system"),
-            "location"            => _("Location"),
-            "contact_num"         => _("Contact person"),
-            "model"               => _("Model"),
-            "type"                => _("Type"),
-            "FK_glpi_enterprise"  => _("Manufacturer"),
-            "Attachments"         => _("Attachments"),
-            "Devices"             => _("Peripheral devices"))
-          ));
-  }
-  
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_glpiAttachmentPool.inc b/plugins/admin/systems/class_glpiAttachmentPool.inc
deleted file mode 100644 (file)
index b500660..0000000
+++ /dev/null
@@ -1,362 +0,0 @@
-<?php
-
-class glpiAttachmentPool 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("name","comment","mime","filename","date_mod");
-  var $objectclasses  = array("whatever");
-
-  var $parent;
-  var $edit = false;
-  var $entry = false;
-  var $date_mod ="";
-  var $name     ="";
-  var $comment  ="";
-  var $mime     ="";
-  var $filename ="";  
-
-  var $Selected = array();
-
-  var $delAttach= "";
-
-  function glpiAttachmentPool (&$config, $dn= NULL,$used=NULL)
-  {
-    plugin::plugin ($config, $dn);
-    if(!isset($_SESSION['GlpiAttachmentFilter'])){
-      $_SESSION['GlpiAttachmentFilter'] = array("filter"=>"*");
-    }
-
-    /* Assign used attributes */
-    if($used !== NULL){
-      $this->Selected = $used;
-    }
-  }
-
-  function execute()
-  {
-    plugin::execute();
-    $attach     = $this->parent->handle->getAttachments();
-    /* Fill templating stuff */
-    $smarty     = get_smarty();
-    $display    = "";
-    $only_once  = true; 
-
-    /* walk through all posted objects */
-    foreach($_POST as $name => $value){
-
-      /* Open dialog to create a new entry */
-      if(preg_match("/new_attach/",$name)){
-        $this->edit = true;
-        $this->entry=array();
-
-        /* Set default values */
-        foreach($this->attributes as $attr) {
-          $this->$attr = "";
-          $this->entry[$attr]="";
-        }
-      }
-  
-      /* Remove attach*/ 
-      if((preg_match("/^delAttach_/",$name))&&($only_once)){
-        $only_once = false;
-        $str = preg_replace("/^delAttach_/","",$name);
-        $str = base64_decode(preg_replace("/_.*$/","",$str));
-
-        /* remove attach from db */
-        $this->delAttach = $str;
-        $smarty->assign("warning", sprintf(_("You're about to delete the glpi attachment component '%s'."), $attach[$str]['name']));
-        return($smarty->fetch(get_template_path('remove_glpi.tpl', TRUE)));
-      }
-      /* Start editing entry */ 
-      if((preg_match("/^editAttach_/",$name))&&($only_once)){
-        $only_once = false;
-        $str = preg_replace("/^editAttach_/","",$name);
-        $str = base64_decode(preg_replace("/_.*$/","",$str));
-        
-        /* Check if we have an attachment with given ID */ 
-        foreach($attach as $att ){
-          if($att['ID'] == $str ){
-
-            /* Entry was found, show dialog */          
-            $this->edit = true;
-            $this->entry  = $att;       
-
-            foreach($att as $name => $value){
-              $this->$name = $value;
-            } 
-          } 
-        }
-      }
-    }
-
-    if((isset($_POST['delete_glpi_confirm']))&&(isset($attach[$this->delAttach]))){
-      if($this->parent->handle->is_attachmentUsed($this->delAttach)){
-        $tmp = $this->parent->handle->is_attachmentUsed($this->delAttach);
-        
-        $names = "";
-        foreach($tmp as $name){
-          $names .= ", ".$name;
-        }
-        $names = preg_replace("/^, /","",$names);
-        $names = trim($names);
-        if(count($tmp) == 3){
-          $names .= " ...";
-        }
-        print_red(sprintf(_("You can't delete this attachment, it is still in use by these system(s) '%s'"),$names));
-
-      }else{
-        $this->parent->handle->deleteAttachment($this->delAttach);
-        @unlink(CONFIG_DIR."/glpi/".$this->filename);
-        $attach     = $this->parent->handle->getAttachments();
-      }
-    }
-
-    /* Someone tries to upload a file */
-    if(($this->edit == true)&&(isset($_POST['upload']))){
-      if(!isset($_FILES['filename'])){
-        print_red(_("There is no valid file uploaded."));
-      }else{
-        $FILE = $_FILES['filename'];  
-        if(!isset($FILE['name'])){
-          print_red(_("There is no valid file uploaded."));
-        }else{
-          if($FILE['error']!=0) {
-            print_red(_("Upload wasn't successfull."));
-          }else{
-            if(!is_dir(CONFIG_DIR."/glpi/")){
-              print_red(sprintf(_("Missing directory '%s/glpi/' to store glpi uploads."),CONFIG_DIR));
-            }else{
-              $filen = CONFIG_DIR."/glpi/".$FILE['name'];
-              if(file_exists($filen)){
-                print_red(_("There is already a file with the same name uploaded."));
-              }else{
-                $fh = fopen($filen,"w");
-                if(!$fh){
-                  print_red(sprintf(_("Can't create file '%s'."),$filen));
-                }else{
-                  $str = file_get_contents($FILE['tmp_name']);
-                  fwrite($fh,$str,strlen($str));
-                  fclose($fh);
-                  $this->mime     = $FILE['type'];   
-                  $this->filename = $FILE['name'];   
-                }
-              } // File already exists
-            }
-          } // Check if any error occurred
-        } // check if valid filename was uploaded
-      } // ende check if file was uploaded 
-    }// upload post
-
-    /* save attachment*/
-    if(($this->edit == true)&&(isset($_POST['SaveAttachment']))){
-      if(count($this->check())==0){
-        $this->date_mod = date("Y-m-d H:i:s");
-        $this->save_entry();
-        $this->edit= false;
-        $this->entry = array();
-        $attach = $this->parent->handle->getAttachments();
-      }else{
-        foreach($this->check() as $msg){
-          print_red($msg);
-        }
-      }
-    }
-
-    /* Abort editing/adding  attachment*/
-    if(($this->edit == true)&&(isset($_POST['CancelAttachment']))){
-      $this->edit  = false;
-      $this->entry = array();
-    }
-
-    /* If edit == true, we have to show a dialog to edit or add an attach 
-     */
-    if($this->edit == true){
-      foreach($this->attributes as $attr){
-        $smarty->assign($attr,htmlentities(utf8_decode($this->$attr)));
-      }
-      if(!empty($this->filename)){
-        if(is_readable(CONFIG_DIR."/glpi/".$this->filename)){
-          $status =_("File is available.");
-        }else{
-          $status =_("File is not readable, possibly the file is missing.");
-        }
-      }else{
-        $status = _("Currently no file uploaded.");
-      }
-      $smarty->assign("status",$status); 
-      return($smarty->fetch(get_template_path('glpiAttachmentEdit.tpl', TRUE)));
-    }
-
-    /* Create list with checkboxes to select / deselect some attachents */
-    $divlist = new divlist("Attachment");  
-    $divlist->SetPluginMode();
-    $divlist->SetHeader(array(
-          array("string" => "&nbsp;", "attach" => "style='text-align:center;width:20px;'"),
-          array("string" => _("Name")),
-          array("string" => _("Mime"),"attach"=>"style='width:200px;'"),
-          array("string" => _("Actions"), "attach" => "style='width:60px;border-right:0px;text-align:right;'" )));
-
-    $divlist->SetSummary(_("This table displays all available attachments."));
-    $divlist->SetEntriesPerPage(0);
-
-    $editdel = "<input type='image' name='editAttach_%s' src='images/edit.png'>";
-    $editdel.= "<input type='image' name='delAttach_%s'  src='images/edittrash.png'>";
-
-    /* Add all given attachments to divlist 
-     */ 
-    foreach($attach as $entry){
-
-      /* Create display name*/
-      if((empty($entry['name']))||(empty($entry['comment']))){
-
-        /* In glpi it is possible to add entries without name 
-           so i've added this block 
-         */ 
-        if(empty($entry['name'])){
-          $str1 = "<i>"._("empty")."</i>";
-        }else{ 
-          $str1 = $entry['name'];
-        }
-
-        if(!empty($entry['comment'])){
-          $str1.= " [".$entry['comment']."]";
-        }
-      }else{
-        /* Both attributes given */
-        $str1 = $entry['name']." [".$entry['comment']."]";
-      }
-
-      $edit = str_replace("%s",base64_encode($entry['ID']),$editdel);
-      $str2 = $entry['mime']."&nbsp;";      
-
-      $chkbox = "<input type='hidden' name='wasOnPage_%s'>".
-        "<input type='checkbox' name='useMe_%s' value='%s' %CHECKED%>";
-
-      if(in_array($entry['ID'],$this->Selected)){
-        $chkbox = preg_replace("/%CHECKED%/"," checked ",$chkbox);
-      }else {
-        $chkbox = preg_replace("/%CHECKED%/"," ",$chkbox);
-      }
-      $chkbox = preg_replace("/%s/",$entry['ID'],$chkbox);
-      $divlist->AddEntry(array(
-            array("string" => $chkbox, 
-              "attach" => "style='text-align:center;width:20px;'"),
-            array("string"=> $str1),
-            array("string"=> $str2,"attach"=>"style='width:200px;'"),
-            array("string"=> $edit ,"attach" => "style='width:60px;border-right:0px;text-align:right;'")
-            ));
-
-    }
-
-    $listhead = "<div style='background:#F0F0F9;padding:5px;'>".
-      "   <input class='center' type='image' 
-      src='images/fai_new_template.png' align='middle' title='"._("Create new attachment")."' 
-      name='new_attach' alt='"._("New Attachment"). "'>&nbsp;".
-      "</div>";
-
-    $smarty->assign("attachments",      $divlist->DrawList());
-    $smarty->assign("attachmenthead",   $listhead);
-    $smarty->assign("search_image",     get_template_path('images/search.png'));
-    $smarty->assign("searchu_image",    get_template_path('images/search_user.png'));
-    $smarty->assign("tree_image",       get_template_path('images/tree.png'));
-    $smarty->assign("infoimage",        get_template_path('images/info_small.png'));
-    $smarty->assign("launchimage",      get_template_path('images/small_filter.png'));
-    $smarty->assign("apply",            apply_filter());
-    $smarty->assign("alphabet",         generate_alphabet());
-    $smarty->assign("attachment_regex", $_SESSION['GlpiAttachmentFilter']['filter']);
-
-    $display.= $smarty->fetch(get_template_path('glpiAttachmentPool.tpl', TRUE));
-    return($display);
-  }
-
-  function save()
-  {
-    return($this->Selected);
-  }
-
-  /* Adds new or saves edited entries */
-  function save_entry()
-  {
-    if($this->edit){
-      $tmp = array();
-      foreach($this->attributes as $attr){
-        $tmp[$attr] = $this->$attr;
-      } 
-      $id = -1;
-      if(isset($this->entry['ID'])){
-        $id = $this->entry['ID'];
-      }
-      $this->parent->handle->saveAttachments($tmp,$id);
-    }
-  }
-
-  function save_object()
-  {
-    foreach($this->attributes as $attr){
-      if(isset($_POST[$attr])){
-        $this->$attr = $_POST[$attr];
-      }
-    }
-
-    /* Checkboxes are only posted, if they are checked
-     * To check if it was deselected, we check if wasOnPage 
-     * was posted with given name, so we can deselect this entry
-     */  
-
-    foreach($_POST as $name => $value){
-      if(preg_match("/wasOnPage_/",$name)){
-        $id=preg_replace("/wasOnPage_/","",$name);
-        if(isset($_POST["useMe_".$id])){
-          $this->Selected[$id]=$id;
-        }else{
-          if(isset($this->Selected[$id])){
-            unset($this->Selected[$id]);
-          }
-        }
-      }
-    }
-  }
-
-  /* Simple check */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    if($this->edit){
-    
-      /* check if given name is already in use */
-      $att = $this->parent->handle->getAttachments();
-      $ok = true;
-      $this->name=trim($this->name);
-
-      foreach($att as $val){
-        if(!isset($this->entry['ID'])){
-          if($val['name'] == $this->name){
-            $ok = false;
-          }
-        }else{
-          if(($val['name'] == $this->name)&&($this->entry['ID'] != $val['ID'])){
-            $ok = false;
-          }
-        }
-      }
-      if(!$ok){
-        $message[] = _("This name is already in use.");
-      }
-      if(empty($this->name)){
-        $message[] = _("Please specify a valid name for this attachment.");
-      }
-    }
-    return($message);
-  }
-
-}// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_glpiDeviceManagement.inc b/plugins/admin/systems/class_glpiDeviceManagement.inc
deleted file mode 100644 (file)
index 0f24300..0000000
+++ /dev/null
@@ -1,427 +0,0 @@
-<?php
-
-class glpiDeviceManagement 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("whatever");
-
-  var $devices = array();
-  var $ui;
-
-  var $parent   ;
-  var $EditEntry;
-  var $editMode =false;
-
-  var $DeviceAttrs = array();
-  var $AllowedDevices = array();
-
-  var $Selected = array();
-
-  var $delete = array();
-
-  function glpiDeviceManagement (&$config, $dn= NULL,$used=NULL)
-  {
-    plugin::plugin ($config, $dn);
-
-    if(!isset($_SESSION['glpiDeviceRegex'])){
-      $tmp['device_regex'] = "*";
-      $_SESSION['glpiDeviceRegex'] = $tmp;
-    }
-    $this->ui = get_userinfo();  
-
-    if(isset($used)){
-    $this->Selected = $used;
-    }
-    /* Specify which vars are allowed for a sepcific type of device */ 
-    $this->DeviceAttrs['case']      = array("designation","format","comment","FK_glpi_enterprise");
-    $this->DeviceAttrs['moboard']   = array("designation","chipset","comment","FK_glpi_enterprise");
-    $this->DeviceAttrs['processor'] = array("designation","frequence","comment","FK_glpi_enterprise","specif_default");
-    $this->DeviceAttrs['iface']     = array("designation","bandwidth","comment","FK_glpi_enterprise","specif_default");
-    $this->DeviceAttrs['ram']       = array("designation","frequence","comment","FK_glpi_enterprise","specif_default","type");
-    $this->DeviceAttrs['hdd']       = array("designation","rpm","interface","cache","comment","FK_glpi_enterprise","specif_default");
-    $this->DeviceAttrs['drive']     = array("designation","speed","interface","is_writer","comment","FK_glpi_enterprise","specif_default");
-    $this->DeviceAttrs['control']   = array("designation","interface","raid","comment","FK_glpi_enterprise");
-    $this->DeviceAttrs['gfxcard']   = array("designation","ram","interface","comment","FK_glpi_enterprise","specif_default");
-    $this->DeviceAttrs['sndcard']   = array("designation","type","comment","FK_glpi_enterprise","specif_default");
-    $this->DeviceAttrs['power']     = array("designation","power","comment","FK_glpi_enterprise","atx");
-    $this->DeviceAttrs['pci']       = array("designation","comment","FK_glpi_enterprise","specif_default");
-    $this->DeviceAttrs['monitor']   = array("name","comments","serial","otherserial","size",
-                                            "flags_micro","flags_speaker","flags_subd","flags_bnc",
-                                            "location","type","FK_glpi_enterprise","is_global","deleted","is_template","tplname");
-
-    $this->AllowedDevices=array("case","moboard","sndcard","processor","iface","ram","hdd","drive","control","gfxcard","power","pci","monitor");
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* Get all defined devices */
-    $this->reload();
-
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-    $display= "";
-
-    /* this var is used to ensure that every post is only performed once */
-    $only_once = true;
-
-    /* Check Post for some actions */
-    foreach($_POST as $name => $value){
-      
-      /* If new_ then we should create an new device */
-      if((preg_match("/^new_/",$name))&&($only_once)){
-    
-        /* don't do this twice */
-        $only_once = false;
-
-        /*extract device device_type */
-        $deviceType = preg_replace("/_.*$/","",preg_replace("/^new_/","",$name));
-
-        /* Check if type is allowed, and create empty entry */
-        $tmp = array();
-        if((!isset($this->DeviceAttrs[$deviceType]))||((!in_array($deviceType,$this->AllowedDevices)))){
-          print_red(sprintf(_("Internal Error can't create device of type '%s'"),$deviceType));
-        }else{
-          foreach($this->DeviceAttrs[$deviceType] as $attr){
-            $tmp[$attr] = "";
-          }
-          $tmp['device_type'] = $deviceType;
-          $this->EditEntry = $tmp;
-          $this->editMode =true;
-        }
-      }
-    }
-
-    /* delete was requested ... show dialog   */
-    if((isset($_GET['act']))&&($_GET['act']=="del_device")){
-      $id = base64_decode($_GET['id']);
-      $tmp = $this->devices[$id];
-
-      $this->delete = $tmp;
-
-      if(isset($tmp['name'])){
-        $smarty->assign("warning", sprintf(_("You're about to delete the glpi device '%s'."), $tmp['name']));
-      }elseif(isset($tmp['designation'])){
-        $smarty->assign("warning", sprintf(_("You're about to delete the glpi device '%s'."), $tmp['designation']));
-      }else{
-        print_red(_("Can't detect object name."));
-      }
-      
-      return($smarty->fetch(get_template_path('remove_glpi.tpl', TRUE)));
-    }
-
-    /* Delete entry, but check if this device is in currently in use */
-    if(isset($_POST['delete_glpi_confirm'])){
-      if(count($this->parent->handle->is_deviceUsed($this->delete))){
-
-        $tmp = $this->parent->handle->is_deviceUsed($this->delete);    
-  
-        $names = "";
-        foreach($tmp as $name){
-          $names .= ", ".$name;
-        }
-        $names = preg_replace("/^, /","",$names);
-        $names = trim($names);
-        if(count($tmp) == 3){
-          $names .= " ...";
-        }
-        print_red(sprintf(_("You can't delete this device, it is still in use by these system(s) '%s'"),$names));
-      }else{
-        $this->parent->handle->deleteDevice($this->delete);
-        $this->reload();
-      }
-    }
-
-    /* Open entry for editing if requested */
-    if((isset($_GET['act']))&&($_GET['act']=="edit_device")){
-      $id = base64_decode($_GET['id']);
-      $this->editMode =true;
-      $this->EditEntry = $this->devices[$id];
-    }
-
-    /* Abort editing this entry */
-    if(isset($_POST['AbortDeviceChanges'])){
-      $this->EditEntry = array();
-      $this->editMode = false;
-    }
-
-    /* Save all changes made on currently selected entry */
-    if(isset($_POST['SaveDeviceChanges'])){
-    
-      /* First check if all changes made are allowed */
-      if(count($this->check())==0){
-        $this->save();
-        $this->editMode = false;
-        $this->reload();
-      }else{
-        foreach($this->check() as $msg){
-          print_red($msg);
-        }
-      }
-      
-    }
-
-    /* Check if we are currently editing something ? */
-    if($this->editMode == true){
-      return ($this->editDevice($this->EditEntry));
-    }
-
-    /*  ENDE :  GET / POST handling 
-     *  Below, only output generation for headpage
-     */
-
-    $divlist = new divlist("glpi devices");
-    $divlist->SetPluginMode();
-    $divlist->SetEntriesPerPage(0);
-    $divlist->SetHeader(array(
-          array("string" => "&nbsp;", "attach" => "style='text-align:center;width:20px;'"),
-          array("string" => _("devices"), "attach" => "style=''"),
-          array("string" => _("Actions"), "attach" => "style='width:60px;border-right:0px;text-align:right;'" )));
-
-    $edit = "<a href='?plug=".$_GET['plug']."&amp;act=edit_device&amp;id=%s'>%s</a>";
-    $editdel = "<a href='?plug=".$_GET['plug']."&amp;act=edit_device&amp;id=%s'><img src='images/edit.png' alt='"._("Edit")."' border=0></a>";
-    $editdel.= "<a href='?plug=".$_GET['plug']."&amp;act=del_device&amp;id=%s'><img src='images/edittrash.png' alt='"._("Delete")."' border=0></a>";
-    
-    $useDevice = "<input type='hidden' name='wasOnPage_%s' value='%s'><input type='checkbox' value='%s' name='useDevice_%s' %USE%>";
-
-    foreach($this->devices as $key=>$user){
-
-      if(isset($user['designation'])){
-        $str = "designation";
-      }else{
-        $str = "name";
-      }
-
-      if(isset($this->Selected[$user['device_type']][$user[$str]])){
-        $use = " checked ";
-      }else{
-        $use ="";
-      }
-
-      /* Dawn databse struckture ....*/
-      if(empty($user['comment']) && isset($user['comments'])) {
-        $user['comment'] = $user['comments'];
-      }
-
-      $field1 = array("string" => preg_replace("/%s/",base64_encode($key),preg_replace("/%USE%/",$use,$useDevice)), "attach" => "style='text-align:center;width:20px;'");
-      $field2 = array("string" => sprintf($edit,base64_encode($key),$user[$str]."&nbsp;[".$user['comment']."]"), "attach" => "style=''");
-      $field3 = array("string" => sprintf($editdel,base64_encode($key),base64_encode($key)), 
-        "attach" => "style='width:60px;border-right:0px;text-align:right;'");
-      $divlist->AddEntry(array($field1,$field2,$field3));
-      
-    }
-    
-  $listhead = "<div style='background:#F0F0F9;padding:5px;'>".
-      " <input class='center' type='image' align='middle' 
-      src='images/monitor.png'  title='"._("New monitor")."' alt='"._("M")."' name='new_monitor'>&nbsp;".
-      " <input class='center' type='image' align='middle' 
-      src='images/mainboard.png' title='"._("New mainbord")."' alt='"._("MB")."' name='new_moboard'>&nbsp;".
-      " <input class='center' type='image' align='middle' 
-      src='images/processor.png' title='"._("New processor")."' alt='"._("P")."' name='new_processor'>&nbsp;".
-      " <input class='center' type='image' align='middle' 
-      src='images/server.png' title='"._("New case")."' alt='"._("C")."' name='new_case'>&nbsp;".
-      " <input class='center' type='image' align='middle' 
-      src='images/net_hardware.png' title='"._("New network interface")."' alt='"._("NI")."' name='new_iface'>&nbsp;".
-      " <input class='center' type='image' align='middle' 
-      src='images/memory.png' title='"._("New ram")."' alt='"._("R")."' name='new_ram'>&nbsp;".
-      " <input class='center' type='image' align='middle' 
-      src='images/fai_partitionTable.png' title='"._("New hard disk")."' alt='"._("HDD")."' name='new_hdd'>&nbsp;".
-      " <input class='center' type='image' align='middle' 
-      src='images/drives.png' title='"._("New drive")."' alt='"._("D")."' name='new_drive'>&nbsp;".
-      " <input class='center' type='image' align='middle' 
-      src='images/hardware.png' title='"._("New controller")."' alt='"._("CS")."' name='new_control'>&nbsp;".
-      " <input class='center' type='image' align='middle' 
-      src='images/gfx_hardware.png' title='"._("New graphics card")."' alt='"._("GC")."' name='new_gfxcard'>&nbsp;".
-      " <input class='center' type='image' align='middle' 
-      src='images/snd_hardware.png' title='"._("New sound card")."' alt='"._("SC")."' name='new_sndcard'>&nbsp;".
-      " <input class='center' type='image' align='middle' 
-      src='images/power.png' title='"._("New power supply")."' alt='"._("PS")."' name='new_power'>&nbsp;".
-      " <input class='center' type='image' align='middle' 
-      src='images/fai_template.png' title='"._("New misc device")."' alt='"._("OC")."' name='new_pci'>&nbsp;".
-      "</div>";
-    
-    $filter= $_SESSION['glpiDeviceRegex'];
-    $smarty->assign("devicehead", $listhead);
-    $smarty->assign("devices", $divlist->DrawList());
-    $smarty->assign("search_image", get_template_path('images/search.png'));
-    $smarty->assign("searchu_image", get_template_path('images/search_user.png'));
-    $smarty->assign("tree_image", get_template_path('images/tree.png'));
-    $smarty->assign("infoimage", get_template_path('images/info_small.png'));
-    $smarty->assign("launchimage", get_template_path('images/small_filter.png'));
-    $smarty->assign("apply", apply_filter());
-    $smarty->assign("alphabet", generate_alphabet());
-    $smarty->assign("device_regex", $filter['device_regex']);
-
-    $display.= $smarty->fetch(get_template_path('glpiDeviceManagement.tpl', TRUE));
-    return($display);
-  }
-
-  /* Save device to glpi database 
-   * If this is a new device, create a new entry, else update this entry 
-   */
-  function save()
-  {
-    if($this->parent->handle->deviceExists($this->EditEntry)){
-      $this->parent->handle->updateDevices($this->EditEntry);
-    }else{
-      $this->parent->handle->addDevice($this->EditEntry);
-    }
-
-  }
-
-  /* this only gets all already defined devices */
-  function reload()
-  {
-    $this->devices = $this->parent->handle->getDevices();
-    ksort($this->devices);
-  }
-
-  /* This funtions saves all POST variables.
-     The variable must be in the array $this->EditEntry 
-  */
-  function save_object()
-  {
-    foreach($_POST as $name => $value){
-
-      if(preg_match("/wasOnPage_/",$name)){
-        $dN = base64_decode($value);
-
-        $device = $this->devices[$dN];
-        $type   = $device['device_type'];  
-            
-        if(isset($device['designation'])){
-          $str = "designation";
-        }else{
-          $str = "name";
-        }
-
-        if(isset($_POST['useDevice_'.$value])){
-          $this->Selected[$type][$device[$str]] = $device;
-        }else{
-          if(isset($this->Selected[$type][$device[$str]])){
-            unset($this->Selected[$type][$device[$str]]);
-          }
-        }
-      }
-    }
-
-    if(is_array($this->EditEntry)){
-      foreach($this->EditEntry as $name => $value){
-        if(isset($_POST[$name])){
-          $this->EditEntry[$name] = $_POST[$name];
-        }
-
-      }
-    }
-  }
-
-  /* returns the selected devices */
-  function getSelected()
-  {
-    return($this->Selected); 
-  }
-
-  /* This function checks all created devices.
-     If you wan't to use device specific checks, 
-        use >>if($attr['device_type']=="moboard")<< to create a device type depending check
-   */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    $attr = $this->EditEntry;
-
-    if(isset($attr['designation'])){
-      $str2 = "designation";
-    }else{
-      $str2 = "name";
-    }
-    if(empty($attr[$str2])){
-      $message[]=(_("You have to specify a valid name for this device."));
-    }
-
-    /* Avoid same name twice */
-    $devices = ($this->parent->handle->getDevices());
-    foreach($devices as $dev){
-
-      /* Some devices use designation some name for name
-       */
-      if(isset($dev['designation'])){
-        $str = "designation";
-      }else{
-        $str = "name";
-      }
-
-      if($dev[$str]==$attr[$str2]){
-        
-        /* Entries with ['ID'] already exists, and are only edited, if ID is missing we are currently creating a new entry */
-        if(isset($attr['ID'])){
-          if(!(($dev['ID'] == $attr['ID'])&&($dev['device_type']==$attr['device_type']))){
-            $message[] = _("This device name is already in use.");
-          }
-        }else{
-          $message[] = _("This device name is already in use.");
-        }
-      }
-    }
-
-    return($message);
-  }
-
-  /* This functions displays the template for all available devices 
-   * This function is also used if we create a new device
-   */
-  function editDevice($entry)
-  {
-    $smarty = get_smarty();
-
-    /* Transfer given data to smarty */
-    foreach($this->EditEntry as $name => $value){
-      $smarty->assign($name,htmlentities(utf8_decode($value)));
-    }
-  
-    /* Set default select boxes, manufacturers ... */
-    $smarty->assign("device_type",$entry['device_type']);
-
-    $none = array(0 => _("none"));
-    $manufacturer = array_merge($none,$this->parent->handle->getEnterprises());
-
-    $ramtypes = $this->parent->handle->getRAMTypes();
-
-    $smarty->assign("RAMtypes",     $ramtypes);
-    $smarty->assign("RAMtypeKeys",  array_flip($ramtypes));
-
-    $deviceControlTypes = array_merge($none,$this->parent->handle->getGlpiDeviceControlTypes());
-
-    $smarty->assign("HDDInterfaceKeys",array_flip($deviceControlTypes));
-    $smarty->assign("HDDInterfaces"   , $deviceControlTypes);
-    
-    $gfxControlTypes = array("0"=>_("None"),"AGP"=>"AGP","PCI"=>"PCI","PCI-X"=>"PCI-X","Other"=>_("Other")); 
-
-    $smarty->assign("GFXInterfaceKeys",array_flip($gfxControlTypes));
-    $smarty->assign("GFXInterfaces"   , $gfxControlTypes);
-    
-    $smarty->assign("FK_glpi_enterpriseKeys",array_flip($manufacturer));
-    $smarty->assign("FK_glpi_enterprises", $manufacturer);
-
-    $smarty->assign("formats",array("Large","Medium","Micro"));
-    $smarty->assign("formats",array("Large","Medium","Micro"));
-
-    $smarty->assign("formats",array("Large","Medium","Micro"));
-    $smarty->assign("formatKeys",array('Grand','Moyen','Micro'));
-    return($smarty->fetch(get_template_path('glpi_devices.tpl', TRUE)));
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_glpiManufacturer.inc b/plugins/admin/systems/class_glpiManufacturer.inc
deleted file mode 100644 (file)
index 8e676d8..0000000
+++ /dev/null
@@ -1,170 +0,0 @@
-<?php
-
-class glpiManufacturer 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("name","type","address","website","phonenumber","comments","deleted","fax","email");
-  var $objectclasses= array("whatever");
-
-  var $ui;
-
-  var $editMode = false;
-  var $Edit_Add = "edit";
-
-  var $name       ="";
-  var $type       ="";
-  var $address    ="";
-  var $website    ="";
-  var $phonenumber="";
-  var $comments   ="";
-  var $deleted    ="";
-  var $fax        ="";
-  var $email      ="";
-  var $ID         =-1;
-
-  function glpiManufacturer(&$config, $dn= NULL, $parent= NULL)
-  {
-    plugin::plugin ($config, $dn, $parent);
-    $this->ui = get_userinfo();  
-  }
-
-  function execute()
-  {
-    plugin::execute();
-    $smarty  = get_smarty();
-    $display = "";
-
-    /* Remove enterprise from db */
-    if((isset($_POST['remove_manu']))&&(isset($_POST['manufacturer']))){
-
-      $tmp = $this->parent->handle->is_manufacturerUsed($_POST['manufacturer']);
-      if(count($tmp)){
-
-        $names = "";
-        foreach($tmp as $name){
-          $names .= ", ".$name;
-        }
-        $names = preg_replace("/^, /","",$names);
-        $names = trim($names);
-        if(count($tmp) == 3){
-          $names .= " ...";
-        }
-        print_red(sprintf(_("You can't delete this manufacturer, it is still in use by these system(s) '%s'"),$names));
-      }else{
-        $this->parent->handle->removeEnterprise($_POST['manufacturer']);
-      }
-    }
-
-    /* Add new Manufactuer : Open dialog with empty fields */
-    if(isset($_POST['add_manu'])){
-      $this->editMode = true;
-      $this->Edit_Add = "add";
-      foreach($this->attributes as $atr){
-        $this->$atr = "";
-      }
-    }
-
-    /* Edit existing manuatctuerer data */
-    if((isset($_POST['edit_manu']))&&(isset($_POST['manufacturer']))){
-      $this->editMode = true;
-      $this->Edit_Add = "edit";
-      $tmp = $this->parent->handle->getEnterprise($_POST['manufacturer']);
-      $tmp = $tmp[0];
-      foreach($this->attributes as $atr){
-        $this->$atr = "";
-      }
-      foreach($this->attributes as $atr){
-        if(isset($tmp[$atr])){
-          $this->$atr = $tmp[$atr];
-        }
-      }
-      $this->ID = $_POST['manufacturer'];
-    }
-
-    /* close Dialog without saving */
-    if(isset($_POST['close_manufacturer'])){
-      $this->editMode=false;
-    }
-
-    /* close dialog an save all changes / adds */
-    if(isset($_POST['save_manufacturer'])){
-      $tmp = array();
-      foreach($this->attributes as $attrs){
-        $tmp[$attrs]=$this->$attrs;
-      }
-
-      $allok = true;
-      if(empty($tmp['name'])){
-        print_red(_("Please specify a name."));
-        $allok = false;
-      }
-
-      $attr = $this->parent->handle->getEnterprises();
-
-      if($this->ID == -1 ){
-        if(in_array($tmp['name'],$attr)){
-          $allok = false;
-          print_red(_("Specified name is already in use, please choose another one."));
-        }
-      }else{
-        unset($attr[$this->ID]);
-        if(in_array($tmp['name'],$attr)){
-          $allok = false;
-          print_red(_("Specified name is already in use, please choose another one."));
-        }
-      }
-
-      /* all checks are ok , so save changes */
-      if($allok){
-        if($this->Edit_Add == "add"){
-          $this->parent->handle->addEnterprise($tmp);
-          $this->editMode=false;
-        }else{
-          $this->parent->handle->updateEnterprise($tmp,$this->ID);
-          $this->editMode=false;
-        }
-      }
-    }
-
-    /* As long as this war is true, we have to display the edit dialog */
-    if($this->editMode == true){
-      $this->save_object();
-      foreach($this->attributes as $attrs){
-        $smarty->assign($attrs,$this->$attrs);
-      }
-
-      $display.= $smarty->fetch(get_template_path('glpiManufacturerAdd.tpl', TRUE));
-      return($display);
-    }
-
-
-    $smarty->assign("Manus",    $this->parent->handle->getEnterprises());
-    $smarty->assign("ManuKeys", array_flip($this->parent->handle->getEnterprises()));
-    $display.= $smarty->fetch(get_template_path('glpiManufacturer.tpl', TRUE));
-    return($display);
-  }
-
-  /* Save to LDAP */
-  function save()
-  {
-  }
-
-  function save_object()
-  {
-    foreach($this->attributes as $attr){
-      if(isset($_POST[$attr])){
-        $this->$attr = stripslashes($_POST[$attr]);
-      }
-    }
-  }
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_glpiPrinterAccount.inc b/plugins/admin/systems/class_glpiPrinterAccount.inc
deleted file mode 100644 (file)
index 049249c..0000000
+++ /dev/null
@@ -1,807 +0,0 @@
-<?php
-
-class glpiPrinterAccount 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= FALSE;
-  var $attributes= array("ID","name","contact","ramSize","flags_serial","flags_par","flags_usb",
-      "tech_num","comments","date_mod","location","domain","network","contact_num","serial","otherserial",
-      "type","is_template","FK_glpi_enterprise","deleted");
-
-  var $ID                 ;       // Is set if this entry is edited 
-  var $name               = "";    // This should be the dn of this entry 
-  var $FK_glpi_enterprise = 0;     // Manufacturer id
-  var $tech_num           = "";    // Technical responsible person
-  var $contact_num        = "";    // Contact person
-  
-  var $comments           = "";    // Comment
-  
-  var $type               = 0;     // printer type id
-  var $serial             = "";   
-  var $otherserial        = "";  
-  var $ramSize            = 0;
-  var $flags_serial       = false;
-  var $flags_par          = false;
-  var $flags_usb          = false;
-
-  var $date_mod           = "";    // Modification timestamp
-  
-  var $location           = 0;     // Not used yet
-  var $domain             = 0;     // ? Set to 0
-  var $network            = 0;     // ? Set to 0 
-
-  var $is_template        = 0;     // Used as template ?
-  var $contact            = "";    // Empty
-  var $deleted            = "N";   // Deleted entries should have this set to Y
-
-  var $rename             = false;
-  var $select_type        ;
-
-  var $editManufacturer   = false;
-
-  /* Not necessary, cause we use mysql databse */
-  var $objectclasses= array("whatever");
-
-  /* Used to remember if this was an account (simply: is this an edited entry) */
-  var $initially_was_account = false;
-
-  /* Remember current dialog */
-  var $edit_type            = false;
-  var $edit_os              = false;
-
-  var $data;
-  var $handle = NULL;               // Glpi class handle used to query database
-
-  var $cur_dialog = NULL;           // This contains the sub dialog handle
-
-  var $orig_dn;                     // To check if dn, has changed 
-  var $ui;                          // Some GOsa specific user informations 
-  
-  var $usedDevices      = array();  // Which devices are currently selected 
-  var $usedAttachments  = array();  // Used Attachments 
-  var $usedCartridges   = array();  // Used Cartridges
-
-  var $view_logged      = FALSE;
-
-  /* Contructor 
-     Sets default values and checks if we already have an existing glpi account
-   */
-  function glpiPrinterAccount (&$config, $dn= NULL, $parent= NULL)
-  {
-    plugin::plugin ($config, $dn, $parent);
-    $this->ui= get_userinfo();
-
-    $this->is_account = false;
-
-    /* Abort class construction, if no db is defined */
-    if(!isset($this->config->data['SERVERS']['GLPI'])){
-      return;
-    }
-
-    // Get informations about databse connection
-    $this->data = $this->config->data['SERVERS']['GLPI'];
-
-    // Abort if mysql extension is missing 
-    if(!is_callable("mysql_connect")){
-      return;
-    }
-
-    // Create handle of glpi class, and check if database connection is established 
-    $this->handle = new glpiDB($this->data['SERVER'],$this->data['LOGIN'],$this->data['PASSWORD'],$this->data['DB']);
-
-    if(!$this->handle->is_connected){
-      return;
-    } 
-
-    // If this dn is already used in database, then get all informations for this entry 
-    if($this->handle->is_printer_account($this->dn)){
-      $this->is_account = true;
-      $tmp = ($this->handle->getPrinterInformations($this->dn));
-
-      foreach(array("tech_num","FK_glpi_enterprise","type","comments","contact_num","flags_serial","flags_par","flags_usb","ramSize") as $attr){
-        $this->$attr = $tmp[0][$attr];
-      }
-      
-      $atts = $this->handle->getAssignPrinterAttachments($tmp[0]['ID']);
-      foreach($atts as $attachment){
-        $this->usedAttachments[$attachment['FK_doc']]=$attachment['FK_doc']; 
-      }
-
-      $cart= $this->handle->getUsedCartridges($tmp[0]['ID']);
-      foreach($cart as $key => $cartridge){
-        $this->usedCartridges[$key]=$cartridge; 
-        $this->usedCartridges[$key]['status']="exists"; 
-      }
-
-
-    }else{
-      $this->is_account = false;
-    }
-
-    /* set defaults */
-    $this->name                 = $this->dn;
-    $this->orig_dn              = $this->dn;
-    $this->initially_was_account = $this->is_account;
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","printer/".get_class($this),$this->dn);
-    }
-
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-    $display= "";
-
-    $smarty->assign("CartridgesACL",$this->getacl("Cartridges"));
-
-    /*  Assign smarty defaults 
-        To avoid undefined indexes, if there is an error with the glpi db
-     */ 
-    foreach(array("PrinterTypeKeys","PrinterTypes","ManufacturerKeys","Manufacturers",
-                  "Attachments","AttachmentKeys","CartridgeKeys","Cartridges") as $attr){
-      $smarty->assign($attr,array());
-    }
-    foreach(array("type","FK_glpi_enterprise","tech_num","contact_num","comments","flags_serial","flags_par","flags_usb","AttachmentsDiv") as $attr){
-      $smarty->assign($attr,"");
-    }
-
-    /* Assign acls */
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translation){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-
-    /* Check if there is a glpi database server defined 
-      */
-    if(!isset($this->config->data['SERVERS']['GLPI'])){
-      print_red(_("There is no server with valid glpi database service."));
-      return($smarty->fetch(get_template_path('glpiPrinter.tpl', TRUE)));
-    }
-
-    $this->data = $this->config->data['SERVERS']['GLPI'];
-
-    /* Check if we can call mysql_connect 
-       If we can't, there is no the mysql-php extension
-     */
-    if(!is_callable("mysql_connect")){
-      print_red(_("Can't connect to glpi database, the php-mysql extension is missing."));
-      return($smarty->fetch(get_template_path('glpiPrinter.tpl', TRUE)));
-    }
-
-    $this->handle = new glpiDB($this->data['SERVER'],$this->data['LOGIN'],$this->data['PASSWORD'],$this->data['DB']);
-
-    /*  If handle == false, abort
-        Seems that the server, username and or password is wrong
-     */
-    if(!$this->handle->is_connected){
-      print_red(_("Can't connect to glpi database, check configuration twice."));
-      return($smarty->fetch(get_template_path('glpiPrinter.tpl', TRUE)));
-    } 
-
-    /*  All checks are ok
-        Lets handle Posts, templates etc below ...
-     */
-    
-    $users = $this->handle->getUsers();
-    $ldap= $this->config->get_ldap_link();
-
-    
-    /*  ##########################################################################
-     *  Some tab management   
-     */
-
-    /* Do we need to flip is_account state? */
-    if(isset($_POST['modify_state'])){
-      if($this->is_account && $this->acl_is_removeable()){
-        $this->is_account= FALSE;
-      }elseif(!$this->is_account && $this->acl_is_createable()){
-        $this->is_account= TRUE;
-      }
-    }
-
-    /* Show tab dialog headers */
-    if ($this->is_account){
-      $display= $this->show_disable_header(_("Remove inventory"),
-          _("This server has inventory features enabled. You can disable them by clicking below."));
-    } else {
-      $display= $this->show_enable_header(_("Add inventory"),
-          _("This server has inventory features disabled. You can enable them by clicking below."));
-      return ($display);
-    }
-
-    
-    /*  ##########################################################################
-     *  Printer type management 
-     *  Dialog 
-     */
-
-    /* Rename was requested */
-    if(isset($_POST['Rename_PType_OK']) && $this->acl_is_writeable("type")){
-      $tmp = $this->handle->getPrinterTypes();
-      $allok = true;
-      foreach($tmp as $id => $name){
-        if(trim($name) == trim($_POST['string'])){
-          $allok = false;
-        }
-      }
-      if($allok){
-        $this->handle->updatePrinterType($_POST['string'],$this->select_type);
-        $this->rename = false;
-      }else{
-        print_red(sprintf(_("Can't rename given printer type to '%s', because this type name already exists."),$_POST['string']));
-      }
-    }
-
-    /* abort rename 
-     */
-    if(isset($_POST['Rename_Cancel'])){
-      $this->rename = false;
-    }
-
-    /* Printer type management
-     */
-    if(isset($_POST['edit_type']) && $this->acl_is_writeable("type")){
-      $this->dialog = true;
-      $this->edit_type=true;
-    }
-
-    /* This closes the printer type editing dialog
-     */
-    if(isset($_POST['close_edit_type'])){
-      $this->edit_type=false;
-      $this->dialog = false;
-    }
-
-    /* This appends a new printer to our sytem types
-     */
-    if((isset($_POST['add_type']))&&(!empty($_POST['type_string'])) && $this->acl_is_writeable("type")){
-    
-      $tmp = $this->handle->getPrinterTypes();
-      $allok = true;
-      foreach($tmp as $id => $name){
-        if(trim($name) == trim($_POST['type_string'])){
-          $allok = false;
-        }
-      }
-      if($allok){
-        $this->handle->addPrinterType($_POST['type_string']);  
-      }else{
-        print_red(sprintf(_("Can't rename given printer type to '%s', because this type name already exists."),$_POST['type_string']));
-      }
-    }
-
-    /* Remove selected type from our printer types list
-     */
-    if((isset($_POST['del_type']))&&(!empty($_POST['select_type'])) && $this->acl_is_writeable("type")){
-      $tmp = $this->handle->is_printerTypeUsed($_POST['select_type']);
-      if(count($tmp)){
-        $str = "";
-        foreach($tmp as $id => $name){
-          $str .= $name.", ";
-        }
-        $str = preg_replace("/, $/","",$str); 
-        print_red(sprintf(_("Can't delete printer type, it is still in use by '%s'."),$str));
-      }else{
-        $this->handle->removePrinterType($_POST['select_type']);  
-      }
-    }
-
-    /* Rename selected printer type to given string
-     */
-    if((isset($_POST['rename_type']))&&(!empty($_POST['select_type']))||($this->rename) && $this->acl_is_writeable("type")){
-      $this->rename = true;
-
-      $smarty->assign("Method","rename");
-
-      $tmp = $this->handle->getPrinterTypes();
-
-      if(isset($_POST['select_type'])){
-        $this->select_type = $_POST['select_type'];
-      }  
-      $smarty->assign("string",$tmp[$this->select_type]);
-      if(isset($_POST['string'])){
-        $smarty->assign("string",$_POST['string']);
-      }
-
-      $display= $smarty->fetch(get_template_path('glpi_edit_printer_type.tpl', TRUE));
-      return($display);
-    }  
-
-    /* Someone wants to edit the printer types ... 
-       So, lets open a new dialog which provides some buttons to edit the types
-     */
-    if($this->edit_type){
-      $smarty->assign("Method","edit");
-      $smarty->assign("PrinterTypes",            $this->handle->getPrinterTypes());
-      $smarty->assign("PrinterTypeKeys",         array_flip($this->handle->getPrinterTypes()));
-      $display= $smarty->fetch(get_template_path('glpi_edit_printer_type.tpl', TRUE));
-      return($display);
-    }
-
-
-    /*  ##########################################################################
-     *  Edit manufacturers 
-     *  Dialog 
-     */
-
-    /* Open dialog which allows to edit the manufacturers
-     */
-    if(isset($_POST['edit_manufacturer']) && $this->acl_is_writeable("FK_glpi_enterprise")){
-      $this->cur_dialog = new glpiManufacturer($this->config,$this->dn);
-      $this->dialog = true;
-      $this->editManufacturer =true;
-    }
-
-    /* Close manufacturer editing dialog
-     */
-    if((isset($_POST['close_edit_manufacturer']))&&($this->editManufacturer)){
-      $this->dialog = false;
-      $this->cur_dialog = false;
-      $this->editManufacturer=false;
-    }
-
-
-    /*  ##########################################################################
-     *  Technical responsible person
-     *  Contact person 
-     *  Dialog 
-     */
-
-    /* Show dialog to select a new contact person
-     * Select a contact person
-     */
-    if(isset($_POST['SelectContactPerson']) && $this->acl_is_writeable("contact_num")){
-      $this->addUser = "contact";
-      $this->cur_dialog= new glpiSelectUser($this->config,$this->dn,"user_tech_num");
-    }
-
-    /* Selecte technical responsible person
-     */
-    if(isset($_POST['SelectTechPerson']) && $this->acl_is_writeable("tech_num")){
-      $this->addUser ="tech";
-      $this->cur_dialog= new glpiSelectUser($this->config,$this->dn,"user_tech_num");
-    }
-
-    /* Abort user selection
-     */
-    $smarty->assign("AbortSelectUser","SelectUserCancel");
-    if(isset($_POST['SelectUserCancel'])){
-      $this->dialog = false;
-      $this->addUser ="";
-      $this->cur_dialog = false;
-    }
-
-    /* Technical responsible/contact person selected */
-    if(isset($_GET['act'])&&($_GET['act']=="user_tech_num")){
-
-      /* Get posted id */
-      $id = base64_decode($_GET['id']);
-
-      /* Check if user is already created in glpi database */
-      if(!in_array($id,$users)){
-
-        /* If this user doesn't exists in glpi db, we must create him */
-        $ldap->cat($id, array('cn', 'mail', 'telephoneNumber'));
-        $atr = $ldap->fetch();
-        $tmp = array();
-        $use = array( "cn"              =>"name",
-            "mail"            =>"email",
-            "telephoneNumber" =>"phone");
-
-        /* Create array */
-        foreach($use as $gosa => $glpi){
-          if(isset($atr[$gosa])){
-            $tmp[$glpi]= $atr[$gosa][0];
-          }
-        }
-
-        /* Add this user */
-        $this->handle->addUser($tmp,$id);
-      }
-
-      /* Re-read users */
-      $users = ($this->handle->getUsers());
-
-      /* Get user */
-      $tmp = array_flip($users);
-      $id=$tmp[$id];
-
-      /* Use user id, close dialog */
-      if($this->addUser == "tech"){
-        $this->tech_num = $id;
-      }else{
-        $this->contact_num = $id;
-      }
-      $this->cur_dialog   = false;
-      $this->dialog= false;
-    }
-
-
-    /*  ##########################################################################
-     *  Handle attachments 
-     */
-    
-    /* Attachment pool was closed with use
-     */
-    if(isset($_POST['UseAttachment']) && $this->acl_is_writeable("Attachments")){
-      if(count($this->cur_dialog->check())){
-        foreach($this->cur_dialog->check() as $msg){
-          print_red($msg);
-        }
-      }else{
-        $this->cur_dialog->save_object();
-        $this->usedAttachments = $this->cur_dialog->save();
-        $this->cur_dialog = false;
-        $this->edit_type = false; 
-      }
-    }
-   
-    /* Attachment pool was closed with abort
-     */ 
-    if(isset($_POST['AbortAttachment'])){
-      $this->cur_dialog = false;
-      $this->edit_type = false; 
-    }
-
-    /* Open Attachment pool to add/edit Attachments
-     */
-    if(isset($_POST['AddAttachment']) && $this->acl_is_writeable("Attachments")){
-      $this->cur_dialog = new glpiAttachmentPool($this->config,$this->dn,$this->usedAttachments);
-      $this->dialog = true;
-    }
-    
-    /* Remove Attachment from this tab 
-     */
-    $once = true;
-    foreach($_POST as $name => $value){
-      if((preg_match("/^delAttachment_/",$name))&&($once) && $this->acl_is_writeable("Attachments")){
-        $once= false;
-        $name = preg_replace("/^delAttachment_/","",$name);
-        $entry = preg_replace("/_.*$/","",$name);
-        if(isset($this->usedAttachments[$entry])){
-          unset($this->usedAttachments[$entry]);
-        }
-      }
-    }
-    if((isset($_POST['RemoveAttachment']))&&(isset($_POST['Attachments'])) && $this->acl_is_writeable("Attachments")){
-      if(isset($this->usedAttachments[$_POST['Attachments']])){
-        unset($this->usedAttachments[$_POST['Attachments']]);
-      }
-    }
-
-    /*  ##########################################################################
-     *  Printer Cartridge handling 
-     */
-
-    /* Abort cartridge select dialog
-     */
-    if(isset($_POST['SelectCartridgeCancel'])){
-      $this->cur_dialog = false;
-      $this->edit_type = false; 
-    }
-
-    /* Get selected cartridges and add them to our list 
-     */ 
-    if(isset($_POST['SelectCartridgeSave'])){
-      $this->cur_dialog->save_object();
-      $carts = $this->cur_dialog->save();
-      foreach($carts as $cart){
-        $cart['status'] = "new";
-        $this->usedCartridges[] = $cart;
-      }
-      $this->cur_dialog = false;
-      $this->edit_type = false; 
-    }
-
-    /* Remove cartridge  
-     */
-    if((isset($_POST['RemoveCartridge']))&&(isset($_POST['Cartridges'])) && $this->acl_is_writeable("ManageCartridges")){
-
-      foreach($_POST['Cartridges'] as $cartID){
-
-        if(isset($this->usedCartridges[$cartID])){
-          if($this->usedCartridges[$cartID]['status'] == "exists"){
-            $this->usedCartridges[$cartID]['status'] = "deleted";
-          }else{
-            unset($this->usedCartridges[$cartID]);
-          }
-        }
-      }
-    }
-
-    /* Open Attachment pool to add/edit Attachments
-     */
-    if(isset($_POST['AddCartridge']) && $this->acl_is_writeable("ManageCartridges")){
-      $this->cur_dialog = new glpiPrinterCartridges($this->config,$this->dn,$this->type);
-      $this->dialog = true;
-    }
-
-
-    /*  ##########################################################################
-     *  Draw Dialogs
-     */
-    /* if( cur_dialog != false || cur_dialog != NULL) 
-     * There is a dialog which wants to be displayed 
-     */
-    if($this->cur_dialog && is_object($this->cur_dialog)){
-      $this->cur_dialog->save_object();
-      $this->dialog=true;
-      $this->cur_dialog->parent = &$this;
-      return($this->cur_dialog->execute());
-    }else{
-      $this->dialog= false;
-    }
-
-
-    /*  ##########################################################################
-     *  Assign listbox / checkbox .... values to smarty  
-     */
-    /* Assign smarty defaults */ 
-    foreach(array("PrinterTypes","PrinterTypeKeys","Manufacturers","TechnicalResponsibles","Attachments","Cartridges") as $attr){
-      $smarty->assign($attr,array());
-    }
-
-    /* Assign some vars to smarty 
-     */
-    foreach(array("type","FK_glpi_enterprise","tech_num","contact_num","flags_serial","flags_par","flags_usb") as $attr){
-      $smarty->assign($attr,"");
-    }
-
-    $smarty->assign("comments",               $this->comments);
-    $smarty->assign("flags_serial",            $this->flags_serial);
-    $smarty->assign("flags_par",               $this->flags_par);
-    $smarty->assign("flags_usb",               $this->flags_usb);
-
-    /* Assign system types 
-     */
-    $smarty->assign("PrinterTypes",           $this->handle->getPrinterTypes());
-    $smarty->assign("PrinterTypeKeys",        array_flip($this->handle->getPrinterTypes()));
-    $smarty->assign("type",                   $this->type);
-
-    /* Append manufacturers
-     */
-    $smarty->assign("ManufacturerKeys",       array_flip($this->handle->getEnterprises()));
-    $smarty->assign("Manufacturers",          $this->handle->getEnterprises());
-    $smarty->assign("FK_glpi_enterprise",     $this->FK_glpi_enterprise);
-
-    /* Assign used Attachments
-    */
-
-    $divlist = new divSelectBox("glpiAttachmentsList");
-    $divlist-> SetHeight(120);
-    $atts = $this->getUsedAttachments(true);
-    $downlink = "<a href='get_attachment.php?id=%s' target='_blank'>%s</a>";
-    $del_link = "<input type='image' src='images/edittrash.png' name='delAttachment_%s'>";
-    foreach($atts as $id => $attachment){
-      $divlist->AddEntry
-          (
-        array(
-            array("string"=>$attachment['name']),
-            array("string"=>$attachment['mime']),
-            array("string"=>sprintf($downlink,$id,$attachment['filename'])),
-            array("string"=>sprintf($del_link,$attachment['ID']),"attach"=>"style='border-right:0px;'"),
-             )
-          );
-    }
-
-    $smarty->assign("AttachmentsDiv"          ,$divlist->DrawList());
-    $smarty->assign("Attachments",            $this->getUsedAttachments());
-    $smarty->assign("AttachmentKeys",         array_flip($this->getUsedAttachments()));
-
-    /* Assign Cartridges 
-     */
-    $smarty->assign("Cartridges",            $this->getUsedCartridges());
-    $smarty->assign("CartridgeKeys",         $this->getUsedCartridges(true));
-
-    /*  ##########################################################################
-     *  Assign contact and technical responsible person 
-     */
-    if(isset($users[$this->contact_num])){
-      $ldap->cat($users[$this->contact_num], array('givenName', 'sn', 'uid'));
-      $tr = $ldap->fetch();
-      $str = "";
-      if(isset($tr['givenName'][0])){   $str .= $tr['givenName'][0]." ";      }
-      if(isset($tr['sn'][0])) {         $str .= $tr['sn'][0]." ";             }
-      if(isset($tr['uid'][0])){         $str .= "[".$tr['uid'][0]."]";        }
-      $smarty->assign("contact_num",               $str);
-    }else{
-      $smarty->assign("contact_num",               _("N/A"));
-    }
-
-    /* Handle tech person 
-       Assign name ... to smarty, if set
-     */ 
-    if(isset($users[$this->tech_num])){
-      $ldap->cat($users[$this->tech_num], array('givenName', 'sn', 'uid'));
-      $tr = $ldap->fetch();
-      $str = "";
-      if(isset($tr['givenName'][0])){   $str .= $tr['givenName'][0]." ";      }
-      if(isset($tr['sn'][0])) {         $str .= $tr['sn'][0]." ";             }
-      if(isset($tr['uid'][0])){         $str .= "[".$tr['uid'][0]."]";        }
-      $smarty->assign("tech_num",               $str);
-    }else{
-      $smarty->assign("tech_num",               _("N/A"));
-    }
-
-    /* If theres a cartridge selected, you can't change the printer type.
-     */ 
-    $disp = true;
-
-    foreach($this->usedCartridges as $cart){
-      if($cart['status'] != "deleted"){
-        $disp = false;
-      }
-    }
-    if($disp==false){
-      $smarty->assign("typeACL", $this->getacl("type",true));
-    }
-
-    $display.= $smarty->fetch(get_template_path('glpiPrinter.tpl', TRUE));
-    return($display);
-  }
-
-  function remove_from_parent()
-  {
-    $this->handle = new glpiDB($this->data['SERVER'],$this->data['LOGIN'],$this->data['PASSWORD'],$this->data['DB']);
-    if($this->initially_was_account){
-      $this->handle->removePrinterInformations($this->dn);
-      new log("remove","printer/".get_class($this),$this->dn); 
-    }
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    if(isset($_POST['glpiPrinterFlagsPosted'])){
-      plugin::save_object();
-      foreach($this->attributes as $attrs){
-        if(isset($_POST[$attrs])){
-          $this->$attrs = $_POST[$attrs];
-        }
-      }
-
-      if(isset($_POST['FK_glpi_enterprise']) && $this->acl_is_writeable("FKglpienterprise")){
-        $this->FK_glpi_enterprise = $_POST['FK_glpi_enterprise'];
-      }
-
-      foreach(array("flags_serial","flags_par","flags_usb") as $checkboxes){
-        if($this->acl_is_writeable($checkboxes)){
-          if(isset($_POST[$checkboxes])){
-            $this->$checkboxes = 1;
-          }else{
-            $this->$checkboxes = 0;
-          }
-        }
-      }
-    }
-
-  }
-
-
-  /* Check supplied data */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    //    if($this->TechnicalResponsible == ""){
-    //      $message[] = _("Please select a technical responsible person for this entry.");
-    //    }
-
-    return ($message);
-  }
-
-  /* Save to LDAP */
-  function save()
-  {
-    if($this->is_account){
-        $attrs = array();
-      $this->date_mod = date("Y-m-d H:i:s");
-      foreach($this->attributes as $attr){
-        $attrs[$attr] = $this->$attr;
-      }
-      $attrs['name'] = $this->dn;
-      unset($attrs['ID']);
-      $this->handle = new glpiDB($this->data['SERVER'],$this->data['LOGIN'],$this->data['PASSWORD'],$this->data['DB']);
-      if($this->initially_was_account&&$this->is_account){
-        $this->handle->updatePrinterInformations($attrs,$this->dn);
-        new log("modify","printer/".get_class($this),$this->dn); 
-      }elseif($this->is_account){
-        $this->handle->addPrinterInformations($attrs,$this->dn);
-        new log("create","printer/".get_class($this),$this->dn); 
-      }
-      $tmp = $this->handle->getPrinterInformations($this->dn);
-      $this->handle->addAttachmentsToPrinter($this->usedAttachments,$tmp[0]['ID']);
-
-      foreach($this->usedCartridges as $cart){
-        if($cart['status'] == "deleted"){
-          $this->handle->removeCartridgeFromPrinter($cart['ID']);
-        }elseif($cart['status'] == "new"){
-          $this->handle->addCartridgeFromPrinter($tmp[0]['ID'],$cart['type_ID']);
-        }
-      }
-    }
-  }
-
-  /* Return used attachments */
-  function getUsedAttachments($divlist = false)
-  {
-    $atts =$this->handle->getAttachments();
-    $ret = array();
-    foreach($atts as $entry){
-      if(in_array($entry['ID'],$this->usedAttachments)){
-        if($divlist){
-          $ret[$entry['ID']] = $entry;
-        }else{
-          $cm ="";
-          if(isset($entry['comment'])){
-            $cm=" [".$entry['comment']."]";
-          }
-          if(isset($entry['mime'])){
-            $cm.=" -".$entry['mime']."";
-          }
-
-          $ret[$entry['ID']]= $entry['name'].$cm;
-        }
-      }
-    }
-    return($ret);
-  }
-
-  function getUsedCartridges($flip = false)
-  {
-    $ret = array();
-    foreach($this->usedCartridges as $key => $value){
-      if($value['status'] == "deleted") continue;
-      if($flip){
-        $ret[$key] = $key;    
-      }else{
-        $ret[$key] = $value['name']." [".$value['type_name']."] "._("since")." :".$value['date_use'];
-      }
-    }
-    return($ret);
-  }  
-
-     /* Return plugin informations for acl handling */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("Glpi"),
-          "plDescription" => _("Printer inventory extension"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 10,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("printer"),
-
-          "plProvidedAcls"=> array(
-            "flags_serial"         => _("Supports serial interface"),
-            "flags_par"            => _("Supports parallel interface"),
-            "flags_usb"            => _("Supports usb interface"),
-            "tech_num"             => _("Technical responsible"),
-            "comments"             => _("Comments"),
-            "location"             => _("Location"),
-            "contact_num"          => _("Contact person"),
-            "type"                 => _("Type"),
-            "FKglpienterprise"   => _("Manufacturer"),
-
-            "Attachments"          => _("Attachments"),
-        
-            "ManageCartridges"            => _("Cartridge settings"))
-          ));
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_glpiPrinterCartridges.inc b/plugins/admin/systems/class_glpiPrinterCartridges.inc
deleted file mode 100644 (file)
index 3d9d630..0000000
+++ /dev/null
@@ -1,298 +0,0 @@
-<?php
-
-class glpiPrinterCartridges 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("whatever");
-
-  var $parent           = NULL;       // Contains parent class, to access glpi db handle
-  var $usedCartridges   = array();    // IDs of used cartridges for this printer 
-  var $PrinterType      = 0;          // Specifies which cartridge types are available
-
-  var $cur_dialog       = false;
-  var $cur_sub_dialog   = false;
-
-  var $editManufacturer = false;
-  var $del              = 0;
-
-
-  function glpiPrinterCartridges (&$config,$dn,$type)
-  {
-    plugin::plugin ($config, $dn);
-
-    /* Assign some basic settings */
-    $this->ui = get_userinfo();  
-    if(!isset($_SESSION['glpiCartridgeRegex'])){
-      $_SESSION['glpiCartridgeRegex'] = "*";
-    }
-  
-    /* Only display cartridges for this type of printer */
-    $this->PrinterType = $type;
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-    $display ="";
-    $smarty = get_smarty();
-    $filter = $_SESSION['glpiCartridgeRegex'];
-
-    /* Filter settings, remove double* */
-    if(isset($_GET['search'])){
-      $filter = preg_replace("/\*\**/","*",$_GET['search']."*");
-    }elseif(isset($_POST['cartridge_regex'])){
-      $filter = preg_replace("/\*\**/","*",$_POST['cartridge_regex']);
-    }
-    if(empty($filter)) {
-      $filter = "*";
-    }
-    $_SESSION['glpiCartridgeRegex']= $filter;
-
-    /* Open dialog which allows to edit the manufacturers
-     */
-    if(isset($_POST['edit_manufacturer_cartridges'])){
-      $this->cur_sub_dialog = new glpiManufacturer($this->config,$this->dn);
-      $this->dialog = true;
-      $this->editManufacturer =true;
-    }
-
-    /* Close manufacturer editing dialog
-     */
-    if((isset($_POST['close_edit_manufacturer']))&&($this->editManufacturer)){
-      $this->dialog = false;
-      $this->cur_sub_dialog = false;
-      $this->editManufacturer=false;
-    }
-
-    /* Check poted vars and do the requested job, but only once */
-    $only_once = true;
-    foreach($_POST as $name => $value){
-
-      /* We have to create a new cartridge */
-      if(preg_match("/^newcartridge/",$name)&&($only_once)){
-        $this->cur_dialog = new glpiPrinterCartridgesEdit($this->config,$this->dn,$this->PrinterType); 
-        $only_once = false;
-      }
-    }
-  
-    /* Edit cartridge */
-    if(isset($_GET['act'])&&$_GET['act']=="edit_cartridge"){
-      $val = ($this->parent->handle->getCartridgeTypeInformations($_GET['id']));
-      $this->cur_dialog = new glpiPrinterCartridgesEdit($this->config,$this->dn,$this->PrinterType,$val[$_GET['id']]); 
-    }
-    /* remove cartridge */ 
-    if(isset($_GET['act'])&&$_GET['act']=="del_cartridge"){
-        /* remove attach from db */
-        $this->del = $_GET['id'];
-        $val = ($this->parent->handle->getCartridgeTypeInformations($_GET['id']));
-        $smarty->assign("warning", sprintf(_("You're about to delete the glpi cartridge type '%s'."), $val[$this->del]['name']));
-        return($smarty->fetch(get_template_path('remove_glpi.tpl', TRUE)));
-    }
-
-    if(isset($_POST['delete_cancel'])){
-      $this->del = false;
-    }
-
-    /* Delete this entry */
-    if(isset($_POST['delete_glpi_confirm'])&&($this->del)) {
-      $tmp = $this->parent->handle->is_cartridgeTypeUsed($this->del);
-      if(count($tmp)){
-
-        $str = "";
-        foreach($tmp as $id => $name){
-          $str .= $name.", "; 
-        }
-        $str = preg_replace("/, $/","",$str);
-
-        print_red(sprintf(_("You can't delete this cartridge type, it is still in use by this printer(s) '%s'."),$str));
-      }else{
-        $val = ($this->parent->handle->getCartridgeTypeInformations($this->del));
-        $this->cur_dialog = new glpiPrinterCartridgesEdit($this->config,$this->dn,$this->PrinterType,$val[$this->del]); 
-        $this->cur_dialog->parent = $this->parent;
-        $this->cur_dialog->remove_from_parent();
-        $this->cur_dialog= false;
-      } 
-    }
-
-    /* Abort edit / add dialog */
-    if(isset($_POST['CancelCartridge'])){
-      $this->cur_dialog = false;
-    }
-  
-    /* Save changes if check is ok */
-    if(isset($_POST['SaveCartridge'])){
-      $this->cur_dialog->save_object();
-      if(count($this->cur_dialog->check())) {
-        foreach($this->cur_dialog->check() as $checks){
-          print_red($checks);
-        }
-      }else{
-        $this->cur_dialog->save();
-        $this->cur_dialog = false;
-      }
-    }
-
-    /* If we have a dialog open, display it */
-    if($this->cur_sub_dialog){
-      $this->cur_sub_dialog->parent = $this->parent;
-      $this->cur_sub_dialog->save_object();
-      return($this->cur_sub_dialog->execute());
-    }
-    /* If we have a dialog open, display it */
-    if($this->cur_dialog){
-      $this->cur_dialog->parent = $this->parent;
-      $this->cur_dialog->save_object();
-      return($this->cur_dialog->execute());
-    }
-
-    /* Create divlist */
-    $divlist = new divlist("glpi devices");
-    $divlist->SetPluginMode();
-    $divlist->SetEntriesPerPage(0);
-    $divlist->SetHeader(array(
-          array("string" => "&nbsp;", "attach" => "style='text-align:center;width:20px;'"),
-          array("string" => _("Cartridges"), "attach" => "style=''"),
-          array("string" => _("Action"), "attach" => "style='width:60px;border-right:0px;text-align:right;'" )));
-
-    /* Links for editing,adding.... */
-    $edit =     "<a href='?plug=".$_GET['plug']."&amp;act=edit_cartridge&amp;id=%s'>%s</a>";
-    $editdel =  "<a href='?plug=".$_GET['plug']."&amp;act=edit_cartridge&amp;id=%s'><img src='images/edit.png' alt='"._("Edit")."' border=0></a>";
-    $editdel.= "<a href='?plug=".$_GET['plug']."&amp;act=del_cartridge&amp;id=%s'><img src='images/edittrash.png' alt='"._("Delete")."' border=0></a>";
-   
-    /* Checkbox for selection of some cartridges */ 
-    $useCartridge = "<input type='hidden' name='wasOnPage_%s' value='%s'><input type='checkbox' value='%s' name='useCartridge_%s' %CHECKED%>";
-
-    /* Add cartridges */ 
-    $cart = $this->getCartridgeTypes();
-
-    /* Remove typically error possibilities */
-    $f = str_replace("/","\/",$filter);
-    $f = str_replace(".","\.",$f);
-    $f = str_replace("*",".*",$f);
-
-    /* Assign cartridges */
-    foreach($cart as $key=>$cartr){
-
-      /* Skip if filter doesn't match*/
-      if(!preg_match("/^".$f."$/i",$cartr['cartridgeName'])){
-        continue;
-      }
-
-      /* check if this cartridge is selected */
-      $chk = "";
-      if(isset($this->usedCartridges[$key])){
-        $chk = " checked ";
-      }
-
-      /* Add fields */
-      $field1 = array("string" => preg_replace("/%s/",($key),preg_replace("/%CHECKED%/",$chk,$useCartridge)), 
-                      "attach" => "style='text-align:center;width:20px;'");
-      $field2 = array("string" => sprintf($edit,($key),$cartr['cartridgeName']."&nbsp;[".$cartr['cartridgeTypeName']."]"), 
-                      "attach" => "style=''");
-      $field3 = array("string" => sprintf($editdel,($key),($key)), 
-                      "attach" => "style='width:60px;border-right:0px;text-align:right;'");
-
-      $divlist->AddEntry(array($field1,$field2,$field3));
-      
-    }
-   
-    /* Create list header */ 
-    $listhead = "<div style='background:#F0F0F9;padding:5px;'>".
-      " <input class='center' type='image' align='middle' 
-      src='images/zip.png'  title='"._("New monitor")."' alt='"._("M")."' name='newcartridge'>&nbsp;".
-      "</div>";
-
-    /* Tell smarty some vars */
-    $filter= $_SESSION['glpiCartridgeRegex'];
-    $smarty->assign("devicehead", $listhead);
-    $smarty->assign("devices", $divlist->DrawList());
-    $smarty->assign("search_image", get_template_path('images/search.png'));
-    $smarty->assign("searchu_image", get_template_path('images/search_user.png'));
-    $smarty->assign("tree_image", get_template_path('images/tree.png'));
-    $smarty->assign("infoimage", get_template_path('images/info_small.png'));
-    $smarty->assign("launchimage", get_template_path('images/small_filter.png'));
-    $smarty->assign("apply", apply_filter());
-    $smarty->assign("alphabet", generate_alphabet());
-    $smarty->assign("cartridge_regex", $filter);
-
-    $display.= $smarty->fetch(get_template_path('glpiPrinterCartridges.tpl', TRUE));
-    return($display);
-  }
-
-  /* Save device to glpi database 
-   * If this is a new device, create a new entry, else update this entry 
-   */
-  function save()
-  {
-    $carts = $this->getCartridgeTypes();
-    $ret = array();
-    foreach($this->usedCartridges as $key){
-      $tmp =array();
-      $tmp['date_use']        = date("Y-m-d");
-      $tmp['ID']              = -1;
-      $tmp['type_ID']         = $carts[$key]['cartridgeID'];
-      $tmp['name']            = $carts[$key]['cartridgeName'];
-      $tmp['FK_glpi_printers']= -1;
-      $tmp['type_name']       = $carts[$key]['cartridgeTypeName'];
-      $ret[$key] = $tmp;
-    }
-    return($ret);
-  }
-
-  /* this only gets all already defined devices */
-  function reload()
-  {
-    $this->devices = $this->parent->handle->getDevices();
-    ksort($this->devices);
-  }
-
-  /* This funtions saves all POST variables.
-     The variable must be in the array $this->EditEntry 
-  */
-  function save_object()
-  {
-    /* Checkbox handling 
-     * Check which checkbox is selected 
-     */
-    foreach($_POST as $name => $value){
-      if(preg_match("/wasOnPage/",$name)){
-        $id = preg_replace("/wasOnPage_/","",$name);
-        if(isset($_POST['useCartridge_'.$id])){
-          $this->usedCartridges[$id]=$id;
-        }else{
-          unset($this->usedCartridges[$id]);
-        }
-      }
-    }
-  }
-
-  /* This function cehck all created devices if you wan't to create device specific check 
-      use >>if($attr['device_type']=="moboard")<< to create a device type depending check
-   */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    return($message);
-  }
-
-  /* Return cartriges for our divlist */
-  function getCartridgeTypes()
-  {
-    $ret = array();
-    $ret = $this->parent->handle->getAvailableCartridgeTypes($this->PrinterType);
-    return($ret);
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_glpiPrinterCartridgesEdit.inc b/plugins/admin/systems/class_glpiPrinterCartridgesEdit.inc
deleted file mode 100644 (file)
index e1d86fc..0000000
+++ /dev/null
@@ -1,337 +0,0 @@
-<?php
-
-class glpiPrinterCartridgesEdit 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("ID","name","ref","location","type","FK_glpi_enterprise","tech_num","deleted","comments","alarm");
-  var $objectclasses        = array("whatever");
-
-  var $printer_type      = 0;
-
-  var $additional_printer= array();
-  var $needToCatch       = true;
-
-  var $parent           = NULL;
-
-  var $ID                 = "";
-  var $name               = "";
-  var $ref                = "";
-  var $location           = "";
-  var $type               = "";
-  var $FK_glpi_enterprise = "";
-  var $tech_num           = "";
-  var $deleted            = "";
-  var $comments           = "";
-  var $alarm              = "";  
-
-  var $cur_dialog         = false;
-  var $edit_type          =false;
-
-
-  function glpiPrinterCartridgesEdit (&$config, $dn,$printer_type,$values = NULL )
-  {
-    plugin::plugin ($config, $dn);
-    foreach($this->attributes as $val){
-      if(isset($values[$val])){
-        $this->$val = $values[$val];
-      }else{
-        $this->$val = "";
-      }
-    }
-    $this->needToCatch = true;
-    $this->printer_type = $printer_type;
-  }
-
-  function remove_from_parent()
-  {
-    if($this->ID > 0){
-      $this->parent->handle->removeCartridgeDropdownType($this->ID);
-    }
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-    $display= "";
-
-    /* Get all currently used/supported printer types for this cartridge type
-     */
-    if($this->needToCatch){
-      $this->needToCatch = false;
-      if(!empty($this->type)){
-        $this->additional_printer= $this->parent->handle->getSupportedPrinterTypeIDsForCartridge($this->ID);
-      }
-    }
-
-
-
-
-
-  
-    /* Printer type management
-     */
-    if(isset($_POST['edit_type_cartridge'])){
-      $this->dialog = true;
-      $this->edit_type=true;
-    }
-
-    /* This closes the printer type editing dialog
-     */
-    if(isset($_POST['close_edit_type_cartridge'])){
-      $this->edit_type=false;
-      $this->dialog = false;
-    }
-
-    /* This appends a new printer to our sytem types
-     */
-    if((isset($_POST['add_cartridge_type']))&&(!empty($_POST['cartridge_type_string']))){
-      print "Add";
-      $this->parent->handle->addCartridgeDropdownType($_POST['cartridge_type_string']);
-    }
-
-    /* Remove selected type from our printer types list
-     */
-    if((isset($_POST['del_cartridge_type']))&&(!empty($_POST['select_type_cartridge']))){
-      $used = $this->parent->handle->getUsedDropdownTypes($_POST['select_type_cartridge']);
-      if(!count($used)){
-        $this->parent->handle->removeCartridgeDropdownType($_POST['select_type_cartridge']);
-      }else{
-        print_red(_("Can't delete this entry, it is still in use."));
-      }
-    }
-
-    /* Rename selected printer type to given string
-     */
-    /* Update*/
-    if((isset($_POST['rename_cartridge_type']))&&(!empty($_POST['select_type_cartridge']))&&(!empty($_POST['cartridge_type_string']))){
-      $this->parent->handle->updateCartridgeDropdownType($_POST['cartridge_type_string'],$_POST['select_type_cartridge']);
-    }
-
-    /* Someone wants to edit the printer types ...
-       So, lets open a new dialog which provides some buttons to edit the types
-     */
-    if($this->edit_type){
-      $smarty->assign("PrinterTypes",            $this->parent->handle->getCartridgeTypes());
-      $smarty->assign("PrinterTypeKeys",         array_flip($this->parent->handle->getCartridgeTypes()));
-      $display= $smarty->fetch(get_template_path('glpi_edit_cartridge_type.tpl', TRUE));
-      return($display);
-    }
-
-    /* Assign attributes */ 
-    foreach($this->attributes as $attr){
-      $smarty->assign($attr,$this->$attr);
-    }
-
-    /* Selecte technical responsible person
-     */
-    if(isset($_POST['SelectCartridgeTechPerson'])){
-      $this->cur_dialog= new glpiSelectUser($this->config,$this->dn,"user_cartridge_tech_num");
-    }
-
-    /* Abort user selection
-     */
-    $smarty->assign("AbortSelectUser","SelectCartridgeUserCancel");
-    $smarty->assign("SaveSelectUser" ,"user_cartridge_tech_num");
-    if(isset($_POST['SelectCartridgeUserCancel'])){
-      $this->dialog = false;
-      $this->addUser ="";
-      $this->cur_dialog = false;
-    }
-
-    /* Start ldap, and get all glpiUsers */
-    $ldap = $this->config->get_ldap_link();
-    $users = ($this->parent->handle->getUsers());
-
-    /* Technical responsible/contact person selected 
-    */
-    if(isset($_GET['act'])&&($_GET['act']=="user_cartridge_tech_num")){
-
-      /* Get posted id */
-      $id = base64_decode($_GET['id']);
-
-      /* Check if user is already created in glpi database */
-      if(!in_array($id,$users)){
-
-        /* If this user doesn't exists in glpi db, we must create him */
-        $ldap->cat($id, array('cn', 'mail', 'telephoneNumber'));
-        $atr = $ldap->fetch();
-        $tmp = array();
-        $use = array( "cn"              =>"name",
-            "mail"            =>"email",
-            "telephoneNumber" =>"phone");
-
-        /* Create array */
-        foreach($use as $gosa => $glpi){
-          if(isset($atr[$gosa])){
-            $tmp[$glpi]= $atr[$gosa][0];
-          }
-        }
-
-        /* Add this user */
-        $this->parent->handle->addUser($tmp,$id);
-      }
-
-      /* Re-read users */
-      $users = ($this->parent->handle->getUsers());
-
-      /* Get user */
-      $tmp = array_flip($users);
-      $id=$tmp[$id];
-    
-      /* Close dialog and use this user */
-      $this->tech_num = $id;
-      $this->cur_dialog   = false;
-      $this->dialog= false;
-    }
-
-    /* Execute dialog*/
-    if($this->cur_dialog){
-      $this->cur_dialog->save_object();
-      $this->dialog=true;
-      $this->cur_dialog->parent = &$this;
-      return($this->cur_dialog->execute());
-    }else{
-      $this->dialog= false;
-    }
-
-    /* Create matrix with all possible printer types 
-     */
-    $matrix = "<table summary=''><tr>";
-    $types = $this->parent->handle->getPrinterTypes();
-   
-    /* Specifies number of cols */ 
-    $spalten = 2;
-    
-    $spalt = $spalten; 
-    foreach($types as $key => $type){
-      $spalt -- ; 
-
-      /* Create new row, if cols for this row reached $spalten */
-      if($spalt < 0) {
-        $spalt = $spalten -1;
-        $matrix .= "</tr><tr>";
-      }
-
-      /* Avoid deselecting every checkbox */
-      if($key == $this->printer_type){
-        $matrix.= "<td><input type='checkbox' name='UsePrinterType_".$key."' disabled checked>".$type."</td>";
-      }else{
-      
-        /* Cehck checkbox */
-        $check = "";
-        if(isset($this->additional_printer[$key])){
-          $check = " checked "; 
-        }
-        $matrix.= "<td><input type='checkbox' name='UsePrinterType_".$key."' ".$check." ><input type='hidden' name='wasOnPage_".$key."' ".$check.">".$type."</td>";
-      }
-    }
-    
-    /* Complete table row, to avoid html errors */
-    if($spalt >0){
-      while($spalt >0){
-        $spalt -- ;
-        $matrix .="<td>&nbsp;</td>";
-      }
-    }
-    
-    $matrix .= "</tr></table>";
-
-     /* Append manufacturers
-     */
-    $smarty->assign("PrinterTypeMatrix",      $matrix);
-    
-    $smarty->assign("ManufacturerKeys",       array_flip($this->parent->handle->getEnterprises()));
-    $smarty->assign("Manufacturers",          $this->parent->handle->getEnterprises());
-    $smarty->assign("FK_glpi_enterprise",     $this->FK_glpi_enterprise);
-
-    $smarty->assign("typeKeys",               array_flip($this->parent->handle->getCartridgeTypes()));
-    $smarty->assign("types",                  $this->parent->handle->getCartridgeTypes());
-    $smarty->assign("type",                   $this->type);
-
-     /* Handle tech person
-       Assign name ... to smarty, if set
-     */
-    if(isset($users[$this->tech_num])){
-      $ldap->cat($users[$this->tech_num], array('givenName', 'sn', 'uid'));
-      $tr = $ldap->fetch();
-      $str = "";
-      if(isset($tr['givenName'][0])){   $str .= $tr['givenName'][0]." ";      }
-      if(isset($tr['sn'][0])) {         $str .= $tr['sn'][0]." ";             }
-      if(isset($tr['uid'][0])){         $str .= "[".$tr['uid'][0]."]";        }
-      $smarty->assign("tech_num",               $str);
-    }else{
-      $smarty->assign("tech_num",               _("N/A"));
-    }
-
-
-    $display.= $smarty->fetch(get_template_path('glpiPrinterCartridgesEdit.tpl', TRUE,dirname(__FILE__)));
-    return($display);
-  }
-
-  /* Check given values */
-  function check(){
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-  
-    /* Avoid choosing an already used name */
-    $types = $this->parent->handle->getCartridgeTypeInformations();
-    foreach($types as $type){
-      if($type['name'] == $this->name){
-        if($type['ID'] != $this->ID){
-          $message[]= _("The selected name is already in use.");
-        }        
-      }
-    }  
-    return $message;
-  }
-
-  /* Save Post data */
-  function save_object()
-  {
-    foreach($this->attributes as $attr){
-      if(isset($_POST[$attr])){
-        $this->$attr= $_POST[$attr];
-      }
-    }
-
-    /* Get selected checkboxes */
-    foreach($_POST as $name => $value){
-      if(preg_match("/wasOnPage_/",$name)){
-        $id = preg_replace("/wasOnPage_/","",$name);
-        if(isset($_POST['UsePrinterType_'.$id])){
-          $this->additional_printer[$id]=$id;
-        }else{
-          if(isset($this->additional_printer[$id])){
-            unset($this->additional_printer[$id]);
-          }
-        }
-      }
-    }
-  }
-
-  /* Create / Update database with this new infos */
-  function save()
-  {
-    $tmp  = array();
-    foreach($this->attributes as $attr){
-      $tmp[$attr] = $this-> $attr;
-    }
-    $types = array();
-    $types = $this->additional_printer;
-    $types[$this->printer_type]=$this->printer_type;
-    $this->parent->handle->Add_UpdateCatrigdeType($tmp,$types);
-  }
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_glpiSelectUser.inc b/plugins/admin/systems/class_glpiSelectUser.inc
deleted file mode 100644 (file)
index 7073b12..0000000
+++ /dev/null
@@ -1,285 +0,0 @@
-<?php
-
-class glpiSelectUser 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("whatever");
-
-  var $users = array();
-  var $departments = array();
-
-  var $ui;
-
-  var $PostVarName      = "";
-
-  function glpiSelectUser (&$config, $dn= NULL,$postvar)
-  {
-    plugin::plugin ($config, $dn);
-
-    $this->PostVarName = $postvar;
-
-    if(!isset($_SESSION['glpi_user_filter'])){
-      $tmp['users_regex'] = "*";
-      $tmp['base']       = $this->config->current['BASE'];
-      $_SESSION['glpi_user_filter'] = $tmp;
-    }
-
-    $this->ui = get_userinfo();  
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    if(isset($_POST['depselect'])){
-      $_SESSION['glpi_user_filter']['base'] = $_POST['depselect'];
-    }
-
-    $filter = $_SESSION['glpi_user_filter'];
-
-    /* Filter settings, remove double* */
-    if(isset($_GET['search'])){
-      $filter['users_regex'] = preg_replace("/\*\**/","*",$_GET['search']."*");
-    }elseif(isset($_POST['regex'])){
-      $filter['users_regex'] = preg_replace("/\*\**/","*",$_POST['regex']);
-    }
-    if(empty($filter['users_regex'])) {
-      $filter = "*";
-    }
-
-
-    $s_action="";
-    /* Test Posts */
-    foreach($_POST as $key => $val){
-      // Post for delete
-      if(preg_match("/dep_back.*/i",$key)){
-        $s_action="back";
-      }elseif(preg_match("/user_new.*/",$key)){
-        $s_action="new";
-      }elseif(preg_match("/dep_home.*/i",$key)){
-        $s_action="home";
-      }
-    }
-
-    /* Homebutton is posted */
-    if($s_action=="home"){
-      $filter['base']=(preg_replace("/^[^,]+,/","",$this->ui->dn));
-      $filter['base']=(preg_replace("/^[^,]+,/","",$filter['base']));
-    }
-
-    if($s_action=="root"){
-      $filter['base']=($this->config->current['BASE']);
-    }
-
-
-    /* If Backbutton is Posted */
-    if($s_action=="back"){
-      $base_back          = preg_replace("/^[^,]+,/","",$filter['base']);
-      $base_back          = convert_department_dn($base_back);
-
-      if(isset($this->config->departments[trim($base_back)])){
-        $filter['base']= $this->config->departments[trim($base_back)];
-      }else{
-        $filter['base']= $this->config->departments["/"];
-      }
-    }
-
-    if((isset($_GET['act']))&&($_GET['act']=="dep_open")){
-      $entry = base64_decode($_GET['dep_id']);
-      $filter['base']= ($this->config->departments[$entry]); 
-    }    
-
-    $_SESSION['glpi_user_filter'] = $filter;
-
-    $this->reload();
-
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-    $display= "";
-
-    $divlist = new divlist("glpi users");
-    $divlist->SetPluginMode();
-    $divlist->SetEntriesPerPage(0);
-    $divlist->SetHeader(array(
-          array("string" => "&nbsp;", "attach" => "style='text-align:center;width:20px;'"),
-          array("string" => _("Users")." / "._("Departments"), "attach" => "style=''"),
-          array("string" => _("Use"), "attach" => "style='width:60px;border-right:0px;text-align:right;'" )));
-    $linkopen = "<a href='?plug=".$_GET['plug']."&amp;act=dep_open&amp;dep_id=%s'>%s</a>";
-    foreach($this->departments as $key=> $val){
-
-      if(!isset($this->config->departments[trim($key)])){
-        $this->config->departments[trim($key)]="";
-      }
-
-      $non_empty="";
-      $keys= str_replace("/","\/",$key);
-      foreach($this->config->departments as $keyd=>$vald ){
-        if(preg_match("/".$keys."\/.*/",$keyd)){
-          $non_empty="full";
-        }
-      }
-
-      $field1 = array("string" => "<img src='images/".$non_empty."folder.png' alt='department'>", "attach" => "style='text-align:center;width:20px;'");
-      $field2 = array("string" => sprintf($linkopen,base64_encode($key),$val), "attach" => "style=''");
-      $field3 = array("string" => "&nbsp;", "attach" => "style='width:60px;border-right:0px;text-align:right;'");
-      $divlist->AddEntry(array($field1,$field2,$field3));
-    }
-
-    $useruse = "<a href='?plug=".$_GET['plug']."&amp;act=".$this->PostVarName."&amp;id=%s'>%s</a>";
-    
-    foreach($this->users as $key=>$user){
-      $field1 = array("string" => "<img src='images/select_user.png' alt='user' >", "attach" => "style='text-align:center;width:20px;'");
-      $field2 = array("string" => sprintf($useruse,base64_encode($key),$user), "attach" => "style=''");
-      $field3 = array("string" => sprintf($useruse,base64_encode($key),"<img title='"._("Use")."' border=0 src='images/crossref.png' alt='"._("use")."'>"), 
-        "attach" => "style='width:60px;border-right:0px;text-align:right;'");
-      $divlist->AddEntry(array($field1,$field2,$field3));
-      
-    }
-
-     /* Prepare departments,
-       which are shown in the listbox on top of the listbox
-     */
-
-    
-    /* Get all departments within this subtree */
-    $this->base = $_SESSION['glpi_user_filter']['base'];
-    $options  ="";
-    $base = $this->config->current['BASE'];
-    $deps= get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", "users", $base,
-                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH);
-
-    /* Load possible departments */
-    $ui= get_userinfo();
-    $tdeps= $ui->get_module_departments("users");
-    $ids = $this->config->idepartments;
-    foreach($deps as $dep){
-      if(isset($ids[$dep['dn']]) && in_array_ics($dep['dn'], $tdeps)){
-        $value = $ids[$dep['dn']];
-        if ($this->base == $dep['dn']){
-          $options.= "<option selected='selected' value='".$dep['dn']."'>$value</option>";
-        } else {
-          $options.= "<option value='".$dep['dn']."'>$value</option>";
-        }
-      }
-    }
-
-    $listhead = "<div style='background:#F0F0F9;padding:5px;'>".
-      " <input class='center' type='image' src='images/list_root.png' 
-      align='middle' title='"._("Go to root department")."' name='dep_root' alt='"._("Root")."'>&nbsp;".
-      " <input class='center' type='image' align='middle' 
-      src='images/list_back.png' title='"._("Go up one department")."' alt='"._("Up")."' name='dep_back'>&nbsp;".
-      " <input class='center' type='image' align='middle' 
-      src='images/list_home.png' title='"._("Go to users department")."' alt='"._("Home")."' name='dep_home'>&nbsp;".
-      " <input class='center' type='image' src='images/list_reload.png' align='middle' title='"._("Reload list")."' name='submit_department' alt='"._("Submit")."'>&nbsp;".
-" <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;"._("Base")."&nbsp;".
-    " <select name='depselect' onChange='mainform.submit()' class='center'>$options</select>".
-    " <input class='center' type='image' src='images/list_submit.png' align='middle'
-        title='"._("Submit department")."' name='submit_department' alt='".           _("Submit")."'>&nbsp;".
-      "</div>";
-
-
-    $filter= $_SESSION['glpi_user_filter'];
-    $smarty->assign("usershead", $listhead);
-    $smarty->assign("users", $divlist->DrawList());
-    $smarty->assign("search_image", get_template_path('images/search.png'));
-    $smarty->assign("searchu_image", get_template_path('images/search_user.png'));
-    $smarty->assign("tree_image", get_template_path('images/tree.png'));
-    $smarty->assign("infoimage", get_template_path('images/info_small.png'));
-    $smarty->assign("launchimage", get_template_path('images/small_filter.png'));
-    $smarty->assign("apply", apply_filter());
-    $smarty->assign("alphabet", generate_alphabet());
-    $smarty->assign("users_regex", $filter['users_regex']);
-
-
-    $display.= $smarty->fetch(get_template_path('glpiSelectUser.tpl', TRUE));
-    return($display);
-  }
-
-  /* Save to LDAP */
-  function save()
-  {
-    plugin::save();
-
-    /* Optionally execute a command after we're done */
-#$this->handle_post_events($mode);
-  }
-
-  function reload()
-  {
-
-    $filter= $_SESSION['glpi_user_filter'];
-
-    $base = $filter['base'];
-    $regex= $filter['users_regex'];
-    /* NEW LIST MANAGMENT
-     * We also need to search for the departments
-     * So we are able to navigate like in konquerer
-     */
-
-    $res3= get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))","users",
-       $base, array("ou", "description"), GL_SIZELIMIT | GL_CONVERT);
-
-    $this->departments= array();
-    $tmp = array();
-    foreach ($res3 as $value){
-      $tmp[strtolower($value['dn']).$value['dn']]=$value;
-    }
-    ksort($tmp);
-    foreach($tmp as $value){
-      if(isset($value["description"][0])){
-        $this->departments[$value['dn']]= get_sub_department($value['dn'])." - [".$value["description"][0]."]";
-      }else{
-        $this->departments[$value['dn']]= get_sub_department($value['dn']);//$value["description"][0];
-      }
-    }
-
-    /* END NEW LIST MANAGMENT
-     */
-    $ou = get_people_ou();
-
-    $res2= get_list("(&(|(cn=$regex)(sn=$regex))(objectClass=person))", "users",
-                    $ou.$base, array("cn", "sn", "uid", "givenName", "description"),
-                    GL_SUBSEARCH | GL_SIZELIMIT);
-
-    $tmp = array();
-
-    foreach($res2 as $val){
-      $str = "";
-      if(isset($val['givenName'][0])){
-        $str .= $val['givenName'][0];
-      }
-      if(isset($val['sn'][0])){
-        $str .= $val['sn'][0];
-      }
-      if(isset($val['uid'][0])){
-        $str .= $val['uid'][0];
-      }
-
-      $tmp[$str] = $val;
-    }
-
-    ksort($tmp);
-    $this->users = array();
-    foreach($tmp as $value){
-      if (isset($value["givenName"][0]) && isset($value["sn"][0])){
-        $this->users[$value['dn']]= $value["sn"][0].", ".
-          $value["givenName"][0].
-          " [".$value["uid"][0]."]";
-      } else {
-        $this->users[$value["dn"]]= "[".$value["uid"][0]."]";
-      }
-    }
-  }
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_goCupsServer.inc b/plugins/admin/systems/class_goCupsServer.inc
deleted file mode 100644 (file)
index 6fa572b..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-<?php
-
-class goCupsServer extends goService{
-       
-  var $cli_summary      = "This plugin is used within the ServerService Pluign \nand indicates that this server supports cups management.";
-  var $cli_description  = "Some longer text\nfor help";
-  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* This plugin only writes its objectClass */
-  var $objectclasses    = array("goCupsServer");
-  var $attributes       = array();
-  var $StatusFlag       = "goCupsServerStatus";
-  /* This class can't be assigned twice so it conflicts with itsself */
-  var $conflicts        = array("goCupsServer");
-
-  var $DisplayName      = "";
-  var $dn               = NULL;
-  var $acl;
-  var $cn                  = "";
-  var $goCupsServerStatus  = "";
-  var $view_logged  =FALSE;
-  function goCupsServer(&$config,$dn)
-  {
-    goService::goService($config,$dn);
-    $this->DisplayName = _("Print service");
-  }
-
-    
-  function execute()
-  { 
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","server/".get_class($this),$this->dn);
-    }
-
-    $smarty = get_smarty(); 
-    foreach($this->attributes as $attr){
-      $smarty->assign($attr,$this->$attr);
-    }
-    return($smarty->fetch(get_template_path("goCupsServer.tpl",TRUE,dirname(__FILE__))));
-  }
-
-  function getListEntry()
-  {
-    $fields = goService::getListEntry();
-    $fields['Message']    = _("Print service");
-    $fields['AllowEdit']  = false;
-    return($fields);
-  }
-
-  function check()
-  { 
-    $message = plugin::check();
-    return($message);
-  }
-  
-  function save_object()
-  {
-    plugin::save_object();
-  }  
-
-  /* Return plugin informations for acl handling */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("Cups"),
-          "plDescription" => _("Print service")." ("._("Services").")",
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 100,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("server"),
-
-          "start"         => _("Start"),
-          "stop"          => _("Stop"),
-          "restart"       => _("Restart"),
-
-          "plProvidedAcls"=> array()
-          ));
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_goFaxServer.inc b/plugins/admin/systems/class_goFaxServer.inc
deleted file mode 100644 (file)
index 1e5e049..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-<?php
-
-class goFaxServer extends goService {
-       
-  var $cli_summary      = "This pluign is used within the ServerService Pluign \nand indicates that this server supports fax informations.";
-  var $cli_description  = "Some longer text\nfor help";
-  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* This plugin only writes its objectClass */
-  var $objectclasses    = array("goFaxServer");
-  var $attributes       = array("goFaxAdmin", "goFaxPassword");
-  var $StatusFlag       = "goFaxServerStatus";
-  /* This class can't be assigned twice so it conflicts with itsself */
-  var $conflicts        = array("goFaxServer");
-
-  var $DisplayName      = "";
-  var $dn               = NULL;
-  var $acl;
-
-  var $goFaxAdmin         = "";
-  var $goFaxPassword      = "";
-  var $goFaxServerStatus  = "";
-  var $cn                 = "";
-  var $view_logged  =FALSE;
-  function goFaxServer(&$config,$dn)
-  {
-    goService::goService($config,$dn);
-    $this->DisplayName = _("FAX database");
-  }
-
-
-  function execute()
-  { 
-    $smarty = get_smarty(); 
-
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","server/".get_class($this),$this->dn);
-    }
-
-    /* Assign acls */
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translation ){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-
-    foreach($this->attributes as $attr){
-      $smarty->assign($attr,$this->$attr);
-    }
-    return($smarty->fetch(get_template_path("goFaxServer.tpl",TRUE,dirname(__FILE__))));
-  }
-
-
-  function getListEntry()
-  {
-    $fields               = goService::getListEntry();
-    $fields['Message']    = _("FAX database configuration");
-    $fields['AllowEdit']  = true;
-    return($fields);
-  }
-
-  function check()
-  { 
-    $message = plugin::check();
-    if (empty($this->goFaxAdmin)){
-      $message[]= _("The attribute user is empty or contains invalid characters.");
-    }
-    if (empty($this->goFaxPassword)){
-      $message[]= _("The attribute password is empty or contains invalid characters.");
-    }
-    return($message);
-  }
-  
-
-  function save_object()
-  {
-    if(isset($_POST['goFaxServerPosted'])){
-      plugin::save_object();
-    }
-  } 
-
-  /* Return plugin informations for acl handling */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("Fax database"),
-          "plDescription" => _("Fax database")." ("._("Services").")",
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 99,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("server"),
-
-          "plProvidedAcls"=> array(
-             "goFaxAdmin"     => _("Login name"),
-             "goFaxPassword"  => _("Password"))
-          ));
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_goFonServer.inc b/plugins/admin/systems/class_goFonServer.inc
deleted file mode 100644 (file)
index 2e69a84..0000000
+++ /dev/null
@@ -1,182 +0,0 @@
-<?php
-
-class goFonServer extends goService{
-       
-  var $cli_summary      = "This pluign is used within the ServerService Pluign \nand indicates that this server supports asterisk management.";
-  var $cli_description  = "Some longer text\nfor help";
-  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* This plugin only writes its objectClass */
-  var $objectclasses    = array("goFonServer");
-  var $attributes       = array("goFonAdmin", "goFonPassword","goFonAreaCode", "goFonCountryCode");
-  var $StatusFlag       = "goFonServerStatus";
-  /* This class can't be assigned twice so it conflicts with itsself */
-  var $conflicts        = array("goFonServer");
-
-  var $DisplayName      = "";
-  var $dn               = NULL;
-  var $cn               ="";
-  var $acl;
-
-  var $goFonServerStatus  = "";
-  var $goFonPassword      = "";
-  var $goFonAdmin         = "";
-  var $goFonAreaCode      = "";
-  var $goFonCountryCode   = "";
-  var $view_logged  =FALSE;
-
-  var $orig_dn            = "";   
-  function goFonServer(&$config,$dn)
-  {
-    goService::goService($config,$dn);
-    $this->DisplayName = _("VoIP service");
-
-    $this->orig_dn = $dn;
-  }
-
-
-  function execute()
-  { 
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","server/".get_class($this),$this->dn);
-    }
-
-    $smarty = get_smarty(); 
-    foreach($this->attributes as $attr){
-      $smarty->assign($attr,$this->$attr);
-    }
-
-    /* Assign acls */
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translation){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-
-    return($smarty->fetch(get_template_path("goFonServer.tpl",TRUE,dirname(__FILE__))));
-  }
-
-
-  function getListEntry()
-  {
-    $fields = goService::getListEntry();
-    $fields['Message']    = _("VoIP service - Asterisk management");
-    $fields['AllowEdit']  = true;
-    return($fields);
-  }
-
-  function check()
-  { 
-    $message = plugin::check();
-    if (empty($this->goFonAdmin)){
-      $message[]= _("The attribute DB user is empty or contains invalid characters.");
-    }
-    if (empty($this->goFonPassword)){
-      $message[]= _("The attribute password is empty or contains invalid characters.");
-    }
-    if (empty($this->goFonAreaCode)){
-      $message[]= _("The attribute local dial prefix is empty or contains invalid characters.");
-    }
-    if (empty($this->goFonCountryCode)){
-      $message[]= _("The attribute country dial prefix is empty or contains invalid characters.");
-    }
-    return($message);
-  }
-  
-
-  function save_object()
-  {
-    if(isset($_POST['goFonServerPosted'])){
-      plugin::save_object();
-    }
-  } 
-
-
-  function allow_remove()
-  {
-    /* Check if we are able to remove the asterisk database. If the database is still in use skip */
-    if($this->is_account){
-      $ldap = $this->config->get_ldap_link();
-      $ldap->cd($this->config->current['BASE']);
-      $ldap->search("(&(goFonHomeServer=".$this->dn.")(|(uid=*)(cn=*)))",array("dn","uid","cn","goFonHomeServer"));
-      if($ldap->count()){
-
-        /* Number of entries shown in warning */
-        $i    = 3;
-        $str  = "";
-        while(($attrs = $ldap->fetch()) && $i >= 0){
-          $i --;
-          if(isset($attrs['uid'][0])){
-            $str .= $attrs['uid'][0]." ";
-          }else{
-            $str .= $attrs['cn'][0]." ";
-          }
-        }
-
-        /* Some entries found */
-        if($i != 3){
-          return(sprintf(_("You can't remove the asterisk database extension, it is still in use by these objects '%s'."),trim($str)));
-        }
-      }
-    }
-  }
-
-  
-  function save()
-  {
-    goService::save();
-    /* Update goFonAccounts if server was is renamed.
-       Set attribute goFonHomeServer to current dn
-     */
-    if(in_array("goFonServer",$this->objectclasses)){
-      if($this->orig_dn != "new" && $this->orig_dn != $this->dn){
-        $ldap = $this->config->get_ldap_link();
-        $ldap->cd($this->config->current['BASE']);
-        $ldap->search("(&(goFonHomeServer=".$this->orig_dn.")(|(objectClass=goFonAccount)(objectClass=goFonConference)))",array("goFonHomeServer"));
-        $dns = array();
-        while($attrs = $ldap->fetch()){
-          $dns[] = $attrs['dn'];
-        }
-        foreach($dns as $dn){
-          $ldap->cd($dn);
-          $ldap->modify(array("goFonHomeServer" => $this->dn));
-          show_ldap_error($ldap->get_error(),sprintf(_("Updating gofon home server failed for '%s'."),$dn));
-        }
-      }
-
-      /* Updated config list of gofon servers */
-      if($this->orig_dn == "new" || $this->orig_dn != $this->dn){
-        $_SESSION['config']->load_servers();
-      }
-    }
-  }
-
-  /* Return plugin informations for acl handling */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("VoIP service"),
-          "plDescription" => _("VoIP - asterisk management")." ("._("Services").")",
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 92,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("server"),
-
-          "plProvidedAcls"=> array(
-            "start"         => _("Start"),
-            "stop"          => _("Stop"),
-            "restart"       => _("Restart"),
-
-              "goFonAdmin"      => _("Admin"), 
-              "goFonPassword"   => _("Password"),
-              "goFonAreaCode"   => _("Area code"), 
-              "goFonCountryCode"=> _("Country code"))
-          ));
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_goGlpiServer.inc b/plugins/admin/systems/class_goGlpiServer.inc
deleted file mode 100644 (file)
index 07c07d4..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-<?php
-
-class goGlpiServer extends goService {
-       
-  var $cli_summary      = "This pluign is used within the ServerService Pluign \nand indicates that this server supports asterisk management.";
-  var $cli_description  = "Some longer text\nfor help";
-  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* This plugin only writes its objectClass */
-  var $objectclasses    = array("goGlpiServer");
-  var $attributes       = array("goGlpiAdmin","goGlpiDatabase","goGlpiPassword");
-  var $StatusFlag       = "goGlpiServerStatus";
-  /* This class can't be assigned twice so it conflicts with itsself */
-  var $conflicts        = array("goGlpiServer");
-
-  var $DisplayName      = "";
-  var $dn               = NULL;
-  var $cn               = "";
-  var $acl;
-
-  var $goGlpiServerStatus ="";
-  var $goGlpiAdmin        ="";
-  var $goGlpiDatabase     ="";
-  var $goGlpiPassword     ="";
-  var $view_logged  =FALSE;
-  function goGlpiServer(&$config,$dn)
-  {
-    goService::goService($config,$dn);
-    $this->DisplayName = _("Inventory database");
-  }
-
-
-  function execute()
-  { 
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","server/".get_class($this),$this->dn);
-    }
-
-    $smarty = get_smarty(); 
-    foreach($this->attributes as $attr){
-      $smarty->assign($attr,$this->$attr);
-    }
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translation ){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-    return($smarty->fetch(get_template_path("goGlpiServer.tpl",TRUE,dirname(__FILE__))));
-  }
-
-
-  function getListEntry()
-  {
-    $fields               = goService::getListEntry();
-    $fields['Message']    = _("Inventory database service");
-    $fields['AllowEdit']  = true;
-    return($fields);
-  }
-
-  function check()
-  { 
-    $message = plugin::check();
-    if(empty($this->goGlpiAdmin)){
-      $message[]= _("The attribute user is empty or contains invalid characters.");
-    }
-    if(empty($this->goGlpiDatabase)){
-      $message[]= _("The attribute database is empty or contains invalid characters.");
-    }
-    return($message);
-  }
-  
-
-  function save_object()
-  {
-    if(isset($_POST['goGlpiServer_posted'])){
-      plugin::save_object();
-    }
-  } 
-
-  /* Return plugin informations for acl handling */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("Inventory database"),
-          "plDescription" => _("Inventory database")." ("._("Services").")" ,
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 93,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("server"),
-
-          "plProvidedAcls"=> array(
-            "start"         => _("Start"),
-            "stop"          => _("Stop"),
-            "restart"       => _("Restart"),
-
-            "goGlpiAdmin"    => _("Admin"), 
-            "goGlpiDatabase" => _("Database"),
-            "goGlpiPassword" => _("Password"))
-          ));
-  }
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_goImapServer.inc b/plugins/admin/systems/class_goImapServer.inc
deleted file mode 100644 (file)
index e5681b9..0000000
+++ /dev/null
@@ -1,187 +0,0 @@
-<?php
-
-class goImapServer extends goService {
-       
-  var $cli_summary      = "This pluign is used within the ServerService Pluign \nand indicates that this server supports mailqueue listings and so on.";
-  var $cli_description  = "Some longer text\nfor help";
-  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* This plugin only writes its objectClass */
-  var $objectclasses    = array("goImapServer");
-  
-  /* This class can't be assigned twice so it conflicts with itsself */
-
-  var $DisplayName      = "";
-  var $dn               = NULL;
-  var $StatusFlag       = "goImapServerStatus";
-  var $attributes       = array("goImapName","goImapConnect","goImapAdmin","goImapPassword",
-                                "goImapSieveServer","goImapSievePort",
-                                "cyrusImap","cyrusImapSSL","cyrusPop3","cyrusPop3SSL");
-
-  var $cn                   = "";
-
-  var $goImapName           = "";
-  var $goImapConnect        = "";
-  var $goImapAdmin          = "";
-  var $goImapPassword       = "";
-  
-  var $goImapSieveServer    = "";
-  var $goImapSievePort      = "";
-  
-  var $goImapServerStatus   = "";
-  
-  var $cyrusImap            = false;
-  var $cyrusImapSSL         = false;
-  var $cyrusPop3            = false;
-  var $cyrusPop3SSL         = false;
-  var $is_account           = false;
-  var $view_logged  =FALSE;
-
-  var $acl; 
-
-  var $Actions              = array();  
-  var $conflicts            = array("goImapServer","kolab");
-  function goImapServer(&$config,$dn)
-  {
-    goService::goService($config,$dn);
-  
-    $this->DisplayName = _("IMAP/POP3 service");
-
-    $this->Actions = array( SERVICE_STOPPED=>SERVICE_STOPPED,
-                            SERVICE_STARTED => SERVICE_STARTED,
-                            SERVICE_RESTARTED=>SERVICE_RESTARTED,
-                            "repair_database"=>_("Repair database"));
-    
-  }
-
-  function execute()
-  { 
-    $smarty = get_smarty();
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","server/".get_class($this),$this->dn);
-    }
-    /* set new status */
-    if(isset($_POST['ExecAction'])){
-      if(isset($this->Actions[$_POST['action']])){
-
-        $tmp = $this->plInfo();
-        foreach($tmp['plProvidedAcls'] as $name => $translation) {
-          if(preg_match("/^".$_POST['action']."$/i",$name)){
-            if($this->acl_is_writeable($name)){
-              $this->setStatus($_POST['action']);
-            }
-          }
-        }
-
-      }
-    }
-
-    foreach($this->attributes as $attr){
-      $smarty->assign($attr,$this->$attr);  
-    }
-
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translation){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-    $smarty->assign("Actions",$this->Actions);
-    $smarty->assign("is_new",$this->dn);
-    $smarty->assign("is_acc",$this->initially_was_account);
-    return($smarty->fetch(get_template_path("goImapServer.tpl",TRUE,dirname(__FILE__))));
-  }
-
-  function getListEntry()
-  {
-    $fields               = goService::getListEntry();
-    $fields['Message']    = _("IMAP/POP3 (Cyrus) service");
-    $fields['AllowRemove']= true;
-    $fields['AllowEdit']  = true;
-    return($fields);
-  }
-
-  function check()
-  { 
-    $message = plugin::check();
-    if(empty($this->goImapName)){
-      $message[] =_("Please specify a server identifier.");
-    }  
-    if(empty($this->goImapConnect)){
-      $message[] =_("Please specify a connect url.");
-    }  
-    if(empty($this->goImapAdmin)){
-      $message[] =_("Please specify an admin user.");
-    }  
-    if(empty($this->goImapPassword)){
-      $message[] =_("Please specify a password for the admin user.");
-    } 
-
-    /* Check connect string */
-    if (!preg_match('/^\{[^:]+:[0-9]+.*\}$/', $this->goImapConnect)){
-      $message[]= sprintf(_("The imap connect string needs to be in the form '%s'."),
-          '{server-name:port/options}');
-    }
-    if (!preg_match('/^[0-9]+$/', $this->goImapSievePort)){
-      $message[]= _("The sieve port needs to be numeric.");
-    }
-    return ($message);
-  }
-
-
-  function save_object()
-  {
-    if(isset($_POST['goImapServerPosted'])){
-      plugin::save_object(); 
-
-      foreach(array("cyrusImap","cyrusImapSSL","cyrusPop3","cyrusPop3SSL") as $checkbox) { 
-
-        if($this->acl_is_writeable($checkbox)){
-          if(!isset($_POST[$checkbox])){
-            $this->$checkbox = false;
-          }else{
-            $this->$checkbox = true;
-          }
-        }
-      }
-    }
-  }
-
-
-  /* Return plugin informations for acl handling */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("IMAP/POP3"),
-          "plDescription" => _("IMAP/POP3")." ("._("Services").")",
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 94,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("server"),
-
-          "plProvidedAcls"=> array(
-
-            "start"           => _("Start"),
-            "stop"            => _("Stop"),
-            "restart"         => _("Restart"),
-            "repair_database" => _("Repair database"),
-
-            "goImapName"        =>_("Server identifier"),
-            "goImapConnect"     =>_("Connect URL"),
-            "goImapAdmin"       =>_("Admin user"),
-            "goImapPassword"    =>_("Admin password"),
-            "goImapSievePort"   =>_("Sieve port"),
-            "cyrusImap"         =>_("Start IMAP service"),
-            "cyrusImapSSL"      =>_("Start IMAP SSL service"),
-            "cyrusPop3"         =>_("Start POP3 service"),
-            "cyrusPop3SSL"      =>_("Start POP3 SSL service"))
-          ));
-  }
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_goKioskService.inc b/plugins/admin/systems/class_goKioskService.inc
deleted file mode 100644 (file)
index 287ed9e..0000000
+++ /dev/null
@@ -1,245 +0,0 @@
-<?php
-
-class goKioskService extends goService{
-       
-  /* This plugin only writes its objectClass */
-  var $objectclasses    = array("goEnvironmentServer");
-  var $attributes       = array("gotoKioskProfile","cn");
-  var $StatusFlag       = "";
-  /* This class can't be assigned twice so it conflicts with itsself */
-  var $conflicts        = array("goKioskService");
-
-  var $baseDir          = "../kiosk";
-  var $filesToAttach    = array();
-  var $cn               = "unknown";  
-  var $gotoKioskProfiles= array();
-  var $gotoKioskProfile = array();
-
-  var $server_path      = "http://%cn/kiosk";
-  function goKioskService(&$config,$dn)
-  {
-    goService::goService($config,$dn);
-
-    $this->DisplayName = _("Kiosk profile service");
-    $this->baseDir = $this->config->search('environment', 'kioskpath',array('menu','tabs'));
-    $this->server_path = preg_replace("/%cn/", $this->cn, $this->server_path);
-
-    /* Load list of profiles and check if they still exists */
-    if ($this->baseDir == ""){
-      print_red(_("There is no KIOSKPATH defined in your gosa.conf. Can't manage kiosk profiles!"));
-    }else{
-      $this->gotoKioskProfiles = array();
-      if(isset($this->attrs['gotoKioskProfile']) && is_array($this->attrs['gotoKioskProfile'])){
-        for($i = 0 ; $i < $this->attrs['gotoKioskProfile']['count']; $i ++){
-          $url = $this->attrs['gotoKioskProfile'][$i];
-          $this->server_path = preg_replace("/\/[^\/]*$/","",$url);
-          $name= preg_replace("/^.*\//","",$url);
-          $this->gotoKioskProfiles[] = array('url'     => $url , 
-                                            'name'    => $name , 
-                                            'initial' =>TRUE,
-                                            'exists'  => file_exists($this->baseDir."/".$name));
-        }
-      }
-    }
-  }
-
-
-  function remove_from_parent()
-  {
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(&(objectClass=gotoEnvironment)(gotoKioskProfile=*/".$this->cn."/*))",array("cn"));
-    $str ="";
-    $cnt = 3;
-    while($cnt && $attrs = $ldap->fetch()){
-      $str .= $attrs['cn'][0].", ";
-      $cnt --;
-    }    
-    $str = preg_replace("/, $/","",$str);
-    if($cnt != 3){
-      print_red(sprintf(_("Can not remove kiosk profile service, it is currently in use by following user(s) : %s."),$str));
-    }else{
-      goService::remove_from_parent();
-    }
-  }
-  
-  
-  function execute()
-  { 
-    /* log actions */
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","server/".get_class($this),$this->dn);
-    }
-
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-    $display= "";
-
-    /* Add new kiosk profile
-     * in profile directory ($this->baseDir);
-     */
-    if((isset($_POST['profileAdd']))&&(isset($_FILES['newProfile']))){
-      $file = $_FILES['newProfile'];
-      if(!file_exists($this->baseDir.$file['name'])){
-        $tmp = array(
-            'url'     => "" ,
-            'name'    => $file['name'] ,
-            'initial' => FALSE,
-            'tmp_name'=> $file['tmp_name'],
-            'content' => file_get_contents($file['tmp_name']),
-            'exists'  => TRUE);
-        $this->gotoKioskProfiles[] = $tmp;
-      }
-      if(!is_writeable($this->baseDir)){
-        print_red(sprintf(_("Can't save new kiosk profiles, possibly permission denied for folder: '%s'."),$this->baseDir));
-      }
-    }
-
-    $only_once = true;
-    foreach($_POST as $name => $value){
-
-      if((preg_match("/^delkiosk_/",$name))&&($only_once)){
-  
-        /* Get id, name and path */
-        $only_once = false;
-        $id = preg_replace("/^delkiosk_/","",$name);
-        $id = preg_replace("/_.*$/","",$id);
-        $name = $this->gotoKioskProfiles[$id]['name'];
-        $filename = $this->baseDir."/".$name;
-
-        /* check if profile is still in use */
-        $ldap = $this->config->get_ldap_link();
-        $ldap->cd($this->config->current['BASE']);
-        $ldap->search("(&(objectClass=gotoEnvironment)(gotoKioskProfile=*".$name.")",array("cn","uid","gotoKioskProfile"));
-        $used_by = "";
-        $cnt = 3;
-        while(($attrs = $ldap->fetch()) && ($cnt)){
-          $cnt --;
-          $check = preg_replace("/^.*\//i","",$attrs['gotoKioskProfile'][0]);
-          if($check == $name){
-            $used_by .= $attrs['cn'][0].", ";
-          }
-        }
-        $used_by = preg_replace("/, $/","",$used_by);
-        if(!empty($used_by)){
-          print_red(sprintf(_("Can't remove kioks profile, it is still in use by the following objects '%s'."),$used_by));
-        }else{
-          if($this->gotoKioskProfiles[$id]['initial']){
-            $res = @unlink($filename);
-            if(!$res){
-              if(!is_writeable($filename)){
-                print_red(sprintf(_("Can't delete '%s'. Error was: permission denied."), $filename));
-              }
-              if(!file_exists($filename)){
-                print_red(sprintf(_("Can't delete '%s'. Error was: file doesn't exist."), $filename));
-              }
-            }
-            unset($this->gotoKioskProfiles[$id]);
-          }
-        }
-      }
-    }
-
-    /* Display list of profiles */
-    $divlist = new divSelectBox("KioskProfiles");
-    $divlist -> SetHeight (300);
-    foreach($this->gotoKioskProfiles as $key => $val ){
-      $divlist->AddEntry(array(
-            array("string"=>"<a target='_blank' href='getkiosk.php?id=".$val['name']."'>".$val['name']."</a>"),
-            array("string"=>"<input type='image' src='images/edittrash.png'
-              class='center' alt='delete' name='delkiosk_".$key."'>" ,
-              "attach"=>" style='border-right: 0px;width:24px; text-align:center;' ")
-            ));
-    }
-
-    /* Assign all existing profiles to smarty */
-    $smarty->assign("divlist",$divlist->DrawList());
-    $smarty = get_smarty(); 
-    foreach($this->attributes as $attr){
-      $smarty->assign($attr,$this->$attr);
-    }
-    $smarty->assign("server_path",$this->server_path);
-    return($smarty->fetch(get_template_path("goKioskService.tpl",TRUE,dirname(__FILE__))));
-  }
-
-  function getListEntry()
-  {
-    $fields = goService::getListEntry();
-    $fields['Message']    = _("Kiosk profile service");
-    $fields['AllowEdit']  = TRUE;
-    $fields['AllowStart']  = false;
-    $fields['AllowStop']  = false;
-    $fields['AllowRestart']  = false;
-    return($fields);
-  }
-
-  function check()
-  { 
-    $message = plugin::check();
-    return($message);
-  }
-
-  function save()
-  {
-    goService::save();
-
-    $method = $this->server_path."/";
-    $method = preg_replace("/\/\/*$/","/",$method);
-    $this->attrs['gotoKioskProfile'] = array();
-    foreach($this->gotoKioskProfiles as $profile){
-      if(!$profile['initial']){
-
-        $contents = $profile['content'];
-        $path = $this->baseDir."/".$profile['name'];
-        $fp = @fopen($path,"w");
-        if(!$fp){
-          print_red(_("Can't save new kiosk profiles, possibly permission denied for folder")." : ",$path);
-        }else{
-          fwrite($fp,$contents,strlen($contents));
-          $this->attrs['gotoKioskProfile'][] = $method.$profile['name'];
-        }
-        @unlink($profile['tmp_name']);
-      }else{
-        $this->attrs['gotoKioskProfile'][] = $method.$profile['name'];
-      }
-    }
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->cd($this->dn);
-    $ldap->modify($this->attrs);
-    show_ldap_error($ldap->get_error(),_("Wohl kaum"));
-  }
-
-  
-  function save_object()
-  {
-    if(isset($_POST['goKioskPosted'])){
-      goService::save_object();
-      if(isset($_POST['server_path'])){
-        $this->server_path = get_post("server_path");
-      }
-    }
-  }  
-
-
-  /* Return plugin informations for acl handling */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("Kiosk"),
-          "plDescription" => _("Kiosk profile management")." ("._("Services").")",
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 100,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("server"),
-
-          "plProvidedAcls"=> array()
-          ));
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_goKrbServer.inc b/plugins/admin/systems/class_goKrbServer.inc
deleted file mode 100644 (file)
index 3eef127..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-<?php
-
-class goKrbServer extends goService{
-       
-  var $cli_summary      = "This pluign is used within the ServerService Pluign \nand indicates that this server supports NTP service.";
-  var $cli_description  = "Some longer text\nfor help";
-  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* This plugin only writes its objectClass */
-  var $objectclasses    = array("goKrbServer");
-  var $attributes       = array("goKrbRealm", "goKrbAdmin","goKrbPassword");
-  var $StatusFlag       = "goKrbServerStatus";
-  /* This class can't be assigned twice so it conflicts with itsself */
-  var $conflicts        = array("goKrbServer");
-
-  var $DisplayName      = "";
-  var $dn               = NULL;
-  var $goKrbServerStatus= "";
-  var $cn               ="";
-  var $goKrbRealm     = "";
-  var $goKrbAdmin     = "";
-  var $goKrbPassword  ="";  
-  var $view_logged  =FALSE;
-  function goKrbServer(&$config,$dn)
-  {
-    goService::goService($config,$dn);
-    $this->DisplayName = _("Kerberos service");
-  }
-
-
-  function execute()
-  { 
-    $smarty = get_smarty(); 
-
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","server/".get_class($this),$this->dn);
-    }
-
-    $tmp = $this->plinfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translation){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-
-    foreach($this->attributes as $attr){
-      $smarty->assign($attr,$this->$attr);
-    }
-    return($smarty->fetch(get_template_path("goKrbServer.tpl",TRUE,dirname(__FILE__))));
-  }
-
-
-  function getListEntry()
-  {
-    $fields               = goService::getListEntry();
-    $fields['Message']    = _("Kerberos service (kadmin access informations)");
-    $fields['AllowEdit']  = true;
-    return($fields);
-  }
-
-  function check()
-  { 
-    $message = plugin::check();
-    /* goKrbPassword is a must field, if goKrbServer is used as objectClass */
-    if (empty($this->goKrbPassword)){
-      $message[]= sprintf(_("The specified kerberos password is empty."), $attr);
-    }
-    if (empty($this->goKrbAdmin)){
-      $message[]= sprintf(_("The specified kerberos admin is empty."), $attr);
-    }
-    if (empty($this->goKrbRealm)){
-      $message[]= sprintf(_("The specified kerberos realm is empty."), $attr);
-    }
-
-    return($message);
-  }
-  
-
-  function save_object()
-  {
-    if(isset($_POST['goKrbServerPosted'])){
-      plugin::save_object();
-    }
-  } 
-
-    /* Return plugin informations for acl handling */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("Kerberos"),
-          "plDescription" => _("Kerberos access information")." ("._("Services").")",
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 95,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("server"),
-
-          "plProvidedAcls"=> array(
-            "goKrbRealm"    => _("Realm"), 
-            "goKrbAdmin"    => _("Admin"),
-            "goKrbPassword" => _("Password"))
-          ));
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_goLdapServer.inc b/plugins/admin/systems/class_goLdapServer.inc
deleted file mode 100644 (file)
index c16df03..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-<?php
-
-class goLdapServer extends goService{
-
-  var $cli_summary      = "This plugin is used within the ServerService Pluign \nand indicates that this server has goLdapServer defined.";
-  var $cli_description  = "Some longer text\nfor help";
-  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* This plugin only writes its objectClass */
-  var $objectclasses    = array("goLdapServer");
-  var $attributes       = array("goLdapBase");
-  var $StatusFlag       = "goLdapServerStatus";
-
-  /* This class can't be assigned twice so it conflicts with itsself */
-  var $conflicts        = array("goLdapServer");
-
-  var $DisplayName      = "";
-  var $dn               = NULL;
-  var $cn                  = "";
-  var $goLdapServerStatus  = "";
-  var $goLdapBase          = ""; 
-  var $view_logged  =FALSE;
-
-  function goLdapServer(&$config,$dn)
-  {
-    goService::goService($config,$dn);
-    $this->DisplayName = _("LDAP service");
-  }
-
-
-  function execute()
-  { 
-
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","server/".get_class($this),$this->dn);
-    }
-
-    $smarty = get_smarty(); 
-    foreach($this->attributes as $attr){
-      $smarty->assign($attr,$this->$attr);
-    }
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translated){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-    return($smarty->fetch(get_template_path("goLdapServer.tpl",TRUE,dirname(__FILE__))));
-  }
-
-
-  function getListEntry()
-  {
-    $fields  = goService::getListEntry();
-    $fields['Message']    = _("LDAP Service");
-    $fields['AllowEdit']  = true;
-    return($fields);
-  }
-
-
-
-  function check()
-  { 
-    $message = plugin::check();
-    if(empty($this->goLdapBase)){
-      $message[] = _("The given base is empty or contains invalid characters.");
-    }
-    return($message);
-  }
-
-
-  function save_object()
-  {
-    if(isset($_POST['goLdapServerPosted'])){
-      plugin::save_object();
-    }
-  } 
-
-
-  /* Return plugin informations for acl handling */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("Ldap"),
-          "plDescription" => _("Ldap")." ("._("Services").")",
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 96,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("server"),
-
-          "plProvidedAcls"=> array(
-            "goLdapBase" => _("Ldap base"))
-          ));
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_goLogDBServer.inc b/plugins/admin/systems/class_goLogDBServer.inc
deleted file mode 100644 (file)
index 3a193db..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-<?php
-
-class goLogDBServer extends goService{
-       
-  var $cli_summary      = "This pluign is used within the ServerService Pluign \nand indicates that this server supports asterisk management.";
-  var $cli_description  = "Some longer text\nfor help";
-  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* This plugin only writes its objectClass */
-  var $objectclasses    = array("goLogDBServer");
-  var $attributes       = array("goLogAdmin", "goLogPassword");
-  var $StatusFlag       = "goLogDBServerStatus";
-
-  /* This class can't be assigned twice so it conflicts with itsself */
-  var $conflicts        = array("goLogDBServer");
-
-  var $DisplayName      = "";
-  var $dn               = NULL;
-  var $acl;
-  var $cn                   = "";
-  var $goLogDBServerStatus  = "";
-  var $goLogAdmin           = "";
-  var $goLogPassword        = "";  
-  var $view_logged  =FALSE;
-
-
-  function goLogDBServer(&$config,$dn)
-  {
-    goService::goService($config,$dn);
-    $this->DisplayName = _("Syslog service database");
-  }
-
-
-  function execute()
-  { 
-    $smarty = get_smarty(); 
-
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","server/".get_class($this),$this->dn);
-    }
-
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translation){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-
-    foreach($this->attributes as $attr){
-      $smarty->assign($attr,$this->$attr);
-    }
-    return($smarty->fetch(get_template_path("goLogDBServer.tpl",TRUE,dirname(__FILE__))));
-  }
-
-
-  function getListEntry()
-  {
-    $fields = goService::getListEntry();
-    $fields['Message']      = _("Syslog service database");
-    $fields['AllowEdit']    = true;
-    return($fields);
-  }
-
-
-  function check()
-  { 
-    $message = plugin::check();
-    if (empty($this->goLogAdmin)){
-      $message[]= sprintf_("The attribute user is empty or contains invalid characters.");
-    }
-    if (empty($this->goLogPassword)){
-      $message[]= sprintf_("The attribute password is empty or contains invalid characters.");
-    }
-    return($message);
-  }
-
-
-  function save_object()
-  {
-    if(isset($_POST['goLogDBServerPosted'])){
-      plugin::save_object();
-    }
-  } 
-
-  /* Return plugin informations for acl handling */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("Logging database"),
-          "plDescription" => _("Logging database")." ("._("Services").")",
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 97,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("server"),
-
-          "plProvidedAcls"=> array(
-            "start"         => _("Start"),
-            "stop"          => _("Stop"),
-            "restart"       => _("Restart"),
-            "goLogAdmin"    => _("Admin"),
-            "goLogPassword" => _("Password"))
-          ));
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_goMailServer.inc b/plugins/admin/systems/class_goMailServer.inc
deleted file mode 100644 (file)
index 742249e..0000000
+++ /dev/null
@@ -1,725 +0,0 @@
-<?php
-
-class goMailServer extends goService{
-       
-  var $cli_summary      = "This pluign is used within the ServerService Pluign \nand indicates that this server supports mailqueue listings and so on.";
-  var $cli_description  = "Some longer text\nfor help";
-  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* This plugin only writes its objectClass */
-  var $objectclasses    = array("goMailServer");
-
-  /* This class can't be assigned twice so it conflicts with itsself */
-  var $DisplayName      = "";
-  var $dn               = NULL;
-  var $StatusFlag       = "goMailServerStatus";
-  var $attributes       = array("description","postfixHeaderSizeLimit",
-      "postfixMailboxSizeLimit","postfixMessageSizeLimit",
-      "postfixMyDestinations","postfixMyDomain","postfixMyhostname",
-      "postfixMyNetworks","postfixRelayhost","postfixTransportTable",
-      "postfixSenderRestrictions","postfixRecipientRestrictions");
-
-  var $goMailServerStatus               ;
-  var $postfixHeaderSizeLimit           = 0;
-  var $postfixMailboxSizeLimit          = 0;
-  var $postfixMessageSizeLimit          = 0;
-  var $postfixMyDestinations            = array();
-  var $postfixMyDomain                  = "";
-  var $postfixMyhostname                = "";
-  var $postfixMyNetworks                = array();
-  var $postfixRelayhost                 = "";
-  var $postfixTransportTable            = array();
-  var $postfixSenderRestrictions        = array();
-  var $postfixRecipientRestrictions     = array();
-  var $description                      = "";
-  var $RestrictionFilters               = array();
-  var $TransportProtocols               = array(); 
-  var $Actions                          = array();
-  var $cn                               = "";
-  var $conflicts                        = array("goMailServer","kolab");
-  var $view_logged  =FALSE;
-
-  function goMailServer(&$config,$dn)
-  {
-    goService::goService($config,$dn);
-    $this->DisplayName = _("Mail smtp service (Postfix)");
-
-    $this->Actions = array( SERVICE_STOPPED=>SERVICE_STOPPED,
-                            SERVICE_STARTED => SERVICE_STARTED,
-                            SERVICE_RESTARTED=>SERVICE_RESTARTED); 
-
-    /* Fill  RestrictionFilters   TransportProtocols  from external hooks */
-    $str = $this->config->data['TABS']['SERVERSERVICE'];
-    $this->TransportProtocols =array("smtp"=>"SMTP");
-    $this->RestrictionFilters = array("FILTER"=>"FILTER"); 
-    foreach(array("ADDITIONALRESTRICTIONFILTERS"=>"RestrictionFilters",
-          "ADDITIONALPROTOCOLLS"        =>"TransportProtocols") as $file => $var){
-      if(isset($this->config->data['MAIN'][$file])){
-        $file = $this->config->data['MAIN'][$file];
-        if((isset($file)) && is_readable($file)){
-          $tmp = file_get_contents($file);
-          $tmp2= split("\n",$tmp);
-          foreach($tmp2 as $entry){
-            if(empty($entry)) continue;
-            if(preg_match("/:/",$entry)){
-              $tmp3 = split(":",$entry);
-              $r = $this->$var;
-              $r[$tmp3[0]]=$tmp3[1];
-              $this->$var = $r;
-            }else{
-              $r = $this->$var;
-              $r[$entry] =$entry;
-              $this->$var = $r;
-            }
-          }
-        }
-      }
-    }
-
-
-    /* Get postfix my networks */
-    $this->postfixMyNetworks = array();
-    $tmp = array();
-    if(isset($this->attrs['postfixMyNetworks'][0])){
-      $tmp = split(",",$this->attrs['postfixMyNetworks'][0]);
-      foreach($tmp as $str){
-        if(!empty($str)){
-          $this->postfixMyNetworks[base64_encode($str)] = $str;
-        }
-      }
-    }
-
-
-    /* Create full name */
-    if(isset($this->attrs['postfixMyDomain'][0])){
-      $this->postfixMyhostname .= ".".$this->attrs['postfixMyDomain'][0];
-    }
-  
-
-    /* Get postfix my domains */
-    $this->postfixMyDestinations = array(); 
-    if(isset($this->attrs['postfixMyDestinations'][0])){
-      unset($this->attrs['postfixMyDestinations']['count']);
-      foreach($this->attrs['postfixMyDestinations'] as $str){
-        $this->postfixMyDestinations[base64_encode($str)] = $str;
-      }
-    }
-
-
-    /* Get transport tables */
-    $tmp = array();
-    $this->postfixTransportTable = array();
-    if(isset($this->attrs['postfixTransportTable'])){
-      $tmp = array();
-      unset($this->attrs['postfixTransportTable']['count']);
-      foreach($this->attrs['postfixTransportTable'] as $entry){
-
-        //0: offshore.vip.ms-europa.lhsystems.com smtp:172.28.0.2
-
-        $Number   = preg_replace('/^([^:]+):.*$/', '\\1', $entry);
-        $Rest     = trim(preg_replace("/^[0-9]*:/","",$entry));
-
-        $Protocol_Destination = preg_replace("/^.*\ /","",$Rest);
-        $Source               = preg_replace("/\ .*$/","",$Rest);
-
-        $Protocol     = preg_replace ('/^([^:]+):.*$/', '\\1' ,trim($Protocol_Destination));
-        $Destination  = preg_replace ('/^[^:]+:(.*)$/', '\\1'    ,trim($Protocol_Destination));
-
-        $Destination  = preg_replace ("/[\[\]]/","",$Destination);
-
-        $tmp[$Number]['src'] = $Source;
-        $tmp[$Number]['dst'] = $Destination;
-        $tmp[$Number]['prt'] = $Protocol;
-      }
-      ksort($tmp);
-      foreach($tmp as $entry){
-        $this->postfixTransportTable[] = $entry;
-      }
-    }
-   
-
-    /* Get sender restrictions */
-    $tmp = array();
-    $this->postfixSenderRestrictions = array();
-    if(isset($this->attrs['postfixSenderRestrictions'])){
-      unset($this->attrs['postfixSenderRestrictions']['count']);
-      foreach($this->attrs['postfixSenderRestrictions'] as $entry){
-        $nr  = preg_replace("/:.*$/","",$entry);
-        $rest= trim(preg_replace("/^[^:]+:/","",$entry));
-        $src = preg_replace("/ .*$/","",$rest);
-        $rest= preg_replace("/^[^ ]+ /","",$rest);
-        $dst = preg_replace("/^.* /","",$rest);
-        $prt = preg_replace("/ .*$/","",$rest);
-        $tmp[$nr]['src'] = $src;
-        $tmp[$nr]['dst'] = $dst;
-        $tmp[$nr]['filter'] = $prt;
-      }
-      ksort($tmp);
-      foreach($tmp as $entry){
-        $this->postfixSenderRestrictions[] = $entry;
-      }
-    }
-
-    /* Get sender restrictions */
-    $tmp = array();
-    $this->postfixRecipientRestrictions = array();
-    if(isset($this->attrs['postfixRecipientRestrictions'])){
-      unset($this->attrs['postfixRecipientRestrictions']['count']);
-      foreach($this->attrs['postfixRecipientRestrictions'] as $entry){
-        $nr  = preg_replace("/:.*$/","",$entry);
-        $rest= trim(preg_replace("/^[^:]+:/","",$entry));
-        $src = preg_replace("/ .*$/","",$rest);
-        $rest= preg_replace("/^[^ ]+ /","",$rest);
-        $dst = preg_replace("/^.* /","",$rest);
-        $prt = preg_replace("/ .*$/","",$rest);
-        $tmp[$nr]['src'] = $src;
-        $tmp[$nr]['dst'] = $dst;
-        $tmp[$nr]['filter'] = $prt;
-      }
-      ksort($tmp);
-      foreach($tmp as $entry){
-        $this->postfixRecipientRestrictions[] = $entry;
-      }
-    }
-
-  }
-
-  function execute()
-  { 
-    $smarty   = get_smarty();
-
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","server/".get_class($this),$this->dn);
-    }
-
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translation){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-
-    $delAr    = array( 
-                    "TranslationDel_"=>"TranslationDel",
-                    "SenderRestrictDel_"=>"SenderRestrictDel",
-                    "RecipientRestrictDel_"=>"RecipientRestrictDel");
-    $once     = true;
-    $s_action = "";
-    $s_entry  = "";
-  
-    /* Check posts for some intruductions */
-    foreach($_POST as $name => $value){
-      foreach($delAr as $preg => $type){
-        if((preg_match("/^".$preg."/",$name)) && ($once)){
-          $once = false;
-          $s_action = $type; 
-          $s_entry = preg_replace("/^".$preg."/","",$name);
-          $s_entry = preg_replace("/_[xy]$/","",$s_entry);
-        }
-      }
-  
-
-      if(preg_match("/^TranslationUp_/",$name) && $once && ($this->acl_is_writeablei("postfixTransportTableACL"))){
-        $once = false;
-        $key = preg_replace("/^TranslationUp_/","",$name);
-        $key = preg_replace("/_[xy]$/","",$key);
-        $this->postfixTransportTable = $this->ArrayUp($key,$this->postfixTransportTable) ;
-      }
-      if(preg_match("/^TranslationDown_/",$name) && $once && ($this->acl_is_writeable("postfixTransportTableACL"))){
-        $once = false;
-        $key = preg_replace("/^TranslationDown_/","",$name);
-        $key = preg_replace("/_[xy]$/","",$key);
-        $this->postfixTransportTable = $this->ArrayDown($key,$this->postfixTransportTable) ;
-      }
-      if(preg_match("/^SenderRestrictUp_/",$name) && $once && ($this->acl_is_writeable("postfixSenderRestrictionsACL"))){
-        $once = false;
-        $key = preg_replace("/^SenderRestrictUp_/","",$name);
-        $key = preg_replace("/_[xy]$/","",$key);
-        $this->postfixSenderRestrictions = $this->ArrayUp($key,$this->postfixSenderRestrictions) ;
-      }
-      if(preg_match("/^SenderRestrictDown_/",$name) && $once && ($this->acl_is_writeable("postfixSenderRestrictionsACL"))){
-        $once = false;
-        $key = preg_replace("/^SenderRestrictDown_/","",$name);
-        $key = preg_replace("/_[xy]$/","",$key);
-        $this->postfixSenderRestrictions = $this->ArrayDown($key,$this->postfixSenderRestrictions) ;
-      }
-      if(preg_match("/^RecipientRestrictUp_/",$name) && $once && ($this->acl_is_writeable("postfixRecipientRestrictionsACL"))){
-        $once = false;
-        $key = preg_replace("/^RecipientRestrictUp_/","",$name);
-        $key = preg_replace("/_[xy]$/","",$key);
-        $this->postfixRecipientRestrictions = $this->ArrayUp($key,$this->postfixRecipientRestrictions) ;
-      }
-      if(preg_match("/^RecipientRestrictDown_/",$name) && $once && ($this->acl_is_writeable("postfixRecipientRestrictionsACL"))){
-        $once = false;
-        $key = preg_replace("/^RecipientRestrictDown_/","",$name);
-        $key = preg_replace("/_[xy]$/","",$key);
-        $this->postfixRecipientRestrictions = $this->ArrayDown($key,$this->postfixRecipientRestrictions) ;
-      }
-    }
-
-
-    /* Add delete my network entry */
-    if((isset($_POST['AddpostfixMyNetworks'])) && (!empty($_POST['NewString_postfixMyNetworks']))){
-      $str = $_POST['NewString_postfixMyNetworks'];
-      $this->postfixMyNetworks[base64_encode($str)] = $str;
-    }
-
-    if((isset($_POST['DelpostfixMyNetworks'])) && isset($_POST['Select_postfixMyNetworks']) &&(count($_POST['Select_postfixMyNetworks']))){
-      foreach($_POST['Select_postfixMyNetworks'] as $str ){
-        unset($this->postfixMyNetworks[$str]);
-      }
-    }
-
-
-    /* Add delete my domain entry */
-    if($this->acl_is_writeable("postfixMyDestinations")){
-      if((isset($_POST['AddpostfixMyDestinations'])) && (!empty($_POST['NewString_postfixMyDestinations']))){
-        $str = $_POST['NewString_postfixMyDestinations'];
-        $this->postfixMyDestinations[base64_encode($str)] = $str;
-      }
-
-      if((isset($_POST['DelpostfixMyDestinations'])) && isset($_POST['Select_postfixMyDestinations']) &&(count($_POST['Select_postfixMyDestinations']))){
-        foreach($_POST['Select_postfixMyDestinations'] as $str ){
-          unset($this->postfixMyDestinations[$str]);
-        }
-      }
-    }
-
-
-    /* Add sender restriction */
-    if($this->acl_is_writeable("postfixSenderRestrictions")){
-      if(($s_action == "SenderRestrictDel") && (isset($this->postfixSenderRestrictions[$s_entry]))){
-        unset($this->postfixSenderRestrictions[$s_entry]);
-      }
-
-      if(isset($_POST['AddpostfixSenderRestrictions'])){
-        $src      = $_POST['Source_postfixSenderRestrictions'];
-        $dst      = $_POST['Destination_postfixSenderRestrictions'];
-        $Filter   = $_POST['SenderRestrictionFilter'];
-        $tmp['src']     = $src;
-        $tmp['dst']     = $dst;
-        $tmp['filter']  = $Filter;
-        $this->postfixSenderRestrictions[] = $tmp;
-      }
-    }
-
-
-    /* Add sender restriction */
-    if($this->acl_is_writeable("postfixRecipientRestrictions")){
-      if(($s_action == "RecipientRestrictDel") && (isset($this->postfixRecipientRestrictions[$s_entry]))){
-        unset($this->postfixRecipientRestrictions[$s_entry]);
-      }
-
-      if(isset($_POST['AddpostfixRecipientRestrictions'])){
-        $src      = $_POST['Source_postfixRecipientRestrictions'];
-        $dst      = $_POST['Destination_postfixRecipientRestrictions'];
-        $Filter   = $_POST['RecipientRestrictionFilter'];
-        $tmp['src']     = $src;
-        $tmp['dst']     = $dst;
-        $tmp['filter']  = $Filter;
-        $this->postfixRecipientRestrictions[] = $tmp;
-      }
-    }
-
-    /* Handle transports */
-    if($this->acl_is_writeable("postfixTransportTable")){
-      if(($s_action == "TranslationDel") && (isset($this->postfixTransportTable[$s_entry]))){
-        unset($this->postfixTransportTable[$s_entry]);
-      }
-
-      if(isset($_POST['AddpostfixTransportTable'])){
-        $src = trim($_POST['Source_postfixTransportTable']);  
-        $dst = trim($_POST['Destination_postfixTransportTable']);    
-        $prt = trim($_POST['TransportProtocol']);
-
-        if((!empty($src)) && (!empty($dst))){
-          if(preg_match("/:/",$dst)){
-            $tmp = split("\:",$dst);
-            $port = trim($tmp[1]);
-            $ip   = trim($tmp[0]);
-
-            if((is_ip($ip)) && (is_numeric($port))){
-              $dst = "[".$ip."]:".$port;
-            }
-          }
-          if(is_ip($dst)){
-            $dst = "[".$dst."]";
-          }
-          $tmp2 ['src'] = $src;
-          $tmp2 ['dst'] = $dst;
-          $tmp2 ['prt'] = $prt;
-
-          $this->postfixTransportTable[] = $tmp2;  
-        } 
-      }
-    }
-
-    /* Set attributes */
-    foreach($this->attributes as $attr){
-      $smarty->assign($attr,$this->$attr);
-    }
-
-
-    /* Create divList for translation tables */
-    $divTranslation = new divSelectBox("TransportProtocols");
-    $divTranslation->SetHeight(90);
-    foreach($this->postfixTransportTable as $key => $entry){
-      $img = "";
-
-      if($key != 0 && $this->acl_is_writeable("postfixTransportTable")){
-        $img.= "<input type='image' src='images/sort_up.png' name='TranslationUp_".$key."' class='center'>&nbsp;";      
-      }else{
-        $img.= "<img src='images/empty.png' style='width:10px;'>";
-      }
-      if(($key+1) < count($this->postfixTransportTable) && $this->acl_is_writeable("postfixTransportTable")){
-        $img.= "<input type='image' src='images/sort_down.png' name='TranslationDown_".$key."' class='center'>&nbsp;";      
-      }else{
-        $img.= "<img src='images/empty.png' style='width:10px;'>";
-      }
-
-      if($this->acl_is_writeable("postfixTransportTable")){
-        $img.= "<input type='image' src='images/edittrash.png' name='TranslationDel_".$key."' class='center'>&nbsp;";      
-      }
-      $field1 = array("string"=> $entry['src']);
-      $field2 = array("string"=> $entry['dst']);
-      $field3 = array("string"=> $entry['prt'],"attach"=>"style='width:120px;'");
-      $field4 = array("string"=> $img, "attach"=>"style='border-right:0px;width:40px;'");
-      $divTranslation->AddEntry(array($field1,$field2,$field3,$field4,));
-    }
-    $smarty->assign("Div_postfixTransportTable" ,$divTranslation->DrawList());
-
-
-    /* Create divList for sender restrictions */
-    $DivSenderRestrict = new divSelectBox("postfixSenderRestrictions");
-    $DivSenderRestrict->SetHeight(90);
-    foreach($this->postfixSenderRestrictions as $key => $entry){
-      $img ="";
-
-      if($key != 0 && $this->acl_is_writeable("postfixSenderRestrictions")){
-        $img.= "<input type='image' src='images/sort_up.png' name='SenderRestrictUp_".$key."' class='center'>&nbsp;";      
-      }else{
-        $img.= "<img src='images/empty.png' style='width:10px;'>";
-      }
-      if(($key+1) < count($this->postfixSenderRestrictions) && $this->acl_is_writeable("postfixSenderRestrictions")){
-        $img.= "<input type='image' src='images/sort_down.png' name='SenderRestrictDown_".$key."' class='center'>&nbsp;";      
-      }else{
-        $img.= "<img src='images/empty.png' style='width:10px;'>";
-      }
-
-      if($this->acl_is_writeable("postfixSenderRestrictions")){
-        $img.= "<input type='image' src='images/edittrash.png' name='SenderRestrictDel_".$key."' class='center'>&nbsp;";     
-      }
-      $field1 = array("string"=> $entry['src']);
-      $field2 = array("string"=> $entry['dst']);
-      $field3 = array("string"=> $entry['filter'],"attach"=>"style='width:100px;'");
-      $field4 = array("string"=> $img, "attach"=>"style='border-right:0px;width:40px;'");
-      $DivSenderRestrict->AddEntry(array($field1,$field2,$field3,$field4,));
-    }
-    $smarty->assign("Div_postfixSenderRestrictions" ,$DivSenderRestrict->DrawList());
-
-
-    /* Create divList for translation tables */
-    $DivRecipientRestrict = new divSelectBox("postfixRecipientRestrictions");
-    $DivRecipientRestrict->SetHeight(90);
-
-    foreach($this->postfixRecipientRestrictions as $key => $entry){
-      $img = "";
-      if($key != 0 && $this->acl_is_writeable("postfixRecipientRestrictions")){
-        $img.= "<input type='image' src='images/sort_up.png' name='RecipientRestrictUp_".$key."' class='center'>&nbsp;";      
-      }else{
-        $img.= "<img src='images/empty.png' style='width:10px;'>";
-      }
-      if(($key+1) < count($this->postfixRecipientRestrictions) && $this->acl_is_writeable("postfixRecipientRestrictions")){
-        $img.= "<input type='image' src='images/sort_down.png' name='RecipientRestrictDown_".$key."' class='center'>&nbsp;";      
-      }else{
-        $img.= "<img src='images/empty.png' style='width:10px;'>";
-      }
-
-      if($this->acl_is_writeable("postfixRecipientRestrictions")){
-        $img.= "<input type='image' src='images/edittrash.png' name='RecipientRestrictDel_".$key."' class='center'>&nbsp;";      
-      }
-      $field1 = array("string"=> $entry['src']);
-      $field2 = array("string"=> $entry['dst']);
-      $field3 = array("string"=> $entry['filter'],"attach"=>"style='width:100px;'");
-      $field4 = array("string"=> $img, "attach"=>"style='border-right:0px;width:40px;'");
-      $DivRecipientRestrict->AddEntry(array($field1,$field2,$field3,$field4,));
-    }
-    $smarty->assign("Div_postfixRecipientRestrictions" ,$DivRecipientRestrict->DrawList());
-
-    
-    /* set new status */
-    if(isset($_POST['ExecAction'])){
-      if(isset($this->Actions[$_POST['action']])){
-        $this->setStatus($_POST['action']);
-      }
-    }
-
-
-    $smarty->assign("is_new",                       $this->dn);
-    $smarty->assign("is_acc",                       $this->initially_was_account);
-    $smarty->assign("TransportProtocols",           $this->TransportProtocols);
-    $smarty->assign("Actions",                      $this->Actions);
-    $smarty->assign("RestrictionFilters",           $this->RestrictionFilters);
-    $smarty->assign("postfixTransportTable" ,       $this->getTransports());
-    $smarty->assign("postfixSenderRestrictions" ,   $this->getSenderRestrictions());
-    $smarty->assign("postfixRecipientRestrictions" ,$this->getRecipientRestrictions());
-
-    return($smarty->fetch(get_template_path("goMailServer.tpl",TRUE,dirname(__FILE__))));
-  }
-
-  /* return transports formated for select box */ 
-  function getTransports()
-  {
-    $ret = array();
-    foreach($this->postfixTransportTable as $key => $vals){
-      $ret[$key] = $vals['src']." -> ".$vals['prt'].":".$vals['dst'];
-    }
-    return($ret);
-  }
-
-
-  /* return sender restriction formated for select box */ 
-  function getSenderRestrictions()
-  {
-    $ret = array();
-    foreach($this->postfixSenderRestrictions as $key => $vals){
-      $ret[$key] = $vals['src']." ".$vals['filter']." ".$vals['dst'];
-    }
-    return($ret);
-  }
-
-
-  /* return recipient restriction formated for select box */ 
-  function getRecipientRestrictions()
-  {
-    $ret = array();
-    foreach($this->postfixRecipientRestrictions as $key => $vals){
-      $ret[$key] = $vals['src']." ".$vals['filter']." ".$vals['dst'];
-    }
-    return($ret);
-  }
-
-
-  /* Return list entry */
-  function getListEntry()
-  {
-    $fields               = goService::getListEntry();
-    $fields['Message']    = _("Mail smtp service (Postfix)");
-    $fields['AllowEdit']  = true;
-    return($fields);
-  }
-
-
-  function save()
-  {
-    $this->postfixMyDomain   = preg_replace("/^[^\.]+\./","",$this->postfixMyhostname);
-    $this->postfixMyhostname = preg_replace("/\..*$/","",$this->postfixMyhostname);
-
-    plugin::save();
-
-    /* Fix transport table*/
-    $i = 0 ; 
-    $this->attrs['postfixTransportTable'] = array();
-    foreach($this->postfixTransportTable as $key => $entry){
-      $this->attrs['postfixTransportTable'][] = $i.": ".$entry['src']." ".$entry['prt'].":".$entry['dst'];
-      $i ++;
-    }
-
-
-    /* Fix sender restrictions */
-    $i = 0;
-    $this->attrs['postfixSenderRestrictions'] =array();
-    foreach($this->postfixSenderRestrictions as $key => $entry){
-      $this->attrs['postfixSenderRestrictions'][] = $i.": ".$entry['src']." ".$entry['filter']." ".$entry['dst']; 
-      $i ++;  
-    }
-  
-  
-    /* Fix recipient restrictions */
-    $i = 0;
-    $this->attrs['postfixRecipientRestrictions'] =array();
-    foreach($this->postfixRecipientRestrictions as $key => $entry){
-      $this->attrs['postfixRecipientRestrictions'][] = $i.": ".$entry['src']." ".$entry['filter']." ".$entry['dst']; 
-      $i ++;  
-    }
-
-
-    /* Fix mydomains */
-    $this->attrs['postfixMyDestinations']  = array();
-    foreach($this->postfixMyDestinations as $entry){
-      $this->attrs['postfixMyDestinations'][] =$entry;
-    }
-
-
-    /* Fix mydomains */
-    if(count($this->postfixMyNetworks)){
-      $this->attrs['postfixMyNetworks']  = "";
-      foreach($this->postfixMyNetworks as $entry){
-        $this->attrs['postfixMyNetworks'] .=$entry.",";
-      }
-      $this->attrs['postfixMyNetworks'] = preg_replace("/,$/","",$this->attrs['postfixMyNetworks']);
-    }else{
-      $this->attrs['postfixMyNetworks']  = array();
-    }
-
-    /* Check if this is a new entry ... add/modify */
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cat($this->dn,array("objectClass"));
-    if($ldap->count()){
-      $ldap->cd($this->dn);
-      $ldap->modify($this->attrs);
-    }else{
-      $ldap->cd($this->dn);
-      $ldap->add($this->attrs);
-    }
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving server services/mail with dn '%s' failed."),$this->dn));
-    if($this->initially_was_account){
-      $this->handle_post_events("modify");
-      new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());  
-    }else{
-      $this->handle_post_events("add");
-      new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());  
-    }
-
-  }
-
-
-  function check()
-  { 
-    $message =plugin::check();
-  
-    if(!is_numeric($this->postfixHeaderSizeLimit)){
-      $message[] = _("Please specify a numeric value for header size limit.");
-    }
-
-    if(!is_numeric($this->postfixMailboxSizeLimit)){
-      $message[] = _("Please specify a numeric value for mailbox size limit.");
-    }
-
-    if(!is_numeric($this->postfixMessageSizeLimit)){
-      $message[] = _("Please specify a numeric value for message size limit.");
-    }
-
-    return $message;
-  }
-
-
-  /* Combine new array */
-  function combineArrays($ar0,$ar1,$ar2)
-  {
-    $ret = array();
-    if(is_array($ar0))
-    foreach($ar0 as $ar => $a){
-        $ret[]=$a;
-    }
-    if(is_array($ar1))
-    foreach($ar1 as $ar => $a){
-        $ret[]=$a;
-    }
-    if(is_array($ar2))
-    foreach($ar2 as $ar => $a){
-        $ret[]=$a;
-    }
-    return($ret);
-  }
-
-
-  function getpos($atr,$attrs)
-  {
-    $i = 0;
-    foreach($attrs as $attr => $name)    {
-      $i++;
-      if($attr == $atr){
-        return($i);
-      }
-    }
-
-    return(-1);
-  }
-
-
-  /* TRansports the geiven Arraykey one position up*/
-  function ArrayUp($atr,$attrs)
-  {
-    $ret = $attrs;
-    $pos = $this->getpos($atr,$attrs) ;
-    $cn = count($attrs);
-    if(!(($pos == -1)||($pos == 1))){
-      $before = array_slice($attrs,0,($pos-2));
-      $mitte  = array_reverse(array_slice($attrs,($pos-2),2));
-      $unten  = array_slice($attrs,$pos);
-      $ret = array();
-      $ret = $this->combineArrays($before,$mitte,$unten);
-    }
-    return($ret);
-  }
-
-
-  /* TRansports the geiven Arraykey one position up*/
-  function ArrayDown($atr,$attrs)
-  {
-    $ret = $attrs;
-    $pos = $this->getpos($atr,$attrs) ;
-    $cn = count($attrs);
-    if(!(($pos == -1)||($pos == $cn))){
-      $before = array_slice($attrs,0,($pos-1));
-      $mitte  = array_reverse(array_slice($attrs,($pos-1),2));
-      $unten  = array_slice($attrs,($pos+1));
-      $ret = array();
-      $ret = $this->combineArrays($before,$mitte,$unten);
-    }
-    return($ret);
-  }
-
-  function save_object()
-  {
-    plugin::save_object();  
-  }
-
-
-  function PrepareForCopyPaste($source)
-  {
-    plugin::PrepareForCopyPaste($source);
-
-    $source_o = new goMailServer($this->config,$source['dn']);
-    foreach(array("postfixMyDomain","postfixMyhostname","postfixMyNetworks","postfixTransportTable","postfixSenderRestrictions","postfixRecipientRestrictions","postfixMyDestinations") as $attr){
-      $this->$attr = $source_o->$attr;
-    }
-  }
-
-
-  /* Return plugin informations for acl handling */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("Mail smtp (Postfix)"),
-          "plDescription" => _("Mail smtp - Postfix")." ("._("Services").")",
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 98,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("server"),
-
-          "plProvidedAcls"=> array(
-            "postfixMyhostname"           => _("Visible full qualified hostname"),
-            "description"                 => _("Description"), 
-            "postfixHeaderSizeLimit"      => _("Header size limit"), 
-            "postfixMailboxSizeLimit"     => _("Max mailbox size"), 
-            "postfixMessageSizeLimit"     => _("Max message size"), 
-            "postfixMyDestinations"       => _("Domains to accept mail for"), 
-            "postfixMyNetworks"           => _("Local networks"), 
-            "postfixRelayhost"            => _("Relay host"), 
-            "postfixTransportTable"       => _("Transport table"), 
-            "postfixSenderRestrictions"   => _("Restrictions for sender"), 
-            "postfixRecipientRestrictions"=> _("Restrictions for recipient"))
-            ));
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_goNtpServer.inc b/plugins/admin/systems/class_goNtpServer.inc
deleted file mode 100644 (file)
index b179ae9..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-<?php
-
-class goNtpServer extends goService{
-
-  var $cli_summary      = "This pluign is used within the ServerService Pluign \nand indicates that this server supports NTP service.";
-  var $cli_description  = "Some longer text\nfor help";
-  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* This plugin only writes its objectClass */
-  var $objectclasses    = array("goNtpServer");
-  var $attributes       = array("goTimeSource");
-  var $StatusFlag       = "goNtpServerStatus";
-
-  /* This class can't be assigned twice so it conflicts with itsself */
-  var $conflicts        = array("goNtpServer");
-
-  var $DisplayName      = "";
-  var $dn               = NULL;
-  var $goTimeSource     = array();
-  var $goNtpServerStatus= "";
-  var $acl;
-  var $cn               = "";
-  var $view_logged  =FALSE;
-
-  function goNtpServer(&$config,$dn)
-  {
-    goService::goService($config,$dn);
-    $this->DisplayName = _("Time service (NTP)");
-
-    /* Load arrays */
-    $tmp = array();
-    if (isset($this->attrs['goTimeSource'])){
-      for ($i= 0; $i<$this->attrs['goTimeSource']['count']; $i++){
-        $tmp[$this->attrs['goTimeSource'][$i]]= $this->attrs['goTimeSource'][$i];
-      }
-    }
-    $this->goTimeSource= $tmp;
-  }
-
-
-  function execute()
-  { 
-    $smarty = get_smarty(); 
-
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","server/".get_class($this),$this->dn);
-    }
-
-    /* Here we add a new entry  */
-    if(isset($_POST['NewNTPAdd']) && $_POST['NewNTPExport'] != "" && $this->acl_is_writeable("goTimeSource")) {
-      $this->goTimeSource[$_POST['NewNTPExport']]= $_POST['NewNTPExport'];
-      asort($this->goTimeSource);
-    }
-
-    /* Deleting an Entry, is a bit more complicated than adding one*/
-    if((isset($_POST['DelNTPEnt'])) && (isset($_POST['goTimeSource'])) && $this->acl_is_writeable("goTimeSource")) {
-      foreach ($_POST['goTimeSource'] as $entry){
-        if (isset($this->goTimeSource[$entry])){
-          unset($this->goTimeSource[$entry]);
-        }
-      }
-    }
-
-    $smarty->assign("goNtpServerACL", $this->getacl("goNtpServer")) ;
-    $smarty->assign("goTimeSource" , $this->goTimeSource); 
-    return($smarty->fetch(get_template_path("goNtpServer.tpl",TRUE,dirname(__FILE__))));
-  }
-
-
-  function getListEntry()
-  {
-    $fields               = goService::getListEntry();
-    $fields['Message']    = _("Time service (NTP)");
-    $fields['AllowEdit']  = true;
-    return($fields);
-  }
-
-
-  function save()
-  {
-    plugin::save();
-    $this->attrs['goTimeSource'] =array();
-    foreach($this->goTimeSource as $entry){
-      $this->attrs['goTimeSource'][] = $entry;
-    }
-    /* Check if this is a new entry ... add/modify */
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cat($this->dn,array("objectClass"));
-    if($ldap->count()){
-      $ldap->cd($this->dn);
-      $ldap->modify($this->attrs);
-    }else{
-      $ldap->cd($this->dn);
-      $ldap->add($this->attrs);
-    }
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving server services/goNtpServer with dn '%s' failed."),$this->dn));
-    if($this->initially_was_account){
-      $this->handle_post_events("modify");
-      new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }else{
-      $this->handle_post_events("add");
-      new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }
-  }
-
-
-  /* Return plugin informations for acl handling */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("Time service"),
-          "plDescription" => _("Time service - NTP")." ("._("Services").")",
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 91,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("server"),
-
-          "plProvidedAcls"=> array(
-            "goTimeSource"        =>_("Ntp source"))
-          ));
-  }
-
-  
-  function PrepareForCopyPaste($source)
-  {
-    plugin::PrepareForCopyPaste($source);
-
-    /* Load arrays */
-    $tmp = array();
-    if (isset($source['goTimeSource'])){
-      for ($i= 0; $i<$source['goTimeSource']['count']; $i++){
-        $tmp[$source['goTimeSource'][$i]]= $source['goTimeSource'][$i];
-      }
-    }
-    $this->goTimeSource= $tmp;
-
-
-  }
-
-  function check(){ return array();}
-
-  function save_object(){;}
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_goService.inc b/plugins/admin/systems/class_goService.inc
deleted file mode 100644 (file)
index edfd3d7..0000000
+++ /dev/null
@@ -1,238 +0,0 @@
-<?php
-
-class goService extends plugin{
-       
-  var $cli_summary      = "This plugin is used within the ServerService plugin.";
-  var $cli_description  = "Some longer text\nfor help";
-  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* This plugin only writes its objectClass */
-  var $objectclasses    = array();
-  var $attributes       = array();
-  var $StatusFlag       = "";
-  /* This class can't be assigned twice so it conflicts with itsself */
-  var $conflicts            = array();
-  var $dn                   = NULL;
-  var $cn                   = "";
-  var $DisplayName          = "";
-  var $view_logged  =FALSE;
-
-   
-  /* Construcktion */ 
-  function goService(&$config,$dn)
-  {
-    plugin::plugin($config,$dn);
-    $this->DisplayName = _("Empty service");
-  }
-
-  
-  /* Create content */
-  function execute()
-  {
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","server/".get_class($this),$this->dn);
-    }
-
-    $str ="<div style='width:100%; text-align:right;'>".
-          "  <input type='submit' name='SaveService' value='"._("Save")."'>&nbsp;".
-          "  <input type='submit' name='CancelService' value='"._("Cancel")."'>".
-          "</div>";
-    return($str);
-  }
-
-
-  /* Get service information for serverService plugin */
-  function getListEntry()
-  {
-    
-    $this->updateStatusState();
-
-    /* Assign status flag */
-    if(!empty($this->StatusFlag)){
-      $flag                   = $this->StatusFlag;
-      $fields['Status']       = $this->$flag;
-    }else{
-      $fields['Status']       = "";
-    }
-
-    /* Name displayed in service overview */
-    $fields['Message']      = _("Empty service");
-
-    /* Allow/disallow some functions */
-    $fields['AllowStart']   = $this->acl_is_writeable("start");
-    $fields['AllowStop']    = $this->acl_is_writeable("stop");
-    $fields['AllowRestart'] = $this->acl_is_writeable("restart");
-    $fields['AllowRemove']  = $this->acl_is_removeable();
-    $fields['AllowEdit']    = true;
-    return($fields);
-  }
-
-
-  /* Remove service */
-  function remove_from_parent()
-  {
-    if(!$this->initially_was_account || !$this->acl_is_removeable()){
-      return;
-    }
-    
-    plugin::remove_from_parent();
-
-    /* Remove status flag, it is not a memeber of 
-        this->attributes, so ensure that it is deleted too */
-    if(!empty($this->StatusFlag)){
-      $this->attrs[$this->StatusFlag] = array();
-    }
-
-    /* Check if this is a new entry ... add/modify */
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cat($this->dn,array("objectClass"));
-    if($ldap->count()){
-      $ldap->cd($this->dn);
-      $ldap->modify($this->attrs);
-    }else{
-      $ldap->cd($this->dn);
-      $ldap->add($this->attrs);
-      
-    }
-
-    new log("remove","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-
-    show_ldap_error($ldap->get_error(), sprintf(_("Removing of server services/".get_class($this)." - (".$this->DisplayName.") with dn '%s' failed."),$this->dn));
-    $this->handle_post_events("remove");
-  }
-
-
-  /* Save service */
-  function save()
-  {
-    plugin::save();
-    /* Check if this is a new entry ... add/modify */
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cat($this->dn,array("objectClass"));
-    if($ldap->count()){
-      $ldap->cd($this->dn);
-      $ldap->modify($this->attrs);
-    }else{
-      $ldap->cd($this->dn);
-      $ldap->add($this->attrs);
-    }
-    if($this->initially_was_account){
-      new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-      $this->handle_post_events("modify");
-    }else{
-      $this->handle_post_events("add");
-      new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of server services/".get_class($this)." - (".$this->DisplayName.") with dn '%s' failed."),$this->dn));
-  }
-
-
-  /* Directly save new status flag */
-  function setStatus($value)
-  {
-    if($value == "none") return;
-
-    /* Can't set status flag for new services (Object doesn't exists in ldap tree) */
-    if(!$this->initially_was_account) return;
-
-    /* Can't set status flag, if no flag is specified  */
-    if(empty($this->StatusFlag)){
-      return;
-    }
-
-    /* Get object (server), update status flag and save changes */
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->dn);
-    $ldap->cat($this->dn,array("objectClass"));
-    if($ldap->count()){
-
-      $tmp = $ldap->fetch();
-      for($i = 0; $i < $tmp['objectClass']['count']; $i ++){
-        $attrs['objectClass'][] = $tmp['objectClass'][$i];
-      }
-      $flag = $this->StatusFlag;
-      $attrs[$flag] = $value;
-      $this->$flag = $value;
-      $ldap->modify($attrs);
-      show_ldap_error($ldap->get_error(), sprintf(_("Set status flag for server services/".get_class($this)." - (".$this->DisplayName.") with dn '%s' failed."),$this->dn));
-      $this->action_hook();
-    }
-  }
-
-
-  function check()
-  { 
-    $message = plugin::check();
-    return($message);
-  }
-  
-
-  function save_object()
-  {
-    plugin::save_object();
-  }  
-
-  
-  function action_hook($add_attrs= array())
-  {
-    /* Find postcreate entries for this class */
-    $command= $this->config->search(get_class($this), "ACTION_HOOK",array('menu','tabs'));
-    if ($command != ""){
-
-      /* Walk through attribute list */
-      foreach ($this->attributes as $attr){
-        if (!is_array($this->$attr)){
-          $command= preg_replace("/%$attr/", $this->$attr, $command);
-        }
-      }
-      $command= preg_replace("/%dn/", $this->dn, $command);
-
-      /* Additional attributes */
-      foreach ($add_attrs as $name => $value){
-        $command= preg_replace("/%$name/", $value, $command);
-      }
-
-      /* If there are still some %.. in our command, try to fill these with some other class vars */
-      if(preg_match("/%/",$command)){
-        $attrs = get_object_vars($this);
-        foreach($attrs as $name => $value){
-          if(!is_string($value)) continue;
-          $command= preg_replace("/%$name/", $value, $command);
-        }
-      }
-
-      if (check_command($command)){
-        @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__,
-            $command, "Execute");
-
-        exec($command);
-      } else {
-        $message= sprintf(_("Command '%s', specified as ACTION_HOOK for plugin '%s' doesn't seem to exist."), $command, get_class($this));
-        print_red ($message);
-      }
-    }
-  }
-
-
-  /* Get updates for status flag */
-  function updateStatusState()
-  {
-    if(empty($this->StatusFlag)) return;
-
-    $attrs = array();
-    $flag = $this->StatusFlag;
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->cn);
-    $ldap->cat($this->dn,array($flag));
-    if($ldap->count()){
-      $attrs = $ldap->fetch();
-    }
-    if(isset($attrs[$flag][0])){
-      $this->$flag = $attrs[$flag][0];
-    }
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_goShareServer.inc b/plugins/admin/systems/class_goShareServer.inc
deleted file mode 100644 (file)
index 354d780..0000000
+++ /dev/null
@@ -1,409 +0,0 @@
-<?php
-
-class goShareServer extends goService{
-
-  var $cli_summary      = "This plugin is used within the ServerService Pluign \nand indicates that this server supports shares.";
-  var $cli_description  = "Some longer text\nfor help";
-  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* This plugin only writes its objectClass */
-  var $objectclasses    = array("goShareServer");
-  var $attributes       = array("goExportEntry");
-  var $StatusFlag       = "goShareServerStatus";
-
-  /* This class can't be assigned twice so it conflicts with itsself */
-  var $conflicts        = array("goShareServer");
-
-  var $DisplayName      = "";
-  var $dn               = NULL;
-  var $cn                   = "";
-  var $goShareServerStatus  = "";
-  var $goExportEntry        = array();
-  var $allow_mounts         = false;
-  var $mounts_to_remove     = array();
-  var $mounts_to_add        = array();
-  var $view_logged  =FALSE;
-
-  function goShareServer(&$config,$dn)
-  {
-    goService::goService($config,$dn);
-
-    $this->DisplayName = _("File service");
-
-    $tmp =array();
-    if(isset($this->attrs['goExportEntry'])){
-      if(isset($this->attrs['goExportEntry']['count'])){
-        for($i= 0; $i<$this->attrs['goExportEntry']['count']; $i++){
-          $entry= $this->attrs['goExportEntry'][$i];
-          $tmp[preg_replace('/\|.*$/', '', $entry)]= $entry;
-        }
-      }
-    } 
-    $this->goExportEntryList = $tmp;
-
-    $ldap = $this->config->get_ldap_link();
-    $avl_objectclasses = $ldap->get_objectclasses();
-    if (isset($avl_objectclasses["mount"])) {
-      $this->allow_mounts = true;
-    }
-  }
-
-
-  function execute()
-  { 
-    $smarty = get_smarty(); 
-
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","server/".get_class($this),$this->dn);
-    }
-
-
-    if((isset($_POST['DelNfsEnt']))&&(isset($_POST['goExportEntryList'])) && ($this->acl_is_writeable("name"))){
-      if($this->allow_mounts){
-        foreach($_POST['goExportEntryList'] as $entry){
-          $this->deleteFromMountList($this->goExportEntryList[$entry]);
-        }
-      }
-      foreach($_POST['goExportEntryList'] as $entry){
-        $this->deleteFromList($entry);
-      }
-    }
-
-    if(isset($_POST['NewNfsAdd']) && ($this->acl_is_writeable("name"))){
-      $this->oldone = NULL;
-      $this->o_subWindow = new servnfs($this->config, $this);
-      $this->o_subWindow->set_acl_category("server");
-      $this->o_subWindow->set_acl_base($this->dn);
-      $this->dialog = true;
-    }
-
-    if((isset($_POST['NewNfsEdit']))&&(isset($_POST['goExportEntryList']))){
-      $entry = $this->goExportEntryList[$_POST['goExportEntryList'][0]];
-      $add_mount=isset($this->mounts_to_add[$entry]);
-      $this->oldone=$entry;
-      $this->o_subWindow = new servnfs($this->config,$this,$entry,$add_mount);
-      $this->o_subWindow->set_acl_base($this->dn);
-      $this->o_subWindow->set_acl_category("server");
-      $this->dialog = true;
-    }
-    if(isset($this->o_subWindow)){
-      $this->o_subWindow->save_object(TRUE);
-    }
-
-    /* Save NFS setup */
-    if(isset($_POST['NFSsave']) && isset($this->o_subWindow) && is_object($this->o_subWindow)){
-      if(count($this->o_subWindow->check())>0){
-        foreach($this->o_subWindow->check() as $msg) {
-          print_red($msg);
-        }
-      }else{
-        $this->o_subWindow->save_object();
-        $newone = $this->o_subWindow->save();
-
-        $this->addToList($newone);
-        if($this->allow_mounts){
-          if($this->oldone != NULL) {
-            $this->deleteFromMountList($this->oldone);
-          }
-          if ($this->o_subWindow->should_create_mount()) {
-            $this->addToMountList($newone);
-          }
-        }
-        unset($this->o_subWindow);
-        $this->dialog = false;
-      }
-    }
-
-    /* Cancel NFS setup */
-    if(isset($_POST['NFScancel'])){
-      $this->oldone = NULL;
-      unset($this->o_subWindow);
-      $this->dialog = false;
-    }
-
-    /* Execute NFS setup dialog*/
-    if(isset($this->o_subWindow)){
-      return $this->o_subWindow->execute();
-    }
-
-    foreach($this->attributes as $attr){
-      $smarty->assign($attr,$this->$attr);
-    }
-
-    /* Set acls */
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translated){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-    $smarty->assign("createable",$this->acl_is_createable());
-    $smarty->assign("removeable",$this->acl_is_removeable());
-
-    $tellSmarty= array();
-    ksort($this->goExportEntryList);
-    foreach($this->goExportEntryList as $name=>$values){
-      $tmp = split("\|",$values);
-      $tellSmarty[$name] = $tmp[0]." ".$tmp[4]." (".$tmp[2].")";
-    }
-    $smarty->assign("goExportEntry",array_keys($tellSmarty));
-    $smarty->assign("goExportEntryKeys",($tellSmarty));
-    return($smarty->fetch(get_template_path("goShareServer.tpl",TRUE,dirname(__FILE__))));
-  }
-
-
-  function getListEntry()
-  {
-    $fields = goService::getListEntry();
-    $fields['Message']    = _("File service (Shares)");
-    $fields['AllowEdit']  = true;
-    return($fields);
-  }
-
-
-  function save()
-  {
-    plugin::save();
-
-    /* Arrays */
-    foreach (array("goExportEntryList"=>"goExportEntry") as $source => $destination){
-      $this->attrs[$destination]= array();
-      foreach ($this->$source as $element){
-        $this->attrs[$destination][]= $element;
-      }
-    }
-
-
-    /* Process netatalk mounts */
-    if($this->allow_mounts) {
-      $this->process_mounts();
-    }
-
-    /* Check if this is a new entry ... add/modify */
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cat($this->dn,array("objectClass"));
-    if($ldap->count()){
-      $ldap->cd($this->dn);
-      $ldap->modify($this->attrs);
-    }else{
-      $ldap->cd($this->dn);
-      $ldap->add($this->attrs);
-    }
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of system server/shares with dn '%s' failed."),$this->dn));
-    if($this->initially_was_account){
-      $this->handle_post_events("modify");
-      new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }else{
-      $this->handle_post_events("add");
-      new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }
-  }
-
-
-  function check()
-  { 
-    $message = plugin::check();
-    return($message);
-  }
-
-
-  function save_object()
-  {
-    if(isset($_POST['goShareServerPosted'])){
-      plugin::save_object();
-    }
-  } 
-
-  function addToList($entry){
-    $key =  key($entry);
-    $this->goExportEntryList[$key]=$entry[$key];
-  }
-
-  function deleteFromList($id)
-  {
-    /* Check if the share is used by someone */
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(|(gotoProfileServer=*|$id)(gotoShare=*|$id|*||*))", array("cn"));
-    $cnt= $ldap->count();
-    if ($cnt){
-      $msg= sprintf(_("The share can't be removed since it is still used by %d users:"), $cnt);
-      $msg.= "<br><br><ul>";
-      while ($attrs= $ldap->fetch()){
-        $msg.= "<li>".$attrs["cn"][0]."</li>";
-      }
-      $msg.= "</ul>"._("Please correct the share-/profile settings of these users");
-      print_red($msg);
-
-    } else {
-      /* Finally remove it */
-      unset($this->goExportEntryList[$id]);
-    }
-  }
-
-   function process_mounts() {
-
-    $clip = "cn=" . $this->cn . ",ou=servers,ou=systems,";
-    $mountsdn = "cn=mounts," . substr($this->dn, strlen($clip));
-
-    $mounts = array(
-      "objectClass" => "container",
-      "cn" => "mounts"
-    );
-
-    # load data from mounts container
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cat($mountsdn, array('dn'));
-    $attrs = $ldap->fetch();
-
-    # mounts container not present yet, so we create it
-    if (count($attrs) == 0) {
-        $ldap->cd($mountsdn);
-        $ldap->add($mounts);
-        show_ldap_error($ldap->get_error(), sprintf(_("Creating system server/shares (mount container) with dn '%s' failed."),$this->dn)); 
-        new log("modify","server/".get_class($this),$mountsdn,array_keys($mounts),$ldap->get_error());
-    }
-
-    # remove deleted mounts from the container
-    foreach ($this->mounts_to_remove as $entry) {
-      $mount=$this->returnMountEntry($entry);
-      $mountdn = "cn=".$mount["cn"].","."$mountsdn";
-
-      $ldap->cat($mountdn, array('dn'));
-      $attrs = $ldap->fetch();
-
-      if (count($attrs) != 0) {
-        $ldap->rmdir($mountdn);
-        show_ldap_error($ldap->get_error(), sprintf(_("Removing system server/shares (mount container) with dn '%s' failed."),$this->dn)); 
-        new log("remove","server/".get_class($this),$mountdn,array_keys($mount),$ldap->get_error());
-      }
-    }
-
-    # add new mounts to the container
-    foreach ($this->mounts_to_add as $entry) {
-      $mount=$this->returnMountEntry($entry);
-      $mountdn = "cn=".$mount["cn"].","."$mountsdn";
-      $ldap->cd($mountdn);
-      $ldap->add($mount);
-      show_ldap_error($ldap->get_error(), sprintf(_("Saving system server/shares (mount container) with dn '%s' failed."),$this->dn)); 
-      new log("create","server/".get_class($this),$mountdn,array_keys($mount),$ldap->get_error());
-    }
-  }
-
-  function addToMountList($entry) 
-  {
-    if($this->acl_is_writeable("name")){
-      $key =  key($entry);
-      $type = $this->get_share_type($entry[$key]);
-      if (($type == "netatalk") || ($type == "NFS")) {
-        $this->mounts_to_add[$entry[$key]] = $entry[$key];
-        unset($this->mounts_to_remove[$entry[$key]]);
-      }
-    }
-  }
-
-  function deleteFromMountList($entry) 
-  {
-    if($this->acl_is_writeable("name")){
-      $type = $this->get_share_type($entry);
-      if (($type == "netatalk") || ($type == "NFS")) {
-        $this->mounts_to_remove[$entry] = $entry;
-        unset($this->mounts_to_add[$entry]);
-      }
-    }
-  }
-
-  function get_share_type($share) 
-  {
-    $tmp = split("\|", $share);
-    return $tmp[2];
-  }
-
-  function returnMountEntry($entry)
-  {
-    $item = split("\|", $entry);
-    $name = $item[0];
-    $description = $item[1];
-    $type = $item[2];
-    $charset = $item[3];
-    $path = $item[4];
-    $options = $item[5];
-
-    switch ($type) {
-      case "netatalk" : {
-        $mount = array(
-            "mountDirectory" => "/Network/Servers/",
-            "mountOption" => array(
-              "net",
-              "url==afp://;AUTH=NO%20USER%20AUTHENT@".$this->cn."/$name/"
-              ),
-            "mountType" => "url",
-            "objectClass" => "mount",
-            "cn" => $this->cn .":/".$name
-            );
-        break;
-      }
-      case "NFS" : {
-        $mount = array(
-            "mountDirectory" => "/Network/Servers/",
-            "mountOption" => "net",
-            "mountType" => "nfs",
-            "objectClass" => "mount",
-            "cn" => $this->cn .":".$path
-            );
-        break;
-      }
-      default : {
-                  continue;
-                }
-    }
-    return $mount;
-  }
-
-
-  function PrepareForCopyPaste($source)
-  {
-    plugin::PrepareForCopyPaste($source);
-
-    $tmp =array();
-    if(isset($source['goExportEntry'])){
-      if(isset($source['goExportEntry']['count'])){
-        for($i= 0; $i<$source['goExportEntry']['count']; $i++){
-          $entry= $source['goExportEntry'][$i];
-          $tmp[preg_replace('/\|.*$/', '', $entry)]= $entry;
-        }
-      }
-    }
-    $this->goExportEntryList = $tmp;
-    $this->goExportEntry = $tmp;
-  }
-
-
-  /* Return plugin informations for acl handling */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("File service (Shares)"),
-          "plDescription" => _("File service - Shares")." ("._("Services").")",
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 90,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("server"),
-
-          "plProvidedAcls"=> array(
-              "name"        => _("Name"),
-              "netatalkmount" => _("Apple mounts"),
-              "description" => _("Description"),
-              "type"        => _("Type"),
-              "charset"     => _("Charset"),
-              "path"        => _("Path"),
-              "option"      => _("Option"),
-              "volume"      => _("Volume"))
-
-          ));
-  }
-
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_goSpamServer.inc b/plugins/admin/systems/class_goSpamServer.inc
deleted file mode 100644 (file)
index 82ff0fb..0000000
+++ /dev/null
@@ -1,357 +0,0 @@
-<?php
-
-class gospamserver extends goService{
-
-  /* CLI vars */
-  var $cli_summary= "Manage server base objects";
-  var $cli_description= "Some longer text\nfor help";
-  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* This plugin only writes its objectClass */
-  var $objectclasses    = array("goSpamServer");
-  var $attributes       = array("saRewriteHeader","saTrustedNetworks","saRequiredScore","saFlags","saRule");
-  var $StatusFlag       = "saStatus";
-  /* This class can't be assigned twice so it conflicts with itsself */
-  var $conflicts        = array("goSpamServer");
-  var $Flags            = array("B","b","C","R","D","P");
-
-  var $DisplayName      = "";
-  var $dn               = NULL;
-  var $cn               = "";
-  var $saStatus         = "";
-
-  var $saRewriteHeader  = "";
-  var $saTrustedNetworks= array();
-  var $TrustedNetworks  = array();
-  var $saRequiredScore  = 0;
-  var $saFlags          = "";
-  var $Rules            = array();
-  var $saRule           = array();
-
-  var $saFlagsB         = false;
-  var $saFlagsb         = false;
-  var $saFlagsC         = false;
-  var $saFlagsR         = false;
-  var $saFlagsD         = false;
-  var $saFlagsP         = false;
-  var $ui               = NULL;
-  var $acl              = NULL;
-  var $view_logged  =FALSE;
-
-  function gospamserver(&$config,$dn, $parent= NULL)
-  {
-    /* Init class */
-    goService::goService($config,$dn, $parent);
-    $this->DisplayName = _("Spamassassin");
-
-    /* Get userinfo & acls */
-    $this->ui = get_userinfo();
-
-    /* Get Flags */
-    foreach($this->Flags as $flag){
-      $var = "saFlags".$flag;
-      if(preg_match("/".$flag."/",$this->saFlags)){
-        $this->$var = TRUE;
-      }
-    }
-    
-    /* Get trusted networks */
-    $this->TrustedNetworks = array();
-    if(isset($this->attrs['saTrustedNetworks']) && is_array($this->attrs['saTrustedNetworks'])){
-      $var = $this->attrs['saTrustedNetworks'];
-      for($i = 0 ; $i < $var['count'] ; $i ++ ){
-        $var2 = $this->attrs['saTrustedNetworks'][$i];
-        $this->TrustedNetworks[ $var2 ] = $var2; 
-      }
-    }
-
-    /* Get rules */
-    $this->Rules = array();
-    if(isset($this->attrs['saRule']) && is_array($this->attrs['saRule'])){  
-      $var = $this->attrs['saRule'];
-      for($i = 0 ; $i < $var['count'] ; $i ++ ){
-        $var2 = $this->attrs['saRule'][$i];
-        $name = preg_replace("/:.*$/","",$var2);
-        $value= base64_decode(preg_replace("/^.*:/","",$var2));
-        $this->Rules[ $name ] = $value;
-      }
-    }
-  }
-
-
-  function execute()
-  {
-    $display ="";
-    $smarty = get_smarty(); 
-    
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","server/".get_class($this),$this->dn);
-    }
-
-    /* If displayed, it is ever true*/
-    $this->is_account =true;
-
-    /* Get acls */
-    $tmp = $this->plinfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translation){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-
-    /* Add new trusted network */
-    if(isset($_POST['AddNewTrust']) && ($this->acl_is_writeable("saTrustedNetworks"))){
-      $this->AddTrust($_POST['NewTrustName']);
-    }
-  
-    /* Delete selected trusted network */
-    if(isset($_POST['DelTrust']) && ($this->acl_is_writeable("saTrustedNetworks"))){
-      $this->DelTrust($_POST['TrustedNetworks']);
-    }
-
-    /* Add a new rule */
-    if(isset($_POST['AddRule']) && $this->acl_is_writeable("saRule")){
-      $this->dialog = new goSpamServerRule($this->config,$this->dn);
-    }
-  
-    /* Cancel adding/editing specified rule */
-    if(isset($_POST['CancelRule'])){
-      $this->dialog = FALSE;
-    }
-
-    /* Handle post to delete rules */
-    $once = true;
-    foreach($_POST as $name => $value){
-      if(preg_match("/^editRule_/",$name) && $once && $this->acl_is_readable("saRule")){
-        $once = false;
-        $entry = preg_replace("/^editRule_/","",$name);
-        $entry = preg_replace("/_(x|y)$/","",$entry);
-        $rule = $this->Rules[$entry];
-        $name = $entry;
-        $this->dialog = new goSpamServerRule($this->config,$this->dn,$name,$rule);
-      }
-      if(preg_match("/^delRule_/",$name) && $once && $this->acl_is_writeable("saRule")){
-        $once = false;
-        $entry = preg_replace("/^delRule_/","",$name);
-        $entry = preg_replace("/_(x|y)$/","",$entry);
-        unset($this->Rules[$entry]);
-      }
-    }
-
-    /* Save rules */
-    if(isset($_POST['SaveRule'])){
-      $this->dialog->save_object();
-      $msgs = $this->dialog->check();
-      if(count($msgs)){
-        foreach($msgs as $msg){
-          print_red($msg);
-        }
-      }elseif($this->acl_is_writeable("saRule")){
-        $ret = $this->dialog->save();
-        if((!empty($ret['orig_name'])) && isset($this->Rules[$ret['orig_name']])){
-          unset($this->Rules[$ret['orig_name']]);
-        }
-        $this->Rules[$ret['name']] = $ret['rule'];
-        $this->dialog = FALSE;
-      }
-    }
-   
-    /* Display dialog if available */ 
-    if($this->dialog && $this->dialog->config){
-      $this->dialog->save_object();
-      return($this->dialog->execute());
-    }
-
-    /* Assign smarty vars */
-    foreach($this->attributes as $attr){
-      $smarty->assign($attr,$this->$attr);
-    }
-
-    /* Assign checkbox states */
-    foreach($this->Flags as $Flag){
-      $var = "saFlags".$Flag;
-      $smarty->assign("saFlags".$Flag."ACL", $this->getacl($Flag));
-      if($this->$var){
-        $smarty->assign("saFlags".$Flag."CHK"," checked " );
-      }else{
-        $smarty->assign("saFlags".$Flag."CHK","");
-      }
-    }
-
-    /* Create divlist */
-    $DivRules = new divSelectBox("SpamRules");
-    $DivRules->SetHeight(130);
-
-    if($this->acl_is_writeable("saTrustedNetworks")){
-      $actions = "";
-    }else{
-    
-      $actions = "<input type='image' src='images/edit.png'      name='editRule_%s'>";
-      if($this->acl_is_writeable("saRule")){
-        $actions.= "<input type='image' src='images/edittrash.png' name='delRule_%s'>";
-      }
-    }
-
-    foreach($this->Rules as $key => $net){
-      $field1 = array("string" => $key );
-      $field2 = array("string" => sprintf($actions,$key,$key) , "attach" => "style='border-right:0px;width:36px;'");
-      $DivRules->AddEntry(array($field1,$field2));
-    }
-    $smarty->assign("divRules",$DivRules->DrawList()); 
-    $smarty->assign("TrustedNetworks",$this->TrustedNetworks); 
-
-    /* Create Spam score select box entries */
-    $tmp = array();
-    for($i = 0 ; $i <= 20 ; $i ++ ){
-      $tmp[$i] = $i;
-    }
-    $smarty->assign("SpamScore",$tmp);
-
-    return($display.$smarty->fetch(get_template_path("goSpamServer.tpl",TRUE,dirname(__FILE__))));
-  }
-
-
-  /* Add $post to list of configured trusted */
-  function AddTrust($post)
-  {
-    if(!empty($post)){
-      if(is_ip($post) || is_domain($post) || (is_ip_with_subnetmask($post))){
-        $this->TrustedNetworks[$post] = $post;
-      }else{
-        print_red(_("Specified value is not a valid 'trusted network' value."));
-      }
-    }
-  }
-
-
-  /* Delete trusted network */
-  function DelTrust($posts)
-  {
-    foreach($posts as $post){
-      if(isset($this->TrustedNetworks[$post])){
-        unset($this->TrustedNetworks[$post]);     
-      }
-    }
-  }
-
-  function save()
-  {
-    if(!$this->is_account) return;
-    plugin::save();
-
-    /* Create Flags */     
-    $this->attrs['saFlags'] = array();
-    foreach($this->Flags as $flag){
-      $var = "saFlags".$flag;
-      if($this->$var){
-        $this->attrs['saFlags'].=$flag;
-      }
-    }
-
-    /* Create trusted network entries */
-    $this->attrs['saTrustedNetworks'] = array();
-    foreach($this->TrustedNetworks as $net){
-      $this->attrs['saTrustedNetworks'][] = $net; 
-    }    
-
-    /* Rules */
-    $this->attrs['saRule'] = array();
-    foreach($this->Rules as $name => $rule){
-      $this->attrs['saRule'][] = $name.":".base64_encode($rule);
-    }
-
-    /* Check if this is a new entry ... add/modify */
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cat($this->dn,array("objectClass"));
-    if($ldap->count()){
-      $ldap->cd($this->dn);
-      $ldap->modify($this->attrs);
-    }else{
-      $ldap->cd($this->dn);
-      $ldap->add($this->attrs);
-    }
-    if($this->initially_was_account){
-      $this->handle_post_events("modify");
-      new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }else{
-      $this->handle_post_events("add");
-      new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }
-
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of server services/spamassassin with dn '%s' failed."),$this->dn));
-  }
-
-  function check()
-  { 
-    $message = plugin::check();
-
-    /* Check if required score is numeric */
-    if(!is_numeric($this->saRequiredScore)){
-      $message[] = _("Required score must be a numeric value.");
-    }
-
-    return($message);
-  }
-  
-
-  function save_object()
-  {
-    if(isset($_POST['goSpamServer'])){
-
-      plugin::save_object();
-
-      /* Check flags */
-      foreach($this->Flags as $flag){
-        $var = "saFlags".$flag;
-
-        if($this->acl_is_writeable($var)){
-          if(isset($_POST[$var])){
-            $this->$var = TRUE;
-          }else{
-            $this->$var = FALSE;
-          }
-        }
-      }
-    }    
-  }  
-
-  
-  /* Return plugin informations for acl handling  */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("Spamassassin"),
-          "plDescription" => _("Spamassassin")." ("._("Services").")",
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 89,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("server"),
-          "plProvidedAcls"=> array(
-
-            "saRewriteHeader"   => _("Rewrite header"),
-            "saTrustedNetworks" => _("Trusted networks"),
-            "saRequiredScore"   => _("Required score"),
-            "saRule"            => _("Rules"),
-
-            "saFlagB"           => _("Enable use of bayes filtering"),
-            "saFlagb"           => _("Enabled bayes auto learning"),
-            "saFlagC"           => _("Enable RBL checks"),
-            "saFlagR"           => _("Enable use of Razor"),
-            "saFlagD"           => _("Enable use of DDC"),
-            "saFlagP"           => _("Enable use of Pyzor"))
-          ));
-  }
-
-  /* For newer service management dialogs */
-  function getListEntry()
-  {
-    $fields                 = goService::getListEntry();
-    $fields['Message']      = _("Spamassassin");
-    $fields['AllowEdit']    = true;
-    return($fields);
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_goSpamServerRule.inc b/plugins/admin/systems/class_goSpamServerRule.inc
deleted file mode 100644 (file)
index c8eed5d..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php
-class goSpamServerRule extends plugin {
-
-       var $attributes = array("name","rule");
-       var $name = "";
-       var $rule = "";
-       
-       var $orig_name = "";
-  var $view_logged  =FALSE;
-       
-       function goSpamServerRule(&$config,$dn,$name = "",$rule ="")
-       {
-               plugin::plugin($config,$dn);
-               $this->name = $this->orig_name= $name;
-               $this->rule = $rule;
-       }
-
-
-       function execute()
-       {
-               $smarty = get_smarty();
-
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","server/".get_class($this),$this->dn);
-    }
-
-               foreach($this->attributes as $attr){
-                       $smarty->assign($attr,$this->$attr);
-               }
-               return($smarty->fetch(get_template_path("goSpamServerRule.tpl",TRUE,dirname(__FILE__))));                       
-       }
-
-       function save_object()
-       {
-               plugin::save_object();
-               foreach($this->attributes as $attr){
-                       if(isset($_POST[$attr])){
-                               $this->$attr = $_POST[$attr];
-                       }
-               }
-       }
-
-
-       function save()
-       {
-               $ret =array();
-               $ret['orig_name'] = $this->orig_name;
-               $ret['name'] = $this->name;
-               $ret['rule'] = $this->rule;
-               return($ret);
-       }
-       
-       function check()
-       {
-               $messages = plugin::check();
-               return($messages);
-       }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_goSyslogServer.inc b/plugins/admin/systems/class_goSyslogServer.inc
deleted file mode 100644 (file)
index 9461977..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-<?php
-
-class goSyslogServer extends goService{
-       
-  var $cli_summary      = "This plugin is used within the ServerService Pluign \nand indicates that this server has syslog server enabled.";
-  var $cli_description  = "Some longer text\nfor help";
-  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* This plugin only writes its objectClass */
-  var $objectclasses    = array("goSyslogServer");
-  var $attributes       = array();
-  var $StatusFlag       = "goSyslogServerStatus";
-  /* This class can't be assigned twice so it conflicts with itsself */
-  var $conflicts        = array("goSyslogServer");
-
-  var $DisplayName      = "";
-  var $dn               = NULL;
-  var $acl;
-  var $cn                    = "";
-  var $goSyslogServerStatus  = "";
-  var $view_logged  =FALSE;
-  function goSyslogServer(&$config,$dn)
-  {
-    goService::goService($config,$dn);
-    $this->DisplayName = _("Syslog server");
-  }
-
-
-  function execute()
-  { 
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","server/".get_class($this),$this->dn);
-    }
-
-
-    $smarty = get_smarty(); 
-    return($smarty->fetch(get_template_path("goSyslogServer.tpl",TRUE,dirname(__FILE__))));
-  }
-
-
-  function getListEntry()
-  {
-    $fields               = goService::getListEntry();
-    $fields['Message']    = _("Syslog server");
-    $fields['AllowEdit']  = false;
-    return($fields);
-  }
-
-  function check()
-  { 
-    $message = plugin::check();
-    return($message);
-  }
-
-
-  function save_object()
-  {
-    plugin::save_object();
-  } 
-
-  /* Return plugin informations for acl handling */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("Logging service"),
-          "plDescription" => _("Logging service")." ("._("Services").")",
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 88,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("server"),
-
-          "plProvidedAcls"=> array()
-          ));
-  }
-
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_goTerminalServer.inc b/plugins/admin/systems/class_goTerminalServer.inc
deleted file mode 100644 (file)
index e832de0..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-<?php
-
-class goTerminalServer extends goService{
-       
-  var $cli_summary      = "This pluign is used within the ServerService Pluign \nand indicates that this server supports asterisk management.";
-  var $cli_description  = "Some longer text\nfor help";
-  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* This plugin only writes its objectClass */
-  var $objectclasses    = array("goTerminalServer");
-  var $attributes       = array("goXdmcpIsEnabled", "goFontPath");
-  var $StatusFlag       = "goTerminalServerStatus";
-  /* This class can't be assigned twice so it conflicts with itsself */
-  var $conflicts        = array("goTerminalServer");
-
-  var $DisplayName      = "";
-  var $dn               = NULL;
-  var $acl;
-  var $cn                      = "";
-  var $goTerminalServerStatus  = "";
-  var $goXdmcpIsEnabled        = false;  
-  var $goFontPath              = "";
-  var $view_logged  =FALSE;
-
-
-  function goTerminalServer(&$config,$dn)
-  {
-    goService::goService($config,$dn);
-    $this->DisplayName = _("Terminal service");
-  }
-
-
-  function execute()
-  { 
-    $smarty = get_smarty();
-
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","server/".get_class($this),$this->dn);
-    }
-
-  
-    $tmp = $this->plinfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translation){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-
-    foreach($this->attributes as $attr){
-      $smarty->assign($attr,$this->$attr);
-    }
-    return($smarty->fetch(get_template_path("goTerminalServer.tpl",TRUE,dirname(__FILE__))));
-  }
-
-
-  function getListEntry()
-  {
-    $fields               = goService::getListEntry();
-    $fields['Message']    = _("Terminal service");
-    $fields['AllowEdit']  = true;
-    return($fields);
-  }
-
-
-  function save()
-  {
-    plugin::save();
-
-    if(!$this->goXdmcpIsEnabled){
-      $this->attrs['goXdmcpIsEnabled'] = "0";
-    }
-
-    /* Check if this is a new entry ... add/modify */
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cat($this->dn,array("objectClass"));
-    if($ldap->count()){
-      $ldap->cd($this->dn);
-      $ldap->modify($this->attrs);
-    }else{
-      $ldap->cd($this->dn);
-      $ldap->add($this->attrs);
-    }
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving server services/terminalServer with dn '%s' failed."),$this->dn));
-    if($this->initially_was_account){
-      $this->handle_post_events("modify");
-      new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }else{
-      $this->handle_post_events("add");
-      new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }
-  }
-
-
-  function check()
-  { 
-    $message = plugin::check();
-    if(empty($this->goFontPath)){
-      $message[]=_("Terminal server, must have fontpath specified.");
-    }
-
-    return($message);
-  }
-
-
-  function save_object()
-  {
-    if(isset($_POST['goTerminalServerPosted'])){
-      plugin::save_object();
-      if($this->acl_is_writeable("goXdmcpIsEnabled")){
-        if(isset($_POST['goXdmcpIsEnabled'])){
-          $this->goXdmcpIsEnabled = true;
-        }else{
-          $this->goXdmcpIsEnabled = false;
-        }
-      }
-    }
-  } 
-
-
-  /* Return plugin informations for acl handling */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("Terminal service"),
-          "plDescription" => _("Terminal service")." ("._("Services").")",
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 87,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("server"),
-
-          "plProvidedAcls"=> array(
-            "goXdmcpIsEnabled"  => _("Temporary disable login"),
-            "goFontPath"        => _("Font path"))
-          ));
-  }
-
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_goVirusServer.inc b/plugins/admin/systems/class_goVirusServer.inc
deleted file mode 100644 (file)
index f91c5f5..0000000
+++ /dev/null
@@ -1,248 +0,0 @@
-<?php
-
-class govirusserver extends goService{
-       
-  /* This plugin only writes its objectClass */
-  var $objectclasses    = array("goVirusServer");
-  var $attributes       = array("avMaxThreads","avMaxDirectoryRecursions","avUser","avFlags","avArchiveMaxFileSize","avArchiveMaxRecursion",
-                                "avArchiveMaxCompressionRatio","avDatabaseMirror","avChecksPerDay","avHttpProxyURL");
-  var $StatusFlag       = "avStatus";
-  /* This class can't be assigned twice so it conflicts with itsself */
-  var $conflicts        = array("goVirusServer");
-
-  var $DisplayName      = "";
-  var $dn               = NULL;
-  var $cn               = "";
-  var $avStatus         = "";
-
-  var $ui               = NULL;
-
-  var $Flags            = array("D","S","A","E");
-  
-  var $avFlags          = "DS";
-  var $avFlagsD         = TRUE;
-  var $avFlagsS         = TRUE;
-  var $avFlagsA         = FALSE;
-  var $avFlagsE         = FALSE;
-
-  var $avMaxThreads                 = 5;
-  var $avMaxDirectoryRecursions     = 4;    
-  var $avArchiveMaxFileSize         = 4000;
-  var $avArchiveMaxRecursion        = 5;
-  var $avArchiveMaxCompressionRatio = 95;
-  var $avChecksPerDay               = 12;
-
-  var $avUser                       = "";
-  var $avHttpProxyURL               = "";
-  var $avDatabaseMirror             = "";
-  var $view_logged  =FALSE;
-
-  function govirusserver(&$config,$dn, $parent= NULL)
-  {
-    /* Init class */
-    goService::goService($config,$dn, $parent);
-    $this->DisplayName = _("Anti virus");
-
-    /* Get userinfo & acls */
-    $this->ui = get_userinfo();
-
-    /* Get Flags */
-    foreach($this->Flags as $flag){
-      $var = "avFlags".$flag;
-      if(preg_match("/".$flag."/",$this->avFlags)){
-        $this->$var = TRUE;
-      }
-    }
-  }
-
-
-  function execute()
-  {
-    $smarty = get_smarty(); 
-
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","server/".get_class($this),$this->dn);
-    }
-
-
-    /* Set acls */
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translation) { 
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-
-    $display = "";
-    $smarty->assign("servtabs",FALSE);
-    $this->is_account = true;
-
-    /* Assign smarty vars */
-    foreach($this->attributes as $attr){
-      $smarty->assign($attr,$this->$attr);
-    }
-
-    /* Assign checkbox states */
-    foreach($this->Flags as $Flag){
-      $var = "avFlags".$Flag;
-      if($this->$var){
-        $smarty->assign("avFlags".$Flag."CHK"," checked " );
-      }else{
-        $smarty->assign("avFlags".$Flag."CHK","");
-      }
-    }
-
-    /* Assign value for max thread select box */
-    $tmp = array();
-    for($i = 1 ; $i <= 20 ; $i ++){
-      $tmp[$i] = $i;
-    }
-    $smarty->assign("ThreadValues",$tmp);
-
-    if($this->avFlagsA){
-      $smarty->assign("avFlagsAState" , "" );
-    }else{
-      $smarty->assign("avFlagsAState" , " disabled " );
-    }
-
-    return($display.$smarty->fetch(get_template_path("goVirusServer.tpl",TRUE,dirname(__FILE__))));
-  }
-
-
-  function save()
-  {
-    if(!$this->is_account) return;
-
-    /* Create Flags */     
-    $this->avFlags = "";
-    foreach($this->Flags as $flag){
-      $var = "avFlags".$flag;
-      if($this->$var){
-        $this->avFlags .=$flag;
-      }
-    }
-
-    plugin::save();
-
-    if(!$this->avFlagsA){
-      $arr = array("avArchiveMaxFileSize","avArchiveMaxRecursion","avArchiveMaxCompressionRatio");
-      foreach($arr as $attr){
-        $this->attrs[$attr] =  array();
-      }
-      $this->attrs['avFlags'] = preg_replace("/E/","",$this->attrs['avFlags']);
-    }
-
-    /* Check if this is a new entry ... add/modify */
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cat($this->dn,array("objectClass"));
-    if($ldap->count()){
-      $ldap->cd($this->dn);
-      $ldap->modify($this->attrs);
-    }else{
-      $ldap->cd($this->dn);
-      $ldap->add($this->attrs);
-    }
-    if($this->initially_was_account){
-      $this->handle_post_events("modify");
-      new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }else{
-      $this->handle_post_events("add");
-      new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }
-
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of server services/anti virus with dn '%s' failed."),$this->dn));
-  }
-
-  function check()
-  { 
-    $message = plugin::check();
-
-    $mustBeNumeric = array(
-          "avMaxDirectoryRecursions"     =>_("Maximum directory recursions"),
-          "avMaxThreads"                 =>_("Maximum threads"),
-          "avArchiveMaxFileSize"         =>_("Maximum file size"),
-          "avArchiveMaxRecursion"        =>_("Maximum recursions"),
-          "avArchiveMaxCompressionRatio" =>_("Maximum compression ratio"),
-          "avChecksPerDay"               =>_("Checks per day"));
-
-    foreach($mustBeNumeric as $key => $trans){
-      if(!is_numeric($this->$key)){
-        $message[] = sprintf(_("The specified value for '%s' must be a numeric value."),$trans);
-      }
-    }
-
-    foreach(array("avUser"=>_("Database user"),"avHttpProxyURL"=>_("Http proxy URL"),"avDatabaseMirror"=>_("Database mirror")) as $attr => $name){
-      if(!preg_match("/^[a-z0-9:_\-\.\/]*$/",$this->$attr)){
-        $message[] = sprintf(_("Please specify a valid value for '%s'."),$name);
-      }
-    }
-  
-    return($message);
-  }
-  
-
-  function save_object()
-  {
-    if(isset($_POST['goVirusServer'])){
-      plugin::save_object();
-      foreach($this->Flags as $flag){
-
-        $var = "avFlags".$flag;
-        if($this->acl_is_writeable($var)){
-          if(isset($_POST[$var])){
-            $this->$var = TRUE;
-          }else{
-            $this->$var = FALSE;
-          }
-        }
-      }
-    }    
-  }  
-  
-
-  /* For newer service management dialogs */
-  function getListEntry()
-  {
-    $fields       = goService::getListEntry();
-    $fields['AllowEdit']    = true;
-    $fields['Message']      = _("Anti virus");
-    return($fields);
-  }
-
-
-  /* Return plugin informations for acl handling */ 
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("Anti virus"),
-          "plDescription" => _("Anti virus")." ("._("Services").")",
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 96,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("server"),
-          "plProvidedAcls"=> array(
-
-          "start"         => _("Start"),
-          "stop"          => _("Stop"),
-          "restart"       => _("Restart"),
-
-          "avFlagsD"         =>_("Enable debugging"),
-          "avFlagsS"         =>_("Enable mail scanning"),
-          "avFlagsA"         =>_("Enable scanning of archives"),
-          "avFlagsE"         =>_("Block encrypted archives"),
-
-          "avMaxThreads"                 =>_("Maximum threads"),
-          "avMaxDirectoryRecursions"     =>_("Maximum directory recursions"),
-          "avUser"                       =>_("Anti virus user"),
-          "avArchiveMaxFileSize"         =>_("Maximum file size"),
-          "avArchiveMaxRecursion"        =>_("Maximum recursions"),
-          "avArchiveMaxCompressionRatio" =>_("Maximum compression ratio"),
-          "avDatabaseMirror"             =>_("Database mirror"),
-          "avChecksPerDay"               =>_("Checks per day"),
-          "avHttpProxyURL"               =>_("Http proxy URL"))
-          ));
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_gosaLogServer.inc b/plugins/admin/systems/class_gosaLogServer.inc
deleted file mode 100644 (file)
index cade0e2..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-<?php
-
-class gosaLogServer extends goService{
-       
-  /* This plugin only writes its objectClass */
-  var $objectclasses    = array("gosaLogServer");
-  var $attributes       = array("goLogDB","goLogDBUser","goLogDBPassword");
-  var $StatusFlag       = "";
-
-  /* This class can't be assigned twice so it conflicts with itsself */
-  var $conflicts        = array("gosaLogServer");
-
-  var $DisplayName      = "";
-  var $dn               = NULL;
-  var $acl;
-  var $cn                 = "";
-  var $goLogDBServerStatus= "";
-  var $goLogDBUser        = "";
-  var $goLogDBPassword    = "";  
-  var $goLogDB            = "";  
-  var $view_logged  =FALSE;
-
-
-  function gosaLogServer(&$config,$dn)
-  {
-    goService::goService($config,$dn);
-    $this->DisplayName = _("GOsa MySQL logging service");
-  }
-
-
-  function execute()
-  { 
-    $smarty = get_smarty(); 
-
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","server/".get_class($this),$this->dn);
-    }
-
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translation){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-
-    foreach($this->attributes as $attr){
-      $smarty->assign($attr,$this->$attr);
-    }
-    return($smarty->fetch(get_template_path("gosaLogServer.tpl",TRUE,dirname(__FILE__))));
-  }
-
-
-  function getListEntry()
-  {
-    $fields = goService::getListEntry();
-    $fields['Message']      = _("GOsa MySQL logging service");
-    $fields['AllowEdit']    = true;
-    $fields['AllowStart']   = FALSE;
-    $fields['AllowStop']    = FALSE;
-    $fields['AllowRestart'] = FALSE;
-    return($fields);
-  }
-
-
-  function check()
-  { 
-    $message = plugin::check();
-    if (empty($this->goLogDBUser)){
-      $message[]= sprintf_("The attribute user is empty or contains invalid characters.");
-    }
-    if (empty($this->goLogDBPassword)){
-      $message[]= sprintf_("The attribute password is empty or contains invalid characters.");
-    }
-    if (empty($this->goLogDB)){
-      $message[]= sprintf_("The attribute database is empty or contains invalid characters.");
-    }
-    return($message);
-  }
-
-
-  function save_object()
-  {
-    if(isset($_POST['gosaLogServerPosted'])){
-      plugin::save_object();
-    }
-  } 
-
-  /* Return plugin informations for acl handling */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("GOsa logging service"),
-          "plDescription" => _("GOsa logging service")." ("._("Services").")",
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 98,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("server"),
-
-          "plProvidedAcls"=> array(
-            "goLogDB"         => _("Database"),
-            "goLogDBUser"     => _("User"),
-            "goLogDBPassword" => _("Password"), 
-            "viewEntries"    => _("Allow view of entries on this server")) 
-          ));
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_printerPPDDialog.inc b/plugins/admin/systems/class_printerPPDDialog.inc
deleted file mode 100644 (file)
index a93e91b..0000000
+++ /dev/null
@@ -1,546 +0,0 @@
-<?php
-
-class printerPPDDialog 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("cn");
-  var $objectclasses        = array("whatever");
-
-  /* PPD Handling */
-  var $selectedPPD          = false;        // e.g. /vendor/device.ppd 
-  var $ppdManager           = false;        // new ppdManager;
-  var $ppdConfig            = false;        // $this->ppdManager->loadProperties($this->selectedPPD['link']);
-  var $ppdList              = array();      // Contains all Printer models
-  var $ppdListHeader        = array();      // Contains all printer vendors
-
-  /* Paths */
-  var $pathToPPD            = "";           // Base path, defined in gosa.conf e.g. "/var/spool/ppd/"
-  var $pathToModified       = "modified/";  // used to store the modified ppds  
-      
-  /* Object Info */
-  var $cn                   = "" ;          // Used to tag the ppds modified by the printer object, 
-
-  /* If there is already a ppd file for the same type of printer, 
-   *  remember the path to ppd file and display a dialog which allows 
-   *  to overwrite the current ppd file. 
-   */
-  var $add_ppd_later            = "";
-  var $add_later_msg_dialog     = NULL;
-
-  function printerPPDDialog (&$config, $dn= NULL, $ppdfile=NULL )
-  {
-    plugin::plugin ($config, $dn);
-    $this->depselect = $this->config->current['BASE'];
-
-    /* Get PPD path and remove double //, and add trailing /  */
-    if(isset($_SESSION['config']->data['MAIN']['PPD_PATH'])){
-      $this->pathToPPD = $_SESSION['config']->data['MAIN']['PPD_PATH'];
-      $this->pathToPPD= preg_replace("/\/\//", "/", $this->pathToPPD);
-      if(!preg_match("/\/$/",$this->pathToPPD)){
-        $this->pathToPPD = $this->pathToPPD."/";
-      }
-    }else{
-      $this->pathToPPD = "";
-    }
-
-    /* It seams that we have an existing PPD path, so go on */
-    if(!((!is_dir($this->pathToPPD))||(empty($this->pathToPPD)))){ 
-
-      /* Load all available PPD files and sort them into an array */
-      $this->ppdManager= new ppdManager($this->pathToPPD);
-      $this->getPrinterReload ();
-
-      /* The user has already a valid PPD assigned
-       * Get some informations about this PPD
-       * and set it as selected. 
-       * The ppdpath ['link'] should be relative from .../ppd/modified/ 
-       *     e.g. "/Compaq/Compaq-J1200.ppd" */
-      if(($ppdfile!== NULL)&&(strlen($ppdfile)>0)){
-        $ppdfile = preg_replace("#".$this->pathToModified."#","",$ppdfile);
-        if(!file_exists($this->pathToPPD.$this->pathToModified.$ppdfile)){
-          print_red(sprintf(_("Can't open '%s', ppd settings resetted."),$ppdfile));
-        }else{
-          $res  = $this->ppdManager->loadDescription($this->pathToPPD.$this->pathToModified.$ppdfile);
-          if($res){
-            $tmp = split("\n",$res);
-            $tmp3 = array(); 
-            $tmp3['name']   = trim(preg_replace("/^\-/","",trim($tmp[1])));
-            $tmp3['link']   = $ppdfile;
-            $tmp3['ppd']    = $res;
-          }    
-          $this->selectedPPD = $tmp3;
-        }
-      }
-    }
-  }
-
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* Fill templating stuff */
-    $display= "";
-    $smarty= get_smarty();
-    $smarty->assign("ppdString", _("Can't get ppd informations."));
-    $smarty->assign("showOptions", "");
-
-    /* Check these paths */
-    $paths = array($this->pathToPPD, $this->pathToPPD.$this->pathToModified);
-
-    /* If one of our required paths is not available, stop here and display some info */
-    foreach($paths as $path){
-    
-      /* Check if path is write/readable*/
-      $is_r = @is_readable($path);  
-      if(((!is_dir($path))||(empty($path)) || (!$is_r)) && (!@mkdir($path))){
-        print_red(sprintf(_("The specified path '%s' which results from PPD_PATH in your gosa.conf is invalid, can't read/write any ppd informations."),$path));
-        /* Print out template */
-        $display.= $smarty->fetch(get_template_path('printerPPDDialog.tpl', TRUE,dirname(__FILE__)));
-        return($display);
-      }
-    }
-
-    // PPD selection / upload / dialog handling 
-
-    /* Is there a new PPD file uploaded ? */
-    if((isset($_FILES['NewPPDFile']))&&(isset($_POST['SubmitNewPPDFile']))){
-      $file = ($_FILES['NewPPDFile']);
-      if($file['size'] != 0 ){
-        if($name = $this->AddPPD($file['tmp_name'])){
-          $this->SelectPPD($name); 
-        }
-      }else{
-        print_red(_("Please specify a valid ppd file."));
-      }
-    }
-
-    /* Overwrite existing PPD file and select it as currently used for this object */
-    if(is_object($this->add_later_msg_dialog) && ($this->add_later_msg_dialog->is_confirmed()) && $this->add_ppd_later != ""){
-      if($name = $this->AddPPD($this->add_ppd_later,TRUE)){
-        $this->SelectPPD($name);
-      }
-      $this->add_ppd_later = "";
-      $this->add_later_msg_dialog = NULL;
-    } 
-
-    /* Open a dialog that allow us to select different PPDs */
-    if(isset($_POST['SelectPPD'])){
-      $this->dialog= new printerPPDSelectionDialog($this->config,$this->dn,$this->ppdList,$this->ppdListHeader,$this->selectedPPD);
-    }
-
-    /* The selection dialog fpr PPDs is canceled */
-    if(isset($_POST['ClosePPDSelection'])){
-      unset($this->dialog);
-      $this->dialog=FALSE;
-    }
-
-    /* Div Selection */ 
-    if((isset($_GET['act']))&&($_GET['act']=="use")){
-      $this->SelectPPD(base64_decode($_GET['id']));
-      unset($this->dialog);
-      $this->dialog=FALSE;
-
-    }
-
-    /* if a dialog is open, print the dialog instead of this class */
-    if(is_object($this->dialog)){
-      $display = $this->dialog->execute();
-      return($display);
-    }
-
-    // ENDE  PPD selection / upload / dialog handling 
-
-    /* Give smarty the information it needs */
-    $smarty->assign("ppdString" ,$this->getPPDInformation());
-    $tmp= $this->generateProperties();
-    if ($tmp == ""){
-      $smarty->assign("showOptions", 0);
-    } else {
-      $smarty->assign("showOptions", 1);
-      $smarty->assign("properties",$this->generateProperties());
-    }
-
-    /* Print out template */
-    $display.= $smarty->fetch(get_template_path('printerPPDDialog.tpl', TRUE,dirname(__FILE__)));
-    return($display);
-  }
-
-
-  /* Select PPD */
-  function SelectPPD($name)
-  {
-    /* Replace base path we don't need it here 
-       The path we need looks like this : "/Vendor/ModellName.ppd"; 
-       thats all */
-    $name = preg_replace("#".$this->pathToPPD."#","",$name);
-
-    /* Intialise some base vars */
-    $AbsoluteSourceName       = $this->pathToPPD.$name;   
-    $AbsoluteDestinationPath  = $this->pathToPPD.$this->pathToModified;
-    $Vendor                   = ""; // Vendor 
-    $Name                     = ""; // Name 
-    $Modell                   = ""; // Modell
-    $PrinterName              = ""; // The new name of the printer 
-    $PPDName                  = "";
-    /* Force reload of config dialog */ 
-    $this->ppdConfig            = false;
-    $this->selectedPPD['link']  = false;
-
-    /* Get PPD informations and set vendor / modell / name */ 
-    if((!file_exists($AbsoluteSourceName)) || (!is_readable($AbsoluteSourceName))){
-      print_red(sprintf(_("Can't select PPD file '%s', the file is not readable"),$AbsoluteSourceName));   
-      return;
-    }
-    $res  = $this->ppdManager->loadDescription($AbsoluteSourceName);
-    if($res){
-      $tmp = split("\n",$res);
-      $Name   = trim(preg_replace("/^\-/","",trim($tmp[1])));
-      $Vendor = trim($tmp[0]);
-      $Model  = trim(preg_replace("/".$Vendor."/","",$Name));
-    }    
-
-    $PrinterName  = $this->cn."-".preg_replace("/[^a-z0-9-_\.]/i","_",$Name);
-    $PPDName      = $Vendor."/".$PrinterName.".ppd";
-    
-    /* Create the vendors path, if it doesn't exists already */
-    if(!is_dir($AbsoluteDestinationPath.$Vendor)){
-      if(!(@mkdir($AbsoluteDestinationPath.$Vendor))){
-        print_red(sprintf(_("Can't create folder '%s' for the uploaded ppd file."),$AbsoluteDestinationPath.$Vendor));
-        return(false);
-      }
-    }
-
-    /* Create destination file handle */
-    $fp = @fopen($AbsoluteDestinationPath.$PPDName,"w+");
-    if(!$fp){
-      print_red(sprintf(_("Can't create file '%s' to store modifed ppd informations."),$AbsoluteDestinationPath.$PPDName));
-      return(false);
-    }
-
-    $str = file_get_contents($AbsoluteSourceName);
-    fputs($fp,$str);
-    @fclose($fp);
-
-    //$this->ppdManager->updateAttribute($filename,"NO_SECTION","ModelName",$printerName);
-
-    $tmp3['link']   =$PPDName;
-    $this->selectedPPD = $tmp3;
-    $this->getPrinterReload(); 
-    return($PPDName);
-  }
-
-
-  /* This function adds a new ppd file to the list of available ppds. 
-     All required paths and files will be created 
-      $_PathOnHdd e.g. = /tmp/PHP_tmpfile213452 */
-  function AddPPD($_PathOnHdd,$overwrite = FALSE)
-  {
-    /* Check if file exists && is readable */
-    if((!is_file($_PathOnHdd)) || (!is_readable($_PathOnHdd))){
-      print_red(sprintf(_("Can't add new ppd file, the source file '%s' is not accessible."),$_PathOnHdd));
-      return(false);
-    }
-    
-    /* Reload list to detect changes e.g. a file has been deleted */
-    $this->getPrinterReload();
-
-    /* Get Description from ppd, & parse out some informations */   
-    $res  = @$this->ppdManager->loadDescription($_PathOnHdd);
-    if($res){
-      $tmp = split("\n",$res);
-      $name   = trim(preg_replace("/^\-/","",trim($tmp[1])));
-      $vendor = trim($tmp[0]);
-      $model  = trim(preg_replace("/".$vendor."/","",$name));
-    }    
-
-    /* Check if parse was successfull */
-    if(empty($name) || empty($vendor)){
-      print_red(sprintf(_("The given ppd file '%s' seams to be invalid, can't get any model or vendor informations."),$_PathOnHdd));
-      return(false);
-    }
-
-    /* Prepare list of ppds */
-    if(!isset($this->ppdList[$vendor])){
-      $this->ppdList[$vendor] = array();
-    }
-
-    /* Create ppd file and fill in the source contents */
-    $ppdname      = $vendor."/".$name.".ppd";
-    $filename     = $this->pathToPPD.preg_replace("/[^a-z0-9-_\.\/]/i","_",$ppdname);
-    $filename     = $this->pathToPPD.$ppdname;
-    $contents     = file_get_contents($_PathOnHdd);
-
-
-    /* Check if this ppd already exists */
-    $found = false;
-    foreach($this->ppdList[$vendor] as $key => $val){
-      if(preg_match("/".$model.".*/i",$key)){
-        $found = true;
-        if(!$overwrite){
-          if(!copy($_PathOnHdd,$_PathOnHdd."_back")){
-            print_red(sprintf(_("Can't add new ppd file, the source file '%s' is not accessible."),$_PathOnHdd));         
-          }else{
-            $this->add_ppd_later = $_PathOnHdd."_back";
-            $this->add_later_msg_dialog = new msg_dialog(_("Overwrite existing PPD"),
-                _("There is already a ppd file for this kind of printer. Do you want to overwrite it?"),CONFIRM_DIALOG);
-          }
-          return;
-        }
-      }
-    }
-
-    /* Create the vendors path, if it doesn't exists already */
-    if(!is_dir($this->pathToPPD.$vendor)){
-      if(!(@mkdir($this->pathToPPD.$vendor))){
-        print_red(sprintf(_("Can't create folder '%s' for the uploaded ppd file."),$this->pathToPPD.$vendor));
-        return(false);
-      }
-    }
-  
-    /* Open file handle */
-    $fp           = fopen($filename,"w+");
-
-    /* Check file handle & contents */
-    if(!$fp){
-      print_red(sprintf(_("Can't save file '%s'."),$filename));
-      return;
-    }
-    if(empty($contents)){
-      print_red(_("Uploaded ppd file is empty, can't create new ppd file."));
-      return;
-    }
-    
-    /* Fille file with data */
-    fputs($fp,$contents);
-    @fclose($fp);
-
-    /* Our job is done here */
-    return($ppdname);
-  }
-
-
-  /* This function reloads the list of available printers/vendors 
-     $this->ppdListHeader 
-     Compaq        => 1
-     $this->ppdList
-     Compaq => Compaq IJ1200 => name => Compaq IJ1200 
-     link => /var/spool/ppd/Compaq/Compaq-J1200.ppd
-     ppd  => Compaq - Co    
-   */
-  function getPrinterReload()
-  {
-    if(is_readable($this->pathToPPD)){
-      $tmp = @$this->ppdManager->getPrinterList(true);
-
-      $this->ppdListHeader = $this->ppdList = array();
-
-      /* Sort all available files, and create header (Vendor index) */
-      foreach($tmp as $file=>$ppd){
-
-        if(preg_match("#".$this->pathToModified."#",$file)) continue;
-
-        $tmp2 = split("\n",$ppd);
-        if(!isset($this->ppdListHeader[$tmp2[0]])){
-          $this->ppdListHeader[$tmp2[0]]=0;
-        }
-        $tmp3['name']   =preg_replace("/^ -/","",$tmp2[1]." - ".$tmp2[2]);
-        $tmp3['link']   =$file;
-        $tmp3['ppd']    =$ppd;
-        $this->ppdListHeader[$tmp2[0]]++;
-        $this->ppdList[$tmp2[0]][preg_replace("/^ -/","",$tmp2[1]." - ".$tmp2[2])]=$tmp3;
-      }
-    }
-  }
-
-
-  /* Save all options posted from ppd dialog */
-  function save_object()
-  {
-    if(!((isset($_POST['PPDDisSubmitted'])) && (is_array($this->ppdConfig)))){
-      return;
-    }
-
-    foreach($this->ppdConfig as $cat => $obj){
-      foreach($obj as $attr => $attributes){
-        if(isset($_POST[base64_encode($attributes['_name'])])){
-          $this->ppdConfig[$cat][$attr]['_default'] = $_POST[base64_encode($attributes['_name'])];
-        }
-      }
-    }
-  }
-
-
-  /* Save modified ppd */
-  function save_ppd()
-  {
-    if($this->ppdManager){
-      $this->ppdManager->saveProperties($this->pathToPPD.$this->pathToModified.$this->selectedPPD['link'],$this->ppdConfig);
-    }
-  }
-
-
-  /* Return selected ppd path, if none is selected then false */
-  function save()
-  {
-    /* return the selected PPD, and in future the selected options too */
-    return($this->pathToModified.$this->selectedPPD['link']);
-  }
-
-
-  /* Get Information for a single PPD entry 
-   * This will be shown on top of template
-   */
-  function getPPDInformation()
-  {
-    $str = "none";
-    if(!empty($this->selectedPPD)){
-      $str = $this->ppdManager->loadDescription($this->pathToPPD.$this->pathToModified.$this->selectedPPD['link']);
-    }
-    return($str) ; 
-  }
-
-
-  /* Display all options from the selected ppd file */
-  function generateProperties()
-  { 
-    /* Set Headline */
-    $str = "";
-    $feed= "";
-
-    $s_ppd = $this->pathToPPD.$this->pathToModified.$this->selectedPPD['link'];
-
-    /* If ppd exists and is readable */
-    if((!empty($this->selectedPPD['link']))&&(file_exists($s_ppd))){
-
-      /* If there is no initial Configuration, load it */
-      if($this->ppdConfig == false){
-        $this->ppdConfig = $this->ppdManager->loadProperties($s_ppd);
-      }
-
-      /* Create a table */
-      $str .= "<div style='padding-left:30px;'><table summary=''>";
-
-      /* Input all data to the table */
-      foreach($this->ppdConfig as $cat => $obj){
-
-        /* Add new category */
-        $str .= "<tr><td colspan='2'>$feed";
-        if ($feed == ""){
-          $feed= "<br>";
-        }
-        $str .= "<b>"._("Section")." '".$cat."'&nbsp;</b><br>";
-        $str .= "</td></tr>";       
-
-        /* Add attributes of the current category */
-        foreach($obj as $attr => $settings){
-
-          /* Skip all entries beginning with _ */
-          if($attr[0] == "_") continue;  
-
-          /* Prepare data */
-          $values   = array();
-          $name     = $settings['_name'];
-
-          if (!isset($settings['_default'])){
-            $default  = "";
-          } else {
-            $default  = $settings['_default'];
-          }
-
-          $type     = $settings['_type'];
-
-          /* Add name to table */ 
-          $str .= "<tr><td style='padding-left:40px;'>\n";
-          $str .= $name."<br>\n";
-          $str .= "</td><td>\n";
-
-          /* Get all values */ 
-          foreach( $settings as $vname => $value){
-            if($vname[0] != "_"){
-              $values[$vname]= $value;
-            }
-          }
-
-          /* preparing Html output
-           * Supported types are PickOne/Boolean
-           */
-
-          /* If type is PickOne, create a select box */
-          if(($type == "PickOne")||(($type=="Boolean")&&(count($values)>1))){
-
-            $str  .=  "<select name='".base64_encode($name)."'>\n";
-            foreach($values as $optionKey => $value){
-              $selected = "";
-              if($optionKey == $default){
-                $selected = " selected ";
-              }
-              $str  .=  "<option value='".$optionKey."' ".$selected.">".$value."</option>\n";
-            }
-            $str  .=  "</select>\n";
-
-          }elseif($type == "Boolean"){
-
-            /* If type is Boolean & no values are given */
-            $str  .=  "<select name='".base64_encode($name)."'>\n";
-            if($default == "False"){
-              $str  .=    "<option value='True' >"._("True")."</option>\n";
-              $str  .=    "<option value='False' selected>"._("False")."</option>\n";
-            }else{
-              $str  .=    "<option value='True' selected>"._("True")."</option>\n";
-              $str  .=    "<option value='False' >"._("False")."</option>\n";
-            }          
-            $str  .=  "</select>\n";
-
-          }else{
-            print_red(sprintf(_("Unsupported ppd type '%s' used for '%s' "),$type,$name));
-          }
-          $str .= "</td></tr>\n";
-        }
-      }
-      $str .= "</table></div>\n";
-    }
-    return($str);
-  }
-
-  function removeModifiedPPD()
-  {
-    $path = $this->pathToPPD.$this->pathToModified.$this->selectedPPD['link'];
-
-    if(file_exists($path)){
-      if(is_writeable($path)){
-        if(!@unlink($path)){
-          print_red(sprintf(_("Removing old ppd file '%s' failed."),$path));
-        }
-      }else{
-        print_red(sprintf(_("Removing old ppd file '%s' failed. File is not accessible."),$path));
-      }
-    }else{
-      print_red(sprintf(_("Removing old ppd file '%s' failed. File does not exists or is not accessible."),$path));
-    }
-  }
-
-  function update_ppd_url()
-  {
-    $this->SelectPPD("modified/".$this->selectedPPD['link']);
-  }
-  
-  function check()
-  {  
-    $message = plugin::check();
-    if(empty($this->selectedPPD['link'])){
-      $message[] = _("Please select a valid ppd file or use 'Cancel' to go back to printer configuration.");
-    }
-    return($message); 
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_printerPPDSelectionDialog.inc b/plugins/admin/systems/class_printerPPDSelectionDialog.inc
deleted file mode 100644 (file)
index d4f5d16..0000000
+++ /dev/null
@@ -1,197 +0,0 @@
-<?php
-
-class printerPPDSelectionDialog 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       = FALSE;
-  var $attributes           = array();
-  var $objectclasses        = array("whatever");
-
-  var $list                 =array();
-  var $header               =array();
-  var $current_del_id       = "";
-  var $Vendor               = "";
-
-  function printerPPDSelectionDialog (&$config, $dn= NULL,$list=false,$headers=false,$ppd=false)
-  {
-    plugin::plugin ($config, $dn);
-    $this->list       = $list;
-    $this->header     = $headers;
-    $this->depselect  = $this->config->current['BASE'];
-    
-    if(!isset($_SESSION['printerPPDSelectionDialog'])){
-      $_SESSION['printerPPDSelectionDialog']['regex'] = "*";
-    }  
-
-    /* Order the manufacturers index */
-    ksort($this->header);
-  }
-
-  function execute()
-  {
-       /* Call parent execute */
-       plugin::execute();
-
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-    $display= "";
-    $s_action = "none";
-  
-    $regex = $_SESSION['printerPPDSelectionDialog']['regex'];
-
-    if(isset($_GET['search'])){
-      $regex = $_GET['search']."*";
-    }
-  
-    if(isset($_POST['regex'])){
-      $regex= $_POST['regex'];
-    }
-    
-    $regex = str_replace("**","*",$regex);
-    $_SESSION['printerPPDSelectionDialog']['regex'] = $regex;
-
-    /* Delete requested, check if everything is ok and display confirmation dialog */
-    if(isset($_GET['act']) && $_GET['act'] == "del"){
-
-      /* Get id and check if id is valid */
-      $id_to_del = base64_decode($_GET['id']);
-      $found = "";
-      foreach($this->list[$this->Vendor] as $key => $data){
-        if($data['link'] == $id_to_del){
-          $found = $key;
-          break;
-        }
-      }
-      if(!empty($found)){
-        $this->current_del_id = $id_to_del;
-
-        $smarty->assign("warning", sprintf(_("You're about to delete the ppd file '%s' at '%s'."), $found,$id_to_del));
-        return($smarty->fetch(get_template_path('remove_ppd.tpl', TRUE)));
-
-      }else{
-        print_red(sprintf(_("Could not found specified ppd file '%s'."),$id_to_del));
-      }
-    }
-
-    /* Deletion confirmed */
-    if(isset($_POST['delete_ppd_confirm']) && !empty($this->current_del_id)){
-
-      /* check if file is removeable */
-      if(is_writeable($this->current_del_id)){
-        $is_ok = @unlink($this->current_del_id);
-
-        /* Update ppd list */
-        if($is_ok){
-          foreach($this->list as $vendor => $ppds){
-            foreach($ppds as $ppd => $data){
-              if($data['link'] == $this->current_del_id){
-                unset($this->list[$vendor][$ppd]);
-              }
-            }
-          }
-        }
-      }else{
-        $is_ok = false;
-      }
-
-      if(!$is_ok){
-        print_red(_("Something went wrong while trying to remove the ppd file from server, possibly we have no write access."));
-      }
-    }
-
-
-    /** Added **/
-    $list = array();
-    foreach($this->list as $cat => $ppds){
-      foreach($ppds as $ppd){
-        if(preg_match("/^".str_replace("*",".*",$regex)."/i",$ppd['ppd'])){
-          if(is_readable($ppd['link'])){
-            $list[$ppd['link']] = $ppd;
-          }
-        }
-      }
-    }
-    if((isset($_GET['act']))&&($_GET['act']=="open"))  {
-      
-      if((!empty($_GET['id'])) && (!isset( $this->header[base64_decode($_GET['id'])]))){
-        print_red(sprintf(_("Selected vendor '%s' does not exists in our list of ppds."),base64_decode($_GET['id'])));      
-        $this->Vendor = ""; 
-      }else{
-        $this->Vendor = base64_decode($_GET['id']);
-      }
-    }
-
-    $div = new divSelectBox("printerPPDSelectionDialog");
-    $div ->SetHeight(450);
-    $div ->SetSummary(_("Printer ppd selection."));
-    
-    $linkopen = "<a href='?plug=".$_GET['plug']."&amp;act=open&amp;id=%s'>
-                  <img src='images/folder.png' class='center' border=0>&nbsp;%s
-                 </a>";
-    $uselink  = "<a href='?plug=".$_GET['plug']."&amp;act=use&amp;id=%s'>%s</a>";
-    $dellink  = "<a href='?plug=".$_GET['plug']."&amp;act=del&amp;id=%s'>
-                  <img src='images/edittrash.png' alt='"._("delete")."' border=0>
-                 </a>"; 
-
-    if(empty($this->Vendor)){
-      foreach($this-> header as $key => $entry){
-        $div ->AddEntry (array(
-              array("string"=>sprintf($linkopen,base64_encode($key),$key),"attach"=>"style='border-right:0px;'")
-              ));
-      }
-    }else{
-      $div ->AddEntry (array(
-            array("string"=>sprintf($linkopen,"",".. ["._("back")."]"),"attach"=>"style='border-right:0px;'")
-            ));
-      foreach($list as $key => $ppd){
-        if(preg_match("/^".$this->Vendor."/",$ppd['ppd'])){
-
-          if(is_writeable($ppd['link'])){
-            $del_str = sprintf($dellink,base64_encode($key));
-          }else{
-            $del_str = "";
-          }
-
-          $div ->AddEntry (array(
-                                  array("string"=>sprintf($uselink,base64_encode($key),$ppd['ppd'])),
-                                  array("string"=>$del_str,"attach"=>"style='border-right:0px;'")
-
-                ));
-        }
-      }
-    }
-
-    $smarty->assign("List",         $div -> DrawList());
-    $smarty->assign("search_image", get_template_path('images/search.png'));
-    $smarty->assign("launchimage",  get_template_path('images/small_filter.png'));
-    $smarty->assign("tree_image",   get_template_path('images/tree.png'));
-    $smarty->assign("alphabet",     generate_alphabet());
-    $smarty->assign("apply",        apply_filter());
-    $smarty->assign("regex",        $regex);
-  
-    $display.= $smarty->fetch(get_template_path('printerPPDSelectionDialog.tpl', TRUE,dirname(__FILE__)));
-    return($display);
-  }
-
-  function save_object()
-  {
-  } 
-
-  function check(){
-  }
-
-  /* Save to LDAP */
-  function save()
-  {
-    return $this->selectedPPD;
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_servDHCP.inc b/plugins/admin/systems/class_servDHCP.inc
deleted file mode 100644 (file)
index c804ec2..0000000
+++ /dev/null
@@ -1,739 +0,0 @@
-<?php
-
-class servdhcp extends goService
-{
-  /* attribute list for save action */
-  var $attributes= array("dhcpServiceDN");
-  var $objectclasses= array("dhcpServer");
-  var $conflicts        = array("servdhcp");
-  var $dhcpServiceDN= "";
-
-  /* Section storage */
-  var $dhcpSections= array();
-  var $dhcpObjectCache= array();
-  var $current_object= "";
-  var $types= array();
-  var $serviceDN= "";
-
-       var $quote_option = array("domain-name");
-
-  var $orig_dn = "";
-
-  var $dhcp_server_list   = array("ENTRIES"=> array(),"FOR_LIST"=> array());
-  var $take_over_id       = -1;
-  var $display_warning  = TRUE;
-
-  function servdhcp (&$config, $dn= NULL, $parent= NULL)
-  {
-    plugin::plugin ($config, $dn, $parent);
-
-    $this->serviceDN = "cn=dhcp,".$dn;
-    $this->orig_dn = $dn;
-
-    $this->DisplayName = _("DHCP service");
-
-    $this->types= array(  "dhcpLog" => _("Logging"),
-            "dhcpService" => _("Global options"),
-            "dhcpClass" => _("Class"),
-            "dhcpSubClass" => _("Subclass"),
-            "dhcpHost" => _("Host"),
-            "dhcpGroup" => _("Group"),
-            "dhcpPool" => _("Pool"),
-            "dhcpSubnet" => _("Subnet"),
-            "dhcpFailOverPeer" => _("Failover peer"),
-            "dhcpSharedNetwork" => _("Shared network"));
-
-
-    /* Backport: PHP4 compatibility  */
-    foreach($this->types as $type => $translation){
-           $this->types[strtolower($type)] = $translation;
-    }
-
-    /* Load information about available services */
-    $this->reload(); 
-    if (!count($this->dhcpSections)){
-      $this->is_account= FALSE;
-      $this->dhcp_server_list = $this->get_list_of_dhcp_servers();
-    }
-  }
-
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-    $smarty->assign("dns_take_over",FALSE);
-    $display= "";
-
-
-    /*****************/
-    /* Handle Take Over Actions 
-    /*****************/
-
-    /* Give smarty the required informations */
-    $smarty->assign("dhcp_server_list", $this->dhcp_server_list['FOR_LIST']);
-    $smarty->assign("dhcp_server_list_cnt", count($this->dhcp_server_list['FOR_LIST']));
-    
-    /* Take over requested, save id */
-    if(isset($_POST['take_over_src']) && isset($_POST['take_over'])){
-      $id = $_POST['take_over_src'];
-      if(isset($this->dhcp_server_list['ENTRIES'][$id])){
-        $this->take_over_id = $id;      
-      }
-    }
-    /* Abort take over action */ 
-    if(isset($_POST['cancel_take_over'])){
-      $this->dialog =false;
-      $this->take_over_id = -1;
-      $this->dhcp_server_list = $this->get_list_of_dhcp_servers();
-    }
-
-    /* Display informartion about take over that will be started when saving this server 
-     *  and hide default dhcp output
-     */
-    if($this->take_over_id != -1){
-
-      $this->dialog = FALSE;
-      $id = $this->take_over_id;
-      $smarty->assign("dns_take_over",TRUE);
-      $warning = sprintf(_("You are going to migrate the DHCP setup from server '%s'."),
-        $this->dhcp_server_list['ENTRIES'][$id]['cn'][0]);
-      $warning.= "&nbsp;"._("The migration will be started when you save this system. To cancel this action, use the cancel button below.");
-
-      if($this->display_warning){
-        print_red($warning);
-        $this->display_warning = FALSE;
-      }
-      return($smarty->fetch(get_template_path('servdhcp.tpl', TRUE)));
-    }
-
-    
-    /*****************/
-    /* List handling  
-    /*****************/
-
-    /* Section Creation? */
-    if (isset($_POST['create_section']) && isset($_POST['section'])){
-      $section= $_POST['section'];
-      $tmp = new dhcpNewSectionDialog(NULL);
-      if (isset($tmp->sectionMap[$section])){
-        $this->dialog= new $section($this->current_object);
-        $this->current_object= "";
-      } else {
-        $this->dialog= FALSE;
-      }
-    }
-
-    /* Cancel section creation? */
-    if (isset($_POST['cancel_section']) || isset($_POST['cancel_dhcp'])){
-      $this->dialog= FALSE;
-    }
-
-    /* Save changes */
-    if (isset($_POST['save_dhcp'])){
-      $this->dialog->save_object();
-      $messages= $this->dialog->check();
-      if (count($messages)){
-        show_errors($messages);
-      } else {
-        $dn= $this->dialog->dn;
-        $class= get_class($this->dialog);
-        $type= $this->types[$class];
-               if(empty($this->serviceDN)){
-                       $indent= substr_count(preg_replace("/".$this->dn."/", '', $dn), ",") -1;
-               }else{
-                       $indent= substr_count(preg_replace("/".$this->serviceDN."/", '', $dn), ",");
-               }
-               $spaces= "";
-               for ($i= 0; $i<$indent; $i++){
-          $spaces.= "&nbsp;&nbsp;&nbsp;&nbsp;";
-        }
-        $data= $this->dialog->save();
-        if ($this->current_object == ""){
-          /* New object */
-          $newsects= array();
-          foreach ($this->dhcpSections as $key => $dsc){
-            $newsects[$key]= $dsc;
-            if ($key == $dn){
-              $spaces.= "&nbsp;&nbsp;&nbsp;&nbsp;";
-              $newsects[$data['dn']]= "$spaces$type '".preg_replace('/^[^=]+=([^,]+),.*$/', '\1', $data['dn'])."'";
-            }
-          }
-          $this->dhcpObjectCache[$data['dn']]= $data;
-          $this->dhcpSections= $newsects;
-        } else {
-          if ($dn != $data['dn']){
-            /* Old object, new name */
-            $this->dhcpObjectCache[$dn]= array();
-            $this->dhcpObjectCache[$data['dn']]= $data;
-
-            /* If we renamed a section, we've to rename a couple of objects, too */
-            foreach ($this->dhcpObjectCache as $key => $dsc){
-              if (preg_match("/,$dn$/", $key)){
-                $new_dn= preg_replace("/,$dn$/", ",".$data['dn'], $key);
-                $dsc['MODIFIED']= TRUE;
-                $this->dhcpObjectCache[$new_dn]= $dsc;
-                unset($this->dhcpObjectCache[$key]);
-              }
-            }
-            $newsects= array();
-            foreach ($this->dhcpSections as $key => $dsc){
-              if ($key == $dn){
-                $newsects[$data['dn']]= "$spaces$type '".preg_replace('/^[^=]+=([^,]+),.*$/', '\1', $data['dn'])."'";
-                continue;
-              }
-              if (preg_match("/,$dn$/", $key)){
-                $new_dn= preg_replace("/,$dn$/", ",".$data['dn'], $key);
-                $newsects[$new_dn]= $dsc;
-              } else {
-                $newsects[$key]= $dsc;
-              }
-            }
-            $this->dhcpSections= $newsects;
-
-          } else {
-            /* Old object, old name */
-            $this->dhcpObjectCache[$data['dn']]= $data;
-          }
-        }
-        $this->dialog= FALSE;
-      }
-    }
-
-    /* Remove section? */
-    if (isset($_POST['delete_dhcp_confirm'])){
-      if ($this->acl_is_removeable()){
-        unset($this->dhcpSections[$this->current_object]);
-        unset($this->dhcpObjectCache[$this->current_object]);
-        $this->dhcpObjectCache[$this->current_object]= array();
-        foreach ($this->dhcpSections as $key => $value){
-          if (preg_match("/".$this->current_object."$/", $key)){
-            unset($this->dhcpSections[$key]);
-            unset($this->dhcpObjectCache[$key]);
-            $this->dhcpObjectCache[$key]= array();
-          }
-        }
-      } else {
-        print_red(_("You're not allowed to remove DHCP sections!"));
-      }
-      $this->dialog= FALSE;
-    }
-
-    /* Look for post entries */
-    foreach($_POST as $name => $value){
-      
-      /* Insert new section? */
-      if (preg_match('/^insertDhcp_.*_x$/', $name)){
-        $dn= base64_decode(preg_replace('/^insertDhcp_([^_]+)_x$/', '\1', $name));
-        if (isset($this->dhcpObjectCache[$dn])){
-          $this->dialog= new dhcpNewSectionDialog($this->objectType($dn));
-          $this->current_object= $dn;
-          $this->dialog->acl= $this->acl;
-        }
-      }
-
-      /* Edit section? */
-      if (preg_match('/^editDhcp_.*_x$/', $name)){
-        $dn= base64_decode(preg_replace('/^editDhcp_([^_]+)_x$/', '\1', $name));
-        if (isset($this->dhcpObjectCache[$dn])){
-          $section= $this->objectType($dn);
-          $this->current_object= $dn;
-          $this->dialog= new $section($this->dhcpObjectCache[$dn]);
-        }
-      }
-
-      /* Remove section? */
-      if (preg_match('/^delDhcp_.*_x$/', $name)){
-        $dn= base64_decode(preg_replace('/^delDhcp_([^_]+)_x$/', '\1', $name));
-        if (isset($this->dhcpObjectCache[$dn])){
-          $this->current_object= $dn;
-          $this->dialog= 1;
-          $smarty->assign("warning", sprintf(_("You're about to delete the DHCP section '%s'."), $dn));
-          return($smarty->fetch(get_template_path('remove_dhcp.tpl', TRUE)));
-        }
-      }
-
-    }
-
-    if(isset($_GET['act']) && $_GET['act']=="edit" && isset($_GET['id'])){
-      $dn = base64_decode($_GET['id']);
-      if (isset($this->dhcpObjectCache[$dn])){
-        $section= $this->objectType($dn);
-        $this->current_object= $dn;
-        $this->dialog= new $section($this->dhcpObjectCache[$dn]);
-      }
-    }
-    
-
-    if(isset($_GET['act']) && $_GET['act']=="edit" && isset($_GET['id'])){
-      $dn = base64_decode($_GET['id']);
-      if (isset($this->dhcpObjectCache[$dn])){
-        $section= $this->objectType($dn);
-        $this->current_object= $dn;
-        $this->dialog= new $section($this->dhcpObjectCache[$dn]);
-      }
-    }
-    
-
-    /* Do we need to flip is_account state? */
-    if (isset($_POST['modify_state'])){
-      $this->is_account= !$this->is_account;
-    }
-
-    /* Show tab dialog headers */
-    if ($this->is_account){
-#      $display= $this->show_header(_("Remove DHCP service"),
-#          _("This server has DHCP features enabled. You can disable them by clicking below."));
-
-      if (!count($this->dhcpObjectCache)){
-        $attrs= array();
-        $attrs['dn']= 'cn=dhcp,'.$this->dn;
-        $attrs['cn']= array('dhcp');
-        $attrs['objectClass']= array('top', 'dhcpService');
-        $attrs['dhcpPrimaryDN']= array($this->dn);
-        $attrs['dhcpStatements']= array("default-lease-time 600",
-                                        "max-lease-time 1200",
-                                        "authoritative",
-                                        "ddns-update-style none");
-        $attrs['MODIFIED']= TRUE;
-        $this->dhcpSections['cn=dhcp,'.$this->dn]= _("Global options");
-        $this->dhcpObjectCache['cn=dhcp,'.$this->dn]= $attrs;
-      }
-
-    } else {
-#      $display= $this->show_header(_("Add DHCP service"),
-
-#          _("This server has DHCP features disabled. You can enable them by clicking below."));
-      return ($display);
-    }
-
-
-    /* Show dialog
-     */
-    if(isset($this->dialog) && is_object($this->dialog)){
-      $this->dialog->save_object();
-      $this->dialog->parent = $this;
-      return($this->dialog->execute());
-    }
-
-    /* Create Listbox with existing Zones
-     */
-    $DhcpList = new divSelectBox("dhcpSections");
-    $DhcpList->SetHeight(400);
-
-    /* Add entries to divlist
-     */
-    $editImgIns = "<input type='image' src='images/list_new.png' name='insertDhcp_%s' title='"._("Insert new DHCP section")."'>".
-      "<input type='image' src='images/edit.png' name='editDhcp_%s' title='"._("Edit DHCP section")."'>".
-      "<input type='image' src='images/edittrash.png' name='delDhcp_%s' title='"._("Remove DHCP section")."'>";
-    $editImgInsNoDel = "<input type='image' src='images/list_new.png' name='insertDhcp_%s' title='"._("Insert new DHCP section")."'>".
-      "<input type='image' src='images/edit.png' name='editDhcp_%s' title='"._("Edit DHCP section")."'>";
-    $editImg = "<input type='image' src='images/edit.png' name='editDhcp_%s' title='"._("Edit DHCP section")."'>".
-      "<input type='image' src='images/edittrash.png' name='delDhcp_%s' title='"._("Remove DHCP section")."'>";
-       
-    $tmp = new dhcpNewSectionDialog(NULL);
-    foreach($this->dhcpSections as $section => $values ){
-    
-      $values = "<a href='?plug=".$_GET['plug']."&act=edit&id=".base64_encode($section)."'>".$values."</a>";
-       
-      if (count($tmp->sectionMap[$this->objectType($section)])){
-        if ($this->objectType($section) == "dhcpService"){
-          $DhcpList->AddEntry(array(
-              array("string" => $values),
-              array("string" => str_replace("%s",base64_encode($section),$editImgInsNoDel), "attach" => "style='text-align:right;'")
-              ));
-        } else {
-          $DhcpList->AddEntry(array(
-              array("string" => $values),
-              array("string" => str_replace("%s",base64_encode($section),$editImgIns), "attach" => "style='text-align:right;'")
-              ));
-        }
-      } else {
-        $DhcpList->AddEntry(array(
-              array("string" => $values),
-              array("string" => str_replace("%s",base64_encode($section),$editImg), "attach" => "style='text-align:right;'")
-              ));
-      }
-    }
-
-    /* Display tempalte */
-    $smarty->assign("DhcpList",$DhcpList->DrawList());
-    $display.= $smarty->fetch(get_template_path('servdhcp.tpl', TRUE));
-    return($display);
-  }
-
-
-  function remove_from_parent()
-  {
-    /* Cancel if there's nothing to do here */
-    if (!$this->initially_was_account){
-      return;
-    }
-
-    /* Remove subtrees */
-    $ldap= $this->config->get_ldap_link();
-    foreach ($this->dhcpObjectCache as $dn => $content){
-      if ($this->objectType($dn) == 'dhcpService'){
-        $ldap->rmdir_recursive($dn);
-        show_ldap_error($ldap->get_error(), _("Removing DHCP entries failed"));
-      }
-    }
-
-    /* Remove from self */
-    $ldap= $this->config->get_ldap_link();
-
-    /* Remove and write to LDAP */
-    plugin::remove_from_parent();
-    
-    @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->attributes, "Save");
-    $ldap->cd($this->dn);
-    $this->cleanup();
-    $ldap->modify ($this->attrs);
-
-    show_ldap_error($ldap->get_error(), _("Removing DHCP entries failed"));
-
-    /* Optionally execute a command after we're done */
-    $this->handle_post_events("remove");
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    plugin::save_object();
-  }
-
-
-  /* Check supplied data */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-    
-    return ($message);
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    /* Take over handling 
-     * - Load servdhcp class and dhcpObjectCache for the source dhcp setup.
-     * - Assign dhcpObjectCache to this configuration. 
-     * - Save this setup and remove source setup from ldap.
-     */
-    if($this->take_over_id != -1){
-      $id = $this->take_over_id;
-      $src = preg_replace("/cn=dhcp,/","",$this->dhcp_server_list['ENTRIES'][$id]['dn']);
-      $tmp = new servdhcp ($this->config, $src);
-      $this->orig_dn = $src;
-      $this->dhcpObjectCache =  $tmp->dhcpObjectCache;
-    }
-
-    /* Save dhcp setttings */
-    $ldap= $this->config->get_ldap_link();
-    foreach ($this->dhcpObjectCache as $dn => $data){
-
-      if($this->dn != $this->orig_dn){
-        $dn = preg_replace("/".normalizePreg($this->orig_dn)."$/i",$this->dn,$dn);
-      }
-
-      /* Remove entry? */
-      if (count($data) == 0){
-        /* Check if exists, then remove... */
-        if($ldap->cat($dn)){
-          $ldap->rmdir_recursive($dn);
-          show_ldap_error($ldap->get_error(), _("Can't remove DHCP object!"));
-        }
-        continue;
-      }
-
-      /* Opdate dhcp option 'server-name' to actual server name */
-      if($this->dn != $this->orig_dn){
-        $fixed = FALSE;
-        foreach(array("dhcpHost","dhcpSubnet","dhcpGroup","dhcpSharedNetwork") as $object){
-          if(in_array($object,$data['objectClass']) && isset($data['dhcpOption'])){
-            foreach($data['dhcpOption'] as $key => $option){
-              if(preg_match("/^server-name /",$option)){
-                $data['dhcpOption'][$key] = "server-name ".$this->cn;
-                $data['MODIFIED'] = TRUE; 
-                break;
-              }
-            }
-          }
-
-          /* Skip next loops if entry is updated */
-          if($fixed){
-            break;
-          }
-        }
-      }
-
-      /* Modify existing entry? */
-      if (isset($data['MODIFIED']) || $this->orig_dn != $this->dn){
-
-        if($ldap->cat($dn)){
-          $modify= TRUE;
-        } else {
-          $modify= FALSE;
-        }
-
-        /* Build new entry */
-        $attrs= array();
-        foreach ($data as $attribute => $values){
-          if ($attribute == "MODIFIED" || $attribute == "dn"){
-            continue;
-          }
-      
-          if(in_array($attribute,array("dhcpPrimaryDN","dhcpSecondaryDN","dhcpServerDN","dhcpFailOverPeerDN"))){
-            foreach($values as $v_key => $value){
-              $values[$v_key] = preg_replace("/".normalizePreg($this->orig_dn)."$/i",$this->dn,$value);
-            }
-          }
-
-          if (count($values)){
-
-            if($attribute == "dhcpOption"){
-              foreach($values as $key => $value){
-                $option_name = trim(preg_replace("/[^ ]*$/","",$value));
-                $option_value= trim(preg_replace("/^[^ ]*/","",$value));
-                if(in_array($option_name,$this->quote_option)){
-                  $values[$key] = $option_name." \"".$option_value."\"";
-                }
-              }
-            }
-            if (count($values) == 1){
-              $attrs[$attribute]= $values[0];
-            } else {
-              $attrs[$attribute]= $values;
-            }
-          } else {
-            if ($modify){
-              $attrs[$attribute]= array();
-            }
-          }
-        }
-
-        $ldap->cd($dn);
-        if ($modify){
-          $ldap->modify($attrs);
-          show_ldap_error($ldap->get_error(), _("Can't save DHCP object!"));
-
-          /* Optionally execute a command after we're done */
-          $this->handle_post_events("modify");
-        } else {
-          $ldap->add($attrs);
-          show_ldap_error($ldap->get_error(), _("Can't save DHCP object!"));
-
-          /* Optionally execute a command after we're done */
-          $this->handle_post_events("create");
-        }
-      }
-    }
-
-    $this->dhcpServiceDN= $this->serviceDN;
-    if($this->dn != $this->orig_dn){
-      $this->dhcpServiceDN= preg_replace("/".normalizePreg($this->orig_dn)."$/i",$this->dn,$this->dhcpServiceDN);
-    }
-
-    /* Replace 'new' dn */ 
-    if(preg_match("/new$/",$this->dhcpServiceDN)){
-      $this->dhcpServiceDN = preg_replace("/new$/",$this->dn,$this->dhcpServiceDN);
-    }
-
-    plugin::save();
-    
-    /* Save data to LDAP */
-    $ldap->cd($this->dn);
-    $this->cleanup();
-    $ldap->modify ($this->attrs);
-
-    show_ldap_error($ldap->get_error(), _("Saving DHCP service failed"));
-
-    /* Optionally execute a command after we're done */
-    if ($this->initially_was_account == $this->is_account){
-      if ($this->is_modified){
-        $this->handle_post_events("modify");
-      }
-    } else {
-      $this->handle_post_events("add");
-    }
-
-    /* Take over handling
-     * - Remove old dhcp config from source server 
-     */
-    if($this->take_over_id != -1){
-      $id = $this->take_over_id;
-      $src = $this->dhcp_server_list['ENTRIES'][$id]['dn'];
-      $tmp = new servdhcp ($this->config, $src);
-      $tmp->remove_from_parent();
-    }
-  }
-
-
-  function reload()
-  {
-    /* Init LDAP and load list */
-    $ldap= $this->config->get_ldap_link();
-    $ui= get_userinfo();
-    $me= $this->dn;
-
-    $filter = "(&(objectClass=dhcpService)(|(dhcpPrimaryDN=$me)(dhcpSecondaryDN=$me)(dhcpServerDN=$me)(dhcpFailOverPeerDN=$me)))";
-
-    $list= get_list($filter, array("server"), $this->config->current['BASE'], array("cn"),GL_SIZELIMIT | GL_SUBSEARCH);
-    $final= array();
-
-    foreach ($list as $value){
-
-      /* Set header */
-      $sortpart= split(",", $value['dn']);
-      $sortpart= array_reverse($sortpart);
-      $tmp= implode(",", $sortpart);
-
-      $final[$value['dn']]= $tmp."!"._("Global options");
-
-      /* Read all sub entries to place here */
-      $ldap->cd($value['dn']);
-      $ldap->search("(|(objectClass=dhcpService)(objectClass=dhcpLog)(objectClass=dhcpClass)(objectClass=dhcpSubClass)(objectClass=dhcpHost)(objectClass=dhcpGroup)(objectClass=dhcpPool)(objectClass=dhcpSubnet)(objectClass=dhcpSharedNetwork)(objectClass=dhcpOptions)(objectClass=dhcpTSigKey)(objectClass=dhcpDnsZone)(objectClass=dhcpFailOverPeer))", array());
-      $this->serviceDN= $value['dn'];
-
-      while ($attrs= $ldap->fetch()){
-        $sattrs= array();
-        for ($i= 0; $i<$attrs['count']; $i++){
-          $sattrs[$attrs[$i]]= $attrs[$attrs[$i]];
-          unset($sattrs[$attrs[$i]]['count']);
-        }
-        $sattrs['dn']= $ldap->getDN();
-
-        foreach($sattrs as $name => $values){
-          if($name == "dhcpOption"){
-            foreach($values as $key => $value){
-              $value_name = trim(preg_replace("/[^ ]*$/","",$value));
-              $value_value= trim(preg_replace("/^[^ ]*/","",$value));
-              if(in_array($value_name,$this->quote_option)){
-                $value_value = preg_replace("/^\"/","",$value_value);
-                $value_value = preg_replace("/\"$/","",$value_value);
-                $sattrs[$name][$key] = $value_name." ".$value_value;
-              }
-            }
-          }
-        }
-
-        $this->dhcpObjectCache[$ldap->getDN()]= $sattrs;
-        $tmp= preg_replace("/".$this->serviceDN."/", "", $ldap->getDN());
-        $indent= substr_count($tmp, ",");
-        $spaces= "";
-        for ($i= 0; $i<$indent; $i++){
-          $spaces.= "&nbsp;&nbsp;&nbsp;&nbsp;";
-        }
-
-        foreach ($this->types as $key => $val){
-          if (in_array("$key", $attrs['objectClass'])){
-            $type= $val;
-            break;
-          }
-        }
-
-        /* Prepare for sorting... */
-        $sortpart= split(",", $ldap->getDN());
-        $sortpart= array_reverse($sortpart);
-        $tmp= implode(",", $sortpart);
-        $final[$ldap->getDN()]= $tmp."!".$spaces.$type." '".$attrs['cn'][0]."'";
-      }
-    }
-
-    /* Sort it... */
-    natsort($final);
-    $this->dhcpSections= array();
-    foreach ($final as $key => $val){
-      $this->dhcpSections[$key]= preg_replace('/^[^!]+!(.*)$/', '\\1', $val);
-    }
-
-  }
-
-
-  function objectType($dn)
-  {
-    $type= "";
-    $types= array("dhcpService", "dhcpClass", "dhcpSubClass", "dhcpHost",
-                  "dhcpGroup", "dhcpPool", "dhcpSubnet", "dhcpSharedNetwork");
-
-    foreach ($this->dhcpObjectCache[$dn]['objectClass'] as $oc){
-      if (in_array($oc, $types)){
-        $type= $oc;
-        break;
-      }
-    }
-
-    /* That should not happen... */
-    if ($type == ""){
-      print_red(_("DHCP configuration set is unknown. Please contact your system administrator."));
-    }
-    
-    return ($type);
-  }
-
-
-  /* Return plugin informations for acl handling */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("DHCP service"),
-          "plDescription" => _("DHCP service")." ("._("Services").")",
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 84,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("server"),
-
-          "plProvidedAcls"=> array(
-            
-          )     
-    ));
-  }
-
-
-  function take_over_service()
-  {
-
-  }
-
-
-  function get_list_of_dhcp_servers()
-  {
-    $ret = array("ENTRIES"=> array(),"FOR_LIST"=> array());
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(&(objectClass=goServer)(dhcpServiceDN=*))",array("dn","cn","dhcpServiceDN"));
-    while($attrs = $ldap->fetch()){
-
-      /* Skip own config */
-      if($this->dn != "new" && preg_match("/".normalizePreg($this->dn)."$/",$attrs['dn'])){
-        continue;
-      }
-
-      $ret['ENTRIES'][] = $attrs;
-    }
-    foreach($ret['ENTRIES'] as $key => $data){
-      $ret['FOR_LIST'][$key] = $data['cn'][0];
-    }
-    return($ret);
-  }
-
-
-  function getListEntry()
-  {
-    $fields               = goService::getListEntry();
-    $fields['Message']    = _("DHCP service");
-    $fields['AllowEdit']  = true;
-    return($fields);
-  }
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_servDNS.inc b/plugins/admin/systems/class_servDNS.inc
deleted file mode 100644 (file)
index 13e7a93..0000000
+++ /dev/null
@@ -1,598 +0,0 @@
-<?php
-
-class servdns extends goService
-{
-  /* 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   = FALSE;
-  var $attributes       = array(); 
-  var $objectclasses    = array("whatever");
-
-  var $RecordTypes      = array();
-  var $Zones            = array();
-
-  var $orig_dn          = "";
-
-  var $initially_was_account;
-  
-  /* ServerService tab vars */
-  var $conflicts        = array("servdns");
-  var $DisplayName      = "";
-  var $StatusFlag       = "";
-  var $view_logged      = FALSE;
-
-  var $dns_server_list   = array("ENTRIES"=> array(),"FOR_LIST"=> array());
-  var $take_over_id       = -1;
-
-
-  function servdns (&$config, $dn= NULL, $parent= NULL)
-  {
-    plugin::plugin ($config, $dn, $parent);
-
-    $this->DisplayName = _("DNS service");
-
-    $this->orig_dn = $dn;
-
-    /* Get record types for zones
-     */
-    $this->RecordTypes = getDnsRecordTypes(true);
-
-    /* Get all zone Informations
-     */
-    $this->Zones = getDNSZoneEntries($config,$dn);
-    
-    /* If there is at least one entry in this -> types, we have DNS enabled 
-     */
-    if(count($this->Zones) == 0){
-      $this->is_account = false;
-      $this->dns_server_list = $this->get_list_of_dns_servers();
-    }else{
-      $this->is_account = true;
-    }
-    $this->initially_was_account = $this->is_account;
-  }
-
-
-  function get_list_of_dns_servers()
-  {
-    $ret = array("ENTRIES"=> array(),"FOR_LIST"=> array());
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(&(objectClass=dNSZone)(zoneName=*))",array("dn","zoneName"));
-    $dns = array();
-    while($attrs = $ldap->fetch()){
-      /* Skip own config */
-      if($this->dn != "new" && preg_match("/".normalizePreg($this->dn)."$/",$attrs['dn'])){
-        continue;
-      }
-      $dn = preg_replace("/^zoneName=[^,]+,/","",$attrs['dn']);
-      if(preg_match("/^cn=/",$dn) && !in_array($dn,$dns)){
-        $dns[] = $dn;
-      }
-    }
-    $i = 0;
-    foreach($dns as $dn){
-      $ldap->cat($dn,array('*'));
-      if($ldap->count()){
-        $i ++;
-        $attrs = $ldap->fetch();
-          $ret['ENTRIES'][$i]   = $attrs;
-          $ret['FOR_LIST'][$i] = $attrs['cn'][0];
-      }
-    }
-    return($ret);
-  }  
-
-
-  function get_dns_info_string($id)
-  {
-    $ret="";
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->dns_server_list['ENTRIES'][$id]['dn']);
-    $ldap->search("(|(zoneName=*)(relativeDomainName=*))",array("dn"));
-    while($attrs = $ldap->fetch()){
-      $ret .= $attrs['dn']."\n";
-    }
-    return($ret);
-  }
-
-
-  function execute()
-  {
-    /* Call parent execute 
-     */
-    plugin::execute();
-
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","server/".get_class($this),$this->dn);
-    }
-
-    /* Fill templating stuff 
-     */
-    $smarty= get_smarty();
-    $smarty->assign("dns_take_over",FALSE);
-    $smarty->assign("is_createable",$this->acl_is_createable());
-    $display= "";
-
-
-    $this->initially_was_account= $this->is_account;
-    /*****************/
-    /* Handle Take Over Actions
-    /*****************/
-
-    /* Give smarty the required informations */
-    $smarty->assign("dns_server_list", $this->dns_server_list['FOR_LIST']);
-    $smarty->assign("dns_server_list_cnt", count($this->dns_server_list['FOR_LIST']));
-
-    /* Take over requested, save id */
-    if(isset($_POST['take_over_src']) && isset($_POST['take_over'])){
-      $id = $_POST['take_over_src'];
-      if(isset($this->dns_server_list['ENTRIES'][$id])){
-        $this->take_over_id = $id;
-      }
-    }
-
-    /* Abort take over action */
-    if(isset($_POST['cancel_take_over'])){
-      $this->dialog =false;
-      $this->take_over_id = -1;
-      $this->dns_server_list = $this->get_list_of_dns_servers();
-    }
-
-    /* Display informartion about take over that will be started when saving this server
-     *  and hide default dns output
-     */
-    if($this->take_over_id != -1){
-      $this->dialog = FALSE;
-      $id = $this->take_over_id;
-      $info = $this->get_dns_info_string($id);
-      $smarty->assign("dns_take_over",TRUE);
-      $smarty->assign("info",$info);
-      $warning = sprintf(_("You are going to migrate the DNS setup from server '%s'."),$this->dns_server_list['ENTRIES'][$id]['cn'][0]);
-      $warning2 = _("The migration will be startet when you save this system. To cancel this action, use the cancel button below.");
-      $smarty->assign("warning",$warning);
-      $smarty->assign("warning2",$warning2);
-      return($smarty->fetch(get_template_path('servdns.tpl', TRUE)));
-    }
-
-
-    /* Do we need to flip is_account state? 
-     */
-    if (isset($_POST['modify_state'])){
-      $this->is_account= !$this->is_account;
-    }
-
-    if ($this->is_account){
-      $display= $this->show_disable_header(_("Remove DNS service"),
-          _("This server has DNS features enabled. You can disable them by clicking below."));
-    } else {
-      $display= $this->show_enable_header(_("Add DNS service"),
-          _("This server has DNS features disabled. You can enable them by clicking below."));
-      return ($display);
-    }
-
-
-    /* Edited or Added zone 
-     */
-    if(isset($_POST['SaveZoneChanges'])){
-      $this->dialog->save_object();
-
-      /* Check for errors  
-       */
-      if(count($this->dialog->check())){
-        foreach($this->dialog->check() as $msgs){
-          print_red($msgs); 
-        }
-      }else{
-        /* add new/edited zone 
-         */
-        $ret = $this->dialog->save();
-        if(!$this->dialog->isNew){
-          unset($this->Zones[$this->dialog->OldZoneName]);
-        }
-        $this->Zones[$ret['zoneName']] = $ret;
-        $this->dialog = FALSE;
-      }
-    }
-
-    /* Cancel zone edit / new 
-     */
-    if(isset($_POST['CancelZoneChanges'])){
-      $this->dialog = FALSE;
-    }
-
-    /* Add empty new zone 
-     */
-    if(isset($_POST['AddZone'])){
-      $this->dialog = new servdnseditZone($this->config,$this->dn);
-    }
-
-    /* Check for edit zone request 
-     */
-    $once = false;
-    foreach( $_POST as $name => $value){
-  
-      /* check all post for edit request 
-       */
-      if(preg_match("/^editZone_/",$name)&&!$once){
-        $once =true;
-        $tmp = preg_replace("/^editZone_/","",$name);
-        $tmp = base64_decode(preg_replace("/_.*$/","",$tmp));
-        $this->dialog= new servdnseditZone($this->config,$this->dn,$this->Zones[$tmp]);
-      }
-
-      /* check posts for delete zone 
-       */
-      if(preg_match("/^delZone_/",$name)&&!$once){
-
-        $once =true;
-        $tmp = preg_replace("/^delZone_/","",$name);
-        $tmp = base64_decode(preg_replace("/_.*$/","",$tmp));
-     
-        /* Initiate deletion
-         */ 
-        $this->RemoveZone($tmp); 
-      }
-    }
-
-    if(isset($_GET['act']) && $_GET['act'] == "edit" && isset($_GET['id'])){
-      $id = base64_decode($_GET['id']);
-      if(isset($this->Zones[$id])){
-         $this->dialog= new servdnseditZone($this->config,$this->dn,$this->Zones[$id]);
-      }
-    }
-
-    if(isset($_GET['act']) && $_GET['act'] == "edit" && isset($_GET['id'])){
-      $id = base64_decode($_GET['id']);
-      if(isset($this->Zones[$id])){
-         $this->dialog= new servdnseditZone($this->config,$this->dn,$this->Zones[$id]);
-      }
-    }
-
-    /* Show dialog 
-     */
-    if(is_object($this->dialog)){
-      $this->dialog->save_object();
-      $this->dialog->parent = $this;
-      return($this->dialog->execute());
-    }
-
-    /* Create Listbox with existing Zones 
-     */
-    $ZoneList = new divSelectBox("dNSZones");
-    $ZoneList -> SetHeight(254);
-
-    /* Add entries to divlist
-     */
-    $editImg = "<input type='image' src='images/edit.png' name='editZone_%s'>";
-    if($this->acl_is_removeable()){
-      $editImg.= "<input type='image' src='images/edittrash.png' name='delZone_%s'>";
-    }
-
-    $link = "<a href='?plug=".$_GET['plug']."&act=edit&id=%s'>%s</a>";
-    foreach($this->Zones as $zone => $values ){
-      $ZoneList->AddEntry(array(
-            array("string" => sprintf($link,base64_encode($zone),($zone))),
-            array("string" => sprintf($link,base64_encode($zone),_("Reverse zone")." : ".($values['ReverseZone']))),
-            array("string" => _("TTL")." : ".$values['sOAttl']),
-            array("string" => _("Class")." : ".$values['dNSClass']),
-            array("string" =>str_replace("%s",base64_encode($zone),$editImg))
-            ));
-    }    
-
-    /* Display tempalte 
-     */
-    $smarty->assign("ZoneList",$ZoneList->DrawList());
-    $display.= $smarty->fetch(get_template_path('servdns.tpl', TRUE));
-    return($display);
-  }
-
-
-  /* Delete specified zone
-   */
-  function RemoveZone($id)
-  {
-    $zones =  $this->getUsedZoneNames();
-
-    if(isset($this->Zones[$id]['InitialReverseZone'])){
-      $rev = FlipIp($this->Zones[$id]['InitialReverseZone']);
-    }else{
-      $rev = FlipIp($this->Zones[$id]['ReverseZone']);
-    }
-
-    $zonename = "";
-    if(isset($this->Zones[$id]['InitialzoneName'])){
-      $zonename= $this->Zones[$id]['InitialzoneName'];
-    }
-
-    $used = array();
-
-    /* Add Records which use this zoneName
-     */
-    if(isset($zones[$zonename])){
-      $used = array_merge($used,$zones[$zonename]);
-    }
-
-    /* Add Records which uses this reverse zone
-     */
-    if(isset($zones[$rev.".in-addr.arpa"])){
-      $used = array_merge($used,$zones[$rev.".in-addr.arpa"]);
-    } 
-
-    /* There are still entries using this configuration
-     *  Abort deletion
-     */
-    if(count($used)){
-      $i = 2;
-      $str ="";
-      foreach($used as $dn){
-        if($i > 0 && !preg_match("/,relativeDomainName=/",$dn)){
-          $i --;
-          $name = preg_replace("/^[^=]+=([^,]*),.*$/","\\1",$dn);
-          $zone = preg_replace("/^.*zoneName=([^,]*),.*$/","\\1",$dn);
-          $str.= $name.".".$zone." ";
-        }
-      }
-
-      /*  Only show 2 dns in the error message 
-       */
-      if(count($used)> 2) {
-        $str .=" ... ";
-      }
-      print_red(sprintf(_("Can't delete the selected zone, because it is still in use by these entry/entries '%s'"),trim($str)));
-      return(false);
-    }else{
-      unset($this->Zones[$id]);
-      return(true);
-    }
-  } 
-
-
-  /* This funtion returns all used Zonenames 
-   */
-  function getUsedZoneNames()
-  {
-    $ret = array();
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(&(objectClass=dNSZone)(!(relativeDomainName=@))(zoneName=*))",array("zoneName","relativeDomainName"));
-    while($attr = $ldap->fetch()){
-      $ret[$attr['zoneName'][0]][] = $attr['dn'];
-    }
-    return($ret);
-  }
-
-
-  /* Remove dns service 
-   */
-  function remove_from_parent()
-  {
-    if($this->initially_was_account){
-      $bool = true;
-      $this->is_account = FALSE;
-      foreach($this->Zones as $key => $zone){
-        $bool= $bool & $this->RemoveZone($key);
-      }
-
-      if($bool){
-        $this->save();
-      }
-      return($bool);
-    }
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-
-    /* Take over handling
-     * - Create list of zones managed by source server 
-     * - Copy ldap entries to destination server 
-     * - Remove old zone entries from source
-     */
-    if($this->take_over_id != -1){
-      $del = array();
-      $id = $this->take_over_id;
-      $src = $this->dns_server_list['ENTRIES'][$id]['dn'];
-      $ldap = $this->config->get_ldap_link(); 
-      $ldap->ls("(objectClass=dnsZone)",$src,array('cn'));
-      while($attrs = $ldap->fetch()){
-        $src_zone = $attrs['dn'];
-        $dst_zone = preg_replace("/".normalizePreg($src)."$/",$this->dn,$src_zone);
-        $res = plugin::recursive_move($src_zone, $dst_zone);
-
-        if($res){
-          $del [] = $src_zone;
-        }
-      }
-      foreach($del as $src_zone){
-        $ldap->rmdir_recursive($src_zone);
-      }
-      return;
-    }
-
-    /* Save zone editor changes now */
-    foreach($this->Zones as $name => $zone){
-      if(isset($zone['zoneEditor'] ) && $zone['zoneEditor'] != NULL && is_object($zone['zoneEditor'])){
-        $zone['zoneEditor']->save();
-        unset($this->Zones[$name]['zoneEditor']);;
-      }
-    }
-
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);  
-  
-    /* Get differences 
-     */
-    $old_dn = $this->orig_dn;
-    if($old_dn == "new"){
-      $old_dn = $this->dn;
-    }
-
-    $tmp = getDNSZoneEntriesDiff($this->config,$this->Zones,$old_dn);
-
-    /* Update dns to current object dn */ 
-    $tmp = getDNSZoneEntriesDiff($this->config,$this->Zones,$old_dn);
-    $tmp2 = array();
-    foreach($tmp as $key1 => $data1){
-      $tmp2[$key1] = array();
-      foreach($data1 as $key2 => $data2){
-        $tmp2[$key1][preg_replace("/".normalizePreg($old_dn)."$/",$this->dn,$key2)] = $data2;
-      }
-    }
-    $tmp = $tmp2;
-
-    /* Updated zone entries if reverser or forward name has changed  
-     * Must be done before moving entries, else the given dn is invalid
-     */
-    if(isset($tmp['zoneUpdates'])){
-      foreach($tmp['zoneUpdates'] as $dn => $attrs){
-        $ldap->cd($dn);
-        $ldap->modify($attrs);
-        new log("modfiy","unknown/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-        show_ldap_error($ldap->get_error(), sprintf(_("Updating of system server/dns with dn '%s' failed."),$this->dn));
-      }
-    }
-
-    /* Delete dns 
-     */
-    foreach($tmp['del'] as $dn => $del){
-
-      $for = $del['InitialzoneName'];
-      $rev = FlipIp($del['InitialReverseZone']).".in-addr.arpa";
-
-      $ldap->cd($dn);
-      $ldap->rmdir_recursive($dn);
-      new log("remove","unknown/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-      show_ldap_error($ldap->get_error(), sprintf(_("Removing of system server/dns with dn '%s' failed."),$this->dn));
-
-      /* Handle Post events */
-      if(preg_match("/^zoneName=/",$dn)){
-#        $this->handle_post_events("remove",array("dn" => $dn,"zoneName" => $for));
-#        $this->handle_post_events("remove",array("dn" => $dn,"zoneName" => $rev));
-      }
-    }
-
-    /* move follwoing entries
-     */
-    foreach($tmp['move'] as $src => $dst){
-      $this->recursive_move($src,$dst);
-    }
-
-    /* Add || Update new DNS entries
-     */
-    foreach($tmp['add'] as $dn => $attrs){
-      $ldap->cd($dn);
-      $ldap->cat($dn, array('dn'));
-      if($ldap->fetch()){
-        $ldap->cd($dn);
-        $ldap->modify ($attrs);
-        show_ldap_error($ldap->get_error(), sprintf(_("Saving of system server/dns with dn '%s' failed."),$this->dn));
-
-        /* Handle Post events */
-        if(preg_match("/^zoneName=/",$dn)){
-#          $this->handle_post_events("modify",array("dn" => $dn,"zoneName" => $attrs['zoneName']));
-        }
-      }else{
-        $ldap->cd($dn);
-        $ldap->add($attrs);
-        show_ldap_error($ldap->get_error(), sprintf(_("Saving of system server/dns with dn '%s' failed."),$this->dn));
-
-        /* Handle Post events */
-        if(preg_match("/^zoneName=/",$dn)){
-#          $this->handle_post_events("add",array("dn" => $dn,"zoneName" => $attrs['zoneName']));
-        }
-      }
-    }
-    $this->handle_post_events("modify");
-  }
-
-
-  /* Directly save new status flag */
-  function setStatus($value)
-  {
-    if($value == "none") return;
-    if(!$this->initially_was_account) return;
-    if(empty($this->StatusFlag)) return;
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->dn);
-    $ldap->cat($this->dn,array("objectClass"));
-    if($ldap->count()){
-
-      $tmp = $ldap->fetch();
-      for($i = 0; $i < $tmp['objectClass']['count']; $i ++){
-        $attrs['objectClass'][] = $tmp['objectClass'][$i];
-      }
-      $flag = $this->StatusFlag;
-      $attrs[$flag] = $value;
-      $this->$flag = $value;
-      $ldap->modify($attrs);
-      show_ldap_error($ldap->get_error(), sprintf(_("Set status flag for system server/dns with dn '%s' failed."),$this->dn));
-      $this->action_hook();
-    }
-  }
-
-
-  function getListEntry()
-  {
-    $fields               = goService::getListEntry(); 
-    $fields['Message']    = _("DNS service");
-    $fields['AllowEdit']  = true;
-    return($fields);
-  }
-
-
-  /* Get updates for status flag */
-  function updateStatusState()
-  {
-    if(empty($this->StatusFlag)) return;
-
-    $attrs = array();
-    $flag = $this->StatusFlag;
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->cn);
-    $ldap->cat($this->dn,array($flag));
-    if($ldap->count()){
-      $attrs = $ldap->fetch();
-    }
-    if(isset($attrs[$flag][0])){
-      $this->$flag = $attrs[$flag][0];
-    }
-  }
-
-
-  /* Return plugin informations for acl handling */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("DNS service"),
-          "plDescription" => _("DNS service")." ("._("Services").")",
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 83,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("server"),
-
-          "plProvidedAcls"=> array(
-            "zoneName"      =>_("Zone name"),
-            "ReverseZone"   =>_("Reverse zone"),
-            "sOAprimary"    =>_("Primary dns server"),
-            "sOAmail"       =>_("Mail address"),
-            "sOAserial"     =>_("Serial"),
-            "sOArefresh"    =>_("Refresh"),
-            "sOAretry"      =>_("Retry"),
-            "sOAexpire"     =>_("Expire"),
-            "sOAttl"        =>_("TTL"),
-            "zoneRecords"   =>_("Zone records"))
-    ));
-  }
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_servDNSeditZone.inc b/plugins/admin/systems/class_servDNSeditZone.inc
deleted file mode 100644 (file)
index d5df087..0000000
+++ /dev/null
@@ -1,603 +0,0 @@
-<?php
-
-class servdnseditZone 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("zoneName","ReverseZone","dNSClass",
-      "sOAprimary","sOAmail","sOAserial","sOArefresh","sOAretry","sOAexpire","sOAttl"); 
-  var $objectclasses  = array("whatever");
-
-  var $RecordTypes              = array();
-
-  var $ReverseZone              = "";
-  var $zoneName                 = "";
-  var $dNSClass                 = "IN";
-
-  var $sOAprimary               = "";
-  var $sOAmail                  = "";
-  var $sOAserial                = "";
-  var $sOArefresh               = "3600";
-  var $sOAretry                 = "1800";
-  var $sOAexpire                = "720000";
-  var $sOAttl                   = "6400";
-
-  var $Records                  = array();
-  var $mXRecords                = array();
-
-  var $OldZoneName              = ""; // To detect changes made with this edit
-  var $OldReverseZone           = "";
-
-  var $InitialReverseZone       = "";
-  var $InitialzoneName          = "";
-  var $NetworkClass                = "A" ; // One out of A,B,C
-
-  var $dialog                   = false;
-
-  var $zoneEditor               = NULL;
-
-  var $isNew                    = true;
-
-  var $ZoneObject               = array();
-
-  function servdnseditZone (&$config, $dn= NULL,$attrs = array())
-  {
-    plugin::plugin ($config, $dn);
-
-    /* All types with required attrs */
-    $this->RecordTypes = getDnsRecordTypes(true); 
-
-    if(!count($attrs)){
-      $this->OldZoneName        = "";
-      $this->OldReverseZone     = "";
-      $this->isNew              = true;
-      $this->sOAserial          = date("Ymd")."1";
-      
-      $this->InitialzoneName    = "";//$attrs['InitialzoneName'];
-      $this->InitialReverseZone = "";//$attrs['InitialReverseZone'];
-    }else{
-      $this->ZoneObject         = $attrs;
-
-      if(isset($attrs['zoneEditor'])){
-        $this->zoneEditor         = $attrs['zoneEditor'];
-      }
-      $this->OldZoneName        = $attrs['zoneName'];
-      $this->OldReverseZone     = $attrs['ReverseZone'];
-
-      $this->InitialzoneName    = $attrs['InitialzoneName'];
-      $this->InitialReverseZone = $attrs['InitialReverseZone'];
-
-      $this->isNew                  = false;
-
-      foreach($this->attributes as $value){
-        $this->$value = $attrs[$value];
-      }
-
-      $this->sOAmail            = preg_replace("/\./","@",$this->sOAmail,1);
-      $this->sOAmail            = preg_replace("/\.$/","",$this->sOAmail);
-      $this->sOAprimary         = preg_replace("/\.$/","",$this->sOAprimary);
-      $this->zoneName           = preg_replace("/\.$/","",$this->zoneName);
-
-      if(isset($attrs['RECORDS'])){
-        $this->Records = $attrs['RECORDS']; 
-
-        $tmp2 = array();
-        $usedPrio = array();
-        foreach($this->Records as $key => $rec){
-          if($rec['type'] == "mXRecord"){
-            $tmp = split(" ",$rec['value']);
-            $rec['value'] = $tmp[1];
-            $tmp2[$tmp[0]] = $rec;
-            unset($this->Records[$key]);
-          }
-          if($rec['type'] == "nSRecord"){
-            unset($this->Records[$key]);
-          }
-        }
-        if(count($tmp2) != 0){
-          reset($tmp2);
-          ksort($tmp2);
-        }
-        $this->mXRecords = $tmp2;
-      }else{
-        $this->mXRecords  = array();
-        $this->Records    = array();
-      }
-
-      $str = date("Ymd");
-      if(preg_match("/^".$str."/",$this->sOAserial)){
-        $this->sOAserial = $this->sOAserial + 1;
-      }else{
-        $this->sOAserial = date("Ymd")."01";
-      }
-    }
-
-    /* Detect Network class */
-    if(!empty($this->ReverseZone)){
-
-      $dots = count(split("\.",$this->ReverseZone));
-      if($dots == 1){
-        $this->NetworkClass = "A";  
-        $this->ReverseZone .= ".0.0.0"; 
-      }elseif($dots == 2){
-        $this->NetworkClass = "B";  
-        $this->ReverseZone .= ".0.0"; 
-      }else{
-        $this->NetworkClass = "C";  
-        $this->ReverseZone .= ".0"; 
-      }
-    }
-  }
-
-  /* TRansports the geiven Arraykey one position up*/
-  function ArrayUp($atr,$attrs)
-  {
-    $ret = $attrs;
-    $pos = $atr ;
-    $cn = count($attrs);
-    if(!(($pos == -1)||($pos == 1)||($pos >$cn))){
-      $before = array_slice($attrs,0,($pos-2));
-      $mitte  = array_reverse(array_slice($attrs,($pos-2),2));
-      $unten  = array_slice($attrs,$pos);
-      $ret = array();
-      $ret = $this->combineArrays($before,$mitte,$unten);
-    }
-    return($ret);
-  }
-
-
-  /* TRansports the geiven Arraykey one position up*/
-  function ArrayDown($atr,$attrs)
-  {
-    $ret = $attrs;
-    $pos = $atr ;
-    $cn = count($attrs);
-    if(!(($pos == -1)||($pos == $cn))){
-      $before = array_slice($attrs,0,($pos-1));
-      $mitte  = array_reverse(array_slice($attrs,($pos-1),2));
-      $unten  = array_slice($attrs,($pos+1));
-      $ret = array();
-      $ret = $this->combineArrays($before,$mitte,$unten);
-    }
-    return($ret);
-  }
-
-  /* Combine new array */
-  function combineArrays($ar0,$ar1,$ar2)
-  {
-    $ret = array();
-    if(is_array($ar0))
-    foreach($ar0 as $ar => $a){
-        $ret[]=$a;
-    }
-    if(is_array($ar1))
-    foreach($ar1 as $ar => $a){
-        $ret[]=$a;
-    }
-    if(is_array($ar2))
-    foreach($ar2 as $ar => $a){
-        $ret[]=$a;
-    }
-    return($ret);
-  }
-  
-  function getpos($atr,$attrs)
-  {
-    $i = 0;
-    foreach($attrs as $attr => $name)    {
-      $i++;
-      if($attr == $atr){
-        return($i);
-      }
-    }
-    return(-1);
-  }
-
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-
-
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-    $ui = get_userinfo();
-
-    $smarty->assign("ACLs",$this->parent->getacl(""));
-    $display= "";
-
-    /* Open Zone Entry Edit Dialog
-     */
-    if(!count($this->ZoneObject)){
-      $smarty->assign("AllowZoneEdit" , false);
-    }else{
-      $smarty->assign("AllowZoneEdit" , true);
-      if(isset($_POST['EditZoneEntries'])){
-        if($this->zoneEditor == NULL){
-          $this->zoneEditor= new servDNSeditZoneEntries($this->config,$this->dn,$this->ZoneObject);
-          $this->zoneEditor->parent = $this;
-        }
-        $this->dialog = $this->zoneEditor;
-      }
-    }
-
-    /* Save Zone Entry Edit Dialog
-     */
-    if(isset($_POST['SaveZoneEntryChanges'])){
-      $this->dialog->save_object();
-      if(count($this->dialog->check())){
-        $msgs = $this->dialog->check();
-        foreach($msgs as $msg){
-          print_red($msg);
-        }
-      }else{
-        $this->zoneEditor = clone $this->dialog;
-        $this->dialog = FALSE;
-#       $rev = FlipIp(getNameFromMix($this->InitialReverseZone)).".in-addr.arpa";
-#       $for = getNameFromMix($this->InitialzoneName);
-#      
-#       $this->parent->handle_post_events("modify",array("dn" => $this->dn,"zoneName" => $rev));
-#       $this->parent->handle_post_events("modify",array("dn" => $this->dn,"zoneName" => $for));
-#       $this->dialog = false;
-      }
-    }
-
-    /* Cancel Zone Entrie Edit Dialog
-    */
-    if(isset($_POST['CancelZoneEntryChanges'])){
-      $this->dialog = false;
-    }
-
-    /* Display any type of open dialogs 
-     */
-    if(is_object($this->dialog)){
-      $this->dialog->save_object();
-      return($this->dialog->execute());
-    }
-
-    $once =true;
-    foreach($_POST as $name => $value){
-      if((preg_match("/^MXup_/",$name)) && ($once)){
-        $once = false;
-
-        $id = preg_replace("/^MXup_/","",$name);
-        $id = preg_replace("/_.*$/","",$id);
-        $id = base64_decode($id);
-    
-        $this->mXRecords = $this->ArrayUp(($id+1),$this->mXRecords);
-      }
-      if((preg_match("/^MXdown_/",$name)) && ($once)){
-        $once = false;
-        
-        $id = preg_replace("/^MXdown_/","",$name);
-        $id = preg_replace("/_.*$/","",$id);
-        $id = base64_decode($id);
-  
-        $this->mXRecords = $this->ArrayDown(($id+1),$this->mXRecords);
-      }
-      if((preg_match("/^MXdel_/",$name)) && ($once)){
-        $once = false;
-        
-        $id = preg_replace("/^MXdel_/","",$name);
-        $id = preg_replace("/_.*$/","",$id);
-        $id = base64_decode($id);
-        
-        unset($this->mXRecords[$id]);
-
-        $tmp  =array();
-        foreach($this->mXRecords as $entry){
-          $tmp[] = $entry;
-        }
-        $this->mXRecords = $tmp; 
-      }
-    }
-
-    if((isset($_POST['AddMXRecord'])) && (!empty($_POST['StrMXRecord']))){
-      $this->mXRecords[] = array("type"=>"mXRecord","value"=>trim($_POST['StrMXRecord']));      
-    }
-
-    /* Handle Post events */
-    $once = true;
-    foreach($_POST as $name => $value){
-
-      /* Delete record if requested */
-      if((preg_match("/RemoveRecord_/",$name))&&($once)){
-        $once = false;
-        $id= preg_replace("/RemoveRecord_/","",$name);
-        unset($this->Records[$id]);
-      }
-    }
-
-    /* Add new Zonerecord */
-    if(isset($_POST['AddNewRecord'])){
-      $this->Records[] = array("type"=>"aRecord","value"=>"");
-    }
-
-    /* Fill in values */
-    foreach($this->attributes as $name){
-      $smarty->assign($name,$this->$name);
-    }
-
-
-    $div = new divSelectBox("MxRecords");
-    $div->setHeight(120);
-    $recs = $this->mXRecords;
-
-    $oneup    = "<input name='MXup_%s'    type='image' src='images/sort_up.png'    title='"._("Up")."'      class='center'>&nbsp;"; 
-    $onedown  = "<input name='MXdown_%s'  type='image' src='images/sort_down.png'  title='"._("Down")."'    class='center'>&nbsp;"; 
-    $onedel   = "<img src='images/empty.png' width='20' class='center'>
-                 <input name='MXdel_%s'   type='image' src='images/edittrash.png'  title='"._("Delete")."'  class='center'>"; 
-
-    foreach($recs as $key => $rec){
-      $div ->AddEntry(array(
-            array("string"=>$rec['value']),
-/*            array("string"=>$key,
-                  "attach"=>"style='width:20px;'"),*/
-            array("string"=>str_replace("%s",base64_encode($key),$oneup.$onedown.$onedel),
-                  "attach"=>"style='width:70px;border-right:0px;'")
-            ));
-    }
-
-    /* Assign records list */
-    $smarty->assign("NotNew", false);
-    $smarty->assign("Mxrecords",  $div->DrawList());
-    $smarty->assign("records"  ,  $this->generateRecordsList());
-    $smarty->assign("NetworkClass",  $this->NetworkClass);
-    $smarty->assign("NetworkClasses",  array("A"=>"255.0.0.0 (Class A)","B"=>"255.255.0.0 (Class B)","C"=>"255.255.255.0 (Class C)"));
-
-    /* Display tempalte */
-    $display.= $smarty->fetch(get_template_path('servdnseditzone.tpl', TRUE));
-    return($display);
-  }
-
-  function remove_from_parent()
-  {
-  }
-
-  /* Save data to object */
-  function save_object()
-  {
-    //plugin::save_object();
-    foreach($this->attributes as $attr){
-      if(isset($_POST[$attr])){
-        $this->$attr = $_POST[$attr];
-      }
-    }
-
-    foreach($this->Records as $id => $value){  
-      if(isset($_POST['RecordTypeSelectedFor_'.$id])){
-        $this->Records[$id]['type'] = $_POST['RecordTypeSelectedFor_'.$id];
-      }
-      if(isset($_POST['RecordValue_'.$id])){
-        $this->Records[$id]['value'] = $_POST['RecordValue_'.$id];
-      }
-    }
-
-     if(isset($_POST['NetworkClass'])){
-       $this->NetworkClass = $_POST['NetworkClass'];
-     }
-
-  }
-
-
-  /* Check supplied data */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-        
-    /* Check if zoneName is already in use */
-    $usedZones = $this->getUsedZoneNames();
-    if(($this->isNew == true)||($this->zoneName  != $this->InitialzoneName)||($this->ReverseZone != $this->InitialReverseZone)){
-    /*  if((isset($usedZones[$this->zoneName]))&&($this->zoneName  != $this->InitialzoneName)){
-        $message[] =_("This zoneName is already in use");
-      }
-      if((in_array($this->ReverseZone,$usedZones))&&($this->ReverseZone != $this->InitialReverseZone)){
-        $message[] =_("This reverse zone is already in use");
-      }*/
-    }
-
-    if(empty($this->zoneName)){
-      $message[] =sprintf(_("Please choose a valid zone name."));
-    }
-
-    if(empty($this->ReverseZone)){
-      $message[] =sprintf(_("Please choose a valid reverse zone name."));
-    }
-
-    if($this->zoneName != strtolower($this->zoneName)){
-      $message[] = _("Only lowercase strings are allowed as zone name.");
-    }
-
-    if(!is_numeric($this->sOAserial)){
-      $message[] = _("Please specify a numeric value for serial number.");
-    }
-
-    if(!is_numeric($this->sOArefresh)){
-      $message[] = _("Please specify a numeric value for refresh.");
-    }
-
-    if(!is_numeric($this->sOAttl)){
-      $message[] = _("Please specify a numeric value for ttl.");
-    }
-
-    if(!is_numeric($this->sOAexpire)){
-      $message[] = _("Please specify a numeric value for expire.");
-    }
-
-    if(!is_numeric($this->sOAretry)){
-      $message[] = _("Please specify a numeric value for retry.");
-    }
-
-    foreach($this->Records as $name => $values){
-      /* only lower-case is allowed in record entries ... */
-      if($values['value'] != strtolower($values['value'])){
-        $message[] = sprintf(_("Only lowercase is allowed, please check your '%ss'."),$values['type']);
-      }
-    }
-
-    /* Check class for given Zone Address */
-    $addr = preg_replace("/^[^\/]*+\//","",$this->ReverseZone);
-  
-    /* Check for valid&complete IP address */
-    if(!is_ip($addr)){
-      $message[] = _("The given network address is not a valid, please specify a valid IP address.");
-    }
-    /* Check if given address matches selected network class */
-    switch($this->NetworkClass){
-      case 'A': { 
-                  if(!preg_match("/^[0-9]*\.0\.0\.0$/",$addr)){
-                    $message[] = sprintf(_("The specified network address is not matching with the specified zone class, try it this way x.0.0.0"));
-                  }
-                }
-                break;
-      case 'B': {
-                  if(!preg_match("/^[0-9]*\.[0-9]*\.0\.0$/",$addr)){
-                    $message[] = sprintf(_("The specified network address is not matching with the specified zone class, try it this way x.x.0.0"));
-                  }
-                }
-                break;
-      case 'C': {
-                  if(!preg_match("/^[0-9]*\.[0-9]*\.[0-9]*\.0$/",$addr)){
-                    $message[] = sprintf(_("The specified network address is not matching with the specified zone class, try it this way x.x.x.0"));
-                  }
-                }
-                break;
-      default : $message[] =sprintf(_("The given network class '%s' is not valid."),$this->NetworkClass);
-    }
-
-    return ($message);
-  }
-
-  /* This funtion returns all used Zonenames */
-  function getUsedZoneNames()
-  {
-    $ret = array();
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(&(objectClass=dNSZone)(relativeDomainName=@)(zoneName=*))",array("zoneName","tXTRecord"));
-    while($attr = $ldap->fetch()){
-      if(preg_match("/in-addr\.arpa/",$attr['zoneName'][0])){
-        if(isset($attr['tXTRecord'][0])){
-          $zn = preg_replace("/zoneName\=/","",$attr['tXTRecord'][0]);
-          $ret[$zn] =FlipIp(preg_replace("/\.in-addr\.arpa/","",$attr['zoneName'][0]));
-        }
-      }else{
-        $ret[$attr['zoneName'][0]]="";
-      }
-    }
-    return($ret);
-  }
-
-  /* Save to LDAP */
-  function save()
-  {
-    $ret =array();
-    foreach($this->attributes as $name){
-      $ret[$name] = $this->$name;
-    }
-
-    /* Create mx records 
-     */
-    foreach($this->mXRecords as $key => $rec){
-      $rec['value']= $key." ".$rec['value'];
-      $this->Records [] = $rec;
-    }
-
-  
-    $ret['RECORDS'] = $this->Records; 
-    switch($this->NetworkClass){
-      case 'C' : $ret['ReverseZone']= preg_replace("/\.[0-9]*$/","",$this->ReverseZone);break;
-      case 'B' : $ret['ReverseZone']= preg_replace("/\.[0-9]*\.[0-9]*$/","",$this->ReverseZone);break;
-      case 'A' : $ret['ReverseZone']= preg_replace("/\.[0-9]*\.[0-9]*\.[0-9]*$/","",$this->ReverseZone);break;
-      default : trigger_error("Invalid network class given '".$this->NetworkClass."'");
-    }
-
-    $ret['InitialReverseZone']=  $this->InitialReverseZone;
-    $ret['InitialzoneName']   =  $this->InitialzoneName;
-
-    $ret['sOAmail']            = preg_replace("/\@/",".",$this->sOAmail);
-
-    foreach(array("sOAprimary","zoneName","sOAmail") as $attr){
-      if(!preg_match("/\.$/",$ret[$attr])){
-        if(!is_ip($ret[$attr])){
-          $ret[$attr] = $ret[$attr].".";
-        }
-      }
-    }
-
-    $ret['RECORDS'][] = array("type" => "nSRecord","value" => $ret['sOAprimary']) ;
-
-    $ret['zoneEditor'] = $this->zoneEditor;
-    return($ret);
-  }
-
-  
-  /* This function generate a table row for each used record.
-     This table row displays the recordtype in a select box
-      and the specified value for the record, and a remove button.
-     The last element of the table also got an 'add' button.
-   */
-  function generateRecordsList($changeStateForRecords="")
-  {
-    $changeStateForRecords = "";
-
-    $str = "<table summary=''>";
-    foreach($this->Records as $key => $entry){
-
-      if($entry['type'] == "mXRecord") continue;
-      
-      $changeStateForRecords.= "changeState('RecordTypeSelectedFor_".$key."');\n";
-      $changeStateForRecords.= "changeState('RecordValue_".$key."');\n";
-      $changeStateForRecords.= "changeState('RemoveRecord_".$key."');\n";
-
-      $str.=" <tr>".
-        "   <td>".$this->generateRecordListBox($entry['type'],"RecordTypeSelectedFor_".$key)."</td>".
-        "   <td><input type='text' value='".$entry['value']."' name='RecordValue_".$key."' id='RecordValue_".$key."'></td>".
-        "   <td><input type='submit' name='RemoveRecord_".$key."' value='"._("Delete")."' id='RemoveRecord_".$key."'></td>".
-        "</tr>";
-    }
-
-    $str.= "  <tr>".
-      "    <td colspan=2></td><td>".
-      "      <input type='submit' value='"._("Add")."' name='AddNewRecord'>".
-      "    </td>".
-      "  </tr>".
-      "</table>";
-    return($str);
-  }
-
-  /* This function generates a select box out of $this->RecordTypes options.
-     The Parameter $selected is used to predefine an attribute.
-     $name is used to specify a post name
-   */
-  function generateRecordListBox($selected,$name)
-  {
-    $str = "<select name='".$name."' id='".$name."'>";
-    foreach($this->RecordTypes as $type => $value){
-
-      if(preg_match("/^mXRecord$/i",$value)) continue;
-
-      $use = "";
-      if($type == $selected){
-        $use = " selected ";
-      }
-      $str.="\n <option value='".$type."' ".$use.">".strtoupper(preg_replace("/record/i","",$type))."</option>";
-    }
-    $str.="</select>";
-    return($str);
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_servDNSeditZoneEntries.inc b/plugins/admin/systems/class_servDNSeditZoneEntries.inc
deleted file mode 100644 (file)
index 8453ae7..0000000
+++ /dev/null
@@ -1,498 +0,0 @@
-<?php
-
-class servDNSeditZoneEntries 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("whatever");
-
-  var $Devices            = array();
-
-  var $zoneName           = "";   // ZoneName of currently edited Zone
-  var $reverseName        = "";   // ReverseZone of the currently edited Zone
-
-  var $RecordTypes        = array();  // Possible record type.
-
-  var $disableDialog      = false; // Dialog will be disabled, if this zone is new 
-
-  function servDNSeditZoneEntries (&$config,$dn, &$zoneObject)
-  {
-    plugin::plugin ($config, $dn);
-
-    /* Initialise class
-     */
-    $this->RecordTypes  = getDnsRecordTypes();
-    $this->dn           = "zoneName=".$zoneObject['InitialzoneName'].",".$dn; 
-    $this->zoneName     = $zoneObject['InitialzoneName'];
-    $this->reverseName  = $zoneObject['InitialReverseZone'];
-
-    /* Remove nSRecord from listed types */
-    if(isset($this->RecordTypes['nSRecord'])){
-      unset($this->RecordTypes['nSRecord']);
-    }
-    /* Remove nSRecord from listed types */
-    if(isset($this->RecordTypes['pTRRecord'])){
-      unset($this->RecordTypes['pTRRecord']);
-    }
-
-    /* Get ldap connection 
-     */
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-
-    /* Get zone content
-     */
-    $ldap->ls("(&(objectClass=dNSZone)(!(relativeDomainName=@)))",$this->dn,array("relativeDomainName"));
-    
-    while($attrs = $ldap->fetch()){
-      $this->Devices[$attrs['relativeDomainName'][0]] = getDNSHostEntries($config,$attrs['relativeDomainName'][0],true);
-      $this->Devices[$attrs['relativeDomainName'][0]]['OrigCn'] = $attrs['relativeDomainName'][0];
-    }
-
-    $ldap->cat($this->dn,array("objectClass"));
-
-    $this->disableDialog = true;
-    if(count($this->Devices)|| $ldap->count()){
-      $this->disableDialog = false;
-    }
-  }
-
-  function execute()
-  {
-    plugin::execute();
-
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-    $display= "";
-
-    $table = "";
-    foreach($this->Devices as $key => $dev){
-      $table .= $this->generateRecordConfigurationRow($key);
-    }
-
-    $smarty->assign("disableDialog",$this->disableDialog);
-    $smarty->assign("table",$table);;
-    $display.= $smarty->fetch(get_template_path('servDNSeditZoneEntries.tpl', TRUE));
-    return($display);
-  }
-
-
-  function save_object()
-  {
-    /* Check posts for operations ...  
-     */
-    $once = true;
-    $ptr_updates = array();
-    foreach($_POST as $name => $value){
-
-      /* Add a new Record in given object  
-       */
-      
-      $tmp    = preg_replace("/^.*_(.*)_.*$/","\\1",$name);
-      $tmp2   = split("\|",$tmp);
-
-      /* Add new host entry
-       */
-      if((preg_match("/^UserRecord_?/",$name)) && ($once)){
-        $once = false;
-        $entry = getDNSHostEntries($this->config,"",true);     
-        $entry['exists']    = true;
-        $entry['zoneName']  = strtoupper($this->attrs['cn'][0])."/".$this->zoneName; 
-        $entry['RECORDS'][] = array("type" => "aRecord" , "value"=>"");
-        $this->Devices[_("New entry")] = $entry;
-      }
-
-      if(count($tmp2) != 2) continue;
-
-      $Name     = base64_decode($tmp2[0]);
-      $RecordID = $tmp2[1];
-
-      /* Add new REcord
-       */
-      if((preg_match("/^AddRecord_/",$name)) && ($once)){
-        $once = false;
-        $this->Devices[$Name]['RECORDS'][] = $this->Devices[$Name]['RECORDS'][$RecordID];
-      }
-
-      /* Remove record from given dn
-       */
-      if((preg_match("/^RemoveRecord_/",$name)) && ($once)){
-        $once   = false;
-        if(isset($this->Devices[$Name]['RECORDS'][$RecordID])){
-          unset($this->Devices[$Name]['RECORDS'][$RecordID]);
-        }
-
-        /* Check if there is at least one visible record. Else remove complete entry */
-        $visible = false;
-        foreach($this->Devices[$Name]['RECORDS'] as $rec){
-          if(in_array($rec['type'],$this->RecordTypes)){
-            $visible = true;  
-            break;
-          }
-        }
-        if(!$visible && isset($this->Devices[$Name]['RECORDS'])){
-          $this->Devices[$Name]['RECORDS'] = array();
-        }
-      }
-    }
-
-    /* Possible attributes posted 
-     */
-    foreach($_POST as $name => $value){
-
-      /* Extract informations out of post name 
-       */
-      $tmp    = preg_replace("/^.*_/","\\1",$name);
-      $tmp2   = split("\|",$tmp);      
-      if(count($tmp2) != 2) continue;
-
-      $Name     = base64_decode($tmp2[0]);
-      $RecordID = $tmp2[1];
-
-      /* Check for value change 
-       */          
-      if(preg_match("/ValueSelection_/",$name)){
-        if(isset($this->Devices[$Name]['RECORDS'][$RecordID])){
-         
-          /* Update value */ 
-          $old = $this->Devices[$Name]['RECORDS'][$RecordID]['value'];
-          $this->Devices[$Name]['RECORDS'][$RecordID]['value'] = $value;
-
-          /* Handle pTRRecord */
-          if(!isset($ptr_updates[$Name]) && $this->Devices[$Name]['RECORDS'][$RecordID]['type'] == "aRecord"){
-    
-            $found = false;
-            $ip = $value;
-            $match = preg_replace("/^[^\/]*+\//","",$this->reverseName);
-            $ip = preg_replace("/^".normalizePreg($match)."/","",$ip);
-            $ip = preg_replace("/^\./","",$ip);
-
-            foreach($this->Devices[$Name]['RECORDS'] as $key => $dev){
-              if($dev['type'] == "pTRRecord"){
-                $ptr_updates[$Name] = $Name;
-                $this->Devices[$Name]['RECORDS'][$key]['value'] = $ip;
-                $found = true;
-                break;
-              }
-            }
-            if(!$found){
-              $dev = array('type'=> 'pTRRecord', 'value' => $ip);
-              $this->Devices[$Name]['RECORDS'][] = $dev;
-            }
-          }
-        }
-      }
-
-      /* record type changed
-       */        
-      if(preg_match("/^RecordTypeSelection_/",$name)){
-        if(isset($this->Devices[$Name]['RECORDS'][$RecordID])){
-          $this->Devices[$Name]['RECORDS'][$RecordID]['type'] = $value;
-        }  
-      }   
-    }
-    
-    /* check for renamed entries 
-     */ 
-    foreach($_POST as $name => $value){
-
-      /* Extract informations out of post name 
-       */
-      $tmp    = preg_replace("/^.*_/","\\1",$name);
-      $tmp2   = split("\|",$tmp);      
-      if(count($tmp2) != 2) continue;
-
-      $Name     = base64_decode($tmp2[0]);
-      $RecordID = $tmp2[1];
-
-      /* Host renamed
-       */
-      if(preg_match("/RenameHost_/",$name)){
-        if((isset($this->Devices[$Name])) && ($Name != $value)){
-    
-          if(isset($this->Devices[$value])){
-            print_red(sprintf(_("Can't rename '%s' to '%s' there is already an entry with the same name in our zone editing dialog."),$Name,$value));
-          }else{
-            $this->Devices[$value] = $this->Devices[$Name];
-            unset($this->Devices[$Name]);
-          }
-        }
-      }
-    }
-  }
-
-
-  /*  check something 
-   */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-    
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-
-    $names = array();
-    foreach($this->Devices as $DevName => $device){
-
-      /* Don't need to check empty values ... */
-      if(!count($device['RECORDS'])) continue;
-
-      /* Checking entry name
-       */
-      if(!preg_match("/^[a-z0-9_\.-]+$/i", $DevName) || (empty($DevName))){
-        $message[] = sprintf(_("Entry name '%s' contains invalid characters."), $DevName);
-      }      
-
-      /* Renaming check for existing devices 
-       */
-      if(isset($device['OrigCn'])  && ($DevName != $device['OrigCn'] )){
-        $ldap->cd($this->config->current['BASE']);
-        $ldap->search("(relativeDomainName=".$DevName.")",array("relativeDomainName"));
-        if($ldap->count()){
-          $message[] = sprintf(_("Can not rename '%s' to '%s',the destination name already exists."),$device['OrigCn'],$DevName);
-        }
-      }elseif(!isset($device['OrigCn'])){
-        $ldap->cd($this->config->current['BASE']);
-        $ldap->search("(relativeDomainName=".$DevName.")",array("relativeDomainName"));
-        if($ldap->count()){
-          $message[] = sprintf(_("Can not create '%s',the destination name already exists."),$DevName);
-        }
-      }
-
-      /* Check names 
-       */
-      if(!isset($names[$DevName])){
-        $names[$DevName] = "";
-      }else{
-        $message[] = sprintf(_("The name '%s' is used more than once."),$DevName);
-      }
-
-      /* Names should be written in lowercase
-       */
-#      if(strtolower($DevName) != $DevName){
-#        $message[] = sprintf(_("The host name '%s' should be written in lowercase."), $DevName);
-#      }
-
-      /* Check records
-       */                 
-      $singleEntries = array("cNAMERecord","pTRRecord");
-
-      $tmp  = array();
-      $tmp2 = array();
-      foreach($device['RECORDS'] as $Num => $Rec){
-
-        /* Check for multiple use of unique record types
-         */
-        if(in_array($Rec['type'],$singleEntries)){
-          if(!isset($tmp[$Rec['type']])){
-            $tmp[$Rec['type']] = "";
-          }else{
-            $message[] = sprintf(_("The record type '%s' is a unique type and can't be defined twice."),$Rec['type']);
-          }
-        }
-
-        /* Check for empty / duplicate entries in record array 
-         */
-        if(empty($Rec['value'])){
-          $message[] = sprintf(_("There is an empty '%s' for host '%s'."),$Rec['type'],$DevName);
-        }
-
-        /* Check for duplicate record entries 
-         */
-        if(!isset($tmp[$Rec['type']][$Rec['value']])){
-          $tmp[$Rec['type']][$Rec['value']] = "";
-        }else{
-          $message[] = sprintf(_("There is a duplicate entry in '%s' for '%s'."),$Rec['type'],$DevName); 
-        }
-      }
-    }
-    return ($message);
-  }
-
-  function save()
-  {
-    if($this->disableDialog) return;
-
-    $todo = array(); 
-
-
-
-    /* Create todolist
-     */
-    foreach($this->Devices as $name => $dev){
-      if(isset($dev['OrigCn'])){
-        if(count($dev['RECORDS'])){
-          $todo[] = getDNSHostEntriesDiff($this->config,$dev['OrigCn'],$dev,$name);
-        }else{
-          $dev['exists'] = false;
-          $todo[] = getDNSHostEntriesDiff($this->config,$dev['OrigCn'],$dev,$name);
-        }
-      }else{
-        if(count($dev['RECORDS'])){
-          $todo[] = getDNSHostEntriesDiff($this->config,"",$dev,$name);
-        }else{
-          $dev['exists'] = false;
-          $todo[] = getDNSHostEntriesDiff($this->config,"",$dev,$name);
-        }
-      }
-    }
-
-    $tmp = array();
-    $tmp['del']   = array();
-    $tmp['add']   = array();
-    $tmp['move']  = array();
-    foreach($todo as $to){
-      foreach($to as $type => $entries){
-        $tmp[$type] = array_merge($tmp[$type],$entries);
-      }
-    }
-
-    /* Get ldap link
-     */
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd ($this->config->current['BASE']);
-
-    /* move follwoing entries
-     */
-    foreach($tmp['move'] as $src => $dst){
-      $this->recursive_move($src,$dst);
-    }
-
-    /* Delete dns */
-    foreach($tmp['del'] as $dn => $del){
-      $ldap->cd($dn);
-      $ldap->rmdir_recursive($dn);
-      if(is_object($this->parent->parent)){
-        $this->parent->parent->handle_post_events("remove",array("dn" => $dn));
-      }
-    }
-
-    /* Add || Update new DNS entries
-     */
-    foreach($tmp['add'] as $dn => $attrs){
-      $ldap->cd($dn);
-      $ldap->cat($dn, array('dn'));
-      if(count($ldap->fetch())){
-        $ldap->cd($dn);
-        $ldap->modify ($attrs);
-        if(is_object($this->parent->parent)){
-          $this->parent->parent->handle_post_events("modify",array("dn" => $dn));
-        }
-      }else{
-        $ldap->cd($dn);
-        $ldap->add($attrs);
-        if(is_object($this->parent->parent)){
-          $this->parent->parent->handle_post_events("create",array("dn" => $dn));
-        }
-      }
-    }
-  }
-
-
-  /* Create html table out of given entry 
-   */
-  function generateRecordConfigurationRow($objKey){
-
-    /* Get some basic informations 
-     */
-    $obj        = $this->Devices[$objKey];
-    $objectName = $objKey;
-
-    /* Abort if emtpy
-     */
-    if(count($obj['RECORDS']) == 0) return "";
-
-    /* Set title 
-     */
-    $str= "<br>";
-
-    $hostNameOnce = true;
-
-    /* Walk through all defined records 
-     */
-    $str.= "<table cellspacing='0' cellpadding='0'>";
-    foreach($obj['RECORDS'] as $id => $record){
-
-      /* Skip not selectable entries */
-      if(!isset($this->RecordTypes [$record['type']])) {
-        continue;
-      }
-
-      /* Create unique post name
-       */
-      $name = base64_encode($objKey)."|".$id;
-
-      $str .= "<tr><td style='width:170px;'>\n";
-
-      /* Only first host entry name should be editable
-       */
-      if($hostNameOnce){
-        $hostNameOnce = false;  
-        $str .="<input type='text' name='RenameHost_".$name."' value='".$objectName."'>\n";
-      }
-
-      /* Create rest. Selectbox, icons ...
-       */
-      $str .="
-        </td>
-        <td style='width:90px;'>
-          ".$this->createRecordTypeSelection($record['type'],$name)."
-        </td>
-        <td>
-          <input type='text'  value='".$record['value']."' name='ValueSelection_".$name."' style='width:250px;'>
-        </td>
-        <td style='width:75px;text-align:right;'>
-          <input type='image' name='AddRecord_".$name."'   src='images/list_new.png' alt='"._("Add")."' title='"._("Add")."'>
-          <input type='image' name='RemoveRecord_".$name."' src='images/edittrash.png'      alt='"._("Remove")."' title='"._("Remove")."'>
-        ";
-
-#        if($record['type'] == "aRecord"){
-#          $str .="<input type='image' name='AddPtr_".$name."' src='images/network.png' 
-#                    alt='"._("Add PTR")."' title='"._("Add PTR record")."'>";
-#        }else{
-#          $str .= "<img src='images/empty.png' alt=''>";
-#        }
-
-      $str.=
-        "</td>
-      </tr>";
-    }
-    $str .="</table>";
-    return($str); 
-  }
-
-
-  /* Create selectbox with all available option types 
-   */
-  function createRecordTypeSelection($id,$refID){
-
-    $str = "\n<select name='RecordTypeSelection_".$refID."'>";
-    foreach($this->RecordTypes as $type => $atr) {
-      if($id == $type){
-        $str .="\n<option value='".$type."' selected >".strtoupper(preg_replace("/record/i","",$type))."</option>";
-      }else{
-        $str .="\n<option value='".$type."'>".strtoupper(preg_replace("/record/i","",$type))."</option>";
-      }
-    }
-    $str.= "\n</select>";
-    return($str);
-  }
-
-
-  function remove_from_parent()
-  {
-  }
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_servKolab.inc b/plugins/admin/systems/class_servKolab.inc
deleted file mode 100644 (file)
index 7d31ff5..0000000
+++ /dev/null
@@ -1,415 +0,0 @@
-<?php
-
-class servkolab extends goService {
-  /* 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");
-
-  var $postfix_mydomain                 = "";
-  var $cyrus_admins                     = "";
-  var $postfix_mydestination            = "";
-  var $postfix_mynetworks               = "127.0.0.1/8";
-  var $postfix_enable_virus_scan        = "TRUE";
-  var $postfix_relayhost                = "";
-  var $postfix_mxrelayenabled           =  true;
-  var $postfix_allow_unauthenticated     = "FALSE";
-  var $cyrus_quotawarn                  = "80";
-  var $kolabFreeBusyFuture              = "1";
-  var $k                                = "kolab";
-  var $cyrus_imap                       = "TRUE";
-  var $cyrus_pop3                       = "FALSE";
-  var $cyrus_imaps                      = "TRUE";
-  var $cyrus_pop3s                      = "TRUE";
-  var $cyrus_sieve                      = "TRUE";
-  var $apache_allow_unauthenticated_fb  = "TRUE";
-  var $proftpd_ftp                      = "FALSE";
-  var $apache_http                      = "TRUE";
-  var $kolabHost                        = array();
-  var $orig_cn                          = "";
-  var $view_logged                      = FALSE;
-
-  var $attributes =  array("postfix_mydomain", "postfix_mydestination", "proftpd_ftp", "k",
-      "postfix_mynetworks", "postfix_enable_virus_scan", "postfix_relayhost", "apache_http",
-      "postfix_allow_unauthenticated", "cyrus_admins", "cyrus_imap","kolabFreeBusyFuture",
-      "cyrus_pop3", "cyrus_imaps", "cyrus_pop3s", "cyrus_sieve", "apache_allow_unauthenticated_fb",
-      "cyrus_quotawarn");
-  var $objectclasses = array("top", "kolab");
-
-  /* Serverservice vars */
-  var $conflicts    = array("goImapServer","goMailServer");
-  var $DisplayName  = "Kolab mail service";
-  var $StatusFlag   = "";
-
-  function servkolab(&$config, $dn = NULL, $parent= NULL) 
-  {
-    /* Setting the hostname and tell this Plugin that we are the kolab extension*/
-    $this->hostname = preg_replace('/^cn=([^,]+),.*$/', '\1', $dn);
-    $this->dn       = "k=kolab,".$config->current['BASE'];
-
-    /* Load variables, if given*/
-    plugin::plugin($config, $this->dn);
-
-    /* Copy needed attributes */
-    foreach($this->attributes as $val) {
-      $name = preg_replace('/_/', '-', $val);
-      if (isset($this->attrs["$name"][0])) {
-        $this->$val = $this->attrs["$name"][0];
-      }
-    }
-
-    /* Toggle relayhost */
-    $this->postfix_mxrelayenabled = preg_match('/^\[/', $this->postfix_relayhost);
-    $this->postfix_relayhost      = preg_replace("/[\[\]]/","",$this->postfix_relayhost);
-
-    /* Is this Server a member of the Kolab extension or not ?*/ 
-    if(isset($this->attrs['kolabHost'])) {
-      $this->kolabHost= $this->attrs['kolabHost'];
-      unset($this->kolabHost['count']);
-    }
-    $this->is_account            = false;
-    $this->initially_was_account = false;
-    foreach($this->kolabHost as $host){
-      if($this->hostname == $host){
-        $this->is_account            = true;
-        $this->initially_was_account = true;
-      }
-    } 
-  }
-
-
-  function execute() 
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","server/".get_class($this),$this->dn);
-    }
-
-    /***************  
-      Variable initialisation
-     ***************/  
-    
-    $smarty     = get_smarty();
-    $display    = "";
-    $ldap       = $this->config->get_ldap_link();
-
-
-    /* Assemble free/busy string */
-    $edit       = sprintf('<input name="kolabFreeBusyFuture" value="%s" type="text" maxlength="3" size="4">',
-                    $this->kolabFreeBusyFuture);
-    $fbfuture   = sprintf(_("Include data from %s days in the past when creating free/busy lists"), $edit);
-
-    /* Assemble quota string */
-    $edit       = sprintf('<input name="cyrus_quotawarn" value="%s" type="text" maxlength="3" size="4">',
-                    $this->cyrus_quotawarn);
-    $quotastr   = sprintf(_("Warn users when using more than %s%% of their mail quota"), $edit);
-
-    /***************
-      Assign informations to smarty 
-     ***************/
-
-    /* Set relayhost and if we have MX lookup enabled*/ 
-    if($this->postfix_mxrelayenabled) {
-      $smarty->assign("RelayMxSupportCheck"," checked ");
-    } else {
-      $smarty->assign("RelayMxSupportCheck","");
-    }
-
-    /* Set acls */
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translation){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-
-    /* Initialize all attributes, that were submitted */
-    foreach($this->attributes as $val) 
-    {
-      /* Tell smarty which variables we are useing */
-      $smarty->assign($val, $this->$val);
-      if (($this->$val != "FALSE") && !empty($this->$val)){
-        $smarty->assign($val."Check", "checked");
-      } else {
-        $smarty->assign($val."Check", "");
-      }
-    }
-
-    $smarty->assign("fbfuture", $fbfuture);
-    $smarty->assign("quotastr", $quotastr);
-
-    /* Load Template */
-    $display.=$smarty->fetch(get_template_path('servkolab.tpl', TRUE));
-    return ($display);
-  }
-
-  function remove_from_parent() 
-  {
-
-     /* Remove status flag, it is not a memeber of
-        this->attributes, so ensure that it is deleted too */
-    if(!empty($this->StatusFlag)){
-      $this->attrs[$this->StatusFlag] = array();
-    }
-
-
-    /* Only walk through following code, if this host 
-       was a member of the kolab hosts, else skip this */
-    if(!$this->initially_was_account){
-      return;
-    }
-
-    /* !!! Don't use "cn" in this function 
-       hostname -> the initial name of the host
-       cn       -> is the new name of the host, in case that it was renamed.
-     */
-
-    $ldap     = $this->config->get_ldap_link();
-    $this->dn = "k=kolab,".$this->config->current['BASE'];
-
-    /* We can't simply remove the whole entry, it is possible that there are 
-       some other hosts assigned to this object. 
-       So, first of all check if we are the last host entry within the host 
-       : Remove k=kolab entry 
-       if we aren't alone, only remove host name from hosts entry and save */
-    /* Are we alone? Remove complete entry... */
-
-    /* Check if we are definitly in kolabHosts */
-    if(!in_array_ics($this->hostname,$this->kolabHost)) {
-      return;
-    }
-
-    /* Integration check, not translated because they can't pop up at all, only for debug */ 
-    if(count($this->kolabHost) == 0){
-      print_red("Server - Kolab tab : This is not possible, we can't remove an account which doesn't exists.");
-      return;
-    }
-    if(!isset($this->hostname) || (empty($this->hostname))){
-      print_red("The required attribute hostname seams to empty.");
-    }
-
-    /* Our hostname is in kolabHosts and there is a only one entry 
-       = we are the last host entry, delete k=kolab entry  */
-    if (count($this->kolabHost) == 1){
-
-      /* Remove complete entry */
-      $ldap->rmdir ($this->dn);
-      show_ldap_error($ldap->get_error(), sprintf(_("Removing host entry from system server/kolab with dn '%s' failed."),$this->dn));
-    } else {
-
-      /* Only modify kolabHost */
-      $hosts= array();
-      foreach ($this->kolabHost as $host){
-        if($host != $this->hostname){
-          $hosts[]= $host;
-        }
-      }
-      $attrs= array('kolabHost' => $hosts);
-      $ldap->cd($this->dn);
-      $this->cleanup();
-      $ldap->modify ($attrs); 
-      show_ldap_error($ldap->get_error(), sprintf(_("Removing host entry from system server/kolab with dn '%s' failed."),$this->dn));
-    }
-
-    new log("remove","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-
-    /* Optionally execute a command after we're done */
-    $this->handle_post_events("remove");
-  }
-
-
-  function save_object()    
-  {
-    if (isset($_POST['kolabtab'])){
-      plugin::save_object();
-
-
-      foreach($this->attributes as $attr){
-        if(($this->acl_is_writeable(preg_replace("/_/","",$attr))) && (isset($_POST[$attr]))){
-          $this->$attr = $_POST[$attr];
-        }
-      }
-
-      /* Save checkboxes */
-      foreach (array( "postfix_enable_virus_scan", "postfix_allow_unauthenticated",
-            "cyrus_imap", "cyrus_pop3", "cyrus_imaps",
-            "cyrus_pop3s", "cyrus_sieve", "apache_allow_unauthenticated_fb",
-            "proftpd_ftp", "apache_http") as $cb){
-
-        if($this->acl_is_writeable(preg_replace("/_/","",$cb))){
-          if (isset($_POST[$cb])){
-            $this->$cb= "TRUE";
-          } else {
-            $this->$cb= "FALSE";
-          }
-        }
-      }
-
-      /* Toggell relay check */
-      if($this->acl_is_writeable("postfixmxrelayenabled")){
-        $this->postfix_mxrelayenabled= isset($_POST['RelayMxSupport']);
-      }
-    }
-
-  }
-
-
-  function check() 
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    if(($this->kolabFreeBusyFuture==""))    {
-      $message[] = _("Future days in Free/Busy settings must be set.");
-    }elseif(!is_uid($this->kolabFreeBusyFuture) || $this->kolabFreeBusyFuture < 0){
-      $message[] = _("Future days in Free/Busy settings must be a positive value.");
-    }
-
-    if(!is_int((int)($this->cyrus_quotawarn))) {
-      $message[] = _("The given Quota settings value must be a number.");
-    }elseif(!(($this->cyrus_quotawarn<=100)&&($this->cyrus_quotawarn>=0))){
-      $message[] = _("Please choose a value between 1 and 100 for Quota settings.");
-    }elseif(strcasecmp($this->cyrus_quotawarn,(int)$this->cyrus_quotawarn)){
-      $message[] = _("Future days must be a value.");
-    }
-
-    if(empty($this->postfix_mynetworks)) { 
-      $message[] = _("No SMTP privileged networks set.");
-    }
-
-    /*if(empty($this->postfix_relayhost)) {
-      $message[] = _("No SMTP smarthost/relayhost set.");
-      }
-     */
-
-    return ($message);
-  }
-
-
-  /* Save to LDAP */
-  function save() 
-  {
-    /* Set ldap connection */
-    $ldap       = $this->config->get_ldap_link();
-
-    /* Open current dn*/
-    $this->dn   = "k=kolab,".$this->config->current['BASE'];
-
-    /* Adapt relayhost */
-    $this->postfix_relayhost= preg_replace('/[\[\]]/', '', $this->postfix_relayhost);
-    if ($this->postfix_mxrelayenabled && $this->postfix_relayhost != ""){
-      $this->postfix_relayhost= "[".$this->postfix_relayhost."]";
-    }
-
-    /* Check if this server was renamed, in this case we have to remove old cn first*/
-    if($this->hostname != $this->cn){
-      $tmp = array();
-      if(in_array_ics($this->hostname,$this->kolabHost)){
-        foreach($this->kolabHost as $host){
-          if($host != $this->hostname){
-            $tmp[] = $host;
-          }
-        }
-        $this->kolabHost = $tmp;
-      }
-    }
-
-    /* Add ourselves to the list of kolabHost's if needed */
-    if (!in_array_ics($this->cn,$this->kolabHost)){
-      $this->kolabHost[]= $this->cn;
-    }
-
-    /* Call parents save to prepare $this->attrs */
-    plugin::save();
-
-    /* Save or modify? */
-    $ldap->cat($this->dn, array('dn'));
-    if (!$ldap->fetch()){
-      $mode= "add"; 
-    } else {
-      $mode= "modify";
-    }
-
-    /* Do attribute conversion */
-    foreach ($this->attrs as $key => $value){
-      if (preg_match('/_/', $key)){
-        $old_key= $key;
-        $key= preg_replace('/_/', '-', $key);
-        $this->attrs[$key]= $value;
-        unset($this->attrs[$old_key]);
-      }
-    }
-    /* Add kolab hosts */
-    $this->attrs['kolabHost']= $this->kolabHost;
-
-    /* Perform LDAP action */
-    $ldap->cd($this->dn);
-    $this->cleanup();;
-    $ldap->$mode($this->attrs);
-
-    if($mode == "add"){
-      new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }else{
-      new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }
-
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving system server/kolab with dn '%s' failed."),$this->dn));
-
-    /* Optionally execute a command after we're done */
-    if ($this->initially_was_account == $this->is_account) {
-      if ($this->is_modified) {
-        $this->handle_post_events("modify");
-      }
-    } else {
-      $this->handle_post_events("add");
-    }
-  }
-
-
-  function getListEntry()
-  {
-    $fields                 = goService::getListEntry();
-    $fields['Message']      = _("Kolab mail service");
-    $fields['AllowEdit']    = true;
-    return($fields);
-  }
-
-
-  /* Return plugin informations for acl handling */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("Kolab"),
-          "plDescription" => _("Kolab mail service")." ("._("Services").")",
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 85,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("server"),
-
-          "plProvidedAcls"=> array(
-            "postfixmydomain"                => _("Postfix mydomain") ,
-            "postfixmydestination"           => _("My destination") ,
-            "cyrusadmins"                    => _("Cyrus admins") ,
-            "proftpdftp"                     => _("FTP FreeBusy service") ,
-            "postfixmynetworks"              => _("SMTP privileged networks") ,
-            "postfixenablevirusscan"         => _("Enable virus scan") ,
-            "postfixrelayhost"               => _("Relayhost") ,
-            "postfixmxrelayenabled"          => _("Enable MX lookup for relayhost"),
-            "apachehttp"                     => _("HTTP FreeBusy service") ,
-            "apacheallowunauthenticatedfb"   => _("Allow unauthenticated free busy"),
-            "postfixallowunauthenticated"    => _("Accept Internet Mail") ,
-            "cyrusimap"                      => _("IMAP service") ,
-            "kolabFreeBusyFuture"            => _("kolabFreeBusyFuture") ,
-            "cyruspop3"                      => _("POP3 service") ,
-            "cyrusimaps"                     => _("IMAP/SSL service") ,
-            "cyruspop3s"                     => _("POP3/SSL service") ,
-            "cyrussieve"                     => _("Sieve service") ,
-            "cyrusquotawarn"                 => _("Quota settings")) 
-            ));
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_servNfs.inc b/plugins/admin/systems/class_servNfs.inc
deleted file mode 100644 (file)
index 1386de1..0000000
+++ /dev/null
@@ -1,267 +0,0 @@
-<?php
-
-class servnfs extends plugin
-{
-  /* CLI vars */
-  var $cli_summary      = "Manage server 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("description","type","charset","path","option", "volume");
-  var $objectclasses    = array("whatever");
-  var $is_account       = true;
-
-  var $name          ="";  // Name of  
-  var $description   ="";  // description
-  var $type          ="";  // Type FS/Samba/NCP
-  var $charset       ="";  // charset
-  var $host       ="";  // hostname
-  var $types         =array();  // Array Types NFS/Samba/NCP/netatalk
-  var $charsets      =array();  // Array with charsets
-  var $path          ="";  // Path
-  var $volume        ="";  // Volume
-  var $option        ="";  // Options
-  var $is_edit           =false;
-  var $create_mount_init = false; //mount entry set for this entry (while editing)?
-  var $create_mount = false; //save mount entry
-
-  var $parent       = NULL;
-  var $view_logged  = FALSE;
-
-  function servnfs (&$config, $parent,$entry= false,$mount =false)
-  {
-    $this->parent = $parent;
-    $dn = $parent->dn;
-    plugin::plugin ($config, $dn);
-
-    $this->types   = array("CIFS" => "CIFS", "NFS"=>"NFS","samba"=>"samba","netatalk"=>"netatalk","NCP"=>"NCP");
-    if($dn){
-      $this->host = substr($dn, 3, strpos($dn, ',')-3);
-    }
-
-    $this->charsets = array();
-
-    if(!file_exists(CONFIG_DIR."/encodings")){
-      print_red(sprintf(_("The file '%s/encodings' does not exist, can't get supported charsets."),CONFIG_DIR));
-    }else{
-      if(!is_readable(CONFIG_DIR."/encodings")){
-        print_red(sprintf(_("Can't read '%s/encodings', please check permissions."),CONFIG_DIR));
-      }else{
-        $fp = fopen(CONFIG_DIR."/encodings","r");
-        $i = 100;
-        while(!feof($fp)&&$i){
-          $i -- ;
-          $str = trim(fgets($fp,256));
-
-          /* Skip comments */
-          if(!preg_match("/^#/",$str)){
-            $arr = split("\=",$str);
-            if(count($arr)==2){
-              $this->charsets[$arr[0]]=$arr[1];
-            }
-          }
-        }
-      }
-    }
-
-    if($entry){
-      list($this->name, $this->description, $this->type, $this->charset,
-          $this->path, $this->option, $this->volume)= split("\|",$entry."|");
-      $this->is_edit          = true;
-
-    }else{
-      $this->attributes[] = "name";
-    }
-
-
-    $this->create_mount_init = $mount;
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","server/".get_class($this),$this->dn);
-    }
-
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-
-    $smarty->assign("charsets" ,$this->charsets);
-    $smarty->assign("types"    ,$this->types);
-
-    /* attrs to smarty*/
-    foreach($this->attributes as $attr){
-      $smarty->assign($attr,$this->$attr);
-    }
-
-    $tmp = $this->parent->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translation){
-      $smarty->assign($name."ACL",$this->parent->getacl($name));
-    }
-
-    $smarty->assign("name",$this->name);
-    if($this->is_edit){
-      $smarty->assign("nameACL", preg_replace("/w/","",$this->parent->getacl("name")));
-    } 
-    $smarty->assign("allow_mounts", $this->parent->allow_mounts);
-    $smarty->assign("mount_checked", "");
-
-    $smarty->assign("appleMountsACL",    $this->getacl("appleMounts"));
-
-    if (($this->type == "netatalk") || ($this->type == "NFS")) {
-      if ($this->create_mount_init) {
-        $smarty->assign("mount_checked", "checked");
-      } else {
-        $tmp = split(",", $this->dn);
-        $clip = $tmp[0] . ",ou=servers,ou=systems,";
-        $mountsdn = "cn=mounts," . substr($this->dn, strlen($clip));
-        switch ($this->type) {
-          case "netatalk" : {
-            $mountdn = "cn=".$this->host.":/".$this->name.",".$mountsdn;
-            break;
-          }
-          case "NFS" : {
-            $mountdn = "cn=".$this->host.":".$this->path.",".$mountsdn;
-            break;
-          }
-          default : {
-                      continue;
-                    }
-        }
-        $ldap = $this->config->get_ldap_link();
-        $ldap->cat($mountdn, array('dn'));
-        $attrs = $ldap->fetch();
-        if (count($attrs) > 0) {
-          $smarty->assign("mount_checked", "checked");
-        }
-      }        
-    }
-
-    $display= $smarty->fetch(get_template_path('servnfs.tpl', TRUE));
-    return($display);
-  }
-
-  function remove_from_parent()
-  {
-    /* This cannot be removed... */
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    if(isset($_POST['servnfs_posted'])){
-
-      foreach($this->attributes as $name){
-        if($this->parent->acl_is_writeable($name) && isset($_POST[$name])){
-          $this->$name = $_POST[$name];
-        }
-      }
-
-      if ((isset($_POST['netatalk_mount'])) && (($this->type == "netatalk") || ($this->type == "NFS"))) {
-        $this->create_mount = true;
-      } else {
-        $this->create_mount = false;
-      }
-    }
-  }
-
-
-  /* Check supplied data */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    // fixme : a check for the path ?  ? 
-    if(empty($this->path)){
-      $message[]=_("Please specify a valid path for your setup.");
-    }
-
-    // only 0-9a-z
-    if(!$this->is_edit){
-      if(!preg_match("/^[a-z0-9\._äüö]*$/ui",$this->name)){
-        $message[]=_("Please specify a valid name for your share.");
-      }
-      if(empty($this->name)){
-        $message[]=_("Please specify a name for your share.");
-      }
-    }
-
-    if(!empty($this->description) && preg_match("/^[^a-z0-9\._äüö\+ -]*$/ui",$this->description)){
-      $message[]=_("Description contains invalid characters.");
-    }
-
-    if(!empty($this->volume) && preg_match("/^[^a-z0-9\._äüö\+ -]*$/ui",$this->volume)){
-      $message[]=_("Volume contains invalid characters.");
-    }
-
-    if(preg_match("/\|/",$this->path)){
-      $message[]=_("Path contains invalid characters.");
-    }
-
-    if(!empty($this->option) && preg_match("/^[^a-z0-9\._äüö,=\+ -]*$/ui",$this->option)){
-      $message[]=_("Option contains invalid characters.");
-    }
-
-    /* remove a / at the end of the path, we neither need it there nor
-     * do we want to check for it later.
-     */
-    if(substr($this->path, -1, 1) == '/') {
-      $this->path=substr($this->path, 0, -1);
-    }
-
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(objectClass=goShareServer)", array("goExportEntry"));
-    while($test = $ldap->fetch()){
-      if($test['dn']==$this->dn)
-        continue;
-      if(isset($test['goExportEntry'])){
-        foreach($test['goExportEntry'] as $entry){
-          $tmp = split("\|",$entry);
-          if($tmp[0] == $this->name){
-            $message[]="Name already in use";
-          }
-        }
-      }
-    }
-    return ($message);
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    /* Everything seems perfect, lets 
-       generate an new export Entry 
-     */
-
-    $s_return = "";
-
-    $s_return.= $this->name."|";     
-    $s_return.= $this->description."|";     
-    $s_return.= $this->type."|";     
-    $s_return.= $this->charset."|";     
-    $s_return.= $this->path."|";     
-    $s_return.= $this->option."|";     
-    $s_return.= $this->volume;     
-
-    return(array($this->name=>$s_return));
-  }
-
-  function should_create_mount() {
-    return $this->create_mount;
-  }
-
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_servRepository.inc b/plugins/admin/systems/class_servRepository.inc
deleted file mode 100644 (file)
index 10321c0..0000000
+++ /dev/null
@@ -1,366 +0,0 @@
-<?php
-
-class servrepository extends goService
-{
-  /* 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("FAIrepository");
-  var $objectclasses          = array("FAIrepositoryServer");
-  
-  /* Repositories */
-  var $repositories          = array();
-  var $FAIrepository         = array();
-  var $conflicts             = array("FAIrepositoryServer");
-  var $DisplayName           = "";
-  var $StatusFlag            = "";
-  
-  var $view_logged            = FALSE;
-  var $fai_activated          = FALSE;
-
-  var $divlist = NULL;
-
-  function servrepository (&$config, $dn= NULL, $parent= NULL)
-  {
-    plugin::plugin ($config, $dn, $parent);
-
-    $this->DisplayName = _("Repository service");
-
-    /* Skip this if fai is deactivated */
-    $tmp= $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
-    if(!empty($tmp)){
-      $this->fai_activated = TRUE;    
-    }else{
-      return;
-    }
-
-    $this->repositories = array();
-    if(isset($this->attrs['FAIrepository'])){
-      for($i = 0; $i < $this->attrs['FAIrepository']['count']; $i++){
-        $tmp = split("\|",$this->attrs['FAIrepository'][$i]);
-        $tmp2 = array();  
-        $tmp3 = array();   
-
-        if(isset($tmp[1])){
-          $tmp2['ParentServer'] = $tmp[1];
-          if(empty($tmp[1])){
-            $tmp2['ParentServer'] = "none";
-          }
-        }else{
-          $tmp2['ParentServer'] = "none";
-        }
-
-        if(isset($tmp[0])){
-          $tmp2['Url']          = $tmp[0];
-        }else{
-          $tmp2['Url']          = "";
-        }
-  
-        if(isset($tmp[2])){
-          $tmp2['Release']      = $tmp[2];
-        }else{
-          $tmp2['Release']      = "";
-        }
-
-        if(isset($tmp[3])){
-          $tmp3 = split(",",$tmp[3]);
-          foreach($tmp3 as $sec){
-            $tmp2['Sections'][$sec]=$sec;
-          }    
-        }else{
-          $tmp['Section']=array();
-        }
-
-        $this->repositories[$tmp[2]]=$tmp2;      
-      }
-    }
-
-
-    /* Create divlist */
-    $this->divlist = new divListRepository($this->config,$this);
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","server/".get_class($this),$this->dn);
-    }
-
-    if(!$this->fai_activated){
-      $str = "<h2>"._("You can't use this plugin until FAI is activated.")."</h2>";
-      return $str;
-    }
-
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-    $smarty->assign("is_createable",$this->acl_is_createable());
-    $display= "";
-
-    /* Show tab dialog headers */
-    /*
-       ADD / EDIT Repository
-       Dialog Handling
-     */
-    $once = false;
-    if(isset($_POST['servRepository'])){
-      foreach($_POST as $name => $value){
-
-        if(preg_match("/AddRepository/",$name) && $this->acl_is_createable()){
-          $once = true;
-          $this->dialog = new servRepositorySetup($this->config,$this->dn);
-          $this->dialog->parent = $this;
-        }
-
-        if((preg_match("/^delete_/",$name)) && (!$once) && $this->acl_is_removeable()){
-          $once = true;
-          $value = preg_replace("/delete_/","",$name);
-          $value = base64_decode(preg_replace("/_.*$/","",$value));
-
-          $url = $this->repositories[$value]['Url'];
-          $release = $this->repositories[$value]['Release'];
-
-          $ldap = $this->config->get_ldap_link();
-          $ldap->cd ($this->config->current['BASE']);
-
-          $ldap->search("(&(objectClass=gotoWorkstation)(objectClass=FAIobject)(FAIdebianMirror=".$url."))",array("cn","FAIclass"));
-
-          $found = false;
-          $found_in = " ";
-          while($attrs = $ldap->fetch()){
-            foreach($attrs['FAIclass'] as $class){
-              if(preg_match("/".str_replace("/","\/",$release)."$/i",$class)){
-                $found = true;  
-                $found_in .= $attrs['cn'][0]." ";
-              }
-            }
-          }
-
-          if($found){
-            print_red(sprintf(_("You can't delete this release, it is still used by these workstations [%s]. Please solve this dependencies first, to keep data base consistency."),$found_in));
-          }else{
-            if(isset($this->repositories[$value])){
-              unset($this->repositories[$value]);
-            }
-          }
-        }
-
-        if((preg_match("/^edit_/",$name))&&(!$once)){
-          $value = preg_replace("/edit_/","",$name);
-          $value = base64_decode(preg_replace("/_.$/","",$value));
-
-          if(isset($this->repositories[$value])){
-
-            $ldap = $this->config->get_ldap_link();
-            $ldap->cd ($this->config->current['BASE']);
-
-            $url = $this->repositories[$value]['Url'];
-            $release = $this->repositories[$value]['Release'];
-
-            $ldap->search("(&(objectClass=gotoWorkstation)(objectClass=FAIobject)(FAIdebianMirror=".$url."))",array("cn","FAIclass"));
-
-            $found = false;
-            $found_in = " ";
-            while($attrs = $ldap->fetch()){
-              foreach($attrs['FAIclass'] as $class){
-                if(preg_match("/".str_replace("/","\/",$release)."$/i",$class)){
-                  $found = true;
-                  $found_in .= $attrs['cn'][0]." ";
-                }
-              }
-            }
-
-            if($found){
-              print_red(sprintf(_("Be careful editing this release, it is still used by these workstations [%s]."),$found_in));
-            } 
-
-            if(isset($this->repositories[$value])){
-              $once = true;
-              $obj = $this->repositories[$value];
-
-              /* to be able to detect if this was renamed */
-              $obj['initialy_was'] = $obj['Release'];
-              $this->dialog = new servRepositorySetup($this->config,$this->dn,$obj);
-              $this->dialog->parent = $this;
-            }
-          }
-        }
-      }
-    }
-    if((isset($_GET['act']))&&($_GET['act']=="open_repository")&&(isset($_GET['id']))){
-      $obj = $this->repositories[base64_decode($_GET['id'])];
-      $obj['initialy_was'] = $obj['Release'];
-      $this->dialog = new servRepositorySetup($this->config,$this->dn,$obj);
-      $this->dialog->parent = $this;
-    }
-
-    if(isset($_POST['repository_setup_save']) && is_object($this->dialog)){
-      $this->dialog->save_object();
-      if(($this->dialog->is_new_name())&&(isset($this->repositories[$this->dialog->GetName()]))){
-        print_red(_("This name is already in use."));
-      }else
-
-      if(count($this->dialog->check())!=0){
-        foreach($this->dialog->check() as $msg){
-          print_red($msg);
-        }
-      }else{
-        $obj = $this->dialog->save();
-        if($this->dialog->is_new_name()){
-          $oldname = $this->dialog->initialy_was;
-          $this->repositories[$obj['Release']]=$obj;        
-          unset($this->repositories[$oldname]);
-        }else{ 
-          $this->repositories[$obj['Release']]=$obj;        
-        }
-        $this->dialog = FALSE;
-        $this->is_dialog= false;
-      }
-    }
-
-    if(isset($_POST['repository_setup_cancel'])){
-      $this->dialog=FALSE;
-      $this->is_dialog = false;
-    }
-   
-    if(is_object($this->dialog)){
-      $this->dialog->save_object();
-      $this->is_dialog = true;
-      return($this->dialog->execute());
-    }
-
-    /*
-      Repository setup dialog handling /END
-    */
-
-
-    $link   = "<a href='?plug=".$_GET['plug']."&amp;act=open_repository&amp;id=%s'>%s</a>";
-    $edit   = "<input type='image' value='%s' name='edit_%s'   src='images/edit.png'>&nbsp;";
-   
-    /* Hide delete icon, if delete is not allowed */ 
-    if($this->acl_is_removeable()){
-      $delete = "<input type='image' value='%s' name='delete_%s' src='images/edittrash.png'>";
-    }else{
-      $delete = "<img src='images/empty.png' alt='&nbsp;'>";
-    }
-
-    $this->divlist->execute(); 
-    $this->divlist->setEntries($this->repositories);
-    $smarty->assign("Repositories",$this->divlist->Draw());
-    $display.= $smarty->fetch(get_template_path('servRepository.tpl', TRUE));
-    return($display);
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    plugin::save_object();
-    if(is_object($this->divlist)){
-      $this->divlist->save_object();
-    }
-  }
-
-
-  /* Check supplied data */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-    return ($message);
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    if(!$this->fai_activated) return;
-
-    plugin::save();
-
-    $arr = array();
-    foreach($this->repositories as $servername => $conf){
-      $str = "";
-      foreach($conf['Sections'] as $sec){
-        $str.=$sec.",";
-      }
-      $str=preg_replace("/,$/","",$str);
-        
-      if($conf['ParentServer']=="none"){
-        $conf['ParentServer'] ="";
-      }    
-    
-      $arr[]=$conf['Url']."|".$conf['ParentServer']."|".$conf['Release']."|".$str;
-    }
-    $this->attrs['FAIrepository'] = $arr;
-
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd ($this->config->current['BASE']);
-    
-    $ldap->cat($this->dn, array('dn'));
-    
-    if($ldap->count()){
-      $ldap->cd($this->dn);
-      $this->cleanup();
-      $ldap->modify ($this->attrs);       
-
-      $this->handle_post_events("modify");
-    }else{
-      $ldap->cd ($this->config->current['BASE']);
-      $ldap->create_missing_trees($this->dn);
-      $ldap->cd($this->dn);
-      $ldap->add($this->attrs);
-      $this->handle_post_events("add");
-    }
-
-    if($this->initially_was_account){
-      new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }else{
-      new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }
-  }
-
-
-  function getListEntry()
-  {
-    $fields = goService::getListEntry();
-    $fields['Message']    = _("Repository service");
-    $fields['AllowEdit']  = true;
-    $fields['AllowStart'] = $fields['AllowStop'] = $fields['AllowRestart'] = false;
-    return($fields);
-  }
-
-  /* Return plugin informations for acl handling */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("Repository"),
-          "plDescription" => _("Repository service")." ("._("Services").")",
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 84,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("server"),
-
-          "plProvidedAcls"=> array(
-              "cn"            => _("Name"),
-              "start"         => _("Start"),
-              "stop"          => _("Stop"),
-              "restart"       => _("Restart"),
-              "Release"       => _("Releases"),
-              "Section"       => _("Sections"),
-              "ParentServer"  => _("Parent server"),
-              "Url"           => _("Url"))
-            ));
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_servRepositorySetup.inc b/plugins/admin/systems/class_servRepositorySetup.inc
deleted file mode 100644 (file)
index 40f37b0..0000000
+++ /dev/null
@@ -1,225 +0,0 @@
-<?php
-
-class servRepositorySetup  extends plugin
-{
-  /* CLI vars */
-  var $cli_summary        = "Manage FAI repositories";
-  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("Release","ParentServer","Url","cn");
-  var $objectclasses    = array("whatever");
-
-  /* Attributes */
-  var $Release          = "";
-  var $ParentServer     = "";
-  var $Url              = "";   
-  var $Sections         = array();
-  var $ParentServers    = "";
-  var $initialy_was     = false;
-  var $cn               = "";
-  var $parent           = "";
-
-  function servRepositorySetup (&$config, $dn= NULL,$data = false)
-  {
-    plugin::plugin ($config, $dn);
-    if($data != false){
-      foreach(array("Sections","Release","Url","ParentServer","initialy_was") as $atr){
-        if(isset($data[$atr])){
-          $this->$atr = $data[$atr];
-        }
-      }
-    }
-  }
-
-  function GetName()
-  {
-    return($this->Release);
-  }
-  
-  function is_new_name()
-  {
-    if(!$this->initialy_was){
-      return(true);
-    }else{
-      if($this->Release != $this->initialy_was){
-        return(true);
-      }
-    }
-    return(false);
-  }
-
-  
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-
-    if((isset($_POST['AddSection']))&&(isset($_POST['SectionName']))&&(!empty($_POST['SectionName']))){
-
-      /* Replace multiple spaces with a single, and cut of white spaces (trim)*/
-      $val = preg_replace("/\ \ * /" , " ", trim($_POST['SectionName']));
-
-      /* check if there are more than one entry given ( "section1 section2 )*/
-      if(preg_match("/ /",$val)){
-
-        /* Generate list of new section names */
-        $vals = split(" ",$val);
-
-        /* Add new entries */
-        foreach($vals as $entry){
-          $entry = trim($entry);
-          $this->Sections[$entry]=$entry;
-        }
-      }else{
-        $this->Sections[$val]=$val;
-      }
-    }
-    
-    foreach($_POST as $name => $value){
-      if(preg_match("/^delete_/",$name)){
-
-        $val = preg_replace("/^delete_/","",$name);
-        $val = base64_decode(preg_replace("/_.*$/","",$val));
-
-        if(isset($this->Sections[$val])){
-          unset($this->Sections[$val]);
-        }
-      }
-    }
-
-    $divlist = new divSelectBox("servRepositorySetup");
-    $divlist->setHeight("220");
-
-    $dellink = "<input type='image' src='images/edittrash.png' title='delete' alt='delete' name='delete_%s' value='%s'>";
-
-    foreach($this->Sections as $sec){
-      $divlist->AddEntry(array(
-                              array("string"=>$sec),
-                              array("string"=>sprintf($dellink,base64_encode($sec),$sec),"attach"=>"style='border-right:0px;width:20px;'")
-                              ));
-    }
-  
-    $smarty->assign("Sections",$divlist->DrawList());
-
-    /* Get && assign acls */
-    $tmp = $this->parent->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translated){
-      $smarty->assign($name."ACL",$this->parent->getacl($name));
-    }
-
-    /* Assign values */
-    foreach($this->attributes as $attr){
-      $smarty->assign($attr       ,$this->$attr);
-    }
-  
-    $tmp = $this->getParentServers();
-    $smarty->assign("ParentServers"   ,$tmp);
-    $smarty->assign("ParentServerKeys",array_flip($tmp));
-
-    return($smarty->fetch(get_template_path('servRepositorySetup.tpl', TRUE)));
-  }
-
-  /* Save data to object */
-  function save_object()
-  {
-    if(isset($_POST['servRepositorySetup_Posted'])) {
-  
-      foreach($this->attributes as $attr){
-        if(($this->parent->acl_is_writeable($attr)) && (isset($_POST[$attr]))){
-          $this->$attr = $_POST[$attr];      
-        }
-      }
-    }
-  }
-
-
-  /* Check supplied data */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    if(empty($this->Release)){
-      $message[]=_("Please enter a value for 'release'.");
-    }
-
-    if(empty($this->Url)){
-      $message[] = _("Please specify a valid value for 'url'.");
-    }
-
-    return ($message);
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    $tmp = array();
-    $tmp['ParentServer']  = $this->ParentServer;
-    $tmp['Url']           = $this->Url;
-    $tmp['Release']       = $this->Release;
-    $tmp['Sections']      = $this->Sections;
-    return($tmp);
-  }
-
-  function getParentServers()
-  {
-    $ret = array();
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(objectClass=FAIrepositoryServer)",array("*"));
-    while($attr = $ldap->fetch()){
-      if($attr['cn'][0] == $this->cn) continue;
-      $ret[$attr['cn'][0]]= $attr['cn'][0];   
-    }
-
-    $ret = array_merge($ret,$this->GetHookElements());
-    
-    $ret['none']= "&nbsp;";
-    asort($ret);
-    return($ret);
-  }
-
-  /* this funtions calls a defined hook 
-      and parses all additional serverdata 
-   */
-  function GetHookElements()
-  {
-    $ret = array();
-    $cmd = $this->config->search("servrepository", "REPOSITORY_HOOK",array('tabs'));
-    if(!empty($cmd)){
-      $res = shell_exec($cmd);
-      $res2 = trim($res);
-      if(!$res){
-        print_red(sprintf(_("Can't execute specified REPOSITORY_HOOK '%s'. Please check your gosa.conf."),$cmd));
-      }elseif(empty($res2)){
-        print_red(sprintf(_("The specified REPOSITORY_HOOK '%s', specified in your gosa.conf, returns an empty string."),$cmd));
-      }else{  
-        $tmp = split("\n",$res);
-        foreach($tmp as $hook){
-          /* skip empty */
-          if(empty($hook)) continue;
-
-          if(preg_match("/;/",$hook)){ 
-            $hookinfo = split(";",$hook);
-            $ret[$hookinfo[0]] = $hookinfo[0];
-          }else{
-            $ret[$hook] = $hook;
-          }
-        }
-      }
-    }
-    return($ret);
-  }
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_termDNS.inc b/plugins/admin/systems/class_termDNS.inc
deleted file mode 100644 (file)
index 0259332..0000000
+++ /dev/null
@@ -1,1012 +0,0 @@
-<?php
-
-class termDNS extends plugin
-{
-  /* attribute list for save action */
-  var $ignore_account = true;
-  var $autonet        = false;
-
-  /* Basic informations 
-   */
-  var $attributes     = array("ipHostNumber","macAddress");
-  var $objectclasses  = array("whatever");
-
-  var $ipHostNumber   = "";    // IP address 
-  var $macAddress     = "";    // Mac address 
-
-  var $orig_ipHostNumber   = "";    // IP address 
-  var $orig_macAddress     = "";    // Mac address 
-
-  var $cn             = "";    // CN of currently edited device 
-  var $OrigCn         = "";    // Initial cn
-  var $IPisMust       = false;
-  var $MACisMust      = false;
-  var $dialog;
-
-  /* DCHP Attributes 
-   */
-  var $dhcpAttributes           = array("dhcpParentNode");
-  var $dhcpEnabled              = FALSE;
-  var $dhcp_is_Account          = FALSE;
-  var $dhcpParentNodes          = array();
-  var $dhcpParentNode           = "";
-  var $dhcpHostEntry            = array();
-  var $initial_dhcpParentNode   = "";
-  var $initial_dhcpHostEntry    = array();
-  var $initial_dhcp_is_Account  = FALSE;
-
-  var $used_ip_mac              = array();  
-
-  /* DNS attributes  
-   */
-  var $DNSattributes            = array("dNSClass","zoneName","dNSTTL");
-  var $DNS_is_account           = false;
-  var $initially_was_account = false;
-  var $dnsEntry                 = array();
-  var $DNSenabled               = false;
-  var $hide_dns_check_box       = FALSE;
-
-  /*  Terminal dns 
-   */
-  function termDNS (&$config, $parent,$objectClasses,$IPisMust = false)
-  {
-    /* We need to know which objectClasses are used, to store the ip/mac
-     * Because of different type of devices   
-     */ 
-    $this->parent         = $parent;
-    $this->objectclasses  =  $objectClasses;
-    $this->IPisMust       = $IPisMust;
-
-    plugin::plugin ($config, $parent->dn);
-
-    if(isset($this->attrs['cn'][0])){
-      $this->OrigCn = preg_replace("/\\\$\$/","",$this->attrs['cn'][0]);
-      $this->cn = preg_replace("/\\\$\$/","",$this->attrs['cn'][0]);
-    }
-
-    /************
-     * DHCP 
-     ************/
-
-    /* Hide all dhcp specific code, if dhcp plugin is not present in config */
-    $dhcpEnabled = FALSE;
-    if($this->config->search("servdhcp","class",array("tabs"))){
-      $this->dhcpEnabled = TRUE;
-    }
-    if($this->dhcpEnabled){
-      $this->dhcpParentNodes = $this->get_dhcp_parent_nodes();
-      $this->dhcpParentNode  = $this->get_dhcp_parent_node();
-      if($this->dhcpParentNode){
-        $this->dhcp_is_Account = TRUE;
-        $this->initial_dhcp_is_Account = TRUE;
-        $this->dhcpHostEntry  = $this->get_dhcp_host_entry();    
-      }
-      $this->initial_dhcpHostEntry = $this->dhcpHostEntry;
-      $this->initial_dhcpParentNode= $this->dhcpParentNode;
-    }
-
-
-    /************
-     * Autonetwork hook 
-     ************/
-    /* Do we have autonet support? */
-    if (isset($this->config->data['MAIN']['AUTO_NETWORK_HOOK'])){
-      $this->autonet= true;
-    }
-
-
-    /************
-     * DNS
-     ************/
-    /* Hide all dns specific code, if dns is not available 
-     */
-    $DNSenabled = false;
-    foreach($this->config->data['TABS']['SERVERSERVICE'] as $tab){
-      if(preg_match("/^servdns$/",$tab['CLASS'])){
-        $this->DNSenabled = true;
-      }
-    }
-    if(!$this->DNSenabled){
-      $this->DNS_is_account = false;
-      return;
-    }
-
-    if($this->DNSenabled){
-
-      /* Get Zones  
-       */
-      $this->Zones        = getAvailableZones($config);
-
-      /* Get Entry 
-       */
-      $this->dnsEntry     = getDNSHostEntries($config,$this->OrigCn);
-
-      /* Remove A record which equals $this->ipHostNumber
-       */
-      $ptr = $this->get_pTRRecord();
-      foreach($this->dnsEntry['RECORDS'] as $key => $rec){
-        if(($rec['type'] == "aRecord") && ($rec['value'] == $this->ipHostNumber)){
-          unset($this->dnsEntry['RECORDS'][$key]);
-        }
-        if(($rec['type'] == "pTRRecord") && ($rec['value'] == $ptr)){
-          unset($this->dnsEntry['RECORDS'][$key]);
-        }
-      }
-
-      /* Get Record types 
-       */
-      $this->RecordTypes  = getDnsRecordTypes();
-
-      /* If there is at least one entry in this -> types, we have DNS enabled 
-       */
-      if($this->dnsEntry['exists']){
-        $this->DNS_is_account = true;
-      }else{
-        $this->DNS_is_account = false;
-      }
-    }
-
-    /* Create a list of used mac and ip addresses */
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(|(macAddress=*)(ipHostNumber=*))",array("macAddress","ipHostNumber"));
-    while($attrs = $ldap->fetch()){
-      if(isset($attrs['ipHostNumber'][0])){
-        $this->used_ip_mac["ip:".$attrs['ipHostNumber'][0]] = "ip:".$attrs['ipHostNumber'][0];
-      }
-      if(isset($attrs['macAddress'][0])){
-        $this->used_ip_mac["mac:".$attrs['macAddress'][0]] = "mac:".$attrs['macAddress'][0];
-      }
-    } 
-
-    /* Save initial ip and mac values, to be able 
-        check if the used values are already in use */ 
-    $this->orig_ipHostNumber   = $this->ipHostNumber;  
-    $this->orig_macAddress     = $this->macAddress;
-    /* Store initally account settings 
-     */
-    $this->initially_was_account = $this->DNS_is_account;
-
-    if($this->DNS_is_account){
-      new log("view","unknown/".get_class($this),$this->dn);
-    }
-  }
-
-
-  function netmaskIsCoherent($idZone) 
-  {
-    $netmask = FlipIp(str_replace(".in-addr.arpa","",getNameFromMix($idZone)));
-    if(!strstr($this->ipHostNumber, $netmask)){
-      return false;
-    }else{
-      return true;
-    }
-  }
-
-
-  function getVarsForSaving($attrs) 
-  {
-    foreach($this->attributes as $attr){
-      if(!empty($this->$attr)){
-        $attrs[$attr] = $this->$attr;
-      }
-    }
-    return($attrs); 
-  }
-
-  function execute()
-  {
-         /* Call parent execute */
-    $smarty= get_smarty();
-
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translation){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-
-    $display= "";
-
-    $smarty->assign("staticAddress", ""); 
-    $smarty->assign("autonet", $this->autonet);
-    /* Check for autonet button */
-    if ($this->autonet && isset($_POST['autonet'])){
-      $cmd= $this->config->data['MAIN']['AUTO_NETWORK_HOOK'];
-      if(!empty($cmd) && $this->cn != ""){
-        $res = shell_exec($cmd." ".$this->cn);
-        if(!$res){
-          print_red(sprintf(_("Can't execute specified AUTO_NETWORK_HOOK '%s'. Please check your gosa.conf."),$cmd));
-        } else {
-          $res= split(';', trim($res));
-          if (isset($res[0]) && $res[0] != ""){
-            $this->ipHostNumber= $res[0];
-          }
-          if (isset($res[1]) && $res[1] != ""){
-            $this->macAddress= $res[1];
-          }
-        }
-      }
-    }
-    
-  
-    /**********
-     * DHCP Handling
-     **********/
-    if(isset($_POST['dhcpEditOptions'])){
-
-      if(count($this->dhcpHostEntry) == 0){
-        $this->dialog = new dhcpHost($this->dhcpParentNode,TRUE);
-      }else{
-        $this->dialog = new dhcpHost($this->dhcpHostEntry,TRUE);
-      }
-      $this->dialog->cn = $this->cn; 
-      $this->dialog->dhcpHWAddress = "ethernet ".$this->macAddress; 
-      if(!empty($this->ipHostNumber)){
-        $this->dialog->statements['fixed-address'] = $this->ipHostNumber; 
-      }
-    }
-
-    if(isset($_POST['cancel_dhcp'])){
-      $this->dialog = FALSE; 
-    }
-
-    if(isset($_POST['save_dhcp'])){
-      $this->dialog->save_object();
-      
-      $msgs = $this->dialog->check(array());
-      if(count($msgs)){
-        foreach($msgs as $msg){
-          print_red($msg);
-        }
-      }else{
-        $this->dhcpHostEntry = $this->dialog->save();
-        $this->dialog = FALSE; 
-      }
-    }
-
-    if(is_object($this->dialog)){
-      $this->dialog->save_object();
-      return($this->dialog->execute());
-    }
-    $smarty->assign("dhcpEnabled",    $this->dhcpEnabled);
-    $smarty->assign("dhcp_is_Account",$this->dhcp_is_Account);
-    $smarty->assign("dhcpParentNode", $this->dhcpParentNode);
-    $smarty->assign("dhcpParentNodes",$this->dhcpParentNodes);
-    $smarty->assign("dhcpParentNodeCnt",count($this->dhcpParentNodes));
-
-
-    /**********
-     * DNS Handling
-     **********/
-
-    /* There is no dns available
-     */
-    if($this->DNSenabled == false){
-
-      /* Is IP address must ? */
-      $smarty->assign("DNS_is_account",false);
-      $smarty->assign("IPisMust",(($this->IPisMust)||($this->DNS_is_account)));
-
-      /* Assign smarty all non DNs attributes */
-      foreach($this->attributes as $attr){
-        $smarty->assign($attr,$this->$attr);
-      }
-      $smarty->assign("staticAddress","<font class=\"must\">*</font>");
-
-      $display.= $smarty->fetch(get_template_path('network.tpl', TRUE));
-    }else{
-      $smarty->assign("DNS_is_account",true);
-
-      /* Add new empty array to our record list */
-      if(isset($_POST['AddNewRecord'])){
-        $this->dnsEntry['RECORDS'][]  =array("type"=>"aRecord","value"=>"");
-      }
-
-      /* propose_ip */
-      if(isset($_POST['propose_ip'])){
-        foreach($this->Zones as $key => $name){
-          if($name == $this->dnsEntry['zoneName']){
-            $net = FlipIp(str_replace(".in-addr.arpa","",getNameFromMix($key)));
-            $this->ipHostNumber = $this->generateRandomIp($net);
-          }
-        }
-      }
-
-      /* Handle all posts */
-      $only_once =true;
-      foreach($_POST as $name => $value){
-
-        /* Check if we have to delete a record entry */
-        if((preg_match("/RemoveRecord_/",$name))&&($only_once)) {
-
-          /* Avoid performing this once again */
-          $only_once = false;
-
-          /* Extract id for specified entry */
-          $id = preg_replace("/RemoveRecord_/","",$name);
-          $id = preg_replace("/_.*$/","",$id);
-
-          /* Delete this record, mark edited entries to be able to delete them */
-          if(isset($this->dnsEntry['RECORDS'][$id])){
-            unset($this->dnsEntry['RECORDS'][$id]);
-          }
-        }
-      }
-      /* Assign smarty all non DNs attributes */
-      foreach($this->attributes as $attr){
-        $smarty->assign($attr,$this->$attr);
-      }
-
-      /* Assign smarty all DNS attributes */
-      foreach($this->DNSattributes as $attr){
-        $smarty->assign($attr,$this->dnsEntry[$attr]);
-      }
-
-      /* Assign all needed vars */
-      $smarty->assign("DNSAccount",$this->DNS_is_account);
-      $smarty->assign("hide_dns_check_box",$this->hide_dns_check_box);
-  
-      $smarty->assign("Zones",$this->Zones);
-      $smarty->assign("ZoneCnt",count($this->Zones));
-      $smarty->assign("ZoneKeys",($this->Zones));
-      $smarty->assign("IPisMust",(($this->IPisMust)||($this->DNS_is_account)));
-
-      /* Create zone array */
-      $idZones = array();
-      foreach($this->Zones as $id => $zone){
-        if($this->netmaskIsCoherent($id)) {
-          $idZones[$id] = $zone;
-        }else{
-          $idZones[$id] = $zone."&nbsp;("._("Not matching").")";
-        }
-      }
-      $smarty->assign("Zones",$idZones);
-      $smarty->assign("ZoneKeys", $this->Zones);
-
-      $tmp = $this->generateRecordsList();
-
-      $changeStateForRecords = $tmp['changeStateForRecords'];
-
-      $smarty->assign("records",$tmp['str']);
-      $smarty->assign("changeStateForRecords",$changeStateForRecords);
-      $smarty->assign("staticAddress","<font class=\"must\">*</font>");
-
-      $display.= $smarty->fetch(get_template_path('network.tpl', TRUE));
-    }
-    return($display);
-  }
-
-
-  function remove_from_parent()
-  {
-    if($this->initially_was_account){
-
-      $ldap = $this->config->get_ldap_link();
-
-      $tmp = array();
-      $this->dnsEntry['exists'] = false;
-      $tmp = getDNSHostEntriesDiff($this->config,$this->OrigCn,$this->dnsEntry,$this->cn);
-
-      /* Delete dns */
-      foreach($tmp['del'] as $dn => $del){
-        $ldap->cd($dn);
-        $ldap->rmdir_recursive($dn);
-        new log("remove","unknown/".get_class($this),$dn);
-      }
-    }
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-
-    if(isset($_POST['network_tpl_posted'])){
-
-      /* Save all posted vars */
-      plugin::save_object();
-
-      /* Handle DHCP Posts*/
-      if($this->dhcpEnabled && isset($_POST['network_tpl_posted'])){
-        foreach($this->dhcpAttributes as $attr){
-          if(isset($_POST[$attr])){
-            $this->$attr = $_POST[$attr];
-          }
-        }
-        if(isset($_POST['dhcp_is_Account'])){
-          $this->dhcp_is_Account = TRUE;
-        }else{
-          $this->dhcp_is_Account = FALSE;
-        }
-      }
-
-      /* Ge all non dns attributes (IP/MAC)*/
-      foreach($this->attributes as $attr){
-        if(isset($_POST[$attr]) && $this->acl_is_writeable($attr)){
-          $this->$attr = $_POST[$attr];
-        }
-      }
-
-      /* Check if DNS should be enabled / disabled */
-      if($this->DNS_is_account && $this->acl_is_removeable() && !isset($_POST['DNS_is_account'])){
-        $this->DNS_is_account = false;
-      }elseif(!$this->DNS_is_account && $this->acl_is_createable() && isset($_POST['DNS_is_account'])){
-        $this->DNS_is_account = true;
-      }
-
-      /* Get dns attributes */
-      if(($this->DNSenabled) && (isset($_POST['network_tpl_posted']))){
-
-        /* Check for posted record changes */
-        if(is_array($this->dnsEntry['RECORDS']) && $this->acl_is_writeable("Records")){
-          foreach($this->dnsEntry['RECORDS'] as $key => $value){
-
-            /* Check if type has changed */
-            if(isset($_POST['RecordTypeSelectedFor_'.$key])){
-              $this->dnsEntry['RECORDS'][$key]['type'] = $_POST['RecordTypeSelectedFor_'.$key];
-            }
-            /* Check if value has changed */
-            if(isset($_POST['RecordValue_'.$key])){
-              $this->dnsEntry['RECORDS'][$key]['value'] = $_POST['RecordValue_'.$key];
-            }
-          }
-        }
-        /* Get all basic DNS attributes (TTL, Clas ..)*/
-        foreach($this->DNSattributes as $attr){
-          if(isset($_POST[$attr]) && $this->acl_is_writeable($attr)){
-            $this->dnsEntry[$attr] = $_POST[$attr];
-          }
-        }
-
-
-      }
-      if($this->hide_dns_check_box){
-        $this->DNS_is_account = true;
-      }
-    }
-  }
-
-
-  /* Check supplied data */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    if($this->dhcpEnabled && $this->dhcp_is_Account && $this->dhcpParentNode != "" && count($this->dhcpHostEntry) == 0){
-#      $message[] =_("You have not configured your dhcp settings yet.");
-    }
-    
-    /* Check if mac and ip are already used */
-    if(!empty($this->ipHostNumber) && $this->DNS_is_account && 
-        $this->ipHostNumber != $this->orig_ipHostNumber && 
-        in_array("ip:".$this->ipHostNumber,$this->used_ip_mac)){
-      $message[] =_("The specified IP address is already in use.");
-    }
-    if(!empty($this->macAddress) && $this->dhcp_is_Account && 
-        $this->macAddress != $this->orig_macAddress && 
-        in_array("mac:".$this->macAddress,$this->used_ip_mac)){
-      print_red(sprintf(_("The specified MAC address '%s' for this system '%s' is already in use."),$this->macAddress,$this->cn));
-    }
-
-    /* Check if ip must be given
-     */  
-    if(($this->IPisMust)||($this->DNS_is_account)){
-      if (empty($this->ipHostNumber)){
-        $message[]= _("The required field 'IP-address' is not set.");
-      }
-
-      if (!is_ip($this->ipHostNumber)){
-        $message[]= _("Wrong IP format in field IP-address.");
-      }
-    }
-
-    /* Check if mac is empty 
-     */
-    if ($this->macAddress == "" ){
-      $message[]= _("The required field 'MAC-address' is not set.");
-    }
-    if(!is_mac($this->macAddress)){
-      $message[]=(_("The given macaddress is invalid. There must be 6 2byte segments seperated by ':'."));
-    }
-
-    /* only perfrom this checks if this is a valid DNS account */
-    if($this->DNS_is_account){
-
-      $checkArray = array();
-      $onlyOnce   = array();
-
-      //  $onlyOnce['cNAMERecord'] = 0;
-       $tmp = array_flip($this->Zones);
-       $tmp2 = $tmp[$this->dnsEntry['zoneName']];
-       if(!$this->netmaskIsCoherent($tmp2)){ //this->dnsEntry['zoneName'])){
-         $tmp2 = preg_replace("/^.*\//","",$tmp2);
-         $message[] =sprintf(_("The specified IP address '%s' is not matching the selected reverse zone entry '%s'."),$this->ipHostNumber,$tmp2);
-       }
-
-      /* Walk through all entries and detect duplicates or mismatches
-       */  
-      foreach($this->dnsEntry['RECORDS'] as $name => $values){
-
-        /* Count record values, to detect duplicate entries for a specific record
-         */
-        if(!isset($checkArray[$values['type']][$values['value']])){
-          $checkArray[$values['type']][$values['value']] = 0;
-        }else{
-          $message[] = sprintf(_("Found duplicate value for record type '%s'."),$values['type']);
-        }
-
-        /* Check if given entries in $onlyOnce are used more than once
-         */
-        if(isset($onlyOnce[$values['type']])){
-          $onlyOnce[$values['type']] ++;
-          if($onlyOnce[$values['type']] > 1){
-            $message[] = sprintf(_("Found more than one entry for the uniqe record type '%s'."),$values['type']);
-          }
-        }
-
-        /* Skip txt record ... 
-         */
-        if($values['type'] == "tXTRecord") continue;
-
-        /* Check if there is an aRecord defined which uses the same IP as used in IPhostAddress 
-         */
-        if(($values['type'] == "aRecord")&&($values['value'] == $this->ipHostNumber)){
-          $message[]=sprintf(_("The device IP '%s' is added as 'A Record', this will be done automatically, please remove the record."), 
-               $this->ipHostNumber);
-        }
-
-        /* only lower-case is allowed in record entries ... 
-         */
-        if($values['value'] != strtolower($values['value'])){
-          $message[] = sprintf(_("Only lowercase is allowed, please check your '%ss'."),$values['type']);
-        }
-      }
-    }
-    return ($message);
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    $ldap= $this->config->get_ldap_link();
-  
-    $dn = $this->parent->dn;
-    /*******************/ 
-    /* IP-MAC HANDLING */
-    /*******************/ 
-
-    /* $dn was posted as parameter */
-    $this->dn = $dn;
-    
-    /* Save DNS setting & ip/Mac*/
-    plugin::save();
-
-    /* Write back to ldap */
-    $ldap->cd($this->dn);
-    $this->cleanup();
-    $ldap->modify ($this->attrs); 
-
-    /****************/ 
-    /* DHCP HANDLING */
-    /****************/ 
-  
-    /* New entry */
-    if($this->dhcpEnabled){
-
-      if(count($this->dhcpHostEntry) == 0){
-        $this->dialog = new dhcpHost($this->dhcpParentNode,TRUE);
-        $this->dialog->cn = $this->cn;
-        $this->dialog->dhcpHWAddress = "ethernet ".$this->macAddress;
-        if(!empty($this->ipHostNumber)){
-          $this->dialog->statements['fixed-address'] = $this->ipHostNumber;
-        }
-        $this->dialog->execute();
-        $this->dialog->save_object(); 
-        $this->dhcpHostEntry = $this->dialog->save();
-        if(count($this->dhcpHostEntry['dhcpOption']) == 0){
-          $this->dhcpHostEntry['dhcpOption']= array("host-name ".$this->cn);
-        }
-      }
-
-      if(count($this->dhcpHostEntry) == 0){
-        $this->dialog = new dhcpHost($this->dhcpParentNode,TRUE);
-        $this->dialog->cn = $this->cn;
-        $this->dialog->dhcpHWAddress = "ethernet ".$this->macAddress;
-        if(!empty($this->ipHostNumber)){
-          $this->dialog->statements['fixed-address'] = $this->ipHostNumber;
-        }
-        $this->dialog->execute();
-        $this->dialog->save_object(); 
-        $this->dhcpHostEntry = $this->dialog->save();
-        if(count($this->dhcpHostEntry['dhcpOption']) == 0){
-          $this->dhcpHostEntry['dhcpOption']= array("host-name ".$this->cn);
-        }
-      }
-
-      /* Write mac address to dhcp settings */
-      if($this->dhcp_is_Account){
-        if(!isset($this->dhcpHostEntry['dhcpHWAddress'][0]) || 
-            !preg_match("/ethernet ".$this->macAddress."/",$this->dhcpHostEntry['dhcpHWAddress'][0])){
-          $this->dhcpHostEntry['dhcpHWAddress'] = array("ethernet ".$this->macAddress);
-          $this->dhcpHostEntry['MODIFIED'] = TRUE;
-        }
-      }
-  
-
-      /* Unset dhcpStatements if this attribute is empty  */
-      if(isset($this->dhcpHostEntry['dhcpStatements']) && 
-          ($this->dhcpHostEntry['dhcpStatements'] == "" || count($this->dhcpHostEntry['dhcpStatements']) == 0) ){
-        unset($this->dhcpHostEntry['dhcpStatements']);
-      }
-  
-      /* DHCP removed */
-      if($this->initial_dhcp_is_Account && !$this->dhcp_is_Account){
-        $ldap->rmdir_recursive($this->dhcpHostEntry['dn']);
-        show_ldap_error($ldap->get_error(),_("Removing dhcp entry for this object failed."));
-
-        $tmp = new servdhcp($this->config,$this->dhcpParentNode);
-        $tmp->handle_post_events("remove");
-      }
-
-      /* DHCP Added */
-      if(!$this->initial_dhcp_is_Account && $this->dhcp_is_Account){
-        $attrs = $this->dhcpHostEntry;
-        unset($attrs['MODIFIED']);
-        unset($attrs['dn']);
-        $ldap->cd("cn=".$this->cn.",".$this->dhcpParentNode);
-        $res = $ldap->add($attrs);
-
-        $tmp = new servdhcp($this->config,$this->dhcpParentNode);
-        $tmp->handle_post_events("add");
-
-        show_ldap_error($ldap->get_error(),_("Tried to add new dhcp entry failed."));
-      }
-
-      /* DHCP still activated */
-      if($this->initial_dhcp_is_Account && $this->dhcp_is_Account){
-
-        /* DHCP node changed */
-        if(($this->initial_dhcpParentNode != $this->dhcpParentNode) || 
-           ($this->cn != $this->OrigCn)){
-          $attrs = $this->dhcpHostEntry;
-          $attrs['cn'] = $this->cn;
-          unset($attrs['dn']);
-          unset($attrs['MODIFIED']);
-          $ldap->cd("cn=".$this->cn.",".$this->dhcpParentNode);
-          $res = $ldap->add($attrs);
-
-          $tmp = new servdhcp($this->config,$this->dhcpParentNode);
-          $tmp->handle_post_events("modify");
-
-          show_ldap_error($ldap->get_error(),_("Tried to add new dhcp entry failed."));
-          if($res){
-            $ldap->rmdir_recursive($this->dhcpHostEntry['dn']);
-            show_ldap_error($ldap->get_error(),_("Removing old dhcp entry failed."));
-          }
-        }
-         
-        /* SAME node but modified */ 
-        if(isset($this->dhcpHostEntry['MODIFIED']) && $this->dhcpHostEntry['MODIFIED'] == 1  && 
-            $this->initial_dhcpParentNode == $this->dhcpParentNode){
-          $attrs = $this->dhcpHostEntry;
-          unset($attrs['dn']);
-          unset($attrs['MODIFIED']);
-          $ldap->cd($this->dhcpHostEntry['dn']);
-          $ldap->modify($attrs);
-          
-          $tmp = new servdhcp($this->config,$this->dhcpParentNode);
-          $tmp->handle_post_events("modify");
-
-          show_ldap_error($ldap->get_error(),_("Modifying dhcp entry failed."));
-        }    
-      }
-    }
-      
-
-    /****************/ 
-    /* DNS HANDLING */
-    /****************/ 
-
-    /* If isn't DNS account but initially was DNS account 
-       remove all DNS entries 
-     */ 
-    if((!$this->DNSenabled) || ((!$this->DNS_is_account)&&(!$this->initially_was_account))){
-      return;
-    }else{
-
-      /* Add ipHostNumber to aRecords
-       */
-      $backup_dnsEntry = $this->dnsEntry;
-      if(!empty($this->ipHostNumber)){
-        $this->dnsEntry['RECORDS'][] = array("type"=>"aRecord","value"=>$this->ipHostNumber);
-        $ptr = $this->get_pTRRecord();
-        if(!empty($ptr)){
-          $this->dnsEntry['RECORDS'][] = array("type"=>"pTRRecord","value"=>$ptr);
-        } 
-      }
-
-      /* Create diff and follow instructions 
-       * If Account was disabled, remove account by setting exists to false
-       */
-      if((!$this->DNS_is_account)&&($this->initially_was_account)){  
-        $this->dnsEntry['exists'] = false;
-        $tmp = getDNSHostEntriesDiff($this->config,$this->OrigCn,$this->dnsEntry,$this->cn);
-      }else{
-        $this->dnsEntry['exists'] = $this->DNS_is_account;
-        $tmp = getDNSHostEntriesDiff($this->config,$this->OrigCn,$this->dnsEntry,$this->cn);
-      }   
-
-      /* move follwoing entries 
-       */
-      foreach($tmp['move'] as $src => $dst){
-        $this->recursive_move($src,$dst);
-      }
-
-      /* Delete dns */
-      foreach($tmp['del'] as $dn => $del){
-        $ldap->cd($dn);
-        $ldap->rmdir_recursive($dn);
-        new log("modify","unknown/".get_class($this),$dn,array("*"),$ldap->get_error());
-      }
-
-      /* Add || Update new DNS entries 
-       */
-      foreach($tmp['add'] as $dn => $attrs){
-        $ldap->cd($dn);
-        $ldap->cat($dn, array('dn'));
-        if(count($ldap->fetch())){
-          $ldap->cd($dn);
-          $ldap->modify ($attrs); 
-        }else{
-          $ldap->cd($dn);
-          $ldap->add($attrs);
-        }
-        new log("modify","unknown/".get_class($this),$dn,array_keys($attrs),$ldap->get_error());
-      }
-
-
-      /* Display errors 
-       */
-      if($ldap->get_error() != "Success"){
-        show_ldap_error($ldap->get_error(), sprintf(_("Saving of terminal/dns account with dn '%s' failed."),$this->dn));
-      }
-
-      $tmp2 = new servdns($this->config,$this->dn);
-      $tmp2->handle_post_events("modify");
-
-      $this->dnsEntry =  $backup_dnsEntry;
-    }
-  }
-
-  /*  Create html table with all used record types
-   */
-  function generateRecordsList()
-  {
-    $changeStateForRecords = "";
-    
-    if(!$this->DNS_is_account) {
-      $str = "<input type='submit' value='"._("Add")."' name='AddNewRecord' id='AddNewRecord' disabled='disabled'>";
-      return(array("str" => $str, "changeStateForRecords"=> ""));
-    }
-    $str = "<table summary='' width='100%'>";
-    foreach($this->dnsEntry['RECORDS'] as $key => $entry){
-
-        $changeStateForRecords.= "changeState('RecordTypeSelectedFor_".$key."');\n";
-        $changeStateForRecords.= "changeState('RecordValue_".$key."');\n";
-        $changeStateForRecords.= "changeState('RemoveRecord_".$key."');\n";
-
-        $str.=" <tr>".
-          "   <td>".$this->generateRecordListBox($entry['type'],"RecordTypeSelectedFor_".$key)."</td>".
-          "   <td><input type='text' value='".$entry['value']."' name='RecordValue_".$key."' id='RecordValue_".$key."'></td>".
-          "   <td><input type='submit' name='RemoveRecord_".$key."' value='"._("Delete")."' id='RemoveRecord_".$key."'></td>".
-          "</tr>";
-    }
-
-    $str.= "  <tr>".
-           "    <td colspan=2 width='50%'></td><td>".
-           "      <input type='submit' value='"._("Add")."' name='AddNewRecord' id='AddNewRecord'>".
-           "    </td>".
-           "  </tr>".
-           "</table>";
-     $ret =  array("str" => $str, "changeStateForRecords" => $changeStateForRecords);
-    return($ret);
-  }
-
-
-  /* Create a html select box which allows us to select different types of records 
-   */
-  function generateRecordListBox($selected,$name)
-  {
-    $str = "<select name='".$name."' id='".$name."'>";
-    foreach($this->RecordTypes as $type => $value){
-      $use = "";
-      if($type == $selected){
-        $use = " selected ";
-      }
-      $str.="\n <option value='".$type."' ".$use.">".strtoupper(preg_replace("/record/i","",$type))."</option>";
-    }
-    $str.="</select>";
-    return($str); 
-  }
-
-
-  /* Return plugin informations for acl handling  */ 
-  static function plInfo()
-  {
-    $tmp =  array(
-        "plShortName"   => _("DNS"),
-        "plDescription" => _("DNS settings"),
-        "plSelfModify"  => FALSE,
-        "plDepends"     => array(),
-        "plPriority"    => 5,
-        "plSection"     => array("administration"),
-        "plCategory"    => array("workstation","terminal","phone","server","component","printer","winworkstation"),
-
-        "plProvidedAcls"=> array(
-          "ipHostNumber"  => _("IP address"),
-          "macAddress"    => _("MAC address"))
-        );
-
-    /* Hide all dns specific code, if dns is not available
-     */
-    foreach($_SESSION['config']->data['TABS']['SERVERSERVICE'] as $tab){
-      if(preg_match("/^servdns$/",$tab['CLASS'])){
-        $tmp['plProvidedAcls']["Records"]        = _("DNS records");
-        $tmp['plProvidedAcls']["zoneName"]       = _("Zone name");
-        $tmp['plProvidedAcls']["dNSTTL"]         = _("TTL");
-        break;
-      }
-    }
-    return($tmp);
-  }
-
-  
-  function get_dhcp_host_entry()
-  {
-    $attrs = array();
-    $dn = $this->get_dhcp_host_entry_dn();
-    if($dn){
-      $ldap = $this->config->get_ldap_link();
-      $ldap->cd($this->config->current['BASE']);
-      $ldap->cat($dn,array("*"));
-      if($ldap->count()){
-        $attrs = $ldap->fetch();
-        foreach($attrs as $key => $value){
-          if(is_numeric($key) || ($key == "count")){
-            unset($attrs[$key]);
-          }
-          if(is_array($value) && isset($value['count'])){
-            unset($attrs[$key]['count']);
-          }
-        }
-      }
-    }
-    return($attrs);
-  }
-
-
-  function get_dhcp_host_entry_dn()
-  {
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search ("(&(objectClass=dhcpHost)(cn=".$this->cn."))",array("cn","dn"));
-
-    if($ldap->count()){
-      $attr = $ldap->fetch();
-      return($attr['dn']);
-    }else{
-      return("");
-    }
-  }  
-
-
-  function get_dhcp_parent_node()
-  {
-    return(preg_replace("/^cn=".normalizePreg($this->cn).",/","",$this->get_dhcp_host_entry_dn()));
-  }
-
-
-  function get_dhcp_parent_nodes()
-  {
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(objectClass=dhcpService)",array("dhcpPrimaryDN"));
-    
-    $dhcp_dns = array();
-    while($attr = $ldap->fetch()){
-      $dhcp_dns[$attr['dn']] = $attr['dhcpPrimaryDN'][0];
-    }
-    foreach($dhcp_dns as $key => $pri_dns){
-      $ldap->cat($pri_dns,array("cn"));
-      $tmp = $ldap->fetch();
-      if(isset($tmp['cn'][0])){
-        $dhcp_dns[$key] = $tmp['cn'][0];
-      }else{
-        unset($dhcp_dns[$key]);
-      }
-    }
-
-    $tmp = $tmp2 = array();
-    foreach($dhcp_dns as $dn => $cn){
-      $ldap->cd($dn);
-      $ldap->search("(|(objectClass=dhcpService)(objectClass=dhcpGroup)".
-                    "(objectClass=dhcpSubnet)(objectClass=dhcpSharedNetwork))",array("cn"));
-      while($attr = $ldap->fetch()){
-        $tmp[$attr['dn']] = $attr['cn'][0];
-      }
-      $tmp2 = array_merge($tmp2,$this->create_tree($tmp,preg_replace("/^[^,]+,/i","",$dn),"(".$cn.")&nbsp;"));
-    }
-    return($tmp2);
-  }
-
-  
-  /* this function returns the default ptr record entry */
-  function get_pTRRecord()
-  {
-    if(!empty($this->ipHostNumber) && isset($this->dnsEntry['zoneName']) && !empty($this->dnsEntry['zoneName'])){
-      $ldap = $this->config->get_ldap_link();
-      $ldap->cat(getDNSZoneDN($this->config,$this->dnsEntry['zoneName']));
-      $attrs = $ldap->fetch();
-      $tmp = array_flip($this->Zones);
-      $tmp = preg_replace("/^[^\/]*+\//","",$tmp[$this->dnsEntry['zoneName']]);
-      $tmp = trim(preg_replace("/\.in-addr.arpa$/","",$tmp));
-      $ptr = preg_replace("/^".normalizePreg(FlipIp($tmp))."\./","",$this->ipHostNumber);
-      return($ptr);
-    }else{
-      return(FALSE);
-    }
-  }
-
-  
-  function generateRandomIP($net = "")
-  {
-    $str = $net;
-    $cnt = 4;
-    while(substr_count($str,".") < 3 && $cnt > 0){
-      $str .= ".".rand(0,255);
-      $str = preg_replace("/\.\.*/",".",$str);
-      $str = trim($str,". ");
-      $cnt --;
-    }
-    return($str);
-  }
-
-  
-  function create_tree($arr,$base,$current = "")
-  {
-    $ret = array();
-    foreach($arr as $r => $name){
-      $base_part = str_replace($base,"",$r);
-      if(preg_match("/^[a-z]*=".normalizePreg($name)."(|,)$/i",$base_part)){
-        $ret[$r] = $current.$name;
-        $tmp = $this->create_tree($arr,$r,$current.".&nbsp;");
-        foreach($tmp as $sub_key => $sub_name){
-          $ret[$sub_key] = $sub_name;
-        }
-      } 
-    }
-    return($ret);
-  }
-
-  function force_dns()
-  {
-    if($this->DNSenabled){
-      $this->DNS_is_account  = TRUE;
-      $this->hide_dns_check_box = TRUE;
-    }
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/dhcpNewSection.tpl b/plugins/admin/systems/dhcpNewSection.tpl
deleted file mode 100644 (file)
index 517c3b4..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-<div style="font-size: 18px;">
-       {t}Create new DHCP section{/t}
-</div>
-<br>
-<p class="seperator">
-<b>{t}Please choose one of the following DHCP section types.{/t}</b>
-</p>
-<br>
-{t}Section{/t}&nbsp;
-<select size="1" id="section" name="section" title="{t}Choose section type to create{/t}">
-  {html_options options=$sections}
-</select>
-
-<p class="plugbottom">
-  <input type=submit name="create_section" value="{t}Create{/t}">
-  &nbsp;
-  <input type=submit name="cancel_section" value="{t}Cancel{/t}">
-</p>
-       
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-       <!--
-       focus_field('section');
-       -->
-</script>
diff --git a/plugins/admin/systems/dhcp_advanced.tpl b/plugins/admin/systems/dhcp_advanced.tpl
deleted file mode 100644 (file)
index 5ce0e46..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-{* GOsa dhcp sharedNetwork - smarty template *}
-
-<p class='seperator'></p>
-<br>
-
-{if $show_advanced}
-
-<input type='submit' name='hide_advanced' value='{t}Hide advanced settings{/t}'>
-
-<table width="100%">
- <tr>
-
-  <td width="50%">
-   <br>
-   <b>{t}DHCP statements{/t}</b>
-   <br>
-   <select name='dhcpstatements' style="width:100%;" size="14">
-    {html_options values=$dhcpstatements output=$dhcpstatements}
-   </select>
-   <br>
-   <input type='text' name='addstatement' size='25' maxlength='80'>&nbsp;
-   <input type='submit' name='add_statement' value='{t}Add{/t}'>&nbsp;
-   <input type='submit' name='delete_statement' value='{t}Delete{/t}'> 
-  </td>
-
-  <td>
-   <br>
-   <b>{t}DHCP options{/t}</b>
-   <br>
-   <select name='dhcpoptions' style="width:100%;" size="14">
-    {html_options values=$dhcpoptions output=$dhcpoptions}
-   </select>
-   <br>
-   <input type='text' name='addoption' size='25' maxlength='80'>&nbsp;
-   <input type='submit' name='add_option' value='{t}Add{/t}'>&nbsp;
-   <input type='submit' name='delete_option' value='{t}Delete{/t}'> 
-  </td>
- </tr>
-</table>
-
-{else}
-
-<input type='submit' name='show_advanced' value='{t}Show advanced settings{/t}'>
-
-{/if}
-<p class='seperator'>&nbsp;</p>
diff --git a/plugins/admin/systems/dhcp_group.tpl b/plugins/admin/systems/dhcp_group.tpl
deleted file mode 100644 (file)
index 930fc05..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-{* GOsa dhcp sharedNetwork - smarty template *}
-<p><b>{t}Generic{/t}</b></p>
-<table>
- <tr>
-  <td>
-   {t}Name{/t}{$must}
-  </td> 
-  <td>
-   <input id='cn' type='text' name='cn' size='25' maxlength='80' value='{$cn}'
-        title='{t}Name of group{/t}'>
-  </td>
- </tr>
-</table>
-
-<p class="seperator">&nbsp;</p>
-
-<!-- Place cursor in correct field -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-        focus_field('cn');
-  -->
-</script>
diff --git a/plugins/admin/systems/dhcp_host.tpl b/plugins/admin/systems/dhcp_host.tpl
deleted file mode 100644 (file)
index 602c512..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-{* GOsa dhcp host - smarty template *}
-<p><b>{t}Generic{/t}</b></p>
-<table width="100%">
- <tr>
-  <td width="50%" style="vertical-align:top">
-   <table>
-    <tr>
-     <td>{t}Name{/t}{$must}</td>
-     <td>
-      <input {if $realGosaHost} disabled {/if} id='cn' type='text' name='cn' size='25' maxlength='80' value='{$cn}'
-             title='{t}Name of host{/t}'>
-     </td>
-    </tr>
-    <tr>
-     <td>{t}Fixed address{/t}</td>
-     <td>
-      <input {if $realGosaHost} disabled {/if} 
-                       type='text' name='fixedaddr' size='25' maxlength='80' value='{$fixedaddr}'
-             title='{t}Use hostname or IP-address to assign fixed address{/t}'>
-     </td>
-    </tr>
-   </table>
-  </td>
-  <td>
-   <table>
-    <tr>
-     <td>{t}Hardware type{/t}</td>
-     <td>
-      <select name='hwtype'  {if $realGosaHost} disabled {/if} >
-       {html_options options=$hwtypes selected=$hwtype}
-      </select>
-     </td>
-    </tr>
-    <tr>
-     <td>{t}Hardware address{/t}{$must}</td>
-     <td>
-      <input  {if $realGosaHost}  disabled {/if} type='text' name='dhcpHWAddress' size='20' maxlength='18' value='{$dhcpHWAddress}'>
-     </td>
-    </tr>
-   </table>
-  </td>
- </tr>
-</table>
-<input type='hidden' name='dhcp_host_posted' value='1'>
-<p class="seperator"></p>
-
-<!-- Place cursor in correct field -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-        focus_field('cn');
-  -->
-</script>
diff --git a/plugins/admin/systems/dhcp_network.tpl b/plugins/admin/systems/dhcp_network.tpl
deleted file mode 100644 (file)
index 5645a63..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-{* GOsa dhcp sharedNetwork - smarty template *}
-<table width="100%">
- <tr>
-  <td width="50%" style="vertical-align:top">
-   <p><b>{t}Network configuration{/t}</b></p>
-   <table>
-    <tr>
-     <td>{t}Router{/t}</td>
-     <td>
-      <input id='routers' type='text' name='routers' size='25' maxlength='80' value='{$routers}'
-              title='{t}Enter name or IP address of router to be used in this section{/t}'>
-     </td>
-    </tr>
-    <tr>
-     <td>{t}Netmask{/t}</td>
-     <td>
-      <input type='text' name='subnet_mask' size='18' maxlength='15' value='{$subnet_mask}'>
-     </td>
-    </tr>
-    <tr>
-     <td>{t}Broadcast{/t}</td>
-     <td>
-      <input type='text' name='broadcast_address' size='18' maxlength='15' value='{$broadcast_address}'>
-     </td>
-    </tr>
-   </table>
-   <br>
-   <br>
-   <p><b>{t}Bootup{/t}</b></p>
-   <table>
-    <tr>
-     <td>{t}Filename{/t}</td>
-     <td>
-      <input type='text' name='filename' size='25' maxlength='80' value='{$filename}'
-              title='{t}Enter name of file that will be loaded via tftp after client has started{/t}'>
-     </td>
-    </tr>
-    <tr>
-     <td>{t}Next server{/t}</td>
-     <td>
-      <input type='text' name='nextserver' size='25' maxlength='80' value='{$nextserver}'
-              title='{t}Enter name of server to retrieve bootimages from{/t}'>
-     </td>
-    </tr>
-   </table>
-  
-  </td>
-  <td style="vertical-align:top">
-   <p><b>{t}Domain Name Service{/t}</b></p>
-   <table>
-    <tr>
-     <td>{t}Domain{/t}</td>
-     <td>
-      <input type='text' name='domain' size='25' maxlength='80' value='{$domain}'
-              title='{t}Name of domain{/t}'>
-     </td>
-    </tr>
-    <tr>
-     <td colspan=2>
-      <br>
-      {t}DNS server{/t}<br>
-      <select name='dnsserver'  title='{t}List of DNS servers to be propagated{/t}' style="width:350px;" size="4">
-       {html_options options=$dnsservers}
-      </select>
-      <br>
-      <input type='text' name='addserver' size='25' maxlength='80' title='{t}DNS server do be added{/t}'>&nbsp;
-      <input type='submit' name='add_dns' value='{t}Add{/t}' title='{t}Click here add the selected server to the list{/t}'>
-      <input type='submit' name='delete_dns' value='{t}Delete{/t}' title='{t}Click here remove the selected servers from the list{/t}'>
-     </td>
-    </tr>
-    <tr>
-     <td colspan=2>
-      <p><b>{t}Domain Name Service options{/t}</b></p>
-      <input type=checkbox name="autohost" value="1" {$autohost}>{t}Assign hostnames found via reverse mapping{/t}
-      <br>
-      <input type=checkbox name="autohostdecl" value="1" {$autohostdecl}>{t}Assign hostnames from host declarations{/t}
-     </td>
-    </tr>
-   </table>
-  
-  </td>
- </tr>
-</table>
-<!-- Place cursor in correct field -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-     focus_field('cn','routers');
-  -->
-</script>
-
diff --git a/plugins/admin/systems/dhcp_pool.tpl b/plugins/admin/systems/dhcp_pool.tpl
deleted file mode 100644 (file)
index dcbd05c..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-{* GOsa dhcp sharedNetwork - smarty template *}
-<p><b>{t}Generic{/t}</b></p>
-<table width="100%">
- <tr>
-  <td width="50%">
-   {t}Name{/t}{$must}&nbsp;
-   <input id='cn' type='text' name='cn' size='25' maxlength='80' value='{$cn}'
-        title='{t}Name of pool{/t}'>
-  </td>
-  <td>
-   {t}Range{/t}{$must}&nbsp;
-   <input type='text' name='range_start' size='25' maxlength='30' value='{$range_start}'>
-   &nbsp;-&nbsp;
-   <input type='text' name='range_stop' size='25' maxlength='30' value='{$range_stop}'>
-  </td>
- </tr>
-</table>
-
-<p class="seperator">&nbsp;</p>
-
-<!-- Place cursor in correct field -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-  document.mainform.cn.focus();
-  -->
-</script>
diff --git a/plugins/admin/systems/dhcp_service.tpl b/plugins/admin/systems/dhcp_service.tpl
deleted file mode 100644 (file)
index 6ca515e..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-<p><b>{t}Generic{/t}</b></p>
-
-<table width="100%">
- <tr>
-  <td width="50%">
-  <input id='authoritative' type=checkbox name="authoritative" value="1" {$authoritative}> {t}Authoritative service{/t}<br>
-  <br>
-  {t}Dynamic DNS update{/t} 
-  <select name='ddns_update_style'  title='{t}Dynamic DNS update style{/t}' size="1">
-       {html_options values=$ddns_styles output=$ddns_styles selected=$ddns_update_style}
-  </select>
-  </td>
-
-  <td style='vertical-align:top'>
-
-   <table>
-    <tr>
-      <td>{t}Default lease time (s){/t}</td>
-      <td>
-      <input type='text' name='default_lease_time' size='25' maxlength='80' value='{$default_lease_time}' title='{t}Enter default lease time in seconds.{/t}'>
-      </td>
-    </tr>
-    <tr>
-      <td>{t}Maximum lease time (s){/t}</td>
-      <td>
-      <input type='text' name='max_lease_time' size='25' maxlength='80' value='{$max_lease_time}' title='{t}Enter maximum lease time in seconds.{/t}'>
-      </td>
-    </tr>
-   </table>
-
-  </td>
-
- </tr>
-</table>
-
-<p class="seperator"></p>
-
-<!-- Place cursor in correct field -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('authoritative');
-  -->
-</script>
diff --git a/plugins/admin/systems/dhcp_sharedNetwork.tpl b/plugins/admin/systems/dhcp_sharedNetwork.tpl
deleted file mode 100644 (file)
index 374da35..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-{* GOsa dhcp sharedNetwork - smarty template *}
-<p><b>{t}Generic{/t}</b></p>
-<table width="100%" border="0">
- <tr>
-
-  <td width="50%">
-
-   <table>
-    <tr>
-     <td>{t}Name{/t}{$must}</td>
-     <td>
-      <input id='cn' type='text' name='cn' size='25' maxlength='80' value='{$cn}' title='{t}Name for shared network{/t}'>
-     </td>
-    </tr>
-    <tr>
-     <td>{t}Server identifier{/t}</td>
-     <td>
-      <input type='text' name='server-identifier' size='25' maxlength='80' value='{$server_identifier}'
-       title='{t}Propagated server identifier for this shared network{/t}'>
-     </td>
-    </tr>
-   </table>
-  
-  </td>
-  
-  <td style="vertical-align:top;">
-   <table>
-    <tr>
-     <td>
-      <input type=checkbox name="authoritative" value="1" {$authoritative}
-       title="{t}Select if this server is authoritative for this shared network{/t}">{t}Authoritative server{/t}
-     </td>
-    </tr>
-   </table>
-  </td>
-  
- </tr>
-</table>
-
-<p class="seperator">&nbsp;</p>
-
-<table width="100%">
- <tr>
-  <td width="50%">
-  
-  <p><b>{t}Leases{/t}</b></p>
-   <table>
-    <tr>
-     <td>{t}Default lease time{/t}</td>
-     <td>
-      <input type='text' name='default-lease-time' size='10' maxlength='25' value='{$default_lease_time}'
-        title='{t}Default lease time{/t}'>&nbsp;{t}seconds{/t}
-     </td>
-    </tr>
-    <tr>
-     <td>{t}Max. lease time{/t}</td>
-     <td>
-      <input type='text' name='max-lease-time' size='10' maxlength='25' value='{$max_lease_time}'
-        title='{t}Maximum lease time{/t}'>&nbsp;{t}seconds{/t}
-     </td>
-    </tr>
-    <tr>
-     <td>{t}Min. lease time{/t}</td>
-     <td>
-      <input type='text' name='min-lease-time' size='10' maxlength='25' value='{$min_lease_time}'
-        title='{t}Minimum lease time{/t}'>&nbsp;{t}seconds{/t}
-     </td>
-    </tr>
-   </table>
-   
-  </td>
-
-  <td style="vertical-align:top">
-   <p><b>{t}Access control{/t}</b></p>
-   <table>
-    <tr>
-     <td>
-     <input type=checkbox name="unknown-clients" value="1" {$allow_unknown_state}
-        title="{t}Select if unknown clients should get dynamic IP addresses{/t}">{t}Allow unknown clients{/t}
-     </td>
-    </tr>
-    <tr>
-     <td>
-     <input type=checkbox name="bootp" value="1" {$allow_bootp_state}
-        title="{t}Select if bootp clients should get dynamic IP addresses{/t}">{t}Allow bootp clients{/t}
-     </td>
-    </tr>
-    <tr>
-     <td>
-     <input type=checkbox name="booting" value="1" {$allow_booting_state}
-        title="{t}Select if clients are allowed to boot using this DHCP server{/t}">{t}Allow booting{/t}
-     </td>
-    </tr>
-   </table>
-  </td>
-  
- </tr> 
-</table>
-
-<p class="seperator">&nbsp;</p>
-
-<!-- Place cursor in correct field -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-  document.mainform.cn.focus();
-  -->
-</script>
diff --git a/plugins/admin/systems/dhcp_subnet.tpl b/plugins/admin/systems/dhcp_subnet.tpl
deleted file mode 100644 (file)
index 05425fb..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-{* GOsa dhcp subnet - smarty template *}
-<p><b>{t}Generic{/t}</b></p>
-<table width="100%">
- <tr>
-  <td width="50%">
-   <table>
-    <tr>
-     <td>{t}Network address{/t}{$must}</td>
-     <td><input id='cn' type='text' name='cn' size='25' maxlength='80' value='{$cn}'></td>
-    </tr>
-    <tr>
-     <td>{t}Netmask{/t}{$must}</td>
-     <td><input type='text' name='dhcp_netmask' size='25' maxlength='80' value='{$dhcp_netmask}'></tr>
-   </table>
-  </td>
-  <td style='vertical-align:top'>
-   <table>
-    <tr>
-     <td><input type="checkbox" name="use_range" value="1" onChange="changeState('range_start');changeState('range_stop');" {$use_range}></td>
-     <td>{t}Range for dynamic address assignment{/t}</td>
-  </tr>
-  <tr>
-  <td>&nbsp;</td>
-  <td><input type='text' id='range_start' name='range_start' size='25' maxlength='80' value='{$range_start}' {$range_disabled}>
-  &nbsp;<b>-</b>&nbsp;
-  <input type='text' id='range_stop' name='range_stop' size='25' maxlength='80' value='{$range_stop}' {$range_disabled}>
-  </td>
-  </tr>
-  </table>
-  </td>
-  </tr>
-</table>
-<input type='hidden' name='dhcp_subnet_posted' value='1'>
-<p class="seperator"></p>
-
-<!-- Place cursor in correct field -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-        focus_field('cn');
-  -->
-</script>
diff --git a/plugins/admin/systems/glpi.tpl b/plugins/admin/systems/glpi.tpl
deleted file mode 100644 (file)
index 0d2f8db..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-<table summary="" style="width:100%;">
-       <tr>
-               <td style="width:50%;vertical-align:top;" >
-                       <!--Upper left-->       
-                       
-                       <h2>{t}Generic{/t}</h2>
-                       <table summary="" cellpadding=5>
-                               <tr>
-                                       <td >{t}System type{/t}
-                                       </td>
-                                       <td>
-{render acl=$typeACL}
-                                               <select name="type">
-                                                       {html_options values=$SystemTypeKeys output=$SystemTypes selected=$type}
-                                               </select>
-{/render}
-{render acl=$typeACL}
-                                               <input type="submit" value="{t}edit{/t}" name="edit_type">      
-{/render}
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>{t}Operating system{/t}
-                                       </td>
-                                       <td>
-{render acl=$osACL}
-                                               <select name="os">
-                                                       {html_options values=$OSKeys output=$OSs selected=$os}
-                                               </select>       
-{/render}
-{render acl=$osACL}
-                                               <input type="submit" value="{t}edit{/t}" name="edit_os">        
-{/render}
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>{t}Manufacturer{/t}
-                                       </td>
-                                       <td>
-{render acl=$FK_glpi_enterpriseACL}
-                                               <select name="FK_glpi_enterprise">
-                                                       {html_options values=$ManufacturerKeys output=$Manufacturers selected=$FK_glpi_enterprise}
-                                               </select>       
-{/render}
-{render acl=$FK_glpi_enterpriseACL}
-                                               <input type="submit" value="{t}edit{/t}" name="edit_manufacturer">      
-{/render}
-                                       </td>
-                               </tr>
-                       <!--</table>
-                       <p class="seperator">&nbsp;</p>
-                       <h2>{t}Contacts{/t}</h2>
-                       <table summary="" width="100%">-->
-                               <tr>
-                                       <td>
-                                               {t}Contact person{/t}
-                                       </td>
-                                       <td>
-                                               <i>{$contact_num}&nbsp; </i>&nbsp;
-{render acl=$contact_numACL}
-                                               <input type="submit" name="SelectContactPerson" value="{t}Edit{/t}">
-{/render}
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>{t}Technical responsible{/t}&nbsp;
-                                       </td>
-                                       <td>
-                                               <i>{$tech_num}&nbsp; </i>&nbsp;
-{render acl=$tech_numACL}
-                                               <input type="submit" value="{t}Edit{/t}" name="SelectTechPerson">
-{/render}
-                                       </td>
-                               </tr>
-                       </table>
-               </td>
-               <td style="border-left: 1px solid rgb(160, 160, 160); vertical-align: top; padding-right: 5px;">
-                       <!--Upper right-->
-                       <h2>{t}Comment{/t}</h2>
-                       <table summary="" width="100%">
-                               <tr>
-                                       <td valign="top" colspan="2">
-{render acl=$commentsACL}
-                                               <textarea name="comments" style="width:100%;height:180px;">{$comments}</textarea>
-{/render}
-                                       </td>
-                               </tr>
-                       </table>
-               </td>
-       </tr>
-</table>
-<p class="seperator" >&nbsp;</p>
-<table summary="" style="width:100%;">
-       <tr>
-               <td style="width:50%;">
-                       <h2>{t}Installed devices{/t}</h2>
-                       <table summary="" width="100%"> 
-                               <tr>
-                                       <td>
-{render acl=$DevicesACL}
-                                               <select name="InstalledDevices" style="height:130px;width:100%;" multiple>
-                                                       {html_options values=$InstalledDeviceKeys output=$InstalledDevices}
-                                               </select>
-{/render}
-{render acl=$DevicesACL}
-                                               <input name="AddDevice" value="{t}Edit{/t}" type="submit">      
-{/render}
-                                       </td>
-                               </tr>
-                       </table>
-<!--                   <p class="seperator" >&nbsp;</p>
-                       <input type="submit" value="{t}Trading{/t}" name="Trading">     
-                       <input type="submit" value="{t}Software{/t}" name="Software">   
-                       <input type="submit" value="{t}Contracts{/t}" name="Contracts"> -->
-               </td>
-               <td style="border-left: 1px solid rgb(160, 160, 160); vertical-align: top; padding-right: 5px;">
-                       <h2>{t}Attachments{/t}</h2>
-                       <table summary="" width="100%"> 
-                               <tr>
-                                       <td>
-{render acl=$AttachmentsACL}
-                                               {$AttachmentsDiv}
-{/render}
-{render acl=$AttachmentsACL}
-                                               <input name="AddAttachment"     value="{t}Add{/t}" type="submit">       
-{/render}
-                                       </td>
-                               </tr>
-                       </table>
-               </td>
-       </tr>
-</table>
-<input type="hidden" name="glpi_tpl_posted" value="1">
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('type');
-  -->
-</script><p style="text-align:right">
diff --git a/plugins/admin/systems/glpiAttachmentEdit.tpl b/plugins/admin/systems/glpiAttachmentEdit.tpl
deleted file mode 100644 (file)
index 7d91e50..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-<br>
-<h2>{t}Attachment{/t}</h2>
-       
-<table summary="" width="100%">
-       <tr>
-               <td width="50%" style="vertical-align:top;">
-                       <table summary="" width="100%">
-                               <tr>
-                                       <td  style="vertical-align:top;">
-                                               {t}Name{/t}
-                                       </td>
-                                       <td>
-                                               <input type="text" value="{$name}" name="name">
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td style="vertical-align:top;">
-                                               {t}Comment{/t}
-                                       </td>
-                                       <td style="vertical-align:top;">
-                                               <textarea name="comment">{$comment}</textarea>
-                                       </td>
-                               </tr>
-                       </table>
-               </td>
-               <td  style="vertical-align:top;">
-                       <table summary="" width="100%">
-                               <tr>
-                                       <td style="vertical-align:top;">
-                                               {t}File{/t}
-                                       </td>
-                                       <td style="vertical-align:top;">
-                                               <input type="file" value="" name="filename"><input type="submit" name="upload" value="{t}Upload{/t}">
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td style="vertical-align:top;">
-                                               {t}Status{/t}
-                                       </td>
-                                       <td style="vertical-align:top;">
-                                               {$status}
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td style="vertical-align:top;">
-                                               {t}Filename{/t}
-                                       </td>
-                                       <td style="vertical-align:top;">
-                                               {$filename}
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td style="vertical-align:top;">
-                                               {t}Mime-type{/t}
-                                       </td>
-                                       <td style="vertical-align:top;">
-                                               {$mime}
-                                       </td>
-                               </tr>
-                       </table>
-               </td>
-       </tr>
-</table>
-
-
-<p class="seperator">&nbsp;</p>
-<div align="right">
-       <p>
-               <input type="submit" name="SaveAttachment"              value="{t}Save{/t}">
-               <input type="submit" name="CancelAttachment"    value="{t}Cancel{/t}">
-       </p>
-</div>
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('name');
-  -->
-</script>
-
diff --git a/plugins/admin/systems/glpiAttachmentPool.tpl b/plugins/admin/systems/glpiAttachmentPool.tpl
deleted file mode 100644 (file)
index e3a73be..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
-<tr>
-  <td style="vertical-align:top;width:50%;" >
-  <div class="contentboxh" style="height:20px;">
-    <p class="contentboxh" style="font-size:12px;">
-     {t}List of attachments{/t}
-    </p>
-  </div>
-  <div class="contentboxb">
-      {$attachmenthead}
-  </div>
-  <div style='height:4px;'></div>
-  <div class="contentboxb" style="border-top:1px solid #B0B0B0;">
-      {$attachments}
-    <input type=hidden name="edit_helper">
-  </div>
-  </td>
-  <td style="vertical-align:top;">
-   <div class="contentboxh" style="border-bottom:1px solid #B0B0B0;height:20px;">
-    <p class="contentboxh" style="font-size:12px;"><img src="{$infoimage}" align="right" alt="[i]">{t}Information{/t}</p>
-   </div>
-   <div class="contentboxb" style="padding:5px;">
-    {t}This dialog allow you to attach additional objects (like manuals, guides, etc.)  to your currently edited computer.{/t}
-   </div>
-   <br>
-   <div class="contentboxh" style="height:20px;">
-    <p class="contentboxh" style="font-size:12px;"><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>
-<table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
-<tr>
-<td><LABEL for="regex"><img alt="{t}Display attachments matching{/t}" src="{$search_image}" align=middle></label></td>
-<td width="99%">
-<input type='text' style='width:99%' name='attachment_regex' maxlength='20' value='{$attachment_regex}' title='{t}Regular expression for matching attachment names{/t}' onChange="mainform.submit()">
-</td>
-</tr>
-</table>
-   {$apply}
-   </div>
-  </td>
-</tr>
-</table>
-
-<input type="hidden" name="ignore">
-<p class="seperator">&nbsp;</p>
-<div align="right">
-       <p>
-               <input type="submit" name="UseAttachment" value="{t}Use{/t}">
-               <input type="submit" name="AbortAttachment" value="{t}Cancel{/t}">
-       </p>
-</div>
diff --git a/plugins/admin/systems/glpiDeviceManagement.tpl b/plugins/admin/systems/glpiDeviceManagement.tpl
deleted file mode 100644 (file)
index ab2baa7..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
-<tr>
-  <td style="vertical-align:top;width:50%;" >
-  <div class="contentboxh" style="height:20px;">
-    <p class="contentboxh" style="font-size:12px;">
-     {t}List of devices{/t}
-    </p>
-  </div>
-  <div class="contentboxb">
-      {$devicehead}
-  </div>
-  <div style='height:4px;'></div>
-  <div class="contentboxb" style="border-top:1px solid #B0B0B0;">
-      {$devices}
-    <input type=hidden name="edit_helper">
-  </div>
-  </td>
-  <td style="vertical-align:top;">
-   <div class="contentboxh" style="border-bottom:1px solid #B0B0B0;height:20px;padding:0px;">
-    <p class="contentboxh" style="font-size:12px;padding:0px;"><img src="{$infoimage}" align="right" alt="[i]">{t}Information{/t}</p>
-   </div>
-   <div class="contentboxb" style="padding:5px;">
-    {t}This dialog allows you to attach a device to your currently edited computer.{/t}
-   </div>
-   <br>
-   <div class="contentboxh" style="height:20px;">
-    <p class="contentboxh" style="font-size:12px;"><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>
-<table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
-<tr>
-<td><LABEL for="regex"><img alt="{t}Display devices matching{/t}" src="{$search_image}" align=middle></label></td>
-<td width="99%">
-<input type='text' style='width:99%' name='device_regex' maxlength='20' value='{$device_regex}' title='{t}Regular expression for matching device names{/t}' onChange="mainform.submit()">
-</td>
-</tr>
-</table>
-   {$apply}
-   </div>
-  </td>
-</tr>
-</table>
-
-<input type="hidden" name="ignore">
-<p class="seperator">&nbsp;</p>
-<div align="right">
-       <p>
-               <input type="submit" name="SelectDeviceSave" value="{t}Use{/t}">
-               <input type="submit" name="SelectDeviceCancel" value="{t}Cancel{/t}">
-       </p>
-</div>
diff --git a/plugins/admin/systems/glpiManufacturer.tpl b/plugins/admin/systems/glpiManufacturer.tpl
deleted file mode 100644 (file)
index a15a29a..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-<h2>{t}Manage manufacturers{/t}</h2>
-<select name="manufacturer" style="width:100%;" size="12">
-  {html_options values=$ManuKeys output=$Manus}
-</select>
-<br>
-<input name="add_manu"                 value="{t}Add{/t}"              type="submit">
-<input name="edit_manu"        value="{t}Edit{/t}"     type="submit">
-<input name="remove_manu"      value="{t}Remove{/t}"   type="submit">
-
-<p class="seperator">&nbsp;</p>
-<div align="right">
-<p>
-       <input name="close_edit_manufacturer" value="{t}Close{/t}" type="submit">
-</p>
-</div>
diff --git a/plugins/admin/systems/glpiManufacturerAdd.tpl b/plugins/admin/systems/glpiManufacturerAdd.tpl
deleted file mode 100644 (file)
index c5b060d..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-<h2>{t}Add/Edit manufacturer{/t}</h2>
-<table summary="" width="100%">
-       <tr>
-               <td width="50%">
-                       <table summary=""> 
-                               <tr>
-                                       <td>{t}Name{/t}
-                                       </td>
-                                       <td>
-                                               <input type="text" name="name" value="{$name}">
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>{t}Website{/t}
-                                       </td>
-                                       <td>
-                                               <input type="text" name="website" value="{$website}">
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td style="vertical-align:top;">{t}Address{/t}
-                                       </td>
-                                       <td>
-                                               <textarea  name="address">{$address}</textarea>
-                                       </td>
-                               </tr>
-                       </table>
-               </td>
-               <td>
-                       <table summary="" >
-                               <tr>
-                                       <td>{t}Phone number{/t}
-                                       </td>
-                                       <td>
-                                               <input type="text" name="phonenumber" value="{$phonenumber}">
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>{t}Fax{/t}
-                                       </td>
-                                       <td>
-                                               <input type="text" name="fax" value="{$fax}">
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>{t}Email{/t}
-                                       </td>
-                                       <td>
-                                               <input type="text" name="email" value="{$email}">
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td style="vertical-align:top;">{t}Comments{/t}
-                                       </td>
-                                       <td>
-                                               <textarea name="comments">{$comments}</textarea>
-                                       </td>
-                               </tr>
-                       </table>
-               </td>
-       </tr>
-</table>
-
-
-
-
-
-
-
-
-
-
-
-
-
-<br>
-<p class="seperator">&nbsp;</p>
-<div align="right">
-<p>
-       <input name="save_manufacturer" value="{t}Save{/t}" type="submit">
-       <input name="close_manufacturer" value="{t}Close{/t}" type="submit">
-</p>
-</div>
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-               focus_field('name');
-  -->
-</script>
-
diff --git a/plugins/admin/systems/glpiPrinter.tpl b/plugins/admin/systems/glpiPrinter.tpl
deleted file mode 100644 (file)
index 46e3446..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-<table summary="" style="width:100%;">
-       <tr>
-               <td style="width:50%;vertical-align: top;">
-                       <!--Upper left-->       
-                       
-                       <h2>{t}Generic{/t}</h2>
-                       <table summary="" cellpadding=5>
-                               <tr>
-                                       <td width="150">{t}Printer type{/t}
-                                       </td>
-                                       <td>
-{render acl=$typeACL}
-                                               <select name="type" >
-                                                       {html_options values=$PrinterTypeKeys output=$PrinterTypes selected=$type}
-                                               </select>
-{/render}
-{render acl=$typeACL}
-                                               <input type="submit" value="{t}edit{/t}" name="edit_type" >     
-{/render}
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>{t}Manufacturer{/t}
-                                       </td>
-                                       <td>
-{render acl=$FKglpienterpriseACL}
-                                               <select name="FK_glpi_enterprise" >
-                                                       {html_options values=$ManufacturerKeys output=$Manufacturers selected=$FK_glpi_enterprise}
-                                               </select>       
-{/render}
-{render acl=$FKglpienterpriseACL}
-                                               <input type="submit" value="{t}edit{/t}" name="edit_manufacturer" >     
-{/render}
-                                       </td>
-                               </tr>
-                       </table>
-               </td>
-               <td style="border-left: 1px solid rgb(160, 160, 160); vertical-align: top; padding-right: 5px;">
-                       <h2>{t}Supported interfaces{/t}</h2>
-                       <table summary="" width="100%">
-                               <tr>
-                                       <td width="20">
-{render acl=$flags_serialACL}
-                                               <input type="checkbox" name="flags_serial" {if $flags_serial=="1"} checked {/if} value="1" >
-{/render}
-                                       </td>
-                                       <td>
-                                               {t}Serial{/t}
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td width="20">
-{render acl=$flags_parACL}
-                                               <input type="checkbox" name="flags_par" {if $flags_par=="1"} checked {/if} value="1" >
-{/render}
-                                       </td>
-                                       <td>
-                                               {t}Parallel{/t}
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td width="20">
-{render acl=$flags_usbACL}
-                                               <input type="checkbox" name="flags_usb" {if $flags_usb=="1"} checked {/if} value="1" >
-{/render}
-                                       </td>
-                                       <td>
-                                               {t}USB{/t}
-                                       </td>
-                               </tr>
-                       </table>
-                       <input name="glpiPrinterFlagsPosted" value="1" type="hidden">
-               </td>
-       </tr>
-</table>
-<p class="seperator" >&nbsp;</p>
-<table summary="" style="width:100%;">
-       <tr>
-               <td style="width:50%;vertical-align: top;">
-                       <h2>{t}Contacts{/t}</h2>
-                       <table summary="" cellpadding=5>
-                               <tr>
-                                       <td>{t}Technical responsible{/t}&nbsp;
-                                       </td>
-                                       <td>
-                                               <i>{$tech_num}&nbsp; </i>&nbsp;
-{render acl=$tech_numACL}
-                                               <input type="submit" value="{t}Edit{/t}" name="SelectTechPerson" >
-{/render}
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>
-                                               {t}Contact person{/t}
-                                       </td>
-                                       <td>
-                                               <i>{$contact_num}&nbsp; </i>&nbsp;
-{render acl=$contact_numACL}
-                                               <input type="submit" name="SelectContactPerson" value="{t}Edit{/t}">
-{/render}
-
-                                       </td>
-                               </tr>
-                       </table>
-               </td>
-               <td style="border-left: 1px solid rgb(160, 160, 160); vertical-align: top; padding-right: 5px;">
-                       <h2>{t}Attachments{/t}</h2>
-                       <table summary="" width="100%"> 
-                               <tr>
-                                       <td>
-{render acl=$AttachmentsACL}
-                                               {$AttachmentsDiv}
-{/render}
-{render acl=$AttachmentsACL}
-                                               <input name="AddAttachment"     value="{t}Add{/t}" type="submit" >      
-{/render}
-                                       </td>
-                               </tr>
-                       </table>
-               </td>
-       </tr>
-</table>
-<p class="seperator" >&nbsp;</p>
-<table summary="" style="width:100%;">
-       <tr>
-               <td style="width:50%;vertical-align: top;">
-                       <h2>{t}Information{/t}</h2>
-                       <table summary="" width="100%">
-                               <tr>
-                                       <td width="100%">
-{render acl=$commentsACL}
-                                               <textarea name="comments" style="width:100%;height:100px;" >{$comments}</textarea>
-{/render}
-                                       </td>
-                               </tr>
-                       </table>
-               </td>
-               <td style="border-left: 1px solid rgb(160, 160, 160); vertical-align: top; padding-right: 5px;">
-                       <h2>{t}Installed cartridges{/t}</h2>
-                       <table summary="" width="100%"> 
-                               <tr>
-                                       <td>
-{render acl=$CartridgesACL}
-                                               <select name="Cartridges[]"  style="height:100px;width:100%;" multiple>
-                                                       {html_options values=$CartridgeKeys output=$Cartridges}
-                                               </select>
-{/render}
-{render acl=$CartridgesACL}
-                                               <input name="AddCartridge"      value="{t}Add{/t}" type="submit" >      
-{/render}
-{render acl=$CartridgesACL}
-                                               <input name="RemoveCartridge"   value="{t}Remove{/t}" type="submit" >   
-{/render}
-                                       </td>
-                               </tr>
-                       </table>
-               </td>
-       </tr>
-</table>
diff --git a/plugins/admin/systems/glpiPrinterCartridges.tpl b/plugins/admin/systems/glpiPrinterCartridges.tpl
deleted file mode 100644 (file)
index 5dcd2de..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
-<tr>
-  <td style="vertical-align:top;width:50%;" >
-  <div class="contentboxh" style="height:20px;">
-    <p class="contentboxh" style="font-size:12px;">
-     {t}List of available cartridge type for this type of printer{/t}
-    </p>
-  </div>
-  <div class="contentboxb">
-      {$devicehead}
-  </div>
-  <div style='height:4px;'></div>
-  <div class="contentboxb" style="border-top:1px solid #B0B0B0;">
-      {$devices}
-    <input type=hidden name="edit_helper">
-  </div>
-  </td>
-  <td style="vertical-align:top;">
-   <div class="contentboxh" style="border-bottom:1px solid #B0B0B0;height:20px;" >
-    <p class="contentboxh" style="font-size:12px;"><img src="{$infoimage}" align="right" alt="[i]">{t}Information{/t}</p>
-   </div>
-   <div class="contentboxb" style="padding:5px;">
-    {t}This dialog allows you to create new types of cartridges, and select one or more types for your printer. Cartridge types depends on the printer type you have selected. For each selected cartridge type there will be a new cartridge created, this allows you to select the same cartridge type for more then one printer.{/t}
-   </div>
-   <br>
-   <div class="contentboxh" style="height:20px;">
-    <p class="contentboxh" style="font-size:12px;"><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>
-<table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
-<tr>
-<td><LABEL for="regex"><img alt="{t}Display cartridge types matching{/t}" src="{$search_image}" align=middle></label></td>
-<td width="99%">
-<input type='text' style='width:99%' name='cartridge_regex' maxlength='20' value='{$cartridge_regex}' title='{t}Regular expression for matching cartridge types{/t}' onChange="mainform.submit()">
-</td>
-</tr>
-</table>
-   {$apply}
-   </div>
-  </td>
-</tr>
-</table>
-
-<input type="hidden" name="ignore">
-<p class="seperator">&nbsp;</p>
-<div align="right">
-       <p>
-       <input type="submit" name="SelectCartridgeSave" value="{t}Use{/t}">
-       <input type="submit" name="SelectCartridgeCancel" value="{t}Cancel{/t}">
-       </p>
-</div>
diff --git a/plugins/admin/systems/glpiPrinterCartridgesEdit.tpl b/plugins/admin/systems/glpiPrinterCartridgesEdit.tpl
deleted file mode 100644 (file)
index 6857efd..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-<table summary="" title="" style="width: 100%;">
-       <tr>
-               <td>
-                       <h2>{t}Generic{/t}</h2>
-                       <table summary="" title="" width="100%" style="vertical-align:top;">    
-                               <tr>
-                                       <td>{t}Name{/t}
-                                       </td>
-                                       <td>
-                                               <input type="text" name="name" value="{$name}">
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>{t}Reference{/t}
-                                       </td>
-                                       <td>
-                                               <input type="text" name="ref" value="{$ref}">
-                                       </td>
-                               </tr>
-                       </table>
-                       <p class="seperator">&nbsp;</p>
-                       <h2>{t}Comments{/t}</h2>
-                       <table summary="" title="" width="100%" style="vertical-align:top;">    
-                               <tr>
-                                       <td>{t}Comment{/t}
-                                       </td>
-                                       <td>
-                                               <textarea name="comments" style="width:100%;">{$comments}</textarea>    
-                                       </td>
-                               </tr>
-                       </table>
-               </td>
-               <td style="vertical-align:top;border-left: 1px solid rgb(160, 160, 160);padding-right: 5px;">
-                       <h2>{t}Generic{/t}</h2>
-            <table summary="" title="" width="100%" style="vertical-align:top;">
-                <tr>
-                    <td>{t}Type{/t}
-                    </td>
-                    <td>
-                                               <select name="type" >
-                            {html_options values=$typeKeys output=$types selected=$type}
-                        </select>
-                        <input type="submit" value="{t}edit{/t}" name="edit_type_cartridge">
-                    </td>
-                       </tr>
-                <tr>
-                    <td>{t}Manufacturer{/t}
-                    </td>
-                    <td>
-                                               <select name="FK_glpi_enterprise">
-                            {html_options values=$ManufacturerKeys output=$Manufacturers selected=$FK_glpi_enterprise}
-                        </select>
-                        <input type="submit" value="{t}edit{/t}" name="edit_manufacturer_cartridges">
-                    </td>
-                       </tr>
-                               <tr>
-                    <td>{t}Technical responsible{/t}&nbsp;
-                    </td>
-                    <td>
-                        <i>{$tech_num}&nbsp; </i>&nbsp;
-                        <input type="submit" value="{t}Choose{/t}" name="SelectCartridgeTechPerson">
-                    </td>
-                </tr>
-                       </table>
-                       <p class="seperator">&nbsp;</p>
-                       {$PrinterTypeMatrix}
-               </td>
-       </tr>
-</table>
-
-<p class="seperator">&nbsp;</p>
-<div style="text-align:right;">
-       <p>
-               <input type="submit" name="SaveCartridge"       value="{t}Save{/t}">&nbsp;
-               <input type="submit" name="CancelCartridge" value="{t}Cancel{/t}"><br>
-       </p>
-</div>
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('name');
-  -->
-</script>
-
diff --git a/plugins/admin/systems/glpiSelectUser.tpl b/plugins/admin/systems/glpiSelectUser.tpl
deleted file mode 100644 (file)
index 75bf351..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
-<tr>
-  <td style="vertical-align:top;width:50%;" >
-  <div class="contentboxh" style="height:20px;">
-    <p class="contentboxh" style="font-size:12px;">
-     {t}List of users{/t}
-    </p>
-  </div>
-  <div class="contentboxb">
-      {$usershead}
-  </div>
-  <div style='height:4px;'></div>
-  <div class="contentboxb" style="border-top:1px solid #B0B0B0;">
-      {$users}
-    <input type=hidden name="edit_helper">
-  </div>
-  </td>
-  <td style="vertical-align:top;">
-   <div class="contentboxh" style="border-bottom:1px solid #B0B0B0;height:20px;">
-    <p class="contentboxh" style="font-size:12px;"><img src="{$infoimage}" align="right" alt="[i]">{t}Information{/t}</p>
-   </div>
-   <div class="contentboxb" style="padding:5px;">
-    {t}This dialog allows you to select a user as technical responsible person.{/t}
-   </div>
-   <br>
-   <div class="contentboxh" style="height:20px;">
-    <p class="contentboxh" style="font-size:12px"><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>
-<table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
-<tr>
-<td><LABEL for="regex"><img alt="{t}Display users matching{/t}" src="{$search_image}" align=middle></label></td>
-<td width="99%">
-<input type='text' style='width:99%' name='regex' maxlength='20' value='{$users_regex}' title='{t}Regular expression for matching user names{/t}' onChange="mainform.submit()">
-</td>
-</tr>
-</table>
-   {$apply}
-   </div>
-  </td>
-</tr>
-</table>
-
-<input type="hidden" name="ignore">
-<p class="seperator">&nbsp;</p>
-<div align="right">
-       <p>
-       <input type="submit" name="{$AbortSelectUser}" value="{t}Cancel{/t}">
-</p>
-</div>
diff --git a/plugins/admin/systems/glpi_devices.tpl b/plugins/admin/systems/glpi_devices.tpl
deleted file mode 100644 (file)
index 44de4fa..0000000
+++ /dev/null
@@ -1,763 +0,0 @@
-{if $device_type=="monitor"}
-       <h2><img alt="" align="middle" src="images/monitor.png" class="center">&nbsp;{t}Add/Edit monitor{/t}</h2>
-       <p class="seperator">&nbsp;</p>
-       <br>
-       <table summary="" width="100%">
-               <tr>
-                       <td width="50%" style="vertical-align:top; border-right:1px solid #A0A0A0; padding-right:5px;">
-                               <table summary="" width="100%">
-                                       <tr>
-                                               <td>{t}Name{/t}
-                                               </td>   
-                                               <td>    
-                                                       <input name="name" value="{$name}">
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td style="vertical-align:top;">{t}Comments{/t}
-                                               </td>   
-                                               <td>    
-                                                       <textarea name="comments">{$comments}</textarea>
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td>{t}Manufacturer{/t}
-                                               </td>   
-                                               <td>    
-                                                       <select name="FK_glpi_enterprise">
-                                                               {html_options values=$FK_glpi_enterpriseKeys output=$FK_glpi_enterprises selected=$FK_glpi_enterprise}
-                                                       </select>
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td style="vertical-align:top;">{t}Monitor size{/t}
-                                               </td>   
-                                               <td>    
-                                                       <input name="size" value="{$size}"> {t}Inch{/t}
-                                               </td>
-                                       </tr>
-                               </table>
-                       </td>
-                       <td>
-                               <table summary="" width="100%">
-                                       <tr>
-                        <td>{t}Integrated microphone{/t}
-                        </td>
-                        <td>
-                            <input type="radio" name="flags_micro" value="1" {if $flags_micro == "1"}checked {/if}>{t}Yes{/t}
-                            <input type="radio" name="flags_micro" value="0" {if ($flags_micro == "0")||($flags_micro=="")}checked {/if}>{t}No{/t}
-                        </td>
-                    </tr>
-                    <tr>
-                        <td>{t}Integrated speakers{/t}
-                        </td>
-                        <td>
-                            <input type="radio" name="flags_speaker" value="1" {if $flags_speaker == "1"}checked {/if}>{t}Yes{/t}
-                            <input type="radio" name="flags_speaker" value="0" {if ($flags_speaker == "0")||($flags_speaker=="")}checked {/if}>{t}No{/t}
-                        </td>
-                    </tr>
-                    <tr>
-                        <td>{t}Sub-D{/t}
-                        </td>
-                        <td>
-                            <input type="radio" name="flags_subd" value="1" {if $flags_subd == "1"}checked {/if}>{t}Yes{/t}
-                            <input type="radio" name="flags_subd" value="0" {if ($flags_subd == "0")||($flags_subd=="")}checked {/if}>{t}No{/t}
-                        </td>
-                    </tr>
-                    <tr>
-                        <td>{t}BNC{/t}
-                        </td>
-                        <td>
-                            <input type="radio" name="flags_bnc" value="1" {if $flags_bnc == "1"}checked {/if}>{t}Yes{/t}
-                            <input type="radio" name="flags_bnc" value="0" {if ($flags_bnc == "0")||($flags_bnc=="")}checked {/if}>{t}No{/t}
-                        </td>
-                    </tr>
-                                       <tr>
-                                               <td style="vertical-align:top;">{t}Serial number{/t}
-                                               </td>   
-                                               <td>    
-                                                       <input name="serial" value="{$serial}">
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td style="vertical-align:top;">{t}Additional serial number{/t}
-                                               </td>   
-                                               <td>    
-                                                       <input name="otherserial" value="{$otherserial}">
-                                               </td>
-                                       </tr>
-                               </table>
-                       </td>
-               </tr>
-       </table>
-
-
-{elseif $device_type=="pci"}
-
-        <h2><img alt="" align="middle" src="images/fai_template.png" class="center">&nbsp;{t}Add/Edit other device{/t}</h2>
-        <p class="seperator">&nbsp;</p>
-        <br>
-       <table summary="" width="100%">
-               <tr>
-                       <td width="50%" style="vertical-align:top; border-right:1px solid #A0A0A0; padding-right:5px;">
-                               <table summary="" width="100%">
-                                       <tr>
-                                               <td>{t}Name{/t}
-                                               </td>   
-                                               <td>    
-                                                       <input name="designation" value="{$designation}">
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td style="vertical-align:top;">{t}Comment{/t}
-                                               </td>   
-                                               <td>    
-                                                       <textarea name="comment">{$comment}</textarea>
-                                               </td>
-                                       </tr>
-                               </table>
-                       </td>
-                       <td>
-                               <table summary="" width="100%">
-                                       <tr>
-                                               <td>{t}Manufacturer{/t}
-                                               </td>   
-                                               <td>    
-                                                       <select name="FK_glpi_enterprise">
-                                                               {html_options values=$FK_glpi_enterpriseKeys output=$FK_glpi_enterprises selected=$FK_glpi_enterprise}
-                                                       </select>
-                                               </td>
-                                       </tr>
-                               </table>
-                       </td>
-               </tr>
-       </table>
-
-{elseif $device_type=="power"}
-
-        <h2><img alt="" align="middle" src="images/power.png" class="center">&nbsp;{t}Add/Edit power supply{/t}</h2>
-        <p class="seperator">&nbsp;</p>
-        <br>
-       <table summary="" width="100%">
-               <tr>
-                       <td width="50%" style="vertical-align:top; border-right:1px solid #A0A0A0; padding-right:5px;">
-                               <table summary="" width="100%">
-                                       <tr>
-                                               <td>{t}Name{/t}
-                                               </td>   
-                                               <td>    
-                                                       <input name="designation" value="{$designation}">
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td style="vertical-align:top;">{t}Comment{/t}
-                                               </td>   
-                                               <td>    
-                                                       <textarea name="comment">{$comment}</textarea>
-                                               </td>
-                                       </tr>
-                               </table>
-                       </td>
-                       <td>
-                               <table summary="" width="100%">
-                                       <tr>
-                                               <td>{t}Manufacturer{/t}
-                                               </td>   
-                                               <td>    
-                                                       <select name="FK_glpi_enterprise">
-                                                               {html_options values=$FK_glpi_enterpriseKeys output=$FK_glpi_enterprises selected=$FK_glpi_enterprise}
-                                                       </select>
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td>{t}Atx{/t}
-                                               </td>   
-                                               <td>    
-                                                       <input type="radio" name="atx" value="Y" {if ($atx == "Y")||($atx=="")}checked {/if}>{t}Yes{/t}
-                                                       <input type="radio" name="atx" value="N" {if $atx == "N"}checked {/if}>{t}No{/t}
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td>{t}Power{/t}
-                                               </td>   
-                                               <td>    
-                                                       <input name="power" value="{$power}">
-                                               </td>
-                                       </tr>
-                               </table>
-                       </td>
-               </tr>
-       </table>
-{elseif $device_type=="gfxcard"}
-
-        <h2><img alt="" align="middle" src="images/gfx_hardware.png" class="center">&nbsp;{t}Add/Edit graphic card{/t}</h2>
-        <p class="seperator">&nbsp;</p>
-        <br>
-       <table summary="" width="100%">
-               <tr>
-                       <td width="50%" style="vertical-align:top; border-right:1px solid #A0A0A0; padding-right:5px;">
-                               <table summary="" width="100%">
-                                       <tr>
-                                               <td>{t}Name{/t}
-                                               </td>   
-                                               <td>    
-                                                       <input name="designation" value="{$designation}">
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td style="vertical-align:top;">{t}Comment{/t}
-                                               </td>   
-                                               <td>    
-                                                       <textarea name="comment">{$comment}</textarea>
-                                               </td>
-                                       </tr>
-                               </table>
-                       </td>
-                       <td>
-                               <table summary="" width="100%">
-                                       <tr>
-                                               <td>{t}Manufacturer{/t}
-                                               </td>   
-                                               <td>    
-                                                       <select name="FK_glpi_enterprise">
-                                                               {html_options values=$FK_glpi_enterpriseKeys output=$FK_glpi_enterprises selected=$FK_glpi_enterprise}
-                                                       </select>
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td>{t}Interface{/t}
-                                               </td>   
-                                               <td>    
-                                                       <select name="interface">
-                                                               {html_options values=$GFXInterfaceKeys output=$GFXInterfaces selected=$interface}
-                                                       </select>
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td>{t}Ram{/t}
-                                               </td>   
-                                               <td>    
-                                                       <input name="ram" value="{$ram}">
-                                               </td>
-                                       </tr>
-                               </table>
-                       </td>
-               </tr>
-       </table>
-{elseif $device_type=="control"}
-
-        <h2><img alt="" align="middle" src="images/hardware.png" class="center">&nbsp;{t}Add/Edit controller{/t}</h2>
-        <p class="seperator">&nbsp;</p>
-        <br>
-       <table summary="" width="100%">
-               <tr>
-                       <td width="50%" style="vertical-align:top; border-right:1px solid #A0A0A0; padding-right:5px;">
-                               <table summary="" width="100%">
-                                       <tr>
-                                               <td>{t}Name{/t}
-                                               </td>   
-                                               <td>    
-                                                       <input name="designation" value="{$designation}">
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td style="vertical-align:top;">{t}Comment{/t}
-                                               </td>   
-                                               <td>    
-                                                       <textarea name="comment">{$comment}</textarea>
-                                               </td>
-                                       </tr>
-                               </table>
-                       </td>
-                       <td>
-                               <table summary="" width="100%">
-                                       <tr>
-                                               <td>{t}Manufacturer{/t}
-                                               </td>   
-                                               <td>    
-                                                       <select name="FK_glpi_enterprise">
-                                                               {html_options values=$FK_glpi_enterpriseKeys output=$FK_glpi_enterprises selected=$FK_glpi_enterprise}
-                                                       </select>
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td>{t}Interface{/t}
-                                               </td>   
-                                               <td>    
-                                                       <select name="interface">
-                                                               {html_options values=$HDDInterfaceKeys output=$HDDInterfaces selected=$interface}
-                                                       </select>
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td>{t}Size{/t}
-                                               </td>   
-                                               <td>    
-                                                       <input type="radio" name="raid" value="Y" {if ($raid == "Y")||($raid=="")}checked {/if}>{t}Yes{/t}
-                                                       <input type="radio" name="raid" value="N" {if $raid == "N"}checked {/if}>{t}No{/t}
-                                               </td>
-                                       </tr>
-                               </table>
-                       </td>
-               </tr>
-       </table>
-
-{elseif $device_type=="drive"}
-
-        <h2><img alt="" align="middle" src="images/drives.png" class="center">&nbsp;{t}Add/Edit drive{/t}</h2>
-        <p class="seperator">&nbsp;</p>
-        <br>
-       <table summary="" width="100%">
-               <tr>
-                       <td width="50%" style="vertical-align:top; border-right:1px solid #A0A0A0; padding-right:5px;">
-                               <table summary="" width="100%">
-                                       <tr>
-                                               <td>{t}Name{/t}
-                                               </td>   
-                                               <td>    
-                                                       <input name="designation" value="{$designation}">
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td style="vertical-align:top;">{t}Comment{/t}
-                                               </td>   
-                                               <td>    
-                                                       <textarea name="comment">{$comment}</textarea>
-                                               </td>
-                                       </tr>
-                               </table>
-                       </td>
-                       <td>
-                               <table summary="" width="100%">
-                                       <tr>
-                                               <td>{t}Manufacturer{/t}
-                                               </td>   
-                                               <td>    
-                                                       <select name="FK_glpi_enterprise">
-                                                               {html_options values=$FK_glpi_enterpriseKeys output=$FK_glpi_enterprises selected=$FK_glpi_enterprise}
-                                                       </select>
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td>{t}Speed{/t}
-                                               </td>   
-                                               <td>    
-                                                       <input type="text" name="speed" value="{$speed}">
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td>{t}Interface{/t}
-                                               </td>   
-                                               <td>    
-                                                       <select name="interface">
-                                                               {html_options values=$HDDInterfaceKeys output=$HDDInterfaces selected=$interface}
-                                                       </select>
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td>{t}Writeable{/t}
-                                               </td>   
-                                               <td>    
-                                                       <input type="radio" name="is_writer" value="Y" {if ($is_writer == "Y")||($is_writer=="")}checked {/if}>{t}Yes{/t}
-                                                       <input type="radio" name="is_writer" value="N" {if $is_writer == "N"}checked {/if}>{t}No{/t}
-                                               </td>
-                                       </tr>
-                               </table>
-                       </td>
-               </tr>
-       </table>
-
-{elseif $device_type=="hdd"}
-        <h2><img alt="" align="middle" src="images/fai_partitionTable.png" class="center">&nbsp;{t}Add/Edit harddisk{/t}</h2>
-        <p class="seperator">&nbsp;</p>
-        <br>
-       <table summary="" width="100%">
-               <tr>
-                       <td width="50%" style="vertical-align:top; border-right:1px solid #A0A0A0; padding-right:5px;">
-                               <table summary="" width="100%">
-                                       <tr>
-                                               <td>{t}Name{/t}
-                                               </td>   
-                                               <td>    
-                                                       <input name="designation" value="{$designation}">
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td style="vertical-align:top;">{t}Comment{/t}
-                                               </td>   
-                                               <td>    
-                                                       <textarea name="comment">{$comment}</textarea>
-                                               </td>
-                                       </tr>
-                               </table>
-                       </td>
-                       <td>
-                               <table summary="" width="100%">
-                                       <tr>
-                                               <td>{t}Manufacturer{/t}
-                                               </td>   
-                                               <td>    
-                                                       <select name="FK_glpi_enterprise">
-                                                               {html_options values=$FK_glpi_enterpriseKeys output=$FK_glpi_enterprises selected=$FK_glpi_enterprise}
-                                                       </select>
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td>{t}Rpm{/t}
-                                               </td>   
-                                               <td>    
-                                                       <input type="text" name="rpm" value="{$rpm}">
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td>{t}Cache{/t}
-                                               </td>   
-                                               <td>    
-                                                       <input type="text" name="cache" value="{$cache}">
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td>{t}Size{/t}
-                                               </td>   
-                                               <td>    
-                                                       <input type="text" name="specif_default" value="{$specif_default}">
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td>{t}Type{/t}
-                                               </td>   
-                                               <td>    
-                                                       <select name="interface">
-                                                               {html_options values=$HDDInterfaceKeys output=$HDDInterfaces selected=$interface}
-                                                       </select>
-                                               </td>
-                                       </tr>
-                                       
-                               </table>
-                       </td>
-               </tr>
-       </table>
-
-{elseif $device_type=="ram"}
-
-        <h2><img alt="" align="middle" src="images/memory.png" class="center">&nbsp;{t}Add/Edit memory{/t}</h2>
-        <p class="seperator">&nbsp;</p>
-        <br>
-       <table summary="" width="100%">
-               <tr>
-                       <td width="50%" style="vertical-align:top; border-right:1px solid #A0A0A0; padding-right:5px;">
-                               <table summary="" width="100%">
-                                       <tr>
-                                               <td>{t}Name{/t}
-                                               </td>   
-                                               <td>    
-                                                       <input name="designation" value="{$designation}">
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td style="vertical-align:top;">{t}Comment{/t}
-                                               </td>   
-                                               <td>    
-                                                       <textarea name="comment">{$comment}</textarea>
-                                               </td>
-                                       </tr>
-                               </table>
-                       </td>
-                       <td>
-                               <table summary="" width="100%">
-                                       <tr>
-                                               <td>{t}Manufacturer{/t}
-                                               </td>   
-                                               <td>    
-                                                       <select name="FK_glpi_enterprise">
-                                                               {html_options values=$FK_glpi_enterpriseKeys output=$FK_glpi_enterprises selected=$FK_glpi_enterprise}
-                                                       </select>
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td>{t}Frequenz{/t}
-                                               </td>   
-                                               <td>    
-                                                       <input type="text" name="frequence" value="{$frequence}">
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td>{t}Size{/t}
-                                               </td>   
-                                               <td>    
-                                                       <input type="text" name="specif_default" value="{$specif_default}">
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td>{t}Type{/t}
-                                               </td>   
-                                               <td>    
-                                                       <select name="type">
-                                                               {html_options values=$RAMtypeKeys output=$RAMtypes selected=$type}
-                                                       </select>
-                                               </td>
-                                       </tr>
-                                       
-                               </table>
-                       </td>
-               </tr>
-       </table>
-
-{elseif $device_type=="sndcard"}
-        <h2><img alt="" align="middle" src="images/snd_hardware.png" class="center">&nbsp;{t}Add/Edit sound card{/t}</h2>
-        <p class="seperator">&nbsp;</p>
-        <br>
-       <table summary="" width="100%">
-               <tr>
-                       <td width="50%" style="vertical-align:top; border-right:1px solid #A0A0A0; padding-right:5px;">
-                               <table summary="" width="100%">
-                                       <tr>
-                                               <td>{t}Name{/t}
-                                               </td>   
-                                               <td>    
-                                                       <input name="designation" value="{$designation}">
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td style="vertical-align:top;">{t}Comment{/t}
-                                               </td>   
-                                               <td>    
-                                                       <textarea name="comment">{$comment}</textarea>
-                                               </td>
-                                       </tr>
-                               </table>
-                       </td>
-                       <td>
-                               <table summary="" width="100%">
-                                       <tr>
-                                               <td>{t}Manufacturer{/t}
-                                               </td>   
-                                               <td>    
-                                                       <select name="FK_glpi_enterprise">
-                                                               {html_options values=$FK_glpi_enterpriseKeys output=$FK_glpi_enterprises selected=$FK_glpi_enterprise}
-                                                       </select>
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td>{t}Type{/t}
-                                               </td>   
-                                               <td>    
-                                                       <input type="text" name="type" value="{$type}">
-                                               </td>
-                                       </tr>
-                               </table>
-                       </td>
-               </tr>
-       </table>
-{elseif $device_type=="iface"}
-    <h2><img alt="" align="middle" src="images/net_hardware.png" class="center">&nbsp;{t}Add/Edit network interface{/t}</h2>
-    <p class="seperator">&nbsp;</p>
-    <br>
-
-    <table summary="" width="100%">
-        <tr>
-            <td width="50%" style="vertical-align:top; border-right:1px solid #A0A0A0; padding-right:5px;">
-                <table summary="" width="100%">
-                    <tr>
-                        <td>{t}Name{/t}
-                        </td>
-                        <td>
-                            <input name="designation" value="{$designation}">
-                        </td>
-                    </tr>
-                    <tr>
-                        <td style="vertical-align:top;">{t}Comment{/t}
-                        </td>
-                        <td>
-                            <textarea name="comment">{$comment}</textarea>
-                        </td>
-                    </tr>
-                </table>
-            </td>
-            <td>
-                <table summary="" width="100%">
-                    <tr>
-                        <td>{t}Manufacturer{/t}
-                        </td>
-                        <td>
-                            <select name="FK_glpi_enterprise">
-                                {html_options values=$FK_glpi_enterpriseKeys output=$FK_glpi_enterprises selected=$FK_glpi_enterprise}
-                            </select>
-                        </td>
-                    </tr>
-                    <tr>
-                        <td>{t}MAC address{/t}
-                        </td>
-                        <td>
-                            <input type="text" name="specif_default" value="{$specif_default}">
-                        </td>
-                    </tr>
-                    <tr>
-                        <td>{t}Bandwidth{/t}
-                        </td>
-                        <td>
-                            <input type="text" name="bandwidth" value="{$bandwidth}">
-                        </td>
-                    </tr>
-                </table>
-            </td>
-        </tr>
-    </table>
-{elseif $device_type=="processor"}
-    <h2><img alt="" align="middle" src="images/processor.png" class="center">&nbsp;{t}Add/Edit processor{/t}</h2>
-    <p class="seperator">&nbsp;</p>
-    <br>
-    <table summary="" width="100%">
-        <tr>
-            <td width="50%" style="vertical-align:top; border-right:1px solid #A0A0A0; padding-right:5px;">
-                <table summary="" width="100%">
-                    <tr>
-                        <td>{t}Name{/t}
-                        </td>
-                        <td>
-                            <input name="designation" value="{$designation}">
-                        </td>
-                    </tr>
-                    <tr>
-                        <td style="vertical-align:top;">{t}Comment{/t}
-                        </td>
-                        <td>
-                            <textarea name="comment">{$comment}</textarea>
-                        </td>
-                    </tr>
-                </table>
-            </td>
-            <td>
-                <table summary="" width="100%">
-                    <tr>
-                        <td>{t}Manufacturer{/t}
-                        </td>
-                        <td>
-                            <select name="FK_glpi_enterprise">
-                                {html_options values=$FK_glpi_enterpriseKeys output=$FK_glpi_enterprises selected=$FK_glpi_enterprise}
-                            </select>
-                        </td>
-                    </tr>
-                    <tr>
-                        <td>{t}Frequence{/t}
-                        </td>
-                        <td>
-                            <input type="text" name="frequence" value="{$frequence}">
-                        </td>
-                    </tr>
-                    <tr>
-                        <td>{t}Default frequence{/t}
-                        </td>
-                        <td>
-                            <input type="text" name="specif_default" value="{$specif_default}">
-                        </td>
-                    </tr>
-                </table>
-            </td>
-        </tr>
-    </table>
-
-{elseif $device_type=="moboard"}
-        <h2><img alt="" align="middle" src="images/mainboard.png" class="center">&nbsp;{t}Add/Edit motherboard{/t}</h2>
-        <p class="seperator">&nbsp;</p>
-        <br>
-       <table summary="" width="100%">
-               <tr>
-                       <td width="50%" style="vertical-align:top; border-right:1px solid #A0A0A0; padding-right:5px;">
-                               <table summary="" width="100%">
-                                       <tr>
-                                               <td>{t}Name{/t}
-                                               </td>   
-                                               <td>    
-                                                       <input name="designation" value="{$designation}">
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td style="vertical-align:top;">{t}Comment{/t}
-                                               </td>   
-                                               <td>    
-                                                       <textarea name="comment">{$comment}</textarea>
-                                               </td>
-                                       </tr>
-                               </table>
-                       </td>
-                       <td>
-                               <table summary="" width="100%">
-                                       <tr>
-                                               <td>{t}Manufacturer{/t}
-                                               </td>   
-                                               <td>    
-                                                       <select name="FK_glpi_enterprise">
-                                                               {html_options values=$FK_glpi_enterpriseKeys output=$FK_glpi_enterprises selected=$FK_glpi_enterprise}
-                                                       </select>
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td>{t}Chipset{/t}
-                                               </td>   
-                                               <td>    
-                                                       <input type="text" name="chipset" value="{$chipset}">
-                                               </td>
-                                       </tr>
-                               </table>
-                       </td>
-               </tr>
-       </table>
-{elseif $device_type=="case"}
-        <h2><img alt="" align="middle" src="images/server.png" class="center">&nbsp;{t}Add/Edit computer case{/t}</h2>
-        <p class="seperator">&nbsp;</p>
-        <br>
-       <table summary="" width="100%">
-               <tr>
-                       <td width="50%" style="vertical-align:top; border-right:1px solid #A0A0A0; padding-right:5px;">
-                               <table summary="" width="100%">
-                                       <tr>
-                                               <td>{t}Name{/t}
-                                               </td>   
-                                               <td>    
-                                                       <input name="designation" value="{$designation}">
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td style="vertical-align:top;">{t}Comment{/t}
-                                               </td>   
-                                               <td>    
-                                                       <textarea name="comment">{$comment}</textarea>
-                                               </td>
-                                       </tr>
-                               </table>
-                       </td>
-                       <td>
-                               <table summary="" width="100%">
-                                       <tr>
-                                               <td>{t}Manufacturer{/t}
-                                               </td>   
-                                               <td>    
-                                                       <select name="FK_glpi_enterprise">
-                                                               {html_options values=$FK_glpi_enterpriseKeys output=$FK_glpi_enterprises selected=$FK_glpi_enterprise}
-                                                       </select>
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td style="vertical-align:top;">{t}format{/t}
-                                               </td>   
-                                               <td>    
-                                                       <select name="format">
-                                                               {html_options values=$formatKeys output=$formats selected=$format}
-                                                       </select>
-                                               </td>
-                                       </tr>
-                               </table>
-                       </td>
-               </tr>
-       </table>
-{/if}
-
-
-<p class="seperator">&nbsp;</p>
-<div align="right">
-       <p>
-               <input type="submit" value="{t}Save{/t}" name="SaveDeviceChanges">
-               <input type="submit" value="{t}Cancel{/t}" name="AbortDeviceChanges">
-       </p> 
-</div>
diff --git a/plugins/admin/systems/glpi_edit_cartridge_type.tpl b/plugins/admin/systems/glpi_edit_cartridge_type.tpl
deleted file mode 100644 (file)
index cbc91d9..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-<br>
-     <select name="select_type_cartridge" size="12" style="width:100%">
-                            {html_options values=$PrinterTypeKeys output=$PrinterTypes}
-     </select><br>
-        <input name="cartridge_type_string">
-        <input type="submit" name="add_cartridge_type"                 value="{t}Add{/t}" >
-        <input type="submit" name="rename_cartridge_type"      value="{t}Rename{/t}" >
-        <input type="submit" name="del_cartridge_type"                 value="{t}Delete{/t}" >
-
-<p class="seperator">&nbsp;</p>
-<div align="right">
-<p>
-<input name="close_edit_type_cartridge" value="{t}Close{/t}" type="submit">
-</p>
-</div>
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('cartridge_type_string');
-  -->
-</script>
-
diff --git a/plugins/admin/systems/glpi_edit_os.tpl b/plugins/admin/systems/glpi_edit_os.tpl
deleted file mode 100644 (file)
index 8e37264..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-<h2>{t}Manage OS-types{/t}</h2>
-{if $Method == "edit"}
-
-       <select name="select_os" size="12" style="width:100%">
-                               {html_options values=$OSKeys output=$OSs}
-       </select><br>
-       <input name="is_string">
-       <input type="submit" name="add_os"              value="{t}Add{/t}" >
-       <input type="submit" name="rename_os"   value="{t}Rename{/t}" >
-       <input type="submit" name="del_os"              value="{t}Delete{/t}" >
-
-<p class="seperator">&nbsp;</p>
-<div align="right">
-<p>
-<input name="close_edit_os" value="{t}Close{/t}" type="submit">
-</p>
-</div>
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-               focus_field('is_string');
-  -->
-</script>
-{else}
-{t}Please enter a new name{/t}&nbsp;<input name="string" value="{$string}">
-<p class="seperator">&nbsp;</p>
-    <p>
-        <div align="right" style="text-align: right;">
-            <input type="submit" name="Rename_os_OK"       value="{t}Rename{/t}" >
-            <input type="submit" name="Rename_Cancel"   value="{t}Cancel{/t}" >
-        </div>
-    </p>
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('string');
-  -->
-</script>
-{/if}
-
-
diff --git a/plugins/admin/systems/glpi_edit_printer_type.tpl b/plugins/admin/systems/glpi_edit_printer_type.tpl
deleted file mode 100644 (file)
index a63e923..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-<br>
-{if $Method == "edit"}
-        <select name="select_type" size="12" style="width:100%">
-                                                       {html_options values=$PrinterTypeKeys output=$PrinterTypes}
-        </select><br>
-        <input name="type_string">
-        <input type="submit" name="add_type"           value="{t}Add{/t}" >
-        <input type="submit" name="rename_type"        value="{t}Rename{/t}" >
-        <input type="submit" name="del_type"           value="{t}Delete{/t}" >
-
-       <p class="seperator">&nbsp;</p>
-       <div align="right">
-               <p>
-                       <input name="close_edit_type" value="{t}Close{/t}" type="submit">
-               </p>
-       </div>
-       <script language="JavaScript" type="text/javascript">
-         <!-- // First input field on page
-               focus_field('type_string');
-         -->
-       </script>
-
-{else}
-
-       {t}Please enter a new name{/t}&nbsp;<input name="string" value="{$string}">
-       <p class="seperator">&nbsp;</p>
-    <p>
-        <div align="right" style="text-align: right;">
-            <input type="submit" name="Rename_PType_OK"       value="{t}Rename{/t}" >
-            <input type="submit" name="Rename_Cancel"   value="{t}Cancel{/t}" >
-        </div>
-    </p>
-       <script language="JavaScript" type="text/javascript">
-         <!-- // First input field on page
-               focus_field('string');
-         -->
-       </script>
-
-{/if}
-
diff --git a/plugins/admin/systems/glpi_edit_type.tpl b/plugins/admin/systems/glpi_edit_type.tpl
deleted file mode 100644 (file)
index 14a4f54..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-<h2>{t}Manage System-types{/t}</h2>
-{if $Method == "edit"}
-
-     <select name="select_type" size="12" style="width:100%">
-                            {html_options values=$SystemTypeKeys output=$SystemTypes}
-     </select><br>
-        <input name="type_string">
-        <input type="submit" name="add_type"           value="{t}Add{/t}" >
-        <input type="submit" name="rename_type"        value="{t}Rename{/t}" >
-        <input type="submit" name="del_type"           value="{t}Delete{/t}" >
-
-       <p class="seperator">&nbsp;</p>
-       <div align="right">
-       <p>
-       <input name="close_edit_type" value="{t}Close{/t}" type="submit">
-       </p>
-       </div>
-       <script language="JavaScript" type="text/javascript">
-         <!-- // First input field on page
-               focus_field('type_string');
-         -->
-       </script>
-{else}
-{t}Please enter a new name{/t}&nbsp;<input name="string" value="{$string}">
-<p class="seperator">&nbsp;</p>
-       <p>
-               <div align="right" style="text-align: right;">
-                       <input type="submit" name="Rename_type_OK"              value="{t}Rename{/t}" >
-                       <input type="submit" name="Rename_Cancel"       value="{t}Cancel{/t}" >
-               </div>
-       </p>
-       <script language="JavaScript" type="text/javascript">
-       <!-- // First input field on page
-               focus_field('string');
-       -->
-       </script>
-{/if}
diff --git a/plugins/admin/systems/goCupsServer.tpl b/plugins/admin/systems/goCupsServer.tpl
deleted file mode 100644 (file)
index e10bd2f..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<h2>{t}Print Service{/t} {t}enabled{/t}</h2>
-
-<p class='seperator'>&nbsp;</p>
-<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
-    <input type='submit' name='SaveService' value='{t}Save{/t}'>
-    &nbsp;
-    <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
-</div>
-<input type="hidden" name="goCupsServerPosted" value="1">
diff --git a/plugins/admin/systems/goFaxServer.tpl b/plugins/admin/systems/goFaxServer.tpl
deleted file mode 100644 (file)
index 27560b3..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-<h2><img class="center" alt="" align="middle" src="images/rightarrow.png" /> {t}FAX database information{/t}</h2>
- <table summary="">
-    <tr>
-     <td>{t}FAX DB user{/t}{$must}</td>
-     <td>
-{render acl=$goFaxAdminACL}
-       <input name="goFaxAdmin" size=30 maxlength=60 id="goFaxAdmin" value="{$goFaxAdmin}" >
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td>{t}Password{/t}{$must}</td>
-     <td>
-{render acl=$goFaxPasswordACL}
-       <input type=password name="goFaxPassword" id="goFaxPassword" size=30 maxlength=60 value="{$goFaxPassword}" >
-{/render}
-     </td>
-    </tr>
-   </table>
-
-<p class='seperator'>&nbsp;</p>
-<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
-    <input type='submit' name='SaveService' value='{t}Save{/t}'>
-    &nbsp;
-    <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
-</div>
-<input type="hidden" name="goFaxServerPosted" value="1">
diff --git a/plugins/admin/systems/goFonServer.tpl b/plugins/admin/systems/goFonServer.tpl
deleted file mode 100644 (file)
index 14a1603..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-<h2><img class="center" alt="" align="middle" src="images/rightarrow.png" /> {t}VoIP database information{/t}</h2>
-  <table summary="">
-    <tr>
-     <td>{t}Asterisk DB user{/t}{$must}</td>
-     <td>
-{render acl=$goFonAdminACL}
-      <input name="goFonAdmin" size=30 maxlength=60 id="goFonAdmin" value="{$goFonAdmin}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td>{t}Password{/t}{$must}</td>
-     <td>
-{render acl=$goFonPasswordACL}
-      <input type=password name="goFonPassword" id="goFonPassword" size=30 maxlength=60 value="{$goFonPassword}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td>{t}Country dial prefix{/t}{$must}</td>
-     <td>
-{render acl=$goFonCountryCodeACL}
-      <input name="goFonCountryCode" size=10 maxlength=30 id="goFonCountryCode" value="{$goFonCountryCode}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td>{t}Local dial prefix{/t}{$must}</td>
-     <td>
-{render acl=$goFonAreaCodeACL}
-      <input name="goFonAreaCode" size=10 maxlength=30 id="goFonAreaCode" value="{$goFonAreaCode}">
-{/render}
-     </td>
-    </tr>
-   </table>
-
-<p class='seperator'>&nbsp;</p>
-<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
-    <input type='submit' name='SaveService' value='{t}Save{/t}'>
-    &nbsp;
-    <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
-</div>
-<input type="hidden" name="goFonServerPosted" value="1">
diff --git a/plugins/admin/systems/goGlpiServer.tpl b/plugins/admin/systems/goGlpiServer.tpl
deleted file mode 100644 (file)
index 36a2f24..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-<h2><img class="center" alt="" align="middle" src="images/rightarrow.png" /> {t}GLPI database information{/t}</h2>
-  <table summary="">
-    <tr>
-     <td>{t}Logging DB user{/t}{$must}</td>
-     <td>
-{render acl=$goGlpiAdminACL}
-      <input name="goGlpiAdmin" id="goGlpiAdmin" size=30 maxlength=60 value="{$goGlpiAdmin}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td>{t}Password{/t}</td>
-     <td>
-{render acl=$goGlpiPasswordACL}
-      <input type="password" name="goGlpiPassword" id="goGlpiPassword" size=30 maxlength=60 value="{$goGlpiPassword}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td>{t}Database{/t}{$must}</td>
-     <td>
-{render acl=$goGlpiDatabaseACL}
-      <input name="goGlpiDatabase" id="goGlpiDatabase" size=30 maxlength=60 value="{$goGlpiDatabase}">
-{/render}
-     </td>
-    </tr>
-   </table>
-
-
-<p class='seperator'>&nbsp;</p>
-<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
-    <input type='submit' name='SaveService' value='{t}Save{/t}'>
-    &nbsp;
-    <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
-</div>
-<input type="hidden" name="goGlpiServer_posted" value="1">
diff --git a/plugins/admin/systems/goImapServer.tpl b/plugins/admin/systems/goImapServer.tpl
deleted file mode 100644 (file)
index 17c4009..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-<h2><img class="center" alt="" align="middle" src="images/rightarrow.png" /> {t}Generic{/t}</h2>
-<table width="100%">
-       <tr>
-               <td style='width:50%;'>
-                       <table summary="">
-                               <tr>
-                                       <td>{t}Server identifier{/t}{$must}
-                                       </td>
-                                       <td>
-{render acl=$goImapNameACL}
-                                               <input name="goImapName" id="goImapName" size=40 maxlength=60 value="{$goImapName}" >
-{/render}
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>{t}Connect URL{/t}{$must}
-                                       </td>
-                                       <td>
-{render acl=$goImapConnectACL}
-                                               <input name="goImapConnect" id="goImapConnect" size=40 maxlength=60 value="{$goImapConnect}" >
-{/render}
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>{t}Admin user{/t}{$must}
-                                       </td>
-                                       <td>
-{render acl=$goImapAdminACL}
-                                               <input name="goImapAdmin" id="goImapAdmin" size=30 maxlength=60 value="{$goImapAdmin}" >
-{/render}
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>{t}Password{/t}{$must}
-                                       </td>
-                                       <td>
-{render acl=$goImapPasswordACL}
-                                       <input type=password name="goImapPassword" id="goImapPassword" size=30 maxlength=60 value="{$goImapPassword}" >
-{/render}
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>{t}Sieve port{/t}{$must}
-                                       </td>
-                                       <td>
-{render acl=$goImapSievePortACL}
-                                               <input name="goImapSievePort" id="goImapSievePort" size=10 maxlength=30 value="{$goImapSievePort}">
-{/render}
-                                       </td>
-                               </tr>
-                       </table>
-               </td>
-               <td style="border-left:1px solid #A0A0A0;vertical-align:top;">
-                       <table>
-                               <tr>
-                                       <td>
-{render acl=$cyrusImapACL}
-                                               <input type='checkbox' name='cyrusImap' value=1 {if $cyrusImap} checked {/if} > 
-{/render}
-                                       </td>
-                                       <td>{t}Start IMAP service{/t}
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>
-{render acl=$cyrusImapSSLACL}
-                                               <input type='checkbox' name='cyrusImapSSL' value=1 {if $cyrusImapSSL} checked {/if}> 
-{/render}
-                                       </td>
-                                       <td>{t}Start IMAP SSL service{/t}
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>
-{render acl=$cyrusPop3ACL}
-                                               <input type='checkbox' name='cyrusPop3' value=1 {if $cyrusPop3} checked {/if} > 
-{/render}
-                                       </td>
-                                       <td>{t}Start POP3 service{/t}
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>
-{render acl=$cyrusPop3SSLACL}
-                                               <input type='checkbox' name='cyrusPop3SSL' value=1 {if $cyrusPop3SSL} checked {/if} > 
-{/render}
-                                       </td>
-                                       <td>{t}Start POP3 SSL service{/t}
-                                       </td>
-                               </tr>
-                       </table>
-               </td>
-       </tr>
-</table>
-<p class='seperator'>&nbsp;</p>
-<br>
-<h2><img class="center" alt="" src="images/rocket.png" align="middle"> Action</h2>
-{if $is_new == "new"}
-    {t}The server must be saved before you can use the status flag.{/t}
-{elseif !$is_acc}
-    {t}The service must be saved before you can use the status flag.{/t}
-{/if}
-<br>
-<select name="action" title='{t}Set new status{/t}' 
-       {if $is_new =="new" || !$is_acc} disabled {/if}
->
-       <option value="none">&nbsp;</option>
-    {html_options options=$Actions}
-</select>
-<input type='submit' name='ExecAction' title='{t}Set status{/t}' value='{t}Execute{/t}' 
-       {if $is_new == "new" | !$is_acc} disabled {/if}
->
-
-<p class="seperator">&nbsp;</p>
-<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
-    <input type='submit' name='SaveService' value='{t}Save{/t}'>
-    &nbsp;
-    <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
-</div>
-<input type="hidden" name="goImapServerPosted" value="1">
diff --git a/plugins/admin/systems/goKioskService.tpl b/plugins/admin/systems/goKioskService.tpl
deleted file mode 100644 (file)
index f812304..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-<h2><img alt="" class="center" src="images/house.png" align="middle">&nbsp;<LABEL for="gotoKioskProfile">{t}Kiosk profile management{/t}</ LABEL></h2>
-
-    <input type="hidden" name="dialogissubmitted" value="1">
-
-{t}Server path{/t}&nbsp;<input name="server_path" style="width:300px;" value="{$server_path}">
-<br>
-<br>
-{$divlist}
-<input type="file" size=50 name="newProfile" value="{t}Browse{/t}">
-<input type="submit" name="profileAdd" value="{t}Add{/t}">
-
-<p class='seperator'>&nbsp;</p>
-<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
-    <input type='submit' name='SaveService' value='{t}Save{/t}'>
-    &nbsp;
-    <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
-</div>
-<input type="hidden" name="goKioskPosted" value="1">
-
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-    focus_field('gotoKioskProfile');
-  -->
-</script>
diff --git a/plugins/admin/systems/goKrbServer.tpl b/plugins/admin/systems/goKrbServer.tpl
deleted file mode 100644 (file)
index a0234eb..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<h2><img class="center" alt="" align="middle" src="images/rightarrow.png" /> {t}Kerberos kadmin access{/t}</h2>
-  <table summary="">
-    <tr>
-     <td>{t}Kerberos Realm{/t}{$must}</td>
-     <td>
-{render acl=$goKrbRealmACL}
-      <input name="goKrbRealm" id="goKrbRealm" size=30 maxlength=60  value="{$goKrbRealm}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td>{t}Admin user{/t}{$must}</td>
-     <td>
-{render acl=$goKrbAdminACL}
-      <input name="goKrbAdmin" id="goKrbAdmin" size=30 maxlength=60 value="{$goKrbAdmin}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td>{t}Password{/t}{$must}</td>
-     <td>
-{render acl=$goKrbPasswordACL}
-      <input type=password name="goKrbPassword" id="goKrbPassword" size=30 maxlength=60 value="{$goKrbPassword}">
-{/render}
-     </td>
-    </tr>
-   </table>
-<p class='seperator'>&nbsp;</p>
-<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
-    <input type='submit' name='SaveService' value='{t}Save{/t}'>
-    &nbsp;
-    <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
-</div>
-<input type="hidden" name="goKrbServerPosted" value="1">
diff --git a/plugins/admin/systems/goLdapServer.tpl b/plugins/admin/systems/goLdapServer.tpl
deleted file mode 100644 (file)
index 24e1817..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<h2><img class="center" alt="" align="middle" src="images/rightarrow.png" /> {t}LDAP service{/t}</h2>
-{t}LDAP URI{/t}{$must} 
-{render acl=$goLdapBaseACL}
-<input type="text" size="80" value="{$goLdapBase}"  name="goLdapBase" id="goLdapBaseId">
-{/render}
-
-<p class='seperator'>&nbsp;</p>
-<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
-    <input type='submit' name='SaveService' value='{t}Save{/t}'>
-    &nbsp;
-    <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
-</div>
-<input type="hidden" name="goLdapServerPosted" value="1">
diff --git a/plugins/admin/systems/goLogDBServer.tpl b/plugins/admin/systems/goLogDBServer.tpl
deleted file mode 100644 (file)
index 8395070..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-<h2><img class="center" alt="" align="middle" src="images/rightarrow.png" /> {t}Logging database information{/t}</h2>
-<table summary="">
-    <tr>
-     <td>{t}Logging DB user{/t}{$must}</td>
-     <td>
-{render acl=$goLogAdminACL}
-       <input name="goLogAdmin" id="goLogAdmin" size=30 maxlength=60 value="{$goLogAdmin}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td>{t}Password{/t}{$must}</td>
-     <td>
-{render acl=$goLogPasswordACL}
-       <input type=password name="goLogPassword" id="goLogPassword" size=30 maxlength=60 value="{$goLogPassword}">
-{/render}
-     </td>
-    </tr>
-   </table>
-
-<p class='seperator'>&nbsp;</p>
-<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
-    <input type='submit' name='SaveService' value='{t}Save{/t}'>
-    &nbsp;
-    <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
-</div>
-<input type="hidden" name="goLogDBServerPosted" value="1">
diff --git a/plugins/admin/systems/goMailServer.tpl b/plugins/admin/systems/goMailServer.tpl
deleted file mode 100644 (file)
index a17d08f..0000000
+++ /dev/null
@@ -1,225 +0,0 @@
-<h2><img class="center" alt="" align="middle" src="images/rightarrow.png" /> {t}Generic{/t}</h2>
-<table  style="width:100%;">
-       <tr>
-               <td width="50%" style="vertical-align:top">
-                       <table >
-                               <tr>
-                                       <td>{t}Visible full qualified hostname{/t}
-                                       </td>
-                                       <td>
-{render acl=$postfixMyhostnameACL}
-                                               <input type="text" name='postfixMyhostname' value='{$postfixMyhostname}' title='{t}The full qualified host name.{/t}'>
-{/render}
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>{t}Max mail header size{/t}
-                                       </td>
-                                       <td>
-{render acl=$postfixMyhostnameACL}
-                                               <input type="text" name='postfixHeaderSizeLimit' value='{$postfixHeaderSizeLimit}' 
-                                                                       title='{t}This value specifies the maximal header size.{/t}'>&nbsp;{t}KB{/t}
-{/render}
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>{t}Max mailbox size{/t}
-                                       </td>
-                                       <td>
-{render acl=$postfixMailboxSizeLimitACL}
-                                               <input type="text" name='postfixMailboxSizeLimit' value='{$postfixMailboxSizeLimit}' 
-                                                                       title='{t}Defines the maximal size of mail box.{/t}'>&nbsp;{t}KB{/t}
-{/render}                                      </td>
-                               </tr>
-                               <tr>
-                                       <td>{t}Max message size{/t}
-                                       </td>
-                                       <td>
-{render acl=$postfixMessageSizeLimitACL}
-                                               <input type="text" name='postfixMessageSizeLimit' value='{$postfixMessageSizeLimit}' 
-                                                                       title='{t}Specify the maximal size of a message.{/t}'>&nbsp;{t}KB{/t}
-{/render}
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>{t}Relay host{/t}
-                                       </td>
-                                       <td>
-{render acl=$postfixRelayhostACL}
-                                               <input type="text" name='postfixRelayhost' value='{$postfixRelayhost}' 
-                                                                       title='{t}Relay messages to following host:{/t}'>
-{/render}
-                                       </td>
-                               </tr>
-                       </table>
-               </td>
-               <td style="border-left:1px solid #A0A0A0; ">
-                       <table style="width:100%;">
-                               <tr>
-                                       <td>
-                                               {t}Local networks{/t}<br>
-{render acl=$postfixMyNetworksACL}
-                                               <select name='Select_postfixMyNetworks[]' multiple size=6 style='width:100%;' title='{t}Postfix networks{/t}'>
-                                                       {html_options options=$postfixMyNetworks}
-                                               </select>
-{/render}
-{render acl=$postfixMyNetworksACL}
-                                               <input type="text" name="NewString_postfixMyNetworks" value="">
-{/render}
-{render acl=$postfixMyNetworksACL}
-                                               <input type="submit" name="AddpostfixMyNetworks" value="{t}Add{/t}">
-{/render}
-{render acl=$postfixMyNetworksACL}
-                                               <input type="submit" name="DelpostfixMyNetworks" value="{t}Remove{/t}">
-{/render}
-                                       </td>
-                               </tr>
-                       </table>
-               </td>
-       </tr>
-       <tr>
-               <td colspan="2">
-                       <p class='seperator'>&nbsp;</p>
-                       <h2>{t}Domains and routing{/t}</h2>
-               </td>
-       </tr>   
-       <tr>
-               <td>
-                         <table style="width:100%;">
-                <tr>
-                    <td>
-                        {t}Domains to accept mail for{/t}<br>
-{render acl=$postfixMyDestinationsACL}
-                        <select name='Select_postfixMyDestinations[]' multiple size=6 style='width:100%;' title='{t}Postfix is responsible for the following domains:{/t}'>
-{/render}
-                            {html_options options=$postfixMyDestinations}
-                        </select>
-{render acl=$postfixMyDestinationsACL}
-                        <input type="text" name="NewString_postfixMyDestinations" value="">
-{/render}
-{render acl=$postfixMyDestinationsACL}
-                        <input type="submit" name="AddpostfixMyDestinations" value="{t}Add{/t}">
-{/render}
-{render acl=$postfixMyDestinationsACL}
-                        <input type="submit" name="DelpostfixMyDestinations" value="{t}Remove{/t}">
-{/render}
-                    </td>
-                </tr>
-            </table>
-               </td>
-               <td style="border-left:1px solid #A0A0A0; ">
-                         <table style="width:100%;">
-                <tr>
-                    <td>
-                        {t}Transports{/t}<br>
-{render acl=$postfixTransportTableACL}
-                                               {$Div_postfixTransportTable}
-{/render}
-
-{render acl=$postfixTransportTableACL}
-                        <input type="text" name="Source_postfixTransportTable" value="">
-{/render}
-{render acl=$postfixTransportTableACL}
-                        <select name='TransportProtocol' title='{t}Select a transport protocol.{/t}'>
-                            {html_options options=$TransportProtocols}
-                        </select>
-{/render}
-{render acl=$postfixTransportTableACL}
-                        <input type="text" name="Destination_postfixTransportTable" value="">
-{/render}
-{render acl=$postfixTransportTableACL}
-                        <input type="submit" name="AddpostfixTransportTable" value="{t}Add{/t}">
-{/render}
-                    </td>
-                </tr>
-            </table>
-               </td>
-       </tr>
-       <tr>
-               <td colspan="2">
-                       <p class='seperator'>&nbsp;</p>
-                       <h2>{t}Restrictions{/t}</h2>
-               </td>
-       </tr>   
-       <tr>
-               <td>
-            <table style="width:100%;">
-                <tr>
-                    <td>
-                        {t}Restrictions for sender{/t}<br>
-{render acl=$postfixSenderRestrictionsACL}
-                                               {$Div_postfixSenderRestrictions}
-{/render}
-{render acl=$postfixSenderRestrictionsACL}
-                        <input type="text" name="Source_postfixSenderRestrictions" value="">
-{/render}
-{render acl=$postfixSenderRestrictionsACL}
-                        <select name='SenderRestrictionFilter' title='{t}Restriction filter{/t}'>
-                            {html_options options=$RestrictionFilters}
-                        </select>
-{/render}
-{render acl=$postfixSenderRestrictionsACL}
-                        <input type="text" name="Destination_postfixSenderRestrictions" value="">
-{/render}
-{render acl=$postfixSenderRestrictionsACL}
-                        <input type="submit" name="AddpostfixSenderRestrictions" value="{t}Add{/t}">
-{/render}
-                    </td>
-                </tr>
-            </table>
-               </td>
-               <td style="border-left:1px solid #A0A0A0;">
-            <table style="width:100%;">
-                <tr>
-                    <td>
-                        {t}Restrictions for recipient{/t}<br>
-{render acl=$postfixRecipientRestrictionsACL}
-                                               {$Div_postfixRecipientRestrictions}
-{/render}
-{render acl=$postfixRecipientRestrictionsACL}
-                        <input type="text" name="Source_postfixRecipientRestrictions" value="">
-{/render}
-{render acl=$postfixRecipientRestrictionsACL}
-                        <select name='RecipientRestrictionFilter' title='{t}Restriction filter{/t}'>
-                            {html_options options=$RestrictionFilters}
-                        </select>
-{/render}
-{render acl=$postfixRecipientRestrictionsACL}
-                        <input type="text" name="Destination_postfixRecipientRestrictions" value="">
-{/render}
-{render acl=$postfixRecipientRestrictionsACL}
-                        <input type="submit" name="AddpostfixRecipientRestrictions" value="{t}Add{/t}">
-{/render}
-                    </td>
-                </tr>
-            </table>
-               </td>
-       </tr>   
-</table>
-
-<p class='seperator'>&nbsp;</p>
-<br>
-<h2><img class="center" alt="" src="images/rocket.png" align="middle"> Action</h2>
-{if $is_new == "new"}
-       {t}The server must be saved before you can use the status flag.{/t}
-{elseif !$is_acc}
-       {t}The service must be saved before you can use the status flag.{/t}
-{/if}
-<br>
-<select name="action" title='{t}Set new status{/t}' 
-       {if $is_new == "new" || $is_acc == false} disabled {/if}
->
-       <option value="none">&nbsp;</option>
-       {html_options options=$Actions} 
-</select>
-<input type='submit' name='ExecAction' title='{t}Set status{/t}' value='{t}Execute{/t}' 
-       {if $is_new == "new" || $is_acc == false} disabled {/if}
->
-
-<p class="seperator">&nbsp;</p>
-<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
-    <input type='submit' name='SaveService' value='{t}Save{/t}'>
-    &nbsp;
-    <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
-</p>
-
diff --git a/plugins/admin/systems/goNtpServer.tpl b/plugins/admin/systems/goNtpServer.tpl
deleted file mode 100644 (file)
index 25a91d4..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-<br>
-<h2>{t}Time server{/t}</h2>
-<br>
-<table summary="" style="width:100%">
-<tr>
- <td>
-{render acl=$goNtpServerACL}
-       <select style="width:100%;" id="goTimeEntry" name="goTimeSource[]" size=8 multiple>
-               {html_options values=$goTimeSource output=$goTimeSource}
-               <option disabled>&nbsp;</option>
-       </select>
-{/render}
-<br>
-{render acl=$goNtpServerACL}
-       <input type="text" name="NewNTPExport"  id="NewNTPExportId">
-{/render}
-{render acl=$goNtpServerACL}
-       <input type="submit"    value="{t}Add{/t}"      name="NewNTPAdd"  id="NewNTPAddId">
-{/render}
-{render acl=$goNtpServerACL}
-       <input type="submit"    value="{t}Delete{/t}"   name="DelNTPEnt"  id="DelNTPEntId">
-{/render}
-</td>
-</tr>
-</table>
-
-<p class="seperator">&nbsp;</p>
-<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
-       <input type='submit' name='SaveService' value='{t}Save{/t}'>
-       &nbsp; 
-       <input type='submit' name='CancelService' value='{t}Cancel{/t}'> 
-</div>
diff --git a/plugins/admin/systems/goShareServer.tpl b/plugins/admin/systems/goShareServer.tpl
deleted file mode 100644 (file)
index 2c645c7..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-<h2><img class="center" alt="" align="middle" src="images/rightarrow.png" /> {t}Shares{/t}</h2>
-   <table summary="" style="width:100%">
-    <tr>
-     <td>
-{render acl=$nameACL  mode=read_active}
-        <select style="width:100%" id="goExportEntry" name="goExportEntryList[]" size=12 multiple >
-            {html_options values=$goExportEntry output=$goExportEntryKeys}
-            <option disabled>&nbsp;</option>
-        </select>
-{/render}
-    <br>
-       
-{render acl=$nameACL}
-        <input type="submit"    value="{t}Add{/t}"     name="NewNfsAdd"   id="NewNfsAddId" {if !$createable} disabled {/if}>
-{/render}
-{render acl=$nameACL mode=read_active}
-        <input type="submit"    value="{t}Edit{/t}"     name="NewNfsEdit"  id="NewNfsEditId">
-{/render}
-{render acl=$nameACL}
-        <input type="submit"    value="{t}Delete{/t}"   name="DelNfsEnt"   id="DelNfsEntId" {if !$removeable} disabled {/if}>
-{/render}
-    </td>
-    </tr>
-   </table>
-
-
-<p class='seperator'>&nbsp;</p>
-<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
-    <input type='submit' name='SaveService' value='{t}Save{/t}'>
-    &nbsp;
-    <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
-</div>
-<input type="hidden" name="goShareServerPosted" value="1">
diff --git a/plugins/admin/systems/goSpamServer.tpl b/plugins/admin/systems/goSpamServer.tpl
deleted file mode 100644 (file)
index c8b5885..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-<table style='width:100%'>
- <tr>
-  <td style='width:50%;vertical-align:top;'><h2>Spam tagging</h2>
-
-   <table>
-    <tr>
-     <td>
-      {t}Rewrite header{/t}      
-     </td>
-     <td>
-{render acl=$saRewriteHeaderACL}
-      <input type='text' name='saRewriteHeader' value='{$saRewriteHeader}'>
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td>
-      {t}Required score{/t}      
-     </td>
-     <td>
-{render acl=$saRequiredScoreACL}
-      <select name='saRequiredScore' title='{t}Select required score to tag mail as spam{/t}'>
-       {html_options options=$SpamScore selected=$saRequiredScore}
-      </select>
-{/render}
-     </td>
-    </tr>
-   </table>
-
-  </td>
-  <td style="vertical-align:top;border-left:1px solid #A0A0A0;"><h2>Trusted networks</h2>
-
-   <table width='100%'>
-    <tr>
-     <td>
-{render acl=$saTrustedNetworksACL}
-      <select name='TrustedNetworks[]' size=4 style='width:100%;' multiple>
-       {html_options options=$TrustedNetworks}
-      </select><br>
-{/render}
-{render acl=$saTrustedNetworksACL}
-      <input type='text'       name='NewTrustName' value=''>&nbsp;
-{/render}
-{render acl=$saTrustedNetworksACL}
-      <input type='submit'      name='AddNewTrust'  value='{t}Add{/t}'>
-{/render}
-{render acl=$saTrustedNetworksACL}
-      <input type='submit'      name='DelTrust'     value='{t}Remove{/t}'>
-{/render}
-     </td>
-    </tr>
-   </table>
-
-  </td>
- </tr>
- <tr>
-  <td colspan=2>
-   <p class='seperator'>&nbsp;</p>
-  </td>
- </tr>
- <tr>
-  <td>
-       <h2>Flags</h2>
-       
-   <table>
-    <tr>
-     <td>
-{render acl=$saFlagsBACL}
-      <input type='checkbox' name='saFlagsB' value='1' {$saFlagsBCHK}> &nbsp;{t}Enable use of bayes filtering{/t}<br>
-{/render}
-{render acl=$saFlagsbACL}
-      <input type='checkbox' name='saFlagsb' value='1' {$saFlagsbCHK}> &nbsp;{t}Enable bayes auto learning{/t}<br>
-{/render}
-{render acl=$saFlagsCACL}
-      <input type='checkbox' name='saFlagsC' value='1' {$saFlagsCCHK}> &nbsp;{t}Enable RBL checks{/t}
-{/render}
-     </td>
-    </tr>
-   </table>
-  </td>
-  <td style="vertical-align:bottom;border-left:1px solid #A0A0A0;">
-   <table>
-    <tr>
-     <td>
-{render acl=$saFlagsRACL}
-      <input type='checkbox' name='saFlagsR' value='1' {$saFlagsRCHK}> &nbsp;{t}Enable use of Razor{/t}<br>
-{/render}
-{render acl=$saFlagsDACL}
-      <input type='checkbox' name='saFlagsD' value='1' {$saFlagsDCHK}> &nbsp;{t}Enable use of DDC{/t}<br>
-{/render}
-{render acl=$saFlagsPACL}
-      <input type='checkbox' name='saFlagsP' value='1' {$saFlagsPCHK}> &nbsp;{t}Enable use of Pyzor{/t}
-{/render}
-     </td>
-    </tr>
-   </table>
-
-  </td>
- </tr>
- <tr>
-  <td colspan=2>
-   <p class='seperator'>&nbsp;</p>
-  </td>
- </tr>
- <tr>
-  <td colspan='2'><h2>Rules</h2>
-
-   <table width='100%'>
-    <tr>
-     <td>
-      {$divRules}<br>
-{render acl=$saTrustedNetworksACL}
-      <input type='submit' name='AddRule' value='{t}Add{/t}'> 
-{/render}
-     </td>
-    </tr>
-   </table>
-
-  </td>
-</table>
-<input type='hidden' value='1' name='goSpamServer'>
-
-<p class='seperator'>&nbsp;</p>
-<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
-    <input type='submit' name='SaveService' value='{t}Save{/t}'>
-    &nbsp;
-    <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
-</div>
-
diff --git a/plugins/admin/systems/goSpamServerRule.tpl b/plugins/admin/systems/goSpamServerRule.tpl
deleted file mode 100644 (file)
index 6448ab5..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-<h2>Edit spam rule</h2>
-
-<table style='width:100%;'>
- <tr>
-  <td width='70'>
-   {t}Name{/t}
-  </td>
-  <td>
-   <input type='text' name='name' value='{$name}' >
-  </td>
- </tr>
- <tr>
-  <td colspan=2>
-   {t}Rule{/t}
-   <textarea name='rule' style='width:100%;'>{$rule}</textarea>
-  </td>
- </tr>
-</table>
-<p class='seperator'>&nbsp;</p>
-<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
-    <input type='submit' name='SaveRule' value='{t}Save{/t}'>
-    &nbsp;
-    <input type='submit' name='CancelRule' value='{t}Cancel{/t}'>
-</div>
-
diff --git a/plugins/admin/systems/goSyslogServer.tpl b/plugins/admin/systems/goSyslogServer.tpl
deleted file mode 100644 (file)
index a7ed661..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<h2>{t}Syslog Service{/t} {t}enabled{/t}</h2>
-
-<p class='seperator'>&nbsp;</p>
-<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
-    <input type='submit' name='SaveService' value='{t}Save{/t}'>
-    &nbsp;
-    <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
-</div>
-<input type="hidden" name="goCupsServerPosted" value="1">
diff --git a/plugins/admin/systems/goTerminalServer.tpl b/plugins/admin/systems/goTerminalServer.tpl
deleted file mode 100644 (file)
index 5fca209..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-<h2><img class="center" alt="" align="middle" src="images/rightarrow.png" /> {t}Terminal service{/t}</h2>
-<table summary="">
-    <tr>
-     <td colspan=2>
-{render acl=$goXdmcpIsEnabledACL}
-      <input type="checkbox" value="true" name="goXdmcpIsEnabled" id="Temporariid" {if $goXdmcpIsEnabled} checked {/if}>
-{/render}
-       {t}Temporary disable login{/t}
-     </td>
-    </tr>
-    <tr>
-     <td>{t}Font path{/t}</td>
-     <td> 
-{render acl=$goXdmcpIsEnabledACL}
-      <input type="text" value="{$goFontPath}" name="goFontPath" id="FontPathId">
-{/render}
-     </td>
-    </tr>
-   </table>
-
-<p class='seperator'>&nbsp;</p>
-<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
-    <input type='submit' name='SaveService' value='{t}Save{/t}'>
-    &nbsp;
-    <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
-</div>
-<input type="hidden" name="goTerminalServerPosted" value="1">
diff --git a/plugins/admin/systems/goVirusServer.tpl b/plugins/admin/systems/goVirusServer.tpl
deleted file mode 100644 (file)
index af14a2b..0000000
+++ /dev/null
@@ -1,172 +0,0 @@
-
-<table style='width:100%;'>
- <tr>
-  <td colspan=2>
-       <h2>{t}Generic virus filtering{/t}</h2>
-  </td>
- </tr>
- <tr>
-  <td style="vertical-align:top;">
-       <table>
-        <tr>
-         <td>
-               {t}Database user{/t}
-         </td>
-         <td>
-{render acl=$avUserACL}
-               <input type='text' name='avUser' value='{$avUser}' style='width:220px;'>
-{/render}
-         </td>
-        </tr>
-        <tr>
-         <td>
-               {t}Database mirror{/t}
-         </td>
-         <td>
-{render acl=$avDatabaseMirrorACL}
-               <input type='text' name='avDatabaseMirror' value='{$avDatabaseMirror}' style='width:220px;'>
-{/render}
-         </td>
-        </tr>
-        <tr>
-         <td>
-               {t}Http proxy URL{/t}
-         </td>
-         <td>
-{render acl=$avHttpProxyURLACL}
-               <input type='text' name='avHttpProxyURL' value='{$avHttpProxyURL}' style='width:220px;'>
-{/render}
-         </td>
-        </tr>
-        <tr>
-         <td>
-               {t}Maximum threads{/t}
-         </td>
-         <td>
-{render acl=$avMaxThreadsACL}
-               <select name="avMaxThreads" title='{t}Select number of maximal threads{/t}'>
-                {html_options options=$ThreadValues selected=$avMaxThreads}
-               </select>
-{/render}
-         </td>
-        </tr>
-       </table>
-  </td>
-  <td style='border-left:1px solid #A0A0A0;vertical-align:top;'>
-  
-       <table>
-        <tr>
-         <td>
-               {t}Max directory recursions{/t}
-         </td>
-         <td>
-{render acl=$avMaxDirectoryRecursionsACL}
-               <input type='text' name='avMaxDirectoryRecursions' value='{$avMaxDirectoryRecursions}' >
-{/render}
-         </td>
-        </tr>
-        <tr>
-         <td>
-               {t}Checks per day{/t}
-         </td>
-         <td>
-{render acl=$avChecksPerDayACL}
-               <input type='text' name='avChecksPerDay' value='{$avChecksPerDay}'> 
-{/render}
-         </td>
-        </tr>
-        <tr>
-         <td colspan=2>
-{render acl=$avFlagsDACL}
-               <input type='checkbox' name='avFlagsD' {$avFlagsDCHK} value='1'>
-{/render}
-               {t}Enable debugging{/t}
-         </td>
-        </tr>
-        <tr>
-         <td colspan=2>
-{render acl=$avFlagsSACL}
-               <input type='checkbox' name='avFlagsS' {$avFlagsSCHK} value='1'>
-{/render}
-               {t}Enable mail scanning{/t}
-         </td>
-        </tr>
-       </table>
-  </td>
- </tr>
- <tr>
-  <td colspan=2>
-   <p class='seperator'>&nbsp;</p>
-       <h2>{t}Archive scanning{/t}</h2> 
-  </td>
- </tr>
- <tr>
-  <td style='vertical-align:top;'>
-       <table>
-        <tr>
-         <td>
-{render acl=$avFlagsAACL}
-               <input type='checkbox' name='avFlagsA' {$avFlagsACHK} value='1'
-                       onClick=" changeState('avFlagsE') ; 
-                                 changeState('avArchiveMaxFileSize') ; 
-                                 changeState('avArchiveMaxRecursion') ; 
-                                 changeState('avArchiveMaxCompressionRatio') ; "
-               >
-{/render}
-               {t}Enable scanning of archives{/t}
-         </td>
-        </tr>
-        <tr>
-         <td>
-{render acl=$avFlagsEACL}
-               <input type='checkbox' name='avFlagsE' {$avFlagsECHK} {$avFlagsAState} value='1' id='avFlagsE'>
-{/render}
-               {t}Block encrypted archives{/t}
-         </td>
-        </tr>
-       </table>
-  
-  </td>
-  <td  style="vertical-align:top;width:50%;border-left:1px solid #A0A0A0;">
-       <table>
-        <tr>
-         <td>{t}Maximum file size{/t}
-         </td>
-         <td>
-{render acl=$avArchiveMaxFileSizeACL}
-          <input name='avArchiveMaxFileSize' id='avArchiveMaxFileSize' value='{$avArchiveMaxFileSize}'  {$avFlagsAState} >
-{/render}
-         </td>
-        </tr>
-        <tr>
-         <td>{t}Maximum recursion{/t}
-         </td>
-         <td>
-{render acl=$avArchiveMaxRecursionACL}
-          <input name='avArchiveMaxRecursion' id='avArchiveMaxRecursion' value='{$avArchiveMaxRecursion}'  {$avFlagsAState} >
-{/render}
-         </td>
-        </tr>
-        <tr>
-         <td>{t}Maximum compression ratio{/t}
-         </td>
-         <td>
-{render acl=$avArchiveMaxCompressionRatioACL}
-          <input name='avArchiveMaxCompressionRatio' id='avArchiveMaxCompressionRatio' value='{$avArchiveMaxCompressionRatio}' {$avFlagsAState}>
-{/render}
-         </td>
-        </tr>
-       </table>
-  
-  </td>
- </tr>
-</table>
-<input type='hidden' name='goVirusServer' value='1'>
-<p class='seperator'>&nbsp;</p>
-<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
-    <input type='submit' name='SaveService' value='{t}Save{/t}'>
-    &nbsp;
-    <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
-</div>
-
diff --git a/plugins/admin/systems/gosaLogServer.tpl b/plugins/admin/systems/gosaLogServer.tpl
deleted file mode 100644 (file)
index 7dd032a..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-<h2><img class="center" alt="" align="middle" src="images/rightarrow.png" /> {t}GOsa logging database{/t}</h2>
-<table summary="">
-    <tr>
-     <td>{t}Database user{/t}{$must}</td>
-     <td>
-{render acl=$goLogDBUserACL}
-       <input name="goLogDBUser" id="goLogDBUser" size=30 maxlength=60 value="{$goLogDBUser}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td>{t}Password{/t}{$must}</td>
-     <td>
-{render acl=$goLogDBPasswordACL}
-       <input type="password" name="goLogDBPassword" id="goLogDBPassword" size=30 maxlength=60 value="{$goLogDBPassword}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td>{t}Database{/t}{$must}</td>
-     <td>
-{render acl=$goLogDBACL}
-       <input name="goLogDB" id="goLogDB" size=30 maxlength=60 value="{$goLogDB}">
-{/render}
-     </td>
-    </tr>
-   </table>
-
-<p class='seperator'>&nbsp;</p>
-<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
-    <input type='submit' name='SaveService' value='{t}Save{/t}'>
-    &nbsp;
-    <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
-</div>
-<input type="hidden" name="gosaLogServerPosted" value="1">
diff --git a/plugins/admin/systems/ppd/class_printerPPDDialog.inc b/plugins/admin/systems/ppd/class_printerPPDDialog.inc
new file mode 100644 (file)
index 0000000..a93e91b
--- /dev/null
@@ -0,0 +1,546 @@
+<?php
+
+class printerPPDDialog 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("cn");
+  var $objectclasses        = array("whatever");
+
+  /* PPD Handling */
+  var $selectedPPD          = false;        // e.g. /vendor/device.ppd 
+  var $ppdManager           = false;        // new ppdManager;
+  var $ppdConfig            = false;        // $this->ppdManager->loadProperties($this->selectedPPD['link']);
+  var $ppdList              = array();      // Contains all Printer models
+  var $ppdListHeader        = array();      // Contains all printer vendors
+
+  /* Paths */
+  var $pathToPPD            = "";           // Base path, defined in gosa.conf e.g. "/var/spool/ppd/"
+  var $pathToModified       = "modified/";  // used to store the modified ppds  
+      
+  /* Object Info */
+  var $cn                   = "" ;          // Used to tag the ppds modified by the printer object, 
+
+  /* If there is already a ppd file for the same type of printer, 
+   *  remember the path to ppd file and display a dialog which allows 
+   *  to overwrite the current ppd file. 
+   */
+  var $add_ppd_later            = "";
+  var $add_later_msg_dialog     = NULL;
+
+  function printerPPDDialog (&$config, $dn= NULL, $ppdfile=NULL )
+  {
+    plugin::plugin ($config, $dn);
+    $this->depselect = $this->config->current['BASE'];
+
+    /* Get PPD path and remove double //, and add trailing /  */
+    if(isset($_SESSION['config']->data['MAIN']['PPD_PATH'])){
+      $this->pathToPPD = $_SESSION['config']->data['MAIN']['PPD_PATH'];
+      $this->pathToPPD= preg_replace("/\/\//", "/", $this->pathToPPD);
+      if(!preg_match("/\/$/",$this->pathToPPD)){
+        $this->pathToPPD = $this->pathToPPD."/";
+      }
+    }else{
+      $this->pathToPPD = "";
+    }
+
+    /* It seams that we have an existing PPD path, so go on */
+    if(!((!is_dir($this->pathToPPD))||(empty($this->pathToPPD)))){ 
+
+      /* Load all available PPD files and sort them into an array */
+      $this->ppdManager= new ppdManager($this->pathToPPD);
+      $this->getPrinterReload ();
+
+      /* The user has already a valid PPD assigned
+       * Get some informations about this PPD
+       * and set it as selected. 
+       * The ppdpath ['link'] should be relative from .../ppd/modified/ 
+       *     e.g. "/Compaq/Compaq-J1200.ppd" */
+      if(($ppdfile!== NULL)&&(strlen($ppdfile)>0)){
+        $ppdfile = preg_replace("#".$this->pathToModified."#","",$ppdfile);
+        if(!file_exists($this->pathToPPD.$this->pathToModified.$ppdfile)){
+          print_red(sprintf(_("Can't open '%s', ppd settings resetted."),$ppdfile));
+        }else{
+          $res  = $this->ppdManager->loadDescription($this->pathToPPD.$this->pathToModified.$ppdfile);
+          if($res){
+            $tmp = split("\n",$res);
+            $tmp3 = array(); 
+            $tmp3['name']   = trim(preg_replace("/^\-/","",trim($tmp[1])));
+            $tmp3['link']   = $ppdfile;
+            $tmp3['ppd']    = $res;
+          }    
+          $this->selectedPPD = $tmp3;
+        }
+      }
+    }
+  }
+
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* Fill templating stuff */
+    $display= "";
+    $smarty= get_smarty();
+    $smarty->assign("ppdString", _("Can't get ppd informations."));
+    $smarty->assign("showOptions", "");
+
+    /* Check these paths */
+    $paths = array($this->pathToPPD, $this->pathToPPD.$this->pathToModified);
+
+    /* If one of our required paths is not available, stop here and display some info */
+    foreach($paths as $path){
+    
+      /* Check if path is write/readable*/
+      $is_r = @is_readable($path);  
+      if(((!is_dir($path))||(empty($path)) || (!$is_r)) && (!@mkdir($path))){
+        print_red(sprintf(_("The specified path '%s' which results from PPD_PATH in your gosa.conf is invalid, can't read/write any ppd informations."),$path));
+        /* Print out template */
+        $display.= $smarty->fetch(get_template_path('printerPPDDialog.tpl', TRUE,dirname(__FILE__)));
+        return($display);
+      }
+    }
+
+    // PPD selection / upload / dialog handling 
+
+    /* Is there a new PPD file uploaded ? */
+    if((isset($_FILES['NewPPDFile']))&&(isset($_POST['SubmitNewPPDFile']))){
+      $file = ($_FILES['NewPPDFile']);
+      if($file['size'] != 0 ){
+        if($name = $this->AddPPD($file['tmp_name'])){
+          $this->SelectPPD($name); 
+        }
+      }else{
+        print_red(_("Please specify a valid ppd file."));
+      }
+    }
+
+    /* Overwrite existing PPD file and select it as currently used for this object */
+    if(is_object($this->add_later_msg_dialog) && ($this->add_later_msg_dialog->is_confirmed()) && $this->add_ppd_later != ""){
+      if($name = $this->AddPPD($this->add_ppd_later,TRUE)){
+        $this->SelectPPD($name);
+      }
+      $this->add_ppd_later = "";
+      $this->add_later_msg_dialog = NULL;
+    } 
+
+    /* Open a dialog that allow us to select different PPDs */
+    if(isset($_POST['SelectPPD'])){
+      $this->dialog= new printerPPDSelectionDialog($this->config,$this->dn,$this->ppdList,$this->ppdListHeader,$this->selectedPPD);
+    }
+
+    /* The selection dialog fpr PPDs is canceled */
+    if(isset($_POST['ClosePPDSelection'])){
+      unset($this->dialog);
+      $this->dialog=FALSE;
+    }
+
+    /* Div Selection */ 
+    if((isset($_GET['act']))&&($_GET['act']=="use")){
+      $this->SelectPPD(base64_decode($_GET['id']));
+      unset($this->dialog);
+      $this->dialog=FALSE;
+
+    }
+
+    /* if a dialog is open, print the dialog instead of this class */
+    if(is_object($this->dialog)){
+      $display = $this->dialog->execute();
+      return($display);
+    }
+
+    // ENDE  PPD selection / upload / dialog handling 
+
+    /* Give smarty the information it needs */
+    $smarty->assign("ppdString" ,$this->getPPDInformation());
+    $tmp= $this->generateProperties();
+    if ($tmp == ""){
+      $smarty->assign("showOptions", 0);
+    } else {
+      $smarty->assign("showOptions", 1);
+      $smarty->assign("properties",$this->generateProperties());
+    }
+
+    /* Print out template */
+    $display.= $smarty->fetch(get_template_path('printerPPDDialog.tpl', TRUE,dirname(__FILE__)));
+    return($display);
+  }
+
+
+  /* Select PPD */
+  function SelectPPD($name)
+  {
+    /* Replace base path we don't need it here 
+       The path we need looks like this : "/Vendor/ModellName.ppd"; 
+       thats all */
+    $name = preg_replace("#".$this->pathToPPD."#","",$name);
+
+    /* Intialise some base vars */
+    $AbsoluteSourceName       = $this->pathToPPD.$name;   
+    $AbsoluteDestinationPath  = $this->pathToPPD.$this->pathToModified;
+    $Vendor                   = ""; // Vendor 
+    $Name                     = ""; // Name 
+    $Modell                   = ""; // Modell
+    $PrinterName              = ""; // The new name of the printer 
+    $PPDName                  = "";
+    /* Force reload of config dialog */ 
+    $this->ppdConfig            = false;
+    $this->selectedPPD['link']  = false;
+
+    /* Get PPD informations and set vendor / modell / name */ 
+    if((!file_exists($AbsoluteSourceName)) || (!is_readable($AbsoluteSourceName))){
+      print_red(sprintf(_("Can't select PPD file '%s', the file is not readable"),$AbsoluteSourceName));   
+      return;
+    }
+    $res  = $this->ppdManager->loadDescription($AbsoluteSourceName);
+    if($res){
+      $tmp = split("\n",$res);
+      $Name   = trim(preg_replace("/^\-/","",trim($tmp[1])));
+      $Vendor = trim($tmp[0]);
+      $Model  = trim(preg_replace("/".$Vendor."/","",$Name));
+    }    
+
+    $PrinterName  = $this->cn."-".preg_replace("/[^a-z0-9-_\.]/i","_",$Name);
+    $PPDName      = $Vendor."/".$PrinterName.".ppd";
+    
+    /* Create the vendors path, if it doesn't exists already */
+    if(!is_dir($AbsoluteDestinationPath.$Vendor)){
+      if(!(@mkdir($AbsoluteDestinationPath.$Vendor))){
+        print_red(sprintf(_("Can't create folder '%s' for the uploaded ppd file."),$AbsoluteDestinationPath.$Vendor));
+        return(false);
+      }
+    }
+
+    /* Create destination file handle */
+    $fp = @fopen($AbsoluteDestinationPath.$PPDName,"w+");
+    if(!$fp){
+      print_red(sprintf(_("Can't create file '%s' to store modifed ppd informations."),$AbsoluteDestinationPath.$PPDName));
+      return(false);
+    }
+
+    $str = file_get_contents($AbsoluteSourceName);
+    fputs($fp,$str);
+    @fclose($fp);
+
+    //$this->ppdManager->updateAttribute($filename,"NO_SECTION","ModelName",$printerName);
+
+    $tmp3['link']   =$PPDName;
+    $this->selectedPPD = $tmp3;
+    $this->getPrinterReload(); 
+    return($PPDName);
+  }
+
+
+  /* This function adds a new ppd file to the list of available ppds. 
+     All required paths and files will be created 
+      $_PathOnHdd e.g. = /tmp/PHP_tmpfile213452 */
+  function AddPPD($_PathOnHdd,$overwrite = FALSE)
+  {
+    /* Check if file exists && is readable */
+    if((!is_file($_PathOnHdd)) || (!is_readable($_PathOnHdd))){
+      print_red(sprintf(_("Can't add new ppd file, the source file '%s' is not accessible."),$_PathOnHdd));
+      return(false);
+    }
+    
+    /* Reload list to detect changes e.g. a file has been deleted */
+    $this->getPrinterReload();
+
+    /* Get Description from ppd, & parse out some informations */   
+    $res  = @$this->ppdManager->loadDescription($_PathOnHdd);
+    if($res){
+      $tmp = split("\n",$res);
+      $name   = trim(preg_replace("/^\-/","",trim($tmp[1])));
+      $vendor = trim($tmp[0]);
+      $model  = trim(preg_replace("/".$vendor."/","",$name));
+    }    
+
+    /* Check if parse was successfull */
+    if(empty($name) || empty($vendor)){
+      print_red(sprintf(_("The given ppd file '%s' seams to be invalid, can't get any model or vendor informations."),$_PathOnHdd));
+      return(false);
+    }
+
+    /* Prepare list of ppds */
+    if(!isset($this->ppdList[$vendor])){
+      $this->ppdList[$vendor] = array();
+    }
+
+    /* Create ppd file and fill in the source contents */
+    $ppdname      = $vendor."/".$name.".ppd";
+    $filename     = $this->pathToPPD.preg_replace("/[^a-z0-9-_\.\/]/i","_",$ppdname);
+    $filename     = $this->pathToPPD.$ppdname;
+    $contents     = file_get_contents($_PathOnHdd);
+
+
+    /* Check if this ppd already exists */
+    $found = false;
+    foreach($this->ppdList[$vendor] as $key => $val){
+      if(preg_match("/".$model.".*/i",$key)){
+        $found = true;
+        if(!$overwrite){
+          if(!copy($_PathOnHdd,$_PathOnHdd."_back")){
+            print_red(sprintf(_("Can't add new ppd file, the source file '%s' is not accessible."),$_PathOnHdd));         
+          }else{
+            $this->add_ppd_later = $_PathOnHdd."_back";
+            $this->add_later_msg_dialog = new msg_dialog(_("Overwrite existing PPD"),
+                _("There is already a ppd file for this kind of printer. Do you want to overwrite it?"),CONFIRM_DIALOG);
+          }
+          return;
+        }
+      }
+    }
+
+    /* Create the vendors path, if it doesn't exists already */
+    if(!is_dir($this->pathToPPD.$vendor)){
+      if(!(@mkdir($this->pathToPPD.$vendor))){
+        print_red(sprintf(_("Can't create folder '%s' for the uploaded ppd file."),$this->pathToPPD.$vendor));
+        return(false);
+      }
+    }
+  
+    /* Open file handle */
+    $fp           = fopen($filename,"w+");
+
+    /* Check file handle & contents */
+    if(!$fp){
+      print_red(sprintf(_("Can't save file '%s'."),$filename));
+      return;
+    }
+    if(empty($contents)){
+      print_red(_("Uploaded ppd file is empty, can't create new ppd file."));
+      return;
+    }
+    
+    /* Fille file with data */
+    fputs($fp,$contents);
+    @fclose($fp);
+
+    /* Our job is done here */
+    return($ppdname);
+  }
+
+
+  /* This function reloads the list of available printers/vendors 
+     $this->ppdListHeader 
+     Compaq        => 1
+     $this->ppdList
+     Compaq => Compaq IJ1200 => name => Compaq IJ1200 
+     link => /var/spool/ppd/Compaq/Compaq-J1200.ppd
+     ppd  => Compaq - Co    
+   */
+  function getPrinterReload()
+  {
+    if(is_readable($this->pathToPPD)){
+      $tmp = @$this->ppdManager->getPrinterList(true);
+
+      $this->ppdListHeader = $this->ppdList = array();
+
+      /* Sort all available files, and create header (Vendor index) */
+      foreach($tmp as $file=>$ppd){
+
+        if(preg_match("#".$this->pathToModified."#",$file)) continue;
+
+        $tmp2 = split("\n",$ppd);
+        if(!isset($this->ppdListHeader[$tmp2[0]])){
+          $this->ppdListHeader[$tmp2[0]]=0;
+        }
+        $tmp3['name']   =preg_replace("/^ -/","",$tmp2[1]." - ".$tmp2[2]);
+        $tmp3['link']   =$file;
+        $tmp3['ppd']    =$ppd;
+        $this->ppdListHeader[$tmp2[0]]++;
+        $this->ppdList[$tmp2[0]][preg_replace("/^ -/","",$tmp2[1]." - ".$tmp2[2])]=$tmp3;
+      }
+    }
+  }
+
+
+  /* Save all options posted from ppd dialog */
+  function save_object()
+  {
+    if(!((isset($_POST['PPDDisSubmitted'])) && (is_array($this->ppdConfig)))){
+      return;
+    }
+
+    foreach($this->ppdConfig as $cat => $obj){
+      foreach($obj as $attr => $attributes){
+        if(isset($_POST[base64_encode($attributes['_name'])])){
+          $this->ppdConfig[$cat][$attr]['_default'] = $_POST[base64_encode($attributes['_name'])];
+        }
+      }
+    }
+  }
+
+
+  /* Save modified ppd */
+  function save_ppd()
+  {
+    if($this->ppdManager){
+      $this->ppdManager->saveProperties($this->pathToPPD.$this->pathToModified.$this->selectedPPD['link'],$this->ppdConfig);
+    }
+  }
+
+
+  /* Return selected ppd path, if none is selected then false */
+  function save()
+  {
+    /* return the selected PPD, and in future the selected options too */
+    return($this->pathToModified.$this->selectedPPD['link']);
+  }
+
+
+  /* Get Information for a single PPD entry 
+   * This will be shown on top of template
+   */
+  function getPPDInformation()
+  {
+    $str = "none";
+    if(!empty($this->selectedPPD)){
+      $str = $this->ppdManager->loadDescription($this->pathToPPD.$this->pathToModified.$this->selectedPPD['link']);
+    }
+    return($str) ; 
+  }
+
+
+  /* Display all options from the selected ppd file */
+  function generateProperties()
+  { 
+    /* Set Headline */
+    $str = "";
+    $feed= "";
+
+    $s_ppd = $this->pathToPPD.$this->pathToModified.$this->selectedPPD['link'];
+
+    /* If ppd exists and is readable */
+    if((!empty($this->selectedPPD['link']))&&(file_exists($s_ppd))){
+
+      /* If there is no initial Configuration, load it */
+      if($this->ppdConfig == false){
+        $this->ppdConfig = $this->ppdManager->loadProperties($s_ppd);
+      }
+
+      /* Create a table */
+      $str .= "<div style='padding-left:30px;'><table summary=''>";
+
+      /* Input all data to the table */
+      foreach($this->ppdConfig as $cat => $obj){
+
+        /* Add new category */
+        $str .= "<tr><td colspan='2'>$feed";
+        if ($feed == ""){
+          $feed= "<br>";
+        }
+        $str .= "<b>"._("Section")." '".$cat."'&nbsp;</b><br>";
+        $str .= "</td></tr>";       
+
+        /* Add attributes of the current category */
+        foreach($obj as $attr => $settings){
+
+          /* Skip all entries beginning with _ */
+          if($attr[0] == "_") continue;  
+
+          /* Prepare data */
+          $values   = array();
+          $name     = $settings['_name'];
+
+          if (!isset($settings['_default'])){
+            $default  = "";
+          } else {
+            $default  = $settings['_default'];
+          }
+
+          $type     = $settings['_type'];
+
+          /* Add name to table */ 
+          $str .= "<tr><td style='padding-left:40px;'>\n";
+          $str .= $name."<br>\n";
+          $str .= "</td><td>\n";
+
+          /* Get all values */ 
+          foreach( $settings as $vname => $value){
+            if($vname[0] != "_"){
+              $values[$vname]= $value;
+            }
+          }
+
+          /* preparing Html output
+           * Supported types are PickOne/Boolean
+           */
+
+          /* If type is PickOne, create a select box */
+          if(($type == "PickOne")||(($type=="Boolean")&&(count($values)>1))){
+
+            $str  .=  "<select name='".base64_encode($name)."'>\n";
+            foreach($values as $optionKey => $value){
+              $selected = "";
+              if($optionKey == $default){
+                $selected = " selected ";
+              }
+              $str  .=  "<option value='".$optionKey."' ".$selected.">".$value."</option>\n";
+            }
+            $str  .=  "</select>\n";
+
+          }elseif($type == "Boolean"){
+
+            /* If type is Boolean & no values are given */
+            $str  .=  "<select name='".base64_encode($name)."'>\n";
+            if($default == "False"){
+              $str  .=    "<option value='True' >"._("True")."</option>\n";
+              $str  .=    "<option value='False' selected>"._("False")."</option>\n";
+            }else{
+              $str  .=    "<option value='True' selected>"._("True")."</option>\n";
+              $str  .=    "<option value='False' >"._("False")."</option>\n";
+            }          
+            $str  .=  "</select>\n";
+
+          }else{
+            print_red(sprintf(_("Unsupported ppd type '%s' used for '%s' "),$type,$name));
+          }
+          $str .= "</td></tr>\n";
+        }
+      }
+      $str .= "</table></div>\n";
+    }
+    return($str);
+  }
+
+  function removeModifiedPPD()
+  {
+    $path = $this->pathToPPD.$this->pathToModified.$this->selectedPPD['link'];
+
+    if(file_exists($path)){
+      if(is_writeable($path)){
+        if(!@unlink($path)){
+          print_red(sprintf(_("Removing old ppd file '%s' failed."),$path));
+        }
+      }else{
+        print_red(sprintf(_("Removing old ppd file '%s' failed. File is not accessible."),$path));
+      }
+    }else{
+      print_red(sprintf(_("Removing old ppd file '%s' failed. File does not exists or is not accessible."),$path));
+    }
+  }
+
+  function update_ppd_url()
+  {
+    $this->SelectPPD("modified/".$this->selectedPPD['link']);
+  }
+  
+  function check()
+  {  
+    $message = plugin::check();
+    if(empty($this->selectedPPD['link'])){
+      $message[] = _("Please select a valid ppd file or use 'Cancel' to go back to printer configuration.");
+    }
+    return($message); 
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/ppd/class_printerPPDSelectionDialog.inc b/plugins/admin/systems/ppd/class_printerPPDSelectionDialog.inc
new file mode 100644 (file)
index 0000000..d4f5d16
--- /dev/null
@@ -0,0 +1,197 @@
+<?php
+
+class printerPPDSelectionDialog 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       = FALSE;
+  var $attributes           = array();
+  var $objectclasses        = array("whatever");
+
+  var $list                 =array();
+  var $header               =array();
+  var $current_del_id       = "";
+  var $Vendor               = "";
+
+  function printerPPDSelectionDialog (&$config, $dn= NULL,$list=false,$headers=false,$ppd=false)
+  {
+    plugin::plugin ($config, $dn);
+    $this->list       = $list;
+    $this->header     = $headers;
+    $this->depselect  = $this->config->current['BASE'];
+    
+    if(!isset($_SESSION['printerPPDSelectionDialog'])){
+      $_SESSION['printerPPDSelectionDialog']['regex'] = "*";
+    }  
+
+    /* Order the manufacturers index */
+    ksort($this->header);
+  }
+
+  function execute()
+  {
+       /* Call parent execute */
+       plugin::execute();
+
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+    $display= "";
+    $s_action = "none";
+  
+    $regex = $_SESSION['printerPPDSelectionDialog']['regex'];
+
+    if(isset($_GET['search'])){
+      $regex = $_GET['search']."*";
+    }
+  
+    if(isset($_POST['regex'])){
+      $regex= $_POST['regex'];
+    }
+    
+    $regex = str_replace("**","*",$regex);
+    $_SESSION['printerPPDSelectionDialog']['regex'] = $regex;
+
+    /* Delete requested, check if everything is ok and display confirmation dialog */
+    if(isset($_GET['act']) && $_GET['act'] == "del"){
+
+      /* Get id and check if id is valid */
+      $id_to_del = base64_decode($_GET['id']);
+      $found = "";
+      foreach($this->list[$this->Vendor] as $key => $data){
+        if($data['link'] == $id_to_del){
+          $found = $key;
+          break;
+        }
+      }
+      if(!empty($found)){
+        $this->current_del_id = $id_to_del;
+
+        $smarty->assign("warning", sprintf(_("You're about to delete the ppd file '%s' at '%s'."), $found,$id_to_del));
+        return($smarty->fetch(get_template_path('remove_ppd.tpl', TRUE)));
+
+      }else{
+        print_red(sprintf(_("Could not found specified ppd file '%s'."),$id_to_del));
+      }
+    }
+
+    /* Deletion confirmed */
+    if(isset($_POST['delete_ppd_confirm']) && !empty($this->current_del_id)){
+
+      /* check if file is removeable */
+      if(is_writeable($this->current_del_id)){
+        $is_ok = @unlink($this->current_del_id);
+
+        /* Update ppd list */
+        if($is_ok){
+          foreach($this->list as $vendor => $ppds){
+            foreach($ppds as $ppd => $data){
+              if($data['link'] == $this->current_del_id){
+                unset($this->list[$vendor][$ppd]);
+              }
+            }
+          }
+        }
+      }else{
+        $is_ok = false;
+      }
+
+      if(!$is_ok){
+        print_red(_("Something went wrong while trying to remove the ppd file from server, possibly we have no write access."));
+      }
+    }
+
+
+    /** Added **/
+    $list = array();
+    foreach($this->list as $cat => $ppds){
+      foreach($ppds as $ppd){
+        if(preg_match("/^".str_replace("*",".*",$regex)."/i",$ppd['ppd'])){
+          if(is_readable($ppd['link'])){
+            $list[$ppd['link']] = $ppd;
+          }
+        }
+      }
+    }
+    if((isset($_GET['act']))&&($_GET['act']=="open"))  {
+      
+      if((!empty($_GET['id'])) && (!isset( $this->header[base64_decode($_GET['id'])]))){
+        print_red(sprintf(_("Selected vendor '%s' does not exists in our list of ppds."),base64_decode($_GET['id'])));      
+        $this->Vendor = ""; 
+      }else{
+        $this->Vendor = base64_decode($_GET['id']);
+      }
+    }
+
+    $div = new divSelectBox("printerPPDSelectionDialog");
+    $div ->SetHeight(450);
+    $div ->SetSummary(_("Printer ppd selection."));
+    
+    $linkopen = "<a href='?plug=".$_GET['plug']."&amp;act=open&amp;id=%s'>
+                  <img src='images/folder.png' class='center' border=0>&nbsp;%s
+                 </a>";
+    $uselink  = "<a href='?plug=".$_GET['plug']."&amp;act=use&amp;id=%s'>%s</a>";
+    $dellink  = "<a href='?plug=".$_GET['plug']."&amp;act=del&amp;id=%s'>
+                  <img src='images/edittrash.png' alt='"._("delete")."' border=0>
+                 </a>"; 
+
+    if(empty($this->Vendor)){
+      foreach($this-> header as $key => $entry){
+        $div ->AddEntry (array(
+              array("string"=>sprintf($linkopen,base64_encode($key),$key),"attach"=>"style='border-right:0px;'")
+              ));
+      }
+    }else{
+      $div ->AddEntry (array(
+            array("string"=>sprintf($linkopen,"",".. ["._("back")."]"),"attach"=>"style='border-right:0px;'")
+            ));
+      foreach($list as $key => $ppd){
+        if(preg_match("/^".$this->Vendor."/",$ppd['ppd'])){
+
+          if(is_writeable($ppd['link'])){
+            $del_str = sprintf($dellink,base64_encode($key));
+          }else{
+            $del_str = "";
+          }
+
+          $div ->AddEntry (array(
+                                  array("string"=>sprintf($uselink,base64_encode($key),$ppd['ppd'])),
+                                  array("string"=>$del_str,"attach"=>"style='border-right:0px;'")
+
+                ));
+        }
+      }
+    }
+
+    $smarty->assign("List",         $div -> DrawList());
+    $smarty->assign("search_image", get_template_path('images/search.png'));
+    $smarty->assign("launchimage",  get_template_path('images/small_filter.png'));
+    $smarty->assign("tree_image",   get_template_path('images/tree.png'));
+    $smarty->assign("alphabet",     generate_alphabet());
+    $smarty->assign("apply",        apply_filter());
+    $smarty->assign("regex",        $regex);
+  
+    $display.= $smarty->fetch(get_template_path('printerPPDSelectionDialog.tpl', TRUE,dirname(__FILE__)));
+    return($display);
+  }
+
+  function save_object()
+  {
+  } 
+
+  function check(){
+  }
+
+  /* Save to LDAP */
+  function save()
+  {
+    return $this->selectedPPD;
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/ppd/printerPPDDialog.tpl b/plugins/admin/systems/ppd/printerPPDDialog.tpl
new file mode 100644 (file)
index 0000000..761d005
--- /dev/null
@@ -0,0 +1,24 @@
+<h2><img alt="P" class="center" src="images/select_printer.png" align="middle">&nbsp;{t}Printer driver{/t}</h2>
+<table summary="" width="100%">
+       <tr>
+               <td width="50%" style="vertical-align:top">
+                       {t}Model{/t}: <i>{$ppdString}</i>&nbsp;
+                       <input type="submit" name="SelectPPD" value="{t}Select{/t}">
+               </td>
+               <td style="border-left: 1px solid rgb(160, 160, 160);padding-left:10px;">
+                       {t}New driver{/t}&nbsp;
+                       <input type="file" value="" name="NewPPDFile">
+                       <input type="submit" name="SubmitNewPPDFile" value="{t}Upload{/t}">
+               </td>
+       </tr>
+</table>
+{if $showOptions eq 1}
+<p class="seperator">&nbsp;</p>
+<h2><img alt="L" class="center" src="images/lamp.png" align="middle">&nbsp;{t}Options{/t}</h2>
+{$properties}
+{/if}
+<p class="plugbottom">
+       <input type="hidden" name="PPDDisSubmitted" value="1">
+       <input type="submit" name="SavePPD" value="{t}Apply{/t}">
+       <input type="submit" name="ClosePPD" value="{t}Cancel{/t}">
+</p>
diff --git a/plugins/admin/systems/ppd/printerPPDSelectionDialog.tpl b/plugins/admin/systems/ppd/printerPPDSelectionDialog.tpl
new file mode 100644 (file)
index 0000000..b6cad00
--- /dev/null
@@ -0,0 +1,48 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
+       <tr>
+               <td style="vertical-align:top;width=50%;width:600px">
+                       <div class="contentboxh" style="height:20px;">
+                               <p class="contentboxh" style="font-size:12px">
+                                       <b>{t}Select objects to add{/t}</b>
+                               </p>
+                       </div>
+                       <div class="contentboxb">
+          {$List}
+                                       <input type=hidden name="edit_helper">
+                       </div>
+               </td>
+               <td style="vertical-align:top;">
+                       <div class="contentboxh" style="height:20px;">
+                               <p class="contentboxh" style="font-size:12px">
+          <img src="{$launchimage}" align="right" alt="[F]">
+          <b>{t}Filters{/t}</b>
+        </p>
+      </div>
+      <div class="contentboxb">
+        <table summary="" style="width:100%;border-top:1px solid #B0B0B0; background-color:#F8F8F8">
+          {$alphabet}
+        </table>
+        <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+          <tr>
+            <td style="width:18px">
+              <img alt="" src="{$search_image}" align=middle title="{t}Display objects matching{/t}">
+            </td>
+            <td>
+              <input type='text' style="width:99%" name='regex' maxlength='20' value='{$regex}' 
+                title='{t}Regular expression for matching object names{/t}' onChange="mainform.submit();">
+            </td>
+          </tr>
+        </table>
+              {$apply}
+
+      </div>
+    </td>
+  </tr>
+</table>
+
+<p class="plugbottom">
+<input type="submit" name="ClosePPDSelection" value="{t}Close{/t}">
+</p>
+<!--
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+-->
diff --git a/plugins/admin/systems/ppd/remove_ppd.tpl b/plugins/admin/systems/ppd/remove_ppd.tpl
new file mode 100644 (file)
index 0000000..6d28ba9
--- /dev/null
@@ -0,0 +1,15 @@
+<div style="font-size:18px;">
+<img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
+</div>
+<p>
+ {$warning}
+</p>
+
+<p>
+ {t}The ppd file will be removed from the server and can not be restored.{/t}
+</p>
+<p class="plugbottom">
+  <input type=submit name="delete_ppd_confirm" value="{t}Delete{/t}">
+  &nbsp;
+  <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
+</p>
diff --git a/plugins/admin/systems/printerPPDDialog.tpl b/plugins/admin/systems/printerPPDDialog.tpl
deleted file mode 100644 (file)
index 761d005..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-<h2><img alt="P" class="center" src="images/select_printer.png" align="middle">&nbsp;{t}Printer driver{/t}</h2>
-<table summary="" width="100%">
-       <tr>
-               <td width="50%" style="vertical-align:top">
-                       {t}Model{/t}: <i>{$ppdString}</i>&nbsp;
-                       <input type="submit" name="SelectPPD" value="{t}Select{/t}">
-               </td>
-               <td style="border-left: 1px solid rgb(160, 160, 160);padding-left:10px;">
-                       {t}New driver{/t}&nbsp;
-                       <input type="file" value="" name="NewPPDFile">
-                       <input type="submit" name="SubmitNewPPDFile" value="{t}Upload{/t}">
-               </td>
-       </tr>
-</table>
-{if $showOptions eq 1}
-<p class="seperator">&nbsp;</p>
-<h2><img alt="L" class="center" src="images/lamp.png" align="middle">&nbsp;{t}Options{/t}</h2>
-{$properties}
-{/if}
-<p class="plugbottom">
-       <input type="hidden" name="PPDDisSubmitted" value="1">
-       <input type="submit" name="SavePPD" value="{t}Apply{/t}">
-       <input type="submit" name="ClosePPD" value="{t}Cancel{/t}">
-</p>
diff --git a/plugins/admin/systems/printerPPDSelectionDialog.tpl b/plugins/admin/systems/printerPPDSelectionDialog.tpl
deleted file mode 100644 (file)
index b6cad00..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
-       <tr>
-               <td style="vertical-align:top;width=50%;width:600px">
-                       <div class="contentboxh" style="height:20px;">
-                               <p class="contentboxh" style="font-size:12px">
-                                       <b>{t}Select objects to add{/t}</b>
-                               </p>
-                       </div>
-                       <div class="contentboxb">
-          {$List}
-                                       <input type=hidden name="edit_helper">
-                       </div>
-               </td>
-               <td style="vertical-align:top;">
-                       <div class="contentboxh" style="height:20px;">
-                               <p class="contentboxh" style="font-size:12px">
-          <img src="{$launchimage}" align="right" alt="[F]">
-          <b>{t}Filters{/t}</b>
-        </p>
-      </div>
-      <div class="contentboxb">
-        <table summary="" style="width:100%;border-top:1px solid #B0B0B0; background-color:#F8F8F8">
-          {$alphabet}
-        </table>
-        <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-          <tr>
-            <td style="width:18px">
-              <img alt="" src="{$search_image}" align=middle title="{t}Display objects matching{/t}">
-            </td>
-            <td>
-              <input type='text' style="width:99%" name='regex' maxlength='20' value='{$regex}' 
-                title='{t}Regular expression for matching object names{/t}' onChange="mainform.submit();">
-            </td>
-          </tr>
-        </table>
-              {$apply}
-
-      </div>
-    </td>
-  </tr>
-</table>
-
-<p class="plugbottom">
-<input type="submit" name="ClosePPDSelection" value="{t}Close{/t}">
-</p>
-<!--
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
--->
diff --git a/plugins/admin/systems/remove_dhcp.tpl b/plugins/admin/systems/remove_dhcp.tpl
deleted file mode 100644 (file)
index 39fb19b..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-<div style="font-size:18px;">
-<img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
-</div>
-<p>
- {$warning}
- {t}This includes 'all' DHCP subsections that are located within this section. Please double check if your really want to do this since there is no way for GOsa to get your data back.{/t}
-</p>
-
-<p>
- {t}Best thing to do before performing this action would be to save the current contents of your LDAP tree in a file. So - if you've done so - press 'Delete' to continue or 'Cancel' to abort.{/t}
-</p>
-
-<p class="plugbottom">
-  <input type=submit name="delete_dhcp_confirm" value="{t}Delete{/t}">
-  &nbsp;
-  <input type=submit name="cancel_section" value="{t}Cancel{/t}">
-</p>
diff --git a/plugins/admin/systems/remove_glpi.tpl b/plugins/admin/systems/remove_glpi.tpl
deleted file mode 100644 (file)
index 4106caf..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-<div style="font-size:18px;">
-<img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
-</div>
-<p>
- {$warning}
- {t}Please double check if your really want to do this since there is no way for GOsa to get your data back.{/t}
-</p>
-
-<p>
- {t}Best thing to do before performing this action would be to save the current contents of your MySql database in a file. So - if you've done so - press 'Delete' to continue or 'Cancel' to abort.{/t}
-</p>
-
-<p class="plugbottom">
-  <input type=submit name="delete_glpi_confirm" value="{t}Delete{/t}">
-  &nbsp;
-  <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
-</p>
diff --git a/plugins/admin/systems/remove_ppd.tpl b/plugins/admin/systems/remove_ppd.tpl
deleted file mode 100644 (file)
index 6d28ba9..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-<div style="font-size:18px;">
-<img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
-</div>
-<p>
- {$warning}
-</p>
-
-<p>
- {t}The ppd file will be removed from the server and can not be restored.{/t}
-</p>
-<p class="plugbottom">
-  <input type=submit name="delete_ppd_confirm" value="{t}Delete{/t}">
-  &nbsp;
-  <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
-</p>
diff --git a/plugins/admin/systems/servDNSeditZoneEntries.tpl b/plugins/admin/systems/servDNSeditZoneEntries.tpl
deleted file mode 100644 (file)
index 9c0428c..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-<h2>{t}This dialog allows you to configure all components of this DNS zone on a single list.{/t}</h2>
-<p class="seperator">&nbsp;</p>
-{if $disableDialog}
-       <br><b>
-       {t}This dialog can't be used until the currently edited zone was saved or the zone entry exists in the ldap database.{/t}
-       </b>
-{else}
-       <br>
-       {$table}
-       <br>
-       <input type='submit' name='UserRecord' value='{t}New entry{/t}' title='{t}Create a new DNS zone entry{/t}'>
-{/if}
-
-<p class="seperator">&nbsp;</p>
-<div style="text-algin:right;" align="right">
-    <p>
-        <input type="submit" name="SaveZoneEntryChanges" value="{t}Save{/t}">
-        <input type="submit" name="CancelZoneEntryChanges" value="{t}Cancel{/t}">
-    </p>
-</div>
-
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('zoneName');
-  -->
-</script>
-                                                                            
diff --git a/plugins/admin/systems/servRepository.tpl b/plugins/admin/systems/servRepository.tpl
deleted file mode 100644 (file)
index ca42710..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-{$Repositories}
-<input type="hidden" name="servRepository" value="1">
-
-<p class="seperator">&nbsp;</p>
-<div style="width:100%; text-align:right;">
-       <input type='submit' name='SaveService' value='{t}Save{/t}'>
-       &nbsp; 
-       <input type='submit' name='CancelService' value='{t}Cancel{/t}'> 
-</div>
diff --git a/plugins/admin/systems/servRepositorySetup.tpl b/plugins/admin/systems/servRepositorySetup.tpl
deleted file mode 100644 (file)
index 29691ec..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-<h2><img src="images/fai_small.png" alt=''>&nbsp;{t}Repository{/t}</h2>
-
-<table width="100%" summary=''>
-       <tr>
-               <td width="50%" valign="top" style="border-right:1px solid #A0A0A0">
-                       <table summary=''>
-                               <tr>
-                                       <td>{t}Parent server{/t}
-                                       </td>
-                                       <td>
-{render acl=$ParentServerACL}
-                                               <select name="ParentServer">
-                                                       {html_options options=$ParentServers values=$ParentServerKeys selected=$ParentServer} 
-                                               </select>
-{/render}
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>{t}Release{/t}
-                                       </td>
-                                       <td>
-{render acl=$ReleaseACL}
-                                               <input type="text" value="{$Release}" name="Release">
-{/render}
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>{t}URL{/t}
-                                       </td>
-                                       <td>
-{render acl=$UrlACL}
-                                               <input type="text" size="40" value="{$Url}" name="Url">
-{/render}
-                                       </td>
-                               </tr>
-                       </table>
-               </td>
-               <td>
-                       {t}Sections{/t}<br>
-{render acl=$SectionACL}
-                       {$Sections}
-{/render}
-{render acl=$SectionACL}
-                       <input type="text"      name="SectionName" value="" style='width:100%;'>
-{/render}
-{render acl=$SectionACL}
-                       <input type="submit"    name="AddSection"  value="{t}Add{/t}">
-{/render}
-               </td>
-       </tr>
-</table>
-<input type='hidden' name='servRepositorySetup_Posted' value='1'>
-<p class="plugbottom">
-  <input type=submit name="repository_setup_save" value="{t}Apply{/t}">
-  &nbsp;
-  <input type=submit name="repository_setup_cancel" value="{t}Cancel{/t}">
-</p>
-
diff --git a/plugins/admin/systems/servdhcp.tpl b/plugins/admin/systems/servdhcp.tpl
deleted file mode 100644 (file)
index 846af22..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-{if $dns_take_over}
-<table summary="" width="100%">
-    <tr>
-        <td style="width:100%;vertical-align:top;">
-                       <h2>{t}DHCP take over will take place when saving this entry. Choose 'Cancel' to abort.{/t}</h2>
-        </td>
-    </tr>
-</table>
-{else}
-<table summary="" width="100%">
-{if $dhcp_server_list_cnt}
-<tr>
-    <td style="width:100%;vertical-align:top;">
-        <b>{t}Take over dhcp configuration from following server{/t}</b>&nbsp;
-        <select name='take_over_src'>
-            {html_options options=$dhcp_server_list}
-        </select>
-        <input type="submit" name="take_over" value="{t}Apply{/t}">
-    </td>
-</tr>
-{/if}
-<tr>
-    <td style="width:100%;vertical-align:top;">
-    <h2>{t}DHCP sections{/t}</h2>
-        {$DhcpList}
-    </td>
-</tr>
-</table>
-{/if}
-<p class='seperator'>&nbsp;</p>
-<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
-    <input type='submit' name='SaveService' value='{t}Save{/t}'>
-    &nbsp;
-    <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
-</div
diff --git a/plugins/admin/systems/servdns.tpl b/plugins/admin/systems/servdns.tpl
deleted file mode 100644 (file)
index 6cfa50f..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-{if $dns_take_over}
-<table summary="" width="100%">
-    <tr>
-        <td style="width:100%;vertical-align:top;">
-            <h2>{t}DNS take over initiated{/t}</h2>
-            {$warning}
-            {t}This includes 'all' DNS zones that are located within this server. Please double check if your really want to do this.{/t}
-            <p>
-            {$warning2}
-            <br>
-            <input type='submit' name='cancel_take_over' value='{t}Cancel{/t}'>
-            </p>
-            <p>
-            {t}Following objects will be taken over{/t}&nbsp;:
-            </p>
-            <p>
-            <pre>{$info}</pre>
-            </p>
-        </td>
-    </tr>
-</table>
-{else}
-<table summary="" width="100%">
-{if $dns_server_list_cnt}
-<tr>
-    <td style="width:100%;vertical-align:top;">
-        <b>{t}Take over DNS configuration from{/t}</b>&nbsp;
-        <select name='take_over_src'>
-            {html_options options=$dns_server_list}
-        </select>
-        <input type="submit" name="take_over" value="{t}Take over{/t}">
-    </td>
-</tr>
-{/if}
-<tr>
-    <td style="width:100%;vertical-align:top;">
-<h2>{t}Zones{/t}</h2>
-                 {$ZoneList}
-                 {if $is_createable}
-                 <input type="submit" name="AddZone" value="{t}Add{/t}">
-                 {else}
-                 <input type="button" value="{t}Add{/t}" disabled>
-                 {/if}
-    </td>
-</tr>
-</table>
-
-
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('AddZone');
-  -->
-</script>
-
-{/if}
-<p class="seperator">&nbsp;</p>
-<p>
-<div style="width:100%; text-align:right;">
-    <input type='submit' name='SaveService' value='{t}Save{/t}'>
-    &nbsp;
-    <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
-</div>
-</p>
diff --git a/plugins/admin/systems/servdnseditzone.tpl b/plugins/admin/systems/servdnseditzone.tpl
deleted file mode 100644 (file)
index 1136dba..0000000
+++ /dev/null
@@ -1,177 +0,0 @@
-<h2>{t}Generic{/t}</h2>
-<table summary="" width="100%">
-       <tr>
-               <td style="width:50%;vertical-align:top;border-right:1px        solid   #b0b0b0;">
-                       <table summary="">
-                               <tr>
-                                       <td>{t}Zone name{/t}{$must}
-                                       </td>
-                                       <td>
-{render acl=$ACLs}                                     
-                                               <input type="text" name="zoneName" value="{$zoneName}" {if $NotNew} disabled {/if}>
-{/render}
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>{t}Network address{/t}{$must}
-                                       </td>
-                                       <td>
-{render acl=$ACLs}                                     
-                                               <input type="text" name="ReverseZone" value="{$ReverseZone}" {if $NotNew} disabled {/if}>
-{/render}
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>{t}Netmask{/t}
-                                       </td>
-                                       <td>
-{render acl=$ACLs}                                     
-                                               <select name="NetworkClass" {if $NotNew} disabled {/if}>
-                                                       {html_options options=$NetworkClasses selected=$NetworkClass }
-                                               </select>
-{/render}
-                                       </td>
-                               </tr>
-                       </table>
-               </td>
-               <td style="vertical-align:top;">
-                       <table summary="">
-                               <tr>
-                                       <td>
-                                               {t}Zone records{/t}
-                                               <br>
-                                               {if $AllowZoneEdit == false}
-                                                       <i>{t}Can't be edited because the zone wasn't saved right now.{/t}</i>
-                                               {/if}
-                                       </td>
-                                       <td>
-{render acl=$ACLs}                                     
-                                               <input type="submit" name="EditZoneEntries" value="{t}Edit{/t}" {if $AllowZoneEdit == false} disabled {/if}> 
-{/render}
-                                       </td>
-                               </tr>
-                       </table>
-               </td>
-       </tr>
-</table>
-<p class="seperator">&nbsp;</p>
-<h2>{t}SOA record{/t}</h2>
-<table summary="" width="100%">
-       <tr>
-               <td style="vertical-align:top;width:50%;border-right:1px        solid   #b0b0b0;">
-                       <table summary="">
-                               <tr>
-                                       <td>{t}Primary dns server for this zone{/t}{$must}
-                                       </td>
-                                       <td>
-{render acl=$ACLs}                                     
-                                               <input type="text" name="sOAprimary" value="{$sOAprimary}">
-{/render}
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>{t}Mail address{/t}{$must}
-                                       </td>
-                                       <td>
-{render acl=$ACLs}                                     
-                                               <input type="text" name="sOAmail" value="{$sOAmail}">
-{/render}
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>{t}Serial number (automatically incremented){/t}{$must}
-                                       </td>
-                                       <td>
-{render acl=$ACLs}                                     
-                                               <input type="text" name="sOAserial" value="{$sOAserial}">
-{/render}
-                                       </td>
-                               </tr>
-                       </table>
-               </td>
-               <td style="vertical-align:top;">
-                       <table summary="">
-                               <tr>
-                                       <td>{t}Refresh{/t}{$must}
-                                       </td>
-                                       <td>
-{render acl=$ACLs}                                     
-                                               <input type="text" name="sOArefresh" value="{$sOArefresh}">
-{/render}
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>{t}Retry{/t}{$must}
-                                       </td>
-                                       <td>
-{render acl=$ACLs}                                     
-                                               <input type="text" name="sOAretry" value="{$sOAretry}">
-{/render}
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>{t}Expire{/t}{$must}
-                                       </td>
-                                       <td>
-{render acl=$ACLs}                                     
-                                               <input type="text" name="sOAexpire" value="{$sOAexpire}">
-{/render}
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>{t}TTL{/t}{$must}
-                                       </td>
-                                       <td>
-{render acl=$ACLs}                                     
-                                               <input type="text" name="sOAttl" value="{$sOAttl}">
-{/render}
-                                       </td>
-                               </tr>
-                       </table>
-               </td>
-       </tr>
-</table>
-
-<p class="seperator">&nbsp;</p>
-<br>
-<table summary="" width="100%">
-       <tr>
-               <td style="vertical-align:top;width:50%;border-right:1px        solid   #b0b0b0;">
-                       <h2>{t}MxRecords{/t}</h2>
-                       <table width="100%">    
-                               <tr>
-                                       <td>
-{render acl=$ACLs}                                     
-                                               {$Mxrecords}
-{/render}
-{render acl=$ACLs}                                     
-                                               <input type="text"              name="StrMXRecord" value="">
-{/render}
-{render acl=$ACLs}                                     
-                                               <input type="submit"    name="AddMXRecord" value="{t}Add{/t}">
-{/render}
-                                       </td>
-                               </tr>
-                       </table>
-               </td>
-               <td style="vertical-align:top;">
-                       <h2>{t}Global zone records{/t}</h2>
-{render acl=$ACLs}                                     
-                         {$records}
-{/render}
-               </td>
-       </tr>
-</table>
-<div style="text-algin:right;" align="right">
-       <p>
-{render acl=$ACLs}                                     
-               <input type="submit" name="SaveZoneChanges" value="{t}Save{/t}">
-{/render}
-               <input type="submit" name="CancelZoneChanges" value="{t}Cancel{/t}">
-       </p>
-</div>
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('zoneName');
-  -->
-</script>
diff --git a/plugins/admin/systems/services/ServiceAddDialog.tpl b/plugins/admin/systems/services/ServiceAddDialog.tpl
new file mode 100644 (file)
index 0000000..f055f33
--- /dev/null
@@ -0,0 +1,32 @@
+<div style="height:5px">&nbsp;</div>
+<div style="font-size:18px;">
+       {t}Adding a new service to the current server{/t}
+</div>
+<br>
+<p class="seperator">
+{t}This dialog allows you to add new services to the currenty edited server object. The box below shows all available but not already used services.{/t}
+<br>
+<br>
+</p>
+{if $Services} 
+<br>
+<br>{t}Service to add{/t} &nbsp;
+       <select name="ServiceName" >
+               <option value="" >&nbsp;</option>
+               {html_options options=$Services }
+       </select>
+{else}
+       <br>
+       {t}All available services are already in use.{/t}
+       <br>
+{/if}
+<br>
+<br>
+<br>
+<p class="seperator">
+<div style="width:100%; text-align:right;padding-top:8px;padding-bottom:3px;">
+    <input type='submit' name='SaveServiceAdd' value='{t}Continue{/t}' {if !$Services} disabled {/if}>
+    &nbsp;
+    <input type='submit' name='CancelServiceAdd' value='{t}Cancel{/t}'>
+</div>
+
diff --git a/plugins/admin/systems/services/class_ServiceAddDialog.inc b/plugins/admin/systems/services/class_ServiceAddDialog.inc
new file mode 100644 (file)
index 0000000..47e9701
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+
+class ServiceAddDialog extends plugin{
+
+  var $cli_summary      = "This dialog is used to add services";
+  var $cli_description  = "Some longer text\nfor help";
+  var $cli_parameters   = array("config"=>"Config object" , "dn"=>"Object dn");
+
+  /* This plugin does not have any ocs */
+  var $objectclasses    = array();
+  var $parent           = NULL;
+
+  function ServiceAddDialog(&$config,$dn,$parent)
+  {
+    plugin::plugin($config);
+    $this->parent = $parent;
+  }
+
+  function execute()
+  {
+    $smarty = get_smarty();
+    $services = $this->parent->getAllUnusedServices();
+    natcasesort($services);
+    $smarty->assign("Services",$services);
+    return($smarty->fetch(get_template_path("ServiceAddDialog.tpl", TRUE,dirname(__FILE__))));
+ }
+
+  function check(){ return array();}
+  function save_object(){;}
+  function save(){}
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/services/class_goService.inc b/plugins/admin/systems/services/class_goService.inc
new file mode 100644 (file)
index 0000000..edfd3d7
--- /dev/null
@@ -0,0 +1,238 @@
+<?php
+
+class goService extends plugin{
+       
+  var $cli_summary      = "This plugin is used within the ServerService plugin.";
+  var $cli_description  = "Some longer text\nfor help";
+  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* This plugin only writes its objectClass */
+  var $objectclasses    = array();
+  var $attributes       = array();
+  var $StatusFlag       = "";
+  /* This class can't be assigned twice so it conflicts with itsself */
+  var $conflicts            = array();
+  var $dn                   = NULL;
+  var $cn                   = "";
+  var $DisplayName          = "";
+  var $view_logged  =FALSE;
+
+   
+  /* Construcktion */ 
+  function goService(&$config,$dn)
+  {
+    plugin::plugin($config,$dn);
+    $this->DisplayName = _("Empty service");
+  }
+
+  
+  /* Create content */
+  function execute()
+  {
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","server/".get_class($this),$this->dn);
+    }
+
+    $str ="<div style='width:100%; text-align:right;'>".
+          "  <input type='submit' name='SaveService' value='"._("Save")."'>&nbsp;".
+          "  <input type='submit' name='CancelService' value='"._("Cancel")."'>".
+          "</div>";
+    return($str);
+  }
+
+
+  /* Get service information for serverService plugin */
+  function getListEntry()
+  {
+    
+    $this->updateStatusState();
+
+    /* Assign status flag */
+    if(!empty($this->StatusFlag)){
+      $flag                   = $this->StatusFlag;
+      $fields['Status']       = $this->$flag;
+    }else{
+      $fields['Status']       = "";
+    }
+
+    /* Name displayed in service overview */
+    $fields['Message']      = _("Empty service");
+
+    /* Allow/disallow some functions */
+    $fields['AllowStart']   = $this->acl_is_writeable("start");
+    $fields['AllowStop']    = $this->acl_is_writeable("stop");
+    $fields['AllowRestart'] = $this->acl_is_writeable("restart");
+    $fields['AllowRemove']  = $this->acl_is_removeable();
+    $fields['AllowEdit']    = true;
+    return($fields);
+  }
+
+
+  /* Remove service */
+  function remove_from_parent()
+  {
+    if(!$this->initially_was_account || !$this->acl_is_removeable()){
+      return;
+    }
+    
+    plugin::remove_from_parent();
+
+    /* Remove status flag, it is not a memeber of 
+        this->attributes, so ensure that it is deleted too */
+    if(!empty($this->StatusFlag)){
+      $this->attrs[$this->StatusFlag] = array();
+    }
+
+    /* Check if this is a new entry ... add/modify */
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cat($this->dn,array("objectClass"));
+    if($ldap->count()){
+      $ldap->cd($this->dn);
+      $ldap->modify($this->attrs);
+    }else{
+      $ldap->cd($this->dn);
+      $ldap->add($this->attrs);
+      
+    }
+
+    new log("remove","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+
+    show_ldap_error($ldap->get_error(), sprintf(_("Removing of server services/".get_class($this)." - (".$this->DisplayName.") with dn '%s' failed."),$this->dn));
+    $this->handle_post_events("remove");
+  }
+
+
+  /* Save service */
+  function save()
+  {
+    plugin::save();
+    /* Check if this is a new entry ... add/modify */
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cat($this->dn,array("objectClass"));
+    if($ldap->count()){
+      $ldap->cd($this->dn);
+      $ldap->modify($this->attrs);
+    }else{
+      $ldap->cd($this->dn);
+      $ldap->add($this->attrs);
+    }
+    if($this->initially_was_account){
+      new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+      $this->handle_post_events("modify");
+    }else{
+      $this->handle_post_events("add");
+      new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of server services/".get_class($this)." - (".$this->DisplayName.") with dn '%s' failed."),$this->dn));
+  }
+
+
+  /* Directly save new status flag */
+  function setStatus($value)
+  {
+    if($value == "none") return;
+
+    /* Can't set status flag for new services (Object doesn't exists in ldap tree) */
+    if(!$this->initially_was_account) return;
+
+    /* Can't set status flag, if no flag is specified  */
+    if(empty($this->StatusFlag)){
+      return;
+    }
+
+    /* Get object (server), update status flag and save changes */
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->dn);
+    $ldap->cat($this->dn,array("objectClass"));
+    if($ldap->count()){
+
+      $tmp = $ldap->fetch();
+      for($i = 0; $i < $tmp['objectClass']['count']; $i ++){
+        $attrs['objectClass'][] = $tmp['objectClass'][$i];
+      }
+      $flag = $this->StatusFlag;
+      $attrs[$flag] = $value;
+      $this->$flag = $value;
+      $ldap->modify($attrs);
+      show_ldap_error($ldap->get_error(), sprintf(_("Set status flag for server services/".get_class($this)." - (".$this->DisplayName.") with dn '%s' failed."),$this->dn));
+      $this->action_hook();
+    }
+  }
+
+
+  function check()
+  { 
+    $message = plugin::check();
+    return($message);
+  }
+  
+
+  function save_object()
+  {
+    plugin::save_object();
+  }  
+
+  
+  function action_hook($add_attrs= array())
+  {
+    /* Find postcreate entries for this class */
+    $command= $this->config->search(get_class($this), "ACTION_HOOK",array('menu','tabs'));
+    if ($command != ""){
+
+      /* Walk through attribute list */
+      foreach ($this->attributes as $attr){
+        if (!is_array($this->$attr)){
+          $command= preg_replace("/%$attr/", $this->$attr, $command);
+        }
+      }
+      $command= preg_replace("/%dn/", $this->dn, $command);
+
+      /* Additional attributes */
+      foreach ($add_attrs as $name => $value){
+        $command= preg_replace("/%$name/", $value, $command);
+      }
+
+      /* If there are still some %.. in our command, try to fill these with some other class vars */
+      if(preg_match("/%/",$command)){
+        $attrs = get_object_vars($this);
+        foreach($attrs as $name => $value){
+          if(!is_string($value)) continue;
+          $command= preg_replace("/%$name/", $value, $command);
+        }
+      }
+
+      if (check_command($command)){
+        @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__,
+            $command, "Execute");
+
+        exec($command);
+      } else {
+        $message= sprintf(_("Command '%s', specified as ACTION_HOOK for plugin '%s' doesn't seem to exist."), $command, get_class($this));
+        print_red ($message);
+      }
+    }
+  }
+
+
+  /* Get updates for status flag */
+  function updateStatusState()
+  {
+    if(empty($this->StatusFlag)) return;
+
+    $attrs = array();
+    $flag = $this->StatusFlag;
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->cn);
+    $ldap->cat($this->dn,array($flag));
+    if($ldap->count()){
+      $attrs = $ldap->fetch();
+    }
+    if(isset($attrs[$flag][0])){
+      $this->$flag = $attrs[$flag][0];
+    }
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/services/cups/class_goCupsServer.inc b/plugins/admin/systems/services/cups/class_goCupsServer.inc
new file mode 100644 (file)
index 0000000..6fa572b
--- /dev/null
@@ -0,0 +1,85 @@
+<?php
+
+class goCupsServer extends goService{
+       
+  var $cli_summary      = "This plugin is used within the ServerService Pluign \nand indicates that this server supports cups management.";
+  var $cli_description  = "Some longer text\nfor help";
+  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* This plugin only writes its objectClass */
+  var $objectclasses    = array("goCupsServer");
+  var $attributes       = array();
+  var $StatusFlag       = "goCupsServerStatus";
+  /* This class can't be assigned twice so it conflicts with itsself */
+  var $conflicts        = array("goCupsServer");
+
+  var $DisplayName      = "";
+  var $dn               = NULL;
+  var $acl;
+  var $cn                  = "";
+  var $goCupsServerStatus  = "";
+  var $view_logged  =FALSE;
+  function goCupsServer(&$config,$dn)
+  {
+    goService::goService($config,$dn);
+    $this->DisplayName = _("Print service");
+  }
+
+    
+  function execute()
+  { 
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","server/".get_class($this),$this->dn);
+    }
+
+    $smarty = get_smarty(); 
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr,$this->$attr);
+    }
+    return($smarty->fetch(get_template_path("goCupsServer.tpl",TRUE,dirname(__FILE__))));
+  }
+
+  function getListEntry()
+  {
+    $fields = goService::getListEntry();
+    $fields['Message']    = _("Print service");
+    $fields['AllowEdit']  = false;
+    return($fields);
+  }
+
+  function check()
+  { 
+    $message = plugin::check();
+    return($message);
+  }
+  
+  function save_object()
+  {
+    plugin::save_object();
+  }  
+
+  /* Return plugin informations for acl handling */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Cups"),
+          "plDescription" => _("Print service")." ("._("Services").")",
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 100,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("server"),
+
+          "start"         => _("Start"),
+          "stop"          => _("Stop"),
+          "restart"       => _("Restart"),
+
+          "plProvidedAcls"=> array()
+          ));
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/services/cups/goCupsServer.tpl b/plugins/admin/systems/services/cups/goCupsServer.tpl
new file mode 100644 (file)
index 0000000..e10bd2f
--- /dev/null
@@ -0,0 +1,9 @@
+<h2>{t}Print Service{/t} {t}enabled{/t}</h2>
+
+<p class='seperator'>&nbsp;</p>
+<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
+    <input type='submit' name='SaveService' value='{t}Save{/t}'>
+    &nbsp;
+    <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
+</div>
+<input type="hidden" name="goCupsServerPosted" value="1">
diff --git a/plugins/admin/systems/services/dhcp/class_dhcpAdvanced.inc b/plugins/admin/systems/services/dhcp/class_dhcpAdvanced.inc
new file mode 100644 (file)
index 0000000..43f5831
--- /dev/null
@@ -0,0 +1,146 @@
+<?php
+/*
+  This code is part of GOsa (https://gosa.gonicus.de)
+  Copyright (C) 2003  Cajus Pollmeier
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+class dhcpAdvanced extends plugin
+{
+  /* Used attributes */
+  var $options= array();
+  var $statements= array();
+  var $show_advanced= FALSE;
+  var $autoStatements= array();
+  var $autoOptions= array();
+
+  /* attribute list for save action */
+  var $attributes= array();
+  var $objectclasses= array();
+
+  function dhcpAdvanced()
+  {
+    /* This is always an account */
+    $this->is_account= TRUE;
+    $this->setAutoStatements();
+    $this->setAutoOptions();
+  }
+
+  function execute()
+  {
+    /* Check for interaction */
+    if (isset($_POST['add_statement']) && $_POST['addstatement'] != ""){
+      $key= preg_replace('/^([a-z0-9-]+)\s(.*)$/', '\\1', get_post('addstatement'));
+      $val= preg_replace("/^$key\s*/", '', get_post('addstatement'));
+      $this->statements[$key]= $val;
+    }
+    if (isset($_POST['delete_statement']) && isset($_POST['dhcpstatements'])){
+      $key= preg_replace('/([a-z0-9-]+)\s(.*)$/', '\\1', get_post('dhcpstatements'));
+      if (in_array($key, $this->autoStatements)){
+        print_red(_("Can't delete automatic statements. Please use the fields above."));
+      } else {
+        unset($this->statements[$key]);        
+      }
+    }
+    if (isset($_POST['add_option']) && $_POST['addoption'] != ""){
+      $key= preg_replace('/^([a-z0-9-]+)\s(.*)$/', '\\1', get_post('addoption'));
+      $val= preg_replace("/^$key\s*/", '', get_post('addoption'));
+      $this->options[$key]= $val;
+    }
+    if (isset($_POST['delete_option']) && isset($_POST['dhcpoptions'])){
+      $key= preg_replace('/([a-z0-9-]+)\s(.*)$/', '\\1', get_post('dhcpoptions'));
+      if (in_array($key, $this->autoOptions)){
+        print_red(_("Can't delete automatic options. Please use the fields above."));
+      } else {
+        unset($this->options[$key]);   
+      }
+    }
+
+    $smarty= get_smarty();
+
+    /* Assign arrays */
+    $statements= array();
+    foreach ($this->statements as $key => $val){
+      if (in_array($key, $this->autoStatements)){
+        $statements[$key]= "$key $val ["._("automatic")."]";
+      } else {
+        $statements[$key]= "$key $val";
+      }
+    }
+    $smarty->assign("dhcpstatements", $statements);
+    $options= array();
+    foreach ($this->options as $key => $val){
+      if (in_array($key, $this->autoOptions)){
+        $options[$key]= "$key $val ["._("automatic")."]";
+      } else {
+        $options[$key]= "$key $val";
+      }
+    }
+    $smarty->assign("dhcpoptions", $options);
+
+    /* Show main page */
+    $smarty->assign("show_advanced", $this->show_advanced);
+    return ($smarty->fetch (get_template_path('dhcp_advanced.tpl', TRUE,dirname(__FILE__))));
+  }
+
+  function remove_from_parent()
+  {
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    if (isset($_POST['show_advanced'])){
+      $this->show_advanced= TRUE;
+    }
+    if (isset($_POST['hide_advanced'])){
+      $this->show_advanced= FALSE;
+    }
+  }
+
+
+  /* Check values */
+  function check()
+  {
+    /* Nothing to check here */
+    $message= array();
+    return $message;
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+  }
+
+
+  function setAutoOptions($addopt= array())
+  {
+    $options= array("routers", "domain-name", "domain-name-servers", "subnet-mask", "broadcast-address");
+    $this->autoOptions= array_merge($options, $addopt);
+  }
+
+
+  function setAutoStatements($addstat= array())
+  {
+    $statements= array("filename", "next-server", "get-lease-hostnames", "use-host-decl-names");
+    $this->autoStatements= array_merge($statements, $addstat);
+  }
+
+}
+
+?>
diff --git a/plugins/admin/systems/services/dhcp/class_dhcpGroup.inc b/plugins/admin/systems/services/dhcp/class_dhcpGroup.inc
new file mode 100644 (file)
index 0000000..cbe987d
--- /dev/null
@@ -0,0 +1,126 @@
+<?php
+/*
+  This code is part of GOsa (https://gosa.gonicus.de)
+  Copyright (C) 2003  Cajus Pollmeier
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+class dhcpGroup extends dhcpPlugin
+{
+  /* attribute list for save action */
+  var $objectclasses= array('top', 'dhcpGroup', 'dhcpOptions');
+
+  function dhcpGroup(&$attrs)
+  {
+    /* Load statements / options */
+    dhcpPlugin::dhcpPlugin($attrs);
+  }
+
+  function execute()
+  {
+    $smarty= get_smarty();
+    $smarty->assign("cn", $this->cn);
+
+    /* Show main page */
+    $display= $smarty->fetch (get_template_path('dhcp_group.tpl', TRUE)).$this->network->execute();
+
+    /* Merge arrays for advanced view */
+    $this->fix_options();
+    foreach (array("options", "statements") as $type){
+      $this->advanced->$type= $this->$type + $this->network->$type;
+    }
+
+    $display.= $this->advanced->execute();
+
+    /* Merge back for removals */
+    foreach (array("options", "statements") as $type){
+      $this->$type= $this->advanced->$type;
+      $this->network->$type= $this->advanced->$type;
+    }
+
+    /* Add footer */
+    $display.= "<div style='width:100%;text-align:right;margin-top:5px;'><input type=submit name='save_dhcp' value='"._("Save")."'>".
+               "&nbsp;<input type=submit name='cancel_dhcp' value='"._("Cancel")."'></div>";
+
+
+    return ($display);
+  }
+
+
+  function remove_from_parent()
+  {
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    /* Save cn */
+    if (isset($_POST['cn'])){
+      $this->cn= validate(get_post('cn'));
+    }
+
+    /* Handle global saving */
+    dhcpPlugin::save_object();
+  }
+
+
+  /* Check values */
+  function check()
+  {
+    $message= array();
+
+    $cache = $this->parent->dhcpObjectCache;
+
+    /* All required fields are set? */
+    if ($this->cn == ""){
+      $message[]= _("Required field 'Name' is not filled.");
+    }
+    if (!preg_match('/^[a-z0-9_-]*$/i', $this->cn)){
+      $message[]= _("Field 'Name' contains illegal characters.");
+    }
+
+    /* cn already used? */
+    if ($this->orig_cn != $this->cn || $this->new){
+
+      foreach($cache as $dn => $dummy){
+        if (preg_match("/^cn=".$this->cn.",/", $dn) && count($dummy)){
+          $message[]= _("The name for this host section is already used!");
+          break;
+        }
+      }
+    }
+
+    /* Check external plugins */
+    $net= $this->network->check();
+    $adv= $this->advanced->check();
+    $message= array_merge($message, $net, $adv);
+
+    return $message;
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    dhcpPlugin::save();
+    return ($this->attrs);
+  }
+
+
+}
+
+?>
diff --git a/plugins/admin/systems/services/dhcp/class_dhcpHost.inc b/plugins/admin/systems/services/dhcp/class_dhcpHost.inc
new file mode 100644 (file)
index 0000000..e8aab5c
--- /dev/null
@@ -0,0 +1,181 @@
+<?php
+/*
+  This code is part of GOsa (https://gosa.gonicus.de)
+  Copyright (C) 2003-2007 Cajus Pollmeier
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+class dhcpHost extends dhcpPlugin
+{
+  /* Used attributes */
+  var $dhcpHWAddress= "";
+  var $realGosaHost = FALSE;
+       
+  /* attribute list for save action */
+  var $objectclasses= array("top", "dhcpHost");
+
+  function dhcpHost($attrs,$host_exists_in_gosa = FALSE)
+  {
+    dhcpPlugin::dhcpPlugin($attrs);
+
+    /* Load attributes */
+    if (!$this->new){
+      $this->dhcpHWAddress= $attrs['dhcpHWAddress'][0];
+    }
+
+    $this->advanced->setAutoOptions(array("host-name"));
+    $this->advanced->setAutoStatements(array("fixed-address"));
+
+       $this->realGosaHost = $host_exists_in_gosa;
+  }
+
+  function execute()
+  {
+    $smarty= get_smarty();
+    $smarty->assign("cn", $this->cn);
+    $smarty->assign("dhcpHWAddress", preg_replace('/^[^ ]+ /', '', $this->dhcpHWAddress));
+    $smarty->assign("realGosaHost",$this->realGosaHost);
+
+    /* Create fixed address */
+    if (isset($this->statements['fixed-address'])){
+      $smarty->assign("fixedaddr", $this->statements['fixed-address']);
+    } else {
+      $smarty->assign("fixedaddr", "");
+    }
+
+    /* Prepare hw type selector */
+    $hwtype= preg_replace('/\s.*$/', '', $this->dhcpHWAddress);
+    $smarty->assign("hwtype", $hwtype);
+    $smarty->assign("hwtypes", array("ethernet" => _("Ethernet"),
+          "fddi" => _("FDDI"),
+          "token-ring" => _("Token Ring")));
+    /* Show main page */
+    $display= $smarty->fetch(get_template_path('dhcp_host.tpl', TRUE,dirname(__FILE__))).$this->network->execute();
+
+    /* Merge arrays for advanced view */
+    $this->fix_options();
+    foreach (array("options", "statements") as $type){
+      $this->advanced->$type= $this->$type + $this->network->$type;
+    }
+    $display.= $this->advanced->execute();
+
+    /* Merge back for removals */
+    foreach (array("options", "statements") as $type){
+      $this->$type= $this->advanced->$type;
+      $this->network->$type= $this->advanced->$type;
+    }
+
+    /* Add footer */
+    $display.= "<div style='width:100%;text-align:right;margin-top:5px;'><input type=submit name='save_dhcp' value='"._("Save")."'>".
+               "&nbsp;<input type=submit name='cancel_dhcp' value='"._("Cancel")."'></div>";
+
+
+    return ($display);
+  }
+
+
+  function remove_from_parent()
+  {
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    /* Save remaining attributes */
+    if (isset($_POST['dhcp_host_posted'])){
+
+      /* Assemble hwAddress */
+      if (isset($_POST['dhcpHWAddress'])){
+        $this->dhcpHWAddress= get_post('hwtype')." ".get_post('dhcpHWAddress');
+      }
+               
+      if(!$this->realGosaHost){
+        $this->cn= validate(get_post('cn'));
+      }
+
+      /* Save fixed address */
+      if(!$this->realGosaHost){
+        if ($_POST['fixedaddr'] != ""){
+          $this->statements['fixed-address']= get_post('fixedaddr');
+        } else {
+          unset ($this->statements['fixed-address']);
+        }
+      }
+      $this->options['host-name']= $this->cn;
+    }
+
+    dhcpPlugin::save_object();
+  }
+
+
+  /* Check values */
+  function check()
+  {
+    $message= array();
+
+    $cache = array();
+    if(isset($this->parent)){
+      $cache = $this->parent->dhcpObjectCache;
+    }
+  
+    /* All required fields are set? */
+    if ($this->cn == ""){
+      $message[]= _("Required field 'Name' is not filled.");
+    }
+
+    /* cn already used? */
+    if ($this->orig_cn != $this->cn || $this->new){
+      
+      foreach($cache as $dn => $dummy){
+        if (preg_match("/^cn=".$this->cn.",/", $dn) && count($dummy)){
+          $message[]= _("The name for this host section is already used!");
+          break;
+        }
+      }
+    }
+
+    /* Check syntax of MAC address */
+    $check= preg_replace('/^[^\s]*\s/', '', $this->dhcpHWAddress);
+    if (!preg_match('/^([0-9a-fA-F]{1,2}:){5}[0-9a-fA-F]{1,2}$/', $check)){
+      $message[]= _("The hardware address specified by you is not valid!");
+    }
+
+    /* Check external plugins */
+    $net= $this->network->check();
+    $adv= $this->advanced->check();
+    $message= array_merge($message, $net, $adv);
+
+    return $message;
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    dhcpPlugin::save();
+    if ($this->dhcpHWAddress != ""){
+      $this->attrs['dhcpHWAddress']= array($this->dhcpHWAddress);
+    } else {
+      $this->attrs['dhcpHWAddress']= array();
+    }
+
+    return ($this->attrs);
+  }
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/services/dhcp/class_dhcpNetwork.inc b/plugins/admin/systems/services/dhcp/class_dhcpNetwork.inc
new file mode 100644 (file)
index 0000000..1c3ced0
--- /dev/null
@@ -0,0 +1,226 @@
+<?php
+/*
+  This code is part of GOsa (https://gosa.gonicus.de)
+  Copyright (C) 2004-2007  Cajus Pollmeier
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+class dhcpNetwork extends plugin
+{
+  /* Used attributes */
+  var $options= array();
+  var $statements= array();
+
+  /* attribute list for save action */
+  var $attributes= array();
+  var $objectclasses= array();
+
+  function dhcpNetwork()
+  {
+    /* This is always an account */
+    $this->is_account= TRUE;
+  }
+
+  function execute()
+  {
+    /* Check for iteraction */
+    if (isset($_POST['add_dns']) && $_POST['addserver'] != ""){
+      if (!preg_match('/^[0-9a-z.-]+$/', get_post('addserver'))){
+        print_red(_("The name of the DNS server your're going to add is not valid!"));
+      } else {
+        $servers= array();
+        if (isset($this->options['domain-name-servers'])){
+          foreach(split(",", $this->options['domain-name-servers']) as $val){
+            $servers[$val]= $val;
+          }
+        }
+        $servers[get_post('addserver')]= get_post('addserver');
+
+        $tmp= "";
+        foreach($servers as $val){
+          $tmp.= $val.",";
+        }
+        $this->options['domain-name-servers']= preg_replace('/,$/', '', $tmp);
+      }
+    }
+    if (isset($_POST['delete_dns']) && isset($_POST['dnsserver'])){
+      $tmp= preg_replace("/(\s*,\s*)?".get_post('dnsserver')."/i", '',
+          $this->options['domain-name-servers']);
+      $tmp= preg_replace("/(\s*)?,(\s*)?$/", '', $tmp);
+      if ($tmp != ""){
+        $this->options['domain-name-servers']= $tmp;
+      } else {
+        unset($this->options['domain-name-servers']);
+      }
+    }
+
+    /* Show main page */
+    $smarty= get_smarty();
+
+    /*
+     * Assemble options
+     */
+
+    /* Router */
+    if (isset($this->options['routers'])){
+      $smarty->assign("routers", $this->options['routers']);
+    } else {
+      $smarty->assign("routers", "");
+    }
+
+    /* DNS */
+    if (isset($this->options['domain-name'])){
+      $smarty->assign("domain", trim($this->options['domain-name'], '"'));
+    } else {
+      $smarty->assign("domain", "");
+    }
+    if (isset($this->options['domain-name-servers'])){
+      $servers= array();
+      foreach(split(",", $this->options['domain-name-servers']) as $val){
+        $servers[$val]= $val;
+      }
+      $smarty->assign("dnsservers", $servers);
+    } else {
+      $smarty->assign("dnsservers", "");
+    }
+
+    /* Netmask / Broadcast */
+    if (isset($this->options['subnet-mask'])){
+      $this->options['subnet-mask']= normalize_netmask($this->options['subnet-mask']);
+      $smarty->assign("subnet_mask", $this->options['subnet-mask']);
+    } else {
+      $smarty->assign("subnet_mask", "");
+    }
+    if (isset($this->options['broadcast-address'])){
+      $smarty->assign("broadcast_address", $this->options['broadcast-address']);
+    } else {
+      $smarty->assign("broadcast_address", "");
+    }
+
+    /* Boot stuff */
+    if (isset($this->statements['filename'])){
+      $smarty->assign("filename", trim($this->statements['filename'], '"'));
+    } else {
+      $smarty->assign("filename", "");
+    }
+    if (isset($this->statements['next-server'])){
+      $smarty->assign("nextserver", $this->statements['next-server']);
+    } else {
+      $smarty->assign("nextserver", "");
+    }
+
+    /* Set flags */
+    $smarty->assign("autohost", "");
+    if (isset($this->statements['get-lease-hostnames'])){
+      if (preg_match('/^(true|on|yes)$/', $this->statements['get-lease-hostnames'])){
+        $smarty->assign("autohost", "checked");
+      }
+    }
+    $smarty->assign("autohostdecl", "");
+    if (isset($this->statements['use-host-decl-names'])){
+      if (preg_match('/^(true|on|yes)$/', $this->statements['use-host-decl-names'])){
+        $smarty->assign("autohostdecl", "checked");
+      }
+    }
+
+    return $smarty->fetch(get_template_path('dhcp_network.tpl', TRUE,dirname(__FILE__)));
+  }
+
+  function remove_from_parent()
+  {
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    /* Only save, if we are "active" */
+    if (isset($_POST['routers'])){
+
+      /*
+       * Assemble options
+       */
+
+      /* Options */
+      foreach (array("routers" => "routers", "domain-name" => "domain", "subnet-mask" => "subnet_mask",
+                     "broadcast-address" => "broadcast_address") as $key => $val){
+
+        if ($_POST["$val"] == ''){
+          unset($this->options["$key"]);
+        } else {
+          $this->options["$key"]= get_post("$val");
+        }
+      }
+
+      /* Statements */
+      foreach (array("filename" => "filename", "next-server" => "nextserver") as $key => $val){
+        if ($_POST["$val"] == ''){
+          unset($this->statements["$key"]);
+        } else {
+    
+          /* Only quote filename values */
+          if(in_array($key,array("filename"))){
+            $this->statements["$key"]= '"'.get_post("$val").'"';
+          }else{
+            $this->statements["$key"]= get_post("$val");
+          }
+        }
+      }
+
+      /* Flags */
+      if (isset ($_POST['autohost'])){
+        $this->statements['get-lease-hostnames']= "true";
+      } else {
+        unset($this->statements['get-lease-hostnames']);
+      }
+      if (isset ($_POST['autohostdecl'])){
+        $this->statements['use-host-decl-names']= "on";
+      } else {
+        unset($this->statements['use-host-decl-names']);
+      }
+    }
+  }
+
+
+  /* Check values */
+  function check()
+  {
+    $message= array();
+
+    /* Check netmask and broadcast */
+    foreach(array("subnet-mask" => _("Netmask"), "broadcast-address" => _("Broadcast")) as $key => $typ){
+      if (!isset($this->options["$key"])){
+        continue;
+      }
+      $tmp= preg_replace('/^[^\s]+\s/', '', $this->options["$key"]);
+
+      if (!is_ip($tmp)){
+        $message[]= sprintf(_("Error in definition of '%s'!"), $typ);
+      }
+    }
+
+    return $message;
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+  }
+  
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/services/dhcp/class_dhcpNewSectionDialog.inc b/plugins/admin/systems/services/dhcp/class_dhcpNewSectionDialog.inc
new file mode 100644 (file)
index 0000000..756a978
--- /dev/null
@@ -0,0 +1,80 @@
+<?php
+
+class dhcpNewSectionDialog extends plugin
+{
+  /* attribute list for save action */
+  var $ignore_account     = TRUE;
+  var $attributes         = array();
+  var $objectclasses      = array("whatever");
+
+  /* Mapping array */
+  var $types= array();
+  var $classtype= "";
+  var $sectionMap= array(  "dhcpService" => array("dhcpSharedNetwork", "dhcpSubnet", "dhcpGroup", "dhcpHost" /*, "dhcpClass"*/),
+                              #"dhcpClass" => array("dhcpSubClass"),
+                              "dhcpSubClass" => array(),
+                              "dhcpHost" => array(),
+                              "dhcpGroup" => array("dhcpHost"),
+                              "dhcpPool" => array(),
+                              "dhcpSubnet" => array("dhcpPool", "dhcpGroup", "dhcpHost" /*, "dhcpClass"*/),
+                              "dhcpSharedNetwork" => array("dhcpSubnet", "dhcpPool"));
+
+
+
+  function dhcpNewSectionDialog($type)
+  {
+    $this->types= array(  "dhcpService" => _("Global options"),
+                          /*"dhcpClass" => _("Class"),*/
+                          "dhcpSubClass" => _("Subclass"),
+                          "dhcpHost" => _("Host"),
+                          "dhcpGroup" => _("Group"),
+                          "dhcpPool" => _("Pool"),
+                          "dhcpSubnet" => _("Subnet"),
+                          "dhcpSharedNetwork" => _("Shared network"));
+
+    $this->classtype= $type;
+  }
+
+  function execute()
+  {
+    /* Fill templating stuff */
+    $smarty = get_smarty();
+    $display= "";
+
+    $sections= $this->sectionMap[$this->classtype];
+    $t_sections= array();
+    foreach ($sections as $section){
+      $t_sections[$section]= $this->types[$section]; 
+    }
+    asort($t_sections);
+    $ui = get_userinfo();
+    $smarty->assign("sections", $t_sections);
+    $display.= $smarty->fetch(get_template_path('dhcpNewSection.tpl', TRUE));
+    return($display);
+  }
+
+  /* Get posts and set class name 
+   */ 
+  function save_object()
+  {
+  }
+
+  /* Check given class name */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= "";
+    return ($message);
+  }
+
+
+  /* Return the class name */
+  function save()
+  {
+  }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/services/dhcp/class_dhcpPool.inc b/plugins/admin/systems/services/dhcp/class_dhcpPool.inc
new file mode 100644 (file)
index 0000000..9e9821e
--- /dev/null
@@ -0,0 +1,191 @@
+<?php
+/*
+  This code is part of GOsa (https://gosa.gonicus.de)
+  Copyright (C) 2003  Cajus Pollmeier
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+class dhcpPool extends dhcpPlugin
+{
+  /* Used attributes */
+  var $dhcpRange= "";
+  var $range_start= "";
+  var $range_stop= "";
+
+  /* attribute list for save action */
+  var $objectclasses= array('top', 'dhcpPool');
+
+  function dhcpPool($attrs)
+  {
+    dhcpPlugin::dhcpPlugin($attrs);
+
+    /* Load attributes */
+    if (!$this->new){
+      $this->dhcpRange= $attrs['dhcpRange'][0];
+      list($this->range_start, $this->range_stop)= preg_split('/\s+/', $this->dhcpRange);
+    }
+
+    $this->advanced->setAutoOptions(array("host-name"));
+    $this->advanced->setAutoStatements(array("fixed-address"));
+  }
+
+  function execute()
+  {
+    $smarty= get_smarty();
+    $smarty->assign("cn", $this->cn);
+    $smarty->assign("range_start", $this->range_start);
+    $smarty->assign("range_stop", $this->range_stop);
+
+    /* Show main page */
+    $display= $smarty->fetch(get_template_path('dhcp_pool.tpl', TRUE)).$this->network->execute();
+
+    /* Merge arrays for advanced view */
+    $this->fix_options();
+    foreach (array("options", "statements") as $type){
+      $this->advanced->$type= $this->$type + $this->network->$type;;
+    }
+
+    $display.= $this->advanced->execute();
+
+    /* Merge back for removals */
+    foreach (array("options", "statements") as $type){
+      $this->$type= $this->advanced->$type;
+      $this->network->$type= $this->advanced->$type;
+    }
+
+    /* Add footer */
+    $display.= "<div style='width:100%;text-align:right;margin-top:5px;'><input type=submit name='save_dhcp' value='"._("Save")."'>".
+               "&nbsp;<input type=submit name='cancel_dhcp' value='"._("Cancel")."'></div>";
+
+    return ($display);
+  }
+
+  function remove_from_parent()
+  {
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    if (isset($_POST['cn'])){
+      $this->cn= validate(get_post('cn'));
+      $this->range_start= validate(get_post('range_start'));
+      $this->range_stop= validate(get_post('range_stop'));
+    }
+
+    dhcpPlugin::save_object();
+
+    /* Move range to internal variable */
+    $this->dhcpRange= $this->range_start." ".$this->range_stop;
+  }
+
+
+  /* Check values */
+  function check()
+  {
+    $message= array();
+
+       $cache = $this->parent->dhcpObjectCache;
+
+    /* All required fields are set? */
+    if ($this->cn == ""){
+      $message[]= _("Required field 'Name' is not filled.");
+    }
+
+    /* cn already used? */
+    if ($this->orig_cn != $this->cn || $this->new){
+
+      foreach($cache as $dn => $dummy){
+        if (preg_match("/^cn=".$this->cn.",/", $dn) && count($dummy)){
+          $message[]= _("The name for this section is already used!");
+          break;
+        }
+      }
+    }
+
+    if ($this->dhcpRange == ""){
+      $message[]= _("Required field 'Range' is not filled.");
+    }
+
+    if (!is_ip($this->range_start) || !is_ip($this->range_stop)){
+      $message[]= _("Field 'Range' contains invalid IP addresses.");
+    }
+
+    if(!is_ip_range($this->range_start,$this->range_stop)){
+      $message[] = _("Field 'Range' contains invalid IP range.");
+    }
+
+    /* Check if range is in the network */
+    $dn= $this->dn;
+    while (preg_match('/,/', $dn)){
+      $type= $this->objectType($cache, $dn);
+
+      /* Check for subnet */
+      if ($type == 'dhcpSubnet'){
+        $network= $cache[$dn]['cn'][0];
+        $netmask= normalize_netmask($cache[$dn]['dhcpNetMask'][0]);
+        if (!is_in_network($network, $netmask, $this->range_start) ||
+            !is_in_network($network, $netmask, $this->range_stop)){
+          $message[] = _("'Range' is not inside the configured network.");
+        }
+      }
+
+      /* Stop if we've examined the service base object */
+      if ($type == 'dhcpService'){
+        break;
+      }
+      $dn= preg_replace('/^[^,]+,/', '', $dn);
+    }
+
+    /* Check external plugins */
+    $net= $this->network->check();
+    $adv= $this->advanced->check();
+    $message= array_merge($message, $net, $adv);
+
+    return $message;
+  }
+
+  /* Save to LDAP */
+  function save()
+  {
+    dhcpPlugin::save();
+    $this->attrs['dhcpRange']= array($this->dhcpRange);
+
+    return ($this->attrs);
+  }
+
+
+  function objectType($cache, $dn)
+  {
+    $type= "";
+    $types= array("dhcpService", "dhcpClass", "dhcpSubClass", "dhcpHost",
+                  "dhcpGroup", "dhcpPool", "dhcpSubnet", "dhcpSharedNetwork");
+
+    foreach ($cache[$dn]['objectClass'] as $oc){
+      if (in_array($oc, $types)){
+        $type= $oc;
+        break;
+      }
+    }
+
+    return ($type);
+  }
+
+  
+}
+
+?>
diff --git a/plugins/admin/systems/services/dhcp/class_dhcpService.inc b/plugins/admin/systems/services/dhcp/class_dhcpService.inc
new file mode 100644 (file)
index 0000000..57f76cc
--- /dev/null
@@ -0,0 +1,181 @@
+<?php
+/*
+  This code is part of GOsa (https://gosa.gonicus.de)
+  Copyright (C) 2003-2007  Cajus Pollmeier
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+class dhcpService extends dhcpPlugin
+{
+  /* Used attributes */
+  var $dhcpPrimaryDN= "";
+  var $orig_dhcpPrimaryDN= "";
+  var $ddns_styles= array('none', 'interim', 'ad-hoc');
+
+  /* attribute list for save action */
+  var $objectclasses= array('top', 'dhcpService');
+
+
+  function dhcpService($attrs)
+  {
+    dhcpPlugin::dhcpPlugin($attrs);
+
+    /* Load statements / options */
+    if (!$this->new){
+      /* Load attributes */
+      $this->dhcpPrimaryDN= $attrs['dhcpPrimaryDN'][0];
+    } else {
+      /* We keep the parent dn here if it's new */
+      $this->statements['default-lease-time']= 600;
+      $this->statements['max-lease-time']= 1700;
+      $this->statements['authoritative']= TRUE;
+      $this->statements['ddns-update-style']= 'none';
+    }
+
+    $this->advanced->setAutoStatements(array("default-lease-time", "max-lease-time", "authoritative", "server-identifier", "ddns-update-style"));
+    $this->advanced->setAutoOptions(array("server-name"));
+
+    /* Save for later action */
+    $this->orig_dhcpPrimaryDN= $this->dhcpPrimaryDN;
+  }
+
+
+  function execute()
+  {
+    /* Show main page */
+    $smarty= get_smarty();
+
+    $smarty->assign('ddns_styles', $this->ddns_styles);
+    foreach (array('max_lease_time', 'default_lease_time', 'ddns_update_style') as $value){
+      if (isset($this->statements[preg_replace('/_/', '-', $value)])){
+        $smarty->assign("$value", $this->statements[preg_replace('/_/', '-', $value)]);
+      } else {
+        $smarty->assign("$value", "");
+      }
+    }
+
+    if (isset($this->statements['authoritative'])){
+      $smarty->assign("authoritative", "checked");
+    } else {
+      $smarty->assign("authoritative", "");
+    }
+
+    /* Show main page */
+    $display= $smarty->fetch(get_template_path('dhcp_service.tpl', TRUE)).$this->network->execute();
+
+    /* Merge arrays for advanced view */
+    $this->fix_options();
+    foreach (array("options", "statements") as $type){
+      $this->advanced->$type= $this->$type + $this->network->$type;;
+    }
+
+    $display.= $this->advanced->execute();
+
+    /* Merge back for removals */
+    foreach (array("options", "statements") as $type){
+      $this->$type= $this->advanced->$type;
+      $this->network->$type= $this->advanced->$type;
+    }
+
+    /* Add footer */
+    $display.= "<div style='width:100%;text-align:right;margin-top:5px;'><input type=submit name='save_dhcp' value='"._("Save")."'>".
+      "&nbsp;<input type=submit name='cancel_dhcp' value='"._("Cancel")."'></div>";
+
+
+    return ($display);
+
+  }
+
+  function remove_from_parent()
+  {
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    /* No need to save in the first time */
+    if (!isset($_POST['ddns_update_style'])){
+      return;
+    }
+
+    /* Save remaining attributes */
+    foreach (array('max_lease_time', 'default_lease_time', 'ddns_update_style') as $val){
+      $tval= preg_replace('/_/', '-', $val);
+      if ($_POST[$val] != ""){
+        $this->statements[$tval]= validate(get_post($val));
+      } else {
+        unset ($this->statements[$tval]);
+      }
+    }
+    if (isset($_POST['authoritative'])){
+      $this->statements['authoritative']= "";
+    } else {
+      unset($this->statements['authoritative']);
+    }
+
+    dhcpPlugin::save_object();
+  }
+
+
+  /* Check values */
+  function check()
+  {
+    $message= array();
+
+    if (!is_id($this->statements['default-lease-time'])){
+      $message[]= _('Default lease time needs to be numeric.');
+    }
+    if (!is_id($this->statements['max-lease-time'])){
+      $message[]= _('Maximum lease time needs to be numeric.');
+    }
+    if ($this->statements['default-lease-time'] > $this->statements['max-lease-time']){
+      $message[]= _('Default lease time needs to smaller than the maximum lease time.');
+    }
+
+    /* Check external plugins */
+    $net= $this->network->check();
+    $adv= $this->advanced->check();
+    $message= array_merge($message, $net, $adv);
+
+    return $message;
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    global $config;
+    $this->attrs= array();
+
+    /* Get and set server name */
+    $ldap= $config->get_ldap_link();
+    $ldap->cat($this->dhcpPrimaryDN, array('cn'));
+    $res= $ldap->fetch();
+    $server_name= $res['cn'][0];
+    
+    dhcpPlugin::save();
+
+    $this->attrs['dhcpPrimaryDN']= array($this->dhcpPrimaryDN);
+    $this->removeOption('server-name');
+#    $this->attrs['dhcpOption'][]= "server-name $server_name";
+
+    return ($this->attrs);
+  }
+  
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/services/dhcp/class_dhcpSharedNetwork.inc b/plugins/admin/systems/services/dhcp/class_dhcpSharedNetwork.inc
new file mode 100644 (file)
index 0000000..6e55b75
--- /dev/null
@@ -0,0 +1,188 @@
+<?php
+/*
+  This code is part of GOsa (https://gosa.gonicus.de)
+  Copyright (C) 2003-2007 Cajus Pollmeier
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+class dhcpSharedNetwork extends dhcpPlugin
+{
+  /* attribute list for save action */
+  var $objectclasses= array('top', 'dhcpSharedNetwork');
+
+  function dhcpSharedNetwork($attrs)
+  {
+    dhcpPlugin::dhcpPlugin($attrs);
+
+    $this->advanced->setAutoStatements(array("server-identifier", "default-lease-time",
+          "max-lease-time", "min-lease-time", "authoritative", "deny-unknown-clients",
+          "deny-bootp", "deny-booting"));
+  }
+
+
+  function execute()
+  {
+    $smarty= get_smarty();
+
+    /* Fill template */
+    $smarty->assign ("cn", $this->cn);
+    foreach (array("server-identifier", "default-lease-time", "max-lease-time", "min-lease-time") as $attr){
+      if (isset($this->statements[$attr])){
+        $smarty->assign(preg_replace('/-/', '_', $attr), $this->statements[$attr]);
+      } else {
+        $smarty->assign(preg_replace('/-/', '_', $attr), "");
+      }
+    }
+    if (isset($this->statements["authoritative"])){
+      $smarty->assign("authoritative", "checked");
+    } else {
+      $smarty->assign("authoritative", "");
+    }
+    if (!isset($this->statements["deny unknown-clients"])){
+      $smarty->assign("allow_unknown_state", "checked");
+    } else {
+      $smarty->assign("allow_unknown_state", "");
+    }
+    if (!isset($this->statements["deny bootp"])){
+      $smarty->assign("allow_bootp_state", "checked");
+    } else {
+      $smarty->assign("allow_bootp_state", "");
+    }
+    if (!isset($this->statements["deny booting"])){
+      $smarty->assign("allow_booting_state", "checked");
+    } else {
+      $smarty->assign("allow_booting_state", "");
+    }
+
+    /* Show main page */
+    $display= $smarty->fetch(get_template_path('dhcp_sharedNetwork.tpl', TRUE)).$this->network->execute();
+
+    /* Merge arrays for advanced view */
+    $this->fix_options();
+    foreach (array("options", "statements") as $type){
+      $this->advanced->$type= $this->$type + $this->network->$type;
+    }
+
+    $display.= $this->advanced->execute();
+
+    /* Merge back for removals */
+    foreach (array("options", "statements") as $type){
+      $this->$type= $this->advanced->$type;
+      $this->network->$type= $this->advanced->$type;
+    }
+
+    /* Add footer */
+    $display.= "<div style='width:100%;text-align:right;margin-top:5px;'><input type=submit name='save_dhcp' value='"._("Save")."'>".
+               "&nbsp;<input type=submit name='cancel_dhcp' value='"._("Cancel")."'></div>";
+
+
+    return ($display);
+  }
+
+
+  function remove_from_parent()
+  {
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    if (isset($_POST['cn'])){
+      $this->cn= validate(get_post('cn'));
+      dhcpPlugin::save_object();
+
+      foreach (array("server-identifier", "default-lease-time",
+            "max-lease-time", "min-lease-time") as $attr){
+        if (isset($_POST[$attr]) && $_POST[$attr] != ""){
+          $this->statements[$attr]= get_post($attr);
+        } else {
+          unset($this->statements[$attr]);
+        }
+      }
+
+      if (isset($_POST["authoritative"])){
+        $this->statements["authoritative"]= "";
+      } else {
+        unset ($this->statements["authoritative"]);
+      }
+
+      foreach(array("unknown-clients", "bootp", "booting") as $name){
+        if (isset($_POST[$name])){
+          $this->statements["allow $name"]= "";
+          unset($this->statements["deny $name"]);
+        } else {
+          $this->statements["deny $name"]= "";
+          unset($this->statements["allow $name"]);
+        }
+      }
+    }
+  }
+
+
+  /* Check values */
+  function check()
+  {
+    $message= array();
+
+       $cache = $this->parent->dhcpObjectCache;
+
+    /* All required fields are set? */
+    if ($this->cn == ""){
+      $message[]= _("Required field 'Name' is not filled.");
+    }
+
+    /* Check lease times */
+    foreach (array("default-lease-time" => _("Default lease time"),
+          "max-lease-time" => _("Max. lease time"),
+          "min-lease-time" => _("Min. lease time")) as $key => $val){
+      if (isset($this->statements[$key]) && $this->statements[$key] != "" && 
+          !is_id($this->statements[$key])){
+        $message[]= sprintf(_("The value specified as '%s' is not numeric!"), $val);
+      }
+    }
+
+    /* cn already used? */
+    if ($this->orig_cn != $this->cn || $this->new){
+
+      foreach($cache as $dn => $dummy){
+        if (preg_match("/^cn=".$this->cn.",/", $dn) && count($dummy)){
+          $message[]= _("The name for this host section is already used!");
+          break;
+        }
+      }
+    }
+
+    /* Check external plugins */
+    $net= $this->network->check();
+    $adv= $this->advanced->check();
+    $message= array_merge($message, $net, $adv);
+
+    return $message;
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    dhcpPlugin::save();
+
+    return ($this->attrs);
+  }
+
+}
+
+?>
diff --git a/plugins/admin/systems/services/dhcp/class_dhcpSubnet.inc b/plugins/admin/systems/services/dhcp/class_dhcpSubnet.inc
new file mode 100644 (file)
index 0000000..8c2da41
--- /dev/null
@@ -0,0 +1,200 @@
+<?php
+/*
+  This code is part of GOsa (https://gosa.gonicus.de)
+  Copyright (C) 2003-2007  Cajus Pollmeier
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+class dhcpSubnet extends dhcpPlugin
+{
+  /* Used attributes */
+  var $dhcpNetMask= 24;
+  var $dhcpRange= "";
+  var $range_start= "";
+  var $range_stop= "";
+  var $use_range= FALSE;
+
+  /* attribute list for save action */
+  var $objectclasses= array('top', 'dhcpSubnet', 'dhcpOptions');
+
+  function dhcpSubnet($attrs)
+  {
+    dhcpPlugin::dhcpPlugin($attrs);
+
+    if (!$this->new){
+      /* Load attributes */
+      foreach (array("dhcpNetMask", "dhcpRange") as $attr){
+        if (isset($attrs[$attr][0])){
+          $this->$attr= $attrs[$attr][0];
+        }
+      }
+      if (isset($attrs['dhcpRange']) && count($attrs['dhcpRange'])){
+        $this->use_range= TRUE;
+        list($this->range_start, $this->range_stop)= preg_split('/\s+/', $this->dhcpRange);
+      }
+    }
+
+    $this->dhcpNetMask= normalize_netmask($this->dhcpNetMask);
+  }
+
+
+  function execute()
+  {
+    $smarty= get_smarty();
+    $smarty->assign("cn", $this->cn);
+    $smarty->assign("dhcp_netmask", $this->dhcpNetMask);
+
+    /* Prepare range */
+    if ($this->use_range){
+      $smarty->assign("use_range", "checked");
+      $smarty->assign("range_disabled", "");
+    } else {
+      $smarty->assign("use_range", "");
+      $smarty->assign("range_disabled", "disabled");
+    }
+    $smarty->assign("range_start", $this->range_start);
+    $smarty->assign("range_stop", $this->range_stop);
+
+    /* Show main page */
+    $display= $smarty->fetch(get_template_path('dhcp_subnet.tpl', TRUE)).$this->network->execute();
+
+    /* Merge arrays for advanced view */
+    $this->fix_options();
+    foreach (array("options", "statements") as $type){
+      $this->advanced->$type= $this->$type + $this->network->$type;
+    }
+
+    $display.= $this->advanced->execute();
+
+    /* Merge back for removals */
+    foreach (array("options", "statements") as $type){
+      $this->$type= $this->advanced->$type;
+      $this->network->$type= $this->advanced->$type;
+    }
+
+    /* Add footer */
+    $display.= "<div style='width:100%;text-align:right;margin-top:5px;'><input type=submit name='save_dhcp' value='"._("Save")."'>".
+               "&nbsp;<input type=submit name='cancel_dhcp' value='"._("Cancel")."'></div>";
+
+    /* Show main page */
+    return $display;
+  }
+
+
+  function remove_from_parent()
+  {
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    if(isset($_POST['dhcp_subnet_posted'])){
+      if (isset($_POST['cn'])){
+        $this->cn= validate(get_post('cn'));
+      } 
+      if (isset($_POST['dhcp_netmask'])){
+        $this->dhcpNetMask= validate(get_post('dhcp_netmask'));
+      } 
+      if (isset($_POST['use_range'])){
+        $this->use_range= TRUE;
+        $this->range_start= validate(get_post('range_start'));
+        $this->range_stop= validate(get_post('range_stop'));
+      } else {
+        $this->use_range= FALSE;
+      }
+
+      /* Move range to internal variable */
+      $this->dhcpRange= $this->range_start." ".$this->range_stop;
+      dhcpPlugin::save_object();
+    }
+  }
+
+
+  /* Check values */
+  function check()
+  {
+    $message= array();
+
+    $cache = $this->parent->dhcpObjectCache;
+
+    /* All required fields are set? */
+    if ($this->cn == ""){
+      $message[]= _("Required field 'Network address' is not filled.");
+    }
+    if ($this->dhcpNetMask == ""){
+      $message[]= _("Required field 'Netmask' is not filled.");
+    }
+
+    /* cn already used? */
+    if ($this->orig_cn != $this->cn || $this->new){
+
+      foreach($cache as $dn => $dummy){
+        if (preg_match("/^cn=".$this->cn.",/", $dn) && count($dummy)){
+          $message[]= _("The name for this section is already used!");
+          break;
+        }
+      }
+    }
+
+    /* IP's? */
+    foreach(array('dhcpNetMask' => _("Netmask"), 'cn' => _("Network address"), 'range_start' => _("Range"), 'range_stop' => _("Range")) as $attr => $str){
+      if ($this->$attr != "" && !is_ip($this->$attr)){
+        $message[]= sprintf(_("The field '%s' contains an invalid IP address"), $str);
+      }
+    }
+
+    /* Check ip range */
+    if ($this->use_range){
+      if(!is_ip_range($this->range_start,$this->range_stop)){
+        $message[] = _("Field 'Range' contains invalid IP range.");
+      }
+
+      /* Check if range is in the network */
+      if (!is_in_network($this->cn, $this->dhcpNetMask, $this->range_start) ||
+          !is_in_network($this->cn, $this->dhcpNetMask, $this->range_stop)){
+        $message[] = _("'Range' is not inside the configured network.");
+      }
+    }
+
+    /* Check external plugins */
+    $net= $this->network->check();
+    $adv= $this->advanced->check();
+    $message= array_merge($message, $net, $adv);
+
+    return $message;
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    dhcpPlugin::save();
+
+    /* Move dn to the result */
+    $this->attrs['dhcpNetMask']= array(netmask_to_bits($this->dhcpNetMask));
+    if ($this->use_range && !empty($this->dhcpRange)){
+      $this->attrs['dhcpRange']= array($this->range_start." ".$this->range_stop);
+    } else {
+      $this->attrs['dhcpRange']= array();
+    }
+
+    return ($this->attrs);
+  }
+  
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/services/dhcp/class_servDHCP.inc b/plugins/admin/systems/services/dhcp/class_servDHCP.inc
new file mode 100644 (file)
index 0000000..c804ec2
--- /dev/null
@@ -0,0 +1,739 @@
+<?php
+
+class servdhcp extends goService
+{
+  /* attribute list for save action */
+  var $attributes= array("dhcpServiceDN");
+  var $objectclasses= array("dhcpServer");
+  var $conflicts        = array("servdhcp");
+  var $dhcpServiceDN= "";
+
+  /* Section storage */
+  var $dhcpSections= array();
+  var $dhcpObjectCache= array();
+  var $current_object= "";
+  var $types= array();
+  var $serviceDN= "";
+
+       var $quote_option = array("domain-name");
+
+  var $orig_dn = "";
+
+  var $dhcp_server_list   = array("ENTRIES"=> array(),"FOR_LIST"=> array());
+  var $take_over_id       = -1;
+  var $display_warning  = TRUE;
+
+  function servdhcp (&$config, $dn= NULL, $parent= NULL)
+  {
+    plugin::plugin ($config, $dn, $parent);
+
+    $this->serviceDN = "cn=dhcp,".$dn;
+    $this->orig_dn = $dn;
+
+    $this->DisplayName = _("DHCP service");
+
+    $this->types= array(  "dhcpLog" => _("Logging"),
+            "dhcpService" => _("Global options"),
+            "dhcpClass" => _("Class"),
+            "dhcpSubClass" => _("Subclass"),
+            "dhcpHost" => _("Host"),
+            "dhcpGroup" => _("Group"),
+            "dhcpPool" => _("Pool"),
+            "dhcpSubnet" => _("Subnet"),
+            "dhcpFailOverPeer" => _("Failover peer"),
+            "dhcpSharedNetwork" => _("Shared network"));
+
+
+    /* Backport: PHP4 compatibility  */
+    foreach($this->types as $type => $translation){
+           $this->types[strtolower($type)] = $translation;
+    }
+
+    /* Load information about available services */
+    $this->reload(); 
+    if (!count($this->dhcpSections)){
+      $this->is_account= FALSE;
+      $this->dhcp_server_list = $this->get_list_of_dhcp_servers();
+    }
+  }
+
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+    $smarty->assign("dns_take_over",FALSE);
+    $display= "";
+
+
+    /*****************/
+    /* Handle Take Over Actions 
+    /*****************/
+
+    /* Give smarty the required informations */
+    $smarty->assign("dhcp_server_list", $this->dhcp_server_list['FOR_LIST']);
+    $smarty->assign("dhcp_server_list_cnt", count($this->dhcp_server_list['FOR_LIST']));
+    
+    /* Take over requested, save id */
+    if(isset($_POST['take_over_src']) && isset($_POST['take_over'])){
+      $id = $_POST['take_over_src'];
+      if(isset($this->dhcp_server_list['ENTRIES'][$id])){
+        $this->take_over_id = $id;      
+      }
+    }
+    /* Abort take over action */ 
+    if(isset($_POST['cancel_take_over'])){
+      $this->dialog =false;
+      $this->take_over_id = -1;
+      $this->dhcp_server_list = $this->get_list_of_dhcp_servers();
+    }
+
+    /* Display informartion about take over that will be started when saving this server 
+     *  and hide default dhcp output
+     */
+    if($this->take_over_id != -1){
+
+      $this->dialog = FALSE;
+      $id = $this->take_over_id;
+      $smarty->assign("dns_take_over",TRUE);
+      $warning = sprintf(_("You are going to migrate the DHCP setup from server '%s'."),
+        $this->dhcp_server_list['ENTRIES'][$id]['cn'][0]);
+      $warning.= "&nbsp;"._("The migration will be started when you save this system. To cancel this action, use the cancel button below.");
+
+      if($this->display_warning){
+        print_red($warning);
+        $this->display_warning = FALSE;
+      }
+      return($smarty->fetch(get_template_path('servdhcp.tpl', TRUE)));
+    }
+
+    
+    /*****************/
+    /* List handling  
+    /*****************/
+
+    /* Section Creation? */
+    if (isset($_POST['create_section']) && isset($_POST['section'])){
+      $section= $_POST['section'];
+      $tmp = new dhcpNewSectionDialog(NULL);
+      if (isset($tmp->sectionMap[$section])){
+        $this->dialog= new $section($this->current_object);
+        $this->current_object= "";
+      } else {
+        $this->dialog= FALSE;
+      }
+    }
+
+    /* Cancel section creation? */
+    if (isset($_POST['cancel_section']) || isset($_POST['cancel_dhcp'])){
+      $this->dialog= FALSE;
+    }
+
+    /* Save changes */
+    if (isset($_POST['save_dhcp'])){
+      $this->dialog->save_object();
+      $messages= $this->dialog->check();
+      if (count($messages)){
+        show_errors($messages);
+      } else {
+        $dn= $this->dialog->dn;
+        $class= get_class($this->dialog);
+        $type= $this->types[$class];
+               if(empty($this->serviceDN)){
+                       $indent= substr_count(preg_replace("/".$this->dn."/", '', $dn), ",") -1;
+               }else{
+                       $indent= substr_count(preg_replace("/".$this->serviceDN."/", '', $dn), ",");
+               }
+               $spaces= "";
+               for ($i= 0; $i<$indent; $i++){
+          $spaces.= "&nbsp;&nbsp;&nbsp;&nbsp;";
+        }
+        $data= $this->dialog->save();
+        if ($this->current_object == ""){
+          /* New object */
+          $newsects= array();
+          foreach ($this->dhcpSections as $key => $dsc){
+            $newsects[$key]= $dsc;
+            if ($key == $dn){
+              $spaces.= "&nbsp;&nbsp;&nbsp;&nbsp;";
+              $newsects[$data['dn']]= "$spaces$type '".preg_replace('/^[^=]+=([^,]+),.*$/', '\1', $data['dn'])."'";
+            }
+          }
+          $this->dhcpObjectCache[$data['dn']]= $data;
+          $this->dhcpSections= $newsects;
+        } else {
+          if ($dn != $data['dn']){
+            /* Old object, new name */
+            $this->dhcpObjectCache[$dn]= array();
+            $this->dhcpObjectCache[$data['dn']]= $data;
+
+            /* If we renamed a section, we've to rename a couple of objects, too */
+            foreach ($this->dhcpObjectCache as $key => $dsc){
+              if (preg_match("/,$dn$/", $key)){
+                $new_dn= preg_replace("/,$dn$/", ",".$data['dn'], $key);
+                $dsc['MODIFIED']= TRUE;
+                $this->dhcpObjectCache[$new_dn]= $dsc;
+                unset($this->dhcpObjectCache[$key]);
+              }
+            }
+            $newsects= array();
+            foreach ($this->dhcpSections as $key => $dsc){
+              if ($key == $dn){
+                $newsects[$data['dn']]= "$spaces$type '".preg_replace('/^[^=]+=([^,]+),.*$/', '\1', $data['dn'])."'";
+                continue;
+              }
+              if (preg_match("/,$dn$/", $key)){
+                $new_dn= preg_replace("/,$dn$/", ",".$data['dn'], $key);
+                $newsects[$new_dn]= $dsc;
+              } else {
+                $newsects[$key]= $dsc;
+              }
+            }
+            $this->dhcpSections= $newsects;
+
+          } else {
+            /* Old object, old name */
+            $this->dhcpObjectCache[$data['dn']]= $data;
+          }
+        }
+        $this->dialog= FALSE;
+      }
+    }
+
+    /* Remove section? */
+    if (isset($_POST['delete_dhcp_confirm'])){
+      if ($this->acl_is_removeable()){
+        unset($this->dhcpSections[$this->current_object]);
+        unset($this->dhcpObjectCache[$this->current_object]);
+        $this->dhcpObjectCache[$this->current_object]= array();
+        foreach ($this->dhcpSections as $key => $value){
+          if (preg_match("/".$this->current_object."$/", $key)){
+            unset($this->dhcpSections[$key]);
+            unset($this->dhcpObjectCache[$key]);
+            $this->dhcpObjectCache[$key]= array();
+          }
+        }
+      } else {
+        print_red(_("You're not allowed to remove DHCP sections!"));
+      }
+      $this->dialog= FALSE;
+    }
+
+    /* Look for post entries */
+    foreach($_POST as $name => $value){
+      
+      /* Insert new section? */
+      if (preg_match('/^insertDhcp_.*_x$/', $name)){
+        $dn= base64_decode(preg_replace('/^insertDhcp_([^_]+)_x$/', '\1', $name));
+        if (isset($this->dhcpObjectCache[$dn])){
+          $this->dialog= new dhcpNewSectionDialog($this->objectType($dn));
+          $this->current_object= $dn;
+          $this->dialog->acl= $this->acl;
+        }
+      }
+
+      /* Edit section? */
+      if (preg_match('/^editDhcp_.*_x$/', $name)){
+        $dn= base64_decode(preg_replace('/^editDhcp_([^_]+)_x$/', '\1', $name));
+        if (isset($this->dhcpObjectCache[$dn])){
+          $section= $this->objectType($dn);
+          $this->current_object= $dn;
+          $this->dialog= new $section($this->dhcpObjectCache[$dn]);
+        }
+      }
+
+      /* Remove section? */
+      if (preg_match('/^delDhcp_.*_x$/', $name)){
+        $dn= base64_decode(preg_replace('/^delDhcp_([^_]+)_x$/', '\1', $name));
+        if (isset($this->dhcpObjectCache[$dn])){
+          $this->current_object= $dn;
+          $this->dialog= 1;
+          $smarty->assign("warning", sprintf(_("You're about to delete the DHCP section '%s'."), $dn));
+          return($smarty->fetch(get_template_path('remove_dhcp.tpl', TRUE)));
+        }
+      }
+
+    }
+
+    if(isset($_GET['act']) && $_GET['act']=="edit" && isset($_GET['id'])){
+      $dn = base64_decode($_GET['id']);
+      if (isset($this->dhcpObjectCache[$dn])){
+        $section= $this->objectType($dn);
+        $this->current_object= $dn;
+        $this->dialog= new $section($this->dhcpObjectCache[$dn]);
+      }
+    }
+    
+
+    if(isset($_GET['act']) && $_GET['act']=="edit" && isset($_GET['id'])){
+      $dn = base64_decode($_GET['id']);
+      if (isset($this->dhcpObjectCache[$dn])){
+        $section= $this->objectType($dn);
+        $this->current_object= $dn;
+        $this->dialog= new $section($this->dhcpObjectCache[$dn]);
+      }
+    }
+    
+
+    /* Do we need to flip is_account state? */
+    if (isset($_POST['modify_state'])){
+      $this->is_account= !$this->is_account;
+    }
+
+    /* Show tab dialog headers */
+    if ($this->is_account){
+#      $display= $this->show_header(_("Remove DHCP service"),
+#          _("This server has DHCP features enabled. You can disable them by clicking below."));
+
+      if (!count($this->dhcpObjectCache)){
+        $attrs= array();
+        $attrs['dn']= 'cn=dhcp,'.$this->dn;
+        $attrs['cn']= array('dhcp');
+        $attrs['objectClass']= array('top', 'dhcpService');
+        $attrs['dhcpPrimaryDN']= array($this->dn);
+        $attrs['dhcpStatements']= array("default-lease-time 600",
+                                        "max-lease-time 1200",
+                                        "authoritative",
+                                        "ddns-update-style none");
+        $attrs['MODIFIED']= TRUE;
+        $this->dhcpSections['cn=dhcp,'.$this->dn]= _("Global options");
+        $this->dhcpObjectCache['cn=dhcp,'.$this->dn]= $attrs;
+      }
+
+    } else {
+#      $display= $this->show_header(_("Add DHCP service"),
+
+#          _("This server has DHCP features disabled. You can enable them by clicking below."));
+      return ($display);
+    }
+
+
+    /* Show dialog
+     */
+    if(isset($this->dialog) && is_object($this->dialog)){
+      $this->dialog->save_object();
+      $this->dialog->parent = $this;
+      return($this->dialog->execute());
+    }
+
+    /* Create Listbox with existing Zones
+     */
+    $DhcpList = new divSelectBox("dhcpSections");
+    $DhcpList->SetHeight(400);
+
+    /* Add entries to divlist
+     */
+    $editImgIns = "<input type='image' src='images/list_new.png' name='insertDhcp_%s' title='"._("Insert new DHCP section")."'>".
+      "<input type='image' src='images/edit.png' name='editDhcp_%s' title='"._("Edit DHCP section")."'>".
+      "<input type='image' src='images/edittrash.png' name='delDhcp_%s' title='"._("Remove DHCP section")."'>";
+    $editImgInsNoDel = "<input type='image' src='images/list_new.png' name='insertDhcp_%s' title='"._("Insert new DHCP section")."'>".
+      "<input type='image' src='images/edit.png' name='editDhcp_%s' title='"._("Edit DHCP section")."'>";
+    $editImg = "<input type='image' src='images/edit.png' name='editDhcp_%s' title='"._("Edit DHCP section")."'>".
+      "<input type='image' src='images/edittrash.png' name='delDhcp_%s' title='"._("Remove DHCP section")."'>";
+       
+    $tmp = new dhcpNewSectionDialog(NULL);
+    foreach($this->dhcpSections as $section => $values ){
+    
+      $values = "<a href='?plug=".$_GET['plug']."&act=edit&id=".base64_encode($section)."'>".$values."</a>";
+       
+      if (count($tmp->sectionMap[$this->objectType($section)])){
+        if ($this->objectType($section) == "dhcpService"){
+          $DhcpList->AddEntry(array(
+              array("string" => $values),
+              array("string" => str_replace("%s",base64_encode($section),$editImgInsNoDel), "attach" => "style='text-align:right;'")
+              ));
+        } else {
+          $DhcpList->AddEntry(array(
+              array("string" => $values),
+              array("string" => str_replace("%s",base64_encode($section),$editImgIns), "attach" => "style='text-align:right;'")
+              ));
+        }
+      } else {
+        $DhcpList->AddEntry(array(
+              array("string" => $values),
+              array("string" => str_replace("%s",base64_encode($section),$editImg), "attach" => "style='text-align:right;'")
+              ));
+      }
+    }
+
+    /* Display tempalte */
+    $smarty->assign("DhcpList",$DhcpList->DrawList());
+    $display.= $smarty->fetch(get_template_path('servdhcp.tpl', TRUE));
+    return($display);
+  }
+
+
+  function remove_from_parent()
+  {
+    /* Cancel if there's nothing to do here */
+    if (!$this->initially_was_account){
+      return;
+    }
+
+    /* Remove subtrees */
+    $ldap= $this->config->get_ldap_link();
+    foreach ($this->dhcpObjectCache as $dn => $content){
+      if ($this->objectType($dn) == 'dhcpService'){
+        $ldap->rmdir_recursive($dn);
+        show_ldap_error($ldap->get_error(), _("Removing DHCP entries failed"));
+      }
+    }
+
+    /* Remove from self */
+    $ldap= $this->config->get_ldap_link();
+
+    /* Remove and write to LDAP */
+    plugin::remove_from_parent();
+    
+    @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->attributes, "Save");
+    $ldap->cd($this->dn);
+    $this->cleanup();
+    $ldap->modify ($this->attrs);
+
+    show_ldap_error($ldap->get_error(), _("Removing DHCP entries failed"));
+
+    /* Optionally execute a command after we're done */
+    $this->handle_post_events("remove");
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    plugin::save_object();
+  }
+
+
+  /* Check supplied data */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+    
+    return ($message);
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    /* Take over handling 
+     * - Load servdhcp class and dhcpObjectCache for the source dhcp setup.
+     * - Assign dhcpObjectCache to this configuration. 
+     * - Save this setup and remove source setup from ldap.
+     */
+    if($this->take_over_id != -1){
+      $id = $this->take_over_id;
+      $src = preg_replace("/cn=dhcp,/","",$this->dhcp_server_list['ENTRIES'][$id]['dn']);
+      $tmp = new servdhcp ($this->config, $src);
+      $this->orig_dn = $src;
+      $this->dhcpObjectCache =  $tmp->dhcpObjectCache;
+    }
+
+    /* Save dhcp setttings */
+    $ldap= $this->config->get_ldap_link();
+    foreach ($this->dhcpObjectCache as $dn => $data){
+
+      if($this->dn != $this->orig_dn){
+        $dn = preg_replace("/".normalizePreg($this->orig_dn)."$/i",$this->dn,$dn);
+      }
+
+      /* Remove entry? */
+      if (count($data) == 0){
+        /* Check if exists, then remove... */
+        if($ldap->cat($dn)){
+          $ldap->rmdir_recursive($dn);
+          show_ldap_error($ldap->get_error(), _("Can't remove DHCP object!"));
+        }
+        continue;
+      }
+
+      /* Opdate dhcp option 'server-name' to actual server name */
+      if($this->dn != $this->orig_dn){
+        $fixed = FALSE;
+        foreach(array("dhcpHost","dhcpSubnet","dhcpGroup","dhcpSharedNetwork") as $object){
+          if(in_array($object,$data['objectClass']) && isset($data['dhcpOption'])){
+            foreach($data['dhcpOption'] as $key => $option){
+              if(preg_match("/^server-name /",$option)){
+                $data['dhcpOption'][$key] = "server-name ".$this->cn;
+                $data['MODIFIED'] = TRUE; 
+                break;
+              }
+            }
+          }
+
+          /* Skip next loops if entry is updated */
+          if($fixed){
+            break;
+          }
+        }
+      }
+
+      /* Modify existing entry? */
+      if (isset($data['MODIFIED']) || $this->orig_dn != $this->dn){
+
+        if($ldap->cat($dn)){
+          $modify= TRUE;
+        } else {
+          $modify= FALSE;
+        }
+
+        /* Build new entry */
+        $attrs= array();
+        foreach ($data as $attribute => $values){
+          if ($attribute == "MODIFIED" || $attribute == "dn"){
+            continue;
+          }
+      
+          if(in_array($attribute,array("dhcpPrimaryDN","dhcpSecondaryDN","dhcpServerDN","dhcpFailOverPeerDN"))){
+            foreach($values as $v_key => $value){
+              $values[$v_key] = preg_replace("/".normalizePreg($this->orig_dn)."$/i",$this->dn,$value);
+            }
+          }
+
+          if (count($values)){
+
+            if($attribute == "dhcpOption"){
+              foreach($values as $key => $value){
+                $option_name = trim(preg_replace("/[^ ]*$/","",$value));
+                $option_value= trim(preg_replace("/^[^ ]*/","",$value));
+                if(in_array($option_name,$this->quote_option)){
+                  $values[$key] = $option_name." \"".$option_value."\"";
+                }
+              }
+            }
+            if (count($values) == 1){
+              $attrs[$attribute]= $values[0];
+            } else {
+              $attrs[$attribute]= $values;
+            }
+          } else {
+            if ($modify){
+              $attrs[$attribute]= array();
+            }
+          }
+        }
+
+        $ldap->cd($dn);
+        if ($modify){
+          $ldap->modify($attrs);
+          show_ldap_error($ldap->get_error(), _("Can't save DHCP object!"));
+
+          /* Optionally execute a command after we're done */
+          $this->handle_post_events("modify");
+        } else {
+          $ldap->add($attrs);
+          show_ldap_error($ldap->get_error(), _("Can't save DHCP object!"));
+
+          /* Optionally execute a command after we're done */
+          $this->handle_post_events("create");
+        }
+      }
+    }
+
+    $this->dhcpServiceDN= $this->serviceDN;
+    if($this->dn != $this->orig_dn){
+      $this->dhcpServiceDN= preg_replace("/".normalizePreg($this->orig_dn)."$/i",$this->dn,$this->dhcpServiceDN);
+    }
+
+    /* Replace 'new' dn */ 
+    if(preg_match("/new$/",$this->dhcpServiceDN)){
+      $this->dhcpServiceDN = preg_replace("/new$/",$this->dn,$this->dhcpServiceDN);
+    }
+
+    plugin::save();
+    
+    /* Save data to LDAP */
+    $ldap->cd($this->dn);
+    $this->cleanup();
+    $ldap->modify ($this->attrs);
+
+    show_ldap_error($ldap->get_error(), _("Saving DHCP service failed"));
+
+    /* Optionally execute a command after we're done */
+    if ($this->initially_was_account == $this->is_account){
+      if ($this->is_modified){
+        $this->handle_post_events("modify");
+      }
+    } else {
+      $this->handle_post_events("add");
+    }
+
+    /* Take over handling
+     * - Remove old dhcp config from source server 
+     */
+    if($this->take_over_id != -1){
+      $id = $this->take_over_id;
+      $src = $this->dhcp_server_list['ENTRIES'][$id]['dn'];
+      $tmp = new servdhcp ($this->config, $src);
+      $tmp->remove_from_parent();
+    }
+  }
+
+
+  function reload()
+  {
+    /* Init LDAP and load list */
+    $ldap= $this->config->get_ldap_link();
+    $ui= get_userinfo();
+    $me= $this->dn;
+
+    $filter = "(&(objectClass=dhcpService)(|(dhcpPrimaryDN=$me)(dhcpSecondaryDN=$me)(dhcpServerDN=$me)(dhcpFailOverPeerDN=$me)))";
+
+    $list= get_list($filter, array("server"), $this->config->current['BASE'], array("cn"),GL_SIZELIMIT | GL_SUBSEARCH);
+    $final= array();
+
+    foreach ($list as $value){
+
+      /* Set header */
+      $sortpart= split(",", $value['dn']);
+      $sortpart= array_reverse($sortpart);
+      $tmp= implode(",", $sortpart);
+
+      $final[$value['dn']]= $tmp."!"._("Global options");
+
+      /* Read all sub entries to place here */
+      $ldap->cd($value['dn']);
+      $ldap->search("(|(objectClass=dhcpService)(objectClass=dhcpLog)(objectClass=dhcpClass)(objectClass=dhcpSubClass)(objectClass=dhcpHost)(objectClass=dhcpGroup)(objectClass=dhcpPool)(objectClass=dhcpSubnet)(objectClass=dhcpSharedNetwork)(objectClass=dhcpOptions)(objectClass=dhcpTSigKey)(objectClass=dhcpDnsZone)(objectClass=dhcpFailOverPeer))", array());
+      $this->serviceDN= $value['dn'];
+
+      while ($attrs= $ldap->fetch()){
+        $sattrs= array();
+        for ($i= 0; $i<$attrs['count']; $i++){
+          $sattrs[$attrs[$i]]= $attrs[$attrs[$i]];
+          unset($sattrs[$attrs[$i]]['count']);
+        }
+        $sattrs['dn']= $ldap->getDN();
+
+        foreach($sattrs as $name => $values){
+          if($name == "dhcpOption"){
+            foreach($values as $key => $value){
+              $value_name = trim(preg_replace("/[^ ]*$/","",$value));
+              $value_value= trim(preg_replace("/^[^ ]*/","",$value));
+              if(in_array($value_name,$this->quote_option)){
+                $value_value = preg_replace("/^\"/","",$value_value);
+                $value_value = preg_replace("/\"$/","",$value_value);
+                $sattrs[$name][$key] = $value_name." ".$value_value;
+              }
+            }
+          }
+        }
+
+        $this->dhcpObjectCache[$ldap->getDN()]= $sattrs;
+        $tmp= preg_replace("/".$this->serviceDN."/", "", $ldap->getDN());
+        $indent= substr_count($tmp, ",");
+        $spaces= "";
+        for ($i= 0; $i<$indent; $i++){
+          $spaces.= "&nbsp;&nbsp;&nbsp;&nbsp;";
+        }
+
+        foreach ($this->types as $key => $val){
+          if (in_array("$key", $attrs['objectClass'])){
+            $type= $val;
+            break;
+          }
+        }
+
+        /* Prepare for sorting... */
+        $sortpart= split(",", $ldap->getDN());
+        $sortpart= array_reverse($sortpart);
+        $tmp= implode(",", $sortpart);
+        $final[$ldap->getDN()]= $tmp."!".$spaces.$type." '".$attrs['cn'][0]."'";
+      }
+    }
+
+    /* Sort it... */
+    natsort($final);
+    $this->dhcpSections= array();
+    foreach ($final as $key => $val){
+      $this->dhcpSections[$key]= preg_replace('/^[^!]+!(.*)$/', '\\1', $val);
+    }
+
+  }
+
+
+  function objectType($dn)
+  {
+    $type= "";
+    $types= array("dhcpService", "dhcpClass", "dhcpSubClass", "dhcpHost",
+                  "dhcpGroup", "dhcpPool", "dhcpSubnet", "dhcpSharedNetwork");
+
+    foreach ($this->dhcpObjectCache[$dn]['objectClass'] as $oc){
+      if (in_array($oc, $types)){
+        $type= $oc;
+        break;
+      }
+    }
+
+    /* That should not happen... */
+    if ($type == ""){
+      print_red(_("DHCP configuration set is unknown. Please contact your system administrator."));
+    }
+    
+    return ($type);
+  }
+
+
+  /* Return plugin informations for acl handling */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("DHCP service"),
+          "plDescription" => _("DHCP service")." ("._("Services").")",
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 84,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("server"),
+
+          "plProvidedAcls"=> array(
+            
+          )     
+    ));
+  }
+
+
+  function take_over_service()
+  {
+
+  }
+
+
+  function get_list_of_dhcp_servers()
+  {
+    $ret = array("ENTRIES"=> array(),"FOR_LIST"=> array());
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(&(objectClass=goServer)(dhcpServiceDN=*))",array("dn","cn","dhcpServiceDN"));
+    while($attrs = $ldap->fetch()){
+
+      /* Skip own config */
+      if($this->dn != "new" && preg_match("/".normalizePreg($this->dn)."$/",$attrs['dn'])){
+        continue;
+      }
+
+      $ret['ENTRIES'][] = $attrs;
+    }
+    foreach($ret['ENTRIES'] as $key => $data){
+      $ret['FOR_LIST'][$key] = $data['cn'][0];
+    }
+    return($ret);
+  }
+
+
+  function getListEntry()
+  {
+    $fields               = goService::getListEntry();
+    $fields['Message']    = _("DHCP service");
+    $fields['AllowEdit']  = true;
+    return($fields);
+  }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/services/dhcp/dhcpNewSection.tpl b/plugins/admin/systems/services/dhcp/dhcpNewSection.tpl
new file mode 100644 (file)
index 0000000..517c3b4
--- /dev/null
@@ -0,0 +1,25 @@
+<div style="font-size: 18px;">
+       {t}Create new DHCP section{/t}
+</div>
+<br>
+<p class="seperator">
+<b>{t}Please choose one of the following DHCP section types.{/t}</b>
+</p>
+<br>
+{t}Section{/t}&nbsp;
+<select size="1" id="section" name="section" title="{t}Choose section type to create{/t}">
+  {html_options options=$sections}
+</select>
+
+<p class="plugbottom">
+  <input type=submit name="create_section" value="{t}Create{/t}">
+  &nbsp;
+  <input type=submit name="cancel_section" value="{t}Cancel{/t}">
+</p>
+       
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+       <!--
+       focus_field('section');
+       -->
+</script>
diff --git a/plugins/admin/systems/services/dhcp/dhcp_advanced.tpl b/plugins/admin/systems/services/dhcp/dhcp_advanced.tpl
new file mode 100644 (file)
index 0000000..5ce0e46
--- /dev/null
@@ -0,0 +1,46 @@
+{* GOsa dhcp sharedNetwork - smarty template *}
+
+<p class='seperator'></p>
+<br>
+
+{if $show_advanced}
+
+<input type='submit' name='hide_advanced' value='{t}Hide advanced settings{/t}'>
+
+<table width="100%">
+ <tr>
+
+  <td width="50%">
+   <br>
+   <b>{t}DHCP statements{/t}</b>
+   <br>
+   <select name='dhcpstatements' style="width:100%;" size="14">
+    {html_options values=$dhcpstatements output=$dhcpstatements}
+   </select>
+   <br>
+   <input type='text' name='addstatement' size='25' maxlength='80'>&nbsp;
+   <input type='submit' name='add_statement' value='{t}Add{/t}'>&nbsp;
+   <input type='submit' name='delete_statement' value='{t}Delete{/t}'> 
+  </td>
+
+  <td>
+   <br>
+   <b>{t}DHCP options{/t}</b>
+   <br>
+   <select name='dhcpoptions' style="width:100%;" size="14">
+    {html_options values=$dhcpoptions output=$dhcpoptions}
+   </select>
+   <br>
+   <input type='text' name='addoption' size='25' maxlength='80'>&nbsp;
+   <input type='submit' name='add_option' value='{t}Add{/t}'>&nbsp;
+   <input type='submit' name='delete_option' value='{t}Delete{/t}'> 
+  </td>
+ </tr>
+</table>
+
+{else}
+
+<input type='submit' name='show_advanced' value='{t}Show advanced settings{/t}'>
+
+{/if}
+<p class='seperator'>&nbsp;</p>
diff --git a/plugins/admin/systems/services/dhcp/dhcp_group.tpl b/plugins/admin/systems/services/dhcp/dhcp_group.tpl
new file mode 100644 (file)
index 0000000..930fc05
--- /dev/null
@@ -0,0 +1,22 @@
+{* GOsa dhcp sharedNetwork - smarty template *}
+<p><b>{t}Generic{/t}</b></p>
+<table>
+ <tr>
+  <td>
+   {t}Name{/t}{$must}
+  </td> 
+  <td>
+   <input id='cn' type='text' name='cn' size='25' maxlength='80' value='{$cn}'
+        title='{t}Name of group{/t}'>
+  </td>
+ </tr>
+</table>
+
+<p class="seperator">&nbsp;</p>
+
+<!-- Place cursor in correct field -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+        focus_field('cn');
+  -->
+</script>
diff --git a/plugins/admin/systems/services/dhcp/dhcp_host.tpl b/plugins/admin/systems/services/dhcp/dhcp_host.tpl
new file mode 100644 (file)
index 0000000..602c512
--- /dev/null
@@ -0,0 +1,52 @@
+{* GOsa dhcp host - smarty template *}
+<p><b>{t}Generic{/t}</b></p>
+<table width="100%">
+ <tr>
+  <td width="50%" style="vertical-align:top">
+   <table>
+    <tr>
+     <td>{t}Name{/t}{$must}</td>
+     <td>
+      <input {if $realGosaHost} disabled {/if} id='cn' type='text' name='cn' size='25' maxlength='80' value='{$cn}'
+             title='{t}Name of host{/t}'>
+     </td>
+    </tr>
+    <tr>
+     <td>{t}Fixed address{/t}</td>
+     <td>
+      <input {if $realGosaHost} disabled {/if} 
+                       type='text' name='fixedaddr' size='25' maxlength='80' value='{$fixedaddr}'
+             title='{t}Use hostname or IP-address to assign fixed address{/t}'>
+     </td>
+    </tr>
+   </table>
+  </td>
+  <td>
+   <table>
+    <tr>
+     <td>{t}Hardware type{/t}</td>
+     <td>
+      <select name='hwtype'  {if $realGosaHost} disabled {/if} >
+       {html_options options=$hwtypes selected=$hwtype}
+      </select>
+     </td>
+    </tr>
+    <tr>
+     <td>{t}Hardware address{/t}{$must}</td>
+     <td>
+      <input  {if $realGosaHost}  disabled {/if} type='text' name='dhcpHWAddress' size='20' maxlength='18' value='{$dhcpHWAddress}'>
+     </td>
+    </tr>
+   </table>
+  </td>
+ </tr>
+</table>
+<input type='hidden' name='dhcp_host_posted' value='1'>
+<p class="seperator"></p>
+
+<!-- Place cursor in correct field -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+        focus_field('cn');
+  -->
+</script>
diff --git a/plugins/admin/systems/services/dhcp/dhcp_network.tpl b/plugins/admin/systems/services/dhcp/dhcp_network.tpl
new file mode 100644 (file)
index 0000000..5645a63
--- /dev/null
@@ -0,0 +1,90 @@
+{* GOsa dhcp sharedNetwork - smarty template *}
+<table width="100%">
+ <tr>
+  <td width="50%" style="vertical-align:top">
+   <p><b>{t}Network configuration{/t}</b></p>
+   <table>
+    <tr>
+     <td>{t}Router{/t}</td>
+     <td>
+      <input id='routers' type='text' name='routers' size='25' maxlength='80' value='{$routers}'
+              title='{t}Enter name or IP address of router to be used in this section{/t}'>
+     </td>
+    </tr>
+    <tr>
+     <td>{t}Netmask{/t}</td>
+     <td>
+      <input type='text' name='subnet_mask' size='18' maxlength='15' value='{$subnet_mask}'>
+     </td>
+    </tr>
+    <tr>
+     <td>{t}Broadcast{/t}</td>
+     <td>
+      <input type='text' name='broadcast_address' size='18' maxlength='15' value='{$broadcast_address}'>
+     </td>
+    </tr>
+   </table>
+   <br>
+   <br>
+   <p><b>{t}Bootup{/t}</b></p>
+   <table>
+    <tr>
+     <td>{t}Filename{/t}</td>
+     <td>
+      <input type='text' name='filename' size='25' maxlength='80' value='{$filename}'
+              title='{t}Enter name of file that will be loaded via tftp after client has started{/t}'>
+     </td>
+    </tr>
+    <tr>
+     <td>{t}Next server{/t}</td>
+     <td>
+      <input type='text' name='nextserver' size='25' maxlength='80' value='{$nextserver}'
+              title='{t}Enter name of server to retrieve bootimages from{/t}'>
+     </td>
+    </tr>
+   </table>
+  
+  </td>
+  <td style="vertical-align:top">
+   <p><b>{t}Domain Name Service{/t}</b></p>
+   <table>
+    <tr>
+     <td>{t}Domain{/t}</td>
+     <td>
+      <input type='text' name='domain' size='25' maxlength='80' value='{$domain}'
+              title='{t}Name of domain{/t}'>
+     </td>
+    </tr>
+    <tr>
+     <td colspan=2>
+      <br>
+      {t}DNS server{/t}<br>
+      <select name='dnsserver'  title='{t}List of DNS servers to be propagated{/t}' style="width:350px;" size="4">
+       {html_options options=$dnsservers}
+      </select>
+      <br>
+      <input type='text' name='addserver' size='25' maxlength='80' title='{t}DNS server do be added{/t}'>&nbsp;
+      <input type='submit' name='add_dns' value='{t}Add{/t}' title='{t}Click here add the selected server to the list{/t}'>
+      <input type='submit' name='delete_dns' value='{t}Delete{/t}' title='{t}Click here remove the selected servers from the list{/t}'>
+     </td>
+    </tr>
+    <tr>
+     <td colspan=2>
+      <p><b>{t}Domain Name Service options{/t}</b></p>
+      <input type=checkbox name="autohost" value="1" {$autohost}>{t}Assign hostnames found via reverse mapping{/t}
+      <br>
+      <input type=checkbox name="autohostdecl" value="1" {$autohostdecl}>{t}Assign hostnames from host declarations{/t}
+     </td>
+    </tr>
+   </table>
+  
+  </td>
+ </tr>
+</table>
+<!-- Place cursor in correct field -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+     focus_field('cn','routers');
+  -->
+</script>
+
diff --git a/plugins/admin/systems/services/dhcp/dhcp_pool.tpl b/plugins/admin/systems/services/dhcp/dhcp_pool.tpl
new file mode 100644 (file)
index 0000000..dcbd05c
--- /dev/null
@@ -0,0 +1,26 @@
+{* GOsa dhcp sharedNetwork - smarty template *}
+<p><b>{t}Generic{/t}</b></p>
+<table width="100%">
+ <tr>
+  <td width="50%">
+   {t}Name{/t}{$must}&nbsp;
+   <input id='cn' type='text' name='cn' size='25' maxlength='80' value='{$cn}'
+        title='{t}Name of pool{/t}'>
+  </td>
+  <td>
+   {t}Range{/t}{$must}&nbsp;
+   <input type='text' name='range_start' size='25' maxlength='30' value='{$range_start}'>
+   &nbsp;-&nbsp;
+   <input type='text' name='range_stop' size='25' maxlength='30' value='{$range_stop}'>
+  </td>
+ </tr>
+</table>
+
+<p class="seperator">&nbsp;</p>
+
+<!-- Place cursor in correct field -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+  document.mainform.cn.focus();
+  -->
+</script>
diff --git a/plugins/admin/systems/services/dhcp/dhcp_service.tpl b/plugins/admin/systems/services/dhcp/dhcp_service.tpl
new file mode 100644 (file)
index 0000000..6ca515e
--- /dev/null
@@ -0,0 +1,43 @@
+<p><b>{t}Generic{/t}</b></p>
+
+<table width="100%">
+ <tr>
+  <td width="50%">
+  <input id='authoritative' type=checkbox name="authoritative" value="1" {$authoritative}> {t}Authoritative service{/t}<br>
+  <br>
+  {t}Dynamic DNS update{/t} 
+  <select name='ddns_update_style'  title='{t}Dynamic DNS update style{/t}' size="1">
+       {html_options values=$ddns_styles output=$ddns_styles selected=$ddns_update_style}
+  </select>
+  </td>
+
+  <td style='vertical-align:top'>
+
+   <table>
+    <tr>
+      <td>{t}Default lease time (s){/t}</td>
+      <td>
+      <input type='text' name='default_lease_time' size='25' maxlength='80' value='{$default_lease_time}' title='{t}Enter default lease time in seconds.{/t}'>
+      </td>
+    </tr>
+    <tr>
+      <td>{t}Maximum lease time (s){/t}</td>
+      <td>
+      <input type='text' name='max_lease_time' size='25' maxlength='80' value='{$max_lease_time}' title='{t}Enter maximum lease time in seconds.{/t}'>
+      </td>
+    </tr>
+   </table>
+
+  </td>
+
+ </tr>
+</table>
+
+<p class="seperator"></p>
+
+<!-- Place cursor in correct field -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('authoritative');
+  -->
+</script>
diff --git a/plugins/admin/systems/services/dhcp/dhcp_sharedNetwork.tpl b/plugins/admin/systems/services/dhcp/dhcp_sharedNetwork.tpl
new file mode 100644 (file)
index 0000000..374da35
--- /dev/null
@@ -0,0 +1,107 @@
+{* GOsa dhcp sharedNetwork - smarty template *}
+<p><b>{t}Generic{/t}</b></p>
+<table width="100%" border="0">
+ <tr>
+
+  <td width="50%">
+
+   <table>
+    <tr>
+     <td>{t}Name{/t}{$must}</td>
+     <td>
+      <input id='cn' type='text' name='cn' size='25' maxlength='80' value='{$cn}' title='{t}Name for shared network{/t}'>
+     </td>
+    </tr>
+    <tr>
+     <td>{t}Server identifier{/t}</td>
+     <td>
+      <input type='text' name='server-identifier' size='25' maxlength='80' value='{$server_identifier}'
+       title='{t}Propagated server identifier for this shared network{/t}'>
+     </td>
+    </tr>
+   </table>
+  
+  </td>
+  
+  <td style="vertical-align:top;">
+   <table>
+    <tr>
+     <td>
+      <input type=checkbox name="authoritative" value="1" {$authoritative}
+       title="{t}Select if this server is authoritative for this shared network{/t}">{t}Authoritative server{/t}
+     </td>
+    </tr>
+   </table>
+  </td>
+  
+ </tr>
+</table>
+
+<p class="seperator">&nbsp;</p>
+
+<table width="100%">
+ <tr>
+  <td width="50%">
+  
+  <p><b>{t}Leases{/t}</b></p>
+   <table>
+    <tr>
+     <td>{t}Default lease time{/t}</td>
+     <td>
+      <input type='text' name='default-lease-time' size='10' maxlength='25' value='{$default_lease_time}'
+        title='{t}Default lease time{/t}'>&nbsp;{t}seconds{/t}
+     </td>
+    </tr>
+    <tr>
+     <td>{t}Max. lease time{/t}</td>
+     <td>
+      <input type='text' name='max-lease-time' size='10' maxlength='25' value='{$max_lease_time}'
+        title='{t}Maximum lease time{/t}'>&nbsp;{t}seconds{/t}
+     </td>
+    </tr>
+    <tr>
+     <td>{t}Min. lease time{/t}</td>
+     <td>
+      <input type='text' name='min-lease-time' size='10' maxlength='25' value='{$min_lease_time}'
+        title='{t}Minimum lease time{/t}'>&nbsp;{t}seconds{/t}
+     </td>
+    </tr>
+   </table>
+   
+  </td>
+
+  <td style="vertical-align:top">
+   <p><b>{t}Access control{/t}</b></p>
+   <table>
+    <tr>
+     <td>
+     <input type=checkbox name="unknown-clients" value="1" {$allow_unknown_state}
+        title="{t}Select if unknown clients should get dynamic IP addresses{/t}">{t}Allow unknown clients{/t}
+     </td>
+    </tr>
+    <tr>
+     <td>
+     <input type=checkbox name="bootp" value="1" {$allow_bootp_state}
+        title="{t}Select if bootp clients should get dynamic IP addresses{/t}">{t}Allow bootp clients{/t}
+     </td>
+    </tr>
+    <tr>
+     <td>
+     <input type=checkbox name="booting" value="1" {$allow_booting_state}
+        title="{t}Select if clients are allowed to boot using this DHCP server{/t}">{t}Allow booting{/t}
+     </td>
+    </tr>
+   </table>
+  </td>
+  
+ </tr> 
+</table>
+
+<p class="seperator">&nbsp;</p>
+
+<!-- Place cursor in correct field -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+  document.mainform.cn.focus();
+  -->
+</script>
diff --git a/plugins/admin/systems/services/dhcp/dhcp_subnet.tpl b/plugins/admin/systems/services/dhcp/dhcp_subnet.tpl
new file mode 100644 (file)
index 0000000..05425fb
--- /dev/null
@@ -0,0 +1,41 @@
+{* GOsa dhcp subnet - smarty template *}
+<p><b>{t}Generic{/t}</b></p>
+<table width="100%">
+ <tr>
+  <td width="50%">
+   <table>
+    <tr>
+     <td>{t}Network address{/t}{$must}</td>
+     <td><input id='cn' type='text' name='cn' size='25' maxlength='80' value='{$cn}'></td>
+    </tr>
+    <tr>
+     <td>{t}Netmask{/t}{$must}</td>
+     <td><input type='text' name='dhcp_netmask' size='25' maxlength='80' value='{$dhcp_netmask}'></tr>
+   </table>
+  </td>
+  <td style='vertical-align:top'>
+   <table>
+    <tr>
+     <td><input type="checkbox" name="use_range" value="1" onChange="changeState('range_start');changeState('range_stop');" {$use_range}></td>
+     <td>{t}Range for dynamic address assignment{/t}</td>
+  </tr>
+  <tr>
+  <td>&nbsp;</td>
+  <td><input type='text' id='range_start' name='range_start' size='25' maxlength='80' value='{$range_start}' {$range_disabled}>
+  &nbsp;<b>-</b>&nbsp;
+  <input type='text' id='range_stop' name='range_stop' size='25' maxlength='80' value='{$range_stop}' {$range_disabled}>
+  </td>
+  </tr>
+  </table>
+  </td>
+  </tr>
+</table>
+<input type='hidden' name='dhcp_subnet_posted' value='1'>
+<p class="seperator"></p>
+
+<!-- Place cursor in correct field -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+        focus_field('cn');
+  -->
+</script>
diff --git a/plugins/admin/systems/services/dhcp/remove_dhcp.tpl b/plugins/admin/systems/services/dhcp/remove_dhcp.tpl
new file mode 100644 (file)
index 0000000..39fb19b
--- /dev/null
@@ -0,0 +1,17 @@
+<div style="font-size:18px;">
+<img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
+</div>
+<p>
+ {$warning}
+ {t}This includes 'all' DHCP subsections that are located within this section. Please double check if your really want to do this since there is no way for GOsa to get your data back.{/t}
+</p>
+
+<p>
+ {t}Best thing to do before performing this action would be to save the current contents of your LDAP tree in a file. So - if you've done so - press 'Delete' to continue or 'Cancel' to abort.{/t}
+</p>
+
+<p class="plugbottom">
+  <input type=submit name="delete_dhcp_confirm" value="{t}Delete{/t}">
+  &nbsp;
+  <input type=submit name="cancel_section" value="{t}Cancel{/t}">
+</p>
diff --git a/plugins/admin/systems/services/dhcp/servdhcp.tpl b/plugins/admin/systems/services/dhcp/servdhcp.tpl
new file mode 100644 (file)
index 0000000..846af22
--- /dev/null
@@ -0,0 +1,35 @@
+{if $dns_take_over}
+<table summary="" width="100%">
+    <tr>
+        <td style="width:100%;vertical-align:top;">
+                       <h2>{t}DHCP take over will take place when saving this entry. Choose 'Cancel' to abort.{/t}</h2>
+        </td>
+    </tr>
+</table>
+{else}
+<table summary="" width="100%">
+{if $dhcp_server_list_cnt}
+<tr>
+    <td style="width:100%;vertical-align:top;">
+        <b>{t}Take over dhcp configuration from following server{/t}</b>&nbsp;
+        <select name='take_over_src'>
+            {html_options options=$dhcp_server_list}
+        </select>
+        <input type="submit" name="take_over" value="{t}Apply{/t}">
+    </td>
+</tr>
+{/if}
+<tr>
+    <td style="width:100%;vertical-align:top;">
+    <h2>{t}DHCP sections{/t}</h2>
+        {$DhcpList}
+    </td>
+</tr>
+</table>
+{/if}
+<p class='seperator'>&nbsp;</p>
+<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
+    <input type='submit' name='SaveService' value='{t}Save{/t}'>
+    &nbsp;
+    <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
+</div
diff --git a/plugins/admin/systems/services/dns/class_servDNS.inc b/plugins/admin/systems/services/dns/class_servDNS.inc
new file mode 100644 (file)
index 0000000..13e7a93
--- /dev/null
@@ -0,0 +1,598 @@
+<?php
+
+class servdns extends goService
+{
+  /* 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   = FALSE;
+  var $attributes       = array(); 
+  var $objectclasses    = array("whatever");
+
+  var $RecordTypes      = array();
+  var $Zones            = array();
+
+  var $orig_dn          = "";
+
+  var $initially_was_account;
+  
+  /* ServerService tab vars */
+  var $conflicts        = array("servdns");
+  var $DisplayName      = "";
+  var $StatusFlag       = "";
+  var $view_logged      = FALSE;
+
+  var $dns_server_list   = array("ENTRIES"=> array(),"FOR_LIST"=> array());
+  var $take_over_id       = -1;
+
+
+  function servdns (&$config, $dn= NULL, $parent= NULL)
+  {
+    plugin::plugin ($config, $dn, $parent);
+
+    $this->DisplayName = _("DNS service");
+
+    $this->orig_dn = $dn;
+
+    /* Get record types for zones
+     */
+    $this->RecordTypes = getDnsRecordTypes(true);
+
+    /* Get all zone Informations
+     */
+    $this->Zones = getDNSZoneEntries($config,$dn);
+    
+    /* If there is at least one entry in this -> types, we have DNS enabled 
+     */
+    if(count($this->Zones) == 0){
+      $this->is_account = false;
+      $this->dns_server_list = $this->get_list_of_dns_servers();
+    }else{
+      $this->is_account = true;
+    }
+    $this->initially_was_account = $this->is_account;
+  }
+
+
+  function get_list_of_dns_servers()
+  {
+    $ret = array("ENTRIES"=> array(),"FOR_LIST"=> array());
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(&(objectClass=dNSZone)(zoneName=*))",array("dn","zoneName"));
+    $dns = array();
+    while($attrs = $ldap->fetch()){
+      /* Skip own config */
+      if($this->dn != "new" && preg_match("/".normalizePreg($this->dn)."$/",$attrs['dn'])){
+        continue;
+      }
+      $dn = preg_replace("/^zoneName=[^,]+,/","",$attrs['dn']);
+      if(preg_match("/^cn=/",$dn) && !in_array($dn,$dns)){
+        $dns[] = $dn;
+      }
+    }
+    $i = 0;
+    foreach($dns as $dn){
+      $ldap->cat($dn,array('*'));
+      if($ldap->count()){
+        $i ++;
+        $attrs = $ldap->fetch();
+          $ret['ENTRIES'][$i]   = $attrs;
+          $ret['FOR_LIST'][$i] = $attrs['cn'][0];
+      }
+    }
+    return($ret);
+  }  
+
+
+  function get_dns_info_string($id)
+  {
+    $ret="";
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->dns_server_list['ENTRIES'][$id]['dn']);
+    $ldap->search("(|(zoneName=*)(relativeDomainName=*))",array("dn"));
+    while($attrs = $ldap->fetch()){
+      $ret .= $attrs['dn']."\n";
+    }
+    return($ret);
+  }
+
+
+  function execute()
+  {
+    /* Call parent execute 
+     */
+    plugin::execute();
+
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","server/".get_class($this),$this->dn);
+    }
+
+    /* Fill templating stuff 
+     */
+    $smarty= get_smarty();
+    $smarty->assign("dns_take_over",FALSE);
+    $smarty->assign("is_createable",$this->acl_is_createable());
+    $display= "";
+
+
+    $this->initially_was_account= $this->is_account;
+    /*****************/
+    /* Handle Take Over Actions
+    /*****************/
+
+    /* Give smarty the required informations */
+    $smarty->assign("dns_server_list", $this->dns_server_list['FOR_LIST']);
+    $smarty->assign("dns_server_list_cnt", count($this->dns_server_list['FOR_LIST']));
+
+    /* Take over requested, save id */
+    if(isset($_POST['take_over_src']) && isset($_POST['take_over'])){
+      $id = $_POST['take_over_src'];
+      if(isset($this->dns_server_list['ENTRIES'][$id])){
+        $this->take_over_id = $id;
+      }
+    }
+
+    /* Abort take over action */
+    if(isset($_POST['cancel_take_over'])){
+      $this->dialog =false;
+      $this->take_over_id = -1;
+      $this->dns_server_list = $this->get_list_of_dns_servers();
+    }
+
+    /* Display informartion about take over that will be started when saving this server
+     *  and hide default dns output
+     */
+    if($this->take_over_id != -1){
+      $this->dialog = FALSE;
+      $id = $this->take_over_id;
+      $info = $this->get_dns_info_string($id);
+      $smarty->assign("dns_take_over",TRUE);
+      $smarty->assign("info",$info);
+      $warning = sprintf(_("You are going to migrate the DNS setup from server '%s'."),$this->dns_server_list['ENTRIES'][$id]['cn'][0]);
+      $warning2 = _("The migration will be startet when you save this system. To cancel this action, use the cancel button below.");
+      $smarty->assign("warning",$warning);
+      $smarty->assign("warning2",$warning2);
+      return($smarty->fetch(get_template_path('servdns.tpl', TRUE)));
+    }
+
+
+    /* Do we need to flip is_account state? 
+     */
+    if (isset($_POST['modify_state'])){
+      $this->is_account= !$this->is_account;
+    }
+
+    if ($this->is_account){
+      $display= $this->show_disable_header(_("Remove DNS service"),
+          _("This server has DNS features enabled. You can disable them by clicking below."));
+    } else {
+      $display= $this->show_enable_header(_("Add DNS service"),
+          _("This server has DNS features disabled. You can enable them by clicking below."));
+      return ($display);
+    }
+
+
+    /* Edited or Added zone 
+     */
+    if(isset($_POST['SaveZoneChanges'])){
+      $this->dialog->save_object();
+
+      /* Check for errors  
+       */
+      if(count($this->dialog->check())){
+        foreach($this->dialog->check() as $msgs){
+          print_red($msgs); 
+        }
+      }else{
+        /* add new/edited zone 
+         */
+        $ret = $this->dialog->save();
+        if(!$this->dialog->isNew){
+          unset($this->Zones[$this->dialog->OldZoneName]);
+        }
+        $this->Zones[$ret['zoneName']] = $ret;
+        $this->dialog = FALSE;
+      }
+    }
+
+    /* Cancel zone edit / new 
+     */
+    if(isset($_POST['CancelZoneChanges'])){
+      $this->dialog = FALSE;
+    }
+
+    /* Add empty new zone 
+     */
+    if(isset($_POST['AddZone'])){
+      $this->dialog = new servdnseditZone($this->config,$this->dn);
+    }
+
+    /* Check for edit zone request 
+     */
+    $once = false;
+    foreach( $_POST as $name => $value){
+  
+      /* check all post for edit request 
+       */
+      if(preg_match("/^editZone_/",$name)&&!$once){
+        $once =true;
+        $tmp = preg_replace("/^editZone_/","",$name);
+        $tmp = base64_decode(preg_replace("/_.*$/","",$tmp));
+        $this->dialog= new servdnseditZone($this->config,$this->dn,$this->Zones[$tmp]);
+      }
+
+      /* check posts for delete zone 
+       */
+      if(preg_match("/^delZone_/",$name)&&!$once){
+
+        $once =true;
+        $tmp = preg_replace("/^delZone_/","",$name);
+        $tmp = base64_decode(preg_replace("/_.*$/","",$tmp));
+     
+        /* Initiate deletion
+         */ 
+        $this->RemoveZone($tmp); 
+      }
+    }
+
+    if(isset($_GET['act']) && $_GET['act'] == "edit" && isset($_GET['id'])){
+      $id = base64_decode($_GET['id']);
+      if(isset($this->Zones[$id])){
+         $this->dialog= new servdnseditZone($this->config,$this->dn,$this->Zones[$id]);
+      }
+    }
+
+    if(isset($_GET['act']) && $_GET['act'] == "edit" && isset($_GET['id'])){
+      $id = base64_decode($_GET['id']);
+      if(isset($this->Zones[$id])){
+         $this->dialog= new servdnseditZone($this->config,$this->dn,$this->Zones[$id]);
+      }
+    }
+
+    /* Show dialog 
+     */
+    if(is_object($this->dialog)){
+      $this->dialog->save_object();
+      $this->dialog->parent = $this;
+      return($this->dialog->execute());
+    }
+
+    /* Create Listbox with existing Zones 
+     */
+    $ZoneList = new divSelectBox("dNSZones");
+    $ZoneList -> SetHeight(254);
+
+    /* Add entries to divlist
+     */
+    $editImg = "<input type='image' src='images/edit.png' name='editZone_%s'>";
+    if($this->acl_is_removeable()){
+      $editImg.= "<input type='image' src='images/edittrash.png' name='delZone_%s'>";
+    }
+
+    $link = "<a href='?plug=".$_GET['plug']."&act=edit&id=%s'>%s</a>";
+    foreach($this->Zones as $zone => $values ){
+      $ZoneList->AddEntry(array(
+            array("string" => sprintf($link,base64_encode($zone),($zone))),
+            array("string" => sprintf($link,base64_encode($zone),_("Reverse zone")." : ".($values['ReverseZone']))),
+            array("string" => _("TTL")." : ".$values['sOAttl']),
+            array("string" => _("Class")." : ".$values['dNSClass']),
+            array("string" =>str_replace("%s",base64_encode($zone),$editImg))
+            ));
+    }    
+
+    /* Display tempalte 
+     */
+    $smarty->assign("ZoneList",$ZoneList->DrawList());
+    $display.= $smarty->fetch(get_template_path('servdns.tpl', TRUE));
+    return($display);
+  }
+
+
+  /* Delete specified zone
+   */
+  function RemoveZone($id)
+  {
+    $zones =  $this->getUsedZoneNames();
+
+    if(isset($this->Zones[$id]['InitialReverseZone'])){
+      $rev = FlipIp($this->Zones[$id]['InitialReverseZone']);
+    }else{
+      $rev = FlipIp($this->Zones[$id]['ReverseZone']);
+    }
+
+    $zonename = "";
+    if(isset($this->Zones[$id]['InitialzoneName'])){
+      $zonename= $this->Zones[$id]['InitialzoneName'];
+    }
+
+    $used = array();
+
+    /* Add Records which use this zoneName
+     */
+    if(isset($zones[$zonename])){
+      $used = array_merge($used,$zones[$zonename]);
+    }
+
+    /* Add Records which uses this reverse zone
+     */
+    if(isset($zones[$rev.".in-addr.arpa"])){
+      $used = array_merge($used,$zones[$rev.".in-addr.arpa"]);
+    } 
+
+    /* There are still entries using this configuration
+     *  Abort deletion
+     */
+    if(count($used)){
+      $i = 2;
+      $str ="";
+      foreach($used as $dn){
+        if($i > 0 && !preg_match("/,relativeDomainName=/",$dn)){
+          $i --;
+          $name = preg_replace("/^[^=]+=([^,]*),.*$/","\\1",$dn);
+          $zone = preg_replace("/^.*zoneName=([^,]*),.*$/","\\1",$dn);
+          $str.= $name.".".$zone." ";
+        }
+      }
+
+      /*  Only show 2 dns in the error message 
+       */
+      if(count($used)> 2) {
+        $str .=" ... ";
+      }
+      print_red(sprintf(_("Can't delete the selected zone, because it is still in use by these entry/entries '%s'"),trim($str)));
+      return(false);
+    }else{
+      unset($this->Zones[$id]);
+      return(true);
+    }
+  } 
+
+
+  /* This funtion returns all used Zonenames 
+   */
+  function getUsedZoneNames()
+  {
+    $ret = array();
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(&(objectClass=dNSZone)(!(relativeDomainName=@))(zoneName=*))",array("zoneName","relativeDomainName"));
+    while($attr = $ldap->fetch()){
+      $ret[$attr['zoneName'][0]][] = $attr['dn'];
+    }
+    return($ret);
+  }
+
+
+  /* Remove dns service 
+   */
+  function remove_from_parent()
+  {
+    if($this->initially_was_account){
+      $bool = true;
+      $this->is_account = FALSE;
+      foreach($this->Zones as $key => $zone){
+        $bool= $bool & $this->RemoveZone($key);
+      }
+
+      if($bool){
+        $this->save();
+      }
+      return($bool);
+    }
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+
+    /* Take over handling
+     * - Create list of zones managed by source server 
+     * - Copy ldap entries to destination server 
+     * - Remove old zone entries from source
+     */
+    if($this->take_over_id != -1){
+      $del = array();
+      $id = $this->take_over_id;
+      $src = $this->dns_server_list['ENTRIES'][$id]['dn'];
+      $ldap = $this->config->get_ldap_link(); 
+      $ldap->ls("(objectClass=dnsZone)",$src,array('cn'));
+      while($attrs = $ldap->fetch()){
+        $src_zone = $attrs['dn'];
+        $dst_zone = preg_replace("/".normalizePreg($src)."$/",$this->dn,$src_zone);
+        $res = plugin::recursive_move($src_zone, $dst_zone);
+
+        if($res){
+          $del [] = $src_zone;
+        }
+      }
+      foreach($del as $src_zone){
+        $ldap->rmdir_recursive($src_zone);
+      }
+      return;
+    }
+
+    /* Save zone editor changes now */
+    foreach($this->Zones as $name => $zone){
+      if(isset($zone['zoneEditor'] ) && $zone['zoneEditor'] != NULL && is_object($zone['zoneEditor'])){
+        $zone['zoneEditor']->save();
+        unset($this->Zones[$name]['zoneEditor']);;
+      }
+    }
+
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);  
+  
+    /* Get differences 
+     */
+    $old_dn = $this->orig_dn;
+    if($old_dn == "new"){
+      $old_dn = $this->dn;
+    }
+
+    $tmp = getDNSZoneEntriesDiff($this->config,$this->Zones,$old_dn);
+
+    /* Update dns to current object dn */ 
+    $tmp = getDNSZoneEntriesDiff($this->config,$this->Zones,$old_dn);
+    $tmp2 = array();
+    foreach($tmp as $key1 => $data1){
+      $tmp2[$key1] = array();
+      foreach($data1 as $key2 => $data2){
+        $tmp2[$key1][preg_replace("/".normalizePreg($old_dn)."$/",$this->dn,$key2)] = $data2;
+      }
+    }
+    $tmp = $tmp2;
+
+    /* Updated zone entries if reverser or forward name has changed  
+     * Must be done before moving entries, else the given dn is invalid
+     */
+    if(isset($tmp['zoneUpdates'])){
+      foreach($tmp['zoneUpdates'] as $dn => $attrs){
+        $ldap->cd($dn);
+        $ldap->modify($attrs);
+        new log("modfiy","unknown/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+        show_ldap_error($ldap->get_error(), sprintf(_("Updating of system server/dns with dn '%s' failed."),$this->dn));
+      }
+    }
+
+    /* Delete dns 
+     */
+    foreach($tmp['del'] as $dn => $del){
+
+      $for = $del['InitialzoneName'];
+      $rev = FlipIp($del['InitialReverseZone']).".in-addr.arpa";
+
+      $ldap->cd($dn);
+      $ldap->rmdir_recursive($dn);
+      new log("remove","unknown/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+      show_ldap_error($ldap->get_error(), sprintf(_("Removing of system server/dns with dn '%s' failed."),$this->dn));
+
+      /* Handle Post events */
+      if(preg_match("/^zoneName=/",$dn)){
+#        $this->handle_post_events("remove",array("dn" => $dn,"zoneName" => $for));
+#        $this->handle_post_events("remove",array("dn" => $dn,"zoneName" => $rev));
+      }
+    }
+
+    /* move follwoing entries
+     */
+    foreach($tmp['move'] as $src => $dst){
+      $this->recursive_move($src,$dst);
+    }
+
+    /* Add || Update new DNS entries
+     */
+    foreach($tmp['add'] as $dn => $attrs){
+      $ldap->cd($dn);
+      $ldap->cat($dn, array('dn'));
+      if($ldap->fetch()){
+        $ldap->cd($dn);
+        $ldap->modify ($attrs);
+        show_ldap_error($ldap->get_error(), sprintf(_("Saving of system server/dns with dn '%s' failed."),$this->dn));
+
+        /* Handle Post events */
+        if(preg_match("/^zoneName=/",$dn)){
+#          $this->handle_post_events("modify",array("dn" => $dn,"zoneName" => $attrs['zoneName']));
+        }
+      }else{
+        $ldap->cd($dn);
+        $ldap->add($attrs);
+        show_ldap_error($ldap->get_error(), sprintf(_("Saving of system server/dns with dn '%s' failed."),$this->dn));
+
+        /* Handle Post events */
+        if(preg_match("/^zoneName=/",$dn)){
+#          $this->handle_post_events("add",array("dn" => $dn,"zoneName" => $attrs['zoneName']));
+        }
+      }
+    }
+    $this->handle_post_events("modify");
+  }
+
+
+  /* Directly save new status flag */
+  function setStatus($value)
+  {
+    if($value == "none") return;
+    if(!$this->initially_was_account) return;
+    if(empty($this->StatusFlag)) return;
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->dn);
+    $ldap->cat($this->dn,array("objectClass"));
+    if($ldap->count()){
+
+      $tmp = $ldap->fetch();
+      for($i = 0; $i < $tmp['objectClass']['count']; $i ++){
+        $attrs['objectClass'][] = $tmp['objectClass'][$i];
+      }
+      $flag = $this->StatusFlag;
+      $attrs[$flag] = $value;
+      $this->$flag = $value;
+      $ldap->modify($attrs);
+      show_ldap_error($ldap->get_error(), sprintf(_("Set status flag for system server/dns with dn '%s' failed."),$this->dn));
+      $this->action_hook();
+    }
+  }
+
+
+  function getListEntry()
+  {
+    $fields               = goService::getListEntry(); 
+    $fields['Message']    = _("DNS service");
+    $fields['AllowEdit']  = true;
+    return($fields);
+  }
+
+
+  /* Get updates for status flag */
+  function updateStatusState()
+  {
+    if(empty($this->StatusFlag)) return;
+
+    $attrs = array();
+    $flag = $this->StatusFlag;
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->cn);
+    $ldap->cat($this->dn,array($flag));
+    if($ldap->count()){
+      $attrs = $ldap->fetch();
+    }
+    if(isset($attrs[$flag][0])){
+      $this->$flag = $attrs[$flag][0];
+    }
+  }
+
+
+  /* Return plugin informations for acl handling */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("DNS service"),
+          "plDescription" => _("DNS service")." ("._("Services").")",
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 83,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("server"),
+
+          "plProvidedAcls"=> array(
+            "zoneName"      =>_("Zone name"),
+            "ReverseZone"   =>_("Reverse zone"),
+            "sOAprimary"    =>_("Primary dns server"),
+            "sOAmail"       =>_("Mail address"),
+            "sOAserial"     =>_("Serial"),
+            "sOArefresh"    =>_("Refresh"),
+            "sOAretry"      =>_("Retry"),
+            "sOAexpire"     =>_("Expire"),
+            "sOAttl"        =>_("TTL"),
+            "zoneRecords"   =>_("Zone records"))
+    ));
+  }
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/services/dns/class_servDNSeditZone.inc b/plugins/admin/systems/services/dns/class_servDNSeditZone.inc
new file mode 100644 (file)
index 0000000..d5df087
--- /dev/null
@@ -0,0 +1,603 @@
+<?php
+
+class servdnseditZone 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("zoneName","ReverseZone","dNSClass",
+      "sOAprimary","sOAmail","sOAserial","sOArefresh","sOAretry","sOAexpire","sOAttl"); 
+  var $objectclasses  = array("whatever");
+
+  var $RecordTypes              = array();
+
+  var $ReverseZone              = "";
+  var $zoneName                 = "";
+  var $dNSClass                 = "IN";
+
+  var $sOAprimary               = "";
+  var $sOAmail                  = "";
+  var $sOAserial                = "";
+  var $sOArefresh               = "3600";
+  var $sOAretry                 = "1800";
+  var $sOAexpire                = "720000";
+  var $sOAttl                   = "6400";
+
+  var $Records                  = array();
+  var $mXRecords                = array();
+
+  var $OldZoneName              = ""; // To detect changes made with this edit
+  var $OldReverseZone           = "";
+
+  var $InitialReverseZone       = "";
+  var $InitialzoneName          = "";
+  var $NetworkClass                = "A" ; // One out of A,B,C
+
+  var $dialog                   = false;
+
+  var $zoneEditor               = NULL;
+
+  var $isNew                    = true;
+
+  var $ZoneObject               = array();
+
+  function servdnseditZone (&$config, $dn= NULL,$attrs = array())
+  {
+    plugin::plugin ($config, $dn);
+
+    /* All types with required attrs */
+    $this->RecordTypes = getDnsRecordTypes(true); 
+
+    if(!count($attrs)){
+      $this->OldZoneName        = "";
+      $this->OldReverseZone     = "";
+      $this->isNew              = true;
+      $this->sOAserial          = date("Ymd")."1";
+      
+      $this->InitialzoneName    = "";//$attrs['InitialzoneName'];
+      $this->InitialReverseZone = "";//$attrs['InitialReverseZone'];
+    }else{
+      $this->ZoneObject         = $attrs;
+
+      if(isset($attrs['zoneEditor'])){
+        $this->zoneEditor         = $attrs['zoneEditor'];
+      }
+      $this->OldZoneName        = $attrs['zoneName'];
+      $this->OldReverseZone     = $attrs['ReverseZone'];
+
+      $this->InitialzoneName    = $attrs['InitialzoneName'];
+      $this->InitialReverseZone = $attrs['InitialReverseZone'];
+
+      $this->isNew                  = false;
+
+      foreach($this->attributes as $value){
+        $this->$value = $attrs[$value];
+      }
+
+      $this->sOAmail            = preg_replace("/\./","@",$this->sOAmail,1);
+      $this->sOAmail            = preg_replace("/\.$/","",$this->sOAmail);
+      $this->sOAprimary         = preg_replace("/\.$/","",$this->sOAprimary);
+      $this->zoneName           = preg_replace("/\.$/","",$this->zoneName);
+
+      if(isset($attrs['RECORDS'])){
+        $this->Records = $attrs['RECORDS']; 
+
+        $tmp2 = array();
+        $usedPrio = array();
+        foreach($this->Records as $key => $rec){
+          if($rec['type'] == "mXRecord"){
+            $tmp = split(" ",$rec['value']);
+            $rec['value'] = $tmp[1];
+            $tmp2[$tmp[0]] = $rec;
+            unset($this->Records[$key]);
+          }
+          if($rec['type'] == "nSRecord"){
+            unset($this->Records[$key]);
+          }
+        }
+        if(count($tmp2) != 0){
+          reset($tmp2);
+          ksort($tmp2);
+        }
+        $this->mXRecords = $tmp2;
+      }else{
+        $this->mXRecords  = array();
+        $this->Records    = array();
+      }
+
+      $str = date("Ymd");
+      if(preg_match("/^".$str."/",$this->sOAserial)){
+        $this->sOAserial = $this->sOAserial + 1;
+      }else{
+        $this->sOAserial = date("Ymd")."01";
+      }
+    }
+
+    /* Detect Network class */
+    if(!empty($this->ReverseZone)){
+
+      $dots = count(split("\.",$this->ReverseZone));
+      if($dots == 1){
+        $this->NetworkClass = "A";  
+        $this->ReverseZone .= ".0.0.0"; 
+      }elseif($dots == 2){
+        $this->NetworkClass = "B";  
+        $this->ReverseZone .= ".0.0"; 
+      }else{
+        $this->NetworkClass = "C";  
+        $this->ReverseZone .= ".0"; 
+      }
+    }
+  }
+
+  /* TRansports the geiven Arraykey one position up*/
+  function ArrayUp($atr,$attrs)
+  {
+    $ret = $attrs;
+    $pos = $atr ;
+    $cn = count($attrs);
+    if(!(($pos == -1)||($pos == 1)||($pos >$cn))){
+      $before = array_slice($attrs,0,($pos-2));
+      $mitte  = array_reverse(array_slice($attrs,($pos-2),2));
+      $unten  = array_slice($attrs,$pos);
+      $ret = array();
+      $ret = $this->combineArrays($before,$mitte,$unten);
+    }
+    return($ret);
+  }
+
+
+  /* TRansports the geiven Arraykey one position up*/
+  function ArrayDown($atr,$attrs)
+  {
+    $ret = $attrs;
+    $pos = $atr ;
+    $cn = count($attrs);
+    if(!(($pos == -1)||($pos == $cn))){
+      $before = array_slice($attrs,0,($pos-1));
+      $mitte  = array_reverse(array_slice($attrs,($pos-1),2));
+      $unten  = array_slice($attrs,($pos+1));
+      $ret = array();
+      $ret = $this->combineArrays($before,$mitte,$unten);
+    }
+    return($ret);
+  }
+
+  /* Combine new array */
+  function combineArrays($ar0,$ar1,$ar2)
+  {
+    $ret = array();
+    if(is_array($ar0))
+    foreach($ar0 as $ar => $a){
+        $ret[]=$a;
+    }
+    if(is_array($ar1))
+    foreach($ar1 as $ar => $a){
+        $ret[]=$a;
+    }
+    if(is_array($ar2))
+    foreach($ar2 as $ar => $a){
+        $ret[]=$a;
+    }
+    return($ret);
+  }
+  
+  function getpos($atr,$attrs)
+  {
+    $i = 0;
+    foreach($attrs as $attr => $name)    {
+      $i++;
+      if($attr == $atr){
+        return($i);
+      }
+    }
+    return(-1);
+  }
+
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+
+
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+    $ui = get_userinfo();
+
+    $smarty->assign("ACLs",$this->parent->getacl(""));
+    $display= "";
+
+    /* Open Zone Entry Edit Dialog
+     */
+    if(!count($this->ZoneObject)){
+      $smarty->assign("AllowZoneEdit" , false);
+    }else{
+      $smarty->assign("AllowZoneEdit" , true);
+      if(isset($_POST['EditZoneEntries'])){
+        if($this->zoneEditor == NULL){
+          $this->zoneEditor= new servDNSeditZoneEntries($this->config,$this->dn,$this->ZoneObject);
+          $this->zoneEditor->parent = $this;
+        }
+        $this->dialog = $this->zoneEditor;
+      }
+    }
+
+    /* Save Zone Entry Edit Dialog
+     */
+    if(isset($_POST['SaveZoneEntryChanges'])){
+      $this->dialog->save_object();
+      if(count($this->dialog->check())){
+        $msgs = $this->dialog->check();
+        foreach($msgs as $msg){
+          print_red($msg);
+        }
+      }else{
+        $this->zoneEditor = clone $this->dialog;
+        $this->dialog = FALSE;
+#       $rev = FlipIp(getNameFromMix($this->InitialReverseZone)).".in-addr.arpa";
+#       $for = getNameFromMix($this->InitialzoneName);
+#      
+#       $this->parent->handle_post_events("modify",array("dn" => $this->dn,"zoneName" => $rev));
+#       $this->parent->handle_post_events("modify",array("dn" => $this->dn,"zoneName" => $for));
+#       $this->dialog = false;
+      }
+    }
+
+    /* Cancel Zone Entrie Edit Dialog
+    */
+    if(isset($_POST['CancelZoneEntryChanges'])){
+      $this->dialog = false;
+    }
+
+    /* Display any type of open dialogs 
+     */
+    if(is_object($this->dialog)){
+      $this->dialog->save_object();
+      return($this->dialog->execute());
+    }
+
+    $once =true;
+    foreach($_POST as $name => $value){
+      if((preg_match("/^MXup_/",$name)) && ($once)){
+        $once = false;
+
+        $id = preg_replace("/^MXup_/","",$name);
+        $id = preg_replace("/_.*$/","",$id);
+        $id = base64_decode($id);
+    
+        $this->mXRecords = $this->ArrayUp(($id+1),$this->mXRecords);
+      }
+      if((preg_match("/^MXdown_/",$name)) && ($once)){
+        $once = false;
+        
+        $id = preg_replace("/^MXdown_/","",$name);
+        $id = preg_replace("/_.*$/","",$id);
+        $id = base64_decode($id);
+  
+        $this->mXRecords = $this->ArrayDown(($id+1),$this->mXRecords);
+      }
+      if((preg_match("/^MXdel_/",$name)) && ($once)){
+        $once = false;
+        
+        $id = preg_replace("/^MXdel_/","",$name);
+        $id = preg_replace("/_.*$/","",$id);
+        $id = base64_decode($id);
+        
+        unset($this->mXRecords[$id]);
+
+        $tmp  =array();
+        foreach($this->mXRecords as $entry){
+          $tmp[] = $entry;
+        }
+        $this->mXRecords = $tmp; 
+      }
+    }
+
+    if((isset($_POST['AddMXRecord'])) && (!empty($_POST['StrMXRecord']))){
+      $this->mXRecords[] = array("type"=>"mXRecord","value"=>trim($_POST['StrMXRecord']));      
+    }
+
+    /* Handle Post events */
+    $once = true;
+    foreach($_POST as $name => $value){
+
+      /* Delete record if requested */
+      if((preg_match("/RemoveRecord_/",$name))&&($once)){
+        $once = false;
+        $id= preg_replace("/RemoveRecord_/","",$name);
+        unset($this->Records[$id]);
+      }
+    }
+
+    /* Add new Zonerecord */
+    if(isset($_POST['AddNewRecord'])){
+      $this->Records[] = array("type"=>"aRecord","value"=>"");
+    }
+
+    /* Fill in values */
+    foreach($this->attributes as $name){
+      $smarty->assign($name,$this->$name);
+    }
+
+
+    $div = new divSelectBox("MxRecords");
+    $div->setHeight(120);
+    $recs = $this->mXRecords;
+
+    $oneup    = "<input name='MXup_%s'    type='image' src='images/sort_up.png'    title='"._("Up")."'      class='center'>&nbsp;"; 
+    $onedown  = "<input name='MXdown_%s'  type='image' src='images/sort_down.png'  title='"._("Down")."'    class='center'>&nbsp;"; 
+    $onedel   = "<img src='images/empty.png' width='20' class='center'>
+                 <input name='MXdel_%s'   type='image' src='images/edittrash.png'  title='"._("Delete")."'  class='center'>"; 
+
+    foreach($recs as $key => $rec){
+      $div ->AddEntry(array(
+            array("string"=>$rec['value']),
+/*            array("string"=>$key,
+                  "attach"=>"style='width:20px;'"),*/
+            array("string"=>str_replace("%s",base64_encode($key),$oneup.$onedown.$onedel),
+                  "attach"=>"style='width:70px;border-right:0px;'")
+            ));
+    }
+
+    /* Assign records list */
+    $smarty->assign("NotNew", false);
+    $smarty->assign("Mxrecords",  $div->DrawList());
+    $smarty->assign("records"  ,  $this->generateRecordsList());
+    $smarty->assign("NetworkClass",  $this->NetworkClass);
+    $smarty->assign("NetworkClasses",  array("A"=>"255.0.0.0 (Class A)","B"=>"255.255.0.0 (Class B)","C"=>"255.255.255.0 (Class C)"));
+
+    /* Display tempalte */
+    $display.= $smarty->fetch(get_template_path('servdnseditzone.tpl', TRUE));
+    return($display);
+  }
+
+  function remove_from_parent()
+  {
+  }
+
+  /* Save data to object */
+  function save_object()
+  {
+    //plugin::save_object();
+    foreach($this->attributes as $attr){
+      if(isset($_POST[$attr])){
+        $this->$attr = $_POST[$attr];
+      }
+    }
+
+    foreach($this->Records as $id => $value){  
+      if(isset($_POST['RecordTypeSelectedFor_'.$id])){
+        $this->Records[$id]['type'] = $_POST['RecordTypeSelectedFor_'.$id];
+      }
+      if(isset($_POST['RecordValue_'.$id])){
+        $this->Records[$id]['value'] = $_POST['RecordValue_'.$id];
+      }
+    }
+
+     if(isset($_POST['NetworkClass'])){
+       $this->NetworkClass = $_POST['NetworkClass'];
+     }
+
+  }
+
+
+  /* Check supplied data */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+        
+    /* Check if zoneName is already in use */
+    $usedZones = $this->getUsedZoneNames();
+    if(($this->isNew == true)||($this->zoneName  != $this->InitialzoneName)||($this->ReverseZone != $this->InitialReverseZone)){
+    /*  if((isset($usedZones[$this->zoneName]))&&($this->zoneName  != $this->InitialzoneName)){
+        $message[] =_("This zoneName is already in use");
+      }
+      if((in_array($this->ReverseZone,$usedZones))&&($this->ReverseZone != $this->InitialReverseZone)){
+        $message[] =_("This reverse zone is already in use");
+      }*/
+    }
+
+    if(empty($this->zoneName)){
+      $message[] =sprintf(_("Please choose a valid zone name."));
+    }
+
+    if(empty($this->ReverseZone)){
+      $message[] =sprintf(_("Please choose a valid reverse zone name."));
+    }
+
+    if($this->zoneName != strtolower($this->zoneName)){
+      $message[] = _("Only lowercase strings are allowed as zone name.");
+    }
+
+    if(!is_numeric($this->sOAserial)){
+      $message[] = _("Please specify a numeric value for serial number.");
+    }
+
+    if(!is_numeric($this->sOArefresh)){
+      $message[] = _("Please specify a numeric value for refresh.");
+    }
+
+    if(!is_numeric($this->sOAttl)){
+      $message[] = _("Please specify a numeric value for ttl.");
+    }
+
+    if(!is_numeric($this->sOAexpire)){
+      $message[] = _("Please specify a numeric value for expire.");
+    }
+
+    if(!is_numeric($this->sOAretry)){
+      $message[] = _("Please specify a numeric value for retry.");
+    }
+
+    foreach($this->Records as $name => $values){
+      /* only lower-case is allowed in record entries ... */
+      if($values['value'] != strtolower($values['value'])){
+        $message[] = sprintf(_("Only lowercase is allowed, please check your '%ss'."),$values['type']);
+      }
+    }
+
+    /* Check class for given Zone Address */
+    $addr = preg_replace("/^[^\/]*+\//","",$this->ReverseZone);
+  
+    /* Check for valid&complete IP address */
+    if(!is_ip($addr)){
+      $message[] = _("The given network address is not a valid, please specify a valid IP address.");
+    }
+    /* Check if given address matches selected network class */
+    switch($this->NetworkClass){
+      case 'A': { 
+                  if(!preg_match("/^[0-9]*\.0\.0\.0$/",$addr)){
+                    $message[] = sprintf(_("The specified network address is not matching with the specified zone class, try it this way x.0.0.0"));
+                  }
+                }
+                break;
+      case 'B': {
+                  if(!preg_match("/^[0-9]*\.[0-9]*\.0\.0$/",$addr)){
+                    $message[] = sprintf(_("The specified network address is not matching with the specified zone class, try it this way x.x.0.0"));
+                  }
+                }
+                break;
+      case 'C': {
+                  if(!preg_match("/^[0-9]*\.[0-9]*\.[0-9]*\.0$/",$addr)){
+                    $message[] = sprintf(_("The specified network address is not matching with the specified zone class, try it this way x.x.x.0"));
+                  }
+                }
+                break;
+      default : $message[] =sprintf(_("The given network class '%s' is not valid."),$this->NetworkClass);
+    }
+
+    return ($message);
+  }
+
+  /* This funtion returns all used Zonenames */
+  function getUsedZoneNames()
+  {
+    $ret = array();
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(&(objectClass=dNSZone)(relativeDomainName=@)(zoneName=*))",array("zoneName","tXTRecord"));
+    while($attr = $ldap->fetch()){
+      if(preg_match("/in-addr\.arpa/",$attr['zoneName'][0])){
+        if(isset($attr['tXTRecord'][0])){
+          $zn = preg_replace("/zoneName\=/","",$attr['tXTRecord'][0]);
+          $ret[$zn] =FlipIp(preg_replace("/\.in-addr\.arpa/","",$attr['zoneName'][0]));
+        }
+      }else{
+        $ret[$attr['zoneName'][0]]="";
+      }
+    }
+    return($ret);
+  }
+
+  /* Save to LDAP */
+  function save()
+  {
+    $ret =array();
+    foreach($this->attributes as $name){
+      $ret[$name] = $this->$name;
+    }
+
+    /* Create mx records 
+     */
+    foreach($this->mXRecords as $key => $rec){
+      $rec['value']= $key." ".$rec['value'];
+      $this->Records [] = $rec;
+    }
+
+  
+    $ret['RECORDS'] = $this->Records; 
+    switch($this->NetworkClass){
+      case 'C' : $ret['ReverseZone']= preg_replace("/\.[0-9]*$/","",$this->ReverseZone);break;
+      case 'B' : $ret['ReverseZone']= preg_replace("/\.[0-9]*\.[0-9]*$/","",$this->ReverseZone);break;
+      case 'A' : $ret['ReverseZone']= preg_replace("/\.[0-9]*\.[0-9]*\.[0-9]*$/","",$this->ReverseZone);break;
+      default : trigger_error("Invalid network class given '".$this->NetworkClass."'");
+    }
+
+    $ret['InitialReverseZone']=  $this->InitialReverseZone;
+    $ret['InitialzoneName']   =  $this->InitialzoneName;
+
+    $ret['sOAmail']            = preg_replace("/\@/",".",$this->sOAmail);
+
+    foreach(array("sOAprimary","zoneName","sOAmail") as $attr){
+      if(!preg_match("/\.$/",$ret[$attr])){
+        if(!is_ip($ret[$attr])){
+          $ret[$attr] = $ret[$attr].".";
+        }
+      }
+    }
+
+    $ret['RECORDS'][] = array("type" => "nSRecord","value" => $ret['sOAprimary']) ;
+
+    $ret['zoneEditor'] = $this->zoneEditor;
+    return($ret);
+  }
+
+  
+  /* This function generate a table row for each used record.
+     This table row displays the recordtype in a select box
+      and the specified value for the record, and a remove button.
+     The last element of the table also got an 'add' button.
+   */
+  function generateRecordsList($changeStateForRecords="")
+  {
+    $changeStateForRecords = "";
+
+    $str = "<table summary=''>";
+    foreach($this->Records as $key => $entry){
+
+      if($entry['type'] == "mXRecord") continue;
+      
+      $changeStateForRecords.= "changeState('RecordTypeSelectedFor_".$key."');\n";
+      $changeStateForRecords.= "changeState('RecordValue_".$key."');\n";
+      $changeStateForRecords.= "changeState('RemoveRecord_".$key."');\n";
+
+      $str.=" <tr>".
+        "   <td>".$this->generateRecordListBox($entry['type'],"RecordTypeSelectedFor_".$key)."</td>".
+        "   <td><input type='text' value='".$entry['value']."' name='RecordValue_".$key."' id='RecordValue_".$key."'></td>".
+        "   <td><input type='submit' name='RemoveRecord_".$key."' value='"._("Delete")."' id='RemoveRecord_".$key."'></td>".
+        "</tr>";
+    }
+
+    $str.= "  <tr>".
+      "    <td colspan=2></td><td>".
+      "      <input type='submit' value='"._("Add")."' name='AddNewRecord'>".
+      "    </td>".
+      "  </tr>".
+      "</table>";
+    return($str);
+  }
+
+  /* This function generates a select box out of $this->RecordTypes options.
+     The Parameter $selected is used to predefine an attribute.
+     $name is used to specify a post name
+   */
+  function generateRecordListBox($selected,$name)
+  {
+    $str = "<select name='".$name."' id='".$name."'>";
+    foreach($this->RecordTypes as $type => $value){
+
+      if(preg_match("/^mXRecord$/i",$value)) continue;
+
+      $use = "";
+      if($type == $selected){
+        $use = " selected ";
+      }
+      $str.="\n <option value='".$type."' ".$use.">".strtoupper(preg_replace("/record/i","",$type))."</option>";
+    }
+    $str.="</select>";
+    return($str);
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/services/dns/class_servDNSeditZoneEntries.inc b/plugins/admin/systems/services/dns/class_servDNSeditZoneEntries.inc
new file mode 100644 (file)
index 0000000..8453ae7
--- /dev/null
@@ -0,0 +1,498 @@
+<?php
+
+class servDNSeditZoneEntries 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("whatever");
+
+  var $Devices            = array();
+
+  var $zoneName           = "";   // ZoneName of currently edited Zone
+  var $reverseName        = "";   // ReverseZone of the currently edited Zone
+
+  var $RecordTypes        = array();  // Possible record type.
+
+  var $disableDialog      = false; // Dialog will be disabled, if this zone is new 
+
+  function servDNSeditZoneEntries (&$config,$dn, &$zoneObject)
+  {
+    plugin::plugin ($config, $dn);
+
+    /* Initialise class
+     */
+    $this->RecordTypes  = getDnsRecordTypes();
+    $this->dn           = "zoneName=".$zoneObject['InitialzoneName'].",".$dn; 
+    $this->zoneName     = $zoneObject['InitialzoneName'];
+    $this->reverseName  = $zoneObject['InitialReverseZone'];
+
+    /* Remove nSRecord from listed types */
+    if(isset($this->RecordTypes['nSRecord'])){
+      unset($this->RecordTypes['nSRecord']);
+    }
+    /* Remove nSRecord from listed types */
+    if(isset($this->RecordTypes['pTRRecord'])){
+      unset($this->RecordTypes['pTRRecord']);
+    }
+
+    /* Get ldap connection 
+     */
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+
+    /* Get zone content
+     */
+    $ldap->ls("(&(objectClass=dNSZone)(!(relativeDomainName=@)))",$this->dn,array("relativeDomainName"));
+    
+    while($attrs = $ldap->fetch()){
+      $this->Devices[$attrs['relativeDomainName'][0]] = getDNSHostEntries($config,$attrs['relativeDomainName'][0],true);
+      $this->Devices[$attrs['relativeDomainName'][0]]['OrigCn'] = $attrs['relativeDomainName'][0];
+    }
+
+    $ldap->cat($this->dn,array("objectClass"));
+
+    $this->disableDialog = true;
+    if(count($this->Devices)|| $ldap->count()){
+      $this->disableDialog = false;
+    }
+  }
+
+  function execute()
+  {
+    plugin::execute();
+
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+    $display= "";
+
+    $table = "";
+    foreach($this->Devices as $key => $dev){
+      $table .= $this->generateRecordConfigurationRow($key);
+    }
+
+    $smarty->assign("disableDialog",$this->disableDialog);
+    $smarty->assign("table",$table);;
+    $display.= $smarty->fetch(get_template_path('servDNSeditZoneEntries.tpl', TRUE));
+    return($display);
+  }
+
+
+  function save_object()
+  {
+    /* Check posts for operations ...  
+     */
+    $once = true;
+    $ptr_updates = array();
+    foreach($_POST as $name => $value){
+
+      /* Add a new Record in given object  
+       */
+      
+      $tmp    = preg_replace("/^.*_(.*)_.*$/","\\1",$name);
+      $tmp2   = split("\|",$tmp);
+
+      /* Add new host entry
+       */
+      if((preg_match("/^UserRecord_?/",$name)) && ($once)){
+        $once = false;
+        $entry = getDNSHostEntries($this->config,"",true);     
+        $entry['exists']    = true;
+        $entry['zoneName']  = strtoupper($this->attrs['cn'][0])."/".$this->zoneName; 
+        $entry['RECORDS'][] = array("type" => "aRecord" , "value"=>"");
+        $this->Devices[_("New entry")] = $entry;
+      }
+
+      if(count($tmp2) != 2) continue;
+
+      $Name     = base64_decode($tmp2[0]);
+      $RecordID = $tmp2[1];
+
+      /* Add new REcord
+       */
+      if((preg_match("/^AddRecord_/",$name)) && ($once)){
+        $once = false;
+        $this->Devices[$Name]['RECORDS'][] = $this->Devices[$Name]['RECORDS'][$RecordID];
+      }
+
+      /* Remove record from given dn
+       */
+      if((preg_match("/^RemoveRecord_/",$name)) && ($once)){
+        $once   = false;
+        if(isset($this->Devices[$Name]['RECORDS'][$RecordID])){
+          unset($this->Devices[$Name]['RECORDS'][$RecordID]);
+        }
+
+        /* Check if there is at least one visible record. Else remove complete entry */
+        $visible = false;
+        foreach($this->Devices[$Name]['RECORDS'] as $rec){
+          if(in_array($rec['type'],$this->RecordTypes)){
+            $visible = true;  
+            break;
+          }
+        }
+        if(!$visible && isset($this->Devices[$Name]['RECORDS'])){
+          $this->Devices[$Name]['RECORDS'] = array();
+        }
+      }
+    }
+
+    /* Possible attributes posted 
+     */
+    foreach($_POST as $name => $value){
+
+      /* Extract informations out of post name 
+       */
+      $tmp    = preg_replace("/^.*_/","\\1",$name);
+      $tmp2   = split("\|",$tmp);      
+      if(count($tmp2) != 2) continue;
+
+      $Name     = base64_decode($tmp2[0]);
+      $RecordID = $tmp2[1];
+
+      /* Check for value change 
+       */          
+      if(preg_match("/ValueSelection_/",$name)){
+        if(isset($this->Devices[$Name]['RECORDS'][$RecordID])){
+         
+          /* Update value */ 
+          $old = $this->Devices[$Name]['RECORDS'][$RecordID]['value'];
+          $this->Devices[$Name]['RECORDS'][$RecordID]['value'] = $value;
+
+          /* Handle pTRRecord */
+          if(!isset($ptr_updates[$Name]) && $this->Devices[$Name]['RECORDS'][$RecordID]['type'] == "aRecord"){
+    
+            $found = false;
+            $ip = $value;
+            $match = preg_replace("/^[^\/]*+\//","",$this->reverseName);
+            $ip = preg_replace("/^".normalizePreg($match)."/","",$ip);
+            $ip = preg_replace("/^\./","",$ip);
+
+            foreach($this->Devices[$Name]['RECORDS'] as $key => $dev){
+              if($dev['type'] == "pTRRecord"){
+                $ptr_updates[$Name] = $Name;
+                $this->Devices[$Name]['RECORDS'][$key]['value'] = $ip;
+                $found = true;
+                break;
+              }
+            }
+            if(!$found){
+              $dev = array('type'=> 'pTRRecord', 'value' => $ip);
+              $this->Devices[$Name]['RECORDS'][] = $dev;
+            }
+          }
+        }
+      }
+
+      /* record type changed
+       */        
+      if(preg_match("/^RecordTypeSelection_/",$name)){
+        if(isset($this->Devices[$Name]['RECORDS'][$RecordID])){
+          $this->Devices[$Name]['RECORDS'][$RecordID]['type'] = $value;
+        }  
+      }   
+    }
+    
+    /* check for renamed entries 
+     */ 
+    foreach($_POST as $name => $value){
+
+      /* Extract informations out of post name 
+       */
+      $tmp    = preg_replace("/^.*_/","\\1",$name);
+      $tmp2   = split("\|",$tmp);      
+      if(count($tmp2) != 2) continue;
+
+      $Name     = base64_decode($tmp2[0]);
+      $RecordID = $tmp2[1];
+
+      /* Host renamed
+       */
+      if(preg_match("/RenameHost_/",$name)){
+        if((isset($this->Devices[$Name])) && ($Name != $value)){
+    
+          if(isset($this->Devices[$value])){
+            print_red(sprintf(_("Can't rename '%s' to '%s' there is already an entry with the same name in our zone editing dialog."),$Name,$value));
+          }else{
+            $this->Devices[$value] = $this->Devices[$Name];
+            unset($this->Devices[$Name]);
+          }
+        }
+      }
+    }
+  }
+
+
+  /*  check something 
+   */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+    
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+
+    $names = array();
+    foreach($this->Devices as $DevName => $device){
+
+      /* Don't need to check empty values ... */
+      if(!count($device['RECORDS'])) continue;
+
+      /* Checking entry name
+       */
+      if(!preg_match("/^[a-z0-9_\.-]+$/i", $DevName) || (empty($DevName))){
+        $message[] = sprintf(_("Entry name '%s' contains invalid characters."), $DevName);
+      }      
+
+      /* Renaming check for existing devices 
+       */
+      if(isset($device['OrigCn'])  && ($DevName != $device['OrigCn'] )){
+        $ldap->cd($this->config->current['BASE']);
+        $ldap->search("(relativeDomainName=".$DevName.")",array("relativeDomainName"));
+        if($ldap->count()){
+          $message[] = sprintf(_("Can not rename '%s' to '%s',the destination name already exists."),$device['OrigCn'],$DevName);
+        }
+      }elseif(!isset($device['OrigCn'])){
+        $ldap->cd($this->config->current['BASE']);
+        $ldap->search("(relativeDomainName=".$DevName.")",array("relativeDomainName"));
+        if($ldap->count()){
+          $message[] = sprintf(_("Can not create '%s',the destination name already exists."),$DevName);
+        }
+      }
+
+      /* Check names 
+       */
+      if(!isset($names[$DevName])){
+        $names[$DevName] = "";
+      }else{
+        $message[] = sprintf(_("The name '%s' is used more than once."),$DevName);
+      }
+
+      /* Names should be written in lowercase
+       */
+#      if(strtolower($DevName) != $DevName){
+#        $message[] = sprintf(_("The host name '%s' should be written in lowercase."), $DevName);
+#      }
+
+      /* Check records
+       */                 
+      $singleEntries = array("cNAMERecord","pTRRecord");
+
+      $tmp  = array();
+      $tmp2 = array();
+      foreach($device['RECORDS'] as $Num => $Rec){
+
+        /* Check for multiple use of unique record types
+         */
+        if(in_array($Rec['type'],$singleEntries)){
+          if(!isset($tmp[$Rec['type']])){
+            $tmp[$Rec['type']] = "";
+          }else{
+            $message[] = sprintf(_("The record type '%s' is a unique type and can't be defined twice."),$Rec['type']);
+          }
+        }
+
+        /* Check for empty / duplicate entries in record array 
+         */
+        if(empty($Rec['value'])){
+          $message[] = sprintf(_("There is an empty '%s' for host '%s'."),$Rec['type'],$DevName);
+        }
+
+        /* Check for duplicate record entries 
+         */
+        if(!isset($tmp[$Rec['type']][$Rec['value']])){
+          $tmp[$Rec['type']][$Rec['value']] = "";
+        }else{
+          $message[] = sprintf(_("There is a duplicate entry in '%s' for '%s'."),$Rec['type'],$DevName); 
+        }
+      }
+    }
+    return ($message);
+  }
+
+  function save()
+  {
+    if($this->disableDialog) return;
+
+    $todo = array(); 
+
+
+
+    /* Create todolist
+     */
+    foreach($this->Devices as $name => $dev){
+      if(isset($dev['OrigCn'])){
+        if(count($dev['RECORDS'])){
+          $todo[] = getDNSHostEntriesDiff($this->config,$dev['OrigCn'],$dev,$name);
+        }else{
+          $dev['exists'] = false;
+          $todo[] = getDNSHostEntriesDiff($this->config,$dev['OrigCn'],$dev,$name);
+        }
+      }else{
+        if(count($dev['RECORDS'])){
+          $todo[] = getDNSHostEntriesDiff($this->config,"",$dev,$name);
+        }else{
+          $dev['exists'] = false;
+          $todo[] = getDNSHostEntriesDiff($this->config,"",$dev,$name);
+        }
+      }
+    }
+
+    $tmp = array();
+    $tmp['del']   = array();
+    $tmp['add']   = array();
+    $tmp['move']  = array();
+    foreach($todo as $to){
+      foreach($to as $type => $entries){
+        $tmp[$type] = array_merge($tmp[$type],$entries);
+      }
+    }
+
+    /* Get ldap link
+     */
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd ($this->config->current['BASE']);
+
+    /* move follwoing entries
+     */
+    foreach($tmp['move'] as $src => $dst){
+      $this->recursive_move($src,$dst);
+    }
+
+    /* Delete dns */
+    foreach($tmp['del'] as $dn => $del){
+      $ldap->cd($dn);
+      $ldap->rmdir_recursive($dn);
+      if(is_object($this->parent->parent)){
+        $this->parent->parent->handle_post_events("remove",array("dn" => $dn));
+      }
+    }
+
+    /* Add || Update new DNS entries
+     */
+    foreach($tmp['add'] as $dn => $attrs){
+      $ldap->cd($dn);
+      $ldap->cat($dn, array('dn'));
+      if(count($ldap->fetch())){
+        $ldap->cd($dn);
+        $ldap->modify ($attrs);
+        if(is_object($this->parent->parent)){
+          $this->parent->parent->handle_post_events("modify",array("dn" => $dn));
+        }
+      }else{
+        $ldap->cd($dn);
+        $ldap->add($attrs);
+        if(is_object($this->parent->parent)){
+          $this->parent->parent->handle_post_events("create",array("dn" => $dn));
+        }
+      }
+    }
+  }
+
+
+  /* Create html table out of given entry 
+   */
+  function generateRecordConfigurationRow($objKey){
+
+    /* Get some basic informations 
+     */
+    $obj        = $this->Devices[$objKey];
+    $objectName = $objKey;
+
+    /* Abort if emtpy
+     */
+    if(count($obj['RECORDS']) == 0) return "";
+
+    /* Set title 
+     */
+    $str= "<br>";
+
+    $hostNameOnce = true;
+
+    /* Walk through all defined records 
+     */
+    $str.= "<table cellspacing='0' cellpadding='0'>";
+    foreach($obj['RECORDS'] as $id => $record){
+
+      /* Skip not selectable entries */
+      if(!isset($this->RecordTypes [$record['type']])) {
+        continue;
+      }
+
+      /* Create unique post name
+       */
+      $name = base64_encode($objKey)."|".$id;
+
+      $str .= "<tr><td style='width:170px;'>\n";
+
+      /* Only first host entry name should be editable
+       */
+      if($hostNameOnce){
+        $hostNameOnce = false;  
+        $str .="<input type='text' name='RenameHost_".$name."' value='".$objectName."'>\n";
+      }
+
+      /* Create rest. Selectbox, icons ...
+       */
+      $str .="
+        </td>
+        <td style='width:90px;'>
+          ".$this->createRecordTypeSelection($record['type'],$name)."
+        </td>
+        <td>
+          <input type='text'  value='".$record['value']."' name='ValueSelection_".$name."' style='width:250px;'>
+        </td>
+        <td style='width:75px;text-align:right;'>
+          <input type='image' name='AddRecord_".$name."'   src='images/list_new.png' alt='"._("Add")."' title='"._("Add")."'>
+          <input type='image' name='RemoveRecord_".$name."' src='images/edittrash.png'      alt='"._("Remove")."' title='"._("Remove")."'>
+        ";
+
+#        if($record['type'] == "aRecord"){
+#          $str .="<input type='image' name='AddPtr_".$name."' src='images/network.png' 
+#                    alt='"._("Add PTR")."' title='"._("Add PTR record")."'>";
+#        }else{
+#          $str .= "<img src='images/empty.png' alt=''>";
+#        }
+
+      $str.=
+        "</td>
+      </tr>";
+    }
+    $str .="</table>";
+    return($str); 
+  }
+
+
+  /* Create selectbox with all available option types 
+   */
+  function createRecordTypeSelection($id,$refID){
+
+    $str = "\n<select name='RecordTypeSelection_".$refID."'>";
+    foreach($this->RecordTypes as $type => $atr) {
+      if($id == $type){
+        $str .="\n<option value='".$type."' selected >".strtoupper(preg_replace("/record/i","",$type))."</option>";
+      }else{
+        $str .="\n<option value='".$type."'>".strtoupper(preg_replace("/record/i","",$type))."</option>";
+      }
+    }
+    $str.= "\n</select>";
+    return($str);
+  }
+
+
+  function remove_from_parent()
+  {
+  }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/services/dns/class_termDNS.inc b/plugins/admin/systems/services/dns/class_termDNS.inc
new file mode 100644 (file)
index 0000000..0259332
--- /dev/null
@@ -0,0 +1,1012 @@
+<?php
+
+class termDNS extends plugin
+{
+  /* attribute list for save action */
+  var $ignore_account = true;
+  var $autonet        = false;
+
+  /* Basic informations 
+   */
+  var $attributes     = array("ipHostNumber","macAddress");
+  var $objectclasses  = array("whatever");
+
+  var $ipHostNumber   = "";    // IP address 
+  var $macAddress     = "";    // Mac address 
+
+  var $orig_ipHostNumber   = "";    // IP address 
+  var $orig_macAddress     = "";    // Mac address 
+
+  var $cn             = "";    // CN of currently edited device 
+  var $OrigCn         = "";    // Initial cn
+  var $IPisMust       = false;
+  var $MACisMust      = false;
+  var $dialog;
+
+  /* DCHP Attributes 
+   */
+  var $dhcpAttributes           = array("dhcpParentNode");
+  var $dhcpEnabled              = FALSE;
+  var $dhcp_is_Account          = FALSE;
+  var $dhcpParentNodes          = array();
+  var $dhcpParentNode           = "";
+  var $dhcpHostEntry            = array();
+  var $initial_dhcpParentNode   = "";
+  var $initial_dhcpHostEntry    = array();
+  var $initial_dhcp_is_Account  = FALSE;
+
+  var $used_ip_mac              = array();  
+
+  /* DNS attributes  
+   */
+  var $DNSattributes            = array("dNSClass","zoneName","dNSTTL");
+  var $DNS_is_account           = false;
+  var $initially_was_account = false;
+  var $dnsEntry                 = array();
+  var $DNSenabled               = false;
+  var $hide_dns_check_box       = FALSE;
+
+  /*  Terminal dns 
+   */
+  function termDNS (&$config, $parent,$objectClasses,$IPisMust = false)
+  {
+    /* We need to know which objectClasses are used, to store the ip/mac
+     * Because of different type of devices   
+     */ 
+    $this->parent         = $parent;
+    $this->objectclasses  =  $objectClasses;
+    $this->IPisMust       = $IPisMust;
+
+    plugin::plugin ($config, $parent->dn);
+
+    if(isset($this->attrs['cn'][0])){
+      $this->OrigCn = preg_replace("/\\\$\$/","",$this->attrs['cn'][0]);
+      $this->cn = preg_replace("/\\\$\$/","",$this->attrs['cn'][0]);
+    }
+
+    /************
+     * DHCP 
+     ************/
+
+    /* Hide all dhcp specific code, if dhcp plugin is not present in config */
+    $dhcpEnabled = FALSE;
+    if($this->config->search("servdhcp","class",array("tabs"))){
+      $this->dhcpEnabled = TRUE;
+    }
+    if($this->dhcpEnabled){
+      $this->dhcpParentNodes = $this->get_dhcp_parent_nodes();
+      $this->dhcpParentNode  = $this->get_dhcp_parent_node();
+      if($this->dhcpParentNode){
+        $this->dhcp_is_Account = TRUE;
+        $this->initial_dhcp_is_Account = TRUE;
+        $this->dhcpHostEntry  = $this->get_dhcp_host_entry();    
+      }
+      $this->initial_dhcpHostEntry = $this->dhcpHostEntry;
+      $this->initial_dhcpParentNode= $this->dhcpParentNode;
+    }
+
+
+    /************
+     * Autonetwork hook 
+     ************/
+    /* Do we have autonet support? */
+    if (isset($this->config->data['MAIN']['AUTO_NETWORK_HOOK'])){
+      $this->autonet= true;
+    }
+
+
+    /************
+     * DNS
+     ************/
+    /* Hide all dns specific code, if dns is not available 
+     */
+    $DNSenabled = false;
+    foreach($this->config->data['TABS']['SERVERSERVICE'] as $tab){
+      if(preg_match("/^servdns$/",$tab['CLASS'])){
+        $this->DNSenabled = true;
+      }
+    }
+    if(!$this->DNSenabled){
+      $this->DNS_is_account = false;
+      return;
+    }
+
+    if($this->DNSenabled){
+
+      /* Get Zones  
+       */
+      $this->Zones        = getAvailableZones($config);
+
+      /* Get Entry 
+       */
+      $this->dnsEntry     = getDNSHostEntries($config,$this->OrigCn);
+
+      /* Remove A record which equals $this->ipHostNumber
+       */
+      $ptr = $this->get_pTRRecord();
+      foreach($this->dnsEntry['RECORDS'] as $key => $rec){
+        if(($rec['type'] == "aRecord") && ($rec['value'] == $this->ipHostNumber)){
+          unset($this->dnsEntry['RECORDS'][$key]);
+        }
+        if(($rec['type'] == "pTRRecord") && ($rec['value'] == $ptr)){
+          unset($this->dnsEntry['RECORDS'][$key]);
+        }
+      }
+
+      /* Get Record types 
+       */
+      $this->RecordTypes  = getDnsRecordTypes();
+
+      /* If there is at least one entry in this -> types, we have DNS enabled 
+       */
+      if($this->dnsEntry['exists']){
+        $this->DNS_is_account = true;
+      }else{
+        $this->DNS_is_account = false;
+      }
+    }
+
+    /* Create a list of used mac and ip addresses */
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(|(macAddress=*)(ipHostNumber=*))",array("macAddress","ipHostNumber"));
+    while($attrs = $ldap->fetch()){
+      if(isset($attrs['ipHostNumber'][0])){
+        $this->used_ip_mac["ip:".$attrs['ipHostNumber'][0]] = "ip:".$attrs['ipHostNumber'][0];
+      }
+      if(isset($attrs['macAddress'][0])){
+        $this->used_ip_mac["mac:".$attrs['macAddress'][0]] = "mac:".$attrs['macAddress'][0];
+      }
+    } 
+
+    /* Save initial ip and mac values, to be able 
+        check if the used values are already in use */ 
+    $this->orig_ipHostNumber   = $this->ipHostNumber;  
+    $this->orig_macAddress     = $this->macAddress;
+    /* Store initally account settings 
+     */
+    $this->initially_was_account = $this->DNS_is_account;
+
+    if($this->DNS_is_account){
+      new log("view","unknown/".get_class($this),$this->dn);
+    }
+  }
+
+
+  function netmaskIsCoherent($idZone) 
+  {
+    $netmask = FlipIp(str_replace(".in-addr.arpa","",getNameFromMix($idZone)));
+    if(!strstr($this->ipHostNumber, $netmask)){
+      return false;
+    }else{
+      return true;
+    }
+  }
+
+
+  function getVarsForSaving($attrs) 
+  {
+    foreach($this->attributes as $attr){
+      if(!empty($this->$attr)){
+        $attrs[$attr] = $this->$attr;
+      }
+    }
+    return($attrs); 
+  }
+
+  function execute()
+  {
+         /* Call parent execute */
+    $smarty= get_smarty();
+
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+    $display= "";
+
+    $smarty->assign("staticAddress", ""); 
+    $smarty->assign("autonet", $this->autonet);
+    /* Check for autonet button */
+    if ($this->autonet && isset($_POST['autonet'])){
+      $cmd= $this->config->data['MAIN']['AUTO_NETWORK_HOOK'];
+      if(!empty($cmd) && $this->cn != ""){
+        $res = shell_exec($cmd." ".$this->cn);
+        if(!$res){
+          print_red(sprintf(_("Can't execute specified AUTO_NETWORK_HOOK '%s'. Please check your gosa.conf."),$cmd));
+        } else {
+          $res= split(';', trim($res));
+          if (isset($res[0]) && $res[0] != ""){
+            $this->ipHostNumber= $res[0];
+          }
+          if (isset($res[1]) && $res[1] != ""){
+            $this->macAddress= $res[1];
+          }
+        }
+      }
+    }
+    
+  
+    /**********
+     * DHCP Handling
+     **********/
+    if(isset($_POST['dhcpEditOptions'])){
+
+      if(count($this->dhcpHostEntry) == 0){
+        $this->dialog = new dhcpHost($this->dhcpParentNode,TRUE);
+      }else{
+        $this->dialog = new dhcpHost($this->dhcpHostEntry,TRUE);
+      }
+      $this->dialog->cn = $this->cn; 
+      $this->dialog->dhcpHWAddress = "ethernet ".$this->macAddress; 
+      if(!empty($this->ipHostNumber)){
+        $this->dialog->statements['fixed-address'] = $this->ipHostNumber; 
+      }
+    }
+
+    if(isset($_POST['cancel_dhcp'])){
+      $this->dialog = FALSE; 
+    }
+
+    if(isset($_POST['save_dhcp'])){
+      $this->dialog->save_object();
+      
+      $msgs = $this->dialog->check(array());
+      if(count($msgs)){
+        foreach($msgs as $msg){
+          print_red($msg);
+        }
+      }else{
+        $this->dhcpHostEntry = $this->dialog->save();
+        $this->dialog = FALSE; 
+      }
+    }
+
+    if(is_object($this->dialog)){
+      $this->dialog->save_object();
+      return($this->dialog->execute());
+    }
+    $smarty->assign("dhcpEnabled",    $this->dhcpEnabled);
+    $smarty->assign("dhcp_is_Account",$this->dhcp_is_Account);
+    $smarty->assign("dhcpParentNode", $this->dhcpParentNode);
+    $smarty->assign("dhcpParentNodes",$this->dhcpParentNodes);
+    $smarty->assign("dhcpParentNodeCnt",count($this->dhcpParentNodes));
+
+
+    /**********
+     * DNS Handling
+     **********/
+
+    /* There is no dns available
+     */
+    if($this->DNSenabled == false){
+
+      /* Is IP address must ? */
+      $smarty->assign("DNS_is_account",false);
+      $smarty->assign("IPisMust",(($this->IPisMust)||($this->DNS_is_account)));
+
+      /* Assign smarty all non DNs attributes */
+      foreach($this->attributes as $attr){
+        $smarty->assign($attr,$this->$attr);
+      }
+      $smarty->assign("staticAddress","<font class=\"must\">*</font>");
+
+      $display.= $smarty->fetch(get_template_path('network.tpl', TRUE));
+    }else{
+      $smarty->assign("DNS_is_account",true);
+
+      /* Add new empty array to our record list */
+      if(isset($_POST['AddNewRecord'])){
+        $this->dnsEntry['RECORDS'][]  =array("type"=>"aRecord","value"=>"");
+      }
+
+      /* propose_ip */
+      if(isset($_POST['propose_ip'])){
+        foreach($this->Zones as $key => $name){
+          if($name == $this->dnsEntry['zoneName']){
+            $net = FlipIp(str_replace(".in-addr.arpa","",getNameFromMix($key)));
+            $this->ipHostNumber = $this->generateRandomIp($net);
+          }
+        }
+      }
+
+      /* Handle all posts */
+      $only_once =true;
+      foreach($_POST as $name => $value){
+
+        /* Check if we have to delete a record entry */
+        if((preg_match("/RemoveRecord_/",$name))&&($only_once)) {
+
+          /* Avoid performing this once again */
+          $only_once = false;
+
+          /* Extract id for specified entry */
+          $id = preg_replace("/RemoveRecord_/","",$name);
+          $id = preg_replace("/_.*$/","",$id);
+
+          /* Delete this record, mark edited entries to be able to delete them */
+          if(isset($this->dnsEntry['RECORDS'][$id])){
+            unset($this->dnsEntry['RECORDS'][$id]);
+          }
+        }
+      }
+      /* Assign smarty all non DNs attributes */
+      foreach($this->attributes as $attr){
+        $smarty->assign($attr,$this->$attr);
+      }
+
+      /* Assign smarty all DNS attributes */
+      foreach($this->DNSattributes as $attr){
+        $smarty->assign($attr,$this->dnsEntry[$attr]);
+      }
+
+      /* Assign all needed vars */
+      $smarty->assign("DNSAccount",$this->DNS_is_account);
+      $smarty->assign("hide_dns_check_box",$this->hide_dns_check_box);
+  
+      $smarty->assign("Zones",$this->Zones);
+      $smarty->assign("ZoneCnt",count($this->Zones));
+      $smarty->assign("ZoneKeys",($this->Zones));
+      $smarty->assign("IPisMust",(($this->IPisMust)||($this->DNS_is_account)));
+
+      /* Create zone array */
+      $idZones = array();
+      foreach($this->Zones as $id => $zone){
+        if($this->netmaskIsCoherent($id)) {
+          $idZones[$id] = $zone;
+        }else{
+          $idZones[$id] = $zone."&nbsp;("._("Not matching").")";
+        }
+      }
+      $smarty->assign("Zones",$idZones);
+      $smarty->assign("ZoneKeys", $this->Zones);
+
+      $tmp = $this->generateRecordsList();
+
+      $changeStateForRecords = $tmp['changeStateForRecords'];
+
+      $smarty->assign("records",$tmp['str']);
+      $smarty->assign("changeStateForRecords",$changeStateForRecords);
+      $smarty->assign("staticAddress","<font class=\"must\">*</font>");
+
+      $display.= $smarty->fetch(get_template_path('network.tpl', TRUE));
+    }
+    return($display);
+  }
+
+
+  function remove_from_parent()
+  {
+    if($this->initially_was_account){
+
+      $ldap = $this->config->get_ldap_link();
+
+      $tmp = array();
+      $this->dnsEntry['exists'] = false;
+      $tmp = getDNSHostEntriesDiff($this->config,$this->OrigCn,$this->dnsEntry,$this->cn);
+
+      /* Delete dns */
+      foreach($tmp['del'] as $dn => $del){
+        $ldap->cd($dn);
+        $ldap->rmdir_recursive($dn);
+        new log("remove","unknown/".get_class($this),$dn);
+      }
+    }
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+
+    if(isset($_POST['network_tpl_posted'])){
+
+      /* Save all posted vars */
+      plugin::save_object();
+
+      /* Handle DHCP Posts*/
+      if($this->dhcpEnabled && isset($_POST['network_tpl_posted'])){
+        foreach($this->dhcpAttributes as $attr){
+          if(isset($_POST[$attr])){
+            $this->$attr = $_POST[$attr];
+          }
+        }
+        if(isset($_POST['dhcp_is_Account'])){
+          $this->dhcp_is_Account = TRUE;
+        }else{
+          $this->dhcp_is_Account = FALSE;
+        }
+      }
+
+      /* Ge all non dns attributes (IP/MAC)*/
+      foreach($this->attributes as $attr){
+        if(isset($_POST[$attr]) && $this->acl_is_writeable($attr)){
+          $this->$attr = $_POST[$attr];
+        }
+      }
+
+      /* Check if DNS should be enabled / disabled */
+      if($this->DNS_is_account && $this->acl_is_removeable() && !isset($_POST['DNS_is_account'])){
+        $this->DNS_is_account = false;
+      }elseif(!$this->DNS_is_account && $this->acl_is_createable() && isset($_POST['DNS_is_account'])){
+        $this->DNS_is_account = true;
+      }
+
+      /* Get dns attributes */
+      if(($this->DNSenabled) && (isset($_POST['network_tpl_posted']))){
+
+        /* Check for posted record changes */
+        if(is_array($this->dnsEntry['RECORDS']) && $this->acl_is_writeable("Records")){
+          foreach($this->dnsEntry['RECORDS'] as $key => $value){
+
+            /* Check if type has changed */
+            if(isset($_POST['RecordTypeSelectedFor_'.$key])){
+              $this->dnsEntry['RECORDS'][$key]['type'] = $_POST['RecordTypeSelectedFor_'.$key];
+            }
+            /* Check if value has changed */
+            if(isset($_POST['RecordValue_'.$key])){
+              $this->dnsEntry['RECORDS'][$key]['value'] = $_POST['RecordValue_'.$key];
+            }
+          }
+        }
+        /* Get all basic DNS attributes (TTL, Clas ..)*/
+        foreach($this->DNSattributes as $attr){
+          if(isset($_POST[$attr]) && $this->acl_is_writeable($attr)){
+            $this->dnsEntry[$attr] = $_POST[$attr];
+          }
+        }
+
+
+      }
+      if($this->hide_dns_check_box){
+        $this->DNS_is_account = true;
+      }
+    }
+  }
+
+
+  /* Check supplied data */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    if($this->dhcpEnabled && $this->dhcp_is_Account && $this->dhcpParentNode != "" && count($this->dhcpHostEntry) == 0){
+#      $message[] =_("You have not configured your dhcp settings yet.");
+    }
+    
+    /* Check if mac and ip are already used */
+    if(!empty($this->ipHostNumber) && $this->DNS_is_account && 
+        $this->ipHostNumber != $this->orig_ipHostNumber && 
+        in_array("ip:".$this->ipHostNumber,$this->used_ip_mac)){
+      $message[] =_("The specified IP address is already in use.");
+    }
+    if(!empty($this->macAddress) && $this->dhcp_is_Account && 
+        $this->macAddress != $this->orig_macAddress && 
+        in_array("mac:".$this->macAddress,$this->used_ip_mac)){
+      print_red(sprintf(_("The specified MAC address '%s' for this system '%s' is already in use."),$this->macAddress,$this->cn));
+    }
+
+    /* Check if ip must be given
+     */  
+    if(($this->IPisMust)||($this->DNS_is_account)){
+      if (empty($this->ipHostNumber)){
+        $message[]= _("The required field 'IP-address' is not set.");
+      }
+
+      if (!is_ip($this->ipHostNumber)){
+        $message[]= _("Wrong IP format in field IP-address.");
+      }
+    }
+
+    /* Check if mac is empty 
+     */
+    if ($this->macAddress == "" ){
+      $message[]= _("The required field 'MAC-address' is not set.");
+    }
+    if(!is_mac($this->macAddress)){
+      $message[]=(_("The given macaddress is invalid. There must be 6 2byte segments seperated by ':'."));
+    }
+
+    /* only perfrom this checks if this is a valid DNS account */
+    if($this->DNS_is_account){
+
+      $checkArray = array();
+      $onlyOnce   = array();
+
+      //  $onlyOnce['cNAMERecord'] = 0;
+       $tmp = array_flip($this->Zones);
+       $tmp2 = $tmp[$this->dnsEntry['zoneName']];
+       if(!$this->netmaskIsCoherent($tmp2)){ //this->dnsEntry['zoneName'])){
+         $tmp2 = preg_replace("/^.*\//","",$tmp2);
+         $message[] =sprintf(_("The specified IP address '%s' is not matching the selected reverse zone entry '%s'."),$this->ipHostNumber,$tmp2);
+       }
+
+      /* Walk through all entries and detect duplicates or mismatches
+       */  
+      foreach($this->dnsEntry['RECORDS'] as $name => $values){
+
+        /* Count record values, to detect duplicate entries for a specific record
+         */
+        if(!isset($checkArray[$values['type']][$values['value']])){
+          $checkArray[$values['type']][$values['value']] = 0;
+        }else{
+          $message[] = sprintf(_("Found duplicate value for record type '%s'."),$values['type']);
+        }
+
+        /* Check if given entries in $onlyOnce are used more than once
+         */
+        if(isset($onlyOnce[$values['type']])){
+          $onlyOnce[$values['type']] ++;
+          if($onlyOnce[$values['type']] > 1){
+            $message[] = sprintf(_("Found more than one entry for the uniqe record type '%s'."),$values['type']);
+          }
+        }
+
+        /* Skip txt record ... 
+         */
+        if($values['type'] == "tXTRecord") continue;
+
+        /* Check if there is an aRecord defined which uses the same IP as used in IPhostAddress 
+         */
+        if(($values['type'] == "aRecord")&&($values['value'] == $this->ipHostNumber)){
+          $message[]=sprintf(_("The device IP '%s' is added as 'A Record', this will be done automatically, please remove the record."), 
+               $this->ipHostNumber);
+        }
+
+        /* only lower-case is allowed in record entries ... 
+         */
+        if($values['value'] != strtolower($values['value'])){
+          $message[] = sprintf(_("Only lowercase is allowed, please check your '%ss'."),$values['type']);
+        }
+      }
+    }
+    return ($message);
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    $ldap= $this->config->get_ldap_link();
+  
+    $dn = $this->parent->dn;
+    /*******************/ 
+    /* IP-MAC HANDLING */
+    /*******************/ 
+
+    /* $dn was posted as parameter */
+    $this->dn = $dn;
+    
+    /* Save DNS setting & ip/Mac*/
+    plugin::save();
+
+    /* Write back to ldap */
+    $ldap->cd($this->dn);
+    $this->cleanup();
+    $ldap->modify ($this->attrs); 
+
+    /****************/ 
+    /* DHCP HANDLING */
+    /****************/ 
+  
+    /* New entry */
+    if($this->dhcpEnabled){
+
+      if(count($this->dhcpHostEntry) == 0){
+        $this->dialog = new dhcpHost($this->dhcpParentNode,TRUE);
+        $this->dialog->cn = $this->cn;
+        $this->dialog->dhcpHWAddress = "ethernet ".$this->macAddress;
+        if(!empty($this->ipHostNumber)){
+          $this->dialog->statements['fixed-address'] = $this->ipHostNumber;
+        }
+        $this->dialog->execute();
+        $this->dialog->save_object(); 
+        $this->dhcpHostEntry = $this->dialog->save();
+        if(count($this->dhcpHostEntry['dhcpOption']) == 0){
+          $this->dhcpHostEntry['dhcpOption']= array("host-name ".$this->cn);
+        }
+      }
+
+      if(count($this->dhcpHostEntry) == 0){
+        $this->dialog = new dhcpHost($this->dhcpParentNode,TRUE);
+        $this->dialog->cn = $this->cn;
+        $this->dialog->dhcpHWAddress = "ethernet ".$this->macAddress;
+        if(!empty($this->ipHostNumber)){
+          $this->dialog->statements['fixed-address'] = $this->ipHostNumber;
+        }
+        $this->dialog->execute();
+        $this->dialog->save_object(); 
+        $this->dhcpHostEntry = $this->dialog->save();
+        if(count($this->dhcpHostEntry['dhcpOption']) == 0){
+          $this->dhcpHostEntry['dhcpOption']= array("host-name ".$this->cn);
+        }
+      }
+
+      /* Write mac address to dhcp settings */
+      if($this->dhcp_is_Account){
+        if(!isset($this->dhcpHostEntry['dhcpHWAddress'][0]) || 
+            !preg_match("/ethernet ".$this->macAddress."/",$this->dhcpHostEntry['dhcpHWAddress'][0])){
+          $this->dhcpHostEntry['dhcpHWAddress'] = array("ethernet ".$this->macAddress);
+          $this->dhcpHostEntry['MODIFIED'] = TRUE;
+        }
+      }
+  
+
+      /* Unset dhcpStatements if this attribute is empty  */
+      if(isset($this->dhcpHostEntry['dhcpStatements']) && 
+          ($this->dhcpHostEntry['dhcpStatements'] == "" || count($this->dhcpHostEntry['dhcpStatements']) == 0) ){
+        unset($this->dhcpHostEntry['dhcpStatements']);
+      }
+  
+      /* DHCP removed */
+      if($this->initial_dhcp_is_Account && !$this->dhcp_is_Account){
+        $ldap->rmdir_recursive($this->dhcpHostEntry['dn']);
+        show_ldap_error($ldap->get_error(),_("Removing dhcp entry for this object failed."));
+
+        $tmp = new servdhcp($this->config,$this->dhcpParentNode);
+        $tmp->handle_post_events("remove");
+      }
+
+      /* DHCP Added */
+      if(!$this->initial_dhcp_is_Account && $this->dhcp_is_Account){
+        $attrs = $this->dhcpHostEntry;
+        unset($attrs['MODIFIED']);
+        unset($attrs['dn']);
+        $ldap->cd("cn=".$this->cn.",".$this->dhcpParentNode);
+        $res = $ldap->add($attrs);
+
+        $tmp = new servdhcp($this->config,$this->dhcpParentNode);
+        $tmp->handle_post_events("add");
+
+        show_ldap_error($ldap->get_error(),_("Tried to add new dhcp entry failed."));
+      }
+
+      /* DHCP still activated */
+      if($this->initial_dhcp_is_Account && $this->dhcp_is_Account){
+
+        /* DHCP node changed */
+        if(($this->initial_dhcpParentNode != $this->dhcpParentNode) || 
+           ($this->cn != $this->OrigCn)){
+          $attrs = $this->dhcpHostEntry;
+          $attrs['cn'] = $this->cn;
+          unset($attrs['dn']);
+          unset($attrs['MODIFIED']);
+          $ldap->cd("cn=".$this->cn.",".$this->dhcpParentNode);
+          $res = $ldap->add($attrs);
+
+          $tmp = new servdhcp($this->config,$this->dhcpParentNode);
+          $tmp->handle_post_events("modify");
+
+          show_ldap_error($ldap->get_error(),_("Tried to add new dhcp entry failed."));
+          if($res){
+            $ldap->rmdir_recursive($this->dhcpHostEntry['dn']);
+            show_ldap_error($ldap->get_error(),_("Removing old dhcp entry failed."));
+          }
+        }
+         
+        /* SAME node but modified */ 
+        if(isset($this->dhcpHostEntry['MODIFIED']) && $this->dhcpHostEntry['MODIFIED'] == 1  && 
+            $this->initial_dhcpParentNode == $this->dhcpParentNode){
+          $attrs = $this->dhcpHostEntry;
+          unset($attrs['dn']);
+          unset($attrs['MODIFIED']);
+          $ldap->cd($this->dhcpHostEntry['dn']);
+          $ldap->modify($attrs);
+          
+          $tmp = new servdhcp($this->config,$this->dhcpParentNode);
+          $tmp->handle_post_events("modify");
+
+          show_ldap_error($ldap->get_error(),_("Modifying dhcp entry failed."));
+        }    
+      }
+    }
+      
+
+    /****************/ 
+    /* DNS HANDLING */
+    /****************/ 
+
+    /* If isn't DNS account but initially was DNS account 
+       remove all DNS entries 
+     */ 
+    if((!$this->DNSenabled) || ((!$this->DNS_is_account)&&(!$this->initially_was_account))){
+      return;
+    }else{
+
+      /* Add ipHostNumber to aRecords
+       */
+      $backup_dnsEntry = $this->dnsEntry;
+      if(!empty($this->ipHostNumber)){
+        $this->dnsEntry['RECORDS'][] = array("type"=>"aRecord","value"=>$this->ipHostNumber);
+        $ptr = $this->get_pTRRecord();
+        if(!empty($ptr)){
+          $this->dnsEntry['RECORDS'][] = array("type"=>"pTRRecord","value"=>$ptr);
+        } 
+      }
+
+      /* Create diff and follow instructions 
+       * If Account was disabled, remove account by setting exists to false
+       */
+      if((!$this->DNS_is_account)&&($this->initially_was_account)){  
+        $this->dnsEntry['exists'] = false;
+        $tmp = getDNSHostEntriesDiff($this->config,$this->OrigCn,$this->dnsEntry,$this->cn);
+      }else{
+        $this->dnsEntry['exists'] = $this->DNS_is_account;
+        $tmp = getDNSHostEntriesDiff($this->config,$this->OrigCn,$this->dnsEntry,$this->cn);
+      }   
+
+      /* move follwoing entries 
+       */
+      foreach($tmp['move'] as $src => $dst){
+        $this->recursive_move($src,$dst);
+      }
+
+      /* Delete dns */
+      foreach($tmp['del'] as $dn => $del){
+        $ldap->cd($dn);
+        $ldap->rmdir_recursive($dn);
+        new log("modify","unknown/".get_class($this),$dn,array("*"),$ldap->get_error());
+      }
+
+      /* Add || Update new DNS entries 
+       */
+      foreach($tmp['add'] as $dn => $attrs){
+        $ldap->cd($dn);
+        $ldap->cat($dn, array('dn'));
+        if(count($ldap->fetch())){
+          $ldap->cd($dn);
+          $ldap->modify ($attrs); 
+        }else{
+          $ldap->cd($dn);
+          $ldap->add($attrs);
+        }
+        new log("modify","unknown/".get_class($this),$dn,array_keys($attrs),$ldap->get_error());
+      }
+
+
+      /* Display errors 
+       */
+      if($ldap->get_error() != "Success"){
+        show_ldap_error($ldap->get_error(), sprintf(_("Saving of terminal/dns account with dn '%s' failed."),$this->dn));
+      }
+
+      $tmp2 = new servdns($this->config,$this->dn);
+      $tmp2->handle_post_events("modify");
+
+      $this->dnsEntry =  $backup_dnsEntry;
+    }
+  }
+
+  /*  Create html table with all used record types
+   */
+  function generateRecordsList()
+  {
+    $changeStateForRecords = "";
+    
+    if(!$this->DNS_is_account) {
+      $str = "<input type='submit' value='"._("Add")."' name='AddNewRecord' id='AddNewRecord' disabled='disabled'>";
+      return(array("str" => $str, "changeStateForRecords"=> ""));
+    }
+    $str = "<table summary='' width='100%'>";
+    foreach($this->dnsEntry['RECORDS'] as $key => $entry){
+
+        $changeStateForRecords.= "changeState('RecordTypeSelectedFor_".$key."');\n";
+        $changeStateForRecords.= "changeState('RecordValue_".$key."');\n";
+        $changeStateForRecords.= "changeState('RemoveRecord_".$key."');\n";
+
+        $str.=" <tr>".
+          "   <td>".$this->generateRecordListBox($entry['type'],"RecordTypeSelectedFor_".$key)."</td>".
+          "   <td><input type='text' value='".$entry['value']."' name='RecordValue_".$key."' id='RecordValue_".$key."'></td>".
+          "   <td><input type='submit' name='RemoveRecord_".$key."' value='"._("Delete")."' id='RemoveRecord_".$key."'></td>".
+          "</tr>";
+    }
+
+    $str.= "  <tr>".
+           "    <td colspan=2 width='50%'></td><td>".
+           "      <input type='submit' value='"._("Add")."' name='AddNewRecord' id='AddNewRecord'>".
+           "    </td>".
+           "  </tr>".
+           "</table>";
+     $ret =  array("str" => $str, "changeStateForRecords" => $changeStateForRecords);
+    return($ret);
+  }
+
+
+  /* Create a html select box which allows us to select different types of records 
+   */
+  function generateRecordListBox($selected,$name)
+  {
+    $str = "<select name='".$name."' id='".$name."'>";
+    foreach($this->RecordTypes as $type => $value){
+      $use = "";
+      if($type == $selected){
+        $use = " selected ";
+      }
+      $str.="\n <option value='".$type."' ".$use.">".strtoupper(preg_replace("/record/i","",$type))."</option>";
+    }
+    $str.="</select>";
+    return($str); 
+  }
+
+
+  /* Return plugin informations for acl handling  */ 
+  static function plInfo()
+  {
+    $tmp =  array(
+        "plShortName"   => _("DNS"),
+        "plDescription" => _("DNS settings"),
+        "plSelfModify"  => FALSE,
+        "plDepends"     => array(),
+        "plPriority"    => 5,
+        "plSection"     => array("administration"),
+        "plCategory"    => array("workstation","terminal","phone","server","component","printer","winworkstation"),
+
+        "plProvidedAcls"=> array(
+          "ipHostNumber"  => _("IP address"),
+          "macAddress"    => _("MAC address"))
+        );
+
+    /* Hide all dns specific code, if dns is not available
+     */
+    foreach($_SESSION['config']->data['TABS']['SERVERSERVICE'] as $tab){
+      if(preg_match("/^servdns$/",$tab['CLASS'])){
+        $tmp['plProvidedAcls']["Records"]        = _("DNS records");
+        $tmp['plProvidedAcls']["zoneName"]       = _("Zone name");
+        $tmp['plProvidedAcls']["dNSTTL"]         = _("TTL");
+        break;
+      }
+    }
+    return($tmp);
+  }
+
+  
+  function get_dhcp_host_entry()
+  {
+    $attrs = array();
+    $dn = $this->get_dhcp_host_entry_dn();
+    if($dn){
+      $ldap = $this->config->get_ldap_link();
+      $ldap->cd($this->config->current['BASE']);
+      $ldap->cat($dn,array("*"));
+      if($ldap->count()){
+        $attrs = $ldap->fetch();
+        foreach($attrs as $key => $value){
+          if(is_numeric($key) || ($key == "count")){
+            unset($attrs[$key]);
+          }
+          if(is_array($value) && isset($value['count'])){
+            unset($attrs[$key]['count']);
+          }
+        }
+      }
+    }
+    return($attrs);
+  }
+
+
+  function get_dhcp_host_entry_dn()
+  {
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search ("(&(objectClass=dhcpHost)(cn=".$this->cn."))",array("cn","dn"));
+
+    if($ldap->count()){
+      $attr = $ldap->fetch();
+      return($attr['dn']);
+    }else{
+      return("");
+    }
+  }  
+
+
+  function get_dhcp_parent_node()
+  {
+    return(preg_replace("/^cn=".normalizePreg($this->cn).",/","",$this->get_dhcp_host_entry_dn()));
+  }
+
+
+  function get_dhcp_parent_nodes()
+  {
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(objectClass=dhcpService)",array("dhcpPrimaryDN"));
+    
+    $dhcp_dns = array();
+    while($attr = $ldap->fetch()){
+      $dhcp_dns[$attr['dn']] = $attr['dhcpPrimaryDN'][0];
+    }
+    foreach($dhcp_dns as $key => $pri_dns){
+      $ldap->cat($pri_dns,array("cn"));
+      $tmp = $ldap->fetch();
+      if(isset($tmp['cn'][0])){
+        $dhcp_dns[$key] = $tmp['cn'][0];
+      }else{
+        unset($dhcp_dns[$key]);
+      }
+    }
+
+    $tmp = $tmp2 = array();
+    foreach($dhcp_dns as $dn => $cn){
+      $ldap->cd($dn);
+      $ldap->search("(|(objectClass=dhcpService)(objectClass=dhcpGroup)".
+                    "(objectClass=dhcpSubnet)(objectClass=dhcpSharedNetwork))",array("cn"));
+      while($attr = $ldap->fetch()){
+        $tmp[$attr['dn']] = $attr['cn'][0];
+      }
+      $tmp2 = array_merge($tmp2,$this->create_tree($tmp,preg_replace("/^[^,]+,/i","",$dn),"(".$cn.")&nbsp;"));
+    }
+    return($tmp2);
+  }
+
+  
+  /* this function returns the default ptr record entry */
+  function get_pTRRecord()
+  {
+    if(!empty($this->ipHostNumber) && isset($this->dnsEntry['zoneName']) && !empty($this->dnsEntry['zoneName'])){
+      $ldap = $this->config->get_ldap_link();
+      $ldap->cat(getDNSZoneDN($this->config,$this->dnsEntry['zoneName']));
+      $attrs = $ldap->fetch();
+      $tmp = array_flip($this->Zones);
+      $tmp = preg_replace("/^[^\/]*+\//","",$tmp[$this->dnsEntry['zoneName']]);
+      $tmp = trim(preg_replace("/\.in-addr.arpa$/","",$tmp));
+      $ptr = preg_replace("/^".normalizePreg(FlipIp($tmp))."\./","",$this->ipHostNumber);
+      return($ptr);
+    }else{
+      return(FALSE);
+    }
+  }
+
+  
+  function generateRandomIP($net = "")
+  {
+    $str = $net;
+    $cnt = 4;
+    while(substr_count($str,".") < 3 && $cnt > 0){
+      $str .= ".".rand(0,255);
+      $str = preg_replace("/\.\.*/",".",$str);
+      $str = trim($str,". ");
+      $cnt --;
+    }
+    return($str);
+  }
+
+  
+  function create_tree($arr,$base,$current = "")
+  {
+    $ret = array();
+    foreach($arr as $r => $name){
+      $base_part = str_replace($base,"",$r);
+      if(preg_match("/^[a-z]*=".normalizePreg($name)."(|,)$/i",$base_part)){
+        $ret[$r] = $current.$name;
+        $tmp = $this->create_tree($arr,$r,$current.".&nbsp;");
+        foreach($tmp as $sub_key => $sub_name){
+          $ret[$sub_key] = $sub_name;
+        }
+      } 
+    }
+    return($ret);
+  }
+
+  function force_dns()
+  {
+    if($this->DNSenabled){
+      $this->DNS_is_account  = TRUE;
+      $this->hide_dns_check_box = TRUE;
+    }
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/services/dns/servDNSeditZoneEntries.tpl b/plugins/admin/systems/services/dns/servDNSeditZoneEntries.tpl
new file mode 100644 (file)
index 0000000..9c0428c
--- /dev/null
@@ -0,0 +1,27 @@
+<h2>{t}This dialog allows you to configure all components of this DNS zone on a single list.{/t}</h2>
+<p class="seperator">&nbsp;</p>
+{if $disableDialog}
+       <br><b>
+       {t}This dialog can't be used until the currently edited zone was saved or the zone entry exists in the ldap database.{/t}
+       </b>
+{else}
+       <br>
+       {$table}
+       <br>
+       <input type='submit' name='UserRecord' value='{t}New entry{/t}' title='{t}Create a new DNS zone entry{/t}'>
+{/if}
+
+<p class="seperator">&nbsp;</p>
+<div style="text-algin:right;" align="right">
+    <p>
+        <input type="submit" name="SaveZoneEntryChanges" value="{t}Save{/t}">
+        <input type="submit" name="CancelZoneEntryChanges" value="{t}Cancel{/t}">
+    </p>
+</div>
+
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('zoneName');
+  -->
+</script>
+                                                                            
diff --git a/plugins/admin/systems/services/dns/servdns.tpl b/plugins/admin/systems/services/dns/servdns.tpl
new file mode 100644 (file)
index 0000000..6cfa50f
--- /dev/null
@@ -0,0 +1,63 @@
+{if $dns_take_over}
+<table summary="" width="100%">
+    <tr>
+        <td style="width:100%;vertical-align:top;">
+            <h2>{t}DNS take over initiated{/t}</h2>
+            {$warning}
+            {t}This includes 'all' DNS zones that are located within this server. Please double check if your really want to do this.{/t}
+            <p>
+            {$warning2}
+            <br>
+            <input type='submit' name='cancel_take_over' value='{t}Cancel{/t}'>
+            </p>
+            <p>
+            {t}Following objects will be taken over{/t}&nbsp;:
+            </p>
+            <p>
+            <pre>{$info}</pre>
+            </p>
+        </td>
+    </tr>
+</table>
+{else}
+<table summary="" width="100%">
+{if $dns_server_list_cnt}
+<tr>
+    <td style="width:100%;vertical-align:top;">
+        <b>{t}Take over DNS configuration from{/t}</b>&nbsp;
+        <select name='take_over_src'>
+            {html_options options=$dns_server_list}
+        </select>
+        <input type="submit" name="take_over" value="{t}Take over{/t}">
+    </td>
+</tr>
+{/if}
+<tr>
+    <td style="width:100%;vertical-align:top;">
+<h2>{t}Zones{/t}</h2>
+                 {$ZoneList}
+                 {if $is_createable}
+                 <input type="submit" name="AddZone" value="{t}Add{/t}">
+                 {else}
+                 <input type="button" value="{t}Add{/t}" disabled>
+                 {/if}
+    </td>
+</tr>
+</table>
+
+
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('AddZone');
+  -->
+</script>
+
+{/if}
+<p class="seperator">&nbsp;</p>
+<p>
+<div style="width:100%; text-align:right;">
+    <input type='submit' name='SaveService' value='{t}Save{/t}'>
+    &nbsp;
+    <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
+</div>
+</p>
diff --git a/plugins/admin/systems/services/dns/servdnseditzone.tpl b/plugins/admin/systems/services/dns/servdnseditzone.tpl
new file mode 100644 (file)
index 0000000..1136dba
--- /dev/null
@@ -0,0 +1,177 @@
+<h2>{t}Generic{/t}</h2>
+<table summary="" width="100%">
+       <tr>
+               <td style="width:50%;vertical-align:top;border-right:1px        solid   #b0b0b0;">
+                       <table summary="">
+                               <tr>
+                                       <td>{t}Zone name{/t}{$must}
+                                       </td>
+                                       <td>
+{render acl=$ACLs}                                     
+                                               <input type="text" name="zoneName" value="{$zoneName}" {if $NotNew} disabled {/if}>
+{/render}
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>{t}Network address{/t}{$must}
+                                       </td>
+                                       <td>
+{render acl=$ACLs}                                     
+                                               <input type="text" name="ReverseZone" value="{$ReverseZone}" {if $NotNew} disabled {/if}>
+{/render}
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>{t}Netmask{/t}
+                                       </td>
+                                       <td>
+{render acl=$ACLs}                                     
+                                               <select name="NetworkClass" {if $NotNew} disabled {/if}>
+                                                       {html_options options=$NetworkClasses selected=$NetworkClass }
+                                               </select>
+{/render}
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+               <td style="vertical-align:top;">
+                       <table summary="">
+                               <tr>
+                                       <td>
+                                               {t}Zone records{/t}
+                                               <br>
+                                               {if $AllowZoneEdit == false}
+                                                       <i>{t}Can't be edited because the zone wasn't saved right now.{/t}</i>
+                                               {/if}
+                                       </td>
+                                       <td>
+{render acl=$ACLs}                                     
+                                               <input type="submit" name="EditZoneEntries" value="{t}Edit{/t}" {if $AllowZoneEdit == false} disabled {/if}> 
+{/render}
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+       </tr>
+</table>
+<p class="seperator">&nbsp;</p>
+<h2>{t}SOA record{/t}</h2>
+<table summary="" width="100%">
+       <tr>
+               <td style="vertical-align:top;width:50%;border-right:1px        solid   #b0b0b0;">
+                       <table summary="">
+                               <tr>
+                                       <td>{t}Primary dns server for this zone{/t}{$must}
+                                       </td>
+                                       <td>
+{render acl=$ACLs}                                     
+                                               <input type="text" name="sOAprimary" value="{$sOAprimary}">
+{/render}
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>{t}Mail address{/t}{$must}
+                                       </td>
+                                       <td>
+{render acl=$ACLs}                                     
+                                               <input type="text" name="sOAmail" value="{$sOAmail}">
+{/render}
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>{t}Serial number (automatically incremented){/t}{$must}
+                                       </td>
+                                       <td>
+{render acl=$ACLs}                                     
+                                               <input type="text" name="sOAserial" value="{$sOAserial}">
+{/render}
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+               <td style="vertical-align:top;">
+                       <table summary="">
+                               <tr>
+                                       <td>{t}Refresh{/t}{$must}
+                                       </td>
+                                       <td>
+{render acl=$ACLs}                                     
+                                               <input type="text" name="sOArefresh" value="{$sOArefresh}">
+{/render}
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>{t}Retry{/t}{$must}
+                                       </td>
+                                       <td>
+{render acl=$ACLs}                                     
+                                               <input type="text" name="sOAretry" value="{$sOAretry}">
+{/render}
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>{t}Expire{/t}{$must}
+                                       </td>
+                                       <td>
+{render acl=$ACLs}                                     
+                                               <input type="text" name="sOAexpire" value="{$sOAexpire}">
+{/render}
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>{t}TTL{/t}{$must}
+                                       </td>
+                                       <td>
+{render acl=$ACLs}                                     
+                                               <input type="text" name="sOAttl" value="{$sOAttl}">
+{/render}
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+       </tr>
+</table>
+
+<p class="seperator">&nbsp;</p>
+<br>
+<table summary="" width="100%">
+       <tr>
+               <td style="vertical-align:top;width:50%;border-right:1px        solid   #b0b0b0;">
+                       <h2>{t}MxRecords{/t}</h2>
+                       <table width="100%">    
+                               <tr>
+                                       <td>
+{render acl=$ACLs}                                     
+                                               {$Mxrecords}
+{/render}
+{render acl=$ACLs}                                     
+                                               <input type="text"              name="StrMXRecord" value="">
+{/render}
+{render acl=$ACLs}                                     
+                                               <input type="submit"    name="AddMXRecord" value="{t}Add{/t}">
+{/render}
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+               <td style="vertical-align:top;">
+                       <h2>{t}Global zone records{/t}</h2>
+{render acl=$ACLs}                                     
+                         {$records}
+{/render}
+               </td>
+       </tr>
+</table>
+<div style="text-algin:right;" align="right">
+       <p>
+{render acl=$ACLs}                                     
+               <input type="submit" name="SaveZoneChanges" value="{t}Save{/t}">
+{/render}
+               <input type="submit" name="CancelZoneChanges" value="{t}Cancel{/t}">
+       </p>
+</div>
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('zoneName');
+  -->
+</script>
diff --git a/plugins/admin/systems/services/glpi/class_glpiAccount.inc b/plugins/admin/systems/services/glpi/class_glpiAccount.inc
new file mode 100644 (file)
index 0000000..e641108
--- /dev/null
@@ -0,0 +1,806 @@
+<?php
+
+class glpiAccount 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= FALSE;
+  var $attributes= array("ID","name","contact",
+      "tech_num","comments","date_mod","os","location","domain","network","contact_num",
+      "model","type","is_template","FK_glpi_enterprise","deleted");
+
+  var $ID                 ;       // Is set if this entry is edited 
+  var $name               = "";    // This should be the dn of this entry 
+  var $contact            = "";    // Empty
+    
+  var $comments           = "";    // Comment
+  
+  var $contact_num        = "";    // Contact person
+  var $tech_num           = "";    // Technical responsible person
+  
+  var $addUser            = "";    // This is used to remember if a dialog was opened for tech_num or contact_num 
+
+  var $date_mod           = "";    // Modification timestamp
+  var $os                 = 0;     // Operating system
+  var $location           = 0;     // Not used yet
+  var $domain             = 0;     // ? Set to 0
+  var $network            = 0;     // ? Set to 0 
+
+  var $model              = 0;     // ? Can't remember this, it isn't used in GOsa 
+  var $type               = 0;     // System type id
+  var $is_template        = 0;     // Used as template ?
+  var $FK_glpi_enterprise = 0;     // Manufacturer id
+  var $deleted            = "N";   // Deleted entries should have this set to Y
+
+  var $renameTypeDialog   = false;
+  var $renameOSDialog     = false;
+  var $select_type        ;
+  var $view_logged = FALSE;
+  
+  /* Not necessary, cause we use mysql databse */
+  var $objectclasses= array("whatever");
+
+  /* Used to remember if this was an account (simply: is this an edited entry) */
+  var $initially_was_account = false;
+
+  /* Remember current dialog */
+  var $edit_type            = false;
+  var $edit_os              = false;
+
+  var $data;
+  var $handle = NULL;               // Glpi class handle used to query database
+
+  var $cur_dialog = NULL;           // This contains the sub dialog handle
+
+  var $orig_dn;                     // To check if dn, has changed 
+  var $ui;                          // Some GOsa specific user informations 
+  
+  var $usedDevices      = array();  // Which devices are currently selected 
+  var $usedAttachments  = array();  // Used Attachments 
+
+  /* Contructor 
+     Sets default values and checks if we already have an existing glpi account
+   */
+  function glpiAccount (&$config, $dn= NULL, $parent= NULL)
+  {
+    plugin::plugin ($config, $dn, $parent);
+    $this->ui= get_userinfo();
+
+    /* Abort class construction, if no db is defined */
+    if(!isset($this->config->data['SERVERS']['GLPI'])){
+      return;
+    }
+
+    // Get informations about databse connection
+    $this->data = $this->config->data['SERVERS']['GLPI'];
+
+    // Abort if mysql extension is missing 
+    if(!is_callable("mysql_connect")){
+      return;
+    }
+
+    // Create handle of glpi class, and check if database connection is established 
+    $this->handle = new glpiDB($this->data['SERVER'],$this->data['LOGIN'],$this->data['PASSWORD'],$this->data['DB']);
+
+    if(!$this->handle->is_connected){
+      return;
+    } 
+
+    // If this dn is already used in database, then get all informations for this entry 
+    if($this->handle->is_account($this->dn)){
+      $this->is_account = true;
+      $tmp = ($this->handle->getComputerInformations($this->dn));
+
+      foreach(array("tech_num","os","FK_glpi_enterprise","type","comments","contact_num") as $attr){
+        $this->$attr = $tmp[0][$attr];
+      }
+      $this->usedDevices = $this->handle->getUsedDevices($tmp[0]['ID']);
+      $atts = $this->handle->getAssignAttachments($tmp[0]['ID']);
+      foreach($atts as $attachment){
+        
+        $this->usedAttachments[$attachment['FK_doc']]=$attachment['FK_doc']; 
+      }
+    }else{
+      $this->is_account = false;
+    }
+
+    /* set defaults */
+    $this->name                 = $this->dn;
+    $this->orig_dn              = $this->dn;
+    $this->initially_was_account = $this->is_account;
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","all/".get_class($this),$this->dn);
+    }
+
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+    $display= "";
+
+    /*  Assign smarty defaults 
+        To avoid undefined indexes, if there is an error with the glpi db
+     */ 
+    foreach(array("SystemTypes","SystemTypeKeys","Manufacturers",
+                  "OSs","TechnicalResponsibles","InstalledDevices","Attachments","AttachmentKeys",
+                  "OSKeys","OSs","ManufacturerKeys","InstalledDeviceKeys") as $attr){
+      $smarty->assign($attr,array());
+    }
+    foreach(array("type","FK_glpi_enterprise","os","tech_num","comments","contact_num","AttachmentsDiv") as $attr){
+      $smarty->assign($attr,"");
+    }
+
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation) {
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+    /* Check if there is a glpi database server defined 
+      */
+    if(!isset($this->config->data['SERVERS']['GLPI'])){
+      print_red(_("There is no server with valid glpi database service."));
+      return($smarty->fetch(get_template_path('glpi.tpl', TRUE)));
+    }
+
+    $this->data = $this->config->data['SERVERS']['GLPI'];
+
+    /* Check if we can call mysql_connect 
+       If we can't, there is no the mysql-php extension
+     */
+    if(!is_callable("mysql_connect")){
+      print_red(_("Can't connect to glpi database, the php-mysql extension is missing."));
+      return($smarty->fetch(get_template_path('glpi.tpl', TRUE)));
+    }
+
+    $this->handle = new glpiDB($this->data['SERVER'],$this->data['LOGIN'],$this->data['PASSWORD'],$this->data['DB']);
+
+    /*  If handle == false, abort
+        Seems that the server, username and or password is wrong
+     */
+    if(!$this->handle->is_connected){
+      print_red(_("Can't connect to glpi database, check configuration twice."));
+      return($smarty->fetch(get_template_path('glpi.tpl', TRUE)));
+    } 
+
+    /*  All checks are ok
+        Lets handle Posts, templates etc below ...
+     */
+    
+    $users = $this->handle->getUsers();
+    $ldap= $this->config->get_ldap_link();
+    /* Check for Trading button Post
+     */
+    if(isset($_POST['Trading'])){
+      print_red(_("This feature is not implemented yet."));
+    }
+
+    /* Check for Software button Post
+     */
+    if(isset($_POST['Software'])){
+      print_red(_("This feature is not implemented yet."));
+    }
+
+    /* Check for Contract button Post
+     */
+    if(isset($_POST['Contracts'])){
+      print_red(_("This feature is not implemented yet."));
+    }
+    /* Add Device was requested, open new dialog
+     */
+    if((isset($_POST['AddDevice'])) && ($this->acl_is_writeable("Devices"))){
+      $this->dialog =true;
+      $this->cur_dialog = new glpiDeviceManagement($this->config,$this->dn,$this->usedDevices);
+    }
+
+    /* Attachment pool was closed with use
+     */
+    if(isset($_POST['UseAttachment']) && ($this->acl_is_writeable("Attachments"))){
+      if(count($this->cur_dialog->check())){
+        foreach($this->cur_dialog->check() as $msg){
+          print_red($msg);
+        }
+      }else{
+        $this->cur_dialog->save_object();
+        $this->usedAttachments = $this->cur_dialog->save();
+        $this->cur_dialog = false;
+        $this->edit_type = false; 
+      }
+    }
+   
+    /* Attachment pool was closed with abort
+     */ 
+    if(isset($_POST['AbortAttachment'])){
+      $this->cur_dialog = false;
+      $this->edit_type = false; 
+    }
+
+    /* Open Attachment pool to add/edit Attachments
+     */
+    if(isset($_POST['AddAttachment']) && ($this->acl_is_writeable("Attachments"))){
+      $this->cur_dialog = new glpiAttachmentPool($this->config,$this->dn,$this->usedAttachments);
+      $this->dialog = true;
+    }
+    
+    /* Remove Attachment fro this tab 
+     */
+    $once = true;
+    foreach($_POST as $name => $value){
+      if((preg_match("/^delAttachment_/",$name))&&($once) && $this->acl_is_writeable("Attachments")){
+        $once= false;
+        $name = preg_replace("/^delAttachment_/","",$name);
+        $entry = preg_replace("/_.*$/","",$name);
+        if(isset($this->usedAttachments[$entry])){
+          unset($this->usedAttachments[$entry]);
+        }
+      }
+    }
+    if((isset($_POST['RemoveAttachment']))&&(isset($_POST['Attachments'])) && ($this->acl_is_writeable("Attachments"))){
+      foreach($_POST['Attachments'] as $entry){
+        if(isset($this->usedAttachments[$entry])){
+          unset($this->usedAttachments[$entry]);
+        }
+      }
+    }
+
+    /* We have selected some devices and pressed use button 
+     */
+    if(isset($_POST['SelectDeviceSave']) && $this->acl_is_writeable("Devices")){
+      $this->cur_dialog->save_object();
+      $this->usedDevices= ($this->cur_dialog->getSelected());
+      $this->cur_dialog = false;
+      $this->dialog = false;
+      $this->edit_type=false;
+    }
+
+    /* Aborted Device selction 
+     */
+    if(isset($_POST['SelectDeviceCancel']) && ($this->acl_is_writeable("Devices"))){
+      $this->dialog = false;
+      $this->cur_dialog = false;
+      $this->edit_type=false;
+    }
+
+    /* System type management
+     */
+    if(isset($_POST['edit_type']) && $this->acl_is_writeable("type")){
+      $this->dialog = true;
+      $this->edit_type=true;
+    }
+
+    /* This closes the system type editing dialog
+     */
+    if(isset($_POST['close_edit_type']) && ($this->acl_is_writeable("type"))){
+      $this->edit_type=false;
+      $this->dialog = false;
+    }
+
+    if(isset($_POST['Rename_Cancel'])){
+      $this->renameTypeDialog = false;
+      $this->renameOSDialog = false;
+    }
+
+    /* This appends a new system to our sytem types
+     */
+    if((isset($_POST['add_type']))&&(!empty($_POST['type_string'])) && $this->acl_is_writeable("type")){
+      $attr = $this->handle->getSystemTypes();
+      if(in_array(trim($_POST['type_string']),$attr)){
+        print_red(_("Adding new sytem type failed, this system type name is already used.")) ;
+      }else{
+        $this->handle->addSystemType(trim($_POST['type_string']));  
+      }
+    }
+
+    /* Remove selected type from our system types list
+     */
+    if((isset($_POST['del_type']))&&(!empty($_POST['select_type'])) && $this->acl_is_writeable("type")){
+      $tmp = $this->handle->is_systemTypeUsed($_POST['select_type']);
+      if(count($tmp)){
+        $names = "";
+        foreach($tmp as $name){
+          $names .= ", ".$name;
+        }
+        $names = preg_replace("/^, /","",$names); 
+        $names = trim($names);
+        if(count($tmp) == 3){
+          $names .= " ...";
+        }
+        print_red(sprintf(_("You can't delete this system type, it is still in use by these system(s) '%s'"),$names));
+      }else{
+        $this->handle->removeSystemType($_POST['select_type']); 
+      } 
+    }
+
+    /* Rename selected system type to given string
+     */
+    if(isset($_POST['Rename_type_OK'])){
+      $attr = $this->handle->getSystemTypes();
+      if(in_array(trim($_POST['string']),$attr)){
+        print_red(_("Rename failed, this system type name is already used.")) ;
+      }else{
+        $this->renameTypeDialog = false;
+        $this->handle->updateSystemType($_POST['string'],trim($this->select_type));
+      }
+    }
+    
+  
+    if((isset($_POST['rename_type'])&&(!empty($_POST['select_type'])))||($this->renameTypeDialog)){
+      if(isset($_POST['select_type'])){
+        $this->select_type = $_POST['select_type'];
+      }
+      $this->renameTypeDialog = true;
+      $tmp = $this->handle->getSystemTypes();
+       
+      $smarty->assign("string",$tmp[$this->select_type]);
+      if(isset($_POST['string'])){
+        $smarty->assign("string",$_POST['string']);
+      }
+      $smarty->assign("Method","rename");
+      $display= $smarty->fetch(get_template_path('glpi_edit_type.tpl', TRUE));
+      return($display);
+    }
+
+    
+
+    /* Someone wants to edit the system types ... 
+       So, lets open a new dialog which provides some buttons to edit the types
+     */
+    if($this->edit_type){
+      $smarty->assign("Method","edit");
+      $smarty->assign("SystemTypes",            $this->handle->getSystemTypes());
+      $smarty->assign("SystemTypeKeys",         array_flip($this->handle->getSystemTypes()));
+      $display= $smarty->fetch(get_template_path('glpi_edit_type.tpl', TRUE));
+      return($display);
+    }
+
+    /* System os management
+     */
+    if(isset($_POST['edit_os']) && $this->acl_is_writeable("os")){
+      $this->dialog = true;
+      $this->edit_os=true;
+    }
+
+    /* Close Operating system dialog
+     */
+    if(isset($_POST['close_edit_os'])){
+      $this->edit_os=false;
+      $this->dialog = false;
+    }
+
+    /* Add new os to the db
+     */
+    if((isset($_POST['add_os']))&&(!empty($_POST['is_string']))  && $this->acl_is_writeable("os")){
+      $attr = $this->handle->getOSTypes();
+      if(in_array(trim($_POST['is_string']),$attr)){
+        print_red(_("Adding new operating system failed, specifed name is already used.")) ;
+      }else{
+        $this->handle->addOS(trim($_POST['is_string']));  
+      }
+    }
+
+    /* Delete selected os from list and db
+     */
+    if((isset($_POST['del_os']))&&(!empty($_POST['select_os']))  && $this->acl_is_writeable("os")){
+      $tmp = $this->handle->is_osUsed($_POST['select_os']);
+  
+      if(count($tmp)){
+
+        $names = "";
+        foreach($tmp as $name){
+          $names .= ", ".$name;
+        }
+        $names = preg_replace("/^, /","",$names);
+        $names = trim($names);
+        if(count($tmp) == 3){
+          $names .= " ...";
+        }
+        print_red(sprintf(_("You can't delete this operating system, it is still in use by these system(s) '%s'"),$names));
+
+      }else{
+        $this->handle->removeOS_byID($_POST['select_os']);  
+      }
+    }
+
+    /* Rename selected os to given string
+     */
+    if(isset($_POST['Rename_os_OK'])  && $this->acl_is_writeable("os")){
+      $attr = $this->handle->getOSTypes();
+      if(in_array(trim($_POST['string']),$attr)){
+        print_red(_("Updating operating system failed, specifed name is already used.")) ;
+      }else{
+        $this->handle->updateOS($_POST['string'],$this->select_type);
+        $this->renameOSDialog = false;
+      }
+    }
+    if((isset($_POST['rename_os'])&&(!empty($_POST['select_os'])))||($this->renameOSDialog)){
+      if(isset($_POST['select_os'])){
+        $this->select_type = $_POST['select_os'];
+      }
+      $this->renameOSDialog = true;
+      $tmp = $this->handle->getOSTypes();
+       
+      $smarty->assign("string",$tmp[$this->select_type]);
+      if(isset($_POST['string'])){
+        $smarty->assign("string",$_POST['string']);
+      }
+      $smarty->assign("Method","rename");
+      $display= $smarty->fetch(get_template_path('glpi_edit_os.tpl', TRUE));
+      return($display);
+    }
+
+    /* Open dialog to edit os types 
+     */
+    if($this->edit_os){
+      $smarty->assign("Method","edit");
+      $smarty->assign("OSs",            $this->handle->getOSTypes());
+      $smarty->assign("OSKeys",         array_flip($this->handle->getOSTypes()));
+      $display= $smarty->fetch(get_template_path('glpi_edit_os.tpl', TRUE));
+      return($display);
+    }
+
+
+
+    /* Show dialog to select a new contact person
+     * Select a contact person
+     */
+    if(isset($_POST['SelectContactPerson']) && $this->acl_is_writeable("contact_num")){
+      $this->addUser = "contact";
+      $this->cur_dialog= new glpiSelectUser($this->config,$this->dn,"user_tech_num");
+      $this->cur_dialog->set_acl_category(preg_replace("/\//","",$this->acl_category));
+      $this->cur_dialog->set_acl_base($this->dn);
+
+    }
+
+    /* Open dialog which allows to edit the manufacturers
+     */
+    if(isset($_POST['edit_manufacturer']) && $this->acl_is_writeable("FK_glpi_enterprise")){
+      $this->cur_dialog = new glpiManufacturer($this->config,$this->dn);
+      $this->dialog = true;
+    }
+
+    /* Close manufacturer editing dialog
+     */
+    if(isset($_POST['close_edit_manufacturer'])){
+      $this->dialog = false;
+      $this->cur_dialog = false;
+    }
+
+    /* Abort user selection
+     */
+    $smarty->assign("AbortSelectUser","SelectUserCancel");
+    if(isset($_POST['SelectUserCancel'])){
+      $this->dialog = false;
+      $this->addUser ="";
+      $this->cur_dialog = false;
+    }
+
+    /* Selecte technical responsible person
+     */
+    if(isset($_POST['SelectTechPerson']) && $this->acl_is_writeable("tech_num")){
+      $this->addUser ="tech";
+      $this->cur_dialog= new glpiSelectUser($this->config,$this->dn,"user_tech_num");
+      $this->cur_dialog->set_acl_category(preg_replace("/\//","",$this->acl_category));
+      $this->cur_dialog->set_acl_base($this->dn);
+    }
+
+    /* Technical responsible person selected*/
+    if(isset($_GET['act'])&&($_GET['act']=="user_tech_num")&&(strlen($_GET['id']) > 100)){
+      print_red(sprintf(_("Could not add the given user, the users dn is too long, only 100 characters are allowed here.")));
+
+    }elseif(isset($_GET['act'])&&($_GET['act']=="user_tech_num") && strlen($_GET['id'])){
+
+
+      /* Get posted id */
+      $id = base64_decode($_GET['id']);
+
+      /* Check if user is already created in glpi database */
+      if(!in_array($id,$users)){
+
+        /* If this user doesn't exists in glpi db, we must create him */
+        $ldap->cat($id, array('cn', 'mail', 'telephoneNumber'));
+        $atr = $ldap->fetch();
+        $tmp = array();
+        $use = array( "cn"              =>"name",
+            "mail"            =>"email",
+            "telephoneNumber" =>"phone");
+
+        /* Create array */
+        foreach($use as $gosa => $glpi){
+          if(isset($atr[$gosa])){
+            $tmp[$glpi]= $atr[$gosa][0];
+          }
+        }
+
+        /* Add this user */
+        $this->handle->addUser($tmp,$id);
+      }
+
+      /* Re-read users */
+      $users = ($this->handle->getUsers());
+
+      /* Get user */
+      $tmp = array_flip($users);
+      $id=$tmp[$id];
+
+      /* Use user id, close dialog */
+      if($this->addUser == "tech"){
+        $this->tech_num = $id;
+      }else{
+        $this->contact_num = $id;
+      }
+      $this->cur_dialog   = false;
+      $this->dialog= false;
+    }
+
+    /* if( cur_dialog != false || cur_dialog != NULL) 
+     * There is a dialog which wants to be displayed 
+     */
+    if(isset($this->cur_dialog) && is_object($this->cur_dialog)){
+      $this->cur_dialog->save_object();
+      $this->dialog=true;
+      $this->cur_dialog->parent = &$this;
+      return($this->cur_dialog->execute());
+    }else{
+      $this->dialog= false;
+    }
+
+    /* Assign smarty defaults */ 
+    foreach(array("SystemTypes","SystemTypeKeys","Manufacturers","OSs","TechnicalResponsibles","InstalledDevices","Attachments") as $attr){
+      $smarty->assign($attr,array());
+    }
+
+    /* Assign some vars to smarty 
+     */
+    foreach(array("type","FK_glpi_enterprise","os","tech_num","contact_num","Attachments","InstalledDevices") as $attr){
+      $smarty->assign($attr,"");
+    }
+
+    /* Do we need to flip is_account state? */
+    if(isset($_POST['modify_state'])){
+      if($this->is_account && $this->acl_is_removeable()){
+        $this->is_account= FALSE;
+      }elseif(!$this->is_account && $this->acl_is_createable()){
+        $this->is_account= TRUE;
+      }
+    }
+
+    /* Show tab dialog headers */
+    if ($this->is_account){
+      $display= $this->show_disable_header(_("Remove inventory"),
+          _("This device has inventory informations enabled. You can disable them by clicking below."));
+    } else {
+      $display= $this->show_enable_header(_("Add inventory"),
+          _("This device has inventory informations disabled. You can enable them by clicking below."));
+      return ($display);
+    }
+
+    /* Assign system types 
+     */
+    $smarty->assign("SystemTypeKeys",         array_flip($this->handle->getSystemTypes()));
+    $smarty->assign("SystemTypes",            $this->handle->getSystemTypes());
+    $smarty->assign("type",                   $this->type);
+
+    /* Assign os types
+     */
+    $smarty->assign("OSKeys",                 array_flip($this->handle->getOSTypes()));
+    $smarty->assign("OSs",                    $this->handle->getOSTypes());
+    $smarty->assign("os",                     $this->os);
+
+    /* Dispaly installed devices */
+    $smarty->assign("InstalledDevices"        ,$this->getDevices());
+    $smarty->assign("InstalledDeviceKeys"     ,array_flip($this->getDevices()));
+
+    /* Append manufacturers
+     */
+    $smarty->assign("ManufacturerKeys",       array_flip($this->handle->getEnterprises()));
+    $smarty->assign("Manufacturers",          $this->handle->getEnterprises());
+    $smarty->assign("FK_glpi_enterprise",     $this->FK_glpi_enterprise);
+
+    /* Assign used Attachments
+    */
+
+    $divlist = new divSelectBox("glpiAttachmentsList");
+    $divlist-> SetHeight(130); 
+    $atts = $this->getUsedAttachments(true);
+    $downlink = "<a href='get_attachment.php?id=%s' target='_blank'>%s</a>";
+    $del_link = "<input type='image' src='images/edittrash.png' name='delAttachment_%s'>";
+    foreach($atts as $id => $attachment){
+      $divlist->AddEntry
+          (
+        array(
+            array("string"=>$attachment['name']),
+            array("string"=>$attachment['mime']),
+            array("string"=>sprintf($downlink,$id,$attachment['filename'])),
+            array("string"=>sprintf($del_link,$attachment['ID']),"attach"=>"style='border-right:0px;'"),
+             )
+          );
+    }
+
+    $smarty->assign("AttachmentsDiv"          ,$divlist->DrawList());
+    /* Handle contact person 
+       Assign name ... to smarty, if set
+     */ 
+    if(isset($users[$this->contact_num])){
+      $ldap->cat($users[$this->contact_num], array('givenName', 'sn', 'uid'));
+      $tr = $ldap->fetch();
+      $str = "";
+      if(isset($tr['givenName'][0])){   $str .= $tr['givenName'][0]." ";      }
+      if(isset($tr['sn'][0])) {         $str .= $tr['sn'][0]." ";             }
+      if(isset($tr['uid'][0])){         $str .= "[".$tr['uid'][0]."]";        }
+      $smarty->assign("contact_num",               $str);
+    }else{
+      $smarty->assign("contact_num",               _("N/A"));
+    }
+
+    /* Handle tech person 
+       Assign name ... to smarty, if set
+     */ 
+    if(isset($users[$this->tech_num])){
+      $tr = $ldap->cat($users[$this->tech_num], array('givenName', 'sn', 'uid'));
+      $tr = $ldap->fetch();
+      $str = "";
+      if(isset($tr['givenName'][0])){   $str .= $tr['givenName'][0]." ";      }
+      if(isset($tr['sn'][0])) {         $str .= $tr['sn'][0]." ";             }
+      if(isset($tr['uid'][0])){         $str .= "[".$tr['uid'][0]."]";        }
+      $smarty->assign("tech_num",               $str);
+    }else{
+      $smarty->assign("tech_num",               _("N/A"));
+    }
+    $smarty->assign("comments",               $this->comments);
+
+    $display.= $smarty->fetch(get_template_path('glpi.tpl', TRUE));
+    return($display);
+  }
+
+  function remove_from_parent()
+  {
+    /* Cancel if there's nothing to do here */
+    if ((!$this->initially_was_account) || (!$this->acl_is_removeable())){
+      return;
+    }
+    if(function_exists("mysql_pconnect")){
+      $this->handle = new glpiDB($this->data['SERVER'],$this->data['LOGIN'],$this->data['PASSWORD'],$this->data['DB']);
+      if($this->initially_was_account){
+        $this->handle->removeComputerInformations($this->dn); 
+        new log("remove","undefined/".get_class($this),$this->dn);
+      }
+    }else{
+      print_red(_("Can't remove glpi account, while mysql extension is missing."));
+      new log("remove","undefined/".get_class($this),$this->dn,array(),_("Can't remove glpi account, while mysql extension is missing."));
+    }
+  
+  }
+
+  function getDevices(){
+    $ret = array();
+    foreach($this->usedDevices as $type => $entries){
+      foreach($entries as $ent){
+        if(isset($ent['designation'])){
+          $ret[] = $ent['designation']." [".$type."]";
+        }else{
+          $ret[] = $ent['name']." [".$type."]";
+        }
+      }
+    }
+    return($ret); 
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    if(!isset($_POST['glpi_tpl_posted'])) {
+      return ;
+    }
+    plugin::save_object();
+  }
+
+
+  /* Check supplied data */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    //    if($this->TechnicalResponsible == ""){
+    //      $message[] = _("Please select a technical responsible person for this entry.");
+    //    }
+
+    return ($message);
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    if($this->is_account){
+        $attrs = array();
+      $this->date_mod = date("Y-m-d H:i:s");
+      foreach($this->attributes as $attr){
+        $attrs[$attr] = $this->$attr;
+      }
+      $attrs['name'] = $this->dn;
+      unset($attrs['ID']);
+      $this->handle = new glpiDB($this->data['SERVER'],$this->data['LOGIN'],$this->data['PASSWORD'],$this->data['DB']);
+
+      /* check if we have to update, add */
+      if($this->initially_was_account&&$this->is_account){
+        $this->handle->updateComputerInformations($attrs,$this->orig_dn);
+        new log("modify","undefined/".get_class($this),$this->dn);
+      }elseif($this->is_account){
+        $this->handle->addComputerInformations($attrs,$this->dn);
+        new log("create","undefined/".get_class($this),$this->dn);
+      }
+      $tmp = $this->handle->getComputerInformations($this->dn);
+      $this->handle->addDevicesToComputer($this->usedDevices,$tmp[0]['ID']);
+    }
+  }
+
+
+  /* Return used attachments */
+  function getUsedAttachments($divlist = false)
+  {
+    $atts =$this->handle->getAttachments();
+    $ret = array();
+    foreach($atts as $entry){
+      if(in_array($entry['ID'],$this->usedAttachments)){
+        if($divlist){
+          $ret[$entry['ID']] = $entry;
+        }else{
+          $cm ="";
+          if(isset($entry['comment'])){
+            $cm=" [".$entry['comment']."]";
+          }
+          if(isset($entry['mime'])){
+            $cm.=" -".$entry['mime']."";
+          }
+
+          $ret[$entry['ID']]= $entry['name'].$cm;
+        }
+      }
+    }
+    return($ret);
+  }
+
+   /* Return plugin informations for acl handling */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Glpi"),
+          "plDescription" => _("Inventory extension"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 20,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("workstation","terminal","component","server","phone") ,
+          "plProvidedAcls"=> array(
+          
+            "tech_num"            => _("Technical responsible"),
+            "comments"            => _("Comment"),
+            "os"                  => _("Operating system"),
+            "location"            => _("Location"),
+            "contact_num"         => _("Contact person"),
+            "model"               => _("Model"),
+            "type"                => _("Type"),
+            "FK_glpi_enterprise"  => _("Manufacturer"),
+            "Attachments"         => _("Attachments"),
+            "Devices"             => _("Peripheral devices"))
+          ));
+  }
+  
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/services/glpi/class_glpiAttachmentPool.inc b/plugins/admin/systems/services/glpi/class_glpiAttachmentPool.inc
new file mode 100644 (file)
index 0000000..b500660
--- /dev/null
@@ -0,0 +1,362 @@
+<?php
+
+class glpiAttachmentPool 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("name","comment","mime","filename","date_mod");
+  var $objectclasses  = array("whatever");
+
+  var $parent;
+  var $edit = false;
+  var $entry = false;
+  var $date_mod ="";
+  var $name     ="";
+  var $comment  ="";
+  var $mime     ="";
+  var $filename ="";  
+
+  var $Selected = array();
+
+  var $delAttach= "";
+
+  function glpiAttachmentPool (&$config, $dn= NULL,$used=NULL)
+  {
+    plugin::plugin ($config, $dn);
+    if(!isset($_SESSION['GlpiAttachmentFilter'])){
+      $_SESSION['GlpiAttachmentFilter'] = array("filter"=>"*");
+    }
+
+    /* Assign used attributes */
+    if($used !== NULL){
+      $this->Selected = $used;
+    }
+  }
+
+  function execute()
+  {
+    plugin::execute();
+    $attach     = $this->parent->handle->getAttachments();
+    /* Fill templating stuff */
+    $smarty     = get_smarty();
+    $display    = "";
+    $only_once  = true; 
+
+    /* walk through all posted objects */
+    foreach($_POST as $name => $value){
+
+      /* Open dialog to create a new entry */
+      if(preg_match("/new_attach/",$name)){
+        $this->edit = true;
+        $this->entry=array();
+
+        /* Set default values */
+        foreach($this->attributes as $attr) {
+          $this->$attr = "";
+          $this->entry[$attr]="";
+        }
+      }
+  
+      /* Remove attach*/ 
+      if((preg_match("/^delAttach_/",$name))&&($only_once)){
+        $only_once = false;
+        $str = preg_replace("/^delAttach_/","",$name);
+        $str = base64_decode(preg_replace("/_.*$/","",$str));
+
+        /* remove attach from db */
+        $this->delAttach = $str;
+        $smarty->assign("warning", sprintf(_("You're about to delete the glpi attachment component '%s'."), $attach[$str]['name']));
+        return($smarty->fetch(get_template_path('remove_glpi.tpl', TRUE)));
+      }
+      /* Start editing entry */ 
+      if((preg_match("/^editAttach_/",$name))&&($only_once)){
+        $only_once = false;
+        $str = preg_replace("/^editAttach_/","",$name);
+        $str = base64_decode(preg_replace("/_.*$/","",$str));
+        
+        /* Check if we have an attachment with given ID */ 
+        foreach($attach as $att ){
+          if($att['ID'] == $str ){
+
+            /* Entry was found, show dialog */          
+            $this->edit = true;
+            $this->entry  = $att;       
+
+            foreach($att as $name => $value){
+              $this->$name = $value;
+            } 
+          } 
+        }
+      }
+    }
+
+    if((isset($_POST['delete_glpi_confirm']))&&(isset($attach[$this->delAttach]))){
+      if($this->parent->handle->is_attachmentUsed($this->delAttach)){
+        $tmp = $this->parent->handle->is_attachmentUsed($this->delAttach);
+        
+        $names = "";
+        foreach($tmp as $name){
+          $names .= ", ".$name;
+        }
+        $names = preg_replace("/^, /","",$names);
+        $names = trim($names);
+        if(count($tmp) == 3){
+          $names .= " ...";
+        }
+        print_red(sprintf(_("You can't delete this attachment, it is still in use by these system(s) '%s'"),$names));
+
+      }else{
+        $this->parent->handle->deleteAttachment($this->delAttach);
+        @unlink(CONFIG_DIR."/glpi/".$this->filename);
+        $attach     = $this->parent->handle->getAttachments();
+      }
+    }
+
+    /* Someone tries to upload a file */
+    if(($this->edit == true)&&(isset($_POST['upload']))){
+      if(!isset($_FILES['filename'])){
+        print_red(_("There is no valid file uploaded."));
+      }else{
+        $FILE = $_FILES['filename'];  
+        if(!isset($FILE['name'])){
+          print_red(_("There is no valid file uploaded."));
+        }else{
+          if($FILE['error']!=0) {
+            print_red(_("Upload wasn't successfull."));
+          }else{
+            if(!is_dir(CONFIG_DIR."/glpi/")){
+              print_red(sprintf(_("Missing directory '%s/glpi/' to store glpi uploads."),CONFIG_DIR));
+            }else{
+              $filen = CONFIG_DIR."/glpi/".$FILE['name'];
+              if(file_exists($filen)){
+                print_red(_("There is already a file with the same name uploaded."));
+              }else{
+                $fh = fopen($filen,"w");
+                if(!$fh){
+                  print_red(sprintf(_("Can't create file '%s'."),$filen));
+                }else{
+                  $str = file_get_contents($FILE['tmp_name']);
+                  fwrite($fh,$str,strlen($str));
+                  fclose($fh);
+                  $this->mime     = $FILE['type'];   
+                  $this->filename = $FILE['name'];   
+                }
+              } // File already exists
+            }
+          } // Check if any error occurred
+        } // check if valid filename was uploaded
+      } // ende check if file was uploaded 
+    }// upload post
+
+    /* save attachment*/
+    if(($this->edit == true)&&(isset($_POST['SaveAttachment']))){
+      if(count($this->check())==0){
+        $this->date_mod = date("Y-m-d H:i:s");
+        $this->save_entry();
+        $this->edit= false;
+        $this->entry = array();
+        $attach = $this->parent->handle->getAttachments();
+      }else{
+        foreach($this->check() as $msg){
+          print_red($msg);
+        }
+      }
+    }
+
+    /* Abort editing/adding  attachment*/
+    if(($this->edit == true)&&(isset($_POST['CancelAttachment']))){
+      $this->edit  = false;
+      $this->entry = array();
+    }
+
+    /* If edit == true, we have to show a dialog to edit or add an attach 
+     */
+    if($this->edit == true){
+      foreach($this->attributes as $attr){
+        $smarty->assign($attr,htmlentities(utf8_decode($this->$attr)));
+      }
+      if(!empty($this->filename)){
+        if(is_readable(CONFIG_DIR."/glpi/".$this->filename)){
+          $status =_("File is available.");
+        }else{
+          $status =_("File is not readable, possibly the file is missing.");
+        }
+      }else{
+        $status = _("Currently no file uploaded.");
+      }
+      $smarty->assign("status",$status); 
+      return($smarty->fetch(get_template_path('glpiAttachmentEdit.tpl', TRUE)));
+    }
+
+    /* Create list with checkboxes to select / deselect some attachents */
+    $divlist = new divlist("Attachment");  
+    $divlist->SetPluginMode();
+    $divlist->SetHeader(array(
+          array("string" => "&nbsp;", "attach" => "style='text-align:center;width:20px;'"),
+          array("string" => _("Name")),
+          array("string" => _("Mime"),"attach"=>"style='width:200px;'"),
+          array("string" => _("Actions"), "attach" => "style='width:60px;border-right:0px;text-align:right;'" )));
+
+    $divlist->SetSummary(_("This table displays all available attachments."));
+    $divlist->SetEntriesPerPage(0);
+
+    $editdel = "<input type='image' name='editAttach_%s' src='images/edit.png'>";
+    $editdel.= "<input type='image' name='delAttach_%s'  src='images/edittrash.png'>";
+
+    /* Add all given attachments to divlist 
+     */ 
+    foreach($attach as $entry){
+
+      /* Create display name*/
+      if((empty($entry['name']))||(empty($entry['comment']))){
+
+        /* In glpi it is possible to add entries without name 
+           so i've added this block 
+         */ 
+        if(empty($entry['name'])){
+          $str1 = "<i>"._("empty")."</i>";
+        }else{ 
+          $str1 = $entry['name'];
+        }
+
+        if(!empty($entry['comment'])){
+          $str1.= " [".$entry['comment']."]";
+        }
+      }else{
+        /* Both attributes given */
+        $str1 = $entry['name']." [".$entry['comment']."]";
+      }
+
+      $edit = str_replace("%s",base64_encode($entry['ID']),$editdel);
+      $str2 = $entry['mime']."&nbsp;";      
+
+      $chkbox = "<input type='hidden' name='wasOnPage_%s'>".
+        "<input type='checkbox' name='useMe_%s' value='%s' %CHECKED%>";
+
+      if(in_array($entry['ID'],$this->Selected)){
+        $chkbox = preg_replace("/%CHECKED%/"," checked ",$chkbox);
+      }else {
+        $chkbox = preg_replace("/%CHECKED%/"," ",$chkbox);
+      }
+      $chkbox = preg_replace("/%s/",$entry['ID'],$chkbox);
+      $divlist->AddEntry(array(
+            array("string" => $chkbox, 
+              "attach" => "style='text-align:center;width:20px;'"),
+            array("string"=> $str1),
+            array("string"=> $str2,"attach"=>"style='width:200px;'"),
+            array("string"=> $edit ,"attach" => "style='width:60px;border-right:0px;text-align:right;'")
+            ));
+
+    }
+
+    $listhead = "<div style='background:#F0F0F9;padding:5px;'>".
+      "   <input class='center' type='image' 
+      src='images/fai_new_template.png' align='middle' title='"._("Create new attachment")."' 
+      name='new_attach' alt='"._("New Attachment"). "'>&nbsp;".
+      "</div>";
+
+    $smarty->assign("attachments",      $divlist->DrawList());
+    $smarty->assign("attachmenthead",   $listhead);
+    $smarty->assign("search_image",     get_template_path('images/search.png'));
+    $smarty->assign("searchu_image",    get_template_path('images/search_user.png'));
+    $smarty->assign("tree_image",       get_template_path('images/tree.png'));
+    $smarty->assign("infoimage",        get_template_path('images/info_small.png'));
+    $smarty->assign("launchimage",      get_template_path('images/small_filter.png'));
+    $smarty->assign("apply",            apply_filter());
+    $smarty->assign("alphabet",         generate_alphabet());
+    $smarty->assign("attachment_regex", $_SESSION['GlpiAttachmentFilter']['filter']);
+
+    $display.= $smarty->fetch(get_template_path('glpiAttachmentPool.tpl', TRUE));
+    return($display);
+  }
+
+  function save()
+  {
+    return($this->Selected);
+  }
+
+  /* Adds new or saves edited entries */
+  function save_entry()
+  {
+    if($this->edit){
+      $tmp = array();
+      foreach($this->attributes as $attr){
+        $tmp[$attr] = $this->$attr;
+      } 
+      $id = -1;
+      if(isset($this->entry['ID'])){
+        $id = $this->entry['ID'];
+      }
+      $this->parent->handle->saveAttachments($tmp,$id);
+    }
+  }
+
+  function save_object()
+  {
+    foreach($this->attributes as $attr){
+      if(isset($_POST[$attr])){
+        $this->$attr = $_POST[$attr];
+      }
+    }
+
+    /* Checkboxes are only posted, if they are checked
+     * To check if it was deselected, we check if wasOnPage 
+     * was posted with given name, so we can deselect this entry
+     */  
+
+    foreach($_POST as $name => $value){
+      if(preg_match("/wasOnPage_/",$name)){
+        $id=preg_replace("/wasOnPage_/","",$name);
+        if(isset($_POST["useMe_".$id])){
+          $this->Selected[$id]=$id;
+        }else{
+          if(isset($this->Selected[$id])){
+            unset($this->Selected[$id]);
+          }
+        }
+      }
+    }
+  }
+
+  /* Simple check */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    if($this->edit){
+    
+      /* check if given name is already in use */
+      $att = $this->parent->handle->getAttachments();
+      $ok = true;
+      $this->name=trim($this->name);
+
+      foreach($att as $val){
+        if(!isset($this->entry['ID'])){
+          if($val['name'] == $this->name){
+            $ok = false;
+          }
+        }else{
+          if(($val['name'] == $this->name)&&($this->entry['ID'] != $val['ID'])){
+            $ok = false;
+          }
+        }
+      }
+      if(!$ok){
+        $message[] = _("This name is already in use.");
+      }
+      if(empty($this->name)){
+        $message[] = _("Please specify a valid name for this attachment.");
+      }
+    }
+    return($message);
+  }
+
+}// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/services/glpi/class_glpiDeviceManagement.inc b/plugins/admin/systems/services/glpi/class_glpiDeviceManagement.inc
new file mode 100644 (file)
index 0000000..0f24300
--- /dev/null
@@ -0,0 +1,427 @@
+<?php
+
+class glpiDeviceManagement 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("whatever");
+
+  var $devices = array();
+  var $ui;
+
+  var $parent   ;
+  var $EditEntry;
+  var $editMode =false;
+
+  var $DeviceAttrs = array();
+  var $AllowedDevices = array();
+
+  var $Selected = array();
+
+  var $delete = array();
+
+  function glpiDeviceManagement (&$config, $dn= NULL,$used=NULL)
+  {
+    plugin::plugin ($config, $dn);
+
+    if(!isset($_SESSION['glpiDeviceRegex'])){
+      $tmp['device_regex'] = "*";
+      $_SESSION['glpiDeviceRegex'] = $tmp;
+    }
+    $this->ui = get_userinfo();  
+
+    if(isset($used)){
+    $this->Selected = $used;
+    }
+    /* Specify which vars are allowed for a sepcific type of device */ 
+    $this->DeviceAttrs['case']      = array("designation","format","comment","FK_glpi_enterprise");
+    $this->DeviceAttrs['moboard']   = array("designation","chipset","comment","FK_glpi_enterprise");
+    $this->DeviceAttrs['processor'] = array("designation","frequence","comment","FK_glpi_enterprise","specif_default");
+    $this->DeviceAttrs['iface']     = array("designation","bandwidth","comment","FK_glpi_enterprise","specif_default");
+    $this->DeviceAttrs['ram']       = array("designation","frequence","comment","FK_glpi_enterprise","specif_default","type");
+    $this->DeviceAttrs['hdd']       = array("designation","rpm","interface","cache","comment","FK_glpi_enterprise","specif_default");
+    $this->DeviceAttrs['drive']     = array("designation","speed","interface","is_writer","comment","FK_glpi_enterprise","specif_default");
+    $this->DeviceAttrs['control']   = array("designation","interface","raid","comment","FK_glpi_enterprise");
+    $this->DeviceAttrs['gfxcard']   = array("designation","ram","interface","comment","FK_glpi_enterprise","specif_default");
+    $this->DeviceAttrs['sndcard']   = array("designation","type","comment","FK_glpi_enterprise","specif_default");
+    $this->DeviceAttrs['power']     = array("designation","power","comment","FK_glpi_enterprise","atx");
+    $this->DeviceAttrs['pci']       = array("designation","comment","FK_glpi_enterprise","specif_default");
+    $this->DeviceAttrs['monitor']   = array("name","comments","serial","otherserial","size",
+                                            "flags_micro","flags_speaker","flags_subd","flags_bnc",
+                                            "location","type","FK_glpi_enterprise","is_global","deleted","is_template","tplname");
+
+    $this->AllowedDevices=array("case","moboard","sndcard","processor","iface","ram","hdd","drive","control","gfxcard","power","pci","monitor");
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* Get all defined devices */
+    $this->reload();
+
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+    $display= "";
+
+    /* this var is used to ensure that every post is only performed once */
+    $only_once = true;
+
+    /* Check Post for some actions */
+    foreach($_POST as $name => $value){
+      
+      /* If new_ then we should create an new device */
+      if((preg_match("/^new_/",$name))&&($only_once)){
+    
+        /* don't do this twice */
+        $only_once = false;
+
+        /*extract device device_type */
+        $deviceType = preg_replace("/_.*$/","",preg_replace("/^new_/","",$name));
+
+        /* Check if type is allowed, and create empty entry */
+        $tmp = array();
+        if((!isset($this->DeviceAttrs[$deviceType]))||((!in_array($deviceType,$this->AllowedDevices)))){
+          print_red(sprintf(_("Internal Error can't create device of type '%s'"),$deviceType));
+        }else{
+          foreach($this->DeviceAttrs[$deviceType] as $attr){
+            $tmp[$attr] = "";
+          }
+          $tmp['device_type'] = $deviceType;
+          $this->EditEntry = $tmp;
+          $this->editMode =true;
+        }
+      }
+    }
+
+    /* delete was requested ... show dialog   */
+    if((isset($_GET['act']))&&($_GET['act']=="del_device")){
+      $id = base64_decode($_GET['id']);
+      $tmp = $this->devices[$id];
+
+      $this->delete = $tmp;
+
+      if(isset($tmp['name'])){
+        $smarty->assign("warning", sprintf(_("You're about to delete the glpi device '%s'."), $tmp['name']));
+      }elseif(isset($tmp['designation'])){
+        $smarty->assign("warning", sprintf(_("You're about to delete the glpi device '%s'."), $tmp['designation']));
+      }else{
+        print_red(_("Can't detect object name."));
+      }
+      
+      return($smarty->fetch(get_template_path('remove_glpi.tpl', TRUE)));
+    }
+
+    /* Delete entry, but check if this device is in currently in use */
+    if(isset($_POST['delete_glpi_confirm'])){
+      if(count($this->parent->handle->is_deviceUsed($this->delete))){
+
+        $tmp = $this->parent->handle->is_deviceUsed($this->delete);    
+  
+        $names = "";
+        foreach($tmp as $name){
+          $names .= ", ".$name;
+        }
+        $names = preg_replace("/^, /","",$names);
+        $names = trim($names);
+        if(count($tmp) == 3){
+          $names .= " ...";
+        }
+        print_red(sprintf(_("You can't delete this device, it is still in use by these system(s) '%s'"),$names));
+      }else{
+        $this->parent->handle->deleteDevice($this->delete);
+        $this->reload();
+      }
+    }
+
+    /* Open entry for editing if requested */
+    if((isset($_GET['act']))&&($_GET['act']=="edit_device")){
+      $id = base64_decode($_GET['id']);
+      $this->editMode =true;
+      $this->EditEntry = $this->devices[$id];
+    }
+
+    /* Abort editing this entry */
+    if(isset($_POST['AbortDeviceChanges'])){
+      $this->EditEntry = array();
+      $this->editMode = false;
+    }
+
+    /* Save all changes made on currently selected entry */
+    if(isset($_POST['SaveDeviceChanges'])){
+    
+      /* First check if all changes made are allowed */
+      if(count($this->check())==0){
+        $this->save();
+        $this->editMode = false;
+        $this->reload();
+      }else{
+        foreach($this->check() as $msg){
+          print_red($msg);
+        }
+      }
+      
+    }
+
+    /* Check if we are currently editing something ? */
+    if($this->editMode == true){
+      return ($this->editDevice($this->EditEntry));
+    }
+
+    /*  ENDE :  GET / POST handling 
+     *  Below, only output generation for headpage
+     */
+
+    $divlist = new divlist("glpi devices");
+    $divlist->SetPluginMode();
+    $divlist->SetEntriesPerPage(0);
+    $divlist->SetHeader(array(
+          array("string" => "&nbsp;", "attach" => "style='text-align:center;width:20px;'"),
+          array("string" => _("devices"), "attach" => "style=''"),
+          array("string" => _("Actions"), "attach" => "style='width:60px;border-right:0px;text-align:right;'" )));
+
+    $edit = "<a href='?plug=".$_GET['plug']."&amp;act=edit_device&amp;id=%s'>%s</a>";
+    $editdel = "<a href='?plug=".$_GET['plug']."&amp;act=edit_device&amp;id=%s'><img src='images/edit.png' alt='"._("Edit")."' border=0></a>";
+    $editdel.= "<a href='?plug=".$_GET['plug']."&amp;act=del_device&amp;id=%s'><img src='images/edittrash.png' alt='"._("Delete")."' border=0></a>";
+    
+    $useDevice = "<input type='hidden' name='wasOnPage_%s' value='%s'><input type='checkbox' value='%s' name='useDevice_%s' %USE%>";
+
+    foreach($this->devices as $key=>$user){
+
+      if(isset($user['designation'])){
+        $str = "designation";
+      }else{
+        $str = "name";
+      }
+
+      if(isset($this->Selected[$user['device_type']][$user[$str]])){
+        $use = " checked ";
+      }else{
+        $use ="";
+      }
+
+      /* Dawn databse struckture ....*/
+      if(empty($user['comment']) && isset($user['comments'])) {
+        $user['comment'] = $user['comments'];
+      }
+
+      $field1 = array("string" => preg_replace("/%s/",base64_encode($key),preg_replace("/%USE%/",$use,$useDevice)), "attach" => "style='text-align:center;width:20px;'");
+      $field2 = array("string" => sprintf($edit,base64_encode($key),$user[$str]."&nbsp;[".$user['comment']."]"), "attach" => "style=''");
+      $field3 = array("string" => sprintf($editdel,base64_encode($key),base64_encode($key)), 
+        "attach" => "style='width:60px;border-right:0px;text-align:right;'");
+      $divlist->AddEntry(array($field1,$field2,$field3));
+      
+    }
+    
+  $listhead = "<div style='background:#F0F0F9;padding:5px;'>".
+      " <input class='center' type='image' align='middle' 
+      src='images/monitor.png'  title='"._("New monitor")."' alt='"._("M")."' name='new_monitor'>&nbsp;".
+      " <input class='center' type='image' align='middle' 
+      src='images/mainboard.png' title='"._("New mainbord")."' alt='"._("MB")."' name='new_moboard'>&nbsp;".
+      " <input class='center' type='image' align='middle' 
+      src='images/processor.png' title='"._("New processor")."' alt='"._("P")."' name='new_processor'>&nbsp;".
+      " <input class='center' type='image' align='middle' 
+      src='images/server.png' title='"._("New case")."' alt='"._("C")."' name='new_case'>&nbsp;".
+      " <input class='center' type='image' align='middle' 
+      src='images/net_hardware.png' title='"._("New network interface")."' alt='"._("NI")."' name='new_iface'>&nbsp;".
+      " <input class='center' type='image' align='middle' 
+      src='images/memory.png' title='"._("New ram")."' alt='"._("R")."' name='new_ram'>&nbsp;".
+      " <input class='center' type='image' align='middle' 
+      src='images/fai_partitionTable.png' title='"._("New hard disk")."' alt='"._("HDD")."' name='new_hdd'>&nbsp;".
+      " <input class='center' type='image' align='middle' 
+      src='images/drives.png' title='"._("New drive")."' alt='"._("D")."' name='new_drive'>&nbsp;".
+      " <input class='center' type='image' align='middle' 
+      src='images/hardware.png' title='"._("New controller")."' alt='"._("CS")."' name='new_control'>&nbsp;".
+      " <input class='center' type='image' align='middle' 
+      src='images/gfx_hardware.png' title='"._("New graphics card")."' alt='"._("GC")."' name='new_gfxcard'>&nbsp;".
+      " <input class='center' type='image' align='middle' 
+      src='images/snd_hardware.png' title='"._("New sound card")."' alt='"._("SC")."' name='new_sndcard'>&nbsp;".
+      " <input class='center' type='image' align='middle' 
+      src='images/power.png' title='"._("New power supply")."' alt='"._("PS")."' name='new_power'>&nbsp;".
+      " <input class='center' type='image' align='middle' 
+      src='images/fai_template.png' title='"._("New misc device")."' alt='"._("OC")."' name='new_pci'>&nbsp;".
+      "</div>";
+    
+    $filter= $_SESSION['glpiDeviceRegex'];
+    $smarty->assign("devicehead", $listhead);
+    $smarty->assign("devices", $divlist->DrawList());
+    $smarty->assign("search_image", get_template_path('images/search.png'));
+    $smarty->assign("searchu_image", get_template_path('images/search_user.png'));
+    $smarty->assign("tree_image", get_template_path('images/tree.png'));
+    $smarty->assign("infoimage", get_template_path('images/info_small.png'));
+    $smarty->assign("launchimage", get_template_path('images/small_filter.png'));
+    $smarty->assign("apply", apply_filter());
+    $smarty->assign("alphabet", generate_alphabet());
+    $smarty->assign("device_regex", $filter['device_regex']);
+
+    $display.= $smarty->fetch(get_template_path('glpiDeviceManagement.tpl', TRUE));
+    return($display);
+  }
+
+  /* Save device to glpi database 
+   * If this is a new device, create a new entry, else update this entry 
+   */
+  function save()
+  {
+    if($this->parent->handle->deviceExists($this->EditEntry)){
+      $this->parent->handle->updateDevices($this->EditEntry);
+    }else{
+      $this->parent->handle->addDevice($this->EditEntry);
+    }
+
+  }
+
+  /* this only gets all already defined devices */
+  function reload()
+  {
+    $this->devices = $this->parent->handle->getDevices();
+    ksort($this->devices);
+  }
+
+  /* This funtions saves all POST variables.
+     The variable must be in the array $this->EditEntry 
+  */
+  function save_object()
+  {
+    foreach($_POST as $name => $value){
+
+      if(preg_match("/wasOnPage_/",$name)){
+        $dN = base64_decode($value);
+
+        $device = $this->devices[$dN];
+        $type   = $device['device_type'];  
+            
+        if(isset($device['designation'])){
+          $str = "designation";
+        }else{
+          $str = "name";
+        }
+
+        if(isset($_POST['useDevice_'.$value])){
+          $this->Selected[$type][$device[$str]] = $device;
+        }else{
+          if(isset($this->Selected[$type][$device[$str]])){
+            unset($this->Selected[$type][$device[$str]]);
+          }
+        }
+      }
+    }
+
+    if(is_array($this->EditEntry)){
+      foreach($this->EditEntry as $name => $value){
+        if(isset($_POST[$name])){
+          $this->EditEntry[$name] = $_POST[$name];
+        }
+
+      }
+    }
+  }
+
+  /* returns the selected devices */
+  function getSelected()
+  {
+    return($this->Selected); 
+  }
+
+  /* This function checks all created devices.
+     If you wan't to use device specific checks, 
+        use >>if($attr['device_type']=="moboard")<< to create a device type depending check
+   */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    $attr = $this->EditEntry;
+
+    if(isset($attr['designation'])){
+      $str2 = "designation";
+    }else{
+      $str2 = "name";
+    }
+    if(empty($attr[$str2])){
+      $message[]=(_("You have to specify a valid name for this device."));
+    }
+
+    /* Avoid same name twice */
+    $devices = ($this->parent->handle->getDevices());
+    foreach($devices as $dev){
+
+      /* Some devices use designation some name for name
+       */
+      if(isset($dev['designation'])){
+        $str = "designation";
+      }else{
+        $str = "name";
+      }
+
+      if($dev[$str]==$attr[$str2]){
+        
+        /* Entries with ['ID'] already exists, and are only edited, if ID is missing we are currently creating a new entry */
+        if(isset($attr['ID'])){
+          if(!(($dev['ID'] == $attr['ID'])&&($dev['device_type']==$attr['device_type']))){
+            $message[] = _("This device name is already in use.");
+          }
+        }else{
+          $message[] = _("This device name is already in use.");
+        }
+      }
+    }
+
+    return($message);
+  }
+
+  /* This functions displays the template for all available devices 
+   * This function is also used if we create a new device
+   */
+  function editDevice($entry)
+  {
+    $smarty = get_smarty();
+
+    /* Transfer given data to smarty */
+    foreach($this->EditEntry as $name => $value){
+      $smarty->assign($name,htmlentities(utf8_decode($value)));
+    }
+  
+    /* Set default select boxes, manufacturers ... */
+    $smarty->assign("device_type",$entry['device_type']);
+
+    $none = array(0 => _("none"));
+    $manufacturer = array_merge($none,$this->parent->handle->getEnterprises());
+
+    $ramtypes = $this->parent->handle->getRAMTypes();
+
+    $smarty->assign("RAMtypes",     $ramtypes);
+    $smarty->assign("RAMtypeKeys",  array_flip($ramtypes));
+
+    $deviceControlTypes = array_merge($none,$this->parent->handle->getGlpiDeviceControlTypes());
+
+    $smarty->assign("HDDInterfaceKeys",array_flip($deviceControlTypes));
+    $smarty->assign("HDDInterfaces"   , $deviceControlTypes);
+    
+    $gfxControlTypes = array("0"=>_("None"),"AGP"=>"AGP","PCI"=>"PCI","PCI-X"=>"PCI-X","Other"=>_("Other")); 
+
+    $smarty->assign("GFXInterfaceKeys",array_flip($gfxControlTypes));
+    $smarty->assign("GFXInterfaces"   , $gfxControlTypes);
+    
+    $smarty->assign("FK_glpi_enterpriseKeys",array_flip($manufacturer));
+    $smarty->assign("FK_glpi_enterprises", $manufacturer);
+
+    $smarty->assign("formats",array("Large","Medium","Micro"));
+    $smarty->assign("formats",array("Large","Medium","Micro"));
+
+    $smarty->assign("formats",array("Large","Medium","Micro"));
+    $smarty->assign("formatKeys",array('Grand','Moyen','Micro'));
+    return($smarty->fetch(get_template_path('glpi_devices.tpl', TRUE)));
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/services/glpi/class_glpiManufacturer.inc b/plugins/admin/systems/services/glpi/class_glpiManufacturer.inc
new file mode 100644 (file)
index 0000000..8e676d8
--- /dev/null
@@ -0,0 +1,170 @@
+<?php
+
+class glpiManufacturer 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("name","type","address","website","phonenumber","comments","deleted","fax","email");
+  var $objectclasses= array("whatever");
+
+  var $ui;
+
+  var $editMode = false;
+  var $Edit_Add = "edit";
+
+  var $name       ="";
+  var $type       ="";
+  var $address    ="";
+  var $website    ="";
+  var $phonenumber="";
+  var $comments   ="";
+  var $deleted    ="";
+  var $fax        ="";
+  var $email      ="";
+  var $ID         =-1;
+
+  function glpiManufacturer(&$config, $dn= NULL, $parent= NULL)
+  {
+    plugin::plugin ($config, $dn, $parent);
+    $this->ui = get_userinfo();  
+  }
+
+  function execute()
+  {
+    plugin::execute();
+    $smarty  = get_smarty();
+    $display = "";
+
+    /* Remove enterprise from db */
+    if((isset($_POST['remove_manu']))&&(isset($_POST['manufacturer']))){
+
+      $tmp = $this->parent->handle->is_manufacturerUsed($_POST['manufacturer']);
+      if(count($tmp)){
+
+        $names = "";
+        foreach($tmp as $name){
+          $names .= ", ".$name;
+        }
+        $names = preg_replace("/^, /","",$names);
+        $names = trim($names);
+        if(count($tmp) == 3){
+          $names .= " ...";
+        }
+        print_red(sprintf(_("You can't delete this manufacturer, it is still in use by these system(s) '%s'"),$names));
+      }else{
+        $this->parent->handle->removeEnterprise($_POST['manufacturer']);
+      }
+    }
+
+    /* Add new Manufactuer : Open dialog with empty fields */
+    if(isset($_POST['add_manu'])){
+      $this->editMode = true;
+      $this->Edit_Add = "add";
+      foreach($this->attributes as $atr){
+        $this->$atr = "";
+      }
+    }
+
+    /* Edit existing manuatctuerer data */
+    if((isset($_POST['edit_manu']))&&(isset($_POST['manufacturer']))){
+      $this->editMode = true;
+      $this->Edit_Add = "edit";
+      $tmp = $this->parent->handle->getEnterprise($_POST['manufacturer']);
+      $tmp = $tmp[0];
+      foreach($this->attributes as $atr){
+        $this->$atr = "";
+      }
+      foreach($this->attributes as $atr){
+        if(isset($tmp[$atr])){
+          $this->$atr = $tmp[$atr];
+        }
+      }
+      $this->ID = $_POST['manufacturer'];
+    }
+
+    /* close Dialog without saving */
+    if(isset($_POST['close_manufacturer'])){
+      $this->editMode=false;
+    }
+
+    /* close dialog an save all changes / adds */
+    if(isset($_POST['save_manufacturer'])){
+      $tmp = array();
+      foreach($this->attributes as $attrs){
+        $tmp[$attrs]=$this->$attrs;
+      }
+
+      $allok = true;
+      if(empty($tmp['name'])){
+        print_red(_("Please specify a name."));
+        $allok = false;
+      }
+
+      $attr = $this->parent->handle->getEnterprises();
+
+      if($this->ID == -1 ){
+        if(in_array($tmp['name'],$attr)){
+          $allok = false;
+          print_red(_("Specified name is already in use, please choose another one."));
+        }
+      }else{
+        unset($attr[$this->ID]);
+        if(in_array($tmp['name'],$attr)){
+          $allok = false;
+          print_red(_("Specified name is already in use, please choose another one."));
+        }
+      }
+
+      /* all checks are ok , so save changes */
+      if($allok){
+        if($this->Edit_Add == "add"){
+          $this->parent->handle->addEnterprise($tmp);
+          $this->editMode=false;
+        }else{
+          $this->parent->handle->updateEnterprise($tmp,$this->ID);
+          $this->editMode=false;
+        }
+      }
+    }
+
+    /* As long as this war is true, we have to display the edit dialog */
+    if($this->editMode == true){
+      $this->save_object();
+      foreach($this->attributes as $attrs){
+        $smarty->assign($attrs,$this->$attrs);
+      }
+
+      $display.= $smarty->fetch(get_template_path('glpiManufacturerAdd.tpl', TRUE));
+      return($display);
+    }
+
+
+    $smarty->assign("Manus",    $this->parent->handle->getEnterprises());
+    $smarty->assign("ManuKeys", array_flip($this->parent->handle->getEnterprises()));
+    $display.= $smarty->fetch(get_template_path('glpiManufacturer.tpl', TRUE));
+    return($display);
+  }
+
+  /* Save to LDAP */
+  function save()
+  {
+  }
+
+  function save_object()
+  {
+    foreach($this->attributes as $attr){
+      if(isset($_POST[$attr])){
+        $this->$attr = stripslashes($_POST[$attr]);
+      }
+    }
+  }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/services/glpi/class_glpiPrinterAccount.inc b/plugins/admin/systems/services/glpi/class_glpiPrinterAccount.inc
new file mode 100644 (file)
index 0000000..049249c
--- /dev/null
@@ -0,0 +1,807 @@
+<?php
+
+class glpiPrinterAccount 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= FALSE;
+  var $attributes= array("ID","name","contact","ramSize","flags_serial","flags_par","flags_usb",
+      "tech_num","comments","date_mod","location","domain","network","contact_num","serial","otherserial",
+      "type","is_template","FK_glpi_enterprise","deleted");
+
+  var $ID                 ;       // Is set if this entry is edited 
+  var $name               = "";    // This should be the dn of this entry 
+  var $FK_glpi_enterprise = 0;     // Manufacturer id
+  var $tech_num           = "";    // Technical responsible person
+  var $contact_num        = "";    // Contact person
+  
+  var $comments           = "";    // Comment
+  
+  var $type               = 0;     // printer type id
+  var $serial             = "";   
+  var $otherserial        = "";  
+  var $ramSize            = 0;
+  var $flags_serial       = false;
+  var $flags_par          = false;
+  var $flags_usb          = false;
+
+  var $date_mod           = "";    // Modification timestamp
+  
+  var $location           = 0;     // Not used yet
+  var $domain             = 0;     // ? Set to 0
+  var $network            = 0;     // ? Set to 0 
+
+  var $is_template        = 0;     // Used as template ?
+  var $contact            = "";    // Empty
+  var $deleted            = "N";   // Deleted entries should have this set to Y
+
+  var $rename             = false;
+  var $select_type        ;
+
+  var $editManufacturer   = false;
+
+  /* Not necessary, cause we use mysql databse */
+  var $objectclasses= array("whatever");
+
+  /* Used to remember if this was an account (simply: is this an edited entry) */
+  var $initially_was_account = false;
+
+  /* Remember current dialog */
+  var $edit_type            = false;
+  var $edit_os              = false;
+
+  var $data;
+  var $handle = NULL;               // Glpi class handle used to query database
+
+  var $cur_dialog = NULL;           // This contains the sub dialog handle
+
+  var $orig_dn;                     // To check if dn, has changed 
+  var $ui;                          // Some GOsa specific user informations 
+  
+  var $usedDevices      = array();  // Which devices are currently selected 
+  var $usedAttachments  = array();  // Used Attachments 
+  var $usedCartridges   = array();  // Used Cartridges
+
+  var $view_logged      = FALSE;
+
+  /* Contructor 
+     Sets default values and checks if we already have an existing glpi account
+   */
+  function glpiPrinterAccount (&$config, $dn= NULL, $parent= NULL)
+  {
+    plugin::plugin ($config, $dn, $parent);
+    $this->ui= get_userinfo();
+
+    $this->is_account = false;
+
+    /* Abort class construction, if no db is defined */
+    if(!isset($this->config->data['SERVERS']['GLPI'])){
+      return;
+    }
+
+    // Get informations about databse connection
+    $this->data = $this->config->data['SERVERS']['GLPI'];
+
+    // Abort if mysql extension is missing 
+    if(!is_callable("mysql_connect")){
+      return;
+    }
+
+    // Create handle of glpi class, and check if database connection is established 
+    $this->handle = new glpiDB($this->data['SERVER'],$this->data['LOGIN'],$this->data['PASSWORD'],$this->data['DB']);
+
+    if(!$this->handle->is_connected){
+      return;
+    } 
+
+    // If this dn is already used in database, then get all informations for this entry 
+    if($this->handle->is_printer_account($this->dn)){
+      $this->is_account = true;
+      $tmp = ($this->handle->getPrinterInformations($this->dn));
+
+      foreach(array("tech_num","FK_glpi_enterprise","type","comments","contact_num","flags_serial","flags_par","flags_usb","ramSize") as $attr){
+        $this->$attr = $tmp[0][$attr];
+      }
+      
+      $atts = $this->handle->getAssignPrinterAttachments($tmp[0]['ID']);
+      foreach($atts as $attachment){
+        $this->usedAttachments[$attachment['FK_doc']]=$attachment['FK_doc']; 
+      }
+
+      $cart= $this->handle->getUsedCartridges($tmp[0]['ID']);
+      foreach($cart as $key => $cartridge){
+        $this->usedCartridges[$key]=$cartridge; 
+        $this->usedCartridges[$key]['status']="exists"; 
+      }
+
+
+    }else{
+      $this->is_account = false;
+    }
+
+    /* set defaults */
+    $this->name                 = $this->dn;
+    $this->orig_dn              = $this->dn;
+    $this->initially_was_account = $this->is_account;
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","printer/".get_class($this),$this->dn);
+    }
+
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+    $display= "";
+
+    $smarty->assign("CartridgesACL",$this->getacl("Cartridges"));
+
+    /*  Assign smarty defaults 
+        To avoid undefined indexes, if there is an error with the glpi db
+     */ 
+    foreach(array("PrinterTypeKeys","PrinterTypes","ManufacturerKeys","Manufacturers",
+                  "Attachments","AttachmentKeys","CartridgeKeys","Cartridges") as $attr){
+      $smarty->assign($attr,array());
+    }
+    foreach(array("type","FK_glpi_enterprise","tech_num","contact_num","comments","flags_serial","flags_par","flags_usb","AttachmentsDiv") as $attr){
+      $smarty->assign($attr,"");
+    }
+
+    /* Assign acls */
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+    /* Check if there is a glpi database server defined 
+      */
+    if(!isset($this->config->data['SERVERS']['GLPI'])){
+      print_red(_("There is no server with valid glpi database service."));
+      return($smarty->fetch(get_template_path('glpiPrinter.tpl', TRUE)));
+    }
+
+    $this->data = $this->config->data['SERVERS']['GLPI'];
+
+    /* Check if we can call mysql_connect 
+       If we can't, there is no the mysql-php extension
+     */
+    if(!is_callable("mysql_connect")){
+      print_red(_("Can't connect to glpi database, the php-mysql extension is missing."));
+      return($smarty->fetch(get_template_path('glpiPrinter.tpl', TRUE)));
+    }
+
+    $this->handle = new glpiDB($this->data['SERVER'],$this->data['LOGIN'],$this->data['PASSWORD'],$this->data['DB']);
+
+    /*  If handle == false, abort
+        Seems that the server, username and or password is wrong
+     */
+    if(!$this->handle->is_connected){
+      print_red(_("Can't connect to glpi database, check configuration twice."));
+      return($smarty->fetch(get_template_path('glpiPrinter.tpl', TRUE)));
+    } 
+
+    /*  All checks are ok
+        Lets handle Posts, templates etc below ...
+     */
+    
+    $users = $this->handle->getUsers();
+    $ldap= $this->config->get_ldap_link();
+
+    
+    /*  ##########################################################################
+     *  Some tab management   
+     */
+
+    /* Do we need to flip is_account state? */
+    if(isset($_POST['modify_state'])){
+      if($this->is_account && $this->acl_is_removeable()){
+        $this->is_account= FALSE;
+      }elseif(!$this->is_account && $this->acl_is_createable()){
+        $this->is_account= TRUE;
+      }
+    }
+
+    /* Show tab dialog headers */
+    if ($this->is_account){
+      $display= $this->show_disable_header(_("Remove inventory"),
+          _("This server has inventory features enabled. You can disable them by clicking below."));
+    } else {
+      $display= $this->show_enable_header(_("Add inventory"),
+          _("This server has inventory features disabled. You can enable them by clicking below."));
+      return ($display);
+    }
+
+    
+    /*  ##########################################################################
+     *  Printer type management 
+     *  Dialog 
+     */
+
+    /* Rename was requested */
+    if(isset($_POST['Rename_PType_OK']) && $this->acl_is_writeable("type")){
+      $tmp = $this->handle->getPrinterTypes();
+      $allok = true;
+      foreach($tmp as $id => $name){
+        if(trim($name) == trim($_POST['string'])){
+          $allok = false;
+        }
+      }
+      if($allok){
+        $this->handle->updatePrinterType($_POST['string'],$this->select_type);
+        $this->rename = false;
+      }else{
+        print_red(sprintf(_("Can't rename given printer type to '%s', because this type name already exists."),$_POST['string']));
+      }
+    }
+
+    /* abort rename 
+     */
+    if(isset($_POST['Rename_Cancel'])){
+      $this->rename = false;
+    }
+
+    /* Printer type management
+     */
+    if(isset($_POST['edit_type']) && $this->acl_is_writeable("type")){
+      $this->dialog = true;
+      $this->edit_type=true;
+    }
+
+    /* This closes the printer type editing dialog
+     */
+    if(isset($_POST['close_edit_type'])){
+      $this->edit_type=false;
+      $this->dialog = false;
+    }
+
+    /* This appends a new printer to our sytem types
+     */
+    if((isset($_POST['add_type']))&&(!empty($_POST['type_string'])) && $this->acl_is_writeable("type")){
+    
+      $tmp = $this->handle->getPrinterTypes();
+      $allok = true;
+      foreach($tmp as $id => $name){
+        if(trim($name) == trim($_POST['type_string'])){
+          $allok = false;
+        }
+      }
+      if($allok){
+        $this->handle->addPrinterType($_POST['type_string']);  
+      }else{
+        print_red(sprintf(_("Can't rename given printer type to '%s', because this type name already exists."),$_POST['type_string']));
+      }
+    }
+
+    /* Remove selected type from our printer types list
+     */
+    if((isset($_POST['del_type']))&&(!empty($_POST['select_type'])) && $this->acl_is_writeable("type")){
+      $tmp = $this->handle->is_printerTypeUsed($_POST['select_type']);
+      if(count($tmp)){
+        $str = "";
+        foreach($tmp as $id => $name){
+          $str .= $name.", ";
+        }
+        $str = preg_replace("/, $/","",$str); 
+        print_red(sprintf(_("Can't delete printer type, it is still in use by '%s'."),$str));
+      }else{
+        $this->handle->removePrinterType($_POST['select_type']);  
+      }
+    }
+
+    /* Rename selected printer type to given string
+     */
+    if((isset($_POST['rename_type']))&&(!empty($_POST['select_type']))||($this->rename) && $this->acl_is_writeable("type")){
+      $this->rename = true;
+
+      $smarty->assign("Method","rename");
+
+      $tmp = $this->handle->getPrinterTypes();
+
+      if(isset($_POST['select_type'])){
+        $this->select_type = $_POST['select_type'];
+      }  
+      $smarty->assign("string",$tmp[$this->select_type]);
+      if(isset($_POST['string'])){
+        $smarty->assign("string",$_POST['string']);
+      }
+
+      $display= $smarty->fetch(get_template_path('glpi_edit_printer_type.tpl', TRUE));
+      return($display);
+    }  
+
+    /* Someone wants to edit the printer types ... 
+       So, lets open a new dialog which provides some buttons to edit the types
+     */
+    if($this->edit_type){
+      $smarty->assign("Method","edit");
+      $smarty->assign("PrinterTypes",            $this->handle->getPrinterTypes());
+      $smarty->assign("PrinterTypeKeys",         array_flip($this->handle->getPrinterTypes()));
+      $display= $smarty->fetch(get_template_path('glpi_edit_printer_type.tpl', TRUE));
+      return($display);
+    }
+
+
+    /*  ##########################################################################
+     *  Edit manufacturers 
+     *  Dialog 
+     */
+
+    /* Open dialog which allows to edit the manufacturers
+     */
+    if(isset($_POST['edit_manufacturer']) && $this->acl_is_writeable("FK_glpi_enterprise")){
+      $this->cur_dialog = new glpiManufacturer($this->config,$this->dn);
+      $this->dialog = true;
+      $this->editManufacturer =true;
+    }
+
+    /* Close manufacturer editing dialog
+     */
+    if((isset($_POST['close_edit_manufacturer']))&&($this->editManufacturer)){
+      $this->dialog = false;
+      $this->cur_dialog = false;
+      $this->editManufacturer=false;
+    }
+
+
+    /*  ##########################################################################
+     *  Technical responsible person
+     *  Contact person 
+     *  Dialog 
+     */
+
+    /* Show dialog to select a new contact person
+     * Select a contact person
+     */
+    if(isset($_POST['SelectContactPerson']) && $this->acl_is_writeable("contact_num")){
+      $this->addUser = "contact";
+      $this->cur_dialog= new glpiSelectUser($this->config,$this->dn,"user_tech_num");
+    }
+
+    /* Selecte technical responsible person
+     */
+    if(isset($_POST['SelectTechPerson']) && $this->acl_is_writeable("tech_num")){
+      $this->addUser ="tech";
+      $this->cur_dialog= new glpiSelectUser($this->config,$this->dn,"user_tech_num");
+    }
+
+    /* Abort user selection
+     */
+    $smarty->assign("AbortSelectUser","SelectUserCancel");
+    if(isset($_POST['SelectUserCancel'])){
+      $this->dialog = false;
+      $this->addUser ="";
+      $this->cur_dialog = false;
+    }
+
+    /* Technical responsible/contact person selected */
+    if(isset($_GET['act'])&&($_GET['act']=="user_tech_num")){
+
+      /* Get posted id */
+      $id = base64_decode($_GET['id']);
+
+      /* Check if user is already created in glpi database */
+      if(!in_array($id,$users)){
+
+        /* If this user doesn't exists in glpi db, we must create him */
+        $ldap->cat($id, array('cn', 'mail', 'telephoneNumber'));
+        $atr = $ldap->fetch();
+        $tmp = array();
+        $use = array( "cn"              =>"name",
+            "mail"            =>"email",
+            "telephoneNumber" =>"phone");
+
+        /* Create array */
+        foreach($use as $gosa => $glpi){
+          if(isset($atr[$gosa])){
+            $tmp[$glpi]= $atr[$gosa][0];
+          }
+        }
+
+        /* Add this user */
+        $this->handle->addUser($tmp,$id);
+      }
+
+      /* Re-read users */
+      $users = ($this->handle->getUsers());
+
+      /* Get user */
+      $tmp = array_flip($users);
+      $id=$tmp[$id];
+
+      /* Use user id, close dialog */
+      if($this->addUser == "tech"){
+        $this->tech_num = $id;
+      }else{
+        $this->contact_num = $id;
+      }
+      $this->cur_dialog   = false;
+      $this->dialog= false;
+    }
+
+
+    /*  ##########################################################################
+     *  Handle attachments 
+     */
+    
+    /* Attachment pool was closed with use
+     */
+    if(isset($_POST['UseAttachment']) && $this->acl_is_writeable("Attachments")){
+      if(count($this->cur_dialog->check())){
+        foreach($this->cur_dialog->check() as $msg){
+          print_red($msg);
+        }
+      }else{
+        $this->cur_dialog->save_object();
+        $this->usedAttachments = $this->cur_dialog->save();
+        $this->cur_dialog = false;
+        $this->edit_type = false; 
+      }
+    }
+   
+    /* Attachment pool was closed with abort
+     */ 
+    if(isset($_POST['AbortAttachment'])){
+      $this->cur_dialog = false;
+      $this->edit_type = false; 
+    }
+
+    /* Open Attachment pool to add/edit Attachments
+     */
+    if(isset($_POST['AddAttachment']) && $this->acl_is_writeable("Attachments")){
+      $this->cur_dialog = new glpiAttachmentPool($this->config,$this->dn,$this->usedAttachments);
+      $this->dialog = true;
+    }
+    
+    /* Remove Attachment from this tab 
+     */
+    $once = true;
+    foreach($_POST as $name => $value){
+      if((preg_match("/^delAttachment_/",$name))&&($once) && $this->acl_is_writeable("Attachments")){
+        $once= false;
+        $name = preg_replace("/^delAttachment_/","",$name);
+        $entry = preg_replace("/_.*$/","",$name);
+        if(isset($this->usedAttachments[$entry])){
+          unset($this->usedAttachments[$entry]);
+        }
+      }
+    }
+    if((isset($_POST['RemoveAttachment']))&&(isset($_POST['Attachments'])) && $this->acl_is_writeable("Attachments")){
+      if(isset($this->usedAttachments[$_POST['Attachments']])){
+        unset($this->usedAttachments[$_POST['Attachments']]);
+      }
+    }
+
+    /*  ##########################################################################
+     *  Printer Cartridge handling 
+     */
+
+    /* Abort cartridge select dialog
+     */
+    if(isset($_POST['SelectCartridgeCancel'])){
+      $this->cur_dialog = false;
+      $this->edit_type = false; 
+    }
+
+    /* Get selected cartridges and add them to our list 
+     */ 
+    if(isset($_POST['SelectCartridgeSave'])){
+      $this->cur_dialog->save_object();
+      $carts = $this->cur_dialog->save();
+      foreach($carts as $cart){
+        $cart['status'] = "new";
+        $this->usedCartridges[] = $cart;
+      }
+      $this->cur_dialog = false;
+      $this->edit_type = false; 
+    }
+
+    /* Remove cartridge  
+     */
+    if((isset($_POST['RemoveCartridge']))&&(isset($_POST['Cartridges'])) && $this->acl_is_writeable("ManageCartridges")){
+
+      foreach($_POST['Cartridges'] as $cartID){
+
+        if(isset($this->usedCartridges[$cartID])){
+          if($this->usedCartridges[$cartID]['status'] == "exists"){
+            $this->usedCartridges[$cartID]['status'] = "deleted";
+          }else{
+            unset($this->usedCartridges[$cartID]);
+          }
+        }
+      }
+    }
+
+    /* Open Attachment pool to add/edit Attachments
+     */
+    if(isset($_POST['AddCartridge']) && $this->acl_is_writeable("ManageCartridges")){
+      $this->cur_dialog = new glpiPrinterCartridges($this->config,$this->dn,$this->type);
+      $this->dialog = true;
+    }
+
+
+    /*  ##########################################################################
+     *  Draw Dialogs
+     */
+    /* if( cur_dialog != false || cur_dialog != NULL) 
+     * There is a dialog which wants to be displayed 
+     */
+    if($this->cur_dialog && is_object($this->cur_dialog)){
+      $this->cur_dialog->save_object();
+      $this->dialog=true;
+      $this->cur_dialog->parent = &$this;
+      return($this->cur_dialog->execute());
+    }else{
+      $this->dialog= false;
+    }
+
+
+    /*  ##########################################################################
+     *  Assign listbox / checkbox .... values to smarty  
+     */
+    /* Assign smarty defaults */ 
+    foreach(array("PrinterTypes","PrinterTypeKeys","Manufacturers","TechnicalResponsibles","Attachments","Cartridges") as $attr){
+      $smarty->assign($attr,array());
+    }
+
+    /* Assign some vars to smarty 
+     */
+    foreach(array("type","FK_glpi_enterprise","tech_num","contact_num","flags_serial","flags_par","flags_usb") as $attr){
+      $smarty->assign($attr,"");
+    }
+
+    $smarty->assign("comments",               $this->comments);
+    $smarty->assign("flags_serial",            $this->flags_serial);
+    $smarty->assign("flags_par",               $this->flags_par);
+    $smarty->assign("flags_usb",               $this->flags_usb);
+
+    /* Assign system types 
+     */
+    $smarty->assign("PrinterTypes",           $this->handle->getPrinterTypes());
+    $smarty->assign("PrinterTypeKeys",        array_flip($this->handle->getPrinterTypes()));
+    $smarty->assign("type",                   $this->type);
+
+    /* Append manufacturers
+     */
+    $smarty->assign("ManufacturerKeys",       array_flip($this->handle->getEnterprises()));
+    $smarty->assign("Manufacturers",          $this->handle->getEnterprises());
+    $smarty->assign("FK_glpi_enterprise",     $this->FK_glpi_enterprise);
+
+    /* Assign used Attachments
+    */
+
+    $divlist = new divSelectBox("glpiAttachmentsList");
+    $divlist-> SetHeight(120);
+    $atts = $this->getUsedAttachments(true);
+    $downlink = "<a href='get_attachment.php?id=%s' target='_blank'>%s</a>";
+    $del_link = "<input type='image' src='images/edittrash.png' name='delAttachment_%s'>";
+    foreach($atts as $id => $attachment){
+      $divlist->AddEntry
+          (
+        array(
+            array("string"=>$attachment['name']),
+            array("string"=>$attachment['mime']),
+            array("string"=>sprintf($downlink,$id,$attachment['filename'])),
+            array("string"=>sprintf($del_link,$attachment['ID']),"attach"=>"style='border-right:0px;'"),
+             )
+          );
+    }
+
+    $smarty->assign("AttachmentsDiv"          ,$divlist->DrawList());
+    $smarty->assign("Attachments",            $this->getUsedAttachments());
+    $smarty->assign("AttachmentKeys",         array_flip($this->getUsedAttachments()));
+
+    /* Assign Cartridges 
+     */
+    $smarty->assign("Cartridges",            $this->getUsedCartridges());
+    $smarty->assign("CartridgeKeys",         $this->getUsedCartridges(true));
+
+    /*  ##########################################################################
+     *  Assign contact and technical responsible person 
+     */
+    if(isset($users[$this->contact_num])){
+      $ldap->cat($users[$this->contact_num], array('givenName', 'sn', 'uid'));
+      $tr = $ldap->fetch();
+      $str = "";
+      if(isset($tr['givenName'][0])){   $str .= $tr['givenName'][0]." ";      }
+      if(isset($tr['sn'][0])) {         $str .= $tr['sn'][0]." ";             }
+      if(isset($tr['uid'][0])){         $str .= "[".$tr['uid'][0]."]";        }
+      $smarty->assign("contact_num",               $str);
+    }else{
+      $smarty->assign("contact_num",               _("N/A"));
+    }
+
+    /* Handle tech person 
+       Assign name ... to smarty, if set
+     */ 
+    if(isset($users[$this->tech_num])){
+      $ldap->cat($users[$this->tech_num], array('givenName', 'sn', 'uid'));
+      $tr = $ldap->fetch();
+      $str = "";
+      if(isset($tr['givenName'][0])){   $str .= $tr['givenName'][0]." ";      }
+      if(isset($tr['sn'][0])) {         $str .= $tr['sn'][0]." ";             }
+      if(isset($tr['uid'][0])){         $str .= "[".$tr['uid'][0]."]";        }
+      $smarty->assign("tech_num",               $str);
+    }else{
+      $smarty->assign("tech_num",               _("N/A"));
+    }
+
+    /* If theres a cartridge selected, you can't change the printer type.
+     */ 
+    $disp = true;
+
+    foreach($this->usedCartridges as $cart){
+      if($cart['status'] != "deleted"){
+        $disp = false;
+      }
+    }
+    if($disp==false){
+      $smarty->assign("typeACL", $this->getacl("type",true));
+    }
+
+    $display.= $smarty->fetch(get_template_path('glpiPrinter.tpl', TRUE));
+    return($display);
+  }
+
+  function remove_from_parent()
+  {
+    $this->handle = new glpiDB($this->data['SERVER'],$this->data['LOGIN'],$this->data['PASSWORD'],$this->data['DB']);
+    if($this->initially_was_account){
+      $this->handle->removePrinterInformations($this->dn);
+      new log("remove","printer/".get_class($this),$this->dn); 
+    }
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    if(isset($_POST['glpiPrinterFlagsPosted'])){
+      plugin::save_object();
+      foreach($this->attributes as $attrs){
+        if(isset($_POST[$attrs])){
+          $this->$attrs = $_POST[$attrs];
+        }
+      }
+
+      if(isset($_POST['FK_glpi_enterprise']) && $this->acl_is_writeable("FKglpienterprise")){
+        $this->FK_glpi_enterprise = $_POST['FK_glpi_enterprise'];
+      }
+
+      foreach(array("flags_serial","flags_par","flags_usb") as $checkboxes){
+        if($this->acl_is_writeable($checkboxes)){
+          if(isset($_POST[$checkboxes])){
+            $this->$checkboxes = 1;
+          }else{
+            $this->$checkboxes = 0;
+          }
+        }
+      }
+    }
+
+  }
+
+
+  /* Check supplied data */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    //    if($this->TechnicalResponsible == ""){
+    //      $message[] = _("Please select a technical responsible person for this entry.");
+    //    }
+
+    return ($message);
+  }
+
+  /* Save to LDAP */
+  function save()
+  {
+    if($this->is_account){
+        $attrs = array();
+      $this->date_mod = date("Y-m-d H:i:s");
+      foreach($this->attributes as $attr){
+        $attrs[$attr] = $this->$attr;
+      }
+      $attrs['name'] = $this->dn;
+      unset($attrs['ID']);
+      $this->handle = new glpiDB($this->data['SERVER'],$this->data['LOGIN'],$this->data['PASSWORD'],$this->data['DB']);
+      if($this->initially_was_account&&$this->is_account){
+        $this->handle->updatePrinterInformations($attrs,$this->dn);
+        new log("modify","printer/".get_class($this),$this->dn); 
+      }elseif($this->is_account){
+        $this->handle->addPrinterInformations($attrs,$this->dn);
+        new log("create","printer/".get_class($this),$this->dn); 
+      }
+      $tmp = $this->handle->getPrinterInformations($this->dn);
+      $this->handle->addAttachmentsToPrinter($this->usedAttachments,$tmp[0]['ID']);
+
+      foreach($this->usedCartridges as $cart){
+        if($cart['status'] == "deleted"){
+          $this->handle->removeCartridgeFromPrinter($cart['ID']);
+        }elseif($cart['status'] == "new"){
+          $this->handle->addCartridgeFromPrinter($tmp[0]['ID'],$cart['type_ID']);
+        }
+      }
+    }
+  }
+
+  /* Return used attachments */
+  function getUsedAttachments($divlist = false)
+  {
+    $atts =$this->handle->getAttachments();
+    $ret = array();
+    foreach($atts as $entry){
+      if(in_array($entry['ID'],$this->usedAttachments)){
+        if($divlist){
+          $ret[$entry['ID']] = $entry;
+        }else{
+          $cm ="";
+          if(isset($entry['comment'])){
+            $cm=" [".$entry['comment']."]";
+          }
+          if(isset($entry['mime'])){
+            $cm.=" -".$entry['mime']."";
+          }
+
+          $ret[$entry['ID']]= $entry['name'].$cm;
+        }
+      }
+    }
+    return($ret);
+  }
+
+  function getUsedCartridges($flip = false)
+  {
+    $ret = array();
+    foreach($this->usedCartridges as $key => $value){
+      if($value['status'] == "deleted") continue;
+      if($flip){
+        $ret[$key] = $key;    
+      }else{
+        $ret[$key] = $value['name']." [".$value['type_name']."] "._("since")." :".$value['date_use'];
+      }
+    }
+    return($ret);
+  }  
+
+     /* Return plugin informations for acl handling */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Glpi"),
+          "plDescription" => _("Printer inventory extension"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 10,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("printer"),
+
+          "plProvidedAcls"=> array(
+            "flags_serial"         => _("Supports serial interface"),
+            "flags_par"            => _("Supports parallel interface"),
+            "flags_usb"            => _("Supports usb interface"),
+            "tech_num"             => _("Technical responsible"),
+            "comments"             => _("Comments"),
+            "location"             => _("Location"),
+            "contact_num"          => _("Contact person"),
+            "type"                 => _("Type"),
+            "FKglpienterprise"   => _("Manufacturer"),
+
+            "Attachments"          => _("Attachments"),
+        
+            "ManageCartridges"            => _("Cartridge settings"))
+          ));
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/services/glpi/class_glpiPrinterCartridges.inc b/plugins/admin/systems/services/glpi/class_glpiPrinterCartridges.inc
new file mode 100644 (file)
index 0000000..3d9d630
--- /dev/null
@@ -0,0 +1,298 @@
+<?php
+
+class glpiPrinterCartridges 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("whatever");
+
+  var $parent           = NULL;       // Contains parent class, to access glpi db handle
+  var $usedCartridges   = array();    // IDs of used cartridges for this printer 
+  var $PrinterType      = 0;          // Specifies which cartridge types are available
+
+  var $cur_dialog       = false;
+  var $cur_sub_dialog   = false;
+
+  var $editManufacturer = false;
+  var $del              = 0;
+
+
+  function glpiPrinterCartridges (&$config,$dn,$type)
+  {
+    plugin::plugin ($config, $dn);
+
+    /* Assign some basic settings */
+    $this->ui = get_userinfo();  
+    if(!isset($_SESSION['glpiCartridgeRegex'])){
+      $_SESSION['glpiCartridgeRegex'] = "*";
+    }
+  
+    /* Only display cartridges for this type of printer */
+    $this->PrinterType = $type;
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+    $display ="";
+    $smarty = get_smarty();
+    $filter = $_SESSION['glpiCartridgeRegex'];
+
+    /* Filter settings, remove double* */
+    if(isset($_GET['search'])){
+      $filter = preg_replace("/\*\**/","*",$_GET['search']."*");
+    }elseif(isset($_POST['cartridge_regex'])){
+      $filter = preg_replace("/\*\**/","*",$_POST['cartridge_regex']);
+    }
+    if(empty($filter)) {
+      $filter = "*";
+    }
+    $_SESSION['glpiCartridgeRegex']= $filter;
+
+    /* Open dialog which allows to edit the manufacturers
+     */
+    if(isset($_POST['edit_manufacturer_cartridges'])){
+      $this->cur_sub_dialog = new glpiManufacturer($this->config,$this->dn);
+      $this->dialog = true;
+      $this->editManufacturer =true;
+    }
+
+    /* Close manufacturer editing dialog
+     */
+    if((isset($_POST['close_edit_manufacturer']))&&($this->editManufacturer)){
+      $this->dialog = false;
+      $this->cur_sub_dialog = false;
+      $this->editManufacturer=false;
+    }
+
+    /* Check poted vars and do the requested job, but only once */
+    $only_once = true;
+    foreach($_POST as $name => $value){
+
+      /* We have to create a new cartridge */
+      if(preg_match("/^newcartridge/",$name)&&($only_once)){
+        $this->cur_dialog = new glpiPrinterCartridgesEdit($this->config,$this->dn,$this->PrinterType); 
+        $only_once = false;
+      }
+    }
+  
+    /* Edit cartridge */
+    if(isset($_GET['act'])&&$_GET['act']=="edit_cartridge"){
+      $val = ($this->parent->handle->getCartridgeTypeInformations($_GET['id']));
+      $this->cur_dialog = new glpiPrinterCartridgesEdit($this->config,$this->dn,$this->PrinterType,$val[$_GET['id']]); 
+    }
+    /* remove cartridge */ 
+    if(isset($_GET['act'])&&$_GET['act']=="del_cartridge"){
+        /* remove attach from db */
+        $this->del = $_GET['id'];
+        $val = ($this->parent->handle->getCartridgeTypeInformations($_GET['id']));
+        $smarty->assign("warning", sprintf(_("You're about to delete the glpi cartridge type '%s'."), $val[$this->del]['name']));
+        return($smarty->fetch(get_template_path('remove_glpi.tpl', TRUE)));
+    }
+
+    if(isset($_POST['delete_cancel'])){
+      $this->del = false;
+    }
+
+    /* Delete this entry */
+    if(isset($_POST['delete_glpi_confirm'])&&($this->del)) {
+      $tmp = $this->parent->handle->is_cartridgeTypeUsed($this->del);
+      if(count($tmp)){
+
+        $str = "";
+        foreach($tmp as $id => $name){
+          $str .= $name.", "; 
+        }
+        $str = preg_replace("/, $/","",$str);
+
+        print_red(sprintf(_("You can't delete this cartridge type, it is still in use by this printer(s) '%s'."),$str));
+      }else{
+        $val = ($this->parent->handle->getCartridgeTypeInformations($this->del));
+        $this->cur_dialog = new glpiPrinterCartridgesEdit($this->config,$this->dn,$this->PrinterType,$val[$this->del]); 
+        $this->cur_dialog->parent = $this->parent;
+        $this->cur_dialog->remove_from_parent();
+        $this->cur_dialog= false;
+      } 
+    }
+
+    /* Abort edit / add dialog */
+    if(isset($_POST['CancelCartridge'])){
+      $this->cur_dialog = false;
+    }
+  
+    /* Save changes if check is ok */
+    if(isset($_POST['SaveCartridge'])){
+      $this->cur_dialog->save_object();
+      if(count($this->cur_dialog->check())) {
+        foreach($this->cur_dialog->check() as $checks){
+          print_red($checks);
+        }
+      }else{
+        $this->cur_dialog->save();
+        $this->cur_dialog = false;
+      }
+    }
+
+    /* If we have a dialog open, display it */
+    if($this->cur_sub_dialog){
+      $this->cur_sub_dialog->parent = $this->parent;
+      $this->cur_sub_dialog->save_object();
+      return($this->cur_sub_dialog->execute());
+    }
+    /* If we have a dialog open, display it */
+    if($this->cur_dialog){
+      $this->cur_dialog->parent = $this->parent;
+      $this->cur_dialog->save_object();
+      return($this->cur_dialog->execute());
+    }
+
+    /* Create divlist */
+    $divlist = new divlist("glpi devices");
+    $divlist->SetPluginMode();
+    $divlist->SetEntriesPerPage(0);
+    $divlist->SetHeader(array(
+          array("string" => "&nbsp;", "attach" => "style='text-align:center;width:20px;'"),
+          array("string" => _("Cartridges"), "attach" => "style=''"),
+          array("string" => _("Action"), "attach" => "style='width:60px;border-right:0px;text-align:right;'" )));
+
+    /* Links for editing,adding.... */
+    $edit =     "<a href='?plug=".$_GET['plug']."&amp;act=edit_cartridge&amp;id=%s'>%s</a>";
+    $editdel =  "<a href='?plug=".$_GET['plug']."&amp;act=edit_cartridge&amp;id=%s'><img src='images/edit.png' alt='"._("Edit")."' border=0></a>";
+    $editdel.= "<a href='?plug=".$_GET['plug']."&amp;act=del_cartridge&amp;id=%s'><img src='images/edittrash.png' alt='"._("Delete")."' border=0></a>";
+   
+    /* Checkbox for selection of some cartridges */ 
+    $useCartridge = "<input type='hidden' name='wasOnPage_%s' value='%s'><input type='checkbox' value='%s' name='useCartridge_%s' %CHECKED%>";
+
+    /* Add cartridges */ 
+    $cart = $this->getCartridgeTypes();
+
+    /* Remove typically error possibilities */
+    $f = str_replace("/","\/",$filter);
+    $f = str_replace(".","\.",$f);
+    $f = str_replace("*",".*",$f);
+
+    /* Assign cartridges */
+    foreach($cart as $key=>$cartr){
+
+      /* Skip if filter doesn't match*/
+      if(!preg_match("/^".$f."$/i",$cartr['cartridgeName'])){
+        continue;
+      }
+
+      /* check if this cartridge is selected */
+      $chk = "";
+      if(isset($this->usedCartridges[$key])){
+        $chk = " checked ";
+      }
+
+      /* Add fields */
+      $field1 = array("string" => preg_replace("/%s/",($key),preg_replace("/%CHECKED%/",$chk,$useCartridge)), 
+                      "attach" => "style='text-align:center;width:20px;'");
+      $field2 = array("string" => sprintf($edit,($key),$cartr['cartridgeName']."&nbsp;[".$cartr['cartridgeTypeName']."]"), 
+                      "attach" => "style=''");
+      $field3 = array("string" => sprintf($editdel,($key),($key)), 
+                      "attach" => "style='width:60px;border-right:0px;text-align:right;'");
+
+      $divlist->AddEntry(array($field1,$field2,$field3));
+      
+    }
+   
+    /* Create list header */ 
+    $listhead = "<div style='background:#F0F0F9;padding:5px;'>".
+      " <input class='center' type='image' align='middle' 
+      src='images/zip.png'  title='"._("New monitor")."' alt='"._("M")."' name='newcartridge'>&nbsp;".
+      "</div>";
+
+    /* Tell smarty some vars */
+    $filter= $_SESSION['glpiCartridgeRegex'];
+    $smarty->assign("devicehead", $listhead);
+    $smarty->assign("devices", $divlist->DrawList());
+    $smarty->assign("search_image", get_template_path('images/search.png'));
+    $smarty->assign("searchu_image", get_template_path('images/search_user.png'));
+    $smarty->assign("tree_image", get_template_path('images/tree.png'));
+    $smarty->assign("infoimage", get_template_path('images/info_small.png'));
+    $smarty->assign("launchimage", get_template_path('images/small_filter.png'));
+    $smarty->assign("apply", apply_filter());
+    $smarty->assign("alphabet", generate_alphabet());
+    $smarty->assign("cartridge_regex", $filter);
+
+    $display.= $smarty->fetch(get_template_path('glpiPrinterCartridges.tpl', TRUE));
+    return($display);
+  }
+
+  /* Save device to glpi database 
+   * If this is a new device, create a new entry, else update this entry 
+   */
+  function save()
+  {
+    $carts = $this->getCartridgeTypes();
+    $ret = array();
+    foreach($this->usedCartridges as $key){
+      $tmp =array();
+      $tmp['date_use']        = date("Y-m-d");
+      $tmp['ID']              = -1;
+      $tmp['type_ID']         = $carts[$key]['cartridgeID'];
+      $tmp['name']            = $carts[$key]['cartridgeName'];
+      $tmp['FK_glpi_printers']= -1;
+      $tmp['type_name']       = $carts[$key]['cartridgeTypeName'];
+      $ret[$key] = $tmp;
+    }
+    return($ret);
+  }
+
+  /* this only gets all already defined devices */
+  function reload()
+  {
+    $this->devices = $this->parent->handle->getDevices();
+    ksort($this->devices);
+  }
+
+  /* This funtions saves all POST variables.
+     The variable must be in the array $this->EditEntry 
+  */
+  function save_object()
+  {
+    /* Checkbox handling 
+     * Check which checkbox is selected 
+     */
+    foreach($_POST as $name => $value){
+      if(preg_match("/wasOnPage/",$name)){
+        $id = preg_replace("/wasOnPage_/","",$name);
+        if(isset($_POST['useCartridge_'.$id])){
+          $this->usedCartridges[$id]=$id;
+        }else{
+          unset($this->usedCartridges[$id]);
+        }
+      }
+    }
+  }
+
+  /* This function cehck all created devices if you wan't to create device specific check 
+      use >>if($attr['device_type']=="moboard")<< to create a device type depending check
+   */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    return($message);
+  }
+
+  /* Return cartriges for our divlist */
+  function getCartridgeTypes()
+  {
+    $ret = array();
+    $ret = $this->parent->handle->getAvailableCartridgeTypes($this->PrinterType);
+    return($ret);
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/services/glpi/class_glpiPrinterCartridgesEdit.inc b/plugins/admin/systems/services/glpi/class_glpiPrinterCartridgesEdit.inc
new file mode 100644 (file)
index 0000000..e1d86fc
--- /dev/null
@@ -0,0 +1,337 @@
+<?php
+
+class glpiPrinterCartridgesEdit 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("ID","name","ref","location","type","FK_glpi_enterprise","tech_num","deleted","comments","alarm");
+  var $objectclasses        = array("whatever");
+
+  var $printer_type      = 0;
+
+  var $additional_printer= array();
+  var $needToCatch       = true;
+
+  var $parent           = NULL;
+
+  var $ID                 = "";
+  var $name               = "";
+  var $ref                = "";
+  var $location           = "";
+  var $type               = "";
+  var $FK_glpi_enterprise = "";
+  var $tech_num           = "";
+  var $deleted            = "";
+  var $comments           = "";
+  var $alarm              = "";  
+
+  var $cur_dialog         = false;
+  var $edit_type          =false;
+
+
+  function glpiPrinterCartridgesEdit (&$config, $dn,$printer_type,$values = NULL )
+  {
+    plugin::plugin ($config, $dn);
+    foreach($this->attributes as $val){
+      if(isset($values[$val])){
+        $this->$val = $values[$val];
+      }else{
+        $this->$val = "";
+      }
+    }
+    $this->needToCatch = true;
+    $this->printer_type = $printer_type;
+  }
+
+  function remove_from_parent()
+  {
+    if($this->ID > 0){
+      $this->parent->handle->removeCartridgeDropdownType($this->ID);
+    }
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+    $display= "";
+
+    /* Get all currently used/supported printer types for this cartridge type
+     */
+    if($this->needToCatch){
+      $this->needToCatch = false;
+      if(!empty($this->type)){
+        $this->additional_printer= $this->parent->handle->getSupportedPrinterTypeIDsForCartridge($this->ID);
+      }
+    }
+
+
+
+
+
+  
+    /* Printer type management
+     */
+    if(isset($_POST['edit_type_cartridge'])){
+      $this->dialog = true;
+      $this->edit_type=true;
+    }
+
+    /* This closes the printer type editing dialog
+     */
+    if(isset($_POST['close_edit_type_cartridge'])){
+      $this->edit_type=false;
+      $this->dialog = false;
+    }
+
+    /* This appends a new printer to our sytem types
+     */
+    if((isset($_POST['add_cartridge_type']))&&(!empty($_POST['cartridge_type_string']))){
+      print "Add";
+      $this->parent->handle->addCartridgeDropdownType($_POST['cartridge_type_string']);
+    }
+
+    /* Remove selected type from our printer types list
+     */
+    if((isset($_POST['del_cartridge_type']))&&(!empty($_POST['select_type_cartridge']))){
+      $used = $this->parent->handle->getUsedDropdownTypes($_POST['select_type_cartridge']);
+      if(!count($used)){
+        $this->parent->handle->removeCartridgeDropdownType($_POST['select_type_cartridge']);
+      }else{
+        print_red(_("Can't delete this entry, it is still in use."));
+      }
+    }
+
+    /* Rename selected printer type to given string
+     */
+    /* Update*/
+    if((isset($_POST['rename_cartridge_type']))&&(!empty($_POST['select_type_cartridge']))&&(!empty($_POST['cartridge_type_string']))){
+      $this->parent->handle->updateCartridgeDropdownType($_POST['cartridge_type_string'],$_POST['select_type_cartridge']);
+    }
+
+    /* Someone wants to edit the printer types ...
+       So, lets open a new dialog which provides some buttons to edit the types
+     */
+    if($this->edit_type){
+      $smarty->assign("PrinterTypes",            $this->parent->handle->getCartridgeTypes());
+      $smarty->assign("PrinterTypeKeys",         array_flip($this->parent->handle->getCartridgeTypes()));
+      $display= $smarty->fetch(get_template_path('glpi_edit_cartridge_type.tpl', TRUE));
+      return($display);
+    }
+
+    /* Assign attributes */ 
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr,$this->$attr);
+    }
+
+    /* Selecte technical responsible person
+     */
+    if(isset($_POST['SelectCartridgeTechPerson'])){
+      $this->cur_dialog= new glpiSelectUser($this->config,$this->dn,"user_cartridge_tech_num");
+    }
+
+    /* Abort user selection
+     */
+    $smarty->assign("AbortSelectUser","SelectCartridgeUserCancel");
+    $smarty->assign("SaveSelectUser" ,"user_cartridge_tech_num");
+    if(isset($_POST['SelectCartridgeUserCancel'])){
+      $this->dialog = false;
+      $this->addUser ="";
+      $this->cur_dialog = false;
+    }
+
+    /* Start ldap, and get all glpiUsers */
+    $ldap = $this->config->get_ldap_link();
+    $users = ($this->parent->handle->getUsers());
+
+    /* Technical responsible/contact person selected 
+    */
+    if(isset($_GET['act'])&&($_GET['act']=="user_cartridge_tech_num")){
+
+      /* Get posted id */
+      $id = base64_decode($_GET['id']);
+
+      /* Check if user is already created in glpi database */
+      if(!in_array($id,$users)){
+
+        /* If this user doesn't exists in glpi db, we must create him */
+        $ldap->cat($id, array('cn', 'mail', 'telephoneNumber'));
+        $atr = $ldap->fetch();
+        $tmp = array();
+        $use = array( "cn"              =>"name",
+            "mail"            =>"email",
+            "telephoneNumber" =>"phone");
+
+        /* Create array */
+        foreach($use as $gosa => $glpi){
+          if(isset($atr[$gosa])){
+            $tmp[$glpi]= $atr[$gosa][0];
+          }
+        }
+
+        /* Add this user */
+        $this->parent->handle->addUser($tmp,$id);
+      }
+
+      /* Re-read users */
+      $users = ($this->parent->handle->getUsers());
+
+      /* Get user */
+      $tmp = array_flip($users);
+      $id=$tmp[$id];
+    
+      /* Close dialog and use this user */
+      $this->tech_num = $id;
+      $this->cur_dialog   = false;
+      $this->dialog= false;
+    }
+
+    /* Execute dialog*/
+    if($this->cur_dialog){
+      $this->cur_dialog->save_object();
+      $this->dialog=true;
+      $this->cur_dialog->parent = &$this;
+      return($this->cur_dialog->execute());
+    }else{
+      $this->dialog= false;
+    }
+
+    /* Create matrix with all possible printer types 
+     */
+    $matrix = "<table summary=''><tr>";
+    $types = $this->parent->handle->getPrinterTypes();
+   
+    /* Specifies number of cols */ 
+    $spalten = 2;
+    
+    $spalt = $spalten; 
+    foreach($types as $key => $type){
+      $spalt -- ; 
+
+      /* Create new row, if cols for this row reached $spalten */
+      if($spalt < 0) {
+        $spalt = $spalten -1;
+        $matrix .= "</tr><tr>";
+      }
+
+      /* Avoid deselecting every checkbox */
+      if($key == $this->printer_type){
+        $matrix.= "<td><input type='checkbox' name='UsePrinterType_".$key."' disabled checked>".$type."</td>";
+      }else{
+      
+        /* Cehck checkbox */
+        $check = "";
+        if(isset($this->additional_printer[$key])){
+          $check = " checked "; 
+        }
+        $matrix.= "<td><input type='checkbox' name='UsePrinterType_".$key."' ".$check." ><input type='hidden' name='wasOnPage_".$key."' ".$check.">".$type."</td>";
+      }
+    }
+    
+    /* Complete table row, to avoid html errors */
+    if($spalt >0){
+      while($spalt >0){
+        $spalt -- ;
+        $matrix .="<td>&nbsp;</td>";
+      }
+    }
+    
+    $matrix .= "</tr></table>";
+
+     /* Append manufacturers
+     */
+    $smarty->assign("PrinterTypeMatrix",      $matrix);
+    
+    $smarty->assign("ManufacturerKeys",       array_flip($this->parent->handle->getEnterprises()));
+    $smarty->assign("Manufacturers",          $this->parent->handle->getEnterprises());
+    $smarty->assign("FK_glpi_enterprise",     $this->FK_glpi_enterprise);
+
+    $smarty->assign("typeKeys",               array_flip($this->parent->handle->getCartridgeTypes()));
+    $smarty->assign("types",                  $this->parent->handle->getCartridgeTypes());
+    $smarty->assign("type",                   $this->type);
+
+     /* Handle tech person
+       Assign name ... to smarty, if set
+     */
+    if(isset($users[$this->tech_num])){
+      $ldap->cat($users[$this->tech_num], array('givenName', 'sn', 'uid'));
+      $tr = $ldap->fetch();
+      $str = "";
+      if(isset($tr['givenName'][0])){   $str .= $tr['givenName'][0]." ";      }
+      if(isset($tr['sn'][0])) {         $str .= $tr['sn'][0]." ";             }
+      if(isset($tr['uid'][0])){         $str .= "[".$tr['uid'][0]."]";        }
+      $smarty->assign("tech_num",               $str);
+    }else{
+      $smarty->assign("tech_num",               _("N/A"));
+    }
+
+
+    $display.= $smarty->fetch(get_template_path('glpiPrinterCartridgesEdit.tpl', TRUE,dirname(__FILE__)));
+    return($display);
+  }
+
+  /* Check given values */
+  function check(){
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+  
+    /* Avoid choosing an already used name */
+    $types = $this->parent->handle->getCartridgeTypeInformations();
+    foreach($types as $type){
+      if($type['name'] == $this->name){
+        if($type['ID'] != $this->ID){
+          $message[]= _("The selected name is already in use.");
+        }        
+      }
+    }  
+    return $message;
+  }
+
+  /* Save Post data */
+  function save_object()
+  {
+    foreach($this->attributes as $attr){
+      if(isset($_POST[$attr])){
+        $this->$attr= $_POST[$attr];
+      }
+    }
+
+    /* Get selected checkboxes */
+    foreach($_POST as $name => $value){
+      if(preg_match("/wasOnPage_/",$name)){
+        $id = preg_replace("/wasOnPage_/","",$name);
+        if(isset($_POST['UsePrinterType_'.$id])){
+          $this->additional_printer[$id]=$id;
+        }else{
+          if(isset($this->additional_printer[$id])){
+            unset($this->additional_printer[$id]);
+          }
+        }
+      }
+    }
+  }
+
+  /* Create / Update database with this new infos */
+  function save()
+  {
+    $tmp  = array();
+    foreach($this->attributes as $attr){
+      $tmp[$attr] = $this-> $attr;
+    }
+    $types = array();
+    $types = $this->additional_printer;
+    $types[$this->printer_type]=$this->printer_type;
+    $this->parent->handle->Add_UpdateCatrigdeType($tmp,$types);
+  }
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/services/glpi/class_glpiSelectUser.inc b/plugins/admin/systems/services/glpi/class_glpiSelectUser.inc
new file mode 100644 (file)
index 0000000..7073b12
--- /dev/null
@@ -0,0 +1,285 @@
+<?php
+
+class glpiSelectUser 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("whatever");
+
+  var $users = array();
+  var $departments = array();
+
+  var $ui;
+
+  var $PostVarName      = "";
+
+  function glpiSelectUser (&$config, $dn= NULL,$postvar)
+  {
+    plugin::plugin ($config, $dn);
+
+    $this->PostVarName = $postvar;
+
+    if(!isset($_SESSION['glpi_user_filter'])){
+      $tmp['users_regex'] = "*";
+      $tmp['base']       = $this->config->current['BASE'];
+      $_SESSION['glpi_user_filter'] = $tmp;
+    }
+
+    $this->ui = get_userinfo();  
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    if(isset($_POST['depselect'])){
+      $_SESSION['glpi_user_filter']['base'] = $_POST['depselect'];
+    }
+
+    $filter = $_SESSION['glpi_user_filter'];
+
+    /* Filter settings, remove double* */
+    if(isset($_GET['search'])){
+      $filter['users_regex'] = preg_replace("/\*\**/","*",$_GET['search']."*");
+    }elseif(isset($_POST['regex'])){
+      $filter['users_regex'] = preg_replace("/\*\**/","*",$_POST['regex']);
+    }
+    if(empty($filter['users_regex'])) {
+      $filter = "*";
+    }
+
+
+    $s_action="";
+    /* Test Posts */
+    foreach($_POST as $key => $val){
+      // Post for delete
+      if(preg_match("/dep_back.*/i",$key)){
+        $s_action="back";
+      }elseif(preg_match("/user_new.*/",$key)){
+        $s_action="new";
+      }elseif(preg_match("/dep_home.*/i",$key)){
+        $s_action="home";
+      }
+    }
+
+    /* Homebutton is posted */
+    if($s_action=="home"){
+      $filter['base']=(preg_replace("/^[^,]+,/","",$this->ui->dn));
+      $filter['base']=(preg_replace("/^[^,]+,/","",$filter['base']));
+    }
+
+    if($s_action=="root"){
+      $filter['base']=($this->config->current['BASE']);
+    }
+
+
+    /* If Backbutton is Posted */
+    if($s_action=="back"){
+      $base_back          = preg_replace("/^[^,]+,/","",$filter['base']);
+      $base_back          = convert_department_dn($base_back);
+
+      if(isset($this->config->departments[trim($base_back)])){
+        $filter['base']= $this->config->departments[trim($base_back)];
+      }else{
+        $filter['base']= $this->config->departments["/"];
+      }
+    }
+
+    if((isset($_GET['act']))&&($_GET['act']=="dep_open")){
+      $entry = base64_decode($_GET['dep_id']);
+      $filter['base']= ($this->config->departments[$entry]); 
+    }    
+
+    $_SESSION['glpi_user_filter'] = $filter;
+
+    $this->reload();
+
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+    $display= "";
+
+    $divlist = new divlist("glpi users");
+    $divlist->SetPluginMode();
+    $divlist->SetEntriesPerPage(0);
+    $divlist->SetHeader(array(
+          array("string" => "&nbsp;", "attach" => "style='text-align:center;width:20px;'"),
+          array("string" => _("Users")." / "._("Departments"), "attach" => "style=''"),
+          array("string" => _("Use"), "attach" => "style='width:60px;border-right:0px;text-align:right;'" )));
+    $linkopen = "<a href='?plug=".$_GET['plug']."&amp;act=dep_open&amp;dep_id=%s'>%s</a>";
+    foreach($this->departments as $key=> $val){
+
+      if(!isset($this->config->departments[trim($key)])){
+        $this->config->departments[trim($key)]="";
+      }
+
+      $non_empty="";
+      $keys= str_replace("/","\/",$key);
+      foreach($this->config->departments as $keyd=>$vald ){
+        if(preg_match("/".$keys."\/.*/",$keyd)){
+          $non_empty="full";
+        }
+      }
+
+      $field1 = array("string" => "<img src='images/".$non_empty."folder.png' alt='department'>", "attach" => "style='text-align:center;width:20px;'");
+      $field2 = array("string" => sprintf($linkopen,base64_encode($key),$val), "attach" => "style=''");
+      $field3 = array("string" => "&nbsp;", "attach" => "style='width:60px;border-right:0px;text-align:right;'");
+      $divlist->AddEntry(array($field1,$field2,$field3));
+    }
+
+    $useruse = "<a href='?plug=".$_GET['plug']."&amp;act=".$this->PostVarName."&amp;id=%s'>%s</a>";
+    
+    foreach($this->users as $key=>$user){
+      $field1 = array("string" => "<img src='images/select_user.png' alt='user' >", "attach" => "style='text-align:center;width:20px;'");
+      $field2 = array("string" => sprintf($useruse,base64_encode($key),$user), "attach" => "style=''");
+      $field3 = array("string" => sprintf($useruse,base64_encode($key),"<img title='"._("Use")."' border=0 src='images/crossref.png' alt='"._("use")."'>"), 
+        "attach" => "style='width:60px;border-right:0px;text-align:right;'");
+      $divlist->AddEntry(array($field1,$field2,$field3));
+      
+    }
+
+     /* Prepare departments,
+       which are shown in the listbox on top of the listbox
+     */
+
+    
+    /* Get all departments within this subtree */
+    $this->base = $_SESSION['glpi_user_filter']['base'];
+    $options  ="";
+    $base = $this->config->current['BASE'];
+    $deps= get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", "users", $base,
+                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH);
+
+    /* Load possible departments */
+    $ui= get_userinfo();
+    $tdeps= $ui->get_module_departments("users");
+    $ids = $this->config->idepartments;
+    foreach($deps as $dep){
+      if(isset($ids[$dep['dn']]) && in_array_ics($dep['dn'], $tdeps)){
+        $value = $ids[$dep['dn']];
+        if ($this->base == $dep['dn']){
+          $options.= "<option selected='selected' value='".$dep['dn']."'>$value</option>";
+        } else {
+          $options.= "<option value='".$dep['dn']."'>$value</option>";
+        }
+      }
+    }
+
+    $listhead = "<div style='background:#F0F0F9;padding:5px;'>".
+      " <input class='center' type='image' src='images/list_root.png' 
+      align='middle' title='"._("Go to root department")."' name='dep_root' alt='"._("Root")."'>&nbsp;".
+      " <input class='center' type='image' align='middle' 
+      src='images/list_back.png' title='"._("Go up one department")."' alt='"._("Up")."' name='dep_back'>&nbsp;".
+      " <input class='center' type='image' align='middle' 
+      src='images/list_home.png' title='"._("Go to users department")."' alt='"._("Home")."' name='dep_home'>&nbsp;".
+      " <input class='center' type='image' src='images/list_reload.png' align='middle' title='"._("Reload list")."' name='submit_department' alt='"._("Submit")."'>&nbsp;".
+" <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;"._("Base")."&nbsp;".
+    " <select name='depselect' onChange='mainform.submit()' class='center'>$options</select>".
+    " <input class='center' type='image' src='images/list_submit.png' align='middle'
+        title='"._("Submit department")."' name='submit_department' alt='".           _("Submit")."'>&nbsp;".
+      "</div>";
+
+
+    $filter= $_SESSION['glpi_user_filter'];
+    $smarty->assign("usershead", $listhead);
+    $smarty->assign("users", $divlist->DrawList());
+    $smarty->assign("search_image", get_template_path('images/search.png'));
+    $smarty->assign("searchu_image", get_template_path('images/search_user.png'));
+    $smarty->assign("tree_image", get_template_path('images/tree.png'));
+    $smarty->assign("infoimage", get_template_path('images/info_small.png'));
+    $smarty->assign("launchimage", get_template_path('images/small_filter.png'));
+    $smarty->assign("apply", apply_filter());
+    $smarty->assign("alphabet", generate_alphabet());
+    $smarty->assign("users_regex", $filter['users_regex']);
+
+
+    $display.= $smarty->fetch(get_template_path('glpiSelectUser.tpl', TRUE));
+    return($display);
+  }
+
+  /* Save to LDAP */
+  function save()
+  {
+    plugin::save();
+
+    /* Optionally execute a command after we're done */
+#$this->handle_post_events($mode);
+  }
+
+  function reload()
+  {
+
+    $filter= $_SESSION['glpi_user_filter'];
+
+    $base = $filter['base'];
+    $regex= $filter['users_regex'];
+    /* NEW LIST MANAGMENT
+     * We also need to search for the departments
+     * So we are able to navigate like in konquerer
+     */
+
+    $res3= get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))","users",
+       $base, array("ou", "description"), GL_SIZELIMIT | GL_CONVERT);
+
+    $this->departments= array();
+    $tmp = array();
+    foreach ($res3 as $value){
+      $tmp[strtolower($value['dn']).$value['dn']]=$value;
+    }
+    ksort($tmp);
+    foreach($tmp as $value){
+      if(isset($value["description"][0])){
+        $this->departments[$value['dn']]= get_sub_department($value['dn'])." - [".$value["description"][0]."]";
+      }else{
+        $this->departments[$value['dn']]= get_sub_department($value['dn']);//$value["description"][0];
+      }
+    }
+
+    /* END NEW LIST MANAGMENT
+     */
+    $ou = get_people_ou();
+
+    $res2= get_list("(&(|(cn=$regex)(sn=$regex))(objectClass=person))", "users",
+                    $ou.$base, array("cn", "sn", "uid", "givenName", "description"),
+                    GL_SUBSEARCH | GL_SIZELIMIT);
+
+    $tmp = array();
+
+    foreach($res2 as $val){
+      $str = "";
+      if(isset($val['givenName'][0])){
+        $str .= $val['givenName'][0];
+      }
+      if(isset($val['sn'][0])){
+        $str .= $val['sn'][0];
+      }
+      if(isset($val['uid'][0])){
+        $str .= $val['uid'][0];
+      }
+
+      $tmp[$str] = $val;
+    }
+
+    ksort($tmp);
+    $this->users = array();
+    foreach($tmp as $value){
+      if (isset($value["givenName"][0]) && isset($value["sn"][0])){
+        $this->users[$value['dn']]= $value["sn"][0].", ".
+          $value["givenName"][0].
+          " [".$value["uid"][0]."]";
+      } else {
+        $this->users[$value["dn"]]= "[".$value["uid"][0]."]";
+      }
+    }
+  }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/services/glpi/class_goGlpiServer.inc b/plugins/admin/systems/services/glpi/class_goGlpiServer.inc
new file mode 100644 (file)
index 0000000..07c07d4
--- /dev/null
@@ -0,0 +1,109 @@
+<?php
+
+class goGlpiServer extends goService {
+       
+  var $cli_summary      = "This pluign is used within the ServerService Pluign \nand indicates that this server supports asterisk management.";
+  var $cli_description  = "Some longer text\nfor help";
+  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* This plugin only writes its objectClass */
+  var $objectclasses    = array("goGlpiServer");
+  var $attributes       = array("goGlpiAdmin","goGlpiDatabase","goGlpiPassword");
+  var $StatusFlag       = "goGlpiServerStatus";
+  /* This class can't be assigned twice so it conflicts with itsself */
+  var $conflicts        = array("goGlpiServer");
+
+  var $DisplayName      = "";
+  var $dn               = NULL;
+  var $cn               = "";
+  var $acl;
+
+  var $goGlpiServerStatus ="";
+  var $goGlpiAdmin        ="";
+  var $goGlpiDatabase     ="";
+  var $goGlpiPassword     ="";
+  var $view_logged  =FALSE;
+  function goGlpiServer(&$config,$dn)
+  {
+    goService::goService($config,$dn);
+    $this->DisplayName = _("Inventory database");
+  }
+
+
+  function execute()
+  { 
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","server/".get_class($this),$this->dn);
+    }
+
+    $smarty = get_smarty(); 
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr,$this->$attr);
+    }
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation ){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+    return($smarty->fetch(get_template_path("goGlpiServer.tpl",TRUE,dirname(__FILE__))));
+  }
+
+
+  function getListEntry()
+  {
+    $fields               = goService::getListEntry();
+    $fields['Message']    = _("Inventory database service");
+    $fields['AllowEdit']  = true;
+    return($fields);
+  }
+
+  function check()
+  { 
+    $message = plugin::check();
+    if(empty($this->goGlpiAdmin)){
+      $message[]= _("The attribute user is empty or contains invalid characters.");
+    }
+    if(empty($this->goGlpiDatabase)){
+      $message[]= _("The attribute database is empty or contains invalid characters.");
+    }
+    return($message);
+  }
+  
+
+  function save_object()
+  {
+    if(isset($_POST['goGlpiServer_posted'])){
+      plugin::save_object();
+    }
+  } 
+
+  /* Return plugin informations for acl handling */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Inventory database"),
+          "plDescription" => _("Inventory database")." ("._("Services").")" ,
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 93,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("server"),
+
+          "plProvidedAcls"=> array(
+            "start"         => _("Start"),
+            "stop"          => _("Stop"),
+            "restart"       => _("Restart"),
+
+            "goGlpiAdmin"    => _("Admin"), 
+            "goGlpiDatabase" => _("Database"),
+            "goGlpiPassword" => _("Password"))
+          ));
+  }
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/services/glpi/glpi.tpl b/plugins/admin/systems/services/glpi/glpi.tpl
new file mode 100644 (file)
index 0000000..0d2f8db
--- /dev/null
@@ -0,0 +1,138 @@
+<table summary="" style="width:100%;">
+       <tr>
+               <td style="width:50%;vertical-align:top;" >
+                       <!--Upper left-->       
+                       
+                       <h2>{t}Generic{/t}</h2>
+                       <table summary="" cellpadding=5>
+                               <tr>
+                                       <td >{t}System type{/t}
+                                       </td>
+                                       <td>
+{render acl=$typeACL}
+                                               <select name="type">
+                                                       {html_options values=$SystemTypeKeys output=$SystemTypes selected=$type}
+                                               </select>
+{/render}
+{render acl=$typeACL}
+                                               <input type="submit" value="{t}edit{/t}" name="edit_type">      
+{/render}
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>{t}Operating system{/t}
+                                       </td>
+                                       <td>
+{render acl=$osACL}
+                                               <select name="os">
+                                                       {html_options values=$OSKeys output=$OSs selected=$os}
+                                               </select>       
+{/render}
+{render acl=$osACL}
+                                               <input type="submit" value="{t}edit{/t}" name="edit_os">        
+{/render}
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>{t}Manufacturer{/t}
+                                       </td>
+                                       <td>
+{render acl=$FK_glpi_enterpriseACL}
+                                               <select name="FK_glpi_enterprise">
+                                                       {html_options values=$ManufacturerKeys output=$Manufacturers selected=$FK_glpi_enterprise}
+                                               </select>       
+{/render}
+{render acl=$FK_glpi_enterpriseACL}
+                                               <input type="submit" value="{t}edit{/t}" name="edit_manufacturer">      
+{/render}
+                                       </td>
+                               </tr>
+                       <!--</table>
+                       <p class="seperator">&nbsp;</p>
+                       <h2>{t}Contacts{/t}</h2>
+                       <table summary="" width="100%">-->
+                               <tr>
+                                       <td>
+                                               {t}Contact person{/t}
+                                       </td>
+                                       <td>
+                                               <i>{$contact_num}&nbsp; </i>&nbsp;
+{render acl=$contact_numACL}
+                                               <input type="submit" name="SelectContactPerson" value="{t}Edit{/t}">
+{/render}
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>{t}Technical responsible{/t}&nbsp;
+                                       </td>
+                                       <td>
+                                               <i>{$tech_num}&nbsp; </i>&nbsp;
+{render acl=$tech_numACL}
+                                               <input type="submit" value="{t}Edit{/t}" name="SelectTechPerson">
+{/render}
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+               <td style="border-left: 1px solid rgb(160, 160, 160); vertical-align: top; padding-right: 5px;">
+                       <!--Upper right-->
+                       <h2>{t}Comment{/t}</h2>
+                       <table summary="" width="100%">
+                               <tr>
+                                       <td valign="top" colspan="2">
+{render acl=$commentsACL}
+                                               <textarea name="comments" style="width:100%;height:180px;">{$comments}</textarea>
+{/render}
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+       </tr>
+</table>
+<p class="seperator" >&nbsp;</p>
+<table summary="" style="width:100%;">
+       <tr>
+               <td style="width:50%;">
+                       <h2>{t}Installed devices{/t}</h2>
+                       <table summary="" width="100%"> 
+                               <tr>
+                                       <td>
+{render acl=$DevicesACL}
+                                               <select name="InstalledDevices" style="height:130px;width:100%;" multiple>
+                                                       {html_options values=$InstalledDeviceKeys output=$InstalledDevices}
+                                               </select>
+{/render}
+{render acl=$DevicesACL}
+                                               <input name="AddDevice" value="{t}Edit{/t}" type="submit">      
+{/render}
+                                       </td>
+                               </tr>
+                       </table>
+<!--                   <p class="seperator" >&nbsp;</p>
+                       <input type="submit" value="{t}Trading{/t}" name="Trading">     
+                       <input type="submit" value="{t}Software{/t}" name="Software">   
+                       <input type="submit" value="{t}Contracts{/t}" name="Contracts"> -->
+               </td>
+               <td style="border-left: 1px solid rgb(160, 160, 160); vertical-align: top; padding-right: 5px;">
+                       <h2>{t}Attachments{/t}</h2>
+                       <table summary="" width="100%"> 
+                               <tr>
+                                       <td>
+{render acl=$AttachmentsACL}
+                                               {$AttachmentsDiv}
+{/render}
+{render acl=$AttachmentsACL}
+                                               <input name="AddAttachment"     value="{t}Add{/t}" type="submit">       
+{/render}
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+       </tr>
+</table>
+<input type="hidden" name="glpi_tpl_posted" value="1">
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('type');
+  -->
+</script><p style="text-align:right">
diff --git a/plugins/admin/systems/services/glpi/glpiAttachmentEdit.tpl b/plugins/admin/systems/services/glpi/glpiAttachmentEdit.tpl
new file mode 100644 (file)
index 0000000..7d91e50
--- /dev/null
@@ -0,0 +1,78 @@
+<br>
+<h2>{t}Attachment{/t}</h2>
+       
+<table summary="" width="100%">
+       <tr>
+               <td width="50%" style="vertical-align:top;">
+                       <table summary="" width="100%">
+                               <tr>
+                                       <td  style="vertical-align:top;">
+                                               {t}Name{/t}
+                                       </td>
+                                       <td>
+                                               <input type="text" value="{$name}" name="name">
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td style="vertical-align:top;">
+                                               {t}Comment{/t}
+                                       </td>
+                                       <td style="vertical-align:top;">
+                                               <textarea name="comment">{$comment}</textarea>
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+               <td  style="vertical-align:top;">
+                       <table summary="" width="100%">
+                               <tr>
+                                       <td style="vertical-align:top;">
+                                               {t}File{/t}
+                                       </td>
+                                       <td style="vertical-align:top;">
+                                               <input type="file" value="" name="filename"><input type="submit" name="upload" value="{t}Upload{/t}">
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td style="vertical-align:top;">
+                                               {t}Status{/t}
+                                       </td>
+                                       <td style="vertical-align:top;">
+                                               {$status}
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td style="vertical-align:top;">
+                                               {t}Filename{/t}
+                                       </td>
+                                       <td style="vertical-align:top;">
+                                               {$filename}
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td style="vertical-align:top;">
+                                               {t}Mime-type{/t}
+                                       </td>
+                                       <td style="vertical-align:top;">
+                                               {$mime}
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+       </tr>
+</table>
+
+
+<p class="seperator">&nbsp;</p>
+<div align="right">
+       <p>
+               <input type="submit" name="SaveAttachment"              value="{t}Save{/t}">
+               <input type="submit" name="CancelAttachment"    value="{t}Cancel{/t}">
+       </p>
+</div>
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('name');
+  -->
+</script>
+
diff --git a/plugins/admin/systems/services/glpi/glpiAttachmentPool.tpl b/plugins/admin/systems/services/glpi/glpiAttachmentPool.tpl
new file mode 100644 (file)
index 0000000..e3a73be
--- /dev/null
@@ -0,0 +1,54 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
+<tr>
+  <td style="vertical-align:top;width:50%;" >
+  <div class="contentboxh" style="height:20px;">
+    <p class="contentboxh" style="font-size:12px;">
+     {t}List of attachments{/t}
+    </p>
+  </div>
+  <div class="contentboxb">
+      {$attachmenthead}
+  </div>
+  <div style='height:4px;'></div>
+  <div class="contentboxb" style="border-top:1px solid #B0B0B0;">
+      {$attachments}
+    <input type=hidden name="edit_helper">
+  </div>
+  </td>
+  <td style="vertical-align:top;">
+   <div class="contentboxh" style="border-bottom:1px solid #B0B0B0;height:20px;">
+    <p class="contentboxh" style="font-size:12px;"><img src="{$infoimage}" align="right" alt="[i]">{t}Information{/t}</p>
+   </div>
+   <div class="contentboxb" style="padding:5px;">
+    {t}This dialog allow you to attach additional objects (like manuals, guides, etc.)  to your currently edited computer.{/t}
+   </div>
+   <br>
+   <div class="contentboxh" style="height:20px;">
+    <p class="contentboxh" style="font-size:12px;"><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>
+<table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
+<tr>
+<td><LABEL for="regex"><img alt="{t}Display attachments matching{/t}" src="{$search_image}" align=middle></label></td>
+<td width="99%">
+<input type='text' style='width:99%' name='attachment_regex' maxlength='20' value='{$attachment_regex}' title='{t}Regular expression for matching attachment names{/t}' onChange="mainform.submit()">
+</td>
+</tr>
+</table>
+   {$apply}
+   </div>
+  </td>
+</tr>
+</table>
+
+<input type="hidden" name="ignore">
+<p class="seperator">&nbsp;</p>
+<div align="right">
+       <p>
+               <input type="submit" name="UseAttachment" value="{t}Use{/t}">
+               <input type="submit" name="AbortAttachment" value="{t}Cancel{/t}">
+       </p>
+</div>
diff --git a/plugins/admin/systems/services/glpi/glpiDeviceManagement.tpl b/plugins/admin/systems/services/glpi/glpiDeviceManagement.tpl
new file mode 100644 (file)
index 0000000..ab2baa7
--- /dev/null
@@ -0,0 +1,54 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
+<tr>
+  <td style="vertical-align:top;width:50%;" >
+  <div class="contentboxh" style="height:20px;">
+    <p class="contentboxh" style="font-size:12px;">
+     {t}List of devices{/t}
+    </p>
+  </div>
+  <div class="contentboxb">
+      {$devicehead}
+  </div>
+  <div style='height:4px;'></div>
+  <div class="contentboxb" style="border-top:1px solid #B0B0B0;">
+      {$devices}
+    <input type=hidden name="edit_helper">
+  </div>
+  </td>
+  <td style="vertical-align:top;">
+   <div class="contentboxh" style="border-bottom:1px solid #B0B0B0;height:20px;padding:0px;">
+    <p class="contentboxh" style="font-size:12px;padding:0px;"><img src="{$infoimage}" align="right" alt="[i]">{t}Information{/t}</p>
+   </div>
+   <div class="contentboxb" style="padding:5px;">
+    {t}This dialog allows you to attach a device to your currently edited computer.{/t}
+   </div>
+   <br>
+   <div class="contentboxh" style="height:20px;">
+    <p class="contentboxh" style="font-size:12px;"><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>
+<table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
+<tr>
+<td><LABEL for="regex"><img alt="{t}Display devices matching{/t}" src="{$search_image}" align=middle></label></td>
+<td width="99%">
+<input type='text' style='width:99%' name='device_regex' maxlength='20' value='{$device_regex}' title='{t}Regular expression for matching device names{/t}' onChange="mainform.submit()">
+</td>
+</tr>
+</table>
+   {$apply}
+   </div>
+  </td>
+</tr>
+</table>
+
+<input type="hidden" name="ignore">
+<p class="seperator">&nbsp;</p>
+<div align="right">
+       <p>
+               <input type="submit" name="SelectDeviceSave" value="{t}Use{/t}">
+               <input type="submit" name="SelectDeviceCancel" value="{t}Cancel{/t}">
+       </p>
+</div>
diff --git a/plugins/admin/systems/services/glpi/glpiManufacturer.tpl b/plugins/admin/systems/services/glpi/glpiManufacturer.tpl
new file mode 100644 (file)
index 0000000..a15a29a
--- /dev/null
@@ -0,0 +1,15 @@
+<h2>{t}Manage manufacturers{/t}</h2>
+<select name="manufacturer" style="width:100%;" size="12">
+  {html_options values=$ManuKeys output=$Manus}
+</select>
+<br>
+<input name="add_manu"                 value="{t}Add{/t}"              type="submit">
+<input name="edit_manu"        value="{t}Edit{/t}"     type="submit">
+<input name="remove_manu"      value="{t}Remove{/t}"   type="submit">
+
+<p class="seperator">&nbsp;</p>
+<div align="right">
+<p>
+       <input name="close_edit_manufacturer" value="{t}Close{/t}" type="submit">
+</p>
+</div>
diff --git a/plugins/admin/systems/services/glpi/glpiManufacturerAdd.tpl b/plugins/admin/systems/services/glpi/glpiManufacturerAdd.tpl
new file mode 100644 (file)
index 0000000..c5b060d
--- /dev/null
@@ -0,0 +1,89 @@
+<h2>{t}Add/Edit manufacturer{/t}</h2>
+<table summary="" width="100%">
+       <tr>
+               <td width="50%">
+                       <table summary=""> 
+                               <tr>
+                                       <td>{t}Name{/t}
+                                       </td>
+                                       <td>
+                                               <input type="text" name="name" value="{$name}">
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>{t}Website{/t}
+                                       </td>
+                                       <td>
+                                               <input type="text" name="website" value="{$website}">
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td style="vertical-align:top;">{t}Address{/t}
+                                       </td>
+                                       <td>
+                                               <textarea  name="address">{$address}</textarea>
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+               <td>
+                       <table summary="" >
+                               <tr>
+                                       <td>{t}Phone number{/t}
+                                       </td>
+                                       <td>
+                                               <input type="text" name="phonenumber" value="{$phonenumber}">
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>{t}Fax{/t}
+                                       </td>
+                                       <td>
+                                               <input type="text" name="fax" value="{$fax}">
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>{t}Email{/t}
+                                       </td>
+                                       <td>
+                                               <input type="text" name="email" value="{$email}">
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td style="vertical-align:top;">{t}Comments{/t}
+                                       </td>
+                                       <td>
+                                               <textarea name="comments">{$comments}</textarea>
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+       </tr>
+</table>
+
+
+
+
+
+
+
+
+
+
+
+
+
+<br>
+<p class="seperator">&nbsp;</p>
+<div align="right">
+<p>
+       <input name="save_manufacturer" value="{t}Save{/t}" type="submit">
+       <input name="close_manufacturer" value="{t}Close{/t}" type="submit">
+</p>
+</div>
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+               focus_field('name');
+  -->
+</script>
+
diff --git a/plugins/admin/systems/services/glpi/glpiPrinter.tpl b/plugins/admin/systems/services/glpi/glpiPrinter.tpl
new file mode 100644 (file)
index 0000000..46e3446
--- /dev/null
@@ -0,0 +1,159 @@
+<table summary="" style="width:100%;">
+       <tr>
+               <td style="width:50%;vertical-align: top;">
+                       <!--Upper left-->       
+                       
+                       <h2>{t}Generic{/t}</h2>
+                       <table summary="" cellpadding=5>
+                               <tr>
+                                       <td width="150">{t}Printer type{/t}
+                                       </td>
+                                       <td>
+{render acl=$typeACL}
+                                               <select name="type" >
+                                                       {html_options values=$PrinterTypeKeys output=$PrinterTypes selected=$type}
+                                               </select>
+{/render}
+{render acl=$typeACL}
+                                               <input type="submit" value="{t}edit{/t}" name="edit_type" >     
+{/render}
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>{t}Manufacturer{/t}
+                                       </td>
+                                       <td>
+{render acl=$FKglpienterpriseACL}
+                                               <select name="FK_glpi_enterprise" >
+                                                       {html_options values=$ManufacturerKeys output=$Manufacturers selected=$FK_glpi_enterprise}
+                                               </select>       
+{/render}
+{render acl=$FKglpienterpriseACL}
+                                               <input type="submit" value="{t}edit{/t}" name="edit_manufacturer" >     
+{/render}
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+               <td style="border-left: 1px solid rgb(160, 160, 160); vertical-align: top; padding-right: 5px;">
+                       <h2>{t}Supported interfaces{/t}</h2>
+                       <table summary="" width="100%">
+                               <tr>
+                                       <td width="20">
+{render acl=$flags_serialACL}
+                                               <input type="checkbox" name="flags_serial" {if $flags_serial=="1"} checked {/if} value="1" >
+{/render}
+                                       </td>
+                                       <td>
+                                               {t}Serial{/t}
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td width="20">
+{render acl=$flags_parACL}
+                                               <input type="checkbox" name="flags_par" {if $flags_par=="1"} checked {/if} value="1" >
+{/render}
+                                       </td>
+                                       <td>
+                                               {t}Parallel{/t}
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td width="20">
+{render acl=$flags_usbACL}
+                                               <input type="checkbox" name="flags_usb" {if $flags_usb=="1"} checked {/if} value="1" >
+{/render}
+                                       </td>
+                                       <td>
+                                               {t}USB{/t}
+                                       </td>
+                               </tr>
+                       </table>
+                       <input name="glpiPrinterFlagsPosted" value="1" type="hidden">
+               </td>
+       </tr>
+</table>
+<p class="seperator" >&nbsp;</p>
+<table summary="" style="width:100%;">
+       <tr>
+               <td style="width:50%;vertical-align: top;">
+                       <h2>{t}Contacts{/t}</h2>
+                       <table summary="" cellpadding=5>
+                               <tr>
+                                       <td>{t}Technical responsible{/t}&nbsp;
+                                       </td>
+                                       <td>
+                                               <i>{$tech_num}&nbsp; </i>&nbsp;
+{render acl=$tech_numACL}
+                                               <input type="submit" value="{t}Edit{/t}" name="SelectTechPerson" >
+{/render}
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>
+                                               {t}Contact person{/t}
+                                       </td>
+                                       <td>
+                                               <i>{$contact_num}&nbsp; </i>&nbsp;
+{render acl=$contact_numACL}
+                                               <input type="submit" name="SelectContactPerson" value="{t}Edit{/t}">
+{/render}
+
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+               <td style="border-left: 1px solid rgb(160, 160, 160); vertical-align: top; padding-right: 5px;">
+                       <h2>{t}Attachments{/t}</h2>
+                       <table summary="" width="100%"> 
+                               <tr>
+                                       <td>
+{render acl=$AttachmentsACL}
+                                               {$AttachmentsDiv}
+{/render}
+{render acl=$AttachmentsACL}
+                                               <input name="AddAttachment"     value="{t}Add{/t}" type="submit" >      
+{/render}
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+       </tr>
+</table>
+<p class="seperator" >&nbsp;</p>
+<table summary="" style="width:100%;">
+       <tr>
+               <td style="width:50%;vertical-align: top;">
+                       <h2>{t}Information{/t}</h2>
+                       <table summary="" width="100%">
+                               <tr>
+                                       <td width="100%">
+{render acl=$commentsACL}
+                                               <textarea name="comments" style="width:100%;height:100px;" >{$comments}</textarea>
+{/render}
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+               <td style="border-left: 1px solid rgb(160, 160, 160); vertical-align: top; padding-right: 5px;">
+                       <h2>{t}Installed cartridges{/t}</h2>
+                       <table summary="" width="100%"> 
+                               <tr>
+                                       <td>
+{render acl=$CartridgesACL}
+                                               <select name="Cartridges[]"  style="height:100px;width:100%;" multiple>
+                                                       {html_options values=$CartridgeKeys output=$Cartridges}
+                                               </select>
+{/render}
+{render acl=$CartridgesACL}
+                                               <input name="AddCartridge"      value="{t}Add{/t}" type="submit" >      
+{/render}
+{render acl=$CartridgesACL}
+                                               <input name="RemoveCartridge"   value="{t}Remove{/t}" type="submit" >   
+{/render}
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+       </tr>
+</table>
diff --git a/plugins/admin/systems/services/glpi/glpiPrinterCartridges.tpl b/plugins/admin/systems/services/glpi/glpiPrinterCartridges.tpl
new file mode 100644 (file)
index 0000000..5dcd2de
--- /dev/null
@@ -0,0 +1,54 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
+<tr>
+  <td style="vertical-align:top;width:50%;" >
+  <div class="contentboxh" style="height:20px;">
+    <p class="contentboxh" style="font-size:12px;">
+     {t}List of available cartridge type for this type of printer{/t}
+    </p>
+  </div>
+  <div class="contentboxb">
+      {$devicehead}
+  </div>
+  <div style='height:4px;'></div>
+  <div class="contentboxb" style="border-top:1px solid #B0B0B0;">
+      {$devices}
+    <input type=hidden name="edit_helper">
+  </div>
+  </td>
+  <td style="vertical-align:top;">
+   <div class="contentboxh" style="border-bottom:1px solid #B0B0B0;height:20px;" >
+    <p class="contentboxh" style="font-size:12px;"><img src="{$infoimage}" align="right" alt="[i]">{t}Information{/t}</p>
+   </div>
+   <div class="contentboxb" style="padding:5px;">
+    {t}This dialog allows you to create new types of cartridges, and select one or more types for your printer. Cartridge types depends on the printer type you have selected. For each selected cartridge type there will be a new cartridge created, this allows you to select the same cartridge type for more then one printer.{/t}
+   </div>
+   <br>
+   <div class="contentboxh" style="height:20px;">
+    <p class="contentboxh" style="font-size:12px;"><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>
+<table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
+<tr>
+<td><LABEL for="regex"><img alt="{t}Display cartridge types matching{/t}" src="{$search_image}" align=middle></label></td>
+<td width="99%">
+<input type='text' style='width:99%' name='cartridge_regex' maxlength='20' value='{$cartridge_regex}' title='{t}Regular expression for matching cartridge types{/t}' onChange="mainform.submit()">
+</td>
+</tr>
+</table>
+   {$apply}
+   </div>
+  </td>
+</tr>
+</table>
+
+<input type="hidden" name="ignore">
+<p class="seperator">&nbsp;</p>
+<div align="right">
+       <p>
+       <input type="submit" name="SelectCartridgeSave" value="{t}Use{/t}">
+       <input type="submit" name="SelectCartridgeCancel" value="{t}Cancel{/t}">
+       </p>
+</div>
diff --git a/plugins/admin/systems/services/glpi/glpiPrinterCartridgesEdit.tpl b/plugins/admin/systems/services/glpi/glpiPrinterCartridgesEdit.tpl
new file mode 100644 (file)
index 0000000..6857efd
--- /dev/null
@@ -0,0 +1,83 @@
+<table summary="" title="" style="width: 100%;">
+       <tr>
+               <td>
+                       <h2>{t}Generic{/t}</h2>
+                       <table summary="" title="" width="100%" style="vertical-align:top;">    
+                               <tr>
+                                       <td>{t}Name{/t}
+                                       </td>
+                                       <td>
+                                               <input type="text" name="name" value="{$name}">
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>{t}Reference{/t}
+                                       </td>
+                                       <td>
+                                               <input type="text" name="ref" value="{$ref}">
+                                       </td>
+                               </tr>
+                       </table>
+                       <p class="seperator">&nbsp;</p>
+                       <h2>{t}Comments{/t}</h2>
+                       <table summary="" title="" width="100%" style="vertical-align:top;">    
+                               <tr>
+                                       <td>{t}Comment{/t}
+                                       </td>
+                                       <td>
+                                               <textarea name="comments" style="width:100%;">{$comments}</textarea>    
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+               <td style="vertical-align:top;border-left: 1px solid rgb(160, 160, 160);padding-right: 5px;">
+                       <h2>{t}Generic{/t}</h2>
+            <table summary="" title="" width="100%" style="vertical-align:top;">
+                <tr>
+                    <td>{t}Type{/t}
+                    </td>
+                    <td>
+                                               <select name="type" >
+                            {html_options values=$typeKeys output=$types selected=$type}
+                        </select>
+                        <input type="submit" value="{t}edit{/t}" name="edit_type_cartridge">
+                    </td>
+                       </tr>
+                <tr>
+                    <td>{t}Manufacturer{/t}
+                    </td>
+                    <td>
+                                               <select name="FK_glpi_enterprise">
+                            {html_options values=$ManufacturerKeys output=$Manufacturers selected=$FK_glpi_enterprise}
+                        </select>
+                        <input type="submit" value="{t}edit{/t}" name="edit_manufacturer_cartridges">
+                    </td>
+                       </tr>
+                               <tr>
+                    <td>{t}Technical responsible{/t}&nbsp;
+                    </td>
+                    <td>
+                        <i>{$tech_num}&nbsp; </i>&nbsp;
+                        <input type="submit" value="{t}Choose{/t}" name="SelectCartridgeTechPerson">
+                    </td>
+                </tr>
+                       </table>
+                       <p class="seperator">&nbsp;</p>
+                       {$PrinterTypeMatrix}
+               </td>
+       </tr>
+</table>
+
+<p class="seperator">&nbsp;</p>
+<div style="text-align:right;">
+       <p>
+               <input type="submit" name="SaveCartridge"       value="{t}Save{/t}">&nbsp;
+               <input type="submit" name="CancelCartridge" value="{t}Cancel{/t}"><br>
+       </p>
+</div>
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('name');
+  -->
+</script>
+
diff --git a/plugins/admin/systems/services/glpi/glpiSelectUser.tpl b/plugins/admin/systems/services/glpi/glpiSelectUser.tpl
new file mode 100644 (file)
index 0000000..75bf351
--- /dev/null
@@ -0,0 +1,53 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
+<tr>
+  <td style="vertical-align:top;width:50%;" >
+  <div class="contentboxh" style="height:20px;">
+    <p class="contentboxh" style="font-size:12px;">
+     {t}List of users{/t}
+    </p>
+  </div>
+  <div class="contentboxb">
+      {$usershead}
+  </div>
+  <div style='height:4px;'></div>
+  <div class="contentboxb" style="border-top:1px solid #B0B0B0;">
+      {$users}
+    <input type=hidden name="edit_helper">
+  </div>
+  </td>
+  <td style="vertical-align:top;">
+   <div class="contentboxh" style="border-bottom:1px solid #B0B0B0;height:20px;">
+    <p class="contentboxh" style="font-size:12px;"><img src="{$infoimage}" align="right" alt="[i]">{t}Information{/t}</p>
+   </div>
+   <div class="contentboxb" style="padding:5px;">
+    {t}This dialog allows you to select a user as technical responsible person.{/t}
+   </div>
+   <br>
+   <div class="contentboxh" style="height:20px;">
+    <p class="contentboxh" style="font-size:12px"><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>
+<table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
+<tr>
+<td><LABEL for="regex"><img alt="{t}Display users matching{/t}" src="{$search_image}" align=middle></label></td>
+<td width="99%">
+<input type='text' style='width:99%' name='regex' maxlength='20' value='{$users_regex}' title='{t}Regular expression for matching user names{/t}' onChange="mainform.submit()">
+</td>
+</tr>
+</table>
+   {$apply}
+   </div>
+  </td>
+</tr>
+</table>
+
+<input type="hidden" name="ignore">
+<p class="seperator">&nbsp;</p>
+<div align="right">
+       <p>
+       <input type="submit" name="{$AbortSelectUser}" value="{t}Cancel{/t}">
+</p>
+</div>
diff --git a/plugins/admin/systems/services/glpi/glpi_devices.tpl b/plugins/admin/systems/services/glpi/glpi_devices.tpl
new file mode 100644 (file)
index 0000000..44de4fa
--- /dev/null
@@ -0,0 +1,763 @@
+{if $device_type=="monitor"}
+       <h2><img alt="" align="middle" src="images/monitor.png" class="center">&nbsp;{t}Add/Edit monitor{/t}</h2>
+       <p class="seperator">&nbsp;</p>
+       <br>
+       <table summary="" width="100%">
+               <tr>
+                       <td width="50%" style="vertical-align:top; border-right:1px solid #A0A0A0; padding-right:5px;">
+                               <table summary="" width="100%">
+                                       <tr>
+                                               <td>{t}Name{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input name="name" value="{$name}">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td style="vertical-align:top;">{t}Comments{/t}
+                                               </td>   
+                                               <td>    
+                                                       <textarea name="comments">{$comments}</textarea>
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>{t}Manufacturer{/t}
+                                               </td>   
+                                               <td>    
+                                                       <select name="FK_glpi_enterprise">
+                                                               {html_options values=$FK_glpi_enterpriseKeys output=$FK_glpi_enterprises selected=$FK_glpi_enterprise}
+                                                       </select>
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td style="vertical-align:top;">{t}Monitor size{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input name="size" value="{$size}"> {t}Inch{/t}
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+                       <td>
+                               <table summary="" width="100%">
+                                       <tr>
+                        <td>{t}Integrated microphone{/t}
+                        </td>
+                        <td>
+                            <input type="radio" name="flags_micro" value="1" {if $flags_micro == "1"}checked {/if}>{t}Yes{/t}
+                            <input type="radio" name="flags_micro" value="0" {if ($flags_micro == "0")||($flags_micro=="")}checked {/if}>{t}No{/t}
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>{t}Integrated speakers{/t}
+                        </td>
+                        <td>
+                            <input type="radio" name="flags_speaker" value="1" {if $flags_speaker == "1"}checked {/if}>{t}Yes{/t}
+                            <input type="radio" name="flags_speaker" value="0" {if ($flags_speaker == "0")||($flags_speaker=="")}checked {/if}>{t}No{/t}
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>{t}Sub-D{/t}
+                        </td>
+                        <td>
+                            <input type="radio" name="flags_subd" value="1" {if $flags_subd == "1"}checked {/if}>{t}Yes{/t}
+                            <input type="radio" name="flags_subd" value="0" {if ($flags_subd == "0")||($flags_subd=="")}checked {/if}>{t}No{/t}
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>{t}BNC{/t}
+                        </td>
+                        <td>
+                            <input type="radio" name="flags_bnc" value="1" {if $flags_bnc == "1"}checked {/if}>{t}Yes{/t}
+                            <input type="radio" name="flags_bnc" value="0" {if ($flags_bnc == "0")||($flags_bnc=="")}checked {/if}>{t}No{/t}
+                        </td>
+                    </tr>
+                                       <tr>
+                                               <td style="vertical-align:top;">{t}Serial number{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input name="serial" value="{$serial}">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td style="vertical-align:top;">{t}Additional serial number{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input name="otherserial" value="{$otherserial}">
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+               </tr>
+       </table>
+
+
+{elseif $device_type=="pci"}
+
+        <h2><img alt="" align="middle" src="images/fai_template.png" class="center">&nbsp;{t}Add/Edit other device{/t}</h2>
+        <p class="seperator">&nbsp;</p>
+        <br>
+       <table summary="" width="100%">
+               <tr>
+                       <td width="50%" style="vertical-align:top; border-right:1px solid #A0A0A0; padding-right:5px;">
+                               <table summary="" width="100%">
+                                       <tr>
+                                               <td>{t}Name{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input name="designation" value="{$designation}">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td style="vertical-align:top;">{t}Comment{/t}
+                                               </td>   
+                                               <td>    
+                                                       <textarea name="comment">{$comment}</textarea>
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+                       <td>
+                               <table summary="" width="100%">
+                                       <tr>
+                                               <td>{t}Manufacturer{/t}
+                                               </td>   
+                                               <td>    
+                                                       <select name="FK_glpi_enterprise">
+                                                               {html_options values=$FK_glpi_enterpriseKeys output=$FK_glpi_enterprises selected=$FK_glpi_enterprise}
+                                                       </select>
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+               </tr>
+       </table>
+
+{elseif $device_type=="power"}
+
+        <h2><img alt="" align="middle" src="images/power.png" class="center">&nbsp;{t}Add/Edit power supply{/t}</h2>
+        <p class="seperator">&nbsp;</p>
+        <br>
+       <table summary="" width="100%">
+               <tr>
+                       <td width="50%" style="vertical-align:top; border-right:1px solid #A0A0A0; padding-right:5px;">
+                               <table summary="" width="100%">
+                                       <tr>
+                                               <td>{t}Name{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input name="designation" value="{$designation}">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td style="vertical-align:top;">{t}Comment{/t}
+                                               </td>   
+                                               <td>    
+                                                       <textarea name="comment">{$comment}</textarea>
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+                       <td>
+                               <table summary="" width="100%">
+                                       <tr>
+                                               <td>{t}Manufacturer{/t}
+                                               </td>   
+                                               <td>    
+                                                       <select name="FK_glpi_enterprise">
+                                                               {html_options values=$FK_glpi_enterpriseKeys output=$FK_glpi_enterprises selected=$FK_glpi_enterprise}
+                                                       </select>
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>{t}Atx{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input type="radio" name="atx" value="Y" {if ($atx == "Y")||($atx=="")}checked {/if}>{t}Yes{/t}
+                                                       <input type="radio" name="atx" value="N" {if $atx == "N"}checked {/if}>{t}No{/t}
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>{t}Power{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input name="power" value="{$power}">
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+               </tr>
+       </table>
+{elseif $device_type=="gfxcard"}
+
+        <h2><img alt="" align="middle" src="images/gfx_hardware.png" class="center">&nbsp;{t}Add/Edit graphic card{/t}</h2>
+        <p class="seperator">&nbsp;</p>
+        <br>
+       <table summary="" width="100%">
+               <tr>
+                       <td width="50%" style="vertical-align:top; border-right:1px solid #A0A0A0; padding-right:5px;">
+                               <table summary="" width="100%">
+                                       <tr>
+                                               <td>{t}Name{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input name="designation" value="{$designation}">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td style="vertical-align:top;">{t}Comment{/t}
+                                               </td>   
+                                               <td>    
+                                                       <textarea name="comment">{$comment}</textarea>
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+                       <td>
+                               <table summary="" width="100%">
+                                       <tr>
+                                               <td>{t}Manufacturer{/t}
+                                               </td>   
+                                               <td>    
+                                                       <select name="FK_glpi_enterprise">
+                                                               {html_options values=$FK_glpi_enterpriseKeys output=$FK_glpi_enterprises selected=$FK_glpi_enterprise}
+                                                       </select>
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>{t}Interface{/t}
+                                               </td>   
+                                               <td>    
+                                                       <select name="interface">
+                                                               {html_options values=$GFXInterfaceKeys output=$GFXInterfaces selected=$interface}
+                                                       </select>
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>{t}Ram{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input name="ram" value="{$ram}">
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+               </tr>
+       </table>
+{elseif $device_type=="control"}
+
+        <h2><img alt="" align="middle" src="images/hardware.png" class="center">&nbsp;{t}Add/Edit controller{/t}</h2>
+        <p class="seperator">&nbsp;</p>
+        <br>
+       <table summary="" width="100%">
+               <tr>
+                       <td width="50%" style="vertical-align:top; border-right:1px solid #A0A0A0; padding-right:5px;">
+                               <table summary="" width="100%">
+                                       <tr>
+                                               <td>{t}Name{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input name="designation" value="{$designation}">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td style="vertical-align:top;">{t}Comment{/t}
+                                               </td>   
+                                               <td>    
+                                                       <textarea name="comment">{$comment}</textarea>
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+                       <td>
+                               <table summary="" width="100%">
+                                       <tr>
+                                               <td>{t}Manufacturer{/t}
+                                               </td>   
+                                               <td>    
+                                                       <select name="FK_glpi_enterprise">
+                                                               {html_options values=$FK_glpi_enterpriseKeys output=$FK_glpi_enterprises selected=$FK_glpi_enterprise}
+                                                       </select>
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>{t}Interface{/t}
+                                               </td>   
+                                               <td>    
+                                                       <select name="interface">
+                                                               {html_options values=$HDDInterfaceKeys output=$HDDInterfaces selected=$interface}
+                                                       </select>
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>{t}Size{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input type="radio" name="raid" value="Y" {if ($raid == "Y")||($raid=="")}checked {/if}>{t}Yes{/t}
+                                                       <input type="radio" name="raid" value="N" {if $raid == "N"}checked {/if}>{t}No{/t}
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+               </tr>
+       </table>
+
+{elseif $device_type=="drive"}
+
+        <h2><img alt="" align="middle" src="images/drives.png" class="center">&nbsp;{t}Add/Edit drive{/t}</h2>
+        <p class="seperator">&nbsp;</p>
+        <br>
+       <table summary="" width="100%">
+               <tr>
+                       <td width="50%" style="vertical-align:top; border-right:1px solid #A0A0A0; padding-right:5px;">
+                               <table summary="" width="100%">
+                                       <tr>
+                                               <td>{t}Name{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input name="designation" value="{$designation}">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td style="vertical-align:top;">{t}Comment{/t}
+                                               </td>   
+                                               <td>    
+                                                       <textarea name="comment">{$comment}</textarea>
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+                       <td>
+                               <table summary="" width="100%">
+                                       <tr>
+                                               <td>{t}Manufacturer{/t}
+                                               </td>   
+                                               <td>    
+                                                       <select name="FK_glpi_enterprise">
+                                                               {html_options values=$FK_glpi_enterpriseKeys output=$FK_glpi_enterprises selected=$FK_glpi_enterprise}
+                                                       </select>
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>{t}Speed{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input type="text" name="speed" value="{$speed}">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>{t}Interface{/t}
+                                               </td>   
+                                               <td>    
+                                                       <select name="interface">
+                                                               {html_options values=$HDDInterfaceKeys output=$HDDInterfaces selected=$interface}
+                                                       </select>
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>{t}Writeable{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input type="radio" name="is_writer" value="Y" {if ($is_writer == "Y")||($is_writer=="")}checked {/if}>{t}Yes{/t}
+                                                       <input type="radio" name="is_writer" value="N" {if $is_writer == "N"}checked {/if}>{t}No{/t}
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+               </tr>
+       </table>
+
+{elseif $device_type=="hdd"}
+        <h2><img alt="" align="middle" src="images/fai_partitionTable.png" class="center">&nbsp;{t}Add/Edit harddisk{/t}</h2>
+        <p class="seperator">&nbsp;</p>
+        <br>
+       <table summary="" width="100%">
+               <tr>
+                       <td width="50%" style="vertical-align:top; border-right:1px solid #A0A0A0; padding-right:5px;">
+                               <table summary="" width="100%">
+                                       <tr>
+                                               <td>{t}Name{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input name="designation" value="{$designation}">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td style="vertical-align:top;">{t}Comment{/t}
+                                               </td>   
+                                               <td>    
+                                                       <textarea name="comment">{$comment}</textarea>
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+                       <td>
+                               <table summary="" width="100%">
+                                       <tr>
+                                               <td>{t}Manufacturer{/t}
+                                               </td>   
+                                               <td>    
+                                                       <select name="FK_glpi_enterprise">
+                                                               {html_options values=$FK_glpi_enterpriseKeys output=$FK_glpi_enterprises selected=$FK_glpi_enterprise}
+                                                       </select>
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>{t}Rpm{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input type="text" name="rpm" value="{$rpm}">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>{t}Cache{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input type="text" name="cache" value="{$cache}">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>{t}Size{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input type="text" name="specif_default" value="{$specif_default}">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>{t}Type{/t}
+                                               </td>   
+                                               <td>    
+                                                       <select name="interface">
+                                                               {html_options values=$HDDInterfaceKeys output=$HDDInterfaces selected=$interface}
+                                                       </select>
+                                               </td>
+                                       </tr>
+                                       
+                               </table>
+                       </td>
+               </tr>
+       </table>
+
+{elseif $device_type=="ram"}
+
+        <h2><img alt="" align="middle" src="images/memory.png" class="center">&nbsp;{t}Add/Edit memory{/t}</h2>
+        <p class="seperator">&nbsp;</p>
+        <br>
+       <table summary="" width="100%">
+               <tr>
+                       <td width="50%" style="vertical-align:top; border-right:1px solid #A0A0A0; padding-right:5px;">
+                               <table summary="" width="100%">
+                                       <tr>
+                                               <td>{t}Name{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input name="designation" value="{$designation}">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td style="vertical-align:top;">{t}Comment{/t}
+                                               </td>   
+                                               <td>    
+                                                       <textarea name="comment">{$comment}</textarea>
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+                       <td>
+                               <table summary="" width="100%">
+                                       <tr>
+                                               <td>{t}Manufacturer{/t}
+                                               </td>   
+                                               <td>    
+                                                       <select name="FK_glpi_enterprise">
+                                                               {html_options values=$FK_glpi_enterpriseKeys output=$FK_glpi_enterprises selected=$FK_glpi_enterprise}
+                                                       </select>
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>{t}Frequenz{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input type="text" name="frequence" value="{$frequence}">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>{t}Size{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input type="text" name="specif_default" value="{$specif_default}">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>{t}Type{/t}
+                                               </td>   
+                                               <td>    
+                                                       <select name="type">
+                                                               {html_options values=$RAMtypeKeys output=$RAMtypes selected=$type}
+                                                       </select>
+                                               </td>
+                                       </tr>
+                                       
+                               </table>
+                       </td>
+               </tr>
+       </table>
+
+{elseif $device_type=="sndcard"}
+        <h2><img alt="" align="middle" src="images/snd_hardware.png" class="center">&nbsp;{t}Add/Edit sound card{/t}</h2>
+        <p class="seperator">&nbsp;</p>
+        <br>
+       <table summary="" width="100%">
+               <tr>
+                       <td width="50%" style="vertical-align:top; border-right:1px solid #A0A0A0; padding-right:5px;">
+                               <table summary="" width="100%">
+                                       <tr>
+                                               <td>{t}Name{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input name="designation" value="{$designation}">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td style="vertical-align:top;">{t}Comment{/t}
+                                               </td>   
+                                               <td>    
+                                                       <textarea name="comment">{$comment}</textarea>
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+                       <td>
+                               <table summary="" width="100%">
+                                       <tr>
+                                               <td>{t}Manufacturer{/t}
+                                               </td>   
+                                               <td>    
+                                                       <select name="FK_glpi_enterprise">
+                                                               {html_options values=$FK_glpi_enterpriseKeys output=$FK_glpi_enterprises selected=$FK_glpi_enterprise}
+                                                       </select>
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>{t}Type{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input type="text" name="type" value="{$type}">
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+               </tr>
+       </table>
+{elseif $device_type=="iface"}
+    <h2><img alt="" align="middle" src="images/net_hardware.png" class="center">&nbsp;{t}Add/Edit network interface{/t}</h2>
+    <p class="seperator">&nbsp;</p>
+    <br>
+
+    <table summary="" width="100%">
+        <tr>
+            <td width="50%" style="vertical-align:top; border-right:1px solid #A0A0A0; padding-right:5px;">
+                <table summary="" width="100%">
+                    <tr>
+                        <td>{t}Name{/t}
+                        </td>
+                        <td>
+                            <input name="designation" value="{$designation}">
+                        </td>
+                    </tr>
+                    <tr>
+                        <td style="vertical-align:top;">{t}Comment{/t}
+                        </td>
+                        <td>
+                            <textarea name="comment">{$comment}</textarea>
+                        </td>
+                    </tr>
+                </table>
+            </td>
+            <td>
+                <table summary="" width="100%">
+                    <tr>
+                        <td>{t}Manufacturer{/t}
+                        </td>
+                        <td>
+                            <select name="FK_glpi_enterprise">
+                                {html_options values=$FK_glpi_enterpriseKeys output=$FK_glpi_enterprises selected=$FK_glpi_enterprise}
+                            </select>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>{t}MAC address{/t}
+                        </td>
+                        <td>
+                            <input type="text" name="specif_default" value="{$specif_default}">
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>{t}Bandwidth{/t}
+                        </td>
+                        <td>
+                            <input type="text" name="bandwidth" value="{$bandwidth}">
+                        </td>
+                    </tr>
+                </table>
+            </td>
+        </tr>
+    </table>
+{elseif $device_type=="processor"}
+    <h2><img alt="" align="middle" src="images/processor.png" class="center">&nbsp;{t}Add/Edit processor{/t}</h2>
+    <p class="seperator">&nbsp;</p>
+    <br>
+    <table summary="" width="100%">
+        <tr>
+            <td width="50%" style="vertical-align:top; border-right:1px solid #A0A0A0; padding-right:5px;">
+                <table summary="" width="100%">
+                    <tr>
+                        <td>{t}Name{/t}
+                        </td>
+                        <td>
+                            <input name="designation" value="{$designation}">
+                        </td>
+                    </tr>
+                    <tr>
+                        <td style="vertical-align:top;">{t}Comment{/t}
+                        </td>
+                        <td>
+                            <textarea name="comment">{$comment}</textarea>
+                        </td>
+                    </tr>
+                </table>
+            </td>
+            <td>
+                <table summary="" width="100%">
+                    <tr>
+                        <td>{t}Manufacturer{/t}
+                        </td>
+                        <td>
+                            <select name="FK_glpi_enterprise">
+                                {html_options values=$FK_glpi_enterpriseKeys output=$FK_glpi_enterprises selected=$FK_glpi_enterprise}
+                            </select>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>{t}Frequence{/t}
+                        </td>
+                        <td>
+                            <input type="text" name="frequence" value="{$frequence}">
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>{t}Default frequence{/t}
+                        </td>
+                        <td>
+                            <input type="text" name="specif_default" value="{$specif_default}">
+                        </td>
+                    </tr>
+                </table>
+            </td>
+        </tr>
+    </table>
+
+{elseif $device_type=="moboard"}
+        <h2><img alt="" align="middle" src="images/mainboard.png" class="center">&nbsp;{t}Add/Edit motherboard{/t}</h2>
+        <p class="seperator">&nbsp;</p>
+        <br>
+       <table summary="" width="100%">
+               <tr>
+                       <td width="50%" style="vertical-align:top; border-right:1px solid #A0A0A0; padding-right:5px;">
+                               <table summary="" width="100%">
+                                       <tr>
+                                               <td>{t}Name{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input name="designation" value="{$designation}">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td style="vertical-align:top;">{t}Comment{/t}
+                                               </td>   
+                                               <td>    
+                                                       <textarea name="comment">{$comment}</textarea>
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+                       <td>
+                               <table summary="" width="100%">
+                                       <tr>
+                                               <td>{t}Manufacturer{/t}
+                                               </td>   
+                                               <td>    
+                                                       <select name="FK_glpi_enterprise">
+                                                               {html_options values=$FK_glpi_enterpriseKeys output=$FK_glpi_enterprises selected=$FK_glpi_enterprise}
+                                                       </select>
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>{t}Chipset{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input type="text" name="chipset" value="{$chipset}">
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+               </tr>
+       </table>
+{elseif $device_type=="case"}
+        <h2><img alt="" align="middle" src="images/server.png" class="center">&nbsp;{t}Add/Edit computer case{/t}</h2>
+        <p class="seperator">&nbsp;</p>
+        <br>
+       <table summary="" width="100%">
+               <tr>
+                       <td width="50%" style="vertical-align:top; border-right:1px solid #A0A0A0; padding-right:5px;">
+                               <table summary="" width="100%">
+                                       <tr>
+                                               <td>{t}Name{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input name="designation" value="{$designation}">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td style="vertical-align:top;">{t}Comment{/t}
+                                               </td>   
+                                               <td>    
+                                                       <textarea name="comment">{$comment}</textarea>
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+                       <td>
+                               <table summary="" width="100%">
+                                       <tr>
+                                               <td>{t}Manufacturer{/t}
+                                               </td>   
+                                               <td>    
+                                                       <select name="FK_glpi_enterprise">
+                                                               {html_options values=$FK_glpi_enterpriseKeys output=$FK_glpi_enterprises selected=$FK_glpi_enterprise}
+                                                       </select>
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td style="vertical-align:top;">{t}format{/t}
+                                               </td>   
+                                               <td>    
+                                                       <select name="format">
+                                                               {html_options values=$formatKeys output=$formats selected=$format}
+                                                       </select>
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+               </tr>
+       </table>
+{/if}
+
+
+<p class="seperator">&nbsp;</p>
+<div align="right">
+       <p>
+               <input type="submit" value="{t}Save{/t}" name="SaveDeviceChanges">
+               <input type="submit" value="{t}Cancel{/t}" name="AbortDeviceChanges">
+       </p> 
+</div>
diff --git a/plugins/admin/systems/services/glpi/glpi_edit_cartridge_type.tpl b/plugins/admin/systems/services/glpi/glpi_edit_cartridge_type.tpl
new file mode 100644 (file)
index 0000000..cbc91d9
--- /dev/null
@@ -0,0 +1,21 @@
+<br>
+     <select name="select_type_cartridge" size="12" style="width:100%">
+                            {html_options values=$PrinterTypeKeys output=$PrinterTypes}
+     </select><br>
+        <input name="cartridge_type_string">
+        <input type="submit" name="add_cartridge_type"                 value="{t}Add{/t}" >
+        <input type="submit" name="rename_cartridge_type"      value="{t}Rename{/t}" >
+        <input type="submit" name="del_cartridge_type"                 value="{t}Delete{/t}" >
+
+<p class="seperator">&nbsp;</p>
+<div align="right">
+<p>
+<input name="close_edit_type_cartridge" value="{t}Close{/t}" type="submit">
+</p>
+</div>
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('cartridge_type_string');
+  -->
+</script>
+
diff --git a/plugins/admin/systems/services/glpi/glpi_edit_os.tpl b/plugins/admin/systems/services/glpi/glpi_edit_os.tpl
new file mode 100644 (file)
index 0000000..8e37264
--- /dev/null
@@ -0,0 +1,39 @@
+<h2>{t}Manage OS-types{/t}</h2>
+{if $Method == "edit"}
+
+       <select name="select_os" size="12" style="width:100%">
+                               {html_options values=$OSKeys output=$OSs}
+       </select><br>
+       <input name="is_string">
+       <input type="submit" name="add_os"              value="{t}Add{/t}" >
+       <input type="submit" name="rename_os"   value="{t}Rename{/t}" >
+       <input type="submit" name="del_os"              value="{t}Delete{/t}" >
+
+<p class="seperator">&nbsp;</p>
+<div align="right">
+<p>
+<input name="close_edit_os" value="{t}Close{/t}" type="submit">
+</p>
+</div>
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+               focus_field('is_string');
+  -->
+</script>
+{else}
+{t}Please enter a new name{/t}&nbsp;<input name="string" value="{$string}">
+<p class="seperator">&nbsp;</p>
+    <p>
+        <div align="right" style="text-align: right;">
+            <input type="submit" name="Rename_os_OK"       value="{t}Rename{/t}" >
+            <input type="submit" name="Rename_Cancel"   value="{t}Cancel{/t}" >
+        </div>
+    </p>
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('string');
+  -->
+</script>
+{/if}
+
+
diff --git a/plugins/admin/systems/services/glpi/glpi_edit_printer_type.tpl b/plugins/admin/systems/services/glpi/glpi_edit_printer_type.tpl
new file mode 100644 (file)
index 0000000..a63e923
--- /dev/null
@@ -0,0 +1,40 @@
+<br>
+{if $Method == "edit"}
+        <select name="select_type" size="12" style="width:100%">
+                                                       {html_options values=$PrinterTypeKeys output=$PrinterTypes}
+        </select><br>
+        <input name="type_string">
+        <input type="submit" name="add_type"           value="{t}Add{/t}" >
+        <input type="submit" name="rename_type"        value="{t}Rename{/t}" >
+        <input type="submit" name="del_type"           value="{t}Delete{/t}" >
+
+       <p class="seperator">&nbsp;</p>
+       <div align="right">
+               <p>
+                       <input name="close_edit_type" value="{t}Close{/t}" type="submit">
+               </p>
+       </div>
+       <script language="JavaScript" type="text/javascript">
+         <!-- // First input field on page
+               focus_field('type_string');
+         -->
+       </script>
+
+{else}
+
+       {t}Please enter a new name{/t}&nbsp;<input name="string" value="{$string}">
+       <p class="seperator">&nbsp;</p>
+    <p>
+        <div align="right" style="text-align: right;">
+            <input type="submit" name="Rename_PType_OK"       value="{t}Rename{/t}" >
+            <input type="submit" name="Rename_Cancel"   value="{t}Cancel{/t}" >
+        </div>
+    </p>
+       <script language="JavaScript" type="text/javascript">
+         <!-- // First input field on page
+               focus_field('string');
+         -->
+       </script>
+
+{/if}
+
diff --git a/plugins/admin/systems/services/glpi/glpi_edit_type.tpl b/plugins/admin/systems/services/glpi/glpi_edit_type.tpl
new file mode 100644 (file)
index 0000000..14a4f54
--- /dev/null
@@ -0,0 +1,37 @@
+<h2>{t}Manage System-types{/t}</h2>
+{if $Method == "edit"}
+
+     <select name="select_type" size="12" style="width:100%">
+                            {html_options values=$SystemTypeKeys output=$SystemTypes}
+     </select><br>
+        <input name="type_string">
+        <input type="submit" name="add_type"           value="{t}Add{/t}" >
+        <input type="submit" name="rename_type"        value="{t}Rename{/t}" >
+        <input type="submit" name="del_type"           value="{t}Delete{/t}" >
+
+       <p class="seperator">&nbsp;</p>
+       <div align="right">
+       <p>
+       <input name="close_edit_type" value="{t}Close{/t}" type="submit">
+       </p>
+       </div>
+       <script language="JavaScript" type="text/javascript">
+         <!-- // First input field on page
+               focus_field('type_string');
+         -->
+       </script>
+{else}
+{t}Please enter a new name{/t}&nbsp;<input name="string" value="{$string}">
+<p class="seperator">&nbsp;</p>
+       <p>
+               <div align="right" style="text-align: right;">
+                       <input type="submit" name="Rename_type_OK"              value="{t}Rename{/t}" >
+                       <input type="submit" name="Rename_Cancel"       value="{t}Cancel{/t}" >
+               </div>
+       </p>
+       <script language="JavaScript" type="text/javascript">
+       <!-- // First input field on page
+               focus_field('string');
+       -->
+       </script>
+{/if}
diff --git a/plugins/admin/systems/services/glpi/goGlpiServer.tpl b/plugins/admin/systems/services/glpi/goGlpiServer.tpl
new file mode 100644 (file)
index 0000000..36a2f24
--- /dev/null
@@ -0,0 +1,36 @@
+<h2><img class="center" alt="" align="middle" src="images/rightarrow.png" /> {t}GLPI database information{/t}</h2>
+  <table summary="">
+    <tr>
+     <td>{t}Logging DB user{/t}{$must}</td>
+     <td>
+{render acl=$goGlpiAdminACL}
+      <input name="goGlpiAdmin" id="goGlpiAdmin" size=30 maxlength=60 value="{$goGlpiAdmin}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td>{t}Password{/t}</td>
+     <td>
+{render acl=$goGlpiPasswordACL}
+      <input type="password" name="goGlpiPassword" id="goGlpiPassword" size=30 maxlength=60 value="{$goGlpiPassword}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td>{t}Database{/t}{$must}</td>
+     <td>
+{render acl=$goGlpiDatabaseACL}
+      <input name="goGlpiDatabase" id="goGlpiDatabase" size=30 maxlength=60 value="{$goGlpiDatabase}">
+{/render}
+     </td>
+    </tr>
+   </table>
+
+
+<p class='seperator'>&nbsp;</p>
+<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
+    <input type='submit' name='SaveService' value='{t}Save{/t}'>
+    &nbsp;
+    <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
+</div>
+<input type="hidden" name="goGlpiServer_posted" value="1">
diff --git a/plugins/admin/systems/services/glpi/remove_glpi.tpl b/plugins/admin/systems/services/glpi/remove_glpi.tpl
new file mode 100644 (file)
index 0000000..4106caf
--- /dev/null
@@ -0,0 +1,17 @@
+<div style="font-size:18px;">
+<img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
+</div>
+<p>
+ {$warning}
+ {t}Please double check if your really want to do this since there is no way for GOsa to get your data back.{/t}
+</p>
+
+<p>
+ {t}Best thing to do before performing this action would be to save the current contents of your MySql database in a file. So - if you've done so - press 'Delete' to continue or 'Cancel' to abort.{/t}
+</p>
+
+<p class="plugbottom">
+  <input type=submit name="delete_glpi_confirm" value="{t}Delete{/t}">
+  &nbsp;
+  <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
+</p>
diff --git a/plugins/admin/systems/services/gofax/class_goFaxServer.inc b/plugins/admin/systems/services/gofax/class_goFaxServer.inc
new file mode 100644 (file)
index 0000000..1e5e049
--- /dev/null
@@ -0,0 +1,103 @@
+<?php
+
+class goFaxServer extends goService {
+       
+  var $cli_summary      = "This pluign is used within the ServerService Pluign \nand indicates that this server supports fax informations.";
+  var $cli_description  = "Some longer text\nfor help";
+  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* This plugin only writes its objectClass */
+  var $objectclasses    = array("goFaxServer");
+  var $attributes       = array("goFaxAdmin", "goFaxPassword");
+  var $StatusFlag       = "goFaxServerStatus";
+  /* This class can't be assigned twice so it conflicts with itsself */
+  var $conflicts        = array("goFaxServer");
+
+  var $DisplayName      = "";
+  var $dn               = NULL;
+  var $acl;
+
+  var $goFaxAdmin         = "";
+  var $goFaxPassword      = "";
+  var $goFaxServerStatus  = "";
+  var $cn                 = "";
+  var $view_logged  =FALSE;
+  function goFaxServer(&$config,$dn)
+  {
+    goService::goService($config,$dn);
+    $this->DisplayName = _("FAX database");
+  }
+
+
+  function execute()
+  { 
+    $smarty = get_smarty(); 
+
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","server/".get_class($this),$this->dn);
+    }
+
+    /* Assign acls */
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation ){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr,$this->$attr);
+    }
+    return($smarty->fetch(get_template_path("goFaxServer.tpl",TRUE,dirname(__FILE__))));
+  }
+
+
+  function getListEntry()
+  {
+    $fields               = goService::getListEntry();
+    $fields['Message']    = _("FAX database configuration");
+    $fields['AllowEdit']  = true;
+    return($fields);
+  }
+
+  function check()
+  { 
+    $message = plugin::check();
+    if (empty($this->goFaxAdmin)){
+      $message[]= _("The attribute user is empty or contains invalid characters.");
+    }
+    if (empty($this->goFaxPassword)){
+      $message[]= _("The attribute password is empty or contains invalid characters.");
+    }
+    return($message);
+  }
+  
+
+  function save_object()
+  {
+    if(isset($_POST['goFaxServerPosted'])){
+      plugin::save_object();
+    }
+  } 
+
+  /* Return plugin informations for acl handling */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Fax database"),
+          "plDescription" => _("Fax database")." ("._("Services").")",
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 99,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("server"),
+
+          "plProvidedAcls"=> array(
+             "goFaxAdmin"     => _("Login name"),
+             "goFaxPassword"  => _("Password"))
+          ));
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/services/gofax/goFaxServer.tpl b/plugins/admin/systems/services/gofax/goFaxServer.tpl
new file mode 100644 (file)
index 0000000..27560b3
--- /dev/null
@@ -0,0 +1,27 @@
+<h2><img class="center" alt="" align="middle" src="images/rightarrow.png" /> {t}FAX database information{/t}</h2>
+ <table summary="">
+    <tr>
+     <td>{t}FAX DB user{/t}{$must}</td>
+     <td>
+{render acl=$goFaxAdminACL}
+       <input name="goFaxAdmin" size=30 maxlength=60 id="goFaxAdmin" value="{$goFaxAdmin}" >
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td>{t}Password{/t}{$must}</td>
+     <td>
+{render acl=$goFaxPasswordACL}
+       <input type=password name="goFaxPassword" id="goFaxPassword" size=30 maxlength=60 value="{$goFaxPassword}" >
+{/render}
+     </td>
+    </tr>
+   </table>
+
+<p class='seperator'>&nbsp;</p>
+<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
+    <input type='submit' name='SaveService' value='{t}Save{/t}'>
+    &nbsp;
+    <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
+</div>
+<input type="hidden" name="goFaxServerPosted" value="1">
diff --git a/plugins/admin/systems/services/gofon/class_goFonServer.inc b/plugins/admin/systems/services/gofon/class_goFonServer.inc
new file mode 100644 (file)
index 0000000..2e69a84
--- /dev/null
@@ -0,0 +1,182 @@
+<?php
+
+class goFonServer extends goService{
+       
+  var $cli_summary      = "This pluign is used within the ServerService Pluign \nand indicates that this server supports asterisk management.";
+  var $cli_description  = "Some longer text\nfor help";
+  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* This plugin only writes its objectClass */
+  var $objectclasses    = array("goFonServer");
+  var $attributes       = array("goFonAdmin", "goFonPassword","goFonAreaCode", "goFonCountryCode");
+  var $StatusFlag       = "goFonServerStatus";
+  /* This class can't be assigned twice so it conflicts with itsself */
+  var $conflicts        = array("goFonServer");
+
+  var $DisplayName      = "";
+  var $dn               = NULL;
+  var $cn               ="";
+  var $acl;
+
+  var $goFonServerStatus  = "";
+  var $goFonPassword      = "";
+  var $goFonAdmin         = "";
+  var $goFonAreaCode      = "";
+  var $goFonCountryCode   = "";
+  var $view_logged  =FALSE;
+
+  var $orig_dn            = "";   
+  function goFonServer(&$config,$dn)
+  {
+    goService::goService($config,$dn);
+    $this->DisplayName = _("VoIP service");
+
+    $this->orig_dn = $dn;
+  }
+
+
+  function execute()
+  { 
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","server/".get_class($this),$this->dn);
+    }
+
+    $smarty = get_smarty(); 
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr,$this->$attr);
+    }
+
+    /* Assign acls */
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+    return($smarty->fetch(get_template_path("goFonServer.tpl",TRUE,dirname(__FILE__))));
+  }
+
+
+  function getListEntry()
+  {
+    $fields = goService::getListEntry();
+    $fields['Message']    = _("VoIP service - Asterisk management");
+    $fields['AllowEdit']  = true;
+    return($fields);
+  }
+
+  function check()
+  { 
+    $message = plugin::check();
+    if (empty($this->goFonAdmin)){
+      $message[]= _("The attribute DB user is empty or contains invalid characters.");
+    }
+    if (empty($this->goFonPassword)){
+      $message[]= _("The attribute password is empty or contains invalid characters.");
+    }
+    if (empty($this->goFonAreaCode)){
+      $message[]= _("The attribute local dial prefix is empty or contains invalid characters.");
+    }
+    if (empty($this->goFonCountryCode)){
+      $message[]= _("The attribute country dial prefix is empty or contains invalid characters.");
+    }
+    return($message);
+  }
+  
+
+  function save_object()
+  {
+    if(isset($_POST['goFonServerPosted'])){
+      plugin::save_object();
+    }
+  } 
+
+
+  function allow_remove()
+  {
+    /* Check if we are able to remove the asterisk database. If the database is still in use skip */
+    if($this->is_account){
+      $ldap = $this->config->get_ldap_link();
+      $ldap->cd($this->config->current['BASE']);
+      $ldap->search("(&(goFonHomeServer=".$this->dn.")(|(uid=*)(cn=*)))",array("dn","uid","cn","goFonHomeServer"));
+      if($ldap->count()){
+
+        /* Number of entries shown in warning */
+        $i    = 3;
+        $str  = "";
+        while(($attrs = $ldap->fetch()) && $i >= 0){
+          $i --;
+          if(isset($attrs['uid'][0])){
+            $str .= $attrs['uid'][0]." ";
+          }else{
+            $str .= $attrs['cn'][0]." ";
+          }
+        }
+
+        /* Some entries found */
+        if($i != 3){
+          return(sprintf(_("You can't remove the asterisk database extension, it is still in use by these objects '%s'."),trim($str)));
+        }
+      }
+    }
+  }
+
+  
+  function save()
+  {
+    goService::save();
+    /* Update goFonAccounts if server was is renamed.
+       Set attribute goFonHomeServer to current dn
+     */
+    if(in_array("goFonServer",$this->objectclasses)){
+      if($this->orig_dn != "new" && $this->orig_dn != $this->dn){
+        $ldap = $this->config->get_ldap_link();
+        $ldap->cd($this->config->current['BASE']);
+        $ldap->search("(&(goFonHomeServer=".$this->orig_dn.")(|(objectClass=goFonAccount)(objectClass=goFonConference)))",array("goFonHomeServer"));
+        $dns = array();
+        while($attrs = $ldap->fetch()){
+          $dns[] = $attrs['dn'];
+        }
+        foreach($dns as $dn){
+          $ldap->cd($dn);
+          $ldap->modify(array("goFonHomeServer" => $this->dn));
+          show_ldap_error($ldap->get_error(),sprintf(_("Updating gofon home server failed for '%s'."),$dn));
+        }
+      }
+
+      /* Updated config list of gofon servers */
+      if($this->orig_dn == "new" || $this->orig_dn != $this->dn){
+        $_SESSION['config']->load_servers();
+      }
+    }
+  }
+
+  /* Return plugin informations for acl handling */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("VoIP service"),
+          "plDescription" => _("VoIP - asterisk management")." ("._("Services").")",
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 92,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("server"),
+
+          "plProvidedAcls"=> array(
+            "start"         => _("Start"),
+            "stop"          => _("Stop"),
+            "restart"       => _("Restart"),
+
+              "goFonAdmin"      => _("Admin"), 
+              "goFonPassword"   => _("Password"),
+              "goFonAreaCode"   => _("Area code"), 
+              "goFonCountryCode"=> _("Country code"))
+          ));
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/services/gofon/goFonServer.tpl b/plugins/admin/systems/services/gofon/goFonServer.tpl
new file mode 100644 (file)
index 0000000..14a1603
--- /dev/null
@@ -0,0 +1,43 @@
+<h2><img class="center" alt="" align="middle" src="images/rightarrow.png" /> {t}VoIP database information{/t}</h2>
+  <table summary="">
+    <tr>
+     <td>{t}Asterisk DB user{/t}{$must}</td>
+     <td>
+{render acl=$goFonAdminACL}
+      <input name="goFonAdmin" size=30 maxlength=60 id="goFonAdmin" value="{$goFonAdmin}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td>{t}Password{/t}{$must}</td>
+     <td>
+{render acl=$goFonPasswordACL}
+      <input type=password name="goFonPassword" id="goFonPassword" size=30 maxlength=60 value="{$goFonPassword}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td>{t}Country dial prefix{/t}{$must}</td>
+     <td>
+{render acl=$goFonCountryCodeACL}
+      <input name="goFonCountryCode" size=10 maxlength=30 id="goFonCountryCode" value="{$goFonCountryCode}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td>{t}Local dial prefix{/t}{$must}</td>
+     <td>
+{render acl=$goFonAreaCodeACL}
+      <input name="goFonAreaCode" size=10 maxlength=30 id="goFonAreaCode" value="{$goFonAreaCode}">
+{/render}
+     </td>
+    </tr>
+   </table>
+
+<p class='seperator'>&nbsp;</p>
+<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
+    <input type='submit' name='SaveService' value='{t}Save{/t}'>
+    &nbsp;
+    <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
+</div>
+<input type="hidden" name="goFonServerPosted" value="1">
diff --git a/plugins/admin/systems/services/imap/class_goImapServer.inc b/plugins/admin/systems/services/imap/class_goImapServer.inc
new file mode 100644 (file)
index 0000000..e5681b9
--- /dev/null
@@ -0,0 +1,187 @@
+<?php
+
+class goImapServer extends goService {
+       
+  var $cli_summary      = "This pluign is used within the ServerService Pluign \nand indicates that this server supports mailqueue listings and so on.";
+  var $cli_description  = "Some longer text\nfor help";
+  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* This plugin only writes its objectClass */
+  var $objectclasses    = array("goImapServer");
+  
+  /* This class can't be assigned twice so it conflicts with itsself */
+
+  var $DisplayName      = "";
+  var $dn               = NULL;
+  var $StatusFlag       = "goImapServerStatus";
+  var $attributes       = array("goImapName","goImapConnect","goImapAdmin","goImapPassword",
+                                "goImapSieveServer","goImapSievePort",
+                                "cyrusImap","cyrusImapSSL","cyrusPop3","cyrusPop3SSL");
+
+  var $cn                   = "";
+
+  var $goImapName           = "";
+  var $goImapConnect        = "";
+  var $goImapAdmin          = "";
+  var $goImapPassword       = "";
+  
+  var $goImapSieveServer    = "";
+  var $goImapSievePort      = "";
+  
+  var $goImapServerStatus   = "";
+  
+  var $cyrusImap            = false;
+  var $cyrusImapSSL         = false;
+  var $cyrusPop3            = false;
+  var $cyrusPop3SSL         = false;
+  var $is_account           = false;
+  var $view_logged  =FALSE;
+
+  var $acl; 
+
+  var $Actions              = array();  
+  var $conflicts            = array("goImapServer","kolab");
+  function goImapServer(&$config,$dn)
+  {
+    goService::goService($config,$dn);
+  
+    $this->DisplayName = _("IMAP/POP3 service");
+
+    $this->Actions = array( SERVICE_STOPPED=>SERVICE_STOPPED,
+                            SERVICE_STARTED => SERVICE_STARTED,
+                            SERVICE_RESTARTED=>SERVICE_RESTARTED,
+                            "repair_database"=>_("Repair database"));
+    
+  }
+
+  function execute()
+  { 
+    $smarty = get_smarty();
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","server/".get_class($this),$this->dn);
+    }
+    /* set new status */
+    if(isset($_POST['ExecAction'])){
+      if(isset($this->Actions[$_POST['action']])){
+
+        $tmp = $this->plInfo();
+        foreach($tmp['plProvidedAcls'] as $name => $translation) {
+          if(preg_match("/^".$_POST['action']."$/i",$name)){
+            if($this->acl_is_writeable($name)){
+              $this->setStatus($_POST['action']);
+            }
+          }
+        }
+
+      }
+    }
+
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr,$this->$attr);  
+    }
+
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+    $smarty->assign("Actions",$this->Actions);
+    $smarty->assign("is_new",$this->dn);
+    $smarty->assign("is_acc",$this->initially_was_account);
+    return($smarty->fetch(get_template_path("goImapServer.tpl",TRUE,dirname(__FILE__))));
+  }
+
+  function getListEntry()
+  {
+    $fields               = goService::getListEntry();
+    $fields['Message']    = _("IMAP/POP3 (Cyrus) service");
+    $fields['AllowRemove']= true;
+    $fields['AllowEdit']  = true;
+    return($fields);
+  }
+
+  function check()
+  { 
+    $message = plugin::check();
+    if(empty($this->goImapName)){
+      $message[] =_("Please specify a server identifier.");
+    }  
+    if(empty($this->goImapConnect)){
+      $message[] =_("Please specify a connect url.");
+    }  
+    if(empty($this->goImapAdmin)){
+      $message[] =_("Please specify an admin user.");
+    }  
+    if(empty($this->goImapPassword)){
+      $message[] =_("Please specify a password for the admin user.");
+    } 
+
+    /* Check connect string */
+    if (!preg_match('/^\{[^:]+:[0-9]+.*\}$/', $this->goImapConnect)){
+      $message[]= sprintf(_("The imap connect string needs to be in the form '%s'."),
+          '{server-name:port/options}');
+    }
+    if (!preg_match('/^[0-9]+$/', $this->goImapSievePort)){
+      $message[]= _("The sieve port needs to be numeric.");
+    }
+    return ($message);
+  }
+
+
+  function save_object()
+  {
+    if(isset($_POST['goImapServerPosted'])){
+      plugin::save_object(); 
+
+      foreach(array("cyrusImap","cyrusImapSSL","cyrusPop3","cyrusPop3SSL") as $checkbox) { 
+
+        if($this->acl_is_writeable($checkbox)){
+          if(!isset($_POST[$checkbox])){
+            $this->$checkbox = false;
+          }else{
+            $this->$checkbox = true;
+          }
+        }
+      }
+    }
+  }
+
+
+  /* Return plugin informations for acl handling */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("IMAP/POP3"),
+          "plDescription" => _("IMAP/POP3")." ("._("Services").")",
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 94,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("server"),
+
+          "plProvidedAcls"=> array(
+
+            "start"           => _("Start"),
+            "stop"            => _("Stop"),
+            "restart"         => _("Restart"),
+            "repair_database" => _("Repair database"),
+
+            "goImapName"        =>_("Server identifier"),
+            "goImapConnect"     =>_("Connect URL"),
+            "goImapAdmin"       =>_("Admin user"),
+            "goImapPassword"    =>_("Admin password"),
+            "goImapSievePort"   =>_("Sieve port"),
+            "cyrusImap"         =>_("Start IMAP service"),
+            "cyrusImapSSL"      =>_("Start IMAP SSL service"),
+            "cyrusPop3"         =>_("Start POP3 service"),
+            "cyrusPop3SSL"      =>_("Start POP3 SSL service"))
+          ));
+  }
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/services/imap/goImapServer.tpl b/plugins/admin/systems/services/imap/goImapServer.tpl
new file mode 100644 (file)
index 0000000..17c4009
--- /dev/null
@@ -0,0 +1,120 @@
+<h2><img class="center" alt="" align="middle" src="images/rightarrow.png" /> {t}Generic{/t}</h2>
+<table width="100%">
+       <tr>
+               <td style='width:50%;'>
+                       <table summary="">
+                               <tr>
+                                       <td>{t}Server identifier{/t}{$must}
+                                       </td>
+                                       <td>
+{render acl=$goImapNameACL}
+                                               <input name="goImapName" id="goImapName" size=40 maxlength=60 value="{$goImapName}" >
+{/render}
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>{t}Connect URL{/t}{$must}
+                                       </td>
+                                       <td>
+{render acl=$goImapConnectACL}
+                                               <input name="goImapConnect" id="goImapConnect" size=40 maxlength=60 value="{$goImapConnect}" >
+{/render}
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>{t}Admin user{/t}{$must}
+                                       </td>
+                                       <td>
+{render acl=$goImapAdminACL}
+                                               <input name="goImapAdmin" id="goImapAdmin" size=30 maxlength=60 value="{$goImapAdmin}" >
+{/render}
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>{t}Password{/t}{$must}
+                                       </td>
+                                       <td>
+{render acl=$goImapPasswordACL}
+                                       <input type=password name="goImapPassword" id="goImapPassword" size=30 maxlength=60 value="{$goImapPassword}" >
+{/render}
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>{t}Sieve port{/t}{$must}
+                                       </td>
+                                       <td>
+{render acl=$goImapSievePortACL}
+                                               <input name="goImapSievePort" id="goImapSievePort" size=10 maxlength=30 value="{$goImapSievePort}">
+{/render}
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+               <td style="border-left:1px solid #A0A0A0;vertical-align:top;">
+                       <table>
+                               <tr>
+                                       <td>
+{render acl=$cyrusImapACL}
+                                               <input type='checkbox' name='cyrusImap' value=1 {if $cyrusImap} checked {/if} > 
+{/render}
+                                       </td>
+                                       <td>{t}Start IMAP service{/t}
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>
+{render acl=$cyrusImapSSLACL}
+                                               <input type='checkbox' name='cyrusImapSSL' value=1 {if $cyrusImapSSL} checked {/if}> 
+{/render}
+                                       </td>
+                                       <td>{t}Start IMAP SSL service{/t}
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>
+{render acl=$cyrusPop3ACL}
+                                               <input type='checkbox' name='cyrusPop3' value=1 {if $cyrusPop3} checked {/if} > 
+{/render}
+                                       </td>
+                                       <td>{t}Start POP3 service{/t}
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>
+{render acl=$cyrusPop3SSLACL}
+                                               <input type='checkbox' name='cyrusPop3SSL' value=1 {if $cyrusPop3SSL} checked {/if} > 
+{/render}
+                                       </td>
+                                       <td>{t}Start POP3 SSL service{/t}
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+       </tr>
+</table>
+<p class='seperator'>&nbsp;</p>
+<br>
+<h2><img class="center" alt="" src="images/rocket.png" align="middle"> Action</h2>
+{if $is_new == "new"}
+    {t}The server must be saved before you can use the status flag.{/t}
+{elseif !$is_acc}
+    {t}The service must be saved before you can use the status flag.{/t}
+{/if}
+<br>
+<select name="action" title='{t}Set new status{/t}' 
+       {if $is_new =="new" || !$is_acc} disabled {/if}
+>
+       <option value="none">&nbsp;</option>
+    {html_options options=$Actions}
+</select>
+<input type='submit' name='ExecAction' title='{t}Set status{/t}' value='{t}Execute{/t}' 
+       {if $is_new == "new" | !$is_acc} disabled {/if}
+>
+
+<p class="seperator">&nbsp;</p>
+<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
+    <input type='submit' name='SaveService' value='{t}Save{/t}'>
+    &nbsp;
+    <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
+</div>
+<input type="hidden" name="goImapServerPosted" value="1">
diff --git a/plugins/admin/systems/services/kerberos/class_goKrbServer.inc b/plugins/admin/systems/services/kerberos/class_goKrbServer.inc
new file mode 100644 (file)
index 0000000..3eef127
--- /dev/null
@@ -0,0 +1,107 @@
+<?php
+
+class goKrbServer extends goService{
+       
+  var $cli_summary      = "This pluign is used within the ServerService Pluign \nand indicates that this server supports NTP service.";
+  var $cli_description  = "Some longer text\nfor help";
+  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* This plugin only writes its objectClass */
+  var $objectclasses    = array("goKrbServer");
+  var $attributes       = array("goKrbRealm", "goKrbAdmin","goKrbPassword");
+  var $StatusFlag       = "goKrbServerStatus";
+  /* This class can't be assigned twice so it conflicts with itsself */
+  var $conflicts        = array("goKrbServer");
+
+  var $DisplayName      = "";
+  var $dn               = NULL;
+  var $goKrbServerStatus= "";
+  var $cn               ="";
+  var $goKrbRealm     = "";
+  var $goKrbAdmin     = "";
+  var $goKrbPassword  ="";  
+  var $view_logged  =FALSE;
+  function goKrbServer(&$config,$dn)
+  {
+    goService::goService($config,$dn);
+    $this->DisplayName = _("Kerberos service");
+  }
+
+
+  function execute()
+  { 
+    $smarty = get_smarty(); 
+
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","server/".get_class($this),$this->dn);
+    }
+
+    $tmp = $this->plinfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr,$this->$attr);
+    }
+    return($smarty->fetch(get_template_path("goKrbServer.tpl",TRUE,dirname(__FILE__))));
+  }
+
+
+  function getListEntry()
+  {
+    $fields               = goService::getListEntry();
+    $fields['Message']    = _("Kerberos service (kadmin access informations)");
+    $fields['AllowEdit']  = true;
+    return($fields);
+  }
+
+  function check()
+  { 
+    $message = plugin::check();
+    /* goKrbPassword is a must field, if goKrbServer is used as objectClass */
+    if (empty($this->goKrbPassword)){
+      $message[]= sprintf(_("The specified kerberos password is empty."), $attr);
+    }
+    if (empty($this->goKrbAdmin)){
+      $message[]= sprintf(_("The specified kerberos admin is empty."), $attr);
+    }
+    if (empty($this->goKrbRealm)){
+      $message[]= sprintf(_("The specified kerberos realm is empty."), $attr);
+    }
+
+    return($message);
+  }
+  
+
+  function save_object()
+  {
+    if(isset($_POST['goKrbServerPosted'])){
+      plugin::save_object();
+    }
+  } 
+
+    /* Return plugin informations for acl handling */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Kerberos"),
+          "plDescription" => _("Kerberos access information")." ("._("Services").")",
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 95,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("server"),
+
+          "plProvidedAcls"=> array(
+            "goKrbRealm"    => _("Realm"), 
+            "goKrbAdmin"    => _("Admin"),
+            "goKrbPassword" => _("Password"))
+          ));
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/services/kerberos/goKrbServer.tpl b/plugins/admin/systems/services/kerberos/goKrbServer.tpl
new file mode 100644 (file)
index 0000000..a0234eb
--- /dev/null
@@ -0,0 +1,34 @@
+<h2><img class="center" alt="" align="middle" src="images/rightarrow.png" /> {t}Kerberos kadmin access{/t}</h2>
+  <table summary="">
+    <tr>
+     <td>{t}Kerberos Realm{/t}{$must}</td>
+     <td>
+{render acl=$goKrbRealmACL}
+      <input name="goKrbRealm" id="goKrbRealm" size=30 maxlength=60  value="{$goKrbRealm}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td>{t}Admin user{/t}{$must}</td>
+     <td>
+{render acl=$goKrbAdminACL}
+      <input name="goKrbAdmin" id="goKrbAdmin" size=30 maxlength=60 value="{$goKrbAdmin}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td>{t}Password{/t}{$must}</td>
+     <td>
+{render acl=$goKrbPasswordACL}
+      <input type=password name="goKrbPassword" id="goKrbPassword" size=30 maxlength=60 value="{$goKrbPassword}">
+{/render}
+     </td>
+    </tr>
+   </table>
+<p class='seperator'>&nbsp;</p>
+<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
+    <input type='submit' name='SaveService' value='{t}Save{/t}'>
+    &nbsp;
+    <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
+</div>
+<input type="hidden" name="goKrbServerPosted" value="1">
diff --git a/plugins/admin/systems/services/kiosk/class_goKioskService.inc b/plugins/admin/systems/services/kiosk/class_goKioskService.inc
new file mode 100644 (file)
index 0000000..287ed9e
--- /dev/null
@@ -0,0 +1,245 @@
+<?php
+
+class goKioskService extends goService{
+       
+  /* This plugin only writes its objectClass */
+  var $objectclasses    = array("goEnvironmentServer");
+  var $attributes       = array("gotoKioskProfile","cn");
+  var $StatusFlag       = "";
+  /* This class can't be assigned twice so it conflicts with itsself */
+  var $conflicts        = array("goKioskService");
+
+  var $baseDir          = "../kiosk";
+  var $filesToAttach    = array();
+  var $cn               = "unknown";  
+  var $gotoKioskProfiles= array();
+  var $gotoKioskProfile = array();
+
+  var $server_path      = "http://%cn/kiosk";
+  function goKioskService(&$config,$dn)
+  {
+    goService::goService($config,$dn);
+
+    $this->DisplayName = _("Kiosk profile service");
+    $this->baseDir = $this->config->search('environment', 'kioskpath',array('menu','tabs'));
+    $this->server_path = preg_replace("/%cn/", $this->cn, $this->server_path);
+
+    /* Load list of profiles and check if they still exists */
+    if ($this->baseDir == ""){
+      print_red(_("There is no KIOSKPATH defined in your gosa.conf. Can't manage kiosk profiles!"));
+    }else{
+      $this->gotoKioskProfiles = array();
+      if(isset($this->attrs['gotoKioskProfile']) && is_array($this->attrs['gotoKioskProfile'])){
+        for($i = 0 ; $i < $this->attrs['gotoKioskProfile']['count']; $i ++){
+          $url = $this->attrs['gotoKioskProfile'][$i];
+          $this->server_path = preg_replace("/\/[^\/]*$/","",$url);
+          $name= preg_replace("/^.*\//","",$url);
+          $this->gotoKioskProfiles[] = array('url'     => $url , 
+                                            'name'    => $name , 
+                                            'initial' =>TRUE,
+                                            'exists'  => file_exists($this->baseDir."/".$name));
+        }
+      }
+    }
+  }
+
+
+  function remove_from_parent()
+  {
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(&(objectClass=gotoEnvironment)(gotoKioskProfile=*/".$this->cn."/*))",array("cn"));
+    $str ="";
+    $cnt = 3;
+    while($cnt && $attrs = $ldap->fetch()){
+      $str .= $attrs['cn'][0].", ";
+      $cnt --;
+    }    
+    $str = preg_replace("/, $/","",$str);
+    if($cnt != 3){
+      print_red(sprintf(_("Can not remove kiosk profile service, it is currently in use by following user(s) : %s."),$str));
+    }else{
+      goService::remove_from_parent();
+    }
+  }
+  
+  
+  function execute()
+  { 
+    /* log actions */
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","server/".get_class($this),$this->dn);
+    }
+
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+    $display= "";
+
+    /* Add new kiosk profile
+     * in profile directory ($this->baseDir);
+     */
+    if((isset($_POST['profileAdd']))&&(isset($_FILES['newProfile']))){
+      $file = $_FILES['newProfile'];
+      if(!file_exists($this->baseDir.$file['name'])){
+        $tmp = array(
+            'url'     => "" ,
+            'name'    => $file['name'] ,
+            'initial' => FALSE,
+            'tmp_name'=> $file['tmp_name'],
+            'content' => file_get_contents($file['tmp_name']),
+            'exists'  => TRUE);
+        $this->gotoKioskProfiles[] = $tmp;
+      }
+      if(!is_writeable($this->baseDir)){
+        print_red(sprintf(_("Can't save new kiosk profiles, possibly permission denied for folder: '%s'."),$this->baseDir));
+      }
+    }
+
+    $only_once = true;
+    foreach($_POST as $name => $value){
+
+      if((preg_match("/^delkiosk_/",$name))&&($only_once)){
+  
+        /* Get id, name and path */
+        $only_once = false;
+        $id = preg_replace("/^delkiosk_/","",$name);
+        $id = preg_replace("/_.*$/","",$id);
+        $name = $this->gotoKioskProfiles[$id]['name'];
+        $filename = $this->baseDir."/".$name;
+
+        /* check if profile is still in use */
+        $ldap = $this->config->get_ldap_link();
+        $ldap->cd($this->config->current['BASE']);
+        $ldap->search("(&(objectClass=gotoEnvironment)(gotoKioskProfile=*".$name.")",array("cn","uid","gotoKioskProfile"));
+        $used_by = "";
+        $cnt = 3;
+        while(($attrs = $ldap->fetch()) && ($cnt)){
+          $cnt --;
+          $check = preg_replace("/^.*\//i","",$attrs['gotoKioskProfile'][0]);
+          if($check == $name){
+            $used_by .= $attrs['cn'][0].", ";
+          }
+        }
+        $used_by = preg_replace("/, $/","",$used_by);
+        if(!empty($used_by)){
+          print_red(sprintf(_("Can't remove kioks profile, it is still in use by the following objects '%s'."),$used_by));
+        }else{
+          if($this->gotoKioskProfiles[$id]['initial']){
+            $res = @unlink($filename);
+            if(!$res){
+              if(!is_writeable($filename)){
+                print_red(sprintf(_("Can't delete '%s'. Error was: permission denied."), $filename));
+              }
+              if(!file_exists($filename)){
+                print_red(sprintf(_("Can't delete '%s'. Error was: file doesn't exist."), $filename));
+              }
+            }
+            unset($this->gotoKioskProfiles[$id]);
+          }
+        }
+      }
+    }
+
+    /* Display list of profiles */
+    $divlist = new divSelectBox("KioskProfiles");
+    $divlist -> SetHeight (300);
+    foreach($this->gotoKioskProfiles as $key => $val ){
+      $divlist->AddEntry(array(
+            array("string"=>"<a target='_blank' href='getkiosk.php?id=".$val['name']."'>".$val['name']."</a>"),
+            array("string"=>"<input type='image' src='images/edittrash.png'
+              class='center' alt='delete' name='delkiosk_".$key."'>" ,
+              "attach"=>" style='border-right: 0px;width:24px; text-align:center;' ")
+            ));
+    }
+
+    /* Assign all existing profiles to smarty */
+    $smarty->assign("divlist",$divlist->DrawList());
+    $smarty = get_smarty(); 
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr,$this->$attr);
+    }
+    $smarty->assign("server_path",$this->server_path);
+    return($smarty->fetch(get_template_path("goKioskService.tpl",TRUE,dirname(__FILE__))));
+  }
+
+  function getListEntry()
+  {
+    $fields = goService::getListEntry();
+    $fields['Message']    = _("Kiosk profile service");
+    $fields['AllowEdit']  = TRUE;
+    $fields['AllowStart']  = false;
+    $fields['AllowStop']  = false;
+    $fields['AllowRestart']  = false;
+    return($fields);
+  }
+
+  function check()
+  { 
+    $message = plugin::check();
+    return($message);
+  }
+
+  function save()
+  {
+    goService::save();
+
+    $method = $this->server_path."/";
+    $method = preg_replace("/\/\/*$/","/",$method);
+    $this->attrs['gotoKioskProfile'] = array();
+    foreach($this->gotoKioskProfiles as $profile){
+      if(!$profile['initial']){
+
+        $contents = $profile['content'];
+        $path = $this->baseDir."/".$profile['name'];
+        $fp = @fopen($path,"w");
+        if(!$fp){
+          print_red(_("Can't save new kiosk profiles, possibly permission denied for folder")." : ",$path);
+        }else{
+          fwrite($fp,$contents,strlen($contents));
+          $this->attrs['gotoKioskProfile'][] = $method.$profile['name'];
+        }
+        @unlink($profile['tmp_name']);
+      }else{
+        $this->attrs['gotoKioskProfile'][] = $method.$profile['name'];
+      }
+    }
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->cd($this->dn);
+    $ldap->modify($this->attrs);
+    show_ldap_error($ldap->get_error(),_("Wohl kaum"));
+  }
+
+  
+  function save_object()
+  {
+    if(isset($_POST['goKioskPosted'])){
+      goService::save_object();
+      if(isset($_POST['server_path'])){
+        $this->server_path = get_post("server_path");
+      }
+    }
+  }  
+
+
+  /* Return plugin informations for acl handling */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Kiosk"),
+          "plDescription" => _("Kiosk profile management")." ("._("Services").")",
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 100,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("server"),
+
+          "plProvidedAcls"=> array()
+          ));
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/services/kiosk/goKioskService.tpl b/plugins/admin/systems/services/kiosk/goKioskService.tpl
new file mode 100644 (file)
index 0000000..f812304
--- /dev/null
@@ -0,0 +1,24 @@
+<h2><img alt="" class="center" src="images/house.png" align="middle">&nbsp;<LABEL for="gotoKioskProfile">{t}Kiosk profile management{/t}</ LABEL></h2>
+
+    <input type="hidden" name="dialogissubmitted" value="1">
+
+{t}Server path{/t}&nbsp;<input name="server_path" style="width:300px;" value="{$server_path}">
+<br>
+<br>
+{$divlist}
+<input type="file" size=50 name="newProfile" value="{t}Browse{/t}">
+<input type="submit" name="profileAdd" value="{t}Add{/t}">
+
+<p class='seperator'>&nbsp;</p>
+<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
+    <input type='submit' name='SaveService' value='{t}Save{/t}'>
+    &nbsp;
+    <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
+</div>
+<input type="hidden" name="goKioskPosted" value="1">
+
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+    focus_field('gotoKioskProfile');
+  -->
+</script>
diff --git a/plugins/admin/systems/services/kolab/class_servKolab.inc b/plugins/admin/systems/services/kolab/class_servKolab.inc
new file mode 100644 (file)
index 0000000..7d31ff5
--- /dev/null
@@ -0,0 +1,415 @@
+<?php
+
+class servkolab extends goService {
+  /* 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");
+
+  var $postfix_mydomain                 = "";
+  var $cyrus_admins                     = "";
+  var $postfix_mydestination            = "";
+  var $postfix_mynetworks               = "127.0.0.1/8";
+  var $postfix_enable_virus_scan        = "TRUE";
+  var $postfix_relayhost                = "";
+  var $postfix_mxrelayenabled           =  true;
+  var $postfix_allow_unauthenticated     = "FALSE";
+  var $cyrus_quotawarn                  = "80";
+  var $kolabFreeBusyFuture              = "1";
+  var $k                                = "kolab";
+  var $cyrus_imap                       = "TRUE";
+  var $cyrus_pop3                       = "FALSE";
+  var $cyrus_imaps                      = "TRUE";
+  var $cyrus_pop3s                      = "TRUE";
+  var $cyrus_sieve                      = "TRUE";
+  var $apache_allow_unauthenticated_fb  = "TRUE";
+  var $proftpd_ftp                      = "FALSE";
+  var $apache_http                      = "TRUE";
+  var $kolabHost                        = array();
+  var $orig_cn                          = "";
+  var $view_logged                      = FALSE;
+
+  var $attributes =  array("postfix_mydomain", "postfix_mydestination", "proftpd_ftp", "k",
+      "postfix_mynetworks", "postfix_enable_virus_scan", "postfix_relayhost", "apache_http",
+      "postfix_allow_unauthenticated", "cyrus_admins", "cyrus_imap","kolabFreeBusyFuture",
+      "cyrus_pop3", "cyrus_imaps", "cyrus_pop3s", "cyrus_sieve", "apache_allow_unauthenticated_fb",
+      "cyrus_quotawarn");
+  var $objectclasses = array("top", "kolab");
+
+  /* Serverservice vars */
+  var $conflicts    = array("goImapServer","goMailServer");
+  var $DisplayName  = "Kolab mail service";
+  var $StatusFlag   = "";
+
+  function servkolab(&$config, $dn = NULL, $parent= NULL) 
+  {
+    /* Setting the hostname and tell this Plugin that we are the kolab extension*/
+    $this->hostname = preg_replace('/^cn=([^,]+),.*$/', '\1', $dn);
+    $this->dn       = "k=kolab,".$config->current['BASE'];
+
+    /* Load variables, if given*/
+    plugin::plugin($config, $this->dn);
+
+    /* Copy needed attributes */
+    foreach($this->attributes as $val) {
+      $name = preg_replace('/_/', '-', $val);
+      if (isset($this->attrs["$name"][0])) {
+        $this->$val = $this->attrs["$name"][0];
+      }
+    }
+
+    /* Toggle relayhost */
+    $this->postfix_mxrelayenabled = preg_match('/^\[/', $this->postfix_relayhost);
+    $this->postfix_relayhost      = preg_replace("/[\[\]]/","",$this->postfix_relayhost);
+
+    /* Is this Server a member of the Kolab extension or not ?*/ 
+    if(isset($this->attrs['kolabHost'])) {
+      $this->kolabHost= $this->attrs['kolabHost'];
+      unset($this->kolabHost['count']);
+    }
+    $this->is_account            = false;
+    $this->initially_was_account = false;
+    foreach($this->kolabHost as $host){
+      if($this->hostname == $host){
+        $this->is_account            = true;
+        $this->initially_was_account = true;
+      }
+    } 
+  }
+
+
+  function execute() 
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","server/".get_class($this),$this->dn);
+    }
+
+    /***************  
+      Variable initialisation
+     ***************/  
+    
+    $smarty     = get_smarty();
+    $display    = "";
+    $ldap       = $this->config->get_ldap_link();
+
+
+    /* Assemble free/busy string */
+    $edit       = sprintf('<input name="kolabFreeBusyFuture" value="%s" type="text" maxlength="3" size="4">',
+                    $this->kolabFreeBusyFuture);
+    $fbfuture   = sprintf(_("Include data from %s days in the past when creating free/busy lists"), $edit);
+
+    /* Assemble quota string */
+    $edit       = sprintf('<input name="cyrus_quotawarn" value="%s" type="text" maxlength="3" size="4">',
+                    $this->cyrus_quotawarn);
+    $quotastr   = sprintf(_("Warn users when using more than %s%% of their mail quota"), $edit);
+
+    /***************
+      Assign informations to smarty 
+     ***************/
+
+    /* Set relayhost and if we have MX lookup enabled*/ 
+    if($this->postfix_mxrelayenabled) {
+      $smarty->assign("RelayMxSupportCheck"," checked ");
+    } else {
+      $smarty->assign("RelayMxSupportCheck","");
+    }
+
+    /* Set acls */
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+    /* Initialize all attributes, that were submitted */
+    foreach($this->attributes as $val) 
+    {
+      /* Tell smarty which variables we are useing */
+      $smarty->assign($val, $this->$val);
+      if (($this->$val != "FALSE") && !empty($this->$val)){
+        $smarty->assign($val."Check", "checked");
+      } else {
+        $smarty->assign($val."Check", "");
+      }
+    }
+
+    $smarty->assign("fbfuture", $fbfuture);
+    $smarty->assign("quotastr", $quotastr);
+
+    /* Load Template */
+    $display.=$smarty->fetch(get_template_path('servkolab.tpl', TRUE));
+    return ($display);
+  }
+
+  function remove_from_parent() 
+  {
+
+     /* Remove status flag, it is not a memeber of
+        this->attributes, so ensure that it is deleted too */
+    if(!empty($this->StatusFlag)){
+      $this->attrs[$this->StatusFlag] = array();
+    }
+
+
+    /* Only walk through following code, if this host 
+       was a member of the kolab hosts, else skip this */
+    if(!$this->initially_was_account){
+      return;
+    }
+
+    /* !!! Don't use "cn" in this function 
+       hostname -> the initial name of the host
+       cn       -> is the new name of the host, in case that it was renamed.
+     */
+
+    $ldap     = $this->config->get_ldap_link();
+    $this->dn = "k=kolab,".$this->config->current['BASE'];
+
+    /* We can't simply remove the whole entry, it is possible that there are 
+       some other hosts assigned to this object. 
+       So, first of all check if we are the last host entry within the host 
+       : Remove k=kolab entry 
+       if we aren't alone, only remove host name from hosts entry and save */
+    /* Are we alone? Remove complete entry... */
+
+    /* Check if we are definitly in kolabHosts */
+    if(!in_array_ics($this->hostname,$this->kolabHost)) {
+      return;
+    }
+
+    /* Integration check, not translated because they can't pop up at all, only for debug */ 
+    if(count($this->kolabHost) == 0){
+      print_red("Server - Kolab tab : This is not possible, we can't remove an account which doesn't exists.");
+      return;
+    }
+    if(!isset($this->hostname) || (empty($this->hostname))){
+      print_red("The required attribute hostname seams to empty.");
+    }
+
+    /* Our hostname is in kolabHosts and there is a only one entry 
+       = we are the last host entry, delete k=kolab entry  */
+    if (count($this->kolabHost) == 1){
+
+      /* Remove complete entry */
+      $ldap->rmdir ($this->dn);
+      show_ldap_error($ldap->get_error(), sprintf(_("Removing host entry from system server/kolab with dn '%s' failed."),$this->dn));
+    } else {
+
+      /* Only modify kolabHost */
+      $hosts= array();
+      foreach ($this->kolabHost as $host){
+        if($host != $this->hostname){
+          $hosts[]= $host;
+        }
+      }
+      $attrs= array('kolabHost' => $hosts);
+      $ldap->cd($this->dn);
+      $this->cleanup();
+      $ldap->modify ($attrs); 
+      show_ldap_error($ldap->get_error(), sprintf(_("Removing host entry from system server/kolab with dn '%s' failed."),$this->dn));
+    }
+
+    new log("remove","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+
+    /* Optionally execute a command after we're done */
+    $this->handle_post_events("remove");
+  }
+
+
+  function save_object()    
+  {
+    if (isset($_POST['kolabtab'])){
+      plugin::save_object();
+
+
+      foreach($this->attributes as $attr){
+        if(($this->acl_is_writeable(preg_replace("/_/","",$attr))) && (isset($_POST[$attr]))){
+          $this->$attr = $_POST[$attr];
+        }
+      }
+
+      /* Save checkboxes */
+      foreach (array( "postfix_enable_virus_scan", "postfix_allow_unauthenticated",
+            "cyrus_imap", "cyrus_pop3", "cyrus_imaps",
+            "cyrus_pop3s", "cyrus_sieve", "apache_allow_unauthenticated_fb",
+            "proftpd_ftp", "apache_http") as $cb){
+
+        if($this->acl_is_writeable(preg_replace("/_/","",$cb))){
+          if (isset($_POST[$cb])){
+            $this->$cb= "TRUE";
+          } else {
+            $this->$cb= "FALSE";
+          }
+        }
+      }
+
+      /* Toggell relay check */
+      if($this->acl_is_writeable("postfixmxrelayenabled")){
+        $this->postfix_mxrelayenabled= isset($_POST['RelayMxSupport']);
+      }
+    }
+
+  }
+
+
+  function check() 
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    if(($this->kolabFreeBusyFuture==""))    {
+      $message[] = _("Future days in Free/Busy settings must be set.");
+    }elseif(!is_uid($this->kolabFreeBusyFuture) || $this->kolabFreeBusyFuture < 0){
+      $message[] = _("Future days in Free/Busy settings must be a positive value.");
+    }
+
+    if(!is_int((int)($this->cyrus_quotawarn))) {
+      $message[] = _("The given Quota settings value must be a number.");
+    }elseif(!(($this->cyrus_quotawarn<=100)&&($this->cyrus_quotawarn>=0))){
+      $message[] = _("Please choose a value between 1 and 100 for Quota settings.");
+    }elseif(strcasecmp($this->cyrus_quotawarn,(int)$this->cyrus_quotawarn)){
+      $message[] = _("Future days must be a value.");
+    }
+
+    if(empty($this->postfix_mynetworks)) { 
+      $message[] = _("No SMTP privileged networks set.");
+    }
+
+    /*if(empty($this->postfix_relayhost)) {
+      $message[] = _("No SMTP smarthost/relayhost set.");
+      }
+     */
+
+    return ($message);
+  }
+
+
+  /* Save to LDAP */
+  function save() 
+  {
+    /* Set ldap connection */
+    $ldap       = $this->config->get_ldap_link();
+
+    /* Open current dn*/
+    $this->dn   = "k=kolab,".$this->config->current['BASE'];
+
+    /* Adapt relayhost */
+    $this->postfix_relayhost= preg_replace('/[\[\]]/', '', $this->postfix_relayhost);
+    if ($this->postfix_mxrelayenabled && $this->postfix_relayhost != ""){
+      $this->postfix_relayhost= "[".$this->postfix_relayhost."]";
+    }
+
+    /* Check if this server was renamed, in this case we have to remove old cn first*/
+    if($this->hostname != $this->cn){
+      $tmp = array();
+      if(in_array_ics($this->hostname,$this->kolabHost)){
+        foreach($this->kolabHost as $host){
+          if($host != $this->hostname){
+            $tmp[] = $host;
+          }
+        }
+        $this->kolabHost = $tmp;
+      }
+    }
+
+    /* Add ourselves to the list of kolabHost's if needed */
+    if (!in_array_ics($this->cn,$this->kolabHost)){
+      $this->kolabHost[]= $this->cn;
+    }
+
+    /* Call parents save to prepare $this->attrs */
+    plugin::save();
+
+    /* Save or modify? */
+    $ldap->cat($this->dn, array('dn'));
+    if (!$ldap->fetch()){
+      $mode= "add"; 
+    } else {
+      $mode= "modify";
+    }
+
+    /* Do attribute conversion */
+    foreach ($this->attrs as $key => $value){
+      if (preg_match('/_/', $key)){
+        $old_key= $key;
+        $key= preg_replace('/_/', '-', $key);
+        $this->attrs[$key]= $value;
+        unset($this->attrs[$old_key]);
+      }
+    }
+    /* Add kolab hosts */
+    $this->attrs['kolabHost']= $this->kolabHost;
+
+    /* Perform LDAP action */
+    $ldap->cd($this->dn);
+    $this->cleanup();;
+    $ldap->$mode($this->attrs);
+
+    if($mode == "add"){
+      new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
+
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving system server/kolab with dn '%s' failed."),$this->dn));
+
+    /* Optionally execute a command after we're done */
+    if ($this->initially_was_account == $this->is_account) {
+      if ($this->is_modified) {
+        $this->handle_post_events("modify");
+      }
+    } else {
+      $this->handle_post_events("add");
+    }
+  }
+
+
+  function getListEntry()
+  {
+    $fields                 = goService::getListEntry();
+    $fields['Message']      = _("Kolab mail service");
+    $fields['AllowEdit']    = true;
+    return($fields);
+  }
+
+
+  /* Return plugin informations for acl handling */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Kolab"),
+          "plDescription" => _("Kolab mail service")." ("._("Services").")",
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 85,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("server"),
+
+          "plProvidedAcls"=> array(
+            "postfixmydomain"                => _("Postfix mydomain") ,
+            "postfixmydestination"           => _("My destination") ,
+            "cyrusadmins"                    => _("Cyrus admins") ,
+            "proftpdftp"                     => _("FTP FreeBusy service") ,
+            "postfixmynetworks"              => _("SMTP privileged networks") ,
+            "postfixenablevirusscan"         => _("Enable virus scan") ,
+            "postfixrelayhost"               => _("Relayhost") ,
+            "postfixmxrelayenabled"          => _("Enable MX lookup for relayhost"),
+            "apachehttp"                     => _("HTTP FreeBusy service") ,
+            "apacheallowunauthenticatedfb"   => _("Allow unauthenticated free busy"),
+            "postfixallowunauthenticated"    => _("Accept Internet Mail") ,
+            "cyrusimap"                      => _("IMAP service") ,
+            "kolabFreeBusyFuture"            => _("kolabFreeBusyFuture") ,
+            "cyruspop3"                      => _("POP3 service") ,
+            "cyrusimaps"                     => _("IMAP/SSL service") ,
+            "cyruspop3s"                     => _("POP3/SSL service") ,
+            "cyrussieve"                     => _("Sieve service") ,
+            "cyrusquotawarn"                 => _("Quota settings")) 
+            ));
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/services/kolab/servkolab.tpl b/plugins/admin/systems/services/kolab/servkolab.tpl
new file mode 100644 (file)
index 0000000..ec83b78
--- /dev/null
@@ -0,0 +1,249 @@
+<table summary="" style="width:100%">
+ <tr>
+  <td style="vertical-align:top; border-right:1px solid #A0A0A0; padding-right:5px;" width="50%">
+   <table summary="">
+    <tr>
+        <td colspan="2"><b>{t}Generic{/t}</b></td>
+       </tr>
+       <tr>
+               <td>{t}Postfix mydomain{/t}
+               </td>
+               <td>
+{render acl=$postfixmydomainACL}
+                       <input type="text" name="postfix_mydomain" value="{$postfix_mydomain}">
+{/render}
+               </td>
+       </tr>
+       <tr>
+               <td>{t}Postfix mydestination{/t}
+               </td>
+               <td>
+{render acl=$postfixmydestinationACL}
+                       <input type="text" name="postfix_mydestination" value="{$postfix_mydestination}">
+{/render}
+               </td>
+       </tr>
+       <tr>
+               <td>{t}Cyrus admins{/t}
+               </td>
+               <td>
+{render acl=$cyrusadminsACL}
+                       <input type="text" name="cyrus_admins" value="{$cyrus_admins}">
+{/render}
+               </td>
+       </tr>
+   </table>    
+   <p class="seperator" >&nbsp;</p>
+   <table summary="">
+    <tr>
+        <td colspan="2"><b>{t}Services{/t}</b></td>
+       </tr>
+       <tr>
+               <td>
+{render acl=$cyruspop3ACL}
+                       <input id="cyrus_pop3" name="cyrus_pop3" value="1" type="checkbox" {$cyrus_pop3Check}>
+{/render}
+               </td>
+               <td>
+                       <LABEL for="cyrus_pop3">{t}POP3 service{/t}</LABEL>
+               </td>
+       </tr>
+       <tr>
+        <td>
+{render acl=$cyruspop3sACL}
+            <input id="cyrus_pop3s" name="cyrus_pop3s" value="1" type="checkbox" {$cyrus_pop3sCheck}>
+{/render}
+        </td>
+               <td>
+                       <LABEL for="cyrus_pop3s">{t}POP3/SSL service{/t}</LABEL>
+        </td>
+    </tr>
+    <tr>
+        <td>
+{render acl=$cyrusimapACL}
+            <input id="cyrus_imap" name="cyrus_imap" value="1" type="checkbox" {$cyrus_imapCheck}>
+{/render}
+        </td>
+        <td>
+                       <LABEL for="cyrus_imap">{t}IMAP service{/t}</LABEL>
+        </td>
+    </tr>
+    <tr>
+        <td>
+{render acl=$cyrusimapsACL}
+            <input id="cyrus_imaps" name="cyrus_imaps" value="1" type="checkbox" {$cyrus_imapsCheck}>
+{/render}
+        </td>
+        <td>
+                       <LABEL for="cyrus_imaps">{t}IMAP/SSL service{/t}</LABEL>
+        </td>
+    </tr>
+    <tr>
+        <td>
+{render acl=$cyrussieveACL}
+            <input id="cyrus_sieve" name="cyrus_sieve" value="1" type="checkbox" {$cyrus_sieveCheck}>
+{/render}
+        </td>
+        <td>
+                       <LABEL for="cyrus_sieve">{t}Sieve service{/t}</LABEL>
+        </td>
+    </tr>
+    <tr>
+        <td>
+{render acl=$proftpdftpACL}
+            <input id="proftpd_ftp" name="proftpd_ftp" value="1" type="checkbox" {$proftpd_ftpCheck}>
+{/render}
+        </td>  
+        <td>
+                       <LABEL for="proftpd_ftp">{t}FTP FreeBusy service (legacy, not interoperable with Kolab2 FreeBusy){/t}</LABEL>
+        </td>
+    </tr>
+    <tr>
+        <td>
+{render acl=$apachehttpACL}
+            <input id="apache_http" name="apache_http" value="1" type="checkbox" {$apache_httpCheck}>
+{/render}
+        </td>
+        <td>
+                       <LABEL for="apache_http">{t}HTTP FreeBusy service (legacy){/t}</LABEL>
+        </td>
+    </tr>
+    <tr>
+        <td>
+{render acl=$postfixenablevirusscanACL}
+                       <input id="postfix_enable_virus_scan" name="postfix_enable_virus_scan" value="1" type="checkbox" {$postfix_enable_virus_scanCheck}>
+{/render}
+        </td>
+        <td>
+                       <LABEL for="postfix_enable_virus_scan">{t}Amavis email scanning (virus/spam){/t}</LABEL>
+               </td>
+       </tr>
+   </table>
+
+   <p class="seperator">&nbsp;</p>
+   <br>
+
+   <table summary="">
+    <tr>
+               <td> 
+                       <b>{t}Quota settings{/t}</b>
+               </td>
+       </tr>
+       <tr>
+               <td>
+{render acl=$cyrusquotawarnACL}
+                       {$quotastr}
+{/render}
+               </td>
+       </tr>
+   </table>
+  
+  </td>
+  <td style="vertical-align:top" width="50%">
+
+   <table summary="">
+    <tr>
+        <td colspan="2">
+            <b>{t}Free/Busy settings{/t}</b>
+        </td>
+    </tr>
+    <tr>
+        <td>
+{render acl=$apacheallowunauthenticatedfbACL}
+            <input name="apache_allow_unauthenticated_fb" value="1" type="checkbox" {$apache_allow_unauthenticated_fbCheck}> {t}Allow unauthenticated downloading of Free/Busy information{/t}
+{/render}
+        </td>
+        </tr>
+        <tr>
+        <td>
+{render acl=$kolabFreeBusyFutureACL}
+               {$fbfuture}
+{/render}
+       </td>
+     </tr>
+   </table>
+
+<p class="seperator">&nbsp;</p>
+<br>
+   <table summary="">
+    <tr>
+        <td>
+               <b>{t}SMTP privileged networks{/t}</b>
+               </td>
+    </tr>
+    <tr>
+         <td>
+           <LABEL for="postfix_mynetworks">{t}Hosts/networks allowed to relay{/t}</LABEL><br>
+{render acl=$postfixmynetworksACL}
+        <input id="postfix_mynetworks" name="postfix_mynetworks" size="60" maxlength="220" value="{$postfix_mynetworks}" type="text">
+{/render}
+               <br>
+               ( {t}Enter multiple values, seperated with{/t} , )
+       </td>
+     </tr>
+   </table>
+
+
+<p class="seperator">&nbsp;</p>
+<br>
+
+
+   <table summary="">
+    <tr>
+        <td>
+               <b>{t}SMTP smarthost/relayhost{/t}</b>
+               </td>
+    </tr>
+    <tr>
+        <td>
+{render acl=$postfixrelayhostACL}
+            <input id="RelayMxSupport" name="RelayMxSupport" value="1" type="checkbox" {$RelayMxSupportCheck}>
+{/render}
+                       <LABEL for="RelayMxSupport">{t}Enable MX lookup for relayhost{/t}</LABEL>
+               </td>
+     </tr>
+       <tr>    
+               <td>
+                   <LABEL for="postfix_relayhost">{t}Host used to relay mails{/t}</LABEL>&nbsp;
+{render acl=$postfixrelayhostACL}
+                       <input id="postfix_relayhost" name="postfix_relayhost" size="35" maxlength="120" value="{$postfix_relayhost}" type="text">
+{/render}
+               </td>
+       </tr>
+   </table>
+
+
+<p class="seperator">&nbsp;</p>
+<br>
+
+
+   <table summary="">
+    <tr>
+        <td>
+               <b>{t}Accept Internet Mail{/t}</b>
+               </td>
+    </tr>
+    <tr>
+        <td>
+{render acl=$postfixallowunauthenticatedACL}
+            <input id="postfix_allow_unauthenticated" name="postfix_allow_unauthenticated" value="1" type="checkbox" {$postfix_allow_unauthenticatedCheck}>
+{/render}
+               <LABEL for="postfix_allow_unauthenticated">{t}Accept mail from other domains over non-authenticated SMTP{/t}</LABEL>
+               </td>
+     </tr>
+   </table>
+
+
+  </td>
+ </tr>
+</table>
+
+<input type="hidden" name="kolabtab">
+
+<p class="seperator">&nbsp;</p>
+<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
+    <input type='submit' name='SaveService' value='{t}Save{/t}'>
+    &nbsp;
+    <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
+</div>
+
diff --git a/plugins/admin/systems/services/ldap/class_goLdapServer.inc b/plugins/admin/systems/services/ldap/class_goLdapServer.inc
new file mode 100644 (file)
index 0000000..c16df03
--- /dev/null
@@ -0,0 +1,97 @@
+<?php
+
+class goLdapServer extends goService{
+
+  var $cli_summary      = "This plugin is used within the ServerService Pluign \nand indicates that this server has goLdapServer defined.";
+  var $cli_description  = "Some longer text\nfor help";
+  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* This plugin only writes its objectClass */
+  var $objectclasses    = array("goLdapServer");
+  var $attributes       = array("goLdapBase");
+  var $StatusFlag       = "goLdapServerStatus";
+
+  /* This class can't be assigned twice so it conflicts with itsself */
+  var $conflicts        = array("goLdapServer");
+
+  var $DisplayName      = "";
+  var $dn               = NULL;
+  var $cn                  = "";
+  var $goLdapServerStatus  = "";
+  var $goLdapBase          = ""; 
+  var $view_logged  =FALSE;
+
+  function goLdapServer(&$config,$dn)
+  {
+    goService::goService($config,$dn);
+    $this->DisplayName = _("LDAP service");
+  }
+
+
+  function execute()
+  { 
+
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","server/".get_class($this),$this->dn);
+    }
+
+    $smarty = get_smarty(); 
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr,$this->$attr);
+    }
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translated){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+    return($smarty->fetch(get_template_path("goLdapServer.tpl",TRUE,dirname(__FILE__))));
+  }
+
+
+  function getListEntry()
+  {
+    $fields  = goService::getListEntry();
+    $fields['Message']    = _("LDAP Service");
+    $fields['AllowEdit']  = true;
+    return($fields);
+  }
+
+
+
+  function check()
+  { 
+    $message = plugin::check();
+    if(empty($this->goLdapBase)){
+      $message[] = _("The given base is empty or contains invalid characters.");
+    }
+    return($message);
+  }
+
+
+  function save_object()
+  {
+    if(isset($_POST['goLdapServerPosted'])){
+      plugin::save_object();
+    }
+  } 
+
+
+  /* Return plugin informations for acl handling */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Ldap"),
+          "plDescription" => _("Ldap")." ("._("Services").")",
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 96,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("server"),
+
+          "plProvidedAcls"=> array(
+            "goLdapBase" => _("Ldap base"))
+          ));
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/services/ldap/goLdapServer.tpl b/plugins/admin/systems/services/ldap/goLdapServer.tpl
new file mode 100644 (file)
index 0000000..24e1817
--- /dev/null
@@ -0,0 +1,13 @@
+<h2><img class="center" alt="" align="middle" src="images/rightarrow.png" /> {t}LDAP service{/t}</h2>
+{t}LDAP URI{/t}{$must} 
+{render acl=$goLdapBaseACL}
+<input type="text" size="80" value="{$goLdapBase}"  name="goLdapBase" id="goLdapBaseId">
+{/render}
+
+<p class='seperator'>&nbsp;</p>
+<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
+    <input type='submit' name='SaveService' value='{t}Save{/t}'>
+    &nbsp;
+    <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
+</div>
+<input type="hidden" name="goLdapServerPosted" value="1">
diff --git a/plugins/admin/systems/services/log/class_gosaLogServer.inc b/plugins/admin/systems/services/log/class_gosaLogServer.inc
new file mode 100644 (file)
index 0000000..cade0e2
--- /dev/null
@@ -0,0 +1,108 @@
+<?php
+
+class gosaLogServer extends goService{
+       
+  /* This plugin only writes its objectClass */
+  var $objectclasses    = array("gosaLogServer");
+  var $attributes       = array("goLogDB","goLogDBUser","goLogDBPassword");
+  var $StatusFlag       = "";
+
+  /* This class can't be assigned twice so it conflicts with itsself */
+  var $conflicts        = array("gosaLogServer");
+
+  var $DisplayName      = "";
+  var $dn               = NULL;
+  var $acl;
+  var $cn                 = "";
+  var $goLogDBServerStatus= "";
+  var $goLogDBUser        = "";
+  var $goLogDBPassword    = "";  
+  var $goLogDB            = "";  
+  var $view_logged  =FALSE;
+
+
+  function gosaLogServer(&$config,$dn)
+  {
+    goService::goService($config,$dn);
+    $this->DisplayName = _("GOsa MySQL logging service");
+  }
+
+
+  function execute()
+  { 
+    $smarty = get_smarty(); 
+
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","server/".get_class($this),$this->dn);
+    }
+
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr,$this->$attr);
+    }
+    return($smarty->fetch(get_template_path("gosaLogServer.tpl",TRUE,dirname(__FILE__))));
+  }
+
+
+  function getListEntry()
+  {
+    $fields = goService::getListEntry();
+    $fields['Message']      = _("GOsa MySQL logging service");
+    $fields['AllowEdit']    = true;
+    $fields['AllowStart']   = FALSE;
+    $fields['AllowStop']    = FALSE;
+    $fields['AllowRestart'] = FALSE;
+    return($fields);
+  }
+
+
+  function check()
+  { 
+    $message = plugin::check();
+    if (empty($this->goLogDBUser)){
+      $message[]= sprintf_("The attribute user is empty or contains invalid characters.");
+    }
+    if (empty($this->goLogDBPassword)){
+      $message[]= sprintf_("The attribute password is empty or contains invalid characters.");
+    }
+    if (empty($this->goLogDB)){
+      $message[]= sprintf_("The attribute database is empty or contains invalid characters.");
+    }
+    return($message);
+  }
+
+
+  function save_object()
+  {
+    if(isset($_POST['gosaLogServerPosted'])){
+      plugin::save_object();
+    }
+  } 
+
+  /* Return plugin informations for acl handling */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("GOsa logging service"),
+          "plDescription" => _("GOsa logging service")." ("._("Services").")",
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 98,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("server"),
+
+          "plProvidedAcls"=> array(
+            "goLogDB"         => _("Database"),
+            "goLogDBUser"     => _("User"),
+            "goLogDBPassword" => _("Password"), 
+            "viewEntries"    => _("Allow view of entries on this server")) 
+          ));
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/services/log/gosaLogServer.tpl b/plugins/admin/systems/services/log/gosaLogServer.tpl
new file mode 100644 (file)
index 0000000..7dd032a
--- /dev/null
@@ -0,0 +1,35 @@
+<h2><img class="center" alt="" align="middle" src="images/rightarrow.png" /> {t}GOsa logging database{/t}</h2>
+<table summary="">
+    <tr>
+     <td>{t}Database user{/t}{$must}</td>
+     <td>
+{render acl=$goLogDBUserACL}
+       <input name="goLogDBUser" id="goLogDBUser" size=30 maxlength=60 value="{$goLogDBUser}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td>{t}Password{/t}{$must}</td>
+     <td>
+{render acl=$goLogDBPasswordACL}
+       <input type="password" name="goLogDBPassword" id="goLogDBPassword" size=30 maxlength=60 value="{$goLogDBPassword}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td>{t}Database{/t}{$must}</td>
+     <td>
+{render acl=$goLogDBACL}
+       <input name="goLogDB" id="goLogDB" size=30 maxlength=60 value="{$goLogDB}">
+{/render}
+     </td>
+    </tr>
+   </table>
+
+<p class='seperator'>&nbsp;</p>
+<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
+    <input type='submit' name='SaveService' value='{t}Save{/t}'>
+    &nbsp;
+    <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
+</div>
+<input type="hidden" name="gosaLogServerPosted" value="1">
diff --git a/plugins/admin/systems/services/mail/class_goMailServer.inc b/plugins/admin/systems/services/mail/class_goMailServer.inc
new file mode 100644 (file)
index 0000000..742249e
--- /dev/null
@@ -0,0 +1,725 @@
+<?php
+
+class goMailServer extends goService{
+       
+  var $cli_summary      = "This pluign is used within the ServerService Pluign \nand indicates that this server supports mailqueue listings and so on.";
+  var $cli_description  = "Some longer text\nfor help";
+  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* This plugin only writes its objectClass */
+  var $objectclasses    = array("goMailServer");
+
+  /* This class can't be assigned twice so it conflicts with itsself */
+  var $DisplayName      = "";
+  var $dn               = NULL;
+  var $StatusFlag       = "goMailServerStatus";
+  var $attributes       = array("description","postfixHeaderSizeLimit",
+      "postfixMailboxSizeLimit","postfixMessageSizeLimit",
+      "postfixMyDestinations","postfixMyDomain","postfixMyhostname",
+      "postfixMyNetworks","postfixRelayhost","postfixTransportTable",
+      "postfixSenderRestrictions","postfixRecipientRestrictions");
+
+  var $goMailServerStatus               ;
+  var $postfixHeaderSizeLimit           = 0;
+  var $postfixMailboxSizeLimit          = 0;
+  var $postfixMessageSizeLimit          = 0;
+  var $postfixMyDestinations            = array();
+  var $postfixMyDomain                  = "";
+  var $postfixMyhostname                = "";
+  var $postfixMyNetworks                = array();
+  var $postfixRelayhost                 = "";
+  var $postfixTransportTable            = array();
+  var $postfixSenderRestrictions        = array();
+  var $postfixRecipientRestrictions     = array();
+  var $description                      = "";
+  var $RestrictionFilters               = array();
+  var $TransportProtocols               = array(); 
+  var $Actions                          = array();
+  var $cn                               = "";
+  var $conflicts                        = array("goMailServer","kolab");
+  var $view_logged  =FALSE;
+
+  function goMailServer(&$config,$dn)
+  {
+    goService::goService($config,$dn);
+    $this->DisplayName = _("Mail smtp service (Postfix)");
+
+    $this->Actions = array( SERVICE_STOPPED=>SERVICE_STOPPED,
+                            SERVICE_STARTED => SERVICE_STARTED,
+                            SERVICE_RESTARTED=>SERVICE_RESTARTED); 
+
+    /* Fill  RestrictionFilters   TransportProtocols  from external hooks */
+    $str = $this->config->data['TABS']['SERVERSERVICE'];
+    $this->TransportProtocols =array("smtp"=>"SMTP");
+    $this->RestrictionFilters = array("FILTER"=>"FILTER"); 
+    foreach(array("ADDITIONALRESTRICTIONFILTERS"=>"RestrictionFilters",
+          "ADDITIONALPROTOCOLLS"        =>"TransportProtocols") as $file => $var){
+      if(isset($this->config->data['MAIN'][$file])){
+        $file = $this->config->data['MAIN'][$file];
+        if((isset($file)) && is_readable($file)){
+          $tmp = file_get_contents($file);
+          $tmp2= split("\n",$tmp);
+          foreach($tmp2 as $entry){
+            if(empty($entry)) continue;
+            if(preg_match("/:/",$entry)){
+              $tmp3 = split(":",$entry);
+              $r = $this->$var;
+              $r[$tmp3[0]]=$tmp3[1];
+              $this->$var = $r;
+            }else{
+              $r = $this->$var;
+              $r[$entry] =$entry;
+              $this->$var = $r;
+            }
+          }
+        }
+      }
+    }
+
+
+    /* Get postfix my networks */
+    $this->postfixMyNetworks = array();
+    $tmp = array();
+    if(isset($this->attrs['postfixMyNetworks'][0])){
+      $tmp = split(",",$this->attrs['postfixMyNetworks'][0]);
+      foreach($tmp as $str){
+        if(!empty($str)){
+          $this->postfixMyNetworks[base64_encode($str)] = $str;
+        }
+      }
+    }
+
+
+    /* Create full name */
+    if(isset($this->attrs['postfixMyDomain'][0])){
+      $this->postfixMyhostname .= ".".$this->attrs['postfixMyDomain'][0];
+    }
+  
+
+    /* Get postfix my domains */
+    $this->postfixMyDestinations = array(); 
+    if(isset($this->attrs['postfixMyDestinations'][0])){
+      unset($this->attrs['postfixMyDestinations']['count']);
+      foreach($this->attrs['postfixMyDestinations'] as $str){
+        $this->postfixMyDestinations[base64_encode($str)] = $str;
+      }
+    }
+
+
+    /* Get transport tables */
+    $tmp = array();
+    $this->postfixTransportTable = array();
+    if(isset($this->attrs['postfixTransportTable'])){
+      $tmp = array();
+      unset($this->attrs['postfixTransportTable']['count']);
+      foreach($this->attrs['postfixTransportTable'] as $entry){
+
+        //0: offshore.vip.ms-europa.lhsystems.com smtp:172.28.0.2
+
+        $Number   = preg_replace('/^([^:]+):.*$/', '\\1', $entry);
+        $Rest     = trim(preg_replace("/^[0-9]*:/","",$entry));
+
+        $Protocol_Destination = preg_replace("/^.*\ /","",$Rest);
+        $Source               = preg_replace("/\ .*$/","",$Rest);
+
+        $Protocol     = preg_replace ('/^([^:]+):.*$/', '\\1' ,trim($Protocol_Destination));
+        $Destination  = preg_replace ('/^[^:]+:(.*)$/', '\\1'    ,trim($Protocol_Destination));
+
+        $Destination  = preg_replace ("/[\[\]]/","",$Destination);
+
+        $tmp[$Number]['src'] = $Source;
+        $tmp[$Number]['dst'] = $Destination;
+        $tmp[$Number]['prt'] = $Protocol;
+      }
+      ksort($tmp);
+      foreach($tmp as $entry){
+        $this->postfixTransportTable[] = $entry;
+      }
+    }
+   
+
+    /* Get sender restrictions */
+    $tmp = array();
+    $this->postfixSenderRestrictions = array();
+    if(isset($this->attrs['postfixSenderRestrictions'])){
+      unset($this->attrs['postfixSenderRestrictions']['count']);
+      foreach($this->attrs['postfixSenderRestrictions'] as $entry){
+        $nr  = preg_replace("/:.*$/","",$entry);
+        $rest= trim(preg_replace("/^[^:]+:/","",$entry));
+        $src = preg_replace("/ .*$/","",$rest);
+        $rest= preg_replace("/^[^ ]+ /","",$rest);
+        $dst = preg_replace("/^.* /","",$rest);
+        $prt = preg_replace("/ .*$/","",$rest);
+        $tmp[$nr]['src'] = $src;
+        $tmp[$nr]['dst'] = $dst;
+        $tmp[$nr]['filter'] = $prt;
+      }
+      ksort($tmp);
+      foreach($tmp as $entry){
+        $this->postfixSenderRestrictions[] = $entry;
+      }
+    }
+
+    /* Get sender restrictions */
+    $tmp = array();
+    $this->postfixRecipientRestrictions = array();
+    if(isset($this->attrs['postfixRecipientRestrictions'])){
+      unset($this->attrs['postfixRecipientRestrictions']['count']);
+      foreach($this->attrs['postfixRecipientRestrictions'] as $entry){
+        $nr  = preg_replace("/:.*$/","",$entry);
+        $rest= trim(preg_replace("/^[^:]+:/","",$entry));
+        $src = preg_replace("/ .*$/","",$rest);
+        $rest= preg_replace("/^[^ ]+ /","",$rest);
+        $dst = preg_replace("/^.* /","",$rest);
+        $prt = preg_replace("/ .*$/","",$rest);
+        $tmp[$nr]['src'] = $src;
+        $tmp[$nr]['dst'] = $dst;
+        $tmp[$nr]['filter'] = $prt;
+      }
+      ksort($tmp);
+      foreach($tmp as $entry){
+        $this->postfixRecipientRestrictions[] = $entry;
+      }
+    }
+
+  }
+
+  function execute()
+  { 
+    $smarty   = get_smarty();
+
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","server/".get_class($this),$this->dn);
+    }
+
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+    $delAr    = array( 
+                    "TranslationDel_"=>"TranslationDel",
+                    "SenderRestrictDel_"=>"SenderRestrictDel",
+                    "RecipientRestrictDel_"=>"RecipientRestrictDel");
+    $once     = true;
+    $s_action = "";
+    $s_entry  = "";
+  
+    /* Check posts for some intruductions */
+    foreach($_POST as $name => $value){
+      foreach($delAr as $preg => $type){
+        if((preg_match("/^".$preg."/",$name)) && ($once)){
+          $once = false;
+          $s_action = $type; 
+          $s_entry = preg_replace("/^".$preg."/","",$name);
+          $s_entry = preg_replace("/_[xy]$/","",$s_entry);
+        }
+      }
+  
+
+      if(preg_match("/^TranslationUp_/",$name) && $once && ($this->acl_is_writeablei("postfixTransportTableACL"))){
+        $once = false;
+        $key = preg_replace("/^TranslationUp_/","",$name);
+        $key = preg_replace("/_[xy]$/","",$key);
+        $this->postfixTransportTable = $this->ArrayUp($key,$this->postfixTransportTable) ;
+      }
+      if(preg_match("/^TranslationDown_/",$name) && $once && ($this->acl_is_writeable("postfixTransportTableACL"))){
+        $once = false;
+        $key = preg_replace("/^TranslationDown_/","",$name);
+        $key = preg_replace("/_[xy]$/","",$key);
+        $this->postfixTransportTable = $this->ArrayDown($key,$this->postfixTransportTable) ;
+      }
+      if(preg_match("/^SenderRestrictUp_/",$name) && $once && ($this->acl_is_writeable("postfixSenderRestrictionsACL"))){
+        $once = false;
+        $key = preg_replace("/^SenderRestrictUp_/","",$name);
+        $key = preg_replace("/_[xy]$/","",$key);
+        $this->postfixSenderRestrictions = $this->ArrayUp($key,$this->postfixSenderRestrictions) ;
+      }
+      if(preg_match("/^SenderRestrictDown_/",$name) && $once && ($this->acl_is_writeable("postfixSenderRestrictionsACL"))){
+        $once = false;
+        $key = preg_replace("/^SenderRestrictDown_/","",$name);
+        $key = preg_replace("/_[xy]$/","",$key);
+        $this->postfixSenderRestrictions = $this->ArrayDown($key,$this->postfixSenderRestrictions) ;
+      }
+      if(preg_match("/^RecipientRestrictUp_/",$name) && $once && ($this->acl_is_writeable("postfixRecipientRestrictionsACL"))){
+        $once = false;
+        $key = preg_replace("/^RecipientRestrictUp_/","",$name);
+        $key = preg_replace("/_[xy]$/","",$key);
+        $this->postfixRecipientRestrictions = $this->ArrayUp($key,$this->postfixRecipientRestrictions) ;
+      }
+      if(preg_match("/^RecipientRestrictDown_/",$name) && $once && ($this->acl_is_writeable("postfixRecipientRestrictionsACL"))){
+        $once = false;
+        $key = preg_replace("/^RecipientRestrictDown_/","",$name);
+        $key = preg_replace("/_[xy]$/","",$key);
+        $this->postfixRecipientRestrictions = $this->ArrayDown($key,$this->postfixRecipientRestrictions) ;
+      }
+    }
+
+
+    /* Add delete my network entry */
+    if((isset($_POST['AddpostfixMyNetworks'])) && (!empty($_POST['NewString_postfixMyNetworks']))){
+      $str = $_POST['NewString_postfixMyNetworks'];
+      $this->postfixMyNetworks[base64_encode($str)] = $str;
+    }
+
+    if((isset($_POST['DelpostfixMyNetworks'])) && isset($_POST['Select_postfixMyNetworks']) &&(count($_POST['Select_postfixMyNetworks']))){
+      foreach($_POST['Select_postfixMyNetworks'] as $str ){
+        unset($this->postfixMyNetworks[$str]);
+      }
+    }
+
+
+    /* Add delete my domain entry */
+    if($this->acl_is_writeable("postfixMyDestinations")){
+      if((isset($_POST['AddpostfixMyDestinations'])) && (!empty($_POST['NewString_postfixMyDestinations']))){
+        $str = $_POST['NewString_postfixMyDestinations'];
+        $this->postfixMyDestinations[base64_encode($str)] = $str;
+      }
+
+      if((isset($_POST['DelpostfixMyDestinations'])) && isset($_POST['Select_postfixMyDestinations']) &&(count($_POST['Select_postfixMyDestinations']))){
+        foreach($_POST['Select_postfixMyDestinations'] as $str ){
+          unset($this->postfixMyDestinations[$str]);
+        }
+      }
+    }
+
+
+    /* Add sender restriction */
+    if($this->acl_is_writeable("postfixSenderRestrictions")){
+      if(($s_action == "SenderRestrictDel") && (isset($this->postfixSenderRestrictions[$s_entry]))){
+        unset($this->postfixSenderRestrictions[$s_entry]);
+      }
+
+      if(isset($_POST['AddpostfixSenderRestrictions'])){
+        $src      = $_POST['Source_postfixSenderRestrictions'];
+        $dst      = $_POST['Destination_postfixSenderRestrictions'];
+        $Filter   = $_POST['SenderRestrictionFilter'];
+        $tmp['src']     = $src;
+        $tmp['dst']     = $dst;
+        $tmp['filter']  = $Filter;
+        $this->postfixSenderRestrictions[] = $tmp;
+      }
+    }
+
+
+    /* Add sender restriction */
+    if($this->acl_is_writeable("postfixRecipientRestrictions")){
+      if(($s_action == "RecipientRestrictDel") && (isset($this->postfixRecipientRestrictions[$s_entry]))){
+        unset($this->postfixRecipientRestrictions[$s_entry]);
+      }
+
+      if(isset($_POST['AddpostfixRecipientRestrictions'])){
+        $src      = $_POST['Source_postfixRecipientRestrictions'];
+        $dst      = $_POST['Destination_postfixRecipientRestrictions'];
+        $Filter   = $_POST['RecipientRestrictionFilter'];
+        $tmp['src']     = $src;
+        $tmp['dst']     = $dst;
+        $tmp['filter']  = $Filter;
+        $this->postfixRecipientRestrictions[] = $tmp;
+      }
+    }
+
+    /* Handle transports */
+    if($this->acl_is_writeable("postfixTransportTable")){
+      if(($s_action == "TranslationDel") && (isset($this->postfixTransportTable[$s_entry]))){
+        unset($this->postfixTransportTable[$s_entry]);
+      }
+
+      if(isset($_POST['AddpostfixTransportTable'])){
+        $src = trim($_POST['Source_postfixTransportTable']);  
+        $dst = trim($_POST['Destination_postfixTransportTable']);    
+        $prt = trim($_POST['TransportProtocol']);
+
+        if((!empty($src)) && (!empty($dst))){
+          if(preg_match("/:/",$dst)){
+            $tmp = split("\:",$dst);
+            $port = trim($tmp[1]);
+            $ip   = trim($tmp[0]);
+
+            if((is_ip($ip)) && (is_numeric($port))){
+              $dst = "[".$ip."]:".$port;
+            }
+          }
+          if(is_ip($dst)){
+            $dst = "[".$dst."]";
+          }
+          $tmp2 ['src'] = $src;
+          $tmp2 ['dst'] = $dst;
+          $tmp2 ['prt'] = $prt;
+
+          $this->postfixTransportTable[] = $tmp2;  
+        } 
+      }
+    }
+
+    /* Set attributes */
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr,$this->$attr);
+    }
+
+
+    /* Create divList for translation tables */
+    $divTranslation = new divSelectBox("TransportProtocols");
+    $divTranslation->SetHeight(90);
+    foreach($this->postfixTransportTable as $key => $entry){
+      $img = "";
+
+      if($key != 0 && $this->acl_is_writeable("postfixTransportTable")){
+        $img.= "<input type='image' src='images/sort_up.png' name='TranslationUp_".$key."' class='center'>&nbsp;";      
+      }else{
+        $img.= "<img src='images/empty.png' style='width:10px;'>";
+      }
+      if(($key+1) < count($this->postfixTransportTable) && $this->acl_is_writeable("postfixTransportTable")){
+        $img.= "<input type='image' src='images/sort_down.png' name='TranslationDown_".$key."' class='center'>&nbsp;";      
+      }else{
+        $img.= "<img src='images/empty.png' style='width:10px;'>";
+      }
+
+      if($this->acl_is_writeable("postfixTransportTable")){
+        $img.= "<input type='image' src='images/edittrash.png' name='TranslationDel_".$key."' class='center'>&nbsp;";      
+      }
+      $field1 = array("string"=> $entry['src']);
+      $field2 = array("string"=> $entry['dst']);
+      $field3 = array("string"=> $entry['prt'],"attach"=>"style='width:120px;'");
+      $field4 = array("string"=> $img, "attach"=>"style='border-right:0px;width:40px;'");
+      $divTranslation->AddEntry(array($field1,$field2,$field3,$field4,));
+    }
+    $smarty->assign("Div_postfixTransportTable" ,$divTranslation->DrawList());
+
+
+    /* Create divList for sender restrictions */
+    $DivSenderRestrict = new divSelectBox("postfixSenderRestrictions");
+    $DivSenderRestrict->SetHeight(90);
+    foreach($this->postfixSenderRestrictions as $key => $entry){
+      $img ="";
+
+      if($key != 0 && $this->acl_is_writeable("postfixSenderRestrictions")){
+        $img.= "<input type='image' src='images/sort_up.png' name='SenderRestrictUp_".$key."' class='center'>&nbsp;";      
+      }else{
+        $img.= "<img src='images/empty.png' style='width:10px;'>";
+      }
+      if(($key+1) < count($this->postfixSenderRestrictions) && $this->acl_is_writeable("postfixSenderRestrictions")){
+        $img.= "<input type='image' src='images/sort_down.png' name='SenderRestrictDown_".$key."' class='center'>&nbsp;";      
+      }else{
+        $img.= "<img src='images/empty.png' style='width:10px;'>";
+      }
+
+      if($this->acl_is_writeable("postfixSenderRestrictions")){
+        $img.= "<input type='image' src='images/edittrash.png' name='SenderRestrictDel_".$key."' class='center'>&nbsp;";     
+      }
+      $field1 = array("string"=> $entry['src']);
+      $field2 = array("string"=> $entry['dst']);
+      $field3 = array("string"=> $entry['filter'],"attach"=>"style='width:100px;'");
+      $field4 = array("string"=> $img, "attach"=>"style='border-right:0px;width:40px;'");
+      $DivSenderRestrict->AddEntry(array($field1,$field2,$field3,$field4,));
+    }
+    $smarty->assign("Div_postfixSenderRestrictions" ,$DivSenderRestrict->DrawList());
+
+
+    /* Create divList for translation tables */
+    $DivRecipientRestrict = new divSelectBox("postfixRecipientRestrictions");
+    $DivRecipientRestrict->SetHeight(90);
+
+    foreach($this->postfixRecipientRestrictions as $key => $entry){
+      $img = "";
+      if($key != 0 && $this->acl_is_writeable("postfixRecipientRestrictions")){
+        $img.= "<input type='image' src='images/sort_up.png' name='RecipientRestrictUp_".$key."' class='center'>&nbsp;";      
+      }else{
+        $img.= "<img src='images/empty.png' style='width:10px;'>";
+      }
+      if(($key+1) < count($this->postfixRecipientRestrictions) && $this->acl_is_writeable("postfixRecipientRestrictions")){
+        $img.= "<input type='image' src='images/sort_down.png' name='RecipientRestrictDown_".$key."' class='center'>&nbsp;";      
+      }else{
+        $img.= "<img src='images/empty.png' style='width:10px;'>";
+      }
+
+      if($this->acl_is_writeable("postfixRecipientRestrictions")){
+        $img.= "<input type='image' src='images/edittrash.png' name='RecipientRestrictDel_".$key."' class='center'>&nbsp;";      
+      }
+      $field1 = array("string"=> $entry['src']);
+      $field2 = array("string"=> $entry['dst']);
+      $field3 = array("string"=> $entry['filter'],"attach"=>"style='width:100px;'");
+      $field4 = array("string"=> $img, "attach"=>"style='border-right:0px;width:40px;'");
+      $DivRecipientRestrict->AddEntry(array($field1,$field2,$field3,$field4,));
+    }
+    $smarty->assign("Div_postfixRecipientRestrictions" ,$DivRecipientRestrict->DrawList());
+
+    
+    /* set new status */
+    if(isset($_POST['ExecAction'])){
+      if(isset($this->Actions[$_POST['action']])){
+        $this->setStatus($_POST['action']);
+      }
+    }
+
+
+    $smarty->assign("is_new",                       $this->dn);
+    $smarty->assign("is_acc",                       $this->initially_was_account);
+    $smarty->assign("TransportProtocols",           $this->TransportProtocols);
+    $smarty->assign("Actions",                      $this->Actions);
+    $smarty->assign("RestrictionFilters",           $this->RestrictionFilters);
+    $smarty->assign("postfixTransportTable" ,       $this->getTransports());
+    $smarty->assign("postfixSenderRestrictions" ,   $this->getSenderRestrictions());
+    $smarty->assign("postfixRecipientRestrictions" ,$this->getRecipientRestrictions());
+
+    return($smarty->fetch(get_template_path("goMailServer.tpl",TRUE,dirname(__FILE__))));
+  }
+
+  /* return transports formated for select box */ 
+  function getTransports()
+  {
+    $ret = array();
+    foreach($this->postfixTransportTable as $key => $vals){
+      $ret[$key] = $vals['src']." -> ".$vals['prt'].":".$vals['dst'];
+    }
+    return($ret);
+  }
+
+
+  /* return sender restriction formated for select box */ 
+  function getSenderRestrictions()
+  {
+    $ret = array();
+    foreach($this->postfixSenderRestrictions as $key => $vals){
+      $ret[$key] = $vals['src']." ".$vals['filter']." ".$vals['dst'];
+    }
+    return($ret);
+  }
+
+
+  /* return recipient restriction formated for select box */ 
+  function getRecipientRestrictions()
+  {
+    $ret = array();
+    foreach($this->postfixRecipientRestrictions as $key => $vals){
+      $ret[$key] = $vals['src']." ".$vals['filter']." ".$vals['dst'];
+    }
+    return($ret);
+  }
+
+
+  /* Return list entry */
+  function getListEntry()
+  {
+    $fields               = goService::getListEntry();
+    $fields['Message']    = _("Mail smtp service (Postfix)");
+    $fields['AllowEdit']  = true;
+    return($fields);
+  }
+
+
+  function save()
+  {
+    $this->postfixMyDomain   = preg_replace("/^[^\.]+\./","",$this->postfixMyhostname);
+    $this->postfixMyhostname = preg_replace("/\..*$/","",$this->postfixMyhostname);
+
+    plugin::save();
+
+    /* Fix transport table*/
+    $i = 0 ; 
+    $this->attrs['postfixTransportTable'] = array();
+    foreach($this->postfixTransportTable as $key => $entry){
+      $this->attrs['postfixTransportTable'][] = $i.": ".$entry['src']." ".$entry['prt'].":".$entry['dst'];
+      $i ++;
+    }
+
+
+    /* Fix sender restrictions */
+    $i = 0;
+    $this->attrs['postfixSenderRestrictions'] =array();
+    foreach($this->postfixSenderRestrictions as $key => $entry){
+      $this->attrs['postfixSenderRestrictions'][] = $i.": ".$entry['src']." ".$entry['filter']." ".$entry['dst']; 
+      $i ++;  
+    }
+  
+  
+    /* Fix recipient restrictions */
+    $i = 0;
+    $this->attrs['postfixRecipientRestrictions'] =array();
+    foreach($this->postfixRecipientRestrictions as $key => $entry){
+      $this->attrs['postfixRecipientRestrictions'][] = $i.": ".$entry['src']." ".$entry['filter']." ".$entry['dst']; 
+      $i ++;  
+    }
+
+
+    /* Fix mydomains */
+    $this->attrs['postfixMyDestinations']  = array();
+    foreach($this->postfixMyDestinations as $entry){
+      $this->attrs['postfixMyDestinations'][] =$entry;
+    }
+
+
+    /* Fix mydomains */
+    if(count($this->postfixMyNetworks)){
+      $this->attrs['postfixMyNetworks']  = "";
+      foreach($this->postfixMyNetworks as $entry){
+        $this->attrs['postfixMyNetworks'] .=$entry.",";
+      }
+      $this->attrs['postfixMyNetworks'] = preg_replace("/,$/","",$this->attrs['postfixMyNetworks']);
+    }else{
+      $this->attrs['postfixMyNetworks']  = array();
+    }
+
+    /* Check if this is a new entry ... add/modify */
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cat($this->dn,array("objectClass"));
+    if($ldap->count()){
+      $ldap->cd($this->dn);
+      $ldap->modify($this->attrs);
+    }else{
+      $ldap->cd($this->dn);
+      $ldap->add($this->attrs);
+    }
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving server services/mail with dn '%s' failed."),$this->dn));
+    if($this->initially_was_account){
+      $this->handle_post_events("modify");
+      new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());  
+    }else{
+      $this->handle_post_events("add");
+      new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());  
+    }
+
+  }
+
+
+  function check()
+  { 
+    $message =plugin::check();
+  
+    if(!is_numeric($this->postfixHeaderSizeLimit)){
+      $message[] = _("Please specify a numeric value for header size limit.");
+    }
+
+    if(!is_numeric($this->postfixMailboxSizeLimit)){
+      $message[] = _("Please specify a numeric value for mailbox size limit.");
+    }
+
+    if(!is_numeric($this->postfixMessageSizeLimit)){
+      $message[] = _("Please specify a numeric value for message size limit.");
+    }
+
+    return $message;
+  }
+
+
+  /* Combine new array */
+  function combineArrays($ar0,$ar1,$ar2)
+  {
+    $ret = array();
+    if(is_array($ar0))
+    foreach($ar0 as $ar => $a){
+        $ret[]=$a;
+    }
+    if(is_array($ar1))
+    foreach($ar1 as $ar => $a){
+        $ret[]=$a;
+    }
+    if(is_array($ar2))
+    foreach($ar2 as $ar => $a){
+        $ret[]=$a;
+    }
+    return($ret);
+  }
+
+
+  function getpos($atr,$attrs)
+  {
+    $i = 0;
+    foreach($attrs as $attr => $name)    {
+      $i++;
+      if($attr == $atr){
+        return($i);
+      }
+    }
+
+    return(-1);
+  }
+
+
+  /* TRansports the geiven Arraykey one position up*/
+  function ArrayUp($atr,$attrs)
+  {
+    $ret = $attrs;
+    $pos = $this->getpos($atr,$attrs) ;
+    $cn = count($attrs);
+    if(!(($pos == -1)||($pos == 1))){
+      $before = array_slice($attrs,0,($pos-2));
+      $mitte  = array_reverse(array_slice($attrs,($pos-2),2));
+      $unten  = array_slice($attrs,$pos);
+      $ret = array();
+      $ret = $this->combineArrays($before,$mitte,$unten);
+    }
+    return($ret);
+  }
+
+
+  /* TRansports the geiven Arraykey one position up*/
+  function ArrayDown($atr,$attrs)
+  {
+    $ret = $attrs;
+    $pos = $this->getpos($atr,$attrs) ;
+    $cn = count($attrs);
+    if(!(($pos == -1)||($pos == $cn))){
+      $before = array_slice($attrs,0,($pos-1));
+      $mitte  = array_reverse(array_slice($attrs,($pos-1),2));
+      $unten  = array_slice($attrs,($pos+1));
+      $ret = array();
+      $ret = $this->combineArrays($before,$mitte,$unten);
+    }
+    return($ret);
+  }
+
+  function save_object()
+  {
+    plugin::save_object();  
+  }
+
+
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);
+
+    $source_o = new goMailServer($this->config,$source['dn']);
+    foreach(array("postfixMyDomain","postfixMyhostname","postfixMyNetworks","postfixTransportTable","postfixSenderRestrictions","postfixRecipientRestrictions","postfixMyDestinations") as $attr){
+      $this->$attr = $source_o->$attr;
+    }
+  }
+
+
+  /* Return plugin informations for acl handling */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Mail smtp (Postfix)"),
+          "plDescription" => _("Mail smtp - Postfix")." ("._("Services").")",
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 98,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("server"),
+
+          "plProvidedAcls"=> array(
+            "postfixMyhostname"           => _("Visible full qualified hostname"),
+            "description"                 => _("Description"), 
+            "postfixHeaderSizeLimit"      => _("Header size limit"), 
+            "postfixMailboxSizeLimit"     => _("Max mailbox size"), 
+            "postfixMessageSizeLimit"     => _("Max message size"), 
+            "postfixMyDestinations"       => _("Domains to accept mail for"), 
+            "postfixMyNetworks"           => _("Local networks"), 
+            "postfixRelayhost"            => _("Relay host"), 
+            "postfixTransportTable"       => _("Transport table"), 
+            "postfixSenderRestrictions"   => _("Restrictions for sender"), 
+            "postfixRecipientRestrictions"=> _("Restrictions for recipient"))
+            ));
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/services/mail/goMailServer.tpl b/plugins/admin/systems/services/mail/goMailServer.tpl
new file mode 100644 (file)
index 0000000..a17d08f
--- /dev/null
@@ -0,0 +1,225 @@
+<h2><img class="center" alt="" align="middle" src="images/rightarrow.png" /> {t}Generic{/t}</h2>
+<table  style="width:100%;">
+       <tr>
+               <td width="50%" style="vertical-align:top">
+                       <table >
+                               <tr>
+                                       <td>{t}Visible full qualified hostname{/t}
+                                       </td>
+                                       <td>
+{render acl=$postfixMyhostnameACL}
+                                               <input type="text" name='postfixMyhostname' value='{$postfixMyhostname}' title='{t}The full qualified host name.{/t}'>
+{/render}
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>{t}Max mail header size{/t}
+                                       </td>
+                                       <td>
+{render acl=$postfixMyhostnameACL}
+                                               <input type="text" name='postfixHeaderSizeLimit' value='{$postfixHeaderSizeLimit}' 
+                                                                       title='{t}This value specifies the maximal header size.{/t}'>&nbsp;{t}KB{/t}
+{/render}
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>{t}Max mailbox size{/t}
+                                       </td>
+                                       <td>
+{render acl=$postfixMailboxSizeLimitACL}
+                                               <input type="text" name='postfixMailboxSizeLimit' value='{$postfixMailboxSizeLimit}' 
+                                                                       title='{t}Defines the maximal size of mail box.{/t}'>&nbsp;{t}KB{/t}
+{/render}                                      </td>
+                               </tr>
+                               <tr>
+                                       <td>{t}Max message size{/t}
+                                       </td>
+                                       <td>
+{render acl=$postfixMessageSizeLimitACL}
+                                               <input type="text" name='postfixMessageSizeLimit' value='{$postfixMessageSizeLimit}' 
+                                                                       title='{t}Specify the maximal size of a message.{/t}'>&nbsp;{t}KB{/t}
+{/render}
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>{t}Relay host{/t}
+                                       </td>
+                                       <td>
+{render acl=$postfixRelayhostACL}
+                                               <input type="text" name='postfixRelayhost' value='{$postfixRelayhost}' 
+                                                                       title='{t}Relay messages to following host:{/t}'>
+{/render}
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+               <td style="border-left:1px solid #A0A0A0; ">
+                       <table style="width:100%;">
+                               <tr>
+                                       <td>
+                                               {t}Local networks{/t}<br>
+{render acl=$postfixMyNetworksACL}
+                                               <select name='Select_postfixMyNetworks[]' multiple size=6 style='width:100%;' title='{t}Postfix networks{/t}'>
+                                                       {html_options options=$postfixMyNetworks}
+                                               </select>
+{/render}
+{render acl=$postfixMyNetworksACL}
+                                               <input type="text" name="NewString_postfixMyNetworks" value="">
+{/render}
+{render acl=$postfixMyNetworksACL}
+                                               <input type="submit" name="AddpostfixMyNetworks" value="{t}Add{/t}">
+{/render}
+{render acl=$postfixMyNetworksACL}
+                                               <input type="submit" name="DelpostfixMyNetworks" value="{t}Remove{/t}">
+{/render}
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+       </tr>
+       <tr>
+               <td colspan="2">
+                       <p class='seperator'>&nbsp;</p>
+                       <h2>{t}Domains and routing{/t}</h2>
+               </td>
+       </tr>   
+       <tr>
+               <td>
+                         <table style="width:100%;">
+                <tr>
+                    <td>
+                        {t}Domains to accept mail for{/t}<br>
+{render acl=$postfixMyDestinationsACL}
+                        <select name='Select_postfixMyDestinations[]' multiple size=6 style='width:100%;' title='{t}Postfix is responsible for the following domains:{/t}'>
+{/render}
+                            {html_options options=$postfixMyDestinations}
+                        </select>
+{render acl=$postfixMyDestinationsACL}
+                        <input type="text" name="NewString_postfixMyDestinations" value="">
+{/render}
+{render acl=$postfixMyDestinationsACL}
+                        <input type="submit" name="AddpostfixMyDestinations" value="{t}Add{/t}">
+{/render}
+{render acl=$postfixMyDestinationsACL}
+                        <input type="submit" name="DelpostfixMyDestinations" value="{t}Remove{/t}">
+{/render}
+                    </td>
+                </tr>
+            </table>
+               </td>
+               <td style="border-left:1px solid #A0A0A0; ">
+                         <table style="width:100%;">
+                <tr>
+                    <td>
+                        {t}Transports{/t}<br>
+{render acl=$postfixTransportTableACL}
+                                               {$Div_postfixTransportTable}
+{/render}
+
+{render acl=$postfixTransportTableACL}
+                        <input type="text" name="Source_postfixTransportTable" value="">
+{/render}
+{render acl=$postfixTransportTableACL}
+                        <select name='TransportProtocol' title='{t}Select a transport protocol.{/t}'>
+                            {html_options options=$TransportProtocols}
+                        </select>
+{/render}
+{render acl=$postfixTransportTableACL}
+                        <input type="text" name="Destination_postfixTransportTable" value="">
+{/render}
+{render acl=$postfixTransportTableACL}
+                        <input type="submit" name="AddpostfixTransportTable" value="{t}Add{/t}">
+{/render}
+                    </td>
+                </tr>
+            </table>
+               </td>
+       </tr>
+       <tr>
+               <td colspan="2">
+                       <p class='seperator'>&nbsp;</p>
+                       <h2>{t}Restrictions{/t}</h2>
+               </td>
+       </tr>   
+       <tr>
+               <td>
+            <table style="width:100%;">
+                <tr>
+                    <td>
+                        {t}Restrictions for sender{/t}<br>
+{render acl=$postfixSenderRestrictionsACL}
+                                               {$Div_postfixSenderRestrictions}
+{/render}
+{render acl=$postfixSenderRestrictionsACL}
+                        <input type="text" name="Source_postfixSenderRestrictions" value="">
+{/render}
+{render acl=$postfixSenderRestrictionsACL}
+                        <select name='SenderRestrictionFilter' title='{t}Restriction filter{/t}'>
+                            {html_options options=$RestrictionFilters}
+                        </select>
+{/render}
+{render acl=$postfixSenderRestrictionsACL}
+                        <input type="text" name="Destination_postfixSenderRestrictions" value="">
+{/render}
+{render acl=$postfixSenderRestrictionsACL}
+                        <input type="submit" name="AddpostfixSenderRestrictions" value="{t}Add{/t}">
+{/render}
+                    </td>
+                </tr>
+            </table>
+               </td>
+               <td style="border-left:1px solid #A0A0A0;">
+            <table style="width:100%;">
+                <tr>
+                    <td>
+                        {t}Restrictions for recipient{/t}<br>
+{render acl=$postfixRecipientRestrictionsACL}
+                                               {$Div_postfixRecipientRestrictions}
+{/render}
+{render acl=$postfixRecipientRestrictionsACL}
+                        <input type="text" name="Source_postfixRecipientRestrictions" value="">
+{/render}
+{render acl=$postfixRecipientRestrictionsACL}
+                        <select name='RecipientRestrictionFilter' title='{t}Restriction filter{/t}'>
+                            {html_options options=$RestrictionFilters}
+                        </select>
+{/render}
+{render acl=$postfixRecipientRestrictionsACL}
+                        <input type="text" name="Destination_postfixRecipientRestrictions" value="">
+{/render}
+{render acl=$postfixRecipientRestrictionsACL}
+                        <input type="submit" name="AddpostfixRecipientRestrictions" value="{t}Add{/t}">
+{/render}
+                    </td>
+                </tr>
+            </table>
+               </td>
+       </tr>   
+</table>
+
+<p class='seperator'>&nbsp;</p>
+<br>
+<h2><img class="center" alt="" src="images/rocket.png" align="middle"> Action</h2>
+{if $is_new == "new"}
+       {t}The server must be saved before you can use the status flag.{/t}
+{elseif !$is_acc}
+       {t}The service must be saved before you can use the status flag.{/t}
+{/if}
+<br>
+<select name="action" title='{t}Set new status{/t}' 
+       {if $is_new == "new" || $is_acc == false} disabled {/if}
+>
+       <option value="none">&nbsp;</option>
+       {html_options options=$Actions} 
+</select>
+<input type='submit' name='ExecAction' title='{t}Set status{/t}' value='{t}Execute{/t}' 
+       {if $is_new == "new" || $is_acc == false} disabled {/if}
+>
+
+<p class="seperator">&nbsp;</p>
+<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
+    <input type='submit' name='SaveService' value='{t}Save{/t}'>
+    &nbsp;
+    <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
+</p>
+
diff --git a/plugins/admin/systems/services/nfs/class_servNfs.inc b/plugins/admin/systems/services/nfs/class_servNfs.inc
new file mode 100644 (file)
index 0000000..1386de1
--- /dev/null
@@ -0,0 +1,267 @@
+<?php
+
+class servnfs extends plugin
+{
+  /* CLI vars */
+  var $cli_summary      = "Manage server 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("description","type","charset","path","option", "volume");
+  var $objectclasses    = array("whatever");
+  var $is_account       = true;
+
+  var $name          ="";  // Name of  
+  var $description   ="";  // description
+  var $type          ="";  // Type FS/Samba/NCP
+  var $charset       ="";  // charset
+  var $host       ="";  // hostname
+  var $types         =array();  // Array Types NFS/Samba/NCP/netatalk
+  var $charsets      =array();  // Array with charsets
+  var $path          ="";  // Path
+  var $volume        ="";  // Volume
+  var $option        ="";  // Options
+  var $is_edit           =false;
+  var $create_mount_init = false; //mount entry set for this entry (while editing)?
+  var $create_mount = false; //save mount entry
+
+  var $parent       = NULL;
+  var $view_logged  = FALSE;
+
+  function servnfs (&$config, $parent,$entry= false,$mount =false)
+  {
+    $this->parent = $parent;
+    $dn = $parent->dn;
+    plugin::plugin ($config, $dn);
+
+    $this->types   = array("CIFS" => "CIFS", "NFS"=>"NFS","samba"=>"samba","netatalk"=>"netatalk","NCP"=>"NCP");
+    if($dn){
+      $this->host = substr($dn, 3, strpos($dn, ',')-3);
+    }
+
+    $this->charsets = array();
+
+    if(!file_exists(CONFIG_DIR."/encodings")){
+      print_red(sprintf(_("The file '%s/encodings' does not exist, can't get supported charsets."),CONFIG_DIR));
+    }else{
+      if(!is_readable(CONFIG_DIR."/encodings")){
+        print_red(sprintf(_("Can't read '%s/encodings', please check permissions."),CONFIG_DIR));
+      }else{
+        $fp = fopen(CONFIG_DIR."/encodings","r");
+        $i = 100;
+        while(!feof($fp)&&$i){
+          $i -- ;
+          $str = trim(fgets($fp,256));
+
+          /* Skip comments */
+          if(!preg_match("/^#/",$str)){
+            $arr = split("\=",$str);
+            if(count($arr)==2){
+              $this->charsets[$arr[0]]=$arr[1];
+            }
+          }
+        }
+      }
+    }
+
+    if($entry){
+      list($this->name, $this->description, $this->type, $this->charset,
+          $this->path, $this->option, $this->volume)= split("\|",$entry."|");
+      $this->is_edit          = true;
+
+    }else{
+      $this->attributes[] = "name";
+    }
+
+
+    $this->create_mount_init = $mount;
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","server/".get_class($this),$this->dn);
+    }
+
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+
+    $smarty->assign("charsets" ,$this->charsets);
+    $smarty->assign("types"    ,$this->types);
+
+    /* attrs to smarty*/
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr,$this->$attr);
+    }
+
+    $tmp = $this->parent->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->parent->getacl($name));
+    }
+
+    $smarty->assign("name",$this->name);
+    if($this->is_edit){
+      $smarty->assign("nameACL", preg_replace("/w/","",$this->parent->getacl("name")));
+    } 
+    $smarty->assign("allow_mounts", $this->parent->allow_mounts);
+    $smarty->assign("mount_checked", "");
+
+    $smarty->assign("appleMountsACL",    $this->getacl("appleMounts"));
+
+    if (($this->type == "netatalk") || ($this->type == "NFS")) {
+      if ($this->create_mount_init) {
+        $smarty->assign("mount_checked", "checked");
+      } else {
+        $tmp = split(",", $this->dn);
+        $clip = $tmp[0] . ",ou=servers,ou=systems,";
+        $mountsdn = "cn=mounts," . substr($this->dn, strlen($clip));
+        switch ($this->type) {
+          case "netatalk" : {
+            $mountdn = "cn=".$this->host.":/".$this->name.",".$mountsdn;
+            break;
+          }
+          case "NFS" : {
+            $mountdn = "cn=".$this->host.":".$this->path.",".$mountsdn;
+            break;
+          }
+          default : {
+                      continue;
+                    }
+        }
+        $ldap = $this->config->get_ldap_link();
+        $ldap->cat($mountdn, array('dn'));
+        $attrs = $ldap->fetch();
+        if (count($attrs) > 0) {
+          $smarty->assign("mount_checked", "checked");
+        }
+      }        
+    }
+
+    $display= $smarty->fetch(get_template_path('servnfs.tpl', TRUE));
+    return($display);
+  }
+
+  function remove_from_parent()
+  {
+    /* This cannot be removed... */
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    if(isset($_POST['servnfs_posted'])){
+
+      foreach($this->attributes as $name){
+        if($this->parent->acl_is_writeable($name) && isset($_POST[$name])){
+          $this->$name = $_POST[$name];
+        }
+      }
+
+      if ((isset($_POST['netatalk_mount'])) && (($this->type == "netatalk") || ($this->type == "NFS"))) {
+        $this->create_mount = true;
+      } else {
+        $this->create_mount = false;
+      }
+    }
+  }
+
+
+  /* Check supplied data */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    // fixme : a check for the path ?  ? 
+    if(empty($this->path)){
+      $message[]=_("Please specify a valid path for your setup.");
+    }
+
+    // only 0-9a-z
+    if(!$this->is_edit){
+      if(!preg_match("/^[a-z0-9\._äüö]*$/ui",$this->name)){
+        $message[]=_("Please specify a valid name for your share.");
+      }
+      if(empty($this->name)){
+        $message[]=_("Please specify a name for your share.");
+      }
+    }
+
+    if(!empty($this->description) && preg_match("/^[^a-z0-9\._äüö\+ -]*$/ui",$this->description)){
+      $message[]=_("Description contains invalid characters.");
+    }
+
+    if(!empty($this->volume) && preg_match("/^[^a-z0-9\._äüö\+ -]*$/ui",$this->volume)){
+      $message[]=_("Volume contains invalid characters.");
+    }
+
+    if(preg_match("/\|/",$this->path)){
+      $message[]=_("Path contains invalid characters.");
+    }
+
+    if(!empty($this->option) && preg_match("/^[^a-z0-9\._äüö,=\+ -]*$/ui",$this->option)){
+      $message[]=_("Option contains invalid characters.");
+    }
+
+    /* remove a / at the end of the path, we neither need it there nor
+     * do we want to check for it later.
+     */
+    if(substr($this->path, -1, 1) == '/') {
+      $this->path=substr($this->path, 0, -1);
+    }
+
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(objectClass=goShareServer)", array("goExportEntry"));
+    while($test = $ldap->fetch()){
+      if($test['dn']==$this->dn)
+        continue;
+      if(isset($test['goExportEntry'])){
+        foreach($test['goExportEntry'] as $entry){
+          $tmp = split("\|",$entry);
+          if($tmp[0] == $this->name){
+            $message[]="Name already in use";
+          }
+        }
+      }
+    }
+    return ($message);
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    /* Everything seems perfect, lets 
+       generate an new export Entry 
+     */
+
+    $s_return = "";
+
+    $s_return.= $this->name."|";     
+    $s_return.= $this->description."|";     
+    $s_return.= $this->type."|";     
+    $s_return.= $this->charset."|";     
+    $s_return.= $this->path."|";     
+    $s_return.= $this->option."|";     
+    $s_return.= $this->volume;     
+
+    return(array($this->name=>$s_return));
+  }
+
+  function should_create_mount() {
+    return $this->create_mount;
+  }
+
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/services/nfs/servnfs.tpl b/plugins/admin/systems/services/nfs/servnfs.tpl
new file mode 100644 (file)
index 0000000..9fb70a5
--- /dev/null
@@ -0,0 +1,144 @@
+<h2><img class="center" alt="" src="images/fai_partitionTable.png" align="middle">&nbsp;{t}Edit share{/t}</h2>
+<table summary="{t}NFS setup{/t}" width="100%">
+       <tr>
+               <td width="45%" style="vertical-align:top">
+               <!--Table left-top-->
+                       <table summary="">
+                               <tr>
+                                       <td>
+                                               {t}Name{/t} {$must}
+                                       </td>
+                                       <td>
+{render acl=$nameACL}
+                                               <input type="text" name="name" value="{$name}" >
+{/render}
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>
+                                               {t}Description{/t}
+                                       </td>
+                                       <td>
+{render acl=$descriptionACL}
+                                               <input type="text" size="40" name="description" value="{$description}">
+{/render}
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>
+                                               {t}Path{/t} / {t}Volume{/t}
+                                       </td>
+                                       <td>
+{render acl=$pathACL}
+                                               <input type="text" size="40" name="path" value="{$path}">
+{/render}
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>
+                                               <div id="vlabel">{t}Server{/t}</div>
+                                       </td>
+                                       <td>
+{render acl=$volumeACL}
+                                               <input type="text" id="volume" size="40" name="volume" value="{$volume}">
+{/render}
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+               <td style="border-left:1px solid #A0A0A0">
+
+               <!--Table right-top-->
+                       <table summary="">
+                               <tr>
+                                       <td style="vertical-align:top">
+
+                                               {t}Type{/t}
+                                       </td>
+                                       <td>
+{render acl=$typeACL}
+                                               <select size="1" name="type" id="sharetype">
+                                                       {html_options options=$types selected=$type}
+                                               </select>
+{/render}
+                                               {if $allow_mounts == TRUE}
+                                               <br><br>
+{render acl=$netatalkmountACL}
+                                               <input type="checkbox" name="netatalk_mount" id="netatalk_mount" {$mount_checked} />
+{/render}
+                                               <label for="netatalk_mount">{t}Auto-mount share on Apple systems{/t}</label>
+                                                       <br>
+                                                       <br>
+                                               {/if}
+
+                                                               {literal}
+                                                                       <script language="JavaScript">
+                                                                               document.getElementById('sharetype').onchange=function() {
+                                                                                       var foobar=this[this.selectedIndex].value;
+                                                                                       var box=document.getElementById('netatalk_mount');
+                                                                                       var volume=document.getElementById('volume');
+                                                                                       var vlabel=document.getElementById('vlabel');
+                                                               {/literal}
+                                                                       <!-- Only add checkbox enable/disable js part if checkbox is available --> 
+                                                                       {if $allow_mounts == TRUE}
+                                                                               {literal}
+                                                                                       if(foobar=="NFS"||foobar=="netatalk"){
+                                                                                               box.disabled=false;
+                                                                                       } else {
+                                                                                               box.disabled=true;
+                                                                                               box.checked=false;
+                                                                                       }
+                                                                               {/literal}
+                                                                       {/if}
+                                                               {literal}
+                                                                                       if(foobar=="NCP"){
+                                                                                               volume.style.visibility="visible";
+                                                                                               vlabel.style.visibility="visible";
+                                                                                       } else {
+                                                                                               volume.style.visibility="hidden";
+                                                                                               vlabel.style.visibility="hidden";
+                                                                                       }
+                                                                               };
+                                                                               document.getElementById('sharetype').onchange();
+                                                                       </script>
+                                                               {/literal}
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>
+                                               {t}Codepage{/t}
+                                       </td>
+                                       <td>
+{render acl=$charsetACL}
+                                               <select size="1" name="charset">
+                                                       {html_options options=$charsets selected=$charset}
+                                               </select>       
+{/render}
+                                       </td>
+                               </tr>
+                               <tr>
+                                   <td>
+                                       {t}Option{/t}
+                                   </td>
+                                   <td>
+{render acl=$optionACL}
+                                                               <input type="text" name="option" value="{$option}">
+{/render}
+                                   </td>
+                               </tr>
+                       </table>
+               </td>
+       </tr>
+       <tr>
+               <td colspan=2>
+                       <p class="seperator">&nbsp;</p>
+               </td>
+       </tr>
+       <tr>
+               <td colspan=2 style="text-align:right">
+                       <input type="submit" name="NFSsave" value="{t}Save{/t}">
+                       <input type="submit" name="NFScancel" value="{t}Cancel{/t}">
+               </td>
+       </tr>
+</table>
+<input type='hidden' name='servnfs_posted' value='1'>
diff --git a/plugins/admin/systems/services/ntp/class_goNtpServer.inc b/plugins/admin/systems/services/ntp/class_goNtpServer.inc
new file mode 100644 (file)
index 0000000..b179ae9
--- /dev/null
@@ -0,0 +1,147 @@
+<?php
+
+class goNtpServer extends goService{
+
+  var $cli_summary      = "This pluign is used within the ServerService Pluign \nand indicates that this server supports NTP service.";
+  var $cli_description  = "Some longer text\nfor help";
+  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* This plugin only writes its objectClass */
+  var $objectclasses    = array("goNtpServer");
+  var $attributes       = array("goTimeSource");
+  var $StatusFlag       = "goNtpServerStatus";
+
+  /* This class can't be assigned twice so it conflicts with itsself */
+  var $conflicts        = array("goNtpServer");
+
+  var $DisplayName      = "";
+  var $dn               = NULL;
+  var $goTimeSource     = array();
+  var $goNtpServerStatus= "";
+  var $acl;
+  var $cn               = "";
+  var $view_logged  =FALSE;
+
+  function goNtpServer(&$config,$dn)
+  {
+    goService::goService($config,$dn);
+    $this->DisplayName = _("Time service (NTP)");
+
+    /* Load arrays */
+    $tmp = array();
+    if (isset($this->attrs['goTimeSource'])){
+      for ($i= 0; $i<$this->attrs['goTimeSource']['count']; $i++){
+        $tmp[$this->attrs['goTimeSource'][$i]]= $this->attrs['goTimeSource'][$i];
+      }
+    }
+    $this->goTimeSource= $tmp;
+  }
+
+
+  function execute()
+  { 
+    $smarty = get_smarty(); 
+
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","server/".get_class($this),$this->dn);
+    }
+
+    /* Here we add a new entry  */
+    if(isset($_POST['NewNTPAdd']) && $_POST['NewNTPExport'] != "" && $this->acl_is_writeable("goTimeSource")) {
+      $this->goTimeSource[$_POST['NewNTPExport']]= $_POST['NewNTPExport'];
+      asort($this->goTimeSource);
+    }
+
+    /* Deleting an Entry, is a bit more complicated than adding one*/
+    if((isset($_POST['DelNTPEnt'])) && (isset($_POST['goTimeSource'])) && $this->acl_is_writeable("goTimeSource")) {
+      foreach ($_POST['goTimeSource'] as $entry){
+        if (isset($this->goTimeSource[$entry])){
+          unset($this->goTimeSource[$entry]);
+        }
+      }
+    }
+
+    $smarty->assign("goNtpServerACL", $this->getacl("goNtpServer")) ;
+    $smarty->assign("goTimeSource" , $this->goTimeSource); 
+    return($smarty->fetch(get_template_path("goNtpServer.tpl",TRUE,dirname(__FILE__))));
+  }
+
+
+  function getListEntry()
+  {
+    $fields               = goService::getListEntry();
+    $fields['Message']    = _("Time service (NTP)");
+    $fields['AllowEdit']  = true;
+    return($fields);
+  }
+
+
+  function save()
+  {
+    plugin::save();
+    $this->attrs['goTimeSource'] =array();
+    foreach($this->goTimeSource as $entry){
+      $this->attrs['goTimeSource'][] = $entry;
+    }
+    /* Check if this is a new entry ... add/modify */
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cat($this->dn,array("objectClass"));
+    if($ldap->count()){
+      $ldap->cd($this->dn);
+      $ldap->modify($this->attrs);
+    }else{
+      $ldap->cd($this->dn);
+      $ldap->add($this->attrs);
+    }
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving server services/goNtpServer with dn '%s' failed."),$this->dn));
+    if($this->initially_was_account){
+      $this->handle_post_events("modify");
+      new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      $this->handle_post_events("add");
+      new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
+  }
+
+
+  /* Return plugin informations for acl handling */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Time service"),
+          "plDescription" => _("Time service - NTP")." ("._("Services").")",
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 91,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("server"),
+
+          "plProvidedAcls"=> array(
+            "goTimeSource"        =>_("Ntp source"))
+          ));
+  }
+
+  
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);
+
+    /* Load arrays */
+    $tmp = array();
+    if (isset($source['goTimeSource'])){
+      for ($i= 0; $i<$source['goTimeSource']['count']; $i++){
+        $tmp[$source['goTimeSource'][$i]]= $source['goTimeSource'][$i];
+      }
+    }
+    $this->goTimeSource= $tmp;
+
+
+  }
+
+  function check(){ return array();}
+
+  function save_object(){;}
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/services/ntp/goNtpServer.tpl b/plugins/admin/systems/services/ntp/goNtpServer.tpl
new file mode 100644 (file)
index 0000000..25a91d4
--- /dev/null
@@ -0,0 +1,32 @@
+<br>
+<h2>{t}Time server{/t}</h2>
+<br>
+<table summary="" style="width:100%">
+<tr>
+ <td>
+{render acl=$goNtpServerACL}
+       <select style="width:100%;" id="goTimeEntry" name="goTimeSource[]" size=8 multiple>
+               {html_options values=$goTimeSource output=$goTimeSource}
+               <option disabled>&nbsp;</option>
+       </select>
+{/render}
+<br>
+{render acl=$goNtpServerACL}
+       <input type="text" name="NewNTPExport"  id="NewNTPExportId">
+{/render}
+{render acl=$goNtpServerACL}
+       <input type="submit"    value="{t}Add{/t}"      name="NewNTPAdd"  id="NewNTPAddId">
+{/render}
+{render acl=$goNtpServerACL}
+       <input type="submit"    value="{t}Delete{/t}"   name="DelNTPEnt"  id="DelNTPEntId">
+{/render}
+</td>
+</tr>
+</table>
+
+<p class="seperator">&nbsp;</p>
+<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
+       <input type='submit' name='SaveService' value='{t}Save{/t}'>
+       &nbsp; 
+       <input type='submit' name='CancelService' value='{t}Cancel{/t}'> 
+</div>
diff --git a/plugins/admin/systems/services/repository/class_servRepository.inc b/plugins/admin/systems/services/repository/class_servRepository.inc
new file mode 100644 (file)
index 0000000..10321c0
--- /dev/null
@@ -0,0 +1,366 @@
+<?php
+
+class servrepository extends goService
+{
+  /* 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("FAIrepository");
+  var $objectclasses          = array("FAIrepositoryServer");
+  
+  /* Repositories */
+  var $repositories          = array();
+  var $FAIrepository         = array();
+  var $conflicts             = array("FAIrepositoryServer");
+  var $DisplayName           = "";
+  var $StatusFlag            = "";
+  
+  var $view_logged            = FALSE;
+  var $fai_activated          = FALSE;
+
+  var $divlist = NULL;
+
+  function servrepository (&$config, $dn= NULL, $parent= NULL)
+  {
+    plugin::plugin ($config, $dn, $parent);
+
+    $this->DisplayName = _("Repository service");
+
+    /* Skip this if fai is deactivated */
+    $tmp= $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
+    if(!empty($tmp)){
+      $this->fai_activated = TRUE;    
+    }else{
+      return;
+    }
+
+    $this->repositories = array();
+    if(isset($this->attrs['FAIrepository'])){
+      for($i = 0; $i < $this->attrs['FAIrepository']['count']; $i++){
+        $tmp = split("\|",$this->attrs['FAIrepository'][$i]);
+        $tmp2 = array();  
+        $tmp3 = array();   
+
+        if(isset($tmp[1])){
+          $tmp2['ParentServer'] = $tmp[1];
+          if(empty($tmp[1])){
+            $tmp2['ParentServer'] = "none";
+          }
+        }else{
+          $tmp2['ParentServer'] = "none";
+        }
+
+        if(isset($tmp[0])){
+          $tmp2['Url']          = $tmp[0];
+        }else{
+          $tmp2['Url']          = "";
+        }
+  
+        if(isset($tmp[2])){
+          $tmp2['Release']      = $tmp[2];
+        }else{
+          $tmp2['Release']      = "";
+        }
+
+        if(isset($tmp[3])){
+          $tmp3 = split(",",$tmp[3]);
+          foreach($tmp3 as $sec){
+            $tmp2['Sections'][$sec]=$sec;
+          }    
+        }else{
+          $tmp['Section']=array();
+        }
+
+        $this->repositories[$tmp[2]]=$tmp2;      
+      }
+    }
+
+
+    /* Create divlist */
+    $this->divlist = new divListRepository($this->config,$this);
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","server/".get_class($this),$this->dn);
+    }
+
+    if(!$this->fai_activated){
+      $str = "<h2>"._("You can't use this plugin until FAI is activated.")."</h2>";
+      return $str;
+    }
+
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+    $smarty->assign("is_createable",$this->acl_is_createable());
+    $display= "";
+
+    /* Show tab dialog headers */
+    /*
+       ADD / EDIT Repository
+       Dialog Handling
+     */
+    $once = false;
+    if(isset($_POST['servRepository'])){
+      foreach($_POST as $name => $value){
+
+        if(preg_match("/AddRepository/",$name) && $this->acl_is_createable()){
+          $once = true;
+          $this->dialog = new servRepositorySetup($this->config,$this->dn);
+          $this->dialog->parent = $this;
+        }
+
+        if((preg_match("/^delete_/",$name)) && (!$once) && $this->acl_is_removeable()){
+          $once = true;
+          $value = preg_replace("/delete_/","",$name);
+          $value = base64_decode(preg_replace("/_.*$/","",$value));
+
+          $url = $this->repositories[$value]['Url'];
+          $release = $this->repositories[$value]['Release'];
+
+          $ldap = $this->config->get_ldap_link();
+          $ldap->cd ($this->config->current['BASE']);
+
+          $ldap->search("(&(objectClass=gotoWorkstation)(objectClass=FAIobject)(FAIdebianMirror=".$url."))",array("cn","FAIclass"));
+
+          $found = false;
+          $found_in = " ";
+          while($attrs = $ldap->fetch()){
+            foreach($attrs['FAIclass'] as $class){
+              if(preg_match("/".str_replace("/","\/",$release)."$/i",$class)){
+                $found = true;  
+                $found_in .= $attrs['cn'][0]." ";
+              }
+            }
+          }
+
+          if($found){
+            print_red(sprintf(_("You can't delete this release, it is still used by these workstations [%s]. Please solve this dependencies first, to keep data base consistency."),$found_in));
+          }else{
+            if(isset($this->repositories[$value])){
+              unset($this->repositories[$value]);
+            }
+          }
+        }
+
+        if((preg_match("/^edit_/",$name))&&(!$once)){
+          $value = preg_replace("/edit_/","",$name);
+          $value = base64_decode(preg_replace("/_.$/","",$value));
+
+          if(isset($this->repositories[$value])){
+
+            $ldap = $this->config->get_ldap_link();
+            $ldap->cd ($this->config->current['BASE']);
+
+            $url = $this->repositories[$value]['Url'];
+            $release = $this->repositories[$value]['Release'];
+
+            $ldap->search("(&(objectClass=gotoWorkstation)(objectClass=FAIobject)(FAIdebianMirror=".$url."))",array("cn","FAIclass"));
+
+            $found = false;
+            $found_in = " ";
+            while($attrs = $ldap->fetch()){
+              foreach($attrs['FAIclass'] as $class){
+                if(preg_match("/".str_replace("/","\/",$release)."$/i",$class)){
+                  $found = true;
+                  $found_in .= $attrs['cn'][0]." ";
+                }
+              }
+            }
+
+            if($found){
+              print_red(sprintf(_("Be careful editing this release, it is still used by these workstations [%s]."),$found_in));
+            } 
+
+            if(isset($this->repositories[$value])){
+              $once = true;
+              $obj = $this->repositories[$value];
+
+              /* to be able to detect if this was renamed */
+              $obj['initialy_was'] = $obj['Release'];
+              $this->dialog = new servRepositorySetup($this->config,$this->dn,$obj);
+              $this->dialog->parent = $this;
+            }
+          }
+        }
+      }
+    }
+    if((isset($_GET['act']))&&($_GET['act']=="open_repository")&&(isset($_GET['id']))){
+      $obj = $this->repositories[base64_decode($_GET['id'])];
+      $obj['initialy_was'] = $obj['Release'];
+      $this->dialog = new servRepositorySetup($this->config,$this->dn,$obj);
+      $this->dialog->parent = $this;
+    }
+
+    if(isset($_POST['repository_setup_save']) && is_object($this->dialog)){
+      $this->dialog->save_object();
+      if(($this->dialog->is_new_name())&&(isset($this->repositories[$this->dialog->GetName()]))){
+        print_red(_("This name is already in use."));
+      }else
+
+      if(count($this->dialog->check())!=0){
+        foreach($this->dialog->check() as $msg){
+          print_red($msg);
+        }
+      }else{
+        $obj = $this->dialog->save();
+        if($this->dialog->is_new_name()){
+          $oldname = $this->dialog->initialy_was;
+          $this->repositories[$obj['Release']]=$obj;        
+          unset($this->repositories[$oldname]);
+        }else{ 
+          $this->repositories[$obj['Release']]=$obj;        
+        }
+        $this->dialog = FALSE;
+        $this->is_dialog= false;
+      }
+    }
+
+    if(isset($_POST['repository_setup_cancel'])){
+      $this->dialog=FALSE;
+      $this->is_dialog = false;
+    }
+   
+    if(is_object($this->dialog)){
+      $this->dialog->save_object();
+      $this->is_dialog = true;
+      return($this->dialog->execute());
+    }
+
+    /*
+      Repository setup dialog handling /END
+    */
+
+
+    $link   = "<a href='?plug=".$_GET['plug']."&amp;act=open_repository&amp;id=%s'>%s</a>";
+    $edit   = "<input type='image' value='%s' name='edit_%s'   src='images/edit.png'>&nbsp;";
+   
+    /* Hide delete icon, if delete is not allowed */ 
+    if($this->acl_is_removeable()){
+      $delete = "<input type='image' value='%s' name='delete_%s' src='images/edittrash.png'>";
+    }else{
+      $delete = "<img src='images/empty.png' alt='&nbsp;'>";
+    }
+
+    $this->divlist->execute(); 
+    $this->divlist->setEntries($this->repositories);
+    $smarty->assign("Repositories",$this->divlist->Draw());
+    $display.= $smarty->fetch(get_template_path('servRepository.tpl', TRUE));
+    return($display);
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    plugin::save_object();
+    if(is_object($this->divlist)){
+      $this->divlist->save_object();
+    }
+  }
+
+
+  /* Check supplied data */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+    return ($message);
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    if(!$this->fai_activated) return;
+
+    plugin::save();
+
+    $arr = array();
+    foreach($this->repositories as $servername => $conf){
+      $str = "";
+      foreach($conf['Sections'] as $sec){
+        $str.=$sec.",";
+      }
+      $str=preg_replace("/,$/","",$str);
+        
+      if($conf['ParentServer']=="none"){
+        $conf['ParentServer'] ="";
+      }    
+    
+      $arr[]=$conf['Url']."|".$conf['ParentServer']."|".$conf['Release']."|".$str;
+    }
+    $this->attrs['FAIrepository'] = $arr;
+
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd ($this->config->current['BASE']);
+    
+    $ldap->cat($this->dn, array('dn'));
+    
+    if($ldap->count()){
+      $ldap->cd($this->dn);
+      $this->cleanup();
+      $ldap->modify ($this->attrs);       
+
+      $this->handle_post_events("modify");
+    }else{
+      $ldap->cd ($this->config->current['BASE']);
+      $ldap->create_missing_trees($this->dn);
+      $ldap->cd($this->dn);
+      $ldap->add($this->attrs);
+      $this->handle_post_events("add");
+    }
+
+    if($this->initially_was_account){
+      new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
+  }
+
+
+  function getListEntry()
+  {
+    $fields = goService::getListEntry();
+    $fields['Message']    = _("Repository service");
+    $fields['AllowEdit']  = true;
+    $fields['AllowStart'] = $fields['AllowStop'] = $fields['AllowRestart'] = false;
+    return($fields);
+  }
+
+  /* Return plugin informations for acl handling */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Repository"),
+          "plDescription" => _("Repository service")." ("._("Services").")",
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 84,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("server"),
+
+          "plProvidedAcls"=> array(
+              "cn"            => _("Name"),
+              "start"         => _("Start"),
+              "stop"          => _("Stop"),
+              "restart"       => _("Restart"),
+              "Release"       => _("Releases"),
+              "Section"       => _("Sections"),
+              "ParentServer"  => _("Parent server"),
+              "Url"           => _("Url"))
+            ));
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/services/repository/class_servRepositorySetup.inc b/plugins/admin/systems/services/repository/class_servRepositorySetup.inc
new file mode 100644 (file)
index 0000000..40f37b0
--- /dev/null
@@ -0,0 +1,225 @@
+<?php
+
+class servRepositorySetup  extends plugin
+{
+  /* CLI vars */
+  var $cli_summary        = "Manage FAI repositories";
+  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("Release","ParentServer","Url","cn");
+  var $objectclasses    = array("whatever");
+
+  /* Attributes */
+  var $Release          = "";
+  var $ParentServer     = "";
+  var $Url              = "";   
+  var $Sections         = array();
+  var $ParentServers    = "";
+  var $initialy_was     = false;
+  var $cn               = "";
+  var $parent           = "";
+
+  function servRepositorySetup (&$config, $dn= NULL,$data = false)
+  {
+    plugin::plugin ($config, $dn);
+    if($data != false){
+      foreach(array("Sections","Release","Url","ParentServer","initialy_was") as $atr){
+        if(isset($data[$atr])){
+          $this->$atr = $data[$atr];
+        }
+      }
+    }
+  }
+
+  function GetName()
+  {
+    return($this->Release);
+  }
+  
+  function is_new_name()
+  {
+    if(!$this->initialy_was){
+      return(true);
+    }else{
+      if($this->Release != $this->initialy_was){
+        return(true);
+      }
+    }
+    return(false);
+  }
+
+  
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+
+    if((isset($_POST['AddSection']))&&(isset($_POST['SectionName']))&&(!empty($_POST['SectionName']))){
+
+      /* Replace multiple spaces with a single, and cut of white spaces (trim)*/
+      $val = preg_replace("/\ \ * /" , " ", trim($_POST['SectionName']));
+
+      /* check if there are more than one entry given ( "section1 section2 )*/
+      if(preg_match("/ /",$val)){
+
+        /* Generate list of new section names */
+        $vals = split(" ",$val);
+
+        /* Add new entries */
+        foreach($vals as $entry){
+          $entry = trim($entry);
+          $this->Sections[$entry]=$entry;
+        }
+      }else{
+        $this->Sections[$val]=$val;
+      }
+    }
+    
+    foreach($_POST as $name => $value){
+      if(preg_match("/^delete_/",$name)){
+
+        $val = preg_replace("/^delete_/","",$name);
+        $val = base64_decode(preg_replace("/_.*$/","",$val));
+
+        if(isset($this->Sections[$val])){
+          unset($this->Sections[$val]);
+        }
+      }
+    }
+
+    $divlist = new divSelectBox("servRepositorySetup");
+    $divlist->setHeight("220");
+
+    $dellink = "<input type='image' src='images/edittrash.png' title='delete' alt='delete' name='delete_%s' value='%s'>";
+
+    foreach($this->Sections as $sec){
+      $divlist->AddEntry(array(
+                              array("string"=>$sec),
+                              array("string"=>sprintf($dellink,base64_encode($sec),$sec),"attach"=>"style='border-right:0px;width:20px;'")
+                              ));
+    }
+  
+    $smarty->assign("Sections",$divlist->DrawList());
+
+    /* Get && assign acls */
+    $tmp = $this->parent->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translated){
+      $smarty->assign($name."ACL",$this->parent->getacl($name));
+    }
+
+    /* Assign values */
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr       ,$this->$attr);
+    }
+  
+    $tmp = $this->getParentServers();
+    $smarty->assign("ParentServers"   ,$tmp);
+    $smarty->assign("ParentServerKeys",array_flip($tmp));
+
+    return($smarty->fetch(get_template_path('servRepositorySetup.tpl', TRUE)));
+  }
+
+  /* Save data to object */
+  function save_object()
+  {
+    if(isset($_POST['servRepositorySetup_Posted'])) {
+  
+      foreach($this->attributes as $attr){
+        if(($this->parent->acl_is_writeable($attr)) && (isset($_POST[$attr]))){
+          $this->$attr = $_POST[$attr];      
+        }
+      }
+    }
+  }
+
+
+  /* Check supplied data */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    if(empty($this->Release)){
+      $message[]=_("Please enter a value for 'release'.");
+    }
+
+    if(empty($this->Url)){
+      $message[] = _("Please specify a valid value for 'url'.");
+    }
+
+    return ($message);
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    $tmp = array();
+    $tmp['ParentServer']  = $this->ParentServer;
+    $tmp['Url']           = $this->Url;
+    $tmp['Release']       = $this->Release;
+    $tmp['Sections']      = $this->Sections;
+    return($tmp);
+  }
+
+  function getParentServers()
+  {
+    $ret = array();
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(objectClass=FAIrepositoryServer)",array("*"));
+    while($attr = $ldap->fetch()){
+      if($attr['cn'][0] == $this->cn) continue;
+      $ret[$attr['cn'][0]]= $attr['cn'][0];   
+    }
+
+    $ret = array_merge($ret,$this->GetHookElements());
+    
+    $ret['none']= "&nbsp;";
+    asort($ret);
+    return($ret);
+  }
+
+  /* this funtions calls a defined hook 
+      and parses all additional serverdata 
+   */
+  function GetHookElements()
+  {
+    $ret = array();
+    $cmd = $this->config->search("servrepository", "REPOSITORY_HOOK",array('tabs'));
+    if(!empty($cmd)){
+      $res = shell_exec($cmd);
+      $res2 = trim($res);
+      if(!$res){
+        print_red(sprintf(_("Can't execute specified REPOSITORY_HOOK '%s'. Please check your gosa.conf."),$cmd));
+      }elseif(empty($res2)){
+        print_red(sprintf(_("The specified REPOSITORY_HOOK '%s', specified in your gosa.conf, returns an empty string."),$cmd));
+      }else{  
+        $tmp = split("\n",$res);
+        foreach($tmp as $hook){
+          /* skip empty */
+          if(empty($hook)) continue;
+
+          if(preg_match("/;/",$hook)){ 
+            $hookinfo = split(";",$hook);
+            $ret[$hookinfo[0]] = $hookinfo[0];
+          }else{
+            $ret[$hook] = $hook;
+          }
+        }
+      }
+    }
+    return($ret);
+  }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/services/repository/servRepository.tpl b/plugins/admin/systems/services/repository/servRepository.tpl
new file mode 100644 (file)
index 0000000..ca42710
--- /dev/null
@@ -0,0 +1,9 @@
+{$Repositories}
+<input type="hidden" name="servRepository" value="1">
+
+<p class="seperator">&nbsp;</p>
+<div style="width:100%; text-align:right;">
+       <input type='submit' name='SaveService' value='{t}Save{/t}'>
+       &nbsp; 
+       <input type='submit' name='CancelService' value='{t}Cancel{/t}'> 
+</div>
diff --git a/plugins/admin/systems/services/repository/servRepositorySetup.tpl b/plugins/admin/systems/services/repository/servRepositorySetup.tpl
new file mode 100644 (file)
index 0000000..29691ec
--- /dev/null
@@ -0,0 +1,58 @@
+<h2><img src="images/fai_small.png" alt=''>&nbsp;{t}Repository{/t}</h2>
+
+<table width="100%" summary=''>
+       <tr>
+               <td width="50%" valign="top" style="border-right:1px solid #A0A0A0">
+                       <table summary=''>
+                               <tr>
+                                       <td>{t}Parent server{/t}
+                                       </td>
+                                       <td>
+{render acl=$ParentServerACL}
+                                               <select name="ParentServer">
+                                                       {html_options options=$ParentServers values=$ParentServerKeys selected=$ParentServer} 
+                                               </select>
+{/render}
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>{t}Release{/t}
+                                       </td>
+                                       <td>
+{render acl=$ReleaseACL}
+                                               <input type="text" value="{$Release}" name="Release">
+{/render}
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>{t}URL{/t}
+                                       </td>
+                                       <td>
+{render acl=$UrlACL}
+                                               <input type="text" size="40" value="{$Url}" name="Url">
+{/render}
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+               <td>
+                       {t}Sections{/t}<br>
+{render acl=$SectionACL}
+                       {$Sections}
+{/render}
+{render acl=$SectionACL}
+                       <input type="text"      name="SectionName" value="" style='width:100%;'>
+{/render}
+{render acl=$SectionACL}
+                       <input type="submit"    name="AddSection"  value="{t}Add{/t}">
+{/render}
+               </td>
+       </tr>
+</table>
+<input type='hidden' name='servRepositorySetup_Posted' value='1'>
+<p class="plugbottom">
+  <input type=submit name="repository_setup_save" value="{t}Apply{/t}">
+  &nbsp;
+  <input type=submit name="repository_setup_cancel" value="{t}Cancel{/t}">
+</p>
+
diff --git a/plugins/admin/systems/services/shares/class_goShareServer.inc b/plugins/admin/systems/services/shares/class_goShareServer.inc
new file mode 100644 (file)
index 0000000..354d780
--- /dev/null
@@ -0,0 +1,409 @@
+<?php
+
+class goShareServer extends goService{
+
+  var $cli_summary      = "This plugin is used within the ServerService Pluign \nand indicates that this server supports shares.";
+  var $cli_description  = "Some longer text\nfor help";
+  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* This plugin only writes its objectClass */
+  var $objectclasses    = array("goShareServer");
+  var $attributes       = array("goExportEntry");
+  var $StatusFlag       = "goShareServerStatus";
+
+  /* This class can't be assigned twice so it conflicts with itsself */
+  var $conflicts        = array("goShareServer");
+
+  var $DisplayName      = "";
+  var $dn               = NULL;
+  var $cn                   = "";
+  var $goShareServerStatus  = "";
+  var $goExportEntry        = array();
+  var $allow_mounts         = false;
+  var $mounts_to_remove     = array();
+  var $mounts_to_add        = array();
+  var $view_logged  =FALSE;
+
+  function goShareServer(&$config,$dn)
+  {
+    goService::goService($config,$dn);
+
+    $this->DisplayName = _("File service");
+
+    $tmp =array();
+    if(isset($this->attrs['goExportEntry'])){
+      if(isset($this->attrs['goExportEntry']['count'])){
+        for($i= 0; $i<$this->attrs['goExportEntry']['count']; $i++){
+          $entry= $this->attrs['goExportEntry'][$i];
+          $tmp[preg_replace('/\|.*$/', '', $entry)]= $entry;
+        }
+      }
+    } 
+    $this->goExportEntryList = $tmp;
+
+    $ldap = $this->config->get_ldap_link();
+    $avl_objectclasses = $ldap->get_objectclasses();
+    if (isset($avl_objectclasses["mount"])) {
+      $this->allow_mounts = true;
+    }
+  }
+
+
+  function execute()
+  { 
+    $smarty = get_smarty(); 
+
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","server/".get_class($this),$this->dn);
+    }
+
+
+    if((isset($_POST['DelNfsEnt']))&&(isset($_POST['goExportEntryList'])) && ($this->acl_is_writeable("name"))){
+      if($this->allow_mounts){
+        foreach($_POST['goExportEntryList'] as $entry){
+          $this->deleteFromMountList($this->goExportEntryList[$entry]);
+        }
+      }
+      foreach($_POST['goExportEntryList'] as $entry){
+        $this->deleteFromList($entry);
+      }
+    }
+
+    if(isset($_POST['NewNfsAdd']) && ($this->acl_is_writeable("name"))){
+      $this->oldone = NULL;
+      $this->o_subWindow = new servnfs($this->config, $this);
+      $this->o_subWindow->set_acl_category("server");
+      $this->o_subWindow->set_acl_base($this->dn);
+      $this->dialog = true;
+    }
+
+    if((isset($_POST['NewNfsEdit']))&&(isset($_POST['goExportEntryList']))){
+      $entry = $this->goExportEntryList[$_POST['goExportEntryList'][0]];
+      $add_mount=isset($this->mounts_to_add[$entry]);
+      $this->oldone=$entry;
+      $this->o_subWindow = new servnfs($this->config,$this,$entry,$add_mount);
+      $this->o_subWindow->set_acl_base($this->dn);
+      $this->o_subWindow->set_acl_category("server");
+      $this->dialog = true;
+    }
+    if(isset($this->o_subWindow)){
+      $this->o_subWindow->save_object(TRUE);
+    }
+
+    /* Save NFS setup */
+    if(isset($_POST['NFSsave']) && isset($this->o_subWindow) && is_object($this->o_subWindow)){
+      if(count($this->o_subWindow->check())>0){
+        foreach($this->o_subWindow->check() as $msg) {
+          print_red($msg);
+        }
+      }else{
+        $this->o_subWindow->save_object();
+        $newone = $this->o_subWindow->save();
+
+        $this->addToList($newone);
+        if($this->allow_mounts){
+          if($this->oldone != NULL) {
+            $this->deleteFromMountList($this->oldone);
+          }
+          if ($this->o_subWindow->should_create_mount()) {
+            $this->addToMountList($newone);
+          }
+        }
+        unset($this->o_subWindow);
+        $this->dialog = false;
+      }
+    }
+
+    /* Cancel NFS setup */
+    if(isset($_POST['NFScancel'])){
+      $this->oldone = NULL;
+      unset($this->o_subWindow);
+      $this->dialog = false;
+    }
+
+    /* Execute NFS setup dialog*/
+    if(isset($this->o_subWindow)){
+      return $this->o_subWindow->execute();
+    }
+
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr,$this->$attr);
+    }
+
+    /* Set acls */
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translated){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+    $smarty->assign("createable",$this->acl_is_createable());
+    $smarty->assign("removeable",$this->acl_is_removeable());
+
+    $tellSmarty= array();
+    ksort($this->goExportEntryList);
+    foreach($this->goExportEntryList as $name=>$values){
+      $tmp = split("\|",$values);
+      $tellSmarty[$name] = $tmp[0]." ".$tmp[4]." (".$tmp[2].")";
+    }
+    $smarty->assign("goExportEntry",array_keys($tellSmarty));
+    $smarty->assign("goExportEntryKeys",($tellSmarty));
+    return($smarty->fetch(get_template_path("goShareServer.tpl",TRUE,dirname(__FILE__))));
+  }
+
+
+  function getListEntry()
+  {
+    $fields = goService::getListEntry();
+    $fields['Message']    = _("File service (Shares)");
+    $fields['AllowEdit']  = true;
+    return($fields);
+  }
+
+
+  function save()
+  {
+    plugin::save();
+
+    /* Arrays */
+    foreach (array("goExportEntryList"=>"goExportEntry") as $source => $destination){
+      $this->attrs[$destination]= array();
+      foreach ($this->$source as $element){
+        $this->attrs[$destination][]= $element;
+      }
+    }
+
+
+    /* Process netatalk mounts */
+    if($this->allow_mounts) {
+      $this->process_mounts();
+    }
+
+    /* Check if this is a new entry ... add/modify */
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cat($this->dn,array("objectClass"));
+    if($ldap->count()){
+      $ldap->cd($this->dn);
+      $ldap->modify($this->attrs);
+    }else{
+      $ldap->cd($this->dn);
+      $ldap->add($this->attrs);
+    }
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of system server/shares with dn '%s' failed."),$this->dn));
+    if($this->initially_was_account){
+      $this->handle_post_events("modify");
+      new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      $this->handle_post_events("add");
+      new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
+  }
+
+
+  function check()
+  { 
+    $message = plugin::check();
+    return($message);
+  }
+
+
+  function save_object()
+  {
+    if(isset($_POST['goShareServerPosted'])){
+      plugin::save_object();
+    }
+  } 
+
+  function addToList($entry){
+    $key =  key($entry);
+    $this->goExportEntryList[$key]=$entry[$key];
+  }
+
+  function deleteFromList($id)
+  {
+    /* Check if the share is used by someone */
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(|(gotoProfileServer=*|$id)(gotoShare=*|$id|*||*))", array("cn"));
+    $cnt= $ldap->count();
+    if ($cnt){
+      $msg= sprintf(_("The share can't be removed since it is still used by %d users:"), $cnt);
+      $msg.= "<br><br><ul>";
+      while ($attrs= $ldap->fetch()){
+        $msg.= "<li>".$attrs["cn"][0]."</li>";
+      }
+      $msg.= "</ul>"._("Please correct the share-/profile settings of these users");
+      print_red($msg);
+
+    } else {
+      /* Finally remove it */
+      unset($this->goExportEntryList[$id]);
+    }
+  }
+
+   function process_mounts() {
+
+    $clip = "cn=" . $this->cn . ",ou=servers,ou=systems,";
+    $mountsdn = "cn=mounts," . substr($this->dn, strlen($clip));
+
+    $mounts = array(
+      "objectClass" => "container",
+      "cn" => "mounts"
+    );
+
+    # load data from mounts container
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cat($mountsdn, array('dn'));
+    $attrs = $ldap->fetch();
+
+    # mounts container not present yet, so we create it
+    if (count($attrs) == 0) {
+        $ldap->cd($mountsdn);
+        $ldap->add($mounts);
+        show_ldap_error($ldap->get_error(), sprintf(_("Creating system server/shares (mount container) with dn '%s' failed."),$this->dn)); 
+        new log("modify","server/".get_class($this),$mountsdn,array_keys($mounts),$ldap->get_error());
+    }
+
+    # remove deleted mounts from the container
+    foreach ($this->mounts_to_remove as $entry) {
+      $mount=$this->returnMountEntry($entry);
+      $mountdn = "cn=".$mount["cn"].","."$mountsdn";
+
+      $ldap->cat($mountdn, array('dn'));
+      $attrs = $ldap->fetch();
+
+      if (count($attrs) != 0) {
+        $ldap->rmdir($mountdn);
+        show_ldap_error($ldap->get_error(), sprintf(_("Removing system server/shares (mount container) with dn '%s' failed."),$this->dn)); 
+        new log("remove","server/".get_class($this),$mountdn,array_keys($mount),$ldap->get_error());
+      }
+    }
+
+    # add new mounts to the container
+    foreach ($this->mounts_to_add as $entry) {
+      $mount=$this->returnMountEntry($entry);
+      $mountdn = "cn=".$mount["cn"].","."$mountsdn";
+      $ldap->cd($mountdn);
+      $ldap->add($mount);
+      show_ldap_error($ldap->get_error(), sprintf(_("Saving system server/shares (mount container) with dn '%s' failed."),$this->dn)); 
+      new log("create","server/".get_class($this),$mountdn,array_keys($mount),$ldap->get_error());
+    }
+  }
+
+  function addToMountList($entry) 
+  {
+    if($this->acl_is_writeable("name")){
+      $key =  key($entry);
+      $type = $this->get_share_type($entry[$key]);
+      if (($type == "netatalk") || ($type == "NFS")) {
+        $this->mounts_to_add[$entry[$key]] = $entry[$key];
+        unset($this->mounts_to_remove[$entry[$key]]);
+      }
+    }
+  }
+
+  function deleteFromMountList($entry) 
+  {
+    if($this->acl_is_writeable("name")){
+      $type = $this->get_share_type($entry);
+      if (($type == "netatalk") || ($type == "NFS")) {
+        $this->mounts_to_remove[$entry] = $entry;
+        unset($this->mounts_to_add[$entry]);
+      }
+    }
+  }
+
+  function get_share_type($share) 
+  {
+    $tmp = split("\|", $share);
+    return $tmp[2];
+  }
+
+  function returnMountEntry($entry)
+  {
+    $item = split("\|", $entry);
+    $name = $item[0];
+    $description = $item[1];
+    $type = $item[2];
+    $charset = $item[3];
+    $path = $item[4];
+    $options = $item[5];
+
+    switch ($type) {
+      case "netatalk" : {
+        $mount = array(
+            "mountDirectory" => "/Network/Servers/",
+            "mountOption" => array(
+              "net",
+              "url==afp://;AUTH=NO%20USER%20AUTHENT@".$this->cn."/$name/"
+              ),
+            "mountType" => "url",
+            "objectClass" => "mount",
+            "cn" => $this->cn .":/".$name
+            );
+        break;
+      }
+      case "NFS" : {
+        $mount = array(
+            "mountDirectory" => "/Network/Servers/",
+            "mountOption" => "net",
+            "mountType" => "nfs",
+            "objectClass" => "mount",
+            "cn" => $this->cn .":".$path
+            );
+        break;
+      }
+      default : {
+                  continue;
+                }
+    }
+    return $mount;
+  }
+
+
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);
+
+    $tmp =array();
+    if(isset($source['goExportEntry'])){
+      if(isset($source['goExportEntry']['count'])){
+        for($i= 0; $i<$source['goExportEntry']['count']; $i++){
+          $entry= $source['goExportEntry'][$i];
+          $tmp[preg_replace('/\|.*$/', '', $entry)]= $entry;
+        }
+      }
+    }
+    $this->goExportEntryList = $tmp;
+    $this->goExportEntry = $tmp;
+  }
+
+
+  /* Return plugin informations for acl handling */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("File service (Shares)"),
+          "plDescription" => _("File service - Shares")." ("._("Services").")",
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 90,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("server"),
+
+          "plProvidedAcls"=> array(
+              "name"        => _("Name"),
+              "netatalkmount" => _("Apple mounts"),
+              "description" => _("Description"),
+              "type"        => _("Type"),
+              "charset"     => _("Charset"),
+              "path"        => _("Path"),
+              "option"      => _("Option"),
+              "volume"      => _("Volume"))
+
+          ));
+  }
+
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/services/shares/goShareServer.tpl b/plugins/admin/systems/services/shares/goShareServer.tpl
new file mode 100644 (file)
index 0000000..2c645c7
--- /dev/null
@@ -0,0 +1,33 @@
+<h2><img class="center" alt="" align="middle" src="images/rightarrow.png" /> {t}Shares{/t}</h2>
+   <table summary="" style="width:100%">
+    <tr>
+     <td>
+{render acl=$nameACL  mode=read_active}
+        <select style="width:100%" id="goExportEntry" name="goExportEntryList[]" size=12 multiple >
+            {html_options values=$goExportEntry output=$goExportEntryKeys}
+            <option disabled>&nbsp;</option>
+        </select>
+{/render}
+    <br>
+       
+{render acl=$nameACL}
+        <input type="submit"    value="{t}Add{/t}"     name="NewNfsAdd"   id="NewNfsAddId" {if !$createable} disabled {/if}>
+{/render}
+{render acl=$nameACL mode=read_active}
+        <input type="submit"    value="{t}Edit{/t}"     name="NewNfsEdit"  id="NewNfsEditId">
+{/render}
+{render acl=$nameACL}
+        <input type="submit"    value="{t}Delete{/t}"   name="DelNfsEnt"   id="DelNfsEntId" {if !$removeable} disabled {/if}>
+{/render}
+    </td>
+    </tr>
+   </table>
+
+
+<p class='seperator'>&nbsp;</p>
+<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
+    <input type='submit' name='SaveService' value='{t}Save{/t}'>
+    &nbsp;
+    <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
+</div>
+<input type="hidden" name="goShareServerPosted" value="1">
diff --git a/plugins/admin/systems/services/spam/class_goSpamServer.inc b/plugins/admin/systems/services/spam/class_goSpamServer.inc
new file mode 100644 (file)
index 0000000..82ff0fb
--- /dev/null
@@ -0,0 +1,357 @@
+<?php
+
+class gospamserver extends goService{
+
+  /* CLI vars */
+  var $cli_summary= "Manage server base objects";
+  var $cli_description= "Some longer text\nfor help";
+  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* This plugin only writes its objectClass */
+  var $objectclasses    = array("goSpamServer");
+  var $attributes       = array("saRewriteHeader","saTrustedNetworks","saRequiredScore","saFlags","saRule");
+  var $StatusFlag       = "saStatus";
+  /* This class can't be assigned twice so it conflicts with itsself */
+  var $conflicts        = array("goSpamServer");
+  var $Flags            = array("B","b","C","R","D","P");
+
+  var $DisplayName      = "";
+  var $dn               = NULL;
+  var $cn               = "";
+  var $saStatus         = "";
+
+  var $saRewriteHeader  = "";
+  var $saTrustedNetworks= array();
+  var $TrustedNetworks  = array();
+  var $saRequiredScore  = 0;
+  var $saFlags          = "";
+  var $Rules            = array();
+  var $saRule           = array();
+
+  var $saFlagsB         = false;
+  var $saFlagsb         = false;
+  var $saFlagsC         = false;
+  var $saFlagsR         = false;
+  var $saFlagsD         = false;
+  var $saFlagsP         = false;
+  var $ui               = NULL;
+  var $acl              = NULL;
+  var $view_logged  =FALSE;
+
+  function gospamserver(&$config,$dn, $parent= NULL)
+  {
+    /* Init class */
+    goService::goService($config,$dn, $parent);
+    $this->DisplayName = _("Spamassassin");
+
+    /* Get userinfo & acls */
+    $this->ui = get_userinfo();
+
+    /* Get Flags */
+    foreach($this->Flags as $flag){
+      $var = "saFlags".$flag;
+      if(preg_match("/".$flag."/",$this->saFlags)){
+        $this->$var = TRUE;
+      }
+    }
+    
+    /* Get trusted networks */
+    $this->TrustedNetworks = array();
+    if(isset($this->attrs['saTrustedNetworks']) && is_array($this->attrs['saTrustedNetworks'])){
+      $var = $this->attrs['saTrustedNetworks'];
+      for($i = 0 ; $i < $var['count'] ; $i ++ ){
+        $var2 = $this->attrs['saTrustedNetworks'][$i];
+        $this->TrustedNetworks[ $var2 ] = $var2; 
+      }
+    }
+
+    /* Get rules */
+    $this->Rules = array();
+    if(isset($this->attrs['saRule']) && is_array($this->attrs['saRule'])){  
+      $var = $this->attrs['saRule'];
+      for($i = 0 ; $i < $var['count'] ; $i ++ ){
+        $var2 = $this->attrs['saRule'][$i];
+        $name = preg_replace("/:.*$/","",$var2);
+        $value= base64_decode(preg_replace("/^.*:/","",$var2));
+        $this->Rules[ $name ] = $value;
+      }
+    }
+  }
+
+
+  function execute()
+  {
+    $display ="";
+    $smarty = get_smarty(); 
+    
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","server/".get_class($this),$this->dn);
+    }
+
+    /* If displayed, it is ever true*/
+    $this->is_account =true;
+
+    /* Get acls */
+    $tmp = $this->plinfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+    /* Add new trusted network */
+    if(isset($_POST['AddNewTrust']) && ($this->acl_is_writeable("saTrustedNetworks"))){
+      $this->AddTrust($_POST['NewTrustName']);
+    }
+  
+    /* Delete selected trusted network */
+    if(isset($_POST['DelTrust']) && ($this->acl_is_writeable("saTrustedNetworks"))){
+      $this->DelTrust($_POST['TrustedNetworks']);
+    }
+
+    /* Add a new rule */
+    if(isset($_POST['AddRule']) && $this->acl_is_writeable("saRule")){
+      $this->dialog = new goSpamServerRule($this->config,$this->dn);
+    }
+  
+    /* Cancel adding/editing specified rule */
+    if(isset($_POST['CancelRule'])){
+      $this->dialog = FALSE;
+    }
+
+    /* Handle post to delete rules */
+    $once = true;
+    foreach($_POST as $name => $value){
+      if(preg_match("/^editRule_/",$name) && $once && $this->acl_is_readable("saRule")){
+        $once = false;
+        $entry = preg_replace("/^editRule_/","",$name);
+        $entry = preg_replace("/_(x|y)$/","",$entry);
+        $rule = $this->Rules[$entry];
+        $name = $entry;
+        $this->dialog = new goSpamServerRule($this->config,$this->dn,$name,$rule);
+      }
+      if(preg_match("/^delRule_/",$name) && $once && $this->acl_is_writeable("saRule")){
+        $once = false;
+        $entry = preg_replace("/^delRule_/","",$name);
+        $entry = preg_replace("/_(x|y)$/","",$entry);
+        unset($this->Rules[$entry]);
+      }
+    }
+
+    /* Save rules */
+    if(isset($_POST['SaveRule'])){
+      $this->dialog->save_object();
+      $msgs = $this->dialog->check();
+      if(count($msgs)){
+        foreach($msgs as $msg){
+          print_red($msg);
+        }
+      }elseif($this->acl_is_writeable("saRule")){
+        $ret = $this->dialog->save();
+        if((!empty($ret['orig_name'])) && isset($this->Rules[$ret['orig_name']])){
+          unset($this->Rules[$ret['orig_name']]);
+        }
+        $this->Rules[$ret['name']] = $ret['rule'];
+        $this->dialog = FALSE;
+      }
+    }
+   
+    /* Display dialog if available */ 
+    if($this->dialog && $this->dialog->config){
+      $this->dialog->save_object();
+      return($this->dialog->execute());
+    }
+
+    /* Assign smarty vars */
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr,$this->$attr);
+    }
+
+    /* Assign checkbox states */
+    foreach($this->Flags as $Flag){
+      $var = "saFlags".$Flag;
+      $smarty->assign("saFlags".$Flag."ACL", $this->getacl($Flag));
+      if($this->$var){
+        $smarty->assign("saFlags".$Flag."CHK"," checked " );
+      }else{
+        $smarty->assign("saFlags".$Flag."CHK","");
+      }
+    }
+
+    /* Create divlist */
+    $DivRules = new divSelectBox("SpamRules");
+    $DivRules->SetHeight(130);
+
+    if($this->acl_is_writeable("saTrustedNetworks")){
+      $actions = "";
+    }else{
+    
+      $actions = "<input type='image' src='images/edit.png'      name='editRule_%s'>";
+      if($this->acl_is_writeable("saRule")){
+        $actions.= "<input type='image' src='images/edittrash.png' name='delRule_%s'>";
+      }
+    }
+
+    foreach($this->Rules as $key => $net){
+      $field1 = array("string" => $key );
+      $field2 = array("string" => sprintf($actions,$key,$key) , "attach" => "style='border-right:0px;width:36px;'");
+      $DivRules->AddEntry(array($field1,$field2));
+    }
+    $smarty->assign("divRules",$DivRules->DrawList()); 
+    $smarty->assign("TrustedNetworks",$this->TrustedNetworks); 
+
+    /* Create Spam score select box entries */
+    $tmp = array();
+    for($i = 0 ; $i <= 20 ; $i ++ ){
+      $tmp[$i] = $i;
+    }
+    $smarty->assign("SpamScore",$tmp);
+
+    return($display.$smarty->fetch(get_template_path("goSpamServer.tpl",TRUE,dirname(__FILE__))));
+  }
+
+
+  /* Add $post to list of configured trusted */
+  function AddTrust($post)
+  {
+    if(!empty($post)){
+      if(is_ip($post) || is_domain($post) || (is_ip_with_subnetmask($post))){
+        $this->TrustedNetworks[$post] = $post;
+      }else{
+        print_red(_("Specified value is not a valid 'trusted network' value."));
+      }
+    }
+  }
+
+
+  /* Delete trusted network */
+  function DelTrust($posts)
+  {
+    foreach($posts as $post){
+      if(isset($this->TrustedNetworks[$post])){
+        unset($this->TrustedNetworks[$post]);     
+      }
+    }
+  }
+
+  function save()
+  {
+    if(!$this->is_account) return;
+    plugin::save();
+
+    /* Create Flags */     
+    $this->attrs['saFlags'] = array();
+    foreach($this->Flags as $flag){
+      $var = "saFlags".$flag;
+      if($this->$var){
+        $this->attrs['saFlags'].=$flag;
+      }
+    }
+
+    /* Create trusted network entries */
+    $this->attrs['saTrustedNetworks'] = array();
+    foreach($this->TrustedNetworks as $net){
+      $this->attrs['saTrustedNetworks'][] = $net; 
+    }    
+
+    /* Rules */
+    $this->attrs['saRule'] = array();
+    foreach($this->Rules as $name => $rule){
+      $this->attrs['saRule'][] = $name.":".base64_encode($rule);
+    }
+
+    /* Check if this is a new entry ... add/modify */
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cat($this->dn,array("objectClass"));
+    if($ldap->count()){
+      $ldap->cd($this->dn);
+      $ldap->modify($this->attrs);
+    }else{
+      $ldap->cd($this->dn);
+      $ldap->add($this->attrs);
+    }
+    if($this->initially_was_account){
+      $this->handle_post_events("modify");
+      new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      $this->handle_post_events("add");
+      new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
+
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of server services/spamassassin with dn '%s' failed."),$this->dn));
+  }
+
+  function check()
+  { 
+    $message = plugin::check();
+
+    /* Check if required score is numeric */
+    if(!is_numeric($this->saRequiredScore)){
+      $message[] = _("Required score must be a numeric value.");
+    }
+
+    return($message);
+  }
+  
+
+  function save_object()
+  {
+    if(isset($_POST['goSpamServer'])){
+
+      plugin::save_object();
+
+      /* Check flags */
+      foreach($this->Flags as $flag){
+        $var = "saFlags".$flag;
+
+        if($this->acl_is_writeable($var)){
+          if(isset($_POST[$var])){
+            $this->$var = TRUE;
+          }else{
+            $this->$var = FALSE;
+          }
+        }
+      }
+    }    
+  }  
+
+  
+  /* Return plugin informations for acl handling  */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Spamassassin"),
+          "plDescription" => _("Spamassassin")." ("._("Services").")",
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 89,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("server"),
+          "plProvidedAcls"=> array(
+
+            "saRewriteHeader"   => _("Rewrite header"),
+            "saTrustedNetworks" => _("Trusted networks"),
+            "saRequiredScore"   => _("Required score"),
+            "saRule"            => _("Rules"),
+
+            "saFlagB"           => _("Enable use of bayes filtering"),
+            "saFlagb"           => _("Enabled bayes auto learning"),
+            "saFlagC"           => _("Enable RBL checks"),
+            "saFlagR"           => _("Enable use of Razor"),
+            "saFlagD"           => _("Enable use of DDC"),
+            "saFlagP"           => _("Enable use of Pyzor"))
+          ));
+  }
+
+  /* For newer service management dialogs */
+  function getListEntry()
+  {
+    $fields                 = goService::getListEntry();
+    $fields['Message']      = _("Spamassassin");
+    $fields['AllowEdit']    = true;
+    return($fields);
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/services/spam/class_goSpamServerRule.inc b/plugins/admin/systems/services/spam/class_goSpamServerRule.inc
new file mode 100644 (file)
index 0000000..c8eed5d
--- /dev/null
@@ -0,0 +1,61 @@
+<?php
+class goSpamServerRule extends plugin {
+
+       var $attributes = array("name","rule");
+       var $name = "";
+       var $rule = "";
+       
+       var $orig_name = "";
+  var $view_logged  =FALSE;
+       
+       function goSpamServerRule(&$config,$dn,$name = "",$rule ="")
+       {
+               plugin::plugin($config,$dn);
+               $this->name = $this->orig_name= $name;
+               $this->rule = $rule;
+       }
+
+
+       function execute()
+       {
+               $smarty = get_smarty();
+
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","server/".get_class($this),$this->dn);
+    }
+
+               foreach($this->attributes as $attr){
+                       $smarty->assign($attr,$this->$attr);
+               }
+               return($smarty->fetch(get_template_path("goSpamServerRule.tpl",TRUE,dirname(__FILE__))));                       
+       }
+
+       function save_object()
+       {
+               plugin::save_object();
+               foreach($this->attributes as $attr){
+                       if(isset($_POST[$attr])){
+                               $this->$attr = $_POST[$attr];
+                       }
+               }
+       }
+
+
+       function save()
+       {
+               $ret =array();
+               $ret['orig_name'] = $this->orig_name;
+               $ret['name'] = $this->name;
+               $ret['rule'] = $this->rule;
+               return($ret);
+       }
+       
+       function check()
+       {
+               $messages = plugin::check();
+               return($messages);
+       }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/services/spam/goSpamServer.tpl b/plugins/admin/systems/services/spam/goSpamServer.tpl
new file mode 100644 (file)
index 0000000..c8b5885
--- /dev/null
@@ -0,0 +1,129 @@
+<table style='width:100%'>
+ <tr>
+  <td style='width:50%;vertical-align:top;'><h2>Spam tagging</h2>
+
+   <table>
+    <tr>
+     <td>
+      {t}Rewrite header{/t}      
+     </td>
+     <td>
+{render acl=$saRewriteHeaderACL}
+      <input type='text' name='saRewriteHeader' value='{$saRewriteHeader}'>
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td>
+      {t}Required score{/t}      
+     </td>
+     <td>
+{render acl=$saRequiredScoreACL}
+      <select name='saRequiredScore' title='{t}Select required score to tag mail as spam{/t}'>
+       {html_options options=$SpamScore selected=$saRequiredScore}
+      </select>
+{/render}
+     </td>
+    </tr>
+   </table>
+
+  </td>
+  <td style="vertical-align:top;border-left:1px solid #A0A0A0;"><h2>Trusted networks</h2>
+
+   <table width='100%'>
+    <tr>
+     <td>
+{render acl=$saTrustedNetworksACL}
+      <select name='TrustedNetworks[]' size=4 style='width:100%;' multiple>
+       {html_options options=$TrustedNetworks}
+      </select><br>
+{/render}
+{render acl=$saTrustedNetworksACL}
+      <input type='text'       name='NewTrustName' value=''>&nbsp;
+{/render}
+{render acl=$saTrustedNetworksACL}
+      <input type='submit'      name='AddNewTrust'  value='{t}Add{/t}'>
+{/render}
+{render acl=$saTrustedNetworksACL}
+      <input type='submit'      name='DelTrust'     value='{t}Remove{/t}'>
+{/render}
+     </td>
+    </tr>
+   </table>
+
+  </td>
+ </tr>
+ <tr>
+  <td colspan=2>
+   <p class='seperator'>&nbsp;</p>
+  </td>
+ </tr>
+ <tr>
+  <td>
+       <h2>Flags</h2>
+       
+   <table>
+    <tr>
+     <td>
+{render acl=$saFlagsBACL}
+      <input type='checkbox' name='saFlagsB' value='1' {$saFlagsBCHK}> &nbsp;{t}Enable use of bayes filtering{/t}<br>
+{/render}
+{render acl=$saFlagsbACL}
+      <input type='checkbox' name='saFlagsb' value='1' {$saFlagsbCHK}> &nbsp;{t}Enable bayes auto learning{/t}<br>
+{/render}
+{render acl=$saFlagsCACL}
+      <input type='checkbox' name='saFlagsC' value='1' {$saFlagsCCHK}> &nbsp;{t}Enable RBL checks{/t}
+{/render}
+     </td>
+    </tr>
+   </table>
+  </td>
+  <td style="vertical-align:bottom;border-left:1px solid #A0A0A0;">
+   <table>
+    <tr>
+     <td>
+{render acl=$saFlagsRACL}
+      <input type='checkbox' name='saFlagsR' value='1' {$saFlagsRCHK}> &nbsp;{t}Enable use of Razor{/t}<br>
+{/render}
+{render acl=$saFlagsDACL}
+      <input type='checkbox' name='saFlagsD' value='1' {$saFlagsDCHK}> &nbsp;{t}Enable use of DDC{/t}<br>
+{/render}
+{render acl=$saFlagsPACL}
+      <input type='checkbox' name='saFlagsP' value='1' {$saFlagsPCHK}> &nbsp;{t}Enable use of Pyzor{/t}
+{/render}
+     </td>
+    </tr>
+   </table>
+
+  </td>
+ </tr>
+ <tr>
+  <td colspan=2>
+   <p class='seperator'>&nbsp;</p>
+  </td>
+ </tr>
+ <tr>
+  <td colspan='2'><h2>Rules</h2>
+
+   <table width='100%'>
+    <tr>
+     <td>
+      {$divRules}<br>
+{render acl=$saTrustedNetworksACL}
+      <input type='submit' name='AddRule' value='{t}Add{/t}'> 
+{/render}
+     </td>
+    </tr>
+   </table>
+
+  </td>
+</table>
+<input type='hidden' value='1' name='goSpamServer'>
+
+<p class='seperator'>&nbsp;</p>
+<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
+    <input type='submit' name='SaveService' value='{t}Save{/t}'>
+    &nbsp;
+    <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
+</div>
+
diff --git a/plugins/admin/systems/services/spam/goSpamServerRule.tpl b/plugins/admin/systems/services/spam/goSpamServerRule.tpl
new file mode 100644 (file)
index 0000000..6448ab5
--- /dev/null
@@ -0,0 +1,25 @@
+<h2>Edit spam rule</h2>
+
+<table style='width:100%;'>
+ <tr>
+  <td width='70'>
+   {t}Name{/t}
+  </td>
+  <td>
+   <input type='text' name='name' value='{$name}' >
+  </td>
+ </tr>
+ <tr>
+  <td colspan=2>
+   {t}Rule{/t}
+   <textarea name='rule' style='width:100%;'>{$rule}</textarea>
+  </td>
+ </tr>
+</table>
+<p class='seperator'>&nbsp;</p>
+<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
+    <input type='submit' name='SaveRule' value='{t}Save{/t}'>
+    &nbsp;
+    <input type='submit' name='CancelRule' value='{t}Cancel{/t}'>
+</div>
+
diff --git a/plugins/admin/systems/services/syslog/class_goLogDBServer.inc b/plugins/admin/systems/services/syslog/class_goLogDBServer.inc
new file mode 100644 (file)
index 0000000..3a193db
--- /dev/null
@@ -0,0 +1,106 @@
+<?php
+
+class goLogDBServer extends goService{
+       
+  var $cli_summary      = "This pluign is used within the ServerService Pluign \nand indicates that this server supports asterisk management.";
+  var $cli_description  = "Some longer text\nfor help";
+  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* This plugin only writes its objectClass */
+  var $objectclasses    = array("goLogDBServer");
+  var $attributes       = array("goLogAdmin", "goLogPassword");
+  var $StatusFlag       = "goLogDBServerStatus";
+
+  /* This class can't be assigned twice so it conflicts with itsself */
+  var $conflicts        = array("goLogDBServer");
+
+  var $DisplayName      = "";
+  var $dn               = NULL;
+  var $acl;
+  var $cn                   = "";
+  var $goLogDBServerStatus  = "";
+  var $goLogAdmin           = "";
+  var $goLogPassword        = "";  
+  var $view_logged  =FALSE;
+
+
+  function goLogDBServer(&$config,$dn)
+  {
+    goService::goService($config,$dn);
+    $this->DisplayName = _("Syslog service database");
+  }
+
+
+  function execute()
+  { 
+    $smarty = get_smarty(); 
+
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","server/".get_class($this),$this->dn);
+    }
+
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr,$this->$attr);
+    }
+    return($smarty->fetch(get_template_path("goLogDBServer.tpl",TRUE,dirname(__FILE__))));
+  }
+
+
+  function getListEntry()
+  {
+    $fields = goService::getListEntry();
+    $fields['Message']      = _("Syslog service database");
+    $fields['AllowEdit']    = true;
+    return($fields);
+  }
+
+
+  function check()
+  { 
+    $message = plugin::check();
+    if (empty($this->goLogAdmin)){
+      $message[]= sprintf_("The attribute user is empty or contains invalid characters.");
+    }
+    if (empty($this->goLogPassword)){
+      $message[]= sprintf_("The attribute password is empty or contains invalid characters.");
+    }
+    return($message);
+  }
+
+
+  function save_object()
+  {
+    if(isset($_POST['goLogDBServerPosted'])){
+      plugin::save_object();
+    }
+  } 
+
+  /* Return plugin informations for acl handling */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Logging database"),
+          "plDescription" => _("Logging database")." ("._("Services").")",
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 97,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("server"),
+
+          "plProvidedAcls"=> array(
+            "start"         => _("Start"),
+            "stop"          => _("Stop"),
+            "restart"       => _("Restart"),
+            "goLogAdmin"    => _("Admin"),
+            "goLogPassword" => _("Password"))
+          ));
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/services/syslog/class_goSyslogServer.inc b/plugins/admin/systems/services/syslog/class_goSyslogServer.inc
new file mode 100644 (file)
index 0000000..9461977
--- /dev/null
@@ -0,0 +1,83 @@
+<?php
+
+class goSyslogServer extends goService{
+       
+  var $cli_summary      = "This plugin is used within the ServerService Pluign \nand indicates that this server has syslog server enabled.";
+  var $cli_description  = "Some longer text\nfor help";
+  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* This plugin only writes its objectClass */
+  var $objectclasses    = array("goSyslogServer");
+  var $attributes       = array();
+  var $StatusFlag       = "goSyslogServerStatus";
+  /* This class can't be assigned twice so it conflicts with itsself */
+  var $conflicts        = array("goSyslogServer");
+
+  var $DisplayName      = "";
+  var $dn               = NULL;
+  var $acl;
+  var $cn                    = "";
+  var $goSyslogServerStatus  = "";
+  var $view_logged  =FALSE;
+  function goSyslogServer(&$config,$dn)
+  {
+    goService::goService($config,$dn);
+    $this->DisplayName = _("Syslog server");
+  }
+
+
+  function execute()
+  { 
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","server/".get_class($this),$this->dn);
+    }
+
+
+    $smarty = get_smarty(); 
+    return($smarty->fetch(get_template_path("goSyslogServer.tpl",TRUE,dirname(__FILE__))));
+  }
+
+
+  function getListEntry()
+  {
+    $fields               = goService::getListEntry();
+    $fields['Message']    = _("Syslog server");
+    $fields['AllowEdit']  = false;
+    return($fields);
+  }
+
+  function check()
+  { 
+    $message = plugin::check();
+    return($message);
+  }
+
+
+  function save_object()
+  {
+    plugin::save_object();
+  } 
+
+  /* Return plugin informations for acl handling */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Logging service"),
+          "plDescription" => _("Logging service")." ("._("Services").")",
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 88,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("server"),
+
+          "plProvidedAcls"=> array()
+          ));
+  }
+
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/services/syslog/goLogDBServer.tpl b/plugins/admin/systems/services/syslog/goLogDBServer.tpl
new file mode 100644 (file)
index 0000000..8395070
--- /dev/null
@@ -0,0 +1,27 @@
+<h2><img class="center" alt="" align="middle" src="images/rightarrow.png" /> {t}Logging database information{/t}</h2>
+<table summary="">
+    <tr>
+     <td>{t}Logging DB user{/t}{$must}</td>
+     <td>
+{render acl=$goLogAdminACL}
+       <input name="goLogAdmin" id="goLogAdmin" size=30 maxlength=60 value="{$goLogAdmin}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td>{t}Password{/t}{$must}</td>
+     <td>
+{render acl=$goLogPasswordACL}
+       <input type=password name="goLogPassword" id="goLogPassword" size=30 maxlength=60 value="{$goLogPassword}">
+{/render}
+     </td>
+    </tr>
+   </table>
+
+<p class='seperator'>&nbsp;</p>
+<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
+    <input type='submit' name='SaveService' value='{t}Save{/t}'>
+    &nbsp;
+    <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
+</div>
+<input type="hidden" name="goLogDBServerPosted" value="1">
diff --git a/plugins/admin/systems/services/syslog/goSyslogServer.tpl b/plugins/admin/systems/services/syslog/goSyslogServer.tpl
new file mode 100644 (file)
index 0000000..a7ed661
--- /dev/null
@@ -0,0 +1,9 @@
+<h2>{t}Syslog Service{/t} {t}enabled{/t}</h2>
+
+<p class='seperator'>&nbsp;</p>
+<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
+    <input type='submit' name='SaveService' value='{t}Save{/t}'>
+    &nbsp;
+    <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
+</div>
+<input type="hidden" name="goCupsServerPosted" value="1">
diff --git a/plugins/admin/systems/services/terminal/class_goTerminalServer.inc b/plugins/admin/systems/services/terminal/class_goTerminalServer.inc
new file mode 100644 (file)
index 0000000..e832de0
--- /dev/null
@@ -0,0 +1,141 @@
+<?php
+
+class goTerminalServer extends goService{
+       
+  var $cli_summary      = "This pluign is used within the ServerService Pluign \nand indicates that this server supports asterisk management.";
+  var $cli_description  = "Some longer text\nfor help";
+  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* This plugin only writes its objectClass */
+  var $objectclasses    = array("goTerminalServer");
+  var $attributes       = array("goXdmcpIsEnabled", "goFontPath");
+  var $StatusFlag       = "goTerminalServerStatus";
+  /* This class can't be assigned twice so it conflicts with itsself */
+  var $conflicts        = array("goTerminalServer");
+
+  var $DisplayName      = "";
+  var $dn               = NULL;
+  var $acl;
+  var $cn                      = "";
+  var $goTerminalServerStatus  = "";
+  var $goXdmcpIsEnabled        = false;  
+  var $goFontPath              = "";
+  var $view_logged  =FALSE;
+
+
+  function goTerminalServer(&$config,$dn)
+  {
+    goService::goService($config,$dn);
+    $this->DisplayName = _("Terminal service");
+  }
+
+
+  function execute()
+  { 
+    $smarty = get_smarty();
+
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","server/".get_class($this),$this->dn);
+    }
+
+  
+    $tmp = $this->plinfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr,$this->$attr);
+    }
+    return($smarty->fetch(get_template_path("goTerminalServer.tpl",TRUE,dirname(__FILE__))));
+  }
+
+
+  function getListEntry()
+  {
+    $fields               = goService::getListEntry();
+    $fields['Message']    = _("Terminal service");
+    $fields['AllowEdit']  = true;
+    return($fields);
+  }
+
+
+  function save()
+  {
+    plugin::save();
+
+    if(!$this->goXdmcpIsEnabled){
+      $this->attrs['goXdmcpIsEnabled'] = "0";
+    }
+
+    /* Check if this is a new entry ... add/modify */
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cat($this->dn,array("objectClass"));
+    if($ldap->count()){
+      $ldap->cd($this->dn);
+      $ldap->modify($this->attrs);
+    }else{
+      $ldap->cd($this->dn);
+      $ldap->add($this->attrs);
+    }
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving server services/terminalServer with dn '%s' failed."),$this->dn));
+    if($this->initially_was_account){
+      $this->handle_post_events("modify");
+      new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      $this->handle_post_events("add");
+      new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
+  }
+
+
+  function check()
+  { 
+    $message = plugin::check();
+    if(empty($this->goFontPath)){
+      $message[]=_("Terminal server, must have fontpath specified.");
+    }
+
+    return($message);
+  }
+
+
+  function save_object()
+  {
+    if(isset($_POST['goTerminalServerPosted'])){
+      plugin::save_object();
+      if($this->acl_is_writeable("goXdmcpIsEnabled")){
+        if(isset($_POST['goXdmcpIsEnabled'])){
+          $this->goXdmcpIsEnabled = true;
+        }else{
+          $this->goXdmcpIsEnabled = false;
+        }
+      }
+    }
+  } 
+
+
+  /* Return plugin informations for acl handling */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Terminal service"),
+          "plDescription" => _("Terminal service")." ("._("Services").")",
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 87,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("server"),
+
+          "plProvidedAcls"=> array(
+            "goXdmcpIsEnabled"  => _("Temporary disable login"),
+            "goFontPath"        => _("Font path"))
+          ));
+  }
+
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/services/terminal/goTerminalServer.tpl b/plugins/admin/systems/services/terminal/goTerminalServer.tpl
new file mode 100644 (file)
index 0000000..5fca209
--- /dev/null
@@ -0,0 +1,27 @@
+<h2><img class="center" alt="" align="middle" src="images/rightarrow.png" /> {t}Terminal service{/t}</h2>
+<table summary="">
+    <tr>
+     <td colspan=2>
+{render acl=$goXdmcpIsEnabledACL}
+      <input type="checkbox" value="true" name="goXdmcpIsEnabled" id="Temporariid" {if $goXdmcpIsEnabled} checked {/if}>
+{/render}
+       {t}Temporary disable login{/t}
+     </td>
+    </tr>
+    <tr>
+     <td>{t}Font path{/t}</td>
+     <td> 
+{render acl=$goXdmcpIsEnabledACL}
+      <input type="text" value="{$goFontPath}" name="goFontPath" id="FontPathId">
+{/render}
+     </td>
+    </tr>
+   </table>
+
+<p class='seperator'>&nbsp;</p>
+<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
+    <input type='submit' name='SaveService' value='{t}Save{/t}'>
+    &nbsp;
+    <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
+</div>
+<input type="hidden" name="goTerminalServerPosted" value="1">
diff --git a/plugins/admin/systems/services/virus/class_goVirusServer.inc b/plugins/admin/systems/services/virus/class_goVirusServer.inc
new file mode 100644 (file)
index 0000000..f91c5f5
--- /dev/null
@@ -0,0 +1,248 @@
+<?php
+
+class govirusserver extends goService{
+       
+  /* This plugin only writes its objectClass */
+  var $objectclasses    = array("goVirusServer");
+  var $attributes       = array("avMaxThreads","avMaxDirectoryRecursions","avUser","avFlags","avArchiveMaxFileSize","avArchiveMaxRecursion",
+                                "avArchiveMaxCompressionRatio","avDatabaseMirror","avChecksPerDay","avHttpProxyURL");
+  var $StatusFlag       = "avStatus";
+  /* This class can't be assigned twice so it conflicts with itsself */
+  var $conflicts        = array("goVirusServer");
+
+  var $DisplayName      = "";
+  var $dn               = NULL;
+  var $cn               = "";
+  var $avStatus         = "";
+
+  var $ui               = NULL;
+
+  var $Flags            = array("D","S","A","E");
+  
+  var $avFlags          = "DS";
+  var $avFlagsD         = TRUE;
+  var $avFlagsS         = TRUE;
+  var $avFlagsA         = FALSE;
+  var $avFlagsE         = FALSE;
+
+  var $avMaxThreads                 = 5;
+  var $avMaxDirectoryRecursions     = 4;    
+  var $avArchiveMaxFileSize         = 4000;
+  var $avArchiveMaxRecursion        = 5;
+  var $avArchiveMaxCompressionRatio = 95;
+  var $avChecksPerDay               = 12;
+
+  var $avUser                       = "";
+  var $avHttpProxyURL               = "";
+  var $avDatabaseMirror             = "";
+  var $view_logged  =FALSE;
+
+  function govirusserver(&$config,$dn, $parent= NULL)
+  {
+    /* Init class */
+    goService::goService($config,$dn, $parent);
+    $this->DisplayName = _("Anti virus");
+
+    /* Get userinfo & acls */
+    $this->ui = get_userinfo();
+
+    /* Get Flags */
+    foreach($this->Flags as $flag){
+      $var = "avFlags".$flag;
+      if(preg_match("/".$flag."/",$this->avFlags)){
+        $this->$var = TRUE;
+      }
+    }
+  }
+
+
+  function execute()
+  {
+    $smarty = get_smarty(); 
+
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","server/".get_class($this),$this->dn);
+    }
+
+
+    /* Set acls */
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation) { 
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+    $display = "";
+    $smarty->assign("servtabs",FALSE);
+    $this->is_account = true;
+
+    /* Assign smarty vars */
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr,$this->$attr);
+    }
+
+    /* Assign checkbox states */
+    foreach($this->Flags as $Flag){
+      $var = "avFlags".$Flag;
+      if($this->$var){
+        $smarty->assign("avFlags".$Flag."CHK"," checked " );
+      }else{
+        $smarty->assign("avFlags".$Flag."CHK","");
+      }
+    }
+
+    /* Assign value for max thread select box */
+    $tmp = array();
+    for($i = 1 ; $i <= 20 ; $i ++){
+      $tmp[$i] = $i;
+    }
+    $smarty->assign("ThreadValues",$tmp);
+
+    if($this->avFlagsA){
+      $smarty->assign("avFlagsAState" , "" );
+    }else{
+      $smarty->assign("avFlagsAState" , " disabled " );
+    }
+
+    return($display.$smarty->fetch(get_template_path("goVirusServer.tpl",TRUE,dirname(__FILE__))));
+  }
+
+
+  function save()
+  {
+    if(!$this->is_account) return;
+
+    /* Create Flags */     
+    $this->avFlags = "";
+    foreach($this->Flags as $flag){
+      $var = "avFlags".$flag;
+      if($this->$var){
+        $this->avFlags .=$flag;
+      }
+    }
+
+    plugin::save();
+
+    if(!$this->avFlagsA){
+      $arr = array("avArchiveMaxFileSize","avArchiveMaxRecursion","avArchiveMaxCompressionRatio");
+      foreach($arr as $attr){
+        $this->attrs[$attr] =  array();
+      }
+      $this->attrs['avFlags'] = preg_replace("/E/","",$this->attrs['avFlags']);
+    }
+
+    /* Check if this is a new entry ... add/modify */
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cat($this->dn,array("objectClass"));
+    if($ldap->count()){
+      $ldap->cd($this->dn);
+      $ldap->modify($this->attrs);
+    }else{
+      $ldap->cd($this->dn);
+      $ldap->add($this->attrs);
+    }
+    if($this->initially_was_account){
+      $this->handle_post_events("modify");
+      new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      $this->handle_post_events("add");
+      new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
+
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of server services/anti virus with dn '%s' failed."),$this->dn));
+  }
+
+  function check()
+  { 
+    $message = plugin::check();
+
+    $mustBeNumeric = array(
+          "avMaxDirectoryRecursions"     =>_("Maximum directory recursions"),
+          "avMaxThreads"                 =>_("Maximum threads"),
+          "avArchiveMaxFileSize"         =>_("Maximum file size"),
+          "avArchiveMaxRecursion"        =>_("Maximum recursions"),
+          "avArchiveMaxCompressionRatio" =>_("Maximum compression ratio"),
+          "avChecksPerDay"               =>_("Checks per day"));
+
+    foreach($mustBeNumeric as $key => $trans){
+      if(!is_numeric($this->$key)){
+        $message[] = sprintf(_("The specified value for '%s' must be a numeric value."),$trans);
+      }
+    }
+
+    foreach(array("avUser"=>_("Database user"),"avHttpProxyURL"=>_("Http proxy URL"),"avDatabaseMirror"=>_("Database mirror")) as $attr => $name){
+      if(!preg_match("/^[a-z0-9:_\-\.\/]*$/",$this->$attr)){
+        $message[] = sprintf(_("Please specify a valid value for '%s'."),$name);
+      }
+    }
+  
+    return($message);
+  }
+  
+
+  function save_object()
+  {
+    if(isset($_POST['goVirusServer'])){
+      plugin::save_object();
+      foreach($this->Flags as $flag){
+
+        $var = "avFlags".$flag;
+        if($this->acl_is_writeable($var)){
+          if(isset($_POST[$var])){
+            $this->$var = TRUE;
+          }else{
+            $this->$var = FALSE;
+          }
+        }
+      }
+    }    
+  }  
+  
+
+  /* For newer service management dialogs */
+  function getListEntry()
+  {
+    $fields       = goService::getListEntry();
+    $fields['AllowEdit']    = true;
+    $fields['Message']      = _("Anti virus");
+    return($fields);
+  }
+
+
+  /* Return plugin informations for acl handling */ 
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Anti virus"),
+          "plDescription" => _("Anti virus")." ("._("Services").")",
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 96,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("server"),
+          "plProvidedAcls"=> array(
+
+          "start"         => _("Start"),
+          "stop"          => _("Stop"),
+          "restart"       => _("Restart"),
+
+          "avFlagsD"         =>_("Enable debugging"),
+          "avFlagsS"         =>_("Enable mail scanning"),
+          "avFlagsA"         =>_("Enable scanning of archives"),
+          "avFlagsE"         =>_("Block encrypted archives"),
+
+          "avMaxThreads"                 =>_("Maximum threads"),
+          "avMaxDirectoryRecursions"     =>_("Maximum directory recursions"),
+          "avUser"                       =>_("Anti virus user"),
+          "avArchiveMaxFileSize"         =>_("Maximum file size"),
+          "avArchiveMaxRecursion"        =>_("Maximum recursions"),
+          "avArchiveMaxCompressionRatio" =>_("Maximum compression ratio"),
+          "avDatabaseMirror"             =>_("Database mirror"),
+          "avChecksPerDay"               =>_("Checks per day"),
+          "avHttpProxyURL"               =>_("Http proxy URL"))
+          ));
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/services/virus/goVirusServer.tpl b/plugins/admin/systems/services/virus/goVirusServer.tpl
new file mode 100644 (file)
index 0000000..af14a2b
--- /dev/null
@@ -0,0 +1,172 @@
+
+<table style='width:100%;'>
+ <tr>
+  <td colspan=2>
+       <h2>{t}Generic virus filtering{/t}</h2>
+  </td>
+ </tr>
+ <tr>
+  <td style="vertical-align:top;">
+       <table>
+        <tr>
+         <td>
+               {t}Database user{/t}
+         </td>
+         <td>
+{render acl=$avUserACL}
+               <input type='text' name='avUser' value='{$avUser}' style='width:220px;'>
+{/render}
+         </td>
+        </tr>
+        <tr>
+         <td>
+               {t}Database mirror{/t}
+         </td>
+         <td>
+{render acl=$avDatabaseMirrorACL}
+               <input type='text' name='avDatabaseMirror' value='{$avDatabaseMirror}' style='width:220px;'>
+{/render}
+         </td>
+        </tr>
+        <tr>
+         <td>
+               {t}Http proxy URL{/t}
+         </td>
+         <td>
+{render acl=$avHttpProxyURLACL}
+               <input type='text' name='avHttpProxyURL' value='{$avHttpProxyURL}' style='width:220px;'>
+{/render}
+         </td>
+        </tr>
+        <tr>
+         <td>
+               {t}Maximum threads{/t}
+         </td>
+         <td>
+{render acl=$avMaxThreadsACL}
+               <select name="avMaxThreads" title='{t}Select number of maximal threads{/t}'>
+                {html_options options=$ThreadValues selected=$avMaxThreads}
+               </select>
+{/render}
+         </td>
+        </tr>
+       </table>
+  </td>
+  <td style='border-left:1px solid #A0A0A0;vertical-align:top;'>
+  
+       <table>
+        <tr>
+         <td>
+               {t}Max directory recursions{/t}
+         </td>
+         <td>
+{render acl=$avMaxDirectoryRecursionsACL}
+               <input type='text' name='avMaxDirectoryRecursions' value='{$avMaxDirectoryRecursions}' >
+{/render}
+         </td>
+        </tr>
+        <tr>
+         <td>
+               {t}Checks per day{/t}
+         </td>
+         <td>
+{render acl=$avChecksPerDayACL}
+               <input type='text' name='avChecksPerDay' value='{$avChecksPerDay}'> 
+{/render}
+         </td>
+        </tr>
+        <tr>
+         <td colspan=2>
+{render acl=$avFlagsDACL}
+               <input type='checkbox' name='avFlagsD' {$avFlagsDCHK} value='1'>
+{/render}
+               {t}Enable debugging{/t}
+         </td>
+        </tr>
+        <tr>
+         <td colspan=2>
+{render acl=$avFlagsSACL}
+               <input type='checkbox' name='avFlagsS' {$avFlagsSCHK} value='1'>
+{/render}
+               {t}Enable mail scanning{/t}
+         </td>
+        </tr>
+       </table>
+  </td>
+ </tr>
+ <tr>
+  <td colspan=2>
+   <p class='seperator'>&nbsp;</p>
+       <h2>{t}Archive scanning{/t}</h2> 
+  </td>
+ </tr>
+ <tr>
+  <td style='vertical-align:top;'>
+       <table>
+        <tr>
+         <td>
+{render acl=$avFlagsAACL}
+               <input type='checkbox' name='avFlagsA' {$avFlagsACHK} value='1'
+                       onClick=" changeState('avFlagsE') ; 
+                                 changeState('avArchiveMaxFileSize') ; 
+                                 changeState('avArchiveMaxRecursion') ; 
+                                 changeState('avArchiveMaxCompressionRatio') ; "
+               >
+{/render}
+               {t}Enable scanning of archives{/t}
+         </td>
+        </tr>
+        <tr>
+         <td>
+{render acl=$avFlagsEACL}
+               <input type='checkbox' name='avFlagsE' {$avFlagsECHK} {$avFlagsAState} value='1' id='avFlagsE'>
+{/render}
+               {t}Block encrypted archives{/t}
+         </td>
+        </tr>
+       </table>
+  
+  </td>
+  <td  style="vertical-align:top;width:50%;border-left:1px solid #A0A0A0;">
+       <table>
+        <tr>
+         <td>{t}Maximum file size{/t}
+         </td>
+         <td>
+{render acl=$avArchiveMaxFileSizeACL}
+          <input name='avArchiveMaxFileSize' id='avArchiveMaxFileSize' value='{$avArchiveMaxFileSize}'  {$avFlagsAState} >
+{/render}
+         </td>
+        </tr>
+        <tr>
+         <td>{t}Maximum recursion{/t}
+         </td>
+         <td>
+{render acl=$avArchiveMaxRecursionACL}
+          <input name='avArchiveMaxRecursion' id='avArchiveMaxRecursion' value='{$avArchiveMaxRecursion}'  {$avFlagsAState} >
+{/render}
+         </td>
+        </tr>
+        <tr>
+         <td>{t}Maximum compression ratio{/t}
+         </td>
+         <td>
+{render acl=$avArchiveMaxCompressionRatioACL}
+          <input name='avArchiveMaxCompressionRatio' id='avArchiveMaxCompressionRatio' value='{$avArchiveMaxCompressionRatio}' {$avFlagsAState}>
+{/render}
+         </td>
+        </tr>
+       </table>
+  
+  </td>
+ </tr>
+</table>
+<input type='hidden' name='goVirusServer' value='1'>
+<p class='seperator'>&nbsp;</p>
+<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
+    <input type='submit' name='SaveService' value='{t}Save{/t}'>
+    &nbsp;
+    <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
+</div>
+
diff --git a/plugins/admin/systems/servkolab.tpl b/plugins/admin/systems/servkolab.tpl
deleted file mode 100644 (file)
index ec83b78..0000000
+++ /dev/null
@@ -1,249 +0,0 @@
-<table summary="" style="width:100%">
- <tr>
-  <td style="vertical-align:top; border-right:1px solid #A0A0A0; padding-right:5px;" width="50%">
-   <table summary="">
-    <tr>
-        <td colspan="2"><b>{t}Generic{/t}</b></td>
-       </tr>
-       <tr>
-               <td>{t}Postfix mydomain{/t}
-               </td>
-               <td>
-{render acl=$postfixmydomainACL}
-                       <input type="text" name="postfix_mydomain" value="{$postfix_mydomain}">
-{/render}
-               </td>
-       </tr>
-       <tr>
-               <td>{t}Postfix mydestination{/t}
-               </td>
-               <td>
-{render acl=$postfixmydestinationACL}
-                       <input type="text" name="postfix_mydestination" value="{$postfix_mydestination}">
-{/render}
-               </td>
-       </tr>
-       <tr>
-               <td>{t}Cyrus admins{/t}
-               </td>
-               <td>
-{render acl=$cyrusadminsACL}
-                       <input type="text" name="cyrus_admins" value="{$cyrus_admins}">
-{/render}
-               </td>
-       </tr>
-   </table>    
-   <p class="seperator" >&nbsp;</p>
-   <table summary="">
-    <tr>
-        <td colspan="2"><b>{t}Services{/t}</b></td>
-       </tr>
-       <tr>
-               <td>
-{render acl=$cyruspop3ACL}
-                       <input id="cyrus_pop3" name="cyrus_pop3" value="1" type="checkbox" {$cyrus_pop3Check}>
-{/render}
-               </td>
-               <td>
-                       <LABEL for="cyrus_pop3">{t}POP3 service{/t}</LABEL>
-               </td>
-       </tr>
-       <tr>
-        <td>
-{render acl=$cyruspop3sACL}
-            <input id="cyrus_pop3s" name="cyrus_pop3s" value="1" type="checkbox" {$cyrus_pop3sCheck}>
-{/render}
-        </td>
-               <td>
-                       <LABEL for="cyrus_pop3s">{t}POP3/SSL service{/t}</LABEL>
-        </td>
-    </tr>
-    <tr>
-        <td>
-{render acl=$cyrusimapACL}
-            <input id="cyrus_imap" name="cyrus_imap" value="1" type="checkbox" {$cyrus_imapCheck}>
-{/render}
-        </td>
-        <td>
-                       <LABEL for="cyrus_imap">{t}IMAP service{/t}</LABEL>
-        </td>
-    </tr>
-    <tr>
-        <td>
-{render acl=$cyrusimapsACL}
-            <input id="cyrus_imaps" name="cyrus_imaps" value="1" type="checkbox" {$cyrus_imapsCheck}>
-{/render}
-        </td>
-        <td>
-                       <LABEL for="cyrus_imaps">{t}IMAP/SSL service{/t}</LABEL>
-        </td>
-    </tr>
-    <tr>
-        <td>
-{render acl=$cyrussieveACL}
-            <input id="cyrus_sieve" name="cyrus_sieve" value="1" type="checkbox" {$cyrus_sieveCheck}>
-{/render}
-        </td>
-        <td>
-                       <LABEL for="cyrus_sieve">{t}Sieve service{/t}</LABEL>
-        </td>
-    </tr>
-    <tr>
-        <td>
-{render acl=$proftpdftpACL}
-            <input id="proftpd_ftp" name="proftpd_ftp" value="1" type="checkbox" {$proftpd_ftpCheck}>
-{/render}
-        </td>  
-        <td>
-                       <LABEL for="proftpd_ftp">{t}FTP FreeBusy service (legacy, not interoperable with Kolab2 FreeBusy){/t}</LABEL>
-        </td>
-    </tr>
-    <tr>
-        <td>
-{render acl=$apachehttpACL}
-            <input id="apache_http" name="apache_http" value="1" type="checkbox" {$apache_httpCheck}>
-{/render}
-        </td>
-        <td>
-                       <LABEL for="apache_http">{t}HTTP FreeBusy service (legacy){/t}</LABEL>
-        </td>
-    </tr>
-    <tr>
-        <td>
-{render acl=$postfixenablevirusscanACL}
-                       <input id="postfix_enable_virus_scan" name="postfix_enable_virus_scan" value="1" type="checkbox" {$postfix_enable_virus_scanCheck}>
-{/render}
-        </td>
-        <td>
-                       <LABEL for="postfix_enable_virus_scan">{t}Amavis email scanning (virus/spam){/t}</LABEL>
-               </td>
-       </tr>
-   </table>
-
-   <p class="seperator">&nbsp;</p>
-   <br>
-
-   <table summary="">
-    <tr>
-               <td> 
-                       <b>{t}Quota settings{/t}</b>
-               </td>
-       </tr>
-       <tr>
-               <td>
-{render acl=$cyrusquotawarnACL}
-                       {$quotastr}
-{/render}
-               </td>
-       </tr>
-   </table>
-  
-  </td>
-  <td style="vertical-align:top" width="50%">
-
-   <table summary="">
-    <tr>
-        <td colspan="2">
-            <b>{t}Free/Busy settings{/t}</b>
-        </td>
-    </tr>
-    <tr>
-        <td>
-{render acl=$apacheallowunauthenticatedfbACL}
-            <input name="apache_allow_unauthenticated_fb" value="1" type="checkbox" {$apache_allow_unauthenticated_fbCheck}> {t}Allow unauthenticated downloading of Free/Busy information{/t}
-{/render}
-        </td>
-        </tr>
-        <tr>
-        <td>
-{render acl=$kolabFreeBusyFutureACL}
-               {$fbfuture}
-{/render}
-       </td>
-     </tr>
-   </table>
-
-<p class="seperator">&nbsp;</p>
-<br>
-   <table summary="">
-    <tr>
-        <td>
-               <b>{t}SMTP privileged networks{/t}</b>
-               </td>
-    </tr>
-    <tr>
-         <td>
-           <LABEL for="postfix_mynetworks">{t}Hosts/networks allowed to relay{/t}</LABEL><br>
-{render acl=$postfixmynetworksACL}
-        <input id="postfix_mynetworks" name="postfix_mynetworks" size="60" maxlength="220" value="{$postfix_mynetworks}" type="text">
-{/render}
-               <br>
-               ( {t}Enter multiple values, seperated with{/t} , )
-       </td>
-     </tr>
-   </table>
-
-
-<p class="seperator">&nbsp;</p>
-<br>
-
-
-   <table summary="">
-    <tr>
-        <td>
-               <b>{t}SMTP smarthost/relayhost{/t}</b>
-               </td>
-    </tr>
-    <tr>
-        <td>
-{render acl=$postfixrelayhostACL}
-            <input id="RelayMxSupport" name="RelayMxSupport" value="1" type="checkbox" {$RelayMxSupportCheck}>
-{/render}
-                       <LABEL for="RelayMxSupport">{t}Enable MX lookup for relayhost{/t}</LABEL>
-               </td>
-     </tr>
-       <tr>    
-               <td>
-                   <LABEL for="postfix_relayhost">{t}Host used to relay mails{/t}</LABEL>&nbsp;
-{render acl=$postfixrelayhostACL}
-                       <input id="postfix_relayhost" name="postfix_relayhost" size="35" maxlength="120" value="{$postfix_relayhost}" type="text">
-{/render}
-               </td>
-       </tr>
-   </table>
-
-
-<p class="seperator">&nbsp;</p>
-<br>
-
-
-   <table summary="">
-    <tr>
-        <td>
-               <b>{t}Accept Internet Mail{/t}</b>
-               </td>
-    </tr>
-    <tr>
-        <td>
-{render acl=$postfixallowunauthenticatedACL}
-            <input id="postfix_allow_unauthenticated" name="postfix_allow_unauthenticated" value="1" type="checkbox" {$postfix_allow_unauthenticatedCheck}>
-{/render}
-               <LABEL for="postfix_allow_unauthenticated">{t}Accept mail from other domains over non-authenticated SMTP{/t}</LABEL>
-               </td>
-     </tr>
-   </table>
-
-
-  </td>
- </tr>
-</table>
-
-<input type="hidden" name="kolabtab">
-
-<p class="seperator">&nbsp;</p>
-<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
-    <input type='submit' name='SaveService' value='{t}Save{/t}'>
-    &nbsp;
-    <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
-</div>
-
diff --git a/plugins/admin/systems/servnfs.tpl b/plugins/admin/systems/servnfs.tpl
deleted file mode 100644 (file)
index 9fb70a5..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-<h2><img class="center" alt="" src="images/fai_partitionTable.png" align="middle">&nbsp;{t}Edit share{/t}</h2>
-<table summary="{t}NFS setup{/t}" width="100%">
-       <tr>
-               <td width="45%" style="vertical-align:top">
-               <!--Table left-top-->
-                       <table summary="">
-                               <tr>
-                                       <td>
-                                               {t}Name{/t} {$must}
-                                       </td>
-                                       <td>
-{render acl=$nameACL}
-                                               <input type="text" name="name" value="{$name}" >
-{/render}
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>
-                                               {t}Description{/t}
-                                       </td>
-                                       <td>
-{render acl=$descriptionACL}
-                                               <input type="text" size="40" name="description" value="{$description}">
-{/render}
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>
-                                               {t}Path{/t} / {t}Volume{/t}
-                                       </td>
-                                       <td>
-{render acl=$pathACL}
-                                               <input type="text" size="40" name="path" value="{$path}">
-{/render}
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>
-                                               <div id="vlabel">{t}Server{/t}</div>
-                                       </td>
-                                       <td>
-{render acl=$volumeACL}
-                                               <input type="text" id="volume" size="40" name="volume" value="{$volume}">
-{/render}
-                                       </td>
-                               </tr>
-                       </table>
-               </td>
-               <td style="border-left:1px solid #A0A0A0">
-
-               <!--Table right-top-->
-                       <table summary="">
-                               <tr>
-                                       <td style="vertical-align:top">
-
-                                               {t}Type{/t}
-                                       </td>
-                                       <td>
-{render acl=$typeACL}
-                                               <select size="1" name="type" id="sharetype">
-                                                       {html_options options=$types selected=$type}
-                                               </select>
-{/render}
-                                               {if $allow_mounts == TRUE}
-                                               <br><br>
-{render acl=$netatalkmountACL}
-                                               <input type="checkbox" name="netatalk_mount" id="netatalk_mount" {$mount_checked} />
-{/render}
-                                               <label for="netatalk_mount">{t}Auto-mount share on Apple systems{/t}</label>
-                                                       <br>
-                                                       <br>
-                                               {/if}
-
-                                                               {literal}
-                                                                       <script language="JavaScript">
-                                                                               document.getElementById('sharetype').onchange=function() {
-                                                                                       var foobar=this[this.selectedIndex].value;
-                                                                                       var box=document.getElementById('netatalk_mount');
-                                                                                       var volume=document.getElementById('volume');
-                                                                                       var vlabel=document.getElementById('vlabel');
-                                                               {/literal}
-                                                                       <!-- Only add checkbox enable/disable js part if checkbox is available --> 
-                                                                       {if $allow_mounts == TRUE}
-                                                                               {literal}
-                                                                                       if(foobar=="NFS"||foobar=="netatalk"){
-                                                                                               box.disabled=false;
-                                                                                       } else {
-                                                                                               box.disabled=true;
-                                                                                               box.checked=false;
-                                                                                       }
-                                                                               {/literal}
-                                                                       {/if}
-                                                               {literal}
-                                                                                       if(foobar=="NCP"){
-                                                                                               volume.style.visibility="visible";
-                                                                                               vlabel.style.visibility="visible";
-                                                                                       } else {
-                                                                                               volume.style.visibility="hidden";
-                                                                                               vlabel.style.visibility="hidden";
-                                                                                       }
-                                                                               };
-                                                                               document.getElementById('sharetype').onchange();
-                                                                       </script>
-                                                               {/literal}
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>
-                                               {t}Codepage{/t}
-                                       </td>
-                                       <td>
-{render acl=$charsetACL}
-                                               <select size="1" name="charset">
-                                                       {html_options options=$charsets selected=$charset}
-                                               </select>       
-{/render}
-                                       </td>
-                               </tr>
-                               <tr>
-                                   <td>
-                                       {t}Option{/t}
-                                   </td>
-                                   <td>
-{render acl=$optionACL}
-                                                               <input type="text" name="option" value="{$option}">
-{/render}
-                                   </td>
-                               </tr>
-                       </table>
-               </td>
-       </tr>
-       <tr>
-               <td colspan=2>
-                       <p class="seperator">&nbsp;</p>
-               </td>
-       </tr>
-       <tr>
-               <td colspan=2 style="text-align:right">
-                       <input type="submit" name="NFSsave" value="{t}Save{/t}">
-                       <input type="submit" name="NFScancel" value="{t}Cancel{/t}">
-               </td>
-       </tr>
-</table>
-<input type='hidden' name='servnfs_posted' value='1'>