Code

Starting move
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 12 Dec 2007 11:33:27 +0000 (11:33 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 12 Dec 2007 11:33:27 +0000 (11:33 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8099 594d385d-05f5-0310-b6e9-bd551577e9d8

996 files changed:
README [deleted file]
README.safemode [deleted file]
gosa-core/README [new file with mode: 0644]
gosa-core/README.safemode [new file with mode: 0644]
gosa-core/plugins/addons/addressbook/address_edit.tpl [new file with mode: 0644]
gosa-core/plugins/addons/addressbook/address_info.tpl [new file with mode: 0644]
gosa-core/plugins/addons/addressbook/class_addressbook.inc [new file with mode: 0644]
gosa-core/plugins/addons/addressbook/contents.tpl [new file with mode: 0644]
gosa-core/plugins/addons/addressbook/dial.tpl [new file with mode: 0644]
gosa-core/plugins/addons/addressbook/main.inc [new file with mode: 0644]
gosa-core/plugins/addons/addressbook/remove.tpl [new file with mode: 0644]
gosa-core/plugins/addons/bugsubmitter/class_bugsubmitter.inc [new file with mode: 0644]
gosa-core/plugins/addons/bugsubmitter/main.inc [new file with mode: 0644]
gosa-core/plugins/addons/godfs/class_dfsManagment.inc [new file with mode: 0644]
gosa-core/plugins/addons/godfs/class_dfsgeneric.inc [new file with mode: 0644]
gosa-core/plugins/addons/godfs/contents.tpl [new file with mode: 0644]
gosa-core/plugins/addons/godfs/generic.tpl [new file with mode: 0644]
gosa-core/plugins/addons/godfs/main.inc [new file with mode: 0644]
gosa-core/plugins/addons/godfs/tabs_dfs.inc [new file with mode: 0644]
gosa-core/plugins/addons/gotomasses/class_divListMasses.inc [new file with mode: 0644]
gosa-core/plugins/addons/gotomasses/class_goto_task.inc [new file with mode: 0644]
gosa-core/plugins/addons/gotomasses/class_gotomasses.inc [new file with mode: 0644]
gosa-core/plugins/addons/gotomasses/class_target_list.inc [new file with mode: 0644]
gosa-core/plugins/addons/gotomasses/goto_task.tpl [new file with mode: 0644]
gosa-core/plugins/addons/gotomasses/main.inc [new file with mode: 0644]
gosa-core/plugins/addons/gotomasses/remove.tpl [new file with mode: 0644]
gosa-core/plugins/addons/ldapmanager/class_csvimport.inc [new file with mode: 0644]
gosa-core/plugins/addons/ldapmanager/class_export.inc [new file with mode: 0644]
gosa-core/plugins/addons/ldapmanager/class_exportxls.inc [new file with mode: 0644]
gosa-core/plugins/addons/ldapmanager/class_import.inc [new file with mode: 0644]
gosa-core/plugins/addons/ldapmanager/class_ldif.inc [new file with mode: 0644]
gosa-core/plugins/addons/ldapmanager/contentcsv.tpl [new file with mode: 0644]
gosa-core/plugins/addons/ldapmanager/contentexport.tpl [new file with mode: 0644]
gosa-core/plugins/addons/ldapmanager/contentexportxls.tpl [new file with mode: 0644]
gosa-core/plugins/addons/ldapmanager/contentimport.tpl [new file with mode: 0644]
gosa-core/plugins/addons/ldapmanager/main.inc [new file with mode: 0644]
gosa-core/plugins/addons/ldapmanager/tabs_ldif.inc [new file with mode: 0644]
gosa-core/plugins/addons/logview/class_gosa_logview.inc [new file with mode: 0644]
gosa-core/plugins/addons/logview/class_logview.inc [new file with mode: 0644]
gosa-core/plugins/addons/logview/contents.tpl [new file with mode: 0644]
gosa-core/plugins/addons/logview/gosa_log_contents.tpl [new file with mode: 0644]
gosa-core/plugins/addons/logview/main.inc [new file with mode: 0644]
gosa-core/plugins/addons/logview/tabs_log.inc [new file with mode: 0644]
gosa-core/plugins/addons/mailqueue/class_mailqueue.inc [new file with mode: 0644]
gosa-core/plugins/addons/mailqueue/class_parseMailQueue.inc [new file with mode: 0644]
gosa-core/plugins/addons/mailqueue/contents.tpl [new file with mode: 0644]
gosa-core/plugins/addons/mailqueue/header.tpl [new file with mode: 0644]
gosa-core/plugins/addons/mailqueue/main.inc [new file with mode: 0644]
gosa-core/plugins/addons/notifications/class_msgplug.inc [new file with mode: 0644]
gosa-core/plugins/addons/notifications/contents.tpl [new file with mode: 0644]
gosa-core/plugins/addons/notifications/main.inc [new file with mode: 0644]
gosa-core/plugins/admin/acl/acl_role.tpl [new file with mode: 0644]
gosa-core/plugins/admin/acl/class_aclManagement.inc [new file with mode: 0644]
gosa-core/plugins/admin/acl/class_aclRole.inc [new file with mode: 0644]
gosa-core/plugins/admin/acl/class_divListACL.inc [new file with mode: 0644]
gosa-core/plugins/admin/acl/main.inc [new file with mode: 0644]
gosa-core/plugins/admin/acl/paste_role.tpl [new file with mode: 0644]
gosa-core/plugins/admin/acl/remove.tpl [new file with mode: 0755]
gosa-core/plugins/admin/acl/tabs_acl.inc [new file with mode: 0644]
gosa-core/plugins/admin/acl/tabs_acl_role.inc [new file with mode: 0644]
gosa-core/plugins/admin/applications/class_applicationGeneric.inc [new file with mode: 0644]
gosa-core/plugins/admin/applications/class_applicationManagement.inc [new file with mode: 0644]
gosa-core/plugins/admin/applications/class_applicationParameters.inc [new file with mode: 0644]
gosa-core/plugins/admin/applications/class_divListApplication.inc [new file with mode: 0755]
gosa-core/plugins/admin/applications/generic.tpl [new file with mode: 0644]
gosa-core/plugins/admin/applications/main.inc [new file with mode: 0644]
gosa-core/plugins/admin/applications/parameters.tpl [new file with mode: 0644]
gosa-core/plugins/admin/applications/release_select.tpl [new file with mode: 0755]
gosa-core/plugins/admin/applications/remove.tpl [new file with mode: 0644]
gosa-core/plugins/admin/applications/tabs_application.inc [new file with mode: 0644]
gosa-core/plugins/admin/departments/class_departmentGeneric.inc [new file with mode: 0644]
gosa-core/plugins/admin/departments/class_departmentManagement.inc [new file with mode: 0644]
gosa-core/plugins/admin/departments/class_divListDepartment.inc [new file with mode: 0755]
gosa-core/plugins/admin/departments/dep_iframe.tpl [new file with mode: 0644]
gosa-core/plugins/admin/departments/dep_move_confirm.tpl [new file with mode: 0644]
gosa-core/plugins/admin/departments/generic.tpl [new file with mode: 0644]
gosa-core/plugins/admin/departments/main.inc [new file with mode: 0644]
gosa-core/plugins/admin/departments/remove.tpl [new file with mode: 0644]
gosa-core/plugins/admin/departments/tabs_department.inc [new file with mode: 0644]
gosa-core/plugins/admin/devices/class_deviceGeneric.inc [new file with mode: 0644]
gosa-core/plugins/admin/devices/class_deviceManagement.inc [new file with mode: 0644]
gosa-core/plugins/admin/devices/class_divListDevices.inc [new file with mode: 0755]
gosa-core/plugins/admin/devices/deviceGeneric.tpl [new file with mode: 0644]
gosa-core/plugins/admin/devices/main.inc [new file with mode: 0755]
gosa-core/plugins/admin/devices/paste_deviceGeneric.tpl [new file with mode: 0644]
gosa-core/plugins/admin/devices/remove.tpl [new file with mode: 0755]
gosa-core/plugins/admin/devices/tabs_devices.inc [new file with mode: 0755]
gosa-core/plugins/admin/fai/askClassName.tpl [new file with mode: 0644]
gosa-core/plugins/admin/fai/branch_selector.tpl [new file with mode: 0644]
gosa-core/plugins/admin/fai/class_askClassName.inc [new file with mode: 0644]
gosa-core/plugins/admin/fai/class_divListFai.inc [new file with mode: 0644]
gosa-core/plugins/admin/fai/class_faiHook.inc [new file with mode: 0644]
gosa-core/plugins/admin/fai/class_faiHookEntry.inc [new file with mode: 0644]
gosa-core/plugins/admin/fai/class_faiManagement.inc [new file with mode: 0644]
gosa-core/plugins/admin/fai/class_faiPackage.inc [new file with mode: 0644]
gosa-core/plugins/admin/fai/class_faiPackageConfiguration.inc [new file with mode: 0644]
gosa-core/plugins/admin/fai/class_faiPackageEntry.inc [new file with mode: 0644]
gosa-core/plugins/admin/fai/class_faiPartitionTable.inc [new file with mode: 0644]
gosa-core/plugins/admin/fai/class_faiPartitionTableEntry.inc [new file with mode: 0644]
gosa-core/plugins/admin/fai/class_faiProfile.inc [new file with mode: 0644]
gosa-core/plugins/admin/fai/class_faiProfileEntry.inc [new file with mode: 0644]
gosa-core/plugins/admin/fai/class_faiScript.inc [new file with mode: 0644]
gosa-core/plugins/admin/fai/class_faiScriptEntry.inc [new file with mode: 0644]
gosa-core/plugins/admin/fai/class_faiSummaryTab.inc [new file with mode: 0644]
gosa-core/plugins/admin/fai/class_faiTemplate.inc [new file with mode: 0644]
gosa-core/plugins/admin/fai/class_faiTemplateEntry.inc [new file with mode: 0644]
gosa-core/plugins/admin/fai/class_faiVariable.inc [new file with mode: 0644]
gosa-core/plugins/admin/fai/class_faiVariableEntry.inc [new file with mode: 0644]
gosa-core/plugins/admin/fai/faiHook.tpl [new file with mode: 0644]
gosa-core/plugins/admin/fai/faiHookEntry.tpl [new file with mode: 0644]
gosa-core/plugins/admin/fai/faiNewBranch.tpl [new file with mode: 0755]
gosa-core/plugins/admin/fai/faiPackage.tpl [new file with mode: 0644]
gosa-core/plugins/admin/fai/faiPackageConfiguration.tpl [new file with mode: 0644]
gosa-core/plugins/admin/fai/faiPackageEntry.tpl [new file with mode: 0644]
gosa-core/plugins/admin/fai/faiPartitionTable.tpl [new file with mode: 0644]
gosa-core/plugins/admin/fai/faiPartitionTableEntry.tpl [new file with mode: 0644]
gosa-core/plugins/admin/fai/faiProfile.tpl [new file with mode: 0644]
gosa-core/plugins/admin/fai/faiProfileEntry.tpl [new file with mode: 0644]
gosa-core/plugins/admin/fai/faiScript.tpl [new file with mode: 0644]
gosa-core/plugins/admin/fai/faiScriptEntry.tpl [new file with mode: 0644]
gosa-core/plugins/admin/fai/faiSummary.tpl [new file with mode: 0644]
gosa-core/plugins/admin/fai/faiTemplate.tpl [new file with mode: 0644]
gosa-core/plugins/admin/fai/faiTemplateEntry.tpl [new file with mode: 0644]
gosa-core/plugins/admin/fai/faiVariable.tpl [new file with mode: 0644]
gosa-core/plugins/admin/fai/faiVariableEntry.tpl [new file with mode: 0644]
gosa-core/plugins/admin/fai/main.inc [new file with mode: 0644]
gosa-core/plugins/admin/fai/remove.tpl [new file with mode: 0644]
gosa-core/plugins/admin/fai/remove_branch.tpl [new file with mode: 0755]
gosa-core/plugins/admin/fai/tabsHook.inc [new file with mode: 0644]
gosa-core/plugins/admin/fai/tabsPackage.inc [new file with mode: 0644]
gosa-core/plugins/admin/fai/tabsPartition.inc [new file with mode: 0644]
gosa-core/plugins/admin/fai/tabsProfile.inc [new file with mode: 0644]
gosa-core/plugins/admin/fai/tabsScript.inc [new file with mode: 0644]
gosa-core/plugins/admin/fai/tabsTemplate.inc [new file with mode: 0644]
gosa-core/plugins/admin/fai/tabsVariable.inc [new file with mode: 0644]
gosa-core/plugins/admin/groups/application.tpl [new file with mode: 0644]
gosa-core/plugins/admin/groups/application_options.tpl [new file with mode: 0644]
gosa-core/plugins/admin/groups/class_divListGroup.inc [new file with mode: 0644]
gosa-core/plugins/admin/groups/class_groupApplication.inc [new file with mode: 0644]
gosa-core/plugins/admin/groups/class_groupGeneric.inc [new file with mode: 0644]
gosa-core/plugins/admin/groups/class_groupMail.inc [new file with mode: 0644]
gosa-core/plugins/admin/groups/class_groupManagement.inc [new file with mode: 0644]
gosa-core/plugins/admin/groups/generic.tpl [new file with mode: 0644]
gosa-core/plugins/admin/groups/group_objects.tpl [new file with mode: 0644]
gosa-core/plugins/admin/groups/mail.tpl [new file with mode: 0644]
gosa-core/plugins/admin/groups/mail_admins.tpl [new file with mode: 0644]
gosa-core/plugins/admin/groups/mail_locals.tpl [new file with mode: 0644]
gosa-core/plugins/admin/groups/main.inc [new file with mode: 0644]
gosa-core/plugins/admin/groups/paste_generic.tpl [new file with mode: 0644]
gosa-core/plugins/admin/groups/paste_mail.tpl [new file with mode: 0644]
gosa-core/plugins/admin/groups/remove.tpl [new file with mode: 0644]
gosa-core/plugins/admin/groups/tabs_group.inc [new file with mode: 0644]
gosa-core/plugins/admin/mimetypes/class_divListMimeTypes.inc [new file with mode: 0755]
gosa-core/plugins/admin/mimetypes/class_mimetypeGeneric.inc [new file with mode: 0644]
gosa-core/plugins/admin/mimetypes/class_mimetypeManagement.inc [new file with mode: 0755]
gosa-core/plugins/admin/mimetypes/generic.tpl [new file with mode: 0644]
gosa-core/plugins/admin/mimetypes/main.inc [new file with mode: 0755]
gosa-core/plugins/admin/mimetypes/paste_generic.tpl [new file with mode: 0644]
gosa-core/plugins/admin/mimetypes/release_select.tpl [new file with mode: 0755]
gosa-core/plugins/admin/mimetypes/remove.tpl [new file with mode: 0755]
gosa-core/plugins/admin/mimetypes/tabs_mimetypes.inc [new file with mode: 0755]
gosa-core/plugins/admin/ogroups/class_divListOGroup.inc [new file with mode: 0755]
gosa-core/plugins/admin/ogroups/class_mailogroup.inc [new file with mode: 0644]
gosa-core/plugins/admin/ogroups/class_ogroup.inc [new file with mode: 0644]
gosa-core/plugins/admin/ogroups/class_ogroupManagement.inc [new file with mode: 0644]
gosa-core/plugins/admin/ogroups/class_phonequeue.inc [new file with mode: 0644]
gosa-core/plugins/admin/ogroups/class_termgroup.inc [new file with mode: 0644]
gosa-core/plugins/admin/ogroups/generic.tpl [new file with mode: 0644]
gosa-core/plugins/admin/ogroups/mail.tpl [new file with mode: 0644]
gosa-core/plugins/admin/ogroups/main.inc [new file with mode: 0644]
gosa-core/plugins/admin/ogroups/ogroup_objects.tpl [new file with mode: 0644]
gosa-core/plugins/admin/ogroups/paste_generic.tpl [new file with mode: 0644]
gosa-core/plugins/admin/ogroups/paste_mail.tpl [new file with mode: 0644]
gosa-core/plugins/admin/ogroups/phonequeue.tpl [new file with mode: 0644]
gosa-core/plugins/admin/ogroups/remove.tpl [new file with mode: 0644]
gosa-core/plugins/admin/ogroups/tabs_ogroups.inc [new file with mode: 0644]
gosa-core/plugins/admin/ogroups/termgroup.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/ArpNewDevice.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/SelectDeviceType.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/chooser.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/class_ArpNewDevice.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/class_SelectDeviceType.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/class_baseSelectDialog.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/class_componentGeneric.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/class_divListRepositories.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/class_divListSystem.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/class_divListSystemService.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/class_phoneGeneric.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/class_printGeneric.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/class_selectUserToPrinterDialog.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/class_servGeneric.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/class_serverService.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/class_systemManagement.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/class_terminalGeneric.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/class_terminalInfo.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/class_terminalService.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/class_terminalStartup.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/class_winGeneric.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/class_workstationGeneric.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/class_workstationService.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/class_workstationStartup.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/component.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/contents.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/gencd.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/gencd_frame.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/info.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/main.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/network.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/password.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/paste_generic.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/phone.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/phonesettings.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/ppd/class_printerPPDDialog.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/ppd/class_printerPPDSelectionDialog.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/ppd/printerPPDDialog.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/ppd/printerPPDSelectionDialog.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/ppd/remove_ppd.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/printer.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/remove.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/selectUserToPrinterDialog.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/server.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/ServiceAddDialog.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/class_ServiceAddDialog.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/class_goService.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/cups/class_goCupsServer.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/cups/goCupsServer.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/dhcp/class_dhcpAdvanced.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/dhcp/class_dhcpGroup.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/dhcp/class_dhcpHost.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/dhcp/class_dhcpNetwork.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/dhcp/class_dhcpNewSectionDialog.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/dhcp/class_dhcpPool.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/dhcp/class_dhcpService.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/dhcp/class_dhcpSharedNetwork.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/dhcp/class_dhcpSubnet.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/dhcp/class_servDHCP.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/dhcp/dhcpNewSection.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/dhcp/dhcp_advanced.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/dhcp/dhcp_group.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/dhcp/dhcp_host.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/dhcp/dhcp_network.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/dhcp/dhcp_pool.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/dhcp/dhcp_service.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/dhcp/dhcp_sharedNetwork.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/dhcp/dhcp_subnet.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/dhcp/remove_dhcp.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/dhcp/servdhcp.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/dns/class_servDNS.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/dns/class_servDNSeditZone.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/dns/class_servDNSeditZoneEntries.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/dns/class_termDNS.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/dns/servDNSeditZoneEntries.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/dns/servdns.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/dns/servdnseditzone.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/glpi/class_glpiAccount.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/glpi/class_glpiAttachmentPool.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/glpi/class_glpiDeviceManagement.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/glpi/class_glpiManufacturer.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/glpi/class_glpiPrinterAccount.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/glpi/class_glpiPrinterCartridges.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/glpi/class_glpiPrinterCartridgesEdit.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/glpi/class_glpiSelectUser.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/glpi/class_goGlpiServer.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/glpi/glpi.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/glpi/glpiAttachmentEdit.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/glpi/glpiAttachmentPool.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/glpi/glpiDeviceManagement.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/glpi/glpiManufacturer.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/glpi/glpiManufacturerAdd.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/glpi/glpiPrinter.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/glpi/glpiPrinterCartridges.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/glpi/glpiPrinterCartridgesEdit.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/glpi/glpiSelectUser.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/glpi/glpi_devices.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/glpi/glpi_edit_cartridge_type.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/glpi/glpi_edit_os.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/glpi/glpi_edit_printer_type.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/glpi/glpi_edit_type.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/glpi/goGlpiServer.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/glpi/remove_glpi.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/gofax/class_goFaxServer.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/gofax/goFaxServer.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/gofon/class_goFonServer.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/gofon/goFonServer.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/imap/class_goImapServer.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/imap/goImapServer.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/kerberos/class_goKrbServer.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/kerberos/goKrbServer.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/kiosk/class_goKioskService.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/kiosk/goKioskService.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/kolab/class_servKolab.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/kolab/servkolab.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/ldap/class_goLdapServer.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/ldap/goLdapServer.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/log/class_gosaLogServer.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/log/gosaLogServer.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/mail/class_goMailServer.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/mail/goMailServer.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/nfs/class_servNfs.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/nfs/servnfs.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/ntp/class_goNtpServer.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/ntp/goNtpServer.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/repository/class_servRepository.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/repository/class_servRepositorySetup.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/repository/servRepository.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/repository/servRepositorySetup.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/shares/class_goShareServer.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/shares/goShareServer.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/spam/class_goSpamServer.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/spam/class_goSpamServerRule.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/spam/goSpamServer.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/spam/goSpamServerRule.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/syslog/class_goLogDBServer.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/syslog/class_goSyslogServer.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/syslog/goLogDBServer.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/syslog/goSyslogServer.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/terminal/class_goTerminalServer.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/terminal/goTerminalServer.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/virus/class_goVirusServer.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/services/virus/goVirusServer.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/tabs_arpnewdevice.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/tabs_component.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/tabs_phone.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/tabs_printers.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/tabs_server.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/tabs_terminal.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/tabs_winstation.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/tabs_workstation.inc [new file with mode: 0644]
gosa-core/plugins/admin/systems/terminal.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/terminalService.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/terminalStartup.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/wingeneric.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/workstation.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/workstationService.tpl [new file with mode: 0644]
gosa-core/plugins/admin/systems/workstationStartup.tpl [new file with mode: 0644]
gosa-core/plugins/admin/users/class_divListUsers.inc [new file with mode: 0644]
gosa-core/plugins/admin/users/class_userManagement.inc [new file with mode: 0644]
gosa-core/plugins/admin/users/main.inc [new file with mode: 0644]
gosa-core/plugins/admin/users/password.tpl [new file with mode: 0644]
gosa-core/plugins/admin/users/remove.tpl [new file with mode: 0644]
gosa-core/plugins/admin/users/tabs_user.inc [new file with mode: 0644]
gosa-core/plugins/admin/users/template.tpl [new file with mode: 0644]
gosa-core/plugins/generic/references/class_reference.inc [new file with mode: 0644]
gosa-core/plugins/generic/references/contents.tpl [new file with mode: 0644]
gosa-core/plugins/generic/welcome/main.inc [new file with mode: 0644]
gosa-core/plugins/generic/welcome/welcome.tpl [new file with mode: 0644]
gosa-core/plugins/gofax/blocklists/class_blocklistGeneric.inc [new file with mode: 0644]
gosa-core/plugins/gofax/blocklists/class_blocklistManagement.inc [new file with mode: 0644]
gosa-core/plugins/gofax/blocklists/class_divListBlocklists.inc [new file with mode: 0755]
gosa-core/plugins/gofax/blocklists/generic.tpl [new file with mode: 0644]
gosa-core/plugins/gofax/blocklists/main.inc [new file with mode: 0644]
gosa-core/plugins/gofax/blocklists/paste_generic.tpl [new file with mode: 0644]
gosa-core/plugins/gofax/blocklists/remove.tpl [new file with mode: 0644]
gosa-core/plugins/gofax/blocklists/tabs_blocklist.inc [new file with mode: 0644]
gosa-core/plugins/gofax/faxaccount/class_gofaxAccount.inc [new file with mode: 0644]
gosa-core/plugins/gofax/faxaccount/generic.tpl [new file with mode: 0644]
gosa-core/plugins/gofax/faxaccount/lists.tpl [new file with mode: 0644]
gosa-core/plugins/gofax/faxaccount/locals.tpl [new file with mode: 0644]
gosa-core/plugins/gofax/faxaccount/main.inc [new file with mode: 0644]
gosa-core/plugins/gofax/faxaccount/paste_generic.tpl [new file with mode: 0644]
gosa-core/plugins/gofax/faxreports/class_faxreport.inc [new file with mode: 0644]
gosa-core/plugins/gofax/faxreports/contents.tpl [new file with mode: 0644]
gosa-core/plugins/gofax/faxreports/detail.tpl [new file with mode: 0644]
gosa-core/plugins/gofax/faxreports/main.inc [new file with mode: 0644]
gosa-core/plugins/gofon/conference/class_divListConferences.inc [new file with mode: 0755]
gosa-core/plugins/gofon/conference/class_phoneConferenceGeneric.inc [new file with mode: 0644]
gosa-core/plugins/gofon/conference/class_phoneConferenceManagment.inc [new file with mode: 0644]
gosa-core/plugins/gofon/conference/generic.tpl [new file with mode: 0644]
gosa-core/plugins/gofon/conference/headpage.tpl [new file with mode: 0644]
gosa-core/plugins/gofon/conference/main.inc [new file with mode: 0644]
gosa-core/plugins/gofon/conference/paste_generic.tpl [new file with mode: 0644]
gosa-core/plugins/gofon/conference/remove.tpl [new file with mode: 0644]
gosa-core/plugins/gofon/conference/tabs_conference.inc [new file with mode: 0644]
gosa-core/plugins/gofon/fonreports/class_fonreport.inc [new file with mode: 0644]
gosa-core/plugins/gofon/fonreports/contents.tpl [new file with mode: 0644]
gosa-core/plugins/gofon/fonreports/main.inc [new file with mode: 0644]
gosa-core/plugins/gofon/macro/class_divListMacros.inc [new file with mode: 0755]
gosa-core/plugins/gofon/macro/class_gofonMacro.inc [new file with mode: 0755]
gosa-core/plugins/gofon/macro/class_gofonMacroManagement.inc [new file with mode: 0755]
gosa-core/plugins/gofon/macro/class_gofonMacroParameters.inc [new file with mode: 0755]
gosa-core/plugins/gofon/macro/generic.tpl [new file with mode: 0755]
gosa-core/plugins/gofon/macro/headpage.tpl [new file with mode: 0755]
gosa-core/plugins/gofon/macro/main.inc [new file with mode: 0755]
gosa-core/plugins/gofon/macro/parameter.tpl [new file with mode: 0755]
gosa-core/plugins/gofon/macro/paste_generic.tpl [new file with mode: 0644]
gosa-core/plugins/gofon/macro/remove.tpl [new file with mode: 0755]
gosa-core/plugins/gofon/macro/tabs_macros.inc [new file with mode: 0755]
gosa-core/plugins/gofon/phoneaccount/class_phoneAccount.inc [new file with mode: 0644]
gosa-core/plugins/gofon/phoneaccount/generic.tpl [new file with mode: 0644]
gosa-core/plugins/gofon/phoneaccount/main.inc [new file with mode: 0644]
gosa-core/plugins/gofon/phoneaccount/paste_generic.tpl [new file with mode: 0644]
gosa-core/plugins/personal/connectivity/class_connectivity.inc [new file with mode: 0644]
gosa-core/plugins/personal/connectivity/class_intranetAccount.inc [new file with mode: 0644]
gosa-core/plugins/personal/connectivity/class_kolabAccount.inc [new file with mode: 0644]
gosa-core/plugins/personal/connectivity/class_opengwAccount.inc [new file with mode: 0644]
gosa-core/plugins/personal/connectivity/class_oxchangeAccount.inc [new file with mode: 0644]
gosa-core/plugins/personal/connectivity/class_phpgwAccount.inc [new file with mode: 0644]
gosa-core/plugins/personal/connectivity/class_phpscheduleitAccount.inc [new file with mode: 0644]
gosa-core/plugins/personal/connectivity/class_pptpAccount.inc [new file with mode: 0644]
gosa-core/plugins/personal/connectivity/class_proxyAccount.inc [new file with mode: 0644]
gosa-core/plugins/personal/connectivity/class_pureftpdAccount.inc [new file with mode: 0644]
gosa-core/plugins/personal/connectivity/class_webdavAccount.inc [new file with mode: 0644]
gosa-core/plugins/personal/connectivity/glpi.tpl [new file with mode: 0644]
gosa-core/plugins/personal/connectivity/intranet.tpl [new file with mode: 0644]
gosa-core/plugins/personal/connectivity/kolab.tpl [new file with mode: 0644]
gosa-core/plugins/personal/connectivity/main.inc [new file with mode: 0644]
gosa-core/plugins/personal/connectivity/opengw.tpl [new file with mode: 0644]
gosa-core/plugins/personal/connectivity/oxchange.tpl [new file with mode: 0644]
gosa-core/plugins/personal/connectivity/phpgw.tpl [new file with mode: 0644]
gosa-core/plugins/personal/connectivity/phpscheduleit.tpl [new file with mode: 0644]
gosa-core/plugins/personal/connectivity/pptp.tpl [new file with mode: 0644]
gosa-core/plugins/personal/connectivity/proxy.tpl [new file with mode: 0644]
gosa-core/plugins/personal/connectivity/pureftpd.tpl [new file with mode: 0644]
gosa-core/plugins/personal/connectivity/webdav.tpl [new file with mode: 0644]
gosa-core/plugins/personal/environment/class_environment.inc [new file with mode: 0644]
gosa-core/plugins/personal/environment/class_hotplugDialog.inc [new file with mode: 0644]
gosa-core/plugins/personal/environment/class_logonManagementDialog.inc [new file with mode: 0644]
gosa-core/plugins/personal/environment/class_selectPrinterDialog.inc [new file with mode: 0644]
gosa-core/plugins/personal/environment/environment.tpl [new file with mode: 0644]
gosa-core/plugins/personal/environment/hotplugDialog.tpl [new file with mode: 0644]
gosa-core/plugins/personal/environment/logonManagement.tpl [new file with mode: 0644]
gosa-core/plugins/personal/environment/main.inc [new file with mode: 0644]
gosa-core/plugins/personal/environment/selectPrinterDialog.tpl [new file with mode: 0644]
gosa-core/plugins/personal/generic/class_user.inc [new file with mode: 0644]
gosa-core/plugins/personal/generic/generic.tpl [new file with mode: 0644]
gosa-core/plugins/personal/generic/generic_certs.tpl [new file with mode: 0644]
gosa-core/plugins/personal/generic/generic_picture.tpl [new file with mode: 0644]
gosa-core/plugins/personal/generic/main.inc [new file with mode: 0644]
gosa-core/plugins/personal/generic/multiple_generic.tpl [new file with mode: 0644]
gosa-core/plugins/personal/generic/password.tpl [new file with mode: 0644]
gosa-core/plugins/personal/generic/paste_generic.tpl [new file with mode: 0644]
gosa-core/plugins/personal/mail/class_mailAccount.inc [new file with mode: 0644]
gosa-core/plugins/personal/mail/copypaste.tpl [new file with mode: 0644]
gosa-core/plugins/personal/mail/generic.tpl [new file with mode: 0644]
gosa-core/plugins/personal/mail/mail_locals.tpl [new file with mode: 0644]
gosa-core/plugins/personal/mail/main.inc [new file with mode: 0644]
gosa-core/plugins/personal/mail/sieve-discard.txt [new file with mode: 0644]
gosa-core/plugins/personal/mail/sieve-header.txt [new file with mode: 0644]
gosa-core/plugins/personal/mail/sieve-mailsize.txt [new file with mode: 0644]
gosa-core/plugins/personal/mail/sieve-spam.txt [new file with mode: 0644]
gosa-core/plugins/personal/mail/sieve-vacation.txt [new file with mode: 0644]
gosa-core/plugins/personal/nagios/class_nagiosAccount.inc [new file with mode: 0644]
gosa-core/plugins/personal/nagios/main.inc [new file with mode: 0644]
gosa-core/plugins/personal/nagios/nagios.tpl [new file with mode: 0644]
gosa-core/plugins/personal/netatalk/class_netatalk.inc [new file with mode: 0644]
gosa-core/plugins/personal/netatalk/main.inc [new file with mode: 0644]
gosa-core/plugins/personal/netatalk/netatalk.tpl [new file with mode: 0644]
gosa-core/plugins/personal/password/changed.tpl [new file with mode: 0644]
gosa-core/plugins/personal/password/class_password.inc [new file with mode: 0644]
gosa-core/plugins/personal/password/main.inc [new file with mode: 0644]
gosa-core/plugins/personal/password/nochange.tpl [new file with mode: 0644]
gosa-core/plugins/personal/password/password.tpl [new file with mode: 0644]
gosa-core/plugins/personal/posix/class_posixAccount.inc [new file with mode: 0644]
gosa-core/plugins/personal/posix/generic.tpl [new file with mode: 0644]
gosa-core/plugins/personal/posix/main.inc [new file with mode: 0644]
gosa-core/plugins/personal/posix/paste_generic.tpl [new file with mode: 0644]
gosa-core/plugins/personal/posix/posix_groups.tpl [new file with mode: 0644]
gosa-core/plugins/personal/posix/posix_shadow.tpl [new file with mode: 0644]
gosa-core/plugins/personal/posix/trust_machines.tpl [new file with mode: 0644]
gosa-core/plugins/personal/samba/class_sambaAccount.inc [new file with mode: 0644]
gosa-core/plugins/personal/samba/class_sambaLogonHours.inc [new file with mode: 0644]
gosa-core/plugins/personal/samba/main.inc [new file with mode: 0644]
gosa-core/plugins/personal/samba/samba2.tpl [new file with mode: 0644]
gosa-core/plugins/personal/samba/samba3.tpl [new file with mode: 0644]
gosa-core/plugins/personal/samba/samba3_workstations.tpl [new file with mode: 0644]
gosa-core/plugins/personal/samba/sambaLogonHours.tpl [new file with mode: 0644]
gosa-core/plugins/personal/scalix/class_scalixAccount.inc [new file with mode: 0644]
gosa-core/plugins/personal/scalix/generic.tpl [new file with mode: 0644]
gosa-core/plugins/personal/scalix/main.inc [new file with mode: 0644]
gosa-core/plugins/personal/scalix/paste_generic.tpl [new file with mode: 0644]
gosa-core/setup/class_setup.inc [new file with mode: 0644]
gosa-core/setup/class_setupStep.inc [new file with mode: 0644]
gosa-core/setup/class_setupStep_Checks.inc [new file with mode: 0644]
gosa-core/setup/class_setupStep_Config1.inc [new file with mode: 0644]
gosa-core/setup/class_setupStep_Config2.inc [new file with mode: 0644]
gosa-core/setup/class_setupStep_Config3.inc [new file with mode: 0644]
gosa-core/setup/class_setupStep_Feedback.inc [new file with mode: 0644]
gosa-core/setup/class_setupStep_Finish.inc [new file with mode: 0644]
gosa-core/setup/class_setupStep_Language.inc [new file with mode: 0644]
gosa-core/setup/class_setupStep_Ldap.inc [new file with mode: 0644]
gosa-core/setup/class_setupStep_License.inc [new file with mode: 0644]
gosa-core/setup/class_setupStep_Migrate.inc [new file with mode: 0644]
gosa-core/setup/class_setupStep_Schema.inc [new file with mode: 0644]
gosa-core/setup/class_setupStep_Welcome.inc [new file with mode: 0644]
gosa-core/setup/license.txt [new file with mode: 0644]
gosa-core/setup/main.inc [new file with mode: 0644]
gosa-core/setup/setup.tpl [new file with mode: 0644]
gosa-core/setup/setup_checks.tpl [new file with mode: 0644]
gosa-core/setup/setup_config1.tpl [new file with mode: 0644]
gosa-core/setup/setup_config2.tpl [new file with mode: 0644]
gosa-core/setup/setup_config3.tpl [new file with mode: 0644]
gosa-core/setup/setup_feedback.tpl [new file with mode: 0644]
gosa-core/setup/setup_finish.tpl [new file with mode: 0644]
gosa-core/setup/setup_frame.tpl [new file with mode: 0644]
gosa-core/setup/setup_language.tpl [new file with mode: 0644]
gosa-core/setup/setup_ldap.tpl [new file with mode: 0644]
gosa-core/setup/setup_license.tpl [new file with mode: 0644]
gosa-core/setup/setup_migrate.tpl [new file with mode: 0644]
gosa-core/setup/setup_schema.tpl [new file with mode: 0644]
gosa-core/setup/setup_welcome.tpl [new file with mode: 0644]
plugins/addons/addressbook/address_edit.tpl [deleted file]
plugins/addons/addressbook/address_info.tpl [deleted file]
plugins/addons/addressbook/class_addressbook.inc [deleted file]
plugins/addons/addressbook/contents.tpl [deleted file]
plugins/addons/addressbook/dial.tpl [deleted file]
plugins/addons/addressbook/main.inc [deleted file]
plugins/addons/addressbook/remove.tpl [deleted file]
plugins/addons/bugsubmitter/class_bugsubmitter.inc [deleted file]
plugins/addons/bugsubmitter/main.inc [deleted file]
plugins/addons/godfs/class_dfsManagment.inc [deleted file]
plugins/addons/godfs/class_dfsgeneric.inc [deleted file]
plugins/addons/godfs/contents.tpl [deleted file]
plugins/addons/godfs/generic.tpl [deleted file]
plugins/addons/godfs/main.inc [deleted file]
plugins/addons/godfs/tabs_dfs.inc [deleted file]
plugins/addons/gotomasses/class_divListMasses.inc [deleted file]
plugins/addons/gotomasses/class_goto_task.inc [deleted file]
plugins/addons/gotomasses/class_gotomasses.inc [deleted file]
plugins/addons/gotomasses/class_target_list.inc [deleted file]
plugins/addons/gotomasses/goto_task.tpl [deleted file]
plugins/addons/gotomasses/main.inc [deleted file]
plugins/addons/gotomasses/remove.tpl [deleted file]
plugins/addons/ldapmanager/class_csvimport.inc [deleted file]
plugins/addons/ldapmanager/class_export.inc [deleted file]
plugins/addons/ldapmanager/class_exportxls.inc [deleted file]
plugins/addons/ldapmanager/class_import.inc [deleted file]
plugins/addons/ldapmanager/class_ldif.inc [deleted file]
plugins/addons/ldapmanager/contentcsv.tpl [deleted file]
plugins/addons/ldapmanager/contentexport.tpl [deleted file]
plugins/addons/ldapmanager/contentexportxls.tpl [deleted file]
plugins/addons/ldapmanager/contentimport.tpl [deleted file]
plugins/addons/ldapmanager/main.inc [deleted file]
plugins/addons/ldapmanager/tabs_ldif.inc [deleted file]
plugins/addons/logview/class_gosa_logview.inc [deleted file]
plugins/addons/logview/class_logview.inc [deleted file]
plugins/addons/logview/contents.tpl [deleted file]
plugins/addons/logview/gosa_log_contents.tpl [deleted file]
plugins/addons/logview/main.inc [deleted file]
plugins/addons/logview/tabs_log.inc [deleted file]
plugins/addons/mailqueue/class_mailqueue.inc [deleted file]
plugins/addons/mailqueue/class_parseMailQueue.inc [deleted file]
plugins/addons/mailqueue/contents.tpl [deleted file]
plugins/addons/mailqueue/header.tpl [deleted file]
plugins/addons/mailqueue/main.inc [deleted file]
plugins/addons/notifications/class_msgplug.inc [deleted file]
plugins/addons/notifications/contents.tpl [deleted file]
plugins/addons/notifications/main.inc [deleted file]
plugins/admin/acl/acl_role.tpl [deleted file]
plugins/admin/acl/class_aclManagement.inc [deleted file]
plugins/admin/acl/class_aclRole.inc [deleted file]
plugins/admin/acl/class_divListACL.inc [deleted file]
plugins/admin/acl/main.inc [deleted file]
plugins/admin/acl/paste_role.tpl [deleted file]
plugins/admin/acl/remove.tpl [deleted file]
plugins/admin/acl/tabs_acl.inc [deleted file]
plugins/admin/acl/tabs_acl_role.inc [deleted file]
plugins/admin/applications/class_applicationGeneric.inc [deleted file]
plugins/admin/applications/class_applicationManagement.inc [deleted file]
plugins/admin/applications/class_applicationParameters.inc [deleted file]
plugins/admin/applications/class_divListApplication.inc [deleted file]
plugins/admin/applications/generic.tpl [deleted file]
plugins/admin/applications/main.inc [deleted file]
plugins/admin/applications/parameters.tpl [deleted file]
plugins/admin/applications/release_select.tpl [deleted file]
plugins/admin/applications/remove.tpl [deleted file]
plugins/admin/applications/tabs_application.inc [deleted file]
plugins/admin/departments/class_departmentGeneric.inc [deleted file]
plugins/admin/departments/class_departmentManagement.inc [deleted file]
plugins/admin/departments/class_divListDepartment.inc [deleted file]
plugins/admin/departments/dep_iframe.tpl [deleted file]
plugins/admin/departments/dep_move_confirm.tpl [deleted file]
plugins/admin/departments/generic.tpl [deleted file]
plugins/admin/departments/main.inc [deleted file]
plugins/admin/departments/remove.tpl [deleted file]
plugins/admin/departments/tabs_department.inc [deleted file]
plugins/admin/devices/class_deviceGeneric.inc [deleted file]
plugins/admin/devices/class_deviceManagement.inc [deleted file]
plugins/admin/devices/class_divListDevices.inc [deleted file]
plugins/admin/devices/deviceGeneric.tpl [deleted file]
plugins/admin/devices/main.inc [deleted file]
plugins/admin/devices/paste_deviceGeneric.tpl [deleted file]
plugins/admin/devices/remove.tpl [deleted file]
plugins/admin/devices/tabs_devices.inc [deleted file]
plugins/admin/fai/askClassName.tpl [deleted file]
plugins/admin/fai/branch_selector.tpl [deleted file]
plugins/admin/fai/class_askClassName.inc [deleted file]
plugins/admin/fai/class_divListFai.inc [deleted file]
plugins/admin/fai/class_faiHook.inc [deleted file]
plugins/admin/fai/class_faiHookEntry.inc [deleted file]
plugins/admin/fai/class_faiManagement.inc [deleted file]
plugins/admin/fai/class_faiPackage.inc [deleted file]
plugins/admin/fai/class_faiPackageConfiguration.inc [deleted file]
plugins/admin/fai/class_faiPackageEntry.inc [deleted file]
plugins/admin/fai/class_faiPartitionTable.inc [deleted file]
plugins/admin/fai/class_faiPartitionTableEntry.inc [deleted file]
plugins/admin/fai/class_faiProfile.inc [deleted file]
plugins/admin/fai/class_faiProfileEntry.inc [deleted file]
plugins/admin/fai/class_faiScript.inc [deleted file]
plugins/admin/fai/class_faiScriptEntry.inc [deleted file]
plugins/admin/fai/class_faiSummaryTab.inc [deleted file]
plugins/admin/fai/class_faiTemplate.inc [deleted file]
plugins/admin/fai/class_faiTemplateEntry.inc [deleted file]
plugins/admin/fai/class_faiVariable.inc [deleted file]
plugins/admin/fai/class_faiVariableEntry.inc [deleted file]
plugins/admin/fai/faiHook.tpl [deleted file]
plugins/admin/fai/faiHookEntry.tpl [deleted file]
plugins/admin/fai/faiNewBranch.tpl [deleted file]
plugins/admin/fai/faiPackage.tpl [deleted file]
plugins/admin/fai/faiPackageConfiguration.tpl [deleted file]
plugins/admin/fai/faiPackageEntry.tpl [deleted file]
plugins/admin/fai/faiPartitionTable.tpl [deleted file]
plugins/admin/fai/faiPartitionTableEntry.tpl [deleted file]
plugins/admin/fai/faiProfile.tpl [deleted file]
plugins/admin/fai/faiProfileEntry.tpl [deleted file]
plugins/admin/fai/faiScript.tpl [deleted file]
plugins/admin/fai/faiScriptEntry.tpl [deleted file]
plugins/admin/fai/faiSummary.tpl [deleted file]
plugins/admin/fai/faiTemplate.tpl [deleted file]
plugins/admin/fai/faiTemplateEntry.tpl [deleted file]
plugins/admin/fai/faiVariable.tpl [deleted file]
plugins/admin/fai/faiVariableEntry.tpl [deleted file]
plugins/admin/fai/main.inc [deleted file]
plugins/admin/fai/remove.tpl [deleted file]
plugins/admin/fai/remove_branch.tpl [deleted file]
plugins/admin/fai/tabsHook.inc [deleted file]
plugins/admin/fai/tabsPackage.inc [deleted file]
plugins/admin/fai/tabsPartition.inc [deleted file]
plugins/admin/fai/tabsProfile.inc [deleted file]
plugins/admin/fai/tabsScript.inc [deleted file]
plugins/admin/fai/tabsTemplate.inc [deleted file]
plugins/admin/fai/tabsVariable.inc [deleted file]
plugins/admin/groups/application.tpl [deleted file]
plugins/admin/groups/application_options.tpl [deleted file]
plugins/admin/groups/class_divListGroup.inc [deleted file]
plugins/admin/groups/class_groupApplication.inc [deleted file]
plugins/admin/groups/class_groupGeneric.inc [deleted file]
plugins/admin/groups/class_groupMail.inc [deleted file]
plugins/admin/groups/class_groupManagement.inc [deleted file]
plugins/admin/groups/generic.tpl [deleted file]
plugins/admin/groups/group_objects.tpl [deleted file]
plugins/admin/groups/mail.tpl [deleted file]
plugins/admin/groups/mail_admins.tpl [deleted file]
plugins/admin/groups/mail_locals.tpl [deleted file]
plugins/admin/groups/main.inc [deleted file]
plugins/admin/groups/paste_generic.tpl [deleted file]
plugins/admin/groups/paste_mail.tpl [deleted file]
plugins/admin/groups/remove.tpl [deleted file]
plugins/admin/groups/tabs_group.inc [deleted file]
plugins/admin/mimetypes/class_divListMimeTypes.inc [deleted file]
plugins/admin/mimetypes/class_mimetypeGeneric.inc [deleted file]
plugins/admin/mimetypes/class_mimetypeManagement.inc [deleted file]
plugins/admin/mimetypes/generic.tpl [deleted file]
plugins/admin/mimetypes/main.inc [deleted file]
plugins/admin/mimetypes/paste_generic.tpl [deleted file]
plugins/admin/mimetypes/release_select.tpl [deleted file]
plugins/admin/mimetypes/remove.tpl [deleted file]
plugins/admin/mimetypes/tabs_mimetypes.inc [deleted file]
plugins/admin/ogroups/class_divListOGroup.inc [deleted file]
plugins/admin/ogroups/class_mailogroup.inc [deleted file]
plugins/admin/ogroups/class_ogroup.inc [deleted file]
plugins/admin/ogroups/class_ogroupManagement.inc [deleted file]
plugins/admin/ogroups/class_phonequeue.inc [deleted file]
plugins/admin/ogroups/class_termgroup.inc [deleted file]
plugins/admin/ogroups/generic.tpl [deleted file]
plugins/admin/ogroups/mail.tpl [deleted file]
plugins/admin/ogroups/main.inc [deleted file]
plugins/admin/ogroups/ogroup_objects.tpl [deleted file]
plugins/admin/ogroups/paste_generic.tpl [deleted file]
plugins/admin/ogroups/paste_mail.tpl [deleted file]
plugins/admin/ogroups/phonequeue.tpl [deleted file]
plugins/admin/ogroups/remove.tpl [deleted file]
plugins/admin/ogroups/tabs_ogroups.inc [deleted file]
plugins/admin/ogroups/termgroup.tpl [deleted file]
plugins/admin/systems/ArpNewDevice.tpl [deleted file]
plugins/admin/systems/SelectDeviceType.tpl [deleted file]
plugins/admin/systems/chooser.tpl [deleted file]
plugins/admin/systems/class_ArpNewDevice.inc [deleted file]
plugins/admin/systems/class_SelectDeviceType.inc [deleted file]
plugins/admin/systems/class_baseSelectDialog.inc [deleted file]
plugins/admin/systems/class_componentGeneric.inc [deleted file]
plugins/admin/systems/class_divListRepositories.inc [deleted file]
plugins/admin/systems/class_divListSystem.inc [deleted file]
plugins/admin/systems/class_divListSystemService.inc [deleted file]
plugins/admin/systems/class_phoneGeneric.inc [deleted file]
plugins/admin/systems/class_printGeneric.inc [deleted file]
plugins/admin/systems/class_selectUserToPrinterDialog.inc [deleted file]
plugins/admin/systems/class_servGeneric.inc [deleted file]
plugins/admin/systems/class_serverService.inc [deleted file]
plugins/admin/systems/class_systemManagement.inc [deleted file]
plugins/admin/systems/class_terminalGeneric.inc [deleted file]
plugins/admin/systems/class_terminalInfo.inc [deleted file]
plugins/admin/systems/class_terminalService.inc [deleted file]
plugins/admin/systems/class_terminalStartup.inc [deleted file]
plugins/admin/systems/class_winGeneric.inc [deleted file]
plugins/admin/systems/class_workstationGeneric.inc [deleted file]
plugins/admin/systems/class_workstationService.inc [deleted file]
plugins/admin/systems/class_workstationStartup.inc [deleted file]
plugins/admin/systems/component.tpl [deleted file]
plugins/admin/systems/contents.tpl [deleted file]
plugins/admin/systems/gencd.tpl [deleted file]
plugins/admin/systems/gencd_frame.tpl [deleted file]
plugins/admin/systems/info.tpl [deleted file]
plugins/admin/systems/main.inc [deleted file]
plugins/admin/systems/network.tpl [deleted file]
plugins/admin/systems/password.tpl [deleted file]
plugins/admin/systems/paste_generic.tpl [deleted file]
plugins/admin/systems/phone.tpl [deleted file]
plugins/admin/systems/phonesettings.tpl [deleted file]
plugins/admin/systems/ppd/class_printerPPDDialog.inc [deleted file]
plugins/admin/systems/ppd/class_printerPPDSelectionDialog.inc [deleted file]
plugins/admin/systems/ppd/printerPPDDialog.tpl [deleted file]
plugins/admin/systems/ppd/printerPPDSelectionDialog.tpl [deleted file]
plugins/admin/systems/ppd/remove_ppd.tpl [deleted file]
plugins/admin/systems/printer.tpl [deleted file]
plugins/admin/systems/remove.tpl [deleted file]
plugins/admin/systems/selectUserToPrinterDialog.tpl [deleted file]
plugins/admin/systems/server.tpl [deleted file]
plugins/admin/systems/services/ServiceAddDialog.tpl [deleted file]
plugins/admin/systems/services/class_ServiceAddDialog.inc [deleted file]
plugins/admin/systems/services/class_goService.inc [deleted file]
plugins/admin/systems/services/cups/class_goCupsServer.inc [deleted file]
plugins/admin/systems/services/cups/goCupsServer.tpl [deleted file]
plugins/admin/systems/services/dhcp/class_dhcpAdvanced.inc [deleted file]
plugins/admin/systems/services/dhcp/class_dhcpGroup.inc [deleted file]
plugins/admin/systems/services/dhcp/class_dhcpHost.inc [deleted file]
plugins/admin/systems/services/dhcp/class_dhcpNetwork.inc [deleted file]
plugins/admin/systems/services/dhcp/class_dhcpNewSectionDialog.inc [deleted file]
plugins/admin/systems/services/dhcp/class_dhcpPool.inc [deleted file]
plugins/admin/systems/services/dhcp/class_dhcpService.inc [deleted file]
plugins/admin/systems/services/dhcp/class_dhcpSharedNetwork.inc [deleted file]
plugins/admin/systems/services/dhcp/class_dhcpSubnet.inc [deleted file]
plugins/admin/systems/services/dhcp/class_servDHCP.inc [deleted file]
plugins/admin/systems/services/dhcp/dhcpNewSection.tpl [deleted file]
plugins/admin/systems/services/dhcp/dhcp_advanced.tpl [deleted file]
plugins/admin/systems/services/dhcp/dhcp_group.tpl [deleted file]
plugins/admin/systems/services/dhcp/dhcp_host.tpl [deleted file]
plugins/admin/systems/services/dhcp/dhcp_network.tpl [deleted file]
plugins/admin/systems/services/dhcp/dhcp_pool.tpl [deleted file]
plugins/admin/systems/services/dhcp/dhcp_service.tpl [deleted file]
plugins/admin/systems/services/dhcp/dhcp_sharedNetwork.tpl [deleted file]
plugins/admin/systems/services/dhcp/dhcp_subnet.tpl [deleted file]
plugins/admin/systems/services/dhcp/remove_dhcp.tpl [deleted file]
plugins/admin/systems/services/dhcp/servdhcp.tpl [deleted file]
plugins/admin/systems/services/dns/class_servDNS.inc [deleted file]
plugins/admin/systems/services/dns/class_servDNSeditZone.inc [deleted file]
plugins/admin/systems/services/dns/class_servDNSeditZoneEntries.inc [deleted file]
plugins/admin/systems/services/dns/class_termDNS.inc [deleted file]
plugins/admin/systems/services/dns/servDNSeditZoneEntries.tpl [deleted file]
plugins/admin/systems/services/dns/servdns.tpl [deleted file]
plugins/admin/systems/services/dns/servdnseditzone.tpl [deleted file]
plugins/admin/systems/services/glpi/class_glpiAccount.inc [deleted file]
plugins/admin/systems/services/glpi/class_glpiAttachmentPool.inc [deleted file]
plugins/admin/systems/services/glpi/class_glpiDeviceManagement.inc [deleted file]
plugins/admin/systems/services/glpi/class_glpiManufacturer.inc [deleted file]
plugins/admin/systems/services/glpi/class_glpiPrinterAccount.inc [deleted file]
plugins/admin/systems/services/glpi/class_glpiPrinterCartridges.inc [deleted file]
plugins/admin/systems/services/glpi/class_glpiPrinterCartridgesEdit.inc [deleted file]
plugins/admin/systems/services/glpi/class_glpiSelectUser.inc [deleted file]
plugins/admin/systems/services/glpi/class_goGlpiServer.inc [deleted file]
plugins/admin/systems/services/glpi/glpi.tpl [deleted file]
plugins/admin/systems/services/glpi/glpiAttachmentEdit.tpl [deleted file]
plugins/admin/systems/services/glpi/glpiAttachmentPool.tpl [deleted file]
plugins/admin/systems/services/glpi/glpiDeviceManagement.tpl [deleted file]
plugins/admin/systems/services/glpi/glpiManufacturer.tpl [deleted file]
plugins/admin/systems/services/glpi/glpiManufacturerAdd.tpl [deleted file]
plugins/admin/systems/services/glpi/glpiPrinter.tpl [deleted file]
plugins/admin/systems/services/glpi/glpiPrinterCartridges.tpl [deleted file]
plugins/admin/systems/services/glpi/glpiPrinterCartridgesEdit.tpl [deleted file]
plugins/admin/systems/services/glpi/glpiSelectUser.tpl [deleted file]
plugins/admin/systems/services/glpi/glpi_devices.tpl [deleted file]
plugins/admin/systems/services/glpi/glpi_edit_cartridge_type.tpl [deleted file]
plugins/admin/systems/services/glpi/glpi_edit_os.tpl [deleted file]
plugins/admin/systems/services/glpi/glpi_edit_printer_type.tpl [deleted file]
plugins/admin/systems/services/glpi/glpi_edit_type.tpl [deleted file]
plugins/admin/systems/services/glpi/goGlpiServer.tpl [deleted file]
plugins/admin/systems/services/glpi/remove_glpi.tpl [deleted file]
plugins/admin/systems/services/gofax/class_goFaxServer.inc [deleted file]
plugins/admin/systems/services/gofax/goFaxServer.tpl [deleted file]
plugins/admin/systems/services/gofon/class_goFonServer.inc [deleted file]
plugins/admin/systems/services/gofon/goFonServer.tpl [deleted file]
plugins/admin/systems/services/imap/class_goImapServer.inc [deleted file]
plugins/admin/systems/services/imap/goImapServer.tpl [deleted file]
plugins/admin/systems/services/kerberos/class_goKrbServer.inc [deleted file]
plugins/admin/systems/services/kerberos/goKrbServer.tpl [deleted file]
plugins/admin/systems/services/kiosk/class_goKioskService.inc [deleted file]
plugins/admin/systems/services/kiosk/goKioskService.tpl [deleted file]
plugins/admin/systems/services/kolab/class_servKolab.inc [deleted file]
plugins/admin/systems/services/kolab/servkolab.tpl [deleted file]
plugins/admin/systems/services/ldap/class_goLdapServer.inc [deleted file]
plugins/admin/systems/services/ldap/goLdapServer.tpl [deleted file]
plugins/admin/systems/services/log/class_gosaLogServer.inc [deleted file]
plugins/admin/systems/services/log/gosaLogServer.tpl [deleted file]
plugins/admin/systems/services/mail/class_goMailServer.inc [deleted file]
plugins/admin/systems/services/mail/goMailServer.tpl [deleted file]
plugins/admin/systems/services/nfs/class_servNfs.inc [deleted file]
plugins/admin/systems/services/nfs/servnfs.tpl [deleted file]
plugins/admin/systems/services/ntp/class_goNtpServer.inc [deleted file]
plugins/admin/systems/services/ntp/goNtpServer.tpl [deleted file]
plugins/admin/systems/services/repository/class_servRepository.inc [deleted file]
plugins/admin/systems/services/repository/class_servRepositorySetup.inc [deleted file]
plugins/admin/systems/services/repository/servRepository.tpl [deleted file]
plugins/admin/systems/services/repository/servRepositorySetup.tpl [deleted file]
plugins/admin/systems/services/shares/class_goShareServer.inc [deleted file]
plugins/admin/systems/services/shares/goShareServer.tpl [deleted file]
plugins/admin/systems/services/spam/class_goSpamServer.inc [deleted file]
plugins/admin/systems/services/spam/class_goSpamServerRule.inc [deleted file]
plugins/admin/systems/services/spam/goSpamServer.tpl [deleted file]
plugins/admin/systems/services/spam/goSpamServerRule.tpl [deleted file]
plugins/admin/systems/services/syslog/class_goLogDBServer.inc [deleted file]
plugins/admin/systems/services/syslog/class_goSyslogServer.inc [deleted file]
plugins/admin/systems/services/syslog/goLogDBServer.tpl [deleted file]
plugins/admin/systems/services/syslog/goSyslogServer.tpl [deleted file]
plugins/admin/systems/services/terminal/class_goTerminalServer.inc [deleted file]
plugins/admin/systems/services/terminal/goTerminalServer.tpl [deleted file]
plugins/admin/systems/services/virus/class_goVirusServer.inc [deleted file]
plugins/admin/systems/services/virus/goVirusServer.tpl [deleted file]
plugins/admin/systems/tabs_arpnewdevice.inc [deleted file]
plugins/admin/systems/tabs_component.inc [deleted file]
plugins/admin/systems/tabs_phone.inc [deleted file]
plugins/admin/systems/tabs_printers.inc [deleted file]
plugins/admin/systems/tabs_server.inc [deleted file]
plugins/admin/systems/tabs_terminal.inc [deleted file]
plugins/admin/systems/tabs_winstation.inc [deleted file]
plugins/admin/systems/tabs_workstation.inc [deleted file]
plugins/admin/systems/terminal.tpl [deleted file]
plugins/admin/systems/terminalService.tpl [deleted file]
plugins/admin/systems/terminalStartup.tpl [deleted file]
plugins/admin/systems/wingeneric.tpl [deleted file]
plugins/admin/systems/workstation.tpl [deleted file]
plugins/admin/systems/workstationService.tpl [deleted file]
plugins/admin/systems/workstationStartup.tpl [deleted file]
plugins/admin/users/class_divListUsers.inc [deleted file]
plugins/admin/users/class_userManagement.inc [deleted file]
plugins/admin/users/main.inc [deleted file]
plugins/admin/users/password.tpl [deleted file]
plugins/admin/users/remove.tpl [deleted file]
plugins/admin/users/tabs_user.inc [deleted file]
plugins/admin/users/template.tpl [deleted file]
plugins/generic/references/class_reference.inc [deleted file]
plugins/generic/references/contents.tpl [deleted file]
plugins/generic/welcome/main.inc [deleted file]
plugins/generic/welcome/welcome.tpl [deleted file]
plugins/gofax/blocklists/class_blocklistGeneric.inc [deleted file]
plugins/gofax/blocklists/class_blocklistManagement.inc [deleted file]
plugins/gofax/blocklists/class_divListBlocklists.inc [deleted file]
plugins/gofax/blocklists/generic.tpl [deleted file]
plugins/gofax/blocklists/main.inc [deleted file]
plugins/gofax/blocklists/paste_generic.tpl [deleted file]
plugins/gofax/blocklists/remove.tpl [deleted file]
plugins/gofax/blocklists/tabs_blocklist.inc [deleted file]
plugins/gofax/faxaccount/class_gofaxAccount.inc [deleted file]
plugins/gofax/faxaccount/generic.tpl [deleted file]
plugins/gofax/faxaccount/lists.tpl [deleted file]
plugins/gofax/faxaccount/locals.tpl [deleted file]
plugins/gofax/faxaccount/main.inc [deleted file]
plugins/gofax/faxaccount/paste_generic.tpl [deleted file]
plugins/gofax/faxreports/class_faxreport.inc [deleted file]
plugins/gofax/faxreports/contents.tpl [deleted file]
plugins/gofax/faxreports/detail.tpl [deleted file]
plugins/gofax/faxreports/main.inc [deleted file]
plugins/gofon/conference/class_divListConferences.inc [deleted file]
plugins/gofon/conference/class_phoneConferenceGeneric.inc [deleted file]
plugins/gofon/conference/class_phoneConferenceManagment.inc [deleted file]
plugins/gofon/conference/generic.tpl [deleted file]
plugins/gofon/conference/headpage.tpl [deleted file]
plugins/gofon/conference/main.inc [deleted file]
plugins/gofon/conference/paste_generic.tpl [deleted file]
plugins/gofon/conference/remove.tpl [deleted file]
plugins/gofon/conference/tabs_conference.inc [deleted file]
plugins/gofon/fonreports/class_fonreport.inc [deleted file]
plugins/gofon/fonreports/contents.tpl [deleted file]
plugins/gofon/fonreports/main.inc [deleted file]
plugins/gofon/macro/class_divListMacros.inc [deleted file]
plugins/gofon/macro/class_gofonMacro.inc [deleted file]
plugins/gofon/macro/class_gofonMacroManagement.inc [deleted file]
plugins/gofon/macro/class_gofonMacroParameters.inc [deleted file]
plugins/gofon/macro/generic.tpl [deleted file]
plugins/gofon/macro/headpage.tpl [deleted file]
plugins/gofon/macro/main.inc [deleted file]
plugins/gofon/macro/parameter.tpl [deleted file]
plugins/gofon/macro/paste_generic.tpl [deleted file]
plugins/gofon/macro/remove.tpl [deleted file]
plugins/gofon/macro/tabs_macros.inc [deleted file]
plugins/gofon/phoneaccount/class_phoneAccount.inc [deleted file]
plugins/gofon/phoneaccount/generic.tpl [deleted file]
plugins/gofon/phoneaccount/main.inc [deleted file]
plugins/gofon/phoneaccount/paste_generic.tpl [deleted file]
plugins/personal/connectivity/class_connectivity.inc [deleted file]
plugins/personal/connectivity/class_intranetAccount.inc [deleted file]
plugins/personal/connectivity/class_kolabAccount.inc [deleted file]
plugins/personal/connectivity/class_opengwAccount.inc [deleted file]
plugins/personal/connectivity/class_oxchangeAccount.inc [deleted file]
plugins/personal/connectivity/class_phpgwAccount.inc [deleted file]
plugins/personal/connectivity/class_phpscheduleitAccount.inc [deleted file]
plugins/personal/connectivity/class_pptpAccount.inc [deleted file]
plugins/personal/connectivity/class_proxyAccount.inc [deleted file]
plugins/personal/connectivity/class_pureftpdAccount.inc [deleted file]
plugins/personal/connectivity/class_webdavAccount.inc [deleted file]
plugins/personal/connectivity/glpi.tpl [deleted file]
plugins/personal/connectivity/intranet.tpl [deleted file]
plugins/personal/connectivity/kolab.tpl [deleted file]
plugins/personal/connectivity/main.inc [deleted file]
plugins/personal/connectivity/opengw.tpl [deleted file]
plugins/personal/connectivity/oxchange.tpl [deleted file]
plugins/personal/connectivity/phpgw.tpl [deleted file]
plugins/personal/connectivity/phpscheduleit.tpl [deleted file]
plugins/personal/connectivity/pptp.tpl [deleted file]
plugins/personal/connectivity/proxy.tpl [deleted file]
plugins/personal/connectivity/pureftpd.tpl [deleted file]
plugins/personal/connectivity/webdav.tpl [deleted file]
plugins/personal/environment/class_environment.inc [deleted file]
plugins/personal/environment/class_hotplugDialog.inc [deleted file]
plugins/personal/environment/class_logonManagementDialog.inc [deleted file]
plugins/personal/environment/class_selectPrinterDialog.inc [deleted file]
plugins/personal/environment/environment.tpl [deleted file]
plugins/personal/environment/hotplugDialog.tpl [deleted file]
plugins/personal/environment/logonManagement.tpl [deleted file]
plugins/personal/environment/main.inc [deleted file]
plugins/personal/environment/selectPrinterDialog.tpl [deleted file]
plugins/personal/generic/class_user.inc [deleted file]
plugins/personal/generic/generic.tpl [deleted file]
plugins/personal/generic/generic_certs.tpl [deleted file]
plugins/personal/generic/generic_picture.tpl [deleted file]
plugins/personal/generic/main.inc [deleted file]
plugins/personal/generic/multiple_generic.tpl [deleted file]
plugins/personal/generic/password.tpl [deleted file]
plugins/personal/generic/paste_generic.tpl [deleted file]
plugins/personal/mail/class_mailAccount.inc [deleted file]
plugins/personal/mail/copypaste.tpl [deleted file]
plugins/personal/mail/generic.tpl [deleted file]
plugins/personal/mail/mail_locals.tpl [deleted file]
plugins/personal/mail/main.inc [deleted file]
plugins/personal/mail/sieve-discard.txt [deleted file]
plugins/personal/mail/sieve-header.txt [deleted file]
plugins/personal/mail/sieve-mailsize.txt [deleted file]
plugins/personal/mail/sieve-spam.txt [deleted file]
plugins/personal/mail/sieve-vacation.txt [deleted file]
plugins/personal/nagios/class_nagiosAccount.inc [deleted file]
plugins/personal/nagios/main.inc [deleted file]
plugins/personal/nagios/nagios.tpl [deleted file]
plugins/personal/netatalk/class_netatalk.inc [deleted file]
plugins/personal/netatalk/main.inc [deleted file]
plugins/personal/netatalk/netatalk.tpl [deleted file]
plugins/personal/password/changed.tpl [deleted file]
plugins/personal/password/class_password.inc [deleted file]
plugins/personal/password/main.inc [deleted file]
plugins/personal/password/nochange.tpl [deleted file]
plugins/personal/password/password.tpl [deleted file]
plugins/personal/posix/class_posixAccount.inc [deleted file]
plugins/personal/posix/generic.tpl [deleted file]
plugins/personal/posix/main.inc [deleted file]
plugins/personal/posix/paste_generic.tpl [deleted file]
plugins/personal/posix/posix_groups.tpl [deleted file]
plugins/personal/posix/posix_shadow.tpl [deleted file]
plugins/personal/posix/trust_machines.tpl [deleted file]
plugins/personal/samba/class_sambaAccount.inc [deleted file]
plugins/personal/samba/class_sambaLogonHours.inc [deleted file]
plugins/personal/samba/main.inc [deleted file]
plugins/personal/samba/samba2.tpl [deleted file]
plugins/personal/samba/samba3.tpl [deleted file]
plugins/personal/samba/samba3_workstations.tpl [deleted file]
plugins/personal/samba/sambaLogonHours.tpl [deleted file]
plugins/personal/scalix/class_scalixAccount.inc [deleted file]
plugins/personal/scalix/generic.tpl [deleted file]
plugins/personal/scalix/main.inc [deleted file]
plugins/personal/scalix/paste_generic.tpl [deleted file]
setup/class_setup.inc [deleted file]
setup/class_setupStep.inc [deleted file]
setup/class_setupStep_Checks.inc [deleted file]
setup/class_setupStep_Config1.inc [deleted file]
setup/class_setupStep_Config2.inc [deleted file]
setup/class_setupStep_Config3.inc [deleted file]
setup/class_setupStep_Feedback.inc [deleted file]
setup/class_setupStep_Finish.inc [deleted file]
setup/class_setupStep_Language.inc [deleted file]
setup/class_setupStep_Ldap.inc [deleted file]
setup/class_setupStep_License.inc [deleted file]
setup/class_setupStep_Migrate.inc [deleted file]
setup/class_setupStep_Schema.inc [deleted file]
setup/class_setupStep_Welcome.inc [deleted file]
setup/license.txt [deleted file]
setup/main.inc [deleted file]
setup/setup.tpl [deleted file]
setup/setup_checks.tpl [deleted file]
setup/setup_config1.tpl [deleted file]
setup/setup_config2.tpl [deleted file]
setup/setup_config3.tpl [deleted file]
setup/setup_feedback.tpl [deleted file]
setup/setup_finish.tpl [deleted file]
setup/setup_frame.tpl [deleted file]
setup/setup_language.tpl [deleted file]
setup/setup_ldap.tpl [deleted file]
setup/setup_license.tpl [deleted file]
setup/setup_migrate.tpl [deleted file]
setup/setup_schema.tpl [deleted file]
setup/setup_welcome.tpl [deleted file]

diff --git a/README b/README
deleted file mode 100644 (file)
index 8508057..0000000
--- a/README
+++ /dev/null
@@ -1,52 +0,0 @@
-GOsa2.1 README
-==============
-
-* Information
-
-GOsa is a LDAP administration frontend for user administration. It
-is NO GENERIC frontend to dictionary servers. Informations are stored
-in the way the underlying conecpts suppose them to be stored (i.e.
-people accounts are stored in "ou=people" subtrees, etc.) This can
-be configured marginally.
-
-Complete setups applying Kerberos, AFS, LDAP, Mail, Proxy and Fax setups
-are not trivial at all. You should be familiar with these components and
-with your UNIX installation, of cause. This file is (and will not be)
-an introduction to any of these components. See INSTALL for a quick
-overview about what to do, to get the things up and running. A complete
-GOsa infrastructure howto is work in progress and not released yet.
-
-
-* Translations
-
-GOsa is not available in your native language? Just take the message.po
-file out of the locales directory and put your translations into the
-msgstr fields. You may look at the de/LC_MESSAGES for the way how it
-works.
-
-If you're ready with that, create a directory for your language using
-the ISO shortcuts (i.e. es for spain) with a subdirectory LC_MESSAGES.
-Put your messages.po in there and run "msgfmt messages.po" from that
-directory. Make sure your apache has locale support or, in case of debian,
-that the specific locale will be generated (via dpkg-reconfigure locales).
-
-You may want your translations to be included in the main GOsa repository,
-then just send the .po file to me.
-
-
-* NOTES
-
-You'll need php-cups (http://www.cups.org) and php-krb5 (pear) in order
-to get full functionality. To make shared folders work in a proper way,
-you either need a recent PHP or a patched one for the get_acl functions
-(see contrib/patches). Basically GOsa will run without these.
-
-Be sure that 'gosaUserTemplates' are not able to log into your server,
-since they may have no password set. Example configs can be found in
-the contrib directory.
-
-Have fun!
-
----
-Cajus Pollmeier <pollmeier@gonicus.de>
-
diff --git a/README.safemode b/README.safemode
deleted file mode 100644 (file)
index e434340..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-In order to run GOsa in PHP's safe mode, these changes in your php.ini
-have been tested:
-
-magic_quotes_qpc = On
-allow_url_fopen = No
-register_globals = Off
-safe_mode = On
-safe_mode_include_dir = "/usr/share/gosa:/var/spool/gosa"
-safe_mode_exec_dir = "/usr/lib/gosa"
-safe_mode_allowed_env_vars = PHP_,LANG
-open_basedir = "/etc/gosa:/var/spool/gosa:/var/cache/gosa:/usr/share/gosa:/tmp"
-include_path = ".:/usr/share/php:/usr/share/gosa:/var/spool/gosa:/usr/share/gosa/safe_bin"
-disable_functions = system, shell_exec, passthru, phpinfo, show_source
-
diff --git a/gosa-core/README b/gosa-core/README
new file mode 100644 (file)
index 0000000..8508057
--- /dev/null
@@ -0,0 +1,52 @@
+GOsa2.1 README
+==============
+
+* Information
+
+GOsa is a LDAP administration frontend for user administration. It
+is NO GENERIC frontend to dictionary servers. Informations are stored
+in the way the underlying conecpts suppose them to be stored (i.e.
+people accounts are stored in "ou=people" subtrees, etc.) This can
+be configured marginally.
+
+Complete setups applying Kerberos, AFS, LDAP, Mail, Proxy and Fax setups
+are not trivial at all. You should be familiar with these components and
+with your UNIX installation, of cause. This file is (and will not be)
+an introduction to any of these components. See INSTALL for a quick
+overview about what to do, to get the things up and running. A complete
+GOsa infrastructure howto is work in progress and not released yet.
+
+
+* Translations
+
+GOsa is not available in your native language? Just take the message.po
+file out of the locales directory and put your translations into the
+msgstr fields. You may look at the de/LC_MESSAGES for the way how it
+works.
+
+If you're ready with that, create a directory for your language using
+the ISO shortcuts (i.e. es for spain) with a subdirectory LC_MESSAGES.
+Put your messages.po in there and run "msgfmt messages.po" from that
+directory. Make sure your apache has locale support or, in case of debian,
+that the specific locale will be generated (via dpkg-reconfigure locales).
+
+You may want your translations to be included in the main GOsa repository,
+then just send the .po file to me.
+
+
+* NOTES
+
+You'll need php-cups (http://www.cups.org) and php-krb5 (pear) in order
+to get full functionality. To make shared folders work in a proper way,
+you either need a recent PHP or a patched one for the get_acl functions
+(see contrib/patches). Basically GOsa will run without these.
+
+Be sure that 'gosaUserTemplates' are not able to log into your server,
+since they may have no password set. Example configs can be found in
+the contrib directory.
+
+Have fun!
+
+---
+Cajus Pollmeier <pollmeier@gonicus.de>
+
diff --git a/gosa-core/README.safemode b/gosa-core/README.safemode
new file mode 100644 (file)
index 0000000..e434340
--- /dev/null
@@ -0,0 +1,14 @@
+In order to run GOsa in PHP's safe mode, these changes in your php.ini
+have been tested:
+
+magic_quotes_qpc = On
+allow_url_fopen = No
+register_globals = Off
+safe_mode = On
+safe_mode_include_dir = "/usr/share/gosa:/var/spool/gosa"
+safe_mode_exec_dir = "/usr/lib/gosa"
+safe_mode_allowed_env_vars = PHP_,LANG
+open_basedir = "/etc/gosa:/var/spool/gosa:/var/cache/gosa:/usr/share/gosa:/tmp"
+include_path = ".:/usr/share/php:/usr/share/gosa:/var/spool/gosa:/usr/share/gosa/safe_bin"
+disable_functions = system, shell_exec, passthru, phpinfo, show_source
+
diff --git a/gosa-core/plugins/addons/addressbook/address_edit.tpl b/gosa-core/plugins/addons/addressbook/address_edit.tpl
new file mode 100644 (file)
index 0000000..8b51230
--- /dev/null
@@ -0,0 +1,274 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left; border:1px solid #B0B0B0;" cellpadding=4 cellspacing=0 border=0>
+       <tr style="background-color: #E8E8E8; height:26px;font-weight:bold;">
+               <td align=left width="100%">
+                       <LABEL for="storage_base">
+                               {$storage_info}
+                       </LABEL>
+                       <select id="storage_base" name="storage_base" size="1" title="{t}Choose the department to store entry in{/t}">
+                               {html_options options=$deplist selected=$storage_base}
+                       </select>
+               </td>
+               <td>
+                       <a href="{$url}">
+                               X
+                       </a>
+               </td>
+       </tr>
+       <tr style="background-color: white">
+               <td colspan=2>
+                       <table summary="" width="100%" cellspacing=2 cellpadding=4>
+                               <tr>
+                                       <td style="width:50%; vertical-align:top; background-color: #F0F0F0">
+                                               <h2>
+                                                       <img class="center" alt="" src="{$personal_image}" align=middle>
+                                                               &nbsp;{t}Personal{/t}
+                                               </h2>
+                                               <table summary="" width="100%">
+                                                       <tr>
+                                                               <td>
+                                                                       <LABEL for="sn">
+                                                                               {t}Last name{/t}{$must}
+                                                                       </LABEL>, 
+                                                                       <LABEL for="givenName">
+                                                                               {t}First name{/t}{$must}
+                                                                       </LABEL>
+                                                               </td>
+                                                               <td>
+{render acl=$snACL}    
+                                                                       <input id="sn" name="sn" size=10 maxlength=60 value="{$info_sn}">, 
+{/render}
+{render acl=$givenNameACL}
+                                                                       <input id="givenName" name="givenName" size=10 maxlength=60 value="{$info_givenName}">
+{/render}
+                                                               <td>
+                                                       </tr>
+                                                       <tr>
+                                                               <td>
+                                                                       <LABEL for="initials">
+                                                                               {t}Initials{/t}
+                                                                       </LABEL>
+                                                               </td>
+                                                               <td>
+{render acl=$initialsACL}
+                                                                       <input id="initials" name="initials" size=5 maxlength=20 value="{$info_initials}">
+{/render}
+                                                               </td>
+                                                       </tr>
+                                                       <tr>
+                                                               <td>
+                                                                       <LABEL for="title">
+                                                                               {t}Personal title{/t}
+                                                                       </LABEL>
+                                                               </td>
+                                                               <td>
+{render acl=$titleACL}
+                                                                       <input id="title" name="title" size=10 maxlength=20 value="{$info_title}">
+{/render}
+                                                               </td>
+                                                       </tr>
+                                               </table>
+                                       </td>
+                                       <td style="width:50%; vertical-align:top;background-color:#E8E8E8">
+                                               <h2>
+                                                       <img class="center" alt="" src="{$home_image}" align=middle>
+                                                       &nbsp;{t}Private{/t}
+                                               </h2>
+                                               <table summary="" width="100%">
+                                                       <tr>
+                                                               <td>
+                                                                       <LABEL for="homePostalAddress">
+                                                                               {t}Address{/t}
+                                                                       </LABEL>
+                                                               <br>
+                                                               <br>
+                                                               </td>
+                                                               <td style="vertical-align:top;">
+{render acl=$homePostalAddressACL}
+                                                                       <textarea id="homePostalAddress" name="homePostalAddress" rows=1 cols=20>{$info_homePostalAddress}</textarea>
+{/render}
+                                                               </td>
+                                                       </tr>
+                                                       <tr>
+                                                               <td>
+                                                                       <LABEL for="homePhone">
+                                                                               {t}Phone{/t}
+                                                                       </LABEL>
+                                                               </td>
+                                                               <td>
+{render acl=$homePhoneACL}
+                                                                       <input id="homePhone" name="homePhone" size=15 maxlength=60 value="{$info_homePhone}">
+{/render}
+                                                               </td>
+                                                       </tr>
+                                                       <tr>
+                                                               <td>
+                                                                       <LABEL for="mobile">
+                                                                               {t}Mobile{/t}
+                                                                       </LABEL>
+                                                               </td>
+                                                               <td>
+{render acl=$mobileACL}
+                                                                       <input id="mobile" name="mobile" size=15 maxlength=60 value="{$info_mobile}">
+{/render}
+                                                               </td>
+                                                       </tr>
+                                                       <tr>
+                                                               <td>
+                                                                       <LABEL for="mail">
+                                                                               {t}Email{/t}
+                                                                       </LABEL>
+                                                               </td>
+                                                               <td>
+{render acl=$mailACL}
+                                                                       <input id="mail" name="mail" size=15 maxlength=60 value="{$info_mail}">
+{/render}
+                                                               </td>
+                                                       </tr>
+                                                </table>
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td style="width:100%; vertical-align:top; background-color: #E4E4E4" colspan=2>
+                                               <h2>
+                                                       <img class="center" alt="" src="{$company_image}" align=middle>
+                                                       &nbsp;{t}Organizational{/t}
+                                               </h2>
+                                               <table summary="" width="100%">
+                                                       <tr>
+                                                               <td>
+                                                                       <table summary="" width="100%">
+                                                                               <tr>
+                                                                                       <td>
+                                                                                               <LABEL for="">  
+                                                                                                       {t}Company{/t}
+                                                                                               </LABEL>
+                                                                                       </td>
+                                                                                       <td>
+{render acl=$oACL}
+                                                                                               <input id="o" name="o" size=15 maxlength=60 value="{$info_o}">
+{/render}
+                                                                                       </td>
+                                                                               </tr>
+                                                                               <tr>
+                                                                                       <td>
+                                                                                               <LABEL for="">
+                                                                                                       {t}Department{/t}
+                                                                                               </LABEL>
+                                                                                       </td>
+                                                                                       <td>
+{render acl=$ouACL}
+                                                                                               <input id="ou" name="ou" size=15 maxlength=60 value="{$info_ou}">
+{/render}
+                                                                                       </td>
+                                                                               </tr>
+                                                                               <tr>
+                                                                                       <td>
+                                                                                               <LABEL for="">
+                                                                                                       {t}City{/t}
+                                                                                               </LABEL>
+                                                                                       </td>
+                                                                                       <td>
+{render acl=$lACL}
+                                                                                               <input id="l" name="l" size=15 maxlength=60 value="{$info_l}">
+{/render}
+                                                                                       </td>
+                                                                               </tr>
+                                                                               <tr>
+                                                                                       <td>
+                                                                                               <LABEL for="">
+                                                                                                       {t}Postal code{/t}
+                                                                                               </LABEL>
+                                                                                       </td>
+                                                                                       <td>
+{render acl=$postalCodeACL}
+                                                                                               <input id="postalCode" name="postalCode" size=15 maxlength=60 value="{$info_postalCode}">
+{/render}
+                                                                                       </td>
+                                                                               </tr>
+                                                                               <tr>
+                                                                                       <td>
+                                                                                               <LABEL for="">
+                                                                                                       {t}Country{/t}
+                                                                                               </LABEL>
+                                                                                       </td>
+                                                                                       <td>
+{render acl=$stACL}
+                                                                                               <input id="st" name="st" size=15 maxlength=60 value="{$info_st}">
+{/render}
+                                                                                       </td>
+                                                                               </tr>
+                                                                       </table>
+                                                                       </td>
+                                                                       <td style="vertical-align:top">
+                                                                       <table summary="" width="100%">
+                                                                               <tr>
+                                                                                       <td>
+                                                                                               <LABEL for="">
+                                                                                                       {t}Address{/t}
+                                                                                               </LABEL>
+                                                                                               <br>
+                                                                                               <br>
+                                                                                       </td>
+                                                                                       <td style="vertical-align:top;">
+{render acl=$postalAddressACL}
+                                                                                               <textarea id="postalAddress" name="postalAddress" rows=1 cols=20 >{$info_postalAddress}</textarea>
+{/render}
+                                                                                       </td>
+                                                                               </tr>
+                                                                               <tr>
+                                                                                       <td>
+                                                                                               <LABEL for="">
+                                                                                                       {t}Phone{/t}    
+                                                                                               </LABEL>
+                                                                                       </td>
+                                                                                       <td>
+{render acl=$telephoneNumberACL}
+                                                                                               <input id="telephoneNumber" name="telephoneNumber" size=15 maxlength=60 value="{$info_telephoneNumber}">
+{/render}
+                                                                                       </td>
+                                                                               </tr>
+                                                                               <tr>
+                                                                                       <td>
+                                                                                               <LABEL for="">
+                                                                                                       {t}FAX{/t}
+                                                                                               </LABEL>
+                                                                                       </td>
+                                                                                       <td>
+{render acl=$facsimileTelephoneNumberACL}
+                                                                                               <input id="facsimileTelephoneNumber" name="facsimileTelephoneNumber"
+                                                                                                       size=15 maxlength=60 value="{$info_facsimileTelephoneNumber}">
+{/render}
+                                                                                       </td>
+                                                                               </tr>
+                                                                               <tr>
+                                                                                       <td>
+                                                                                               <LABEL for="">
+                                                                                                       {t}Pager{/t}
+                                                                                               </LABEL>
+                                                                                       </td>
+                                                                                       <td>
+{render acl=$pagerACL}
+                                                                                               <input id="pager" name="pager" size=15 maxlength=60 value="{$info_pager}">
+{/render}
+                                                                                       </td>
+                                                                               </tr>
+                                                                       </table>
+                                                               </td>
+                                                       </tr>
+                                               </table>
+                                       </td>
+                               </tr>
+                       </table>
+
+                       <p align=right>
+                       <input type="submit" name="save" value="{t}Save{/t}">
+                       <input type="submit" name="cancel" value="{t}Cancel{/t}">
+                       </p>
+
+               </td>
+       </tr>
+</table>
+
+<!--
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+-->
diff --git a/gosa-core/plugins/addons/addressbook/address_info.tpl b/gosa-core/plugins/addons/addressbook/address_info.tpl
new file mode 100644 (file)
index 0000000..3bb3a22
--- /dev/null
@@ -0,0 +1,196 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left; border:1px solid #B0B0B0;" cellpadding=4 cellspacing=0 border=0>
+ <tr style="background-color: #E8E8E8; height:26px;font-weight:bold;">
+  <td align=left width="100%">{$storage_info}
+  </td>
+  <td>
+   <a href="{$url}">X</a>
+  </td>
+ </tr>
+
+ <tr style="background-color: white">
+  <td colspan=2>
+
+   <table summary="" width="100%" cellspacing=2 cellpadding=4>
+    <tr>
+     <td style="width:50%; vertical-align:top; background-color: #F0F0F0">
+      <h2>
+       <img class="center" alt="" src="{$personal_image}" align=middle> 
+       {t}Personal{/t}
+      </h2>
+      <table summary="" width="100%">
+       <tr>
+        <td style='width:40%;'>
+         {t}Name{/t}
+        </td> 
+        <td>
+         <i>{$info_sn}, {$info_givenName}</i>
+        </td>
+       </tr>
+       <tr>
+        <td>
+         {t}Initials{/t}
+        </td> 
+        <td>
+         <i>{$info_initials}</i>
+        </td>
+       </tr>
+       <tr>
+        <td>
+         {t}Personal title{/t}
+        </td>
+        <td>
+         <i>{$info_title}</i>
+        </td>
+       </tr>
+      </table>
+
+     </td>
+     <td style="vertical-align:top; background-color: #E8E8E8">
+
+      <h2>
+       <img class="center" alt="" src="{$home_image}" align=middle> 
+       {t}Private{/t}
+      </h2>
+
+      <table summary="" width="100%">
+        <tr>
+         <td style='vertical-align:top; width: 40%;'>
+          {t}Address{/t}
+         </td>
+         <td style="vertical-align:top;">
+          <i>{$info_homePostalAddress}</i>
+         </td>
+        </tr>
+        <tr>
+         <td>
+          {t}Phone{/t}
+         </td>
+         <td>
+          <i>{$info_homePhone}</i>
+         </td>
+        </tr>
+        <tr>
+         <td>
+          {t}Mobile{/t}
+         </td>
+         <td>
+          <i>{$info_mobile}</i>
+         </td>
+        </tr>
+        <tr>
+         <td>
+          {t}Email{/t}
+         </td>
+         <td>
+          <i><a href="mailto:{$info_givenName}%20{$info_sn}%20%3C{$info_mail}%3E">{$info_mail}</a></i>
+         </td>
+        </tr>
+       </table>
+
+      </td>
+     </tr>
+
+     <tr>
+      <td style="vertical-align:top; background-color: #E4E4E4" colspan=2>
+
+       <h2>
+        <img class="center" alt="" src="{$company_image}" align=middle> 
+        {t}Organizational{/t}
+       </h2>
+
+       <table summary="" width="100%">
+        <tr>
+         <td width='50%'>
+  
+          <table summary="" width="100%">
+           <tr>
+            <td style='width:40%;'>
+             {t}Company{/t}
+            </td>
+            <td>
+             <i>{$info_o}</i>
+            </td>
+           </tr>
+           <tr>
+            <td>
+             {t}Department{/t}
+            </td>
+            <td>
+             <i>{$info_ou}</i>
+            </td>
+           </tr>
+           <tr>
+            <td> 
+             {t}City{/t}
+            </td>
+            <td>
+             <i>{$info_l}</i>
+            </td>
+           </tr>
+           <tr>
+            <td>
+             {t}Postal code{/t}
+            </td>
+            <td>
+             <i>{$info_postalCode}</i>
+            </td>
+           </tr>
+           <tr>
+            <td>
+             {t}Country{/t}
+            </td>
+            <td>
+             <i>{$info_st}</i>
+            </td>
+           </tr>
+          </table>
+
+         </td>
+         <td style="vertical-align:top">
+
+          <table summary="" width="100%">
+           <tr>
+            <td style='vertical_align:top; width:40%;'>
+             {t}Address{/t}
+            </td>
+            <td style="vertical-align:top;">
+             <i>{$info_postalAddress}</i>
+            </td>
+           </tr>
+           <tr>
+            <td>
+             {t}Phone{/t}
+            </td>
+            <td>
+             <i>{$info_telephoneNumber}</i>
+            </td>
+           </tr>
+           <tr>
+            <td>
+             {t}FAX{/t}
+            </td>
+            <td>
+             <i>{$info_facsimileTelephoneNumber}</i>
+            </td>
+           </tr>
+           <tr>
+            <td>
+             {t}Pager{/t}
+            </td>
+            <td>
+             <i>{$info_pager}</i>
+            </td>
+           </tr>
+          </table>
+         </td>
+        </tr>
+       </table>
+
+      </td> 
+     </tr>
+    </table>
+
+   </td>
+ </tr>
+</table>
diff --git a/gosa-core/plugins/addons/addressbook/class_addressbook.inc b/gosa-core/plugins/addons/addressbook/class_addressbook.inc
new file mode 100644 (file)
index 0000000..67bb345
--- /dev/null
@@ -0,0 +1,835 @@
+<?php
+
+class addressbook extends plugin
+{
+       /* Definitions */
+       var $plHeadline   = "Addressbook";
+       var $plDescription= "This does something";
+
+  /* Generic */
+  var $ui;  
+
+       /* Phonelist attributes */
+       var $telephone_list   = array();
+       var $new_dn           = "";
+       var $orig_cn          = "";
+       var $storage_base     = "";
+       var $orig_storage_base= "";
+
+  /* Filter attributes */
+       var $start            = 0;
+       var $search_for       = "*";
+       var $search_base      = "";
+       var $search_type      = "";
+       var $range            = 20;
+
+  /* Currently edited/added entry attributes */
+       var $sn                       = "";
+       var $cn                       = "";
+       var $givenName                = "";
+       var $mail                     = "";
+       var $title                    = "";
+       var $personalTitle            = "";
+       var $initials                 = "";
+       var $homePostalAddress        = "";
+       var $homePhone                = "";
+       var $mobile                   = "";
+       var $o                        = "";
+       var $postalAddress            = "";
+       var $l                        = "";
+       var $postalCode               = "";
+       var $st                       = "";
+       var $ou                       = "";
+       var $telephoneNumber          = "";
+       var $facsimileTelephoneNumber = "";
+       var $pager                    = "";
+  var $view_logged              = FALSE;
+
+       /* attribute list for save action */
+       var $attributes= array("sn", "givenName", "mail", "title",
+                       "initials", "homePostalAddress", "displayName",
+                       "homePhone", "mobile", "o", "postalAddress", "l",
+                       "postalCode", "st", "ou", "telephoneNumber",
+                       "facsimileTelephoneNumber", "pager");
+
+       var $objectclasses= array("top", "person", "organizationalPerson", "inetOrgPerson");
+
+       var $abobjectclass= "dc=addressbook";
+
+  function addressbook (&$config, $dn= NULL)
+  {
+    /* Include config object */
+    $this->config= &$config;
+
+    /* Check if there is a special ldap-sub-tree specified, instead of dc=addressbook, */
+    $aoc = $this->config->search("addressbook", "LDAP_OBJECT_CLASS",array('menu'));
+    if ($aoc != ""){
+      $this->abobjectclass  = $aoc;
+    }
+
+    /* Get global filter config */
+    if (!is_global("phonefilter")){
+      $ui         = get_userinfo();
+      $base       = get_base_from_people($ui->dn);
+      $phonefilter= array(
+          "search_base"       => $base,
+          "organizational"    => "checked",
+          "global"            => "checked",
+          "search_for"        => "*",
+          "object_type"       => "*");
+      register_global("phonefilter", $phonefilter);
+    }
+     
+    $this->ui = get_userinfo();
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    $smarty= get_smarty();
+
+    /* Prevent empty variables for smarty */
+    foreach($this->attributes as $atr) {
+      $smarty->assign($atr,"");
+    }
+
+    /* Save formular information */
+    $phonefilter= get_global("phonefilter");
+    foreach( array("search_for", "search_base", "object_type") as $type){
+      if (isset($_POST[$type])){
+        $phonefilter[$type]= $_POST[$type];
+      }
+      $this->$type= $phonefilter[$type];
+    }
+    if (isset($_POST['search_base'])){
+      foreach( array("organizational", "global") as $type){
+        if (isset($_POST[$type])){
+          $phonefilter[$type]= "checked";
+        } else {
+          $phonefilter[$type]= "";
+        }
+      }
+    }
+
+    /* Search string */
+    $s= $phonefilter['search_for'];
+    if ($s == "") {
+      $s= "*";
+    }
+    if (isset($_GET['search'])){
+      $s= validate(mb_substr($_GET['search'], 0, 1, "UTF8"))."*";
+      if ($s == "**"){
+        $s= "*";
+      }
+      $this->search_for= $s;
+      $phonefilter['search_for']= $s;
+    }
+    register_global("phonefilter", $phonefilter);
+
+    /* Assign create acl */
+    $acl = $this->get_entry_acls($this->abobjectclass.",".$phonefilter['search_base']);
+    $smarty->assign("internal_createable", preg_match("/c/",$acl));
+    $smarty->assign("internal_removeable", preg_match("/d/",$acl));
+    $smarty->assign("internal_editable",   preg_match("/w/",$acl));
+
+    /* Perform actions with CTI hook */
+    if (isset($_GET['target'])
+        && isset($_GET['dial'])
+        && isset($this->config->current['CTIHOOK'])){
+
+      $dialmode= $_GET['dial'];
+      if ($dialmode == "telephoneNumber" ||
+          $dialmode == "mobile" ||
+          $dialmode == "homePhone"){
+
+        /* Get target */
+        $ldap= $this->config->get_ldap_link();
+        $ldap->cat(base64_decode($_GET['target']), array('telephoneNumber', 'mobile', 'homePhone'));
+        $attrs= $ldap->fetch();
+        if (isset($attrs["$dialmode"])){
+          $target= $attrs[$dialmode][0];
+        } else {
+          $target= "";
+        }
+
+        /* Get source */
+        $ui= get_userinfo();
+        $ldap->cat($ui->dn, array('telephoneNumber'));
+        $attrs= $ldap->fetch();
+        if (isset($attrs["telephoneNumber"])){
+          $source= $attrs['telephoneNumber'][0];
+        } else {
+          $source= "";
+        }
+
+        /* Save to session */
+        $_SESSION['source']= $source;
+        $_SESSION['target']= $target;
+
+        /* Perform call */
+        if ($target != "" && $source != ""){
+          $smarty->assign("phone_image", get_template_path('images/phone.png'));
+          $smarty->assign("dial_info", sprintf(_("Dial from %s to %s now?"), "<b style='font-size:22px; color:red'>".$source."</b>", "<b style='font-size:22px;color:red'>".$target."</b>"));
+          return($smarty->fetch(get_template_path('dial.tpl', TRUE)));
+          return;
+        } else {
+          print_red (_("You have no personal phone number set. Please change that in order to perform direct dials."));
+        }
+      }
+
+    }
+
+    /* Finally dial */
+    if (isset($_POST['dial']) && isset($_SESSION['source']) && isset($_SESSION['target'])){
+      exec ($this->config->current['CTIHOOK']." '".$_SESSION['source']."' '".$_SESSION['target']."'", $dummy, $retval);
+      unset($_SESSION['source']);
+      unset($_SESSION['target']);
+    }
+
+
+    /* Delete entry? */
+    if (isset($_POST['delete_entry_confirm'])){
+
+      /* Some nice guy may send this as POST, so we've to check
+         for the permissions again. */
+      
+      $acl = $this->get_entry_acls($this->dn);
+      if(preg_match("/d/",$acl)){
+
+        /* Delete request is permitted, perform LDAP action */
+        $ldap= $this->config->get_ldap_link();
+        $ldap->rmdir ($this->dn);
+        new log("remove","addressbook/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+        show_ldap_error($ldap->get_error(), sprintf(_("Removing of addressbook entry '%s' failed."),$this->dn));
+        new log("remove","addressbook/".get_class($this),$this->dn,array(),"Address book object'".$this->dn."' has been removed");
+  
+      } else {
+
+        /* Normally this shouldn't be reached, send some extra
+           logs to notify the administrator */
+        print_red (_("You are not allowed to delete this entry!"));
+        new log("remove","addressbook/".get_class($this),$this->dn,array(),"Warning: '".$this->ui->uid."' tried to trick address book deletion.");
+      }
+
+      /* Remove lock file after successfull deletion */
+      del_lock ($this->dn);
+
+      /* Clean up */
+      if (isset($_SESSION['saved_start'])){
+        $_GET['start']= $_SESSION['saved_start'];
+      }
+      unset($_SESSION['show_info']);
+      unset($_SESSION['saved_start']);
+    }
+
+
+    /* Delete entry? */
+    if (isset($_POST['delete_cancel'])){
+      del_lock ($this->dn);
+    }
+
+
+    /* Save address entry? */
+    if (isset($_POST['save'])){
+      $this->save_object();
+      $this->storage_base= $_POST['storage_base'];
+
+      /* Perform checks */
+      $message= $this->check ();
+
+      /* No errors, save object */
+      if (count ($message) == 0){
+        $this->save();
+
+        /* Clean up */
+        if (isset($_SESSION['saved_start'])){
+          $_GET['start']= $_SESSION['saved_start'];
+        }
+        $_SESSION['show_info']= $this->dn;
+        unset($_SESSION['saved_start']);
+      } else {
+        /* Errors found, show message */
+        show_errors ($message);
+      }
+    }
+
+
+    /* Close info window */
+    if (isset($_GET['close']) || isset($_POST['cancel'])){
+      if (isset($_SESSION['saved_start'])){
+        $_GET['start']= $_SESSION['saved_start'];
+      }
+      unset($_SESSION['show_info']);
+      unset($_SESSION['saved_start']);
+    }
+
+
+    /* Start address book edit mode? */
+    if (isset($_GET['global'])){
+      if (!isset($_SESSION['saved_start']) && isset($_GET['start'])){
+        $_SESSION['saved_start']= $_GET['start'];
+      }
+      switch ($_GET['global']){
+        case "add":
+          $this->dn= "new";
+        $this->orig_cn= "";
+
+        /* Clean values */
+        foreach ($this->attributes as $name){
+          $this->$name= "";
+        }
+        $this->saved_attributes= array();
+        $this->storage_base= $this->config->current["BASE"];
+        break;
+
+        case "edit":
+          /* Clean values */
+          foreach ($this->attributes as $name){
+            $this->$name= "";
+          }
+        $this->dn= $_SESSION['show_info']; 
+        $this->load();
+        $this->orig_cn= $this->cn;
+        break;
+        case "remove":
+          $this->dn= $_SESSION['show_info']; 
+        $this->load();
+
+        /* Load permissions for selected 'dn' and check if
+           we're allowed to remove this 'dn' */
+        $acl = $this->get_entry_acls($this->dn);
+        if(preg_match("/d/",$acl)){
+
+          /* Check locking, save current plugin in 'back_plugin', so
+             the dialog knows where to return. */
+          if (($user= get_lock($this->dn)) != ""){
+            return(gen_locked_message ($user, $this->dn));
+          }
+
+          /* Lock the current entry, so nobody will edit it during deletion */
+          $ui= get_userinfo();
+          add_lock ($this->dn, $ui->dn);
+          $smarty->assign("info", sprintf(_("You're about to delete the entry %s."), $this->dn));
+          return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+        } else {
+
+          /* Obviously the user isn't allowed to delete. Show message and
+             clean session. */
+          print_red (_("You are not allowed to delete this entry!"));
+        }
+      }
+      $_SESSION['show_info']= "ADD";
+    }
+
+
+    /* Open info window */
+    if (isset($_GET['show'])){
+      if (!isset($_SESSION['saved_start'])){
+        $_SESSION['saved_start']= $_GET['start'];
+      }
+      $this->dn = base64_decode($_GET['show']);
+      $this->view_logged =FALSE;
+      if(!$this->view_logged){
+        $this->view_logged = TRUE;
+        new log("view","addressbook/".get_class($this),$this->dn);
+      }
+      $_SESSION['show_info']= base64_decode($_GET['show']);
+    }
+
+
+    /* Get ldap link / build filter */
+    $ldap= $this->config->get_ldap_link();
+    $this->telephone_list= array ();
+
+
+    /* Assemble bases 
+        (Depending on checkboxes, we search for organisational entries or seperated 
+        adressbook entries within dc=adressbook, ) */
+    $bases= array();
+    $filter= "";
+    if ($phonefilter['global'] == "checked"){
+      $bases[]= preg_replace("/".$this->config->current['BASE']."/", $this->abobjectclass.",".$this->config->current['BASE'], $this->search_base);
+    } else {
+      $filter= '(objectClass=gosaAccount)';
+    }
+    if ($phonefilter['organizational'] == "checked"){
+      $bases[]= $this->search_base;
+    }
+
+
+    /* Only display those entries that have at least on of this attributes set */
+    $must_have_this = array("telephoneNumber","facsimileTelephoneNumber","mobile","homePhone","mail");
+
+    /* Requested attributes in ldap search */
+    $attributes = array("sn", "givenName", "telephoneNumber", "facsimileTelephoneNumber", "mobile", "homePhone", "uid", "mail", "cn");
+
+    /* Create attribute filter part */
+    $attribute_filter = "";
+    foreach($attributes as $att){
+      $attribute_filter .= "(".$att."=".$s.")";
+    }
+
+    /* Walk through bases an check for usable entries */
+    foreach ($bases as $base){
+
+      $ldap->cd ($base);
+
+      if ($phonefilter['object_type'] == '*'){
+        $ldap->search (
+            "(&(objectClass=person)$filter(!(objectClass=gosaUserTemplate))".   // Skip templates etc ..
+            "(!(uid=*$))".                                                      // Skip entries with ...$ as uid 
+            "(|".$attribute_filter."))"                                         
+          ,$attributes); 
+      } else {
+        $ldap->search ("(&$filter(!(uid=*$))(!(objectClass=gosaUserTemplate))".                     //array
+            "(".$phonefilter['object_type']."=$s))", $attributes);
+      }
+
+      /* Walk through LDAP results */
+      while ($attrs= $ldap->fetch()){
+
+        /* prevent empty vaiables */
+        foreach($this->attributes as $atr)          {
+          if(!isset($attrs[$atr][0])) {
+            $attrs[$atr][0] = "";
+          }
+        }
+
+        /* Check if page number was posted */
+        if(!isset($_GET['start'])) {
+          $_GET['start']="";
+        }
+
+        /* Check if at least one attribute is specified */
+        $skip = false;
+
+        foreach($must_have_this as $attr)      {
+          if(isset($attrs[$attr][0]) && !empty($attrs[$attr][0])){
+            $skip =false;
+            break;
+          }
+        }
+
+        /* Skip all attributes that we are not allowed to read */
+        $any = false;
+        foreach($attributes as $attr){
+    
+          $acls = $this->get_entry_acls($attrs['dn'],$attr);  
+          if(!preg_match("/r/",$acls)){
+            $attrs[$attr][0] = "";
+          }else{
+            $any = true;
+          }
+        }
+        /* Only show lines that have set any mail or phone informations */
+        if(!$skip && $any){      
+  
+          $this->telephone_list[$attrs['sn'][0].$attrs['dn']]=
+
+            "<td class=\"phonelist\" title=\"".$attrs['sn'][0].", ".$attrs['givenName'][0].
+              "\"onClick='location.href=\"main.php?plug=".validate($_GET['plug']).
+                          "&amp;start=".validate($_GET['start']).
+                          "&amp;show=".urlencode(base64_encode($attrs['dn']))."\"'>
+              <a style='vertical-align:middle;' href=\"main.php?plug=".validate($_GET['plug']).
+                          "&amp;start=".validate($_GET['start']).
+                          "&amp;show=".urlencode(base64_encode($attrs['dn']))."\">".
+               $attrs['sn'][0].", ".$attrs['givenName'][0].
+            "</a>
+            &nbsp;</td>
+            <td class=\"phonelist\" title=\""._("Dial")." ".$attrs['telephoneNumber'][0]."\">
+            <a style='vertical-align:middle;' href=\"main.php?plug=".validate($_GET['plug'])."&amp;dial=telephoneNumber&amp;start=".validate($_GET['start'])."&amp;target=".base64_encode($attrs['dn'])."\">".$attrs['telephoneNumber'][0]."
+            </a>
+            &nbsp;</td>
+            <td class=\"phonelist\" title=\"".$attrs['facsimileTelephoneNumber'][0]."\">
+            ".$attrs['facsimileTelephoneNumber'][0]."
+            &nbsp;</td>
+            <td class=\"phonelist\" title=\""._("Dial")." ".$attrs['mobile'][0]."\">
+            <a style='vertical-align:middle;' href=\"main.php?plug=".validate($_GET['plug'])."&amp;dial=mobile&amp;start=".validate($_GET['start'])."&amp;target=".base64_encode($attrs['dn'])."\">".$attrs['mobile'][0]."
+            </a>
+            &nbsp;</td>
+            <td class=\"phonelist\" title=\""._("Dial")." ".$attrs['homePhone'][0]."\">
+            <a style='vertical-align:middle;' href=\"main.php?plug=".validate($_GET['plug'])."&amp;dial=homePhone&amp;start=".validate($_GET['start'])."&amp;target=".base64_encode($attrs['dn'])."\">".$attrs['homePhone'][0]."
+            </a>
+            &nbsp;</td>
+            <td>
+            <a href=\"getvcard.php?dn=".base64_encode($attrs['dn'])."\">
+            <img align=\"top\" border=0 src=\"images/save.png\" alt=\"vcf\" title=\"".sprintf(_("Save contact for %s as vcard"), $attrs['givenName'][0]." ".$attrs['sn'][0])."\">
+            </a>";
+
+
+          if(preg_match("/r/",$this->get_entry_acls($attrs['dn'],"mail"))){
+            if (isset($attrs['mail'][0]) && !empty($attrs['mail'][0])){
+              $dest= sprintf(_("Send mail to %s"), $attrs['mail'][0]);
+              $this->telephone_list[$attrs['sn'][0].$attrs['dn']].=
+
+                "<a href=\"mailto:".htmlentities($attrs['mail'][0])."\">".
+                "<img  align=\"top\" border=0 src=\"images/mailto.png\" alt=\"vcf\" title=\"$dest\"></a>";
+            }
+          }
+          $this->telephone_list[$attrs['sn'][0].$attrs['dn']].= "&nbsp;</td>";
+        }
+      }
+      error_reporting(E_ALL | E_STRICT);
+    }
+
+    /* Sort up list */
+    ksort ($this->telephone_list);
+    reset ($this->telephone_list);
+
+    /* Fill template variables */
+    $smarty->assign("search_for", $this->search_for);
+    $smarty->assign("object_type", $this->object_type);
+
+    $this->base = $phonefilter['search_base'];
+    $smarty->assign("deplist", $this->get_allowed_bases());
+    $smarty->assign("depselect", $this->search_base);
+    $smarty->assign("global", $phonefilter['global']);
+    $smarty->assign("organizational", $phonefilter['organizational']);
+    $smarty->assign("search_image", get_template_path('images/search.png'));
+    $smarty->assign("obj_image", get_template_path('images/list_ogroup.png'));
+    $smarty->assign("tree_image", get_template_path('images/tree.png'));
+    $smarty->assign("infoimage", get_template_path('images/info.png'));
+    $smarty->assign("actionimage", get_template_path('images/action.png'));
+    $smarty->assign("launchimage", get_template_path('images/launch.png'));
+
+    /* Generate alphabet */
+    $alphabet= generate_alphabet();
+
+    /* Build list output */
+    $output= "";
+    $mod= 0;
+
+
+    /* View detailed infos */
+    $smarty->assign("show_info", "");
+    if (isset($_SESSION['show_info'])){
+
+      $range= 4;
+      $smarty->assign("show_info", "1");
+      $smarty->assign("url", "main.php?plug=".validate($_GET['plug'])."&amp;close=1");
+
+      $tmp = $this->plInfo();
+
+      if(isset($_POST['storage_base'])){
+        $this->storage_base = $_POST['storage_base'];  
+      }
+
+      switch ($_SESSION['show_info']){
+
+        case "ADD":
+
+          $a_bases = $this->get_allowed_bases();
+  
+          if(!isset($a_bases[$this->storage_base])){
+            $base = key($this->get_allowed_bases());
+            $this->storage_base = $base;
+          } 
+
+          $smarty->assign ('storage_base', $this->storage_base);
+          $smarty->assign ('address_info', get_template_path('address_edit.tpl', TRUE));
+
+          foreach($tmp['plProvidedAcls'] as $name => $translated){
+            $smarty->assign($name."ACL",$this->get_entry_acls($this->abobjectclass.",".$base,$name));
+          }
+        break;
+
+        default:
+          $smarty->assign ('address_info', get_template_path('address_info.tpl', TRUE));
+          foreach($tmp['plProvidedAcls'] as $name => $translated){
+            $smarty->assign($name."ACL",$this->get_entry_acls($this->dn,$name));
+          }
+        break;
+      }
+
+      /* Fill variables from LDAP */
+      if ($_SESSION['show_info'] != "ADD"){
+        $ldap->cat($_SESSION['show_info'], $this->attributes);
+        $info= $ldap->fetch();
+      }
+      foreach ($this->attributes as $name){
+
+        /* Skip entries we are not allowed to read */
+        if(!preg_match("/r/",$this->get_entry_acls($this->dn,$name))){
+          $smarty->assign("info_$name", "");
+        }else
+
+        if ($_SESSION['show_info'] != "ADD" && isset($info["$name"][0])){
+          error_reporting(0);
+          /* Special treatment for phone attributes */
+          if ($name == "mobile" ||
+              $name == "homePhone" ||
+              $name == "telephoneNumber"){
+            $smarty->assign("info_$name",
+                "<a title=\""._("Dial")." ".$info["$name"][0]."\" href=\"main.php?plug=".validate($_GET['plug'])."&amp;dial=$name&amp;start=".validate($_GET['start'])."&amp;target=".base64_encode($_SESSION['show_info'])."\">".$info["$name"][0]."</a>");
+          } else {
+            $smarty->assign("info_$name", preg_replace("/\n/", "<br>", $info["$name"][0]));
+          }
+          error_reporting(E_ALL | E_STRICT);
+        } elseif ($_SESSION['show_info'] == "ADD" && isset($this->$name)) {
+          $smarty->assign("info_$name", $this->$name);
+        } else {
+          $smarty->assign("info_$name", "-");
+        }
+      }
+      if (preg_match("/,".$this->abobjectclass.",/", $_SESSION['show_info'])){
+        $storage= _("global addressbook");
+        $smarty->assign("internal", 0);
+      } else {
+        $storage= _("user database");
+        $smarty->assign("internal", 1);
+      }
+      if ($_SESSION['show_info'] != "ADD"){
+        $smarty->assign("storage_info", sprintf(_("Contact stored in '%s'"), $storage));
+      } else {
+        $smarty->assign("storage_info", _("Creating new entry in"));
+      }
+    } else {
+
+
+      if(isset($_POST['EntryPerPage'])){
+        $this->range = $_POST['EntryPerPage'];
+      }
+      $range = $this->range;   
+      $smarty->assign("internal", 1);
+    }
+    if (isset($_GET['start'])){
+      $this->start= validate($_GET['start']);
+    }
+    foreach ($this->telephone_list as $val){
+      if ($mod < $this->start) {
+        $mod++;
+        continue;
+      }
+      if ($mod >= ($this->start + $range)){
+        $mod++;
+        break;
+      }
+      if ( ($mod++) & 1){
+        $col= "style=\"background-color: #ECECEC;\"";
+      } else {
+        $col= "style=\"background-color: #F5F5F5;\"";
+      }
+      $output.= "<tr $col>\n$val</tr>\n";
+    }
+
+    $smarty->assign("search_result", $output);
+    $smarty->assign("apply", apply_filter());
+    $smarty->assign("alphabet", $alphabet);
+    if($range < 20){
+      $smarty->assign("range_selector", range_selector(count($this->telephone_list), $this->start, $range));
+    }else{
+      $smarty->assign("range_selector", range_selector(count($this->telephone_list), $this->start, $range, "EntryPerPage"));
+    }
+    $tmp= array("*" => _("All"), "sn" => _("Name"), "givenName" => _("Given name"),
+        "telephoneNumber" => _("Work phone"), "mobile" => _("Cell phone"),
+        "homePhone" => _("Home phone"), "uid" => _("User ID"));
+    natsort($tmp);
+    $smarty->assign("objlist", $tmp);
+
+    /* Show main page */
+    $smarty->assign ('personal_image', get_template_path('images/addr_personal.png'));
+    $smarty->assign ('home_image', get_template_path('images/addr_home.png'));
+    $smarty->assign ('company_image', get_template_path('images/addr_company.png'));
+    $smarty->assign ('add_image', get_template_path('images/editpaste.png'));
+    $smarty->assign ('edit_image', get_template_path('images/edit.png'));
+    $smarty->assign ('delete_image', get_template_path('images/editdelete.png'));
+    return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
+  }
+
+  function save_object()
+  {
+    plugin::save_object();
+    foreach($this->attributes as $attr){
+
+      /* save attributes depending on acls */
+      $acl = $this->get_entry_acls($this->dn,$attr);
+
+      if(preg_match("/w/",$acl)){
+        if(isset($_POST[$attr])){
+          $this->$attr = $_POST[$attr];
+        }
+      }
+
+    }
+  }
+
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    /* must: sn, givenName */
+    if ($this->sn == ""){
+      $message[]= _("The required field 'Name' is not set.");
+      return ($message);
+    }
+    if ($this->givenName == ""){
+      $message[]= _("The required field 'Given name' is not set.");
+      return ($message);
+    }
+
+    /* Check for valid name definition */
+    if (preg_match ("/[\\\\]/", $this->sn)){
+      $message[]= _("The field 'Name' contains invalid characters.");
+    }
+    if (preg_match ("/[\\\\]/", $this->givenName)){
+      $message[]= _("The field 'Given name' contains invalid characters.");
+    }
+
+    /* Check phone numbers */
+    if (!is_phone_nr($this->homePhone)){
+      $message[]= _("The field 'Phone' contains an invalid phone number.");
+    }
+    if (!is_phone_nr($this->telephoneNumber)){
+      $message[]= _("The field 'Phone' contains an invalid phone number.");
+    }
+    if (!is_phone_nr($this->facsimileTelephoneNumber)){
+      $message[]= _("The field 'Fax' contains an invalid phone number.");
+    }
+    if (!is_phone_nr($this->mobile)){
+      $message[]= _("The field 'Mobile' contains an invalid phone number.");
+    }
+    if (!is_phone_nr($this->pager)){
+      $message[]= _("The field 'Pager' contains an invalid phone number.");
+    }
+
+    /* Check for reserved characers */
+    if (preg_match ('/[,+"<>;]/', $this->givenName)){
+      $message[]= _("The field 'Given name' contains invalid characters.");
+  }
+  if (preg_match ('/[,+"<>;]/', $this->sn)){
+    $message[]= _("The field 'Name' contains invalid characters.");
+  }
+
+  /* Check mail */
+  if (!is_email($this->mail)){
+    $message[]= _("Please enter a valid email address in 'Primary address' field.");
+  }
+
+  /* Assemble cn/dn */
+  $this->cn= $this->givenName." ".$this->sn;
+  if ($this->orig_cn != $this->cn || $this->storage_base != $this->orig_storage_base){
+    $this->new_dn= $this->create_unique_dn("cn", preg_replace("/,*".$this->config->current['BASE']."$/", "", $this->storage_base).",".$this->abobjectclass.",".$this->config->current['BASE']);
+    if ($this->new_dn == "none"){
+      $message[]= _("Cannot create a unique DN for your entry. Please fill more formular fields.");
+      return ($message);
+    }
+  } else {
+    $this->new_dn= $this->dn;
+  }
+
+  return ($message);
+  }
+
+
+  function load()
+  {
+    /* Load base attributes */
+    plugin::plugin ($this->config, $this->dn);
+    $this->view_logged = FALSE;
+    $this->storage_base= preg_replace('/^[^,]+,/', '', preg_replace('/'.$this->abobjectclass.',/', '', $this->dn));
+  }
+
+
+  function save()
+  {
+    /* First use parents methods to do some basic fillup in $this->attrs */
+    plugin::save ();
+
+    $this->attrs['cn']= $this->cn;
+    $this->attrs['displayName']= $this->givenName." ".$this->sn;
+
+    /* Move entry if it got another name... */
+    if ($this->dn != "new" && $this->dn != $this->new_dn){
+      $this->move($this->dn, $this->new_dn);
+    }
+    $this->dn= $this->new_dn;
+
+    /* Save data. Using 'modify' implies that the entry is already present, use 'add' for
+       new entries. So do a check first... */
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cat ($this->dn,array('dn'));
+    if ($ldap->fetch()){
+      $mode= "modify";
+    } else {
+      $mode= "add";
+      $ldap->cd($this->config->current['BASE']);
+      $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
+    }
+
+    /* Finally write data with selected 'mode' */
+    $ldap->cd ($this->dn);
+    $this->cleanup();
+    $ldap->$mode ($this->attrs);
+    if (show_ldap_error($ldap->get_error(), sprintf(_("Removing of addressbook entry '%s' failed."),$this->dn))){
+      return (1);
+    }
+
+    if($mode == "add"){
+      new log("create","addressbook/".get_class($this),$this->dn, array_keys($this->attrs),$ldap->get_error());
+    }else{
+      new log("modify","addressbook/".get_class($this),$this->dn, array_keys($this->attrs),$ldap->get_error());
+    }
+  }
+
+  
+  /* Return entry acls */
+  function get_entry_acls($dn,$attr = "")
+  {
+    $acls = "";
+  
+    /* Use addressbook acls */
+    if(preg_match("/".normalizePreg($this->abobjectclass)."/",$dn))  {
+      $dn = preg_replace("/".normalizePreg($this->abobjectclass).",/","",$dn);
+      $acls = $this->ui->get_permissions($dn,"addressbook/addressbook",$attr);
+    }
+    
+    /* Use Organizational Person acls */
+    else{
+      $acls = $this->ui->get_permissions($dn,"users/user",$attr);
+    }
+
+    return($acls);
+  }
+
+
+  /* Return plugin informations for acl handling  */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName" => _("Addressbook"),
+          "plDescription" => _("Addressbook entry acls"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 0,
+          "plSection"     => array("addons" => _("Addons")),
+          "plCategory"    => array("addressbook" => array("objectClass" => "inetOrgPerson", "description" => _("Addressbook"))),
+
+          "plProvidedAcls"    => array(
+            "sn"                        => _("Surename"),         
+            "givenName"                 => _("Given name"), 
+            "telephoneNumber"           => _("Telefon number"), 
+            "facsimileTelephoneNumber"  => _("Fax number"), 
+            "mobile"                    => _("Mobile number"), 
+            "homePhone"                 => _("Home phone number"), 
+            "uid"                       => _("User identification"), 
+            "mail"                      => _("Mail address"), 
+            "pager"                     => _("Pager"),
+            "o"                         => _("Organization"),
+            "ou"                        => _("Department"),
+            "l"                         => _("Location"),
+            "postalAddress"             => _("Postal address"),
+            "postalCode"                => _("Postal address"),
+            "st"                        => _("State"),
+            "initials"                  => _("Initials"), 
+            "title"                     => _("Title"), 
+            "homePostalAddress"         => _("Home postal address"), 
+            "cn"                        => _("Common name"))
+            ));
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/addons/addressbook/contents.tpl b/gosa-core/plugins/addons/addressbook/contents.tpl
new file mode 100644 (file)
index 0000000..004e3d2
--- /dev/null
@@ -0,0 +1,127 @@
+<table summary="" style="table-layout:fixed; width:100%; vertical-align:top; text-align:left; table-layout:auto;" cellpadding="4" border="0">
+<tr>
+  <td style="vertical-align:top;">
+   <table summary="" style="border:1px solid #B0B0B0; width:100%; vertical-align:top; text-align:left;"  cellpadding="4" cellspacing="0">
+    <colgroup>
+        <col width="32%">
+        <col width="14%">
+        <col width="14%">
+        <col width="14%">
+        <col width="14%">
+        <col width="8%">
+    </colgroup>
+    <tr style="background-color: #E8E8E8; height:26px;font-weight:bold;">
+     <td class="tbhead">{t}Name{/t}</td><td class="tbhead">{t}Phone{/t}</td><td class="tbhead">{t}Fax{/t}</td>
+     <td class="tbhead">{t}Mobile{/t}</td><td class="tbhead">{t}Private{/t}</td><td class="tbrhead">{t}Contact{/t}</td>
+    </tr>
+    {$search_result}
+   </table>
+
+   <table summary="" style="vertical-align:top; text-align:center; width:100%;" cellpadding="4" cellspacing="0" border="0">
+    <tr>
+     <td>{$range_selector}</td>
+    </tr>
+   </table>
+
+   {if $show_info eq 1}
+    {include file=$address_info}
+   {/if}
+
+  </td>
+  <td style="vertical-align:top; width:270px;">
+   <div class="contentboxh" style="border-bottom:1px solid #B0B0B0;">
+    <p class="contentboxh"><img src="{$infoimage}" align="right" alt="[i]">{t}Information{/t}</p>
+   </div>
+   <div class="contentboxb">
+    <p class="contentboxb">
+     {t}The telephone list plugin provides list and search facilities for the people in your site. You may want to specify the asterisk [*] like in 'Go*us' to find 'Gonicus'. Use the filters below to narrow down your search.{/t}
+    </p>
+   </div>
+   <br>
+   <div class="contentboxh">
+    <p class="contentboxh" style="vertical-align:middle;"><img src="{$actionimage}" style="vertical-align:middle;" align="right" alt="[a]">{t}Actions{/t}</p>
+   </div>
+   <div class="contentboxb">
+    <p class="contentboxb" style="vertical-align:middle;">
+{if $internal_createable}
+     <img class="center" alt="" src="{$add_image}">&nbsp;
+     <a href="main.php{$plug}&amp;global=add" style="text-align:center;vertical-align:middle;">{t}Add entry{/t}</a><br>
+{/if}
+
+{if $internal eq 0}
+ {if $internal_editable}
+     <img alt="" src="{$edit_image}" class="center">&nbsp;
+     <a href="main.php{$plug}&amp;global=edit">{t}Edit entry{/t}</a><br>
+ {/if}
+ {if $internal_removeable}
+            <img alt="" src="{$delete_image}" class="center">&nbsp;
+            <a href="main.php{$plug}&amp;global=remove" style="vertical-align:middle;">{t}Remove entry{/t}</a><br>
+ {/if}
+{/if}
+    </p>
+   </div>
+   <br>
+   <div class="contentboxh">
+    <p class="contentboxh"><img src="{$launchimage}" align="right" alt="[F]">{t}Filters{/t}</p>
+   </div>
+   <div class="contentboxb">
+    <table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
+     {$alphabet}
+    </table>
+    
+<table summary=""  style="width:100%;border-top:1px solid #B0B0B0;">
+       <tr>
+               <td>
+<input type="checkbox" name="organizational" value="1" {$organizational} onClick="mainform.submit()" title="{t}Select to see regular users{/t}">{t}Show organizational entries{/t}<br>
+    <input type="checkbox" name="global" value="1" {$global} onClick="mainform.submit()" title="{t}Select to see users in addressbook{/t}">{t}Show addressbook entries{/t}<br>
+               </td>
+       </tr>
+</table>
+
+<table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
+       <tr>
+               <td>
+                       <label for="search_base"><img class="center" alt="" src="{$tree_image}" align=middle title='{t}Display results for department{/t}'></label>
+               </td>
+       <td>
+                       <select name="search_base" style='width:220px' onChange="mainform.submit()" title="{t}Choose the department the search will be based on{/t}">
+                       {html_options options=$deplist selected=$depselect}
+                               <option disabled>&nbsp;</option>
+               </select>
+               </td>
+       </tr>
+</table>
+<table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
+       <tr>
+               <td>
+                       <label for="object_type"><img class="center" alt="" src="{$obj_image}" align=middle title='{t}Match object{/t}'></label>
+               </td>
+           <td>
+                       <select id="object_type" style='width:220px' name="object_type" onChange="mainform.submit()" title="{t}Choose the object that will be searched in{/t}">
+                       {html_options options=$objlist selected=$object_type}
+                               <option disabled>&nbsp;</option>
+               </select>
+           </td>
+       </tr>
+</table>
+<table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
+       <tr>
+               <td><label for="search_for"><img class="center" alt="" src="{$search_image}" style="text-align:center;" title='{t}Search for{/t}'></label>
+               </td>
+           <td>
+                       <input id="search_for" style='width:99%' type='text' name='search_for' maxlength='20' value='{$search_for}' title='{t}Search string{/t}' onChange="mainform.submit()">
+               </td>
+       </tr>
+</table>
+   {$apply}
+   </div>
+  </td>
+</tr>
+</table>
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('search_for');
+  -->
+</script>
diff --git a/gosa-core/plugins/addons/addressbook/dial.tpl b/gosa-core/plugins/addons/addressbook/dial.tpl
new file mode 100644 (file)
index 0000000..b10b8db
--- /dev/null
@@ -0,0 +1,15 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left; border:1px solid #B0B0B0;" cellpadding=4 cellspacing=0 border=0>
+<tr style="background-color: #E8E8E8; height:26px;font-weight:bold;">
+<td align=left width="100%"><LABEL for="dial">{t}Dial connection...{/t}</LABEL></td>
+</tr>
+<tr style="background-color: white">
+<td style="text-align:center;">
+ <div style="height:50px;">&nbsp;</div>
+ <a style="font-size:22px"><img alt="" src="{$phone_image}" align=middle>{$dial_info}</a>
+ <div style="height:60px;">&nbsp;</div>
+ <input type='submit' name='dial' id="dial" value='{t}Dial{/t}'>&nbsp;<input type='submit' name='cancel' value='{t}Cancel{/t}'>
+
+</td>
+
+</tr>
+</table>
diff --git a/gosa-core/plugins/addons/addressbook/main.inc b/gosa-core/plugins/addons/addressbook/main.inc
new file mode 100644 (file)
index 0000000..dbfd760
--- /dev/null
@@ -0,0 +1,41 @@
+<?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
+*/
+
+if (!$remove_lock){
+       /* Create phonelist object on demand */
+       if (!isset($_SESSION['addressbook']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+               $_SESSION['addressbook']= new addressbook ($config);
+               $_SESSION['addressbook']->set_acl_base($ui->dn);
+               $_SESSION['addressbook']->set_acl_category("addressbook");
+               unset($_SESSION['show_info']);
+       }
+       $addressbook= $_SESSION['addressbook'];
+
+       /* Execute formular */
+       $display= $addressbook->execute ();
+       $display.= "<input type=\"hidden\" name=\"ignore\">\n";
+
+       /* Page header*/
+       $display= print_header(get_template_path('images/addressbook.png'), _("Address book")).$display;
+
+       /* Store changes  in session */
+       $_SESSION['addressbook']= $addressbook;
+}
+?>
diff --git a/gosa-core/plugins/addons/addressbook/remove.tpl b/gosa-core/plugins/addons/addressbook/remove.tpl
new file mode 100644 (file)
index 0000000..ba37685
--- /dev/null
@@ -0,0 +1,18 @@
+<div style="font-size:18px;">
+ <img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
+</div>
+<p>
+  {$info}
+  {t}This includes all addressbook data in this entry. 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}So - if you're sure - press 'Delete' to continue or 'Cancel' to abort.{/t}
+</p>
+
+<p class="plugbottom">
+  <input type=submit name="delete_entry_confirm" value="{t}Delete{/t}">
+  &nbsp;
+  <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
+</p>
+
diff --git a/gosa-core/plugins/addons/bugsubmitter/class_bugsubmitter.inc b/gosa-core/plugins/addons/bugsubmitter/class_bugsubmitter.inc
new file mode 100644 (file)
index 0000000..c9dbebd
--- /dev/null
@@ -0,0 +1,8 @@
+<?php
+
+class bugsubmitter extends plugin
+{
+       var $plHeadline= "<a href='https://oss.gonicus.de/labs/gosa/newticket' target='_blank'>Bugsubmitter</a>";
+}
+
+?>
diff --git a/gosa-core/plugins/addons/bugsubmitter/main.inc b/gosa-core/plugins/addons/bugsubmitter/main.inc
new file mode 100644 (file)
index 0000000..82efded
--- /dev/null
@@ -0,0 +1,5 @@
+<?php
+header('location:?');
+exit();
+$display = "";
+?>
diff --git a/gosa-core/plugins/addons/godfs/class_dfsManagment.inc b/gosa-core/plugins/addons/godfs/class_dfsManagment.inc
new file mode 100644 (file)
index 0000000..913b270
--- /dev/null
@@ -0,0 +1,263 @@
+<?php
+
+/* Create a class (name must be unique inside GOsa) which extends plugin. The plugin base
+    class contains all methods that are used by GOsa and it provides the mechanism to load data
+    from LDAP to local variables and prepare the save to ldap routine for you. */
+class dfsManagment extends plugin {
+  /* Definitions */
+  var $plHeadline = "DFS Managment";
+  var $plDescription = "This does something";
+   
+  /* These contain attributes to be loaded. We're not doing an LDAP plugin currently, so we don't
+     care... */
+  var $attributes = array();
+  var $objectclasses = array();
+  var $dfstab = NULL;
+
+  /* The constructor just saves a copy of the config. You may add what ever you need. */
+  function dfsManagment (&$config, &$ui) {
+    /* save config for later use */
+    $this->config = &$config;
+    $this->ui = &$ui;
+    
+  }
+
+  /* Execute is the function all plugins need. It fills the plugin with life and produces the output. */
+  function execute() {
+       
+    /* Normally you would react to user input here. */
+    plugin::execute();    
+
+    $action = "";
+    $s_action= "";
+    $options = "";
+    $regex = "";
+       
+    $icon         = 'folder.gif';
+    $expandedIcon = 'folder-expanded.gif';
+    $base = get_base_from_people($this->ui->dn);
+    $smarty= get_smarty();
+
+    foreach ($_POST as $key => $val) {
+      # delete
+      if (preg_match("/dfs_del.*/", $key)) {
+        $s_action = "del";
+        $s_entry = preg_replace("/dfs_".$s_action."_/i", "", $key);
+        $s_entry = preg_replace("/_.*$/", "", $s_entry);
+        $s_entry = base64_decode($s_entry);
+      # edit  
+      } elseif (preg_match("/dfs_edit.*/", $key)) {
+        $s_action = "edit";
+        $s_entry = preg_replace("/dfs_".$s_action."_/i", "", $key);
+        $s_entry = preg_replace("/_.*$/", "", $s_entry);
+        $s_entry = base64_decode($s_entry);
+      # new
+      } elseif (preg_match("/dfs_new.*/", $key)) {
+        $s_action = "new";
+      # back
+      } elseif (preg_match("/dfs_back.*/", $key)) {
+        $s_action = "back";
+      # home
+      } elseif (preg_match("/dfs_home.*/", $key)) {
+        $s_action = "home";
+      # root
+      } elseif (preg_match("/dfs_root.*/", $key)) {
+        $s_action = "root";
+      }
+    }  
+
+    $tree  = new HTML_TreeMenu();
+
+    if ((isset($_GET['act'])) && ($_GET['act'] == "edit_entry")) {
+      $s_action = "edit";
+      $dfs_share = $_GET['id'];
+    }
+
+    # new
+    if ($s_action == "new") {
+      $this->dn = "new";
+      $this->dfstab = new dfstabs($this->config, $this->config->data['TABS']['DFSTABS'], $this->dn);
+    }
+
+    # edit
+    if (($_SERVER['REQUEST_METHOD'] == "POST") || ($_SERVER['REQUEST_METHOD'] == "GET")) {
+      if ($s_action == "edit") {
+
+        $this->dn = $dfs_share;
+
+        if (($user = get_lock($this->dn)) != "") {  
+          return (gen_locked_message ($user, $this->dn));
+        } else {
+          add_lock ($this->dn, $this->ui->dn);
+        }
+
+        $this->acl = get_permissions($this->dn, $this->ui->subtreeACL);
+
+        $this->dfstab = new dfstabs($this->config, $this->config->data['TABS']['DFSTABS'], $this->dn);
+        $this->dfstab->set_acl($this->acl);
+        $this->dfstab->save_object();
+        $_SESSION['objectinfo']= $this->dn;
+      }
+    } 
+      
+    # save pressed
+    if (isset($_POST['edit_finish'])) {
+      $this->dfstab->last = $this->dfstab->current;
+      $this->dfstab->save_object(); 
+      #$disp = $this->by_object[''];
+      #var_dump($disp);
+    
+      $message = $this->dfstab->check();
+     
+      # any errors?
+      if (count($message) == 0) {
+        # write to ldap
+        $this->dfstab->save();
+      } else {
+        show_errors($message);
+      }
+    }
+
+    # cancel pressed
+    if (isset($_POST['edit_cancel'])) {
+      del_lock ($_SESSION['objectinfo']);
+      unset ($this->dfstab);
+      $this->dfstab = NULL;
+      $this->dn = "";
+      unset($_SESSION['objectinfo']);
+    }
+
+    # delete pressed
+    if (isset($_POST['edit_delete'])) {
+      
+      # get the current values
+      $this->sambasharename = $_POST['sambaShareName'];
+      $this->sharedescription = $_POST['description'];
+      $this->fileserver = $_POST['fileserver'];
+      $this->share = $_POST['fileservershare'];
+      $this->loc = $_POST['location'];
+          
+      $base = get_base_from_people($this->ui->dn);
+      $ou = get_ou("DFS");
+      $this->basedn = "sambaShareName=$this->sambasharename,ou=$this->loc,$ou$base";
+
+      $ldap = $this->config->get_ldap_link();
+      $ldap->cd($this->basedn);
+      $ldap->rmdir($this->basedn);
+                       show_ldap_error($ldap->get_error(), sprintf(_("Removing of DFS share with dn '%s' failed."),$this->dn));
+      
+      del_lock ($_SESSION['objectinfo']);
+      unset ($this->dfstab);
+      $this->dfstab = NULL;
+      $this->dn = "";
+      unset($_SESSION['objectinfo']);
+    }
+
+    # generate main page no tabs
+
+    $ldap = $this->config->get_ldap_link();
+
+    $ou = get_ou("DFS");
+    
+    $ldap->cd("$ou$base");
+    $ldap->search(("ou=*"), array("dn"));
+    
+    if ($ldap->count() == 0) {
+      $message[] = _("No DFS entries found");
+      show_errors ($message);
+    } else {
+      $have_tree= false;
+      while ($dfs = $ldap->fetch()) {
+        if (preg_match("/^ou=DFS.*/", $dfs["dn"])) {
+          $dfs_root_node = new HTML_TreeNode(array('text' => "DFS", 'icon' => $icon, 'expandedIcon' => $expandedIcon, 'expanded' => false));
+         $have_tree= true;
+        } elseif ($have_tree) {
+          preg_match("/^ou=(.*),/U", $dfs["dn"], $reg);
+          $loc = $reg[1];
+          $node = $dfs_root_node->addItem(new HTML_TreeNode(array('text' => "$loc", 'icon' => $icon, 'expandedIcon' => $expandedIcon)));
+          
+          $sub_node_ldap = $this->config->get_ldap_link();
+          $sub_node_ldap->cd("ou=$loc, $ou$base");
+          $sub_node_ldap->search("(objectclass=sambaShare)", array("sambaShareName", "description", "documentLocation"));
+          
+          while ($dfs_loc = $sub_node_ldap->fetch()) {
+            $share_name = $dfs_loc["sambaShareName"][0];
+            $desc = $dfs_loc["description"][0];
+            $srv_loc = preg_replace("/msdfs:/", "", $dfs_loc["documentLocation"][0]);
+            #$srv_loc = preg_replace("/\\/", "\\\\", $srv_loc);
+            $link = "main.php\?plug=".$_GET['plug']."\&id=$loc\/$share_name\&act=edit_entry"; 
+            $share_node = &$node->addItem(new HTML_TreeNode(array('text' => "$share_name - $desc", 'link' => "$link", 'icon' => $icon, 'expandedIcon' => $expandedIcon)));
+            $srv_loc_node = &$share_node->addItem(new HTML_TreeNode(array('text' => "$srv_loc", 'icon' => $icon, 'expandedIcon' => $expandedIcon)));
+          }
+        }
+      }
+    }
+
+    $tree->addItem($dfs_root_node);
+
+    // Create the presentation class
+    $treeMenu = new HTML_TreeMenu_DHTML($tree, array('images' => 'images', 'defaultClass' => 'treeMenuDefault'));
+    $tree_html = $treeMenu->toHTML();
+    
+    if ($this->dfstab === NULL) {
+
+      if (($message = check_sizelimit()) != "") {
+        return ($message);
+      }
+  
+      $listhead = "<div style='background:#F0F0F9;padding:5px;'>".
+         " <input type='image' class='center' src='images/list_up.png' align='middle' title='"._("Go up one dfsshare")."' name='dfs_back' alt='"._("Up")."'>&nbsp;".
+         " <input type='image' class='center' src='images/list_root.png' align='middle' title='"._("Go to dfs root")."' name='dfs_root' alt='"._("Root")."'>&nbsp;".
+         " <input class='center' type='image' src='images/dtree.png' align='middle' alt='"._("Create new dfsshare")."' name='dfs_new'>&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>";
+
+
+      /* Use the smarty templating engine here... */
+
+      $smarty->assign('tree', $tree_html);
+      $smarty->assign('search_image', get_template_path('images/search.png'));
+      $smarty->assign('infoimage', get_template_path('images/info.png'));
+      $smarty->assign('launchimage', get_template_path('images/launch.png'));
+      $smarty->assign('alphabet', generate_alphabet());
+      $smarty->assign('hint', print_sizelimit_warning());
+      $smarty->assign('apply', apply_filter());
+      $smarty->assign('dfshead', $listhead);
+
+      /* Let smarty fetch and process the page. Always seperate PHP and HTML as much as
+         you can. */
+      return ($smarty->fetch (get_template_path('contents.tpl', TRUE)));
+    }
+
+    /* TABS */
+
+    $display = $this->dfstab->execute();
+   
+    $display .= "<p>\n";
+    $display .= "  <table width=100\%>\n";
+    $display .= "    <tbody>\n";
+    $display .= "      <tr>\n";
+    $display .= "        <td style=\"text-align: right\">\n";
+    $display .= "          <input type=submit name=\"edit_finish\" value=\""._("Finish")."\">\n";
+    $display .= "          &nbsp;\n";
+    $display .= "          <input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+    $display .= "        </td>\n";
+    $display .= "      </tr>\n";
+    $display .= "    </tbody>\n";
+    $display .= "  </table>\n";
+    $display .= "</p>\n";
+    
+    return ($display);
+
+  }
+
+  function remove_lock() {
+    if (isset($this->dn)) {
+      del_lock ($this->dn);
+    }
+  }
+
+}
+?>
diff --git a/gosa-core/plugins/addons/godfs/class_dfsgeneric.inc b/gosa-core/plugins/addons/godfs/class_dfsgeneric.inc
new file mode 100644 (file)
index 0000000..12a2ed2
--- /dev/null
@@ -0,0 +1,223 @@
+<?php
+
+  class dfsgeneric extends plugin {
+    /* CLI vars */
+    var $cli_summary      = "Manage terminal base objects";
+    var $cli_description  = "Some longer text\nfor help";
+    var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+    /* Needed values and lists */
+    var $base             = "";
+    var $cn               = "";
+
+    /* attribute list for save action */
+    var $attributes     = array();
+    var $objectclasses  = array();
+
+    function dfsgeneric(&$config, $dn) {
+      plugin::plugin($config, $dn);
+      $this->dn = $dn;
+      $this->orig_dn = $dn;
+    }
+    function execute() {
+      /* Call parent execute */
+      plugin::execute();
+      
+      $smarty= get_smarty();
+
+      if (($this->dn == "new") || ($this->dn == "")) {
+        $smarty->assign("sambasharename", "");
+        $smarty->assign("sharedescription", "");
+        $smarty->assign("fileserver", "");
+        $smarty->assign("fileservershare", "");
+        $smarty->assign("location", "");
+        $smarty->assign("dfsdescription", "");
+      } else {
+        $ldap = $this->config->get_ldap_link();
+
+        $base = get_base_from_people($this->dn);
+        $ou = get_ou("DFS");
+
+        $tmp = preg_split('/\//', $this->dn, 2);
+        $this->loc = $tmp[0];
+        $this->sambasharename = $tmp[1];
+
+        $ldap->cd("$ou $base");
+        $ldap->search(("ou=$this->loc"), array("description"));
+        $dfs_desc = $ldap->fetch();
+        $this->dfsdescription = $dfs_desc['description'][0];
+
+        $ldap->cd("ou=$this->loc, $ou $base");
+        $ldap->search("(&(sambaShareName=$this->sambasharename)(objectclass=sambaShare))", array("description", "documentLocation"));
+
+        $details = $ldap->fetch();
+        $this->sharedescription = $details['description'][0];
+        $tmp = preg_split('/\\\\/', $details['documentLocation'][0], 2);
+
+        $this->fileserver = preg_replace("/msdfs:/", "", $tmp[0]);
+        $this->share = preg_replace("/\\\/", "", $tmp[1]);
+      
+        #var_dump($this->dn);
+        #echo "<BR>\n";
+
+        /* Fill array */
+        #$this->reload();
+        $smarty->assign("sambasharename", $this->sambasharename);
+        $smarty->assign("sharedescription", $this->sharedescription);
+        $smarty->assign("fileserver", $this->fileserver);
+        $smarty->assign("fileservershare", $this->share);
+        $smarty->assign("location", $this->loc);
+        $smarty->assign("dfsdescription", $this->dfsdescription);
+      }
+
+      /* Show main page */
+      return ($smarty->fetch (get_template_path('generic.tpl', TRUE)));
+      #, dirname(__FILE__))));
+    }
+
+    function check() 
+       {
+      plugin::check(); 
+      $message = array();
+
+      ## permission
+      #if (chkacl($this->acl, "create") != "") {
+      #  $message[] = _("You have no premissions to create a dfs share.");
+      #}
+
+      # existance
+      
+      $ldap = $this->config->get_ldap_link();
+      $base = get_base_from_people($this->ui->dn);
+      $ou = get_ou("DFS");
+      $dn_explode = explode("/", $this->dn);
+      $sub_ou = $dn_explode[0];
+      $sambaShareName = $dn_explode[1] . "/" . $dn_explode[2] . "/" . $dn_explode[3];
+      $dn = "sambaShareName=$sambaShareName,ou=$sub_ou,$ou$base";
+      $ldap->cat($dn);
+      $attrs = $ldap->fetch();
+      
+      if ($this->orig_dn == "new" && !($attrs == FALSE)) {
+        $message[] = _("Dfs share already exists.");
+      } elseif ($this->orig_dn != $this->dn && !($attrs == FALSE)) {
+        $message[] = _("Dfs share already exists.");
+      }
+      
+      if ($this->dn == "new" || $this->dn == "") {
+        $this->sambasharename = $_POST['sambaShareName'];
+        $this->sharedescription = $_POST['description'];
+        $this->fileserver = $_POST['fileserver'];
+        $this->share = $_POST['fileservershare'];
+        $this->loc = $_POST['location'];
+      }
+      
+      # required fields set?
+      if ($this->sambasharename == "") {
+        $message[] = _("Required Field \"Name of dfs Share\" is not set.");
+      }
+      if ($this->sharedescription == "") {
+        $message[] = _("Required Field \"Description\" is not set.");
+      }
+      if ($this->fileserver == "") {
+        $message[] = _("Required Field \"Fileserver\" is not set.");
+      }
+      if ($this->share == "") {
+        $message[] = _("Required Field \"Share on fileserver\" is not set.");
+      }
+      if ($this->loc == "") {
+        $message[] = _("Required Field \"Location\" is not set.");
+      }
+
+      return $message;
+    }
+    
+    function save() {
+      
+      plugin::save();
+
+      # get the current values
+      $this->sambasharename = $_POST['sambaShareName'];
+      $this->sharedescription = $_POST['description'];
+      $this->fileserver = $_POST['fileserver'];
+      $this->share = $_POST['fileservershare'];
+      $this->loc = $_POST['location'];
+          
+      # set the attribs
+      $this->attrs["sambaShareName"]   = "$this->sambasharename,ou=$this->loc,$ou$base";
+      $this->attrs["objectClass"][]    = "top";
+      $this->attrs["objectClass"][]    = "SambaShare";
+      $this->attrs["objectClass"][]    = "extensibleObject"; 
+      $this->attrs["sambaShareName"]   = $this->sambasharename;
+      $this->attrs["description"]      = $this->sharedescription;
+      $this->attrs["documentLocation"] = "msdfs:$this->fileserver\\\\$this->share";
+
+      $ldap = $this->config->get_ldap_link();
+
+      if ($this->dn == "new" || $this->dn == "") {
+        echo "new<br>\n";
+        $base = get_base_from_people($this->ui->dn);
+        $ou = get_ou("DFS");
+        $this->basedn = "sambaShareName=$this->sambasharename,ou=$this->loc,$ou$base";
+        $ldap->cd($this->basedn);
+        $ldap->add($this->attrs);
+      } else {
+        # try to find entry
+        $base = get_base_from_people($this->ui->dn);
+        $ou = get_ou("DFS");
+        #$dn_explode = explode("/", $this->sambasharename);
+        #$sub_ou = $dn_explode[0];
+        #$sambaShareName = $dn_explode[1] . "/" . $dn_explode[2] . "/" . $dn_explode[3];
+        $dn = "sambaShareName=$this->sambasharename,ou=$this->loc,$ou$base";
+        $ldap->cat($dn);
+        $attrs = $ldap->fetch();
+          
+        $this->basedn = "sambaShareName=$this->sambasharename,ou=$this->loc,$ou$base";
+        $ldap->cd($this->basedn);
+        $nr = count($attrs);
+        
+        if (count($attrs)) {
+          # modify if found
+          $ldap->modify($this->attrs);
+        } else {
+          # add
+          $ldap->add($this->attrs);
+        }
+                               show_ldap_error($ldap->get_error(), sprintf(_("Saving dfs/generic with dn '%s' failed."),$this->basedn));
+      }
+    }
+
+    function save_object() {
+      #if (isset($_POST['base'])) {
+        plugin::save_object();
+        #echo "base = ".$_POST['base']."<br>\n";
+      #}
+#      if (chkacl($this->acl, "create") == "") {
+        $this->base = $_POST['base'];
+#      }
+    }
+
+    function delete() {
+    
+      plugin::delete();
+
+      # get the current values
+      $this->sambasharename = $_POST['sambaShareName'];
+      $this->sharedescription = $_POST['description'];
+      $this->fileserver = $_POST['fileserver'];
+      $this->share = $_POST['fileservershare'];
+      $this->loc = $_POST['location'];
+          
+      $base = get_base_from_people($this->ui->dn);
+      $ou = get_ou("DFS");
+      $this->basedn = "sambaShareName=$this->sambasharename,ou=$this->loc,$ou$base";
+      echo "BASEDN: $this->basedn<br>\n";
+
+      $ldap = $this->config->get_ldap_link();
+      $ldap->cd($this->basedn);
+      $ldap->rmdir($this->basedn);
+                       show_ldap_error($ldap->get_error(), sprintf(_("Removing dfs/generic with dn '%s' failed."),$this->basedn));
+    }
+      
+  }
+
diff --git a/gosa-core/plugins/addons/godfs/contents.tpl b/gosa-core/plugins/addons/godfs/contents.tpl
new file mode 100644 (file)
index 0000000..e5f2206
--- /dev/null
@@ -0,0 +1,54 @@
+<script src="TreeMenu.js" language="JavaScript" type="text/javascript"></script>
+
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
+<tr>
+  <td style="vertical-align:top;width:600px">
+  <div class="contentboxh">
+    <p class="contentboxh">
+     {t}DFS Shares{/t} {$hint}
+    </p>
+  </div>
+  <div class="contentboxb">
+      {$dfshead}
+  </div>
+  <div style='height:4px;'></div>
+  <div class="contentboxb" style="border-top:1px solid #B0B0B0;">
+      {$tree}
+    <input type=hidden name="edit_helper">
+  </div>
+  </td>
+  <td style="vertical-align:top;">
+   <div class="contentboxh">
+    <p class="contentboxh"><img src="{$infoimage}" align="right" alt="[i]">{t}Information{/t}</p>
+   </div>
+   <div class="contentboxb">
+   <p class="contentboxb">
+     {t}This menu allows you to create, delete and edit selected dfs shares. Having a large numbers of dfs shares, you might prefer the range selectors on top of the dfs share list.{/t}
+   </p>
+   </div>
+   <br>
+   <div class="contentboxh">
+    <p class="contentboxh"><img src="{$launchimage}" align="right" alt="[F]">{t}Filters{/t}</p>
+   </div>
+   <div class="contentboxb">
+     <table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
+      {$alphabet}
+     </table>
+     <table summary=""  style="width:100%;border-top:1px solid #B0B0B0;">
+     <tr>
+     <td>
+     <LABEL for "regex"><img alt="{t}Display dfs shares matching{/t}" src="{$search_image}" align=middle title='{t}Display dfs shares matching{/t}'></LABEL>
+     </td>
+     <td width="99%">
+     <input type='text' name='regex' maxlength='20' style='width:99%' value='{*$regex*}' id='filter'
+     title='{t}Regular expression for matching dfs share names{/t}' onChange="mainform.submit()">
+     </td>
+     </tr>
+     </table>
+                            {$apply}
+   </div>
+  </td>
+</tr>
+</table summary="">
+
+<input type="hidden" name="ignore">
diff --git a/gosa-core/plugins/addons/godfs/generic.tpl b/gosa-core/plugins/addons/godfs/generic.tpl
new file mode 100644 (file)
index 0000000..4f3ded4
--- /dev/null
@@ -0,0 +1,52 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
+ <tr>
+   <td style="vertical-align:top; width:50%">
+     <h2><img alt="" align="top" src="images/rightarrow.png"> {t}DFS Properties{/t}</h2>
+     
+     <table summary="">
+      <tr>
+       <td><LABEL for="sambaShareName">{t}Name of dfs Share{/t}</LABEL>{$must}</td>
+       <td><input id="sambaShareName" name="sambaShareName" size=40 maxlength=100 value="{$sambasharename}"></td>
+      </tr>
+      <tr>
+       <td><LABEL for="descripition">{t}Description{/t}</LABEL>{$must}</td>
+       <td><input id="description" name="description" size=40 maxlength=100 value="{$sharedescription}"></td>
+      </tr>
+      <tr>
+       <td><LABEL for="fileserver">{t}Fileserver{/t}</LABEL>{$must}</td>
+       <td><input id="fileserver" name="fileserver" size=40 maxlength=100 value="{$fileserver}"></td>
+      </tr>
+      <tr>
+       <td><LABEL for="fileservershare">{t}Share on Fileserver{/t}</LABEL>{$must}</td>
+       <td><input id="fileservershare" name="fileservershare" size=40 maxlength=100 value="{$fileservershare}"></td>
+      </tr>
+     </table>
+
+   </td>
+   <td style="border-left:1px solid #A0A0A0">
+    &nbsp;
+   </td>
+   <td style="vertical-align:top; width:50%">
+     <h2><img alt="" align="top" src="images/house.png"> {t}DFS Location{/t}</h2>
+
+     <table summary="" style="width:100%">
+      <tr>
+       <td><LABEL for="location">{t}Location{/t}</LABEL>{$must}</td>
+       <td><input id="location" name="location" size=40 maxlength=100 value="{$location}"></td>
+      </tr>
+      <tr>
+       <td><LABEL for="dfsdescription">{t}Description{/t}</LABEL></td>
+       <td><input id="dfsdescription" name="dfsdescription" size=40 maxlength=100 value="{$dfsdescription}"></td>
+      </tr>
+     </table>
+
+   </td>
+ </tr>
+</table>
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('ou');
+  -->
+</script>
diff --git a/gosa-core/plugins/addons/godfs/main.inc b/gosa-core/plugins/addons/godfs/main.inc
new file mode 100644 (file)
index 0000000..56fc3c0
--- /dev/null
@@ -0,0 +1,42 @@
+<?php
+   if ($remove_lock) {
+     if (isset($_SESSION['dfsManagment'])) {
+       $dfsManagment = $_SESSION['dfsManagment'];
+       $dfsManagment->remove_lock();
+       del_lock($ui->dn);
+       sess_del('dfsManagment');
+     }
+   } else {
+     # create dfsManagment object
+     if (!isset($_SESSION['dfsManagment']) || 
+        (isset($_GET['reset']) && $_GET['reset'] == 1)) {
+       $_SESSION['dfsManagment'] = new dfsManagment($config, $_SESSION['ui']);
+     }
+     $dfsManagment = $_SESSION['dfsManagment'];
+     $output = $dfsManagment->execute();
+
+     # do we have to reset
+     if (isset($_GET['reset']) && $_GET['reset'] == 1) {
+       del_lock ($ui->dn);
+       sess_del('dfsManagment');
+     }
+     # create page header
+     if (isset($_SESSION['objectinfo'])) {
+       $display = print_header(get_template_path('images/dfs.png'), 
+                                _("Distributed File System Administration"),
+                                "<img alt=\"\" class=\"center\" src=\"".
+                                get_template_path('images/closedlock.png').
+                                "\"> ".$_SESSION['objectinfo']);
+     } else {
+       $display = print_header(get_template_path('images/dfs.png'),
+                                _("Distributed File System Administration"));
+     }
+
+     $display.= $output;
+    
+     # show page
+     $_SESSION['dfsManagment'] = $dfsManagment;
+  }
+
+?>
diff --git a/gosa-core/plugins/addons/godfs/tabs_dfs.inc b/gosa-core/plugins/addons/godfs/tabs_dfs.inc
new file mode 100644 (file)
index 0000000..ef5950e
--- /dev/null
@@ -0,0 +1,39 @@
+<?php
+
+class dfstabs extends tabs { 
+  var $base;
+
+  function dfstabs($config, $data, $dn) {
+    tabs::tabs($config, $data, $dn);
+    #$this->base = $this->by_object['dfsManagment']->base;
+  }
+
+  #function save_object() {
+  #  if (isset($_POST['base'])) {
+  #    plugin::save_object();
+  #  } else {
+  #    $this->base = $_POST['base'];
+  #  }
+  #}
+
+
+
+
+  function check($ignore_account= FALSE) {
+    return (tabs::check(TRUE));
+  }
+
+  function save($ignore_account= FALSE)
+  {
+    $baseobject = $this->by_object['dfsManagment'];
+    return tabs::save(TRUE);
+  }
+
+  function del() {
+    $baseobject = $this->by_object['dfsManagment'];
+    return tabs::delete(TRUE); 
+  }
+
+}
+
+?>
diff --git a/gosa-core/plugins/addons/gotomasses/class_divListMasses.inc b/gosa-core/plugins/addons/gotomasses/class_divListMasses.inc
new file mode 100644 (file)
index 0000000..f32f76b
--- /dev/null
@@ -0,0 +1,170 @@
+<?php
+
+class divListMasses extends MultiSelectWindow
+{
+
+  /* Current base */
+  var $selectedBase       = "";
+  var $departments        = array();
+
+  var $parent             ;
+  var $ui                 ;
+
+  var $wake = TRUE;  
+  
+  function divListMasses (&$config,$parent)
+  {
+    MultiSelectWindow::MultiSelectWindow($config, "gotoMasses", array("gotomasses"));
+
+    $this->parent       = $parent;
+    $this->ui           = get_userinfo();
+    $this->SetSummary(_("List of system deployment tasks"));
+    $this->SetHeadpageMode();
+    $this->EnableCloseButton(FALSE);
+    $this->EnableSaveButton(FALSE);
+    $this->SetInformation(_("This menu allows you to add, remove and change the properties of system deployment tasks."));
+
+    foreach($this->parent->get_actions() as $name => $desc){
+      $this->$name = TRUE;
+      $this->AddCheckBox($name,sprintf(_("Display entries with action %s."),$desc),
+                               sprintf(_("Display entries with action %s."),$desc),TRUE);
+    }
+    $plug  = $_GET['plug'];
+
+    /* Toggle all selected / deselected */
+    $chk = "<input type='checkbox' id='select_all' name='select_all'
+               onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
+
+    /* set Page header */
+    $this->AddHeader(array("string"=> $chk,          "attach"=>"style='width:20px;'"));
+    $this->AddHeader(array("string"=>"<a href='?plug=".$plug."&amp;sort=QueuePosition'>"._("#")."</a>",
+                           "attach"=>"style='width:20px;'"));
+    $this->AddHeader(array("string"=>"<a href='?plug=".$plug."&amp;sort=TargetName'>"._("Target")."</a>&nbsp;/&nbsp;".
+                                     "<a href='?plug=".$plug."&amp;sort=TaskID'>"._("Task")."</a>"));
+    $this->AddHeader(array("string"=>"<a href='?plug=".$plug."&amp;sort=Schedule'>"._("Schedule")."</a>",
+                                      "attach"=>"style='width:100px;'"));
+    $this->AddHeader(array("string"=>"<a href='?plug=".$plug."&amp;sort=Action'>"._("Type")."</a>",
+                                      "attach"=>"style='width:80px;'"));
+    $this->AddHeader(array("string"=>_("Action"),
+                                      "attach"=>"style='border-right:0px;width:120px;'"));
+  }
+
+  function GenHeader()
+  {
+    
+    /* Display add button if allowed */
+    $header = "<div style='padding:5px'>";
+    if($this->parent->acl_is_createable()){
+      $header .= "<input type='image' src='images/gotomasses_new_task.png' name='new_task' class='center'>&nbsp;";
+    }
+
+    /* Display add button if allowed */
+    if($this->parent->acl_is_removeable()){
+      $header .= "<input type='image' src='images/edittrash.png' name='remove_multiple_task' class='center'>&nbsp;";
+    }
+
+    /* Add priority options */
+    if(preg_match("/w/",$this->parent->getacl(""))){
+      $header .= "<input type='image' src='images/prio_top.png'       name='multiple_prio_top'      class='center'>&nbsp;";
+      $header .= "<input type='image' src='images/prio_increase.png'  name='multiple_prio_increase' class='center'>&nbsp;";
+      $header .= "<input type='image' src='images/prio_decrease.png'  name='multiple_prio_decrease' class='center'>&nbsp;";
+      $header .= "<input type='image' src='images/prio_bottom.png'    name='multiple_prio_bottom'   class='center'>&nbsp;";
+    }
+    $header .= "</div>";
+    
+    /* Create divlist */
+    $this->SetListHeader($header);
+
+  }
+
+  function execute()
+  {
+    $this->ClearElementsList();
+    $this->GenHeader();
+  }
+
+
+  function setEntries($tasks)
+  {
+    /* Create edit link */
+    $plug = $_GET['plug'];
+    $edit_link = "<div style='width:100%;overflow:hidden;'><nobr><a href='?plug=".$_GET['plug']."&act=edit&id=%id%'>%str%</nobr></div>";
+
+    /* Create action filter array, to sort out those actions we do not want to see */
+    $allowed_action = array();
+    foreach($this->parent->get_actions() as $name => $desc){
+      if($this->$name){
+        $allowed_action[] = $name;
+      }
+    }
+
+    $colors[0] = "#DDDDDD";
+    $colors[1] = "#EEEEEE";
+    $c_keys = array();
+    $last_c = 0;
+    if($this->parent->sort_dir=="down"){
+      $last_c = !$last_c; 
+    }
+  
+    foreach($tasks as $key => $task){
+
+      /* Skip unchecked actions */ 
+      if(!in_array($task['Action'],$allowed_action)){
+        continue;
+      }
+
+      /* Handle coloring */
+      $color="";
+      if($this->parent->sort_by == "TaskID"){
+        if(!in_array($task['TASK_ID'],$c_keys)){
+          $c_keys[] = $task['TASK_ID'];
+          $last_c = !$last_c;
+        }
+        $color = "background-color: ".$colors[$last_c];
+      }
+
+      /* Create actions */
+      $id         = $task['ID'];
+      $queue_pos  = $task['Queue_Position'];
+      $prio_actions = "<input class='center' type='image' src='images/prio_top.png'      name='prio_top_".$id."'>&nbsp;";
+      $prio_actions.= "<input class='center' type='image' src='images/prio_increase.png' name='prio_increase_".$id."'>&nbsp;";
+      $prio_actions.= "<input class='center' type='image' src='images/prio_decrease.png' name='prio_decrease_".$id."'>&nbsp;";
+      $prio_actions.= "<input class='center' type='image' src='images/prio_bottom.png'   name='prio_bottom_".$id."'>&nbsp;";
+      $action = "<input type='image' src='images/edit.png' name='edit_task_".$id."' class='center' alt='"._("Edit")."'>";
+      if($this->parent->acl_is_removeable()){
+        $action.= "<input type='image' src='images/edittrash.png' name='remove_task_".$id."' class='center' alt='"._("Reomve")."'>";
+      }
+
+      $display = preg_replace(array("/%id%/","/%str%/"),array($id,$this->parent->target_to_string($task)),$edit_link);
+      $display2= $this->parent->get_additional_entry_informations($task);
+
+      /* Create each field */
+      $field0 = array("string" => "<input type='checkbox' id='item_selected_".$id."' name='item_selected_".$id."'>" ,
+                      "attach" => "style='width:20px;".$color."'");
+      $field0a= array("string" => $queue_pos ,"attach" => "style='width:20px;".$color."'");
+      $field1 = array("string" => $display,
+                      "attach" => "style='".$color."'");
+      $field1a= array("string" => $display2,
+                      "attach" => "style='".$color.";width:80px;'");
+      $field2 = array("string" => $this->parent->time_to_string($task),"attach" => "style='".$color.";width:100px;'");
+      $field3 = array("string" => $this->parent->action_to_string($task),"attach" => "style='".$color.";width:80px;'");
+      $field4 = array("string" => $prio_actions.$action,"attach" => "style='".$color.";text-align:right;width:120px;border-right:0px;'");
+      $this->AddElement(array($field0,$field0a,$field1,$field1a,$field2,$field3,$field4));
+    }
+  }
+
+
+  function Save()
+  {
+    MultiSelectWindow :: Save();  
+  }
+
+
+  function save_object()
+  {
+    /* Save automatic created POSTs like regex, checkboxes */
+    MultiSelectWindow :: save_object();  
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/addons/gotomasses/class_goto_task.inc b/gosa-core/plugins/addons/gotomasses/class_goto_task.inc
new file mode 100644 (file)
index 0000000..d53a4c2
--- /dev/null
@@ -0,0 +1,485 @@
+<?php
+
+class goto_task extends plugin
+{
+  /* Definitions */
+  var $plHeadline     = "System mass deployment";
+  var $plDescription  = "This does something";
+  var $parent   = NULL;
+  var $Minute   = "*";
+  var $Hour     = "*";
+  var $Day      = "*";
+  var $Month    = "*";
+  var $Weekday  = "*";
+  var $Action   = "install";
+
+  var $Zone     = "";
+  var $Section  = "";
+
+  var $Zones    = array();
+  var $Sections = array();
+
+  var $Comment  = "";
+  var $OGroup   = "keep_current";
+  var $OGroups  = array();
+  var $Target   = array();
+  var $Initial_Target   = array();
+  var $Actions  = array();
+  var $new      = FALSE;
+  var $ID = 0;
+  var $TASK_ID =0;
+  var $attributes     = array("ID","TASK_ID","Zone","Section","OGroup","Minute","Hour","Day",
+                              "Month","Weekday","Action","Comment","Target","Initial_Target");
+
+  var $configure_dhcp = FALSE;
+  var $configure_dns  = FALSE;
+
+
+  function goto_task(&$config, &$parent, $data = array())
+  {
+    /* Set parent object */
+    $this->parent = &$parent;
+
+    /* Intialize plugin */
+    $this->config = &$config;
+    if(count($data)){
+      $tmp = $this->get_array_values();
+      foreach($this->attributes as $attr){
+        if(!isset($data[$attr])){
+          trigger_error("Missing parameter: '".$attr."' for goto_task contruction.");
+        }else{
+          $this->$attr = $data[$attr];
+        }
+      }
+    }else{
+      $this->new = TRUE;
+    }
+
+    if(!empty($this->Zone) && !preg_match("/^\"\"$/",$this->Zone)){
+      $this->configure_dns = TRUE;
+    }
+    if(!empty($this->Section) && !preg_match("/^\"\"$/",$this->Section)){
+      $this->configure_dhcp = TRUE;
+    }
+
+    /* Set dns and dhcp attributes */
+    foreach(getAvailableZones($this->config) as $zone){
+      $name = preg_replace("#^[^/]+/#","",$zone);
+      $this->Zones[$name] = $zone; 
+    }
+    $this->Sections = $this->get_dhcp_sections();
+
+    /* Create ogroup select list */
+    $this->OGroups = array("\"\""     => "["._("Keep current")."]");
+    $this->OGroups = array_merge($this->OGroups,$this->parent->get_object_groups());
+
+    /* Prepare list of available actions */
+    $this->Actions = $this->parent->get_actions();
+  }
+
+
+  function execute()
+  {
+    /********
+     * Handle Posts  
+     ********/
+  
+    /* Handle Target options */
+    foreach($_POST as $name => $value){
+      if(preg_match("/^remove_/",$name)){
+        $value = preg_replace("/^remove_([0-9]*)_(x|y)$/i","\\1",$name);
+        if(isset($this->Target[$value]) && $this->Action != "initial_install"){
+          unset($this->Target[$value]);
+        }elseif(isset($this->Initial_Target[$value]) && $this->Action == "initial_install"){
+          unset($this->Initial_Target[$value]);
+        }
+      }
+    }
+
+    if($this->Action != "initial_install"){
+      
+      /* Add target */
+      if($this->ID == 0 && isset($_POST['add_target']) && !empty($_POST['target_text'])){
+        $target = get_post("target_text");
+        if($this->is_valid_target($target) && !in_array($target,$this->Target)){
+          $this->Target[] = $target;
+        }else{
+          print_red(_("You must specify a valid MAC address or host name."));
+        }
+      }
+    }else{
+
+      /* Add target */
+      if($this->ID ==0 && isset($_POST['add_target']) && !empty($_POST['task_MAC'])){
+        $MAC = $_POST['task_MAC'];
+        $NAME= "";
+        $IP  = "";
+        $DNS   = "";
+        $DHCP  = "";
+        if(isset($_POST['task_Name'])){
+          $NAME = $_POST['task_Name'];
+        }
+        if(isset($_POST['task_IP']) && is_ip($_POST['task_IP'])){
+          $IP = $_POST['task_IP'];
+        }
+        if(isset($_POST['configure_dns']) && isset($_POST['Zone']) && isset($this->Zones[$_POST['Zone']])){
+          $DNS = $_POST['Zone'];
+        }
+        if(isset($_POST['configure_dhcp']) && isset($_POST['Section']) && isset($this->Sections[$_POST['Section']])){
+          $DHCP = $_POST['Section'];
+        }
+        if(is_mac($MAC)){
+          $this->Initial_Target[] = array("MAC"=>$MAC,"IP"=>$IP,"NAME"=>$NAME);
+        }
+      }
+    }
+
+    /* Add via csv */
+    if($this->ID == 0 && isset($_FILES['import_file'])){
+      $file = $_FILES['import_file']['tmp_name'];
+      if(file_exists($file) && is_readable($file)){
+        $str ="";
+        $fp = fopen($file,"r");
+        while(!feof($fp)){
+          $line = fgets($fp,512);
+          $tmp = preg_split("/(,|;)/",$line);
+
+          $MAC = $IP = $NAME; 
+          if(isset($tmp[0])){
+            $MAC = trim($tmp[0]);
+          }
+          if(isset($tmp[1])){
+            $IP = trim($tmp[1]);
+          }
+          if(isset($tmp[2])){
+            $NAME = trim($tmp[2]);
+          }
+          if(is_mac($MAC)){
+            $this->Initial_Target[] = array("MAC"=>$MAC,"IP"=>$IP,"NAME"=>$NAME);
+          }
+        }
+      }
+    }
+  
+    /********
+     * Add target from list 
+     ********/
+
+    /* If add from list is was requsted, display this list */ 
+    if(isset($_POST['add_from_list'])){
+      $this->dialog = new target_list($this->config,$this->Target);
+    }
+
+    /* Save selected objects as target */
+    if(isset($_POST['SaveMultiSelectWindow']) && is_object($this->dialog)){
+      $this->dialog->save_object();
+      $ret = $this->dialog->save();
+      foreach($ret as $entry){
+        $this->Target[] = $entry['cn'][0];
+      }
+      $this->dialog = FALSE;
+    }
+
+    /* Cancel object listing */
+    if(isset($_POST['CloseMultiSelectWindow'])){
+      $this->dialog = FALSE;
+    }
+
+    /* Display object Listing */
+    if(is_object($this->dialog)){
+      $this->dialog->save_object();
+      return($this->dialog->execute());
+    }
+
+    /********
+     * Display this plugin  
+     ********/
+
+    $divlist = new divlist("goto_task");
+#    $divlist->SetPluginMode(); 
+    $divlist->setHeight(200);
+    $divlist->SetWidth("100%");
+    $divlist->SetEntriesPerPage(0);
+
+    $acl_target = $this->parent->getacl("Target");
+    if(preg_match("/w/i",$acl_target)){
+      $field_del = array("string" => "<input type='image' src='images/edittrash.png' name='remove_%KEY%'>" , 
+          "attach" => "style='width:44px;border-right:0px;'");
+    }else{
+      $field_del = array("string" => "",
+          "attach" => "style='width:44px;border-right:0px;'");
+    }
+
+    /* Add entries to divlist */
+    if($this->Action == "initial_install"){
+      $divlist->SetHeader(array(
+                            array("string" => _("Target systems") ,"attach" => "style='width:120px;'"),
+                            array("string" => _("IP")      , "attach" => "style='width:90px;'"),
+                            array("string" => _("Name")    , "attach" => "style='width:150px;'"),
+                            array("string" => _("Actions") , "attach" => "style='width:44px;border-right:0px;text-align:right;'")));
+      foreach($this->Initial_Target as $key => $target){
+        $field1 = array("string" => $target['MAC']  ,"attach" => "style='width:120px;'");
+        $field2 = array("string" => $target['IP']   ,"attach" => "style='width:90px;'");
+        $field3 = array("string" =>  $target['NAME'] ,"attach" => "style='width:150px;'");
+        $divlist->AddEntry(array($field1,$field2,$field3,preg_replace("/%KEY%/",$key,$field_del)));
+      } 
+    }else{
+      $divlist->SetHeader(array(
+                            array("string" => "Target", "attach" => "style=''"),
+                            array("string" => "Actions" , "attach" => "style='width:44px;border-right:0px;text-align:right;'")));
+      foreach($this->Target as $key => $target){
+        $field1 = array("string" => $target);
+        $divlist->AddEntry(array($field1,preg_replace("/%KEY%/",$key,$field_del)));
+      } 
+    }
+
+    $smarty = get_smarty();
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr."ACL", $this->parent->getacl($attr));
+      $smarty->assign($attr,$this->$attr);
+    }
+
+    $smarty->assign("Zones", $this->Zones);
+    $smarty->assign("Sections", $this->Sections);
+
+    $smarty->assign("ID",$this->ID);
+  
+    $smarty->assign("Zone", $this->Zone);
+    $smarty->assign("Section", $this->Section);
+
+    $smarty->assign("configure_dhcp", $this->configure_dhcp);
+    $smarty->assign("configure_dns", $this->configure_dns);
+
+    $tmp = $this->get_array_values();
+    $smarty->assign("JS"      , $_SESSION['js']);
+    $smarty->assign("Minutes" , $tmp['Minute']);
+    $smarty->assign("Hours"   , $tmp['Hour']);
+    $smarty->assign("Days"    , $tmp['Day']);
+    $smarty->assign("Months"  , $tmp['Month']);
+    $smarty->assign("Weekdays", $tmp['Weekday']);
+    $smarty->assign("OGroups" , $this->OGroups);
+    $smarty->assign("Actions"     , $this->Actions);
+    $smarty->assign("Target_list" , $divlist->DrawList());
+    $smarty->assign("new"      , $this->new);
+    return ($smarty->fetch (get_template_path('goto_task.tpl', TRUE)));
+  }
+
+
+  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 get_dhcp_sections()
+  {
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(objectClass=dhcpService)",array("dhcpPrimaryDN"));
+
+    $tmp   = array();
+    $tmp2  = array();
+
+    $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();
+      $dhcp_dns[$key] = $tmp['cn'][0];
+    }
+
+    foreach($dhcp_dns as $dn => $cn){
+      $ldap->cd($dn);
+      $ldap->search("(|(objectClass=dhcpService)(objectClass=dhcpGroup)".
+                    "(objectClass=dhcpSubnet)(objectClass=dhcpSharedNetwork))",array("cn"));
+      $tmp = array();
+      while($attr = $ldap->fetch()){
+        $tmp[$attr['dn']] = $attr['cn'][0];
+      }
+      $tmp2 = $this->create_tree($tmp,preg_replace("/^[^,]+,/i","",$dn),"(".$cn.")&nbsp;");
+    }
+    $ret = array();
+    foreach($tmp2 as $key => $label){
+      $ret[$tmp[$key]] = $label;
+    }
+    return($ret);
+  }
+
+  
+  /* check given values */
+  function check()
+  {
+    $message = plugin::check();
+    $tmp = array(
+      "OGroup" => _("Object group") ,"Minute" => _("Minute"),
+      "Hour"   => _("Hour")         ,"Day"    => _("Day"),
+      "Month"  => _("Month")        ,"Weekday"=> _("Week day"),
+      "Action" => _("Action")       ,"Comment"=> _("Description"));
+    
+    foreach($tmp as $name => $desc){
+      if(empty($this->$name) && $this->$name != 0){
+        $message[] = sprintf(_("The given value for attribute '%s' is invalid."),$desc);
+      }
+    }
+    if(count($this->Target) == 0 && $this->Action != "initial_install"){
+      $message[] = sprintf(_("You must specify at least one target"));
+    }
+    if(count($this->Initial_Target) == 0 && $this->Action == "initial_install"){
+      $message[] = sprintf(_("You must specify at least one target"));
+    }
+    return($message);
+  }
+  
+
+  /* Map acl function, to be able to use plugin::save_object() */
+  function acl_is_writeable($attribute,$skip_write = FALSE)
+  {
+    return($this->parent->acl_is_writeable($attribute,$skip_write));
+  }
+
+
+  function save_object()
+  {
+    if(isset($_POST['goto_task_posted'])){
+
+      if($this->Action == "initial_install"){
+        if(isset($_POST['configure_dns'])){
+          $this->configure_dns = TRUE;
+          if(isset($_POST['Zone'])){
+            $this->Zone = get_post("Zone");
+          }
+        }else{
+          $this->Zone = "\"\"";
+          $this->configure_dns = FALSE;
+        }
+
+        if(isset($_POST['configure_dhcp'])){
+          $this->configure_dhcp = TRUE;
+          if(isset($_POST['Section'])){
+            $this->Section = get_post("Section");
+          }
+        }else{
+          $this->configure_dhcp = FALSE;
+          $this->Section = "\"\"";
+        }
+      }
+      plugin::save_object();
+    }
+  }  
+
+
+  /* Check if given target is vald.
+   * It must either be a valid MAC address or an existing object group
+   */
+  function is_valid_target($str)
+  {
+    if(is_mac($str)){
+      return(TRUE);
+    }else{
+      $ldap = $this->config->get_ldap_link();
+      $ldap->cd($this->config->current['BASE']);
+      $ldap->search("(&(objectClassgosaGroupOfNames)(cn=".$str."))",array("cn"));
+      if($ldap->count()){
+        return(TRUE);
+      }
+    }
+  }
+
+  function save()
+  {
+    $tmp = array();
+    foreach($this->attributes as $attr){
+      $tmp[$attr] = $this->$attr;
+    }
+
+    if($this->Action != "initial_install" || !$this->configure_dns){
+      $tmp['Zone'] = "\"\"";
+    }
+    if($this->Action != "initial_install" || !$this->configure_dhcp){
+      $tmp['Section'] = "\"\"";
+    }
+    return($tmp);
+  }
+
+
+  /* Return values for listboxes. 
+   */
+  function get_array_values()
+  {
+    $ret = array();    
+
+    /* Create minute array */
+    $Minute = array( "*"    => "*",
+                      "*/1"  => "*/1",
+                      "*/3"  => "*/3",
+                      "*/5"  => "*/5",
+                      "*/10" => "*/10",
+                      "*/15" => "*/15",
+                      "*/30" => "*/30",
+                      "*/45" => "*/45",
+                      "*/60" => "*/60"); 
+    for($i = 0; $i < 60 ; $i ++){
+      $Minute[$i] = $i;
+    }
+
+    /* Create hour array */
+    $Hour = array(   "*" => "*");
+    for($i = 1 ; $i < 24 ; $i ++ ){
+      $Hour["*/".$i] = "*/".$i;
+    } 
+    for($i = 0 ; $i < 24 ; $i ++ ){
+      $Hour[$i] = $i;
+    } 
+
+    /* Create hour array */
+    $Day = array( "*" => "*");
+    for($i = 1 ; $i < 32 ; $i ++ ){
+      $Day["*/".$i] = "*/".$i;
+    } 
+    for($i = 1 ; $i < 32 ; $i ++ ){
+      $Day[$i] = $i;
+    } 
+   
+    /* Create month array */
+    $Month = array( "*" => "*");
+    for($i = 1 ; $i <= 12 ; $i ++ ){
+      $Month["*/".$i] = "*/".$i;
+    } 
+    for($i = 1 ; $i <= 12 ; $i ++ ){
+      $Month[$i] = $i;
+    } 
+   
+    /* Create week day array */
+    $Weekday = array( "*" => "*");
+    for($i = 1 ; $i <= 7 ; $i ++ ){
+      $Weekday["*/".$i] = "*/".$i;
+    } 
+    for($i = 0 ; $i <= 7 ; $i ++ ){
+      $Weekday[$i] = $i;
+    } 
+   
+    foreach(array("Minute","Weekday","Hour","Day","Month") as $var){
+      $ret[$var] = $$var;
+    }
+    return($ret);
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/addons/gotomasses/class_gotomasses.inc b/gosa-core/plugins/addons/gotomasses/class_gotomasses.inc
new file mode 100644 (file)
index 0000000..adf2218
--- /dev/null
@@ -0,0 +1,431 @@
+<?php
+
+class gotomasses extends plugin
+{
+  /* Definitions */
+  var $plHeadline     = "System deployment";
+  var $plDescription  = "This does something";
+
+  /* attribute list for save action */
+  var $attributes= array();
+  var $objectclasses= array();
+
+  /* Queue tasks */
+  var $current =false;
+  var $dialog = FALSE;
+  var $ids_to_remove = array();
+  var $divlist = NULL;
+
+  var $sort_by = "QueuePosition";
+  var $sort_dir= "up";
+
+  function gotomasses(&$config, $dn= NULL)
+  {
+    /* Include config object */
+    $this->config= &$config;
+    $this->divlist = new divListMasses($this->config,$this);
+    $this->o_queue = new hostActionQueue(&$config);
+  }
+
+
+  function execute()
+  {
+    $smarty = get_smarty();
+    /************
+     * Handle posts 
+     ************/
+
+    $s_entry = $s_action = "";
+    $arr = array( 
+                  "/^prio_top_/"      => "prio_top",
+                  "/^prio_increase_/" => "prio_increase",
+                  "/^prio_decrease_/" => "prio_decrease",
+                  "/^prio_bottom_/"   => "prio_bottom",
+
+                  "/^multiple_prio_top_/"      => "mprio_top",
+                  "/^multiple_prio_increase_/" => "mprio_increase",
+                  "/^multiple_prio_decrease_/" => "mprio_decrease",
+                  "/^multiple_prio_bottom_/"   => "mprio_bottom",
+
+                  "/^edit_task_/"=>"edit","/^remove_task_/"=>"remove",
+                  "/^new_task_/"=>"new_task","/^remove_multiple_task_/" => "remove_multiple");
+    foreach($arr as $regex => $action){
+      foreach($_POST as $name => $value){
+        if(preg_match($regex,$name)){
+          $s_action = $action;
+          $s_entry  = preg_replace($regex,"",$name);
+          $s_entry  = preg_replace("/_(x|y)$/","",$s_entry);
+        }
+      }
+    }
+
+    /* Edit posted from list link */
+    if(isset($_GET['act']) && $_GET['act'] == "edit" && isset($_GET['id']) && isset($this->tasks[$_GET['id']])){
+      $s_action = "edit";
+      $s_entry = $_GET['id'];
+    }
+
+    /************
+     * REMOVE 
+     ************/
+    
+    if(preg_match("/^mprio_/",$s_action) || preg_match("/^prio_/",$s_action)){
+
+      switch($s_action){
+        case 'mprio_top'       : foreach($this->list_get_selected_items() as $id ){
+                                   $this->o_queue->max_entry_priority($id);
+                                 }
+                                 break;
+        case 'mprio_increase'  : foreach($this->list_get_selected_items() as $id ){
+                                   $this->o_queue->increase_entry_priority($id);
+                                 }
+                                 break;
+        case 'mprio_decrease'  : foreach($this->list_get_selected_items() as $id ){
+                                   $this->o_queue->decrease_entry_priority($id);
+                                 }
+                                 break;
+        case 'mprio_bottom'    : foreach($this->list_get_selected_items() as $id ){
+                                   $this->o_queue->min_entry_priority($id);
+                                 }
+                                 break;
+        case 'prio_top'       : $this->o_queue->max_entry_priority($s_entry);break;
+        case 'prio_increase'  : $this->o_queue->increase_entry_priority($s_entry);break;
+        case 'prio_decrease'  : $this->o_queue->decrease_entry_priority($s_entry);break;
+        case 'prio_bottom'    : $this->o_queue->min_entry_priority($s_entry);break;
+        default : trigger_error("Undefined priority setting used.");
+      }
+      if($this->o_queue->is_error()){
+        print_red($this->o_queue->get_error());
+      }
+    }
+
+    /************
+     * REMOVE 
+     ************/
+
+    /* Remove multiple */
+    if($s_action == "remove_multiple" || $s_action == "remove"){
+
+      if(!$this->acl_is_removeable()){
+        print_red(_("You are not allowed to remove a task."));
+      }else{
+
+        if($s_action == "remove"){
+          $ids = array($s_entry);
+        }else{
+          $ids = $this->list_get_selected_items();
+        }
+  
+
+        $this->ids_to_remove = $ids;
+        $tmp = "";
+        foreach($this->ids_to_remove as $key => $id){
+          if($this->o_queue->id_exists($id)){
+            $task = $this->o_queue->get_entry($id);
+            $tmp.= "\n".$this->target_to_string($task);
+          }else{
+            unset($this->ids_to_remove[$key]);
+          }
+        }
+        $smarty->assign("multiple", TRUE); 
+        $smarty->assign("info",sprintf(_("Your are about to delete the following tasks: %s"),"<pre>".$tmp."</pre>"));
+        $this->current = $s_entry;
+        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+      }
+    }
+
+    /* Remove specified tasks */
+    if(count($this->ids_to_remove) && isset($_POST['delete_multiple_confirm'])){
+      foreach($this->ids_to_remove as $id){
+        if($this->o_queue->id_exists($id)){
+          $this->o_queue->remove_entry($id);
+        }
+      }
+      $this->save();
+    }
+
+    /* Remove aborted */
+    if(isset($_POST['delete_cancel'])){
+      $this->ids_to_remove = array();;
+    }
+
+
+    /************
+     * EDIT 
+     ************/
+
+    /* Edit selected entry */
+    if($s_action == "edit"){
+      $entry = $this->o_queue->get_entry($s_entry);
+      if($entry){
+        $this->dialog = new goto_task($this->config,$this,$entry);
+        $this->current = $s_entry;
+      }
+    }
+
+    /* New entry */
+    if($s_action== "new_task" && $this->acl_is_createable()){
+      $this->dialog = new goto_task($this->config,$this);
+      $this->current = -1;
+    }
+  
+    /* Close dialog */
+    if(isset($_POST['close_goto_task'])){
+      $this->dialog = FALSE;
+      $this->current = -1;
+    }
+
+    /* Close dialog */
+    if((isset($_POST['save_goto_task']) || isset($_POST['apply_goto_task'])) && is_object($this->dialog) ){
+      $this->dialog->save_object();
+      $msgs = $this->dialog->check();
+      if(count($msgs)){
+        foreach($msgs as $msg){
+          print_red($msg);  
+        }
+      }else{  
+        
+        if($this->o_queue->id_exists($this->current)){
+          $this->o_queue->update_entry($this->current,$this->dialog->save());
+        }else{
+          $tmp = $this->dialog->save();
+          $tmp2= array();
+          $targets =$tmp['Target'];
+          foreach($targets as $target){
+            $tmp['Target'] = array($target);
+            $tmp2[] = $tmp;
+          }
+          if(!$this->o_queue->add_multiple($tmp2)){
+            print_red($this->o_queue->get_error());
+          }
+        }
+        if(!isset($_POST['apply_goto_task'])){
+          $this->dialog = FALSE;
+          $this->current = -1;
+        }
+        $this->save();
+      }
+    }
+
+    /* Display dialogs if currently opened */
+    if(is_object($this->dialog)){
+      $this->dialog->save_object();
+      return($this->dialog->execute());
+    }
+
+    /************
+     * Handle Divlist 
+     ************/
+
+    $this->divlist->execute();
+    $this->divlist->SetEntries($this->get_queue_entries()); 
+    $str = 
+      "<script type=\"text/javascript\">
+      <!--
+        var time = null
+        function move() {
+          window.location = '?plug=".$_GET['plug']."'
+        }
+        setInterval(\"move()\",20000);
+        //-->
+        </script>";
+    return($str.$this->divlist->Draw());
+  }
+
+    
+  function get_queue_entries()
+  {
+    if(!$this->o_queue->load()){
+      print_red("ERROR:".$this->o_queue->get_error());
+      return(array());
+    }
+
+    $queue_pos = 1;
+    $tasks = array();
+    $ret = array();
+    while($entry = $this->o_queue->fetch()){
+      $task = $entry['TASK_ID']; 
+      if(!isset($tasks[$task])){
+        $tasks[$task] = dechex(rand(100,240)).dechex(rand(100,240)).dechex(rand(100,240));
+      }
+      $entry['Queue_Position'] = $queue_pos;
+      $entry['color'] = $tasks[$task]; 
+      $ret[]= $entry;
+      $queue_pos ++;
+    }
+  
+    /* Sort entries */
+    $simple_map = array("QueuePosition" => "Queue_Position",
+                        "Action"        => "Action",
+                        "TaskID"        => "TASK_ID");
+    $sort_arr = array();
+    if(isset($simple_map[$this->sort_by])){
+      foreach($ret as $id => $entry){
+        $sort_arr[$entry[$simple_map[$this->sort_by]]][] = $id;
+      }
+    }
+    if($this->sort_by == "TargetName"){
+      foreach($ret as $id => $entry){
+        $name = $this->target_to_string($entry);
+        $sort_arr[$name][] = $id;
+      }
+    }
+    if($this->sort_by == "Schedule"){
+      foreach($ret as $id => $entry){
+        $name = $entry['Minute'].$entry['Hour'].$entry['Day'].$entry['Month'].$entry['Weekday'];
+        $sort_arr[$name][] = $id;
+      }
+    }
+    if($this->sort_dir == "up"){
+      ksort($sort_arr);
+    }else{
+      krsort($sort_arr);
+    }
+    $ret2 = array();
+    foreach($sort_arr as $key => $entries){
+      foreach($entries as $entry_id){
+        $ret2[] = $ret[$entry_id];
+      }
+    }
+    return($ret2);
+  }
+
+
+  function get_additional_entry_informations($data)
+  {
+    $i = rand(0,3);
+    if($i == 0){
+      return("<div style='width:80px;background-color:#999999;'><div style='background-color:#00FF00;width:40%'>&nbsp;</div></div>");
+    }
+    if($i == 1){
+      return("<font style='color: #FF0000;'>Failed</font>");
+    }
+    if($i == 1){
+      return("<font style='color: #00FF00;'>OK</font>");
+    }
+    return("-");
+  }
+
+
+  function target_to_string($data)
+  {
+    $ret = "";
+    if($data['Action'] == "initial_install"){
+      foreach($data['Initial_Target'] as $target){
+        $ret .= $target['MAC'].", ";
+      } 
+    }else{
+      foreach($data['Target'] as $target){
+        $ret .= $target.", ";
+      } 
+    }
+    return(preg_replace("/, $/","",$ret));
+  }
+
+  
+  function time_to_string($data)
+  {
+    return($data['Minute']." ".$data['Hour']." ".$data['Day']." ".$data['Month']." ".$data['Weekday']);
+  }
+
+  
+  function action_to_string($data)
+  {
+    $tmp = $this->get_actions();
+    if(isset($tmp[$data['Action']])){
+      return($tmp[$data['Action']]);
+    }else{
+      return(_("Unknown"));
+    }
+  }
+
+  
+  function save_object()
+  {
+    $this->divlist->save_object();
+    $sort_vals = array("Action","QueuePosition","TargetName","Schedule","TaskID");
+    if(isset($_GET['sort']) && in_array($_GET['sort'],$sort_vals)){
+      $sort = $_GET['sort'];
+      if($this->sort_by == $sort){
+        if($this->sort_dir == "up"){
+           $this->sort_dir = "down";
+        }else{
+           $this->sort_dir = "up";
+        }
+      }
+      $this->sort_by = $sort;
+    }
+  }
+
+
+  /* Return list of object groups */
+  function get_object_groups()
+  {
+    $ret = array();
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(&(objectClass=gosaGroupOfNames)(cn=*))",array("cn"));
+    while($attrs = $ldap->fetch()){
+      $ret[$attrs['cn'][0]] = $attrs['cn'][0];
+    }
+    return($ret); 
+  }
+
+  
+  function save()
+  {
+  }
+
+
+  function list_get_selected_items()
+  {
+    $ids = array();
+    foreach($_POST as $name => $value){
+      if(preg_match("/^item_selected_[0-9]*$/",$name)){
+        $id   = preg_replace("/^item_selected_/","",$name);
+        $ids[$id] = $id;
+      }
+    }
+    return($ids);
+  }
+
+
+  function get_actions()
+  {
+    /* Prepare list of available actions */
+    $actions = array(       "reboot"          => _("Reboot"),
+                            "localboot"       => _("Localboot"),
+                            "halt"            => _("Halt system"),
+                            "initial_install" => _("Initial installation"),
+                            "update"          => _("Update"),
+                            "reinstall"       => _("(Re)Install"),
+                            "rescan"          => _("Rescan"),
+                            "wake"            => _("Wake"),
+                            "memcheck"        => _("Memory check"));
+    return($actions);
+  }
+
+
+  static function plInfo()
+  {
+    return (array(
+        "plShortName"   => _("System mass deployment"),
+        "plDescription" => _("Provide a mechanism to automatically activate a set of systems"),
+        "plSelfModify"  => FALSE,
+        "plDepends"     => array(),
+        "plPriority"    => 0,
+        "plSection"     => array("addon"),
+        "plCategory"    => array("gotomasses" => array("objectClass" => "none", "description" => _("System mass deployment"))),
+        "plProvidedAcls" => array("Comment"   => _("Description"), 
+                                  "Action"    => _("Action"),
+                                  "Day"       => _("Day"),
+                                  "Minute"    => _("Minute"),
+                                  "Hour"      => _("Hour"),
+                                  "Month"     => _("Month"),
+                                  "Weekday"   => _("Week day"),
+                                  "Target"    => _("Target"))
+        ));
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/addons/gotomasses/class_target_list.inc b/gosa-core/plugins/addons/gotomasses/class_target_list.inc
new file mode 100644 (file)
index 0000000..6ecd300
--- /dev/null
@@ -0,0 +1,303 @@
+<?php
+
+class target_list extends MultiSelectWindow
+{
+  var $config;
+  var $list         =array();
+  var $Targets_used =array();
+
+  /* Current base */
+  var $selectedBase       = "";
+  var $departments        = array();
+
+  /* Regex */
+  var $Regex              = "*";
+  var $IP_start           = "0.0.0.0";
+  var $IP_end             = "255.255.255.255";
+
+  /* CheckBoxes, to change default values modify $this->AddCheckBox */
+  var $ogroups        ;
+  var $servers        ;
+  var $workstations   ;
+
+
+  /* Subsearch checkbox */
+  var $SubSearch          ;
+  var $IPMatch            ;
+  var $parent             ;
+  var $ui                 ;
+  function target_list(&$config,$Targets_used)
+  {
+    MultiSelectWindow::MultiSelectWindow($config, "Targetselection", array("ogroup","gotomasses"));
+
+    $this->Targets_used = $Targets_used;
+    
+    $this->SetInformation(  _("Select the target objects for your scheduled action."));
+    $this->SetTitle(        _("Available targets"));
+    $this->SetSummary(      _("Available targets"));
+    $this->SetHeadpageMode(FALSE);
+    
+    /* set Page header */
+    $chk = "<input type='checkbox' id='select_all' name='select_all'
+               onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
+    $this->AddHeader(array("string"=> $chk,          "attach"=>"style='width:20px;'"));
+
+    $this->AddHeader(array("string" => "&nbsp;", "attach" => "style='text-align:center;width:20px;'"));
+    $this->AddHeader(array("string" => _("Object name"), "attach" => "style=''"));
+
+    /* Text ,Value, Name, Is selected */
+    $this->AddCheckBox("ogroups",       _("Select to see object groups"),  _("Show object groups"), true);
+    $this->AddCheckBox("servers",       _("Select to see servers")  ,   _("Show servers"), true);
+    $this->AddCheckBox("workstations",  _("Select to see workstations"),_("Show workstations"), true);
+
+    /* Add SubSearch checkbox */
+    $this->AddCheckBox(SEPERATOR);
+    $this->AddCheckBox("SubSearch",  _("Select to search within subtrees"), _("Search in subtrees"), false);
+    $this->AddCheckBox("IPMatch",    _("Select to search for a specific IP range only"), _("Match IP range"), false);
+
+    /* Name,Text,Default  , Connect with alphabet  */
+    $this->AddRegex   ("Regex",     _("Regular expression for matching group names"), "*" , true);
+    $this->AddRegex   ("IP_start",  _("IP range start"),  "0.0.0.0" , true);
+    $this->AddRegex   ("IP_end",    _("IP range end"),    "255.255.255.255" , true);
+    $this->EnableAplhabet(TRUE);
+  }
+
+
+  function GenHeader()
+  {
+    $options= "";
+
+    /* Get all departments within this subtree */
+    $ui= get_userinfo();
+    $first = "";
+    $found = FALSE;
+    $base = $this->config->current['BASE'];
+
+    /* Add base */
+    $tmp = array();
+    $tmp[] = array("dn"=>$this->config->current['BASE']);
+    $tmp=  array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
+                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
+
+    $deps = array();
+    foreach($tmp as $tm){
+      $deps[$tm['dn']] = $tm['dn'];
+    }
+
+    /* Load possible departments */
+    $ui= get_userinfo();
+    $tdeps= $ui->get_module_departments("ogroups");
+    $ids = $this->config->idepartments;
+    $first = "";
+    $found = FALSE;
+    foreach($ids as $dep => $name){
+      if(isset($deps[$dep]) && in_array_ics($dep, $tdeps)){
+
+        /* Keep first base dn in mind, we could need this
+         *  info if no valid base was found
+         */
+        if(empty($first)) {
+          $first = $dep['dn'];
+        }
+
+        $value = $ids[$dep];
+        if ($this->selectedBase == $dep){
+          $found = TRUE;
+          $options.= "<option selected='selected' value='".$dep."'>$value</option>";
+        } else {
+          $options.= "<option value='".$dep."'>$value</option>";
+        }
+      }
+    }
+
+    /* The currently used base is not visible with your acl setup.
+     * Set base to first useable base.
+     */
+    if(!$found){
+      $this->selectedBase = $first;
+    }
+
+    /* Get copy & paste icon */
+    $acls  = $ui->get_permissions($this->selectedBase,"ogroups/ogroup");
+    $acl_all= $ui->has_complete_category_acls($this->selectedBase,"ogroups");
+
+    /* Add default header */
+    $listhead = MultiSelectWindow::get_default_header();
+
+    /* Add department selector */
+    $listhead .= _("Base")."&nbsp;<select name='CurrentMainBase' 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;";
+    $listhead .="</div>";
+
+    $this->SetListHeader($listhead);
+  }
+
+
+  function execute()
+  {
+    $this->ClearElementsList();
+    $this->GenHeader();
+    $this->reload();
+    $this->SetEntries($this->list);
+    return($this->Draw());
+  }
+
+  
+  function SetEntries($list)
+  {
+      /* Add Copy & Paste buttons if copy&paste is enabled
+     */
+    // Defining Links
+    $linkopen = "<a href='?plug=".$_GET['plug']."&amp;act=dep_open&amp;dep_id=%s'>%s</a>";
+    $editlink = "<a href='?plug=".$_GET['plug']."&amp;id=%s&amp;act=edit_entry'>%s</a>";
+
+    $ui = get_userinfo();
+
+    // Assigning ogroups
+    foreach($list as $key => $val){
+
+      if(in_array($val['cn'][0],$this->Targets_used) || 
+         isset($val['macAddress'][0]) && in_array($val['macAddress'][0],$this->Targets_used)) continue;
+
+      $title = "title='".preg_replace('/ /', '&nbsp;', @LDAP::fix($val['dn']))."'";
+      if(!isset($val['description'][0])){
+        $desc = "";
+      }else{
+        $desc = " - [ ".$val['description'][0]." ]";
+      }
+      if(!isset($val['ipHostNumber'][0])){
+        $desc.= "";
+      }else{
+        $desc.= " - ".$val['ipHostNumber'][0]."";
+      }
+
+
+      $img ="Hmm";
+      if(in_array("goServer",$val['objectClass'])){
+        $img = "<img src='images/select_server.png' alt='"._("Server")."' ".$title.">";
+      }elseif(in_array("gotoWorkstation",$val['objectClass'])){
+        $img = "<img src='images/select_workstation.png' alt='"._("Workstation")."' ".$title.">";
+      }elseif(in_array("gosaGroupOfNames",$val['objectClass'])){
+        $img = "<img src='images/list_ogroup.png' alt='"._("Object group")."' ".$title.">";
+      }
+
+      /* Create each field */
+      $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
+                      "attach" => "style='width:20px;'");
+      $field1 = array("string" => $img, 
+                      "attach" => "style='text-   align:center;width: 20px;'");
+      $field2 = array("string" => $val['cn'][0].$desc, 
+                      "attach" => "style='border-right:0px;' ".$title);
+
+      $this->AddElement(array($field0,$field1,$field2));
+    }
+  }
+
+  
+  function save()
+  { 
+    $ret = array();
+    $items = $this->list_get_selected_items();
+    foreach($items as $item){
+      $ret[] = $this->list[$item];
+    }
+    return($ret);
+  }
+
+
+  function save_object()
+  {
+    MultiSelectWindow::save_object();
+  }
+
+  
+  function reload()
+  {
+    /* Set base for all searches && initialise some vars */
+    $this->list= array();
+    $base     = $this->selectedBase;
+    $filter   = "";
+    $Regex    = $this->Regex;
+    $IP_start = $this->IP_start;
+    $IP_end   = $this->IP_end;
+
+    if($this->IPMatch){
+      if(!is_ip($IP_start)){
+        print_red(_("Please specify a valid IP range."));
+        return;
+      }
+      if(!is_ip($IP_end)){
+        print_red(_("Please specify a valid IP range."));
+        return;
+      }
+    }
+  
+
+    $chk = array(
+        "ogroups"       => "(&(objectClass=gosaGroupOfNames)(|(gosaGroupObjects=*S*)(gosaGroupObjects=*W*)))" ,
+        "servers"       => "(objectClass=goServer)" ,
+        "workstations"  => "(objectClass=gotoWorkstation)");
+
+    /* Create filter */
+    foreach($chk as $chkBox => $FilterPart){
+      if($this->$chkBox){
+        $filter .=  $FilterPart;
+      }
+    }
+    $filter= "(&(cn=".$Regex.")(|".$filter."))";
+
+    if($this->SubSearch){
+      $res= get_list($filter, array("ogroups","workstations","servers"), $base, 
+            array("cn","objectClass","gosaGroupObjects","ipHostNumber","description"), GL_SIZELIMIT | GL_SUBSEARCH);
+    }else{
+      $res= get_list($filter, "ogroups", get_groups_ou().$base, 
+            array("cn","objectClass","ipHostNumber","description"), GL_SIZELIMIT );
+      $res= array_merge($res,get_list($filter, "workstation",  "ou=workstations,ou=systems,".$base, 
+            array("cn","objectClass","ipHostNumber","description"), GL_SIZELIMIT ));
+      $res= array_merge($res,get_list($filter, "server", "ou=servers,ou=systems,".$base, 
+            array("cn","objectClass","ipHostNumber","description"), GL_SIZELIMIT ));
+    }
+
+    $this->list= $res;
+    ksort ($this->list);
+    reset ($this->list);
+    $tmp=array();
+    foreach($this->list as $tkey => $val ){
+
+      if($this->IPMatch){
+        if(isset($val['ipHostNumber'][0])){
+          if(is_ip_range($IP_start,$val['ipHostNumber'][0]) && is_ip_range($val['ipHostNumber'][0],$IP_end)){
+            $tmp[strtolower($val['cn'][0]).$val['cn'][0]]=$val;
+          }
+        }
+      }else{
+        $tmp[strtolower($val['cn'][0]).$val['cn'][0]]=$val;
+      }
+    }
+    ksort($tmp);
+    $this->list=array();
+    foreach($tmp as $val){
+      $this->list[]=$val;
+    }
+    reset ($this->list);
+  }
+
+  function list_get_selected_items()
+  {
+    $ids = array();
+    foreach($_POST as $name => $value){
+      if(preg_match("/^item_selected_[0-9]*$/",$name)){
+        $id   = preg_replace("/^item_selected_/","",$name);
+        $ids[$id] = $id;
+      }
+    }
+    return($ids);
+  }
+}
+
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/addons/gotomasses/goto_task.tpl b/gosa-core/plugins/addons/gotomasses/goto_task.tpl
new file mode 100644 (file)
index 0000000..f841a4f
--- /dev/null
@@ -0,0 +1,235 @@
+<table style='width:100%'>
+       <tr>
+               <td colspan="2">
+                       <h2><img alt="" src="images/head.png" class="center" align="middle"> {t}Generic{/t}</h2>
+               </td>
+       </tr>
+       <tr>
+               <td style='width:50%;border-right: 1px solid rgb(160, 160, 160);'>
+                       <table>
+                               <tr>
+                                       <td>
+                                               {t}Description{/t}
+                                       </td>
+                                       <td>
+                                               {render acl=$CommentACL}
+                                               <input type="text" name="Comment" value="{$Comment}">
+                                               {/render}
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>
+                                               {t}Object group membership{/t}
+                                       </td>
+                                       <td>
+                                               {render acl=$OGroupACL}
+                                               <select name="OGroup">
+                                                       {html_options options=$OGroups selected=$OGroup}
+                                               </select>
+                                               {/render}
+                                       </td>
+                               </tr>
+                               {if $Action == "initial_install"}
+                               <tr>
+                                       <td><input class='center' {if $configure_dns} checked {/if} id='configure_dns'
+                                               type='checkbox' name='configure_dns' value='1' onClick="changeState('Zone');">
+                                               <label for='configure_dns'>{t}Configure DNS{/t}</label>
+                                       </td>
+                                       <td>
+                                               <select name="Zone" id="Zone" {if !$configure_dns} disabled {/if}>
+                                                       {html_options options=$Zones selected=$Zone}
+                                               </select>
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td><input class='center' {if $configure_dhcp} checked {/if} id='configure_dhcp' 
+                                                       type='checkbox' name='configure_dhcp' value='1' onClick="changeState('Section');">
+                                               <label for='configure_dhcp'>{t}Configure DHCP{/t}</label>
+                                       </td>
+                                       <td>
+                                               <select name="Section" id="Section" {if !$configure_dhcp} disabled {/if}>
+                                                       {html_options options=$Sections selected=$Section}
+                                               </select>
+                                       </td>
+                               </tr>
+                               {/if}
+                       </table>
+               </td>
+               <td style='vertical-align:top'>
+                       <table>
+                               <tr>
+                                       <td>
+                                               {t}Action{/t}
+                                       </td>
+                                       <td>
+                                               {render acl=$ActionACL}
+                                               <select name="Action" onChange="document.mainform.submit();">
+                                                       {html_options options=$Actions selected=$Action}
+                                               </select>
+                                               {/render}
+                                               {if !$JS}
+                                                       <input type='image' src='images/list_reload.png' class='center'>
+                                               {/if}
+                                       </td>
+                               </tr>
+                       </table>
+
+               </td>
+       </tr>
+</table>
+{if $Action == "initial_install"}
+{if $ID == 0}
+<p class='seperator'>&nbsp;</p>
+<table style='width:100%;'>
+       <tr>
+               <td colspan="2" style='padding-top:5px;'>
+                       <h2><img alt="" src="images/select_workstation.png" class="center" align="middle"> {t}Systems{/t}</h2>
+               </td>
+       </tr>
+       <tr>
+               <td colspan="2">
+            <table  summary="" style="border:1px solid #B0B0B0;width:100%; " cellspacing=0 cellpadding=0>
+                <tr>   
+                    <td>
+                                               {render acl=$TargetACL}
+                                               {$Target_list}  
+                                               {/render}
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+       </tr>
+       <tr>
+               <td style="width:50%; border-right: 1px solid #A0A0A0;">
+                       <table>
+                               <tr>
+                                       <td>{t}MAC address{/t}{$must}
+                                       </td>
+                                       <td><input type="text" name="task_MAC" value="">        
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>{t}Name{/t}
+                                       </td>
+                                       <td><input type="text" name="task_Name" value="">       
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>{t}IP address{/t}
+                                       </td>
+                                       <td><input type="text" name="task_IP" value=""> 
+                                               {render acl=$TargetACL}
+                                               <input type="submit" name="add_target" value="{t}Add{/t}">
+                                               {/render}
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+               <td style='vertical-align:top'>
+                       <table>
+                               <tr><td>{t}CVS import from file{/t}</td></tr>
+                               <tr>
+                                       <td>
+            &nbsp;
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>
+                                               <input type="hidden" name="MAX_FILE_SIZE" value="2000000">
+                                   <input name="import_file" type="file" size="20" maxlength="255" accept="*.csv">
+                                               {render acl=$TargetACL}
+                                               <input type="submit" name="add_import" value="{t}Import{/t}">
+                                               {/render}
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+       </tr>
+</table>
+{/if}
+{else}
+<p class='seperator'>&nbsp;</p>
+<table style='width:100%;'>
+       <tr>
+               <td colspan="2">
+                       <h2><img alt="" src="images/time.png" class="center" align="middle"> {t}Schedule{/t}</h2>
+               </td>
+       </tr>
+       <tr>
+               <td colspan="2">
+                       {t}Minute{/t}
+                       {render acl=$MinuteACL}
+                               <select name='Minute'>
+                               {html_options options=$Minutes selected=$Minute}
+                               </select>
+                       {/render}
+                       {t}Hour{/t}
+                       {render acl=$HourACL}
+                               <select name='Hour'>
+                               {html_options options=$Hours selected=$Hour}
+                               </select>
+                       {/render}
+                       {t}Day{/t}
+                       {render acl=$DayACL}
+                               <select name='Day'>
+                               {html_options options=$Days selected=$Day}
+                               </select>
+                       {/render}
+                       {t}Month{/t}
+                       {render acl=$MonthACL}
+                               <select name='Month'>
+                               {html_options options=$Months selected=$Month}
+                               </select>
+                       {/render}
+                       {t}Week day{/t}
+                       {render acl=$WeekdayACL}
+                               <select name='Weekday'>
+                               {html_options options=$Weekdays selected=$Weekday}
+                               </select>
+                       {/render}
+               </td>
+       </tr>
+</table>
+{if $ID == 0}
+<p class='seperator'>&nbsp;</p>
+<table style='width:100%;'>
+       <tr>
+               <td colspan="2" style='padding-top:5px;'>
+                       <h2><img alt="" src="images/select_workstation.png" class="center" align="middle"> {t}Target systems{/t}</h2>
+               </td>
+       </tr>
+       <tr>
+               <td colspan="2">
+            <table  summary="" style="border:1px solid #B0B0B0;width:100%; " cellspacing=0 cellpadding=0>
+                <tr>
+                    <td>
+                                               {render acl=$TargetACL}
+                                               {$Target_list}  
+                                               {/render}
+                                       </td>
+                               </tr>
+                       </table>
+                                               {render acl=$TargetACL}
+                                               <input type="text" name="target_text" value="">
+                                               {/render}
+                                               {render acl=$TargetACL}
+                                               <input type="submit" name="add_target" value="{t}Add{/t}">
+                                               {/render}
+                                               {render acl=$TargetACL}
+                                               <input type="submit" name="add_from_list" value="{t}Add from list{/t}">
+                                               {/render}
+
+               </td>
+       </tr>
+</table>
+{/if}
+{/if}
+<p class='seperator'>&nbsp;</p>
+<input type='hidden' name='goto_task_posted' value='1'>
+<p style="text-align:right">
+       <input type='submit' name='save_goto_task' value='{t}Ok{/t}'>
+{if !$new}
+       <input type='submit' name='apply_goto_task' value='{t}Apply{/t}'>
+{/if}
+       <input type='submit' name='close_goto_task' value='{t}Cancel{/t}'>
+</p>
diff --git a/gosa-core/plugins/addons/gotomasses/main.inc b/gosa-core/plugins/addons/gotomasses/main.inc
new file mode 100644 (file)
index 0000000..abe913f
--- /dev/null
@@ -0,0 +1,55 @@
+<?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
+*/
+
+if (!$remove_lock){
+
+       /* Create gotomasses object on demand */
+       if (!isset($_SESSION['gotomasses']) || (isset($_GET['reset']) && $_GET['reset'] == 1) || isset($_POST['reload_gotomass_data'])){
+               $_SESSION['gotomasses']= new gotomasses ($config);
+               $_SESSION['gotomasses']->set_acl_category("gotomasses");
+
+        /* Check root dn and user dn for acl informations */
+        $_SESSION['gotomasses']->set_acl_base($config->current['BASE']);
+        if($_SESSION['gotomasses']->getacl("") == ""){
+            $_SESSION['gotomasses']->set_acl_base($ui->dn);
+        }
+               
+               /* Check if we have acl on our own base */
+        if($_SESSION['gotomasses']->getacl("") == ""){
+            $_SESSION['gotomasses']->set_acl_base(dn2base($ui->dn));
+        }
+       
+       
+       }
+       $gotomasses= $_SESSION['gotomasses'];
+
+       /* Execute formular */
+       $display= $gotomasses->save_object();
+       if(isset($_POST['save_gotomass_changes'])){
+               $gotomasses->save();
+       }
+       $display= $gotomasses->execute ();
+
+       /* Page header*/
+       $display= print_header(get_template_path('images/system.png'), _("System deployment")).$display;
+
+       /* Store changes  in session */
+       $_SESSION['gotomasses']= $gotomasses;
+}
diff --git a/gosa-core/plugins/addons/gotomasses/remove.tpl b/gosa-core/plugins/addons/gotomasses/remove.tpl
new file mode 100644 (file)
index 0000000..023142f
--- /dev/null
@@ -0,0 +1,21 @@
+<div style="font-size:18px;">
+ <img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
+</div>
+<p>
+  {$info}
+  {t}This includes all account data, system access rules, imap settings, etc. for this user. 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}So - if you're sure - press 'Delete' to continue or 'Cancel' to abort.{/t}
+</p>
+
+<p class="plugbottom">
+{if $multiple}
+  <input type=submit name="delete_multiple_confirm" value="{t}Delete{/t}">
+{else}
+  <input type=submit name="delete_confirm" value="{t}Delete{/t}">
+{/if}
+  <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
+</p>
+
diff --git a/gosa-core/plugins/addons/ldapmanager/class_csvimport.inc b/gosa-core/plugins/addons/ldapmanager/class_csvimport.inc
new file mode 100644 (file)
index 0000000..66131ca
--- /dev/null
@@ -0,0 +1,508 @@
+<?php
+
+class csvimport extends plugin
+{
+  /* Definitions */
+  var $plHeadline= "LDIF export";
+  var $plDescription= "This does something";
+  var $access= "";
+
+  /* Array with csv informations*/
+  var $csvinfo=array();
+
+  /* attribute list for save action */
+  var $attributes= array();
+  var $objectclasses= array();
+  var $view_logged = FALSE;
+
+  function csvimport (&$config, $dn= NULL)
+  {
+    /* Include config object */
+    $this->config= &$config;
+
+    $this->ui = get_userinfo();
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* Log view */
+    if(!$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","all/".get_class($this),$this->dn);
+    }
+
+    /* initiate smarty */
+    $smarty= get_smarty();
+    $smarty->assign("selectedattrs",array(0=>""));
+    $smarty->assign("data",array(0=>""));
+    $smarty->assign("head",array(0=>""));
+    $smarty->assign("sorted",0);
+    $smarty->assign("fileup",0);
+
+    /* Get the LDAP link, to generate the Export */
+    $ldap = $this->config->get_ldap_link();
+
+    $arrtemplates = array();
+    $tempvar =0;
+
+    /* Array to fill in Formfields */
+    $arrtemplates[$tempvar] = "None";
+    if(!is_array($this->csvinfo)){
+      $this->csvinfo=array();
+    }
+
+    /* Set Usertemplate information and get all Attribute from userclass */
+    unset ($this->csvinfo['arrtemplates']);
+    unset ($this->csvinfo['arrtempls']);
+
+    /* Generate Template Array, Attribute Array */
+    if(!isset($this->csvinfo['arrtempls'])){
+
+      /* Generating attributes */
+      $attrs = @get_class_vars("user");
+      $this->csvinfo['attr']  = $attrs['attributes'];
+
+      /* Attach the choise none to discard a csv col */
+      $new = array();
+      $new[0]="none";
+      $new[1]="userPassword";
+      for($c = 0; $c < count($this->csvinfo['attr']);$c++){
+        $new[$c+2]=$this->csvinfo['attr'][$c];
+      }
+
+      $this->csvinfo['attr'] = $new;
+
+      /* Search all Templates    */
+      $this->csvinfo['templates'] = $ldap->search("(objectClass=gosaUserTemplate)",array("*"));
+
+      /* Array to handle selected Form fiels */
+      $this->csvinfo['arrtempls'][$tempvar]['name'] = "";
+      $this->csvinfo['arrtempls'][$tempvar]['dn']   = "";
+
+      $this->csvinfo['arrtemplates'][]="None";
+
+      while($temp = $ldap->fetch($this->csvinfo['templates'])){
+        $tempvar ++;
+        $this->csvinfo['arrtemplates'][$tempvar] = $temp['sn'][0]." - ".$this->config->idepartments[preg_replace("/^[^,]+,".get_people_ou()."/i", "", $temp['dn'])];
+        $this->csvinfo['arrtempls']   [$tempvar]['name'] = $temp['sn'][0]; 
+        $this->csvinfo['arrtempls']   [$tempvar]['dn']   = $temp['dn'];
+      }
+    }
+
+    $arr_temp  = array_flip($this->csvinfo['attr']);
+    $this->csvinfo['arr_selected']= array($arr_temp['uid'],$arr_temp['sn'],$arr_temp['givenName'],$arr_temp['userPassword']);
+
+    $smarty->assign("templates",$this->csvinfo['arrtemplates']);
+    $smarty->assign("attrs",$this->csvinfo['attr']);
+
+    /* Check permissions for import */
+    $acl = $this->ui->get_permissions($this->config->current['BASE'],"all/all");
+    if(!preg_match("/w/",$acl)){
+      if(isset($_POST['userfile']) || isset($_POST['sorted']) || isset($_POST['fileup'])){
+        print_red(_("You've no permission to do CSV imports."));
+      }
+      return ($smarty->fetch (get_template_path('contentcsv.tpl', TRUE)));
+    }
+
+    /* If the given dat from the csv File are sorted by the attributes */
+    if(isset($_POST['sorted'])) {
+
+      /* Template Handling */
+      $smarty->assign("fileup",TRUE); 
+      $smarty->assign("sorted",TRUE); 
+
+      for($i = 0 ; $i < $this->csvinfo['rows'];$i++){
+        /* Preparing given Data */
+        $this->csvinfo['sorteddata'][$i]=array(); 
+
+        /* Go through every col */
+        for($a = 0; $a <= ($this->csvinfo['cols']); $a ++) {
+          /* Append a status col at last, to show possibly errors */
+          if($a==($this->csvinfo['cols'])){
+            $this->csvinfo['sorteddata'][$i]["status"]="-";            
+          } else {
+            $cc = ($i * ($this->csvinfo['cols']))+$a;
+
+            /* If theres a Attribut given for this col */
+            if(!empty($_POST[('row'.($a))])) {
+              $this->csvinfo['sorteddata'][$i][$this->csvinfo['attr'][$_POST[('row'.($a))]]]=$this->csvinfo['data'][($cc)]; 
+            }
+          }
+        }
+      } 
+
+      /* aleast one entry */
+      $rowcnt=0;      
+      if(isset($this->csvinfo['sorteddata'])){
+        $rowcnt ++;
+
+        /* Set the col count */
+        $tblcolcount= count ($this->csvinfo['cols']);
+
+        /* entrie count */
+        $tbl_entries= count ($this->csvinfo['count']);
+
+        /* row count */
+        $tbl_rows   = $tbl_entries / $tblcolcount;
+
+        /* No error occurred */
+        $failing = FALSE;
+
+        /* For every row */
+        for($i = 0; $i < $this->csvinfo['rows']; $i++){
+
+          /* Get elemenet */
+          $dat = $this->csvinfo['sorteddata'][$i];
+
+          /* If not all needed vars set .... */
+          if(         ( empty($dat['sn']))||( empty($dat['givenName']))||( empty($dat['uid']))||
+              (!isset($dat['sn']))||(!isset($dat['givenName']))||(!isset($dat['uid']))){
+
+            /* Output Error */
+
+            print_red (_("Need 'sn','givenName' and 'uid' to create user."));
+          } else {
+
+            /* Register usertab to trigger edit dialog */
+            $this->usertab= new usertabs($this->config, $this->config->data['TABS']['USERTABS'], 'new');
+            $keys = array_keys($dat);
+
+
+            /* Set all submitted vars  */
+            if(is_array($keys))
+              foreach($keys as $key) {
+                if($key != "status"){
+                  $this->usertab->$key = $dat[$key];
+                }
+              }
+
+            /* Initialize template */
+            if($this->csvinfo['tplid']!=0){
+              $this->usertab->adapt_from_template($this->csvinfo['arrtempls'][$this->csvinfo['tplid']]['dn']);
+              $this->usertab->save_object();
+            } else {
+
+              /* Reset vars */
+              if(is_array($keys))
+                foreach($keys as $key) {
+                  if($key != "status"){
+                    $this->usertab->by_object['user']->$key = $dat[$key];
+                  }
+                }
+            }
+
+            // Setting user Password 
+            if((isset($dat['userPassword']))&&(!empty($dat['userPassword'])))
+              $password = $dat['userPassword']; 
+            else
+            {
+              $rand_str="";
+              $feed = "0123456789abcdefghijklmnopqrstuvwxyz";
+              for ($i=0; $i < 8; $i++)
+              {
+                $rand_str .= substr($feed, rand(0, strlen($feed)-1), 1);
+              }
+              $password = $rand_str;
+            }
+
+            /* Insert in the LDAP tree */
+            if(count($this->usertab->check())) {
+              show_errors($this->usertab->check());
+              $this->csvinfo['sorteddata'][$i]['status']="<b>"._("failed")."</b>";
+              $failing = $i+1;
+              break;
+            } else {
+              $this->csvinfo['sorteddata'][$i]['status']=_("ok");
+              $this->usertab->save();
+              change_password($this->usertab->dn,$password); 
+            }
+          }
+        }
+
+        $pointsbefore = FALSE;
+        $pointsafter  = FALSE;
+
+        /* Get Attributs for Tableheadline  */
+        $this->csvinfo['colsstr'] = array();
+        for($i =0; $i <= $this->csvinfo['cols']; $i++) {
+          if(!empty($_POST[('row'.$i)])){
+            $this->csvinfo['colsstr'][$i] = $this->csvinfo['attr'][$_POST[('row'.$i)]];
+          }
+        }
+
+        /*Create array with data for the template */
+        if($failing == FALSE){
+
+          $dataouts= array();
+          for($i =1; $i <= $this->csvinfo['shownrowscount']; $i++) {
+            if(is_array($this->csvinfo['sorteddata'][($i-1)])){
+              foreach($this->csvinfo['sorteddata'][($i-1)] as $dat){
+                $dataouts[]=$dat;
+              }
+            }
+          }
+
+          if($this->csvinfo['rows']> $this->csvinfo['shownrowscount']){
+            $pointsafter = TRUE;
+          }
+        } else {
+          $pointsbefore = TRUE;
+          $pointsafter  = TRUE;
+
+          $begin = $failing -3;
+
+          if($begin <0) {
+            $begin =0;
+            $pointsbefore = FALSE;
+          }
+
+          $end = $failing + 2;
+
+          if($end > $this->csvinfo['rows']) {
+            $end = $this->csvinfo['rows']+1;
+            $pointsafter = FALSE;
+          }
+          $this->csvinfo['shownrowscount']=$end - $begin;
+
+          if($this->csvinfo['shownrowscount']> $this->csvinfo['rows'])$this->csvinfo['shownrowscount']=$this->csvinfo['rows'];
+
+          $dataouts = array(); 
+          for($i =$begin; $i <= $end; $i++) {
+            if(is_array($this->csvinfo['sorteddata'][($i-1)])){
+              foreach($this->csvinfo['sorteddata'][($i-1)] as $dat){
+                $dataouts[]=$dat;
+              }
+            }
+          }
+        }
+        $tmparr2  = $this->csvinfo['colsstr'];
+        $tmparr2[]=_("status");
+
+        /* Error? */
+        if ($failing){
+          print_red(sprintf(_("An Error Occured while inserting entry %s - process aborted"), $failing));
+        }
+        $smarty->assign("error",$failing);
+
+        /* Set vars to smarty */
+        $smarty->assign("cols",count($tmparr2));
+        $smarty->assign("anz" ,$this->csvinfo['count']);
+        $smarty->assign("rows",$this->csvinfo['shownrowscount']);
+
+
+        $cnt = 0 ;
+        $tmp2 = $tmp3 = array();
+        if(is_array($dataouts))
+          foreach($dataouts as $tmp){
+            $tmp2[] = $tmp;
+            $cnt ++ ;
+            if($cnt >= count($tmparr2)){
+              $tmp3[] = $tmp2;
+              $tmp2= array();
+              $cnt = 0; 
+            }
+          }  
+        $smarty->assign("head",$tmparr2);
+        $smarty->assign("data",$tmp3);
+
+        /* Set other vars  */
+        $smarty->assign("i",1);
+        $smarty->assign("ie",0);
+        $smarty->assign("tplid",$this->csvinfo['tplid']);
+
+        $smarty->assign("pointsafter",$pointsafter);
+        $smarty->assign("pointsbefore",$pointsbefore);
+      } else {
+        /* Set Template ID */
+        $tplid = $_POST['tplid'];
+
+
+        $smarty->assign("tpl",$arrtemplates[$tplid]);
+        print_red (_("Nothing to import!"));
+      }
+
+      /* If theres a File uploaded */
+    } else {
+      /* Check if theres a file uploaded */
+      if(!empty($_FILES['userfile']['name'])){
+
+        $handle = NULL;
+
+        if((!isset($_FILES['userfile']['name']))||(!isset($_POST['fileup'])))
+        {
+          print_red(_("There is no file uploaded."));
+          $smarty->assign("LDIFError",TRUE);
+        }
+        elseif(!$_FILES['userfile']['size'] > 0 )
+        {
+          print_red(_("The specified file is empty."));
+          $smarty->assign("LDIFError",TRUE);
+        }
+        /* Is there a tmp file, which we can use ? */
+        elseif(!file_exists($_FILES['userfile']['tmp_name']))
+        {
+          print_red(_("There is no file uploaded."));
+          $smarty->assign("LDIFError",TRUE);
+        }
+        elseif(!$handle = @fopen($_FILES['userfile']['tmp_name'],"r"))
+        {
+          print_red(_("There is no file uploaded."));
+          $smarty->assign("LDIFError",TRUE);
+        }
+        else
+        {
+          $smarty->assign("fileup",TRUE);
+          $str = "";
+
+
+          /* Reading content */
+          while(!feof($handle)) {
+            $str .= fread($handle,1024);
+          }
+
+          $lines = split("\n",$str);
+          $anz  = 0;
+          $rest = 0;
+          $data = array();
+
+          /* check colum count */
+          if(is_array($lines))
+            foreach($lines as $line) {
+              /* continue if theres a comment */
+              if(substr(trim($line),0,1)=="#"){
+                continue;
+              }
+
+              $line= str_replace ("\t","",$line);
+              $cells  = split(",",$line )  ;
+
+              if(count($cells)> $anz ){
+                $anz = count($cells);
+              }
+            }
+
+          /* At least one entry */
+          if($anz >1) {
+
+            /* Generate array with outpu info  */
+            if(is_array($lines))
+              foreach($lines as $line) {
+                $rest = 0;
+                $cnt  = 0;
+
+                /* dont use comments or empty lines */
+                if((substr(trim($line),0,1)=="#")||(empty($line))){
+                  continue;
+                }
+
+                /* replace \t to , */
+                $line= str_replace ("\t"  ,"" ,$line);
+
+                /* get all elements  */
+                $cells  = split(",",$line )  ;
+
+                /* attach all elements to data array */
+                if(is_array($cells))
+                  foreach($cells as $cell) {
+                    if(!empty($cell)) {
+                      $cnt++; 
+                      $data[]=trim($cell);
+                    }
+                  }
+
+                /* cell count less than anz, attach some empty fields */
+                if(($cnt != $anz)&&(!empty($cnt))) {
+                  $rest = $anz - $cnt;
+                  for($i = 0 ; $i < $rest ; $i ++){
+                    $data[] = " ";
+                  }
+                }
+              }    
+
+            unset($this->csvinfo['sorteddata']);
+            unset($this->csvinfo['colsstr']);
+            unset($this->csvinfo['sorteddata']);
+
+            $this->csvinfo['cols']        = $anz;
+            $this->csvinfo['data']        = array();
+            $this->csvinfo['data']        = $data;
+            $this->csvinfo['count']       = count($this->csvinfo['data']);
+
+            if($this->csvinfo['count']> (6* $this->csvinfo['cols'])) {
+              /* only show 6 rows in ouptuttablei */
+              $datouttemp =  array_chunk($this->csvinfo['data'],(6* $this->csvinfo['cols']));
+              $this->csvinfo['dataout']=$datouttemp[0];
+              $this->csvinfo['shownrowscount'] = 6;
+            } else {
+              $this->csvinfo['shownrowscount'] = (count($this->csvinfo['data']))/$this->csvinfo['cols'];
+              $this->csvinfo['dataout']= $this->csvinfo['data'];  
+            }
+
+            $this->csvinfo['tplid']       = $_POST['template'];
+            $this->csvinfo['templatestr'] = $this->csvinfo['arrtemplates' ][$this->csvinfo['tplid']];
+            $this->csvinfo['count']       = count($this->csvinfo['data']);
+            $this->csvinfo['rows']        = (count($this->csvinfo['data'])/$anz);
+
+            $i =  0; 
+            $tmp = $tmp2= array();
+            if(is_array($this->csvinfo['dataout']))
+              foreach($this->csvinfo['dataout'] as $dat){
+                $tmp[]= $dat;
+                $i++;
+                if($i >=$this->csvinfo['cols']){
+                  $i = 0;
+                  $tmp2[] = $tmp;
+                  $tmp = array();
+                }
+
+              }
+
+            /* Set Templateid  */
+            $smarty->assign("tplid",$this->csvinfo['tplid']);
+
+            /* Set Template  */
+            $smarty->assign("tpl",$this->csvinfo['templatestr']);
+
+            /* Temp var 1 */
+            $smarty->assign("ia",1); 
+
+            /* Temp var 2 */
+            $smarty->assign("i",0); 
+
+            /* Num rows    */
+            $smarty->assign("rows",$this->csvinfo['shownrowscount']);
+
+
+            for($i  = 0 ; $i < $anz; $i ++)
+              $this->csvinfo['arr_selected'][]="0";
+
+            $smarty->assign("selectedattrs",$this->csvinfo['arr_selected']);
+
+            /* Entrie count5 */
+            $smarty->assign("anz",$this->csvinfo['cols']);                                                    
+
+            /* Array with data */
+            $smarty->assign("data",$tmp2);   
+
+            @fclose($handle);
+          } else {
+            $smarty->assign("tpl",$this->csvinfo['attr'][$_POST['template']]);
+            $smarty->assign("LDIFError",TRUE);
+            $smarty->assign("fileup",FALSE);
+            print_red(_("The selected file does not contain any CSV Data..."));  
+          }
+        }
+      }
+    }                                              
+
+    /* Show main page */
+    return ($smarty->fetch (get_template_path('contentcsv.tpl', TRUE)));
+  }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/addons/ldapmanager/class_export.inc b/gosa-core/plugins/addons/ldapmanager/class_export.inc
new file mode 100644 (file)
index 0000000..aa988a3
--- /dev/null
@@ -0,0 +1,125 @@
+<?php
+
+class ldifexport extends plugin
+{
+  /* Definitions */
+  var $plHeadline= "CSV import";
+  var $plDescription= "This does something";
+
+  /* attribute list for save action */
+  var $attributes= array();
+  var $objectclasses= array();
+  var $view_logged = FALSE;
+
+  function ldifexport (&$config, $dn= NULL)
+  {
+    /* Include config object */
+    $this->config= &$config;
+    $this->ui = get_userinfo();
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* Log view */
+    if(!$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","all/".get_class($this),$this->dn);
+    }
+
+    /* Set government mode */
+    $smarty= get_smarty();
+
+    $smarty->assign("type",FALSE);
+    $smarty->assign("depselectivbb","");
+
+    // fill in old vars in the Export form
+    if((isset($_POST['single']))&&(isset($_POST['sfrmgetsingle']))){
+      $smarty->assign("single",$_POST['single']);
+      $smarty->assign("type","single");
+      $dn = $_POST['single'];
+    }
+    if((isset($_POST['selfull']))&&(isset($_POST['sfrmgetfull']))){
+      $smarty->assign("depselectfull",$_POST['selfull']);
+      $smarty->assign("type","full");
+      $dn = $_POST['selfull'];
+    } else {
+      $smarty->assign("depselectfull", "");
+    }
+    if((isset($_POST['selivbb']))&&(isset($_POST['sfrmgetivbb']))){
+      $smarty->assign("depselectivbb",$_POST['selivbb']);
+      $smarty->assign("type","ivbb");
+      $dn = $_POST['selivbb'];
+    } else {
+      $smarty->assign("depselectivbb", "");
+    }
+
+    // Set values for optionlist in form
+    $bases      = array();
+    $acl_bases  = $this->ui->get_module_departments("all");
+    foreach($this->config->idepartments as $base_dn => $name){
+      if(in_array_ics($base_dn,$acl_bases)){
+        $bases[$base_dn] = $name;
+      }
+    }
+    $smarty->assign("deplist", $bases);
+
+    // Get the LDAP link, to generate the Export
+    $ldap = $this->config->get_ldap_link();
+
+    if ($this->config->current['GOVERNMENTMODE'] == 'true'){
+      $smarty->assign ("govmode", "true");
+    } else {
+      $smarty->assign ("govmode", "false");
+    }
+
+    $smarty->assign("LDIFError",FALSE);
+
+    if(isset($dn))
+    {
+      if(!($ldap->dn_exists($dn) && $dn != "")){
+        $smarty->assign("LDIFError",TRUE);
+        print_red (_("Error while exporting the requested entries!"));
+      }
+    }
+
+    /* check alcs for given dn */
+    $acls ="";
+    if(isset($dn)){
+      $acls = $this->ui->get_permissions($dn,"all/all");
+    }
+    if((!preg_match("/r/",$acls)) && (isset($dn))){
+
+      /* Show error msg */      
+      print_red(sprintf(_("You are not allowed to export the given ldap entry (%s)"),@LDAP::fix($dn)));
+
+      /* Show main page */
+      $smarty->assign("LDIFError",TRUE);
+      $smarty->assign("para","");
+    }else{
+
+      // Export a single LDAP entry
+      if(isset($_POST['sfrmgetsingle']))
+      {
+        $smarty->assign("para","?ivbb=2&amp;dn=".base64_encode($_POST['single']));
+      }
+      elseif(isset($_POST['sfrmgetfull']))
+      {
+        $smarty->assign("para","?ivbb=3&amp;dn=".base64_encode($_POST['selfull']));
+      }
+      elseif(isset($_POST['sfrmgetivbb']))
+      {
+        $smarty->assign("para","?ivbb=4&amp;dn=".base64_encode($_POST['selivbb']));
+      }
+    }
+
+    /* Show main page */
+    return ($smarty->fetch (get_template_path('contentexport.tpl', TRUE)));
+  }
+}
+
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/addons/ldapmanager/class_exportxls.inc b/gosa-core/plugins/addons/ldapmanager/class_exportxls.inc
new file mode 100644 (file)
index 0000000..3331cba
--- /dev/null
@@ -0,0 +1,142 @@
+<?php
+
+
+class xlsexport extends plugin
+{
+  /* Definitions */
+  var $plHeadline= "XLS import";
+  var $plDescription= "This does something";
+  var $access= "";
+
+  /* attribute list for save action */
+  var $attributes= array();
+  var $objectclasses= array();
+  var $ui;
+  var $view_logged = FALSE;
+
+  function xlsexport (&$config, $dn= NULL)
+  {
+    /* Include config object */
+    $this->config= &$config;
+
+    $this->ui = get_userinfo();
+  }
+
+  function execute()
+  {
+       /* Call parent execute */
+       plugin::execute();
+
+    /* Log view */
+    if(!$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","all/".get_class($this),$this->dn);
+    }
+
+    $dn = $this->config->current['BASE'];
+
+    /* Set government mode */
+    $smarty= get_smarty();
+    $smarty->assign("type",FALSE);
+    $smarty->assign("depselectivbb","");
+    
+    if(!isset($_POST['selfull'])) $_POST['selfull'] = "Somehow not posted";
+
+    /* Check permissions for export */
+    // fill in old vars in the Export form
+    if((isset($_POST['single']))&&(isset($_POST['sfrmgetsingle']))){
+      $smarty->assign("single",$_POST['single']);
+      $smarty->assign("type","single");
+      $a=$_POST['single'];
+      $b=$_POST['selfull'];
+
+    }
+    if((isset($_POST['selfull']))&&(isset($_POST['sfrmgetfull']))){
+      $smarty->assign("depselectfull",$_POST['selfull']);
+      $smarty->assign("type","full");
+      $dn = $_POST['selfull'];
+    } else {
+      $smarty->assign("depselectfull", "");
+    }
+    if((isset($_POST['selivbb']))&&(isset($_POST['sfrmgetivbb']))){
+      $smarty->assign("depselectivbb",$_POST['selivbb']);
+      $smarty->assign("type","ivbb");
+      $dn = $_POST['selivbb'];
+    } else {
+      $smarty->assign("depselectivbb", "");
+    }
+
+    // Set values for optionlist in form
+    $bases      = array();
+    $acl_bases  = $this->ui->get_module_departments("all");
+    foreach($this->config->idepartments as $base_dn => $name){
+      if(in_array_ics($base_dn,$acl_bases)){
+        $bases[$base_dn] = $name;
+      }
+    }
+    $smarty->assign("deplist", $bases);
+    $smarty->assign("choicelist",array( get_people_ou()             =>"users" ,
+                                        "ou=groups,"                =>"groups" ,
+                                        "ou=systems,"               =>"computers",
+                                        "ou=servers,ou=systems,"    =>"servers",
+                                        "dc=addressbook,"           =>"addressbook"));
+
+    // Get the LDAP link, to generate the Export
+    $ldap = $this->config->get_ldap_link();
+
+    if ($this->config->current['GOVERNMENTMODE'] == 'true'){
+      $smarty->assign ("govmode", "true");
+    } else {
+      $smarty->assign ("govmode", "false");
+    }
+
+    $smarty->assign("LDIFError",FALSE);
+
+    if(isset($dn))
+    {
+      if(!($ldap->dn_exists($dn) && $dn != "")){
+        $smarty->assign("LDIFError",TRUE);
+       print_red (_("Error while exporting the requested entries!"));
+      }
+    }
+   
+    /* check alcs for given dn */
+    $acls ="";
+    if(isset($dn)){
+      $acls = $this->ui->get_permissions($dn,"all/all");
+    }
+    if(!preg_match("/r/",$acls) && (isset($_POST['sfrmgetsingle']) || isset($_POST['sfrmgetfull']) || isset($_POST['sfrmgetivbb']))){
+
+      /* Show error msg */      
+      print_red(sprintf(_("You are not allowed to export the given ldap entry (%s)"),@LDAP::fix($dn)));
+
+      /* Show main page */
+      $smarty->assign("LDIFError",TRUE);
+      $smarty->assign("para","");
+    }else{
+
+      // Export a single LDAP entry
+      if(isset($_POST['sfrmgetsingle']))
+      {
+        $smarty->assign("para","?ivbb=2&amp;d=".base64_encode($_POST['single'])."&n=".base64_encode($_POST['selfull']));       
+      }
+      elseif(isset($_POST['sfrmgetfull']))
+      {
+        $smarty->assign("para","?ivbb=3&amp;dn=".base64_encode($_POST['selfull']));
+      }
+      elseif(isset($_POST['sfrmgetivbb']))
+      {
+        $smarty->assign("para","?ivbb=4&amp;dn=".base64_encode($_POST['selivbb']));
+      }
+    }
+
+    /* Show main page */
+    return ($smarty->fetch (get_template_path('contentexportxls.tpl', TRUE)));
+  }
+
+}
+
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/addons/ldapmanager/class_import.inc b/gosa-core/plugins/addons/ldapmanager/class_import.inc
new file mode 100644 (file)
index 0000000..71edbb2
--- /dev/null
@@ -0,0 +1,120 @@
+<?php
+
+class ldifimport extends plugin
+{
+  /* Definitions */
+  var $plHeadline= "LDIF export";
+  var $plDescription= "This does something";
+  var $access= "";
+
+  /* attribute list for save action */
+  var $attributes= array();
+  var $objectclasses= array();
+  var $ui;
+  var $view_logged = FALSE;
+
+  function ldifimport (&$config, $dn= NULL)
+  {
+    /* Include config object */
+    $this->config= &$config;
+
+    $this->ui = get_userinfo();
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* Log view */
+    if(!$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","all/".get_class($this),$this->dn);
+    }
+
+    /* Set government mode */
+    $smarty= get_smarty();
+
+    // Get the LDAP link, to generate the Export
+    $ldap = $this->config->get_ldap_link();
+
+    $smarty->assign("LDIFError",FALSE);
+    $smarty->assign("type",FALSE);
+
+    /* Get acls */
+    $acl = $this->ui->get_permissions($this->config->current['BASE'],"all/all");
+    
+    /* Import requested check file and acls */
+    if((isset($_FILES['userfile']['name']))&&(isset($_POST['fileup']))){
+
+      /* Check acls */
+      if(!preg_match("/w/",$acl)){
+        print_red(_("You need full access to all objects, to execute the import command."));
+      }else{
+
+        $smarty->assign("type","importfile");
+        $handle = NULL;
+
+        // Check if there is a file submitted
+        if(!$_FILES['userfile']['size'] > 0 )
+        {
+          print_red(_("The specified file is empty."));
+          $smarty->assign("LDIFError",TRUE);  
+        }
+
+        // Is there a tmp file, which we can use ?
+        elseif(!file_exists($_FILES['userfile']['tmp_name']))  
+        {
+          print_red(_("There is no file uploaded."));
+          $smarty->assign("LDIFError",TRUE);
+
+        }
+
+        // Can we open the tmp file, for reading
+        elseif(!$handle = @fopen($_FILES['userfile']['tmp_name'],"r"))
+        {
+          print_red(_("There is no file uploaded."));
+          $smarty->assign("LDIFError",TRUE);  
+        }
+        else
+        {
+          // Everything just fine :)
+          $str = ""; 
+
+          // Reading content 
+          while(!feof($handle))
+          {
+            $str .= fread($handle,1024);
+          }
+          @fclose($handle);
+
+          // Should we use Overwrite ?
+          if(!empty($_POST['overwrite'])) $overwrite = true; else $overwrite = false;;
+          if(!empty($_POST['cleanup']))   $cleanup   = true; else $cleanup = false;
+
+          $ErrorStr="";
+          $check = $ldap->import_complete_ldif($str,$ErrorStr,$overwrite,$cleanup);
+
+          if($check == INSERT_OK  )
+            $smarty->assign("LDIFError",FALSE);
+          else
+            $smarty->assign("LDIFError",TRUE);
+
+          switch($check)
+          {
+            case INSERT_OK : break;
+            case ALREADY_EXISTING_ENTRY      : print_red($ErrorStr); break;
+            case UNKNOWN_TOKEN_IN_LDIF_FILE  : print_red($ErrorStr);break;
+
+            default : print_red(_("Unknown Error"));break;
+          }
+        }
+      }
+    }
+    return ($smarty->fetch (get_template_path('contentimport.tpl', TRUE)));
+  }
+}
+
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/addons/ldapmanager/class_ldif.inc b/gosa-core/plugins/addons/ldapmanager/class_ldif.inc
new file mode 100644 (file)
index 0000000..3451f81
--- /dev/null
@@ -0,0 +1,52 @@
+<?php
+
+class ldif extends plugin
+{
+  /* Definitions */
+  var $plHeadline= "LDAP manager";
+  var $plDescription= "This does something";
+
+  /* attribute list for save action */
+  var $attributes= array();
+  var $objectclasses= array();
+  var $ldif;
+
+  function ldif (&$config)
+  {
+    /* Include config object */
+    $this->ldif= new ldiftab($config, $config->data['TABS']['LDIFTAB'], "");
+  }
+
+  function execute()
+  {
+       /* Call parent execute */
+       plugin::execute();
+
+    /* Show main page */
+    return ($this->ldif->execute());
+  }
+
+  /* Return plugin informations for acl handling
+     #FIXME You can only read attributes within this report plugin */
+  static function plInfo()
+  {
+    return (array(
+        "plShortName"   => _("Ldap manager"),
+        "plDescription" => "Dummy entry for menu creation functions, later",
+        "plSelfModify"  => FALSE,
+        "plDepends"     => array(),
+        "plPriority"    => 1,
+        "plSection"     => array("addon"),
+        "plCategory"    => array("ldapmanager" => array("objectClass" => "none", "description" => _("Ldap manager addon"))),
+
+        "plProvidedAcls" => array()
+        ));
+  }
+
+
+
+}
+
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/addons/ldapmanager/contentcsv.tpl b/gosa-core/plugins/addons/ldapmanager/contentcsv.tpl
new file mode 100644 (file)
index 0000000..fbfdfef
--- /dev/null
@@ -0,0 +1,118 @@
+<p>
+  {t}The CSV import plugin provides methods to generate user accounts from a file containing Comma Seperated Values. The administrator can decide which columns should be transfered to which attribute. Note that you must have at least the UID, GIVENNAME and SURENAME set.{/t}
+</p>
+<p class="seperator">&nbsp;</p>
+
+{if $fileup != TRUE}
+<table summary="">
+       <tr>
+               <td>
+                       <LABEL for="userfile">{t}Select CSV file to import{/t}</LABEL>
+               </td>
+               <td>
+               <input type="hidden" name="MAX_FILE_SIZE" value="2097152">
+               <input id="userfile" name="userfile" type="file" value="{t}Browse{/t}">
+               </td>
+       </tr>
+       <tr>
+               <td>
+               <LABEL for="template">{t}Select template{/t}</LABEL>
+               </td>
+               <td>
+               <select id="template" name="template" size="1" title="">
+                       {html_options options=$templates selected=""}   
+               </select>
+               </td>
+               
+       </tr>
+</table>
+{elseif $sorted != FALSE}
+
+
+<br>
+    {if $error == FALSE}
+        <b>{t}All entries have been written to the LDAP database successfully.{/t}</b>
+    {else}
+        <b style="color:red">{t}Oups. There was an error during the import of your data.{/t}</b>
+       {/if}
+
+<b>{t}Here is the status report for the import:{/t} </b>
+<br>
+<br>
+
+
+       <table summary="" cellspacing="1" border=0 cellpadding="4"  bgcolor="#FEFEFE">
+               <tr>
+                       {foreach from=$head item=h}
+                       <td bgcolor="#BBBBBB">
+                               <b>{$h}</b>
+                       </td>
+                       {/foreach}
+               </tr>
+               {if $pointsbefore == TRUE}
+               <tr>
+                       <td colspan={$i} bgcolor = "#EEEEEE">
+                               ...     
+                       </td>
+               </tr>
+               {/if}
+               
+               {foreach from=$data item=row key=key}   
+               <tr>
+                       {foreach from=$data[$key] item=col key=key2}
+                       <td bgcolor="#EEEEEE">
+                               {$data[$key][$key2]}
+                       </td>
+                       {/foreach}
+               </tr>
+               {/foreach}
+           {if $pointsafter == TRUE}
+           <tr>
+               <td colspan={$i} bgcolor = "#EEEEEE">
+               ...
+               </td>
+           </tr>
+           {/if}
+                                                                                                                                                  
+       </table>
+
+{else}
+<br><b>{t}Selected Template{/t}:</b> {$tpl}
+<br>
+<br>
+       <table summary="" cellspacing="1" border=0 cellpadding="4" bgcolor="#FEFEFE">
+               <tr>
+                       {foreach from=$data[0] item=item key=key}
+                       <td bgcolor="#BBBBBB">
+                               <select name="row{$key}" size="1" title="">
+                                {html_options options=$attrs selected=$selectedattrs[$key]}
+                               </select>
+                       </td>
+                       {/foreach}
+               </tr>
+               {foreach from=$data item=val key=key}
+               <tr>
+                       {foreach from=$data[$key] item=val2 key=key2}
+                       <td bgcolor="#EEEEEE">
+                               {$data[$key][$key2]}&nbsp;
+                       </td>
+                       {/foreach}
+               </tr>
+               {/foreach}
+               
+       </table>
+
+<!-- {html_table loop=$data cols=$anz table_attr='border="1"'}-->
+{/if}
+<p class="plugbottom">
+{if $fileup != TRUE}
+  <input type="submit" value="{t}Import{/t}" name="fileup" >
+{else}
+{if $sorted == FALSE}
+  <input name="sorted" value="{t}Import{/t}" type ="submit">
+{else}
+  <input type=submit name="back{$plug}" value="{t}Back{/t}">
+{/if}
+{/if}
+</p>
+<input type="hidden" name="ignore">
diff --git a/gosa-core/plugins/addons/ldapmanager/contentexport.tpl b/gosa-core/plugins/addons/ldapmanager/contentexport.tpl
new file mode 100644 (file)
index 0000000..5cd2301
--- /dev/null
@@ -0,0 +1,73 @@
+{if $LDIFError != FALSE || $type == FALSE}
+<p style="margin-top:5px;">
+  {t}The LDIF export plugin provides methods to download a complete snapshot of the running LDAP directory as ldif. You may save these files for backup purpose or when initializing a new server.{/t}
+</p>
+<p class="seperator">&nbsp;</p>
+
+<table summary="" style="width:100%;">
+<tr>
+       <td width="30%">
+               <LABEL for="text" >{t}Export single entry{/t}</LABEL>
+       </td>
+       <td>
+               <input id="text" type="text" value="" name="single">
+       </td>
+       <td>
+               <input type="submit" value="{t}Export{/t}" name="sfrmgetsingle">
+       </td>
+</tr>
+<tr>
+       <td width="30%">
+               <LABEL for="selfull">{t}Export complete LDIF for{/t}</LABEL>
+       </td>
+       <td>
+               <select id="selfull" name="selfull" size="1" title="{t}Choose the department you want to Export{/t}">
+                       {html_options options=$deplist selected=0}
+               </select>
+       </td>
+       <td>
+               <input type="submit" value="{t}Export{/t}" name="sfrmgetfull">
+       </td>
+</tr>
+       
+{if $govmode eq "true"}
+<tr>
+       <td width="30%">
+               <LABEL for="selivbb">{t}Export IVBB LDIF for{/t}</LABEL>
+       </td>
+       <td>
+               <select id="selivbb" name="selivbb" size="1" title="{t}Choose the department you want to Export{/t}">
+                       {html_options options=$deplist selected=$depselectivbb}
+               </select>
+       </td>
+       <td>
+               <input type="submit" value="{t}Export{/t}" name="sfrmgetivbb">
+       </td>
+</tr>
+{/if}
+</table> 
+
+
+{else}
+
+
+<br>
+       <h1>{t}Export successful{/t}</h1>
+<br>
+       <div>
+               <img alt="" border="0" align=middle src="images/filesaveas.png">
+               <a href = "getldif.php{$para}" title="{t}Click here to save the complete LDAP database to a file{/t} ">{t}Click here to save the LDAP Export {/t}</a>
+
+
+               <br>
+               <br>
+       </div>
+       <div align="right">
+               <input type="submit" value="{t}Back{/t}" name='back'>
+       </div>
+{/if}
+<p class="plugbottom">
+  &nbsp;
+</p>
+
+<input type="hidden" name="ignore">
diff --git a/gosa-core/plugins/addons/ldapmanager/contentexportxls.tpl b/gosa-core/plugins/addons/ldapmanager/contentexportxls.tpl
new file mode 100644 (file)
index 0000000..bb115c7
--- /dev/null
@@ -0,0 +1,76 @@
+{if $LDIFError != FALSE || $type == FALSE}
+<p style="margin-top:5px;">
+  {t}The XLS export plugin provides methods to download a complete snapshot of the running LDAP directory as xls. You may save these files for documentation.{/t}
+</p>
+<p class="seperator">&nbsp;</p>
+
+<table summary="" style="width:100%;">
+<tr>
+       <td width="30%">
+               <LABEL for="single" >{t}Export single entry{/t}</LABEL>
+       </td>
+       <td>
+               {*<input id="text" type="text" value="" name="single">*}
+               <select id="single" name="single" size="1" title="{t}Choose the data you want to Export{/t}">
+                       {html_options options=$choicelist selected=0}
+               </select>
+       </td>
+       <td>
+               <input type="submit" value="{t}Export{/t}" name="sfrmgetsingle">
+       </td>
+</tr>
+<tr>
+       <td width="30%">
+               <LABEL for="selfull">{t}Export complete XLS for{/t}</LABEL>
+       </td>
+       <td>
+               <select id="selfull" name="selfull" size="1" title="{t}Choose the department you want to Export{/t}">
+                       {html_options options=$deplist selected=0}
+               </select>
+       </td>
+       <td>
+               <input type="submit" value="{t}Export{/t}" name="sfrmgetfull">
+       </td>
+</tr>
+       
+{if $govmode eq "true"}
+<tr>
+       <td width="30%">
+               <LABEL for="selivbb">{t}Export IVBB LDIF for{/t}</LABEL>
+       </td>
+       <td>
+               <select id="selivbb" name="selivbb" size="1" title="{t}Choose the department you want to Export{/t}">
+                       {html_options options=$deplist selected=$depselectivbb}
+               </select>
+       </td>
+       <td>
+               <input type="submit" value="{t}Export{/t}" name="sfrmgetivbb">
+       </td>
+</tr>
+{/if}
+</table> 
+
+
+{else}
+
+
+<br>
+       <h1>{t}Export successful{/t}</h1>
+<br>
+       <div>
+               <img alt="" border="0" align=middle src="images/filesaveas.png">
+               <a href = "getxls.php{$para}" title="{t}Click here to save the complete LDAP database to a xls file{/t} ">{t}Click here to save the LDAP Export to a xls file{/t}</a>
+
+
+               <br>
+               <br>
+       </div>
+       <div align="right">
+               <input type="submit" value="{t}Back{/t}" name='back'>
+       </div>
+{/if}
+<p class="plugbottom">
+  &nbsp;
+</p>
+
+<input type="hidden" name="ignore">
diff --git a/gosa-core/plugins/addons/ldapmanager/contentimport.tpl b/gosa-core/plugins/addons/ldapmanager/contentimport.tpl
new file mode 100644 (file)
index 0000000..b7d5afc
--- /dev/null
@@ -0,0 +1,52 @@
+{if $type == FALSE || $LDIFError != FALSE}
+<p style="margin-top:5px;">
+  {t}The LDIF import plugin provides methods to upload a set of entries to your running LDAP directory as ldif. You may use this to add new or modify existing entries. Remember that GOsa will not check your ldifs for GOsa conformance.{/t}
+</p>
+
+<p class="seperator">&nbsp;</p>
+<table summary="" width="100%">
+<tr>
+    <td width="180">
+               <LABEL for="userfile">{t}Import LDIF File{/t}</LABEL>
+    </td>
+    <td>
+                       <input type="hidden" name="ignore">
+                       <input type="hidden" name="MAX_FILE_SIZE" value="2097152">
+                       <input name="userfile" id="userfile" type="file" value="{t}Browse{/t}">
+    </td>
+</tr>
+<tr>
+       <td>
+               &nbsp;
+       </td>
+       <td>
+<!--        <input type="checkbox" name="overwrite" value="1" id="overwrite">-->
+               <input type="radio" name="overwrite" value="1" checked>{t}Modify existing objects, keep untouched attributes{/t}<br>
+               <input type="radio" name="overwrite" value="0">{t}Overwrite existing objects, all not listed attributes will be removed{/t}
+       </td>
+</tr>
+<tr>
+       <td>
+               &nbsp;
+       </td>
+       <td>
+        <input type="checkbox" name="cleanup" value="1" id="cleanup">
+               <LABEL for="cleanup">{t}Remove existing entries first{/t}</LABEL>
+       </td>
+</tr>
+</table>
+{else}
+
+<br>
+    <h1>{t}Import successful{/t}</h1>
+<br>
+
+<div align="right">
+               <input type="submit" value="{t}Back{/t}" name='back'>
+</div>
+               
+{/if}
+<p class="plugbottom">
+<input type="submit" value="{t}Import{/t}" name="fileup" >
+</p>
+<input type="hidden" name="ignore">
diff --git a/gosa-core/plugins/addons/ldapmanager/main.inc b/gosa-core/plugins/addons/ldapmanager/main.inc
new file mode 100644 (file)
index 0000000..696c14a
--- /dev/null
@@ -0,0 +1,39 @@
+<?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
+*/
+
+if (!$remove_lock){
+       /* Create phonelist object on demand */
+       if (!isset($_SESSION['ldif']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+               $_SESSION['ldif']= new ldif ($config);
+               $_SESSION['ldif']->set_acl_category("logview");
+       }
+       $ldif= $_SESSION['ldif'];
+
+       /* Execute formular */
+       $display= $ldif->execute ();
+       $display.= "<input type=\"hidden\" name=\"ignore\">\n";
+
+       /* Page header*/
+       $display= print_header(get_template_path('images/ldif.png'), _("LDAP manager")).$display;
+
+       /* Store changes  in session */
+       $_SESSION['ldif']= $ldif;
+}
+?>
diff --git a/gosa-core/plugins/addons/ldapmanager/tabs_ldif.inc b/gosa-core/plugins/addons/ldapmanager/tabs_ldif.inc
new file mode 100644 (file)
index 0000000..2f6b70f
--- /dev/null
@@ -0,0 +1,24 @@
+<?php
+
+class ldiftab extends tabs
+{
+
+  function ldiftab($config, $data, $dn)
+  {
+    tabs::tabs($config, $data, $dn);
+  }
+
+  function save_object($save_current= FALSE)
+  {
+    tabs::save_object($save_current);
+  }
+
+
+  function save($ignore_account= FALSE)
+  {
+  }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/addons/logview/class_gosa_logview.inc b/gosa-core/plugins/addons/logview/class_gosa_logview.inc
new file mode 100644 (file)
index 0000000..87d234a
--- /dev/null
@@ -0,0 +1,398 @@
+<?php
+
+class gosa_logview extends plugin
+{
+  /* Definitions */
+  var $plHeadline= "System logs";
+  var $plDescription= "This does something";
+
+  /* attribute list for save action */
+  var $attributes     = array();
+  var $objectclasses  = array();
+
+  var $server         = "";
+  var $action         = "modify";
+  var $time           = 2;
+  var $regex          = "*";
+
+  var $start  = 0;
+  var $sort   = 1;
+
+  var $sort_direction = "down";
+  var $fields         = array("action","timestamp","user","objecttype","object","result","repeated");
+  var $range          = 25;
+  var $view_logged    = FALSE;
+
+  var $timezone_offset  = 0;
+
+  var $uid_map = array();
+  
+
+  function gosa_logview (&$config, $dn= NULL)
+  {
+    /* Include config object */
+    $this->config= &$config;
+    $this->ui = get_userinfo();
+
+    /* Restore last filter settings */
+    foreach(array("action","server","time","regex") as $attr){
+      if(isset($_SESSION['logview']['gosa_log'][$attr])){
+        $this->$attr = $_SESSION['logview']['gosa_log'][$attr];
+      }
+    }
+
+    $tz = get_default_timezone();
+    $this->timezone_offset = $tz['value'] * 60 * 60 ;
+
+    $ldap = $this->config->get_ldap_link();
+    $ldap->search("(&(objectClass=person)(uid=*))",array("uid","dn"));
+    while($attrs = $ldap->fetch()){
+      $this->uid_map[$attrs['dn']] = $attrs['uid'][0];
+    }
+  }
+
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* Log view */
+    if(!$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","logview/".get_class($this),$this->dn);
+    }
+
+    /* Time interval */
+    $date_select = array(
+        "0" => _("one hour"), "1" => _("6 hours"),
+        "2" => _("12 hours"), "3" => _("24 hours"),
+        "4" => _("2 days"),   "5" => _("one week"),
+        "6" => _("2 weeks"),  "7" => _("one month"));
+
+
+    $time = time();
+    $date_select_ = array(
+        "0" => $time - 3600, 
+        "1" => $time - 21600,
+        "2" => $time - 43200,
+        "3" => $time - 86400,
+        "4" => $time - 172800,
+        "5" => $time - 604800,
+        "6" => $time - 1209600,
+        "7" => $time - 2419200);
+
+    $smarty= get_smarty();
+    $smarty->assign("search_result", "");
+    $smarty->assign("plug", "?plug=".validate($_GET['plug']));
+    $smarty->assign("search_image", get_template_path('images/search.png'));
+    $smarty->assign("time_image", get_template_path('images/time.png'));
+    $smarty->assign("server_image", get_template_path('images/server.png'));
+    $smarty->assign("log_image", get_template_path('images/log_warning.png'));
+    $smarty->assign("ruleset_image", get_template_path('images/edit.png'));
+    $smarty->assign("launchimage", get_template_path('images/launch.png'));
+    $smarty->assign("date_select", $date_select);
+    $smarty->assign("actions", array());
+    $smarty->assign("direction", "up");
+    $smarty->assign("mode0", "");
+    $smarty->assign("mode1", "");
+    $smarty->assign("mode2", "");
+    $smarty->assign("mode3", "");
+    $smarty->assign("mode4", "");
+    $smarty->assign("mode5", "");
+    $smarty->assign("mode6", "");
+
+    /* Assign select option content */
+    foreach( array("server", "action", "time", "regex") as $type){
+      $smarty->assign("$type", $this->$type);
+    }
+
+    /**** 
+     * Check if defined servers 
+     *  and mysql extension 
+     ****/
+    if (!isset($this->config->data['SERVERS']['LOGGING']) || !count($this->config->data['SERVERS']['LOGGING'])){
+      print_red (_("No GOsa LOG servers defined!"));
+      return ($smarty->fetch (get_template_path('gosa_log_contents.tpl', TRUE)));
+    }
+    
+    if(!is_callable("mysql_connect")){
+      print_red(_("There is no mysql extension available, please check your php setup."));
+      return ($smarty->fetch (get_template_path('gosa_log_contents.tpl', TRUE)));
+    }
+
+    /****
+     * Get Configurations 
+     ****/
+    $list_of_servers = $this->config->data['SERVERS']['LOGGING']; 
+    $servers         = array();
+    foreach($list_of_servers as $servername => $data){
+      $servers[$servername] = $servername;
+    }
+    $smarty->assign("servers", $servers);
+    
+    /* Set a default server, if there is currently no valid server selected */
+    if(empty($this->server) || !in_array($this->server,$servers)){
+      $this->server = key($servers);
+    }
+   
+    /**** 
+     * Connect to currently selected server 
+     ****/
+    $cfg = $list_of_servers[$this->server];
+    $link = @mysql_pconnect($this->server, $cfg['USER'], $cfg['PWD']);
+    if ($link === FALSE){
+      print_red(_("Can't connect to log database, no logs can be shown!"));
+      new log("debug","logview","",array(),@mysql_error());
+      return ($smarty->fetch (get_template_path('gosa_log_contents.tpl', TRUE)));
+    }
+
+    /* check of log database is available */
+    if (! @mysql_select_db($cfg['DB'])){
+      print_red(_("Can't select log database for log generation!"));
+      new log("debug","logview","",array(),@mysql_error());
+      return ($smarty->fetch (get_template_path('gosa_log_contents.tpl', TRUE)));
+    }
+
+    
+    /****
+     * Get all action types 
+     ****/
+
+    $actions = array("!ALL" => _("All"));
+    $query = "SELECT distinct(action) FROM gosa_log;";
+    $res = @mysql_query($query);
+    while($attrs = @mysql_fetch_assoc($res)){
+      $actions[$attrs['action']] = $attrs['action'];
+    } 
+
+
+    /****
+     * Check Acls 
+     ****/
+
+    $ui = get_userinfo();
+    $dn = $list_of_servers[$this->server]['DN'];
+    $acls = $ui->get_permissions($dn,"server/gosaLogServer","viewEntries");
+    
+    if(!preg_match("/r/",$acls)){
+      $res = "<tr>
+        <td colspan=".count($this->fields).">
+        "._("You have insufficient permissions to view syslog entries.")."
+        </td>
+        </tr>";
+
+      /* Show main page */
+      $smarty->assign("range_selector", "");
+      $smarty->assign("search_result", $res);
+      return ($smarty->fetch (get_template_path('gosa_log_contents.tpl', TRUE)));
+    }
+
+
+    /****
+     * Query stuff 
+     ****/
+    $res= "";
+    $cfg    = $list_of_servers[$this->server];
+    $link   = @mysql_pconnect($this->server, $cfg['USER'], $cfg['PWD']);
+
+    /* Test connection object && create up query string */
+    if ($link === FALSE){
+      print_red(_("Can't connect to log database, no logs can be shown!"));
+      new log("debug","logview","",array(),@mysql_error());
+    } else {
+
+      if (! @mysql_select_db($cfg['DB'])){
+        print_red(_("Can't select log database for log generation!"));
+        new log("debug","logview","",array(),@mysql_error());
+      } else {
+
+        /* Prepare order setting */
+        if ($this->sort_direction == "down"){
+          $desc= "DESC";
+          $sort_sign = "<img src='images/sort_down.png' alt='\/' class='center' title='down' border=0>";
+        } else {
+          $desc= "";
+          $sort_sign = "<img src='images/sort_up.png' alt='/\' class='center' title='up' border=0>";
+        }
+
+        /* Get start time */
+        $start = $date_select_[$this->time];
+        
+        /* Prepare search filter */
+        $sql_regex =trim(preg_replace("/\*/","%",$this->regex));
+        $sql_regex = "%".trim($sql_regex,"%")."%";
+
+        /* Create search filter */
+        $query_base= "FROM  gosa_log WHERE timestamp >= $start ";
+  
+        /* Append action filter */
+        if($this->action != "!ALL"){
+          $query_base .=" AND action like '".$this->action."' ";
+        }
+
+        /* Append search filter */
+        if($sql_regex != "%%"){
+          $query_base .=" AND ( result like '".$sql_regex."' OR user like '".$sql_regex."') ";
+        }
+
+        /* Get number of entries */
+        $query= "SELECT COUNT(`user`) ".$query_base.";";
+        $result = mysql_query($query);
+        if(!$result){
+          new log("debug","logview","",array(),@mysql_error());
+        }
+        $line= mysql_fetch_array($result, MYSQL_ASSOC);
+        $count= $line['COUNT(`user`)'];
+        if ($count > 25){
+          $smarty->assign("range_selector", range_selector($count, $this->start, $this->range,"EntriesPerPage"));
+        } else {
+          $smarty->assign("range_selector", "");
+        }
+
+        /* Query results that will be displayed */
+        $query= "SELECT * ".$query_base." ORDER BY ".$this->fields[$this->sort]." ".$desc." LIMIT  ".$this->start.",".$this->range.";";
+        @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__, $query, "Database query");
+        $result = @mysql_query($query);
+        if(!$result){
+          new log("debug","logview","",array(),@mysql_error());
+        }
+
+        /* Display results */
+        $mod= 0;
+
+        /* Add entries to result str */
+        while ($line = mysql_fetch_array($result, MYSQL_ASSOC)){
+
+          /* Toggle background color */
+          if ( ($mod++) & 1){
+            $col= "background-color: #ECECEC;";
+          } else {
+            $col= "background-color: #F5F5F5;";
+          }
+
+          $base = ", ".substr($this->config->current['BASE'],0,5)."...";
+  
+          if(isset($this->uid_map[$line['user']])){
+            $user = $this->uid_map[$line['user']];
+          }else{
+            $user = preg_replace("/,".normalizePreg($this->config->current['BASE'])."/",$base,$line['user']);
+          }
+          $object = preg_replace("/,".normalizePreg($this->config->current['BASE'])."/",$base,$line['object']);
+
+          $res.=" <tr style=\"$col\">\n";
+          $res.="   <td title='".$line['objecttype']."'>".$line['action']."</td>";
+          $res.="   <td>".date("H:i:s d.m.Y",($line['timestamp'] + $this->timezone_offset))."</td>";
+          $res.="   <td title='".$line['user']."'>".preg_replace("/,/",", ",$user)."</td>"; 
+          $res.="   <td title='".$line['objecttype']."'>".$line['objecttype']."</td>"; 
+          $res.="   <td title='".$line['object']."'>".preg_replace("/,/",", ",$object)."</td>"; 
+          $res.="   <td>".$line['result']."</td>";
+#         if($line['repeated'] == 1){
+#           $res.="   <td>-</td>";
+#         }else{
+#           $res.="   <td>".($line['repeated']-1)."</td>";
+#         }
+          $res.=" </tr>\n";
+        }
+        mysql_close($link);
+        $smarty->assign("mode".$this->sort, $sort_sign);
+        $smarty->assign("search_result", $res);
+      }
+    }
+
+    $smarty->assign("regex", $this->regex);
+    $smarty->assign("server",$this->server);
+    $smarty->assign("servers",$servers);
+    $smarty->assign("action",$this->action);
+    $smarty->assign("actions",$actions);
+    $smarty->assign("date_select", $date_select);
+
+    $smarty->assign("direction", $this->sort_direction);
+
+    /* Show main page */
+    return ($smarty->fetch (get_template_path('gosa_log_contents.tpl', TRUE)));
+  }
+
+
+  function save_object()
+  {
+    if(isset($_POST['gosa_log_contents_posted'])){
+
+      /* Get submitted range */        
+      if(isset($_POST['EntriesPerPage'])){
+        if(is_numeric($_POST['EntriesPerPage'])){
+          $this->range = $_POST['EntriesPerPage'];
+        }
+      }
+
+      /* Get actual select boxe values */
+      $logfilter_changed = FALSE;
+      foreach( array("server", "action","time","regex") as $type){
+        if(isset($_POST[$type])){
+          $this->$type = $_POST[$type];   
+        }
+      }
+
+      /* Filter regex values */
+      if ($this->regex == ""){
+        $this->regex= '*';
+      } else {
+        $new = preg_replace('/\*\**/', '*', $this->regex);
+        $this->regex= $new;
+      }
+
+      /* Set start value */
+      if (isset($_GET['start'])){
+        $this->start= (int)$_GET['start'];
+      }
+
+      /* Reset page number if filter has changed */
+      if ($logfilter_changed > 0){
+        $this->start= 0;
+      }
+
+      /* Adapt sorting */
+      if (isset($_GET['sort'])){
+
+        if($_GET['direction'] == "up"){
+          $this->sort_direction = "down";
+        }else{
+          $this->sort_direction = "up";
+        }
+
+        $this->sort= (int)$_GET['sort'];
+        if ($this->sort < 0 || $this->sort > count($this->fields)){
+          $this->sort= 0;
+        }
+      }
+
+      /* Save attributes in Sessiob, so we are able to recontruct filter on plugin reload */
+      $_SESSION['logview']['gosa_log'] = array();
+      foreach(array("action","server","time","regex") as $attr){
+        $_SESSION['logview']['gosa_log'][$attr] = $this->$attr;
+      }
+
+    }
+  }
+
+
+  /* Return plugin informations for acl handling
+     #FIXME You can only read attributes within this report plugin 
+  static function plInfo()
+  {
+    return (array(
+        "plShortName"   => _("Log view"),
+        "plDescription" => _("Log view addon"),
+        "plSelfModify"  => FALSE,
+        "plDepends"     => array(),
+        "plPriority"    => 0,
+        "plSection"     => array("addon"),
+        "plCategory"    => array("logview" => array("objectClass" => "none", "description" => _("System logs"))),
+
+        "plProvidedAcls" => array()
+        ));
+  }
+  */
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/addons/logview/class_logview.inc b/gosa-core/plugins/addons/logview/class_logview.inc
new file mode 100644 (file)
index 0000000..8716ee7
--- /dev/null
@@ -0,0 +1,415 @@
+<?php
+
+class logview extends plugin
+{
+  /* Definitions */
+  var $plHeadline= "System logs";
+  var $plDescription= "This does something";
+
+  /* attribute list for save action */
+  var $attributes= array();
+  var $objectclasses= array();
+  var $start= 0;
+  var $sort= 2;
+  var $sort_direction= "down";
+  var $hostlist= array();
+  var $loglevellist= array();
+  var $tilist= array();
+  var $fields= array("log_level", "host", "time_stamp", "message");
+  var $last= array("log_level", "host", "time", "regex");
+  var $range = 25;
+  var $view_logged = FALSE;
+
+  function logview (&$config, $dn= NULL)
+  {
+    /* Include config object */
+    $this->config= &$config;
+
+    /* Get global filter config */
+    if (!is_global("logfilter")){
+      $logfilter= array(
+          "time" => "1",
+          "log_level" => "!All",
+          "host" => "!All",
+          "regex" => "*");
+
+      register_global("logfilter", $logfilter);
+    }
+
+    $this->ui = get_userinfo();
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* Log view */
+    if(!$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","logview/".get_class($this),$this->dn);
+    }
+
+    $logfilter= get_global("logfilter");
+    $smarty= get_smarty();
+    $smarty->assign("search_result", "");
+    $smarty->assign("plug", "?plug=".validate($_GET['plug']));
+    $smarty->assign("search_image", get_template_path('images/search.png'));
+    $smarty->assign("time_image", get_template_path('images/time.png'));
+    $smarty->assign("server_image", get_template_path('images/server.png'));
+    $smarty->assign("log_image", get_template_path('images/log_warning.png'));
+    $smarty->assign("ruleset_image", get_template_path('images/edit.png'));
+    $smarty->assign("launchimage", get_template_path('images/launch.png'));
+    $smarty->assign("hostlist", $this->hostlist);
+    $smarty->assign("loglevellist", $this->loglevellist);
+    $smarty->assign("tilist", $this->tilist);
+    $smarty->assign("mode0", "");
+    $smarty->assign("mode1", "");
+    $smarty->assign("mode2", "");
+    $smarty->assign("mode3", "");
+
+    /* Assign select option content */
+    foreach( array("host", "log_level", "time", "regex") as $type){
+      $smarty->assign("$type", $logfilter[$type]);
+    }
+
+    /* Test connection to log database */
+    if (!isset($this->config->data['SERVERS']['LOG'])){
+      print_red (_("No LOG servers defined!"));
+      return ($smarty->fetch (get_template_path('contents.tpl', TRUE)));
+
+    }elseif(!is_callable("mysql_connect")){
+      print_red(_("There is no mysql extension available, please check your php setup."));
+      return ($smarty->fetch (get_template_path('contents.tpl', TRUE)));
+
+    }else{
+
+      /* Cehck connection informations */      
+      $cfg= $this->config->data['SERVERS']['LOG'];
+
+      /* Open link to database  and check if it is valid */    
+      $link = @mysql_pconnect($cfg['SERVER'], $cfg['LOGIN'], $cfg['PASSWORD']);
+      if ($link === FALSE){
+        print_red(_("Can't connect to log database, no logs can be shown!"));
+        new log("debug","logview","",array(),@mysql_error());
+        return ($smarty->fetch (get_template_path('contents.tpl', TRUE)));
+      }
+
+      /* check of log database is available */
+      if (! @mysql_select_db("gomon")){
+        print_red(_("Can't select log database for log generation!"));
+        new log("debug","logview","",array(),@mysql_error());
+        return ($smarty->fetch (get_template_path('contents.tpl', TRUE)));
+      }
+
+      /* Get Host list, if still empty */
+      if(count($this->hostlist) == 0){
+
+        /* Query database and check results */
+        $query= "SELECT DISTINCT host FROM golog LIMIT 200;";
+        @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__, $query, "Database query");
+        $result = @mysql_query($query);
+        if ($result === false){
+          print_red(_("Query for log database failed!. Requesting host names failed."));
+          new log("debug","logview","",array(),@mysql_error());
+          return ($smarty->fetch (get_template_path('contents.tpl', TRUE)));
+        }
+
+        /* Add hostnames to list */    
+        while ($line = mysql_fetch_array($result, MYSQL_ASSOC)){
+          $this->hostlist[$line['host']]= $line['host'];
+        }
+        $this->hostlist['!All']= _("All");
+        ksort($this->hostlist);
+        $smarty->assign("hostlist", $this->hostlist);
+      }
+
+      /* Get log level list */
+      if(count($this->loglevellist) == 0){
+
+        /* Try to get all used log level types */
+        $query= "SELECT DISTINCT log_level FROM golog LIMIT 200;";
+        @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__, $query, "Database query");
+        $result = @mysql_query($query);
+        if ($result === false){
+          new log("debug","logview","",array(),@mysql_error());
+          print_red(_("Query for log database failed!"));
+          return ($smarty->fetch (get_template_path('contents.tpl', TRUE)));
+        }
+
+        /* Add each etry to log level list */
+        while ($line = mysql_fetch_array($result, MYSQL_ASSOC)){
+          $this->loglevellist[$line['log_level']]= $line['log_level'];
+        }
+        $this->loglevellist['!All']= _("All");
+        ksort($this->loglevellist);
+        $smarty->assign("loglevellist", $this->loglevellist);
+      }
+    }
+
+    /* Set list of available time sequences */
+    if(count($this->tilist) == 0){
+
+      /* Time interval */
+      $this->tilist= array("0" => _("one hour"), "1" => _("6 hours"),
+          "2" => _("12 hours"), "3" => _("24 hours"),
+          "4" => _("2 days"), "5" => _("one week"),
+          "6" => _("2 weeks"), "7" => _("one month"));
+      $smarty->assign("tilist", $this->tilist);
+    }
+
+    $smarty->assign("regex", $logfilter['regex']);
+
+
+    /* Get acls */
+    
+    $tmp_cat_bases = $this->ui->get_module_departments("logview");
+    $all_acls = "";
+    foreach($tmp_cat_bases as $acl_base){
+      $all_acls .= $this->ui->get_permissions($acl_base,"logview/logview");
+    }
+    if(count($tmp_cat_bases) == 0 || !preg_match("/r/",$all_acls)){
+      $res = "<tr>
+        <td colspan=4>
+        "._("You have insufficient permissions to view syslog entries.")."
+        </td>
+        </tr>";
+
+      /* Show main page */
+      $smarty->assign("range_selector", "");
+      $smarty->assign("search_result", $res);
+      return ($smarty->fetch (get_template_path('contents.tpl', TRUE)));
+    }
+
+    /* Query stuff */
+    $res= "";
+    $cfg    = $this->config->data['SERVERS']['LOG'];
+    $tmp    = set_error_handler('dummy_error_handler');
+    $link   = @mysql_pconnect($cfg['SERVER'], $cfg['LOGIN'], $cfg['PASSWORD']);
+    set_error_handler($tmp);
+
+    /* Test connection object && create up query string */
+    if ($link === FALSE){
+      print_red(_("Can't connect to log database, no logs can be shown!"));
+      new log("debug","logview","",array(),@mysql_error());
+    } else {
+      if (! @mysql_select_db("gomon")){
+        print_red(_("Can't select log database for log generation!"));
+        new log("debug","logview","",array(),@mysql_error());
+      } else {
+
+        /* Assemble time query */
+        switch ($logfilter['time']){
+          case '0':
+            $start= date ("YmdHis", time() - 3600);
+            break;
+            ;;
+          case '1':
+            $start= date ("YmdHis", time() - 21600);
+            break;
+            ;;
+          case '2':
+            $start= date ("YmdHis", time() - 43200);
+            break;
+            ;;
+          case '3':
+            $start= date ("YmdHis", time() - 86400);
+            break;
+            ;;
+          case '4':
+            $start= date ("YmdHis", time() - 172800);
+            break;
+            ;;
+          case '5':
+            $start= date ("YmdHis", time() - 604800);
+            break;
+            ;;
+          case '6':
+            $start= date ("YmdHis", time() - 1209600);
+            break;
+            ;;
+          case '7':
+            $start= date ("YmdHis", time() - 2419200);
+            break;
+            ;;
+        }
+
+        /* Assemble log level query */
+        if ($logfilter['log_level'] == '!All'){
+          $ll= "";
+        } else {
+          $ll= "AND log_level='".$logfilter['log_level']."'";
+        }
+        if ($logfilter['host'] == '!All'){
+          $hf= "";
+        } else {
+          $hf= "AND host='".$logfilter['host']."'";
+        }
+
+        /* Order setting */
+        if ($this->sort_direction == "down"){
+          $desc= "DESC";
+          $sort_sign = "\\/";
+        } else {
+          $desc= "";
+          $sort_sign="/\\";
+        }
+        $end= date ("YmdHis");
+        $query_base= "  FROM 
+          golog 
+          WHERE 
+          message like '".preg_replace("/\*/","%",$logfilter['regex'])."' 
+          $ll 
+          $hf 
+          AND 
+          time_stamp <= $end AND time_stamp >= $start";
+
+        /* Get number of entries */
+        $query= "SELECT COUNT(*)".$query_base.";";
+        $result = @mysql_query($query);
+        if(!$result){
+          new log("debug","logview","",array(),@mysql_error());
+        }
+        $line= mysql_fetch_array($result, MYSQL_ASSOC);
+        $count= $line['COUNT(*)'];
+        if ($count > 25){
+          $smarty->assign("range_selector", range_selector($count, $this->start, $this->range,"EntriesPerPage"));
+        } else {
+          $smarty->assign("range_selector", "");
+        }
+
+        /* Query results */
+        $query= "SELECT *".$query_base." ORDER BY ".$this->fields[$this->sort]." $desc LIMIT ".$this->start.",".$this->range.";";
+        @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__, $query, "Database query");
+        $result = @mysql_query($query);
+        if(!$result){
+          new log("debug","logview","",array(),@mysql_error());
+        }
+        /* Display results */
+        $mod= 0;
+
+        /* Add entries to result str */
+        while ($line = mysql_fetch_array($result, MYSQL_ASSOC)){
+
+          /* Toggle background color */
+          if ( ($mod++) & 1){
+            $col= "background-color: #ECECEC;";
+          } else {
+            $col= "background-color: #F5F5F5;";
+          }
+
+          $res.=" <tr style=\"$col\">\n";
+          $res.="   <td style=\"text-align:center\">
+            <img alt=\"".$line['log_level']."\" 
+            src=\"".get_template_path('images/log_'.strtolower($line['log_level'])).".png\" 
+            title=\"Log level is '".$line['log_level']."'\">
+            </td>";
+          $res.="   <td>".
+            $line['host']."
+            </td>"; 
+            $res.=" <td>".
+            $line['time_stamp']."
+            </td>";
+          $res .= "<td width=\"100%\">".
+            $line['message']."
+            </td>";
+          $res.=" </tr>\n";
+        }
+        mysql_close($link);
+        $smarty->assign("mode".$this->sort, $sort_sign);
+        $smarty->assign("host", $logfilter['host']);
+        $smarty->assign("log_level", $logfilter['log_level']);
+
+        $smarty->assign("search_result", $res);
+      }
+    }
+
+    /* Show main page */
+    return ($smarty->fetch (get_template_path('contents.tpl', TRUE)));
+  }
+
+
+  function save_object()
+  {
+    /* Get submitted range */  
+    if(isset($_POST['EntriesPerPage'])){
+      if(is_numeric($_POST['EntriesPerPage'])){
+        $this->range = $_POST['EntriesPerPage'];
+      }
+    }
+
+    /* Save data */
+    $logfilter= get_global("logfilter");
+
+    /* Get actual select boxe values */
+    $logfilter_changed = 0;
+    foreach( array("host", "time", "log_level", "regex") as $type){
+    
+      /* Set new value and test if value has changed */
+      $last[$type] = $logfilter[$type];
+      if (isset($_POST[$type])){
+        $logfilter[$type]= $_POST[$type];
+      }
+  
+      if ($last[$type] != $logfilter[$type]){
+        $logfilter_changed = 1;
+      }
+    }
+
+    /* Filter regex values */
+    if ($logfilter['regex'] == ""){
+      $logfilter['regex']= '%';
+    } else {
+      $new = preg_replace('/\*\**/', '*', $logfilter['regex']);
+      $logfilter['regex']= $new;
+    }
+
+    /* Store filter values */
+    register_global("logfilter", $logfilter);
+
+    /* Set start value */
+    if (isset($_GET['start'])){
+      $this->start= (int)$_GET['start'];
+    }
+  
+    /* Reset page number if filter has changed */
+    if ($logfilter_changed > 0){
+      $this->start= 0;
+    }
+
+    /* Adapt sorting */
+    if (isset($_GET['sort'])){
+      if ($this->sort == (int)$_GET['sort']){
+        if ($this->sort_direction == "down"){
+          $this->sort_direction= "up";
+        } else {
+          $this->sort_direction= "down";
+        }
+      }
+      $this->sort= (int)$_GET['sort'];
+      if ($this->sort < 0 || $this->sort > 3){
+        $this->sort= 0;
+      }
+    }
+  }
+
+
+  /* Return plugin informations for acl handling
+     #FIXME You can only read attributes within this report plugin */
+  static function plInfo()
+  {
+    return (array(
+        "plShortName"   => _("Log view"),
+        "plDescription" => _("Log view addon"),
+        "plSelfModify"  => FALSE,
+        "plDepends"     => array(),
+        "plPriority"    => 0,
+        "plSection"     => array("addon"),
+        "plCategory"    => array("logview" => array("objectClass" => "none", "description" => _("System logs"))),
+
+        "plProvidedAcls" => array()
+        ));
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/addons/logview/contents.tpl b/gosa-core/plugins/addons/logview/contents.tpl
new file mode 100644 (file)
index 0000000..9a03544
--- /dev/null
@@ -0,0 +1,105 @@
+<div class="contentboxh">
+ <p class="contentboxh"><img src="{$launchimage}" align="right" alt="[F]">{t}Filter{/t}</p>
+</div>
+<div class="contentboxb">
+
+ <table summary="" width="100%" class="contentboxb" style="border-top:1px solid #B0B0B0; padding:0px;">
+  <tr>
+   <td width="33%">
+    <table summary="">
+     <tr>
+      <td><img class="center" alt="" align="middle" border=0 src="{$server_image}">&nbsp;<LABEL FOR="host">{t}Show hosts{/t}</LABEL></td>
+      <td>
+       <select id="host" name="host" size=1 onChange="mainform.submit()">
+                      {html_options options=$hostlist selected=$host}
+                          <option disabled>&nbsp; </option>
+       </select>
+      </td>
+     </tr>
+     <tr>
+      <td><img class="center" alt="" align="middle" border=0 src="{$log_image}">&nbsp;<LABEL for="log_level">{t}Log level{/t}</label></td>
+      <td>
+       <select id="log_level" name="log_level" size=1 onChange="mainform.submit()">
+               {html_options options=$loglevellist selected=$log_level}
+            <option disabled>&nbsp;</option>
+       </select>
+      </td>
+     </tr>
+    </table>
+   </td>
+   
+   <td style="border-left:1px solid #A0A0A0">
+    &nbsp;
+   </td>
+   
+   <td width="33%">
+    <table summary="">
+     <tr>
+      <td><img class="center" alt="" align="middle" border=0 src="{$time_image}">&nbsp;<LABEL for="time" >{t}Time interval{/t}</LABEL></td>
+      <td>
+       <select id="time" name="time" size=1 onChange="mainform.submit()">
+               {html_options options=$tilist selected=$time}
+            <option disabled>&nbsp;</option>
+       </select>
+      </td>
+     </tr>
+     <tr>
+      <td><img class="center" alt="" align="middle" border=0 src="{$search_image}">&nbsp;<LABEL for="regex">{t}Search for{/t}</LABEL></td>
+      <td><input id="regex" name="regex" size=25 maxlength=60 value="{$regex}" title="{t}Enter string to search for{/t}"></td>
+     </tr>
+    </table>
+   </td>
+
+   <td style="border-left:1px solid #A0A0A0">
+    &nbsp;
+   </td>
+   <td>
+    <table summary="" width="100%">
+  <!-- 
+     <tr>
+      <td><img class="center" alt="" align="middle" border=0 src="{$ruleset_image}">&nbsp;<LABEL for="edit_rules">{t}Ruleset{/t}</LABEL></td>
+      <td width="100%">
+       <input id="edit_rules" name="edit_rules" type="submit" value="{t}Edit{/t}" disabled>
+      </td>
+     </tr>
+-->
+     <tr>
+      <td colspan=2 style="text-align:right;">
+       <input name="search" type="submit" value="{t}Search{/t}">
+      </td>
+     </tr>
+    </table>
+   </td>
+  </tr>
+ </table>
+</div>
+
+<br>
+
+{if $search_result ne ""}
+ <table summary="" style="width:100%; vertical-align:top; text-align:left; border:1px solid #B0B0B0;" cellpadding=2 cellspacing=1 rules="cols">
+  <tr style="background-color: #E8E8E8; height:26px; font-weight:bold">
+   <td><a href=main.php{$plug}&amp;sort=0>{t}Level{/t} {$mode0}</a></td>
+   <td><a href=main.php{$plug}&amp;sort=1>{t}Hostname{/t} {$mode1}</a></td>
+   <td width=15%><a href=main.php{$plug}&amp;sort=2>{t}Date{/t} {$mode2}</a></td>
+   <td><a href=main.php{$plug}&amp;sort=3>{t}Message{/t} {$mode3}</a></td>
+  </tr>
+  {$search_result}
+ </table>
+
+ <table summary="" style="width:100%; vertical-align:top; text-align:center;" cellpadding=4 cellspacing=0 border=0>
+  <tr>
+   <td>{$range_selector}</td>
+  </tr>
+ </table>
+
+{else}
+  <b>{t}Search returned no results...{/t}</b>
+{/if}
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('search_for');
+  -->
+</script>
diff --git a/gosa-core/plugins/addons/logview/gosa_log_contents.tpl b/gosa-core/plugins/addons/logview/gosa_log_contents.tpl
new file mode 100644 (file)
index 0000000..5d71d81
--- /dev/null
@@ -0,0 +1,107 @@
+<div class="contentboxh">
+ <p class="contentboxh"><img src="{$launchimage}" align="right" alt="[F]">{t}Filter{/t}</p>
+</div>
+<div class="contentboxb">
+
+ <table summary="" width="100%" class="contentboxb" style="border-top:1px solid #B0B0B0; padding:0px;" border=0>
+  <tr>
+   <td width="33%">
+    <table summary="">
+     <tr>
+      <td><img class="center" alt="" align="middle" border=0 src="{$server_image}">&nbsp;<LABEL FOR="server">{t}Show hosts{/t}</LABEL></td>
+      <td>
+       <select id="server" name="server" size=1 onChange="mainform.submit()">
+                      {html_options options=$servers selected=$server}
+                          <option disabled>&nbsp; </option>
+       </select>
+      </td>
+     </tr>
+     <tr>
+      <td><img class="center" alt="" align="middle" border=0 src="{$log_image}">&nbsp;<LABEL for="action">{t}Action{/t}</label></td>
+      <td>
+       <select id="action" name="action" size=1 onChange="mainform.submit()">
+               {html_options options=$actions selected=$action}
+            <option disabled>&nbsp;</option>
+       </select>
+      </td>
+     </tr>
+    </table>
+   </td>
+   
+   <td style="border-left:1px solid #A0A0A0">
+    &nbsp;
+   </td>
+   
+   <td width="33%">
+    <table summary="">
+     <tr>
+      <td><img class="center" alt="" align="middle" border=0 src="{$time_image}">&nbsp;<LABEL for="time" >{t}Time interval{/t}</LABEL></td>
+      <td>
+       <select id="time" name="time" size=1 onChange="mainform.submit()">
+               {html_options options=$date_select selected=$time}
+            <option disabled>&nbsp;</option>
+       </select>
+      </td>
+     </tr>
+     <tr>
+      <td><img class="center" alt="" align="middle" border=0 src="{$search_image}">&nbsp;<LABEL for="regex">{t}Search for{/t}</LABEL></td>
+      <td><input id="regex" name="regex" size=25 maxlength=60 value="{$regex}" title="{t}Enter string to search for{/t}"></td>
+     </tr>
+    </table>
+   </td>
+
+   <td style="border-left:1px solid #A0A0A0">
+    &nbsp;
+   </td>
+   <td>
+    <table summary="" width="100%">
+  <!-- 
+     <tr>
+      <td><img class="center" alt="" align="middle" border=0 src="{$ruleset_image}">&nbsp;<LABEL for="edit_rules">{t}Ruleset{/t}</LABEL></td>
+      <td width="100%">
+       <input id="edit_rules" name="edit_rules" type="submit" value="{t}Edit{/t}" disabled>
+      </td>
+     </tr>
+-->
+     <tr>
+      <td colspan=2 style="text-align:right;">
+       <input name="search" type="submit" value="{t}Search{/t}">
+      </td>
+     </tr>
+    </table>
+   </td>
+  </tr>
+ </table>
+</div>
+
+<br>
+
+{if $search_result ne ""}
+ <table style="width:100%;background-color: #B0B0B0;" cellspacing=1 cellpadding=2>
+  <tr style="background-color: #E8E8E8; height:26px; font-weight:bold">
+   <td><a href="main.php{$plug}&amp;sort=0&amp;direction={$direction}">{t}Action{/t} {$mode0}</a></td>
+   <td><a href="main.php{$plug}&amp;sort=1&amp;direction={$direction}">{t}Date{/t} {$mode1}</a></td>
+   <td><a href="main.php{$plug}&amp;sort=2&amp;direction={$direction}">{t}User{/t} {$mode2}</a></td>
+   <td><a href="main.php{$plug}&amp;sort=3&amp;direction={$direction}">{t}Object type{/t} {$mode3}</a></td>
+   <td><a href="main.php{$plug}&amp;sort=4&amp;direction={$direction}">{t}Object{/t} {$mode4}</a></td>
+   <td><a href="main.php{$plug}&amp;sort=5&amp;direction={$direction}">{t}Message{/t} {$mode5}</a></td>
+  </tr>
+  {$search_result}
+ </table>
+
+ <table summary="" style="width:100%; vertical-align:top; text-align:center;" cellpadding=4 cellspacing=0 border=0>
+  <tr>
+   <td>{$range_selector}</td>
+  </tr>
+ </table>
+
+{else}
+  <b>{t}Search returned no results...{/t}</b>
+{/if}
+<input type='hidden' name='gosa_log_contents_posted' value='1'>
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+  focus_field('regex');
+  -->
+</script>
diff --git a/gosa-core/plugins/addons/logview/main.inc b/gosa-core/plugins/addons/logview/main.inc
new file mode 100644 (file)
index 0000000..9ecb316
--- /dev/null
@@ -0,0 +1,39 @@
+<?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
+*/
+if (!$remove_lock){
+
+       /* Create logview object on demand */
+       if (!isset($_SESSION['log_tabs']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+               $_SESSION['log_tabs']= new log_tabs($config, $config->data['TABS']['LOGTABS'],"");
+       }
+       $log_tabs= $_SESSION['log_tabs'];
+
+       /* Execute formular */
+#      $display= $log_tabs->save_object();
+       $display= $log_tabs->execute ();
+       $display.= "<input type=\"hidden\" name=\"ignore\">\n";
+
+       /* Page header*/
+       $display= print_header(get_template_path('images/logview.png'), _("System log view")).$display;
+
+       /* Store changes  in session */
+       $_SESSION['log_tabs']= $log_tabs;
+}
+?>
diff --git a/gosa-core/plugins/addons/logview/tabs_log.inc b/gosa-core/plugins/addons/logview/tabs_log.inc
new file mode 100644 (file)
index 0000000..bb855d2
--- /dev/null
@@ -0,0 +1,24 @@
+<?php
+
+class log_tabs extends tabs
+{
+
+  function log_tabs($config, $data, $dn)
+  {
+    tabs::tabs($config, $data, $dn);
+  }
+
+  function save_object($save_current= FALSE)
+  {
+    tabs::save_object($save_current);
+  }
+
+
+  function save($ignore_account= FALSE)
+  {
+  }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/addons/mailqueue/class_mailqueue.inc b/gosa-core/plugins/addons/mailqueue/class_mailqueue.inc
new file mode 100644 (file)
index 0000000..6b1e6e4
--- /dev/null
@@ -0,0 +1,418 @@
+<?php
+
+class mailqueue extends plugin
+{
+  /* Definitions */
+  var $plHeadline= "Mail queue";
+  var $plDescription= "This does something";
+
+  /* attribute list for save action */
+  var $attributes     = array();
+  var $objectclasses  = array();
+  var $mailQueueScript= "";    
+  var $Server         = "all";
+  var $Time           = 0;
+  var $Search         = "*";
+  var $Page           = 0;
+  var $Stat           = "all";
+  var $OrderBy        = "Arrival";
+  var $SortType       = "up";
+  var $disp_header    = false;
+  var $range          = 20;   
+  var $view_logged = FALSE;
+
+  function mailqueue(&$config, $dn= NULL)
+  {
+    $this->config           = &$config;
+    if (isset($this->config->current['MAILQUEUESCRIPTPATH'])){
+      $this->mailQueueScript  = $this->config->current['MAILQUEUESCRIPTPATH'];    
+    }
+
+    if(isset($this->config->data['MAIN']['MAILQUEUESCRIPTPATH'])){
+       $this->mailQueueScript  = $this->config->data['MAIN']['MAILQUEUESCRIPTPATH'];
+    }
+
+    $this->Server           = "all";
+  }
+
+
+  function pass_cmd($str)
+  {
+//    print_red($str);
+    return(shell_exec($str));
+  }
+
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* Log view */
+    if(!$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","mailqueue/".get_class($this),$this->dn);
+    }
+
+    if(isset($_POST['EntriesPerPage'])){
+      $this->range = $_POST['EntriesPerPage'];
+    }
+
+    $smarty= get_smarty();
+    $error =false;
+
+    if(empty($this->mailQueueScript)){
+      print_red(_("Please check your 'gosa.conf', there is no 'MAILQUEUESCRIPTPATH' specified."));
+      $error = true;
+    }else{
+
+      /* If we have more than one server selected (all), 
+         create a string with all servers separated by ', '
+       */ 
+      if($this->Server=="all"){
+        $se = $this->getServer();
+
+        unset($se['all']);
+        $se_str = "";
+        foreach($se as $server) {
+          $se_str .= $server." ";
+        }
+      }else{
+        /* We have only one server selected */
+        $se_str = $this->Server;
+      }
+
+      /* Check all post that will effect all entries */
+      $only_once = true;
+      foreach(array("unhold_all","hold_all","del_all","requeue_all") as $attr){
+        foreach($_POST as $name => $value){
+          if((preg_match("/".$attr."/",$name))&&($only_once)){
+            if(!$this->acl_is_readable($attr)){
+              $only_once = false;
+              print_red(sprintf(_("You do not have permission to execute the command '%s' on the mailqueue."),$attr));
+            }else{
+              $only_once = false;
+              $act = preg_replace("/_.*$/i","",$attr);
+              $r_cmd = preg_replace("/%action/" , $act           ,$this->mailQueueScript);
+              $r_cmd = preg_replace("/%server/" , $se_str         ,$r_cmd);
+              $r_cmd = preg_replace("/%id/"     , "ALL"           ,$r_cmd);
+              if($this->pass_cmd($r_cmd)==false){
+                print_red(sprintf(_("Please check your 'gosa.conf' the given '%s' can't be executed."),$r_cmd));
+              }
+            }
+          }
+        }
+      }        
+
+      /* Check single entry manipulation  posts */
+      $only_once = true;
+
+      /* act specifies the command to execute */
+      if(isset($_GET['act'])){
+        $opt = $_GET['act'];  
+  
+        /* The option to exec should be one of these */
+        if(in_array($opt,array("unhold","hold","del","requeue","query","header"))){
+          $only_once = false;
+
+          if(!$this->acl_is_readable($opt)){
+              print_red(sprintf(_("You do not have permission to execute the command '%s' on the mailqueue."),$opt));
+          }else{
+            /* Create cmd */
+            $r_cmd = preg_replace("/%action/" , $opt            ,$this->mailQueueScript);
+            $r_cmd = preg_replace("/%server/" , $this->Server   ,$r_cmd);
+            $r_cmd = preg_replace("/%id/"     , $_GET['id']     ,$r_cmd);
+
+            /* Execute cmd */
+            if(!$str = $this->pass_cmd($r_cmd)){
+              print_red(sprintf(_("Please check your 'gosa.conf' the given '%s' can't be executed."),$r_cmd));
+            }else{
+            
+              /* Special handling for option='header' */
+              if($opt == "header"){
+          
+                /* Create table which displays the header informations */
+                $this->disp_header ="\n<table width='80%'>";
+                foreach(split("\n",$str) as $line){
+                  $line = trim($line);
+                  if(empty($line)) {
+                    continue;
+                  }
+                  $this->disp_header .= "\n<tr>";
+                  $tmp0 = preg_replace("/:.*$/","",$line);
+                  $tmp1 = preg_replace("/^.*:/","",$line);
+                  $this->disp_header .= "\n<td style='background-color:#EEEEEE;'>".$tmp0."</td><td>".$tmp1."</td>"; 
+                  $this->disp_header .= "\n</tr>";
+                }              
+                $this->disp_header .= "\n</table>";
+              }
+            }
+          }
+        }
+      }        
+
+
+      /* Back is posted from the header display page */
+      if(isset($_POST['back'])){
+        $this->disp_header = false;
+      }
+
+      /* If there is a header in disp_header, then display it */
+      if($this->disp_header){
+        $smarty->assign("header",$this->disp_header);
+        return ($smarty->fetch (get_template_path('header.tpl', TRUE)));
+      }
+
+      /* tell smarty to display the search results*/
+      $smarty->assign("all_ok"      , "true");
+      
+      /* A single server is selected */
+      if($this->Server != "all"){    
+
+        /* Create Query cmd */ 
+        $q_cmd = preg_replace("/%action/" ,"query"      ,$this->mailQueueScript);
+        $q_cmd = preg_replace("/%server/" ,$this->Server,$q_cmd);
+        $q_cmd = preg_replace("/%id/"     ,"all"        ,$q_cmd);
+
+        if(!$this->acl_is_readable("query")){
+          print_red(sprintf(_("You do not have permission to execute the command '%s' on the mailqueue."),"query"));
+          $mailQueueParser = new parseMailQueue("",$this->Server);
+        }else{
+
+          /* Only display this if the query cmd is executeable */
+          if($str = @$this->pass_cmd ($q_cmd)){
+            /* Parse returned data */
+            $mailQueueParser = new parseMailQueue($str,$this->Server);
+          }else{
+            /* On error/ no return value / false return value */
+            print_red(sprintf(_("Please check your 'gosa.conf' the given '%s' can't be executed."),$q_cmd));
+            $error = true;
+          }
+        }
+      }else{
+        $mailQueueParser = NULL;
+        foreach($this->getServer() as $ServerID=>$ServerName){
+
+          /* Don't query the server named all :) */
+          if($ServerID == "all") continue;
+
+          /* Prepare query cmd */
+          $q_cmd = preg_replace("/%action/" ,"query"      ,$this->mailQueueScript);
+          $q_cmd = preg_replace("/%server/" ,$ServerName  ,$q_cmd);
+          $q_cmd = preg_replace("/%id/"     ,"ALL"           ,$q_cmd);
+
+          
+          if(!$this->acl_is_readable("query")){
+            print_red(sprintf(_("You do not have permission to execute the command '%s' on the mailqueue."),"query"));
+            $mailQueueParser = new parseMailQueue("",$this->Server);
+          }else{
+
+            /* Shell exec this cmd */
+            if($str = @$this->pass_cmd ($q_cmd)){
+
+              /* If there is no parser available, create one  */
+              if($mailQueueParser === NULL){
+                $mailQueueParser = new parseMailQueue($str,$ServerID);
+              }else{
+                $mailQueueParser->parseAdditionalQueue($str,$ServerID);
+              }
+              /* On error/ no return value / false return value */
+            }else{
+              print_red(sprintf(_("Please check your 'gosa.conf' the given '%s' can't be executed."),$q_cmd));
+              $error = true;
+            }
+          }
+        }
+      }     
+
+      /* Check for existing servers 
+          objectClass=goMailServer is required at least for one server. 
+         Else display error   */
+      $server = $this->getServer();
+      if((count($server) == 1 ) && (isset($server['all']))){
+        print_red(_("There are no mail server specified."));
+        $error = true;
+      }
+
+      if(!$error){
+
+        /* Filter data with the given */
+        $mailQueueParser->OrderBy($this->OrderBy,$this->SortType);
+        $mailQueueParser->OnlyDaysAgo($this->Time);
+        $mailQueueParser->CreateDate();
+     
+        if($this->Stat == "hold"){
+          $mailQueueParser->Search(true,array("Hold"),true);
+        }
+        if($this->Stat == "unhold"){
+          $mailQueueParser->Search(false,array("Hold"),true);
+        }
+        if($this->Stat == "active"){
+          $mailQueueParser->Search(true,array("Active"),true);
+        }
+        if($this->Stat == "nonactive"){
+          $mailQueueParser->Search(false,array("Active"),true);
+        }
+
+        $mailQueueParser->Search($this->Search,array("MailID","Size","Sender","Recipient","Error","Arrival"));
+
+        /* */
+        $entries = $mailQueueParser->GetAll();
+  
+        if(count($entries) ==0 ){
+          $smarty->assign("all_ok",false);
+        }
+        $smarty->assign("entries"       , array_slice($entries,$this->Page,$this->range));
+        $smarty->assign("plug"          , "?plug=".$_GET['plug']);
+        $smarty->assign("r_stats"       , $this->getStats());
+        $smarty->assign("stats"         , array_flip($this->getStats()));
+        $smarty->assign("stat"          , $this->Stat);
+        $smarty->assign("p_server"      , $this->Server);
+        $smarty->assign("p_servers"     , $this->getServer());
+        $smarty->assign("p_serverKeys"  , array_flip($this->getServer()));
+        $smarty->assign("p_time"        , $this->Time);
+        $smarty->assign("p_times"       , $this->getTimes());
+        $smarty->assign("p_timeKeys"    , array_flip($this->getTimes()));
+        $smarty->assign("search_for"    , $this->Search);
+        $smarty->assign("range_selector", range_selector(count($entries), $this->Page, $this->range,"EntriesPerPage")); 
+        $smarty->assign("OrderBy"       , $this->OrderBy);
+
+        /* Display sort arrow */
+        if($this->SortType == "up"){
+          $smarty->assign("SortType","<img src='images/sort_up.png' alt='"._("up")."' border='0'>");
+        }else{
+          $smarty->assign("SortType","<img src='images/sort_down.png' alt='"._("down")."' border='0'>");
+        }
+      }
+    }
+
+    /* In case of an error */
+    if($error){  
+      $smarty->assign("all_ok"        , "false");
+      $smarty->assign("r_stats"       , $this->getStats());
+      $smarty->assign("stats"         , array_flip($this->getStats()));
+      $smarty->assign("stat"          , $this->Stat);
+      $smarty->assign("plug"          , "?plug=".$_GET['plug']);
+      $smarty->assign("p_server"      , $this->Server);
+      $smarty->assign("p_servers"     , $this->getServer());
+      $smarty->assign("p_serverKeys"  , array_flip($this->getServer()));
+      $smarty->assign("p_time"        , $this->Time);
+      $smarty->assign("p_times"       , $this->getTimes());
+      $smarty->assign("p_timeKeys"    , array_flip($this->getTimes()));
+      $smarty->assign("search_for"    , $this->Search);
+      $smarty->assign("OrderBy"       , $this->OrderBy);
+    }
+    return ($smarty->fetch (get_template_path('contents.tpl', TRUE)));
+  }
+
+
+  /* return selectable server */
+  function getServer()
+  {
+    $ret= array("all"=>_("All"));
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);    
+    $ldap->search("(objectClass=goMailServer)",array("cn"));
+    while($tmp = $ldap->fetch()){
+      $ret[$tmp['cn'][0]]= $tmp['cn'][0];
+    }
+    return($ret);
+  }
+
+
+  /* Return selectable times*/
+  function getTimes()
+  {
+    $ret = array();
+    $ret['nolimit']=_("no limit"); 
+    foreach(array(1,2,4,8,12,24,36,48) as $i){
+      if($i == 1){
+        $ret[$i] = $i."&nbsp;"._("hour");
+      }else{
+        $ret[$i] = $i."&nbsp;"._("hours");
+      }
+    }
+    return($ret);
+  }
+
+
+  /* Save post values*/
+  function save_object($save_current= FALSE)
+  {
+    if(isset($_POST['p_server'])){
+      $this->Server = $_POST['p_server'];
+    }
+    if(isset($_POST['p_time'])){
+      $this->Time = $_POST['p_time'];
+    }
+    if(isset($_POST['search_for'])){
+      $this->Search = $_POST['search_for'];
+    }
+    if(isset($_POST['Stat'])){
+      $this->Stat = $_POST['Stat'];
+    }
+    if((isset($_GET['start']))&&(is_numeric($_GET['start']))&&($_GET['start']>=0)){
+      $this->Page = $_GET['start'];
+    }
+
+    if((isset($_GET['sort']))&&(!empty($_GET['sort']))){
+      $old = $this->OrderBy;
+      $this->OrderBy = $_GET['sort'];
+      if($this->OrderBy == $old)
+      {
+        if($this->SortType== "up"){
+          $this->SortType = "down";
+        }else{
+          $this->SortType = "up";
+        }
+      }
+    }
+
+  }
+
+  /* Return stats */
+  function getStats()
+  {
+    return(array(
+          "all"     =>_("All"),
+          "hold"    =>_("Hold"),
+          "unhold"  =>_("Un hold"),
+          "active"  =>_("Active"),
+          "nonactive"  =>_("Not active")
+          ));
+  }
+
+  /* Return plugin informations for acl handling
+     #FIXME You can only read attributes within this report plugin */
+  static function plInfo()
+  {
+    return (array(
+        "plShortName"   => _("Mailqueue"),
+        "plDescription" => _("Mailqueue addon"),
+        "plSelfModify"  => FALSE,
+        "plDepends"     => array(),
+        "plPriority"    => 1,
+        "plSection"     => array("addon"),
+        "plCategory"    => array("mailqueue" => array("objectClass" => "none", "description" => _("Mail queue addon"))),
+
+        "plProvidedAcls" => array(
+            "unhold_all"      => _("Unhold all messages"),
+            "hold_all"        => _("Hold all messages"),
+            "del_all"         => _("Delete all messages"),
+            "requeue_all"     => _("Requeue all messages"),
+            "unhold"          => _("Unhold message"),
+            "hold"            => _("Hold message"),
+            "del"             => _("Delete message"),
+            "requeue"         => _("Requeue message"),
+            "query"           => _("Gathering queue data"),
+            "header"          => _("Get header information")
+          )
+        ));
+  }
+
+
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/addons/mailqueue/class_parseMailQueue.inc b/gosa-core/plugins/addons/mailqueue/class_parseMailQueue.inc
new file mode 100644 (file)
index 0000000..b510cb3
--- /dev/null
@@ -0,0 +1,237 @@
+<?php
+
+class parseMailQueue
+{
+       var $s_dataToParse;
+       var $a_parsedData;
+  var $i_count;        
+
+  /* Contructor
+   * $s_data specifies the data that shuold be parse
+   */
+       function parseMailQueue($s_data,$server)
+       {
+    $this->s_dataToParse = $s_data;            
+         $this->a_parsedData = array();
+    $this->_parse($s_data,$server);
+  }
+
+
+  /* Remove all entries which are older than the last x hours
+   */
+  function OnlyDaysAgo($str)
+  {
+    /* Get current time */
+    $cur = time();
+  
+    /* Only perform this filter, if the given parameter is valid */
+    if((is_numeric($str))&&($str != 0)){
+
+      /* hours are given as parameter */
+      $cur = $cur - ($str*(60*60));
+
+      /* Remove old entries */
+      foreach($this->a_parsedData as $key => $data){
+        if($data['Arrival'] < $cur){
+          unset($this->a_parsedData[$key]);
+        }
+      }
+    }
+  }
+
+
+  /* Only keep entries that contains the $filter
+   * in any of the given $fields
+   */
+  function Search($filter,$fields,$bool = false)
+  {
+    /* Go through all entries */
+    foreach($this->a_parsedData as $key => $data){
+
+      /* not found yet */
+      $found = false;
+
+      foreach($fields as $attr){
+        if(($bool)&&($data[$attr]==$filter)){
+          $found = true;
+        }elseif(preg_match("/".str_replace("*",".*",$filter)."/i",$data[$attr])){
+          $found= true;
+        }
+      }
+  
+      /* if nothing found, delete this entry */
+      if($found == false){
+        unset($this->a_parsedData[$key]);
+      }
+    }
+  }
+
+  /* Convert date from timestamp to human readable */
+  function CreateDate()
+  {
+    foreach($this->a_parsedData as $key => $data){
+      $this->a_parsedData[$key]['Arrival'] = date("d.m.Y H:i:s",$data['Arrival']);
+    }
+  }
+
+  /* Order by specified field */
+  function OrderBy($str = "Arrival",$type = "up" )
+  {
+    $tmp = array();
+    /* If the given field is not valid */
+    if(!in_array($str,array("MailID","Size","Sender","Recipient","Arrival","Error","Server"))){
+      return(false);
+    }
+
+    /* Size need special handling, cause it contains numbers 
+     */
+    if($str == "Size"){
+      foreach($this->a_parsedData as $data){
+        $struse = "";
+        for($i = strlen($data['Size']); $i < 10 ; $i++  ){
+          $struse .="0";
+        }
+        $struse .= $data[$str].$data['MailID'].$data['Server'];
+        $tmp[$struse]= $data;
+      }
+    }else{
+      foreach($this->a_parsedData as $data){
+        $tmp[strtolower($data[$str]).$data['MailID']."-".$data['Server']]= $data;
+      }
+    } 
+    ksort($tmp);
+    if($type != "up"){
+      $tmp = array_reverse($tmp);
+    }
+    $this->a_parsedData = array();
+    foreach($tmp as $data){
+      $this->a_parsedData[$data['MailID']."-".$data['Server']] = $data;
+    }
+    return(true);
+  }
+  
+  function GetAll()
+  {
+    return($this->a_parsedData);
+  }
+
+  /* Checks if the given MailID exists */
+  function IDExists($id)
+  {
+    foreach($this->a_parsedData as $entry){
+      if($entry['MailID'] == $id) return(true);
+    }
+    return(false);
+  }
+
+  function parseAdditionalQueue($str, $server)
+  {
+    $this->_parse($str, $server);
+  }
+
+  /* This function parses the given data 
+   * it creates an array with all given queue entries
+   */
+  function _parse($str, $server)
+  {
+    $i              =  0;       // Temp var 
+    $entries        = array();  // Contains an array with the raw data for every single entry
+    $s_tmp          = "";       // Buffer
+
+    $s_mailID       = "";       // Queue ID 
+    $s_Size         = "";       // Mail size 
+    $s_Arrival      = "";       // Arrival time
+    $s_Sender       = "";       // Sender
+    $s_Recipient    = "";       // Recipient 
+    $s_Error        = "";       // Occured error
+
+    /* Remove header
+     */
+    $this->s_dataToParse = preg_replace("/^.*------\n/","",$str);
+
+    /* Create array with single entries
+     */
+    $entries = split("\n\n",$this->s_dataToParse);
+  
+    /* The last entry in this array is not realy an valid entry, its some kind of status.
+     * It would be something like this : -- 795 Kbytes in 124 Requests.
+     */
+    $this->i_count = (count($entries))-1;
+  
+    for($i = 0 ; $i < $this->i_count; $i ++ ){
+    
+      while(strstr($entries[$i],"  ")){
+        $entries[$i] = str_replace("  "," ",$entries[$i]);  
+      } 
+    
+      $s_buffer = split("\n",preg_replace("/[\\n\\r\\t]/s","\n",$entries[$i]));
+        
+      /* Get mailID */
+      $tmp = split(" ",$s_buffer[0]);
+
+      /* Get values */
+      $s_mailID   = $tmp[0];
+      $s_Size     = $tmp[1];
+      $s_Sender   = $tmp[6];
+
+      /* Parse time */
+      $tmp3 = split(":",$tmp[5]);
+      $tmp2 = strtotime($tmp[4]." ".$tmp[3]." ".date("Y"));
+      $s_Arrival= mktime($tmp3[0],$tmp3[1],$tmp3[2],date("d",$tmp2),date("m",$tmp2),date("Y",$tmp2));
+
+      $s_Error      = $s_buffer[1];
+      $s_Recipient  = $s_buffer[2];
+
+      /*
+              *      The message is in the active queue, i.e. the  message  is
+                     selected for delivery.
+
+              !      The  message is in the hold queue, i.e. no further deliv-delivery
+                     ery attempt will be made until  the  mail  is  taken  off
+                     hold.
+      */
+
+      $s_Hold = false;
+      if(preg_match("/\!/",$s_mailID)){
+        $s_mailID = preg_replace("/\!/","",$s_mailID);
+        $s_Hold = "true";
+      }
+      
+      $s_Active = false;
+      if(preg_match("/\*/",$s_mailID)){
+        $s_mailID = preg_replace("/\*/","",$s_mailID);
+        $s_Active = true;
+      }
+
+      /* Append data */
+      $this->a_parsedData[$s_mailID."-".$server]['Server']     = $server; 
+      $this->a_parsedData[$s_mailID."-".$server]['MailID']     = $s_mailID; 
+      $this->a_parsedData[$s_mailID."-".$server]['Size']       = $s_Size; 
+      $this->a_parsedData[$s_mailID."-".$server]['Arrival']    = $s_Arrival; 
+      $this->a_parsedData[$s_mailID."-".$server]['Sender']     = $s_Sender; 
+      $this->a_parsedData[$s_mailID."-".$server]['Recipient']  = $s_Recipient; 
+      $this->a_parsedData[$s_mailID."-".$server]['Hold']       = $s_Hold; 
+      $this->a_parsedData[$s_mailID."-".$server]['Active']     = $s_Active; 
+      $this->a_parsedData[$s_mailID."-".$server]['Error']      = $this->_parseError($s_Error); 
+    }
+    return($this->a_parsedData);
+  }
+
+  /* Parse Error part of the entry */
+  function _parseError($str)
+  {
+    $str   = trim(preg_replace("/[()]/","",$str));
+    $tmp2 = split(":",$str);
+    $tmp = array_reverse($tmp2);
+    $err  = preg_replace("/#.*$/","",$tmp[0]);
+    $text = preg_replace("/said$/i","",trim($tmp2[0])); 
+    return($err);
+  }
+
+}
+
+
+
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/addons/mailqueue/contents.tpl b/gosa-core/plugins/addons/mailqueue/contents.tpl
new file mode 100644 (file)
index 0000000..139bcd4
--- /dev/null
@@ -0,0 +1,130 @@
+<div style="height: 5px;">&nbsp;</div>
+<div class="contentboxh">
+ <p class="contentboxh"><img src="images/launch.png" alt="[F]" align="right">Filter</p>
+</div>
+<div class="contentboxb">
+  <div >
+       <table width="100%" summary="">
+               <tr>
+                       <td>
+       <img class="center" alt="{t}Search{/t}" src="images/search.png" align="middle" border="0">
+        &nbsp;{t}Search for{/t}
+    <input name="search_for" size="12" maxlength="60" value="{$search_for}" title="{t}Please enter a search string here.{/t}" onchange="mainform.submit()">
+        &nbsp;in 
+       <select size="1" name="p_server" title="{t}Select a server{/t}" onchange="mainform.submit()">
+        {html_options values=$p_serverKeys output=$p_servers selected=$p_server}
+       </select>
+       {t}with status{/t} : 
+       <select size="1" name="Stat" onchange="mainform.submit()">
+        {html_options values=$stats output=$r_stats selected=$stat}
+       </select>
+        &nbsp;{t}within the last{/t}&nbsp;
+       <select size="1" name="p_time" onchange="mainform.submit()">
+        {html_options values=$p_timeKeys output=$p_times selected=$p_time}
+       </select>
+        &nbsp;
+       <input name="search" value="{t}Search{/t}" type="submit">
+                       </td>
+                       <td style="border-left:1px solid #A0A0A0; text-align:right;">&nbsp;
+                               <input name="del_all"  src="images/edittrash.png"                       value="{t}Remove all messages{/t}"              type="image" 
+                                       title="{t}Remove all messages from selected servers queue{/t}">
+                               <input name="hold_all"    src="images/mailq_hold.png"                   value="{t}Hold all messages{/t}"                type="image"
+                                       title="{t}Hold all messages in selected servers queue{/t}">
+                               <input name="unhold_all"    src="images/mailq_unhold.png"               value="{t}Release all messages{/t}"     type="image"
+                                       title="{t}Release all messages in selected servers queue{/t}">
+                               <input name="requeue_all" src="images/mailq_requeue.png"                value="{t}Requeue all messages{/t}"     type="image"
+                                       title="{t}Requeue all messages in selected servers queue{/t}">
+                       </td>
+               </tr>
+       </table>
+       </div>
+</div>
+<br>
+
+
+{if $all_ok != "true"}
+<b>{t}Search returned no results{/t}...</b>
+{else}
+
+<table style="border: 1px solid rgb(176, 176, 176); width: 100%; vertical-align: top; text-align: left;" summary=""
+ border="0" cellpadding="2" cellspacing="1" rules="cols">
+       <tr style="background-color: rgb(232, 232, 232); height: 26px; font-weight: bold;">
+               <td><a href="{$plug}&amp;sort=MailID"           >{t}ID{/t}                      {if $OrderBy == "MailID"}       {$SortType}{/if}</a></td>
+               <td><a href="{$plug}&amp;sort=Server"           >{t}Server{/t}          {if $OrderBy == "Server"}       {$SortType}{/if}</a></td>
+               <td><a href="{$plug}&amp;sort=Size"                     >{t}Size{/t}            {if $OrderBy == "Size"}         {$SortType}{/if}</a></td>
+               <td><a href="{$plug}&amp;sort=Arrival"          >{t}Arrival{/t}         {if $OrderBy == "Arrival"}      {$SortType}{/if}</a></td>
+               <td><a href="{$plug}&amp;sort=Sender"           >{t}Sender{/t}          {if $OrderBy == "Sender"}       {$SortType}{/if}</a></td>
+               <td><a href="{$plug}&amp;sort=Recipient"        >{t}Recipient{/t}       {if $OrderBy == "Recipient"}{$SortType}{/if}</a></td>
+               <td><a href="{$plug}&amp;sort=Error"            >{t}Error{/t}           {if $OrderBy == "Error"}        {$SortType}{/if}</a></td>
+               <td>&nbsp;</td>
+       </tr>
+
+{counter start=0 assign=i start=1}
+{foreach from=$entries item=val key=key}
+                       
+       {if ($i%2)== 0 }
+               <tr style="height: 22px; background-color: rgb(236, 236, 236);">
+       {else}
+               <tr style="height: 22px; background-color: rgb(245, 245, 245);">
+       {/if}
+               <td >
+<!-- onlick="javascript:       document.mainform.header_server.value='{$entries[$key].Server}';
+                                                               document.mainform.header_id.value='{$entries[$key].MailID}';
+                                                               document.mainform.submit();"
+-->
+                       {if $entries[$key].Active == true}
+                               <img class="center" src="images/mailq_active.png" border=0 alt="{t}Active{/t}">
+                       {/if}
+                       
+                       {$entries[$key].MailID}</td>
+               <td> 
+<!-- onclick="javascript: document.location.href='{$plug}&amp;act=header&amp;id={$entries[$key].MailID}&amp;server={$entries[$key].Server}'"-->
+                       {$entries[$key].Server}</td>
+               <td>
+                       {$entries[$key].Size}</td>
+               <td>
+                       {$entries[$key].Arrival}</td>
+               <td>
+                       {$entries[$key].Sender}</td>
+               <td>
+                       {$entries[$key].Recipient}</td>
+               <td >{$entries[$key].Error}</td>
+               <td style="text-align:right">
+                       <a href="{$plug}&amp;act=del&amp;id={$entries[$key].MailID}&amp;server={$entries[$key].Server}">
+                               <img class="center" src="images/edittrash.png" border=0 alt="{t}delete{/t}" title="{t}Delete this message{/t}">
+                       </a>
+               {if $entries[$key].Hold == true}
+                       <a href="{$plug}&amp;act=unhold&amp;id={$entries[$key].MailID}&amp;server={$entries[$key].Server}">
+                               <img class="center" src="images/mailq_unhold.png" border=0 alt="{t}unhold{/t}" title="{t}Release message{/t}">
+                       </a>
+               {else}
+                       <a href="{$plug}&amp;act=hold&amp;id={$entries[$key].MailID}&amp;server={$entries[$key].Server}">
+                               <img class="center" src="images/mailq_hold.png" border=0 alt="{t}hold{/t}" title="{t}Hold message{/t}">
+                       </a>
+               {/if}
+                       <a href="{$plug}&amp;act=requeue&amp;id={$entries[$key].MailID}&amp;server={$entries[$key].Server}">
+                               <img class="center" src="images/mailq_requeue.png" border=0 alt="{t}requeue{/t}" title="{t}Requeue this message{/t}">
+                       </a>
+                       <a href="{$plug}&amp;act=header&amp;id={$entries[$key].MailID}&amp;server={$entries[$key].Server}">
+                               <img class="center" src="images/mailq_header.png" border=0 alt="{t}header{/t}" title="{t}Display header from this message{/t}">
+                       </a>
+               </td>
+       </tr>
+       {counter}
+{/foreach}
+</table>
+
+ <table summary="" style="width:100%; vertical-align:top; text-align:center;" cellpadding=4 cellspacing=0 border=0>
+  <tr>
+   <td>{$range_selector}</td>
+  </tr>
+ </table>
+<p class="plugbottom">&nbsp;</p>
+
+{/if}
+
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('search_for');
+  -->
+</script>
diff --git a/gosa-core/plugins/addons/mailqueue/header.tpl b/gosa-core/plugins/addons/mailqueue/header.tpl
new file mode 100644 (file)
index 0000000..eeb8bcf
--- /dev/null
@@ -0,0 +1,6 @@
+{$header}
+
+<p class="seperator">&nbsp;</p>
+<div style='text-align:right;'>
+       <input type="submit" name="back" value="{t}Back{/t}"> 
+</div>
diff --git a/gosa-core/plugins/addons/mailqueue/main.inc b/gosa-core/plugins/addons/mailqueue/main.inc
new file mode 100644 (file)
index 0000000..09bbe56
--- /dev/null
@@ -0,0 +1,47 @@
+<?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
+*/
+
+if (!$remove_lock){
+       /* Create mailqueue object on demand */
+       if (!isset($_SESSION['mailqueue']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+               $ui = get_userinfo();
+               $_SESSION['mailqueue']= new mailqueue ($config);
+               $_SESSION['mailqueue']->set_acl_category("mailqueue");
+               
+               /* Check root dn and user dn for acl informations */
+               $_SESSION['mailqueue']->set_acl_base($config->current['BASE']);
+               if($_SESSION['mailqueue']->getacl("") == ""){
+                       $_SESSION['mailqueue']->set_acl_base($ui->dn);
+               }
+       }
+       $mailqueue= $_SESSION['mailqueue'];
+
+       /* Execute formular */
+       $mailqueue->save_object();
+       $display= $mailqueue->execute ();
+       $display.= "<input type=\"hidden\" name=\"ignore\">\n";
+
+       /* Page header*/
+       $display= print_header(get_template_path('images/mailqueue.png'), _("Mail queue")).$display;
+
+       /* Store changes  in session */
+       $_SESSION['mailqueue']= $mailqueue;
+}
+?>
diff --git a/gosa-core/plugins/addons/notifications/class_msgplug.inc b/gosa-core/plugins/addons/notifications/class_msgplug.inc
new file mode 100644 (file)
index 0000000..edbab55
--- /dev/null
@@ -0,0 +1,258 @@
+<?php
+
+class msgplug extends plugin
+{
+  /* Definitions */
+  var $plHeadline= "Notifications";
+  var $plDescription= "This does something";
+
+  /* attribute list for save action */
+  var $attributes= array("target", "nmessage");
+  var $objectclasses= array();
+
+  /* Helpers */
+  var $target= "group";
+  var $nmessage= "";
+
+  var $targets= array();
+  var $users= array();
+  var $groups= array();
+  var $recipients= array();
+  var $show_templates= false;
+  var $templates= array();
+  var $template= "";
+  var $finalized= false;
+  var $module = "msgplug";
+  var $view_logged = FALSE;
+
+  function msgplug (&$config, $dn= NULL)
+  {
+    /* Include config object */
+    $this->config= &$config;
+    $ui= get_userinfo();
+    $tag= $ui->gosaUnitTag;
+
+    /* Preset values */
+    $this->targets= array("user" => _("Users"), "group" => _("Groups"));
+    asort($this->targets);
+
+    $res = get_list("(objectClass=gosaAccount)", "users", $this->config->current['BASE'],array('uid', 'cn'),GL_SUBSEARCH);
+    foreach($res as $key => $attrs){
+      $this->users['U:'.$attrs['uid'][0]]= $attrs['cn'][0].' ['.$attrs['uid'][0].']';
+    }
+    ksort($this->users);
+
+    $res = get_list("(objectClass=posixGroup)", "groups", $this->config->current['BASE'],array('cn','description'));
+    foreach($res as $key => $attrs){
+      $dsc= "";
+      if (isset($attrs['description'][0])){
+        $dsc= $attrs['description'][0];
+      }
+      $this->groups['G:'.$attrs['cn'][0]]= $attrs['cn'][0].' ['.$dsc.']';
+    }
+    ksort($this->users);
+
+
+    /* Load templates */
+    if (isset($this->config->current['NOTIFYDIR'])){
+      $dir= $this->config->current['NOTIFYDIR'];
+      if (is_dir($dir) && is_readable($dir)){
+
+        /* Look for files and build the vacation array */
+        $dh= opendir($dir);
+        while ($file = readdir($dh)){
+          $description= $this->parse_notification("$dir/$file");
+          if ($description != ""){
+            $this->templates["$dir/$file"]= $description;
+          }
+        }
+        closedir($dh);
+      }
+
+      /* Enable templates if there are some... */
+      if (count($this->templates)){
+        $this->show_templates= true;
+      }
+    }
+  }
+
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* Log view */
+    if(!$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","msgplug/".get_class($this),$this->dn);
+    }
+
+    /* Send message? */
+    if (isset($_POST['send']) && $this->acl_is_writeable("notify")){
+
+      /* Do we have recipients? */
+      if (count($this->recipients)){
+
+        /*Permissions ok? */
+        if (!$this->acl_is_writeable('notify')){
+          print_red(_("You have no permissions to send a message!"));
+        } else {
+          $cmd= $this->config->search("msgplug", "NOTIFY_COMMAND",array('menu'));
+          if ($cmd == ""){
+            print_red(_("No NOTIFY_COMMAND definition found in your gosa.conf"));
+          } else {
+            $parameters= base64_encode($this->nmessage) ." ";
+            foreach ($this->recipients as $key => $value){
+              $parameters.= "$key ";
+            }
+            exec ("$cmd $parameters", $dummy, $retval);
+            if ($retval != 0){
+              print_red(sprintf(_("Execution of '%s' failed!"), $cmd));
+            }
+            $this->finalized= true;
+          }
+        }
+      } else {
+        print_red(_("Please specify at least one recipient to send a message!"));
+      }
+    }
+
+    /* Bounce back to the original dialog */
+    if (isset($_POST['continue'])){
+      $this->finalized= false;
+    }
+
+    /* Add to list? */
+    if (isset($_POST['add']) && isset($_POST['source']) && $this->acl_is_writeable("notify")){
+      foreach ($_POST['source'] as $key){
+        if ($this->target == 'user'){
+          if(isset($this->users[$key])){
+            $this->recipients[$key]= $this->users[$key];
+          }
+        }
+        if ($this->target == 'group'){
+          if(isset($this->groups[$key])){
+            $this->recipients[$key]= $this->groups[$key];
+          }
+        }
+      }
+      ksort($this->recipients);
+    }
+
+    /* Remove from list? */
+    if (isset($_POST['del']) && isset($_POST['recipient'])){
+      foreach ($_POST['recipient'] as $key){
+          unset($this->recipients[$key]);
+      }
+    }
+
+    /* Import message? */
+    if (isset($_POST["import_template"]) && isset($this->templates[$_POST["nmessage_template"]])){
+      $contents= "";
+      $lines= file($_POST["nmessage_template"]);
+      foreach ($lines as $line){
+        if (!preg_match('/^DESC:/', $line)){
+          $contents.= $line;
+        }
+      }
+
+      /* Replace attributes */
+      $ui= get_userinfo();
+      $contents= preg_replace('/%self/', $ui->cn, $contents);
+
+      /* Save message */
+      $this->nmessage= htmlspecialchars($contents);
+    }
+
+    $smarty= get_smarty();
+
+    /* Assign possible target types */
+    $smarty->assign("targets", $this->targets);
+    foreach ($this->attributes as $attr){
+      $smarty->assign($attr, $this->$attr);
+    }
+
+    /* Generate list */
+    $tmp= array();
+    foreach (array("user" => "users", "group" => "groups") as $field => $arr){
+      if ($this->target == $field){
+        foreach ($this->$arr as $key => $value){
+          if (!isset($this->recipients[$key])){
+            $tmp[$key]= $value;
+          }
+        }
+      }
+    }
+    $smarty->assign('sources', $tmp);
+    $smarty->assign('recipients', $this->recipients);
+
+    /* Assign ACL */
+    $smarty->assign('nmessageACL', $this->getacl("notify"));
+
+    /* Handle templates */
+    $smarty->assign('show_templates', $this->show_templates?"true":"false");
+    $smarty->assign('message_templates', $this->templates);
+    $smarty->assign('template', $this->template);
+    $smarty->assign('finished', $this->finalized?"true":"false");
+
+    /* Show main page */
+    return ($smarty->fetch (get_template_path('contents.tpl', TRUE)));
+  }
+
+
+  function parse_notification($file)
+  {
+    $desc= "";
+
+    if (is_file($file)){
+      $fh = fopen($file, "r");
+      $line= fgets($fh, 256);
+
+      if (!preg_match('/^DESC:/', $line)){
+        print_red (_("No DESC tag in message file:")." $file");
+        return $desc;
+      }
+      fclose ($fh);
+
+      $desc= trim(preg_replace('/^DESC:\s*/', '', $line));
+    }
+
+    return $desc;
+  }
+
+  
+  function save_object()
+  {
+    plugin::save_object();
+    foreach($this->attributes as $attr){
+      if(isset($_POST[$attr])){
+        $this->$attr = $_POST[$attr];
+      }
+    }
+  }
+
+  
+  /* Return plugin informations for acl handling */
+  static function plInfo()
+  {
+    return (array(
+        "plShortName"   => _("Notification"),
+        "plDescription" => _("Notification plugin"),
+        "plSelfModify"  => FALSE,
+        "plDepends"     => array(),
+        "plPriority"    => 89,
+        "plSection"     => array("addon"),
+        "plCategory"    => array("msgplug" => array("objectClass" => "none", "description" => _("Notification plugin"))),
+
+        "plProvidedAcls" => array(
+            "notify"          => _("Allow sending notifications")
+          )
+        ));
+  }
+
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/addons/notifications/contents.tpl b/gosa-core/plugins/addons/notifications/contents.tpl
new file mode 100644 (file)
index 0000000..6898696
--- /dev/null
@@ -0,0 +1,80 @@
+{if $finished eq "false"}
+<h2>{t}Notification target{/t}</h2>
+
+<table style="width:100%">
+ <tr>
+  <td style="width:48%; vertical-align:top;">
+   {t}Use target from{/t}
+   <select name="target" onChange="document.mainform.submit()">
+        {html_options options=$targets selected=$target}
+        <option disabled>&nbsp;</option>
+   </select>
+   {if $javascript eq 'false'}<input type="submit" value="{t}Apply{/t}" name="refresh">{/if}<br><br>
+  </td>
+  <td>
+  </td>
+  <td>
+  </td>
+ </tr>
+ <tr>
+  <td>
+   {t}Available recipients{/t}<br>
+   <select style="width:100%;height:180px;" name="source[]" size="20" multiple title="{t}List message possible targets{/t}">
+            {html_options options=$sources}
+           <option disabled>&nbsp;</option>
+   </select>
+  </td>
+  <td style="vertical-align:center; text-align:center">
+   <input type="submit" value="&gt;" name="add">
+   <br><br>
+   <input type="submit" value="&lt;" name="del">
+  </td>
+  <td style="width:48%; vertical-align:top;">
+   {t}Recipients{/t}<br>
+   <select style="width:100%;height:180px;" name="recipient[]" size="20" multiple title="{t}List message recipients{/t}">
+            {html_options options=$recipients}
+           <option disabled>&nbsp;</option>
+   </select>
+  </td>
+ </tr>
+</table>
+
+
+<p class="seperator">&nbsp;</p>
+<h2>{t}Message{/t}</h2>
+{render acl=$nmessageACL}
+  <textarea id="nmessage" style="width:99%; height:180px;" name="nmessage" rows="4" cols="512" >{$nmessage}</textarea>
+{/render}
+
+{if $show_templates eq "true"}
+<select name="nmessage_template">
+       {html_options options=$message_templates selected=$template}
+       <option disabled>&nbsp;</option>
+</select>
+<input type="submit" value="{t}Import{/t}" name="import_template">
+{/if}
+
+<p class="seperator">&nbsp;</p>
+<div style='text-align:right;margin-top:5px'>
+{render acl=$nmessageACL}
+        <input type="submit" name="send" value="{t}Send message{/t}">
+{/render}
+</div>
+
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+  document.mainform.nmessage.focus();
+  -->
+</script>
+{else}
+<h2>{t}Notification send!{/t}</h2>
+<p class="seperator">&nbsp;</p>
+<br>
+{t}Your message has been sent successfully. Press the continue button to get back to the notification plugin.{/t}
+<p class="seperator">&nbsp;</p>
+<div style='text-align:right;margin-top:5px'>
+        <input type="submit" name="continue" value="{t}Continue{/t}">
+</div>
+{/if}
diff --git a/gosa-core/plugins/addons/notifications/main.inc b/gosa-core/plugins/addons/notifications/main.inc
new file mode 100644 (file)
index 0000000..c736985
--- /dev/null
@@ -0,0 +1,51 @@
+<?php
+/*
+  This code is part of GOsa (https://gosa.gonicus.de)
+  Copyright (C) 2005  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
+*/
+
+if (!$remove_lock){
+        /* Create msgplug object on demand */
+        if (!isset($_SESSION['msgplug']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+                $ui = get_userinfo();
+                $_SESSION['msgplug']= new msgplug ($config);
+                $_SESSION['msgplug']->set_acl_category("msgplug");
+
+                /* Check root dn and user dn for acl informations */
+                $_SESSION['msgplug']->set_acl_base($config->current['BASE']);
+                if($_SESSION['msgplug']->getacl("") == ""){
+                        $_SESSION['msgplug']->set_acl_base($ui->dn);
+                }
+        }
+       $msgplug= $_SESSION['msgplug'];
+
+       /* save changes back to object */
+       if (isset ($_POST['target'])){
+         $msgplug->save_object ();
+       }
+
+       /* Execute formular */
+       $display= $msgplug->execute ();
+       $display.= "<input type=\"hidden\" name=\"ignore\">\n";
+
+       /* Page header*/
+       $display= print_header(get_template_path('images/notifications.png'), _("Notifications")).$display;
+
+       /* Store changes  in session */
+       $_SESSION['msgplug']= $msgplug;
+}
+?>
diff --git a/gosa-core/plugins/admin/acl/acl_role.tpl b/gosa-core/plugins/admin/acl/acl_role.tpl
new file mode 100644 (file)
index 0000000..17a2704
--- /dev/null
@@ -0,0 +1,78 @@
+{if $dialogState eq 'head'}
+
+<h1>{t}Assigned ACLs for current entry{/t}</h1>
+<table>
+<tr>
+       <td>
+               {t}Name{/t}
+       </td>
+       <td>    
+{render acl=$cnACL}
+               <input type="text" name='cn' value="{$cn}" style='width:200px;'>
+{/render}
+       </td>
+</tr>
+<tr>
+       <td>
+               {t}Description{/t}
+       </td>
+       <td>
+{render acl=$descriptionACL}
+               <input type="text" name='description' value="{$description}" style='width:200px;'>
+{/render}
+       </td>
+</tr>
+<tr>
+       <td>
+               {t}Base{/t}
+       </td>
+       <td>
+{render acl=$baseACL}
+             <select id="base" size="1" name="base" title="{t}Choose subtree to place group in{/t}">
+              {html_options options=$bases selected=$base_select}
+             </select>
+{/render}
+
+{render acl=$baseACL disable_picture='images/folder_gray.png'}
+               <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
+{/render}
+
+       </td>
+</tr>
+</table>
+{$aclList}
+<input type="submit" name="new_acl" value="{t}New ACL{/t}">
+
+{/if}
+
+{if $dialogState eq 'create'}
+<h1>{t}ACL type{/t} <select size="1" name="aclType" title="{t}Select an acl type{/t}" onChange="document.mainform.submit()">{html_options options=$aclTypes selected=$aclType}<option disabled>&nbsp;</option></select>&nbsp;{if $javascript eq 'false'}<input type="submit" value="{t}Apply{/t}" name="refresh">{/if}</h1>
+
+<p class="seperator">&nbsp;</p>
+
+
+<h1>{t}List of available ACL categories{/t}</h1>
+{$aclList}
+
+<p class="seperator">&nbsp;</p>
+<div style='text-align:right;margin-top:5px'>
+       <input type="submit" name="submit_new_acl" value="{t}Apply{/t}">
+       &nbsp;
+       <input type="submit" name="cancel_new_acl" value="{t}Cancel{/t}">
+</div>
+{/if}
+
+{if $dialogState eq 'edit'}
+
+<h1>{$headline}</h1>
+
+{$aclSelector}
+
+<p class="seperator">&nbsp;</p>
+<div style='text-align:right;margin-top:5px'>
+       <input type="submit" name="submit_edit_acl" value="{t}Apply{/t}">
+       &nbsp;
+       <input type="submit" name="cancel_edit_acl" value="{t}Cancel{/t}">
+</div>
+{/if}
+<input type='hidden' name='acl_role_posted' value='1'>
diff --git a/gosa-core/plugins/admin/acl/class_aclManagement.inc b/gosa-core/plugins/admin/acl/class_aclManagement.inc
new file mode 100644 (file)
index 0000000..fd784ed
--- /dev/null
@@ -0,0 +1,656 @@
+<?php
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2003-2006 - Cajus Pollmeier <pollmeier@gonicus.de>
+
+   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 aclManagement extends plugin
+{
+  /* Plugin definitions */
+  var $plHeadline     = "ACLs";
+  var $plDescription  = "This does something";
+
+  /* Dialog attributes */
+  var $acltabs              = NULL;
+  var $ui                   = NULL;
+  var $acl                  = "";
+  var $DivListACL           = NULL;
+
+  var $CopyPasteHandler;
+  var $start_pasting_copied_objects = FALSE;
+
+  function aclManagement(&$config, &$ui)
+  {
+    /* Save configuration for internal use */
+    $this->config = &$config;
+    $this->ui     = &$ui;
+
+    /* Copy & Paste enabled ?*/
+    if((isset($this->config->data['MAIN']['ENABLECOPYPASTE']))&&(preg_match("/true/i",$this->config->data['MAIN']['ENABLECOPYPASTE']))){
+      $this->CopyPasteHandler = new CopyPasteHandler($this->config);
+    }
+
+    /* Creat dialog object */
+    $this->DivListACL = new divListACL($this->config,$this);
+  }
+
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    $_SESSION['LOCK_VARS_TO_USE'] = array("/^list/","/^id_/","/^list_acl_role_del/","/^list_acl_del/");
+
+    $smarty       = get_smarty();                 // Smarty instance
+    $s_action     = "";                           // Contains the action to be taken
+    $s_entry      = "";                           // The value for s_action
+
+    /* Edit entry button pressed? */
+    if( isset($_GET['act']) && $_GET['act'] == "list_edit_entry" ){
+      $s_action= "edit";
+      $s_entry= validate($_GET['id']);
+    }
+
+    /* Edit entry button pressed? */
+    if( isset($_GET['act']) && $_GET['act'] == "list_edit_role" ){
+      $s_action= "edit_role";
+      $s_entry= validate($_GET['id']);
+    }
+
+    $types = array( 
+                    "del"       =>"^list_acl_del",
+                    "edit"      =>"^list_acl_edit",
+                    "del_role"  =>"^list_acl_role_del",
+                    "edit_role" =>"^list_acl_role_edit",
+                    "copy"      =>"^copy",
+                    "cut"       =>"^cut",
+                    "copy_multiple"=> "^multiple_copy_objects",
+                    "cut_multiple" => "^multiple_cut_objects",
+                    "editPaste" =>"^editPaste",
+                    "addrole"   =>"^new_acl_role");
+
+    /* Test relevant POST values */  
+    foreach($_POST as $key => $val){
+
+      /* Get every possible POST combination and set s_action/s_entry accordingly */
+      foreach($types as $act => $name){
+
+        if (preg_match("/".$name.".*/", $key)){
+          $s_action= $act;
+          $s_entry= preg_replace("/".$name."_/i", "", $key);
+        }
+      }
+    } 
+
+    /* Remove coordinate prefix from POST, required by some browsers */
+    $s_entry= preg_replace("/_.$/", "", $s_entry);
+
+    /* Seperate possibly encoded tab and entry, default to tab "acl" */
+    if(preg_match("/.*-.*/", $s_entry)){
+      $s_tab= preg_replace("/^[^-]*-/i", "" ,$s_entry);
+      $s_entry= preg_replace("/-[^-]*$/i", "", $s_entry);
+    }else{
+      $s_tab= "generic";
+    }
+   
+
+    /* handle C&P from layers menu */
+    if(isset($_POST['menu_action']) && preg_match("/^multiple_copy_systems/",$_POST['menu_action'])){
+      $s_action = "copy_multiple";
+    }
+    if(isset($_POST['menu_action']) && preg_match("/^multiple_cut_systems/",$_POST['menu_action'])){
+      $s_action = "cut_multiple";
+    }
+    if(isset($_POST['menu_action']) && preg_match("/^editPaste/",$_POST['menu_action'])){
+      $s_action = "editPaste";
+    }
+
+    /* Create options */
+    if(isset($_POST['menu_action']) && $_POST['menu_action'] == "new_acl_role"){
+      $s_action = "new";
+    }
+
+    /* handle remove from layers menu */
+    if(isset($_POST['menu_action']) && preg_match("/^remove_multiple/",$_POST['menu_action'])){
+      $s_action = "del_multiple";
+    }
+    /********************
+      Copy & Paste Handling  ...
+     ********************/
+
+    /* Display the copy & paste dialog, if it is currently open */
+    $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
+    if($ret){
+      return($ret);
+    }
+
+
+    /********************
+     * Add new Role entry 
+     ********************/
+
+    if(($s_action == "addrole") && (!isset($this->acltabs->config))){
+
+      /* Get 'dn' from posted acl, must be unique */
+      $this->dn= "new";
+
+      /* Check permissions */
+      if(preg_match("/c/",$this->ui->get_permissions($this->DivListACL->selectedBase,"acl/acl"))){
+
+        /* Register acltabs to trigger edit dialog */
+        $this->acltabs= new aclroletab($this->config, NULL,$this->dn);
+        $this->acltabs->set_acl_base($this->DivListACL->selectedBase);
+      }else{
+        print_red(_("You are not allowed to create a new role."));
+      }
+    }
+
+    /********************
+      Edit existing entry 
+     ********************/
+
+    if (($s_action=="edit" || $s_action=="edit_role") && (!isset($this->acltabs->config))){
+
+      /* Get 'dn' from posted acl, must be unique */
+      $this->dn= $this->list[trim($s_entry)]['dn'];
+
+      /* Check permissions */
+      if(preg_match("/r/",$this->ui->get_permissions($this->dn,"acl/acl"))){
+      
+        /* Check locking, save current plugin in 'back_plugin', so
+           the dialog knows where to return. */
+        if (($acl= get_lock($this->dn)) != ""){
+          return(gen_locked_message ($acl, $this->dn));
+        }
+
+        /* Lock the current entry, so everyone will get the above dialog */
+        add_lock ($this->dn, $this->ui->dn);
+
+        /* Register acltabs to trigger edit dialog */ 
+        if($s_action=="edit_role"){
+          $this->acltabs= new aclroletab($this->config, NULL,$this->dn);
+          $this->acltabs-> set_acl_base($this->dn);
+        }else{
+          $this->acltabs= new acltab($this->config, NULL,$this->dn);
+          $this->acltabs-> set_acl_base($this->dn);
+        }
+
+        /* Set ACL and move DN to the headline */
+        $_SESSION['objectinfo']= $this->dn;
+      }else{
+        print_red(_("You are not allowed to edit this acl."));
+      }
+    }
+
+
+    /********************
+      Edit canceled 
+     ********************/
+    if(isset($_POST['delete_lock'])){
+      del_lock ($this->dn);
+      unset($_SESSION['objectinfo']);
+    }
+
+    /* Reset all relevant data, if we get a _cancel request */
+    if (isset($_POST['edit_cancel'])){
+      if (isset($this->acltabs)){
+        del_lock ($this->dn);
+        unset ($this->acltabs);
+      }
+      $this->acltabs= NULL;
+      unset ($_SESSION['objectinfo']);
+    }
+
+
+    /********************
+      Delete entry requested, display confirm dialog
+     ********************/
+
+    /* Remove acl was requested */
+    if ($s_action=="del_role"){
+
+      /* Get 'dn' from posted acl */
+      $this->dn= $this->list[trim($s_entry)]['dn'];
+
+      /* Check permissions */
+      if(preg_match("/d/",$this->ui->get_permissions($this->dn,"aclroles/aclrole"))){
+
+        /* Check locking, save current plugin in 'back_plugin', so
+           the dialog knows where to return. */
+        if (($acl= get_lock($this->dn)) != ""){
+          return(gen_locked_message ($acl, $this->dn));
+        }
+
+        /* Lock the current entry, so nobody will edit it during deletion */
+        add_lock ($this->dn, $this->ui->dn);
+        $smarty->assign("info", sprintf(_("You're about to delete the acl %s."), @LDAP::fix($this->dn)));
+        $smarty->assign("is_role",true);
+  
+        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+      } else {
+
+        /* Obviously the acl isn't allowed to delete. Show message and
+           clean session. */
+        print_red (_("You are not allowed to delete this acl!"));
+      }
+    }
+
+
+    /********************
+      Delete entry confirmed 
+     ********************/
+
+    /* Confirmation for deletion has been passed. Acl should be deleted. */
+    if (isset($_POST['delete_acl_role_confirmed'])){
+
+      /* Check permissions */
+      if(preg_match("/d/",$this->ui->get_permissions($this->dn,"aclroles/aclrole"))){
+
+        /* Delete request is permitted, perform LDAP action */
+        $this->acltabs= new aclroletab($this->config, NULL,$this->dn);
+        $this->acltabs->delete();
+        unset ($this->acltabs);
+        $this->acltabs= NULL;
+      } else {
+
+        /* Normally this shouldn't be reached, send some extra
+           logs to notify the administrator */
+        print_red (_("You are not allowed to delete this acl role!"));
+
+        if(isset($this->ui->uid)){
+          new log("security","aclroles/".get_class($this),$this->dn,array(),"Warning: '".$this->ui->uid."' tried to trick acl role deletion.");
+        }
+      }
+
+      /* Remove lock file after successfull deletion */
+      del_lock ($this->dn);
+    }
+
+    /********************
+      Delete entry requested, display confirm dialog
+     ********************/
+
+    /* Remove acl was requested */
+    if ($s_action=="del"){
+
+      /* Get 'dn' from posted acl */
+      $this->dn= $this->list[trim($s_entry)]['dn'];
+
+      /* Check permissions */
+      if(preg_match("/d/",$this->ui->get_permissions($this->dn,"acl/acl"))){
+        /* Check locking, save current plugin in 'back_plugin', so
+           the dialog knows where to return. */
+        if (($acl= get_lock($this->dn)) != ""){
+          $_SESSION['LOCK_VARS_TO_USE'] = array("/^list_acl_edit/","/^list_acl_del/","/^id_/");
+          return(gen_locked_message ($acl, $this->dn));
+        }
+
+        /* Lock the current entry, so nobody will edit it during deletion */
+        add_lock ($this->dn, $this->ui->dn);
+        $smarty->assign("info", sprintf(_("You're about to delete the acl %s."), @LDAP::fix($this->dn)));
+        $smarty->assign("is_role",false);
+        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+      } else {
+
+        /* Obviously the acl isn't allowed to delete. Show message and
+           clean session. */
+        print_red (_("You are not allowed to delete this acl!"));
+      }
+    }
+
+
+    /********************
+      Delete entry confirmed 
+     ********************/
+
+    /* Confirmation for deletion has been passed. Acl should be deleted. */
+    if (isset($_POST['delete_acl_confirm'])){
+
+      /* Check permissions */
+      if(preg_match("/d/",$this->ui->get_permissions($this->dn,"acl/acl"))){
+
+        /* Delete request is permitted, perform LDAP action */
+        $this->acltabs= new acl($this->config, NULL,$this->dn);
+        $this->acltabs->remove_from_parent();
+        unset ($this->acltabs);
+        $this->acltabs= NULL;
+      } else {
+
+        /* Normally this shouldn't be reached, send some extra
+           logs to notify the administrator */
+        print_red (_("You are not allowed to delete this acl!"));
+
+        if(isset($this->ui->uid)){
+          new log("security","aclroles/".get_class($this),$this->dn,array(),"Warning: '".$this->ui->uid."' tried to trick acl role      deletion.");
+          
+        }
+      }
+
+      /* Remove lock file after successfull deletion */
+      del_lock ($this->dn);
+    }
+
+    
+    /********************
+      Delete entry Canceled 
+     ********************/
+
+    /* Delete acl canceled? */
+    if (isset($_POST['delete_cancel'])){
+      del_lock ($this->dn);
+    }
+
+
+    /********************
+      Edit entry finished (Save) 
+     ********************/
+
+    /* Finish acl edit is triggered by the tabulator dialog, so
+       the acl wants to save edited data. Check and save at this
+       point. */
+    if ((isset($_POST['edit_finish']) || isset($_POST['edit_apply'])) && (isset($this->acltabs->config))){
+
+      /* Check tabs, will feed message array */
+      $this->acltabs->save_object();
+      $message= $this->acltabs->check();
+
+      /* Save, or display error message? */
+      if (count($message) == 0){
+
+        /* Save acl data to ldap */
+        if($this->acltabs->save() == 1){
+          return;
+        }
+
+        if (!isset($_POST['edit_apply'])){
+
+          /* ACl has been saved successfully, remove lock from LDAP. */
+          if ($this->dn != "new"){
+            del_lock ($this->dn);
+          }
+
+          unset ($this->acltabs);
+          $this->acltabs= NULL;
+          unset ($_SESSION['objectinfo']);
+        }
+      } else {
+        /* Ok. There seem to be errors regarding to the tab data,
+           show message and continue as usual. */
+        show_errors($message);
+      }
+    }
+
+
+    /********************
+      Display subdialog 
+     ********************/
+
+
+    /* Show tab dialog if object is present */
+    if(isset($this->acltabs->config)){
+      
+      /* Save object */
+      $this->acltabs->save_object();
+      $display= $this->acltabs->execute();
+
+      /* Don't show buttons if tab dialog requests this */
+      if(isset($this->acltabs)){
+
+        /* Skip displaying save/cancel if there is a sub dialog open */
+        if (!isset($this->acltabs->dialog) || !$this->acltabs->dialog){
+          $display.= "<p style=\"text-align:right\">\n";
+//          $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
+          $display.= "&nbsp;\n";
+
+          /* Skip Apply if it is a new entry */
+          #if ($this->dn != "new"){
+          #  $display.= "<input type=submit name=\"edit_apply\" value=\""._("Apply")."\">\n";
+          #  $display.= "&nbsp;\n";
+          #}
+
+  //        $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+          $display.= "</p>";
+        }
+      }
+      return ($display);
+    }
+    
+    /* Check if there is a snapshot dialog open */
+    $base = $this->DivListACL->selectedBase;
+    if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases())){
+      return($str);
+    }
+  
+    /* Return rendered main page */
+        /* Display dialog with system list */
+    $this->DivListACL->parent = $this;
+    $this->DivListACL->execute();
+
+    /* Add departments if subsearch is disabled */
+    if(!$this->DivListACL->SubSearch){
+      $this->DivListACL->AddDepartments($this->DivListACL->selectedBase,3,1);
+    }
+    $this->reload();
+    $this->DivListACL->setEntries($this->list);
+    return($this->DivListACL->Draw());
+  }
+
+
+  function reload()
+  {
+    /* Get divlist informations from filter part */
+    $Regex      = $this->DivListACL -> Regex;
+    $SubSearch  = $this->DivListACL -> SubSearch;
+    $base       = $this->DivListACL -> selectedBase; 
+    $Attrs      = array("ou","cn","description","gosaAclEntry","objectClass");
+    $res        = array();
+    $tmp        = array();                                    // Will contain temporary results 
+    $ldap       = $this->config->get_ldap_link();
+    $Filter     = "(&(objectClass=gosaACL)(gosaAclEntry=*)(|(cn=".$Regex.")(ou=".$Regex.")))";
+    $FilterRoles= "(&(objectClass=gosaRole)(|(cn=".$Regex.")(ou=".$Regex.")))";
+
+    /* Fetch following structures, this will be used if !$SubSearch */
+    $fetch_this = array(
+      "ME"      => array("TYPE" => "cat"    , "FLAGS" => GL_SIZELIMIT                ,"BASE"=>""),
+      "SYSTEMS" => array("TYPE" => "search" , "FLAGS" => GL_SIZELIMIT | GL_SUBSEARCH ,"BASE"=>"ou=systems,"),
+      "APPS"    => array("TYPE" => "search" , "FLAGS" => GL_SIZELIMIT | GL_SUBSEARCH ,"BASE"=>"ou=apps,"),
+      "PEOPLE"  => array("TYPE" => "search" , "FLAGS" => GL_SIZELIMIT | GL_SUBSEARCH ,"BASE"=>get_people_ou()),
+      "GROUPS"  => array("TYPE" => "search" , "FLAGS" => GL_SIZELIMIT | GL_SUBSEARCH ,"BASE"=>get_groups_ou()));
+
+    /* Subsearch ? */
+    if($SubSearch){
+
+      /* Get all object in this base */
+      $Flags        = GL_SIZELIMIT | GL_SUBSEARCH;
+      $fetch_base   = $base;
+      $tmp  = get_list($Filter,   "acl", $fetch_base, $Attrs, $Flags);
+      $tmp2 = get_list($FilterRoles,  "acl", $fetch_base, $Attrs, $Flags);
+      foreach($tmp as $entry){
+        $res[] = $entry;
+      }
+      foreach($tmp2 as $entry){
+        $res[] = $entry;
+      }
+
+    }else{
+
+      $tmp_roles = get_list($FilterRoles,  "acl", "ou=aclroles,".$base, $Attrs,GL_SIZELIMIT);
+
+      foreach($tmp_roles as $entry){
+        $res[] = $entry;
+      }
+
+      /* Walk through all possible bases */
+      foreach($fetch_this as $type => $data){
+
+        /* Get requried attributes */
+        $Flags        = $data['FLAGS'];
+        $fetch_base   = $data['BASE'].$base;
+        $Type         = $data['TYPE'];
+
+        /* Check if method is cat or search */
+        if($Type == "search"){
+          $tmp = get_list($Filter, "acl", $fetch_base, $Attrs, $Flags);
+          foreach($tmp as $entry){
+            $res[] = $entry;
+          }
+        }else{
+          $ldap->cat($fetch_base,$Attrs);
+          $attrs = $ldap->fetch();
+          if($attrs && isset($attrs['gosaAclEntry'])){
+            $re2 = preg_replace("/\*/",".*",$Regex);
+
+            if(!isset($attrs['ou']) && !isset($attrs['cn'])){
+              $namingAttr= preg_replace("/^[^=]*+=([^,]*),.*$/","\\1",$fetch_base);
+              if(preg_match("/".$re2."/i",$namingAttr)){
+                $res[] = $attrs;
+              }
+            }elseif( (isset($attrs['cn'][0]) && preg_match("/".$re2."/i",$attrs['cn'][0]))
+               ||(isset($attrs['ou'][0]) && preg_match("/".$re2."/i",$attrs['ou'][0]))){
+              $res[] = $attrs;
+            }
+          }
+        }
+      }
+    }
+    $this->list = $res;
+  }
+
+
+  function copyPasteHandling_from_queue($s_action,$s_entry)
+  {
+    /* Check if Copy & Paste is disabled */
+    if(!is_object($this->CopyPasteHandler)){
+      return("");
+    }
+
+    /* Add a single entry to queue */
+    if($s_action == "cut" || $s_action == "copy"){
+
+      /* Cleanup object queue */
+      $this->CopyPasteHandler->cleanup_queue();
+      $dn = $this->list[$s_entry]['dn'];
+  
+      if(isset($this->list[$s_entry]['objectClass']) && in_array("gosaRole",$this->list[$s_entry]['objectClass'])){
+        $this->CopyPasteHandler->add_to_queue($dn,$s_action,"aclroletab","ACLROLETAB","aclroles");
+      }
+    }
+
+    /* Add entries to queue */
+    if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
+
+      /* Cleanup object queue */
+      $this->CopyPasteHandler->cleanup_queue();
+
+      /* Add new entries to CP queue */
+      foreach($this->list_get_selected_items() as $id){
+        $dn = $this->list[$id]['dn'];
+
+        if(isset($this->list[$id]['objectClass']) && in_array("gosaRole",$this->list[$id]['objectClass'])){
+
+          if($s_action == "copy_multiple"){
+            $this->CopyPasteHandler->add_to_queue($dn,"copy","aclroletab","ACLROLETAB","aclroles");
+          }
+          if($s_action == "cut_multiple"){
+            $this->CopyPasteHandler->add_to_queue($dn,"cut","aclroletab","ACLROLETAB","aclroles");
+          }
+        }
+      }
+    }
+
+    /* Start pasting entries */
+    if($s_action == "editPaste"){
+      $this->start_pasting_copied_objects = TRUE;
+    }
+    /* Return C&P dialog */
+    if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
+
+      /* Load entry from queue and set base */
+      $this->CopyPasteHandler->load_entry_from_queue();
+      $this->CopyPasteHandler->SetVar("base",$this->DivListACL->selectedBase);
+
+      /* Get dialog */
+      $data = $this->CopyPasteHandler->execute();
+
+      /* Return dialog data */
+      if(!empty($data)){
+        return($data);
+      }
+    }
+
+    /* Automatically disable status for pasting */
+    if(!$this->CopyPasteHandler->entries_queued()){
+      $this->start_pasting_copied_objects = FALSE;
+    }
+    return("");
+  }
+
+
+  function list_get_selected_items()
+  {
+    $ids = array();
+    foreach($_POST as $name => $value){
+      if(preg_match("/^item_selected_[0-9]*$/",$name)){
+        $id   = preg_replace("/^item_selected_/","",$name);
+        $ids[$id] = $id;
+      }
+    }
+    return($ids);
+  }
+
+
+  function remove_lock()
+  {
+    /* Remove acl lock if a DN is marked as "currently edited" */
+    if (isset($this->acltabs->dn)){
+      del_lock ($this->acltabs->dn);
+    }
+  }
+
+
+  function save_object()
+  {
+    /* Handle divlist filter && department selection*/
+    if(!is_object($this->acltabs)){
+      $this->DivListACL->save_object();
+    }
+  }
+
+  /* A set of disabled and therefore overloaded functions. They are
+     not needed in this class. */
+  function remove_from_parent() { } 
+  function check() { } 
+
+  function save() {
+    echo "SAVE ACL";
+  } 
+
+  function adapt_from_template($dn) { } 
+  function password_change_needed() { } 
+
+
+  /* Return departments, that will be included within snapshot detection */
+  function get_used_snapshot_bases()
+  {
+    return(array());
+  }  
+
+} 
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/acl/class_aclRole.inc b/gosa-core/plugins/admin/acl/class_aclRole.inc
new file mode 100644 (file)
index 0000000..18bf440
--- /dev/null
@@ -0,0 +1,686 @@
+<?php
+
+class aclrole extends acl
+{
+  /* Definitions */
+  var $plHeadline= "Access control list templates";
+  var $plDescription= "This does something";
+
+  /* attribute list for save action */
+  var $attributes= array('gosaAclTemplate',"cn","description");
+  var $objectclasses= array('top','gosaRole');
+
+  /* Helpers */
+  var $dialogState= "head";
+  var $aclType= "";
+  var $aclObject= "";
+  var $aclContents= array();
+  var $target= "group";
+  var $aclTypes= array();
+  var $aclObjects= array();
+  var $recipients= array();
+  var $isContainer= TRUE;
+  var $currentIndex= 0;
+  var $wasNewEntry= FALSE;
+  var $ocMapping= array();
+  var $savedAclContents= array();
+  var $myAclObjects = array();
+
+  /* Role attributes */
+  var $gosaAclTemplate= "";
+  var $cn = "";
+  var $description = "";
+  var $orig_dn;
+  var $base ="";
+
+  function aclrole (&$config,  $dn= NULL)
+  {
+    /* Include config object */
+    plugin::plugin($config, $dn);
+
+    if($this->dn == "new"){
+      $this->base = $_SESSION['CurrentMainBase'];
+    }else{
+      $this->base = preg_replace("/^[^,]+,[^,]+,/","",$this->dn);
+      new log("view","aclroles/".get_class($this),$this->dn);
+    }
+   
+    /* Load ACL's */
+    $this->gosaAclTemplate= array();
+    if (isset($this->attrs["gosaAclTemplate"])){
+      for ($i= 0; $i<$this->attrs["gosaAclTemplate"]['count']; $i++){
+        $acl= $this->attrs["gosaAclTemplate"][$i];
+        $this->gosaAclTemplate= array_merge($this->gosaAclTemplate, $this->explodeACL($acl));
+      }
+    }
+    ksort($this->gosaAclTemplate);
+
+    /* Extract available categories from plugin info list */
+    $tmp= get_global('plist');
+    $plist= $tmp->info;
+    $oc = array();
+    foreach ($plist as $class => $acls){
+
+      /* Only feed categories */
+      if (isset($acls['plCategory'])){
+
+        /* Walk through supplied list and feed only translated categories */
+        foreach($acls['plCategory'] as $idx => $data){
+
+          /* Non numeric index means -> base object containing more informations */
+          if (preg_match('/^[0-9]+$/', $idx)){
+            if (!isset($this->ocMapping[$data])){
+              $this->ocMapping[$data]= array();
+              $this->ocMapping[$data][]= '0';
+            }
+            $this->ocMapping[$data][]= $class;
+          } else {
+            if (!isset($this->ocMapping[$idx])){
+              $this->ocMapping[$idx]= array();
+              $this->ocMapping[$idx][]= '0';
+            }
+            $this->ocMapping[$idx][]= $class;
+            $this->aclObjects[$idx]= $data['description'];
+
+            /* Additionally filter the classes we're interested in in "self edit" mode */
+            if (is_array($data['objectClass'])){
+              foreach($data['objectClass'] as $objectClass){
+                if (in_array_ics($objectClass, $oc)){
+                  $this->myAclObjects[$idx.'/'.$class]= $acls['plDescription'];
+                  break;
+                }
+              }
+            } else {
+              if (in_array_ics($data['objectClass'], $oc)){
+                $this->myAclObjects[$idx.'/'.$class]= $acls['plDescription'];
+              }
+            }
+          }
+
+        }
+      }
+    }
+    $this->aclObjects['all']= '*&nbsp;'._("All categories");
+    $this->ocMapping['all']= array('0' => 'all');
+
+    /* Sort categories */
+    asort($this->aclObjects);
+
+    /* Fill acl types */
+    $this->aclTypes= array( "reset" => _("Reset ACLs"),
+                             "one" => _("One level"),
+                             "base" => _("Current object"),
+                             "sub" => _("Complete subtree"),
+                             "psub" => _("Complete subtree (permanent)"));
+    asort($this->aclTypes);
+
+    /* Finally - we want to get saved... */
+    $this->is_account= TRUE;
+  }
+
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* Base select dialog */
+    $once = true;
+    foreach($_POST as $name => $value){
+      if((preg_match("/^chooseBase/",$name) && $once) && ($this->acl_is_moveable())){
+        $once = false;
+        $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
+        $this->dialog->setCurrentBase($this->base);
+      }
+    }
+
+    /* Dialog handling */
+    if(is_object($this->dialog)){
+      /* Must be called before save_object */
+      $this->dialog->save_object();
+
+      if($this->dialog->isClosed()){
+        $this->dialog = false;
+      }elseif($this->dialog->isSelected()){
+
+        /* Check if selected base is valid */
+        $tmp = $this->get_allowed_bases();
+        if(isset($tmp[$this->dialog->isSelected()])){
+          $this->base = $this->dialog->isSelected();
+        }
+        $this->dialog= false;
+      }else{
+        return($this->dialog->execute());
+      }
+    }
+
+    $tmp= get_global('plist');
+    $plist= $tmp->info;
+
+    /* Handle posts */
+    if (isset($_POST['new_acl'])){
+      $this->dialogState= 'create';
+      $this->dialog= TRUE;
+      $this->currentIndex= count($this->gosaAclTemplate);
+      $this->loadAclEntry(TRUE);
+    }
+
+    $new_acl= array();
+    $aclDialog= FALSE;
+    $firstedit= FALSE;
+    foreach($_POST as $name => $post){
+
+      /* Actions... */
+      if (preg_match('/^acl_edit_.*_x/', $name)){
+        $this->dialogState= 'create';
+        $firstedit= TRUE;
+        $this->dialog= TRUE;
+        $this->currentIndex= preg_replace('/^acl_edit_([0-9]+).*$/', '\1', $name);
+        $this->loadAclEntry();
+        continue;
+      }
+      if (preg_match('/^acl_del_.*_x/', $name)){
+        unset($this->gosaAclTemplate[preg_replace('/^acl_del_([0-9]+).*$/', '\1', $name)]);
+        continue;
+      }
+
+      if (preg_match('/^cat_edit_.*_x/', $name)){
+        $this->aclObject= preg_replace('/^cat_edit_([^_]+)_.*$/', '\1', $name);
+        $this->dialogState= 'edit';
+        foreach ($this->ocMapping[$this->aclObject] as $oc){
+          if (isset($this->aclContents[$oc])){
+            $this->savedAclContents[$oc]= $this->aclContents[$oc];
+          }
+        }
+        continue;
+      }
+      if (preg_match('/^cat_del_.*_x/', $name)){
+        $idx= preg_replace('/^cat_del_([^_]+)_.*$/', '\1', $name);
+        foreach ($this->ocMapping[$idx] as $key){
+          unset($this->aclContents["$idx/$key"]);
+        }
+        continue;
+      }
+
+      /* Sorting... */
+      if (preg_match('/^sortup_.*_x/', $name)){
+        $index= preg_replace('/^sortup_([0-9]+).*$/', '\1', $name);
+        if ($index > 0){
+          $tmp= $this->gosaAclTemplate[$index];
+          $this->gosaAclTemplate[$index]= $this->gosaAclTemplate[$index-1];
+          $this->gosaAclTemplate[$index-1]= $tmp;
+        }
+        continue;
+      }
+      if (preg_match('/^sortdown_.*_x/', $name)){
+        $index= preg_replace('/^sortdown_([0-9]+).*$/', '\1', $name);
+        if ($index < count($this->gosaAclTemplate)-1){
+          $tmp= $this->gosaAclTemplate[$index];
+          $this->gosaAclTemplate[$index]= $this->gosaAclTemplate[$index+1];
+          $this->gosaAclTemplate[$index+1]= $tmp;
+        }
+        continue;
+      }
+
+      /* ACL saving... */
+      if (preg_match('/^acl_.*_[^xy]$/', $name)){
+        $aclDialog= TRUE;
+        list($dummy, $object, $attribute, $value)= split('_', $name);
+
+        /* Skip for detection entry */
+        if ($object == 'dummy') {
+          continue;
+        }
+
+        /* Ordinary ACLs */
+        if (!isset($new_acl[$object])){
+          $new_acl[$object]= array();
+        }
+        if (isset($new_acl[$object][$attribute])){
+          $new_acl[$object][$attribute].= $value;
+        } else {
+          $new_acl[$object][$attribute]= $value;
+        }
+      }
+    }
+    
+    /* Only be interested in new acl's, if we're in the right _POST place */
+    if ($aclDialog && $this->aclObject != "" && is_array($this->ocMapping[$this->aclObject])){
+
+      foreach ($this->ocMapping[$this->aclObject] as $oc){
+        unset($this->aclContents[$oc]);
+        unset($this->aclContents[$this->aclObject.'/'.$oc]);
+        if (isset($new_acl[$oc])){
+          $this->aclContents[$oc]= $new_acl[$oc];
+        }
+        if (isset($new_acl[$this->aclObject.'/'.$oc])){
+          $this->aclContents[$this->aclObject.'/'.$oc]= $new_acl[$this->aclObject.'/'.$oc];
+        }
+      }
+    }
+
+    /* Save new acl in case of base edit mode */
+    if (1 == 0 && $this->aclType == 'base' && !$firstedit){
+      $this->aclContents= $new_acl;
+    }
+
+    /* Cancel new acl? */
+    if (isset($_POST['cancel_new_acl'])){
+      $this->dialogState= 'head';
+      $this->dialog= FALSE;
+      if ($this->wasNewEntry){
+        unset ($this->gosaAclTemplate[$this->currentIndex]);
+      }
+    }
+
+    /* Store ACL in main object? */
+    if (isset($_POST['submit_new_acl'])){
+      $this->gosaAclTemplate[$this->currentIndex]['type']= $this->aclType;
+      $this->gosaAclTemplate[$this->currentIndex]['members']= $this->recipients;
+      $this->gosaAclTemplate[$this->currentIndex]['acl']= $this->aclContents;
+      $this->dialogState= 'head';
+      $this->dialog= FALSE;
+    }
+
+    /* Cancel edit acl? */
+    if (isset($_POST['cancel_edit_acl'])){
+      $this->dialogState= 'create';
+      foreach ($this->ocMapping[$this->aclObject] as $oc){
+        if (isset($this->savedAclContents[$oc])){
+          $this->aclContents[$oc]= $this->savedAclContents[$oc];
+        }
+      }
+    }
+
+    /* Save edit acl? */
+    if (isset($_POST['submit_edit_acl'])){
+      $this->dialogState= 'create';
+    }
+
+    /* Add acl? */
+    if (isset($_POST['add_acl']) && $_POST['aclObject'] != ""){
+      $this->dialogState= 'edit';
+      $this->savedAclContents= array();
+      foreach ($this->ocMapping[$this->aclObject] as $oc){
+        if (isset($this->aclContents[$oc])){
+          $this->savedAclContents[$oc]= $this->aclContents[$oc];
+        }
+      }
+    }
+
+    /* Save common values */
+    foreach (array("aclType", "aclObject", "target") as $key){
+      if (isset($_POST[$key])){
+        $this->$key= validate($_POST[$key]);
+      }
+    }
+
+    /* Create templating instance */
+    $smarty= get_smarty();
+
+    $smarty->assign("bases", $this->get_allowed_bases());
+    $smarty->assign("base_select", $this->base);
+
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+    if ($this->dialogState == 'head'){
+      /* Draw list */
+      $aclList= new divSelectBox("aclList");
+      $aclList->SetHeight(350);
+      
+      /* Fill in entries */
+      foreach ($this->gosaAclTemplate as $key => $entry){
+        $field1= array("string" => $this->aclTypes[$entry['type']], "attach" => "style='width:100px'");
+        $field2= array("string" => $this->assembleAclSummary($entry));
+        $action= "<input type='image' name='sortup_$key' alt='up' title='"._("Up")."' src='images/sort_up.png' align='top'>";
+        $action.= "<input type='image' name='sortdown_$key' alt='down' title='"._("Down")."' src='images/sort_down.png'>";
+        $action.= "<input class='center' type='image' src='images/edit.png' alt='"._("edit")."' name='acl_edit_$key' title='"._("Edit ACL")."'>";
+        $action.= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."' name='acl_del_$key' title='"._("Delete ACL")."'>";
+
+        $field3= array("string" => $action, "attach" => "style='border-right:0px;width:50px;text-align:right;'");
+        $aclList->AddEntry(array($field1, $field2, $field3));
+      }
+
+      $smarty->assign("aclList", $aclList->DrawList());
+    }
+
+    if ($this->dialogState == 'create'){
+      /* Draw list */
+      $aclList= new divSelectBox("aclList");
+      $aclList->SetHeight(450);
+
+      /* Add settings for all categories to the (permanent) list */
+      foreach ($this->aclObjects as $section => $dsc){
+        $summary= "";
+        foreach($this->ocMapping[$section] as $oc){
+          if (isset($this->aclContents[$oc]) && count($this->aclContents[$oc]) && isset($this->aclContents[$oc][0]) &&
+              $this->aclContents[$oc][0] != ""){
+
+            $summary.= "$oc, ";
+            continue;
+          }
+          if (isset($this->aclContents["$section/$oc"]) && count($this->aclContents["$section/$oc"]) && isset($this->aclContents["$section/$oc"][0]) &&
+              $this->aclContents["$section/$oc"][0] != ""){
+
+            $summary.= "$oc, ";
+            continue;
+          }
+          if (isset($this->aclContents[$oc]) && !isset($this->aclContents[$oc][0]) && count($this->aclContents[$oc])){
+            $summary.= "$oc, ";
+          }
+        }
+
+        /* Set summary... */
+        if ($summary == ""){
+          $summary= '<i>'._("No ACL settings for this category").'</i>';
+        } else {
+          $summary= sprintf(_("Contains ACLs for these objects: %s"), preg_replace('/, $/', '', $summary));
+        }
+
+        $field1= array("string" => $dsc, "attach" => "style='width:140px'");
+        $field2= array("string" => $summary);
+        $action= "<input class='center' type='image' src='images/edit.png' alt='"._("edit")."' name='cat_edit_$section' title='"._("Edit categories ACLs")."'>";
+        $action.= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."' name='cat_del_$section' title='"._("Clear categories ACLs")."'>";
+        $field3= array("string" => $action, "attach" => "style='border-right:0px;width:50px'");
+        $aclList->AddEntry(array($field1, $field2, $field3));
+      }
+
+      $smarty->assign("aclList", $aclList->DrawList());
+      $smarty->assign("aclType", $this->aclType);
+      $smarty->assign("aclTypes", $this->aclTypes);
+      $smarty->assign("target", $this->target);
+
+      if ($this->aclType == 'base'){
+        $smarty->assign('aclSelector', $this->buildAclSelector($this->myAclObjects));
+      }
+    }
+
+    if ($this->dialogState == 'edit'){
+      $smarty->assign('headline', sprintf(_("Edit ACL for '%s', scope is '%s'"), $this->aclObjects[$this->aclObject], $this->aclTypes[$this->aclType]));
+
+      /* Collect objects for selected category */
+      foreach ($this->ocMapping[$this->aclObject] as $idx => $class){
+        if ($idx == 0){
+          continue;
+        }
+        $aclObjects[$this->aclObject.'/'.$class]= $plist[$class]['plDescription'];
+      }
+      if ($this->aclObject == 'all'){
+        $aclObjects['all']= _("All objects in current subtree");
+      }
+      $smarty->assign('aclSelector', $this->buildAclSelector($aclObjects));
+    }
+
+    /* Show main page */
+    $smarty->assign("dialogState", $this->dialogState);
+
+    /* Assign cn and decription if this is a role */
+    foreach(array("cn","description") as $name){
+      $smarty->assign($name,$this->$name);
+    }
+    return ($smarty->fetch (get_template_path('acl_role.tpl',dirname(__FILE__))));
+  }
+
+  function sort_by_priority($list)
+  {
+    $tmp= get_global('plist');
+    $plist= $tmp->info;
+    asort($plist);
+    $newSort = array();
+
+    foreach($list as $name => $translation){
+      $na  =  preg_replace("/^.*\//","",$name);
+      if (!isset($plist[$na]['plPriority'])){
+        $prio= 0;
+      } else {
+        $prio=  $plist[$na]['plPriority'] ;
+      }
+
+      $newSort[$name] = $prio;
+    }
+
+    asort($newSort);
+
+    $ret = array();
+    foreach($newSort as $name => $prio){
+      $ret[$name] = $list[$name];
+    }
+    return($ret);
+  }
+
+  function loadAclEntry($new= FALSE)
+  {
+    /* New entry gets presets... */
+    if ($new){
+      $this->aclType= 'sub';
+      $this->recipients= array();
+      $this->aclContents= array();
+    } else {
+      $acl= $this->gosaAclTemplate[$this->currentIndex];
+      $this->aclType= $acl['type'];
+      $this->recipients= $acl['members'];
+      $this->aclContents= $acl['acl'];
+    }
+
+    $this->wasNewEntry= $new;
+  }
+
+
+  function aclPostHandler()
+  {
+    if (isset($_POST['save_acl'])){
+      $this->save();
+      return TRUE;
+    }
+
+    return FALSE;
+  }
+
+
+  function save()
+  {
+    /* Assemble ACL's */
+    $tmp_acl= array();
+    foreach ($this->gosaAclTemplate as $prio => $entry){
+      $final= "";
+      $members= "";
+      if (isset($entry['members'])){
+        foreach ($entry['members'] as $key => $dummy){
+          $members.= base64_encode(preg_replace('/^.:/', '', $key)).',';
+        }
+      }
+      $final= $prio.":".$entry['type'].":".preg_replace('/,$/', '', $members);
+
+      /* ACL's if needed */
+      if ($entry['type'] != "reset" && $entry['type'] != "role"){
+        $acl= ":";
+        if (isset($entry['acl'])){
+          foreach ($entry['acl'] as $object => $contents){
+
+            /* Only save, if we've some contents in there... */
+            if (count($contents)){
+              $acl.= $object.";";
+
+              foreach($contents as $attr => $permission){
+
+                /* First entry? Its the one for global settings... */
+                if ($attr == '0'){
+                  $acl.= $permission;
+                } else {
+                  $acl.= '#'.$attr.';'.$permission;
+                }
+
+              }
+              $acl.= ',';
+            }
+            
+          }
+        }
+        $final.= preg_replace('/,$/', '', $acl);
+      }
+
+      $tmp_acl[]= $final;
+    } 
+
+    /* Call main method */
+    plugin::save();
+
+    /* Finally (re-)assign it... */
+    $this->attrs["gosaAclTemplate"]= $tmp_acl;
+
+    /* Remove acl from this entry if it is empty... */
+    if (!count($tmp_acl)){
+      /* Remove attribute */
+      if ($this->initially_was_account){
+        $this->attrs["gosaAclTempalte"]= array();
+      } else {
+        if (isset($this->attrs["gosaAclTemplate"])){
+          unset($this->attrs["gosaAclTemplate"]);
+        }
+      }
+    }
+
+    /* Do LDAP modifications */
+    $ldap= $this->config->get_ldap_link();
+
+    /* Check if object already exists */
+    $ldap->cat($this->dn);
+    if($ldap->count()){
+      $ldap->cd($this->dn);
+      $this->cleanup();
+      $ldap->modify ($this->attrs);
+      new log("modify","aclroles/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      $ldap->cd($this->config->current['BASE']);
+      $ldap->create_missing_trees(preg_replace("/^[^,]+,/","",$this->dn));
+      $ldap->cd($this->dn);
+      $ldap->add($this->attrs);
+      new log("create","aclroles/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
+
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving ACLs with dn '%s' failed."),$this->dn));
+
+    /* Refresh users ACLs */
+    $ui= get_userinfo();
+    $ui->loadACL();
+    $_SESSION['ui']= $ui;
+  }
+
+
+  function remove_from_parent()
+  {
+    $ldap = $this->config->get_ldap_link();
+    $serach_for = "*:role:".base64_encode($this->dn).":*"; 
+    $ldap->search ("(&(objectClass=gosaACL)(gosaAclEntry=".$serach_for."))",array('dn','cn','sn','givenName','uid'));
+    $all_names = "";
+
+
+    $cnt = 3;
+    while(($attrs = $ldap->fetch()) && $cnt){
+      $name = $attrs['dn'];
+      $name = preg_replace("/[ ]/","&nbsp;",$name);
+      $name = "<i>'".$name."'</i>";
+      $all_names .= $name.", ";
+      $cnt --;
+    }
+
+    if(!empty($all_names)){
+      $all_names = preg_replace("/, $/","",$all_names);
+      if(!$cnt){
+        $all_names .= ", ...";
+      }
+      $all_names = "<span style='text-align:left;'>".$all_names."</span>";
+      print_red(sprintf(_("This role can't be removed while it is in use. Follwing objects are using this role %s"),$all_names));
+      return;
+    }
+        
+    $ldap->rmDir($this->dn);
+    new log("remove","aclroles/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    show_ldap_error($ldap->get_error(), sprintf(_("Removing of aclRole with dn '%s' failed."),$this->dn));
+
+    /* Optionally execute a command after we're done */
+    $this->handle_post_events("remove");
+
+    /* Delete references to object groups */
+    $ldap->cd ($this->config->current['BASE']);
+    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
+    while ($ldap->fetch()){
+      $og= new ogroup($this->config, $ldap->getDN());
+      unset($og->member[$this->dn]);
+      $og->save ();
+      show_ldap_error($ldap->get_error(), sprintf(_("Removing aclRole from objectgroup '%s' failed"), $og->dn));
+    }
+  }
+
+
+  function save_object()
+  {
+    plugin::save_object();
+    if(isset($_POST['acl_role_posted'])){
+     
+      /* Get base selection */
+      if(isset($_POST['base'])){
+        $tmp = $this->get_allowed_bases();
+        if(isset($tmp[$_POST['base']])){
+          $this->base = $_POST['base'];
+        }
+      }
+    }
+  }
+
+
+  function saveCopyDialog()
+  {
+    if(isset($_POST['cn'])){
+      $this->cn = $_POST['cn'];
+    }
+  }
+  
+
+  function getCopyDialog()
+  {
+    $smarty = get_smarty();
+    $smarty->assign("cn",$this->cn);
+    $str = $smarty->fetch(get_template_path("paste_role.tpl",TRUE,dirname(__FILE__)));
+    $ret = array();
+    $ret['string'] = $str;
+    $ret['status'] = "";
+    return($ret);
+  }
+
+  
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);
+    
+    $source_o = new aclrole($this->config,$source['dn']);
+    $this->gosaAclTemplate = $source_o->gosaAclTemplate;
+  }
+  
+
+  /* Return plugin informations for acl handling  */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName" => _("Role"),
+          "plDescription" => _("ACL roles"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 0,
+          "plSection"     => array("admin"),
+          "plCategory"    => array("aclroles" => array("objectClass" => "gosaRole", "description" => _("Acl roles"))),
+
+          "plProvidedAcls"    => array(
+            "cn"                => _("Name"),
+            "base"              => _("Base"),
+            "description"       => _("Description"))
+        ));
+  }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/acl/class_divListACL.inc b/gosa-core/plugins/admin/acl/class_divListACL.inc
new file mode 100644 (file)
index 0000000..7da9936
--- /dev/null
@@ -0,0 +1,306 @@
+<?php
+
+class divListACL extends MultiSelectWindow
+{
+
+  /* Current base */
+  var $selectedBase       = "";
+  var $departments        = array();
+
+  /* Regex */
+  var $Regex              = "*";
+
+  /* CheckBoxes */
+
+  /* Subsearch checkbox */
+  var $SubSearch              = false;
+
+  var $parent             ;
+  var $ui                 ;
+  var $action_col_size;
+  
+
+  function divListACL (&$config, &$parent)
+  {
+    MultiSelectWindow::MultiSelectWindow($config, "ACLs", "acl");
+    
+    $this->parent       = &$parent;
+    $this->ui           = get_userinfo();
+
+    /* Set list strings */
+    $this->SetTitle(_("List of acl"));
+    $this->SetSummary(_("List of acls"));
+
+    /* Result page will look like a headpage */
+    $this->SetHeadpageMode();
+    $this->SetInformation(_("This menu allows you to edit and delete selected acls."));
+
+    $this->EnableAplhabet   (true);
+  
+    /* Disable buttonsm */
+    $this->EnableCloseButton(false);
+    $this->EnableSaveButton (false);
+
+    /* Dynamic action col */
+    $this->action_col_size = 120;
+
+    /* Toggle all selected / deselected */
+    $chk = "<input type='checkbox' id='select_all' name='select_all'
+      onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
+
+    /* set Page header */
+    $this->AddHeader(array("string"=> $chk,          "attach"=>"style='width:20px;'"));
+    $this->AddHeader(array("string"=>"&nbsp;",          "attach"=>"style='width:20px;'"));
+    $this->AddHeader(array("string"=>_("Summary")));
+    $this->AddHeader(array("string"=>_("Actions"),      "attach" => "style='width:".$this->action_col_size."px;border-right:0px;text-align:right;'"));
+
+    /* Set dynamically filter checkboxes */
+    $this->set_filter_objectclasses();   
+    /* Add SubSearch checkbox */
+    $this->AddCheckBox("SubSearch",  _("Select to search within subtrees"), _("Ignore subtrees"), false);
+
+
+    /*                  Name                 ,Text                              ,Default  , Connect with alphabet  */
+    $this->AddRegex   ("Regex",     _("Display acls matching"),"*" , true);
+  }
+
+
+  function GenHeader()
+  {
+     /* Prepare departments,
+       which are shown in the listbox on top of the listbox
+     */
+    $options= "";
+    $Copy_Paste = "";
+
+    /* Get all departments within this subtree */
+    $ui= get_userinfo();
+    $first = "";
+    $found = FALSE;
+    $base = $this->config->current['BASE'];
+
+    /* Add base */
+    $tmp = array();
+    $tmp[] = array("dn"=>$this->config->current['BASE']);
+    $tmp=  array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
+                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
+
+    $deps = array();
+    foreach($tmp as $tm){
+      $deps[$tm['dn']] = $tm['dn'];
+    }
+
+    /* Load possible departments */
+    $ui= get_userinfo();
+    $tdeps= $ui->get_module_departments("acl");
+    $ids = $this->config->idepartments;
+    $first = "";
+    $found = FALSE;
+    foreach($ids as $dep => $name){
+      if(isset($deps[$dep]) && in_array_ics($dep, $tdeps)){
+
+        /* Keep first base dn in mind, we could need this
+         *  info if no valid base was found
+         */
+        if(empty($first)) {
+          $first = $dep['dn'];
+        }
+
+        $value = $ids[$dep];
+        if ($this->selectedBase == $dep){
+          $found = TRUE;
+          $options.= "<option selected='selected' value='".$dep."'>$value</option>";
+        } else {
+          $options.= "<option value='".$dep."'>$value</option>";
+        }
+      }
+    }
+
+    /* The currently used base is not visible with your acl setup.
+     * Set base to first useable base.
+     */
+    if(!$found){
+      $this->selectedBase = $first;
+    }
+
+    /* Allow copy & paste for roles */ 
+    $acl_all  = $ui->has_complete_category_acls($this->selectedBase,"acl");
+    $acl      = $ui->get_permissions($this->selectedBase,"acl/acl");
+
+    /* Add default header */
+    $listhead = MultiSelectWindow::get_default_header();
+    $listhead .=  
+      _("Base")."&nbsp;<select name='CurrentMainBase' 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;";
+
+
+    /* Create Layers menu */
+    $s  = ".|"._("Actions")."|\n";
+    $s .= "..|<img src='images/list_new.png' alt='' border='0' class='center'>".
+      "&nbsp;"._("Create")."|\n";
+
+    /* Append create options */
+    if(preg_match("/c/",$acl)) {
+      $s.= "...|<input class='center' type='image' src='images/list_new_acl_role.png' alt=''>".
+        "&nbsp;"._("Role")."|new_acl_role|\n";
+    }
+
+    /* Multiple options */
+    $s.= "..|---|\n";
+    $s.= "..|<img src='images/edittrash.png' alt='' border='0' class='center'>".
+      "&nbsp;"._("Remove")."|"."remove_multiple|\n";
+
+    /* Add multiple copy & cut icons */
+    if(is_object($this->parent->CopyPasteHandler)){
+      $s.= "..|---|\n";
+      $s.= "..|<img src='images/editcopy.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Copy")."|"."multiple_copy_systems|\n";
+      $s.= "..|<img src='images/editcut.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Cut")."|"."multiple_cut_systems|\n";
+
+      if($this->parent->CopyPasteHandler->entries_queued()){
+        $img = "<img border='0' class='center' src='images/editpaste.png' alt=''>";
+        $s.="..|".$img."&nbsp;"._("Paste")."|editPaste|\n";
+      }else{
+        $img = "<img border='0' class='center' src='images/cant_editpaste.png' alt=''>";
+        $s.="..|".$img."&nbsp;"._("Paste")."\n";
+      }
+    }
+
+    /* Add snapshot icons */
+    if(preg_match("/(c.*w|w.*c)/",$acl_all)){
+      $str = $this->get_snapshot_header(TRUE) ;
+      if(!empty($str)){
+        $s .= "..|---|\n";
+        $s .= $str;
+      }
+    }
+
+    $this->SetDropDownHeaderMenu($s);
+    $this->SetListHeader($listhead);
+  }
+
+  /* so some basic settings */
+  function execute()
+  {
+    $this->ClearElementsList();
+    $this->GenHeader();
+  }
+
+  function setEntries($list)
+  {
+
+    foreach($list as $key => $acl_entry){
+
+      /* Get copy & paste icon */
+      $acl        = $this->ui->get_permissions($acl_entry['dn'],"acl/acl");
+      $acl_all    = $this->ui->has_complete_category_acls($acl_entry['dn'],"acl");
+      $action     = "";
+
+      if(in_array("gosaRole",$acl_entry['objectClass'])){
+
+        /* Role handling */
+        $editlink       = "<a href='?plug=".$_GET['plug']."&amp;id=%s&amp;act=list_edit_role'>%s</a>";
+        $list_left_icon = "<img src='images/select_acl_role.png' alt='"._("Role")."'>";
+        $cn = htmlentities(utf8_decode($acl_entry['cn'][0])) ;
+
+        if(isset($acl_entry['description'][0])){
+          $cn .= "&nbsp;[".$acl_entry['description'][0]."]";
+        }
+
+        /* Add copy & paste handler */
+        if(($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
+          $action.= "<input class='center' type='image'
+            src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
+          $action.= "<input class='center' type='image'
+            src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
+        }
+
+        /* Add actions depending on acls */
+        if(preg_match("/r/", $acl)){
+          $action.= "<input class='center' type='image' src='images/edit.png' alt='"._("edit")."'     
+            name='list_acl_role_edit_%KEY%' title='"._("Edit acl role")."'>";
+        }
+
+        /* Add snapshot functionality */
+        if(preg_match("/(c.*w|w.*c)/", $acl_all)){
+          $action.= $this->GetSnapShotActions($acl_entry['dn']);
+        }
+
+        if(preg_match("/d/", $acl)){
+          $action.= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."' 
+            name='list_acl_role_del_%KEY%' title='"._("Delete acl role")."'>";
+        }
+      }else{
+
+        /* Acl handling */
+        $editlink       = "<a href='?plug=".$_GET['plug']."&amp;id=%s&amp;act=list_edit_entry'>%s</a>";
+        $list_left_icon = "<img src='images/select_acl.png' alt='"._("Acl")."'>";
+        $cn = htmlentities(utf8_decode($acl_entry['dn'])); 
+
+        /* Add actions depending on acls */
+        if(preg_match("/r/", $acl)){
+          $action.= "<input class='center' type='image' src='images/edit.png' alt='"._("edit")."'     
+            name='list_acl_edit_%KEY%' title='"._("Edit acl")."'>";
+        }
+        if(preg_match("/d/", $acl)){
+          $action.= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."' 
+            name='list_acl_del_%KEY%' title='"._("Delete acl")."'>";
+        }
+      }
+
+      if(in_array("gosaRole",$acl_entry['objectClass'])){
+        $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
+            "attach" => "style='width:20px;'");
+      }else{
+        $field0 = array("string" => "", "attach" => "style='width:20px;'");
+      }
+
+      /* Cutted objects should be displayed in light grey */
+      $display = $cn;
+      if($this->parent->CopyPasteHandler){
+        foreach($this->parent->CopyPasteHandler->queue as $queue_key => $queue_data){
+          if($queue_data['dn'] == $acl_entry['dn']) {
+            $display = "<font color='#999999'>".$display."</font>";
+            break;
+          }
+        }
+      }
+  
+      $field1 = array("string" => $list_left_icon, "attach"=> "style='text-align:center;width:20px;'");
+      $field2 = array("string" => sprintf($editlink,$key,$display)."&nbsp;","attach" => "");
+      $field3 = array("string" => preg_replace("/%KEY%/",$key,$action), "attach"=> "style='text-align:right;width:".$this->action_col_size."px;border-right:0px;'");
+      $this->AddElement(array($field0,$field1,$field2,$field3));
+    }
+  }
+
+  function Save()
+  {
+    MultiSelectWindow :: Save();  
+  }
+
+  function save_object()
+  {
+    /* Save automatic created POSTs like regex, checkboxes */
+    MultiSelectWindow::save_object();   
+  }
+
+
+  /* Add some additional checkboxes to the filter part, this should be generated dynamically. */
+  function set_filter_objectclasses()
+  { 
+  }
+  
+  /* Return objectClass names used in filter part */  
+  function get_filter_objectclasses()
+  {
+    return(array("gosaAccount","gosaDepartment"));
+  }
+
+
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/acl/main.inc b/gosa-core/plugins/admin/acl/main.inc
new file mode 100644 (file)
index 0000000..bea89a9
--- /dev/null
@@ -0,0 +1,57 @@
+<?php
+/*
+  This code is part of GOsa (https://gosa.gonicus.de)
+  Copyright (C) 2006  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
+*/
+
+if ($remove_lock){
+        if(isset($_SESSION['macl'])){
+                $macl= $_SESSION['macl'];
+                $macl->remove_lock();
+                del_lock ($ui->dn);
+                sess_del ('macl');
+        }
+} else {
+       $display= "No headpage yet for this module";
+
+       /* Create usermanagement object on demand */
+if (!isset($_SESSION['macl']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+       $_SESSION['macl']= new aclManagement($config, $ui);
+       }
+       $macl= $_SESSION['macl'];
+       
+       /* Show and save dialog */
+       $macl->save_object();
+       $output= $macl->execute();
+
+       /* Page header*/
+       if (isset($_SESSION['objectinfo'])){
+               $display= print_header(get_template_path('images/acl.png'), _("ACL management"), "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".@LDAP::fix($_SESSION['objectinfo']));
+       } else {
+               $display= print_header(get_template_path('images/acl.png'), _("ACL management"));
+       }
+
+       /* Reset requested? */
+       if (isset($_GET['reset']) && $_GET['reset'] == 1){
+               del_lock ($ui->dn);
+               sess_del ('macl');
+       }
+
+       $display.= $output;
+       $_SESSION['macl']= $macl;
+}
+?>
diff --git a/gosa-core/plugins/admin/acl/paste_role.tpl b/gosa-core/plugins/admin/acl/paste_role.tpl
new file mode 100644 (file)
index 0000000..41f4577
--- /dev/null
@@ -0,0 +1,10 @@
+<table>
+       <tr>
+               <td>
+                       {t}Name{/t}
+               </td>
+               <td>
+                       <input type="text" name='cn' value="{$cn}" style='width:200px;'>
+               </td>
+       </tr>
+</table>
diff --git a/gosa-core/plugins/admin/acl/remove.tpl b/gosa-core/plugins/admin/acl/remove.tpl
new file mode 100755 (executable)
index 0000000..0b5323d
--- /dev/null
@@ -0,0 +1,23 @@
+<div style="font-size:18px;">
+<img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
+</div>
+<p>
+ {$info}
+ {t}This includes all system and setup informations. 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">
+{if $is_role}
+  <input type=submit name="delete_acl_role_confirmed" value="{t}Delete{/t}">
+  &nbsp;
+  <input type=submit name="delete_acl_role_cancel" value="{t}Cancel{/t}">
+{else}
+  <input type=submit name="delete_acl_confirm" value="{t}Delete{/t}">
+  &nbsp;
+  <input type=submit name="delete_acl_cancel" value="{t}Cancel{/t}">
+{/if}
+</p>
diff --git a/gosa-core/plugins/admin/acl/tabs_acl.inc b/gosa-core/plugins/admin/acl/tabs_acl.inc
new file mode 100644 (file)
index 0000000..db87979
--- /dev/null
@@ -0,0 +1,70 @@
+<?php
+
+class acltab extends tabs
+{
+
+  function acltab($config, $data, $dn)
+  {
+    $data = array(array("CLASS" => "acl" , "NAME" => _("Acl")));
+
+    /* Save dn */
+    $this->dn= $dn;
+    $this->config= $config;
+
+    $baseobject= NULL;
+
+    foreach ($data as $tab){
+      $this->by_name[$tab['CLASS']]= $tab['NAME'];
+
+      
+      if ($baseobject === NULL){
+        if($tab['CLASS'] == "acl"){
+          $baseobject= new $tab['CLASS']($this->config, $this, $this->dn);
+        }else{
+          $baseobject= new $tab['CLASS']($this->config,$this->dn);
+        }
+        $this->by_object[$tab['CLASS']]= $baseobject;
+      } else {
+        if($tab['CLASS'] == "acl"){
+          $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config,$this,$this->dn, $baseobject);
+        }else{
+          $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn, $baseobject);
+        }
+      }
+
+      $this->by_object[$tab['CLASS']]->parent= &$this;
+      $this->by_object[$tab['CLASS']]->set_acl_category("acl");
+
+      /* Initialize current */
+      if ($this->current == ""){
+        $this->current= $tab['CLASS'];
+      }
+    }
+  }
+
+  function save($ignore_account= FALSE)
+  {
+    $ret= tabs::save();
+    return $ret;
+  }
+
+  function save_object($ignore_account= FALSE)
+  {
+    tabs::save_object();
+  }
+  
+  function execute()
+  {
+    $display= tabs::execute();
+    if(!$this->by_object['acl']->dialog){
+      $display.= "<p style=\"text-align:right\">\n";
+      $display.= "  <input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
+      $display.= "  &nbsp;\n";
+      $display.= "  <input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+      $display.= "</p>";
+    }
+    return($display);
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/acl/tabs_acl_role.inc b/gosa-core/plugins/admin/acl/tabs_acl_role.inc
new file mode 100644 (file)
index 0000000..b113235
--- /dev/null
@@ -0,0 +1,61 @@
+<?php
+
+class aclroletab extends tabs
+{
+
+  function aclroletab($config, $data, $dn)
+  {
+    $data = array(array("CLASS" => "aclrole" , "NAME" => _("ACL Templates")));
+    tabs::tabs($config, $data, $dn,"acl");
+  }
+
+  function save($ignore_account= FALSE)
+  {
+    $baseobject= $this->by_object['aclrole'];
+
+    /* Check for new 'dn', in order to propagate the
+       'dn' to all plugins */
+    $new_dn= 'cn='.$baseobject->cn.",ou=aclroles,".$baseobject->base;
+
+    if ($this->dn != $new_dn){
+
+      /* Write entry on new 'dn' */
+      if ($this->dn != "new"){
+        $baseobject->move($this->dn, $new_dn);
+        $this->by_object['aclrole']= $baseobject;
+      }
+
+      /* Happen to use the new one */
+      $this->dn= $new_dn;
+    }
+
+    $ret= tabs::save();
+
+    /* Fix tagging if needed */
+    $baseobject->dn= $new_dn;
+    $baseobject->handle_object_tagging();
+
+    return $ret;
+  }
+
+  function save_object($ignore_account= FALSE)
+  {
+    tabs::save_object();
+  }
+  
+  function execute()
+  {
+    $display= tabs::execute();
+    if(!$this->by_object['aclrole']->dialog){
+      $display.= "<p style=\"text-align:right\">\n";
+      $display.= "  <input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
+      $display.= "  &nbsp;\n";
+      $display.= "  <input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+      $display.= "</p>";
+    }
+    return($display);
+  }
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/applications/class_applicationGeneric.inc b/gosa-core/plugins/admin/applications/class_applicationGeneric.inc
new file mode 100644 (file)
index 0000000..22fcf10
--- /dev/null
@@ -0,0 +1,569 @@
+<?php
+class application extends plugin
+{
+  /* CLI vars */
+  var $cli_summary= "Handling of GOsa's application object";
+  var $cli_description= "Some longer text\nfor help";
+  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* application attributes */
+  var $cn= "";
+  var $description= "";
+  var $base= "";
+  var $gosaApplicationExecute= "";
+  var $gosaApplicationName= "";
+  var $gosaApplicationFlags= "";
+  var $gosaApplicationIcon= "";
+  var $gotoLogonScript ="";
+  var $iconData;
+  var $view_logged = FALSE;
+
+  /* Headpage attributes */
+  var $last_sorting= "invalid";
+  var $applications= array();
+
+  /* attribute list for save action */
+  var $attributes= array("cn", "description", "gosaApplicationExecute", "gosaApplicationName","gosaApplicationIcon",
+      "gosaApplicationFlags","gotoLogonScript");
+  var $objectclasses= array("top", "gosaApplication");
+
+  var $isReleaseApplikation = false;
+
+  function application (&$config, $dn= NULL, $parent= NULL)
+  {
+    plugin::plugin ($config, $dn, $parent);
+
+    $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
+    if(!empty($tmp)) {
+      if(!preg_match("/^ou=apps,/",$_SESSION['appfilter']['release'])){
+        $this->isReleaseApplikation = true;  
+      }
+    }
+
+    /* Load icon */
+    $ldap= $config->get_ldap_link();
+    if ($dn != 'new'){
+      $this->iconData= $ldap->get_attribute($dn, "gosaApplicationIcon");
+      $this->saved_attributes['gosaApplicationIcon'] = $this->iconData;
+    }
+    if ($this->iconData == ""){
+      $this->set_picture("");
+    }
+    $_SESSION['binary']= $this->iconData;
+    $_SESSION['binarytype']= "image/jpeg";
+    $this->gosaApplicationIcon= $this->iconData;
+
+    /* This is always an account */
+    $this->is_account= TRUE;
+
+    if ($this->dn == "new"){
+      if(isset($_SESSION['CurrentMainBase'])){
+        $this->base= $_SESSION['CurrentMainBase'];
+      }else{
+        $ui= get_userinfo();
+        $this->base= dn2base($ui->dn);
+      }
+    } else {
+
+      if($this->isReleaseApplikation){
+        $this->base = preg_replace("/^.*,ou=apps,/","",$this->dn);
+      }else{
+        $this->base= preg_replace ("/^[^,]+,[^,]+,/", "", $this->dn);
+      }
+    }
+  }
+
+
+  function generateTemplate()
+  {
+    $str= "# This code is part of GOsa (https://gosa.gonicus.de)\n#\n";
+
+    $values = array();
+    $names     = array();
+    if($this->parent->by_object['applicationParameters']->is_account){
+      $names = $this->parent->by_object['applicationParameters']->option_name;
+      $values = $this->parent->by_object['applicationParameters']->option_value;
+    }
+
+    if (count($names)){
+      $str .="# This plugin handles these environment variables:\n";
+    } else {
+      $str .="# This plugin handles no environment variables.\n";
+    }
+
+    foreach($names as $index => $name){
+
+      // Fix length
+      for($i = strlen($name) ; $i < 30 ; $i++){
+        $name= $name." ";
+      }
+      if((isset($values[$index]))&&(!empty($values[$index]))){
+        $str.= "# ".$name."\t(e.g. '".$values[$index]."')\n";
+      }else{
+        $str.= "# ".$name."\t("._("no example").")\n";
+      }
+    }
+    $str .= "#\n".
+      "# Don't remove the following tag, it is used for header update.\n".
+      "### END HEADER ###";
+
+    return($str);
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* Log view */
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","application/".get_class($this),$this->dn);
+    }
+
+    $smarty= get_smarty();
+
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+    /* Do we represent a valid group? */
+    if (!$this->is_account && $this->parent === NULL){
+      $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\">&nbsp;<b>".
+        _("This 'dn' is no application.")."</b>";
+      return ($display);
+    }
+
+    /* Download requested */
+    foreach($_POST as $name => $value){
+      if(preg_match("/^downloadScript/",$name)){
+        $_SESSION['binary']       = $this->gotoLogonScript;
+        $_SESSION['binarytype']   = "octet-stream";
+        $_SESSION['binaryfile']   = $this->cn.".gosaApplication";
+        header("location: getbin.php ");
+        exit();
+      }
+    }
+
+    /* Reassign picture data, sometimes its corrupt cause we started a download of application scripts */
+    $_SESSION['binary']     = $this->iconData;
+    $_SESSION['binarytype'] = "image/jpeg";
+    
+    $smarty->assign("rand", rand(0, 10000));
+    $head = $this->generateTemplate();
+    $this->gotoLogonScript= $this->generateTemplate().preg_replace('/.*### END HEADER ###/s', '', $this->gotoLogonScript);
+
+    if((isset($_POST['upLoad']))&&(isset($_FILES['ScriptFile']))){
+      $str = file_get_contents($_FILES['ScriptFile']['tmp_name']);
+      $this->gotoLogonScript = $str;
+    }
+
+    /* Fill templating stuff */
+    $smarty->assign("cn", $this->cn);
+    $smarty->assign("bases", $this->get_allowed_bases());
+    if ($this->dn == "new"){
+      $smarty->assign("selectmode", "");
+      $smarty->assign("namemode", "");
+    } else {
+      $smarty->assign("namemode", "readonly");
+      $smarty->assign("selectmode", "disabled");
+    }
+    
+    /* Base select dialog */
+    $once = true;
+    foreach($_POST as $name => $value){
+      if(preg_match("/^chooseBase/",$name) && $once){
+        $once = false;
+        $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
+        $this->dialog->setCurrentBase($this->base);
+      }
+    }
+
+    /* Dialog handling */
+    if(is_object($this->dialog)){
+      /* Must be called before save_object */
+      $this->dialog->save_object();
+
+      if($this->dialog->isClosed()){
+        $this->dialog = false;
+      }elseif($this->dialog->isSelected()){
+        /* Just allow selection valid bases */ 
+        $tmp = $this->get_allowed_bases();
+        if(isset($tmp[$this->dialog->isSelected()])){
+          $this->base = $this->dialog->isSelected();
+        }
+        $this->dialog= false;
+      }else{
+        return($this->dialog->execute());
+      }
+    }
+
+    /* Get random number for pictures */
+    srand((double)microtime()*1000000);
+    $smarty->assign("rand", rand(0, 10000));
+
+    /* Variables */
+    foreach(array("description", "gosaApplicationExecute", "gosaApplicationName","cn") as $val){
+      $smarty->assign($val, $this->$val);
+    }
+
+    /* Checkboxes */
+    foreach (array("G" => "exec_for_groupmembers", "O" => "overwrite_config",
+          "L" => "place_on_kicker",
+          "D" => "place_on_desktop", "M" => "place_in_startmenu") as $key => $val){
+      if (preg_match("/$key/", $this->gosaApplicationFlags)){
+        $smarty->assign("$val", "checked");
+      } else {
+        $smarty->assign("$val", "");
+      }
+    }
+
+    $smarty->assign("isReleaseApplikation" , $this->isReleaseApplikation);
+    $smarty->assign("gotoLogonScript",htmlentities($this->gotoLogonScript, ENT_COMPAT, 'UTF-8'));
+    $smarty->assign("base_select", $this->base);
+    /* Show main page */
+    return($smarty->fetch (get_template_path('generic.tpl', TRUE)));
+  }
+
+
+  function remove_from_parent()
+  {
+    $ldap= $this->config->get_ldap_link();
+    $ldap->rmDir($this->dn);
+    new log("remove","application/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    show_ldap_error($ldap->get_error(), sprintf(_("Removing of application with dn '%s' failed."),$this->dn));
+
+    /* Optionally execute a command after we're done */
+    $this->handle_post_events("remove");
+
+    /* Delete references to object groups */
+    $ldap->cd ($this->config->current['BASE']);
+    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
+    while ($ldap->fetch()){
+      $og= new ogroup($this->config, $ldap->getDN());
+      unset($og->member[$this->dn]);
+      $og->save ();
+      show_ldap_error($ldap->get_error(), sprintf(_("Removing application from objectgroup '%s' failed"), $og->dn));
+    }
+    $ldap->search ("(&(objectClass=posixGroup)(gosaMemberApplication=".$this->cn."))", array("cn"));
+    while ($attrs= $ldap->fetch()){
+      $ag= new appgroup($this->config, $ldap->getDN());
+      $ag->removeApp($this->cn);
+      $ag->save ();
+      show_ldap_error($ldap->get_error(), sprintf(_("Removing application from group '%s' failed"), $ag->dn));
+    }
+
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    if (isset($_POST['cn'])){
+
+      /* Create a base backup and reset the
+         base directly after calling plugin::save_object();
+         Base will be set seperatly a few lines below */
+      $base_tmp = $this->base;
+      plugin::save_object();
+      $this->base = $base_tmp;
+
+      /* Save attributes */
+      parent::save_object();
+
+      /* Save application flags */
+      $flag= "";
+      if (isset($_POST['exec_for_groupmembers']) && $_POST['exec_for_groupmembers'] == 1){
+        $flag.= "G";
+      }
+      if (isset($_POST['place_on_desktop']) && $_POST['place_on_desktop'] == 1){
+        $flag.= "D";
+      }
+      if (isset($_POST['place_on_kicker']) && $_POST['place_on_kicker'] == 1){
+        $flag.= "L";
+      }
+      if (isset($_POST['place_in_startmenu']) && $_POST['place_in_startmenu'] == 1){
+        $flag.= "M";
+      }
+      if (isset($_POST['overwrite_config']) && $_POST['overwrite_config'] == 1){
+        $flag.= "O";
+      }
+      if ($this->acl_is_writeable("gosaApplicationFlags")){
+        $this->gosaApplicationFlags= "[$flag]";
+      }
+
+      /* Remove current picture */
+      if(isset($_POST['remove_picture'])){
+        $this->set_picture("");
+      }
+
+      /* Check for picture upload */
+      if (isset($_FILES['picture_file']['name']) && $_FILES['picture_file']['name'] != ""){
+
+        if (!is_uploaded_file($_FILES['picture_file']['tmp_name'])) {
+          print_red (_("The specified picture has not been uploaded correctly."));
+        }
+
+        if (!function_exists("imagick_blob2image")){
+          /* Get temporary file name for conversation */
+          $fname = tempnam ("/tmp", "GOsa");
+
+          /* Open file and write out photoData */
+          $fp = fopen ($fname, "w");
+          fwrite ($fp, $_FILES['picture_file']['tmp_name']);
+          fclose ($fp);
+
+          /* Build conversation query. Filename is generated automatically, so
+             we do not need any special security checks. Exec command and save
+             output. For PHP safe mode, you'll need a configuration which respects
+             image magick as executable... */
+          $query= "convert -size 48x48 $fname -resize 48x48 +profile \"*\" -";
+          @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $query, "Execute");
+
+          /* Read data written by convert */
+          $output= "";
+          $sh= popen($query, 'r');
+          while (!feof($sh)){
+            $output.= fread($sh, 4096);
+          }
+          pclose($sh);
+
+          unlink($fname);      
+        } else {
+
+          /* Load the new uploaded Photo */
+          if(!$handle  =  imagick_ReadImage($_FILES['picture_file']['tmp_name'])){
+            print_red(_("Can't access uploaded image."));
+          }
+
+          /* Resizing image to 147x200 and blur */
+          if(!imagick_resize($handle,48,48,IMAGICK_FILTER_GAUSSIAN,0)){
+            print_red(_("Uploaded image could not be resized, possilby the image magick extension is missing."));
+          }
+
+          /* Converting image to JPEG */
+          if(!imagick_convert($handle,"PNG")) {
+            print_red(_("Could not convert image to png, possilby the image magick extension is missing."));
+          }
+
+          if(!imagick_writeimage($handle,$_FILES['picture_file']['tmp_name'])){
+            print_red(sprintf(_("Could not save uploaded image to %s."),$_FILES['picture_file']['tmp_name']));
+          }
+
+          imagick_free($handle);
+        }
+
+        /* Activate new picture */
+        $this->set_picture($_FILES['picture_file']['tmp_name']);
+      }        
+
+      if(!$this->isReleaseApplikation){
+        $tmp = $this->get_allowed_bases();
+        if(isset($_POST['base'])){
+          if(isset($tmp[$_POST['base']])){
+            $this->base= $_POST['base'];
+          }
+        }
+      }
+    }
+  }
+
+
+  /* Check values */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    if(!preg_match("#^/#",$this->gosaApplicationExecute)){
+      $message[]=(_("Specified execute path must start with '/'."));
+    }
+
+    /* Permissions for that base? */
+    if ($this->base != ""){
+      $new_dn= "cn=".$this->cn.",ou=apps,".$this->base;
+    } else {
+      $new_dn= $this->dn;
+    }
+
+
+    if($this->dn == "new"){
+      $this->set_acl_base($this->base);
+    }
+
+    /* All required fields are set? */
+    if ($this->cn == ""){
+      $message[]= _("Required field 'Name' is not filled.");
+    }
+
+    if(preg_match("/[^a-z0-9]/",$this->cn))    {
+      $message[]=_("Invalid character in application name. Only a-z 0-9 are allowed.");
+    }
+
+    if ($this->gosaApplicationExecute == ""){
+      $message[]= _("Required field 'Execute' is not filled.");
+    }
+
+    /* Check for existing application */
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd($this->config->current["BASE"]);
+
+    $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
+    if((!empty($tmp)) && (isset($_SESSION['appfilter']['release']))){
+      $baseDn = str_replace($this->config->current['BASE'],$this->base,$_SESSION['appfilter']['release']);
+      $baseDn = preg_replace("/ou=apps,.*/","ou=apps,".$this->base,$_SESSION['appfilter']['release']);
+      $ldap->ls("(&(objectClass=gosaApplication)(cn=".$this->cn."))",$baseDn,array("cn"));
+      if($ldap->count()){
+        $attrs = $ldap->fetch();
+        if($this->dn != $attrs['dn']) {
+          $message[]= _("There's already an application with this 'Name'.");
+        }
+      }
+    }else{
+      $ldap->ls("(&(objectClass=gosaApplication)(cn=".$this->cn."))","ou=apps,".$this->base,array("cn"));
+      if ($ldap->count()){
+        $attrs = $ldap->fetch();
+        if($this->dn != $attrs['dn']) {
+          $message[]= _("There's already an application with this 'Name'.");
+        }
+      }
+    }
+    return $message;
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    /* Get application script without header part, to check if we must save the script itself */
+    $script = preg_replace('/.*### END HEADER ###/s', '', $this->gotoLogonScript);
+
+    plugin::save();
+    $this->attrs["gosaApplicationIcon"]= $this->gosaApplicationIcon;
+
+    /* Write back to ldap */
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cat($this->dn, array('dn'));
+
+    $a= $ldap->fetch();
+    if (count($a)){
+
+      /* Remove gotoLogonScript if it is empty */
+      if(empty($script))    {
+        $this->attrs['gotoLogonScript'] = array();
+      }
+
+      $ldap->cd($this->dn);
+      $this->cleanup();
+      $ldap->modify ($this->attrs); 
+      $this->handle_post_events("modify");
+      new log("modify","application/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    } else {
+      
+      /* Remove gotoLogonScript if it is empty */
+      if(empty($script))    {
+        unset($this->attrs['gotoLogonScript']);
+      }
+
+      $ldap->cd($this->config->current['BASE']);
+      $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
+      $ldap->cd($this->dn);
+      $ldap->add($this->attrs);
+      new log("create","application/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+      $this->handle_post_events("add");
+    }
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of application with dn '%s' failed."),$this->dn));
+  }
+
+  function set_picture($filename)
+  {
+    if (!is_file($filename)){
+      $filename= "./images/default_icon.png";
+      $this->gosaApplicationIcon= "*removed*";
+    }
+
+    if (file_exists($filename)){
+      $fd = fopen ($filename, "rb");
+      $this->iconData= fread ($fd, filesize ($filename));
+      $_SESSION['binary']= $this->iconData;
+      $_SESSION['binarytype']= "image/jpeg";
+      $this->gosaApplicationIcon= $this->iconData;
+
+      fclose ($fd);
+    }
+  }
+
+  function getCopyDialog()
+  {
+    $vars = array("cn");
+
+    $str ="<h2>"._("Application settings")."</h2>
+      <table>
+      <tr>
+      <td>".
+      _("Application name"). 
+      "</td>  
+      <td>
+      <input id='gosaApplicationName' name='cn' size='35' maxlength='60' 
+      value='".$this->cn."' 
+      title='"._("Application name to be displayed (i.e. below icons)")."'>                     
+      </td>
+      </tr>
+      </table>";
+    $ret = array();
+    $ret['status'] = "";
+    $ret['string'] = $str;
+    return($ret);
+  }
+
+  function saveCopyDialog()
+  {
+    if(isset($_POST['cn'])){
+      $this->cn = $_POST['cn'];
+    }
+  }
+
+
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);
+    $source_o = new application($this->config,$source['dn']);
+    $this->gosaApplicationIcon = $source_o->gosaApplicationIcon;     
+  }
+
+
+  /* Return plugin informations for acl handling
+      #FIXME FAIscript seams to ununsed within this class... */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Generic"),
+          "plDescription" => _("Application generic"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 0,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("application" => array("description"  => _("Application"),
+                                                          "objectClass"  => "gosaApplication")),
+          "plProvidedAcls"=> array(
+            "cn"                => _("Name"),
+            "base"              => _("Base"),
+            "description"       => _("Description"),
+            "gosaApplicationExecute"  => _("Execute"),
+            "gosaApplicationName"     => _("Name"),
+            "gosaApplicationIcon"     => _("Icon"),
+            "gosaApplicationFlags"    => _("Flag"),
+            "gotoLogonScript"         => _("Script content"),
+
+            "exec_for_groupmembers" => _("Only executable for members"),              // G
+            "place_on_desktop"      => _("Place icon on members desktop"),            // D
+            "place_on_kicker"       => _("Place entry in members launch bar"),        // L
+            "place_in_startmenu"    => _("Place entry in members startmenu"),         // M
+            "overwrite_config"      => _("Replace user configuration on startup"))  // O
+            ));
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/applications/class_applicationManagement.inc b/gosa-core/plugins/admin/applications/class_applicationManagement.inc
new file mode 100644 (file)
index 0000000..69a4c0f
--- /dev/null
@@ -0,0 +1,645 @@
+<?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 applicationManagement extends plugin
+{
+  /* Definitions */
+  var $plHeadline     = "Applications";
+  var $plDescription  = "This does something";
+
+  /* Dialog attributes */
+  var $apptabs                  = NULL;
+  var $ui                       = NULL;
+  var $CopyPasteHandler         = NULL;
+  var $DivListApplication       = NULL;
+  var $applications             = array();
+  var $enableReleaseManagement  = false;
+  var $start_pasting_copied_objects = FALSE;
+
+  function IsReleaseManagementActivated()
+  {
+    /* Check if we should enable the release selection */
+    $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
+    if(!empty($tmp)){
+      return(true);
+    }
+    return(false);
+  }
+
+  function applicationManagement (&$config, &$ui)
+  {
+    /* Save configuration for internal use */
+    $this->config   = &$config;
+    $this->ui       = &$ui;
+
+    /* Check if copy & paste is activated */
+    if($this->config->boolValueIsTrue("MAIN","ENABLECOPYPASTE")){
+      $this->CopyPasteHandler = new CopyPasteHandler($this->config);
+    }
+
+    /* Creat dialog object */
+    $this->DivListApplication = new divListApplication($this->config,$this);
+
+    if($this->IsReleaseManagementActivated()){
+    /* Check if we should enable the release selection */
+      $this->enableReleaseManagement = true;
+
+      /* Hide SubSearch checkbox */
+      $this->DivListApplication->DisableCheckBox("SubSearch");
+    }
+  }
+
+  function getReleases($base)
+  {
+    $ldap                   = $this->config->get_ldap_link();
+    $dn                     = "ou=apps,".$base;
+    $ret                    = array();
+    $ret ["ou=apps,".$base] = "/";
+
+    $ldap->cd($dn);
+    $ldap->search("objectClass=organizationalUnit",array("ou"));
+
+    while($attrs = $ldap->fetch()){
+      $str = str_replace($dn,"",$attrs['dn']);
+      $tmp = array_reverse( split("ou=",$str));
+      $str = "";
+      foreach($tmp as $val){
+        $val = trim(preg_replace("/,/","",$val));
+        if(empty($val)) break;
+        $str .= "/".$val;
+      } 
+      if(!empty($str)){
+        $ret[$attrs['dn']]= preg_replace("/^\//","",$str);
+      }
+    }
+    asort($ret);
+    return($ret);
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+
+    /**************** 
+      Variable init 
+     ****************/
+
+    /* These vars will be stored if you try to open a locked app, 
+        to be able to perform your last requests after showing a warning message */
+    $_SESSION['LOCK_VARS_TO_USE'] = array("/^act$/","/^id$/","/^appl_edit_/","/^appl_del_/","/^item_selected/","/^remove_multiple_applications/");
+
+    $smarty       = get_smarty();             // Smarty instance
+    $s_action     = "";                       // Contains the action to proceed
+    $s_entry      = "";                       // The value for s_action
+    $base_back    = "";                       // The Link for Backbutton
+    
+    /* Test Posts */
+    foreach($_POST as $key => $val){
+      // Post for delete
+      if(preg_match("/appl_del.*/",$key)){
+        $s_action = "del";
+        $s_entry  = preg_replace("/appl_".$s_action."_/i","",$key);
+        // Post for edit
+      }elseif(preg_match("/appl_edit_.*/",$key)){
+        $s_action="edit";
+        $s_entry  = preg_replace("/appl_".$s_action."_/i","",$key);
+        // Post for new
+      }elseif(preg_match("/^copy_.*/",$key)){
+        $s_action="copy";
+        $s_entry  = preg_replace("/^copy_/i","",$key);
+      }elseif(preg_match("/^cut_.*/",$key)){
+        $s_action="cut";
+        $s_entry  = preg_replace("/^cut_/i","",$key);
+        // Post for new
+      }elseif(preg_match("/^appl_new.*/",$key)){
+        $s_action="new";
+      }elseif(preg_match("/^remove_multiple_applications/",$key)){
+        $s_action="del_multiple";
+      }elseif(preg_match("/^editPaste.*/i",$key)){
+        $s_action="editPaste";
+      }elseif(preg_match("/^multiple_copy_groups/",$key)){
+        $s_action = "copy_multiple";
+      }elseif(preg_match("/^multiple_cut_groups/",$key)){
+        $s_action = "cut_multiple";
+      }
+    }
+
+    if((isset($_GET['act']))&&($_GET['act']=="edit_entry")){
+      $s_action ="edit";
+      $s_entry  = $_GET['id'];
+    }
+
+    $s_entry  = preg_replace("/_.$/","",$s_entry);
+
+
+    /* handle C&P from layers menu */
+    if(isset($_POST['menu_action']) && preg_match("/^multiple_copy_systems/",$_POST['menu_action'])){
+      $s_action = "copy_multiple";
+    }
+    if(isset($_POST['menu_action']) && preg_match("/^multiple_cut_systems/",$_POST['menu_action'])){
+      $s_action = "cut_multiple";
+    }
+    if(isset($_POST['menu_action']) && preg_match("/^editPaste/",$_POST['menu_action'])){
+      $s_action = "editPaste";
+    }
+
+    /* Create options */
+    if(isset($_POST['menu_action']) && $_POST['menu_action'] == "appl_new"){
+      $s_action = "new";
+    }
+
+    /* handle remove from layers menu */
+    if(isset($_POST['menu_action']) && preg_match("/^remove_multiple/",$_POST['menu_action'])){
+      $s_action = "del_multiple";
+    }
+
+    /**************** 
+      Copy & Paste handling  
+     ****************/
+
+    /* Display the copy & paste dialog, if it is currently open */
+    $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
+    if($ret){
+      return($ret);
+    }
+
+    /**************** 
+      Create a new app 
+     ****************/
+
+    /* New application? */
+    if ($s_action=="new"){
+
+      /* By default we set 'dn' to 'new', all relevant plugins will
+         react on this. */
+      $this->dn= "new";
+
+      /* Create new usertab object */
+      $this->apptabs= new apptabs($this->config,$this->config->data['TABS']['APPSTABS'], $this->dn,"application");
+      $this->apptabs->set_acl_base($this->DivListApplication->selectedBase);
+    }
+
+
+    /**************** 
+      Edit entry canceled 
+     ****************/
+
+    /* Cancel dialogs */
+    if (isset($_POST['edit_cancel']) || isset($_POST['password_cancel'])){
+      del_lock ($this->apptabs->dn);
+      unset ($this->apptabs);
+      $this->apptabs= NULL;
+      unset ($_SESSION['objectinfo']);
+    }
+
+
+    /**************** 
+      Edit entry finished 
+     ****************/
+
+    /* Finish apps edit is triggered by the tabulator dialog, so
+       the user wants to save edited data. Check and save at this
+       point. */
+    if ((isset($_POST['edit_finish']) || isset($_POST['edit_apply']) ) && (isset($this->apptabs->config))){
+
+      /* Check tabs, will feed message array */
+      $this->apptabs->last= $this->apptabs->current;
+      $this->apptabs->save_object();
+      $message= $this->apptabs->check();
+
+      /* Save, or display error message? */
+      if (count($message) == 0){
+
+        /* Save data data to ldap */
+        $this->apptabs->set_release($this->DivListApplication->selectedRelease);
+        $this->apptabs->save();
+
+        if (!isset($_POST['edit_apply'])){
+          /* Application has been saved successfully, remove lock from
+             LDAP. */
+          if ($this->dn != "new"){
+            del_lock ($this->dn);
+          }
+          unset ($this->apptabs);
+          $this->apptabs= NULL;
+          unset ($_SESSION['objectinfo']);
+        }
+      } else {
+        /* Ok. There seem to be errors regarding to the tab data,
+           show message and continue as usual. */
+        show_errors($message);
+      }
+    }
+
+
+    /**************** 
+      Edit entry  
+     ****************/
+
+    /* User wants to edit data? */
+    if (($s_action=="edit") && (!isset($this->apptabs->config))){
+
+      /* Get 'dn' from posted 'applist', must be unique */
+      $this->dn= $this->applications[$s_entry]['dn'];
+
+      /* Check locking, save current plugin in 'back_plugin', so
+         the dialog knows where to return. */
+      if (($user= get_lock($this->dn)) != ""){
+        return(gen_locked_message ($user, $this->dn));
+      }
+
+      /* Lock the current entry, so everyone will get the
+         above dialog */
+      add_lock ($this->dn, $this->ui->dn);
+
+      /* Register apptabs to trigger edit dialog */
+      $this->apptabs= new apptabs($this->config,$this->config->data['TABS']['APPSTABS'], $this->dn,"application");
+      $this->apptabs->set_acl_base($this->dn);
+      $_SESSION['objectinfo']= $this->dn;
+    }
+
+
+
+    /********************
+      Delete MULTIPLE entries requested, display confirm dialog
+     ********************/
+
+    if ($s_action=="del_multiple"){
+      $ids = $this->list_get_selected_items();
+
+      if(count($ids)){
+
+        foreach($ids as $id){
+          $dn = $this->applications[$id]['dn'];
+          if (($user= get_lock($dn)) != ""){
+            return(gen_locked_message ($user, $dn));
+          }
+          $this->dns[$id] = $dn;
+        }
+
+        $dns_names = "<br><pre>";
+        foreach($this->dns as $dn){
+          add_lock ($dn, $this->ui->dn);
+          $dns_names .= $dn."\n";
+        }
+        $dns_names .="</pre>";
+
+        /* Lock the current entry, so nobody will edit it during deletion */
+        if (count($this->dns) == 1){
+          $smarty->assign("intro",     sprintf(_("You're about to delete the following entry %s"), @LDAP::fix($dns_names)));
+        } else {
+          $smarty->assign("intro",     sprintf(_("You're about to delete the following entries %s"), @LDAP::fix($dns_names)));
+        }
+        $smarty->assign("multiple", true);
+        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+      }
+    }
+
+
+    /********************
+      Delete MULTIPLE entries confirmed
+     ********************/
+
+    /* Confirmation for deletion has been passed. Users should be deleted. */
+    if (isset($_POST['delete_multiple_application_confirm'])){
+
+      /* Remove user by user and check acls before removeing them */
+      foreach($this->dns as $key => $dn){
+
+        $ui = get_userinfo();
+        $acl = $ui->get_permissions($dn ,"application/application");
+        if (preg_match('/d/', $acl)){
+
+          /* Delete request is permitted, perform LDAP action */
+          $this->apptabs= new apptabs($this->config, $this->config->data['TABS']['APPSTABS'], $dn,"application");
+          $this->apptabs->set_acl_base($dn);
+          $this->apptabs->delete ();
+          unset ($this->apptabs);
+          $this->apptabs= NULL;
+
+        } else {
+          /* Normally this shouldn't be reached, send some extra
+             logs to notify the administrator */
+          print_red (_("You are not allowed to delete this application!"));
+          new log("security","application/".get_class($this),$dn,array(),"Tried to trick deletion.");
+        }
+        /* Remove lock file after successfull deletion */
+        del_lock ($dn);
+        unset($this->dns[$key]);
+      }
+    }
+
+
+    /********************
+      Delete MULTIPLE entries Canceled
+     ********************/
+
+    /* Remove lock */
+    if(isset($_POST['delete_multiple_application_cancel'])){
+      foreach($this->dns as $key => $dn){
+        del_lock ($dn);
+        unset($this->dns[$key]);
+      }
+    }
+
+    /**************** 
+      Delete app 
+     ****************/
+
+    /* Remove user was requested */
+    if ($s_action == "del"){
+
+      /* Get 'dn' from posted 'uid' */
+      $this->dn= $this->applications[$s_entry]['dn'];
+
+      /* Load permissions for selected 'dn' and check if
+         we're allowed to remove this 'dn' */
+      $ui = get_userinfo();
+      $acl = $ui->get_permissions($this->dn ,"application/application");
+
+      if(preg_match("/d/",$acl)){
+        /* Check locking, save current plugin in 'back_plugin', so
+           the dialog knows where to return. */
+        if (($user= get_lock($this->dn)) != ""){
+          return (gen_locked_message ($user, $this->dn));
+        }
+
+        /* Lock the current entry, so nobody will edit it during deletion */
+        add_lock ($this->dn, $this->ui->dn);
+        $smarty= get_smarty();
+        $smarty->assign("intro", sprintf(_("You're about to delete the application '%s'."), @LDAP::fix($this->dn)));
+        $smarty->assign("multiple", false);
+        return($smarty->fetch (get_template_path('remove.tpl', TRUE)));
+      } else {
+
+        /* Obviously the user isn't allowed to delete. Show message and
+           clean session. */
+        print_red (_("You are not allowed to delete this application!"));
+      }
+    }
+
+
+    /**************** 
+      Delete app confirmed 
+     ****************/
+
+    /* Confirmation for deletion has been passed. Group should be deleted. */
+    if (isset($_POST['delete_app_confirm'])){
+
+      /* Some nice guy may send this as POST, so we've to check
+         for the permissions again. */
+      $ui = get_userinfo();
+      $acl = $ui->get_permissions($this->dn ,"application/application");
+
+      if(preg_match("/d/",$acl)){
+
+        /* Delete request is permitted, perform LDAP action */
+        $this->apptabs= new apptabs($this->config, $this->config->data['TABS']['APPSTABS'], $this->dn,"application");
+        $this->apptabs->set_acl_base($this->dn);
+        $this->apptabs->delete ();
+        unset ($this->apptabs);
+        $this->apptabs= NULL;
+
+      } else {
+
+        /* Normally this shouldn't be reached, send some extra
+           logs to notify the administrator */
+        print_red (_("You are not allowed to delete this application!"));
+        new log("security","application/".get_class($this),$dn,array(),"Tried to trick deletion.");
+      }
+
+      /* Remove lock file after successfull deletion */
+      del_lock ($this->dn);
+    }
+
+
+    /**************** 
+      Delete app canceled 
+     ****************/
+
+    /* Delete application canceled? */
+    if (isset($_POST['delete_cancel'])){
+      del_lock ($this->dn);
+      unset($_SESSION['objectinfo']);
+    }
+
+    /* Show tab dialog if object is present */
+    if (($this->apptabs) && (isset($this->apptabs->config))){
+      $display= $this->apptabs->execute();
+
+      /* Don't show buttons if tab dialog requests this */
+      if (!$this->apptabs->by_object[$this->apptabs->current]->dialog){
+        $display.= "<p style=\"text-align:right\">\n";
+        $display.= "<input type=\"submit\" name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
+        $display.= "&nbsp;\n";
+        if ($this->dn != "new"){
+          $display.= "<input type=submit name=\"edit_apply\" value=\""._("Apply")."\">\n";
+          $display.= "&nbsp;\n";
+        }
+        $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+        $display.= "</p>";
+      }
+      return ($display);
+    }
+
+
+    /****************
+      Dialog display
+     ****************/
+
+    /* Check if there is a snapshot dialog open */
+    $base = $this->DivListApplication->selectedBase;
+    if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases($base))){
+      return($str);
+    }
+
+    /* Display dialog with system list */
+    $this->DivListApplication->parent = $this;
+    $this->DivListApplication->execute();
+    $this->DivListApplication->AddDepartments($this->DivListApplication->selectedBase,3,1);
+    $this->reload();
+    $this->DivListApplication->setEntries($this->applications);
+    return($this->DivListApplication->Draw());
+  }
+
+
+  /* Return departments, that will be included within snapshot detection */
+  function get_used_snapshot_bases(){
+    if($this->DivListApplication->selectedRelease == "main"){
+      return(array($this->DivListApplication->selectedBase));
+    }else{
+      return(array($this->DivListApplication->selectedRelease));
+    }
+  }
+
+
+  function reload()
+  {
+    $this->applications= array();
+
+    /* Set base for all searches */
+    $base       = $this->DivListApplication->selectedBase;
+    $release    = $this->DivListApplication->selectedRelease;
+    $Regex      = $this->DivListApplication->Regex;
+    $SubSearch  = $this->DivListApplication->SubSearch; 
+    $Flags      =  GL_NONE | GL_SIZELIMIT;
+    $Filter     = "(&(cn=".$Regex.")(objectClass=gosaApplication))";
+    $tmp        = array();
+    $Releases   = $this->getReleases($base);
+
+    if(!$this->enableReleaseManagement){
+      $use_base = "ou=apps,".$base;
+    }else{
+      if(isset($Releases[$release])){
+        $use_base  = $release;
+      }else{
+        $use_base  = "ou=apps,".$base;
+      }
+    }
+
+    if($SubSearch){
+      $Flags    |= GL_SUBSEARCH;  
+    }
+   
+    $res= get_list($Filter, "application", $use_base, array("cn","description","dn","objectClass"), $Flags);
+    foreach ($res as $val){
+      $tmp[strtolower($val['cn'][0]).$val['cn'][0].$val['dn']]=$val;
+    }
+
+    ksort($tmp);
+    $this->applications=array();
+    foreach($tmp as $val){
+      $this->applications[]=$val;
+    }
+    reset ($this->applications);
+  }
+
+  function remove_from_parent()
+  {
+    /* Optionally execute a command after we're done */
+    $this->postremove();
+  }
+
+
+  function copyPasteHandling_from_queue($s_action,$s_entry)
+  {
+    /* Check if Copy & Paste is disabled */
+    if(!is_object($this->CopyPasteHandler)){
+      return("");
+    }
+
+    /* Add a single entry to queue */
+    if($s_action == "cut" || $s_action == "copy"){
+
+      /* Cleanup object queue */
+      $this->CopyPasteHandler->cleanup_queue();
+      $dn = $this->applications[$s_entry]['dn'];
+      $this->CopyPasteHandler->add_to_queue($dn,$s_action,"apptabs","APPSTABS","application");
+    }
+
+
+    /* Add entries to queue */
+    if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
+
+      /* Cleanup object queue */
+      $this->CopyPasteHandler->cleanup_queue();
+
+      /* Add new entries to CP queue */
+      foreach($this->list_get_selected_items() as $id){
+        $dn = $this->applications[$id]['dn'];
+
+        if($s_action == "copy_multiple"){
+          $this->CopyPasteHandler->add_to_queue($dn,"copy","apptabs","APPSTABS","application");
+        }
+        if($s_action == "cut_multiple"){
+          $this->CopyPasteHandler->add_to_queue($dn,"cut","apptabs","APPSTABS","application");
+        }
+      }
+    }
+
+    /* Start pasting entries */
+    if($s_action == "editPaste"){
+      $this->start_pasting_copied_objects = TRUE;
+    }
+
+
+    /* Return C&P dialog */
+    if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
+
+      /* Load entry from queue and set base */
+      $this->CopyPasteHandler->load_entry_from_queue();
+      $this->CopyPasteHandler->SetVar("base",$this->DivListApplication->selectedBase);
+
+      /* Get dialog */
+      $data = $this->CopyPasteHandler->execute();
+
+      /* Return dialog data */
+      if(!empty($data)){
+        return($data);
+      }
+    }
+
+    /* Automatically disable status for pasting */
+    if(!$this->CopyPasteHandler->entries_queued()){
+      $this->start_pasting_copied_objects = FALSE;
+    }
+    return("");
+  }
+
+
+  function list_get_selected_items()
+  {
+    $ids = array();
+    foreach($_POST as $name => $value){
+      if(preg_match("/^item_selected_[0-9]*$/",$name)){
+        $id   = preg_replace("/^item_selected_/","",$name);
+        $ids[$id] = $id;
+      }
+    }
+    return($ids);
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    /* Optionally execute a command after we're done */
+    $this->postcreate();
+  }
+
+  function remove_lock()
+  {
+    if (isset($this->apptabs->dn)){
+      del_lock ($this->apptabs->dn);
+    }
+  }
+
+  function save_object() {
+    $this->DivListApplication->save_object();
+  }
+
+  function check() {}
+  function adapt_from_template($dn) {}
+  function password_change_needed() {}
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/applications/class_applicationParameters.inc b/gosa-core/plugins/admin/applications/class_applicationParameters.inc
new file mode 100644 (file)
index 0000000..9f11eb6
--- /dev/null
@@ -0,0 +1,248 @@
+<?php
+class applicationParameters extends plugin
+{
+  /* CLI vars */
+  var $cli_summary= "Manage application class parameters";
+  var $cli_description= "Some longer text\nfor help";
+  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* Parameters  */
+  var $option_name= array();
+  var $option_value= array();
+
+  /* attribute list for save action */
+  var $attributes= array("gosaApplicationParameter");
+  var $objectclasses= array();
+
+  var $CopyPasteVars = array("option_name","option_value");
+
+  function applicationParameters (&$config, $dn= NULL, $parent= NULL)
+  {
+    plugin::plugin ($config, $dn, $parent);
+
+    $this->gosaApplicationParameter = array();
+
+    if (isset($this->attrs['gosaApplicationParameter'])){
+      $this->is_account= TRUE;
+      for ($i= 0; $i<$this->attrs['gosaApplicationParameter']['count']; $i++){
+        $option= preg_replace('/^[^:]+:/', '',
+            $this->attrs['gosaApplicationParameter'][$i]);
+        $name= preg_replace('/:.*$/', '',
+            $this->attrs['gosaApplicationParameter'][$i]);
+        $this->option_name[$i]= $name;
+        $this->option_value[$i]= $option;
+      }
+    } else {
+      $this->is_account= FALSE;
+    }
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* Do we need to flip is_account state? */
+    if (isset($_POST['modify_state'])){
+      $this->is_account= !$this->is_account;
+    }
+
+    /* Show tab dialog headers */
+    $display= "";
+    if ($this->parent !== NULL){
+      if ($this->is_account){
+        $display= $this->show_disable_header(_("Remove options"),
+            _("This application has options. You can disable them by clicking below."));
+      } else {
+        $display= $this->show_enable_header(_("Create options"),
+            _("This application has options disabled. You can enable them by clicking below."));
+        $this->parent->by_object['application']->generateTemplate();
+        return ($display);
+      }
+    }
+
+    /* Add option to list */
+    if (isset($_POST['add_option'])){
+      $i= count($this->option_name);
+      $this->option_name[$i]= "";
+      $this->option_value[$i]= "";
+    }
+
+    /* Remove value from list */
+    for ($i= 0; $i<count($this->option_name); $i++){
+      if (isset($_POST["remove$i"])){
+        $k= 0;
+        $on= array();
+        $ov= array();
+        for ($j= 0; $j<count($this->option_name); $j++){
+          if ($j != $i){
+            $on[$k]= $this->option_name[$j];
+            $ov[$k]= $this->option_value[$j];
+            $k++;
+          }
+        }
+        $this->option_name= $on;
+        $this->option_value= $ov;
+        break;
+      }
+    }
+
+    /* Generate list of attributes */
+    if (count($this->option_name) == 0){
+      $this->option_name[]= "";
+      $this->option_value[]= "";
+    }
+
+
+    $acl = $this->getacl("gosaApplicationParameter")   ;
+    $table= "<table summary=\"\"><tr><td>"._("Variable")."</td><td>"._("Default value")."</td><td></td></tr>";
+    if (count ($this->option_name)){
+
+      for ($i= 0; $i < count($this->option_name); $i++){
+        $name = $this->option_name[$i];
+        $value= $this->option_value[$i];
+
+        $tag = "";
+        if(!preg_match("/w/",$acl)){
+          $tag = " disabled ";
+        }
+
+        if(!preg_match("/r/",$acl)){
+          $name = "";
+          $value= "";
+        }
+
+        $table.="<tr>".
+          " <td>".
+          "  <input name=\"option$i\" size=25 maxlength=50 value=\"".$name."\" ".$tag.">".
+          " </td>".
+          " <td>".
+          "  <input name=\"value$i\" size=60 maxlength=250 value=\"".$value."\" ".$tag.">".
+          "  <br>".
+          " </td>".
+          " <td>".
+          "  <input type=\"submit\" name=\"remove$i\" value=\""._("Remove")."\" ".$tag.">".
+          " </td>".
+          "</tr>";
+      }
+    }
+    $table.= "</table>";
+    $table.="<input type=\"submit\" name=\"add_option\" value=\""._("Add option")."\">";
+
+    /* Show main page */
+    $smarty= get_smarty();
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+    $smarty->assign("table", $table);
+    $display.= $smarty->fetch(get_template_path('parameters.tpl', TRUE));
+    $this->parent->by_object['application']->generateTemplate();
+    return ($display);
+  }
+
+  function remove_from_parent()
+  {
+    $ldap= $this->config->get_ldap_link();
+
+    /* Zero attributes */
+    $this->attrs= array();
+    $this->attrs['gosaApplicationParameter']= array();
+
+    $ldap->cd($this->dn);
+    @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
+        $this->attributes, "Save");
+    $this->cleanup();
+    $ldap->modify ($this->attrs); 
+
+    show_ldap_error($ldap->get_error(), sprintf(_("Removing of application parameters with dn '%s' failed."),$this->dn));
+
+    /* Optionally execute a command after we're done */
+    $this->handle_post_events('remove');
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    if (isset($_POST['option0'])){
+      for ($i= 0; $i<count($this->option_name); $i++){
+        $this->option_name[$i]= $_POST["option$i"];
+        $this->option_value[$i]= "";
+        if ($_POST["value$i"] != ""){
+          $this->option_value[$i]= $_POST["value$i"];
+        }
+      }
+    }
+  }
+
+
+  /* Check values */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    /* Check for valid option names */
+    for ($i= 0; $i<count($this->option_name); $i++){
+      if (!preg_match ("/^[a-z0-9_]+$/i", $this->option_name[$i])){
+        $message[]= sprintf(_("Value '%s' specified as option name is not valid."), 
+            $this->option_name[$i]);
+      }
+    }
+
+    return $message;
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    /* Generate values */
+    $this->attrs= array();
+    if (count($this->option_name) == 0){
+      $this->attrs['gosaApplicationParameter']= array();
+    } else {
+      for ($i= 0; $i<count($this->option_name); $i++){
+        $this->attrs['gosaApplicationParameter'][]= $this->option_name[$i].
+          ":".$this->option_value[$i];
+      }
+    }
+
+    /* Write back to ldap */
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd($this->dn);
+    @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
+        $this->attributes, "Save");
+    $this->cleanup();
+    $ldap->modify ($this->attrs); 
+
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of application parameters with dn '%s' failed."),$this->dn));
+
+    /* Optionally execute a command after we're done */
+    $this->handle_post_events('modify');
+  }
+
+  /* Return plugin informations for acl handling
+#FIXME FAIscript seams to ununsed within this class... */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Parameter"),
+          "plDescription" => _("Parameter configuration"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 0,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("application"),
+
+          "plProvidedAcls"=> array(
+            "gosaApplicationParameter"      => _("Application parameter settings"))  
+          ));
+  }
+
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/applications/class_divListApplication.inc b/gosa-core/plugins/admin/applications/class_divListApplication.inc
new file mode 100755 (executable)
index 0000000..15b09c6
--- /dev/null
@@ -0,0 +1,321 @@
+<?php
+
+class divListApplication extends MultiSelectWindow
+{
+  /* Current base */
+  var $selectedBase       = "";
+  var $selectedRelease    = "main";
+  var $AvailableReleases  = array();
+  var $departments        = array();
+  var $parent               ;
+  var $ui                   ;
+
+  /* Regex */
+  var $Regex           = "*";
+
+  /* Subsearch checkbox */
+  var $SubSearch;
+
+  var $SaveAdditionalVars = array("selectedRelease");
+
+  function divListApplication (&$config,&$parent)
+  {
+    MultiSelectWindow::MultiSelectWindow($config,"Application", "application");
+   
+    $this->selectedRelease = "ou=apps,".$_SESSION['CurrentMainBase'];
+    $this->parent       = &$parent;
+    $this->ui           = get_userinfo();
+
+    /* Set list strings */
+    $this->SetTitle(_("List of Applications"));
+    $this->SetSummary(_("This table displays all applications in the selected tree."));
+
+    /* Result page will look like a headpage */
+    $this->SetHeadpageMode();
+    $this->SetInformation(_("This menu allows you to add, edit and remove selected applications. You may want to use the range selector on top of the application listbox, when working with a large number of applications."));
+
+    $this->EnableAplhabet(true);
+  
+    /* Disable buttonsm */
+    $this->EnableCloseButton(false);
+    $this->EnableSaveButton (false);
+
+    /* set Page header */
+    $action_col_size = 80;
+    if($this->parent->snapshotEnabled()){
+      $action_col_size += 38;
+    }
+
+
+    /* Toggle all selected / deselected */
+    $chk = "<input type='checkbox' id='select_all' name='select_all'
+               onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
+
+    /* set Page header */
+    $this->AddHeader(array("string"=> $chk,          "attach"=>"style='width:20px;'"));
+    $this->AddHeader(array("string" => "&nbsp;",                "attach" => "style='text-align:center;width:20px;'"));
+    $this->AddHeader(array("string" => _("Application name")." / "._("Department"), "attach" => "style=''"));
+    $this->AddHeader(array("string" => _("Actions"),            "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'"));
+
+    /* Add SubSearch checkbox */
+    $this->AddCheckBox("SubSearch",  _("Select to search within subtrees"), _("Search in subtrees"), false);
+
+    /*                  Name                 ,Text                              ,Default  , Connect with alphabet  */
+    $this->AddRegex   ("Regex",     _("Display users matching"),"*" , true);
+  }
+
+  function AddUserBoxToFilter($position){
+    $str = "";
+    if(($position  == 2) && ($this->parent->IsReleaseManagementActivated($this->config))){
+      $smarty = get_smarty();
+      $smarty->assign("selectedRelease",$this->selectedRelease);
+      $smarty->assign("branchimage","images/branch.png");
+      $smarty->assign("releases",$this->AvailableReleases);
+      $str = $smarty->fetch(get_template_path('release_select.tpl', TRUE));
+    }
+    return($str);
+  }
+
+  function GenHeader()
+  {
+    /* Prepare departments,
+       which are shown in the listbox on top of the listbox
+    */
+    $options= "";
+
+    /* Get all departments within this subtree */
+    $base = $this->config->current['BASE'];
+
+    /* Add base */
+    $tmp = array();
+    $tmp[] = array("dn"=>$this->config->current['BASE']);
+    $tmp=  array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
+                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
+
+    $deps = array();
+    foreach($tmp as $tm){
+      $deps[$tm['dn']] = $tm['dn'];
+    }
+
+    /* Load possible departments */
+    $ui= get_userinfo();
+    $tdeps= $ui->get_module_departments("application");
+    $ids = $this->config->idepartments;
+    $first = "";
+    $found = FALSE;
+    foreach($ids as $dep => $name){
+      if(isset($deps[$dep]) && in_array_ics($dep, $tdeps)){
+
+        /* Keep first base dn in mind, we could need this
+         *  info if no valid base was found
+         */
+        if(empty($first)) {
+          $first = $dep['dn'];
+        }
+
+        $value = $ids[$dep];
+        if ($this->selectedBase == $dep){
+          $found = TRUE;
+          $options.= "<option selected='selected' value='".$dep."'>$value</option>";
+        } else {
+          $options.= "<option value='".$dep."'>$value</option>";
+        }
+      }
+    }
+
+    /* The currently used base is not visible with your acl setup.
+     * Set base to first useable base.
+     */
+    if(!$found){
+      $this->selectedBase = $first;
+    }
+
+    /* Get acls */
+    $ui       = get_userinfo();
+    $acl      = $ui->get_permissions("cn=dummy,".$this->selectedBase,"application/application");
+    $acl_all  = $ui->has_complete_category_acls($this->selectedBase,"application");
+
+    /* Add default header */
+    $listhead = MultiSelectWindow::get_default_header();
+
+    /* And the rest, a base selection box */
+    $listhead .= _("Base")."&nbsp;<select name='CurrentMainBase' 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;";
+
+    /* Create Layers menu */
+    $s  = ".|"._("Actions")."|\n";
+    $s .= "..|<img src='images/list_new.png' alt='' border='0' class='center'>".
+      "&nbsp;"._("Create")."|\n";
+
+    /* Append create options */
+    if(preg_match("/c/",$acl)) {
+      $s.= "...|<input class='center' type='image' src='images/list_new_app' alt=''>".
+        "&nbsp;"._("Application")."|appl_new|\n";
+    }
+
+    /* Multiple options */
+    $s.= "..|---|\n";
+    $s.= "..|<img src='images/edittrash.png' alt='' border='0' class='center'>".
+      "&nbsp;"._("Remove")."|"."remove_multiple|\n";
+
+    /* Add multiple copy & cut icons */
+    if(is_object($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
+      $s.= "..|---|\n";
+      $s.= "..|<img src='images/editcopy.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Copy")."|"."multiple_copy_systems|\n";
+      $s.= "..|<img src='images/editcut.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Cut")."|"."multiple_cut_systems|\n";
+
+      if($this->parent->CopyPasteHandler->entries_queued()){
+        $img = "<img border='0' class='center' src='images/editpaste.png' alt=''>";
+        $s.="..|".$img."&nbsp;"._("Paste")."|editPaste|\n";
+      }else{
+        $img = "<img border='0' class='center' src='images/cant_editpaste.png' alt=''>";
+        $s.="..|".$img."&nbsp;"._("Paste")."\n";
+      }
+    }
+
+    /* Add snapshot icons */
+    if(preg_match("/(c.*w|w.*c)/",$acl_all)){
+      $s .= "..|---|\n";
+      $s .= $this->get_snapshot_header(TRUE);
+    }
+
+    $this->SetDropDownHeaderMenu($s);
+    $this->SetListHeader($listhead);
+
+    $this->SetListHeader($listhead);
+  }
+
+  /* so some basic settings */
+  function execute()
+  {
+    $this->ClearElementsList();
+    $this->GenHeader();
+    $this->AvailableReleases = $this->parent->getReleases($this->selectedBase);
+  }
+
+  function setEntries($list)
+  {
+    /********************
+      Variable init
+     ********************/
+  
+    /* Create links */
+    $linkopen = "<a href='?plug=".$_GET['plug']."&amp;act=dep_open&amp;dep_id=%s'>%s</a>";
+    $editlink = "<a href='?plug=".$_GET['plug']."&amp;id=%s&amp;act=edit_entry'>%s</a>";
+    $userimg  = "<img class='center' src='images/select_groups.png' alt='User'    title='%s'>";
+    $applimg  = "<img class='center' src='images/select_application.png' alt='A'  title='"._("Application")."'>";
+    $empty    = "<img class='center' src='images/empty.png' style='width:16px;height:16px;' alt=''>";
+
+    /* set Page header */
+    $action_col_size = 80;
+    if($this->parent->snapshotEnabled()){
+      $action_col_size += 38;
+    }
+
+    /********************
+      Attach objects
+     ********************/
+    
+    $ui = get_userinfo();
+    foreach($list as $key => $val){
+
+      $acl = $ui->get_permissions($val['dn'],"application/application");
+      $acl_all= $ui->has_complete_category_acls($val['dn'],"application");
+
+      /* Create action icons */
+      $actions= "";
+
+      /* Add Copy & Paste icon */
+      if(($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
+        /* Only add cut icon, if we are allowed to move this user */
+        if(preg_match("/m/",$acl)){
+          $actions.= "<input class='center' type='image'
+            src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
+
+          $actions.= "<input class='center' type='image'
+            src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
+        }
+      }
+
+      /* Add edit icon */
+      $actions.= "<input class='center' type='image'
+        src='images/edit.png' alt='"._("edit")."' name='appl_edit_%KEY%' title='"._("Edit this entry")."'>";
+
+
+      if(preg_match("/(c.*w|w.*c)/",$acl_all)){
+        $actions.= $this->GetSnapShotActions($val['dn']);
+      }
+
+      /* If we are allowed to remove the application account, display remove icon */
+      if(preg_match("/d/",$acl)){
+        $actions.= "<input class='center' type='image'
+          src='images/edittrash.png' alt='"._("delete")."' name='appl_del_%KEY%' title='"._("Delete this entry")."'>";
+      }else{
+        $actions.= "<img src='images/empty.png' alt='&nbsp;'>";
+      }
+
+      $title = "title='".preg_replace('/ /', '&nbsp;', @LDAP::fix($val['dn']))."'";
+
+      if(!isset($val['description'][0])){
+        $desc = "";
+      }else{
+        $desc = " - [ ".$val['description'][0]." ]";
+      }
+
+      /* Cutted objects should be displayed in light grey */
+      $display = $val['cn'][0].$desc;
+      if($this->parent->CopyPasteHandler){
+        foreach($this->parent->CopyPasteHandler->queue as $queue_key => $queue_data){
+          if($queue_data['dn'] == $val['dn']) {
+            $display = "<font color='#999999'>".$display."</font>";
+            break;
+          }
+        }
+      }
+
+      /* Create each field */
+      $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
+                      "attach" => "style='width:20px;'");
+      $field1 = array("string" => sprintf($applimg,$val['dn']), "attach" => "style='text-align:center;width:20px;'");
+      $field2 = array("string" => sprintf($editlink,$key,$display), "attach" => "style='' ".$title);
+      $field3 = array("string" => preg_replace("/%KEY%/", $key, $actions), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'");
+      $this->AddElement(array($field0,$field1,$field2,$field3));
+    }
+
+    /* Create summary string for list footer */
+    $num_deps=0;
+    if(!$this->SubSearch){
+      $num_deps = count($this->Added_Departments);
+    }
+    $num_apps = count($list);
+
+    $num_app_str = _("Number of listed applications");
+    $num_dep_str = _("Number of listed departments");
+  
+    $str = "<img class='center' src='images/select_application.png' 
+              title='".$num_app_str."' alt='".$num_app_str."'>&nbsp;".$num_apps."&nbsp;&nbsp;&nbsp;&nbsp;";
+    $str.= "<img class='center' src='images/folder.png' 
+              title='".$num_dep_str."' alt='".$num_dep_str."'>&nbsp;".$num_deps."&nbsp;&nbsp;&nbsp;&nbsp;";
+
+    $this->set_List_Bottom_Info($str);
+  }
+
+  function Save()
+  {
+    MultiSelectWindow::Save();  
+  }
+
+  function save_object()
+  {
+    /* Save automatic created POSTs like regex, checkboxes */
+    MultiSelectWindow::save_object(); 
+    $_SESSION['appfilter']['release']  = $this->selectedRelease;
+  }
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/applications/generic.tpl b/gosa-core/plugins/admin/applications/generic.tpl
new file mode 100644 (file)
index 0000000..b50ed7e
--- /dev/null
@@ -0,0 +1,152 @@
+<table summary="" style="width:100%;">
+ <tr>
+  <td style="width:50%;">
+
+   <table summary="">
+     <tr>
+      <td><LABEL for="cn">{t}Application name{/t}{$must}</LABEL></td>
+      <td>
+{render acl=$cnACL}
+       <input id="cn" name="cn" size=25 maxlength=60 value="{$cn}" title="{t}Application name{/t}">
+{/render}
+      </td>
+    </tr>
+    <tr>
+     <td><LABEL for="gosaApplicationName">{t}Display name{/t}</LABEL></td>
+     <td>
+{render acl=$gosaApplicationNameACL}
+        <input id="gosaApplicationName" name="gosaApplicationName" size=35 maxlength=60 
+         value="{$gosaApplicationName}" title="{t}Application name to be displayed (i.e. below icons){/t}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><LABEL for="gosaApplicationExecute">{t}Execute{/t}{$must}</LABEL></td>
+     <td>
+{render acl=$gosaApplicationExecuteACL}
+        <input id="gosaApplicationExecute" name="gosaApplicationExecute" size=35 maxlength=120 
+         value="{$gosaApplicationExecute}" title="{t}Path and/or binary name of application{/t}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><LABEL for="description">{t}Description{/t}</LABEL></td>
+     <td>
+{render acl=$descriptionACL}
+      <input id="description" name="description" size=35 maxlength=80 value="{$description}">
+{/render}
+     </td>
+    </tr>
+    <tr><td colspan=2><div style="height:15px;"></div></td></tr>
+    <tr>
+      <td><LABEL for="base">{t}Base{/t}{$must}</LABEL></td>
+      <td>
+{render acl=$baseACL}
+       <select size="1" id="base" name="base" title="{t}Choose subtree to place application in{/t}" 
+        {if $isReleaseApplikation} disabled {/if}>
+        {html_options options=$bases selected=$base_select}
+       </select>
+{/render}
+{if !$isReleaseApplikation}
+{render acl=$baseACL disable_picture='images/folder_gray.png'}
+      <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
+{/render}
+{/if}
+      </td>
+     </tr>
+   </table>
+  </td>
+  <td style="border-left:1px solid #A0A0A0">
+   &nbsp;
+  </td>
+  <td style="vertical-align:top;">
+   <table summary="">
+    <tr>
+    <td>
+    <LABEL for="picture_file">{t}Icon{/t}</LABEL>
+    <br>
+    <img alt="" src="getbin.php?rand={$rand}" border=1 style="width:48px; height:48; background-color:white; vertical-align:bottom;">
+    </td>
+    <td style="vertical-align:top">
+    &nbsp;<br>
+
+    <input type="hidden" name="MAX_FILE_SIZE" value="100000">
+{render acl=$gosaApplicationIconACL}
+    <input name="picture_file" type="file" size="20" maxlength="255" accept="image/*.png" id="picture_file">
+{/render}
+{render acl=$gosaApplicationIconACL}
+<input type="submit" name="update" value="{t}Update{/t}" title="{t}Reload picture from LDAP{/t}">
+{/render}
+{render acl=$gosaApplicationIconACL}
+<input type="submit" name="remove_picture" value="{t}Remove picture{/t}" title="{t}Remove picture from LDAP{/t}">
+{/render}
+    </td>
+    </tr>
+   </table>
+  </td>
+ </tr>
+</table>
+
+<p class="plugbottom" style="height:4px; margin-bottom:0px;">&nbsp;</p>
+
+<h2><img src="images/lamp.png" alt="{t}Options{/t}" align="middle">&nbsp;{t}Options{/t}</h2>
+<table summary="" style="width:100%;">
+  <tr>
+    <td style="width:50%;border-right:1px solid #B0B0B0; vertical-align:top">
+{render acl=$gosaApplicationFlagsACL}
+      <input type=checkbox name="exec_for_groupmembers" value="1" {$exec_for_groupmembers}>
+{/render}
+       {t}Only executable for members{/t}
+      <br>
+{render acl=$gosaApplicationFlagsACL}
+      <input type=checkbox name="overwrite_config" value="1" {$overwrite_config}>
+{/render}
+       {t}Replace user configuration on startup{/t}
+    </td>
+    <td>
+{render acl=$gosaApplicationFlagsACL}
+      <input type=checkbox name="place_on_desktop" value="1" {$place_on_desktop}>
+{/render}
+      {t}Place icon on members desktop{/t}
+      <br>
+{render acl=$gosaApplicationFlagsACL}
+      <input type=checkbox name="place_in_startmenu" value="1" {$place_in_startmenu}>
+{/render}
+      {t}Place entry in members startmenu{/t}
+      <br>
+{render acl=$gosaApplicationFlagsACL}
+      <input type=checkbox name="place_on_kicker" value="1" {$place_on_kicker}>
+{/render}
+      {t}Place entry in members launch bar{/t}
+    </td>
+  </tr>
+</table>
+
+<p class="plugbottom" style="height:4px; margin-bottom:0px;">&nbsp;</p>
+
+<table width="99%" summary="">
+       <tr>
+               <td>
+                       <h2><img src="images/fai_script.png" alt="{t}Script{/t}" align="middle">&nbsp;{t}Script{/t}</h2>
+{render acl=$gotoLogonScriptACL}
+                       <textarea name="gotoLogonScript" style='width:99%;height:220px;'>{$gotoLogonScript}</textarea>
+{/render}
+{render acl=$gotoLogonScriptACL}
+                       <input type="file" name="ScriptFile" value="{t}Import{/t}">
+{/render}
+{render acl=$gotoLogonScriptACL}
+                       <input type="submit" name="upLoad" value="{t}Upload{/t}">
+{/render}
+                       <input type='image' name='downloadScript'  src='images/save.png' title='{t}Download{/t}' class='center'>
+               </td>
+       </tr>
+</table>
+
+<div style="height:20px;"></div>
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('cn');
+  -->
+</script>
diff --git a/gosa-core/plugins/admin/applications/main.inc b/gosa-core/plugins/admin/applications/main.inc
new file mode 100644 (file)
index 0000000..2df7377
--- /dev/null
@@ -0,0 +1,55 @@
+<?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
+*/
+
+if ($remove_lock){
+        if(isset($_SESSION['applicationManagement'])){
+                $applicationManagement= $_SESSION['applicationManagement'];
+                $applicationManagement->remove_lock();
+                del_lock ($ui->dn);
+                sess_del ('applicationManagement');
+        }
+} else {
+       /* Create applicationManagement object on demand */
+       if (!isset($_SESSION['applicationManagement']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+               $_SESSION['applicationManagement']= new applicationManagement ($config, $_SESSION['ui']);
+       }
+       $applicationManagement= $_SESSION['applicationManagement'];
+       $applicationManagement->save_object();
+       $output= $applicationManagement->execute();
+
+       /* Page header*/
+       if (isset($_SESSION['objectinfo'])){
+               $display= print_header(get_template_path('images/application.png'), _("Application management"), "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".@LDAP::fix($_SESSION['objectinfo']));
+       } else {
+               $display= print_header(get_template_path('images/application.png'), _("Application management"));
+       }
+
+       /* Reset requested? */
+       if (isset($_GET['reset']) && $_GET['reset'] == 1){
+               del_lock ($ui->dn);
+               sess_del ('applicationManagement');
+       }
+
+       /* Show and save dialog */
+       $display.= $output;
+       $_SESSION['applicationManagement']= $applicationManagement;
+}
+
+?>
diff --git a/gosa-core/plugins/admin/applications/parameters.tpl b/gosa-core/plugins/admin/applications/parameters.tpl
new file mode 100644 (file)
index 0000000..57c2219
--- /dev/null
@@ -0,0 +1,2 @@
+{$table}
+<div style="height:20px"></div>
diff --git a/gosa-core/plugins/admin/applications/release_select.tpl b/gosa-core/plugins/admin/applications/release_select.tpl
new file mode 100755 (executable)
index 0000000..d58738f
--- /dev/null
@@ -0,0 +1,16 @@
+<br> 
+<div class="contentboxh" style="border-bottom:1px solid #B0B0B0;">
+ <p class="contentboxh"><img src="{$branchimage}" align="right" alt="[F]">{t}Branches{/t}</p>
+</div>
+<div class="contentboxb">
+ <table summary="" style="width:100%;">
+  <tr>
+   <td>
+    {t}Current release{/t}&nbsp;
+    <select name="selectedRelease" onChange="document.mainform.submit();">
+     {html_options options=$releases selected=$selectedRelease}
+    </select>
+   </td>
+  </tr>
+ </table>
+</div>
diff --git a/gosa-core/plugins/admin/applications/remove.tpl b/gosa-core/plugins/admin/applications/remove.tpl
new file mode 100644 (file)
index 0000000..8598ed8
--- /dev/null
@@ -0,0 +1,23 @@
+<div style="font-size:18px;">
+  <img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
+</div>
+<p>
+ {$intro}
+ {t}This may be used by several groups. 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}So - if you're sure - press 'Delete' to continue or 'Cancel' to abort.{/t}
+</p>
+
+<p class="plugbottom">
+       {if $multiple}
+               <input type=submit name="delete_multiple_application_confirm" value="{t}Delete{/t}">
+               &nbsp;
+               <input type=submit name="delete_multiple_application_cancel" value="{t}Cancel{/t}">
+       {else}
+               <input type=submit name="delete_app_confirm" value="{t}Delete{/t}">
+               &nbsp;
+               <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
+       {/if}
+</p>
+
diff --git a/gosa-core/plugins/admin/applications/tabs_application.inc b/gosa-core/plugins/admin/applications/tabs_application.inc
new file mode 100644 (file)
index 0000000..059e683
--- /dev/null
@@ -0,0 +1,62 @@
+<?php
+
+class apptabs extends tabs
+{
+  var $Release= "";
+
+  function apptabs($config, $data, $dn,$category)
+  {
+    tabs::tabs($config, $data, $dn,$category);
+
+    /* Add references/acls/snapshots */
+    $this->addSpecialTabs();
+  }
+
+  function set_release($newRelease)
+  {
+    $this->Release= preg_replace('/,ou=apps,.*$/', '', $newRelease);
+    if ($this->Release != ""){
+      $this->Release= ",".$this->Release;
+    }
+  }
+
+  function save($ignore_account= FALSE)
+  {
+    $baseobject= $this->by_object['application'];
+
+    /* Check for new 'dn', in order to propagate the
+       'dn' to all plugins */
+    $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
+    if((!empty($tmp)) && (isset($_SESSION['appfilter']['release']))){
+      if(!$baseobject->isReleaseApplikation){
+        $new_dn= "cn=".$baseobject->cn.",ou=apps,".$baseobject->base;
+      }else{
+        $new_dn ="cn=".$baseobject->cn.",".$_SESSION['appfilter']['release'];
+      }
+    }else{
+      $new_dn= "cn=".$baseobject->cn.",ou=apps,".$baseobject->base;
+    }
+
+    /* Move group? */
+    if ($this->dn != $new_dn){
+
+      /* Write entry on new 'dn' */
+      if ($this->dn != "new"){
+        $baseobject->move($this->dn, $new_dn);
+        $this->by_object['application']= $baseobject;
+      }
+
+      /* Happen to use the new one */
+      $this->dn= $new_dn;
+    }
+
+    tabs::save();
+
+    /* Fix tagging if needed */
+    $baseobject->dn= $this->dn;
+    $baseobject->handle_object_tagging();
+  }
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/departments/class_departmentGeneric.inc b/gosa-core/plugins/admin/departments/class_departmentGeneric.inc
new file mode 100644 (file)
index 0000000..668da2f
--- /dev/null
@@ -0,0 +1,610 @@
+<?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 department extends plugin
+{
+       /* department attributes */
+       var $ou= "";
+       var $description= "";
+       var $base= "";
+       var $st= "";
+       var $l= "";
+       var $postalAddress= "";
+       var $businessCategory= "";
+       var $telephoneNumber= "";
+       var $facsimileTelephoneNumber= "";
+       var $orig_dn= "";
+       var $is_administrational_unit= false;
+       var $gosaUnitTag= "";
+  var $view_logged = FALSE;
+       var $rec_dst=false;     // Destination for recursive move
+       var $rec_src=false;     // Source for recursive move 
+       var $rec_cpy=false;     // Is recursive move requested ? 
+
+       /* Headpage attributes */
+       var $last_dep_sorting= "invalid";
+       var $departments= array();
+
+  var $must_be_tagged = false;
+
+       /* attribute list for save action */
+       var $attributes= array("ou", "description", "businessCategory", "st", "l", "postalAddress",
+                       "telephoneNumber", "facsimileTelephoneNumber", "gosaUnitTag");
+       var $objectclasses= array("top", "gosaDepartment", "organizationalUnit");
+  var $initially_was_tagged = false;
+
+  
+  /* Temporary disable the Unit Tag functionalityi.
+     This is not used anymore, cause of the new acl implementation. 
+     Setting this to TRUE will disable 
+      all POST / GET activity, "Department tagging" and the checkbox within the generic template.
+   */
+  var $UnitTagDiabled     = TRUE;
+  var $orig_base = "";
+  var $orig_ou = "";
+
+       function department (&$config, $dn)
+       {
+
+               plugin::plugin($config, $dn);
+               $this->is_account= TRUE;
+               $this->ui= get_userinfo();
+               $this->dn= $dn;
+               $this->orig_dn= $dn;
+               $this->orig_ou= $this->ou;
+               $this->config= $config;
+
+               /* Set base */
+               if ($this->dn == "new"){
+                       $ui= get_userinfo();
+                       if(isset($_SESSION['CurrentMainBase'])){
+                               $this->base= $_SESSION['CurrentMainBase'];
+                       }else{
+                               $this->base= dn2base($ui->dn);
+                       }
+               } else {
+                       $this->base= preg_replace ("/^[^,]+,/", "", $this->dn);
+               }
+
+    $this->orig_base = $this->base;
+
+               /* Is administrational Unit? */
+               if ($dn != "new" && in_array_ics('gosaAdministrativeUnit', $this->attrs['objectClass'])){
+                       $this->is_administrational_unit= true;
+      $this->initially_was_tagged = true;
+               }
+       }
+
+       function execute()
+       {
+               /* Call parent execute */
+               plugin::execute();
+
+    /* Log view */
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","department/".get_class($this),$this->dn);
+    }
+
+               /* Reload departments */
+               $this->config->get_departments($this->dn);
+               $this->config->make_idepartments();
+               $smarty= get_smarty();
+
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+               /* Base select dialog */
+               $once = true;
+               foreach($_POST as $name => $value){
+                       if((preg_match("/^chooseBase/",$name) && $once) && ($this->acl_is_moveable())){
+                               $once = false;
+                               $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
+                               $this->dialog->setCurrentBase($this->base);
+                       }
+               }
+
+               /* Dialog handling */
+               if(is_object($this->dialog)){
+                       /* Must be called before save_object */
+                       $this->dialog->save_object();
+
+                       if($this->dialog->isClosed()){
+                               $this->dialog = false;
+                       }elseif($this->dialog->isSelected()){
+
+        /* A new base was selected, check if it is a valid one */
+        $tmp = $this->get_allowed_bases();
+        if(isset($tmp[$this->dialog->isSelected()])){
+          $this->base = $this->dialog->isSelected();
+        }
+  
+                               $this->dialog= false;
+                       }else{
+                               return($this->dialog->execute());
+                       }
+               }
+
+               /* Hide all departments, that are subtrees of this department */
+    $bases = $this->get_allowed_bases();
+               if(($this->dn == "new")||($this->dn == "")){
+                       $tmp = $bases;
+               }else{
+                       $tmp    = array();      
+                       foreach($bases as $dn=>$base){
+                               $fixed = str_replace("/","\\",$this->dn);
+                               /* Only attach departments which are not a subtree of this one */
+                               if(!preg_match("/".$fixed."/",$dn)){
+                                       $tmp[$dn]=$base;
+                               }
+                       }
+               }
+               $smarty->assign("bases", $tmp);
+
+               foreach ($this->attributes as $val){
+                       $smarty->assign("$val", $this->$val);
+               }
+               $smarty->assign("base_select", $this->base);
+
+    /* Set admin unit flag */
+    $smarty->assign("UnitTagDiabled",$this->UnitTagDiabled);
+    if(!$this->UnitTagDiabled){
+      if ($this->is_administrational_unit) {
+        $smarty->assign("unitTag", "checked");
+      } else {
+        $smarty->assign("unitTag", "");
+      }
+    }
+
+               return($smarty->fetch (get_template_path('generic.tpl', TRUE)));
+       }
+
+       function clear_fields()
+       {
+               $this->dn   = "";
+               $this->base = "";
+
+               foreach ($this->attributes as $val){
+                       $this->$val= "";
+               }
+       }
+
+       function remove_from_parent()
+       {
+               $ldap= $this->config->get_ldap_link();
+               $ldap->cd ($this->dn);
+               $ldap->recursive_remove();
+    new log("remove","department/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    show_ldap_error($ldap->get_error(), sprintf(_("Removing of department with dn '%s' failed."),$this->dn));
+
+               /* Optionally execute a command after we're done */
+               $this->handle_post_events('remove');
+       }
+
+       function must_be_tagged()
+       {
+               return $this->must_be_tagged;
+       }
+
+       function am_i_moved()
+       {
+               return $this->rec_cpy;
+       }
+
+
+       /* Save data to object */
+       function save_object()
+       {
+               if (isset($_POST['dep_generic_posted'])){
+
+      /* Create a base backup and reset the
+         base directly after calling plugin::save_object();
+         Base will be set seperatly a few lines below */
+      $base_tmp = $this->base;
+      plugin::save_object();
+      $this->base = $base_tmp;
+
+      /* Set new base if allowed */
+      $tmp = $this->get_allowed_bases();
+      if(isset($_POST['base'])){
+        if(isset($tmp[$_POST['base']])){
+          $this->base= $_POST['base'];
+        }
+      }
+
+      /* Save tagging flag */
+      if(!$this->UnitTagDiabled){
+        if ($this->acl_is_writeable("unitTag")){
+          if (isset($_POST['unitTag'])){
+            $this->is_administrational_unit= true;
+          } else {
+            $this->is_administrational_unit= false;
+          }
+        }
+      }
+    }
+       }
+
+
+       /* Check values */
+       function check()
+       {
+               /* Call common method to give check the hook */
+               $message= plugin::check();
+
+               /* Check for presence of this department */
+               $ldap= $this->config->get_ldap_link();
+    $ldap->ls ("(&(ou=".$this->ou.")(objectClass=organizationalUnit))", $this->base, array('dn'));
+    if ($this->orig_dn == "new" && $ldap->count()){
+                       $message[]= _("Department with that 'Name' already exists.");
+               } elseif ($this->orig_dn != $this->dn && !($attrs === FALSE)){
+                       $message[]= _("Department with that 'Name' already exists.");
+               }
+
+               /* All required fields are set? */
+               if ($this->ou == ""){
+                       $message[]= _("Required field 'Name' is not set.");
+               }
+               if ($this->description == ""){
+                       $message[]= _("Required field 'Description' is not set.");
+               }
+
+    if(is_department_name_reserved($this->ou,$this->base)){
+      $message[]= sprintf(_("The field 'Name' contains the reserved word '%s'. Please choose another name."),$this->ou);
+    }
+
+               if (preg_match ('/[#+:=>\\\\\/]/', $this->ou)){
+                       $message[]= _("The field 'Name' contains invalid characters.");
+               }
+               if (!is_phone_nr($this->telephoneNumber)){
+                       $message[]= _("The field 'Phone' contains an invalid phone number.");
+               }
+               if (!is_phone_nr($this->facsimileTelephoneNumber)){
+                       $message[]= _("The field 'Fax' contains an invalid phone number.");
+               }
+
+               return $message;
+       }
+
+
+       /* Save to LDAP */
+       function save()
+       {
+               $ldap= $this->config->get_ldap_link();
+
+    if(!$this->UnitTagDiabled){
+
+      /* Add tag objects if needed */
+      if ($this->is_administrational_unit){
+
+        /* If this wasn't tagged before add oc an reset unit tag */
+        if(!$this->initially_was_tagged){
+          $this->objectclasses[]= "gosaAdministrativeUnit";
+          $this->gosaUnitTag= "";
+
+          /* It seams that this method is called twice, 
+             set this to true. to avoid adding this oc twice */
+          $this->initially_was_tagged = true;
+        }
+
+        if ($this->gosaUnitTag == ""){
+
+          /* It's unlikely, but check if already used... */
+          $try= 5;
+          $ldap->cd($this->config->current['BASE']);
+          while ($try--){
+
+            /* Generate microtime stamp as tag */
+            list($usec, $sec)= explode(" ", microtime());
+            $time_stamp= preg_replace("/\./", "", $sec.$usec);
+
+            $ldap->search("(&(objectClass=gosaAdministrativeUnit)(gosaUnitTag=$time_stamp))",array("gosaUnitTag"));
+            if ($ldap->count() == 0){
+              break;
+            }
+          }
+          if($try == 0) {
+            print_red(_("Fatal error: Can't find an unused tag to mark the administrative unit!"));
+            return;
+          }
+          $this->gosaUnitTag= preg_replace("/\./", "", $sec.$usec);
+        }
+      }
+    }
+               plugin::save();
+
+    if(!$this->UnitTagDiabled){
+
+      /* Remove tag information if needed */
+      if (!$this->is_administrational_unit){
+        $tmp= array();
+
+        /* Remove gosaAdministrativeUnit from this plugin */
+        $has_unit_tag= false;
+        foreach($this->attrs['objectClass'] as $oc){
+          if (!preg_match("/^gosaAdministrativeUnit$/i", $oc)){
+            $tmp[]= $oc;
+          }
+          if (preg_match("/^gosaAdministrativeUnitTag$/i", $oc)){
+            $has_unit_tag= true;
+          }
+        }
+        $this->attrs['objectClass']= $tmp;
+
+        if(!$has_unit_tag && isset($this->attrs['gosaUnitTag'])){
+          $this->attrs['gosaUnitTag']= array();
+        }
+        $this->gosaUnitTag = "";
+      }
+    }
+
+               /* Write back to ldap */
+               $ldap= $this->config->get_ldap_link();
+               $ldap->cat($this->dn, array('dn'));
+               $a= $ldap->fetch();
+               $ldap->cd($this->dn);
+
+               if (count($a)){
+                       $this->cleanup();
+                       $ldap->modify ($this->attrs); 
+      new log("modify","department/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+                       $this->handle_post_events('modify');
+               } else {
+                       $ldap->add($this->attrs);
+                       $this->handle_post_events('add');
+      new log("create","department/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+               }
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of department with dn '%s' failed."),$this->dn));
+
+
+    if(!$this->UnitTagDiabled){
+      /* The parameter forces only to set must_be_tagged, and don't touch any objects 
+         This will be done later */
+      $this->tag_objects(true);
+
+      /* Fix tagging if needed */
+      if (!$this->is_administrational_unit){
+        $this->handle_object_tagging();
+      }
+    }
+    
+    /* Optionally execute a command after we're done */
+               $this->postcreate();
+    return(false);
+       }
+
+
+  function ShowMoveFrame()
+  {
+    $smarty = get_smarty();
+    $smarty->assign("src","?plug=".$_GET['plug']."&amp;PerformRecMove");
+    $smarty->assign("message","As soon as the move operation has finished, you can scroll down to end of the page and press the 'Continue' button to continue with the department management dialog.");
+    $display=  $smarty->fetch(get_template_path("dep_iframe.tpl",TRUE));
+    return($display);
+  }
+
+  function ShowTagFrame()
+  {
+    $smarty = get_smarty();
+    $smarty->assign("src","?plug=".$_GET['plug']."&TagDepartment");
+    $smarty->assign("message","As soon as the tag operation has finished, you can scroll down to end of the page and press the 'Continue' button to continue with the department management dialog.");
+    $display=  $smarty->fetch(get_template_path("dep_iframe.tpl",TRUE));
+    return($display);
+  }
+
+       /* Tag objects to have the gosaAdministrativeUnitTag */
+       function tag_objects($OnlySetTagFlag = false)
+       {
+    if(!$OnlySetTagFlag){
+      $smarty= get_smarty();
+      /* Print out html introduction */
+      echo '  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
+        <html>
+        <head>
+        <title></title>
+        <style type="text/css">@import url("themes/default/style.css");</style>
+        <script language="javascript" src="include/focus.js" type="text/javascript"></script>
+        </head>
+        <body style="background: none; margin:4px;" id="body" >
+        ';
+      echo "<h3>".sprintf(_("Tagging '%s'."),"<i>".@LDAP::fix($this->dn)."</i>")."</h3>";
+    }
+
+               $add= $this->is_administrational_unit;
+               $len= strlen($this->dn);
+               $ldap= $this->config->get_ldap_link();
+               $ldap->cd($this->dn);
+               if ($add){
+                       $ldap->search('(!(&(objectClass=gosaAdministrativeUnitTag)(gosaUnitTag='.
+                                                               $this->gosaUnitTag.')))', array('dn'));
+               } else {
+                       $ldap->search('objectClass=gosaAdministrativeUnitTag', array('dn'));
+               }
+
+               while ($attrs= $ldap->fetch()){
+
+                       /* Skip self */
+                       if ($attrs['dn'] == $this->dn){
+                               continue;
+                       }
+
+                       /* Check for confilicting administrative units */
+                       $fix= true;
+                       foreach ($this->config->adepartments as $key => $tag){
+                               /* This one is shorter than our dn, its not relevant... */
+                               if ($len >= strlen($key)){
+                                       continue;
+                               }
+
+                               /* This one matches with the latter part. Break and don't fix this entry */
+                               if (preg_match('/(^|,)'.normalizePreg($key).'$/', $attrs['dn'])){
+                                       $fix= false;
+                                       break;
+                               }
+                       }
+
+      /* Fix entry if needed */
+      if ($fix){
+        if($OnlySetTagFlag){
+          $this->must_be_tagged =true;
+          return;
+        }
+                               $this->handle_object_tagging($attrs['dn'], $this->gosaUnitTag, TRUE );
+                       }
+               }
+    if(!$OnlySetTagFlag){
+      echo '<p class="seperator">&nbsp;</p>';
+      echo "<div style='width:100%;text-align:right;'><form name='form' method='post' action='?plug=".$_GET['plug']."' target='_parent'>
+        <br><input type='submit' name='back' value='"._("Continue")."'>
+        </form></div>";
+    }
+       }
+
+
+       /* Move/Rename complete trees */
+       function recursive_move($src_dn, $dst_dn,$force = false)
+       {
+    /* If force == false prepare to recursive move this object from src to dst 
+        on the next call. */
+               if(!$force){
+                       $this->rec_cpy  = true;
+                       $this->rec_src  = $src_dn;
+                       $this->rec_dst  = $dst_dn;
+               }else{
+
+      /* If this is called, but not wanted, abort */
+                       if(!$this->rec_cpy){ 
+                               return;
+                       }
+
+                       $src_dn = $this->rec_src;
+                       $dst_dn = $this->rec_dst;
+
+                       /* Print header to have styles included */
+                       $smarty= get_smarty();
+
+      echo '  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
+        <html>
+        <head>
+        <title></title>
+        <style type="text/css">@import url("themes/default/style.css");</style>
+        <script language="javascript" src="include/focus.js" type="text/javascript"></script>
+        </head>
+        <body style="background: none; margin:4px;" id="body" >
+        ';
+                       echo "<h3>".sprintf(_("Moving '%s' to '%s'"),"<i>".@LDAP::fix($src_dn)."</i>","<i>".@LDAP::fix($dst_dn)."</i>")."</h3>";
+
+
+                       /* Check if the destination entry exists */
+                       $ldap= $this->config->get_ldap_link();
+
+                       /* Check if destination exists - abort */
+                       $ldap->cat($dst_dn, array('dn'));
+                       if ($ldap->fetch()){
+                               trigger_error("Recursive_move ".@LDAP::fix($dst_dn)." already exists.",
+                                               E_USER_WARNING);
+                               echo sprintf("Recursive_move: '%s' already exists", @LDAP::fix($dst_dn))."<br>"; 
+                               return (FALSE);
+                       }
+
+                       /* Perform a search for all objects to be moved */
+                       $objects= array();
+                       $ldap->cd($src_dn);
+                       $ldap->search("(objectClass=*)", array("dn"));
+                       while($attrs= $ldap->fetch()){
+                               $dn= $attrs['dn'];
+                               $objects[$dn]= strlen($dn);
+                       }
+
+                       /* Sort objects by indent level */
+                       asort($objects);
+                       reset($objects);
+
+                       /* Copy objects from small to big indent levels by replacing src_dn by dst_dn */
+                       foreach ($objects as $object => $len){
+
+
+                               $src= str_replace("\\","\\\\",$object);
+                               $dst= preg_replace("/".str_replace("\\","\\\\",$src_dn)."$/", "$dst_dn", $object);
+                               $dst= str_replace($src_dn,$dst_dn,$object);
+
+                               echo "<b>"._("Object").":</b> ".@LDAP::fix($src)."<br>";
+
+        $this->update_acls($object, $dst,TRUE);
+
+                               if (!$this->copy($src, $dst)){
+                                       echo "<font color='#FF0000'><br>".sprintf(_("FAILED to copy %s, aborting operation"),@LDAP::fix($src))."</font>";
+                                       return (FALSE);
+                               }
+        echo "<script language=\"javascript\" type=\"text/javascript\">scrollDown2();</script>" ;
+                               flush();
+                       }
+
+                       /* Remove src_dn */
+                       $ldap->cd($src_dn);
+                       $ldap->recursive_remove();
+      $this->dn = $this->rec_dst;
+                       $this->rec_src = $this->rec_dst = "";
+                       $this->rec_cpy =false;
+
+                       echo '<p class="seperator">&nbsp;</p>';
+
+                       echo "<div style='width:100%;text-align:right;'><form name='form' method='post' action='?plug=".$_GET['plug']."' target='_parent'>
+                               <br><input type='submit' name='back' value='"._("Continue")."'>
+                               </form></div>";
+
+      echo "<script language=\"javascript\" type=\"text/javascript\">scrollDown2();</script>" ;
+                       echo "</body></html>";
+
+                       return (TRUE);
+               }
+       }
+
+
+  /* Return plugin informations for acl handling */ 
+  static function plInfo()
+  {
+    return (array("plShortName"   => _("Generic"),
+                  "plDescription" => _("Departments"),
+                  "plSelfModify"  => FALSE,
+                  "plPriority"    => 0,
+                  "plDepends"     => array(),
+                  "plSection"     => array("admin"),
+                  "plCategory"    => array("department" => array("objectClass" => "gosaDepartment", "description" => _("Departments"))),
+            
+                  "plProvidedAcls" => array(
+                    "description"       => _("Description"),
+                    "c"                 => _("Country"),
+                    "base"              => _("Base"),
+                    "l"                 => _("Location"),
+                    "telephoneNumber"   => _("Telephone"),
+                    "ou"                => _("Department name"),
+                    "businessCategory"  => _("Category"),
+                    "st"                => _("State"),
+                    "postalAddress"     => _("Address"),
+                    "gosaUnitTag"       => _("Administrative settings"),
+                    "facsimileTelephoneNumber" => _("Fax"))
+                  ));
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/departments/class_departmentManagement.inc b/gosa-core/plugins/admin/departments/class_departmentManagement.inc
new file mode 100644 (file)
index 0000000..e2db188
--- /dev/null
@@ -0,0 +1,535 @@
+<?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 departmentManagement extends plugin
+{
+  /* Definitions */
+  var $plHeadline= "Departments";
+  var $plDescription= "This does something";
+
+  /* CLI vars */
+  var $cli_summary= "Handling of LDAP subtrees";
+  var $cli_description= "Some longer text\nfor help";
+  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* Headpage attributes */
+  var $last_dep_sorting= "invalid";
+  var $departments= array();
+  var $deptabs= NULL;
+
+  /* attribute list for save action */
+  var $attributes= array();
+  var $objectclasses= array();
+
+  /* Vars to handle operations after saving the department 
+     Recursive move && tagging   */
+  var $ObjectInSaveMode         = false;    // Is true, if current object wasn't saved right now
+  var $ObjectTaggingRequested   = false;    // Object must be tagged, an iframe will be shown. 
+  var $RecursiveRemoveRequested = false;    // Is true, if this object must be moved, an iframe will be displayed in this case
+
+  function departmentManagement (&$config, &$ui)
+  {
+    $this->ui= &$ui;
+    $this->dn= "";
+    $this->config= &$config;
+    $this->DivListDepartment = new divListDepartment($this->config,$this);
+  }
+
+  function execute()
+  {
+    global $config;
+  
+    /* Call parent execute */
+    plugin::execute();
+
+    /***************
+      Var init 
+     ***************/
+
+    $_SESSION['LOCK_VARS_TO_USE'] = array("/^act$/","/^id$/","/^dep_edit_.*/","/^dep_del_.*/","/^item_selected/","/^remove_multiple_departments/");
+
+    /* Reload departments */
+    $smarty                                            = get_smarty();
+    $display                                   = "";
+    $s_action                                  = "";  // Will contain an action, like del or edit
+    $s_entry                                   = "";  // The entry name for edit delete -...
+
+
+    /***************
+      Check posts  
+     ***************/
+
+    // Check Post action
+    foreach($_POST as $key => $val){
+      // Post for delete
+      if(preg_match("/dep_del.*/",$key)){
+        $s_action = "del";
+        $s_entry  = preg_replace("/dep_".$s_action."_/i","",$key);
+        $s_entry  = preg_replace("/_.*$/","",$s_entry);
+        $s_entry  = base64_decode($s_entry);
+        // Post for edit
+      }elseif(preg_match("/dep_edit_.*/",$key)){
+        $s_action="edit";
+        $s_entry  = preg_replace("/dep_".$s_action."_/i","",$key);
+        $s_entry  = preg_replace("/_.*$/","",$s_entry);
+        $s_entry  = base64_decode($s_entry);
+        // Post for new
+      }elseif(preg_match("/^remove_multiple_departments/",$key)){
+        $s_action="del_multiple";
+      }elseif(preg_match("/dep_new.*/",$key)){
+        $s_action="new";
+      }
+    }
+
+    /* Create options */
+    if(isset($_POST['menu_action']) && $_POST['menu_action'] == "dep_new"){
+      $s_action = "new";
+    }
+
+    /* handle remove from layers menu */
+    if(isset($_POST['menu_action']) && preg_match("/^remove_multiple/",$_POST['menu_action'])){
+      $s_action = "del_multiple";
+    }
+
+
+    /***************
+      Create a new department
+     ***************/
+
+    /* New Entry if Posted action (s_action) == new
+     */
+    if ($s_action=="new"){
+      $this->dn= "new";
+      $this->deptabs= new deptabs($this->config,$this->config->data['TABS']['DEPTABS'], $this->dn,"department");
+      $this->deptabs->set_acl_base($this->DivListDepartment->selectedBase);
+    }
+
+
+    /***************
+      Edit entry
+     ***************/
+
+    /* Edit Entry if Posted action (s_action) == edit 
+     * The entry which will be edited is defined in $s_entry
+     */
+    if (( $s_action=="edit") && (!isset($this->deptabs->config))){
+      $this->dn= $this->config->departments[trim($s_entry)];
+
+      if (($user= get_lock($this->dn)) != ""){
+        return(gen_locked_message ($user, $this->dn));
+      }
+
+      /* Lock the current entry, so everyone will get the  above dialog */
+      add_lock ($this->dn, $this->ui->dn);
+
+      /* Register deptabs to trigger edit dialog */
+      $this->deptabs= new deptabs($this->config,$this->config->data['TABS']['DEPTABS'], $this->dn,"department");
+      $this->deptabs->set_acl_base($this->dn);
+
+      $_SESSION['objectinfo']= $this->dn;
+    }
+
+
+    /********************
+      Delete MULTIPLE entries requested, display confirm dialog
+     ********************/
+
+    if ($s_action=="del_multiple"){
+      $ids = $this->list_get_selected_items();
+
+
+      if(count($ids)){
+        foreach($ids as $id){
+          $id = base64_decode($id);
+          $dn = $this->config->departments[$id];
+  
+          if (($user= get_lock($dn)) != ""){
+            return(gen_locked_message ($user, $dn));
+          }
+          $this->dns[$id] = $dn;
+        }
+
+        $dns_names = "<br><pre>";
+        foreach($this->dns as $dn){
+          add_lock ($dn, $this->ui->dn);
+          $dns_names .= $dn."\n";
+        }
+        $dns_names .="</pre>";
+
+        /* Lock the current entry, so nobody will edit it during deletion */
+        if (count($this->dns) == 1){
+          $smarty->assign("info",     sprintf(_("You're about to delete the following entry %s"), @LDAP::fix($dns_names)));
+        } else {
+          $smarty->assign("info",     sprintf(_("You're about to delete the following entries %s"), @LDAP::fix($dns_names)));
+        }
+        $smarty->assign("multiple", true);
+        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+      }
+    }
+   
+
+    /********************
+      Delete MULTIPLE entries confirmed
+     ********************/
+
+    /* Confirmation for deletion has been passed. Users should be deleted. */
+    if (isset($_POST['delete_multiple_department_confirm'])){
+
+      /* Remove user by user and check acls before removeing them */
+      foreach($this->dns as $key => $dn){
+        $acl = $this->ui->get_permissions($dn,"department/department");
+        if (preg_match('/d/', $acl)){
+
+          /* Delete request is permitted, perform LDAP action */
+          $this->deptabs= new deptabs($this->config,$this->config->data['TABS']['DEPTABS'], $dn,"department");
+          $this->deptabs->set_acl_base();
+          $this->deptabs->delete ();
+          $this->deptabs = NULL;
+        } else {
+          print_red (_("You have no permission to remove this department."));
+        }
+        /* Remove lock file after successfull deletion */
+        del_lock ($dn);
+        unset($this->dns[$key]);
+      }
+    }
+
+    /********************
+      Delete MULTIPLE entries Canceled
+     ********************/
+
+    /* Remove lock */
+    if(isset($_POST['delete_multiple_department_cancel'])){
+      foreach($this->dns as $key => $dn){
+        del_lock ($dn);
+        unset($this->dns[$key]);
+      }
+    }
+
+
+    /***************
+      Delete entry 
+     ***************/
+
+    /* Delete Entry if Posted action (s_action) == del 
+     * The entry which will be deleted is defined in $s_entry
+     */
+    if ($s_action =="del"){
+      $this->dn= $this->config->departments[trim($s_entry)];
+
+      /* check acls */
+      $acl = $this->ui->get_permissions($this->dn,"department/department");
+      if(preg_match("/d/",$acl)){
+
+        /* Check locking */
+        if (($user= get_lock($this->dn)) != ""){
+          $_SESSION['dn']= $this->dn;
+          return(gen_locked_message($user, $this->dn));
+        } else {
+          add_lock ($this->dn, $this->ui->dn);
+          $smarty->assign("info", sprintf(_("You're about to delete the whole LDAP subtree placed under '%s'."), @LDAP::fix($this->dn)));
+          $smarty->assign("multiple", false);
+          $display.= $smarty->fetch (get_template_path('remove.tpl', TRUE));
+          return ($display);
+        }
+      }else{
+        print_red (_("You have no permission to remove this department."));
+      }
+    }
+
+
+    /***************
+      Delete department confirmed  
+     ***************/
+
+    /* If department deletion is accepted ...
+     * Finally delete department 
+     */
+    if (isset($_POST['delete_department_confirm'])){
+
+      /* check acls */
+      $acl = $this->ui->get_permissions($this->dn,"department/department");
+      if(preg_match("/d/",$acl)){
+        $this->remove_from_parent();
+      } else {
+        print_red (_("You have no permission to remove this department."));
+      }
+    }
+
+
+    /***************
+      Edit department finished 
+     ***************/
+
+    if ((isset($_POST['edit_finish'])) && (isset($this->deptabs->config)) && !isset($_POST['dep_move_confirm'])){
+      $this->deptabs->save_object();
+      $obj = $this->deptabs->by_object['department'];
+      if($obj->orig_dn != "new"){
+        if($obj->orig_ou != $obj->ou || $obj->base != $obj->orig_base){
+          return($smarty->fetch(get_template_path("dep_move_confirm.tpl",TRUE)));
+        }
+      }
+    }
+
+    /* Save changes */
+    if ((isset($_POST['edit_finish'])|| isset($_POST['dep_move_confirm'])) && (isset($this->deptabs->config))){
+
+      /* Check tabs, will feed message array */
+      $message= $this->deptabs->check();
+
+      /* Save, or display error message? */
+      if (count($message) == 0){
+
+        $this->deptabs->save(true);
+        global $config;
+        $config->get_departments();
+        $config->make_idepartments();
+        $this->config = $config;
+
+        /* This object must be tagged, so set ObjectTaggingRequested to true */
+        if($this->deptabs->by_object['department']->must_be_tagged()){
+          $this->ObjectTaggingRequested   = true; 
+        }              
+
+        /* Get recursive move is required, set RecursiveRemoveRequested to true */
+        if($this->deptabs->by_object['department']->am_i_moved()){     
+          $this->RecursiveRemoveRequested = true;
+        }              
+      
+        /* This var indicated that there is an object which isn't saved right now. */
+        $this->ObjectInSaveMode = true;
+
+      } else {
+        /* Ok. There seem to be errors regarding to the tab data,
+           show message and continue as usual. */
+        show_errors($message);
+      }
+    }
+
+
+    /***************
+      Handle Tagging (Return output for an iframe)
+     ***************/
+
+    /* This department must be tagged (Is called from iframe, generates output)*/
+    if(isset($_GET['TagDepartment'])){
+      $this->deptabs->by_object['department']->tag_objects();
+      exit();  
+    }
+
+
+    /***************
+      Handle recursive move (Return output for an iframe)
+     ***************/
+
+    /* initiate recursive remove  (Is called from iframe, generates output)*/
+    if(isset($_GET['PerformRecMove'])){
+      $this->deptabs->by_object['department']->recursive_move("","",true);
+      $this->DivListDepartment->selectedBase = $this->deptabs->by_object['department']->dn;  
+      exit();
+    }
+
+
+    /***************
+      Return iframes, which call tagging / recusrsive move 
+     ***************/
+
+    /* While one of these vars below isset, we must return an iframe, 
+       to perform requested operation */
+    if($this->ObjectTaggingRequested){
+      $this->ObjectTaggingRequested = false;
+      return($this->deptabs->by_object['department']->ShowTagFrame());
+    }
+    if($this->RecursiveRemoveRequested){
+      $this->RecursiveRemoveRequested = false;
+      return($this->deptabs->by_object['department']->ShowMoveFrame());
+    }
+
+
+    /***************
+      In case of tagging/moving the object wasn't deleted, do it know
+     ***************/
+
+    /* If there is an unsaved object and all operations are done
+       remove locks & save object tab & unset current object */
+    if($this->ObjectInSaveMode && (!$this->RecursiveRemoveRequested) && (!$this->ObjectTaggingRequested)){
+      $this->deptabs->save();
+      $this->config->get_departments();
+      $this->ObjectInSaveMode = false;
+      if ($this->dn != "new"){
+        del_lock ($this->dn);
+      }
+      unset ($this->deptabs);
+      $this->deptabs= NULL;
+      unset ($_SESSION['objectinfo']);
+    }
+
+
+    /***************
+      Dialog canceled  
+     ***************/
+
+    /* User canceled edit oder delete
+     * Cancel dialog 
+     */
+    if (isset($_POST['edit_cancel']) || isset($_POST['delete_cancel']) || isset($_POST['delete_department_confirm'])){
+      del_lock ($this->dn);
+      unset($this->depdabs);
+      $this->deptabs= NULL;
+      unset ($_SESSION['objectinfo']);
+    }
+
+    /* Headpage or normal plugin screen? */
+    if ($this->deptabs !== NULL){
+
+      /* Show main page (tabs) */
+      $display= $this->deptabs->execute();
+      if (!$this->deptabs->by_object[$this->deptabs->current]->dialog){
+        $display.= "<p style=\"text-align:right\">\n";
+        $display.= "<input type=submit name=\"edit_finish\" value=\""._("Save")."\">\n";
+        $display.= "&nbsp;\n";
+        $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+        $display.= "</p>";
+      }
+      return ($display);
+    }else{
+      /* Display dialog with group list */
+      $this->DivListDepartment->parent = $this;
+      $this->DivListDepartment->execute();
+      $this->reload();
+      $this->DivListDepartment->DepartmentsAdded = true;
+      $this->DivListDepartment->setEntries($this->departments);
+      return($this->DivListDepartment->Draw());
+    }
+  }
+
+
+  function reload()
+  {
+    /* Vairaible init */
+    $base         = $this->DivListDepartment->selectedBase;
+    $base_back    = preg_replace("/^[^,]+,/","",$base);
+    $Regex        = $this->DivListDepartment->Regex;
+  
+    // Create Array to Test if we have a valid back button
+    $tmp = $_SESSION['config']->idepartments;
+
+    // In case of a valid back button create entry
+    if(isset($tmp[$base_back])){
+      $tmp2    ['dn']          = convert_department_dn($base_back);
+
+      // If empty always go to top
+      if(empty($tmp2['dn'])){
+        $tmp2['dn']="/";
+      }
+      $tmp2    ['description'][0] = ".. "._("Back");
+      $result[$tmp[$base_back]]=$tmp2;
+    }
+
+    if($this->DivListDepartment->SubSearch){
+      $res= get_list("(&(|(ou=$Regex)(description=$Regex))(objectClass=gosaDepartment))",
+          "department", $base, array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH);
+    }else{
+      $res= get_list("(&(|(ou=$Regex)(description=$Regex))(objectClass=gosaDepartment))",
+          "department", $base, array("ou", "description"), GL_SIZELIMIT );
+    }
+
+    $this->departments= array();
+
+    /* Add current base to the list of available departments, but only if its naming attribute is 'ou' */
+    if(preg_match("/^ou=/",$base)){
+      $this->departments [ convert_department_dn($base) ] = ".";
+    }
+
+    foreach ($res as $key => $value){
+
+      /* Don't display base as entry on subsearch */
+      if(($value['dn'] == $base) && ($this->DivListDepartment->SubSearch)){
+        continue;
+      }
+
+      $cdn= convert_department_dn($value['dn']);
+
+      /* Append to dep list */
+      if(isset($value["description"][0])){
+        $this->departments[$cdn]= get_sub_department($cdn)." - [".$value["description"][0]."]";
+      }else{
+        $this->departments[$cdn]= get_sub_department($cdn);//$value["description"][0];
+      }
+    }
+    natcasesort ($this->departments);
+    reset ($this->departments);
+  }
+
+  function remove_from_parent()
+  {
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd ($this->dn);
+    $ldap->recursive_remove();
+
+    /* Optionally execute a command after we're done */
+    $this->postremove();
+
+    /* Delete references to object groups */
+    $ldap->cd ($this->config->current['BASE']);
+    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
+    while ($ldap->fetch()){
+      $og= new ogroup($this->config, $ldap->getDN());
+      unset($og->member[$this->dn]);
+      $og->save ();
+    }
+
+  }
+
+
+  function list_get_selected_items()
+  {
+    $ids = array();
+    foreach($_POST as $name => $value){
+      if(preg_match("/^item_selected_[a-z0-9\\/\=]*$/i",$name)){
+        $id   = preg_replace("/^item_selected_/","",$name);
+        $ids[$id] = $id;
+      }
+    }
+    return($ids);
+  }
+
+
+  function remove_lock()
+  {
+    if (isset($this->dn)){
+      del_lock ($this->dn);
+    }
+  }
+
+  function save_object()
+  {
+    /* reload department */
+    $this->config->get_departments();
+
+    $this->config->make_idepartments();
+    $this->DivListDepartment->config= $this->config;
+    $this->DivListDepartment->save_object();
+  }
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/departments/class_divListDepartment.inc b/gosa-core/plugins/admin/departments/class_divListDepartment.inc
new file mode 100755 (executable)
index 0000000..b1f642d
--- /dev/null
@@ -0,0 +1,228 @@
+<?php
+
+class divListDepartment extends MultiSelectWindow
+{
+
+  /* Current base */
+  var $selectedBase       = "";
+  var $departments        = array();
+
+  /* Regex */
+  var $Regex              = "*";
+  
+  /* Subsearch checkbox */
+  var $SubSearch          = false;
+
+  var $parent             ;
+  var $ui                 ;
+
+  function divListDepartment (&$config, &$parent)
+  {
+    MultiSelectWindow::MultiSelectWindow($config, "Department", "department");
+    
+    $this->parent       = &$parent;
+    $this->ui           = get_userinfo();
+
+    /* Set list strings */
+    $this->SetTitle(_("List of departments"));
+    $this->SetSummary(_("List of departments"));
+    $this->EnableAplhabet   (true);
+
+    /* Result page will look like a headpage */
+    $this->SetHeadpageMode();
+    $this->SetInformation(_("This menu allows you to create, delete and edit selected departments. Having a large number of departments, you might prefer the range selectors on top of the department list."));
+  
+    /* Disable buttonsm */
+    $this->EnableCloseButton(false);
+    $this->EnableSaveButton (false);
+
+
+
+   /* Toggle all selected / deselected */
+    $chk = "<input type='checkbox' id='select_all' name='select_all'
+               onClick='toggle_all_(\"^item_selected_[a-zA-Z0-9\\/\=]*$\",\"select_all\");' >";
+
+    /* set Page header */
+    $this->AddHeader(array("string"=> $chk,          "attach"=>"style='width:20px;'"));
+    $this->AddHeader(array("string" => "&nbsp;", "attach" => "style='text-align:center;width:20px;'"));
+    $this->AddHeader(array("string"=>_("Department name"), "attach" => "style=''"));
+    $this->AddHeader(array("string" =>_("Actions"), "attach" => "style='width:60px;border-right:0px;text-align:right;'"));
+
+
+    /* Add SubSearch checkbox */    
+    $this->AddCheckBox("SubSearch",  _("Select to search within subtrees"), _("Search in subtrees"), false);
+
+    /*                  Name                 ,Text                              ,Default  , Connect with alphabet  */
+    $this->AddRegex   ("Regex",     _("Regular expression for matching department names"), "*" , true);
+  }
+
+
+  function GenHeader()
+  {
+    /* Prepare departments,
+       which are shown in the listbox on top of the listbox
+    */
+    $options= "";
+
+    /* Get all departments within this subtree */
+    $ui= get_userinfo();
+    $first = "";
+    $found = FALSE;
+    $base = $this->config->current['BASE'];
+
+    /* Add base */
+    $tmp = array();
+    $tmp[] = array("dn"=>$this->config->current['BASE']);
+    $tmp=  array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
+                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
+
+    $deps = array();
+    foreach($tmp as $tm){
+      $deps[$tm['dn']] = $tm['dn'];
+    }
+
+    /* Load possible departments */
+    $ui= get_userinfo();
+    $tdeps= $ui->get_module_departments("department");
+    $ids = $this->config->idepartments;
+    $first = "";
+    $found = FALSE;
+    foreach($ids as $dep => $name){
+      if(isset($deps[$dep]) && in_array_ics($dep, $tdeps)){
+
+        /* Keep first base dn in mind, we could need this
+         *  info if no valid base was found
+         */
+        if(empty($first)) {
+          $first = $dep['dn'];
+        }
+
+        $value = $ids[$dep];
+        if ($this->selectedBase == $dep){
+          $found = TRUE;
+          $options.= "<option selected='selected' value='".$dep."'>$value</option>";
+        } else {
+          $options.= "<option value='".$dep."'>$value</option>";
+        }
+      }
+    }
+
+    /* The currently used base is not visible with your acl setup.
+     * Set base to first useable base.
+     */
+    if(!$found){
+      $this->selectedBase = $first;
+    }
+
+    /* Generate list head */
+    $ui = get_userinfo();
+    $acl = $ui->get_permissions("ou=dummy,".$this->selectedBase  ,"department/department");
+      
+    /* Add default header */
+    $listhead = MultiSelectWindow::get_default_header();
+
+    $listhead .=  
+      " "._("Base")."&nbsp;<select name='CurrentMainBase' 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;";
+
+    /* Create Layers menu */
+    $s  = ".|"._("Actions")."|\n";
+    $s .= "..|<img src='images/list_new.png' alt='' border='0' class='center'>".
+      "&nbsp;"._("Create")."|\n";
+
+    /* Append create options */
+    if(preg_match("/c/",$acl)) {
+      $s.= "...|<input class='center' type='image' src='images/list_new_department' alt=''>".
+        "&nbsp;"._("Department")."|dep_new|\n";
+    }
+    $s.= "..|---|\n";
+    $s.= "..|<img src='images/edittrash.png' alt='' border='0' class='center'>".
+      "&nbsp;"._("Remove")."|"."remove_multiple|\n";
+
+
+    $this->SetDropDownHeaderMenu($s);
+    $this->SetListHeader($listhead);
+  }
+
+  function execute()
+  {
+    $this->ClearElementsList();
+    $this->GenHeader();
+  }
+
+  function setEntries($list)
+  {
+    $linkopen = "<a href='?plug=".$_GET['plug']."&amp;act=dep_open&amp;dep_id=%s'>%s</a>";
+
+    $ui = get_userinfo();
+    foreach($list as $key => $val) {
+
+      $actions= "";      
+
+      $acl = $ui->get_permissions($this->config->departments[$key] ,"department/department");
+      if(preg_match("/r/",$acl)){
+        $actions.= "<input class='center' type='image' src='images/edit.png'
+          alt='"._("edit")."'   name='dep_edit_%KEY%' title='"._("Edit this entry")."'>";
+      }
+
+      if(preg_match("/c/",$acl)){
+        $actions.= "<input class='center' type='image' src='images/edittrash.png'
+          alt='"._("delete")."'   name='dep_del_%KEY%' title='"._("Delete this entry")."'>";
+      }
+
+      if(!isset($this->config->departments[trim($key)])){
+        $this->config->departments[trim($key)]="";
+      }
+
+      /* check if this department contains sub-departments
+         Display different image in this case
+       */
+      $non_empty="";
+      $nkey= normalizePreg($key);
+      foreach($this->config->departments as $keyd=>$vald ){
+        if(preg_match('/$nkey\/.*/',$keyd)){
+          $non_empty="full";
+        }
+      }
+
+      $title = preg_replace('/ /', '&nbsp;', @LDAP::fix($this->config->departments[$key]));
+
+      if($val == "."){
+        $field01 = array("string" => "&nbsp;",
+            "attach" => "style='width:20px;'");
+      }else{
+        $field01 = array("string" => "<input type='checkbox' id='item_selected_".base64_encode($key)."' 
+            name='item_selected_".base64_encode($key)."'>" ,
+            "attach" => "style='width:20px;'");
+      }
+
+      $field0 = array("string" => "<img src='images/".$non_empty."folder.png' title='"._("department")."' alt='department'>", "attach" => "style='text-align:center;width:20px;'");
+      $field1 = array("string" => sprintf($linkopen,base64_encode($key),$val), "attach" => "style='' title='".$title."'");
+      $field2 = array("string" => preg_replace("/%KEY%/", base64_encode($key), $actions), "attach" => "style='width:60px;border-right:0px;text-align:
+          right;'");
+
+      $this->AddElement( array($field01,$field0,$field1,$field2));
+    }
+
+    /* Create summary string for list footer */
+    $num_deps=count($list);
+    $num_dep_str = _("Number of listed departments");
+    $str = "<img class='center' src='images/folder.png'
+              title='".$num_dep_str."' alt='".$num_dep_str."'>&nbsp;".$num_deps."&nbsp;&nbsp;&nbsp;&nbsp;";
+    $this->set_List_Bottom_Info($str);
+
+  }
+  function Save()
+  {
+    MultiSelectWindow::Save();
+  }
+
+  function save_object()
+  {
+    /* Save automatic created POSTs like regex, checkboxes */
+    MultiSelectWindow::save_object();   
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/departments/dep_iframe.tpl b/gosa-core/plugins/admin/departments/dep_iframe.tpl
new file mode 100644 (file)
index 0000000..396cf2c
--- /dev/null
@@ -0,0 +1,21 @@
+<h2>{t}Processing the requested operation{/t}</h2>
+{$message}
+<br>
+<br>
+<div style="margin:3px;background-color:white; border:1px solid #A0A0A0">
+<iframe src="{$src}" style="width:100%;height:450px;background-color:#FFFFFF;" name="status">
+       <p>{t}Your browser doesn't support iframes, please use this link to perform the requested operation.{/t}
+       <br>
+       <a href="{$src}">{$src}</a>
+       </p>
+</iframe>
+</div>
+
+<!--
+<p class="seperator">&nbsp;</p>
+<div style="text-align:right;">
+       <p>
+               <input type="submit" name="back" value="{t}Back{/t}">
+       </p>
+</div>
+-->
diff --git a/gosa-core/plugins/admin/departments/dep_move_confirm.tpl b/gosa-core/plugins/admin/departments/dep_move_confirm.tpl
new file mode 100644 (file)
index 0000000..9338b76
--- /dev/null
@@ -0,0 +1,19 @@
+<div style="font-size:18px;">
+ <img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t} - {t}You are currently moving/renaming this department.{/t}
+</div>
+<p>
+{t}Modifying a departments naming attribute 'ou' or base may corrupt acls and snapshot entries for all entire objects.{/t}
+</p>
+<p>
+{t}GOsa can NOT fix this for you, yet.{/t}
+</p>
+<p>
+{t}Before you confirm this action, ensure that everything will be as expected, possibly the best solution is a backup.{/t} 
+</p>
+
+<p class="plugbottom">
+       <input type='submit' name='dep_move_confirm' value='{t}Save{/t}'>
+       &nbsp;
+       <input type='submit' name='cancel_save' value='{t}Cancel{/t}'>
+</p>
+
diff --git a/gosa-core/plugins/admin/departments/generic.tpl b/gosa-core/plugins/admin/departments/generic.tpl
new file mode 100644 (file)
index 0000000..7e353be
--- /dev/null
@@ -0,0 +1,132 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
+ <tr>
+   <td style="vertical-align:top; width:50%">
+     <h2><img class="center" alt="" align="middle" src="images/rightarrow.png"> {t}Properties{/t}</h2>
+     
+     <table summary="">
+      <tr>
+       <td><LABEL for="ou">{t}Name of department{/t}</LABEL>{$must}</td>
+       <td>
+{render acl=$ouACL}
+       <input id="ou" name="ou" size=25 maxlength=60 value="{$ou}" title="{t}Name of subtree to create{/t}">
+{/render}
+       </td>
+      </tr>
+      <tr>
+       <td><LABEL for="description">{t}Description{/t}</LABEL>{$must}</td>
+       <td>
+{render acl=$descriptionACL}
+        <input id="description" name="description" size=25 maxlength=80 value="{$description}" title="{t}Descriptive text for department{/t}">
+{/render}
+       </td>
+      </tr>
+      <tr>
+       <td><LABEL for="businessCategory">{t}Category{/t}</LABEL></td>
+       <td>
+{render acl=$businessCategoryACL}
+        <input id="businessCategory" name="businessCategory" size=25 maxlength=80 value="{$businessCategory}" title="{t}Category for this subtree{/t}">
+{/render}
+       </td>
+      </tr>
+      <tr>
+        <td colspan="2"><br></td>
+      </tr>
+      <tr>
+        <td><LABEL for="base">{t}Base{/t}</LABEL>{$must}</td>
+
+        <td>
+{render acl=$baseACL}
+         <select id="base" size="1" name="base" title="{t}Choose subtree to place department in{/t}"> 
+          {html_options options=$bases selected=$base_select}
+         </select>
+{/render}
+
+{render acl=$baseACL disable_picture='images/folder_gray.png'}
+        <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
+{/render}
+       </td>
+       </tr>
+     </table>
+
+   </td>
+   <td style="border-left:1px solid #A0A0A0">
+    &nbsp;
+   </td>
+   <td>
+     <h2><img class="center" alt="" align="middle" src="images/house.png"> {t}Location{/t}</h2>
+
+     <table summary="" style="width:100%">
+      <tr>
+       <td><LABEL for="st">{t}State{/t}</LABEL></td>
+       <td>
+{render acl=$stACL}
+       <input id="st" name="st" size=25 maxlength=60 value="{$st}" title="{t}State where this subtree is located{/t}">
+{/render}
+       </td>
+      </tr>
+      <tr>
+       <td><LABEL for="l">{t}Location{/t}</LABEL></td>
+       <td>
+{render acl=$lACL}
+       <input id="l" name="l" size=25 maxlength=60 value="{$l}" title="{t}Location of this subtree{/t}">
+{/render}
+       </td>
+      </tr>
+      <tr>
+       <td style="vertical-align:top;"><LABEL for="postalAddress">{t}Address{/t}</LABEL></td>
+       <td>
+{render acl=$postalAddressACL}
+       <textarea id="postalAddress" name="postalAddress" style="width:100%" rows=3 cols=22 title="{t}Postal address of this subtree{/t}">{$postalAddress}</textarea>
+{/render}
+      </tr>
+      <tr>
+       <td><LABEL for="telephoneNumber">{t}Phone{/t}</LABEL></td>
+       <td>
+{render acl=$telephoneNumberACL}
+       <input id="telephoneNumber" name="telephoneNumber" size=25 maxlength=60 value="{$telephoneNumber}" title="{t}Base telephone number of this subtree{/t}">
+{/render}
+       </td>
+      </tr>
+      <tr>
+       <td><LABEL for="facsimileTelephoneNumber">{t}Fax{/t}</LABEL></td>
+       <td>
+{render acl=$facsimileTelephoneNumberACL}
+       <input id="facsimileTelephoneNumber" name="facsimileTelephoneNumber" size=25 maxlength=60 value="{$facsimileTelephoneNumber}" title="{t}Base facsimile telephone number of this subtree{/t}">
+{/render}
+       </td>
+      </tr>
+     </table>
+
+   </td>
+ </tr>
+</table>
+
+
+{if !$UnitTagDiabled}
+
+<!--
+This is not used anymore cause of the new acl implementation
+Its functionality is disabled in class_departmentGeneric.inc
+-->
+
+<p class='seperator'>&nbsp;</p>
+
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
+ <tr>
+   <td style="vertical-align:top; width:100%">
+     <h2><img class="center" alt="" align="middle" src="images/closedlock.png"> {t}Administrative settings{/t}</h2>
+{render acl=$gosaUnitTagACL}
+     <input id="unitTag" type=checkbox name="unitTag" value="1" {$unitTag}><label for="unitTag">{t}Tag department as an independent administrative unit{/t}</label>
+{/render}
+   </td>
+  </tr>
+</table>
+
+{/if}
+<!-- Place cursor -->
+<input type='hidden' name='dep_generic_posted' value='1'>
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('ou');
+  -->
+</script>
diff --git a/gosa-core/plugins/admin/departments/main.inc b/gosa-core/plugins/admin/departments/main.inc
new file mode 100644 (file)
index 0000000..5db6278
--- /dev/null
@@ -0,0 +1,57 @@
+<?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
+*/
+
+if ($remove_lock){
+        if(isset($_SESSION['department'])){
+                $department= $_SESSION['department'];
+                $department->remove_lock();
+                del_lock ($ui->dn);
+                sess_del ('department');
+        }
+} else {
+       /* Create usermanagement object on demand */
+       if (!isset($_SESSION['department']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+               $_SESSION['department']= new departmentManagement($config, $ui);
+       }
+       $department= $_SESSION['department'];
+       
+       /* Show and save dialog */
+       $department->save_object();
+       $output= $department->execute();
+
+       /* Page header*/
+       if (isset($_SESSION['objectinfo'])){
+               $display= print_header(get_template_path('images/department.png'), _("Department management"), "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".@LDAP::fix($_SESSION['objectinfo']));
+       } else {
+               $display= print_header(get_template_path('images/department.png'), _("Department management"));
+       }
+
+       /* Reset requested? */
+       if (isset($_GET['reset']) && $_GET['reset'] == 1){
+               del_lock ($ui->dn);
+               sess_del ('department');
+       }
+
+       $display.= $output;
+       $_SESSION['department']= $department;
+       $config = $department->config;
+}
+
+?>
diff --git a/gosa-core/plugins/admin/departments/remove.tpl b/gosa-core/plugins/admin/departments/remove.tpl
new file mode 100644 (file)
index 0000000..e4e075a
--- /dev/null
@@ -0,0 +1,24 @@
+<div style="font-size:18px;">
+ <img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
+</div>
+<p>
+ {$info}
+ {t}This includes 'all' accounts, systems, etc. in this subtree. 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">
+       {if $multiple}
+               <input type=submit name="delete_multiple_department_confirm" value="{t}Delete{/t}">
+               &nbsp;
+               <input type=submit name="delete_multiple_department_cancel" value="{t}Cancel{/t}">
+               {else}
+               <input type=submit name="delete_department_confirm" value="{t}Delete{/t}">
+               &nbsp;
+               <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
+       {/if}
+</p>
+
diff --git a/gosa-core/plugins/admin/departments/tabs_department.inc b/gosa-core/plugins/admin/departments/tabs_department.inc
new file mode 100644 (file)
index 0000000..cf04bd2
--- /dev/null
@@ -0,0 +1,52 @@
+<?php
+
+class deptabs extends tabs
+{
+  var $base= "";
+
+  function deptabs($config, $data, $dn,$category)
+  {
+    tabs::tabs($config, $data, $dn,$category);
+    $this->base= $this->by_object['department']->base;
+
+    /* Add references/acls/snapshots */
+    $this->addSpecialTabs();
+  }
+
+  function check($ignore_account= FALSE)
+  {
+    return (tabs::check(TRUE));
+  }
+
+
+  function save($ignore_account= FALSE)
+  {
+    $baseobject= $this->by_object['department'];
+    $ou= preg_replace('/,/', '\,', $baseobject->ou);
+    $new_dn= @LDAP::convert('ou='.$ou.','.$baseobject->base);
+    
+    if($ignore_account){
+      if ($this->dn != $new_dn && $this->dn != "new"){
+        /* if( new_dn is subtree of this->dn ) */
+        $cnt1 = count(split(",",$this->dn));
+        $cnt2 = count(split(",",$new_dn));
+        if((strstr($new_dn,$this->dn))&&($cnt1<$cnt2)){
+          print_red(_("Try to move tree failed. Destination tree is subtree of source tree."));
+        }else{
+          /* Prepare to be moved */
+          $baseobject->recursive_move($this->dn, $new_dn);                     
+          $this->by_object['department'] = $baseobject;
+          return;
+        }
+      }
+    }
+    $this->dn= $new_dn;
+    $baseobject->dn= $this->dn;
+    $this->by_object['department']= $baseobject;
+    return(tabs::save(TRUE));
+  }
+
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/devices/class_deviceGeneric.inc b/gosa-core/plugins/admin/devices/class_deviceGeneric.inc
new file mode 100644 (file)
index 0000000..095adf7
--- /dev/null
@@ -0,0 +1,241 @@
+<?php
+
+class deviceGeneric extends plugin
+{
+  public $dn            = "";
+  public $cn            = "";
+  public $orig_cn       = "";
+  public $description   = "";
+  public $vendor        = "";
+  public $dev_id        = "";
+  public $serial        = "";
+  public $base          = "";  
+
+  public $posts           = array("description","dev_id","serial","vendor");
+  public $attributes      = array("cn");
+  public $objectclasses   = array("top","gotoDevice");
+
+  public $CopyPasteVars   = array("orig_cn","description","vendor","dev_id","serial","base");
+
+  public function deviceGeneric(&$config,$dn = NULL)
+  {
+    plugin::plugin($config,$dn);
+
+    $this->is_account = TRUE;
+
+    /* Set class values */
+    if(isset($this->attrs['gotoHotplugDevice'][0])){
+      $tmp = preg_split("/\|/",$this->attrs['gotoHotplugDevice'][0]);
+      $this->cn         = $this->attrs['cn'][0];
+      $this->description= $tmp[0];
+      $this->dev_id     = $tmp[1];
+      $this->serial     = $tmp[2];
+      $this->vendor     = $tmp[3];
+    }     
+
+    $this->orig_cn = $this->cn;
+
+    /* Set Base */
+    if ($this->dn == "new"){
+      if(isset($_SESSION['CurrentMainBase'])){
+        $this->base= $_SESSION['CurrentMainBase'];
+      }else{
+        $ui= get_userinfo();
+        $this->base= dn2base($ui->dn);
+      }
+    } else {
+      $this->base =preg_replace ("/^[^,]+,ou=devices,/","",$this->dn);
+    }
+  }
+
+
+  public function execute()
+  {
+    $smarty = get_smarty();
+    $smarty->assign("base",$this->base);
+    $smarty->assign("bases",$this->get_allowed_bases());
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr,$this->$attr);
+    }
+    foreach($this->posts as $attr){
+      $smarty->assign($attr,$this->$attr);
+    }
+    return($smarty->fetch(get_template_path("deviceGeneric.tpl",TRUE,dirname(__FILE__))));
+  }
+
+  
+  public function check()
+  {
+    $message = plugin::check();
+
+    if(empty($this->cn)||(preg_match("/[^a-z0-9]/i",$this->cn))){
+      $message[]=_("Please specify a valid name. Only 0-9 a-Z is allowed.");
+    }
+    if(preg_match("/[^a-z0-9!\"?.,;:-_\(\) ]/i",$this->description)){
+      $message[]=_("Invalid character in description. Please specify a valid description.");
+    }
+
+    /* Skip serial check if vendor and product id are given */
+    if(preg_match("/^\s+$/i",$this->dev_id)){
+      $message[]=_("Please specify a valid iSerial.");
+    }
+    if(empty($this->serial) || !$this->is_2byteHex($this->serial)){
+      $message[]=_("Please specify a valid vendor ID. (2 byte hex like '0xFFFF')");
+    }
+    if(empty($this->vendor) || !$this->is_2byteHex($this->vendor)){
+      $message[]=_("Please specify a valid product ID. (2 byte hex like '0xFFFF')");
+    }
+   
+    /* Check if entry already exists */ 
+    if($this->cn != $this->orig_cn){
+      $ldap = $this->config->get_ldap_link();
+      $ldap->search("(&(objectClass=gotoDevice)(cn=".$this->cn."*))",array("cn"));
+      if($ldap->count()){
+        $message[]=_("An Entry with this name already exists.");
+      }
+    }
+
+    return($message);
+  }
+
+
+  public function save_object()
+  {
+    if(isset($_POST['deviceGeneric_posted'])){
+      plugin::save_object();
+  
+      if(isset($_POST['base'])){
+        $tmp = $this->get_allowed_bases();
+        if(isset($tmp[get_post("base")])){
+          $this->base = get_post("base");
+        }
+      }
+    
+      foreach($this->posts as $post){
+        if(isset($_POST[$post])){
+          $this->$post = get_post($post);
+        }
+      }
+    }
+  }
+
+  
+  public function remove_from_parent()
+  {
+    plugin::remove_from_parent();
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+
+    $ldap->search("(&(objectClass=gotoEnvironment)(gotoHotplugDeviceDN=".$this->dn."))",array("cn","gotoHotplugDeviceDN"));
+    $skip = FALSE;
+    $str ="";
+    $cnt = 3;
+    while($cnt && $attrs = $ldap->fetch()){
+      $skip =TRUE;
+      $str .= $attrs['cn'][0].", ";
+      $cnt --;
+    }
+    if($skip){
+      $str  = preg_replace("/, $/","",$str);
+      if($cnt == 0){
+        $str .= "...";
+      }
+      print_red(sprintf(_("Can't remove the device '%s' it is still in use be this user(s) : %s"),$this->cn,$str));
+    }else{
+      $ldap->rmdir_recursive($this->dn);
+    }
+  }
+
+
+  public function save()
+  {
+    plugin::save();
+
+    $this->attrs['gotoHotplugDevice'] = "";
+    foreach($this->posts as $post){
+      $this->attrs['gotoHotplugDevice'] .= $this->$post."|"; 
+    }
+    $this->attrs['gotoHotplugDevice'] = preg_replace("/\|$/","",$this->attrs['gotoHotplugDevice']);
+
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->cat($this->dn);
+    if($ldap->count()){
+      $ldap->cd($this->dn);
+      $ldap->modify($this->attrs);
+    }else{
+      $ldap->create_missing_trees(preg_replace("/^[^,]+,/","",$this->dn));
+      $ldap->cd($this->dn);
+      $ldap->add($this->attrs);
+    }
+    show_ldap_error($ldap->get_error(),_("Device could not be saved."));
+  }
+
+
+  /* check if given str in like this 0xffff*/
+  function is_2byteHex($str)
+  {
+    return !strlen($str) || preg_match("/^(0x|x|)[a-f0-9][a-f0-9][a-f0-9][a-f0-9]/i",$str);
+  }
+
+
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);
+    $source_o = new deviceGeneric($this->config,$source['dn']);
+    foreach($this->CopyPasteVars as $post){
+      $this->$post = $source_o->$post;
+    }
+  }
+
+
+  /* Return a dialog with all fields that must be changed,
+     if we want to copy this entry */
+  function getCopyDialog()
+  {
+    $str = "";
+    $smarty = get_smarty();
+    $smarty->assign("cn",         $this->cn);
+    $str = $smarty->fetch(get_template_path("paste_deviceGeneric.tpl",TRUE,dirname(__FILE__)));
+
+    $ret = array();
+    $ret['string'] = $str;
+    $ret['status'] = "";
+    return($ret);
+  }
+
+
+  /* Save all */
+  function saveCopyDialog()
+  {
+    $attrs = array("cn");
+    foreach($attrs as $attr){
+      if(isset($_POST[$attr])){
+        $this->$attr = $_POST[$attr];
+      }
+    }
+  }
+
+
+
+  /* Return plugin informations for acl handling  */
+  public static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Generic"),
+          "plDescription" => _("Device generic"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 0,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("devices" => array("description"  => _("Devices"),
+                                                        "objectClass"  => "gotoHotplugDevice")),
+          "plProvidedAcls"=> array(
+            "cn"                          => _("Name"))
+          ));
+
+  }
+       
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/devices/class_deviceManagement.inc b/gosa-core/plugins/admin/devices/class_deviceManagement.inc
new file mode 100644 (file)
index 0000000..dbdfc0f
--- /dev/null
@@ -0,0 +1,554 @@
+<?php
+
+class deviceManagement extends plugin
+{
+
+  /* Definitions */
+  var $plHeadline     = "Devices";
+  var $plDescription  = "Manage devices";
+
+  /* Dialog attributes */
+  var $ui                             = NULL;
+  var $DivListDevices               = NULL;
+  var $enableReleaseManagement        = false;
+  var $devicetabs                       = NULL;
+  var $snapDialog                     = NULL;
+  var $CopyPasteHandler               = NULL;
+  var $start_pasting_copied_objects;
+  var $dn ="";
+
+  function deviceManagement(&$config, $dn= NULL)
+  {
+    plugin::plugin ($config, $dn);
+    $this->ui = get_userinfo();  
+
+    /* Check if copy & paste is activated */
+    if($this->config->boolValueIsTrue("MAIN","ENABLECOPYPASTE")){
+      $this->CopyPasteHandler = new CopyPasteHandler($this->config);
+    }
+
+    /* Creat dialog object */
+    $this->DivListDevices = new divListDevices($this->config,$this);
+  }
+
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /****************
+      Variable init
+     ****************/
+
+    /* These vars will be stored if you try to open a locked device,
+        to be able to perform your last requests after showing a warning message */
+    $_SESSION['LOCK_VARS_TO_USE'] = array("/^act$/","/^id$/","/^device_edit_/",
+                                          "/^device_del_/","/^item_selected/","/^remove_multiple_devices/");
+
+    $smarty       = get_smarty();             // Smarty instance
+    $s_action     = "";                       // Contains the action to proceed
+    $s_entry      = "";                       // The value for s_action
+    $base_back    = "";                       // The Link for Backbutton
+
+    /* Test Posts */
+    foreach($_POST as $key => $val){
+
+      if(preg_match("/device_del.*/",$key)){
+        $s_action = "del";
+        $s_entry  = preg_replace("/device_".$s_action."_/i","",$key);
+      }elseif(preg_match("/device_edit_.*/",$key)){
+        $s_action="edit";
+        $s_entry  = preg_replace("/device_".$s_action."_/i","",$key);
+      }elseif(preg_match("/^copy_.*/",$key)){
+        $s_action="copy";
+        $s_entry  = preg_replace("/^copy_/i","",$key);
+      }elseif(preg_match("/^cut_.*/",$key)){
+        $s_action="cut";
+        $s_entry  = preg_replace("/^cut_/i","",$key);
+      }elseif(preg_match("/^device_new.*/",$key)){
+        $s_action="new";
+      }elseif(preg_match("/^remove_multiple_devices/",$key)){
+        $s_action="del_multiple";
+      }elseif(preg_match("/^editPaste.*/i",$key)){
+        $s_action="editPaste";
+      }elseif(preg_match("/^multiple_copy_devices/",$key)){
+        $s_action = "copy_multiple";
+     }elseif(preg_match("/^multiple_cut_devices/",$key)){
+        $s_action = "cut_multiple";
+      }
+    }
+
+    if((isset($_GET['act']))&&($_GET['act']=="edit_entry")){
+      $s_action ="edit";
+      $s_entry  = $_GET['id'];
+    }
+
+    $s_entry  = preg_replace("/_.$/","",$s_entry);
+
+
+    /* handle C&P from layers menu */
+    if(isset($_POST['menu_action']) && preg_match("/^multiple_copy_systems/",$_POST['menu_action'])){
+      $s_action = "copy_multiple";
+    }
+    if(isset($_POST['menu_action']) && preg_match("/^multiple_cut_systems/",$_POST['menu_action'])){
+      $s_action = "cut_multiple";
+    }
+    if(isset($_POST['menu_action']) && preg_match("/^editPaste/",$_POST['menu_action'])){
+      $s_action = "editPaste";
+    }
+
+    /* Create options */
+    if(isset($_POST['menu_action']) && $_POST['menu_action'] == "device_new"){
+      $s_action = "new";
+    }
+
+    /* handle remove from layers menu */
+    if(isset($_POST['menu_action']) && preg_match("/^remove_multiple/",$_POST['menu_action'])){
+      $s_action = "del_multiple";
+    }
+
+    /****************
+      Copy & Paste handling
+     ****************/
+
+    /* Display the copy & paste dialog, if it is currently open */
+    $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
+    if($ret){
+      return($ret);
+    }
+
+    /****************
+      Create a new device type
+     ****************/
+
+    /* New device type? */
+    $ui = get_userinfo();
+    $acl = $ui->get_permissions($this->DivListDevices->selectedBase,"devices/deviceGeneric");
+    if (($s_action=="new") && preg_match("/c/",$acl)){
+
+      /* By default we set 'dn' to 'new', all relevant plugins will
+         react on this. */
+      $this->dn= "new";
+
+      /* Create new usertab object */
+      $this->devicetabs= new devicetabs($this->config, $this->config->data['TABS']['DEVICETABS'], $this->dn,"devices");
+      $this->devicetabs->set_acl_base($this->DivListDevices->selectedBase);
+    }
+
+
+    /****************
+      Edit entry canceled
+     ****************/
+
+    /* Cancel dialogs */
+    if (isset($_POST['edit_cancel']) && is_object($this->devicetabs)){
+      del_lock ($this->devicetabs->dn);
+      unset ($this->devicetabs);
+      $this->devicetabs= NULL;
+      unset ($_SESSION['objectinfo']);
+    }
+
+
+    /****************
+      Edit entry finished
+     ****************/
+
+    /* Finish device edit is triggered by the tabulator dialog, so
+       the user wants to save edited data. Check and save at this point. */
+    if ((isset($_POST['edit_finish']) || isset($_POST['edit_apply']) ) && (isset($this->devicetabs->config))){
+
+      /* Check tabs, will feed message array */
+      $this->devicetabs->save_object();
+      $message= $this->devicetabs->check();
+
+      /* Save, or display error message? */
+      if (count($message) == 0){
+
+        /* Save data data to ldap */
+#        $this->devicetabs->set_release($this->DivListDevices->selectedRelease);
+        $this->devicetabs->save();
+
+        if (!isset($_POST['edit_apply'])){
+          /* device type has been saved successfully, remove lock from LDAP. */
+          if ($this->dn != "new"){
+            del_lock ($this->dn);
+          }
+          unset ($this->devicetabs);
+          $this->devicetabs= NULL;
+          unset ($_SESSION['objectinfo']);
+        }
+      } else {
+       /* Ok. There seem to be errors regarding to the tab data,
+           show message and continue as usual. */
+        show_errors($message);
+      }
+    }
+
+
+    /****************
+      Edit entry
+     ****************/
+
+    /* User wants to edit data? */
+    if (($s_action=="edit") && (!isset($this->devicetabs->config))){
+
+      /* Get 'dn' from posted 'devicelist', must be unique */
+      $this->dn= $this->devices[$s_entry]['dn'];
+
+      /* Check locking, save current plugin in 'back_plugin', so
+         the dialog knows where to return. */
+      if (($user= get_lock($this->dn)) != ""){
+        return(gen_locked_message ($user, $this->dn));
+      }
+
+      /* Lock the current entry, so everyone will get the
+         above dialog */
+      add_lock ($this->dn, $this->ui->dn);
+
+
+      /* Register devicetabs to trigger edit dialog */
+      $this->devicetabs= new devicetabs($this->config,$this->config->data['TABS']['DEVICETABS'], $this->dn,"devices");
+      $this->devicetabs->set_acl_base($this->dn);
+      $_SESSION['objectinfo']= $this->dn;
+    }
+
+
+    /********************
+      Delete MULTIPLE entries requested, display confirm dialog
+     ********************/
+    if ($s_action=="del_multiple"){
+      $ids = $this->list_get_selected_items();
+
+      if(count($ids)){
+
+        foreach($ids as $id){
+          $dn = $this->devices[$id]['dn'];
+          if (($user= get_lock($dn)) != ""){
+            return(gen_locked_message ($user, $dn));
+          }
+          $this->dns[$id] = $dn;
+        }
+
+        $dns_names = "<br><pre>";
+        foreach($this->dns as $dn){
+          add_lock ($dn, $this->ui->dn);
+          $dns_names .= $dn."\n";
+        }
+        $dns_names .="</pre>";
+
+        /* Lock the current entry, so nobody will edit it during deletion */
+        if (count($this->dns) == 1){
+          $smarty->assign("intro",     sprintf(_("You're about to delete the following entry %s"), @LDAP::fix($dns_names)));
+        } else {
+          $smarty->assign("intro",     sprintf(_("You're about to delete the following entries %s"), @LDAP::fix($dns_names)));
+        }
+        $smarty->assign("multiple", true);
+        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+      }
+    }
+
+
+    /********************
+      Delete MULTIPLE entries confirmed
+     ********************/
+
+    /* Confirmation for deletion has been passed. Users should be deleted. */
+    if (isset($_POST['delete_multiple_device_confirm'])){
+
+      $ui = get_userinfo();
+
+      /* Remove user by user and check acls before removeing them */
+      foreach($this->dns as $key => $dn){
+
+        $acl = $ui->get_permissions($dn,"devices/deviceGeneric");
+        if(preg_match("/d/",$acl)){
+
+          /* Delete request is permitted, perform LDAP action */
+          $this->devicetabs= new devicetabs($this->config, $this->config->data['TABS']['DEVICETABS'], $dn,"devices");
+          $this->devicetabs->set_acl_base($dn);
+          $this->devicetabs->delete ();
+          unset ($this->devicetabs);
+          $this->devicetabs= NULL;
+
+        } else {
+          /* Normally this shouldn't be reached, send some extra
+             logs to notify the administrator */
+          print_red (_("You are not allowed to delete this device type!"));
+          new log("security","devices/".get_class($this),$dn,array(),"Tried to trick deletion.");
+        }
+        /* Remove lock file after successfull deletion */
+        del_lock ($dn);
+        unset($this->dns[$key]);
+      }
+    }
+
+
+    /********************
+      Delete MULTIPLE entries Canceled
+     ********************/
+
+    /* Remove lock */
+    if(isset($_POST['delete_multiple_device_cancel'])){
+      foreach($this->dns as $key => $dn){
+        del_lock ($dn);
+        unset($this->dns[$key]);
+      }
+    }
+
+
+    /****************
+      Delete device type
+     ****************/
+
+    /* Remove user was requested */
+    if ($s_action == "del"){
+
+      /* Get 'dn' from posted 'uid' */
+      $this->dn= $this->devices[$s_entry]['dn'];
+
+      /* Load permissions for selected 'dn' and check if
+         we're allowed to remove this 'dn' */
+      $ui = get_userinfo();
+      $acl = $ui->get_permissions($this->dn,"devices/deviceGeneric");
+      if (preg_match("/d/",$acl)){
+
+        /* Check locking, save current plugin in 'back_plugin', so
+           the dialog knows where to return. */
+        if (($user= get_lock($this->dn)) != ""){
+          return (gen_locked_message ($user, $this->dn));
+        }
+
+        /* Lock the current entry, so nobody will edit it during deletion */
+        add_lock ($this->dn, $this->ui->dn);
+        $smarty= get_smarty();
+        $smarty->assign("intro", sprintf(_("You're about to delete the device '%s'."), @LDAP::fix($this->dn)));
+        $smarty->assign("multiple", false);
+        return($smarty->fetch (get_template_path('remove.tpl', TRUE)));
+      } else {
+
+        /* Obviously the user isn't allowed to delete. Show message and
+           clean session. */
+       print_red (_("You are not allowed to delete this device!"));
+      }
+    }
+
+
+    /****************
+      Delete device confirmed
+     ****************/
+
+    /* Confirmation for deletion has been passed. Group should be deleted. */
+    if (isset($_POST['delete_device_confirm'])){
+
+      /* Some nice guy may send this as POST, so we've to check
+         for the permissions again. */
+      $ui = get_userinfo();
+      $acl = $ui->get_permissions($this->dn,"devices/deviceGeneric");
+      if(preg_match("/d/",$acl)){
+
+        /* Delete request is permitted, perform LDAP action */
+        $this->devicetabs= new devicetabs($this->config, $this->config->data['TABS']['DEVICETABS'], $this->dn,"devices");
+        $this->devicetabs->set_acl_base($this->dn);
+        $this->devicetabs->delete ();
+        unset ($this->devicetabs);
+        $this->devicetabs= NULL;
+
+      } else {
+
+        /* Normally this shouldn't be reached, send some extra
+           logs to notify the administrator */
+        print_red (_("You are not allowed to delete this device!"));
+        new log("security","devices/".get_class($this),$dn,array(),"Tried to trick deletion.");
+      }
+
+      /* Remove lock file after successfull deletion */
+      del_lock ($this->dn);
+    }
+
+
+    /****************
+      Delete device canceled
+     ****************/
+
+    /* Delete device canceled? */
+    if (isset($_POST['delete_cancel'])){
+      del_lock ($this->dn);
+      unset($_SESSION['objectinfo']);
+  }
+
+    /* Show tab dialog if object is present */
+    if (($this->devicetabs) && (isset($this->devicetabs->config))){
+      $display= $this->devicetabs->execute();
+
+      /* Don't show buttons if tab dialog requests this */
+      if (!$this->devicetabs->by_object[$this->devicetabs->current]->dialog){
+        $display.= "<p style=\"text-align:right\">\n";
+        $display.= "<input type=\"submit\" name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
+        $display.= "&nbsp;\n";
+        if ($this->dn != "new"){
+          $display.= "<input type=submit name=\"edit_apply\" value=\""._("Apply")."\">\n";
+          $display.= "&nbsp;\n";
+        }
+        $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+        $display.= "</p>";
+      }
+      return ($display);
+    }
+
+
+    /****************
+      Dialog display
+     ****************/
+
+        /* Check if there is a snapshot dialog open */
+    $base = $this->DivListDevices->selectedBase;
+    if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases())){
+      return($str);
+    }
+
+    /* Display dialog with system list */
+    $this->DivListDevices->parent = $this;
+    $this->DivListDevices->execute();
+    $this->DivListDevices->AddDepartments($this->DivListDevices->selectedBase,3,1);
+    $this->reload();
+    $this->DivListDevices->setEntries($this->devices);
+    return($this->DivListDevices->Draw());
+
+  }
+
+  function save_object() {
+    $this->DivListDevices->save_object();
+  }
+
+
+  /* Return departments, that will be included within snapshot detection */
+  function get_used_snapshot_bases()
+  {
+    return(array("ou=devices,".$this->DivListDevices->selectedBase));
+  }
+
+  function copyPasteHandling_from_queue($s_action,$s_entry)
+  {
+    /* Check if Copy & Paste is disabled */
+    if(!is_object($this->CopyPasteHandler)){
+      return("");
+    }
+
+    /* Add a single entry to queue */
+    if($s_action == "cut" || $s_action == "copy"){
+
+      /* Cleanup object queue */
+      $this->CopyPasteHandler->cleanup_queue();
+      $dn = $this->devices[$s_entry]['dn'];
+      $this->CopyPasteHandler->add_to_queue($dn,$s_action,"devicetabs","DEVICETABS","devices");
+    }
+
+    /* Add entries to queue */
+    if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
+
+      /* Cleanup object queue */
+      $this->CopyPasteHandler->cleanup_queue();
+
+      /* Add new entries to CP queue */
+      foreach($this->list_get_selected_items() as $id){
+        $dn = $this->devices[$id]['dn'];
+
+        if($s_action == "copy_multiple"){
+          $this->CopyPasteHandler->add_to_queue($dn,"copy","devicetabs","DEVICETABS","devices");
+        }
+        if($s_action == "cut_multiple"){
+          $this->CopyPasteHandler->add_to_queue($dn,"cut","devicetabs","DEVICETABS","devices");
+        }
+      }
+    }
+
+    /* Start pasting entries */
+    if($s_action == "editPaste"){
+      $this->start_pasting_copied_objects = TRUE;
+    }
+
+    /* Return C&P dialog */
+    if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
+
+      /* Load entry from queue and set base */
+      $this->CopyPasteHandler->load_entry_from_queue();
+      $this->CopyPasteHandler->SetVar("base",$this->DivListDevices->selectedBase);
+
+      /* Get dialog */
+      $data = $this->CopyPasteHandler->execute();
+
+      /* Return dialog data */
+      if(!empty($data)){
+        return($data);
+      }
+    }
+
+    /* Automatically disable status for pasting */
+    if(!$this->CopyPasteHandler->entries_queued()){
+      $this->start_pasting_copied_objects = FALSE;
+    }
+    return("");
+  }
+
+
+
+  function reload()
+  {
+    /* Set base for all searches */
+    $base       = $this->DivListDevices->selectedBase;
+    $Regex      = $this->DivListDevices->Regex;
+    $SubSearch  = $this->DivListDevices->SubSearch;
+    $Flags      =  GL_NONE | GL_SIZELIMIT;
+    $Filter     = "(&(|(cn=".$Regex.")(description=".$Regex."))(objectClass=gotoDevice))";
+    $tmp        = array();
+
+    /* In case of subsearch, add the subsearch flag */
+    if($SubSearch){
+      $Flags    |= GL_SUBSEARCH;
+    }else{
+      $base ="ou=devices,".$base;
+    }
+
+    /* Get results and create index */
+    $res= get_list($Filter, "devices", $base, array("cn","description","dn","objectClass"), $Flags);
+    foreach ($res as $val){
+      $tmp[strtolower($val['cn'][0]).$val['cn'][0].$val['dn']]=$val;
+    }
+
+    /* sort entries */
+    ksort($tmp);
+    $this->devices=array();
+    foreach($tmp as $val){
+      $this->devices[]=$val;
+    }
+    reset ($this->devices);
+  }
+
+  function remove_lock()
+  {
+    if (isset($this->devicetabs->dn)){
+      del_lock ($this->devicetabs->dn);
+    }
+  }
+
+  function list_get_selected_items()
+  {
+    $ids = array();
+    foreach($_POST as $name => $value){
+      if(preg_match("/^item_selected_[0-9]*$/",$name)){
+        $id   = preg_replace("/^item_selected_/","",$name);
+        $ids[$id] = $id;
+      }
+    }
+    return($ids);
+  }
+
+
+  function remove_from_parent()
+  {
+    /* This cannot be removed... */
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/devices/class_divListDevices.inc b/gosa-core/plugins/admin/devices/class_divListDevices.inc
new file mode 100755 (executable)
index 0000000..fb09fe8
--- /dev/null
@@ -0,0 +1,303 @@
+<?php
+
+class divListDevices extends MultiSelectWindow
+{
+  /* Current base */
+  var $selectedBase       = "";
+  var $departments        = array();
+  var $parent               ;
+  var $ui                   ;
+
+  /* Regex */
+  var $Regex              = "*";
+
+  /* Subsearch checkbox */
+  var $SubSearch;
+
+  function divListDevices (&$config, &$parent)
+  {
+    /* Create divlist and setup */
+    MultiSelectWindow::MultiSelectWindow($config, "Devices", "devices");
+    /* initialize required attributes */ 
+    $this->parent           = &$parent;
+    $this->ui               = get_userinfo();
+
+    /* set Page header */
+    $action_col_size = 80;
+    if($this->parent->snapshotEnabled()){
+      $action_col_size += 38;
+    }
+
+    /* Set list strings */
+    $this->SetTitle       (_("List of defined devices"));
+    $this->SetSummary     (_("List of defined devices"));
+    $this->SetInformation (_("This menu allows you to add, edit and remove selected devices. You may want to use the range selector on top of the device listbox, when working with a large number of devices."));
+
+    /* Result page will look like a headpage */
+    $this->SetHeadpageMode();
+    $this->EnableAplhabet(true);
+  
+    /* Disable buttonsm */
+    $this->EnableCloseButton(false);
+    $this->EnableSaveButton (false);
+
+    /* Toggle all selected / deselected */
+    $chk = "<input type='checkbox' id='select_all' name='select_all'
+               onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
+
+    /* set Page header */
+    $this->AddHeader(array("string"=> $chk,          "attach"=>"style='width:20px;'"));
+    $this->AddHeader(array("string" => "&nbsp;",                "attach" => "style='text-align:center;width:20px;'"));
+    $this->AddHeader(array("string" => _("Device name")." / "._("Department"), "attach" => "style=''"));
+    $this->AddHeader(array("string" => _("Actions"),            "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'"));
+
+    /* Add SubSearch checkbox */
+    $this->AddCheckBox("SubSearch",  _("Select to search within subtrees"), _("Search in subtrees"), false);
+
+    /*                  Name                 ,Text                              ,Default  , Connect with alphabet  */
+    $this->AddRegex   ("Regex",     _("Display devices matching"),"*" , true);
+  }
+
+
+  /* Create list header, with create / copy & paste etc*/
+  function GenHeader()
+  {
+    /* Prepare departments,
+       which are shown in the listbox on top of the listbox
+     */
+    $options= "";
+
+    /* Get all departments within this subtree */
+    $ui= get_userinfo();
+    $first = "";
+    $found = FALSE;
+    $base = $this->config->current['BASE'];
+
+    /* Add base */
+    $tmp = array();
+    $tmp[] = array("dn"=>$this->config->current['BASE']);
+    $tmp=  array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
+                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
+
+    $deps = array();
+    foreach($tmp as $tm){
+      $deps[$tm['dn']] = $tm['dn'];
+    }
+
+    /* Load possible departments */
+    $ui= get_userinfo();
+    $tdeps= $ui->get_module_departments($this->module);
+    $ids = $this->config->idepartments;
+    $first = "";
+    $found = FALSE;
+    foreach($ids as $dep => $name){
+      if(isset($deps[$dep]) && in_array_ics($dep, $tdeps)){
+
+        /* Keep first base dn in mind, we could need this
+         *  info if no valid base was found
+         */
+        if(empty($first)) {
+          $first = $dep['dn'];
+        }
+
+        $value = $ids[$dep];
+        if ($this->selectedBase == $dep){
+          $found = TRUE;
+          $options.= "<option selected='selected' value='".$dep."'>$value</option>";
+        } else {
+          $options.= "<option value='".$dep."'>$value</option>";
+        }
+      }
+    }
+
+    /* The currently used base is not visible with your acl setup.
+     * Set base to first useable base.
+     */
+    if(!$found){
+      $this->selectedBase = $first;
+    }
+
+    /* Get acls */
+    $ui       = get_userinfo();
+    $acl      = $ui->get_permissions("cn=dummy,ou=devices,".$this->selectedBase,"devices/deviceGeneric");
+    $acl_all  = $ui->has_complete_category_acls($this->selectedBase,"devices") ;
+
+
+    /* If this is true we add an additional seperator. Just look a few lines below */  
+    $listhead = MultiSelectWindow::get_default_header();
+
+    /* And at least add a department selection box */
+    $listhead .=  _("Base")."&nbsp;<select name='CurrentMainBase' 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;";
+
+    /* Create Layers menu */
+    $s  = ".|"._("Actions")."|\n";
+    $s .= "..|<img src='images/list_new.png' alt='' border='0' class='center'>".
+      "&nbsp;"._("Create")."|\n";
+
+    /* Append create options */
+    if(preg_match("/c/",$acl)) {
+      $s.= "...|<input class='center' type='image' src='images/list_new_device.png' alt=''>".
+        "&nbsp;"._("Device")."|device_new|\n";
+    }
+
+    /* Multiple options */
+    $s.= "..|---|\n";
+    $s.= "..|<img src='images/edittrash.png' alt='' border='0' class='center'>".
+      "&nbsp;"._("Remove")."|"."remove_multiple|\n";
+
+    /* Add multiple copy & cut icons */
+    if(is_object($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
+      $s.= "..|---|\n";
+      $s.= "..|<img src='images/editcopy.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Copy")."|"."multiple_copy_systems|\n";
+      $s.= "..|<img src='images/editcut.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Cut")."|"."multiple_cut_systems|\n";
+
+      if($this->parent->CopyPasteHandler->entries_queued()){
+        $img = "<img border='0' class='center' src='images/editpaste.png' alt=''>";
+        $s.="..|".$img."&nbsp;"._("Paste")."|editPaste|\n";
+      }else{
+        $img = "<img border='0' class='center' src='images/cant_editpaste.png' alt=''>";
+        $s.="..|".$img."&nbsp;"._("Paste")."\n";
+      }
+    }
+
+    /* Add snapshot icons */
+    if(preg_match("/(c.*w|w.*c)/",$acl_all)){
+      $s .= "..|---|\n";
+      $s .= $this->get_snapshot_header(TRUE);
+    }
+
+    $this->SetDropDownHeaderMenu($s);
+                                                                       
+    $this->SetListHeader($listhead);
+  }
+
+
+  /* Some basic settings */
+  function execute()
+  {
+    $this->ClearElementsList();
+    $this->GenHeader();
+  }
+
+
+  function setEntries($list)
+  {
+    /********************
+      Variable init
+     ********************/
+
+    /* Create links */
+    $linkopen = "<a href='?plug=".$_GET['plug']."&amp;act=dep_open&amp;dep_id=%s'>%s</a>";
+    $editlink = "<a href='?plug=".$_GET['plug']."&amp;id=%s&amp;act=edit_entry'>%s</a>";
+    $userimg  = "<img class='center' src='images/select_groups.png' alt='User'    title='%s'>";
+    $deviceimg  = "<img class='center' src='images/select_device.png' alt='A'  title='"._("Device")."'>";
+    $empty    = "<img class='center' src='images/empty.png' style='width:16px;height:16px;' alt=''>";
+
+    /* set Page header */
+    $action_col_size = 80;
+    if($this->parent->snapshotEnabled()){
+      $action_col_size += 38;
+    }
+
+    /********************
+      Attach objects
+     ********************/
+
+    foreach($list as $key => $val){
+
+      $ui       = get_userinfo();
+      $acl      = $ui->get_permissions($val['dn'],"devices/deviceGeneric");
+      $acl_all  = $ui->has_complete_category_acls($val['dn'],"devices") ;
+
+      /* Create action icons */
+      $actions = "";
+      if(preg_match("/(c.*w|w.*c)/",$acl_all)){
+        $actions .= $this->GetSnapShotActions($val['dn']);
+      }
+
+      /* Get copy Paste icons */
+      if(($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
+        $actions.= "<input class='center' type='image'
+          src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
+        $actions.= "<input class='center' type='image'
+          src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
+      }
+
+      $actions.= "<input class='center' type='image'
+        src='images/edit.png' alt='"._("edit")."' name='device_edit_%KEY%' title='"._("Edit this entry")."'>";
+
+      /* Add delete button */
+      if(preg_match("/d/",$acl)){
+        $actions.= "<input class='center' type='image'
+          src='images/edittrash.png' alt='"._("delete")."' name='device_del_%KEY%' title='"._("Delete this entry")."'>";
+      }else{
+        $actions.= "<img src='images/empty.png' alt='&nbsp;' class='center'>";
+      }
+
+      $title = "title='".preg_replace('/ /', '&nbsp;', @LDAP::fix($val['dn']))."'";
+
+      if(!isset($val['description'][0])){
+        $desc = "";
+      }else{
+        $desc = " - [ ".$val['description'][0]." ]";
+      }
+
+      /* Cutted objects should be displayed in light grey */
+      $display = $val['cn'][0].$desc;
+      if($this->parent->CopyPasteHandler){
+        foreach($this->parent->CopyPasteHandler->queue as $queue_key => $queue_data){
+          if($queue_data['dn'] == $val['dn']) {
+            $display = "<font color='#999999'>".$display."</font>";
+            break;
+          }
+        }
+      }
+
+
+      /* Create each field */
+      $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
+                      "attach" => "style='width:20px;'");
+      $field1 = array("string" => sprintf($deviceimg,$val['dn']), "attach" => "style='text-align:center;width:20px;'");
+      $field2 = array("string" => sprintf($editlink,$key,$display), "attach" => "style='' ".$title);
+      $field3 = array("string" => preg_replace("/%KEY%/", $key, $actions), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'");
+      $this->AddElement(array($field0,$field1,$field2,$field3));
+    }
+
+
+    /* Create summary string for list footer */
+    $num_deps=0;
+    if(!$this->SubSearch){
+      $num_deps = count($this->Added_Departments);
+    }
+    $num_objs = count($list);
+
+    $num_obj_str = _("Number of listed devices");
+    $num_dep_str = _("Number of listed departments");
+
+    $str = "<img class='center' src='images/select_devices.png'
+              title='".$num_obj_str."' alt='".$num_obj_str."'>&nbsp;".$num_objs."&nbsp;&nbsp;&nbsp;&nbsp;";
+    $str.= "<img class='center' src='images/folder.png'
+              title='".$num_dep_str."' alt='".$num_dep_str."'>&nbsp;".$num_deps."&nbsp;&nbsp;&nbsp;&nbsp;";
+
+    $this->set_List_Bottom_Info($str);
+  }
+
+  function Save()
+  {
+    MultiSelectWindow::Save();  
+  }
+
+  function save_object()
+  {
+    /* Save automatic created POSTs like regex, checkboxes */
+    MultiSelectWindow::save_object(); 
+  }
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/devices/deviceGeneric.tpl b/gosa-core/plugins/admin/devices/deviceGeneric.tpl
new file mode 100644 (file)
index 0000000..59f7b9c
--- /dev/null
@@ -0,0 +1,66 @@
+
+<h2>{t}Devices{/t}</h2>
+
+<table width="100%" summary="">
+ <tr>
+  <td width="50%" style="vertical-align:top">
+    <table style="border-right:1px solid #B0B0B0;width:100%">
+        <tr>
+            <td><LABEL for="base">{t}Base{/t}</LABEL>
+            </td>
+            <td>
+                               <select name="base">
+                                       {html_options options=$bases selected=$base}
+                               </select>
+            </td>
+        </tr>
+        <tr>
+            <td><LABEL for="cn">{t}Device name{/t}</LABEL>{$must}
+            </td>
+            <td>
+                <input type="text" size=40 value="{$cn}" name="cn" id="cn">
+            </td>
+        </tr>
+        <tr>
+            <td><LABEL for="description">{t}Description{/t}</LABEL>
+            </td>
+            <td>
+                <input type="text" size=40 value="{$description}" name="description" id="description">
+            </td>
+        </tr>
+    </table>
+   </td>
+   <td style="vertical-align:top">
+    <table summary="">
+        <tr>
+            <td><LABEL for="dev_id">{t}Serial number{/t}&nbsp;{t}(iSerial){/t}</LABEL>{$must}
+            </td>
+            <td>
+                <input type="text" value="{$dev_id}" name="dev_id" id="dev_id">
+            </td>
+            <td colspan="2">&nbsp;</td>
+        </tr>
+        <tr>
+            <td><LABEL for="vendor">{t}Vendor-ID{/t}&nbsp;{t}(idVendor){/t}</LABEL>{$must}
+            </td>
+            <td>
+                <input type="text" value="{$vendor}" name="vendor" id="vendor">
+            </td>
+        </tr>
+        <tr>
+          <td><LABEL for="produkt">{t}Product-ID{/t}&nbsp;{t}(idProduct){/t}</LABEL>{$must}
+            </td>
+            <td>
+                <input type="text" value="{$serial}" name="serial" id="serial">
+            </td>
+        </tr>
+    </table>
+</table>
+<input type='hidden' value="1" name="deviceGeneric_posted">
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+    focus_field('name');
+  -->
+</script>
+
+
diff --git a/gosa-core/plugins/admin/devices/main.inc b/gosa-core/plugins/admin/devices/main.inc
new file mode 100755 (executable)
index 0000000..92f901d
--- /dev/null
@@ -0,0 +1,57 @@
+<?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
+ */
+
+if ($remove_lock){
+               if(isset($_SESSION['DeviceManagement'])){
+                               $DeviceManagement= $_SESSION['DeviceManagement'];
+                               $DeviceManagement->remove_lock();
+                               del_lock ($ui->dn);
+                               sess_del ('DeviceManagement');
+               }
+} else {
+
+               /* Create DeviceManagement object on demand */
+               if (!isset($_SESSION['DeviceManagement']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+                               $_SESSION['DeviceManagement']= new deviceManagement ($config);
+               }
+
+               /* Get object */
+               $DeviceManagement= $_SESSION['DeviceManagement'];
+               $DeviceManagement->save_object();
+               $output= $DeviceManagement->execute();
+
+               /* Page header*/
+               if (isset($_SESSION['objectinfo'])){
+                               $display= print_header(get_template_path('images/devices.png'), _("Device management"), "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".@LDAP::fix($_SESSION['objectinfo']));
+               } else {
+                               $display= print_header(get_template_path('images/devices.png'), _("Device management"));
+               }
+
+               /* Reset requested? */
+               if (isset($_GET['reset']) && $_GET['reset'] == 1){
+                               del_lock ($ui->dn);
+                               sess_del ('DeviceManagement');
+               }
+
+               /* Show and save dialog */
+               $display.= $output;
+               $_SESSION['DeviceManagement']= $DeviceManagement;
+}
+?>
diff --git a/gosa-core/plugins/admin/devices/paste_deviceGeneric.tpl b/gosa-core/plugins/admin/devices/paste_deviceGeneric.tpl
new file mode 100644 (file)
index 0000000..44d6882
--- /dev/null
@@ -0,0 +1,25 @@
+
+<h2>{t}Devices{/t}</h2>
+
+<table width="100%" summary="">
+ <tr>
+  <td width="50%" style="vertical-align:top">
+    <table style="border-right:1px solid #B0B0B0;width:100%">
+        <tr>
+            <td><LABEL for="cn">{t}Device name{/t}</LABEL>{$must}
+            </td>
+            <td>
+                <input type="text" size=40 value="{$cn}" name="cn" id="cn">
+            </td>
+        </tr>
+    </table>
+   </td>
+</table>
+<input type='hidden' value="1" name="deviceGeneric_posted">
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+    focus_field('name');
+  -->
+</script>
+
+
diff --git a/gosa-core/plugins/admin/devices/remove.tpl b/gosa-core/plugins/admin/devices/remove.tpl
new file mode 100755 (executable)
index 0000000..643056c
--- /dev/null
@@ -0,0 +1,23 @@
+<div style="font-size:18px;">
+  <img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
+</div>
+<p>
+ {$intro}
+ {t}This may be used by several users/groups. 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}So - if you're sure - press 'Delete' to continue or 'Cancel' to abort.{/t}
+</p>
+
+<p class="plugbottom">
+       {if $multiple}
+               <input type=submit name="delete_multiple_device_confirm" value="{t}Delete{/t}">
+               &nbsp;
+               <input type=submit name="delete_multiple_device_cancel" value="{t}Cancel{/t}">
+       {else}
+               <input type=submit name="delete_device_confirm" value="{t}Delete{/t}">
+               &nbsp;
+               <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
+       {/if}
+</p>
+
diff --git a/gosa-core/plugins/admin/devices/tabs_devices.inc b/gosa-core/plugins/admin/devices/tabs_devices.inc
new file mode 100755 (executable)
index 0000000..9cb2e90
--- /dev/null
@@ -0,0 +1,43 @@
+<?php
+
+class devicetabs extends tabs
+{
+  var $Release= "";
+
+  function devicetabs($config, $data, $dn,$category)
+  {
+    tabs::tabs($config, $data, $dn,$category);
+
+    /* Add references/acls/snapshots */
+    $this->addSpecialTabs();
+  }
+
+  function save($ignore_account= FALSE)
+  {
+    $baseobject= $this->by_object['deviceGeneric'];
+    $new_dn= "cn=".$baseobject->cn.",ou=devices,".$baseobject->base;
+
+    /* Move group? */
+    if ($this->dn != $new_dn){
+
+      /* Write entry on new 'dn' */
+      if ($this->dn != "new"){
+        $baseobject->move($this->dn, $new_dn);
+        $this->by_object['deviceGeneric']= $baseobject;
+      }
+
+      /* Happen to use the new one */
+      $this->dn= $new_dn;
+    }
+
+    tabs::save();
+
+    /* Fix tagging if needed */
+    $baseobject->dn= $this->dn;
+    $baseobject->handle_object_tagging();
+    $this->by_object['deviceGeneric'] = $baseobject;
+  }
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/fai/askClassName.tpl b/gosa-core/plugins/admin/fai/askClassName.tpl
new file mode 100644 (file)
index 0000000..7975e10
--- /dev/null
@@ -0,0 +1,89 @@
+<div style="font-size: 18px;">
+       {$headline}
+</div>
+<br>
+<p class="seperator">
+{t}Adding a new class to the FAI management, requires a class name. You have to specify a unique class name for unique types of FAI classes, while you can use the same class name for different types of FAI classes. In the laste case, FAI will automatically enclose all these different class types to one unique class name.{/t}
+<br>
+<br>
+</p>
+<p class="seperator">
+<br>
+<b>{t}Please use one of the following methods to choose the name for the new FAI class.{/t}</b>
+<br>
+<br>
+</p>
+<br>
+<table summary="" style='width:100%'>
+ <tr>
+  <td style='width:49%'>
+   <table summary="">
+    <tr>
+     <td>
+       <input type=radio name="classSelector" value="1" checked>
+     </td>
+     <td> 
+       <h1>{t}Enter FAI class name manually{/t}</h1>
+     </td>
+   </tr>
+   <tr>
+     <td>&nbsp;</td>
+     <td>
+      {t}Class name{/t}&nbsp;<input type="text"         name="UseTextInputName" value="{$ClassName}" style="width:120px;">
+     </td>
+    </tr>
+   </table>
+   <br>
+   <br>
+  </td>
+  <td style='border-left:1px solid #909090'>
+  </td>
+  <td>
+   <table summary="" {$grey}>
+    <tr>
+     <td>
+       <input type=radio name="classSelector" value="2" {$ClassNamesAvailable}>
+     </td>
+     <td>
+      <h1 {$grey}>{t}Choose FAI class name from a list of existing classes{/t}</h1>
+     </td>
+    </tr>
+    <tr>
+     <td>&nbsp;</td>
+     <td>
+      {t}Class name{/t}&nbsp;<select name="SelectedClass" title="{t}Choose class name{/t}" style="width:120px;" {$ClassNamesAvailable}>
+       {html_options options=$ClassNames}
+      </select>
+     </td>
+    </tr>
+   </table>
+   <br>
+   <br>
+  </td>
+ </tr>
+</table>
+
+<!--
+<table summary="">
+       <tr>
+               <td>
+               <input type="submit" name="UseSelectedClass" value="{t}Use{/t}" {$ClassNamesAvailable}> 
+               </td>
+       </tr>
+       <tr>
+               <td><b>{t}A new class name.{/t}</b>
+               </td>
+               <td>
+               <input type="submit" name="UseNewClass" value="{t}Use{/t}"> 
+               </td>
+       </tr>
+</table>
+-->
+<p class="seperator">&nbsp;</p>
+       
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+       <!--
+       focus_field('UseTextInputName');
+       -->
+</script>
diff --git a/gosa-core/plugins/admin/fai/branch_selector.tpl b/gosa-core/plugins/admin/fai/branch_selector.tpl
new file mode 100644 (file)
index 0000000..addb5a7
--- /dev/null
@@ -0,0 +1,42 @@
+<br>
+ <div class="contentboxh" style="border-bottom:1px solid #B0B0B0;">
+    <p class="contentboxh"><img src="{$branchimage}" align="right" alt="[F]">{t}Branches{/t}</p>
+   </div>
+   <div class="contentboxb">
+        <table summary="" style="width:100%;border-bottom:1px solid #B0B0B0;">
+     <tr>
+      <td>
+    {t}Current release{/t}&nbsp;
+    <select name="selectedBranch" onChange="document.mainform.submit();">
+        {html_options options=$branches selected=$selectedBranch}
+    </select>
+      </td>
+     </tr>
+        </table>
+        <table summary="" style="width:100%;">
+     <tr>
+      <td>
+    {if $allow_create}
+        <input class="center" type="image" name="branch_branch" src="images/branch_small.png">
+        <a href="?plug={$plug_id}&act=branch_branch">{t}Create new branch{/t}</a>
+        <br>
+        <input class="center" type="image" name="freeze_branch" src="images/freeze.png">
+               <a href="?plug={$plug_id}&act=freeze_branch">{t}Create new locked branch{/t}</a>
+    {else}
+        <img src="images/branch_small_grey.png" alt='{t}Branch{/t}' class='center'>
+        {t}Create new branch{/t}
+        <br>
+        <img src="images/freeze_grey.png" alt='{t}Freeze{/t}' class='center'>
+               {t}Create new locked branch{/t}
+    {/if}
+
+    {if $selectedBranch != "main" && $allow_remove}
+    <br>
+        <input class="center" type="image" name="remove_branch" src="images/edittrash.png">
+           <a href="?plug={$plug_id}&act=remove_branch">{t}Delete current release{/t}</a>
+    {/if}
+      </td>
+     </tr>
+        </table>
+   </div>
+
diff --git a/gosa-core/plugins/admin/fai/class_askClassName.inc b/gosa-core/plugins/admin/fai/class_askClassName.inc
new file mode 100644 (file)
index 0000000..4225869
--- /dev/null
@@ -0,0 +1,172 @@
+<?php
+
+class askClassName 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 $objectClass        = false;
+  var $forbidden          = array();
+  var $ClassName          = "";  
+  var $ClassAlreadyExists = false;
+
+  function askClassName (&$config,$dn,$ui,$objectClass)
+  {
+    $this->ui = $ui;
+    $this->objectClass = $objectClass;
+    plugin::plugin ($config, $dn);
+    if(!isset($_SESSION['CurrentMainBase'])){
+      $_SESSION['CurrentMainBase'] = $this->config->current['BASE'];
+    }
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* Fill templating stuff */
+    $smarty = get_smarty();
+    $display= "";
+
+    /* The faifilter contais 
+     * The base for all fai objects 
+     */
+    $faifilter = $_SESSION['faifilter'];
+
+    /* First search for every ou, in given fai base
+     * With a second search detect all object that belong to the different ous. 
+     */
+
+    $base = "ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase'];
+    if($faifilter['branch'] != "main"){
+      $base = $faifilter['branch'];
+    }
+    $ldap = $this->config->get_ldap_link();
+    
+    $res= get_list("(&(objectClass=organizationalUnit)(!(objectClass=FAIbranch)))", "fai", $base,
+                   array("cn","description","objectClass"), GL_SIZELIMIT );
+
+    $delete = array();
+    $used   = array();
+    foreach($res as $objecttypes){
+      $res2= get_list("(objectClass=*)", "fai", $objecttypes['dn'],
+                      array("cn","description","objectClass","FAIclass","FAIstate"), GL_SIZELIMIT | GL_CONVERT );
+      foreach($res2 as $object){
+
+        /* skip class names with this name */ 
+        if(in_array($this->objectClass,$object['objectClass']) || in_array("FAIprofile",$object['objectClass'])){
+          if(isset($object['FAIstate'][0]) && preg_match("/removed$/",$object['FAIstate'][0])){
+            continue;
+          }
+          $delete[] = $object['cn'][0];
+        }
+    
+        /* Skip profiles */
+        if(!in_array("FAIprofile",$object['objectClass'])){
+          if(isset($object['cn'])){
+            $used[$object['cn'][0]]= $object['cn'][0];
+          }
+        }
+      }
+    }
+
+    /* Create headline
+     * Depending on the object type we want to create, a different headline will be shown
+     */ 
+    switch($this->objectClass) {
+      case "FAIpartitionTable":  $str =_("Create new FAI object - partition table.");break;
+      case "FAIpackageList"   :  $str =_("Create new FAI object - package bundle.");break;
+      case "FAIscript"        :  $str =_("Create new FAI object - script bundle.");break;
+      case "FAIvariable"      :  $str =_("Create new FAI object - variable bundle.");break;
+      case "FAIhook"          :  $str =_("Create new FAI object - hook bundle.");break;
+      case "FAIprofile"       :  $str =_("Create new FAI object - profile.");break;
+      case "FAItemplate"      :  $str =_("Create new FAI object - template.");break;
+      default                 :  $str =_("Create new FAI object");break;
+    }
+    $smarty->assign("headline",$str);
+    
+    /* Save forbidden class names
+     */
+    $this->forbidden = $delete;
+
+    /* Delete all class names which already have this type of object 
+     */
+    foreach($delete as $del){
+      unset($used[$del]);
+    }
+   
+    /* if there is no class name which is missing for this type 
+     *  of objectClass, we only can create a new one, disable selectBox 
+     */
+    if(count ($used)==0){
+      $smarty->assign("ClassNamesAvailable", " disabled ");
+      $smarty->assign("grey", 'style="color:#C0C0C0"');
+    }else{
+      $smarty->assign("ClassNamesAvailable", "");
+      $smarty->assign("grey", "");
+    }
+    ksort($used);
+    $smarty->assign("ClassNames", $used);
+    $smarty->assign("ClassName",  $this->ClassName);
+    $display.= $smarty->fetch(get_template_path('askClassName.tpl', TRUE));
+    return($display);
+  }
+
+  /* Get posts and set class name 
+   */ 
+  function save_object()
+  {
+    if(isset($_POST['classSelector']) && $_POST['classSelector'] == 1 
+       && isset($_POST['edit_continue'])){
+      $this->ClassName          = $_POST['UseTextInputName'];
+      $this->ClassAlreadyExists = true;
+    }
+  
+    if(isset($_POST['classSelector']) && $_POST['classSelector'] == 2 
+       && isset($_POST['edit_continue'])){
+      $this->ClassAlreadyExists = false;
+      $this->ClassName          = $_POST['SelectedClass'];
+    }
+  }
+
+  /* Check given class name 
+   */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+  
+    if($this->ClassName != preg_replace("/ /","",trim($this->ClassName))){
+      $message[] = _("Spaces are not allowed within class names.");
+    }
+
+    if(empty($this->ClassName)){
+      $message[]=_("The given class name is empty.");
+    }
+
+    if(in_array($this->ClassName,$this->forbidden)){
+      $message[]=_("The specified class name is already in use for this object type.");
+    }
+
+    return ($message);
+  }
+
+
+  /* Return the class name */
+  function save()
+  {
+    return($this->ClassName);
+  }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/fai/class_divListFai.inc b/gosa-core/plugins/admin/fai/class_divListFai.inc
new file mode 100644 (file)
index 0000000..b15485c
--- /dev/null
@@ -0,0 +1,419 @@
+<?php
+
+class divListFai extends MultiSelectWindow
+{
+  /* Current base */
+  var $selectedBase       = "";
+  var $selectedBranch     = "main";
+  var $AvailableBranches  = array();
+  var $departments        = array();
+
+  /* Regex */
+  var $Regex              = "*";
+  var $ShowProfiles;
+  var $ShowTemplates;
+  var $ShowScripts;
+  var $ShowHooks;
+  var $ShowVariables;
+  var $ShowPackages;
+  var $ShowPartitions;
+
+  /* Subsearch checkbox */
+  var $SubSearch;
+
+  var $parent             ;
+  var $ui                 ;
+
+  var $SaveAdditionalVars = array("selectedBranch");
+
+  function divListFai (&$config,$parent)
+  {
+    MultiSelectWindow::MultiSelectWindow($config, "Fai", "fai");
+    
+    $this->parent       = $parent;
+    $this->ui           = get_userinfo();
+
+    /* Set default base */
+    if(!isset($_SESSION['CurrentMainBase'])){
+      $_SESSION['CurrentMainBase'] = $this->config->current['BASE'];
+    }
+    $this->selectedBase = $_SESSION['CurrentMainBase'];
+
+    /* Set list strings */
+    $this->SetTitle(_("List of FAI classes"));
+    $this->SetSummary(_("This table displays all FAI classes in the selected tree."));
+
+    /* Result page will look like a headpage */
+    $this->SetHeadpageMode();
+    $this->SetInformation(_("This menu allows you to create, delete and edit FAI classes."));
+
+    $this->EnableAplhabet   (true);
+  
+    /* Disable buttonsm */
+    $this->EnableCloseButton(false);
+    $this->EnableSaveButton (false);
+
+    /* Dynamic action col, depending on snapshot icons */
+    $action_col_size = 80;
+#   if($this->parent->snapshotEnabled()){
+#     $action_col_size += 32;
+#   }
+
+    /* Toggle all selected / deselected */
+    $chk = "<input type='checkbox' id='select_all' name='select_all'
+               onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
+
+    /* set Page header */
+    $this->AddHeader(array("string"=> $chk,          "attach"=>"style='width:20px;'"));
+    $this->AddHeader(array("string" => "&nbsp;",                "attach" => "style='text-align:center;width:20px;'"));
+    $this->AddHeader(array("string" => _("Name of FAI class"),  "attach" => "style=''"));
+    $this->AddHeader(array("string" => _("Class type"),         "attach" => "style='width:200px;'"));
+    $this->AddHeader(array("string" => _("Actions"),            "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'"));
+
+    $this->AddCheckBox("ShowProfiles"   , _("Display FAI profile objects")    ,_("Show profiles")     ,true);
+    $this->AddCheckBox("ShowTemplates"  , _("Display FAI template objects")   ,_("Show templates")    ,true);
+    $this->AddCheckBox("ShowScripts"    , _("Display FAI scripts")            ,_("Show scripts")      ,true);
+    $this->AddCheckBox("ShowHooks"      , _("Display FAI hooks")              ,_("Show hooks")        ,true);
+    $this->AddCheckBox("ShowVariables"  , _("Display FAI variables")          ,_("Show variables")    ,true);
+    $this->AddCheckBox("ShowPackages"   , _("Display FAI packages")           ,_("Show packages")     ,true);
+    $this->AddCheckBox("ShowPartitions" , _("Display FAI partitions")         ,_("Show partitions")   ,true);
+
+    /* Add SubSearch checkbox */
+    //$this->AddCheckBox(SEPERATOR);
+    //$this->AddCheckBox("SubSearch",  _("Select to search within subtrees"), _("Search in subtrees"), false);
+
+    /*                  Name                 ,Text                              ,Default  , Connect with alphabet  */
+    $this->AddRegex   ("Regex",     _("Display users matching"),"*" , true);
+  }
+
+  function AddUserBoxToFilter($position)
+  {
+    $str = "";
+    if($position  == 2){
+
+      /* Check if there are post commands available for fai management.
+       * If not, grey out freeze/branch and release remove buttons.
+       */
+      $r = $this->config->search("faiManagement", "POSTREMOVE",array('menu','tabs'));
+      $c = $this->config->search("faiManagement", "POSTCREATE",array('menu','tabs'));
+
+      $smarty = get_smarty();
+      $smarty->assign("allow_create", $c);
+      $smarty->assign("allow_remove", $r);
+      $smarty->assign("selectedBranch",$this->selectedBranch);
+      $smarty->assign("branchimage","images/branch.png");
+      $smarty->assign("branches",$this->AvailableBranches);
+      $plug_id = 0;       
+      if(isset($_GET['plug'])){
+        $plug_id = $_GET['plug'];
+      }
+      $smarty->assign("plug_id",$plug_id);
+      $str = $smarty->fetch(get_template_path('branch_selector.tpl', TRUE));
+    }
+    return($str);
+  }
+
+  function GenHeader()
+  {
+    /* Prepare departments,
+       which are shown in the listbox on top of the listbox
+     */
+    $options= "";
+
+    /* Get all departments within this subtree */
+    $ui= get_userinfo();
+    $first = "";
+    $found = FALSE;
+    $base = $this->config->current['BASE'];
+
+    /* Add base */
+    $tmp = array();
+    $tmp[] = array("dn"=>$this->config->current['BASE']);
+    $tmp=  array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
+                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
+
+    $deps = array();
+    foreach($tmp as $tm){
+      $deps[$tm['dn']] = $tm['dn'];
+    }
+
+    /* Load possible departments */
+    $ui= get_userinfo();
+    $tdeps= $ui->get_module_departments("fai");
+    $ids = $this->config->idepartments;
+    $first = "";
+    $found = FALSE;
+    foreach($ids as $dep => $name){
+      if(isset($deps[$dep]) && in_array_ics($dep, $tdeps)){
+
+        /* Keep first base dn in mind, we could need this
+         *  info if no valid base was found
+         */
+        if(empty($first)) {
+          $first = $dep['dn'];
+        }
+
+        $value = $ids[$dep];
+        if ($this->selectedBase == $dep){
+          $found = TRUE;
+          $options.= "<option selected='selected' value='".$dep."'>$value</option>";
+        } else {
+          $options.= "<option value='".$dep."'>$value</option>";
+        }
+      }
+    }
+
+    /* The currently used base is not visible with your acl setup.
+     * Set base to first useable base.
+     */
+    if(!$found){
+      $this->selectedBase = $first;
+    }
+
+    /* Add seperator */
+    $add_sep = false;
+
+    /* Get complete fai acls, to be able to check if we must show or hide the snapshot abilities */ 
+    $acl_all = $ui->has_complete_category_acls($this->selectedBase,$this->module);
+
+    /* Add default header */
+    $listhead = MultiSelectWindow::get_default_header();
+
+    /* Add additional seperator */
+    if($add_sep){
+      $listhead .=" <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;";
+    }
+
+    $listhead .=  _("Base")."&nbsp;<select name='CurrentMainBase' 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;";
+
+
+    $s  = ".|"._("Actions")."|\n";
+    $s .= "..|<img src='images/list_new.png' alt='' border='0' class='center'>".
+      "&nbsp;"._("Create")."|\n";
+
+    $acl = $ui->get_permissions($this->selectedBase,"fai/faiProfile");
+    if(preg_match("/c/",$acl)){
+      $s.= "...|<input class='center' type='image' src='images/fai_new_profile.png' alt=''>".
+        "&nbsp;"._("Profile")."|Create_profile|\n";
+    }
+
+    /* Append create icons for each fai component */
+    $arr = array(
+        array("images/fai_new_partitionTable.png" , _("Partition table")  ,"Create_partition" , _("PT") , "faiPartitionTable"),
+        array("images/fai_new_script.png"         , _("Scripts")          ,"Create_script"    , _("S")  , "faiScript"),
+        array("images/fai_new_hook.png"           , _("Hooks")            ,"Create_hook"      , _("H")  , "faiHook"),
+        array("images/fai_new_variable.png"       , _("Variables")        ,"Create_variable"  , _("V")  , "faiVariable"),
+        array("images/fai_new_template.png"       , _("Templates ")       ,"Create_template"  , _("I")  , "faiTemplate"),
+        array("images/fai_new_packages.png"       , _("Package list")     ,"Create_package"   , _("PK") , "faiPackage"));
+
+    foreach($arr as $ar){
+      $acl = $ui->get_permissions($this->selectedBase,"fai/".$ar[4]);
+      if(preg_match("/c/",$acl)){
+        $s.= "...|<input class='center' type='image' src='".$ar[0]."' alt=''>".
+          "&nbsp;".$ar[1]."|".$ar[2]."|\n";
+      }
+    }
+
+    /* Multiple options */
+    $s.= "..|<img src='images/edittrash.png' alt='' border='0' class='center'>".
+      "&nbsp;"._("Remove")."|"."remove_multiple|\n";
+
+    /* Add multiple copy & cut icons */
+    if(is_object($this->parent->CopyPasteHandler)){
+      $s.= "..|---|\n";
+      $s.= "..|<img src='images/editcopy.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Copy")."|"."multiple_copy_systems|\n";
+      $s.= "..|<img src='images/editcut.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Cut")."|"."multiple_cut_systems|\n";
+    }
+
+    /* Add copy & paste icons, currently disabled, this ability is not implemeneted yet */
+    if(preg_match("/(c.*w|w.*c)/",$acl_all) &&  isset($this->parent->CopyPasteHandler) && $this->parent->CopyPasteHandler){
+      $s .= "..|---|\n";
+      if($this->parent->CopyPasteHandler->entries_queued()){
+        $img = "<img border='0' class='center' src='images/editpaste.png' alt=''>";
+        $s.="..|".$img."&nbsp;"._("Paste")."|editPaste|\n";
+      }else{
+        $img = "<img border='0' class='center' src='images/cant_editpaste.png' alt=''>";
+        $s.="..|".$img."&nbsp;"._("Paste")."\n";
+      }
+    }
+
+#   /* Add snapshot icons, if we are allowed to write and create the complete fai module ($ui->has_complete_category_acls) */ 
+#   if(preg_match("/(c.*w|w.*c)/",$acl_all)){ 
+#     if($this->parent->snapshotEnabled()){
+#       $s .= "..|---|\n";
+#       $s .= $this->get_snapshot_header(TRUE);
+#     }
+#   }
+
+    $this->SetDropDownHeaderMenu($s);
+    $this->SetListHeader($listhead);
+  }
+
+  /* so some basic settings */
+  function execute()
+  {
+    $this->ClearElementsList();
+    $this->GenHeader();
+    $this->AvailableBranches = $this->parent->getBranches();
+  }
+
+  function setEntries($list)
+  {
+    /********************
+      Variable init
+     ********************/
+
+     $objects = array(
+           "FAIpartitionTable"  => array("IMG"=> "images/fai_partitionTable.png", "NAME"=>_("Partition table"),"KZL"=> "PT", "VAR"=>"ShowPartitions"),
+           "FAIpackageList"     => array("IMG"=> "images/fai_packages.png",       "NAME"=>_("Package list") ,  "KZL"=> "PL", "VAR"=>"ShowPackages"),
+           "FAIscript"          => array("IMG"=> "images/fai_script.png",         "NAME"=>_("Scripts") ,       "KZL"=> "S",  "VAR"=>"ShowScripts"),
+           "FAIvariable"        => array("IMG"=> "images/fai_variable.png",       "NAME"=>_("Variables") ,     "KZL"=> "V",  "VAR"=>"ShowVariables"),
+           "FAIhook"            => array("IMG"=> "images/fai_hook.png",           "NAME"=>_("Hooks"),          "KZL"=> "H",  "VAR"=>"ShowHooks"),
+           "FAIprofile"         => array("IMG"=> "images/fai_profile.png",        "NAME"=>_("Profile") ,       "KZL"=> "P",  "VAR"=>"ShowProfiles"),
+           "FAItemplate"        => array("IMG"=> "images/fai_template.png",       "NAME"=>_("Templates") ,     "KZL"=> "T",  "VAR"=>"ShowTemplates"));
+
+    $editlink ="<a href='?plug=".$_GET['plug']."&amp;edit_entry=%KEY%' title='%TITLE%'>%NAME%</a>";
+
+    /* Dynamic action col, depending on snapshot icons */
+    $action_col_size = 80;
+#   if($this->parent->snapshotEnabled()){
+#     $action_col_size += 32;
+#   }
+
+    /********************
+      Attach objects
+     ********************/
+
+    $cnts = array();
+    foreach($objects as $key => $data){
+      $cnts[$key] = 0;
+    }
+
+     foreach($list as $key => $value){
+       $info     = "";
+       $img      = "";
+       $type     = $value['type'];
+       $abort    =false;
+
+       $cnts[$type] ++;
+
+       if(isset($objects[$type])){
+         $img   = "<img class='center' src='".$objects[$type]['IMG']."' title='".$objects[$type]['NAME']."' alt='".$objects[$type]['KZL']."'>";
+         $info  = $objects[$type]['NAME'];
+         $var   = $objects[$type]['VAR'];
+       }else{
+         $img   = "<img class='center' src='images/empty.png' alt=''>";
+         $info  = "";
+         $var   = "";
+       }
+
+       if((isset($value['description']))&&(!empty($value['description']))){
+         $desc= " [".$value['description']."]";
+       }else{
+         $desc= "";
+       }
+
+       /* Add copy & cut icons */
+       $ui = get_userinfo();
+       $action ="";
+       $acl_all = $ui->has_complete_category_acls($this->selectedBase,$this->module);
+       if(preg_match("/(c.*w|w.*c)/",$acl_all) && $this->parent->CopyPasteHandler){
+         $action .= "<input class='center' type='image'
+           src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
+         $action.= "<input class='center' type='image'
+           src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
+       }
+
+       if($value['FAIstate'] == "freeze"){
+         $action.=  "<img src='images/closedlock.png' alt='F' class='center'><img src='images/empty.png' width='38' height='2' class='center' alt=''>";
+         $action.= "<input class='center' type='image' src='images/edit.png'  alt='"._("edit")."'
+           name='entry_edit_%KEY%' title='"._("Edit class")."'>";
+       }else{
+         $action.= "<input class='center' type='image' src='images/edit.png'  alt='"._("edit")."'
+           name='entry_edit_%KEY%' title='"._("Edit class")."'>";
+
+#        if(preg_match("/(c)/",$value['acl']) && preg_match("/(w)/",$value['acl'])){
+#          $action.= $this->GetSnapShotActions($value['dn']);;
+#        }
+
+         if(preg_match("/d/",$value['acl'])){
+           $action.= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."'
+             name='entry_delete_%KEY%' title='"._("Delete class")."'>";
+         }
+       }
+
+       /* Cutted objects should be displayed in light grey */
+       $display = $value['cn'].$desc;
+       if($this->parent->CopyPasteHandler){
+         foreach($this->parent->CopyPasteHandler->queue as $queue_key => $queue_data){
+           if($queue_data['dn'] == $value['dn']) {
+             $display = "<font color='#999999'>".$display."</font>";
+             break;
+           }
+         }
+       }
+       $edi = $editlink;
+       $acti = $action;
+
+       /* Create each field */
+       $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
+           "attach" => "style='width:20px;'");
+       $field1 = array("string" => $img , "attach" => "style='text-align:center;width:20px;'");
+       $field2 = array("string" => preg_replace(array("/%KEY%/","/%NAME%/","/%TITLE%/"),array($key,$display,preg_replace('/ /', '&nbsp;', @LDAP::fix($value['dn']))),$edi) , "attach" => "style=''");
+       $field3 = array("string" => $info, "attach" => "style='width:200px;'");
+       $field4 = array("string" => preg_replace("/%KEY%/",$key,$acti) , "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'");
+       $this->AddElement(array($field0,$field1,$field2,$field3,$field4));
+     }
+
+     /* Create summary string for list footer */
+     $num_deps=0;
+     if(!$this->SubSearch){
+       $num_deps = count($this->Added_Departments);
+     }
+
+     $profile_str    = _("Number of listed profiles");
+     $partition_str  = _("Number of listed partitions");
+     $script_str     = _("Number of listed scripts");
+     $hook_str       = _("Number of listed hooks");
+     $variable_str   = _("Number of listed variables");
+     $template_str   = _("Number of listed templates");
+     $package_str    = _("Number of listed packages");
+     $dep_str        = _("Number of listed departments");
+
+     $str = "<img class='center' src='".$objects['FAIprofile']['IMG']."'
+       title='".$profile_str."' alt='".$profile_str."'>&nbsp;".$cnts['FAIprofile']."&nbsp;&nbsp;&nbsp;&nbsp;";
+     $str.= "<img class='center' src='".$objects['FAIpartitionTable']['IMG']."'
+       title='".$partition_str."' alt='".$partition_str."'>&nbsp;".$cnts['FAIpartitionTable']."&nbsp;&nbsp;&nbsp;&nbsp;";
+     $str.= "<img class='center' src='".$objects['FAIscript']['IMG']."'
+       title='".$script_str."' alt='".$script_str."'>&nbsp;".$cnts['FAIscript']."&nbsp;&nbsp;&nbsp;&nbsp;";
+     $str.= "<img class='center' src='".$objects['FAIhook']['IMG']."'
+       title='".$hook_str."' alt='".$hook_str."'>&nbsp;".$cnts['FAIhook']."&nbsp;&nbsp;&nbsp;&nbsp;";
+     $str.= "<img class='center' src='".$objects['FAIvariable']['IMG']."'
+       title='".$variable_str."' alt='".$variable_str."'>&nbsp;".$cnts['FAIvariable']."&nbsp;&nbsp;&nbsp;&nbsp;";
+     $str.= "<img class='center' src='".$objects['FAItemplate']['IMG']."'
+       title='".$template_str."' alt='".$template_str."'>&nbsp;".$cnts['FAItemplate']."&nbsp;&nbsp;&nbsp;&nbsp;";
+     $str.= "<img class='center' src='".$objects['FAIpackageList']['IMG']."'
+       title='".$package_str."' alt='".$package_str."'>&nbsp;".$cnts['FAIpackageList']."&nbsp;&nbsp;&nbsp;&nbsp;";
+     $str.= "<img class='center' src='images/folder.png'
+       title='".$dep_str."' alt='".$dep_str."'>&nbsp;".$num_deps."&nbsp;&nbsp;&nbsp;&nbsp;";
+     $this->set_List_Bottom_Info($str);
+  }
+
+  function Save()
+  {
+    MultiSelectWindow::Save();  
+  }
+
+  function save_object()
+  {
+    /* Save automatic created POSTs like regex, checkboxes */
+    MultiSelectWindow::save_object(); 
+    $_SESSION['faifilter']['branch'] = $this->selectedBranch; 
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/fai/class_faiHook.inc b/gosa-core/plugins/admin/fai/class_faiHook.inc
new file mode 100644 (file)
index 0000000..ce60202
--- /dev/null
@@ -0,0 +1,608 @@
+<?php
+
+class faiHook 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;
+
+  /* Attributes for this Object */
+  var $attributes       = array("cn","description");
+
+  /* ObjectClasses for this Object*/
+  var $objectclasses    = array("top","FAIclass","FAIhook");
+
+  /* Class name of the Ldap ObjectClass for the Sub Object */
+  var $subClass         = "FAIhookEntry";
+  var $subClasses       = array("top","FAIclass","FAIhookEntry");
+
+  /* Class name of the php class which allows us to edit a Sub Object */
+  var $subClassName     = "faiHookEntry";      
+
+  /* Attributes to initialise for each subObject */
+  var $subAttributes    = array("cn","description","FAItask"); 
+  var $sub_Load_Later   = array("FAIscript");
+  var $sub64coded       = array();
+  var $subBinary        = array("FAIscript");
+
+  /* Specific attributes */
+  var $cn               = "";       // The class name for this object
+  var $description      = "";       // The description for this set of partitions
+  var $is_dialog        = false;    // specifies which buttons will be shown to save or abort
+  var $SubObjects       = array();  // All leafobjects of this object
+  var $view_logged      = FALSE;
+  var $FAIstate         = "";  
+  var $ui;
+
+  function faiHook (&$config, $dn= NULL)
+  {
+    /* Load Attributes */
+    plugin::plugin ($config, $dn);
+
+    /* If "dn==new" we try to create a new entry
+     * Else we must read all objects from ldap which belong to this entry.
+     */
+    if($dn != "new"){
+      $this->dn =$dn;
+    
+      /* Get FAIstate
+       */
+      if(isset($this->attrs['FAIstate'][0])){
+        $this->FAIstate = $this->attrs['FAIstate'][0];
+      }
+
+      /* Read all leaf objects of this object (For FAIscript this would be FAIscriptEntry)
+       */
+      $ldap     = $this->config->get_ldap_link();
+      $ldap->cd ($this->dn);
+      $attrs_to_search = $this->subAttributes;
+      $attrs_to_search[] = "FAIstate";
+      $ldap->search("(&(objectClass=FAIclass)(objectClass=".$this->subClass."))", $attrs_to_search);
+
+      while($object = $ldap->fetch()){
+
+       /* Skip objects, that are tagged as removed */
+        if(isset($object['FAIstate'][0])){
+          if(preg_match("/removed$/",$object['FAIstate'][0])){
+            continue;
+          }
+        }
+
+        /* Set status for save management */
+        $objects = array();
+        $objects['status']      = "FreshLoaded";
+        $objects['dn']          = $object['dn'];
+        $objects                = $this->get_object_attributes($objects,$this->subAttributes);
+        $this->SubObjects[$objects['cn']] = $objects;
+      }
+    }
+    $this->ui = get_userinfo();
+  }
+
+
+  /* Reload some attributes */
+  function get_object_attributes($object,$attributes)
+  {
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->cat($object['dn'],$attributes);
+    $tmp  = $ldap->fetch();
+
+    foreach($attributes as $attrs){
+      if(isset($tmp[$attrs][0])){
+        $var = $tmp[$attrs][0];
+
+        /* Check if we must decode some attributes */
+        if(in_array_ics($attrs,$this->sub64coded)){
+          $var = base64_decode($var);
+        }
+
+        /*  check if this is a binary entry */
+        if(in_array_ics($attrs,$this->subBinary)){
+          $var = $ldap->get_attribute($object['dn'], $attrs,$r_array=0);
+        }
+
+        /* Fix slashes */
+        $var = addslashes($var);
+        $object[$attrs] = $var;
+      }
+    }
+    return($object);
+  }
+
+
+  function acl_base_for_current_object($dn)
+  {
+    if($dn == "new"){
+      if($this->dn == "new"){
+        $dn= $_SESSION['CurrentMainBase'];
+      }else{
+        $dn = $this->dn;
+      }
+    }
+    return($dn);
+  }
+
+
+  function getUsedFAItask($cn)
+  {
+    $ret = array();
+    foreach($this->SubObjects as $name => $class){
+      if($class['cn'] == $cn){
+        continue;
+      } 
+      if($class['status'] != "delete"){
+        $ret[$class['FAItask']] = $class['FAItask'];
+      }
+    }
+    return($ret);
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","fai/".get_class($this),$this->dn);
+    }
+
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+    $display= "";
+
+    /* New Listhandling
+     */
+    $once = true;
+    foreach($_POST as $name => $value){
+      if(preg_match("/^editscript_/",$name)&&($once)){
+        $once = false;
+        $entry = preg_replace("/^editscript_/","",$name);
+        $entry = base64_decode(preg_replace("/_.*/","",$entry));
+
+        $obj  = $this->SubObjects[$entry];
+        if($obj['status'] == "FreshLoaded"){
+          $obj  = $this->get_object_attributes($obj,$this->sub_Load_Later);
+        }
+
+        $this->dialog= new $this->subClassName($this->config,$this->dn,$obj);
+        $this->dialog->set_acl_base($this->acl_base_for_current_object($obj['dn']));
+        $this->dialog->set_acl_category("fai");
+
+        $_SESSION['objectinfo'] = $obj['dn'];
+        $this->dialog->parent = &$this;
+        $this->is_dialog=true;
+      }
+      if(preg_match("/^deletescript_/",$name)&&($once)){
+        $entry = preg_replace("/^deletescript_/","",$name);
+        $entry = base64_decode(preg_replace("/_.*/","",$entry));
+
+        $dn = $this->acl_base_for_current_object($this->SubObjects[$entry]['dn']);
+        $acl = $this->ui -> get_permissions($dn,"fai/faiScriptEntry")  ;
+
+        if(preg_match("/d/",$acl)){
+          $once = false;
+
+          $status = $this->SubObjects[$entry]['status'];
+          if($status == "edited" || $status == "FreshLoaded"){
+            $this->SubObjects[$entry]['status']= "delete";
+          }else{
+            unset($this->SubObjects[$entry]);
+          }
+        }
+      }
+    }
+
+    /* Edit entries via GET */
+    if(isset($_GET['act']) && isset($_GET['id'])){
+      if($_GET['act'] == "edit" && isset($this->SubObjects[$_GET['id']])){
+        $obj = $this->SubObjects[$_GET['id']];
+          if($obj['status'] == "FreshLoaded"){
+          $obj  = $this->get_object_attributes($obj,$this->sub_Load_Later);
+        }
+        $this->dialog= new $this->subClassName($this->config,$this->dn,$obj);
+        $this->dialog->acl = $this->acl;
+        $_SESSION['objectinfo'] = $obj['dn'];
+        $this->dialog->parent = &$this;
+        $this->is_dialog=true;
+      }
+    }
+
+    ///// Ende new list handling
+
+    /* Add new sub object */
+    if(isset($_POST['AddSubObject'])){
+
+      $c_dn = $this->acl_base_for_current_object($this->dn);
+      $this->dialog= new $this->subClassName($this->config,"new");
+      $this->dialog->set_acl_base($c_dn);
+      $this->dialog->set_acl_category("fai");
+      $this->dialog->parent = &$this;
+      $this->is_dialog=true;
+    }
+
+
+    /* Save Dialog */
+    if(isset($_POST['SaveSubObject'])){
+
+      /* Perform post check*/
+      $this->dialog->save_object();
+
+      /* Get messages */
+      $msgs = $this->dialog->check();
+
+      /* print errors */
+      if(count($msgs)>0){
+        foreach($msgs as $msg){
+          print_red($msg);
+        }
+      }else{
+
+        /* Get return object */
+        $obj = $this->dialog->save();
+        if(isset($obj['remove'])){
+
+          $old_stat = $this->SubObjects[$obj['remove']['from']]['status'];
+  
+          /* Depending on status, set new status */
+          if($old_stat == "edited" || $old_stat == "FreshLoaded"){
+            $this->SubObjects[$obj['remove']['from']]['status'] = "delete";
+          }elseif($this->SubObjects[$obj['remove']['from']]['status']=="new"){
+            unset($this->SubObjects[$obj['remove']['from']]);
+          }
+          $obj['status'] = "new";
+          $this->SubObjects[$obj['remove']['to']] = $obj;
+          unset($this->SubObjects[$obj['remove']['to']]['remove']);
+        }else{
+          if($obj['status'] == "FreshLoaded"){
+            $obj['status'] = "edited";
+          }
+          $this->SubObjects[$obj['cn']]=$obj;
+        }
+        $this->is_dialog=false;
+        unset($this->dialog);
+        $this->dialog=FALSE;
+      }
+    }
+
+    /* Sort entries */
+    $tmp = $keys = array();
+    foreach($this->SubObjects as $key => $entry){
+      $keys[$key]=$key;
+    }
+    natcasesort($keys);
+    foreach($keys as $key){
+      $tmp[$key]=$this->SubObjects[$key];
+    }
+    $this->SubObjects = $tmp;
+
+    /* Cancel Dialog */
+    if(isset($_POST['CancelSubObject'])){
+      $this->is_dialog=false; 
+      unset($this->dialog);
+      $this->dialog=FALSE;
+    }
+
+    /* Print dialog if $this->dialog is set */
+    if(is_object($this->dialog)){
+      $this->dialog->save_object();
+      $display = $this->dialog->execute();
+      return($display);
+    }
+
+
+
+    /* Divlist            added 28.02.2006
+       Containing FAIscripts
+     */
+
+    $divlist = new divSelectBox("FAIhooks");
+    $divlist->setHeight(400);
+
+    foreach($this->getList(true) as $key => $name){
+
+      $dn= $this->acl_base_for_current_object($name['dn']);
+      $acl = $this->ui->get_permissions($dn,"fai/faiHookEntry")  ;
+      $act = "";
+
+      /* Check if this object is freezed, in this case hide the delete icon */
+      if($this->FAIstate == "freeze"){
+        $act .= "<input type='image' src='images/edit.png'      name='editscript_%s'    title='"._("edit")."' alt='"._("edit")."'>";
+      }else{
+        $act .= "<input type='image' src='images/edit.png'      name='editscript_%s'    title='"._("edit")."' alt='"._("edit")."'>";
+        if(preg_match("/d/",$acl)){
+          $act .="<input type='image' src='images/edittrash.png' name='deletescript_%s'  title='"._("delete")."' alt='"._("delete")."'>";
+        }
+      }
+
+      /* Check if we are allowed to use the export button for this object */
+      $s_acl = $this->ui->get_permissions($dn,"fai/faiHookEntry","FAIscript")  ;
+      if(($this->SubObjects[$key]['status'] == "new") || ($this->SubObjects[$key]['dn'] == "new") || !preg_match("/r/",$s_acl)){
+        $down = "";
+      }else{
+        $down = "<a href='getFAIscript.php?id=".base64_encode($name['dn'])."'>
+          <img src='images/save.png' alt='"._("Download")."' title='"._("Download")."' border=0>
+          </a>";
+      }
+
+      /* Check if we are allowed to view the object */
+      $s_acl = $this->ui->get_permissions($dn,"fai/faiHookEntry","cn")  ;
+      if(preg_match("/r/",$s_acl)){
+
+        $edit_link = "<a href='?plug=".$_GET['plug']."&amp;act=edit&amp;id=".$key."'>".$name['name']."</a>";
+        $divlist->AddEntry(array( array("string"=>$edit_link),
+              array("string"=>$down , "attach" => "style='width:20px;'"),
+              array("string"=>str_replace("%s",base64_encode($key),$act),
+                "attach"=>"style='border-right: 0px;width:50px;text-align:right;'")));
+      }
+    }
+    $smarty->assign("Entry_divlist",$divlist->DrawList());
+    /* Divlist creation complete
+     */
+
+    $smarty->assign("SubObjects",$this->getList());
+
+    /* Magic quotes GPC, escapes every ' " \, to solve some security risks
+     * If we post the escaped strings they will be escaped again
+     */
+    foreach($this->attributes as $attrs){
+      if(get_magic_quotes_gpc()){
+        $smarty->assign($attrs,stripslashes($this->$attrs));
+      }else{
+        $smarty->assign($attrs,($this->$attrs));
+      }
+    }
+
+    $tmp = $this->plInfo();
+      
+    $c_dn = $this->acl_base_for_current_object($this->dn);
+    $smarty->assign("sub_object_is_addable", preg_match("/c/",$this->ui->get_permissions($c_dn,"fai/faiHookEntry")) && $this->FAIstate!="freeze");
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+    $display.= $smarty->fetch(get_template_path('faiHook.tpl', TRUE));
+    return($display);
+  }
+
+  /* Generate listbox friendly SubObject list
+   */
+  function getList($use_dns=false){
+    $a_return=array();
+    foreach($this->SubObjects as $obj){
+      if($obj['status'] != "delete"){
+        if($use_dns){
+          if((isset($obj['description']))&&(!empty($obj['description']))){
+            $a_return[$obj['cn']]['name']= $obj['cn']." [".stripslashes($obj['description'])."]";
+          }else{
+            $a_return[$obj['cn']]['name']= $obj['cn'];
+          }
+          $a_return[$obj['cn']]['dn']= $obj['dn'];
+        }else{
+          if((isset($obj['description']))&&(!empty($obj['description']))){
+            $a_return[$obj['cn']]= $obj['cn']." [".stripslashes($obj['description'])."]";
+          }else{
+            $a_return[$obj['cn']]= $obj['cn'];
+          }
+        }
+      }
+    }
+    return($a_return);
+  }
+
+
+  /* Delete me, and all my subtrees
+   */
+  function remove_from_parent()
+  {
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd ($this->dn);
+
+#    $use_dn = str_ireplace( get_release_dn($this->dn), $_SESSION['faifilter']['branch'], $this->dn);
+    $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $this->dn);
+    if($_SESSION['faifilter']['branch'] == "main"){
+      $use_dn = $this->dn;
+    }
+
+    prepare_to_save_FAI_object($use_dn,array(),true);
+
+    new log("remove","fai/".get_class($this),$use_dn,$this->attributes);
+
+    foreach($this->SubObjects as $name => $obj){
+#      $use_dn = str_ireplace( get_release_dn($this->dn), $_SESSION['faifilter']['branch'], $obj['dn']);
+      $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $obj['dn']);
+      if($_SESSION['faifilter']['branch'] == "main"){
+        $use_dn = $obj['dn'];
+      }
+      prepare_to_save_FAI_object($use_dn,array(),true);
+    }
+    $this->handle_post_events("remove");    
+  }
+
+
+  /* Save data to object 
+   */
+  function save_object()
+  {
+    if((isset($_POST['FAIhook_posted'])) && ($this->FAIstate != "freeze")){
+      plugin::save_object();
+      foreach($this->attributes as $attrs){
+        if(isset($_POST[$attrs])){
+          $this->$attrs = $_POST[$attrs];
+        }
+      }
+    }
+  }
+
+
+  /* Check supplied data */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    return ($message);
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    plugin::save();
+
+    $ldap = $this->config->get_ldap_link();
+
+    prepare_to_save_FAI_object($this->dn,$this->attrs);
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of FAI/hook with dn '%s' failed."),$this->dn));
+
+    if($this->initially_was_account){
+      new log("modify","fai/".get_class($this),$this->dn,$this->attributes);
+    }else{
+      new log("create","fai/".get_class($this),$this->dn,$this->attributes);
+    }
+
+    /* Do object tagging */
+    $this->handle_object_tagging();
+
+    $ldap->cd($this->dn);
+
+    /* Prepare FAIscriptEntry to write it to ldap
+     * First sort array.
+     *  Because we must delete old entries first.
+     * After deletion, we perform add and modify 
+     */
+    $Objects = array();
+
+    /* We do not need to save untouched objects */
+    foreach($this->SubObjects as $name => $obj){
+      if($obj['status'] == "FreshLoaded"){
+        unset($this->SubObjects[$name]);
+      }
+    }
+
+    foreach($this->SubObjects as $name => $obj){
+      if($obj['status'] == "delete"){
+        $Objects[$name] = $obj; 
+      }
+    }
+    foreach($this->SubObjects as $name => $obj){
+      if($obj['status'] != "delete"){
+        $Objects[$name] = $obj; 
+      }
+    }
+
+    foreach($Objects as $name => $obj){
+
+      foreach($this->sub64coded as $codeIt){
+        $obj[$codeIt]=base64_encode(stripslashes($obj[$codeIt]));
+      }
+
+      $tmp = array();
+      $attributes = array_merge($this->sub_Load_Later,$this->subAttributes);
+      foreach($attributes as $attrs){
+        if(empty($obj[$attrs])){
+          $obj[$attrs] = array();
+        }
+        if(!is_array($obj[$attrs])){
+          $tmp[$attrs] = stripslashes($obj[$attrs]);
+        }else{
+          $tmp[$attrs] = $obj[$attrs];
+        }
+      }    
+
+      $tmp['objectClass'] = $this->subClasses;
+
+      $sub_dn = "cn=".$obj['cn'].",".$this->dn;
+
+      if($obj['status']=="new"){
+        $ldap->cat($sub_dn,array("objectClass"));
+        if($ldap->count()){
+          $obj['status']="edited";
+        }
+      }
+
+      /* Check if gosaAdministrativeUnitTag is required as object class */
+      if($obj['status'] == "edited"){
+        $ldap->cat($sub_dn,array("objectClass"));
+        $attrs = $ldap->fetch();
+        if(isset($attrs['objectClass'])){
+          if(in_array_ics("gosaAdministrativeUnitTag",$attrs['objectClass'])){
+            $tmp['objectClass'][] = "gosaAdministrativeUnitTag";
+          }
+        }
+      }
+
+      if($obj['status'] == "delete"){
+        prepare_to_save_FAI_object($sub_dn,array(),true);
+        $this->handle_post_events("remove");
+      }elseif($obj['status'] == "edited"){
+        prepare_to_save_FAI_object($sub_dn,$tmp);
+        $this->handle_post_events("modify");
+      }elseif($obj['status']=="new"){
+        prepare_to_save_FAI_object($sub_dn,$tmp);
+        $this->handle_post_events("add");
+      }
+      $this->handle_object_tagging($sub_dn, $this->gosaUnitTag);
+    }
+  }
+
+
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);
+
+    /* Read all leaf objects of this object (For FAIscript this would be FAIscriptEntry)
+     */
+    $ldap     = $this->config->get_ldap_link();
+    $ldap->cd ($source['dn']);
+
+    $attrs_to_search = $this->subAttributes;
+    $attrs_to_search[] = "FAIstate";
+    $ldap->search("(&(objectClass=FAIclass)(objectClass=".$this->subClass."))",$attrs_to_search);
+
+    while($object = $ldap->fetch()){
+
+      /* Skip objects, that are tagged as removed */
+      if(isset($object['FAIstate'][0])){
+        if(preg_match("/removed$/",$object['FAIstate'][0])){
+          continue;
+        }
+      }
+
+      /* Set status for save management */
+      $objects = array();
+      $objects['status']      = "edited";
+      $objects['dn']          = $object['dn'];
+      $objects                = $this->get_object_attributes($objects,$this->subAttributes);
+      $objects                = $this->get_object_attributes($objects,$this->sub_Load_Later);
+
+      $this->SubObjects[$objects['cn']] = $objects;
+    }
+  }
+
+
+  /* Return plugin informations for acl handling */ 
+  static function plInfo()
+  {
+    return (array( 
+          "plShortName" => _("Hook"),
+          "plDescription" => _("FAI hook"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 20,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("fai"),
+          "plProvidedAcls" => array(
+            "cn"                => _("Name")." ("._("Read only").")",
+            "description"       => _("Description"))
+          ));
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/fai/class_faiHookEntry.inc b/gosa-core/plugins/admin/fai/class_faiHookEntry.inc
new file mode 100644 (file)
index 0000000..84b326e
--- /dev/null
@@ -0,0 +1,206 @@
+<?php
+
+class faiHookEntry 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","description","FAIscript","FAItask");
+  var $objectclasses= array();
+
+  var $orig_cn              = "";
+  var $tasks                = array("chboot", "configure", "debconf", "extrbase", "faiend", "finish",
+                                    "install", "instsoft", "mirror", "mountdisks", "partition", "prepareapt",
+                                    "savelog", "softupdate", "sysinfo","updatebase");
+  var $dn            = "";
+  var $cn            = "";
+  var $FAItask       = "chboot";
+  var $FAIscript     = "";
+  var $description   = "";
+  var $status        = "new";
+  var $parent        = NULL;
+  var $FAIstate      = "";
+  
+  function faiHookEntry (&$config, $dn= NULL,$object=false)
+  {
+    plugin::plugin ($config, $dn);
+    if($dn != "new"){
+      $this->orig_cn= $object['cn'];
+      $this->dn=$object['dn'];
+      foreach($object as $name=>$value){
+        $oname = $name;
+        $this->$oname=$value;
+      }
+
+      if(isset($this->attrs['FAIstate'][0])){
+        $this->FAIstate = $this->attrs['FAIstate'][0];
+      }
+
+    }elseif(is_array($object)){
+      if(count($object)){
+        $this->orig_cn= $object['cn'];
+        $this->dn=$object['dn'];
+        foreach($object as $name=>$value){
+          $oname = $name;
+          $this->$oname=$value;
+        }
+      }else{
+
+        $this->status = "new";
+        $this->orig_cn       = false;
+      }
+    }
+  }
+
+
+  function execute()
+  {
+       /* Call parent execute */
+       plugin::execute();
+
+    /* Fill templating stuff */
+    $smarty     = get_smarty();
+    $display = "";
+        
+    if(isset($_POST['ImportUpload'])){
+      if(($_FILES['ImportFile']['error']!=0)){
+        print_red(_("Please select a valid file."));
+      }else
+      if(($_FILES['ImportFile']['size']==0)){
+        print_red(_("Selected file is empty."));
+      }else{
+        $str = utf8_encode(file_get_contents($_FILES['ImportFile']['tmp_name']));
+        $this->FAIscript = $str;
+      }
+    }
+
+    /* Create download button*/
+    if($this->dn != "new" && $this->acl_is_readable("FAIscript")){
+      $smarty->assign("DownMe","<a href='getFAIscript.php?id=".base64_encode($this->dn)."'>
+          <img src='images/save.png' alt='"._("Download")."' title='"._("Download")."' border=0 class='center'>
+        </a>");
+    }else{
+      $smarty->assign("DownMe","");  
+    }
+
+    $used_tasks = $this->parent->getUsedFAItask($this->cn);
+    $tasks = $this->tasks;
+    foreach($this->tasks as $id => $task){
+      if(in_array($task,$used_tasks)){
+        unset($tasks[$id]);
+      }
+    }
+    $smarty->assign("tasks", $tasks);
+
+     /* Magic quotes GPC, escapes every ' " \, to solve some security risks
+     * If we post the escaped strings they will be escaped again
+     */
+    foreach($this->attributes as $attrs){
+      if(get_magic_quotes_gpc()){
+        $smarty->assign($attrs,(stripslashes($this->$attrs)));
+      }else{
+        $smarty->assign($attrs,($this->$attrs));
+      }
+    }
+
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translated){
+      $acl = $this->getacl($name);
+      if($this->FAIstate == "freezed"){
+        $acl = preg_replace("/w/","",$acl);
+      }
+      $smarty->assign($name."ACL",$acl);
+    }
+   
+    if(get_magic_quotes_gpc()){
+      $smarty->assign("FAIscript" , htmlentities(stripslashes($this->FAIscript)));
+    }else{
+      $smarty->assign("FAIscript" , htmlentities($this->FAIscript));
+    }
+    $display.= $smarty->fetch(get_template_path('faiHookEntry.tpl', TRUE));
+    return($display);
+  }
+
+  /* Save data to object */
+  function save_object()
+  {
+    if((isset($_POST['SubObjectFormSubmitted'])) && ($this->FAIstate != "freeze")){
+      foreach($this->attributes as $attrs){
+        if($this->acl_is_writeable($attrs)){
+          if(isset($_POST[$attrs])){
+            $this->$attrs = $_POST[$attrs];
+          }else{
+            $this->$attrs = "";
+          }
+        }
+      }
+    }
+  }
+
+  /* Check supplied data */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    if(isset($this->parent->SubObjects[$this->cn]) && $this->cn != $this->orig_cn){
+      $message[] =_("There is already a hook with the given name.");
+    }
+
+    if(empty($this->FAIscript)) {
+      $message[]=_("Please enter a value for script.");
+    }
+
+    if(empty($this->cn)){
+      $message[] = _("Please enter a name.");
+    }
+
+    return ($message);
+  }
+  function save()
+  {
+    $tmp=array();
+    foreach($this->attributes as $attrs){ 
+      $tmp[$attrs] = $this->$attrs;
+    }
+
+    /* Strip out dos newlines */
+    $tmp['FAIscript']= strtr($this->FAIscript, array("\x0D" => ""));
+
+    if(($this->orig_cn)&&($tmp['cn']!=$this->orig_cn)){
+      $tmp['remove']['from']  = $this->orig_cn;
+      $tmp['remove']['to']    = $tmp['cn'];
+    }
+  
+    $tmp['dn']      = $this->dn;  
+    $tmp['status']  = $this->status;  
+    return($tmp);
+  }
+
+    /* Return plugin informations for acl handling */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName" => _("Hook entry"),
+          "plDescription" => _("FAI hook entry"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 21,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("fai"),
+          "plProvidedAcls" => array(
+            "cn"                => _("Name"),
+            "description"       => _("Description"),
+            "FAItask"           => _("Task"),
+            "FAIscript"         => _("FAI script"))
+          ));
+  }
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/fai/class_faiManagement.inc b/gosa-core/plugins/admin/fai/class_faiManagement.inc
new file mode 100644 (file)
index 0000000..b9c0271
--- /dev/null
@@ -0,0 +1,1156 @@
+<?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 faiManagement extends plugin
+{
+       /* Definitions */
+       var $plHeadline                 = "FAI";
+       var $plDescription              = "Fully Automatic Installation - management";
+
+       /* CLI vars */
+       var $cli_summary                  = "Handling of FAI entries";
+       var $cli_description    = "This plugin represents a management tool\n
+               which allows us to manage all needed attributes for fully automatic installations (FAI)";
+       var $cli_parameters             = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+       /* Headpage attributes */
+  var $lock_type    = "";    // should be branch/freeze
+  var $lock_name    = "";
+  var $lock_dn      = "";  
+
+       /* attribute list for save action */
+       var $attributes         = array("lock_type","lock_name","lock_dn");     //      Attributes Managed by this plugin 
+       var $objectclasses= array();    //      ObjectClasses which the attributes are related to
+       var $dialog                             = array();      //      This object contains every dialog we have currently opened
+
+       var $objects                    = array();      //      This array contains all available objects shown in divlist
+       var $is_dialog          = false;
+
+  var $dispNewBranch= false;
+  var $dispNewFreeze= false;
+
+  var $DivListFai;
+  var $start_pasting_copied_objects = FALSE;
+  var $CopyPasteHandler = FALSE;
+  var $base = "";
+
+       /* construction/reconstruction 
+        */
+       function faiManagement (&$config, $ui)
+       {
+               /* Set defaults */
+               $this->dn                       = "";
+               $this->config   = $config;
+               $this->ui                       = $ui;  
+    
+    /* Creat dialog object */
+    $this->DivListFai = new divListFai($this->config,$this);
+
+    /* Copy & Paste handler */
+    if ($this->config->boolValueIsTrue("main", "enableCopyPaste")){
+      $this->CopyPasteHandler= new CopyPasteHandler($this->config);
+    }
+       }
+
+       function execute()
+       {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* Initialise vars and smarty */
+               $smarty         = get_smarty();
+               $smarty->assign("BranchName","");
+    
+               $display        = "";
+    $s_action  = "";
+               $s_entry        = "";
+    
+    /* If an entry was locked, these vars will be stored in a session to allow direct edit */
+    $_SESSION['LOCK_VARS_TO_USE'] = array("/^edit_entry$/","/^id$/","/^entry_edit_/","/^entry_delete_/","/^item_selected/","/^remove_multiple_fai_objects/");
+
+
+    /****************
+      Handle posts 
+     ****************/
+
+               /* Check ImageButton posts
+                * Create new tab ich new_xx is posted
+                */
+    $posts = array( "/remove_branch/"=>"remove_branch",    "/branch_branch/"=>"branch_branch",
+                    "/freeze_branch/"=>"freeze_branch",    "/create_partition/i"=>"new_partition",
+                    "/create_script/i"=>"new_script",      "/create_hook/i"=>"new_hook",
+                    "/create_variable/i"=>"new_variable",  "/create_template/i"=>"new_template",
+                    "/create_package/i"=>"new_package",    "/create_profile/i"=>"new_profile",
+                    "/edit_continue/"=>"select_class_name_finished",
+                    "/^multiple_copy_fai/" => "copy_multiple", 
+                    "/^multiple_cut_fai/" => "cut_multiple", 
+                    "/^copy/" => "copy",
+                    "/^cut/" => "cut",
+                    "/^remove_multiple_fai_objects/" => "del_multiple");
+
+               foreach($_POST as $name => $value){
+      foreach($posts as $reg => $act ){
+        if(preg_match($reg,$name)){
+          $s_action = $act;
+          $s_entry = ltrim(preg_replace($reg,"",$name),"_");
+          $s_entry = preg_replace("/_.*$/","",$s_entry);
+        }
+      }
+                       if(preg_match("/^entry_edit_.*/",$name)){
+                               $s_entry = preg_replace("/^entry_edit_/","",$name);
+                               $s_entry = preg_replace("/_.*$/","",$s_entry);
+                               $s_action = "edit";
+                       }elseif(preg_match("/^entry_delete_.*/",$name)){
+                               $s_entry = preg_replace("/^entry_delete_/","",$name);
+                               $s_entry = preg_replace("/_.*$/","",$s_entry);
+        $s_action = "delete";
+      }
+    }
+
+               if(isset($_GET['edit_entry'])){
+                       $s_entry = $_GET['edit_entry'];
+                       $s_action = "edit";
+               }
+
+    if(isset($_GET['act']) && $_GET['act'] == "freeze_branch"){
+      $s_action = "freeze_branch";
+    }
+    if(isset($_GET['act']) && $_GET['act'] == "branch_branch"){
+      $s_action = "branch_branch";
+    }
+    if(isset($_GET['act']) && $_GET['act'] == "remove_branch"){
+      $s_action = "remove_branch";
+    }
+    
+    if((isset($_POST['CancelBranchName'])) || (isset($_POST['CloseIFrame']))){
+      $this->dispNewBranch = false;
+      $this->dispNewFreeze = false;
+    }
+
+
+    $type_acl_mapping = array(
+        "FAIpartitionTable"  => "faiPartitionTable", 
+        "FAIpackageList"     => "faiPackage",
+        "FAIscript"          => "faiScript",
+        "FAIvariable"        => "faiVariable",
+        "FAIhook"            => "faiHook",
+        "FAIprofile"         => "faiProfile",
+        "FAItemplate"        => "faiTemplate");
+
+
+    /* handle C&P from layers menu */
+    if(isset($_POST['menu_action']) && preg_match("/^multiple_copy_systems/",$_POST['menu_action'])){
+      $s_action = "copy_multiple";
+    }
+    if(isset($_POST['menu_action']) && preg_match("/^multiple_cut_systems/",$_POST['menu_action'])){
+      $s_action = "cut_multiple";
+    }
+    if(isset($_POST['menu_action']) && preg_match("/^editPaste/",$_POST['menu_action'])){
+      $s_action = "editPaste";
+    }
+
+    /* Create options */
+    if(isset($_POST['menu_action']) && preg_match("/^Create_/",$_POST['menu_action'])){
+      $s_action = "new_".preg_replace("/^Create_/","",$_POST['menu_action']);;
+      $s_entry  = preg_replace("/^Create_/","",$_POST['menu_action']);
+    }
+
+    /* handle remove from layers menu */
+    if(isset($_POST['menu_action']) && preg_match("/^remove_multiple/",$_POST['menu_action'])){
+      $s_action = "del_multiple";
+    }
+
+    /********************
+      Copy & Paste
+     ********************/
+
+    /* Display the copy & paste dialog, if it is currently open */
+    $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
+    if($ret){
+      return($ret);
+    }
+
+
+    /****************
+      Delete confirme dialog 
+     ****************/
+
+               if ($s_action=="delete"){
+
+      /* Get 'dn' from posted termlinst */
+      $this->dn= $this->objects[$s_entry]['dn'];
+
+                       /* Load permissions for selected 'dn' and check if
+                          we're allowed to remove this 'dn' */
+      $acl  = $this->ui->get_permissions($this->dn,"fai/".$type_acl_mapping[$this->objects[$s_entry]['type']]);
+      if(preg_match("/d/",$acl)){
+
+                               /* Check locking, save current plugin in 'back_plugin', so the dialog knows where to return. */
+                               if (($user= get_lock($this->dn)) != ""){
+                                       return(gen_locked_message ($user, $this->dn));
+                               }
+
+                               /* Lock the current entry, so nobody will edit it during deletion */
+                               add_lock ($this->dn, $this->ui->dn);
+                               $smarty->assign("warning", sprintf(_("You're about to delete all information about the FAI class at '%s'."), @LDAP::fix($this->dn)));
+        $smarty->assign("multiple", false);
+                               return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+                       } else {
+
+                               /* Obviously the user isn't allowed to delete. Show message and
+                                  clean session. */
+                               print_red (_("You are not allowed to delete this component!"));
+                       }
+               }
+
+
+    /********************
+      Delete MULTIPLE entries requested, display confirm dialog
+     ********************/
+
+    if ($s_action=="del_multiple"){
+      $this->dns = array();
+      $ids = $this->list_get_selected_items();
+
+      if(count($ids)){
+
+        foreach($ids as $id){
+          $dn = $this->objects[$id]['dn'];
+          if (($user= get_lock($dn)) != ""){
+            return(gen_locked_message ($user, $dn));
+          }
+          $this->dns[$id] = $dn;
+        }
+
+        $dns_names = "<br><pre>";
+        foreach($this->dns as $dn){
+          add_lock ($dn, $this->ui->dn);
+          $dns_names .= $dn."\n";
+        }
+        $dns_names .="</pre>";
+
+        /* Lock the current entry, so nobody will edit it during deletion */
+        if (count($this->dns) == 1){
+          $smarty->assign("warning",     sprintf(_("You're about to delete the following entry %s"), @LDAP::fix($dns_names)));
+        } else {
+          $smarty->assign("warning",     sprintf(_("You're about to delete the following entries %s"), @LDAP::fix($dns_names)));
+        }
+        $smarty->assign("multiple", true);
+        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+      }
+    }
+
+
+    /********************
+      Delete MULTIPLE entries confirmed
+     ********************/
+
+    /* Confirmation for deletion has been passed. Users should be deleted. */
+    if (isset($_POST['delete_multiple_fai_object_confirm'])){
+
+      /* Find out more about the object type */
+      $ldap   = $this->config->get_ldap_link();
+
+      /* Remove user by user and check acls before removeing them */
+      foreach($this->dns as $key => $dn){
+
+        $ldap->cat($dn, array('objectClass'));
+        $attrs  = $ldap->fetch();
+        $type   = $this->get_type($attrs);
+
+        $acl  = $this->ui->get_permissions($dn,"fai/".$type[1]);
+        if(preg_match("/d/",$acl)){
+
+          $this->dialog = new $type[0]($this->config, $this->config->data['TABS'][$type[2]], $dn,"fai");
+          $this->dialog->set_acl_base($dn);
+          $this->dialog->by_object[$type[1]]->remove_from_parent ();
+          unset ($this->dialog);
+          $this->dialog= FALSE;
+          $to_del = clean_up_releases($dn);
+          save_release_changes_now();
+
+          foreach($to_del as $dn){
+            $ldap->rmdir_recursive($dn);
+          }
+
+        } else {
+
+          /* Normally this shouldn't be reached, send some extra
+             logs to notify the administrator */
+          print_red (_("You are not allowed to delete this component!"));
+          new log("security","fai/".get_class($this),$dn,array(),"Tried to trick deletion.");
+        }
+
+        /* Remove lock file after successfull deletion */
+        del_lock ($dn);
+        unset($this->dns[$key]);
+      }
+    }
+
+
+    /********************
+      Delete MULTIPLE entries Canceled
+     ********************/
+
+    /* Remove lock */
+    if(isset($_POST['delete_multiple_fai_object_cancel'])){
+      foreach($this->dns as $key => $dn){
+        del_lock ($dn);
+        unset($this->dns[$key]);
+      }
+    }
+
+
+    /****************
+      Delete aborted  
+     ****************/
+
+               /* Delete canceled? */
+               if (isset($_POST['delete_cancel'])){
+                       del_lock ($this->dn);
+               }
+
+
+    /****************
+      Delete confirmed 
+     ****************/
+
+               /* Deltetion was confirmed, so delete this entry
+     */
+    if (isset($_POST['delete_terminal_confirm'])){
+
+      /* Some nice guy may send this as POST, so we've to check
+         for the permissions again. */
+
+      /* Find out more about the object type */
+      $ldap      = $this->config->get_ldap_link();
+      $ldap->cat($this->dn, array('objectClass'));
+      if($ldap->count()){
+        $attrs = $ldap->fetch();
+        $type    = $this->get_type($attrs);                    
+
+        $acl  = $this->ui->get_permissions($this->dn,"fai/".$type[1]);
+        if(preg_match("/d/",$acl)){
+
+          $this->dialog = new $type[0]($this->config,  $this->config->data['TABS'][$type[2]], $this->dn,"fai");
+          $this->dialog->set_acl_base($this->dn);
+          $this->dialog->by_object[$type[1]]->remove_from_parent ();
+          unset ($this->dialog);
+          $this->dialog= FALSE;
+          $to_del = clean_up_releases($this->dn);
+          save_release_changes_now();
+
+          foreach($to_del as $dn){
+            $ldap->rmdir_recursive($dn);
+          }
+
+        } else {
+
+          /* Normally this shouldn't be reached, send some extra
+             logs to notify the administrator */
+          print_red (_("You are not allowed to delete this component!"));
+          new log("security","fai/".get_class($this),$dn,array(),"Tried to trick deletion.");
+        }
+
+      }else{
+        print_red(sprintf(_("Object could not be deleted '%s', object does not exist."),$this->dn));
+      }
+      /* Remove lock file after successfull deletion */
+      del_lock ($this->dn);
+    }
+
+
+    /****************
+      Edit entry 
+     ****************/
+
+               if(($s_action == "edit") && (!isset($this->dialog->config))){
+                       $entry    = $this->objects[$s_entry];
+                       $a_setup  = $this->get_type($entry);
+                       $this->dn = $entry['dn'];
+
+                       /* Check locking, save current plugin in 'back_plugin', so the dialog knows where to return. */
+                       if (($user= get_lock($this->dn)) != ""){
+                               return(gen_locked_message ($user, $this->dn));
+                       }
+                       add_lock ($this->dn, $this->ui->dn);
+
+                       $this->dialog     = new $a_setup[0]($this->config,$this->config->data['TABS'][$a_setup[2]],$this->dn,"fai");
+      $this->dialog->set_acl_base($this->dn);
+                       $this->is_dialog  = true;
+
+      if($entry['FAIstate'] == "freeze"){
+        #$this->dialog->set_acl(array("*none*"))  ;    
+        echo "Dawn it is freezed.";
+      }
+                       $_SESSION['objectinfo'] = $this->dn;
+               }
+
+
+    /*  Branch handling 
+        09.01.2006
+    */
+
+    /****************
+      Remove branch
+     ****************/
+
+    /* Remove branch 
+     */
+    if($s_action == "remove_branch"){
+      $base= $this->DivListFai->selectedBranch;
+
+      /* Check if we have a post remove method configured
+       *  else skip this operation. (Skip:Button in the ui should be disabled in this case too)
+       */
+      if("" != $this->config->search("faiManagement", "POSTREMOVE",array('menu','tabs'))){
+        /* Load permissions for selected 'dn' and check if
+           we're allowed to remove this 'dn' */
+        if($this->acl_is_removeable()){
+
+          $smarty->assign("info", sprintf(_("You're about to delete a fai branch / freeze  '%s'."), $this->DivListFai->selectedBranch));
+          return($smarty->fetch(get_template_path('remove_branch.tpl',TRUE)));
+        } else {
+          print_red (_("You are not allowed to delete this release!"));
+        }
+      }
+    }
+
+    
+    /****************
+      Remove branch confirmed
+     ****************/
+
+    if(isset($_POST['delete_branch_confirm'])){
+
+      /* Check if we have a post remove method configured
+       *  else skip this operation. (Skip:Button in the ui should be disabled in this case too)
+       */
+      if("" != $this->config->search("faiManagement", "POSTREMOVE",array('menu','tabs'))){
+
+        $bb =  $this->DivListFai->selectedBranch;
+        if(!isset($ldap)){
+          $ldap = $this->config->get_ldap_link();
+        }
+
+        $br = $this->getBranches();
+
+        if(isset($br[$bb]) && $this->acl_is_removeable()){
+          $name = $br[$bb];
+          $ldap->cd($bb);
+          $ldap->recursive_remove();
+          $ldap->cd(preg_replace('/,ou=fai,ou=configs,ou=systems,/', ',ou=apps,', $bb));
+          $ldap->recursive_remove();
+          $this->DivListFai->selectedBranch = "main";
+
+          /* Post remove */
+          $this->lock_name   = $name;
+          $this->lock_dn     = $bb;
+          $this->postremove();
+
+          new log("remove","fai/".get_class($this),$br[$bb],array(),"Release removed");
+        }
+      }
+    }
+
+
+    /****************
+      Create a new branch "insert Name"
+     ****************/
+
+    if((isset($_POST['UseBranchName']))&&(($this->dispNewBranch)||($this->dispNewFreeze))){
+      $_SESSION['LASTPOST'] = $_POST;
+
+      if($this->dispNewBranch){
+        $type = "branch";
+      }else{
+        $type = "freeze";
+      }
+
+      /* Check branch name */
+      $name = $_POST['BranchName'];
+      $is_ok = true;
+      $smarty->assign("BranchName",$name);
+      $base= "ou=fai,ou=configs,ou=systems,".$this->DivListFai->selectedBase;
+
+      /* Check used characters */
+      if(preg_match("/[^0-9a-z \ö\ä\ü\.-_:,]/i",$name)){
+        if($type == "branch"){
+          print_red(_("Specified branch name is invalid."));
+        }else{
+          print_red(_("Specified freeze name is invalid."));
+        }
+        $is_ok = false;
+      }
+
+      /* Check if this name is already in use */
+      if(!$this->CheckNewBranchName($_POST['BranchName'],$this->DivListFai->selectedBranch)){
+        print_red(_("This name is already in use."));
+        $is_ok = false;
+      }
+
+      if($is_ok){
+        $_SESSION['LASTPOST']['base'] = $base;
+        $_SESSION['LASTPOST']['type'] = $type;
+        $smarty->assign("iframe", true);
+        $smarty->assign("plugID", $_GET['plug']);
+        $display       = $smarty->fetch(get_template_path('faiNewBranch.tpl', TRUE, dirname(__FILE__)));
+        return($display);
+      }
+    }
+
+
+    /****************
+      Create a new branch 
+     ****************/
+
+    if(isset($_GET['PerformBranch'])){
+    
+      if(!$this->acl_is_createable()){
+        print_red(_("You are not allowed to create a new branch."));
+      }else{
+
+        /* Create it know */
+        $this->dispNewBranch = false;
+        $this->dispNewFreeze = false;
+        $base = $_SESSION['LASTPOST']['base'];
+        $_POST = $_SESSION['LASTPOST'];      
+        $name = $_POST['BranchName'];
+
+        $type = $_SESSION['LASTPOST']['type'];
+        $ldap = $this->config->get_ldap_link();
+
+        $baseToUse = $base;
+        if($this->DivListFai->selectedBranch != "main" ){
+          $baseToUse = $this->DivListFai->selectedBranch;
+        }
+
+        /* Create new Release name to be able to set faidebianRelease for FAIpackageList */
+
+        $CurrentReleases  = $this->getBranches();
+        $NewReleaseName   = $name;
+        if(isset($CurrentReleases[$this->DivListFai->selectedBranch])) {
+          if($this->DivListFai->selectedBranch != "main"){
+            $NewReleaseName = $CurrentReleases[$this->DivListFai->selectedBranch]."/".$name;
+            $NewReleaseName = preg_replace("#\/#","/",$NewReleaseName); 
+          }else{
+            $NewReleaseName   = $name;
+          }
+        }
+
+        $appsrc = preg_replace("/ou=fai,ou=configs,ou=systems,/","ou=apps,",$baseToUse); 
+        $appdst = preg_replace("/ou=fai,ou=configs,ou=systems,/","ou=apps,","ou=".$name.",".$baseToUse) ; 
+
+        $mimesrc = preg_replace("/ou=fai,ou=configs,ou=systems,/","ou=mime,",$baseToUse); 
+        $mimedst = preg_replace("/ou=fai,ou=configs,ou=systems,/","ou=mime,","ou=".$name.",".$baseToUse) ; 
+
+        /* Check if source depeartments exist */
+        foreach(array($baseToUse,$appsrc,$mimesrc) as $dep){
+          $ldap->cd($this->config->current['BASE']);
+          $ldap->cat($dep);
+          if(!$ldap->count()){
+            $ldap->create_missing_trees($dep);
+          }
+        }
+
+        /* Print header to have styles included */
+        echo '  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
+          <html>
+          <head>
+          <title></title>
+          <style type="text/css">@import url("themes/default/style.css");</style>
+          <script language="javascript" src="include/focus.js" type="text/javascript"></script>
+          </head>
+          <body style="background: none;margin:3px;color:black">
+          ';
+
+        new log("create","fai/".get_class($this),$NewReleaseName,array(),"New $type created");
+
+        /* Duplicate applications 
+         */
+        $ldap->cat($appsrc,array("dn")) ;
+        if($ldap->count()){
+          $ldap->cd ($appdst);
+          $ldap->recursive_remove();
+          $ldap->cd ($this->config->current['BASE']);
+          $ldap->copy_FAI_resource_recursive($appsrc,$appdst,$NewReleaseName,$type,true);
+        }
+
+        /* Duplicate mime types 
+         */
+        $ldap->cat($mimesrc,array("dn")) ;
+        if($ldap->count()){
+          $ldap->cd ($mimedst);
+          $ldap->recursive_remove();
+          $ldap->cd ($this->config->current['BASE']);
+          $ldap->copy_FAI_resource_recursive($mimesrc,$mimedst,$NewReleaseName,$type,true);
+        }
+
+        $attr = array();
+        $attr['objectClass'] = array("organizationalUnit","FAIbranch");
+        $attr['ou']       = $name;
+        $attr['FAIstate'] = $type;
+        $ldap->cd($this->config->current['BASE']);
+        $ldap->cd("ou=".$name.",".$baseToUse);
+        $ldap->cat("ou=".$name.",".$baseToUse);
+        if($ldap->count()){
+          $ldap->modify($attr);
+        }else{
+          $ldap->add($attr);
+        }
+
+        /* Duplicate fai objects 
+         */
+        //      $ldap->cd ("ou=".$name.",".$baseToUse);
+        //      $ldap->recursive_remove();
+        //      $ldap->cd ($this->config->current['BASE']);
+        //      $ldap->copy_FAI_resource_recursive($baseToUse,"ou=".$name.",".$baseToUse,$NewReleaseName,$type,true);
+
+        echo "<div style='width:100%;text-align:right;'><form name='form' method='post' action='?plug=".$_GET['plug']."' target='_parent'>
+          <br><input type='submit' name='CloseIFrame' value='"._("Continue")."'>
+          </form></div>";
+
+        echo "<script language=\"javascript\" type=\"text/javascript\">scrollDown2();</script>" ;
+
+        /* Print footer to have valid html */
+        echo "</body></html>";
+
+        $this->dispNewFreeze = false; 
+
+        /* Postcreate */ 
+
+        /* Assign possible attributes */
+        $this->lock_type  = $type; 
+        $this->lock_name  = $name; 
+        $this->lock_dn    = $baseToUse;
+        $this->postcreate();
+        exit();
+      }
+    }
+
+    /****************
+      Display dialog to enter new Branch name
+     ****************/
+
+    /* Check if we have a post create method configured
+     *  else skip this operation. (Skip:Button in the ui should be disabled in this case too)
+     */
+    if("" != $this->config->search("faiManagement", "POSTCREATE",array('menu','tabs'))){
+      if(($s_action == "branch_branch")||($this->dispNewBranch)){
+        if(!$this->acl_is_createable()){
+          print_red(_("You are not allowed to create a new branch."));
+        }else{
+          $this->dispNewBranch=true;
+          $smarty->assign("iframe",false);
+          $display     .= $smarty->fetch(get_template_path('faiNewBranch.tpl', TRUE, dirname(__FILE__)));
+          return($display);
+        }
+      } 
+    }
+
+    /****************
+      Display dialog to enter new Freeze name
+     ****************/
+
+    /* Check if we have a post create method configured
+     *  else skip this operation. (Skip:Button in the ui should be disabled in this case too)
+     */
+    if("" != $this->config->search("faiManagement", "POSTCREATE",array('menu','tabs'))){
+      if(($s_action == "freeze_branch")||($this->dispNewFreeze)){
+        if(!$this->acl_is_createable()){
+          print_red(_("You are not allowed to create a new branch."));
+        }else{
+          $this->dispNewFreeze = true;
+          $smarty->assign("iframe",false);
+          $display     .= $smarty->fetch(get_template_path('faiNewBranch.tpl', TRUE, dirname(__FILE__)));
+          return($display);
+        }
+      }
+    }
+
+
+    /****************
+      Create a new object 
+     ****************/
+
+    $types = array( "new_partition"     =>  "FAIpartitionTable",
+                    "new_script"        =>  "FAIscript",
+                    "new_hook"          =>  "FAIhook",
+                    "new_variable"      =>  "FAIvariable",
+                    "new_template"      =>  "FAItemplate",
+                    "new_package"       =>  "FAIpackageList");
+
+    if(isset($types[$s_action])){
+      $acl = $this->ui->get_permissions($this->DivListFai->selectedBase,"fai/".$type_acl_mapping[$types[$s_action]]);
+      if(preg_match("/c/",$acl)){
+        $this->dialog = new askClassName($this->config,$this->dn,$this->ui,$types[$s_action]);
+      }else{
+        print_red(sprintf(_("You are not allowed to create a new '%s' object."),$types[$s_action]));
+      }
+    }
+
+    /* New Profile */
+    if($s_action == "new_profile"){
+      $this->dn = "new" ;
+
+      $acl = $this->ui->get_permissions($this->DivListFai->selectedBase,"fai/faiProfile");
+      if(preg_match("/c/",$acl)){
+        $a_setup= $this->get_type(array("objectClass"=>array("FAIprofile")));
+        $this->dialog = new $a_setup[0]($this->config,$this->config->data['TABS'][$a_setup[2]],$this->dn,"fai");
+        $this->dialog->set_acl_base($this->base);
+
+        $this->is_dialog = false;
+      }else{
+        print_red(sprintf(_("You are not allowed to create a new '%s' object."),"FAIprofile"));
+      }
+    }
+
+
+    /****************
+      Get from ask class name dialog 
+     ****************/
+
+    if($s_action == "select_class_name_finished"){
+      $this->dialog->save_object();
+      if(count($this->dialog->check())!=0){
+        foreach($this->dialog->check() as $msg){
+          print_red($msg);
+        }              
+      }elseif(isset($this->dialog->objectClass)){
+        $this->dn = "new" ;
+        $a_setup= $this->get_type(array("objectClass"=>array($this->dialog->objectClass)));
+        $name = $this->dialog->save();
+
+        if(class_exists($a_setup[0])){
+          $this->dialog = new $a_setup[0]($this->config,$this->config->data['TABS'][$a_setup[2]],$this->dn,"fai");
+          $this->dialog->set_acl_base($this->base);
+          $this->dialog->by_object[$a_setup[1]]->cn = $name;
+          $this->is_dialog = true;
+        }
+      }                
+    }  
+
+
+    /****************
+     Cancel dialogs 
+     ****************/
+
+               if(isset($_POST['edit_cancel'])){
+                       unset($this->dialog);
+                       $this->dialog=FALSE;
+                       $this->is_dialog = false;
+                       unset($_SESSION['objectinfo']);
+                       del_lock ($this->dn);
+               }
+
+
+    /****************
+      Save sub dialogs 
+     ****************/
+
+               /* This check if the given tab could be saved 
+                * If it was possible to save it, remove dialog object. 
+                * If it wasn't possible, show errors and keep dialog.
+                */
+               if((isset($_POST['edit_finish']) || isset($_POST['edit_apply'])) && (isset($this->dialog->config))){
+                       $this->dialog->save_object();
+      $msgs= $this->dialog->check();
+                       if(count($msgs)!=0){
+                               foreach($msgs as $msg){
+                                       print_red($msg);
+                               }
+                       }else{
+                               $this->dialog->save();
+        save_release_changes_now();
+        if (!isset($_POST['edit_apply'])){
+          del_lock ($this->dn);
+          unset($this->dialog);
+          $this->dialog=FALSE;
+          $this->is_dialog=false;
+          unset($_SESSION['objectinfo']);
+        }
+                       }
+               }
+
+
+    /****************
+      Display currently open dialog 
+     ****************/
+
+               /* If dialog is set, but $this->is_dialog==false, then 
+                *  only the "abort" button is shown, this are dialogs that must not be saved.  
+                * If is_dialog == true, we are currently editing tab objects.
+                *  Here we need both, save and cancel
+                */ 
+
+               if(is_object($this->dialog)){
+                       $display .= $this->dialog->execute();
+                       /* Don't show buttons if tab dialog requests this */
+
+      if(isset($this->dialog->current)){
+
+        $obj = $this->dialog->by_object[$this->dialog->current];
+
+        if((isset($obj->is_dialog) && (!$obj->is_dialog)) || (isset($obj->dialog) && (!$obj->dialog))){
+
+          $display.= "<p style=\"text-align:right\">\n";
+          $display.= "<input type=\"submit\" name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
+          $display.= "&nbsp;\n";
+          if ($this->dn != "new"){
+            $display.= "<input type=submit name=\"edit_apply\" value=\""._("Apply")."\">\n";
+            $display.= "&nbsp;\n";
+          }
+          $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+          $display.= "</p>";
+        }elseif(!isset($this->dialog->current)){
+          $display.= "<p style=\"text-align:right\">\n";
+          $display.= "<input type=\"submit\" name=\"edit_continue\" value=\""._("Continue")."\">&nbsp;";
+          $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+          $display.= "</p>";
+        }
+      }else{
+        $display.= "<p style=\"text-align:right\">\n";
+        $display.= "<input type=\"submit\" name=\"edit_continue\" value=\""._("Continue")."\">&nbsp;";
+        $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+        $display.= "</p>";
+
+      }
+      return($display);
+               }
+               
+
+    /****************
+      Dialog display
+     ****************/
+
+    /* Check if there is a snapshot dialog open */
+    $base = $this->DivListFai->selectedBase;
+    if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases())){
+      return($str);
+    }
+
+    /* Display dialog with system list */
+    $this->DivListFai->parent = $this;
+    $this->DivListFai->execute();
+    $this->DivListFai->AddDepartments($this->DivListFai->selectedBase,4,1);
+    $this->reload();
+    $this->DivListFai->setEntries($this->objects);
+    return($this->DivListFai->Draw());
+       }
+
+
+  /* Return departments, that will be included within snapshot detection */
+  function get_used_snapshot_bases()
+  {
+    $tmp = array();
+    $types = array("hooks","scripts","disk","packages","profiles","templates","variables");
+    foreach($types as $type){
+      if($this->DivListFai->selectedBranch == "main"){
+        $tmp[] = "ou=".$type.",ou=fai,ou=configs,ou=systems,".$this->DivListFai->selectedBase;
+      }else{
+        $tmp[] = "ou=".$type.",".$this->DivListFai->selectedBranch;
+      }
+    }
+    return($tmp);
+  }
+
+
+  /* Get available branches for current base */
+  function getBranches($base = false,$prefix = "")
+  {
+    $ret = array("/"=>"main");
+    $ldap = $this->config->get_ldap_link();
+    if(!$base){
+      $base= $_SESSION['CurrentMainBase'];
+    }
+    $tmp = get_all_releases_from_base($base,true);
+    foreach($tmp as $dn => $name){
+      $ret[$name]=$dn;
+    }
+    ksort($ret);
+    $ret = array_flip($ret);
+
+    return ($ret);
+  }
+  
+
+  function list_get_selected_items()
+  {
+    $ids = array();
+    foreach($_POST as $name => $value){
+      if(preg_match("/^item_selected_[0-9]*$/",$name)){
+        $id   = preg_replace("/^item_selected_/","",$name);
+        $ids[$id] = $id;
+      }
+    }
+    return($ids);
+  }
+
+
+  /* reload list of objects */
+  function reload()
+  {
+    /* Variable initialisation */
+    $str            = "";
+    $Regex          = $this->DivListFai->Regex;
+    $this->objects  = array();
+
+    /* Get base */
+    $base = "ou=fai,ou=configs,ou=systems,".$this->DivListFai->selectedBase;
+    if($this->DivListFai->selectedBranch != "main"){
+      $br = $this->getBranches();
+      if(isset($br[$this->DivListFai->selectedBranch])){
+        $base = $this->DivListFai->selectedBranch;
+      }else{
+        $base = "ou=fai,ou=configs,ou=systems,".$this->DivListFai->selectedBase;
+      }
+    }
+    $this->base = $base;
+    $this->set_acl_base($this->base);
+
+    $this->lock_type = get_release_tag(get_release_dn($base));
+
+    /* Create a new list of FAI object 
+     * Generate List of Partitions,Hooks,Scripts,Templates,Profiles ... 
+     */
+    $ObjectTypes = array(
+        "FAIpartitionTable"  => array("OU"=>"ou=disk,"        , "CHKBOX"=>"ShowPartitions"  ,"ACL" => "faiPartitionTable"),
+        "FAIpackageList"     => array("OU"=>"ou=packages,"    , "CHKBOX"=>"ShowPackages"    ,"ACL" => "faiPackage"),
+        "FAIscript"          => array("OU"=>"ou=scripts,"     , "CHKBOX"=>"ShowScripts"     ,"ACL" => "faiScript"),
+        "FAIvariable"        => array("OU"=>"ou=variables,"   , "CHKBOX"=>"ShowVariables"   ,"ACL" => "faiVariable"),
+        "FAIhook"            => array("OU"=>"ou=hooks,"       , "CHKBOX"=>"ShowHooks"       ,"ACL" => "faiHook"),
+        "FAIprofile"         => array("OU"=>"ou=profiles,"    , "CHKBOX"=>"ShowProfiles"    ,"ACL" => "faiProfile"),
+        "FAItemplate"        => array("OU"=>"ou=templates,"   , "CHKBOX"=>"ShowTemplates"   ,"ACL" => "faiTemplate"));
+
+    $filter = "";
+    foreach($ObjectTypes as $key => $data){
+      if($this->DivListFai->$data['CHKBOX']){
+        $filter.= "(objectClass=".$key.")";
+      }
+    }
+    $filter = "(&(|".$filter.")(cn=$Regex))";
+    
+    /* Get resolved release dependencies */
+    $tmp = get_all_objects_for_given_base($base,$filter);
+
+    /* Ge listed ldap objects */
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    foreach($tmp as $entry){
+
+      /* Get some more informations about the object */ 
+      $ldap->cat($entry['dn'], array("cn","description","objectClass","FAIclass","FAIstate","objectClass"));
+      $object  = $ldap->fetch();
+
+      /* Walk through possible types */
+      foreach($ObjectTypes as $type => $rest){  
+
+        $acl = $this->ui->get_permissions($object['dn'],"fai/".$rest ['ACL']);
+
+        if(in_array($type,$object['objectClass']) && preg_match("/r/",$acl)){
+
+          /* Prepare object */
+          unset($object['objectClass']['count']);
+          if(!isset($object['description'][0])){
+            $object['description'][0]="";
+          }
+
+          /* Clean up object informations */
+          $obj                  = array();
+          $obj['cn']                         = $object['cn'][0];
+          $obj['dn']                         = $object['dn'];
+          $obj['acl']                      = $acl;
+          $obj['description']   = $object['description'][0];
+          $obj['objectClass']   = $object['objectClass'];
+
+          /* Append type to this string, to be able to check if the selected 
+           * entry is of type 'freeze' or 'branch'
+           */
+          if(!isset($object['FAIstate'])){
+            $obj['FAIstate'] = $this->lock_type;
+          }else{
+            $obj['FAIstate'] = $object['FAIstate'][0]; 
+          }
+
+          $this->objects[strtolower($obj['cn']).$obj['cn'].$type] = $obj;
+          $this->objects[strtolower($obj['cn']).$obj['cn'].$type]['type']=$type;
+        }
+                       }
+               }
+
+               ksort($this->objects);
+               reset ($this->objects);
+       
+               /* use numeric index, thats a bit more secure */        
+               $tmp0 = array();
+               foreach($this->objects as $obj){
+                       $tmp0[]= $obj;
+               }
+               $this->objects = array();
+               $this->objects = $tmp0;
+       }
+
+       function remove_lock()
+       {
+               if (isset($this->dn)){
+                       del_lock ($this->dn);
+               }
+       }
+
+       function get_type($array){
+               if(in_array("FAIpartitionTable",$array['objectClass'])){
+                       return(array("tabsPartition","faiPartitionTable","FAIPARTITIONTABS"));
+               }
+               if(in_array("FAIscript",$array['objectClass'])){
+                       return(array("tabsScript","faiScript","FAISCRIPTTABS"));
+               }
+               if(in_array("FAItemplate",$array['objectClass'])){
+                       return(array("tabsTemplate","faiTemplate","FAITEMPLATETABS"));
+               }
+               if(in_array("FAIhook",$array['objectClass'])){
+                       return(array("tabsHook","faiHook","FAIHOOKTABS"));
+               }
+               if(in_array("FAIvariable",$array['objectClass'])){
+                       return(array("tabsVariable","faiVariable","FAIVARIABLETABS"));
+               }
+               if(in_array("FAIprofile",$array['objectClass'])){
+                       return(array("tabsProfile","faiProfile","FAIPROFILETABS"));
+               }
+               
+               if(in_array("FAIpackageList",$array['objectClass'])){
+                       return(array("tabsPackage","faiPackage","FAIPACKAGETABS"));
+               }
+       }
+
+  function CheckNewBranchName($name,$base)
+  {
+    $f = $this->DivListFai->selectedBranch;
+    if($name == ""){
+      return(false);
+    }elseif(in_array($name,$this->getBranches($f))) {
+      return(false);
+    }elseif(is_department_name_reserved($name,$base)){
+      return(false);
+    }
+    return(true);
+  }
+
+  function save_object()
+  {
+    $this->DivListFai->save_object();
+  }
+
+
+  function copyPasteHandling_from_queue($s_action,$s_entry)
+  {
+    /* Check if Copy & Paste is disabled */
+    if(!is_object($this->CopyPasteHandler)){
+      return("");
+    }
+
+    $base = $this->DivListFai->selectedBranch;
+    if($base == "main"){
+      $base = $this->DivListFai->selectedBase;
+    }
+
+    /* Add a single entry to queue */
+    if($s_action == "cut" || $s_action == "copy"){
+
+      /* Cleanup object queue */
+      $this->CopyPasteHandler->cleanup_queue();
+      $entry    = $this->objects[$s_entry];
+      $a_setup  = $this->get_type($entry);
+      $dn = $entry['dn'];
+      $this->CopyPasteHandler->add_to_queue($dn,$s_action,$a_setup[0],$a_setup[2],"fai");//$a_setup[1]);
+    }
+
+    /* Add entries to queue */
+    if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
+
+      /* Cleanup object queue */
+      $this->CopyPasteHandler->cleanup_queue();
+
+      /* Add new entries to CP queue */
+      foreach($this->list_get_selected_items() as $id){
+
+        /* Cleanup object queue */
+        $entry    = $this->objects[$id];
+        $a_setup  = $this->get_type($entry);
+        $dn = $entry['dn'];
+
+
+        if($s_action == "copy_multiple"){
+          $this->CopyPasteHandler->add_to_queue($dn,"copy",$a_setup[0],$a_setup[2],"fai");//$a_setup[1]);
+        }
+        if($s_action == "cut_multiple"){
+          $this->CopyPasteHandler->add_to_queue($dn,"cut",$a_setup[0],$a_setup[2],"fai");//$a_setup[1]);
+        }
+      }
+    }
+
+    /* Start pasting entries */
+    if($s_action == "editPaste"){
+      $this->start_pasting_copied_objects = TRUE;
+    }
+
+    /* Return C&P dialog */
+    if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
+
+      /* Load entry from queue and set base */
+      $this->CopyPasteHandler->load_entry_from_queue();
+      $this->CopyPasteHandler->SetVar("base",$base);
+
+      /* Get dialog */
+      $data = $this->CopyPasteHandler->execute();
+
+      save_release_changes_now();
+
+      /* Return dialog data */
+      if(!empty($data)){
+        return($data);
+      }
+    }
+
+    /* Automatically disable status for pasting */
+    if(!$this->CopyPasteHandler->entries_queued()){
+      $this->start_pasting_copied_objects = FALSE;
+    }
+    return("");
+  }
+
+
+  /* Return plugin informations for acl handling */ 
+  static function plInfo()
+  {
+    return (array( 
+          "plShortName"   => _("FAI releases"),
+          "plDescription" => _("FAI release management"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 0,
+          "plSection"     => array("administration"),           
+          "plCategory"    => array("fai"=> array("description" => _("FAI"),
+                                                 "objectClass" => "FAIclass")),
+          "plProvidedAcls"=> array()));
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/fai/class_faiPackage.inc b/gosa-core/plugins/admin/fai/class_faiPackage.inc
new file mode 100644 (file)
index 0000000..bcd5eaa
--- /dev/null
@@ -0,0 +1,670 @@
+<?php
+
+class faiPackage 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;
+
+  /* Attributes for this Object */
+  var $attributes       = array("cn","description","FAIpackage","FAIdebianRelease","FAIdebianSection", "FAIinstallMethod");
+
+  /* ObjectClasses for this Object*/
+  var $objectclasses    = array("top","FAIclass","FAIpackageList","FAIrepository");
+
+  /* Class name of the Ldap ObjectClass for the Sub Object */
+  var $subClass         = "";
+  var $subClasses       = array("top","FAIclass","FAIscriptEntry");
+
+  /* Class name of the php class which allows us to edit a Sub Object */
+  var $subClassName     = "";      
+
+  /* Attributes to initialise for each subObject */
+  var $subAttributes    = array("cn","description"); 
+  var $sub64coded       = array();
+
+  var $ConfiguredPackages = array();
+
+  /* Specific attributes */
+  var $cn               = "";       // The class name for this object
+  var $description      = "";       // The description for this set of partitions
+  var $is_dialog        = false;    // specifies which buttons will be shown to save or abort
+  var $SubObjects       = array();  // All leafobjects of this object
+
+  var $FAIdebianRelease          = ""; // The selected release
+  var $FAIdebianSection          = array(); // selected section
+  var $FAIinstallMethod          = "aptitude"; // hard coded
+  var $mirror                    = ""; // selected mirror
+
+  var $servers          = array();  // All available servers
+  var $releases         = array();  // All possible releases 
+  var $sections         = array();  // All section types
+
+  var $list             = NULL;
+
+  var $mirrors          = array();  // The combination of server/release/section
+  var $confDir          = "";
+  var $usedPackages     = array();
+  var $buffer           = NULL; 
+  var $strID            ="";
+  var $newDialogShown   =false;
+
+  var $FAIstate         = "";
+  var $view_logged      = FALSE;
+  var $base;
+
+  var $FAIinstallMethods  = array( "install", "ninstall", "remove", 
+      "dselect-upgrade", "taskinst", "taskrm",
+      "hold", "clean", "aptitude", "aptitude-r",
+      "pending", "dpkgc" );
+
+
+  function faiPackage (&$config, $dn= NULL)
+  {
+    /* Load Attributes */
+    plugin::plugin ($config, $dn);
+
+    /* If "dn==new" we try to create a new entry
+     * Else we must read all objects from ldap which belong to this entry.
+     * First read SubObjects from ldap ... and then the partition definitions for the SubObjects.
+     */
+    if($dn != "new"){
+      $this->dn =$dn;
+
+      /* Get FAIstate
+       */
+      if(isset($this->attrs['FAIstate'][0])){
+        $this->FAIstate = $this->attrs['FAIstate'][0];
+      }
+    }
+
+    if(isset($this->attrs['FAIpackage'])){
+      unset($this->attrs['FAIpackage']['count']);
+      foreach($this->attrs['FAIpackage'] as $pkg){
+        $this->usedPackages[$pkg] = $pkg;
+      }
+      ksort($this->usedPackages);
+    }else{
+      $this->usedPackages = array();
+    }  
+
+    if($dn != "new"){
+
+      /* Create one filter with all package names, 
+         instead of calling $ldap->search for every single package 
+       */
+      $PackageFilter = "";
+      foreach($this->usedPackages as $name){
+        $PackageFilter .= "(FAIpackage=".$name.")";
+      }
+      $PackageFilter = "(&(objectClass=FAIdebconfInfo)(|".$PackageFilter."))";
+
+      /* Search for configuration objects */ 
+      $ldap = $this->config->get_ldap_link();
+      $ldap->cd($this->dn);
+      $ldap->search($PackageFilter,array("FAIvariable","FAIvariableType","FAIvariableContent","FAIpackage","FAIdebianSection","FAIstate"));
+
+      /* Walk through configurations and append them to our list of ConfiguredPackages */
+      while($attr = $ldap->fetch()){
+
+        /* Skip objects, that are tagged as removed */
+        if(isset($object['FAIstate'][0])){
+          if(preg_match("/removed$/",$attr['FAIstate'][0])){
+            continue;
+          }
+        }
+
+        $tmp =array(); 
+        $tmp['Name']  = $attr['FAIvariable'][0];
+        $tmp['Type']  = $attr['FAIvariableType'][0];
+
+        if (isset($attr['FAIvariableContent'][0])){
+          if(!in_array($attr['FAIvariableType'],array("multiselect"))){
+            $tmp['Value'] = $attr['FAIvariableContent'][0];
+          }else{
+            $content = array();        
+            unset($attr['FAIvariableContent']['count']);
+            foreach($attr['FAIvariableContent'] as $attr){
+              $tmp['Value'][] = $attr;
+            }
+          }
+          $this->ConfiguredPackages[$attr['FAIpackage'][0]][$attr['FAIvariable'][0]]=$tmp;
+        }
+      }
+    }
+
+    if (isset($this->attrs['FAIdebianSection']['count'])){
+      unset($this->attrs['FAIdebianSection']['count']);
+    }
+    if((isset($this->attrs['FAIdebianSection']))&&(is_array($this->attrs['FAIdebianSection']))){
+      $this->FAIdebianSection = array();
+      foreach($this->attrs['FAIdebianSection'] as $sec){
+        $this->FAIdebianSection[$sec]=$sec;
+      }
+    }
+
+    if((isset($this->attrs['FAIdebianSection']))&&(is_string($this->attrs['FAIdebianSection']))){
+      $this->FAIdebianSection=array($this->attrs['FAIdebianSection']=>$this->attrs['FAIdebianSection']) ;
+    }
+    $this->confDir = CONFIG_DIR."/fai/";
+    $this->FAIpackage = array();
+
+
+    $methods = array();
+    foreach($this->FAIinstallMethods as $method){
+      $methods[$method] = $method;
+    }
+    $this->FAIinstallMethods = $methods;
+    /* Check if we exist already - no need to ask for revisions, etc. then */
+    if ($this->dn != "new"){
+      $this->newDialogShown= true;
+    }
+
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","fai/".get_class($this),$this->dn);
+    }
+
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+    $display= "";
+
+    $smarty->assign( "FAIinstallMethods", $this->FAIinstallMethods );
+
+    if(!$this->is_account){
+
+      /* Assemble release name */
+      $tmp= preg_replace('/,ou=fai,ou=configs,ou=systems,.*$/', '', $_SESSION['faifilter']['branch']);
+      $tmp= preg_replace('/ou=/', '', $tmp);
+      $rev= array_reverse(split(',', $tmp));
+      $this->FAIdebianRelease= "";
+      foreach ($rev as $part){
+        $this->FAIdebianRelease.= "/$part";
+      }
+      $this->FAIdebianRelease= preg_replace('#^/#', '', $this->FAIdebianRelease);
+
+      /* Assemble sections */
+      $repos= $this->getServerInfos();
+      if(isset($repos[$this->FAIdebianRelease])){
+        $this->FAIdebianSection= $repos[$this->FAIdebianRelease];
+        $this->FAIdebianSection= array_unique($this->FAIdebianSection);
+      }
+
+      /* Assign Repository settings*/ 
+      $this->is_account     = true;
+    }
+
+    /* Assign variables */
+    foreach($this->attributes as $attrs){
+      $smarty->assign($attrs,$this->$attrs);
+    }
+
+    /* Generate package list */
+    $this->list= $this->genPkgs();
+
+    /* + was pressed to open the package dialog */
+    if(isset($_POST['Addpkg']) && $this->acl_is_writeable("FAIpackage")){
+      $this->dialog = new faiPackageEntry($this->config, $this->dn,$this->list,$this->usedPackages);
+      $this->is_dialog =true;
+    }
+
+    /* Delte selected package */ 
+    if(isset($_POST['Delpkg']) && $this->acl_is_writeable("FAIpackage")){
+      if($this->FAIstate != "freeze"){
+        foreach($_POST['usedPackages'] as $del){
+          if(isset($this->usedPackages[$del])){
+            unset($this->usedPackages[$del]);
+          }
+        }
+      }
+    }
+
+    /* Abort package selection dialog */ 
+    if(isset($_POST['CancelSubObject'])){
+      $this->dialog = false;
+      $this->is_dialog=false;
+    }
+
+    /* attach new packages */
+    if(isset($_POST['SaveSubObject'])) {
+      if($this->FAIstate != "freeze"){
+        $this->dialog->save_object();
+        if(count($this->dialog->check())){
+          foreach($this->dialog->check() as $msgs){
+            print_red($msgs);
+          }
+        }else{
+          $use = $this->dialog->save();
+          $this->usedPackages = $use;
+          $this->dialog = false;
+          $this->is_dialog=false;
+          ksort($this->usedPackages);
+        }
+      }else{
+        $this->dialog = false;
+        $this->is_dialog=false;
+      }
+    }
+
+    /* Configuration dialog open*/
+    if((isset($_POST['Conpkg']))&&(isset($_POST['usedPackages']))&&(!empty($_POST['usedPackages'][0])) && $this->acl_is_writeable("FAIdebconfInfo")){
+      $path = CONFIG_DIR."/fai/".$this->FAIdebianRelease."/debconf.d";
+      $pkg_config = array();
+      $pkg = $_POST['usedPackages'][0];
+
+      if(isset($this->ConfiguredPackages[$pkg])){
+        $pkg_config = $this->ConfiguredPackages[$pkg];
+      }
+
+      $this->dialog = new faiPackageConfiguration($this->config, $this->dn,$pkg, $path, $pkg_config);
+      $this->is_dialog =true;
+    }
+
+    /* Configuration dialog open*/
+    if($this->FAIstate != "freeze" && $this->acl_is_writeable("FAIpackage")){
+      if((isset($_POST['Markpkg']))&&(isset($_POST['usedPackages']))&&(!empty($_POST['usedPackages']))){
+        foreach($_POST['usedPackages'] as $pkg){
+          if (isset($this->usedPackages[$pkg])){
+            unset($this->usedPackages[$pkg]);
+            if (preg_match('/^-/', $pkg)){
+              $pkg= preg_replace('/^-/', '', $pkg);
+            } else {
+              $pkg= preg_replace('/^/', '-', $pkg);
+            }
+            $this->usedPackages[$pkg]= $pkg;
+          }
+        }
+      }
+    }
+
+    /* Save Configuration */
+    if(isset($_POST['SaveObjectConfig'])){
+      if($this->FAIstate != "freeze"){
+        $this->ConfiguredPackages= array_merge($this->ConfiguredPackages,$this->dialog->save());
+      }
+      $this->dialog = false;
+      $this->is_dialog=false;
+    }
+
+    /* cancel configuration */     
+    if(isset($_POST['CancelObjectConfig'])){
+      $this->dialog = false;
+      $this->is_dialog=false;
+    }
+
+    /* Display dialog */ 
+    if($this->is_dialog){
+      return $this->dialog->execute();
+    }
+
+    /* Assign section to smarty */
+    $strsec = "";
+    foreach($this->FAIdebianSection as $sec){
+      $strsec .= $sec." ";
+    }
+
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translated){
+      $smarty->assign($name."ACL",$this->getacl($name,preg_match("/freeze/",$this->FAIstate)));
+    }
+
+    $smarty->assign("releases",$this->releases);
+    $smarty->assign("release" ,$this->FAIdebianRelease);
+    $smarty->assign("sections",$this->sections);
+    $smarty->assign("section" ,$strsec);
+    $smarty->assign("usedPackages",$this->printUsedPackages());
+    $display.= $smarty->fetch(get_template_path('faiPackage.tpl', TRUE));
+    return($display);
+  }
+
+  /* Delete me, and all my subtrees
+   */
+  function remove_from_parent()
+  {
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd ($this->dn);
+
+#    $use_dn = str_ireplace( get_release_dn($this->dn), $_SESSION['faifilter']['branch'], $this->dn);
+    $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $this->dn);
+    if($_SESSION['faifilter']['branch'] == "main"){
+      $use_dn = $this->dn;
+    }
+
+    prepare_to_save_FAI_object($use_dn,array(),true);
+
+    new log("remove","fai/".get_class($this),$use_dn,$this->attributes);
+
+    foreach($this->ConfiguredPackages as $pkgname => $attrs){
+      foreach($attrs as $name => $attr){
+        $pkgdn =  "FAIvariable=".$name.",".$this->dn;
+#        $use_dn = str_ireplace( get_release_dn($this->dn), $_SESSION['faifilter']['branch'], $pkgdn);
+        $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $pkgdn);
+        if($_SESSION['faifilter']['branch'] == "main"){
+          $use_dn = $obj['dn'];
+        }
+        prepare_to_save_FAI_object($use_dn,array(),true);
+      }
+    }
+    $this->handle_post_events("remove");
+  }
+
+
+  /* Save data to object 
+   */
+  function save_object()
+  {
+    if($this->FAIstate == "freeze") return;  
+    plugin::save_object();
+  }
+
+
+  /* Check supplied data */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    if(count($this->usedPackages)==0){
+      $message[]=_("Please select a least one Package.");
+    }
+
+    if((empty($this->FAIdebianRelease))||(empty($this->FAIdebianSection))){
+      $message[]=_("Please choose a valid combination for your repository setup.");
+    }
+
+    return ($message);
+  }
+
+  function printUsedPackages(){
+    $a_ret=array(); 
+    if(is_array($this->usedPackages)) {
+      foreach($this->usedPackages as $usedName){
+
+        $config = 0;
+
+        foreach($this->ConfiguredPackages as $name => $value){
+          if($name == $usedName){
+            $config ++;
+          }
+        }
+
+        $c_str ="";
+        if($config){
+          $c_str = " - "._("package is configured");
+        }
+
+        /* Adapt used name if we're marked for removal */
+        $dsc= "";
+        if (preg_match('/^-/', $usedName)){
+          $dsc= " - "._("Package marked for removal");
+          // Generally a bad idea here, because the toggel triggers on -, not on !
+          //$usedName= preg_replace('/^-/', '! ', $usedName);
+        }else{
+          $usedName2= $usedName;
+        }
+
+        if(isset($this->list[$usedName][1])){
+          $a_ret[$usedName] = $usedName2." [".$this->list[$usedName][1]."]".$c_str.$dsc;
+        }else{
+          $a_ret[$usedName] = $usedName2.$c_str.$dsc;
+        }
+      }
+    }
+    return($a_ret);
+  }
+
+  function genPkgs()
+  {
+    /* Generate a list off available packages for this mirror, section and release
+     */
+    /* Only read this file if it wasn't read before */
+    if($this->buffer === NULL){
+      $this->buffer=array();
+      $a_ret = array();
+      foreach($this->FAIdebianSection as $sec){
+        $strID= CONFIG_DIR."/fai/".$this->FAIdebianRelease."/".$sec;
+
+        if(!is_file($strID)){
+          print_red(sprintf(_("Package file '%s' does not exist."),$strID));
+          unset($this->buffer);
+          return(array());
+        }
+        $fp = fopen($strID,"r");
+
+        /* Parse every line and create an array */
+        while(!feof($fp)){
+          $str= fgets($fp,512);
+          $stra= split("\|",$str);
+          if(count($stra)==4){
+            $a_ret[$stra[0]] = $stra;
+          }
+        }
+        fclose($fp);
+        /* Save our Data, to avoid reading it again */
+      }
+      $this->buffer = $a_ret;
+      ksort($a_ret);
+      return($a_ret);
+    }else{
+      return $this->buffer;
+    }
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+
+    /* Assemble release name */
+    if($this->FAIdebianRelease == "ClearFromCopyPaste"){
+      $tmp= preg_replace('/,ou=fai,ou=configs,ou=systems,.*$/', '', $_SESSION['faifilter']['branch']);
+      $tmp= preg_replace('/ou=/', '', $tmp);
+      $rev= array_reverse(split(',', $tmp));
+      $this->FAIdebianRelease= "";
+      foreach ($rev as $part){
+        $this->FAIdebianRelease.= "/$part";
+      }
+      $this->FAIdebianRelease= preg_replace('#^/#', '', $this->FAIdebianRelease);
+    }
+
+    plugin::save();
+
+    $ldap = $this->config->get_ldap_link();
+
+    $this->attrs['FAIpackage'] = array();
+    foreach($this->usedPackages as $pkg => $obj){
+      $this->attrs['FAIpackage'][] = $pkg;
+    } 
+
+    $this->attrs['FAIdebianSection'] = array();
+    foreach($this->FAIdebianSection as $sec){
+      $this->attrs['FAIdebianSection'][] = $sec;
+    }
+
+    prepare_to_save_FAI_object($this->dn,$this->attrs);
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of FAI/package list with dn '%s' failed."),$this->dn));
+    
+    if($this->initially_was_account){
+      new log("modify","fai/".get_class($this),$this->dn,$this->attributes);
+    }else{
+      new log("create","fai/".get_class($this),$this->dn,$this->attributes);
+    }
+
+    /* Do object tagging */
+    $this->handle_object_tagging();
+    $ldap->cd($this->dn);
+
+    /* Save Package configurations */
+    foreach($this->ConfiguredPackages as $pkgname => $attrs){
+      foreach($attrs as $name => $attr){
+      
+        $pkgattrs = array();
+
+        foreach($attr as $n=>$v){
+          if(empty($v)) $v = array();
+        }
+
+        /* Set attributes */
+        $pkgattrs['objectClass'][]        = "FAIdebconfInfo";
+
+        $pkgattrs['FAIpackage']           = $pkgname;
+        $pkgattrs['FAIvariable']          = $name;
+        $pkgattrs['FAIvariableType']      = $attr['Type'];
+        $pkgattrs['FAIvariableContent']   = $attr['Value'];
+        $pkgdn =  "FAIvariable=".$name.",".$this->dn;
+
+        /* cehck if object already exists */
+        $ldap->cat($pkgdn,array("objectClass"));
+
+        /* Workaround for missing "gosaAdministrativeUnitTag" */
+        $attrs = $ldap->fetch();
+        if((isset($attrs['objectClass'])) && (in_array_ics("gosaAdministrativeUnitTag",$attrs['objectClass']))){
+          $pkgattrs['objectClass'][] = "gosaAdministrativeUnitTag";
+        }
+
+        if(in_array($pkgattrs['FAIvariableType'],array("boolean","multiselect","password","select","string","text"))){
+          prepare_to_save_FAI_object($pkgdn,$pkgattrs);
+        }
+  
+        /* Handle tagging */
+        $this->handle_object_tagging($pkgdn, $this->gosaUnitTag);
+      }
+    }
+  }
+
+  /* Return plugin informations for acl handling */ 
+  static function plInfo()
+  {
+    return (array( 
+          "plShortName" => _("Package"),
+          "plDescription" => _("FAI Package list"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 28,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("fai"),
+          "plProvidedAcls" => array(
+            "cn"                => _("Name"),
+            "description"       => _("Description"),
+            "FAIpackage"        => _("Packages"),
+            "FAIdebianSection"  => _("Section")."&nbsp;("._("Readonly").")",
+            "FAIinstallMethod"  => _("Install Method"),
+            "FAIdebconfInfo"    => _("Package configuration"),
+            "FAIdebianRelease"  => _("Release")."&nbsp;("._("Readonly").")")
+          ));
+  }
+
+
+
+
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);
+
+    if(isset($source['FAIstate'][0])){
+      $this->FAIstate = $source['FAIstate'][0];
+    }
+
+    $this->FAIdebianRelease = "ClearFromCopyPaste";
+
+    if(isset($source['FAIpackage'])){
+      unset($source['FAIpackage']['count']);
+      foreach($source['FAIpackage'] as $pkg){
+        $this->usedPackages[$pkg] = $pkg;
+      }
+      ksort($this->usedPackages);
+    }else{
+      $this->usedPackages = array();
+    }
+
+    if((isset($source['FAIdebianSection']))&&(is_array($source['FAIdebianSection']))){
+      $this->FAIdebianSection = array();
+      for($i = 0 ; $i < $source['FAIdebianSection']['count'] ; $i ++){
+        $this->FAIdebianSection[$source['FAIdebianSection'][$i]]=$source['FAIdebianSection'][$i];
+      }
+    }
+
+    /* Create one filter with all package names, 
+       instead of calling $ldap->search for every single package 
+     */
+    $PackageFilter = "";
+    foreach($this->usedPackages as $name){
+      $PackageFilter .= "(FAIpackage=".$name.")";
+    }
+    $PackageFilter = "(&(objectClass=FAIdebconfInfo)(|".$PackageFilter."))";
+
+    /* Search for configuration objects */ 
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($source['dn']);
+    $ldap->search($PackageFilter,array("FAIvariable","FAIvariableType","FAIvariableContent","FAIpackage","FAIdebianSection","FAIstate"));
+
+    /* Walk through configurations and append them to our list of ConfiguredPackages */
+    while($attr = $ldap->fetch()){
+
+      /* Skip objects, that are tagged as removed */
+      if(isset($object['FAIstate'][0])){
+        if(preg_match("/removed$/",$attr['FAIstate'][0])){
+          continue;
+        }
+      }
+
+      $tmp =array(); 
+      $tmp['Name']  = $attr['FAIvariable'][0];
+      $tmp['Type']  = $attr['FAIvariableType'][0];
+
+      if (isset($attr['FAIvariableContent'][0])){
+        if(!in_array($attr['FAIvariableType'],array("multiselect"))){
+          $tmp['Value'] = $attr['FAIvariableContent'][0];
+        }else{
+          $content = array();        
+          unset($attr['FAIvariableContent']['count']);
+          foreach($attr['FAIvariableContent'] as $attr){
+            $tmp['Value'][] = $attr;
+          }
+        }
+        $this->ConfiguredPackages[$attr['FAIpackage'][0]][$attr['FAIvariable'][0]]=$tmp;
+      }
+    }
+  }
+
+
+  function getServerInfos()
+  {
+    $ret = array();
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(objectClass=FAIrepositoryServer)",array("*"));
+    while($attrs = $ldap->fetch()){
+      if(isset($attrs['FAIrepository'])){
+        for($i =0 ; $i < $attrs['FAIrepository']['count']; $i++){
+          $obj = $attrs['FAIrepository'][$i];
+          $tmp = split("\|",$obj);
+          if(count($tmp)==4){
+            foreach(split(",",$tmp[3]) as $sec){
+              if(!empty($sec)){
+                $ret[$tmp[2]][] =  $sec;
+              }
+            }
+          }
+        }
+      }
+    }
+    return($ret);
+  }
+
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/fai/class_faiPackageConfiguration.inc b/gosa-core/plugins/admin/fai/class_faiPackageConfiguration.inc
new file mode 100644 (file)
index 0000000..18f3e2b
--- /dev/null
@@ -0,0 +1,84 @@
+<?php
+
+class faiPackageConfiguration extends plugin
+{
+  /* CLI vars */
+  var $cli_summary        = "Manage server basic objects";
+  var $cli_description    = "Some longer text\nfor help";
+  var $cli_parameters     = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* attribute list for save action */
+  var $ignore_account = TRUE;
+  var $attributes     = array();
+  var $objectclasses  = array();
+
+  var $Debconf_handle = NULL;
+  var $pkg_config ;
+  var $obj;
+
+  function faiPackageConfiguration (&$config, $dn= NULL,$obj,$path,$pkg_config)
+  {
+    plugin::plugin ($config, $dn);
+    $this->obj = $obj;
+    $this->Debconf_handle = new debconf();
+    $this->Debconf_handle->set_template_directory($path);
+    $this->Debconf_handle->set_package($this->obj);
+    $this->Debconf_handle->set_language(preg_replace('/_.*$/', '', get_browser_language()));
+
+    if( $this->Debconf_handle->load() ) {
+      $this->pkg_config = $pkg_config;
+
+      foreach($this->pkg_config as $var){
+        $this->Debconf_handle->SetDefault($var['Name'],$var['Value']);
+      }
+    }
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* Fill templating stuff */
+    $smarty     = get_smarty();
+    $display = "";
+    $smarty->assign("headline", sprintf(_("Debconf information for package '%s'"), $this->obj));
+
+    $this->Debconf_handle->PostCheck();
+
+    $smarty->assign("Config",$this->Debconf_handle->get_dialog());
+
+    $display.= $smarty->fetch(get_template_path('faiPackageConfiguration.tpl', TRUE));
+    return($display);
+  }
+
+  /* Save data to object */
+  function save_object()
+  {
+  }
+
+  /* Check supplied data */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    return ($message);
+  }
+
+  function save()
+  {
+    $this->Debconf_handle->PostCheck();
+    $pkgs = $this->Debconf_handle->template;
+
+    $tmp = array();
+    foreach($pkgs as $pkg){
+      $tmp[$this->obj][$pkg['Name']]['Value']= $pkg['Default'];
+      $tmp[$this->obj][$pkg['Name']]['Name'] = $pkg['Name'];
+      $tmp[$this->obj][$pkg['Name']]['Type'] = $pkg['Type'];
+    }
+    return($tmp);
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/fai/class_faiPackageEntry.inc b/gosa-core/plugins/admin/fai/class_faiPackageEntry.inc
new file mode 100644 (file)
index 0000000..1b22ba8
--- /dev/null
@@ -0,0 +1,200 @@
+<?php
+
+class faiPackageEntry extends plugin
+{
+  /* CLI vars */
+  var $cli_summary= "Manage server basic objects";
+  var $cli_description= "Some longer text\nfor help";
+  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* attribute list for save action */
+  var $ignore_account= TRUE;
+  var $attributes   = array();
+  var $objectclasses= array();
+  var $pkgs        = array();  
+
+  var $buffer       = array();
+  var $categories   = array();
+  var $searchStrPKG = "";
+  var $selected     = array();
+
+  /* Array with available class names */
+  var $FAIAllclasses        = array();
+
+  function faiPackageEntry (&$config, $dn= NULL,$pkgs,$selected=array())
+  {
+    plugin::plugin ($config, $dn);
+    
+    $this->pkgs=$pkgs;
+
+    if(isset($_SESSION['searchStrPKG'])){
+      $this->searchStrPKG=$_SESSION['searchStrPKG'];
+    }
+    $this->selected=$selected;
+
+    $this->searchStrPKG= _("Please enter your search string here");
+  }
+
+  function execute()
+  {
+       /* Call parent execute */
+       plugin::execute();
+
+    /* Fill templating stuff */
+    $smarty     = get_smarty();
+    $display = "";
+
+    $divlist = new divlist("PackageEntry");
+    $divlist->SetPluginMode();
+    $divlist->SetSummary(_("This list displays all assigned package names for this repository settings."));
+    $divlist->SetEntriesPerPage(0);
+    $divlist->SetHeight("650px;");
+    $divlist->SetHeader(array(array("string" => "&nbsp;", "attach" => "style='text-align:center;width:20px;'"),
+                              array("string" => "Name", "attach" => "style='width:180px;'"),
+                              array("string" => "Version", "attach" ),
+                              array("string" => "Description", "attach" => "style='width:240px;border-right:0px;text-align:left;'")));
+
+    if(isset($_GET['search'])){
+      $this->searchStrPKG= $_GET['search']."*";
+    }
+    
+    $pkgs= $this->pkgs;
+
+    unset($this->categories);
+    foreach($pkgs as $name => $entry){
+      $cat = $entry[2];
+      if(!empty($cat)){
+        if(!isset($this->categories[$cat])){  
+          $this->categories[$cat] = true;
+        }
+        if(isset($_POST['chkchange'])){
+          $this->searchStrPKG = $_POST['searchStrPKG'];
+          if(isset($_POST['CAT'.$cat])){
+            $this->categories[$cat]=true;
+          }else{
+            $this->categories[$cat]=false;
+          }
+        }
+      } 
+    }
+
+    $this->searchStrPKG = preg_replace("/^\+/","",$this->searchStrPKG);
+    if(empty($this->searchStrPKG)){
+      $this->searchStrPKG = "*";
+    }
+
+    @ksort($this->categories);
+
+$CHKS = "<input type='hidden' value='chkchange' name='chkchange'><table summary=''><tr>";
+    $i = 0;
+    if(is_array($this->categories)) 
+    foreach($this->categories as $cat => $selected){
+      if($i == 3){
+        $CHKS .="</tr><tr>";
+        $i = 0;
+      }
+      $i ++ ;
+      if($selected){
+        $CHKS .="<td><input type='checkbox' value='1' name='CAT".$cat."' checked onclick='document.mainform.submit()'>&nbsp;".$cat."&nbsp;</td>";
+      }else{
+        $CHKS .="<td><input type='checkbox' value='1' name='CAT".$cat."' onclick='document.mainform.submit()'>&nbsp;".$cat."&nbsp;</td>";
+      }
+    }
+    $CHKS .= "</tr></table>";
+
+
+    foreach($_POST as $name => $value){
+      if(preg_match("/^wasonpage_/i",$name)){
+        $name = preg_replace("/^wasonpage_/","",$name);
+        $n =base64_decode($name);
+
+        if(isset($_POST['use_'.$name])){
+          $this->selected[$n] = $n; 
+        }else{
+          if(isset($this->selected[$n])){
+            unset($this->selected[$n]);
+          }
+        }
+
+      }
+    }
+
+    /* Prepare search filter */
+    $search_str = preg_replace("/\\\\\*/",".*",normalizePreg($this->searchStrPKG));
+
+    $cnt = 0; 
+    foreach($pkgs as $pkg){
+      if($cnt > 200) {
+        print_red(sprintf(_("Your specified search string '%s' returned too many results. Only the first 200 entries are shown, to keep the memory usage low."),$this->searchStrPKG));
+        break;
+      }
+      if((preg_match("/^".$search_str."/i",$pkg[0]))||
+         (preg_match("/^".$search_str."/i",$pkg[3]))){
+        if($this->categories[$pkg[2]]){
+          if(in_array($pkg[0],$this->selected)){
+            $check = " checked ";
+          }else{
+            $check = "";
+          }
+          $cnt ++ ;
+          $chkbox = "<input type='checkbox' value='1' name='use_".base64_encode($pkg[0])."' ".$check.">
+                   <input type='hidden' value='1' name='wasonpage_".base64_encode($pkg[0])."'>";
+          $divlist->AddEntry(array(array("string"=>$chkbox, "attach" => "style='text-align:center;width:20px;'"),
+                               array("string"=>$pkg[0], "attach" => "style='width:180px;'"),
+                               array("string"=>htmlentities($pkg[1])),
+                               array("string"=>htmlentities($pkg[3]), "attach" => "style='width:221px;border-right:0px;text-align:left;'")));
+        }
+      }
+    }
+
+    $_SESSION['searchStrPKG']       = $this->searchStrPKG;
+    $smarty->assign("CHKS"          , $CHKS);
+    $smarty->assign("searchStrPKG"  , $this->searchStrPKG);
+    $smarty->assign("faihead"       , "");
+    $smarty->assign("failist"       , $divlist->DrawList());
+    $smarty->assign("infoimage"     , get_template_path('images/info.png'));
+    $smarty->assign("launchimage"   , get_template_path('images/launch.png'));
+    $smarty->assign("alphabet"      , generate_alphabet());
+    $smarty->assign("apply"         , apply_filter(TRUE));
+    $smarty->assign("search_image"  , get_template_path('images/search.png'));
+
+    $display.= $smarty->fetch(get_template_path('faiPackageEntry.tpl', TRUE));
+    return($display);
+  }
+
+  /* Save data to object */
+  function save_object()
+  {
+    foreach($_POST as $name => $value){
+      if(preg_match("/^wasonpage_/i",$name)){
+        $name = preg_replace("/^wasonpage_/","",$name);
+        $n =base64_decode($name);
+        if(isset($_POST['use_'.$name])){
+          $this->selected[$n] = $n;
+        }else{
+          if(isset($this->selected[$n])){
+            unset($this->selected[$n]);
+          }
+        }
+
+      }
+    }
+
+  }
+
+  /* Check supplied data */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+        
+    return ($message);
+  }
+
+  function save()
+  {
+    return($this->selected);
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/fai/class_faiPartitionTable.inc b/gosa-core/plugins/admin/fai/class_faiPartitionTable.inc
new file mode 100644 (file)
index 0000000..216d6c3
--- /dev/null
@@ -0,0 +1,621 @@
+<?php
+
+class faiPartitionTable 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","description");
+  var $objectclasses    = array("top","FAIclass","FAIpartitionTable");
+
+  /* Specific attributes */
+  var $cn               = "";       // The class name for this object
+  var $description      = "";       // The description for this set of partitions
+  var $disks            = array();  // All defined Disks 
+  var $is_dialog        = false;    // specifies which buttons will be shown to save or abort
+
+  var $FAIstate         = "";
+  var $ui;
+
+  var $view_logged      = FALSE;
+
+  function faiPartitionTable (&$config, $dn= NULL)
+  {
+    /* Load Attributes */
+    plugin::plugin ($config, $dn);
+
+    $this->acl ="#all#";
+
+    $this->ui = get_userinfo();    
+
+    /* If "dn==new" we try to create a new entry
+     * Else we must read all objects from ldap which belong to this entry.
+     * First read disks from ldap ... and then the partition definitions for the disks.
+     */
+    if($dn != "new"){
+      $this->dn =$dn;
+
+      /* Get FAIstate
+       */
+      if(isset($this->attrs['FAIstate'][0])){
+        $this->FAIstate = $this->attrs['FAIstate'][0];
+      }
+
+      /* Read all disks from ldap taht are defined fot this partition table 
+       */
+      $ldap = $this->config->get_ldap_link();
+      $ldap->cd ($this->dn);
+      $ldap->search("(&(objectClass=FAIclass)(objectClass=FAIpartitionDisk))",array("*"));
+      while($object = $ldap->fetch()){
+
+        /* Skip objects, that are tagged as removed */
+        if(isset($object['FAIstate'][0])){
+          if(preg_match("/removed$/",$object['FAIstate'][0])){
+            continue;
+          }
+        }
+
+        $this->disks[$object['cn'][0]]['status']      = "edited";
+        $this->disks[$object['cn'][0]]['dn']          = $object['dn'];
+        $this->disks[$object['cn'][0]]['cn']          = $object['cn'][0];
+        if(isset($object['description'][0])){
+          $this->disks[$object['cn'][0]]['description'] = $object['description'][0];
+        }else{
+          $this->disks[$object['cn'][0]]['description'] = "";
+        }
+        $this->disks[$object['cn'][0]]['partitions']   = array();
+      }
+  
+      /* read all partitions for each disk 
+       */
+      foreach($this->disks as $name => $disk){
+        $ldap->cd ($disk['dn']);
+        $ldap->search("(&(objectClass=FAIclass)(objectClass=FAIpartitionEntry))",array("*"));
+        while($partition = $ldap->fetch()){
+
+          /* Skip objects, that are tagged as removed */
+          if(isset($partition['FAIstate'][0])){
+            if(preg_match("/removed$/",$partition['FAIstate'][0])){
+              continue;
+            }
+          }
+
+          /* remove count ... from ldap result 
+           */
+          foreach($partition as $key=>$val){
+            if((is_numeric($key))||($key=="count")||($key=="dn")){
+              unset($partition[$key]);
+            }else{
+              $partition[$key] = $val[0];
+            }
+          }
+
+          /* Append fetched partitions
+           */
+          $partition['status']="edited";
+          $this->disks[$name]['partitions'][$partition['FAIpartitionNr']] = $partition; 
+        }  
+      }
+    }
+    ksort($this->disks);
+  }
+
+
+  function acl_base_for_current_object($dn)
+  {
+    if($dn == "new"){
+      if($this->dn == "new"){
+        $dn= $_SESSION['CurrentMainBase'];
+      }else{
+        $dn = $this->dn;
+      }
+    }
+    return($dn);
+  }
+
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","fai/".get_class($this),$this->dn);
+    }
+
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+    $display= "";
+    /* Add Disk to this Partitionset
+     * This code adds a new HDD to the disks 
+     * A new Dialog will be opened 
+     */
+    if(isset($_POST['AddDisk'])){
+      $usedDiskNames =array();
+      foreach($this->disks as $key=>$disk){
+        $usedDiskNames[]= $key;
+      }
+      $this->dialog = new faiPartitionTableEntry($this->config,$this->dn,$usedDiskNames); 
+      $this->dialog->set_acl_base($this->acl_base_for_current_object($this->dn));
+      $this->dialog->set_acl_category("fai");
+      $this->dialog->FAIstate = $this->FAIstate;
+      $this->is_dialog = true;
+    }
+
+    /* Edit disk.
+     * Open dialog which allows us to edit the selected entry 
+     */    
+
+    if($this->dn != "new"){
+      $_SESSION['objectinfo']= $this->dn;
+    }
+
+    if((isset($_POST['EditDisk']))&&(isset($_POST['disks']))){
+      $usedDiskNames =array();
+      $Udisk = $_POST['disks'][0];
+      if(isset($this->disks[$Udisk])){
+
+        foreach($this->disks  as $key=>$disk){
+          if($key != $Udisk){
+            $usedDiskNames[]= $key;
+          }
+        }
+
+        /* Set object info string, which will be displayed in plugin info line */ 
+        if(isset($this->disks[$Udisk]['dn'])){
+          $_SESSION['objectinfo'] = $this->disks[$Udisk]['dn'];
+          $dn = $this->disks[$Udisk]['dn'];
+        }else{
+          $_SESSION['objectinfo'] = "";
+          $dn = "new";
+        }
+
+        $this->dialog = new faiPartitionTableEntry($this->config,$this->dn,$usedDiskNames,$this->disks[$Udisk]); 
+        $this->dialog->set_acl_base($this->acl_base_for_current_object($dn));
+        $this->dialog->set_acl_category("fai");
+        $this->dialog->FAIstate = $this->FAIstate;
+
+        $this->is_dialog = true;
+      }
+    }
+
+    /* Edit aborted, close dialog, without saving anything
+     */
+    if(isset($_POST['CancelDisk'])){
+      unset($this->dialog);
+      $this->dialog = FALSE;
+      $this->is_dialog=false;
+    }
+
+    /* Dialog saved
+     * Save given data from Dialog, if no error is occurred
+     */
+    if(isset($_POST['SaveDisk'])){
+
+      if($this->FAIstate != "freeze"){
+        $this->dialog->save_object();
+        if(count($this->dialog->check())){
+          foreach($this->dialog->check() as $msg){
+            print_red($msg);
+          }
+        }else{
+          $disk = $this->dialog->save();
+          if(isset($disk['rename'])){
+            if($this->disks[$disk['rename']['from']]['status']=="edited"){
+              $this->disks[$disk['rename']['from']]['status']="delete";
+            }else{
+              unset($this->disks[$disk['rename']['from']]);
+            }
+
+            foreach($disk['partitions'] as $key => $val){
+              if($disk['partitions'][$key]['status']!="delete"){
+                $disk['partitions'][$key]['status']= "new";
+              }
+            }
+
+            $disk['status']="new";
+            $disk['cn']= $disk['rename']['to'];
+          }
+
+          $this->disks[$disk['cn']]=$disk; 
+          unset($this->dialog);
+          $this->dialog = FALSE;
+          $this->is_dialog=false;
+          ksort($this->disks);
+        }
+      }else{
+        $this->dialog = FALSE;
+        $this->is_dialog=false;
+      }
+    }
+
+    /* Delete selected disk drive from list
+     * Assign delete status for all its partitions      
+     */
+    if((isset($_POST['DelDisk']))&&(!empty($_POST['disks']))){
+      if($this->FAIstate != "freeze"){
+        foreach($_POST['disks'] as $disk) {
+
+          if(isset($this->disks[$disk])){
+            if($this->disks[$disk]['status']=="edited"){
+              $this->disks[$disk."-delete"]=$this->disks[$disk];
+              unset($this->disks[$disk]);
+              $disk = $disk."-delete";        
+              $this->disks[$disk]['status']="delete";
+              foreach($this->disks[$disk]['partitions'] as $name => $value ){
+                if($value['status']=="edited"){
+                  $this->disks[$disk]['partitions'][$name]['status']="delete"; 
+                }else{
+                  unset($this->disks[$disk]['partitions'][$name]);
+                }
+              }
+            }else{
+              unset($this->disks[$disk]);
+            }
+          }
+        }
+      }
+    }
+
+    /* Display dialog if one is defined
+     */
+    if(is_object($this->dialog)){
+      $this->dialog->save_object();
+      return($this->dialog->execute());
+    }
+
+    /* Assign all attributes to smarty engine
+     */
+    foreach($this->attributes as $attrs){
+      $smarty->assign($attrs,$this->$attrs);
+      if($this->$attrs){
+        $smarty->assign($attrs."CHK"," ");
+      }else{
+        $smarty->assign($attrs."CHK"," disabled ");
+      }
+    }
+   
+    $dn = $this->acl_base_for_current_object($this->dn);
+    $smarty->assign("sub_object_is_addable",
+        preg_match("/c/",$this->ui->get_permissions($dn,"fai/faiPartitionTableEntry")) &&
+        !preg_match("/freeze/",$this->FAIstate));
+
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translated){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+    $disks = $this->getDisks();
+    $smarty->assign("disks"   ,$disks);
+    $display.= $smarty->fetch(get_template_path('faiPartitionTable.tpl', TRUE));
+    return($display);
+  }
+
+  function getDisks(){
+    /* Return all available disks for this partition table
+     * Return in listBox friendly array
+     */
+    $a_return = array();
+    foreach($this->disks as $key => $disk){
+
+      $dn = "new";
+      if(isset($obj['dn'])){
+        $dn = $obj['dn'];
+      }
+      $dn = $this->acl_base_for_current_object($dn);
+      $acl = $this->ui->get_permissions($dn,"fai/faiPartitionTableEntry");
+      if(preg_match("/(r|w)/",$acl)) {
+
+        if($disk['status'] != "delete"){
+          $cnt=0;
+          foreach($disk['partitions'] as $val){
+            if($val['status']!="delete"){
+              $cnt ++;
+            }
+          }
+          if(!empty($disk['description'])){
+            if($cnt == 1){
+              $a_return[$key]=  $disk['cn']." [".$disk['description']."], ".sprintf(_("%s partition"), $cnt);
+            }else{
+              $a_return[$key]=  $disk['cn']." [".$disk['description']."], ".sprintf(_("%s partition(s)"), $cnt);
+            }
+          }else{
+            if($cnt == 1){
+              $a_return[$key]=  $disk['cn'].", ".sprintf(_("%s partition"), $cnt);
+            }else{
+              $a_return[$key]=  $disk['cn'].", ".sprintf(_("%s partition(s)"), $cnt);
+            }
+          }
+        }
+      }
+    }
+    return($a_return);
+  }
+
+
+  /* Delete me, and all my subtrees
+   */
+  function remove_from_parent()
+  {
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd ($this->dn);
+
+#    $use_dn = str_ireplace( get_release_dn($this->dn), $_SESSION['faifilter']['branch'], $this->dn);
+    $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $this->dn);
+    if($_SESSION['faifilter']['branch'] == "main"){
+      $use_dn = $this->dn;
+    }
+
+    prepare_to_save_FAI_object($use_dn,array(),true);
+
+    new log("remove","fai/".get_class($this),$use_dn,$this->attributes);   
+    foreach($this->disks as $disk){
+
+      $disk_dn = "cn=".$disk['cn'].",".$this->dn;
+#      $use_dn = str_ireplace( get_release_dn($this->dn), $_SESSION['faifilter']['branch'], $disk_dn);
+      $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $disk_dn);
+      if($_SESSION['faifilter']['branch'] == "main"){
+        $use_dn = $disk_dn;
+      }
+      prepare_to_save_FAI_object($use_dn,array(),true);
+
+      foreach($disk['partitions'] as $key => $partition){    
+     
+        $partition_dn= "FAIpartitionNr=".$partition['FAIpartitionNr'].",".$disk_dn;      
+#        $use_dn = str_ireplace( get_release_dn($this->dn), $_SESSION['faifilter']['branch'], $partition_dn);
+        $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $partition_dn);
+        if($_SESSION['faifilter']['branch'] == "main"){
+          $use_dn = $disk_dn;
+        }
+        prepare_to_save_FAI_object($use_dn,array(),true);
+      }
+    }
+  }
+
+
+  /* Save data to object 
+   */
+  function save_object()
+  {
+    if($this->FAIstate == "freeze") return;
+    plugin::save_object();
+    foreach($this->attributes as $attrs){
+      if(isset($_POST[$attrs])){
+        $this->$attrs = $_POST[$attrs];
+      }
+    }
+  }
+
+
+  /* Check supplied data */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    return ($message);
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+
+    plugin::save();
+    /* Save current settings.
+     * 1 : We must save the partition table, with its description and cn 
+     * 2 : Append Disk with cn and  description.
+     * 3 : Save partitions for each disk
+     */  
+
+    $ldap = $this->config->get_ldap_link();
+
+    prepare_to_save_FAI_object($this->dn,$this->attrs);
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of FAI/partition table with dn '%s' failed."),$this->dn));
+
+    if($this->initially_was_account){
+      new log("modify","fai/".get_class($this),$this->dn,$this->attributes);
+    }else{
+      new log("create","fai/".get_class($this),$this->dn,$this->attributes);
+    }
+    /* Do object tagging */
+    $this->handle_object_tagging();
+  
+    /* Sort entries, because we must delete entries with status="delete" first */
+    $order = array();
+    foreach($this->disks as $key => $disk){
+      if($disk['status'] == "delete"){
+        $order[$key] = $disk;
+      }
+    }
+    foreach($this->disks as $key => $disk){
+      if($disk['status'] != "delete"){
+        $order[$key] = $disk;
+      }
+    }
+
+    /* Append all disks to ldap */
+    foreach($order as $cn=>$disk){
+      $disk_dn                    = "cn=".$disk['cn'].",".$this->dn;
+      $disk_attrs['cn']           =  $disk['cn'];
+      $disk_attrs['description']  =  $disk['description']; 
+      $disk_attrs['objectClass']  =  array("top","FAIclass","FAIpartitionDisk");
+
+      if($disk['status']=="new"){
+        $ldap->cat($disk_dn,array("objectClass"));
+        if($ldap->count()){
+          $disk['status']="edited";
+        }
+      }
+
+      /* Fix problem with missing objectClass "gosaAdministrativeUnitTag" for disks */
+      $ldap->cat($disk_dn,array("objectClass"));
+      $attrs = $ldap->fetch();
+      if(isset($attrs['objectClass']) && in_array_ics("gosaAdministrativeUnitTag",$attrs['objectClass'])){
+        $disk_attrs['objectClass'][] = "gosaAdministrativeUnitTag";
+      }
+
+      if($disk['status'] == "delete"){
+        prepare_to_save_FAI_object($disk_dn,array(),true);
+        $this->handle_post_events("remove");
+      }elseif($disk['status'] == "edited"){
+        prepare_to_save_FAI_object($disk_dn,$disk_attrs);
+        $this->handle_post_events("modify");
+      }elseif($disk['status']=="new"){
+        prepare_to_save_FAI_object($disk_dn,$disk_attrs);
+        $this->handle_post_events("add");
+      }
+
+      $this->handle_object_tagging($disk_dn, $this->gosaUnitTag);
+
+      if($disk['status']!="delete")
+      /* Add all partitions */
+      foreach($disk['partitions'] as $key => $partition){
+        $partition_attrs = array();
+
+        foreach($partition as $key => $value){
+          if(!empty($value)){
+            $partition_attrs[$key]=$value;        
+          }else{
+            unset($partition_attrs[$key]);        
+          }
+        }
+
+        $partition_dn= "FAIpartitionNr=".$partition_attrs['FAIpartitionNr'].",".$disk_dn;      
+        $partition_attrs['objectClass']= array("top","FAIclass","FAIpartitionEntry");
+        $partition_attrs['cn']= $partition_attrs['FAIpartitionNr'];
+        
+        unset($partition_attrs['status']);
+        unset($partition_attrs['old_cn']);
+
+        if($partition['status']=="new"){
+          $ldap->cat($partition_dn,array("objectClass"));
+          if($ldap->count()){
+            $partition['status']="edited";
+          }
+        }
+
+        if((!isset($partition['FAImountPoint']))||(empty($partition['FAImountPoint']))){
+          $partition_attrs['FAImountPoint']="swap";
+        }
+
+        /* Fix problem with missing objectClass "gosaAdministrativeUnitTag" for partitions */
+        $ldap->cat($partition_dn,array("objectClass"));
+        $attrs = $ldap->fetch();
+        if(isset($attrs['objectClass']) && in_array_ics("gosaAdministrativeUnitTag",$attrs['objectClass'])){
+          $partition_attrs['objectClass'][] = "gosaAdministrativeUnitTag";
+        }
+
+        if($partition['status'] == "delete"){
+          prepare_to_save_FAI_object($partition_dn,array(),true);
+          $this->handle_post_events("remove");
+        }elseif($partition['status'] == "edited"){
+          prepare_to_save_FAI_object($partition_dn,$partition_attrs);
+          $this->handle_post_events("modify");
+        }elseif($partition['status']=="new"){
+          prepare_to_save_FAI_object($partition_dn,$partition_attrs);
+          $this->handle_post_events("add");
+        }
+
+        $this->handle_object_tagging($partition_dn, $this->gosaUnitTag);
+      }
+    }
+    $this->handle_post_events("add");
+  }
+
+
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);
+    /* Get FAIstate
+     */
+    if(isset($source['FAIstate'][0])){
+      $this->FAIstate = $source['FAIstate'][0];
+    }
+
+    /* Read all disks from ldap taht are defined fot this partition table 
+     */
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd ($source['dn']);
+    $ldap->search("(&(objectClass=FAIclass)(objectClass=FAIpartitionDisk))",array("*"));
+    while($object = $ldap->fetch()){
+
+      /* Skip objects, that are tagged as removed */
+      if(isset($object['FAIstate'][0])){
+        if(preg_match("/removed$/",$object['FAIstate'][0])){
+          continue;
+        }
+      }
+
+      $this->disks[$object['cn'][0]]['status']      = "edited";
+      $this->disks[$object['cn'][0]]['dn']          = $object['dn'];
+      $this->disks[$object['cn'][0]]['cn']          = $object['cn'][0];
+      if(isset($object['description'][0])){
+        $this->disks[$object['cn'][0]]['description'] = $object['description'][0];
+      }else{
+        $this->disks[$object['cn'][0]]['description'] = "";
+      }
+      $this->disks[$object['cn'][0]]['partitions']   = array();
+    }
+
+    /* read all partitions for each disk 
+     */
+    foreach($this->disks as $name => $disk){
+      $ldap->cd ($disk['dn']);
+      $ldap->search("(&(objectClass=FAIclass)(objectClass=FAIpartitionEntry))",array("*"));
+      while($partition = $ldap->fetch()){
+
+        /* Skip objects, that are tagged as removed */
+        if(isset($partition['FAIstate'][0])){
+          if(preg_match("/removed$/",$partition['FAIstate'][0])){
+            continue;
+          }
+        }
+
+        /* remove count ... from ldap result 
+         */
+        foreach($partition as $key=>$val){
+          if((is_numeric($key))||($key=="count")||($key=="dn")){
+            unset($partition[$key]);
+          }else{
+            $partition[$key] = $val[0];
+          }
+        }
+
+        /* Append fetched partitions
+         */
+        $partition['status']="edited";
+        $this->disks[$name]['partitions'][$partition['FAIpartitionNr']] = $partition; 
+      }  
+    }
+    ksort($this->disks);
+  }
+
+
+  /* Return plugin informations for acl handling */ 
+  static function plInfo()
+  {
+    return (array( 
+          "plShortName" => _("Partition table"),
+          "plDescription" => _("FAI partition table"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 26,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("fai"),
+          "plProvidedAcls" => array(
+            "cn"                => _("Name")."&nbsp;("._("Read only").")",
+            "description"       => _("Description"))
+          ));
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/fai/class_faiPartitionTableEntry.inc b/gosa-core/plugins/admin/fai/class_faiPartitionTableEntry.inc
new file mode 100644 (file)
index 0000000..431157c
--- /dev/null
@@ -0,0 +1,516 @@
+<?php
+
+class faiPartitionTableEntry 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("DISKcn","DISKdescription");
+  var $objectclasses= array();
+
+  var $DISKcn              = "";
+  var $DISKdescription     = "";
+  
+  var $partitions           = array();
+  var $UsedAttrs            = array();
+  var $is_edit              = false;
+  var $old_cn               = "";
+  var $status               = "new";
+  var $deletePartitions     = array();
+
+  var $FAIstate             = "";
+
+  function faiPartitionTableEntry (&$config, $dn= NULL,$usedDiskNames=array(),$disk=false)
+  {
+    plugin::plugin ($config, $dn);
+    $this->UsedAttrs  = array("cn","description","FAIpartitionType","FAIpartitionNr","FAIfsType","FAImountPoint","FAIpartitionSize",
+                         "FAImountOptions","FAIfsOptions","FAIpartitionFlags");
+
+    /* Default status is new */
+    $this->status = "new";    
+    /* We want to edit an entry */
+    if($disk){
+
+      /* Set disk status */      
+      $this->status = $disk['status'];
+
+      /* Walk through partitions */
+      foreach($disk['partitions'] as $name => $values){
+
+        /* If a partition is already marked as delete, attach it to deletePartitions only. */
+        if($values['status'] == "delete"){
+          unset($disk['partitions'][$name]);
+          $this->deletePartitions[]=$values;
+        }else{
+
+          /* Set status, to know which partition must be deleted from ldap
+             new    : Neu partition entry // save
+             edited : Update partition entry in ldap
+             deleted: Remove partition from ldap
+           */
+    
+          /* If status is not new, set to edit mode. 
+           * New means that this partition currently wasn't saved to ldap.
+           */
+          if($disk['partitions'][$name]['status']!="new"){
+            $disk['partitions'][$name]['status']="edited";
+          }
+     
+          $disk['partitions'][$name]['old_cn']= $disk['partitions'][$name]['cn'];
+          /* Assign empty attributes, if attribute is missing */
+          foreach($this->UsedAttrs as $attr){
+            if(!isset($values[$attr])){
+              $disk['partitions'][$name][$attr]="";  
+            }
+          }
+
+          if (preg_match('/^_/', $disk['partitions'][$name]['FAIfsType'])){
+            $disk['partitions'][$name]['FAIfsType']= preg_replace('/^_/', '', $disk['partitions'][$name]['FAIfsType']);
+            $disk['partitions'][$name]['FAIencrypted']= true;
+          } else {
+            $disk['partitions'][$name]['FAIencrypted']= false;
+          }
+        }
+      }
+
+      /* Set default attributes */
+      $this->DISKcn          = $disk['cn'];
+      $this->DISKdescription = $disk['description'];
+      $this->partitions       = $disk['partitions'];
+      $this->is_edit          = true;
+      $this->old_cn           = $disk['cn'];
+    }
+  }
+
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* Fill templating stuff */
+    $smarty     = get_smarty();
+    $s_action   = "";
+    $s_entry    = "";
+    $display    = "";
+    
+    /* Assign values 
+     * And Checkbox selection
+     */
+    foreach($this->attributes as $attrs){
+      $smarty->assign($attrs,$this->$attrs);
+      if($this->$attrs){
+        $smarty->assign($attrs."CHK"," ");
+      }else{
+        $smarty->assign($attrs."CHK"," disabled ");
+      }
+    }
+
+    /* Check all Posts if there is something usefull for us,
+     * For example : Delete is posted as Delete_1 
+     * The number specifies the index we want to delete
+     */
+    foreach($_POST as $name => $value){
+      if((preg_match("/Delete_.*/",$name)) && $this->acl_is_removeable()){
+        $tmp = split("_",$name);
+        $s_action = "remove";
+        $s_entry  = $tmp[1]; 
+      }
+    }
+
+    /* To remove a partition we unset the index posted.
+     * We must sort the index again, else we possibly got problems 
+     * with partitions order.
+     */
+    if($s_action == "remove" && $this->acl_is_removeable()){
+      if($this->partitions[$s_entry]['status'] == "edited"){
+        $this->deletePartitions[$s_entry]= $this->partitions[$s_entry];
+        $this->deletePartitions[$s_entry]['FAIpartitionNr']=$s_entry;
+        unset($this->partitions[$s_entry]);
+      }else{
+        unset($this->partitions[$s_entry]);
+      }
+      $tmp= array();
+      foreach($this->partitions as $part){
+        $tmp[count($tmp)+1]=$part;
+      }
+      $this->partitions = $tmp;
+    }
+
+    /* To add a partitions we only append an empty 
+     *  array to the already defined partitions.
+     */
+    if(isset($_POST['AddPartition']) && $this->acl_is_createable()){
+      foreach($this->UsedAttrs as $attr){
+        $tmp[$attr]                = "";     
+      }
+      $tmp["old_cn"]               = "";     
+      $tmp["FAIencrypted"] = FALSE;     
+      $tmp['status']="new";
+      $this->partitions[count($this->partitions)+1]=$tmp;
+    }
+
+    /* $setup contains a table with the partitions. 
+     */
+    $smarty->assign("setup", $this->generateParts());
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr,$this->$attr);
+    }
+
+    $tmp = $this->plInfo();
+    $sacl = "";
+    foreach($tmp['plProvidedAcls'] as $name => $translated){
+
+      $acl = $this->getacl($name);
+      $sacl .= $acl;
+      if($this->FAIstate == "freezed"){
+        $acl = preg_replace("/w/","",$acl);
+      }
+      $smarty->assign($name."ACL",$acl);
+    }
+    $smarty->assign("allowSave",$sacl);
+   
+    $smarty->assign("sub_object_is_createable",$this->acl_is_createable());
+    /* Fetch template and show the result
+     */
+    $display.= $smarty->fetch(get_template_path('faiPartitionTableEntry.tpl', TRUE));
+    return($display);
+  }
+
+  function generateParts()
+  {
+    /* Define Arrays with allowed syntax */
+    $PartitionTypes   = array("primary"=>_("primary"),"logical"=>_("logical"));
+    $FAIfsTypes       = array("ext2","ext3","xfs","swap","reiser","dosfat16","winfat32");
+
+    /* Display Header */
+    $str = "";
+    if (count($this->partitions)){
+      $str .= "<tr>";
+      $str .= "<td><b>"._("Type")."</b></td>";
+      $str .= "<td><b>"._("FS type")."</b></td>";
+      $str .= "<td><b>"._("Mount point")."</b></td>";
+      $str .= "<td><b>"._("Size in MB")."</b></td>";
+      $str .= "<td><b>"._("Mount options")."</b></td>";
+      $str .= "<td><b>"._("FS option")."</b></td>";
+      $str .= "<td><b>"._("Preserve")."</b></td>";
+      $str .= "<td><b>"._("Encrypted")."</b></td>";
+      $str .= "<td>&nbsp;</td>";
+      $str .= "</tr>";
+    }
+    
+    /* Walk through all defined partitions.
+     * Create a new row for each partition and append it to 
+     *  the header defined above.
+     * To be able to check the posts later, we append a key to each single postfield. like cn_1 ... cn_2
+     */
+    foreach($this->partitions as $key => $part){
+      
+      $dis = "";
+      if($part['FAIpartitionFlags'] == "preserve"){
+        $dis = " disabled ";
+      }
+
+      $disableALL = "";
+      if($this->FAIstate =="freeze"){
+        $disableALL = " disabled ";
+      }
+
+      if($part['status']!="delete"){
+
+        /* Generate Partition select box  
+         */
+        $PartitionType = "";
+        if($this->acl_is_writeable("FAIpartitionType")){
+          $PartitionType = "<select name='FAIpartitionType_".$key."' id='FAIpartitionType_".$key."' ".$disableALL.">";
+          foreach($PartitionTypes as $type => $PTname){
+            if($part['FAIpartitionType'] == $type){
+              $PartitionType .="<option value='".$type."' selected >".$PTname."</option>";
+            }else{
+              $PartitionType .="<option value='".$type."'>".$PTname."</option>";
+            }
+          }        
+          $PartitionType.="</select>";   
+        }elseif($this->acl_is_readable("FAIpartitionType")){
+          $PartitionType = $part['FAIpartitionType'];
+        }
+
+
+        /* Generate fsType select box  
+         */
+        $FAIfsType= "";
+        if($this->acl_is_writeable("FAIfsType")){
+          $FAIfsType= "<select name='FAIfsType_".$key."' id='FAIfsType_".$key."' ".$dis." ".$disableALL.">";
+          foreach($FAIfsTypes as $type){
+            if($part['FAIfsType'] == $type){
+              $FAIfsType  .="<option value='".$type."' selected >".$type."</option>";
+            }else{
+              $FAIfsType .="<option value='".$type."'>".$type."</option>";
+            }
+          }        
+          $FAIfsType.="</select>";   
+        }elseif($this->acl_is_readable("FAIfsType")){
+          $FAIfsType = $part['FAIfsType'];
+        }
+
+        foreach(array("FAImountPoint","FAIpartitionSize","FAImountOptions","FAIfsOptions") as $attr){
+          $$attr  = "";
+          if($this->acl_is_writeable($attr)){
+            $$attr = "<input name='".$attr."_".$key."'  ".$disableALL."  ".$dis."
+                        value='".$part[$attr]."'    id='".$attr."_".$key."'>";
+
+          }elseif($this->acl_is_readable($attr)){
+            $$attr = $part[$attr];
+          }
+        }
+
+
+        $str .= "\n<tr>";
+        $str .= "\n<td>".$PartitionType."</td>";
+        $str .= "\n<td>".$FAIfsType."</td>";
+        $str .= "\n<td>".$FAImountPoint."</td>";
+        $str .= "\n<td>".$FAIpartitionSize."</td>";
+        $str .= "\n<td>".$FAImountOptions."</td>";
+        $str .= "\n<td>".$FAIfsOptions."</td>";
+
+        $changeState = "onClick=\"changeState('FAImountPoint_".$key."') ; ".
+                                 "changeState('FAIpartitionSize_".$key."') ; ".
+                                 "changeState('FAImountOptions_".$key."') ; ".
+                                 "changeState('FAIfsType_".$key."') ; ".
+                                 "changeState('FAIfsOptions_".$key."') ; \"";
+  
+        if($this->acl_is_writeable("FAIpartitionFlags")){
+          if($part['FAIpartitionFlags']!=false){
+            $str .= "\n<td><input type='checkbox' name='FAIpartitionFlags_".$key."' value='preserve' checked ".$changeState." ".$disableALL."></td>";
+          }else{
+            $str .= "\n<td><input type='checkbox' name='FAIpartitionFlags_".$key."' value='preserve' ".$changeState." ".$disableALL."></td>";
+          }
+          if($part['FAIencrypted']!=false){
+            $str .= "\n<td><input type='checkbox' name='FAIencrypted_".$key."' value='encrypted' checked></td>";
+          }else{
+            $str .= "\n<td><input type='checkbox' name='FAIencrypted_".$key."' value='encrypted'></td>";
+          }
+        }else{
+          if($part['FAIpartitionFlags']!=false){
+            $str .= "<td>"._("False")."</td>";
+          }else{
+            $str .= "<td>"._("True")."</td>";
+          }
+          if($part['FAIencrypted']!=false){
+            $str .= "<td>"._("False")."</td>";
+          }else{
+            $str .= "<td>"._("True")."</td>";
+          }
+        }
+        if($this->acl_is_removeable()){
+          $str .= "\n<td><input type='submit' name='Delete_".$key."' value='"._("Remove")."' ".$disableALL."></td>";    
+        }else{
+          $str .= "\n<td><input type='submit' name='restricted' disabled value='"._("Remove")."'></td>";    
+        }
+        $str .= "\n</tr>";    
+      }
+    }
+    
+    if(!empty($str)){
+      $str = "<table summary='' style='width:100%'>".$str."</table>";
+    }
+    return($str);
+
+  }
+
+  function save()
+  {
+    $tmp = array();
+    $tmp['cn']          = $this->DISKcn;
+
+    /* Attach partitions */
+    foreach($this->partitions as $key=>$val) {
+      if (isset($this->partitions[$key]['FAIencrypted']) && $this->partitions[$key]['FAIencrypted']){
+        unset ($this->partitions[$key]['FAIencrypted']);
+        $this->partitions[$key]['FAIfsType']= "_".$this->partitions[$key]['FAIfsType'];
+      }
+      $this->partitions[$key]['FAIpartitionNr']=$key;
+    }
+
+    /* Attach deleted */
+    foreach($this->deletePartitions as $key=>$val) {
+      $this->partitions[$key."-delete"]=$val;
+      $this->partitions[$key."-delete"]['status']="delete";
+    }
+
+    $tmp['description'] = $this->DISKdescription;
+    $tmp['partitions']  = $this->partitions;
+    $tmp['status']      = $this->status;
+
+    /* If hdd name has changed, tell partitionTable to rename it */
+    if(($this->is_edit)&&($this->old_cn != $this->DISKcn)){
+      $tmp['rename']['from']  = $this->old_cn;
+      $tmp['rename']['to']    = $this->DISKcn;
+    }
+    return($tmp);
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+
+
+    if((isset($_POST['TableEntryFrameSubmitted'])) && ($this->FAIstate != "freeze") ){
+      plugin::save_object();
+
+      foreach($this->partitions as $key => $part){
+        foreach($this->UsedAttrs as $attrs){
+
+          if($this->acl_is_writeable($attrs)){
+
+            if(isset($_POST[$attrs."_".$key])){
+              $this->partitions[$key][$attrs] = $_POST[$attrs."_".$key];
+            }else{
+              $this->partitions[$key][$attrs] = false;
+            }
+          }
+        }
+
+        if($this->acl_is_writeable("FAIencrypted")){
+
+          if(isset($_POST["FAIencrypted_".$key])){
+            $this->partitions[$key]["FAIencrypted"] = $_POST["FAIencrypted_".$key];
+          }else{
+            $this->partitions[$key]["FAIencrypted"] = false;
+          }
+        }
+      }
+    }
+  }
+
+
+  /* Check supplied data */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+  
+    /* Check for an empty disk name */
+    if(empty($this->DISKcn)){
+      $message[] = _("Please specify a valid disc name.");
+    }
+       
+    /* check every partition.
+     * if there is an invalid value defined, append an errorstr to message
+     */
+
+    /* Array that contain every partitionname mountpoint etc already assigned */
+    $alreadyUsed    = array();
+    foreach($this->UsedAttrs as $attrs){
+      $alreadyUsed[$attrs] = array();
+    }      
+
+    foreach($this->partitions as $key => $part){
+  
+      /* Skip all checks, if preserve is set */ 
+      if($part['FAIpartitionFlags'] == "preserve"){
+        $this->partitions[$key]['FAIfsType']        = "preserve";
+        $this->partitions[$key]['FAIpartitionSize'] = "preserve";
+        continue;
+      }
+      if((in_array($part['FAImountPoint'],$alreadyUsed['FAImountPoint']))&&($part['FAIfsType']!="swap")){
+        $message[]=sprintf(_("please enter a unique mount point for partition %s"),($key));
+      }
+
+      if($part['FAIfsType']!="swap" && $part['FAImountPoint'] != "-"){
+        if((empty($part['FAImountPoint']))||(!((preg_match("/^\/.*/",$part['FAImountPoint']))||(preg_match("/^swap$/",$part['FAImountPoint']))))){
+          $message[]=sprintf(_("Please enter a valid mount point for partition %s." ),($key));
+        }
+      }
+      if($part['FAIfsType'] == "swap"){
+        if(in_array($part['FAIfsType'],$alreadyUsed['FAIfsType'])){
+          $message[]=sprintf(_("File system type 'swap' is already used, change file system type for partition %s."),$key);
+        }
+      }
+      if(($part['FAIfsType'] == "swap")&&(!empty($part['FAImountPoint']))&&($part['FAImountPoint']!="swap")){
+        $message[]=_("Please use 'swap' as mount point, if 'swap' is used as fs-type.");
+      }
+
+      $tmp = split("-",$part['FAIpartitionSize']);
+      switch (count($tmp)){
+        case 0:
+                $message[]= sprintf(_("Please enter a valid partition size for partition %s."),($key));
+                break;
+        case 1:
+                if (!is_id(is_id($tmp[0])) &&(!empty($tmp[1]))){
+                  $message[]= sprintf(_("Please enter a valid partition size for partition %s."),($key));
+                }
+                break;
+                
+        case 2:
+                if((!is_id($tmp[0]))&&(!is_id($tmp[1])) &&(!empty($tmp[1]))){
+                  $message[]=sprintf(_("Please enter a valid range for partition %s."),($key)); 
+                }elseif($tmp[0]>=$tmp[1]){
+                  $message[]=sprintf(_("Please enter a valid range for partition %s."),($key));
+                }
+                break;
+
+        default:
+                $message[]=sprintf(_("Please enter a range for partition size for partition %s."),($key));
+      }
+
+      foreach($this->UsedAttrs as $attrs){
+        $alreadyUsed[$attrs][$key] = $part[$attrs];
+      }      
+    }
+
+    $cnt = 0;
+    foreach($this->partitions as $key => $part){
+      if($part['FAIpartitionType'] == "primary"){
+        $cnt ++ ; 
+      }
+    }
+    if($cnt > 3){
+      $message[] = _("You have more than 3 primary partition table entries in your configuration, please check your configuration twice.");
+    }
+
+    return ($message);
+  }
+
+  
+
+  /* Return plugin informations for acl handling */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName" => _("Partition table entry"),
+          "plDescription" => _("FAI partition table entry"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 27,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("fai"),
+          "plProvidedAcls" => array(
+            "DISKcn"           => _("Name"),
+            "DISKdescription"  => _("Description"),
+            "FAIpartitionType"  => _("Partition type"),
+            "FAIpartitionNr"    => _("Partition no."),
+            "FAIfsType"         => _("File system type"),
+            "FAImountPoint"     => _("Mount point"),
+            "FAIpartitionSize"  => _("Partition size"),
+            "FAImountOptions"   => _("Mount options"),
+            "FAIfsOptions"      => _("File system options"),
+            "FAIencrypted"      => _("File system encryption"),
+            "FAIpartitionFlags" => _("Partition flags"))
+          ));
+  }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/fai/class_faiProfile.inc b/gosa-core/plugins/admin/fai/class_faiProfile.inc
new file mode 100644 (file)
index 0000000..4b5daea
--- /dev/null
@@ -0,0 +1,501 @@
+<?php
+
+class faiProfile 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;
+
+  /* Attributes for this Object */
+  var $attributes       = array("cn","description","FAIclass");
+
+  /* ObjectClasses for this Object*/
+  var $objectclasses    = array("top","FAIclass","FAIprofile");
+
+  /* Specific attributes */
+  var $old_cn           = "";
+  var $cn               = "";       // The class name for this object
+  var $description      = "";       // The description for this set of partitions
+  var $is_dialog        = false;    // specifies which buttons will be shown to save or abort
+  var $FAIclass         = "";       // Classnames used for this profile
+  var $FAIclasses       = array();  // Contains classname seperated in an array
+  var $FAIAllclasses    = array();  // Contains all possible Classnames
+  var $ui               ;
+  var $FAIstate      = "";
+  var $view_logged      = FALSE;
+
+  function faiProfile(&$config, $dn= NULL)
+  {
+    /* Load Attributes */
+    plugin::plugin ($config, $dn);
+    $ldap=$this->config->get_ldap_link();
+
+    $this->ui = get_userinfo();
+
+    /* Parse ldap attribute to get all assigned classes */
+    $tmp = split(" ",$this->FAIclass);
+    $tmp2 = array();
+    foreach($tmp as $class){
+      if(!empty($class)){
+        $tmp2[trim($class)] = trim($class);
+      }
+    }
+
+    if(isset($this->attrs['FAIstate'][0])){
+      $this->FAIstate = $this->attrs['FAIstate'][0];
+    }
+
+    /* Sort assigned classes */ 
+    if(is_array($tmp2)){
+      foreach($tmp2 as $class){
+        $this->FAIclasses[$class]=$class;
+      }
+    }
+
+    $categories = array("FAIscript","FAItemplate","FAIhook","FAIvariable","FAIpartitionTable","FAIpackageList");
+
+    /* Build filter */
+    $filter= "";
+    foreach ($categories as $cat){
+      $filter.= "(objectClass=$cat)";
+    }
+    
+    /* Get ldap connection */ 
+    $base = $_SESSION['CurrentMainBase'];
+    $ldap->cd($base);
+    $sort = array();
+
+    /* search all FAI classes */
+    $ldap->search("(|$filter)",array("*"));
+    while($attrs = $ldap->fetch()){
+
+      /* Sort by categorie */
+      foreach($categories as $cat){
+        if(in_array($cat,$attrs['objectClass'])){
+
+          /* Append entry */
+          $this->FAIAllclasses[$attrs['cn'][0]][$cat]=$attrs;
+  
+          /* Create sort array, because the array above is a multidimensional array, and can't be sorted by php sorting functions*/
+          $sort[strtolower($attrs['cn'][0])] = $attrs['cn'][0];
+        }
+      }
+    } 
+
+    /* Sort the sort array */
+    //ksort($sort);
+
+    /* Reorder the FAIclasses array */
+    foreach($sort as $name){
+      $tmp[$name] =$this->FAIAllclasses[$name];
+    }
+
+    /* Assign sorted classes */
+    $this->FAIAllclasses = array();
+    $this->FAIAllclasses = $tmp;
+
+    if($dn != "new"){
+      $this->dn =$dn;
+    }
+    $this->old_cn   = $this->cn;
+  }
+
+
+  /* Combine new array, used for up down buttons */
+  function combineArrays($ar0,$ar1,$ar2)
+  {
+    $ret = array();
+    if(is_array($ar0))
+      foreach($ar0 as $ar => $a){
+        $ret[$ar]=$a;
+      }
+    if(is_array($ar1))
+      foreach($ar1 as $ar => $a){
+        $ret[$ar]=$a;
+      }
+    if(is_array($ar2))
+      foreach($ar2 as $ar => $a){
+        $ret[$ar]=$a;
+      }
+    return($ret);
+  }
+
+
+  function acl_base_for_current_object($dn)
+  {
+    if($dn == "new"){
+      if($this->dn == "new"){
+        $dn= $_SESSION['CurrentMainBase'];
+      }else{
+        $dn = $this->dn;
+      }
+    }
+    return($dn);
+  }
+
+
+  /* returns position in array */
+  function getpos($atr,$attrs)
+  {
+    $i = 0;
+    foreach($attrs as $attr => $name)    {
+      $i++;
+      if($attr == $atr){
+        return($i);
+      }
+    }
+    return(-1);
+  }
+
+  /* Transports the given 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 given Arraykey one position down*/
+  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);
+  }
+
+  /* class one position up */
+  function catUp($id)
+  {
+    /* Get all cats depinding on current dir */
+    $cats = $this->FAIclasses;
+    $this->FAIclasses =$this->ArrayUp($id,$cats);
+  }
+
+  /* Class one position down */
+  function catDown($id)
+  {
+    /* Get all cats depinding on current dir */
+    $cats = $this->FAIclasses;
+    $this->FAIclasses =$this->ArrayDown($id,$cats);
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","fai/".get_class($this),$this->dn);
+    }
+
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+    $display= "";
+
+    $s_entry = "";
+    $s_action = "";
+
+    /* Remove class name From list */
+    $sort_once = false;
+    foreach($_POST as $name => $post){
+      if(preg_match("/DEL_/i",$name) && $this->acl_is_writeable("FAIclass")){
+        $s_action = "delete";
+        $s_entry  = preg_replace("/DEL_/","",$name);
+        $s_entry  = base64_decode(preg_replace("/_.*$/","",$s_entry));
+      }elseif(preg_match("/Add_class/i",$name)&& $this->acl_is_writeable("FAIclass")){
+        $s_action  = "add";
+      }elseif(preg_match("/DelClass/i",$name) && $this->acl_is_writeable("FAIclass")){
+        $s_action  = "delete";
+        $s_entry = $_POST['FAIclass'];
+      }elseif(preg_match("/AddClass/i",$name) && $this->acl_is_writeable("FAIclass")){
+        $s_action  = "add";
+      }
+
+      /* Check if a list element should be pushed one position up */
+      if((preg_match("/sortup_/",$name))&&(!$sort_once) && $this->acl_is_writeable("FAIclass")){
+        $sort_once = true;
+        $val = preg_replace("/sortup_/","",$name);
+        $val = preg_replace("/_.*$/","",$val);
+        $val = base64_decode($val);
+        $this->catUp($val);
+      }
+      
+      /* Check if a list element should be pushed one position down */
+      if((preg_match("/sortdown_/",$name))&&(!$sort_once) && $this->acl_is_writeable("FAIclass")){
+        $sort_once = true;
+        $val = preg_replace("/sortdown_/","",$name);
+        $val = preg_replace("/_.*$/","",$val);
+        $val = base64_decode($val);
+        $this->catDown($val);
+      }
+
+    }
+
+    if($s_action == "delete" && $this->acl_is_writeable("FAIclass")){
+      unset($this->FAIclasses[$s_entry]);
+    }
+
+    if($s_action == "add" && $this->acl_is_writeable("FAIclass")){
+      $this->dialog = new faiProfileEntry($this->config,$this->dn,$this->FAIclasses);
+      $this->is_dialog  =true;
+    }
+
+    /* Save Dialog */
+    if(isset($_POST['SaveSubObject'])){
+      $this->dialog->save_object();
+      $msgs= $this->dialog->check();
+      if(count($msgs)){
+        print_red($msgs);
+      }else{
+        $ret = $this->dialog->save();
+        foreach($ret as $class){
+          $this->FAIclasses[$class] =$class; 
+        }
+        $this->is_dialog=false;
+        unset($this->dialog);
+        $this->dialog=FALSE;
+        //ksort($this->FAIclasses);
+      }
+    }
+
+    /* Cancel Dialog */
+    if(isset($_POST['CancelSubObject'])){
+      $this->is_dialog=false;
+      unset($this->dialog);
+      $this->dialog=FALSE;
+    }
+
+    if(is_object($this->dialog)){
+      $this->dialog->save_object();
+      return($this->dialog->execute());
+    }
+
+    $divlist  =new divSelectBox("Profile");
+    $divlist->SetSummary(_("This list displays all assigned class names for this profile."));
+
+    /* item images */
+    $objTypes['FAIhook']            = "<img src='images/fai_hook.png' title='"._("Hook bundle")."' alt=''>";
+    $objTypes['FAItemplate']        = "<img src='images/fai_template.png' title='"._("Template bundle")."' alt=''>";
+    $objTypes['FAIscript']          = "<img src='images/fai_script.png' title='"._("Script bundle")."' alt=''>";
+    $objTypes['FAIvariable']        = "<img src='images/fai_variable.png' title='"._("Variable bundle")."' alt=''>";
+    $objTypes['FAIpackageList']        = "<img src='images/fai_packages.png' title='"._("Packages bundle")."' alt=''>";
+    $objTypes['FAIpartitionTable']  = "<img src='images/fai_partitionTable.png' title='"._("Partition table")."' alt=''>";
+
+    /* Delete button */
+    $actions = "<input type='image' src='images/edittrash.png' title='"._("Remove class from profile")."' name='DEL_%KEY%'>"; 
+    
+    /* Up down buttons */
+    $linkupdown = "&nbsp;<input type='image' name='sortup_%s'   alt='up'    title='"._("Up")."'   src='images/sort_up.png' align='top' >";
+    $linkupdown.= "<input type='image' name='sortdown_%s' alt='down'  title='"._("Down")."' src='images/sort_down.png' >";
+
+    /* Append fai classes to divlist */
+    if($this->acl_is_readable("FAIclass")){
+      foreach($this->FAIclasses as $usedClass){
+        $str = "&nbsp;";
+        $act = "";
+
+        if(isset($this->FAIAllclasses[$usedClass])){
+          foreach($this->FAIAllclasses[$usedClass] as $class => $obj){
+            $str.= $objTypes[$class]; 
+          }
+        }
+
+        $field1 = array("string"=> $usedClass,"attach"=>"");
+        $field2 = array("string"=> $str,"attach"=>"");
+        if(($this->FAIstate != "freeze") && $this->acl_is_writeable("FAIclass")){
+          $field3 = array("string"=> preg_replace("/%KEY%/",base64_encode($usedClass),$actions).
+              preg_replace("/%s/",base64_encode($usedClass),$linkupdown),
+              "attach"=>"style='border-right:none;'");
+        }else{
+          $field3 = array("string"=>"&nbsp;", "attach"=>"style='border-right:none;'");
+        }
+        $divlist->AddEntry(array($field1,$field2,$field3));
+      }
+    }
+
+    $smarty->assign("FAIclasses"  ,$this->FAIclasses);
+    $smarty->assign("divlist"     ,$divlist->DrawList());
+
+    /* Magic quotes GPC, escapes every ' " \, to solve some security risks
+     * If we post the escaped strings they will be escaped again
+     */
+    foreach($this->attributes as $attrs){
+      if(get_magic_quotes_gpc()){
+        $smarty->assign($attrs,stripslashes($this->$attrs));
+      }else{
+        $smarty->assign($attrs,($this->$attrs));
+      }
+    }
+
+    
+    $dn = $this->acl_base_for_current_object($this->dn);
+    $smarty->assign("sub_object_is_addable",
+        preg_match("/c/",$this->ui->get_permissions($dn,"fai/faiScriptEntry")) &&
+        !preg_match("/freeze/",$this->FAIstate));
+
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translated){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+    $display.= $smarty->fetch(get_template_path('faiProfile.tpl', TRUE));
+    return($display);
+  }
+
+  function remove_from_parent()
+  {
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd ($this->dn);
+
+#    $use_dn = str_ireplace( get_release_dn($this->dn), $_SESSION['faifilter']['branch'], $this->dn);
+    $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $this->dn);
+    if($_SESSION['faifilter']['branch'] == "main"){
+      $use_dn = $this->dn;
+    }
+
+    new log("remove","fai/".get_class($this),$use_dn,$this->attributes);
+    prepare_to_save_FAI_object($use_dn,array(),true);
+    $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();
+
+    if(count($this->FAIclasses) == 0){
+      $message[]=_("Please assign at least one class to this  profile.");
+    }
+
+    if(empty($this->cn)){
+      $message[]=_("Please enter a valid name.");
+    }
+
+    $ldap = $this->config->get_ldap_link();
+
+    $base = $_SESSION['faifilter']['branch'];
+    if($base == "main"){
+      $base =$_SESSION['CurrentMainBase'];
+    }
+    $base = "ou=profiles,".$base;
+  
+    $ldap->cd($base);
+    if ($this->old_cn == ""){
+      $ldap->ls("(&(objectClass=FAIprofile)(cn=".$this->cn."))",$base,array("*"));
+    } else {
+      $ldap->ls("(&(objectClass=FAIprofile)(cn=".$this->cn.")(!cn=".$this->old_cn."))",$base,array("*"));
+    }
+
+    if($ldap->count() || isset($this->FAIAllclasses[$this->cn])){
+      $message[]=_("There is already a FAI object with this class name defined.");
+    }
+
+    return ($message);
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    plugin::save();
+
+    $ldap = $this->config->get_ldap_link();
+
+    $this->FAIclass = "";
+    foreach($this->FAIclasses as $class){
+      $this->FAIclass.=$class." ";
+    }
+
+    $this->attrs['FAIclass']=trim($this->FAIclass);
+
+    prepare_to_save_FAI_object($this->dn,$this->attrs);
+   
+    if($this->initially_was_account){
+      new log("modify","fai/".get_class($this),$this->dn,$this->attributes);
+    }else{
+      new log("create","fai/".get_class($this),$this->dn,$this->attributes);
+    }
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of FAI/profile with dn '%s' failed."),$this->dn));
+
+    /* Do object tagging */
+    $this->handle_object_tagging();
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of FAI/profile with dn '%s' failed."),$this->dn));
+  }
+
+
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);
+
+    /* Parse ldap attribute to get all assigned classes */
+    $tmp = split(" ",$this->FAIclass);
+    $tmp2 = array();
+    foreach($tmp as $class){
+      if(!empty($class)){
+        $tmp2[trim($class)] = trim($class);
+      }
+    }
+
+    /* Sort assigned classes */
+    if(is_array($tmp2)){
+      foreach($tmp2 as $class){
+        $this->FAIclasses[$class]=$class;
+      }
+    }
+  }
+
+
+  /* Return plugin informations for acl handling */ 
+  static function plInfo()
+  {
+    return (array( 
+          "plShortName" => _("Profile"),
+          "plDescription" => _("FAI profile"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 30,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("fai"),
+          "plProvidedAcls" => array(
+            "cn"                => _("Name"),
+            "description"       => _("Description"),
+            "FAIclass"          => _("FAI classes"))
+          ));
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/fai/class_faiProfileEntry.inc b/gosa-core/plugins/admin/fai/class_faiProfileEntry.inc
new file mode 100644 (file)
index 0000000..2d9b097
--- /dev/null
@@ -0,0 +1,277 @@
+<?php
+
+class faiProfileEntry 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();
+
+  /* Array with available class names */
+  var $FAIAllclasses        = array();
+  var $ui;
+
+  function faiProfileEntry (&$config, $dn= NULL,$used=array(),$objects=false)
+  {
+    plugin::plugin ($config, $dn);
+
+    /* Search only in fai tree */
+    $base = "ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase'];
+    if($_SESSION['faifilter']['branch']!="main"){
+      $base = $_SESSION['faifilter']['branch'];
+    }
+  
+    $this->ui = get_userinfo();
+
+    $filter = "(|(objectClass=FAIscript)(objectClass=FAItemplate)(objectClass=FAIhook)".
+                "(objectClass=FAIvariable)(objectClass=FAIpartitionTable)(objectClass=FAIpackageList))";
+
+    $FAI_objects = get_all_objects_for_given_base($base,$filter,true);
+
+    /* Create array with categories to be able to sort different types of objects */
+    $categories = array("FAIscript"         => "faiScript",
+                        "FAItemplate"       => "faiTemplate",
+                        "FAIhook"           => "faiHook",
+                        "FAIvariable"       => "faiVariable",
+                        "FAIpartitionTable" => "faiPartitionTable",
+                        "FAIpackageList"    => "faiPackageList");
+
+    /* Read out all objects from fai tree */
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd($base);
+    $sort=array();
+    foreach($FAI_objects as $obj){
+
+      $ldap->cat($obj['dn']);
+      $attrs = $ldap->fetch();
+
+      /* Only use objects which have cn set */
+      if((isset($attrs['cn'][0]))&&(!in_array($attrs['cn'][0],$used))){
+        foreach($categories as $cat => $acl){
+          if(in_array($cat,$attrs['objectClass'])){
+
+            $acl =  $this->ui->get_permissions($attrs['dn'],"fai/".$acl); 
+
+            /* Append different types of objects */
+            $this->FAIAllclasses[$attrs['cn'][0]]['objects'][$cat]=$cat;
+
+            if(!isset($this->FAIAllclasses[$attrs['cn'][0]]['acl'])){
+              $this->FAIAllclasses[$attrs['cn'][0]]['acl']="";
+            }
+            $this->FAIAllclasses[$attrs['cn'][0]]['acl'].=$acl;
+
+            /* Set selected status to false */
+            $this->FAIAllclasses[$attrs['cn'][0]]['status']=false;
+
+            $sort[strtolower($attrs['cn'][0])] = $attrs['cn'][0];
+          }
+        } 
+      }
+    }
+
+
+    $tmp = array();
+    ksort($sort);
+    foreach($sort as $name){
+      $tmp[$name] =$this->FAIAllclasses[$name];
+    }
+    $this->FAIAllclasses = array();
+    $this->FAIAllclasses = $tmp;
+
+    /* If no search filter is set, create one */
+    if (!is_global("SUBfaifilter")){
+      $SUBfaifilter= array("base" => "ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase'], "Sregex" => "*");
+      $SUBfaifilter['SShowTemplates'] = true;
+      $SUBfaifilter['SShowScripts']   = true;
+      $SUBfaifilter['SShowHooks']     = true;
+      $SUBfaifilter['SShowVariables'] = true;
+      $SUBfaifilter['SShowPackages']  = true;
+      $SUBfaifilter['SShowPartitions']= true;
+      register_global("SUBfaifilter", $SUBfaifilter);
+    }
+  }
+
+  function execute()
+  {
+       /* Call parent execute */
+       plugin::execute();
+
+    /* Fill templating stuff */
+    $smarty     = get_smarty();
+    $display = "";
+
+    $SUBfaifilter = $_SESSION['SUBfaifilter'];
+
+    /* If someone used the apply button, update searchfilter */
+    if(isset($_POST['Sregex'])){
+      foreach($SUBfaifilter as $key => $val){
+        if(!isset($_POST[$key])){
+          $SUBfaifilter[$key] = false;
+        }else{
+          $SUBfaifilter[$key] =$_POST[$key];
+        }
+      }
+      $SUBfaifilter['Sregex']= $_POST['Sregex'];
+      if(!strstr($SUBfaifilter['Sregex'],"*")){
+        $SUBfaifilter['Sregex'] = $SUBfaifilter['Sregex']."*";
+      }
+    }
+  
+    /* Save current searchfilter in session*/
+    $_SESSION['SUBfaifilter']= $SUBfaifilter;
+
+    /* Check if we used a checkboxe from the list, to select dselect an entry */
+    foreach($_POST as $name => $value){
+      foreach($this->FAIAllclasses as $class => $obj){
+        $bclass = base64_encode($class);
+        if(isset($_POST["ON_PAGE_".$bclass])){
+          if(isset($_POST['USE_'.$bclass])){
+            $this->FAIAllclasses[$class]['status']=true;  
+          }else{
+            $this->FAIAllclasses[$class]['status']=false;  
+          }    
+        }
+      }
+    }
+
+    /* Create different picture for each object type */
+    $objTypes['FAIhook']            = "<img src='images/fai_hook.png' title='"._("Hook bundle")."' alt=''>&nbsp;";
+    $objTypes['FAItemplate']        = "<img src='images/fai_template.png' title='"._("Template bundle")."' alt=''>&nbsp;";
+    $objTypes['FAIscript']          = "<img src='images/fai_script.png' title='"._("Script bundle")."' alt=''>&nbsp;";
+    $objTypes['FAIvariable']        = "<img src='images/fai_variable.png' title='"._("Variable bundle")."' alt=''>&nbsp;";
+    $objTypes['FAIpackageList']     = "<img src='images/fai_packages.png' title='"._("Package bundle")."' alt=''>&nbsp;";
+    $objTypes['FAIpartitionTable']  = "<img src='images/fai_partitionTable.png' title='"._("Partition table")."' alt=''>&nbsp;";
+
+    /* Magic quotes GPC, escapes every ' " \, to solve some security risks
+     * If we post the escaped strings they will be escaped again
+     */
+    foreach($this->attributes as $attrs){
+      if(get_magic_quotes_gpc()){
+        $smarty->assign($attrs,stripslashes($this->$attrs));
+      }else{
+        $smarty->assign($attrs,($this->$attrs));
+      }
+    }
+
+    /* Assign all filter attributes to smarty */
+    foreach($SUBfaifilter as $key => $val){
+      if(($key != "base")&&($key != "Sregex")){
+        if($val){
+          $smarty->assign($key."CHK", " checked ");
+        }else{
+          $smarty->assign($key."CHK", "");
+        }
+      }else{
+        $smarty->assign($key,$val);
+      }
+    }
+  
+    /* Create a divlist to display all available class names with the depending object types */
+    $divlist = new divlist("ProfileEntry");
+    $divlist->SetPluginMode();
+    $divlist->SetSummary(_("This list displays all assigned class names for this profile."));
+    $divlist->SetEntriesPerPage(0);
+    $divlist->SetHeader(array(array("string"=> _("Class name")),
+                              array("string"=> _("Objects"),"attach"=>"style='border-right:0px;'")));
+
+    /* Action button allows us to delete an entry */
+    $action = "<input type='hidden' name='ON_PAGE_%KEY%' value='1'>
+              <input type='checkbox' name='USE_%KEY%' value='%KEY%' onClick='document.mainform.submit();' %CHECK%>";
+
+    /* Check every single class name to match the current search filter */
+    foreach($this->FAIAllclasses as $usedClass => $classes){
+
+      /* Skip those entries that we are not allowed to read. */
+      if(!preg_match("/r/",$classes['acl'])){
+        continue;
+      }
+
+      $fi = str_replace("*",".*",$SUBfaifilter['Sregex']);  
+      $abort = true; 
+      if(!preg_match("/".$fi."/",$usedClass)){
+        $abort = false;
+      }
+      if((isset($classes['objects']['FAIscript']))&&($SUBfaifilter['SShowScripts'])){
+        $abort = false;
+      }
+      if((isset($classes['objects']['FAItemplate']))&&($SUBfaifilter['SShowTemplates'])){
+        $abort = false;
+      }
+      if((isset($classes['objects']['FAIhook']))&&($SUBfaifilter['SShowHooks'])){
+        $abort = false;
+      }
+      if((isset($classes['objects']['FAIvariable']))&&($SUBfaifilter['SShowVariables'])){
+        $abort = false;
+      }
+      if((isset($classes['objects']['FAIpartitionTable']))&&($SUBfaifilter['SShowPartitions'])){
+        $abort = false;
+      }
+      if((isset($classes['objects']['FAIpackageList']))&&($SUBfaifilter['SShowPackages'])){
+        $abort = false;
+      }
+
+      if(!$abort){
+        $str = "";
+        foreach($classes['objects'] as $class => $obj){
+          $str.= $objTypes[$obj];
+        }
+
+        /* Is this entry selected */ 
+        if($classes['status']==true){
+          $action_check = preg_replace("/%CHECK%/"," checked ",$action);
+        }else{
+          $action_check = preg_replace("/%CHECK%/","",$action);
+        }      
+        
+        /* Append to list */
+        $field1 = array("string"=> str_replace("%KEY%",base64_encode($usedClass),$action_check).$usedClass,"attach"=>"");
+        $field2 = array("string"=> $str,"attach"=>"style='border-right:0px;'");
+        $divlist->AddEntry(array($field1,$field2));
+      }
+    }
+
+    $smarty->assign("faihead"       , "");
+    $smarty->assign("failist"       , $divlist->DrawList());
+    $smarty->assign("infoimage"     , get_template_path('images/info_small.png'));
+    $smarty->assign("launchimage"   , get_template_path('images/small_filter.png'));
+    $smarty->assign("alphabet"      , generate_alphabet());
+    $smarty->assign("apply"         , apply_filter(TRUE));
+    $smarty->assign("search_image"  , get_template_path('images/search.png'));
+
+    $display.= $smarty->fetch(get_template_path('faiProfileEntry.tpl', TRUE));
+    return($display);
+  }
+
+  /* Save data to object */
+  function save_object()
+  {
+  }
+
+  /* Check supplied data */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    return ($message);
+  }
+
+  function save()
+  {
+    $tmp = array();
+    foreach($this->FAIAllclasses as $class => $obj){
+      if($obj['status']==true){
+        $tmp[$class]=$class;
+      }
+    }
+    return($tmp);
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/fai/class_faiScript.inc b/gosa-core/plugins/admin/fai/class_faiScript.inc
new file mode 100644 (file)
index 0000000..928aa0e
--- /dev/null
@@ -0,0 +1,658 @@
+<?php
+
+class faiScript 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;
+
+  /* Attributes for this Object */
+  var $attributes       = array("cn","description");
+
+  /* ObjectClasses for this Object*/
+  var $objectclasses    = array("top","FAIclass","FAIscript");
+
+  /* Class name of the Ldap ObjectClass for the Sub Object */
+  var $subClass         = "FAIscriptEntry";
+  var $subClasses       = array("top","FAIclass","FAIscriptEntry");
+
+  /* Class name of the php class which allows us to edit a Sub Object */
+  var $subClassName     = "faiScriptEntry";      
+
+  /* Attributes to initialise for each subObject */
+  var $subAttributes    = array("cn","description","FAIpriority"); 
+  var $sub_Load_Later   = array("FAIscript");
+  var $sub64coded       = array();
+  var $subBinary        = array("FAIscript");
+
+  /* Specific attributes */
+  var $cn               = "";       // The class name for this object
+  var $description      = "";       // The description for this set of partitions
+  var $is_dialog        = false;    // specifies which buttons will be shown to save or abort
+  var $SubObjects       = array();  // All leafobjects of this object
+
+  var $FAIstate         = "";
+  var $sort_by          = "name";
+  var $sort_order       = "up";
+
+  var $view_logged = FALSE;
+  var $ui;
+
+  function faiScript (&$config, $dn= NULL)
+  {
+    /* Load Attributes */
+    plugin::plugin ($config, $dn);
+
+    /* If "dn==new" we try to create a new entry
+     * Else we must read all objects from ldap which belong to this entry.
+     * First read SubObjects from ldap ... and then the partition definitions for the SubObjects.
+     */
+    if($dn != "new"){
+
+      $this->dn =$dn;
+
+      /* Get FAIstate
+       */
+      if(isset($this->attrs['FAIstate'][0])){
+        $this->FAIstate = $this->attrs['FAIstate'][0];
+      }
+
+      /* Read all leaf objects of this object (For FAIscript this would be FAIscriptEntry)
+       */
+      $ldap     = $this->config->get_ldap_link();
+      $ldap->cd ($this->dn);
+      
+      $attrs_to_search = $this->subAttributes;
+      $attrs_to_search[] = "FAIstate";
+      $ldap->search("(&(objectClass=FAIclass)(objectClass=".$this->subClass."))",$attrs_to_search);
+
+      while($object = $ldap->fetch()){
+
+        /* Skip objects, that are tagged as removed */
+        if(isset($object['FAIstate'][0])){
+          if(preg_match("/removed$/",$object['FAIstate'][0])){
+            continue;
+          }
+        }
+
+        /* Set status for save management */
+        $objects = array();
+        $objects['status']      = "FreshLoaded";
+        $objects['dn']          = $object['dn'];
+        $objects                = $this->get_object_attributes($objects,$this->subAttributes);
+        $this->SubObjects[$objects['cn']] = $objects;
+      }
+    
+    }
+    $this->ui = get_userinfo();
+  }
+
+
+  /* Reload some attributes */
+  function get_object_attributes($object,$attributes)
+  {
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->cat($object['dn'],$attributes);
+    $tmp  = $ldap->fetch();
+
+    foreach($attributes as $attrs){
+      if(isset($tmp[$attrs][0])){
+        $var = $tmp[$attrs][0];
+
+        /* Check if we must decode some attributes */
+        if(in_array_ics($attrs,$this->sub64coded)){
+          $var = base64_decode($var);
+        }
+
+        /*  check if this is a binary entry */
+        if(in_array_ics($attrs,$this->subBinary)){
+          $var = $ldap->get_attribute($object['dn'], $attrs,$r_array=0);
+        }
+
+        /* Fix slashes */
+        $var = addslashes($var);
+        $object[$attrs] = $var;
+      }
+    }
+    return($object);
+  }
+
+  
+  /* Return a valid dn to fetch acls. Because 'new' will not work. */
+  function acl_base_for_current_object($dn)
+  {
+    if($dn == "new"){
+      if($this->dn == "new"){
+        $dn= "cn=dummy,".$_SESSION['CurrentMainBase'];
+      }else{
+        $dn = $this->dn;
+      }
+    }
+    return($dn);
+  }
+
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","fai/".get_class($this),$this->dn);
+    }
+
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+    $display= "";
+
+    /* Add new sub object */
+    if(isset($_POST['AddSubObject'])){
+      $this->dialog= new $this->subClassName($this->config,"new");
+      $this->dialog->set_acl_base($this->acl_base);
+      $this->dialog->set_acl_category("fai");
+      $this->dialog->parent = &$this;
+      $this->is_dialog=true;
+    }
+
+    if($this->dn != "new"){
+      $_SESSION['objectinfo']= $this->dn;
+    }
+
+    /* Handle posts */
+    $s_action = $s_entry = "";
+    foreach($_POST as $name => $value){
+
+      /* Edit script posted */
+      if(preg_match("/^editscript_/",$name)){
+        $s_action = "edit";
+        $s_entry = preg_replace("/^editscript_/","",$name);
+        $s_entry = base64_decode(preg_replace("/_.*/","",$s_entry));
+        break;
+      }
+
+      /* Delete script requested */
+      if(preg_match("/^deletescript_/",$name)){
+        $s_action = "remove";
+        $s_entry = preg_replace("/^deletescript_/","",$name);
+        $s_entry = base64_decode(preg_replace("/_.*/","",$s_entry));
+        break;
+      }
+    }
+
+    if(isset($_GET['act']) && $_GET['act'] == "edit" && isset($_GET['id'])){
+      $s_entry = $_GET['id'];
+      if(isset($this->SubObjects[$s_entry])){
+        $s_action = "edit";
+      }
+    }
+
+    if($s_action =="edit" && isset($this->SubObjects[$s_entry])){
+
+      /* Get object, and load missing entry values */
+      $obj  = $this->SubObjects[$s_entry];
+      if($obj['status'] == "FreshLoaded"){
+        $obj  = $this->get_object_attributes($obj,$this->sub_Load_Later);
+      }
+
+      /* Create new dialog and set acl attributes  */
+      $this->dialog= new $this->subClassName($this->config,$this->dn,$obj);
+      $this->dialog->set_acl_base($this->acl_base_for_current_object($obj['dn']));
+      $this->dialog->set_acl_category("fai");
+
+      /* Assign some additional dialog informations like headline and parent  */
+      $_SESSION['objectinfo'] = $obj['dn'];
+      $this->dialog->parent = &$this;
+      $this->is_dialog=true;
+    }
+
+    /* Check acls, are we allowed to delete an entry */
+    if($s_action == "remove" && isset($this->SubObjects[$s_entry])){
+      $entry = $this->SubObjects[$s_entry];  
+      $acl = $this->ui->get_permissions($this->acl_base_for_current_object($entry['dn']),"fai/faiScriptEntry")  ;
+      if(preg_match("/d/",$acl)){
+        $status = $entry['status'];
+        if($status == "edited" || $status == "FreshLoaded"){
+          $this->SubObjects[$s_entry]['status']= "delete";
+        }else{
+          unset($this->SubObjects[$s_entry]);
+        }
+      }
+    }
+
+      /* Save the edited entry */
+    if(isset($_POST['SaveSubObject'])){
+
+      /* Check if there are still errors remaining that must be fixed before saving */
+      $this->dialog->save_object();
+      $msgs = $this->dialog->check();
+      if(count($msgs)>0){
+        foreach($msgs as $msg){
+          print_red($msg);
+        }
+      }else{
+
+        /* Get return object */
+        $obj = $this->dialog->save();
+
+        /* If we have renamed the script entry, we must remove the old entry */
+        if(isset($obj['remove'])){
+
+          /* Get old entry values */
+          $old_stat = $this->SubObjects[$obj['remove']['from']]['status'];
+
+          /* Depending on status, set new status */
+          if($old_stat == "edited" || $old_stat == "FreshLoaded"){
+            $this->SubObjects[$obj['remove']['from']]['status'] = "delete";
+          }elseif($this->SubObjects[$obj['remove']['from']]['status']=="new"){
+            unset($this->SubObjects[$obj['remove']['from']]);
+          }
+
+          /* Append the new entry */
+          $obj['status'] = "new";
+          $this->SubObjects[$obj['remove']['to']] = $obj;
+          unset($this->SubObjects[$obj['remove']['to']]['remove']);
+        }else{
+  
+          /* Set new status and append the entry */
+          if($obj['status'] == "FreshLoaded"){
+            $obj['status'] = "edited";
+          }
+          $this->SubObjects[$obj['cn']]=$obj;
+        }
+        $this->is_dialog=false;
+        unset($this->dialog);
+        $this->dialog=FALSE;
+
+      }
+    }
+
+    /* Sort entries */
+    $tmp = $keys = array();
+
+    if($this->sort_by == "name"){
+      foreach($this->SubObjects as $key => $entry){
+        $keys[$key]=$entry['cn'];
+      }
+    }elseif($this->sort_by == "priority"){
+      foreach($this->SubObjects as $key => $entry){
+        $keys[$key]=$entry['FAIpriority'];
+      }
+    }
+
+    natcasesort($keys);
+
+    if($this->sort_order == "down"){
+      $keys =array_reverse($keys);
+    }
+
+    foreach($keys as $key => $order_var){
+      $tmp[$key]=$this->SubObjects[$key];
+    }
+    $this->SubObjects = $tmp;
+
+    /* Cancel Dialog */
+    if(isset($_POST['CancelSubObject'])){
+      $this->is_dialog=false; 
+      unset($this->dialog);
+      $this->dialog=FALSE;
+    }
+
+    /* Print dialog if $this->dialog is set */
+    if(is_object($this->dialog)){
+      $this->dialog->save_object();
+      $display = $this->dialog->execute();
+      return($display);
+    }
+
+    /* Divlist            added 23.02.2006 
+       Containing FAIscripts 
+     */
+    $divlist = new divlist("FAIscripts");
+    $divlist->SetEntriesPerPage(0);
+    $plug = $_GET['plug'];
+   
+    if($this->sort_order == "up"){
+      $dir = "<img src='images/sort_up.png' title='"._("Sort direction")."' alt='\/' border=0>";
+    }else{
+      $dir = "<img src='images/sort_down.png' title='"._("Sort direction")."' alt='/\' border=0>";
+    }
+    if($this->sort_by == "name"){
+      $sort_name = $dir;
+      $sort_prio = "";
+    }else{
+      $sort_name = "";
+      $sort_prio = $dir;
+    }
+
+    $divlist->SetHeader(array(  array("string"=>"<a href='?plug=".$plug."&amp;sort=name'>"._("Name").$sort_name."</a>"),
+                                array("string"=>"<a href='?plug=".$plug."&amp;sort=priority'>".$sort_prio._("Priority")."</a>",
+                                      "attach"=>"style='width:100px;'"),
+                                array("string"=>_("Download"),
+                                      "attach"=>"style='width:100px;'"),
+                                array("string"=>_("Action"),
+                                      "attach"=>"style='border-right: 0px;width:100px;text-align:right;'")));
+    $divlist->SetHeight(300);
+    $divlist->SetWidth("100%");
+    foreach($this->getList(true) as $key => $name){
+
+      $dn= $this->acl_base_for_current_object($name['dn']);
+      $acl = $this->ui->get_permissions($dn,"fai/faiScriptEntry")  ;
+      $act = "";
+      
+      /* Hide delete icon if this object is freezed */
+      if($this->FAIstate == "freeze"){
+        $act .= "<input type='image' src='images/edit.png'      name='editscript_%s'    title='"._("edit")."' alt='"._("edit")."'>";
+      }else{
+        $act .= "<input type='image' src='images/edit.png'      name='editscript_%s'    title='"._("edit")."' alt='"._("edit")."'>";
+        if(preg_match("/d/",$acl)){
+          $act .="<input type='image' src='images/edittrash.png' name='deletescript_%s'  title='"._("delete")."' alt='"._("delete")."'>";
+        }
+      }
+
+      /* Check acls for download icon */
+      $s_acl = $this->ui->get_permissions($dn,"fai/faiScriptEntry","FAIscript")  ;
+      if(($this->SubObjects[$key]['status'] == "new") || ($this->SubObjects[$key]['dn'] == "new") || !preg_match("/r/",$s_acl)){
+        $down = "";
+      }else{
+        $down = "<a href='getFAIscript.php?id=".base64_encode($name['dn'])."' >
+          <img src='images/save.png' alt='"._("Download")."' title='"._("Download")."' border=0>
+          </a>"; 
+      } 
+
+      /* Check if we are allowed to view this object */
+      $s_acl = $this->ui->get_permissions($dn,"fai/faiScriptEntry","cn")  ;
+      if(preg_match("/r/",$s_acl)){
+        $divlist->AddEntry(array( array("string"=>"<a href='?plug=".$_GET['plug']."&amp;act=edit&amp;id=".$key."'>".$name['name']."</a>"),
+              array("string"=>$name['FAIpriority'] , "attach" => "style='width:100px;'"),
+              array("string"=>$down , "attach" => "style='width:100px;'"),
+              array("string"=>str_replace("%s",base64_encode($key),$act),
+                "attach"=>"style='border-right: 0px;width:100px;text-align:right;'")));
+      }
+    }
+    $smarty->assign("Entry_divlist",$divlist->DrawList());
+
+
+    /* Magic quotes GPC, escapes every ' " \, to solve some security risks
+     * If we post the escaped strings they will be escaped again
+     */
+    foreach($this->attributes as $attrs){
+      if(get_magic_quotes_gpc()){
+        $smarty->assign($attrs,stripslashes($this->$attrs));
+      }else{
+        $smarty->assign($attrs,($this->$attrs));
+      }
+    }
+
+    $dn = $this->acl_base_for_current_object($this->dn);
+    $smarty->assign("sub_object_is_addable",  
+        preg_match("/c/",$this->ui->get_permissions($dn,"fai/faiScriptEntry")) && 
+        !preg_match("/freeze/",$this->FAIstate));
+
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translated){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+    $display.= $smarty->fetch(get_template_path('faiScript.tpl', TRUE));
+    return($display);
+  }
+
+  /* Generate listbox friendly SubObject list
+   */
+  function getList($use_dns=false){
+    $a_return=array();
+    foreach($this->SubObjects as $obj){
+      if($obj['status'] != "delete"){
+        if($use_dns){
+          if((isset($obj['description']))&&(!empty($obj['description']))){
+            $a_return[$obj['cn']]['name']= $obj['cn']." [".stripslashes($obj['description'])."]";
+          }else{
+            $a_return[$obj['cn']]['name']= $obj['cn'];
+          }
+          $a_return[$obj['cn']]['dn']= $obj['dn'];
+          $a_return[$obj['cn']]['FAIpriority']= $obj['FAIpriority'];
+        }else{
+          if((isset($obj['description']))&&(!empty($obj['description']))){
+            $a_return[$obj['cn']]= $obj['cn']." [".stripslashes($obj['description'])."]";
+          }else{
+            $a_return[$obj['cn']]= $obj['cn'];
+          }
+        }
+      }
+    }
+    return($a_return);
+  }
+
+  /* Delete me, and all my subtrees
+   */
+  function remove_from_parent()
+  {
+    if($this->acl_is_removeable()){
+      $ldap = $this->config->get_ldap_link();
+      $ldap->cd ($this->dn);
+
+      $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $this->dn);
+      if($_SESSION['faifilter']['branch'] == "main"){
+        $use_dn = $this->dn;
+      }
+   
+      new log("remove","fai/".get_class($this),$use_dn,$this->attributes);
+      prepare_to_save_FAI_object($use_dn,array(),true);
+      
+      foreach($this->SubObjects as $name => $obj){
+        $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $obj['dn']);
+        if($_SESSION['faifilter']['branch'] == "main"){
+          $use_dn = $obj['dn'];
+        }
+        prepare_to_save_FAI_object($use_dn,array(),true);
+      }
+      $this->handle_post_events("remove");
+    }
+  }
+
+
+  /* Save data to object 
+   */
+  function save_object()
+  {
+    if((isset($_POST['FAIscript_posted'])) && ($this->FAIstate != "freeze")){
+      plugin::save_object();
+      foreach($this->attributes as $attrs){
+        if(isset($_POST[$attrs])){
+          $this->$attrs = $_POST[$attrs];
+        }
+      }
+    }
+    
+    /* Get sort order */
+    if(isset($_GET['sort']) && in_array($_GET['sort'],array("name","priority"))){
+      if($this->sort_by == $_GET['sort']){
+        if($this->sort_order == "up"){
+          $this->sort_order = "down";
+        }elseif($this->sort_order == "down"){
+          $this->sort_order = "up";
+        }
+      }
+      $this->sort_by = $_GET['sort'];
+    }
+  }
+
+
+  /* Check supplied data */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    return ($message);
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    plugin::save();
+
+    $ldap = $this->config->get_ldap_link();
+
+    prepare_to_save_FAI_object($this->dn,$this->attrs);
+    show_ldap_error($ldap->get_error(), sprintf(_("Creating of FAI/script with dn '%s' failed."),$this->dn));
+
+    if($this->initially_was_account){
+      new log("modify","fai/".get_class($this),$this->dn,$this->attributes);
+    }else{
+      new log("create","fai/".get_class($this),$this->dn,$this->attributes);
+    }
+
+    /* Do object tagging */
+    $this->handle_object_tagging();
+
+    /* Prepare FAIscriptEntry to write it to ldap
+     * First sort array.
+     *  Because we must delete old entries first.
+     * After deletion, we perform add and modify 
+     */
+    $Objects = array();
+
+    /* We do not need to save untouched objects */
+    foreach($this->SubObjects as $name => $obj){
+      if($obj['status'] == "FreshLoaded"){
+        unset($this->SubObjects[$name]);
+      }
+    }
+
+    foreach($this->SubObjects as $name => $obj){
+      if($obj['status'] == "delete"){
+        $Objects[$name] = $obj; 
+      }
+    }
+    foreach($this->SubObjects as $name => $obj){
+      if($obj['status'] != "delete"){
+        $Objects[$name] = $obj; 
+      }
+    }
+
+    foreach($Objects as $name => $obj){
+
+      foreach($this->sub64coded as $codeIt){
+        $obj[$codeIt]=base64_encode(stripslashes($obj[$codeIt]));
+      }
+
+      $tmp = array();
+      $attributes = array_merge($this->sub_Load_Later,$this->subAttributes);
+      foreach($attributes as $attrs){
+
+        if(empty($obj[$attrs])){
+          $obj[$attrs] = array();
+        }
+        if(!is_array($obj[$attrs])){
+          $tmp[$attrs] = stripslashes($obj[$attrs]);
+        }else{
+          $tmp[$attrs] = $obj[$attrs];
+        }
+      }    
+
+      $tmp['objectClass'] = $this->subClasses;
+
+      $sub_dn = "cn=".$obj['cn'].",".$this->dn;
+
+      if($obj['status']=="new"){
+        $ldap->cat($sub_dn,array("objectClass"));
+        if($ldap->count()){
+          $obj['status']="edited";
+        }
+      }
+
+      if(empty($tmp['FAIpriority'])){
+        $tmp['FAIpriority']  ="0";
+      }
+
+      /* Check if gosaAdministrativeUnitTag is required as object class */
+      if($obj['status'] == "edited"){
+        $ldap->cat($sub_dn,array("objectClass"));
+        $attrs = $ldap->fetch();
+        if(isset($attrs['objectClass'])){
+          if(in_array_ics("gosaAdministrativeUnitTag",$attrs['objectClass'])){
+            $tmp['objectClass'][] = "gosaAdministrativeUnitTag";
+          }
+        }
+      }
+
+      if($obj['status'] == "delete"){
+        prepare_to_save_FAI_object($sub_dn,array(),true);
+        $this->handle_post_events("remove");
+      }elseif($obj['status'] == "edited"){
+        prepare_to_save_FAI_object($sub_dn,$tmp);
+        $this->handle_post_events("modify");
+      }elseif($obj['status']=="new"){
+        prepare_to_save_FAI_object($sub_dn,$tmp);
+        $this->handle_post_events("add");
+      }
+
+      $this->handle_object_tagging($sub_dn, $this->gosaUnitTag);
+    }
+  }
+
+
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);
+
+    /* Read all leaf objects of this object (For FAIscript this would be FAIscriptEntry)
+     */
+    $ldap     = $this->config->get_ldap_link();
+    $ldap->cd ($source['dn']);
+
+    $attrs_to_search = $this->subAttributes;
+    $attrs_to_search[] = "FAIstate";
+    $ldap->search("(&(objectClass=FAIclass)(objectClass=".$this->subClass."))",$attrs_to_search);
+
+    while($object = $ldap->fetch()){
+
+      /* Skip objects, that are tagged as removed */
+      if(isset($object['FAIstate'][0])){
+        if(preg_match("/removed$/",$object['FAIstate'][0])){
+          continue;
+        }
+      }
+
+      /* Set status for save management */
+      $objects = array();
+      $objects['status']      = "edited";
+      $objects['dn']          = $object['dn'];
+      $objects                = $this->get_object_attributes($objects,$this->subAttributes);
+      $objects                = $this->get_object_attributes($objects,$this->sub_Load_Later);
+  
+      $this->SubObjects[$objects['cn']] = $objects;
+    }
+  }
+  
+
+  /* Return plugin informations for acl handling */ 
+  static function plInfo()
+  {
+    return (array( 
+          "plShortName" => _("Script"),
+          "plDescription" => _("FAI script"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 18,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("fai"),
+          "plProvidedAcls" => array(
+            "cn"                => _("Name")." ("._("Readonly").")",
+            "description"       => _("Description"))
+          ));
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/fai/class_faiScriptEntry.inc b/gosa-core/plugins/admin/fai/class_faiScriptEntry.inc
new file mode 100644 (file)
index 0000000..0321329
--- /dev/null
@@ -0,0 +1,198 @@
+<?php
+
+class faiScriptEntry 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","description","FAIpriority","FAIscript");
+  var $objectclasses= array();
+
+  var $orig_cn              = "";
+
+  var $dn            = "";
+  var $cn            = "";
+  var $FAIpriority   = "0";
+  var $FAIscript     = "";
+  var $description   = "";
+  var $status        = "new";
+  var $parent        = NULL;
+  var $FAIstate      = "";
+  
+  function faiScriptEntry (&$config, $dn= NULL,$object=false)
+  {
+    plugin::plugin ($config, $dn);
+    if($dn != "new"){
+      $this->orig_cn= $object['cn'];
+      $this->dn=$object['dn'];
+      foreach($object as $name=>$value){
+        $oname = $name;
+        $this->$oname=$value;
+      }
+
+      if(isset($this->attrs['FAIstate'][0])){
+        $this->FAIstate = $this->attrs['FAIstate'][0];
+      }
+
+    }else{
+      if(is_array($object)&&count($object)){
+        $this->orig_cn= $object['cn'];
+        $this->dn=$object['dn'];
+        foreach($object as $name=>$value){
+          $oname = $name;
+          $this->$oname=$value;
+        }
+      }else{
+
+        $this->status = "new";
+        $this->orig_cn       = false;
+      }
+    }
+  }
+
+  function execute()
+  {
+       /* Call parent execute */
+       plugin::execute();
+
+    /* Fill templating stuff */
+    $smarty     = get_smarty();
+    $display = "";
+  
+    if(isset($_POST['ImportUpload']) && $this->acl_is_writeable("FAIscript")){
+      if(($_FILES['ImportFile']['error']!=0)){
+        print_red(_("Please select a valid file."));
+      }else
+      if(($_FILES['ImportFile']['size']==0)){
+        print_red(_("Selected file is empty."));
+      }else{
+        $str = utf8_encode(addslashes(file_get_contents($_FILES['ImportFile']['tmp_name'])));
+        $this->FAIscript = $str;
+      }
+    }
+  
+    foreach($this->attributes as $attrs){
+      if(get_magic_quotes_gpc()){
+       $smarty->assign($attrs,stripslashes($this->$attrs));
+      }else{
+       $smarty->assign($attrs,($this->$attrs));
+      } 
+    }
+
+     /* Create download button*/
+    if($this->dn != "new" && $this->acl_is_readable("FAIscript")){
+      $smarty->assign("DownMe","<a href='getFAIscript.php?id=".base64_encode($this->dn)."'>
+        <input type='button' value='"._("Download")."'>
+        </a>");
+    }else{
+      $smarty->assign("DownMe","");
+    }
+
+    for($i =0 ; $i < 100 ; $i++){
+      $FAIprioritys[$i]=$i;
+    }
+
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translated){
+      $acl = $this->getacl($name);
+      if($this->FAIstate == "freezed"){
+        $acl = preg_replace("/w/","",$acl);
+      }
+      $smarty->assign($name."ACL",$acl);
+    }
+
+    $smarty->assign("FAIprioritys",$FAIprioritys);
+    if(get_magic_quotes_gpc()){
+      $smarty->assign("FAIscript" , htmlentities(stripslashes($this->FAIscript)));
+    }else{
+      $smarty->assign("FAIscript" , htmlentities($this->FAIscript));
+    }
+    $display.= $smarty->fetch(get_template_path('faiScriptEntry.tpl', TRUE));
+    return($display);
+  }
+
+  /* Save data to object */
+  function save_object()
+  {
+    if((isset($_POST['SubObjectFormSubmitted'])) && ($this->FAIstate != "freeze")){
+      foreach($this->attributes as $attrs){
+        if($this->acl_is_writeable($attrs)){
+          if(isset($_POST[$attrs])){
+            $this->$attrs = $_POST[$attrs];
+          }else{
+            $this->$attrs = "";
+          }
+        }
+      }
+    }
+  }
+
+  /* Check supplied data */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+  
+    if(isset($this->parent->SubObjects[$this->cn]) && $this->cn != $this->orig_cn){
+      $message[] =_("There is already a script with the given name.");
+    }
+
+    if(empty($this->cn)){
+      $message[] = _("Please enter a name.");
+    }
+
+    if(empty($this->FAIscript)){
+      $message[]=_("Please enter a script.");
+    }
+
+    return ($message);
+  }
+  function save()
+  {
+    $tmp=array();
+    foreach($this->attributes as $attrs){ 
+      $tmp[$attrs] = $this->$attrs;
+    }
+
+    /* Strip out dos newlines */
+    $tmp['FAIscript']= strtr($this->FAIscript, array("\x0D" => ""));
+
+    if(($this->orig_cn)&&($tmp['cn']!=$this->orig_cn)){
+      $tmp['remove']['from']  = $this->orig_cn;
+      $tmp['remove']['to']    = $tmp['cn'];
+    }
+  
+    $tmp['dn']      = $this->dn;  
+    $tmp['status']  = $this->status; 
+    return($tmp);
+  }
+
+  
+  /* Return plugin informations for acl handling */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName" => _("Script entry"),
+          "plDescription" => _("FAI script entry"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 19,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("fai"),
+          "plProvidedAcls" => array(
+            "cn"              => _("Name"),
+            "description"     => _("Description"),
+            "FAIscript"       => _("Script entry"),
+            "FAIpriority"     => _("Script Priority"))
+          ));
+  }
+
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/fai/class_faiSummaryTab.inc b/gosa-core/plugins/admin/fai/class_faiSummaryTab.inc
new file mode 100644 (file)
index 0000000..a9bfbb8
--- /dev/null
@@ -0,0 +1,583 @@
+<?php
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) Fabian Hickert 
+
+   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 faiSummaryTab extends plugin{
+
+  var $Classes        = array();
+  var $Release        = "";
+  var $Releases       = array();
+  var $Result         = array();
+  var $objs              = array();
+  var $ObjectList     = "";
+  var $is_dialog      = false;
+  var $InitCalled     = false;
+  var $usedClasses    = array();
+  var $base           = ""; 
+  var $parent         = NULL; 
+  var $ui             = NULL;
+
+  function faiSummaryTab(&$config,$dn)//,$parent)
+  {
+    plugin::plugin($config,$dn);//,$parent);
+
+    $this->ui = get_userinfo();
+
+    /* Base object configuration */
+    $this->objs = array(       
+        "FAIscript"                => array(   "Image" =>"images/fai_script.png",        "Name"=>_("Scripts")      ,"Tree"     =>"ou=scripts,") ,
+        "FAIhook"                          => array(   "Image" =>"images/fai_hook.png" ,         "Name"=>_("Hooks")        ,"Tree"     =>"ou=hooks,"),
+        "FAIvariable"            => array(     "Image" =>"images/fai_variable.png",      "Name"=>_("Variables")    ,"Tree"     =>"ou=variables,") ,
+        "FAItemplate"            => array(     "Image" =>"images/fai_template.png",      "Name"=>_("Templates")    ,"Tree"     =>"ou=templates,") ,
+        "FAIpartitionTable" => array(  "Image" =>"images/fai_partitionTable.png","Name"=>_("Partition table")  ,"Tree" =>"ou=disk,") ,
+        "FAIpackageList"         => array(     "Image" =>"images/fai_packages.png",      "Name"=>_("Package list") ,"Tree"     =>"ou=packages,") ,
+        "FAIprofile"               => array(   "Image" =>"images/fai_profile.png",       "Name"=>_("Profiles")     ,"Tree"     =>"ou=profiles,"));
+  }
+
+
+  /* Init the fai tree with objects.
+     If this method is called, all assigned classes and the release name 
+      will be read from parent object. */
+  function init()
+  {
+    $this->InitCalled = true;
+    $this->Result = array();
+    $_SESSION['faiSummaryTab']['UniqueID'] = 0; 
+  
+    /* Get classes & release name 
+       There are 2 different tabs which use the summary tab
+       faiProfile / Workstations */
+    
+    /* Check if given parent object is fai profile tabs */
+    if(isset($this->parent->by_name['faiProfile'])){
+      
+      /* Get Classes and release */
+      $this->Classes = $this->parent->by_object['faiProfile']->FAIclasses;
+      $this->base    = $this->parent->by_object['faiProfile']->base;
+      $str = preg_replace("/^.*ou=profiles,/","",$this->dn);
+  
+    /* Check if parent tab is work tab */
+    }elseif(isset($this->parent->by_name['workstartup'])){
+      $this->Classes = $this->parent->by_object['workstartup']->FAIclass;
+      $this->Release = $this->parent->by_object['workstartup']->FAIrelease;
+
+      /* Check if this is a workstation or an object group */
+      if(isset($this->parent->by_object['workgeneric'])){
+        $this->base    = $this->parent->by_object['workgeneric']->base;
+      }elseif(isset($this->parent->by_object['ogroup'])){
+        $this->base    = $this->parent->by_object['ogroup']->base;
+      }elseif(isset($this->parent->by_object['servgeneric'])){
+        $this->base    = $this->parent->by_object['servgeneric']->base;
+      }else{
+        print_red(_("Unknown type of FAI source information. This is not a profile, workstation nor a ogroup."));
+      }
+      
+      /* Append workstation class && LAST */
+      if(isset($this->parent->by_object['workgeneric']->cn)){
+        $this->Classes[] = $this->parent->by_object['workgeneric']->cn;
+      }
+    }
+
+    $tmp = array_flip($this->getBranches());
+
+    $this->Classes[] = "LAST";
+
+    /* You need full access to complete collection of fai acls to view this summary */
+    $acl = $this->ui->has_complete_category_acls($this->base,"fai");
+    if(!preg_match("/r/",$acl)){
+      $this->Classes = array();
+    }
+
+    /* Set all available releases */
+    $this->Releases = $tmp;
+    $this->usedClasses = array();
+
+    /* Check the configuration */
+    if(count($this->Classes) && (!empty($this->Release))){
+      foreach($this->Classes as $class){
+        $this->resolveObject($class);
+      }
+    }
+  }
+
+
+  /* Capture posts, and call opnen close tag */
+  function save_object()
+  {
+    $once = true;
+
+    if(isset($_GET['expand']) && isset($_GET['id'])){
+      if(isset($this->Result[$_GET['id']])){
+        $this->Result[$_GET['id']]['Open'] =true  ;
+      }
+    }
+
+    if(isset($_GET['compress']) && isset($_GET['id'])){
+      if(isset($this->Result[$_GET['id']])){
+        unset($this->Result[$_GET['id']]['Open']);
+      }
+    }
+
+    foreach($_POST as $name => $value ){
+
+      /* check for open tag request */
+      if(preg_match("/^open_/",$name) && $once){
+        $once  = false;
+        $value = preg_replace("/^open_/","",$name);
+        $value = preg_replace("/_.*$/","",$value); 
+        $this->Result[$value]['Open'] =true  ;
+      }
+      /* Check for close tag request */
+      if(preg_match("/^close_/",$name) && $once){
+        $once  = false;
+        $value = preg_replace("/^close_/","",$name);
+        $value = preg_replace("/_.*$/","",$value); 
+        unset($this->Result[$value]['Open']);
+      }
+      if(preg_match("/^reloadList/",$name)){
+        $this->InitCalled = false;
+      }
+    }
+  }
+
+
+  /* returns an array with all possibly release types */
+  function getBranches($base = false,$prefix = "")
+  {
+    if(!$base){
+      $base = $this->base;
+    }
+    return(get_all_releases_from_base($base,true));
+  }
+
+
+  /* This function calls all nescessary functions to generate the fai class summary tree */
+  function execute() 
+  {
+
+    /* Skip this if fai is deactivated */
+    $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
+    if(empty($tmp)){
+      $str = "<h2>"._("You can't use this plugin until FAI is activated.")."</h2>";
+      return $str;
+    }    
+
+    /* Check if we must (re)init the this tab */
+    if(!$this->InitCalled){
+      $this->init();
+    }
+
+    if(isset($_GET['show'])){
+      $ldap = $this->config->get_ldap_link();
+      $ldap->cat(base64_decode($_GET['id']), array('FAIscript', 'FAIhook', 'FAItemplateFile'));
+      $attrs = $ldap->fetch();
+      if($_GET['type'] == "FAIscript"){
+        $str = $attrs['FAIscript'][0];
+      }elseif($_GET['type'] == "FAIhook"){
+        $str = $attrs['FAIscript'][0];
+      }elseif($_GET['type'] == "FAItemplate"){
+        $str = $attrs['FAItemplateFile'][0];
+      }
+      echo "<pre>".$str."</pre>";
+      exit();
+    }
+
+    /* Get smarty class & assign created summary results */
+    $smarty = get_smarty();
+    $acl = $this->ui->has_complete_category_acls($this->base,"fai");
+    $smarty->assign("readable", preg_match("/r/",$acl));
+
+    $this->ObjectList = $this->createSummary($this->Result);
+    $smarty->assign("objectList",$this->ObjectList);
+    return($smarty->fetch (get_template_path('faiSummary.tpl', TRUE, dirname(__FILE__))));
+  }
+
+
+  /* Create output of from resolved fai objects */
+  function createSummary($data)
+  {
+    /* Don't generate any output, if there is no result */ 
+    $str ="<table cellspacing=0 cellpadding=2 style='width:100%;background:#F5F5F5;'> ";
+    if(!count($this->Result)){
+      $str.="<tr><td>"; 
+      $str.= (_("This object has no FAI classes assigned."));
+      $str.= "</tr></td></table>";
+      return($str);
+    }
+
+    /* walk through all classes */     
+    foreach($data as $key => $entry){
+      
+      $image = "<img src='".$this->objs[$key]['Image']."' class='center' alt='".$this->objs[$key]['Name']."' border=0>";
+      if(!isset($entry['Open'])){
+        $str .= "<tr>
+                  <td colspan=2>
+                   <a href='?plug=".$_GET['plug']."&amp;expand&amp;id=".$key."'>
+                    <img border=0 class='center' src='images/expand.png' alt='"._("Open")."'>&nbsp;";
+        $str .=     $image."&nbsp;";
+        $str .= "   <b>".$this->objs[$key]['Name']."</b></a></td></tr>";
+      }else{
+        $str .= "<tr><td colspan=2>
+                    <a href='?plug=".$_GET['plug']."&amp;compress&amp;id=".$key."'>
+                   <img border=0 class='center' src='images/sort_down.png' alt='"._("Close")."'>&nbsp;";
+        $str .= $image."&nbsp;";
+        $str .= "<b>".$this->objs[$key]['Name']."</b></a></td></tr>";
+   
+        /* Display FAItemplate FAIhook FAIscript entries */ 
+        if(in_array($key,array("FAItemplate","FAIhook","FAIscript"))){
+
+          $nums = array();          
+          $tmp  = array();
+          if($key == "FAIscript"){
+            if(is_array($entry['Entries'])){
+              foreach($entry['Entries'] as $scripts){
+                foreach($scripts as $script){
+
+                  if(!isset($nums[$script['cn'][0]])){
+                    $nums[$script['cn'][0]]= 0;
+                  } 
+                  $nums[$script['cn'][0]] ++;
+
+                  $tmp[$script['FAIpriority'][0].$script['cn'][0].$script['CLASS']] = $script;
+                }
+              }
+            }
+            krsort($tmp);;
+            
+            $entry['Entries'] = $tmp;
+          }else{
+            $tmp = array();
+            foreach($entry['Entries'] as $script){
+              $tmp[$script['cn'][0].$script['CLASS']] = $script;
+              if(!isset($nums[$script['cn'][0]])){
+                $nums[$script['cn'][0]]= 0;
+              } 
+              $nums[$script['cn'][0]] ++;
+            }
+             ksort($tmp);
+            $entry['Entries'] = $tmp;
+          }
+
+          foreach($entry['Entries'] as $cn => $data){
+
+            if(isset($nums[$data['cn'][0]]) && ($nums[$data['cn'][0]] > 1)){
+              $str .="<tr style='background: #EE3434;'><td style='padding-left:20px;'>";
+            }else{
+              $str .="<tr><td style='padding-left:20px;'>";
+            }
+
+            $str .= "<a target='_blank' href='?plug=".$_GET['plug']."&amp;show&amp;type=".$key."&amp;id=".base64_encode($data['dn'])."'>";
+            $str .= $image."&nbsp;";
+            if(isset($data['FAIpriority'][0])){
+              $str .= "(".$data['FAIpriority'][0].")";
+            }
+
+            $str .= "&nbsp;".$data['cn'][0];
+            if(isset($data['description'][0])){
+              $str .= " [".$data['description'][0]."]";
+            }
+            $str .= "</a>";
+            $str .= "</td><td><i>".$data['CLASS']."</i>";
+            $str .= "</td></tr>";
+          }
+        }
+
+        /* Create variable entries */
+        if(in_array($key,array("FAIvariable"))) {
+          foreach($entry['Entries'] as $cn => $data){
+            $str .="<tr><td style='padding-left:20px;'>";
+            $str .= $image."&nbsp;".$data['cn'][0];
+            if(isset($data['description'][0])){
+              $str .= " [".$data['description'][0]."] ";
+            }
+            /* Only display FAIvariableContent if description dosn't contain [*] */ 
+            if(isset($data['description'][0]) && !preg_match("#\[\*\]#",$data['description'][0])){
+              $str .=" = '".$data['FAIvariableContent'][0]."'";
+            }
+            $str .= "</td><td><i>".$data['CLASS']."</i>";
+            $str .="</td></tr>";
+          }
+        }
+
+        /* Create packagelist entries */ 
+        if(in_array($key,array("FAIpackageList"))) {
+          ksort($entry['Entries']);
+          foreach($entry['Entries'] as $data){
+            $str .="<tr><td style='padding-left:20px;'>";
+            $str .= $image."&nbsp;".$data['cn'][0];
+            $str .= "</td><td><i>".$data['CLASS']."</i>";
+            $str .= "</td></tr>";;
+          }
+        }
+
+        /* Create partition table entries */
+        if(in_array($key,array("FAIpartitionTable"))) {
+          foreach($entry['Entries'] as $cn => $data){
+            $str .= "<tr><td style='padding-left:20px;'>";
+            $str .= $image."&nbsp;".$data['name'];
+            $str .= "</td><td><i>".$data['CLASS']."</i>";
+            $str .= "</td></tr>";
+            ksort($data['partitions']);
+
+            $str .= "<tr><td colspan=2  style='padding-left:20px;'>";
+            $str .= "<table cellspacing=0 cellpadding=2 style='background:#FFFFFF;border:1px solid #B0B0B0'>
+                      <tr style='background-color:#DBDBDB;'>
+                       <td class='tbhead'>"._("No.")."</td>
+                       <td class='tbhead'>"._("Name")."</td>
+                       <td class='tbhead'>"._("FS options")."</td>
+                       <td class='tbhead'>"._("Mount options")."</td>
+                       <td class='tbhead'>"._("Size in MB")."</td>
+                       <td class='tbhead'>"._("Mount point")."</td>
+                       <td class='tbrhead'>"._("Type")."</td>
+                      </tr>";
+
+            $i = 0;
+            foreach($data['partitions'] as $key => $part){
+              $i ++;
+
+              if($i%2 == 1){
+                $c = " class='rowxp1'";
+                $d = " class='list1'";
+              }else{
+                $c = " class='rowxp0'";
+                $d = " class='list0'";
+              }
+
+              $str.="<tr $c style='height:10px;'>
+                      <td $d>".$i."</td> 
+                      <td $d>".$part['cn'][0]."</td> 
+                      <td $d>".$part['FAIfsType'][0]."</td> 
+                      <td $d>".$part['FAIfsOptions'][0]."</td> 
+                      <td $d>".$part['FAIpartitionSize'][0]."</td> 
+                      <td $d>".$part['FAImountPoint'][0]."</td> 
+                      <td $d style='border:none'>".$part['FAIpartitionType'][0]."</td> 
+                    </tr>";
+            }
+            $str .="</table>";
+          }
+        }
+      }
+    }
+    $str .="</table>"; 
+    return($str);
+  }
+
+
+  /* resolve specified object to append it to our object tree */
+  function resolveObject($class)
+  {
+    $ldap                = $this->config->get_ldap_link();
+    $dn                    = $this->Releases [$this->Release];
+    $resolvedClasses  = get_all_objects_for_given_base($dn,"(&(objectClass=FAIclass)(cn=".$class."))");
+
+    /* Try to fetch all types of fai objects with the given cn  */
+    foreach($resolvedClasses as $obj){
+
+      $dn = $obj['dn'];
+      $ldap->cat($dn);
+
+      while($attrs = $ldap->fetch()){
+
+        foreach($this-> objs as $key => $rest){
+          if(in_array($key,$attrs['objectClass'])){
+
+            if(!isset($this->usedClasses[$key][$class])){
+              $this->usedClasses[$key][$class] = true;
+              switch($key){
+                case "FAIprofile":                     $this->prepare_FAIprofile($attrs);break;
+                case "FAIscript":                      $this->prepare_FAIscript($attrs);break;
+                case "FAIhook":                          $this->prepare_FAIhook($attrs);break;
+                case "FAIvariable":                    $this->prepare_FAIvariable($attrs);break;
+                case "FAItemplate":                    $this->prepare_FAItemplate($attrs);break;
+                case "FAIpackageList":       $this->prepare_FAIpackageList($attrs);break;
+                case "FAIpartitionTable":          $this->prepare_FAIpartitionTable($attrs);break;
+              }
+            }
+
+          }
+        }
+      }
+    }
+  }
+
+  /* Prepare fai script */
+  function prepare_FAIscript($data)
+  {
+    if(isset($this->Result['FAIscript']['Entries'])){
+      $current = $this->Result['FAIscript']['Entries'];
+    }else{
+      $current = array();
+    }
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($data['dn']);
+    $ldap->search("(objectClass=FAIscriptEntry)",array("cn","description","FAIpriority"));
+    while($attrs = $ldap->fetch()){
+      $attrs['CLASS'] = $data['cn'][0];
+      $current[$attrs['FAIpriority'][0]][] = $attrs;
+    }
+    $this->Result['FAIscript']['Entries'] = $current ;
+  }
+
+
+  /* Prepare fai script */
+  function prepare_FAIpartitionTable($data)
+  {
+    if(isset($this->Result['FAIpartitionTable']['Entries'])){
+      $current = $this->Result['FAIpartitionTable']['Entries'];
+    }else{
+      $current = array();
+    }
+
+    /* get subentries */
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($data['dn']);
+    $ldap->search("(objectClass=FAIpartitionDisk)",array("cn","description"));
+    $disks = array();
+
+    /* Create an array which is sortable by priority */
+    while($attrs = $ldap->fetch()){
+      $attrs['CLASS'] = $data['cn'][0];
+      $disks[$attrs['cn'][0]]= $attrs;
+      if(isset($attrs['description'][0])){
+        $disks[$attrs['cn'][0]]['name'] = $attrs['cn'][0]." [".$attrs['description'][0]."]";
+      }else{
+        $disks[$attrs['cn'][0]]['name'] = $attrs['cn'][0];
+      }
+      $disks[$attrs['cn'][0]]['dn'] = $attrs['dn'];
+      $disks[$attrs['cn'][0]]['partitions'] = array();
+    }
+
+    /* Sort by priority */
+    foreach($disks as $key => $disk){
+      $ldap->cd($disk['dn']);
+      $ldap->search("(objectClass=FAIpartitionEntry)",array("*"));
+      while($attrs = $ldap->fetch()){
+        if(!isset($attrs['FAIfsOptions'][0])){
+          $attrs['FAIfsOptions'][0] = "";
+        }
+        $attrs['CLASS'] = $data['cn'][0];
+        $disks[$key]['partitions'][$attrs['cn'][0]] = $attrs;
+      }
+    }
+    $this->Result['FAIpartitionTable']['Entries'] = $disks;
+  }
+
+
+  /* Create template entry */  
+  function prepare_FAItemplate($data)
+  {
+    $current = array();
+    if(isset($this->Result['FAItemplate']['Entries'])){
+      $current = $this->Result['FAItemplate']['Entries'];
+    }
+
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($data['dn']);
+    $ldap->search("(objectClass=FAItemplateEntry)",array("cn","description"));
+    while($attrs = $ldap->fetch()){
+      $attrs['CLASS'] = $data['cn'][0];
+      $current[] = $attrs;
+    }
+    $this->Result['FAItemplate']['Entries'] = $current ;
+  }
+
+
+  /* Create a package list  */ 
+  function prepare_FAIpackageList($data)
+  {
+    $current = array();
+    if(isset($this->Result['FAIpackageList']['Entries'])){
+      $current = $this->Result['FAIpackageList']['Entries'];
+    }
+    if(isset($data['FAIpackage'])){
+      unset($data['FAIpackage']['count']);
+      foreach($data['FAIpackage'] as $pkg){
+        $attrs['CLASS'] = $data['cn'][0];
+        $attrs['cn'][0] = $pkg;
+        $current[$pkg] = $attrs;
+      }
+    }
+    $this->Result['FAIpackageList']['Entries'] = $current ;
+  }
+
+
+  /* Create a variable entry */        
+  function prepare_FAIvariable($data)
+  {
+    $current = array();
+    if(isset($this->Result['FAIvariable']['Entries'])){
+      $current = $this->Result['FAIvariable']['Entries'];
+    }
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($data['dn']);
+    $ldap->search("(objectClass=FAIvariableEntry)",array("cn","description","FAIvariableContent"));
+    while($attrs = $ldap->fetch()){
+      $attrs['CLASS'] = $data['cn'][0];
+      $current[] = $attrs;
+    }
+    $this->Result['FAIvariable']['Entries'] = $current ;
+  }
+
+  /* Create a hook entry */    
+  function prepare_FAIhook($data)
+  {
+    $current = array();
+    if(isset($this->Result['FAIhook']['Entries'])){
+      $current = $this->Result['FAIhook']['Entries'];
+    }
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($data['dn']);
+    $ldap->search("(objectClass=FAIhookEntry)",array("cn","description"));
+    while($attrs = $ldap->fetch()){
+      $attrs['CLASS'] = $data['cn'][0];
+      $current[$attrs['cn'][0]] = $attrs;
+    }
+    $this->Result['FAIhook']['Entries'] = $current ;
+  }
+
+
+  /* Create a new Profile entry */
+  function prepare_FAIprofile($data)
+  {
+    $classes = split("\ ",$data['FAIclass'][0]);
+    foreach($classes as $class){
+      $class = trim($class);
+      $this->resolveObject($class);
+    }
+  }
+
+  /* Return plugin informations for acl handling * /
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Summary"),
+          "plDescription" => _("FAI summary"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 15,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("workstation","server","fai","ogroups") ,
+          "plProvidedAcls"=> array(
+            "readable" => _("Viewable")),
+          ));
+  }
+  */
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/fai/class_faiTemplate.inc b/gosa-core/plugins/admin/fai/class_faiTemplate.inc
new file mode 100644 (file)
index 0000000..5f4fcbf
--- /dev/null
@@ -0,0 +1,579 @@
+<?php
+
+class faiTemplate 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;
+
+  /* Attributes for this Object */
+  var $attributes       = array("cn","description");
+
+  /* ObjectClasses for this Object*/
+  var $objectclasses    = array("top","FAIclass","FAItemplate");
+
+  /* Class name of the Ldap ObjectClass for the Sub Object */
+  var $subClass         = "FAItemplateEntry";
+  var $subClasses       = array("top","FAIclass","FAItemplateEntry");
+
+  /* Class name of the php class which allows us to edit a Sub Object */
+  var $subClassName     = "faiTemplateEntry";      
+
+  /* Attributes to initialise for each subObject */
+  var $subAttributes    = array("cn","description","FAItemplatePath","FAIowner","FAImode");
+  var $sub_Load_Later   = array("FAItemplateFile"); 
+  var $sub64coded       = array();
+  var $subBinary        = array("FAItemplateFile");
+
+  /* Specific attributes */
+  var $cn               = "";       // The class name for this object
+  var $description      = "";       // The description for this set of partitions
+  var $is_dialog        = false;    // specifies which buttons will be shown to save or abort
+  var $SubObjects       = array();  // All leafobjects of this object
+
+  var $FAIstate         = "";
+  var $ui;
+  var $view_logged      = FALSE;
+
+  function faiTemplate (&$config, $dn= NULL)
+  {
+    /* Load Attributes */
+    plugin::plugin ($config, $dn);
+
+    /* If "dn==new" we try to create a new entry
+     * Else we must read all objects from ldap which belong to this entry.
+     * First read SubObjects from ldap ... and then the partition definitions for the SubObjects.
+     */
+    if($dn != "new"){
+      $this->dn =$dn;
+
+      /* Get FAIstate
+       */
+      if(isset($this->attrs['FAIstate'][0])){
+        $this->FAIstate = $this->attrs['FAIstate'][0];
+      }
+
+      /* Read all leaf objects of this object (For FAIscript this would be FAIscriptEntry)
+       */
+      $ldap     = $this->config->get_ldap_link();
+      $ldap->cd ($this->dn);
+    
+      $attrs_to_search = $this->subAttributes;
+      $attrs_to_search[] = "FAIstate";
+      $ldap->search("(&(objectClass=FAIclass)(objectClass=".$this->subClass."))",$attrs_to_search);
+
+      while($object = $ldap->fetch()){
+
+        /* Skip objects, that are tagged as removed */
+        if(isset($object['FAIstate'][0])){
+          if(preg_match("/removed$/",$object['FAIstate'][0])){
+            continue;
+          }
+        }
+
+        /* Set status for save management */
+        $objects = array();
+        $objects['status']      = "FreshLoaded";
+        $objects['dn']          = $object['dn'];
+        $objects                = $this->get_object_attributes($objects,$this->subAttributes);
+        $this->SubObjects[$objects['cn']] = $objects;
+      }
+    }
+    $this->ui = get_userinfo();
+  }
+
+
+  /* Reload some attributes */
+  function get_object_attributes($object,$attributes)
+  {
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->cat($object['dn'],$attributes);
+    $tmp  = $ldap->fetch();
+
+    foreach($attributes as $attrs){
+      if(isset($tmp[$attrs][0])){
+        $var = $tmp[$attrs][0];
+
+        /* Check if we must decode some attributes */
+        if(in_array_ics($attrs,$this->sub64coded)){
+          $var = base64_decode($var);
+        }
+
+        /*  check if this is a binary entry */
+        if(in_array_ics($attrs,$this->subBinary)){
+          $var = $ldap->get_attribute($object['dn'], $attrs,$r_array=0);
+        }
+
+        $var = stripslashes($var);
+  
+        $object[$attrs] = $var;
+      }
+    }
+    return($object);
+  }
+
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","fai/".get_class($this),$this->dn);
+    }
+
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+    $display= "";
+
+    /* New Listhandling
+     */
+    $once = true;
+    foreach($_POST as $name => $value){
+      if(preg_match("/^editscript_/",$name)&&($once)){
+        $once = false;
+        $entry = preg_replace("/^editscript_/","",$name);
+        $entry = base64_decode(preg_replace("/_.*/","",$entry));
+        $obj  = $this->SubObjects[$entry];
+
+        $acl_dn = $this->acl_base_for_current_object($obj['dn']);
+        $acl = $this->ui->get_permissions($acl_dn,"fai/faiTemplateEntry");
+        if(preg_match("/r/",$acl)){
+          if($obj['status'] == "FreshLoaded"){
+            $obj  = $this->get_object_attributes($obj,$this->sub_Load_Later);
+          }
+          $this->dialog= new $this->subClassName($this->config,$this->dn,$obj);
+          $this->dialog->set_acl_base($this->acl_base);
+          $this->dialog->set_acl_category("fai");
+
+          $_SESSION['objectinfo'] = $obj['dn'];
+          $this->dialog->parent = &$this;
+          $this->is_dialog=true;
+        }
+      }
+      if(preg_match("/^deletescript_/",$name)&&($once)){
+        $once = false;
+        $entry = preg_replace("/^deletescript_/","",$name);
+        $entry = base64_decode(preg_replace("/_.*/","",$entry));
+        $obj  = $this->SubObjects[$entry];
+
+        $acl_dn = $this->acl_base_for_current_object($obj['dn']);
+        $acl = $this->ui->get_permissions($acl_dn,"fai/faiTemplateEntry");
+        if(preg_match("/d/",$acl)){
+          $status = $this->SubObjects[$entry]['status'];
+          if($status == "edited" || $status == "FreshLoaded"){
+            $this->SubObjects[$entry]['status']= "delete";
+          }else{
+            unset($this->SubObjects[$entry]);
+          }
+        }
+      }
+    }
+
+    /* Edit entries via GET */
+    if(isset($_GET['act']) && isset($_GET['id'])){
+      if($_GET['act'] == "edit" && isset($this->SubObjects[$_GET['id']])){
+        $obj = $this->SubObjects[$_GET['id']];
+          if($obj['status'] == "FreshLoaded"){
+          $obj  = $this->get_object_attributes($obj,$this->sub_Load_Later);
+        }
+        $this->dialog= new $this->subClassName($this->config,$this->dn,$obj);
+        $this->dialog->acl = $this->acl;
+        $_SESSION['objectinfo'] = $obj['dn'];
+        $this->dialog->parent = &$this;
+        $this->is_dialog=true;
+      }
+    }
+
+    /* Add new sub object */
+    if(isset($_POST['AddSubObject'])){
+      $acl_dn = "cn=dummy,".$this->acl_base_for_current_object($this->dn);
+      $acl    = $this->ui->get_permissions($acl_dn,"fai/faiTemplateEntry");
+
+      if(preg_match("/c/",$acl)){
+        $this->dialog= new $this->subClassName($this->config,"new");
+        $this->dialog->set_acl_base($this->acl_base);
+        $this->dialog->set_acl_category("fai");
+        $this->dialog->parent = &$this;
+        $this->is_dialog=true;
+      }
+    }
+
+    if($this->dn != "new"){
+      $_SESSION['objectinfo']= $this->dn;
+    }
+
+    /* Save Dialog */
+    if(isset($_POST['SaveSubObject']) && is_object($this->dialog)){
+      $this->dialog->save_object();
+      $msgs = $this->dialog->check();
+      if(count($msgs)>0){
+        foreach($msgs as $msg){
+          print_red($msg);
+        }
+      }else{
+        /* Get return object */
+        $obj = $this->dialog->save();
+        if(isset($obj['remove'])){
+
+          $old_stat = $this->SubObjects[$obj['remove']['from']]['status'];
+
+          /* Depending on status, set new status */
+          if($old_stat == "edited" || $old_stat == "FreshLoaded"){
+            $this->SubObjects[$obj['remove']['from']]['status'] = "delete";
+          }elseif($this->SubObjects[$obj['remove']['from']]['status']=="new"){
+            unset($this->SubObjects[$obj['remove']['from']]);
+          }
+          $obj['status'] = "new";
+          $this->SubObjects[$obj['remove']['to']] = $obj;
+          unset($this->SubObjects[$obj['remove']['to']]['remove']);
+        }else{
+          if($obj['status'] == "FreshLoaded"){
+            $obj['status'] = "edited";
+          }
+          $this->SubObjects[$obj['cn']]=$obj;
+        }
+        $this->is_dialog=false;
+        unset($this->dialog);
+        $this->dialog=FALSE;
+      }
+    }
+
+    /* Sort entries */
+    $tmp = $keys = array();
+    foreach($this->SubObjects as $key => $entry){
+      $keys[$key]=$key;
+    }
+    natcasesort($keys);
+    foreach($keys as $key){
+      $tmp[$key]=$this->SubObjects[$key];
+    }
+    $this->SubObjects = $tmp;
+
+    /* Cancel Dialog */
+    if(isset($_POST['CancelSubObject'])){
+      $this->is_dialog=false; 
+      unset($this->dialog);
+      $this->dialog=FALSE;
+    }
+
+    /* Print dialog if $this->dialog is set */
+    if(is_object($this->dialog)){
+      $this->dialog->save_object();
+      $display = $this->dialog->execute();
+      return($display);
+    }
+
+     /* Divlist Containing FAItemplates */
+    $divlist = new divSelectBox("FAItemplates");
+    $divlist->setHeight(400);
+
+    $tmp = $this->getList(true);
+  
+    /* Create div list with all sub entries listed */
+    foreach($this->SubObjects as $key => $name){
+
+      /* Skip removed entries */ 
+      if($name['status'] == "delete") continue;
+
+      /* Get permissions */
+      $dn  = $this->acl_base_for_current_object($name['dn']);
+      $acl = $this->ui->get_permissions($dn,"fai/faiTemplateEntry")  ;
+      $act = "";
+
+      /* Hide delete icon if this object is freezed */
+      if(preg_match("/freeze/",$this->FAIstate)){
+        $act .= "<input type='image' src='images/edit.png'      name='editscript_%s'    title='"._("edit")."' alt='"._("edit")."'>";
+      }else{
+        $act .= "<input type='image' src='images/edit.png'      name='editscript_%s'    title='"._("edit")."' alt='"._("edit")."'>";
+        if(preg_match("/d/",$acl)){
+          $act .="<input type='image' src='images/edittrash.png' name='deletescript_%s'  title='"._("delete")."' alt='"._("delete")."'>";
+        }
+      }
+
+      /* Check acls for download icon */
+      $s_acl = $this->ui->get_permissions($dn,"fai/faiTemplateEntry","FAItemplateFile")  ;
+      if(($this->SubObjects[$key]['status'] == "new") || ($this->SubObjects[$key]['dn'] == "new") || !preg_match("/r/",$s_acl)){
+        $down = "";
+      }else{
+        $down = "<a href='getFAIscript.php?is_template&amp;id=".base64_encode($dn)."'>
+          <img src='images/save.png' alt='"._("Download")."' title='"._("Download")."' border=0>
+          </a>";
+      }
+
+      /* Check if we are allowed to view this object */
+      $s_acl = $this->ui->get_permissions($dn,"fai/faiTemplateEntry","cn")  ;
+      if(preg_match("/r/",$s_acl)){
+
+        $edit_link = "<a href='?plug=".$_GET['plug']."&amp;act=edit&amp;id=".$key."'>".$tmp[$key]."</a>";
+        $divlist->AddEntry(array( array("string"=> $edit_link), 
+              array("string"=>$down , "attach" => "style='width:20px;'"),
+              array("string"=>str_replace("%s",base64_encode($key),$act),
+                "attach"=>"style='border-right: 0px;width:50px;text-align:right;'")));
+      }
+    }
+    $smarty->assign("Entry_divlist",$divlist->DrawList());
+    /* Divlist creation complete
+     */
+
+     /* Magic quotes GPC, escapes every ' " \, to solve some security risks
+     * If we post the escaped strings they will be escaped again
+     */
+    foreach($this->attributes as $attrs){
+      if(get_magic_quotes_gpc()){
+        $smarty->assign($attrs,stripslashes($this->$attrs));
+      }else{
+        $smarty->assign($attrs,($this->$attrs));
+      }
+    }
+
+    $dn = $this->acl_base_for_current_object($this->dn);
+    $smarty->assign("sub_object_is_addable", 
+            preg_match("/c/",$this->ui->get_permissions($dn,"fai/faiTemplateEntry")) && 
+            !preg_match("/freeze/",$this->FAIstate));
+
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr."ACL",$this->getacl($attr));
+    }
+
+    $display.= $smarty->fetch(get_template_path('faiTemplate.tpl', TRUE));
+    return($display);
+  }
+
+
+  function acl_base_for_current_object($dn)
+  {
+    if($dn == "new"){
+      if($this->dn == "new"){
+        $dn= $_SESSION['CurrentMainBase'];
+      }else{
+        $dn = $this->dn;
+      }
+    }
+    return($dn);
+  }
+
+
+  /* Generate listbox friendly SubObject list
+  */
+  function getList(){
+    $a_return=array();
+    foreach($this->SubObjects as $obj){
+      if($obj['status'] != "delete"){
+      
+        if((isset($obj['description']))&&(!empty($obj['description']))){
+          if(strlen($obj['description']) > 40){
+            $obj['description'] = substr($obj['description'],0,40)."...";
+          }
+          $a_return[$obj['cn']]= $obj['cn']." [".$obj['description']."]";
+        }else{
+          $a_return[$obj['cn']]= $obj['cn'];
+        }
+      }
+    }
+    return($a_return);
+  }
+
+  /* Delete me, and all my subtrees
+   */
+  function remove_from_parent()
+  {
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd ($this->dn);
+
+#    $use_dn = str_ireplace( get_release_dn($this->dn), $_SESSION['faifilter']['branch'], $this->dn);
+    $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $this->dn);
+    if($_SESSION['faifilter']['branch'] == "main"){
+      $use_dn = $this->dn;
+    }
+
+    prepare_to_save_FAI_object($use_dn,array(),true);
+    new log("remove","fai/".get_class($this),$use_dn,$this->attributes);
+
+    foreach($this->SubObjects as $name => $obj){
+#      $use_dn = str_ireplace( get_release_dn($this->dn), $_SESSION['faifilter']['branch'], $obj['dn']);
+      $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $obj['dn']);
+      if($_SESSION['faifilter']['branch'] == "main"){
+        $use_dn = $obj['dn'];
+      }
+      prepare_to_save_FAI_object($use_dn,array(),true);
+    }
+    $this->handle_post_events("remove");    
+  }
+
+
+  /* Save data to object 
+   */
+  function save_object()
+  {
+    if((isset($_POST['FAItemplate_posted'])) && (!preg_match("/freeze/",$this->FAIstate))){
+      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()
+  {
+    plugin::save();
+
+    $ldap = $this->config->get_ldap_link();
+
+    prepare_to_save_FAI_object($this->dn,$this->attrs);
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of FAI/template with dn '%s' failed."),$this->dn));
+
+    if($this->initially_was_account){
+      new log("modify","fai/".get_class($this),$this->dn,$this->attributes);
+    }else{
+      new log("create","fai/".get_class($this),$this->dn,$this->attributes);
+    }
+
+    /* Do object tagging */
+    $this->handle_object_tagging();
+
+    /* Prepare FAIscriptEntry to write it to ldap
+     * First sort array.
+     *  Because we must delete old entries first.
+     * After deletion, we perform add and modify 
+     */
+    $Objects = array();
+    foreach($this->SubObjects as $name => $obj){
+      if($obj['status'] == "FreshLoaded"){
+        unset($this->SubObjects[$name]);
+      }
+    }
+
+    foreach($this->SubObjects as $name => $obj){
+      if($obj['status'] == "delete"){
+        $Objects[$name] = $obj; 
+      }
+    }
+    foreach($this->SubObjects as $name => $obj){
+      if($obj['status'] != "delete"){
+        $Objects[$name] = $obj; 
+      }
+    }
+
+    foreach($Objects as $name => $obj){
+
+      foreach($this->sub64coded as $codeIt){
+        $obj[$codeIt]=base64_encode($obj[$codeIt]);
+      }
+      $tmp = array();
+      $attributes = array_merge($this->sub_Load_Later,$this->subAttributes);
+      foreach($attributes as $attrs){
+        if(empty($obj[$attrs])){
+          $obj[$attrs] = array();
+        }
+        $tmp[$attrs] =($obj[$attrs]);
+      }    
+        
+      $tmp['objectClass'] = $this->subClasses;
+
+      $sub_dn = "cn=".$obj['cn'].",".$this->dn;
+
+      if($obj['status']=="new"){
+        $ldap->cat($sub_dn,array("objectClass"));
+        if($ldap->count()){
+          $obj['status']="edited";
+        }
+      }
+
+       /* Check if gosaAdministrativeUnitTag is required as object class */
+      if($obj['status'] == "edited"){
+        $ldap->cat($sub_dn,array("objectClass"));
+        $attrs = $ldap->fetch();
+        if(isset($attrs['objectClass'])){
+          if(in_array_ics("gosaAdministrativeUnitTag",$attrs['objectClass'])){
+            $tmp['objectClass'][] = "gosaAdministrativeUnitTag";
+          }
+        }
+      }
+
+      if($obj['status'] == "delete"){
+        prepare_to_save_FAI_object($sub_dn,array(),true);
+        $this->handle_post_events("remove");
+      }elseif($obj['status'] == "edited"){
+        prepare_to_save_FAI_object($sub_dn,$tmp);
+        $this->handle_post_events("modify");
+      }elseif($obj['status']=="new"){
+        prepare_to_save_FAI_object($sub_dn,$tmp);
+        $this->handle_post_events("add");
+      }
+
+
+      $this->handle_object_tagging($sub_dn, $this->gosaUnitTag);
+    }
+  }
+
+
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);
+
+    /* Read all leaf objects of this object (For FAIscript this would be FAIscriptEntry)
+     */
+    $ldap     = $this->config->get_ldap_link();
+    $ldap->cd ($source['dn']);
+
+    $attrs_to_search = $this->subAttributes;
+    $attrs_to_search[] = "FAIstate";
+    $ldap->search("(&(objectClass=FAIclass)(objectClass=".$this->subClass."))",$attrs_to_search);
+
+    while($object = $ldap->fetch()){
+
+      /* Skip objects, that are tagged as removed */
+      if(isset($object['FAIstate'][0])){
+        if(preg_match("/removed$/",$object['FAIstate'][0])){
+          continue;
+        }
+      }
+
+      /* Set status for save management */
+      $objects = array();
+      $objects['status']      = "edited";
+      $objects['dn']          = $object['dn'];
+      $objects                = $this->get_object_attributes($objects,$this->subAttributes);
+      $objects                = $this->get_object_attributes($objects,$this->sub_Load_Later);
+
+      $this->SubObjects[$objects['cn']] = $objects;
+    }
+  }
+  
+
+  /* Return plugin informations for acl handling */ 
+  static function plInfo()
+  {
+    return (array( 
+          "plShortName" => _("Template"),
+          "plDescription" => _("FAI template"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 24,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("fai"),
+          "plProvidedAcls" => array(
+            "cn"                => _("Name")." ("._("Readonly").")",
+            "description"       => _("Description"))
+          ));
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/fai/class_faiTemplateEntry.inc b/gosa-core/plugins/admin/fai/class_faiTemplateEntry.inc
new file mode 100644 (file)
index 0000000..05c6b72
--- /dev/null
@@ -0,0 +1,275 @@
+<?php
+
+class faiTemplateEntry 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","description","FAItemplateFile","FAItemplatePath","FAImode","user","group","binary","FAIowner");
+  var $objectclasses= array();
+
+  var $orig_cn              = "";
+
+  var $dn            = "";
+  var $cn            = "";
+  var $FAItemplateFile   = "";
+  var $FAItemplatePath   = "";
+  var $description   = "";
+  var $status        = "new";
+  var $FAImode       = "0640";
+  var $FAIowner      = "root.root";
+  var $user          = "root";
+  var $group         = "root";
+  var $binary        = false;
+  var $parent        = NULL;
+  var $FAIstate      = "";
+  
+  function faiTemplateEntry (&$config, $dn= NULL,$object=false)
+  {
+    plugin::plugin ($config, $dn);
+
+    if((isset($object['cn'])) && (!empty($object['cn']))){
+      $this->orig_cn= $object['cn'];
+      $this->dn=$object['dn'];
+      foreach($object as $name=>$value){
+        $oname = $name;
+        $this->$oname=$value;
+      }
+
+      if(isset($this->attrs['FAIstate'][0])){
+        $this->FAIstate = $this->attrs['FAIstate'][0];
+      }
+
+    }else{
+      $this->status = "new";
+      $this->orig_cn= false;
+    }
+
+    $this->user = explode( '.', $this->FAIowner );
+    $this->group = $this->user[1];
+    $this->user = $this->user[0];
+
+    $_SESSION['binary'] = $this->FAItemplateFile;
+    $_SESSION['binarytype'] = 'octet-stream';
+    $_SESSION['binaryfile'] = basename( $this->FAItemplatePath );
+
+    if(!empty($this->dn) && $this->dn != "new"){
+      $ldap = $this->config->get_ldap_link();
+      $_SESSION['binary'] =$ldap->get_attribute($this->dn,"FAItemplateFile");
+      $this->FAItemplateFile = $_SESSION['binary'];
+    }
+    
+    $this->FAImode= sprintf("%0.4s", $this->FAImode)." ";
+  }
+
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* Fill templating stuff */
+    $smarty     = get_smarty();
+    $smarty->assign("rand", rand(0, 10000));
+    $display = "";
+
+    if(isset($_POST['TmpFileUpload']) && $this->acl_is_writeable("FAItemplateFile")){
+      if($str=file_get_contents($_FILES['FAItemplateFile']['tmp_name'])){
+        $this->FAItemplateFile = $str;
+
+        /* If we don't have a filename set it from upload filename. */
+        if( 0 == strlen( $this->FAItemplatePath )){
+          $this->FAItemplatePath = $_FILES['FAItemplateFile']['name'];
+        }
+
+        $_SESSION['binary']     = $this->FAItemplateFile;
+        $_SESSION['binarytype'] = 'octet-stream';
+        $_SESSION['binaryfile'] = basename( $this->FAItemplatePath );
+      }
+    }
+    
+    $status= _("no file uploaded yet");
+
+    $bStatus = false; // Hide download icon on default 
+    
+    if(strlen($this->FAItemplateFile)){
+
+      $status= sprintf(_("exists in database (size: %s bytes)"),strlen($this->FAItemplateFile));
+      $bStatus = true;  // Display download icon 
+    }
+    $smarty->assign("status",$status);
+    $smarty->assign("bStatus",$bStatus);
+
+    /* Magic quotes GPC, escapes every ' " \, to solve some security risks 
+     * If we post the escaped strings they will be escaped again
+     */
+    foreach($this->attributes as $attrs){
+      if(get_magic_quotes_gpc()){
+        $smarty->assign($attrs,stripslashes($this->$attrs));
+      }else{
+        $smarty->assign($attrs,($this->$attrs));
+      }
+    }
+
+    /* Assign file modes */
+    $tmode= "$this->FAImode ";
+    foreach (array("s", "u", "g", "o") as $type){
+      $current= substr($tmode, 0, 1);
+      $tmode=   preg_replace("/^./", "", $tmode);
+      $nr= 1;
+      while ($nr < 5){
+        if ($current & $nr){
+          $smarty->assign($type.$nr, "checked");
+        } else {
+          $smarty->assign($type.$nr, "");
+        }
+        $nr+= $nr;
+      }
+    }
+
+    $smarty->assign("FAItemplateFile","");
+
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr."ACL",$this->getacl($attr,preg_match("/freeze/",$this->FAIstate)));
+    }
+
+    /* We now split cn/FAItemplatePath to make things more clear... */
+    $smarty->assign("cn", basename($this->FAItemplatePath));
+    $smarty->assign("templatePath", dirname($this->FAItemplatePath));
+
+    $display.=  $smarty->fetch(get_template_path('faiTemplateEntry.tpl', TRUE));
+    return($display);
+  }
+
+  /* Save data to object */
+  function save_object()
+  {
+    /* Check if form is posted and we are not freezed */
+    if((isset($_POST['SubObjectFormSubmitted'])) && ($this->FAIstate != "freeze")){
+
+      plugin::save_object();
+
+      /* Set user.group (FAIowner) attribute */  
+      if(isset($_POST['group']) && isset($_POST["user"]) && $this->acl_is_writeable("FAIowner")){
+        $this->FAIowner = $_POST["user"].'.'.$_POST["group"];
+        $this->user = $_POST['user'];
+        $this->group= $_POST['group'];
+      }
+
+      /* Check if permissions have changed */
+      if($this->acl_is_writeable("FAImode")){
+
+        /* Save mode */
+        $tmode= "";
+        foreach (array("s", "u", "g", "o") as $type){
+          $nr= 1;
+          $dest= 0;
+          while ($nr < 5){
+            if (isset($_POST["$type$nr"])){
+              $dest+= $nr;
+            }
+            $nr+= $nr;
+          }
+          $tmode= $tmode.$dest;
+        }
+        $this->FAImode= $tmode;
+
+        /* Assemble cn/FAItemplatePath */
+        $this->cn= preg_replace('/\/+/', '/', $this->FAItemplatePath.'/'.$this->cn);
+        $this->FAItemplatePath= $this->cn;
+      }
+    }
+  }
+
+
+  /* Check supplied data */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    if(isset($this->parent->SubObjects[$this->cn]) && $this->cn != $this->orig_cn){
+      $message[] =_("There is already a template with the given name.");
+    }
+
+    if(empty($this->FAItemplateFile)){
+      $message[]=_("Please specify a value for attribute 'file'.");
+    } 
+
+    if(!preg_match('/^\//', $this->FAItemplatePath)){
+      $message[]=_("Please specify a valid value for attribute 'Destination path'.");
+    } 
+  
+    if(empty($this->cn)){
+      $message[] = _("Please enter a file name.");
+    }
+
+#    echo $this->cn;
+#    if(preg_match('/\//', $this->cn)){
+#      $message[] = _("The file name should not contain / characters.");
+# #   }
+
+    if(empty($this->user)){
+      $message[] = _("Please enter a user.");
+    }
+    elseif(preg_match("/[^0-9a-z]/i",$this->user)){
+      $message[] = _("Please enter a valid user. Only a-z/0-9 are allowed.");
+    }
+
+    if(empty($this->group)){
+      $message[] = _("Please enter a group.");
+    }
+    elseif(preg_match("/[^0-9a-z]/i",$this->group)){
+      $message[] = _("Please enter a valid group. Only a-z/0-9 are allowed.");
+    }
+
+    return ($message);
+  }
+  function save()
+  {
+    $tmp=array();
+    foreach($this->attributes as $attrs){ 
+      $tmp[$attrs] = $this->$attrs;
+    }
+
+    if(($this->orig_cn)&&($tmp['cn']!=$this->orig_cn)){
+      $tmp['remove']['from']  = $this->orig_cn;
+      $tmp['remove']['to']    = $tmp['cn'];
+    }
+  
+    $tmp['dn']      = $this->dn;  
+    $tmp['status']  = $this->status;  
+
+    return($tmp);
+  }
+
+  
+  /* Return plugin informations for acl handling */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName" => _("Template entry"),
+          "plDescription" => _("FAI template entry"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 25,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("fai"),
+          "plProvidedAcls" => array(
+            "cn"                => _("Name"),
+            "description"       => _("Description"),
+            "FAItemplateFile"   => _("Template file"),
+            "FAItemplatePath"   => _("Template path"),
+            "FAIowner"          => _("File owner"),
+            "FAImode"           => _("File permissions"))
+          ));
+  }
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/fai/class_faiVariable.inc b/gosa-core/plugins/admin/fai/class_faiVariable.inc
new file mode 100644 (file)
index 0000000..ae6b79a
--- /dev/null
@@ -0,0 +1,475 @@
+<?php
+
+class faiVariable 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;
+
+  /* Attributes for this Object */
+  var $attributes       = array("cn","description");
+
+  /* ObjectClasses for this Object*/
+  var $objectclasses    = array("top","FAIclass","FAIvariable");
+
+  /* Class name of the Ldap ObjectClass for the Sub Object */
+  var $subClass         = "FAIvariableEntry";
+  var $subClasses       = array("top","FAIclass","FAIvariableEntry");
+
+  /* Class name of the php class which allows us to edit a Sub Object */
+  var $subClassName     = "faiVariableEntry";      
+
+  /* Attributes to initialise for each subObject */
+  var $subAttributes    = array("cn","description","FAIvariableContent"); 
+  var $sub64coded       = array();  
+
+  /* Specific attributes */
+  var $cn               = "";       // The class name for this object
+  var $description      = "";       // The description for this set of partitions
+  var $is_dialog        = false;    // specifies which buttons will be shown to save or abort
+  var $SubObjects       = array();  // All leafobjects of this object
+
+  var $FAIstate         = "";
+  var $ui   ;
+  var $view_logged      = FALSE;
+
+  function faiVariable (&$config, $dn= NULL)
+  {
+    /* Load Attributes */
+    plugin::plugin ($config, $dn);
+
+    if($dn != "new"){
+      $this->dn =$dn;
+
+      /* Get FAIstate
+       */
+      if(isset($this->attrs['FAIstate'][0])){
+        $this->FAIstate = $this->attrs['FAIstate'][0];
+      }
+
+      /* Read all leaf objects of this object (For FAIscript this would be FAIscriptEntry)
+       */
+      $ldap     = $this->config->get_ldap_link();
+      $ldap->cd ($this->dn);
+
+      $attrs_to_search = $this->subAttributes;
+      $attrs_to_search[] = "FAIstate";
+      $ldap->search("(&(objectClass=FAIclass)(objectClass=".$this->subClass."))",$attrs_to_search);
+
+      while($object = $ldap->fetch()){
+      
+        /* Skip objects, that are tagged as removed */
+        if(isset($object['FAIstate'][0])){
+          if(preg_match("/removed$/",$object['FAIstate'][0])){
+            continue;
+          }
+        }
+
+        /* Set status for save management */
+        foreach($this->subAttributes as $attrs){
+          if(!isset($object[$attrs][0])){
+            $this->SubObjects[$object['cn'][0]][$attrs]="";
+          }else{
+            $this->SubObjects[$object['cn'][0]][$attrs]=$object[$attrs][0];
+          }
+        }
+     
+        foreach($this->sub64coded as $codeIt){
+          $this->SubObjects[$object['cn'][0]][$codeIt]=base64_decode($this->SubObjects[$object['cn'][0]][$codeIt]);
+        }
+        $this->SubObjects[$object['cn'][0]]['status']      = "edited";
+        $this->SubObjects[$object['cn'][0]]['dn']          = $object['dn'];
+      }
+
+    }
+    $this->ui = get_userinfo();
+  }
+
+
+  function acl_base_for_current_object($dn)
+  {
+    if($dn == "new"){
+      if($this->dn == "new"){
+        $dn= $_SESSION['CurrentMainBase'];
+      }else{
+        $dn = $this->dn;
+      }
+    }
+    return($dn);
+  }
+
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","fai/".get_class($this),$this->dn);
+    }
+
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+    $display= "";
+
+    /* Add new sub object */
+    if(isset($_POST['AddSubObject'])){
+      $this->dialog= new $this->subClassName($this->config,"new");
+      $this->dialog->set_acl_base($this->acl_base_for_current_object($this->dn));
+      $this->dialog->set_acl_category("fai");
+      $this->dialog->parent = &$this;
+      $this->is_dialog=true;
+    }
+
+    if($this->dn != "new"){
+      $_SESSION['objectinfo']= $this->dn;
+    }
+
+
+    /* Edit selected Sub Object */
+    if((isset($_POST['EditSubObject']))&&(isset($_POST['SubObject']))){
+
+      $var = $_POST['SubObject'][0];
+      $c_dn = $this->acl_base_for_current_object($this->SubObjects[$var]['dn']);
+      $this->dialog= new $this->subClassName($this->config,$this->dn,$this->SubObjects[$var]);
+      $this->dialog->set_acl_category("fai");
+      $this->dialog->set_acl_base($c_dn);
+      $this->dialog->parent = &$this;
+      $_SESSION['objectinfo'] = $this->SubObjects[$var]['dn'];
+      $this->is_dialog=true;
+    }
+    
+    /* Remove Sub object */
+    if((isset($_POST['DelSubObject']))&&(isset($_POST['SubObject']))){
+      foreach($_POST['SubObject'] as $var){
+
+        $c_dn = $this->acl_base_for_current_object($this->SubObjects[$var]['dn']);
+        $acl = $this->ui->get_permissions($c_dn,"fai/faiVariable");
+        if(preg_match("/d/",$acl)){
+          if($this->SubObjects[$var]['status'] == "edited"){
+            $this->SubObjects[$var]['status']= "delete";
+          }else{
+            unset($this->SubObjects[$var]);
+          }
+        }
+      }
+    }
+
+    /* Save Dialog */
+    if(isset($_POST['SaveSubObject'])){
+      $this->dialog->save_object();
+      $msgs = $this->dialog->check();
+      if(count($msgs)>0){
+        foreach($msgs as $msg){
+          print_red($msg);
+        }
+      }else{
+        $obj = $this->dialog->save();
+        if(isset($obj['remove'])){
+          if($this->SubObjects[$obj['remove']['from']]['status']=="edited"){
+            $this->SubObjects[$obj['remove']['from']]['status'] = "delete";
+          }elseif($this->SubObjects[$obj['remove']['from']]['status']=="new"){
+            unset($this->SubObjects[$obj['remove']['from']]);
+          }
+          $obj['status'] = "new";
+          $this->SubObjects[$obj['remove']['to']] = $obj;
+          unset($this->SubObjects[$obj['remove']['to']]['remove']);
+        }else{
+          $this->SubObjects[$obj['cn']]=$obj;
+        }
+        $this->is_dialog=false;
+        unset($this->dialog);
+        $this->dialog=FALSE;
+      }
+    }
+
+    /* Sort entries */
+    $tmp = $keys = array();
+    foreach($this->SubObjects as $key => $entry){
+      $keys[$key]=$key;
+    }
+    natcasesort($keys);
+    foreach($keys as $key){
+      $tmp[$key]=$this->SubObjects[$key];
+    } 
+    $this->SubObjects = $tmp;
+
+    /* Cancel Dialog */
+    if(isset($_POST['CancelSubObject'])){
+      $this->is_dialog=false; 
+      unset($this->dialog);
+      $this->dialog=FALSE;
+    }
+
+    /* Print dialog if $this->dialog is set */
+    if(is_object($this->dialog)){
+      $this->dialog->save_object();
+      $display = $this->dialog->execute();
+      return($display);
+    }
+
+    $ui = get_userinfo();
+    $ret = $this->getList();
+    $tmp = array();
+    foreach($this->SubObjects as $key => $obj){
+      $acl = $ui->get_permissions($obj['dn'],"fai/faiVariableEntry");
+      if(preg_match("/r/",$acl) || $obj['dn'] == "new"){
+        $tmp[$key] = $ret[$key];
+      } 
+    }
+    $smarty->assign("SubObjects",$tmp);
+
+
+    /* Magic quotes GPC, escapes every ' " \, to solve some security risks
+     * If we post the escaped strings they will be escaped again
+     */
+    foreach($this->attributes as $attrs){
+      if(get_magic_quotes_gpc()){
+        $smarty->assign($attrs,htmlentities (stripslashes(utf8_decode($this->$attrs))));
+      }else{
+        $smarty->assign($attrs,htmlentities (utf8_decode($this->$attrs)));
+      }
+    }
+
+    $c_dn = $this->acl_base_for_current_object($this->dn);
+    $smarty->assign("is_createable",     preg_match("/c/",$this->ui->get_permissions($c_dn,"fai/faiVariableEntry")) && $this->FAIstate!="freeze");
+    $smarty->assign("is_removeable",  preg_match("/d/",$this->ui->get_permissions($c_dn,"fai/faiVariableEntry")) && $this->FAIstate!="freeze");
+
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation) {
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+    
+
+    $display.= $smarty->fetch(get_template_path('faiVariable.tpl', TRUE));
+    return($display);
+  }
+
+  /* Generate listbox friendly SubObject list
+  */
+  function getList(){
+    $a_return=array();
+    foreach($this->SubObjects as $obj){
+      if($obj['status'] != "delete"){
+
+        if((isset($obj['description']))&&(!empty($obj['description']))&&(!preg_match("/\[\*\]/",$obj['description']))){
+          if (preg_match("/\[\*\]/", $obj['description'])){
+            $a_return[$obj['cn']]= $obj['cn']." [".preg_replace("/\s*\[\*\]\s*/", "", $obj['description'])."]";
+          } else {
+            $a_return[$obj['cn']]= $obj['cn']."=".$obj['FAIvariableContent']." [".$obj['description']."]";
+          }
+        }else{
+          if (preg_match("/\[\*\]/", $obj['description'])){
+            $a_return[$obj['cn']]= $obj['cn'];
+          } else {
+            $a_return[$obj['cn']]= $obj['cn']."=".$obj['FAIvariableContent'];
+          }
+        }
+      }
+    }
+    return($a_return);
+  }
+
+  /* Delete me, and all my subtrees
+   */
+  function remove_from_parent()
+  {
+    if($this->acl_is_removeable()){
+      $ldap = $this->config->get_ldap_link();
+      $ldap->cd ($this->dn);
+
+      $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $this->dn);
+      if($_SESSION['faifilter']['branch'] == "main"){
+        $use_dn = $this->dn;
+      }
+  
+      prepare_to_save_FAI_object($use_dn,array(),true);
+      new log("remove","fai/".get_class($this),$use_dn,$this->attributes);
+
+      foreach($this->SubObjects as $name => $obj){
+        $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $obj['dn']);
+        if($_SESSION['faifilter']['branch'] == "main"){
+          $use_dn = $obj['dn'];
+        }
+        prepare_to_save_FAI_object($use_dn,array(),true);
+      }
+      $this->handle_post_events("remove");
+    }
+  }
+
+
+  /* Save data to object 
+   */
+  function save_object()
+  {
+    if((isset($_POST['FAIvariable_posted'])) && ($this->FAIstate != "freeze") ){
+      plugin::save_object();
+      foreach($this->attributes as $attrs){
+        if(isset($_POST[$attrs])){
+          $this->$attrs = $_POST[$attrs];
+        }
+      }
+    }
+  }
+
+
+  /* Check supplied data */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    return ($message);
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    plugin::save();
+    $ldap = $this->config->get_ldap_link();
+    prepare_to_save_FAI_object($this->dn,$this->attrs);
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of FAI/variable with dn '%s' failed."),$this->dn));
+
+    if($this->initially_was_account){
+      new log("modify","fai/".get_class($this),$this->dn,$this->attributes);
+    }else{
+      new log("create","fai/".get_class($this),$this->dn,$this->attributes);
+    }
+    /* Do object tagging */
+    $this->handle_object_tagging();
+    /* Prepare FAIscriptEntry to write it to ldap
+     * First sort array.
+     *  Because we must delete old entries first.
+     * After deletion, we perform add and modify 
+     */
+    $Objects = array();
+    foreach($this->SubObjects as $name => $obj){
+      if($obj['status'] == "delete"){
+        $Objects[$name] = $obj; 
+      }
+    }
+    foreach($this->SubObjects as $name => $obj){
+      if($obj['status'] != "delete"){
+        $Objects[$name] = $obj; 
+      }
+    }
+
+    foreach($Objects as $name => $obj){
+
+      foreach($this->sub64coded as $codeIt){
+        $obj[$codeIt]=base64_encode($obj[$codeIt]);
+      }
+
+      $tmp = array();
+      foreach($this->subAttributes as $attrs){
+        if(empty($obj[$attrs])){
+          $obj[$attrs] = array();
+        }
+        $tmp[$attrs] = $obj[$attrs];
+      }    
+        
+      $tmp['objectClass'] = $this->subClasses;
+
+      $sub_dn = "cn=".$obj['cn'].",".$this->dn;
+
+      if($obj['status']=="new"){
+        $ldap->cat($sub_dn,array("objectClass"));
+        if($ldap->count()){
+          $obj['status']="edited";
+        }
+      }
+
+      /* Check if gosaAdministrativeUnitTag is required as object class */
+      if($obj['status'] == "edited"){
+        $ldap->cat($sub_dn,array("objectClass"));
+        $attrs = $ldap->fetch();
+        if(isset($attrs['objectClass'])){
+          if(in_array_ics("gosaAdministrativeUnitTag",$attrs['objectClass'])){
+            $tmp['objectClass'][] = "gosaAdministrativeUnitTag";
+          }
+        }
+      }
+      
+      if($obj['status'] == "delete"){
+        prepare_to_save_FAI_object($sub_dn,array(),true);
+        $this->handle_post_events("remove");
+      }elseif($obj['status'] == "edited"){
+        prepare_to_save_FAI_object($sub_dn,$tmp);
+        $this->handle_post_events("modify");
+      }elseif($obj['status']=="new"){
+        prepare_to_save_FAI_object($sub_dn,$tmp);
+        $this->handle_post_events("add");
+      }
+
+      $this->handle_object_tagging($sub_dn, $this->gosaUnitTag);
+    }
+  }
+
+
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);
+
+    /* Read all leaf objects of this object (For FAIscript this would be FAIscriptEntry)
+     */
+    $ldap     = $this->config->get_ldap_link();
+    $ldap->cd ($source['dn']);
+    $attrs_to_search = $this->subAttributes;
+    $attrs_to_search[] = "FAIstate";
+    $ldap->search("(&(objectClass=FAIclass)(objectClass=".$this->subClass."))",$attrs_to_search);
+    while($object = $ldap->fetch()){
+
+      /* Skip objects, that are tagged as removed */
+      if(isset($object['FAIstate'][0])){
+        if(preg_match("/removed$/",$object['FAIstate'][0])){
+          continue;
+        }
+      }
+
+      /* Set status for save management */
+      foreach($this->subAttributes as $attrs){
+        if(!isset($object[$attrs][0])){
+          $this->SubObjects[$object['cn'][0]][$attrs]="";
+        }else{
+          $this->SubObjects[$object['cn'][0]][$attrs]=$object[$attrs][0];
+        }
+      }
+      foreach($this->sub64coded as $codeIt){
+        $this->SubObjects[$object['cn'][0]][$codeIt]=base64_decode($this->SubObjects[$object['cn'][0]][$codeIt]);
+      }
+      $this->SubObjects[$object['cn'][0]]['status']      = "edited";
+      $this->SubObjects[$object['cn'][0]]['dn']          = $object['dn'];
+    }
+  } 
+
+  /* Return plugin informations for acl handling */ 
+  static function plInfo()
+  {
+    return (array( 
+          "plShortName" => _("Variable"),
+          "plDescription" => _("FAI variable"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 22,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("fai"),
+          "plProvidedAcls" => array(
+            "cn"                => _("Name")." ("._("Read only").")",
+            "description"       => _("Description"))
+          ));
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/fai/class_faiVariableEntry.inc b/gosa-core/plugins/admin/fai/class_faiVariableEntry.inc
new file mode 100644 (file)
index 0000000..5fc6ef0
--- /dev/null
@@ -0,0 +1,155 @@
+<?php
+
+class faiVariableEntry 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","description","FAIvariableContent");
+  var $objectclasses= array();
+
+  var $orig_cn              = "";
+  var $dn            = "";
+  var $cn            = "";
+  var $FAIvariableContent   = "";
+  var $description   = "";
+  var $status        = "new";
+  var $parent        = NULL;
+  var $FAIstate      = "";
+  
+  function faiVariableEntry (&$config, $dn= NULL,$object=false)
+  {
+    plugin::plugin ($config, $dn);
+    if((isset($object['cn'])) && (!empty($object['cn']))){
+      $this->orig_cn= $object['cn'];
+      $this->dn=$object['dn'];
+      foreach($object as $name=>$value){
+        $oname = $name;
+        $this->$oname=addslashes($value);
+      }
+
+      if(isset($this->attrs['FAIstate'][0])){
+        $this->FAIstate = $this->attrs['FAIstate'][0];
+      }
+
+    }else{
+      $this->status = "new";
+      $this->orig_cn       = false;
+    }
+  }
+
+  function execute()
+  {
+       /* Call parent execute */
+       plugin::execute();
+
+    /* Fill templating stuff */
+    $smarty     = get_smarty();
+    $display = "";
+
+     /* Magic quotes GPC, escapes every ' " \, to solve some security risks
+     * If we post the escaped strings they will be escaped again
+     */
+    foreach($this->attributes as $attrs){
+      if(get_magic_quotes_gpc()){
+        $smarty->assign($attrs,htmlentities (stripslashes(utf8_decode($this->$attrs))));
+      }else{
+        $smarty->assign($attrs,htmlentities (utf8_decode($this->$attrs)));
+      }
+    }
+
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translated){
+      $acl = $this->getacl($name);
+      if($this->FAIstate == "freezed"){
+        $acl = preg_replace("/w/","",$acl);
+      }
+      $smarty->assign($name."ACL",$acl);
+    }
+
+
+
+    $display.= $smarty->fetch(get_template_path('faiVariableEntry.tpl', TRUE));
+    return($display);
+  }
+
+  /* Save data to object */
+  function save_object()
+  {
+     if((isset($_POST['SubObjectFormSubmitted'])) && ($this->FAIstate != "freeze")){
+      foreach($this->attributes as $attrs){
+        if($this->acl_is_writeable($attrs)){
+          if(isset($_POST[$attrs])){
+            $this->$attrs = $_POST[$attrs];
+          }else{
+            $this->$attrs = "";
+          }
+        }
+      }
+    }
+  }
+
+  /* Check supplied data */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    if(isset($this->parent->SubObjects[$this->cn]) && $this->cn != $this->orig_cn){
+      $message[] =_("There is already a variable with the given name.");
+    }
+    
+    if(empty($this->FAIvariableContent)) {
+      $message[]=_("Please specify a value for the attribute 'content'."); 
+    }
+   
+    if(empty($this->cn)){
+      $message[] = _("Please enter a name.");
+    }
+
+    return ($message);
+  }
+  function save()
+  {
+    $tmp=array();
+    foreach($this->attributes as $attrs){ 
+      $tmp[$attrs] = stripslashes( $this->$attrs);
+    }
+
+    if(($this->orig_cn)&&($tmp['cn']!=$this->orig_cn)){
+      $tmp['remove']['from']  = $this->orig_cn;
+      $tmp['remove']['to']    = $tmp['cn'];
+    }
+  
+    $tmp['dn']      = $this->dn;  
+    $tmp['status']  = $this->status;  
+    return($tmp);
+  }
+
+  /* Return plugin informations for acl handling */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName" => _("Variable entry"),
+          "plDescription" => _("FAI variable entry "),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 23,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("fai"),
+          "plProvidedAcls" => array(
+            "cn"                => _("Name"),
+            "description"       => _("Description"),
+            "FAIvariableContent"=> _("Variable content") )
+          ));
+  }
+
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/fai/faiHook.tpl b/gosa-core/plugins/admin/fai/faiHook.tpl
new file mode 100644 (file)
index 0000000..6768ad9
--- /dev/null
@@ -0,0 +1,63 @@
+<table width="100%" summary=''>
+       <tr>
+               <td width="50%" valign="top">
+                               <h2><img class="center" alt="" src="images/fai_small.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2>
+                               <table summary="" cellspacing="4">
+                                       <tr>
+                                               <td>
+                                                       <LABEL for="cn">
+                                                       {t}Name{/t}
+                                                       </LABEL>
+                                               </td>
+                                               <td>
+{render acl=$cnACL}
+                                                       <input value="{$cn}" size="45" maxlength="80" disabled id="cn">
+{/render}
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>
+                                                       <LABEL for="description">
+                                                       {t}Description{/t}
+                                                       </LABEL>
+                                               </td>
+                                               <td>
+{render acl=$descriptionACL}
+                                                       <input value="{$description}" size="45" maxlength="80" name="description" id="description">
+{/render}
+                                               </td>
+                                       </tr>
+                               </table>
+               </td>
+       </tr>
+</table>
+<p class="seperator">&nbsp;</p>
+<table width="100%" summary=''>
+       <tr>
+               <td>
+                               <h2><img class="center" alt="" src="images/fai_hook.png" align="middle" title="{t}Objects{/t}">&nbsp;
+                                       {t}List of hook scripts{/t}
+                               </h2>
+                               <table width="100%" summary=''>
+                               <tr>
+                                       <td>
+                                               {$Entry_divlist}
+{if $sub_object_is_addable}
+                                               <input type="submit" name="AddSubObject"     value="{t}Add{/t}" title="{t}Add{/t}">
+{else}
+                                               <input type="submit" name="AddSubObject"     value="{t}Add{/t}" title="{t}Add{/t}" disabled>
+{/if}
+                                       </td>
+                               </tr>
+                               </table>
+               </td>
+       </tr>
+</table>
+<input type="hidden" value="1" name="FAIhook_posted">
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('cn','description');
+  -->
+</script>
+
diff --git a/gosa-core/plugins/admin/fai/faiHookEntry.tpl b/gosa-core/plugins/admin/fai/faiHookEntry.tpl
new file mode 100644 (file)
index 0000000..882da26
--- /dev/null
@@ -0,0 +1,94 @@
+<input type="hidden" name="SubObjectFormSubmitted" value="1">
+<table width="100%" summary="">
+       <tr>
+               <td valign="top" width="50%">
+                       <h2><img class="center" alt="" src="images/forward.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2>
+                               <table summary="">
+                                       <tr>
+                                               <td>
+                                                       {t}Name{/t}{$must}&nbsp;
+                                               </td>
+                                               <td>
+{render acl=$cnACL}
+                                                       <input value="{$cn}" size="45" name="cn">
+{/render}
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>
+                                                       {t}Description{/t}&nbsp;
+                                               </td>
+                                               <td>
+{render acl=$descriptionACL}
+                                                       <input value="{$description}" size="45" name="description">
+{/render}
+                                               </td>
+                                       </tr>
+                               </table>
+               </td>
+               <td style="border-left: 1px solid rgb(160, 160, 160);">
+           &nbsp;
+        </td>
+               <td style="vertical-align:top">
+                               <h2><img class="center" alt="" src="images/fai_hook.png" align="middle" title="{t}Hook attributes{/t}">&nbsp;{t}Hook attributes{/t}</h2>
+                               <table width="100%" summary="">
+                                       <tr>
+                                               <td>
+                                                       <LABEL for="FAItask">
+                                                       {t}Task{/t}&nbsp;
+                                                       </LABEL>
+{render acl=$FAItaskACL}
+                                                       <select id="FAItask" name="FAItask" title="{t}Choose an existing FAI task{/t}">
+                                                               {html_options values=$tasks output=$tasks selected=$FAItask}
+                                                       </select>
+{/render}
+                                               </td>
+                                       </tr>
+                               </table>
+               </td>
+       </tr>
+</table>
+
+
+<p class="seperator">&nbsp;</p>
+<h2><img class="center" alt="" src="images/fai_hook.png" align="middle" title="{t}Hook attributes{/t}">&nbsp;
+    <LABEL for="FAIscript">
+        {t}Script{/t}
+    </LABEL>
+    </h2>
+<table width="99%" summary="">
+    <tr>
+        <td>
+{render acl=$FAIscriptACL}
+            <textarea name="FAIscript" style="width:100%;height:300px;" id="FAIscript" 
+                               rows=20 cols=120>{$FAIscript}</textarea>
+{/render}
+        </td>
+    </tr>
+</table>
+<br>
+<div>
+{render acl=$FAIscriptACL}
+    <input type="file" name="ImportFile">&nbsp;
+{/render}
+{render acl=$FAIscriptACL}
+    <input type="submit" name="ImportUpload" value="{t}Import script{/t}" >
+{/render}
+{render acl=$FAIscriptACL}
+       {$DownMe}
+{/render}
+</div>
+
+<p class="seperator">&nbsp;</p>
+<br>
+<div style="align:right;" align="right">
+       <input type="submit" value="{t}Apply{/t}"       name="SaveSubObject">&nbsp;
+       <input type="submit" value="{t}Cancel{/t}"      name="CancelSubObject">
+</div>
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('cn','description');
+  -->
+</script>
+
diff --git a/gosa-core/plugins/admin/fai/faiNewBranch.tpl b/gosa-core/plugins/admin/fai/faiNewBranch.tpl
new file mode 100755 (executable)
index 0000000..831e028
--- /dev/null
@@ -0,0 +1,55 @@
+{if $iframe == false}
+
+<br>
+<p class="seperator">
+{t}You are now going to create a branch or locked branch. This action clones the existing release to another release name. Branches can be modified as usual. FAI classes of locked branches cannot be modified, just additional classes are possible. Branch names should be alphanumeric, excluding the reserved names 'scripts', 'hooks', 'partitions', 'variables', 'templates' and 'fai'.{/t}
+<br>
+{t}Branches are created as subreleases of the currently selected branch. Creating a new branch named 1.0.2 in SARGE for example, will result in a new release called SARGE/1.0.2.{/t}
+ <br>
+<br>
+</p>
+<p class="seperator">
+<br>
+<b>{t}Please enter a name for the branch{/t}</b> &nbsp;
+<input type="text" id="BranchName" name="BranchName" value="{$BranchName}" style="width:120px;">
+<br>
+<br>
+</p>
+
+<div align="right">
+       <p>
+               <input type="submit" value="{t}Apply{/t}"       name="UseBranchName">           
+               <input type="submit" value="{t}Cancel{/t}"      name="CancelBranchName">                
+       </p>
+</div>
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+       <!--
+       focus_field('BranchName');
+       -->
+</script>
+{else}
+
+<h2>{t}Processing the requested operation{/t}</h2>
+{t}As soon as the copy operation has finished, you can scroll down to end of the page and press the 'Continue' button to continue with the fai management dialog.{/t}
+<br>
+<br>
+<div style="margin:3px;background-color:white; border:1px solid #A0A0A0">
+<iframe src="?plug={$plugID}&amp;PerformBranch=1" width="100%" name="status" style="height:450px;background-color:#FFFFFF;">
+
+       <p>{t}Your browser doesn't support iframes, please use this link to perform the requested operation.{/t}
+               <br>
+               <a href='?plug={$plugID}&amp;PerformBranch=1' target="_blank" title="{t}Perform requested operation.{/t}"><b>{t}Initiate operation{/t}</b></a>
+       </p>    
+</iframe>
+</div>
+<!--
+<p class="seperator">&nbsp;</p>
+<div style="text-align: right;width:99%;">
+       <p>
+               <input type="submit" name="CancelBranchName" value="{t}Back{/t}">
+       </p>
+</div>
+-->
+{/if}
diff --git a/gosa-core/plugins/admin/fai/faiPackage.tpl b/gosa-core/plugins/admin/fai/faiPackage.tpl
new file mode 100644 (file)
index 0000000..87c83d9
--- /dev/null
@@ -0,0 +1,100 @@
+<table width="100%" summary="">
+       <tr>
+               <td width="50%" valign="top" style="border-right:1px solid #A0A0A0">
+                               <h2><img class="center" alt="" src="images/forward.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2>
+                               <table summary="" cellspacing="4">
+                                       <tr>
+                                               <td>
+                                                       <LABEL for="cn">
+                                                       {t}Name{/t}
+                                                       </LABEL>
+                                               </td>
+                                               <td>
+{render acl=$cnACL}
+                                                       <input value="{$cn}" size="45" disabled id="cn">
+{/render}
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>
+                                                       <LABEL for="description">
+                                                       {t}Description{/t}
+                                                       </LABEL>
+                                               </td>
+                                               <td>
+{render acl=$descriptionACL}
+                                                       <input value="{$description}" size="45" name="description" id="description">
+{/render}
+                                               </td>
+                                       </tr>
+                               </table>
+               </td>
+               <td width="50%" valign="top">
+                       <h2><img class="center" alt="" src="images/network.png" align="middle" title="{t}Repository{/t}">&nbsp;{t}Repository{/t}</h2>
+                               <table summary="" cellspacing="4">
+                                       <tr>
+                                               <td>
+                                                       {t}Release{/t} : 
+                                               </td>
+                                               <td>
+                                                       {$release}
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>
+                                                       {t}Section{/t} : 
+                                               </td>
+                                               <td>
+                                                       {$section}
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                           <td>
+                                                 {t}Install method{/t} :
+                                               </td>
+                                               <td>
+{render acl=$FAIinstallMethodACL}
+                                                       <select name="FAIinstallMethod" title='{t}Please select the installation method{/t}'>
+                                                         {html_options options=$FAIinstallMethods output=$FAIinstallMethod selected=$FAIinstallMethod}
+                                                       </select>
+{/render}
+                                               </td>
+                                       </tr>
+                               </table>
+               </td>
+       </tr>
+</table>
+<p class="seperator">&nbsp;</p>
+<table width="99%" summary="">
+       <tr>
+               <td> 
+                       <h2><img class="center" alt="" src="images/fai_packages.png" align="middle" title="{t}Used packages{/t}">&nbsp;{t}Used packages{/t}</h2>
+                       <br>
+                       <select id="usedPackages" name="usedPackages[]" title="{t}Choosen packages{/t}" multiple style="width:100%;height:300px;">
+                               {html_options options=$usedPackages}
+                               <option value="">&nbsp;</option>
+               </select>
+                       <br>
+{render acl=$FAIpackageACL}
+                       <input type="submit" name="Addpkg" value="{t}Add{/t}">
+{/render}
+{render acl=$FAIpackageACL}
+                       <input type="submit" name="Delpkg" value="{t}Remove{/t}">
+{/render}
+{render acl=$FAIdebconfInfoACL}
+                       <input type="submit" name="Conpkg" value="{t}Configure{/t}">
+{/render}
+{render acl=$FAIpackageACL}
+                       <input type="submit" name="Markpkg" value="{t}Toggle remove flag{/t}">
+{/render}
+               </td>
+       </tr>
+</table>
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('cn','description');
+  -->
+</script>
+
diff --git a/gosa-core/plugins/admin/fai/faiPackageConfiguration.tpl b/gosa-core/plugins/admin/fai/faiPackageConfiguration.tpl
new file mode 100644 (file)
index 0000000..db04759
--- /dev/null
@@ -0,0 +1,9 @@
+<h1><img class="center" alt="" src="images/forward.png" align="middle" title="{t}Package{/t}">&nbsp;{$headline}</h1>
+{$Config}
+<p class="seperator">&nbsp;</p>
+<br>
+<div align="right" style="align:right;">
+    <input name="SaveObjectConfig" value="{t}Apply{/t}" type="submit">
+    <input name="CancelObjectConfig" value="{t}Cancel{/t}" type="submit">
+</div>
+
diff --git a/gosa-core/plugins/admin/fai/faiPackageEntry.tpl b/gosa-core/plugins/admin/fai/faiPackageEntry.tpl
new file mode 100644 (file)
index 0000000..79f47c6
--- /dev/null
@@ -0,0 +1,66 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
+<tr>
+       <td style="vertical-align:top;width:600px">
+               <div class="contentboxh">
+               <p class="contentboxh">
+                       {t}List of available packages{/t}
+               </p>
+               </div>
+               <div class="contentboxb">
+               {$faihead}
+               </div>
+               <div style='height:4px;'>
+               </div>
+               <div class="contentboxb" style="border-top:1px solid #B0B0B0;">
+               {$failist}
+               <input type="hidden" name="edit_helper">
+               </div>
+       </td>
+       <td style="vertical-align:top;">
+               <div class="contentboxh" style="border-bottom:1px solid #B0B0B0;">
+               <p class="contentboxh">
+                               <img src="{$infoimage}" align="right" alt="[i]">{t}Information{/t}
+                       </p>
+               </div>
+               <div class="contentboxb" style="padding:4px;">
+                       {t}This menu allows you to select multiple packages to add them to the currently edited package list.{/t}
+               </div>
+               <br>
+               <div class="contentboxh">
+               <p class="contentboxh">
+                               <img src="{$launchimage}" align="right" alt="[F]">
+                               {t}Filters{/t}
+                       </p>
+               </div>
+               <div class="contentboxb"> 
+                       {$CHKS}
+               </div>
+               <div class="contentboxb">
+               <table summary=""  style="width:100%;">
+                       <tr>
+                               <td>
+                                               <img alt="{t}Display objects matching{/t}" src="{$search_image}" align=middle title='{t}Display objects matching{/t}'>
+                               </td>
+                               <td width="99%">
+                                       <input type='text' name='searchStrPKG' maxlength='40' style='width:99%' value='{$searchStrPKG}' id='filter' 
+                                            title='{t}Regular expression for matching object names{/t}' onClick="mainform.filter.value='';" onChange="mainform.submit()">
+                               </td>
+                       </tr>
+               </table>
+                {$apply}
+               </div>
+       </td>
+</tr>
+</table>
+<div align="right" style="align:right;">
+       <input id="SaveSubObject" name="SaveSubObject" value="{t}Apply{/t}" type="submit">
+       <input id="CancelSubObject" name="CancelSubObject" value="{t}Cancel{/t}" type="submit">
+</div>
+<input type="hidden" name="ignore">
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('filter');
+  -->
+</script>
+
diff --git a/gosa-core/plugins/admin/fai/faiPartitionTable.tpl b/gosa-core/plugins/admin/fai/faiPartitionTable.tpl
new file mode 100644 (file)
index 0000000..f330fe6
--- /dev/null
@@ -0,0 +1,68 @@
+<table width="100%" summary="">
+       <tr>
+               <td width="50%" valign="top">
+                               <h2><img class="center" alt="" src="images/fai_small.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2>
+                               <table summary="" cellspacing="4">
+                                       <tr>
+                                               <td>
+                                                       <LABEL for="cn">
+                                                       {t}Name{/t}{$must}
+                                                       </LABEL>
+                                               </td>
+                                               <td>
+{render acl=$cnACL}
+                                                       <input value="{$cn}" size="45" maxlength="80" id='cn' disabled >
+{/render}
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>
+                                                       <LABEL for="description">
+                                                       {t}Description{/t}
+                                                       </LABEL>
+                                               </td>
+                                               <td>
+{render acl=$descriptionACL}
+                                                       <input value="{$description}" size="45" maxlength="80" name="description" id="description">
+{/render}
+                                               </td>
+                                       </tr>
+                               </table>
+               </td>
+               <td style="border-left: 1px solid rgb(160, 160, 160);">
+                  &nbsp;
+               </td>
+               <td>
+                               <h2><img class="center" alt="" src="images/fai_partitionTable.png" align="middle" title="{t}Objects{/t}">&nbsp;
+                                       <LABEL for="SubObject">
+                                               {t}Discs{/t}
+                                       </LABEL>
+                               </h2>
+                               <table width="100%" summary="">
+                               <tr>
+                                       <td>
+                                               <select name="disks[]" title="{t}Choose a disk to delete or edit{/t}" style="width:100%" size="20" id="SubObject" multiple>
+                                                       {html_options options=$disks}
+                                                       <option>&nbsp;</option>
+                                               </select><br>
+{if $sub_object_is_addable}
+                                               <input type="submit" name="AddDisk"     value="{t}Add{/t}"     title="{t}Add{/t}">
+{else}
+                                               <input type="submit" name="AddDisk"     value="{t}Add{/t}"     title="{t}Add{/t}" disabled >
+{/if}
+
+                                               <input type="submit" name="EditDisk"    value="{t}Edit{/t}"    title="{t}Edit{/t}">
+                                               <input type="submit" name="DelDisk"     value="{t}Delete{/t}"  title="{t}Delete{/t}">
+                                       </td>
+                               </tr>
+                               </table>
+               </td>
+       </tr>
+</table>
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('cn','description');
+  -->
+</script>
+
diff --git a/gosa-core/plugins/admin/fai/faiPartitionTableEntry.tpl b/gosa-core/plugins/admin/fai/faiPartitionTableEntry.tpl
new file mode 100644 (file)
index 0000000..4379b66
--- /dev/null
@@ -0,0 +1,48 @@
+<input type="hidden" name="TableEntryFrameSubmitted" value="1">
+<h2><img class="center" alt="" src="images/fai_partitionTable.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Device{/t}</h2>
+<table style='width:100%' summary="">
+       <tr>
+               <td style='width:50%;border-right:1px solid #909090;'><LABEL for="DISKcn">
+                       {t}Name{/t}
+                       </LABEL>{$must}&nbsp;
+{render acl=$DISKcnACL}
+                       <input value="{$DISKcn}" size="45" maxlength="80" name="DISKcn" id="DISKcn">
+{/render}
+               </td>
+               <td><LABEL for="DISKdescription">
+                       &nbsp;{t}Description{/t}
+                       </LABEL>&nbsp;
+{render acl=$DISKdescriptionACL}
+                       <input value="{$DISKdescription}" size="45" maxlength="80" name="DISKdescription" id="DISKdescription">
+{/render}
+               </td>
+       </tr>
+</table>
+<br>
+<p class="seperator">&nbsp;</p>
+<br>
+<h2><img class="center" alt="" src="images/editpaste.png" align="middle" title="{t}Partition entries{/t}">&nbsp;{t}Partition entries{/t}</h2>
+{$setup}
+<br>
+{if $sub_object_is_createable}
+       <input type="submit" name="AddPartition" value="{t}Add partition{/t}">
+{else}
+       <input type="submit" name="restricted" value="{t}Add partition{/t}" disabled>
+{/if}
+<br>   
+<br>
+<p class="seperator">&nbsp;</p>
+<br>
+<div style="align:right;" align="right">
+{render acl=$allowSave}
+<input type="submit" name="SaveDisk" value="{t}Save{/t}">
+{/render}
+<input type="submit" name="CancelDisk" value="{t}Cancel{/t}" >
+</div>
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('DISK_cn');
+  -->
+</script>
+
diff --git a/gosa-core/plugins/admin/fai/faiProfile.tpl b/gosa-core/plugins/admin/fai/faiProfile.tpl
new file mode 100644 (file)
index 0000000..090d968
--- /dev/null
@@ -0,0 +1,58 @@
+<table width="100%" summary="">
+       <tr>
+               <td width="50%" valign="top">
+                       <h2><img class="center" alt="" src="images/forward.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2>
+                       <table summary="" cellspacing="4">
+                               <tr>
+                                       <td>
+                                               <LABEL for="cn">
+                                               {t}Name{/t}{$must}
+                                               </LABEL>
+                                       </td>
+                                       <td>
+{render acl=$cnACL}
+                                               <input value="{$cn}" size="45" maxlength="80" id="cn" name="cn">
+{/render}
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>
+                                               <LABEL for="description">
+                                               {t}Description{/t}
+                                               </LABEL>
+                                       </td>
+                                       <td>
+{render acl=$descriptionACL}
+                                               <input value="{$description}" size="45" maxlength="80" name="description" id="description">
+{/render}
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+               <td valign="top" style="border-left: 1px solid rgb(160, 160, 160);">
+                       <table summary="" style="vertical-align:top; text-align:left;" cellpadding=4 width="100%">
+                               <tr>
+                                       <td style="vertical-align:top;">
+                                               <h2><img class="center" alt="" src="images/fai_template.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}FAI classes{/t}</h2> 
+<!--                                           <select name="FAIclass" title="{t}Choose a priority{/t}" size="20" style="width:100%;" multiple>
+                                                       {html_options values=$FAIclasses output=$FAIclasses}
+                                               </select>-->
+                                               {$divlist}
+                                               <br>
+{render acl=$FAIclassACL}
+                                               <input type="submit" name="AddClass" value="{t}Add{/t}">
+{/render}
+                                               <input type="hidden" name="edit_helper">
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+       </tr>
+</table>
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('cn','description');
+  -->
+</script>
+
diff --git a/gosa-core/plugins/admin/fai/faiProfileEntry.tpl b/gosa-core/plugins/admin/fai/faiProfileEntry.tpl
new file mode 100644 (file)
index 0000000..72e865b
--- /dev/null
@@ -0,0 +1,73 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
+<tr>
+  <td style="vertical-align:top;width:600px">
+       <div class="contentboxh" style="height:20px">
+       <p class="contentboxh" style="font-size:12px">
+               {t}List of FAI objects (Fully Automatic Installation){/t}
+       </p>
+       </div>
+       <div class="contentboxb">
+       {$faihead}
+       </div>
+       <div style='height:4px;'></div>
+       <div class="contentboxb" style="border-top:1px solid #B0B0B0;">
+       {$failist}
+               <input type=hidden name="edit_helper">
+       </div>
+  </td>
+  <td style="vertical-align:top;">
+       <div class="contentboxh" style="height:20px;border-bottom:1px solid #B0B0B0">
+       <p class="contentboxh" style="font-size:12px">
+                       <img src="{$infoimage}" align="right" alt="[i]">{t}Information{/t}
+               </p>
+       </div>
+       <div class="contentboxb">
+               <p class="contentboxb" style="border-color:#f0f0f0;">
+               {t}This menu allows you to select FAI class names and to add them to the currently edited profile.{/t}
+               </p>
+       </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><input onClick='document.mainform.submit()' 
+                                                               type="checkbox" name="SShowTemplates"   {$SShowTemplatesCHK}>{t}Show only classes with templates{/t}</td></tr>
+                       <tr><td><input onClick='document.mainform.submit()'
+                                                                       type="checkbox" name="SShowScripts"             {$SShowScriptsCHK}>{t}Show only classes with scripts{/t}</td></tr>
+                       <tr><td><input onClick='document.mainform.submit()'
+                                                                       type="checkbox" name="SShowHooks"               {$SShowHooksCHK}>{t}Show only classes with hooks{/t}</td></tr>
+                       <tr><td><input onClick='document.mainform.submit()'
+                                                                       type="checkbox" name="SShowVariables"   {$SShowVariablesCHK}>{t}Show only classes with variables{/t}</td></tr>
+                       <tr><td><input onClick='document.mainform.submit()'
+                                                                       type="checkbox" name="SShowPackages"    {$SShowPackagesCHK}>{t}Show only classes with packages{/t}</td></tr>
+                       <tr><td><input onClick='document.mainform.submit()'
+                                                               type="checkbox" name="SShowPartitions"  {$SShowPartitionsCHK}>{t}Show only classes with partitions{/t}</td></tr>
+                </table>
+        <table summary=""  style="width:100%;border-top:1px solid #B0B0B0;">
+               <tr>
+                       <td>
+                                       <img alt="{t}Display objects matching{/t}" src="{$search_image}" 
+                                                       align=middle title='{t}Display objects matching{/t}'>
+                       </td>
+                       <td width="99%">
+                                       <input type='text' name='Sregex' maxlength='20' style='width:99%' value='{$Sregex}' id='filter' 
+                                               title='{t}Regular expression for matching object names{/t}' onClick="mainform.submit()">
+                       </td>
+               </tr>
+       </table>
+               {$apply}
+               </div>
+       </td>
+</tr>
+</table>
+
+<div align="right" style="align:right;">
+       <input name="SaveSubObject" value="{t}Apply{/t}" type="submit">
+       <input name="CancelSubObject" value="{t}Cancel{/t}" type="submit">
+</div>
+<!-- Place cursor -->
diff --git a/gosa-core/plugins/admin/fai/faiScript.tpl b/gosa-core/plugins/admin/fai/faiScript.tpl
new file mode 100644 (file)
index 0000000..c0ff247
--- /dev/null
@@ -0,0 +1,63 @@
+<table width="100%" summary="">
+       <tr>
+               <td width="50%" valign="top">
+                               <h2><img class="center" alt="" src="images/fai_small.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2>
+                               <table summary="" cellspacing="4">
+                                       <tr>
+                                               <td>
+                                                       <LABEL for="cn">
+                                                       {t}Name{/t}{$must}
+                                                       </LABEL>
+                                               </td>
+                                               <td>
+{render acl=$cnACL}
+                                                       <input value="{$cn}"  maxlength="80" size="45" disabled id="cn">
+{/render}
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>
+                                                       <LABEL for="description">
+                                                       {t}Description{/t}
+                                                       </LABEL>
+                                               </td>
+                                               <td>
+{render acl=$descriptionACL}
+                                                       <input size="45" maxlength="80" value="{$description}" name="description" id="description" >
+{/render}
+                                               </td>
+                                       </tr>
+                               </table>
+               </td>
+       </tr>
+</table>
+<p class="seperator">&nbsp;</p>
+<table width="100%" summary="">
+       <tr>
+               <td>
+                               <h2><img class="center" alt="" src="images/fai_script.png" align="middle" title="{t}Objects{/t}">&nbsp;
+                                               {t}List of scripts{/t}
+                               </h2>
+                               <table width="100%" summary="" style="border:1px solid #B0B0B0; " cellspacing=0 cellpadding=0>
+                               <tr>
+                                       <td>
+                                               {$Entry_divlist}
+{if $sub_object_is_addable}
+                                               <input type="submit" name="AddSubObject"     value="{t}Add{/t}" title="{t}Add{/t}" >
+{else}
+                                               <input type="submit" name="AddSubObject"     value="{t}Add{/t}" title="{t}Add{/t}" disabled>
+{/if}
+                                       </td>
+                               </tr>
+                               </table>
+               </td>
+       </tr>
+</table>
+<input type="hidden" value="1" name="FAIscript_posted" >
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+<!--
+       focus_field("cn","description");
+-->
+</script>
+
diff --git a/gosa-core/plugins/admin/fai/faiScriptEntry.tpl b/gosa-core/plugins/admin/fai/faiScriptEntry.tpl
new file mode 100644 (file)
index 0000000..cddb2bb
--- /dev/null
@@ -0,0 +1,92 @@
+<input type="hidden" name="SubObjectFormSubmitted" value="1">
+<table width="100%" summary="">
+       <tr>
+               <td valign="top" width="50%">
+                       <h2><img class="center" alt="" src="images/forward.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2>
+                               <table summary="">
+                                       <tr>
+                                               <td>
+                                                       {t}Name{/t}{$must}&nbsp;
+                                               </td>
+                                               <td>
+{render acl=$cnACL}
+                                                       <input value="{$cn}" size="45" maxlength="80" name="cn">
+{/render}
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>
+                                                       {t}Description{/t}&nbsp;
+                                               </td>
+                                               <td>
+{render acl=$descriptionACL}
+                                                       <input size="45" maxlength="80" value="{$description}" name="description">
+{/render}
+                                               </td>
+                                       </tr>
+                               </table>
+               </td>
+               <td style="border-left: 1px solid rgb(160, 160, 160);">
+           &nbsp;
+        </td>
+               <td valign="top">
+                               <h2><img class="center" alt="" src="images/fai_script.png" align="middle" title="{t}Properties{/t}">&nbsp;{t}Script attributes{/t}</h2>
+                               <table summary="" width="100%">
+                                       <tr>
+                                               <td>
+                                                       <LABEL for="FAIpriority">
+                                                       {t}Priority{/t}
+                                                       </LABEL>
+                                               </td>
+                                               <td>
+{render acl=$FAIpriorityACL}
+                                                   <select id="FAIpriority" name="FAIpriority" title="{t}Choose a priority. Low values result in earlyer, high values in later excecution.{/t}">
+                                               {html_options options=$FAIprioritys selected=$FAIpriority}
+                                       </select>
+{/render}
+                                               </td>
+                                       </tr>
+                               </table>
+               </td>
+       </tr>
+</table>
+<p class="seperator">&nbsp;</p>
+<h2><img class="center" alt="" src="images/fai_script.png" align="middle" title="{t}Script attributes{/t}">&nbsp;
+       <LABEL for="FAIscript">
+               {t}Script{/t}
+       </LABEL>
+       </h2>
+<table summary="" width="99%">
+    <tr>
+        <td>
+{render acl=$FAIscriptACL}
+            <textarea name="FAIscript" style="width:100%;height:300px;" id="FAIscript"  
+                               rows="20" cols="120">{$FAIscript}</textarea>
+{/render}
+        </td>
+    </tr>
+</table>
+<br>
+<div>
+{render acl=$FAIscriptACL}
+       <input type="file" name="ImportFile">&nbsp;
+{/render}
+{render acl=$FAIscriptACL}
+       <input type="submit" name="ImportUpload" value="{t}Import script{/t}">
+{/render}
+{render acl=$FAIscriptACL}
+       {$DownMe}
+{/render}
+</div>
+<br>
+<div style="align:right;" align="right">
+       <input type="submit" value="{t}Apply{/t}"       name="SaveSubObject">&nbsp;
+       <input type="submit" value="{t}Cancel{/t}"      name="CancelSubObject">
+</div>
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('cn','description');
+  -->
+</script>
+
diff --git a/gosa-core/plugins/admin/fai/faiSummary.tpl b/gosa-core/plugins/admin/fai/faiSummary.tpl
new file mode 100644 (file)
index 0000000..196f7ca
--- /dev/null
@@ -0,0 +1,27 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left; border:1px solid #B0B0B0;"  cellpadding=0 cellspacing=0 border=0>
+
+ <tr style="background-color: #E8E8E8; height:26px;font-weight:bold;">
+  <td style="padding:5px;">{t}FAI object tree{/t}</td>
+ </tr>
+
+{if $readable}
+ <tr>
+       <td style="padding-left:5px;padding-top:5px;padding-bottom:12px;border-bottom:1px solid #B0B0B0">
+               <input type="image" src="images/list_reload.png" name="reloadList" class="center">      
+               {t}Reload class and release configuration from parent object.{/t}
+       </td>
+ </tr>
+ <tr style="background-color: #E8E8E8; ">
+       <td>
+ {$objectList}
+       </td>
+ </tr>
+{else}
+<tr>
+       <td style='padding:6px;'>
+               {t}You are not allowed to view the fai summary.{/t}
+       </td>
+</tr>
+{/if}
+</table>
+
diff --git a/gosa-core/plugins/admin/fai/faiTemplate.tpl b/gosa-core/plugins/admin/fai/faiTemplate.tpl
new file mode 100644 (file)
index 0000000..627c5dd
--- /dev/null
@@ -0,0 +1,52 @@
+<table summary="" width="100%">
+       <tr>
+               <td valign="top" style="border-right:1px solid #A0A0A0; width:50%">
+                               <h2><img class="center" alt="" src="images/fai_small.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2>
+                               <table summary="" cellspacing="4">
+                                       <tr>
+                                               <td>
+                                                       <LABEL for="cn">
+                                                       {t}Name{/t}{$must}
+                                                       </LABEL>
+                                               </td>
+                                               <td>
+{render acl=$cnACL}
+                                                       <input value="{$cn}" size="45" maxlength="80" disabled id="cn">
+{/render}
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>
+                                                       <LABEL for="description">
+                                                       {t}Description{/t}
+                                                       </LABEL>
+                                               </td>
+                                               <td>
+{render acl=$descriptionACL}
+                                                       <input value="{$description}" size="45" maxlength="80" name="description" id="description">
+{/render}
+                                               </td>
+                                       </tr>
+                               </table>
+               </td>
+               <td style="width:50%">
+                               <h2><img class="center" alt="" src="images/fai_template.png" align="middle" title="{t}Objects{/t}">&nbsp;
+                                       {t}List of template files{/t}
+                               </h2>
+                       {$Entry_divlist}
+{if $sub_object_is_addable}
+                               <input type="submit" name="AddSubObject"     value="{t}Add{/t}"         title="{t}Add{/t}">
+{else}
+                               <input type="submit" name="AddSubObject"     value="{t}Add{/t}"         title="{t}Add{/t}" disabled>
+{/if}
+               </td>
+       </tr>
+</table>
+<input type="hidden" value="1" name="FAItemplate_posted">
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('cn','description');
+  -->
+</script>
+
diff --git a/gosa-core/plugins/admin/fai/faiTemplateEntry.tpl b/gosa-core/plugins/admin/fai/faiTemplateEntry.tpl
new file mode 100644 (file)
index 0000000..b8ee41a
--- /dev/null
@@ -0,0 +1,203 @@
+<input type="hidden" name="SubObjectFormSubmitted" value="1">
+
+<h2><img class="middle" alt="" src="images/forward.png" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2>
+<table width="100%" summary="">
+<tr>
+       <td width="50%">
+               <table>
+                 <tr>
+                   <td>
+               {t}File name{/t}{$must}&nbsp;
+                   </td>
+                   <td>
+{render acl=$cnACL}
+               <input value="{$cn}" name="cn" size="45" maxlength="80">&nbsp;&nbsp;
+{/render}
+                   </td>
+                  </tr>
+                 <tr>
+                       <td>
+                               <LABEL for="templatePath">
+                                       {t}Destination path{/t}{$must}&nbsp;
+                               </LABEL>
+                               </td>
+                       <td>
+{render acl=$FAItemplatePathACL}
+                               <input type="text" name="FAItemplatePath" value="{$templatePath}" id="templatePath" size="45">
+{/render}
+                               </td>
+                 </tr>
+               </table>
+       </td>
+       <td>
+               {t}Description{/t}&nbsp;
+{render acl=$descriptionACL}
+               <input size="45" maxlength="80" value="{$description}" name="description">
+{/render}
+       </td>
+</tr>
+</table>
+
+<p class="seperator">&nbsp;</p>
+
+<table width="100%" summary="">
+<tr>
+  <td colspan=2><h2><img class="middle" alt="" src="images/fai_template.png" title="{t}Template attributes{/t}">&nbsp;{t}Template attributes{/t}</h2></td>
+</tr>
+<tr>
+  <td style="vertical-align:top;width:50%;border-right:1px solid #B0B0B0">
+   <table summary="">
+    <tr>
+               <td style="vertical-align:top">
+                       <LABEL for="FAItemplateFile">
+                               {t}File{/t}{$must}&nbsp;
+                       </LABEL>
+                       </td>
+               <td style="vertical-align:top" class="center">
+                       {$status}
+                       {if $bStatus}
+                         <a href="getbin.php?rand={$rand}">
+                               <img class="center" alt="{t}Save template{/t}..." title="{t}Save template{/t}..." src="images/save.png" border="0" />
+                         </a>
+                       {/if}
+                       <br>
+                       <br>
+{render acl=$FAItemplateFileACL}
+                       <input type="file" name="FAItemplateFile" value="{$FAItemplateFile}" id="FAItemplateFile">
+{/render}
+{render acl=$FAItemplateFileACL}
+                       &nbsp;<input type="submit" value="{t}Upload{/t}" name="TmpFileUpload">
+{/render}
+                       <br>
+                       <br>
+                       </td>
+       </tr><tr>
+                       <td>
+                               {t}Full path{/t}&nbsp;
+                               </td>
+                       <td>
+{render acl=$FAItemplatePathACL}
+                               <i>{$FAItemplatePath}</i>
+{/render}
+                               </td>
+               </tr>
+               </table>
+       </td>
+       <td>
+         <table summary="">
+               <tr>
+       
+               <td>
+                       <LABEL for="user">
+                               {t}Owner{/t}{$must}&nbsp;
+                       </LABEL>
+                       </td>
+               <td>
+{render acl=$FAIownerACL}
+                       <input type="text" name="user" value="{$user}" id="user" size="15">
+{/render}
+               </td>
+       </tr><tr>
+               <td style="vertical-align:top">
+                       <LABEL for="group">
+                               {t}Group{/t}{$must}&nbsp;
+                       </LABEL>
+                       </td>
+               <td>
+{render acl=$FAIownerACL}
+                       <input type="text" name="group" value="{$group}" id="group" size="15">
+{/render}
+                       <br>
+                       <br>
+               </td>
+       </tr><tr>
+               <td style="vertical-align:top">{t}Access{/t}{$must}&nbsp; </td>
+               <td>
+         <table summary="" style="border:1px solid #B0B0B0">
+              <colgroup width="55" span="3">
+               </colgroup>
+               <tr>
+                       <th>{t}Class{/t}</th>
+                       <th>{t}Read{/t}</th>
+                       <th>{t}Write{/t}</th>
+                       <th>{t}Execute{/t}</th>
+                       <th>&nbsp;</th>
+                       <th>{t}Special{/t}</th>
+                       <th>&nbsp;</th>
+               </tr>
+               <tr><td>{t}User{/t}</td>
+{render acl=$FAImodeACL}
+                       <td align="center"><input type="checkbox" name="u4" value="4" {$u4}></td>
+{/render}
+{render acl=$FAImodeACL}
+                       <td align="center"><input type="checkbox" name="u2" value="2" {$u2}></td>
+{/render}
+{render acl=$FAImodeACL}
+                       <td align="center"><input type="checkbox" name="u1" value="1" {$u1}></td>
+{/render}
+                       <td>&nbsp;</td>
+{render acl=$FAImodeACL}
+                       <td align="center"><input type="checkbox" name="s4" value="4" {$s4}></td>
+{/render}
+                       <td>({t}SUID{/t})</td>
+                       </tr>
+
+               <tr><td>{t}Group{/t}</td>
+{render acl=$FAImodeACL}
+                       <td align="center"><input type="checkbox" name="g4" value="4" {$g4}></td>
+{/render}
+{render acl=$FAImodeACL}
+                       <td align="center"><input type="checkbox" name="g2" value="2" {$g2}></td>
+{/render}
+{render acl=$FAImodeACL}
+                       <td align="center"><input type="checkbox" name="g1" value="1" {$g1}></td>
+{/render}
+                       <td>&nbsp;</td>
+{render acl=$FAImodeACL}
+                       <td align="center"><input type="checkbox" name="s2" value="2" {$s2}></td>
+{/render}
+                       <td>({t}SGID{/t})</td>
+                       </tr>
+
+               <tr><td>{t}Others{/t}</td>
+{render acl=$FAImodeACL}
+                       <td align="center"><input type="checkbox" name="o4" value="4" {$o4}></td>
+{/render}
+{render acl=$FAImodeACL}
+                       <td align="center"><input type="checkbox" name="o2" value="2" {$o2}></td>
+{/render}
+{render acl=$FAImodeACL}
+                       <td align="center"><input type="checkbox" name="o1" value="1" {$o1}></td>
+{/render}
+                       <td>&nbsp;</td>
+{render acl=$FAImodeACL}
+                       <td align="center"><input type="checkbox" name="s1" value="1" {$s1}></td>
+{/render}
+                       <td>({t}sticky{/t})</td>
+       </tr></table>
+       
+               </td></tr></table>
+       </td>
+</tr>
+<tr>
+<td colspan=2>
+<br>
+<p class="seperator">&nbsp;</p>
+<br>
+<div style="align:right;" align="right">
+       <input type="submit" value="{t}Apply{/t}"       name="SaveSubObject">&nbsp;
+       <input type="submit" value="{t}Cancel{/t}"      name="CancelSubObject">
+</div>
+</td>
+</tr>
+</table>
+
+<input type='hidden' name='FAItemplateEntryPosted' value='1'>
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('cn','description');
+  -->
+</script>
+
diff --git a/gosa-core/plugins/admin/fai/faiVariable.tpl b/gosa-core/plugins/admin/fai/faiVariable.tpl
new file mode 100644 (file)
index 0000000..cdbdab9
--- /dev/null
@@ -0,0 +1,72 @@
+<table summary="" width="100%">
+       <tr>
+               <td width="50%" valign="top">
+                               <h2><img class="center" alt="" src="images/fai_small.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2>
+                               <table summary="" cellspacing="4">
+                                       <tr>
+                                               <td>
+                                                       <LABEL for="cn">
+                                                       {t}Name{/t}{$must}
+                                                       </LABEL>
+                                               </td>
+                                               <td>
+{render acl=$cnACL}
+                                                       <input value="{$cn}" size="45" maxlength="80" disabled id="cn">
+{/render}
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>
+                                                       <LABEL for="description">
+                                                       {t}Description{/t}
+                                                       </LABEL>
+                                               </td>
+                                               <td>
+{render acl=$descriptionACL}
+                                                       <input size="45" maxlength="80" value="{$description}" name="description" id="description">
+{/render}
+                                               </td>
+                                       </tr>
+                               </table>
+               </td>
+               <td style="border-left: 1px solid rgb(160, 160, 160);">
+                  &nbsp;
+               </td>
+               <td>
+                               <h2><img class="center" alt="" src="images/fai_variable.png" align="middle" title="{t}Objects{/t}">&nbsp;
+                                       <LABEL for="SubObject">
+                                               {t}List of assigned variables{/t}
+                                       </LABEL>
+                               </h2>
+                               <table summary="" width="100%">
+                               <tr>
+                                       <td>
+                                               <select name="SubObject[]" multiple  title="{t}Choose a variable to delete or edit{/t}" 
+                                                       style="width:100%;" size="20" id="SubObject">
+                                                       {html_options options=$SubObjects}
+                                               </select><br>
+{if $is_createable}
+                                       <input type="submit" name="AddSubObject"     value="{t}Add{/t}"         title="{t}Add{/t}">
+{else}
+                                       <input disabled type="submit" name="AddSubObject"     value="{t}Add{/t}"                title="{t}Add{/t}">
+{/if}
+                                       <input type="submit" name="EditSubObject"    value="{t}Edit{/t}"    title="{t}Edit{/t}" >
+{if $is_removeable}
+                                       <input type="submit" name="DelSubObject"     value="{t}Delete{/t}"  title="{t}Delete{/t}">
+{else}
+                                       <input disabled type="submit" name="DelSubObject"     value="{t}Delete{/t}"  title="{t}Delete{/t}">
+{/if}
+                                       </td>
+                               </tr>
+                               </table>
+               </td>
+       </tr>
+</table>
+<input type="hidden" value="1" name="FAIvariable_posted">
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('cn','description');
+  -->
+</script>
+
diff --git a/gosa-core/plugins/admin/fai/faiVariableEntry.tpl b/gosa-core/plugins/admin/fai/faiVariableEntry.tpl
new file mode 100644 (file)
index 0000000..0fd8a4a
--- /dev/null
@@ -0,0 +1,64 @@
+<input type="hidden" name="SubObjectFormSubmitted" value="1">
+<table width="100%" summary="">
+       <tr>
+               <td valign="top" width="50%">
+                       <h2><img class="center" alt="" src="images/fai_small.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2>
+                               <table summary="">
+                                       <tr>
+                                               <td>
+                                                       {t}Name{/t}{$must}&nbsp;
+                                               </td>
+                                               <td>
+{render acl=$cnACL}
+                                                       <input value="{$cn}" size="45" maxlength="80" name="cn">
+{/render}
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>
+                                                       {t}Description{/t}&nbsp;
+                                               </td>
+                                               <td>
+{render acl=$descriptionACL}
+                                                       <input value="{$description}" size="45" maxlength="80" name="description">
+{/render}
+                                               </td>
+                                       </tr>
+                               </table>
+               </td>
+               <td style="border-left: 1px solid rgb(160, 160, 160);">
+           &nbsp;
+        </td>
+               <td valign="top">
+                               <h2><img class="center" alt="" src="images/fai_variable.png" align="middle" title="{t}Variable attributes{/t}">&nbsp;{t}Variable attributes{/t}</h2>
+                               <table  summary="" width="100%">
+                                       <tr>
+                                               <td>
+                                                       <LABEL for="Content">
+                                                       {t}Variable content{/t}{$must}&nbsp;
+                                                       </LABEL>
+                                               </td>
+                                               <td>
+{render acl=$FAIvariableContentACL}
+                                                       <input type="text" name="FAIvariableContent" value="{$FAIvariableContent}" id="Content" style="width:250px;">
+{/render}
+                                               </td>
+                                       </tr>
+                               </table>
+               </td>
+       </tr>
+</table>
+<p class="seperator">&nbsp;</p>
+<br>
+<div style="align:right;" align="right">
+       <input type="submit" value="{t}Apply{/t}"       name="SaveSubObject" >&nbsp;
+       <input type="submit" value="{t}Cancel{/t}"      name="CancelSubObject">
+</div>
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('cn','description');
+  -->
+</script>
+
diff --git a/gosa-core/plugins/admin/fai/main.inc b/gosa-core/plugins/admin/fai/main.inc
new file mode 100644 (file)
index 0000000..ab6749d
--- /dev/null
@@ -0,0 +1,55 @@
+<?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
+*/
+
+if ($remove_lock){
+        if(isset($_SESSION['FAI'])){
+                $FAI= $_SESSION['FAI'];
+                $FAI->remove_lock();
+                del_lock ($ui->dn);
+                sess_del ('FAI');
+        }
+} else {
+       /* Create usermanagement object on demand */
+       if (!isset($_SESSION['FAI']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+               $_SESSION['FAI']= new faiManagement($config, $ui);
+               $_SESSION['FAI']->set_acl_category("fai");
+               $_SESSION['FAI']->set_acl_base($_SESSION['CurrentMainBase']);
+       }
+       $FAI= $_SESSION['FAI'];
+       $FAI->save_object();
+       $output= $FAI->execute();
+
+       /* Reset requested? */
+       if (isset($_GET['reset']) && $_GET['reset'] == 1){
+               del_lock ($ui->dn);
+               sess_del ('FAI');
+       }
+       /* Page header*/
+       if (isset($_SESSION['objectinfo'])){
+               $display= print_header(get_template_path('images/fai.png'), _("Fully Automatic Installation"), "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".@LDAP::fix($_SESSION['objectinfo']));
+       } else {
+               $display= print_header(get_template_path('images/fai.png'), _("Fully Automatic Installation"));
+       }
+       $display.= $output;
+
+       $_SESSION['FAI']= $FAI;
+}
+
+?>
diff --git a/gosa-core/plugins/admin/fai/remove.tpl b/gosa-core/plugins/admin/fai/remove.tpl
new file mode 100644 (file)
index 0000000..10bf93d
--- /dev/null
@@ -0,0 +1,24 @@
+<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' object information. 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">
+{if $multiple}
+       <input type=submit name="delete_multiple_fai_object_confirm" value="{t}Delete{/t}">
+       &nbsp;
+       <input type=submit name="delete_multiple_fai_object_cancel" value="{t}Cancel{/t}">
+{else}
+       <input type=submit name="delete_terminal_confirm" value="{t}Delete{/t}">
+       &nbsp;
+       <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
+{/if}
+</p>
diff --git a/gosa-core/plugins/admin/fai/remove_branch.tpl b/gosa-core/plugins/admin/fai/remove_branch.tpl
new file mode 100755 (executable)
index 0000000..3ed7f23
--- /dev/null
@@ -0,0 +1,18 @@
+<div style="font-size:18px;">
+ <img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
+</div>
+<p>
+  {$info}
+  {t}This includes all account data, system access, etc. for this branch. 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}So - if you're sure - press 'Delete' to continue or 'Cancel' to abort.{/t}
+</p>
+
+<p class="plugbottom">
+  <input type=submit name="delete_branch_confirm" value="{t}Delete{/t}">
+  &nbsp;
+  <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
+</p>
+
diff --git a/gosa-core/plugins/admin/fai/tabsHook.inc b/gosa-core/plugins/admin/fai/tabsHook.inc
new file mode 100644 (file)
index 0000000..1857854
--- /dev/null
@@ -0,0 +1,48 @@
+<?php
+
+class tabsHook extends tabs
+{
+  var $base= "";
+
+  function tabsHook($config, $data, $dn,$category)
+  {
+       tabs::tabs($config, $data, $dn,$category);
+       /* Add references/acls/snapshots */
+       $this->addSpecialTabs();
+  }
+
+  function check($ignore_account= FALSE)
+  {
+       return (tabs::check(TRUE));
+  }
+  
+
+  function save($ignore_account= FALSE)
+  {
+       $baseobject= $this->by_object['faiHook'];
+
+       $new_dn= 'cn='.$baseobject->cn.",ou=hooks,ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase'];
+       
+       if($_SESSION['faifilter']['branch']!="main"){
+               $new_dn ='cn='.$baseobject->cn.",ou=hooks,".$_SESSION['faifilter']['branch'];
+       }
+
+       if ($this->dn != $new_dn && $this->dn != "new"){
+               
+               /* if( new_dn is subtree of this->dn ) */
+               $cnt1 = count(split(",",$this->dn));
+               $cnt2 = count(split(",",$new_dn));
+               if((strstr($new_dn,$this->dn))&&($cnt1<$cnt2)){
+                       print_red(_("Try to move tree failed. Destination tree is subtree of source tree."));
+               }else{
+//                     $baseobject->recursive_move($this->dn, $new_dn);
+               }
+       }
+       $this->dn= $new_dn;
+
+       tabs::save(TRUE);
+  }
+
+}
+
+?>
diff --git a/gosa-core/plugins/admin/fai/tabsPackage.inc b/gosa-core/plugins/admin/fai/tabsPackage.inc
new file mode 100644 (file)
index 0000000..8731835
--- /dev/null
@@ -0,0 +1,48 @@
+<?php
+
+class tabsPackage extends tabs
+{
+  var $base= "";
+
+  function tabsPackage($config, $data, $dn,$category)
+  {
+       tabs::tabs($config, $data, $dn,$category);
+
+       /* Add references/acls/snapshots */
+       $this->addSpecialTabs();
+  }
+
+  function check($ignore_account= FALSE)
+  {
+       return (tabs::check(TRUE));
+  }
+  
+
+  function save($ignore_account= FALSE)
+  {
+       $baseobject= $this->by_object['faiPackage'];
+
+       $new_dn= 'cn='.$baseobject->cn.",ou=packages,ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase'];
+       if($_SESSION['faifilter']['branch']!="main"){
+               $new_dn ='cn='.$baseobject->cn.",ou=packages,".$_SESSION['faifilter']['branch'];
+       }
+                       
+       if ($this->dn != $new_dn && $this->dn != "new"){
+               
+               /* if( new_dn is subtree of this->dn ) */
+               $cnt1 = count(split(",",$this->dn));
+               $cnt2 = count(split(",",$new_dn));
+               if((strstr($new_dn,$this->dn))&&($cnt1<$cnt2)){
+                       print_red(_("Try to move tree failed. Destination tree is subtree of source tree."));
+               }else{
+//                     $baseobject->recursive_move($this->dn, $new_dn);
+               }
+       }
+       $this->dn= $new_dn;
+
+       tabs::save(TRUE);
+  }
+
+}
+
+?>
diff --git a/gosa-core/plugins/admin/fai/tabsPartition.inc b/gosa-core/plugins/admin/fai/tabsPartition.inc
new file mode 100644 (file)
index 0000000..9d2312d
--- /dev/null
@@ -0,0 +1,49 @@
+<?php
+
+class tabsPartition extends tabs
+{
+  var $base= "";
+
+  function tabsPartition($config, $data, $dn,$category)
+  {
+       tabs::tabs($config, $data, $dn,$category);
+
+       /* Add references/acls/snapshots */
+       $this->addSpecialTabs();
+  }
+
+  function check($ignore_account= FALSE)
+  {
+       return (tabs::check(TRUE));
+  }
+  
+
+  function save($ignore_account= FALSE)
+  {
+       $baseobject= $this->by_object['faiPartitionTable'];
+
+       $new_dn= 'cn='.$baseobject->cn.",ou=disk,ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase'];
+       
+       if($_SESSION['faifilter']['branch']!="main"){
+               $new_dn ='cn='.$baseobject->cn.",ou=disk,".$_SESSION['faifilter']['branch'];
+       }
+
+       if ($this->dn != $new_dn && $this->dn != "new"){
+               
+               /* if( new_dn is subtree of this->dn ) */
+               $cnt1 = count(split(",",$this->dn));
+               $cnt2 = count(split(",",$new_dn));
+               if((strstr($new_dn,$this->dn))&&($cnt1<$cnt2)){
+                       print_red(_("Try to move tree failed. Destination tree is subtree of source tree."));
+               }else{
+//                     $baseobject->recursive_move($this->dn, $new_dn);
+               }
+       }
+       $this->dn= $new_dn;
+
+       tabs::save(TRUE);
+  }
+
+}
+
+?>
diff --git a/gosa-core/plugins/admin/fai/tabsProfile.inc b/gosa-core/plugins/admin/fai/tabsProfile.inc
new file mode 100644 (file)
index 0000000..cbc3abd
--- /dev/null
@@ -0,0 +1,49 @@
+<?php
+
+class tabsProfile extends tabs
+{
+  var $base= "";
+
+  function tabsProfile($config, $data, $dn,$category)
+  {
+       tabs::tabs($config, $data, $dn,$category);
+
+       /* Add references/acls/snapshots */
+       $this->addSpecialTabs();
+  }
+
+  function check($ignore_account= FALSE)
+  {
+       return (tabs::check(TRUE));
+  }
+  
+
+  function save($ignore_account= FALSE)
+  {
+       $baseobject= $this->by_object['faiProfile'];
+
+       $new_dn= 'cn='.$baseobject->cn.",ou=profiles,ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase'];
+
+       if($_SESSION['faifilter']['branch']!="main"){
+               $new_dn ='cn='.$baseobject->cn.",ou=profiles,".$_SESSION['faifilter']['branch'];
+       }
+                       
+       if ($this->dn != $new_dn && $this->dn != "new"){
+               
+               /* if( new_dn is subtree of this->dn ) */
+               $cnt1 = count(split(",",$this->dn));
+               $cnt2 = count(split(",",$new_dn));
+               if((strstr($new_dn,$this->dn))&&($cnt1<$cnt2)){
+                       print_red(_("Try to move tree failed. Destination tree is subtree of source tree."));
+               }else{
+//                     $baseobject->recursive_move($this->dn, $new_dn);
+               }
+       }
+       $this->dn= $new_dn;
+
+       tabs::save(TRUE);
+  }
+
+}
+
+?>
diff --git a/gosa-core/plugins/admin/fai/tabsScript.inc b/gosa-core/plugins/admin/fai/tabsScript.inc
new file mode 100644 (file)
index 0000000..28ebd22
--- /dev/null
@@ -0,0 +1,49 @@
+<?php
+
+class tabsScript extends tabs
+{
+  var $base= "";
+
+  function tabsScript($config, $data, $dn,$category)
+  {
+       tabs::tabs($config, $data, $dn,$category);
+
+       /* Add references/acls/snapshots */
+       $this->addSpecialTabs();
+  }
+
+  function check($ignore_account= FALSE)
+  {
+       return (tabs::check(TRUE));
+  }
+  
+
+  function save($ignore_account= FALSE)
+  {
+       $baseobject= $this->by_object['faiScript'];
+
+       $new_dn= 'cn='.$baseobject->cn.",ou=scripts,ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase'];
+
+       if($_SESSION['faifilter']['branch']!="main"){
+               $new_dn ='cn='.$baseobject->cn.",ou=scripts,".$_SESSION['faifilter']['branch'];
+       }
+       
+       if ($this->dn != $new_dn && $this->dn != "new"){
+               
+               /* if( new_dn is subtree of this->dn ) */
+               $cnt1 = count(split(",",$this->dn));
+               $cnt2 = count(split(",",$new_dn));
+               if((strstr($new_dn,$this->dn))&&($cnt1<$cnt2)){
+                       print_red(_("Try to move tree failed. Destination tree is subtree of source tree."));
+               }else{
+//                     $baseobject->recursive_move($this->dn, $new_dn);
+               }
+       }
+       $this->dn= $new_dn;
+
+       tabs::save(TRUE);
+  }
+
+}
+
+?>
diff --git a/gosa-core/plugins/admin/fai/tabsTemplate.inc b/gosa-core/plugins/admin/fai/tabsTemplate.inc
new file mode 100644 (file)
index 0000000..2ff5819
--- /dev/null
@@ -0,0 +1,49 @@
+<?php
+
+class tabsTemplate extends tabs
+{
+  var $base= "";
+
+  function tabsTemplate($config, $data, $dn,$category)
+  {
+       tabs::tabs($config, $data, $dn, $category);
+
+       /* Add references/acls/snapshots */
+       $this->addSpecialTabs();
+  }
+
+  function check($ignore_account= FALSE)
+  {
+       return (tabs::check(TRUE));
+  }
+  
+
+  function save($ignore_account= FALSE)
+  {
+       $baseobject= $this->by_object['faiTemplate'];
+       
+       $new_dn= 'cn='.$baseobject->cn.",ou=templates,ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase'];
+
+       if($_SESSION['faifilter']['branch']!="main"){
+               $new_dn ='cn='.$baseobject->cn.",ou=templates,".$_SESSION['faifilter']['branch'];
+       }
+
+       if ($this->dn != $new_dn && $this->dn != "new"){
+               
+               /* if( new_dn is subtree of this->dn ) */
+               $cnt1 = count(split(",",$this->dn));
+               $cnt2 = count(split(",",$new_dn));
+               if((strstr($new_dn,$this->dn))&&($cnt1<$cnt2)){
+                       print_red(_("Try to move tree failed. Destination tree is subtree of source tree."));
+               }else{
+//                     $baseobject->recursive_move($this->dn, $new_dn);
+               }
+       }
+       $this->dn= $new_dn;
+
+       tabs::save(TRUE);
+  }
+
+}
+
+?>
diff --git a/gosa-core/plugins/admin/fai/tabsVariable.inc b/gosa-core/plugins/admin/fai/tabsVariable.inc
new file mode 100644 (file)
index 0000000..c872f2d
--- /dev/null
@@ -0,0 +1,49 @@
+<?php
+
+class tabsVariable extends tabs
+{
+  var $base= "";
+
+  function tabsVariable($config, $data, $dn,$category)
+  {
+       tabs::tabs($config, $data, $dn, $category);
+
+       /* Add references/acls/snapshots */
+       $this->addSpecialTabs();
+  }
+
+  function check($ignore_account= FALSE)
+  {
+       return (tabs::check(TRUE));
+  }
+  
+
+  function save($ignore_account= FALSE)
+  {
+       $baseobject= $this->by_object['faiVariable'];
+
+       $new_dn= 'cn='.$baseobject->cn.",ou=variables,ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase'];
+       
+       if($_SESSION['faifilter']['branch']!="main"){
+               $new_dn ='cn='.$baseobject->cn.",ou=variables,".$_SESSION['faifilter']['branch'];
+       }
+                       
+       if ($this->dn != $new_dn && $this->dn != "new"){
+               
+               /* if( new_dn is subtree of this->dn ) */
+               $cnt1 = count(split(",",$this->dn));
+               $cnt2 = count(split(",",$new_dn));
+               if((strstr($new_dn,$this->dn))&&($cnt1<$cnt2)){
+                       print_red(_("Try to move tree failed. Destination tree is subtree of source tree."));
+               }else{
+//                     $baseobject->recursive_move($this->dn, $new_dn);
+               }
+       }
+       $this->dn= $new_dn;
+
+       tabs::save(TRUE);
+  }
+
+}
+
+?>
diff --git a/gosa-core/plugins/admin/groups/application.tpl b/gosa-core/plugins/admin/groups/application.tpl
new file mode 100644 (file)
index 0000000..87d8050
--- /dev/null
@@ -0,0 +1,44 @@
+{if $enableReleaseManagement == true}
+       <br>
+       <b>{t}Release focus{/t}</b>&nbsp;
+       {if $ReleaseSelectAble}
+{render acl=$FAIreleaseACL}
+               <select name="FAIrelease" title="{t}Select release name{/t}" onChange="javascript: document.mainform.submit();">
+                       {html_options output=$Releases values=$Releases selected=$FAIrelease}
+               </select>
+{/render}
+       {else}
+               {$Release}
+       {/if}
+       <p class="seperator">&nbsp;</p>
+{
+/if}
+<table summary="" style="width:100%;">
+ <tr>
+  <td style="width:48%; vertical-align:top;">
+   <b>
+       <LABEL for="used_apps">{t}Used applications{/t}</LABEL>
+   </b>
+   {$UsedApps}
+{render acl=$gosaMemberApplicationACL} 
+   <input type="text" value="" size="30" name='CatName'>
+{/render}
+{render acl=$gosaMemberApplicationACL} 
+   <input type="submit" value="{t}Add category{/t}" name='AddCat'>
+{/render}
+  </td>
+  <td>&nbsp;
+  </td>
+  <td style="width:48%;vertical-align:top;">
+   <b>
+    <LABEL for="apps">{t}Available applications{/t}</LABEL>
+   </b>
+   <br>
+   {$List}
+{render acl=$gosaMemberApplicationACL} 
+   <input type="submit" value="{t}Add{/t}" name='AddApps'>
+{/render}
+  </td>
+ </tr>
+</table>
+
diff --git a/gosa-core/plugins/admin/groups/application_options.tpl b/gosa-core/plugins/admin/groups/application_options.tpl
new file mode 100644 (file)
index 0000000..aa55221
--- /dev/null
@@ -0,0 +1,15 @@
+<br>
+<b>{t}Application options{/t}</b>
+<br>
+<br>
+
+{$table}
+
+<div style="height:20px;"></div>
+
+<p class="plugbottom">
+  <input type=submit name="edit_options_finish" value="{t}Apply{/t}">
+  &nbsp;
+  <input type=submit name="edit_options_cancel" value="{t}Cancel{/t}">
+</p>
+
diff --git a/gosa-core/plugins/admin/groups/class_divListGroup.inc b/gosa-core/plugins/admin/groups/class_divListGroup.inc
new file mode 100644 (file)
index 0000000..fcf32f8
--- /dev/null
@@ -0,0 +1,351 @@
+<?php
+
+class divListGroup extends MultiSelectWindow
+{
+
+  /* Current base */
+  var $selectedBase       = "";
+  var $departments        = array();
+
+  /* Regex */
+  var $Regex              = "*";
+  var $UserRegex          = "*";
+
+  /* CheckBoxes, to change default values modify $this->AddCheckBox */
+  var $ShowPrimaryGroups;
+  var $ShowSambaGroups;  
+  var $ShowApplicationGroups; 
+  var $ShowMailGroups;
+  var $ShowFunctionalGroups;
+
+  /* Subsearch checkbox */
+  var $SubSearch              = false;
+
+  var $parent             ;
+  var $ui                 ;
+
+  function divListGroup (&$config, &$parent)
+  {
+    MultiSelectWindow::MultiSelectWindow($config, "Groups", "groups");
+    
+    $this->parent       = &$parent;
+    $this->ui           = get_userinfo();
+
+    /* Set list strings */
+    $this->SetTitle(_("List of groups"));
+    $this->SetSummary(_("List of groups"));
+    $this->EnableAplhabet   (true);
+
+    /* Result page will look like a headpage */
+    $this->SetHeadpageMode();
+    $this->SetInformation(_("This menu allows you to add, edit and remove selected groups. You may want to use the range selector on top of the group listbox, when working with a large number of groups."));
+  
+    /* Disable buttonsm */
+    $this->EnableCloseButton(false);
+    $this->EnableSaveButton (false);
+
+    /* Dynamic action col, depending on snapshot icons */
+    $action_col_size = 80;
+    if($this->parent->snapshotEnabled()){
+      $action_col_size += 38;
+    }
+
+    /* Toggle all selected / deselected */
+    $chk = "<input type='checkbox' id='select_all' name='select_all'
+               onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
+
+    /* set Page header */
+    $this->AddHeader(array("string"=> $chk,          "attach"=>"style='width:20px;'"));
+    $this->AddHeader(array("string"=>"&nbsp;","attach"=>"style='width:20px;'"));
+    $this->AddHeader(array("string"=>_("Groupname / Department")));
+    $this->AddHeader(array("string"=>_("Properties"),"attach"=>"style='width:136px;'"));
+    $this->AddHeader(array("string"=>_("Actions"),"attach"=>"style='width:".$action_col_size."px;border-right:0px;'"));
+
+    /*                  Text        ,Value    ,Name         ,Is selected */
+    $this->AddCheckBox("ShowPrimaryGroups",     _("Select to see groups that are primary groups of users"),          _("Show primary groups"),      true);
+    $this->AddCheckBox("ShowSambaGroups",       _("Select to see groups that have samba groups mappings"),          _("Show samba groups"),      true);
+    $this->AddCheckBox("ShowApplicationGroups", _("Select to see groups that have applications configured"),        _("Show application groups"),true);
+    $this->AddCheckBox("ShowMailGroups",        _("Select to see groups that have mail settings"),                  _("Show mail groups"),       true);
+    $this->AddCheckBox("ShowFunctionalGroups",  _("Select to see normal groups that have only functional aspects"), _("Show functional groups"), true);
+    $this->AddCheckBox(SEPERATOR);
+
+    /* Add SubSearch checkbox */    
+    $this->AddCheckBox("SubSearch",  _("Select to search within subtrees"), _("Search in subtrees"), false);
+
+    /*                  Name                 ,Text                              ,Default  , Connect with alphabet  */
+    $this->AddRegex   ("Regex",     _("Regular expression for matching group names"), "*" , true);
+    $this->AddRegex   ("UserRegex", _("User name of which groups are shown"),         "*" , false, "images/search_user.png");
+  }
+
+
+  function GenHeader()
+  {
+    /* Prepare departments,
+       which are shown in the listbox on top of the listbox
+     */
+    $options= "";
+
+
+    
+    /* Get all departments within this subtree */
+    $ui= get_userinfo();
+    $first = "";
+    $found = FALSE;
+    $base = $this->config->current['BASE'];
+
+
+    
+    /* Add base */
+    $tmp = array();
+    $tmp[] = array("dn"=>$this->config->current['BASE']);
+    $tmp=  array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
+                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
+
+    $deps = array();
+    foreach($tmp as $tm){
+      $deps[$tm['dn']] = $tm['dn'];
+    }
+
+        /* Load possible departments */
+    $ui= get_userinfo();
+    $tdeps= $ui->get_module_departments("groups");
+    $ids = $this->config->idepartments;
+    $first = "";
+    $found = FALSE;
+    foreach($ids as $dep => $name){
+      if(isset($deps[$dep]) && in_array_ics($dep, $tdeps)){
+
+        /* Keep first base dn in mind, we could need this
+         *  info if no valid base was found
+         */
+        if(empty($first)) {
+          $first = $dep['dn'];
+        }
+
+        $value = $ids[$dep];
+        if ($this->selectedBase == $dep){
+          $found = TRUE;
+          $options.= "<option selected='selected' value='".$dep."'>$value</option>";
+        } else {
+          $options.= "<option value='".$dep."'>$value</option>";
+        }
+      }
+    }
+
+    /* The currently used base is not visible with your acl setup.
+     * Set base to first useable base.
+     */
+    if(!$found){
+      $this->selectedBase = $first;
+    }
+  
+    /* Get acls */
+    $acls   = $ui->get_permissions($this->selectedBase,"groups/group");
+    $acl_all= $ui->has_complete_category_acls($this->selectedBase,"groups");
+
+
+    /* Add default header */
+    $listhead = MultiSelectWindow::get_default_header();
+    
+    /* Add department selection */
+    $listhead .= _("Base")."&nbsp;<select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
+      " <input type='image' class='center' src='images/list_submit.png' title='"._("Submit department")."' name='submit_department' alt='"._("Submit").
+      "'>&nbsp;";
+
+
+        /* Create Layers menu */
+    $s  = ".|"._("Actions")."|\n";
+    $s .= "..|<img src='images/list_new.png' alt='' border='0' class='center'>".
+      "&nbsp;"._("Create")."|\n";
+
+
+    /* Append create options */
+    if(preg_match("/c/",$acl_all)) {
+      $s.= "...|<input class='center' type='image' src='images/list_new_group.png' alt=''>".
+        "&nbsp;"._("Group")."|group_new|\n";
+    }
+
+    /* Multiple options */
+    $s.= "..|---|\n";
+    $s.= "..|<img src='images/edittrash.png' alt='' border='0' class='center'>".
+      "&nbsp;"._("Remove")."|"."remove_multiple|\n";
+
+    /* Add multiple copy & cut icons */
+    if(is_object($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
+      $s.= "..|---|\n";
+      $s.= "..|<img src='images/editcopy.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Copy")."|"."multiple_copy_systems|\n";
+      $s.= "..|<img src='images/editcut.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Cut")."|"."multiple_cut_systems|\n";
+
+      if($this->parent->CopyPasteHandler->entries_queued()){
+        $img = "<img border='0' class='center' src='images/editpaste.png' alt=''>";
+        $s.="..|".$img."&nbsp;"._("Paste")."|editPaste|\n";
+      }else{
+        $img = "<img border='0' class='center' src='images/cant_editpaste.png' alt=''>";
+        $s.="..|".$img."&nbsp;"._("Paste")."\n";
+      }
+    }
+
+    /* Add snapshot icons */
+    if(preg_match("/(c.*w|w.*c)/",$acl_all)){
+      $s .= "..|---|\n";
+      $s .= $this->get_snapshot_header(TRUE);
+    }
+
+    $this->SetDropDownHeaderMenu($s);
+
+    $this->SetListHeader($listhead);
+  }
+
+  function execute()
+  {
+    $this->ClearElementsList();
+    $this->GenHeader();
+  }
+
+  function setEntries($groups)
+  {
+    // Defining Links
+    $linkopen = "<a href='?plug=".$_GET['plug']."&amp;act=dep_open&amp;dep_id=%s'>%s</a>";
+
+    // image Buttons
+    $editlink = "<a href='?plug=".$_GET['plug']."&amp;id=%s&amp;act=edit_entry'>%s</a>";
+    $userimg  = "<img class='center' src='images/select_groups.png' alt='User'    title='%s'>";
+
+    /* Dynamic action col, depending on snapshot icons */
+    $action_col_size = 80;
+    if($this->parent->snapshotEnabled()){
+      $action_col_size += 38;
+    }
+
+    /* Assign extension images */
+    $posiximg = "<input type='image' class='center' src='images/select_groups.png'
+                 name='group_group_edit_%KEY%' alt='P'  title='"._("Posix")  ."'>";
+    $mailimg  = "<input type='image' class='center' src='images/mailto.png'
+                 name='mailgroup_group_edit_%KEY%' alt='M'  title='"._("Mail")   ."'>";
+    $sambaimg = "<input type='image'  class='center' src='images/select_winstation.png'
+                 name='group_group_edit_%KEY%' alt='S'  title='"._("Samba")  ."'>";
+    $applimg  = "<input type='image'  class='center' src='images/select_application.png'
+                 name='appgroup_group_edit_%KEY%' alt='A'  title='"._("Application")."'>";
+    $phoneimg = "<input type='image'  class='center' src='images/select_phone.png'
+                 name='group_group_edit_%KEY%' alt='Ph' title='"._("Phone")  ."'>";
+    $envimg   = "<input type='image'  class='center' src='images/smallenv.png'
+                 name='environment_group_edit_%KEY%' alt='E' title='"._("Environment")  ."'>";
+
+    // Space
+    $empty    = "<img class='center' src='images/empty.png' style='width:16px;height:16px;' alt=''>";
+
+    // User and Template  Images
+    $editlink = "<a href='?plug=".$_GET['plug']."&amp;id=%s&amp;act=edit_entry'>%s</a>";
+
+    $ui = get_userinfo();
+
+    // Test Every Entry and generate divlist Array
+    foreach($groups as $key => $val){
+    
+      /* Create action icons - copy & paste icons */
+      $acl = $ui->get_permissions($val['dn'],"groups/group");
+      $acl_all= $ui->has_complete_category_acls($val['dn'],"groups");
+
+      $actions= "";
+      if(($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
+        $actions.= "<input class='center' type='image'
+          src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
+        $actions.= "<input class='center' type='image'
+          src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
+      }
+
+      /* Add edit icon */
+      $actions.= "<input class='center' type='image'
+        src='images/edit.png' alt='"._("edit")."' name='group_edit_%KEY%' title='"._("Edit this entry")."'>";
+
+      /* Add snapshot functionality */
+      if(preg_match("/(c.*w|w.*c)/", $acl_all)){
+        $actions.= $this->GetSnapShotActions($val['dn']);
+      }
+
+      if(preg_match("/d/",$acl)){
+        $actions.= "<input class='center' type='image'
+          src='images/edittrash.png' alt='"._("delete")."' name='group_del_%KEY%' title='"._("Delete this entry")."'>";
+      }
+
+
+      $posix=$mail=$samba=$appl=$phone=$enviro=$empty;
+
+      if(isset($val['objectClass'])){
+        if(in_array("posixGroup",           $val['objectClass']))   $posix = $posiximg;
+        if(in_array("gosaMailAccount",      $val['objectClass']))   $mail  = $mailimg;
+        if(in_array("sambaGroupMapping",    $val['objectClass']))   $samba = $sambaimg;
+        if(in_array("gosaApplicationGroup", $val['objectClass']))   $appl  = $applimg;
+        if(in_array("goFonPickupGroup",     $val['objectClass']))   $phone = $phoneimg;
+        if(in_array("gotoEnvironment",      $val['objectClass']))   $enviro= $envimg;
+      }
+
+      $title = "title='".preg_replace('/ /', '&nbsp;', @LDAP::fix($val['dn']))."'";
+
+      if(!isset($val['description'][0])){
+        $desc = "";
+      }else{
+        $desc = " - [ ".$val['description'][0]." ]";
+      }
+
+      /* FAIrelease tag from groupApplications */
+      if(isset($val['FAIrelease'][0])){
+        $desc .= " (".$val['FAIrelease'][0].")";
+      }
+
+      $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
+          "attach" => "style='width:20px;'");
+
+      /* Cutted objects should be displayed in light grey */
+      $display = $val['cn'][0].$desc;
+      if($this->parent->CopyPasteHandler){
+        foreach($this->parent->CopyPasteHandler->queue as $queue_key => $queue_data){
+          if($queue_data['dn'] == $val['dn']) {
+            $display = "<font color='#999999'>".$display."</font>";
+            break;
+          }
+        }
+      }
+
+      $field1 = array("string" => sprintf($userimg,$val['dn']), "attach" => "style='text-align:center;width:20px;'");
+      $field2 = array("string" => sprintf($editlink,$key,$display), "attach" => "style='' ".$title);
+      $field3 = array("string" => preg_replace("/%KEY%/", $key, $posix."&nbsp;".$enviro."&nbsp;".$mail."&nbsp;".$samba."&nbsp;".$appl."&nbsp;".$phone),     "attach" => "style='width:136px;'");
+      $field4 = array("string" => preg_replace("/%KEY%/", $key, $actions), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'");
+
+      $this->AddElement(array($field0,$field1,$field2,$field3,$field4));
+    }
+
+    /* Create summary string for list footer */
+    $num_deps=0;
+    if(!$this->SubSearch){
+      $num_deps = count($this->Added_Departments);
+    }
+    $num_grps = count($groups);
+
+    $num_grp_str = _("Number of listed groups");
+    $num_dep_str = _("Number of listed departments");
+
+    $str = "<img class='center' src='images/select_groups.png'
+              title='".$num_grp_str."' alt='".$num_grp_str."'>&nbsp;".$num_grps."&nbsp;&nbsp;&nbsp;&nbsp;";
+    $str.= "<img class='center' src='images/folder.png'
+              title='".$num_dep_str."' alt='".$num_dep_str."'>&nbsp;".$num_deps."&nbsp;&nbsp;&nbsp;&nbsp;";
+
+    $this->set_List_Bottom_Info($str);
+
+  }
+
+  function Save()
+  {
+    MultiSelectWindow :: Save();  
+  }
+
+  function save_object()
+  {
+    /* Save automatic created POSTs like regex, checkboxes */
+    MultiSelectWindow::save_object();   
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/groups/class_groupApplication.inc b/gosa-core/plugins/admin/groups/class_groupApplication.inc
new file mode 100644 (file)
index 0000000..12b80fa
--- /dev/null
@@ -0,0 +1,1230 @@
+<?php
+class appgroup extends plugin
+{
+  /* CLI vars */
+  var $cli_summary= "Manage application groups";
+  var $cli_description= "Some longer text\nfor help";
+  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* Appgroup attributes */
+  var $gosaMemberApplication= array();
+
+  /* Helpers */
+  var $departments        = "";       // All departments within $this->curbase;
+  var $apps               = array();  // All available applications
+  var $used_apps          = array();  // Specifies which applications are currently assigned 
+
+  var $option_name          = array();
+  var $option_value         = array();
+  var $appoption            = array();
+
+  var $table                  = "";
+  var $curbase                = "";
+  var $curCatDir                  ;
+  var $curCatDepth              =0;         //
+  var $Categories;
+
+  /* attribute list for save action */
+  var $attributes               = array("gosaMemberApplication","gosaApplicationParameter");
+  var $objectclasses            = array("gosaApplicationGroup");
+
+  var $FAIrelease               = "/";
+  var $InitialFAIrelease           = "/";
+  var $Releases                 = array();
+  var $enableReleaseManagement  = false;
+
+  var $AllAppsForRelease        = array();
+  var $AllAppsForReleaseParameter = array();
+  var $view_logged = FALSE;
+  var $CopyPasteVars            = array("Categories");
+  var $gosaApplicationParameter ;
+  var $ui                       = NULL;
+  var $no_release_acls          = false;
+
+  function appgroup (&$config, $dn= NULL, $parent= NULL)
+  {
+   
+    /* Check if we have relase mangement enabled and prepare group application for release management */ 
+    $tmp = $config->search("faiManagement", "CLASS",array('menu','tabs'));
+    if(!empty($tmp)){
+      $this->enableReleaseManagement = true;
+      $this->objectclasses  [] = "FAIreleaseTag";
+      $this->attributes     [] = "FAIrelease";
+    }
+
+    plugin::plugin ($config, $dn, $parent);
+
+    /* set userinfo object */
+    $this->ui = get_userinfo();
+
+    /* Compatibility check 
+        In some case of old applikations with old release tag saving, 
+          we must reassign is_account state.
+          (Or if release management wasn't activated before creating this app) */
+    if($this->enableReleaseManagement){
+  
+      /* Release management is activated && this is a valid group app account,
+          but no release class was found, so activate is_account flag  */
+      if(isset($this->attrs['objectClass'])){
+        if($dn != "new" && ( in_array("gosaApplicationGroup",$this->attrs['objectClass'])) && 
+            (!in_array("FAIreleaseTag",$this->attrs['objectClass']))){
+          $this->is_account =true;
+        }
+      }
+    }
+    
+    /* Load member applications */
+    if (isset ($this->attrs["gosaMemberApplication"][0])){
+      $this->gosaMemberApplication = array();
+      for ($i= 0; $i<$this->attrs["gosaMemberApplication"]["count"]; $i++){
+        $this->gosaMemberApplication[]=
+          $this->attrs["gosaMemberApplication"][$i];
+      }
+    }
+
+    /* Load application options */
+    if (isset($this->attrs['gosaApplicationParameter'])){
+      for ($i= 0; $i<$this->attrs['gosaApplicationParameter']['count']; $i++){
+        $option= preg_replace('/^[^:]+:/', '',
+            $this->attrs['gosaApplicationParameter'][$i]);
+        $name= preg_replace('/:.*$/', '',
+            $this->attrs['gosaApplicationParameter'][$i]);
+        $this->appoption[$name]= $option;
+      }
+    }
+
+    /* Parse MemberApplication*/
+    $tmp    = array();
+    $tmp2   = array();
+    $prios  = array();
+    $cats   = array();
+
+    foreach($this->gosaMemberApplication as $memberApp){
+      if(preg_match("/\|/i",$memberApp)){
+    
+        $tmp = split("\|",$memberApp);
+        if(!empty($tmp[0])){
+          $tmp2[$tmp[1]][$tmp[2]] = array("App"=>$tmp[0]);
+        }
+        if(!empty($tmp[1])){
+          $n = split("/",$tmp[1]);
+          $c = count($n);
+          $cats [$tmp[1]] = $n[$c-1];
+        }
+        $prios[$tmp[1]][$tmp[2]] = $tmp[2];
+      }else{
+        $tmp2[]['App'] = $memberApp;
+      }
+    }
+
+    /* Assign collected category and application settings */
+    $this->Categories = $cats;
+    $this->gosaMemberApplication = $tmp2;
+
+    /* Sort application by category */
+    $cats[""]="";
+    foreach($cats as $cat ){
+      if((isset($prios[$cat]))&&(count($prios[$cat]))){
+        $max = max($prios[$cat]);
+        $min = 1;//min($prios[$cat]);  
+        $last = false;
+        for($i = $min ; $i < $max ; $i++){
+          if(!isset($prios[$cat][$i])){
+            if($last == false){
+              $this->gosaMemberApplication[$cat][$i]['App'] = "__SEPARATOR__".$i;
+            
+              $last = true;
+            }
+          }else{
+            $last = false;
+          }
+        }
+      }
+    } 
+
+    /* Sort application by priority */
+    $tmp = array();
+    foreach($this->gosaMemberApplication as $key =>  $entries){
+      ksort ($entries);
+      foreach($entries as $entry){
+        $tmp[$key][]= $entry;
+      }
+    }
+    $this->gosaMemberApplication = $tmp;
+    $this->curbase = $this->config->current['BASE'];
+    
+    /* Get required release informations */
+    if($this->enableReleaseManagement){
+      $this->InitialFAIrelease  = $this->FAIrelease;
+      $this->Releases           = $this->getReleases();
+    }
+
+  }
+
+
+  /* Combine new array */
+  function combineArrays($ar0,$ar1,$ar2)
+  {
+    $ret = array();
+    if(is_array($ar0))
+    foreach($ar0 as $ar => $a){
+        $ret[$ar]=$a;
+    }
+    if(is_array($ar1))
+    foreach($ar1 as $ar => $a){
+        $ret[$ar]=$a;
+    }
+    if(is_array($ar2))
+    foreach($ar2 as $ar => $a){
+        $ret[$ar]=$a;
+    }
+    return($ret);
+  }
+
+  /* Returns element position within given array */
+  function getpos($atr,$attrs)
+  {
+    $i = 0;
+    foreach($attrs as $attr => $name)    {
+      $i++;
+      if($attr == $atr){
+        return($i);
+      }
+    }
+    return(-1);
+  }
+
+
+  /* Check current combination of application && release 
+      Are all application available?, application parameter changed? ... */
+  function diffAppsInReleases()
+  {
+    /* Only diff if it is required  */
+    $ret =array();
+
+    /* If current release has changed */
+    if($this->FAIrelease != $this->InitialFAIrelease){
+
+      /* Walk through all apps which are currently displayed */
+      if(isset($this->gosaMemberApplication[$this->curCatDir])){
+
+        foreach($this->gosaMemberApplication[$this->curCatDir] as $entry){
+
+          /* If application is also available in new release, check if parameter differs */
+          if(in_array($entry['App'],$this->AllAppsForRelease)){ 
+
+            $old = array();   // Old application parameter
+            $new = array();   // New parameters 
+
+            /* There are possibly no parameters specified */
+            if(isset($this->AllAppsForReleaseParameter[$this->InitialFAIrelease][$entry['App']])){
+              $old = $this->AllAppsForReleaseParameter[$this->InitialFAIrelease][$entry['App']];
+            }
+
+            if(isset($this->AllAppsForReleaseParameter[$this->FAIrelease][$entry['App']])){
+              $new = $this->AllAppsForReleaseParameter[$this->FAIrelease][$entry['App']];
+            }
+
+            /*  Both (old & new) have no gosaApplicationParameter
+             */
+            if((!isset($old['gosaApplicationParameter'])) && (!isset($new['gosaApplicationParameter']))){
+              $ret[$entry['App']] = false; 
+
+              /* Both got gosaApplicationParameter */
+            }elseif((isset($old['gosaApplicationParameter'])) && (isset($new['gosaApplicationParameter']))){
+              if(array_differs($old['gosaApplicationParameter'],$new['gosaApplicationParameter'])){
+                $ret[$entry['App']]  = true;
+              }else{
+                $ret[$entry['App']]  = false;
+              }
+            }
+            /* Initially had gosaApplicationParameter bot in new release not */
+          }elseif((isset($old['gosaApplicationParameter'])) && (!isset($new['gosaApplicationParameter']))){
+            $ret[$entry['App']]  = true;
+
+            /* Old release had no gosaApplicationParameter but new got some */
+          }elseif((!isset($old['gosaApplicationParameter'])) && (isset($new['gosaApplicationParameter']))){
+            $ret[$entry['App']]  = true;
+          }
+        }
+      }
+    }
+    return($ret);
+  }
+
+  /* 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);
+  }
+
+    
+  /* Sort category on position up  */
+  function catUp($id)
+  {
+    /* Get all cats depinding on current dir */
+    $cats = $this->GetSubdirs($this->curCatDir);
+    $newcats =$this->ArrayUp($id,$cats);
+    foreach($newcats as $cat => $name){
+      unset($this->Categories[$cat]);
+    }
+    foreach($newcats as $cat => $name){
+      $this->Categories[$cat]=$name;
+    }
+  }
+
+
+  /* Sort category on position down */
+  function catDown($id)
+  {
+    /* Get all cats depinding on current dir */
+    $cats = $this->GetSubdirs($this->curCatDir);
+    $newcats =$this->ArrayDown($id,$cats);
+    foreach($newcats as $cat => $name){
+      unset($this->Categories[$cat]);
+    }
+    foreach($newcats as $cat => $name){
+      $this->Categories[$cat]=$name;
+    }
+  }
+
+
+  /* Increase application priority */
+  function getOneUp($appl)
+  { 
+    $cat  = $this->curCatDir;
+    $apps = $this->gosaMemberApplication[$cat];
+    $appsA = array();
+    foreach ($apps as $appkey => $name){
+      $appsA[$name['App']] =$name['App'];
+    }
+    $result = $this->ArrayUp($appl,$appsA);
+    $ret = array();
+    foreach($result as $app){
+      $ret[]=array("App"=>$app);
+    }
+    $this->gosaMemberApplication[$cat] = $ret;
+  }
+
+
+  /* Decrease application priority */
+  function getOneDown($appl)
+  {
+    $cat  = $this->curCatDir;
+    $apps = $this->gosaMemberApplication[$cat];
+    $appsA = array();
+    foreach ($apps as $appkey => $name){
+      $appsA[$name['App']] =$name['App'];
+    }
+    $result = $this->ArrayDown($appl,$appsA);
+    $ret = array();
+    foreach($result as $app){
+      $ret[]=array("App"=>$app);
+    }
+    $this->gosaMemberApplication[$cat] = $ret;
+  } 
+
+
+  /* Add seperator to application list */
+  function AddSeperator($id)
+  {
+    $found  = false;
+    $cat    = "";
+    $tmp = array();
+    foreach($this->gosaMemberApplication[$this->curCatDir] as $appID => $app){  
+      $tmp[] = $app;    
+      if(($app['App'] == $id)&&(!$found)){
+        $cnt = count($this->gosaMemberApplication[$this->curCatDir]);
+        $tmp[] = array("App" => "__SEPARATOR__".($cnt+1));
+        $found = true;
+      }
+    }
+    if($found){
+      $this->gosaMemberApplication[$this->curCatDir]=$tmp;
+    }
+  }
+
+
+  /* Check if application acls are readable */
+  function check_acls()
+  {
+    return(count($this->ui->get_module_departments("application")));
+  }
+
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* Log view */
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","groups/".get_class($this),$this->dn);
+    }
+
+    /* Check if department was selected */ 
+    if((isset($_GET['act']))&&($_GET['act']=="depopen")){
+      $dep = base64_decode($_GET['depid']); 
+      $this->curbase =$dep;
+    }
+
+    /* Check if category was selected */
+    if((isset($_GET['act']))&&($_GET['act']=="open") && (empty($_GET['id']) || isset($this->Categories[base64_decode($_GET['id'])]))){
+      $this->curCatDir = base64_decode($_GET['id']);
+    }
+
+    /* 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;
+      }
+    }
+
+    /* Do we represent a valid group? */
+    if (!$this->is_account && $this->parent === NULL){
+      $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\">&nbsp;<b>".
+        _("This 'dn' is no appgroup.")."</b>";
+      return ($display);
+    }
+
+    /* Show tab dialog headers */
+    $display= "";
+    if ($this->parent !== NULL){
+      if ($this->is_account){
+        $display= $this->show_disable_header(_("Remove applications"),
+            _("This group has application features enabled. You can disable them by clicking below."));
+      } else {
+        $display.= $this->show_enable_header(_("Create applications"),
+            _("This group has application features disabled. You can enable them by clicking below."));
+        return ($display);
+      }
+    }
+
+    /* Check acl, applications must be readable */
+    if(!$this->check_acls()){
+      $display .= "<img src='images/button_cancel.png' alt='"._("ACL")."' class='center'>
+                  <b>"._("Insufficient permissions")."</b>
+                  <p>".
+                  _("You do not have permission to query application entries. All your changes will not be saved.").
+                  "</p><p class='seperator'>&nbsp;</p>";
+      $this->no_release_acls = true;
+    }
+    
+
+    /* Add Categorie */ 
+    if((isset($_POST['AddCat']))&&(isset($_POST['CatName']))&&(!empty($_POST['CatName']))){
+
+      /* Only allow adding a category, if it is allowed */  
+      if($this->acl_is_writeable("gosaMemberApplication",$this->no_release_acls)){
+
+        if(preg_match("/[\\\\\/]/i",$_POST['CatName'])){
+          print_red(_("Invalid character in category name."));
+        }elseif(!in_array($_POST['CatName'],$this->Categories)){ 
+          if(empty($this->curCatDir)){
+            $this->Categories[$_POST['CatName']]=$_POST['CatName'];
+          }else{
+            $this->Categories[$this->curCatDir."/".$_POST['CatName']]=$_POST['CatName'];
+          }
+        }else{
+          print_red(_("The specified category already exists."));
+        }
+      }
+    }
+
+
+    $this->reload();
+    $this->diffAppsInReleases();
+
+    /* Check POST variables for commands 
+        to add/remove some applications */
+    $only_once = false;
+    if($this->acl_is_writeable("gosaMemberApplication",$this->no_release_acls)){
+
+      /* Walk through posts */
+      foreach($_POST as $name => $value){
+
+        /* Add a seperator to current category */
+        if((preg_match("/AddSep_/",$name))&&(!$only_once)){
+          $only_once = true;
+          $n = preg_replace("/AddSep_/","",$name);
+          $val= preg_replace("/_.*$/","",$n);
+          $this->AddSeperator($val);
+        }
+
+        /* Delete application | seperator entry */
+        if((preg_match("/DelApp_/",$name))&&(!$only_once)){
+          $only_once = true;
+
+          if(preg_match("/DelApp___SEPARATOR__/",$name)) {
+            $n=  preg_replace("/DelApp___SEPARATOR__/","",$name);
+            $val= "__SEPARATOR__".preg_replace("/_.*$/","",$n);
+          }else{
+            $n = preg_replace("/DelApp_/","",$name);
+            $val= preg_replace("/_.*$/","",$n);
+          }
+
+          foreach($this->gosaMemberApplication as $key =>  $cat){
+            foreach($cat as $key2 => $app){
+              if($app['App'] == $val){
+                unset($this->gosaMemberApplication[$key][$key2]);
+                if(isset($this->used_apps[$val])){
+                  foreach($this->getParameters($val) as $para){
+                    if(isset($this->appoption[$para])){
+                      unset($this->appoption[$para]);
+                    }
+                  }
+                  unset($this->used_apps[$val]);
+                }
+              }
+            }
+          }
+        }
+
+        if(preg_match("/DelCat_/",$name) && !$only_once){
+          $only_once =TRUE;
+          $cat = preg_replace("/DelCat_/","",$name);
+          $cat = trim(base64_decode( preg_replace("/_.*$/","",$cat)));
+
+          $free_apps = array();
+
+          if(isset($this->gosaMemberApplication[$cat]) && is_array($this->gosaMemberApplication[$cat])){
+            foreach($this->gosaMemberApplication[$cat] as $app){
+              $free_apps[] = $app['App'];
+            }
+            unset($this->gosaMemberApplication[$cat]);
+            unset($this->Categories[$cat]);
+          }
+          foreach($this->Categories as $key => $name){
+            if(preg_match("/^".normalizePreg($cat)."\/.*/",$key)){
+              foreach($this->gosaMemberApplication[$key] as $app){
+                $free_apps[] = $app['App'];
+              }
+              unset($this->gosaMemberApplication[$key]);
+              unset($this->Categories[$key]);
+            }
+          }
+          foreach($free_apps as $app){
+            if(isset($this->used_apps[$app])){
+              unset($this->used_apps[$app]);
+            }
+          }
+        }
+
+        /* Edit application parameter */
+        if((preg_match("/EdiApp_/",$name))&&(!$only_once)){
+
+          $only_once = true;
+          $appname = $value;
+          $appname = preg_replace("/EdiApp_/","",$name);  
+          $appname = preg_replace("/_.*$/","",$appname);
+
+          /* We've got the appname, get parameters from ldap */
+          $ldap= $this->config->get_ldap_link();
+
+          /* Check if we have release management enabled */
+          $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
+          if(!empty($tmp)){
+    
+            /* Get application parameter from ldap */
+            $tmp = array_flip($this->Releases);
+            $base = $tmp[$this->FAIrelease];
+            $ldap->cd($base);
+            $ldap->search("(&(objectClass=gosaApplication)(cn=$appname))",array("gosaApplicationParameter"));
+            $found = "";
+            while($attrs = $ldap->fetch()) {
+              if(preg_match("/cn=".$appname.",".$base."/",$attrs['dn'])){
+                $found = $attrs['dn'];
+              }
+            }
+            $ldap->cat($found, array("gosaApplicationParameter"));
+          }else{
+
+            /* Get application parameter from ldap */
+            $ldap->cd($this->config->current['BASE']);
+            $ldap->search("(&(objectClass=gosaApplication)(cn=$appname))",array("gosaApplicationParameter"));
+          }
+
+          /* Check if this application is unique */
+          if ($ldap->count() != 1){
+            print_red (_("The selected application name is not uniq. Please check your LDAP."));
+          } else {
+
+            /* Get parameter */
+            $attrs= $ldap->fetch();
+            if(isset($attrs['gosaApplicationParameter'])){
+              $this->dialog= TRUE;
+
+              /* Fill name and value arrays */
+              for ($i= 0; $i<$attrs['gosaApplicationParameter']['count']; $i++){
+                $option= preg_replace('/^[^:]+:/', '',
+                    $attrs['gosaApplicationParameter'][$i]);
+                $name= preg_replace('/:.*$/', '', 
+                    $attrs['gosaApplicationParameter'][$i]);
+                $this->option_name[$i]= $name;
+
+                /* Fill with values from application, default should be
+                   loaded by the external scripts */
+                if (isset($this->appoption[$name])){
+                  $this->option_value[$i]= $this->appoption[$name];
+                }
+              }
+
+              /* Create edit field */
+              $table= "<table summary=\"\">";
+              for ($i= 0; $i < count($this->option_name); $i++){
+                if (isset($this->option_value[$i])){
+                  $value= $this->option_value[$i];
+                } else {
+                  $value= "";
+                }
+                $table.="<tr><td>".$this->option_name[$i]."</td><td>".
+                  "<input name=\"value$i\" size=60 maxlength=250 ".
+                  "value=\"".$value."\"><br></td></tr>";
+              }
+              $table.= "</table>";
+              $this->table= $table;
+            } else {
+              print_red (_("The selected application has no options."));
+            }
+          }
+        }
+      }
+    }
+
+    /* Add multiple */
+    if(isset($_POST['AddApps'])){
+      foreach($_POST as $name => $value){
+        if(preg_match("/AddApp_/",$name)){
+          $app = preg_replace("/AddApp_/","",$name);
+          $this->addApp($app);
+        }
+      }
+    }
+
+    /* Add application with post */
+    if((isset($_GET['act']))&&($_GET['act']=="add")){
+      $this->used_apps[$_GET['id']]= $_GET['id'];
+      asort($this->used_apps);
+      $this->addApp($_GET['id']);
+    }
+
+    /* Cancel edit options? */
+    if (isset($_POST['edit_options_cancel'])){
+      $this->dialog= FALSE;
+    }
+
+    /* Finish edit options? */
+    if (isset($_POST['edit_options_finish'])){
+      $this->dialog= FALSE;
+
+      /* Save informations passed by the user */
+      $this->option_value= array();
+      for ($i= 0; $i<count($this->option_name); $i++){
+        $this->appoption[$this->option_name[$i]]= $_POST["value$i"];
+        $this->is_modified= TRUE;
+      }
+    }
+
+    /* Prepare templating stuff */
+    $smarty= get_smarty();
+    $smarty->assign("used_apps", $this->used_apps);
+    $apps= array();
+    foreach ($this->apps as $key => $value){
+      if (!array_key_exists($key, $this->used_apps)){
+        $apps["$key"]= "$value";
+      }
+    }
+
+
+    /* Create application list */
+    $div = new divSelectBox("appgroup");    
+    $div->SetHeight(300);
+    $departments = array();
+    $res = get_list("(objectClass=gosaDepartment)", "application", $this->curbase,array("description","cn","ou"),GL_SIZELIMIT);
+    foreach($res as $value){
+      $fdn = $value['dn'];
+      $fdn = preg_replace("/".normalizePreg($this->curbase)."/","",$fdn);
+      $fdn= @LDAP::fix($fdn);
+      if($value["description"][0]!=".."){
+        $departments[$value['dn']]= convert_department_dn($fdn)." - [".$value["description"][0]."]";
+      }else{
+        $departments[$value['dn']]=convert_department_dn($fdn)." ["._("Back")."]";
+      }
+    }
+
+    /* Create 'open' and 'add' links */
+    if($this->acl_is_writeable("gosaMemberApplication",$this->no_release_acls)){
+      $linkadd  = "<a href='?plug=".$_GET['plug']."&amp;act=add&amp;id=%s'>%s</a>";
+    }else{
+      $linkadd = "%s";
+    }
+    $linkopen = "<a href='?plug=".$_GET['plug']."&amp;act=depopen&amp;depid=%s'>%s</a>";
+
+    /* Create base back entry */
+    $base_back = preg_replace("/^[^,]+,/","",$this->curbase);
+    if((strlen($base_back)>= strlen($this->config->current['BASE']))&&($this->curbase!=$this->config->current['BASE'])){
+      $div->AddEntry(array(
+            array("string"=>sprintf($linkopen,base64_encode($base_back),".. ["._("back")."]"),
+              "attach"=>"style='border:0px;'")
+            ));
+    }
+
+    /* Append departments for current base */
+    foreach($departments as $key => $app){
+      $div->AddEntry(array(
+            array("string"=>"<img class='center' src='images/folder.png' alt='"._("department")."'>&nbsp;".sprintf($linkopen,base64_encode($key),$app),
+              "attach"=>"style='border:0px;'")
+            ));
+    }
+
+    /* Add applications found on this base */
+    foreach($apps as $key => $app){
+      $div->AddEntry(array(
+            array("string"=>sprintf("<input class='center' type='checkbox' value='1' name='AddApp_%s'>",$key).
+              "<img class='center' src='images/select_application.png' alt='"._("application")."'>&nbsp;".sprintf($linkadd,$key,$app),
+              "attach"=>"style='border:0px;'")
+            ));
+    }
+
+    /* Create list of used/assigned applications */
+    $div2 = new divSelectBox("appgroup");
+    $div2->SetHeight(300);
+
+    /* Check acls to create "edit/remove" category links */
+    if(!$this->acl_is_writeable("gosaMemberApplication",$this->no_release_acls)){
+      $linkopen       = "<img class='center' src='images/folder.png' alt=\"\">&nbsp;<a href='?plug=".$_GET['plug']."&amp;act=open&amp;id=%s'>%s</a>";
+      $catremove      = "&nbsp;<img src='images/empty.png' alt='&nbsp;'>";
+      $catupdown      = "";
+    }else{
+      $linkopen       = "<img class='center' src='images/folder.png' alt=\"\">&nbsp;<a href='?plug=".$_GET['plug']."&amp;act=open&amp;id=%s'>%s</a>";
+      $catremove      = "&nbsp;<input type='image' src='images/edittrash.png' title='"._("Delete entry")."' name='DelCat_%s' value='%s'>";
+      $catupdown      = "<a href='?plug=".$_GET['plug']."&amp;act=cat_up&amp;id=%s'>".
+        "<img align='top' alt=\"\" src='images/sort_up.png' border=0 title='"._("Move up")."'>".
+        "</a>&nbsp;".
+        "<a href='?plug=".$_GET['plug']."&amp;act=cat_down&amp;id=%s'>".
+        "<img alt=\"\" src='images/sort_down.png' title='"._("Move down")."' border=0>".
+        "</a>";
+    }
+
+    /* Add back category for current category */
+    if(empty($this->curCatDir)){
+      $cnt =0;
+    }else{
+      $cnt = count(split("/",$this->curCatDir));
+      $tmp = split("/",$this->curCatDir);
+      $bbk = "";
+      for($i = 0 ; $i < ($cnt -1 ) ; $i++){
+        $bbk .= $tmp[$i]."/";
+      }
+      $bbk = preg_replace("/\/$/","",$bbk);
+      $div2 ->AddEntry(array(array("string"=>sprintf($linkopen,base64_encode($bbk),".. ["._("Back")."]")),array("string"=>"&nbsp;","attach"=>"style='border-right:0px;'")));
+    }
+
+    /* Add sub categories */ 
+    $this->GetSubdirs($this->curCatDir);
+    foreach($this->GetSubdirs($this->curCatDir) as $path => $name){
+      $div2 ->AddEntry(array( 
+            array("string"=>sprintf($linkopen,base64_encode($path),$name)),
+            array("string"=>preg_replace("/%s/",base64_encode($path),$catupdown.$catremove),
+              "attach"=>"align='right' style='width:80px;border-right:0px;'"))); 
+    }
+
+    /* Create priority & seperator links */
+    $separator ="<hr size=1>"; 
+    if($this->acl_is_writeable("gosaMemberApplication",$this->no_release_acls)){
+      $sep      = "<input type='image' src='images/back.png' title='"._("Insert seperator")."' value='%s' name='AddSep_%s'>";
+      $upudown  = "<a href='?plug=".$_GET['plug']."&amp;act=one_up&amp;id=%s'>".
+                  " <img alt='{t}sort{/t}' align='top' src='images/sort_up.png' title='"._("Move up")."' border=0>".
+                  "</a>&nbsp;".
+                  "<a href='?plug=".$_GET['plug']."&amp;act=one_down&amp;id=%s'>".
+                  " <img alt='{t}sort{/t}' src='images/sort_down.png' title='"._("Move down")."' border=0>".
+                  "</a>&nbsp;".
+                  "<input type='image' src='images/edittrash.png' title='"._("Delete entry")."' name='DelApp_%s' value='%s' alt='{t}delete{/t}' >";
+    }else{
+      $sep      = "";
+      $upudown  = "";
+    }
+     
+    /* Create edit link */ 
+    if($this->acl_is_writeable("gosaApplicationParameter",$this->no_release_acls)){
+      $edit=      "&nbsp;<input type='image' src='images/edit.png' title='"._("Edit entry")."' name='EdiApp_%s' value='%s' alt='{t}edit{/t}' >";
+    }else{
+      $edit=      "";
+    }
+
+    /* Get differences to mark those entries that have changed from last edit. */
+    $Differences = $this->diffAppsInReleases();
+
+    /* Walk through entries an append them to list */
+    if(isset($this->gosaMemberApplication[$this->curCatDir])){
+      foreach($this->gosaMemberApplication[$this->curCatDir] as $cat => $entry){
+
+        /* Add seperator */ 
+        if(preg_match("/__SEPARATOR__/",$entry['App'])){
+          $div2 ->AddEntry(array(array("string"=>$separator),
+                array("string"=>preg_replace("/\%s/",htmlentities($entry['App']),$upudown),"attach"=>"align='right' style='border-right:0px;'")));
+        }else{
+
+          /* Add application */
+
+          $image = "";
+          /* Check if application was available within selected release
+           *  or application list if release management is not active
+           */
+          if(!in_array($entry['App'],$this->AllAppsForRelease)){
+
+            /*  release managent is active
+             */
+            if(!$this->enableReleaseManagement){
+              $image = "<img class='center' alt='R' src='images/select_invalid_application.png' 
+                          title='"._("This application is no longer available.")."'>&nbsp;";
+            }else{
+              $image = "<img class='center' alt='F' src='images/select_invalid_application.png' 
+                          title=\"".sprintf(_("This application is not available in any release named %s."),$this->FAIrelease)."\">&nbsp;";
+            }
+      
+          }elseif(isset($Differences[$entry['App']]) && ($Differences[$entry['App']] == true)) {
+            $entry['App'].=" <i>["._("Check parameter")."]</i>";
+              $image = "<img class='center' src='images/select_invalid_application.png' 
+                          title='"._("This application has changed parameters.")."'>&nbsp;";
+          }else{
+            $image = "<img class='center' src='images/select_application.png' alt=\"\">&nbsp;"; 
+          }
+          
+          $div2->AddEntry(array(array("string"=>sprintf($image."%s",$entry['App'])),
+                array("string"=>preg_replace("/\%s/",htmlentities($entry['App']),$sep.$edit.$upudown),
+                      "attach"=>"align='right' style='width:100px;border-right:0px;'")));
+        }
+      }
+    }
+
+    /* Assign created div lists to template */
+    $smarty->assign("UsedApps", $div2->DrawList());
+    $smarty->assign("List", $div->DrawList());
+    $smarty->assign("apps", $apps);
+   
+    $smarty->assign("enableReleaseManagement",$this->enableReleaseManagement);
+
+    $smarty->assign("ReleaseSelectAble", false);
+    $smarty->assign("Release", $this->FAIrelease);
+    if($this->enableReleaseManagement){
+      $smarty->assign("FAIrelease",  $this->FAIrelease);
+      $smarty->assign("Releases", $this->Releases);
+
+      if(!$this->no_release_acls && count($this->Releases)){
+        $smarty->assign("ReleaseSelectAble", true);
+      }
+    }
+  
+    /* Set acls to  template */
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $acl => $translation){
+      $smarty->assign($acl."ACL",$this->getacl($acl,$this->no_release_acls));
+    }
+
+    /* Show main page */
+    if (is_object($this->dialog)){
+      $smarty->assign("table", $this->table);
+      $display.= $smarty->fetch (get_template_path('application_options.tpl', TRUE,dirname(__FILE__)));
+    } else {
+      $display.= $smarty->fetch (get_template_path('application.tpl', TRUE,dirname(__FILE__)));
+    }
+    
+    return ($display);
+  }
+
+
+  function getReleases()
+  {
+    /* Only display those releases that we are able to read */
+    $dn     = $this->config->current['BASE'];
+    $filter = "(&(objectClass=organizationalUnit)(objectClass=FAIbranch))";
+    $res    = get_list($filter,"application", $dn, array("ou"), GL_SUBSEARCH);
+
+    $ret =array();
+    foreach($res as $attrs){
+      if(preg_match("/ou=apps,/",$attrs['dn'])){
+        $bb     = preg_replace("/ou=apps,.*/","",$attrs['dn']);
+        $parts  = array_reverse(split("ou=",$bb));
+
+        $str ="";
+        foreach($parts as $part){
+          if(empty($part)) {
+            continue;
+          }
+          $str .= str_replace(",","",$part)."/";
+        }    
+        $name = preg_replace("/\/$/","",$str);
+        if(empty($name)) {
+          $name ="/";
+        }
+        $ret[$attrs['dn']] = $name;
+      }
+    }
+    return($ret);
+  }
+
+  function save_object()
+  {
+
+    /* Move category one position up or down */
+    if((isset($_GET['act']))&&(($_GET['act'] == "cat_up")||($_GET['act']=="cat_down"))){
+      if($_GET['act']=="cat_up"){
+        $this->catUp(base64_decode($_GET['id']));
+      }
+      if($_GET['act']=="cat_down"){
+        $this->catDown(base64_decode($_GET['id']));
+      }
+    }
+
+    /* Move application one position up or down */
+    if((isset($_GET['act']))&&(($_GET['act'] == "one_up")||($_GET['act']=="one_down"))){
+      if(isset($_GET['id'])){
+        $id   = $_GET['id'];
+        $act  = $_GET['act']; 
+
+        if($act == "one_up"){
+          $this->getOneUp($id);
+        }elseif($act == "one_down")   { 
+          $this->getOneDown($id);
+        }
+      }
+    }
+
+
+    plugin::save_object();
+  }
+
+  function remove_from_parent()
+  {
+    if(!$this->initially_was_account){
+      return;
+    }
+
+    plugin::remove_from_parent();
+
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd($this->dn);
+    $this->cleanup();
+    
+    $ldap->modify ($this->attrs); 
+    new log("remove","group/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    show_ldap_error($ldap->get_error(), sprintf(_("Removing of groups/applications with dn '%s' failed."),$this->dn));
+
+    /* Optionally execute a command after we're done */
+    $this->handle_post_events("remove");
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    /* Skip saving application settings, if we do not have release acls */
+    if($this->no_release_acls){
+      new log("security","groups/".get_class($this),$this->dn,array(),"Skip saving group application extension. Caused by insufficient acls");
+      
+      return;
+    }
+
+    plugin::save();
+
+
+
+    /* Copy members */
+    $this->Categories[""]=""; 
+    $this->attrs["gosaMemberApplication"]= array();
+    $this->attrs["gosaApplicationParameter"]= array();
+    $cat_id= 0 ;
+    foreach($this->Categories as $name => $cats){
+      $i =0;
+      if(isset($this->gosaMemberApplication[$name])){
+        foreach($this->gosaMemberApplication[$name] as $entry){
+          if(!preg_match("/__SEPARATOR__/",$entry['App'])){
+            $this->attrs["gosaMemberApplication"][]= $entry['App']."|".$name."|".$i;
+            $i ++;
+          }
+        }
+      }
+      if(($i==0)&&(!empty($name))){
+        $this->attrs["gosaMemberApplication"][]= "|".$name."|".$cat_id;
+      }
+      $cat_id++;
+    }
+
+
+
+    /* Are there application parameters to be saved */
+    $this->attrs['gosaApplicationParameter']= array();
+    foreach($this->appoption as $name => $value){
+      if ($value != ""){
+        $this->attrs['gosaApplicationParameter'][]= "$name:$value";
+      }
+    }
+
+    /* Write back to LDAP */
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd($this->dn);
+    $this->cleanup();
+    $ldap->modify ($this->attrs); 
+
+    if($this->initially_was_account){
+      new log("modify","group/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      new log("create","group/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); 
+    }   
+
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of groups/applications 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 check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    return ($message);
+  }
+
+
+  function reload()
+  {
+    /* Generate applist */
+    $this->apps= array();
+
+    /* Special handling for release managed apps */
+    $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
+    if(!empty($tmp) && count($this->Releases)){
+      $this->enableReleaseManagement = true;
+
+      /* Check if release is available */
+      $tmp = array_flip($this->Releases);
+      if(isset($tmp[$this->FAIrelease])){
+        $base =  $tmp[$this->FAIrelease];
+      }else{
+
+        /* Release is not available, check if there is an alternative */
+        $old_r =  $this->FAIrelease;
+        $k = key($tmp);
+
+        if(isset($tmp[$k])){
+      
+          /* We have found an alternative release name */
+          $r = $tmp[$k];
+          $this->FAIrelease = $k;
+          $base = $r; 
+
+          /* Display msg */
+          if(!(!$this->initially_was_account && $old_r =="/")){
+            print_red(sprintf(_("Can't resolve the release name '%s', setting release name to '%s'. Possibly the objects base has changed."),$old_r,$k));   
+          }
+        }else{
+          
+          /* There are no releases available ... */
+          print_red(_("There are no releases available. You will not be able to select another release."));
+          return;
+        }
+      }
+
+      /* Get applications for this release */
+      $base = preg_replace("/ou=apps,.*$/","ou=apps,".$this->curbase,$base);
+      $res = get_list("(objectClass=gosaApplication)","application",$base,array("*"));
+    }else{
+    
+      /* Get applications for this base */
+      $res = get_list("(objectClass=gosaApplication)","application","ou=apps,".$this->curbase,array("*"));
+    }
+    
+    /* Append applications */
+    foreach($res as $attrs){
+      if (isset($attrs["description"][0])){    
+        $this->apps[$attrs["cn"][0]]=
+          $attrs["cn"][0]." (".
+          $attrs["description"][0].")";
+      } else {
+        $this->apps[$attrs["cn"][0]]=
+          $attrs["cn"][0];
+      }
+    }
+
+    /* Get all apps ... */
+    $res = get_list("objectClass=gosaApplication","application",$this->config->current['BASE'],array("gosaApplicationParameter","cn"),GL_SUBSEARCH); 
+    $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
+    $this->AllAppsForRelease = array();
+    if(!empty($tmp)){
+      $tmp = array_flip($this->Releases);
+      foreach($res as $attrs){
+        
+        $testdn = preg_replace("/ou=apps,.*$/","ou=apps",$attrs['dn']);
+        $testdn = preg_replace("/^[^,]+/","",$testdn);
+        $testdn = preg_replace("/^,/","",$testdn);
+
+        if($testdn == preg_replace("/ou=apps,.*$/","ou=apps",$tmp[$this->FAIrelease])){
+          $this->AllAppsForRelease[$attrs['dn']] = $attrs['cn'][0];
+          $this->AllAppsForReleaseParameter[$this->FAIrelease][$attrs['cn'][0]] = $attrs;
+        }
+      }
+    }else{
+      foreach($res as $attrs){
+        $this->AllAppsForRelease[$attrs['dn']] = $attrs['cn'][0];
+      }
+    }
+
+    natcasesort ($this->apps);
+    reset ($this->apps);
+
+    if(is_array($this->gosaMemberApplication))
+      foreach ($this->gosaMemberApplication as $cat){   
+        if(is_array($cat))
+          foreach($cat as $entry){
+            $this->used_apps[$entry['App']]= $entry['App'];
+          }
+      }
+  }
+
+
+  function addApp($cn)
+  {
+    if((isset($this->gosaMemberApplication[$this->curCatDir]))&&(is_array($this->gosaMemberApplication[$this->curCatDir]))){
+      foreach($this->gosaMemberApplication[$this->curCatDir] as $entry){
+        if($entry['App'] == $cn) return;
+      }
+    }
+    $this->gosaMemberApplication[$this->curCatDir][]= array("App"=>$cn);
+    $this->used_apps[$cn]=$cn;
+    $this->is_modified= TRUE;
+  }
+
+
+  function removeApp($cn)
+  {
+    $temp= array();
+    foreach ($this->gosaMemberApplication as $value){
+      if ($value != $cn){
+        $temp[]= $value;
+      }
+    }
+    $this->gosaMemberApplication= $temp;
+    $this->is_modified= TRUE;
+  }
+
+  function getParameters($app)
+  {
+    $tmp = $this->getReleases();
+    $ret = array();
+    if(in_array($this->FAIrelease,$tmp)){
+      $tmp2 = array_flip($tmp);
+      $base = $tmp2[$this->FAIrelease];
+      $ldap = $this->config->get_ldap_link();
+      $ldap->cd($this->config->current['BASE']);
+      $ldap->search("(&(objectClass=gosaApplication)(cn=".$app.")(gosaApplicationParameter=*))",array("gosaApplicationParameter"));
+      if($ldap->count()){
+        $attrs = $ldap->fetch();
+        for($i = 0 ; $i < $attrs['gosaApplicationParameter']['count'] ; $i ++ ){
+          $name = preg_replace("/:.*$/","",$attrs['gosaApplicationParameter'][$i]);
+          $ret[$name] = $name;
+        } 
+      }
+    }
+    return($ret);
+  }
+
+  function GetSubdirs($dir)
+  {
+    $ret = array();
+    $tmp1 = split("/",$this->curCatDir);
+    foreach($this->Categories as $path=>$cat){
+      $tmp2 = split("/",$path);
+      
+      if((empty($this->curCatDir))&&(!preg_match("/\//",$path))){
+        $abort = false;
+      }elseif(((count($tmp1))+1) == (count($tmp2))){
+        $abort = false;
+        for($i = 0 ; $i < count($tmp1) ; $i++){
+          if($tmp1[$i] != $tmp2[$i]){
+            $abort = true;
+          }
+        }
+      }else{
+        $abort= true;
+      }
+      if(!$abort){
+        $ret[$path]=$cat;
+      } 
+    }
+    return($ret);
+  }
+
+
+  function PrepareForCopyPaste($source)
+  {
+    $s = new appgroup($this->config,$source['dn']);
+    $this->FAIrelease = $this->InitialFAIrelease = $s->FAIrelease;
+    $this->gosaMemberApplication = $s->gosaMemberApplication;
+    $this->appoption = $s->appoption;
+    $this->Categories = $s->Categories;
+  }
+
+
+  /* Return plugin informations for acl handling  */ 
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Applications"),
+          "plDescription" => _("Group applications"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 0,
+          "plSection"     => array("admin"),
+          "plCategory"    => array("groups"),
+          "plProvidedAcls"=> array(
+            "gosaMemberApplication"     => _("Application"),
+            "FAIrelease"                => _("Release"),
+            "gosaApplicationParameter"  => _("Application parameter"))
+          ));
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/groups/class_groupGeneric.inc b/gosa-core/plugins/admin/groups/class_groupGeneric.inc
new file mode 100644 (file)
index 0000000..095d3be
--- /dev/null
@@ -0,0 +1,978 @@
+<?php
+
+class group extends plugin
+{
+  /* CLI vars */
+  var $cli_summary= "Handling of GOsa's base group object";
+  var $cli_description= "Some longer text\nfor help";
+  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* Group attributes */
+  var $cn= "";
+  var $description= "";
+  var $gidNumber= "";
+  var $memberUid= array();
+
+  /* Helpers */
+  var $base= "";
+  var $force_gid= FALSE;
+  var $fon_group= FALSE;
+  var $smbgroup= FALSE;
+  var $groupType= FALSE;
+  var $samba3= FALSE;
+  var $sambaSID= "";
+  var $sambaDomainName= "DEFAULT";
+  var $SID= "";
+  var $ridBase= 0;
+  var $members= array();
+  var $users= array();
+  var $member= array();
+  var $allusers= array();
+  var $saved_gidNumber= "";
+  var $oldgroupType= "";
+  var $orig_dn= "";
+  var $orig_cn= "";
+  var $has_mailAccount= FALSE;
+  var $group_dialog= FALSE;
+  var $nagios_group =FALSE;
+  var $sambaGroupType;
+  var $dialog;
+  var $rfc2307bis= FALSE;
+  var $OnlyShowFirstEntries =200;
+  var $dnMapping= array();
+  var $view_logged = FALSE;
+  var $allowGroupsWithSameNameInOtherSubtrees = true;
+
+  /* attribute list for save action */
+  var $attributes= array("cn", "description", "gidNumber","memberUid","sambaGroupType","sambaSID");
+  var $objectclasses= array("top", "posixGroup");
+
+  var $CopyPasteVars  = array("force_gid","fon_group","smbgroup","groupType","sambaSID","sambaDomainName","SID","nagios_group","sambaGroupType");
+
+  function group (&$config, $dn= NULL)
+  {
+     /* Set rfc2307bis flag */
+     if (isset($config->current['RFC2307BIS']) && ($config->current['RFC2307BIS']== "true")){
+       $this->rfc2307bis= TRUE;
+       $this->attributes[]= "member";
+       $this->objectclasses[]= "groupOfNames";
+     }
+
+    plugin::plugin ($config, $dn);
+
+    /* Load attributes depending on the samba version */
+    $this->samba3= ($config->current['SAMBAVERSION'] == 3);
+    $this->orig_dn= $dn;
+    $this->orig_cn= $this->cn;
+
+    /* Get member list */
+    if (isset($this->attrs['memberUid'][0])){
+      $tmp= array();
+      for ($i= 0; $i<$this->attrs['memberUid']['count']; $i++){
+        $tmp[]= $this->attrs['memberUid'][$i];
+      }
+      $this->memberUid= $tmp;
+      sort ($this->memberUid);
+    }
+
+    /* Save gidNumber for later use */
+    if (isset($this->attrs['gidNumber'])){
+      $this->saved_gidNumber= $this->attrs['gidNumber'][0];
+    }
+
+    /* Is a samba group? */
+    if (isset($this->attrs['objectClass'])){
+      if (array_search ('sambaGroupMapping', $this->attrs['objectClass']) == FALSE ){
+        $this->smbgroup= FALSE;
+      } else {
+        $this->smbgroup= TRUE;
+        if (isset($this->attrs['sambaSID'])){
+          $this->sambaSID= $this->attrs['sambaSID'][0];
+        }
+      }
+      if (array_search ('goFonPickupGroup', $this->attrs['objectClass']) == FALSE ){
+        $this->fon_group= FALSE;
+      } else {
+        $this->fon_group= TRUE;
+      }
+      if (array_search ('nagiosContactGroup', $this->attrs['objectClass']) == FALSE ){
+        $this->nagios_group= FALSE;
+      } else {
+        $this->nagios_group= TRUE;
+      }
+    }
+
+    /* Set mail flag */
+    if (isset($this->attrs['objectClass']) && in_array('gosaMailAccount', $this->attrs['objectClass'])){
+      $this->has_mailAccount= TRUE;
+    }
+
+    /* Get samba Domain in case of samba 3 */
+    if ($this->samba3 && $this->sambaSID != ""){
+      $this->SID= preg_replace ("/-[^-]+$/", "", $this->sambaSID);
+      $ldap= $this->config->get_ldap_link();
+      $ldap->cd($this->config->current['BASE']);
+      $ldap->search ("(&(objectClass=sambaDomain)(sambaSID=$this->SID))",array("sambaAlgorithmicRidBase"));
+      if ($ldap->count() != 0){
+        $attrs= $ldap->fetch();
+        $this->ridBase= $attrs['sambaAlgorithmicRidBase'][0];
+
+        /* Get domain name for SID */
+        $this->sambaDomainName= "DEFAULT";
+        foreach ($this->config->data['SERVERS']['SAMBA'] as $key => $val){
+          if ($val['SID'] == $this->SID){
+            $this->sambaDomainName= $key;
+            break;
+          }
+        }
+      } else {
+        if (isset($this->config->current['RIDBASE'])){
+          $this->sambaDomainName= "DEFAULT";
+          $this->ridBase= $this->config->current['RIDBASE'];
+          $this->SID= $this->config->current['SID'];
+        } else {
+          print_red(_("Can't find this groups SID in LDAP or in your configuration file!"));
+        }
+      }
+
+      /* Get group type */
+      $this->groupType= (int)substr(strrchr($this->sambaSID, "-"), 1);
+      if ($this->groupType < 500 || $this->groupType > 553){
+        $this->groupType= 0;
+      }
+      $this->oldgroupType= $this->groupType;
+    }
+
+    /* Get global filter config */
+    if (!is_global("gufilter")){
+      $ui= get_userinfo();
+      $base= get_base_from_people($ui->dn);
+      $gufilter= array( "dselect"       => $base,
+          "regex"           => "*");
+      register_global("gufilter", $gufilter);
+    }
+    $gufilter= get_global('gufilter');
+
+    $gufilter['SubSearchGroup'] = false;
+    $gufilter['dselect'] = $_SESSION['gufilter']['dselect'];  
+
+    register_global('gufilter',$gufilter);
+  
+    if ($this->dn == "new"){
+      if(isset($_SESSION['CurrentMainBase'])){
+        $this->base= $_SESSION['CurrentMainBase'];
+      }else{
+        $ui= get_userinfo();
+        $this->base= dn2base($ui->dn);
+      }
+    } else {
+
+      /* Get object base */
+      $this->base =preg_replace ("/^[^,]+,".normalizePreg(get_groups_ou())."/","",$this->dn);
+    }
+
+    /* This is always an account */
+    $this->is_account= TRUE;
+    $this->reload();
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* Log view */
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","groups/".get_class($this),$this->dn);
+    }
+
+    /* Do we represent a valid group? */
+    if (!$this->is_account && $this->parent === NULL){
+      $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\">&nbsp;<b>".
+        _("This 'dn' is no group.")."</b>";
+      return ($display);
+    }
+
+    /* Delete user from group */
+    if (isset($_POST['del_users']) && isset($_POST['members'])){
+      foreach ($_POST['members'] as $value){
+        unset ($this->members["$value"]);
+        $this->removeUser($value);
+      }
+      $this->reload();
+    }
+
+    /* Add objects? */
+    if (isset($_POST["edit_membership"])){
+      $this->group_dialog= TRUE;
+      $this->dialog= TRUE;
+    }
+
+    /* Add objects finished? */
+    if (isset($_POST["add_users_finish"]) || isset($_POST["add_users_cancel"])){
+      $this->group_dialog= FALSE;
+      $this->dialog= FALSE;
+    }
+
+    /* Add user to group */
+    if (isset($_POST['add_users_finish']) && isset($_POST['users'])){
+      foreach ($_POST['users'] as $value){
+        $this->members["$value"]= $this->allusers[$value];
+        asort($this->members);
+        $this->addUser($value);
+      }
+      $this->reload();
+    }
+
+    /* Base select dialog */
+    $once = true;
+    foreach($_POST as $name => $value){
+      if((preg_match("/^chooseBase/",$name) && $once) && ($this->acl_is_moveable())){
+          
+        $once = false;
+        $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
+        $this->dialog->setCurrentBase($this->base);
+      }
+    }
+
+    /* Dialog handling */
+    if(is_object($this->dialog)){
+      /* Must be called before save_object */
+      $this->dialog->save_object();
+
+      if($this->dialog->isClosed()){
+        $this->dialog = false;
+      }elseif($this->dialog->isSelected()){
+
+        /* Check if selected base is valid */
+        $tmp = $this->get_allowed_bases();
+        if(isset($tmp[$this->dialog->isSelected()])){
+          $this->base = $this->dialog->isSelected();
+        }
+        $this->dialog= false;
+      }else{
+        return($this->dialog->execute());
+      }
+    }
+
+   /* Assign templating stuff */
+    $smarty= get_smarty();
+    if ($this->samba3){
+      $smarty->assign("samba3", "true");
+    } else {
+      $smarty->assign("samba3", "");
+    }
+
+    if($this->config->search("nagiosaccount", "CLASS",array('menu'))){
+      $smarty->assign("nagios",true);
+    }else{
+      $smarty->assign("nagios",false);
+    }
+    
+    if($this->config->search("phoneAccount", "CLASS",array('menu'))){
+      $smarty->assign("pickupGroup",true);
+    }else{
+      $smarty->assign("pickupGroup",false);
+    }
+
+    /* Manage object add dialog */
+    if ($this->group_dialog){
+
+      /* Save data */
+      $gufilter= get_global("gufilter");
+      foreach( array("dselect", "regex") as $type){
+        if (isset($_POST[$type])){
+          $gufilter[$type]= $_POST[$type];
+        }
+      }
+      if(isset($_POST['regex'])){
+        if(isset($_POST['SubSearchGroup'])){
+          $gufilter['SubSearchGroup'] = true;
+        }else{
+          $gufilter['SubSearchGroup'] = false;
+        }
+      }
+
+      if (isset($_GET['search'])){
+        $s= mb_substr($_GET['search'], 0, 1, "UTF8")."*";
+        if ($s == "**"){
+          $s= "*";
+        }
+        $gufilter['regex']= $s;
+      }
+      register_global("gufilter", $gufilter);
+      $this->reload();
+
+      /* Show dialog */
+      $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("deplist", $this->get_allowed_bases("users/user"));
+      $smarty->assign("alphabet", generate_alphabet());
+      foreach( array("dselect", "regex","SubSearchGroup") as $type){
+        $smarty->assign("$type", $gufilter[$type]);
+      }
+      $smarty->assign("hint", print_sizelimit_warning());
+      $smarty->assign("users", $this->displayUsers);
+      $smarty->assign("apply", apply_filter());
+      $display= $smarty->fetch (get_template_path('group_objects.tpl', TRUE, dirname(__FILE__)));
+      return ($display);
+    }
+
+    $smarty->assign("bases", $this->get_allowed_bases());
+    $smarty->assign("base_select", $this->base);
+
+    if ($this->samba3){
+      $domains= array();
+      foreach($this->config->data['SERVERS']['SAMBA'] as $name => $content){
+        $domains[$name]= $name;
+      }
+      $smarty->assign("sambaDomains", $domains);
+      $smarty->assign("sambaDomainName", $this->sambaDomainName);
+      $groupTypes= array(0 => _("Samba group"), 512 => _("Domain admins"), 513 => _("Domain users"),
+          514 => _("Domain guests"));
+
+      /* Don't loose special groups! If not key'ed above, add it to
+         the combo box... */   
+      if ($this->groupType >= 500 && $this->groupType <= 553 && !isset($groupTypes[$this->groupType])){
+        $groupTypes[$this->groupType]= sprintf(_("Special group (%d)"), $this->groupType);
+      }
+
+      $smarty->assign("groupTypes", $groupTypes);
+      $smarty->assign("groupType", $this->groupType);
+    }
+
+    /* Members and users */
+    $smarty->assign("members", $this->members);
+
+    /* Checkboxes */
+    foreach (array("force_gid", "smbgroup") as $val){
+      if ($this->$val == "1"){
+        $smarty->assign("$val", "checked");
+      } else {
+        $smarty->assign("$val", "");
+      }
+    }
+    if ($this->force_gid != "1"){
+      $smarty->assign("forceMode", "disabled");
+    }else{
+      $smarty->assign("forceMode", "");
+    }
+    if ($this->fon_group){
+      $smarty->assign("fon_group", "checked");
+    } else {
+      $smarty->assign("fon_group", "");
+    }
+
+    if ($this->nagios_group){
+      $smarty->assign("nagios_group", "checked");
+    } else {
+      $smarty->assign("nagios_group", "");
+    }
+
+    /* Fields */
+    foreach (array("cn", "description", "gidNumber") as $val){
+      $smarty->assign("$val", $this->$val);
+    }
+
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+    
+    if($this->acl_is_writeable("base")){
+      $smarty->assign("baseSelect",true);
+    }else{
+      $smarty->assign("baseSelect",false);
+    }
+
+    /* Show main page */
+    $smarty->assign("alphabet", generate_alphabet(10));
+    $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("deplist", $this->config->idepartments);
+    return($smarty->fetch (get_template_path('generic.tpl', TRUE)));
+  }
+
+  function addUser($uid)
+  {
+    $this->memberUid[]= $uid;
+    $this->memberUid= array_unique($this->memberUid);
+  }
+
+  function removeUser($uid)
+  {
+    $temp= array();
+    foreach ($this->memberUid as $value){
+      if ($value != $uid){
+        $temp[]= $value;
+      }
+    }
+    $this->memberUid= $temp;
+  }
+
+
+  /* Reload data */
+  function reload()
+  {
+    /* Fix regex string */
+    $gufilter = get_global("gufilter");
+    $regex    = normalizeLdap($gufilter['regex']);
+    $MaxUser  = $this->OnlyShowFirstEntries;
+
+    /* Prepare ldap link */
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd($gufilter['dselect']);
+
+
+    /* Resolve still unresolved memberuids to fill the list with sn/giveName attributes 
+        (Store gathered sn/givenName informations in $this->allusers too, 
+         to be prepared when adding/deleting users)
+     */    
+    $filter = "";
+    foreach ($this->memberUid as $value){
+      if(!isset($this->members[$value])){
+        $filter .= "(uid=".normalizeLdap($value).")";
+      }
+    }
+    if(!empty($filter)){    
+      $ldap->cd($this->config->current['BASE']);
+      $ldap->search("(&(objectClass=gosaAccount)(!(objectClass=gosaUserTemplate))(|".$filter."))",array("dn", "uid","sn","givenName"));
+      while($attrs = $ldap->fetch()){
+        $this->dnMapping[$attrs['uid'][0]] = $attrs['dn'];
+        $this->members[$attrs['uid'][0]] = $this->createResultName($attrs);
+        $this->allusers[$attrs['uid'][0]]= $this->createResultName($attrs);
+      } 
+    }
+  
+    /* check if all uids are resolved */
+    foreach ($this->memberUid as $value){
+      if(!isset($this->members[$value])){
+        $this->members[$value] =  _("! unknown id")." [".$value."]"; 
+      }
+    }  
+
+    /* Create display list of users matching regex & filter 
+     */
+    $this->displayUsers = array();
+    $filter = "(&(objectClass=gosaAccount)(!(objectClass=gosaUserTemplate))(!(uid=*$))(|(uid=".$regex.")(sn=".$regex.")(givenName=".$regex.")))";
+
+    /* Search in current tree or within subtrees depending on the checkbox from filter section */
+    if($gufilter['SubSearchGroup']){
+      $flag = GL_SIZELIMIT | GL_SUBSEARCH;
+      $base = $gufilter['dselect'];
+    }else{
+      $flag = GL_SIZELIMIT ;
+      $base = get_people_ou().$gufilter['dselect'];
+    }
+    $i = 0;
+  
+
+    $res = get_list($filter,"users",$base,array("dn", "uid", "sn", "givenName"),$flag);
+
+    /* Fetch all users and skip already used users */
+    foreach($res as $attrs){
+      if(in_array($attrs['uid'][0], $this->memberUid)) {
+        continue;
+      }
+      $i ++;
+      if($i > $MaxUser) {
+        break;
+      }
+      $this->dnMapping[$attrs['uid'][0]]= $attrs["dn"];
+      $this->allusers[$attrs['uid'][0]]     = $this->createResultName($attrs);
+      $this->displayUsers[$attrs['uid'][0]] = $this->createResultName($attrs);
+    }
+  
+    /* If more than max users are found, display a message to warn the user */
+    if(($i == $MaxUser)){
+      print_red(sprintf(_("Your search method returned more than '%s' users, only '%s' users are shown.") , $MaxUser,$MaxUser));
+    }
+    
+    /* Sort lists */
+    natcasesort($this->members);
+    reset($this->members);
+    natcasesort ($this->displayUsers);
+    reset ($this->displayUsers);
+  }
+
+
+  /* Create display name, this was used so often that it is excluded into a seperate function */
+  function createResultName($attrs)
+  {
+    if (isset($attrs["givenName"][0]) && isset($attrs["sn"][0])){
+      $ret =  $attrs["sn"][0].", ".$attrs["givenName"][0]." [".$attrs["uid"][0]."]";
+    } else {
+      $ret= $attrs['uid'][0];
+    }
+    return($ret);
+  }
+
+
+  function remove_from_parent()
+  {
+    plugin::remove_from_parent();
+
+    $ldap= $this->config->get_ldap_link();
+    $ldap->rmdir($this->dn);
+    show_ldap_error($ldap->get_error(), sprintf(_("Removing of groups/generic with dn '%s' failed."),$this->dn));
+
+    new log("remove","groups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+
+    /* Delete references to object groups */
+    $ldap->cd ($this->config->current['BASE']);
+    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
+    while ($ldap->fetch()){
+      $og= new ogroup($this->config, $ldap->getDN());
+      unset($og->member[$this->dn]);
+      $og->save ();
+    }
+
+    /* Remove ACL dependencies too,
+     */
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(&(objectClass=gosaAcl)(gosaAclEntry=*".base64_encode($this->dn)."*))",array("gosaAclEntry","dn"));
+    while($attrs = $ldap->fetch()){
+      $acl = new acl($this->config,$this->parent,$attrs['dn']);
+      foreach($acl->gosaAclEntry as $id => $entry){
+        foreach($entry['members'] as $m_id => $member){
+          if($m_id == "G:".$this->dn || $m_id == "U:".$this->dn){
+            unset($acl->gosaAclEntry[$id]['members'][$m_id]);
+            gosa_log("modify","groups/acl",$attrs['dn'],array(),sprintf("Removed acl for %s on object %s.",$this->dn,$attrs['dn']));
+          }
+        }
+      }
+      $acl -> save();
+    }
+
+    /* Remove ACL dependencies too,
+     */
+    $tmp = new acl($this->config,$this->parent,$this->dn);
+    $tmp->remove_acl();
+
+    /* Send signal to the world that we've done */
+    $this->handle_post_events("remove");
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    /* Save additional values for possible next step */
+    if (isset($_POST['groupedit'])){
+
+      /* Create a base backup and reset the 
+          base directly after calling plugin::save_object();  
+         Base will be set seperatly a few lines below */
+      $base_tmp = $this->base;
+      plugin::save_object();
+      $this->base = $base_tmp;
+
+      $this->force_gid= 0;
+
+      /* Only reset sambagroup flag if we are able to write this flag */
+      if($this->acl_is_writeable("sambaGroupType")){
+        $this->smbgroup = 0;
+      }
+
+      /* Get base selection */
+      if(isset($_POST['base'])){
+        $tmp = $this->get_allowed_bases();
+        if(isset($tmp[$_POST['base']])){
+          $this->base = $_POST['base'];
+        }
+      }
+
+      foreach (array(
+            "force_gid"  => "gidNumber", 
+            "smbgroup"   => "sambaGroupType") as $val => $aclname) {
+        if ($this->acl_is_writeable($aclname)  && isset($_POST["$val"])){
+          $this->$val= $_POST["$val"];
+        }
+      }
+
+      /* Save sambaDomain attribute */
+      if ($this->acl_is_writeable("sambaDomainName") && $this->samba3 && isset ($_POST['sambaDomainName'])){
+        $this->sambaDomainName= $_POST['sambaDomainName'];
+        $this->groupType= $_POST['groupType'];
+      }
+
+      /* Save fon attribute */
+      if ($this->acl_is_writeable("fon_group")){
+        if (isset ($_POST['fon_group'])){
+          $this->fon_group= TRUE;
+        } else {
+          $this->fon_group= FALSE;
+        }
+      }
+      if ($this->acl_is_writeable("nagios_group")){
+        if (isset ($_POST['nagios_group'])){
+          $this->nagios_group= TRUE;
+        } else {
+          $this->nagios_group= FALSE;
+        }
+      }
+    }
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+
+    /* ID handling */
+    if ($this->force_gid == 0){
+      if ($this->saved_gidNumber != ""){
+        $this->gidNumber= $this->saved_gidNumber;
+      } else {
+        /* Calculate new, lock uids */
+        $wait= 10;
+        while (get_lock("uidnumber") != ""){
+          sleep (1);
+
+          /* timed out? */
+          if ($wait-- == 0){
+            break;
+          }
+        }
+        add_lock ("uidnumber", "gosa");
+        $this->gidNumber= $this->get_next_id("gidNumber", $this->dn);
+      }
+    }
+  
+    plugin::save(); 
+
+    /* Remove objectClass for samba/phone support */
+    $tmp= array();
+    for ($i= 0; $i<count($this->attrs["objectClass"]); $i++){
+      if ($this->attrs['objectClass'][$i] != 'sambaGroupMapping' &&
+          $this->attrs['objectClass'][$i] != 'sambaIdmapEntry' &&
+          $this->attrs['objectClass'][$i] != 'goFonPickupGroup' &&
+        $this->attrs['objectClass'][$i] != 'nagiosContactGroup'){
+        $tmp[]= $this->attrs['objectClass'][$i];
+      }
+    }
+    $this->attrs['objectClass']= $tmp;
+    $ldap= $this->config->get_ldap_link();
+
+    /* Add samba group functionality */
+    if ($this->samba3 && $this->smbgroup){
+  
+      /* Fixed undefined index ... 
+       */ 
+      $this->SID = $this->ridBase = "";
+      if(isset($this->config->data['SERVERS']['SAMBA'][$this->sambaDomainName]['SID'])){
+        $this->SID    = $this->config->data['SERVERS']['SAMBA'][$this->sambaDomainName]['SID'];
+      }else{
+        print_red(sprintf(_("No configured SID found for '%s'."),$this->sambaDomainName));
+      }
+      if(isset($this->config->data['SERVERS']['SAMBA'][$this->sambaDomainName]['RIDBASE'])){
+        $this->ridBase= $this->config->data['SERVERS']['SAMBA'][$this->sambaDomainName]['RIDBASE']; 
+      }else{
+        print_red(sprintf(_("No configured RIDBASE found for '%s'."),$this->sambaDomainName));
+      }
+
+      $this->attrs['objectClass'][]= 'sambaGroupMapping';
+      $this->attrs['sambaGroupType']= "2";
+
+      /* Check if we need to create a special entry */
+      if ($this->groupType == 0){
+
+        if ($this->sambaSID == "" || $this->oldgroupType != $this->groupType){
+          $gidNumber= $this->gidNumber;
+          while(TRUE){
+            $sid= $this->SID."-".($gidNumber*2 + $this->ridBase+1);
+            $ldap->cd($this->config->current['BASE']);
+            $ldap->search("(sambaSID=$sid)",array("sambaSID"));
+            if ($ldap->count() == 0){
+              break;
+            }
+            $gidNumber++;
+          }
+          $this->attrs['sambaSID']= $sid;
+          $this->sambaSID= $sid;
+        }
+
+      } else {
+        $this->attrs['sambaSID']=$this->SID."-".$this->groupType;
+      }
+
+      /* User wants me to fake the idMappings? This is useful for
+         making winbind resolve the group names in a reasonable amount
+         of time in combination with larger databases. */
+      if (isset($this->config->current['SAMBAIDMAPPING']) &&
+          preg_match('/true/i', $this->config->current['SAMBAIDMAPPING'])){
+        $this->attrs['objectClass'][]= "sambaIdmapEntry";
+      }
+
+    }
+
+    /* Add phone functionality */
+    if ($this->fon_group){
+      $this->attrs['objectClass'][]= "goFonPickupGroup";
+    }
+
+    /* Add nagios functionality */
+    if ($this->nagios_group){
+      $this->attrs['objectClass'][]= "nagiosContactGroup";
+    }
+
+    /* Take members array */
+    if (count ($this->memberUid)){
+      $this->attrs['memberUid']= array_unique($this->memberUid);
+    }
+
+    /* New accounts need proper 'dn', propagate it to remaining objects */
+    if ($this->dn == 'new'){
+      $this->dn= 'cn='.$this->cn.','.get_groups_ou().$this->base;
+    }
+
+    /* Add member dn's for RFC2307bis Support */
+    if ($this->rfc2307bis){
+      if (count($this->memberUid)){
+        $this->attrs['member'] = array();
+        foreach($this->attrs['memberUid'] as $uid) {
+          $this->attrs['member'][]= $this->dnMapping[$uid];
+        }
+      } else {
+        $this->attrs['member'][]= $this->dn;
+      }
+    }
+
+    /* Save data. Using 'modify' implies that the entry is already present, use 'add' for
+       new entries. So do a check first... */
+    $ldap->cat ($this->dn, array('dn'));
+    if ($ldap->fetch()){
+      /* Modify needs array() to remove values :-( */
+      if (!count ($this->memberUid)){
+        $this->attrs['memberUid']= array();
+      }
+      if ($this->samba3){
+        if (!$this->smbgroup){
+          $this->attrs['sambaGroupType']= array();
+          $this->attrs['sambaSID']= array();
+        }
+      }
+      $mode= "modify";
+    } else {
+      $mode= "add";
+      $ldap->cd($this->config->current['BASE']);
+      $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
+    }
+
+    /* Write back to ldap */
+    $ldap->cd($this->dn);
+    $this->cleanup();
+    $ldap->$mode($this->attrs);
+
+    /* Remove ACL dependencies too,
+     */
+    if($this->dn != $this->orig_dn && $this->orig_dn != "new"){
+      $tmp = new acl($this->config,$this->parent,$this->dn);
+      $tmp->update_acl_membership($this->orig_dn,$this->dn);
+    }
+
+    if($this->initially_was_account){
+      new log("modify","groups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      new log("create","groups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
+
+    $ret= 0;
+    if ( show_ldap_error($ldap->get_error(), sprintf(_("Removing of groups/generic with dn '%s' failed."),$this->dn))){
+      $ret= 1;
+    }
+
+    /* Remove uid lock */
+    del_lock ("uidnumber");
+
+    /* Post that we've done*/
+    $this->handle_post_events($mode);
+
+    return ($ret);
+  }
+
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    /* Permissions for that base? */
+    if ($this->base != ""){
+      $new_dn= 'cn='.$this->cn.','.get_groups_ou().$this->base;
+    } else {
+      $new_dn= $this->dn;
+    }
+
+    /* must: cn */
+    if ($this->cn == "" && $this->acl_is_writeable("cn")){
+      $message[]= "The required field 'Name' is not set.";
+    }
+
+    /* Check for valid input */
+    if (!is_uid($this->cn)){
+      $message[]= _("The field 'Name' contains invalid characters. Lowercase, numbers and dashes are allowed.");
+    }
+
+    if($this->allowGroupsWithSameNameInOtherSubtrees == true){
+
+      /* Check for used 'cn' */
+      $ldap= $this->config->get_ldap_link();
+      if(($this->cn  != $this->orig_cn) || ($this->orig_dn == "new")){
+        $ldap->cd("ou=groups,".$this->base);
+        $ldap->ls("(&(|(objectClass=gosaGroupOfNames)(objectClass=posixGroup))(cn=$this->cn))",get_groups_ou().$this->base,array("cn"));
+        if ($ldap->count() != 0){
+          $message[]= _("Value specified as 'Name' is already used.");
+        }
+      }
+
+    }else{
+
+      /* Check for used 'cn' */
+      $ldap= $this->config->get_ldap_link();
+      $ldap->cd($this->config->current['BASE']);
+      $ldap->search("(&(|(objectClass=gosaGroupOfNames)(objectClass=posixGroup))(cn=$this->cn))",array("cn"));
+      if ($ldap->count() != 0){
+
+        /* New entry? */
+        if ($this->dn == 'new'){
+          $message[]= _("Value specified as 'Name' is already used.");
+        }
+
+        /* Moved? */
+        elseif ($new_dn != $this->orig_dn){
+          $ldap->fetch();
+          if ($ldap->getDN() != $this->orig_dn){
+            $message[]= _("Value specified as 'Name' is already used.");
+          }
+        }
+      }
+    }
+     
+    /* Check ID */
+    if ($this->force_gid == "1"){
+      if (!is_id($this->gidNumber)){
+        $message[]= _("Value specified as 'GID' is not valid.");
+      } else {
+        if ($this->gidNumber < $this->config->current['MINID']){
+          $message[]= _("Value specified as 'GID' is too small.");
+        }
+
+      }
+    }
+
+    return ($message);
+  }
+
+  function get_next_id($attrib, $dn)
+  {
+    $ids= array();
+    $ldap= $this->config->get_ldap_link();
+
+    $ldap->cd ($this->config->current['BASE']);
+    if (preg_match('/gidNumber/i', $attrib)){
+      $oc= "posixGroup";
+    } else {
+      $oc= "posixAccount";
+    }
+    $ldap->search ("(&(objectClass=$oc)($attrib=*))", array("$attrib"));
+
+    /* Get list of ids */
+    while ($attrs= $ldap->fetch()){
+      $ids[]= (int)$attrs["$attrib"][0];
+    }
+
+    /* Find out next free id near to UID_BASE */
+    if (!isset($this->config->current['BASE_HOOK'])){
+      $base= $this->config->current['UIDBASE'];
+    } else {
+      /* Call base hook */
+      $base= get_base_from_hook($dn, $attrib);
+    }
+    for ($id= $base; $id++; $id < pow(2,32)){
+      if (!in_array($id, $ids)){
+        return ($id);
+      }
+    }
+
+    /* Check if id reached maximum */
+    if ($id >= pow(2,32)){
+      print_red(_("Too many users, can't allocate a free ID!"));
+      exit;
+    }
+  }
+
+  function getCopyDialog()
+  {
+    $vars = array("cn");
+  
+    if($this ->force_gid){
+      $used = " checked ";
+      $dis  = "";
+    }else{
+      $used = "";
+      $dis  = " disabled ";
+    }
+
+    $smarty = get_smarty();
+    $smarty->assign("used",$used);
+    $smarty->assign("dis" ,$dis);
+    $smarty->assign("cn" ,$this->cn);
+    $smarty->assign("gidNumber",$this->gidNumber);
+    $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE));
+    $ret = array();
+    $ret['string'] = $str;
+    $ret['status'] = "";
+    return($ret);
+  }
+
+  function saveCopyDialog()
+  {
+    if(isset($_POST['cn'])){
+      $this->cn = $_POST['cn'];
+    }
+    if(isset($_POST['force_gid'])){
+      $this->force_gid  = 1;
+      $this->gidNumber= $_POST['gidNumber'];
+    }else{
+      $this->force_gid  = 0;
+      $this->gidNumber  = false;
+    }
+  }
+
+  
+  /* Return plugin informations for acl handling  */ 
+  static function plInfo()
+  {
+    return (array(  
+          "plShortName" => _("Generic"),
+          "plDescription" => _("Generic group settings"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 0,
+          "plSection"     => array("admin"),
+          "plCategory"    => array("groups" => array("objectClass" => "posixGroup", "description" => _("Groups"))),
+
+          "plProvidedAcls"    => array(
+            "cn"                => _("Name"),
+            "base"              => _("Base"),
+            "description"       => _("Description"),
+
+            "fonGroup"          => _("Phone pickup group"),
+            "nagiosGroup"       => _("Nagios group"),
+
+            "gidNumber"         => _("GID"),
+            "memberUid"         => _("Group member"),
+            "sambaGroupType"    => _("Samba group type"),
+            "sambaDomainName"   => _("Samba domain name"),
+            "sambaSID"          => _("Samba SID"))
+        ));
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/groups/class_groupMail.inc b/gosa-core/plugins/admin/groups/class_groupMail.inc
new file mode 100644 (file)
index 0000000..be6f7b3
--- /dev/null
@@ -0,0 +1,1162 @@
+<?php
+
+class mailgroup extends plugin
+{
+  /* CLI vars */
+  var $cli_summary        = "Manage mail groups/shared folders";
+  var $cli_description    = "Some longer text\nfor help";
+  var $cli_parameters     = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  var $uid                        = "";       // User id 
+  var $cn                         = "";       // cn
+  var $orig_cn                    = "";       // cn
+
+  var $method                     = "mailMethod"; // Used Mail method 
+  var $mmethod                    = "";           // Contains the gosa.conf MAILMETHOD
+  var $mail                       = "";           // Default mail address 
+
+  var $gosaMailAlternateAddress   = array();  // Set default Alternate Mail Adresses to empty array
+  var $gosaMailForwardingAddress  = array();  // Forwarding also empty
+
+  var $gosaMailServer             = "";       // Selected mailserver 
+  var $gosaMailQuota              = "";       // Defined Quota 
+  var $quotaUsage                 = 0;        // Currently used quota
+
+  var $gosaVacationMessage        = "";       // Vocation message 
+
+  var $imapacl                    = array('anyone'    => 'p',     // Set acls for everyone
+      '%members%' => 'lrswp',  // %members% are all group-members
+      ''          => 'p');    // Every user added gets this right
+
+  var $kolabFolderType_SubType = "";
+  var $kolabFolderType_Type = "";
+
+  var $gosaSpamSortLevel          = "";     
+  var $gosaSpamMailbox            = "";
+  var $gosaSharedFolderTarget     ;
+
+  var $forward_dialog             = FALSE;    
+
+  var $members                    = array();  // Group members
+
+  var $mailusers                  = array();
+  var $perms                      = array();
+  var $gosaMailDeliveryMode       = "[L        ]";   // 
+  var $gosaMailMaxSize            = "";       // 
+  
+  var $remove_folder_from_imap    = true;
+
+  /* Helper */
+  var $indexed_acl= array();
+  var $indexed_user= array();
+
+  var $view_logged = FALSE;
+
+  /* attribute list for save action */
+  var $attributes= array( "mail",   "gosaMailServer", "gosaMailQuota", "gosaMailMaxSize",
+      "gosaMailAlternateAddress", "gosaMailForwardingAddress",
+      "gosaMailDeliveryMode", "gosaSpamSortLevel", "gosaSpamMailbox",
+      "acl","gosaSharedFolderTarget", "gosaVacationMessage");
+
+  var $objectclasses= array("gosaMailAccount");
+  var $CopyPasteVars          = array("quotaUsage","imapacl");
+
+  function mailgroup (&$config, $dn= NULL, $ui= NULL)
+  {
+    /* Initialise all available attributes ... if possible
+     */
+    plugin::plugin($config, $dn);
+    $this->orig_cn = $this->cn;
+
+    /* Set mailMethod to the one defined in gosa.conf 
+     */
+    if (isset($this->config->current['MAILMETHOD'])){
+      $this->mmethod= $this->config->current['MAILMETHOD'];
+    }
+
+    /* Check if selected mail method exists 
+     */
+    $cls = get_correct_class_name("mailMethod$this->mmethod");
+    if ($cls && class_exists($cls)){
+      $this->method= $cls;
+    } else {
+      print_red(sprintf(_("There is no mail method '%s' specified in your gosa.conf available."), $this->mmethod));
+    }
+
+    /* Load Mailserver  
+     */
+    if(isset($this->attrs['gosaMailServer'][0])){
+      $this->gosaMailServer =  $this->attrs['gosaMailServer'][0];
+    }
+
+    /* Convert cn to uid in case of existing entry
+     */
+    if (isset($this->attrs['cn'][0])){
+      $this->uid= $this->attrs['cn'][0];
+    }
+
+    /* Get folder type */
+    if(isset($this->config->current['MAILMETHOD'])&&preg_match("/olab/i",$this->config->current['MAILMETHOD'])){
+      if(isset($this->attrs['kolabFolderType'])){
+        $tmp = split("\.",$this->attrs['kolabFolderType'][0]);
+        $this->kolabFolderType_Type = $tmp[0];
+        $this->kolabFolderType_SubType = $tmp[1];
+      }
+    }
+
+    /* If this ins't new mailgroup, read all required data from ldap
+     */
+    if (($dn != "new")&&($dn !== NULL)){
+
+      /* Load attributes which represent multiple entries  
+       */
+      foreach (array("gosaMailAlternateAddress", "gosaMailForwardingAddress") as $val){
+        $this->$val = array();
+        if (isset($this->attrs["$val"]["count"])){
+          for ($i= 0; $i<$this->attrs["$val"]["count"]; $i++){
+            array_push($this->$val, $this->attrs["$val"][$i]);
+          }
+        }
+      }
+
+      /* Only do IMAP actions if gosaMailServer attribute is set 
+       */
+      if (isset ($this->attrs["gosaMailServer"][0])){
+
+        /* Create new instance of our defined mailclass
+         */
+        $method= new $this->method($this->config);
+
+        if ($method->connect($this->attrs["gosaMailServer"][0])){
+        
+
+          /* Maybe the entry is not saved in new style, get
+             permissions from IMAP and convert them to acl attributes */
+          if (!isset($this->attrs['acl'])){
+            $this->imapacl=  $method->getSharedFolderPermissions($this->uid);
+
+            /* Need to filter what a member acl could be... */
+            $vote= array();
+            $peak= 0;
+            $leader= "";
+            foreach ($this->imapacl as $user => $acl){
+
+              if ($user != "anyone" ){
+                if (!isset($vote[$acl])){
+                  $vote[$acl]= 1;
+                } else {
+                  $vote[$acl]++;
+                }
+                if ($vote[$acl] > $peak){
+                  $leader= $acl;
+                  $peek= $vote[$acl];
+                }
+              }
+
+            }
+
+            /* Highest count wins as %members%, remove all members
+               with the same acl */
+            if(!empty($leader)){
+              $this->imapacl['%members%']= $leader;
+            }
+            foreach ($this->imapacl as $user => $acl){
+              if ($this->acl == $leader && in_array($user, $this->attrs['memberUid'])){
+                unset($this->imapacl[$user]);
+              }
+            }
+
+          } // ENDE ! isset ($this->attrs['acl'])
+          
+          /* Adapt attributes if needed */
+          $method->fixAttributesOnLoad($this);
+          
+          /*  get Quota */
+          $quota= $method->getQuota($this->uid);
+
+          /* Update quota values */
+          if(is_array($quota)){
+            if ($quota['gosaMailQuota'] == 2147483647){
+              $this->quotaUsage= "";
+              $this->gosaMailQuota= "";
+            } else {
+              $this->quotaUsage= $quota['quotaUsage'];
+              $this->gosaMailQuota= $quota['gosaMailQuota'];
+            }
+          }else{
+            $this->quotaUsage     = "";
+            $this->gosaMailQuota  = "";
+//            print_red(sprintf(_("Can't get quota information for '%s'."),$this->uid));
+          }
+          $method->disconnect();
+        }   // ENDE $method->connect($this->attrs["gosaMailServer"][0])){
+
+      }   // ENDE gosaMailServer
+
+    }   // ENDE dn != "new"
+
+
+    /* Get global filter config */
+    if (!is_global("gmailfilter")){
+      $ui= get_userinfo();
+      $base= get_base_from_people($ui->dn);
+      $gmailfilter= array( "depselect"       => $base,
+          "muser"            => "",
+          "regex"           => "*");
+      register_global("gmailfilter", $gmailfilter);
+    }
+
+    /* Load permissions */
+    $tmp = array();
+    if(preg_match("/olab/i",$this->mmethod)){
+      $ldap = $this->config->get_ldap_link();
+
+      if (isset($this->attrs['acl'])){
+
+        for ($i= 0; $i<$this->attrs['acl']['count']; $i++){
+          list($user, $permission)= split(' ', $this->attrs['acl'][$i]);
+
+          /* Add to list */
+          $this->imapacl[$user]= $permission;
+
+          /* Get all user permissions sorted by acl, to detect the most used acl
+             This acl is then used for %members%
+           */
+          if ($user != "anyone" && $user != "%members%"){
+            $tmp[$permission][] = $user;
+          }
+
+          /* There is an entry in $this->imapacl like this this ... 
+             $this->attrs['imapacl']['anyone'] = "p";
+             $this->attrs['imapacl']['%members%'] = "lprs";
+             $this->attrs['imapacl'][''] = ""; <------ This is used to diplay an empty 
+             Field for special acls in our template.
+             If there is at least one special acl in out imapacl,
+             we don't need this entry anymore, because it is already displayed. 
+           */
+          if ($user != "anyone" && $user != "%members%"){
+            unset($this->imapacl['']);
+          }
+        }
+      }
+
+      /* In this section we dectect which acl is tho most used 
+         This will be used as %members% acl  
+       */
+      $tmp2 = array(); 
+      foreach($tmp as $acl => $user){
+        $tmp2[count($tmp[$acl])]=$acl;
+      }
+      /* Most used at last 
+       */
+      ksort($tmp2);      
+  
+      /* Assign last (most used acl) to %members% acl 
+       */
+      $str = array_pop($tmp2);
+      if(!empty($str)) {
+        $this->imapacl['%members%']=$str;
+      }
+
+      /* Open ldap connection 
+       */
+      $ldap = $this->config->get_ldap_link();
+      $ldap->cd($this->config->current['BASE']);
+
+      /* Remove those users, that use %members% acl && are member of this group. */
+      foreach($this->imapacl as $mail => $permission){
+        $ldap->search("(&(objectClass=person)(mail=".$mail."))",array("uid"));
+        $atr = $ldap->fetch();
+        if((isset($this->attrs['memberUid'])) && (is_array($this->attrs['memberUid']))){
+          if((isset($atr['uid'][0]))&&(in_array($atr['uid'][0],$this->attrs['memberUid']))&&($permission == $this->imapacl['%members%'])){
+            unset($this->imapacl[$mail]);
+          }
+        }
+      }
+      /* Append an empty entry, for special acl handling */
+      if(count($this->imapacl)==2){
+        $this->imapacl[''] ="";
+      }
+  
+    }else{ // Not kolab 
+      /* Load permissions */ 
+      if (isset($this->attrs['acl'])){
+        for ($i= 0; $i<$this->attrs['acl']['count']; $i++){
+          list($user, $permission)= split(' ', $this->attrs['acl'][$i]);
+          $this->imapacl[$user]= $permission;
+          if ($user != "anyone" && $user != "%members%"){
+            unset($this->imapacl['']);
+          }
+        }
+      }
+    }
+
+    /* Load Mailserver  
+     */
+    if(isset($this->attrs['gosaMailServer'][0])){
+      $this->gosaMailServer =  $this->attrs['gosaMailServer'][0];
+    }
+    /* Fill translations */
+    $this->perms["lrsw"]= _("read");
+    $this->perms["lrspw"]= _("post");
+    $this->perms["p"]= _("external post");
+    $this->perms["lrsipw"]= _("append");
+    $this->perms["lrswipcd"]= _("write");
+    $this->perms["lrswipcda"]= _("admin");
+    $this->perms[""]= _("none");
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    //plugin::execute();
+
+    /* Log view */
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","groups/".get_class($this),$this->dn);
+    }
+
+    /* Load templating engine */
+    $smarty= get_smarty();
+
+    /* Assign acls */
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation) {
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+    if ($_SESSION['js']==FALSE){
+      $smarty->assign("javascript", "false");
+    } else {
+      $smarty->assign("javascript", "true");
+    }
+
+    /* 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;
+      }
+    }
+
+    $display = "";
+
+    /* Do we represent a valid account? */
+    if (!$this->is_account && $this->parent === NULL){
+
+      $display.= "<img alt=\"\" src=\"images/stop.png\" align=middle>&nbsp;<b>".
+        _("This 'dn' has no valid mail extensions.")."</b>";
+      return ($display);
+    }
+
+    /* Show tab dialog headers */
+    $display= "";
+    if ($this->parent !== NULL){
+      if ($this->is_account){
+        $display.= $this->show_disable_header(_("Remove mail account"),
+            _("This account has mail features enabled. You can disable them by clicking below."));
+      } else {
+        $display.= $this->show_enable_header(_("Create mail account"),
+            _("This account has mail features disabled. You can enable them by clicking below."));
+  
+        /* Show checkbox that allows us to remove imap entry too*/
+        if($this->initially_was_account){
+          $c = "";
+          if($this->remove_folder_from_imap){
+            $c= " checked ";
+          }
+          $display .= "<h2>Shared folder delete options</h2>
+                       <input class='center' type='checkbox' name='remove_folder_from_imap' value='1' ".$c."
+                        title='"._("Remove shared folder from mail server database when entry gets removed in LDAP")."'>";
+          $display .= _("Remove the shared folder and all its contents after saving this account");
+        }
+        return ($display);
+      }
+    }
+
+    /* Add ACL? */
+    if($this->acl_is_writeable("acl")){
+      foreach ($this->indexed_user as $nr => $user){
+        if (isset($_POST["add_$nr"])){
+          $this->imapacl[""]= "l";
+        }
+        if (isset($_POST["del_$nr"])){
+          unset ($this->imapacl[$user]);
+        }
+      }
+    }
+
+    /* Trigger forward add dialog? */
+    if($this->acl_is_writeable("gosaMailForwardingAddress")){
+      if (isset($_POST['add_local_forwarder'])){
+        $this->forward_dialog= TRUE;
+        $this->dialog= TRUE;
+      }
+    }
+
+    /* Cancel forward add dialog? */
+    if($this->acl_is_writeable("gosaMailForwardingAddress")){
+      if (isset($_POST['add_locals_cancel'])){
+        $this->forward_dialog= FALSE;
+        $this->dialog= FALSE;
+      }
+    }
+
+    /* Finished adding of locals? */
+    if ((isset($_POST['add_locals_finish'])) && ($this->acl_is_writeable("gosaMailForwardingAddress"))) {
+      if (count ($_POST['local_list']) && $this->acl_is_writeable("gosaMailForwardingAddress")){
+
+        /* Walk through list of forwarders, ignore own addresses */
+        foreach ($_POST['local_list'] as $val){
+          if (!in_array ($val, $this->gosaMailAlternateAddress) &&
+              $val != $this->mail){
+
+            $this->addForwarder($val);
+          }
+        }
+      }
+      $this->forward_dialog= FALSE;
+      $this->dialog= FALSE;
+    }
+
+    /* Add forward email addresses */
+    if ((isset($_POST['add_forwarder'])) && ($this->acl_is_writeable("gosaMailForwardingAddress"))){
+      if ($_POST['forward_address'] != ""){
+
+        /* Valid email address specified? */
+        $address= $_POST['forward_address'];
+        if (!is_email($address)){
+
+          print_red (_("You're trying to add an invalid email address ".
+                "to the list of forwarders."));
+
+        } elseif ($address == $this->mail
+            || in_array($address, $this->gosaMailAlternateAddress)) {
+
+          print_red (_("Adding your one of your own addresses to the forwarders makes no sense."));
+
+        } else {
+
+          /* Add it */
+          if ($this->acl_is_writeable("gosaMailForwardingAddress")){
+            $this->addForwarder ($address);
+          }
+
+        }
+      }
+    }
+
+    /* Delete forward email addresses */
+    if (isset($_POST['delete_forwarder']) && ($this->acl_is_writeable("gosaMailForwardingAddress"))){
+      if (count($_POST['forwarder_list'])&& $this->acl_is_writeable("gosaMailForwardingAddress")){
+
+        $this->delForwarder ($_POST['forwarder_list']);
+      }
+    }
+
+    /* Add alternate email addresses */
+    if (isset($_POST['add_alternate'])){
+      if ($_POST['alternate_address'] != "" && $this->acl_is_writeable("gosaMailAlternateAddress")){
+
+        if (!is_email($_POST['alternate_address'])){
+          print_red (_("You're trying to add an invalid email address to the list of alternate addresses."));
+
+        } elseif (($user= $this->addAlternate ($_POST['alternate_address'])) != ""){
+          $ui= get_userinfo();
+          if ($user != $ui->username){
+            print_red (_("The address you're trying to add is already used by user")." '$user'.");
+          }
+        }
+      }
+    }
+
+    /* Delete alternate email addresses */
+    if($this->acl_is_writeable("gosaMailAlternateAddress")){
+      if (isset($_POST['delete_alternate']) && isset ($_POST['alternates_list'])){
+        if (count($_POST['alternates_list']) && $this->acl_is_writeable("gosaMailAlternateAddress")){
+          $this->delAlternate ($_POST['alternates_list']);
+        }
+      }
+    }
+
+    /* Show forward add dialog */
+    if ($this->forward_dialog){
+      $ldap= $this->config->get_ldap_link();
+
+      /* Save data */
+      $gmailfilter= get_global("gmailfilter");
+      foreach( array("depselect", "muser", "regex") as $type){
+        if (isset($_POST[$type])){
+          $gmailfilter[$type]= $_POST[$type];
+        }
+      }
+      if (isset($_GET['search'])){
+        $s= mb_substr($_GET['search'], 0, 1, "UTF8")."*";
+        if ($s == "**"){
+          $s= "*";
+        }
+        $gmailfilter['regex']= $s;
+      }
+      register_global("gmailfilter", $gmailfilter);
+
+      /* Get actual list */
+      $mailusers= array ();
+      if ($gmailfilter['regex'] != '*' && $gmailfilter['regex'] != ""){
+        $regex= $gmailfilter['regex'];
+        $filter= "(|(mail=$regex)(gosaMailAlternateAddress=$regex))";
+      } else {
+        $filter= "";
+      }
+      if ($gmailfilter['muser'] != ""){
+        $user= $gmailfilter['muser'];
+        $filter= "$filter(|(uid=$user)(cn=$user)(givenName=$user)(sn=$user))";
+      }
+
+      /* Add already present people to the filter */
+      $exclude= "";
+      foreach ($this->gosaMailForwardingAddress as $mail){
+        $exclude.= "(mail=$mail)";
+      }
+      if ($exclude != ""){
+        $filter.= "(!(|$exclude))";
+      }
+
+      $res= get_list("(&(objectClass=gosaMailAccount)$filter)", "users", $gmailfilter['depselect'],
+                     array("sn", "mail", "givenName"), GL_SUBSEARCH | GL_SIZELIMIT);
+      $ldap->cd($gmailfilter['depselect']);
+      $ldap->search ("(&(objectClass=gosaMailAccount)$filter)", array("sn", "mail", "givenName"));
+      error_reporting (0);
+      while ($attrs= $ldap->fetch()){
+        if(preg_match('/%/', $attrs['mail'][0])){
+          continue;
+        }
+        $name= $this->make_name($attrs);
+        $mailusers[$attrs['mail'][0]]= $name."&lt;".
+          $attrs['mail'][0]."&gt;";
+      }
+      error_reporting (E_ALL | E_STRICT);
+      natcasesort ($mailusers);
+      reset ($mailusers);
+
+      /* Show dialog */
+      $smarty->assign("search_image", get_template_path('images/search.png'));
+      $smarty->assign("usearch_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.png'));
+      $smarty->assign("launchimage", get_template_path('images/small_filter.png'));
+      $smarty->assign("mailusers", $mailusers);
+      $smarty->assign("deplist", $this->config->idepartments);
+      $smarty->assign("apply", apply_filter());
+      $smarty->assign("alphabet", generate_alphabet());
+      $smarty->assign("hint", print_sizelimit_warning());
+      foreach( array("depselect", "muser", "regex") as $type){
+        $smarty->assign("$type", $gmailfilter[$type]);
+      }
+      $smarty->assign("hint", print_sizelimit_warning());
+      $display.= $smarty->fetch (get_template_path('mail_locals.tpl', TRUE));
+      return ($display);
+    }
+
+    /* Assemble normal permissions */
+    if (isset($this->imapacl['anyone'])){
+      $smarty->assign("default_permissions", $this->imapacl['anyone']);
+    }
+    $smarty->assign("member_permissions", "lrsp");
+    if (isset($this->imapacl['%members%'])){
+      $smarty->assign("member_permissions", $this->imapacl['%members%']);
+    }
+
+    /* Assemble extra attributes */
+    $perm= $this->getacl( "permissions");
+    $tmp= "";
+    $nr= 0;
+    $count= count($this->imapacl);
+    $this->indexed_user= array();
+    $this->indexed_acl= array();
+    foreach($this->imapacl as $user => $acl){
+
+      /* Add additional acl settings */
+      if ($user != "anyone" && $user != "%members%"){
+
+        $Dis  = "";
+        if(!preg_match("/w/",$perm)){
+          $Dis = " disabled ";
+        }
+  
+        /* Reset given Acls to ensure that nobody can read username and acls if not allwoed */
+        if(!preg_match("/r/",$perm)){
+          $user = "";
+          $nr   = "none";
+          $key  = "none";  
+        }
+
+        $tmp.= "<tr>  
+                 <td>
+                  <input name=\"user_$nr\" size=20 maxlength=60 value=\"$user\" ".$Dis.">
+                 </td>
+                 <td>
+                 <select size=\"1\" name=\"perm_$nr\" ".$Dis.">";
+
+        /* Add acl options for this additional acl setting */
+        if(preg_match("/r/",$perm)){
+          foreach ($this->perms as $key => $value){
+            if ($acl == $key){
+              $tmp.= "<option value=\"$key\" selected>$value</option>";
+            } else {
+              $tmp.= "<option value=\"$key\">$value</option>";
+            }
+          }
+        }
+        $tmp.= "</select>&nbsp;";
+
+
+        
+        if ($nr == $count - 1){
+          if($this->acl_is_writeable("acl")){
+            $tmp.= "<input type=submit value=\""._("Add")."\" ".
+              "name=\"add_$nr\" >";
+          }
+        }
+        if ($count > 3){
+          if($this->acl_is_writeable("acl")){
+            $tmp.= "<input type=submit value=\""._("Remove")."\" ".
+              "name=\"del_$nr\" ></td></tr>";        
+          }
+        }
+      }
+      $this->indexed_user[$nr]= $user;
+      $this->indexed_acl[$nr++]= $acl;
+    }
+    $smarty->assign("plusattributes", $tmp);
+
+    /* Show main page */
+    $mailserver= array();
+    foreach ($this->config->data['SERVERS']['IMAP'] as $key => $val){
+      $mailserver[]= $key;
+    }
+    $smarty->assign("mailServers", $mailserver);
+    foreach(array("gosaMailServer", "gosaMailQuota", "perms", "mail",
+          "gosaMailAlternateAddress", "gosaMailForwardingAddress") as $val){
+      $smarty->assign("$val", $this->$val);
+    }
+    if (is_numeric($this->gosaMailQuota) && $this->gosaMailQuota != 0){
+      if($this->acl_is_readable("gosaMailQuota")){
+        $smarty->assign("quotausage", progressbar(round(($this->quotaUsage * 100)/ $this->gosaMailQuota),100,15,true));
+        $smarty->assign("quotadefined", "true");
+      }else{
+        $smarty->assign("quotadefined", "true");
+        $smarty->assign("quotausage", "-");
+      }
+    } else {
+      $smarty->assign("quotadefined", "false");
+    }
+
+    if(isset($this->config->current['MAILMETHOD'])&&preg_match("/olab/i",$this->config->current['MAILMETHOD'])){
+
+      $smarty->assign("kolab", TRUE);
+      $smarty->assign("JS",$_SESSION['js']);
+      $smarty->assign("kolabFolderType_Types",    array (   ''      => _('Unspecified'),  'mail' => _('Mails'),
+                                                            'task'  => _('Tasks') ,       'journal' => _('Journals'),
+                                                            'calendar' => _('Calendar'),       'contact' => _('Contacts'), 
+                                                            'note'  => _('Notes')));
+      if($this->kolabFolderType_Type == "mail"){
+        $smarty->assign("kolabFolderType_SubTypes", array(    
+              ''          => _('Unspecified'),  'inbox'     => _("Inbox")   , 
+              'drafts'    => _("Drafts"),       'sentitems' => _("Sent items"),
+              'junkemail' => _("Junk mail")));
+      }else{
+        $smarty->assign("kolabFolderType_SubTypes", array(  'default' => _("Default")));
+      }
+      $smarty->assign("kolabFolderType_Type",     $this->kolabFolderType_Type);
+      $smarty->assign("kolabFolderType_SubType",  $this->kolabFolderType_SubType);
+    }else{
+      $smarty->assign("kolab", FALSE);
+    }
+
+
+    $display.= $smarty->fetch (get_template_path('mail.tpl', TRUE));
+    return ($display);
+  }
+
+
+  /* remove object from parent */
+  function remove_from_parent()
+  {
+    if(!$this->initially_was_account){
+      return;
+    }
+  
+    /* Added these ObjectClass and Attributes, because they were not 
+       removed correctly, only in case of kolab ... 
+     */
+    if(isset($this->config->current['MAILMETHOD'])&&preg_match("/olab/i",$this->config->current['MAILMETHOD'])){
+      $this->attributes[]="acl";
+      $this->objectclasses[] = "kolabSharedFolder";
+    }
+    /* include global link_info */
+    $ldap= $this->config->get_ldap_link();
+
+    /* Remove and write to LDAP */
+    plugin::remove_from_parent();
+
+    /* Zero arrays */
+    $this->attrs['gosaMailAlternateAddress']= array();
+    $this->attrs['gosaMailForwardingAddress']= array();
+    $this->attrs['gosaSharedFolderTarget']= array();
+
+    /* Connect to IMAP server for account deletion */
+    if ($this->initially_was_account){
+      $method= new $this->method($this->config);
+      $method->fixAttributesOnRemove($this);
+      if ($method->connect($this->gosaMailServer) && $this->remove_folder_from_imap){
+
+        /* Remove account from IMAP server */
+        $method->deleteMailbox($this->uid);
+        $method->disconnect();
+      }
+    }
+    /* Keep uid */
+    unset ($this->attrs['uid']);
+
+    $ldap->cd($this->dn);
+    $ldap->modify ($this->attrs); 
+    show_ldap_error($ldap->get_error(), sprintf(_("Removing of groups/mail with dn '%s' failed."),$this->dn));
+
+
+    new log("remove","groups/".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");
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+
+    /* Add special kolab attributes */    
+    if(isset($this->config->current['MAILMETHOD'])&&preg_match("/olab/i",$this->config->current['MAILMETHOD'])){
+      if(isset($_POST['kolabFolderType_Type'])){
+        $this->kolabFolderType_Type = get_post("kolabFolderType_Type");
+        $this->kolabFolderType_SubType = get_post("kolabFolderType_SubType");
+      }
+    }
+  
+    /* Check if user wants to remove the shared folder from imap too */
+    if($this->initially_was_account && !$this->is_account){
+      if(isset($_POST['remove_folder_from_imap'])){
+        $this->remove_folder_from_imap = true;
+      }else{
+        $this->remove_folder_from_imap = false;
+      }
+    }
+
+    /* Assemble mail delivery mode
+       The mode field in ldap consists of values between braces, this must
+       be called when 'mail' is set, because checkboxes may not be set when
+       we're in some other dialog.
+
+       Example for gosaMailDeliveryMode [LR        ]
+L: Local delivery
+R: Reject when exceeding mailsize limit
+S: Use spam filter
+V: Use vacation message
+C: Use custom sieve script
+I: Only insider delivery */
+    if (isset($_POST['mailedit'])){
+
+      plugin::save_object();
+
+      $tmp= preg_replace("/[^a-z]/i","",$this->gosaMailDeliveryMode);
+
+      /* Handle delivery flags */
+      if($this->acl_is_writeable("gosaMailDeliveryModeL")){
+        if(!preg_match("/L/",$tmp) && !isset($_POST['drop_own_mails'])){
+          $tmp.="L";
+        }elseif(preg_match("/L/",$tmp) && isset($_POST['drop_own_mails'])){
+          $tmp = preg_replace("/L/","",$tmp);
+        }
+      }
+
+      $opts = array(
+          "R"   => "use_mailsize_limit",
+          "S"   => "use_spam_filter",
+          "V"   => "use_vacation",
+          "C"   => "own_script",
+          "I"   => "only_local");
+
+      foreach($opts as $flag => $post){
+        if($this->acl_is_writeable("gosaMailDeliveryMode".$flag)){
+          if(!preg_match("/".$flag."/",$tmp) && isset($_POST[$post])){
+            $tmp.= $flag;
+          }elseif(preg_match("/".$flag."/",$tmp) && !isset($_POST[$post])){
+            $tmp = preg_replace("/".$flag."/","",$tmp);
+          }
+        }
+      }
+
+      $tmp= "[$tmp]";
+      if ($this->gosaMailDeliveryMode != $tmp){
+        $this->is_modified= TRUE;
+      }
+      $this->gosaMailDeliveryMode= $tmp;
+
+      /* Collect data and re-assign it to the imapacl array */
+      if ($this->acl_is_writeable("acl")){
+        $this->imapacl= array();
+        $this->imapacl['%members%']= $_POST['member_permissions'];
+        $this->imapacl['anyone']= $_POST['default_permissions'];
+        foreach ($this->indexed_user as $nr => $user){
+          if (!isset($_POST["user_$nr"])){
+            continue;
+          }
+          if ($_POST["user_$nr"] != $user ||
+              $_POST["perm_$nr"] != $this->indexed_acl[$nr]){
+            $this->is_modified= TRUE;
+          }
+          $this->imapacl[$_POST["user_$nr"]]= $_POST["perm_$nr"];
+        }
+      }
+    }
+
+  }
+
+
+
+  /* Save data to LDAP, depending on is_account we save or delete */
+  function save()
+  {
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+
+    /* Call parents save to prepare $this->attrs */
+    plugin::save();
+
+    /* Save arrays */
+    $this->attrs['gosaMailAlternateAddress']  = $this->gosaMailAlternateAddress;
+    $this->attrs['gosaMailForwardingAddress'] = $this->gosaMailForwardingAddress;
+    $this->attrs['gosaSharedFolderTarget']    = "share+".$this->uid;
+
+    /* Only do IMAP actions if we are not a template */
+    if(preg_match("/olab/i",$this->mmethod)){
+      if (empty($this->gosaMailServer)||is_array($this->gosaMailServer)){
+        if(isset($this->attrs['gosaMailServer'][0])){
+          $this->gosaMailServer = $this->attrs['gosaMailServer'][0];
+        }
+      }
+    }  
+
+    /* Exchange '%member%' pseudo entry */
+    $memberacl= $this->imapacl['%members%'];
+
+    foreach ($this->members as $user){
+      if (!isset($this->imapacl[$user])){
+        $this->imapacl[$user]= $memberacl;
+      }
+    }
+    if(preg_match("/olab/i",$this->mmethod)){
+
+      /* Save acl's */
+      $this->attrs['acl']= array();
+      foreach ($this->imapacl as $user => $acl){
+        if ($user == "" || preg_match("/%members%/",$user)){
+          continue;
+        }
+        $ldap->search("(&(objectClass=person)(|(uid=".$user.")(mail=".$user.")))",array("mail"));
+        $mail = $ldap->fetch();
+        if(isset($mail['mail'][0])){
+          $sacl = $mail['mail'][0]." ".$acl;
+        }else{
+          $sacl= "$user $acl";
+        }
+        if(!in_array($sacl,$this->attrs['acl'])){
+          $this->attrs['acl'][]= $sacl;
+        }
+      }
+   
+      if(!empty($this->kolabFolderType_Type)){ 
+        $this->attrs['kolabFolderType'] = $this->kolabFolderType_Type.".".$this->kolabFolderType_SubType;
+      }else{
+        $this->attrs['kolabFolderType'] = array();
+      }
+    }else{
+
+      /* Save acl's */
+      $this->attrs['acl']= array();
+      foreach ($this->imapacl as $user => $acl){
+        if ($user == "" || preg_match("/%members%/",$user)){
+          continue;
+        }
+        $this->attrs['acl'][]= "$user $acl";
+      }
+    }
+
+    if ((!$this->is_template)&&(!empty($this->gosaMailServer))){
+      $method= new $this->method($this->config);
+      $method->fixAttributesOnStore($this);
+      if (($method->connect($this->gosaMailServer))){
+        $method->updateMailbox($this->uid);
+        $method->setQuota($this->uid, $this->gosaMailQuota);
+        $method->setSharedFolderPermissions($this->uid, $this->imapacl);
+        $method->disconnect();
+      }
+    }
+
+    /* Save data to LDAP */
+    $ldap->cd($this->dn);
+    $this->cleanup();
+    $ldap->modify ($this->attrs); 
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of groups/mail with dn '%s' failed."),$this->dn));
+    
+    if($this->initially_was_account){
+      new log("modify","groups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      new log("create","groups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());  
+    }
+    
+
+    /* 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");
+    }
+  }
+
+  /* Check formular input */
+  function check()
+  {
+    $ldap= $this->config->get_ldap_link();
+
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    if(!$this->is_account) return array();
+    
+    //$message[] = $str;      
+
+    /* must: mail */
+    if ($this->mail == ""){
+      $message[]= _("The required field 'Primary address' is not set.");
+    }
+    if (!is_email($this->mail)){
+      $message[]= _("Please enter a valid email addres in 'Primary address' field.");
+    }
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search ("(&(!(objectClass=gosaUserTemplate))(objectClass=gosaMailAccount)(|(mail=".$this->mail.")(gosaMailAlternateAddress=".
+        $this->mail."))(!(uid=".$this->orig_cn."))(!(cn=".$this->orig_cn.")))");
+    if ($ldap->count() != 0){
+      $message[]= _("The primary address you've entered is already in use.");
+    }
+  
+    /* Check quota */
+    if ($this->gosaMailQuota != '' && $this->acl_is_writeable("gosaMailQuota")){
+      if (!is_numeric($this->gosaMailQuota)) {
+        $message[]= _("Value in 'Quota size' is not valid.");
+      } else {
+        $this->gosaMailQuota= (int) $this->gosaMailQuota;
+      }
+    }
+
+    /* Check rejectsize for integer */
+    if ($this->gosaMailMaxSize != '' && $this->acl_is_writeable("gosaMailQuota")){
+      if (!is_numeric($this->gosaMailMaxSize)){
+        $message[]= _("Please specify a vaild mail size for mails to be rejected.");
+      } else {
+        $this->gosaMailMaxSize= (int) $this->gosaMailMaxSize;
+      }
+    }
+
+    /* Need gosaMailMaxSize if use_mailsize_limit is checked */
+    if (is_integer(strpos($this->gosaMailDeliveryMode, "reject")) && $this->gosaMailMaxSize == ""){
+      $message[]= _("You need to set the maximum mail size in order to reject anything.");
+    }
+
+    if(ord($this->imapacl['anyone'][0])==194){
+      $message[] = _("Please choose valid permission settings. Default permission can't be emtpy.");
+    }
+
+    if(empty($this->gosaMailServer)){
+      $message[] = _("Please select a valid mail server.");
+    }
+
+    return ($message);
+  }
+
+  /* Adapt from template, using 'dn' */
+  function adapt_from_template($dn)
+  {
+    plugin::adapt_from_template($dn);
+
+    foreach (array("gosaMailAlternateAddress", "gosaMailForwardingAddress") as $val){
+      $this->$val= array();
+      if (isset($this->attrs["$val"]["count"])){
+        for ($i= 0; $i<$this->attrs["$val"]["count"]; $i++){
+          $value= $this->attrs["$val"][$i];
+          foreach (array("sn", "givenName", "uid") as $repl){
+            if (preg_match("/%$repl/i", $value)){
+              $value= preg_replace ("/%$repl/i", $this->parent->$repl, $value);
+            }
+          }
+          array_push($this->$val, $value);
+        }
+      }
+    }
+  }
+
+  /* Add entry to forwarder list */
+  function addForwarder($address)
+  {
+    $this->gosaMailForwardingAddress[]= $address;
+    $this->gosaMailForwardingAddress= array_unique ($this->gosaMailForwardingAddress);
+
+    sort ($this->gosaMailForwardingAddress);
+    reset ($this->gosaMailForwardingAddress);
+    $this->is_modified= TRUE;
+  }
+
+  /* Remove list of addresses from forwarder list */
+  function delForwarder($addresses)
+  {
+    $this->gosaMailForwardingAddress= array_remove_entries ($addresses,
+        $this->gosaMailForwardingAddress);
+    $this->is_modified= TRUE;
+  }
+
+
+
+  function addAlternate($address)
+  {
+    $ldap= $this->config->get_ldap_link();
+
+    $address= strtolower($address);
+
+    /* Is this address already assigned in LDAP? */
+    $ldap->cd ($this->config->current['BASE']);
+    $ldap->search ("(&(objectClass=gosaMailAccount)(|(mail=$address)".
+        "(gosaMailAlternateAddress=$address)))");
+
+    if ($ldap->count() > 0){
+      $attrs= $ldap->fetch ();
+      return ($attrs["uid"][0]);
+    }
+
+    /* Add to list of alternates */
+    if (!in_array($address, $this->gosaMailAlternateAddress)){
+      $this->gosaMailAlternateAddress[]= $address;
+    }
+
+    sort ($this->gosaMailAlternateAddress);
+    reset ($this->gosaMailAlternateAddress);
+    $this->is_modified= TRUE;
+
+    return ("");
+  }
+
+
+  function delAlternate($addresses)
+  {
+    $this->gosaMailAlternateAddress= array_remove_entries ($addresses,
+        $this->gosaMailAlternateAddress);
+    $this->is_modified= TRUE;
+  }
+
+
+  function make_name($attrs)
+  {
+    $name= "";
+    if (isset($attrs['sn'][0])){
+      $name= $attrs['sn'][0];
+    }
+    if (isset($attrs['givenName'][0])){
+      if ($name != ""){
+        $name.= ", ".$attrs['givenName'][0];
+      } else {
+        $name.= $attrs['givenName'][0];
+      }
+    }
+    if ($name != ""){
+      $name.= " ";
+    }
+
+    return ($name);
+  }
+
+  function getCopyDialog()
+  {
+    if(!$this->is_account) return("");
+
+    $smarty = get_smarty();
+    $smarty->assign("gosaMailAlternateAddress",$this->gosaMailAlternateAddress);
+    $smarty->assign("gosaMailForwardingAddress",$this->gosaMailForwardingAddress);
+    $smarty->assign("mail",$this->mail);
+    $display= $smarty->fetch (get_template_path('paste_mail.tpl', TRUE));
+    $ret = array();
+    $ret['string'] = $display;
+    $ret['status'] = "";
+    return($ret);
+  }
+
+  function saveCopyDialog()
+  {
+    if(!$this->is_account) return;
+
+    /* Perform ADD / REMOVE ... for mail alternate / mail forwarding addresses 
+    */
+    $this->execute();
+    if(isset($_POST['mail'])){
+      $this->mail = $_POST['mail'];
+    }
+  }
+
+
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);
+    /* Reset alternate mail addresses */
+    $this->gosaMailAlternateAddress = array();
+  }
+
+
+  /* Return plugin informations for acl handling  */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Mail"),
+          "plDescription" => _("Group mail"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 0,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("groups"), 
+          "plProvidedAcls"=> array(
+            "mail"                      => _("Mail address"),
+            "gosaMailAlternateAddress"  => _("Alternate addresses"),
+            "gosaMailForwardingAddress" => _("Forwarding addresses"),
+            "gosaMailQuota"             => _("Quota size"),
+            "gosaMailServer"            => _("Mail server"),
+            "acl"                       => _("Permissions"))
+          ));
+  }
+
+  
+  /* Remove given ACL for given member (uid,mail) ..
+   */
+  function removeUserAcl($index )
+  {
+    if(isset($this->imapacl[$index])){
+      unset($this->imapacl[$index]);
+    }
+  }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/groups/class_groupManagement.inc b/gosa-core/plugins/admin/groups/class_groupManagement.inc
new file mode 100644 (file)
index 0000000..f146ad6
--- /dev/null
@@ -0,0 +1,720 @@
+<?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 groupManagement extends plugin
+{
+  /* Definitions */
+  var $plHeadline= "Groups";
+  var $plDescription= "This does something";
+
+  /* Dialog attributes */
+  var $grouptab           = NULL;
+  var $grouplist          = array();
+  var $ui                 = NULL;
+  var $CopyPasteHandler   = NULL;
+  var $DivListGroup       = NULL;
+  var $ShowPrimaryCheckBox= false; 
+  var $start_pasting_copied_objects = FALSE;
+
+  function groupManagement (&$config, &$ui)
+  {
+    /* Save configuration for internal use */
+    $this->config = &$config;
+    $this->ui     = &$ui;
+
+    /* Copy & Paste enabled ?*/
+    if((isset($this->config->data['MAIN']['ENABLECOPYPASTE']))&&(preg_match("/true/i",$this->config->data['MAIN']['ENABLECOPYPASTE']))){
+      $this->CopyPasteHandler = new CopyPasteHandler($this->config);
+    }
+    
+    /* Detect if we have to display the primary group checkbox */
+    $tmp = "";
+    if (isset($this->config->data['MAIN']['NOPRIMARYGROUP'])){
+      $tmp = $this->config->data['MAIN']['NOPRIMARYGROUP'];
+    }
+    if(preg_match("/true/i",$tmp)|| (preg_match("/yes/",$tmp))){ 
+      $this->ShowPrimaryCheckBox = false;
+    } else {
+      $this->ShowPrimaryCheckBox = true;
+    }
+
+    /* Create dialog object */
+    $this->DivListGroup = new divListGroup($this->config,$this);
+    $this->DivListGroup->DisableCheckBox("ShowPrimaryGroups",$this->ShowPrimaryCheckBox);
+  }
+
+
+  function execute()
+  {
+       /* Call parent execute */
+       plugin::execute();
+
+    /* Store these posts if the current object is locked (used by somebody else)*/
+    $_SESSION['LOCK_VARS_TO_USE'] = array("/^act$/","/^id$/","/^group_edit_/","/^group_del_/","/^item_selected/","/^remove_multiple_groups/");
+
+    /* Save data */
+    $s_action   = "";
+    $s_entry    = "";
+
+    /* Test Posts */
+    foreach($_POST as $key => $val){
+      // Post for delete
+      if(preg_match("/^group_del.*/",$key)){
+        $s_action = "del";
+        $s_entry  = preg_replace("/group_".$s_action."_/i","",$key);
+        // Post for edit
+      }elseif(preg_match("/^group_edit_.*/",$key)){
+        $s_action="edit";
+        $s_entry  = preg_replace("/group_".$s_action."_/i","",$key);
+        // Post for new
+      }elseif(preg_match("/^group_new.*/",$key)){
+        $s_action="new";
+      }elseif(preg_match("/^dep_home.*/i",$key)){
+        $s_action="home";
+      }elseif(preg_match("/^group_tplnew.*/i",$key)){
+        $s_action="new_tpl";
+      }elseif(preg_match("/^group_chgpw.*/i",$key)){
+        $s_action="change_pw";
+        $s_entry  = preg_replace("/group_chgpw_/i","",$key);
+      }elseif(preg_match("/_group_edit_/",$key)){
+        $type = preg_replace("/_group_edit_.*$/","",$key);
+        $s_action="edit";
+        $s_entry  = preg_replace("/".$type."_group_edit_/i","",$key); 
+        $_POST['arg'] = $type;
+      }elseif(preg_match("/^editPaste.*/i",$key)){
+        $s_action="editPaste";
+      }elseif(preg_match("/^copy_.*/",$key)){
+        $s_action="copy";
+        $s_entry  = preg_replace("/^copy_/i","",$key);
+      }elseif(preg_match("/^cut_.*/",$key)){
+        $s_action="cut";
+        $s_entry  = preg_replace("/^cut_/i","",$key);
+      }elseif(preg_match("/^remove_multiple_groups/",$key)){
+        $s_action="del_multiple";
+      }elseif(preg_match("/^multiple_copy_groups/",$key)){
+        $s_action = "copy_multiple";
+      }elseif(preg_match("/^multiple_cut_groups/",$key)){
+        $s_action = "cut_multiple";
+      }
+    }
+    $s_entry  = preg_replace("/_.$/","",$s_entry); 
+
+    /* Check for posted gets */
+    if((isset($_GET['act'])) && ($_GET['act'] == "edit_entry")){
+      $s_entry    = $_GET['id'];
+      $s_action = "edit";
+    }
+
+    /* handle C&P from layers menu */
+    if(isset($_POST['menu_action']) && preg_match("/^multiple_copy_systems/",$_POST['menu_action'])){
+      $s_action = "copy_multiple";
+    }
+    if(isset($_POST['menu_action']) && preg_match("/^multiple_cut_systems/",$_POST['menu_action'])){
+      $s_action = "cut_multiple";
+    }
+    if(isset($_POST['menu_action']) && preg_match("/^editPaste/",$_POST['menu_action'])){
+      $s_action = "editPaste";
+    }
+
+    /* Create options */
+    if(isset($_POST['menu_action']) && $_POST['menu_action'] == "group_new"){
+      $s_action = "new";
+    }
+
+    /* handle remove from layers menu */
+    if(isset($_POST['menu_action']) && preg_match("/^remove_multiple/",$_POST['menu_action'])){
+      $s_action = "del_multiple";
+    }
+
+
+
+    $smarty= get_smarty();
+
+    /********************
+      Copy & Paste Handling  ...
+     ********************/
+
+    /* Display the copy & paste dialog, if it is currently open */
+    $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
+    if($ret){
+      return($ret);
+    }
+
+
+    /********************
+      Create a new group  ...
+     ********************/
+
+    /* New group? */
+    if ($s_action=="new"){
+
+      /* Check create permissions */
+      $acl = $this->ui->get_permissions($this->DivListGroup->selectedBase,"groups/group");
+      if(preg_match("/c/",$acl)){
+
+        /* By default we set 'dn' to 'new', all relevant plugins will
+           react on this. */
+        $this->dn= "new";
+
+        /* Create new usertab object */
+        $this->grouptab= new grouptabs($this->config, $this->config->data['TABS']['GROUPTABS'], $this->dn);
+
+        /* Set up the group ACL's for this 'dn' */
+        $this->grouptab->set_acl_base($this->DivListGroup->selectedBase);
+      }
+    }
+
+
+    /********************
+      Save Group Tab/Object Changes
+     ********************/
+
+    /* Finish group edit is triggered by the tabulator dialog, so
+       the user wants to save edited data. Check and save at this
+       point. */
+    if ((isset($_POST['edit_finish']) || isset($_POST['edit_apply'])) && (isset($this->grouptab->config)) ){
+
+      /* Check tabs, will feed message array 
+         Save, or display error message? */
+      $message= $this->grouptab->check();
+      if (count($message) == 0){
+
+        /* Save user data to ldap */
+        $this->grouptab->save();
+
+        if (!isset($_POST['edit_apply'])){
+          /* Group has been saved successfully, remove lock from LDAP. */
+          if ($this->dn != "new"){
+            del_lock ($this->dn);
+          }
+
+          /* There's no page reload so we have to read new groups at this point. */
+          //$this->reload ();
+          unset ($this->grouptab);
+          $this->grouptab= NULL;
+          unset ($_SESSION['objectinfo']);
+        }
+      } else {
+        /* Ok. There seem to be errors regarding to the tab data,
+           show message and continue as usual. */
+        show_errors($message);
+      }
+    }
+
+
+    /********************
+      Edit existing group 
+     ********************/
+
+    /* User wants to edit data? */
+    if (($s_action=="edit") && (!isset($this->grouptab-> config))){
+
+      /* Get 'dn' from posted 'uid', must be unique */
+      $this->dn= $this->grouplist[trim($s_entry)]['dn'];
+
+      /* Check locking & lock entry if required */
+      $user = get_lock($this->dn);
+      if ($user != ""){
+        return(gen_locked_message ($user, $this->dn));
+      }
+      add_lock ($this->dn, $this->ui->dn);
+
+      /* Register grouptab to trigger edit dialog */
+      $this->grouptab= new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], $this->dn);
+      $this->grouptab->set_acl_base($this->dn);
+      $_SESSION['objectinfo']= $this->dn;
+    }
+
+
+    /********************
+      Delete MULTIPLE entries requested, display confirm dialog
+     ********************/
+
+    if ($s_action=="del_multiple"){
+      $ids = $this->list_get_selected_items();
+
+      if(count($ids)){
+
+        foreach($ids as $id){
+          $dn = $this->grouplist[$id]['dn'];
+          if (($user= get_lock($dn)) != ""){
+            return(gen_locked_message ($user, $dn));
+          }
+          $this->dns[$id] = $dn;
+        }
+
+        $dns_names = "<br><pre>";
+        foreach($this->dns as $dn){
+          add_lock ($dn, $this->ui->dn);
+          $dns_names .= $dn."\n";
+        }
+        $dns_names .="</pre>";
+
+        /* Lock the current entry, so nobody will edit it during deletion */
+        if (count($this->dns) == 1){
+          $smarty->assign("info",     sprintf(_("You're about to delete the following entry %s"), @LDAP::fix($dns_names)));
+        } else {
+          $smarty->assign("info",     sprintf(_("You're about to delete the following entries %s"), @LDAP::fix($dns_names)));
+        }
+        $smarty->assign("multiple", true);
+        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+      }
+    }
+
+
+    /********************
+      Delete MULTIPLE entries confirmed
+     ********************/
+
+      /* Confirmation for deletion has been passed. Groups should be deleted. */
+      if (isset($_POST['delete_multiple_groups_confirm'])){
+
+        /* Remove user by user and check acls before removeing them */
+        foreach($this->dns as $key => $dn){
+
+          /* Load permissions for selected 'dn' and check if
+             we're allowed to remove this 'dn' */
+          $acl = $this->ui->get_permissions($dn,"groups/group");
+          if(preg_match("/d/",$acl)){
+
+            /* Delete request is permitted, perform LDAP action */
+            $this->grouptab= new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], $dn);
+            $this->grouptab->set_acl_base($dn);
+            $this->grouptab->delete ();
+            unset ($this->grouptab);
+            $this->grouptab= NULL;
+
+          } else {
+
+            /* Normally this shouldn't be reached, send some extra
+               logs to notify the administrator */
+            print_red (_("You are not allowed to delete this group!"));
+            new log("security","groups/".get_class($this),$dn,array(),"Tried to trick deletion.");
+          }
+          /* Remove lock file after successfull deletion */
+          del_lock ($dn);
+          unset($this->dns[$key]);
+        }
+      }
+
+
+      /********************
+        Delete MULTIPLE entries Canceled
+       ********************/
+
+      /* Remove lock */
+    if(isset($_POST['delete_multiple_user_cancel'])){
+      foreach($this->dns as $key => $dn){
+        del_lock ($dn);
+        unset($this->dns[$key]);
+      }
+    }
+
+
+    /********************
+      Delete group 
+     ********************/
+
+    /* Remove group was requested */
+    if ($s_action=="del"){
+
+      /* Get 'dn' from posted 'uid' */
+      $this->dn= $this->grouplist[trim($s_entry)]['dn'];
+
+      /* Load permissions for selected 'dn' and check if
+         we're allowed to remove this 'dn' */
+      $acl = $this->ui->get_permissions($this->dn,"groups/group");
+      if(preg_match("/d/",$acl)){
+
+        /* Check locking, save current plugin in 'back_plugin', so
+           the dialog knows where to return. */
+        if (($user= get_lock($this->dn)) != ""){
+          return(gen_locked_message ($user, $this->dn));
+        }
+
+        /* Lock the current entry, so nobody will edit it during deletion */
+        add_lock ($this->dn, $this->ui->dn);
+        $smarty->assign("info", sprintf(_("You're about to delete the group '%s'."), @LDAP::fix($this->dn)));
+        $smarty->assign("multiple", false);
+        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+
+      } else {
+        
+        /* Obviously the user isn't allowed to delete. Show message and clean session. */
+        print_red (_("You are not allowed to delete this group!"));
+      }
+    }
+
+
+    /********************
+      Delete group confirmed  
+     ********************/
+
+    /* Confirmation for deletion has been passed. Group should be deleted. */
+    if (isset($_POST['delete_group_confirm'])){
+
+      /* Some nice guy may send this as POST, so we've to check
+         for the permissions again. */
+      $acl = $this->ui->get_permissions($this->dn,"groups/group");
+      if(preg_match("/d/",$acl)){
+
+        /* Delete request is permitted, perform LDAP action */
+        $this->grouptab= new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], $this->dn);
+        $this->grouptab->set_acl_base($this->dn);
+        $this->grouptab->delete ();
+        unset ($this->grouptab);
+        $this->grouptab= NULL;
+
+        /* Group list has changed, reload it. */
+        //$this->reload ();
+
+      } else {
+
+        /* Normally this shouldn't be reached, send some extra
+           logs to notify the administrator */
+        print_red (_("You are not allowed to delete this group!"));
+        new log("security","groups/".get_class($this),$dn,array(),"Tried to trick deletion.");
+      }
+
+      /* Remove lock file after successfull deletion */
+      del_lock ($this->dn);
+      unset($_SESSION['objectinfo']);
+    }
+
+
+    /********************
+      Delete group canceled  
+     ********************/
+
+    /* Delete group canceled? */
+    if (isset($_POST['delete_cancel'])){
+      del_lock ($this->dn);
+      unset($_SESSION['objectinfo']);
+    }
+    
+
+    /********************
+      A dialog was canceled  
+     ********************/
+
+    /* Cancel dialogs */
+    if (isset($_POST['edit_cancel']) || isset($_POST['password_cancel'])){
+      if(isset($this->grouptab->dn)){
+        del_lock ($this->grouptab->dn);
+      }
+      unset ($this->grouptab);
+      $this->grouptab= NULL;
+      unset($_SESSION['objectinfo']);
+    }
+
+
+    /********************
+      If there is currently a dialog open, display it
+     ********************/
+
+    /* Show tab dialog if object is present */
+    if (isset($this->grouptab->config)){
+      $display= $this->grouptab->execute();
+
+      /* Don't show buttons if tab dialog requests this */
+      if(isset($this->grouptab->by_object)){
+        if (!$this->grouptab->by_object[$this->grouptab->current]->dialog){
+          $display.= "<p style=\"text-align:right\">\n";
+          $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
+          $display.= "&nbsp;\n";
+          if ($this->dn != "new"){
+            $display.= "<input type=submit name=\"edit_apply\" value=\""._("Apply")."\">\n";
+            $display.= "&nbsp;\n";
+          }
+          $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+          $display.= "</p>";
+        }
+      }
+      return ($display);
+    }
+
+
+    /* Check if there is a snapshot dialog open */
+    $base = $this->DivListGroup->selectedBase;
+    if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases())){
+      return($str);
+    }
+   
+    /* Display dialog with group list */
+    $this->DivListGroup->parent = $this;
+    $this->DivListGroup->execute();
+
+    /* Add departments if subsearch is disabled */
+    if(!$this->DivListGroup->SubSearch){
+      $this->DivListGroup->AddDepartments($this->DivListGroup->selectedBase,4,1);
+    }
+    $this->reload ();
+    $this->DivListGroup->setEntries($this->grouplist);
+    return($this->DivListGroup->Draw());
+  }
+
+
+  /* Return departments, that will be included within snapshot detection */
+  function get_used_snapshot_bases()
+  {
+    return(array(get_groups_ou().$this->DivListGroup->selectedBase));
+  }
+
+
+  function list_get_selected_items()
+  {
+    $ids = array();
+    foreach($_POST as $name => $value){
+      if(preg_match("/^item_selected_[0-9]*$/",$name)){
+        $id   = preg_replace("/^item_selected_/","",$name);
+        $ids[$id] = $id;
+      }
+    }
+    return($ids);
+  }
+
+
+  function reload($CreatePosixsList=false)
+  {
+    $this->grouplist        = array();
+    $primaries              = array();
+    $functional             = array();
+    $error= $error2         = "";
+    $filter                 = "(objectclass=posixGroup)";
+
+    $base                   = $this->DivListGroup->selectedBase;
+    $Regex                  = $this->DivListGroup->Regex;
+    $UserRegex              = $this->DivListGroup->UserRegex;
+    $SubSearch              = $this->DivListGroup->SubSearch;
+    $ShowPrimaryGroups      = $this->DivListGroup->ShowPrimaryGroups;
+    $ShowSambaGroups        = $this->DivListGroup->ShowSambaGroups;
+    $ShowApplicationGroups  = $this->DivListGroup->ShowApplicationGroups;
+    $ShowMailGroups         = $this->DivListGroup->ShowMailGroups;
+    $ShowFunctionalGroups   = $this->DivListGroup->ShowFunctionalGroups;
+
+    /* Prepare ldap class */
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd($base);
+    $ldap->set_size_limit($_SESSION['size_limit']);
+
+
+    /********************
+      Create filter depending on selected checkboxes 
+     ********************/
+
+    /* Add application groups */
+    if ($ShowApplicationGroups){
+      $filter.= "(objectClass=gosaApplicationGroup)";
+    }
+    
+    /* Add Mail Groups */
+    if ($ShowMailGroups){
+      $filter.= "(objectClass=gosaMailAccount)";
+    }
+
+    $sfilter= "";
+    if ($this->config->current['SAMBAVERSION'] == 3){
+      if (!$ShowPrimaryGroups){
+        $sfilter= "(objectClass=sambaGroupMapping)";
+      } elseif ($ShowSambaGroups){
+        $filter.= "(objectClass=sambaGroupMapping)";
+      }
+    }
+
+    /* Prepare filter for given Regex && UserRegex */
+    if ($filter != ""){
+      $filter= "(&(cn=$Regex)(objectClass=posixGroup)(|$filter))";
+      if ($UserRegex != ""){
+        $filter= "(&(|(memberUID=".$UserRegex.")(cn=".$UserRegex."))$filter)";
+      }
+    }
+
+
+    /********************
+      Collect some groupids to be able to skip primary & functional groups 
+     ********************/
+
+    /* Collect primary groupIDs to show primary groups 
+       if this option is enabled in gosa conf && the checkbox is checked */  
+    if ($this->ShowPrimaryCheckBox){
+      $res = get_list("(&(uid=$Regex)(!(uid=*$))(objectClass=posixAccount)(gidNumber=*))",
+            "groups", $base,array("gidNumber", "cn"),  GL_SUBSEARCH);
+      foreach ($res as $attrs){
+        $primaries[$attrs['gidNumber'][0]]= $attrs['cn'][0];
+      }
+    }
+
+    /* Collect all GroupIDs from those groups which are functional.
+       Only perfrom this search if  ShowFunctionalGroups  is unchecked, else leave arre empty  */ 
+    $ff = "(&(cn=$Regex)(objectClass=posixGroup)(!(|(objectClass=gosaMailAccount)(objectClass=gosaApplicationGroup)$sfilter)))";
+    if ($SubSearch){
+      $res = get_list($ff, "groups", $base,array("gidNumber", "cn", "description"), GL_SUBSEARCH);
+    } else {
+      $res = get_list($ff, "groups", $base,array("gidNumber", "cn", "description"), GL_NONE);
+    }
+    foreach($res as $attrs){
+      if (!isset($primaries[$attrs['gidNumber'][0]])){
+        $functional[$attrs['gidNumber'][0]]= $attrs['gidNumber'][0];
+      }
+    }
+   
+
+    /********************
+      Search for the prepared filter 
+     ********************/
+   
+    /* Attributes to search for */    
+    $attrs = array("cn", "description", "gidNumber", "objectClass");
+    /* If subsearch is activated search for subobjects too */
+    $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
+    if(!empty($tmp)){
+      $attrs [] = "FAIrelease";
+    }
+
+    if ($SubSearch){
+      $res= get_list($filter, "groups", $base, $attrs, GL_SIZELIMIT| GL_SUBSEARCH);
+    } else {
+      $res= get_list($filter, "groups", get_groups_ou().$base, $attrs, GL_SIZELIMIT);
+    }
+
+    /* Sort values into grouplist*/
+    $tmp = $tmp2 = array();
+    foreach ($res as $value){
+      /* Skip functional groups if checkbox isn't checked */
+      if (!$ShowFunctionalGroups && isset($functional[$value['gidNumber'][0]])){
+        continue;
+      }
+      
+      /* If gidNumber is in $primaries skip this entry */
+      if (($ShowPrimaryGroups)   ||   (!$ShowPrimaryGroups && !isset($primaries[$value['gidNumber'][0]]))){
+        $tmp2[$value['cn'][0]] = $value;
+        $tmp [$value['cn'][0]] = $value['cn'][0];
+      }
+    }
+    natcasesort($tmp);
+    foreach($tmp as $name){
+      $this->grouplist[] = $tmp2[$name]; 
+    }
+    reset ($this->grouplist);
+  }
+
+
+  function copyPasteHandling_from_queue($s_action,$s_entry)
+  {
+    /* Check if Copy & Paste is disabled */
+    if(!is_object($this->CopyPasteHandler)){
+      return("");
+    }
+
+    /* Add a single entry to queue */
+    if($s_action == "cut" || $s_action == "copy"){
+
+      /* Cleanup object queue */
+      $this->CopyPasteHandler->cleanup_queue();
+      $dn = $this->grouplist[$s_entry]['dn'];
+      $this->CopyPasteHandler->add_to_queue($dn,$s_action,"grouptabs","GROUPTABS","groups");
+    }
+
+
+    /* Add entries to queue */
+    if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
+
+      /* Cleanup object queue */
+      $this->CopyPasteHandler->cleanup_queue();
+
+      /* Add new entries to CP queue */
+      foreach($this->list_get_selected_items() as $id){
+        $dn = $this->grouplist[$id]['dn'];
+
+        if($s_action == "copy_multiple"){
+          $this->CopyPasteHandler->add_to_queue($dn,"copy","grouptabs","GROUPTABS","groups");
+        }
+        if($s_action == "cut_multiple"){
+          $this->CopyPasteHandler->add_to_queue($dn,"cut","grouptabs","GROUPTABS","groups");
+        }
+      }
+    }
+
+    /* Start pasting entries */
+    if($s_action == "editPaste"){
+      $this->start_pasting_copied_objects = TRUE;
+    }
+
+    /* Return C&P dialog */
+    if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
+
+      /* Load entry from queue and set base */
+      $this->CopyPasteHandler->load_entry_from_queue();
+      $this->CopyPasteHandler->SetVar("base",$this->DivListGroup->selectedBase);
+
+      /* Get dialog */
+      $data = $this->CopyPasteHandler->execute();
+
+      /* Return dialog data */
+      if(!empty($data)){
+        return($data);
+      }
+    }
+
+    /* Automatically disable status for pasting */
+    if(!$this->CopyPasteHandler->entries_queued()){
+      $this->start_pasting_copied_objects = FALSE;
+    }
+    return("");
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    $this->DivListGroup->save_object();
+  }
+
+
+  function remove_lock()
+  {
+    if (isset($this->grouptab->dn)){
+      del_lock ($this->grouptab->dn);
+    }
+  }
+
+
+  function remove_from_parent()
+  {
+    /* Optionally execute a command after we're done */
+    $this->postremove();
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    /* Optionally execute a command after we're done */
+    $this->postcreate();
+  }
+
+  /* Unused functions  */
+  function check()  { }
+  function adapt_from_template($dn) { }
+  function password_change_needed()  { }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/groups/generic.tpl b/gosa-core/plugins/admin/groups/generic.tpl
new file mode 100644 (file)
index 0000000..4d67c86
--- /dev/null
@@ -0,0 +1,155 @@
+<table summary="" style="width:100%;">
+ <tr>
+  <td style="width:50%; vertical-align:top;">
+   <table summary="" style="width:100%">
+    <tr>
+     <td><LABEL for="cn">{t}Group name{/t}</LABEL>{$must}</td>
+     <td>
+{render acl=$cnACL}
+       <input id="cn" name="cn" size=25 maxlength=60 value="{$cn}" title="{t}Posix name of the group{/t}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td>
+      <LABEL for="description">{t}Description{/t}</LABEL>
+     </td>
+     <td>
+{render acl=$descriptionACL}
+      <input id="description" name="description" size=40 maxlength=80 value="{$description}" title="{t}Descriptive text for this group{/t}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td colspan=2> 
+      <div style="height:15px;"></div> 
+     </td>
+    </tr>
+    <tr>
+     <td>
+      <LABEL for="base">{t}Base{/t}</LABEL>{$must}
+     </td>
+     <td>
+{render acl=$baseACL}
+      <select id="base" size="1" name="base" title="{t}Choose subtree to place group in{/t}">
+       {html_options options=$bases selected=$base_select}
+      </select>
+{/render}
+
+{render acl=$baseACL disable_picture='images/folder_gray.png'}
+       <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+      <td colspan=2> <div style="height:15px; width:100%; border-bottom:1px solid #909090;"></div> </td>
+    </tr>
+    <tr>
+      <td colspan=2> <div style="height:15px; width:100%;"></div> </td>
+    </tr>
+    <tr>
+     <td colspan=2>
+{render acl=$gidNumberACL}
+      <input type=checkbox name="force_gid" value="1" title="{t}Normally IDs are autogenerated, select to specify manually{/t}" 
+       {$force_gid} onclick="changeState('gidNumber')">
+{/render}
+       <LABEL for="gidNumber">{t}Force GID{/t}</LABEL>
+      &nbsp;
+{render acl=$gidNumberACL}
+      <input name="gidNumber" size=9 maxlength=9 id="gidNumber" {$forceMode} value="{$gidNumber}" title="{t}Forced ID number{/t}">
+{/render}
+     </td>
+    </tr>
+
+    {if $samba3 ne ""}
+    <tr>
+     <td colspan=2>
+{render acl=$sambaGroupTypeACL}
+      <input type=checkbox name="smbgroup" value="1" {$smbgroup}  title="{t}Select to create a samba conform group{/t}">
+{/render}
+{render acl=$sambaGroupTypeACL}
+      <select size="1" name="groupType">
+       {html_options options=$groupTypes selected=$groupType}
+      </select>
+{/render}
+      &nbsp;
+      <LABEL for="">{t}in domain{/t}</LABEL>
+      &nbsp;
+{render acl=$sambaDomainNameACL}
+      <select id="sambaDomainName" size="1" name="sambaDomainName">
+       {html_options values=$sambaDomains output=$sambaDomains selected=$sambaDomainName}
+      </select>
+{/render}
+     </td>
+    </tr>
+    {/if}
+       {if $pickupGroup == "true"}
+    <tr>
+      <td colspan=2> <div style="height:15px; width:100%; border-bottom:1px solid #909090;"></div> </td>
+    </tr>
+    <tr>
+      <td colspan=2> <div style="height:15px; width:100%;"></div> </td>
+    </tr>
+    <tr>
+     <td colspan=2>
+{render acl=$fonGroupACL}
+      <input type=checkbox name="fon_group" value="1" {$fon_group}>{t}Members are in a phone pickup group{/t}
+{/render}
+     </td>
+    </tr>
+       {/if}
+       {if $nagios == "true"}
+    <tr>
+      <td colspan=2> <div style="height:15px; width:100%; border-bottom:1px solid #909090;"></div> </td>
+    </tr>
+    <tr>
+      <td colspan=2> <div style="height:15px; width:100%;"></div> </td>
+    </tr>
+    <tr>
+     <td colspan=2>
+{render acl=$nagiosGroupACL}
+      <input type=checkbox name="nagios_group" value="1" {$nagios_group}>{t}Members are in a nagios group{/t}
+{/render}
+     </td>
+    </tr>
+       {/if}
+   </table>
+
+  </td>
+  <td style="border-left:1px solid #A0A0A0">
+   &nbsp;
+  </td>
+
+  <td style="vertical-align:top;">
+
+   <table summary="" style="width:100%">
+    <tr>
+     <td style="vertical-align:top; width:50%">
+      <b><LABEL for="members">{t}Group members{/t}</LABEL></b>
+      <br>
+{render acl=$memberUidACL}
+      <select style="width:100%; height:380px;" id="members" name="members[]" size=15 multiple>
+       {html_options options=$members}
+               <option disabled>&nbsp;</option>
+      </select>
+{/render}
+      <br>
+      <input type=submit name="edit_membership" value="{t}Add{/t}">
+      &nbsp;
+      <input type=submit name="del_users" value="{t}Delete{/t}">
+     </td>
+    </tr> 
+   </table>
+  </td>
+
+ </tr>
+</table>
+
+<input type="hidden" name="groupedit" value="1">
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('cn');
+  -->
+</script>
diff --git a/gosa-core/plugins/admin/groups/group_objects.tpl b/gosa-core/plugins/admin/groups/group_objects.tpl
new file mode 100644 (file)
index 0000000..5fcdc73
--- /dev/null
@@ -0,0 +1,59 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
+<tr>
+  <td style="vertical-align:top; width:600px">
+   <div class="contentboxh" style="height:20px;">
+    <p class="contentboxh" style="font-size:12px">
+     <b><LABEL for="users">{t}Select users to add{/t}</LABEL> {$hint}</b>
+    </p>
+   </div>
+   <div class="contentboxb">
+    <p class="contentboxb" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+     <select id="users" style="width:600px; height:450px; margin-top:4px;" name="users[]" size="15" multiple>
+      {html_options options=$users}
+     </select>
+     <input type=hidden name="edit_helper">
+    </p>
+   </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>
+                               <input type=checkbox name="SubSearchGroup"  value="1" {if $SubSearchGroup == 1} checked {/if} 
+                                        onClick="mainform.submit()" title="{t}Select to see servers{/t}">{t}Search within subtree{/t}<br>
+                       </td>
+               </tr>   
+       </table>
+    <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+               <tr>
+                       <td>
+                               <img alt="" src="{$tree_image}" align=middle title="{t}Display users of department{/t}">
+                               &nbsp;
+                               <select name="dselect" id="dselect" size=1 onChange="mainform.submit()" 
+                                       title="{t}Choose the department the search will be based on{/t}">
+                               {html_options options=$deplist selected=$dselect}
+                       </select>
+                       </td>
+               </tr>
+       </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 users matching{/t}"></td>
+    <td><input type='text' name='regex' maxlength='20' style='width:99%' value='{$regex}' title='{t}Regular expression for matching user names{/t}' onChange="mainform.submit()"></td></tr></table>
+   {$apply}
+   </div>
+  </td>
+</tr>
+</table>
+
+<p class="plugbottom">
+  <input type=submit name="add_users_finish" value="{t}Add{/t}">
+  &nbsp;
+  <input type=submit name="add_users_cancel" value="{t}Cancel{/t}">
+</p>
+
diff --git a/gosa-core/plugins/admin/groups/mail.tpl b/gosa-core/plugins/admin/groups/mail.tpl
new file mode 100644 (file)
index 0000000..e7eb708
--- /dev/null
@@ -0,0 +1,170 @@
+<input type="hidden" name="mailedit" value="1">
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=0 border=0>
+
+ <!-- Headline container -->
+ <tr>
+  <td style="width:50%; border-right:1px solid #A0A0A0; vertical-align:top">
+   <h2><img class="center" alt="" align="middle" src="images/rightarrow.png"> {t}Generic{/t}</h2>
+   <table summary="">
+    <tr>
+     <td><LABEL for="mail">{t}Primary address{/t}</LABEL>{$must}</td>
+     <td>
+{render acl=$mailACL}
+       <input id="mail" name="mail" size="25" maxlength="65" value="{$mail}" title="{t}Primary mail address for this shared folder{/t}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><LABEL for="gosaMailServer">{t}Server{/t}</LABEL></td>
+     <td>
+{render acl=$gosaMailServerACL}
+      <select size="1" name="gosaMailServer" title="{t}Select mail server to place user on{/t}">
+       {html_options values=$mailServers output=$mailServers selected=$gosaMailServer}
+          <option disabled>&nbsp;</option>
+      </select>
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td>
+      <br>
+       <LABEL for="gosaMailQuota"> {t}Quota usage{/t}</LABEL>
+     </td>
+     <td>
+      <br>
+{if $quotadefined eq "true"}
+       {$quotausage}
+{else}
+       {t}not defined{/t}
+{/if}
+     </td>
+    </tr>
+    <tr>
+     <td>{t}Quota size{/t}</td>
+     <td>
+{render acl=$gosaMailQuotaACL}
+       <input id="gosaMailQuota" name="gosaMailQuota" size="6" align=middle maxlength="30" value="{$gosaMailQuota}">
+{/render}
+ {t}MB{/t}
+</td>
+    </tr>
+       {if $kolab}
+       <tr>
+               <td>
+                       {t}Folder type{/t}
+               </td>
+               <td>
+                       <select name="kolabFolderType_Type" onChange="document.mainform.submit();">
+                               {html_options options=$kolabFolderType_Types selected=$kolabFolderType_Type}
+                       </select>
+                       <select name="kolabFolderType_SubType" onChange="document.mainform.submit();">
+                               {html_options options=$kolabFolderType_SubTypes selected=$kolabFolderType_SubType}
+                       </select>
+                       {if !$JS}
+                               <input type='image' src='images/list_reload.png' class='center' alt='{t}Reload{/t}'>
+                       {/if}
+               </td>
+       </tr>
+       {/if}
+   </table>
+     
+  </td>
+  <td style="vertical-align:top;padding-left:2px;">
+   <h2><img class="center" alt="" align="middle" src="images/alternatemail.png"> {t}Alternative addresses{/t}</h2>
+
+{render acl=$gosaMailAlternateAddressACL}
+   <select style="width:100%;" name="alternates_list[]" size=10 multiple title="{t}List of alternative mail addresses{/t}">
+    {html_options values=$gosaMailAlternateAddress output=$gosaMailAlternateAddress}
+       <option disabled>&nbsp;</option>
+   </select>
+{/render}
+
+   <br>
+
+{render acl=$gosaMailAlternateAddressACL}
+   <input name="alternate_address" size="30" align=middle maxlength="60" value="">
+{/render}
+
+{render acl=$gosaMailAlternateAddressACL}
+   <input type=submit value="{t}Add{/t}" name="add_alternate">&nbsp;
+{/render}
+
+{render acl=$gosaMailAlternateAddressACL}
+   <input type=submit value="{t}Delete{/t}" name="delete_alternate">
+{/render}
+
+  </td>
+ </tr>
+
+</table>
+
+<p class="seperator">&nbsp;</p>
+
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4 border=0>
+ <tr>
+  <td style="vertical-align:top;width:50%; border-right:1px solid #A0A0A0">
+   <h2><img class="center" alt="" align="middle" src="images/members.png"> {t}IMAP shared folders{/t}</h2>
+
+   <table summary="" cellpadding=0 border=0>
+    <tr>
+     <td><LABEL for="default_permissions">{t}Default permission{/t}</LABEL></td>
+     <td>
+{render acl=$aclACL}
+      <select size="1" id="default_permissions" name="default_permissions">
+       {html_options options=$perms selected=$default_permissions}
+          <option disabled>&nbsp;</option>
+      </select>
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><LABEL for="member_permissions">{t}Member permission{/t}</LABEL></td>
+     <td>
+{render acl=$aclACL}
+      <select id="member_permissions" size="1" name="member_permissions">
+       {html_options options=$perms selected=$member_permissions}
+      </select>
+{/render}
+     </td>
+    </tr>
+       {$plusattributes}
+   </table>
+      
+  </td>
+  <td style="vertical-align:top;width:50%">
+   <h2>
+       <img class="center" alt="" align="middle" src="images/envelope.png">
+       {t}Forward messages to non group members{/t}
+   </h2>
+
+{render acl=$gosaMailForwardingAddressACL}
+   <select style="width:100%;" name="forwarder_list[]" size=10 multiple>
+    {html_options values=$gosaMailForwardingAddress output=$gosaMailForwardingAddress}
+       <option disabled>&nbsp;</option>
+   </select>
+{/render}
+
+   <br>
+
+{render acl=$gosaMailForwardingAddressACL}
+   <input name="forward_address" size=20 align=middle maxlength=65 value="">
+{/render}
+{render acl=$gosaMailForwardingAddressACL}
+   <input type=submit value="{t}Add{/t}" name="add_forwarder">&nbsp;
+{/render}
+{render acl=$gosaMailForwardingAddressACL}
+   <input type=submit value="{t}Add local{/t}" name="add_local_forwarder">&nbsp;
+{/render}
+{render acl=$gosaMailForwardingAddressACL}
+   <input type=submit value="{t}Delete{/t}" name="delete_forwarder">
+{/render}
+  </td>
+ </tr>
+</table>
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('mail');
+  -->
+</script>
diff --git a/gosa-core/plugins/admin/groups/mail_admins.tpl b/gosa-core/plugins/admin/groups/mail_admins.tpl
new file mode 100644 (file)
index 0000000..8c95cb0
--- /dev/null
@@ -0,0 +1,40 @@
+<table summary="" style="width:100%;">
+ <tr>
+  <td style="width:45%; vertical-align:top;">
+  <LABEL for="admins"> {t}Folder administrators{/t}</LABEL>
+   <br>
+   <select id="admins" style="width:380px; height:300px;" name="admins[]" size=15 multiple>
+    {html_options options=$admins}
+   </select>
+  </td>
+
+  <td style="width:10%; vertical-align:middle; text-align:center;">
+   <input type=submit name="add_users" value="&larr;" style="width:50px;">
+   <br>
+   <br>
+   <input type=submit name="del_users" value="&rarr;" style="width:50px;">
+  </td>
+
+  <td style="width:45%; vertical-align:top;">
+   <br>
+   <select style="width:380px; height:275px;" name="users[]" size=15 multiple>
+    {html_options options=$mailusers}
+   </select>
+   <br>
+       <LABEL for="department">{t}Select a specific department{/t}</LABEL>:
+   <select id="department" name="department" size=1 onChange="mainform.submit()">
+    {html_options options=$departments selected=$department}
+   </select>
+
+   {if $javascript ne "true"}
+   <input type=submit name="goButton" value="{t}Choose{/t}">
+   {/if}
+  </td>
+ </tr>
+</table>
+
+<p class="plugbottom">
+ <input type=submit name="edit_admins_finish" value="{t}Apply{/t}">
+ &nbsp;
+ <input type=submit name="edit_admins_cancel" value="{t}Cancel{/t}">
+</p>
diff --git a/gosa-core/plugins/admin/groups/mail_locals.tpl b/gosa-core/plugins/admin/groups/mail_locals.tpl
new file mode 100644 (file)
index 0000000..09d734a
--- /dev/null
@@ -0,0 +1,69 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
+<tr>
+  <td style="vertical-align:top; width:600px">
+   <div class="contentboxh" style="height:20px;">
+    <p class="contentboxh" style="font-size:12px">
+     <b><LABEL for="local_list">{t}Select addresses to add{/t} {$hint}</LABEL ></b><br>
+    </p>
+   </div>
+   <div class="contentboxb">
+    <p class="contentboxb" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+     <select style="width:600px; margin-top:4px; height:450px;" id="local_list" name="local_list[]" size="15" multiple>
+               {html_options options=$mailusers}
+               <option disabled>&nbsp;</option>
+     </select>
+    </p>
+   </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="width:100%;border-top:1px solid #B0B0B0; background-color:#F8F8F8">
+               <tr>
+                       <td>
+                               <img alt="" src="{$tree_image}" align=middle title="{t}Display addresses of department{/t}">&nbsp;
+                               <select name="depselect" size=1 onChange="mainform.submit()" title="{t}Choose the department the search will be based on{/t}">
+                       {html_options options=$deplist selected=$depselect}
+                               </select>
+                       </td>
+               </tr>
+       </table>
+    <table summary="" width="100%" style="width:100%;border-top:1px solid #B0B0B0; background-color:#F8F8F8">
+               <tr>
+                       <td width="18">
+                               <img alt="" src="{$search_image}" align=middle title="{t}Display addresses matching{/t}">
+                       </td>
+               <td>
+                               <input type='text' name='regex' maxlength='20' style="width:99%"value='{$regex}' title='{t}Regular expression for matching addresses{/t}' onChange="mainform.submit()">
+                       </td>
+               </tr>
+       </table>
+    <table summary="" width="100%"  style="width:100%;border-top:1px solid #B0B0B0; background-color:#F8F8F8">
+               <tr>
+                       <td width="18">
+                               <img alt="" src="{$usearch_image}" align=middle title="{t}Display addresses of user{/t}">
+                       </td>
+               <td>
+                               <input type='text' name='muser' maxlength='20' value='{$muser}' style="width:99%" title='{t}User name of which addresses are shown{/t}' onChange="mainform.submit()">
+                       </td>
+               </tr>
+       </table>
+   {$apply}
+   </div>
+  </td>
+</tr>
+</table>
+
+<p class="plugbottom">
+  <input type=submit name="add_locals_finish" value="{t}Add{/t}">
+  &nbsp;
+  <input type=submit name="add_locals_cancel" value="{t}Cancel{/t}">
+</p>
diff --git a/gosa-core/plugins/admin/groups/main.inc b/gosa-core/plugins/admin/groups/main.inc
new file mode 100644 (file)
index 0000000..3a12101
--- /dev/null
@@ -0,0 +1,60 @@
+<?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
+ */
+
+if ($remove_lock){
+  if(isset($_SESSION['groupManagement'])){
+    $groupManagement= $_SESSION['groupManagement'];
+    $groupManagement->remove_lock();
+    del_lock ($ui->dn);
+    sess_del ('groupManagement');
+  }
+} else {
+  /* Create groupManagement object on demand */
+  if (!isset($_SESSION['groupManagement']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+    $_SESSION['groupManagement']= new groupManagement ($config, $_SESSION['ui']);
+  }
+  $groupManagement= $_SESSION['groupManagement'];
+  $groupManagement->save_object();
+  $output= $groupManagement->execute();
+
+  /* Page header*/
+  if (isset($_SESSION['objectinfo'])){
+    $display= print_header(get_template_path('images/group.png'),
+                           _("Group administration"), "<img alt=\"\" align=\"middle\" src=\"".
+                            get_template_path('images/closedlock.png')."\"> ".
+                            @LDAP::fix($_SESSION['objectinfo']));
+  } else {
+    $display= print_header(get_template_path('images/group.png'), _("Group administration"));
+  }
+
+  $display.= $output;
+
+  /* Reset requested? */
+  if (isset($_GET['reset']) && $_GET['reset'] == 1){
+    del_lock ($ui->dn);
+    sess_del ('groupManagement');
+  }
+
+  /* Show and save dialog */
+  $_SESSION['groupManagement']= $groupManagement;
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/groups/paste_generic.tpl b/gosa-core/plugins/admin/groups/paste_generic.tpl
new file mode 100644 (file)
index 0000000..26477de
--- /dev/null
@@ -0,0 +1,25 @@
+<h2>{t}Group settings{/t}</h2>
+<table width='100%'>
+       <tr>
+               <td style='width:150px;'>
+                       {t}Group name{/t}
+               </td>
+               <td>
+                       <input id='cn' name='cn' size='35' maxlength='60' value='{$cn}' title='{t}Posix name of the group{/t}'>
+               </td>
+       </tr>
+       <tr>
+               <td>
+                       <input type=checkbox name='force_gid' value='1' {$used} title='{t}Normally IDs are autogenerated, select to specify manually{/t}' 
+                               onclick='changeState("gidNumber")'>
+                       <LABEL for='gidNumber'>{t}Force GID{/t}</LABEL>
+               </td>
+               <td>
+                       <input name='gidNumber' size=9 maxlength=9 id='gidNumber' {$dis} value='{$gidNumber}' title='{t}Forced ID number{/t}'>
+               </td>
+       </tr>
+</table>
+
+<script language="JavaScript" type="text/javascript">
+       focus_field('cn');
+</script>
diff --git a/gosa-core/plugins/admin/groups/paste_mail.tpl b/gosa-core/plugins/admin/groups/paste_mail.tpl
new file mode 100644 (file)
index 0000000..e30ba9a
--- /dev/null
@@ -0,0 +1,56 @@
+<h2>{t}Mail settings{/t}</h2>
+<table summary="" style="width:100%; vertical-align:top; text-align:left;">
+       <tr>
+               <td colspan=2>   
+                       <table summary="">
+                       <tr>
+                               <td>
+                                               <LABEL for="mail">{t}Primary address{/t}</LABEL>{$must}
+                                       </td>
+                               <td>
+                                               <input id="mail" name="mail" size="25" maxlength="65" 
+                                                       value="{$mail}" title="{t}Primary mail address for this shared folder{/t}">
+                                       </td>
+                       </tr>
+                       </table>
+               </td>
+       </tr>
+       <tr>
+               <td>
+                       <table style="width:100%; vertical-align:top; text-align:left;">
+                               <tr>
+                                       <td style="width:50%; border-right:1px solid #A0A0A0; vertical-align:top">
+                                                       {t}Alternative addresses{/t}
+                                               <select style="width:100%;" name="alternates_list[]" size=10 multiple title="{t}List of alternative mail addresses{/t}">
+                                                       {html_options values=$gosaMailAlternateAddress output=$gosaMailAlternateAddress}
+                                                       <option disabled>&nbsp;</option>
+                                               </select>
+                                               <br>
+                                               <input name="alternate_address" size="30" align=middle maxlength="60" value="">
+                                               <input type=submit value="{t}Add{/t}" name="add_alternate">&nbsp;
+                                               <input type=submit value="{t}Delete{/t}" name="delete_alternate">
+                                       </td>
+                                       <td style="vertical-align:top;width:50%">
+                                                       {t}Forward messages to non group members{/t}
+                                               <select style="width:100%;" name="forwarder_list[]" size=10 multiple>
+                                                       {html_options values=$gosaMailForwardingAddress output=$gosaMailForwardingAddress}
+                                                       <option disabled>&nbsp;</option>
+                                               </select>
+                                               <br>
+                                               <input name="forward_address" size=20 align=middle maxlength=65 value="">
+                                               <input type=submit value="{t}Add{/t}" name="add_forwarder">&nbsp;
+                                               <input type=submit value="{t}Add local{/t}" name="add_local_forwarder">&nbsp;
+                                               <input type=submit value="{t}Delete{/t}" name="delete_forwarder">
+                                       </td>
+                               </tr>
+                       </table>
+               <td>
+       </tr>
+</table>
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('mail');
+  -->
+</script>
diff --git a/gosa-core/plugins/admin/groups/remove.tpl b/gosa-core/plugins/admin/groups/remove.tpl
new file mode 100644 (file)
index 0000000..1c93834
--- /dev/null
@@ -0,0 +1,27 @@
+<div style="font-size:18px;">
+  <img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
+</div>
+<p>
+  {$info}
+  {t}This may be a primary user group. Please double check if you really want to do this since there is no way for GOsa to get your data back.{/t}
+</p>
+
+<p>
+  {t}So - if you're sure - press 'Delete' to continue or 'Cancel' to abort.{/t}
+</p>
+
+<p class="plugbottom">
+
+  {if $multiple}
+  <input type=submit name="delete_multiple_groups_confirm" value="{t}Delete{/t}">
+  &nbsp;
+  <input type=submit name="delete_multiple_group_cancel" value="{t}Cancel{/t}">
+  {else}
+  <input type=submit name="delete_group_confirm" value="{t}Delete{/t}">
+  &nbsp;
+  <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
+  {/if}
+
+
+</p>
+
diff --git a/gosa-core/plugins/admin/groups/tabs_group.inc b/gosa-core/plugins/admin/groups/tabs_group.inc
new file mode 100644 (file)
index 0000000..094551d
--- /dev/null
@@ -0,0 +1,101 @@
+<?php
+
+class grouptabs extends tabs
+{
+
+       function grouptabs($config, $data, $dn)
+       {
+               tabs::tabs($config, $data, $dn,"groups");
+               $this->addSpecialTabs();
+       }
+
+       function save_object($save_current= FALSE)
+       {
+               tabs::save_object($save_current);
+
+               /* Update reference, transfer variables */
+               $baseobject= $this->by_object['group'];
+               foreach ($this->by_object as $name => $obj){
+                       /* Don't touch base object */
+                       if ($name != 'group'){
+                               $obj->parent= &$this;
+                               $obj->cn= $baseobject->cn;
+                               $this->by_object[$name]= $obj;
+                       }
+               }
+       }
+
+       function delete()
+       {
+               /* Put baseobjects 'cn' to mailobjects 'uid' */
+               $baseobject= $this->by_object['group'];
+               if (isset($this->by_object['mailgroup'])){
+                       $this->by_object['mailgroup']->uid= $baseobject->cn;
+               }
+               tabs::delete();
+       }
+
+  function save($ignore_account= FALSE)
+       {
+               $baseobject= $this->by_object['group'];
+
+               /* Check for new 'dn', in order to propagate the
+                  'dn' to all plugins */
+               $new_dn= 'cn='.$baseobject->cn.','.get_groups_ou().$baseobject->base;
+
+               /* Put baseobjects 'cn' to mailobjects 'uid' */
+               if (isset($this->by_object['mailgroup'])){
+                       $this->by_object['mailgroup']->uid= $baseobject->cn;
+               }
+
+
+               /* Update reference, transfer variables */
+               foreach ($this->by_object as $name => $obj){
+                       /* Transfer attributes for mailgroup account */
+                       if ($name == 'mailgroup'){
+                               $this->by_object['mailgroup']->members= $baseobject->memberUid;;
+                       }
+               }
+
+               /* Move group? */
+               if ($this->dn != $new_dn){
+
+                       /* Write entry on new 'dn' */
+                       if ($this->dn != "new"){
+                               $baseobject->update_acls($this->dn,$new_dn);
+                               $baseobject->move($this->dn, $new_dn);
+                               $this->by_object['group']= $baseobject;
+                       }
+
+                       /* Happen to use the new one */
+                       $this->dn= $new_dn;
+               }
+
+               $ret= tabs::save();
+
+               /* Fix tagging if needed */
+               $baseobject->dn= $new_dn;
+               $baseobject->handle_object_tagging();
+
+               return $ret;
+       }
+
+       function saveCopyDialog()
+       {
+               tabs::saveCopyDialog();
+               
+               /* Update reference, transfer variables */
+               $baseobject= $this->by_object['group'];
+               foreach ($this->by_object as $name => $obj){
+                       /* Don't touch base object */
+                       if ($name != 'group'){
+                               $obj->parent= &$this;
+                               $obj->cn= $baseobject->cn;
+                               $this->by_object[$name]= $obj;
+                       }
+               }
+       }
+       
+}
+
+?>
diff --git a/gosa-core/plugins/admin/mimetypes/class_divListMimeTypes.inc b/gosa-core/plugins/admin/mimetypes/class_divListMimeTypes.inc
new file mode 100755 (executable)
index 0000000..1c8677f
--- /dev/null
@@ -0,0 +1,343 @@
+<?php
+
+class divListMimeTypes extends MultiSelectWindow
+{
+  /* Current base */
+  var $selectedBase       = "";
+  var $selectedRelease    = "main";
+  var $AvailableReleases  = array();
+  var $departments        = array();
+  var $parent               ;
+  var $ui                   ;
+
+  /* Regex */
+  var $Regex              = "*";
+
+  /* Subsearch checkbox */
+  var $SubSearch;
+
+  /* These vars should be saved too */
+  var $SaveAdditionalVars = array("selectedRelease");
+
+
+  function divListMimeTypes (&$config, &$parent)
+  {
+    /* Create divlist and setup */
+    MultiSelectWindow::MultiSelectWindow($config, "Mimetypes", "mimetypes");
+  
+    /* initialize required attributes */ 
+    $this->selectedRelease  = "ou=mime,".$_SESSION['CurrentMainBase'];
+    $this->parent           = &$parent;
+    $this->ui               = get_userinfo();
+    $this->AvailableReleases= $this->parent->getReleases($this->selectedBase);
+
+    /* Set list strings */
+    $this->SetTitle       (_("List of defined mime types"));
+    $this->SetSummary     (_("List of defined mime types"));
+    $this->SetInformation (_("This menu allows you to add, edit and remove selected mime types. You may want to use the range selector on top of the mime type listbox, when working with a large number of mime types."));
+
+    /* Result page will look like a headpage */
+    $this->SetHeadpageMode();
+    $this->EnableAplhabet(true);
+  
+    /* Disable buttonsm */
+    $this->EnableCloseButton(false);
+    $this->EnableSaveButton (false);
+
+    /* set Page header */
+    $action_col_size = 80;
+    if($this->parent->snapshotEnabled()){
+      $action_col_size += 38;
+    }
+
+    /* Toggle all selected / deselected */
+    $chk = "<input type='checkbox' id='select_all' name='select_all'
+               onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
+
+    /* set Page header */
+    $this->AddHeader(array("string"=> $chk,          "attach"=>"style='width:20px;'"));
+    $this->AddHeader(array("string" => "&nbsp;",                "attach" => "style='text-align:center;width:20px;'"));
+    $this->AddHeader(array("string" => _("Mime type name")." / "._("Department"), "attach" => "style=''"));
+    $this->AddHeader(array("string" => _("Actions"),            "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'"));
+
+    /* Add SubSearch checkbox */
+    $this->AddCheckBox("SubSearch",  _("Select to search within subtrees"), _("Search in subtrees"), false);
+
+    /*                  Name                 ,Text                              ,Default  , Connect with alphabet  */
+    $this->AddRegex   ("Regex",     _("Display mime types matching"),"*" , true);
+  }
+
+
+  /* This function allows us to add a user defined filter part at position $position*/
+  function AddUserBoxToFilter($position)
+  {
+    $str = "";
+    if(($position  == 2) && ($this->parent->IsReleaseManagementActivated($this->config))){
+      $smarty = get_smarty();
+      $smarty->assign("selectedRelease",$this->selectedRelease);
+      $smarty->assign("branchimage","images/branch.png");
+      $smarty->assign("releases",$this->AvailableReleases);
+      $str = $smarty->fetch(get_template_path('release_select.tpl', TRUE,dirname(__FILE__)));
+    }
+    return($str);
+  }
+
+
+  /* Create list header, with create / copy & paste etc*/
+  function GenHeader()
+  {
+    /* Prepare departments,
+       which are shown in the listbox on top of the listbox
+     */
+    $options= "";
+
+    /* Get all departments within this subtree */
+    $ui= get_userinfo();
+    $first = "";
+    $found = FALSE;
+    $base = $this->config->current['BASE'];
+
+    /* Add base */
+    $tmp = array();
+    $tmp[] = array("dn"=>$this->config->current['BASE']);
+    $tmp=  array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
+                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
+
+    $deps = array();
+    foreach($tmp as $tm){
+      $deps[$tm['dn']] = $tm['dn'];
+    }
+
+    /* Load possible departments */
+    $ui= get_userinfo();
+    $tdeps= $ui->get_module_departments($this->module);
+    $ids = $this->config->idepartments;
+    $first = "";
+    $found = FALSE;
+    foreach($ids as $dep => $name){
+      if(isset($deps[$dep]) && in_array_ics($dep, $tdeps)){
+
+        /* Keep first base dn in mind, we could need this
+         *  info if no valid base was found
+         */
+        if(empty($first)) {
+          $first = $dep['dn'];
+        }
+
+        $value = $ids[$dep];
+        if ($this->selectedBase == $dep){
+          $found = TRUE;
+          $options.= "<option selected='selected' value='".$dep."'>$value</option>";
+        } else {
+          $options.= "<option value='".$dep."'>$value</option>";
+        }
+      }
+    }
+
+    /* The currently used base is not visible with your acl setup.
+     * Set base to first useable base.
+     */
+    if(!$found){
+      $this->selectedBase = $first;
+    }
+
+    /* Get acls */
+    $ui       = get_userinfo();
+    $acl      = $ui->get_permissions("cn=dummy,ou=mimetypes,".$this->selectedBase,"mimetypes/mimetype");
+    $acl_all  = $ui->has_complete_category_acls($this->selectedBase,"mimetypes") ;
+
+
+    /* If this is true we add an additional seperator. Just look a few lines below */  
+    $add_sep = false;
+    /* Get copy & paste icon */
+    $Copy_Paste ="";
+    if(preg_match("/(c.*w|w.*c)/",$acl_all) &&  $this->parent->CopyPasteHandler){
+      $Copy_Paste = $this->parent->CopyPasteHandler->generatePasteIcon();
+      $add_sep = true;
+    }
+
+    /* Add default header */
+    $listhead = MultiSelectWindow::get_default_header();
+
+    /* And at least add a department selection box */
+    $listhead .=  _("Base")."&nbsp;<select name='CurrentMainBase' 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;";
+
+    /* Create Layers menu */
+    $s  = ".|"._("Actions")."|\n";
+    $s .= "..|<img src='images/list_new.png' alt='' border='0' class='center'>".
+      "&nbsp;"._("Create")."|\n";
+
+    /* Append create options */
+    if(preg_match("/c/",$acl)) {
+      $s.= "...|<input class='center' type='image' src='images/list_new_mime.png' alt=''>".
+        "&nbsp;"._("Mime type")."|mime_new|\n";
+    }
+
+    /* Multiple options */
+    $s.= "..|---|\n";
+    $s.= "..|<img src='images/edittrash.png' alt='' border='0' class='center'>".
+      "&nbsp;"._("Remove")."|"."remove_multiple|\n";
+
+    /* Add multiple copy & cut icons */
+    if(is_object($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
+      $s.= "..|---|\n";
+      $s.= "..|<img src='images/editcopy.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Copy")."|"."multiple_copy_systems|\n";
+      $s.= "..|<img src='images/editcut.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Cut")."|"."multiple_cut_systems|\n";
+
+      if($this->parent->CopyPasteHandler->entries_queued()){
+        $img = "<img border='0' class='center' src='images/editpaste.png' alt=''>";
+        $s.="..|".$img."&nbsp;"._("Paste")."|editPaste|\n";
+      }else{
+        $img = "<img border='0' class='center' src='images/cant_editpaste.png' alt=''>";
+        $s.="..|".$img."&nbsp;"._("Paste")."\n";
+      }
+    }
+
+    /* Add snapshot icons */
+    if(preg_match("/(c.*w|w.*c)/",$acl_all)){
+      $s .= "..|---|\n";
+      $s .= $this->get_snapshot_header(TRUE);
+    }
+
+    $this->SetDropDownHeaderMenu($s);
+    $this->SetListHeader($listhead);
+  }
+
+
+  /* Some basic settings */
+  function execute()
+  {
+    $this->ClearElementsList();
+    $this->GenHeader();
+  }
+
+
+  function setEntries($list)
+  {
+    /********************
+      Variable init
+     ********************/
+
+    /* Create links */
+    $linkopen = "<a href='?plug=".$_GET['plug']."&amp;act=dep_open&amp;dep_id=%s'>%s</a>";
+    $editlink = "<a href='?plug=".$_GET['plug']."&amp;id=%s&amp;act=edit_entry'>%s</a>";
+    $userimg  = "<img class='center' src='images/select_groups.png' alt='User'    title='%s'>";
+    $mimeimg  = "<img class='center' src='images/select_mimetype.png' alt='A'  title='"._("Mime type")."'>";
+    $empty    = "<img class='center' src='images/empty.png' style='width:16px;height:16px;' alt=''>";
+
+    /* set Page header */
+    $action_col_size = 80;
+    if($this->parent->snapshotEnabled()){
+      $action_col_size += 38;
+    }
+
+    /********************
+      Attach objects
+     ********************/
+
+    foreach($list as $key => $val){
+
+      $ui       = get_userinfo();
+      $acl      = $ui->get_permissions($val['dn'],"mimetypes/mimetype");
+      $acl_all  = $ui->has_complete_category_acls($val['dn'],"mimetypes") ;
+
+      /* Create action icons */
+      $actions = "";
+      if(preg_match("/(c.*w|w.*c)/",$acl_all)){
+        $actions .= $this->GetSnapShotActions($val['dn']);
+      }
+
+      /* Get copy Paste icons */
+      if(($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
+        $actions.= "<input class='center' type='image'
+          src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
+        $actions.= "<input class='center' type='image'
+          src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
+      }
+
+      $actions.= "<input class='center' type='image'
+        src='images/edit.png' alt='"._("edit")."' name='mime_edit_%KEY%' title='"._("Edit this entry")."'>";
+
+      /* Add delete button */
+      if(preg_match("/d/",$acl)){
+        $actions.= "<input class='center' type='image'
+          src='images/edittrash.png' alt='"._("delete")."' name='mime_del_%KEY%' title='"._("Delete this entry")."'>";
+      }else{
+        $actions.= "<img src='images/empty.png' alt='&nbsp;' class='center'>";
+      }
+
+      $title = "title='".preg_replace('/ /', '&nbsp;', @LDAP::fix($val['dn']))."'";
+
+      if(!isset($val['description'][0])){
+        $desc = "";
+      }else{
+        $desc = " - [ ".$val['description'][0]." ]";
+      }
+
+      /* Cutted objects should be displayed in light grey */
+      $display = $val['cn'][0].$desc;
+      if($this->parent->CopyPasteHandler){
+        foreach($this->parent->CopyPasteHandler->queue as $queue_key => $queue_data){
+          if($queue_data['dn'] == $val['dn']) {
+            $display = "<font color='#999999'>".$display."</font>";
+            break;
+          }
+        }
+      }
+
+
+      /* Create each field */
+      $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
+                      "attach" => "style='width:20px;'");
+      $field1 = array("string" => sprintf($mimeimg,$val['dn']), "attach" => "style='text-align:center;width:20px;'");
+      $field2 = array("string" => sprintf($editlink,$key,$display), "attach" => "style='' ".$title);
+      $field3 = array("string" => preg_replace("/%KEY%/", $key, $actions), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'");
+      $this->AddElement(array($field0,$field1,$field2,$field3));
+    }
+
+
+    /* Create summary string for list footer */
+    $num_deps=0;
+    if(!$this->SubSearch){
+      $num_deps = count($this->Added_Departments);
+    }
+    $num_objs = count($list);
+
+    $num_obj_str = _("Number of listed mimetypes");
+    $num_dep_str = _("Number of listed departments");
+
+    $str = "<img class='center' src='images/select_mimetype.png'
+              title='".$num_obj_str."' alt='".$num_obj_str."'>&nbsp;".$num_objs."&nbsp;&nbsp;&nbsp;&nbsp;";
+    $str.= "<img class='center' src='images/folder.png'
+              title='".$num_dep_str."' alt='".$num_dep_str."'>&nbsp;".$num_deps."&nbsp;&nbsp;&nbsp;&nbsp;";
+
+    $this->set_List_Bottom_Info($str);
+  }
+
+  function Save()
+  {
+    MultiSelectWindow::Save();  
+  }
+
+  function save_object()
+  {
+    /* Save automatic created POSTs like regex, checkboxes */
+    MultiSelectWindow::save_object(); 
+
+    /* check if returned selectedRelease is a valid release.
+        If it isn't set to a valid release */
+    $this->AvailableReleases = $this->parent->getReleases($this->selectedBase);
+    if(!isset($this->AvailableReleases[$this->selectedRelease])){
+      $this->selectedRelease =key($this->AvailableReleases);
+    }
+    $_SESSION['mimefilter']['release']  = $this->selectedRelease;
+  }
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/mimetypes/class_mimetypeGeneric.inc b/gosa-core/plugins/admin/mimetypes/class_mimetypeGeneric.inc
new file mode 100644 (file)
index 0000000..38b695e
--- /dev/null
@@ -0,0 +1,755 @@
+<?php
+class mimetype extends plugin
+{
+       /* CLI vars */
+       var $cli_summary                  = "This tab allows you to modify, add or remove mime types in the selected department.";
+       var $cli_description    = "Management dialog to handle mime types";
+       var $ignore_account     = true; // This is always a valid account
+       var $cli_parameters             = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+       var $objectclasses              = array("top","gotoMimeType");
+       var $attributes                   = array("cn","gotoMimeApplication","gotoMimeLeftClickAction","gotoMimeIcon",
+                                                                       "description","gotoMimeFilePattern","gotoMimeEmbeddedApplication",
+                                                                       "gotoMimeGroup");       
+
+       /* Class vars */
+       var $ui;
+       var $cn                                                                               = "";                                     
+       var $gotoMimeLeftClickAction                        = "I";
+       var $gotoMimeLeftClickAction_I              = true;
+       var $gotoMimeLeftClickAction_E              = false;
+       var $gotoMimeLeftClickAction_Q              = false;
+       var $gotoMimeIcon                                                         = "*removed*";
+       var $description                                                          = "";
+       var $gotoMimeFilePattern                                      = array();
+       var $gotoMimeApplication                                      = array();
+       var $gotoMimeEmbeddedApplication            = array();
+       var $gotoMimeGroup                                                      = "";
+       var $iconData                                                               = NULL;     
+       var $base                                                                             = "";
+  var $ApplicationList                  = array();  
+
+
+  /* To prevent errors when using the 'apply' button, we use this variables 
+      to manage array attributes */
+       var $use_gotoMimeIcon                                           = NULL;
+       var $use_gotoMimeFilePattern                        = array();
+       var $use_gotoMimeApplication                        = array();
+       var $use_gotoMimeEmbeddedApplication    = array();
+
+  /* divLists */
+  var $DivPatterns                                                       = NULL;
+  var $DivApps                                                             = NULL;
+  var $DivEApps                                                                    = NULL;
+
+  /* Mime type release mode */
+  var $isReleaseMimeType                                             = false;
+
+  /* These vars will be copied too, if you use copy&paste mode */
+  var $CopyPasteVars        = array("use_gotoMimeFilePattern","use_gotoMimeApplication","use_gotoMimeEmbeddedApplication","iconData",
+                                    "gotoMimeLeftClickAction_I","gotoMimeLeftClickAction_E","gotoMimeLeftClickAction_Q","use_gotoMimeIcon");
+
+  var $view_logged  = FALSE;
+
+  /* Select options */
+  var $MimeGroups                            = array("application","audio","chemical","image","inode","message","model",
+                                      "multipart","text","video","x-conference","x-world");
+
+  /* Orig_Dn is used to verify if this object is new or only edited */         
+  var $orig_dn                 = "";
+
+  function mimetype(&$config,$dn= NULL)
+  {
+    plugin::plugin ($config, $dn);
+
+    /* Save original dn */
+    $this->orig_dn = $dn;      
+
+    /* get gotoMimeLeftClickActions I/E/Q */
+    if(isset($this->gotoMimeLeftClickAction)){
+      $str = $this->gotoMimeLeftClickAction;
+      for($i = 0 ; $i < strlen($str) ; $i ++ ){
+        $varna = "gotoMimeLeftClickAction_". $str[$i];
+        if(isset($this->$varna)){
+          $this->$varna = true;
+        }
+      }
+    }
+
+    /* Create list of defined applications in GOsa */
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(&(objectClass=gosaApplication)(cn=*))",array('cn'));
+    $this->ApplicationList = array();
+    while($attrs = $ldap->fetch()){
+      $this->ApplicationList[$attrs['cn'][0]] = $attrs['cn'][0];
+    }
+
+    /* If both radio buttons arn't set, set option I */
+    if(!$this->gotoMimeLeftClickAction_I && !$this->gotoMimeLeftClickAction_E){
+      $this->gotoMimeLeftClickAction_I = true;
+    }
+
+    /* Get list of array attributes */
+    foreach(array("gotoMimeFilePattern") as $attr){
+      $this->$attr = array();
+      if(isset($this->attrs[$attr])){
+        $tmp = array();
+        for($i = 0 ; $i < $this->attrs[$attr]['count'] ; $i ++){
+          $str = $this->attrs[$attr][$i];
+          $tmp[] = $str;
+        }
+        $use_attr = "use_".$attr;
+        $this->$use_attr = $tmp;
+      }
+    }
+
+    /* Get list of array attributes with priority tag ( Test|32 )*/
+    foreach(array("gotoMimeApplication","gotoMimeEmbeddedApplication") as $attr){
+      $this->$attr = array();
+      if(isset($this->attrs[$attr])){
+        $tmp = array();
+        for($i = 0 ; $i < $this->attrs[$attr]['count'] ; $i ++){
+          $str = $this->attrs[$attr][$i];
+          $tmp2= split("\|",$str);
+
+          if(count($tmp2) == 2){
+            $name = $tmp2[0];
+            $prio = $tmp2[1];
+            $tmp[$prio] = $name;
+          }
+        }
+        ksort($tmp);
+        $use_attr = "use_".$attr;
+        $this->$use_attr = $tmp;
+      }
+    }
+
+    /* Check if release Management is enabled */
+    $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
+    if(!empty($tmp)) {
+      $this->isReleaseMimeType= true;
+    }
+
+    /* Set base */     
+    if ($this->dn == "new"){
+      if(isset($_SESSION['CurrentMainBase'])){
+        $this->base= $_SESSION['CurrentMainBase'];
+      }else{
+        $ui= get_userinfo();
+        $this->base= dn2base($ui->dn);
+      }
+    } else {
+      $this->base= preg_replace ("/^[^,]+,[^,]+,/", "", $this->dn);
+    }
+
+    /* Get icon data */
+    if(isset($this->attrs['gotoMimeIcon'])){
+      $ldap = $this->config->get_ldap_link();
+      $this->iconData = $ldap->get_attribute($this->dn,"gotoMimeIcon");
+      $this->saved_attributes['gotoMimeIcon'] = $this->iconData;
+    }
+    if ($this->iconData == ""){
+      $this->set_new_picture("");
+    }
+    $_SESSION['binary']                        = $this->iconData;
+    $_SESSION['binarytype']            = "image/jpeg";
+  }
+
+
+  function execute()
+  {
+    $smarty = get_smarty();
+
+    if(!$this->view_logged){
+      $this->view_logged =TRUE;
+      new log("view","mimetypes/".get_class($this),$this->dn);
+    }
+
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+    /* Base select dialog */
+    $once = true;
+    foreach($_POST as $name => $value){
+      if(preg_match("/^chooseBase/",$name) && $once){
+        $once = false;
+        $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
+        $this->dialog->setCurrentBase($this->base);
+      }
+    }
+
+    /* Dialog handling */
+    if(is_object($this->dialog)){
+
+      /* Must be called before save_object */
+      $this->dialog->save_object();
+
+      if($this->dialog->isClosed()){
+        $this->dialog = false;
+      }elseif($this->dialog->isSelected()){
+
+        /* A new base was selected, check if it is a valid one */
+        $tmp = $this->get_allowed_bases();
+        if(isset($tmp[$this->dialog->isSelected()])){
+          $this->base = $this->dialog->isSelected();
+        }
+
+        $this->dialog= false;
+      }else{
+        return($this->dialog->execute());
+      }
+    }
+
+    /* Check Posts */
+    $posts = array(    
+        "/^Pattern_SortUp_/"   => array("Action" => "Pattern_SortUp",  "Func" => "ArrayUp",    "Attr" => "use_gotoMimeFilePattern"),
+        "/^Pattern_SortDown_/"         => array("Action" => "Pattern_SortDown","Func" => "ArrayDown",  "Attr" => "use_gotoMimeFilePattern"),
+        "/^Pattern_Remove_/"   => array("Action" => "Pattern_Remove",  "Func" => "ArrayRemove","Attr" => "use_gotoMimeFilePattern"),
+        "/^Apps_SortUp_/"              => array("Action" => "Apps_SortUp",             "Func" => "ArrayUp",    "Attr" => "use_gotoMimeApplication"),
+        "/^Apps_SortDown_/"    => array("Action" => "Apps_SortDown",   "Func" => "ArrayDown",  "Attr" => "use_gotoMimeApplication"),
+        "/^Apps_Remove_/"              => array("Action" => "Apps_Remove",             "Func" => "ArrayRemove","Attr" => "use_gotoMimeApplication"),
+        "/^EApps_SortUp_/"             => array("Action" => "EApps_SortUp",    "Func" => "ArrayUp",    "Attr" => "use_gotoMimeEmbeddedApplication"),
+        "/^EApps_SortDown_/"   => array("Action" => "EApps_SortDown",  "Func" => "ArrayDown",  "Attr" => "use_gotoMimeEmbeddedApplication"),
+        "/^EApps_Remove_/"             => array("Action" => "EApps_Remove",    "Func" => "ArrayRemove","Attr" => "use_gotoMimeEmbeddedApplication"));          
+    $once = true;
+
+    /* Walk through posts and try to find some commands for us. */
+    foreach($_POST as $name => $value){
+
+      /* Walk through possible commands */
+      foreach($posts as $regex => $action){
+
+        /* Check if there is a command posted */
+        if(preg_match($regex,$name) && $once){
+          $once = false;
+
+          /* Get action vars */
+          $func                = $action['Func'];              // Get function name 
+          $attr                = $action['Attr'];              // Get attribute name
+
+          /* Get entry id */
+          $s_entry     = preg_replace($regex,"",$name);
+          $s_entry     = preg_replace("/_[xy]$/","",$s_entry); 
+
+          /* Execute a command with the given attribute and entry 
+             e.g. $this->gotoMimeFilePattern = $this->ArrayUp(3,$this->gotoMimeFilePattern) */
+          if($this->acl_is_writeable($attr)){
+            $this->$attr= $this->$func($s_entry,$this->$attr,true);                                     
+          }
+        }
+      }
+    }
+
+    /* Set a new icon was requested */
+    if(isset($_POST['update_icon']) && (isset($_FILES['picture_file']['name']))){
+      $this->set_new_picture($_FILES['picture_file']['tmp_name']);             
+    }
+
+    /* Add gotoMimeFilePattern */
+    if(isset($_POST['AddNewFilePattern']) && isset($_POST['NewFilePattern'])){
+      if($this->acl_is_writeable("gotoMimeFilePattern")){
+        $str = $_POST['NewFilePattern'];
+        if(!empty($str)){
+          $this->use_gotoMimeFilePattern[] = $str;
+        }
+      }
+    }  
+
+    /* Add gotoMimeFilePattern */
+    if(isset($_POST['AddNewApplication']) && 
+            (isset($_POST['NewApplication']) || isset($_POST['NewApplicationSelect']))){
+      if($this->acl_is_writeable("gotoMimeApplication")){
+        $str = "";
+        if(isset($_POST['NewApplicationSelect']) && !empty($_POST['NewApplicationSelect'])){
+          $str = get_post("NewApplicationSelect");
+        }
+        if(isset($_POST['NewApplication']) && !empty($_POST['NewApplication'])){
+          $str = get_post("NewApplication");
+        }
+        if(!empty($str) && !in_array($str,$this->use_gotoMimeApplication)){
+          $this->use_gotoMimeApplication[] = $str;
+        }
+      }
+    }  
+
+    /* Add embedded application 
+     *  - From input or from select box 
+     */
+    if(isset($_POST['AddNewEmbeddedApplication']) && 
+            (isset($_POST['NewEmbeddedApplication']) || isset($_POST['NewEmbeddedApplicationSelect']))){
+      if($this->acl_is_writeable("gotoMimeEmbeddedApplication")){
+        $str = "";
+        if(isset($_POST['NewEmbeddedApplicationSelect']) && !empty($_POST['NewEmbeddedApplicationSelect'])){
+          $str = get_post('NewEmbeddedApplicationSelect');
+        }
+        if(isset($_POST['NewEmbeddedApplication']) && !empty($_POST['NewEmbeddedApplication'])){
+          $str = get_post('NewEmbeddedApplication');
+        }
+        if(!empty($str) && !in_array($str,$this->use_gotoMimeEmbeddedApplication)){
+          $this->use_gotoMimeEmbeddedApplication[] = $str;
+        }
+      }
+    }  
+
+    /* Create divlists */
+    $DivPatterns       = new divSelectBox("gotoMimePatterns");
+    $DivApps           = new divSelectBox("gotoMimeApplications");
+    $DivEApps          = new divSelectBox("gotoMimeEmbeddedApplications");
+    $DivPatterns       -> SetHeight(100);
+    $DivApps           -> SetHeight(100);
+    $DivEApps          -> SetHeight(100);
+
+
+    if($this->acl_is_writeable("gotoMimeFilePattern")){
+      $Pattern_Actions= " <input type='image' src='images/sort_up.png'         class='center'  name='Pattern_SortUp_%s' >&nbsp;
+      <input type='image' src='images/sort_down.png'   class='center'  name='Pattern_SortDown_%s'>&nbsp;
+      <input type='image' src='images/edittrash.png'   class='center'  name='Pattern_Remove_%s'>";
+    }else{
+      $Pattern_Actions= "";    
+    }
+
+    if($this->acl_is_writeable("gotoMimeApplication")){
+      $Apps_Actions    = " <input type='image' src='images/sort_up.png'        class='center'  name='Apps_SortUp_%s' >&nbsp;
+      <input type='image' src='images/sort_down.png'   class='center'  name='Apps_SortDown_%s'>&nbsp;
+      <input type='image' src='images/edittrash.png'   class='center'  name='Apps_Remove_%s'>";
+    }else{
+      $Apps_Actions= "";       
+    }
+
+    if($this->acl_is_writeable("gotoMimeEmbeddedApplication")){
+      $EApps_Actions   = " <input type='image' src='images/sort_up.png'        class='center'  name='EApps_SortUp_%s' >&nbsp;
+      <input type='image' src='images/sort_down.png'   class='center'  name='EApps_SortDown_%s'>&nbsp;
+      <input type='image' src='images/edittrash.png'   class='center'  name='EApps_Remove_%s'>";
+    }else{
+      $EApps_Actions= "";      
+    }
+
+    /* Before adding some entries check acls */
+    if($this->acl_is_readable("gotoMimeFilePattern")){
+      foreach($this->use_gotoMimeFilePattern as $key => $pattern){
+        $field1 = array("string" => $pattern);
+        $field2 = array("string" => preg_replace("/%s/",$key,$Pattern_Actions),"attach"=>"style='border-right:0px;width:50px;'");
+        $fields = array($field1,$field2);
+        $DivPatterns -> AddEntry($fields);
+      }                        
+    }
+
+    if($this->acl_is_readable("gotoMimeApplication")){
+      foreach($this->use_gotoMimeApplication as $key => $pattern){
+        $field1 = array("string" => $pattern);
+        $field2 = array("string" => preg_replace("/%s/",$key,$Apps_Actions),"attach"=>"style='border-right:0px;width:50px;'");
+        $fields = array($field1,$field2);
+        $DivApps -> AddEntry($fields);
+      }                        
+    }                  
+    if($this->acl_is_readable("gotoMimeEmbeddedApplication")){
+      foreach($this->use_gotoMimeEmbeddedApplication as $key => $pattern){
+        $field1 = array("string" => $pattern);
+        $field2 = array("string" => preg_replace("/%s/",$key,$EApps_Actions),"attach"=>"style='border-right:0px;width:50px;'");
+        $fields = array($field1,$field2);
+        $DivEApps -> AddEntry($fields);
+      }
+    }                  
+    $smarty->assign("bases",                                           $this->get_allowed_bases());            
+    $smarty->assign("base_select",                                     $this->base);           
+    $smarty->assign("isReleaseMimeType",                       $this->isReleaseMimeType);
+    $smarty->assign("gotoMimeFilePatterns",                    $DivPatterns->DrawList());
+    $smarty->assign("gotoMimeApplications",                    $DivApps->DrawList());
+    $smarty->assign("gotoMimeEmbeddedApplications",    $DivEApps->DrawList());
+
+    $smarty->assign("ApplicationList",$this->ApplicationList);
+  
+    /* Assign class vars to smarty */
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr,$this->$attr);
+    }  
+
+    /* Assign additional vars that are not included in attributes*/
+    foreach(array("gotoMimeLeftClickAction_I","gotoMimeLeftClickAction_E","gotoMimeLeftClickAction_Q") as $attr){
+      $smarty->assign($attr,$this->$attr);
+    }  
+
+    /* Assign select box options */
+    $smarty->assign("gotoMimeGroups",$this->MimeGroups);
+    $smarty->assign("gotoMimeIcon"     ,$this->get_picture());
+    return($smarty->fetch(get_template_path("generic.tpl",TRUE,dirname(__FILE__))));
+  }
+
+
+  function save_object()
+  {
+    if(isset($_POST['MimeGeneric'])){
+
+      /* Create a base backup and reset the
+         base directly after calling plugin::save_object();
+         Base will be set seperatly a few lines below */
+      $base_tmp = $this->base;
+      plugin::save_object();
+      $this->base = $base_tmp;
+  
+      /* Only save base if we are not in release mode */
+      if(!$this->isReleaseMimeType){
+
+        /* Set new base if allowed */
+        $tmp = $this->get_allowed_bases();
+        if(isset($_POST['base'])){
+          if(isset($tmp[$_POST['base']])){
+            $this->base= $_POST['base'];
+          }
+        }
+
+      }
+
+      /* Save radio buttons */
+      if($this->acl_is_writeable("gotoMimeLeftClickAction")){
+        if(isset($_POST['gotoMimeLeftClickAction_IE'])){
+          $chr = $_POST['gotoMimeLeftClickAction_IE'];
+          if($chr == "E"){
+            $this->gotoMimeLeftClickAction_E = true;
+            $this->gotoMimeLeftClickAction_I = false;
+          }else{
+            $this->gotoMimeLeftClickAction_E = false;
+            $this->gotoMimeLeftClickAction_I = true;
+          }
+        }
+        if(isset($_POST['gotoMimeLeftClickAction_Q'])){
+          $this->gotoMimeLeftClickAction_Q = true;
+        }else{
+          $this->gotoMimeLeftClickAction_Q = false;
+        }
+      }
+    }
+  }
+
+
+  /* save current changes */
+  function save()
+  {
+    /* Create gotoMimeLeftClickAction out of checkboxes and radio buttons */   
+    $arr = array ("E","I","Q");
+    $str = "";
+    foreach ($arr as $Chr){
+      $var = "gotoMimeLeftClickAction_".$Chr;
+      if($this->$var){
+        $str .= $Chr;
+      }
+    }
+    $this->gotoMimeLeftClickAction = $str;
+
+    /* Create array entries with priority tag ( Test|3 )*/
+    foreach(array("gotoMimeEmbeddedApplication","gotoMimeApplication") as $attr){
+      $i                               = 0;
+      $use_attr                = "use_".$attr;
+      $tmp                     = array();
+      $this->$attr     = array();
+      foreach($this->$use_attr as $entry){
+        $tmp[] = $entry."|".$i ++;
+      }
+      $this->$attr = $tmp;
+    }
+
+    /* Create array entries */
+    foreach(array("gotoMimeFilePattern") as $attr){
+      $i                               = 0;
+      $use_attr                = "use_".$attr;
+      $tmp                     = array();
+      $this->$attr     = array();
+      foreach($this->$use_attr as $entry){
+        $tmp[] = $entry;
+      }
+      $this->$attr = $tmp;
+    }
+
+    /* Remove Icon if requested  */
+    if($this->use_gotoMimeIcon != "*removed*"){
+      $this->gotoMimeIcon = $this->iconData;
+    }else{
+      $this->gotoMimeIcon = "";
+    }
+
+    plugin::save();
+
+    /* If this is a newly created object, skip storing those 
+       attributes that contain an empty array */
+    if($this->orig_dn == "new"){
+      foreach(array("gotoMimeEmbeddedApplication","gotoMimeApplication","gotoMimeFilePattern") as $attr){
+        if(!count($this->$attr)){
+          unset($this->attrs[$attr]);
+        }
+      }
+    }
+
+    $ldap = $this->config->get_ldap_link();
+    $ldap-> cd ( $this->config->current['BASE']);
+    $ldap->cat($this->dn);
+    if($ldap->count()){
+      $ldap->cd($this->dn);
+      $this->cleanup();
+      $ldap->modify($this->attrs);
+      new log("modify","mimetypes/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
+      $ldap->cd($this->dn);
+      $ldap->add($this->attrs);
+      new log("create","mimetypes/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of mime type/generic with dn '%s' failed."),$this->dn));
+  }
+
+
+  /* Remove current mime type */
+  function remove_from_parent()
+  {
+    plugin::remove_from_parent();
+    $ldap = $this->config->get_ldap_link();
+    $ldap->rmDir($this->dn);
+    show_ldap_error($ldap->get_error(), sprintf(_("Removing of mime type/generic with dn '%s' failed."),$this->dn));
+    new log("remove","mimetypes/".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");
+
+    /* Delete references to object groups */
+    $ldap->cd ($this->config->current['BASE']);
+    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
+    while ($ldap->fetch()){
+      $og= new ogroup($this->config, $ldap->getDN());
+      unset($og->member[$this->dn]);
+      $og->save ();
+      show_ldap_error($ldap->get_error(), sprintf(_("Removing mime type from objectgroup '%s' failed"), $og->dn));
+    }
+  }
+
+
+  /* Check given values */
+  function check()
+  {
+    $message = plugin::check();
+    if(empty($this->cn)){
+      $message[] = _("Please specify a valid name for this mime type.");
+    }
+    if(!count($this->use_gotoMimeFilePattern)){
+      $message[] = _("Please specify at least one file pattern.") ;
+    }
+
+    /* Check if there is already a mime type with this cn */
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current["BASE"]);
+    if($this->isReleaseMimeType && (isset($_SESSION['mimefilter']['release']))){
+      $baseDn = str_replace($this->config->current['BASE'],$this->base,$_SESSION['mimefilter']['release']);
+      $baseDn = preg_replace("/ou=mime,.*/","ou=mime,".$this->base,$_SESSION['mimefilter']['release']);
+      $ldap->ls("(&(objectClass=gotoMimeType)(cn=".$this->cn."))",$baseDn,array("cn"));
+      if($ldap->count()){
+        $attrs = $ldap->fetch();
+        if($this->dn != $attrs['dn']) {
+          $message[]= _("There's already a mime type with this 'Name'.");
+        }
+      }
+    }else{
+      $ldap->ls("(&(objectClass=gotoMimeType)(cn=".$this->cn."))","ou=mime,".$this->base,array("cn"));
+      if ($ldap->count()){
+        $attrs = $ldap->fetch();
+        if($this->dn != $attrs['dn']) {
+          $message[]= _("There's already an mime with this 'Name'.");
+        }
+      }
+    }
+
+    return($message);
+  }
+
+  /** Helper functions **/
+
+  /* Set a new picture */      
+  function set_new_picture($filename)
+  {
+    if (empty($filename)){
+      $filename= "./images/default_icon.png";
+      $this->use_gotoMimeIcon= "*removed*";
+    }else{
+      $this->use_gotoMimeIcon= $filename;
+    }
+
+    if (file_exists($filename)){
+      $fd = fopen ($filename, "rb");
+      $this->iconData= fread ($fd, filesize ($filename));
+      $_SESSION['binary']= $this->iconData;
+      $_SESSION['binarytype']= "image/jpeg";
+      fclose ($fd);
+    }
+  }
+
+  /* Get picture link */
+  function get_picture()
+  {
+    $_SESSION['binary']= $this->iconData;
+    $_SESSION['binarytype']= "image/jpeg";
+    return("getbin.php");
+  }
+
+  /* Transports the given 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 given Arraykey one position down*/
+  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);
+  }
+
+
+  /* return the position of the element in the array */
+  function getpos($atr,$attrs)
+  {
+    $i = 0;
+    foreach($attrs as $attr => $name)    {
+      $i++;
+      if($attr == $atr){
+        return($i);
+      }
+    }
+    return(-1);
+  }
+
+
+  /* Remove this element from array */
+  function ArrayRemove($key,$array,$reorder = false)   
+  {
+    if(isset($array[$key])){
+      unset($array[$key]);
+      if($reorder){
+        $tmp = array();
+        foreach($array as $entry){
+          $tmp[] = $entry;
+        }
+        $array = $tmp;
+      }
+    }  
+    return($array);
+  }
+
+
+  /* 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);
+  }
+
+
+  /* Return a dialog with all fields that must be changed, 
+     if we want to copy this entry */
+  function getCopyDialog()
+  {
+    $str = "";
+
+    $smarty = get_smarty();
+    $smarty->assign("cn",              $this->cn);
+    $smarty->assign("description",  $this->description);
+    $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE,dirname(__FILE__)));
+
+    $ret = array();
+    $ret['string'] = $str;
+    $ret['status'] = "";
+    return($ret);
+  }
+
+
+  /* Save all */
+  function saveCopyDialog()
+  {
+    $attrs = array("cn","description");
+    foreach($attrs as $attr){
+      if(isset($_POST[$attr])){
+        $this->$attr = $_POST[$attr];
+      }
+    }
+  }
+
+  /* Return plugin informations for acl handling  */ 
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Generic"),
+          "plDescription" => _("Mime type generic"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 0,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("mimetypes" => array("description"  => _("Mime types"),
+                                                        "objectClass"  => "gotoMimeType")),
+          "plProvidedAcls"=> array(
+            "cn"                          => _("Name"),
+            "gotoMimeGroup"               => _("Mime group"),
+            "description"                 => _("Description"),
+            "base"                        => _("Base"),
+            "gotoMimeApplication"         => _("Application"),
+            "gotoMimeLeftClickAction"     => _("Left click action"),
+            "gotoMimeIcon"                => _("Icon"),
+            "gotoMimeFilePattern"         => _("File patterns"),
+            "gotoMimeEmbeddedApplication" => _("Embedded applications"))
+          ));
+
+  }
+
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);
+
+    $source_o = new mimetype($this->config,$source['dn'],$this->parent);
+
+    foreach(array("gotoMimeLeftClickAction_Q","gotoMimeEmbeddedApplication","gotoMimeApplication","gotoMimeFilePattern","gotoMimeIcon","iconData") as $name){
+      $use_attr     = "use_".$name;
+      if(isset($this->$use_attr)){
+        $this->$use_attr= $source_o->$use_attr;
+      }
+      $this->$name = $source_o->$name;
+    } 
+    foreach($this->attributes as $name){
+      $this->$name = $source_o->$name;
+    }
+
+    if($this->iconData){
+      $this->use_gotoMimeIcon ="Not emtpy, causes icon to be written.";
+    }
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/mimetypes/class_mimetypeManagement.inc b/gosa-core/plugins/admin/mimetypes/class_mimetypeManagement.inc
new file mode 100755 (executable)
index 0000000..5cd9c15
--- /dev/null
@@ -0,0 +1,664 @@
+<?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 mimetypeManagement extends plugin
+{
+  /* Definitions */
+  var $plHeadline     = "Mime types";
+  var $plDescription  = "Manage mime types";
+
+  /* Dialog attributes */
+  var $ui                             = NULL;
+  var $DivListMimeTypes               = NULL;
+  var $enableReleaseManagement        = false;
+  var $mimetabs                       = NULL;
+  var $snapDialog                     = NULL;
+  var $CopyPasteHandler               = NULL;
+  var $start_pasting_copied_objects = FALSE;
+
+
+  function mimetypeManagement (&$config, &$ui)
+  {
+    /* Save configuration for internal use */
+    $this->config   = &$config;
+    $this->ui       = &$ui;
+
+    /* Check if copy & paste is activated */
+    if($this->config->boolValueIsTrue("MAIN","ENABLECOPYPASTE")){
+      $this->CopyPasteHandler = new CopyPasteHandler($this->config);
+    }
+
+    /* Creat dialog object */
+    $this->DivListMimeTypes = new divListMimeTypes($this->config,$this);
+
+    if($this->IsReleaseManagementActivated()){
+
+      /* Check if we should enable the release selection */
+      $this->enableReleaseManagement = true;
+
+      /* Hide SubSearch checkbox */
+      $this->DivListMimeTypes->DisableCheckBox("SubSearch");
+    }
+
+  }
+
+
+  /* Get all releases */
+  function getReleases($base)
+  {
+    $ldap                   = $this->config->get_ldap_link();
+    $dn                     = "ou=mime,".$base;
+    $ret                    = array();
+    $ret ["ou=mime,".$base] = "/";    
+
+    $ldap->cd($dn);
+    $ldap->search("objectClass=organizationalUnit",array("ou"));
+
+    while($attrs = $ldap->fetch()){
+      $str = str_replace($dn,"",$attrs['dn']);
+      $tmp = array_reverse( split("ou=",$str));
+      $str = "";
+      foreach($tmp as $val){
+        $val = trim(preg_replace("/,/","",$val));
+        if(empty($val)) break;
+        $str .= "/".$val;
+      } 
+      if(!empty($str)){
+        $ret[$attrs['dn']]= preg_replace("/^\//","",$str);
+      }
+    }
+    asort($ret);
+    return($ret);
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+
+    /**************** 
+      Variable init 
+     ****************/
+
+    /* These vars will be stored if you try to open a locked mime, 
+        to be able to perform your last requests after showing a warning message */
+    $_SESSION['LOCK_VARS_TO_USE'] = array("/^act$/","/^id$/","/^mime_edit_/","/^mime_del_/","/^item_selected/","/^remove_multiple_mimetypes/");
+
+    $smarty       = get_smarty();             // Smarty instance
+    $s_action     = "";                       // Contains the action to proceed
+    $s_entry      = "";                       // The value for s_action
+    $base_back    = "";                       // The Link for Backbutton
+    
+    /* Test Posts */
+    foreach($_POST as $key => $val){
+      // Post for delete
+      if(preg_match("/mime_del.*/",$key)){
+        $s_action = "del";
+        $s_entry  = preg_replace("/mime_".$s_action."_/i","",$key);
+        // Post for edit
+      }elseif(preg_match("/mime_edit_.*/",$key)){
+        $s_action="edit";
+        $s_entry  = preg_replace("/mime_".$s_action."_/i","",$key);
+        // Post for new
+      }elseif(preg_match("/^copy_.*/",$key)){
+        $s_action="copy";
+        $s_entry  = preg_replace("/^copy_/i","",$key);
+      }elseif(preg_match("/^cut_.*/",$key)){
+        $s_action="cut";
+        $s_entry  = preg_replace("/^cut_/i","",$key);
+        // Post for new
+      }elseif(preg_match("/^mime_new.*/",$key)){
+        $s_action="new";
+      }elseif(preg_match("/^remove_multiple_mimetypes/",$key)){
+        $s_action="del_multiple";
+      }elseif(preg_match("/^editPaste.*/i",$key)){
+        $s_action="editPaste";
+      }elseif(preg_match("/^multiple_copy_mimetypes/",$key)){
+        $s_action = "copy_multiple";
+      }elseif(preg_match("/^multiple_cut_mimetypes/",$key)){
+        $s_action = "cut_multiple";
+      }
+    }
+
+    if((isset($_GET['act']))&&($_GET['act']=="edit_entry")){
+      $s_action ="edit";
+      $s_entry  = $_GET['id'];
+    }
+
+    $s_entry  = preg_replace("/_.$/","",$s_entry);
+
+
+    /* handle C&P from layers menu */
+    if(isset($_POST['menu_action']) && preg_match("/^multiple_copy_systems/",$_POST['menu_action'])){
+      $s_action = "copy_multiple";
+    }
+    if(isset($_POST['menu_action']) && preg_match("/^multiple_cut_systems/",$_POST['menu_action'])){
+      $s_action = "cut_multiple";
+    }
+    if(isset($_POST['menu_action']) && preg_match("/^editPaste/",$_POST['menu_action'])){
+      $s_action = "editPaste";
+    }
+
+    /* Create options */
+    if(isset($_POST['menu_action']) && $_POST['menu_action'] == "mime_new"){
+      $s_action = "new";
+    }
+
+    /* handle remove from layers menu */
+    if(isset($_POST['menu_action']) && preg_match("/^remove_multiple/",$_POST['menu_action'])){
+      $s_action = "del_multiple";
+    }
+
+    /**************** 
+      Copy & Paste handling  
+     ****************/
+
+    /* Display the copy & paste dialog, if it is currently open */
+    $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
+    if($ret){
+      return($ret);
+    }
+
+
+    /**************** 
+      Create a new mime type 
+     ****************/
+
+    /* New mime type? */
+    $ui = get_userinfo();
+    $acl = $ui->get_permissions($this->DivListMimeTypes->selectedBase,"mimetypes/mimetype");
+    if (($s_action=="new") && preg_match("/c/",$acl)){
+
+      /* By default we set 'dn' to 'new', all relevant plugins will
+         react on this. */
+      $this->dn= "new";
+
+      /* Create new usertab object */
+      $this->mimetabs= new mimetabs($this->config, $this->config->data['TABS']['MIMETABS'], $this->dn,"mimetypes");
+      $this->mimetabs->set_acl_base($this->DivListMimeTypes->selectedBase);
+    }   
+
+
+    /**************** 
+      Edit entry canceled 
+     ****************/
+
+    /* Cancel dialogs */
+    if (isset($_POST['edit_cancel'])){
+      del_lock ($this->mimetabs->dn);
+      unset ($this->mimetabs);
+      $this->mimetabs= NULL;
+      unset ($_SESSION['objectinfo']);
+    }
+
+
+    /**************** 
+      Edit entry finished 
+     ****************/
+
+    /* Finish mime edit is triggered by the tabulator dialog, so
+       the user wants to save edited data. Check and save at this point. */
+    if ((isset($_POST['edit_finish']) || isset($_POST['edit_apply']) ) && (isset($this->mimetabs->config))){
+
+      /* Check tabs, will feed message array */
+      $this->mimetabs->save_object();
+      $message= $this->mimetabs->check();
+
+      /* Save, or display error message? */
+      if (count($message) == 0){
+
+        /* Save data data to ldap */
+        $this->mimetabs->set_release($this->DivListMimeTypes->selectedRelease);
+        $this->mimetabs->save();
+
+        if (!isset($_POST['edit_apply'])){
+          /* Mime type has been saved successfully, remove lock from LDAP. */
+          if ($this->dn != "new"){
+            del_lock ($this->dn);
+          }
+          unset ($this->mimetabs);
+          $this->mimetabs= NULL;
+          unset ($_SESSION['objectinfo']);
+        }
+      } else {
+        /* Ok. There seem to be errors regarding to the tab data,
+           show message and continue as usual. */
+        show_errors($message);
+      }
+    }
+
+
+    /**************** 
+      Edit entry  
+     ****************/
+
+    /* User wants to edit data? */
+    if (($s_action=="edit") && (!isset($this->mimetabs->config))){
+
+      /* Get 'dn' from posted 'mimelist', must be unique */
+      $this->dn= $this->mimetypes[$s_entry]['dn'];
+
+      /* Check locking, save current plugin in 'back_plugin', so
+         the dialog knows where to return. */
+      if (($user= get_lock($this->dn)) != ""){
+        return(gen_locked_message ($user, $this->dn));
+      }
+
+      /* Lock the current entry, so everyone will get the
+         above dialog */
+      add_lock ($this->dn, $this->ui->dn);
+
+
+      /* Register mimetabs to trigger edit dialog */
+      $this->mimetabs= new mimetabs($this->config,$this->config->data['TABS']['MIMETABS'], $this->dn,"mimetypes");
+      $this->mimetabs->set_acl_base($this->dn);
+      $_SESSION['objectinfo']= $this->dn;
+    }
+
+
+    /********************
+      Delete MULTIPLE entries requested, display confirm dialog
+     ********************/
+
+    if ($s_action=="del_multiple"){
+      $ids = $this->list_get_selected_items();
+
+      $this->dns = array();
+      if(count($ids)){
+
+        foreach($ids as $id){
+          $dn = $this->mimetypes[$id]['dn'];
+          if (($user= get_lock($dn)) != ""){
+            return(gen_locked_message ($user, $dn));
+          }
+          $this->dns[$id] = $dn;
+        }
+
+        $dns_names = "<br><pre>";
+        foreach($this->dns as $dn){
+          add_lock ($dn, $this->ui->dn);
+          $dns_names .= $dn."\n";
+        }
+        $dns_names .="</pre>";
+
+        /* Lock the current entry, so nobody will edit it during deletion */
+        if (count($this->dns) == 1){
+          $smarty->assign("intro",     sprintf(_("You're about to delete the following entry %s"), @LDAP::fix($dns_names)));
+        } else {
+          $smarty->assign("intro",     sprintf(_("You're about to delete the following entries %s"), @LDAP::fix($dns_names)));
+        }
+        $smarty->assign("multiple", true);
+        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+      }
+    }
+
+
+
+
+    /********************
+      Delete MULTIPLE entries confirmed
+     ********************/
+
+    /* Confirmation for deletion has been passed. Users should be deleted. */
+    if (isset($_POST['delete_multiple_mimetype_confirm'])){
+
+      $ui = get_userinfo();
+
+      /* Remove user by user and check acls before removeing them */
+      foreach($this->dns as $key => $dn){
+
+        $acl = $ui->get_permissions($dn,"mimetypes/mimetype");
+        if(preg_match("/d/",$acl)){
+
+          /* Delete request is permitted, perform LDAP action */
+          $this->mimetabs= new mimetabs($this->config, $this->config->data['TABS']['MIMETABS'], $dn,"mimetypes");
+          $this->mimetabs->set_acl_base($dn);
+          $this->mimetabs->delete ();
+          unset ($this->mimetabs);
+          $this->mimetabs= NULL;
+
+        } else {
+          /* Normally this shouldn't be reached, send some extra
+             logs to notify the administrator */
+          print_red (_("You are not allowed to delete this mime type!"));
+          new log("security","mimetypes/".get_class($this),$dn,array(),"Tried to trick deletion.");
+        }
+        /* Remove lock file after successfull deletion */
+        del_lock ($dn);
+        unset($this->dns[$key]);
+      }
+    }
+
+
+    /********************
+      Delete MULTIPLE entries Canceled
+     ********************/
+
+    /* Remove lock */
+    if(isset($_POST['delete_multiple_mimetype_cancel'])){
+      foreach($this->dns as $key => $dn){
+        del_lock ($dn);
+        unset($this->dns[$key]);
+      }
+    }
+
+
+    /**************** 
+      Delete mime type 
+     ****************/
+
+    /* Remove user was requested */
+    if ($s_action == "del"){
+
+      /* Get 'dn' from posted 'uid' */
+      $this->dn= $this->mimetypes[$s_entry]['dn'];
+
+      /* Load permissions for selected 'dn' and check if
+         we're allowed to remove this 'dn' */
+      $ui = get_userinfo();
+      $acl = $ui->get_permissions($this->dn,"mimetypes/mimetype");
+      if (preg_match("/d/",$acl)){
+
+        /* Check locking, save current plugin in 'back_plugin', so
+           the dialog knows where to return. */
+        if (($user= get_lock($this->dn)) != ""){
+          return (gen_locked_message ($user, $this->dn));
+        }
+
+        /* Lock the current entry, so nobody will edit it during deletion */
+        add_lock ($this->dn, $this->ui->dn);
+        $smarty= get_smarty();
+        $smarty->assign("intro", sprintf(_("You're about to delete the mime type '%s'."), @LDAP::fix($this->dn)));
+        $smarty->assign("multiple", false);
+        return($smarty->fetch (get_template_path('remove.tpl', TRUE)));
+      } else {
+
+        /* Obviously the user isn't allowed to delete. Show message and
+           clean session. */
+        print_red (_("You are not allowed to delete this mime type!"));
+      }
+    }
+
+
+    /**************** 
+      Delete mime confirmed 
+     ****************/
+
+    /* Confirmation for deletion has been passed. Group should be deleted. */
+    if (isset($_POST['delete_mime_confirm'])){
+
+      /* Some nice guy may send this as POST, so we've to check
+         for the permissions again. */
+      $ui = get_userinfo();
+      $acl = $ui->get_permissions($this->dn,"mimetypes/mimetype");
+      if(preg_match("/d/",$acl)){
+
+        /* Delete request is permitted, perform LDAP action */
+        $this->mimetabs= new mimetabs($this->config, $this->config->data['TABS']['MIMETABS'], $this->dn,"mimetypes");
+        $this->mimetabs->set_acl_base($this->dn);
+        $this->mimetabs->delete ();
+        unset ($this->mimetabs);
+        $this->mimetabs= NULL;
+
+      } else {
+
+        /* Normally this shouldn't be reached, send some extra
+           logs to notify the administrator */
+        print_red (_("You are not allowed to delete this mime type!"));
+        new log("security","mimetypes/".get_class($this),$dn,array(),"Tried to trick deletion.");
+      }
+
+      /* Remove lock file after successfull deletion */
+      del_lock ($this->dn);
+    }
+
+
+    /**************** 
+      Delete mime canceled 
+     ****************/
+
+    /* Delete mime type canceled? */
+    if (isset($_POST['delete_cancel'])){
+      del_lock ($this->dn);
+      unset($_SESSION['objectinfo']);
+    }
+
+    /* Show tab dialog if object is present */
+    if (($this->mimetabs) && (isset($this->mimetabs->config))){
+      $display= $this->mimetabs->execute();
+
+      /* Don't show buttons if tab dialog requests this */
+      if (!$this->mimetabs->by_object[$this->mimetabs->current]->dialog){
+        $display.= "<p style=\"text-align:right\">\n";
+        $display.= "<input type=\"submit\" name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
+        $display.= "&nbsp;\n";
+        if ($this->dn != "new"){
+          $display.= "<input type=submit name=\"edit_apply\" value=\""._("Apply")."\">\n";
+          $display.= "&nbsp;\n";
+        }
+        $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+        $display.= "</p>";
+      }
+      return ($display);
+    }
+
+
+    /****************
+      Dialog display
+     ****************/
+
+        /* Check if there is a snapshot dialog open */
+    $base = $this->DivListMimeTypes->selectedBase;
+    if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases())){
+      return($str);
+    }
+
+    /* Display dialog with system list */
+    $this->DivListMimeTypes->parent = $this;
+    $this->DivListMimeTypes->execute();
+    $this->DivListMimeTypes->AddDepartments($this->DivListMimeTypes->selectedBase,3,1);
+    $this->reload();
+    $this->DivListMimeTypes->setEntries($this->mimetypes);
+    return($this->DivListMimeTypes->Draw());
+  }
+
+    
+  /* Return departments, that will be included within snapshot detection */
+  function get_used_snapshot_bases()
+  {
+    return(array($this->DivListMimeTypes->selectedRelease));
+  }
+
+
+
+  function reload()
+  {
+    $this->mimetypes= array();
+
+    /* Set base for all searches */
+    $base       = $this->DivListMimeTypes->selectedBase;
+    $release    = $this->DivListMimeTypes->selectedRelease;
+    $Regex      = $this->DivListMimeTypes->Regex;
+    $SubSearch  = $this->DivListMimeTypes->SubSearch; 
+    $Flags      =  GL_NONE | GL_SIZELIMIT;
+    $Filter     = "(&(|(cn=".$Regex.")(description=".$Regex."))(objectClass=gotoMimeType))";
+    $tmp        = array();
+    $Releases   = $this->getReleases($base);
+
+
+    /* If release management is enabled, use release as base. */
+    if(!$this->enableReleaseManagement){
+      $use_base = $base;
+    }else{
+      if(isset($Releases[$release])){
+        $use_base  = $release;
+      }else{
+        $use_base  = $base;
+      }
+    }
+
+    /* In case of subsearch, add the subsearch flag */
+    if($SubSearch){
+      $Flags    |= GL_SUBSEARCH;  
+    }else{
+      if(!$this->enableReleaseManagement){
+        $use_base ="ou=mime,".$use_base;
+      }
+    }
+  
+    /* Get results and create index */ 
+    $res= get_list($Filter, "mimetypes", $use_base, array("cn","description","dn","objectClass"), $Flags);
+    foreach ($res as $val){
+      $tmp[strtolower($val['cn'][0]).$val['cn'][0].$val['dn']]=$val;
+    }
+
+    /* sort entries */
+    ksort($tmp);
+    $this->mimetypes=array();
+    foreach($tmp as $val){
+      $this->mimetypes[]=$val;
+    }
+    reset ($this->mimetypes);
+  }
+
+  function remove_from_parent()
+  {
+    /* Optionally execute a command after we're done */
+    $this->postremove();
+  }
+
+
+  function copyPasteHandling_from_queue($s_action,$s_entry)
+  {
+    /* Check if Copy & Paste is disabled */
+    if(!is_object($this->CopyPasteHandler)){
+      return("");
+    }
+
+    /* Add a single entry to queue */
+    if($s_action == "cut" || $s_action == "copy"){
+
+      /* Cleanup object queue */
+      $this->CopyPasteHandler->cleanup_queue();
+      $this->start_pasting_copied_objects = FALSE;
+      $dn = $this->mimetypes[$s_entry]['dn'];
+      $this->CopyPasteHandler->add_to_queue($dn,$s_action,"mimetabs","MIMETABS","mimetypes");
+    }
+
+    /* Add entries to queue */
+    if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
+
+      /* Cleanup object queue */
+      $this->CopyPasteHandler->cleanup_queue();
+      $this->start_pasting_copied_objects = FALSE;
+  
+      /* Add new entries to CP queue */
+      foreach($this->list_get_selected_items() as $id){
+        $dn = $this->mimetypes[$id]['dn'];
+
+        if($s_action == "copy_multiple"){
+          $this->CopyPasteHandler->add_to_queue($dn,"copy","mimetabs","MIMETABS","mimetypes");
+        }
+        if($s_action == "cut_multiple"){
+          $this->CopyPasteHandler->add_to_queue($dn,"cut","mimetabs","MIMETABS","mimetypes");
+        }
+      }
+    }
+
+    /* Start pasting entries */
+    if($s_action == "editPaste"){
+      $this->start_pasting_copied_objects = TRUE;
+    }
+
+    /* Return C&P dialog */
+    if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
+
+      /* Load entry from queue and set base */
+      $this->CopyPasteHandler->load_entry_from_queue();
+      $this->CopyPasteHandler->SetVar("base",$this->DivListMimeTypes->selectedBase);
+
+      /* Get dialog */
+      $data = $this->CopyPasteHandler->execute();
+
+      /* Return dialog data */
+      if(!empty($data)){
+        return($data);
+      }
+    }
+
+    /* Automatically disable status for pasting */
+    #if(!$this->CopyPasteHandler->entries_queued()){
+    #  $this->start_pasting_copied_objects = FALSE;
+    #}
+    return("");
+  }
+
+
+  /* Check if the release management is activated. */
+  function IsReleaseManagementActivated()
+  {
+    /* Check if we should enable the release selection */
+    $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
+    if(!empty($tmp)){
+      return(true);
+    }
+    return(false);
+  }
+
+
+  function list_get_selected_items()
+  {
+    $ids = array();
+    foreach($_POST as $name => $value){
+      if(preg_match("/^item_selected_[0-9]*$/",$name)){
+        $id   = preg_replace("/^item_selected_/","",$name);
+        $ids[$id] = $id;
+      }
+    }
+    return($ids);
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    /* Optionally execute a command after we're done */
+    $this->postcreate();
+  }
+
+  function remove_lock()
+  {
+    if (isset($this->mimetabs->dn)){
+      del_lock ($this->mimetabs->dn);
+    }
+  }
+
+  function save_object() {
+    $this->DivListMimeTypes->save_object();
+  }
+
+  function check() {}
+  function adapt_from_template($dn) {}
+  function password_change_needed() {}
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/mimetypes/generic.tpl b/gosa-core/plugins/admin/mimetypes/generic.tpl
new file mode 100644 (file)
index 0000000..1cb6d75
--- /dev/null
@@ -0,0 +1,199 @@
+<table style="width:100%">
+       <tr>
+               <td colspan="2">
+                       <h2><img src='images/list_mime.png' class='center' alt='[M]'>&nbsp;{t}Generic{/t}</h2>
+               </td>
+       </tr>
+       <tr>
+               <td style='width:50%; vertical-align:top;' >
+                       <table>
+                               <tr>
+                                       <td>
+                                               {t}Mime type{/t}{$must}
+                                       </td>
+                                       <td>
+{render acl=$gotoMimeGroupACL}
+                                               <input type="text" name='cn' value="{$cn}" title='{t}Please enter a name for the mime type here{/t}'>
+{/render}
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>
+                                               {t}Mime group{/t}
+                                       </td>
+                                       <td>
+{render acl=$gotoMimeGroupACL}
+                                               <select name='gotoMimeGroup' title='{t}Categorize this mime type{/t}'>
+                                                       {html_options output=$gotoMimeGroups values=$gotoMimeGroups selected=$gotoMimeGroup}
+                                               </select>
+{/render}
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>
+                                               {t}Description{/t}
+                                       </td>
+                                       <td>
+{render acl=$descriptionACL}
+                                               <input type="text" name='description' value="{$description}" title='{t}Please specify a description{/t}'>
+{/render}
+                                       </td>
+                               </tr>
+{if !$isReleaseMimeType} 
+                               <tr>
+                                       <td><LABEL for="base">{t}Base{/t}{$must}</LABEL></td>
+                                       <td>
+       {render acl=$baseACL}
+               <select size="1" id="base" name="base" title="{t}Choose subtree to place application in{/t}">
+                       {html_options options=$bases selected=$base_select}
+               </select>
+       {/render}
+       {if !$isReleaseMimeType}
+               {render acl=$baseACL disable_picture='images/folder_gray.png'}
+                       <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
+               {/render}
+       {/if}
+                                       </td>
+                                </tr>
+
+{/if}
+                       </table>
+                       
+               </td>
+               <td style="border-left:1px solid #A0A0A0;vertical-align:top;">
+                       <table summary="">
+                               <tr>
+                                       <td>
+                                               <LABEL for="picture_file">{t}Icon{/t}</LABEL><br>
+                                               <img src="{$gotoMimeIcon}" border=1 alt='{t}Mime icon{/t}' 
+                                                       style="width:48px; height:48; background-color:white; vertical-align:bottom;">
+                                       </td>
+                                       <td style="vertical-align:top">
+                                               &nbsp;<br>
+                                               <input type="hidden" name="MAX_FILE_SIZE" value="100000">
+{render acl=$gotoMimeIconACL}
+                                               <input name="picture_file" type="file" size="20" maxlength="255" 
+                                                       accept="image/*.png" id="picture_file">
+{/render}
+{render acl=$gotoMimeIconACL}
+                                               <input type="submit" name="update_icon" value="{t}Update{/t}" 
+                                                       title="{t}Update mime type icon{/t}">
+{/render}
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+       </tr>
+       <tr>
+               <td colspan="2">
+                       <p class='seperator'>&nbsp;</p>
+               </td>
+       </tr>
+       <tr>
+               <td colspan="2">
+                       <h2><img src='images/mime_leftclick.png' class='center' alt='{t}Left click{/t}'>&nbsp;{t}Left click{/t}</h2>
+               </td>
+       </tr>
+       <tr>
+               <td style='width:50%; vertical-align:top;' >
+                       {t}File patterns{/t}{$must}
+{render acl=$gotoMimeFilePatternACL}   
+                       {$gotoMimeFilePatterns} 
+{/render}
+
+{render acl=$gotoMimeFilePatternACL}   
+                       <input type='text'       name='NewFilePattern'    value='' title='{t}Please specify a new file pattern{/t}'>
+{/render}
+{render acl=$gotoMimeFilePatternACL}   
+                       <input type='submit' name='AddNewFilePattern' value='{t}Add{/t}' title='{t}Add a new file pattern{/t}'>
+{/render}
+               </td>
+               <td style="border-left:1px solid #A0A0A0;vertical-align:top;">
+                       {t}Applications{/t}
+{render acl=$gotoMimeApplicationACL}   
+                       {$gotoMimeApplications}         
+{/render}
+
+{render acl=$gotoMimeApplicationACL}   
+                       <select name="NewApplicationSelect">
+                               <option value="">-</option>
+                               {html_options options=$ApplicationList}
+                       </select>
+{/render}
+{render acl=$gotoMimeApplicationACL}   
+                       <input type='text'       name='NewApplication'    value='' title='{t}Enter an application name here{/t}'>
+{/render}
+{render acl=$gotoMimeApplicationACL}   
+                       <input type='submit' name='AddNewApplication' value='{t}Add{/t}' title='{t}Add application{/t}'>
+{/render}
+               </td>
+       </tr>
+       <tr>    
+               <td colspan="2">
+                       <p class='seperator'>&nbsp;</p>
+               </td>
+       </tr>
+       <tr>    
+               <td colspan="2">
+                       <h2><img src='images/mime_embedding.png' class='center' alt='{t}Embedding{/t}'>&nbsp;{t}Embedding{/t}</h2>
+               </td>
+       </tr>
+       <tr>
+               <td style='width:50%; vertical-align:top;' >
+                               
+                       <table>
+                               <tr>
+                                       <td style='vertical-align:top; '>
+{render acl=$gotoMimeLeftClickActionACL}
+                                               <input type='radio' name='gotoMimeLeftClickAction_IE' value='I' 
+                                                       {if $gotoMimeLeftClickAction_I} checked {/if}>
+{/render}
+                                               {t}Show file in embedded viewer{/t}
+                                               <br>
+
+{render acl=$gotoMimeLeftClickActionACL}
+                                               <input type='radio' name='gotoMimeLeftClickAction_IE' value='E' 
+                                                       {if $gotoMimeLeftClickAction_E} checked {/if}>
+{/render}
+                                               {t}Show file in external viewer{/t}
+                                               <br>
+
+{render acl=$gotoMimeLeftClickActionACL}
+                                               <input type='checkbox' name='gotoMimeLeftClickAction_Q' value='1' 
+                                                       {if $gotoMimeLeftClickAction_Q} checked {/if}>
+{/render}
+                                               {t}Ask whether to save to local disk{/t}
+                                       </td>
+                               </tr>
+                       </table>
+                       
+               </td>
+               <td style="border-left:1px solid #A0A0A0;vertical-align:top;">
+                       {t}Applications{/t}
+{render acl=$gotoMimeEmbeddedApplicationACL}
+                       {$gotoMimeEmbeddedApplications}         
+{/render}
+{render acl=$gotoMimeEmbeddedApplicationACL}
+                       <select name="NewEmbeddedApplicationSelect">
+                               <option value="">-</option>
+                               {html_options options=$ApplicationList}
+                       </select>
+{/render}
+{render acl=$gotoMimeEmbeddedApplicationACL}
+                       <input type='text'       name='NewEmbeddedApplication'    value='' 
+                               title='{t}Enter an application name here{/t}'>
+{/render}
+{render acl=$gotoMimeEmbeddedApplicationACL}
+                       <input type='submit' name='AddNewEmbeddedApplication' value='{t}Add{/t}' 
+                               title='{t}Add application{/t}'>
+{/render}
+               </td>
+       </tr>
+</table>
+<input type="hidden" name="MimeGeneric" value="1">
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('cn');
+  -->
+</script>
diff --git a/gosa-core/plugins/admin/mimetypes/main.inc b/gosa-core/plugins/admin/mimetypes/main.inc
new file mode 100755 (executable)
index 0000000..1595f18
--- /dev/null
@@ -0,0 +1,57 @@
+<?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
+ */
+
+if ($remove_lock){
+               if(isset($_SESSION['MimeTypeManagement'])){
+                               $MimeTypeManagement= $_SESSION['MimeTypeManagement'];
+                               $MimeTypeManagement->remove_lock();
+                               del_lock ($ui->dn);
+                               sess_del ('MimeTypeManagement');
+               }
+} else {
+
+               /* Create MimeTypeManagement object on demand */
+               if (!isset($_SESSION['MimeTypeManagement']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+                               $_SESSION['MimeTypeManagement']= new mimetypeManagement ($config, $_SESSION['ui']);
+               }
+
+               /* Get object */
+               $MimeTypeManagement= $_SESSION['MimeTypeManagement'];
+               $MimeTypeManagement->save_object();
+               $output= $MimeTypeManagement->execute();
+
+               /* Page header*/
+               if (isset($_SESSION['objectinfo'])){
+                               $display= print_header(get_template_path('images/mimetypes.png'), _("Mimetype management"), "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".@LDAP::fix($_SESSION['objectinfo']));
+               } else {
+                               $display= print_header(get_template_path('images/mimetypes.png'), _("Mimetype management"));
+               }
+
+               /* Reset requested? */
+               if (isset($_GET['reset']) && $_GET['reset'] == 1){
+                               del_lock ($ui->dn);
+                               sess_del ('MimeTypeManagement');
+               }
+
+               /* Show and save dialog */
+               $display.= $output;
+               $_SESSION['MimeTypeManagement']= $MimeTypeManagement;
+}
+?>
diff --git a/gosa-core/plugins/admin/mimetypes/paste_generic.tpl b/gosa-core/plugins/admin/mimetypes/paste_generic.tpl
new file mode 100644 (file)
index 0000000..34b5e07
--- /dev/null
@@ -0,0 +1,31 @@
+<table style="width:100%">
+       <tr>
+               <td colspan="2">
+                       <h2><img src='images/head.png' class='center'>&nbsp;{t}Generic{/t}</h2>
+               </td>
+       </tr>
+       <tr>
+               <td style='width:50%; vertical-align:top;' >
+                               
+                       <table>
+                               <tr>
+                                       <td>
+                                               {t}Mime type{/t}
+                                       </td>
+                                       <td>
+                                               <input type="text" name='cn' value="{$cn}" title='{t}Please enter a name for the mime type here{/t}'>
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>
+                                               {t}Description{/t}
+                                       </td>
+                                       <td>
+                                               <input type="text" name='description' value="{$description}" title='{t}Please specify a description for this mime type here{/t}'>
+                                       </td>
+                               </tr>
+                       </table>
+                       
+               </td>
+       </tr>
+</table>
diff --git a/gosa-core/plugins/admin/mimetypes/release_select.tpl b/gosa-core/plugins/admin/mimetypes/release_select.tpl
new file mode 100755 (executable)
index 0000000..d58738f
--- /dev/null
@@ -0,0 +1,16 @@
+<br> 
+<div class="contentboxh" style="border-bottom:1px solid #B0B0B0;">
+ <p class="contentboxh"><img src="{$branchimage}" align="right" alt="[F]">{t}Branches{/t}</p>
+</div>
+<div class="contentboxb">
+ <table summary="" style="width:100%;">
+  <tr>
+   <td>
+    {t}Current release{/t}&nbsp;
+    <select name="selectedRelease" onChange="document.mainform.submit();">
+     {html_options options=$releases selected=$selectedRelease}
+    </select>
+   </td>
+  </tr>
+ </table>
+</div>
diff --git a/gosa-core/plugins/admin/mimetypes/remove.tpl b/gosa-core/plugins/admin/mimetypes/remove.tpl
new file mode 100755 (executable)
index 0000000..30c4233
--- /dev/null
@@ -0,0 +1,23 @@
+<div style="font-size:18px;">
+  <img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
+</div>
+<p>
+ {$intro}
+ {t}This may be used by several groups. 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}So - if you're sure - press 'Delete' to continue or 'Cancel' to abort.{/t}
+</p>
+
+<p class="plugbottom">
+       {if $multiple}
+               <input type=submit name="delete_multiple_mimetype_confirm" value="{t}Delete{/t}">
+               &nbsp;
+               <input type=submit name="delete_multiple_mimetype_cancel" value="{t}Cancel{/t}">
+       {else}
+               <input type=submit name="delete_mime_confirm" value="{t}Delete{/t}">
+               &nbsp;
+               <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
+       {/if}
+</p>
+
diff --git a/gosa-core/plugins/admin/mimetypes/tabs_mimetypes.inc b/gosa-core/plugins/admin/mimetypes/tabs_mimetypes.inc
new file mode 100755 (executable)
index 0000000..6c1cd34
--- /dev/null
@@ -0,0 +1,64 @@
+<?php
+
+class mimetabs extends tabs
+{
+  var $Release= "";
+
+  function mimetabs($config, $data, $dn,$category)
+  {
+    tabs::tabs($config, $data, $dn,$category);
+
+    /* Add references/acls/snapshots */
+    $this->addSpecialTabs();
+  }
+
+  function set_release($newRelease)
+  {
+    $this->Release= preg_replace('/,ou=mime,.*$/', '', $newRelease);
+    if ($this->Release != ""){
+      $this->Release= ",".$this->Release;
+    }
+  }
+
+  function save($ignore_account= FALSE)
+  {
+    $baseobject= $this->by_object['mimetype'];
+
+    /* Check for new 'dn', in order to propagate the
+       'dn' to all plugins */
+    $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
+
+    if((!empty($tmp)) && (isset($_SESSION['mimefilter']['release']))){
+      if(!$baseobject->isReleaseMimeType){
+        $new_dn= "cn=".$baseobject->cn.",ou=mime,".$baseobject->base;
+      }else{
+        $new_dn ="cn=".$baseobject->cn.",".$_SESSION['mimefilter']['release'];
+      }
+    }else{
+      $new_dn= "cn=".$baseobject->cn.",ou=mime,".$baseobject->base;
+    }
+
+    /* Move group? */
+    if ($this->dn != $new_dn){
+
+      /* Write entry on new 'dn' */
+      if ($this->dn != "new"){
+        $baseobject->move($this->dn, $new_dn);
+        $this->by_object['mimetype']= $baseobject;
+      }
+
+      /* Happen to use the new one */
+      $this->dn= $new_dn;
+    }
+
+    tabs::save();
+
+    /* Fix tagging if needed */
+    $baseobject->dn= $this->dn;
+    $baseobject->handle_object_tagging();
+    $this->by_object['mimetype'] = $baseobject;
+  }
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/ogroups/class_divListOGroup.inc b/gosa-core/plugins/admin/ogroups/class_divListOGroup.inc
new file mode 100755 (executable)
index 0000000..c0e96a7
--- /dev/null
@@ -0,0 +1,331 @@
+<?php
+
+class divListOGroup extends MultiSelectWindow
+{
+
+  /* Current base */
+  var $selectedBase       = "";
+  var $departments        = array();
+
+  /* Regex */
+  var $Regex              = "*";
+
+  /* CheckBoxes, to change default values modify $this->AddCheckBox */
+  var $UserGroups         ;
+  var $GroupGroups        ;
+  var $ApplicationGroups  ;
+  var $DepartmentGroups   ; 
+  var $ServerGroups       ;
+  var $WorkstationGroups  ;
+  var $TerminalGroups     ;
+  var $PrinterGroups      ;
+  var $PhoneGroups        ;
+  
+
+  /* Subsearch checkbox */
+  var $SubSearch          ;
+  var $parent             ;
+  var $ui                 ;
+
+  function divListOGroup (&$config,$parent)
+  {
+    MultiSelectWindow::MultiSelectWindow($config, "OGroups", "ogroups");
+    
+    $this->parent       = $parent;
+    $this->ui           = get_userinfo();
+
+    /* Set list strings */
+    $this->SetTitle(_("List of object groups"));
+    $this->SetSummary(_("List of object groups"));
+    $this->EnableAplhabet(true);
+
+    /* Result page will look like a headpage */
+    $this->SetHeadpageMode();
+    $this->SetInformation(_("This menu allows you to add, edit or remove selected groups. You may want to use the range selector on top of the group listbox, when working with  a large number of groups."));
+  
+    /* Disable buttonsm */
+    $this->EnableCloseButton(false);
+    $this->EnableSaveButton (false);
+
+    /* Dynamic action col, depending on snapshot icons */
+    $action_col_size = 80;
+    if($this->parent->snapshotEnabled()){
+      $action_col_size += 38; 
+    }
+
+    /* Toggle all selected / deselected */
+    $chk = "<input type='checkbox' id='select_all' name='select_all'
+               onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
+
+    /* set Page header */
+    $this->AddHeader(array("string"=> $chk,          "attach"=>"style='width:20px;'"));
+    $this->AddHeader(array("string" => "&nbsp;", "attach" => "style='text-align:center;width:20px;'"));
+    $this->AddHeader(array("string" => _("Name of object groups")." / "._("Departments"), "attach" => "style=''"));
+    $this->AddHeader(array("string" => _("Properties"), "attach" => "style='width:136px;'"));
+    $this->AddHeader(array("string" => _("Actions"), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'"));
+
+    /*                  Text        ,Value    ,Name         ,Is selected */
+    $this->AddCheckBox("UserGroups" ,       _("Select to see groups containing users")       , _("Show groups containing users"), true);
+    $this->AddCheckBox("GroupGroups" ,      _("Select to see groups containing groups")      , _("Show groups containing groups"), true);
+    $this->AddCheckBox("ApplicationGroups", _("Select to see groups containing applications"), _("Show groups containing applications"), true);
+    $this->AddCheckBox("DepartmentGroups" , _("Select to see groups containing departments") , _("Show groups containing departments"), true);
+    $this->AddCheckBox("ServerGroups" ,     _("Select to see groups containing servers")     , _("Show groups containing servers"), true);
+    $this->AddCheckBox("WorkstationGroups", _("Select to see groups containing workstations"), _("Show groups containing workstations"), true);
+    $this->AddCheckBox("TerminalGroups" ,   _("Select to see groups containing terminals")   , _("Show groups containing terminals"), true);
+    $this->AddCheckBox("PrinterGroups" ,    _("Select to see groups containing printer")     , _("Show groups containing printer"), true);
+    $this->AddCheckBox("PhoneGroups" ,      _("Select to see groups containing phones")      , _("Show groups containing phones"), true);
+
+    /* Add SubSearch checkbox */    
+    $this->AddCheckBox(SEPERATOR);
+    $this->AddCheckBox("SubSearch",  _("Select to search within subtrees"), _("Search in subtrees"), false);
+
+    /*                  Name                 ,Text                              ,Default  , Connect with alphabet  */
+    $this->AddRegex   ("Regex",     _("Regular expression for matching group names"), "*" , true);
+  }
+
+
+  function GenHeader()
+  {
+    /* Prepare departments,
+       which are shown in the listbox on top of the listbox
+     */
+    $options= "";
+
+    /* Get all departments within this subtree */
+    $ui= get_userinfo();
+    $first = "";
+    $found = FALSE;
+    $base = $this->config->current['BASE'];
+
+    /* Add base */
+    $tmp = array();
+    $tmp[] = array("dn"=>$this->config->current['BASE']);
+    $tmp=  array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
+                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
+
+    $deps = array();
+    foreach($tmp as $tm){
+      $deps[$tm['dn']] = $tm['dn'];
+    }
+
+    /* Load possible departments */
+    $ui= get_userinfo();
+    $tdeps= $ui->get_module_departments("ogroups");
+    $ids = $this->config->idepartments;
+    $first = "";
+    $found = FALSE;
+    foreach($ids as $dep => $name){
+      if(isset($deps[$dep]) && in_array_ics($dep, $tdeps)){
+
+        /* Keep first base dn in mind, we could need this
+         *  info if no valid base was found
+         */
+        if(empty($first)) {
+          $first = $dep['dn'];
+        }
+
+        $value = $ids[$dep];
+        if ($this->selectedBase == $dep){
+          $found = TRUE;
+          $options.= "<option selected='selected' value='".$dep."'>$value</option>";
+        } else {
+          $options.= "<option value='".$dep."'>$value</option>";
+        }
+      }
+    }
+
+    /* The currently used base is not visible with your acl setup.
+     * Set base to first useable base.
+     */
+    if(!$found){
+      $this->selectedBase = $first;
+    }
+
+    /* Add a seperator after displaying c&p and snapshot icons ? */
+    $add_sep = false;
+  
+    /* Get copy & paste icon */
+    $acls  = $ui->get_permissions($this->selectedBase,"ogroups/ogroup");
+    $acl_all= $ui->has_complete_category_acls($this->selectedBase,"ogroups");
+    $Copy_Paste ="";
+    if(preg_match("/(c.*w|w.*c)/",$acl_all) &&  $this->parent->CopyPasteHandler){
+      $Copy_Paste = $this->parent->CopyPasteHandler->generatePasteIcon();
+      $add_sep = true;
+    }
+
+    /* Add default header */
+    $listhead = MultiSelectWindow::get_default_header();
+
+  
+    /* Add department selector */
+    $listhead .= _("Base")."&nbsp;<select name='CurrentMainBase' 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;";
+
+
+    /* Create Layers menu */
+    $s  = ".|"._("Actions")."|\n";
+    $s .= "..|<img src='images/list_new.png' alt='' border='0' class='center'>".
+      "&nbsp;"._("Create")."|\n";
+
+    /* Append create options */
+    if(preg_match("/c/",$acls)) {
+      $s.= "...|<input class='center' type='image' src='images/list_new_ogroup.png' alt=''>".
+        "&nbsp;"._("Object group")."|group_new|\n";
+    }
+
+    /* Multiple options */
+    $s.= "..|---|\n";
+#    $s.= "..|<img src='images/edit.png' alt='' border='0' class='center'>".
+#      "&nbsp;"._("Edit")."|"."multiple_edit|\n";
+
+    $s.= "..|<img src='images/edittrash.png' alt='' border='0' class='center'>".
+      "&nbsp;"._("Remove")."|"."remove_multiple_ogroups/|\n";
+
+    /* Add multiple copy & cut icons */
+    if(is_object($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
+      $s.= "..|---|\n";
+      $s.= "..|<img src='images/editcopy.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Copy")."|"."multiple_copy_systems|\n";
+      $s.= "..|<img src='images/editcut.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Cut")."|"."multiple_cut_systems|\n";
+
+      if($this->parent->CopyPasteHandler->entries_queued()){
+        $img = "<img border='0' class='center' src='images/editpaste.png' alt=''>";
+        $s.="..|".$img."&nbsp;"._("Paste")."|editPaste|\n";
+      }else{
+        $img = "<img border='0' class='center' src='images/cant_editpaste.png' alt=''>";
+        $s.="..|".$img."&nbsp;"._("Paste")."\n";
+      }
+    }
+
+    /* Add snapshot icons */
+    if(preg_match("/(c.*w|w.*c)/",$acl_all)){
+      $s .= "..|---|\n";
+      $s .= $this->get_snapshot_header(TRUE);
+    }
+
+    $this->SetDropDownHeaderMenu($s);
+    $this->SetListHeader($listhead);
+  }
+
+  function execute()
+  {
+    $this->ClearElementsList();
+    $this->GenHeader();
+  }
+
+  function setEntries($list)
+  {
+    /* Add Copy & Paste buttons if copy&paste is enabled
+     */
+    // Defining Links
+    $linkopen = "<a href='?plug=".$_GET['plug']."&amp;act=dep_open&amp;dep_id=%s'>%s</a>";
+    $editlink = "<a href='?plug=".$_GET['plug']."&amp;id=%s&amp;act=edit_entry'>%s</a>";
+    $userimg  = "<img class='center' src='images/select_groups.png' alt='User'    title='%s'>";
+    $mailimg  = "<img class='center' src='images/mailto.png'             alt='M'  title='"._("Mail")   ."'>";
+    $empty    = "<img class='center' src='images/empty.png' style='width:16px;height:16px;' alt=''>";
+
+    /* Dynamic action col, depending on snapshot icons */
+    $action_col_size = 80;
+    if($this->parent->snapshotEnabled()){
+      $action_col_size += 38; 
+    }
+  
+    $ui = get_userinfo();
+
+    // Assigning ogroups
+    foreach($list as $key => $val){
+
+      /* Create action icons */
+      $actions= "";
+      $acl_all= $ui->has_complete_category_acls($val['dn'],"ogroups");
+      if(($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
+        $actions.= "<input class='center' type='image'
+          src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
+        $actions.= "<input class='center' type='image'
+          src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
+      }
+
+      $actions.= "<input class='center' type='image'
+        src='images/edit.png' alt='"._("edit")."' name='group_edit_%KEY%' title='"._("Edit this entry")."'>";
+    
+      if(preg_match("/(c.*w|w.*c)/", $acl_all)){
+        $actions.= $this->GetSnapShotActions($val['dn']);
+      }
+
+      if(preg_match("/d/",$ui->get_permissions($val['dn'],"ogroups/ogroup"))) {
+        $actions.= "<input class='center' type='image'
+          src='images/edittrash.png' alt='"._("delete")."' name='group_del_%KEY%' title='"._("Delete this entry")."'>";
+      }else{
+        $actions.= "<img class='center' src='images/empty.png' alt='&nbsp;'
+          title='"._("You are not allowed to remove this entry.")."'>";
+      }
+
+
+      if(isset($val['mail'])){
+        $mail = $mailimg;
+      }else{
+        $mail = $empty;
+      }
+      $title = "title='".preg_replace('/ /', '&nbsp;', @LDAP::fix($val['dn']))."'";
+      if(!isset($val['description'][0])){
+        $desc = "";
+      }else{
+        $desc = " - [ ".$val['description'][0]." ]";
+      }
+
+      /* Cutted objects should be displayed in light grey */
+      $display = $val['cn'][0].$desc;
+      if($this->parent->CopyPasteHandler){
+        foreach($this->parent->CopyPasteHandler->queue as $queue_key => $queue_data){
+          if($queue_data['dn'] == $val['dn']) {
+            $display = "<font color='#999999'>".$display."</font>";
+            break;
+          }
+        }
+      }
+
+      /* Create each field */
+      $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
+                      "attach" => "style='width:20px;'");
+      $field1 = array("string" => "<img src='images/list_ogroup.png' alt='"._("Object group")."' ".$title.">", "attach" => "style='text-align:center;width: 20px;'");
+      $field2 = array("string" => sprintf($editlink,$key,$display), "attach" => "style='' ".$title);
+      $field3 = array("string" => preg_replace("/%KEY/", $key, $this->parent->convert_list($val))."&nbsp;".$mail, "attach" => "style='width:136px;'");
+      $field4 = array("string" => preg_replace("/%KEY%/", $key, $actions), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'");
+
+      $this->AddElement(array($field0,$field1,$field2,$field3,$field4));
+    }
+   
+    /* Create summary string for list footer */
+    $num_deps=0;
+    if(!$this->SubSearch){
+      $num_deps = count($this->Added_Departments);
+    }
+    $num_objs = count($list);
+
+    $num_obj_str = _("Number of listed object groups");
+    $num_dep_str = _("Number of listed departments");
+
+    $str = "<img class='center' src='images/select_ogroup.png'
+              title='".$num_obj_str."' alt='".$num_obj_str."'>&nbsp;".$num_objs."&nbsp;&nbsp;&nbsp;&nbsp;";
+    $str.= "<img class='center' src='images/folder.png'
+              title='".$num_dep_str."' alt='".$num_dep_str."'>&nbsp;".$num_deps."&nbsp;&nbsp;&nbsp;&nbsp;";
+
+    $this->set_List_Bottom_Info($str);
+  }
+
+  function Save()
+  {
+    MultiSelectWindow :: Save();  
+  }
+
+  function save_object()
+  {
+    /* Save automatic created POSTs like regex, checkboxes */
+    MultiSelectWindow::save_object();   
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/ogroups/class_mailogroup.inc b/gosa-core/plugins/admin/ogroups/class_mailogroup.inc
new file mode 100644 (file)
index 0000000..ebf5697
--- /dev/null
@@ -0,0 +1,199 @@
+<?php
+
+class mailogroup extends plugin
+{
+  /* plugin specific values */
+  var $mail= "";
+  var $cn= "";
+
+  /* attribute list for save action */
+  var $attributes= array("mail");
+  var $objectclasses= array("kolabGroupOfNames");
+  var $members= array();
+  var $view_logged = FALSE;
+
+  function mailogroup (&$config, $dn= NULL, $parent= NULL)
+  {
+    plugin::plugin($config, $dn, $parent);
+
+    /* Include config object */
+    $this->config= $config;
+
+    /* Save initial account state */
+    $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","ogroups/".get_class($this),$this->dn);
+    }
+
+
+    /* 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->parent !== NULL){
+      if ($this->is_account){
+        $display= $this->show_disable_header(_("Remove mail account"),
+            _("This group has mail features enabled. You can disable them by clicking below."));
+      } else {
+        $display= $this->show_enable_header(_("Create mail account"), _("This group has mail features disabled. You can enable them by clicking below."));
+        return ($display);
+      }
+    }
+    
+    /* Initialize templating engine */
+    $smarty= get_smarty();
+
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl("mail"));
+    }
+
+    /* Assign mail attribute */
+    $smarty->assign("mail", $this->mail);
+
+    /* Show main page */
+    return ($display.$smarty->fetch (get_template_path('mail.tpl', TRUE)));
+  }
+
+
+  /* Check formular input */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    if ($this->is_account){
+      $ldap= $this->config->get_ldap_link();
+
+      /* Check if mail address is valid */
+      if (!is_email($this->mail) || $this->mail == ""){
+        $message[]= _("Please enter a valid email address in 'Primary address' field.");
+      }
+
+      /* Check if mail address is already in use */
+      $ldap->cd($this->config->current['BASE']);
+      $ldap->search ("(&(!(objectClass=gosaUserTemplate))(|(mail=".$this->mail.")(gosaMailAlternateAddress=".$this->mail."))(!(cn=".$this->cn.")))", array("uid"));
+      if ($ldap->count() != 0){
+        $message[]= _("The primary address you've entered is already in use.");
+      }
+    }
+
+    return ($message);
+  }
+
+
+  function save()
+  {
+    $ldap= $this->config->get_ldap_link();
+
+    /* Call parents save to prepare $this->attrs */
+    plugin::save();
+
+    /* Save data to LDAP */
+    $ldap->cd($this->dn);
+    $this->cleanup();
+    $ldap->modify ($this->attrs); 
+
+    if($this->initially_was_account){
+      new log("modify","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      new log("create","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
+
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of object group/mail 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");
+    }
+  }
+
+
+  /* remove object from parent */
+  function remove_from_parent()
+  {
+    /* Cancel if there's nothing to do here */
+    if (!$this->initially_was_account){
+      return;
+    }
+
+    /* include global link_info */
+    $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); 
+
+    new log("remove","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+
+    show_ldap_error($ldap->get_error(), sprintf(_("Removing of object group/mail with dn '%s' failed."),$this->dn));
+  }
+
+
+  function getCopyDialog()
+  {
+    $str = "";
+    $smarty = get_smarty();
+    $smarty->assign("mail",     $this->mail);
+    $str = $smarty->fetch(get_template_path("paste_mail.tpl",TRUE,dirname(__FILE__)));
+    $ret = array();
+    $ret['string'] = $str;
+    $ret['status'] = "";
+    return($ret);
+  }
+
+
+  function saveCopyDialog()
+  {
+    if(isset($_POST['mail'])){
+      $this->mail = $_POST['mail'];
+    }
+  }
+
+
+   static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Mail"),
+          "plDescription" => _("Mail group"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 4,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("ogroups"),
+          "plProvidedAcls"=> array(
+            "mail" => _("Mail address"))
+          ));
+  }
+
+
+
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/ogroups/class_ogroup.inc b/gosa-core/plugins/admin/ogroups/class_ogroup.inc
new file mode 100644 (file)
index 0000000..e74b398
--- /dev/null
@@ -0,0 +1,765 @@
+<?php
+
+
+/* Sort multidimensional arrays for key 'text' */
+function sort_list($val1, $val2)
+{
+  $v1= strtolower($val1['text']);
+  $v2= strtolower($val2['text']);
+  if ($v1 > $v2){
+    return 1;
+  }
+  if ($v1 < $v2){
+    return -1;
+  }
+  return 0;
+}
+
+
+class ogroup extends plugin
+{
+  /* Variables */
+  var $cn= "";
+  var $description= "";
+  var $base= "";
+  var $gosaGroupObjects= "";
+  var $department= "";
+  var $objects= array();
+  var $objcache= array();
+  var $memberList= array();
+  var $member= array();
+  var $orig_dn= "";
+  var $group_dialog= FALSE;
+  var $view_logged = FALSE;
+
+  /* attribute list for save action */
+  var $attributes= array("cn", "description", "gosaGroupObjects","member");
+  var $objectclasses= array("top", "gosaGroupOfNames");
+
+  function ogroup (&$config, $dn= NULL)
+  {
+    plugin::plugin ($config, $dn);
+    $this->orig_dn= $dn;
+
+    $this->member = array();
+
+    /* Load member objects */
+    if (isset($this->attrs['member'])){
+      foreach ($this->attrs['member'] as $key => $value){
+        if ("$key" != "count"){
+          $value= @LDAP::convert($value);
+          $this->member["$value"]= "$value";
+        }
+      }
+    }
+    $this->is_account= TRUE;
+
+    /* Get global filter config */
+    if (!is_global("ogfilter")){
+      $ui= get_userinfo();
+      $base= get_base_from_people($ui->dn);
+      $ogfilter= array( "dselect"       => $base,
+          "regex"           => "*");
+      register_global("ogfilter", $ogfilter);
+    }
+    $ogfilter= get_global('ogfilter');
+
+    /* Adjust flags */
+    foreach( array(   "U" => "accounts",
+          "G" => "groups",
+          "A" => "applications",
+          "D" => "departments",
+          "S" => "servers",
+          "W" => "workstations",
+          "T" => "terminals",
+          "F" => "phones",
+          "_" => "subtrees",
+          "P" => "printers") as $key => $val){
+
+      if (preg_match("/$key/", $this->gosaGroupObjects)){
+        $ogfilter[$val]= "checked";
+      } else {
+        $ogfilter[$val]= "";
+      }
+    }
+    register_global("ogfilter", $ogfilter);
+  
+    if(isset($_SESSION['CurrentMainBase'])){
+     $this->base = $_SESSION['CurrentMainBase'];
+    }
+
+    /* Set base */
+    if ($this->dn == "new"){
+      $this->base= $_SESSION['CurrentMainBase'];
+    } else {
+      $this->base= preg_replace("/^[^,]+,".get_groups_ou()."/","",$this->dn);
+    }
+
+    /* Load member data */
+    $this->reload();
+  }
+
+  function AddDelMembership($NewMember = false){
+
+    if($NewMember){
+
+      /* Add member and force reload */
+      $this->member[$NewMember]= $NewMember;
+      $this->reload(); 
+
+      $this->memberList[$NewMember]= $this->objcache[$NewMember];
+      unset ($this->objects[$NewMember]);
+      uasort ($this->memberList, 'sort_list');
+      reset ($this->memberList);
+    }else{
+      /* Delete objects from group */
+      if (isset($_POST['delete_membership']) && isset($_POST['members'])){
+        foreach ($_POST['members'] as $value){
+          $this->objects["$value"]= $this->memberList[$value];
+          unset ($this->memberList["$value"]);
+          unset ($this->member["$value"]);
+          uasort ($this->objects, 'sort_list');
+          reset ($this->objects);
+        }
+        $this->reload();
+      }
+
+      /* Add objects to group */
+      if (isset($_POST['add_object_finish']) && isset($_POST['objects'])){
+        foreach ($_POST['objects'] as $value){
+          $this->memberList["$value"]= $this->objects[$value];
+          $this->member["$value"]= $value;
+          unset ($this->objects[$value]);
+          uasort ($this->memberList, 'sort_list');
+          reset ($this->memberList);
+        }
+        $this->reload();
+      }
+    }
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    if(!$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","ogroups/".get_class($this),$this->dn);
+    }
+
+
+    /* Do we represent a valid group? */
+    if (!$this->is_account){
+      $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\">&nbsp;<b>".
+        _("This 'dn' is no object group.")."</b>";
+      return ($display);
+    }
+
+    /* Delete objects from group */
+    if (isset($_POST['delete_membership']) && isset($_POST['members'])){
+      foreach ($_POST['members'] as $value){
+        if(isset($this->memberList[$value])){
+          $this->objects["$value"]= $this->memberList[$value];
+          unset ($this->memberList["$value"]);
+          unset ($this->member["$value"]);
+          uasort ($this->objects, 'sort_list');
+          reset ($this->objects);
+        }
+      }
+      $this->reload();
+    }
+
+    /* Add objects to group */
+    if (isset($_POST['add_object_finish']) && isset($_POST['objects'])){
+      foreach ($_POST['objects'] as $value){
+        if(isset($this->objects[$value])){
+          $this->memberList["$value"]= $this->objects[$value];
+          $this->member["$value"]= $value;
+          unset ($this->objects[$value]);
+          uasort ($this->memberList, 'sort_list');
+          reset ($this->memberList);
+        }
+      }
+      $this->reload();
+    }
+
+    /* Load templating engine */
+    $smarty= get_smarty();
+
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+    /* Base select dialog */
+    $once = true;
+    foreach($_POST as $name => $value){
+      if(preg_match("/^chooseBase/",$name) && $once && $this->acl_is_moveable()){
+        $once = false;
+        $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
+        $this->dialog->setCurrentBase($this->base);
+      }
+    }
+
+    /* Dialog handling */
+    if(is_object($this->dialog) && $this->acl_is_moveable()){
+      /* Must be called before save_object */
+      $this->dialog->save_object();
+
+      if($this->dialog->isClosed()){
+        $this->dialog = false;
+      }elseif($this->dialog->isSelected()){
+
+        /* A new base was selected, check if it is a valid one */
+        $tmp = $this->get_allowed_bases();
+        if(isset($tmp[$this->dialog->isSelected()])){
+          $this->base = $this->dialog->isSelected();
+        }
+        $this->dialog= false;
+      }else{
+        return($this->dialog->execute());
+      }
+    }
+
+    /* Add objects? */
+    if (isset($_POST["edit_membership"])){
+      $this->group_dialog= TRUE;
+      $this->dialog= TRUE;
+    }
+
+    /* Add objects finished? */
+    if (isset($_POST["add_object_finish"]) || isset($_POST["add_object_cancel"])){
+      $this->group_dialog= FALSE;
+      $this->dialog= FALSE;
+    }
+
+    /* Manage object add dialog */
+    if ($this->group_dialog){
+
+      /* Save data */
+      $ogfilter= get_global("ogfilter");
+      foreach( array("dselect", "regex") as $type){
+        if (isset($_POST[$type])){
+          $ogfilter[$type]= $_POST[$type];
+        }
+      }
+      if (isset($_POST['dselect'])){
+        foreach( array("accounts", "groups", "applications", "departments",
+              "servers", "workstations", "terminals", "printers","subtrees",
+              "phones") as $type){
+
+          if (isset($_POST[$type])) {
+            $ogfilter[$type]= "checked";
+          } else {
+            $ogfilter[$type]= "";
+          }
+        }
+      }
+      if (isset($_GET['search'])){
+        $s= mb_substr($_GET['search'], 0, 1, "UTF8")."*";
+        if ($s == "**"){
+          $s= "*";
+        }
+        $ogfilter['regex']= $s;
+      }
+      register_global("ogfilter", $ogfilter);
+      $this->reload();
+
+      /* Calculate actual groups */
+      $smarty->assign("objects", $this->convert_list($this->objects));
+
+      /* Show dialog */
+      $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("deplist", $this->config->idepartments);
+      $smarty->assign("alphabet", generate_alphabet());
+      foreach( array("dselect", "regex", "accounts", "groups", "applications",
+            "departments", "servers", "workstations", "terminals","subtrees",
+            "printers", "phones") as $type){
+        $smarty->assign("$type", $ogfilter[$type]);
+      }
+      $smarty->assign("hint", print_sizelimit_warning());
+      $smarty->assign("apply", apply_filter());
+
+      $display= $smarty->fetch (get_template_path('ogroup_objects.tpl', TRUE, dirname(__FILE__)));
+      return ($display);
+    }
+
+    /* Bases / Departments */
+      if ((isset($_POST['base'])) && ($this->acl_is_moveable())){
+        $this->base= $_POST['base'];
+      }
+
+    /* Assemble combine string */
+    if ($this->gosaGroupObjects == "[]"){
+      $smarty->assign("combinedObjects", _("none"));
+    } elseif (strlen($this->gosaGroupObjects) > 4){
+      $smarty->assign("combinedObjects", "<font color=red>"._("too many different objects!")."</font>");
+    } else {
+      $conv= array(   "U" => _("users"),
+          "G" => _("groups"),
+          "A" => _("applications"),
+          "D" => _("departments"),
+          "S" => _("servers"),
+          "W" => _("workstations"),
+          "T" => _("terminals"),
+          "F" => _("phones"),
+          "P" => _("printers"));
+
+      $type= preg_replace('/[\[\]]/', '', $this->gosaGroupObjects);
+      $p1= $conv[$type[0]];
+      error_reporting(0);
+      if (isset($type[1]) && preg_match('/[UGADSFWTP]/', $type[1])){
+        $p2= $conv[$type[1]];
+        $smarty->assign("combinedObjects", "$p1 "._("and")." $p2");
+      } else {
+        $smarty->assign("combinedObjects", "$p1");
+      }
+      error_reporting(E_ALL | E_STRICT);
+    }
+
+    /* Assign variables */
+    $smarty->assign("bases", $this->get_allowed_bases());
+    $smarty->assign("base_select", $this->base);
+    $smarty->assign("department", $this->department);
+    $smarty->assign("members", $this->convert_list($this->memberList));
+
+    /* Objects have to be tuned... */
+    $smarty->assign("objects", $this->convert_list($this->objects));
+
+    /* Fields */
+    foreach ($this->attributes as $val){
+      $smarty->assign("$val", $this->$val);
+    }
+
+    return ($smarty->fetch (get_template_path('generic.tpl', TRUE)));
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    /* Save additional values for possible next step */
+    if (isset($_POST['ogroupedit'])){
+
+      /* Create a base backup and reset the
+         base directly after calling plugin::save_object();
+         Base will be set seperatly a few lines below */
+      $base_tmp = $this->base;
+      plugin::save_object();
+      $this->base = $base_tmp;
+
+      /* Save base, since this is no LDAP attribute */
+      $tmp = $this->get_allowed_bases();
+      if(isset($_POST['base'])){
+        if(isset($tmp[$_POST['base']])){
+          $this->base= $_POST['base'];
+        }
+      }
+    }
+  }
+
+
+  /* (Re-)Load objects */
+  function reload()
+  {
+    /*###########
+      Variable initialisation 
+      ###########*/
+
+    $this->objects                = array();
+    $this->ui                     = get_userinfo();
+    $filter                       = "";
+    $objectClasses                = array();
+    
+    $ogfilter               = get_global("ogfilter");
+    $regex                  = $ogfilter['regex'];
+
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd ($ogfilter['dselect']);
+
+
+    /*###########
+      Generate Filter 
+      ###########*/
+
+    $p_f= array("accounts"        => array("CLASS"=>"gosaAccount"    ,"DN"=> get_people_ou()                  ,"ACL" => "users"), 
+                "groups"          => array("CLASS"=>"posixGroup"     ,"DN"=> get_groups_ou()                  ,"ACL" => "groups"), 
+                "applications"    => array("CLASS"=>"gosaApplication","DN"=> "ou=apps,"                       ,"ACL" => "application"), 
+                "departments"     => array("CLASS"=>"gosaDepartment" ,"DN"=> ""                               ,"ACL" => "department"), 
+                "servers"         => array("CLASS"=>"goServer"       ,"DN"=> "ou=servers,ou=systems,"         ,"ACL" => "server"),
+                "workstations"    => array("CLASS"=>"gotoWorkstation","DN"=> "ou=workstations,ou=systems,"    ,"ACL" => "workstation"),
+                "terminals"       => array("CLASS"=>"gotoTerminal"   ,"DN"=> "ou=terminals,ou=systems,"       ,"ACL" => "terminal"),
+                "printers"        => array("CLASS"=>"gotoPrinter"    ,"DN"=> "ou=printers,ou=systems,"        ,"ACL" => "printer"),
+                "phones"          => array("CLASS"=>"goFonHardware"  ,"DN"=> "ou=phones,ou=systems,"          ,"ACL" => "phone"));
+
+
+    /*###########
+      Perform search for selected objectClasses & regex to fill list with objects   
+      ###########*/
+
+    $Get_list_flags = 0;
+    if($ogfilter['subtrees'] == "checked"){
+      $Get_list_flags |= GL_SUBSEARCH;
+    }    
+
+    foreach($p_f as $post_name => $data){
+
+      if($ogfilter[$post_name] == "checked"){
+
+        if($ogfilter['subtrees']){
+          $base =  $ogfilter['dselect'];
+        }else{
+          $base =  $data['DN'].$ogfilter['dselect'];
+        }
+    
+        $filter = "(&(objectClass=".$data['CLASS'].")(|(uid=$regex)(cn=$regex)(ou=$regex)))";
+        $res    = get_list($filter, $data['ACL']  , $base, 
+                    array("description", "objectClass", "sn", "givenName", "uid","ou","cn"),$Get_list_flags);
+
+        /* fetch results and append them to the list */
+        foreach($res as $attrs){
+
+          $type= $this->getObjectType($attrs);
+          $name= $this->getObjectName($attrs);
+
+          /* Fill array */
+          if (isset($attrs["description"][0])){
+            $this->objects[$attrs["dn"]]= array("text" => "$name [".$attrs["description"][0]."]", "type" => "$type");
+          } elseif (isset($attrs["uid"][0])) {
+            $this->objects[$attrs["dn"]]= array("text" => "$name [".$attrs["uid"][0]."]", "type" => "$type");
+          } else {
+            $this->objects[$attrs["dn"]]= array("text" => "$name", "type" => "$type");
+          }
+        }
+      }
+    }
+    uasort ($this->objects, 'sort_list');
+    reset ($this->objects);
+
+    
+    /*###########
+      Build member list and try to detect obsolete entries 
+      ###########*/
+
+    $this->memberList = array();
+  
+    /* Walk through all single member entry */
+    foreach($this->member as $dn){
+
+      /* The dn for the current member can't be resolved 
+         it seams that this entry was removed 
+       */ 
+      /* Try to resolv the entry again, if it still fails, display error msg */
+      $ldap->cat($dn, array("cn", "sn", "givenName", "ou", "description", "objectClass"));
+
+      /* It has failed, add entry with type flag I (Invalid)*/
+      if ($ldap->error != "Success"){
+        $this->memberList[$dn]= array('text' => _("Non existing dn:")." ".@LDAP::fix($dn),"type" => "I");
+
+      } else {
+
+        /* Append this entry to our all object list */
+
+        /* Fetch object */
+        $attrs= $ldap->fetch();
+
+        $type= $this->getObjectType($attrs);
+        $name= $this->getObjectName($attrs);
+
+        if (isset($attrs["description"][0])){
+          $this->objcache[$attrs["dn"]]= array("text" => "$name [".$attrs["description"][0]."]", "type" => "$type");
+        } elseif (isset($attrs["uid"][0])) {
+          $this->objcache[$attrs["dn"]]= array("text" => "$name [".$attrs["uid"][0]."]", "type" => "$type");
+        } else {
+          $this->objcache[$attrs["dn"]]= array("text" => "$name", "type" => "$type");
+        }
+        $this->objcache[$attrs["dn"]]['objectClass']  = $attrs['objectClass'];
+        if(isset($attrs['uid'])){
+          $this->objcache[$attrs["dn"]]['uid']          = $attrs['uid'];
+        }
+
+        /* Fill array */
+        if (isset($attrs["description"][0])){
+          $this->objects[$attrs["dn"]]= array("text" => "$name [".$attrs["description"][0]."]", "type" => "$type");
+        } else {
+          $this->objects[$attrs["dn"]]= array("text" => "$name", "type" => "$type");
+        }
+
+        $this->memberList[$dn]= $this->objects[$attrs["dn"]];
+      }
+    }
+    uasort ($this->memberList, 'sort_list');
+    reset ($this->memberList);
+
+    /* Assemble types of currently combined objects */
+    $objectTypes= "";
+    foreach ($this->memberList as $dn => $desc){
+
+      /* Invalid object? */
+      if ($desc['type'] == 'I'){
+        continue;
+      }
+
+      /* Fine. Add to list. */
+      if (!preg_match('/'.$desc['type'].'/', $objectTypes)){
+        $objectTypes.= $desc['type'];
+      }
+    }
+    $this->gosaGroupObjects= "[$objectTypes]";
+  }
+
+
+  function convert_list($input)
+  {
+    $temp= "";
+    $conv= array(  "U" => "select_user.png",
+        "G" => "select_groups.png",
+        "A" => "select_application.png",
+        "D" => "select_department.png",
+        "S" => "select_server.png",
+        "W" => "select_workstation.png",
+        "T" => "select_terminal.png",
+        "F" => "select_phone.png",
+        "I" => "flag.png",
+        "P" => "select_printer.png");
+
+    foreach ($input as $key => $value){
+      /* Generate output */
+      $temp.= "<option title='".addslashes( $key)."' value=\"$key\" class=\"select\" style=\"background-image:url('".get_template_path("images/".$conv[$value['type']])."');\">".$value['text']."</option>\n";
+    }
+
+    return ($temp);
+  }
+
+
+  function getObjectType($attrs)
+  {
+    $type= "I";
+
+    foreach(array(  "U" => "gosaAccount",
+          "G" => "posixGroup",
+          "A" => "gosaApplication",
+          "D" => "gosaDepartment",
+          "S" => "goServer",
+          "W" => "gotoWorkstation",
+          "T" => "gotoTerminal",
+          "F" => "goFonHardware",
+          "P" => "gotoPrinter") as $index => $class){
+      if (in_array($class, $attrs['objectClass'])){
+        $type= $index;
+        break;
+      }
+    }
+
+    return ($type);
+  }
+
+
+  function getObjectName($attrs)
+  {
+    /* Person? */
+    $name =""; 
+    if (in_array('gosaAccount', $attrs['objectClass'])){
+      if(isset($attrs['sn']) && isset($attrs['givenName'])){
+        $name= $attrs['sn'][0].", ".$attrs['givenName'][0];
+      } else {
+        $name= $attrs['uid'][0];
+      }
+    } else {
+      if(isset($attrs["cn"][0])) {
+        $name= $attrs['cn'][0];
+      } else {
+        $name= $attrs['ou'][0];
+      }
+    }
+
+    return ($name);
+  }
+
+
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    /* Permissions for that base? */
+    if ($this->base != ""){
+      $new_dn= 'cn='.$this->cn.','.get_groups_ou().$this->base;
+    } else {
+      $new_dn= $this->dn;
+    }
+
+
+    $ldap = $this->config->get_ldap_link();
+    if($this->dn != $new_dn){
+      $ldap->cat ($new_dn, array('dn'));
+    }
+    
+    if($ldap->count() !=0){
+      $message[]= _("There is already an object with this cn.");
+    } 
+
+    /* Set new acl base */
+    if($this->dn == "new") {
+      $this->set_acl_base($this->base);
+    }
+
+    /* must: cn */
+    if ($this->cn == ""){
+      $message[]= "The required field 'Name' is not set.";
+    }
+
+    /* To many different object types? */
+    if (strlen($this->gosaGroupObjects) > 4){
+      $message[]= _("You can combine two different object types at maximum only!");
+    }
+
+    return ($message);
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    plugin::save();
+
+    /* Move members to target array */
+    $this->attrs['member'] =array();
+    foreach ($this->member as $key => $desc){
+      $this->attrs['member'][]= @LDAP::fix($key);
+    }
+
+    $ldap= $this->config->get_ldap_link();
+
+    /* New accounts need proper 'dn', propagate it to remaining objects */
+    if ($this->dn == 'new'){
+      $this->dn= 'cn='.$this->cn.','.get_groups_ou().$this->base;
+    }
+
+    /* Save data. Using 'modify' implies that the entry is already present, use 'add' for
+       new entries. So do a check first... */
+    $ldap->cat ($this->dn, array('dn'));
+    if ($ldap->fetch()){
+      /* Modify needs array() to remove values :-( */
+      if (!count ($this->member)){
+        $this->attrs['member']= array();
+      }
+      $mode= "modify";
+
+    } else {
+      $mode= "add";
+      $ldap->cd($this->config->current['BASE']);
+      $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
+    }
+
+    /* Write back to ldap */
+    $ldap->cd($this->dn);
+    $this->cleanup();
+    $ldap->$mode($this->attrs);
+
+    if($mode == "add"){
+      new log("create","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      new log("modify","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
+
+    /* Trigger post signal */
+    $this->handle_post_events($mode);
+
+    $ret= 0;
+    if (show_ldap_error($ldap->get_error(), sprintf(_("Saving of object group/generic with dn '%s' failed."),$this->dn))){
+      $ret= 1;
+    }
+
+    return ($ret);
+  }
+
+  function remove_from_parent()
+  {
+    plugin::remove_from_parent();
+
+    $ldap= $this->config->get_ldap_link();
+    $ldap->rmdir($this->dn);
+    show_ldap_error($ldap->get_error(), sprintf(_("Removing of object group/generic with dn '%s' failed."),$this->dn));
+
+    new log("remove","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+
+    /* Trigger remove signal */
+    $this->handle_post_events("remove");
+  }
+
+  
+  function PrepareForCopyPaste($source)
+  {
+    /* Update available object types */
+    if(isset($source['gosaGroupObjects'][0])){
+      $this->gosaGroupObjects =  $source['gosaGroupObjects'][0];
+    }
+
+    /* Reload tabs */
+    $this->parent->reload($this->gosaGroupObjects );
+   
+    /* Reload plugins */ 
+    foreach($this->parent->by_object as $name => $class ){
+      if(get_class($this) != $name) {
+        $this->parent->by_object[$name]->PrepareForCopyPaste($source);
+      }
+    }
+
+    /* Load member objects */
+    if (isset($source['member'])){
+      foreach ($source['member'] as $key => $value){
+        if ("$key" != "count"){
+          $value= @LDAP::convert($value);
+          $this->member["$value"]= "$value";
+        }
+      }
+    }
+
+  }
+
+
+  function getCopyDialog()
+  {
+    $smarty = get_smarty();
+    $smarty->assign("cn",     $this->cn);
+    $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE,dirname(__FILE__)));
+    $ret = array();
+    $ret['string'] = $str;
+    $ret['status'] = "";
+    return($ret);
+  }
+
+  function saveCopyDialog()
+  {
+    if(isset($_POST['cn'])){
+      $this->cn = $_POST['cn'];
+    }
+  }
+
+
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Generic"),
+          "plDescription" => _("Object group generic"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 1,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("ogroups" => array("description"  => _("Object groups"),
+                                                      "objectClass"  => "gosaGroupOfNames")),
+          "plProvidedAcls"=> array(
+            "cn"                => _("Name"),
+            "base"              => _("Base"),
+            "description"       => _("Description"),
+            "member"            => _("Member"))
+          ));
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/ogroups/class_ogroupManagement.inc b/gosa-core/plugins/admin/ogroups/class_ogroupManagement.inc
new file mode 100644 (file)
index 0000000..5740877
--- /dev/null
@@ -0,0 +1,632 @@
+<?php
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2004 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 ogroupManagement extends plugin
+{
+  /* Definitions */
+  var $plHeadline= "Object groups";
+  var $plDescription= "This does something";
+
+  /* attribute list for save action */
+  var $attributes= array();
+  var $objectclasses= array();
+  var $obtypes= array();
+  var $ogroup;
+
+  var $CopyPasteHandler = NULL;
+  var $DivListOGroup    = NULL;
+  var $start_pasting_copied_objects = FALSE;
+
+  function ogroupManagement (&$config, $dn= NULL)
+  {
+    /* Include config object */
+    $this->config= &$config;
+    $this->ui= get_userinfo();
+
+    /* Copy & Paste enabled ?
+     */
+    if((isset($this->config->data['MAIN']['ENABLECOPYPASTE']))&&(preg_match("/true/i",$this->config->data['MAIN']['ENABLECOPYPASTE'] ))){
+      $this->CopyPasteHandler = new CopyPasteHandler($this->config);
+    }
+
+    /* Div lsit management */
+    $this->DivListOGroup = new divListOGroup($this->config,$this);
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /****************
+      Variable intialisation && Check posts for commands  
+     ****************/
+
+    $_SESSION['LOCK_VARS_TO_USE'] = array("/^act$/","/^id$/","/^group_edit_/","/^group_del_/","/^item_selected/","/^remove_multiple_ogroups/");
+
+    $smarty     = get_smarty();
+    $s_action   = "";
+    $s_entry    = "";
+
+    /* Test Posts */
+    foreach($_POST as $key => $val){
+      // Post for delete
+      if(preg_match("/^group_del.*/",$key)){
+        $s_action = "del";
+        $s_entry  = preg_replace("/^group_".$s_action."_/i","",$key);
+        // Post for edit
+      }elseif(preg_match("/^group_edit_.*/",$key)){
+        $s_action="edit";
+        $s_entry  = preg_replace("/^group_".$s_action."_/i","",$key);
+        // Post for new
+      }elseif(preg_match("/^group_new.*/",$key)){
+        $s_action="new";
+      }elseif(preg_match("/^editPaste.*/i",$key)){
+        $s_action="editPaste";
+      }elseif(preg_match("/^copy_.*/",$key)){
+        $s_action="copy";
+        $s_entry  = preg_replace("/^copy_/i","",$key);
+      }elseif(preg_match("/^cut_.*/",$key)){
+        $s_action="cut";
+        $s_entry  = preg_replace("/^cut_/i","",$key);
+      }elseif(preg_match("/^remove_multiple_ogroups/",$key)){
+        $s_action="del_multiple";
+      }elseif(preg_match("/^multiple_cut_ogroups/",$key)){
+        $s_action = "cut_multiple";
+      }elseif(preg_match("/^multiple_copy_ogroups/",$key)){
+        $s_action = "copy_multiple";
+      }elseif(preg_match("/_group_edit_/",$key)){
+        $type = preg_replace("/_group_edit_.*$/","",$key);
+        $s_action="edit";
+        $s_entry  = preg_replace("/".$type."_group_edit_/i","",$key);
+        $_POST['arg'] = $type;
+      }
+    }
+    $s_entry  = preg_replace("/_.$/","",$s_entry);
+
+    // Edit if
+    if((isset($_GET['act']))&&($_GET['act']=="edit_entry")){
+      $s_action ="edit";
+      $s_entry  = $_GET['id'];
+    }
+
+
+
+    /* handle C&P from layers menu */
+    if(isset($_POST['menu_action']) && preg_match("/^multiple_copy_systems/",$_POST['menu_action'])){
+      $s_action = "copy_multiple";
+    }
+    if(isset($_POST['menu_action']) && preg_match("/^multiple_cut_systems/",$_POST['menu_action'])){
+      $s_action = "cut_multiple";
+    }
+    if(isset($_POST['menu_action']) && preg_match("/^editPaste/",$_POST['menu_action'])){
+      $s_action = "editPaste";
+    }
+
+    /* Create options */
+    if(isset($_POST['menu_action']) && $_POST['menu_action'] == "group_new"){
+      $s_action = "new";
+    }
+
+    /* handle remove from layers menu */
+    if(isset($_POST['menu_action']) && preg_match("/^remove_multiple/",$_POST['menu_action'])){
+      $s_action = "del_multiple";
+    }
+
+
+    /****************
+      Copy & Paste handling 
+     ****************/
+
+    /* Display the copy & paste dialog, if it is currently open */
+    $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
+    if($ret){
+      return($ret);
+    }
+
+
+    /***************
+      Create a new object group 
+     ****************/
+
+    /* New group? */
+    if ($s_action=="new"){
+
+      /* By default we set 'dn' to 'new', all relevant plugins will
+         react on this. */
+      $this->dn= "new";
+
+      /* Create new usertab object */
+      $this->ogroup= new ogrouptabs($this->config,$this->config->data['TABS']['OGROUPTABS'], $this->dn,"ogroups");
+      $this->ogroup->set_acl_base($this->DivListOGroup->selectedBase);
+    }
+
+
+    /********************
+      Delete MULTIPLE entries requested, display confirm dialog
+     ********************/
+    if ($s_action=="del_multiple"){
+      $ids = $this->list_get_selected_items();
+      if(count($ids)){
+        foreach($ids as $id){
+          $dn = $this->ogrouplist[$id]['dn'];
+          if (($user= get_lock($dn)) != ""){
+            return(gen_locked_message ($user, $dn));
+          }
+          $this->dns[$id] = $dn;
+        }
+        $dns_names = "<br><pre>";
+        foreach($this->dns as $dn){
+          add_lock ($dn, $this->ui->dn);
+          $dns_names .= $dn."\n";
+        }
+        $dns_names .="</pre>";
+        /* Lock the current entry, so nobody will edit it during deletion */
+        if (count($this->dns) == 1){
+          $smarty->assign("info",     sprintf(_("You're about to delete the following object entry %s"), @LDAP::fix($dns_names)));
+        } else {
+          $smarty->assign("info",     sprintf(_("You're about to delete the following object entries %s"), @LDAP::fix($dns_names)));
+        }
+        $smarty->assign("multiple", true);
+        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+      }
+    }
+
+
+    /********************
+      Delete MULTIPLE entries confirmed
+     ********************/
+
+    /* Confirmation for deletion has been passed. Users should be deleted. */
+    if (isset($_POST['delete_multiple_ogroup_confirm'])){
+
+      /* Remove user by user and check acls before removeing them */
+      foreach($this->dns as $key => $dn){
+
+        $acl = $this->ui->get_permissions($dn, "ogroups");
+        if (preg_match('/d/', $acl)){
+
+          /* Delete request is permitted, perform LDAP action */
+          $this->ogroup= new ogrouptabs($this->config,$this->config->data['TABS']['OGROUPTABS'], $dn);
+          $this->ogroup->delete ();
+          unset ($this->ogroup);
+          $this->ogroup= NULL;
+        } else {
+
+          /* Normally this shouldn't be reached, send some extra
+             logs to notify the administrator */
+          print_red (_("You are not allowed to delete this object group!"));
+          new log("security","ogroups/".get_class($this),$dn,array(),"Tried to trick deletion.");
+        }
+        /* Remove lock file after successfull deletion */
+        del_lock ($dn);
+        unset($this->dns[$key]);
+      }
+    }
+
+
+    /********************
+      Delete MULTIPLE entries Canceled
+     ********************/
+
+    /* Remove lock */
+    if(isset($_POST['delete_multiple_ogroup_cancel'])){
+      foreach($this->dns as $key => $dn){
+        del_lock ($dn);
+        unset($this->dns[$key]);
+      }
+    }
+
+
+    /****************
+      Delete object group
+     ****************/
+
+    if ($s_action=="del"){
+
+      /* Get 'dn' from posted 'uid' */
+      $this->dn= $this->ogrouplist[$s_entry]['dn'];
+
+      /* Load permissions for selected 'dn' and check if
+         we're allowed to remove this 'dn' */
+      $acl = $this->ui->get_permissions($this->dn,"ogroups");
+      if(preg_match("/d/",$acl)){
+
+        /* Check locking, save current plugin in 'back_plugin', so
+           the dialog knows where to return. */
+        if (($user= get_lock($this->dn)) != ""){
+          return(gen_locked_message ($user, $this->dn));
+        }
+
+        /* Lock the current entry, so nobody will edit it during deletion */
+        add_lock ($this->dn, $this->ui->dn);
+        $smarty->assign("info", sprintf(_("You're about to delete the object group '%s'."), @LDAP::fix($this->dn)));
+        $smarty->assign("multiple", false);
+        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+      } else {
+
+        /* Obviously the user isn't allowed to delete. Show message and
+           clean session. */
+        print_red (_("You are not allowed to delete this object group!"));
+      }
+    }
+
+
+    /****************
+      Delete confirmed 
+     ****************/
+
+    /* Confirmation for deletion has been passed. Group should be deleted. */
+    if (isset($_POST['delete_group_confirm'])){
+
+      /* Some nice guy may send this as POST, so we've to check
+         for the permissions again. */
+      $acl = $this->ui->get_permissions($this->dn,"ogroups");
+      if(preg_match("/d/",$acl)){
+
+        /* Delete request is permitted, perform LDAP action */
+        $this->ogroup= new ogrouptabs($this->config,
+            $this->config->data['TABS']['OGROUPTABS'], $this->dn);
+        $this->ogroup->delete ();
+        unset ($this->ogroup);
+        $this->ogroup= NULL;
+      } else {
+
+        /* Normally this shouldn't be reached, send some extra
+           logs to notify the administrator */
+        print_red (_("You are not allowed to delete this object group!"));
+        new log("security","ogroups/".get_class($this),$dn,array(),"Tried to trick deletion.");
+      }
+
+      /* Remove lock file after successfull deletion */
+      del_lock ($this->dn);
+      unset($_SESSION['objectinfo']);
+    }
+
+
+    /****************
+      Delete object group Canceled
+     ****************/
+
+    /* Delete group canceled? */
+    if (isset($_POST['delete_cancel'])){
+      del_lock ($this->dn);
+      unset($_SESSION['objectinfo']);
+    }
+
+
+    /****************
+      Edit group
+     ****************/
+
+    if (($s_action=="edit") && (! isset($this->ogroup->config)) ){
+
+      /* Get 'dn' from posted 'uid', must be unique */
+      $this->dn= $this->ogrouplist[$s_entry]['dn'];
+
+      /* Check locking, save current plugin in 'back_plugin', so
+         the dialog knows where to return. */
+      if (($user= get_lock($this->dn)) != ""){
+        return(gen_locked_message ($user, $this->dn));
+      }
+
+      /* Lock the current entry, so everyone will get the
+         above dialog */
+      add_lock ($this->dn, $this->ui->dn);
+
+      /* Register grouptab to trigger edit dialog */
+      $this->ogroup= new ogrouptabs($this->config, $this->config->data['TABS']['OGROUPTABS'], $this->dn, "ogroups");
+      $this->ogroup->set_acl_base($this->dn);
+      $_SESSION['objectinfo']= $this->dn;
+    }
+
+
+    /****************
+      Edit finished save 
+     ****************/
+
+    /* Finish button has been pressed */
+    if ((isset($_POST['edit_finish']) || isset($_POST['edit_apply'])) && (isset($this->ogroup->config)) ){
+
+      /* Check tabs, will feed message array */
+      $message= $this->ogroup->check();
+
+      /* Save, or display error message? */
+      if (count($message) == 0){
+
+        /* Save user data to ldap */
+        $this->ogroup->save();
+
+        if (!isset($_POST['edit_apply'])){
+          /* Group has been saved successfully, remove lock from
+             LDAP. */
+          if ($this->dn != "new"){
+            del_lock ($this->dn);
+          }
+
+          unset ($this->ogroup);
+          $this->ogroup= NULL;
+          unset ($_SESSION['objectinfo']);
+        }
+      } else {
+        /* Ok. There seem to be errors regarding to the tab data,
+           show message and continue as usual. */
+        show_errors($message);
+      }
+    }
+
+
+    /****************
+      Cancel edit object group
+     ****************/
+
+    /* Cancel dialogs */
+    if ((isset($_POST['edit_cancel']))  && (isset($this->ogroup->dn))){
+      del_lock ($this->ogroup->dn);
+      unset ($this->ogroup);
+      $this->ogroup= NULL;
+      unset($_SESSION['objectinfo']);
+    }
+
+
+    /****************
+      Display open dialogs 
+     ****************/
+
+    /* Show dialog if object is present */
+    if (isset($this->ogroup->config)){
+      $display= $this->ogroup->execute();
+
+      /* Don't show buttons if tab dialog requests this */
+      if (!$this->ogroup->by_object[$this->ogroup->current]->dialog){
+        $display.= "<p style=\"text-align:right\">\n";
+        $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
+        $display.= "&nbsp;\n";
+        if ($this->dn != "new"){
+          $display.= "<input type=submit name=\"edit_apply\" value=\""._("Apply")."\">\n";
+          $display.= "&nbsp;\n";
+        }
+        $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+        $display.= "</p>";
+      }
+      return ($display);
+    }
+
+
+    /****************
+      Display list 
+     ****************/
+
+    /* Check if there is a snapshot dialog open */
+    $base = $this->DivListOGroup->selectedBase;
+    if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases())){
+      return($str);
+    }
+
+    /* Display dialog with group list */
+    $this->DivListOGroup->parent = $this;
+    $this->DivListOGroup->execute();
+
+    /* Add departments if subsearch is disabled */
+    if(!$this->DivListOGroup->SubSearch){
+      $this->DivListOGroup->AddDepartments($this->DivListOGroup->selectedBase,4,1);
+    }
+    $this->reload ();
+    $this->DivListOGroup->setEntries($this->ogrouplist);
+    return($this->DivListOGroup->Draw());
+  }
+
+
+  /* Return departments, that will be included within snapshot detection */
+  function get_used_snapshot_bases()
+  {
+    return(array(get_groups_ou().$this->DivListOGroup->selectedBase));
+  }
+
+  
+
+  function convert_list($input)
+  {
+    $temp= "";
+
+    $conv= array(   
+        "U" => array("select_user.png"        ,_("User")        , "ogroup"),
+        "G" => array("select_groups.png"      ,_("Group")       , "ogroup"),
+        "A" => array("select_application.png" ,_("Application") , "ogroup"),
+        "D" => array("select_department.png"  ,_("Department")  , "ogroup"),
+        "S" => array("select_server.png"      ,_("Server")      , "ogroup"),
+        "F" => array("select_phone.png"       ,_("Phone")       , "phonequeue"),
+        "W" => array("select_workstation.png" ,_("Workstation") , "workstartup"),
+        "T" => array("select_terminal.png"    ,_("Terminal")    , "termgroup"),
+        "P" => array("select_printer.png"     ,_("Printer")     , "ogroup"));
+
+    /* Assemble picture */
+    $type= $input['gosaGroupObjects'][0];
+    $type= preg_replace("/[^A-Z]/i","",$type);
+    if (isset($type[0])){
+      $p1['pic']= $conv[$type[0]][0];
+      $p1['tit']= $conv[$type[0]][1];
+      $p1['alt']= $type[0];
+      $p1['lnk']= $conv[$type[0]][2];
+      $html_object_1 = "<input type='image' name='".$p1['lnk']."_group_edit_%KEY' ";
+    } else {
+      $p1['pic']= "empty.png";
+      $p1['tit']= "";
+      $p1['alt']= "";
+      $p1['lnk']= "";//$conv[$type[0]][2];
+      $html_object_1 = "<img ";
+    }
+
+    if (isset($type[1])){
+      $p2['pic']= $conv[$type[1]][0];
+      $p2['alt']= $type[1];
+      $p2['tit']= $conv[$type[1]][1];
+      $p2['lnk']= $conv[$type[1]][2];
+      $html_object_2 = "<input type='image' name='".$p2['lnk']."_group_edit_%KEY' ";
+    } else {
+      $p2['pic']= "empty.png";
+      $p2['alt']= "";
+      $p2['tit']= "";
+      $p2['lnk']= ""; //$conv[$type[0]][2];
+      $html_object_2 = "<img ";
+    }
+    
+    $temp = $html_object_1." class='center' id='iconA".preg_replace("/_/","",$p1['lnk']."_group_edit_%KEY")."' 
+      src='images/".$p1['pic']."' alt='".$p1['alt']."' title='".$p1['tit']."'>";
+    $temp.= $html_object_2." class='center' id='iconB".preg_replace("/_/","",$p2['lnk']."_group_edit_%KEY")."' 
+      src='images/".$p2['pic']."' alt='".$p2['alt']."' title='".$p2['tit']."'>";
+    return ($temp);
+  }
+
+
+  function reload()
+  {
+    /* Set base for all searches && initialise some vars */
+    $this->ogrouplist= array();
+    $base     = $this->DivListOGroup->selectedBase;
+    $filter   = "(gosaGroupObjects=[])";
+    $Regex    = $this->DivListOGroup->Regex;
+
+    $chk = array(
+        "UserGroups"          => "(gosaGroupObjects=*U*)" ,
+        "GroupGroups"         => "(gosaGroupObjects=*G*)" ,
+        "ApplicationGroups"   => "(gosaGroupObjects=*A*)" ,
+        "DepartmentGroups"    => "(gosaGroupObjects=*D*)" ,
+        "ServerGroups"        => "(gosaGroupObjects=*S*)" ,
+        "WorkstationGroups"   => "(gosaGroupObjects=*W*)" ,
+        "TerminalGroups"      => "(gosaGroupObjects=*T*)" ,
+        "PrinterGroups"       => "(gosaGroupObjects=*P*)" ,
+        "PhoneGroups"         => "(gosaGroupObjects=*F*)" );
+    /* Create filter */ 
+    foreach($chk as $chkBox => $FilterPart){
+      if($this->DivListOGroup->$chkBox){
+        $filter .=  $FilterPart;
+      }
+    }
+    $filter= "(&(cn=$Regex)(objectClass=gosaGroupOfNames)(|$filter))";
+
+    if($this->DivListOGroup->SubSearch){
+      $res= get_list($filter, "ogroups", $base, array("cn","objectClass","gosaGroupObjects"), GL_SIZELIMIT | GL_SUBSEARCH);
+    }else{
+      $res= get_list($filter, "ogroups", get_groups_ou().$base, array("cn","objectClass","gosaGroupObjects"), GL_SIZELIMIT );
+    }
+
+    $this->ogrouplist= $res;
+    ksort ($this->ogrouplist);
+    reset ($this->ogrouplist);
+    $tmp=array();
+    foreach($this->ogrouplist as $tkey => $val ){
+      $tmp[strtolower($val['cn'][0]).$val['cn'][0]]=$val;
+    }
+    ksort($tmp);
+    $this->ogrouplist=array();
+    foreach($tmp as $val){
+      $this->ogrouplist[]=$val;
+    }
+    reset ($this->ogrouplist);
+  }
+
+
+  function list_get_selected_items()
+  {
+    $ids = array();
+    foreach($_POST as $name => $value){
+      if(preg_match("/^item_selected_[0-9]*$/",$name)){
+        $id   = preg_replace("/^item_selected_/","",$name);
+        $ids[$id] = $id;
+      }
+    }
+    return($ids);
+  }
+
+
+  function copyPasteHandling_from_queue($s_action,$s_entry)
+  {
+    /* Check if Copy & Paste is disabled */
+    if(!is_object($this->CopyPasteHandler)){
+      return("");
+    }
+
+    /* Add a single entry to queue */
+    if($s_action == "cut" || $s_action == "copy"){
+
+      /* Cleanup object queue */
+      $this->CopyPasteHandler->cleanup_queue();
+      $dn = $this->ogrouplist[$s_entry]['dn'];
+      $this->CopyPasteHandler->add_to_queue($dn,$s_action,"ogrouptabs","OGROUPTABS","ogroups");
+    }
+
+
+    /* Add entries to queue */
+    if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
+
+      /* Cleanup object queue */
+      $this->CopyPasteHandler->cleanup_queue();
+
+      /* Add new entries to CP queue */
+      foreach($this->list_get_selected_items() as $id){
+        $dn = $this->ogrouplist[$id]['dn'];
+
+        if($s_action == "copy_multiple"){
+          $this->CopyPasteHandler->add_to_queue($dn,"copy","ogrouptabs","OGROUPTABS","ogroups");
+        }
+        if($s_action == "cut_multiple"){
+          $this->CopyPasteHandler->add_to_queue($dn,"cut","ogrouptabs","OGROUPTABS","ogroups");
+        }
+      }
+    }
+
+    /* Start pasting entries */
+    if($s_action == "editPaste"){
+      $this->start_pasting_copied_objects = TRUE;
+    }
+
+    /* Return C&P dialog */
+    if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
+
+      /* Load entry from queue and set base */
+      $this->CopyPasteHandler->load_entry_from_queue();
+      $this->CopyPasteHandler->SetVar("base",$this->DivListOGroup->selectedBase);
+
+      /* Get dialog */
+      $data = $this->CopyPasteHandler->execute();
+
+      /* Return dialog data */
+      if(!empty($data)){
+        return($data);
+      }
+    }
+    /* Automatically disable status for pasting */
+    if(!$this->CopyPasteHandler->entries_queued()){
+      $this->start_pasting_copied_objects = FALSE;
+    }
+    return("");
+  }
+
+
+  function save_object()
+  {
+    $this->DivListOGroup->save_object();
+  }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/ogroups/class_phonequeue.inc b/gosa-core/plugins/admin/ogroups/class_phonequeue.inc
new file mode 100644 (file)
index 0000000..f67ee78
--- /dev/null
@@ -0,0 +1,961 @@
+<?php
+
+class phonequeue extends plugin
+{
+  /* plugin specific values */
+  var $mail= "";
+  var $cn= "";
+  var $old_cn ="";
+
+  var $goFonTimeOut             ="20"; 
+  var $goFonMaxLen              ="20"; // 
+  var $goFonAnnounceFrequency   ="60"; // Annouce Frequency in seconds
+  var $goFonDialOptiont         ="";
+  var $goFonDialOptionT         ="";
+  var $goFonDialOptionh         ="";
+  var $goFonDialOptionr         ="";
+  var $goFonDialOptionH         ="";
+  var $goFonQueueAnnounce       ="gonicus-berlin-welcome";
+  var $goFonMusiconHold         ="default";
+  var $goFonWelcomeMusic        ="gonicus-berlin-welcome";
+  var $goFonQueueReportHold     ="yes";
+  var $goFonQueueYouAreNext     ="queue-youarenext";
+  var $goFonQueueThereAre       ="queue-thereare";
+  var $goFonQueueCallsWaiting   ="queue-callswaiting";
+  var $goFonQueueThankYou       ="queue-thankyou";
+  var $goFonQueueMinutes        ="queue-minutes"; 
+  var $goFonQueueSeconds        ="queue-seconds";
+  var $goFonQueueLessThan       ="queue-lessthan";
+  var $goFonQueueLanguage       ="queue-holdtime";
+  var $goFonQueueStrategy       ="ringall";
+  var $goFonQueueAnnounceHoldtime="yes";
+  var $telephoneNumber          =array();
+  var $goFonQueueMember         =array(); 
+  var $goFonDialOption          ="";
+  var $goFonQueueRetry          =5;
+
+  var $goFonQueueStrategyOptions=array();
+  var $goFonQueueStrategyOptionsR=array();
+  
+  var $old_phone_numbers        =array();
+
+  var $goFonHomeServer  = "0";
+  var $init_HomeServer  = "0";
+  var $goFonHomeServers = array();
+
+  var $view_logged = FALSE;
+
+  /* attribute list for save action */
+  var $attributes= array( "goFonTimeOut","goFonMaxLen","goFonAnnounceFrequency","goFonDialOptiont","goFonDialOptionT",
+      "goFonDialOptionh","goFonDialOptionr","cn","goFonHomeServer",
+      "goFonDialOptionH","goFonMusiconHold","goFonWelcomeMusic","goFonQueueReportHold","goFonQueueYouAreNext",
+      "goFonQueueThereAre","goFonQueueCallsWaiting","goFonQueueThankYou","goFonQueueMinutes","goFonQueueSeconds","goFonQueueLessThan",
+      "telephoneNumber","goFonQueueLanguage","goFonQueueStrategy","goFonQueueAnnounceHoldtime","goFonQueueAnnounce","goFonDialOption","goFonQueueRetry");
+
+  /* ObjectClass */
+  var $objectclasses= array("goFonQueue");
+
+
+
+  /* Pluigin initialization 
+   * - Check currently selected and available home server.
+   * - Set default home server if necessary
+   * - Parse phone options flags
+   * - Get phone numbers 
+   */
+  function phonequeue (&$config, $dn= NULL)
+  {
+    plugin::plugin($config, $dn);
+
+    /* Check server configurations
+     * Load all server configuration in $this->goFonHomeServers if available
+     *  and use first server as default if necessary.
+     */
+    if(array_key_exists('config',$_SESSION) &&
+        array_key_exists('SERVERS',$_SESSION['config']->data) &&
+        array_key_exists('FON',$_SESSION['config']->data['SERVERS']) &&
+        count($_SESSION['config']->data['SERVERS']['FON']) &&
+        is_callable("mysql_connect")
+      ) {
+
+      /* Set available server */
+      $this->goFonHomeServers = $_SESSION['config']->data['SERVERS']['FON'];
+
+      /* Set default server */
+      if($this->dn == "new"){
+        $this->goFonHomeServer = $this->goFonHomeServers[0]['DN'];
+      }
+
+      /* Remember inital home server, to be able to remove old entries */
+      $this->init_HomeServer = $this->goFonHomeServer;
+
+      /* get config */
+      if(!isset($this->goFonHomeServers[$this->goFonHomeServer])){
+        print_red(sprintf(_("The specified home server '%s' is not available in GOsa server configuration. Saving this account will create a new entry on the server '%s'. Use cancel if you do not want to create a new entry while ignoring old accounts."), preg_replace("/,/",", ",$this->goFonHomeServer), preg_replace("/,/",", ",$this->goFonHomeServers[0]['DN'])));
+        $this->goFonHomeServer = $this->goFonHomeServers[0]['DN'];
+        $this->init_HomeServer = $this->goFonHomeServers[0]['DN'];
+      }
+      $cur_cfg = $this->goFonHomeServers[$this->goFonHomeServer];
+    }
+
+
+    /* Variable init  
+     *  Load phone nubmers and parse dial options 
+     */
+    if($this->is_account){
+      if(isset($this->attrs['telephoneNumber'])){
+        $this->telephoneNumber=$this->attrs['telephoneNumber'];
+        unset($this->telephoneNumber['count']); 
+      }
+      for($i = 0; $i < strlen($this->goFonDialOption); $i++){
+        $name = "goFonDialOption".$this->goFonDialOption[$i];
+        $this->$name=$this->goFonDialOption[$i];
+      }
+    }
+
+    /* Set Queue announce hold time to true/false */
+    if(preg_match("/no/i",$this->goFonQueueAnnounceHoldtime)){
+      $this->goFonQueueAnnounceHoldtime=false;
+    }else{
+      $this->goFonQueueAnnounceHoldtime=true;
+    }
+
+    /* Define all available ringdown types */
+    $types= array('ringall'    =>_("ring all"),
+        'roundrobin' =>_("round robin"),
+        'leastrecent'=>_("least recently called"),
+        'fewestcalls'=>_("fewest completed calls"),
+        'random'     =>_("random"),
+        'rrmemory'   =>_("round robin with memory"));
+    $i = 0;
+    foreach($types as $type => $name){
+      $i++;
+      $this->goFonQueueStrategyOptions[$i]    =$name;
+      $this->goFonQueueStrategyOptionsR[$i]   =$type;
+      $tmp[$type] = $i; 
+    }
+    $this->goFonQueueStrategy= $tmp[$this->goFonQueueStrategy];
+    $this->old_cn = $this->cn;
+    $this->old_phone_numbers = $this->telephoneNumber;
+  }
+
+
+  /* This function ensures that the selected home server 
+   * and the initially selected home server are reachable and accessible  
+   */
+  function check_database_accessibility()
+  {
+    /* Check if mysql extension is available */
+    if(!is_callable("mysql_pconnect")){
+      return(_("Can't save any changes to asterisk database, there is currently no mysql extension available in your php setup."));
+    }
+
+    /********************
+     * Check currently selected home server
+     ********************/
+
+    $cfg_Current  = $this->goFonHomeServers[$this->goFonHomeServer];
+    $r_current    =  @mysql_pconnect($cfg_Current['SERVER'],$cfg_Current['LOGIN'],$cfg_Current['PASSWORD']);
+    if(!$r_current){
+      new log("debug","ogroups/".get_class($this),"",array(),@mysql_error($r_current));
+      return(sprintf(_("The MySQL home server '%s' isn't reachable as user '%s', check GOsa log for mysql error."),
+            $cfg_Current['SERVER'],$cfg_Current['LOGIN']));
+    }
+    $db_current  =  @mysql_select_db($cfg_Current['DB'],$r_current);
+    if(!$db_current){
+      new log("debug","ogroups/".get_class($this),"",array(),@mysql_error($r_current));
+      mysql_close($r_current);
+      return( sprintf(_("Can't select database '%s' on home server '%s'."),$cfg_Current['DB'],$cfg_Current['SERVER']));
+    }
+
+    /********************
+     * Check init home server
+     ********************/
+
+    if($this->initially_was_account){
+      $cfg_Init  = $this->goFonHomeServers[$this->init_HomeServer] ;
+      $r_init    =  @mysql_pconnect($cfg_Init['SERVER'],$cfg_Init['LOGIN'],$cfg_Init['PASSWORD']);
+      if(!$r_init){
+        new log("debug","ogroups/".get_class($this),"",array(),@mysql_error($r_init));
+        return(sprintf(_("The MySQL initial home server '%s' isn't reachable as user '%s', check GOsa log for mysql error."),
+              $cfg_Init['SERVER'],$cfg_Init['LOGIN']));
+      }
+      $db_init  =  @mysql_select_db($cfg_Init['DB'],$r_init);
+      if(!$db_init){
+        new log("debug","ogroups/".get_class($this),"",array(),@mysql_error($r_init));
+        mysql_close($r_init);
+        return( sprintf(_("Can't select database '%s' on initial home server '%s'."),$cfg_Init['DB'],$cfg_Init['SERVER']));
+      }
+    }
+  }
+
+  
+  /* Display plugin ui */
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","ogroups/".get_class($this),$this->dn);
+    }
+
+    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->parent !== NULL){
+      if ($this->is_account){
+        $display= $this->show_disable_header(_("Remove the phone queue from this Account"),
+            _("Phone queue is enabled for this group. You can disable it by clicking below."));
+      } else {
+        $display= $this->show_enable_header(_("Create phone queue"),
+            _("For this group the phone queues are disabled. You can enable them by clicking below."));
+        return ($display);
+      }
+    }
+
+    if($this->acl_is_writeable("telephoneNumber")){
+
+      /* Add queue number */ 
+      if(isset($_POST['add_phonenumber'])&&(isset($_POST['phonenumber']))&&(!empty($_POST['phonenumber']))){
+        if((!in_array($_POST['phonenumber'],$this->telephoneNumber))&&(is_numeric($_POST['phonenumber']))){
+          $this->telephoneNumber[]=$_POST['phonenumber'];
+        }
+      }
+
+      /* Delete queue number */ 
+      if(isset($_POST['delete_phonenumber'])&&(isset($_POST['goFonQueueNumber_List']))){
+        unset($this->telephoneNumber[$_POST['goFonQueueNumber_List']]);
+      }
+
+      /* queue number up */ 
+      if(isset($_POST['up_phonenumber'])&&(isset($_POST['goFonQueueNumber_List']))){
+        if($_POST['goFonQueueNumber_List']>0){
+          $up   = $this->telephoneNumber[$_POST['goFonQueueNumber_List']];
+          $down = $this->telephoneNumber[$_POST['goFonQueueNumber_List']-1];
+          $this->telephoneNumber[$_POST['goFonQueueNumber_List']]    = $down;
+          $this->telephoneNumber[$_POST['goFonQueueNumber_List']-1]  = $up;
+        }
+      }
+
+      /* Queuenumber down */
+      if(isset($_POST['down_phonenumber'])&&(isset($_POST['goFonQueueNumber_List']))){
+        if(isset($this->telephoneNumber[($_POST['goFonQueueNumber_List']+1)])){
+          $up   = $this->telephoneNumber[$_POST['goFonQueueNumber_List']+1];
+          $down = $this->telephoneNumber[$_POST['goFonQueueNumber_List']];
+          $this->telephoneNumber[$_POST['goFonQueueNumber_List']+1]    = $down;
+          $this->telephoneNumber[$_POST['goFonQueueNumber_List']]  = $up;
+        }
+        $this->telephoneNumber[$_POST['goFonQueueNumber_List']]  = $up;
+      }
+    }
+
+    $tmp = array();
+    foreach($this->telephoneNumber as $val){
+      if(!empty($val)){
+        $tmp[]= $val;
+      }
+    }  
+    $this->telephoneNumber=$tmp;
+
+    /* Assign samrty variables */
+    $smarty= get_smarty();
+    $smarty->assign("goFonQueueLanguageOptions",get_languages(FALSE,TRUE));
+    $smarty->assign("goFonQueueStrategyOptions", $this->goFonQueueStrategyOptions);
+
+    /* Set acls */
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translated){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+    foreach($this->attributes as $key => $val){
+      $smarty->assign($val,$this->$val);  
+      if($this->$val == false){
+        $smarty->assign($val."CHK","");
+      }else{
+        $smarty->assign($val."CHK"," checked ");
+      }
+    }
+    
+    /* Create array with goFonHomeServer */
+    $tmp = array();
+    foreach($this->goFonHomeServers as $dn => $val){
+      if(!is_numeric($dn)){
+        $tmp[$dn]  = $val['SERVER'];
+      }
+    }
+    $smarty->assign("goFonHomeServers",$tmp);
+
+    return ($display.$smarty->fetch (get_template_path('phonequeue.tpl', TRUE)));
+  }
+
+
+  /* Check formular input */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+    if(!count($this->goFonHomeServers)){
+      $message[] = _("There must be at least one server with an asterisk database to create a phone queue.");
+    }
+    if(empty($this->goFonHomeServer)){
+      $message[] = _("Please select a valid goFonHomeServer.");
+    }
+    if($this->is_number_used()){
+      $message[] = $this->is_number_used();
+    }
+    if(!((is_numeric($this->goFonTimeOut))||(empty($this->goFonTimeOut)))){
+      $message[] = _("Timeout must be numeric");
+    }
+    if(!((is_numeric($this->goFonQueueRetry))||(empty($this->goFonQueueRetry)))){
+      $message[] = _("Retry must be numeric");
+    }
+    if(!((is_numeric($this->goFonMaxLen))||(empty($this->goFonMaxLen)))){
+      $message[] = _("Max queue length must be numeric");
+    }
+    if(!((is_numeric($this->goFonAnnounceFrequency))||(empty($this->goFonAnnounceFrequency)))){
+      $message[] = _("Announce frequency must be numeric");
+    }
+    if(count($this->telephoneNumber)==0){
+      $message[] = _("There must be least one queue number defined.");
+    }
+
+    /* check if add to database could be successfull  */
+    $str = $this->add_to_database();
+    if(!empty($str)){
+      $message[] = $str;
+    }
+    return $message;
+  }
+
+
+  /* This function removes the old database entries. 
+   * If this entry should be removed or the home server has changed
+   *  this function is called to ensure that all old entries will be deleted.
+   */
+  function remove_from_database($save = false)
+  {
+    /* Check if we must remove old entries */
+    if($this->initially_was_account){
+
+      /* Check if there is at least on server configuration */
+      if(!count($this->goFonHomeServers)){
+        return( _("There is currently no asterisk server defined. Possibly you are missing a server that handles the asterisk management (goFonServer). Your settings can't be saved to asterisk database."));
+      }
+
+      /********************
+       * Get configuration and check it
+       ********************/
+
+      /* Check if databases are reachable, returns an error string if anything fails  */
+      $error_str = $this->check_database_accessibility();
+      if($error_str){
+        return($error_str);
+      }
+
+      /* Connect to current database to be able to add new entries */
+      $cfg_Current  = $this->goFonHomeServers[$this->init_HomeServer] ;
+      $res_cur      =  @mysql_pconnect($cfg_Current['SERVER'],$cfg_Current['LOGIN'],$cfg_Current['PASSWORD']);
+      $db_cur       =  @mysql_select_db($cfg_Current['DB'],$res_cur);
+
+      /* Create sql entries */
+      $delete[]=    "DELETE FROM ".$cfg_Current['EXT_TABLE']."    WHERE exten='".$this->old_cn."';\n";
+      $delete[]=    "DELETE FROM ".$cfg_Current['QUEUE_TABLE']."  WHERE name='".$this->old_cn."'; \n";
+      $delete[]=    "DELETE FROM ".$cfg_Current['QUEUE_MEMBER_TABLE']." WHERE queue_name='".$this->old_cn."';\n";
+      foreach($this->old_phone_numbers as $number){
+        $delete[]=    "DELETE FROM ".$cfg_Current['EXT_TABLE']."    WHERE exten='".$number."';\n";
+      }
+
+      /* Execute the queries */  
+      if($save){
+        foreach($delete as $sql){
+          $res = @mysql_query($sql,$res_cur);
+          if(!$res){
+            new log("debug","ogroups/".get_class($this),"",array(),@mysql_error($r_current));
+            return(_("Error while removing old queue entries from database.").
+                "&nbsp;"._("Please have a look a the gosa logfiles."));
+          }
+        }
+      }
+    }
+  }
+
+
+  /* This function handles the database entries for this 
+   *  queue. 
+   * Existing entries will be updated if possible.
+   */
+  function add_to_database($save = false)
+  {
+    /* Check if there is at least on server configuration */
+    if(!count($this->goFonHomeServers)){
+      return( _("There is currently no asterisk server defined. Possibly you are missing a server that handles the asterisk management (goFonServer). Your settings can't be saved to asterisk database."));
+    }
+
+    /********************
+     * Get configuration and check it
+     ********************/
+
+    /* Check if databases are reachable, returns an error string if anything fails  */
+    $error_str = $this->check_database_accessibility();
+    if($error_str){
+      return($error_str);
+    }
+
+    /* Connect to current database to be able to add new entries */
+    $cfg_Current  = $this->goFonHomeServers[$this->goFonHomeServer] ;
+    $res_cur      =  @mysql_pconnect($cfg_Current['SERVER'],$cfg_Current['LOGIN'],$cfg_Current['PASSWORD']);
+    $db_cur       =  @mysql_select_db($cfg_Current['DB'],$res_cur);
+
+    /* Connect to old home server and remove old entries if necessary */
+    if(($this->initially_was_account) && ($this->init_HomeServer != $this->goFonHomeServer)){
+      $str = $this->remove_from_database($save); 
+      if(!empty($str)){
+        return($str);;
+      }
+    }
+
+    /* Ensure that we have the new cn in $this->cn and the old cn in $this->old_cn */
+    $this->cn = $this->parent->by_object['ogroup']->cn;
+
+    if($save){
+  
+      /*****************
+       * Create queue table entry 
+       *****************/
+      /* Check if QUEUE_TABLE entry exists.
+       * If this entry is missing - create it 
+       *  else update the entry with new values.
+       */
+      $query = "SELECT * FROM ".$cfg_Current['QUEUE_TABLE']."  WHERE name='".$this->old_cn."';";
+      $res   = mysql_query($query,$res_cur);
+      if(!$res){
+        new log("debug","ogroups/".get_class($this),"",array(),@mysql_error($res_cur));
+        return(_("Could not detect old queue entry, query failed.")."&nbsp;"._("Please have a look a the gosa logfiles."));
+      }
+      $cnt = mysql_affected_rows($res_cur);
+
+
+      /* Create queue table entry 
+       * Leave unused options empty. 
+       */
+      $queue["announce"]              = "";
+      $queue["monitor_join"]          = "";
+      $queue["monitor_format"]        = "";
+      $queue["announce_round_seconds"]= "";   
+      $queue["wrapuptime"]            = "";
+      $queue["servicelevel"]          = "";
+      $queue["eventmemberstatus"]     = "";
+      $queue["eventwhencalled"]       = "";
+      $queue["memberdelay"]           = "";
+      $queue["weight"]                = "";
+      $queue["timeoutrestart"]        = "";
+
+      $queue["queue_holdtime"]        = $this->goFonQueueAnnounce;
+      $queue["queue_lessthan"]        = $this->goFonQueueLessThan;   
+      $queue["retry"]                 = $this->goFonQueueRetry;
+      $queue["reportholdtime"]        = "1";
+      $queue["joinempty"]             = "no";
+      $queue["leavewhenempty"]        = "yes";   
+
+      $queue["context"]               = "default";
+      $queue["name"]                  = $this->cn;  
+      $queue["timeout"]               = $this->goFonTimeOut; 
+      $queue["maxlen"]                = $this->goFonMaxLen;
+      $queue["strategy" ]             = $this->goFonQueueStrategyOptionsR[$this->goFonQueueStrategy];
+      $queue["queue_thankyou"]        = $this->goFonQueueThankYou;   
+      $queue["queue_reporthold"]      = $this->goFonQueueReportHold; 
+      $queue["announce_frequency"]    = $this->goFonAnnounceFrequency;
+      $queue["queue_youarenext"]      = $this->goFonQueueYouAreNext;   
+      $queue["queue_thereare"]        = $this->goFonQueueThereAre;   
+      $queue["queue_callswaiting"]    = $this->goFonQueueCallsWaiting;
+      $queue["queue_minutes"]         = $this->goFonQueueMinutes;
+      $queue["queue_seconds"]         = $this->goFonQueueSeconds;   
+      $queue["announce_holdtime"]     = $this->goFonQueueAnnounceHoldtime;   
+      $queue["musiconhold"]           = $this->goFonMusiconHold;
+
+
+      /* Check if we must create a new queue entry 
+       *  or if we can update an existing entry 
+       *  $cnt contains the number of entries matching this cn
+       */
+
+      /* Create new queue table entry 
+       */
+      if($cnt == 0){
+
+        /* Parse and Add Queue */
+        $entries = "";
+        $values  = "";
+        foreach($queue as $attr=>$val){
+          if($val == "") continue;
+          $entries.= "`".$attr."`,";
+          $values .= "'".$val."',";
+        }
+        $values  = preg_replace("/,$/","",$values);
+        $entries = preg_replace("/,$/","",$entries );
+        $SQL[]="INSERT INTO ".$cfg_Current['QUEUE_TABLE']." (".$entries.") VALUES (".$values.");";
+      }elseif($cnt == 1){
+
+        /* Update queue table entry 
+         */
+        $queue_old = @mysql_fetch_assoc($res);
+        foreach($queue_old as $name => $value){
+          if(isset($queue[$name]) && $queue[$name] == $value){
+            unset($queue[$name]);
+          }
+        }
+
+        /* Parse and Add Queue */
+        if(count($queue)){
+          $query = "UPDATE ".$cfg_Current['QUEUE_TABLE']." SET ";
+          foreach($queue as $key => $val){
+            $query.= "".$key."='".$val."',";
+          }
+          $query = preg_replace("/,$/","",$query);
+          $query.= " WHERE name='".$this->old_cn."';";
+          $SQL[] = $query;
+        }
+      }else{
+        return(sprintf(_("More than one entry in queue table found, that uses the name ('%s'). Please fix this issue manually first."),$this->cn));
+      }
+
+
+      /*****************
+       * Create queue member entries
+       *****************/
+      
+      /* Add the queue member entries 
+       * First we must remove all old user entries. 
+       * to be able to add a clean set of members.
+       */ 
+      $SQL[]= "DELETE FROM ".$cfg_Current['QUEUE_MEMBER_TABLE']." WHERE queue_name='".$this->cn."';";
+      $SQL[]= "DELETE FROM ".$cfg_Current['QUEUE_MEMBER_TABLE']." WHERE queue_name='".$this->old_cn."';";
+      
+      /* Append new Member for this queue */ 
+      $queueuser =array();
+      $i = 0;
+      $parent = $this->parent->by_object['ogroup'];
+
+      
+      $ldap = $this->config->get_ldap_link();
+      foreach($parent->memberList as $member => $mem_data){
+        $ldap->cat($member,array("goFonHomeServer","objectClass","dn","uid"));
+        if($ldap->count()){
+
+          $obj = $ldap->fetch();
+
+          /* Calculate server and account dependencies */
+          $is_acc = in_array("goFonAccount",$obj['objectClass']);
+          $is_home= isset($obj['goFonHomeServer'][0]) && $obj['goFonHomeServer'][0] == $this->goFonHomeServer; 
+
+          /* Append user to list of queue member,
+           *  only if user has phoneAccount extension && is on same home server */
+          if($is_acc && $is_home){
+            $i ++ ;
+            $queueuser[$i]['queue_name']  = $this->cn; 
+            $queueuser[$i]['interface']   = "SIP/".$obj['uid'][0]; 
+            $queueuser[$i]['penalty']     = 1; 
+          }
+        }
+      }
+
+      /* Parse and Add members to query Array */
+      if(is_array($queueuser)){
+        foreach($queueuser as $user){
+          $entries = "";
+          $values  = "";
+          foreach($user as $attr => $val){
+            $entries.= "`".$attr."`,"; 
+            $values .= "'".$val."',";
+          }
+          $values  = preg_replace("/,$/","",$values);
+          $entries = preg_replace("/,$/","",$entries );
+
+          $SQL[]="INSERT INTO ".$cfg_Current['QUEUE_MEMBER_TABLE']." (".$entries.") VALUES (".$values.")"; 
+        }
+      }
+      
+
+      /*****************
+       * Create extension entries
+       *****************/
+      
+      /* Add the extension entries 
+       * First we must remove all old entensions. 
+       */ 
+      $SQL[]=  "DELETE FROM ".$cfg_Current['EXT_TABLE']."  WHERE exten='".$this->cn."';\n";
+      $SQL[]=  "DELETE FROM ".$cfg_Current['EXT_TABLE']."  WHERE exten='".$this->old_cn."';\n";
+
+      /* Delete old enxtension entries for the old telephone nubmer  */
+      if(is_array($this->old_phone_numbers)){
+        foreach($this->old_phone_numbers as $phone){
+          $SQL[]= "DELETE FROM ".$cfg_Current['EXT_TABLE']." WHERE exten='".$phone."';\n";
+        }
+      }
+      
+      /* Delete enxtension entries for telephone numbers  */
+      if(is_array($this->telephoneNumber)){
+        foreach($this->telephoneNumber as $phone){
+          $SQL[]= "DELETE FROM ".$cfg_Current['EXT_TABLE']." WHERE exten='".$phone."';\n";
+        }
+      }
+
+      /* Create a extension entry fpr each telephoneNumber */
+      $i_insert_only_once = false;
+      $prio = 11;   // This represents the priority for each telephoneNumber 
+      foreach($this->telephoneNumber as $num){
+
+        /* The naming refrences */
+        if($i_insert_only_once == false){
+          $i_insert_only_once = true;
+          $a_ext[$i]['context']  = 'GOsa';
+          $a_ext[$i]['exten']    = $this->cn;
+          $a_ext[$i]['priority'] = 1;
+          $a_ext[$i]['app']      = "Goto";
+          $a_ext[$i]['appdata']  = $num."|1";
+          $i ++ ; 
+        }
+
+        /* If there is currently no user for this queue 
+         * Play no service sound file and return to default context.  
+         */
+        if(count($queueuser)==0){
+          $a_ext[$i]['context']  = 'GOsa';
+          $a_ext[$i]['exten']    = $num;
+          $a_ext[$i]['priority'] = 1;
+          $a_ext[$i]['app']      = "SetLanguage";
+          $a_ext[$i]['appdata']  = "de";
+          $i ++ ; 
+
+          $a_ext[$i]['context']  = 'GOsa';
+          $a_ext[$i]['exten']    = $num;
+          $a_ext[$i]['priority'] = 2;
+          $a_ext[$i]['app']      = "Playback";
+          $a_ext[$i]['appdata']  = "ss-noservice";
+          $i ++ ; 
+
+          $a_ext[$i]['context']  = 'GOsa';
+          $a_ext[$i]['exten']    = $num;
+          $a_ext[$i]['priority'] = 3;
+          $a_ext[$i]['app']      = "Goto";
+          $a_ext[$i]['appdata']  = "default";
+          $i ++ ; 
+        }else{
+
+          /* Dcrement priority to avoid using same priority twice */
+          $prio --;
+
+          /* Wait for 2 seconds */
+          $a_ext[$i]['context']  = 'GOsa';
+          $a_ext[$i]['exten']    = $num;
+          $a_ext[$i]['priority'] = 1;
+          $a_ext[$i]['app']      = "Wait";
+          $a_ext[$i]['appdata']  = "2";
+          $i ++ ; 
+    
+          /* Set language to queue language */
+          $a_ext[$i]['context']  = 'GOsa';
+          $a_ext[$i]['exten']    = $num;
+          $a_ext[$i]['priority'] = 2;
+          $a_ext[$i]['app']      = "SetLanguage";
+          $a_ext[$i]['appdata']  = $this->goFonQueueLanguage;
+          $i ++ ; 
+  
+          /* Play welcome sound file */
+          $a_ext[$i]['context']  = 'GOsa';
+          $a_ext[$i]['exten']    = $num;
+          $a_ext[$i]['priority'] = 3;
+          $a_ext[$i]['app']      = "Playback";
+          $a_ext[$i]['appdata']  = $this->goFonWelcomeMusic;
+          $i ++ ; 
+
+          /* Set CID name */
+          $a_ext[$i]['context']  = 'GOsa';
+          $a_ext[$i]['exten']    = $num;
+          $a_ext[$i]['priority'] = 4;
+          $a_ext[$i]['app']      = "SetCIDName";
+          if(!empty($this->parent->by_object['ogroup']->description)){
+            $a_ext[$i]['appdata']  = $this->parent->by_object['ogroup']->description;
+          }else{
+            $a_ext[$i]['appdata']  = $this->cn." - ".$num;
+          }
+          $i ++ ; 
+
+          /* Set queue priority */
+          $a_ext[$i]['context']  = 'GOsa';
+          $a_ext[$i]['exten']    = $num;
+          $a_ext[$i]['priority'] = 5;
+          $a_ext[$i]['app']      = "SetVar";
+          $a_ext[$i]['appdata']  = "QUEUE_PRIO=".$prio;
+          $i ++ ; 
+
+          /* Open queue */
+          $a_ext[$i]['context']  = 'GOsa';
+          $a_ext[$i]['exten']    = $num;
+          $a_ext[$i]['priority'] = 6;
+          $a_ext[$i]['app']      = "Queue";
+          $a_ext[$i]['appdata']  =  $this->cn;
+            "|".
+            $this->goFonDialOptiont.
+            $this->goFonDialOptionT.
+            $this->goFonDialOptionh.
+            $this->goFonDialOptionH.
+            $this->goFonDialOptionr;
+        }
+
+        $i++;
+      }
+
+      /* Parse and Add Extension entries */
+      foreach($a_ext as $ext){
+        $entries = "";
+        $values  = "";
+        foreach($ext as $attr => $val){
+          $entries.= "`".$attr."`,";
+          $values .= "'".$val."',";
+        }
+        $values  = preg_replace("/,$/","",$values);
+        $entries = preg_replace("/,$/","",$entries );
+        $SQL[]="INSERT INTO ".$cfg_Current['EXT_TABLE']." (".$entries.") VALUES (".$values.")";
+      }
+
+      /* Do all collected mysql queries 
+       */
+      foreach($SQL as $query)
+      $res   = mysql_query($query,$res_cur);
+      if(!$res){
+        new log("debug","ogroups/".get_class($this),"",array(),@mysql_error($res_cur));
+        return(_("Mysql query failed.")."&nbsp;"._("Please have a look a the gosa logfiles."));
+      }
+    }
+    @mysql_close($r_con);
+    return(false);
+  }
+
+
+  /* This function checks if the given phonenumbers 
+   *  are available or already in use
+   */
+  function is_number_used()
+  {
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(&(& (!(uid=".$this->cn."))
+                        (!(cn=".$this->cn.")))
+                     (| (objectClass=goFonAccount)
+                        (objectClass=goFonQueue)
+                        (objectClass=goFonConference)))", array("telephoneNumber","cn","uid"));
+    while($attrs = $ldap->fetch()) {
+      unset($attrs['telephoneNumber']['count']);
+      foreach($attrs['telephoneNumber'] as $tele){
+        if(!isset($attrs['cn'][0])) $attrs['cn'][0]=$attrs['dn'];
+        if(!isset($attrs['uid'][0])) $attrs['uid'][0]=$attrs['dn'];
+        $numbers[$tele]=$attrs;
+      }
+    }
+
+    foreach($this->telephoneNumber as $num){
+      if((isset($numbers[$num]))&&(($numbers[$num]['cn'][0]!= $this->attrs['cn'][0]))){
+        if(isset($numbers[$num]['uid'][0])){
+          return sprintf(_("The specified telephonenumber '%s' is already assigned to '%s'."),$num,$numbers[$num]['uid'][0]);
+        }else{
+          return sprintf(_("The specified telephonenumber '%s' is already assigned to '%s'."),$num,$numbers[$num]['cn'][0]);
+        }
+      }
+    }
+  }
+
+
+  /* Get posted attributes */
+  function save_object()
+  {
+    plugin::save_object();  
+    if(isset($_POST['phonenumber'])){
+      foreach(array("goFonDialOptiont","goFonDialOptionT","goFonDialOptionh","goFonDialOptionr","goFonDialOptionH","goFonMusiconHold") as $val){
+        if(isset($_POST[$val])){
+          $this->$val = $_POST[$val];
+        }else{
+          $this->$val = false;
+        }
+      }
+      if(isset($_POST['goFonQueueAnnounceHoldtime'])){
+        $this->goFonQueueAnnounceHoldtime = "yes";
+      }else{
+        $this->goFonQueueAnnounceHoldtime = false;
+      }
+    }
+  }
+
+
+  function save()
+  {
+    $ldap= $this->config->get_ldap_link();
+
+    plugin::save();
+
+    /* Create dial option attribute */
+    $this->attrs['goFonDialOption'] = "";
+    foreach(array("goFonDialOptiont","goFonDialOptionT","goFonDialOptionr","goFonDialOptionh","goFonDialOptionH","cn") as $val){
+      $this->attrs['goFonDialOption'].=$this->$val; 
+      unset($this->attrs[$val]); 
+    }
+    if(empty($this->attrs['goFonDialOption'])) {
+      $this->attrs['goFonDialOption']=array();
+    }
+
+    /* Set announce hold time to yes no .. */
+    if($this->goFonQueueAnnounceHoldtime != "no" ){
+      $this->attrs['goFonQueueAnnounceHoldtime'] = "yes";
+    }else{
+      $this->attrs['goFonQueueAnnounceHoldtime'] = "no";
+    }
+
+    /* Set strategy */
+    $this->attrs['goFonQueueStrategy'] = $this->goFonQueueStrategyOptionsR[$this->goFonQueueStrategy];
+
+    /* Add database entry, display error and abort if this fails */
+    $str = $this->add_to_database(true);
+    if(!empty($str)){
+      print_red($str);
+    }
+
+    /* Save data to LDAP */
+    $ldap->cd($this->dn);
+    $this->cleanup();
+    $ldap->modify ($this->attrs); 
+
+    if($this->initially_was_account){
+      new log("modify","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      new log("modify","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
+
+    show_ldap_error($ldap->get_error(), _("Saving phone queue 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");
+    }
+  }
+
+
+  /* remove object from parent */
+  function remove_from_parent()
+  {
+    /* Cancel if nothing is to do here */
+    if (!$this->initially_was_account){
+      return;
+    }
+
+    /* Remove database entries, 
+     *  if fails display errors and abort
+     */
+    $str = $this->remove_from_database(true);
+    if(!empty($str)){
+      print_red($str);
+      return false;
+    }
+  
+    /* Remove all temporary attributes */
+    $tmp = array_flip($this->attributes);
+    foreach(array("goFonDialOptiont","goFonDialOptionT","goFonDialOptionr","goFonDialOptionh","goFonDialOptionH","cn") as $val){
+      unset($this->$val);
+      unset($this->attrs[$val]);
+      unset($tmp[$val]);
+    }   
+    foreach(array_flip($tmp) as $key => $val){
+      $tmp2[]=$val;
+    } 
+    $this->attributes = $tmp2;
+
+    /* include global link_info */
+    $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); 
+    new log("remove","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    show_ldap_error($ldap->get_error(), _("Removing phone queue failed"));
+  }
+
+  
+  function getCopyDialog()
+  {
+    $str  = "";
+    $str .= _("Phone number");
+    $str .= "&nbsp;<input type='text' name='telephoneNumber' value='".$this->telephoneNumber."'>";
+    return($str);
+  }
+
+
+  function saveCopyDialog()
+  {
+    if(isset($_POST['telephoneNumber'])){
+      $this->telephoneNumber = $_POST['telephoneNumber'];
+    }
+  }
+
+
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Phone"),
+          "plDescription" => _("Phone group"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 3,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("ogroups"),
+          "plProvidedAcls"=> array(
+
+            "goFonTimeOut"              => _("Timeout"),
+            "goFonMaxLen"               => _("Max queue length"),
+            "goFonHomeServer"           => _("Home server"),
+            "goFonAnnounceFrequency"    => _("Announce frequency"),
+            "goFonDialOptiont"          => _("Allow the called user to transfer his call"),
+            "goFonDialOptionT"          => _("Allows calling user to transfer call"),
+            "goFonDialOptionh"          => _("Allow the called to hangup by pressing *"),
+            "goFonDialOptionr"          => _("Ring instead of playing background music"),
+            "goFonDialOptionH"          => _("Allows calling to hangup by pressing *"),
+
+            "goFonMusiconHold"          => _("Music on hold"),
+            "goFonWelcomeMusic"         => _("Welcome music"),
+            "goFonQueueReportHold"      => _("Report hold time"),
+            "goFonQueueYouAreNext"      => _("'You are next' sound"),
+            "goFonQueueThereAre"        => _("'There are' sound"),
+            "goFonQueueCallsWaiting"    => _("'Call waiting' sound"),
+            "goFonQueueThankYou"        => _("'Thank you' sound"),
+            "goFonQueueMinutes"         => _("'Minutes' sound"),
+            "goFonQueueSeconds"         => _("'Seconds' sound"),
+            "goFonQueueLessThan"        => _("'Less than' sound"),
+            "telephoneNumber"           => _("Queue phone number"),
+            "goFonQueueLanguage"        => _("Language"),
+            "goFonQueueStrategy"        => _("Method"),
+            "goFonQueueAnnounceHoldtime"=> _("Announce holdtime"),
+            "goFonQueueAnnounce"        => _("Announce"),
+            "goFonQueueRetry"           => _("Retry"))
+              ));
+  }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/ogroups/class_termgroup.inc b/gosa-core/plugins/admin/ogroups/class_termgroup.inc
new file mode 100644 (file)
index 0000000..53c59ec
--- /dev/null
@@ -0,0 +1,432 @@
+<?php
+
+class termgroup extends plugin
+{
+  /* attribute list for save action */
+  var $members= array();
+
+  var $gotoMode           = "locked";
+  var $gotoSyslogServer   = "";
+  var $gotoNtpServer      = array();
+  var $gotoNtpServers     = array();
+  var $modes              = array();
+  var $inheritTimeServer  = true;
+  var $is_account                    = true; 
+  var $orig_dn            = "";
+  var $didAction          = FALSE;
+  var $mapActions   = array("reboot"          => "localboot",
+                            "instant_update"  => "softupdate",
+                            "update"          => "sceduledupdate",
+                            "reinstall"       => "install",
+                            "rescan"          => "",
+                            "memcheck"        => "memcheck",
+                            "sysinfo"         => "sysinfo");
+
+  var $attributes     = array("gotoMode","gotoSyslogServer", "gotoNtpServer");
+  var $objectclasses  = array("gotoWorkstationTemplate");
+  var $CopyPasteVars  = array("gotoNtpServers","modes","inheritTimeServer","members");
+  var $view_logged    = FALSE;
+
+
+  function termgroup (&$config, $dn= NULL, $parent= NULL)
+  {
+    /***************
+      Some  initialisations
+     ***************/
+
+    plugin::plugin($config, $dn, $parent);
+
+    $ldap= $config->get_ldap_link();
+
+    $this->is_account = true;
+    $this->modes["active"]= _("Activated");
+    $this->modes["locked"]= _("Locked");
+//    $this->modes["memcheck"]= _("Memory test");
+//    $this->modes["sysinfo"]= _("System analysis");
+
+    $this->orig_dn =   $this->dn;
+
+    /*************** 
+      Get mac addresses from member objects  
+     ***************/
+
+    /* We're only interested in the terminal members here, evaluate
+       these... */
+    if(isset($this->attrs['member'])){
+      for ($i= 0; $i<$this->attrs['member']['count']; $i++){
+        $member= $this->attrs['member'][$i];
+        $ldap->cat($member, array('objectClass', 'macAddress', 'cn'));
+        if (preg_match("/success/i", $ldap->error)){
+          $attrs = $ldap->fetch();
+          if (in_array("gotoTerminal", $attrs['objectClass']) ||
+              in_array("gotoWorkstation", $attrs['objectClass'])){
+            if (isset($attrs['macAddress'])){
+              $this->members[$attrs['cn'][0]]= $attrs['macAddress'][0];
+            } else {
+              $this->members[$attrs['cn'][0]]= "";
+            }
+          }
+        }
+      }
+    }
+
+    /*************** 
+      Perpare NTP settings 
+     ***************/
+
+    /* Create used ntp server array */
+    $this->gotoNtpServer= array();
+    if(isset($this->attrs['gotoNtpServer'])){
+      $this->inheritTimeServer = false;
+      unset($this->attrs['gotoNtpServer']['count']);
+      foreach($this->attrs['gotoNtpServer'] as $server){
+        $this->gotoNtpServer[$server] = $server;
+      }
+    }
+
+    /* Set inherit checkbox state */
+    if(in_array("default",$this->gotoNtpServer)){
+      $this->inheritTimeServer = true;
+      $this->gotoNtpServer=array();
+    }
+
+    /* Create available ntp options */
+    $this->gotoNtpServers = $this->config->data['SERVERS']['NTP'];
+    foreach($this->gotoNtpServers as $key => $server){
+      if($server == "default"){
+        unset($this->gotoNtpServers[$key]);
+      }
+    }
+  }
+
+  function check()
+  {
+     /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    if (!$this->acl_is_createable() && $this->dn == "new"){
+      $message[]= _("You have no permissions to create a workstation on this 'Base'.");
+    }
+
+    /* Check for valid ntpServer selection */
+    if((!$this->inheritTimeServer) && (!count($this->gotoNtpServer))){
+      $message[]= _("There must be at least one NTP server selected.");
+    }
+    return($message);
+  }
+
+  function remove_from_parent()
+  {
+    /* Workstation startup is using gotoWorkstationTemplate too,
+        if we remove this oc all other not manged attributes will cause errors */
+    if(isset($this->attrs['gotoKernelParameters'])){
+      $this->objectclasses = array();
+    }
+
+    /* Remove acc */
+    plugin::remove_from_parent();
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->orig_dn);
+    $ldap->modify($this->attrs);
+    $this->handle_post_events("remove");
+    new log("remove","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+  }
+
+
+  function update_term_member_FAIstate($act)
+  {
+    /* Get required informations */
+    $og     = $this->parent->by_object['ogroup'];
+    $allobs = $og->objcache;
+
+    /* Get correct value for FAIstate */
+    $action = $this->mapActions[$act];
+
+    /* Get ldap connection */
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd ($this->config->current['BASE']);
+
+    /* Foreach member of mthis ogroup  ... */
+    foreach($og->member  as $key ){
+  
+      /* check objectClasses and create attributes array */
+      $attrs = array("FAIstate"=>$action);  
+      for($i = 0; $i < $allobs[$key]['objectClass']['count'] ; $i ++){
+        $attrs['objectClass'][] = $allobs[$key]['objectClass'][$i];
+      }
+      if(($attrs['FAIstate'] != "") && (!in_array("FAIobject",$attrs['objectClass']))){
+        $attrs['objectClass'][] = "FAIobject";
+      }
+      if($attrs['FAIstate'] == ""){
+        $attrs['FAIstate'] = array();
+      }
+
+      /* If this objects is workstation,terminal or server upodate FAIstate */ 
+      if(preg_match("/(w|t|s)/i",$allobs[$key]['type'])){
+        $ldap->cd ($key);
+        $ldap->modify($attrs);
+        show_ldap_error($ldap->get_error(),sprintf(_("Setting action state (FAIstate) failed for object '%s', value was '%s'."),$key,$action));
+      }
+    }
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    if(!$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","ogroups/".get_class($this),$this->dn);
+    }
+
+    /*************** 
+      Handle requested action
+     ***************/
+
+    /* Watch for events */
+    if (isset($_POST['action'])){
+      $macaddresses="";
+      $names="";
+      foreach ($this->members as $cn => $macAddress){
+        $macaddresses.= "$macAddress ";
+        $names.= "$cn ";
+      }
+
+      if (isset($_POST['action'])){
+  
+        /* Update members fai state */
+        $this->update_term_member_FAIstate(trim($_POST['saction']));
+
+        $cmd = $this->config->search("workgeneric", "ACTIONCMD",array('tabs'));
+
+        if ($cmd == ""){
+          print_red(_("No ACTIONCMD definition found in your gosa.conf"));
+        } else {
+          exec ($cmd." ".$macaddresses." ".escapeshellarg($_POST['saction']), $dummy, $retval);
+          if ($retval != 0){
+            print_red(sprintf(_("Execution of '%s' failed!"), $cmd));
+          } else {
+            $this->didAction= TRUE;
+
+            /* Get dns from member objects. Create ldap object  */
+            $member = $this->parent->by_object['ogroup']->member;
+            $ldap = $this->config->get_ldap_link();
+            $ldap->cd($this->config->current['BASE']);
+
+            /* walk trough members and add FAIstate */ 
+            foreach($member as $dn =>  $object){
+
+              /* Get object */
+              $ldap->cat($dn,array("objectClass"));
+              $res                = $ldap->fetch();
+              $attrs              = array();
+
+              /* Add FAI state */
+              $attrs['FAIstate']  = "";
+              if(isset($this->mapActions[$_POST['saction']])){
+                $attrs['FAIstate'] = $this->mapActions[$_POST ['saction']];
+              }
+
+              /* Fix objectClass index */
+              for($i = 0; $i < $res['objectClass']['count'] ; $i ++){
+                $attrs['objectClass'][] = $res['objectClass'][$i];
+              }
+
+              /* Check if we must add the objectClass */
+              if(($attrs['FAIstate'] != "") && (!in_array("FAIobject",$attrs['objectClass']))){
+                $attrs['objectClass'][] = "FAIobject";
+              }
+
+              if($attrs['FAIstate'] == ""){
+                $attrs['FAIstate'] = array();
+              }
+
+              $ldap->cd($dn);
+              $ldap->modify($attrs);
+              show_ldap_error($ldap->get_error(), sprintf(_("Saving of system workstation/generic (FAIstate) with dn '%s' failed."),$dn));
+            }
+            $this->didAction= TRUE;
+          }
+        }
+      }
+    }
+
+
+    /*************** 
+      Add remove NTP server
+     ***************/
+
+    /* Add new ntp Server to our list */
+    if((isset($_POST['addNtpServer'])) && (isset($_POST['gotoNtpServers']))){
+      $this->gotoNtpServer[$_POST['gotoNtpServers']] = $_POST['gotoNtpServers'];
+    }
+
+    /* Delete selected NtpServer for list of used servers  */
+    if((isset($_POST['delNtpServer'])) && (isset($_POST['gotoNtpServerSelected']))){
+      foreach($_POST['gotoNtpServerSelected'] as $name){
+        unset($this->gotoNtpServer[$name]);
+      }
+    }
+
+
+    /*************** 
+      Prepare smarty 
+     ***************/
+
+    /* Set government mode */
+    $smarty= get_smarty();
+
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translated) {
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr,      $this->$attr);
+    }
+
+    /* Variables */
+    foreach(array("gotoMode","gotoNtpServer") as $val){
+      $smarty->assign($val."_select", $this->$val);
+    }
+
+    $smarty->assign("actions", array("halt" => _("Switch off"), "reboot" => _("Reboot"),
+          "instant_update" => _("Instant update"),
+          "update" => _("Scheduled update"),
+          "reinstall" => _("Reinstall"),
+          "rescan" => _("Rescan hardware"),
+          "memcheck" => _("Memory test"),
+          "sysinfo"  => _("System analysis")));
+
+    $smarty->assign("inheritTimeServer",$this->inheritTimeServer);
+    $smarty->assign("modes", $this->modes);
+
+    $tmp = array();
+    foreach($this->gotoNtpServers as $server){
+      if(!in_array($server,$this->gotoNtpServer)){
+        $tmp[$server] = $server;
+      }
+    }
+
+    $smarty->assign("gotoNtpServers",$tmp); 
+    $smarty->assign("syslogservers", $this->config->data['SERVERS']['SYSLOG']); 
+    $smarty->assign("gotoSyslogServer_select", $this->gotoSyslogServer); 
+
+    /* Show main page */
+    return ($smarty->fetch (get_template_path('termgroup.tpl', TRUE)));
+  }
+
+  function save_object()
+  {
+    plugin::save_object();  
+    /* Set inherit mode */
+    if(isset($_POST['workgeneric_posted'])){
+      if(isset($_POST["inheritTimeServer"])){
+        $this->inheritTimeServer = true;
+      }else{
+        $this->inheritTimeServer = false;
+      }
+    }
+  }
+
+  /* Save to LDAP */
+  function save()
+  {
+    plugin::save();
+
+    /***************
+      Prepare special vars 
+     ***************/
+
+    /* Unset some special vars ... */
+    foreach (array("gotoSyslogServer") as $val){
+      if ($this->attrs[$val] == "default"){
+        $this->attrs[$val]= array();
+      }
+    }
+
+    /* Update ntp server settings */
+    if($this->inheritTimeServer){
+      $this->attrs['gotoNtpServer'] = "default";
+    }else{
+      /* Set ntpServers */
+      $this->attrs['gotoNtpServer'] = array();
+      foreach($this->gotoNtpServer as $server){
+        $this->attrs['gotoNtpServer'][] = $server;
+      }
+    }
+
+
+    /***************
+      Write to ldap 
+     ***************/
+
+    /* Write back to ldap */
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd($this->dn);
+    $this->cleanup();
+    $ldap->modify ($this->attrs);
+
+    if($this->initially_was_account){
+      new log("modify","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      new log("create","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
+
+    if(!$this->didAction){
+      $this->handle_post_events("modify");
+    }
+    show_ldap_error($ldap->get_error(), _("Saving workstation failed"));
+
+  }
+  
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("System"),
+          "plDescription" => _("System group"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 5,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("ogroups"),
+          "plProvidedAcls"=> array(
+            "gotoMode"          => _("Mode"),     
+            "gotoSyslogServer"  => _("Syslog server"), 
+            "FAIstate"          => _("Action flag"), 
+            "gotoNtpServer"     => _("Ntp server"))
+          ));
+  }
+
+  function PrepareForCopyPaste($source)
+  {
+    /* Create used ntp server array */
+    $this->gotoNtpServer= array();
+
+    if(isset($source['gotoNtpServer'])){
+      $this->inheritTimeServer = false;
+      unset($source['gotoNtpServer']['count']);
+      foreach($source['gotoNtpServer'] as $server){
+        $this->gotoNtpServer[$server] = $server;
+      }
+    }
+
+    /* Set inherit checkbox state */
+    if(in_array("default",$this->gotoNtpServer)){
+      $this->inheritTimeServer = true;
+      $this->gotoNtpServer=array();
+    }
+
+    /* Create available ntp options */
+    $this->gotoNtpServers = $this->config->data['SERVERS']['NTP'];
+    foreach($this->gotoNtpServers as $key => $server){
+      if($server == "default"){
+        unset($this->gotoNtpServers[$key]);
+      }
+    }
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/ogroups/generic.tpl b/gosa-core/plugins/admin/ogroups/generic.tpl
new file mode 100644 (file)
index 0000000..f6f75bc
--- /dev/null
@@ -0,0 +1,65 @@
+<table summary="" style="width:100%;">
+ <tr>
+  <td style="width:50%; vertical-align:top">
+   <input type="hidden" name="ogroupedit" value="1">
+   <table summary="">
+    <tr>
+     <td><LABEL for="cn">{t}Group name{/t}</LABEL>{$must}</td>
+     <td>
+{render acl=$cnACL}
+       <input name="cn" id="cn" size=25 maxlength=60 value="{$cn}" title="{t}Name of the group{/t}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><LABEL for="description">{t}Description{/t}</LABEL></td>
+     <td>
+{render acl=$descriptionACL}
+       <input id="description" name="description" size=40 maxlength=80 value="{$description}" title="{t}Descriptive text for this group{/t}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td colspan=2>&nbsp;</td>
+    </tr>
+    <tr>
+     <td><LABEL for="base">{t}Base{/t}</LABEL>{$must}</td>
+     <td>
+{render acl=$baseACL}
+      <select size="1" id="base" name="base" title="{t}Choose subtree to place group in{/t}">
+       {html_options options=$bases selected=$base_select}
+      </select>
+{/render}
+{render acl=$baseACL disable_picture='images/folder_gray.png'}
+      <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
+{/render}
+     </td>
+    </tr>
+   </table>
+
+  </td>
+  <td style="border-left:1px solid #A0A0A0; padding-left:10px;">
+   <b><LABEL for="members">{t}Member objects{/t}</LABEL></b>&nbsp;({$combinedObjects})
+   <br>
+{render acl=$memberACL}
+   <select style="width:100%; height:450px;" id="members" name="members[]" size="15" multiple>
+    {$members}
+   </select>
+{/render}
+   <br>
+{render acl=$memberACL}
+   <input type=submit value="{t}Add{/t}" name="edit_membership">&nbsp;
+{/render}
+{render acl=$memberACL}
+   <input type=submit value="{t}Delete{/t}" name="delete_membership">
+{/render}
+  </td>
+ </tr>
+</table>
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('cn');
+  -->
+</script>
diff --git a/gosa-core/plugins/admin/ogroups/mail.tpl b/gosa-core/plugins/admin/ogroups/mail.tpl
new file mode 100644 (file)
index 0000000..a28d0ac
--- /dev/null
@@ -0,0 +1,27 @@
+<input type="hidden" name="mailedit" value="1">
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=0 border=0>
+
+ <!-- Headline container -->
+ <tr>
+  <td style="width:50%; vertical-align:top;">
+   <h2><img class="center" alt="" align="middle" src="images/rightarrow.png"> {t}Mail distribution list{/t}</h2>
+   <table summary="">
+    <tr>
+     <td><LABEL for="mail">{t}Primary address{/t}</LABEL>{$must}</td>
+     <td>
+{render acl=$mailACL}
+       <input id="mail" name="mail" size=50 maxlength=65 value="{$mail}" title="{t}Primary mail address for this distribution list{/t}">
+{/render}
+     </td>
+    </tr>
+   </table>
+  </td>
+ </tr>
+</table>
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('mail');
+  -->
+</script>
diff --git a/gosa-core/plugins/admin/ogroups/main.inc b/gosa-core/plugins/admin/ogroups/main.inc
new file mode 100644 (file)
index 0000000..7969077
--- /dev/null
@@ -0,0 +1,50 @@
+<?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
+ */
+
+if (!$remove_lock){
+  /* Create object object on demand */
+  if (!isset($_SESSION['ogroup']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+    $_SESSION['ogroup']= new ogroupManagement ($config);
+  }
+  $ogroup= $_SESSION['ogroup'];
+
+  /* Execute formular */
+  $ogroup->save_object();
+  $output= $ogroup->execute ();
+
+  /* Page header*/
+  if (isset($_SESSION['objectinfo'])){
+    $display= print_header(get_template_path('images/ogroup.png'),
+                          _("Object groups"),
+                          "<img alt=\"\" align=\"middle\" src=\"".
+                          get_template_path('images/closedlock.png').
+                          "\"> ".@LDAP::fix($_SESSION['objectinfo']));
+  } else {
+    $display= print_header(get_template_path('images/ogroup.png'), _("Object groups"));
+  }
+
+  $display.= $output;
+
+  /* Store changes  in session */
+  $_SESSION['ogroup']= $ogroup;
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/ogroups/ogroup_objects.tpl b/gosa-core/plugins/admin/ogroups/ogroup_objects.tpl
new file mode 100644 (file)
index 0000000..663b602
--- /dev/null
@@ -0,0 +1,58 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
+<tr>
+  <td style="vertical-align:top; width:600px;">
+   <div class="contentboxh" style="height:20px;">
+    <p class="contentboxh" style="font-size:12px">
+     <b>{t}Select objects to add{/t} {$hint}</b>
+    </p>
+   </div>
+   <div class="contentboxb">
+    <p class="contentboxb" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+     <select style="width:600px; height:450px; margin-top:4px;" name="objects[]" size="15" multiple>
+      {$objects}
+     </select>
+     <input type=hidden name="edit_helper">
+    </p>
+   </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>
+    <p class="contentboxb" style="border-top:1px solid #B0B0B0; background-color:#F8F8F8">
+    <input type=checkbox name="departments" value="1" {$departments} onClick="mainform.submit()" title="{t}Select to see departments{/t}">{t}Show departments{/t}<br>
+    <input type=checkbox name="accounts" value="1" {$accounts} onClick="mainform.submit()" title="{t}Select to see GOsa accounts{/t}">{t}Show people{/t}<br>
+    <input type=checkbox name="groups" value="1" {$groups} onClick="mainform.submit()" title="{t}Select to see GOsa groups{/t}">{t}Show groups{/t}<br>
+    <input type=checkbox name="applications" value="1" {$applications} onClick="mainform.submit()" title="{t}Select to see applications{/t}">{t}Show applications{/t}<br>
+    <input type=checkbox name="servers" value="1" {$servers} onClick="mainform.submit()" title="{t}Select to see servers{/t}">{t}Show servers{/t}<br>
+    <input type=checkbox name="workstations" value="1" {$workstations} onClick="mainform.submit()" title="{t}Select to see workstations{/t}">{t}Show workstations{/t}<br>
+    <input type=checkbox name="terminals" value="1" {$terminals} onClick="mainform.submit()" title="{t}Select to see terminals{/t}">{t}Show terminals{/t}<br>
+    <input type=checkbox name="printers" value="1" {$printers} onClick="mainform.submit()" title="{t}Select to see printers{/t}">{t}Show printers{/t}<br>
+    <input type=checkbox name="phones" value="1" {$phones} onClick="mainform.submit()" title="{t}Select to see phones{/t}">{t}Show phones{/t}<br>
+ </p>
+ <p class="contentboxb" style="border-top:1px solid #B0B0B0; background-color:#F8F8F8">
+    <input type=checkbox name="subtrees" value="1" {$subtrees} onClick="mainform.submit()" title="{t}Select to search within subtrees{/t}">{t}Search in subtrees{/t}<br>
+ </p>
+
+    <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8"><tr><td width="50%"><img alt="" src="{$tree_image}" align=middle title="{t}Display objects of department{/t}">&nbsp;
+    <select name="dselect" size=1 onChange="mainform.submit()" title="{t}Choose the department the search will be based on{/t}">
+      {html_options options=$deplist selected=$dselect}
+    </select></td></tr></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' name='regex' maxlength='20' style="width:99%" 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="add_object_finish" value="{t}Add{/t}">
+  &nbsp;
+  <input type=submit name="add_object_cancel" value="{t}Cancel{/t}">
+</p>
+
diff --git a/gosa-core/plugins/admin/ogroups/paste_generic.tpl b/gosa-core/plugins/admin/ogroups/paste_generic.tpl
new file mode 100644 (file)
index 0000000..91f84d8
--- /dev/null
@@ -0,0 +1,14 @@
+<table width='100%'>
+       <tr>
+               <td width='120'>
+                       <LABEL for="cn">{t}Group name{/t}</LABEL>{$must}
+               </td>
+               <td>
+                       <input type='text' id='cn' name='cn' value='{$cn}' size='40' title='{t}Please enter the new object group name{/t}'> 
+               </td>
+       </tr>
+</table>
+
+<script language="JavaScript" type="text/javascript">
+       focus_field('cn');
+</script>
diff --git a/gosa-core/plugins/admin/ogroups/paste_mail.tpl b/gosa-core/plugins/admin/ogroups/paste_mail.tpl
new file mode 100644 (file)
index 0000000..737d707
--- /dev/null
@@ -0,0 +1,14 @@
+<table width='100%'>
+        <tr>
+                <td width='120'>
+                       <LABEL for="mail">{t}Mail{/t}</LABEL>{$must}
+               </td>
+               <td>
+                       <input type='text' id='main' name='mail' value='{$mail}' size='40' title='{t}Please enter a mail address{/t}'> 
+               </td>
+       </tr>
+</table>
+
+<script language="JavaScript" type="text/javascript">
+       focus_field('mail');
+</script>
diff --git a/gosa-core/plugins/admin/ogroups/phonequeue.tpl b/gosa-core/plugins/admin/ogroups/phonequeue.tpl
new file mode 100644 (file)
index 0000000..643b4a3
--- /dev/null
@@ -0,0 +1,328 @@
+<p style='padding-left:7px;'>
+ <img class='center' src='images/lamp.png' alt='!'>&nbsp;<b>{t}Only users with the same asterisk home server will be included to this queue.{/t}</b>
+</p>
+
+<table summary="{t}Queue Settings{/t}" style="width: 100%; vertical-align: top; text-align: left;" border="0" cellpadding="4">
+<tr>
+<td valign='top'>
+               <h2><img class="center" alt="" src="images/select_phone.png" align="middle">&nbsp;{t}Phone numbers{/t}</h2>
+               <table summary="">
+               <tr>
+               <td colspan=2>
+                 <table summary="{t}Generic queue Settings{/t}">
+                  <tr>
+                   <td>
+{render acl=$telephoneNumberACL}
+                       <select style="width:300px; height:60px;" name="goFonQueueNumber_List" size=6>
+                       {html_options options=$telephoneNumber}
+                       <option disabled>&nbsp;</option>
+                       </select>
+{/render}
+               </td>
+               <td style="vertical-align:center">
+{render acl=$telephoneNumberACL}
+                       <input type="submit" value="{t}Up{/t}"          name="up_phonenumber"><br>
+{/render}
+{render acl=$telephoneNumberACL}
+                       <input type="submit" value="{t}Down{/t}"        name="down_phonenumber">
+{/render}
+               </td>
+               </tr>
+               <tr>
+                <td colspan=2>
+{render acl=$telephoneNumberACL}
+                       <input name="phonenumber" size=20 align=middle maxlength=60 value="">
+{/render}
+{render acl=$telephoneNumberACL}
+                       <input type="submit" value="{t}Add{/t}"         name="add_phonenumber" >&nbsp;
+{/render}
+{render acl=$telephoneNumberACL}
+                       <input type="submit" value="{t}Delete{/t}"      name="delete_phonenumber" >
+{/render}
+            </td>
+               </tr>
+               </table>
+               </tr>
+               <tr>
+                 <td colspan=2><h2><img class="center" alt="" src="images/select_ogroup.png" align="middle">&nbsp;{t}Options{/t}</h2></td>
+               </tr>
+                <tr>
+                <td><LABEL for="goFonHomeServer">{t}Home server{/t}</LABEL>{$must}</td>
+                <td>
+{render acl=$goFonHomeServerACL}
+                        <select name='goFonHomeServer'>
+                         {html_options options=$goFonHomeServers selected=$goFonHomeServer}
+                        </select>
+{/render}
+                </td>
+                </tr>
+
+               <tr>
+               <td>
+                       {t}Language{/t} 
+               </td>
+               <td>
+{render acl=$goFonQueueLanguageACL}
+                       <select name="goFonQueueLanguage">
+                       {html_options options=$goFonQueueLanguageOptions selected=$goFonQueueLanguage}
+                       <option disabled>&nbsp;</option>
+                       </select>
+{/render}
+               </td>
+               </tr>
+               <tr>
+               <td>
+                       {t}Timeout{/t}
+               </td>
+               <td>
+{render acl=$goFonTimeOutACL}
+                       <input name='goFonTimeOut' value='{$goFonTimeOut}'>
+{/render}
+               </td>
+               </tr>
+               <tr>
+               <td>
+                       {t}Retry{/t}
+               </td>
+               <td>
+{render acl=$goFonQueueRetryACL}
+                       <input name='goFonQueueRetry' value='{$goFonQueueRetry}'>
+{/render}
+               </td>
+               </tr>
+               <tr>
+               <td>
+                       {t}Strategy{/t} 
+               </td>
+               <td>
+{render acl=$goFonQueueStrategyACL}
+                       <select name="goFonQueueStrategy">
+            {html_options options=$goFonQueueStrategyOptions selected=$goFonQueueStrategy}
+            <option disabled>&nbsp;</option>
+            </select>
+{/render}
+       
+               </td>
+               </tr>
+               <tr>
+               <td>
+                       {t}Max queue length{/t}
+               </td>
+               <td>
+{render acl=$goFonMaxLenACL}
+                       <input name='goFonMaxLen' value='{$goFonMaxLen}'>       
+{/render}
+               </td>
+               </tr>
+               <tr>
+               <td>
+                       {t}Announce frequency{/t}
+               </td>
+               <td>
+{render acl=$goFonAnnounceFrequencyACL}
+                       <input name='goFonAnnounceFrequency' value='{$goFonAnnounceFrequency}'>
+{/render}
+                       {t}(in seconds){/t}     
+               </td>
+               </tr>
+               </table>
+</td>
+<td valign='top' style="border-left: 1px solid rgb(160, 160, 160);">
+       <h2>
+    <img class="center" alt="" src="images/sound.png" align="middle">
+    {t}Queue sound setup{/t}
+    </h2>
+       <table summary="{t}Generic queue Settings{/t}">
+               <!--<tr>
+               <td>
+                       {t}Use music on hold instead of ringing{/t}
+               </td>
+               <td>
+{render acl=goFonMusiconHoldACL}
+                       <input type="checkbox" name='goFonMusiconHold' value='1' {$goFonMusiconHoldCHK}>
+{/render}
+               </td>
+               </tr>
+               -->
+               <tr>
+               <td>
+                       {t}Music on hold{/t}
+               </td>
+               <td>
+{render acl=$goFonMusiconHoldACL}
+                       <input type="text" style='width:250px;' name='goFonMusiconHold' value='{$goFonMusiconHold}'>
+{/render}
+               </td>
+               </tr>
+               <tr>
+               <td>
+                       {t}Welcome sound file{/t}
+               </td>
+               <td>
+{render acl=$goFonWelcomeMusicACL}
+                       <input type="text" style='width:250px;' name='goFonWelcomeMusic' value='{$goFonWelcomeMusic}'>
+{/render}
+               </td>
+               </tr>
+               <tr>
+               <td>
+                       {t}Announce message{/t}
+               </td>
+               <td>
+{render acl=$goFonQueueAnnounceACL}
+                       <input type="text" style='width:250px;' name='goFonQueueAnnounce' value='{$goFonQueueAnnounce}'>
+{/render}
+               </td>
+               </tr>
+               <tr>
+               <td>
+                       {t}Sound file for 'You are next ...'{/t}
+               </td>
+               <td>
+{render acl=$goFonQueueYouAreNextACL}
+                       <input type="text" style='width:250px;' name='goFonQueueYouAreNext' value='{$goFonQueueYouAreNext}'>
+{/render}
+               </td>
+               </tr>
+               <tr>
+               <td>
+                       {t}'There are ...'{/t}
+               </td>
+               <td>
+{render acl=$goFonQueueThereAreACL}
+                       <input type="text" style='width:250px;' name='goFonQueueThereAre' value='{$goFonQueueThereAre}'>
+{/render}
+               </td>
+               </tr>
+               <tr>
+               <td>
+                       {t}'... calls waiting'{/t}
+               </td>
+               <td>
+{render acl=$goFonQueueCallsWaitingACL}
+                       <input type="text" style='width:250px;' name='goFonQueueCallsWaiting' value='{$goFonQueueCallsWaiting}'>
+{/render}
+               </td>
+               </tr>
+               <tr>
+               <td>
+                       {t}'Thank you' message{/t}
+               </td>
+               <td>
+{render acl=$goFonQueueThankYouACL}
+                       <input type="text" style='width:250px;' name='goFonQueueThankYou' value='{$goFonQueueThankYou}'>
+{/render}
+               </td>
+               </tr>
+               <tr>
+               <td>
+                       {t}'minutes' sound file{/t}
+               </td>
+               <td>
+{render acl=$goFonQueueMinutesACL}
+                       <input type="text" style='width:250px;' name='goFonQueueMinutes' value='{$goFonQueueMinutes}'>
+{/render}
+               </td>
+               </tr>
+               <tr>
+               <td>
+                       {t}'seconds' sound file{/t}
+               </td>
+               <td>
+{render acl=$goFonQueueSecondsACL}
+                       <input type="text" style='width:250px;' name='goFonQueueSeconds' value='{$goFonQueueSeconds}'>
+{/render}
+               </td>
+               </tr>
+               <tr>
+               <td>
+                       {t}Hold sound file{/t}
+               </td>
+               <td>
+{render acl=$goFonQueueReportHoldACL}
+                       <input type="text" style='width:250px;' name='goFonQueueReportHold' value='{$goFonQueueReportHold}'>
+{/render}
+               </td>
+               </tr>
+               <tr>
+               <td>
+                       {t}Less Than sound file{/t}
+               </td>
+               <td>
+{render acl=$goFonQueueLessThanACL}
+                       <input type="text" style='width:250px;' name='goFonQueueLessThan' value='{$goFonQueueLessThan}'>
+{/render}
+               </td>
+               </tr>
+
+               </table>
+</td>
+</tr>
+<tr>
+       <td colspan=2>
+               <p class="seperator">
+       </td>
+</tr>
+<tr>
+<td colspan=2><h2 style='margin-bottom:0px;'><img class="center" alt="" src="images/select_ogroup.png" align="middle">&nbsp;{t}Phone attributes {/t}</h2></td>
+</tr>
+<tr>
+<td>
+               <table summary="" style="width: 100%; vertical-align: top; text-align: left;" border="0" cellpadding="0">
+        <tr>
+        <td colspan=2>
+{render acl=$goFonQueueAnnounceHoldtimeACL}
+            <input type="checkbox" name='goFonQueueAnnounceHoldtime' value='yes'  {$goFonQueueAnnounceHoldtimeCHK}>
+{/render}
+            {t}Announce holdtime{/t}
+        </td>
+        </tr>
+        <tr>
+        <td colspan=2>
+{render acl=$goFonDialOptiontACL}
+            <input type="checkbox" name='goFonDialOptiont' value='t'  {$goFonDialOptiontCHK}>
+{/render}
+            {t}Allow the called user to transfer his call{/t}
+        </td>
+        </tr>
+        <tr>
+        <td colspan=2>
+{render acl=$goFonDialOptionTACL}
+            <input type="checkbox" name='goFonDialOptionT' value='T' {$goFonDialOptionTCHK}>
+{/render}
+            {t}Allows calling user to transfer call{/t}
+        </td>
+        </table>
+
+</td>
+<td valign='top' style="border-left: 1px solid rgb(160, 160, 160);">
+               <table summary=""  style="width: 100%; vertical-align: top; text-align: left;" border="0" cellpadding="0">
+        <tr>
+        <td colspan=2>
+{render acl=$goFonDialOptionhACL}
+            <input type="checkbox" name='goFonDialOptionh' value='h' {$goFonDialOptionhCHK}>
+{/render}
+            {t}Allow the called to hangup by pressing *{/t}
+        </td>
+        </tr>
+        <tr>
+        <td colspan=2>
+{render acl=$goFonDialOptionHACL}
+            <input type="checkbox" name='goFonDialOptionH' value='H' {$goFonDialOptionHCHK}>
+{/render}
+            {t}Allows calling to hangup by pressing *{/t}
+        </td>
+        </tr>
+        <tr>
+        <td colspan=2>
+{render acl=$goFonDialOptionrACL}
+            <input type="checkbox" name='goFonDialOptionr' value='r' {$goFonDialOptionrCHK}>
+{/render}
+            {t}Ring instead of playing background music{/t}
+        </td>
+        </tr>
+        </table>
+</td>
+</tr>
+
+</table>
diff --git a/gosa-core/plugins/admin/ogroups/remove.tpl b/gosa-core/plugins/admin/ogroups/remove.tpl
new file mode 100644 (file)
index 0000000..720156b
--- /dev/null
@@ -0,0 +1,24 @@
+<div style="font-size:18px;">
+  <img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
+</div>
+
+<p>
+  {$info}
+  {t}Please double check if you really want to do this since there is no way for GOsa to get your data back.{/t}
+</p>
+<p>
+  {t}So - if you're sure - press 'Delete' to continue or 'Cancel' to abort.{/t}
+</p>
+
+<p class="plugbottom">
+       {if $multiple}
+               <input type=submit name="delete_multiple_ogroup_confirm" value="{t}Delete{/t}">
+               &nbsp;
+               <input type=submit name="delete_multiple_ogroup_cancel" value="{t}Cancel{/t}">
+       {else}
+               <input type=submit name="delete_group_confirm" value="{t}Delete{/t}">
+               &nbsp;
+               <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
+       {/if}
+</p>
+
diff --git a/gosa-core/plugins/admin/ogroups/tabs_ogroups.inc b/gosa-core/plugins/admin/ogroups/tabs_ogroups.inc
new file mode 100644 (file)
index 0000000..3485bb7
--- /dev/null
@@ -0,0 +1,309 @@
+<?php
+
+class ogrouptabs extends tabs
+{
+  var $base= "";
+  var $acl_category; 
+  function reload($dd){
+    $objects= preg_replace('/[\[\]]/', '', $dd);
+    
+    /* If there is a phonequeue,
+     * but there is no user left with goPhoneAccount ... remove it.
+     */
+    $usePhoneTab = false;
+    foreach($this->by_object['ogroup']->memberList as $dn => $val){
+
+      if(isset($this->by_object['ogroup']->objcache[$dn])){
+        $obj = $this->by_object['ogroup']->objcache[$dn];
+        if(isset($obj['objectClass'])){
+          if(in_array("goFonAccount",$obj['objectClass'])){
+            $usePhoneTab = true;
+          }
+        }
+      }
+    }
+    if(((!$usePhoneTab)&&(isset($this->by_object['phonequeue'])))||((!preg_match("/U/",$objects))&&(isset($this->by_object['phonequeue'])))){
+      $this->by_object['phonequeue']->remove_from_parent();
+      unset($this->by_object['phonequeue']);
+      unset($this->by_name['phonequeue']);
+    }
+    /* Remove mail group if there is no user anymore */
+    if((!preg_match("/U/",$objects))&&(isset($this->by_object['mailogroup']))){
+      $this->by_object['mailogroup']->remove_from_parent();
+      unset($this->by_object['mailogroup']);
+      unset($this->by_name['mailogroup']);
+    }
+    
+    /* Remove terminal group, if theres no terminal left in the object list */
+    if(((!preg_match("/T/",$objects)) && (!preg_match("/W/",$objects)))&&(isset($this->by_object['termgroup']))){
+      $this->by_object['termgroup']->remove_from_parent();
+      unset($this->by_object['termgroup']);
+      unset($this->by_name['termgroup']);
+    }
+    
+    /* Remove ws tabs, if theres no ws left in the object list */
+    if((!preg_match("/W/",$objects))&&(isset($this->by_object['workservice']))){
+      $this->by_object['workservice']->remove_from_parent();
+      unset($this->by_object['workservice']);
+      unset($this->by_name['workservice']);
+    }
+    if((!preg_match("/S/",$objects) && !preg_match("/W/",$objects))&&(isset($this->by_object['workstartup']))){
+      $this->by_object['workstartup']->remove_from_parent();
+      unset($this->by_object['workstartup']);
+      unset($this->by_name['workstartup']);
+      $this->by_object['faiSummary']->remove_from_parent();
+      unset($this->by_object['faiSummary']);
+      unset($this->by_name['faiSummary']);
+    }
+  
+    /* Create goPhoneAccount if theres an user with goPhoneAccount
+     * but only if there is currently no queue enabled.
+     */
+    if(!isset($this->by_object['phonequeue'])){
+      foreach($this->by_object['ogroup']->memberList as $dn => $val){
+
+        if(isset($this->by_object['ogroup']->objcache[$dn])){
+          $obj = $this->by_object['ogroup']->objcache[$dn];
+
+          if(isset($obj['objectClass'])){
+            if(in_array("goFonAccount",$obj['objectClass'])){
+              $this->by_name['phonequeue']= _("Phone queue");
+              $this->by_object['phonequeue']= new phonequeue($this->config, $this->dn);
+              $this->by_object['phonequeue']->parent= &$this;
+              break;
+            }
+          }
+        }
+      }
+    }
+
+    /* Add mail group tab , if there is curerntly no mail tab defined */ 
+    if((preg_match("/U/",$objects))&&(!isset($this->by_object['mailogroup']))){
+      if(isset($this->config->current['MAILMETHOD'])){
+        if (preg_match('/kolab/i', $this->config->current['MAILMETHOD'])){
+          $this->by_name['mailogroup']= _("Mail");
+          $this->by_object['mailogroup']= new mailogroup($this->config, $this->dn);
+          $this->by_object['mailogroup']->parent= &$this;
+        }
+      }
+    }
+
+    /* Add Terminal tab */
+    if(((preg_match("/T/",$objects)) || (preg_match("/W/",$objects)))&&(!isset($this->by_object['termgroup']))){
+      if(!isset($this->by_object['termgroup'])){
+        $this->by_name['termgroup']= _("System");
+        $this->by_object['termgroup']= new termgroup($this->config, $this->dn);
+        $this->by_object['termgroup']->inheritTimeServer = false;
+        $this->by_object['termgroup']->parent= &$this;
+      }
+    }
+    
+    /* Add Workstation tabs */
+    if((preg_match("/W/",$objects))&&(!isset($this->by_object['workservice']))){
+        $this->by_name['workservice']= _("Devices");
+        $this->by_object['workservice']= new workservice($this->config, $this->dn);
+        $this->by_object['workservice']->inheritTimeServer = false;
+        $this->by_object['workservice']->parent= &$this;
+        $this->by_object['workservice']->acl = "#all#";
+    }
+    if((preg_match("/S/",$objects) || preg_match("/W/",$objects))&&(!isset($this->by_object['workstartup']))){
+        $this->by_name['workstartup']= _("Startup");
+        $this->by_object['workstartup']= new workstartup($this->config, $this->dn);
+        $this->by_object['workstartup']->parent= &$this;
+        $this->by_object['workstartup']->acl = "#all#";
+        $this->by_name['faiSummary']= _("Summary");
+        $this->by_object['faiSummary']= new faiSummaryTab($this->config, $this->dn);
+        $this->by_object['faiSummary']->parent= &$this;
+    }
+
+    /* Add application tab if user or group is member in this object group*/
+    if((preg_match("/G/",$objects) || preg_match("/U/",$objects)) && !isset($this->by_name['appgroup'])){
+      $this->by_name['appgroup']= _("Application");
+      $this->by_object['appgroup']= new appgroup($this->config, $this->dn);
+      $this->by_object['appgroup']->acl = "#all#";
+      $this->by_object['appgroup']->parent= &$this;
+    }
+
+    /* Remove application tab if not required any longer */
+    if(!preg_match("/G/",$objects) && !preg_match("/U/",$objects) && isset($this->by_name['appgroup'])){
+      $this->by_object['appgroup']->remove_from_parent();
+      unset($this->by_name['appgroup']);
+      unset($this->by_object['appgroup']);
+    }
+
+    /* Add environment tab if user or group is member in this object group*/
+    if((preg_match("/G/",$objects) || preg_match("/U/",$objects)) && !isset($this->by_name['environment'])){
+      $this->by_name['environment']= _("Environment");
+      $this->by_object['environment']= new environment($this->config, $this->dn);
+      $this->by_object['environment']->acl = "#all#";
+      $this->by_object['environment']->parent= &$this;
+    }
+
+    /* Remove environment tab if not required any longer */
+    if(!preg_match("/G/",$objects) && !preg_match("/U/",$objects) && isset($this->by_name['environment'])){
+      $this->by_object['environment']->remove_from_parent();
+      unset($this->by_name['environment']);
+      unset($this->by_object['environment']);
+    }
+    /* Move reference tab to second position from right */
+    if(isset($this->by_name['acl'])){
+      $tmp = $this->by_name['acl'];
+      unset($this->by_name['acl']);
+      $this->by_name['acl'] = $tmp;
+    }
+  
+    /* Move reference tab to last position*/
+    if(isset($this->by_name['reference'])){
+      $tmp = $this->by_name['reference'];
+      unset($this->by_name['reference']);
+      $this->by_name['reference'] = $tmp;
+    }
+
+    /* Reset acls */
+    $this->set_acl_base($this->base);
+    foreach($this->by_object as $name => $obj){
+      $this->by_object[$name]->set_acl_category($this->acl_category);
+    }
+  }
+
+  function execute(){
+    $str = "";
+    $this->by_object['ogroup']->AddDelMembership();
+    $this->reload($this->by_object['ogroup']->gosaGroupObjects);
+    $str .= tabs::execute();
+    return ( $str);
+  }  
+
+  function ogrouptabs($config, $data, $dn,$category ="ogroups")
+  {
+
+    tabs::tabs($config, $data, $dn, $category);
+    $this->base= $this->by_object['ogroup']->base;
+    $this->acl_category = $category;
+
+    /* Insert extra tabs for several object types - if present */
+
+    $objects= preg_replace('/[\[\]]/', '', $this->by_object['ogroup']->gosaGroupObjects);
+   
+    for ($n= 0; $n<strlen($objects); $n++){
+      switch ($objects[$n]){
+        case "T":
+          /* Add a terminal tab */
+          $this->by_name['termgroup']= _("Terminals");
+          $this->by_object['termgroup']= new termgroup($this->config, $this->dn);
+          $this->by_object['termgroup']->parent= &$this;
+
+          break;
+
+          case "U":
+            /* Append a PhoneQueue, if objectClass = goFonAccount */
+            $use = false;
+          foreach($this->by_object['ogroup']->memberList as $dn => $val){
+
+            $obj = $this->by_object['ogroup']->objcache[$dn];
+            
+            if(isset($obj['objectClass'])){
+              if(in_array("goFonAccount",$obj['objectClass'])){
+                $use = true; 
+              }
+            }
+          }
+
+          /* We found goFonAccount in users objectClasses*/
+          if($use){
+            $this->by_name['phonequeue']= _("Phone queue");
+            $this->by_object['phonequeue']= new phonequeue($this->config, $this->dn);
+            $this->by_object['phonequeue']->parent= &$this;
+          } 
+          /* Add a user tab used for mail distribution lists */
+          if(isset($this->config->current['MAILMETHOD'])){
+            if (preg_match('/kolab/i', $this->config->current['MAILMETHOD'])){
+              $this->by_name['mailogroup']= _("Mail");
+              $this->by_object['mailogroup']= new mailogroup($this->config, $this->dn);
+              $this->by_object['mailogroup']->parent= &$this;
+            }
+          }
+
+          break;
+      }
+    }
+
+    /* Add references/acls/snapshots */
+    $this->reload($this->by_object['ogroup']->gosaGroupObjects);
+    $this->addSpecialTabs();
+  }
+
+
+  function check($ignore_account= FALSE)
+  {
+    return (tabs::check(FALSE));
+  }
+
+
+  function save_object($save_current= FALSE)
+  {
+    tabs::save_object($save_current);
+
+    /* Update reference, transfer variables */
+    $baseobject= $this->by_object['ogroup'];
+    foreach ($this->by_object as $name => $obj){
+
+      /* Don't touch base object */
+      if ($name != 'ogroup'){
+        $obj->parent    = &$this;
+        $obj->uid       = $baseobject->uid;
+        $obj->cn        = $baseobject->cn;
+        $obj->sn        = $baseobject->uid;
+        $obj->givenName = $baseobject->uid;
+        $this->by_object[$name]= $obj;
+      }
+
+      /* Update parent in base object */
+      $this->by_object['ogroup']->parent= &$this;
+    }
+  }
+
+
+  function save($ignore_account= FALSE)
+  {
+    $baseobject= $this->by_object['ogroup'];
+
+    /* Check for new 'dn', in order to propagate the
+       'dn' to all plugins */
+    $new_dn= 'cn='.$baseobject->cn.','.get_groups_ou().$baseobject->base;
+
+    /* Move group? */
+    if ($this->dn != $new_dn){
+
+      /* Write entry on new 'dn' */
+      if ($this->dn != "new"){
+        $baseobject->move($this->dn, $new_dn);
+        $this->by_object['ogroup']= $baseobject;
+      }
+
+      /* Happen to use the new one */
+      $this->dn= $new_dn;
+    }
+
+    if ($this->dn == "new"){
+      $this->dn= 'cn='.$baseobject->cn.','.get_groups_ou().$baseobject->base;
+    }
+
+    tabs::save();
+
+    /* Fix tagging if needed */
+               $baseobject->dn= $new_dn;
+    $baseobject->handle_object_tagging();
+  }
+
+  function getCopyDialog()
+  {
+    $this->reload($this->by_object['ogroup']->gosaGroupObjects); 
+    return(tabs::getCopyDialog());
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/ogroups/termgroup.tpl b/gosa-core/plugins/admin/ogroups/termgroup.tpl
new file mode 100644 (file)
index 0000000..b35458c
--- /dev/null
@@ -0,0 +1,110 @@
+<br>
+<b>{t}Warning{/t}:</b> {t}Actions you choose here influence all systems in this object group. Additionally, all values editable here can be inherited by the clients assigned to this object group.{/t}
+<br>
+<br>
+<p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
+<h2><img class="center" alt="" align="middle" src="images/select_terminal.png"> {t}Generic{/t}</h2>
+
+<table width="100%">
+       <tr>
+               <td style='width:50%;'>
+               <!-- Upper left -->
+                          <table width="100%">
+                               <tr>
+                                <td colspan="2" style='padding-top:5px;'><LABEL for="gotoNtpServerSelected">{t}NTP server{/t}</LABEL><br>
+{render acl=$gotoNtpServerACL}
+                                 <select name="gotoNtpServerSelected[]" id="gotoNtpServerSelected" multiple size=5 style="width:100%;"
+                                               title="{t}Choose server to use for synchronizing time{/t}" {if $inheritTimeServer} disabled {/if}>
+                                  {html_options options=$gotoNtpServer_select}
+                                 </select>
+{/render}
+                                <br>
+{render acl=$gotoNtpServerACL}
+                                 <select name="gotoNtpServers" id="gotoNtpServers" {if $inheritTimeServer} disabled {/if} >
+                                  {html_options output=$gotoNtpServers values=$gotoNtpServers}
+                                 </select>
+{/render}
+{render acl=$gotoNtpServerACL}
+                                       <input type="submit" name="addNtpServer" value="{t}Add{/t}"     id="addNtpServer"
+                                        {if ($inheritTimeServer) || (!$gotoNtpServers)} disabled {/if}>
+{/render}
+
+{render acl=$gotoNtpServerACL}
+                                       <input type="submit" name="delNtpServer" value="{t}Delete{/t}"  id="delNtpServer"
+                                        {if ($inheritTimeServer) || (!$gotoNtpServer_select)} disabled {/if} >
+{/render}
+                                </td>
+                               </tr>
+                          </table>
+
+
+               </td>
+               <td style="vertical-align:top;border-left:1px solid #A0A0A0;">
+               <!-- Upper right -->
+                               
+                       <table summary="">
+                               <tr>
+                                <td>{t}Mode{/t}</td>
+                                <td>
+{render acl=$gotoModeACL}
+                                 <select name="gotoMode" title="{t}Select terminal mode{/t}">
+                                  {html_options options=$modes selected=$gotoMode_select}
+                                 </select>
+{/render}
+                                </td>
+                               </tr>
+                               <tr><td colspan="2">&nbsp;</td></tr>
+                               <tr>
+                                <td><LABEL for="gotoSyslogServer">{t}Syslog server{/t}</LABEL></td>
+                                <td>
+{render acl=$gotoSyslogServerACL}
+                                 <select id="gotoSyslogServer" name="gotoSyslogServer" title="{t}Choose server to use for logging{/t}">
+                                  {html_options values=$syslogservers output=$syslogservers selected=$gotoSyslogServer_select}
+                                 </select>
+{/render}
+                                </td>
+                               </tr>
+                               </table>
+               </td>
+       </tr>
+       <tr>
+               <td colspan=2>
+                       <p class="seperator">&nbsp;</p>
+               </td>
+       </tr>
+       <tr>
+               <td>
+               <!-- Bottom left -->                    
+
+               </td>
+               <td style="vertical-align:top;border-left:1px solid #A0A0A0;">
+               <!-- Bottom right -->                   
+               </td>
+       </tr>
+</table>
+<input name="workgeneric_posted" value="1" type="hidden">
+
+
+<h2><img class="center" alt="" align="middle" src="images/rocket.png"> {t}Action{/t}</h2>
+                               <table summary="">
+                                <tr>
+                                 <td>
+{render acl=$FAIstateACL}
+                                  <select size="1" name="saction" {$FAIstateACL} title="{t}Select action to execute for this terminal{/t}">
+                                       <option>&nbsp;</option>
+                                       {html_options options=$actions}
+                                  </select>
+{/render}
+                                 </td>
+                                 <td>
+{render acl=$FAIstateACL}
+                                  <input type=submit name="action" value="{t}Execute{/t}">
+{/render}
+                                 </td>
+                                </tr>
+                               </table>
+       
+
+
+
+
diff --git a/gosa-core/plugins/admin/systems/ArpNewDevice.tpl b/gosa-core/plugins/admin/systems/ArpNewDevice.tpl
new file mode 100644 (file)
index 0000000..8e4bf44
--- /dev/null
@@ -0,0 +1,31 @@
+<h2><img class="center" alt="" align="middle" src="images/rightarrow.png"> {t}Integrating unknown devices{/t}</h2>
+<p>
+ {t}The current device has been detected by the ARP monitor used by GOsa. You can integrate this device into your running DHCP/DNS infrastructure by submitting this form. The device entry will disapear from the list of the systems and move to the DNS/DHCP configuration.{/t}
+</p>
+<table summary="" style="width:100%">
+<tr>
+ <td style>
+  <LABEL for="cn">
+   {t}DNS name{/t}{$must}
+  </LABEL>
+ </td>
+ <td style='width:35%;border-right:1px solid #aaa'>
+  <input name="cn" id="cn" size=18 maxlength=60 value="{$cn}">
+ </td>
+ <td style='width:15%'>
+  <LABEL for="description">
+   {t}Description{/t}
+  </LABEL>
+ </td>
+ <td style='width:35%'>
+  <input name="description" id="description" size=18 maxlength=60 value="{$description}">
+ </td>
+</tr>
+</table>
+<br>
+<p class="seperator"></p>
+{$netconfig}
+
+<input type='hidden' name='ArpNewDevice_posted' value='1'>
+
+<p class="seperator"></p>
diff --git a/gosa-core/plugins/admin/systems/SelectDeviceType.tpl b/gosa-core/plugins/admin/systems/SelectDeviceType.tpl
new file mode 100644 (file)
index 0000000..d25acbf
--- /dev/null
@@ -0,0 +1,46 @@
+<br>
+<p class="seperator">
+{t}This is a new system which currently has no system type defined. Please choose a system type for this entry and press the 'continue' button. If this system should be added to a group of system settings, specify the preferred object group below.{/t}
+<br>
+<br>
+</p>
+<p class="seperator">
+<br>
+<b>{t}Please select a system type and an optional bundle of predefined settings to be inherited.{/t}</b>
+<br>
+<br>
+</p>
+<br>
+<table summary="" style='width:100%'>
+ <tr>
+  <td style='width:49%'>
+   <table summary="">
+    <tr>
+     <td> 
+      {t}System type{/t}&nbsp;
+         <select name="SystemType" title="{t}Choose a system type{/t}" style="width:120px;">
+       {html_options values=$SystemTypeKeys output=$SystemTypes selected=$SystemType}
+      </select>
+     </td>
+    </tr>
+   </table>
+  </td>
+  <td>
+   <table summary="">
+    <tr>
+     <td> 
+      {t}Choose an object group as template{/t}&nbsp;
+         <select name="ObjectGroup" title="{t}Choose an object group{/t}" style="width:120px;">
+       {html_options values=$ObjectGroupKeys output=$ObjectGroups selected=$ObjectGroup}
+      </select>
+     </td>
+    </tr>
+   </table>
+  </td>
+ </tr>
+</table>
+<p class="seperator">&nbsp;</p>
+<div style="align: right;" align="right"><p>
+       <input type="submit" name="SystemTypeChoosen" value="{t}Continue{/t}">
+       <input type="submit" name="SystemTypeAborted" value="{t}Cancel{/t}">
+</p></div>
diff --git a/gosa-core/plugins/admin/systems/chooser.tpl b/gosa-core/plugins/admin/systems/chooser.tpl
new file mode 100644 (file)
index 0000000..3e8bf95
--- /dev/null
@@ -0,0 +1,21 @@
+<h1>{t}Choose the kind of system component you want to create{/t}</h1>
+
+<p>
+ {t}Linux terminals and workstations are autocreated on bootup. For this reason you're only be able to create templates for a specific tree. Servers are normally automatically added too, but in some special cases you may need to create a faked server entry to provide GOsa with some informations. Other network components may be used for Nagios setups to create component dependencies.{/t}
+</p>
+
+<input type="radio" name="system" value="terminal" checked>{t}Linux thin client template{/t}<br>
+<input type="radio" name="system" value="workstation">{t}Linux workstation template{/t}<br>
+<input type="radio" name="system" value="server">{t}Linux Server{/t}<br>
+<!--<input type="radio" name="system" value="machineaccount">{t}Windows workstation{/t}<br>-->
+<input type="radio" name="system" value="printer">{t}Network printer{/t}<br>
+<input type="radio" name="system" value="phone">{t}Phone{/t}<br>
+<input type="radio" name="system" value="component">{t}Other network component{/t}<br>
+
+<p class="plugbottom">
+ <input type=submit name="create_system" value="{t}Create{/t}">
+ &nbsp;
+ <input type=submit name="cancel" value="{t}Cancel{/t}">
+</p>
+
+<input type="hidden" name="ignore">
diff --git a/gosa-core/plugins/admin/systems/class_ArpNewDevice.inc b/gosa-core/plugins/admin/systems/class_ArpNewDevice.inc
new file mode 100644 (file)
index 0000000..7900990
--- /dev/null
@@ -0,0 +1,74 @@
+<?php 
+class ArpNewDevice extends plugin
+{
+  var $cn= "";
+  var $description = "";
+  var $netConfigDNS = NULL;
+  var $attributes= array("cn","description");
+  var $objectclasses = array("gotoHard");
+  var $ignore_account = TRUE;
+
+  function ArpNewDevice ($config, $dn= NULL, $parent= NULL)
+  {
+    plugin :: plugin($config,$dn);
+    $this->cn ="";
+    $this->netConfigDNS = new termDNS($this->config,$this,$this->objectclasses);
+    $this->acl = "#all#";
+    $this->netConfigDNS->acl = $this->acl;
+    $this->netConfigDNS->force_dns();
+  }
+
+  function execute()
+  {
+    $smarty = get_smarty();
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr,$this->$attr);
+    }
+    $this->netConfigDNS->cn= $this->cn;
+    $smarty->assign("netconfig", $this->netConfigDNS->execute());
+
+    /* Display sub dialog from network settings */
+    $this->netConfigDNS->acl = $this->acl;
+    if($this->netConfigDNS->dialog){
+      $this->dialog = TRUE;
+      return($this->netConfigDNS->execute());
+    }else{
+      $this->dialog = FALSE;
+    }
+
+    return($smarty->fetch (get_template_path('ArpNewDevice.tpl', TRUE)));
+  }
+
+  function check()
+  {
+    $message= plugin::check();
+    $message= array_merge($message, $this->netConfigDNS->check());
+    if(empty($this->cn)){
+      $message[] = _("Please specify a valid dns name.");
+    }
+    return($message);
+  }
+
+  function save_object()
+  {
+    if(isset($_POST['ArpNewDevice_posted'])){
+      plugin::save_object();
+      $this->netConfigDNS->save_object();
+    }
+  }
+
+  function save()
+  {
+    $this->netConfigDNS->acl = $this->acl;
+    plugin::save();
+    $this->netConfigDNS->cn = $this->cn;    
+    $this->netConfigDNS->save($this->dn);
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->rmdir_recursive($this->dn);
+    show_ldap_error($ldap->get_error(),_("Could not remove arp-alert device after writing dns and dhcp configuration."));
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/systems/class_SelectDeviceType.inc b/gosa-core/plugins/admin/systems/class_SelectDeviceType.inc
new file mode 100644 (file)
index 0000000..c17b8ef
--- /dev/null
@@ -0,0 +1,85 @@
+<?php
+
+class SelectDeviceType 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("ObjectGroup","SystemType");
+  var $objectclasses= array("whatever");
+
+  var $ObjectGroups   = array();
+  var $SystemTypes       = array();
+
+  var $ObjectGroup    = "";
+  var $SystemType        = "";
+
+  function SelectDeviceType  (&$config, $dn= NULL)
+  {
+    plugin::plugin ($config, $dn);
+
+    /* Get object groups */
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd ($this->config->current['BASE']);
+    $ldap->search("(&(objectClass=gosaGroupOfNames)(cn=*))",array("cn"));
+    $this->ObjectGroups['none']=_("none");
+    while($attrs = $ldap->fetch()){
+      $this->ObjectGroups[$attrs['dn']]= $attrs['cn'][0];
+    }
+
+    $this->SystemTypes =array("workstation"=>_("Workstation"), "terminal"=>_("Terminal"), "server"=>_("Server"));
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+    $display= "";
+
+    $smarty->assign("ObjectGroups"    ,$this->ObjectGroups);
+    $smarty->assign("ObjectGroupKeys" ,array_flip($this->ObjectGroups));
+    $smarty->assign("SystemTypes"     ,$this->SystemTypes);
+    $smarty->assign("SystemTypeKeys"  ,array_flip($this->SystemTypes)); 
+
+    $smarty->assign("ObjectGroup",$this->ObjectGroup);
+    $smarty->assign("SystemType",$this->SystemType);
+
+    $display.= $smarty->fetch(get_template_path('SelectDeviceType.tpl', TRUE));
+    return($display);
+  }
+
+  /* Save data to object */
+  function save_object()
+  {
+    plugin::save_object();
+    foreach($this->attributes as $attr){
+      if(isset($_POST[$attr])){
+        $this->$attr = $_POST[$attr];
+      }
+    }
+  }
+
+  /* Check supplied data */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    return ($message);
+  }
+
+  /* Save to LDAP */
+  function save()
+  {
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/systems/class_baseSelectDialog.inc b/gosa-core/plugins/admin/systems/class_baseSelectDialog.inc
new file mode 100644 (file)
index 0000000..04275e0
--- /dev/null
@@ -0,0 +1,197 @@
+<?php
+
+class baseSelectDialog extends MultiSelectWindow
+{
+  var $selectedBase        = ""; // Used for navigation 
+  var $base_selection_regex = "*"; // Used regex ... 
+  var $BaseToUse         = false;  // used to specify the selected base, 
+                                      // false if none is selected
+
+  var $allowedBases         = array();
+  var $parent               = NULL;
+  function baseSelectDialog (&$config,$parent,$onlyAllowThisBases = array())
+  {
+    $module= "all";
+    MultiSelectWindow::MultiSelectWindow($config, "BASEselectWindow", $module);
+   
+    $this->parent = $parent;
+    $this->selectedBase = $config->current['BASE'];
+    $this->allowedBases  = $onlyAllowThisBases;
+
+    $this->SetTitle("Base");
+    $this->SetSummary(_("Choose a base"));
+    $this->SetListHeader("<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;".
+        "</div>");
+
+    $this->SetInformation(_("Step in the prefered tree and click save to use the current subtree as base. Or click the image at the end of each entry."));
+
+    $this->EnableAplhabet   (true);
+    $this->EnableCloseButton(true);
+    $this->EnableSaveButton (true);
+
+    $this->SetSaveButtonString(_("Use"));
+    $this->SetCloseButtonString(_("Cancel"));
+
+    $this->AddHeader(array("string"=>"&nbsp;","attach"=>"style='width:20px;'"));
+    $this->AddHeader(array("string"=>_("Base")));
+    $this->AddHeader(array("string"=>_("Action"),"attach"=>"style='width:50px;border-right:0px;'"));
+
+    /*                  Text        ,Value    ,Name         ,Is selected */
+//  $this->AddCheckBox("Doesnothing","servers","Doesnothing",true);
+
+    /*                  Name                 ,Text                              ,Default  , Connect with alphabet  */
+    $this->AddRegex   ("base_selection_regex",_("Filter entries with this syntax"),"*"      , true);
+  }
+
+  function execute()
+  {
+    $this->setEntries();
+    return($this->Draw());
+  }
+
+  function setEntries()
+  {
+    $this->ClearElementsList();
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->selectedBase);
+    $ldap->ls("(&(objectClass=gosaDepartment)
+                 (|(ou=".$this->base_selection_regex.")
+                   (cn=".$this->base_selection_regex.")
+                   (description=".$this->base_selection_regex.")))",
+              $this->selectedBase,array("ou","description","cn"));
+
+    $link = "<a href='?plug=".$_GET['plug']."&open_dep=%s'>%s</a>";
+
+    $base_back          = preg_replace("/^[^,]+,/","",$this->selectedBase);
+    $base_back          = convert_department_dn($base_back);
+  
+    /* Add departments, to be able to switch into them
+     */
+    while($attrs = $ldap->fetch()){
+      $key = $attrs['dn']  ;
+      $val = $attrs['ou'][0];
+    
+      if(count($this->allowedBases) != 0){
+        if(!isset($this->allowedBases[$key])){
+          continue;
+          break;
+        }
+      }
+      /* Append description */ 
+      if(isset($attrs['description'][0])){
+        $val.=" [".$attrs['description'][0]."]";
+      }
+
+      /* Add missing entries ... */
+      if(!isset($this->config->departments[trim($key)])){
+        $this->config->departments[trim($key)]="";
+      }
+
+      /* check if this department contains sub-departments
+         Display different image in this case
+       */
+      $non_empty="";
+      $keys= str_replace("/","\/",$key);
+      foreach($this->config->departments as $keyd ){
+        if(preg_match("/,".$keys."/",$keyd)){
+          $non_empty="full";
+        }
+      }
+
+      /* Add to divlist */
+      $field1 = array("string" => "<img src='images/".$non_empty."folder.png' alt='department'>", 
+                      "attach" => "style='text-align:center;width:20px;'");
+      $field2 = array("string" => sprintf($link,base64_encode($key),$val), "attach" => "style=''");
+      $field3 = array("string" => sprintf("&nbsp;<input title='"._("Select this base")."' type='image' img src='images/save.png' name='usebase_%s'>",base64_encode($key)), 
+                      "attach" => "style='width:50px;border-right:0px;text-align:right;'");
+      $this->AddElement(array($field1,$field2,$field3));
+    }
+  }
+
+  function Save()
+  {
+    MultiSelectWindow :: Save();  
+    $this->BaseToUse = $this->selectedBase;
+  }
+
+  function isSelected() 
+  {
+    return($this->BaseToUse);
+  }
+
+  function setCurrentBase($base)
+  {
+    $this->selectedBase = $base;
+  }
+
+  function save_object()
+  {
+    /* Save current base */
+    $old_base = $this->selectedBase;
+  
+    /* Save automatic created POSTs like regex, checkboxes */
+    MultiSelectWindow::save_object();   
+    
+    if(isset($_GET['open_dep'])){
+      $this->selectedBase = base64_decode($_GET['open_dep']);
+    } 
+
+    $s_action ="";
+    foreach($_POST as $key => $value){
+      if(preg_match("/^dep_back.*/i",$key)){
+        $s_action="back";
+      }elseif(preg_match("/^dep_root.*/",$key)){
+        $s_action="root";
+      }elseif(preg_match("/^dep_home.*/i",$key)){
+        $s_action="home";
+      }elseif(preg_match("/^usebase_/",$key)){
+        $tmp = preg_replace("/^usebase_/","",$key);
+        $tmp = preg_replace("/_.*$/","",$tmp);
+        $tmp = base64_decode($tmp);
+        $this->BaseToUse = $tmp;
+      }
+    }
+
+    $ui= get_userinfo();
+    /* Homebutton is posted */
+    if($s_action=="home"){
+      $this->selectedBase=(preg_replace("/^[^,]+,/","",$ui->dn));
+      $this->selectedBase=(preg_replace("/^[^,]+,/","",$this->selectedBase));
+    }
+
+    /* back to the roots ^^ */
+    if($s_action=="root"){
+      $this->selectedBase=($this->config->current['BASE']);
+    }
+
+    /* If Backbutton is Posted */
+    if($s_action=="back"){
+      $base_back          = preg_replace("/^[^,]+,/","",$this->selectedBase);
+      $base_back          = convert_department_dn($base_back);
+
+      if(isset($this->config->departments[trim($base_back)])){
+        $this->selectedBase= $this->config->departments[trim($base_back)];
+      }else{
+        $this->selectedBase= $this->config->departments["/"];
+      }
+    }
+
+    /* Restore old base, if selected base is not allowed */
+    if(count($this->allowedBases) && !isset($this->allowedBases[$this->selectedBase])){
+      $this->selectedBase = $old_base;
+    }
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/systems/class_componentGeneric.inc b/gosa-core/plugins/admin/systems/class_componentGeneric.inc
new file mode 100644 (file)
index 0000000..8a65bdd
--- /dev/null
@@ -0,0 +1,331 @@
+<?php
+
+class componentGeneric extends plugin
+{
+  /* CLI vars */
+  var $cli_summary= "Manage component base objects";
+  var $cli_description= "Some longer text\nfor help";
+  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* Generic terminal attributes */
+  var $interfaces= array();
+  var $ignore_account= TRUE;
+
+  /* Needed values and lists */
+  var $base= "";
+  var $cn= "";
+  var $description= "";
+  var $orig_dn= "";
+
+  /* attribute list for save action */
+  var $attributes= array("cn", "description");
+  var $objectclasses= array("top", "device", "ipHost", "ieee802Device");
+  var $netConfigDNS;
+  var $view_logged  = FALSE;
+
+  function componentGeneric (&$config, $dn= NULL, $parent= NULL)
+  {
+    plugin::plugin ($config, $dn, $parent);
+
+    /* Set base */
+    if ($this->dn == "new"){
+      $ui= get_userinfo();
+      $this->base= dn2base($ui->dn);
+      $this->cn= "";
+    } else {
+      $this->base= preg_replace ("/^[^,]+,[^,]+,[^,]+,/", "", $this->dn);
+    }
+    $this->netConfigDNS = new termDNS($this->config,$this,$this->objectclasses, true);
+    /* Save dn for later references */
+    $this->orig_dn= $this->dn;
+  }
+
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","component/".get_class($this),$this->dn);
+    }
+
+    /* Do we represent a valid phone? */
+    if (!$this->is_account && $this->parent === NULL){
+      $display= "<img alt=\"\" src=\"images/stop.png\" align=middle>&nbsp;<b>".
+        _("This 'dn' has no network features.")."</b>";
+      return($display);
+    }
+
+    /* Base select dialog */
+    $once = true;
+    foreach($_POST as $name => $value){
+      if(preg_match("/^chooseBase/",$name) && $once){
+        $once = false;
+        $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
+        $this->dialog->setCurrentBase($this->base);
+      }
+    }
+
+    /* Dialog handling */
+    if(is_object($this->dialog)){
+      /* Must be called before save_object */
+      $this->dialog->save_object();
+
+      if($this->dialog->isClosed()){
+        $this->dialog = false;
+      }elseif($this->dialog->isSelected()){
+
+        /* A new base was selected, check if it is a valid one */
+        $tmp = $this->get_allowed_bases();
+        if(isset($tmp[$this->dialog->isSelected()])){
+          $this->base = $this->dialog->isSelected();
+        }
+
+        $this->dialog= false;
+      }else{
+        return($this->dialog->execute());
+      }
+    }
+
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+    $smarty->assign("bases", $this->config->idepartments);
+
+    /* Set acls */
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+    $smarty->assign("bases", $this->get_allowed_bases());
+
+    /* Assign attributes */
+    foreach ($this->attributes as $attr){
+      $smarty->assign("$attr", $this->$attr);
+    }
+    $smarty->assign("base_select", $this->base);
+
+    /* Show main page */
+    $str = $this->netConfigDNS->execute();
+    if(is_object($this->netConfigDNS->dialog)){
+      return($str);
+    }
+    $smarty->assign("netconfig", $str);
+    return($smarty->fetch (get_template_path('component.tpl', TRUE)));
+  }
+
+  function set_acl_base($base)
+  {
+    plugin::set_acl_base($base);
+    $this->netConfigDNS->set_acl_base($base);
+  }
+
+  function set_acl_category($cat)
+  {
+    plugin::set_acl_category($cat);
+    $this->netConfigDNS->set_acl_category($cat);
+  }
+
+  function remove_from_parent()
+  {
+    $ldap= $this->config->get_ldap_link();
+    $this->netConfigDNS->remove_from_parent();
+    $ldap->rmdir($this->dn);
+    
+    new log("remove","component/".get_class($this),$this->dn,$this->attributes,$ldap->get_error());
+
+    show_ldap_error($ldap->get_error(), sprintf(_("Removing of system component/generic with dn '%s' failed."),$this->dn));
+    $this->handle_post_events(array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
+
+    /* Delete references to object groups */
+    $ldap->cd ($this->config->current['BASE']);
+    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
+    while ($ldap->fetch()){
+      $og= new ogroup($this->config, $ldap->getDN());
+      unset($og->member[$this->dn]);
+      $og->save ();
+    }
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    
+    /* Create a base backup and reset the
+       base directly after calling plugin::save_object();
+       Base will be set seperatly a few lines below */
+    $base_tmp = $this->base;
+    plugin::save_object();
+    $this->base = $base_tmp;
+
+    $this->netConfigDNS->save_object();
+
+    /* Set new base if allowed */
+    $tmp = $this->get_allowed_bases();
+    if(isset($_POST['base'])){
+      if(isset($tmp[$_POST['base']])){
+        $this->base= $_POST['base'];
+      }
+    }
+  }
+
+
+  /* Check supplied data */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+    $message= array_merge($message,$this->netConfigDNS->check());
+
+    $this->dn= "cn=".$this->cn.",ou=netdevices,ou=systems,".$this->base;
+
+    if ($this->cn == "" ){
+      $message[]= _("The required field 'Component name' is not set.");
+    }
+
+    /* Check if given name is a valid host/dns name */
+    if(!is_dns_name($this->cn)){
+      $message[] = _("Please specify a valid name for this object.");
+    }
+
+    /* To check for valid ip*/
+    if($this->netConfigDNS->ipHostNumber == ""){
+       $message[]= _("The required field IP address is empty.");
+    } else {
+      if (!is_ip($this->netConfigDNS->ipHostNumber)){
+        $message[]= _("The field IP address contains an invalid address.");
+      }
+    }
+
+    if ($this->orig_dn != $this->dn){
+      $ldap= $this->config->get_ldap_link();
+      $ldap->cd ($this->base);
+      $ldap->search ("(cn=".$this->cn.")", array("cn"));
+      if ($ldap->count() != 0){
+        while ($attrs= $ldap->fetch()){
+          if(preg_match("/cn=dhcp,/",$attrs['dn'])){
+            continue;
+          }
+          if ($attrs['dn'] != $this->orig_dn){
+            $message[]= sprintf (_("There is already an entry '%s' in the base choosen by you"), $this->cn);
+            break;
+          }
+        }
+      }
+    }
+
+    return ($message);
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    plugin::save();
+
+    /* Remove all empty values */
+    if ($this->orig_dn == 'new'){
+      $attrs= array();
+      foreach ($this->attrs as $key => $val){
+        if (is_array($val) && count($val) == 0){
+          continue;
+        }
+        $attrs[$key]= $val;
+      }
+      $this->attrs= $attrs;
+    }
+
+    /* If this is a new Object IP & Mac aren't set.
+         IP & Mac are msut attributes, so we set this values by here. */
+    if($this->orig_dn == 'new'){
+      $this->attrs['ipHostNumber'] = $this->netConfigDNS->ipHostNumber;
+      $this->attrs['macAddress']  = $this->netConfigDNS->macAddress;
+    }
+
+    /* Write back to ldap */
+    $ldap= $this->config->get_ldap_link();
+    if ($this->orig_dn == 'new'){
+      $ldap->cd($this->config->current['BASE']);
+      $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
+      $ldap->cd($this->dn);
+      $ldap->add($this->attrs);
+      new log("create","component/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+      $this->handle_post_events("add",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
+      
+    } else {
+      if ($this->orig_dn != $this->dn){
+        $this->move($this->orig_dn, $this->dn);
+      }
+
+      $ldap->cd($this->dn);
+      $this->cleanup();
+      $ldap->modify ($this->attrs); 
+      new log("modify","component/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+      $this->handle_post_events("modify",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
+    }
+
+    $this->netConfigDNS->cn = $this->cn;
+    $this->netConfigDNS->save();
+
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of system component/generic with dn '%s' failed."),$this->dn));
+  }
+
+  /* Return plugin informations for acl handling */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Generic"),
+          "plDescription" => _("Component generic"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 1,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("component" => array("description"  => _("Network device"),
+                                                        "objectClass"  => array("device", "ipHost", "ieee802Device"))),
+          "plProvidedAcls"=> array(
+            "cn"                  => _("Name"),
+            "base"                => _("Base"),
+            "description"         => _("Description"))
+          ));
+  }
+
+  /* Display generic part for server copy & paste */
+  function getCopyDialog()
+  {
+    $vars = array("cn");
+    $smarty = get_smarty();
+    $smarty->assign("cn" ,$this->cn);
+    $smarty->assign("object","component");
+    $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE));
+    $ret = array();
+    $ret['string'] = $str;
+    $ret['status'] = "";
+    return($ret);
+  }
+
+
+  function saveCopyDialog()
+  {
+    if(isset($_POST['cn'])){
+      $this->cn = $_POST['cn'];
+    }
+  }
+
+
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);
+    if(isset($source['macAddress'][0])){
+      $this->netConfigDNS->macAddress = $source['macAddress'][0];
+    }
+    if(isset($source['ipHostNumber'][0])){
+      $this->netConfigDNS->ipHostNumber = $source['ipHostNumber'][0];
+    }
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/systems/class_divListRepositories.inc b/gosa-core/plugins/admin/systems/class_divListRepositories.inc
new file mode 100644 (file)
index 0000000..6e43dc1
--- /dev/null
@@ -0,0 +1,84 @@
+<?php
+
+class divListRepository extends MultiSelectWindow
+{
+  /* CheckBoxes, to change default values modify $this->AddCheckBox */
+  var $parent             ;
+  var $ui                 ;
+
+  var $regex ="*";
+
+  function divListRepository ($config,$parent)
+  {
+    MultiSelectWindow::MultiSelectWindow($config,"Repository", "server");
+    
+    $this->parent       = $parent;
+    $this->ui           = get_userinfo();
+
+    $this->SetTitle("repositories");
+    $this->SetSummary(_("List of configured repositories."));
+    $this->SetInformation(_("This menu allows you to create, delete and edit repository settings."));
+    $this->EnableCloseButton(FALSE);
+    $this->EnableSaveButton(FALSE);
+    $this->AddHeader(array("string"=>_("Release"),"attach"=>"style='width:80px;'"));
+    $this->AddHeader(array("string"=>_("Sections")));
+    $this->AddHeader(array("string"=>_("Options"),"attach"=>"style='border-right:0px;width:55px;'"));
+    $this->AddRegex("regex",_("Regular expression for matching object names"),"*",TRUE);
+    $this->EnableAplhabet(TRUE);
+  }
+
+  function GenHeader()
+  {
+    if($this->parent->acl_is_createable()){
+      $this->SetListHeader("<input type=\"image\" src=\"images/fai_new_packages.png\" title=\""._("Add repository")."\"                 name=\"AddRepository\">");
+    }
+  }
+
+  function execute()
+  {
+    $this->ClearElementsList();
+    $this->GenHeader();
+  }
+
+  function setEntries($list)
+  {
+    $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->parent->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;'>";
+    }
+
+    foreach($list as $name => $reps){
+
+      $str = " ";
+      if(preg_match("/".str_replace("*",".*",$this->regex)."/",$reps['Release'])){
+        foreach($reps['Sections'] as $sec){
+          $str.=$sec." ";
+        }
+        $this->AddElement(array(
+              array("string"=>sprintf($link,base64_encode($name),$name),"attach"=>"style='width:80px;'"),
+              array("string"=>sprintf($link,base64_encode($name),_("Sections")." :".$str)),
+              array("string"=>preg_replace("/%s/",base64_encode($name),$edit.$delete),"attach"=>"style='border-right:0px;width:55px;text-  align:right;'")
+              ));
+      }
+    }
+
+  }
+
+  function Save()
+  {
+    MultiSelectWindow :: Save();  
+  }
+
+  function save_object()
+  {
+    /* Save automatic created POSTs like regex, checkboxes */
+    MultiSelectWindow :: save_object();   
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/systems/class_divListSystem.inc b/gosa-core/plugins/admin/systems/class_divListSystem.inc
new file mode 100644 (file)
index 0000000..61871b7
--- /dev/null
@@ -0,0 +1,468 @@
+<?php
+
+class divListSystem extends MultiSelectWindow
+{
+
+  /* Current base */
+  var $selectedBase       = "";
+  var $departments        = array();
+
+  /* Regex */
+  var $Regex              = "*";
+  var $UserRegex          = "*";
+
+  /* CheckBoxes, to change default values modify $this->AddCheckBox */
+  var $ShowServers;
+  var $ShowTerminals;
+  var $ShowWorkstations;
+  var $ShowWinWorkstations;
+  var $ShowPrinters;
+  var $ShowDevices;
+  var $ShowPhones;
+
+  /* Subsearch checkbox */
+  var $SubSearch;
+
+  var $parent             ;
+  var $ui                 ;
+
+  function divListSystem (&$config,$parent)
+  {
+    MultiSelectWindow::MultiSelectWindow($config, "System", array("server",
+                                                                  "workstation",
+                                                                  "terminal",
+                                                                  "phone",
+                                                                  "incoming",
+                                                                  "printer"));
+
+    $this->parent       = $parent;
+    $this->ui           = get_userinfo();
+
+    /* Set list strings */
+    $this->SetTitle(_("List of systems"));
+    $this->SetSummary(_("List of systems"));
+
+    /* Result page will look like a headpage */
+    $this->SetHeadpageMode();
+    $this->SetInformation(_("This menu allows you to add, remove and change the properties of specific systems. You can only add systems which have already been started once."));
+
+    $this->EnableAplhabet   (true);
+
+    /* Disable buttonsm */
+    $this->EnableCloseButton(false);
+    $this->EnableSaveButton (false);
+
+    /* Dynamic action col, depending on snapshot icons */
+    $action_col_size = 110;
+    if($this->parent->snapshotEnabled()){
+      $action_col_size += 38;
+    }
+
+    /* Toggle all selected / deselected */
+    $chk = "<input type='checkbox' id='select_all' name='select_all'
+               onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
+
+    /* set Page header */
+    $this->AddHeader(array("string"=> $chk,          "attach"=>"style='width:20px;'"));
+    $this->AddHeader(array("string"=>"&nbsp;","attach"=>"style='width:20px;'"));
+    $this->AddHeader(array("string"=>_("System / Department")));
+    $this->AddHeader(array("string"=>_("Actions"),"attach"=>"style='width:".$action_col_size."px;border-right:0px;'"));
+
+    /*                  Text        ,Value    ,Name         ,Is selected */
+    $this->AddCheckBox("ShowServers",         _("Select to see servers"),            _("Show servers"),          true);
+    $this->AddCheckBox("ShowTerminals",       _("Select to see Linux terminals"),    _("Show terminals") ,       true);
+    $this->AddCheckBox("ShowWorkstations",    _("Select to see Linux workstations"), _("Show workstations"),     true);
+    $this->AddCheckBox("ShowWinWorkstations", _("Select to see MicroSoft Windows based workstations"), _("Show windows based workstations"),true);
+    $this->AddCheckBox("ShowPrinters",        _("Select to see network printers"),    _("Show network printers") ,true);
+    $this->AddCheckBox("ShowPhones",          _("Select to see VOIP phones"),         _("Show phones") ,          true);
+    $this->AddCheckBox("ShowDevices",         _("Select to see network devices"),     _("Show network devices"),  true);
+
+    /* Add SubSearch checkbox */
+    $this->AddCheckBox(SEPERATOR);
+    $this->AddCheckBox("SubSearch",  _("Select to search within subtrees"), _("Search in subtrees"), false);
+
+    /*                  Name                 ,Text                              ,Default  , Connect with alphabet  */
+    $this->AddRegex   ("Regex",     _("Display systems matching"),"*" , true);
+    $this->AddRegex   ("UserRegex", _("Display systems of user"), "*" , false, "images/search_user.png");
+  }
+
+  function GenHeader()
+  {
+   /* Prepare departments,
+       which are shown in the listbox on top of the listbox
+     */
+    $options= "";
+
+    /* Get all departments within this subtree */
+    $base = $this->config->current['BASE'];
+
+    /* Add base */
+    $tmp = array();
+    $tmp[] = array("dn"=>$this->config->current['BASE']);
+    $tmp=  array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
+                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
+
+    $deps = array();
+    foreach($tmp as $tm){
+      $deps[$tm['dn']] = $tm['dn'];
+    }
+
+    /* Load possible departments */
+    $ui= get_userinfo();
+    $first = "";
+    $found = FALSE;
+    $department = $departments = array();
+    foreach($this->module as $module){
+      $d = $ui->get_module_departments($module);      
+      foreach($d as $department){
+        $departments[$department] = $department;
+      }
+    }
+
+    /* Load possible departments */
+    $ui= get_userinfo();
+    $ids = $this->config->idepartments;
+    $first = "";
+    $found = FALSE;
+    foreach($ids as $dep => $name){
+      if(isset($deps[$dep]) && in_array_ics($dep, $departments)){
+
+        /* Keep first base dn in mind, we could need this
+         *  info if no valid base was found
+         */
+        if(empty($first)) {
+          $first = $dep['dn'];
+        }
+
+        $value = $ids[$dep];
+        if ($this->selectedBase == $dep){
+          $found = TRUE;
+          $options.= "<option selected='selected' value='".$dep."'>$value</option>";
+        } else {
+          $options.= "<option value='".$dep."'>$value</option>";
+        }
+      }
+    }
+
+
+    /* The currently used base is not visible with your acl setup.
+     * Set base to first useable base.
+     */
+    if(!$found){
+      $this->selectedBase = $first;
+    }
+
+    /* If there is at least one c (Create) and one w (Write) acl in this combination
+        display the snapshot paste icon. BUT check the correct acls in the management plugin */
+    $all_module_acls = "";
+    foreach($this->module as $module){
+      $all_module_acls .= $ui->has_complete_category_acls($this->selectedBase,$module);
+    }
+
+    /* Must we add an additional seperator */
+    $add_sep = false;
+   
+    /* Add default header */
+    $listhead = MultiSelectWindow::get_default_header();
+
+    /* Add base selection */
+    $listhead .= _("Base")."&nbsp; <select name='CurrentMainBase' 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;";
+
+    /* Handle create icons */ 
+    $s = ".|"._("Actions")."|\n";
+    $s.= "..|<img src='images/list_new.png' alt='' border='0' class='center'>".
+      "&nbsp;"._("Create")."|\n";
+    if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"terminal/termgeneric"))){
+      $s.= "...|<img src='images/select_terminal.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Terminal")."|"."newsystem_terminal|\n";
+    }
+    if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"workstation/workgeneric"))){
+      $s.= "...|<img src='images/select_workstation.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Workstation")."|"."newsystem_workstation|\n";
+    }
+    if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"workstation/workgeneric"))){
+      $s.= "...|<img src='images/select_server.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Server")."|"."newsystem_server|\n";
+    }
+    if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"phone/phoneGeneric"))){
+      $s.= "...|<img src='images/select_phone.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Phone")."|"."newsystem_phone|\n";
+    }
+    if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"printer/printgeneric"))){
+      $s.= "...|<img src='images/select_printer.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Printer")."|"."newsystem_printer|\n";
+    }
+    if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"component/componentGeneric"))){
+      $s.= "...|<img src='images/select_component.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Component")."|"."newsystem_component|\n";
+    }
+    $s.= "..|<img src='images/edittrash.png' alt='' border='0' class='center'>".
+      "&nbsp;"._("Remove")."|"."remove_multiple|\n";
+
+    /* Add multiple copy & cut icons */
+    if(is_object($this->parent->CopyPasteHandler)){
+      $s.= "..|---|\n";
+      $s.= "..|<img src='images/editcopy.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Copy")."|"."multiple_copy_systems|\n";
+      $s.= "..|<img src='images/editcut.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Cut")."|"."multiple_cut_systems|\n";
+    }
+
+    /* Get copy & paste icon */
+    $Copy_Paste ="";
+    if(preg_match("/(c.*w|w.*c)/",$all_module_acls) &&  $this->parent->CopyPasteHandler){
+      $s .= "..|---|\n";
+      if($this->parent->CopyPasteHandler->entries_queued()){
+        $img = "<img border='0' class='center' src='images/editpaste.png' alt=''>";
+        $s.="..|".$img."&nbsp;"._("Paste")."|editPaste|\n";
+      }else{
+        $img = "<img border='0' class='center' src='images/cant_editpaste.png' alt=''>";
+        $s.="..|".$img."&nbsp;"._("Paste")."\n";
+      }
+    }
+
+    /* Add snapshot icons */
+    if(preg_match("/(c.*w|w.*c)/",$all_module_acls)){
+      $s .= "..|---|\n";
+      $s .= $this->get_snapshot_header(TRUE);
+    }
+
+    $this->SetDropDownHeaderMenu($s);
+    $this->SetListHeader($listhead);
+  }
+
+  function execute()
+  {
+    $this->ClearElementsList();
+    $this->GenHeader();
+  }
+
+  function setEntries($terminals)
+  {
+    $img1  = "<img class='center' src='images/printer.png'            alt='C' title='"._("Cups Server")  ."'>";
+    $img2  = "<img class='center' src='images/scanner.png'            alt='L' title='"._("Log Db") ."'>";
+    $img3  = "<img class='center' src='images/select_terminal.png'    alt='L' title='"._("Syslog Server") ."'>";
+    $img4  = "<img class='center' src='images/mailto.png'             alt='M' title='"._("Mail Server")  ."'>";
+    $img5  = "<img class='center' src='images/select_phone.png'       alt='I' title='"._("Imap Server") ."'>";
+    $img6  = "<img class='center' src='images/fax_small.png'          alt='F' title='"._("Nfs Server")   ."'>";
+    $img7  = "<img class='center' src='images/select_winstation.png'  alt='K' title='"._("Kerberos Server") ."'>";
+    $img8  = "<img class='center' src='images/select_phone.png'       alt='A' title='"._("Asterisk Server") ."'>";
+    $img9  = "<img class='center' src='images/fax_small.png'          alt='F' title='"._("Fax Server") ."'>";
+    $img10 = "<img class='center' src='images/save.png'               alt='L' title='"._("Ldap Server") ."'>";
+
+    $empty    ="<img src='images/empty.png' style='width:16px ; height: 16px;' class='center' alt=''>";
+
+    /* Dynamic action col, depending on snapshot icons */
+    $action_col_size = 110;
+    if($this->parent->snapshotEnabled()){
+      $action_col_size += 38;
+    }
+
+    // User and Template  Images
+    $editlink = "<a href='?plug=".$_GET['plug']."&amp;id=%s&amp;act=edit_entry'>%s</a>";
+
+    /* ACL mapping */
+    $ui = get_userinfo();
+    $tabs = array(
+          "terminal"    => array("CLASS"=>"TERMTABS",     "TABCLASS" =>"termtabs",      "ACL"=> "terminal/termgeneric"),
+          "workstation" => array("CLASS"=>"WORKTABS",     "TABCLASS" =>"worktabs",      "ACL"=> "workstation/workgeneric"),
+          "server"      => array("CLASS"=>"SERVTABS",     "TABCLASS" =>"servtabs",      "ACL"=> "server/servgeneric"),
+          "printer"     => array("CLASS"=>"PRINTTABS",    "TABCLASS" =>"printtabs",     "ACL"=> "printer/printgeneric"),
+          "phone"       => array("CLASS"=>"PHONETABS",    "TABCLASS" =>"phonetabs",     "ACL"=> "phone/phoneGeneric"),
+          "winstation"  => array("CLASS"=>"WINTABS",      "TABCLASS" =>"wintabs",       "ACL"=> "winworkstation/wingeneric"),
+          "incoming"    => array("CLASS"=>"",             "TABCLASS" =>"",              "ACL"=> "incoming/systems"),
+          "component"   => array("CLASS"=>"COMPONENTTABS","TABCLASS" =>"componenttabs", "ACL"=> "component/componentGeneric"));
+
+
+    $cnts = array("component" => 0 , "terminal" => 0 , "workstation" => 0 , 
+                  "printer" => 0 , "phone" => 0 , "server" => 0,
+                  "NewDevice" => 0, "winstation"=> 0);
+
+    // Test Every Entry and generate divlist Array
+    foreach($terminals as $key => $val){
+
+      /* Get system type, it is used to fetch the acls for the current object.
+          "winstation" acls are stored as 2winworkstation", so we have to map this here */
+      $type     = $this->parent->get_system_type($val);
+      if($type == "winstation") {
+        $acl_type = "winworkstation";
+      }else{
+        $acl_type = $type;
+      }
+
+      /* Map NewDevice acls to workstation acls */
+      if($type == "NewDevice" || $type == "ArpNewDevice"){
+        $type     = "incoming";
+        $acl_type = "incoming";
+      }
+
+      /* Get complete category acls */
+      $acl_all  = $ui->has_complete_category_acls($val['dn'],$acl_type) ;
+  
+      /* Get specific generic acls */
+      $acl      = $ui->get_permissions($val['dn'],$tabs[$type]['ACL']);
+
+      $action ="";
+      if(($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
+        $action.= "<input class='center' type='image'
+          src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
+        $action.= "<input class='center' type='image'
+          src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
+      }
+      $action.= "<input class='center' type='image' src='images/edit.png' 
+                    alt='"._("edit")."'     name='system_edit_%KEY%' title='"._("Edit system")."'>";
+      if(preg_match("/(c.*w|w.*c)/",$acl_all)){
+        $action.= $this->GetSnapShotActions($val['dn']);
+      }else{
+        $action.= $empty."&nbsp;".$empty."&nbsp;";
+      }
+
+
+      if(preg_match("/d/",$acl)){
+        $action.= "<input class='center' type='image' src='images/edittrash.png' 
+          alt='"._("delete")."'   name='system_del_%KEY%' title='"._("Delete system")."'>";
+      }else{
+        $action.= $empty;    
+      }
+
+      /* Generate picture list, which is currently disabled */
+      if(in_array("goCupsServer"    ,$val['objectClass'])) $cups    = $img1;   else $cups  =$empty;
+      if(in_array("goLogDBServer"   ,$val['objectClass'])) $logdb   = $img2;   else $logdb =$empty;
+      if(in_array("goSyslogServer"  ,$val['objectClass'])) $syslog  = $img3;   else $syslog=$empty;
+      if(in_array("goImapServer"    ,$val['objectClass'])) $imap    = $img4;   else $imap  =$empty;
+      if(in_array("sambaSamAccount" ,$val['objectClass'])) $samba   = $img5;   else $samba =$empty;
+      if(in_array("goShareServer"   ,$val['objectClass'])) $nfs     = $img6;   else $nfs   =$empty;
+      if(in_array("goKrbServer"     ,$val['objectClass'])) $krb     = $img7;   else $krb   =$empty;
+      if(in_array("goFonServer"     ,$val['objectClass'])) $fon     = $img8;   else $fon   =$empty;
+      if(in_array("goFaxServer"     ,$val['objectClass'])) $fax     = $img9;   else $fax   =$empty;
+      if(in_array("goLdapServer"    ,$val['objectClass'])) $ldap     = $img10;   else $ldap   =$empty;
+
+      $pics = $cups.$logdb.$syslog.$imap.$samba.$nfs.$krb.$fon.$fax.$ldap;
+      $pics = ""; // Pictures currently hidden
+
+      $val['cn'][0]= preg_replace('/\$$/', '', $val['cn'][0]);
+
+      // Generate Array to Add
+      $dsc= "";
+      if (isset($val['description'][0])){
+        $dsc= " [".$val['description'][0]."]";
+      }
+      if((isset($val['is_new']))&&(!empty($val['is_new']))){
+        $display= $val["cn"][0]." ".$val['is_new'].$dsc;
+      }else{
+        $display= $val["cn"][0].$dsc;
+      }
+
+     
+      /* Check if this is a terminal/workstation && if we are allowed to change the gotoRootPasswd */
+      $pwd_acl =""; 
+      if(in_array("gotoWorkstation",$val['objectClass'])){
+        $pwd_acl = $ui->get_permissions($val['dn'],"workstation/workgeneric","gotoRootPasswd");
+      }    
+      if(in_array("gotoTerminal",$val['objectClass'])){
+        $pwd_acl = $ui->get_permissions($val['dn'],"terminal/termgeneric","gotoRootPasswd");
+      }    
+      if(preg_match("/w/",$pwd_acl)){
+        $action2 = "<input class='center' type='image' src='images/certs.png' alt='"._("Password")."'   name='system_setpwd_%KEY%' title='"._("Set root password")."'>";
+      }else{
+        $action2 = $empty;
+      }
+
+
+      if(in_array("gotoWorkstation",$val['objectClass'])){
+        $action2= "<input class='center' type='image' src='images/cdrom.png' alt='"._("Create CD")."'   
+                      name='gen_cd_%KEY%' title='"._("Create FAI CD")."'>&nbsp;".$action2;
+      }else{
+        $action2= $empty.$action2;
+      }
+
+      if(isset($val['message'])){
+        $display.= "  (".$val['message'].")";
+      }
+
+      $img    = $this->parent->convert_list($val);
+
+      /* Cutted objects should be displayed in light grey */
+      if($this->parent->CopyPasteHandler){
+        foreach($this->parent->CopyPasteHandler->queue as $queue_key => $queue_data){
+          if($queue_data['dn'] == $val['dn']) {
+            $display = "<font color='#999999'>".$display."</font>";
+            break;
+          }
+        }
+      }
+
+      $type = $this->parent->get_system_type($val);
+      if($type == "ArpNewDevice"){
+        $type = "NewDevice";
+      }
+      $cnts[$type] ++;
+
+
+      /* Create each field */
+      $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
+                      "attach" => "style='width:20px;'");
+
+      $field1 = array("string" => sprintf($img['img'],$val['dn']), "attach" => "style='text-align:center;width:20px;'");
+      $field2 = array("string" => sprintf($editlink,$key,$display), "attach" => "style='' title='".preg_replace('/ /', '&nbsp;', @LDAP::fix($val['dn']))."'");
+      $field3 = array("string" => preg_replace("/%KEY%/", "$key", $action2.$action), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'");
+      $this->AddElement( array($field0,$field1,$field2,$field3));
+    }
+
+    /* Create summary string for list footer */
+    $num_deps=0;
+    if(!$this->SubSearch){
+      $num_deps = count($this->Added_Departments);
+    }
+
+    $num_ser_str = _("Number of listed servers");
+    $num_ws_str  = _("Number of listed workstations");
+    $num_ter_str = _("Number of listed terminals");
+    $num_pho_str = _("Number of listed phones");
+    $num_prt_str = _("Number of listed printers");
+    $num_com_str = _("Number of listed network components");
+    $num_new_str = _("Number of listed new devices");
+    $num_wws_str = _("Number of listed windows workstations");
+    $num_dep_str = _("Number of listed departments");
+
+    $str = "<img class='center' src='images/select_server.png'
+      title='".$num_ser_str."' alt='".$num_ser_str."'>&nbsp;".$cnts['server']."&nbsp;&nbsp;&nbsp;&nbsp;";
+    $str.= "<img class='center' src='images/select_workstation.png'
+      title='".$num_ws_str."' alt='".$num_ws_str."'>&nbsp;".$cnts['workstation']."&nbsp;&nbsp;&nbsp;&nbsp;";
+    $str.= "<img class='center' src='images/select_terminal.png'
+      title='".$num_ter_str."' alt='".$num_ter_str."'>&nbsp;".$cnts['terminal']."&nbsp;&nbsp;&nbsp;&nbsp;";
+    $str.= "<img class='center' src='images/select_phone.png'
+      title='".$num_pho_str."' alt='".$num_pho_str."'>&nbsp;".$cnts['phone']."&nbsp;&nbsp;&nbsp;&nbsp;";
+    $str.= "<img class='center' src='images/select_printer.png'
+      title='".$num_prt_str."' alt='".$num_prt_str."'>&nbsp;".$cnts['printer']."&nbsp;&nbsp;&nbsp;&nbsp;";
+    $str.= "<img class='center' src='images/select_component.png'
+      title='".$num_com_str."' alt='".$num_com_str."'>&nbsp;".$cnts['component']."&nbsp;&nbsp;&nbsp;&nbsp;";
+    $str.= "<img class='center' src='images/select_newsystem.png'
+      title='".$num_new_str."' alt='".$num_new_str."'>&nbsp;".$cnts['NewDevice']."&nbsp;&nbsp;&nbsp;&nbsp;";
+    $str.= "<img class='center' src='images/select_winstation.png'
+      title='".$num_wws_str."' alt='".$num_wws_str."'>&nbsp;".$cnts['winstation']."&nbsp;&nbsp;&nbsp;&nbsp;";
+    $str.= "<img class='center' src='images/folder.png'
+      title='".$num_dep_str."' alt='".$num_dep_str."'>&nbsp;".$num_deps."&nbsp;&nbsp;&nbsp;&nbsp;";
+
+    $this->set_List_Bottom_Info($str);
+  }
+
+
+  function Save()
+  {
+    MultiSelectWindow :: Save();  
+  }
+
+
+  function save_object()
+  {
+    /* Save automatic created POSTs like regex, checkboxes */
+    MultiSelectWindow :: save_object();  
+
+
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/systems/class_divListSystemService.inc b/gosa-core/plugins/admin/systems/class_divListSystemService.inc
new file mode 100644 (file)
index 0000000..ca31601
--- /dev/null
@@ -0,0 +1,152 @@
+<?php
+
+class divListSystemService extends MultiSelectWindow
+{
+  /* CheckBoxes, to change default values modify $this->AddCheckBox */
+  var $parent             ;
+  var $ui                 ;
+
+  function divListSystemService ($config,$parent)
+  {
+    MultiSelectWindow::MultiSelectWindow($config,"SystemService", "server");
+    
+    $this->parent       = $parent;
+    $this->ui           = get_userinfo();
+    $this->EnableJSLeaveMsg(TRUE);
+
+    /* Set list strings */
+    $this->SetTitle(_("Installed services"));
+    $this->SetSummary(_("Installed services"));
+
+    /* Result page will look like a headpage */
+    $this->SetInformation(_("This menu allows you to add, remove and configure the properties of a specific service."));
+
+    /* Disable buttonsm */
+    $this->EnableCloseButton(false);
+    $this->EnableSaveButton (false);
+
+    /* set Page header */
+    $this->AddHeader(array("string"=>"&nbsp;","attach"=>"style='width:20px;'"));
+    $this->AddHeader(array("string"=>_("Service name")));
+    $this->AddHeader(array("string"=>_("Actions"),"attach"=>"style='width:100px;border-right:0px;'"));
+    $this->HideFilterPart();
+  }
+
+  function GenHeader()
+  {
+    /* Prepare departments,
+       which are shown in the listbox on top of the listbox
+     */
+    $listhead = "<div style='background:#F0F0F9;height:16px;padding:0px;'>".
+    " <input type='image' align='middle' src='images/select_new_server.png' class='center' 
+        name='addNewService' alt='"._("Add service")."' title='"._("Add new service")."'>&nbsp;".
+    " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;".
+    " <input type='image' align='middle' src='images/status_start_all.png' class='center'
+        name='startServices' alt='"._("Start all")."' title='"._("Start all services")."'>&nbsp;".
+    " <input type='image' align='middle' src='images/status_stop_all.png'  class='center'   
+        name='stopServices' alt='"._("Stop service")."' title='"._("Stop all services")."'>&nbsp;".
+    " <input type='image' align='middle' src='images/status_restart_all.png'    class='center'
+        name='restartServices' alt='"._("Restart service")."' title='"._("Restart all services")."'>&nbsp;".
+    "</div>";
+    $this->SetListHeader($listhead);
+  }
+
+  function execute()
+  {
+    $this->ClearElementsList();
+    $this->GenHeader();
+  }
+
+  function setEntries($list)
+  {
+    $tmp = array();
+    foreach($list as $name => $entry){
+      $tmp[$name] = $entry['Message']; 
+    }
+
+    natcasesort($tmp);
+    $tmp2 = array();
+    foreach($tmp as $name => $value){
+      $tmp2[$name] = $list[$name];
+    }
+
+    $ui = get_userinfo();
+
+    foreach($tmp2 as $name => $entry){
+      switch($entry['Status']){
+        case ''      : $str ="&nbsp;";break;
+        case SERVICE_STOPPED  : $str ="<img src='images/status_stopped.png' title='"._("Stopped")."'>"; break;
+        case SERVICE_STARTED  : $str ="<img src='images/status_running.png' title='"._("Started")."'>"; break;
+        case SERVICE_RESTARTED : $str ="<img src='images/status_restarting.png' title='"._("Restarting")."' alt='R'>"; break;
+        default: $str= "<img src='images/select_user.png' alt='".$entry['Status']."' title='"._("User status")." : ".$entry['Status']."'>";
+      }
+
+      /* Get acls */
+      $acl = $ui->get_permissions($this->parent->dn,"server/".$name);
+      if(preg_match("/w/i",$acl) && !preg_match("/r/i",$acl)){
+        continue;
+      }
+  
+      $WasAccount = $this->parent->plugins[$name] -> initially_was_account;    
+  
+      $plug = $_GET['plug'];
+      $link = "<a href='?plug=".$plug."&amp;act=open&amp;id=".$name."'>".$entry['Message']."</a>";
+
+      $field1 = array("string" => $str ,"attach" => "style='width:20px;'");
+      $field2 = array("string" => $link);
+
+      $actions ="";
+      if($entry['AllowStart'] && $WasAccount){
+        $actions .= "&nbsp;<input type='image' name='StartSingleService_".$name."' src='images/status_start.png'
+                            title='"._("Start service")."'>";
+      }else{
+        $actions .= "&nbsp;<img src='images/empty.png' width='16' alt=''>";
+      }
+      if($entry['AllowStart'] && $WasAccount){
+        $actions .= "&nbsp;<input type='image' name='StopSingleService_".$name."' src='images/status_stop.png'
+                            title='"._("Stop service")."'>";
+      }else{
+        $actions .= "&nbsp;<img src='images/empty.png' width='16' alt=''>";
+      }
+      if($entry['AllowStart'] && $WasAccount){
+        $actions .= "&nbsp;<input type='image' name='RestartSingleService_".$name."' src='images/status_restart.png'
+                            title='"._("Restart service")."'>";
+      }else{
+        $actions .= "&nbsp;<img src='images/empty.png' width='16' alt=''>";
+      }
+
+      /* Check if edit is enabled and allowed for current service */
+      if($entry['AllowEdit'] && preg_match("/(r|w)/i",$acl)){
+        $actions .= "&nbsp;<input type='image' name='EditSingleService_".$name."' src='images/edit.png'
+                            title='"._("Edit service")."'>";
+      }else{
+        $actions .= "&nbsp;<img src='images/empty.png' width='16' alt=''>";
+      }
+
+      /* Check if remove is enabled and allowed for current service */
+      if($entry['AllowRemove'] && preg_match("/d/i",$acl)){
+        $actions .= "&nbsp;<input type='image' name='RemoveSingleService_".$name."' src='images/edittrash.png'
+                            title='"._("Remove service")."'>";
+      }else{
+        $actions .= "&nbsp;<img src='images/empty.png' width='16' alt=''>";
+      }
+
+      $field3 = array("string" => $actions ,"attach" => "style='width:100px;border-right:0px;'");
+      $this->AddElement(array($field1,$field2,$field3));
+    }
+  }
+
+  function Save()
+  {
+    MultiSelectWindow :: Save();  
+  }
+
+  function save_object()
+  {
+    /* Save automatic created POSTs like regex, checkboxes */
+    MultiSelectWindow :: save_object();   
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/systems/class_phoneGeneric.inc b/gosa-core/plugins/admin/systems/class_phoneGeneric.inc
new file mode 100644 (file)
index 0000000..f169c0e
--- /dev/null
@@ -0,0 +1,521 @@
+<?php
+
+class phoneGeneric extends plugin
+{
+  /* CLI vars */
+  var $cli_summary= "Manage phone base objects";
+  var $cli_description= "Some longer text\nfor help";
+  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* Generic terminal attributes */
+  var $interfaces= array();
+  var $ignore_account= TRUE;
+
+  /* Needed values and lists */
+  var $base             = "";
+  var $cn               = "";
+  var $description      = "";
+  var $orig_dn          = "";
+  var $goFonType        = "";
+  var $goFonDmtfMode    = "";
+  var $goFonHost        = "";
+  var $goFonDefaultIP   = "dynamic";
+  var $goFonQualify     = "";
+  var $goFonAuth        = "";
+  var $goFonSecret      = "";
+  var $goFonInkeys      = "";
+  var $goFonPermit      = array();
+  var $goFonDeny        = array();
+  var $goFonOutkey      = "";
+  var $goFonTrunk       = "";
+  var $goFonAccountCode = "";
+  var $goFonMSN         = "";
+  var $selected_categorie    = 0;
+  var $netConfigDNS;
+  var $view_logged      = FALSE;
+
+  /* attribute list for save action */
+  var $attributes= array("cn", "description",
+                          "goFonType","goFonDmtfMode","goFonHost","goFonDefaultIP",
+                          "goFonQualify","goFonAuth","goFonSecret","goFonInkeys","goFonOutkey",
+                          "goFonTrunk","goFonAccountCode","goFonMSN","selected_categorie","goFonPermit","goFonDeny" 
+                         );
+
+  /* this array defines which attributes are schown / saved for the different type of phones */ 
+  var $usedattrs =    array( "0"=>array("cn", "description", 
+                                  "goFonType","goFonDmtfMode","goFonHost","goFonDefaultIP",
+                                  "goFonQualify"),
+                             "1"=>array("cn", "description", 
+                                  "goFonType","goFonHost","goFonDefaultIP",
+                                  "goFonQualify","goFonAuth","goFonSecret","goFonInkeys","goFonOutkey",
+                                  "goFonTrunk","goFonAccountCode","selected_categorie","goFonPermit","goFonDeny"),
+                             "2"=>array("cn", "description", "goFonMSN"));
+  
+
+  var $objectclasses= array("top", "goFonHardware");
+
+  function phoneGeneric (&$config, $dn= NULL, $parent= NULL)
+  {
+    plugin::plugin ($config, $dn, $parent);
+    $this->netConfigDNS = new termDNS($this->config,$this,$this->objectclasses, true);
+
+    /* Set base */
+    if ($this->dn == "new"){
+      $ui= get_userinfo();
+      $this->base= dn2base($ui->dn);
+      $this->cn= "";
+    } else {
+      $this->base= preg_replace ("/^[^,]+,[^,]+,[^,]+,/", "", $this->dn);
+    }
+  
+    if($this->goFonMSN != ""){
+      $this->selected_categorie = 2;
+    }elseif($this->goFonAccountCode != ""){
+      $this->selected_categorie = 1 ;
+    
+      if(isset($this->attrs['goFonPermit']['count'])){
+        unset ($this->attrs['goFonPermit']['count']);
+        $this->goFonPermit=$this->attrs['goFonPermit'];
+      }  
+     
+      if(isset($this->attrs['goFonDeny']['count'])){
+        unset ($this->attrs['goFonDeny']['count'])   ;
+        $this->goFonDeny=$this->attrs['goFonDeny'];
+      } 
+
+    } else {
+      $this->selected_categorie = 0;
+    }
+
+    if($this->goFonDefaultIP!="dynamic"){
+      $this->goFonDefaultIP = "network";
+    }
+
+    /* Save dn for later references */
+    $this->orig_dn= $this->dn;
+  }
+
+  function set_acl_base($base)
+  {
+    plugin::set_acl_base($base);
+    $this->netConfigDNS->set_acl_base($base);
+  }
+
+  function set_acl_category($cat)
+  {
+    plugin::set_acl_category($cat);
+    $this->netConfigDNS->set_acl_category($cat);
+  }
+
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","phone/".get_class($this),$this->dn);
+    }
+
+    /* Do we represent a valid phone? */
+    if (!$this->is_account && $this->parent === NULL){
+      $display= "<img alt=\"\" src=\"images/stop.png\" align=middle>&nbsp;<b>".
+        _("This 'dn' has no phone features.")."</b>";
+      return($display);
+    }
+
+    /* Base select dialog */
+    $once = true;
+    foreach($_POST as $name => $value){
+      if(preg_match("/^chooseBase/",$name) && $once){
+        $once = false;
+        $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
+        $this->dialog->setCurrentBase($this->base);
+      }
+    }
+
+    /* Dialog handling */
+    if(is_object($this->dialog)){
+      /* Must be called before save_object */
+      $this->dialog->save_object();
+
+      if($this->dialog->isClosed()){
+        $this->dialog = false;
+      }elseif($this->dialog->isSelected()){
+        
+        /* A new base was selected, check if it is a valid one */
+        $tmp = $this->get_allowed_bases();
+        if(isset($tmp[$this->dialog->isSelected()])){
+          $this->base = $this->dialog->isSelected();
+        }
+
+        $this->dialog= false;
+      }else{
+        return($this->dialog->execute());
+      }
+    }
+
+    /* handle Permit Add*/
+    if(isset($_POST['goFonPermitAdd']) && $this->acl_is_writeable("goFonPermit")){
+      if(isset($_POST['goFonPermitNew'])){
+        if(is_string($this->goFonPermit)){
+          $this->goFonPermit=array();
+        }
+        $new = $_POST['goFonPermitNew'];
+        if(strlen($new)> 1) {
+          $this->goFonPermit[]= $new;
+        }
+      }
+    }
+      
+    /* handle Deny Add*/
+    if(isset($_POST['goFonDenyAdd']) && $this->acl_is_writeable("goFonDeny")){
+      if(isset($_POST['goFonDenyNew'])){
+        if(is_string($this->goFonDeny)){
+          $this->goFonDeny=array();
+        }
+        $new = $_POST['goFonDenyNew'];
+        if(strlen($new)> 1) {
+          $this->goFonDeny[]= $new;
+        }
+      }
+    }
+
+    /* Handle Permit Deletion*/
+    if(isset($_POST['goFonPermitDel']) && $this->acl_is_writeable("goFonPermit")){
+      if(isset($_POST['goFonPermitS'])){
+        if(is_string($this->goFonPermit)){
+          $this->goFonPermit=array();
+        }
+        $new = $_POST['goFonPermitS'];
+        $tmp = array_flip($this->goFonPermit);
+        unset($tmp[$new]);
+        $this->goFonPermit=array();
+        foreach(array_flip($tmp) as $tm){
+          $this->goFonPermit[]=$tm;
+        }
+      }
+    }
+
+
+    /* Handle Permit Deletion*/
+    if(isset($_POST['goFonDenyDel']) && $this->acl_is_writeable("goFonDeny")){
+      if(isset($_POST['goFonDenyS'])){
+        if(is_string($this->goFonDeny)){
+          $this->goFonDeny=array();
+        }
+        $new = $_POST['goFonDenyS'];
+        $tmp = array_flip($this->goFonDeny);
+        unset($tmp[$new]);
+        $this->goFonDeny=array();
+        foreach(array_flip($tmp) as $tm){
+          $this->goFonDeny[]=$tm;
+        }
+      }
+    }
+  
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+
+    $smarty->assign("bases", $this->get_allowed_bases());
+
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+    $smarty->assign("staticAddress","<font class=\"must\">*</font>");// $this->config->idepartments);
+
+    /* Create Arrays for samrty select boxes */
+    $smarty->assign("categories",     array("SIP","IAX","CAPI"));
+    $smarty->assign("goFonTypes",     array("peer"      =>"peer"      ,"user"   =>"user"    ,"friend" =>"friend"));
+    $smarty->assign("goFonDmtfModes", array("inband"    =>"inband"    ,"rfc2833"=>"rfc2833" ,"info"   =>"info"));
+    $smarty->assign("goFonAuths",     array("plaintext" =>"plaintext" ,"md5"    =>"md5"     /*,"rsa"    =>"rsa"*/));
+    $smarty->assign("goFonTrunks",    array("yes" =>_("yes") ,"no" => _("no")));
+
+    /* deativate all fields that are not used by the specified type */
+    foreach($this->attributes as $att){
+      if((!in_array($att,$this->usedattrs[$this->selected_categorie]))){
+        $smarty->assign($att."USED", "disabled" );
+        $smarty->assign($att, "");
+      }else{
+        $smarty->assign($att."USED", "" );
+        $smarty->assign($att, $this->$att);
+      }
+    }
+    
+    $smarty->assign("selected_categorie",$this->selected_categorie);
+
+    /* Assign attributes */
+    $smarty->assign("base_select", $this->base);
+    $smarty->assign("goFonDefaultIPs",array("dynamic"=>_("dynamic"),"network"=>_("Networksettings")));
+    /* Show main page */
+    $str = $this->netConfigDNS->execute();
+    if(is_object($this->netConfigDNS->dialog)){
+      return($str);
+    }
+    $smarty->assign("netconfig", $str);
+    $smarty->assign("phonesettings", dirname(__FILE__)."/phonesettings.tpl");
+    return($smarty->fetch (get_template_path('phone.tpl', TRUE)));
+  }
+
+  function remove_from_parent()
+  {
+    if($this->acl_is_removeable()){
+      $ldap= $this->config->get_ldap_link();
+      $ldap->cd($this->config->current['BASE']);
+
+      $ldap->search ("(&(objectClass=goFonAccount)(goFonHardware=".$this->cn."))", array("uid","cn"));
+      while ($attr =  $ldap->fetch()){
+        print_red(sprintf(_("Can't delete because there are users which are depending on this phone. One of them is user '%s'."),
+              ($attr['uid'][0]." - ".$attr['cn'][0])));
+        return;
+      }
+
+      $this->netConfigDNS->remove_from_parent();
+      $ldap->rmdir($this->dn);
+  
+      new log("remove","phone/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+
+      show_ldap_error($ldap->get_error(), sprintf(_("Removing of system phone/generic with dn '%s' failed."),$this->dn));
+      $this->handle_post_events("remove",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
+
+      /* Delete references to object groups */
+      $ldap->cd ($this->config->current['BASE']);
+      $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
+      while ($ldap->fetch()){
+        $og= new ogroup($this->config, $ldap->getDN());
+        unset($og->member[$this->dn]);
+        $og->save ();
+      }
+    }
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    /* Create a base backup and reset the
+       base directly after calling plugin::save_object();
+       Base will be set seperatly a few lines below */
+    $base_tmp = $this->base;
+    plugin::save_object();
+    $this->base = $base_tmp;
+
+    $this->netConfigDNS->save_object();
+
+    /* Set new base if allowed */
+    $tmp = $this->get_allowed_bases();
+    if(isset($_POST['base'])){
+      if(isset($tmp[$_POST['base']])){
+        $this->base= $_POST['base'];
+      }
+    }
+  }
+
+
+  /* Check supplied data */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+    $message= array_merge($message, $this->netConfigDNS->check());
+
+    $this->dn= "cn=".$this->cn.",ou=phones,ou=systems,".$this->base;
+
+    /* To check for valid ip*/
+    if($this->netConfigDNS->ipHostNumber == ""){
+       $message[]= _("The required field IP address is empty.");
+    } else {
+      if (!is_ip($this->netConfigDNS->ipHostNumber)){
+        $message[]= _("The field IP address contains an invalid address.");
+      }
+    }
+
+    /* Check if given name is a valid host/dns name */
+    if(!is_dns_name($this->cn) ){
+      $message[] = _("Please specify a valid name for this object.");
+    }
+
+    if ($this->cn == ""){
+      $message[]= _("The required field 'Phone name' is not set.");
+    }
+    if ($this->cn == "0"){ 
+      $message[]= _("The 'Phone name' '0' is reserved and cannot be used.");
+    }
+
+    if ($this->orig_dn != $this->dn){
+      $ldap= $this->config->get_ldap_link();
+      $ldap->cd ($this->base);
+      $ldap->search ("(cn=".$this->cn.")", array("cn"));
+      if ($ldap->count() != 0){
+        while ($attrs= $ldap->fetch()){
+
+          if(preg_match("/cn=dhcp,/",$attrs['dn'])){
+            continue;
+          }
+  
+          if ($attrs['dn'] != $this->orig_dn){
+            $message[]= sprintf (_("There is already an entry '%s' in the base choosen by you"), $this->cn);
+            break;
+          }
+        }
+      }
+    }
+
+    return ($message);
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    plugin::save();
+   
+   
+    /* only to define which attrs to save*/ 
+    $mode = $this->selected_categorie;
+
+    /* Remove all unwanted attrs */
+    foreach($this->attributes as $att){
+      
+      /* Check all attributes, if they are needed for this type of phone */
+      if(!in_array($att,$this->usedattrs[$mode])){
+        $this->attrs[$att] = array();
+      }
+    }
+
+    /* unset the categorie*/
+    unset($this->attrs['selected_categorie']);
+    
+    /* Remove all empty values */
+    if ($this->orig_dn == 'new'){
+      $attrs= array();
+      foreach ($this->attrs as $key => $val){
+        if (is_array($val) && count($val) == 0){
+          continue;
+        }
+        $attrs[$key]= $val;
+      }
+      $this->attrs= $attrs;
+    }
+
+    if($this->goFonDefaultIP!="dynamic"){
+      $this->attrs['goFonDefaultIP'] = $this->netConfigDNS->ipHostNumber;
+    }    
+
+    $this->attrs = $this->netConfigDNS->getVarsForSaving($this->attrs);
+
+    /* Write back to ldap */
+    $ldap= $this->config->get_ldap_link();
+    if ($this->orig_dn == 'new'){
+      $ldap->cd($this->config->current['BASE']);
+      $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
+      $ldap->cd($this->dn);
+      $ldap->add($this->attrs);
+      new log("create","phone/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+      $this->handle_post_events("add",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
+    } else {
+      if ($this->orig_dn != $this->dn){
+        $this->move($this->orig_dn, $this->dn);
+      }
+
+      $ldap->cd($this->dn);
+      $this->cleanup();
+      $ldap->modify ($this->attrs); 
+      new log("modify","phone/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+
+      // $user_phone_reload   
+      $ldap->cd ($this->config->current['BASE']); 
+      $user_phone_assignment = $ldap->fetch($ldap->search("(&(objectClass=goFonAccount)(goFonHardware=".$this->cn."))",array("uid")));
+      if($user_phone_assignment){
+        $usertab= new usertabs($this->config,$this->config->data['TABS']['USERTABS'], $user_phone_assignment['dn']);
+        $usertab->by_object['phoneAccount']->is_modified = true;
+        $usertab->save();
+        unset($usertab);
+      }
+      $this->handle_post_events("modify",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
+    }
+    $this->netConfigDNS->cn = $this->cn;    
+    $this->netConfigDNS->save();
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of system phone/generic with dn '%s' failed."),$this->dn));
+  }
+
+
+  /* Display generic part for server copy & paste */
+  function getCopyDialog()
+  {
+    $vars = array("cn");
+    $smarty = get_smarty();
+    $smarty->assign("cn" ,$this->cn);
+    $smarty->assign("object","phone");
+    $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE));
+    $ret = array();
+    $ret['string'] = $str;
+    $ret['status'] = "";
+    return($ret);
+  }
+
+
+  function saveCopyDialog()
+  {
+    if(isset($_POST['cn'])){
+      $this->cn = $_POST['cn'];
+    }
+  }
+
+
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);
+    if(isset($source['macAddress'][0])){
+      $this->netConfigDNS->macAddress = $source['macAddress'][0];
+    }
+    if(isset($source['ipHostNumber'][0])){
+      $this->netConfigDNS->ipHostNumber = $source['ipHostNumber'][0];
+    }
+
+    $source_o = new phoneGeneric($this->config, $source['dn']);
+    $this->selected_categorie = $source_o->selected_categorie;
+  }
+
+
+  /* Return plugin informations for acl handling
+      #FIXME FAIscript seams to ununsed within this class... */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Generic"),
+          "plDescription" => _("Phone generic"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 0,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("phone" => array("description"  => _("Phone hardware"),
+                                                    "objectClass"  => "goFonHardware")),
+          "plProvidedAcls"=> array(
+            "cn"                  => _("Name"),
+            "base"                => _("Base"),
+            "description"         => _("Description"),
+            "goFonType"           => _("SIP Mode"),
+            "goFonDmtfMode"       => _("SIP DTMF mode"),
+            "goFonDefaultIP"      => _("SIP Default ip"),
+            "goFonQualify"        => _("SIP Qualify"),
+            "goFonAuth"           => _("IAX authentication type"),
+            "goFonSecret"         => _("IAX secret"),
+            "goFonAccountCode"    => _("IAX account code"),
+            "goFonTrunk"          => _("IAX trunk lines"),
+            "goFonPermit"         => _("IAX permit settings"),
+            "goFonDeny"           => _("IAX deny settings"),
+            "goFonMSN"            => _("CAPI MSN"),
+            "categorie"  => _("Hardware type"))
+          ));
+  }
+
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/systems/class_printGeneric.inc b/gosa-core/plugins/admin/systems/class_printGeneric.inc
new file mode 100644 (file)
index 0000000..54092c6
--- /dev/null
@@ -0,0 +1,1048 @@
+<?php
+
+class printgeneric extends plugin
+{
+  /* CLI vars */
+  var $cli_summary      = "Manage terminal base objects";
+  var $cli_description  = "Some longer text\nfor help";
+  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* Generic terminal attributes */
+  var $interfaces     = array();
+  var $ignore_account = FALSE;
+
+  /* Needed values and lists */
+  var $base             = "";
+  var $cn               = "";
+  var $l                = "";
+  var $description      = "";
+  var $labeledURI       = "";
+  var $gotoPrinterPPD   = "";
+  var $initial_PPD      = "";
+  var $orig_dn          = "";
+
+  var $UserMember       ="";
+  var $UserMembers      =array();
+  var $UserMemberKeys   =array();
+
+  var $AdminMember      ="";
+  var $AdminMembers     =array();
+  var $AdminMemberKeys  =array();
+
+  var $PPDdialogToSave  = NULL;
+  var $BelongsTo        = "unknown"; //  Specifies if this is a standalone printer, or belongs to a terminal / WS
+
+  var $member           =array();
+  var $strings          = "";
+  var $netConfigDNS;
+  var $baseSelection    = false;
+  var $macAddress       = "";
+
+  var $gotoUserAdminPrinter;
+  var $gotoGroupAdminPrinter ;
+  var $gotoGroupPrinter;
+  var $gotoUserPrinter ;
+
+  /* attribute list for save action */
+  var $attributes     = array("cn", "description", "l", "labeledURI", "gotoPrinterPPD","gotoUserPrinter", "macAddress", 
+                              "gotoUserAdminPrinter","gotoGroupAdminPrinter","gotoUserPrinter","gotoGroupPrinter");
+  var $objectclasses  = array("top", "gotoPrinter");
+  var $view_logged    = FALSE;
+  var $parent;
+
+  function printgeneric (&$config, $dn,$parent_init,$parent)
+  {
+    $this->config = &$config;
+    $this->dn = $dn; 
+    /* If parent was posted(the tabs object) we can detect the printer type. */
+    if($parent){
+      $this->parent = $parent;
+      $this->getTypeOfPrinter();
+    }else{
+      $this->BelongsTo = "unknown";
+      return;
+    }
+
+    /* Update dn, to ensure storing as printer instead of WS / terminal */
+    if(preg_match("/Terminal/i",$this->BelongsTo) || preg_match("/TerminalTemplate/i",$this->BelongsTo)){
+      $this->dn= preg_replace("/ou=terminals,/","ou=printers,",$this->dn);
+    }
+
+    if(preg_match("/Workstation/i",$this->BelongsTo) || preg_match("/WorkstationTemplate/i",$this->BelongsTo)){
+      $this->dn= preg_replace("/ou=workstations,/","ou=printers,",$this->dn);
+    }
+
+    $this->orig_dn = $this->dn;
+
+    /* Get printer settings, possibly dn has changed */
+    plugin::plugin ($config, $this->dn);
+
+    /* Get is_account initially_was_account status */
+    $this->getTypeOfPrinter(true);
+
+    /* set orig dn to new if object is new */
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cat($this->dn, array('dn'));
+    if(!$ldap->count()){
+      $this->orig_dn = "new";
+    }
+    
+    /* create dns object */
+    $this->netConfigDNS = new termDNS($this->config, $this,$this->objectclasses);
+
+    /* Set base */
+    if ($this->dn == "new"){
+      $ui= get_userinfo();
+      $this->base= dn2base($ui->dn);
+      $this->cn= "";
+    } else {
+    
+      /* Set base and check if the extracted base exists */
+      if(preg_match("/ou=incoming,/",$this->dn)){
+        $this->base= preg_replace("/ou=incoming,/","",dn2base($this->dn));
+      }else{
+        $this->base= preg_replace("/ou=printers,ou=systems,/","",dn2base($this->dn));
+      }
+
+      if(!isset($this->config->idepartments[$this->base])){
+        print_red(_("Can't extract a valid base out of object dn, setting base to '%s'."),$_SESSION['CurrentMainBase']);
+        $this->base = $_SESSION['CurrentMainBase'];
+      }
+    }
+
+    /* Extract selected ppd */
+    if(isset($this->gotoPrinterPPD)){
+      $this->gotoPrinterPPD = preg_replace("/^http.*ppd\//i","",$this->gotoPrinterPPD);
+    }
+
+    $this->initial_PPD = $this->gotoPrinterPPD;
+
+    /* Prepare different member types */ 
+    foreach(array("AddUser"       =>"gotoUserPrinter",
+          "AddGroup"      =>"gotoGroupPrinter",
+          "AddAdminUser"  =>"gotoUserAdminPrinter",
+          "AddAdminGroup" =>"gotoGroupAdminPrinter") as $type => $attr){
+
+      /* $this->members contains all members */
+      $this->member[$type]=array();
+
+      if (isset($this->attrs[$attr]['count'])) {
+        unset($this->attrs[$attr]['count']);
+      }
+
+      if(isset($this->attrs[$attr])){
+        foreach($this->attrs[$attr] as $mem){
+          if(preg_match("/Group/",$type)){
+            $ldap->search("(&(objectClass=posixGroup)(cn=".$mem."))",array("cn","description"));
+            if($ldap->count()){
+              $entry = $ldap->fetch();
+              $this->member[$type][$entry['cn'][0]]=$entry;
+            }
+          }else{
+            $ldap->search("(&(objectClass=person)(objectClass=inetOrgPerson)(uid=".$mem."))",array("cn","uid"));
+            if($ldap->count()){
+              $entry = $ldap->fetch();
+              $this->member[$type][$entry['uid'][0]]=$entry;
+            }
+          }
+        }
+      }
+    }
+  }
+
+  function set_acl_base($base)
+  {
+    plugin::set_acl_base($base);
+    if(is_object($this->netConfigDNS)){
+      $this->netConfigDNS->set_acl_base($base);
+    }
+  }
+
+  function set_acl_category($cat)
+  {
+    plugin::set_acl_category($cat);
+    if(is_object($this->netConfigDNS)){
+      $this->netConfigDNS->set_acl_category($cat);
+    }
+  }
+
+  /* Detect type of printer.
+   * Printer can be stand alone, belong to a workstation or belong to a terminal. 
+   * We can detect the type printer type when comparing the tabs objects
+   */
+  function getTypeOfPrinter($UpdateAccountStatus = false)
+  {
+    /* Disable account as default
+     */  
+    $this->is_account = $this->initially_was_account = false;
+
+    /* Detect type of printer via parent tabs.
+     */
+
+    $class = get_class($this->parent);
+    if(isset($this->parent->by_object['workgeneric'])){
+
+      /* Exclude templates 
+       */
+      $this->cn = $this->parent->by_object['workgeneric']->cn;
+      if($this->parent->by_object['workgeneric']->cn == "wdefault"){
+        $this->BelongsTo = "WorkstationTemplate";
+      }else{
+        $this->BelongsTo = "Workstation";
+      }
+    }elseif(isset($this->parent->by_object['termgeneric'])){
+
+      /* Exclude templates 
+       */
+      $this->cn = $this->parent->by_object['termgeneric']->cn;
+      if($this->parent->by_object['termgeneric']->cn == "default"){
+        $this->BelongsTo = "TerminalTemplate";  
+      }else{
+        $this->BelongsTo = "Terminal";
+      }
+    }elseif(isset($this->parent->by_name['printgeneric'])){
+      $this->BelongsTo  = "Printer";
+    }
+
+    if($UpdateAccountStatus){
+
+      /* Set is_account / was account 
+       */
+      if($this->dn == "new"){
+        $this->initially_was_account = false;
+      }
+
+      /* If is printer it must be a true account.
+       */
+      if(preg_match("/printer/i",$this->BelongsTo)){
+        $this->is_account = true;
+      }
+
+      /* Update dn, to ensure storing as printer instead of WS / terminal
+       */
+      if(preg_match("/terminal/i",$this->BelongsTo)){
+        $this->dn= preg_replace("/ou=terminals,/","ou=printers,",$this->dn);
+      }
+
+      if(preg_match("/workstation/i",$this->BelongsTo)){
+        $this->dn= preg_replace("/ou=workstations,/","ou=printers,",$this->dn);
+      }
+
+      /* Detect if this is a valid printer account;
+       */
+      $ldap = $this->config->get_ldap_link();
+      $ldap->cat($this->dn, array('objectClass'));
+
+      if($ldap->count()){
+        $attrs = $ldap->fetch();
+        if(in_array("gotoPrinter",$attrs['objectClass'])){
+          $this->initially_was_account = true;
+          $this->is_account             = true;
+        }else{
+          $this->is_account = false;
+        }
+      }
+    }
+  }
+
+  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);
+    }
+
+
+    /* If type of printer couldn't be detected (because of missing parent object in construction) 
+     * hide this tab.
+     */
+    if(preg_match("/unknown/i",$this->BelongsTo)){
+      $display= $this->show_enable_header(_("Add printer extension"),
+          _("Could not initialize printer tab, parameter parent was missing while construction."),TRUE,TRUE);
+      return($display);
+    }
+
+    /* Templates can't have printer extensions 
+     */
+    if(preg_match("/WorkstationTemplate/i",$this->BelongsTo)){
+      $display= $this->show_enable_header(_("Add printer extension"),
+          _("This is a workstation template, printer tab is disabled."),TRUE,TRUE);
+      return($display);
+    }
+    if(preg_match("/TerminalTemplate/i",$this->BelongsTo)){
+      $display= $this->show_enable_header(_("Add printer extension"),
+          _("This is a terminal template, printer tab is disabled."),TRUE,TRUE);
+      return($display);
+    }
+
+    /* Get cn from base object */
+    if(preg_match("/^Workstation$/i",$this->BelongsTo)){
+      $this->cn = $this->parent->by_object['workgeneric']->cn;
+    }
+    if(preg_match("/^Terminal$/i",$this->BelongsTo)){
+      $this->cn = $this->parent->by_object['termgeneric']->cn;
+    }
+
+    $smarty= get_smarty();
+
+    /* Assign acls */
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL", $this->getacl($name));
+    }
+
+    $display="";
+
+    /* Tell smarty if this is a standalone object or a terminal / WS depending printer */
+    if(preg_match("/^Printer$/i",$this->BelongsTo)){    
+      $smarty->assign("StandAlone",true);
+    }else{
+      $smarty->assign("StandAlone",false);
+    }
+
+    /* 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;
+      }
+    }
+
+    /* Do we represent a valid printer? */
+    if (!$this->is_account && $this->parent === NULL){
+      $display= "<img alt=\"\" src=\"images/stop.png\" align=middle>&nbsp;<b>".
+        _("This 'dn' has no printer features.")."</b>";
+      return($display);
+    }
+
+    /* If this is a WS / Terminal depending printer, display account state button */
+    if(!preg_match("/^Printer$/i",$this->BelongsTo)){
+      if((empty($this->cn)) && ($this->dn != "new")){
+        $display= $this->show_enable_header(_("Add printer extension"),
+            _("This object has printer extension disabled. You can't enable it while 'cn' is not present in entry. Possibly you are currently creating a new terminal template"),TRUE,TRUE);
+        $this->is_account= false;
+        return $display;
+      }
+
+      if (($this->is_account)){
+        if(preg_match("/^Workstation$/i",$this->BelongsTo)){
+          $display= $this->show_disable_header(_("Remove printer extension"),
+              _("This workstation has printer extension enabled.You can disable it by clicking below."));
+        }elseif(preg_match("/^Terminal$/i",$this->BelongsTo)){
+          $display= $this->show_disable_header(_("Remove printer extension"),
+              _("This terminal has printer extension enabled. You can disable it by clicking below."));
+        }
+      }else{
+        if(preg_match("/^Workstation$/i",$this->BelongsTo)){
+          $display= $this->show_disable_header(_("Add printer extension"),
+              _("This workstation has printer extension disabled. You can enable it by clicking below."));
+        }elseif(preg_match("/^Terminal$/i",$this->BelongsTo)){
+          $display= $this->show_enable_header(_("Add printer extension"),
+              _("This terminal has printer extension disabled. You can enable it by clicking below."));
+        }  
+        return ($display);
+      }
+    }
+
+    /* Base select dialog */
+    $once = true;
+    foreach($_POST as $name => $value){
+      if(preg_match("/^chooseBase/",$name) && $once && $this->acl_is_moveable()){
+        $once = false;
+        $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
+        $this->dialog->setCurrentBase($this->base);
+        $this->baseSelection = true;
+      }
+    }
+
+    /* Dialog handling for base select dialog
+     * Check if base was selected, dialog aborted etc */
+    if(is_object($this->dialog)){
+
+      $this->dialog->save_object();
+      if($this->baseSelection){
+        if($this->dialog->isClosed()){
+          $this->dialog = false;
+          $this->baseSelection = false;
+        }elseif($this->dialog->isSelected()){
+
+          /* A new base was selected, check if it is a valid one */
+          $tmp = $this->get_allowed_bases();
+          if(isset($tmp[$this->dialog->isSelected()])){
+            $this->base = $this->dialog->isSelected();
+          }
+
+          $this->dialog= false;
+          $this->baseSelection = false;
+        }else{
+          return($this->dialog->execute());
+        }
+      }
+    }
+
+    /* Fill templating stuff */
+    $smarty->assign("bases", $this->get_allowed_bases());
+    $smarty->assign("base_select", $this->base);
+
+    /* Assign attributes */
+    foreach ($this->attributes as $attr){
+      $smarty->assign("$attr", $this->$attr);
+    }
+
+    if(isset($_POST['AddUser'])){
+      $this->dialog = new selectUserToPrinterDialog($this->config, NULL,"AddUser");
+    }
+    if(isset($_POST['AddGroup'])){
+      $this->dialog = new selectUserToPrinterDialog($this->config, NULL,"AddGroup");
+    }
+    if(isset($_POST['AddAdminUser'])){
+      $this->dialog = new selectUserToPrinterDialog($this->config, NULL,"AddAdminUser");
+    }
+    if(isset($_POST['AddAdminGroup'])){
+      $this->dialog = new selectUserToPrinterDialog($this->config, NULL,"AddAdminGroup");
+    }
+
+    /* Display ppd configure/select dialog      */
+    if(isset($_POST['EditDriver'])){
+      if($this->PPDdialogToSave && is_object($this->PPDdialogToSave)){
+        $this->dialog = $this->PPDdialogToSave;
+      }else{
+        $this->dialog = new printerPPDDialog($this->config, $this->dn,$this->gotoPrinterPPD);
+        $this->dialog->cn= $this->cn;
+      }
+    }
+
+    /* remove ppd */
+    if(isset($_POST['RemoveDriver'])){
+      $this->gotoPrinterPPD = array();
+      $this->PPDdialogToSave = NULL;
+    }
+
+    /* Close ppd dialog */
+    if(isset($_POST['ClosePPD'])){
+      unset($this->dialog);
+      $this->dialog=FALSE;
+    }
+
+    /* Save selected ppd */
+    if(isset($_POST['SavePPD'])){
+      $this->dialog->save_object();
+      if(count($this->dialog->check())){
+        foreach($this->dialog->check() as $msg){
+          print_red($msg);
+        }
+      }else{
+        $this->gotoPrinterPPD = array();
+        $this->gotoPrinterPPD = $this->dialog->save();
+        $this->PPDdialogToSave = $this->dialog;
+        unset($this->dialog);
+        $this->dialog=FALSE;
+      }
+    }
+
+     /* Member management, delete user / group / admin ..*/
+    if((isset($_POST['DelUser']))&&(isset($_POST['UserMember']))){
+      foreach($_POST['UserMember'] as $mem){
+        $this->DelMember('AddUser',$mem);
+      }
+    }
+
+    if((isset($_POST['DelUser']))&&(isset($_POST['UserMember']))){
+      foreach($_POST['UserMember'] as $mem){
+        $this->DelMember('AddGroup',$mem);
+      }
+    }
+
+    if((isset($_POST['DelAdmin']))&&(isset($_POST['AdminMember']))){
+      foreach($_POST['AdminMember'] as $mem){
+        $this->DelMember('AddAdminUser',$mem);
+      }
+    }
+
+    if((isset($_POST['DelAdmin']))&&(isset($_POST['AdminMember']))){
+      foreach($_POST['AdminMember'] as $mem){
+        $this->DelMember('AddAdminGroup',$mem);
+      }
+    }
+
+    /* Abort user / group adding dialog */
+    if(isset($_POST['PrinterCancel'])){
+      unset($this->dialog);
+      $this->dialog= FALSE;
+    }
+
+    /* Save selected users / groups */
+    if(isset($_POST['PrinterSave'])){
+      $this->dialog->save_object();
+      if(count($this->dialog->check())){
+        foreach($this->dialog->check() as $msg){
+          print_red($msg);
+        }
+      }else{
+        $data= $new = $this->dialog->save();
+        unset($data['type']);
+        foreach($data as $mem){
+          $this->AddMember($new['type'], $mem['dn']);
+        }
+        unset($this->dialog);
+        $this->dialog=FALSE;
+      }
+    }
+
+    /* Display dialog, if there is currently one open*/
+    if(is_object($this->dialog)){
+      $this->dialog->save_object();
+      $display = $this->dialog->execute();
+      return $display;
+    }
+
+    /* Parse selected ppd file */
+    if((isset($_SESSION['config']->data['MAIN']['PPD_PATH']))&&(is_dir($_SESSION['config']->data['MAIN']['PPD_PATH']))){
+
+      $path = $_SESSION['config']->data['MAIN']['PPD_PATH'];
+      if(!preg_match("/\/$/",$path)){
+        $path = $path."/";
+      }
+
+      $ppdManager= new ppdManager($path);
+      if(!empty($this->gotoPrinterPPD)){
+        if((!file_exists($path.$this->gotoPrinterPPD))){
+          $smarty->assign("driverInfo", "<b>".sprintf(_("Your currently selected PPD file '%s' doesn't exist."),$path.$this->gotoPrinterPPD)."</b>");
+        }else{
+          $smarty->assign("driverInfo", $ppdManager->loadDescription($path.$this->gotoPrinterPPD));
+        }
+      }else{
+        $smarty->assign("driverInfo", _("Not defined"));
+      }
+    }else{
+      $smarty->assign("driverInfo",_("Can't get ppd informations."));
+    }
+
+    /* Create user & admin user list */
+    $list=$this->generateList();
+    $userlist   = array_merge($list['AddUser'],$list['AddGroup']);
+    $adminlist  = array_merge($list['AddAdminUser'],$list['AddAdminGroup']);
+
+    asort($userlist);
+    asort($adminlist);
+
+    if(!preg_match("/Printer/i",$this->BelongsTo)){
+      if(preg_match("/Terminal/i",$this->BelongsTo)){
+        $smarty->assign("desc"    ,sprintf(_("This printer belongs to terminal %s. You can't rename this printer."),"<b>".$this->cn."</b>"));
+      }else{
+        $smarty->assign("desc"    ,sprintf(_("This printer belongs to workstation %s. You can't rename this printer."),"<b>".$this->cn."</b>"));
+      }
+      $smarty->assign("cnACL"    , $this->getacl("cn",true));
+    }else{
+      $smarty->assign("desc"    ,"");
+    }
+    $smarty->assign("UserMember"    ,$this->UserMember);
+    $smarty->assign("UserMembers"   ,$userlist);
+    $smarty->assign("UserMemberKeys",array_flip($userlist));
+
+    $smarty->assign("AdminMember"    ,$this->AdminMember);
+    $smarty->assign("AdminMembers"   ,$adminlist);
+    $smarty->assign("AdminMemberKeys",array_flip($adminlist));
+    if(preg_match("/Printer/i",$this->BelongsTo)){
+
+      /* Show main page */
+      $str = $this->netConfigDNS->execute();
+      if(is_object($this->netConfigDNS->dialog)){
+        return($str);
+      }
+      $smarty->assign("netconfig", $str);
+    } else {
+      $smarty->assign("netconfig", "");
+    }
+
+    return($display.$smarty->fetch (get_template_path('printer.tpl', TRUE)));
+  }
+
+  function remove_from_parent()
+  {
+    /* Only remove if there was initially an account */
+    if($this->initially_was_account){
+
+      /* Update dn, to ensure storing as printer instead of WS / terminal
+       */
+      if(preg_match("/terminal/i",$this->BelongsTo)){
+        $this->dn= preg_replace("/ou=terminals,/","ou=printers,",$this->dn);
+      }
+
+      if(preg_match("/workstation/i",$this->BelongsTo)){
+        $this->dn= preg_replace("/ou=workstations,/","ou=printers,",$this->dn);
+      }
+
+      /* Check if this dn points to a printer, to avoid deleting something else */
+      $ldap= $this->config->get_ldap_link();
+      $ldap->cat($this->dn, array('dn',"objectClass"));
+      if(!$ldap->count()){
+        print_red("Trying to remove printer object which isn't a printer. Aborted to avoid data loss.");
+        return;
+      }
+
+      /* Check if obejct is a printer */
+      $CheckPrinter = $ldap->fetch();
+      if(!in_array("gotoPrinter",$CheckPrinter['objectClass'])){
+        print_red("Trying to remove printer object which isn't a printer. Aborted to avoid data loss.");
+        return;
+      }
+
+      /* Remove account & dns extension */ 
+      $this->netConfigDNS->remove_from_parent();
+      $ldap->rmdir($this->dn);
+
+      new log("remove","printer/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+  
+      show_ldap_error($ldap->get_error(), sprintf(_("Removing of system print/generic with dn '%s' failed."),$this->dn));
+      $this->handle_post_events("remove",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
+
+      /* Delete references to object groups */
+      $ldap->cd ($this->config->current['BASE']);
+      $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
+      while ($ldap->fetch()){
+        $og= new ogroup($this->config, $ldap->getDN());
+        unset($og->member[$this->dn]);
+        $og->save ();
+      }
+
+      /* Remove previously selected ppd file.*/
+      if(!empty($this->initial_PPD)){
+        $tmp = new printerPPDDialog($this->config, $this->dn,$this->initial_PPD);
+        $tmp->removeModifiedPPD();
+      }
+    }
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    /* Create a base backup and reset the
+       base directly after calling plugin::save_object();
+       Base will be set seperatly a few lines below */
+    $base_tmp = $this->base;
+    plugin::save_object();
+    $this->base = $base_tmp;
+
+    if(is_object($this->netConfigDNS)){
+      $this->netConfigDNS->save_object();
+    }
+    
+    /* Set new base if allowed */
+    $tmp = $this->get_allowed_bases();
+    if(isset($_POST['base'])){
+      if(isset($tmp[$_POST['base']])){
+        $this->base= $_POST['base'];
+      }
+    }
+  }
+
+  /* Check supplied data */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+    if (preg_match("/printer/i",$this->BelongsTo)){
+      $message= array_merge($message, $this->netConfigDNS->check());
+    }
+
+    /* Don't display check messages if this is a template object */
+    if(isset($this->parent->by_object['workgeneric'])){
+      if($this->parent->by_object['workgeneric']->cn == "wdefault"){
+        return $message;
+      }
+    }elseif(isset($this->parent->by_object['termgeneric'])){
+      if($this->parent->by_object['termgeneric']->cn == "default"){
+        return $message;
+      }
+    }
+
+    $dn= "cn=".$this->cn.",ou=printers,ou=systems,".$this->base;
+
+    /* must: cn */
+    if(($this->BelongsTo == "Printer") && (empty($this->cn))){
+      $message[]= _("The required field 'Printer name' is not set.");
+    }
+
+    /* must: cn */
+    if(($this->BelongsTo == "Printer") && !is_dns_name($this->cn)){
+      $message[]= _("Invalid character in printer name.");
+    }
+
+    /* must: labeledURI */
+    if(empty($this->labeledURI)){
+      $message[]= "The required field 'Printer URL' is not set.";
+    }
+    
+    /* Check if there is already an entry with this cn*/
+    if (($this->orig_dn != $dn)&&( preg_match("/printer/i",$this->BelongsTo))){
+      $ldap= $this->config->get_ldap_link();
+      $ldap->cd ($this->base);
+      $ldap->ls("(cn=".$this->cn.")","ou=printers,ou=systems,".$this->base, array("cn"));
+      if ($ldap->count() != 0){
+        while ($attrs= $ldap->fetch()){
+          if(preg_match("/cn=dhcp,/",$attrs['dn'])){
+            continue;
+          }
+          if ($attrs['dn'] != $this->orig_dn){
+            $message[]= sprintf (_("There is already an entry '%s' in the base choosen by you"), $this->cn);
+            break;
+          }
+        }
+      }
+    }
+
+    return ($message);
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    /* Update dn, to ensure storing as printer instead of WS / terminal
+     */
+    if(preg_match("/terminal/i",$this->BelongsTo)){
+      $this->dn= preg_replace("/ou=terminals,/","ou=printers,",$this->dn);
+    }
+
+    if(preg_match("/workstation/i",$this->BelongsTo)){
+      $this->dn= preg_replace("/ou=workstations,/","ou=printers,",$this->dn);
+    }
+    
+    if(!$this->is_account) return;
+    if(isset($this->parent->by_object['workgeneric'])){
+      if($this->parent->by_object['workgeneric']->cn == "wdefault"){
+        return;
+      }
+    }elseif(isset($this->parent->by_object['termgeneric'])){
+      if($this->parent->by_object['termgeneric']->cn == "default"){
+        return;
+      }
+    }
+
+    /* If type is still unknown, the initialisation of this printer failed, abort. */
+    if(preg_match("/unknown/i",$this->BelongsTo)){
+      return;
+    }
+
+    /* save ppd configuration */
+    if($this->PPDdialogToSave && is_object($this->PPDdialogToSave)){
+      $this->PPDdialogToSave->save_ppd();
+    }
+    if($this->orig_dn != $this->dn){
+      if(!empty($this->gotoPrinterPPD)) {
+        $this->PPDdialogToSave = new printerPPDDialog($this->config, $this->dn,$this->gotoPrinterPPD);
+        $this->PPDdialogToSave->cn = $this->cn;
+        $this->PPDdialogToSave->generateProperties();
+        $this->PPDdialogToSave->update_ppd_url();
+      }
+    }
+
+    /* Remove previously selected ppd file.*/
+    if($this->initial_PPD != $this->gotoPrinterPPD){
+      if(!empty($this->initial_PPD)){
+        $tmp = new printerPPDDialog($this->config, $this->dn,$this->initial_PPD);
+        $tmp->removeModifiedPPD();
+      }
+    }
+
+    if(preg_match("/https/i",$_SERVER['HTTP_REFERER'])){
+      $method="https://";
+    }else{
+      $method="http://";
+    }
+
+    /* If no ppd is selected, remove this attribute */
+    if(!empty($this->gotoPrinterPPD)) {
+      $this->gotoPrinterPPD = $method.str_replace("//","/",$_SERVER['SERVER_NAME']."/ppd/".$this->gotoPrinterPPD);
+    }else{
+      $this->gotoPrinterPPD = array();
+    }
+
+    $dn= $this->dn;
+    plugin::save();
+    $ldap= $this->config->get_ldap_link();
+
+    /* reduce objectClasses to minimun */
+    $this->attrs['objectClass']= $this->objectclasses;
+
+    /* Remove all empty values */
+    if ($this->orig_dn == 'new'){
+      $attrs= array();
+      foreach ($this->attrs as $key => $val){
+        if (is_array($val) && count($val) == 0){
+          continue;
+        }
+        $attrs[$key]= $val;
+      }
+      $this->attrs= $attrs;
+    }
+
+    /* Append printer user 
+     */
+    $this->attrs['gotoUserPrinter']=array();
+    foreach($this->member['AddUser'] as $mem){
+      $this->attrs['gotoUserPrinter'][]=$mem['uid'][0];
+    }
+
+    /* Append printer group 
+     */
+    $this->attrs['gotoGroupPrinter'] = array();
+    foreach($this->member['AddGroup'] as $mem){
+      $this->attrs['gotoGroupPrinter'][]=$mem['cn'][0];
+    }
+
+    /* Append printer admin user 
+     */
+    $this->attrs['gotoUserAdminPrinter'] = array();
+    foreach($this->member['AddAdminUser'] as $mem){
+      $this->attrs['gotoUserAdminPrinter'][]=$mem['uid'][0];
+    }
+
+    /* Append printer admin group 
+     */
+    $this->attrs['gotoGroupAdminPrinter']= array();
+    foreach($this->member['AddAdminGroup'] as $mem){
+      $this->attrs['gotoGroupAdminPrinter'][]=$mem['cn'][0];
+    }
+
+    if($this->orig_dn == 'new'){
+      foreach(array("gotoGroupPrinter","gotoUserAdminPrinter","gotoGroupAdminPrinter","gotoUserPrinter") as $checkVar){
+        if(count($this->attrs[$checkVar])  == 0 || empty($this->attrs[$checkVar])){
+          unset($this->attrs[$checkVar]);
+        }
+      }
+    }else{
+      if(($this->gosaUnitTag) && (!in_array_ics("gosaAdministrativeUnitTag",$this->attrs['objectClass']))){
+        $this->attrs['objectClass'][] = "gosaAdministrativeUnitTag";
+      }
+    }
+
+    /* Ensure to create a new object */
+    if(preg_match("/ou=incoming,/",$this->orig_dn)){
+      $this->orig_dn = "new";
+    }
+
+    /* Move object in necessary*/
+    if (($this->orig_dn != $this->dn) && ($this->orig_dn != 'new')){
+      $this->move($this->orig_dn, $this->dn);
+    }
+
+    /* Write back to ldap */
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cat($this->dn);
+    if(!$ldap->count()){
+      $ldap->cd($this->config->current['BASE']);
+      $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
+      $ldap->cd($this->dn);
+
+      /* Remove empty values */ 
+      foreach($this->attrs as $name => $value){
+        if(empty($value)){
+          unset($this->attrs[$name]);
+        }
+      }
+
+      $ldap->add($this->attrs);
+      $this->handle_post_events("add",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
+      new log("create","printer/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    } else {
+      $ldap->cd($this->dn);
+      $this->cleanup();
+      $ldap->modify ($this->attrs); 
+      $this->handle_post_events("modify",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
+      new log("modify","printer/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of system print/generic with dn '%s' failed."),$this->dn));
+
+    if(preg_match("/printer/i",$this->BelongsTo)){
+      $this->netConfigDNS->cn = $this->cn;
+      $this->netConfigDNS->dn = $this->dn;
+      $this->netConfigDNS->save();
+    }
+
+    /* This is a multi object. Handle tagging here... */
+    $this->handle_object_tagging();
+  }
+
+  function generateList(){
+    $a_return=array();
+
+    foreach($this->member as $type => $values){
+      $a_return[$type]=array();
+      foreach($values as $value){
+        if((preg_match("/Group/i",$type))){
+          if(!isset($value['description'])){
+            $a_return[$type][$value['cn'][0]]= _("Group")." : ".$value['cn'][0];
+          }else{
+            $a_return[$type][$value['cn'][0]]= _("Group")." : ".$value['cn'][0]." [".$value['description'][0]."]";
+          }
+        }else{
+          $a_return[$type][$value['uid'][0]]=_("User")." : ".$value['cn'][0];
+        }
+      }
+    }
+    return($a_return);
+  }
+
+  /* Return plugin informations for acl handling
+      #FIXME FAIscript seams to ununsed within this class... */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Generic"),
+          "plDescription" => _("Print generic"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 4,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("printer" => array("description"  => _("Printer"),
+                                                    "objectClass"  => "gotoPrinter"),"workstation","terminal"),
+          "plProvidedAcls"=> array(
+            "cn"                => _("Name"),
+            "base"                => _("Base") ,         
+            "description"       => _("Description"), 
+            "l"                 => _("Location"), 
+            "labeledURI"        => _("LabeledURL"), 
+            "gotoPrinterPPD"    => _("Printer PPD"),
+            "gotoUserPrinter"   => _("Permissions")) 
+          ));
+  }
+
+
+  /* Delete member */
+  function DelMember($type,$id)
+  {
+    /* Check if there was a printer "dn" given, or the "cn" */
+    foreach($this->member[$type] as $key => $printer){
+      if($printer['dn'] == $id) {
+        $id = $key;
+      }
+    }
+  
+    if(!$this->acl_is_writeable("gotoUserPrinter")){
+      print_red(sprintf(_("You are not allowed to remove the given object '%s' from the list of members of printer '%s'."),$id,$this->dn));
+      return(FALSE);
+    }
+    if(isset($this->member[$type][$id])){
+      unset($this->member[$type][$id]);
+      return(TRUE);
+    }
+    return(FALSE);
+  }
+
+
+  /* Add given obejct to members */
+  function AddMember($type,$dn)
+  {
+    $types = array("AddUser","AddGroup","AddAdminUser","AddAdminGroup");
+    if(!in_array_ics($type, $types)){
+      print_red(sprintf(_("Illegal printer type while adding '%s' to the list of '%s' printers,"),$dn,$type));
+      return(FALSE);
+    }
+
+    if(!$this->acl_is_writeable("gotoUserPrinter")){
+      print_red(sprintf(_("You are not allowed to add the given object '%s' to the list of members of '%s'."),$dn,$this->dn));
+      return(FALSE);
+    }
+
+    /* Get name of index attributes */
+    if(preg_match("/user/i",$type)){
+      $var = "uid";
+    }else{
+      $var = "cn";
+    }
+
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($dn);
+    $ldap->cat($dn,array($var,"cn"));
+    if($ldap->count()){
+
+      $attrs = $ldap->fetch();
+
+      if(isset($attrs[$var][0])){
+        $name = $attrs[$var][0];
+
+        /* Check if this uid/cn is already assigned to any permission */
+        foreach($types as $ctype){
+
+          /* If we want to add a user, only check user/userAdmin members */
+          if((preg_match("/user/i",$type)) && (!preg_match("/user/i",$ctype))){
+            continue;
+          }
+
+          /* If we want to add a group, only check groups/adminGroups .. */
+          if((preg_match("/group/i",$type)) && (!preg_match("/group/i",$ctype))){
+            continue;
+          }
+
+          if(isset(  $this->member[$ctype][$name])){
+            print_red(sprintf(_("Can't add '%s' to the list of members, it is already used."),$attrs[$var][0]));
+            return(FALSE);
+          }
+        }
+
+        /* Everything is fine. So add the given object to members */
+        $this->member[$type][$attrs[$var][0]] = $attrs ;
+      }else{
+        print_a($attrs);
+      }
+    }else{
+      print_red(sprintf(_("Can't add '%s' to list of members, it is not reachable."),$dn));
+      return(FALSE);
+    }
+    return(TRUE);
+  }
+
+
+   /* Display generic part for server copy & paste */
+  function getCopyDialog()
+  {
+    $vars = array("cn");
+    $smarty = get_smarty();
+    $smarty->assign("cn" ,$this->cn);
+    $smarty->assign("object","printer");
+    $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE));
+    $ret = array();
+    $ret['string'] = $str;
+    $ret['status'] = "";
+    return($ret);
+  }
+
+
+  function saveCopyDialog()
+  {
+    if(isset($_POST['cn'])){
+      $this->cn = $_POST['cn'];
+    }
+  }
+
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);
+    if(isset($source['macAddress'][0])){
+      $this->netConfigDNS->macAddress = $source['macAddress'][0];
+    }
+    if(isset($source['ipHostNumber'][0])){
+      $this->netConfigDNS->ipHostNumber = $source['ipHostNumber'][0];
+    }
+
+    $source_o = new printgeneric($this->config,$source['dn'],NULL,$this->parent);
+    foreach($this->attributes as $attr){
+      $this->$attr = $source_o->$attr;
+    }
+    $this->member = $source_o -> member;
+
+    $this->gotoPrinterPPD = "";
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/systems/class_selectUserToPrinterDialog.inc b/gosa-core/plugins/admin/systems/class_selectUserToPrinterDialog.inc
new file mode 100644 (file)
index 0000000..1f110e3
--- /dev/null
@@ -0,0 +1,198 @@
+<?php
+
+class selectUserToPrinterDialog 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 $regex                = "*";
+  var $subtree              = FALSE;
+  var $depselect            = "/";
+  var $deplist              = "/";
+
+  var $searchObjects        = "";
+  var $searchAttrs          = "";
+  var $searchAppend         = "";
+  var $baseAddition         = "";
+  var $type                 = "";
+  var $search_cat           = ""; 
+  function selectUserToPrinterDialog (&$config, $dn= NULL,$type=false )
+  {
+    plugin::plugin ($config, $dn);
+    $this->depselect = $this->config->current['BASE'];
+
+    switch($type){
+      case "AddUser" : 
+        $this->searchObjects = "(objectClass=gosaAccount)(!(uid=*$))";
+        $this->searchAttrs   = array("cn","uid");
+        $this->searchAppend  = "uid"; 
+        $this->baseAddition  = get_people_ou(); 
+        $this->search_cat    = "users";
+          ;break;
+      case "AddGroup" :
+        $this->searchObjects = "(objectClass=posixGroup)";
+        $this->searchAttrs   = array("cn","description");
+        $this->searchAppend  = "cn"; 
+        $this->baseAddition  = get_groups_ou(); 
+        $this->search_cat    = "groups";
+          ;break;
+      case "AddAdminUser" : 
+        $this->searchObjects = "(objectClass=gosaAccount)(!(uid=*$))";
+        $this->searchAttrs   = array("cn","uid");
+        $this->searchAppend  = "uid"; 
+        $this->baseAddition  = get_people_ou(); 
+        $this->search_cat    = "users";
+          ;break;
+      case "AddAdminGroup" :
+        $this->searchObjects = "(objectClass=posixGroup)";
+        $this->searchAttrs   = array("cn","description");
+        $this->searchAppend  = "cn"; 
+        $this->baseAddition  = get_groups_ou(); 
+        $this->search_cat    = "groups";
+          ;break;
+    }
+    $this->type = $type;
+
+  }
+
+  function execute()
+  {
+       /* Call parent execute */
+       plugin::execute();
+
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+    $display= "";
+
+    if(isset($_POST['dialogissubmitted'])){
+      $this->regex=$_POST['regexPrinter'];
+      $this->depselect = $_POST['depselectPrinter'];
+    }
+    $this->subtree= isset($_POST['SubSearch']);
+
+    if((isset($_GET['search']))&&(!empty($_GET['search']))){
+      $this->regex=$_GET['search']."*";
+      $this->regex=preg_replace("/\*\*/","*",$this->regex);
+    }
+
+
+    /* Get all departments within this subtree */
+    $base = $this->config->current['BASE'];
+    $deps_res[] = array("dn"=>$this->config->current['BASE']);
+    $deps_res= array_merge($deps_res,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", array("users","groups"), $this->config->current['BASE'],
+                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
+
+    /* Load possible departments */
+    $ui     = get_userinfo();
+  
+    /* Allowed user departments */
+    $udeps  = $ui->get_module_departments("users");
+
+    /* Allowed groups department */
+    $gdeps  = $ui->get_module_departments("groups");
+
+    /* Combine both arrays */
+    $tdeps  = array_unique(array_merge($udeps,$gdeps));
+
+    /* Create usable departments array */
+    $ids = $this->config->idepartments;
+    $deps = array();
+    foreach($deps_res as $dep){
+      if(isset($ids[$dep['dn']]) && in_array_ics($dep['dn'], $tdeps)){
+        $value = $ids[$dep['dn']];
+        $deps[$dep['dn']] = $value;
+      }
+    }
+    if(!isset($deps[$this->depselect])){
+      $this->depselect = key($deps);
+    }
+
+
+
+    $tmp_printers= $this->getPrinter();
+    natcasesort($tmp_printers);
+    $smarty->assign("regexPrinter"        , $this->regex);
+    $smarty->assign("deplistPrinter"      , $deps);;//deplist);
+    $smarty->assign("depselectPrinter"    , $this->depselect);
+    $smarty->assign("gotoPrinters"        , $tmp_printers);
+    $smarty->assign("gotoPrinterKeys"     , array_flip($tmp_printers));
+    $smarty->assign("apply"               , apply_filter());
+    $smarty->assign("alphabet"            , generate_alphabet());
+    $smarty->assign("search_image"        , get_template_path('images/search.png'));
+    $smarty->assign("tree_image"          , get_template_path('images/tree.png'));
+    $smarty->assign("infoimage"           , get_template_path('images/info.png'));
+    $smarty->assign("launchimage"         , get_template_path('images/small_filter.png'));
+    $smarty->assign("deplist"             , $deps);
+    $smarty->assign("subtree", $this->subtree?"checked":"");
+
+    $display.= $smarty->fetch(get_template_path('selectUserToPrinterDialog.tpl', TRUE,dirname(__FILE__)));
+    return($display);
+  }
+
+  function check(){
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    if(empty($_POST['gotoPrinter'])){
+      $message[] = _("Please select a printer or press cancel.");
+    }
+    return $message;
+  }
+
+  /* Save to LDAP */
+  function save()
+  {
+    $a_return['type']=$this->type;
+    
+    foreach($_POST['gotoPrinter'] as $name){
+      $data = $this->getPrinter(true);
+      $a_return[$name]= $data[$name];
+    }
+    return($a_return);
+  }
+
+  /* This function generates the Printerlist
+   * All printers are returned that match regex and and depselect
+   */
+  function getPrinter($detailed = false)
+  {
+    $a_return=array();
+
+    $filter = "(&".$this->searchObjects."(cn=".$this->regex."))";
+    $base   = $this->baseAddition.$this->depselect;
+    $attrs  = $this->searchAttrs;
+    $cat    = $this->search_cat;
+
+    if ($this->subtree){
+      $res= get_list($filter,$cat,$this->depselect,$attrs, GL_SUBSEARCH);
+    } else {
+      $res= get_list($filter,$cat,$base,$attrs);
+    }
+    foreach($res as $printer){
+      if(($detailed ==true)){
+        if(isset($printer[$this->searchAppend])){
+          $a_return[$printer[$this->searchAppend][0]] = $printer;
+        }
+      }else{
+        if(isset($printer[$this->searchAppend])){
+          if(isset($printer['description'][0])){
+            $a_return[$printer[$this->searchAppend][0]] = $printer['cn'][0]." - ".$printer['description'][0]; 
+          }else{
+            $a_return[$printer[$this->searchAppend][0]] = $printer['cn'][0];
+          }
+        }
+      }
+    }
+    return($a_return);
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/systems/class_servGeneric.inc b/gosa-core/plugins/admin/systems/class_servGeneric.inc
new file mode 100644 (file)
index 0000000..9d29f5e
--- /dev/null
@@ -0,0 +1,444 @@
+<?php
+
+class servgeneric extends plugin
+{
+  /* 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");
+
+  /* Generic terminal attributes */
+  var $ignore_account= TRUE;
+  var $interfaces= array();
+
+  /* Needed values and lists */
+  var $base= "";
+  var $cn= "";
+  var $l= "";
+  var $description= "";
+  var $orig_dn= "";
+  var $didAction= FALSE;
+
+  /* attribute list for save action */
+  var $attributes= array("cn", "description","gotoMode");
+  var $objectclasses= array("top", "GOhard", "goServer");
+
+  var $gotoMode= "locked";
+
+  var $netConfigDNS;
+  var $modes = array();
+  var $ui   ;
+  var $mapActions   = array("reboot"          => "",
+                            "instant_update"  => "softupdate",
+                            "localboot"       => "localboot",
+                            "update"          => "sceduledupdate",
+                            "reinstall"       => "install",
+                            "rescan"          => "",
+                            "memcheck"        => "memcheck",
+                            "sysinfo"         => "sysinfo");
+
+  var $fai_activated  =FALSE;
+  var $view_logged = FALSE;
+
+  function servgeneric (&$config, $dn= NULL, $parent= NULL)
+  {
+    /* Check if FAI is activated */
+    $tmp = $config->search("faiManagement", "CLASS",array('menu','tabs'));
+    
+    if(!empty($tmp)){
+      $this->fai_activated = TRUE;
+    }
+
+    plugin::plugin ($config, $dn, $parent);
+
+    $this->ui = get_userinfo();
+    $this->modes["active"]= _("Activated");
+    $this->modes["locked"]= _("Locked");
+
+    /* Set base */
+    if ($this->dn == "new"){
+      $ui= get_userinfo();
+      $this->base= dn2base($ui->dn);
+      $this->cn= "";
+    } else {
+      $this->base= preg_replace ("/^[^,]+,[^,]+,[^,]+,/", "", $this->dn);
+    }
+    $this->netConfigDNS = new termDNS($this->config,$this,$this->objectclasses);
+    $this->netConfigDNS->set_acl_category("server");
+    $this->netConfigDNS->set_acl_base($this->base);
+       
+    /* Save dn for later references */
+    $this->orig_dn= $this->dn;
+  }
+
+
+  function set_acl_base($base)
+  {
+    plugin::set_acl_base($base);
+    $this->netConfigDNS->set_acl_base($base);
+  }
+
+
+  function set_acl_category($cat)
+  {
+    plugin::set_acl_category($cat);
+    $this->netConfigDNS->set_acl_category($cat);
+  }
+
+
+  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);
+    }
+
+    /* Do we represent a valid server? */
+    if (!$this->is_account && $this->parent === NULL){
+      $display= "<img alt=\"\" src=\"images/stop.png\" align=middle>&nbsp;<b>".
+        _("This 'dn' has no server features.")."</b>";
+      return($display);
+    }
+
+    /* Check for action */
+    if (isset($_POST['action']) && $this->acl_is_writeable("FAIstate")){
+      $cmd = $this->config->search("workgeneric", "ACTIONCMD",array('tabs'));
+      if ($cmd == ""){
+        print_red(_("No ACTIONCMD definition found in your gosa.conf"));
+      } else {
+
+        exec ($cmd." ".$this->netConfigDNS->macAddress." ".escapeshellarg($_POST['saction']), $dummy, $retval);
+        if ($retval != 0){
+          print_red(sprintf(_("Execution of '%s' failed!"), $cmd));
+        } else {
+          $this->didAction= TRUE;
+
+          /* Set FAIstate */
+          if($this->fai_activated && $this->dn != "new"){
+            $ldap = $this->config->get_ldap_link();
+            $ldap->cd($this->config->current['BASE']);
+            $ldap->cat($this->dn,array("objectClass"));
+            $res = $ldap->fetch();
+
+            $attrs = array();
+            $attrs['FAIstate'] = "";
+            if(isset($this->mapActions[$_POST['saction']])){
+              $attrs['FAIstate'] = $this->mapActions[$_POST ['saction']];
+            }
+
+            for($i = 0; $i < $res['objectClass']['count'] ; $i ++){
+              $attrs['objectClass'][] = $res['objectClass'][$i];
+            }
+
+            if(($attrs['FAIstate'] != "") && (!in_array("FAIobject",$attrs['objectClass']))){
+              $attrs['objectClass'][] = "FAIobject";
+            }
+
+            if($attrs['FAIstate'] == ""){
+#FIXME we should check if FAIobject is used anymore
+              $attrs['FAIstate'] = array();
+            }
+
+            $ldap->cd($this->dn);
+            $ldap->modify($attrs);
+          }
+          show_ldap_error($ldap->get_error(), sprintf(_("Saving of system server/generic (FAIstate) with dn '%s' failed."),$this->dn)); 
+        }
+      }
+    }
+
+    /* Base select dialog */
+    $once = true;
+    foreach($_POST as $name => $value){
+      if(preg_match("/^chooseBase/",$name) && $once ){
+        $once = false;
+        $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
+        $this->dialog->setCurrentBase($this->base);
+      }
+    }
+
+    /* Dialog handling */
+    if(is_object($this->dialog)){
+      /* Must be called before save_object */
+      $this->dialog->save_object();
+
+      if($this->dialog->isClosed()){
+        $this->dialog = false;
+      }elseif($this->dialog->isSelected()){
+  
+        /* Only accept allowed bases */
+        $tmp = $this->get_allowed_bases();
+        if($tmp[$this->dialog->isSelected()]){
+          $this->base = $this->dialog->isSelected();
+        }
+        $this->dialog= false;
+      }else{
+        return($this->dialog->execute());
+      }
+    }
+
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translated){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+    /* Assign base ACL */
+    $smarty->assign("bases"   , $this->get_allowed_bases());
+
+    /* Assign attributes */
+    foreach ($this->attributes as $attr){
+      $smarty->assign("$attr", $this->$attr);
+    }
+
+    $smarty->assign("staticAddress", "");
+    $smarty->assign("base_select", $this->base);
+
+    /* Assign status */
+    $query= "fping -q -r 1 -t 500 ".$this->cn;
+    exec ($query, $dummy, $retval);
+
+    /* Offline */
+    if ($retval == 0){
+      $smarty->assign("actions", array("halt" => _("Switch off"), "reboot" => _("Reboot"),
+                                       "instant_update" => _("Instant update"),
+                                       "update" => _("Scheduled update"),
+                                       "reinstall" => _("Reinstall"),
+                                       "rescan" => _("Rescan hardware"),
+                                       "memcheck" => _("Memory test"),
+                                       "localboot" => _("Force localboot"),
+                                       "sysinfo"  => _("System analysis")));
+    } else {
+      $smarty->assign("actions", array("wake" => _("Wake up"),
+                                       "reinstall" => _("Reinstall"),
+                                       "update" => _("Scheduled update"),
+                                       "memcheck" => _("Memory test"),
+                                       "localboot" => _("Force localboot"),
+                                       "sysinfo"  => _("System analysis")));
+    }
+
+    /* Show main page */
+    $smarty->assign("fai_activated",$this->fai_activated);
+
+    $str = $this->netConfigDNS->execute();
+    if(is_object($this->netConfigDNS->dialog)){
+      return($str);
+    }
+    $smarty->assign("netconfig", $str);
+    $smarty->assign("modes", $this->modes);
+
+    return($smarty->fetch (get_template_path('server.tpl', TRUE)));
+  }
+
+  function remove_from_parent()
+  {
+    /* Cancel if there's nothing to do here */
+    if ((!$this->initially_was_account) || (!$this->acl_is_removeable())){
+      return;
+    }
+
+    $this->netConfigDNS->remove_from_parent();
+    $ldap= $this->config->get_ldap_link();
+    $ldap->rmdir($this->dn);
+
+    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 system server/generic with dn '%s' failed."),$this->dn)); 
+
+    /* Delete references to object groups */
+    $ldap->cd ($this->config->current['BASE']);
+    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
+    while ($ldap->fetch()){
+      $og= new ogroup($this->config, $ldap->getDN());
+      unset($og->member[$this->dn]);
+      $og->save ();
+    }
+    $this->handle_post_events("remove",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    /* Save current base, to be able to revert to last base, 
+        if new base is invalid or not allowed to be selected */
+    $base_tmp = $this->base;
+    plugin::save_object();
+    $this->netConfigDNS->save_object();
+
+    /* Get base selection */
+    $tmp = $this->get_allowed_bases();
+    if(isset($_POST['base'])){
+      if($tmp[$_POST['base']]){
+        $this->base = $_POST['base'];
+      }else{
+        $this->base = $base_tmp;
+      }
+    }
+  }
+
+
+  /* Check supplied data */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+    $message= array_merge($message, $this->netConfigDNS->check());
+    $this->dn= "cn=".$this->cn.",ou=servers,ou=systems,".$this->base;
+
+    /* must: cn */
+    if ($this->cn == ""){
+      $message[]= _("The required field 'Server name' is not set.");
+    }
+    
+    /* Check if given name is a valid host/dns name */
+    if(!is_dns_name($this->cn)){
+      $message[] = _("Please specify a valid name for this object.");
+    }
+
+    if ($this->orig_dn != $this->dn){
+      $ldap= $this->config->get_ldap_link();
+      $ldap->cd ($this->base);
+      $ldap->search ("(cn=".$this->cn.")", array("cn"));
+      if ($ldap->count() != 0){
+        while ($attrs= $ldap->fetch()){
+          if ($attrs['dn'] != $this->orig_dn){
+            if(!preg_match("/cn=dhcp,/",$attrs['dn']) && !preg_match("/,ou=incoming,/",$attrs['dn']) && preg_match("/,ou=servers,ou=systems,/",$attrs['dn'])){
+              $message[]= sprintf (_("There is already an entry '%s' in the base choosen by you"), $this->cn);
+              break;
+            }
+          }
+        }
+      }
+    }
+
+    return ($message);
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    plugin::save();
+
+    /* Remove all empty values */
+    if ($this->orig_dn == 'new'){
+      $attrs= array();
+      foreach ($this->attrs as $key => $val){
+        if (is_array($val) && count($val) == 0){
+          continue;
+        }
+        $attrs[$key]= $val;
+      }
+      $this->attrs= $attrs;
+    }
+
+    /* Write back to ldap */
+    $ldap= $this->config->get_ldap_link();
+    if ($this->orig_dn == 'new'){
+      $ldap->cd($this->config->current['BASE']);
+      $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
+      $ldap->cd($this->dn);
+      $ldap->add($this->attrs);
+      new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+      $mode= "add";
+    } else {
+   
+      /* cn is not case sensitive for ldap, but for php it is!! */ 
+      if($this->config->current['DNMODE'] == "cn"){
+        if (strtolower($this->orig_dn) != (strtolower($this->dn))){
+          $this->recursive_move($this->orig_dn, $this->dn);
+          plugin::save();
+        }
+      }else{
+        if ($this->orig_dn != $this->dn){
+          $this->recursive_move($this->orig_dn, $this->dn);
+          plugin::save();
+        }
+      }
+  
+      $ldap->cd($this->dn);
+      $this->cleanup();
+      $ldap->modify ($this->attrs); 
+      new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+
+      $mode= "modify";
+    }
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of system server/generic with dn '%s' failed."),$this->dn)); 
+    $this->netConfigDNS->cn = $this->cn;
+    $this->netConfigDNS->save();
+
+    /* Optionally execute a command after we're done */
+    if(!$this->didAction){
+      $this->handle_post_events($mode,array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
+    }
+  }
+
+
+  /* Display generic part for server copy & paste */
+  function getCopyDialog()
+  {
+    $vars = array("cn");
+
+    $smarty = get_smarty();
+    $smarty->assign("cn" ,$this->cn);
+    $smarty->assign("object","server");
+    $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE));
+    $ret = array();
+    $ret['string'] = $str;
+    $ret['status'] = "";
+    return($ret);
+  }
+
+
+  function saveCopyDialog()
+  {
+    if(isset($_POST['cn'])){
+      $this->cn = $_POST['cn'];
+    }
+  }
+
+  
+  function PrepareForCopyPaste($source)  
+  {
+    plugin::PrepareForCopyPaste($source);
+    if(isset($source['macAddress'][0])){
+      $this->netConfigDNS->macAddress = $source['macAddress'][0];
+    }
+    if(isset($source['ipHostNumber'][0])){
+      $this->netConfigDNS->ipHostNumber = $source['ipHostNumber'][0];
+    }
+
+  }
+  
+
+
+  /* Return plugin informations for acl handling */ 
+  static function plInfo()
+  {
+    return (array( 
+          "plShortName"   => _("Generic"),
+          "plDescription" => _("Server generic"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 1,
+          "plSection"     => array("administration"),           
+          "plCategory"    => array("server" => array("description"  => _("Server"),
+                                                     "objectClass"  => "goServer")),
+          "plProvidedAcls"=> array(
+            "cn"           => _("Name"),
+            "description"  => _("Description"),
+            "gotoMode"     => _("Goto mode"),
+            "base"         => _("Base"),
+            "FAIstate"     => _("Action flag"))
+          ));
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/systems/class_serverService.inc b/gosa-core/plugins/admin/systems/class_serverService.inc
new file mode 100644 (file)
index 0000000..338052b
--- /dev/null
@@ -0,0 +1,442 @@
+<?php
+
+define("START_SERVICE",1);
+define("STOP_SERVICE",2);
+define("RESTART_SERVICE",3);
+
+define("SERVICE_STOPPED",_("Stop"));
+define("SERVICE_STARTED",_("Start"));
+define("SERVICE_RESTARTED",_("Restart"));
+
+define("ALL_SERVICES",100);
+
+class ServerService extends plugin
+{
+  /* CLI vars */
+  var $cli_summary      = "Manage server services";
+  var $cli_description  = "Managing services by adding,removing and configuring services. Allows to start/stop used services.";
+  var $cli_parameters   = array("config"=>"Config object" , "dn"=>"Object dn");
+
+  /* attribute list for save action */
+  var $ignore_account   = TRUE;
+  var $attributes       = array();
+  var $objectclasses    = array();
+
+  var $divList          = NULL;
+
+  var $plugins          = array();
+  var $pluign_names     = array();
+
+  var $current          = "";
+  var $backup           = NULL;
+  var $acl              ;
+  var $cn;
+
+  function ServerService (&$config, $dn)
+  {
+    plugin::plugin($config);
+    $this->dn= $dn;
+    foreach ($config->data['TABS']['SERVERSERVICE'] as $plug){
+      $name= $plug['CLASS'];
+      $this->plugin_names[]= $name;
+      $this->plugins[$name]= new $name($config, $dn);
+      /* Capture all service objectClases, necessary for acl handling */ 
+      if(isset($this->plugins[$name]->objectclasses)){
+        foreach($this->plugins[$name]->objectclasses as $oc){
+          $this->objectclasses[] = $oc;
+        }
+      }
+    }
+    $this->divList = new divListSystemService($config,$this);
+       }
+
+  function set_acl_base($base)
+  {
+    plugin::set_acl_base($base);
+    foreach($this->plugins as $name => $obj){
+      $this->plugins[$name]->set_acl_base($base);
+    }
+  }
+
+  function set_acl_category($category)
+  {
+    plugin::set_acl_category($category);
+    foreach($this->plugins as $name => $obj){
+      $this->plugins[$name]->set_acl_category($category);
+    }
+  }
+
+  function execute()
+  {
+    /* Variable initialisation */  
+    $s_action = "";
+    $s_entry  = "";
+
+    /* Walk through posts and check if there are some introductions for us */
+    $PossiblePosts = array("addNewService"  => "", 
+                           "startServices"  => "",
+                           "stopServices"   => "",
+                           "restartServices"  => "",
+                           "removeServices" => "",
+
+                           "StartSingleService"  => "/^StartSingleService_(.*)_[xy]$/",
+                           "StopSingleService"   => "/^StopSingleService_(.*)_[xy]$/",
+                           "RestartSingleService"  => "/^RestartSingleService_(.*)_[xy]$/",
+                           "RemoveSingleService" => "/^RemoveSingleService_(.*)_[xy]$/",
+                           "EditSingleService"   => "/^EditSingleService_(.*)_[xy]$/");
+
+  
+    $once = true;
+    foreach($_POST as $name => $value){
+      foreach($PossiblePosts as $pregCheck => $idPreg) {
+        if(preg_match("/^".$pregCheck."/",$name) && $once){
+          $once     = false;
+          $s_action = $pregCheck;
+          
+          if(!empty($idPreg)){
+            $s_entry = preg_replace($idPreg,"\\1",$name);
+          }
+        }
+      }
+    }
+
+
+    /* Handle state changes for services */
+    $map =  array(    "startServices"         => array("type" => START_SERVICE ,   "service" => ALL_SERVICES),
+                      "stopServices"          => array("type" => STOP_SERVICE  ,   "service" => ALL_SERVICES),
+                      "restartServices"       => array("type" => RESTART_SERVICE , "service" => ALL_SERVICES),                 
+                      "StartSingleService"    => array("type" => START_SERVICE ,   "service" => $s_entry),
+                      "StopSingleService"     => array("type" => STOP_SERVICE ,    "service" => $s_entry),
+                      "RestartSingleService"  => array("type" => RESTART_SERVICE , "service" => $s_entry));
+    if(isset($map[$s_action])){
+      $type     = $map[$s_action]['type'];
+      $service  = $map[$s_action]['service'];
+      $this->ServiceStatusUpdate($type,$service);
+    }
+
+    /* Handle actions linked via href */
+    if(isset($_GET['act']) && $_GET['act'] == "open" && isset($_GET['id'])){
+      $id = $_GET['id'];
+      if(isset($this->plugins[$id])){
+        $s_entry = $id;
+        $s_action = "EditSingleService";
+      } 
+    }
+
+    /* Open service add dialog */
+    if($s_action == "addNewService"){
+      $this->dialog = new ServiceAddDialog($this->config,$this->dn,$this);
+    }
+
+
+    /* Remove service */
+    if($s_action == "RemoveSingleService"){
+
+      /* Create resetted obj */
+      $new_obj = new $s_entry($this->config,$this->dn);
+      $new_obj -> set_acl_base($this->acl_base);
+      $new_obj -> set_acl_category(preg_replace("/\/$/","",$this->acl_category));
+      $tmp     = $new_obj->getListEntry();
+
+      if($tmp['AllowRemove']){
+
+        /* Check if we are allowed to remove this service
+         */
+        $str = $this->plugins[$s_entry]->allow_remove();
+
+        if(empty($str)){
+          $this->plugins[$s_entry] = $new_obj;
+          $this->plugins[$s_entry]->is_account = false;
+        }else{
+          print_red($str);
+        }
+      }
+    }
+
+
+    /* Edit a service and make a backup from all attributes, 
+       to be able to restore old values after aborting dialog */ 
+    if($s_action == "EditSingleService"){
+      $this->backup   = get_object_vars($this->plugins[$s_entry]);
+      $this->dialog   = $this->plugins[$s_entry];
+      $this->current  = $s_entry;
+    }
+
+   
+    /* Abort service add */
+    if(isset($_POST['CancelServiceAdd'])){
+      $this->dialog   = FALSE;
+      $this->backup   = NULL;
+      $this->current  = "";
+    }
+
+    /* Abort dialog 
+       Restore vars with values before editing */
+    if(isset($_POST['CancelService']) && !empty($this->current)){
+      if($this->backup == NULL){
+        $this->plugins[$this->current] = new $this->current($this->config,$this->dn);
+        $this->plugins[$this->current]-> set_acl_base($this->acl_base);
+        $this->plugins[$this->current]-> set_acl_category(preg_replace("/\/$/","",$this->acl_category));
+
+      }else{
+        foreach($this->backup as $name => $value){
+          $this->plugins[$this->current]->$name = $value;
+        }
+      }
+      $this->dialog   = FALSE;
+      $this->backup   = NULL;
+      $this->current  = ""; 
+    }
+  
+
+    /* Abort dialog */
+    if(isset($_POST['SaveService']) && is_object($this->dialog)){
+      $this->dialog->save_object();
+      $msgs = $this->dialog->check();
+      if(count($msgs)){
+        foreach($msgs as $msg){
+          print_red($msg);
+        }
+      }else{
+        $this->plugins[$this->current] = $this->dialog;
+        $tmp  = get_object_vars($this->dialog);
+        foreach($tmp as $name => $value){
+          $this->plugins[$this->current]->$name = $value;
+        }
+        $this->current = "";
+        $this->dialog = FALSE;
+        $this->backup = NULL;
+      }
+    }
+
+
+    /* Abort dialog */
+    if((isset($_POST['SaveServiceAdd'])) && (!empty($_POST['ServiceName']))){
+      $serv = $_POST['ServiceName'];    
+      $this->plugins[$serv]->is_account = true;
+      $this->dialog  = $this->plugins[$serv];
+      $this->current = $serv;
+    }
+
+
+    /* There is currently a subdialog open, display this dialog */
+    if(is_object($this->dialog)){
+      $this->dialog->save_object();
+      return($this->dialog->execute());
+    }
+
+
+    /* Dispaly services overview */
+    $this->divList->execute();
+    $list = array();
+
+    foreach($this->plugins as $name => $obj){
+      if($obj->is_account){
+        $list[$name] = $this->plugins[$name]->getListEntry(); 
+      }
+    }
+    $this->divList -> setEntries($list);
+    return("<table style='width:100%;'><tr><td>".$this->divList->Draw()."</td></tr></table>");
+  }
+
+
+  /* Get all used services 
+      CLASSNAME => _($this->plugins[*]->DisplayName);   */
+  function getAllUsedServices()
+  {
+    $ret = array();
+    foreach($this->plugins as $name => $obj){
+      if($obj->is_account){
+        if(isset($obj->DisplayName)){
+          $ret[$name] = $obj->DisplayName;
+        }else{
+          $ret[$name] = $name;
+        }
+      }
+    }
+    return($ret);
+  }
+
+
+  /* Get all unused services 
+      CLASSNAME => _($this->plugins[*]->DisplayName);  */
+  function getAllUnusedServices()
+  {
+    $tmp = $this->getAllUsedServices();
+    $pool_of_ocs =array();
+    foreach($tmp as $name => $value){
+      if(isset($this->plugins[$name]->conflicts)){
+        $pool_of_ocs[]= get_class($this->plugins[$name]);
+      }
+    }
+   
+    $ret = array();
+    foreach($this->plugins as $name => $obj){
+
+      /* Skip all pluigns that will lead into conflicts */
+      $skip = false;
+      if(isset($obj->conflicts)){
+        foreach($obj->conflicts as $oc){
+          if(in_array_ics($oc,$pool_of_ocs)){
+            $skip = true;
+          }
+        }
+      }
+
+      /* Only show createable services */
+      if(!$obj->acl_is_createable()){
+        $skip = true;
+      }
+
+      if(!$skip){
+        if(isset($obj->DisplayName)){
+          $ret[$name] = $obj->DisplayName;
+        }else{
+          $ret[$name] = $name;
+        }
+      }
+    }
+    return($ret);
+  }
+  /* This function sets the status var for each used 
+     service && calls an external hook if specified in gosa.conf*/
+  function ServiceStatusUpdate($method , $service)
+  {
+    /* Skip if this is a new server */
+    if($this->dn == "new"){
+      print_red(_("Can't set status while this server is not saved."));
+      return;
+    }
+
+    $action = "";
+    if($method == START_SERVICE){
+      $action = SERVICE_STARTED;
+    }elseif($method== STOP_SERVICE){
+      $action = SERVICE_STOPPED;
+    }elseif($method == RESTART_SERVICE){
+      $action = SERVICE_RESTARTED;
+    }else{
+      print_red(sprintf(_("The specified method '%s' can't executed for services."),$action));
+      return;
+    }
+    
+    $caseVars = array("cn","dn");
+    if($service == ALL_SERVICES){
+      foreach($this->plugins as $name => $obj){
+        foreach($caseVars as $var){
+          if(isset($this->$var)){
+            $this->plugins[$name]->$var = $this->$var;  
+          }
+        }
+
+        /* check if services can be restarted */
+        $map =array(SERVICE_STARTED=> "AllowStart" ,
+                    SERVICE_STOPPED => "AllowStop",
+                    SERVICE_RESTARTED => "AllowRestart");
+
+        /* get plugins informations, restart/start/stop actions allowed ?*/
+        $tmp = $this->plugins[$name]->getListEntry();
+
+        /* Check if given action is allowed for this service */
+        if($tmp[$map[$action]]){
+          if($this->plugins[$name]->initially_was_account && $this->plugins[$name]->is_account){
+            $this->plugins[$name]->setStatus($action);
+          }
+        }
+      }
+    }else{
+      foreach($caseVars as $var){
+        if(isset($this->$var)){
+          $this->plugins[$service]->$var = $this->$var;  
+        }
+      }
+      if($this->plugins[$service]->is_account){
+        $this->plugins[$service]->setStatus($action);
+      }
+    }
+  }
+
+
+  function check()
+  {
+    $message = plugin::check();
+    return $message;
+  }
+
+
+  function save_object()
+  {
+    foreach($this->plugins as $name => $obj){
+      if($obj->is_account){
+        $this->plugins[$name]->save_object();
+      }
+    }
+  }
+
+
+  function remove_from_parent()
+  {
+    $caseVars = array("cn","dn");
+    foreach($this->plugins as $name => $obj){
+      foreach($caseVars as $var){
+        if(isset($this->$var)){
+          $this->plugins[$name]->$var = $this->$var;  
+        }
+      }
+      if($this->plugins[$name]->initially_was_account){
+        $this->plugins[$name]->remove_from_parent();
+      }
+    }
+  }
+
+
+  function save()
+  {
+    $caseVars = array("cn","dn");
+    foreach($this->plugins as $name => $obj){
+
+      foreach($caseVars as $var){
+        if(isset($this->$var)){
+          $this->plugins[$name]->$var = $this->$var;
+        }
+      }
+
+      if($this->plugins[$name]->is_account){
+        $this->plugins[$name]->save();
+      }else{
+        if($this->plugins[$name]->initially_was_account){
+          $this->plugins[$name]->remove_from_parent();
+        }
+      }
+    }
+  }
+
+  
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);
+
+    foreach($this->plugins as $name => $plugin){
+      $this->plugins[$name]->PrepareForCopyPaste($source);
+    }
+  }
+
+
+  /* Check if all plugins allow a remove ..  */
+  function allow_remove()
+  {
+    foreach($this->plugins as $name => $obj){
+      $str = $obj->allow_remove();
+      if(!empty($str)){
+        return($str);
+      }
+    }
+  }
+  
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/systems/class_systemManagement.inc b/gosa-core/plugins/admin/systems/class_systemManagement.inc
new file mode 100644 (file)
index 0000000..60a577e
--- /dev/null
@@ -0,0 +1,1398 @@
+<?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 systems extends plugin
+{
+  /* Definitions */
+  var $plHeadline     = "Systems";
+  var $plDescription  = "This does something";
+  var $departments    = array();
+
+  /* Dialog attributes */
+  var $systab   = NULL;
+  var $terminals= array();
+  var $ui       = NULL;
+  var $DivListSystem;
+  var $start_pasting_copied_objects = FALSE;
+  var $CopyPasteHandler   = NULL;
+
+  /* Arp hanlding activated */
+  var $arp_handling_active = FALSE;
+
+  function systems (&$config, $ui)
+  {
+    /* Save configuration for internal use */
+    $this->config= $config;
+    $this->ui= $ui;
+
+    /* Creat dialog object */
+    $this->DivListSystem = new divListSystem($this->config,$this);
+
+    /* Copy & Paste enabled ?*/
+    if((isset($this->config->data['MAIN']['ENABLECOPYPASTE']))&&(preg_match("/true/i",$this->config->data['MAIN']['ENABLECOPYPASTE']))){
+      $this->CopyPasteHandler = new CopyPasteHandler($this->config);
+    }
+
+    /* Check whether the arp handling active or not */
+    if($this->config->search("ArpNewDevice","CLASS",array('tabs')) != ""){
+      $this->arp_handling_active = TRUE;
+    }
+
+  }
+
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    $_SESSION['LOCK_VARS_TO_USE'] = array("/^system_edit_/i","/^system_del_/","/^act/","/^id/","/^item_selected/","/^remove_multiple_systems/");
+
+    /********************
+      Check for functional posts, edit|delete|add|... system devices 
+     ********************/
+    $s_action     = "";                       // Contains the action to proceed
+    $s_entry      = "";                       // The value for s_action
+    $base_back    = "";                       // The Link for Backbutton
+    $smarty       = get_smarty();
+
+    /* Test Posts */
+    foreach($_POST as $key => $val){
+      // Post for delete
+      if(preg_match("/system_del.*/",$key)){
+        $s_action = "del";
+        $s_entry  = preg_replace("/system_del_/i","",$key);
+        // Post for edit
+      }elseif(preg_match("/system_edit_.*/",$key)){
+        $s_action="edit";
+        $s_entry  = preg_replace("/system_edit_/i","",$key);
+        // Post for new
+      }elseif(preg_match("/system_new.*/",$key)){
+        $s_action="new";
+      }elseif(preg_match("/system_tplnew.*/i",$key)){
+        $s_action="new_tpl";
+      }elseif(preg_match("/system_setpwd_.*/i",$key)){
+        $s_action="change_pw";
+        $s_entry  = preg_replace("/system_setpwd_/i","",$key);
+      }elseif(preg_match("/gen_cd_.*/i",$key)){
+        $s_action="gen_cd";
+        $s_entry  = preg_replace("/gen_cd_/i","",$key);
+      }elseif(preg_match("/^copy_.*/",$key)){
+        $s_action="copy";
+        $s_entry  = preg_replace("/^copy_/i","",$key);
+      }elseif(preg_match("/^cut_.*/",$key)){
+        $s_action="cut";
+        $s_entry  = preg_replace("/^cut_/i","",$key);
+      }
+    }
+   
+    /* Incoming handling  
+     * If someone made a systemtype and ogroup selection 
+     * Display the new requested entry type ... servtab  in case of server and so on.
+     */
+    if(isset($_POST['SystemTypeChoosen'])){
+      $s_action = "SelectedSystemType";
+      $s_entry  = $_POST['SystemType'];
+      $_SESSION['SelectedSystemType']['ogroup'] = $_POST['ObjectGroup'];
+      $this->systab = NULL;
+    }
+
+    /* remove image tags from posted entry  (posts looks like this 'name_x')*/
+    $s_entry  = preg_replace("/_.$/","",$s_entry);
+
+    /* Edit was requested by pressing the name(link) of an item */
+    if((isset($_GET['act']))&&($_GET['act']=="edit_entry")){
+      $s_action ="edit";
+      $s_entry  = $_GET['id'];
+    }
+    /* Create options */
+    if(isset($_POST['menu_action']) && preg_match("/^newsystem_/",$_POST['menu_action'])){
+      $s_action = "newsystem";
+      $s_entry  = preg_replace("/^newsystem_/","",$_POST['menu_action']);
+    }
+
+    /* handle C&P from layers menu */
+    if(isset($_POST['menu_action']) && preg_match("/^multiple_copy_systems/",$_POST['menu_action'])){
+      $s_action = "copy_multiple";
+    }
+    if(isset($_POST['menu_action']) && preg_match("/^multiple_cut_systems/",$_POST['menu_action'])){
+      $s_action = "cut_multiple";
+    }
+    if(isset($_POST['menu_action']) && preg_match("/^editPaste/",$_POST['menu_action'])){
+      $s_action = "editPaste";
+    }
+
+    /* handle remove from layers menu */
+    if(isset($_POST['menu_action']) && preg_match("/^remove_multiple/",$_POST['menu_action'])){
+      $s_action = "del_multiple";
+    }
+    
+
+    /* Check for exeeded sizelimit */
+    if (($message= check_sizelimit()) != ""){
+      return($message);
+    }
+
+    /* Try to get informations about what kind of system to create */
+    if ($s_action=="new") {
+      return ($smarty->fetch(get_template_path('chooser.tpl', TRUE)));
+    }
+
+
+    /********************
+      Copy & Paste Handling  ...
+     ********************/
+
+    /* Display the copy & paste dialog, if it is currently open */
+    $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
+    if($ret){
+      return($ret);
+    }
+  
+
+    /********************
+      Create FAI CD ...   
+     ********************/
+    if ($s_action=="gen_cd"){
+      $this->dn= $this->terminals[$s_entry]['dn'];
+      $_SESSION['objectinfo']= $this->dn;
+      return ($smarty->fetch(get_template_path('gencd.tpl', TRUE)));
+    }
+
+
+    /* Start CD-Creation */
+    if ((isset($_POST["cd_create"])) && !empty($this->dn)){
+      $smarty->assign("src", "?plug=".$_GET['plug']."&amp;PerformIsoCreation");
+      return ($smarty->fetch(get_template_path('gencd_frame.tpl', TRUE)));
+    }
+
+
+    if ($this->dn != "" && isset($_GET['PerformIsoCreation'])){
+
+      $return_button   = "<form method='get' action='main.php' target='_parent'>
+        <input type='submit' value='"._("Back")."'>
+        <input type='hidden' name='plug' value='".$_GET['plug']."'/>
+        </form>";
+
+      $dsc             = array(0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w"));
+
+      /* Get and check command */
+      $command= $this->config->search("workgeneric", "ISOCMD",array('tabs'));
+      
+      if (check_command($command)){
+        @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, "Execute");
+
+        /* Print out html introduction */
+        echo '  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
+          <html>
+          <head>
+          <title></title>
+          <style type="text/css">@import url("themes/default/style.css");</style>
+          <script language="javascript" src="include/focus.js" type="text/javascript"></script>
+          </head>
+          <body style="background: none; margin:4px;" id="body" >
+          <pre>';
+
+        /* Open process handle and check if it is a valid process */
+        $process= proc_open($command." '".$this->dn."'", $dsc, $pipes);
+        if (is_resource($process)) {
+          fclose($pipes[0]);
+
+          /* Print out returned lines && write JS to scroll down each line */
+          while (!feof($pipes[1])){
+            $cur_dat = fgets($pipes[1], 1024);
+            echo $cur_dat;
+            echo '<script language="javascript" type="text/javascript">scrollDown2();</script>' ;
+            flush();
+          }
+        }
+
+        /* Get error string && close streams */
+        $buffer= stream_get_contents($pipes[2]);
+
+        fclose($pipes[1]);
+        fclose($pipes[2]);
+        echo "</pre>";
+
+        /* Check return code */
+        $ret= proc_close($process);
+        if ($ret != 0){
+          echo "<h1 style='color:red'>"._("Creating the image failed. Please see the report below.")."</h1>";
+          echo "<pre style='color:red'>$buffer</pre>";
+        }
+
+
+
+        echo $return_button."<br>";
+
+      } else {
+        $tmp= "<h1 style='color:red'>".sprintf(_("Command '%s', specified for ISO creation doesn't seem to exist."), $command)."</h1>";
+        echo $tmp;
+      }
+
+      /* Scroll down completly */
+      echo '<script language="javascript" type="text/javascript">scrollDown2();</script>' ;
+      echo '</body></html>';
+      flush();
+      exit;
+    }
+
+
+    /********************
+      Create new system ...   
+     ********************/
+    /* Create new default terminal 
+     * Or create specified object of selected system type, from given incoming object  
+     */
+
+    $save_object_directly = false;
+    if(($s_action == "SelectedSystemType") && (isset($_POST['ObjectGroup']) && ($_POST['ObjectGroup'] != "none"))){
+      $save_object_directly = true;
+    }
+
+    if (isset($_POST['create_system'])||$s_action=="newsystem"||$s_action == "SelectedSystemType") {
+
+      /* If the current entry is an incoming object 
+       * $sw = System type as posted in new incoming handling dialog 
+       */ 
+      if($s_action == "SelectedSystemType") {
+        $sw         = $s_entry;
+      }else{
+        if(isset($_POST['system'])){
+          $sw = $_POST['system'];
+        }else{
+          $sw = $s_entry;
+        }
+        $this->dn= "new";
+      }
+
+      $tabs = array(
+          "terminal"    => array("CLASS"=>"TERMTABS",     "TABNAME"=>"termgeneric",     "TABCLASS" =>"termtabs",      "ACL"=> "terminal"),
+          "workstation" => array("CLASS"=>"WORKTABS",     "TABNAME"=>"workgeneric",     "TABCLASS" =>"worktabs",      "ACL"=> "workstation"),
+          "server"      => array("CLASS"=>"SERVTABS",     "TABNAME"=>"servgeneric",     "TABCLASS" =>"servtabs",      "ACL"=> "server"),
+          "printer"     => array("CLASS"=>"PRINTTABS",    "TABNAME"=>"printgeneric",    "TABCLASS" =>"printtabs",     "ACL"=> "printer"),
+          "phone"       => array("CLASS"=>"PHONETABS",    "TABNAME"=>"phoneGeneric",    "TABCLASS" =>"phonetabs",     "ACL"=> "phone"),
+          "component"   => array("CLASS"=>"COMPONENTTABS","TABNAME"=>"componentGeneric","TABCLASS" =>"componenttabs", "ACL"=> "component"));
+
+      if(isset($tabs[$sw])){
+        $class    = $tabs[$sw]["CLASS"];
+        $tabname  = $tabs[$sw]["TABNAME"];
+        $tabclass = $tabs[$sw]["TABCLASS"];
+        $acl_cat  = $tabs[$sw]["ACL"];
+
+        /* Load permissions for selected 'dn' and check if
+           we're allowed to remove this 'dn' */
+        $ui       = get_userinfo();
+        $tabacl   = $ui->get_permissions($this->DivListSystem->selectedBase,$acl_cat."/".$tabname);
+        if(preg_match("/c/",$tabacl)){
+          $this->systab= new $tabclass($this->config, $this->config->data['TABS'][$class], $this->dn,$sw);
+          $this->systab->set_acl_base($this->DivListSystem->selectedBase);
+          $this->systab->by_object[$tabname]->base = $this->DivListSystem->selectedBase;
+          $this->systab->base = $this->DivListSystem->selectedBase;
+        }else{
+          print_red(_("You are not allowed to create a new object of this type."));
+        }
+      }
+    }
+
+    /********************
+      Edit system ...   
+     ********************/
+
+    /* User wants to edit data? */
+    if (($s_action == "edit") && (!isset($this->systab->config))){
+
+      $this->dn= $this->terminals[$s_entry]['dn'];
+
+      /* Check locking, save current plugin in 'back_plugin', so
+         the dialog knows where to return. */
+      if (($user= get_lock($this->dn)) != ""){
+        return(gen_locked_message ($user, $this->dn));
+      }
+
+      /* Find out more about the object type */
+      $ldap= $this->config->get_ldap_link();
+      $ldap->cat($this->dn, array('objectClass','gotoMode'));
+      $attrs= $ldap->fetch();
+      $type= $this->get_system_type($attrs);
+
+      /* Lock the current entry, so everyone will get the
+         above dialog */
+      $tabs = array(
+          "terminal"    => array("CLASS"=>"TERMTABS",     "TABCLASS" =>"termtabs",      "ACL"=> "terminal"),
+          "workstation" => array("CLASS"=>"WORKTABS",     "TABCLASS" =>"worktabs",      "ACL"=> "workstation"),
+          "server"      => array("CLASS"=>"SERVTABS",     "TABCLASS" =>"servtabs",      "ACL"=> "server"),
+          "printer"     => array("CLASS"=>"PRINTTABS",    "TABCLASS" =>"printtabs",     "ACL"=> "printer"),
+          "phone"       => array("CLASS"=>"PHONETABS",    "TABCLASS" =>"phonetabs",     "ACL"=> "phone"),
+          "winstation"  => array("CLASS"=>"WINTABS",      "TABCLASS" =>"wintabs",       "ACL"=> "winworkstation"),
+          "component"   => array("CLASS"=>"COMPONENTTABS","TABCLASS" =>"componenttabs", "ACL"=> "component"));
+
+
+      if($type == "ArpNewDevice"){
+        $this->systab = new ArpNewDeviceTabs($this->config,$this->config->data['TABS']['ARPNEWDEVICETABS'],$this->dn);
+      }elseif($type == "NewDevice"){
+        $this->systab = new SelectDeviceType($this->config,$this->dn) ;
+      }elseif(isset($tabs[$type])){
+
+        $class    = $tabs[$type]["CLASS"];
+        $acl_cat  = $tabs[$type]["ACL"];
+        $tabclass = $tabs[$type]["TABCLASS"];
+
+        $this->systab= new $tabclass($this->config, $this->config->data['TABS'][$class], $this->dn,$acl_cat);
+        $this->systab->set_acl_base($this->dn);
+        $_SESSION['objectinfo']= $this->dn;
+        add_lock ($this->dn, $this->ui->dn);
+      }else{ 
+        print_red (_("You can't edit this object type yet!"));
+        del_lock($this->dn);
+      }
+    }
+
+
+    /********************
+      Change password ...   
+     ********************/
+
+    /* Set terminals root password */
+    if ($s_action=="change_pw"){
+      $tabs = array(
+          "terminal"    => array("CLASS"=>"TERMTABS",     "TABNAME"=>"termgeneric",     "TABCLASS" =>"termtabs",      "ACL"=> "terminal"),
+          "workstation" => array("CLASS"=>"WORKTABS",     "TABNAME"=>"workgeneric",     "TABCLASS" =>"worktabs",      "ACL"=> "workstation"));
+
+      $type = $this->get_system_type($this->terminals[$s_entry]);
+      $class    = $tabs[$type]["CLASS"];
+      $tabname  = $tabs[$type]["TABNAME"];
+      $acl_cat  = $tabs[$type]["ACL"];
+      $tabclass = $tabs[$type]["TABCLASS"];
+      $ui       = get_userinfo();
+      $tabacl   = $ui->get_permissions($this->DivListSystem->selectedBase,$acl_cat."/".$tabname,"gotoRootPasswd");
+      if(preg_match("/w/",$tabacl)){
+        $this->dn= $this->terminals[$s_entry]['dn'];
+        $_SESSION['objectinfo']= $this->dn;
+        return ($smarty->fetch(get_template_path('password.tpl', TRUE)));
+      }else{
+        print_red(_("You are not allowed to change the password for this object."));
+      }
+    }
+
+
+    /********************
+      Password change finish, but check if entered data is ok 
+     ********************/
+
+    /* Correctly specified? */
+    if (isset($_POST['password_finish'])){
+      if ($_POST['new_password'] != $_POST['repeated_password']){
+        print_red (_("Passwords entered as new and repeated do not match!"));
+        return($smarty->fetch(get_template_path('password.tpl', TRUE)));
+      }
+    }
+
+    /********************
+      Password change finish
+     ********************/
+
+    /* Change terminal password */
+    if (isset($_POST['password_finish']) && 
+        $_POST['new_password'] == $_POST['repeated_password']){
+
+      /* Check if user is allowed to set password */
+      $tabs = array(
+          "terminal"    => array("CLASS"=>"TERMTABS",     "TABNAME"=>"termgeneric",     "TABCLASS" =>"termtabs",      "ACL"=> "terminal"),
+          "workstation" => array("CLASS"=>"WORKTABS",     "TABNAME"=>"workgeneric",     "TABCLASS" =>"worktabs",      "ACL"=> "workstation"));
+
+      /* Detect object type */
+      $type = "";
+      foreach($this->terminals as $terminal){
+        if($terminal['dn'] == $this->dn){
+          $type = $this->get_system_type($terminal);
+          break;
+        } 
+      }
+
+      /* Type detected */
+      if(!empty($type)){
+
+        /* Get infos */
+        $class    = $tabs[$type]["CLASS"];
+        $tabname  = $tabs[$type]["TABNAME"];
+        $acl_cat  = $tabs[$type]["ACL"];
+        $tabclass = $tabs[$type]["TABCLASS"];
+    
+        /* Get acls */
+        $ui       = get_userinfo();
+        $tabacl   = $ui->get_permissions($this->DivListSystem->selectedBase,$acl_cat."/".$tabname,"gotoRootPasswd");
+
+        /* Check acls */
+        if(preg_match("/w/",$tabacl)){
+          $ldap = $this->config->get_ldap_link();
+          $ldap->cd($this->dn);
+
+          $attrs= array();
+          if ($_POST['new_password'] == ""){
+            $attrs['gotoRootPasswd']= array();
+          } else {
+            $attrs['gotoRootPasswd']= crypt($_POST['new_password'],substr(session_id(),0,2));
+          }
+          $ldap->modify($attrs);
+          new log("security","systems/".get_class($this),$this->dn,array_keys($attrs),$ldap->get_error());
+        }else{
+          print_red(_("You are not allowed to change the password for this object."));
+        }
+      }else{
+        print_red(_("Can't detect object to change password."));
+      }
+      unset($_SESSION['objectinfo']);
+    }
+
+
+    /********************
+      Delete system cancel
+     ********************/
+
+    /* Delete terminal canceled? */
+    if (isset($_POST['delete_cancel']) || isset($_POST['password_cancel'])){
+      del_lock ($this->dn);
+      unset($_SESSION['objectinfo']);
+    }
+
+
+    /********************
+      Delete MULTIPLE entries requested, display confirm dialog
+     ********************/
+
+    if ($s_action=="del_multiple"){
+      $this->dns = array();
+      $ids = $this->list_get_selected_items();
+
+      if(count($ids)){
+
+        foreach($ids as $id){
+          $dn = $this->terminals[$id]['dn'];
+          if (($user= get_lock($dn)) != ""){
+            return(gen_locked_message ($user, $dn));
+          }
+          $this->dns[$id] = $dn;
+        }
+
+        $dns_names = "<br><pre>";
+        foreach($this->dns as $dn){
+          add_lock ($dn, $this->ui->dn);
+          $dns_names .= $dn."\n";
+        }
+        $dns_names .="</pre>";
+
+        /* Lock the current entry, so nobody will edit it during deletion */
+        if (count($this->dns) == 1){
+          $smarty->assign("warning",     sprintf(_("You're about to delete the following entry %s"), @LDAP::fix($dns_names)));
+        } else {
+          $smarty->assign("warning",     sprintf(_("You're about to delete the following entries %s"), @LDAP::fix($dns_names)));
+        }
+        $smarty->assign("multiple", true);
+        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+      }
+    }
+
+
+    /********************
+      Delete MULTIPLE entries confirmed
+     ********************/
+
+    /* Confirmation for deletion has been passed. Users should be deleted. */
+    if (isset($_POST['delete_multiple_system_confirm'])){
+
+      $ui = get_userinfo();
+      $tabs = array(
+          "terminal"    => array("CLASS"=>"TERMTABS",     "TABCLASS" =>"termtabs",      "ACL"=> "terminal/termgeneric"),
+          "workstation" => array("CLASS"=>"WORKTABS",     "TABCLASS" =>"worktabs",      "ACL"=> "workstation/workgeneric"),
+          "server"      => array("CLASS"=>"SERVTABS",     "TABCLASS" =>"servtabs",      "ACL"=> "server/servgeneric"),
+          "printer"     => array("CLASS"=>"PRINTTABS",    "TABCLASS" =>"printtabs",     "ACL"=> "printer/printgeneric"),
+          "phone"       => array("CLASS"=>"PHONETABS",    "TABCLASS" =>"phonetabs",     "ACL"=> "phone/phoneGeneric"),
+          "winstation"  => array("CLASS"=>"WINTABS",      "TABCLASS" =>"wintabs",       "ACL"=> "winworkstation/wingeneric"),
+          "component"   => array("CLASS"=>"COMPONENTTABS","TABCLASS" =>"componenttabs", "ACL"=> "component/componentGeneric"));
+
+
+      /* Remove user by user and check acls before removeing them */
+      foreach($this->dns as $key => $dn){
+
+        /* Get 'dn' from posted termlinst */
+        $attrs    = $this->terminals[$key];
+        $type= $this->get_system_type($attrs);
+
+        /* get object type */
+        $tabtype  = "termtabs";
+        $tabobj   = "TERMTABS";
+        $tabacl   = "";
+        if(isset($tabs[$type])){
+          $tabtype = $tabs[$type]['TABCLASS'];
+          $tabobj  = $tabs[$type]['CLASS'];
+          $tabacl  = $ui->get_permissions($dn,$tabs[$type]['ACL']);
+
+          /* Load permissions for selected 'dn' and check if
+             we're allowed to remove this 'dn' */
+          if(preg_match("/d/",$tabacl)){ 
+
+            /* Delete request is permitted, perform LDAP action */
+            if($tabtype=="phonetabs"){
+              $this->systab= new $tabtype($this->config, $this->config->data['TABS'][$tabobj], $dn,$type);
+              $this->systab->set_acl_base($dn);
+              $this->systab->by_object['phoneGeneric']->remove_from_parent ();
+            }else{
+              $this->systab= new $tabtype($this->config,$this->config->data['TABS'][$tabobj], $dn,$type);
+              $this->systab->set_acl_base($dn);
+              $this->systab->delete();
+            }
+            unset ($this->systab);
+            $this->systab= NULL;
+
+          } else {
+            /* Normally this shouldn't be reached, send some extra
+               logs to notify the administrator */
+            print_red (_("You are not allowed to delete this component!"));
+            new log("security","systems/".get_class($this),$dn,array(),"Tried to trick deletion.");
+          }
+          /* Remove lock file after successfull deletion */
+          del_lock ($dn);
+          unset($this->dns[$key]);
+        }
+      }
+    }
+
+    /********************
+      Delete MULTIPLE entries Canceled
+     ********************/
+
+    /* Remove lock */
+   if(isset($_POST['delete_multiple_system_cancel'])){
+      foreach($this->dns as $key => $dn){
+        del_lock ($dn);
+        unset($this->dns[$key]);
+      }
+    }
+
+
+    /********************
+      Delete system, confirm dialog
+     ********************/
+
+    /* Remove terminal was requested */
+    if ($s_action=="del"){
+
+      /* Get 'dn' from posted termlinst */
+      $this->dn = $this->terminals[$s_entry]['dn'];
+      $attrs    = $this->terminals[$s_entry];
+
+      $type= $this->get_system_type($attrs);
+      $ui = get_userinfo();
+      $tabs = array(
+          "terminal"    => array("CLASS"=>"TERMTABS",     "TABCLASS" =>"termtabs",      "ACL"=> "terminal/termgeneric"),
+          "workstation" => array("CLASS"=>"WORKTABS",     "TABCLASS" =>"worktabs",      "ACL"=> "workstation/workgeneric"),
+          "server"      => array("CLASS"=>"SERVTABS",     "TABCLASS" =>"servtabs",      "ACL"=> "server/servgeneric"),
+          "printer"     => array("CLASS"=>"PRINTTABS",    "TABCLASS" =>"printtabs",     "ACL"=> "printer/printgeneric"),
+          "phone"       => array("CLASS"=>"PHONETABS",    "TABCLASS" =>"phonetabs",     "ACL"=> "phone/phoneGeneric"),
+          "winstation"  => array("CLASS"=>"WINTABS",      "TABCLASS" =>"wintabs",       "ACL"=> "winworkstation/wingeneric"),
+          "component"   => array("CLASS"=>"COMPONENTTABS","TABCLASS" =>"componenttabs", "ACL"=> "component/componentGeneric"));
+
+
+      /* get object type */
+      $tabtype  = "termtabs";
+      $tabobj   = "TERMTABS";
+      $tabacl   = "";
+      if(isset($tabs[$type])){
+        $tabtype = $tabs[$type]['TABCLASS'];
+        $tabobj  = $tabs[$type]['CLASS'];
+        $tabacl  = $ui->get_permissions($this->dn,$tabs[$type]['ACL']);
+      }
+
+      /* Load permissions for selected 'dn' and check if
+         we're allowed to remove this 'dn' */
+      if(preg_match("/d/",$tabacl)){ 
+
+        /* Check locking, save current plugin in 'back_plugin', so
+           the dialog knows where to return. */
+        if (($user= get_lock($this->dn)) != ""){
+          return(gen_locked_message ($user, $this->dn));
+        }
+
+        /* Lock the current entry, so nobody will edit it during deletion */
+        add_lock ($this->dn, $this->ui->dn);
+        $smarty->assign("warning", sprintf(_("You're about to delete all information about the component at '%s'."), @LDAP::fix($this->dn)));
+        $smarty->assign("multiple", false);
+        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+      } else {
+
+        /* Obviously the user isn't allowed to delete. Show message and
+           clean session. */
+        print_red (_("You are not allowed to delete this component!"));
+      }
+    }
+
+
+    /********************
+      Delete system, confirmed
+     ********************/
+    /* Confirmation for deletion has been passed. Terminal should be deleted. */
+    if (isset($_POST['delete_terminal_confirm'])){
+
+      /* Find out more about the object type */
+      $ldap= $this->config->get_ldap_link();
+      $ldap->cat($this->dn, array('objectClass'));
+      $attrs= $ldap->fetch();
+      $type= $this->get_system_type($attrs);
+
+      $ui = get_userinfo();
+
+      $tabs = array(
+          "terminal"    => array("CLASS"=>"TERMTABS",     "TABCLASS" =>"termtabs",      "ACL"=> "terminal/termgeneric"),
+          "workstation" => array("CLASS"=>"WORKTABS",     "TABCLASS" =>"worktabs",      "ACL"=> "workstation/workgeneric"),
+          "server"      => array("CLASS"=>"SERVTABS",     "TABCLASS" =>"servtabs",      "ACL"=> "server/servgeneric"),
+          "printer"     => array("CLASS"=>"PRINTTABS",    "TABCLASS" =>"printtabs",     "ACL"=> "printer/printgeneric"),
+          "phone"       => array("CLASS"=>"PHONETABS",    "TABCLASS" =>"phonetabs",     "ACL"=> "phone/phoneGeneric"),
+          "winstation"  => array("CLASS"=>"WINTABS",      "TABCLASS" =>"wintabs",       "ACL"=> "winworkstation/wingeneric"),
+          "component"   => array("CLASS"=>"COMPONENTTABS","TABCLASS" =>"componenttabs", "ACL"=> "component/componentGeneric"));
+
+      /* get object type */
+      $tabtype  = "termtabs";
+      $tabobj   = "TERMTABS";
+      $tabacl   = "";
+      if(isset($tabs[$type])){
+        $tabtype = $tabs[$type]['TABCLASS'];
+        $tabobj  = $tabs[$type]['CLASS'];
+        $tabacl  = $ui->get_permissions($this->dn,$tabs[$type]['ACL']);
+      }
+
+      /* Check if we are allowed to remove this object */
+      if(preg_match("/d/",$tabacl)){
+
+        /* Delete request is permitted, perform LDAP action */
+        if($tabtype=="phonetabs"){
+          $this->systab= new $tabtype($this->config, $this->config->data['TABS'][$tabobj], $this->dn,$type);
+          $this->systab->set_acl_base($this->dn);
+          $this->systab->by_object['phoneGeneric']->remove_from_parent ();
+        }else{  
+          $this->systab= new $tabtype($this->config,$this->config->data['TABS'][$tabobj], $this->dn,$type);
+          $this->systab->set_acl_base($this->dn);
+          $this->systab->delete();
+        }
+        unset ($this->systab);
+        $this->systab= NULL;
+
+        /* Terminal list has changed, reload it. */
+      } else {
+
+        /* Normally this shouldn't be reached, send some extra
+           logs to notify the administrator */
+        print_red (_("You are not allowed to delete this component!"));
+        new log("security","systems/".get_class($this),$dn,array(),"Tried to trick deletion.");
+      }
+
+      /* Remove lock file after successfull deletion */
+      del_lock ($this->dn);
+    }
+
+
+
+
+
+
+
+
+
+   /********************
+      Edit system type finished, check if everything went ok
+     ********************/
+    /* Finish user edit is triggered by the tabulator dialog, so
+       the user wants to save edited data. Check and save at this
+       point. */
+    if ((isset($_POST['edit_finish'])) && (isset($this->systab->config)) || $save_object_directly){
+
+      /* Check tabs, will feed message array */
+      $message = array();
+      if(!$save_object_directly){
+        $message = $this->systab->check();
+      }else{
+        $found = false;
+
+        /* Set gotoMode to active if we there was an ogroup selected . (save_object_directly) */
+        foreach(array("workgeneric"=>"active","servgeneric"=>"active","termgeneric"=>"graphic") as $tab => $value){
+          if(isset($this->systab->by_object[$tab]->gotoMode)) {
+            $found = true;
+            $this->systab->by_object[$tab]->gotoMode = $value;
+          }
+        }
+        if(!$found){
+          print_red(sprintf(_("Can't set gotoMode to status 'active', the current object couldn't be identified.")));
+        }
+
+      }
+      /* Save, or display error message? */
+      if (count($message) == 0){
+
+        /* Incoming behavior; you can select a system type and an ogroup membership.
+         * If this object is an Incoming object, $_SESSION['SelectedSystemType'] isset.
+         * Check if we must add the new object to an object group.
+         *
+         * If this is done, delete the old incoming entry... it is still there, because this is a new
+         * entry and not an edited one, so we will delete it.
+         *
+         */
+
+        if(isset($_SESSION['SelectedSystemType'])){
+          $SelectedSystemType= $_SESSION['SelectedSystemType'];
+          if($SelectedSystemType['ogroup'] != "none"){
+            $og = new ogroup($this->config,$SelectedSystemType['ogroup']);
+            if($og){
+              $og->AddDelMembership($this->systab->dn);
+              $og->save();
+            }
+          }
+        }
+
+        /* Save terminal data to ldap */
+        if(isset($_SESSION['SelectedSystemType']['ogroup']) && $_SESSION['SelectedSystemType']['ogroup'] != 'none'){
+          foreach (array("workservice", "termservice") as $cls){
+            if (isset($this->systab->by_object[$cls])){
+              $this->systab->by_object[$cls]->gotoXMouseport= "";
+              $this->systab->by_object[$cls]->gotoXMouseType= "";
+              $this->systab->by_object[$cls]->gotoXResolution= "";
+              $this->systab->by_object[$cls]->gotoXColordepth= "";
+            }
+          }
+        }
+
+        $this->systab->save();
+
+        if(isset($_SESSION['SelectedSystemType'])){
+          unset($_SESSION['SelectedSystemType']);
+          if(!isset($ldap)){
+            $ldap = $this->config->get_ldap_link();
+          }
+          $ldap->cd ($this->dn);
+          $ldap->cat($this->dn, array('dn'));
+          if(count($ldap->fetch())){
+            $ldap->cd($this->dn);
+            $ldap->rmDir($this->dn);
+          }
+          $ldap->cd($this->config->current['BASE']);
+        }
+
+        /* Terminal has been saved successfully, remove lock from
+           LDAP. */
+        if ($this->dn != "new"){
+          del_lock ($this->dn);
+        }
+
+        unset ($this->systab);
+        $this->systab= NULL;
+        unset($_SESSION['objectinfo']);
+      } else {
+        /* Ok. There seem to be errors regarding to the tab data,
+           show message and continue as usual. */
+        show_errors($message);
+      }
+    }
+
+
+    /********************
+      Edit system was canceled 
+     ********************/
+    /* Cancel dialogs */
+    if (isset($_POST['edit_cancel']) || isset($_POST['password_cancel']) || isset($_POST['SystemTypeAborted'])){
+      if (isset($this->systab)){
+        del_lock ($this->systab->dn);
+        unset ($this->systab);
+      }
+      $this->systab= NULL;
+      unset($_SESSION['objectinfo']);
+
+      /* Remove ogroup selection, which was set while editing a new incoming entry */
+      if(isset($_SESSION['SelectedSystemType'])){
+        unset($_SESSION['SelectedSystemType']);
+      }
+    }
+
+    /********************
+      Display edit dialog, or some other
+     ********************/
+
+    /* Show tab dialog if object is present */
+    if (isset($this->systab->config)){
+      $display= $this->systab->execute();
+
+      /* Don't show buttons if tab dialog requests this */
+
+      $dialog     = FALSE;
+      $hide_apply = $this->dn == "new";
+      if(is_object($this->systab) && !isset($this->systab->by_object)){
+        $dialog = TRUE;
+        $hide_apply = TRUE;
+      }elseif(isset($this->systab->by_object[$this->systab->current]->dialog)){
+        $dia = $this->systab->by_object[$this->systab->current]->dialog;
+        if($dia === TRUE || is_object($dia)){
+          $dialog = TRUE;
+        }  
+      }
+      if(isset($this->systab->by_object[$this->systab->current]->netConfigDNS) && 
+        $this->systab->by_object[$this->systab->current]->netConfigDNS->dialog){
+        $dialog = TRUE;
+      }
+
+      if (!$dialog){
+        $display.= "<p style=\"text-align:right\">\n";
+        $display.= "<input type=\"submit\" name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
+        $display.= "&nbsp;\n";
+        if (!$hide_apply){
+          $display.= "<input type=submit name=\"edit_apply\" value=\""._("Apply")."\">\n";
+          $display.= "&nbsp;\n";
+        }
+        $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+        $display.= "</p>";
+      }
+      return ($display);
+    }
+
+    /* Check if there is a snapshot dialog open */
+    $base = $this->DivListSystem->selectedBase;
+    if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases())){
+      return($str);
+    }
+
+    /* Display dialog with system list */
+    $this->DivListSystem->parent = $this;
+    $this->DivListSystem->execute();
+
+    /* Add departments if subsearch is disabled */
+    if(!$this->DivListSystem->SubSearch){
+      $this->DivListSystem->AddDepartments($this->DivListSystem->selectedBase,3,1);
+    }
+    $this->reload();
+    $this->DivListSystem->setEntries($this->terminals);
+    return($this->DivListSystem->Draw());
+  }
+
+
+  /* Return departments, that will be included within snapshot detection */
+  function get_used_snapshot_bases()
+  {
+    $tmp = array();
+
+    /* Check acls, if we are not allowed to create and write each plugin tab, skip this object */
+
+    $tabs = array(
+        "terminal"        => "ou=terminals,ou=systems,",
+        "workstation"     => "ou=workstations,ou=systems,",
+        "incoming"        => "ou=incoming,",
+        "server"          => "ou=servers,ou=systems,",
+        "printer"         => "ou=printers,ou=systems,",
+        "phone"           => "ou=phones,ou=systems,",
+        "winworkstation"  => get_winstations_ou(),
+        "component"       => "ou=netdevices,ou=systems,"
+        ); 
+
+    foreach($tabs as $acl_cat => $dn){
+
+      $acl_all = $this->ui->has_complete_category_acls($dn.$this->DivListSystem->selectedBase,$acl_cat);
+      if(preg_match("/(c.*w|w.*c)/",$acl_all)){
+        $tmp[] = $dn.$this->DivListSystem->selectedBase;
+      }
+    }
+    return($tmp); 
+  }
+
+
+  function remove_from_parent()
+  {
+    /* Optionally execute a command after we're done */
+    $this->postremove();
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    $this->DivListSystem->save_object();
+  }
+
+
+  /* Check values */
+  function check()
+  {
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+  }
+
+  function adapt_from_template($dn)
+  {
+  }
+
+  function password_change_needed()
+  {
+  }
+
+  function reload()
+  {
+    /* some var init */
+    $ui = get_userinfo();
+    $res              = array();
+    $this->terminals  = array();
+    $userregex        = "";
+
+    /* Set base for all searches */
+    $base=  $this->DivListSystem->selectedBase;
+
+    /* Prepare samba class name */
+    $samba  ="";
+    if ($this->DivListSystem->ShowWinWorkstations){
+      if ($this->config->current['SAMBAVERSION'] == "3"){
+        $samba= "sambaSamAccount";
+      } else {
+        $samba= "sambaAccount";
+      }
+    }
+
+    /* This array represents the combination between checkboxes and search filters */
+    $objs = array( "ShowServers"        => array("CLASS" => "goServer"        ,"TREE" => "ou=servers,ou=systems," ),
+        "ShowTerminals"      => array("CLASS" => "gotoTerminal"    ,"TREE" => "ou=terminals,ou=systems,"), 
+        "ShowPrinters"       => array("CLASS" => "gotoPrinter"     ,"TREE" => "ou=printers,ou=systems," ),
+        "ShowDevices"        => array("CLASS" => "ieee802Device"   ,"TREE" => "ou=netdevices,ou=systems," ),
+        "ShowPhones"         => array("CLASS" => "goFonHardware"   ,"TREE" => "ou=phones,ou=systems," ),
+        "ShowWorkstations"   => array("CLASS" => "gotoWorkstation" ,"TREE" => "ou=workstations,ou=systems," ),
+        "ShowWinWorkstations"=> array("CLASS" => $samba            ,"TREE" => get_winstations_ou() ));
+
+    /* Include the 'Display Systems of user' attribute */ 
+    if ((!empty($this->DivListSystem->UserRegex)) && ($this->DivListSystem->UserRegex!= "*")){
+      $userregex = "(gotoLastUser=".$this->DivListSystem->UserRegex.")";
+    }
+
+    /* Attributes to fetch */
+    $sys_attrs        = array("cn", "description", "macAddress", "objectClass", "sambaDomainName","gotoMode");
+    $sys_categories   = array("terminal", "workstation", "server", "phone" ,"printer");
+
+    /* Add FAIstate to attributes if FAI is activated */
+    $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
+    if(!empty($tmp)){
+      $sys_attrs[] = "FAIstate";
+    }    
+
+    /* Walk through all possible search combinations, and search for some objects if the checkbox is enabled  */
+    foreach($objs as $checkBox => $oc){
+      if($this->DivListSystem->$checkBox){
+        if($this->DivListSystem->SubSearch){
+          if($oc['CLASS'] != ""){
+            $filter = "(&".$userregex."(objectClass=".$oc['CLASS'].")(cn=".$this->DivListSystem->Regex."))";
+            $new_res = get_list($filter, $sys_categories , $base,$sys_attrs, GL_NONE | GL_SUBSEARCH | GL_SIZELIMIT);
+      
+            /* Remove all objects that are not in the expected sub department */
+            foreach($new_res as $key => $obj){
+              if(preg_match("/^[^,]+,".normalizePreg($oc['TREE'])."/",$obj['dn'])){
+                $res[$obj['dn']] = $obj;
+              }
+            }
+          }
+        }else{
+          /* User filter? */
+          if($oc['CLASS'] != ""){
+            $filter = "(&".$userregex."(objectClass=".$oc['CLASS'].")(cn=".$this->DivListSystem->Regex."))";
+            $res = array_merge($res,get_list($filter,$sys_categories,$oc['TREE'].$base, $sys_attrs, GL_NONE | GL_SIZELIMIT));
+          }
+        }
+      } 
+    }
+
+    /* Search for incoming objects */ 
+    $filter = "(|(&".$userregex."(objectClass=goHard)(cn=".$this->DivListSystem->Regex.")))";
+    $res = array_merge($res,get_list($filter,$sys_categories,"ou=incoming,".$base,$sys_attrs, GL_NONE | GL_SIZELIMIT));
+
+    /* Get all gotoTerminal's */
+    foreach ($res as $value){
+
+      $tmp= $value['dn'];
+      $add= "";
+
+      /* Extract base */
+      foreach($objs as $obj){
+        if(preg_match("/,".$obj['TREE']."/i",$value['dn'])){
+          $tmp = trim( preg_replace("/^[^,]+,[^o]*".$obj['TREE']."/i","",$value['dn']));
+        }
+      }
+
+      /* Create a string containing the last part of the department. */
+      $dn_name = preg_replace("#^([^/]+/)*#","",convert_department_dn(@LDAP::fix($tmp)));
+      if(empty($dn_name)){
+        $dn_name = "/";
+      }
+
+      /* check if current object is a new one */
+      if (preg_match ("/,ou=incoming,/i", $tmp)){
+        if (in_array_ics('gotoTerminal', $value['objectClass'])){
+          $add= "- "._("New terminal");
+        }elseif (in_array_ics('gotoWorkstation', $value['objectClass'])){
+          $add= "- "._("New workstation");
+        }elseif (in_array_ics('GOhard', $value['objectClass']) && !isset($value['gotoMode'])){
+          $add= "- "._("Unknown device");
+        }elseif (in_array_ics('GOhard', $value['objectClass'])){
+          $add= "- "._("New Device");
+        }
+      } 
+
+      /* Detect type of object and create an entry for $this->terminals */
+      $terminal = array();
+
+      if (in_array_ics('gotoTerminal', $value["objectClass"])){
+
+        /* check acl */
+        $acl = $ui->get_permissions($value['dn'],"terminal/termgeneric");
+        if($add != "" || preg_match("/r/",$acl)) {
+          if (isset($value["macAddress"][0]) && $value["macAddress"][0] != "-"){
+            $terminal             = $value;
+            $terminal['type']     = "T";
+            $terminal['is_new']   = $add;
+          } else {
+            $terminal             = $value;
+            $terminal['type']     = "D";
+            $terminal['message']  = _("Terminal template for")."&nbsp;'".$dn_name."'&nbsp;";
+            $terminal['location'] = array_search($tmp, $this->config->departments); 
+          }
+        }
+      } elseif (in_array_ics('gotoWorkstation', $value["objectClass"])){
+
+        $acl = $ui->get_permissions($value['dn'],"workstation/workgeneric");
+        if($add != "" || preg_match("/r/",$acl)) {
+          if (isset($value["macAddress"][0]) &&  $value["macAddress"][0] != "-"){
+            $terminal             = $value;
+            $terminal['type']     = "L";
+            $terminal['is_new']   = $add;
+          } else {
+            $terminal             = $value;
+            $terminal['type']     = "D";
+            $terminal['location'] = array_search($tmp, $this->config->departments);
+            $terminal['message']  = _("Workstation template for")."&nbsp;'".$dn_name."'&nbsp;";
+          }
+          if (isset($value["FAIstate"][0])){
+            $terminal['type']= $this->getState($terminal['type'], $value["FAIstate"][0]);
+          }
+        }
+      } elseif (in_array_ics('gotoPrinter', $value["objectClass"])){
+       
+   
+        $acl = $ui->get_permissions($value['dn'],"printer/printgeneric");
+        if($add != "" || preg_match("/r/",$acl)) {
+
+          $terminal             = $value;
+          $terminal['type']     = "P";
+        }
+      } elseif (in_array_ics('goServer', $value["objectClass"])){
+
+        $acl = $ui->get_permissions($value['dn'],"server/servgeneric");
+        if($add != "" || preg_match("/r/",$acl)) {
+
+          $terminal             = $value;
+          $terminal['type']     = "S";
+          if (isset($value["FAIstate"][0])){
+            $terminal['type']= $this->getState($terminal['type'], $value["FAIstate"][0]);
+          }
+        }
+      } elseif (in_array_ics('goFonHardware', $value["objectClass"])){
+
+        $acl = $ui->get_permissions($value['dn'],"phone/phoneGeneric");
+        if($add != "" || preg_match("/r/",$acl)) {
+
+          $terminal             = $value;
+          $terminal['type']     = "F";
+        }
+      }elseif (in_array_ics("GOhard",$value['objectClass'])){
+
+        $acl =  $ui->get_permissions($value['dn'],"server/servgeneric"). 
+                $ui->get_permissions($value['dn'],"terminal/termgeneric").
+                $ui->get_permissions($value['dn'],"workstation/workgeneric");
+        if($add != "" || preg_match("/r/",$acl)) {
+
+          $terminal = $value;
+          $terminal['type']   = "Q";
+          $terminal['is_new'] = $add;
+        }
+      } elseif (in_array_ics('ieee802Device', $value["objectClass"])){
+
+        $acl = $ui->get_permissions($value['dn'],"component/componentGeneric");
+        if($add != "" || preg_match("/r/",$acl)) {
+
+          $terminal             = $value;
+          $terminal['type']     = "C";
+        }
+      } else{
+
+        $name= preg_replace('/\$$/', '', $value['cn'][0]);
+        if (isset($value['sambaDomainName'])){
+          $domain= " [".$value['sambaDomainName'][0]."]";
+        } else {
+          $domain= "";
+        }
+        $terminal=$value;
+        $terminal['type']     ="W";
+        $terminal['domain']   = $name.$domain;
+      }
+
+      if(count($terminal)){
+        $this->terminals[]=$terminal;
+      }
+    }
+
+    $tmp=array();
+    foreach($this->terminals as $tkey => $val ){
+      $tmp[strtolower($val['cn'][0]).$val['dn']]=$val;
+    }
+    ksort($tmp);
+    $this->terminals=array();
+    foreach($tmp as $val){
+      $this->terminals[]=$val;
+    }
+    reset ($this->terminals);
+  }
+
+  function remove_lock()
+  {
+    if (isset($this->systab->dn)){
+      del_lock ($this->systab->dn);
+    }
+  }
+
+
+  function copyPasteHandling_from_queue($s_action,$s_entry)
+  {
+    /* Check if Copy & Paste is disabled */
+    if(!is_object($this->CopyPasteHandler)){
+      return("");
+    }
+
+
+    $tabs = array(
+        "terminal"    => array( "CLASS"     =>"TERMTABS",     "TABNAME" =>"termgeneric",     
+          "TABCLASS"  =>"termtabs",     "ACL"     =>"terminal"),
+        "workstation" => array( "CLASS"     =>"WORKTABS",     "TABNAME" =>"workgeneric",     
+          "TABCLASS"  =>"worktabs",     "ACL"     =>"workstation"),
+        "server"      => array( "CLASS"     =>"SERVTABS",     "TABNAME" =>"servgeneric",     
+          "TABCLASS"  =>"servtabs",     "ACL"     =>"server"),
+        "printer"     => array( "CLASS"     =>"PRINTTABS",    "TABNAME" =>"printgeneric",    
+          "TABCLASS"  =>"printtabs",    "ACL"     =>"printer"),
+        "phone"       => array( "CLASS"     =>"PHONETABS",    "TABNAME" =>"phoneGeneric",    
+          "TABCLASS"  =>"phonetabs",    "ACL"     =>"phone"),
+        "component"   => array( "CLASS"     =>"COMPONENTTABS","TABNAME" =>"componentGeneric",
+          "TABCLASS"  =>"componenttabs","ACL"     =>"component"));
+
+    /* Add a single entry to queue */
+    if($s_action == "cut" || $s_action == "copy"){
+
+      /* Cleanup object queue */
+      $this->CopyPasteHandler->cleanup_queue();
+      $dn     = $this->terminals[$s_entry]['dn'];
+      $oc     = $this->terminals[$s_entry]['objectClass'];
+      $type   = $this->get_system_type($this->terminals[$s_entry]);
+
+      $tab_o  = $tabs[$type]['CLASS'];
+      $tab_c  = $tabs[$type]['TABCLASS'];
+      $acl    = $tabs[$type]['ACL'];
+
+      $this->CopyPasteHandler->add_to_queue($dn,$s_action,$tab_c,$tab_o,$acl);
+    }
+
+    /* Add entries to queue */
+    if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
+
+      /* Cleanup object queue */
+      $this->CopyPasteHandler->cleanup_queue();
+
+      /* Add new entries to CP queue */
+      foreach($this->list_get_selected_items() as $id){
+        $dn = $this->terminals[$id]['dn'];
+        $oc = $this->terminals[$id]['objectClass']; 
+        $type = $this->get_system_type($this->terminals[$id]);
+
+        if(isset($tabs[$type])){
+          $tab_o  = $tabs[$type]['CLASS'];
+          $tab_c  = $tabs[$type]['TABCLASS'];
+          $acl    = $tabs[$type]['ACL'];
+
+          if($s_action == "copy_multiple"){
+            $this->CopyPasteHandler->add_to_queue($dn,"copy",$tab_c,$tab_o,$acl);
+          }
+          if($s_action == "cut_multiple"){
+            $this->CopyPasteHandler->add_to_queue($dn,"cut",$tab_c,$tab_o,$acl);
+          }
+        }
+      }
+    }
+
+    /* Start pasting entries */
+    if($s_action == "editPaste"){
+      $this->start_pasting_copied_objects = TRUE;
+    }
+  
+    /* Return C&P dialog */
+    if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
+    
+      /* Load entry from queue and set base */
+      $this->CopyPasteHandler->load_entry_from_queue();
+      $this->CopyPasteHandler->SetVar("base",$this->DivListSystem->selectedBase);
+
+      /* Get dialog */
+      $data = $this->CopyPasteHandler->execute();
+
+      /* Return dialog data */
+      if(!empty($data)){
+        return($data);
+      }
+    }
+
+    /* Automatically disable status for pasting */
+    if(!$this->CopyPasteHandler->entries_queued()){
+      $this->start_pasting_copied_objects = FALSE;
+    }
+    return("");
+  }
+
+
+  function get_system_type($attrs)
+  {
+    $classes = $attrs['objectClass'];
+
+    $type= "";
+    if (in_array_ics('ieee802Device', $classes)){
+      $type= "component";
+    }elseif (in_array_ics('gotoTerminal', $classes)){
+      $type= "terminal";
+    }elseif (in_array_ics('gotoWorkstation', $classes)){
+      $type= "workstation";
+    }elseif (in_array_ics('gotoPrinter', $classes)){
+      $type= "printer";
+    }elseif (in_array_ics('goFonHardware', $classes)){
+      $type= "phone";
+    }elseif (in_array_ics('goServer', $classes)){
+      $type= "server";
+    }elseif (in_array_ics('GOhard', $classes) && !isset($attrs['gotoMode']) && $this->arp_handling_active){
+      $type= "ArpNewDevice";
+    }elseif (in_array_ics('GOhard', $classes)){
+      $type= "NewDevice";
+    }elseif (in_array_ics('sambaAccount', $classes) ||
+        in_array_ics('sambaSamAccount', $classes)){
+      $type= "winstation";
+    }
+    return ($type);
+  }
+
+
+  function convert_list($input)
+  {
+    $temp= "";
+    $conv= array(      
+        "NQ" => array("select_newsystem.png",_("New System from incoming")),
+        "D" => array("select_default.png",_("Template")),
+        "T" => array("select_terminal.png",_("Terminal")),
+        "L" => array("select_workstation.png",_("Workstation")),
+        "GL" => array("select_workstation_green.png",_("Workstation is installing")),
+        "YL" => array("select_workstation_yellow.png",_("Workstation is waiting for action")),
+        "RL" => array("select_workstation_red.png",_("Workstation installation failed")),
+        "F" => array("select_phone.png",_("Phone")),
+        "S" => array("select_server.png",_("Server")),
+        "GS" => array("select_server_green.png",_("Server is installing")),
+        "YS" => array("select_server_yellow.png",_("Server is waiting for action")),
+        "RS" => array("select_server_red.png",_("Server installation failed")),
+        "W" => array("select_winstation.png",_("Winstation")),
+        "C" => array("select_component.png",_("Network Device")),
+        "NT"=> array("select_new_terminal.png",_("New Terminal")),
+        "NL"=> array("select_new_workstation.png",_("New Workstation")),
+        "P" => array("select_printer.png",_("Printer")));
+
+    if((isset($input['is_new']))&&(!empty($input['is_new']))){
+      $input['type']="N".$input['type'];
+    }
+    foreach ($conv  as $key => $value){
+      if($input['type']==$key){
+        $tmp['img'] ="<img class='center' src='images/".$value[0]."' alt='".$key."' title='".$value['1']."'>";
+        $tmp['class']=$key;
+        return $tmp;
+      }
+    }
+  }
+
+  
+  function getState($type, $state)
+  {
+    switch (preg_replace('/:.*$/', '', $state)) {
+      case 'installing':
+                $type= 'G'.$type;
+                break;
+      case 'error':
+                $type= 'R'.$type;
+                break;
+      case 'install':
+      case 'sysinfo':
+      case 'softupdate':
+      case 'scheduledupdate':
+                $type= 'Y'.$type;
+                break;
+    }
+
+
+    return ($type);
+  }
+
+
+  function list_get_selected_items()
+  {
+    $ids = array();
+    foreach($_POST as $name => $value){
+      if(preg_match("/^item_selected_[0-9]*$/",$name)){
+        $id   = preg_replace("/^item_selected_/","",$name);
+        $ids[$id] = $id;
+      }
+    }
+    return($ids);
+  }
+
+
+  /* !! Incoming dummy acls, required to defined acls for incoming objects
+   */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Incoming objects"),
+          "plDescription" => _("Incoming objects"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 99,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("incoming"   => array( "description"  => _("Incoming"),
+                                                          "objectClass"  => "")),
+          "plProvidedAcls"=> array()
+            
+          ));
+  }
+
+
+  
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/systems/class_terminalGeneric.inc b/gosa-core/plugins/admin/systems/class_terminalGeneric.inc
new file mode 100644 (file)
index 0000000..be12d59
--- /dev/null
@@ -0,0 +1,682 @@
+<?php
+
+class termgeneric extends plugin
+{
+  /* CLI vars */
+  var $cli_summary= "Manage terminal base objects";
+  var $cli_description= "Some longer text\nfor help";
+  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* Generic terminal attributes */
+  var $gotoMode= "disabled";
+  var $gotoTerminalPath= "";
+  var $gotoSwapServer= "";
+  var $gotoSyslogServer= "";
+  var $gotoSyslogServers = array();
+  var $gotoNtpServer= array();
+  var $gotoNtpServers= array();
+  var $gotoSndModule= "";
+  var $gotoFloppyEnable= "";
+  var $gotoCdromEnable= "";
+  var $ghCpuType= "-";
+  var $ghMemSize= "-";
+  var $ghUsbSupport= "-";
+  var $ghNetNic= array();
+  var $ghIdeDev= array();
+  var $ghScsiDev= array();
+  var $ghGfxAdapter= "-";
+  var $ghSoundAdapter= "-";
+  var $gotoLastUser= "-";
+  var $netConfigDNS;
+  /* Needed values and lists */
+  var $base= "";
+  var $cn= "";
+  var $orig_dn= "";
+
+  var $inheritTimeServer = true;
+
+  /* Plugin side filled */
+  var $modes= array();
+
+  /* attribute list for save action */
+  var $ignore_account= TRUE;
+  var $attributes= array("gotoMode", "gotoTerminalPath", 
+      "gotoSwapServer", "gotoSyslogServer", "gotoNtpServer",
+      "gotoFloppyEnable", "gotoCdromEnable", "cn", "gotoSndModule",
+      "ghCpuType", "ghMemSize","ghUsbSupport",
+      "ghGfxAdapter", "ghSoundAdapter", "gotoLastUser");
+  var $objectclasses= array("top", "gotoTerminal", "GOhard");
+
+  var $mapActions   = array("reboot"          => "",
+                            "instant_update"  => "softupdate",
+                            "update"          => "sceduledupdate",
+                            "reinstall"       => "install",
+                            "rescan"          => "",
+                            "memcheck"        => "memcheck",
+                            "sysinfo"         => "sysinfo");
+
+  var $fai_activated = FALSE;
+  var $view_logged = FALSE;
+
+  var $member_of_ogroup = FALSE;
+
+  function termgeneric (&$config, $dn= NULL, $parent= NULL)
+  {
+    /* Check if FAI is activated */
+    $tmp= $config->search("faiManagement", "CLASS",array('menu','tabs'));
+    if(!empty($tmp)){
+      $this->fai_activated = TRUE;
+    }
+
+    plugin::plugin ($config, $dn, $parent);
+
+    if(!isset($this->parent->by_object['ogroup'])){
+      $ldap = $this->config->get_ldap_link();
+      $ldap->cd ($this->config->current['BASE']);
+      $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".$this->dn."))",array("cn"));
+      $this->member_of_ogroup = $ldap->count() >= 1;
+    }
+
+    $this->netConfigDNS = new termDNS($this->config,$this,$this->objectclasses);
+    /* Read arrays */
+    foreach (array("ghNetNic", "ghIdeDev", "ghScsiDev") as $val){
+      if (!isset($this->attrs[$val])){
+        continue;
+      }
+      for ($i= 0; $i<$this->attrs[$val]['count']; $i++){
+        array_push($this->$val, $this->attrs[$val][$i]);
+      }
+    }
+
+    /* Create used ntp server array */
+    $this->gotoNtpServer= array();
+    if(isset($this->attrs['gotoNtpServer'])){
+      $this->inheritTimeServer = false;
+      unset($this->attrs['gotoNtpServer']['count']);
+      foreach($this->attrs['gotoNtpServer'] as $server){
+        $this->gotoNtpServer[$server] = $server;
+      }
+    }
+
+    /* Set inherit checkbox state */
+    if((in_array("default",$this->gotoNtpServer)) || (count($this->gotoNtpServer)==0)){
+      $this->inheritTimeServer = true;
+      $this->gotoNtpServer=array();
+    }
+
+    /* You can't inherit the NTP service, if we are not member in an object group */
+    if(!$this->member_of_ogroup){
+      $this->inheritTimeServer = FALSE;
+    }
+
+    /* Create available ntp options */
+    $this->gotoNtpServers = $this->config->data['SERVERS']['NTP'];
+    foreach($this->gotoNtpServers as $key => $server){
+      if($server == "default"){
+        unset($this->gotoNtpServers[$key]);
+      }
+    }
+
+    $this->modes["disabled"]= _("disabled");
+    $this->modes["text"]= _("text");
+    $this->modes["graphic"]= _("graphic");
+
+    /* Set base */
+    if ($this->dn == "new"){
+      $ui= get_userinfo();
+      $this->base= dn2base($ui->dn);
+    } else {
+      $this->base= preg_replace ("/^[^,]+,[^,]+,[^,]+,/", "", $this->dn);
+    }
+
+    /* Create an array of all Syslog servers */
+    $tmp = $this->config->data['SERVERS']['SYSLOG'];
+    foreach($tmp as $server){
+      $visible = $server;
+      if($server == "default" && $this->member_of_ogroup) {
+        $visible = "["._("inherited")."]";
+      }
+      $this->gotoSyslogServers[$server] = $visible;
+    }
+
+    $this->orig_dn= $this->dn;
+  }
+
+  function set_acl_base($base)
+  {
+    plugin::set_acl_base($base);
+    $this->netConfigDNS->set_acl_base($base);
+  }
+
+  function set_acl_category($cat)
+  {
+    plugin::set_acl_category($cat);
+    $this->netConfigDNS->set_acl_category($cat);
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","terminal/".get_class($this),$this->dn);
+    }
+
+    /* Do we need to flip is_account state? */
+    if (isset($_POST['modify_state'])){
+      $this->is_account= !$this->is_account;
+    }
+
+    if (isset($_POST['action']) && $this->acl_is_writeable("FAIstate")){
+
+      /* Set FAIstate */
+      if($this->fai_activated && $this->dn != "new"){
+        $ldap = $this->config->get_ldap_link();
+        $ldap->cd($this->config->current['BASE']);
+        $ldap->cat($this->dn,array("objectClass"));
+        $res = $ldap->fetch();
+
+        $attrs = array();
+        $attrs['FAIstate'] = "";
+        if(isset($this->mapActions[$_POST['saction']])){
+          $attrs['FAIstate'] = $this->mapActions[$_POST ['saction']];
+        }
+
+        for($i = 0; $i < $res['objectClass']['count'] ; $i ++){
+          $attrs['objectClass'][] = $res['objectClass'][$i];
+        }
+
+        if(($attrs['FAIstate'] != "") && (!in_array("FAIobject",$attrs['objectClass']))){
+          $attrs['objectClass'][] = "FAIobject";
+        }
+
+        if($attrs['FAIstate'] == ""){
+#FIXME we should check if FAIobject is used anymore
+          $attrs['FAIstate'] = array();
+        }
+
+        $ldap->cd($this->dn);
+        $ldap->modify($attrs);
+        show_ldap_error($ldap->get_error(), sprintf(_("Saving of system terminal/generic (FAIstate) with dn '%s' failed."),$this->dn));
+      }
+
+      switch($_POST['saction']){
+        case 'wake':
+          $cmd= $this->config->search("termgeneric", "WAKECMD",array('tabs'));
+
+          if ($cmd == ""){
+            print_red(_("No WAKECMD definition found in your gosa.conf"));
+          } else {
+            exec ($cmd." ".$this->netConfigDNS->macAddress, $dummy, $retval);
+            if ($retval != 0){
+              print_red(sprintf(_("Execution of '%s' failed!"), $cmd));
+            }
+          }
+          break;
+
+        case 'reboot':
+          $cmd= $this->config->search("termgeneric", "REBOOTCMD",array('tabs'));
+          if ($cmd == ""){
+            print_red(_("No REBOOTCMD definition found in your gosa.conf"));
+          } else {
+            exec ($cmd." ".$this->cn, $dummy, $retval);
+            if ($retval != 0){
+              print_red(sprintf(_("Execution of '%s' failed!"), $cmd));
+            }
+          }
+          break;
+
+        case 'halt':
+          $cmd= $this->config->search("termgeneric", "HALTCMD",array('tabs'));
+          if ($cmd == ""){
+            print_red(_("No HALTCMD definition found in your gosa.conf"));
+          } else {
+            exec ($cmd." ".$this->cn, $dummy, $retval);
+            if ($retval != 0){
+              print_red(sprintf(_("Execution of '%s' failed!"), $cmd));
+            }
+          }
+          break;
+      }
+    }
+
+    /* Base select dialog */
+    $once = true;
+    foreach($_POST as $name => $value){
+      if(preg_match("/^chooseBase/",$name) && $once && $this->acl_is_moveable()){
+        $once = false;
+        $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
+        $this->dialog->setCurrentBase($this->base);
+      }
+    }
+
+    /* Dialog handling */
+    if(is_object($this->dialog)){
+      /* Must be called before save_object */
+      $this->dialog->save_object();
+
+      if($this->dialog->isClosed()){
+        $this->dialog = false;
+      }elseif($this->dialog->isSelected()){
+
+        /* A new base was selected, check if it is a valid one */
+        $tmp = $this->get_allowed_bases();
+        if(isset($tmp[$this->dialog->isSelected()])){
+          $this->base = $this->dialog->isSelected();
+        }
+        $this->dialog= false;
+      }else{
+        return($this->dialog->execute());
+      }
+    }
+
+    /* Do we represent a valid terminal? */
+    if (!$this->is_account && $this->parent === NULL){
+      $display= "<img alt=\"\" src=\"images/stop.png\" align=middle>&nbsp;<b>".
+        _("This 'dn' has no terminal features.")."</b>";
+      return($display);
+    }
+
+    /* Add new ntp Server to our list */
+    if((isset($_POST['addNtpServer'])) && (isset($_POST['gotoNtpServers'])) && $this->acl_is_writeable("gotoNtpServer")){
+      $this->gotoNtpServer[$_POST['gotoNtpServers']] = $_POST['gotoNtpServers'];
+    }
+
+    /* Delete selected NtpServer for list of used servers  */
+    if((isset($_POST['delNtpServer'])) && (isset($_POST['gotoNtpServerSelected'])) && $this->acl_is_writeable("gotoNtpServer")){
+      foreach($_POST['gotoNtpServerSelected'] as $name){
+        unset($this->gotoNtpServer[$name]);
+      } 
+    }
+
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+    
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+    $smarty->assign("cn", $this->cn);
+    $smarty->assign("staticAddress", "");
+
+    $smarty->assign("bases", $this->get_allowed_bases());
+
+    /* tell smarty the inherit checkbox state */
+    $smarty->assign("inheritTimeServer",$this->inheritTimeServer);
+
+    /* Check if terminal is online */
+    $query= "fping -q -r 1 -t 500 ".$this->cn;
+    exec ($query, $dummy, $retval);
+
+    /* Offline */
+    if ($retval == 0){
+      $smarty->assign("actions", array( "halt" => _("Switch off"), 
+                                        "reboot" => _("Reboot"),
+                                        "memcheck" => _("Memory test"),
+                                        "sysinfo"  => _("System analysis")));
+    } else {
+      $smarty->assign("actions", array("wake" => _("Wake up"),
+                                       "memcheck" => _("Memory test"),
+                                       "sysinfo"  => _("System analysis")));
+    }
+
+    /* Arrays */
+    $smarty->assign("modes", $this->modes);
+
+    $tmp2 = array(); 
+    foreach($this->config->data['SERVERS']['NFS'] as $server){
+      if($server != "default"){
+        $tmp2[$server]= $server;
+      }else{
+        if($this->member_of_ogroup){
+          $tmp2[$server]="["._("inherited")."]";
+        }
+      }
+    }
+  
+    $smarty->assign("nfsservers",     $tmp2);
+    $smarty->assign("syslogservers",  $this->gotoSyslogServers);
+
+    $tmp = array();
+    foreach($this->gotoNtpServers as $server){
+      if(!in_array($server,$this->gotoNtpServer)){
+        $tmp[$server] = $server;
+      }
+    }
+    
+    $smarty->assign("ntpservers",     $tmp);
+    $smarty->assign("fai_activated",$this->fai_activated);
+
+    /* Variables */
+    foreach(array("base", "gotoMode", "gotoTerminalPath", "gotoSwapServer","gotoSyslogServer", "gotoNtpServer") as $val){
+      $smarty->assign($val."_select", $this->$val);
+    }
+
+    $smarty->assign("member_of_ogroup",$this->member_of_ogroup);
+
+    /* Show main page */
+    $str = $this->netConfigDNS->execute();
+    if(is_object($this->netConfigDNS->dialog)){
+      return($str);
+    }
+    $smarty->assign("netconfig", $str);
+    return($smarty->fetch (get_template_path('terminal.tpl', TRUE)));
+  }
+
+  function remove_from_parent()
+  {
+    if($this->acl_is_removeable()){   
+      $ldap= $this->config->get_ldap_link();
+      $ldap->cd($this->dn);
+      $ldap->cat($this->dn, array('dn'));
+      if($ldap->count()){
+        $this->netConfigDNS->remove_from_parent();
+        $ldap->rmDir($this->dn);
+  
+        new log("remove","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+  
+        show_ldap_error($ldap->get_error(), sprintf(_("Removing of object system terminal/generic with dn '%s' failed."),$this->dn));
+
+        /* Optionally execute a command after we're done */
+        $this->handle_post_events("remove",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
+
+        /* Delete references to object groups */
+        $ldap->cd ($this->config->current['BASE']);
+        $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
+        while ($ldap->fetch()){
+          $og= new ogroup($this->config, $ldap->getDN());
+          unset($og->member[$this->dn]);
+          $og->save ();
+        }
+      }
+    }
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    /* Create a base backup and reset the
+       base directly after calling plugin::save_object();
+       Base will be set seperatly a few lines below */
+    $base_tmp = $this->base;
+    plugin::save_object();
+    $this->base = $base_tmp;
+
+    /* Set new base if allowed */
+    $tmp = $this->get_allowed_bases();
+    if(isset($_POST['base'])){
+      if(isset($tmp[$_POST['base']])){
+        $this->base= $_POST['base'];
+      }
+    }
+    
+    $this->netConfigDNS->save_object();
+
+    /* Save terminal path to parent since it is used by termstartup, too */
+    if(isset($this->parent->by_object['termstartup'])){
+      $this->parent->by_object['termstartup']->gotoTerminalPath= $this->gotoTerminalPath;
+    }
+    
+    if(isset($_POST['termgeneric_posted'])){
+      if(isset($_POST["inheritTimeServer"]) && $this->member_of_ogroup){
+        $this->inheritTimeServer = true;
+      }else{
+        $this->inheritTimeServer = false;
+      }
+    }  
+
+    if(isset($_POST["inheritAll"])){
+      $this->set_everything_to_inherited();
+    }
+
+  }
+
+
+  /* Check supplied data */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    /* Skip IP & Mac checks if this is a template */
+    if($this->cn != "default"){
+      $message= array_merge($message, $this->netConfigDNS->check());
+    }
+
+    /* Permissions for that base? */
+    $this->dn= "cn=".$this->cn.",ou=terminals,ou=systems,".$this->base;
+
+    if ($this->cn == ""){
+      $message[]= _("The required field 'Terminal name' is not set.");
+    }
+
+    /* Check if given name is a valid host/dns name */
+    if(!is_dns_name($this->cn) ){
+      $message[] = _("Please specify a valid name for this object.");
+    }
+
+    if ($this->orig_dn == 'new'){
+      $ldap= $this->config->get_ldap_link();
+      $ldap->cd ($this->base);
+
+      /* It is possible to have a 'default' terminal on every base */
+      if($this->cn == "default"){
+        $ldap->cat($this->dn);
+      }else{
+        $ldap->search ("(&(objectClass=gotoTerminal)(cn=".$this->cn."))", array("cn"));
+      }
+      if ($ldap->count() != 0){
+        while ($attrs= $ldap->fetch()){
+          if (preg_match("/cn=dhcp,/",$attrs['dn']) || preg_match ("/,ou=incoming,/", $ldap->getDN())){
+            continue;
+          } else {
+            if ($attrs['dn'] != $this->orig_dn){
+              $message[]= sprintf (_("There is already an entry '%s' in the base choosen by you"), $this->cn);
+              break;
+            }
+          }
+        }
+      }
+    }
+
+    /* Check for valid ntpServer selection */
+    if((!$this->inheritTimeServer) && (!count($this->gotoNtpServer))){
+      $message[]= _("There must be at least one NTP server selected, or the inherit mode activated.");
+    }
+
+    return ($message);
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+
+    /* Move object if requested */
+    if( $this->orig_dn != 'new' && $this->dn != $this->orig_dn){
+      $this->move($this->orig_dn, $this->dn);
+    }
+
+    plugin::save();
+
+    /* Strip out 'default' values */
+    foreach (array("gotoTerminalPath", "gotoSwapServer", "gotoSyslogServer") as $val){
+      if(isset($this->attrs[$val])){
+        if ($this->attrs[$val] == "default"){
+          $this->attrs[$val]= array();
+        }
+      }
+    }
+
+    /* Add missing arrays */
+    foreach (array("ghScsiDev", "ghIdeDev", "ghNetNic") as $val){
+      if (isset ($this->$val) && count ($this->$val) != 0){
+        $this->attrs["$val"]= $this->$val;
+      }
+    }
+
+    /* Remove all empty values */
+    if ($this->orig_dn == 'new'){
+      $attrs= array();
+      foreach ($this->attrs as $key => $val){
+        if (is_array($val) && count($val) == 0){
+          continue;
+        }
+        $attrs[$key]= $val;
+      }
+      $this->attrs= $attrs;
+    }
+
+    /* Set ntpServers */
+    $this->attrs['gotoNtpServer'] = array();
+    if(!$this->inheritTimeServer){
+      foreach($this->gotoNtpServer as $server){
+        $this->attrs['gotoNtpServer'][] = $server;
+      }
+    }
+
+    /* Append gosaAdministrativeUnitTag to objectClass if gosaUnitTag isset */
+    if(($this->gosaUnitTag) && (!in_array_ics("gosaAdministrativeUnitTag",$this->attrs['objectClass']))){
+      $this->attrs['objectClass'][] = "gosaAdministrativeUnitTag";
+    }
+
+    /* Write back to ldap */
+    $ldap= $this->config->get_ldap_link();
+    if ($this->orig_dn == 'new'){
+      $ldap->cd($this->config->current['BASE']);
+      $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
+      $ldap->cd($this->dn);
+      if (!count($this->attrs['gotoNtpServer'])){
+        unset($this->attrs['gotoNtpServer']);
+      }
+      $ldap->add($this->attrs);
+      new log("create","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+      $this->handle_post_events("add",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
+    } else {
+      $ldap->cd($this->dn);
+      $this->cleanup();
+      $ldap->modify ($this->attrs); 
+      new log("modify","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+      $this->handle_post_events("modify",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
+    }
+    
+    /* cn=default and macAddress=- indicates that this is a template */
+    if($this->cn == "default"){
+      $this->netConfigDNS->macAddress = "-";
+    }
+
+    $this->netConfigDNS->cn = $this->cn;
+    $this->netConfigDNS->save();
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of object system terminal/generic with dn '%s' failed."),$this->dn));
+  }
+
+
+
+
+
+  /* Display generic part for server copy & paste */
+  function getCopyDialog()
+  {
+    $vars = array("cn");
+    $smarty = get_smarty();
+    $smarty->assign("cn" ,$this->cn);
+    $smarty->assign("object","terminal");
+    $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE));
+    $ret = array();
+    $ret['string'] = $str;
+    $ret['status'] = "";
+    return($ret);
+  }
+
+
+  function saveCopyDialog()
+  {
+    if(isset($_POST['cn'])){
+      $this->cn = $_POST['cn'];
+    }
+  }
+
+
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);
+    if(isset($source['macAddress'][0])){
+      $this->netConfigDNS->macAddress = $source['macAddress'][0];
+    }
+    if(isset($source['ipHostNumber'][0])){
+      $this->netConfigDNS->ipHostNumber = $source['ipHostNumber'][0];
+    }
+
+    /* Create used ntp server array */
+    $this->gotoNtpServer= array();
+    if(isset($source['gotoNtpServer'])){
+      $this->inheritTimeServer = false;
+      unset($source['gotoNtpServer']['count']);
+      foreach($source['gotoNtpServer'] as $server){
+        $this->gotoNtpServer[$server] = $server;
+      }
+    }
+
+    /* Set inherit checkbox state */
+    if((in_array("default",$this->gotoNtpServer)) || (count($this->gotoNtpServer)==0)){
+      $this->inheritTimeServer = true;
+      $this->gotoNtpServer=array();
+    }
+  }
+
+
+  /* Return plugin informations for acl handling */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Terminal"),
+          "plDescription" => _("Terminal generic"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 1,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("terminal" => array( "description"  => _("Terminal"),
+                                                        "objectClass"  => "gotoTerminal")),
+          "plProvidedAcls"=> array(
+            "gotoMode"            => _("Mode"),
+            "gotoTerminalPath"    => _("Root server"),
+            "gotoSwapServer"      => _("Swap server"),
+            "gotoSyslogServer"    => _("Syslog server enabled"),
+            "gotoNtpServer"       => _("Ntp server settings"),
+            "base"                => _("Base"),
+            "cn"                  => _("Name"),
+            "gotoRootPasswd"      => _("Root password"),
+            "FAIstate"            => _("Action flag"))
+          ));
+  }
+
+
+  function set_everything_to_inherited()
+  {
+    $this->gotoTerminalPath  = "default";
+    $this->gotoSwapServer    = "default" ;
+    $this->gotoSyslogServer  = "default";
+    $this->inheritTimeServer = TRUE;
+
+    /* Set workstation service attributes to inherited */
+    if($this->member_of_ogroup && isset($this->parent->by_object['termservice'])){
+      foreach(array("gotoXKbLayout","gotoXKbModel","gotoXKbVariant",
+            "gotoXResolution","gotoXColordepth","gotoXMouseType","gotoXMouseport") as $name){
+        $this->parent->by_object['termservice']->$name = "default";
+      }
+    }
+
+    /* Set workstation startup attributes to inherited */
+    if($this->member_of_ogroup && isset($this->parent->by_object['termstartup'])){
+      $this->parent->by_object['termstartup']->gotoBootKernel = "default-inherited";
+      $this->parent->by_object['termstartup']->gotoLdapServer = "default-inherited";
+    }
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/systems/class_terminalInfo.inc b/gosa-core/plugins/admin/systems/class_terminalInfo.inc
new file mode 100644 (file)
index 0000000..0a21884
--- /dev/null
@@ -0,0 +1,255 @@
+<?php
+
+class terminfo extends plugin
+{
+  /* CLI vars */
+  var $cli_summary= "Retrieve informations about terminals";
+  var $cli_description= "Some longer text\nfor help";
+  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* Generic terminal attributes */
+  var $ghCpuType= "-";
+  var $ghMemSize= "-";
+  var $macAddress= "-";
+  var $ghUsbSupport= "-";
+  var $ghNetNic= array();
+  var $ghIdeDev= array();
+  var $ghScsiDev= array();
+  var $ghGfxAdapter= "-";
+  var $ghSoundAdapter= "-";
+  var $ghInventoryNumber= "-";
+  var $gotoLastUser= "-";
+  var $gotoFloppyEnable= "";
+  var $gotoCdromEnable= "";
+
+  /* Needed values and lists */
+  var $base= "";
+  var $cn= "";
+  var $view_logged = FALSE;
+
+  /* attribute list for save action */
+  var $ignore_account= TRUE;
+  var $attributes= array("cn", "gotoMode", "gotoTerminalPath", "gotoFloppyEnable",
+      "gotoCdromEnable", "ghInventoryNumber",
+      "gotoSwapServer", "gotoSyslogServer", "gotoNtpServer",
+      "ghCpuType", "ghMemSize", "macAddress", "ghUsbSupport",
+      "ghGfxAdapter", "ghSoundAdapter", "gotoLastUser");
+  var $objectclasses= array("GOhard");
+
+  function terminfo (&$config, $dn= NULL, $parent= NULL)
+  {
+    plugin::plugin ($config,$dn);
+
+    /* Read arrays */
+    foreach (array("ghNetNic", "ghIdeDev", "ghScsiDev") as $val){
+      if (!isset($this->attrs[$val])){
+        continue;
+      }
+      for ($i= 0; $i<$this->attrs[$val]['count']; $i++){
+        array_push($this->$val, $this->attrs[$val][$i]);
+      }
+    }
+
+    /* Fix USB entry */
+    if ($this->ghUsbSupport == "true"){
+      $this->ghUsbSupport= _("present");
+    }
+  }
+
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","terminal/".get_class($this),$this->dn);
+    }
+
+    /* Do we represent a valid terminal? */
+    if (!$this->is_account && $this->parent === NULL){
+      echo "<img alt=\"\" src=\"images/stop.png\" align=middle>&nbsp;<b>".
+        _("This 'dn' has no terminal features.")."</b>";
+      return;
+    }
+
+    $smarty= get_smarty();
+    $display= "";
+    if(!is_callable("snmpget")){
+      print_red(_("There is no php snmp module installed, can't gather any informations."));
+
+      $smarty->assign("load", progressbar(0,100,15,true));
+      $smarty->assign("mem", progressbar(0,100,15,true));
+      $smarty->assign("swap", progressbar(0,100,15,true));
+      foreach(array("uptime", "sshd", "X", "saned", "artsd", "cupsd","status","ghNetNic", "ghIdeDev", "ghScsiDev","FloppyDevice", "CdromDevice","active") as $val){
+        $smarty->assign("$val", "<i>"._("unknown status")."</i>");
+      }
+
+
+      $display ="";
+    }else
+      /* Default entry? */
+      if ($this->cn == "default"){
+        $display= "<div style='height:150px;'><br><b>";
+        $display.= _("This is a virtual terminal which has no properties to show here.");
+        $display.= "</b></div>";
+      } else {
+
+        /* Get template object */
+        $smarty->assign("staticAddress", "");
+
+        /* Prevent undefined variable .... */ 
+        $smarty->assign("load", progressbar(0,100,15,true));
+        $smarty->assign("mem", progressbar(0,100,15,true));
+        $smarty->assign("swap", progressbar(0,100,15,true));
+
+        /* Check if terminal is online */
+        $query= "fping -q -r 1 -t 500 ".$this->cn;
+        exec ($query, $dummy, $retval);
+
+        if ($retval == 0){
+          $smarty->assign("status", _("online"));
+          $smarty->assign("active", "true");
+
+          /* Fill data if we have snmp */
+          $host= $this->cn;
+
+          /* Use 'goto' as snmp community or the configured value from the config */
+          $community= 'goto';
+          $str = search_config($this->config->data['TABS'],"terminfo","SNMPCOMMUNITY");
+          if(!empty($str)){
+            $community = $str;
+          }
+
+          /* Get memory informations */
+          if(!is_callable("snmpget")){
+            $MemFree = false;
+          }else{
+            $MemFree= @snmpget($host, $community, "UCD-SNMP-MIB::memory.memAvailReal.0");
+          }
+          if ($MemFree != FALSE){
+            $MemFree= preg_replace('/^.*[=:] ([0-9.]+)$/', '\\1', $MemFree);
+            $MemTotal= @snmpget($host, $community, "UCD-SNMP-MIB::memory.memTotalReal.0");
+            $MemTotal= preg_replace('/^.*[=:] ([0-9.]+)$/', '\\1', $MemTotal);
+            if ($MemTotal != 0){
+              $smarty->assign("mem",progressbar( (int)(($MemTotal - $MemFree)*100/$MemTotal),100,15,true));
+              ;
+            }
+            $SwapFree= @snmpget($host, $community, "UCD-SNMP-MIB::memory.memAvailSwap.0");
+            $SwapFree= preg_replace('/^.*[=:] ([0-9.]+)$/', '\\1', $SwapFree);
+            $SwapTotal= @snmpget($host, $community, "UCD-SNMP-MIB::memory.memTotalSwap.0");
+            $SwapTotal= preg_replace('/^.*[=:] ([0-9.]+)$/', '\\1', $SwapTotal);
+            if ($SwapTotal != 0){
+#$smarty->assign("swap", (int)(($SwapTotal - $SwapFree)*100/$SwapTotal));
+              $smarty->assign("swap", progressbar(0,100,15,true));
+            }
+
+            /* Get system uptime */
+            $sysup= @snmpget($host, $community, "SNMPv2-MIB::sysUpTime.0");
+            $smarty->assign("uptime", preg_replace('/^.* ([0-9:]+)\..*$/', '\\1', $sysup));
+
+            /* Get system load */
+            $sysload= @snmpget($host, $community, "UCD-SNMP-MIB::laLoad.2");
+            $sysload= preg_replace('/^.*[=:] ([0-9.]+)$/', '\\1', $sysload);
+
+            $smarty->assign("load", progressbar($sysload*100,100,15,true));
+
+            /* Get status for key processes */
+            $processes= @snmpwalk($host, $community, "UCD-SNMP-MIB::prNames");
+            $check4= array("sshd", "cupsd", "artsd", "X", "saned");
+            foreach ($check4 as $pname){
+              $eflag= -1;
+              foreach ($processes as $key => $val){
+                $process= preg_replace('/^.*[:=] (.*)$/', '\\1', $val);
+                if ($process == $pname){
+                  $index= preg_replace('/^.*\.([0-9]+) [:=] .*$/', '\\1', $val);
+                  $res= @snmpget($host, $community, "UCD-SNMP-MIB::prErrorFlag.$index");
+                  $eflag= preg_replace('/^.*[:=] /', '', $res);
+                  break;
+                }
+              }
+              switch ($eflag){
+                case 0:
+                  $smarty->assign("$pname", "<img alt=\""._("running")."\" src=\"images/true.png\">");
+                  break;
+                case 1:
+                  $smarty->assign("$pname", "<img alt=\""._("not running")."\" src=\"images/false.png\">");
+                  break;
+                default:
+                  $smarty->assign("$pname", _("not defined"));
+              }
+            }
+          } else {
+            foreach(array("uptime", "sshd", "X", "saned", "artsd", "cupsd") as $val){
+              $smarty->assign("$val", "<i>"._("unknown status")."</i>");
+            }
+          }
+          /* Check for mounted partitions (show max 8 partitions) */
+          $partitions= "";
+          for ($n= 1; $n<9; $n++){
+            $device= @snmpget($host, $community, "UCD-SNMP-MIB::dskDevice.$n");
+            if ($device == ""){
+              break;
+            }
+            $device= preg_replace('/^STRING: */', '', $device);
+            $usage= @snmpget($host, $community, "UCD-SNMP-MIB::dskPercent.$n");
+            $usage= preg_replace('/^INTEGER: */', '', $usage);
+            $partitions.= "<tr><td><b>$device</b></td><td>".progressbar($usage,100,16,true)."</td></tr>\n";
+          }
+          $smarty->assign("partitions", $partitions);
+        } else {
+          $smarty->assign("status", _("offline"));
+          $smarty->assign("active", "false");
+        }
+
+        /* Set floppy and cdrom status */
+        foreach(array("Floppy", "Cdrom") as $val){
+          $name= "goto".$val."Enable";
+          if ($this->$name == "YES"){
+            $status= _("present");
+          } else {
+            $status= "-";
+          }
+          $smarty->assign($val."Device", $status);
+        }
+
+        /* Show main page */
+        foreach(array("ghNetNic", "ghIdeDev", "ghScsiDev") as $val){
+          if (!count($this->$val)){
+            $this->$val= "-";
+          }
+          $smarty->assign($val, $this->$val);
+        }
+      }
+      foreach(array("ghCpuType", "ghMemSize", "macAddress", "ghUsbSupport",
+            "ghGfxAdapter", "ghSoundAdapter", "gotoLastUser", "ghInventoryNumber") as $val){
+
+        $smarty->assign($val, $this->$val);
+      }
+      $display= $smarty->fetch (get_template_path('info.tpl', TRUE));
+
+    return ($display);
+  }
+
+  function remove_from_parent()
+  {
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    plugin::save_object();
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+  }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/systems/class_terminalService.inc b/gosa-core/plugins/admin/systems/class_terminalService.inc
new file mode 100644 (file)
index 0000000..49f8046
--- /dev/null
@@ -0,0 +1,527 @@
+<?php
+
+class termservice extends plugin
+{
+  /* CLI vars */
+  var $cli_summary= "Manage terminal service aspects";
+  var $cli_description= "Some longer text\nfor help";
+  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* Generic terminal attributes */
+  var $gotoLpdEnable= FALSE;
+  var $gotoXMonitor= "";
+  var $gotoXMethod= "";
+  var $gotoXdmcpServer= "";
+  var $gotoFontPath= "";
+  var $gotoXDriver= "";
+  var $gotoXResolution= "";
+  var $gotoXColordepth= "";
+  var $gotoXHsync= "";
+  var $gotoXVsync= "";
+  var $gotoXKbModel= "";
+  var $gotoXKbLayout= "";
+  var $gotoXKbVariant= "";
+  var $gotoXMouseType= "";
+  var $gotoXMouseport= "";
+  var $gotoLpdServer= "";
+  var $gotoScannerEnable= "";
+  var $gotoScannerModel= "";
+  var $gotoScannerClients= "";
+  var $gotoScannerBackend= "";
+  var $goFonHardware= "automatic";
+
+  var $AutoSync = false;
+  var $view_logged = FALSE;
+
+  /* Needed values and lists */
+  var $ignore_account= TRUE;
+  var $base= "";
+  var $cn= "";
+  var $orig_dn= "";
+  var $XMethods= array();
+  var $XDrivers= array();
+  var $XResolutions= array();
+  var $XColordepths= array();
+  var $XKbModels= array ();
+  var $XKbLayouts= array ();
+  var $XKbVariants= array ();
+  var $MouseTypes= array();
+  var $MousePorts= array();
+  var $gotoScannerModels= array();
+  var $hardware_list= array();
+  var $used_hardware= array();
+
+
+  /* attribute list for save action */
+  var $attributes= array("cn", "gotoLpdEnable", "gotoXMonitor", "gotoXMethod", "gotoXdmcpServer",
+      "gotoFontPath", "gotoXDriver", "gotoXResolution", "gotoXColordepth",
+      "gotoXHsync", "gotoXVsync", "gotoLpdEnable", "gotoLpdServer",
+      "gotoScannerEnable", "gotoScannerModel", "gotoScannerClients",
+      "gotoScannerBackend", "gotoXKbModel", "gotoXKbLayout", "gotoXKbVariant",
+      "gotoXMouseType", "gotoXMouseport", "goFonHardware");
+  var $objectclasses= array("GOhard");
+
+
+  function termservice (&$config, $dn= NULL, $parent= NULL)
+  {
+    plugin::plugin ($config, $dn, $parent);
+   
+    /* Get list of available xdrivers */
+    $this->XDrivers = $this->getListOfXDrivers();
+    array_unshift($this->XDrivers, "["._("unknown")."]");
+    
+    $this->XResolutions= array(
+        "default"   =>  "["._("inherited")."]"  ,
+        "640x480"   =>  "640x480",
+        "800x600"   =>  "800x600",
+        "1024x768"  =>  "1024x768",
+        "1152x864"  =>  "1152x864",
+        "1280x1024" =>  "1280x1024",
+        "1400x1050" =>  "1400x1050",
+        "1600x1200" =>  "1600x1200");
+
+    if(isset($this->config->data['MAIN']['RESOLUTION_HOOK'])){
+      $file = $this->config->data['MAIN']['RESOLUTION_HOOK'];
+
+      if(is_readable($file)){
+        $str = file_get_contents($file);
+        $lines = split("\n",$str);
+        foreach($lines as $line){
+          $line = trim($line);
+          if(!empty($line)){
+            $this->XResolutions[$line]=$line;
+          }
+        }
+        //natcasesort($this->gotoXResolutions);
+      }else{
+        print_red(sprintf(_("You have specified an external resolution hook which can't be read, please check the permission of the file '%s'."),$file));
+      }
+    }
+
+    $this->XColordepths= array(
+        "default"  => "["._("inherited")."]",
+        "8"        => "8 " ._("bit"),
+        "15"       => "15 "._("bit"),
+        "16"       => "16 "._("bit"),
+        "24"       => "24 "._("bit"));
+
+    $this->XKbModels['default']= "["._("inherited")."]";
+    foreach(array ("btc9000", "chicony", "compaq", "dell", "dell101", "everex",
+          "flexpro", "geniuscomfy", "hp", "itouch", "jp106", "logicordless",
+          "logiinetnav", "logiinternet", "macintosh", "microsoft",
+          "microsoftpro", "omnikey101", "pc101", "pc102", "pc104",
+          "pc105", "rapidaccess", "rapidaccess2", "winbook") as $type){
+      $this->XKbModels[$type] = $type;
+    }
+
+    /* Additional values will be extracted from CONFIG_DIR.keyboardLayouts */
+    $this->XKbLayouts= array ("default"=>"["._("inherited")."]","de"=> "de","intl" =>"intl","us" =>"us");
+    $this->XKbVariants= array ("default"=>"["._("inherited")."]", "nodeadkeys"=>"nodeadkeys", "basic"=>"basic");
+
+    $this->MouseTypes= array( "AUTO"      =>  "["._("inherited")."]" ,  "ImPS/2"      => "ImPS/2", 
+                              "PS/2"      =>  "PS/2"                 ,  "Microsoft"   => "Microsoft", 
+                              "Logitech"  =>  "Logitech");
+
+    $this->MousePorts= array("AUTO"             =>"["._("inherited")."]"   , "/dev/ttyS0"  => "/dev/ttyS0", 
+                             "/dev/ttyS1"       => "/dev/ttyS1"            , "/dev/psaux"  => "/dev/psaux", 
+                             "/dev/input/mice"  =>"/dev/input/mice");
+
+    /* try to read additional keyboard layouts
+     */
+    if(file_exists(CONFIG_DIR."/keyboardLayouts")){
+      if(is_readable(CONFIG_DIR."/keyboardLayouts")){
+        $str = file_get_contents(CONFIG_DIR."/keyboardLayouts");
+        $tmp = split("\n",$str);
+        foreach($tmp as $entry){
+          if((!empty($entry)) && (!preg_match("/^#/",$entry))){
+            $entry = trim($entry);
+            $tmp2 = split ("\:",$entry);
+            $la =   trim($tmp2[0]);   // What would be saved to ldap
+            $da =   trim($tmp2[1]);   // This wis displayed in the listbox
+            $this->XKbLayouts [ $la] = $da;
+          }
+        }
+      }
+    }
+
+    /* Load scanner models */
+    $fcontents = file ($this->config->basedir."/include/scanner.inc");
+    while (list ($line_num, $line) = each ($fcontents)) {
+      preg_match('/^(\w+) "([^"]+)" "([^"]+)" "([^"]+)"/', "$line", $matches);
+      $this->gotoScannerModels[$matches[2]." - ".$matches[3]]= $matches[1]."|".$matches[4];
+    }
+    ksort ($this->gotoScannerModels);
+
+    /* Initialize methods */
+    $this->XMethods["default"]= _("default");
+    $this->XMethods["indirect"]= _("show chooser");
+    $this->XMethods["query"]= _("direct");
+#$this->XMethods["squery"]= _("direct via ssh");
+#$this->XMethods["nquery"]= _("direct via nx");
+    $this->XMethods["load"]= _("load balanced");
+#$this->XMethods["sload"]= _("load balanced via ssh");
+#$this->XMethods["nload"]= _("load balanced via nx");
+    $this->XMethods["rdp"]= _("Windows RDP");
+    $this->XMethods["citrix"]= _("ICA client");
+
+    $this->orig_dn= $this->dn;
+
+    /* Load hardware list */
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(objectClass=goFonHardware)", array('cn', 'description'));
+    while ($attrs= $ldap->fetch()){
+      $cn= $attrs['cn'][0];
+      if (isset($attrs['description'])){
+        $description= " - ".$attrs['description'][0];
+      } else {
+        $description= "";
+      }
+      $this->hardware_list[$cn]= "$cn$description";
+    }
+
+    /* Eventually colorize phones */
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(goFonHardware=*)",array('cn','dn','goFonHardware'));
+    while($attrs = $ldap->fetch()){
+        $cn = $attrs['goFonHardware'][0];
+        if(isset($this->hardware_list[$cn])){
+          $this->used_hardware[$cn]= $cn;
+        }
+    }
+
+    $this->hardware_list["automatic"]= _("automatic");
+    ksort($this->hardware_list);
+
+    /* Convert gotoLpdEnable */
+    $this->gotoLpdEnable= preg_match("/yes/i",$this->gotoLpdEnable);
+
+    /* Load hardware list */
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".$this->dn."))");
+    if ($ldap->count() == 1){
+      $map= array("gotoXResolution", "gotoXColordepth", "gotoXKbModel", "gotoXKbLayout",
+                  "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport");
+      $attrs= $ldap->fetch();
+
+      foreach ($map as $name){
+        if (!isset($attrs[$name][0])){
+          continue;
+        }
+
+        switch ($name){
+          case 'gotoXResolution':
+            $this->XResolutions['default'] = _("inherited").' ['.$attrs[$name][0].']' ;
+            break;
+          case 'gotoXColordepth':
+            $this->XColordepths['default'] =  _("inherited").' ['.$attrs[$name][0].' '._('Bit').']';
+            break;
+          case 'gotoXKbModel':
+            $this->XKbModels['default'] =  _("inherited").' ['.$attrs[$name][0].']';
+            break;
+          case 'gotoXKbLayout':
+            $this->XKbLayouts['default'] =  _("inherited").' ['.$attrs[$name][0].']';
+            break;
+          case 'gotoXKbVariant':
+            $this->XKbVariants['default'] = _("inherited").' ['.$attrs[$name][0].']' ;
+            break;
+          case 'gotoXMouseType':
+            $this->MouseTypes['AUTO'] = _("inherited").' ['.$attrs[$name][0].']' ;
+            break;
+          case 'gotoXMouseport':
+            $this->MousePorts['AUTO'] = _("inherited").' ['.$attrs[$name][0].']' ;
+            break;
+        }
+      }
+    }
+    if(preg_match("/\+/",$this->gotoXHsync)){
+      $this->AutoSync = true;
+      $this->gotoXHsync = preg_replace("/\+/","-",$this->gotoXHsync);
+      $this->gotoXVsync = preg_replace("/\+/","-",$this->gotoXVsync);
+    }
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","terminal/".get_class($this),$this->dn);
+    }
+
+    /* Do we need to flip is_account state? */
+    if (isset($_POST['modify_state'])){
+      $this->is_account= !$this->is_account;
+    }
+
+    /* Do we represent a valid terminal? */
+    if (!$this->is_account && $this->parent === NULL){
+      $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\">&nbsp;<b>".
+        _("This 'dn' has no terminal features.")."</b>";
+      return ($display);
+    }
+
+    /* Show main page */
+    $smarty= get_smarty();
+
+    /* Assign acls */
+    $tmp= $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+
+    /* Arrays */ 
+    foreach(array("XMethods", "XDrivers", "XResolutions", "XColordepths",
+          "gotoScannerModels", "XKbModels","XKbVariants",
+          "MouseTypes", "MousePorts") as $val){
+      $smarty->assign("$val", $this->$val);
+    }
+    $smarty->assign("XKbLayouts",   $this->XKbLayouts);
+    $smarty->assign("XKbLayoutKeys",array_flip($this->XKbLayouts));
+  
+    $smarty->assign("xdmcpservers", $this->config->data['SERVERS']['TERMINAL']);
+    $smarty->assign("fontservers", $this->config->data['SERVERS']['FONT']);
+    $smarty->assign("nfsservers", $this->config->data['SERVERS']['NFS']);
+    $smarty->assign("nfsservers", $this->config->data['SERVERS']['NFS']);
+
+    /* Variables - select */
+    foreach(array("gotoXMethod", "gotoXdmcpServer", "gotoFontPath", 
+          "gotoXDriver", "gotoXResolution", "gotoXColordepth", 
+          "gotoLpdServer", "gotoScannerModel", "gotoXKbModel", "gotoXKbLayout",
+          "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport") as $val){
+
+      $smarty->assign($val."_select", $this->$val);
+    }
+
+    /* Variables */
+    foreach(array("gotoXHsync", "gotoXVsync") as $val){
+      $smarty->assign($val, $this->$val);
+    }
+    $smarty->assign("staticAddress", "");
+
+    /* Checkboxes */
+    foreach(array("gotoLpdEnable", "gotoScannerEnable") as $val){
+      if ($this->$val == TRUE) {
+        $smarty->assign("$val", "checked");
+      } else {
+        $smarty->assign("$val", "");
+      }
+    }
+
+    /* Phone stuff */
+    $smarty->assign ("goFonHardware", $this->goFonHardware);
+    $hl= "<select size=\"1\" name=\"goFonHardware\" title=\"".
+         _("Choose the phone located at the current terminal")."\" >\n";
+    foreach ($this->hardware_list as $cn => $description){
+      if ($cn == $this->goFonHardware){
+        $selected= "selected";
+      } else {
+        $selected= "";
+      }
+      if (isset($this->used_hardware[$cn])){
+        $color= "style=\"color:#A0A0A0\"";
+      } else {
+        $color= "";
+      }
+      $hl.= "  <option $color label=\"$cn\" value=\"$cn\" $selected>$description</option>\n";
+    }
+    $hl.= "</select>\n";
+    $smarty->assign ("hardware_list", $hl);
+    $smarty->assign ("gotoXMonitor", $this->gotoXMonitor);
+
+    $smarty->assign("AutoSyncACL",$this->getacl("AutoSync"));
+
+    $smarty->assign("AutoSyncCHK"," ");
+    if($this->AutoSync){
+      $smarty->assign("AutoSyncCHK"," checked ");
+      $smarty->assign("gotoXVsyncACL", preg_replace("/w/","",$this->getacl("gotoXVsync")));
+      $smarty->assign("gotoXHsyncACL", preg_replace("/w/","",$this->getacl("gotoXHsync")));
+    }
+
+    /* Show main page */
+    return($smarty->fetch (get_template_path('terminalService.tpl', TRUE)));
+  }
+
+  function remove_from_parent()
+  {
+    new log("remove","terminal/".get_class($this),$this->dn,array_keys($this->attrs));
+    $this->handle_post_events("remove");
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    plugin::save_object();
+
+    /* Save checkbox state */
+    if (isset ($_POST['gotoXMethod'])){
+      foreach (array("gotoLpdEnable", "gotoScannerEnable") as $val){
+
+        if($this->acl_is_writeable($val)){
+          if (!isset ($_POST["$val"])){
+            $this->$val= FALSE;
+          } else {
+            $this->$val= TRUE;
+          }
+        }
+      }
+    } 
+
+    if(isset($_POST['gotoXDriver'])){
+      if(isset($_POST['AutoSync'])){
+        $this->AutoSync = true;
+      }else{
+        $this->AutoSync = false;
+      }
+    }
+
+    /* Default entries can use blank hsync/vsync entries */
+    if ($this->dn != "" && $this->cn != "default" && $this->cn != "default"){
+
+      /* But only if no auto sync is enabled... */
+      if (!$this->AutoSync){
+
+        /* Check vsync for correct usage */
+        $val= preg_replace ("/\s/", "", $this->gotoXVsync);
+        if (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val) && $this->acl_is_writeable("gotoXVsync")){
+
+          $message[]= _("Please specify a valid VSync range.");
+        } elseif ($this->acl_is_writeable("gotoXVsync")){
+          list($v1,$v2)= preg_split ("/[-+]/", $val);
+          if ($v2 != ""){
+            if ($v1 > $v2){
+              $message[]= _("Please specify a valid VSync range.");
+            }
+          }
+        }
+
+        /* Check hsync for correct usage */
+        $val= preg_replace ("/\s/", "", $this->gotoXHsync);
+        if (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val) && $this->acl_is_writeable("gotoXHsync")){
+
+          $message[]= _("Please specify a valid HSync range.");
+        } elseif ($this->acl_is_writeable("gotoXHsync")){
+          list($v1,$v2)= preg_split ("/[-+]/", $val);
+          if ($v2 != ""){
+            if ($v1 > $v2){
+              $message[]= _("Please specify a valid HSync range.");
+            }
+          }
+        }
+      }
+    }
+  }
+
+
+  /* Check supplied data */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+    return ($message);
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    /* Convert to string */
+    $this->gotoLpdEnable= $this->gotoLpdEnable?"Yes":"No";
+
+    plugin::save();
+
+    /* Strip out 'default' values */
+    foreach(array("gotoXMethod", "gotoXdmcpServer", "gotoFontPath",
+          "gotoXDriver", "gotoXResolution", "gotoXColordepth",
+          "gotoLpdServer", "gotoScannerModel", "gotoXKbModel", "gotoXKbLayout",
+          "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport") as $val){
+
+      if ($this->attrs[$val] == "default"){
+        $this->attrs[$val]= array();
+      }
+    }
+
+    if($this->AutoSync){
+      $this->attrs['gotoXHsync'] = "30+55";
+      $this->attrs['gotoXVsync'] = "50+70";
+    }
+
+    /* Write back to ldap */
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd($this->dn);
+    $this->cleanup();
+    $ldap->modify ($this->attrs); 
+    new log("modify","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of object system terminal/service with dn '%s' failed."),$this->dn));
+    $this->handle_post_events("modify");
+  }
+
+
+  function getListOfXDrivers()
+  {
+    $drivers = array();
+
+    /* Generate a list of xdrivers from CONFIG_DIR/xdrivers */
+    if (file_exists(CONFIG_DIR.'/xdrivers')){
+      $xdrivers = file (CONFIG_DIR.'/xdrivers');
+      foreach ($xdrivers as $line){
+        if (!preg_match ("/^#/", $line)){
+          $drivers[]= trim($line);
+        }
+      }
+    } else {
+      $drivers = array("ati", "atimisc", "chips", "cirrus", "cyrix", "fbdev", "fglrx",
+          "i128", "i740", "i810", "imstt", "mga", "neomagic", "newport", "nsc",  "nv", "nvidia",
+          "r128", "radeon", "rendition", "s3", "s3virge", "savage", "siliconmotion",
+          "sis", "tdfx", "tga", "trident", "tseng", "vesa", "vga", "vmware");
+    }
+    return($drivers);
+  }
+
+
+  /* Return plugin informations for acl handling */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Service"),
+          "plDescription" => _("Terminal service"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 3,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("terminal"),
+
+          "plProvidedAcls"=> array(
+            "gotoXMonitor"            => _("Monitor"),
+            "gotoXMethod"             => _("Method"),
+            "gotoXdmcpServer"         => _("Remote desktop"),
+            "gotoFontPath"            => _("Font path"),
+            "gotoXDriver"             => _("Gfx driver"),
+            "gotoXResolution"         => _("Gfx resolution"),
+            "gotoXColordepth"         => _("Gfx color depth"),
+            "gotoXHsync"              => _("Hsync"),
+            "gotoXVsync"              => _("Vsync"),
+            "AutoSync"                => _("Auto-Sync"),
+            "gotoLpdEnable"           => _("Printer service enabled"),
+            "gotoLpdServer"           => _("Spool server"),
+            "gotoScannerEnable"       => _("Scanner enabled"),
+            "gotoScannerModel"        => _("Scanner model"),
+            "gotoXKbModel"            => _("Keyboard model"),
+            "gotoXKbLayout"           => _("Keyboard layout"),
+            "gotoXKbVariant"          => _("Keyboard variant"),
+            "gotoXMouseType"          => _("Mouse type"),
+            "gotoXMouseport"          => _("Mouse port"),
+            "goFonHardware"           => _("Telephone hardware"))
+          ));
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/systems/class_terminalStartup.inc b/gosa-core/plugins/admin/systems/class_terminalStartup.inc
new file mode 100644 (file)
index 0000000..0174459
--- /dev/null
@@ -0,0 +1,582 @@
+<?php
+class termstartup extends plugin
+{
+  /* CLI vars */
+  var $cli_summary= "Manage terminal startup options";
+  var $cli_description= "Some longer text\nfor help";
+  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* Generic terminal attributes */
+  var $bootmode= "G";
+  var $goLdapServerList= array();
+  var $gotoBootKernel= "default-inherit";
+  var $gotoKernelParameters= "";
+  var $gotoLdapServer= "";
+  var $gotoModules= array();
+  var $gotoTerminalPath= "";
+  var $gotoBootKernels= array();
+
+  /* Ldap server list */
+  var $gotoLdapServers    = array();
+  var $gotoLdapServerList = array();
+  var $gotoLdap_inherit   = FALSE;
+
+  /* Share */
+  var $gotoShares         = array();// Currently Share Option
+  var $gotoShare          = "";     // currently selected Share Option
+  var $gotoShareSelections= array();// Available Shares for this account in Listbox format
+  var $gotoAvailableShares= array();// Available Shares for this account
+
+
+  /* attribute list for save action */
+  var $attributes= array("gotoLdapServer", "gotoBootKernel", "gotoKernelParameters","gotoModules");
+  var $objectclasses= array("GOhard");
+  var $view_logged = FALSE;
+
+  /* Helper */
+  var $customParameters= "";
+  var $orig_dn= "";
+  var $ignore_account= TRUE;
+
+  function termstartup (&$config, $dn= NULL, $parent= NULL)
+  {
+    plugin::plugin ($config, $dn, $parent);
+
+    $this->gotoBootKernels = array("default-inherit"=>"["._("inherited")."]");
+
+    /* Get arrays */
+    foreach (array("gotoModules") as $val){
+      $this->$val = array();
+      if (isset($this->attrs["$val"]["count"])){
+        for ($i= 0; $i<$this->attrs["count"]; $i++){
+          if (isset($this->attrs["$val"][$i])){
+            array_push($this->$val, $this->attrs["$val"][$i]);
+          }
+        }
+      }
+      sort ($this->$val);
+      $this->$val= array_unique($this->$val);
+    }
+
+    /* Parse Kernel Parameters to decide what boot mode is enabled */
+    if (preg_match("/ splash=silent/", $this->gotoKernelParameters)){
+      $this->bootmode= "G";
+    } elseif (preg_match("/ debug/", $this->gotoKernelParameters)){
+      $this->bootmode= "D";
+    } elseif ($this->gotoKernelParameters == "") {
+      $this->bootmode= "G";
+    } else {
+      $this->bootmode= "T";
+    }
+    if (preg_match("/ o /", $this->gotoKernelParameters)){
+      $this->customParameters= preg_replace ("/^.* o /", "", $this->gotoKernelParameters);
+    } else {
+      $this->customParameters= "";
+    }
+
+    /* Prepare Shares */
+    if((isset($this->attrs['gotoShare']))&&(is_array($this->attrs['gotoShare']))){
+      unset($this->attrs['gotoShare']['count']);
+      foreach($this->attrs['gotoShare'] as $share){
+        $tmp = $tmp2 = array();
+        $tmp = split("\|",$share);
+        $tmp2['server']      =$tmp[0];
+        $tmp2['name']        =$tmp[1];
+        $tmp2['mountPoint']  =$tmp[2];
+        $this->gotoShares[$tmp[1]."|".$tmp[0]]=$tmp2;
+      }
+    }
+
+    $this->gotoShareSelections= $config->getShareList(true);
+    $this->gotoAvailableShares= $config->getShareList(false);
+
+    $this->orig_dn= $this->dn;
+
+    /* Get list of boot kernels */
+    if (isset($this->config->data['TABS'])){
+      $command= $this->config->search(get_class($this), "KERNELS",array('tabs'));
+
+      if (!check_command($command)){
+        $message[]= sprintf(_("Command '%s', specified as KERNELS hook for plugin '%s' doesn't seem to exist."), $command,
+            get_class($this));
+      } else {
+        $fh= popen($command, "r");
+        while (!feof($fh)) {
+          $buffer= trim(fgets($fh, 256));
+          
+          if(!empty($buffer)){
+          
+            $name=$value = $buffer;
+
+            if(preg_match("/:/",$buffer)){
+              $name = preg_replace("/:.*$/","",$buffer);
+              $value= preg_replace("/^.*:/","",$buffer);
+              $this->gotoBootKernels[$name]= $name.":".$value;
+            }else{
+              $this->gotoBootKernels[$name]= $value;
+            }
+          }
+        }
+        pclose($fh);
+      }
+
+    }
+    
+    foreach($this->config->data['SERVERS']['LDAP'] as $server) {
+      $this->gotoLdapServerList[]= $server;
+    }
+    if(isset($this->attrs['gotoLdapServer'])){
+      unset($this->attrs['gotoLdapServer']['count']);
+      sort($this->attrs['gotoLdapServer']);
+      foreach($this->attrs['gotoLdapServer'] as $value){
+        $this->gotoLdapServers[] = preg_replace("/^[0-9]*:/","",$value);
+      }
+    }
+    if(!count($this->gotoLdapServers)){
+      $this->gotoLdap_inherit = TRUE;
+    }
+
+    /* Load hardware list */
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".$this->dn."))");
+    if ($ldap->count() == 1){
+      $map= array("gotoLdapServer");
+      $attrs= $ldap->fetch();
+
+      foreach ($map as $name){
+        if (!isset($attrs[$name][0])){
+          continue;
+        }
+
+        switch ($name){
+          case 'gotoLdapServer':
+            $this->goLdapServerList= array_merge(array('default-inherit' => _("inherited").' ['.$attrs[$name][0].']' ), $this->goLdapServerList);
+            break;
+        }
+      }
+    }
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","terminal/".get_class($this),$this->dn);
+    }
+
+    /* Do we need to flip is_account state? */
+    if (isset($_POST['modify_state'])){
+      $this->is_account= !$this->is_account;
+    }
+
+    /* Do we represent a valid terminal? */
+    if (!$this->is_account && $this->parent === NULL){
+      $display= "<img alt=\"\" src=\"images/stop.png\" align=middle>&nbsp;<b>".
+        _("This 'dn' has no terminal features.")."</b>";
+      return ($display);
+    }
+
+    /* Add module */
+    if (isset ($_POST['add_module'])){
+      if ($_POST['module'] != "" && $this->acl_is_writeable("gotoMode")){
+        $this->add_list ($this->gotoModules, $_POST['module']);
+      }
+    }
+
+    /* Delete module */
+    if (isset ($_POST['delete_module'])){
+      if (count($_POST['modules_list']) && $this->acl_is_writeable("gotoMode")){
+        $this->del_list ($this->gotoModules, $_POST['modules_list']);
+      }
+    }
+
+    /* Show main page */
+    $smarty= get_smarty();
+
+    /* Assign acls */
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+
+       /* In this section server shares will be defined
+     * A user can select one of the given shares and a mount point
+     *  and attach this combination to his setup.
+     */
+    $smarty->assign("gotoShareSelections",    $this->gotoShareSelections);
+    $smarty->assign("gotoShareSelectionKeys", array_flip($this->gotoShareSelections));
+    $smarty->assign("gotoBootKernels",$this->gotoBootKernels);
+
+    /* if $_POST['gotoShareAdd'] is set, we will try to add a new entry
+     * This entry will be, a combination of mountPoint and sharedefinitions
+     */
+    if(isset($_POST['gotoShareAdd']) && $this->acl_is_writeable("gotoShare")){
+      /* We assign a share to this user, if we don't know where to mount the share */
+      if((!isset($_POST['gotoShareMountPoint']))||(empty($_POST['gotoShareMountPoint']))||(preg_match("/[\|]/i",$_POST['gotoShareMountPoint']))){
+        print_red(_("You must specify a valid mount point."));
+      }else{
+        $a_share = $this->gotoAvailableShares[$_POST['gotoShareSelection']];
+        $s_mount = $_POST['gotoShareMountPoint'];
+        /* Preparing the new assignment */
+        $this->gotoShares[$a_share['name']."|".$a_share['server']]=$a_share;
+        $this->gotoShares[$a_share['name']."|".$a_share['server']]['mountPoint']=$s_mount;
+      }
+    }
+
+    /* if the Post  gotoShareDel is set, someone asked GOsa to delete the selected entry (if there is one selected)
+     * If there is no defined share selected, we will abort the deletion without any message
+     */
+    if((isset($_POST['gotoShareDel']))&&(isset($_POST['gotoShare'])) && $this->acl_is_writeable("gotoShare")){
+      unset($this->gotoShares[$_POST['gotoShare']]);
+    }
+
+    $smarty->assign("gotoShares",$this->printOutAssignedShares());
+    $smarty->assign("gotoShareKeys",array_flip($this->printOutAssignedShares()));
+
+    /* Create divSelectBox for ldap server selection
+     */
+    $SelectBoxLdapServer = new divSelectBox("LdapServer");
+    $SelectBoxLdapServer->SetHeight(80);
+
+ /* Add new ldap server to the list */
+    if(!$this->gotoLdap_inherit && isset($_POST['add_ldap_server']) && isset($_POST['ldap_server_to_add'])){
+      if(isset($this->gotoLdapServerList[$_POST['ldap_server_to_add']])){
+        $to_add = $this->gotoLdapServerList[$_POST['ldap_server_to_add']];
+        if(!in_array($to_add,$this->gotoLdapServers)){
+          $this->gotoLdapServers[] = $to_add;
+        }
+      }
+    }
+
+    /* Move ldap servers up and down */
+    if(!$this->gotoLdap_inherit){
+      foreach($_POST as $name => $value){
+        if(preg_match("/sort_ldap_up_/",$name)){
+          $id = preg_replace("/^sort_ldap_up_([0-9]*)_(x|y)$/","\\1",$name);
+          $from =  $id;
+          $to   =  $id -1;
+          $tmp = $this->array_switch_item($this->gotoLdapServers,$from,$to);
+          if($tmp){
+            $this->gotoLdapServers = $tmp;
+          }
+          break;
+        }
+        if(preg_match("/sort_ldap_down_/",$name)){
+          $id = preg_replace("/^sort_ldap_down_([0-9]*)_(x|y)$/","\\1",$name);
+          $from =  $id;
+          $to   =  $id +1;
+          $tmp = $this->array_switch_item($this->gotoLdapServers,$from,$to);
+          if($tmp){
+            $this->gotoLdapServers = $tmp;
+          }
+          break;
+        }
+        if(preg_match("/gotoLdapRemove_/",$name)){
+          $id = preg_replace("/^gotoLdapRemove_([0-9]*)_(x|y)$/","\\1",$name);
+          $value = $this->gotoLdapServers[$id];
+          $this->gotoLdapServers = array_remove_entries(array($value),$this->gotoLdapServers);
+          break;
+        }
+      }
+    }
+  /* Add Entries
+     */
+    foreach($this->gotoLdapServers as $key => $server){
+      if(!in_array($server,$this->gotoLdapServerList)){
+        $server = $server."&nbsp;<font style='color:red'>(missing)</font>";
+      }
+
+      $SelectBoxLdapServer->AddEntry(
+          array(array("string" => $server),
+            array("string" =>
+              "<input class='center' type='image' src='images/sort_up.png' name='sort_ldap_up_".$key."'>&nbsp;".
+              "<input class='center' type='image' src='images/sort_down.png' name='sort_ldap_down_".$key."'>&nbsp;".
+              "<input class='center' type='image' src='images/edittrash.png' name='gotoLdapRemove_".$key."'>",
+              "attach" => "style='text-align:right;width:40px;border-right:0px;'")));
+    }
+
+    if($this->gotoLdap_inherit){
+      $smarty->assign("gotoLdapServerACL_inherit", preg_replace("/w/","",$this->getacl("gotoLdapServer")));;
+    }else{
+      $smarty->assign("gotoLdapServerACL_inherit", $this->getacl("gotoLdapServer"));
+    }
+
+    $list = array();
+    foreach($this->gotoLdapServerList as $key => $entry){
+      if(!in_array($entry,$this->gotoLdapServers)){
+        $list[$key] = $entry;
+      }
+    }
+    $smarty->assign("gotoLdapServers",    $SelectBoxLdapServer->DrawList());
+    $smarty->assign("gotoLdapServerList", $list);
+    $smarty->assign("gotoLdap_inherit",   $this->gotoLdap_inherit);
+    $smarty->assign("JS",  $_SESSION['js']);
+
+    foreach (array("gotoModules" ) as $val){
+      $smarty->assign("$val", $this->$val);
+    }
+
+    /* Values */
+    foreach(array("gotoBootKernel", "customParameters") as $val){
+      $smarty->assign($val, $this->$val);
+    }
+
+    /* Radio button group */
+    if (preg_match("/G/", $this->bootmode)) {
+      $smarty->assign("graphicalbootup", "checked");
+    } else {
+      $smarty->assign("graphicalbootup", "");
+    }
+    if (preg_match("/T/", $this->bootmode)) {
+      $smarty->assign("textbootup", "checked");
+    } else {
+      $smarty->assign("textbootup", "");
+    }
+    if (preg_match("/D/", $this->bootmode)) {
+      $smarty->assign("debugbootup", "checked");
+    } else {
+      $smarty->assign("debugbootup", "");
+    }
+
+    /* Show main page */
+    return($smarty->fetch (get_template_path('terminalStartup.tpl', TRUE)));
+  }
+
+  function remove_from_parent()
+  {
+    if($this->acl_is_removeable()){
+      $this->handle_post_events("remove");
+      new log("remove","terminal/".get_class($this),$this->dn,array_keys($this->attrs));
+    }
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    plugin::save_object();
+
+    if(isset($_POST['TerminalStarttabPosted'])){
+      if(isset($_POST['gotoLdap_inherit'])){
+        $this->gotoLdap_inherit = TRUE;
+      }else{
+        $this->gotoLdap_inherit = FALSE;
+      }
+
+      /* Save group radio buttons */
+      if ($this->acl_is_writeable("bootmode") && isset($_POST["bootmode"])){
+        $this->bootmode= $_POST["bootmode"];
+      }
+
+      /* Save kernel parameters */
+      if ($this->acl_is_writeable("gotoKernelParameters") && isset($_POST["customParameters"])){
+        $this->customParameters= $_POST["customParameters"];
+      }
+    }
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    /* Find proper terminal path for tftp configuration
+       FIXME: This is suboptimal when the default has changed to
+       another location! */
+    if ($this->gotoTerminalPath == "default-inherit"){
+      $ldap= $this->config->get_ldap_link();
+
+      /* Strip relevant part from dn, keep trailing ',' */
+      $tmp= preg_replace("/^cn=[^,]+,ou=terminals,ou=systems,/i", "", $this->dn);
+      $tmp= preg_replace("/".$this->config->current['BASE']."$/i", "", $tmp);
+
+      /* Walk from top to base and try to load default values for
+         'gotoTerminalPath'. Abort when an entry is found. */
+      while (TRUE){
+        $tmp= preg_replace ("/^[^,]+,/", "", $tmp);
+
+        $ldap->cat("cn=default,ou=terminals,ou=systems,$tmp".
+            $this->config->current['BASE'], array('gotoTerminalPath'));
+        $attrs= $ldap->fetch();
+        if (isset($attrs['gotoTerminalPath'])){
+          $this->gotoTerminalPath= $attrs['gotoTerminalPath'][0];
+          break;
+        }
+
+        /* Nothing left? */
+        if ($tmp == ""){
+          break;
+        }
+      }
+    }
+    
+    /* Add semi automatic values */
+    // FIXME: LDAP Server may not be set here...
+    $this->gotoKernelParameters= "root=/dev/nfs nfsroot=".
+      $this->gotoTerminalPath.
+      ",ro,hard,nolock,fg,rsize=8192 ".
+      "ip=::::::dhcp ldap=".base64_encode($this->gotoLdapServer);
+
+    switch ($this->bootmode){
+      case "D":
+        $this->gotoKernelParameters.= " debug";
+      break;
+      case "G":
+        $this->gotoKernelParameters.= " splash=silent";
+      break;
+    }
+    if ($this->customParameters != ""){
+      $this->gotoKernelParameters.= " o ".$this->customParameters;
+    }
+
+    plugin::save();
+
+    /* Add missing arrays */
+    foreach (array("gotoModules") as $val){
+      if (isset ($this->$val) && count ($this->$val) != 0){
+    
+        $this->attrs["$val"]= array_unique($this->$val);
+      }
+      if(!isset($this->attrs["$val"])){
+       $this->attrs["$val"]=array();
+      }
+    }
+
+    /* Prepare list of ldap servers */
+    $this->attrs['gotoLdapServer'] = array();
+    if(!$this->gotoLdap_inherit){
+      $i = 0;
+      foreach($this->gotoLdapServers as $server){
+        $i ++;
+        $this->attrs['gotoLdapServer'][] = $i.":".$server;
+      }
+    }
+
+    /* Strip out 'default' values */
+    foreach(array("gotoBootKernel") as $value){
+      if (!isset($this->attrs[$value]) || $this->attrs[$value] == "default-inherit"){
+        $this->attrs[$value] = array();
+      } 
+    }
+
+     /* prepare share settings */
+    $tmp = array();
+    foreach($this->gotoShares as $name => $settings){
+      $tmp2 = split("\|",$name);
+      $name = $tmp2[0];
+      $tmp[] = $settings['server']."|".$name."|".$settings['mountPoint'];
+    }
+    $this->attrs['gotoShare']=$tmp;
+
+    /* Write back to ldap */
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd($this->dn);
+    
+    $this->cleanup();
+    $ldap->modify ($this->attrs); 
+
+    new log("modify","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of system terminal/startup with dn '%s' failed."),$this->dn));
+    $this->handle_post_events("modify");
+  }
+
+  /* Add value to array, check if unique */
+  function add_list (&$array, $value)
+  {
+    if ($value != ""){
+      $array[]= $value;
+      sort($array);
+      array_unique ($array);
+    }
+  }
+
+
+  /* Delete value to array, check if unique */
+  function del_list (&$array, $list)
+  {
+    $tmp= array();
+    foreach ($array as $mod){
+      if (!in_array($mod, $list)){
+        $tmp[]= $mod;
+      }
+    }
+    $array= $tmp;
+  }
+
+   /* Generate ListBox frindly output for the defined shares
+   * Possibly Add or remove an attribute here,
+   */
+  function printOutAssignedShares()
+  {
+    $a_return = array();
+    if(is_array($this->gotoShares)){
+      foreach($this->gotoShares as $share){
+        $a_return[$share['name']."|".$share['server']]= $share['name']." [".$share['server']."]";
+      }
+    }
+    return($a_return);
+  }
+
+
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);
+
+    $source_o = new termstartup ($this->config, $source['dn']);
+
+    foreach(array("gotoModules", "gotoKernelParameters","gotoShares","customParameters","bootmode","gotoTerminalPath","gotoShares","goLdapServerList","gotoBootKernel","gotoLdapServer","gotoBootKernels") as $attr){
+      $this->$attr = $source_o->$attr;
+    }
+  }
+
+
+  function array_switch_item($ar,$from,$to)
+  {
+    if(!is_array($ar)){
+      return(false);
+    }
+    if(!isset($ar[$from])){
+      return(false);
+    }
+    if(!isset($ar[$to])){
+      return(false);
+    }
+
+    $tmp = $ar[$from];
+    $ar[$from] = $ar[$to];
+    $ar[$to] = $tmp;
+    return($ar);
+  }
+
+
+  /* Return plugin informations for acl handling */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Startup"),
+          "plDescription" => _("Terminal startup"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 5,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("terminal"),
+
+          "plProvidedAcls"=> array(
+            "gotoLdapServer"      => _("Ldap server"),
+            "gotoShare"           => _("Shares"),
+            "gotoModules"         => _("Kernel modules"),
+            "gotoBootKernel"      => _("Boot kernel"), 
+            "gotoKernelParameters"=> _("Kernel parameter"))
+          ));
+  }
+
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/systems/class_winGeneric.inc b/gosa-core/plugins/admin/systems/class_winGeneric.inc
new file mode 100644 (file)
index 0000000..8a15e93
--- /dev/null
@@ -0,0 +1,306 @@
+<?php
+
+class wingeneric extends plugin
+{
+  /* CLI vars */
+  var $cli_summary        = "Manage component base objects";
+  var $cli_description    = "Some longer text\nfor help";
+  var $cli_parameters     = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* Generic terminal attributes */
+  var $interfaces= array();
+
+  /* Needed values and lists */
+  var $base= "";
+  var $cn= "";
+  var $description= "";
+  var $orig_dn= "";
+  var $shadowLastChange="";
+  var $uidNumber="";
+  var $gidNumber="";
+  var $loginShell="";
+  var $gecos="";
+  var $shadowMin="";
+  var $shadowWarning="";
+  var $shadowInactive="";
+  var $uid="";
+  var $sn="";
+  var $givenName="";
+  var $homeDirectory="";
+  var $sambaSID="";
+  var $sambaPrimaryGroupSID="";
+  var $displayName="";
+  var $sambaPwdMustChange="";
+  var $sambaNTPassword="";
+  var $sambaPwdLastSet="";
+  var $sambaAcctFlags="";
+  var $netConfigDNS;
+  /* attribute list for save action */
+  var $ignore_account= TRUE;
+  var $attributes   = array("cn", "description","shadowLastChange",
+                            "uidNumber","gidNumber","loginShell","gecos","shadowMin","shadowWarning",
+                            "shadowInactive","uid","cn","sn","givenName","homeDirectory","sambaSID",
+                            "sambaPrimaryGroupSID","displayName", "sambaPwdMustChange",
+                            "sambaNTPassword","sambaPwdLastSet","sambaAcctFlags");
+  var $objectclasses= array("posixAccount","person","organizationalPerson","inetOrgPerson","gosaAccount","shadowAccount","sambaSamAccount","top");
+
+  var $view_logged = FALSE;
+
+  function wingeneric (&$config, $dn= NULL, $parent= NULL)
+  {
+    plugin::plugin ($config, $dn, $parent);
+    $this->netConfigDNS = new termDNS($this->config,$this,$this->objectclasses);
+    /* Set base */
+    if ($this->dn == "new"){
+      $ui= get_userinfo();
+      $this->base= dn2base($ui->dn);
+      $this->cn= "";
+    } else {
+      $this->base= preg_replace ("/^[^,]+,".normalizePreg(get_winstations_ou())."/", "", $this->dn);
+    }
+
+    /* Save dn for later references */
+    $this->orig_dn= $this->dn;
+
+    $this->cn= preg_replace("/\\\$\$/","",$this->cn);
+  }
+
+
+  function set_acl_base($base)
+  {
+    plugin::set_acl_base($base);
+    $this->netConfigDNS->set_acl_base($base);
+  }
+
+  function set_acl_category($cat)
+  {
+    plugin::set_acl_category($cat);
+    $this->netConfigDNS->set_acl_category($cat);
+  }
+
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","winworkstation/".get_class($this),$this->dn);
+    }
+
+
+    /* Do we represent a valid phone? */
+    if (!$this->is_account && $this->parent === NULL){
+      $display= "<img alt=\"\" src=\"images/stop.png\" align=middle>&nbsp;<b>".
+        _("This 'dn' has no network features.")."</b>";
+      return($display);
+    }
+
+    /* Base select dialog */
+    $once = true;
+    foreach($_POST as $name => $value){
+      if(preg_match("/^chooseBase/",$name) && $once){
+        $once = false;
+        $this->dialog = new baseSelectDialog($this->config,$this);
+        $this->dialog->setCurrentBase($this->base);
+      }
+    }
+
+    /* Dialog handling */
+    if(is_object($this->dialog)){
+      /* Must be called before save_object */
+      $this->dialog->save_object();
+
+      if($this->dialog->isClosed()){
+        $this->dialog = false;
+      }elseif($this->dialog->isSelected()){
+
+        /* A new base was selected, check if it is a valid one */
+        $tmp = $this->get_allowed_bases();
+        if(isset($tmp[$this->dialog->isSelected()])){
+          $this->base = $this->dialog->isSelected();
+        }
+
+        $this->dialog= false;
+      }else{
+        return($this->dialog->execute());
+      }
+    }
+
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+
+    // Undefined index in wingeneric.tpl ... 
+    $smarty->assign("bases", $this->config->idepartments);
+
+    /* Assign attributes */
+    foreach ($this->attributes as $attr){
+      $smarty->assign("$attr", $this->$attr);
+    }
+    
+    $smarty->assign("base_select", $this->base);
+
+    /* Show main page */
+    $str = $this->netConfigDNS->execute();
+    if(is_object($this->netConfigDNS->dialog)){
+      return($str);
+    }
+    $smarty->assign("netconfig", $str);
+    return($smarty->fetch (get_template_path('wingeneric.tpl', TRUE)));
+  }
+
+  function remove_from_parent()
+  {
+    $this->netConfigDNS->remove_from_parent();
+    $ldap= $this->config->get_ldap_link();
+    $ldap->rmdir($this->dn);
+    new log("remove","winworkstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    show_ldap_error($ldap->get_error(), sprintf(_("Removing of system wingeneric/generic with dn '%s' failed."),$this->dn));
+    $this->handle_post_events("remove");
+
+    /* Delete references to object groups */
+    $ldap->cd ($this->config->current['BASE']);
+    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
+    while ($ldap->fetch()){
+      $og= new ogroup($this->config, $ldap->getDN());
+      unset($og->member[$this->dn]);
+      $og->save ();
+    }
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    /* Create a base backup and reset the
+       base directly after calling plugin::save_object();
+       Base will be set seperatly a few lines below */
+    $base_tmp = $this->base;
+    plugin::save_object();
+    $this->base = $base_tmp;
+
+    $this->netConfigDNS->save_object();
+
+    /* Set new base if allowed */
+    $tmp = $this->get_allowed_bases();
+    if(isset($_POST['base'])){
+      if(isset($tmp[$_POST['base']])){
+        $this->base= $_POST['base'];
+      }
+    }
+  }
+
+
+  /* Check supplied data */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+    $message= array_merge($message, $this->netConfigDNS->check());
+    $this->dn= "cn=".$this->cn.",ou=netdevices,ou=systems,".$this->base;
+    
+    /* Set new acl base */
+    if($this->dn == "new") {
+      $this->set_acl_base($this->base);
+    }
+
+    if(!$this->acl_is_createable() && $this->dn == "new"){
+      $message[]= _("You have no permissions to create a component on this 'Base'.");
+    }
+
+    if ($this->orig_dn != $this->dn){
+      $ldap= $this->config->get_ldap_link();
+      $ldap->cd ($this->base);
+      $ldap->search ("(cn=".$this->cn.")", array("cn"));
+      if ($ldap->count() != 0){
+        while ($attrs= $ldap->fetch()){
+          if(preg_match("/cn=dhcp,/",$attrs['dn'])){
+            continue;
+          }
+          if ($attrs['dn'] != $this->orig_dn){
+            $message[]= sprintf (_("There is already an entry '%s' in the base choosen by you"), $this->cn);
+            break;
+          }
+        }
+      }
+    }
+
+    return ($message);
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    plugin::save();
+
+    /* Remove all empty values */
+    if ($this->orig_dn == 'new'){
+      $attrs= array();
+      foreach ($this->attrs as $key => $val){
+        if (is_array($val) && count($val) == 0){
+          continue;
+        }
+        $attrs[$key]= $val;
+      }
+      $this->attrs= $attrs;
+    }
+
+    if(($this->gosaUnitTag) && (!in_array_ics("gosaAdministrativeUnitTag",$this->attrs['objectClass']))){
+      $this->attrs['objectClass'][] = "gosaAdministrativeUnitTag";
+    }
+
+    /* Write back to ldap */
+    $ldap= $this->config->get_ldap_link();
+    if ($this->orig_dn == 'new'){
+      $ldap->cd($this->config->current['BASE']);
+      $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
+      $ldap->cd($this->dn);
+      $ldap->add($this->attrs);
+      new log("create","winworkstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+      $this->handle_post_events("add");
+    } else {
+      if ($this->orig_dn != $this->dn){
+        $this->move($this->orig_dn, $this->dn);
+      }
+
+      $ldap->cd($this->dn);
+      $this->cleanup();
+      $ldap->modify ($this->attrs); 
+      new log("modify","winworkstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+      $this->handle_post_events("modify");
+    }
+
+    $this->netConfigDNS->cn =  preg_replace("/\\\$\$/","",$this->cn);
+    $this->netConfigDNS->save();
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of system wingeneric/generic with dn '%s' failed."),$this->dn));
+
+    /* Optionally execute a command after we're done */
+    $this->postcreate();
+  }
+
+  /* Return plugin informations for acl handling
+  #FIXME FAIscript seams to ununsed within this class... */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Win generic"),
+          "plDescription" => _("Windows workstation generic"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 0,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("winworkstation" => array("description"  => _("Win workstation"),
+                                                          "objectClass"  => "gotoWorkstation")),
+          "plProvidedAcls"=> array(
+            "cn"                  => _("Workstation name"),
+            "description"         => _("Description"))
+          ));
+  }
+
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/systems/class_workstationGeneric.inc b/gosa-core/plugins/admin/systems/class_workstationGeneric.inc
new file mode 100644 (file)
index 0000000..14641c0
--- /dev/null
@@ -0,0 +1,663 @@
+<?php
+
+class workgeneric extends plugin
+{
+  /* CLI vars */
+  var $cli_summary= "Manage workstation base objects";
+  var $cli_description= "Some longer text\nfor help";
+  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* Generic terminal attributes */
+  var $gotoMode= "locked";
+  var $gotoSyslogServer= "";
+  var $gotoSyslogServers= array();
+  var $gotoNtpServer= array();
+  var $gotoNtpServers= array();
+  var $gotoSndModule= "";
+  var $gotoFloppyEnable= "";
+  var $gotoCdromEnable= "";
+  var $ghCpuType= "-";
+  var $ghMemSize= "-";
+  var $ghUsbSupport= "-";
+  var $ghNetNic= array();
+  var $ghIdeDev= array();
+  var $ghScsiDev= array();
+  var $ghGfxAdapter= "-";
+  var $ghSoundAdapter= "-";
+  var $gotoLastUser= "-";
+  var $FAIscript= "";
+  var $didAction= FALSE;
+  var $FAIstate= "";
+  var $view_logged = FALSE;
+
+  /* Needed values and lists */
+  var $base= "";
+  var $cn= "";
+  var $l= "";
+  var $orig_dn= "";
+
+  /* Plugin side filled */
+  var $modes= array();
+
+  var $netConfigDNS;
+
+  var $inheritTimeServer = true;
+
+  /* attribute list for save action */
+  var $ignore_account= TRUE;
+  var $attributes= array("gotoMode", "gotoSyslogServer", "gotoNtpServer",
+      "gotoFloppyEnable", "gotoCdromEnable", "cn", "gotoSndModule",
+      "ghCpuType", "ghMemSize", "ghUsbSupport",
+      "ghGfxAdapter", "ghSoundAdapter", "gotoLastUser", "l","FAIscript");
+  var $objectclasses= array("top", "gotoWorkstation", "GOhard");
+
+  var $mapActions   = array("reboot"          => "",
+                            "localboot"       => "localboot",
+                            "halt"            => "",
+                            "instant_update"  => "softupdate",
+                            "update"          => "scheduledupdate",
+                            "reinstall"       => "install",
+                            "rescan"          => "",
+                            "memcheck"        => "memcheck",
+                            "sysinfo"         => "sysinfo");
+
+  
+  var $fai_activated = FALSE;
+
+  var $member_of_ogroup = FALSE;
+
+  function workgeneric (&$config, $dn= NULL, $parent= NULL)
+  {
+    $tmp= $config->search("faiManagement", "CLASS",array('menu','tabs'));
+    if(!empty($tmp)){
+      $this->fai_activated = TRUE;
+    }
+
+    plugin::plugin ($config, $dn, $parent);
+
+    if(!isset($this->parent->by_object['ogroup'])){
+      $ldap = $this->config->get_ldap_link();
+      $ldap->cd ($this->config->current['BASE']);
+      $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".$this->dn."))",array("cn"));
+      $this->member_of_ogroup = $ldap->count() >= 1;
+    }
+
+    $this->netConfigDNS = new termDNS($this->config,$this,$this->objectclasses);
+
+    /* Read arrays */
+    foreach (array("ghNetNic", "ghIdeDev", "ghScsiDev") as $val){
+      if (!isset($this->attrs[$val])){
+        continue;
+      }
+      for ($i= 0; $i<$this->attrs[$val]['count']; $i++){
+        array_push($this->$val, $this->attrs[$val][$i]);
+      }
+    }
+
+    /* Create used ntp server array */
+    $this->gotoNtpServer= array();
+    if(isset($this->attrs['gotoNtpServer'])){
+      $this->inheritTimeServer = false;
+      unset($this->attrs['gotoNtpServer']['count']);
+      foreach($this->attrs['gotoNtpServer'] as $server){
+        $this->gotoNtpServer[$server] = $server;
+      }
+    }
+
+    /* Set inherit checkbox state */
+    if((in_array("default",$this->gotoNtpServer)) || (count($this->gotoNtpServer) == 0)){
+      $this->inheritTimeServer = true;
+      $this->gotoNtpServer=array();
+    }
+
+    /* You can't inherit the NTP service, if we are not member in an object group */
+    if(!$this->member_of_ogroup){
+      $this->inheritTimeServer = FALSE;
+    }
+
+    /* Create available ntp options */
+    $tmp = $this->config->data['SERVERS']['NTP'];
+    $this->gotoNtpServers = array();
+    foreach($tmp as $key => $server){
+      if($server == "default") continue;
+      $this->gotoNtpServers[$server] = $server;
+    }
+
+    $this->modes["active"]= _("Activated");
+    $this->modes["locked"]= _("Locked");
+
+    /* Set base */
+    if ($this->dn == "new"){
+      $ui= get_userinfo();
+      $this->base= dn2base($ui->dn);
+    } else {
+      $this->base= preg_replace ("/^[^,]+,[^,]+,[^,]+,/", "", $this->dn);
+    }
+
+    /* Create an array of all Syslog servers */
+    $tmp = $this->config->data['SERVERS']['SYSLOG'];
+    foreach($tmp as $server){
+      $visible = $server;
+      if($server == "default" && $this->member_of_ogroup) {
+        $visible = "["._("inherited")."]";
+      }
+      $this->gotoSyslogServers[$server] = $visible;
+    }
+
+    /* Save 'dn' for later referal */
+    $this->orig_dn= $this->dn;
+  }
+
+
+  function set_acl_base($base)
+  {
+    plugin::set_acl_base($base);
+    $this->netConfigDNS->set_acl_base($base);
+  }
+
+  function set_acl_category($cat)
+  {
+    plugin::set_acl_category($cat);
+    $this->netConfigDNS->set_acl_category($cat);
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","workstation/".get_class($this),$this->dn);
+    }
+
+    /* 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;
+      }
+    }
+
+    if ((isset($_POST['action'])) && ($this->acl_is_writeable("FAIstate"))){
+      $cmd= $this->config->search("workgeneric", "ACTIONCMD",array('tabs'));
+      if ($cmd == ""){
+        print_red(_("No ACTIONCMD definition found in your gosa.conf"));
+      } else {
+        exec ($cmd." ".$this->netConfigDNS->macAddress." ".escapeshellarg($_POST['saction']), $dummy, $retval);
+        if ($retval != 0){
+          print_red(sprintf(_("Execution of '%s' failed!"), $cmd));
+        } elseif ($_POST['saction'] != "wake") {
+
+          /* Set FAIstate */
+          if($this->fai_activated && $this->dn != "new"){
+            $ldap = $this->config->get_ldap_link();
+            $ldap->cd($this->config->current['BASE']);
+            $ldap->cat($this->dn,array("objectClass"));
+            $res = $ldap->fetch();
+
+            $attrs = array();
+            $attrs['FAIstate'] = $this->FAIstate;
+            if(isset($this->mapActions[$_POST['saction']]) && $this->mapActions[$_POST['saction']] != ""){
+              $attrs['FAIstate'] = $this->mapActions[$_POST ['saction']];
+            }
+
+            for($i = 0; $i < $res['objectClass']['count'] ; $i ++){
+              $attrs['objectClass'][] = $res['objectClass'][$i];
+            }
+
+            if(($attrs['FAIstate'] != "") && (!in_array("FAIobject",$attrs['objectClass']))){
+              $attrs['objectClass'][] = "FAIobject";
+            }
+
+            if($attrs['FAIstate'] == ""){
+#FIXME we should check if FAIobject is not used anymore
+              $attrs['FAIstate'] = array();
+            }
+
+            $ldap->cd($this->dn);
+            $ldap->modify($attrs);
+            show_ldap_error($ldap->get_error(), sprintf(_("Saving of system workstation/generic (FAIstate) with dn '%s' failed."),$this->dn));
+
+          }
+          $this->didAction= TRUE;
+        }
+      }
+    }
+
+    /* Do we represent a valid terminal? */
+    if (!$this->is_account && $this->parent === NULL){
+      $display= "<img alt=\"\" src=\"images/stop.png\" align=middle>&nbsp;<b>".
+        _("This 'dn' has no workstation features.")."</b>";
+      return($display);
+    }
+
+    /* Base select dialog */
+    $once = true;
+    foreach($_POST as $name => $value){
+      if(preg_match("/^chooseBase/",$name) && $once && $this->acl_is_writeable("base")){
+        $once = false;
+        $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
+        $this->dialog->setCurrentBase($this->base);
+      }
+    }
+
+    /* Dialog handling */
+    if(is_object($this->dialog)){
+      /* Must be called before save_object */
+      $this->dialog->save_object();
+
+      if($this->dialog->isClosed()){
+        $this->dialog = false;
+      }elseif($this->dialog->isSelected()){
+
+        /* A new base was selected, check if it is a valid one */
+        $tmp = $this->get_allowed_bases();
+        if(isset($tmp[$this->dialog->isSelected()])){
+          $this->base = $this->dialog->isSelected();
+        }
+
+        $this->dialog= false;
+      }else{
+        return($this->dialog->execute());
+      }
+    }
+
+    /* Add new ntp Server to our list */ 
+    if((isset($_POST['addNtpServer'])) && (isset($_POST['gotoNtpServers'])) && $this->acl_is_writeable("gotoNtpServer")){
+      $this->gotoNtpServer[$_POST['gotoNtpServers']] = $_POST['gotoNtpServers'];
+    }
+
+    /* Delete selected NtpServer for list of used servers  */
+    if((isset($_POST['delNtpServer'])) && (isset($_POST['gotoNtpServerSelected'])) && $this->acl_is_writeable("gotoNtpServer")){
+      foreach($_POST['gotoNtpServerSelected'] as $name){
+        unset($this->gotoNtpServer[$name]);
+      }
+    }
+
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+
+    /* Set acls */
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+    $smarty->assign("cn", $this->cn);
+    $smarty->assign("l", $this->l);
+    $smarty->assign("bases", $this->get_allowed_bases());
+    $smarty->assign("staticAddress", "");
+
+    $tmp = array();
+    foreach($this->gotoNtpServers as $server){
+      if(!in_array($server,$this->gotoNtpServer)){
+        $tmp[$server] = $server;
+      }
+    }
+    $smarty->assign("gotoNtpServers",$tmp);
+        
+    /* Check if workstation is online */
+    $query= "fping -q -r 1 -t 500 ".$this->cn;
+    exec ($query, $dummy, $retval);
+
+    /* Offline */
+    if ($retval == 0){
+      $smarty->assign("actions", array("halt" => _("Switch off"), "reboot" => _("Reboot"),
+                                       "instant_update" => _("Instant update"),
+                                       "update" => _("Scheduled update"),
+                                       "reinstall" => _("Reinstall"),
+                                       "rescan" => _("Rescan hardware"),
+                                       "memcheck" => _("Memory test"),
+                                       "localboot" => _("Force localboot"),
+                                       "sysinfo"  => _("System analysis")));
+    } else {
+      $smarty->assign("actions", array("wake" => _("Wake up"),
+                                       "reinstall" => _("Reinstall"),
+                                       "update" => _("Scheduled update"),
+                                       "memcheck" => _("Memory test"),
+                                       "localboot" => _("Force localboot"),
+                                       "sysinfo"  => _("System analysis")));
+    }
+    /* Arrays */
+    $smarty->assign("modes", $this->modes);
+    $smarty->assign("nfsservers", $this->config->data['SERVERS']['NFS']);
+    $smarty->assign("syslogservers", $this->gotoSyslogServers);
+    $smarty->assign("fai_activated",$this->fai_activated);
+
+    $ntpser = array();
+    foreach($this->gotoNtpServers as $server){
+      if(!in_array($server,$this->gotoNtpServer)){
+        $ntpser[$server] = $server;
+      }
+    }
+    $smarty->assign("gotoNtpServers", $ntpser);
+
+    /* Variables */
+    foreach(array("base", "gotoMode", "gotoSyslogServer", "gotoNtpServer") as $val){
+      $smarty->assign($val."_select", $this->$val);
+    }
+
+    /* tell smarty the inherit checkbox state */
+    $smarty->assign("inheritTimeServer",$this->inheritTimeServer);
+    $smarty->assign("member_of_ogroup",$this->member_of_ogroup);
+
+    $str = $this->netConfigDNS->execute();
+    if(is_object($this->netConfigDNS->dialog)){
+      return($str);
+    }
+    $smarty->assign("netconfig", $str);
+
+    /* Show main page */
+    return($smarty->fetch (get_template_path('workstation.tpl', TRUE)));
+  }
+
+  function remove_from_parent()
+  {
+    if($this->acl_is_removeable()){
+
+      $this->netConfigDNS->remove_from_parent();
+      $ldap= $this->config->get_ldap_link();
+      $ldap->rmdir($this->dn);
+      new log("remove","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+      show_ldap_error($ldap->get_error(), sprintf(_("Removing of system workstation/generic with dn '%s' failed."),$this->dn));
+
+      /* Optionally execute a command after we're done */
+      $this->handle_post_events("remove", array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
+
+      /* Delete references to object groups */
+      $ldap->cd ($this->config->current['BASE']);
+      $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
+      while ($ldap->fetch()){
+        $og= new ogroup($this->config, $ldap->getDN());
+        unset($og->member[$this->dn]);
+        $og->save ();
+      }
+    }
+
+    if(isset($_POST["inheritAll"])){
+      $this->set_everything_to_inherited();
+    }
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+
+    /* Create a base backup and reset the
+       base directly after calling plugin::save_object();
+       Base will be set seperatly a few lines below */
+    $base_tmp = $this->base;
+    plugin::save_object();
+    $this->base = $base_tmp;
+
+    /* Save base, since this is no LDAP attribute */
+    $tmp = $this->get_allowed_bases();
+    if(isset($_POST['base'])){
+      if(isset($tmp[$_POST['base']])){
+        $this->base= $_POST['base'];
+      }
+    }
+
+    $this->netConfigDNS->save_object();
+
+    /* Set inherit mode */
+    if((isset($_POST['workgeneric_posted'])) && ($this->acl_is_writeable("gotoNtpServer"))){
+      if(isset($_POST["inheritTimeServer"]) && $this->member_of_ogroup){
+        $this->inheritTimeServer = true;
+      }else{
+        $this->inheritTimeServer = false;
+      }
+    }
+    
+    if(isset($_POST["inheritAll"])){
+      $this->set_everything_to_inherited();
+    }
+  }
+
+
+  /* Check supplied data */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+  
+    /* Skip IP & Mac checks if this is a template */
+    if($this->cn != "wdefault"){
+      $message= array_merge($message, $this->netConfigDNS->check());
+    }
+
+    $this->dn= "cn=".$this->cn.",ou=workstations,ou=systems,".$this->base;
+
+    if ($this->cn == ""){
+      $message[]= _("The required field 'Workstation name' is not set.");
+    }
+
+    /* Check if given name is a valid host/dns name */
+    if(!is_dns_name($this->cn)){
+      $message[] = _("Please specify a valid name for this object.");
+    }
+
+    if ($this->orig_dn != $this->dn){
+      $ldap= $this->config->get_ldap_link();
+      $ldap->cd ($this->base);
+
+      if($this->cn == "wdefault"){
+        $ldap->cat($this->dn);
+      }else{
+        $ldap->search ("(&(cn=".$this->cn.")(objectClass=gotoWorkstation))", array("cn"));
+      }
+      if ($ldap->count() != 0){
+        while ($attrs= $ldap->fetch()){
+          if (preg_match("/cn=dhcp,/",$attrs['dn']) || preg_match ("/,ou=incoming,/", $ldap->getDN())){
+            continue;
+          } else {
+            if ($attrs['dn'] != $this->orig_dn){
+              $message[]= sprintf (_("There is already an entry '%s' in the base choosen by you"), $this->cn);
+              break;
+            }
+          }
+        }
+      }
+    }
+
+    /* Check for valid ntpServer selection */
+    if((!$this->inheritTimeServer) && (!count($this->gotoNtpServer))){
+      $message[]= _("There must be at least one NTP server selected, or the inherit mode activated.");
+    }
+
+    return ($message);
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    plugin::save();
+
+    /* Strip out 'default' values */
+    foreach (array("gotoSyslogServer") as $val){
+
+      if (isset($this->attrs[$val]) && $this->attrs[$val] == "default"){
+        $this->attrs[$val]= array();
+      }
+    }
+
+    /* Add missing arrays */
+    foreach (array("ghScsiDev", "ghIdeDev", "ghNetNic") as $val){
+      if (isset ($this->$val) && count ($this->$val) != 0){
+        $this->attrs["$val"]= $this->$val;
+      }
+    }
+
+    /* Remove all empty values */
+    if ($this->orig_dn == 'new'){
+      $attrs= array();
+      foreach ($this->attrs as $key => $val){
+        if (is_array($val) && count($val) == 0){
+          continue;
+        }
+        $attrs[$key]= $val;
+      }
+      $this->attrs= $attrs;
+    }
+
+    /* Update ntp server settings */
+    if($this->inheritTimeServer){
+      if($this->is_new){
+        if(isset($this->attrs['gotoNtpServer'])){
+          unset($this->attrs['gotoNtpServer']);
+        }
+      }else{
+        $this->attrs['gotoNtpServer'] = array();
+      }
+    }else{
+      /* Set ntpServers */
+      $this->attrs['gotoNtpServer'] = array();
+      foreach($this->gotoNtpServer as $server){
+        $this->attrs['gotoNtpServer'][] = $server;
+      }
+    }
+
+    if(($this->gosaUnitTag) && (!in_array_ics("gosaAdministrativeUnitTag",$this->attrs['objectClass']))){
+      $this->attrs['objectClass'][] = "gosaAdministrativeUnitTag";
+    }
+
+    /* Write back to ldap */
+    $ldap= $this->config->get_ldap_link();
+    if ($this->orig_dn == 'new'){
+      $ldap->cd($this->config->current['BASE']);
+      $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
+      $ldap->cd($this->dn);
+      $ldap->add($this->attrs);
+      new log("create","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+      show_ldap_error($ldap->get_error(), sprintf(_("Saving of system workstation/generic with dn '%s' failed."),$this->dn));
+      if(!$this->didAction){
+        $this->handle_post_events("add",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
+      }
+    } else {
+      if ($this->orig_dn != $this->dn){
+        $this->move($this->orig_dn, $this->dn);
+      }
+      $ldap->cd($this->dn);
+      $this->cleanup();
+      $ldap->modify ($this->attrs); 
+      new log("modify","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+
+      if(!$this->didAction){
+        $this->handle_post_events("modify",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
+      }
+    }
+
+    /* cn=default and macAddress=- indicates that this is a template */
+    if($this->cn == "wdefault"){
+      $this->netConfigDNS->macAddress = "-";
+    }
+
+    $this->netConfigDNS->cn = $this->cn;
+    $this->netConfigDNS->save();
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of system workstation/generic with dn '%s' failed."),$this->dn));
+  }
+
+
+  /* Display generic part for server copy & paste */
+  function getCopyDialog()
+  {
+    $vars = array("cn");
+    $smarty = get_smarty();
+    $smarty->assign("cn" ,$this->cn);
+    $smarty->assign("object","workstation");
+    $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE));
+    $ret = array();
+    $ret['string'] = $str;
+    $ret['status'] = "";
+    return($ret);
+  }
+
+
+  function saveCopyDialog()
+  {
+    if(isset($_POST['cn'])){
+      $this->cn = $_POST['cn'];
+    }
+  }
+
+
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);
+    if(isset($source['macAddress'][0])){
+      $this->netConfigDNS->macAddress = $source['macAddress'][0];
+    }
+    if(isset($source['ipHostNumber'][0])){
+      $this->netConfigDNS->ipHostNumber = $source['ipHostNumber'][0];
+    }
+
+    /* Create used ntp server array */
+    $this->gotoNtpServer= array();
+    if(isset($source['gotoNtpServer'])){
+      $this->inheritTimeServer = false;
+      unset($source['gotoNtpServer']['count']);
+      foreach($source['gotoNtpServer'] as $server){
+        $this->gotoNtpServer[$server] = $server;
+      }
+    }
+
+    /* Set inherit checkbox state */
+    if((in_array("default",$this->gotoNtpServer)) || (count($this->gotoNtpServer)==0)){
+      $this->inheritTimeServer = true;
+      $this->gotoNtpServer=array();
+    }
+  }
+
+
+  /* Return plugin informations for acl handling 
+      #FIXME FAIscript seams to ununsed within this class... */ 
+  static function plInfo()
+  {
+    return (array(  
+          "plShortName"   => _("Generic"),
+          "plDescription" => _("Workstation generic"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 0,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("workstation" => array("description"  => _("Workstation"),
+                                                          "objectClass"  => "gotoWorkstation")),
+          "plProvidedAcls"=> array(
+            "cn"                  => _("Workstation name"),
+            "l"                   => _("Location") ,
+            "base"                => _("Base") ,
+            "gotoMode"            => _("Goto mode"), 
+            "gotoSyslogServer"    => _("Syslog server"), 
+            "gotoNtpServer"       => _("Ntp server"), 
+            "gotoRootPasswd"      => _("Root password"),
+            "FAIstate"            => _("Action flag"))
+          ));
+  }
+
+  function set_everything_to_inherited()
+  {
+    $this->gotoSyslogServer  = "default";
+    $this->inheritTimeServer = TRUE;
+
+    /* Set workstation service attributes to inherited */
+    if($this->member_of_ogroup && isset($this->parent->by_object['workservice'])){
+      foreach(array("gotoXKbLayout","gotoXKbModel","gotoXKbVariant",
+            "gotoXResolution","gotoXColordepth","gotoXMouseType","gotoXMouseport") as $name){
+        $this->parent->by_object['workservice']->$name = "default"; 
+      }
+    }
+
+    /* Set workstation startup attributes to inherited */
+    if($this->member_of_ogroup && isset($this->parent->by_object['workstartup'])){
+      $this->parent->by_object['workstartup']->gotoBootKernel = "default-inherited";
+      $this->parent->by_object['workstartup']->gotoLdapServer = "default-inherited";
+      $this->parent->by_object['workstartup']->FAIdebianMirror= "inherited";
+    }
+  }
+}
+  // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/systems/class_workstationService.inc b/gosa-core/plugins/admin/systems/class_workstationService.inc
new file mode 100644 (file)
index 0000000..23698cf
--- /dev/null
@@ -0,0 +1,505 @@
+<?php
+
+class workservice extends plugin
+{
+  /* CLI vars */
+  var $cli_summary= "Manage terminal service aspects";
+  var $cli_description= "Some longer text\nfor help";
+  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  var $gotoScannerEnable;
+  /* Generic terminal attributes */
+  var $gotoXMonitor= "";
+  var $gotoXDriver= "";
+  var $gotoXResolution= "";
+  var $gotoXColordepth= "";
+  var $gotoXHsync= "";
+  var $gotoXVsync= "";
+  var $AutoSync = false;
+  var $gotoXKbModel= "";
+  var $gotoXKbLayout= "";
+  var $gotoXKbVariant= "";
+  var $gotoXMouseType= "";
+  var $gotoXMouseport= "";
+  var $gotoScannerClients= "";
+  var $gotoScannerBackend= "";
+  var $goFonHardware= "automatic";
+  var $view_logged = FALSE;
+
+  /* Needed values and lists */
+  var $ignore_account= TRUE;
+  var $base= "";
+  var $cn= "";
+  var $orig_dn= "";
+  var $XMethods= array();
+  var $XDrivers= array();
+  var $XResolutions = array();
+  var $MouseTypes= array();
+  var $MousePorts= array();
+  var $hardware_list= array();
+  var $used_hardware= array();
+
+
+  /* attribute list for save action */
+  var $attributes= array("gotoXMonitor",
+      "gotoXDriver", "gotoXResolution", "gotoXColordepth",
+      "gotoXHsync", "gotoXVsync",
+      "gotoScannerEnable", "gotoScannerClients",
+      "gotoScannerBackend", "gotoXKbModel", "gotoXKbLayout", "gotoXKbVariant",
+      "gotoXMouseType", "gotoXMouseport", "goFonHardware");
+  var $objectclasses= array("GOhard");
+
+  var $XColordepths     =array();
+  var $XKbModels        =array();
+  var $XKbLayouts       =array();
+  var $XKbVariants      =array();
+
+  function workservice (&$config, $dn= NULL, $parent= NULL)
+  {
+    plugin::plugin ($config, $dn, $parent);
+
+    $this->XResolutions= array( 
+        "640x480"   =>  "640x480",
+        "800x600"   =>  "800x600",
+        "1024x768"  =>  "1024x768",
+        "1152x864"  =>  "1152x864", 
+        "1280x1024" =>  "1280x1024",
+        "1400x1050" =>  "1400x1050", 
+        "1600x1200" =>  "1600x1200");
+
+    if(isset($this->config->data['MAIN']['RESOLUTION_HOOK'])){
+      $file = $this->config->data['MAIN']['RESOLUTION_HOOK'];
+
+      if(is_readable($file)){
+        $str = file_get_contents($file);
+        $lines = split("\n",$str);
+        foreach($lines as $line){
+          $line = trim($line);
+          if(!empty($line)){
+            $this->XResolutions[$line]=$line;
+          }
+        }
+        //natcasesort($this->gotoXResolutions);
+      }else{
+        print_red(sprintf(_("You have specified an external resolution hook which can't be read, please check the permission of the file '%s'."),$file));
+      }
+    }
+
+    /* Get list of available xdrivers */
+    $this->XDrivers = $this->getListOfXDrivers();
+
+    array_unshift($this->XDrivers, "["._("unknown")."]");
+    $this->XColordepths= array( 
+        "8"        => "8 " ._("bit"), 
+        "15"       => "15 "._("bit"),      
+        "16"       => "16 "._("bit"),   
+        "24"       => "24 "._("bit"));
+
+    foreach(array ("btc9000", "chicony", "compaq", "dell", "dell101", "everex",
+          "flexpro", "geniuscomfy", "hp", "itouch", "jp106", "logicordless",
+          "logiinetnav", "logiinternet", "macintosh", "microsoft",
+          "microsoftpro", "omnikey101", "pc101", "pc102", "pc104",
+          "pc105", "rapidaccess", "rapidaccess2", "winbook") as $type){
+      $this->XKbModels[$type] = $type;
+    }
+
+    $this->MouseTypes= array("ImPS/2" => "ImPS/2", "PS/2" => "PS/2", "Microsoft" => "Microsoft", 
+                              "Logitech" => "Logitech");
+
+    $this->MousePorts= array("/dev/ttyS0"  =>"/dev/ttyS0", 
+                             "/dev/ttyS1"       => "/dev/ttyS1",          "/dev/psaux"  =>"/dev/psaux", 
+                             "/dev/input/mice"  => "/dev/input/mice");
+
+    /* Additional values will be extracted from CONFIG_DIR./keyboardLayouts */
+    $this->XKbLayouts= array ("de"=> "de","intl" =>"intl","us" =>"us");
+    $this->XKbVariants= array ("nodeadkeys"=>"nodeadkeys", "basic"=>"basic");
+
+    /* try to read additional keyboard layouts 
+     */
+    if(file_exists(CONFIG_DIR."/keyboardLayouts")){
+      if(is_readable(CONFIG_DIR."/keyboardLayouts")){
+        $str = file_get_contents(CONFIG_DIR."/keyboardLayouts");
+        $tmp = split("\n",$str);
+        foreach($tmp as $entry){
+          if((!empty($entry)) && (!preg_match("/^#/",$entry))){
+            $entry = trim($entry);
+            $tmp2 = split ("\:",$entry);
+            $la =   trim($tmp2[0]);   // What would be saved to ldap
+            $da =   trim($tmp2[1]);   // This wis displayed in the listbox
+            $this->XKbLayouts [ $la] = $da;  
+          } 
+        }
+      }
+    }
+
+    /* Initialize methods */
+    $this->XMethods["indirect"]= _("show chooser");
+    $this->XMethods["query"]= _("direct");
+    #$this->XMethods["squery"]= _("direct via ssh");
+    #$this->XMethods["nquery"]= _("direct via nx");
+    $this->XMethods["load"]= _("load balanced");
+    #$this->XMethods["sload"]= _("load balanced via ssh");
+    #$this->XMethods["nload"]= _("load balanced via nx");
+    $this->XMethods["rdp"]= _("Windows RDP");
+    $this->XMethods["citrix"]= _("ICA client");
+
+    $this->orig_dn= $this->dn;
+
+    /* Load hardware list */
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(objectClass=goFonHardware)", array('cn', 'description'));
+    while ($attrs= $ldap->fetch()){
+      $cn= $attrs['cn'][0];
+      if (isset($attrs['description'])){
+        $description= " - ".$attrs['description'][0];
+      } else {
+        $description= "";
+      }
+      $this->hardware_list[$cn]= "$cn$description";
+    }
+
+    /* Eventually colorize phones */
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(goFonHardware=*)",array('cn','dn','goFonHardware'));
+    while($attrs = $ldap->fetch()){
+        $cn = $attrs['goFonHardware'][0];
+        if(isset($this->hardware_list[$cn])){
+          $this->used_hardware[$cn]= $cn;
+        }
+    }
+
+    if(preg_match("/\+/",$this->gotoXHsync)){
+      $this->AutoSync = true;
+      $this->gotoXHsync = preg_replace("/\+/","-",$this->gotoXHsync);
+      $this->gotoXVsync = preg_replace("/\+/","-",$this->gotoXVsync);
+    }
+
+    $this->hardware_list["automatic"]= _("automatic");
+    ksort($this->hardware_list);
+
+    /* Load hardware list */
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".$this->dn."))");
+    if ($ldap->count() == 1){
+      $map= array("gotoXResolution", "gotoXColordepth", "gotoXKbModel", "gotoXKbLayout",
+                  "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport");
+      $attrs= $ldap->fetch();
+
+      foreach ($map as $name){
+        if (!isset($attrs[$name][0])){
+          continue;
+        }
+        
+        switch ($name){
+          case 'gotoXResolution':
+            $this->XResolutions= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XResolutions;
+            break;
+          case 'gotoXColordepth':
+            $this->XColordepths= array('default' => _("inherited").' ['.$attrs[$name][0].' '._('Bit').']') + $this->XColordepths;
+            break;
+          case 'gotoXKbModel':
+            $this->XKbModels= array('default' => _("inherited").' ['.$attrs[$name][0].']') + $this->XKbModels;
+            break;
+          case 'gotoXKbLayout':
+            $this->XKbLayouts= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XKbLayouts;
+            break;
+          case 'gotoXKbVariant':
+            $this->XKbVariants= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XKbVariants;
+            break;
+          case 'gotoXMouseType':
+            $this->MouseTypes= array('AUTO' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->MouseTypes;
+            break;
+          case 'gotoXMouseport':
+            $this->MousePorts= array('AUTO' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->MousePorts;
+            break;
+        }
+
+      }
+
+    }
+
+    /* Workaround to fill in inherited values if we've specified an objectclass */
+    if (isset($_SESSION['SelectedSystemType']['ogroup']) && $_SESSION['SelectedSystemType']['ogroup'] != 'none'){
+      $this->XResolutions= array('default' => _("inherited"));
+      $this->XColordepths= array('default' => _("inherited"));
+      $this->XKbModels= array('default' => _("inherited"));
+      $this->XKbLayouts= array('default' => _("inherited"));
+      $this->XKbVariants= array('default' => _("inherited"));
+      $this->MouseTypes= array('AUTO' => _("inherited"));
+      $this->MousePorts= array('AUTO' => _("inherited"));
+    }
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","workstation/".get_class($this),$this->dn);
+    }
+
+    /* Do we need to flip is_account state? */
+    if (isset($_POST['modify_state'])){
+      $this->is_account= !$this->is_account;
+    }
+
+    /* 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 main page */
+    $smarty= get_smarty();
+
+    /* Assign ACLs */
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translated){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+    /* Arrays */ 
+    foreach(array("XMethods", "XDrivers", "XResolutions", "XColordepths",
+          "XKbModels", "XKbVariants",
+          "MouseTypes", "MousePorts") as $val){
+      $smarty->assign("$val", $this->$val);
+    }
+    $smarty->assign("XKbLayouts"    ,$this->XKbLayouts);
+    $smarty->assign("XKbLayoutKeys" ,array_flip($this->XKbLayouts));
+
+    $smarty->assign("xdmcpservers", $this->config->data['SERVERS']['TERMINAL']);
+    $smarty->assign("fontservers", $this->config->data['SERVERS']['FONT']);
+    $smarty->assign("nfsservers", $this->config->data['SERVERS']['NFS']);
+    $smarty->assign("nfsservers", $this->config->data['SERVERS']['NFS']);
+
+    /* Variables - select */
+    foreach(array(
+          "gotoXDriver", "gotoXResolution", "gotoXColordepth", 
+          "gotoXKbModel", "gotoXKbLayout","gotoScannerEnable",
+          "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport") as $val){
+
+      $smarty->assign($val."_select", $this->$val);
+    }
+
+    /* Variables */
+    foreach(array("gotoXHsync", "gotoXVsync") as $val){
+      $smarty->assign($val, $this->$val);
+    }
+    $smarty->assign("staticAddress", "");
+
+    /* Checkboxes */
+    foreach(array("gotoScannerEnable") as $val){
+      if ($this->$val == TRUE) {
+        $smarty->assign("$val", "checked");
+      } else {
+        $smarty->assign("$val", "");
+      }
+    }
+
+    /* Phone stuff */
+    $smarty->assign ("goFonHardware", $this->goFonHardware);
+
+    $perms = "";
+    if($this->acl_is_writeable("goFonHardware")){
+      $perms = " disabled ";
+    }
+
+    $hl= "<select size=\"1\" name=\"goFonHardware\" ".$perms." title=\"".
+      _("Choose the phone located at the current terminal")."\" >";
+    foreach ($this->hardware_list as $cn => $description){
+      if ($cn == $this->goFonHardware){
+        $selected= "selected";
+      } else {
+        $selected= "";
+      }
+      if (isset($this->used_hardware[$cn])){
+        $color= "style=\"color:#A0A0A0\"";
+      } else {
+        $color= "";
+      }
+      $hl.= "  <option $color label=\"$cn\" value=\"$cn\" $selected>$description</option>\n";
+    }
+    $hl.= "</select>\n";
+    $smarty->assign ("hardware_list", $hl);
+    $smarty->assign ("gotoXMonitor", $this->gotoXMonitor);
+
+    if($this->AutoSync){
+      $smarty->assign("AutoSyncCHK"," checked ");
+      $smarty->assign("hiddenState"," disabled ");
+    }else{
+      $smarty->assign("AutoSyncCHK"," ");
+      $smarty->assign("hiddenState","");
+    }
+
+    /* Show main page */
+    return($smarty->fetch (get_template_path('workstationService.tpl',TRUE,dirname(__FILE__))));
+  }
+
+  function remove_from_parent()
+  {
+    $this->handle_post_events("remove");
+    new log("remove","workstation/".get_class($this),$this->dn);
+  }
+
+  /* Save data to object */
+  function save_object()
+  {
+    plugin::save_object();
+
+    if((isset($_POST['gotoXDriver'])) && $this->acl_is_writeable("AutoSync")) {
+      if(isset($_POST['AutoSync'])){
+        $this->AutoSync = true;
+      }else{
+        $this->AutoSync = false;
+      }
+    }
+  }
+
+  /* Check supplied data */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    /* Default entries can use blank hsync/vsync entries */
+    if ($this->dn != "" && $this->cn != "default" && $this->cn != "wdefault"){
+
+      /* But only if no auto sync is enabled... */
+      if (!$this->AutoSync){
+
+        /* Check vsync for correct usage */
+        $val= preg_replace ("/\s/", "", $this->gotoXVsync);
+
+        if($this->acl_is_writeable("gotoXVsync")){
+          if (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val)){
+            $message[]= _("Please specify a valid VSync range.");
+          } else{
+            list($v1,$v2)= preg_split ("/[-+]/", $val);
+            if ($v2 != ""){
+              if ($v1 > $v2){
+                $message[]= _("Please specify a valid VSync range.");
+              }
+            }
+          }
+        }
+
+        /* Check hsync for correct usage */
+        $val= preg_replace ("/\s/", "", $this->gotoXHsync);
+        if($this->acl_is_writeable("gotoXHsync")){
+          if (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val)){
+            $message[]= _("Please specify a valid HSync range.");
+          } else{
+            list($v1,$v2)= preg_split ("/[-+]/", $val);
+            if ($v2 != ""){
+              if ($v1 > $v2){
+                $message[]= _("Please specify a valid HSync range.");
+              }
+            }
+          }
+        }
+      }
+    }
+
+    return ($message);
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    /* remove objectclass GOhard if this is an ogroup tab */
+    if(isset($this->parent->by_object['ogroup'])){
+      $this->objectclasses = array();
+    }
+
+    plugin::save();
+
+    /* Strip out 'default' values */
+    foreach(array(
+          "gotoXDriver", "gotoXResolution", "gotoXColordepth",
+          "gotoXKbModel", "gotoXKbLayout",
+          "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport") as $val){
+
+      if ($this->attrs[$val] == "default"){
+        $this->attrs[$val]= array();
+      }
+    }
+
+    if($this->AutoSync){
+      $this->attrs['gotoXHsync'] = "30+55";
+      $this->attrs['gotoXVsync'] = "50+70";
+    }
+
+    /* Write back to ldap */
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd($this->dn);
+    $this->cleanup();
+    $ldap->modify ($this->attrs); 
+    new log("modify","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of system workstation/service with dn '%s' failed."),$this->dn));
+    $this->handle_post_events("modify");
+  }
+
+
+  function getListOfXDrivers()
+  {
+    /* Generate a list of xdrivers from CONFIG_DIR./xdrivers */
+    $drivers = array();
+    if (file_exists(CONFIG_DIR.'/xdrivers')){
+      $xdrivers = file (CONFIG_DIR.'/xdrivers');
+      foreach ($xdrivers as $line){
+        if (!preg_match ("/^#/", $line)){
+          $drivers[]= trim($line);
+        }
+      }
+    } else {
+      $drivers = array("ati", "atimisc", "chips", "cirrus", "cyrix", "fbdev", "fglrx",
+          "i128", "i740", "i810", "imstt", "mga", "neomagic", "newport", "nsc",  "nv", "nvidia",
+          "r128", "radeon", "rendition", "s3", "s3virge", "savage", "siliconmotion",
+          "sis", "tdfx", "tga", "trident", "tseng", "vesa", "vga", "vmware");
+    }
+    return($drivers);
+  }
+
+
+  /* Return plugin informations for acl handling */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Service"),
+          "plDescription" => _("Workstation service"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 10,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("workstation","ogroups"), 
+
+          "plProvidedAcls"=> array(
+            "gotoXMonitor"          => _("Monitor"),
+            "gotoXDriver"           => _("Gfx driver"),
+            "gotoXResolution"       => _("Gfx resolution"),
+            "gotoXColordepth"       => _("Gfx color depth"),
+            "gotoXHsync"            => _("Hsync"),
+            "gotoXVsync"            => _("Vsync"),
+            "AutoSync"              => _("Use DDC"),
+            "gotoScannerEnable"     => _("Scanner enabled"),
+            "gotoXKbModel"          => _("Keyboard model"),
+            "gotoXKbLayout"         => _("Keyboard layout"),
+            "gotoXKbVariant"        => _("Keyboard variant"),
+            "gotoXMouseType"        => _("Mouse type"),
+            "gotoXMouseport"        => _("Mouse port"),
+            "goFonHardware"         => _("Telephone hardware")) 
+            ));
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/systems/class_workstationStartup.inc b/gosa-core/plugins/admin/systems/class_workstationStartup.inc
new file mode 100644 (file)
index 0000000..8e9ed52
--- /dev/null
@@ -0,0 +1,1360 @@
+<?php
+class workstartup extends plugin
+{
+  /* CLI vars */
+  var $cli_summary= "Manage terminal startup options";
+  var $cli_description= "Some longer text\nfor help";
+  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* Ldap server list */
+  var $gotoLdapServers    = array();
+  var $gotoLdapServerList = array();
+  var $gotoLdap_inherit   = FALSE;
+
+  /* Generic terminal attributes */
+  var $bootmode             = "G";
+  var $gotoBootKernel       = "default-inherited";
+  var $gotoKernelParameters = "";
+  var $gotoLdapServer       = "default-inherited";
+  var $gotoModules          = array();
+  var $gotoAutoFs           = array();
+  var $gotoFilesystem       = array();
+  var $gotoTerminalPath     = "";
+  var $FAIstatus            = "";
+  var $gotoBootKernels      = array();
+
+  /* attribute list for save action */
+  var $attributes     = array("gotoLdapServer", "gotoBootKernel", "gotoKernelParameters", "FAIclass", "FAIstatus", "gotoShare","FAIdebianMirror", "FAIrelease");
+  var $objectclasses  = array("GOhard", "FAIobject");
+
+  /* Share */
+  var $gotoShares         = array();// Currently Share Option
+  var $gotoShare          = "";     // currently selected Share Option
+  var $gotoShareSelections= array();// Available Shares for this account in Listbox format
+  var $gotoAvailableShares= array();// Available Shares for this account
+
+  /* Helper */
+  var $customParameters   = "";
+  var $orig_dn            = "";
+  var $ignore_account     = TRUE;
+  /* FAI class selection */ 
+  var $FAIclass           = array();
+  var $FAIclasses         = array();
+  var $FAIclassInfo       = array();
+  var $FAIrelease         = "";
+  var $FAIdebianMirror    = "auto";
+
+  var $unresolved_classes = array();
+  var $view_logged        = FALSE;
+  
+  /* FAI class selection */
+  var $InheritedFAIclass           = array();
+  var $InheritedFAIrelease         = "";
+  var $InheritedFAIdebianMirror    = "auto";
+
+  /* Contains all possible server/release/class settings */
+  var $FAIServRepConfig   = array();
+
+  var $CopyPasteVars = array("gotoModules","gotoShares");
+
+  var $fai_activated = FALSE;
+  var $o_group_dn     ="";
+  var $member_of_ogroup   = FALSE;
+
+  function workstartup (&$config, $dn= NULL, $parent= NULL)
+  {
+    /* Check if FAI is active */
+    $tmp= $config->search("faiManagement", "CLASS",array('menu','tabs'));
+    if(!empty($tmp)){
+      $this->fai_activated = TRUE;
+    }else{
+      $this->attributes = array("gotoLdapServer", "gotoBootKernel", "gotoKernelParameters", "gotoShare");
+      $this->objectclasses  = array("GOhard");
+    }
+
+    plugin::plugin ($config, $dn, $parent);
+
+    if(!isset($this->parent->by_object['ogroup'])){
+      $ldap = $this->config->get_ldap_link();
+      $ldap->cd ($this->config->current['BASE']);
+      $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".$this->dn."))",array("cn","dn"));
+      if($ldap->count()){
+        $this->member_of_ogroup = TRUE;
+        $attrs = $ldap->fetch();
+        $this->o_group_dn = $attrs['dn'];
+      }
+    }
+
+    /* Creating a list of valid Mirrors 
+     * none will not be saved to ldap.
+     */
+    $ldap   = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+
+    foreach($this->config->data['SERVERS']['LDAP'] as $server) {
+      $this->gotoLdapServerList[]= $server; 
+    }
+    if(isset($this->attrs['gotoLdapServer'])){
+      unset($this->attrs['gotoLdapServer']['count']);
+      sort($this->attrs['gotoLdapServer']);
+      foreach($this->attrs['gotoLdapServer'] as $value){
+        $this->gotoLdapServers[] = preg_replace("/^[0-9]*:/","",$value);
+      }
+    }
+    if(!count($this->gotoLdapServers) && $this->member_of_ogroup){ 
+      $this->gotoLdap_inherit = TRUE;
+    }
+
+    /* FAI Initialization
+       Skip this if FAI is not activated 
+     */
+    if($this->fai_activated) {
+
+      $_SESSION['getAvailableClassesForThisRelease_CACHE'] = array();
+      $_SESSION['getAvailableClassesForThisRelease_CACHED_CLASSES'] = array();
+
+      /* Search all FAI objects */
+      $ldap->search("(|(objectClass=FAIpackageList)(objectClass=FAItemplate)(objectClass=FAIvariable)(objectClass=FAIscript)(objectClass=FAIhook)(objectClass=FAIprofile)(objectClass=FAIpartitionTable))",array("cn","objectClass","FAIdebianSection",'description'));
+      /* Sort all entries, and attach elementtype.
+       * To be able to show the types in the listbox.
+       */
+      while($attr = $ldap->fetch()){
+        $cn = $attr['cn'][0];
+      
+        if(!isset($attr['description'])){
+          $attr['description'][0] ="";
+        }
+
+        $_SESSION['getAvailableClassesForThisRelease_CACHED_CLASSES'][] = $attr;
+   
+        if(in_array('FAIpackageList',$attr['objectClass'])){
+          $tmp2[$cn]['FAIpackageList']['obj']   = 'FAIpackageList'; 
+          $tmp2[$cn]['FAIpackageList']['kzl']   = 'Pl';
+          $tmp2[$cn]['FAIpackageList']['sec']   = $attr['FAIdebianSection'];
+          $tmp2[$cn]['FAIpackageList']['desc']  = $attr['description'];
+          $this->FAIclasses[$attr['cn'][0]]=$attr['cn'][0];
+        }
+        if(in_array('FAItemplate',$attr['objectClass'])){
+          $tmp2[$cn]['FAItemplate']['obj']      = 'FAItemplate'; 
+          $tmp2[$cn]['FAItemplate']['kzl']      = 'T'; 
+          $tmp2[$cn]['FAItemplate']['desc']  = $attr['description'];
+          $this->FAIclasses[$attr['cn'][0]]=$attr['cn'][0];
+        }
+        if(in_array('FAIvariable',$attr['objectClass'])){
+          $tmp2[$cn]['FAIvariable']['obj']      = 'FAIvariable'; 
+          $tmp2[$cn]['FAIvariable']['kzl']      = 'V'; 
+          $tmp2[$cn]['FAIvariable']['desc']  = $attr['description'];
+          $this->FAIclasses[$attr['cn'][0]]=$attr['cn'][0];
+        }
+        if(in_array('FAIscript',$attr['objectClass'])){
+          $tmp2[$cn]['FAIscript']['obj']        = 'FAIscript'; 
+          $tmp2[$cn]['FAIscript']['kzl']        = 'S'; 
+          $tmp2[$cn]['FAIscript']['desc']  = $attr['description'];
+          $this->FAIclasses[$attr['cn'][0]]=$attr['cn'][0];
+        }
+        if(in_array('FAIhook',$attr['objectClass'])){
+          $tmp2[$cn]['FAIhook']['obj']          = 'FAIhook'; 
+          $tmp2[$cn]['FAIhook']['kzl']          = 'H'; 
+          $tmp2[$cn]['FAIhook']['desc']  = $attr['description'];
+          $this->FAIclasses[$attr['cn'][0]]=$attr['cn'][0];
+        }
+        if(in_array('FAIpartitionTable',$attr['objectClass'])){
+          $tmp2[$cn]['FAIpartitionTable']['obj']= 'FAIpartitionTable'; 
+          $tmp2[$cn]['FAIpartitionTable']['kzl']= 'Pt'; 
+          $tmp2[$cn]['FAIpartitionTable']['desc']  = $attr['description'];
+          $this->FAIclasses[$attr['cn'][0]]=$attr['cn'][0];
+        }
+        if(in_array('FAIprofile',$attr['objectClass'])){
+          $tmp2[$cn]['FAIprofile']['obj']= 'FAIprofile'; 
+          $tmp2[$cn]['FAIprofile']['kzl']= 'P'; 
+          $tmp2[$cn]['FAIprofile']['desc']  = $attr['description'];
+          $this->FAIclasses[$attr['cn'][0]]=$attr['cn'][0];
+        }
+      }
+      if(is_array($this->FAIclasses)){
+        natcasesort($this->FAIclasses);
+      }
+
+      if(isset($tmp2)){
+        $this->FAIclassInfo = $tmp2;
+      } else {
+        $this->FAIclassInfo = array();
+      }
+
+      /* Build up an array like this one :
+          [$url]['SERVER'] = 'srv1-002';
+          [$url]['RELEASE']['siga/rc9.0.2']
+                                             ['SECTIONS'][0] "main";
+                                             ['SECTIONS'][1] "non-free";
+          [$url]['RELEASE']['siga/rc9.0.2']
+                                             ['PACKAGES'][0] "pkg1";
+                                             ['PACKAGES'][1] "postfix";
+       */
+
+      $ldap->search("(&(FAIrepository=*)(objectClass=FAIrepositoryServer))",array("FAIrepository"));
+      $test = array();
+      while($attr = $ldap->fetch()){
+        if(isset($attr['FAIrepository'])){
+
+          unset($attr['FAIrepository']['count']);
+
+          foreach($attr['FAIrepository'] as $rep){
+            $tmp = split("\|",$rep);
+
+            if(count($tmp)==4){
+              $sections = split(",",$tmp[3]);
+              $release  = $tmp[2];
+              $server   = $tmp[1];
+              $url      = $tmp[0];
+             
+              $test[$url]['RELEASE'][$release]['SECTIONS'] = $sections;
+      
+              /* Result will be cached
+               */
+              $rel_classes = $this->getAvailableClassesForThisRelease($release);
+              $test[$url]['RELEASE'][$release]['PACKAGES'] = $rel_classes;
+              $test[$url]['SERVER'] = $server;
+
+              /* auto gets all releases/classes 
+               */
+              $test['auto']['RELEASE'][$release]['SECTION'] = $sections;
+              $test['auto']['RELEASE'][$release]['PACKAGES'] = $rel_classes;
+            }
+          }
+        }
+      }
+      
+      /* Add possible elements from hook */
+      $lines= $this->GetHookElements();
+      foreach ($lines as $hline){
+        $entries= split(";", $hline);
+        if (isset($entries[1]) && !isset($test[$entries[1]])){
+          $test[$entries[1]]['RELEASE']= array();
+
+          /* Split releases */
+          if (isset($entries[2])){
+            $releases= split(",", $entries[2]);
+
+            foreach ($releases as $release){
+              $rname= preg_replace('/:.*$/', '', $release);
+              $sections= split(':', preg_replace('/^[^:]+:([^|]+)|.*$/', '\1', $release));
+              $classes= split('\|', preg_replace('/^[^|]+\|(.*)$/', '\1', $release));
+              $test[$entries[1]]['RELEASE'][$rname]= array();
+              $test[$entries[1]]['RELEASE'][$rname]['SECTION']= $sections;
+              foreach ($classes as $class){
+                if ($class != ""){
+                  $test[$entries[1]]['RELEASE'][$rname]['PACKAGES'][$class]= $class;
+                }
+              }
+            }
+          }
+        }
+      }
+      
+      $this->FAIServRepConfig= $test;
+
+      if((isset($this->FAIclass))&&(!is_array($this->FAIclass))){
+        $tmp = array();
+        $tmp = split(" ",$this->FAIclass);
+        $tmp2 =array();  
+
+        foreach($tmp as $class){
+          if( ":" == $class[0] ) {
+            $this->FAIrelease = substr( $class, 1 );
+          }
+          else
+          {
+            $tmp2[$class] = $class;
+          }
+        }
+        $this->FAIclass = $tmp2;
+      }
+
+      if(!is_array($this->FAIclass)){
+        $this->FAIclass =array();
+      }
+    }// END of FAI initialization stuff 
+
+
+    /* Get arrays */
+    foreach (array("gotoModules", "gotoAutoFs", "gotoFilesystem") as $val){
+      if (isset($this->attrs["$val"]["count"])){
+        for ($i= 0; $i<$this->attrs["count"]; $i++){
+          if (isset($this->attrs["$val"][$i])){
+            array_push($this->$val, $this->attrs["$val"][$i]);
+          }
+        }
+      }
+      sort ($this->$val);
+      $this->$val= array_unique($this->$val);
+    }
+
+    /* Parse Kernel Parameters to decide what boot mode is enabled */
+    if (preg_match("/ splash=silent/", $this->gotoKernelParameters)){
+      $this->bootmode= "G";
+    } elseif (preg_match("/ debug/", $this->gotoKernelParameters)){
+      $this->bootmode= "D";
+    } elseif ($this->gotoKernelParameters == "") {
+      $this->bootmode= "G";
+    } else {
+      $this->bootmode= "T";
+    }
+    if (preg_match("/ o /", $this->gotoKernelParameters)){
+      $this->customParameters= preg_replace ("/^.* o /", "", $this->gotoKernelParameters);
+    } else {
+      $this->customParameters= "";
+    }
+
+    /* Prepare Shares */
+    if((isset($this->attrs['gotoShare']))&&(is_array($this->attrs['gotoShare']))){
+      unset($this->attrs['gotoShare']['count']);
+      foreach($this->attrs['gotoShare'] as $share){
+        $tmp = $tmp2 = array();
+        $tmp = split("\|",$share);
+        $tmp2['server']      =$tmp[0];
+        $tmp2['name']        =$tmp[1];
+        $tmp2['mountPoint']  =$tmp[2];
+        $this->gotoShares[$tmp[1]."|".$tmp[0]]=$tmp2;
+      }
+    }
+
+    $this->gotoShareSelections= $config->getShareList(true);
+    $this->gotoAvailableShares= $config->getShareList(false);
+    $tmp2 = array();
+  
+
+    $this->orig_dn= $this->dn;
+
+    /* Handle inheritance value "default" */
+    if ($this->member_of_ogroup){
+      $this->gotoBootKernels= array("default-inherited" => '['._("inherited").']'); 
+    }
+
+    /* Load hardware list */
+    if ($this->member_of_ogroup){
+
+      if(count($this->FAIclass)==0 && $this->FAIrelease == ""){
+        $this->FAIdebianMirror = "inherited";
+      }
+
+      if($this->fai_activated){
+        $map= array("gotoBootKernel","FAIclass","FAIdebianMirror");
+      }else{
+        $map= array("gotoBootKernel");
+      }
+
+      $ldap = $this->config->get_ldap_link();
+      $ldap->cat($this->o_group_dn);
+      $attrs= $ldap->fetch();
+
+      foreach ($map as $name){
+        if (!isset($attrs[$name][0])){
+          continue;
+        }
+
+        switch ($name){
+          case 'gotoBootKernel':
+            $this->gotoBootKernels['default-inherited']=  _("inherited").' ['.$attrs[$name][0].']' ;
+            break;
+
+          case 'FAIclass':
+            $str = split(":",$attrs[$name][0]);
+            $this->InheritedFAIclass    = split("\ ",trim($str[0]));
+            $this->InheritedFAIrelease  = trim($str[1]);
+            break;
+
+          case 'FAIdebianMirror':
+            $this->InheritedFAIdebianMirror = $attrs[$name][0];
+            break;
+        }
+      }
+    }
+
+    /* Get list of boot kernels */
+    if (isset($this->config->data['TABS'])){
+      $command= $this->config->search(get_class($this), "KERNELS",array('tabs'));
+
+      if (!check_command($command)){
+        $message[]= sprintf(_("Command '%s', specified as KERNELS hook for plugin '%s' doesn't seem to exist."), $command,
+            get_class($this));
+      } else {
+        $fh= popen($command, "r");
+        while (!feof($fh)) {
+          $buffer= trim(fgets($fh, 256));
+          
+          if(!empty($buffer)){
+          
+            $name=$value = $buffer;
+
+            if(preg_match("/:/",$buffer)){
+              $name = preg_replace("/:.*$/","",$buffer);
+              $value= preg_replace("/^.*:/","",$buffer);
+              $this->gotoBootKernels[$name]= $name.":".$value;
+            }else{
+              $this->gotoBootKernels[$name]= $value;
+            }
+          }
+
+        }
+        pclose($fh);
+      }
+    }
+
+    /* Turn to default, if we've nothing to inherit */
+    if (!isset($this->gotoBootKernels['default-inherited']) && $this->gotoBootKernel == "default-inherited"){
+      $this->gotoBootKernel= "default";
+    }
+
+    /* Preselect release if none was selected yet */
+    if(empty($this->FAIrelease) && $this->FAIdebianMirror == "auto"){
+      if(isset($this->FAIServRepConfig['auto']['RELEASE']) && is_array($this->FAIServRepConfig['auto']['RELEASE'])){
+        $this->FAIrelease = key($this->FAIServRepConfig['auto']['RELEASE']);
+      }
+    }
+  }
+
+  
+  /* This class is called by the contrucktor ONLY.
+   *   It return the available classes for each 
+   *    Server / Release combination ... 
+   *   (Release specifies which classes are available) 
+   */
+  function getAvailableClassesForThisRelease($release)
+  {
+    /* There could be more than one server providing this release,
+        so use cached result if available
+     */
+    if(isset($_SESSION['getAvailableClassesForThisRelease_CACHE'][$release]))  {
+      return($_SESSION['getAvailableClassesForThisRelease_CACHE'][$release]);
+    }
+
+    $test2  = array();
+    $bb     = $this->generateDNSyn($release);
+
+    $ldap   = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+  
+    /* Get classes fpr given release */
+    $p_classes = get_all_objects_for_given_base($bb,
+        "(|(objectClass=FAIpackageList)(objectClass=FAItemplate)".
+          "(objectClass=FAIvariable)(objectClass=FAIscript)(objectClass=FAIhook)".
+          "(objectClass=FAIprofile)(objectClass=FAIpartitionTable))");
+
+    /* Create list of classes */
+    foreach($p_classes as $class){
+      $ldap->cat($class['dn'],array("cn"));
+      $attr = $ldap->fetch();
+      $test2[$attr['cn'][0]] = $attr['cn'][0];
+    }
+    $_SESSION['getAvailableClassesForThisRelease_CACHE'][$release] = $test2;
+    return($test2);
+  }
+
+
+  /*  Create array to display available classes/profiles in a selectbox 
+   *   This function only displays the available classes.
+   *   If a class is available is defined by these facts : 
+   *     1. Is this class available for the selected release ?
+   *       - if it is available, check if the release is available for the selected server 
+   *         (done by $this->getFAIreleases())
+   *     2. Is this class currently not assigned to $this->FAIclass
+   */
+  function selectFriendlyClasses(){
+    $tmp=array();
+
+    if($this->FAIdebianMirror == "inherited" || $this->FAIrelease == ""){
+      return($tmp);
+    }
+
+    /* check if the current release exists,
+        else select the first one ..
+     */
+    $tmp2 = $this->getFAIreleases();
+    if(!isset($tmp2[$this->FAIrelease]) || !$tmp2[$this->FAIrelease]['USE']){
+      foreach($tmp2 as $key => $data){
+        if($data['USE']){
+          $this->FAIrelease = $key;
+        }
+      }
+    }
+    if(!in_array($this->FAIrelease, $tmp2)){
+#  $this->FAIrelease = key($tmp2);
+    }
+
+    /* Get all Packages for this server/release combination
+     */
+    if(!isset($this->FAIServRepConfig[$this->FAIdebianMirror]['RELEASE'][$this->FAIrelease]['PACKAGES'])){
+      $pkgs = array();
+      print_red(_("There are packages in your configuration, which can't be resolved with current server/release settings."));
+    }else{
+      $pkgs = $this->FAIServRepConfig[$this->FAIdebianMirror]['RELEASE'][$this->FAIrelease]['PACKAGES'];
+    }
+
+    /* Check each and every single class name 
+     */
+    foreach($pkgs as $pkg){
+  
+      /* Class already assigned to the classes list ?
+       * If not ... go on
+       */
+      if(!in_array($pkg,$this->FAIclass)){
+        
+        /* Create the displayed list entry value
+            HKLMOP [-Pl P V T-] or something like that 
+         */
+        $str = "";
+        foreach($this->FAIclassInfo[$pkg] as $entry){
+          if(isset($entry['kzl'])){
+            $str .= $entry['kzl']." ";
+          }
+        }
+        
+        /* Append class if everyting was fine
+         */        
+        $tmp[$pkg] = $pkg." [-".trim($str)."-]";
+      }
+    }
+    /* Just sort and return new classes list ...
+       ( possibly we should cache the result ... )
+     */
+    natcasesort ($tmp);
+    return($tmp);
+  }
+
+  function check()
+  {
+    $messages = array();
+    
+    /* Call common method to give check the hook */
+    $messages= plugin::check();
+
+    /* If there are packages selected, but no mirror show error */   
+    if(($this->FAIdebianMirror == "none")&&(count($this->FAIclass)>0)){
+      $messages[]=_("Please select a 'FAI server' or remove the 'FAI classes'.");
+    }
+
+    return($messages);
+  }
+
+  function execute()
+  {
+       /* Call parent execute */
+       plugin::execute();
+
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","workstation/".get_class($this),$this->dn);
+    }
+
+    /* 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;
+      }
+    }
+
+    /* Do we represent a valid terminal? */
+    if (!$this->is_account && $this->parent === NULL){
+      $display= "<img alt=\"\" src=\"images/stop.png\" align=middle>&nbsp;<b>".
+        _("This 'dn' has no terminal features.")."</b>";
+      return ($display);
+    }
+
+    /* Add module */
+    if (isset ($_POST['add_module'])){
+      if ($_POST['module'] != "" && $this->acl_is_writeable("gotoModule")){
+        $this->add_list ($this->gotoModules, $_POST['module']);
+      }
+    }
+
+    /* Delete module */
+    if (isset ($_POST['delete_module'])){
+      if (count($_POST['modules_list']) && $this->acl_is_writeable("gotoModule")){
+        $this->del_list ($this->gotoModules, $_POST['modules_list']);
+      }
+    }
+
+    /* FAI class management */
+    if($this->fai_activated){
+      if(((isset($_POST['AddClass']))&&(isset($_POST['FAIclassesSel']))) && ($this->acl_is_writeable("FAIclass"))){
+        $found = 0 ; 
+
+        /* If this new class/profile will attach a second partition table
+         * to our list of classes, abort and show a message.
+         */
+        foreach($this->FAIclass as $name){
+          if(isset($this->FAIclassInfo[$name])){
+            foreach($this->FAIclassInfo[$name] as $atr){
+              if(isset($atr['obj'])){
+                if($atr['obj'] == "FAIpartitionTable"){
+                  $found ++ ; 
+                }
+              }
+            }
+          }
+        }
+
+        if((isset($this->FAIclassInfo[$_POST['FAIclassesSel']]['FAIpartitionTable']))&&($found>0)){
+          print_red(_("There is already a profile in your selection that contain partition table configurations."));
+        }else{
+          $this->FAIclass[$_POST['FAIclassesSel']]=$_POST['FAIclassesSel'];
+        }
+      }
+
+      $sort = false;
+
+      /* Move one used class class one position up or down */
+      if($this->acl_is_writeable("FAIclass")){
+        foreach($_POST as $name => $val){
+
+          $sort_type = false;
+          if((preg_match("/sort_up/",$name))&&(!$sort)){
+            $sort_type = "sort_up_";
+          }
+          if((preg_match("/sort_down/",$name))&&(!$sort)){
+            $sort_type = "sort_down_";
+          }
+
+          if(($sort_type)&&(!$sort)){
+            $value = base64_decode(preg_replace("/_.*$/i","",preg_replace("/".$sort_type."/i","",$name)));
+            $sort = true;
+
+            $last = -1;
+            $change_down  = -1;
+
+            /* Create array with numeric index */ 
+            $tmp = array();
+            foreach($this->FAIclass as $class){
+              $tmp [] = $class;
+            }
+
+            /* Walk trough array */
+            foreach($tmp as $key => $faiName){
+              if($faiName == $value){
+                if($sort_type == "sort_up_"){
+                  if($last != -1){
+                    $change_down= $last;
+                  }
+                }else{
+                  if(isset($tmp[$key+1])){
+                    $change_down = $key;
+                  }
+                }
+              }
+              $last = $key;
+            }
+
+            $tmp2 = array();
+            $skip = false;    
+
+            foreach($tmp as $ky => $vl){
+
+              if($ky == $change_down){
+                $skip = $vl;
+              }else{
+                $tmp2[$vl] = $vl;
+              }
+              if(($skip != false)&&($ky != $change_down)){
+                $tmp2[$skip]  = $skip;
+                $skip =false;
+              }
+            }   
+            $this->FAIclass = $tmp2; 
+          }
+
+          if(preg_match("/fai_remove/i",$name)){
+            $value = base64_decode(preg_replace("/_.*$/i","",preg_replace("/fai_remove_/i","",$name)));
+            unset($this->FAIclass[$value]);
+          }
+        }
+      }
+
+      /* Delete selected class from our list */
+      if($this->acl_is_writeable("FAIclass")){
+        if((isset($_POST['DelClass']))&&(isset($_POST['FAIclassSel']))){
+          if(isset($this->FAIclass[$_POST['FAIclassSel']])){
+            unset($this->FAIclass[$_POST['FAIclassSel']]);
+          }
+        }
+      }
+    }// END fai handling
+
+    /* Show main page */
+    $smarty= get_smarty();
+
+    /* Assign ACLs to smarty */
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    } 
+
+    $smarty->assign("member_of_ogroup",$this->member_of_ogroup);
+
+    /* In this section server shares will be defined
+     * A user can select one of the given shares and a mount point
+     *  and attach this combination to his setup.
+     */
+    $smarty->assign("gotoShareSelections",    $this->gotoShareSelections);
+    $smarty->assign("gotoShareSelectionKeys", array_flip($this->gotoShareSelections));
+
+    /* if $_POST['gotoShareAdd'] is set, we will try to add a new entry
+     * This entry will be, a combination of mountPoint and sharedefinitions
+     */
+    if((isset($_POST['gotoShareAdd'])) && ($this->acl_is_writeable("gotoShare"))) {
+      /* We assign a share to this user, if we don't know where to mount the share */
+      if((!isset($_POST['gotoShareMountPoint']))||(empty($_POST['gotoShareMountPoint']))||(preg_match("/[\|]/i",$_POST['gotoShareMountPoint']))){
+        print_red(_("You must specify a valid mount point."));
+      }else{
+        if(count($this->gotoAvailableShares)){
+          $a_share = $this->gotoAvailableShares[$_POST['gotoShareSelection']];
+          $s_mount = $_POST['gotoShareMountPoint'];
+          /* Preparing the new assignment */
+          $this->gotoShares[$a_share['name']."|".$a_share['server']]=$a_share;
+          $this->gotoShares[$a_share['name']."|".$a_share['server']]['mountPoint']=$s_mount;
+        }
+      }
+    }
+
+    /* if the Post  gotoShareDel is set, someone asked GOsa to delete the selected entry (if there is one selected)
+     * If there is no defined share selected, we will abort the deletion without any message
+     */
+    if(($this->acl_is_writeable("gotoShare"))&& (isset($_POST['gotoShareDel']))&&(isset($_POST['gotoShare']))){
+      unset($this->gotoShares[$_POST['gotoShare']]);
+    }
+
+    $smarty->assign("gotoShares",$this->printOutAssignedShares());
+    $smarty->assign("gotoSharesCount",count($this->printOutAssignedShares()));
+    $smarty->assign("gotoShareKeys",array_flip($this->printOutAssignedShares()));
+    $smarty->assign("gotoBootKernels",$this->gotoBootKernels);
+
+    /* Create divSelectBox for ldap server selection
+     */
+    $SelectBoxLdapServer = new divSelectBox("LdapServer");
+    $SelectBoxLdapServer->SetHeight(130);
+
+    /* Add new ldap server to the list */
+    if(!$this->gotoLdap_inherit && isset($_POST['add_ldap_server']) && isset($_POST['ldap_server_to_add'])){
+      if(isset($this->gotoLdapServerList[$_POST['ldap_server_to_add']])){
+        $to_add = $this->gotoLdapServerList[$_POST['ldap_server_to_add']];
+        if(!in_array($to_add,$this->gotoLdapServers)){
+          $this->gotoLdapServers[] = $to_add;
+        }
+      }
+    }
+    
+    /* Move ldap servers up and down */
+    if(!$this->gotoLdap_inherit){
+      foreach($_POST as $name => $value){
+        if(preg_match("/sort_ldap_up_/",$name)){
+          $id = preg_replace("/^sort_ldap_up_([0-9]*)_(x|y)$/","\\1",$name);
+          $from =  $id;  
+          $to   =  $id -1;
+          $tmp = $this->array_switch_item($this->gotoLdapServers,$from,$to);
+          if($tmp){
+            $this->gotoLdapServers = $tmp;
+          }
+          break;
+        }
+        if(preg_match("/sort_ldap_down_/",$name)){
+          $id = preg_replace("/^sort_ldap_down_([0-9]*)_(x|y)$/","\\1",$name);
+          $from =  $id;  
+          $to   =  $id +1;
+          $tmp = $this->array_switch_item($this->gotoLdapServers,$from,$to);
+          if($tmp){
+            $this->gotoLdapServers = $tmp;
+          }
+          break;
+        }
+        if(preg_match("/gotoLdapRemove_/",$name)){
+          $id = preg_replace("/^gotoLdapRemove_([0-9]*)_(x|y)$/","\\1",$name);
+          $value = $this->gotoLdapServers[$id];
+          $this->gotoLdapServers = array_remove_entries(array($value),$this->gotoLdapServers);
+          break;
+        }
+      } 
+    }
+  
+    /* Add Entries 
+     */
+    foreach($this->gotoLdapServers as $key => $server){
+      if(!in_array($server,$this->gotoLdapServerList)){
+        $server = $server."&nbsp;<font style='color:red'>(missing)</font>";
+      }
+
+      $SelectBoxLdapServer->AddEntry(
+          array(array("string" => $server),
+            array("string" => 
+              "<input class='center' type='image' src='images/sort_up.png' name='sort_ldap_up_".$key."'>&nbsp;".
+              "<input class='center' type='image' src='images/sort_down.png' name='sort_ldap_down_".$key."'>&nbsp;".
+              "<input class='center' type='image' src='images/edittrash.png' name='gotoLdapRemove_".$key."'>",
+              "attach" => "style='text-align:right;width:40px;border-right:0px;'")));
+    }    
+
+    if($this->gotoLdap_inherit){
+      $smarty->assign("gotoLdapServerACL_inherit", preg_replace("/w/","",$this->getacl("gotoLdapServer")));;
+    }else{
+      $smarty->assign("gotoLdapServerACL_inherit", $this->getacl("gotoLdapServer"));
+    }
+    
+    $list = array();
+    foreach($this->gotoLdapServerList as $key => $entry){
+      if(!in_array($entry,$this->gotoLdapServers)){
+        $list[$key] = $entry;
+      }
+    }
+    $smarty->assign("gotoLdapServers",    $SelectBoxLdapServer->DrawList());
+    $smarty->assign("gotoLdapServerList", $list);
+    $smarty->assign("gotoLdap_inherit",   $this->gotoLdap_inherit);
+    $smarty->assign("JS",  $_SESSION['js']);
+
+    foreach (array("gotoModules", "gotoAutoFs", "gotoFilesystem") as $val){
+      $smarty->assign("$val", $this->$val);
+    }
+
+    /* Values */
+    foreach(array("gotoBootKernel", "customParameters", "gotoShare","FAIclasses","FAIclass","FAIdebianMirror","FAIrelease") as $val){
+      $smarty->assign($val, $this->$val);
+    }
+
+    $smarty->assign("fai_activated",$this->fai_activated);
+
+    /* Create FAI output */
+    if($this->fai_activated){
+      $smarty->assign("FAIdebianMirrors",$this->getFAIdebianMirrors());
+      $smarty->assign("FAIdebianMirror",$this->FAIdebianMirror);
+      $smarty->assign("FAIreleases",$this->getFAIreleases());
+      $smarty->assign("FAIrelease",$this->FAIrelease);
+      $smarty->assign("FAIclasses",$this->selectFriendlyClasses());
+      $smarty->assign("FAIclassesKeys",array_flip($this->selectFriendlyClasses()));
+      $smarty->assign("FAIclassKeys",$this->FAIclass);
+
+      $inheritedRelease = array();
+      if(!empty($this->InheritedFAIrelease)){
+        $inheritedRelease[$this->InheritedFAIrelease]= $this->InheritedFAIrelease;
+      } 
+      $smarty->assign("InheritedFAIrelease",$inheritedRelease);
+
+      $div = new divSelectBox("WSFAIscriptClasses");
+      $div -> SetHeight("110");
+      $str_up     = " &nbsp;<input type='image' src='images/sort_up.png'    name='sort_up_%s'    value='%s'>";
+      $str_down   = " &nbsp;<input type='image' src='images/sort_down.png'  name='sort_down_%s'  value='%s'>";
+      $str_remove = " &nbsp;<input type='image' src='images/edittrash.png'  name='fai_remove_%s' value='%s'>";
+      $str_empty  = " &nbsp;<img src='images/empty.png' alt=\"\" width='7'>"; 
+
+      $i = 1;
+
+      if($this->FAIdebianMirror == "inherited"){
+        $tmp = $this->InheritedFAIclass;
+      }else{
+        $tmp = $this->FAIclass;
+      }
+
+      foreach($tmp as $class){
+
+        $marker = "";
+        if(in_array_ics($class,$this->unresolved_classes)){
+          $marker = "&nbsp;<font color='red'>("._("Not available in current setup").")</font>";
+        }
+
+        if($this->FAIdebianMirror == "inherited"){
+          $str = "";
+        }else{
+          if($i==1){
+            $str = $str_empty.$str_down.$str_remove;
+          }elseif($i == count($this->FAIclass)){
+            $str = $str_up.$str_empty.$str_remove;
+          }else{
+            $str = $str_up.$str_down.$str_remove;
+          }
+        }
+        $i ++ ; 
+  
+        $desc = ""; 
+        if(isset($this->FAIclassInfo[$class])){
+          foreach($this->FAIclassInfo[$class] as $types ){
+            if(isset($types['desc'][0])){
+              $desc.= $types['desc'][0]." ";
+            }
+          }
+        }
+        if(!empty($desc)){
+          $desc = "&nbsp;[".trim($desc)."]";
+        }        
+
+        $div->AddEntry(array(
+              array("string"=>$class.$desc.$marker),
+              array("string"=>preg_replace("/\%s/",base64_encode($class),$str),"attach"=>"style='width:50px;border-right:none;'")
+              ));
+      }  
+      $smarty->assign("FAIScriptlist",$div->DrawList()); 
+    }// END FAI output generation 
+
+    /* Radio button group */
+    if (preg_match("/G/", $this->bootmode)) {
+      $smarty->assign("graphicalbootup", "checked");
+    } else {
+      $smarty->assign("graphicalbootup", "");
+    }
+    if (preg_match("/T/", $this->bootmode)) {
+      $smarty->assign("textbootup", "checked");
+    } else {
+      $smarty->assign("textbootup", "");
+    }
+    if (preg_match("/D/", $this->bootmode)) {
+      $smarty->assign("debugbootup", "checked");
+    } else {
+      $smarty->assign("debugbootup", "");
+    }
+
+    /* Show main page */
+    return($smarty->fetch (get_template_path('workstationStartup.tpl', TRUE,dirname(__FILE__))));
+  }
+
+  function remove_from_parent()
+  {
+    $this->handle_post_events("remove");
+    new log("remove","workstation/".get_class($this),$this->dn);
+  }
+
+  function generateDNSyn($release)
+  {
+    $str = "";
+    $tmp = split("\/",$release);
+    $tmp = array_reverse($tmp);
+    $base = "ou=fai,ou=configs,ou=systems,";   
+    foreach($tmp as $departmentname){
+      $str .= ",ou=".$departmentname;
+    }
+    $str = preg_replace("/^,/","",($str.",".$base));
+
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(&(objectClass=FAIbranch))",array("ou"));
+    while($attrs = $ldap->fetch()){
+      if(preg_match("/".normalizePreg($str)."/",$attrs['dn'])){
+        return($attrs['dn']);
+      }
+    }
+
+    return($str.$this->config->current['BASE']);
+  }
+
+  function getFAIdebianMirrors()
+  {
+    $ret = array();
+
+    /* Only add inherit option, if we are part in an object group 
+     */
+    if($this->member_of_ogroup)    {
+      $ret['inherited']['NAME']="["._("inherited")."]";
+      $ret['inherited']['USE'] = TRUE;
+    }
+
+    $ret['auto']['NAME']=_("automatic");
+    $ret['auto']['USE'] = TRUE;
+    $secs  = array();
+
+    /* Walk through all available servers 
+        and check if they support the currently selected classes
+        if not, dont't add them to our list
+     */
+    foreach($this->FAIServRepConfig as $mirror => $rest){
+
+      /* Automatically selection is available everytime */
+      if($mirror == "auto"){
+        continue;
+      }
+
+      $use = false;
+      if(count($this->FAIclass) == 0){
+        $use = true;
+      }else{
+        $tmp = $this->getFAIreleases();
+        foreach($tmp as $release => $data){
+          if(isset($rest['RELEASE'][$release]) && $release == $this->FAIrelease){
+            $use = $data['USE']; 
+          }
+        } 
+      }
+
+      /* If current server, doesn't support this class
+          remove it from list
+       */
+      $ret[$mirror]['NAME'] = $mirror;
+      $ret[$mirror]['USE'] = $use;
+    }
+    return($ret);
+  }
+
+  function getFAIreleases() 
+  {
+    $ret = array();
+
+    if($this->FAIdebianMirror == "inherited") {
+      return(array());
+    }
+
+    if(!isset($this->FAIServRepConfig[$this->FAIdebianMirror])){
+      $this->FAIdebianMirror = "auto";
+    }
+
+    $errorClasses = array();
+    if(isset($this->FAIServRepConfig[$this->FAIdebianMirror]['RELEASE'])) {
+      foreach($this->FAIServRepConfig[$this->FAIdebianMirror]['RELEASE'] as $release => $sections){
+        $use = true;
+
+        if(!count($this->FAIclass) == 0){
+          foreach($this->FAIclass as $class){
+            if(!in_array($class, $sections['PACKAGES'])){
+              $use = false;
+              $errorClasses[$class] = $class;
+            }else{
+              if(isset($errorClasses[$class])){
+                unset($errorClasses[$class]);
+              }
+            }
+          }
+        }
+        $ret[$release]['NAME']=$release;
+        $ret[$release]['USE']=$use;
+      }
+    }
+
+    if((count($ret) == 0 ) && ($this->FAIdebianMirror != "auto")){
+      $eClasses = " ";
+      foreach($errorClasses as $class){
+        $eClasses .= $class." ";
+      }
+
+      print_red(sprintf(_("Can't resolve one or more of the given FAIclass(es) [%s] in FAI server '%s'. Server was reset to 'auto'."),$eClasses, $this->FAIdebianMirror));
+      $this->FAIdebianMirror = "auto";
+      return($this->getFAIreleases());
+    }elseif((count($ret) == 0 ) && ($this->FAIdebianMirror == "auto")){
+
+      $eClasses = " ";
+      foreach($errorClasses as $class){
+        $eClasses .= $class." ";
+      }
+
+      $eClasses = preg_replace("/  */","",$eClasses);
+     
+      if(!empty($eClasses)) {
+
+        $this->unresolved_classes = $errorClasses;
+        $this->FAIdebianMirror = "auto";
+        print_red(sprintf(_("Can't resolve the given FAIclass(es) [%s] anyway, please check your FAI configurations, possibly some classes where deleted or renamed. Server was reset to 'auto'."),$eClasses));
+      }
+    }
+    return($ret);
+  }
+
+  /* Save data to object */
+  function save_object()
+  {
+    plugin::save_object();
+
+    if(isset($_POST['WorkstationStarttabPosted'])){
+      if(isset($_POST['gotoLdap_inherit'])){
+        $this->gotoLdap_inherit = TRUE;
+      }else{
+        $this->gotoLdap_inherit = FALSE;
+      }
+
+      /* Save group radio buttons */
+      if ($this->acl_is_writeable("bootmode") && isset($_POST["bootmode"])){
+        $this->bootmode= $_POST["bootmode"];
+      }
+
+      /* Save kernel parameters */
+      if ($this->acl_is_writeable("gotoKernelParameters") && isset($_POST["customParameters"])){
+        $this->customParameters= $_POST["customParameters"];
+      }
+    }
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+
+    /* Depending on the baseobject (Ogroup / WS) we
+     *  use another set of objectClasses
+     * In case of WS itself, we use  "array("GOhard", "FAIobject");"
+     * if we are currently editing from ogroup menu we use (array("gotWorkstationTemplate","GOhard", "FAIobject"))
+     */
+    if(isset($this->parent->by_object['ogroup'])){
+      $this->objectclasses = array("gotoWorkstationTemplate");
+    }elseif(isset($this->parent->by_object['workgeneric'])){
+      $this->objectclasses = array("GOhard");
+    }elseif(isset($this->parent->by_object['servgeneric'])){
+      $this->objectclasses = array("GOhard","gotoWorkstationTemplate");
+    }else{
+      print "Object Type Configuration : unknown";
+      exit();
+    }
+
+    /* Append FAI class */
+    if($this->fai_activated){
+      $this->objectclasses[]  = "FAIobject";
+    }
+
+    /* Find proper terminal path for tftp configuration
+       FIXME: This is suboptimal when the default has changed to
+       another location! */
+    if (($this->gotoTerminalPath == "default")){
+      $ldap= $this->config->get_ldap_link();
+
+      /* Strip relevant part from dn, keep trailing ',' */
+      $tmp= preg_replace("/^cn=[^,]+,ou=terminals,ou=systems,/i", "", $this->dn);
+      $tmp= preg_replace("/".$this->config->current['BASE']."$/i", "", $tmp);
+
+      /* Walk from top to base and try to load default values for
+         'gotoTerminalPath'. Abort when an entry is found. */
+      while (TRUE){
+        $tmp= preg_replace ("/^[^,]+,/", "", $tmp);
+
+        $ldap->cat("cn=default,ou=terminals,ou=systems,$tmp".
+            $this->config->current['BASE'], array('gotoTerminalPath'));
+        $attrs= $ldap->fetch();
+        if (isset($attrs['gotoTerminalPath'])){
+          $this->gotoTerminalPath= $attrs['gotoTerminalPath'][0];
+          break;
+        }
+
+        /* Nothing left? */
+        if ($tmp == ""){
+          break;
+        }
+      }
+    }
+
+    /* Add semi automatic values */
+    // FIXME: LDAP Server may not be set here...
+    $this->gotoKernelParameters= "ldap=".base64_encode($this->gotoLdapServer);
+
+    switch ($this->bootmode){
+      case "D":
+        $this->gotoKernelParameters.= " debug";
+      break;
+      case "G":
+        $this->gotoKernelParameters.= " splash=silent";
+      break;
+    }
+    if ($this->customParameters != ""){
+      $this->gotoKernelParameters.= " o ".$this->customParameters;
+    }
+
+    plugin::save();
+
+    unset( $this->attrs['FAIrelease'] );
+    
+    $str = "";
+
+    /* Skip FAI attribute handling if not necessary */
+    if($this->fai_activated){
+      if($this->FAIdebianMirror == "inherited"){
+        $this->attrs['FAIclass'] = $this->attrs['FAIrelease'] =  $this->attrs['FAIdebianMirror'] = array(); 
+      }else{
+        foreach($this->FAIclass as $class){
+          $str .= $class." ";
+        }
+        $str .= ":" . $this->FAIrelease;
+        $this->attrs['FAIclass']= "";
+        $this->attrs['FAIclass']= trim($str);
+
+        if(empty($this->attrs['FAIclass'])){
+          $this->attrs['FAIclass'] = array();
+        }
+      }
+    }
+  
+    /* Add missing arrays */
+    foreach (array("gotoFilesystem", "gotoAutoFs", "gotoModules") as $val){
+      if (isset ($this->$val) && count ($this->$val) != 0){
+    
+        $this->attrs["$val"]= array_unique($this->$val);
+      }
+      if(!isset($this->attrs["$val"])) $this->attrs["$val"]=array();
+    }
+
+    /* Prepare list of ldap servers */
+    $this->attrs['gotoLdapServer'] = array();
+    if(!$this->gotoLdap_inherit){
+      $i = 0;
+      foreach($this->gotoLdapServers as $server){
+        $i ++;
+        $this->attrs['gotoLdapServer'][] = $i.":".$server;
+      }
+    }
+
+    if (($this->attrs['gotoBootKernel'] == "default-inherited") || ($this->attrs['gotoBootKernel'] == "%default%")){
+      $this->attrs['gotoBootKernel']= array();
+    }
+
+    /* if mirror == none stop saving this attribute */
+    if($this->FAIdebianMirror == "none"){
+      $this->FAIdebianMirror = "";
+    }
+   
+    /* Get FAIstate from object, the generic tab could have changed it during execute */
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd($this->dn);
+
+
+    /* Skip FAI attribute handling if not necessary */
+    if($this->fai_activated){
+      $ldap->cat($this->dn,array("FAIstate"));
+      $checkFAIstate = $ldap->fetch();
+
+      /* Remove FAI objects if no FAI class is selected */ 
+      if((count($this->FAIclass)==0) && (!isset($checkFAIstate['FAIstate']))){
+        $this->attrs['FAIclass']        = array();
+        $this->attrs['FAIdebianMirror'] = array();
+      }
+    }
+
+
+    /* prepare share settings */
+    $tmp = array();
+    foreach($this->gotoShares as $name => $settings){
+      $tmp2= split("\|",$name);
+      $name = $tmp2[0];
+      $tmp[] = $settings['server']."|".$name."|".$settings['mountPoint'];
+    }
+    $this->attrs['gotoShare']=$tmp;
+
+    $this->cleanup();
+    $ldap->modify ($this->attrs); 
+    new log("modify","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of system workstation/startup with dn '%s' failed."),$this->dn));
+    $this->handle_post_events("modify");
+  }
+
+  /* Add value to array, check if unique */
+  function add_list (&$array, $value)
+  {
+    if ($value != ""){
+      $array[]= $value;
+      sort($array);
+      array_unique ($array);
+    }
+  }
+
+
+  /* Delete value to array, check if unique */
+  function del_list (&$array, $list)
+  {
+    $tmp= array();
+    foreach ($array as $mod){
+      if (!in_array($mod, $list)){
+        $tmp[]= $mod;
+      }
+    }
+    $array= $tmp;
+  }
+
+  /* Generate ListBox frindly output for the defined shares
+   * Possibly Add or remove an attribute here,
+   */
+  function printOutAssignedShares()
+  {
+    $a_return = array();
+    if(is_array($this->gotoShares)){
+      foreach($this->gotoShares as $share){
+        $a_return[$share['name']."|".$share['server']]= $share['name']." [".$share['server']."]";
+      }
+    }
+    return($a_return);
+  }
+
+
+  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 $line){
+          if(empty($line)) continue;
+          $ret[]= $line;
+        }
+      }
+    }
+    return($ret);
+  }
+
+
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);    
+
+    $source_o = new workstartup ($this->config, $source['dn']);
+    
+    foreach(array("FAIclass","gotoModules", "gotoAutoFs", "gotoFilesystem","gotoKernelParameters","gotoShares","customParameters") as $attr){
+      $this->$attr = $source_o->$attr;
+    }
+  }
+
+  
+  function array_switch_item($ar,$from,$to)
+  {
+    if(!is_array($ar)){
+      return(false);
+    }
+    if(!isset($ar[$from])){
+      return(false);
+    }
+    if(!isset($ar[$to])){
+      return(false);
+    }
+
+    $tmp = $ar[$from];
+    $ar[$from] = $ar[$to];    
+    $ar[$to] = $tmp;    
+    return($ar);
+  }
+
+
+  /* Return plugin informations for acl handling */ 
+  static function plInfo()
+  {
+    return (array( 
+          "plShortName"   => _("Startup"),
+          "plDescription" => _("System startup"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 9,
+          "plSection"     => array("administration"),           
+          "plCategory"    => array("workstation","server","ogroups"),
+
+          "plProvidedAcls"=> array(
+            "gotoLdapServer"        => _("Ldap server"),
+            "gotoBootKernel"        => _("Boot kernel"),
+            "gotoKernelParameters"  => _("Kernel parameter"),
+
+            "gotoModules"           => _("Kernel modules"),
+            "gotoShare"             => _("Shares"),
+
+            "FAIclass"              => _("FAI classes"),
+            "FAIdebianMirror"       => _("Debian mirror"),
+            "FAIrelease"            => _("Debian release"),
+
+            "FAIstatus"             => _("FAI status flag")) // #FIXME is this acl realy necessary ?
+          ));
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/systems/component.tpl b/gosa-core/plugins/admin/systems/component.tpl
new file mode 100644 (file)
index 0000000..3ddd506
--- /dev/null
@@ -0,0 +1,56 @@
+<table summary="" width="100%">
+ <tr>
+  <td style="vertical-align:top; width:50%; border-right:1px solid #A0A0A0">
+       <table summary="">
+        <tr>
+         <td><LABEL for="cn">{t}Device name{/t}</LABEL>{$must}</td>
+         <td>
+{render acl=$cnACL}
+          <input name="cn" id="cn" size=20 maxlength=60 value="{$cn}">
+{/render}
+         </td>
+        </tr>
+        <tr>
+          <td colspan=2>&nbsp;</td>
+        </tr>
+        <tr>
+         <td><LABEL for="base">{t}Base{/t}</LABEL>{$must}</td>
+         <td>
+{render acl=$baseACL}
+           <select id="base" size="1" name="base" title="{t}Choose subtree to place group in{/t}">
+            {html_options options=$bases selected=$base_select}
+           </select>
+{/render}
+{render acl=$baseACL disable_picture='images/folder_gray.png'}
+        <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
+{/render}
+
+          </td>
+         </tr>
+       </table>
+  </td>
+  <td style="vertical-align:top">
+       <table summary="">
+        <tr>
+         <td><LABEL for="description">{t}Description{/t}</LABEL></td>
+         <td>  
+{render acl=$descriptionACL}
+          <input id="description" name="description" size=25 maxlength=80 value="{$description}">
+{/render}
+          </td>
+        </tr>
+       </table>
+  </td>
+ </tr>
+</table>
+
+<p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
+
+{$netconfig}
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('cn');
+  -->
+</script>
diff --git a/gosa-core/plugins/admin/systems/contents.tpl b/gosa-core/plugins/admin/systems/contents.tpl
new file mode 100644 (file)
index 0000000..001d50d
--- /dev/null
@@ -0,0 +1 @@
+{$Kekse} sind gesund
diff --git a/gosa-core/plugins/admin/systems/gencd.tpl b/gosa-core/plugins/admin/systems/gencd.tpl
new file mode 100644 (file)
index 0000000..f0c4496
--- /dev/null
@@ -0,0 +1,20 @@
+<p>
+ <b>{t}CD-Install-Image generation{/t}</b>
+</p>
+<p>
+  {t}This option enables you to generate FAI install CD images for the selected workstation. The procedure may take about 10 minutes to complete, so please be patient after pressing the 'Create ISO-Image' button.{/t}
+</p>
+
+<p class="plugbottom">
+  <input type=submit name="cd_create" value="{t}Create ISO-Image{/t}">
+  &nbsp;
+  <input type=submit name="cd_cancel" value="{t}Cancel{/t}">
+</p>
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       nextfield= 'new_password';
+       focus_field('new_password');
+  -->
+</script>
diff --git a/gosa-core/plugins/admin/systems/gencd_frame.tpl b/gosa-core/plugins/admin/systems/gencd_frame.tpl
new file mode 100644 (file)
index 0000000..4c53bda
--- /dev/null
@@ -0,0 +1,3 @@
+<iframe src='{$src}' style='width:100%; height:550px;background-color:#FFFFFF;'>
+       {t}Your browser does not supprt iframes.{/t}
+</iframe>
diff --git a/gosa-core/plugins/admin/systems/info.tpl b/gosa-core/plugins/admin/systems/info.tpl
new file mode 100644 (file)
index 0000000..e088c59
--- /dev/null
@@ -0,0 +1,135 @@
+<h2><img class="center" alt="" align="middle" src="images/info_small.png"> {t}System information{/t}</h2>
+<table summary="" style="width:100%;">
+ <tr>
+  <td style="vertical-align:top; width:50%">
+   <table summary="">
+    <tr>
+     <td style="vertical-align:top"><b>{t}CPU{/t}</b></td><td>{$ghCpuType}</td>
+    </tr>
+    <tr>
+     <td><b>{t}Memory{/t}</b></td><td>{$ghMemSize}</td>
+    </tr>
+    <tr>
+     <td><b>{t}Boot MAC{/t}</b></td><td>{$macAddress}</td>
+    </tr>
+    <tr>
+     <td style="vertical-align:top;"><b>{t}USB support{/t}</b></td><td>{$ghUsbSupport}<div style="height:20px;"></div></td>
+    </tr>
+    <tr>
+     <td><b>{t}System status{/t}</b></td>
+     <td>{$status}</td>
+    </tr>
+    <tr>
+     <td><b>{t}Inventory number{/t}</b></td>
+     <td>{$ghInventoryNumber}</td>
+    </tr>
+    <tr>
+     <td><b>{t}Last login{/t}</b></td>
+     <td>{$gotoLastUser}</td>
+    </tr>
+   </table>
+  </td>
+  <td style="border-left:1px solid #A0A0A0">
+   &nbsp;
+  </td>
+  <td>
+   <table summary="">
+    <tr>
+     <td style="vertical-align:top"><b>{t}Network devices{/t}</b></td>
+     <td>
+      {foreach item=netcard from=$ghNetNic}
+        {$netcard}<br>
+      {/foreach}
+     </td>
+    </tr>
+    <tr><td colspan=2><div style="height:10px;"></div></td></tr>
+    <tr>
+     <td style="vertical-align:top;"><b>{t}IDE devices{/t}</b></td>
+     <td>
+       {foreach item=idedev from=$ghIdeDev}
+         {$idedev}<br>
+       {/foreach}
+     </td>
+    </tr>
+    <tr><td colspan=2><div style="height:10px;"></div></td></tr>
+    <tr>
+     <td style="vertical-align:top;"><b>{t}SCSI devices{/t}</b></td>
+     <td>
+       {foreach item=scsidev from=$ghScsiDev}
+         {$scsidev}<br>
+       {/foreach}
+     </td>
+    </tr>
+    <tr>
+     <td><b>{t}Floppy device{/t}</b></td>
+     <td>{$FloppyDevice}</td>
+    </tr>
+    <tr>
+     <td><b>{t}CDROM device{/t}</b></td>
+     <td>{$CdromDevice}</td>
+    </tr>
+    <tr><td colspan=2><div style="height:10px;"></div></td></tr>
+    <tr>
+     <td style="vertical-align:top"><b>{t}Graphic device{/t}</b></td>
+     <td>{$ghGfxAdapter}</td>
+    </tr>
+    <tr>
+     <td style="vertical-align:top"><b>{t}Audio device{/t}</b></td>
+     <td>{$ghSoundAdapter}</td>
+    </tr>
+   </table>
+  </td>
+ </tr>
+</table>
+
+{if $active eq "true"}
+<br>
+<h2 style="border-top:1px solid #A0A0A0; padding-top:5px;"><img class="center" alt="" align="middle" src="images/lamp.png"> {t}System status{/t}</h2>
+<table summary="" style="width:100%">
+ <tr>
+  <td style="vertical-align:top; width:50%">
+   <table summary="">
+    <tr>
+     <td><b>{t}Up since{/t}</b></td><td>{$uptime}</td>
+    </tr>
+    <tr>
+     <td><b>{t}CPU load{/t}</b></td><td>{$load}</td>
+    </tr>
+    <tr>
+     <td><b>{t}Memory usage{/t}</b></td><td>{$mem}</td>
+    </tr>
+    <tr>
+     <td><b>{t}Swap usage{/t}</b></td><td>{$swap}</td>
+    </tr>
+    <tr>
+     <td colspan=2>&nbsp;</td>
+    </tr>
+    {$partitions}
+   </table>
+  </td>
+  <td style="border-left:1px solid #A0A0A0">
+   &nbsp;
+  </td>
+  <td style="vertical-align:top;">
+   <table summary="">
+    <tr>
+     <td><b>{t}SSH service{/t}</b></td><td>{$sshd}</td>
+    </tr>
+    <tr>
+     <td><b>{t}Print service{/t}</b></td><td>{$cupsd}</td>
+    </tr>
+    <tr>
+     <td><b>{t}Scan service{/t}</b></td><td>{$saned}</td>
+    </tr>
+    <tr>
+     <td><b>{t}Sound service{/t}</b></td><td>{$artsd}</td>
+    </tr>
+    <tr>
+     <td><b>{t}GUI{/t}</b></td><td>{$X}</td>
+    </tr>
+   </table>
+  </td>
+ </tr>
+</table>
+{/if}
+
diff --git a/gosa-core/plugins/admin/systems/main.inc b/gosa-core/plugins/admin/systems/main.inc
new file mode 100644 (file)
index 0000000..f9bd8fb
--- /dev/null
@@ -0,0 +1,55 @@
+<?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
+*/
+
+if ($remove_lock){
+        if(isset($_SESSION['systems'])){
+                $systems= $_SESSION['systems'];
+                $systems->remove_lock();
+                del_lock ($ui->dn);
+                sess_del ('systems');
+        }
+} else {
+       /* Create usermanagement object on demand */
+       if (!isset($_SESSION['systems']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+               $_SESSION['systems']= new systems($config, $ui);
+       }
+       $systems= $_SESSION['systems'];
+       $systems->save_object();
+       $output= $systems->execute();
+
+       /* Reset requested? */
+       if (isset($_GET['reset']) && $_GET['reset'] == 1){
+               del_lock ($ui->dn);
+               sess_del ('systems');
+       }
+
+       /* Page header*/
+       if (isset($_SESSION['objectinfo'])){
+               $display= print_header(get_template_path('images/system.png'), _("System management"), "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".@LDAP::fix($_SESSION['objectinfo']));
+       } else {
+               $display= print_header(get_template_path('images/system.png'), _("System management"));
+       }
+
+       /* Show and save dialog */
+       $display.= $output;
+       $_SESSION['systems']= $systems;
+}
+
+?>
diff --git a/gosa-core/plugins/admin/systems/network.tpl b/gosa-core/plugins/admin/systems/network.tpl
new file mode 100644 (file)
index 0000000..7cb6b3f
--- /dev/null
@@ -0,0 +1,152 @@
+<h2><img       class="center"  alt=""  align="middle"  src="images/network.png">       {t}Network      settings{/t}</h2>
+
+
+<table summary=""      width="100%" cellspacing=0 cellpadding=0>
+       <tr>
+               <td     style="width:50%; vertical-align: top;">
+                       <table  summary="">
+                               <tr>
+                                       <td><LABEL      for="ipHostNumber">{t}IP-address{/t}{if $IPisMust}{$staticAddress}{/if}</LABEL></td>
+                                       <td>
+{render acl=$ipHostNumberACL}
+            <input     id="ipHostNumber"       name="ipHostNumber"     size=25 maxlength=80    value="{$ipHostNumber}">
+{/render}
+{render acl=$ipHostNumberACL}
+{if $DNSAccount == true}
+      <input id="propose_ip" type="submit" name="propose_ip" value="{t}Propose ip{/t}" style="visibility:visible;">
+      {else}
+      <input id="propose_ip" type="submit" name="propose_ip" value="{t}Propose ip{/t}" style="visibility:hidden;">
+      {/if}
+{/render}
+          </td>
+                               </tr>
+                               <tr>
+                                       <td><LABEL      for="macAddress">{t}MAC-address{/t}</LABEL>{$staticAddress}</td>
+                                       <td>
+{render acl=$macAddressACL}
+            <input     name="macAddress"       id="macAddress" size=25 maxlength=80    value="{$macAddress}">
+{/render}
+            {if $autonet==true}
+                                           <input type="submit" name="autonet" value="{t}Autodetect{/t}">
+            {/if}
+          </td>
+                               </tr>
+        {if $dhcpEnabled}
+        <tr>
+          <td colspan=2 style='padding-top:12px;'>
+            <table>
+              {if $dhcpParentNodeCnt}
+              <tr>
+                <td>
+                  <input onClick='document.mainform.submit();'
+                    {if $dhcp_is_Account} checked {/if} type='checkbox' name='dhcp_is_Account' class='center'>
+                </td>
+                <td>
+                  {t}Enable DHCP for this device{/t}
+                  <input type='image' src='images/list_reload.png' class='center'>
+                </td>
+              </tr>
+              {else}
+              <tr>
+                <td>
+                  <input type='checkbox' name='dummy' class='center' disabled>
+                  {t}Enable DHCP for this device{/t} ({t}not configured{/t})
+                  <input type='image' src='images/list_reload.png' class='center'>
+                </td>
+              </tr>
+              {/if}
+              {if $dhcp_is_Account}
+              <tr>
+                <td>&nbsp;</td>
+                <td>
+                  {t}Parent node{/t}
+                  <select name='dhcpParentNode'>      
+                    {html_options options=$dhcpParentNodes selected=$dhcpParentNode}
+                  </select>
+                  &nbsp;
+                  <input type='submit' name='dhcpEditOptions' value='{t}Edit settings{/t}'>
+                </td>
+              </tr>
+              {/if}
+            </table>
+          </td>
+        </tr>
+        {/if}
+      </table> 
+    </td>
+    {if $DNS_is_account==true}
+               <td     style="width:50%;vertical-align:top;border-left:1px solid #b0b0b0;" valign="top">
+
+    {if $ZoneCnt}
+      {if $DNSAccount == true}
+      <input type="checkbox" name="DNS_is_account" value="1"  
+        checked="checked"
+        onclick="toggle('test2');
+          changeState('zoneName');
+          changeState('dNSTTL');
+          toggle('propose_ip');
+          changeState('AddNewRecord');
+          {$changeStateForRecords}"/>
+        {else}
+      <input type="checkbox" name="DNS_is_account" value="1"  
+        onclick="toggle('test2');
+          changeState('zoneName');
+          changeState('dNSTTL');
+          toggle('propose_ip');
+          changeState('AddNewRecord');"/>
+        {/if}
+
+      {t}Enable DNS for this device{/t}
+      <input type='image' src='images/list_reload.png' class='center' name="reloadThisDNSStuff" >
+      {if $DNSAccount == true}
+      <div style="padding-left:20px;visibility:visible;" id="test2">
+      {else}
+      <div style="padding-left:20px;visibility:hidden;" id="test2">
+      {/if}
+                       <table summary="">
+                               <tr>
+                                       <td><LABEL      for="zoneName">{t}Zone{/t}</LABEL></td>
+                                       <td>
+{render acl=$zoneNameACL}
+              <select name="zoneName" id="zoneName" {if $DNSAccount == false} disabled {/if}>
+                {html_options values=$ZoneKeys output=$Zones selected=$zoneName}
+              </select>
+{/render}
+          </td>
+        </tr>
+        <tr>
+          <td>{t}TTL{/t}</td>
+          <td>
+{render acl=$dNSTTLACL}
+            <input type="text" name="dNSTTL" value="{$dNSTTL}" id="dNSTTL" {if $DNSAccount == false} disabled {/if}>
+{/render}
+          </td>
+        </tr>
+        <tr>
+          <td valign="top">{t}Dns records{/t}</td>
+          <td>
+            {if $DNS_is_account == true}
+{render acl=$RecordsACL}
+              {$records}
+{/render}
+            {/if}
+          </td>
+                               </tr>
+                       </table>
+      </div>
+    {else}        
+      <input type="checkbox" name="dummy" value="1" disabled class='center'>
+      {t}Enable DNS for this device{/t} ({t}not configured{/t})
+      <input type='image' src='images/list_reload.png' class='center'>
+    {/if}
+
+               </td>
+    {/if}
+    
+       </tr>
+</table>
+<input type="hidden" name="network_tpl_posted" value="1">
+
+<!--
+vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+-->
diff --git a/gosa-core/plugins/admin/systems/password.tpl b/gosa-core/plugins/admin/systems/password.tpl
new file mode 100644 (file)
index 0000000..734a4ae
--- /dev/null
@@ -0,0 +1,39 @@
+<p>
+ {t}To change the terminal root password use the fields below. The changes take effect during the next reboot. Please memorize the new password, because you wouldn't be able to log in.{/t}
+</p>
+<p>
+ <b>{t}Leave fields blank for password inheritance from default entries.{/t}</b>
+</p>
+
+<p>
+ {t}Changing the password impinges on authentification only.{/t}
+</p>
+
+<table summary="" style="vertical-align:top; text-align:left;" cellpadding=4 border=0>
+  <tr>
+    <td><b><LABEL for="new_password">{t}New password{/t}</LABEL></b></td>
+    <td><input id="new_password" type="password" name="new_password" size="30" maxlength="40"
+               onFocus="nextfield= 'repeated_password';"></td>
+  </tr>
+  <tr>
+    <td><b><LABEL for="repeated_password">{t}Repeat new password{/t}</LABEL></b></td>
+    <td><input type="password" id="repeated_password" name="repeated_password" size="30" maxlength="40"
+               onFocus="nextfield= 'password_finish';"></td>
+  </tr>
+</table>
+
+<br>
+
+<p class="plugbottom">
+  <input type=submit name="password_finish" value="{t}Set password{/t}">
+  &nbsp;
+  <input type=submit name="password_cancel" value="{t}Cancel{/t}">
+</p>
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       nextfield= 'new_password';
+       focus_field('new_password');
+  -->
+</script>
diff --git a/gosa-core/plugins/admin/systems/paste_generic.tpl b/gosa-core/plugins/admin/systems/paste_generic.tpl
new file mode 100644 (file)
index 0000000..b15920a
--- /dev/null
@@ -0,0 +1,60 @@
+{if $object == "server"}
+    <table summary="">
+     <tr>
+      <td><LABEL for="cn">{t}Server name{/t}</LABEL>{$must}</td>
+      <td>
+       <input name="cn" id="cn" size=20 maxlength=60 value="{$cn}">
+      </td>
+     </tr>
+       </table>
+{/if}
+{if $object == "workstation"}
+    <table summary="">
+     <tr>
+      <td><LABEL for="cn">{t}workstation name{/t}</LABEL>{$must}</td>
+      <td>
+       <input name="cn" id="cn" size=20 maxlength=60 value="{$cn}">
+      </td>
+     </tr>
+       </table>
+{/if}
+{if $object == "terminal"}
+    <table summary="">
+     <tr>
+      <td><LABEL for="cn">{t}Terminal name{/t}</LABEL>{$must}</td>
+      <td>
+       <input name="cn" id="cn" size=20 maxlength=60 value="{$cn}">
+      </td>
+     </tr>
+       </table>
+{/if}
+{if $object == "printer"}
+    <table summary="">
+     <tr>
+      <td><LABEL for="cn">{t}Printer name{/t}</LABEL>{$must}</td>
+      <td>
+       <input name="cn" id="cn" size=20 maxlength=60 value="{$cn}">
+      </td>
+     </tr>
+       </table>
+{/if}
+{if $object == "phone"}
+    <table summary="">
+     <tr>
+      <td><LABEL for="cn">{t}Phone name{/t}</LABEL>{$must}</td>
+      <td>
+       <input name="cn" id="cn" size=20 maxlength=60 value="{$cn}">
+      </td>
+     </tr>
+       </table>
+{/if}
+{if $object == "component"}
+    <table summary="">
+     <tr>
+      <td><LABEL for="cn">{t}Component name{/t}</LABEL>{$must}</td>
+      <td>
+       <input name="cn" id="cn" size=20 maxlength=60 value="{$cn}">
+      </td>
+     </tr>
+       </table>
+{/if}
diff --git a/gosa-core/plugins/admin/systems/phone.tpl b/gosa-core/plugins/admin/systems/phone.tpl
new file mode 100644 (file)
index 0000000..58fdd60
--- /dev/null
@@ -0,0 +1,57 @@
+<table summary="" width="100%">
+ <tr>
+  <td style="vertical-align:top; width:50%; border-right:1px solid #A0A0A0">
+       <table summary="">
+        <tr>
+         <td><LABEL for="cn">{t}Phone name{/t}</LABEL>{$must}</td>
+         <td>
+{render acl=$cnACL}
+          <input id="cn" name="cn" size=20 maxlength=60 value="{$cn}">
+{/render}
+         </td>
+        </tr>
+        <tr>
+          <td colspan=2>&nbsp;</td>
+        </tr>
+        <tr>
+         <td><LABEL for="base">{t}Base{/t}</LABEL>{$must}</td>
+         <td>
+{render acl=$baseACL}
+      <select id="base" size="1" name="base" title="{t}Choose subtree to place group in{/t}">
+       {html_options options=$bases selected=$base_select}
+      </select>
+{/render}
+{render acl=$baseACL disable_picture='images/folder_gray.png'}
+        <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
+{/render}
+          </td>
+         </tr>
+       </table>
+  </td>
+  <td style="vertical-align:top">
+       <table summary="">
+        <tr>
+         <td><LABEL for="description">{t}Description{/t}</LABEL></td>
+         <td>
+{render acl=$descriptionACL}
+          <input name="description" id="description" size=25 maxlength=80 value="{$description}">
+{/render}
+          </td>
+        </tr>
+       </table>
+  </td>
+ </tr>
+</table>
+
+<p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
+{include file="$phonesettings"}
+
+<p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
+{$netconfig}
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('cn');
+  -->
+</script>
diff --git a/gosa-core/plugins/admin/systems/phonesettings.tpl b/gosa-core/plugins/admin/systems/phonesettings.tpl
new file mode 100644 (file)
index 0000000..19385ac
--- /dev/null
@@ -0,0 +1,260 @@
+<h2><img class="center" alt="" align="middle" src="images/select_phone.png"> {t}Advanced phone settings{/t}</h2>
+
+<table summary="" style="width:100%" border=0>
+       <tr>
+               <td colspan="2">
+               <LABEL for="selected_categorie">{t}Phone type{/t}</LABEL>{$staticAddress}
+{render acl=$categorieACL}
+               <select id="selected_categorie" size="1" name="selected_categorie" title="{t}Choose a phone type{/t}" onchange="mainform.submit();">
+                       {html_options options=$categories selected=$selected_categorie}
+               </select>
+{/render}
+               {if $javascript eq 'false'}
+                       <input type="submit" value="{t}refresh{/t}" name="refresh">
+               {/if}
+               <br>
+               <br>
+       </td>
+       </tr>
+{if $selected_categorie eq '0'}
+       <tr>
+               <td style="width:50%; border-right:1px solid #A0A0A0">
+                       <table summary="" border=0>
+                        <tr>
+                               <td>
+                                       <LABEL for="goFonType">{t}Mode{/t}</LABEL>{$staticAddress}
+                                       
+                               </td>
+                               <td>
+{render acl=$goFonTypeACL}
+                                       <select id="goFonType" size="1" name="goFonType" title="{t}Choose a phone type{/t}" style="width:200px;" {$goFonTypeUSED}>
+                                               {html_options options=$goFonTypes selected=$goFonType}
+                                       </select>
+{/render}
+                               </td>
+                        </tr>
+                        <tr>
+                               <td >
+                                       <LABEL for="goFonDmtfMode">{t}DTMF mode{/t}</LABEL>
+                               </td>
+                               <td>
+{render acl=$goFonDmtfModeACL}
+                                       <select size="1" id="goFonDmtfMode" name="goFonDmtfMode" title="{t}Choose a phone type{/t}" style="width:200px;" {$goFonDmtfModeUSED}>
+                                               {html_options options=$goFonDmtfModes selected=$goFonDmtfMode}
+                                       </select>
+{/render}
+                               </td>
+                       </tr>
+               </table>
+          </td>
+          <td>
+               <table summary="" border=0>
+                       <tr>
+                               <td >
+                                       <LABEL for="goFonDefaultIP">{t}Default IP{/t}</LABEL>
+                               </td>
+                <td>
+{render acl=$goFonDefaultIPACL}
+                    <select id="goFonDefaultIP" size="1" name="goFonDefaultIP" title="{t}Choose a phone type{/t}" style="width:200px;" >
+                        {html_options options=$goFonDefaultIPs selected=$goFonDefaultIP}
+                    </select>
+{/render}
+                   </td>
+                       </tr>
+                       <tr>
+                               <td >
+                                       <LABEL for="goFonQualify">{t}Response timeout{/t}</LABEL>
+                               </td>
+                               <td>
+{render acl=$goFonQualifyACL}
+                                       <input id="goFonQualify" style="width:200px" name="goFonQualify" value="{$goFonQualify}" {$goFonQualifyUSED}>
+{/render}
+                               </td>
+                       </tr>
+                       </table>
+               </td>
+        </tr>
+</table>
+{/if}
+
+{if $selected_categorie eq '1'}
+               
+       <tr>
+               <td style="vertical-align:top; width:50%; border-right:1px solid #A0A0A0">
+                       <table summary="" width="100%">
+                        <tr>
+                               <td>
+                                       <LABEL for="goFonType">{t}Modus{/t}{$staticAddress}</LABEL>
+                               </td>
+                               <td >
+{render acl=$goFonTypeACL}
+                                       <select size="1" id="goFonType" name="goFonType" title="{t}Choose a phone type{/t}" style="width:200px;" {$goFonTypeUSED}>
+                                               {html_options options=$goFonTypes selected=$goFonType}
+                                       </select>
+{/render}
+                               </td>
+                        </tr>
+                       <tr>
+                               <td >
+                                       <LABEL for="goFonDefaultIP">{t}Default IP{/t}</LABEL>
+                               </td>
+                               <td>
+{render acl=$goFonDefaultIPACL}
+                                       <input id="goFonDefaultIP" style="width:200px" name="goFonDefaultIP" value="{$goFonDefaultIP}" {$goFonDefaultIPUSED}>
+{/render}
+                               </td>
+                       </tr>
+                       <tr>
+                               <td >
+                                       <LABEL for="goFonQualify">{t}Response timeout{/t}</LABEL>
+                               </td>
+                               <td>
+{render acl=$goFonQualifyACL}
+                                       <input id="goFonQualify" style="width:200px" name="goFonQualify" value="{$goFonQualify}" {$goFonQualifyUSED}>
+{/render}
+                               </td>
+                       </tr>
+                       <tr>
+                               <td colspan=2>
+                                       &nbsp;                                  
+                               </td>
+                       </tr>
+                       <tr>
+                               <td>
+                                       <LABEL for="goFonAuth">{t}Authtype{/t}</LABEL>
+                               </td>
+                               <td>
+{render acl=$goFonAuthACL}
+                                       <select size="1" id="goFonAuth" name="goFonAuth" title="{t}Choose a phone type{/t}" style="width:200px;" {$goFonAuthUSED}>
+                                               {html_options options=$goFonAuths selected=$goFonAuth}
+                                       </select>
+{/render}
+                               </td>
+                       </tr>
+                       <tr>
+                               <td>    
+                                        <LABEL for="goFonSecret">{t}Secret{/t}</LABEL>
+                               </td>
+                               <td>
+{render acl=$goFonSecretACL}
+                                       <input id="goFonSecret" style="width:200px" name="goFonSecret" value="{$goFonSecret}" {$goFonSecretUSED}>
+{/render}
+                               </td>
+                       </tr>
+<!--                   <tr>
+                               <td>
+                                        {t}GoFonInkeys{/t}
+                               </td>
+                               <td>
+                                       <input style="width:200px" name="goFonInkeys" value="{$goFonInkeys}" {$goFonInkeysUSED}>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td>
+                                        {t}GoFonOutKeys{/t}
+                               </td>
+                               <td>
+                                       <input style="width:200px" name="goFonOutkey" value="{$goFonOutkey}" {$goFonOutkeyUSED}>
+                               </td>
+                       </tr> -->
+                       <tr>
+                <td colspan=2>
+                                       &nbsp;
+                </td>
+            </tr>
+            <tr>
+                <td>
+                    <LABEL for="goFonAccountCode">{t}Account code{/t}</LABEL>
+                </td>
+                <td>
+{render acl=$goFonAccountCodeACL}
+                    <input id="goFonAccountCode" style="width:200px" name="goFonAccountCode" value="{$goFonAccountCode}" {$goFonAccountCodeUSED}>
+{/render}
+                </td>
+            </tr>
+            <tr>
+                <td>
+                    <LABEL for="goFonTrunk">{t}Trunk lines{/t}</LABEL>
+                </td>
+                <td>
+{render acl=$goFonTrunkACL}
+                     <select size="1" id="goFonTrunk" name="goFonTrunk" title="{t}Choose a phone type{/t}" {$goFonTrunkUSED}>
+                        {html_options options=$goFonTrunks selected=$goFonTrunk}
+                     </select>
+{/render}
+                 </td>
+            </tr>
+
+                       </table>
+               </td>
+               <td valign="top" style="vertical-align:top">
+                        <table summary="" width="100%">
+               <tr>
+                    <td style="vertical-align:top;">
+                        <LABEL for="goFonPermitS">{t}Hosts that are allowed to connect{/t}</LABEL><br>
+{render acl=$goFonPermitACL}
+                        <select id="goFonPermitS" style="width:100%; height:80px;" name="goFonPermitS" size=15
+                            multiple title="{t}List of alternative mail addresses{/t}">
+                            {html_options values=$goFonPermit output=$goFonPermit}
+                            <option disabled>&nbsp;</option>
+                        </select>
+{/render}
+                        <br>
+{render acl=$goFonPermitACL}
+                            <input name="goFonPermitNew" size=30 align="middle" maxlength="65" value="">
+{/render}
+{render acl=$goFonPermitACL}
+                        <input type=submit value="{t}Add{/t}" name="goFonPermitAdd">
+{/render}
+{render acl=$goFonPermitACL}
+                        <input type=submit value="{t}Delete{/t}" name="goFonPermitDel">
+{/render}
+                                               <br><br>
+                    </td>
+                </tr>
+                               <tr>
+                    <td style="vertical-align:top;">
+                       <LABEL for="goFonDenyS">{t}Hosts that are not allowed to connect{/t}</LABEL><br>
+{render acl=$goFonDenyACL}
+                        <select id="goFonDenyS" style="width:100%; height:80px;" name="goFonDenyS" size=15
+                            multiple title="{t}List of alternative mail addresses{/t}">
+                            {html_options values=$goFonDeny output=$goFonDeny}
+                            <option disabled>&nbsp;</option>
+                        </select>
+{/render}
+                        <br>
+{render acl=$goFonDenyACL}
+                            <input name="goFonDenyNew" size=30 align="middle" maxlength="65" value="">
+{/render}
+{render acl=$goFonDenyACL}
+                        <input type=submit value="{t}Add{/t}" name="goFonDenyAdd">
+{/render}
+{render acl=$goFonDenyACL}
+                        <input type=submit value="{t}Delete{/t}" name="goFonDenyDel">
+{/render}
+                    </td>
+                </table>
+    </tr>
+</table>
+{/if}
+
+{if $selected_categorie eq '2'}
+       <tr>
+               <td style="width:50%">
+                       <table summary="" width="100%">
+                               <tr>
+                                       <td>
+                                               <LABEL for="goFonMSN">{t}MSN{/t}</LABEL>&nbsp;
+{render acl=$goFonMSNACL}
+                                               <input id="goFonMSN" style="width:200px" name="goFonMSN" value="{$goFonMSN}" {$goFonMSNUSED}>
+{/render}
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+               <td>
+                       &nbsp;
+               </td>
+       </tr>
+</table>
+{/if}
diff --git a/gosa-core/plugins/admin/systems/ppd/class_printerPPDDialog.inc b/gosa-core/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/gosa-core/plugins/admin/systems/ppd/class_printerPPDSelectionDialog.inc b/gosa-core/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/gosa-core/plugins/admin/systems/ppd/printerPPDDialog.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/ppd/printerPPDSelectionDialog.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/ppd/remove_ppd.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/printer.tpl b/gosa-core/plugins/admin/systems/printer.tpl
new file mode 100644 (file)
index 0000000..e4ba965
--- /dev/null
@@ -0,0 +1,150 @@
+<table summary="" width="100%">
+ <tr>
+  <td style="vertical-align:top; width:50%; border-right:1px solid #B0B0B0">
+{if $StandAlone }
+   <h2>{t}General{/t}</h2>
+   <table summary="">
+    <tr>
+     <td><LABEL for="cn" >{t}Printer name{/t}</LABEL>{$must}</td>
+     <td>
+{render acl=$cnACL}
+      <input name="cn" id="cn" size=20 maxlength=60 value="{$cn}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><LABEL for="description">{t}Description{/t}</LABEL></td>
+     <td>
+{render acl=$descriptionACL}
+      <input id="description" name="description" size=25 maxlength=80 value="{$description}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+      <td colspan=2>&nbsp;</td>
+    </tr>
+    <tr>
+     <td><LABEL for="base">{t}Base{/t}</LABEL>{$must}</td>
+     <td>
+{render acl=$baseACL}
+      <select id="base" size="1" name="base" title="{t}Choose subtree to place user in{/t}">
+       {html_options options=$bases selected=$base_select}
+      </select>
+{/render}
+{render acl=$baseACL disable_picture='images/folder_gray.png'}
+      <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
+{/render}
+     </td>
+    </tr>
+   </table>
+  </td>
+  <td>
+{/if}
+   <h2>{t}Details{/t}</h2>
+   <table summary="">
+     <tr>
+       <td><LABEL for="l">{t}Printer location{/t}</LABEL></td>
+       <td>
+{render acl=$lACL}
+        <input id="l" name="l" size=25 maxlength=80 value="{$l}">
+{/render}
+       </td>
+     </tr>
+     <tr>
+       <td><LABEL for="labeledURI">{t}Printer URL{/t}</LABEL>{$must}</td>
+       <td>
+{render acl=$labeledURIACL}
+        <input id="labeledURI" name="labeledURI" size=25 maxlength=80 value="{$labeledURI}">
+{/render}
+       </td>
+     </tr>
+   </table>
+   <table summary="">
+    <tr> 
+     <td>
+      <br>
+      {t}Driver{/t}: <i>{$driverInfo}</i>&nbsp;
+{render acl=$gotoPrinterPPDACL mode=read_active}
+       <input type="submit" name="EditDriver" value="{t}Edit{/t}">
+{/render}
+{render acl=$gotoPrinterPPDACL}
+       <input type="submit" name="RemoveDriver" value="{t}Remove{/t}">
+{/render}
+     </td>
+    </tr>
+   </table>
+  </td>
+ </tr>
+</table>
+
+<p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
+
+<h2><img class="center" alt="" align="middle" src="images/closedlock.png"> {t}Permissions{/t}</h2>
+<table summary="" width="100%">
+ <tr>
+  <td style="border-right:1px solid #B0B0B0; width:50%">
+   <table style="width:100%" summary=''>
+    <tr>
+     <td>
+      {t}Users which are allowed to use this printer{/t}<br>
+{render acl=$gotoUserPrinterACL}
+      <select size="1" name="UserMember[]" title="{t}Users{/t}" style="width:100%;height:120px;"  multiple>
+       {html_options options=$UserMembers values=$UserMemberKeys}
+      </select><br>
+{/render}
+{render acl=$gotoUserPrinterACL}
+      <input type="submit" value="{t}Add user{/t}"  name="AddUser">
+{/render}
+{render acl=$gotoUserPrinterACL}
+      <input type="submit" value="{t}Add group{/t}" name="AddGroup">
+{/render}
+{render acl=$gotoUserPrinterACL}
+      <input type="submit" value="{t}Delete{/t}" name="DelUser">
+{/render}
+     </td>
+    </tr>
+   </table> 
+  </td>
+  <td>
+   <table style="width:100%" summary=''>
+    <tr>
+     <td>
+      {t}Users which are allowed to administrate this printer{/t}<br>
+{render acl=$gotoUserPrinterACL}
+           <select size="1" name="AdminMember[]" title="{t}Admins{/t}" style="width:100%;height:120px;"  multiple>
+                    {html_options options=$AdminMembers values=$AdminMemberKeys}
+                   </select><br>
+{/render}
+{render acl=$gotoUserPrinterACL}
+       <input type="submit" value="{t}Add user{/t}"  name="AddAdminUser">
+{/render}
+{render acl=$gotoUserPrinterACL}
+       <input type="submit" value="{t}Add group{/t}" name="AddAdminGroup">
+{/render}
+{render acl=$gotoUserPrinterACL}
+       <input type="submit" value="{t}Delete{/t}" name="DelAdmin">
+{/render}
+  
+     </td>
+    </tr>
+   </table>
+   
+  </td>
+ </tr>
+</table>
+
+
+{if $netconfig ne ''}
+<p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
+{$netconfig}
+{/if}
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+
+  <!-- // First input field on page
+  if(document.mainform.cn)
+       focus_field('cn');
+  -->
+</script>
diff --git a/gosa-core/plugins/admin/systems/remove.tpl b/gosa-core/plugins/admin/systems/remove.tpl
new file mode 100644 (file)
index 0000000..dc5dbb2
--- /dev/null
@@ -0,0 +1,23 @@
+<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 system and setup informations. 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">
+       {if $multiple}
+               <input type=submit name="delete_multiple_system_confirm" value="{t}Delete{/t}">
+               &nbsp;
+               <input type=submit name="delete_multiple_system_cancel" value="{t}Cancel{/t}">
+       {else}
+               <input type=submit name="delete_terminal_confirm" value="{t}Delete{/t}">
+               &nbsp;
+               <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
+       {/if}
+</p>
diff --git a/gosa-core/plugins/admin/systems/selectUserToPrinterDialog.tpl b/gosa-core/plugins/admin/systems/selectUserToPrinterDialog.tpl
new file mode 100644 (file)
index 0000000..c60be22
--- /dev/null
@@ -0,0 +1,70 @@
+    <input type="hidden" name="dialogissubmitted" value="1">
+
+       <table summary="{t}Select printer to add{/t}" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
+        <tr>
+            <td style="width:600px">
+                               <div class="contentboxh" style="height:20px;">
+                               <p class="contentboxh" style="font-size:12px">
+                                       <b><LABEL for="gotoPrinter">{t}Select entries to add{/t}</LABEL></b>
+                               </p>
+                               </div>
+                               <div class="contentboxb">
+                               <p class="contentboxb" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+                               <select style="width:600px;height:450px;" size=20 name="gotoPrinter[]" id="gotoPrinter" multiple>
+                               {html_options values=$gotoPrinterKeys output=$gotoPrinters}
+                               <option disabled>&nbsp;</option>
+                                        </select><br>
+                                       </p>
+                               </div>
+            </td>
+            <td valign="top">
+                               <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;background-color:#F8F8F8">
+                               {$alphabet}
+                               </table>
+                                       <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+                                               <tr>
+                                                       <td>
+                                                               <input type='checkbox' name='SubSearch' value='1' title='{t}Select to search within subtrees{/t}' onClick='document.mainform.submit();' {$subtree}>&nbsp;{t}Search in subtrees{/t}
+                                                       </td>
+                                               </tr>
+                                       </table>
+                               <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+                                       <tr>
+                                               <td>
+                                                       <label for="dspselectPrinter"><img class="center" alt="" src="{$tree_image}" align="middle" title="{t}Display members of department{/t}"></label>
+                                               </td>
+                                               <td style="width:99%">
+                                                       <select style="width:99%" name="depselectPrinter" size=1 onChange="mainform.submit()" title="{t}Choose the department the search will be based on{/t}">
+                                                         {html_options options=$deplistPrinter selected=$depselectPrinter}
+                                                       </select>
+                                               </td>
+                                       </tr>
+                               </table>
+                                       <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+                                                       <tr>
+                                                               <td>
+                                                                       <LABEL for='filter'><img class="center" alt="Search" src="{$search_image}" align="middle" title="{t}Display members matching{/t}">
+                                                                       </LABEL>
+                                                               </td>
+                                                       <td width="99%">
+                                                                       <input id='filter' style='width:99%' type='text' name='regexPrinter' maxlength='20' value='{$regexPrinter}' 
+                                                                                       title='{t}Regular expression for matching member names{/t}' onChange="mainform.submit()">
+                                                               </td>
+                                                       </tr>
+                                               </table>
+                                       {$apply}
+                               </div>
+               </td>
+       </tr>
+    </table>
+
+       <p class="seperator">&nbsp;</p>
+    <p align="right">
+    <input type="submit" name="PrinterSave"     value="{t}Add{/t}">
+    <input type="submit" name="PrinterCancel"   value="{t}Cancel{/t}">
+    </p>
+
diff --git a/gosa-core/plugins/admin/systems/server.tpl b/gosa-core/plugins/admin/systems/server.tpl
new file mode 100644 (file)
index 0000000..4e2d9b6
--- /dev/null
@@ -0,0 +1,85 @@
+<table summary="" width="100%">
+ <tr>
+  <td style="vertical-align:top; width:50%;">
+       <table summary="">
+        <tr>
+         <td><LABEL for="cn">{t}Server name{/t}</LABEL>{$must}</td>
+         <td>
+{render acl=$cnACL}
+          <input name="cn" id="cn" size=20 maxlength=60 value="{$cn}">
+{/render}
+         </td>
+        </tr>
+        <tr>
+         <td><LABEL for="description">{t}Description{/t}</LABEL></td>
+         <td>
+{render acl=$descriptionACL}
+           <input name="description" id="description" size=25 maxlength=80 value="{$description}">
+{/render}
+          </td>
+        </tr>
+        <tr>
+         <td><br><LABEL for="base">{t}Base{/t}</LABEL>{$must}</td>
+         <td>
+          <br>
+{render acl=$baseACL}
+      <select id="base" size="1" name="base" title="{t}Choose subtree to place group in{/t}">
+       {html_options options=$bases selected=$base_select}
+      </select>
+{/render}
+
+{render acl=$baseACL disable_picture='images/folder_gray.png'}
+        <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
+{/render}
+          </td>
+         </tr>
+       </table>
+  </td>
+  <td  style="vertical-align:top;border-left:1px solid #A0A0A0;">
+       <table summary="">
+       <tr>
+     <td>{t}Mode{/t}</td>
+     <td>
+{render acl=$gotoModeACL}
+      <select name="gotoMode" title="{t}Select terminal mode{/t}">
+       {html_options options=$modes selected=$gotoMode}
+      </select>
+{/render}
+     </td>
+    </tr>
+       </table>
+  </td>
+ </tr>
+</table>
+
+<p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
+
+{$netconfig}
+
+{if $fai_activated}
+<p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
+
+<h2><img class="center" alt="" align="middle" src="images/rocket.png"> {t}Action{/t}</h2>
+<table summary="">
+ <tr>
+  <td>
+{render acl=$FAIstateACL}
+   <select size="1" name="saction" title="{t}Select action to execute for this server{/t}">
+    <option disabled>&nbsp;</option>
+    {html_options options=$actions}
+   </select>
+{/render}
+  </td>
+  <td>
+   <input type=submit name="action" value="{t}Execute{/t}">
+  </td>
+ </tr>
+</table>
+{/if}
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('cn');
+  -->
+</script>
diff --git a/gosa-core/plugins/admin/systems/services/ServiceAddDialog.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/class_ServiceAddDialog.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/class_goService.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/cups/class_goCupsServer.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/cups/goCupsServer.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/dhcp/class_dhcpAdvanced.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/dhcp/class_dhcpGroup.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/dhcp/class_dhcpHost.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/dhcp/class_dhcpNetwork.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/dhcp/class_dhcpNewSectionDialog.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/dhcp/class_dhcpPool.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/dhcp/class_dhcpService.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/dhcp/class_dhcpSharedNetwork.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/dhcp/class_dhcpSubnet.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/dhcp/class_servDHCP.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/dhcp/dhcpNewSection.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/dhcp/dhcp_advanced.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/dhcp/dhcp_group.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/dhcp/dhcp_host.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/dhcp/dhcp_network.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/dhcp/dhcp_pool.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/dhcp/dhcp_service.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/dhcp/dhcp_sharedNetwork.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/dhcp/dhcp_subnet.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/dhcp/remove_dhcp.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/dhcp/servdhcp.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/dns/class_servDNS.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/dns/class_servDNSeditZone.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/dns/class_servDNSeditZoneEntries.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/dns/class_termDNS.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/dns/servDNSeditZoneEntries.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/dns/servdns.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/dns/servdnseditzone.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/glpi/class_glpiAccount.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/glpi/class_glpiAttachmentPool.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/glpi/class_glpiDeviceManagement.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/glpi/class_glpiManufacturer.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/glpi/class_glpiPrinterAccount.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/glpi/class_glpiPrinterCartridges.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/glpi/class_glpiPrinterCartridgesEdit.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/glpi/class_glpiSelectUser.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/glpi/class_goGlpiServer.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/glpi/glpi.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/glpi/glpiAttachmentEdit.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/glpi/glpiAttachmentPool.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/glpi/glpiDeviceManagement.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/glpi/glpiManufacturer.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/glpi/glpiManufacturerAdd.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/glpi/glpiPrinter.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/glpi/glpiPrinterCartridges.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/glpi/glpiPrinterCartridgesEdit.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/glpi/glpiSelectUser.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/glpi/glpi_devices.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/glpi/glpi_edit_cartridge_type.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/glpi/glpi_edit_os.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/glpi/glpi_edit_printer_type.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/glpi/glpi_edit_type.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/glpi/goGlpiServer.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/glpi/remove_glpi.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/gofax/class_goFaxServer.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/gofax/goFaxServer.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/gofon/class_goFonServer.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/gofon/goFonServer.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/imap/class_goImapServer.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/imap/goImapServer.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/kerberos/class_goKrbServer.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/kerberos/goKrbServer.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/kiosk/class_goKioskService.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/kiosk/goKioskService.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/kolab/class_servKolab.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/kolab/servkolab.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/ldap/class_goLdapServer.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/ldap/goLdapServer.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/log/class_gosaLogServer.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/log/gosaLogServer.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/mail/class_goMailServer.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/mail/goMailServer.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/nfs/class_servNfs.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/nfs/servnfs.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/ntp/class_goNtpServer.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/ntp/goNtpServer.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/repository/class_servRepository.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/repository/class_servRepositorySetup.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/repository/servRepository.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/repository/servRepositorySetup.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/shares/class_goShareServer.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/shares/goShareServer.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/spam/class_goSpamServer.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/spam/class_goSpamServerRule.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/spam/goSpamServer.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/spam/goSpamServerRule.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/syslog/class_goLogDBServer.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/syslog/class_goSyslogServer.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/syslog/goLogDBServer.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/syslog/goSyslogServer.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/terminal/class_goTerminalServer.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/terminal/goTerminalServer.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/services/virus/class_goVirusServer.inc b/gosa-core/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/gosa-core/plugins/admin/systems/services/virus/goVirusServer.tpl b/gosa-core/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/gosa-core/plugins/admin/systems/tabs_arpnewdevice.inc b/gosa-core/plugins/admin/systems/tabs_arpnewdevice.inc
new file mode 100644 (file)
index 0000000..fe12b40
--- /dev/null
@@ -0,0 +1,19 @@
+<?php
+
+class ArpNewDeviceTabs extends tabs
+{
+
+  function save($ignore_account= FALSE)
+  {
+    tabs::save($ignore_account);
+  }
+
+  function execute()
+  {
+    tabs::execute(); 
+    return($this->by_object[$this->current]->execute());
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/systems/tabs_component.inc b/gosa-core/plugins/admin/systems/tabs_component.inc
new file mode 100644 (file)
index 0000000..941203e
--- /dev/null
@@ -0,0 +1,41 @@
+<?php
+
+class componenttabs extends tabs
+{
+
+  function componenttabs($config, $data, $dn,$category)
+  {
+    tabs::tabs($config, $data, $dn,$category);
+
+    /* Add references/acls/snapshots */
+    $this->addSpecialTabs();
+  }
+
+  function save_object($save_current= FALSE)
+  {
+    tabs::save_object($save_current);
+  }
+
+
+  function save($ignore_account= FALSE)
+  {
+    /* Check for new 'dn', in order to propagate the
+       'dn' to all plugins */
+    $baseobject= $this->by_object['componentGeneric'];
+    $this->dn= "cn=$baseobject->cn,ou=netdevices,ou=systems,".$baseobject->base;
+    $baseobject->dn= $this->dn;
+
+    foreach ($this->by_object as $key => $obj){
+      $this->by_object[$key]->dn= $this->dn;
+    }
+
+    tabs::save(TRUE);
+
+    /* Fix tagging if needed */
+    $baseobject->handle_object_tagging();
+  }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/systems/tabs_phone.inc b/gosa-core/plugins/admin/systems/tabs_phone.inc
new file mode 100644 (file)
index 0000000..13d5ac3
--- /dev/null
@@ -0,0 +1,41 @@
+<?php
+
+class phonetabs extends tabs
+{
+
+  function phonetabs($config, $data, $dn,$category)
+  {
+    tabs::tabs($config, $data, $dn,$category);
+
+    /* Add references/acls/snapshots */
+    $this->addSpecialTabs();
+  }
+
+  function save_object($save_current= FALSE)
+  {
+    tabs::save_object($save_current);
+  }
+
+
+  function save($ignore_account= FALSE)
+  {
+    /* Check for new 'dn', in order to propagate the
+       'dn' to all plugins */
+    $baseobject= $this->by_object['phoneGeneric'];
+    $this->dn= "cn=$baseobject->cn,ou=phones,ou=systems,".$baseobject->base;
+    $baseobject->dn= $this->dn;
+
+    foreach ($this->by_object as $key => $obj){
+      $this->by_object[$key]->dn= $this->dn;
+    }
+
+    tabs::save(TRUE);
+
+    /* Fix tagging if needed */
+    $baseobject->handle_object_tagging();
+  }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/systems/tabs_printers.inc b/gosa-core/plugins/admin/systems/tabs_printers.inc
new file mode 100644 (file)
index 0000000..92963d6
--- /dev/null
@@ -0,0 +1,65 @@
+<?php
+
+class printtabs extends tabs
+{
+
+  function printtabs($config, $data, $dn,$category)
+  {
+
+    /* Save dn */
+    $this->dn= $dn;
+    $this->config= $config;
+
+    $baseobject= NULL;
+
+    foreach ($data as $tab){
+      $this->by_name[$tab['CLASS']]= $tab['NAME'];
+
+      if ($baseobject === NULL){
+        $baseobject= new $tab['CLASS']($this->config, $this->dn,NULL,$this);
+        $this->by_object[$tab['CLASS']]= $baseobject;
+      } else {
+        $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn, $baseobject,$this);
+      }
+
+      $this->by_object[$tab['CLASS']]->parent= &$this;
+      $this->by_object[$tab['CLASS']]->set_acl_category($category);
+
+      /* Initialize current */
+      if ($this->current == ""){
+        $this->current= $tab['CLASS'];
+      }
+    }
+
+    /* Add references/acls/snapshots */
+    $this->addSpecialTabs();
+  }
+
+  function save_object($save_current= FALSE)
+  {
+    tabs::save_object($save_current);
+  }
+
+
+  function save($ignore_account= FALSE)
+  {
+    /* Check for new 'dn', in order to propagate the
+       'dn' to all plugins */
+    $baseobject= $this->by_object['printgeneric'];
+    $this->dn= "cn=$baseobject->cn,ou=printers,ou=systems,".$baseobject->base;
+    $baseobject->dn= $this->dn;
+
+    foreach ($this->by_object as $key => $obj){
+      $this->by_object[$key]->dn= $this->dn;
+    }
+
+    tabs::save(FALSE);
+
+    /* Fix tagging if needed */
+    $baseobject->handle_object_tagging();
+  }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/systems/tabs_server.inc b/gosa-core/plugins/admin/systems/tabs_server.inc
new file mode 100644 (file)
index 0000000..564e925
--- /dev/null
@@ -0,0 +1,70 @@
+<?php
+
+class servtabs extends tabs
+{
+
+  function servtabs($config, $data, $dn,$category)
+  {
+    /* Save dn */
+    $this->dn= $dn;
+    $this->config= $config;
+
+    $baseobject= NULL;
+
+    foreach ($data as $tab){
+      $this->by_name[$tab['CLASS']]= $tab['NAME'];
+
+      if ($baseobject === NULL){
+        $baseobject= new $tab['CLASS']($this->config, $this->dn,NULL,$this);
+        $this->by_object[$tab['CLASS']]= $baseobject;
+      } else {
+        $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn, $baseobject,$this);
+      }
+
+      $this->by_object[$tab['CLASS']]->parent= &$this;
+      $this->by_object[$tab['CLASS']]->set_acl_category($category);
+
+      /* Initialize current */
+      if ($this->current == ""){
+        $this->current= $tab['CLASS'];
+      }
+    }
+
+    /* Add references/acls/snapshots */
+    $this->addSpecialTabs();
+  }
+
+  function save_object($save_current= FALSE)
+  {
+    tabs::save_object($save_current);
+  }
+
+
+  function save($ignore_account= FALSE)
+  {
+    /* Check for new 'dn', in order to propagate the
+       'dn' to all plugins */
+    $baseobject= $this->by_object['servgeneric'];
+    $this->dn= "cn=$baseobject->cn,ou=servers,ou=systems,".$baseobject->base;
+    $baseobject->dn= $this->dn;
+
+    foreach ($this->by_object as $key => $obj){
+      $this->by_object[$key]->dn= $this->dn;
+      $this->by_object[$key]->cn= $baseobject->cn;
+    }
+
+    tabs::save(FALSE);
+
+    /* Reload server settings after saving */
+    $config= $_SESSION['config'];
+    $config->load_servers();
+    $_SESSION['config']= $config;
+
+    /* Fix tagging if needed */
+    $baseobject->handle_object_tagging();
+  }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/systems/tabs_terminal.inc b/gosa-core/plugins/admin/systems/tabs_terminal.inc
new file mode 100644 (file)
index 0000000..3a3b774
--- /dev/null
@@ -0,0 +1,80 @@
+<?php
+
+class termtabs extends tabs
+{
+
+  function termtabs($config, $data, $dn, $category)
+  {
+    /* Save dn */
+    $this->dn= $dn;
+    $this->config= $config;
+
+    $baseobject= NULL;
+
+    foreach ($data as $tab){
+      $this->by_name[$tab['CLASS']]= $tab['NAME'];
+
+      if ($baseobject === NULL){
+        $baseobject= new $tab['CLASS']($this->config, $this->dn,NULL,$this);
+        $this->by_object[$tab['CLASS']]= $baseobject;
+      } else {
+        $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn, $baseobject,$this);
+      }
+
+      $this->by_object[$tab['CLASS']]->parent= &$this;
+      $this->by_object[$tab['CLASS']]->set_acl_category($category);
+
+      /* Initialize current */
+      if ($this->current == ""){
+        $this->current= $tab['CLASS'];
+      }
+    }
+
+    /* Add references/acls/snapshots */
+    $this->addSpecialTabs();
+  }
+
+  function save_object($save_current= FALSE)
+  {
+    tabs::save_object($save_current);
+
+    /* Update reference, transfer variables */
+    if(isset($this->by_object['termstartup'])){
+      $this->by_object['termstartup']->gotoTerminalPath= $this->by_object['termgeneric']->gotoTerminalPath;
+    }
+    
+    $base_obj = $this->by_object['termgeneric'];
+    foreach($this->by_object as $name => $plug){
+      $this->by_object[$name]->cn = $base_obj->cn;
+    }
+  }
+
+
+  function save($ignore_account= FALSE)
+  {
+    /* Check for new 'dn', in order to propagate the
+       'dn' to all plugins */
+    $baseobject= $this->by_object['termgeneric'];
+    $this->dn= "cn=".$baseobject->cn.",ou=terminals,ou=systems,".$baseobject->base;
+    $baseobject->dn= $this->dn;
+
+    foreach ($this->by_object as $key => $obj){
+      $this->by_object[$key]->dn= $this->dn;
+      $this->by_object[$key]->cn= $baseobject->cn;
+    }
+
+    tabs::save(TRUE);
+    if(isset($this->by_object['printgeneric'])){
+      if(($this->by_object['printgeneric']->is_account==false)&&($this->by_object['printgeneric']->initially_was_account==true)){
+        $this->by_object['printgeneric']->remove_from_parent();
+      }
+    }
+
+    /* Fix tagging if needed */
+    $baseobject->handle_object_tagging();
+  }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/systems/tabs_winstation.inc b/gosa-core/plugins/admin/systems/tabs_winstation.inc
new file mode 100644 (file)
index 0000000..cada48b
--- /dev/null
@@ -0,0 +1,47 @@
+<?php
+
+class wintabs extends tabs
+{
+
+  function wintabs($config, $data, $dn,$category)
+  {
+    tabs::tabs($config, $data, $dn,$category);
+
+    /* Add references/acls/snapshots */
+    $this->addSpecialTabs();
+  }
+
+  function save_object($save_current= FALSE)
+  {
+    tabs::save_object($save_current);
+  }
+
+
+  function save($ignore_account= FALSE)
+  {
+    /* Check for new 'dn', in order to propagate the
+       'dn' to all plugins */
+
+    /* add $ to end of name if mising */
+    $baseobject= $this->by_object['wingeneric'];
+    if(!preg_match("/\\\$\$/",$baseobject->cn)){
+      $baseobject->cn .= "$";
+    }
+
+    $this->dn= "uid=$baseobject->cn,".get_winstations_ou().$baseobject->base;
+    $baseobject->dn= $this->dn;
+
+    foreach ($this->by_object as $key => $obj){
+      $this->by_object[$key]->dn= $this->dn;
+    }
+
+    tabs::save(TRUE);
+
+    /* Fix tagging if needed */
+    $baseobject->handle_object_tagging();
+  }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/systems/tabs_workstation.inc b/gosa-core/plugins/admin/systems/tabs_workstation.inc
new file mode 100644 (file)
index 0000000..6c34fd1
--- /dev/null
@@ -0,0 +1,78 @@
+<?php
+
+class worktabs extends tabs
+{
+
+  function worktabs($config, $data, $dn,$category)
+  {
+    
+    /* Save dn */
+    $this->dn= $dn;
+    $this->config= $config;
+
+    $baseobject= NULL;
+
+    foreach ($data as $tab){
+      $this->by_name[$tab['CLASS']]= $tab['NAME'];
+
+      if ($baseobject === NULL){
+        $baseobject= new $tab['CLASS']($this->config, $this->dn,NULL,$this);
+        $this->by_object[$tab['CLASS']]= $baseobject;
+      } else {
+        $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn, $baseobject,$this);
+      }
+
+      $this->by_object[$tab['CLASS']]->parent= &$this;
+      $this->by_object[$tab['CLASS']]->set_acl_category($category);
+
+      /* Initialize current */
+      if ($this->current == ""){
+        $this->current= $tab['CLASS'];
+      }
+    }
+
+    /* Add references/acls/snapshots */
+    $this->addSpecialTabs();
+  }
+
+  function save_object($save_current= FALSE)
+  {
+    tabs::save_object($save_current);
+
+    /* Assign current cn */
+    $baseobject= $this->by_object['workgeneric'];
+    foreach ($this->by_object as $key => $obj){
+      $this->by_object[$key]->cn= $baseobject->cn;
+    }
+  }
+
+
+  function save($ignore_account= FALSE)
+  {
+    /* Check for new 'dn', in order to propagate the
+       'dn' to all plugins */
+    $baseobject= $this->by_object['workgeneric'];
+    $this->dn= "cn=".$baseobject->cn.",ou=workstations,ou=systems,".$baseobject->base;
+    $baseobject->dn= $this->dn;
+
+    foreach ($this->by_object as $key => $obj){
+      $this->by_object[$key]->dn= $this->dn;
+      $this->by_object[$key]->cn= $baseobject->cn;
+    }
+
+    tabs::save(TRUE);
+
+    if(isset($this->by_object['printgeneric'])){
+      if(($this->by_object['printgeneric']->is_account==false)&&($this->by_object['printgeneric']->initially_was_account==true)){
+        $this->by_object['printgeneric']->remove_from_parent();
+      }
+    }
+
+    /* Fix tagging if needed */
+    $baseobject->handle_object_tagging();
+  }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/systems/terminal.tpl b/gosa-core/plugins/admin/systems/terminal.tpl
new file mode 100644 (file)
index 0000000..dc088f8
--- /dev/null
@@ -0,0 +1,176 @@
+<h2><img class="center" alt="" align="middle" src="images/rightarrow.png"> {t}Properties{/t}</h2>
+<table summary="" style="width:100%;">
+ <tr>
+  <td style="width:50%; vertical-align:top;">
+   <table summary="">
+    <tr>
+     {if $cn eq 'default'}
+     <td colspan=2>{t}Terminal template{/t}</td>
+     {else}
+     <td><LABEL for="cn">{t}Terminal name{/t}</LABEL>{$must}</td>
+     <td>
+{render acl=$cnACL}
+      <input name="cn" id="cn" size=18 maxlength=60 value="{$cn}">
+{/render}
+     </td>
+     {/if}
+    </tr>
+    <tr>
+     <td><LABEL for="base">{t}Base{/t}</LABEL>{$must}</td>
+     <td>
+
+{render acl=$baseACL}
+      <select id="base" size="1" name="base" title="{t}Choose subtree to place group in{/t}">
+       {html_options options=$bases selected=$base_select}
+      </select>
+{/render}
+{render acl=$baseACL disable_picture='images/folder_gray.png'}
+        <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
+{/render}
+     </td>
+    </tr>
+   </table>
+{if $member_of_ogroup}
+   <br>
+   <br>
+   <br>
+   <input type='submit' name='inheritAll' value='{t}Inherit all{/t}'>
+{/if}
+  </td>
+  <td style="vertical-align:top;border-left:1px solid #A0A0A0;" >
+   <table summary="">
+    <tr>
+     <td><LABEL for="gotoMode">{t}Mode{/t}</LABEL></td>
+     <td>
+{render acl=$gotoModeACL}
+      <select id="gotoMode" name="gotoMode" title="{t}Select terminal mode{/t}">
+       {html_options options=$modes selected=$gotoMode_select}
+      </select>
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><LABEL for="gotoSyslogServer">{t}Syslog server{/t}</LABEL></td>
+     <td>
+{render acl=$gotoSyslogServerACL}
+      <select name="gotoSyslogServer" id="gotoSyslogServer" title="{t}Choose server to use for logging{/t}">
+       {html_options options=$syslogservers selected=$gotoSyslogServer_select}
+      </select>
+{/render}
+     </td>
+    </tr>
+       </table>
+  </td>
+ </tr>
+</table>
+<p class="seperator" style="margin:0px; padding:0px;">&nbsp;</p>
+<table style="width:100%;">
+ <tr>
+  <td style="width:50%;vertical-align:top;">
+   <table summary="">
+    <tr>
+     <td><LABEL for="gotoTerminalPath">{t}Root server{/t}</LABEL></td>
+     <td>
+{render acl=$gotoTerminalPathACL}
+      <select name="gotoTerminalPath" id="gotoTerminalPath" title="{t}Select NFS root filesystem to use{/t}">
+       {html_options options=$nfsservers selected=$gotoTerminalPath_select}
+      </select>
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><LABEL for="gotoSwapServer">{t}Swap server{/t}</LABEL></td>
+     <td>
+{render acl=$gotoSwapServerACL}
+      <select name="gotoSwapServer" id="gotoSwapServer" title="{t}Choose NFS filesystem to place swap files on{/t}">
+       {html_options options=$nfsservers selected=$gotoSwapServer_select}
+      </select>
+{/render}
+     </td>
+    </tr>
+   </table>
+  </td>
+  <td style="border-left:1px solid #A0A0A0;">
+       <table width="100%">
+    <tr>
+        <td colspan="2">
+{if $member_of_ogroup}
+{render acl=$gotoNtpServerACL}
+               <input type="checkbox" value="1" name="inheritTimeServer"
+                       {if $inheritTimeServer } checked {/if} 
+                       onClick="javascript:
+                                       changeState('gotoNtpServerSelected');
+                                       changeState('gotoNtpServers');
+                                       changeState('addNtpServer');
+                                       changeState('delNtpServer');">{t}Inherit time server attributes{/t}
+{/render}
+{else}
+       <input disabled type='checkbox' name='option_disabled'>{t}Inherit time server attributes{/t}
+{/if}
+        </td>
+       </tr>
+       <tr>
+     <td colspan="2" style='padding-left:14px;padding-top:5px;'><LABEL for="gotoNtpServerSelected">{t}NTP server{/t}</LABEL><br>
+{render acl=$gotoNtpServerACL}
+      <select name="gotoNtpServerSelected[]" id="gotoNtpServerSelected" multiple size=5 style="width:100%;"
+                       title="{t}Choose server to use for synchronizing time{/t}" {if $inheritTimeServer} disabled {/if}>
+       {html_options options=$gotoNtpServer_select}
+      </select>
+{/render}
+        <br>
+{render acl=$gotoNtpServerACL}
+      <select name="gotoNtpServers" id="gotoNtpServers" {if $inheritTimeServer} disabled {/if} >
+       {html_options values=$ntpservers output=$ntpservers }
+      </select>
+{/render}
+{render acl=$gotoNtpServerACL}
+               <input type="submit" name="addNtpServer" value="{t}Add{/t}"             id="addNtpServer"
+                {if $inheritTimeServer} disabled {/if}>
+{/render}
+{render acl=$gotoNtpServerACL}
+               <input type="submit" name="delNtpServer" value="{t}Delete{/t}"  id="delNtpServer" 
+                {if $inheritTimeServer} disabled {/if}>
+{/render}
+     </td>
+    </tr>
+   </table>
+
+  </td>
+ </tr>
+</table>
+
+{if $cn neq 'default'}
+<p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
+
+{$netconfig}
+{/if}
+
+{if $fai_activated}
+<p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
+<h2><img class="center" alt="" align="middle" src="images/rocket.png"> {t}Action{/t}</h2>
+<table summary="">
+ <tr>
+  <td>
+{render acl=$gotoNtpServerACL}
+   <select size="1" name="saction" title="{t}Select action to execute for this terminal{/t}">
+    <option disabled>&nbsp;</option>
+    {html_options options=$actions}
+   </select>
+{/render}
+  </td>
+  <td>
+{render acl=$gotoNtpServerACL}
+   <input type=submit name="action" value="{t}Execute{/t}">
+{/render}
+  </td>
+ </tr>
+</table>
+{/if}
+
+<input type="hidden" name="termgeneric_posted" value="1">
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('cn');
+  -->
+</script>
diff --git a/gosa-core/plugins/admin/systems/terminalService.tpl b/gosa-core/plugins/admin/systems/terminalService.tpl
new file mode 100644 (file)
index 0000000..72ba28b
--- /dev/null
@@ -0,0 +1,269 @@
+<table style="width:100%;" summary="">
+ <tr>
+  <td style="width:33%; vertical-align:top;">
+   <h2><img class="center" alt="" align="middle" src="images/keyboard.png"> {t}Keyboard{/t}</h2>
+   <table summary="">
+    <tr>
+     <td><LABEL for="gotoXKbModel">{t}Model{/t}</LABEL></td>
+     <td>
+{render acl=$gotoXKbModelACL}
+      <select id="gotoXKbModel" name="gotoXKbModel" title="{t}Choose keyboard model{/t}" >
+       {html_options options=$XKbModels selected=$gotoXKbModel_select}
+      </select>
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><LABEL for="gotoXKbLayout">{t}Layout{/t}</LABEL></td>
+     <td>
+{render acl=$gotoXKbLayoutACL}
+      <select id="gotoXKbLayout" name="gotoXKbLayout" title="{t}Choose keyboard layout{/t}" >
+       {html_options options=$XKbLayouts selected=$gotoXKbLayout_select}
+      </select>
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><LABEL for="gotoXKbVariant">{t}Variant{/t}</LABEL></td>
+     <td>
+{render acl=$gotoXKbVariantACL}
+      <select id="gotoXKbVariant" name="gotoXKbVariant" title="{t}Choose keyboard variant{/t}" >
+       {html_options options=$XKbVariants selected=$gotoXKbVariant_select}
+      </select>
+{/render}
+     </td>
+    </tr>
+   </table>
+
+  </td>
+
+  <td style="border-left:1px solid #A0A0A0">
+   &nbsp;
+  </td>
+  
+  <td style="vertical-align:top;width:32%">
+   <h2><img class="center" alt="" align="middle" src="images/mouse.png"> {t}Mouse{/t}</h2>
+   <table summary="">
+    <tr>
+     <td><LABEL for="gotoXMouseType">{t}Type{/t}</LABEL></td>
+     <td>
+{render acl=$gotoXMouseTypeACL}
+      <select name="gotoXMouseType" id="gotoXMouseType" title="{t}Choose mouse type{/t}" >
+       {html_options options=$MouseTypes selected=$gotoXMouseType_select}
+      </select>
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><LABEL for="gotoXMouseport">{t}Port{/t}</LABEL></td>
+     <td>
+{render acl=$gotoXMouseportACL}
+      <select id="gotoXMouseport" name="gotoXMouseport" title="{t}Choose mouse port{/t}" >
+       {html_options options=$MousePorts selected=$gotoXMouseport_select}
+      </select>
+{/render}
+     </td>
+    </tr>
+   </table>
+
+  </td>
+
+  <td style="border-left:1px solid #A0A0A0">
+   &nbsp;
+  </td>
+  
+  <td style="vertical-align:top;width:33%">
+   <h2><img class="center" alt="" align="middle" src="images/select_phone.png"> {t}Telephone hardware{/t}</h2>
+   <table style="width:100%" border=0 summary="">
+    <tr>
+     <td>{t}Telephone{/t}&nbsp;
+{render acl=$goFonHardwareACL}
+         {$hardware_list}
+{/render}
+     </td>
+    </tr>
+   </table>
+
+  </td>
+ </tr>
+</table>
+
+<table style="width:100%;" summary="">
+ <tr><td colspan=5><p class="plugbottom" style="text-align:left;"></p></td></tr>
+ <tr>
+   <td style="width:33%;vertical-align:top;">
+   <h2><img class="center" alt="" align="middle" src="images/hardware.png"> {t}Graphic device{/t}</h2>
+   <table summary="">
+    <tr>
+     <td><LABEL for="gotoXDriver">{t}Driver{/t}</LABEL></td>
+     <td>
+{render acl=$gotoXDriverACL}
+      <select id="gotoXDriver" name="gotoXDriver" title="{t}Choose graphic driver that is needed by the installed graphic board{/t}" >
+       {html_options values=$XDrivers output=$XDrivers selected=$gotoXDriver_select}
+      </select>
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><LABEL for="gotoXResolution">{t}Resolution{/t}</LABEL></td>
+     <td>
+{render acl=$gotoXResolutionACL}
+      <select id="gotoXResolution" name="gotoXResolution" title="{t}Choose screen resolution used in graphic mode{/t}" >
+       {html_options options=$XResolutions selected=$gotoXResolution_select}
+      </select>
+{/render }
+     </td>
+    </tr>
+    <tr>
+     <td><LABEL for="gotoXColordepth">{t}Color depth{/t}</LABEL></td>
+     <td>
+{render acl=$gotoXColordepthACL}
+      <select id="gotoXColordepth" name="gotoXColordepth" title="{t}Choose colordepth used in graphic mode{/t}" >
+       {html_options options=$XColordepths selected=$gotoXColordepth_select}
+      </select>
+{/render}
+     </td>
+    </tr>
+   </table>
+   </td>
+
+  <td style="border-left:1px solid #A0A0A0">
+   &nbsp;
+  </td>
+
+   <td style="width:32%; vertical-align:top;">
+   <h2><img class="center" alt="" align="middle" src="images/display.png"> {t}Display device{/t}</h2>
+   <table summary="">
+    <tr>
+     <td>{t}Type{/t}</td>
+     <td>{$gotoXMonitor}</td>
+    </tr>
+    <tr>
+     <td>
+{render acl=$AutoSyncACL}
+      <input type="checkbox" name="AutoSync" value="1" {$AutoSyncCHK} onChange="changeState('gotoXHsync');changeState('gotoXVsync');">
+{/render}
+     </td>
+     <td>{t}Use DDC for automatic detection{/t}</td>
+    </tr>
+    <tr>
+     <td><LABEL for="gotoXHsync">{t}HSync{/t}</LABEL></td>
+     <td>
+{render acl=$gotoXHsyncACL}
+       <input id="gotoXHsync" name="gotoXHsync" size=10 maxlength=60 
+                value="{$gotoXHsync}" title="{t}Horizontal refresh frequency for installed monitor{/t}"> kHz</td>
+{/render}
+    </tr>
+    <tr>
+     <td><LABEL for="gotoXVsync">{t}VSync{/t}</LABEL></td>
+     <td>
+{render acl=$gotoXVsyncACL}
+      <input id="gotoXVsync"  name="gotoXVsync" size=10 maxlength=60 
+                value="{$gotoXVsync}" title="{t}Vertical refresh frequency for installed monitor{/t}"> Hz</td>
+{/render}
+    </tr>
+   </table>
+
+   </td>
+  <td style="border-left:1px solid #A0A0A0">
+   &nbsp;
+  </td>
+
+  <td style="width:33%; vertical-align:top;">
+   <h2><img class="center" alt="" align="middle" src="images/server.png"> {t}Remote desktop{/t}</h2>
+   <table summary="">
+    <tr>
+     <td></td>
+     <td><LABEL for="gotoXMethod">{t}Connect method{/t}</LABEL></td>
+     <td>
+{render acl=$gotoXMethodACL}
+      <select name="gotoXMethod" id="gotoXMethod" title="{t}Choose method to connect to terminal server{/t}" >
+       {html_options options=$XMethods selected=$gotoXMethod_select}
+      </select>
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td></td>
+     <td><LABEL for="gotoXdmcpServer">{t}Terminal server{/t}</LABEL></td>
+     <td>
+{render acl=$gotoXdmcpServerACL}
+      <select id="gotoXdmcpServer" name="gotoXdmcpServer" title="{t}Select specific terminal server to use{/t}" >
+       {html_options values=$xdmcpservers output=$xdmcpservers selected=$gotoXdmcpServer_select}
+      </select>
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td></td>
+     <td><LABEL for="gotoFontPath">{t}Font server{/t}</LABEL></td>
+     <td>
+{render acl=$gotoFontPathACL}
+      <select name="gotoFontPath" id="gotoFontPath" title="{t}Select specific font server to use{/t}" >
+       {html_options values=$fontservers output=$fontservers selected=$gotoFontPath_select}
+      </select>
+{/render}
+     </td>
+    </tr>
+   </table>
+   
+  </td>
+ </tr>
+</table>
+
+<table style="width:100%;" summary="">
+ <tr><td colspan=3><p class="plugbottom" style="margin-top:0px;"></p></td></tr>
+
+ <tr>
+  <td style="width:50%; vertical-align:top;">
+   <h2><img class="center" alt="" align="middle" src="images/printer.png"><LABEL for="gotoLpdEnable"> {t}Print device{/t}</LABEL></h2>
+{render acl=$gotoLpdEnableACL}
+   <input id="gotoLpdEnable" type=checkbox name="gotoLpdEnable" value="1" {$gotoLpdEnable} title="{t}Select to start IPP based printing service on terminal{/t}">
+{/render}
+   {t}Provide print services{/t}
+   <br>
+
+   <table summary="">
+   <tr>
+     <td><div style="width:20px;"></div></td>
+     <td><LABEL for="gotoLpdServer">{t}Spool server{/t}</LABEL></td>
+     <td>
+{render acl=$gotoLpdServerACL}
+      <select name="gotoLpdServer" id="gotoLpdServer" title="{t}Select NFS filesystem to place spool files on{/t}" >
+       {html_options values=$nfsservers output=$nfsservers selected=$gotoLpdServer_select}
+      </select>
+{/render}
+     </td>
+    </tr>
+  </table>
+
+  <td style="border-left:1px solid #A0A0A0">
+   &nbsp;
+  </td>
+
+  <td style="vertical-align:top;">
+   <h2><img class="center" alt="" align="middle" src="images/scanner.png"> {t}Scan device{/t}</h2>
+{render acl=$gotoScannerEnableACL}
+   <input type=checkbox name="gotoScannerEnable" value="1" title="{t}Select to start SANE scan service on terminal{/t}" {$gotoScannerEnable} >
+{/render}
+   {t}Provide scan services{/t}
+   <br>
+   <table summary="">
+    <tr>
+     <td><div style="width:20px;"></div></td>
+     <td><LABEL for="gotoScannerModel">{t}Model{/t}</LABEL></td>
+     <td>
+{render acl=$gotoScannerEnableACL}
+      <select name="gotoScannerModel" id="gotoScannerModel" title="{t}Select scanner driver to use{/t}" >
+       {html_options values=$gotoScannerModels output=$gotoScannerModels selected=$gotoScannerModel_select}
+      </select>
+{/render}
+     </td>
+    </tr>
+  </table>
+
+  </td>
+ </tr>
+</table>
+
+<div style="height:40px;"></div>
diff --git a/gosa-core/plugins/admin/systems/terminalStartup.tpl b/gosa-core/plugins/admin/systems/terminalStartup.tpl
new file mode 100644 (file)
index 0000000..ccfacfb
--- /dev/null
@@ -0,0 +1,142 @@
+<h2><img class="center" alt="" align="middle" src="images/penguin.png"> {t}Boot parameters{/t}</h2>
+<table summary="" style="width:100%;">
+ <tr>
+  <td style="width:50%; vertical-align:top;">
+
+   <table summary="" style="width:100%">
+    <tr>
+     <td style="width:30%"><LABEL for="gotoBootKernel">{t}Boot kernel{/t}</LABEL></td>
+     <td>
+{render acl=$gotoBootKernelACL}
+       <select id="gotoBootKernel" name="gotoBootKernel">
+       {html_options options=$gotoBootKernels  selected=$gotoBootKernel}
+       <option disabled>&nbsp;</option>
+       </select>
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><LABEL for="customParameters">{t}Custom options{/t}</LABEL></td>
+     <td>
+{render acl=$gotoKernelParametersACL}
+      <input name="customParameters" id="customParameters"  size=25 maxlength=500
+                value="{$customParameters}" title="{t}Enter any parameters that should be passed to the kernel as append line during bootup{/t}"></td>
+{/render}
+    </tr>
+    <tr>
+     <td colspan="2" style='vertical-align:top;padding-top:3px;width:100%'><LABEL for="gotoLdapServer">{t}LDAP server{/t}</LABEL>
+{render acl=$gotoLdapServerACL}
+(<input type='checkbox' name='gotoLdap_inherit' {if $gotoLdap_inherit} checked {/if} value="1"
+      onClick="document.mainform.submit();" class='center'>
+&nbsp;{t}inherit from group{/t})
+{if !$JS}
+      <input type='image' src="images/list_reload.png" alt='{t}Reload{/t}' class='center'>
+{/if}
+{/render}
+{render acl=$gotoLdapServerACL_inherit}
+        {$gotoLdapServers}
+{/render}
+{render acl=$gotoLdapServerACL_inherit}
+      <select name='ldap_server_to_add' id='ldap_server_to_add'>
+        {html_options options=$gotoLdapServerList}
+    </select>
+{/render}
+{render acl=$gotoLdapServerACL_inherit}
+      <input type='submit' name='add_ldap_server' value="{t}Add{/t}" id='add_ldap_server'>
+{/render}
+     </td>
+    </tr>
+   </table>
+
+  </td>
+
+  <td style="border-left:1px solid #A0A0A0">
+     &nbsp;
+  </td>
+  
+  <td style="vertical-align:top;">
+{render acl=$gotoKernelParametersACL}
+    <input type="radio" name="bootmode" value="G" title="{t}Select if terminal supports graphical startup with progress bar{/t}" {$graphicalbootup}>
+{/render}
+    {t}use graphical bootup{/t}
+    <br>
+{render acl=$gotoKernelParametersACL}
+    <input type="radio" name="bootmode" value="T" title="{t}Select if terminal should boot in text mode{/t}" {$textbootup}>
+{/render}
+    {t}use standard linux textual bootup{/t}
+    <br>
+{render acl=$gotoKernelParametersACL}
+    <input type="radio" name="bootmode" value="D" title="{t}Select to get more verbose output during startup{/t}" {$debugbootup}>
+{/render}
+    {t}use debug mode for startup{/t}
+  </td>
+ </tr>
+</table>
+
+<table summary="" style="width:100%;">
+ <tr><td colspan=2><p class="plugbottom" style="margin-top:0px;"></p></td></tr>
+
+ <tr>
+  <td style="width:50%; vertical-align:top;">
+   <h2>
+    <img class="center" alt="" align="middle" src="images/hardware.png"> {t}Kernel modules (format: name parameters){/t}
+   </h2>
+{render acl=$gotoModulesACL}
+    <select style="width:100%;" name="modules_list[]" size=15 multiple title="{t}Add additional modules to load on startup{/t}">
+     {html_options values=$gotoModules output=$gotoModules}
+        <option disabled>&nbsp;</option>
+    </select>
+{/render}
+    <br>
+{render acl=$gotoModulesACL}
+    <input name="module" size=30 align=middle maxlength=30>
+{/render}
+{render acl=$gotoModulesACL}
+    <input type=submit value="{t}Add{/t}" name="add_module">&nbsp;
+{/render}
+{render acl=$gotoModulesACL}
+    <input type=submit value="{t}Delete{/t}" name="delete_module">
+{/render}
+  </td>
+
+  <td style="padding-left:10px;border-left:1px solid #A0A0A0;vertical-align:top">
+        <h2><img class="center" alt="" src="images/fai_partitionTable.png" align="middle">&nbsp;<LABEL for="gotoShare">{t}Shares{/t}</LABEL></h2>
+        <table summary="" style="width:100%">
+                <tr>
+                        <td>
+{render acl=$gotoShareACL}
+                        <select style="width:100%;" name="gotoShare" multiple size=15 id="gotoShare">
+                               {html_options values=$gotoShareKeys output=$gotoShares}
+                               <option disabled>&nbsp;</option>
+                        </select>
+{/render}
+                                <br>
+{render acl=$gotoShareACL}
+                               <select name="gotoShareSelection">
+                                       {html_options values=$gotoShareSelectionKeys output=$gotoShareSelections}
+                                       <option disabled>&nbsp;</option>
+                                </select>
+{/render}
+{render acl=$gotoShareACL}
+                                <input type="text" size=15 name="gotoShareMountPoint" value="{t}Mountpoint{/t}">
+{/render}
+{render acl=$gotoShareACL}
+                                <input type="submit" name="gotoShareAdd" value="{t}Add{/t}">
+{/render}
+{render acl=$gotoShareACL}
+                                <input type="submit" name="gotoShareDel" value="{t}Remove{/t}">
+{/render}
+                        </td>
+                </tr>
+        </table>
+  </td>
+ </tr>
+</table>
+<input type='hidden' name='TerminalStarttabPosted' value="1">
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('gotoLdapServer');
+  -->
+</script>
diff --git a/gosa-core/plugins/admin/systems/wingeneric.tpl b/gosa-core/plugins/admin/systems/wingeneric.tpl
new file mode 100644 (file)
index 0000000..fb58a6d
--- /dev/null
@@ -0,0 +1,42 @@
+<table summary="" width="100%">
+ <tr>
+  <td style="vertical-align:top; width:50%;">
+       <table summary="">
+        <tr>
+         <td><LABEL for="cn">{t}Machine name{/t}</LABEL>{$must}</td>
+         <td><input id="cn" name="cn" size=20 maxlength=60 value="{$cn}"></td>
+        </tr>
+        <tr>
+          <td colspan=2>&nbsp;</td>
+        </tr>
+        <tr>
+         <td><LABEL for="base">{t}Base{/t}</LABEL>{$must}</td>
+         <td>
+          <select size="1" id="base" name="base" title="{t}Choose subtree to place terminal in{/t}">
+           {html_options options=$bases selected=$base_select}
+          </select>
+               <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
+         </tr>
+       </table>
+  </td>
+  <td style="vertical-align:top">
+       <table summary="">
+        <tr>
+         <td><LABEL for="description">{t}Description{/t}</LABEL></td>
+         <td><input id="description" name="description" size=25 maxlength=80 value="{$description}"></td>
+        </tr>
+       </table>
+  </td>
+ </tr>
+</table>
+
+<p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
+
+{$netconfig}
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('cn');
+  -->
+</script>
diff --git a/gosa-core/plugins/admin/systems/workstation.tpl b/gosa-core/plugins/admin/systems/workstation.tpl
new file mode 100644 (file)
index 0000000..ba84899
--- /dev/null
@@ -0,0 +1,157 @@
+<h2><img class="center" alt="" align="middle" src="images/rightarrow.png"> {t}Properties{/t}</h2>
+<table summary="" style="width:100%;">
+ <tr>
+  <td style="width:50%; vertical-align:top;">
+   <table summary="">
+    <tr>
+{if $cn eq 'wdefault'}
+     <td colspan=2>{t}Workstation template{/t}</td>
+{else}
+     <td><LABEL for="cn">{t}Workstation name{/t}</LABEL>{$must}</td>
+     <td>
+{render acl=$cnACL}
+      <input name="cn" id="cn" size=18 maxlength=60 value="{$cn}">
+{/render}
+     </td>
+{/if}
+    </tr>
+    <tr>
+     <td><LABEL for="cn">{t}Location{/t}</LABEL></td>
+     <td>
+{render acl=$lACL}
+      <input name="l" id="l" size=18 maxlength=60 value="{$l}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><LABEL for="base">{t}Base{/t}</LABEL>{$must}</td>
+     <td>
+{render acl=$baseACL}
+      <select id="base" size="1" name="base" title="{t}Choose subtree to place group in{/t}">
+       {html_options options=$bases selected=$base_select}
+      </select>
+{/render}
+{render acl=$baseACL disable_picture='images/folder_gray.png'}
+        <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
+{/render}
+     </td>
+    </tr>
+   </table>
+{if $member_of_ogroup}
+   <br>
+   <br>
+   <br>
+   <input type='submit' name='inheritAll' value='{t}Inherit all{/t}'>
+{/if}
+  </td>
+  <td  style="vertical-align:top;border-left:1px solid #A0A0A0;">
+   <table summary="">
+    <tr>
+     <td>{t}Mode{/t}</td>
+     <td>
+{render acl=$gotoModeACL}
+      <select name="gotoMode" title="{t}Select terminal mode{/t}">
+       {html_options options=$modes selected=$gotoMode_select}
+      </select>
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><LABEL for="gotoSyslogServer">{t}Syslog server{/t}</LABEL></td>
+     <td>
+{render acl=$gotoSyslogServerACL}
+      <select id="gotoSyslogServer" name="gotoSyslogServer" title="{t}Choose server to use for logging{/t}">
+       {html_options options=$syslogservers selected=$gotoSyslogServer_select}
+      </select>
+{/render}
+     </td>
+    </tr>
+   </table>
+<p class="seperator">&nbsp;</p>
+   <table width="100%">
+    <tr>
+     <td colspan="2">
+{if $member_of_ogroup}
+{render acl=$gotoNtpServerACL}
+        <input type="checkbox" value="1" name="inheritTimeServer"
+            {if $inheritTimeServer } checked {/if}
+            onClick="javascript:
+                    changeState('gotoNtpServerSelected');
+                    changeState('gotoNtpServers');
+                    changeState('addNtpServer');
+                    changeState('delNtpServer');">{t}Inherit time server attributes{/t}
+{/render}
+{else}
+       <input disabled type='checkbox' name='option_disabled'>{t}Inherit time server attributes{/t}
+{/if}
+     </td>
+    </tr>
+    <tr>
+     <td colspan="2" style='padding-left:14px;padding-top:5px;'><LABEL for="gotoNtpServerSelected">{t}NTP server{/t}</LABEL><br>
+{render acl=$gotoNtpServerACL}
+      <select name="gotoNtpServerSelected[]" id="gotoNtpServerSelected" multiple size=5 style="width:100%;"
+            title="{t}Choose server to use for synchronizing time{/t}" {if $inheritTimeServer} disabled {/if}>
+       {html_options options=$gotoNtpServer_select}
+      </select>
+{/render}
+     <br>
+{render acl=$gotoNtpServerACL}
+      <select name="gotoNtpServers" id="gotoNtpServers" {if $inheritTimeServer} disabled {/if} >
+       {html_options options=$gotoNtpServers}
+      </select>
+{/render}
+{render acl=$gotoNtpServerACL}
+        <input type="submit" name="addNtpServer" value="{t}Add{/t}"     id="addNtpServer"
+         {if $inheritTimeServer} disabled {/if}>
+{/render}
+{render acl=$gotoNtpServerACL}
+        <input type="submit" name="delNtpServer" value="{t}Delete{/t}"  id="delNtpServer" 
+         {if $inheritTimeServer} disabled {/if}>
+{/render}
+     </td>
+    </tr>
+   </table>
+  </td>
+ </tr>
+</table>
+{if $cn neq 'wdefault'}
+<p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
+
+{$netconfig}
+{/if}
+<p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
+
+{if $fai_activated}
+<h2><img class="center" alt="" align="middle" src="images/rocket.png"> {t}Action{/t}</h2>
+<table summary="">
+ <tr>
+  <td>
+{render acl=$FAIstateACL}
+   <select size="1" name="saction" title="{t}Select action to execute for this terminal{/t}">
+    <option>&nbsp;</option>
+    {html_options options=$actions}
+   </select>
+{/render}
+  </td>
+  <td>
+   <input type=submit name="action" value="{t}Execute{/t}">
+  </td>
+ </tr>
+</table>
+{/if}
+<input type="hidden" name="workgeneric_posted" value="1">
+ {if $cn eq 'wdefault'}
+<!-- Place cursor -->
+               <script language="JavaScript" type="text/javascript">
+                 <!-- // First input field on page
+                       focus_field('l');
+                 -->
+               </script>
+     {else}
+               <script language="JavaScript" type="text/javascript">
+                 <!-- // First input field on page
+                       focus_field('cn');
+                 -->
+               </script>
+     {/if}
+
diff --git a/gosa-core/plugins/admin/systems/workstationService.tpl b/gosa-core/plugins/admin/systems/workstationService.tpl
new file mode 100644 (file)
index 0000000..e5171fe
--- /dev/null
@@ -0,0 +1,224 @@
+<table style="width:100%;" summary="">
+ <tr>
+  <td style="width:33%; vertical-align:top;">
+   <h2><img class="center" alt="" align="middle" src="images/keyboard.png"> {t}Keyboard{/t}</h2>
+   <table summary="">
+    <tr>
+     <td><LABEL for="gotoXKbModel">{t}Model{/t}</LABEL></td>
+     <td>
+
+{render acl=$gotoXKbModelACL}
+      <select id="gotoXKbModel" name="gotoXKbModel" title="{t}Choose keyboard model{/t}">
+       {html_options options=$XKbModels selected=$gotoXKbModel_select}
+      </select>
+{/render}
+
+     </td>
+    </tr>
+    <tr>
+     <td><LABEL for="gotoXKbLayout">{t}Layout{/t}</LABEL></td>
+     <td>
+
+{render acl=$gotoXKbLayoutACL}
+      <select id="gotoXKbLayout" name="gotoXKbLayout" title="{t}Choose keyboard layout{/t}">
+       {html_options options=$XKbLayouts selected=$gotoXKbLayout_select}
+      </select>
+{/render}
+
+     </td>
+    </tr>
+    <tr>
+     <td><LABEL for="gotoXKbVariant">{t}Variant{/t}</LABEL></td>
+     <td>
+
+{render acl=$gotoXKbVariantACL}
+      <select id="gotoXKbVariant" name="gotoXKbVariant" title="{t}Choose keyboard variant{/t}">
+       {html_options options=$XKbVariants selected=$gotoXKbVariant_select}
+      </select>
+{/render}
+
+     </td>
+    </tr>
+   </table>
+
+  </td>
+
+  <td style="border-left:1px solid #A0A0A0">
+   &nbsp;
+  </td>
+  
+  <td style="vertical-align:top;width:32%">
+   <h2><img class="center" alt="" align="middle" src="images/mouse.png"> {t}Mouse{/t}</h2>
+   <table summary="">
+    <tr>
+     <td><LABEL for="gotoXMouseType">{t}Type{/t}</LABEL></td>
+     <td>
+
+{render acl=$gotoXMouseTypeACL}
+      <select name="gotoXMouseType" id="gotoXMouseType" title="{t}Choose mouse type{/t}">
+       {html_options options=$MouseTypes selected=$gotoXMouseType_select}
+      </select>
+     </td>
+{/render}
+
+    </tr>
+    <tr>
+     <td><LABEL for="gotoXMouseport">{t}Port{/t}</LABEL></td>
+     <td>
+
+{render acl=$gotoXMouseportACL}
+      <select id="gotoXMouseport" name="gotoXMouseport" title="{t}Choose mouse port{/t}">
+       {html_options options=$MousePorts selected=$gotoXMouseport_select}
+      </select>
+{/render}
+
+     </td>
+    </tr>
+   </table>
+
+  </td>
+
+  <td style="border-left:1px solid #A0A0A0">
+   &nbsp;
+  </td>
+  
+  <td style="vertical-align:top;width:33%">
+   <h2><img class="center" alt="" align="middle" src="images/select_phone.png"> {t}Telephone hardware{/t}</h2>
+   <table style="width:100%" border=0 summary="">
+    <tr>
+     <td>{t}Telephone{/t}&nbsp;
+
+{render acl=$goFonHardwareACL}
+         {$hardware_list}
+{/render}
+
+     </td>
+    </tr>
+   </table>
+
+  </td>
+ </tr>
+</table>
+
+<table style="width:100%;" summary="">
+ <tr><td colspan=5><p class="plugbottom" style="text-align:left;"></p></td></tr>
+ <tr>
+   <td style="width:33%;vertical-align:top;">
+   <h2><img class="center" alt="" align="middle" src="images/hardware.png"> {t}Graphic device{/t}</h2>
+   <table summary="">
+    <tr>
+     <td><LABEL for="gotoXDriver">{t}Driver{/t}</LABEL></td>
+     <td>
+
+{render acl=$gotoXDriverACL}
+      <select id="gotoXDriver" name="gotoXDriver" title="{t}Choose graphic driver that is needed by the installed graphic board{/t}">
+       {html_options values=$XDrivers output=$XDrivers selected=$gotoXDriver_select}
+      </select>
+{/render}
+
+     </td>
+    </tr>
+    <tr>
+     <td><LABEL for="gotoXResolution">{t}Resolution{/t}</LABEL></td>
+     <td>
+
+{render acl=$gotoXResolutionACL}
+      <select id="gotoXResolution" name="gotoXResolution" title="{t}Choose screen resolution used in graphic mode{/t}">
+       {html_options options=$XResolutions selected=$gotoXResolution_select}
+      </select>
+{/render}
+
+     </td>
+    </tr>
+    <tr>
+     <td><LABEL for="gotoXColordepth">{t}Color depth{/t}</LABEL></td>
+     <td>
+
+{render acl=$gotoXColordepthACL}
+      <select id="gotoXColordepth" name="gotoXColordepth" title="{t}Choose colordepth used in graphic mode{/t}">
+       {html_options options=$XColordepths selected=$gotoXColordepth_select}
+      </select>
+{/render}
+
+     </td>
+    </tr>
+   </table>
+   </td>
+
+  <td style="border-left:1px solid #A0A0A0">
+   &nbsp;
+  </td>
+
+   <td style="width:32%; vertical-align:top;">
+   <h2><img class="center" alt="" align="middle" src="images/display.png"> {t}Display device{/t}</h2>
+   <table summary="">
+    <tr>
+     <td>{t}Type{/t}</td>
+     <td>{if $gotoXMonitor==""}{t}unknown{/t}{/if}{$gotoXMonitor}</td>
+    </tr>
+    <tr>
+       <td>
+
+{render acl=$AutoSyncACL}
+        <input type="checkbox" name="AutoSync" value="1" {$AutoSyncCHK} onChange="changeState('gotoXHsync');changeState('gotoXVsync');">
+{/render}
+
+        </td>
+       <td>{t}Use DDC for automatic detection{/t}</td>
+    </tr>
+    <tr>
+     <td><LABEL for="gotoXHsync">{t}HSync{/t}</LABEL></td>
+     <td>
+
+{render acl=$gotoXHsyncACL}
+       <input id="gotoXHsync" name="gotoXHsync" size=10 maxlength=60 {$hiddenState}
+                value="{$gotoXHsync}" title="{t}Horizontal refresh frequency for installed monitor{/t}"> kHz
+{/render}
+
+     </td>
+    </tr>
+    <tr>
+     <td><LABEL for="gotoXVsync">{t}VSync{/t}</LABEL></td>
+     <td>
+
+{render acl=$gotoXVsyncACL}
+       <input id="gotoXVsync"  name="gotoXVsync" size=10 maxlength=60 {$hiddenState}
+                value="{$gotoXVsync}" title="{t}Vertical refresh frequency for installed monitor{/t}"> Hz
+{/render}
+
+     </td>
+    </tr>
+   </table>
+
+   </td>
+  <td style="border-left:1px solid #A0A0A0">
+   &nbsp;
+  </td>
+
+  <td style="width:33%; vertical-align:top;">
+  
+
+   <h2><img class="center" alt="" align="middle" src="images/scanner.png"> {t}Scan device{/t}</h2>
+
+{render acl=$gotoScannerEnableACL}
+   <input type=checkbox name="gotoScannerEnable" value="1" title="{t}Select to start SANE scan service on terminal{/t}" {$gotoScannerEnable}>
+{/render}
+
+   {t}Provide scan services{/t}
+   <br>
+       </td>
+ </tr>
+</table>
+
+
+<div style="height:40px;"></div>
+
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('gotoXKbModel');
+  -->
+</script>
+
+
+
+
diff --git a/gosa-core/plugins/admin/systems/workstationStartup.tpl b/gosa-core/plugins/admin/systems/workstationStartup.tpl
new file mode 100644 (file)
index 0000000..d69b2ec
--- /dev/null
@@ -0,0 +1,244 @@
+<table summary="" style="width:100%;">
+ <tr>
+  <td style="width:50%; vertical-align:top;">
+<h2><img class="center" alt="" align="middle" src="images/penguin.png"> {t}Boot parameters{/t}</h2>
+
+   <table summary="" style="width:100%">
+    <tr>
+     <td><LABEL for="gotoBootKernel">{t}Boot kernel{/t}</LABEL></td>
+     <td style="width:70%">
+{render acl=$gotoBootKernelACL}
+        <select id="gotoBootKernel" name="gotoBootKernel">
+         {html_options options=$gotoBootKernels selected=$gotoBootKernel}
+       </select>
+{/render}
+      </td>
+    </tr>
+    <tr>
+     <td><LABEL for="customParameters">{t}Custom options{/t}</LABEL></td>
+     <td>
+{render acl=$gotoKernelParametersACL}
+       <input name="customParameters" id="customParameters" size=25 maxlength=500
+                value="{$customParameters}" title="{t}Enter any parameters that should be passed to the kernel as append line during bootup{/t}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td colspan="2" style='vertical-align:top;padding-top:3px;'><LABEL for="gotoLdapServer">{t}LDAP server{/t}</LABEL>
+{render acl=$gotoLdapServerACL}
+{if $member_of_ogroup}
+(<input type='checkbox' name='gotoLdap_inherit' {if $gotoLdap_inherit} checked {/if} value="1"
+       onClick="document.mainform.submit();" class='center'>
+&nbsp;{t}inherit from group{/t})
+{if !$JS}
+       <input type='image' src="images/list_reload.png" alt='{t}Reload{/t}' class='center'>
+{/if}
+{/if}
+{/render}
+{render acl=$gotoLdapServerACL_inherit}
+         {$gotoLdapServers}    
+{/render}
+{render acl=$gotoLdapServerACL_inherit}
+       <select name='ldap_server_to_add' id='ldap_server_to_add'>
+         {html_options options=$gotoLdapServerList}    
+    </select>
+{/render}
+{render acl=$gotoLdapServerACL_inherit}
+       <input type='submit' name='add_ldap_server' value="{t}Add{/t}" id='add_ldap_server'>
+{/render}
+     </td>
+    </tr>
+   </table>
+
+  </td>
+
+  <td style="border-left:1px solid #A0A0A0">
+     &nbsp;
+  </td>
+  
+  <td style="vertical-align:top;">
+
+       {if $fai_activated}
+
+               {if $FAIdebianMirror == "inherited"}
+
+                       <table>
+                               <tr>
+                                       <td>
+                                               <h2><img class="center" alt="" align="middle" src="images/fai_profile.png">&nbsp;{t}FAI server{/t}
+                                               </h2>
+                                       </td>
+                                       <td>
+                                               <h2><img class="center" alt="" align="middle" src="images/fai_profile.png">&nbsp;{t}Release{/t}
+                                               </h2>
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>
+       {render acl=$FAIdebianMirrorACL}
+                                               <select name="FAIdebianMirror"   onchange='document.mainform.submit()'>
+                                                       {foreach from=$FAIdebianMirrors item=val key=key}
+                                                                       {if $val.USE}
+                                                                                       <option value="{$key}" {if $FAIdebianMirror == $key} selected {/if}>{$val.NAME}</option>
+                                                                       {else}
+                                                                                       <option value="auto" disabled>{$val.NAME}</option>
+                                                                       {/if}
+                                                       {/foreach}
+                                               </select>
+       {/render}
+                                       </td>
+                                       <td>
+                                               <select name="FAIrelease"  disabled>
+                                               {html_options options=$InheritedFAIrelease output=$InheritedFAIrelease selected=$InheritedFAIrelease}
+                                               </select>
+                                       </td>
+                               </tr>
+                       </table>
+                       <h2>
+                               <img class="center" alt="" align="middle" src="images/fai_profile.png">&nbsp;{t}Assigned FAI classes{/t}
+                       </h2>
+       {render acl=$FAIclassACL}
+                       {$FAIScriptlist}        
+       {/render}
+               {else}
+
+                       <table>
+                               <tr>
+                                       <td>
+                                               <h2><img class="center" alt="" align="middle" src="images/fai_profile.png">&nbsp;{t}FAI server{/t}
+                                               </h2>
+                                       </td>
+                                       <td>
+                                               <h2><img class="center" alt="" align="middle" src="images/fai_profile.png">&nbsp;{t}Release{/t}
+                                               </h2>
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>
+       {render acl=$FAIdebianMirrorACL}
+                                               <select name="FAIdebianMirror" {$FAIdebianMirrorACL} onchange='document.mainform.submit()'>
+                                                       {foreach from=$FAIdebianMirrors item=val key=key}
+                                                               {if $val.USE}
+                                                                       <option value="{$key}" {if $FAIdebianMirror == $key} selected {/if}>{$val.NAME}</option>
+                                                               {else}
+                                                                       <option value="auto" disabled>{$val.NAME}</option>
+                                                               {/if}
+                                                       {/foreach}
+                                                       <option disabled>&nbsp;</option>
+                                               </select>
+       {/render}
+       {if $javascript eq 'false'}
+       {render acl=$FAIdebianMirrorACL}
+               <input type="submit" value="{t}set{/t}" name="refresh">
+       {/render}
+       {/if}
+                                       </td>
+                                       <td>
+       {render acl=$FAIreleaseACL}
+                                               <select name="FAIrelease"  onchange='document.mainform.submit()' {$FAIclassACL}>
+                                                       {foreach from=$FAIreleases item=val key=key}
+                                                               {if $val.USE}
+                                                                       <option value="{$val.NAME}" {if $FAIrelease == $key} selected {/if}>{$val.NAME}</option>
+                                                               {else}
+                                                                       <option value="auto" disabled>{$val.NAME}</option>
+                                                               {/if}
+                                                       {/foreach}
+                                               </select>
+       {/render}
+                                       </td>
+                               </tr>
+                       </table>
+                       <h2>
+                               <img class="center" alt="" align="middle" src="images/fai_profile.png">&nbsp;{t}Assigned FAI classes{/t}
+                       </h2>
+       {render acl=$FAIclassACL}
+                       {$FAIScriptlist}        
+       {/render}
+
+       {render acl=$FAIclassACL}
+                       <select name="FAIclassesSel">
+                               {html_options values=$FAIclassesKeys output=$FAIclasses}
+                               <option disabled>&nbsp;</option>
+                       </select>       
+       {/render}
+       {render acl=$FAIclassACL}
+                       <input name="AddClass" value="{t}Add{/t}" type="submit"> 
+       {/render}
+       <!--            <input name="DelClass" value="{t}Delete{/t}" type="submit"> -->
+               {/if}
+
+               {else}
+
+                       <h2>{t}FAI Object assignment disabled. You can't use this feature until FAI is activated.{/t}</h2>                      
+
+               {/if}
+               </td>
+       </tr>
+</table>
+
+<table summary="" style="width:100%;">
+ <tr><td colspan=2><p class="plugbottom" style="margin-top:0px;"></p></td></tr>
+
+ <tr>
+  <td style="width:50%; vertical-align:top; border-right:1px solid #B0B0B0">
+   <h2>
+    <img class="center" alt="" align="middle" src="images/hardware.png"> {t}Kernel modules (format: name parameters){/t}
+   </h2>
+{render acl=$gotoModulesACL}
+    <select style="width:100%; height:150px;" name="modules_list[]" size=15 multiple title="{t}Add additional modules to load on startup{/t}">
+     {html_options values=$gotoModules output=$gotoModules}
+        <option disabled>&nbsp;</option>
+    </select>
+{/render}
+    <br>
+{render acl=$gotoModulesACL}
+    <input name="module" size=30 align=middle maxlength=30>
+{/render}
+{render acl=$gotoModulesACL}
+    <input type=submit value="{t}Add{/t}" name="add_module">&nbsp;
+{/render}
+{render acl=$gotoModulesACL}
+    <input type=submit value="{t}Delete{/t}" name="delete_module">
+{/render}
+  </td>
+
+  <td style="vertical-align:top;">
+        <h2><img class="center" alt="" src="images/fai_partitionTable.png" align="middle">&nbsp;<LABEL for="gotoShare">{t}Shares{/t}</LABEL></h2>
+        <table summary="" style="width:100%">
+                <tr>
+                        <td>
+{render acl=$gotoShareACL}
+                        <select style="width:100%;height:150px;" name="gotoShare" multiple size=4 id="gotoShare">
+                                            {html_options values=$gotoShareKeys output=$gotoShares}
+                                                               <option disabled>&nbsp;</option>
+                                </select>
+{/render}
+                                <br>
+{render acl=$gotoShareACL}
+                        <select name="gotoShareSelection">
+                                                   {html_options values=$gotoShareSelectionKeys output=$gotoShareSelections}
+                                                       <option disabled>&nbsp;</option>
+                                </select>
+{/render}
+{render acl=$gotoShareACL}
+                                <input type="text" size=15 name="gotoShareMountPoint" value="{t}Mountpoint{/t}">
+{/render}
+{render acl=$gotoShareACL}
+                                <input type="submit" name="gotoShareAdd" value="{t}Add{/t}">
+{/render}
+{render acl=$gotoShareACL}
+                                <input type="submit" name="gotoShareDel" value="{t}Remove{/t}" {if $gotoSharesCount == 0} disabled {/if}>
+{/render}
+                        </td>
+                </tr>
+        </table>
+  </td>
+ </tr>
+</table>
+<input name="WorkstationStarttabPosted" type="hidden" value="1">
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('gotoLdapServer');
+  -->
+</script>
diff --git a/gosa-core/plugins/admin/users/class_divListUsers.inc b/gosa-core/plugins/admin/users/class_divListUsers.inc
new file mode 100644 (file)
index 0000000..6ba71d7
--- /dev/null
@@ -0,0 +1,435 @@
+<?php
+
+class divListUsers extends MultiSelectWindow
+{
+
+  /* Current base */
+  var $selectedBase       = "";
+  var $departments        = array();
+
+  /* Regex */
+  var $Regex              = "*";
+
+  /* CheckBoxes */
+  var $ShowTemplates ;
+  var $ShowFunctionalUsers;
+  var $ShowUnixUsers;
+  var $ShowMailUsers;
+  var $ShowSambaUsers;
+  var $ShowProxyUsers;
+
+  /* Subsearch checkbox */
+  var $SubSearch              = false;
+
+  var $parent             ;
+  var $ui                 ;
+
+  function divListUsers (&$config,$parent)
+  {
+    MultiSelectWindow::MultiSelectWindow($config, "Users", "users");
+    
+    $this->parent       = $parent;
+    $this->ui           = get_userinfo();
+
+    /* Set list strings */
+    $this->SetTitle(_("List of users"));
+    $this->SetSummary(_("List of users"));
+
+    /* Result page will look like a headpage */
+    $this->SetHeadpageMode();
+    $this->SetInformation(_("This menu allows you to create, edit and delete selected users. Having a great number of users, you may want to use the range selectors on top of the user list."));
+
+    $this->EnableAplhabet   (true);
+  
+    /* Disable buttonsm */
+    $this->EnableCloseButton(false);
+    $this->EnableSaveButton (false);
+
+    /* Dynamic action col, depending on snapshot icons */
+    $action_col_size = 122;
+    if($this->parent->snapshotEnabled()){
+      $action_col_size += 38;
+    }
+
+    /* Toggle all selected / deselected */
+    $chk = "<input type='checkbox' id='select_all' name='select_all' 
+               onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
+
+    /* set Page header */
+    $this->AddHeader(array("string"=> $chk,          "attach"=>"style='width:20px;'"));
+    $this->AddHeader(array("string"=> "&nbsp;",          "attach"=>"style='width:20px;'"));
+    $this->AddHeader(array("string"=>_("Username")." / "._("Department")));
+    $this->AddHeader(array("string"=>_("Properties"),   "attach" => "style='width:166px;'"));
+    $this->AddHeader(array("string"=>_("Actions"),      "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'"));
+    
+    $this->AddCheckBox("ShowTemplates"      ,_("Select to see template pseudo users")               ,_("Show templates")        , false);
+    $this->AddCheckBox("ShowFunctionalUsers",_("Select to see users that have only a GOsa object"),_("Show functional users") , true);
+    $this->AddCheckBox("ShowUnixUsers"      ,_("Select to see users that have posix settings")      ,_("Show unix users")       , true);
+    $this->AddCheckBox("ShowMailUsers"      ,_("Select to see users that have mail settings")       ,_("Show mail users")       , true);
+    $this->AddCheckBox("ShowSambaUsers"     ,_("Select to see users that have samba settings")      ,_("Show samba users")      , true);
+    $this->AddCheckBox("ShowProxyUsers"     ,_("Select to see users that have proxy settings")      ,_("Show proxy users")      , true);
+
+    /* Add SubSearch checkbox */
+    $this->AddCheckBox(SEPERATOR);
+    $this->AddCheckBox("SubSearch",  _("Select to search within subtrees"), _("Search in subtrees"), false);
+
+    /*                  Name                 ,Text                              ,Default  , Connect with alphabet  */
+    $this->AddRegex   ("Regex",     _("Display users matching"),"*" , true);
+  }
+
+
+  function GenHeader()
+  {
+    /* Prepare departments,
+       which are shown in the listbox on top of the listbox
+     */
+    $options= "";
+
+    /* Get all departments within this subtree */ 
+    $base = $this->config->current['BASE'];
+
+    /* Add base */
+    $tmp = array();
+    $tmp[] = array("dn"=>$this->config->current['BASE']);
+    $tmp=  array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
+                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
+    
+    $deps = array();
+    foreach($tmp as $tm){
+      $deps[$tm['dn']] = $tm['dn'];
+    }    
+
+
+    /* Load possible departments */
+    $ui= get_userinfo();
+    $tdeps= $ui->get_module_departments("users");
+    $ids = $this->config->idepartments;
+    $first = "";
+    $found = FALSE;
+    foreach($ids as $dep => $name){
+      if(isset($deps[$dep]) && in_array_ics($dep, $tdeps)){
+
+        /* Keep first base dn in mind, we could need this
+         *  info if no valid base was found
+         */
+        if(empty($first)) {
+          $first = $dep['dn'];
+        }
+
+        $value = $ids[$dep]; 
+        if ($this->selectedBase == $dep){
+          $found = TRUE;
+          $options.= "<option selected='selected' value='".$dep."'>$value</option>";
+        } else {
+          $options.= "<option value='".$dep."'>$value</option>";
+        }
+      }
+    }
+
+    /* The currently used base is not visible with your acl setup.
+     * Set base to first useable base. 
+     */
+    if(!$found){
+      $this->selectedBase = $first;
+    }
+
+    /* Get copy & paste icon */
+    $acl_all  = $ui->has_complete_category_acls($this->selectedBase,"users") ;
+    $acl      = $ui->get_permissions($this->selectedBase,"users/user");
+
+    /* Add default header */
+    $listhead = MultiSelectWindow::get_default_header();
+    $listhead .=
+      _("Base")."&nbsp;<select name='CurrentMainBase' 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;";
+
+
+    /* Create Layers menu */
+    $s  = ".|"._("Actions")."|\n";
+    $s .= "..|<img src='images/list_new.png' alt='' border='0' class='center'>".
+      "&nbsp;"._("Create")."|\n";
+
+    /* Append create options */
+    if(preg_match("/c/",$acl)) {
+      $s.= "...|<input class='center' type='image' src='images/list_new_user.png' alt=''>".
+        "&nbsp;"._("User")."|user_new|\n";
+      $s.= "...|<input class='center' type='image' src='images/list_new.png' alt=''>".
+        "&nbsp;"._("Template")."|user_tplnew|\n";
+    }
+
+    /* Multiple options */ 
+    $s.= "..|---|\n";
+    $s.= "..|<img src='images/edit.png' alt='' border='0' class='center'>".
+      "&nbsp;"._("Edit")."|"."multiple_edit|\n";
+    $s.= "..|<img src='images/list_password.png' alt='' border='0' class='center'>".
+      "&nbsp;"._("Change password")."|"."multiple_password_change|\n";
+    $s.= "..|<img src='images/edittrash.png' alt='' border='0' class='center'>".
+      "&nbsp;"._("Remove")."|"."remove_multiple|\n";
+
+    /* Add multiple copy & cut icons */
+    if(is_object($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
+      $s.= "..|---|\n";
+      $s.= "..|<img src='images/editcopy.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Copy")."|"."multiple_copy_systems|\n";
+      $s.= "..|<img src='images/editcut.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Cut")."|"."multiple_cut_systems|\n";
+      
+      if($this->parent->CopyPasteHandler->entries_queued()){
+        $img = "<img border='0' class='center' src='images/editpaste.png' alt=''>";
+        $s.="..|".$img."&nbsp;"._("Paste")."|editPaste|\n";
+      }else{
+        $img = "<img border='0' class='center' src='images/cant_editpaste.png' alt=''>";
+        $s.="..|".$img."&nbsp;"._("Paste")."\n";
+      }
+    }
+
+    /* Add snapshot icons */
+    if(preg_match("/(c.*w|w.*c)/",$acl_all)){
+      $s .= "..|---|\n";
+      $s .= $this->get_snapshot_header(TRUE);
+    }
+
+    $this->SetDropDownHeaderMenu($s);
+    $this->SetListHeader($listhead);
+  }
+
+  /* so some basic settings */
+  function execute()
+  {
+    $this->ClearElementsList();
+    $this->GenHeader();
+  }
+
+  function setEntries($list)
+  {
+    /********************
+      Variable init
+     ********************/
+    
+    $num_users      = 0;
+    $num_templates  = 0;
+
+    /* Variable initialation */
+    $enviro     = $posix = $maila = $faxac = $samba = $netatalk = "";
+    $empty      = "<img class='center' src='images/empty.png' style='width:16px;height:16px;' alt='-'>";
+    $userimg    = "<img class='center' src='images/select_user.png' alt='User' title='%s'>";
+    $tplimg     = "<img class='center' src='images/select_template.png' alt='Template' title='%s'>";
+    $editlink   = "<a href='?plug=".validate($_GET['plug'])."&amp;id=%s&amp;act=edit_entry'>%s</a>";
+
+    /* Dynamic action col, depending on snapshot icons */
+    $action_col_size = 122;
+    if($this->parent->snapshotEnabled()){
+      $action_col_size += 38;
+    }
+
+    /* Possilbe objectClass image combinations */  
+    $possibleAccounts = array(
+            "posixAccount"    => array("VAR"=>"posix"     ,"IMG"=>"posiximg"),
+            "gotoEnvironment" => array("VAR"=>"enviro"    ,"IMG"=>"eviroimg"),
+            "gosaMailAccount" => array("VAR"=>"maila"     ,"IMG"=>"mailimg"),
+            "goFaxAccount"    => array("VAR"=>"faxac"     ,"IMG"=>"faximg"),
+            "sambaSamAccount" => array("VAR"=>"samba"     ,"IMG"=>"sambaimg"),
+            "apple-user"      => array("VAR"=>"netatalk"  ,"IMG"=>"netatalkimg"));
+
+     /* Pictures for Extensions */
+    $usrimg   ="<input class='center' type='image' src='images/select_user.png' alt='"._("GOsa")."'
+                    name='user_edit_%KEY%-user' title='"._("Edit generic properties")."'>";
+    $posiximg = "<input class='center' type='image' src='images/penguin.png' alt='"._("Posix")."'
+                    name='user_edit_%KEY%-posixAccount' title='"._("Edit UNIX properties")."'>";
+    $eviroimg = "<input class='center' type='image' src='images/smallenv.png' alt='"._("Environment")."'
+                    name='user_edit_%KEY%-environment' title='"._("Edit environment properties")."'>";
+    $mailimg  = "<input class='center' type='image' src='images/mailto.png' alt='"._("Mail")."'
+                    name='user_edit_%KEY%-mailAccount' title='"._("Edit mail properties")."'>";
+    $fonimg   = "<input class='center' type='image' src='images/%image%' alt='"._("Phone")."'
+                    name='user_edit_%KEY%-phoneAccount' title='"._("Edit phone properties")."%title%'>";
+    $faximg   = "<input class='center' type='image' src='images/fax_small.png' alt='"._("Fax")."'
+                    name='user_edit_%KEY%-gofaxAccount' title='"._("Edit fax properies")."'>";
+    $sambaimg = "<input class='center' type='image' src='images/select_winstation.png' alt='"._("Samba")."'
+                    name='user_edit_%KEY%-sambaAccount' title='"._("Edit samba properties")."'>";
+    $netatalkimg = "<input class='center' type='image' src='images/select_netatalk.png' alt='"._("Netatalk")."'
+                    name='user_edit_%KEY%-netatalk' title='"._("Edit netatalk properties")."'>";
+    $tplcreateuserimg  = "<input type='image' class='center' src='images/list_new.png' alt='"._("Create user from template")."'
+                    name='userfrom_tpl_%KEY%' title='"._("Create user with this template")."'>";
+
+    /********************
+      END :: Variable init
+     ********************/
+
+    /********************
+      Append entries to divlist 
+     ********************/
+    $ui = get_userinfo(); 
+  
+    // Test Every Entry and generate divlist Array
+    foreach($list as $key => $val){
+  
+      /* Create action icons */
+      $action= "";
+
+      /* Add copy & cut icons */     
+      $acl_all  = $ui->has_complete_category_acls($this->selectedBase,"users") ;
+      $acl      = $ui->get_permissions($val['dn'],"users/user");
+      if(preg_match("/(c.*w|w.*c)/",$acl_all) && $this->parent->CopyPasteHandler){
+        $action .= "<input class='center' type='image'
+          src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
+        $action.= "<input class='center' type='image'
+          src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
+      }
+
+      /* Add deactivate status */
+      $lock_status = "";
+
+      if(isset($val['userPassword'][0]) && preg_match("/^\{[^\}]/",$val['userPassword'][0])){
+        if(preg_match("/^[^\}]*+\}!/",$val['userPassword'][0])){
+          $lock_status = "<input class='center' type='image' src='images/closedlock.png'
+            alt='"._("Deactivated")."' name='toggle_lock_status_%KEY%'>";
+        }else{
+          $lock_status = "<input class='center' type='image' src='images/openlock.png'
+            alt='"._("Active")."' name='toggle_lock_status_%KEY%'>";
+        }
+      }else{
+        $lock_status = "<img src='images/empty.png' alt=' ' class='center'>";
+      }
+
+      /* Generate edit icon */
+      $action.= "<input class='center' type='image' src='images/edit.png' alt='"._("edit")."'
+        name='user_edit_%KEY%' title='"._("Edit user")."'>";
+
+      /* Add deactivate status if we are allowed to */
+      if (preg_match("/w/",$acl_all)){
+        $action.= $lock_status;
+      }
+
+      /* Add Password change icon, if we are able to write users/password */
+      if(!in_array_ics("gosaUserTemplate",$val['objectClass']) && preg_match("/w/",$ui->get_permissions($val['dn'],"users/password"))) {
+        $action.= "<input class='center' type='image' src='images/list_password.png' alt='"._("password")."'
+          name='user_chgpw_%KEY%' title='"._("Change password")."'>";
+      }else{
+        $action.= "<img class='center' src='images/empty.png' alt='&nbsp;' 
+          title='"._("You are not allowed to change the password for this user.")."'>";
+      }
+
+      /* Add snapshot icon */
+      if(preg_match("/(c.*w|w.*c)/",$acl_all)){
+        $action.= $this->GetSnapShotActions($val['dn']);
+      }
+
+      /* Add remove icon, if we are allowed to remove the current user */
+      if(preg_match("/d/",$ui->get_permissions($val['dn'],"users/user"))) {
+        $action.= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."'
+          name='user_del_%KEY%' title='"._("Delete user")."'>";
+      }else{
+        $action.= "<img class='center' src='images/empty.png' alt='&nbsp;'  
+          title='"._("You are not allowed to remove this user.")."'>";
+      }
+
+      /* Create phonaccopunt informationm, if conencted && is phoneAccount */ 
+      if((in_array("goFonAccount"    ,$val['objectClass']))){
+
+        /* Set defaults */
+        $fonac = preg_replace("/%image%/", "select_phone.png", $fonimg);
+        $fonac = preg_replace("/%KEY%/", "$key", $fonac);
+        $fonac = preg_replace("/%title%/", "", $fonac);
+
+      }else{
+        $fonac=$empty;
+      }
+
+      /* Set images for different types of objectClasses */
+      foreach($possibleAccounts as $objectClass => $Settigns){ 
+        if(in_array($objectClass ,$val['objectClass'])){
+          $$Settigns['VAR'] = preg_replace("/%KEY%/", "$key", $$Settigns['IMG']);
+        }else{
+          $$Settigns['VAR'] = $empty;
+        }
+      }
+
+      /* Create userimg */
+      if(in_array("gosaUserTemplate",$val['objectClass'])){
+        $tpl                          = preg_replace("/%KEY%/", "$key", $tplimg);
+        $s_img_create_from_template   = preg_replace("/%KEY%/", "$key", $tplcreateuserimg);
+        $num_templates ++;
+      }else{
+        $s_img_create_from_template   = "";
+        $tpl                          = $userimg;
+        $num_users ++;
+      }
+
+      /* Insert key into userimg */
+      $usrimg2 = preg_replace("/%KEY%/", "$key", $usrimg);
+
+      // Generate caption for rows
+      if (isset($val["sn"]) && isset($val["givenName"])){
+        $display= $val["sn"][0].", ".$val["givenName"][0]." [".$val["uid"][0]."]";
+      } else {
+        $display= "[".$val["uid"][0]."]";
+      }
+
+      /* Connect all images */
+      $UseImg = $usrimg2."&nbsp;".$posix."&nbsp;".$enviro."&nbsp;".$maila."&nbsp;".$fonac."&nbsp;".$faxac."&nbsp;".$samba."&nbsp;".$netatalk;
+
+      /* Cutted objects should be displayed in light grey */ 
+      if($this->parent->CopyPasteHandler){
+        foreach($this->parent->CopyPasteHandler->queue as $queue_key => $queue_data){
+          if($queue_data['dn'] == $val['dn']) {
+            $display = "<font color='#999999'>".$display."</font>";
+            break;
+          }
+        }
+      }
+
+      /* Create each field */
+      $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
+                      "attach" => "style='width:20px;'");
+      $field1 = array("string" => sprintf($tpl,$val['dn']), "attach" => "style='text-align:center;width:20px;'");
+      $field2 = array("string" => sprintf($editlink,$key,$display), "attach" => "style='' title='".preg_replace('/ /', '&nbsp;', @LDAP::fix($val['dn']))."'");
+      $field3 = array("string" => $UseImg, "attach" => "style='width:166px;'");
+      $field4 = array("string" => $s_img_create_from_template.preg_replace("/%KEY%/", "$key", $action),
+                      "attach" => "style='width:".$action_col_size."px;border-right:0px;    text-align:right;'");
+      /* Add to list */
+      $add = array($field0,$field1,$field2,$field3,$field4);
+      $this->AddElement($add);
+
+      // Template or User
+      if(in_array("gosaUserTemplate",$val['objectClass'])){
+        $tpls[strtolower( $val['sn']['0'].$val['uid']['0'])]=$add;
+      }else{
+        $users[strtolower( $val['sn']['0'].$val['uid']['0'])]=$add;
+      }
+    }
+
+
+    /* Create summary string for list footer */
+    $num_deps=0;
+    if(!$this->SubSearch){
+      $num_deps = count($this->Added_Departments);
+    }
+    $num_users = count($list);
+
+    $num_user_str = _("Number of listed users");
+    $num_dep_str = _("Number of listed departments");
+
+    $str = "<img class='center' src='images/select_user.png'
+              title='".$num_user_str."' alt='".$num_user_str."'>&nbsp;".$num_users."&nbsp;&nbsp;&nbsp;&nbsp;";
+    $str.= "<img class='center' src='images/folder.png'
+              title='".$num_dep_str."' alt='".$num_dep_str."'>&nbsp;".$num_deps."&nbsp;&nbsp;&nbsp;&nbsp;";
+
+    $this->set_List_Bottom_Info($str);
+  }
+
+  function Save()
+  {
+    MultiSelectWindow :: Save();  
+  }
+
+  function save_object()
+  {
+    /* Save automatic created POSTs like regex, checkboxes */
+    MultiSelectWindow::save_object();   
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/users/class_userManagement.inc b/gosa-core/plugins/admin/users/class_userManagement.inc
new file mode 100644 (file)
index 0000000..a031e89
--- /dev/null
@@ -0,0 +1,1117 @@
+<?php
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2003-2006 - Cajus Pollmeier <pollmeier@gonicus.de>
+
+   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 userManagement extends plugin
+{
+  /* Plugin definitions */
+  var $plHeadline= "Users";
+  var $plDescription= "This does something";
+
+  /* Dialog attributes */
+  var $usertab              = NULL;
+  var $ui                   = NULL;
+  var $templates            = array();
+  var $got_uid              = false;
+  var $CopyPasteHandler     = NULL;
+  var $CPPasswordChange     = ""; // Contains the entry id which should get a new password
+  var $DivListUsers;
+
+  var $pwd_change_queue     = array();
+
+  var $start_pasting_copied_objects = FALSE;
+  var $current_action ="";
+  var $msg_dialog= NULL;
+  
+  function userManagement(&$config, $ui)
+  {
+    /* Save configuration for internal use */
+    $this->config= &$config;
+    $this->ui= &$ui;
+
+    /* Copy & Paste handler */
+    if ($this->config->boolValueIsTrue("main", "enableCopyPaste")){
+      $this->CopyPasteHandler= new CopyPasteHandler($this->config);
+    }
+
+    /* Creat dialog object */
+    $this->DivListUsers = new divListUsers($this->config,$this);
+
+  }
+
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* LOCK MESSAGE Vars */
+    $_SESSION['LOCK_VARS_TO_USE'] = array("/^act$/","/^id$/","/^user_edit_/","/^user_del_/","/^item_selected/","/^remove_multiple_users/","/^multiple_edit/","/menu_action/");
+
+    $smarty       = get_smarty();                 // Smarty instance
+    $s_action     = "";                           // Contains the action to be taken
+    $s_entry      = "";                           // The value for s_action
+
+    /* Edit entry button pressed? */
+    if( isset($_GET['act']) && $_GET['act'] == "edit_entry" ){
+      $s_action= "edit";
+      $s_entry= validate($_GET['id']);
+    }
+
+    /* Test relevant POST values */  
+    foreach($_POST as $key => $val){
+
+      /* Get every possible POST combination and set s_action/s_entry accordingly */
+      foreach(array("del"       => "user_del",    
+                    "edit"      => "user_edit",
+                    "new"       => "user_new",
+                    "new_tpl"   => "user_tplnew",
+                    "del_multiple" => "^remove_multiple_users",
+                    "create_user_from_tpl"          => "userfrom_tpl",
+                    "change_pw" => "user_chgpw", 
+                    "editPaste" => "editPaste",  
+                    "copy_multiple" => "multiple_copy_users",
+                    "multiple_edit" => "multiple_edit",
+                    "cut_multiple" => "multiple_cut_users",
+                    "multiple_password_change" => "multiple_password_change",
+                    "copy"      => "^copy",
+                    "toggle_lock_status" => "toggle_lock_status",
+                    "cut"       => "^cut") as $act => $name){
+
+        if (preg_match("/".$name.".*/", $key)){
+          $s_action= $act;
+          $s_entry= preg_replace("/".$name."_/i", "", $key);
+          break;
+        }
+      }
+      
+    } /* ...Test POST */
+
+    /* Remove coordinate prefix from POST, required by some browsers */
+    $s_entry= preg_replace("/_.$/", "", $s_entry);
+
+    /* Seperate possibly encoded tab and entry, default to tab "user" */
+    if(preg_match("/.*-.*/", $s_entry)){
+      $s_tab= preg_replace("/^[^-]*-/i", "" ,$s_entry);
+      $s_entry= preg_replace("/-[^-]*$/i", "", $s_entry);
+    }else{
+      $s_tab= "user";
+    }
+
+    if(!$this->config->search($s_tab, 'class',array('tabs'))){
+      $s_tab = "user";
+    }
+
+
+    /* handle C&P from layers menu */
+    if(isset($_POST['menu_action']) && preg_match("/^multiple_copy_systems/",$_POST['menu_action'])){
+      $s_action = "copy_multiple";
+    }
+    if(isset($_POST['menu_action']) && preg_match("/^multiple_cut_systems/",$_POST['menu_action'])){
+      $s_action = "cut_multiple";
+    }
+    if(isset($_POST['menu_action']) && preg_match("/^editPaste/",$_POST['menu_action'])){
+      $s_action = "editPaste";
+    }
+
+    /* Create options */
+    if(isset($_POST['menu_action']) && $_POST['menu_action'] == "user_new"){
+      $s_action = "new";
+    }
+    if(isset($_POST['menu_action']) && $_POST['menu_action'] == "user_tplnew"){
+      $s_action = "new_tpl";
+    }
+    if(isset($_POST['menu_action']) && $_POST['menu_action'] == "multiple_edit"){
+      $s_action = "multiple_edit";
+    }
+
+    /* handle remove from layers menu */
+    if(isset($_POST['menu_action']) && preg_match("/^multiple_password_change/",$_POST['menu_action'])){
+      $s_action = "multiple_password_change";
+    }
+
+    /* handle remove from layers menu */
+    if(isset($_POST['menu_action']) && preg_match("/^remove_multiple/",$_POST['menu_action'])){
+      $s_action = "del_multiple";
+    }
+
+
+    /********************
+      Copy & Paste 
+     ********************/
+
+    /* Display the copy & paste dialog, if it is currently open */
+    if($this->CPPasswordChange == ""){
+      $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
+      if($ret){
+        return($ret);
+      }
+    }
+
+
+    /********************
+      Change password confirmed
+     ********************/
+
+    /* Perform password change */
+    if (isset($_POST['password_finish'])){
+
+      /* For security reasons, check if user is allowed to set password again */
+      $dn  = $this->dn;
+      $acl = $this->ui->get_permissions($dn, "users/password");
+      $cacl= $this->ui->get_permissions($dn, "users/user");
+
+      if (preg_match('/w/', $acl) || preg_match('/c/', $cacl)){
+
+        /* Check input and feed errors into 'message' */
+        $message= array();
+
+        /* Sanity checks... */
+        if ($_POST['new_password'] != $_POST['repeated_password']){
+
+          /* Matching passwords in new and repeated? */
+          $message[]= _("The passwords you've entered as 'New password' and 'Repeated new password' do not match.");
+        } else {
+
+          /* Empty password is not permitted by default. */
+          if ($_POST['new_password'] == ""){
+            $message[]= _("The password you've entered as 'New password' is empty.");
+          }
+        }
+
+        /* Errors, or password change? */
+        if (count($message) != 0){
+
+          /* Show error message and continue editing */
+          show_errors ($message);
+          return($smarty->fetch(get_template_path('password.tpl', TRUE)));
+        }
+
+        $config= $this->config;
+        $ldap_ui= $this->config->get_ldap_link();
+        if(isset($this->usertab->dn)){
+          $ldap_ui->cat($this->usertab->dn,array("uid"));
+          $user = $ldap_ui->fetch();
+        }else{
+          $ldap_ui->cat($this->dn,array("uid"));
+          $user = $ldap_ui->fetch();
+        }
+        if((is_array($user))&&(isset($user['uid']))){
+          $username= $user['uid'][0];
+        }
+
+        /* Set password, perform required steps */
+        if ($this->usertab){
+          if ($this->usertab->password_change_needed()){
+            $obj= $this->usertab->by_object['user'];
+            change_password ($this->usertab->dn, $_POST['new_password'],0, $obj->pw_storage);
+            if (isset($config->data['MAIN']['EXTERNALPWDHOOK'])){
+              exec($config->data['MAIN']['EXTERNALPWDHOOK']." ".$username." ".$_POST['new_password'], $resarr);
+            }
+            new log("modify","users/".get_class($this),$this->usertab->dn,array(),"Password has been changed");
+            unset($this->usertab);
+            $this->usertab= NULL;
+          }
+        } else {
+          change_password ($this->dn, $_POST['new_password']);
+          if (isset($config->data['MAIN']['EXTERNALPWDHOOK'])){
+            exec($config->data['MAIN']['EXTERNALPWDHOOK']." ".$username." ".$_POST['new_password'], $resarr);
+          }
+          new log("modify","users/".get_class($this),$this->dn,array(),"Password has been changed");
+        }
+      } else {
+
+        /* Missing permissions, show message */
+        msg_dialog::display(_("Password change failed."),_("You are not allowed to set this users password!"),WARNING_DIALOG);
+      }
+      /* Clean session, delete lock */
+      del_lock ($this->dn);
+      unset ($this->usertab);
+      $this->usertab= NULL;
+      $this->lognames= array();;
+      $this->sn= "";
+      $this->givenName= "";
+      $this->uid= "";
+      unset ($_SESSION['objectinfo']);
+    }
+
+
+    /********************
+     Change multiple passwords requested 
+     ********************/
+  
+    if($s_action == "multiple_password_change"){
+      $this->pwd_change_queue = $this->list_get_selected_items();
+    }    
+
+
+    /********************
+      Change password requested  
+     ********************/
+
+    /* Password change requested */
+    if (($s_action == "change_pw") || (!empty($this->CPPasswordChange)) || count($this->pwd_change_queue)){
+
+      /* Get users whose passwords should be changed. */
+      if(count($this->pwd_change_queue)){
+        $s_entry= array_pop($this->pwd_change_queue);
+      }
+
+      if(!empty($this->CPPasswordChange)){
+        $s_entry = $this->CPPasswordChange;
+        $this->CPPasswordChange = "";
+      }
+
+      /* Get 'dn' from posted 'uid' */
+      $this->dn= $this->list[trim($s_entry)]['dn'];
+
+      /* Load permissions for selected 'dn' and check if
+         we're allowed to remove this 'dn' */
+      if (preg_match("/w/",$this->ui->get_permissions($this->dn,"users/password"))){
+
+        /* User is allowed to change passwords, save 'dn' and 'acl' for next
+           dialog. */
+        $_SESSION['objectinfo']= $this->dn;
+        return ($smarty->fetch(get_template_path('password.tpl', TRUE)));
+        
+
+      } else {
+        /* User is not allowed. Show message and cancel. */
+        msg_dialog::display(_("Password change"),_("You are not allowed to set this users password!"),WARNING_DIALOG);
+      }
+    }
+
+
+
+     /********************
+      Edit existing entry
+     ********************/
+
+    /* User wants to edit data? */
+    if (($s_action=="edit") && (!isset($this->usertab->config))){
+
+      /* Get 'dn' from posted 'uid', must be unique */
+      $this->dn= $this->list[trim($s_entry)]['dn'];
+
+      /* Check locking, save current plugin in 'back_plugin', so
+         the dialog knows where to return. */
+      if (($user= get_lock($this->dn)) != ""){
+        return(gen_locked_message ($user, $this->dn));
+      }
+
+      /* Lock the current entry, so everyone will get the
+         above dialog */
+      add_lock ($this->dn, $this->ui->dn);
+
+      /* Register usertab to trigger edit dialog */
+      $this->usertab= new usertabs($this->config,
+          $this->config->data['TABS']['USERTABS'], $this->dn);
+
+      /* Switch tab, if it was requested by the user */
+      $this->usertab->current = $s_tab;
+
+      /* Set ACL and move DN to the headline */
+      $this->usertab->set_acl_base($this->dn);
+      $_SESSION['objectinfo']= $this->dn;
+    }
+
+
+    /********************
+      Edit multiple entries
+     ********************/
+
+    /* User wants to edit data? */
+    if ($s_action == "multiple_edit" && !isset($this->usertab->config)){
+
+      $this->dn = array();
+      foreach($this->list_get_selected_items() as $id){
+        $this->dn[] = $this->list[$id]['dn'];;
+      }
+      $tmp = new multi_plug($this->config,"usertabs",$this->config->data['TABS']['USERTABS'],
+            $this->dn,$this->DivListUsers->selectedBase,"user");
+      if ($tmp->entries_locked()){
+        return($tmp->display_lock_message());
+      }
+      $tmp->lock_entries($this->ui->dn);
+      if($tmp->multiple_available()){
+        $this->usertab = $tmp;
+        $this->usertab->set_active_tab($s_tab);
+        $_SESSION['objectinfo']= $this->usertab->get_object_info();
+      }
+    }
+
+
+    /********************
+      Edit canceled 
+     ********************/
+
+    /* Reset all relevant data, if we get a _cancel request */
+    if (isset($_POST['edit_cancel']) || isset($_POST['password_cancel'])){
+      if (isset($this->usertab)){
+        del_lock ($this->usertab->dn);
+        unset ($this->usertab);
+      }
+      $this->usertab= NULL;
+      $this->lognames= array();;
+      $this->sn= "";
+      $this->givenName= "";
+      $this->uid= "";
+      unset ($_SESSION['objectinfo']);
+    }
+
+
+    /********************
+      Delete MULTIPLE entries requested, display confirm dialog
+     ********************/
+
+    if ($s_action=="del_multiple"){
+      $ids = $this->list_get_selected_items();
+      $this->dns = array();
+      if(count($ids)){
+
+        foreach($ids as $id){
+          $dn = $this->list[$id]['dn'];
+          if (($user= get_lock($dn)) != ""){
+            return(gen_locked_message ($user, $dn));
+          }
+          $this->dns[$id] = $dn; 
+        }
+
+        $dns_names = "<br><pre>";
+        foreach($this->dns as $dn){
+          $dns_names .= $dn."\n";
+        }
+        $dns_names .="</pre>";
+
+        /* Lock the current entry, so nobody will edit it during deletion */
+        if (count($this->dns) == 1){
+          $info = sprintf(_("You're about to delete the following entry: %s"), @LDAP::fix($dns_names));
+        } else {
+          $info = sprintf(_("You're about to delete the following entries: %s"), @LDAP::fix($dns_names));
+        }
+        $this->msg_dialog = new msg_dialog(_("Delete users"),$info,CONFIRM_DIALOG);
+        $this->current_action = $s_action;
+      }
+    }
+
+
+    /********************
+      Delete MULTIPLE entries confirmed 
+     ********************/
+
+      /* Confirmation for deletion has been passed. Users should be deleted. */
+      if ($this->current_action == "del_multiple" && is_object($this->msg_dialog) && $this->msg_dialog->is_confirmed()){
+        
+        $this->current_action = "";  
+        
+        /* Remove user by user and check acls before removeing them */
+        foreach($this->dns as $key => $dn){
+
+          $acl = $this->ui->get_permissions($dn, "users/user"); 
+          if (preg_match('/d/', $acl)){
+
+            /* Delete request is permitted, perform LDAP action */
+            $this->usertab= new usertabs($this->config, $this->config->data['TABS']['USERTABS'],$dn);
+            $this->usertab->set_acl_base();
+            $this->usertab->delete ();
+            unset ($this->usertab);
+            $this->usertab= NULL;
+          } else {
+            msg_dialog::display(_("User delete"),sprintf(_("You are not allowed to delete the user '%s'!"),$dn),WARNING_DIALOG);
+            if(isset($this->ui->uid)){
+              new log("security","users/".get_class($this),$dn,array(),"Tried to trick deletion.");
+            }
+          }
+          /* Remove lock file after successfull deletion */
+          del_lock ($dn);
+          unset($this->dns[$key]);
+      }
+    }
+
+
+    /********************
+      Delete MULTIPLE entries Canceled 
+     ********************/
+
+    /* Remove lock */
+    if(isset($_POST['delete_multiple_user_cancel'])){
+      foreach($this->dns as $key => $dn){
+        del_lock ($dn);
+        unset($this->dns[$key]);
+      }
+    }
+  
+  
+    /********************
+      Toggle lock status for user
+     ********************/
+  
+    if($s_action == "toggle_lock_status" && isset($this->list[$s_entry])){
+
+      /* Get entry check current status */
+      $val = $this->list[$s_entry];
+      $pwd = $val['userPassword'][0];
+
+      if(!preg_match("/^\{[^\}]/",$pwd)){
+        trigger_error("Can not deactivate user which is using clear password encryption.");
+      }else{
+
+        $locked = false;
+        if(preg_match("/^[^\}]*+\}!/",$pwd)){
+          $locked = true;
+        }
+
+        /* Create ldap array to update status */
+        $attrs = array("userPassword" => $pwd);
+        if($locked){
+          $attrs['userPassword'] = preg_replace("/(^[^\}]+\})!(.*$)/","\\1\\2",$attrs['userPassword']);
+        }else{
+          $attrs['userPassword'] = preg_replace("/(^[^\}]+\})(.*$)/","\\1!\\2",$attrs['userPassword']);
+        }
+
+        /* Write new status back to ldap */
+        $ldap = $this->config->get_ldap_link();
+        $ldap->cd($val['dn']);
+        $ldap->modify($attrs);
+        if($locked){
+          show_ldap_error($ldap->get_error(),_("Could not set user status from locked to unlocked."));
+        }else{
+          show_ldap_error($ldap->get_error(),_("Could not set user status from unlocked to locked."));
+        }
+      }
+    }
+
+
+    /********************
+      Delete entry requested, display confirm dialog
+     ********************/
+
+    /* Remove user was requested */
+    if ($s_action=="del"){
+
+      /* Get 'dn' from posted 'uid' */
+      $this->dn= $this->list[trim($s_entry)]['dn'];
+
+      /* Load permissions for selected 'dn' and check if
+         we're allowed to remove this 'dn' */
+
+      /* Check locking, save current plugin in 'back_plugin', so
+         the dialog knows where to return. */
+      if (($user= get_lock($this->dn)) != ""){
+        return(gen_locked_message ($user, $this->dn));
+      }
+
+  
+      /* Lock the current entry, so nobody will edit it during deletion */
+#      add_lock ($this->dn, $this->ui->dn);
+#      $smarty->assign("info", sprintf(_("You're about to delete the user %s."), @LDAP::fix($this->dn)));
+#      $smarty->assign("multiple", false);
+#      return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+      $this->msg_dialog = new msg_dialog( _("Delete user"),sprintf(_("You're about to delete the user %s."), @LDAP::fix($this->dn)),CONFIRM_DIALOG);
+      $this->current_action = $s_action;
+    }
+
+
+    /********************
+      Delete entry confirmed 
+     ********************/
+
+    /* Confirmation for deletion has been passed. User should be deleted. */
+    if ($this->current_action == "del" && is_object($this->msg_dialog) && $this->msg_dialog->is_confirmed()){
+
+      $this->current_action = ""; 
+      /* Some nice guy may send this as POST, so we've to check
+         for the permissions again. */
+
+      $acl = $this->ui->get_permissions($this->dn, "users/user"); 
+      if (preg_match('/d/', $acl)){
+
+        /* Delete request is permitted, perform LDAP action */
+        $this->usertab= new usertabs($this->config, $this->config->data['TABS']['USERTABS'],$this->dn);
+        $this->usertab->set_acl_base();
+        $this->usertab->delete ();
+        unset ($this->usertab);
+        $this->usertab= NULL;
+        msg_dialog::display(_("User delted"),_("User successfully removed."),INFO_DIALOG);
+      } else {
+
+        /* Normally this shouldn't be reached, send some extra
+           logs to notify the administrator */
+        msg_dialog::display(_("User delete"),_("You are not allowed to delete this user!"),WARNING_DIALOG);
+
+        if(isset($this->ui->uid)){
+          new log("security","users/".get_class($this),$this->dn,array(),"Tried to trick deletion.");
+        }
+      }
+
+      /* Remove lock file after successfull deletion */
+      del_lock ($this->dn);
+    }
+
+    
+    /********************
+      Delete entry Canceled 
+     ********************/
+
+    /* Delete user canceled? */
+    if (isset($_POST['delete_cancel'])){
+      del_lock ($this->dn);
+    }
+
+
+    /********************
+      Edit entry finished (Save) 
+     ********************/
+
+    /* Finish user edit is triggered by the tabulator dialog, so
+       the user wants to save edited data. Check and save at this
+       point. */
+    if ((isset($_POST['edit_finish']) || isset($_POST['edit_apply'])) && (isset($this->usertab->config))){
+
+      /* Check tabs, will feed message array */
+      $this->usertab->last= $this->usertab->current;
+      $this->usertab->save_object();
+      $message= $this->usertab->check();
+
+      /* Save, or display error message? */
+      if (count($message) == 0){
+
+        /* No errors. Go ahead and prepare to ask for a password
+           in case we're creating a new user. 'dn' will be 'new'
+           in this case. It is set to the correct value later. */
+        if ($this->dn == "new"){
+          $set_pass= 1;
+        } else {
+          $set_pass= 0;
+        }
+
+        /* Save user data to ldap */
+        if($this->usertab->save() == 1){
+          return;
+        }
+
+        if (!isset($_POST['edit_apply'])){
+          /* User has been saved successfully, remove lock from LDAP. */
+          if ($this->dn != "new"){
+            del_lock ($this->dn);
+          }
+
+          /* In case of new users, ask for a password, skip this for templates */
+          if (($set_pass || $this->usertab->password_change_needed()) && !$this->is_template){
+            $this->dn = $this->usertab->dn;
+            return($smarty->fetch(get_template_path('password.tpl', TRUE)));
+          }
+
+          unset ($this->usertab);
+          $this->usertab= NULL;
+          unset ($_SESSION['objectinfo']);
+        }
+      } else {
+        /* Ok. There seem to be errors regarding to the tab data,
+           show message and continue as usual. */
+        show_errors($message);
+      }
+    }
+
+
+    /********************
+      We want to create a new user, so fetch all available user templates 
+     ********************/
+
+    /* Generate template list */
+    if (($s_action=="new")||($s_action=="create_user_from_tpl")){
+
+      $this->templates= array();
+      $ldap= $this->config->get_ldap_link();
+
+      /* Create list of templates */
+      foreach ($this->config->departments as $key => $value){
+    
+        /* Get acls from different ou's */
+        $acl = $this->ui->get_permissions("cn=dummy,".get_people_ou().$value,"users/user")       ; 
+        /* If creation of a new user is allowed, append this template */
+        if (preg_match("/c/",$acl)){
+          
+          /* Search all templates from the current dn */
+          $ldap->cd (get_people_ou().$value);
+          $ldap->search ("(objectClass=gosaUserTemplate)", array("uid"));
+
+          /* Append */
+          if ($ldap->count() != 0){
+            while ($attrs= $ldap->fetch()){
+              $this->templates[$ldap->getDN()]=
+                $attrs['uid'][0]." - ".@LDAP::fix($key);
+            }
+            $this->templates['none']= _("none");
+          }
+        }
+      }
+
+      /* Sort templates */
+      natcasesort ($this->templates);
+      reset ($this->templates);
+    }
+
+
+    /********************
+      Create a new user,template, user from template 
+     ********************/
+
+    /* Check selected options for template */
+    if (isset($_POST['template_continue'])){
+      $message = array();
+      if(!isset($_POST['template']) || (empty($_POST['template']))){
+        $message[] = _("Please select a valid template.");
+      }
+      if(!isset($_POST['sn']) || (empty($_POST['sn']))){
+        $message[]= _("The required field 'Name' is not set.");
+      }
+      if(!isset($_POST['givenName']) || (empty($_POST['givenName']))){
+        $message[]= _("The required field 'Given name' is not set.");
+      }
+    
+      /* Show error message / continue editing */
+      if (count($message) > 0){
+        show_errors ($message);
+
+        foreach(array("sn", "givenName", "uid", "template") as $attr){
+          if(isset($_POST[$attr])){
+            $smarty->assign("$attr", $_POST[$attr]);
+          }else{
+            $smarty->assign("$attr", "");
+          }
+        }
+        $smarty->assign("templates",$this->templates);
+        $smarty->assign("got_uid",$this->got_uid);
+        $smarty->assign("edit_uid",false);
+        return($smarty->fetch(get_template_path('template.tpl', TRUE)));
+
+      }
+    }
+
+    /* New user/template request */
+    if (($s_action=="create_user_from_tpl")||($s_action=="new") || ($s_action=="new_tpl")){
+      /* By default we set 'dn' to 'new', all relevant plugins will
+         react on this. */
+      $this->dn= "new";
+      
+      if (isset($this->config->current['IDGEN'])){
+        $this->got_uid= false;
+      } else {
+        $this->got_uid= true;
+      }
+
+      /* Create new usertab object */
+      $this->usertab= new usertabs($this->config,$this->config->data['TABS']['USERTABS'], $this->dn);
+      $this->usertab->by_object['user']->base= $this->DivListUsers->selectedBase;
+      $this->usertab->set_acl_base('dummy,'.$this->DivListUsers->selectedBase);
+
+      /* Take care about templates */
+      if ($s_action=="new_tpl"){
+        $this->is_template= TRUE;
+        $this->usertab->set_template_mode ();
+      } else {
+        $this->is_template= FALSE;
+      }
+
+      /* Use template if there are any of them */
+      if ((count($this->templates) && ($s_action!='new_tpl'))||($s_action=="create_user_from_tpl")){
+        foreach(array("sn", "givenName", "uid", "got_uid", "templates") as $attr){
+          $smarty->assign("$attr", $this->$attr);
+        }
+        if ($s_action=="create_user_from_tpl"){
+          $smarty->assign("template", $this->dn= $this->list[trim($s_entry)]['dn']);
+        } else {
+          $smarty->assign("template", "none");
+        }
+        $smarty->assign("edit_uid", "");
+        return($smarty->fetch(get_template_path('template.tpl', TRUE)));
+      }
+    }
+
+    /********************
+      Template selected continue edit
+     ********************/
+
+    /* Continue template editing */
+    if ((isset($_POST['template_continue'])) && ($_POST['template'] != 'none') && (!isset($_POST['uid']))){
+
+      $this->sn             = $_POST['sn'];
+      $this->givenName      = $_POST['givenName'];
+
+      /* Check for requred values */
+      $message= array();
+      if ($this->sn == "") {
+        $message[]= _("The required field 'Name' is not set.");
+      }
+      if ($this->givenName == "") {
+        $message[]= _("The required field 'Given name' is not set.");
+      }
+
+      /* Check if dn is used */
+      $dn= preg_replace("/^[^,]+,/i", "", $_POST['template']);
+      $ldap= $this->config->get_ldap_link();
+      $ldap->cd ($dn);
+      $ldap->search ("(&(sn=".normalizeLdap($this->sn).")(givenName=".normalizeLdap($this->givenName)."))", array("givenName"));
+      if ($ldap->count () != 0){
+        $message[]= _("A person with the choosen name is already used in this tree.");
+      }
+
+      /* Show error message / continue editing */
+      if (count($message) > 0){
+        show_errors ($message);
+      } else {
+        $attributes= array('sn' => $this->sn, 'givenName' => $this->givenName);
+        if (isset($this->config->current['IDGEN']) &&
+            $this->config->current['IDGEN'] != ""){
+          $uids= gen_uids ($this->config->current['IDGEN'], $attributes);
+          if (count($uids)){
+            $smarty->assign("edit_uid", "false");
+            $smarty->assign("uids", $uids);
+            $this->uid= current($uids);
+          }
+        } else {
+          $smarty->assign("edit_uid", "");
+          $this->uid= "";
+        }
+        $this->got_uid= true;
+      }
+
+      foreach(array("sn", "givenName", "uid", "got_uid", "templates") as $attr){
+        $smarty->assign("$attr", $this->$attr);
+      }
+      if (isset($_POST['template'])){
+        $smarty->assign("template", $_POST['template']);
+      }
+      return($smarty->fetch(get_template_path('template.tpl', TRUE)));
+    }
+
+    /********************
+      No template selected continue edit
+     ********************/
+
+    /* No template. Ok. Lets fill data into the normal user dialog */
+    if (isset($_POST['template_continue']) && $_POST['template'] == 'none'){
+      foreach(array("sn", "givenName", "uid") as $attr){
+        if (isset($_POST[$attr])){
+          $this->usertab->by_object['user']->$attr= $_POST[$attr];
+        }
+      }
+    }
+
+
+    /********************
+      Template selected continue edit
+     ********************/
+
+    /* Finish template preamble */
+    if (isset($_POST['template_continue']) && $_POST['template'] != 'none' && (isset($_POST['uid']))){
+
+      /* Might not be filled if IDGEN is unset */
+      $this->sn                 = $_POST['sn'];
+      $this->givenName          = $_POST['givenName'];
+
+      /* Move user supplied data to sub plugins */
+      $this->uid                = $_POST['uid'];
+      $this->usertab->uid       = $this->uid;
+      $this->usertab->sn        = $this->sn;
+      $this->usertab->givenName = $this->givenName;
+      $template_dn              = $_POST['template'];
+      $this->usertab->adapt_from_template($template_dn);
+      $template_base            = preg_replace("/^[^,]+,".normalizePreg(get_people_ou())."/", '', $template_dn);
+      $this->usertab->by_object['user']->base= $template_base;
+    }
+   
+    /********************
+      If no template was selected set base
+     ********************/
+
+    if (isset($_POST['template_continue']) && ($_POST['template'] == 'none')){
+      $this->usertab->by_object['user']->base= $this->DivListUsers->selectedBase;
+    }
+
+
+    /********************
+      Display subdialog 
+     ********************/
+
+    /* Show tab dialog if object is present */
+    if(isset($this->usertab->config)){
+      $display= $this->usertab->execute();
+
+      /* Don't show buttons if tab dialog requests this */
+      
+        $dia = FALSE;
+        if(isset($this->usertab->by_object[$this->usertab->current]->dialog)){
+          $dia = $this->usertab->by_object[$this->usertab->current]->dialog;
+        }
+
+        if(!is_object($dia) && $dia != TRUE){
+          $display.= "<p style=\"text-align:right\">\n";
+          $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
+          $display.= "&nbsp;\n";
+          if ($this->dn != "new"){
+            $display.= "<input type=submit name=\"edit_apply\" value=\""._("Apply")."\">\n";
+            $display.= "&nbsp;\n";
+          }
+          $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+          $display.= "</p>";
+        }
+      return ($display);
+    }
+    
+    /* Check if there is a snapshot dialog open */
+    $base = $this->DivListUsers->selectedBase;
+    if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases())){
+      return($str);
+    }
+  
+    /* Return rendered main page */
+        /* Display dialog with system list */
+    $this->DivListUsers->parent = $this;
+    $this->DivListUsers->execute();
+
+    /* Add departments if subsearch is disabled */
+    if(!$this->DivListUsers->SubSearch){
+      $this->DivListUsers->AddDepartments($this->DivListUsers->selectedBase,4,1);
+    }
+    $this->reload();
+    $this->DivListUsers->setEntries($this->list);
+    return($this->DivListUsers->Draw());
+  }
+
+
+  /* Return departments, that will be included within snapshot detection */
+  function get_used_snapshot_bases()
+  {
+    return(array(get_people_ou().$this->DivListUsers->selectedBase));
+  }  
+
+
+  function reload()
+  {
+    /* Set base for all searches */
+    $base= $this->DivListUsers->selectedBase;
+    $this->list =array();
+
+    /* Get filter configuration */
+    $Regex                = $this->DivListUsers->Regex;
+    $SubSearch            = $this->DivListUsers->SubSearch;
+    $ShowTemplates        = $this->DivListUsers->ShowTemplates;
+    $ShowFunctionalUsers  = $this->DivListUsers->ShowFunctionalUsers;
+    $ShowUnixUsers        = $this->DivListUsers->ShowUnixUsers;
+    $ShowMailUsers        = $this->DivListUsers->ShowMailUsers;
+    $ShowSambaUsers       = $this->DivListUsers->ShowSambaUsers;
+    $ShowProxyUsers       = $this->DivListUsers->ShowProxyUsers;
+
+    /* Setup filter depending on selection */
+    $filter="";
+    if ($this->config->current['SAMBAVERSION'] == 3){
+      $samba= "sambaSamAccount";
+    } else {
+      $samba= "sambaAccount";
+    }
+
+    if ($ShowFunctionalUsers){
+      $filter.= "(&(objectClass=gosaAccount)(!(|(objectClass=posixAccount)".
+                "(objectClass=gosaMailAccount)(objectClass=$samba)".
+                "(objectClass=gosaProxyAccount))))";
+    }
+    if ($ShowUnixUsers){
+      $filter.= "(objectClass=posixAccount)";
+    }
+    if ($ShowMailUsers){
+      $filter.= "(objectClass=gosaMailAccount)";
+    }
+    if ($ShowSambaUsers){
+      $filter.= "(objectClass=$samba)";
+    }
+    if ($ShowProxyUsers){
+      $filter.= "(objectClass=gosaProxyAccount)";
+    }
+    if ($ShowTemplates){
+      $filter= "(|(objectClass=gosaUserTemplate)(&(objectClass=gosaAccount)(|$filter)))";
+    } else {
+      $filter= "(&(objectClass=gosaAccount)(!(objectClass=gosaUserTemplate))(|$filter))";
+    }
+    $filter= "(&(|(uid=".normalizeLdap($Regex).")(sn=".normalizeLdap($Regex).")(givenName=".normalizeLdap($Regex)."))$filter)";
+
+    /* Generate userlist */
+    $ldap= $this->config->get_ldap_link(TRUE);
+
+    if ($SubSearch){
+      $ListTemp =  get_list($filter, "users", $base,
+                            array("uid", "givenName", "sn", "objectClass","userPassword"), GL_SUBSEARCH | GL_SIZELIMIT);
+    } else {
+      $base= get_people_ou().$base;
+      $ListTemp = get_list($filter, "users", $base, 
+                            array("uid", "givenName", "sn", "objectClass","userPassword"), GL_SIZELIMIT);
+    }
+    $SortTemp = array();
+    $List = array();
+    foreach($ListTemp as $Key => $Entry){
+
+      /* Skip entries that are not located under the people ou (normaly 'ou=people,')
+       * Else winstations will be listed too, if you use the subtree flag. 
+       */
+      if(!preg_match("/".normalizePreg(get_people_ou())."/i",$Entry['dn'])){
+        continue;
+      }else{
+
+        // Generate caption for rows
+        if (isset($Entry["sn"]) && isset($Entry["givenName"])){
+          $display= $Entry["sn"][0].", ".$Entry["givenName"][0]." [".$Entry["uid"][0]."]";
+        } else {
+          $display= "[".$Entry["uid"][0]."]";
+        }
+
+        $display = strtolower($display);
+        $List[$display] = $Entry;
+        $SortTemp[$display] = $display;
+      }
+    }
+    sort($SortTemp);
+    reset($SortTemp);
+
+    $this->list = array();
+    foreach($SortTemp as $Key){
+      $this->list[] = $List[$Key];
+    }
+  }
+
+  function remove_lock()
+  {
+    /* Remove user lock if a DN is marked as "currently edited" */
+    if (isset($this->usertab->dn)){
+      del_lock ($this->usertab->dn);
+    }
+  }
+
+
+  function copyPasteHandling_from_queue($s_action,$s_entry)
+  {
+    /* Check if Copy & Paste is disabled */
+    if(!is_object($this->CopyPasteHandler)){
+      return("");
+    }
+
+    /* Add a single entry to queue */
+    if($s_action == "cut" || $s_action == "copy"){
+      /* Cleanup object queue */
+      $this->CopyPasteHandler->cleanup_queue();
+      $dn = $this->list[$s_entry]['dn'];
+      $this->CopyPasteHandler->add_to_queue($dn,$s_action,"usertabs","USERTABS","users");
+    }
+
+    /* Add entries to queue */
+    if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
+
+      /* Cleanup object queue */
+      $this->CopyPasteHandler->cleanup_queue();
+
+      /* Add new entries to CP queue */
+      foreach($this->list_get_selected_items() as $id){
+        $dn = $this->list[$id]['dn'];
+
+        if($s_action == "copy_multiple"){
+          $this->CopyPasteHandler->add_to_queue($dn,"copy","usertabs","USERTABS","users");
+        }
+        if($s_action == "cut_multiple"){
+          $this->CopyPasteHandler->add_to_queue($dn,"cut","usertabs","USERTABS","users");
+        }
+      }
+    }
+    
+    /* Start pasting entries */
+    if($s_action == "editPaste"){
+      $this->start_pasting_copied_objects = TRUE;
+    }
+
+    /* Return C&P dialog */ 
+    if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
+   
+      /* Load entry from queue and set base */
+      $this->CopyPasteHandler->load_entry_from_queue();
+      $this->CopyPasteHandler->SetVar("base",$this->DivListUsers->selectedBase); 
+
+      /* Get dialog */
+      $data = $this->CopyPasteHandler->execute();
+
+      /* Set CPPasswordChange to s_entry which indicates that this entry requires a new password. */
+      if(isset($_POST['passwordTodo']) && ($_POST['passwordTodo'] == "new")){
+        $s_entry = $this->CopyPasteHandler->last_entry();
+        $this->reload();
+        foreach($this->list as $key => $entry){
+          if($entry['dn'] == $s_entry){
+            $this->CPPasswordChange = $key;
+          }
+        }
+      }
+
+      /* Return dialog data */
+      if(!empty($data) && $this->CPPasswordChange == ""){
+        return($data);
+      }
+    }
+
+    /* Automatically disable status for pasting */ 
+    if(!$this->CopyPasteHandler->entries_queued()){
+      $this->start_pasting_copied_objects = FALSE;
+    }
+    return("");
+  }
+
+
+  function save_object()
+  {
+    /* Handle divlist filter && department selection*/
+    if(!is_object($this->usertab)){
+      $this->DivListUsers->save_object();
+    }
+  }
+
+    
+  function list_get_selected_items()
+  {
+    $ids = array();
+    foreach($_POST as $name => $value){
+      if(preg_match("/^item_selected_[0-9]*$/",$name)){
+        $id   = preg_replace("/^item_selected_/","",$name);
+        $ids[$id] = $id;
+      }
+    }
+    return($ids);
+  }
+  
+
+  /* A set of disabled and therefore overloaded functions. They are
+     not needed in this class. */
+  function remove_from_parent() { } 
+  function check() { } 
+  function save() { } 
+  function adapt_from_template($dn) { } 
+  function password_change_needed() { } 
+
+} /* ... class userManagement */
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/users/main.inc b/gosa-core/plugins/admin/users/main.inc
new file mode 100644 (file)
index 0000000..d545835
--- /dev/null
@@ -0,0 +1,65 @@
+<?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
+ */
+
+if ($remove_lock){
+  if(isset($_SESSION['userManagement'])){
+    $userManagement= $_SESSION['userManagement'];
+    $userManagement->remove_lock();
+    del_lock ($ui->dn);
+    sess_del ('userManagement');
+  }
+} else {
+  /* Create usermanagement object on demand */
+  if (!isset($_SESSION['userManagement']) ||
+     (isset($_GET['reset']) && $_GET['reset'] == 1)){
+    $_SESSION['userManagement']= new userManagement ($config, $_SESSION['ui']);
+    $_SESSION['userManagement']->set_acl_category("users");
+  }
+  $userManagement= $_SESSION['userManagement'];
+  $userManagement->save_object();
+  $output= $userManagement->execute();
+
+  /* Page header*/
+  if (isset($_SESSION['objectinfo'])){
+    $display= print_header(get_template_path('images/user.png'),
+                           _("User administration"),
+                           "<img alt=\"\" class=\"center\" src=\"".
+                           get_template_path('images/closedlock.png').
+                           "\"> ".@LDAP::fix($_SESSION['objectinfo']));
+  } else {
+    $display= print_header(get_template_path('images/user.png'),
+                          _("User administration"));
+  }
+
+  /* Generate dialog output */
+  $display.= $output;
+
+  /* Reset requested? */
+  if (isset($_GET['reset']) && $_GET['reset'] == 1){
+    del_lock ($ui->dn);
+    sess_del ('userManagement');
+  }
+
+  /* Show and save dialog */
+  $_SESSION['userManagement']= $userManagement;
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/users/password.tpl b/gosa-core/plugins/admin/users/password.tpl
new file mode 100644 (file)
index 0000000..83dfc24
--- /dev/null
@@ -0,0 +1,32 @@
+<p>
+ {t}To change the user password use the fields below. The changes take effect immediately. Please memorize the new password, because the user wouldn't be able to login without it.{/t}
+</p>
+
+<p>
+ {t}Changing the password affects your authentification on mail, proxy, samba and unix services.{/t}
+</p>
+
+<table summary="" style="vertical-align:top; text-align:left;" cellpadding=4 border=0>
+  <tr>
+    <td><b><LABEL for="new_password">{t}New password{/t}</LABEL></b></td>
+    <td><input type="password" id="new_password" name="new_password" size="30" maxlength="40" onFocus="nextfield= 'repeated_password';"></td>
+  </tr>
+  <tr>
+    <td><b><LABEL for="repeated_password">{t}Repeat new password{/t}</LABEL></b></td>
+    <td><input type="password" id="repeated_password" name="repeated_password" size="30" maxlength="40" onFocus="nextfiled= 'password_finish'"></td>
+  </tr>
+</table>
+<br>
+<p class="plugbottom">
+  <input type=submit name="password_finish" value="{t}Set password{/t}">
+  &nbsp;
+  <input type=submit name="password_cancel" value="{t}Cancel{/t}">
+</p>
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       nextfield= "new_password";
+       focus_field('new_password');
+  -->
+</script>
diff --git a/gosa-core/plugins/admin/users/remove.tpl b/gosa-core/plugins/admin/users/remove.tpl
new file mode 100644 (file)
index 0000000..eb41471
--- /dev/null
@@ -0,0 +1,23 @@
+<div style="font-size:18px;">
+ <img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
+</div>
+<p>
+  {$info}
+  {t}This includes all account data, system access rules, imap settings, etc. for this user. 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}So - if you're sure - press 'Delete' to continue or 'Cancel' to abort.{/t}
+</p>
+
+<p class="plugbottom">
+  {if $multiple}
+  <input type=submit name="delete_multiple_user_confirm" value="{t}Delete{/t}">
+  <input type=submit name="delete_multiple_user_cancel" value="{t}Cancel{/t}">
+  {else}
+  <input type=submit name="delete_user_confirm" value="{t}Delete{/t}">
+  <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
+  {/if}
+  &nbsp;
+</p>
+
diff --git a/gosa-core/plugins/admin/users/tabs_user.inc b/gosa-core/plugins/admin/users/tabs_user.inc
new file mode 100644 (file)
index 0000000..c656533
--- /dev/null
@@ -0,0 +1,142 @@
+<?php
+
+class usertabs extends tabs
+{
+  var $base;
+
+  function usertabs($config, $data, $dn)
+  {
+    tabs::tabs($config, $data, $dn, 'users');
+    $this->base= $this->by_object['user']->base;
+
+    /* Add references/acls/snapshots */
+    $this->addSpecialTabs();
+
+  }
+
+  function save_object($save_current= FALSE)
+  {
+    tabs::save_object($save_current);
+
+    /* Update reference, transfer variables */
+    $baseobject= $this->by_object['user'];
+    foreach ($this->by_object as $name => $obj){
+
+      /* Adding uid to sub plugins of connectivity */
+      if($name == "connectivity"){
+        foreach ($obj->plugin_name as $plg_name){
+          if(isset($obj->plugin[$plg_name]->uid)){
+            $obj->plugin[$plg_name]->uid = $baseobject->uid;
+          }
+        }
+      }
+
+      /* Don't touch base object */
+      if ($name != 'user'){
+        $obj->parent= &$this;
+        $obj->uid= $baseobject->uid;
+        $obj->sn= $baseobject->uid;
+        $obj->givenName= $baseobject->uid;
+      }
+
+      /* Copy mail if needed */
+      if ($name == "gofaxAccount"){
+        if (isset($this->by_object['mailAccount']) && $this->by_object['mailAccount']->is_account){
+          $obj->mail= $this->by_object['mailAccount']->mail;
+        }
+      }
+
+      $this->by_object[$name]= $obj;
+
+      /* Update parent in base object */
+      $this->by_object['user']->parent= &$this;
+    }
+
+    /* Move facsimile / phone number if nessecary */
+    if ($this->last == "user" && isset($this->by_object['gofaxAccount'])){
+
+      /* Move number to fax plugin */
+      $this->by_object['gofaxAccount']->facsimileTelephoneNumber=
+        $this->by_object['user']->facsimileTelephoneNumber;
+
+      /* Move phone number if plugin exists */
+      if (isset($this->by_object['phoneAccount']) && 
+          !$this->by_object['phoneAccount']->is_account){
+        $this->by_object['phoneAccount']->phoneNumbers= array();
+        if ($this->by_object['user']->telephoneNumber != ""){
+          $this->by_object['phoneAccount']->phoneNumbers[$this->by_object['user']->telephoneNumber]= $this->by_object['user']->telephoneNumber;
+        }
+      }
+    }
+
+    /* Move number from fax plugin */
+    if ($this->last == "gofaxAccount"){
+
+      $this->by_object['user']->facsimileTelephoneNumber=
+        $this->by_object['gofaxAccount']->facsimileTelephoneNumber;
+    }
+
+    /* Move number from fax plugin */
+    if ($this->last == "phoneAccount" && $this->by_object['phoneAccount']->is_account){
+      reset($this->by_object['phoneAccount']->phoneNumbers);
+      $number= key($this->by_object['phoneAccount']->phoneNumbers);
+
+      /* Only the first phoneAccount number, if it is not empty */
+      if(!empty($number)){
+        $this->by_object['user']->telephoneNumber= $number;
+      }
+    }
+
+    /* Possibly change acl base */
+    $this->set_acl_base();
+  }
+
+  function save($ignore_account= FALSE)
+  {
+    /* Check for new 'dn', in order to propagate the
+       'dn' to all plugins */
+    $baseobject= $this->by_object['user'];
+    $baseobject->update_new_dn();
+    if ($this->dn != 'new'){
+
+      $new_dn= $baseobject->new_dn;
+
+      if (strtolower($this->dn) != strtolower($new_dn)){
+
+        /* Udpate acls */
+        $baseobject->update_acls($this->dn,$new_dn);
+        $baseobject->move($this->dn, $new_dn);
+        $this->by_object['user']= $baseobject;
+
+        /* Did we change ourselves? Update ui object. */
+        change_ui_dn($this->dn, $new_dn);
+      }
+    }
+
+    $this->dn= $baseobject->new_dn;
+
+    return tabs::save();
+  }
+
+
+  function set_template_mode()
+  {
+    foreach ($this->by_object as $key => $obj){
+      $this->by_object[$key]->is_template= TRUE;
+    }
+  }
+  
+  function saveCopyDialog()
+  {
+    tabs::saveCopyDialog();
+    $baseobject= $this->by_object['user'];
+    $uid = $baseobject->uid;
+    foreach($this->by_object as  $name => $obj){
+      $this->by_object[$name]->uid = $uid;
+    }
+  }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/admin/users/template.tpl b/gosa-core/plugins/admin/users/template.tpl
new file mode 100644 (file)
index 0000000..37237f9
--- /dev/null
@@ -0,0 +1,60 @@
+<div style="font-size:18px;">
+  {t}Creating a new user using templates{/t}
+</div>
+
+<p>
+ {t}Creating a new user can be assisted by using templates. Many database records will be filled automatically. Choose 'none' to skip the usage of templates.{/t}
+</p>
+
+<p class="seperator">&nbsp;</p>
+
+<br>
+
+<table summary="" style="vertical-align:top; text-align:left;" cellpadding=4 border=0>
+  <tr>
+    <td><b><LABEL for="template">{t}Template{/t}</LABEL></b></td>
+    <td>
+      <select size="1" name="template" id="template">
+       {html_options options=$templates selected=$template}
+      </select>
+    </td>
+  </tr>
+  <tr>
+    <td><b><LABEL for="sn">{t}Last name{/t}</LABEL></b></td>
+    <td><input name="sn" id="sn" size="30" maxlength="40" value="{$sn}"></td>
+  </tr>
+  <tr>
+    <td><b><LABEL for="givenName">{t}First name{/t}</LABEL></b></td>
+    <td><input name="givenName" id="givenName" size="30" maxlength="40" value="{$givenName}"></td>
+  </tr>
+  {if $got_uid eq "true"}
+  <tr>
+    <td><b>{t}Login{/t}</b></td>
+    <td>
+      {if $edit_uid eq "false"}
+      <select size="1" name="uid">
+        {html_options output=$uids values=$uids selected=$uid}
+      </select>
+      {else}
+      <input name="uid" size="30" maxlength="40" value="{$uid}">
+      {/if}
+    </td>
+  </tr>
+  {/if}
+</table>
+
+<br>
+<p class="plugbottom">
+  <input type=submit name="template_continue" value="{t}Continue{/t}">
+  &nbsp;
+  <input type=submit name="edit_cancel" value="{t}Cancel{/t}">
+</p>
+
+
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('sn');
+  -->
+</script>
diff --git a/gosa-core/plugins/generic/references/class_reference.inc b/gosa-core/plugins/generic/references/class_reference.inc
new file mode 100644 (file)
index 0000000..472e42e
--- /dev/null
@@ -0,0 +1,181 @@
+<?php
+
+class reference extends plugin
+{
+  /* attribute list for save action */
+  var $attributes= array();
+  var $objectclasses= array();
+  var $objectlist= "";
+  var $obtypes= array();
+  var $fold= array();
+  var $objectCache= array();
+
+  function reference (&$config, $dn= NULL)
+  {
+       /* Include config object */
+       $this->config= &$config;
+       $this->dn= $dn;
+
+        /* Fill translation array */
+        $this->obtypes= array(  "gosaAccount" => array(           "text" => _("Generic"),
+                                                          "image" => "penguin.png"),
+                               "posixAccount" => array(   "text" =>_("UNIX"),
+                                                          "image" => "select_user.png"),
+                                "gosaMailAccount" => array("text" => _("Mail"),
+                                                          "image" => "mailto.png"),
+                                "sambaSamAccount" => array("text" => _("Samba"),
+                                                          "image" => "select_winstation.png"),
+                                "sambaAccount" => array(   "text" => _("Samba"),
+                                                          "image" => "select_winstation.png"),
+                                "goFaxAccount" => array(   "text" => _("FAX"),
+                                                          "image" => "fax_small.png"),
+                                "gosaProxyAccount" => array("text" => _("Proxy"),
+                                                          "image" => "select_proxy.png"),
+                                "PureFTPdUser" => array(   "text" => _("FTP"),
+                                                          "image" => "select_proxy.png"),
+                                "posixGroup" => array(     "text" => _("Group"),
+                                                          "image" => "select_groups.png"),
+                                "gosaDepartment" => array( "text" => _("Department"),
+                                                          "image" => "select_department.png"),
+                                "goFonHardware" => array(   "text" => _("Phone"),
+                                                          "image" => "select_phone.png"),
+                                "gosaApplication" => array("text" => _("Application"),
+                                                          "image" => "select_application.png"),
+                                "goServer" => array(      "text" => _("Server"),
+                                                          "image" => "select_server.png"),
+                                "gotoTerminal" => array(   "text" => _("Thin Client"),
+                                                          "image" => "select_terminal.png"),
+                                "gotoWorkstation" => array("text" => _("Workstation"),
+                                                          "image" => "select_workstation.png"),
+                                "gosaGroupOfNames" => array("text" => _("Object group"),
+                                                          "image" => "select_ogroup.png"),
+                                "gotoPrinter" => array(           "text" => _("Printer"),
+                                                          "image" => "select_printer.png"));
+  }
+
+  function execute()
+  {
+       /* Call parent execute */
+       plugin::execute();
+
+       /* Set government mode */
+       $smarty= get_smarty();
+
+       if (isset($_GET['show'])){
+               $dn= base64_decode($_GET['show']);
+               if (isset($this->fold["$dn"])){
+                       unset($this->fold["$dn"]);
+               } else {
+                       $this->fold["$dn"]= "$dn";
+               }
+       }
+
+       /* Fill array */
+       $this->reload();
+       $smarty->assign("objectList", $this->objectlist);
+
+       /* Show main page */
+       return ($smarty->fetch (get_template_path('contents.tpl', TRUE, dirname(__FILE__))));
+  }
+
+  function reload()
+  {
+       $ldap= $this->config->get_ldap_link();
+       $ldap->cd($this->config->current['BASE']);
+       $ldap->search("(|(member=".$this->dn.")(memberUid=".$this->uid."))",array("memberUid","member","cn","description","objectClass"));
+       
+       $cycle= array("F5F5F5", "ECECEC");
+       $id= 0;
+       $this->objectlist= "";
+       while ($attrs= $ldap->fetch()){
+
+               /* Add more information? */
+               $addon= "";
+               if (in_array($attrs['dn'], $this->fold)){
+                       $memberattr= "";
+                       if (isset($attrs['memberUid'])){
+                               unset($attrs['memberUid']['count']);
+                               $memberattr= "memberUid";
+                       } 
+                       if (isset($attrs['member'])){
+                               unset($attrs['member']['count']);
+                               $memberattr= "member";
+                       } 
+                       if ($memberattr == ""){
+                               continue;
+                       }
+                       foreach ($attrs[$memberattr] as $uid){
+                               $content= $this->getCacheObject($uid);
+                               if ($content === NULL) {
+                                       continue;
+                               }
+                               $addon.= '<tr style="background-color:'.$cycle[$id&1].';"><td title="'.$attrs['cn'][0].'">&nbsp;&nbsp;&nbsp;'.$content['name'].'</td><td>'.$content['description'].'</td><td>'.$content['type'].'</td> </tr>';
+                       }
+               }
+
+               /* Build final entry */
+               if (isset($attrs['description'])){
+                       $description= $attrs['description'][0];
+               } else {
+                       $description= "-";
+               }
+               $content= $this->createContentString($attrs['objectClass']);
+               if ($addon == ""){
+                       $img= "images/expand.png";
+               } else {
+                       $img= "images/sort_down.png";
+               }
+               $this->objectlist.= '<tr style="background-color:'.$cycle[$id&1].';"><td class="phonelist" title="'.$attrs['cn'][0].'"><a href="main.php?plug='.$_GET['plug'].'&amp;start=&amp;show='.base64_encode($attrs['dn']).'"><img alt="" src="'.$img.'" border=0>&nbsp;'.$attrs['cn'][0].'</a></td><td>'.$description.'</td><td>'.$content.'</td> </tr>'.$addon;
+
+               $id++;
+       }
+       
+  }
+
+  function getCacheObject($dn)
+  {
+       if (!isset($this->objectCache[$dn])){
+               $ldap= $this->config->get_ldap_link();
+               if (preg_match('/,/', $dn)){
+                       $ldap->cat($dn, array("cn", "objectClass", "description","ou"));
+               } else {
+                       $ldap->search("(uid=$dn)", array("cn", "objectClass", "description","ou"));
+               }
+               if ($ldap->count()){
+                       $attrs= $ldap->fetch();
+
+                       if(isset($attrs['ou']) && !isset($attrs['cn'])){
+                               $attrs['cn'] = $attrs['ou'];
+                       }
+                               
+                       if (isset($attrs['description'])){
+                               $description= $attrs['description'][0];
+                       } else {
+                               $description= "-";
+                       }
+                       $this->objectCache[$dn]= array( 'name' => $attrs['cn'][0],
+                                       'description' => "$description",
+                                       'type' => $this->createContentString($attrs['objectClass']));
+               } else {
+                       return NULL;
+               }
+       }
+       return ($this->objectCache[$dn]);
+  }
+
+  function createContentString($classes)
+  {
+       $result= "";
+       if(!is_null($classes)) {
+               foreach ($classes as $class){
+                       if (isset($this->obtypes[$class])){
+                               $result.= "<a><img alt=\"\" border=0 src='images/".$this->obtypes[$class]['image']."'>&nbsp;".$this->obtypes[$class]['text']."</a> ";
+                       }
+               }
+       }
+       return (preg_replace('/ $/', '', $result));
+  }
+  
+}
+
+?>
diff --git a/gosa-core/plugins/generic/references/contents.tpl b/gosa-core/plugins/generic/references/contents.tpl
new file mode 100644 (file)
index 0000000..e953da1
--- /dev/null
@@ -0,0 +1,19 @@
+{if $objectList ne ""}
+<table summary="" style="width:100%; vertical-align:top; text-align:left; border:1px solid #B0B0B0;"  cellpadding=4 cellspacing=0 border=0 rules="cols">
+
+ <colgroup>
+  <col width="20%">
+  <col width="20%">
+  <col width="60%">
+ </colgroup>
+
+ <tr style="background-color: #E8E8E8; height:26px;font-weight:bold;">
+  <td>{t}Object name{/t}</td><td>{t}Description{/t}</td><td>{t}Contents{/t}</td>
+ </tr>
+
+ {$objectList}
+
+</table>
+{else}
+<b>{t}This object has no relationship to other objects.{/t}</b>
+{/if}
diff --git a/gosa-core/plugins/generic/welcome/main.inc b/gosa-core/plugins/generic/welcome/main.inc
new file mode 100644 (file)
index 0000000..eb0c63c
--- /dev/null
@@ -0,0 +1,30 @@
+<?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
+*/
+
+if (!$remove_lock){
+       $_SESSION['plugin_dir']= dirname(__FILE__);
+       $smarty->assign("iconmenu", $plist->show_iconmenu());
+       $smarty->assign("header", print_header(get_template_path('images/hdd_linux_unmount.png'), sprintf(_("Welcome %s!"), $ui->cn)));
+       $smarty->assign("year", date("Y"));
+       $smarty->assign("revision", get_gosa_version());
+       $display= $smarty->fetch(get_template_path('welcome.tpl', TRUE));
+}
+
+?>
diff --git a/gosa-core/plugins/generic/welcome/welcome.tpl b/gosa-core/plugins/generic/welcome/welcome.tpl
new file mode 100644 (file)
index 0000000..35a27ed
--- /dev/null
@@ -0,0 +1,19 @@
+{$header}
+
+<p>
+  {t}This is the GOsa main menu. You can select your tasks from the menu on the left, or by choosing one of the pictograms below. All changes apply directly to your companies LDAP server.{/t}
+</p>
+
+<p>
+  {t}Use 'Sign out' on the upper left to close the connection and 'Main' to get back to the pictogram view.{/t}
+</p>
+{$iconmenu}
+
+<br>
+
+<div class="copynotice">&copy; 2002-{$year} <a href="http://gosa.gonicus.de">{t}The GOsa team{/t}, {$revision}</a>
+</div>
+
+<input type="hidden" name="ignore">
+
diff --git a/gosa-core/plugins/gofax/blocklists/class_blocklistGeneric.inc b/gosa-core/plugins/gofax/blocklists/class_blocklistGeneric.inc
new file mode 100644 (file)
index 0000000..1928466
--- /dev/null
@@ -0,0 +1,371 @@
+<?php
+
+define("BLOCK_LIST_RECEIVE" , 0);
+define("BLOCK_LIST_SEND" , 1);
+
+class blocklistGeneric extends plugin
+{
+  /* Definitions */
+  var $plHeadline= "FAX Blocklists";
+  var $plDescription= "This does something";
+
+  var $cn ="";
+  var $description = "";
+  var $base = "";  
+
+  var $type;
+  var $goFaxBlocklist = array();
+  var $readonly = FALSE;
+  var $view_logged = FALSE;
+  var $attributes = array("cn","description");
+
+  var $ignore_account = TRUE;
+  
+  function __construct($config,$dn = "new")
+  {
+    plugin::plugin($config,$dn);
+
+    /* Set default list type */
+    $this->type = BLOCK_LIST_SEND;
+
+    /* Load defined numbers */
+    if($dn != "new"){
+  
+      /* We will not be able to rename edited blocklists */
+      $this->readonly = TRUE;
+  
+      /* Get blocklist type and defined numbers */
+      if (in_array("goFaxSBlock",$this->attrs['objectClass'])){
+        if(isset($this->attrs["goFaxSBlocklist"])){
+          for ($i= 0; $i<$this->attrs["goFaxSBlocklist"]["count"]; $i++){
+            $this->goFaxBlocklist[]= $this->attrs["goFaxSBlocklist"][$i];
+          }
+        }
+        $this->type= BLOCK_LIST_SEND;
+      } elseif (in_array("goFaxRBlock",$this->attrs['objectClass'])){
+        if(isset($this->attrs["goFaxRBlocklist"])){
+          for ($i= 0; $i<$this->attrs["goFaxRBlocklist"]["count"]; $i++){
+            $this->goFaxBlocklist[]= $this->attrs["goFaxRBlocklist"][$i];
+          }
+        }
+        $this->type= BLOCK_LIST_RECEIVE;
+      }
+    }
+
+    /* Set base */
+    if ($this->dn == "new"){
+      if(isset($_SESSION['CurrentMainBase'])){
+        $this->base= $_SESSION['CurrentMainBase'];
+      }else{
+        $ui= get_userinfo();
+        $this->base= dn2base($ui->dn);
+      }
+    } else {
+      $this->base =preg_replace ("/^[^,]+,[^,]+,[^,]+,/","",$this->dn);
+    }
+  }
+
+  public function execute()
+  {
+    /* Log view */
+    if(!$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","blocklist/".get_class($this),$this->dn);
+    }
+
+
+    /**************
+     * Base select dialog 
+     **************/
+
+    $once = true;
+    foreach($_POST as $name => $value){
+      if(preg_match("/^chooseBase/",$name) && $once){
+        $once = false;
+        $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
+        $this->dialog->setCurrentBase($this->base);
+      }
+    }
+
+    /* Dialog handling */
+    if(is_object($this->dialog)){
+      /* Must be called before save_object */
+      $this->dialog->save_object();
+
+      if($this->dialog->isClosed()){
+        $this->dialog = false;
+      }elseif($this->dialog->isSelected()){
+
+        /* A new base was selected, check if it is a valid one */
+        $tmp = $this->get_allowed_bases();
+        if(isset($tmp[$this->dialog->isSelected()])){
+          $this->base = $this->dialog->isSelected();
+        }
+        $this->dialog= false;
+
+      }else{
+        return($this->dialog->execute());
+      }
+    }
+
+
+    /***************
+      Add numer to blocklist
+     ***************/
+
+
+    /* Handle interactions: add */
+    if (isset($_POST['add_number']) && $_POST['number'] != ""){
+      if (is_phone_nr($_POST['number']) || preg_match ("/^[\/0-9 ()\^\.\$+*-]+$/",$_POST['number'])){
+        $this->addNumber ($_POST['number']);
+      } else {
+        print_red (_("Please specify a valid phone number."));
+      }
+    }
+
+
+    /***************
+      Delete number from list
+     ***************/
+
+    /* Handle interactions: delete */
+    if (isset($_POST['delete_number']) && isset($_POST['numbers']) && count($_POST['numbers']) > 0){
+      $this->delNumber ($_POST['numbers']);
+    }
+
+
+    /***************
+      Template output
+     ***************/
+
+    $smarty = get_smarty();
+    foreach($this->attributes as $name){
+      $smarty->assign($name,$this->$name);
+    }
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+    $smarty->assign("goFaxBlocklist",$this->goFaxBlocklist);
+    $smarty->assign("cnACL",$this->getacl("cn",$this->readonly));
+    $smarty->assign("typeACL",$this->getacl("type",$this->readonly));
+    $smarty->assign("base",$this->base);
+    $smarty->assign("bases", $this->get_allowed_bases());
+    $smarty->assign("types", array(BLOCK_LIST_SEND => _("send"), BLOCK_LIST_RECEIVE => _("receive")));
+    $smarty->assign("type", $this->type);
+    return($smarty->fetch(get_template_path('generic.tpl', TRUE)));
+  }
+
+
+  public function save_object()
+  {
+    if(isset($_POST['blocklist_posted'])){
+      $tmp_cn = $this->cn;
+      plugin::save_object();
+      $this->cn = $tmp_cn;
+
+      /* Save base, since this is no LDAP attribute */
+      $tmp = $this->get_allowed_bases();
+      if(isset($_POST['base'])){
+        if(isset($tmp[$_POST['base']])){
+          $this->base= $_POST['base'];
+        }
+      }
+      $tmp = $this->attributes;
+      $tmp[] = "type";
+      foreach($tmp as $attr){
+        if(in_array($attr,array("cn","type")) && $this->readonly){
+          continue;
+        }elseif(isset($_POST[$attr]) && $this->acl_is_writeable($attr)){
+          $this->$attr = $_POST[$attr];
+        }
+      }
+    }
+  }
+
+
+  function remove_from_parent()
+  {
+    $ldap= $this->config->get_ldap_link();
+    $ldap->rmDir($this->dn);
+    new log("remove","gofaxlist/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    show_ldap_error($ldap->get_error(), sprintf(_("Removing of blocklist with dn '%s' failed."),$this->dn));
+    $this->handle_post_events("remove");
+  }
+
+
+  /* Check values */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    /* check syntax: must cn */
+    if ($this->cn == ""){
+      $message[]= _("Required field 'Name' is not set.");
+    } else {
+      if (!is_uid($this->cn)){
+        $message[]= _("Required field 'Name' contains invalid characters");
+      }
+      if ($this->dn == 'new'){
+        $ldap= $this->config->get_ldap_link();
+        $ldap->cd ("ou=gofax,ou=systems,".$this->config->current["BASE"]);
+        $ldap->search ("(&(|(objectClass=goFaxSBlock)(objectClass=goFaxRBlock))(cn=".$this->cn."))", array("cn"));
+        if ($ldap->count() != 0){
+          $message[]= _("Specified name is already used.");
+        }
+      }
+    }
+    return $message;
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    plugin::save();
+
+    /* Type selection */
+    if ($this->type == BLOCK_LIST_SEND){
+      $type= "goFaxSBlocklist";
+      $this->attrs['objectClass']= "goFaxSBlock";
+    } else {
+      $type= "goFaxRBlocklist";
+      $this->attrs['objectClass']= "goFaxRBlock";
+    }
+
+    /* Add list */
+    if (count($this->goFaxBlocklist)){
+      $this->attrs[$type]= $this->goFaxBlocklist;
+    }
+
+    /* Write back to ldap */
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd($this->base);
+    $ldap->cat($this->dn, array('dn'));
+    if ($ldap->count()){
+      if (!isset($this->attrs[$type])){
+        $this->attrs[$type]= array();
+      }
+      $ldap->cd($this->dn);
+      $this->cleanup();
+      $ldap->modify($this->attrs);
+      new log("modify","faxblocklist/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+      $this->handle_post_events("modify");
+    } else {
+      $ldap->cd($this->config->current['BASE']);
+      $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
+      $ldap->cd($this->dn);
+      $ldap->add($this->attrs);
+      new log("create","gofaxlist/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+      $this->handle_post_events("add");
+    }
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of blocklist with dn '%s' failed."),$this->dn));
+  }
+
+
+  /* Add number */
+  function addNumber($number)
+  {
+    if (!in_array($number, $this->goFaxBlocklist)){
+      $this->goFaxBlocklist[]= $number;
+      sort($this->goFaxBlocklist);
+    }
+  }
+
+
+  /* Remove number from list */
+  function delNumber($numbers)
+  {
+    $tmp= array();
+    foreach ($this->goFaxBlocklist as $val){
+      if (!in_array($val, $numbers)){
+        $tmp[]= $val;
+      }
+    }
+    $this->goFaxBlocklist= $tmp;
+  }
+
+
+  function getCopyDialog()
+  { 
+    $smarty = get_smarty();
+    $smarty->assign("cn",$this->cn);
+    $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE,dirname(__FILE__)));
+    $ret = array();
+    $ret['string'] = $str;
+    $ret['status'] = "";
+    return($ret);
+  }
+
+  function saveCopyDialog()
+  {
+    if(isset($_POST['cn'])){
+      $this->cn = get_post('cn');
+    }
+  }
+
+  
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);
+
+    /* We will not be able to rename edited blocklists */
+    $this->readonly = TRUE;
+
+    /* Get blocklist type and defined numbers */
+    if (in_array("goFaxSBlock",$source['objectClass'])){
+      if(isset($source["goFaxSBlocklist"])){
+        for ($i= 0; $i<$source["goFaxSBlocklist"]["count"]; $i++){
+          $this->goFaxBlocklist[]= $source["goFaxSBlocklist"][$i];
+        }
+      }
+      $this->type= BLOCK_LIST_SEND;
+    } elseif (in_array("goFaxRBlock",$source['objectClass'])){
+      if(isset($source["goFaxRBlocklist"])){
+        for ($i= 0; $i<$source["goFaxRBlocklist"]["count"]; $i++){
+          $this->goFaxBlocklist[]= $source["goFaxRBlocklist"][$i];
+        }
+      }
+      $this->type= BLOCK_LIST_RECEIVE;
+    }
+
+    /* Set base */
+    if ($this->dn == "new"){
+      if(isset($_SESSION['CurrentMainBase'])){
+        $this->base= $_SESSION['CurrentMainBase'];
+      }else{
+        $ui= get_userinfo();
+        $this->base= dn2base($ui->dn);
+      }
+    } else {
+      $this->base =preg_replace ("/^[^,]+,[^,]+,[^,]+,/","",$this->dn);
+    }
+  }
+
+
+  /* Return plugin informations for acl handling */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"       => _("Fax"),
+          "plDescription"     => _("Fax blocklists"),
+          "plSelfModify"      => FALSE,
+          "plDepends"         => array(),
+
+          "plPriority"    => 0,
+          "plSection"     => array("administration" => _("FAX Blocklists")),
+          "plCategory"    => array("gofaxlist"      => array("description" => _("Fax blocklists"),
+              "objectClass" => array("goFaxRBlock","goFaxSBlock"))),
+          "plProvidedAcls" => array(
+            "cn"              => _("Name"),
+            "description"     => _("Description"),
+            "base"            => _("Base"),
+            "goFaxBlocklist"  => _("Blocklist"),
+            "type"            => _("Blocklist type"))
+          ));
+  }
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/gofax/blocklists/class_blocklistManagement.inc b/gosa-core/plugins/gofax/blocklists/class_blocklistManagement.inc
new file mode 100644 (file)
index 0000000..f9b19ea
--- /dev/null
@@ -0,0 +1,477 @@
+<?php
+class blocklist extends plugin
+{
+  /* Definitions */
+  var $plHeadline= "FAX Blocklists";
+  var $plDescription= "This does something";
+
+  var $blocklists       = array();
+  var $DivListBlocklist = NULL;
+  var $CopyPasteHandler = NULL;
+
+  var $start_pasting_copied_objects = FALSE;
+  
+  function blocklist (&$config, $ui)
+  {
+    $this->ui     = $ui;
+    $this->dn     = "";
+    $this->config = &$config;
+    $this->base = $_SESSION['CurrentMainBase']; 
+    $this->DivListBlocklist = new divListBlocklist($this->config,$this);
+
+    /* Initialize copy&paste queue */
+    if ($this->config->boolValueIsTrue("main", "enableCopyPaste")){
+      $this->CopyPasteHandler= new CopyPasteHandler($this->config);
+    }
+  }
+
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    $_SESSION['LOCK_VARS_TO_USE'] = array("/^goFaxBlocklist_/","/^act$/","/^id$/","/^remove_multiple_blocklists/","/^item_selected/");
+
+    /***************
+      Init vars 
+     ***************/
+
+    /* Get global smarty instance */
+    $smarty       = get_smarty();
+    $s_action     = "";                       // Contains the action to proceed
+    $s_entry      = "";                       // The value for s_action
+    $base_back    = "";                       // The Link for Backbutton
+
+
+    /***************
+      Fetch posts 
+     ***************/
+
+    /* Test Posts */
+    foreach($_POST as $key => $val){
+      // Post for delete
+      if(preg_match("/^goFaxBlocklist_del.*/",$key)){
+        $s_action = "del";
+        $s_entry  = preg_replace("/^goFaxBlocklist_del_/i","",$key);
+        // Post for edit
+      }elseif(preg_match("/^goFaxBlocklist_edit_.*/",$key)){
+        $s_action="edit";
+        $s_entry  = preg_replace("/^goFaxBlocklist_edit_/i","",$key);
+        // Post for new
+      }elseif(preg_match("/^goFaxBlocklist_new.*/",$key)){
+        $s_action="new";
+      }elseif(preg_match("/^remove_multiple_blocklists/",$key)){
+        $s_action="del_multiple";
+      }elseif(preg_match("/^copy/",$key)){
+        $s_action = "copy";
+        $s_entry= preg_replace("/^copy_/i", "", $key);
+      }elseif(preg_match("/^cut/",$key)){
+        $s_action = "cut";
+        $s_entry= preg_replace("/^cut_/i", "", $key);
+      }
+
+    }
+    if((isset($_GET['act']))&&($_GET['act']=="edit_entry")){
+      $s_action ="edit";
+      $s_entry  = $_GET['id'];
+    }
+
+    $s_entry  = preg_replace("/_.$/","",$s_entry);
+
+
+    /* handle C&P from layers menu */
+    if(isset($_POST['menu_action']) && preg_match("/^multiple_copy_systems/",$_POST['menu_action'])){
+      $s_action = "copy_multiple";
+    }
+    if(isset($_POST['menu_action']) && preg_match("/^multiple_cut_systems/",$_POST['menu_action'])){
+      $s_action = "cut_multiple";
+    }
+    if(isset($_POST['menu_action']) && preg_match("/^editPaste/",$_POST['menu_action'])){
+      $s_action = "editPaste";
+    }
+
+
+    /* Create options */
+    if(isset($_POST['menu_action']) && $_POST['menu_action'] == "goFaxBlocklist_new"){
+      $s_action = "new";
+    }
+
+    /* handle remove from layers menu */
+    if(isset($_POST['menu_action']) && preg_match("/^remove_multiple/",$_POST['menu_action'])){
+      $s_action = "del_multiple";
+    }
+
+
+    /***************
+      Handle copy & paste  
+     ***************/
+
+    $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
+    if($ret){
+      return($ret);
+    }
+
+
+    /***************
+      Cancel some dialogs  
+     ***************/
+
+    /* Cancel dialog */
+    if (isset($_POST['edit_cancel']) || 
+        isset($_POST['delete_blocklist_cancel']) ||
+        isset($_POST['delete_lock'])){
+
+      del_lock ($this->dn);
+      $this->dialog = NULL;
+      unset($_SESSION['objectinfo']);
+    }
+
+
+    /***************
+      Save blocklist 
+     ***************/
+
+    /* What about finish? */
+    if (isset($_POST['edit_finish']) || isset($_POST['edit_apply'])){
+
+      /* No errors, save object */
+      $this->dialog->save_object();
+      $message= $this->check();
+      if (count ($message) == 0){
+
+        $this->dialog->save ();
+
+        if (!isset($_POST['edit_apply'])){
+          del_lock ($this->dn);
+          $this->dn= "";
+          $this->dialog = NULL;
+          unset($_SESSION['objectinfo']);
+        }
+      } else {
+        /* Errors found, show message */
+        show_errors ($message);
+      }
+    }
+
+
+    /***************
+      Create a new blocklist (dialog)
+     ***************/
+
+    /* Create new blocklist? */
+    if ($s_action=="new"){
+      $this->dn= "new";
+      $this->dialog = new faxblocktabs($this->config,$this->config->data['TABS']['FAXBLOCKTABS'],$this->dn);
+      $this->dialog->set_acl_base($this->base);
+    }
+
+
+    /***************
+      Edit blocklist 
+     ***************/
+
+    if ($s_action=="edit" && !is_object($this->dialog)){
+
+      $this->dn=$this->blocklists[$s_entry]['dn'];
+
+      if (($user= get_lock($this->dn)) != ""){
+        return(gen_locked_message($user, $this->dn));
+      }else{
+        add_lock ($this->dn, $this->ui->dn);
+      }
+      $_SESSION['objectinfo']= trim($this->dn);
+      $this->dialog = new faxblocktabs($this->config,$this->config->data['TABS']['FAXBLOCKTABS'],$this->dn);
+      $this->dialog->set_acl_base($this->dn);
+    }    
+
+
+    /***************
+      Display dialog  
+     ***************/
+
+    if(is_object($this->dialog) && ($this->dialog instanceof faxblocktabs)){
+      $this->dialog->save_object();
+      return($this->dialog->execute());
+    }
+
+
+    /********************
+      Delete MULTIPLE entries requested, display confirm dialog
+     ********************/
+
+    if ($s_action=="del_multiple"){
+
+      $this->dns = array();
+      $ids = $this->list_get_selected_items();
+
+      if(count($ids)){
+        foreach($ids as $id){
+          $dn = $this->blocklists[$id]['dn'];
+          if (($user= get_lock($dn)) != ""){
+            return(gen_locked_message ($user, $dn));
+          }
+          $this->dns[$id] = $dn;
+        }
+
+        $dns_names = "<br><pre>";
+        foreach($this->dns as $dn){
+          add_lock ($dn, $this->ui->dn);
+          $dns_names .= $dn."\n";
+        }
+        $dns_names .="</pre>";
+
+        /* Lock the current entry, so nobody will edit it during deletion */
+        $smarty->assign("info",     sprintf(_("You're about to delete the following blocklists(s) %s"), @LDAP::fix($dns_names)));
+        $smarty->assign("multiple", true);
+        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+      }
+    }
+
+
+    /********************
+      Delete MULTIPLE entries confirmed
+     ********************/
+
+    /* Confirmation for deletion has been passed. */
+    if (isset($_POST['delete_multiple_blocklist_confirm'])){
+
+      /* Remove user by user and check acls before removeing them */
+      foreach($this->dns as $key => $dn){
+        if (preg_match("/d/",$this->ui->get_permissions($this->dn,"gofaxlist/blocklistGeneric"))){
+          $this->dn = $dn;
+          $this->dialog = new faxblocktabs($this->config,$this->config->data['TABS']['FAXBLOCKTABS'],$this->dn);
+          $this->dialog->delete();
+          $this->dialog = NULL;
+        } else {
+          print_red (sprintf(_("You are not allowed to delete the blocklist '%s'!"),$dn));
+        }
+        /* Remove lock file after successfull deletion */
+        del_lock ($dn);
+        unset($this->dns[$key]);
+      }
+      $this->reload();
+    }
+
+
+    /********************
+      Delete MULTIPLE entries Canceled
+     ********************/
+
+    /* Remove lock */
+    if(isset($_POST['delete_multiple_blocklist_cancel'])){
+      foreach($this->dns as $key => $dn){
+        del_lock ($dn);
+        unset($this->dns[$key]);
+      }
+    }
+
+
+    /***************
+      Remove blocklist
+     ***************/
+
+    /* Delete blocklist requested */
+    if ($s_action=="del"){
+      $this->dn=$this->blocklists[$s_entry]['dn'];
+
+      /* Check locking */
+      if (($user= get_lock($this->dn)) != ""){
+        $_SESSION['dn']= $this->dn;
+        return(gen_locked_message($user, $this->dn));
+      } else {
+
+        // Lock this dn for editing
+        add_lock ($this->dn, $this->ui->dn);
+        $smarty->assign("info", sprintf(_("You're about to delete the blocklist '%s'."), $this->dn));
+        $smarty->assign("multiple", false);
+        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+      }
+    }
+
+
+    /***************
+      Remove blocklist confirmed
+     ***************/
+
+    /* Finally delete blocklist */
+    if (isset($_POST['delete_blocklist_confirm'])){
+      if (preg_match("/d/",$this->ui->get_permissions($this->dn,"gofaxlist/blocklistGeneric"))){
+        $this->dialog = new faxblocktabs($this->config,$this->config->data['TABS']['FAXBLOCKTABS'],$this->dn);
+        $this->dialog->delete();
+        $this->dialog = NULL;
+        del_lock ($this->dn);
+      } else {
+        print_red (_("You have no permission to remove this blocklist."));
+      }
+    }
+
+    /***************
+      Divlist dialog 
+     ***************/
+
+    /* Check if there is a snapshot dialog open */
+    $base = $this->DivListBlocklist->selectedBase;
+    if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases())){
+      return($str);
+    }
+
+    /* Display dialog with system list */
+    $this->DivListBlocklist->parent = $this;
+    $this->DivListBlocklist->execute();
+
+    /* Add departments if subsearch is disabled */
+    if(!$this->DivListBlocklist->SubSearch){
+      $this->DivListBlocklist->AddDepartments($this->DivListBlocklist->selectedBase,3,1);
+    }
+    $this->reload();
+    $this->DivListBlocklist->setEntries($this->blocklists);
+    return($this->DivListBlocklist->Draw());
+  }
+
+
+  function list_get_selected_items()
+  {
+    $ids = array();
+    foreach($_POST as $name => $value){
+      if(preg_match("/^item_selected_[0-9]*$/",$name)){
+        $id   = preg_replace("/^item_selected_/","",$name);
+        $ids[$id] = $id;
+      }
+    }
+    return($ids);
+  }
+
+
+  /* Return departments, that will be included within snapshot detection */
+  function get_used_snapshot_bases()
+  {
+    return(array("ou=gofax,ou=systems,". $this->DivListBlocklist->selectedBase));
+  }
+
+
+  /* Reload the list of known blocklists */
+  function reload()
+  {
+    /* Init some vars */
+    $filter = $filter2      = "";
+    $base                   = $this->DivListBlocklist->selectedBase;
+    $Regex                  = $this->DivListBlocklist->Regex;
+    $SubSearch              = $this->DivListBlocklist->SubSearch;
+    $ShowSendBocklists      = $this->DivListBlocklist->ShowSendBocklists;
+    $ShowReceiveBlocklists  = $this->DivListBlocklist->ShowReceiveBlocklists;
+    $Flags                  = GL_SIZELIMIT;
+    $res = $res2            = array();
+
+    /* Append subsearch to Flags */
+    if($SubSearch){
+      $Flags |= GL_SUBSEARCH;
+    }else{
+      $base = "ou=gofax,ou=systems,".$base;
+    }  
+
+    /* Create filter */
+    if ($ShowSendBocklists){
+      $filter = "(&(objectClass=goFaxSBlock)(|(cn=".$Regex.")(goFaxSBlocklist=".$Regex.")))";
+      $res= get_list($filter, "gofaxlist", $base,array("*"), $Flags);
+    }
+    if ($ShowReceiveBlocklists){
+      $filter2= "(&(objectClass=goFaxRBlock)(|(cn=".$Regex.")(goFaxRBlocklist=".$Regex.")))";
+      $res2= get_list($filter2, "gofaxlist", $base,array("*"), $Flags);
+    }
+
+    $this->blocklists = array_merge($res,$res2);
+
+    /* appen && sort */
+    $tmp=array();
+    foreach($this->blocklists as $tkey => $val ){
+
+      $acl = $this->ui ->get_permissions($base,"gofaxlist/blocklist");
+      if(preg_match("/r/",$acl)){
+        $tmp[strtolower($val['cn'][0]).$val['cn'][0]]=$val;
+      }
+    }
+    ksort($tmp);
+    $this->blocklists=array();
+    foreach($tmp as $val){
+      $this->blocklists[]=$val;
+    }
+    reset ($this->blocklists);
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    $this->DivListBlocklist->save_object();
+  }
+
+
+
+
+
+  function copyPasteHandling_from_queue($s_action,$s_entry)
+  {
+    /* Check if Copy & Paste is disabled */
+    if(!is_object($this->CopyPasteHandler)){
+      return("");
+    }
+
+    /* Add a single entry to queue */
+    if($s_action == "cut" || $s_action == "copy"){
+      /* Cleanup object queue */
+      $this->CopyPasteHandler->cleanup_queue();
+      $dn = $this->blocklists[$s_entry]['dn'];
+      $this->CopyPasteHandler->add_to_queue($dn,$s_action,"faxblocktabs","FAXBLOCKTABS","gofaxlist");
+    }
+
+    /* Add entries to queue */
+    if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
+
+      /* Cleanup object queue */
+      $this->CopyPasteHandler->cleanup_queue();
+
+      /* Add new entries to CP queue */
+      foreach($this->list_get_selected_items() as $id){
+        $dn = $this->blocklists[$id]['dn'];
+
+        if($s_action == "copy_multiple"){
+          $this->CopyPasteHandler->add_to_queue($dn,"copy","faxblocktabs","FAXBLOCKTABS","gofaxlist");
+        }
+        if($s_action == "cut_multiple"){
+          $this->CopyPasteHandler->add_to_queue($dn,"cut","faxblocktabs","FAXBLOCKTABS","gofaxlist");
+        }
+      }
+    }
+
+    /* Start pasting entries */
+    if($s_action == "editPaste"){
+      $this->start_pasting_copied_objects = TRUE;
+    }
+
+    /* Return C&P dialog */
+    if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
+
+      /* Load entry from queue and set base */
+      $this->CopyPasteHandler->load_entry_from_queue();
+      $this->CopyPasteHandler->SetVar("base",$this->DivListBlocklist->selectedBase);
+
+      /* Get dialog */
+      $data = $this->CopyPasteHandler->execute();
+
+      /* Return dialog data */
+      if(!empty($data)){
+        return($data);
+      }
+    }
+
+    /* Automatically disable status for pasting */
+    if(!$this->CopyPasteHandler->entries_queued()){
+      $this->start_pasting_copied_objects = FALSE;
+    }
+    return("");
+  }
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/gofax/blocklists/class_divListBlocklists.inc b/gosa-core/plugins/gofax/blocklists/class_divListBlocklists.inc
new file mode 100755 (executable)
index 0000000..8b8a505
--- /dev/null
@@ -0,0 +1,291 @@
+<?php
+
+class divListBlocklist extends MultiSelectWindow
+{
+
+  /* Current base */
+  var $selectedBase       = "";
+  var $departments        = array();
+
+  /* Regex */
+  var $Regex              = "*";
+
+  /* checkboxes */
+  var $ShowSendBocklists      ;
+  var $ShowReceiveBlocklists  ;
+
+  /* Subsearch checkbox */
+  var $SubSearch;
+
+  var $parent             ;
+  var $ui                 ;
+
+  function divListBlocklist (&$config, &$parent)
+  {
+    MultiSelectWindow::MultiSelectWindow($config, "Blocklists", "gofaxlist");
+    
+    $this->parent       = $parent;
+    $this->ui           = get_userinfo();
+
+    /* Set list strings */
+    $this->SetTitle(_("List of blocklists"));
+    $this->SetSummary(_("List of blocklists"));
+
+    /* Result page will look like a headpage */
+    $this->SetHeadpageMode();
+    $this->SetInformation(_("This menu allows you to create, delete and edit selected blocklists. Having a large size of lists, you might prefer the range selectors on top of the select box."));
+
+    $this->EnableAplhabet   (true);
+  
+    /* Disable buttonsm */
+    $this->EnableCloseButton(false);
+    $this->EnableSaveButton (false);
+
+    /* Dynamic action col, depending on snapshot icons */
+    $action_col_size = 100;
+    if($this->parent->snapshotEnabled()){
+      $action_col_size += 20;
+    }
+
+    /* Toggle all selected / deselected */
+    $chk = "<input type='checkbox' id='select_all' name='select_all'
+               onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
+
+    /* set Page header */
+    $this->AddHeader(array("string"=> $chk,          "attach"=>"style='width:20px;'"));
+    $this->AddHeader(array("string" => "&nbsp;", "attach" => "style='text-align:center;width:20px;'"));
+    $this->AddHeader(array("string" => _("Blocklist name")." / "._("Department"), "attach" => "style=''"));
+    $this->AddHeader(array("string" => _("Actions"), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'" ));
+
+    /* Add Checkboxes / SubSearch checkbox */
+    $this->AddCheckBox("ShowSendBocklists"     , _("Select to see send blocklists"),    _("Show send blocklists"),true);
+    $this->AddCheckBox("ShowReceiveBlocklists" , _("Select to see receive blocklists"), _("Show receive blocklists"),true);
+  
+    $this->AddCheckBox(SEPERATOR);
+    $this->AddCheckBox("SubSearch",  _("Select to search within subtrees"), _("Search in subtrees"), false);
+
+    /*                  Name                 ,Text                              ,Default  , Connect with alphabet  */
+    $this->AddRegex   ("Regex",     _("Regular expression for matching list names"),"*" , true);
+  }
+
+
+  function GenHeader()
+  {
+    /* Prepare departments,
+       which are shown in the listbox on top of the listbox
+     */
+    $options= "";
+
+    /* Get all departments within this subtree */
+    $base = $this->config->current['BASE'];
+
+    /* Add base */
+    $tmp = array();
+    $tmp[] = array("dn"=>$this->config->current['BASE']);
+    $tmp=  array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
+                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
+
+    $deps = array();
+    foreach($tmp as $tm){
+      $deps[$tm['dn']] = $tm['dn'];
+    }
+
+    /* Load possible departments */
+    $ui= get_userinfo();
+    $tdeps= $ui->get_module_departments("gofaxlist");
+    $ids = $this->config->idepartments;
+    $first = "";
+    $found = FALSE;
+    foreach($ids as $dep => $name){
+      if(isset($deps[$dep]) && in_array_ics($dep, $tdeps)){
+
+        /* Keep first base dn in mind, we could need this
+         *  info if no valid base was found
+         */
+        if(empty($first)) {
+          $first = $dep['dn'];
+        }
+
+        $value = $ids[$dep];
+        if ($this->selectedBase == $dep){
+          $found = TRUE;
+          $options.= "<option selected='selected' value='".$dep."'>$value</option>";
+        } else {
+          $options.= "<option value='".$dep."'>$value</option>";
+        }
+      }
+    }
+
+    /* The currently used base is not visible with your acl setup.
+     * Set base to first useable base.
+     */
+    if(!$found){
+      $this->selectedBase = $first;
+    }
+  
+    /* Get acls */
+    $ui       = get_userinfo();
+    $acl      = $ui->get_permissions($this->selectedBase,"gofaxlist/blocklist");
+    $acl_all  = $ui->has_complete_category_acls($this->selectedBase,"gofaxlist");
+
+    /* Add default header */
+    $listhead = MultiSelectWindow::get_default_header();
+
+    /* Append department selector */
+    $listhead .= "&nbsp;"._("Base")."&nbsp;<select name='CurrentMainBase' 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;";
+
+    /* Create Layers menu */
+    $s  = ".|"._("Actions")."|\n";
+    $s .= "..|<img src='images/list_new.png' alt='' border='0' class='center'>".
+      "&nbsp;"._("Create")."|\n";
+
+    /* Append create options */
+    if(preg_match("/c/",$acl)) {
+      $s.= "...|<input class='center' type='image' src='images/list_new_blocklist.png' alt=''>".
+        "&nbsp;"._("Blocklist")."|goFaxBlocklist_new|\n";
+    }
+
+    /* Multiple options */
+    $s.= "..|---|\n";
+    $s.= "..|<img src='images/edittrash.png' alt='' border='0' class='center'>".
+      "&nbsp;"._("Remove")."|"."remove_multiple|\n";
+
+    /* Add multiple copy & cut icons */
+    if(is_object($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
+      $s.= "..|---|\n";
+      $s.= "..|<img src='images/editcopy.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Copy")."|"."multiple_copy_systems|\n";
+      $s.= "..|<img src='images/editcut.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Cut")."|"."multiple_cut_systems|\n";
+
+      if($this->parent->CopyPasteHandler->entries_queued()){
+        $img = "<img border='0' class='center' src='images/editpaste.png' alt=''>";
+        $s.="..|".$img."&nbsp;"._("Paste")."|editPaste|\n";
+      }else{
+        $img = "<img border='0' class='center' src='images/cant_editpaste.png' alt=''>";
+        $s.="..|".$img."&nbsp;"._("Paste")."\n";
+      }
+    }
+
+    /* Add snapshot icons */
+    if(preg_match("/(c.*w|w.*c)/",$acl_all)){
+      $s .= "..|---|\n";
+      $s .= $this->get_snapshot_header(TRUE);
+    }
+
+    $this->SetDropDownHeaderMenu($s);
+
+    $this->SetListHeader($listhead);
+  }
+
+  function execute()
+  {
+    $this->ClearElementsList();
+    $this->GenHeader();
+  }
+
+  function setEntries($list)
+  {
+    // User and Template  Images
+    $blockimg = "<img class='center' src='images/list_blocklist.png' alt='User' title='%s'>";
+    $editlink = "<a href='?plug=".$_GET['plug']."&amp;id=%s&amp;act=edit_entry'>%s</a>";
+
+    /* Dynamic action col, depending on snapshot icons */
+    $action_col_size = 100;
+    if($this->parent->snapshotEnabled()){
+      $action_col_size += 20;
+    }
+
+    /* Append to list */
+    $ui = get_userinfo();
+    foreach($list as $key => $val){
+
+      $acl = $ui->get_permissions($val['dn'],"gofaxlist/blocklist");
+      if(!preg_match("/r/",$acl)){
+        continue;
+      }  
+
+      /* Edit link ; requires read access */
+      $action= "<input class='center' type='image' src='images/edit.png' alt='"._("edit")."'     name='goFaxBlocklist_edit_%KEY%' title='"._("Edit user")."'>";
+
+      
+      /* Create snapshot ; requires write access && create access */
+      if(preg_match("/w/",$acl) && preg_match("/c/",$acl)){
+        $action.= $this->GetSnapShotActions($val['dn']);
+      }
+     
+      /* Add copy & cut icons */
+      if(preg_match("/(c.*w|w.*c)/",$acl) && $this->parent->CopyPasteHandler){
+        $action .= "<input class='center' type='image'
+          src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
+        $action.= "<input class='center' type='image'
+          src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
+      }
+
+      /* Delete entry ; requires remove access */
+      if(preg_match("/d/",$acl)){
+        $action.= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."' name='goFaxBlocklist_del_%KEY%' title='"._("Delete user")."'>";
+      }
+      
+      // Generate Array to Add
+      if(isset($val["description"][0])){
+        $display= $val["cn"][0]." [".$val["description"][0]."]";
+      }else{
+        $display= $val["cn"][0];
+      }
+
+      /* Cutted objects should be displayed in light grey */
+      if(isset($this->parent->CopyPasteHandler->queue) && is_array($this->parent->CopyPasteHandler->queue)){
+        foreach($this->parent->CopyPasteHandler->queue as $queue_key => $queue_data){
+          if($queue_data['dn'] == $val['dn']) {
+            $display = "<font color='#999999'>".$display."</font>";
+            break;
+          }
+        }
+      }
+
+      
+      /* Create each field */
+      $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
+                      "attach" => "style='width:20px;'");
+      $field1 = array("string" => sprintf($blockimg,$val['dn']), "attach" => "style='text-align:center;width:20px;'");
+      $field2 = array("string" => sprintf($editlink,$key,$display), "attach" => "style='' title='".preg_replace('/ /', '&nbsp;', @LDAP::fix($val['dn']))."'");
+      $field3 = array("string" => preg_replace("/%KEY%/", "$key", $action), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'");
+      $this->AddElement( array($field0,$field1,$field2,$field3));
+    }
+
+    /* Create summary string for list footer */
+    $num_deps=0;
+    if(!$this->SubSearch){
+      $num_deps = count($this->Added_Departments);
+    }
+    $num_objs = count($list);
+
+    $num_obj_str = _("Number of listed blocklists");
+    $num_dep_str = _("Number of listed departments");
+
+    $str = "<img class='center' src='images/list_blocklist.png'
+              title='".$num_obj_str."' alt='".$num_obj_str."'>&nbsp;".$num_objs."&nbsp;&nbsp;&nbsp;&nbsp;";
+    $str.= "<img class='center' src='images/folder.png'
+              title='".$num_dep_str."' alt='".$num_dep_str."'>&nbsp;".$num_deps."&nbsp;&nbsp;&nbsp;&nbsp;";
+
+    $this->set_List_Bottom_Info($str);
+
+  }
+
+  function Save()
+  {
+    MultiSelectWindow :: Save();  
+  }
+
+  function save_object()
+  {
+    /* Save automatic created POSTs like regex, checkboxes */
+    MultiSelectWindow :: save_object();   
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/gofax/blocklists/generic.tpl b/gosa-core/plugins/gofax/blocklists/generic.tpl
new file mode 100644 (file)
index 0000000..df9f84a
--- /dev/null
@@ -0,0 +1,109 @@
+<h2><img class="center" alt="" align="middle" src="images/rightarrow.png"> {t}Generic{/t}</h2>
+<table summary="" style="width:100%; vertical-align:top; text-align:left;">
+
+ <tr>
+   <td style="width:50%; vertical-align:top;">
+    <table summary="">
+     <tr>
+      <td><LABEL for="cn">{t}List name{/t}</LABEL>{$must}</td>
+      <td>
+
+{render acl=$cnACL}
+       <input name="cn" id="cn" size=25 maxlength=60 value="{$cn}" title="{t}Name of blocklist{/t}">
+{/render}
+      </td>
+     </tr>
+     <tr>
+      <td><LABEL for="base">{t}Base{/t}</LABEL>{$must}</td>
+      <td>
+{render acl=$baseACL}
+      <select id="base" size="1" name="base" title="{t}Choose subtree to place group in{/t}">
+       {html_options options=$bases selected=$base}
+      </select>
+{/render}
+
+{render acl=$baseACL disable_picture='images/folder_gray.png'}
+        <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
+{/render}
+      </td>
+     </tr>
+    </table>
+   </td>
+
+  <td style="border-left:1px solid #A0A0A0">
+   &nbsp;
+  </td>
+
+   <td style="vertical-align:top;">
+    <table summary="">
+     <tr>
+       <td><LABEL for="type">{t}Type{/t}</LABEL></td>
+       <td>
+{render acl=$typeACL}
+        <select size="1" id="type" name="type" title="{t}Select wether to filter incoming or outgoing calls{/t}">
+               {html_options options=$types selected=$type}
+               <option disabled>&nbsp;</option>
+        </select>
+{/render}
+        </td>
+      </tr>
+      <tr>
+       <td><LABEL for="description">{t}Description{/t}</LABEL></td>
+       <td>
+{render acl=$descriptionACL}
+         <input name="description" id="description" size=25 maxlength=80 value="{$description}" title="{t}Descriptive text for this blocklist{/t}">
+{/render}
+       </td>
+      </tr>
+    </table>
+   </td>
+ </tr>
+</table>
+
+<p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
+
+<table summary="" style="width:100%">
+ <tr>
+   <td style="width:50%;">
+     <h2><img class="center" alt="" align="middle" src="images/false.png"> {t}Blocked numbers{/t}</h2>
+{render acl=$goFaxBlocklistACL}
+     <select style="width:100%; height:200px;" name="numbers[]" size=15 multiple>
+      {html_options values=$goFaxBlocklist output=$goFaxBlocklist}
+         <option disabled>&nbsp;</option>
+     </select>
+{/render}
+     <br>
+{render acl=$goFaxBlocklistACL}
+     <input id="number" name="number" size=25 maxlength=60 >&nbsp;
+{/render}
+{render acl=$goFaxBlocklistACL}
+     <input type=submit value="{t}Add{/t}" name="add_number">&nbsp;
+{/render}
+{render acl=$goFaxBlocklistACL}
+     <input type=submit value="{t}Delete{/t}" name="delete_number">
+{/render}
+   </td>
+  <td style="border-left:1px solid #A0A0A0">
+   &nbsp;
+  </td>
+   <td style="vertical-align:top;" >
+     <h2><img class="center" alt="" align="middle" src="images/info_small.png"> {t}Information{/t}</h2>
+     <p>
+      {t}Numbers can also contain wild cards.{/t}
+     </p>
+   </td>
+ </tr>
+</table>
+
+<p class="plugbottom">
+  <input type=submit name="edit_finish" style="width:80px" value="{t}Ok{/t}">
+  <input type=submit name="edit_apply" value="{t}Apply{/t}">
+  <input type=submit name="edit_cancel" value="{t}Cancel{/t}">
+</p>
+<input type='hidden' name='blocklist_posted' value="1">
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('n');
+  -->
+</script>
diff --git a/gosa-core/plugins/gofax/blocklists/main.inc b/gosa-core/plugins/gofax/blocklists/main.inc
new file mode 100644 (file)
index 0000000..71c0b81
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+if ($remove_lock){
+        if(isset($_SESSION['blocklist'])){
+                $blocklist= $_SESSION['blocklist'];
+                del_lock ($ui->dn);
+                sess_del ('blocklist');
+        }
+} else {
+       /* Create blocklist object on demand */
+       if (!isset($_SESSION['blocklist']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+               $_SESSION['blocklist']= new blocklist($config, $ui);
+               $_SESSION['blocklist']->set_acl_category("gofaxlist");
+       }
+       $blocklist= $_SESSION['blocklist'];
+       $blocklist->save_object();
+       $output= $blocklist->execute();
+
+       /* Reset requested? */
+       if (isset($_GET['reset']) && $_GET['reset'] == 1){
+               del_lock ($ui->dn);
+               sess_del ('blocklist');
+       }
+
+       /* Page header*/
+       if (isset($_SESSION['objectinfo'])){
+               $display= print_header(get_template_path('images/blocklists.png'), _("Blocklist management"), "<img alt=\"\"align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".@LDAP::fix($_SESSION['objectinfo']));
+       } else {
+               $display= print_header(get_template_path('images/blocklists.png'), _("Blocklist management"));
+       }
+       $display.= $output;
+
+       $_SESSION['blocklist']= $blocklist;
+}
+?>
diff --git a/gosa-core/plugins/gofax/blocklists/paste_generic.tpl b/gosa-core/plugins/gofax/blocklists/paste_generic.tpl
new file mode 100644 (file)
index 0000000..ac4cef9
--- /dev/null
@@ -0,0 +1,8 @@
+<table summary="">
+ <tr>
+  <td><LABEL for="cn">{t}List name{/t}</LABEL></td>
+  <td>
+   <input name="cn" id="cn" size=25 maxlength=60 value="{$cn}" title="{t}Name of blocklist{/t}">
+  </td>
+ </tr>
+</table>
diff --git a/gosa-core/plugins/gofax/blocklists/remove.tpl b/gosa-core/plugins/gofax/blocklists/remove.tpl
new file mode 100644 (file)
index 0000000..ebea1e3
--- /dev/null
@@ -0,0 +1,24 @@
+<div style="font-size:18px;">
+ <img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
+</div>
+<p>
+ {$info}
+ {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}So - if you're sure - press 'Delete' to continue or 'Cancel' to abort.{/t}
+</p>
+
+<p class="plugbottom">
+       {if $multiple}
+               <input type=submit name="delete_multiple_blocklist_confirm" value="{t}Delete{/t}">
+               &nbsp;
+               <input type=submit name="delete_multiple_blocklist_cancel" value="{t}Cancel{/t}">
+       {else}
+               <input type=submit name="delete_blocklist_confirm" value="{t}Delete{/t}">
+               &nbsp;
+               <input type=submit name="delete_blocklist_cancel" value="{t}Cancel{/t}">
+       {/if}
+</p>
+
diff --git a/gosa-core/plugins/gofax/blocklists/tabs_blocklist.inc b/gosa-core/plugins/gofax/blocklists/tabs_blocklist.inc
new file mode 100644 (file)
index 0000000..9293903
--- /dev/null
@@ -0,0 +1,38 @@
+<?php
+
+class faxblocktabs extends tabs
+{
+  function faxblocktabs($config, $data, $dn)
+  {
+    tabs::tabs($config, $data, $dn, 'gofaxlist');
+
+    /* Add references/acls/snapshots */
+    $this->addSpecialTabs();
+  }
+
+  function save($ignore_account= FALSE)
+  {
+    $baseobject= $this->by_object['blocklistGeneric'];
+
+    /* Check for new 'dn', in order to propagate the 'dn' to all plugins */
+    $new_dn= "cn=".$baseobject->cn.",ou=gofax,ou=systems,".$baseobject->base;
+
+    /* Move group? */
+    if ($this->dn != $new_dn){
+
+      /* Write entry on new 'dn' */
+      if ($this->dn != "new"){
+        $baseobject->move($this->dn, $new_dn);
+        $this->by_object['blocklistGeneric']= $baseobject;
+      }
+
+      /* Happen to use the new one */
+      $this->dn= $new_dn;
+    }
+
+    tabs::save();
+  }
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/gofax/faxaccount/class_gofaxAccount.inc b/gosa-core/plugins/gofax/faxaccount/class_gofaxAccount.inc
new file mode 100644 (file)
index 0000000..eca2228
--- /dev/null
@@ -0,0 +1,857 @@
+<?php
+
+class gofaxAccount extends plugin
+{
+  /* Definitions */
+  var $plHeadline= "FAX";
+  var $plDescription= "This does something";
+
+  /* CLI vars */
+  var $cli_summary= "Manage users fax account";
+  var $cli_description= "Some longer text\nfor help";
+  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+
+  /* Department list shown in the divSelectList*/
+  var $departments;
+
+  /* Fax attributes */
+  var $goFaxDeliveryMode= "";
+  var $facsimileTelephoneNumber= "";
+  var $goFaxIsEnabled= 1;
+  var $goFaxPrinter= "";
+  var $goFaxDivertNumber= "";
+  var $goFaxLanguage= "";
+  var $goFaxFormat= "";
+  var $goFaxRBlocklist = array();
+  var $goFaxRBlockgroups= array();
+  var $goFaxSBlocklist= array();
+  var $goFaxSBlockgroups= array();
+  var $mail= "";
+  var $facsimileAlternateTelephoneNumber= array();
+  var $fax_formats = array("pdf","ps","png","mtiff","tiff");  
+
+  /* Internal variables */
+  var $printerList= array();
+  var $has_mailAccount= FALSE;
+  var $locals_dialog= FALSE;
+  var $in_blocklist_dialog= FALSE;
+  var $out_blocklist_dialog= FALSE;
+  var $current_blocklist= array();
+  var $view_logged = FALSE;
+
+  /* Copy & paste variables */
+  var $CopyPasteVars=array("facsimileTelephoneNumber");//,"goFaxRBlocklist","goFaxRBlockgroups","goFaxSBlocklist","goFaxSBlockgroups");
+
+  /* attribute list for save action */
+  var $attributes= array("goFaxDeliveryMode", "goFaxIsEnabled","facsimileAlternateTelephoneNumber","goFaxRBlocklist","goFaxRBlockgroups","goFaxSBlocklist","goFaxSBlockgroups","goFaxPrinter", "goFaxDivertNumber", "goFaxLanguage", "goFaxFormat", "mail","facsimileTelephoneNumber");
+
+  var $uid ="";
+
+  var $objectclasses= array("goFaxAccount");
+
+  function gofaxAccount (&$config, $dn= NULL)
+  {
+    /* General initialization */
+    plugin::plugin ($config, $dn);
+
+    /* Set uid, it is used in handle_post_events */
+    if(isset($this->attrs['uid'])){
+      $this->uid = $this->attrs['uid'][0];
+    }
+
+    /* Hickert : 11.11.05
+     * Added to be able to handle department selection in divSelelect
+     */
+    if(!isset($_SESSION["Fax_Filter"])){
+      $_SESSION['Fax_Filter']['depselect'] = $this->config->current['BASE'];
+    }
+
+    if ($dn != "new"){
+      /* Get arrays */
+      foreach (array("goFaxRBlocklist", "goFaxRBlockgroups", "goFaxSBlocklist",
+            "goFaxSBlockgroups", "facsimileAlternateTelephoneNumber") as $val){
+        $this->$val =array();
+        if (isset($this->attrs["$val"]["count"])){
+          for ($i= 0; $i<$this->attrs["$val"]["count"]; $i++){
+            array_push($this->$val, $this->attrs["$val"][$i]);
+          }
+        }
+      }
+
+      /* Set up has_mailAccount */
+      if (in_array("gosaMailAccount", $this->attrs['objectClass'])){
+        $this->has_mailAccount= TRUE;
+      }
+    }
+
+    /* Load printer list */
+    if (isset($this->config->data['SERVERS']['CUPS'])){
+      $this->printerList= get_printer_list ($this->config->data['SERVERS']['CUPS']);
+      asort ($this->printerList);
+    }
+
+    /* Check if the currently selected printer is still available. 
+       If not, append current printer to list of available.
+       It could be possible, that we are not allowed to view printers and so the list is empty ...  */
+    if(!empty($this->goFaxPrinter) && !isset($this->printerList[$this->goFaxPrinter])) {
+      $this->printerList[$this->goFaxPrinter] = "[".$this->goFaxPrinter."]";
+    }
+
+    /* Get global filter config */
+    if (!is_global("faxfilter")){
+      $ui= get_userinfo();
+      $base= get_base_from_people($ui->dn);
+      $faxfilter= array( "depselect"       => $base,
+          "fuser"            => "*",
+          "regex"           => "");
+      register_global("faxfilter", $faxfilter);
+    }
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* Log view */
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","users/".get_class($this),$this->dn);
+    }
+
+    /* Hickert : 11.11.05
+     * Added to be able to handle department selection in divSelelect
+     */
+    if((isset($_GET['act']))&&($_GET['act']=="dep_open")){
+
+      if(strlen(base64_decode($_GET['dep_id']))>= strlen($this->config->current['BASE'])){
+        $_SESSION['Fax_Filter']['depselect']= base64_decode($_GET['dep_id']);
+      }else{
+        $_SESSION['Fax_Filter']['depselect']= $this->config->current['BASE'];
+      }
+    }
+
+    /* Edit mode specifies if we are editing from my accout */
+    $edit_mode = (!is_object($this->parent) && !isset($_SESSION['edit']));
+
+    /* Load smarty stuff */
+    $smarty= get_smarty();
+
+    /* Check if mail account is active. We'll display an additional
+       mail address field if this is not the case. Some people may
+       want goFax, but have a mailserver which is not managed with
+       GOsa */
+    if (!@isset($this->parent->by_object['mailAccount'])) {
+      $smarty->assign("has_mailaccount", $this->has_mailAccount?"true":"false");
+    } elseif ( !$this->parent->by_object['mailAccount']->is_account){
+      $smarty->assign("has_mailaccount", "false");
+      $this->has_mailAccount= false;
+    } else {
+      $smarty->assign("has_mailaccount", "true");
+    }
+
+    /* Do we need to flip is_account state? */
+    if (isset($_POST['modify_state'])){
+      $this->is_account= !$this->is_account;
+    }
+
+    /* Do we represent a valid account? */
+    if (!$this->is_account && $this->parent === NULL){
+      $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\">&nbsp;<b>".
+        _("This account has no fax extensions.")."</b>";
+      $display.= back_to_main();
+      return ($display);
+    }
+
+    /* Show tab dialog headers */
+    $display= "";
+    if ($this->parent !== NULL){
+      if ($this->is_account){
+        $display= $this->show_disable_header(_("Remove fax account"),
+            _("This account has fax features enabled. You can disable them by clicking below."));
+      } else {
+        $display= $this->show_enable_header(_("Create fax account"),
+            _("This account has fax features disabled. You can enable them by clicking below."));
+        return ($display);
+      }
+    }
+
+    /* Trigger Add local fax alternatives dialog */
+    if (isset($_POST['add_local_alternate'])){
+      if($this->acl_is_writeable("facsimileAlternateTelephoneNumber",$edit_mode)){
+        $this->locals_dialog= TRUE;    
+        $this->dialog= TRUE;   
+      }
+    }
+
+    /* Add alternatives from dialog */
+    if (isset($_POST['add_locals_finish']) && isset($_POST['local_list'])){
+      if($this->acl_is_writeable("facsimileAlternateTelephoneNumber",$edit_mode)){
+        foreach ($_POST['local_list'] as $val){
+          $this->addAlternate($val);
+          $this->is_modified= TRUE;
+        }
+      }
+    }
+
+    /* Add alternatives */
+    if (isset($_POST['add_alternate']) && !empty($_POST['forward_address']) && is_phone_nr($_POST['forward_address'])){ 
+      if($this->acl_is_writeable("facsimileAlternateTelephoneNumber",$edit_mode)){
+        $this->addAlternate($_POST['forward_address']);
+      }
+    }
+
+    /* Delete alternate fax number */
+    if (isset($_POST['delete_alternate']) && isset($_POST['alternate_list']) && count($_POST['alternate_list'])){ 
+      if($this->acl_is_writeable("facsimileAlternateTelephoneNumber",$edit_mode)){
+        $this->delAlternate ($_POST['alternate_list']);
+      }
+    }
+
+
+    /* Edit incoming blocklists */
+    if (isset($_POST['edit_incoming'])){
+      if($this->acl_is_writeable("goFaxRBlocklist",$edit_mode))  {
+        $this->current_blocklist= array_merge($this->goFaxRBlocklist,$this->goFaxRBlockgroups);
+        sort($this->current_blocklist);
+        reset($this->current_blocklist);
+
+        $this->in_blocklist_dialog= TRUE;
+        $this->dialog= TRUE;
+      }
+    }
+
+    /* Edit outgoing blocklists */
+    if (isset($_POST['edit_outgoing'])){
+      $this->current_blocklist= array_merge($this->goFaxSBlocklist,$this->goFaxSBlockgroups);
+      sort($this->current_blocklist);
+      reset($this->current_blocklist);
+
+      $this->out_blocklist_dialog= TRUE;
+      $this->dialog= TRUE;
+    }
+
+    /* Add number to blocklist (dialog) */
+    if (isset($_POST['add_blocklist_number']) && $_POST['block_number'] != ""){
+      if (!is_phone_nr($_POST['block_number'])){
+        print_red (_("You're trying to add an invalid phone number."));
+      } else {
+        array_push($this->current_blocklist, $_POST['block_number']);
+        $this->current_blocklist= array_unique($this->current_blocklist);
+        sort($this->current_blocklist);
+        reset($this->current_blocklist);
+      }
+    }
+
+    /* Hickert : 11.11.05
+     * Add selection from divSelelect to our Blocklist 
+     */
+    /* Add list to blocklist */
+    if (isset($_POST['add_blocklist'])){
+      foreach($_POST as $name => $value){
+        if(preg_match("/ADDLIST_/i",$name)){
+          $this->current_blocklist= array_merge($this->current_blocklist, array(base64_decode($value)));
+
+        }
+      } 
+      $this->current_blocklist= array_unique($this->current_blocklist);
+      sort($this->current_blocklist);
+      reset($this->current_blocklist);
+    }
+
+    /* Add list to blocklist */
+    if (isset($_GET['add'])){
+      if(!is_array($this->current_blocklist)) $this->current_blocklist=array();
+      $this->current_blocklist= array_merge($this->current_blocklist, array( base64_decode($_GET['add'])));
+      $this->current_blocklist= array_unique($this->current_blocklist);
+      sort($this->current_blocklist);
+      reset($this->current_blocklist);
+    }
+
+    /* Delete from blocklist */
+    if (isset($_POST['delete_blocklist_number']) && isset($_POST['block_list'])){
+      $tmp= array();
+      foreach($this->current_blocklist as $val){
+        if (!in_array($val, $_POST['block_list'])){
+          $tmp[]= $val;
+        }
+      }
+      $this->current_blocklist= $tmp;
+    }
+
+
+    /* Blocklist edit finished */
+    if (isset($_POST['edit_blocklists_finish'])){
+
+      /* Incoming or outgoing? */
+      if ($this->in_blocklist_dialog){
+        $this->goFaxRBlocklist = array();
+        $this->goFaxRBlockgroups = array();
+
+        foreach ($this->current_blocklist as $val){
+          if (is_phone_nr($val)){
+            $this->goFaxRBlocklist[]=$val;
+          } else {
+            $this->goFaxRBlockgroups[]= $val;
+          }
+        }
+      } else {
+        $this->goFaxSBlocklist = array();
+        $this->goFaxSBlockgroups = array();
+
+        /* Transfer values to ourself */
+        foreach ($this->current_blocklist as $val){
+          if (is_phone_nr($val)){
+            $this->goFaxSBlocklist[]=$val;
+          } else {
+            $this->goFaxSBlockgroups[]= $val;
+          }
+        }
+      }
+      $this->is_modified= TRUE;
+    }
+
+
+    /* Set departments */
+    if ($this->locals_dialog || $this->in_blocklist_dialog || $this->out_blocklist_dialog){
+      
+      $list= array ();
+      $ldap= $this->config->get_ldap_link();
+      if (isset ($_POST['department'])){
+        $ldap->cd ($_POST['department']);
+      } else {
+        $ldap->cd ($this->config->current['BASE']);
+      }
+    }
+
+    /* Cancel  dialogs */
+    if (isset($_POST['add_locals_cancel']) || isset($_POST['edit_blocklists_finish']) ||
+        isset($_POST['edit_blocklists_cancel']) || isset($_POST['add_locals_finish'])){
+
+      $this->locals_dialog= FALSE;
+      $this->in_blocklist_dialog= FALSE;
+      $this->out_blocklist_dialog= FALSE;
+      $this->dialog= FALSE;
+    }
+
+    /* Manage locals dialog */
+    if ($this->locals_dialog){
+
+      /* Save data */
+      $faxfilter= get_global("faxfilter");
+      foreach( array("depselect", "fuser", "regex") as $type){
+        if (isset($_POST[$type])){
+          $faxfilter[$type]= $_POST[$type];
+        }
+      }
+      if (isset($_GET['search'])){
+        $s= mb_substr($_GET['search'], 0, 1, "UTF8")."*";
+        if ($s == "**"){
+          $s= "*";
+        }
+        $faxfilter['fuser']= $s;
+      }
+
+      if ($faxfilter['regex'] != '*' && $faxfilter['regex'] != ""){
+        $regex= $faxfilter['regex'];
+        $filter= "(facimileTelephoneNumber=$regex)";
+      } else {
+        $filter= "";
+      }
+      if ($faxfilter['fuser'] != ""){
+        $user= $faxfilter['fuser'];
+        $filter= "$filter(|(uid=$user)(cn=$user)(givenName=$user)(sn=$user))";
+      }
+
+      $base= $faxfilter['depselect'];
+      $res= get_list("(&(objectClass=goFaxAccount)$filter)", "gofax", $base, 
+                     array("sn", "givenName", "facsimileTelephoneNumber"), GL_SIZELIMIT | GL_SUBSEARCH);
+
+      foreach ($res as $attrs){
+        $list[$attrs['facsimileTelephoneNumber'][0]]=
+          $attrs['sn'][0].", ".
+          $attrs['givenName'][0]." [".
+          $attrs['facsimileTelephoneNumber'][0]."]";
+      }
+
+      /* Show dialog */
+      $smarty->assign("search_image", get_template_path('images/search.png'));
+      $smarty->assign("usearch_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.png'));
+      $smarty->assign("launchimage", get_template_path('images/small_filter.png'));
+      $smarty->assign("departments", $this->config->idepartments);
+      $smarty->assign("list", $list);
+      if (isset($_POST['depselect'])){
+        $smarty->assign("depselect", $_POST['depselect']);
+      }
+      $smarty->assign("deplist", $this->config->idepartments);
+      $smarty->assign("apply", apply_filter());
+      $smarty->assign("alphabet", generate_alphabet());
+      $smarty->assign("hint", print_sizelimit_warning());
+      foreach( array("depselect", "fuser", "regex") as $type){
+        $smarty->assign("$type", $faxfilter[$type]);
+      }
+      $smarty->assign("hint", print_sizelimit_warning());
+
+      $display.= $smarty->fetch (get_template_path('locals.tpl', TRUE, dirname(__FILE__)));
+      return ($display);
+    }
+
+
+    /* Manage incoming blocklists */
+    if ($this->in_blocklist_dialog){
+
+      /* This handles the divSelectBox */
+
+      /* The base specifies the current position in the ldap tree 
+       * The current base was specified by $_GET['dep_id'] before. Or contains the default value.
+       */
+      $base = $_SESSION['Fax_Filter']['depselect'];
+      $ldap->cd($base);
+
+      /* Ge all Blocklists */
+      $ldap->search ("(objectClass=goFaxRBlock)",array("cn","description"));
+      while ($attrs= $ldap->fetch()){
+
+        /* Generate list depending on description */
+        if(isset($attrs['description'][0])){
+          $list[$attrs['cn'][0]]=
+            $attrs['description'][0].
+            " [".$attrs['cn'][0]."]";
+        }else{
+          $list[$attrs['cn'][0]]= $attrs['cn'][0];
+        }
+      }
+
+      /* Create our divselect box */
+      $divSel = new divSelectBox("divSelectPredefined");
+      $divSel->setHeight(296);
+
+      /* NEW LIST MANAGMENT
+       * We also need to search for the departments
+       * So we are able to navigate like in konquerer
+       */
+      $this->departments= array();
+   
+      /* Get all departments within the current department */ 
+      $base = $_SESSION['Fax_Filter']['depselect'];
+      $ldap->ls("(objectClass=gosaDepartment)",$base);
+
+      /* Base back is used to go one department up in our ldap tree */
+      $base_back = preg_replace("/^[^,]+,/","",$base);
+
+      /* Only show base_back if it is needed */
+      if((strlen($base_back)>= strlen($this->config->current['BASE']))&&($base!=$this->config->current['BASE'])){
+        $this->departments[preg_replace("/^[^,]+,/","",$base)] = ".. - ["._("back")."]"; 
+      }
+
+      /* Fetch all returned departments an add them to our divlist */
+      while($value = $ldap->fetch()){
+        if($value["description"][0]!=".."){
+          $this->departments[$value['dn']]=@LDAP::fix(convert_department_dn($value['dn'])." - [".$value["description"][0]."]");
+        }else{
+          $this->departments[$value['dn']]=$value["description"][0];
+        }
+      }
+      /* END NEW LIST MANAGMENT
+       */
+
+      // This links specifies the department open link 
+      $linkopen = "<a href='?plug=".$_GET['plug']."&amp;act=dep_open&amp;dep_id=%s'>%s</a>";
+
+      /* Insert departments in divsel */
+      foreach($this->departments as $key=> $val){
+        if(!isset($this->config->departments[trim($key)])){
+          $this->config->departments[trim($key)]="";
+        }
+        $field1 = array("string" => "<img src='images/folder.png' alt='department'>","attach"=>"style='width:16px;text-align:center;'");
+        $field2 = array("string" => sprintf($linkopen,base64_encode($key),$val),"attach"=>" style='border:none'");
+        $divSel->AddEntry(array($field1,$field2));
+      }
+
+      /* Append predefined Blocklists */
+      foreach($list as $entry => $value){
+        $divSel->AddEntry(array(
+              array("string"=>"<input type='checkbox' value='".base64_encode($entry)."' name='ADDLIST_".base64_encode($entry)."'>"),
+              array("string"=>$value,"attach"=>"style='border:0px;'")
+              ));
+      }
+
+      /* Show dialog */
+      $smarty->assign("cblocklist", $this->current_blocklist);
+      $smarty->assign("departments", $this->config->idepartments);
+      $smarty->assign("divSelectPredefined", $divSel->DrawList());
+      $display.= $smarty->fetch (get_template_path('lists.tpl', TRUE, dirname(__FILE__)));
+      return ($display);
+    }
+
+    /* Manage outgoing blocklists */
+
+    if ($this->out_blocklist_dialog){
+
+      /* This handles the divSelectBox */
+
+      /* The base specifies the current position in the ldap tree
+       * The current base was specified by $_GET['dep_id'] before. Or contains the default value.
+       */
+      $base = $_SESSION['Fax_Filter']['depselect'];
+      $ldap->cd($base);
+
+      /* Ge all Blocklists */ 
+      $ldap->search ("(objectClass=goFaxSBlock)",array("cn","description"));
+      while ($attrs= $ldap->fetch()){
+        if(isset($attrs['description'][0])){
+          $list[$attrs['cn'][0]]=
+            $attrs['description'][0].
+            " [".$attrs['cn'][0]."]";
+        }else{
+          $list[$attrs['cn'][0]]= $attrs['cn'][0];
+        }
+      }
+
+      /*Create DivSel*/
+      $divSel = new divSelectBox("divSelectPredefined");
+      $divSel->setHeight(296);
+
+      /* NEW LIST MANAGMENT
+       * We also need to search for the departments
+       * So we are able to navigate like in konquerer
+       */
+      $this->departments= array();
+      $ldap->ls("(objectClass=gosaDepartment)",$base);
+
+      /* Generate Back url, and append if it is needed */
+      $base_back = preg_replace("/^[^,]+,/","",$base);
+      if((strlen($base_back)>= strlen($this->config->current['BASE']))&&($base!=$this->config->current['BASE'])){
+        $this->departments[preg_replace("/^[^,]+,/","",$base)] = ".. - ["._("back")."]";
+      }
+
+      /* Get all departments */
+      while($value = $ldap->fetch()){
+        if(isset($value["description"][0])){
+          $this->departments[$value['dn']]=@LDAP::fix(convert_department_dn($value['dn'])." - [".$value["description"][0]."]");
+        }else{
+          $this->departments[$value['dn']]=$value["description"][0];
+        }
+      }
+      /* END NEW LIST MANAGMENT
+       */
+
+      // Defining Links
+      $linkopen = "<a href='?plug=".$_GET['plug']."&amp;act=dep_open&amp;dep_id=%s'>%s</a>";
+
+      /* Insert departments in divlist*/
+      foreach($this->departments as $key=> $val){
+        if(!isset($this->config->departments[trim($key)])){
+          $this->config->departments[trim($key)]="";
+        }
+
+        $field1 = array("string" => "<img src='images/folder.png' alt='department'>","attach"=>"style='width:16px;text-align:center;'");
+        $field2 = array("string" => sprintf($linkopen,base64_encode($key),$val),"attach"=>" style='border:none'");
+        $divSel->AddEntry(array($field1,$field2));
+      }
+
+      /* Append Blocklits */
+      foreach($list as $entry => $value){
+        $divSel->AddEntry(array(
+              array("string"=>"<input type='checkbox' value='".base64_encode($entry)."' name='ADDLIST_".base64_encode($entry)."'>"),
+              array("string"=>$value,"attach"=>"style='border:0px;'")
+              ));
+      }
+
+      /* Show dialog */
+      $smarty->assign("cblocklist", $this->current_blocklist);
+      $smarty->assign("departments", $this->config->idepartments);
+      $smarty->assign("divSelectPredefined", $divSel->DrawList());
+      $display.= $smarty->fetch (get_template_path('lists.tpl', TRUE, dirname(__FILE__)));
+      return ($display);
+    }
+
+
+    /* Show main page */
+    $smarty->assign("languages", get_languages(TRUE));
+
+    $smarty->assign("formats",  $this->fax_formats);
+    $smarty->assign("printers", $this->printerList);
+
+    /* Load attributes */
+    foreach(array("goFaxIsEnabled", "goFaxDeliveryMode", "facsimileTelephoneNumber",
+          "goFaxPrinter", "goFaxLanguage", "goFaxFormat", 
+          "facsimileAlternateTelephoneNumber", "mail") as $val){
+
+      $smarty->assign("$val", $this->$val);
+    }
+
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $acl => $desc){
+      $smarty->assign($acl."ACL",$this->getacl($acl,$edit_mode));
+    }
+
+    /* Load checkboxes */
+    if ($this->goFaxIsEnabled == "1"){
+      $smarty->assign("goFaxIsEnabled", "");
+    } else {
+      $smarty->assign("goFaxIsEnabled", "checked");
+    }
+    /* goFaxAccount has "mail" as must! Block if no mailaddress is specified... */
+    if ($this->goFaxDeliveryMode & 32) {
+      $smarty->assign("faxtomail", "checked");
+    } else {
+      $smarty->assign("faxtomail", "");
+    }
+    if ($this->goFaxDeliveryMode & 64) {
+      $smarty->assign("faxtoprinter", "checked");
+    } else {
+      $smarty->assign("faxtoprinter", "");
+    }
+
+
+    $display.= $smarty->fetch (get_template_path('generic.tpl', TRUE, dirname(__FILE__)));
+    return ($display);
+  }
+
+  function remove_from_parent()
+  {
+    /* Cancel if there's nothing to do here */
+    if (!$this->initially_was_account){
+      return;
+    }
+
+    plugin::remove_from_parent();
+
+    /* Adapt mail settings if needed */
+    if ((isset($this->parent->by_object['mailAccount']->is_account)) && ($this->parent->by_object['mailAccount']->is_account)){
+      unset($this->attrs['mail']);
+    }
+
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd($this->dn);
+    $this->cleanup();
+    $ldap->modify ($this->attrs); 
+
+    new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+
+    show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/fax account with dn '%s' failed."),$this->dn));
+
+    /* Optionally execute a command after we're done */
+    $this->handle_post_events('remove',array("uid"=> $this->uid));
+  }
+
+
+  /* Check formular input */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    /* must: facsimileTelephoneNumber */
+    if ($this->facsimileTelephoneNumber == ""){
+      $message[]= _("The required field 'Fax' is not set.");
+    }
+
+    if (!is_phone_nr($this->facsimileTelephoneNumber)){
+      $message[]= _("Please enter a valid telephone number in the 'Fax' field.");
+    }
+
+    /* IF mail is specified (which is only the case if there's no mail account
+       present), check if it's valid..  */
+    if (@isset($this->parent->by_object['mailAccount']) &&
+        $this->goFaxDeliveryMode & 32){
+      if ($this->mail == ""){
+        $message[]= _("Mail delivery is checked, but no address has been specified.");
+      } elseif (!is_email($this->mail)){
+        $message[]= _("The mail address you've entered is invalid.");
+      }
+    }
+
+    // IE Fix, IE lets you choose disabled option, stupid browser ... 
+    if((empty($this->goFaxPrinter))&&($this->goFaxDeliveryMode & 64)){
+      $message[]= _("Deliver fax to printer, is only possible if valid printer is given. Please correct your choice.");
+    }
+
+    return ($message);
+  }
+
+  /* Save data to object */
+  function save_object()
+  {
+    $edit_mode = (!is_object($this->parent) && !isset($_SESSION['edit']));
+    if (isset($_POST['faxTab'])){
+      plugin::save_object();
+
+
+      $tmp = 0+$this->goFaxDeliveryMode;
+
+      if($this->acl_is_writeable("faxtomail",$edit_mode)){
+        if (isset($_POST["faxtomail"]) && $_POST["faxtomail"] == 1){  
+          $tmp |= 32;
+        }elseif($tmp & 32){
+          $tmp &= (!32);
+        }
+      }
+      if($this->acl_is_writeable("faxtoprinter",$edit_mode)){
+        if (isset($_POST["faxtoprinter"]) && $_POST["faxtoprinter"] == 1){  
+          $tmp |= 64;
+        }elseif($tmp & 64){
+          $tmp &= !64;
+        }
+      }
+      $this->goFaxDeliveryMode = $tmp;
+
+      if($this->acl_is_writeable("goFaxIsEnabled",$edit_mode)){
+        if (isset($_POST["goFaxIsEnabled"]) && $_POST["goFaxIsEnabled"] == "1"){
+          $this->goFaxIsEnabled= "0";
+        } else {
+          $this->goFaxIsEnabled= "1";
+        }
+      }
+
+    
+      if (isset($_POST['mail']) && $this->acl_is_writeable("faxtomail",$edit_mode)){
+        $this->mail= $_POST['mail'];
+      }
+
+      /* Check if mail account is active and correct the internal
+         reference to represent the current status. */
+      if(isset($this->parent)){
+        if (isset($this->parent->by_object['mailAccount']->is_account)&&($this->parent->by_object['mailAccount']->is_account)){
+          $this->has_mailAccount= TRUE;
+        }
+      }
+    }
+
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    plugin::save();
+
+    /* Save arrays */
+    foreach (array("goFaxRBlocklist", "goFaxRBlockgroups", "goFaxSBlocklist",
+          "goFaxSBlockgroups", "facsimileAlternateTelephoneNumber") as $val){
+
+      $this->attrs[$val]= $this->$val;
+    }
+
+    if(!$this->attrs['goFaxDeliveryMode']){
+      $this->attrs['goFaxDeliveryMode'] = 0;
+    }
+  
+    /* Do not save mail address ... it was possibly changed by mail plugin */
+    /* Adapt mail settings if needed */
+    if ((isset($this->parent->by_object['mailAccount']->is_account)) && ($this->parent->by_object['mailAccount']->is_account)){
+      unset($this->attrs['mail']);
+    }
+
+    /* Write back to ldap */
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd($this->dn);
+    $this->cleanup();
+    $ldap->modify ($this->attrs); 
+
+    /* Log last action */
+    if($this->initially_was_account){
+      new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
+
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/fax account 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("mofidy",array("uid" => $this->uid));
+      }
+    } else {
+      $this->handle_post_events("add",array("uid" => $this->uid));
+    }
+
+  }
+
+
+  /* Adapt from template, using 'dn' */
+  function adapt_from_template($dn)
+  {
+    plugin::adapt_from_template($dn);
+
+    foreach (array("goFaxRBlocklist", "goFaxRBlockgroups", "goFaxSBlocklist",
+          "goFaxSBlockgroups", "facsimileAlternateTelephoneNumber") as $val){
+
+      if (isset($this->attrs[$val])){
+        $this->$val= $this->attrs[$val];
+      }
+    }
+  }
+
+
+
+  /* Add alternate fax recipient */
+  function addAlternate($number)
+  {
+    $this->facsimileAlternateTelephoneNumber[]= "$number";
+    $this->facsimileAlternateTelephoneNumber=
+      array_unique ($this->facsimileAlternateTelephoneNumber);
+
+    sort ($this->facsimileAlternateTelephoneNumber);
+    reset ($this->facsimileAlternateTelephoneNumber);
+  }
+
+  function delAlternate($numbers)
+  {
+    $this->facsimileAlternateTelephoneNumber= array_remove_entries ($numbers,
+        $this->facsimileAlternateTelephoneNumber);
+  }
+
+  function getCopyDialog()
+  {
+    $str    = "";
+    $smarty = get_smarty();
+    $smarty->assign("facsimileTelephoneNumber", $this->facsimileTelephoneNumber);
+    $str['string']   = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE,dirname(__FILE__)));
+    $str['status'] ="";
+    return($str);
+  }
+
+  function SaveCopyDialog()
+  {
+    if(isset($_POST['facsimileTelephoneNumber'])){
+      $this->facsimileTelephoneNumber = $_POST['facsimileTelephoneNumber'];
+    }
+  }
+
+
+  /* Return plugin informations for acl handling 
+      #FIXME some attributes are still missing in this plugin acls */
+  static function plInfo()
+  {
+    return (array(  
+          "plShortName"     => _("Fax"),
+          "plDescription"   => _("Fax account settings"),
+          "plSelfModify"    => TRUE,
+          "plDepends"       => array("user"),
+          "plPriority"      => 6,             
+          "plSection"       => "personal",  
+          "plCategory"      => array("users"),
+          "plOptions"       => array(),
+
+          "plProvidedAcls"  => array(
+            "goFaxIsEnabled"                    => _("Enable/Disable fax"),
+            "goFaxRBlocklist"                   => _("Receive blocklist"),
+            "goFaxSBlocklist"                   => _("Send blocklist"),
+            "facsimileTelephoneNumber"          => _("Fax number"), // goFaxDeliveryMode
+            "facsimileAlternateTelephoneNumber" => _("Alternate fax number"), // goFaxDeliveryMode
+            "faxtomail"                         => _("Deliver fax as mail"),
+            "faxtoprinter"                      => _("Deliver fax to printer"),
+            "goFaxFormat"                       => _("Delivery format"),
+            "goFaxLanguage"                     => _("Language"))
+          ));
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/gofax/faxaccount/generic.tpl b/gosa-core/plugins/gofax/faxaccount/generic.tpl
new file mode 100644 (file)
index 0000000..cb56a6c
--- /dev/null
@@ -0,0 +1,145 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding="0" border="0">
+
+ <!-- Headline container -->
+ <tr>
+   <td style="width:50%; vertical-align:top;">
+     <h2><img class="center" alt="" align="middle" src="images/rightarrow.png" />&nbsp;{t}Generic{/t}</h2>
+
+     <table summary="">
+       <tr>
+         <td><label for="facsimileTelephoneNumber">{t}Fax{/t}</label>{$must}</td>
+         <td>
+
+{render acl=$facsimileTelephoneNumberACL}
+           <input name="facsimileTelephoneNumber" id="facsimileTelephoneNumber" size=20 maxlength=65
+               value="{$facsimileTelephoneNumber}" title="{t}Fax number for GOfax to trigger on{/t}">
+{/render}
+
+         </td>
+       </tr>
+       <tr>
+         <td><label for="goFaxLanguage">{t}Language{/t}</label></td>
+        <td>
+
+{render acl=$goFaxLanguageACL}
+           <select size="1" name="goFaxLanguage" id="goFaxLanguage" 
+               title="{t}Specify the GOfax communication language for fax to mail gateway{/t}">
+                       {html_options options=$languages selected=$goFaxLanguage}
+           </select>
+{/render}
+
+         </td>
+       </tr>
+       <tr>
+         <td><label for="goFaxFormat">{t}Delivery format{/t}</label></td>
+         <td>
+
+{render acl=$goFaxFormatACL}
+           <select id="goFaxFormat" size="1" name="goFaxFormat" title="{t}Specify delivery format for fax to mail gateway{/t}">
+           {html_options values=$formats output=$formats selected=$goFaxFormat}
+           </select>
+{/render}
+         </td>
+       </tr>
+     </table>
+     
+   </td>
+   <td style="border-left:1px solid #A0A0A0">
+    &nbsp;
+   </td>
+   <td style="vertical-align:top; width:100%">
+     <h2><img class="center" alt="" align="middle" src="images/printer.png" />&nbsp;{t}Delivery methods{/t}</h2>
+
+{render acl=$goFaxIsEnabledACL}
+     <input type=checkbox name="goFaxIsEnabled" value="1" {$goFaxIsEnabled}>
+{/render}
+     {t}Temporary disable fax usage{/t}<br>
+
+     {if $has_mailaccount eq "false"}
+{render acl=$faxtomailACL}
+     <input type=checkbox name="faxtomail" value="1" {$faxtomail}>
+{/render}
+      <label for="mail">{t}Deliver fax as mail to{/t}</label>&nbsp;
+{render acl=$faxtomailACL}
+      <input name="mail" id="mail" size=25 maxlength=65 value="{$mail}">
+{/render}
+     {else}
+{render acl=$faxtomailACL}
+     <input type=checkbox name="faxtomail" value="1" {$faxtomail}>
+{/render}
+      {t}Deliver fax as mail{/t}
+     {/if}
+     <br>
+
+{render acl=$faxtoprinterACL}
+     <input type=checkbox name="faxtoprinter" value="1" {$faxtoprinter}>
+{/render}
+     {t}Deliver fax to printer{/t}&nbsp;
+{render acl=$faxtoprinterACL}
+     <select size="1" name="goFaxPrinter">
+      {html_options options=$printers selected=$goFaxPrinter}
+               <option disabled>&nbsp;</option>
+     </select>
+{/render}
+   </td>
+ </tr>
+</table>
+
+<p class="seperator">&nbsp;</p>
+
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4 border=0>
+  <tr>
+    <td style="width:50%; border-right:1px solid #A0A0A0">
+    <h2><img class="center" alt="" align="middle" src="images/fax_small.png">&nbsp;{t}Alternate fax numbers{/t}</h2>
+{render acl=$facsimileAlternateTelephoneNumberACL}
+    <select style="width:100%" name="alternate_list[]" size="10" multiple>
+                       {html_options values=$facsimileAlternateTelephoneNumber output=$facsimileAlternateTelephoneNumber}
+                       <option disabled>&nbsp;</option>
+    </select>
+{/render}
+    <br>
+{render acl=$facsimileAlternateTelephoneNumberACL}
+    <input name="forward_address" size=20 align="middle" maxlength=65 value="">
+{/render}
+{render acl=$facsimileAlternateTelephoneNumberACL}
+    <input type=submit value="{t}Add{/t}" name="add_alternate">&nbsp;
+{/render}
+{render acl=$facsimileAlternateTelephoneNumberACL}
+    <input type=submit value="{t}Add local{/t}" name="add_local_alternate" >&nbsp;
+{/render}
+{render acl=$facsimileAlternateTelephoneNumberACL}
+    <input type=submit value="{t}Delete{/t}" name="delete_alternate">
+{/render}
+   </td>
+   <td style="vertical-align:top; width:50%">
+      <h2><img class="center" alt="" align="middle" src="images/false.png" />&nbsp;{t}Blocklists{/t}</h2>
+      <table summary="" style="width:100%">
+        <tr>
+          <td>{t}Blocklists for incoming fax{/t}</td>
+          <td>
+{render acl=$goFaxRBlocklistACL}
+            <input type=submit name="edit_incoming" value="{t}Edit{/t}">
+{/render}
+          </td>
+        </tr>
+        <tr>
+          <td>{t}Blocklists for outgoing fax{/t}</td>
+          <td>
+{render acl=$goFaxSBlocklistACL}
+            <input type=submit name="edit_outgoing" value="{t}Edit{/t}">
+{/render}
+          </td>
+        </tr>
+      </table>
+    </td>
+  </tr>
+</table>
+
+<input type="hidden" name="faxTab" value="faxTab">
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('facsimileTelephoneNumber');
+  -->
+</script>
diff --git a/gosa-core/plugins/gofax/faxaccount/lists.tpl b/gosa-core/plugins/gofax/faxaccount/lists.tpl
new file mode 100644 (file)
index 0000000..5817e6c
--- /dev/null
@@ -0,0 +1,35 @@
+
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4 border=0>
+ <tr>
+  <td style="vertical-align:top;width:50%;border-right:1px solid #A0A0A0"> 
+   <b>{t}Blocked numbers/lists{/t}</b>
+   <br> 
+   <select style="width:100%; height:300px;" name="block_list[]" size=15 multiple>
+           {html_options values=$cblocklist output=$cblocklist}
+               <option disabled>&nbsp;</option>
+   </select>
+   <br>
+   <input name="block_number" size=25 align="middle" maxlength=30 value="">
+   <input type=submit value="{t}Add{/t}" name="add_blocklist_number" >&nbsp;
+   <input type=submit value="{t}Delete{/t}" name="delete_blocklist_number" >
+  </td>
+  <td>
+       <b>{t}List of predefined blocklists{/t}</b><br>
+       <table style="width:100%;height:300px;" summary="">
+               <tr>
+                       <td valign="top">
+                                       {$divSelectPredefined}
+                       </td>
+               </tr>
+       </table>
+   <input type=submit value="{t}Add the list to the blocklists{/t}" name="add_blocklist"><br>
+  </td>
+ </tr>
+</table>
+
+<p class="plugbottom">
+  <input type=submit name="edit_blocklists_finish" value="{t}Apply{/t}">
+  &nbsp;
+  <input type=submit name="edit_blocklists_cancel" value="{t}Cancel{/t}">
+</p>
+
diff --git a/gosa-core/plugins/gofax/faxaccount/locals.tpl b/gosa-core/plugins/gofax/faxaccount/locals.tpl
new file mode 100644 (file)
index 0000000..ebf9a89
--- /dev/null
@@ -0,0 +1,64 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
+<tr>
+  <td style="vertical-align:top; width:600px">
+   <div class="contentboxh" style="height:20px;">
+    <p class="contentboxh" style="font-size:12px">
+     <b>{t}Select numbers to add{/t} {$hint}</b><br>
+    </p>
+   </div>
+   <div class="contentboxb">
+    <p class="contentboxb" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+     <select style="width:100%; margin-top:4px; height:450px;" name="local_list[]" size="15" multiple>
+       {html_options options=$list}
+     </select>
+    </p>
+   </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"  style="background-color:#F8F8F8">
+     <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>
+                               <img class="center" alt="" src="{$tree_image}" align="middle" title="{t}Display numbers of department{/t}">&nbsp;
+                               <select name="depselect" size="1" onChange="mainform.submit()" title="{t}Choose the department the search will be based on{/t}">
+                             {html_options options=$deplist selected=$depselect}
+                           </select>
+                       </td>
+               </tr>
+       </table>
+    <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+               <tr>
+                       <td width="18">
+                               <img class="center" alt="" src="{$search_image}" align="middle" title="{t}Display numbers matching{/t}">
+                       </td>
+               <td>
+                               <input type='text' name='regex' maxlength='20' value='{$regex}' style="width:99%" title='{t}Regular expression for matching numbers{/t}' onChange="mainform.submit()">  </td>
+               </tr>
+       </table>
+    <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+               <tr>
+                       <td width="18">
+                               <img class="center" alt="" src="{$usearch_image}" align="middle" title="{t}Display numbers of user{/t}">
+                       </td>
+                   <td>
+                               <input type='text' name='fuser' style="width:99%" maxlength='20' value='{$fuser}' title='{t}User name of which numbers are shown{/t}' onChange="mainform.submit()">     </td>
+               </tr>
+       </table>
+   {$apply}
+   </div>
+  </td>
+</tr>
+</table>
+
+<p class="plugbottom">
+  <input type=submit name="add_locals_finish" value="{t}Add{/t}">
+  &nbsp;
+  <input type=submit name="add_locals_cancel" value="{t}Cancel{/t}">
+</p>
+
diff --git a/gosa-core/plugins/gofax/faxaccount/main.inc b/gosa-core/plugins/gofax/faxaccount/main.inc
new file mode 100644 (file)
index 0000000..d2786d8
--- /dev/null
@@ -0,0 +1,112 @@
+<?php
+
+$display  ="";
+$lock_msg = "";
+
+if (!$remove_lock){
+
+       /* Reset requested? */
+       if (isset($_POST['edit_cancel']) ||
+               (isset($_GET['reset']) && $_GET['reset'] == 1)){
+
+               del_lock ($ui->dn);
+               sess_del ('edit');
+               sess_del ('gofaxAccount');
+       }
+
+       /* Create gofaxAccount object on demand */
+       if (!isset($_SESSION['gofaxAccount']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+               $_SESSION['gofaxAccount']= new gofaxAccount ($config, $ui->dn);
+               $_SESSION['gofaxAccount']->set_acl_base($ui->dn);
+               $_SESSION['gofaxAccount']->set_acl_category("users");
+
+       }
+       $gofaxAccount= $_SESSION['gofaxAccount'];
+
+       /* save changes back to object */
+       if (isset ($_SESSION['edit'])){
+               $gofaxAccount->save_object ();
+       }
+
+       /* Enter edit mode? */
+       if (isset($_POST['edit'])){
+
+               /* Check locking */
+               if (($username= get_lock($ui->dn)) != ""){
+                       $_SESSION['back_plugin']= $plug;
+                       $_SESSION['LOCK_VARS_TO_USE'] = array("/^edit$/","/^plug$/");
+                       $lock_msg =  gen_locked_message ($username, $ui->dn);
+
+               }else{
+
+                       /* Lock the current entry */
+                       add_lock ($ui->dn, $ui->dn);
+                       $_SESSION['dn']= $ui->dn;
+                       $_SESSION['edit']= TRUE;
+               }
+       }
+
+       /* save changes to LDAP and disable edit mode */
+       if (isset($_POST['edit_finish'])){
+
+                /* Perform checks */
+                $message= $gofaxAccount->check ();
+
+                /* No errors, save object */
+                if (count ($message) == 0){
+                        $gofaxAccount->save ();
+                        del_lock ($ui->dn);
+                        sess_del ('edit');
+
+                } else {
+                        /* Errors found, show message */
+                        show_errors ($message);
+                }
+        }
+
+       /* Execute formular */
+       if($lock_msg){
+               $display.= $lock_msg;
+       }else{
+               $display.= $gofaxAccount->execute ();
+       }
+
+       $info= "";
+
+       /* Store changes  in session */
+       if (isset ($_SESSION['edit'])){
+               $_SESSION['gofaxAccount']= $gofaxAccount;
+       }
+
+       /* Show page footer depending on the mode */
+       if (!$gofaxAccount->locals_dialog &&
+               !$gofaxAccount->out_blocklist_dialog &&
+               !$gofaxAccount->in_blocklist_dialog &&
+               $gofaxAccount->is_account       && 
+               empty($lock_msg)){
+
+               $display.= "<p class=\"plugbottom\">\n";
+
+               /* Are we in edit mode? */
+               if (isset($_SESSION['edit'])){
+                       $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
+                       $display.= "&nbsp;\n";
+                       $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+                       $info= "<img alt='' align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".$ui->dn."&nbsp;";
+               } else {
+                       $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/openlock.png')."\"> ".$ui->dn."&nbsp;";
+
+                       if(preg_match("/w/",$ui->get_permissions($ui->dn,"users/gofaxAccount"))){
+                               $info.= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/lamp.png')."\">"._("Click the 'Edit' button below to change informations in this dialog");
+                               $display.= "<input type=submit name=\"edit\" value=\""._("Edit")."\">";
+                       }
+                       $display.= "<input type=\"hidden\" name=\"ignore\">\n";
+               }
+               $display.= "</p>";
+       }
+       
+       /* Page header*/
+       $display= print_header(get_template_path('images/fax.png'), _("FAX settings"), $info).$display;
+
+}
+?>
diff --git a/gosa-core/plugins/gofax/faxaccount/paste_generic.tpl b/gosa-core/plugins/gofax/faxaccount/paste_generic.tpl
new file mode 100644 (file)
index 0000000..6efca1d
--- /dev/null
@@ -0,0 +1,31 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding="0" border="0">
+       <tr>
+               <td style="width:50%; vertical-align:top;">
+               <h2><img class="center" alt="" align="middle" src="images/rightarrow.png" />&nbsp;{t}Generic{/t}</h2>
+               <table summary="">
+                               <tr>
+                               <td>
+                                       <label for="facsimileTelephoneNumber">{t}Fax{/t}</label>{$must}
+                               </td>
+                               <td>
+                                       <input name="facsimileTelephoneNumber" id="facsimileTelephoneNumber" 
+                                                       size=40 maxlength=65 value="{$facsimileTelephoneNumber}" 
+                                                       title="{t}Fax number for GOfax to trigger on{/t}">
+                               </td>
+                               </tr>
+                        <tr>
+                                <td colspan=2>
+                                      {t}Alternate fax numbers will not be copied{/t}
+                                </td>
+                        </tr>
+
+                       </table>
+               </td>
+       </tr>
+</table>
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('facsimileTelephoneNumber');
+  -->
+</script>
diff --git a/gosa-core/plugins/gofax/faxreports/class_faxreport.inc b/gosa-core/plugins/gofax/faxreports/class_faxreport.inc
new file mode 100644 (file)
index 0000000..41e0fc4
--- /dev/null
@@ -0,0 +1,507 @@
+<?php
+
+class faxreport extends plugin
+{
+  /* Definitions */
+  var $plHeadline     = "FAX Reports";
+  var $plDescription  = "This does something";
+
+  /* For internal use */
+  var $start          = 0;
+  var $search_for     = "*";
+  var $search_base    = "";
+  var $year           = "";
+  var $month          = "";
+  var $sort           = 1;
+  var $sort_direction = "down";
+  var $report_list    = array();
+  var $ui             = NULL;
+  var $range          = 20;
+  var $view_logged = FALSE;
+
+  /* Constant stuff */
+  var $status= array( "SENT", "MAILED", "SERROR", "RERROR", "SBLOCK", "RBLOCK",
+      "DELETED", "REQUEUED", "DISABLED", "PRINTED", "DIVERTED",
+      "UNDEFINED", "UNDEFINED", "UNDEFINED", "UNDEFINED",
+      "UNDEFINED");
+  var $fields= array("uid", "queuing_time", "status", "sender_id", "receiver_id", "pages");
+
+  /* these vars will be stored in session to be able to remember last search config */
+  var $attributes_SO= array("search_for","search_base","month","year","start","year","month","sort","sort_direction","range");
+  var $objectclasses= array();
+  var $fax_users    = array();
+
+
+  /* Create class */
+  function faxreport (&$config, &$ui)
+  {
+    /* Include config object */
+    $this->config       = $config;
+    $this->ui           = &$ui;
+    $this->search_base  = get_base_from_people($ui->dn);
+    $this->year         = date("Y");
+    $this->month        = date("m");
+
+    /* Get global filter config and set class vars , 
+       or create a filter */
+    if (!is_global("faxreportfilter")){
+      $faxreportfilter = array();
+      foreach($this->attributes_SO as $name){
+        $faxreportfilter[$name] = $this->$name;
+      } 
+      register_global("faxreportfilter",$faxreportfilter);
+    }else{
+      $faxreportfilter = get_global("faxreportfilter");
+      foreach($this->attributes_SO as $name){
+        $this->$name = $faxreportfilter[$name];
+      }
+    }
+  }
+
+  
+  /* Create Filter & Search & Display results */
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* Log view */
+    if(!$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","users/".get_class($this),$this->dn);
+    }
+
+    /************ 
+      Variable initialisation 
+     ************/
+    /* Create months */ 
+    $months= array();
+    for($i = 1 ; $i <= 12 ; $i ++ ){
+      $months[$i] = _(date("F",gmmktime(0,0,0,$i,1)));
+    }
+
+    /* Create years */
+    $current= date("Y");
+    $years= array();
+    for ($y= $current - 5; $y<=$current; $y++){
+      $years[]= $y;
+    }
+
+    
+    /************ 
+      Set smarty defaults  
+     ************/
+
+    $smarty= get_smarty();
+    $smarty->assign("launchimage"              , get_template_path('images/launch.png'));
+    $smarty->assign("search_image"  , get_template_path('images/search.png'));
+    $smarty->assign("search_for"               , $this->search_for);
+    $smarty->assign("bases"                              , $this->config->idepartments);
+    $smarty->assign("base_select"              , $this->search_base);
+    $smarty->assign("months"                     , $months);
+    $smarty->assign("month_select"     , $this->month);
+    $smarty->assign("years"                              , $years);
+    $smarty->assign("year_select"              , $this->year);
+    $smarty->assign("search_result"    , "");
+
+    
+    /************ 
+      Check database accessibility 
+     ************/
+
+    /* Some checks */
+    if(!isset($this->config->data['SERVERS']['FAX'])){
+      print_red(_("No fax extension defined in your server configuration, no reports can be shown!"));
+      return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
+    }elseif(!is_callable("mysql_connect")){
+      print_red(_("There is no mysql extension available, please check your php setup."));
+      return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
+    }else{
+      /* Connecting, selecting database */
+      $cfg     = $this->config->data['SERVERS']['FAX'];
+      $link    = @mysql_pconnect($cfg['SERVER'], $cfg['LOGIN'], $cfg['PASSWORD']);
+      if ($link === FALSE){
+        print_red(_("Can't connect to fax database, no reports can be shown!"));
+        return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
+      }
+      if (! @mysql_select_db("gofax")){
+        print_red(_("Can't select fax database for report generation!"));
+        return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
+      }
+
+      if (! mysql_query("SELECT * FROM faxlog;")){
+        print_red(_("Can't query fax table 'faxlog' for report generation!"));
+        return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
+      }
+    }          
+
+    
+    /************ 
+      Perform a deatil view 
+     ************/
+
+    /* Do detail view? */
+    if (isset($_GET['detail'])){
+
+      /* Create query */
+      $query = "SELECT id,uid,date_format(queuing_time, '%Y%m%d%H%i%s') as queuing_time,status,sender_id,sender_msn,receiver_id,".
+        "receiver_msn,pages,status_message,transfer_time FROM faxlog WHERE id=".$_GET['detail'].";";
+
+      /* Connecting, selecting database */
+      $cfg= $this->config->data['SERVERS']['FAX'];
+
+      /* Check if everything went ok*/
+      $result = @mysql_query($query);
+      if ($result === false){
+        print_red(_("Query for fax database failed!"));
+        @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query, "Database query failed");
+        return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
+      }
+
+      $line = mysql_fetch_array($result, MYSQL_ASSOC);
+      mysql_close($link);
+
+      if (!preg_match ("/'".$line["uid"]."'/", $this->userfilter)){
+        print_red (_("You have no permission to retrieve informations about this fax id!"));
+        return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
+      }
+
+      /* Check acls */
+      $fax_uids = array_flip($this->fax_users);
+      $uid = $line['uid'];
+      $dn = $fax_uids[$uid];
+      $acls = $this->ui->get_permissions($dn,"faxreport/faxreport");
+      if(!preg_match("/r/",$acls)){
+        print_red (_("You have no permission to retrieve informations about this fax id!"));
+        return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
+      }
+
+      $parts= array( "id", "uid", "queuing_time", "status", "sender_id", "sender_msn",
+          "receiver_id", "receiver_msn", "pages", "status_message", "transfer_time" );
+
+      foreach ($parts as $vname) {
+
+        $final="fax_$vname";
+        if($vname != "uid"){
+          $v_acl = $this->ui->get_permissions($dn,"faxreport/faxreport",preg_replace("/_/","",$vname));
+        }else{
+          $v_acl = "r";
+        }
+
+        if ($line[$vname] != "" && preg_match("/r/",$v_acl)){
+          $smarty->assign("$final", $line[$vname]);
+        } else {
+          $smarty->assign("$final", "-");
+        }
+      }
+      $queuing_time= $line['queuing_time'];
+
+      /* The user is allowed to download all fax images from those users 
+          that are listed in $_SESSION['fuserfilter'] 
+         Don't forget to check getfax.php if you change somthing here */
+      $_SESSION['fuserfilter']= $this->userfilter;
+      $smarty->assign("plug", "?plug=".validate($_GET['plug']));
+      $smarty->assign("detail", validate($_GET['detail']));
+
+      $format= _("Y-M-D");
+      $date= preg_replace("/Y/", substr($queuing_time,0,4), $format);
+      $date= preg_replace("/M/", substr($queuing_time,4,2), $date);
+      $date= preg_replace("/D/", substr($queuing_time,6,2), $date);
+      $smarty->assign("date", $date);
+      $smarty->assign("time", substr($queuing_time,8,2).":".
+          substr($queuing_time,10,2).":".
+          substr($queuing_time,12,2));
+      return($smarty->fetch(get_template_path('detail.tpl', TRUE)));
+    }
+
+    
+    /************ 
+      Search for uids matching the filter  
+     ************/
+
+    /* Search button has been pressed */
+    if ($this->search_for != ""){
+
+      if (is_integer (strpos($this->search_for, "*"))){
+        $s= $this->search_for;
+      } else {
+        $s= "*".$this->search_for."*";
+      }
+      $ldap= $this->config->get_ldap_link();
+      $ldap->cd ($this->search_base);
+
+      /* Perform ldap search for potential users */
+      $filter= "(&(objectClass=gosaAccount)(!(objectClass=gosaUserTemplate))".
+          "(objectClass=goFaxAccount)".
+          "(|(uid=$s)(l=$s)(homePhone=$s)".
+          "(telephoneNumber=$s)(facsimileTelephoneNumber=$s)(mobile=$s)".
+          "(pager=$s)(cn=$s)(givenName=$s)(sn=$s)(personalTitle=$s)".
+          "(title=$s)))";
+  
+      $res = get_list($filter, "users", $this->search_base, array("uid"), GL_SUBSEARCH );
+
+      /* Check if we are allowed to collect fax data */
+      $fax_users= array();
+      foreach($res as $attrs){
+        $acl = $this->ui->get_permissions($attrs['dn'],"users/user","uid");
+        if(preg_match("/r/",$acl)){
+          $fax_users[ $attrs['dn']]= $attrs["uid"][0];
+        }
+      }
+
+      $this->fax_users = $fax_users;
+
+      /* Prepare SQL query */
+      $this->userfilter= "";
+      foreach ($fax_users as $user){
+        $this->userfilter.= "uid = '$user' OR ";
+      }
+      $this->userfilter= preg_replace("/OR $/", "", $this->userfilter);
+    }
+
+    /************ 
+      Create filter  
+     ************/
+
+    /* Perform SQL query */
+    if ($this->userfilter){
+      if ($this->sort_direction == "down"){
+        $desc= "DESC";
+      } else {
+        $desc= "";
+      }
+      $start= date ("YmdHis", mktime(0,0,0,$this->month,1,$this->year));
+      $end=   date ("YmdHis", mktime(23,59,59,$this->month+1,0,$this->year));
+      $query = "SELECT id,uid,date_format(queuing_time, '%Y%m%d%H%i%s') as queuing_time,status,sender_id,receiver_id,pages FROM faxlog ".
+        "WHERE ( ".$this->userfilter." ) AND queuing_time <= $end AND ".
+        "queuing_time >= $start ORDER BY ".$this->fields[$this->sort]." $desc;";
+
+      if(!is_callable("mysql_connect")){
+        print_red("There is no mysql extension configured in your php setup.");
+        return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
+      }
+
+    
+    /************ 
+      Create results  
+     ************/
+
+      /* Connecting, selecting database */
+      $cfg= $this->config->data['SERVERS']['FAX'];
+      $link = @mysql_pconnect($cfg['SERVER'], $cfg['LOGIN'], $cfg['PASSWORD']);
+      
+      @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query, "Database query");
+      $result = @mysql_query($query);
+      if ($result === false){
+        print_red(_("Query for fax database failed!"));
+        return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
+      }
+
+      $this->report_list= array();
+      $user_ids = array_flip($fax_users);
+      while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
+
+        /* Check permissions for each field */
+        $dn = $user_ids[$line['uid']];
+
+        /* Hide restricted attributes */ 
+        foreach(array("pages","receiverid","senderid","status","queuingtime","detailedView") as $attr){
+          $var = $attr."ACL";
+          $$var = $this->ui->get_permissions($dn,"faxreport/faxreport",$attr);
+        }
+
+        /* Restricted attributes will not be displayed, this will be displayed instead */
+        $no_acl = "<img class='center' src='images/closedlock.png' 
+                    title='"._("Insufficient permissions to view this attribute")."' alt='"._("Insufficient permissions")."'>";
+
+        /* Create date */ 
+        if((!empty($line["queuing_time"])) && preg_match("/r/",$queuingtimeACL)){
+          $hour=  substr($line["queuing_time"], 8, 2);
+          $minute=substr($line["queuing_time"], 10, 2);
+          $format= _("Y-M-D");
+          $date= preg_replace("/Y/", substr($line["queuing_time"], 0, 4), $format);
+          $date= preg_replace("/M/", substr($line["queuing_time"], 4, 2), $date);
+          $date= preg_replace("/D/", substr($line["queuing_time"], 6, 2), $date);
+          $str_date = $date." ".$hour.":".$minute;
+        }else{
+          $str_date = $no_acl;
+        }
+  
+        /* Create entry html str */
+
+        if(preg_match("/r/",$detailedViewACL)){
+          $str = "<td class=\"phonelist\">
+            <a href=\"main.php?plug=".validate($_GET['plug'])."&amp;detail=".$line["id"]."\">
+            <img class='center' alt=\"\" align=\"middle\" border=0 src=\"".get_template_path('images/info_small.png')."\">
+            &nbsp;".$line["uid"].
+            "</a>
+            </td>
+            <td>$str_date</td>";
+        }else{
+          $str = "<td>
+            <img class='center' alt=\"\" align=\"middle\" border=0 src=\"".get_template_path('images/info_small.png')."\">
+            &nbsp;".$line["uid"]."</td>
+            <td>$str_date</td>";
+        }
+        
+        /* Add Status td */
+        if(preg_match("/r/",$statusACL)){
+          $str.="<td>".$this->status[$line["status"]]."</td>";
+        }else{
+          $str.="<td>".$no_acl."</td>";
+        }
+
+        /* Add sender_id td */
+        if(preg_match("/r/",$senderidACL)){
+          $str.="<td>".$line["sender_id"]."</td>";
+        }else{
+          $str.="<td>".$no_acl."</td>";
+        }
+
+        /* Add receiver_id td */
+        if(preg_match("/r/",$receiveridACL)){
+          $str.="<td>".$line["receiver_id"]."</td>";
+        }else{
+          $str.="<td>".$no_acl."</td>";
+        }
+
+        /* Add receiver_id td */
+        if(preg_match("/r/",$pagesACL)){
+          $str.="<td>".$line["pages"]."</td>";
+        }else{
+          $str.="<td>".$no_acl."</td>";
+        }
+      $this->report_list[] =  $str;
+      }
+
+      mysql_close($link);
+    }
+
+    /************ 
+      Create output out of results  
+     ************/
+
+    /* Generate output */
+    $mod= 0;
+    $output= "";
+    foreach ($this->report_list as $val){
+      if ($mod < $this->start) {
+        $mod++;
+        continue;
+      }
+      if ($mod >= ($this->start + $this->range)){
+        $mod++;
+        break;
+      }
+      if ( ($mod++) & 1){
+        $col= "background-color: #ECECEC;";
+      } else {
+        $col= "background-color: #F5F5F5;";
+      }
+      $output.= "<tr style=\"height:22px; $col\">$val</tr>";
+    }
+
+    
+    /************ 
+      Display results  
+     ************/
+
+    if (isset($fax_users) && count($fax_users)){
+      $smarty->assign("search_result", $output);
+      $smarty->assign("range_selector", range_selector(count($this->report_list), $this->start, $this->range,"EntriesPerPage"));
+    }else{
+      $smarty->assign("search_result", "");
+    }
+
+    /* Show main page */
+    $smarty->assign("plug", "?plug=".validate($_GET['plug']));
+    for($i= 0; $i<7; $i++){
+      $smarty->assign("mode$i", "");
+    }
+    $smarty->assign("mode".$this->sort, "<img alt=\"\" src=\"images/sort_".$this->sort_direction.
+        ".png\" border=0 align=middle>");
+    return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
+  }
+
+
+  /* Save ui input, and store it in $_SESSION 
+     to remember last search next time*/
+  function save_object()
+  {
+    $faxreportfilter = get_global("faxreportfilter");
+    if(isset($_POST['EntriesPerPage'])){
+      $this->range = $_POST['EntriesPerPage'];
+    }
+
+    if (isset($_GET['start'])){
+      $this->start= (int)$_GET['start'];
+    }
+
+    /* Adapt sorting */
+    if (isset($_GET['sort'])){
+      if ($this->sort == (int)$_GET['sort']){
+        if ($this->sort_direction == "down"){
+          $this->sort_direction= "up";
+        } else {
+          $this->sort_direction= "down";
+        }
+      }
+      $this->sort= (int)$_GET['sort'];
+      if ($this->sort < 0 || $this->sort > 5){
+        $this->sort= 0;
+      }
+    }
+    foreach( array("year", "month", "search_for", "search_base") as $type){
+      if (isset($_POST[$type])){
+        $faxreportfilter[$type]= $_POST[$type];
+
+        /* reset start page, if filter has changed */ 
+        if(!isset($_GET['start'])){
+          $this->start = 0;
+        }
+      }
+      $this->$type= $faxreportfilter[$type];
+   
+    }
+    foreach($this->attributes_SO as $name){
+      $faxreportfilter[$name] = $this->$name;
+    }  
+    register_global("faxreportfilter",$faxreportfilter);
+  }
+
+
+  /* Return plugin informations for acl handling
+    #FIXME You can only read attributes within this report plugin */
+  static function plInfo()
+  {
+  
+    return (array(
+          "plShortName"     => _("Fax report"),
+          "plDescription"   => _("Fax report")."&nbsp;<i>"._("All entries are readonly")."</i>",
+          "plSelfModify"    => TRUE,
+          "plDepends"       => array(),
+          "plPriority"      => 1,                                 // Position in tabs
+          "plSection"       => array("administration"),                     // This belongs to personal
+          "plCategory"      => array("faxreport" => array("description" => _("Fax reports"),
+                                                         "objectClass" => array())),
+          "plOptions"       => array(),
+
+          "plProvidedAcls" => array(
+            "detailedView"   => _("Detailed view"),
+            "id"             => _("Fax ID"),
+            "queuingtime"    => _("Date")."&nbsp;/&nbsp;"._("Time"),
+            "status"         => _("Status"),
+            "senderid"       => _("Sender ID"),
+            "sendermsn"      => _("Sender MSN"),
+            "receiverid"     => _("Receiver ID"),
+            "receivermsn"    => _("Receiver MSN"),
+            "pages"          => _("Number of pages"),
+            "statusmessage"  => _("Status Message"),
+            "transfertime"   => _("Transfer time"))
+        ));
+  }
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/gofax/faxreports/contents.tpl b/gosa-core/plugins/gofax/faxreports/contents.tpl
new file mode 100644 (file)
index 0000000..197c5b8
--- /dev/null
@@ -0,0 +1,59 @@
+<div class="contentboxh">
+ <p class="contentboxh"><img src="{$launchimage}" align="right" alt="[F]">{t}Filter{/t}</p>
+</div>
+<div class="contentboxb">
+ <p class="contentboxb" style="border-top:1px solid #B0B0B0; padding-top:5px;">
+ <img class="center" alt="" align="middle" border=0 src="{$search_image}">&nbsp;{t}Search for{/t}
+ <input name="search_for" size=25 maxlength=60 value="{$search_for}" title="{t}Enter user name to search for{/t}" onChange="mainform.submit()">
+ {t}in{/t}
+ <select size="1" name="search_base" title="{t}Select subtree to base search on{/t}" onChange="mainform.submit()">
+  {html_options options=$bases selected=$base_select}
+ </select>
+ {t}during{/t}
+ <select size="1" name="month" onChange="mainform.submit()">
+  {html_options options=$months selected=$month_select}
+ </select>
+ {t}in{/t} 
+ <select size="1" name="year" onChange="mainform.submit()">
+  {html_options values=$years output=$years selected=$year_select}
+ </select>
+ &nbsp;
+ <input type=submit name="search" value="{t}Search{/t}">
+</p>
+</div>
+
+<br>
+
+{if $search_result ne ""}
+ <table summary="" style="width:100%; vertical-align:top; text-align:left; border:1px solid #B0B0B0;" cellpadding=2 cellspacing=1 border=0 rules="cols">
+  <tr style="background-color: #E8E8E8; height:26px; font-weight:bold">
+   <td><a href="main.php{$plug}&amp;sort=0">{t}User{/t} {$mode0}</a></td>
+   <td><a href="main.php{$plug}&amp;sort=1">{t}Date{/t} {$mode1}</a></td>
+   <td><a href="main.php{$plug}&amp;sort=2">{t}Status{/t} {$mode2}</a></td>
+   <td><a href="main.php{$plug}&amp;sort=3">{t}Sender{/t} {$mode3}</a></td>
+   <td><a href="main.php{$plug}&amp;sort=4">{t}Receiver{/t} {$mode4}</a></td>
+   <td><a href="main.php{$plug}&amp;sort=5">{t}# pages{/t} {$mode5}</a></td>
+  </tr>
+  {$search_result}
+ </table>
+
+ <table summary="" style="width:100%; vertical-align:top; text-align:center;" cellpadding=4 cellspacing=0 border=0>
+  <tr>
+   <td>{$range_selector}</td>
+  </tr>
+ </table>
+<p class="plugbottom">
+ &nbsp;
+</p>
+
+{else}
+  <b>{t}Search returned no results...{/t}</b>
+{/if}
+
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('search_for');
+  -->
+</script>
diff --git a/gosa-core/plugins/gofax/faxreports/detail.tpl b/gosa-core/plugins/gofax/faxreports/detail.tpl
new file mode 100644 (file)
index 0000000..20b6123
--- /dev/null
@@ -0,0 +1,69 @@
+<table summary="">
+ <tr>
+  <td> 
+   <a href="getfax.php?id={$detail}&amp;download=1">
+     <img  align="bottom" width="420" height="594" src="getfax.php?id={$detail}" alt="{t}FAX preview - please wait{/t}" border=1>
+   </a>
+   <p style="margin-top-width:0px; text-align:center;">
+    {t}Click on fax to download{/t}
+   </p>
+  </td>
+  <td style="width:20px;">
+    &nbsp;
+  </td>
+  <td style="vertical-align:top">
+    <table summary="" border=0 cellspacing=5>
+     <tr>
+      <td><b>{t}FAX ID{/t}</b></td>
+      <td>{$fax_id}</td>
+     </tr>
+     <tr>
+      <td><b>{t}User{/t}</b></td>
+      <td>{$fax_uid}</td>
+     </tr>
+     <tr>
+      <td><b>{t}Date / Time{/t}</b></td>
+      <td>{$date} / {$time}</td>
+     </tr>
+     <tr>
+      <td><b>{t}Sender MSN{/t}</b></td>
+      <td>{$fax_sender_msn}</td>
+     </tr>
+     <tr>
+      <td><b>{t}Sender ID{/t}</b></td>
+      <td>{$fax_sender_id}</td>
+     </tr>
+     <tr>
+      <td><b>{t}Receiver MSN{/t}</b></td>
+      <td>{$fax_receiver_msn}</td>
+     </tr>
+     <tr>
+      <td><b>{t}Receiver ID{/t}</b></td>
+      <td>{$fax_receiver_id}</td>
+     </tr>
+     <tr>
+      <td><b>{t}Status{/t}</b></td>
+      <td>{$fax_status}</td>
+     </tr>
+     <tr>
+      <td><b>{t}Status message{/t}</b></td>
+      <td>{$fax_status_message}</td>
+     </tr>
+     <tr>
+      <td><b>{t}Transfer time{/t}</b></td>
+      <td>{$fax_transfer_time}</td>
+     </tr>
+     <tr>
+      <td><b>{t}# pages{/t}</b></td>
+      <td>{$fax_pages}</td>
+     </tr>
+    </table>
+
+  </td>
+ </tr>
+</table>
+
+<p class="plugbottom">
+  <input type=submit name="bck_to_list" value="{t}Back{/t}">
+</p>
+
diff --git a/gosa-core/plugins/gofax/faxreports/main.inc b/gosa-core/plugins/gofax/faxreports/main.inc
new file mode 100644 (file)
index 0000000..ac80ff3
--- /dev/null
@@ -0,0 +1,19 @@
+<?php
+
+if (!$remove_lock){
+       /* Create faxreport object on demand */
+       if (!isset($_SESSION['faxreport']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+               $_SESSION['faxreport']= new faxreport ($config, $ui);
+       }
+       $faxreport= $_SESSION['faxreport'];
+
+       /* Execute formular */
+       $faxreport->save_object();
+       $display= $faxreport->execute ();
+       $display.= "<input type=\"hidden\" name=\"ignore\">\n";
+       $display= print_header(get_template_path('images/reports.png'), _("FAX reports")).$display;
+
+       /* Store changes  in session */
+       $_SESSION['faxreport']= $faxreport;
+}
+?>
diff --git a/gosa-core/plugins/gofon/conference/class_divListConferences.inc b/gosa-core/plugins/gofon/conference/class_divListConferences.inc
new file mode 100755 (executable)
index 0000000..cdcdcbc
--- /dev/null
@@ -0,0 +1,317 @@
+<?php
+
+class divListConference extends MultiSelectWindow
+{
+
+  /* Current base */
+  var $selectedBase       = "";
+  var $departments        = array();
+
+  /* Regex */
+  var $Regex              = "*";
+
+  /* checkboxes */
+  var $ShowSendBocklists      ;
+  var $ShowReceiveMacros  ;
+
+  /* Subsearch checkbox */
+  var $SubSearch;
+
+  var $parent             ;
+  var $ui                 ;
+
+  function divListConference (&$config,$parent)
+  {
+    MultiSelectWindow::MultiSelectWindow($config,"Conferences", "gofonconference");
+    
+    $this->parent       = $parent;
+    $this->ui           = get_userinfo();
+
+    /* Set list strings */
+    $this->SetTitle(_("List of conference rooms"));
+    $this->SetSummary(_("List of conference rooms"));
+
+    /* Result page will look like a headpage */
+    $this->SetHeadpageMode();
+    $this->SetInformation(_("This menu allows you to create, delete and edit selected phone conferences. Having a large number of phone conferences, you might prefer the range selectors on top of the conferences list."));
+
+    $this->EnableAplhabet(true);
+  
+    /* Disable buttonsm */
+    $this->EnableCloseButton(false);
+    $this->EnableSaveButton (false);
+
+    /* Dynamic action col, depending on snapshot icons */
+    $action_col_size = 100;
+    if($this->parent->snapshotEnabled()){
+      $action_col_size += 20;
+    }
+
+    /* Toggle all selected / deselected */
+    $chk = "<input type='checkbox' id='select_all' name='select_all'
+      onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
+
+    /* set Page header */
+    $this->AddHeader(array("string"=> $chk,          "attach"=>"style='width:20px;'"));
+    $this->AddHeader(array("string" => "&nbsp;", "attach" => "style='text-align:center;width:20px;'"));
+    $this->AddHeader(array("string" =>_("Name - Number"), "attach" => "style=''"));
+    $this->AddHeader(array("string" => _("Owner"), "attach" => "style='width:200px;'"));
+    $this->AddHeader(array("string" => _("PIN"), "attach" => "style='width:50px;'"));
+    $this->AddHeader(array("string" =>_("Actions"), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'"));
+
+    /* Add Checkboxes / SubSearch checkbox */
+    $this->AddCheckBox("SubSearch",  _("Select to search within subtrees"), _("Search in subtrees"), false);
+
+    /*                  Name                 ,Text                              ,Default  , Connect with alphabet  */
+    $this->AddRegex   ("Regex",      _("Regular expression for matching conference names"),"*" , true);
+  }
+
+
+  function GenHeader()
+  {
+    /* Prepare departments,
+       which are shown in the listbox on top of the listbox
+     */
+    $options= "";
+
+    /* Get all departments within this subtree */
+    $base = $this->config->current['BASE'];
+
+    /* Add base */
+    $tmp = array();
+    $tmp[] = array("dn"=>$this->config->current['BASE']);
+    $tmp=  array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
+                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
+
+    $deps = array();
+    foreach($tmp as $tm){
+      $deps[$tm['dn']] = $tm['dn'];
+    }
+  
+    /* Load possible departments */
+    $ui= get_userinfo();
+    $tdeps= $ui->get_module_departments("gofonconference");
+    $ids = $this->config->idepartments;
+    $first = "";
+    $found = FALSE;
+    foreach($ids as $dep => $name){
+      if(isset($deps[$dep]) && in_array_ics($dep, $tdeps)){
+
+        /* Keep first base dn in mind, we could need this
+         *  info if no valid base was found
+         */
+        if(empty($first)) {
+          $first = $dep['dn'];
+        }
+
+        $value = $ids[$dep];
+        if ($this->selectedBase == $dep){
+          $found = TRUE;
+          $options.= "<option selected='selected' value='".$dep."'>$value</option>";
+        } else {
+          $options.= "<option value='".$dep."'>$value</option>";
+        }
+      }
+    }
+
+    /* The currently used base is not visible with your acl setup.
+     * Set base to first useable base.
+     */
+    if(!$found){
+      $this->selectedBase = $first;
+    }
+
+    /* Get acls */
+    $acls     = $ui->get_permissions($this->selectedBase,"gofonconference/conference");
+    $acl_all  = $ui->has_complete_category_acls($this->selectedBase,"gofonconference") ;
+
+    /* Add default header */
+    $listhead = MultiSelectWindow::get_default_header();
+
+    /* Add the rest (base select ....)*/
+    $listhead .= _("Base")."&nbsp;<select name='CurrentMainBase' 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;";
+
+    /* Create Layers menu */
+    $s  = ".|"._("Actions")."|\n";
+    $s .= "..|<img src='images/list_new.png' alt='' border='0' class='center'>".
+      "&nbsp;"._("Create")."|\n";
+
+    /* Append create options */
+    if(preg_match("/(c.*w|w.*c)/",$acl_all)){
+      $s.= "...|<input class='center' type='image' src='images/list_new_conference.png' alt=''>".
+        "&nbsp;"._("Conference")."|conference_new|\n";
+    }
+
+    /* Multiple options */
+    $s.= "..|---|\n";
+    $s.= "..|<img src='images/edittrash.png' alt='' border='0' class='center'>".
+      "&nbsp;"._("Remove")."|"."remove_multiple|\n";
+
+    /* Add multiple copy & cut icons */
+    if(is_object($this->parent->CopyPasteHandler)){
+      $s.= "..|---|\n";
+      $s.= "..|<img src='images/editcopy.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Copy")."|"."multiple_copy_systems|\n";
+      $s.= "..|<img src='images/editcut.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Cut")."|"."multiple_cut_systems|\n";
+
+      if($this->parent->CopyPasteHandler->entries_queued()){
+        $img = "<img border='0' class='center' src='images/editpaste.png' alt=''>";
+        $s.="..|".$img."&nbsp;"._("Paste")."|editPaste|\n";
+      }else{
+        $img = "<img border='0' class='center' src='images/cant_editpaste.png' alt=''>";
+        $s.="..|".$img."&nbsp;"._("Paste")."\n";
+      }
+    }
+
+    /* Add snapshot icons */
+    if(preg_match("/(c.*w|w.*c)/",$acls)){
+      $s .= "..|---|\n";
+      $s .= $this->get_snapshot_header(TRUE);
+    }
+
+    $this->SetDropDownHeaderMenu($s);
+    $this->SetListHeader($listhead);
+  }
+
+  function execute()
+  {
+    $this->ClearElementsList();
+    $this->GenHeader();
+  }
+
+  function setEntries($list)
+  {
+    $linkopen= "<a href='?plug=".$_GET['plug']."&amp;act=dep_open&amp;dep_id=%s'>%s</a>";
+
+    $userimg  = "<img class='center' src='images/select_conference.png' alt='User' title='%s'>";
+    $editlink = "<a href='?plug=".$_GET['plug']."&amp;id=%s&amp;act=edit_entry'>%s</a>";
+
+    /* Dynamic action col, depending on snapshot icons */
+    $action_col_size = 100;
+    if($this->parent->snapshotEnabled()){
+      $action_col_size += 20;
+    }
+
+    /* Insert conferneces*/
+    foreach($list as $conferencekey => $conference ){
+
+      $acl      = $this->ui->get_permissions($conference['dn'],"gofonconference/conference");
+      $acl_all  = $this->ui->has_complete_category_acls($conference['dn'],"gofonconference");
+
+      /* You will need at least read access for the 
+          current conference informations to display it */  
+      if(!preg_match("/r/",$acl)){
+        continue;
+      }
+
+      $actions ="";
+      if(($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
+        $actions.= "<input class='center' type='image'
+          src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
+        $actions.= "<input class='center' type='image'
+          src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
+      }
+
+      /* Add edit icon - This is allowed when we have at least read access. */
+      $actions.= "<input class='center' type='image' src='images/edit.png'     
+                    alt='"._("edit")."'    name='conference_edit_%KEY%' title='"._("Edit this entry")."'>";
+
+      /* Add snapshot icon - This is allowed when we have create and write access for the current entry */
+      if(preg_match("/(c.*w|w.*c)/",$acl_all)){
+        $actions.= $this->GetSnapShotActions($conference['dn']);
+      }
+
+      /* Create delete link - Only if we are allowed to delete this entry */
+      if(preg_match("/d/",$acl)){
+        $actions.= "<input class='center' type='image' src='images/edittrash.png' 
+          alt='"._("delete")."'   name='conference_del_%KEY%'  title='"._("Delete this entry")."'>";
+      }
+
+      /* Display PIN icon, only if we are the owner of the given conference */
+      $owner = $this->parent->ui->dn==$conference['goFonConferenceOwner'][0];
+      $p_acl = $this->ui->get_permissions($conference['dn'],"gofonconference/conference","goFonPIN");
+      if((isset($conference['goFonPIN'][0])) && $owner && preg_match("/r/",$p_acl)){
+        $pin = "<img class='center' src='images/list_password.png' title='PIN : ".$conference['goFonPIN'][0]."' alt='PIN'>";
+      }else{
+        $pin = "&nbsp;";
+      }
+
+      /* Display numer of the conference if we are allowed to view it */
+      $n_acl = $this->ui->get_permissions($conference['dn'],"gofonconference/conference","telephoneNumber");
+      if(isset($conference['telephoneNumber'][0]) && preg_match("/r/",$n_acl)){
+        $number = " - ".$conference['telephoneNumber'][0];
+      }else{
+        $number = "&nbsp; - ?";
+      }
+
+      /* Get conference owner name */
+      $ldap= $this->parent->config->get_ldap_link();
+      $ldap->cat($conference['goFonConferenceOwner'][0], array('cn'));
+      $data = $ldap->fetch();
+      if(isset($data['cn'][0])){
+        $cn = $data['cn'][0];
+      }else{
+        $cn = _("Unknown"); 
+      }  
+
+      /* Create title */
+      $title = " title='".preg_replace("/ /","&nbsp;",@LDAP::fix($data['dn']))."' ";
+
+      /* Cutted objects should be displayed in light grey */
+      $display = $conference['cn'][0].$number;
+      if($this->parent->CopyPasteHandler){
+        foreach($this->parent->CopyPasteHandler->queue as $queue_key => $queue_data){
+          if($queue_data['dn'] == $conference['dn']) {
+            $display = "<font color='#999999'>".$display."</font>";
+            break;
+          }
+        }
+      }
+
+      /* Create each field */
+      $field0 = array("string" => "<input type='checkbox' id='item_selected_".$conferencekey."' name='item_selected_".$conferencekey."'>" ,
+          "attach" => "style='width:20px;'");
+      $a_field1 = array("string"=>sprintf($userimg,_("Conference")), "attach" => $title." style='text-align:center;width:20px;'");
+      $a_field2 = array("string"=>sprintf($editlink,$conferencekey,$display), "attach" => $title." style=''");
+      $a_field3 = array("string"=> $cn , "attach" =>  $title." style='width:200px;'");
+      $a_field4 = array("string"=> $pin, "attach" =>  $title." style='width:50px;'");
+      $a_field5 = array("string"=> preg_replace("/%KEY%/",$conferencekey,$actions), 
+                        "attach"=> $title."style='width:".$action_col_size."px;border-right:0px;text-align:right;'");
+
+      $this->AddElement(array($field0,$a_field1,$a_field2,$a_field3,$a_field4,$a_field5));
+    }
+
+    /* Create summary string for list footer */
+    $num_deps=0;
+    if(!$this->SubSearch){
+      $num_deps = count($this->Added_Departments);
+    }
+    $num_objs = count($list);
+
+    $num_obj_str = _("Number of listed conferences");
+    $num_dep_str = _("Number of listed departments");
+
+    $str = "<img class='center' src='images/select_conference.png'
+              title='".$num_obj_str."' alt='".$num_obj_str."'>&nbsp;".$num_objs."&nbsp;&nbsp;&nbsp;&nbsp;";
+    $str.= "<img class='center' src='images/folder.png'
+              title='".$num_dep_str."' alt='".$num_dep_str."'>&nbsp;".$num_deps."&nbsp;&nbsp;&nbsp;&nbsp;";
+
+    $this->set_List_Bottom_Info($str);
+  }
+
+  function Save()
+  {
+    MultiSelectWindow :: Save();  
+  }
+
+  function save_object()
+  {
+    /* Save automatic created POSTs like regex, checkboxes */
+    MultiSelectWindow :: save_object();   
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/gofon/conference/class_phoneConferenceGeneric.inc b/gosa-core/plugins/gofon/conference/class_phoneConferenceGeneric.inc
new file mode 100644 (file)
index 0000000..e0364dc
--- /dev/null
@@ -0,0 +1,794 @@
+<?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 conference extends plugin
+{
+  /* department attributes */
+  var $cn                                                = "";
+  var $description             = "";
+  var $base                              = "";
+  var $old_base            = "";
+  var $ou                                              = "";
+  var $goFonPIN                                = "";
+  var $old_cn         = "";
+
+  var $goFonConferenceOption           = "";
+  var $goFonConferenceOption_P         = "";   // Set PIN 
+  var $goFonConferenceOption_r         = "";   // record Conference
+  var $goFonConferenceOption_M         = "";   // Play Music opn hold
+  var $goFonConferenceOption_s         = "";   // activate menu
+  var $goFonConferenceOption_i         = "";   // announce new and leaving user
+  var $goFonConferenceOption_c         = "";   // Count User
+  var $goFonConferenceOption_D         = "";   // Conference Type, no PIN/PIN
+
+  var $goFonConferenceOwner     = "";
+  var $goFonHomeServer          = "0";      // Home server of the conference
+  var $init_HomeServer          = "0";      // Initial home server of the conference
+  var $goFonHomeServers         = array();  // All available home servers
+
+  var $goFonConferenceOptionFormat             = "";
+  var $goFonConferenceOptionLifetime   = "";
+  var $telephoneNumber                 = "";
+
+  var $old_tele_number         = false;
+  var $old_dn;
+
+  /* Headpage attributes */
+  var $last_dep_sorting= "invalid";
+  var $departments= array();
+  var $view_logged = FALSE;
+  var $dialog ;
+
+  /* attribute list for save action */
+  var $attributes= array("cn","base", "description", "goFonPIN","goFonConferenceOption_P","goFonConferenceOption_r","goFonHomeServer",
+      "goFonConferenceOption_M","goFonConferenceOption_s","goFonConferenceOption_i","goFonConferenceOption_c","goFonHomeServer",
+      "goFonConferenceOption_D","goFonConferenceOptionFormat","goFonConferenceOptionLifetime","telephoneNumber","goFonConferenceOwner");
+
+  var $language  = "de";
+  var $languages = array();
+
+  var $objectclasses= array("top", "goFonConference");
+
+  function conference (&$config, $dn, $plugin= NULL)
+  {
+    plugin::plugin($config, $dn, $plugin);
+    $this->is_account  = TRUE;
+    $this->ui                      = get_userinfo();
+    $this->orig_dn             = $dn;
+
+    $this->languages= get_languages(TRUE,TRUE);
+
+
+    /* Check server configurations
+     * Load all server configuration in $this->goFonHomeServers if available
+     *  and use first server as default if necessary.
+     */
+    $a_SETUP= array();
+    if(array_key_exists('config',$_SESSION) &&
+       array_key_exists('SERVERS',$_SESSION['config']->data) &&
+       array_key_exists('FON',$_SESSION['config']->data['SERVERS']) &&
+       count($_SESSION['config']->data['SERVERS']['FON']) &&
+       is_callable("mysql_connect")
+       ) {
+
+      /* Set available server */
+      $this->goFonHomeServers = $_SESSION['config']->data['SERVERS']['FON'];
+
+      /* Set default server */
+      if($this->dn == "new"){
+        $this->goFonHomeServer = $this->goFonHomeServers[0]['DN'];
+      }
+
+      /* Remember inital home server, to be able to remove old entries */
+      $this->init_HomeServer = $this->goFonHomeServer;
+
+      /* get config */
+      if(!isset($this->goFonHomeServers[$this->goFonHomeServer])){
+        print_red(sprintf(_("The specified home server '%s' is not available in GOsa server configuration. Saving this account will create a new entry on the server '%s'. Use cancel if you do not want to create a new entry while ignoring old accounts."),$this->goFonHomeServer, $this->goFonHomeServers[0]['DN']));
+
+        $this->goFonHomeServer = $this->goFonHomeServers[0]['DN'];
+        $this->init_HomeServer = $this->goFonHomeServers[0]['DN'];
+      }
+      $cur_cfg = $this->goFonHomeServers[$this->goFonHomeServer]; 
+    }
+
+    /* Set base */
+    if ($this->dn == "new"){
+      $ui= get_userinfo();
+      if(isset($_SESSION['CurrentMainBase'])){
+        $this->base = $_SESSION['CurrentMainBase'];
+      }else{
+        $this->base= dn2base($ui->dn);
+      }
+    } else {
+
+      /* The base is something like this 
+          "cn=Confis,ou=conferences,ou=asterisk,ou=configs,ou=systems," */
+      $this->base= preg_replace ("/^[^,]+,[^,]+,[^,]+,[^,]+,[^,]+,/", "", $this->dn);
+    }
+
+    $this->goFonConferenceOwner=$this->ui->dn;
+
+    /* Parse Options ... 
+     * Parameter|Lifetime|number
+     */
+    if($this->dn!="new"){
+      $tmp1= split("\|",$this->attrs['goFonConferenceOption'][0]);
+
+      for($i = 0 ; $i < strlen($tmp1[0]);$i++){
+        $varname = "goFonConferenceOption_".$tmp1[0][$i];
+        if($tmp1[0][$i]=="d"){
+          $this->goFonConferenceOption_D = $tmp1[0][$i];    
+        }else{
+          $this->$varname = $tmp1[0][$i];    
+        }
+      }
+
+      $this->goFonConferenceOptionLifetime  = $tmp1[1];
+      if(isset($tmp1[2]) && isset($this->languages[$tmp1[2]])){
+        $this->language = $tmp1[2];
+      }
+  
+      $this->old_tele_number                = $this->telephoneNumber;
+    }
+    $this->old_dn = $this->dn;
+    $this->old_cn = $this->cn;
+    $this->old_base = $this->base;
+  }
+
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* Log last action */
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","gofonconference/".get_class($this),$this->dn);
+    }
+
+    $smarty= get_smarty();
+
+    $smarty->assign("bases" ,$this->config->idepartments);
+    $smarty->assign("base"  ,$this->base);
+
+    $once = true; 
+    foreach($_POST as $name => $value){
+      if(preg_match("/^chooseBase/",$name) && $once && $this->acl_is_writeable("base")){
+        $once = false;
+        $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
+        $this->dialog->setCurrentBase($this->base);
+      }
+    }
+
+    /* Dialog handling */
+    if(is_object($this->dialog)){
+      /* Must be called before save_object */
+      $this->dialog->save_object();
+
+      if($this->dialog->isClosed()){
+        $this->dialog = false;
+      }elseif($this->dialog->isSelected()){
+        $tmp = $this->get_allowed_bases();
+        if(isset($tmp[$this->dialog->isSelected()])){
+          $this->base = $this->dialog->isSelected();
+        }
+        $this->dialog= false;
+      }else{
+        return($this->dialog->execute());
+      }
+    }
+
+    foreach ($this->attributes as $val){
+      $smarty->assign("$val", $this->$val);
+      if(!$this->$val){
+        $smarty->assign($val."CHK", "");
+      }else{
+        $smarty->assign($val."CHK", " checked ");
+      }
+    }
+
+    /* Create array with goFonHomeServer */
+    $tmp = array();
+    foreach($this->goFonHomeServers as $dn => $val){
+      if(!is_numeric($dn)){
+        $tmp[$dn]  = $val['SERVER'];
+      }
+    }
+    $smarty->assign("language",$this->language);
+    $smarty->assign("languages",$this->languages);
+    $smarty->assign("goFonHomeServers",$tmp);
+    $smarty->assign("goFonConferenceOptions",              array("D"=>"Conference ","d"=>"Conference without PIN"));
+    $smarty->assign("goFonConferenceOptionFormats",    array("WAV"=>"Wave","GSM"=>"GSM","WAV49"=>"Wave49"));
+    $smarty->assign("goFonConferenceOption",        $this->goFonConferenceOption_D);
+
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+    if($this->acl_is_writeable("base")){
+      $smarty->assign("baseSelect",true);
+    }else{
+      $smarty->assign("baseSelect",false);
+    }
+
+    $smarty->assign("bases" ,$this->get_allowed_bases());
+    $smarty->assign("base_select"  ,$this->base);
+
+
+    if($_SESSION['js']==1){
+      if($this->goFonConferenceOption_P != "P"){
+        $smarty->assign("goFonPINACL", $this->getacl("goFonPIN",TRUE));
+        $smarty->assign("goFonPIN","");
+      }
+      if($this->goFonConferenceOption_r != "r"){
+        $smarty->assign("goFonConferenceOptionFormatACL", $this->getacl("goFonConferenceOptionr",TRUE));
+      }
+    }
+    return($smarty->fetch (get_template_path('generic.tpl', TRUE)));
+  }
+
+
+  function remove_from_parent()
+  {
+    /* Check if 'old' home server is available in gosa FON server configuration 
+     * Try to remove this entry from database and display errors.  
+     */
+    if(isset($this->goFonHomeServers[$this->goFonHomeServer])){
+      $str = $this->SQL_remove_me(true); 
+      if($str){
+        print_red($str);
+        return false;
+      }
+    }else{
+      print_red(_("Could not remove the conference entry from database on home server (%s). Please check your asterisk database configuration."));
+      return false;
+    }
+
+    /* Remove ldap entry */
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd ($this->dn);
+    $ldap->recursive_remove();
+
+    new log("remove","gofonconference/".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');
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    if(isset($_POST['phoneConferenceGeneric'])){
+
+      /* Get selected language */
+      if(isset($_POST['language']) && isset($this->languages[get_post('language')])){
+        $this->language = get_post('language');
+      }
+
+      /* Create a base backup and reset the
+         base directly after calling plugin::save_object();
+         Base will be set seperatly a few lines below */
+      $base_tmp = $this->base;
+      plugin::save_object();
+      $this->base = $base_tmp;
+
+      /* Save base, since this is no LDAP attribute */
+      $tmp = $this->get_allowed_bases();
+      if(isset($_POST['base'])){
+        if(isset($tmp[$_POST['base']])){
+          $this->base= $_POST['base'];
+        }
+      }
+      foreach(array("goFonConferenceOption_P","goFonConferenceOption_r","goFonConferenceOption_M","goFonConferenceOption_s",
+            "goFonConferenceOption_i","goFonConferenceOption_c","goFonConferenceOption_D") as $attrs){
+
+        /* Acl can't contain _ so we remove it here. */
+        $acl_name = preg_replace("/_/","",$attrs);
+
+        if($this->acl_is_writeable($acl_name)){
+
+          if(isset($_POST[$attrs])){
+            $this->$attrs = $_POST[$attrs];
+          }else{
+            $this->$attrs = false;
+          }
+        }
+      }
+    }
+  }
+
+
+  function check_database_accessibility()
+  {
+    /* Check if mysql extension is available */
+    if(!is_callable("mysql_pconnect")){
+      return(_("Can't save any changes to asterisk database, there is currently no mysql extension available in your php setup."));
+    }
+
+    /********************
+     * Check currently selected home server 
+     ********************/
+
+    $cfg_Current  = $this->goFonHomeServers[$this->goFonHomeServer];
+    $r_current    =  @mysql_pconnect($cfg_Current['SERVER'],$cfg_Current['LOGIN'],$cfg_Current['PASSWORD']);
+    if(!$r_current){
+      new log("debug","gofonconference/".get_class($this),"",array(),@mysql_error($r_current));
+
+      return(sprintf(_("The MySQL home server '%s' isn't reachable as user '%s', check GOsa log for mysql error."),
+            $cfg_Current['SERVER'],$cfg_Current['LOGIN']));
+    }
+    $db_current  =  @mysql_select_db($cfg_Current['DB'],$r_current);
+    if(!$db_current){
+      new log("debug","gofonconference/".get_class($this),"",array(),@mysql_error($r_current));
+      mysql_close($r_current);
+      return( sprintf(_("Can't select database '%s' on home server '%s'."),$cfg_Current['DB'],$cfg_Current['SERVER']));
+    }
+
+    /********************
+     * Check init home server 
+     ********************/
+
+    if($this->goFonHomeServers != $this->init_HomeServer){
+      $cfg_Init  = $this->goFonHomeServers[$this->init_HomeServer] ;
+      $r_init    =  @mysql_pconnect($cfg_Init['SERVER'],$cfg_Init['LOGIN'],$cfg_Init['PASSWORD']);
+      if(!$r_init){
+        new log("debug","gofonconference/".get_class($this),"",array(),@mysql_error($r_init));
+
+        return(sprintf(_("The MySQL initial home server '%s' isn't reachable as user '%s', check GOsa log for mysql error."),
+              $cfg_Init['SERVER'],$cfg_Init['LOGIN']));
+      }
+      $db_init  =  @mysql_select_db($cfg_Init['DB'],$r_init);
+      if(!$db_init){
+        new log("debug","gofonconference/".get_class($this),"",array(),@mysql_error($r_init));
+        mysql_close($r_init);
+        return( sprintf(_("Can't select database '%s' on initial home server '%s'."),$cfg_Init['DB'],$cfg_Init['SERVER']));
+      }
+    }
+  }
+
+  /* Check values */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    if($this->is_number_used()){
+      $message[] =  $this->is_number_used();
+    }
+
+    /* Check if previously selected server is still available */
+    if($this->initially_was_account && !isset($this->goFonHomeServers[$this->goFonHomeServer])){
+      $message[]= sprintf(_("The previously selected asterisk home server (%s) is no longer available."),preg_replace("/,/",", ",$this->goFonHomeServer));
+      return($message);
+    }
+
+    if((empty($this->goFonPIN))&&($this->goFonConferenceOption_P=="P")&&($this->goFonConferenceOption_D=="D")){
+      $message[]= _("Please enter a PIN.");
+    }
+
+    if(empty($this->cn)){
+      $message[] =_("Please enter a name for the conference.");
+    }
+
+    if(!is_numeric($this->telephoneNumber)){
+      $message[] =_("Only numeric chars are allowed in Number field.");
+    }
+
+    if(!((is_numeric($this->goFonConferenceOptionLifetime))||(empty($this->goFonConferenceOptionLifetime)))){
+      $message[] =_("Only numbers are allowed in Lifetime.");
+    }
+
+    /* Check if add could be successful */    
+    $str = $this->SQL_add_me(false);
+    if(!empty($str)){
+      $message[] = $str;
+    }
+
+    if($this->old_cn != $this->cn || $this->base != $this->old_base){
+      $ldap = $this->config->get_ldap_link();
+      $ldap->cd("ou=conferences,ou=asterisk,ou=configs,ou=systems,".$this->base);
+      $ldap->search("(&(objectClass=goFonConference)(cn=".$this->cn."))",array("cn"));
+      if($ldap->count()){
+        $message[] =_("There is already a conference with this name in the current tree.");
+      }
+    }
+    return $message;
+  }
+
+
+  function SQL_add_me($save)
+  {
+    /* Check if there is at least on server configuration */
+    if(!count($this->goFonHomeServers)){
+      return( _("There is currently no asterisk server defined. Possibly you are missing a server that handles the asterisk management (goFonServer). Your settings can't be saved to asterisk database."));
+    }
+  
+    /********************
+     * Get configuration and try to connect 
+     ********************/
+
+    /* Check if databases are reachable, returns an error string if anything fails  */
+    $error_str = $this->check_database_accessibility();
+    if($error_str){
+      return($error_str);
+    }
+
+    /* Remove old entries, returns an error string if anything fails  */
+    $error_str = $this->SQL_remove_me($save);
+    if($error_str){
+      return($error_str);
+    }
+
+    /* Connect to current database to be able to add new entries */
+    $cfg_Current  = $this->goFonHomeServers[$this->goFonHomeServer] ;
+    $res_cur      =  @mysql_pconnect($cfg_Current['SERVER'],$cfg_Current['LOGIN'],$cfg_Current['PASSWORD']);
+    $db_cur       =  @mysql_select_db($cfg_Current['DB'],$res_cur);
+
+    /********************
+     * Remove entries that could cause trouble  
+     ********************/
+
+    /* If the current home server is different to the initial home server,
+     *  there may be already some entries with the given telephoneNumber and/or cn.
+     * We must remove those entries to avoid duplicate use of the same extension name.
+     */
+    if($this->goFonHomeServer != $this->init_HomeServer){
+      $query = "SELECT id FROM ".$cfg_Current['EXT_TABLE']." WHERE exten='".$this->telephoneNumber."' OR exten='".$this->cn."';";
+      $res = @mysql_query($query,$res_cur);
+      @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query, "Database query");
+      if(!$res){
+        new log("debug","gofonconference/".get_class($this),"",array(),@mysql_error($res_cur));
+        return(_("Can not check if there are already some entries with given telephone number and/or cn in the destination home server.").
+            "&nbsp;"._("Please have a look a the gosa logfiles."));
+      }
+      if($save && mysql_affected_rows($res_cur)) {
+        $SQL = "DELETE FROM ".$cfg_Current['EXT_TABLE']." 
+          WHERE   (exten='".$this->telephoneNumber."') 
+          OR    (exten='".$this->cn."')";
+
+        /* Query and ensure that everything went fine */
+        $res =  @mysql_query($SQL,$res_cur);
+        @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$SQL, "Database query");
+        if(!$res){
+          new log("debug","gofonconference/".get_class($this),"",array(),@mysql_error($res_cur));
+          return(_("Can not remove entries with some telephone number and/or cn from destination home server.").
+              "&nbsp;"._("Please have a look a the gosa logfiles."));
+        }
+      }
+    }
+
+    /********************
+     * Add new conference entry  
+     ********************/
+    if((!empty($this->telephoneNumber))&&($save==true)){
+
+      /* Create string out of conference Flags */
+      $parameter  ="";
+      foreach(array("goFonConferenceOption_P","goFonConferenceOption_r","goFonConferenceOption_M","goFonConferenceOption_s",
+            "goFonConferenceOption_i","goFonConferenceOption_c","goFonConferenceOption_D") as $attrs){
+        $parameter .= $this->$attrs;
+      }
+
+      $i=1;
+      $EXT=array();
+      $context="GOsa";
+      // Set Language to German
+      $EXT[$i]['exten']   =$this->telephoneNumber;
+      $EXT[$i]['context'] = $context;
+      $EXT[$i]['priority']= $i;
+      $EXT[$i]['app']     ="SetLanguage";
+      $EXT[$i]['appdata'] =$this->language;
+      $i++;      
+
+      if($this->goFonConferenceOption_r == "r"){
+
+        // Recordingformat for conference
+        $EXT[$i]['exten']   =$this->telephoneNumber;
+        $EXT[$i]['context'] =$context;
+        $EXT[$i]['priority']= $i;
+        $EXT[$i]['app']     ="Setvar";
+        $EXT[$i]['appdata'] ="MEETME_RECORDINGFORMAT=".$this->goFonConferenceOptionFormat;
+        $i++;      
+
+      }
+
+      // Answer Call
+      $EXT[$i]['exten']   =$this->telephoneNumber;
+      $EXT[$i]['context'] =$context;
+      $EXT[$i]['priority']=$i;
+      $EXT[$i]['app']     ="answer";
+      $EXT[$i]['appdata'] ="";
+      $i++;      
+
+      // Start Conference 
+      $EXT[$i]['exten']   =$this->telephoneNumber;
+      $EXT[$i]['context'] =$context;
+      $EXT[$i]['priority']=$i;
+      $EXT[$i]['app']     ="MeetMe";
+
+      if(empty($this->goFonPIN)) {
+        $EXT[$i]['appdata'] =$this->telephoneNumber."|".$parameter;
+      }else{
+        $EXT[$i]['appdata'] =$this->telephoneNumber."|".$parameter."|".$this->goFonPIN;
+      }
+      $i++; 
+
+      // Start Conference 
+      $EXT[$i]['exten']   =$this->cn;
+      $EXT[$i]['context'] =$context;
+      $EXT[$i]['priority']=1;
+      $EXT[$i]['app']     ="Goto";
+      $EXT[$i]['appdata'] =$this->telephoneNumber."|1";
+      $SQL=array();
+
+      foreach($EXT as $keytop => $valtop){
+        $s_keys = "";
+        $s_values = ""; 
+        foreach($valtop as $key=>$val){
+          $s_keys   .="`".$key."`,";
+          $s_values .="'".$val."',";
+        }
+        $s_keys   =preg_replace("/\,$/","",$s_keys); 
+        $s_values =preg_replace("/\,$/","",$s_values); 
+        $SQL[]="INSERT INTO ".$cfg_Current['EXT_TABLE']." (".$s_keys.") VALUES (".$s_values.");"; 
+      }
+      foreach($SQL as $sqlsyn){
+        mysql_query($sqlsyn,$res_cur);
+        @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$sqlsyn, "Database query");
+      }
+    } 
+
+    @mysql_close($res_cur);
+  }
+
+
+  /* Remove initial entry from database 
+   * This function checks if there is an entry in the 
+   *  initial home server that uses this->old_cn or $this->old_tele_number
+   *  and removes this entries. 
+   * This function is called from save and remove_from parent.
+   * 
+   *  The parameter '$save' is false if we just 
+   *   want to check if a remove is possible. 
+   *  And true if we realy want to remove the entries.   
+   */
+  function SQL_remove_me($save)
+  {
+    /* check database access */
+    $str = $this->check_database_accessibility();
+    if($str){
+      return($str);
+    }
+
+    /* Connect to old database */
+    $cfg_Init  = $this->goFonHomeServers[$this->init_HomeServer] ;
+    $r_init    =  @mysql_pconnect($cfg_Init['SERVER'],$cfg_Init['LOGIN'],$cfg_Init['PASSWORD']);
+    $db_init   =  @mysql_select_db($cfg_Init['DB'],$r_init);
+   
+    /* Check if there is an old entry */
+    $query = "SELECT id FROM ".$cfg_Init['EXT_TABLE']." WHERE exten='".$this->old_tele_number."' OR exten='".$this->old_cn."';";
+    $res = @mysql_query($query,$r_init);
+    @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query, "Database query");
+    if(!$res){
+      new log("debug","gofonconference/".get_class($this),"",array(),@mysql_error($r_init));
+      return(_("Can not check if entry exists in old database. Please have a look a the gosa logfiles."));
+    }
+   
+    /* There are entries using this cn and/or phone number */
+    if($save && mysql_affected_rows($r_init)) {
+      $SQL = "DELETE FROM ".$cfg_Init['EXT_TABLE']." 
+      WHERE   (exten='".$this->old_tele_number."') 
+        OR    (exten='".$this->old_cn."')";
+  
+      /* Query and ensure that everything went fine */
+      $res =  @mysql_query($SQL,$r_init);
+      @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$SQL, "Database query");
+      if(!$res){
+        new log("debug","gofonconference/".get_class($this),"",array(),@mysql_error($r_init));
+        return(_("Can not remove old entries from initial home server. Please have a look a the gosa logfiles."));
+      }
+
+    }//ENDE  old num availiable ...
+    @mysql_close($r_init);
+    return(false);
+  }
+
+
+
+  /* This function checks if the given phonenumbers are available or already in use*/
+  function is_number_used()
+  {
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(|(objectClass=goFonAccount)(objectClass=goFonQueue)(objectClass=goFonConference))", array("telephoneNumber","cn","uid"));
+    while($attrs = $ldap->fetch()) {
+      unset($attrs['telephoneNumber']['count']);
+      foreach($attrs['telephoneNumber'] as $tele){
+        if(!isset($attrs['cn'][0])) $attrs['cn'][0]=$attrs['dn'];
+        if(!isset($attrs['uid'][0])) $attrs['uid'][0]=$attrs['dn'];
+        $numbers[$tele]=$attrs;
+      }
+    }
+
+    $num = $this->telephoneNumber;
+    if((isset($numbers[$num]))&&(($numbers[$num]['cn'][0]!=$this->old_cn))){
+      if(isset($numbers[$num]['uid'][0])){
+        return sprintf(_("The specified telephonenumber '%s' is already assigned to '%s'."),$num,$numbers[$num]['uid'][0]);
+      }else{
+        return sprintf(_("The specified telephonenumber '%s' is already assigned to '%s'."),$num,$numbers[$num]['cn'][0]);
+      }
+    }
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+
+    if((!isset($this->attrs['goFonPIN']))){
+      $pin_use = false;
+    }else{
+      $pin_use = true;
+    }
+
+    /* Unset PIN if this is a conference without PIN */
+    if((!empty($this->goFonPIN)||($this->goFonConferenceOption_P=="P"))&&($this->goFonConferenceOption_D=="d")){
+      $this->goFonPIN = "";
+    }
+
+    plugin::save();
+
+    if(empty($this->old_tele_number)){
+      $this->old_tele_number= $this->telephoneNumber;
+    }
+
+    $this->SQL_add_me(true);
+
+    if(empty($this->goFonConferenceOption_P)){
+      if($pin_use){
+        $this->attrs['goFonPIN']=array();
+      }else{
+        unset($this->attrs['goFonPIN']);
+      }
+    }
+    $this->attrs['goFonConferenceOption']="";
+    foreach(array("goFonConferenceOption_P","goFonConferenceOption_r","goFonConferenceOption_M","goFonConferenceOption_s",
+          "goFonConferenceOption_i","goFonConferenceOption_c","goFonConferenceOption_D","goFonConferenceOptionFormat") as $attrs){
+      $this->attrs['goFonConferenceOption'] .= $this->$attrs;
+      unset($this->attrs[$attrs]);         
+    }
+
+    $this->attrs['goFonConferenceOption'].="|".$this->goFonConferenceOptionLifetime;
+    $this->attrs['goFonConferenceOption'].="|".$this->language;
+    unset($this->attrs['goFonConferenceOptionLifetime']);
+
+    /* Write back to ldap */
+
+    unset($this->attrs['base']);
+
+    $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->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
+      $ldap->cd($this->dn);
+      $ldap->add($this->attrs);
+      $this->handle_post_events('add');
+    }
+
+    /* Log last action */
+    if($this->initially_was_account){
+      new log("modify","gofonconference/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      new log("create","gofonconference/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
+
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of goFonConference/generic with dn '%s' failed."),$this->dn));
+
+    /* Optionally execute a command after we're done */
+    $this->postcreate();
+  }
+
+
+  function getCopyDialog()
+  {
+    $smarty = get_smarty();
+    $smarty->assign("cn" ,$this->cn);
+    $smarty->assign("telephoneNumber" ,$this->telephoneNumber);
+    $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE));
+    $ret = array();
+    $ret['string'] = $str;
+    $ret['status'] = "";
+    return($ret);
+  }
+
+
+  function saveCopyDialog()
+  {
+    if(isset($_POST['cn'])){
+      $this->cn = $_POST['cn'];
+    }
+    if(isset($_POST['telephoneNumber'])){
+      $this->telephoneNumber = $_POST['telephoneNumber'];
+    }
+  }
+
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source) ;
+
+    $source_o = new conference($this->config,$source['dn']);
+  
+    foreach($this->attributes as $attr){
+      $this->$attr = $source_o->$attr;
+    }
+  }
+
+
+  /* Return plugin informations for acl handling */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Conference"),
+          "plDescription" => _("Phone conference management"),
+          "plSelfModify"  => TRUE,
+          "plDepends"     => array(),
+          "plPriority"    => 0,
+          "plSection"     => array("addons" => _("Addons")),
+          "plCategory"    => array("gofonconference" => array("description" => _("GOfon conference"),
+              "objectClass" => "gofonConference")),
+
+          "plProvidedAcls" => array(
+            "cn"                            => _("Name"),
+            "base"                          => _("Base"),
+            "description"                   => _("Description"),
+            "goFonPIN"                      => _("Conference PIN"),
+
+            "goFonHomeServer"              => _("Home server"),
+            "goFonConferenceOptionP"       => _("Preset PIN"),
+            "goFonConferenceOptionr"       => _("Record conference"),
+            "goFonConferenceOptionM"       => _("Play music on hold"),
+            "goFonConferenceOptions"       => _("Activate menu"),
+            "goFonConferenceOptioni"       => _("Announce user activity"),
+            "goFonConferenceOptionc"       => _("Count user"),
+            "goFonConferenceOptionD"       => _("Conference type"),
+
+            "goFonConferenceOptionFormat"   => _("Format"),
+            "goFonConferenceOptionLifetime" => _("Lifetime"),
+            "telephoneNumber"               => _("Telephone number"),
+            "goFonConferenceOwner"          => _("Owner"))
+            ));
+  }
+
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/gofon/conference/class_phoneConferenceManagment.inc b/gosa-core/plugins/gofon/conference/class_phoneConferenceManagment.inc
new file mode 100644 (file)
index 0000000..023e52e
--- /dev/null
@@ -0,0 +1,555 @@
+<?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 phoneConferenceManagment extends plugin
+{
+  /* Definitions */
+  var $plHeadline                                = "Phone conferences";
+  var $plDescription                   = "Management";
+
+  /* CLI vars */
+  var $cli_summary                       = "Handling of LDAP subtrees";
+  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 $attributes                                = array();
+  var $objectclasses                   = array();
+
+  var $conferences                       = array();
+  var $conftab            = false;
+  var $ui                 = NULL;
+  var $DivListConference  = NULL;
+
+  var $CopyPasteHandler = NULL;
+  var $start_pasting_copied_objects = FALSE;
+
+  /* Initialise Class */
+  function phoneConferenceManagment (&$config, $ui)
+  {
+    $this->ui                    = $ui;
+    $this->dn                    = "";
+    $this->config              = $config;
+    $this->DivListConference = new divListConference($this->config,$this);
+
+    /* Copy & Paste enabled ?*/
+    if((isset($this->config->data['MAIN']['ENABLECOPYPASTE']))&&(preg_match("/true/i",$this->config->data['MAIN']['ENABLECOPYPASTE']))){
+      $this->CopyPasteHandler = new CopyPasteHandler($this->config);
+    }
+  }
+
+
+  /* Execute class and display something */
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    $_SESSION['LOCK_VARS_TO_USE'] = array("/^id$/","/^act$/","/^conference_/","/^item_selected/","/^remove_multiple_conferences/");
+
+    /***************
+      Variable initialisation
+     ***************/
+  
+    /* Reload departments */
+    $smarty                                                      = get_smarty();
+    $display                                             = "";
+    $s_action                                          = "";  // Will contain an action, like del or edit
+    $s_entry                                           = "";  // The entry name for edit delete -...
+
+
+    /***************
+      Check posts  
+     ***************/
+  
+    foreach($_POST as $key => $post){
+      if(preg_match("/^conference_new.*/i",$key)){
+        $s_action = "new";
+        // Post for delete
+      }elseif(preg_match("/^conference_del.*/",$key)){
+        $s_action = "del";
+        $s_entry  = preg_replace("/^conference_del_/i","",$key);
+        $s_entry  = preg_replace("/_.*$/","",$s_entry);
+        // Post for edit
+      }elseif(preg_match("/conference_edit_.*/",$key)){
+        $s_action="edit";
+        $s_entry  = preg_replace("/conference_edit_/i","",$key);
+        $s_entry  = preg_replace("/_.*$/","",$s_entry);
+      }elseif(preg_match("/^remove_multiple_conferences/",$key)){
+        $s_action="del_multiple";
+      }elseif(preg_match("/^editPaste.*/i",$key)){
+        $s_action="editPaste";
+      }elseif(preg_match("/^copy_.*/",$key)){
+        $s_action="copy";
+        $s_entry  = preg_replace("/^copy_/i","",$key);
+        $s_entry  = preg_replace("/_.$/","",$s_entry);
+      }elseif(preg_match("/^cut_.*/",$key)){
+        $s_action="cut";
+        $s_entry  = preg_replace("/^cut_/i","",$key);
+        $s_entry  = preg_replace("/_.$/","",$s_entry);
+      }elseif(preg_match("/^multiple_copy_objects/",$key)){
+        $s_action = "copy_multiple";
+      }elseif(preg_match("/^multiple_cut_objects/",$key)){
+        $s_action = "cut_multiple";
+      } 
+    }
+
+    /* Edit Entry */
+    if((isset($_GET['act']))&&($_GET['act']=="edit_entry")){
+      $s_action = "edit";
+      $s_entry  = $_GET['id'];
+    }
+
+    /* handle C&P from layers menu */
+    if(isset($_POST['menu_action']) && preg_match("/^multiple_copy_systems/",$_POST['menu_action'])){
+      $s_action = "copy_multiple";
+    }
+    if(isset($_POST['menu_action']) && preg_match("/^multiple_cut_systems/",$_POST['menu_action'])){
+      $s_action = "cut_multiple";
+    }
+    if(isset($_POST['menu_action']) && preg_match("/^editPaste/",$_POST['menu_action'])){
+      $s_action = "editPaste";
+    }
+
+    /* Create options */
+    if(isset($_POST['menu_action']) && $_POST['menu_action'] == "conference_new"){
+      $s_action = "new";
+    }
+
+    /* handle remove from layers menu */
+    if(isset($_POST['menu_action']) && preg_match("/^remove_multiple/",$_POST['menu_action'])){
+      $s_action = "del_multiple";
+    }
+
+
+    /***************
+      Cancel dialogs 
+     ***************/
+  
+    /* Reset requested? */
+    if (isset($_POST['edit_cancel'])){
+      if (isset($this->conftab)){
+        del_lock ($this->conftab->dn);
+        unset ($this->conftab);
+      }
+      $this->conftab= NULL;
+      $this->lognames= array();;
+      $this->cn= "";
+      unset ($_SESSION['objectinfo']);
+    }
+
+
+    /********************
+      Copy & Paste Handling  ...
+     ********************/
+
+    /* Display the copy & paste dialog, if it is currently open */
+    $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
+    if($ret){
+      return($ret);
+    }
+
+
+    /********************
+      Delete MULTIPLE entries requested, display confirm dialog
+     ********************/
+
+    if ($s_action=="del_multiple"){
+      $ids = $this->list_get_selected_items();
+
+      if(count($ids)){
+
+        foreach($ids as $id){
+          $dn = $this->conferences[$id]['dn'];
+          if (($user= get_lock($dn)) != ""){
+            return(gen_locked_message ($user, $dn));
+          }
+          $this->dns[$id] = $dn;
+        }
+
+        $dns_names = "<br><pre>";
+        foreach($this->dns as $dn){
+          add_lock ($dn, $this->ui->dn);
+          $dns_names .= $dn."\n";
+        }
+        $dns_names .="</pre>";
+
+        /* Lock the current entry, so nobody will edit it during deletion */
+        $smarty->assign("info",     sprintf(_("You're about to delete the following user(s) %s"), @LDAP::fix($dns_names)));
+        $smarty->assign("multiple", true);
+        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+      }
+    }
+
+
+    /********************
+      Delete MULTIPLE entries confirmed
+     ********************/
+
+    /* Confirmation for deletion has been passed. Users should be deleted. */
+    if (isset($_POST['delete_multiple_conference_confirm'])){
+
+      /* Remove user by user and check acls before removeing them */
+      foreach($this->dns as $key => $dn){
+        $this->dn = $dn;
+        $acl = $this->ui->get_permissions($this->dn,"gofonconference/conference");
+        if(preg_match("/d/",$acl)){
+          $this->remove_from_parent();
+        } else {
+          print_red (_("You have no permission to remove this department."));
+        }
+        /* Remove lock file after successfull deletion */
+        del_lock ($dn);
+        unset($this->dns[$key]);
+      }
+    }
+
+
+    /********************
+      Delete MULTIPLE entries Canceled
+     ********************/
+
+    /* Remove lock */
+    if(isset($_POST['delete_multiple_conference_cancel'])){
+      foreach($this->dns as $key => $dn){
+        del_lock ($dn);
+        unset($this->dns[$key]);
+      }
+    }
+
+
+    /***************
+      Delete 
+     ***************/
+  
+    /* Delete Entry if Posted action (s_action) == del
+     * The entry which will be deleted is defined in $s_entry
+     */
+    if ($s_action =="del"){
+
+      $acl = $this->ui->get_permissions($this->conferences[$s_entry]['dn'],"gofonconference/conference"); 
+      if(preg_match("/d/",$acl)){
+        $this->dn= $this->conferences[$s_entry]['dn'];
+
+        /* Check locking */
+        if (($conf= get_lock($this->dn)) != ""){
+          $_SESSION['dn']= $this->dn;
+          return(gen_locked_message($conf, $this->dn));
+        } else {
+          add_lock ($this->dn, $this->ui->dn);
+          $smarty->assign("info", sprintf(_("You're about to delete the whole LDAP subtree placed under '%s'."), $this->dn));
+          $smarty->assign("multiple", false);
+          $display.= $smarty->fetch (get_template_path('remove.tpl', TRUE));
+          return ($display);
+        }
+      }
+    }
+
+
+    /***************
+      Delete confirmed  
+     ***************/
+  
+    /* If department deletion is accepted ...
+     * Finally delete department
+     */
+    if (isset($_POST['delete_department_confirm'])){
+      $acl = $this->ui->get_permissions($this->dn,"gofonconference/conference"); 
+      if(preg_match("/d/",$acl)){
+        $this->remove_from_parent();
+      } else {
+        print_red (_("You have no permission to remove this department."));
+      }
+    }
+
+
+    /***************
+      Edit
+     ***************/
+  
+    /* Edit Entry if Posted action (s_action) == edit
+     * The entry which will be edited is defined in $s_entry
+     */
+    if (($s_action=="edit") && (!isset($this->conftab->config))){
+
+      $this->dn= $this->conferences[$s_entry]['dn'];
+
+      if (($conf= get_lock($this->dn)) != ""){
+        return(gen_locked_message ($conf, $this->dn));
+      }
+
+      /* Lock the current entry, so everyone will get the  above dialog */
+      add_lock ($this->dn, $this->ui->dn);
+
+      /* Register conftab to trigger edit dialog */
+      $this->conftab= new conferencetabs($this->config,$this->config->data['TABS']['CONFERENCETABS'], $this->dn,"gofonconference");
+      $this->conftab->set_acl_base($this->dn);
+      $_SESSION['objectinfo']= $this->dn;
+    }
+
+
+    /***************
+      Create new  
+     ***************/
+  
+    /* Insert new entry*/    
+    if($s_action == "new" ){
+
+      $dummy_dn = "cn=dummy,ou=conferences,ou=asterisk,ou=configs,ou=systems,".$this->DivListConference->selectedBase;      
+      $acl = $this->ui->get_permissions($dummy_dn,"gofonconference/conference"); 
+      if(preg_match("/c/",$acl)){
+        /* Set up the users ACL's for this 'dn' */
+        $this->dn= "new";
+        $this->conftab= new conferencetabs($this->config,$this->config->data['TABS']['CONFERENCETABS'], $this->dn,"gofonconference");
+        $this->conftab->set_acl_base($dummy_dn);
+        unset($_SESSION['objectinfo']);
+      }
+    }
+
+
+    /***************
+      Save entry  
+     ***************/
+  
+    /* Edit finished, check and save changes */
+    if ((isset($_POST['edit_finish']) || isset($_POST['edit_apply'])) && (isset($this->conftab->config))){
+      /* Check tabs, will feed message array */
+      $this->conftab->last= $this->conftab->current;
+      $this->conftab->save_object();
+      $message= $this->conftab->check();
+
+      if (count($message) == 0){
+        if($this->conftab->save() == 1){
+          gosa_log ("goFonConference object '".$this->dn."' saving failed.");
+          return;
+        }
+        gosa_log ("goFonConference object '".$this->dn."' has been saved");
+
+        if (!isset($_POST['edit_apply'])){
+          if ($this->dn != "new"){
+            del_lock ($this->dn);
+          }
+        }
+
+        del_lock ($this->conftab->dn);;
+        unset ($this->conftab);
+        $this->conftab= NULL;
+        unset ($_SESSION['objectinfo']);
+      } else {
+        show_errors($message);
+      }
+    }
+
+
+    /***************
+      Display dialogs   
+     ***************/
+  
+    /* if edit or new, show dialog */
+    if(($this->conftab) && (isset($this->conftab->config))){
+      $display= $this->conftab->execute();
+
+      /* Don't show buttons if tab dialog requests this */
+      if (!$this->conftab->by_object[$this->conftab->current]->dialog){
+        $display.= "<p style=\"text-align:right\">\n";
+        $display.= "<input type=\"submit\" name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
+        $display.= "&nbsp;\n";
+        if ($this->dn != "new"){
+          $display.= "<input type=submit name=\"edit_apply\" value=\""._("Apply")."\">\n";
+          $display.= "&nbsp;\n";
+        }
+        $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+        $display.= "</p>";
+      }
+      return ($display);
+    }
+
+
+    /***************
+      display divlist
+     ***************/
+
+    /* Check if there is a snapshot dialog open */
+    $base = $this->DivListConference->selectedBase;
+    if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases())){
+      return($str);
+    }
+
+    /* Return rendered main page */
+    /* Display dialog with system list */
+    $this->DivListConference->parent = $this;
+    $this->DivListConference->execute();
+
+    /* Add departments if subsearch is disabled */
+    if(!$this->DivListConference->SubSearch){
+      $this->DivListConference->AddDepartments($this->DivListConference->selectedBase,5,1);
+    }
+    $this->reload();
+    $this->DivListConference->setEntries($this->conferences);
+    return($this->DivListConference->Draw());
+  }
+
+
+  /* Return departments, that will be included within snapshot detection */
+  function get_used_snapshot_bases()
+  {
+    return(array("ou=conferences,ou=asterisk,ou=configs,ou=systems,".$this->DivListConference->selectedBase));
+  }
+
+
+  /* Reload entries for divlist.
+   * reload all conferences for the current base, with the given regex
+   */
+  function reload()
+  {
+    $Base             = "ou=conferences,ou=asterisk,ou=configs,ou=systems,".$this->DivListConference->selectedBase;
+    $SubSearch        = $this->DivListConference->SubSearch;
+    $Regex            = $this->DivListConference->Regex;
+    $Flags            = GL_SIZELIMIT ; 
+    $Filter           = "(&(|(cn=".$Regex.")(description=".$Regex."))(objectClass=goFonConference))";
+    $Attrs            = array("cn","goFonConferenceOwner","goFonPIN","telephoneNumber");
+    if($SubSearch){
+      $Flags |= GL_SUBSEARCH;
+    }
+
+    $this->conferences= get_list($Filter, "gofonconference", $Base, $Attrs, $Flags);
+  }
+
+  function remove_from_parent()
+  {
+    /* Ehm what are we doinf here ? */
+  
+    $cfg = new conference($this->config, $this->dn);
+    $cfg->set_acl_category("gofonconference");
+    $cfg->set_acl_base($this->dn);
+
+    $cfg->remove_from_parent();
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd ($this->dn);
+    $ldap->recursive_remove();
+
+    /* Optionally execute a command after we're done */
+    $this->postremove();
+
+    /* Delete references to object groups */
+    $ldap->cd ($this->config->current['BASE']);
+    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
+    while ($ldap->fetch()){
+      $og= new conftab($this->config, $ldap->getDN());
+      unset($og->member[$this->dn]);
+      $og->save ();
+    }
+
+  }
+
+
+  function copyPasteHandling_from_queue($s_action,$s_entry)
+  {
+    /* Check if Copy & Paste is disabled */
+    if(!is_object($this->CopyPasteHandler)){
+      return("");
+    }
+
+    /* Add a single entry to queue */
+    if($s_action == "cut" || $s_action == "copy"){
+
+      /* Cleanup object queue */
+      $this->CopyPasteHandler->cleanup_queue();
+      $dn = $this->conferences[$s_entry]['dn'];
+      $this->CopyPasteHandler->add_to_queue($dn,$s_action,"conferencetabs","CONFERENCETABS","gofonconference");
+    }
+
+    /* Add entries to queue */
+    if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
+
+      /* Cleanup object queue */
+      $this->CopyPasteHandler->cleanup_queue();
+
+      /* Add new entries to CP queue */
+      foreach($this->list_get_selected_items() as $id){
+        $dn = $this->conferences[$id]['dn'];
+
+        if($s_action == "copy_multiple"){
+          $this->CopyPasteHandler->add_to_queue($dn,"copy","conferencetabs","CONFERENCETABS","gofonconference");
+        }
+        if($s_action == "cut_multiple"){
+          $this->CopyPasteHandler->add_to_queue($dn,"cut","conferencetabs","CONFERENCETABS","gofonconference");
+        }
+      }
+    }
+
+    /* Start pasting entries */
+    if($s_action == "editPaste"){
+      $this->start_pasting_copied_objects = TRUE;
+    }
+    /* Return C&P dialog */
+    if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
+
+      /* Load entry from queue and set base */
+      $this->CopyPasteHandler->load_entry_from_queue();
+      $this->CopyPasteHandler->SetVar("base",$this->DivListConference->selectedBase);
+
+      /* Get dialog */
+      $data = $this->CopyPasteHandler->execute();
+
+      /* Return dialog data */
+      if(!empty($data)){
+        return($data);
+      }
+    }
+
+    /* Automatically disable status for pasting */
+    if(!$this->CopyPasteHandler->entries_queued()){
+      $this->start_pasting_copied_objects = FALSE;
+    }
+    return("");
+  }
+
+
+  function save_object()
+  {
+    $this->DivListConference->save_object();
+  }
+
+  function remove_lock()
+  {
+    if (isset($this->dn)){
+      del_lock ($this->dn);
+    }
+  }
+
+
+  function list_get_selected_items()
+  {
+    $ids = array();
+    foreach($_POST as $name => $value){
+      if(preg_match("/^item_selected_[0-9]*$/",$name)){
+        $id   = preg_replace("/^item_selected_/","",$name);
+        $ids[$id] = $id;
+      }
+    }
+    return($ids);
+  }
+
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/gofon/conference/generic.tpl b/gosa-core/plugins/gofon/conference/generic.tpl
new file mode 100644 (file)
index 0000000..63938a4
--- /dev/null
@@ -0,0 +1,249 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
+  <tr>
+    <td colspan=3>
+      <h2 style='margin:0px; padding:0px;'><img class="center" alt="" align="middle" src="images/rightarrow.png"> 
+        {t}Properties{/t}
+      </h2>
+    </td>
+  </tr>
+  <tr>
+    <td style="vertical-align:top">
+       <table summary="">
+        <tr>
+          <td>
+            <LABEL for="cn">
+              {t}Conference name{/t}
+            </LABEL>
+            {$must}
+          </td>
+          <td>
+{render acl=$cnACL}
+            <input id="cn" name="cn" size=25 maxlength=60 value="{$cn}" title="{t}Name of conference to create{/t}">
+{/render}
+          </td>
+        </tr>
+        <tr>
+          <td>
+            <LABEL for="goFonConferenceOption_D">
+              {t}Type{/t}
+            </LABEL>
+            {$must}
+          </td>
+          <td>
+{render acl=$goFonConferenceOptionDACL}
+            <select id="goFonConferenceOption_D" size="1" name="goFonConferenceOption_D" 
+              title="{t}Choose subtree to place conference in{/t}"> 
+              {html_options options=$goFonConferenceOptions selected=$goFonConferenceOption_D}
+            </select>
+{/render} 
+          </td>
+        </tr>
+        <tr>
+          <td colspan="2">
+            <br>
+          </td>
+        </tr>
+        <tr>
+          <td>
+            <LABEL for="base">
+              {t}Base{/t}
+            </LABEL>
+            {$must}
+          </td>
+          <td>
+
+{render acl=$baseACL}
+            <select id="base" size="1" name="base" title="{t}Select a base{/t}">
+              {html_options options=$bases selected=$base_select}
+            </select>
+{/render}
+
+{render acl=$baseACL disable_picture='images/folder_gray.png'}
+            <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
+{/render}
+
+          </td>
+        </tr>
+        <tr>
+          <td><LABEL for="goFonHomeServer">{t}Home server{/t}</LABEL>{$must}</td>
+          <td>
+{render acl=$goFonHomeServerACL}
+                <select name='goFonHomeServer'>
+                 {html_options options=$goFonHomeServers selected=$goFonHomeServer}
+                </select>
+{/render}
+          </td>
+        </tr>
+        <tr>
+          <td>{t}Language{/t}
+          </td>
+          <td>
+            <select name="language" title="{t}Select language{/t}">
+              {html_options options=$languages selected=$language}
+            </select>
+          </td>
+        </tr>
+      </table>
+    </td>
+    <td style="border-left:1px solid #A0A0A0">
+      &nbsp;
+    </td>
+    <td width="50%">
+      <table summary="">
+        <tr>
+          <td>
+            <LABEL for="description">
+              {t}Description{/t}
+            </LABEL>
+          </td>
+          <td>
+{render acl=$descriptionACL}
+            <input id="description" name="description" size=40 maxlength=80  
+              value="{$description}" title="{t}Descriptive text for department{/t}">
+{/render} 
+          </td>
+        </tr>
+        <tr>
+          <td>
+            {t}Lifetime (in days){/t}
+          </td>
+          <td>
+{render acl=$goFonConferenceOptionLifetimeACL}
+            <input name="goFonConferenceOptionLifetime" size=15 value="{$goFonConferenceOptionLifetime}">
+{/render} 
+          </td>
+        </tr>
+        <tr>
+          <td>
+            {t}Phone number{/t}
+            {$must}
+          </td>
+          <td>
+{render acl=$telephoneNumberACL}
+            <input name="telephoneNumber" value="{$telephoneNumber}" size=15>
+{/render} 
+          </td>
+        </tr>
+      </table>
+
+    </td>
+  </tr>
+  <tr>
+    <td colspan=3 style='width:100%;'>
+      <p class='seperator'>&nbsp;</p>
+    </td>
+  </tr>
+  <tr>
+    <td colspan=3>
+      <h2 style='margin:0px; padding:0px;'><img class="center" alt="" align="middle" src="images/select_ogroup.png"> 
+        {t}Options{/t}
+      </h2>
+    </td>
+  </tr>
+  <tr>
+    <td>
+
+           <table summary="">
+        <tr>
+               <td>
+{render acl=$goFonConferenceOptionPACL}
+                       <input type="checkbox" onclick="changeState('goFonPIN');" name="goFonConferenceOption_P" 
+                                           value="P" {$goFonConferenceOption_PCHK}> 
+{/render} 
+               </td>
+          <td>
+                       {t}Preset PIN{/t}
+               </td>
+             </tr>
+             <tr>
+               <td>
+                 &nbsp;
+               </td>
+               <td>
+                       {t}PIN{/t} 
+{render acl=$goFonPINACL}
+            <input type='password' name="goFonPIN" id="goFonPIN" value="{$goFonPIN}" title="{$goFonPIN}">
+{/render} 
+               </td>
+             </tr>
+        <tr>
+               <td colspan=2>
+{render acl=$goFonConferenceOptionrACL}
+                       <input type="checkbox" onclick="changeState('goFonConferenceOptionFormat');" name="goFonConferenceOption_r" 
+              value="r" {$goFonConferenceOption_rCHK}> 
+{/render} 
+             {t}Record conference{/t}
+               </td>
+             </tr>
+             <tr>
+               <td>
+                 &nbsp;
+               </td>
+               <td>
+                 {t}Sound file format{/t}&nbsp;
+{render acl=$goFonConferenceOptionFormatACL}
+                 <select id="goFonConferenceOptionFormat" size="1" name="goFonConferenceOptionFormat" 
+              title="{t}Choose subtree to place department in{/t}"> 
+                   {html_options options=$goFonConferenceOptionFormats selected=$goFonConferenceOptionFormat}
+               </select>
+{/render} 
+               </td>
+             </tr>
+           </table>
+
+    </td>
+    <td style="border-left:1px solid #A0A0A0">
+      &nbsp;
+         </td>
+    <td>
+
+      <table summary="">
+        <tr>
+          <td>
+{render acl=$goFonConferenceOptionMACL}
+            <input type="checkbox" name="goFonConferenceOption_M" value="M" {$goFonConferenceOption_MCHK}> 
+{/render} 
+            {t}Play music on hold{/t}
+          </td>
+        </tr>
+        <tr>
+          <td>
+{render acl=$goFonConferenceOptionsACL}
+            <input type="checkbox" name="goFonConferenceOption_s" value="s" {$goFonConferenceOption_sCHK}> 
+{/render} 
+            {t}Activate session menu{/t}
+          </td>
+        </tr>
+        <tr>
+          <td>
+{render acl=$goFonConferenceOptioniACL}
+            <input type="checkbox" name="goFonConferenceOption_i" value="i" {$goFonConferenceOption_iCHK}> 
+{/render} 
+            {t}Announce users joining or leaving the conference{/t}
+         </td>
+        </tr>
+        <tr>
+          <td>
+{render acl=$goFonConferenceOptioncACL}
+            <input type="checkbox" name="goFonConferenceOption_c" value="c" {$goFonConferenceOption_cCHK}>
+{/render} 
+            {t}Count users{/t}
+          </td>
+        </tr>
+      </table>
+
+    </td>
+  </tr>
+</table>
+
+<input type='hidden' name='phoneConferenceGeneric' value='1'>
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('cn');
+  -->
+</script>
+<!-- 
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: 
+-->
diff --git a/gosa-core/plugins/gofon/conference/headpage.tpl b/gosa-core/plugins/gofon/conference/headpage.tpl
new file mode 100644 (file)
index 0000000..5b5a95a
--- /dev/null
@@ -0,0 +1,45 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
+<tr>
+  <td style="vertical-align:top;width:600px">
+  <div class="contentboxh">
+    <p class="contentboxh">
+     {t}List of conference rooms{/t} {$hint}
+    </p>
+  </div>
+  <div class="contentboxb">
+      {$conferencehead}
+  </div>
+  <div style='height:4px;'></div>
+  <div class="contentboxb" style="border-top:1px solid #B0B0B0;">
+      {$conferences}
+    <input type=hidden name="edit_helper">
+  </div>
+  </td>
+  <td style="vertical-align:top;">
+   <div class="contentboxh" style="border-bottom:1px solid #B0B0B0;">
+    <p class="contentboxh"><img src="{$infoimage}" align="right" alt="[i]">{t}Information{/t}</p>
+   </div>
+   <div class="contentboxb">
+   <p class="contentboxb">
+     {t}This menu allows you to create, delete and edit selected phone conferences. Having a large number of phone conferences, you might prefer the range selectors on top of the conferences list.{/t}
+   </p>
+   </div>
+   <br>
+   <div class="contentboxh">
+    <p class="contentboxh"><img src="{$launchimage}" align="right" alt="[F]">{t}Filters{/t}</p>
+   </div>
+   <div class="contentboxb">
+     <table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
+      {$alphabet}
+     </table>
+    <table summary="" width="100%" style="border-top:1px solid #B0B0B0;"><tr><td><LABEL for='filter'><img class="center" alt="Search" src="{$search_image}" align="middle" title="{t}Display users matching{/t}"></LABEL></td>
+    <td width="99%"><input id='filter' style='width:99%' type='text' name='regexit' maxlength='20' value='{$regex}' title='{t}Regular expression for        matching user names{/t}' onChange="mainform.submit()"></td></tr></table>
+   {$apply}
+   </div>
+
+
+  </td>
+</tr>
+</table summary="">
+
+<input type="hidden" name="ignore">
diff --git a/gosa-core/plugins/gofon/conference/main.inc b/gosa-core/plugins/gofon/conference/main.inc
new file mode 100644 (file)
index 0000000..d75fc78
--- /dev/null
@@ -0,0 +1,56 @@
+<?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
+*/
+
+if ($remove_lock){
+        if(isset($_SESSION['conference'])){
+                $conference= $_SESSION['conference'];
+                $conference->remove_lock();
+                del_lock ($ui->dn);
+                sess_del ('conference');
+        }
+} else {
+       /* Create usermanagement object on demand */
+       if (!isset($_SESSION['conference']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+               $_SESSION['conference']= new phoneConferenceManagment($config, $ui);
+       }
+       $conference= $_SESSION['conference'];
+       $conference->save_object();
+       $output= $conference->execute();
+
+       /* Page header*/
+       if (isset($_SESSION['objectinfo'])){
+               $display= print_header(get_template_path('images/conference.png'), _("Conference management"), "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".@LDAP::fix($_SESSION['objectinfo']));
+       } else {
+               $display= print_header(get_template_path('images/conference.png'), _("Conference management"));
+       }
+
+       /* Reset requested? */
+       if (isset($_GET['reset']) && $_GET['reset'] == 1){
+               del_lock ($ui->dn);
+               sess_del ('conference');
+       }
+
+       /* Show and save dialog */
+       $conference->save_object();
+       $display.= $output;
+       $_SESSION['conference']= $conference;
+}
+
+?>
diff --git a/gosa-core/plugins/gofon/conference/paste_generic.tpl b/gosa-core/plugins/gofon/conference/paste_generic.tpl
new file mode 100644 (file)
index 0000000..fa72f3f
--- /dev/null
@@ -0,0 +1,23 @@
+<table summary="">
+       <tr>
+               <td>
+                       <LABEL for="cn">
+                               {t}Conference name{/t}
+                       </LABEL>
+                       {$must}
+               </td>
+               <td>
+                       <input id="cn" name="cn" size=25 maxlength=60 value="{$cn}" title="{t}Name of conference to create{/t}">
+               </td>
+       </tr>
+       <tr>
+               <td>
+                       {t}Phone number{/t}
+                       {$must}
+               </td>
+               <td>
+                       <input name="telephoneNumber" value="{$telephoneNumber}" size=15>
+               </td>
+       </tr>
+</table>
+
diff --git a/gosa-core/plugins/gofon/conference/remove.tpl b/gosa-core/plugins/gofon/conference/remove.tpl
new file mode 100644 (file)
index 0000000..970abd4
--- /dev/null
@@ -0,0 +1,24 @@
+<div style="font-size:18px;">
+ <img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
+</div>
+ {$info}
+<p>
+ {t}This includes 'all' accounts, systems, etc. in this subtree. 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">
+{if $multiple}
+       <input type=submit name="delete_multiple_conference_confirm" value="{t}Delete{/t}">
+       &nbsp;
+       <input type=submit name="delete_multiple_conference_cancel" value="{t}Cancel{/t}">
+{else}
+       <input type=submit name="delete_department_confirm" value="{t}Delete{/t}">
+       &nbsp;
+       <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
+{/if}
+</p>
+
diff --git a/gosa-core/plugins/gofon/conference/tabs_conference.inc b/gosa-core/plugins/gofon/conference/tabs_conference.inc
new file mode 100644 (file)
index 0000000..5b58065
--- /dev/null
@@ -0,0 +1,41 @@
+<?php
+
+class conferencetabs extends tabs
+{
+  var $base= "";
+
+  function conferencetabs($config, $data, $dn, $category)
+  {
+         tabs::tabs($config, $data, $dn,$category);
+         $this->base= $this->by_object['conference']->base; 
+
+    /* Add references/acls/snapshots */
+    $this->addSpecialTabs();
+  }
+
+  function check($ignore_account= FALSE)
+  {
+       return (tabs::check(TRUE));
+  }
+  
+
+  function save($ignore_account= FALSE)
+  {
+       $baseobject= $this->by_object['conference'];
+       $new_dn= 'cn='.$baseobject->cn.',ou=conferences,ou=asterisk,ou=configs,ou=systems,'.$baseobject->base;
+
+       if(strtolower($this->dn)==strtolower($new_dn)){
+               $this->dn=$new_dn;
+       }
+
+       if($this->dn != $new_dn){
+               $baseobject->recursive_move($this->dn, $new_dn);
+       }
+       $this->dn= $new_dn;
+
+       tabs::save(TRUE);
+  }
+
+}
+
+?>
diff --git a/gosa-core/plugins/gofon/fonreports/class_fonreport.inc b/gosa-core/plugins/gofon/fonreports/class_fonreport.inc
new file mode 100644 (file)
index 0000000..a63a78f
--- /dev/null
@@ -0,0 +1,415 @@
+<?php
+
+class fonreport extends plugin
+{
+  /* Definitions */
+  var $plHeadline= "Phone Reports";
+  var $plDescription= "This does something";
+
+  /* For internal use */
+  var $start                             = 0;
+  var $search_for                = "*";
+  var $search_base       = "";
+  var $fields                            = array("calldate", "src", "dst", "channel", "lastapp", "disposition", "duration");
+  var $year                                      = "";
+  var $month                             = "";
+  var $sort                                      = 0;
+  var $sort_direction  = "down";
+  var $report_list             = array();
+  var $userfilter                      = "";
+  var $ui                                          = NULL;
+  var $range                             = 20;
+  var $EntryPerPage   = 20;
+
+  /* attribute list for save action */
+  var $attributes_SO  = array("start","search_for","search_base","range","month","sort_direction","sort","year");
+  var $objectclasses  = array();
+  var $view_logged = FALSE;
+  
+  /* Construct class */
+  function fonreport (&$config, $ui)
+  {
+    /* Include config object */
+    $this->config                      = $config;
+    $this->ui                            = $ui;
+    $this->search_base= get_base_from_people($ui->dn);
+  
+    $this->month      = date("m");
+    $this->year       = date("Y");
+
+    /* Use filter settings if we have already searched */
+    if (!is_global("fonfilter")){
+      $fonfilter = array();
+      foreach($this->attributes_SO as $name){
+        $fonfilter[$name]=$this->$name;
+      }
+      register_global("fonfilter", $fonfilter);
+    }else{
+      $fonfilter = get_global("fonfilter");
+      foreach($this->attributes_SO as $name){
+        $this->$name = $fonfilter[$name];
+      }
+    }
+  }
+
+
+  /* Save ui interactions and store results in session, 
+      to remember settings */
+  function save_object()
+  {
+    $fonfilter= get_global("fonfilter");
+    if(isset($_POST['EntryPerPage'])){
+      $this->range = $_POST['EntryPerPage'];
+    }
+    if (isset($_GET['start'])){
+      $this->start= (int)$_GET['start'];
+    }
+    foreach( array("year", "month", "search_for", "search_base") as $type){
+      if (isset($_POST[$type])){
+        $this->$type= $_POST[$type];
+      }
+    }
+    
+    /* Adapt sorting */
+    if (isset($_GET['sort'])){
+      if ($this->sort == (int)$_GET['sort']){
+        if ($this->sort_direction == "down"){
+          $this->sort_direction= "up";
+        } else {
+          $this->sort_direction= "down";
+        }
+      }
+      $this->sort= (int)$_GET['sort'];
+      if ($this->sort < 0 || $this->sort > 6){
+        $this->sort= 0;
+      }
+    }
+
+    /* remove unwanted tags */
+    $this->search_for = stripslashes(preg_replace("/[^0-9a-z\*\+ \-]/i","",$this->search_for));
+  
+    foreach($this->attributes_SO as $name){
+      $fonfilter[$name] = $this->$name;
+    }
+    register_global("fonfilter", $fonfilter);
+  }
+
+
+  /* Search & display results */
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* GVet template engine */
+    $smarty= get_smarty();
+
+    /* Log view */
+    if(!$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","gofon/".get_class($this),$this->dn);
+    }
+
+    /*****************
+      Variable Init
+     *****************/
+
+    $fields_str = "";
+
+    $months= array();
+    for($i = 1 ; $i <= 12 ; $i ++ ){
+      $months[$i] = _(date("F",gmmktime(0,0,0,$i)));
+    }
+
+    /* Prepare template */
+    $current= date("Y");
+    $years= array();
+    for ($y= $current - 5; $y<=$current; $y++){
+      $years[$y]= $y;
+    }
+
+    /*****************
+      Smarty 
+     *****************/
+    $bases      = array();
+    $cat_bases  = $this->ui->get_module_departments("gofon");
+    foreach($this->config->idepartments as $dn => $name){
+      if(in_array_ics($dn,$cat_bases)){
+        $bases[$dn] = $name;
+      }
+    }
+
+    if(!isset($bases[$this->search_base])){
+      $this->search_base = key($bases);
+    }
+
+    $smarty->assign("plug",           "?plug=".validate($_GET['plug']));
+    $smarty->assign("launchimage",    get_template_path('images/launch.png'));
+    $smarty->assign("search_image",   get_template_path('images/search.png'));
+    $smarty->assign("search_for",     $this->search_for);
+    $smarty->assign("bases",          $bases);
+    $smarty->assign("base_select",    $this->search_base);
+    $smarty->assign("months",         $months);
+    $smarty->assign("month_select",   $this->month);
+    $smarty->assign("years",          $years);
+    $smarty->assign("year_select",    $this->year);
+    $smarty->assign("search_result",  "");
+
+
+    /*****************
+      Check Database , Table , Connection 
+     *****************/
+
+    /* Connecting, selecting database */
+    if (!isset($this->config->data['SERVERS']['FON'][0])){
+      print_red(_("Can't connect to phone database, no reports can be shown!"));
+      return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
+    }elseif(!is_callable("mysql_connect")){
+      print_red(_("There is no mysql extension available, please check your php setup."));
+      return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
+    }else{
+
+      $cfg= $this->config->data['SERVERS']['FON'][0];
+      $link = @mysql_pconnect($cfg['SERVER'], $cfg['LOGIN'], $cfg['PASSWORD']);
+      if ($link === FALSE){
+        print_red(_("Can't connect to phone database, no reports can be shown!"));
+        return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
+      }
+      if (! @mysql_select_db("gophone")){
+        print_red(_("Can't select phone database for report generation!"));
+        return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
+      }
+    }
+
+
+    /*****************
+      Get Query String && Search
+     *****************/
+
+    $query  = $this->CreateQuerySyntax();
+    $cfg    = $this->config->data['SERVERS']['FON'][0];
+    $link   = @mysql_pconnect($cfg['SERVER'], $cfg['LOGIN'], $cfg['PASSWORD']);
+
+    @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query, "Database query");
+
+    $result = @mysql_query($query);
+    if ($result === false){
+      print_red(_("Query for phone database failed!"));
+      return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
+    }
+
+    /*****************
+      Fetch results 
+     *****************/
+  
+    $report_list= array();
+    
+    /* Restricted attributes will not be displayed, this will be displayed instead */
+    $no_acl = "<img class='center' src='images/closedlock.png'
+      title='"._("Insufficient permissions to view this attribute")."' alt='"._("Insufficient permissions")."'>";
+
+    $no_acl = "&nbsp;";
+
+    while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
+
+      foreach($line as $attr => $value){
+
+        if($attr == "duration") continue;
+  
+        $acl = $this->ui->get_permissions($this->search_base,"gofon/fonreport",$attr);
+        if(!preg_match("/r/",$acl)){
+          $line[$attr] = $no_acl;
+        }
+      }
+
+      if($this->ui->get_permissions($this->search_base,"gofon/fonreport","calldate")){
+        $hour=  substr($line["calldate"], 11, 2);
+        $minute=substr($line["calldate"], 14, 2);
+        $format= _("Y-M-D");
+        $date= preg_replace("/Y/", substr($line["calldate"], 0, 4), $format);
+        $date= preg_replace("/M/", substr($line["calldate"], 5, 2), $date);
+        $date= preg_replace("/D/", substr($line["calldate"], 8, 2), $date);
+        $date_str = $date." ".$hour.":".$minute;
+      }else{
+        $date_str = $no_acl;
+      }
+  
+      $append_str = "";
+      $append_str .=   "<td>".$date_str."</td>";
+
+      foreach(array("src","dst","channel","lastapp","disposition") as $atr){
+        if(isset($line[$atr])){
+          $append_str .=       "<td>".$line[$atr]."</td>";
+        }
+      }
+
+      if($this->ui->get_permissions($this->search_base,"gofon/fonreport","duration")){
+        $append_str .=         "<td>".$this->gen_duration($line["duration"])."</td>";
+      }else{
+        $append_str .=         "<td>".$no_acl."</td>";
+      }
+      $report_list[] = $append_str;
+    }
+
+    $this->report_list= $report_list;
+    @mysql_close($link);
+
+
+    /*****************
+      Create list of results  
+     *****************/
+
+    /* Generate output */
+    $mod      = 0;
+    $output   = "";
+    if(count($this->report_list) < $this->start){
+      $this->start = 0;
+    }
+    foreach($this->report_list as $val){
+      if ($mod < $this->start) {
+        $mod++;
+        continue;
+      }
+      if ($mod >= ($this->start + $this->range)){
+        $mod++;
+        break;
+      }
+      if ( ($mod++) & 1){
+        $col= "background-color: #ECECEC;";
+      } else {
+        $col= "background-color: #F5F5F5;";
+      }
+      $output.= "<tr style=\"height:22px; $col\">$val</tr>";
+    }
+
+    /*****************
+      Tell smarty what we have found  
+     *****************/
+
+    if ($output != ""){
+      $smarty->assign("search_result", $output);
+      $smarty->assign("range_selector", range_selector(count($this->report_list), $this->start,$this->range,"EntryPerPage"));
+    } else {
+      $smarty->assign("search_result", "");
+    }
+
+    /* Show main page */
+    for($i= 0; $i<7; $i++){
+      $smarty->assign("mode$i", "");
+    }
+    $smarty->assign("mode".$this->sort, "<img alt=\"\" src=\"images/sort_".$this->sort_direction.".png\" border=0 align=middle>");
+
+    return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
+  }
+
+  
+  /* Create duration string   12'11" */
+  function gen_duration($seconds)
+  {
+    if ($seconds / 60 > 1){
+      $minutes= (int)($seconds / 60);
+      $seconds= $seconds % 60;
+      return ("$minutes&rsquo;$seconds&rdquo;");
+    }
+    return ("$seconds&rdquo;");
+  }
+
+
+  /* Create WHERE part for our mysql serach */
+  function GetUidMatchingFilter()
+  {
+    $ldap       = $this->config->get_ldap_link();
+    $ldap->cd     ($this->search_base);
+    $s          = $this->search_for;
+
+    $s          = preg_replace("/\%/","",$s);  
+    $s2         = preg_replace("/\*/","%",$s);  
+
+    $filter = "(&(objectClass=gosaAccount)(!(objectClass=gosaUserTemplate))".
+        "(|(uid=$s)(l=$s)(homePhone=$s)(telephoneNumber=$s)(facsimileTelephoneNumber=$s)(mobile=$s)".
+        "(pager=$s)(cn=$s)(givenName=$s)(sn=$s)(personalTitle=$s)(title=$s)))";
+
+    $attrs  = array("uid");
+    $res    = get_list($filter,"users",$this->search_base,$attrs);
+    
+    $str = " AND (";
+    $fields = array("dstchannel","channel");
+    if(count($res)){
+      foreach($res as $attrs){
+        $uid =  $attrs["uid"][0];
+        foreach($fields as $name){
+          $str .= $name." like '%".$uid."%' OR ";
+        }
+      }
+    }
+    $str .= " channel     like '%".$s."%' OR  
+              dstchannel  like '%".$s."%' OR  
+              dst         like '".$s2."' OR 
+              src         like '".$s2."' OR 
+              lastapp     like '".$s2."')"; 
+    return($str);
+  }
+
+
+  /* Create query string */
+  function CreateQuerySyntax()
+  {
+    /* Get extended search filter which contain uids and so on */
+    $uidstring = $this->GetUidMatchingFilter();
+
+    /* Create string with all fields seperated by ,*/
+    $fields_str ="";
+    foreach($this->fields as $field){
+      if($field == "calldate") {
+        continue;      
+      }
+      $fields_str .= $field.", ";
+    }
+    $fields_str = preg_replace("/, $/","",$fields_str);
+
+    /* Create Sort tag */
+    if ($this->sort_direction == "down"){
+      $desc= "DESC";
+    } else {
+      $desc= "ASC";
+    }
+    /* Create times */
+    $start= date ("YmdHis", mktime(0,0,0,$this->month,1,$this->year));
+    $end=   date ("YmdHis", mktime(23,59,59,($this->month +1),0,$this->year));
+    $query = "SELECT ".$fields_str.",calldate FROM cdr ".
+      "WHERE   
+      calldate <= $end 
+      AND 
+      calldate >= $start 
+      ". $uidstring." 
+      ORDER BY ".$this->fields[$this->sort]." $desc;";
+    return($query);
+  }
+
+
+  /* Return plugin informations for acl handling 
+     #FIXME You can only read attributes within this report plugin */
+  static function plInfo()
+  {
+    return (array(
+        "plShortName"   => _("Phone reports"),
+        "plDescription" => _("Phone reports")."&nbsp;<i>"._("All entries are readonly")."</i>",
+        "plSelfModify"  => TRUE,
+        "plDepends"     => array(),
+        "plPriority"    => 0,
+        "plSection"     => array("administration"),
+        "plCategory"    => array("fonreport"),
+  
+        "plProvidedAcls" => array(
+          "calldate"      =>_("Date"), 
+          "src"           =>_("Source"), 
+          "dst"           =>_("Destination"), 
+          "channel"       =>_("Channel"), 
+          "lastapp"       =>_("Application called"),
+          "disposition"   =>_("Disposition"), 
+          "duration"      =>_("Duration"))
+        ));
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/gofon/fonreports/contents.tpl b/gosa-core/plugins/gofon/fonreports/contents.tpl
new file mode 100644 (file)
index 0000000..d8cf0a4
--- /dev/null
@@ -0,0 +1,59 @@
+<div class="contentboxh">
+ <p class="contentboxh"><img src="{$launchimage}" align="right" alt="[F]">{t}Filter{/t}</p>
+</div>
+<div class="contentboxb">
+ <p class="contentboxb" style="border-top:1px solid #B0B0B0; padding-top:5px;">
+ <img class="center" alt="" align="middle" border=0 src="{$search_image}">&nbsp;{t}Search for{/t}
+ <input name="search_for" size=25 maxlength=60 value="{$search_for}" title="{t}Enter user name to search for{/t}" onChange="mainform.submit()">
+ {t}in{/t}
+ <select size="1" name="search_base" title="{t}Select subtree to base search on{/t}" onChange="mainform.submit()">
+  {html_options options=$bases selected=$base_select}
+ </select>
+ {t}during{/t}
+ <select size="1" name="month" onChange="mainform.submit()">
+  {html_options options=$months selected=$month_select}
+ </select>
+ {t}in{/t} 
+ <select size="1" name="year" onChange="mainform.submit()">
+  {html_options values=$years output=$years selected=$year_select}
+ </select>
+ &nbsp;
+ <input type=submit name="search" value="{t}Search{/t}">
+</p>
+</div>
+
+<br>
+
+{if $search_result }
+ <table style="width:100%; vertical-align:top; text-align:left; border:1px solid #B0B0B0;" cellpadding=2 cellspacing=1 border=0 rules="cols" summary="">
+  <tr style="background-color: #E8E8E8; height:26px; font-weight:bold">
+   <td><a href="main.php{$plug}&amp;sort=0">{t}Date{/t} {$mode0}</a></td>
+   <td><a href="main.php{$plug}&amp;sort=1">{t}Source{/t} {$mode1}</a></td>
+   <td><a href="main.php{$plug}&amp;sort=2">{t}Destination{/t} {$mode2}</a></td>       
+   <td><a href="main.php{$plug}&amp;sort=3">{t}Channel{/t} {$mode3}</a></td>   
+   <td><a href="main.php{$plug}&amp;sort=4">{t}Application{/t} {$mode4}</a></td>       
+   <td><a href="main.php{$plug}&amp;sort=5">{t}Status{/t} {$mode5}</a></td>    
+   <td><a href="main.php{$plug}&amp;sort=6">{t}Duration{/t} {$mode6}</a></td>  
+  </tr>
+  {$search_result}
+ </table>
+
+ <table style="width:100%; vertical-align:top; text-align:center;" cellpadding=4 cellspacing=0 border=0 summary="">
+  <tr>
+   <td>{$range_selector}</td>
+  </tr>
+ </table>
+
+<p class="plugbottom">
+ &nbsp;
+</p>
+{else}
+  <b>{t}Search returned no results...{/t}</b>
+{/if}
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('search_for');
+  -->
+</script>
diff --git a/gosa-core/plugins/gofon/fonreports/main.inc b/gosa-core/plugins/gofon/fonreports/main.inc
new file mode 100644 (file)
index 0000000..5d1741d
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+
+if (!$remove_lock){
+       /* Create fonreport object on demand */
+       if (!isset($_SESSION['fonreport']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+               $_SESSION['fonreport']= new fonreport ($config, $ui);
+       }
+       $fonreport= $_SESSION['fonreport'];
+
+       /* Execute formular */
+       $fonreport->save_object();
+       $display= $fonreport->execute ();
+       $display.= "<input type=\"hidden\" name=\"ignore\">\n";
+
+       /* Page header*/
+       $display= print_header(get_template_path('images/phonereport.png'), _("Phone reports")).$display;
+
+       /* Store changes  in session */
+       $_SESSION['fonreport']= $fonreport;
+}
+?>
diff --git a/gosa-core/plugins/gofon/macro/class_divListMacros.inc b/gosa-core/plugins/gofon/macro/class_divListMacros.inc
new file mode 100755 (executable)
index 0000000..de822bb
--- /dev/null
@@ -0,0 +1,298 @@
+<?php
+
+class divListMacro extends MultiSelectWindow
+{
+
+  /* Current base */
+  var $selectedBase       = "";
+  var $departments        = array();
+
+  /* Regex */
+  var $Regex              = "*";
+
+  /* checkboxes */
+  var $ShowSendBocklists      ;
+  var $ShowReceiveMacros  ;
+
+  /* Subsearch checkbox */
+  var $SubSearch;
+
+  var $parent             ;
+  var $ui                 ;
+
+  function divListMacro (&$config,$parent)
+  {
+    MultiSelectWindow::MultiSelectWindow($config,"Macros", "gofonmacro");
+    
+    $this->parent       = $parent;
+    $this->ui           = get_userinfo();
+
+    /* Set list strings */
+    $this->SetTitle(_("List of macros"));
+    $this->SetSummary(_("List of macros"));
+
+    /* Result page will look like a headpage */
+    $this->SetHeadpageMode();
+    $this->SetInformation(_("This menu allows you to add, edit and remove selected macros. You may want to use the range selector on top of the macro listbox, when working with a large number of macros."));
+
+    $this->EnableAplhabet   (true);
+  
+    /* Disable buttonsm */
+    $this->EnableCloseButton(false);
+    $this->EnableSaveButton (false);
+
+    /* Dynamic action col, depending on snapshot icons */
+    $action_col_size = 100;
+    if($this->parent->snapshotEnabled()){
+      $action_col_size += 20;
+    }
+
+    /* Toggle all selected / deselected */
+    $chk = "<input type='checkbox' id='select_all' name='select_all'
+               onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
+
+    /* set Page header */
+    $this->AddHeader(array("string"=> $chk,          "attach"=>"style='width:20px;'"));
+    $this->AddHeader(array("string" => "&nbsp;", "attach" => "style='text-align:center;width:20px;'"));
+    $this->AddHeader(array("string" => _("Macro name")." / "._("Department"), "attach" => "style=''"));
+    $this->AddHeader(array("string" => _("Visible"), "attach" => "style='width:50px;'"));
+    $this->AddHeader(array("string" => _("Actions"), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'" ));
+
+    /* Add Checkboxes / SubSearch checkbox */
+    $this->AddCheckBox("SubSearch",  _("Select to search within subtrees"), _("Search in subtrees"), false);
+
+    /*                  Name                 ,Text                              ,Default  , Connect with alphabet  */
+    $this->AddRegex   ("Regex",     _("Regular expression for matching macro names"),"*" , true);
+  }
+
+  function GenHeader()
+  {
+    /* Prepare departments,
+       which are shown in the listbox on top of the listbox
+     */
+    $options= "";
+
+    /* Get all departments within this subtree */
+    $base = $this->config->current['BASE'];
+    $first = "";
+    $found = FALSE;
+
+    /* Add base */
+    $tmp = array();
+    $tmp[] = array("dn"=>$this->config->current['BASE']);
+    $tmp=  array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
+                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
+
+    $deps = array();
+    foreach($tmp as $tm){
+      $deps[$tm['dn']] = $tm['dn'];
+    }
+
+    /* Load possible departments */
+    $ui= get_userinfo();
+    $tdeps= $ui->get_module_departments("gofonmacro");
+    $ids = $this->config->idepartments;
+    $first = "";
+    $found = FALSE;
+    foreach($ids as $dep => $name){
+      if(isset($deps[$dep]) && in_array_ics($dep, $tdeps)){
+
+        /* Keep first base dn in mind, we could need this
+         *  info if no valid base was found
+         */
+        if(empty($first)) {
+          $first = $dep['dn'];
+        }
+
+        $value = $ids[$dep];
+        if ($this->selectedBase == $dep){
+          $found = TRUE;
+          $options.= "<option selected='selected' value='".$dep."'>$value</option>";
+        } else {
+          $options.= "<option value='".$dep."'>$value</option>";
+        }
+      }
+    }
+
+    /* The currently used base is not visible with your acl setup.
+     * Set base to first useable base.
+     */
+    if(!$found){
+      $this->selectedBase = $first;
+    }
+
+    $acls  = $ui->get_permissions($this->selectedBase,"gofonmacro/macro");
+
+    /* Add default header */
+    $listhead = MultiSelectWindow::get_default_header();
+    $listhead .= _("Base")."&nbsp;<select name='CurrentMainBase' 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;";
+    
+    /* Create Layers menu */
+    $s  = ".|"._("Actions")."|\n";
+    $s .= "..|<img src='images/list_new.png' alt='' border='0' class='center'>".
+      "&nbsp;"._("Create")."|\n";
+
+    /* Append create options */
+    if(preg_match("/c/",$acls)){
+      $s.= "...|<input class='center' type='image' src='images/list_new_macro.png' alt=''>".
+        "&nbsp;"._("Macro")."|goFonMacro_new|\n";
+    }
+
+    /* Multiple options */
+    $s.= "..|---|\n";
+    $s.= "..|<img src='images/edittrash.png' alt='' border='0' class='center'>".
+      "&nbsp;"._("Remove")."|"."remove_multiple|\n";
+
+    /* Add multiple copy & cut icons */
+    if(preg_match("/(c.*w|w.*c)/",$acls) && is_object( $this->parent->CopyPasteHandler)){
+      $s.= "..|---|\n";
+      $s.= "..|<img src='images/editcopy.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Copy")."|"."multiple_copy_systems|\n";
+      $s.= "..|<img src='images/editcut.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Cut")."|"."multiple_cut_systems|\n";
+
+      if($this->parent->CopyPasteHandler->entries_queued()){
+        $img = "<img border='0' class='center' src='images/editpaste.png' alt=''>";
+        $s.="..|".$img."&nbsp;"._("Paste")."|editPaste|\n";
+      }else{
+        $img = "<img border='0' class='center' src='images/cant_editpaste.png' alt=''>";
+        $s.="..|".$img."&nbsp;"._("Paste")."\n";
+      }
+    }
+
+    /* Add snapshot icons */
+    if(preg_match("/(c.*w|w.*c)/",$acls)){
+      $s .= "..|---|\n";
+      $s .= $this->get_snapshot_header(TRUE);
+    }
+
+    $this->SetDropDownHeaderMenu($s);
+
+
+
+
+    $this->SetListHeader($listhead);
+  }
+
+  function execute()
+  {
+    $this->ClearElementsList();
+    $this->GenHeader();
+  }
+
+  function setEntries($list)
+  {
+  
+    $empty      = "<img class='center' src='images/nothing.png' style='width:16px;height:16px;' alt=''>";
+    $macroimg   = "<img class='center' src='images/list_macro.png' alt='"._("Macro")."' title='%s'>";
+    $visible    = "<img class='center' src='images/true.png' alt='"._("yes")."' title='"._("visible")."'>";
+    $invisible  = "<img class='center' src='images/false.png' alt='"._("no")."'title='"._("invisible")."'>";
+    $editlink   = "<a href='?plug=".$_GET['plug']."&amp;id=%s&amp;act=edit_entry'>%s</a>";
+
+    /* Dynamic action col, depending on snapshot icons */
+    $action_col_size = 100;
+    if($this->parent->snapshotEnabled()){
+      $action_col_size += 20;
+    }
+
+    $ui = get_userinfo();
+
+    foreach($list as $key => $val){
+       
+      $sacl  = $ui->get_permissions($val['dn'],"gofonmacro/macro");
+
+      $action = "";
+      if(!preg_match("/r/",$sacl)){
+        continue;
+      }
+
+      if(($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$sacl)){
+        $action.= "<input class='center' type='image'
+          src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
+        $action.= "<input class='center' type='image'
+          src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
+      }
+
+      $action.= "<input class='center' type='image' src='images/edit.png' alt='"._("edit")."'     
+        name='goFonMacro_edit_%KEY%' title='"._("Edit macro")."'>";
+
+      if(preg_match("/c/",$sacl) && preg_match("/w/",$sacl)){
+        $action.= $this->GetSnapShotActions($val['dn']); 
+      }
+
+      if(preg_match("/d/",$sacl)){
+        $action.= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."'   
+          name='goFonMacro_del_%KEY%' title='"._("Delete macro")."'>";
+      }
+
+      if(isset($val['goFonMacroVisible']['0'])&&($val['goFonMacroVisible']['0'] == "1")){
+        $pic1 = $visible;
+      }else{
+        $pic1 = $invisible;
+      }
+
+      $display= $val["displayName"][0]."&nbsp;(".$val["cn"][0].")";
+      if(isset($val['description'][0])){
+
+        $desc = $val['description'][0];
+        if(strlen($desc) > 55){
+          $desc = substr($desc,0,52)."...";
+        }
+
+        $display .= "&nbsp;[".$desc."]";
+      }
+
+      /* Cutted objects should be displayed in light grey */
+      if($this->parent->CopyPasteHandler){
+        foreach($this->parent->CopyPasteHandler->queue as $queue_key => $queue_data){
+          if($queue_data['dn'] == $val['dn']) {
+            $display = "<font color='#999999'>".$display."</font>";
+            break;
+          }
+        }
+      }
+
+      /* Create each field */
+      $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
+                      "attach" => "style='width:20px;'");
+      $field1 = array("string" => sprintf($macroimg,$val['dn']), "attach" => "style='text-align:center;width:20px;'");
+      $field2 = array("string" => sprintf($editlink,$key,$display), "attach" => "style='' title='".preg_replace('/ /', '&nbsp;', @LDAP::fix($val['dn']))."'");
+      $field3 = array("string" => $pic1, "attach" => "style='width:50px;'");
+      $field4 = array("string" => preg_replace("/%KEY%/", "$key", $action), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'");
+
+      $this->AddElement(array($field0,$field1,$field2,$field3,$field4));
+    }
+
+    /* Create summary string for list footer */
+    $num_deps=0;
+    if(!$this->SubSearch){
+      $num_deps = count($this->Added_Departments);
+    }
+    $num_objs = count($list);
+
+    $num_obj_str = _("Number of listed macros");
+    $num_dep_str = _("Number of listed departments");
+
+    $str = "<img class='center' src='images/select_macro.png'
+              title='".$num_obj_str."' alt='".$num_obj_str."'>&nbsp;".$num_objs."&nbsp;&nbsp;&nbsp;&nbsp;";
+    $str.= "<img class='center' src='images/folder.png'
+              title='".$num_dep_str."' alt='".$num_dep_str."'>&nbsp;".$num_deps."&nbsp;&nbsp;&nbsp;&nbsp;";
+
+    $this->set_List_Bottom_Info($str);
+  }
+
+  function Save()
+  {
+    MultiSelectWindow :: Save();  
+  }
+
+  function save_object()
+  {
+    /* Save automatic created POSTs like regex, checkboxes */
+    MultiSelectWindow :: save_object();   
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/gofon/macro/class_gofonMacro.inc b/gosa-core/plugins/gofon/macro/class_gofonMacro.inc
new file mode 100755 (executable)
index 0000000..1dbb4ee
--- /dev/null
@@ -0,0 +1,593 @@
+<?php
+
+//!  The Phone Macro Class: Handles Macro Contents, and some attributes. 
+/*!
+     This class handles the basic information about phone macros, like
+     cn base description displayName goFonMacroContent goFonMacroVisible
+
+     This is not the only Class that manages phone Macros, there ist also the class_goFonMacroParameter.
+*/
+class macro extends plugin
+{
+  /*! CLI vars */
+  var $cli_summary= "Handling of GOsa's macro object";
+  /*! CLI vars */
+  var $cli_description= "Some longer text\nfor help";
+  /*! CLI vars */
+  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /*! Macro attributes,  */
+  var $generate_error= "";
+  
+  /*! The name of the Macro in the openldap drirectory */
+  var $cn               = ""; 
+  /*! Display error once */
+  var $error_shown = false; 
+
+  /*! This ist the variable that contains the description of the macro*/
+  var $description      = "";
+
+  /*! The base of the macro, is used to save the macro in the correct directory tree */
+  var $base             = "";
+
+  /*! This is the name of the macro which the enduser will see, instead of the cn */
+  var $displayName      = "";
+    
+  /*! Here is the macro content, the real macroscript */
+  var $goFonMacroContent= "";
+  
+  /*! To allow user to use this macro this var must be true, else false */
+  var $goFonMacroVisible= 0;
+
+  /*! attribute list for save action */
+  var $attributes     = array("cn","base", "description","displayName","goFonMacroContent","goFonMacroVisible");
+  var $view_logged = FALSE;
+  var $orig_cn = ""; 
+  /*! Objectclasses that this calls handles */
+  var $objectclasses  = array("top", "goFonMacro");
+
+  var $goFonHomeServers = array(); // Contains all available asterisk database server 
+
+  //! The Konstructor   
+  /*!  Konstructor, load class with  attributes of the given dn*/
+  function macro (&$config, $dn= NULL, $parent= NULL)
+  {
+    plugin::plugin ($config, $dn, $parent);
+
+    /* This is always an account */
+    $this->is_account= TRUE;
+
+    /* Edit or new one ?*/
+    if ($this->dn == "new"){
+      if(isset($_SESSION['CurrentMainBase'])){
+        $this->base = $_SESSION['CurrentMainBase'];
+      }else{
+        $ui= get_userinfo();
+        $this->base= dn2base($ui->dn);
+      }
+    } else {
+      $this->orig_cn=$this->cn;
+      $this->base= preg_replace ("/^[^,]+,[^,]+,[^,]+,[^,]+,[^,]+,/", "", $this->dn);
+    }
+
+    /* Check server configurations
+     * Load all server configuration in $this->goFonHomeServers if available
+     */
+    $a_SETUP= array();
+    if(array_key_exists('config',$_SESSION) &&
+       array_key_exists('SERVERS',$_SESSION['config']->data) &&
+       count($_SESSION['config']->data['SERVERS']['FON']) && 
+       array_key_exists('FON',$_SESSION['config']->data['SERVERS'])) {
+
+      /* Set available server */
+      $this->goFonHomeServers = $_SESSION['config']->data['SERVERS']['FON'];
+  
+      /* Remove default entry, not necessary here */
+      if(isset($this->goFonHomeServers[0])){
+        unset($this->goFonHomeServers[0]);  
+      }
+    }
+  }
+
+
+  /*!  Execute this plugin */
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* Log view */
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","gofonmacro/".get_class($this),$this->dn);
+    }
+
+    /* Variables */
+    $vars      = "";
+    $tmp       = array();
+    $number = 0; 
+
+    /* Base select dialog */
+    $once = true;
+    foreach($_POST as $name => $value){
+      if(preg_match("/^chooseBase/",$name) && $once){
+        $once = false;
+        $this->dialog = new baseSelectDialog($this->config,$this,$this->allowedBasesToMoveTo());
+        $this->dialog->setCurrentBase($this->base);
+      }
+    }
+
+    /* Dialog handling */
+    if(is_object($this->dialog)){
+      /* Must be called before save_object */
+      $this->dialog->save_object();
+
+      if($this->dialog->isClosed()){
+        $this->dialog = false;
+      }elseif($this->dialog->isSelected()){
+
+        /* A new base was selected, check if it is a valid one */
+        $tmp = $this->get_allowed_bases();
+        if(isset($tmp[$this->dialog->isSelected()])){
+          $this->base = $this->dialog->isSelected();
+        }
+
+        $this->dialog= false;
+      }else{
+        return($this->dialog->execute());
+      }
+    }
+
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+    $smarty->assign("bases", $this->get_allowed_bases());
+
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+    if($this->acl_is_writeable("base")){
+      $smarty->assign("baseSelect",true);
+    }else{
+      $smarty->assign("baseSelect",false);
+    }
+
+
+    /* Assign all vars to Smarty */
+    foreach($this->attributes as $ar){
+      $smarty->assign($ar, $this->$ar);
+    }
+    /* Checkboxes */
+    $smarty->assign("base_select", $this->base);
+    $smarty->assign("vars", $vars);
+
+    if($this->goFonMacroVisible){
+      $smarty->assign("goFonMacroVisibleChecked"," checked ");
+    }else{
+      $smarty->assign("goFonMacroVisibleChecked","");
+    }
+
+    $smarty->assign("cnACL",$this->getacl("cn",$this->initially_was_account));
+    $smarty->assign("cn",$this->cn);
+
+    /* Ensure that macro content is displayed correctly encoded */
+    $smarty->assign("goFonMacroContent",htmlentities(utf8_decode ($this->goFonMacroContent)));
+
+    /* Show main page */
+    return($smarty->fetch (get_template_path('generic.tpl', TRUE)));
+  }
+
+
+  /* This method check if all databases are reachable.  
+   *  Returns with error message or an empty string on success.
+   * 
+   * - Is mysql extension available  
+   * - Is every server reachable 
+   * - Does the database exists/is accessible
+   */
+  function check_database_accessibility()
+  {
+    /* Check if mysql extension is available */
+    if(!is_callable("mysql_pconnect")){
+      return(_("Can't save any changes to asterisk database, there is currently no mysql extension available in your php setup."));
+    }
+
+    /********************
+     * Check all home server
+     ********************/
+    foreach($this->goFonHomeServers as $goFonHomeServer => $cfg_Current){
+      $r_current    =  @mysql_pconnect($cfg_Current['SERVER'],$cfg_Current['LOGIN'],$cfg_Current['PASSWORD']);
+      if(!$r_current){
+        new log("debug","gofonmacro/".get_class($this),"",array(),@mysql_error($r_current));
+        return(sprintf(_("The MySQL home server '%s' isn't reachable as user '%s', check GOsa log for mysql error."),
+              $cfg_Current['SERVER'],$cfg_Current['LOGIN']));
+      }
+      $db_current  =  @mysql_select_db($cfg_Current['DB'],$r_current);
+      if(!$db_current){
+        new log("debug","gofonmacro/".get_class($this),"",array(),@mysql_error($r_current));
+        mysql_close($r_current);
+        return( sprintf(_("Can't select database '%s' on home server '%s'."),$cfg_Current['DB'],$cfg_Current['SERVER']));
+      }
+    }
+  }
+
+
+  /* Remove current macro from all asterisk server.
+   * First of all check if we have access to all databases. 
+   * - Remove old entries 
+   */ 
+  function remove_from_database($save)
+  {
+    /* Check if all databases are reachable */
+    $str = $this->check_database_accessibility();
+    if($str){
+      return($str);
+    }
+
+    /* Create query string */
+    $context  = addslashes("macro-".$this->cn);
+
+    /* Remove current macro from each server available */ 
+    if($save){
+      foreach($this->goFonHomeServers as $dn => $Server){
+        $query      = "DELETE FROM ".$Server['EXT_TABLE']." WHERE context='".$context."';";
+        $r_current  =  @mysql_pconnect($Server['SERVER'],$Server['LOGIN'],$Server['PASSWORD']);
+        $db_current =  @mysql_select_db($Server['DB'],$r_current);
+        $res = @mysql_query($query,$r_current);
+        @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query, "Database query");
+        if(!$res){
+          new log("debug","gofonmacro/".get_class($this),"",array(),@mysql_error($r_current));
+          return(sprintf(_("Removing macro from '%s' failed. Check GOsa log for mysql error."),$Server['SERVER']));
+        }
+        @mysql_close($r_current);
+      }
+    }
+  }
+
+  /* Add current macro to all asterisk server.
+   * First of all check if we have access to all databases. 
+   * - Remove old entries 
+   * - Add new entries 
+   */ 
+  function add_to_database($save)
+  {
+    /* Check if all databases are reachable */
+    $str = $this->check_database_accessibility();
+    if($str){
+      return($str);
+    }
+
+    /* Remove old entries first. Else we got duplicated entries */
+    $str = $this->remove_from_database($save);
+    if($str){
+      return($str);
+    }
+
+    /* Create query string */
+    $context      = "macro-".$this->cn;
+
+    /************
+     * Parse Macro content
+     ************/
+    $sql = 
+      "INSERT INTO %TABLENAME% ".
+      " (context,exten,priority,app,appdata) ".
+      " VALUES ";
+      
+    $a_contentLines = split("\n",$this->goFonMacroContent);
+    foreach($a_contentLines as $i_linenum => $s_linestr){
+
+      /* Remove the 'exten => ' string in front of the macro content line 
+       *  example line  'exten => s,2,GotoIf(${ARG3}?3:5)'
+       * Remove comments introduced by ;
+       * Skip empty lines 
+       */ 
+      $s_linestr = trim($s_linestr);
+      $s_linestr = preg_replace("/;.*$/","",$s_linestr) ;
+      $s_linestr = preg_replace ("/^.*=\> /","",$s_linestr);
+
+      if(empty($s_linestr)){
+        continue;
+      }
+
+      /* A line that passes the check above should look like this 
+       *  s,1,SetLanguage(de)
+       * 3 parts seperated by , 
+       * If there are more or less parts, abort.
+       * The preg_replace exclude parameters from split .. 
+       */
+      $tmp  = split(",", $s_linestr,3);
+
+      /* Check if there are exactly 2 , */ 
+#      if(substr_count($s_linestr,",") !=2){
+#        return(sprintf(_("More than two ',' given in line : '%s'. Remember that parameters are seperated by '|'."),$i_linenum));
+#      }
+      /* Multiple () are not supproted currently ... */  
+      if(substr_count($s_linestr,"(") >1 ){
+        return(sprintf(_("More than one '(' is currently not supported. Line : '%s'."),$i_linenum));
+      }
+      if(substr_count($s_linestr,")") >1 ){
+        return(sprintf(_("More than one ')' is currently not supported. Line : '%s'."),$i_linenum));
+      }
+      /* Check if there is an application given */
+      if(empty($tmp[1])){
+        return(sprintf(_("There is no application given in line : '%s'."),$i_linenum));
+      } 
+      /* Check if there is an extension given */
+      if(empty($tmp[0])){
+        return(sprintf(_("There is no extension type given in line : '%s'."),$i_linenum));
+      } 
+
+      /* Create extension entry for current line 
+       *  and add this line to an array that will be inserted 
+       *  to each database.
+       */
+      $exten  = addslashes($tmp[0]);
+      $prio   = addslashes($tmp[1]);
+      $app    = addslashes(preg_replace("/\(.*\).*$/","",$tmp[2]));
+      $para   = addslashes(preg_replace("/^.*\(/","",$tmp[2]));
+      $para   = preg_replace("/\).*$/","",$para);
+      $sql.= " ('".$context."','".$exten."','".$prio."','".$app."','".$para."'),";
+    }
+    
+    /* Remove last , from query string */
+    $sql = preg_replace("/,$/","",$sql);
+
+    /* Save current changes to the database */
+    if($save){
+    
+      /* Macro are spread to each asterisk server */
+      foreach($this->goFonHomeServers as $dn => $cfg){
+        $r_con  = @mysql_pconnect($cfg['SERVER'],$cfg['LOGIN'],$cfg['PASSWORD']); 
+        $db     = @mysql_select_db($cfg['DB'],$r_con);
+        $query  = preg_replace("/%TABLENAME%/",$cfg['EXT_TABLE'],$sql);
+        $res    = @mysql_query($query,$r_con);
+        @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query, "Database query");
+        if(!$res){
+          new log("debug","gofonmacro/".get_class($this),"",array(),@mysql_error($r_con));
+          return(sprintf(_("Insert of new macro failed for server '%s'."),$cfg['SERVER']));
+        }
+        @mysql_close($r_con);
+      }
+    }
+  }
+
+
+  function save_object()
+  {
+    if (isset($_POST['gofonMacroGenericPosted'])){
+
+      $old_cn       = $this->cn;
+      $old_visible  = $this->goFonMacroVisible;
+
+      /* Create a base backup and reset the
+         base directly after calling plugin::save_object();
+         Base will be set seperatly a few lines below */
+      $base_tmp = $this->base;
+      plugin::save_object();
+      $this->base = $base_tmp;
+
+      /* Save base, since this is no LDAP attribute */
+      $tmp = $this->get_allowed_bases();
+      if(isset($_POST['base'])){
+        if(isset($tmp[$_POST['base']])){
+          $this->base= $_POST['base'];
+        }
+      }
+
+      /* Restore old cn if we have insuficient acls to change cn ... */
+      if(!$this->acl_is_writeable("cn",$this->initially_was_account)){
+        $this->cn = $old_cn;
+      }
+
+      /* check if we are allowed to toggle visibility */
+      if($this->acl_is_writeable("goFonMacroVisible")) {
+
+        /* Checkbox selected ? */
+        if(isset($_POST['goFonMacroVisible'])) {
+          $this->goFonMacroVisible= 1 ;
+        }else  {
+          if(isset($_POST['displayName'])){
+            $this->goFonMacroVisible= 0 ;
+          }
+        }
+      }else{
+        $this->goFonMacroVisible = $old_visible;
+      }
+    }
+  }
+
+
+  /*! Check values */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    if(!count($this->goFonHomeServers)){
+      $message[] = _("There must be at least one server with an asterisk database to save this phone macro.");
+    }
+
+    /* Check if insert/replace is possible and all servers are available */
+    $str = $this->add_to_database(false);
+    if($str){
+      $message[] = $str;
+    }
+
+    /* Check if cn is already used  */
+    if(($this->dn=="new")||($this->orig_cn!=$this->cn)){
+      $ldap = $this->config->get_ldap_link();
+      $ldap->search("(&(objectClass=goFonMacro)(cn=".$this->cn."))",array("cn"));
+      if($ldap->count()>0){
+        $message[]=sprintf(_("The given cn '%s' already exists."),$this->cn);
+      }
+    }
+  
+    /* Check if display name is set */
+    if(empty($this->displayName)){
+      $message[] = _("You must specify the 'Display Name' in order to save this macro");
+    }  
+    /* CN is restricted to 20 chars */
+    if(strlen("Makro-".$this->cn)>20 ){
+      $message[]=_("The given cn is too long, to create a Makro entry, maximum 20 chars.");
+    }
+  
+    /* If this macro is still in use we should not change the visible for user flag to invisible */
+    if(!$this->goFonMacroVisible){
+      $ldap = $this->config->get_ldap_link();
+      $res = $ldap->search("(&(objectClass=goFonAccount)(objectClass=gosaAccount)(goFonMacro=*))", array("goFonMacro"));
+      while ($val = $ldap->fetch()){
+        if(strstr($val['goFonMacro'][0],$this->dn)){
+          $message[] = _("This macro is still in use. It is necessary to mark this macro as visible for users.");
+          return($message);
+        }
+      }
+    }
+
+    /* Macro content must be smaller than 100 lines */
+    if(count(split("\n",$this->goFonMacroContent))>100){
+      $message[] = _("Makro length must be lower than 100 lines");
+    }
+
+    /* Macro content must be smaller than 100 lines */
+    if(empty($this->goFonMacroContent)){
+      $message[] = _("You can't save an empty macro.");
+    }
+    return $message;
+  }
+
+
+  /*! Remove makro from all given databases 
+   *   and ldap too.
+   */
+  function remove_from_parent()
+  {
+    $ldap= $this->config->get_ldap_link();
+
+    /* Skip remove if this macro is still in use */
+    $res = $ldap->search("(&(objectClass=goFonAccount)(objectClass=gosaAccount)(goFonMacro=*))", array("goFonMacro"));
+    while ($val = $ldap->fetch()){ 
+      if(strstr($val['goFonMacro'][0],$this->dn)){ 
+        print_red(_("This macro is still in use. To delete this Macro ensure that nobody has selected it."));
+        return false;
+      }
+    }
+
+    /* Try to remove from database */
+    if(count($this->goFonHomeServers)){
+      $str = $this->remove_from_database(true);
+      if($str){ 
+        print_red($str);
+        return false;
+      }
+    }else{
+      print_red(_("Could not remove the macro entry from asterisk databases. Please check your asterisk database configurations."));
+      return false;
+    }
+
+    /* Remove phone macro */ 
+    $ldap->rmDir($this->dn);
+    new log("remove","gofonmacro/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); 
+    show_ldap_error($ldap->get_error(), sprintf(_("Removing of goFonMacro/generic account with dn '%s' failed."),$this->dn));
+
+    /* Delete references to object groups */
+    $ldap->cd ($this->config->current['BASE']);
+    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
+    while ($ldap->fetch()){
+      $og= new ogroup($this->config, $ldap->getDN());
+      unset($og->member[$this->dn]);
+      $og->save ();
+      show_ldap_error($ldap->get_error(), sprintf(_("Removing of goFonMacro/generic account with dn '%s' failed."),$this->dn));
+    }
+  }
+
+
+  /*! Save to LDAP */
+  function save()
+  {
+    plugin::save();
+    unset($this->attrs['base']);
+
+    /* Try to add entries to databases */
+    $str = $this->add_to_database(true);
+    if($str){
+      print_red($str);
+    }else{
+      /* Write back to ldap */
+      $ldap= $this->config->get_ldap_link();
+      $ldap->cat($this->dn, array('dn'));
+      $a= $ldap->fetch();
+
+      if (count($a)){
+        $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(preg_replace('/^[^,]+,/', '', $this->dn));
+        $ldap->cd($this->dn);
+        $ldap->add($this->attrs);
+        $this->handle_post_events("add");
+      }
+      show_ldap_error($ldap->get_error(), sprintf(_("Saving of goFonMacro/generic account with dn '%s' failed."),$this->dn));
+
+      /* Log last action */
+      if($this->initially_was_account){
+        new log("modify","gofonmacro/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+      }else{
+        new log("create","gofonmacro/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+      }
+    }
+  }
+
+
+  function getCopyDialog()
+  {
+    $smarty = get_smarty();
+    $smarty->assign("cn" ,$this->cn);
+    $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE));
+    $ret = array();
+    $ret['string'] = $str;
+    $ret['status'] = "";
+    return($ret);
+  }
+
+
+  function saveCopyDialog()
+  {
+    if(isset($_POST['cn'])){
+      $this->cn = $_POST['cn'];
+    }
+  }
+
+
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Generic"),
+          "plDescription" => _("Asterisk macro management"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 0,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("gofonmacro" => array("description" => _("GOfon macro"),
+              "objectClass" => "gofonMacro")),
+
+          "plProvidedAcls" => array(
+            "cn"                            => _("Macro name"),
+            "base"                          => _("Base"),
+            "description"                   => _("Description"),
+            "displayName"                   => _("Display name"),
+            "goFonMacroContent"             => _("Macro content and parameter"),
+            "goFonMacroVisible"             => _("Visibility flag"))
+          ));
+  }
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/gofon/macro/class_gofonMacroManagement.inc b/gosa-core/plugins/gofon/macro/class_gofonMacroManagement.inc
new file mode 100755 (executable)
index 0000000..f25f495
--- /dev/null
@@ -0,0 +1,555 @@
+<?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 goFonMacro extends plugin
+{
+  /* Definitions */
+  var $plHeadline                  = "Phone macros";
+  var $plDescription     = "This does something";
+
+  /* Dialog attributes */
+  var $macrotabs                   = NULL;
+  var $macros                  = array();
+  var $ui                                      = NULL;
+  var $DivListMacro     = NULL;
+
+  var $CopyPasteHandler = NULL;
+  var $start_pasting_copied_objects = FALSE;
+
+  function gofonMacro(&$config, $ui)
+  {
+    /* Save configuration for internal use */
+    $this->config= $config;
+    $this->ui= $ui;
+
+    $this->DivListMacro = new divListMacro($this->config,$this);
+
+    /* Copy & Paste enabled ?*/
+    if((isset($this->config->data['MAIN']['ENABLECOPYPASTE']))&&(preg_match("/true/i",$this->config->data['MAIN']['ENABLECOPYPASTE']))){
+      $this->CopyPasteHandler = new CopyPasteHandler($this->config);
+    }
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    $_SESSION['LOCK_VARS_TO_USE'] = array("/^goFonMacro_/","/^act$/","/^id$/","/^item_selected/","/^remove_multiple_macros/");
+
+    /*****************
+      Variable initialisation
+     *****************/
+
+    $s_action     = "";                       // Contains the action to proceed
+    $s_entry      = "";                       // The value for s_action
+    $base_back    = "";                       // The Link for Backbutton
+    $smarty= get_smarty();
+
+
+    /*****************
+      Check Posts 
+     *****************/
+
+    /* Test Posts */
+    foreach($_POST as $key => $val){
+      // Post for delete
+      if(preg_match("/^goFonMacro_del/",$key)){
+        $s_action = "del";
+        $s_entry  = preg_replace("/^goFonMacro_del_/i","",$key);
+        // Post for edit
+      }elseif(preg_match("/^goFonMacro_edit_/",$key)){
+        $s_action="edit";
+        $s_entry  = preg_replace("/^goFonMacro_edit_/i","",$key);
+        // Post for new
+      }elseif(preg_match("/^goFonMacro_new/",$key)){
+        $s_action="new";
+      }elseif(preg_match("/^remove_multiple_macros/",$key)){
+        $s_action="del_multiple";
+      }elseif(preg_match("/^editPaste.*/i",$key)){
+        $s_action="editPaste";
+      }elseif(preg_match("/^copy_.*/",$key)){
+        $s_action="copy";
+        $s_entry  = preg_replace("/^copy_/i","",$key);
+      }elseif(preg_match("/^cut_.*/",$key)){
+        $s_action="cut";
+        $s_entry  = preg_replace("/^cut_/i","",$key);
+      }elseif(preg_match("/^multiple_copy_objects/",$key)){
+        $s_action = "copy_multiple";
+      }elseif(preg_match("/^multiple_cut_objects/",$key)){
+        $s_action = "cut_multiple";
+      }
+    }
+    if((isset($_GET['act']))&&($_GET['act']=="edit_entry")){
+      $s_action ="edit";
+      $s_entry  = $_GET['id'];
+    }
+    $s_entry  = preg_replace("/_.$/","",$s_entry);
+
+
+    /********************
+      Copy & Paste Handling  ...
+     ********************/
+
+    
+    /* handle C&P from layers menu */
+    if(isset($_POST['menu_action']) && preg_match("/^multiple_copy_systems/",$_POST['menu_action'])){
+      $s_action = "copy_multiple";
+    }
+    if(isset($_POST['menu_action']) && preg_match("/^multiple_cut_systems/",$_POST['menu_action'])){
+      $s_action = "cut_multiple";
+    }
+    if(isset($_POST['menu_action']) && preg_match("/^editPaste/",$_POST['menu_action'])){
+      $s_action = "editPaste";
+    }
+
+    /* Create options */
+    if(isset($_POST['menu_action']) && $_POST['menu_action'] == "goFonMacro_new"){
+      $s_action = "new";
+    }
+
+    /* handle remove from layers menu */
+    if(isset($_POST['menu_action']) && preg_match("/^remove_multiple/",$_POST['menu_action'])){
+      $s_action = "del_multiple";
+    }
+
+    /* Display the copy & paste dialog, if it is currently open */
+    $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
+    if($ret){
+      return($ret);
+    }
+
+
+    /*****************
+      Create a new Macro 
+     *****************/
+
+    /* New macro? */
+    if ($s_action=="new"){
+
+      /* By default we set 'dn' to 'new', all relevant plugins will
+         react on this. */
+      $this->dn= "new";
+
+      /* Create new usertab object */
+      $this->macrotabs= new macrotabs($this->config,$this->config->data['TABS']['MACROTABS'], $this->dn,"gofonmacro");
+      $this->macrotabs->set_acl_base($this->DivListMacro->selectedBase);
+    }
+
+    /*****************
+      Edit || Password canceled  
+     *****************/
+
+    /* Cancel dialogs */
+    if (isset($_POST['edit_cancel'])){
+      del_lock ($this->macrotabs->dn);
+      unset ($this->macrotabs);
+      $this->macrotabs= NULL;
+      unset ($_SESSION['objectinfo']);
+    }
+
+
+    /*****************
+      Edit finised
+     *****************/
+
+    /* Finish mac edit is triggered by the tabulator dialog, so
+       the user wants to save edited data. Check and save at this
+       point. */
+    if ((isset($_POST['edit_finish']) || isset($_POST['edit_apply'])) && (isset($this->macrotabs->config))){
+
+      /* Check tabs, will feed message array */
+      $this->macrotabs->last= $this->macrotabs->current;
+      $this->macrotabs->save_object();
+      $message= $this->macrotabs->check();
+
+      /* Save, or display error message? */
+      if (count($message) == 0){
+
+        /* Save data data to ldap */
+        $this->macrotabs->save();
+
+        if (!isset($_POST['edit_apply'])){
+          /* macro has been saved successfully, remove lock from
+             LDAP. */
+          if ($this->dn != "new"){
+            del_lock ($this->dn);
+          }
+
+          unset ($this->macrotabs);
+          $this->macrotabs= NULL;
+          unset ($_SESSION['objectinfo']);
+        }
+      } else {
+        /* Ok. There seem to be errors regarding to the tab data,
+           show message and continue as usual. */
+        show_errors($message);
+      }
+    }
+
+
+    /*****************
+      Edit macro 
+     *****************/
+
+    /* User wants to edit data */
+    if (($s_action=="edit") && (!isset($this->macrotabs->config))){
+
+      $dn  = $this->macros[$s_entry]['dn'];
+      $acl = $this->ui->get_permissions($dn,"gofonmacro/macro");
+      if(preg_match("/r/",$acl)){
+        $this->dn = $dn;
+
+        /* Check locking, save current plugin in 'back_plugin', so
+           the dialog knows where to return. */
+        if (($user= get_lock($this->dn)) != ""){
+          return(gen_locked_message ($user, $this->dn));
+        }
+
+        /* Lock the current entry, so everyone will get the
+           above dialog */
+        add_lock ($this->dn, $this->ui->dn);
+        /* Register macrotabs to trigger edit dialog */
+        $this->macrotabs= new macrotabs($this->config,
+            $this->config->data['TABS']['MACROTABS'], $this->dn,"gofonmacro");
+        $_SESSION['objectinfo']= $this->dn;
+      }
+    }
+
+
+
+    /********************
+      Delete MULTIPLE entries requested, display confirm dialog
+     ********************/
+
+    if ($s_action=="del_multiple"){
+      $ids = $this->list_get_selected_items();
+
+      if(count($ids)){
+
+        foreach($ids as $id){
+          $dn = $this->macros[$id]['dn'];
+          if (($user= get_lock($dn)) != ""){
+            return(gen_locked_message ($user, $dn));
+          }
+          $this->dns[$id] = $dn;
+        }
+
+        $dns_names = "<br><pre>";
+        foreach($this->dns as $dn){
+          add_lock ($dn, $this->ui->dn);
+          $dns_names .= $dn."\n";
+        }
+        $dns_names .="</pre>";
+
+        /* Lock the current entry, so nobody will edit it during deletion */
+        $smarty->assign("intro",     sprintf(_("You're about to delete the following user(s) %s"), @LDAP::fix($dns_names)));
+        $smarty->assign("multiple", true);
+        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+      }
+    }
+
+
+    /********************
+      Delete MULTIPLE entries confirmed
+     ********************/
+
+    /* Confirmation for deletion has been passed. Users should be deleted. */
+    if (isset($_POST['delete_multiple_macro_confirm'])){
+
+      /* Remove user by user and check acls before removeing them */
+      foreach($this->dns as $key => $dn){
+
+        $acl = $this->ui->get_permissions($dn,"gofonmacro/macro");
+        if(preg_match("/d/",$acl)){
+
+          /* Delete request is permitted, perform LDAP action */
+          $this->macrotabs= new macrotabs($this->config,$this->config->data['TABS']['MACROTABS'], $dn,"gofonmacro");
+          $this->macrotabs->delete ();
+          unset ($this->macrotabs);
+          $this->macrotabs= NULL;
+
+        } else {
+          print_red (_("You are not allowed to delete this macro!"));
+        }
+
+        /* Remove lock file after successfull deletion */
+        del_lock ($dn);
+        unset($this->dns[$key]);
+      }
+    }
+
+
+    /********************
+      Delete MULTIPLE entries Canceled
+     ********************/
+
+    /* Remove lock */
+    if(isset($_POST['delete_multiple_macro_cancel'])){
+      foreach($this->dns as $key => $dn){
+        del_lock ($dn);
+        unset($this->dns[$key]);
+      }
+    }
+
+
+    /*****************
+      Remove macro
+     *****************/
+
+    /* Remove user was requested */
+    if ($s_action=="del"){
+
+      /* Get 'dn' from posted 'uid' */
+      $dn  = $this->macros[$s_entry]['dn'];
+      $acl = $this->ui->get_permissions($dn,"gofonmacro/macro");
+
+      if(preg_match("/d/",$acl)){
+
+        $this->dn = $dn;
+  
+        /* Check locking, save current plugin in 'back_plugin', so
+           the dialog knows where to return. */
+        if (($user= get_lock($this->dn)) != ""){
+          return (gen_locked_message ($user, $this->dn));
+        }
+
+        /* Lock the current entry, so nobody will edit it during deletion */
+        add_lock ($this->dn, $this->ui->dn);
+        $smarty= get_smarty();
+        $smarty->assign("intro", sprintf(_("You're about to delete the macro '%s'."), $this->dn));
+        $smarty->assign("multiple", false);
+        return($smarty->fetch (get_template_path('remove.tpl', TRUE)));
+      } else {
+
+        /* Obviously the user isn't allowed to delete. Show message and
+           clean session. */
+        print_red (_("You are not allowed to delete this macro!"));
+      }
+    }
+
+
+    /*****************
+      Remove macro
+     *****************/
+
+    /* Confirmation for deletion has been passed. Macro should be deleted. */
+    if (isset($_POST['delete_macro_confirm'])){
+
+      $acl = $this->ui->get_permissions($this->dn,"gofonmacro/macro");
+
+      if(preg_match("/r/",$acl)){
+
+        /* Delete request is permitted, perform LDAP action */
+        $this->macrotabs= new macrotabs($this->config,$this->config->data['TABS']['MACROTABS'], $this->dn,"gofonmacro");
+        $this->macrotabs->delete ();
+        unset ($this->macrotabs);
+        $this->macrotabs= NULL;
+      } else {
+        /* Normally this shouldn't be reached, send some extra
+           logs to notify the administrator */
+        print_red (_("You are not allowed to delete this macro!"));
+        new log("security","gofonmacro/".get_class($this),$this->dn,array(),"Tried to trick deletion.");
+      }
+      /* Remove lock file after successfull deletion */
+      del_lock ($this->dn);
+    }
+
+
+    /*****************
+      Display open dialogs  
+     *****************/
+
+    /* Show tab dialog if object is present */
+    if (($this->macrotabs) && (isset($this->macrotabs->config))){
+      $display= $this->macrotabs->execute();
+
+      /* Don't show buttons if tab dialog requests this */
+      if (!$this->macrotabs->by_object[$this->macrotabs->current]->dialog){
+        $display.= "<p style=\"text-align:right\">\n";
+        $display.= "<input type=\"submit\" name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
+        $display.= "&nbsp;\n";
+        if ($this->dn != "new"){
+          $display.= "<input type=submit name=\"edit_apply\" value=\""._("Apply")."\">\n";
+          $display.= "&nbsp;\n";
+        }
+        $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+        $display.= "</p>";
+      }
+      return ($display);
+    }
+
+
+    /*****************
+      Display entry list 
+     *****************/
+
+    /* Check if there is a snapshot dialog open */
+    $base = $this->DivListMacro->selectedBase;
+    if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases())){
+      return($str);
+    }
+
+    /* Return rendered main page */
+    /* Display dialog with system list */
+    $this->DivListMacro->parent = $this;
+    $this->DivListMacro->execute();
+
+    /* Add departments if subsearch is disabled */
+    if(!$this->DivListMacro->SubSearch){
+      $this->DivListMacro->AddDepartments($this->DivListMacro->selectedBase,4,1);
+    }
+    $this->reload();
+    $this->DivListMacro->setEntries($this->macros);
+    return($this->DivListMacro->Draw());
+  }
+
+
+  function copyPasteHandling_from_queue($s_action,$s_entry)
+  {
+    /* Check if Copy & Paste is disabled */
+    if(!is_object($this->CopyPasteHandler)){
+      return("");
+    }
+
+    /* Add a single entry to queue */
+    if($s_action == "cut" || $s_action == "copy"){
+
+      /* Cleanup object queue */
+      $this->CopyPasteHandler->cleanup_queue();
+      $dn = $this->macros[$s_entry]['dn'];
+      $this->CopyPasteHandler->add_to_queue($dn,$s_action,"macrotabs","MACROTABS","gofonmacro");
+    }
+
+    /* Add entries to queue */
+    if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
+
+      /* Cleanup object queue */
+      $this->CopyPasteHandler->cleanup_queue();
+
+      /* Add new entries to CP queue */
+      foreach($this->list_get_selected_items() as $id){
+        $dn = $this->macros[$id]['dn'];
+
+        if($s_action == "copy_multiple"){
+          $this->CopyPasteHandler->add_to_queue($dn,"copy","macrotabs","MACROTABS","gofonmacro");
+        }
+        if($s_action == "cut_multiple"){
+          $this->CopyPasteHandler->add_to_queue($dn,"cut","macrotabs","MACROTABS","gofonmacro");
+        }
+      }
+    }
+
+    /* Start pasting entries */
+    if($s_action == "editPaste"){
+      $this->start_pasting_copied_objects = TRUE;
+    }
+
+    /* Return C&P dialog */
+    if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
+
+      /* Load entry from queue and set base */
+      $this->CopyPasteHandler->load_entry_from_queue();
+      $this->CopyPasteHandler->SetVar("base",$this->DivListMacro->selectedBase);
+
+      /* Get dialog */
+      $data = $this->CopyPasteHandler->execute();
+
+      /* Return dialog data */
+      if(!empty($data)){
+        return($data);
+      }
+    }
+
+    /* Automatically disable status for pasting */
+    if(!$this->CopyPasteHandler->entries_queued()){
+      $this->start_pasting_copied_objects = FALSE;
+    }
+    return("");
+  }
+
+
+
+  /* Return departments, that will be included within snapshot detection */
+  function get_used_snapshot_bases()
+  {
+    return(array("ou=macros,ou=asterisk,ou=configs,ou=systems,".$this->DivListMacro->selectedBase));
+  }
+
+
+  function reload()
+  {
+    /* Set base for all searches */
+    $base       = $this->DivListMacro->selectedBase;
+    $SubSearch  = $this->DivListMacro->SubSearch;
+    $Regex      = $this->DivListMacro->Regex;
+    $Filter     = "(&(cn=".$Regex.")(objectClass=goFonMacro))";
+    $Flags      = GL_SIZELIMIT;
+    $Attrs      = array("cn","description","displayName","goFonMacroVisible");
+
+    /* Prepare for ls or search*/        
+    if($SubSearch){
+      $Flags |= GL_SUBSEARCH;
+    }else{
+      $base = "ou=macros,ou=asterisk,ou=configs,ou=systems,".$base;
+    }
+
+    /* Generate macro list */
+    $res= get_list($Filter, "gofonmacro", $base, $Attrs, $Flags);
+
+    $tmp=array();
+    foreach($res as $tkey => $val ){
+      $tmp[strtolower($val['cn'][0]).$val['cn'][0]]=$val;
+    }
+    ksort($tmp);
+    $this->macros=array();
+    foreach($tmp as $val){
+      $this->macros[]=$val;
+    }
+
+    reset ($this->macros);
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    $this->DivListMacro->save_object();
+  }
+
+
+  function list_get_selected_items()
+  {
+    $ids = array();
+    foreach($_POST as $name => $value){
+      if(preg_match("/^item_selected_[0-9]*$/",$name)){
+        $id   = preg_replace("/^item_selected_/","",$name);
+        $ids[$id] = $id;
+      }
+    }
+    return($ids);
+  }
+
+
+  function adapt_from_template($dn)  { }
+  function check() { }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/gofon/macro/class_gofonMacroParameters.inc b/gosa-core/plugins/gofon/macro/class_gofonMacroParameters.inc
new file mode 100755 (executable)
index 0000000..5a08d3e
--- /dev/null
@@ -0,0 +1,414 @@
+<?php
+//! This class handles the goFonMacroParameter
+/*! In this class all parameters from goFonMacroContent \n
+    and all (if given) already defined parameters are managed \n
+    \n
+    Parameters will be saved to openldap like this :\n
+    goFonMacroParameter: ID!NAME:!TYPE(string:combo:bool)!DEFAULT_VALUE\n    
+    In Case of type=combo the DEFAULT_VALUE specifies the entries in the listbox, like this\n
+    "first:second:third:last" \n
+*/
+class macroParameter extends plugin
+{
+  /*! CLI vars */
+  var $cli_summary= "Handling of GOsa's application object";
+  /*! CLI vars */
+  var $cli_description= "Some longer text\nfor help";
+  /*! CLI vars */
+  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* Parameter Count*/
+  var $para_count = 0 ; 
+  /*! macro base  */
+  var $base= "";
+  
+  /*! This array contains all Parameter defined for the macro*/
+  var $goFonMacroParameter =array();
+
+  /*! This are the available types for a macro */
+  var $type_shortcut= array("string" => array("selected", "", ""),
+      "combo"  => array("", "selected", ""),
+      "bool"   => array("", "", "selected"));
+
+  /*! attribute list for save action */
+  var $attributes= array("base","goFonMacroParameter");
+  
+  /*! Objectclasses needed by the class*/  
+  var $objectclasses= array("top", "goFonMacro");
+  var $ui;
+
+  //! The konstructor of macroParameter    
+  /*! The konstructor of macroParameter...
+     - reads goFonMacroParameter and parses them to an array 
+     - Set attributes from openldap (edit)
+     - Set attributes from default (new)
+  */
+  function macroParameter (&$config, $dn= NULL, $parent= NULL)
+  {
+    plugin::plugin ($config, $dn, $parent);
+
+    $tmp = array();  // temporary Var 
+    $tmp2 = array(); // temporary Var ...
+    $tmp3 = "";
+    $ldap= $config->get_ldap_link();
+
+    $this->dn = $dn;
+
+    /* This is always an account */
+    $this->is_account= TRUE;
+
+    /* Edit or new one ?*/
+    if ($this->dn == "new"){
+      $ui= get_userinfo();
+      $this->base= dn2base($ui->dn);
+    } else {
+      $this->base= dn2base($this->dn);
+    }
+
+    /* initialising macro parameter */
+    if(isset($this->attrs['goFonMacroParameter']) &&
+        isset($this->attrs['goFonMacroParameter']['count'])){
+      unset($this->attrs['goFonMacroParameter']['count']);
+    }
+
+    /* Set Parameters, or a new array if ther are no parameters */
+    if(isset($this->attrs['goFonMacroParameter'])){
+      $this->goFonMacroParameter = $this->attrs['goFonMacroParameter'];
+    }else{
+      $this->goFonMacroParameter =array();
+    }
+
+    /* Create an array for parameters if not given yet */
+    if(!is_array($this->goFonMacroParameter)){
+      $tmp3 = $this->goFonMacroParameter;
+      $this->goFonMacroParameter =array();     
+      if(!empty($tmp3)) {
+        $this->goFonMacroParameter[]  = $tmp3;
+      }
+    }
+
+    /* Load parametersettings*/
+    foreach($this->goFonMacroParameter as $para){
+      $tmp = split("!",$para);
+      $num = $tmp[0];
+      $tmp2[$num]['name']        = base64_decode($tmp[1]);
+      $tmp2[$num]['type']        = $tmp[2];
+      $tmp2[$num]['default']     = $tmp[3];
+      $tmp2[$num]['var']         = "var".$num;
+    }
+
+    
+    /* Assign this array */
+    $this->goFonMacroParameter = $tmp2;
+
+    $this->para_count = count ($tmp2);
+   
+    $this->ui= get_userinfo();
+  }
+
+  //! Perform Parameter check 
+  /*! 
+      Compares the given parameters (goFonMacroParameters) with the parameters defined in goFonContent\n 
+      -> Decide which attrs are new and which are unused\n
+      -> Sort result array (containing both parameters 'goFonMacroParameters/goFonContent' and new / unused info)\n
+      \param $content The given goFonContent for this macro\n
+      \param $goFonMacroParameter Array with the already given parameters \n
+   */
+  function check_paras($content,$goFonMacroParameter)
+  { 
+    /* Check contents for parameters */
+    preg_match_all("/[$]\{ARG[0-9]*\}/",$content,$res,PREG_OFFSET_CAPTURE);
+
+    $new = array();
+
+    /* Detect parameters with positions */
+    foreach($res[0] as $val){
+      $num = preg_replace("/[^0-9]/","",$val[0]); 
+      $new[$num]['val'] = $val[0];
+      $new[$num]['num'] = $num;
+    }
+
+    /* Compare content parameter and macro parameter */
+    foreach($goFonMacroParameter as $gokey => $goval){
+      foreach($new as $nkey => $nval){
+        if($gokey == $nval['num']){
+          /* sign this as OK */
+          $goFonMacroParameter[$gokey]['check']= true;
+        }
+      }
+    }
+
+    /* Now check if there is new parameter in the content, which is not assigned yet */
+    foreach($new as $key => $val){
+      /* Assign std values */
+      $goFonMacroParameter[$key]['var']="var".$key;
+      $goFonMacroParameter[$key]['check']= true;
+
+      /* If this is a new Parameter, name it ${ARG#} by default*/
+      if((!isset($goFonMacroParameter[$key]['name']))||(empty($goFonMacroParameter[$key]['name']))){
+        $goFonMacroParameter[$key]['name']="\${ARG".$key."}";
+      }
+    }  
+
+    foreach($goFonMacroParameter as $key => $val){
+      /* All attributes with check == false, are unneeded so mark them with ['check']= false */
+      if(!isset($goFonMacroParameter[$key]['check'])){
+        $goFonMacroParameter[$key]['check']= false;
+      }
+      /* Ah no default given assign ="" to prevent unsigned index  */
+      if(!isset($goFonMacroParameter[$key]['default'])){
+        $goFonMacroParameter[$key]['default'] = "";
+      }
+    }
+
+    /* Sort output for better reading */
+    asort($goFonMacroParameter);
+    return($goFonMacroParameter);
+
+  }
+
+  //! Execute this Plugin
+  /*! 
+      Perform Parameter check \n
+      Draw paramter table\n
+      Show tpl   \n 
+  */
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* Variables */
+    $vars      = "";
+    $tmp       = array();
+    $number = 0; 
+    /* Get acls for this tab, 
+        there is only one attribute to write,
+         so we use the acls from gofon/marco */
+    $ACLs = $this->ui->get_permissions($this->dn,"gofonmacro/macro","goFonMarcoContent");
+
+    /* get current content */ 
+    $content = $_SESSION['macroManagment']->macrotabs->by_object['macro']->goFonMacroContent;
+
+    if(strstr($content,"ARG")){
+      $vorpos = strpos($content,"ARG");
+      $rest   = substr($content,$vorpos, strlen($content));
+    }    
+
+    /* Do we represent a valid group? */
+    if (!$this->is_account && $this->parent === NULL){
+      $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\">&nbsp;<b>".
+        _("This 'dn' is no phone macro.")."</b>";
+      return ($display);
+    }
+
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+
+    /* Add an empty Parameter */
+    if(isset($_POST['addvar']) && preg_match("/w/",$ACLs)){
+      if(!is_array($this->goFonMacroParameter)){
+        $vars = $this->goFonMacroParameter;
+        $this->goFonMacroParameter = array();
+        $this->goFonMacroParameter[]= $vars;
+      }
+      $number= count($this->goFonMacroParameter);
+      $number++;
+      $this->goFonMacroParameter[]=array("var"=>"var","name"=>"new","type"=>"string","default"=>"test");
+    }
+
+    /*generate Table which shows als parameters */
+    $FonParas = $this->check_paras($content,$this->goFonMacroParameter); 
+
+    /* Sort by Parameterid, and keep keys */    
+    ksort($FonParas);
+
+    
+
+    if(!preg_match("/r/",$ACLs)){
+      $smarty->assign("readable",false);      
+    }else{
+      $smarty->assign("readable",true);      
+      foreach($FonParas as $key=>$para)        {
+
+        /* Select correct item of combobox */
+        if(isset($para['type'])){
+          list($sel1, $sel2, $sel3)= $this->type_shortcut[$para['type']];
+        }else{
+          list($sel1, $sel2, $sel3)= array("", "", "");
+        }
+   
+        /* Disable all input fields if we are not allowed to change the parameters */ 
+        $disabled = "";
+        if(!preg_match("/w/",$ACLs)){
+          $key = "";
+          $disabled = " disabled ";
+        }
+
+        /* Assemble output table */
+        $vars .="<tr>
+          <td>
+            <input name=\"number".$key."\" value='".$key."' type='hidden' ".$disabled.">
+            <input name='var".$key."' type='hidden'   value='".$para['var']."' ".$disabled.">ARG".$key."
+          </td>
+          <td><input size=\"45\" name='varname".$key."'  value='".$para['name']."' ".$disabled."></td>
+          <td>
+            <select name='vartype".$key."'  ".$disabled.">
+              <option  value='string' ".$sel1.">"._("String")."&nbsp;</option>
+              <option  value='combo'   ".$sel2.">"._("Combobox")."&nbsp;</option>
+              <option  value='bool'   ".$sel3.">"._("Bool")."&nbsp;</option>
+            </select>
+          </td>
+          <td><input size=\"45\" name='default".$key."'   value='".$para['default']."'  ".$disabled."></td>
+          <td>&nbsp;";
+        if($para['check']==false) {
+          $vars.="<input name='del".$key."' value='"._("Delete unused")."' type='submit'>";
+        }
+
+        $vars.=" </td></tr>";
+      }
+    }
+
+    /* Checkboxes */
+    $smarty->assign("base_select", $this->base);
+    $smarty->assign("vars", $vars);
+
+    /* Show main page */
+    return($smarty->fetch (get_template_path('parameter.tpl', TRUE)));
+  }
+  
+  //! Unused here 
+  /*!
+      Unused here because goFonMacro will remove this Macro\n 
+  */
+  function remove_from_parent()
+  {
+  }
+
+  //! Save our data
+  /*! 
+      Save POST data to object \n
+      This gives us the possibility to leave a tab, without losing our typed informations\n
+      \n
+      Read the POST fields for the parameters and saves their info the the class\n
+  */
+  function save_object()
+  {
+    if (isset($_POST['phoneparameters'])){
+      plugin::save_object();
+    }
+    /* read out post data, and assign it to the parameters */
+    /* And or delete */
+    foreach($_POST as $name=>$value){
+
+      /* Test if there is a variable begining with "del" */
+      if(preg_match("/del/",$name)){
+
+        /* Extract entry id to delete */
+        $nr = str_replace("del","",$name) ;
+
+        /* unset entry */
+        unset($this->goFonMacroParameter[$nr]);
+
+      }elseif(preg_match("/number/",$name)){
+
+        /* Set Post vars */
+        $key = $_POST[$name];
+    
+        $this->goFonMacroParameter[$key]['var']   = $_POST["var".$key];
+        $this->goFonMacroParameter[$key]['name']   = $_POST["varname".$key];
+        $this->goFonMacroParameter[$key]['type']   = $_POST["vartype".$key];
+        $this->goFonMacroParameter[$key]['default']= $_POST["default".$key];
+      }
+    }
+
+  }
+
+
+  //! Checks given values 
+  /*! 
+      Check values\n 
+      If a user enters an invalid value, then this function will output an error msg\n
+      (In better words :prepare the errormessages that will be put out )\n
+  */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    foreach($this->goFonMacroParameter as $key=>$val){
+      if((strstr($val['default'],"!"))||(strstr($val['default'],"#"))) {
+        $message[] = sprintf(_("The parameter %s contains invalid char. '!,#' is used as delimiter"),$val['name']);
+      }
+      switch($val['type']){
+        case 'bool'   :   $possible = array("","0","1");
+                          if(!in_array($val['default'],$possible)) {
+                            $message[] = sprintf(_("The parameter %s has incorrect value for type bool."),$val['name']);
+                          };break;
+        case 'string' :
+        case 'combo'  : 
+        default : ;
+
+      }
+    }
+    return $message;
+  }
+
+  //! Save changes to openldap
+  /*!
+      Save to LDAP 
+      This function saves given attributes to the ldap
+  */
+  function save()
+  {
+    /* Post checks */
+
+    plugin::save();
+
+    $this->attrs['goFonMacroParameter']=array();
+
+    foreach($this->goFonMacroParameter as $key=>$fonpara){
+      $this->attrs['goFonMacroParameter'][]=$key."!".base64_encode($fonpara['name'])."!".$fonpara['type']."!".$fonpara['default'];
+    }
+
+    if($this->para_count != count($this->attrs['goFonMacroParameter'])){
+      print_red(_("Parameter count of the macro changed, you must update each user which are using this macro '%s'."),$this->dn);
+    }
+
+    unset($this->attrs['base']);
+
+    /* Write back to ldap */
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cat($this->dn, array('dn'));
+    $a= $ldap->fetch();
+
+    if (count($a)){
+      $ldap->cd($this->dn);
+      $this->cleanup();
+      $ldap->modify ($this->attrs); 
+
+      $this->handle_post_events("modify");
+    } else {
+      if(count($this->attrs['goFonMacroParameter']==0)){
+        unset($this->attrs['goFonMacroParameter']);
+      }                
+      $ldap->cd($this->dn);
+      $ldap->create_missing_trees( $this->dn);
+      $ldap->cd($this->dn);
+      $ldap->add($this->attrs);
+      $this->handle_post_events("add");
+    }
+    show_ldap_error($ldap->get_error(), sprintf(_("Removing of goFonMacro/generic account with dn '%s' failed."),$this->dn));
+  }
+
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);
+
+    $source_o = new macroParameter($this->config,$source['dn']);
+    $this->goFonMacroParameter = $source_o-> goFonMacroParameter;
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/gofon/macro/generic.tpl b/gosa-core/plugins/gofon/macro/generic.tpl
new file mode 100755 (executable)
index 0000000..7bedc52
--- /dev/null
@@ -0,0 +1,83 @@
+<table width="100%" summary="">
+  <tr>
+    <td>
+                       <table summary="">
+                       <tr>
+                               <td><LABEL for="cn">{t}Macro name{/t}</LABEL>{$must}</td>
+                               <td>
+{render acl=$cnACL}
+                                       <input name="cn" id="id" size=13 maxlength=13 value="{$cn}" title="{t}Macro name{/t}">
+{/render}
+                               </td>
+                       </tr>
+                       <tr>
+                               <td><LABEL for="displayName">{t}Display name{/t}</LABEL>{$must}</td>
+                               <td>
+{render acl=$displayNameACL}
+                                       <input name="displayName" id="displayName" size=35 maxlength=60 value="{$displayName}" 
+                                               title="{t}Macro name to be displayed{/t}">
+{/render}
+                               </td>
+                       </tr>
+                       <tr>
+                                       <td colspan=2>
+                                       </td>
+                               </tr>
+                       <tr>
+                               <td><LABEL for="base">{t}Base{/t}</LABEL>{$must}</td>
+                               <td>
+                                       {render acl=$baseACL}
+                                             <select id="base" size="1" name="base" title="{t}Choose subtree to place group in{/t}">
+                                              {html_options options=$bases selected=$base_select}
+                                             </select>
+                                       {/render}
+
+                                       {render acl=$baseACL disable_picture='images/folder_gray.png'}
+                                               <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
+                                       {/render}
+
+                               </td>
+                       </tr>
+                       </table>
+               </td>
+               <td style="border-left:1px solid #A0A0A0">
+                    &nbsp;
+               </td>
+               <td style="vertical-align:top;">
+                       <table summary="">
+                       <tr>
+                               <td><LABEL for="description">{t}Description{/t}</LABEL></td>
+                               <td>
+{render acl=$descriptionACL}
+                                       <input name="description" id="description" size=35 maxlength=80 value="{$description}">
+{/render}
+                               </td>
+                       </tr>
+                       <tr>
+                               <td colspan=2>
+{render acl=$goFonMacroVisibleACL}
+                                       <input type="checkbox" name="goFonMacroVisible" size=35 maxlength=60 value="1" 
+                                               {$goFonMacroVisibleChecked}> {t}Visible for user{/t}
+{/render}
+                               </td>
+                       </tr>
+                       </table>
+               </td>
+       </tr>
+</table>
+<p class="seperator">&nbsp;</p>
+<br>
+{t}Macro text{/t}
+<br>
+{render acl=$goFonMacroContentACL}
+<textarea name="goFonMacroContent" style="width:99%;height:300px;font-size:14px;font-family:Arial;">{$goFonMacroContent}</textarea>
+{/render}
+
+<input type='hidden' name='gofonMacroGenericPosted' value='1'>
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('cn');
+  -->
+</script>
diff --git a/gosa-core/plugins/gofon/macro/headpage.tpl b/gosa-core/plugins/gofon/macro/headpage.tpl
new file mode 100755 (executable)
index 0000000..79a6fa2
--- /dev/null
@@ -0,0 +1,51 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
+<tr>
+  <td style="vertical-align:top;">
+  <div class="contentboxh">
+    <p class="contentboxh">
+     {t}List of macros{/t} {$hint}
+    </p>
+  </div>
+  <div class="contentboxb">
+      {$macroshead}
+  </div>
+  <div style='height:4px;'></div>
+  <div class="contentboxb" style="border-top:1px solid #B0B0B0;">
+      {$macros}
+    <input type=hidden name="edit_helper">
+  </div>
+  </td>
+  <td style="vertical-align:top">
+   <div class="contentboxh" style="border-bottom:1px solid #B0B0B0;">
+    <p class="contentboxh"><img src="{$infoimage}" align="right" alt="[i]">{t}Information{/t}</p>
+   </div>
+   <div class="contentboxb">
+   <p class="contentboxb">
+    {t}This menu allows you to add, edit and remove selected macros. You may want to use the range selector on top of the macro listbox, when working with a large number of macros.{/t}
+   </p>
+   </div>
+   <br>
+   <div class="contentboxh">
+    <p class="contentboxh"><img src="{$launchimage}" align="right" alt="[F]">{t}Filters{/t}</p>
+   </div>
+   <div class="contentboxb">
+     <table style="width:100%;border-top:1px solid #B0B0B0;" summary="">
+      {$alphabet}
+     </table>
+    <table style="width:100%;border-top:1px solid #B0B0B0;" summary="">
+               <tr>
+                       <td>
+                               <img alt="{t}Display macros matching{/t}" src="{$search_image}" align=middle title='{t}Display macros  matching{/t}'>
+                       </td>
+               <td width="99%">
+                               <input type='text' id='regex' name='regex' maxlength='20' value='{$regex}' style='width:99%;' title='{t}Regular expression for matching macro names{/t}' onChange="mainform.submit()">
+                       </td>
+               </tr>
+       </table>
+    {$apply}
+   </div>
+  </td>
+</tr>
+</table>
+
+<input type="hidden" name="ignore">
diff --git a/gosa-core/plugins/gofon/macro/main.inc b/gosa-core/plugins/gofon/macro/main.inc
new file mode 100755 (executable)
index 0000000..f35e23b
--- /dev/null
@@ -0,0 +1,61 @@
+<?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
+ */
+
+if ($remove_lock){
+  if(isset($_SESSION['macroManagement'])){
+    $macroManagment= $_SESSION['macroManagment'];
+    $macroManagment->remove_lock();
+    del_lock ($ui->dn);
+    sess_del ('macroManagment');
+  }
+} else {
+
+  /* Create macroManagment object on demand */
+  if (!isset($_SESSION['macroManagment']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+    $_SESSION['macroManagment']= new goFonMacro ($config, $_SESSION['ui']);
+  }
+
+  /* Get object */
+  $macroManagment= $_SESSION['macroManagment'];
+  $macroManagment->save_object();
+  $output= $macroManagment->execute();
+
+  /* Page header*/
+  if (isset($_SESSION['objectinfo'])){
+    $display= print_header( get_template_path('images/macros.png'), 
+                            _("Phone macro management"), 
+                            "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> 
+                            ".@LDAP::fix($_SESSION['objectinfo']));
+  } else {
+    $display= print_header(get_template_path('images/macros.png'), _("Phone macro management"));
+  }
+
+  /* Reset requested? */
+  if (isset($_GET['reset']) && $_GET['reset'] == 1){
+    del_lock ($ui->dn);
+    sess_del ('macroManagment');
+  }
+
+  /* Show and save dialog */
+  $display.= $output;
+  $_SESSION['macroManagment']= $macroManagment;
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/gofon/macro/parameter.tpl b/gosa-core/plugins/gofon/macro/parameter.tpl
new file mode 100755 (executable)
index 0000000..48e99cd
--- /dev/null
@@ -0,0 +1,28 @@
+{if $readable}
+<table width="100%" summary="">
+       <tr>
+               <td>{t}Argument{/t}
+               </td>
+               <td>{t}Name{/t}
+               </td>
+               <td>{t}type{/t}
+               </td>
+               <td>{t}Default value{/t}
+               </td>
+               <td>
+               &nbsp;
+               </td>
+       </tr>
+               {$vars}
+</table>
+{else}
+       <h2>{t}You are not allowed to view the macro parameter settings{/t}</h2>
+{/if}
+<input type="hidden" name="phoneparemeters">
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('cn');
+  -->
+</script>
diff --git a/gosa-core/plugins/gofon/macro/paste_generic.tpl b/gosa-core/plugins/gofon/macro/paste_generic.tpl
new file mode 100644 (file)
index 0000000..0f5acf4
--- /dev/null
@@ -0,0 +1,9 @@
+<table summary="">
+       <tr>
+       <td>
+                       <LABEL for="cn">{t}Macro name{/t}</LABEL>{$must}</td>
+               <td>
+                       <input name="cn" id="id" size=13 maxlength=13 value="{$cn}" title="{t}Macro name{/t}">
+               </td>
+       </tr>
+</table>
diff --git a/gosa-core/plugins/gofon/macro/remove.tpl b/gosa-core/plugins/gofon/macro/remove.tpl
new file mode 100755 (executable)
index 0000000..4dbd248
--- /dev/null
@@ -0,0 +1,23 @@
+<div style="font-size:18px;">
+  <img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
+</div>
+<p>
+ {$intro}
+ {t}This may be used by several groups. 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}So - if you're sure - press 'Delete' to continue or 'Cancel' to abort.{/t}
+</p>
+
+<p class="plugbottom">
+       {if $multiple}
+               <input type=submit name="delete_multiple_macro_confirm" value="{t}Delete{/t}">
+               &nbsp;
+               <input type=submit name="delete_multiple_macro_cancel" value="{t}Cancel{/t}">
+       {else}
+               <input type=submit name="delete_macro_confirm" value="{t}Delete{/t}">
+               &nbsp;
+               <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
+       {/if}
+</p>
+
diff --git a/gosa-core/plugins/gofon/macro/tabs_macros.inc b/gosa-core/plugins/gofon/macro/tabs_macros.inc
new file mode 100755 (executable)
index 0000000..5c5bcf6
--- /dev/null
@@ -0,0 +1,40 @@
+<?php
+
+class macrotabs extends tabs
+{
+
+  function macrotabs($config, $data, $dn,$category)
+  {
+         tabs::tabs($config, $data, $dn,$category);
+
+         /* Add references/acls/snapshots */
+         $this->addSpecialTabs();
+  }
+
+  function save($ignore_account= FALSE)
+  {
+       $baseobject= $this->by_object['macro'];
+
+       /* Check for new 'dn', in order to propagate the
+          'dn' to all plugins */
+       $new_dn= "cn=".$baseobject->cn.",ou=macros,ou=asterisk,ou=configs,ou=systems,".$baseobject->base;
+
+        /* Move group? */
+        if ($this->dn != $new_dn){
+
+                /* Write entry on new 'dn' */
+                if ($this->dn != "new"){
+                        $baseobject->move($this->dn, $new_dn);
+                        $this->by_object['macro']= $baseobject;
+                }
+
+                /* Happen to use the new one */
+                $this->dn= $new_dn;
+        }
+               
+       tabs::save();
+  }
+
+}
+
+?>
diff --git a/gosa-core/plugins/gofon/phoneaccount/class_phoneAccount.inc b/gosa-core/plugins/gofon/phoneaccount/class_phoneAccount.inc
new file mode 100644 (file)
index 0000000..6871854
--- /dev/null
@@ -0,0 +1,1512 @@
+<?php
+
+class phoneAccount extends plugin
+{
+  /* Definitions */
+  var $plHeadline= "Phone";
+  var $plDescription= "This does something";
+  var $has_mailAccount= FALSE;
+
+  /* Attributes */
+  var $telephoneNumber        = array();
+  var $goFonHardware          = "automatic";
+  var $goFonFormat            = "wav";
+  var $goFonPIN               = "";
+  var $goFonVoicemailPIN      = "";
+  var $goFonDeliveryMode      = "";
+  var $phoneNumbers           = array();
+  var $mail                   = "";
+  var $hardware_list          = array();
+  var $used_hardware          = array();
+  var $goFonMacro             = "";
+  var $macro                  = 0;              // Selected Macroi
+  var $lastmacro              = "";
+  var $macros                 = array();        // List of macros for smarty select box
+  var $macroarray             = array();        // All needed macro informations
+  var $macrostillavailable    = false;
+  var $generate_error         = "";
+  var $a_old_telenums         = array();
+  var $goFonPINVoice          = "";
+  var $goFonHomeServer        = "0";            // Contains the dn of the server that manage this account 
+  var $init_HomeServer        = "0";            // Contains the dn of the server that manage this account 
+  var $goFonHomeServers       = array();        // Contains all available server configurations 
+
+  /* CLI vars */
+  var $cli_summary            = "Manage users phone account";
+  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 $CopyPasteVars          = array("phoneNumbers","macroarray","macrostillavailable"/*"phoneNumbers" -Reset- */,
+                                      "hardware_list","used_hardware");
+
+  var $attributes             = array("goFonDeliveryMode", "goFonFormat","cn","goFonHomeServer",
+      "goFonHardware","goFonPIN","goFonVoicemailPIN","telephoneNumber", "goFonMacro","macro");
+  var $objectclasses= array("goFonAccount");
+
+  var $uid;
+
+  var $view_logged = FALSE;
+
+  function phoneAccount (&$config, $dn= NULL, $parent= NULL)
+  {
+    plugin::plugin ($config, $dn, $parent);
+
+    /* Assemble phone numbers */
+    if (isset($this->attrs['telephoneNumber'])){
+      for ($i= 0; $i<$this->attrs['telephoneNumber']['count']; $i++){
+        $number= $this->attrs['telephoneNumber'][$i];
+        $this->phoneNumbers[$number]= $number;
+      }
+    }
+
+    /* Set up has_mailAccount */
+    if (isset($this->attrs['objectClass'])){
+      if (in_array("gosaMailAccount", $this->attrs['objectClass'])){
+        $this->has_mailAccount= TRUE;
+      }
+    }
+
+    /* Set uid */
+    if((isset($this->parent->by_object['user']->uid))&&(!empty($this->parent->by_object['user']->uid))){
+      $this->uid = $this->parent->by_object['user']->uid;
+    }
+    if((isset($this->parent->by_object['user']->cn))&&(!empty($this->parent->by_object['user']->cn))){
+      $this->cn  = $this->parent->by_object['user']->cn;
+    }
+
+    /* Check server configurations 
+     * Load all server configuration in $this->goFonHomeServers if available
+     *  and first server as default if necessary.
+     * Check if connection is successfull for the selected server $this->goFonHomeServer
+     */
+
+  
+    /* Set available server */
+    if(isset($_SESSION['config']->data['SERVERS']['FON'])){
+      $this->goFonHomeServers = $_SESSION['config']->data['SERVERS']['FON'];
+    }
+
+    $a_SETUP= array();
+    if($this->is_account &&
+       array_key_exists('config',$_SESSION) &&
+       array_key_exists('SERVERS',$_SESSION['config']->data) &&
+       array_key_exists('FON',$_SESSION['config']->data['SERVERS']) &&
+       is_callable("mysql_connect")
+       ) {
+
+      /* Servers defined? Watch here... */
+      if (count($this->goFonHomeServers)){
+
+        /* Set default server */
+        if(empty($this->goFonHomeServer) || $this->goFonHomeServer == "0"){
+          $this->goFonHomeServer= $this->goFonHomeServers[0]['DN'];
+        }
+
+        /* Remember inital home server, to be able to remove old entries */
+        $this->init_HomeServer = $this->goFonHomeServer;
+
+        /* Get config */
+        if(!isset($this->goFonHomeServers[$this->goFonHomeServer])){
+          print_red(sprintf(_("The specified goFonHomeServer '%s' is not available in GOsa server configuration. Saving this account will create a new entry on the server '%s'. Use cancel if you do not want to create a new entry ignoring old accounts."),$this->goFonHomeServer, $this->goFonHomeServers[0]['DN']));
+
+          $this->goFonHomeServer = $this->goFonHomeServers[0]['DN'];
+          $this->init_HomeServer = $this->goFonHomeServers[0]['DN'];
+        }    
+        $cur_cfg = $this->goFonHomeServers[$this->goFonHomeServer];
+
+        $r_con =  @mysql_pconnect($cur_cfg['SERVER'],$cur_cfg['LOGIN'],$cur_cfg['PASSWORD']);
+        if(!$r_con){
+#          print_red( sprintf(_("The MySQL Server '%s' isn't reachable as user '%s', check GOsa log for mysql error."),
+#                $cur_cfg['SERVER'],$cur_cfg['LOGIN']));
+          new log("debug","gofonreport/".get_class($this),"",array(),@mysql_error());
+        }
+        $db  =  @mysql_select_db($cur_cfg['DB'],$r_con);
+        if(!$db){
+#          print_red(sprintf(_("Can't select database %s on %s."),$cur_cfg['DB'],$cur_cfg['SERVER']));
+          new log("debug","gofonreport/".get_class($this),"",array(),@mysql_error());
+        }
+
+        $first = false; 
+        foreach($this->phoneNumbers as $key => $val){
+          if(!$first){
+            $first = $key;
+          }
+        }
+      }
+    }
+
+    /* Get available phone hardware  
+     * Search for all available phone hardware  
+     */
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(objectClass=goFonHardware)", array('cn', 'description'));
+    while ($attrs= $ldap->fetch()){
+      $cn= $attrs['cn'][0];
+      if (isset($attrs['description'])){
+        $description= " - ".$attrs['description'][0];
+      } else {
+        $description= "";
+      }
+      $this->hardware_list[$cn]= "$cn$description";
+    }
+
+
+    /* Get available Macros  
+     * Search for all Marcos that are visible and create 
+     *  an array with name and parameters 
+     */
+    $ldap->search("(&(objectClass=goFonMacro)(goFonMacroVisible=1))", array("*"));
+
+    /* Add none for no macro*/
+    $this->macros['none']=_("no macro");    
+    $this->macro ="none";
+
+    /* Fetch all Macros*/
+    while ($attrs= $ldap->fetch()){
+
+      /* unset Count, we don't need that here */
+      unset($attrs['displayName']['count']);
+
+      /* Parse macro data, unset count for parameterarrays  */
+      if (isset($attrs['goFonMacroParameter']['count'])){
+        unset($attrs['goFonMacroParameter']['count']);
+      }
+
+      /* fill Selectfield variable with Macros */
+      if(isset($attrs['displayName'][0])){
+        $this->macros[$attrs['dn']] = $attrs['displayName'][0]." (".$attrs['cn'][0].")";
+      }else{
+        $this->macros[$attrs['dn']] = _("undefined");
+      }
+
+      /* Go through available parameters and parse all attributes, like parametername, type, default ...*/
+      if((isset($attrs['goFonMacroParameter']))&&(is_array($attrs['goFonMacroParameter']))){
+
+        foreach($attrs['goFonMacroParameter'] as $pkey=>$pval){
+          /* Split Data in readable values, by delimiter !  */
+          $data = split("!",$attrs['goFonMacroParameter'][$pkey]);
+
+          /* Set all attrs */
+          $id = $data[0];
+          $this->macroarray[$attrs['dn']][$id]['var']    ="var".$id;
+          $this->macroarray[$attrs['dn']][$id]['choosen']=$data[3]; 
+          $this->macroarray[$attrs['dn']][$id]['id']     =$id;
+          $this->macroarray[$attrs['dn']][$id]['name']   =$data[1];
+          $this->macroarray[$attrs['dn']][$id]['type']   =$data[2];
+          $this->macroarray[$attrs['dn']][$id]['default']=$data[3];
+          if($data[2] == "bool"){
+            $this->macroarray[$attrs['dn']][$id]['choosen']=$data[3];
+          }
+        }//foreach
+      }//is_array
+    }//while
+
+
+    /* Parse used Macro  
+     * If we have a macro selected, parse it and set values 
+     *  in $this->macroarray[$this->macro]. 
+     */
+    $tmp = split("!",$this->goFonMacro);
+    if(is_array($tmp)){
+
+      /* First value is the macroname */
+      $this->macro = $tmp[0];
+
+      /* Macroname saved, delete that index */
+      unset($tmp[0]);
+
+      /* Check if makro has been removed */
+      if(!isset($this->macros[$this->macro])){
+        $this->macrostillavailable = false;
+      }else{
+        $this->macrostillavailable = true;
+      }
+
+      /* for each parametervalues ( parameterID#value like 25#twentyfive) */
+      foreach($tmp as $var){
+
+        /* Split this, so we have $varar[0] = parameterID $varar[1] = SelectedValue */
+        $varar = split("#",$var);
+
+        /* Only insert if the parameter still exists */
+        if(isset($this->macroarray[$this->macro][$varar[0]])){
+          /* Assign value */
+          $this->macroarray[$this->macro][$varar[0]]['choosen']=$varar[1];
+        }
+      }
+    }
+
+
+    /* Colorize phones 
+     * Used phones will be colored in grey, 
+     *  so we must detect which phones are currently in use.
+     */
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(goFonHardware=*)",array('cn','dn','goFonHardware'));
+    while($attrs = $ldap->fetch()){
+        $cn = $attrs['goFonHardware'][0];
+        if(isset($this->hardware_list[$cn])){
+          $this->used_hardware[$cn]= $cn;
+        }
+    }
+    $this->hardware_list["automatic"]= _("automatic");
+    ksort($this->hardware_list);
+    $this->a_old_telenums = $this->phoneNumbers;
+
+    /* Get voicemail PIN from MySQL DB 
+     * Because every user can change his PIN directly from the phone
+     *  without any update to the ldap
+     * This means, the PIN in the DB is up to date
+     */
+    // Connect to DB server
+    if((is_callable("mysql_pconnect"))&&(isset($cur_cfg))&&(isset($cur_cfg['SERVER']))&&(isset($cur_cfg['LOGIN']))&&(isset($cur_cfg['PASSWORD']))){
+      $r_con =  @mysql_pconnect($cur_cfg['SERVER'],$cur_cfg['LOGIN'],$cur_cfg['PASSWORD']);
+      if($r_con){
+        $r_db  =  @mysql_select_db($cur_cfg['DB'],$r_con);
+  
+        $query_tmp = "SELECT ".$cur_cfg['VOICE_TABLE'].".password FROM  ".$cur_cfg['VOICE_TABLE'].", ".
+                     $cur_cfg['SIP_TABLE']."  WHERE customer_id = sip_users.mailbox AND name='".$this->uid."'";
+
+        $vp = mysql_fetch_row(mysql_query($query_tmp));
+        @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query_tmp, "Database query");
+        if((isset($vp[0]))&&(!empty($vp[0]))){
+          $this->goFonPINVoice = $vp[0];
+        }
+      }
+    }
+    $this->lastmacro=$this->macro;
+
+    if(is_callable("mysql_close")&&(isset($r_con))&&($r_con)){
+      @mysql_close($r_con) ;
+    }
+  }
+
+
+  /* This function generates the Database entries. 
+   * The Parameter 'save' could be true or false.
+   *  false - means only testing no database transactions.
+   *  true  - write database entries.
+   *
+   * 'sip_users','voice_mail' and 'extensions' table entries will be created.
+   * 
+   * If the phone hardware is 'automatic' the table entries will only be removed
+   *  and not added. 
+   */
+  function generate_mysql_entension_entries($save = false)
+  {
+    /* Check if there is at least one server available 
+     * If not, return and tell the user that saving failed 
+     */
+    if(!count($this->goFonHomeServers)){
+      if($save){
+        print_red(_("There is currently no asterisk server defined. Possibly you are missing a server that handles the asterisk management (goFonServer). Your settings can't be saved to asterisk database."));
+      }
+      return(true);
+    }
+
+    /* Check if Mysql extension is available */
+    if(!is_callable("mysql_pconnect")){
+      if($save)
+      print_red(_("Can't save any changes to asterisk database, there is no mysql extension available."));
+      return(true);
+    }
+    /********************** 
+     * Attribute Initialisation
+     **********************/
+
+    $old_connection = false;
+
+    // Get Configuration for Mysql database Server
+    $s_parameter    = "";                                           // Contains paramter for selected Macro 
+    $r_con          = false;                                        // DB connection
+    $r_db           = false;                                        // Selected DB
+    $r_res          = false;                                        // Result resource
+    $a_ldap_attrs   = array();                                      //  
+
+    $s_ip           = NULL;                   // Contains ip for Sip entry
+    $s_host         = NULL;                   // Contains host for Sip entry
+    $s_qualify      = "yes";                  // Qualify entry
+    $s_pin          = NULL;                   // Entry for secret
+    $s_type         = NULL;                   // Entry for phone type (friend , peer ..)
+
+    $sip_data_array = array();                // Contains complete sip entry, to generate SQL syntax
+    $i_old_key      = false;                  // Contains index for first old phonenumber, to delete old entries corectly
+    $i_new_key      = false;                  // Contains index for first new phonenumber, to generate new  entries corectly
+
+    $s_sip_values   = "";     // Contains string with all values for given attributes in SQL syntax
+    $s_sip_keys     = "";     // Contains all needed attributes to generate sip entry in DB
+
+    $s_sip_key      = "";     // Key for SIP entry index      
+    $s_sip_val      = "";     // Value for SIP entry index      
+
+    $b_first_deleted= false;  // Only delete first entry, 
+    $s_telenums     = "";     // for each value variable
+
+    $i_is_accounted = false;  // Ensure that extension entry, for name to number is only once in table
+
+    restore_error_handler();
+
+    /* Prepare some basic attributes */
+    foreach($this->a_old_telenums as $tele){
+      $oldnums[]= preg_replace("/[^0-9]/","",$tele);
+    }
+    foreach($this->phoneNumbers as $tele){
+      $newnums[]= preg_replace("/[^0-9]/","",$tele);
+    }
+
+    /* If deletion starts from userslist, cn uid are not set */
+    if((isset($this->parent->by_object['user']->uid))&&(!empty($this->parent->by_object['user']->uid))){
+      $this->uid = $this->parent->by_object['user']->uid;
+    }
+    if((isset($this->parent->by_object['user']->cn))&&(!empty($this->parent->by_object['user']->cn))){
+      $this->cn  = $this->parent->by_object['user']->cn;
+    }
+    /* Create voicemail entry 
+     */
+    if((!isset($this->cn))||(empty($this->cn))){
+      $CNname= $this->uid;
+    }else{
+      $CNname= $this->cn;
+    }
+
+    if((isset($this->parent))&&(isset($this->parent->by_object['mailAccount']))&&($this->parent->by_object['mailAccount']->is_account==true)){
+      $s_mail = $this->parent->by_object['mailAccount']->mail;
+    }else{
+      $s_mail = "";
+    }
+    /* Get phonehardware to setup sip entry  */
+    $ldap         = $this->config->get_ldap_link();
+    $r_res        = $ldap->search("(&(objectClass=goFonHardware)(cn=".$this->goFonHardware."))", array('*'));
+    $a_ldap_attrs = $ldap->fetch();
+
+    /* Check selected phone hardware, is a default IP set? */
+    if(((isset($a_ldap_attrs['goFonDefaultIP'][0]))&&($a_ldap_attrs['goFonDefaultIP'][0] != "dynamic"))){
+      $s_ip       = $a_ldap_attrs['goFonDefaultIP'][0];
+      $s_host     = $s_ip;
+    }else{
+      $s_ip       = NULL;
+      $s_host     = "dynamic";
+    }
+
+    // Attribute GoFonQualify set ?
+    if(isset($a_ldap_attrs['goFonQualify'])){
+      $s_qualify = $a_ldap_attrs['goFonQualify'][0];
+    }
+
+    // Attribute GoFonPIN set ?
+    if(isset($this->goFonPIN)){
+      $s_pin      = $this->goFonPIN;
+    }
+
+    // Attribute GoFonType set ?
+    if(isset($a_ldap_attrs['goFonType'])){
+      $s_type = $a_ldap_attrs['goFonType'][0];
+    }
+
+    if(isset($a_ldap_attrs['goFonDmtfMode'][0])){
+      $sip_data_array['dtmfmode']     = $a_ldap_attrs['goFonDmtfMode'][0];
+    }else{
+      $sip_data_array['dtmfmode']     ="rfc2833";
+    }
+
+    /* Check if phone number is used */
+    if($this->is_number_used()){
+      $this->generate_error = $this->is_number_used(); 
+      return false;
+    }
+
+
+
+    /********************** 
+     * Check Server Connection Information
+     **********************/
+    /* Create Mysql handle for the current goFonHomeServer, if possible  
+     * Get configuration to old asterisk home server 
+     */ 
+    $a_New = $this->goFonHomeServers[$this->goFonHomeServer];  // DB Configuration
+    $new_connection =  @mysql_pconnect($a_New['SERVER'],$a_New['LOGIN'],$a_New['PASSWORD']);
+    if(!$new_connection){
+      $this->generate_error = sprintf(
+          _("The MySQL Server '%s' isn't reachable as user '%s'. Abort saving entries to keep the database consistent, check GOsa log for mysql error."),
+          $a_New['SERVER'],$a_New['LOGIN']);
+      new log("debug","gofonreport/".get_class($this),"",array(),@mysql_error($new_connection));
+      return false;
+    }
+    $new_database  =  @mysql_select_db($a_New['DB'],$new_connection);
+    if(!$new_database){
+      $this->generate_error = sprintf(
+          _("Can't select database %s on %s. Abort saving entries to keep the database consistent, check GOsa log for mysql error."),
+          $a_New['DB'],$a_New['SERVER']);
+      new log("debug","gofonreport/".get_class($this),"",array(),@mysql_error($new_connection));
+      return false;
+    }
+
+    /* If the home server has changed, we must remove entries from old 
+     *  server and add new entries in new server.  
+     */
+    if($this->init_HomeServer != $this->goFonHomeServer){
+    
+      /* Get configuration to old asterisk home server */ 
+      $a_Remove = $this->goFonHomeServers[$this->init_HomeServer];  // DB Configuration
+      /* Create connection to the database that contains the old entry. 
+       */
+      $old_connection =  @mysql_pconnect($a_Remove['SERVER'],$a_Remove['LOGIN'],$a_Remove['PASSWORD']);
+      if(!$old_connection){
+        $this->generate_error = sprintf(
+            _("The old MySQL home server '%s' isn't reachable as user '%s'. Abort saving entries to keep the database consistent, check GOsa log for mysql error."),
+            $a_Remove['SERVER'],$a_Remove['LOGIN']);
+        new log("debug","gofonreport/".get_class($this),"",array(),@mysql_error($old_connection));
+        return false;
+      }
+      $old_database  =  @mysql_select_db($a_Remove['DB'],$old_connection);
+      if(!$old_database){
+        $this->generate_error = sprintf(
+            _("Can't select database %s on %s. Abort saving entries to keep the database consistent, check GOsa log for mysql error."),
+            $a_Remove['DB'],$a_Remove['SERVER']);
+        new log("debug","gofonreport/".get_class($this),"",array(),@mysql_error($old_connection));
+        return false;
+      }
+    }
+
+    /* Save means that we must save changes, not only test  */
+    if($save == true){
+    
+      /********************** 
+       * Remove entries from old home server 
+       **********************/
+
+      /* Check if there is an old entry 
+       * If there is an old entry, get callerid and remove voicemail and extensions 
+       */
+      if($old_connection){
+        $query  = "SELECT id,name,callerid FROM ".$a_Remove['SIP_TABLE']." WHERE name='".$this->uid."';";
+        $rid    = mysql_query($query,$old_connection);
+        @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query, "Database query");
+
+        /* Old entry found, remove it */
+        $query_a = array();
+        if(mysql_affected_rows($old_connection)){
+          $result = mysql_fetch_assoc($rid);
+          $query_a[]= "DELETE FROM ".$a_Remove['SIP_TABLE']." WHERE name='".$this->uid."';";
+          $query_a[]= "DELETE FROM ".$a_Remove['VOICE_TABLE']." WHERE customer_id='".$result['callerid']."';";
+          $query_a[]= "DELETE FROM ".$a_Remove['EXT_TABLE']." WHERE exten='".$this->uid."';";
+          foreach($oldnums as $s_telenums) {
+            $query_a[]= "DELETE FROM ".$a_Remove['EXT_TABLE']." WHERE exten='".$s_telenums."';";
+          }
+
+          foreach($query_a as $qry){
+                 @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$qry, "Database query");
+            if(!mysql_query($qry,$old_connection)){
+              echo mysql_error($old_connection);
+            } 
+          }
+        }
+      }
+
+      /********************** 
+       * Update / Insert sip_users entry  
+       **********************/
+
+      /* Set the first given phone number as callerid */
+      reset($newnums);        
+      $i_new_key = key($newnums);
+      $sip_data_array['callerid']  =$newnums[$i_new_key];
+      $sip_data_array['mailbox']   =$newnums[$i_new_key];
+
+      /* Check if there is already an entry in sip_users for this uid */
+      $SQL_query_array = array();
+      $query = "SELECT * FROM ".$a_New['SIP_TABLE']." WHERE name='".$this->uid."';\n"; 
+      $rid = mysql_query($query,$new_connection);
+      @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query, "Database query");
+      if(mysql_affected_rows($new_connection)){
+
+        /********************** 
+         * Update sip_users entry 
+         **********************/
+        $result                     = mysql_fetch_assoc($rid);
+        $sip_data_array['host']         = $s_host;
+        $sip_data_array['qualify']      = $s_qualify;
+        $sip_data_array['secret']       = $this->goFonPIN;
+        $sip_data_array['type']         = $s_type ;
+        $sip_data_array['username']     = $this->uid;
+        $sip_data_array['ipaddr']       = $s_ip;
+
+        /* Remove not changed attributes, to avoid updating table with same values */
+        foreach($sip_data_array as $name => $value){
+          if($result[$name] == $value){
+            unset($sip_data_array[$name]);
+          }
+        }
+        /* Only update entry if there is something to uopdate */
+        if(count($sip_data_array)){
+          $query = "UPDATE ".$a_New['SIP_TABLE']." SET ";
+          foreach($sip_data_array as $key => $val){
+            $query.= "".$key."='".$val."',"; 
+          } 
+          $query = preg_replace("/,$/","",$query);
+          $query.= " WHERE name='".$this->uid."';";
+          $SQL_query_array[] = $query;
+        }
+      } else {
+        /********************** 
+         * Insert sip_users entry 
+         **********************/
+        //generate SIP entry
+        $sip_data_array['id']           = "";
+        $sip_data_array['name']         = $this->uid;
+        $sip_data_array['accountcode']  = NULL;          
+        $sip_data_array['amaflags']     = NULL;
+        $sip_data_array['callgroup']    = NULL;
+        $sip_data_array['canreinvite']  = "no";
+        $sip_data_array['context']      = "default";
+        $sip_data_array['defaultip']    = NULL;
+        $sip_data_array['fromuser']     = NULL;
+        $sip_data_array['fromdomain']   = NULL;
+        $sip_data_array['host']         = $s_host;
+        $sip_data_array['insecure']     = NULL;
+        $sip_data_array['language']     = NULL;
+        $sip_data_array['mailbox']      = $newnums[$i_new_key];
+        $sip_data_array['md5secret']    = NULL;
+        $sip_data_array['nat']          = "no";
+        $sip_data_array['permit']       = NULL;
+        $sip_data_array['deny']         = NULL;
+        $sip_data_array['mask']         = NULL;
+        $sip_data_array['pickupgroup']  = NULL;
+        $sip_data_array['port']         = NULL;
+        $sip_data_array['qualify']      = $s_qualify;
+        $sip_data_array['restrictcid']  = "n";
+        $sip_data_array['rtptimeout']   = NULL;
+        $sip_data_array['rtpholdtimeout']=NULL;
+        $sip_data_array['secret']       = $this->goFonPIN;
+        $sip_data_array['type']         = $s_type ;
+        $sip_data_array['username']     = $this->uid;
+        $sip_data_array['disallow']     = NULL;
+        $sip_data_array['allow']        = NULL;
+        $sip_data_array['musiconhold']  = NULL;
+        $sip_data_array['regseconds']   = NULL;
+        $sip_data_array['ipaddr']       = $s_ip;
+        $sip_data_array['regexten']     = NULL;
+        $sip_data_array['cancallforward']=NULL;
+
+        /* There is currently no entry for this user in the sip_users table. 
+         * We should create one i
+         */
+        foreach($sip_data_array as $s_sip_key=>$s_sip_val){
+          if($s_sip_val === NULL) continue;
+          $s_sip_values.="'".$s_sip_val."',";
+          $s_sip_keys  .="`".$s_sip_key."`,";
+        }
+        $s_sip_values =  preg_replace("/,$/","",$s_sip_values);
+        $s_sip_keys   =  preg_replace("/,$/","",$s_sip_keys);
+
+        /* Add sip entries to mysql queries */
+        $SQL_query_array[] ="INSERT INTO ".$a_New['SIP_TABLE']." (".$s_sip_keys.") VALUES (".$s_sip_values.");";
+      }
+
+
+      /********************** 
+       * Update / Insert Voice mail entry  
+       **********************/
+
+      $customer_id = $newnums[$i_new_key];
+
+      $voice_data_array = array(
+          "customer_id" => $customer_id,
+          "mailbox"     => $customer_id,
+          "password"    => $this->goFonVoicemailPIN,
+          "fullname"    => $CNname,
+          "email"       => $s_mail);
+
+      /* Set pager number if available */
+      if(isset($this->parent->by_object['user']->pager)){
+        $voice_data_array['pager']   = $this->parent->by_object['user']->pager;
+      }
+
+      /* Check if there is already an entry in sip_users for this uid */
+      $query_tmp = "SELECT * FROM ".$a_New['VOICE_TABLE']." WHERE customer_id='".$customer_id."';\n";
+      $rid = mysql_query($query_tmp,$new_connection);
+      @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query_tmp, "Database query");
+      if(mysql_affected_rows($new_connection)){
+
+        /********************** 
+         * Update Voice mail entry  
+         **********************/
+        $result = mysql_fetch_assoc($rid)  ;
+
+        foreach($voice_data_array as $name => $value){
+          if($result[$name] == $value){
+            unset($voice_data_array[$name]);
+          }
+        }
+
+        /* Only update entry if there is something to uopdate */
+        if(count($voice_data_array)){
+          $query = "UPDATE ".$a_New['VOICE_TABLE']." SET ";
+          foreach($voice_data_array as $key => $val){
+            $query.= "".$key."='".$val."',"; 
+          } 
+          $query = preg_replace("/,$/","",$query);
+          $query.= " WHERE customer_id='".$customer_id."';";
+          $SQL_query_array[] = $query;
+        }
+      }else{
+
+        /********************** 
+         * Insert Voice mail entry  
+         **********************/
+        $voice_data_array['context'] = "default";
+  
+        /* There is currently no voice mail entry for this user. 
+         * We should create one 
+         */
+        $s_voi_values = $s_voi_keys = "";
+        foreach($voice_data_array as $s_voi_key=>$s_voi_val){
+          if($s_voi_val === NULL) continue;
+          $s_voi_values.="'".$s_voi_val."',";
+          $s_voi_keys  .="`".$s_voi_key."`,";
+        }
+        $s_voi_values =  preg_replace("/,$/","",$s_voi_values);
+        $s_voi_keys   =  preg_replace("/,$/","",$s_voi_keys);
+
+        /* Add sip entries to mysql queries */
+        $SQL_query_array[] ="INSERT INTO ".$a_New['VOICE_TABLE']." (".$s_voi_keys.") VALUES (".$s_voi_values.");";
+      }
+
+     
+      /********************** 
+       * Remove/Insert extension entries
+       **********************/
+      
+      /* Remove old entries */
+      $query = array();
+      $query[]= "DELETE FROM ".$a_New['EXT_TABLE']." WHERE exten=\"".$this->uid."\";";
+      foreach($oldnums as $s_telenums){
+        $query[]= "DELETE FROM ".$a_New['EXT_TABLE']." WHERE exten=\"".$s_telenums."\";";
+      }
+      foreach($newnums as $s_telenums){
+        $query[]= "DELETE FROM ".$a_New['EXT_TABLE']." WHERE exten=\"".$s_telenums."\";";
+      }
+      foreach($query as $qry){
+        @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$qry, "Database query");
+        if(!mysql_query($qry,$new_connection)){
+          echo mysql_error($new_connection);
+        } 
+      }
+      /********************** 
+       * Insert extension entries
+       **********************/
+      // Get selected Macro Parameter and create parameter entry 
+      if(isset($this->macroarray[$this->macro])){
+        foreach($this->macroarray[$this->macro] as $key => $val ){
+          $s_parameter .= $val['choosen']."|";
+        }
+        $s_parameter = preg_replace("/\|$/","",$s_parameter);
+      }
+     
+      $i = 0; 
+      $EXT = array();
+      if(!is_numeric($this->uid)){
+        $EXT[$i]['context'] = 'GOsa';
+        $EXT[$i]['exten']   = $this->uid;
+        $EXT[$i]['priority']= 1;
+        $EXT[$i]['app']     = "Goto";
+        $EXT[$i]['appdata'] = $newnums[$i_new_key]."|1";
+        $i ++;
+      }
+
+      // Entension entries  Hint / Dial / Goto
+      foreach($newnums as $s_telenums){
+
+        /* Hint Entry */
+        $EXT[$i]['context'] = 'GOsa';
+        $EXT[$i]['exten']   = $s_telenums;
+        $EXT[$i]['priority']= "Hint";
+        $EXT[$i]['app']     = 'SIP/'.$this->uid;
+        $i ++;  
+        /* SetCID */
+        //$EXT[$i]['context'] = 'GOsa';
+        //$EXT[$i]['exten']   = $s_telenums;
+        //$EXT[$i]['priority']= 1;
+        //$EXT[$i]['app']     = "SetCIDName";
+        //$EXT[$i]['appdata'] = $CNname;
+        //$i ++;  
+
+        // If no macro is selected use Dial
+        if($this->macro!="none"){ 
+          $macroname = preg_replace("/,.*$/","",$this->macro);        
+          $macroname = preg_replace("/^.*=/","",$macroname);        
+          $s_app = "Macro";$macroname;
+          $s_par = $macroname."|".$s_parameter; 
+        }else{
+          $s_app = "Dial";
+          $s_par = 'SIP/'.$this->uid."|20|r";
+        }
+
+        $EXT[$i]['context'] = 'GOsa';
+        $EXT[$i]['exten']   = $s_telenums;
+        $EXT[$i]['priority']= 1;
+        $EXT[$i]['app']     = $s_app;
+        $EXT[$i]['appdata'] = $s_par;
+        $i ++;
+      }
+
+      // Append all these Entries 
+      foreach($EXT as $entr){
+        $SQL_syn = "INSERT INTO ".$a_New['EXT_TABLE']." (";
+        foreach($entr as $key2 => $val2){
+          $SQL_syn.= "`".$key2."`,";
+        }
+        $SQL_syn = preg_replace("/,$/","",$SQL_syn);
+        $SQL_syn .= ") VALUES ("; 
+        foreach($entr as $key2 => $val2){
+          $SQL_syn .= "'".$val2."',";
+        }
+        $SQL_syn = preg_replace("/,$/","",$SQL_syn);
+        $SQL_syn .=");\n";
+
+        $SQL_query_array[] =$SQL_syn;
+        $SQL_syn ="";
+      }
+
+      // Perform queries ...
+      if($this->goFonHardware != "automatic"){
+        foreach($SQL_query_array as $query){
+          @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query, "Database query");
+          if(!@mysql_query($query,$new_connection)){
+            print_red(_("Error while performing query:")." ".mysql_error());
+            return false;
+          }
+        }
+      }
+    }
+    @mysql_close($new_connection);
+    return true;
+  }
+
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* Log view */
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","users/".get_class($this),$this->dn);
+    }
+
+    $display = "";
+    $SkipWrite = (!isset($this->parent) || !$this->parent) && !isset($_SESSION['edit']);
+    if(empty($this->macro)&&(!empty($this->goFonMacro))){
+
+      /* Go through already saved values, for a parameter */
+      $tmp = split("!",$this->goFonMacro);
+
+      /* it is possible that nothing has been saved yet */
+      if(is_array($tmp)){
+
+        /* First value is the macroname */
+        $this->macro = $tmp[0];
+
+        /* Macroname saved, delete that index */
+        unset($tmp[0]);
+
+        /* Check if macro has been removed */
+        if(!isset($this->macroarray[$this->macro])){
+          $this->macrostillavailable = false;
+        }else{
+          $this->macrostillavailable = true;
+        }
+
+        /* for each parametervalues ( parameterID#value like 25#twentyfive) */
+        foreach($tmp as $var){
+
+          /* Split this, so we have $varar[0] = parameterID $varar[1] = SelectedValue */
+          $varar = split("#",$var);
+
+          /* Only insert if the parameter still exists */
+          if(isset($this->macroarray[$this->macro][$varar[0]])){
+            /* Assign value */
+            $this->macroarray[$this->macro][$varar[0]]['choosen']=$varar[1];
+          }
+        }
+      }
+    }
+    
+    /* Do we represent a valid account? */
+    if (!$this->is_account && $this->parent === NULL){
+      $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\">&nbsp;<b>".
+        _("This account has no phone extensions.")."</b>";
+      $display.= back_to_main();
+      return ($display);
+    }
+
+    /* Do we need to flip is_account state? */
+    if (isset($_POST['modify_state'])){
+      $this->is_account= !$this->is_account;
+    }
+
+    /* Select no macro if, state is empty, this is the case, if the selected macro is no longer available */
+    if(empty($this->macro)){
+      $this->macro ="none";
+    }
+
+    /* Prepare templating */
+    $smarty= get_smarty();
+
+    /* tell user that the selected plugin is no longer available */
+    if((!$this->macrostillavailable)&&($this->macro!="none")){
+      print_red(_("The macro you selected, is no longer available for you, please choose another one."));
+    }
+
+    /* Assing macroselectbox values  */
+    $smarty->assign("macros",$this->macros);   
+    $smarty->assign("macro", $this->macro);   
+
+    /* check if there is a FON server created */
+    if(!count($this->goFonHomeServer)){
+      print_red(_("There is currently no asterisk server defined. Possibly you are missing a server that handles the asterisk management (goFonServer). Your settings can't be saved to asterisk database."));
+    }
+
+    /* Create html parameter table for selected macro parameters 
+     *  skip if no parameters given 
+     */
+    if(!isset($this->macroarray[$this->macro])){
+      $macrotab="";
+    }else{
+
+      $macrotab ="<table summary=\""._("Parameter")."\">";
+      /* for every single parameter-> display textfile,combo, or true false switch*/
+
+      foreach($this->phoneNumbers as $phonenum){
+        $tmp[] = $phonenum;
+      }
+    
+      if($this->macro != $this->lastmacro){
+        /* Go through all params */
+        foreach($this->macroarray[$this->macro] as $key => $paras){
+
+          $string = $paras['default'];
+
+          $string=preg_replace("/%uid/i",$this->uid,$string);
+
+          if(isset($this->cn)){
+            $string=preg_replace("/%cn/i",$this->cn,$string);
+          }
+
+          for($i = 0 ; $i < 10; $i++){
+            if(isset($tmp[$i])){
+              $string = preg_replace("/%telephoneNumber_".($i+1)."/i",$tmp[$i],$string);
+            }
+          }
+          if(isset($tmp[0])){
+            $string = preg_replace("/%telephoneNumber/i",$tmp[0],$string);
+          }
+          $this->macroarray[$this->macro][$key]['choosen']=$string;
+        }
+      }
+
+      foreach($this->macroarray[$this->macro] as $paras){
+
+        /* get al vars */
+        $var        = $paras['var'];           
+        $name       = $paras['name'];           
+        $default    = $paras['default'];
+        $type       = $paras['type'];
+        $choosen    = $paras['choosen'] ; 
+        $str        = $default;
+
+        $dis = "";
+        if(!$this->acl_is_writeable("goFonMacro",$SkipWrite)){
+          $dis = " disabled ";
+        }
+
+        /* in case of a combo box display a combobox with selected attr */
+        $macrotab.= "<tr>";
+        switch ($type){
+
+          case "combo":
+            $str= "<select name='".$var."' ".$dis." >";
+          foreach(split(":",$default) as $choice){
+            if($choosen==$choice){
+              $str.= "\n<option value='".$choice."' selected>".$choice."&nbsp;</option>";
+            }else{
+              $str.= "\n<option value='".$choice."'>".$choice."&nbsp;</option>";
+            }
+          }
+          $str.="</select>";
+          $macrotab.= "<td>".base64_decode($name)."</td><td>$str";
+          break;
+
+          case "bool":
+            if(!$choosen){
+              $str="\n<input type='checkbox' name='".$var."' value='1' ".$dis." >";
+            }else{
+              $str="\n<input type='checkbox' name='".$var."' value='1' checked  ".$dis.">";
+            }
+          $macrotab.= "<td colspan='2'>$str&nbsp;".base64_decode($name)."";
+          break;
+
+          case "string":
+            $str="<input name='".$var."' value='".$choosen."' ".$dis." style='width:340px;'>";
+          $macrotab.= "<td>".base64_decode($name)."</td><td>$str";
+          break;
+
+        }
+        $macrotab.= "</td></tr>";
+
+      }
+      $macrotab.="</table><input name='post_success' type='hidden' value='1'>";
+    }//is_array()
+
+    /* Give smarty the table */
+    $smarty->assign("macrotab",$macrotab);
+
+
+    /* Do we represent a valid account? */
+    if (!$this->is_account && $this->parent === NULL){
+      $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\">&nbsp;<b>".
+        _("This account has no phone extensions.")."</b>";
+      $display.= back_to_main();
+      return($display);
+    }
+
+    $display= "";
+ /* Show tab dialog headers */
+    if ($this->parent !== NULL){
+      if ($this->is_account){
+        $display= $this->show_disable_header(_("Remove phone account"),
+            _("This account has phone features enabled. You can disable them by clicking below."));
+      } else {
+        if(empty($this->uid)){
+          $display= $this->show_enable_header(_("Create phone account"),
+              _("This account has phone features disabled. You can't enable them while no uid is set."),TRUE,TRUE);
+        }else{
+          $display= $this->show_enable_header(_("Create phone account"),
+              _("This account has phone features disabled. You can enable them by clicking below."));
+        }
+        return ($display);
+      }
+    }
+
+    /* Add phone number */
+    if (isset($_POST["add_phonenumber"]) && $_POST['phonenumber']){
+      if (is_phone_nr($_POST['phonenumber'])){
+        $number= $_POST["phonenumber"];
+        $this->phoneNumbers[$number]= $number;
+        $this->is_modified= TRUE;
+      } else {
+        print_red(_("Please enter a valid phone number!"));
+      }
+    }
+
+    /* Remove phone number */
+    if (isset($_POST["delete_phonenumber"]) && isset($_POST["phonenumber_list"])){
+      foreach ($_POST['phonenumber_list'] as $number){
+        unset($this->phoneNumbers[$number]);
+        $this->is_modified= TRUE;
+      }
+    }
+
+    /* Assign acls */
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+    /* Transfer ACL's */
+    foreach($this->attributes as $val){
+      if(isset($this->$val)){
+        $smarty->assign($val,$this->$val);
+      }else{
+        $smarty->assign($val,"");
+      }
+    }
+
+    /* Create home server array */
+    $tmp = array();
+    foreach($this->goFonHomeServers as $dn => $attrs){
+      if(!is_numeric($dn)){
+        $tmp[$dn] = $attrs['SERVER'];
+      }
+    }
+    $smarty->assign("goFonHomeServers",$tmp);
+
+    /* Fill arrays */
+    $smarty->assign ("goFonHardware", $this->goFonHardware);
+    if (!count($this->phoneNumbers)){
+      $smarty->assign ("phoneNumbers", array());
+    } else {
+      $smarty->assign ("phoneNumbers", $this->phoneNumbers);
+    }
+
+    $dis = "";
+    if(!$this->acl_is_writeable("goFonHardware",$SkipWrite)){
+      $dis= " disabled ";
+    }
+    $hl= "<select size=\"1\" name=\"goFonHardware\" ".$dis." title=\"".
+       _("Choose your private phone")."\">\n";
+
+    foreach ($this->hardware_list as $cn => $description){
+      if ($cn == $this->goFonHardware){
+        $selected= "selected";
+      } else {
+        $selected= "";
+      }
+      if (isset($this->used_hardware[$cn])){
+        $color= "style=\"color:#A0A0A0\"";
+      } else {
+        $color= "";
+      }
+      $hl.= "  <option $color label=\"$cn\" value=\"$cn\" $selected>$description&nbsp;</option>\n";
+    }
+    $hl.= "</select>\n";
+    $smarty->assign ("hardware_list", $hl);
+
+    /* Show main page */
+    $this->lastmacro = $this->macro;
+    $display.= $smarty->fetch(get_template_path('generic.tpl', TRUE, dirname(__FILE__)));
+    return($display);
+  }
+
+
+  function save_object()
+  {
+    $SkipWrite = (!isset($this->parent) || !$this->parent) && !isset($_SESSION['edit']);
+    if (isset($_POST["phoneTab"])){
+    
+      plugin::save_object();
+
+      /* Save checkbox */
+      $tmp = preg_replace("/[^a-z]/i","",$this->goFonDeliveryMode);
+      if($this->acl_is_writeable("goFonDeliveryMode",$SkipWrite)){
+        if(isset($_POST['fon_to_mail']) && !preg_match("/M/",$this->goFonDeliveryMode)){
+          $tmp .= "M";
+        }elseif(!isset($_POST['fon_to_mail']) && preg_match("/M/",$this->goFonDeliveryMode)){
+          $tmp  = preg_replace ("/M/","",$tmp);
+        }
+      }
+      $this->goFonDeliveryMode= "[".$tmp."]";
+
+
+      /* Every macro in the select box are available */
+      if((isset($_POST['macro']))){
+        $this->macrostillavailable=true;
+      }
+
+      if(isset($_POST['macro']) && $_POST['macro'] != $this->macro){
+        $this->is_modified =true;
+      }
+
+      if(is_array($this->phoneNumbers)){
+        foreach($this->phoneNumbers as $telenumms) {
+          $nummsinorder[]=$telenumms; 
+        }
+      }else{
+        $nummsinorder=array("");
+      }
+
+
+      /* get all Postvars */
+      if(isset($this->macroarray[$this->macro])){
+
+        if($this->acl_is_writeable("goFonMarco",$SkipWrite)){
+          foreach($this->macroarray[$this->macro] as $key => $paras){
+
+            $backup = $this->macroarray[$this->macro][$key];
+
+            if(isset($_POST[$paras['var']])){
+              $this->macroarray[$this->macro][$key]['choosen'] = $_POST[$paras['var']];
+            }
+
+            /* Checkboxes are special, they are not Posted if they are not selected, so the won't be changed with the above code
+               We need this code below to read and save checkboxes correct
+             */
+
+            if(isset($_POST['post_success'])){
+              if($this->macroarray[$this->macro][$key]['type']=="bool"){
+                if(isset($_POST[$this->macroarray[$this->macro][$key]['var']])) {
+                  $this->macroarray[$this->macro][$key]['choosen']=$_POST[$paras['var']];
+                }else{
+                  $this->macroarray[$this->macro][$key]['choosen']=false;
+                }
+              }
+            }
+          }
+          if(count(array_diff($this->macroarray[$this->macro][$key],$backup))){
+            $this->modified = TRUE;
+          }
+        }
+      }
+    }
+  }
+
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    if(!count($this->goFonHomeServers)){
+      $message[] = _("There must be at least one server with an asterisk database to create a phone account.");
+    }
+
+    if(empty($this->goFonHomeServer)){
+      $message[] = _("Please select a valid goFonHomeServer.");
+    }
+
+    if((strlen($this->goFonVoicemailPIN)==0)||(strlen($this->goFonVoicemailPIN)>4)){
+      $message[]=(_("Voicemail PIN must be between 1-4 characters."));
+    }else{
+      if(preg_match("/[^0-9]/",$this->goFonVoicemailPIN)){
+        $message[]=(_("The specified Voicemail PIN contains invalid characters, only numeric values are allowed here."));
+      }
+    }
+
+    if(preg_match("/[^0-9a-z]/i",$this->goFonPIN)){
+      $message[]=(_("The specified phone PIN contains invalid characters, only aphanumeric values are allowed here."));
+    }
+
+    if ($this->initially_was_account != $this->is_account || $this->is_modified){
+      if(!$this->generate_mysql_entension_entries()){
+        $message[] = $this->generate_error;
+      }
+    }
+
+    /* We need at least one phone number */
+    if (count($this->phoneNumbers) == 0){
+      $message[]= sprintf(_("You need to specify at least one phone number!"));
+    }
+
+    /* check for ! in any parameter setting*/
+    if(isset($this->macroarray[$this->macro])){
+      foreach($this->macroarray[$this->macro] as $val){
+        if((strstr($val['choosen'],"!"))||(strstr($val['choosen'],"#"))){
+          $message[] = sprintf(_("The parameter %s contains invalid char. '!,#' is used as delimiter"),$val['name']);
+        }
+      }
+    }
+    return ($message);
+  }
+
+
+
+  function save()
+  {
+    plugin::save();
+
+    /* Force saving macro again 
+     * This ensures that 
+     *  - the macro is available on the destiantion server.
+     *  - the macro saved is up to date on the destination server.
+     */
+    if(!empty($this->macro) && $this->macro != "none")  {
+      $macro_tab= new macrotabs($this->config,$this->config->data['TABS']['MACROTABS'], $this->macro,"gofonmacro");
+      $macro_tab -> save();
+    }
+
+    /* Save arrays */
+    $tmp_numbers = array();
+    foreach ($this->phoneNumbers as $number){
+      $tmp_numbers[] = $number;
+    }
+
+    /* Save settings, or remove goFonMacro attribute*/
+    if($this->macro!="none"){    
+      $this->attrs['goFonMacro']=$this->macro;
+      if(isset($this->macroarray[$this->macro])){
+        foreach($this->macroarray[$this->macro] as $paras)  {
+          $this->attrs['goFonMacro'].="!".$paras['id']."#".$paras['choosen'];
+        }
+      }
+    }else{
+      $this->attrs['goFonMacro']=array();
+    }
+    unset($this->attrs['macro'])  ;
+
+    $this->attrs['goFonForwarding']=array();
+
+    if ($this->initially_was_account != $this->is_account || $this->is_modified){
+      $str = $this->generate_mysql_entension_entries(true);
+      if(empty($str)){
+        print_red($str);
+      }
+    }
+
+    if($this->attrs['goFonMacro']==""){
+      $this->attrs['goFonMacro']=array();
+    }
+
+    unset($this->attrs['cn']);
+
+    /* Write back to ldap */
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd($this->dn);
+    $this->cleanup();
+    
+    /* Force saving numbers, else it will be overwriten by user account. */
+    $this->attrs['telephoneNumber'] =$tmp_numbers;
+    $ldap->modify ($this->attrs); 
+
+    /* Log last action */
+    if($this->initially_was_account){
+      new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
+
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/phone account 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",array("uid" => $this->uid));
+      }
+    } else {
+      $this->handle_post_events("add",array("uid" => $this->uid));
+    }
+
+  }
+
+
+  function adapt_from_template($dn)
+  {
+    plugin::adapt_from_template($dn);
+
+    /* Assemble phone numbers */
+    if (isset($this->attrs['telephoneNumber'])){
+      for ($i= 0; $i<$this->attrs['telephoneNumber']['count']; $i++){
+        $number= $this->attrs['telephoneNumber'][$i];
+        $this->phoneNumbers[$number]= $number;
+      }
+    }
+  }
+
+
+  function remove_from_parent()
+  {
+    if(!$this->initially_was_account) return;
+
+    foreach($this->attributes as $key=>$val){
+      if(in_array($val,array("uid","cn"))){
+        unset($this->attributes[$key]);
+        unset($this->$val);
+      }
+    }
+    if(count($this->goFonHomeServers) && !empty($this->init_HomeServer) && is_callable("mysql_pconnect")){
+
+      // Get Configuration for initial Mysql database Server
+      $a_SETUP = $this->goFonHomeServers[$this->init_HomeServer];
+      $s_parameter  ="";
+
+      // Connect to DB server
+      $r_con =  @mysql_pconnect($a_SETUP['SERVER'],$a_SETUP['LOGIN'],$a_SETUP['PASSWORD']);
+
+      // Check if we are  connected correctly
+      if(!$r_con){
+        print_red(sprintf(_("The MySQL Server '%s' isn't reachable as user '%s', check GOsa log for mysql error."),
+                    $a_SETUP['SERVER'],$a_SETUP['LOGIN']));
+        new log("debug","gofonreport/".get_class($this),"",array(),@mysql_error());
+        return false;
+      }
+
+      // Select database for Extensions
+      $db  =  @mysql_select_db($a_SETUP['DB'],$r_con);
+
+      // Test if we have the database selected correctly
+      if(!$db){
+        print_red(sprintf(_("Can't select database %s on %s."),$a_SETUP['DB'],$a_SETUP['SERVER']));
+        new log("debug","gofonreport/".get_class($this),"",array(),@mysql_error());
+        return false;
+      }
+
+      $SQL="";
+
+      /* If deletion starts from userslist, cn uid are not set */
+      if((isset($this->parent->by_object['user']->uid))&&(!empty($this->parent->by_object['user']->uid))){
+        $this->uid = $this->parent->by_object['user']->uid;
+      }
+
+      if((isset($this->parent->by_object['user']->cn))&&(!empty($this->parent->by_object['user']->cn))){
+        $this->cn  = $this->parent->by_object['user']->cn;
+      }
+
+      $first_num = false;
+      // Delete old entries
+      foreach($this->a_old_telenums as $s_telenums){
+        if(!$first_num){
+          $first_num = $s_telenums;
+        }
+        $SQL[] = "DELETE FROM ".$a_SETUP['EXT_TABLE']." WHERE exten='".$s_telenums."';\n";
+      }
+
+      $SQL[] = "DELETE FROM ".$a_SETUP['VOICE_TABLE']." WHERE customer_id='".$first_num."';";
+      $SQL[] = "DELETE FROM ".$a_SETUP['EXT_TABLE']." WHERE exten='".$this->uid."';\n";
+      $SQL[] = "DELETE FROM ".$a_SETUP['SIP_TABLE']." WHERE name='".$this->uid."';\n";
+
+      foreach($SQL as $query){
+        @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query, "Database query");
+        if(!@mysql_query($query,$r_con)){
+          print_red(_("Stop".mysql_error()));
+          return false;
+        }
+      }
+    }else{
+      print_red(_("Can't remove phone account, the mysql extension is not present in php configuration."));
+      return false;
+    }
+
+    /* unset macro attr, it will cause an error */
+    $tmp = array_flip($this->attributes);
+    unset($tmp['macro']);
+    $this->attributes=array_flip($tmp);
+
+    /* Cancel if there's nothing to do here */
+    if (!$this->initially_was_account){
+      return;
+    }
+
+    plugin::remove_from_parent();
+
+    /* Just keep one phone number */
+    if (count($this->telephoneNumber) && $this->telephoneNumber != ""){
+      $this->attrs['telephoneNumber']= $this->telephoneNumber;
+    } else {
+      $this->attrs['telephoneNumber']= array();
+    }
+
+
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(&(objectClass=goFonQueue)(member=*))", array("member"));
+    while($attr = $ldap->fetch()){
+      if(in_array($this->dn,$attr['member'])){
+        $new =new ogrouptabs($this->config, $this->config->data['TABS']['OGROUPTABS'],$attr['dn']);
+        unset($new->by_object['ogroup']->memberList[$this->dn]);
+        unset($new->by_object['ogroup']->member[$this->dn]);
+        $new->save();
+        print_red(sprintf(_("Removed user '%s' from phone queue '%s'."),$this->uid,$new->by_object['ogroup']->cn));
+      }
+    }
+    $ldap->cd($this->dn);
+    $this->cleanup();
+    $ldap->modify ($this->attrs); 
+
+    new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/phone account with dn '%s' failed."),$this->dn));
+
+    /* Optionally execute a command after we're done */
+    @mysql_close($r_con);
+    $this->handle_post_events('remove',array("uid"=> $this->uid));
+  }
+
+
+
+  /* This function checks if the given phonenumbers are available or already in use*/
+  function is_number_used()
+  {
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(|(objectClass=goFonAccount)(objectClass=goFonQueue)(objectClass=goFonConference))", array("telephoneNumber","cn","uid"));
+    while($attrs = $ldap->fetch()) {
+      unset($attrs['telephoneNumber']['count']);
+      foreach($attrs['telephoneNumber'] as $tele){
+        if(!isset($attrs['cn'][0])) $attrs['cn'][0]=$attrs['dn'];
+        if(!isset($attrs['uid'][0])) $attrs['uid'][0]=$attrs['dn'];
+        $numbers[$tele]=$attrs;
+      }
+    }
+
+    foreach($this->phoneNumbers as $num){
+      if(!isset($this->cn)) $this->cn = "";
+
+      if((isset($numbers[$num]))&&(($numbers[$num]['uid'][0]!=$this->uid))){
+        if(isset($numbers[$num]['uid'][0])){
+          return sprintf(_("The specified telephonenumber '%s' is already assigned to '%s'."),$num,$numbers[$num]['uid'][0]);
+        }else{
+          return sprintf(_("The specified telephonenumber '%s' is already assigned to '%s'."),$num,$numbers[$num]['cn'][0]);
+        }
+      }
+    }
+  }
+
+
+  /* Create phoneAccount part of copy & paste dialog */
+  function getCopyDialog()
+  { 
+    if(!$this->is_account) return("");
+    $smarty = get_smarty();
+    if (!count($this->phoneNumbers)){
+      $smarty->assign ("phoneNumbers", array(""));
+    } else {
+      $smarty->assign ("phoneNumbers", $this->phoneNumbers);
+    }
+
+    $smarty->assign("goFonVoicemailPIN",$this->goFonVoicemailPIN);
+    $smarty->assign("goFonPIN",$this->goFonPIN);
+
+    $display= $smarty->fetch(get_template_path('paste_generic.tpl', TRUE, dirname(__FILE__)));
+    $ret =array();
+    $ret['string'] = $display;
+    $ret['status'] = "";
+    return($ret);
+  }
+
+  /* Save posts from copy & paste dialog dialog  */
+  function saveCopyDialog()
+  {
+    if(!$this->is_account) return;
+    $this->execute();
+    if(isset($_POST['goFonVoicemailPIN'])) {
+      $this->goFonVoicemailPIN = $_POST['goFonVoicemailPIN'];
+    }
+    if(isset($_POST['goFonPIN'])){
+      $this->goFonPIN = $_POST['goFonPIN'];
+    }
+  }
+
+
+  function allow_remove()
+  {
+    /* Check if previously selected server is still available */
+    if($this->initially_was_account && !isset($this->goFonHomeServers[$this->goFonHomeServer])){
+      return sprintf(_("The previously selected asterisk home server (%s) is no longer available. Remove aborted."),preg_replace("/,/",", ",$this->goFonHomeServer));
+    }
+  }
+
+  /* Return plugin informations for acl handling */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"     => _("Phone"),
+          "plDescription"   => _("Phone account settings"),
+          "plSelfModify"    => TRUE,
+          "plDepends"       => array("user"),
+          "plPriority"      => 7,                                 // Position in tabs
+          "plSection"       => "personal",                        // This belongs to personal
+          "plCategory"      => array("gofonreport" => array("description" => _("GOfon reports"),
+              "objectClass" => "")),
+
+          "plOptions"       => array(),
+
+          "plProvidedAcls"  => array(
+            "telephoneNumber"     => _("Telephone number"),
+            "goFonHomeServer"     => _("Home server"),
+            "goFonMacro"          => _("Macro settings"),
+            "goFonHardware"       => _("Phone hardware"),
+            "goFonPIN"            => _("Telephone pin"),
+            "goFonVoicemailPIN"   => _("Voicemail pin"))
+          ));
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/gofon/phoneaccount/generic.tpl b/gosa-core/plugins/gofon/phoneaccount/generic.tpl
new file mode 100644 (file)
index 0000000..f034afe
--- /dev/null
@@ -0,0 +1,113 @@
+<table summary="{t}Phone numbers{/t}" style="width:100%">
+ <tr>
+  <td style="vertical-align:top; border-right:1px solid #A0A0A0; width:50%">
+   <h2>
+    <img class="center" alt="" align="middle" src="images/banana.png" />
+    &nbsp;{t}Phone numbers{/t}
+   </h2>
+{render acl=$telephoneNumberACL}
+   <select style="width:100%;" name="phonenumber_list[]" size=7 multiple>
+    {html_options options=$phoneNumbers}
+    <option disabled>&nbsp;</option>
+   </select>
+{/render}
+   <br>
+{render acl=$telephoneNumberACL}
+   <input name="phonenumber" size=20 align=middle maxlength=60 value="">
+{/render}
+{render acl=$telephoneNumberACL}
+   <input type="submit" value="{t}Add{/t}" name="add_phonenumber">&nbsp;
+{/render}
+{render acl=$telephoneNumberACL}
+      <input type="submit" value="{t}Delete{/t}" name="delete_phonenumber">
+{/render}
+  </td>
+  <td style="vertical-align:top; width:50%;">
+   <table summary="" style="width:100%" border=0>
+ <tr>
+
+  <td style="vertical-align:top;">
+   <h2><img class="center" alt="" align="middle" src="images/hardware.png" />&nbsp;{t}Telephone hardware{/t}</h2>
+
+      <table summary="{t}Telephone{/t}" border=0>
+       <tr>
+        <td>{t}Telephone{/t}</td>
+        <td>{$hardware_list}</td>
+       </tr>
+       <tr>
+        <td>{t}Home server{/t}{$must}
+        </td>
+        <td>
+{render acl=$goFonHomeServerACL}
+         <select name='goFonHomeServer' title='{t}Select the accounts home server{/t}'>
+          {html_options options=$goFonHomeServers selected=$goFonHomeServer}
+         </select>
+{/render}
+        </td>
+      </tr>
+      <tr>
+       <td>
+        <label for="goFonVoicemailPIN">{t}Voicemail PIN{/t}{$must}</label>
+       </td>
+       <td>
+{render acl=$goFonVoicemailPINACL}
+        <input type="password" id="goFonVoicemailPIN" name="goFonVoicemailPIN" value="{$goFonVoicemailPIN}">
+{/render}
+      </td>
+      </tr>
+      <tr>
+       <td>
+        <label for="goFonPIN">{t}Phone PIN{/t}{$must}</label>
+       </td>
+       <td>
+{render acl=$goFonPINACL}
+        <input type="password" id="goFonPIN" name="goFonPIN" value="{$goFonPIN}">
+{/render}
+      </td>
+      </tr>
+      </table>
+     </td>
+    </tr>
+   </table>
+  </td>
+
+ </tr>
+ <tr>
+ <td style="vertical-align:top; border-top:1px solid #A0A0A0; width:50%" colspan="2">&nbsp;</td>
+ </tr>
+ <tr style="vertical-align:top; border-top:1px solid #A0A0A0;">
+ <td colspan=2 style="vertical-align:top;width:50%">
+  <h2>
+   <img class="center" alt="" src="images/select_macro.png" align="middle" />
+   &nbsp;{t}Phone macro{/t}
+  </h2>
+  <table summary="{t}Phone macro{/t}">
+   <tr>
+    <td colspan=2>
+{render acl=$goFonMacroACL}
+     <select name="macro" onchange="document.mainform.submit()">
+      {html_options options=$macros selected=$macro}
+      <option disabled>&nbsp;</option>
+     </select>
+{/render}
+     {if $javascript eq 'false'}
+{render acl=$goFonMacroACL}
+      <input type="submit" name="refresh" value="{t}Refresh{/t}">
+{/render}
+     {/if}
+    </td>
+   </tr>
+  </table>
+  <br>
+  {$macrotab}
+ </td>
+ </tr>
+</table>
+<input type="hidden" name="phoneTab" value="phoneTab">
+
+
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('phonenumber');
+  -->
+</script>
diff --git a/gosa-core/plugins/gofon/phoneaccount/main.inc b/gosa-core/plugins/gofon/phoneaccount/main.inc
new file mode 100644 (file)
index 0000000..683057a
--- /dev/null
@@ -0,0 +1,125 @@
+<?php
+/*
+  This code is part of GOsa (https://gosa.gonicus.de)
+  Copyright (C) 2004  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
+*/
+
+$display       = "";
+$lock_msg      = "";
+if (!$remove_lock){
+       /* Reset requested? */
+       if (isset($_POST['edit_cancel']) ||
+               (isset($_GET['reset']) && $_GET['reset'] == 1)){
+
+               del_lock ($ui->dn);
+               sess_del ('edit');
+               sess_del ('phoneAccount');
+       }
+
+       /* Create phoneAccount object on demand */
+       if (!isset($_SESSION['phoneAccount']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+               $_SESSION['phoneAccount']= new phoneAccount ($config, $ui->dn);
+               $_SESSION['phoneAccount']->set_acl_base($ui->dn);
+               $_SESSION['phoneAccount']->set_acl_category("users");
+       }
+       $phoneAccount= $_SESSION['phoneAccount'];
+
+       /* save changes back to object */
+       if (isset ($_SESSION['edit'])){
+               $phoneAccount->save_object ();
+       }
+
+       /* Enter edit mode? */
+       if (isset($_POST['edit'])){
+
+               /* Check locking */
+               if (($username= get_lock($ui->dn)) != ""){
+                       $_SESSION['back_plugin']= $plug;
+                       $_SESSION['LOCK_VARS_TO_USE'] = array("/^edit$/","/^plug$/");
+                       $lock_msg =  gen_locked_message ($username, $ui->dn);
+
+               }else{
+
+                       /* Lock the current entry */
+                       add_lock ($ui->dn, $ui->dn);
+                       $_SESSION['dn']= $ui->dn;
+                       $_SESSION['edit']= TRUE;
+               }
+
+       }
+
+       /* save changes to LDAP and disable edit mode */
+       if (isset($_POST['edit_finish'])){
+
+               /* Perform checks */
+               $message= $phoneAccount->check ();
+
+               /* No errors, save object */
+               if (count ($message) == 0){
+                       $phoneAccount->save ();
+
+                       del_lock ($ui->dn);
+                       sess_del ('edit');
+
+                       /* Write back to session */
+                       $_SESSION['phoneAccount']= $phoneAccount;
+               } else {
+                       /* Errors found, show message */
+                       show_errors ($message);
+               }
+       }
+
+       /* Execute formular */
+       if($lock_msg){
+               $display.= $lock_msg;
+       }else{
+               $display.= $phoneAccount->execute ();
+       }
+
+       /* Store changes  in session */
+       if (isset ($_SESSION['edit'])){
+               $_SESSION['phoneAccount']= $phoneAccount;
+       }
+
+       $info= "";
+       if ($phoneAccount->is_account && empty($lock_msg)){
+               $display.= "<p class=\"plugbottom\">";
+
+               /* Are we in edit mode? */
+               if (isset($_SESSION['edit'])){
+                       $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
+                       $display.= "&nbsp;";
+                       $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+                       $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".$ui->dn."&nbsp;";
+               } else {
+                       $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/openlock.png')."\"> ".$ui->dn."&nbsp;";
+
+                       if(preg_match("/w/",$ui->get_permissions($ui->dn,"users/phoneAccount"))){
+                               $info.= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/lamp.png')."\">"._("Click the 'Edit' button below to change informations in this dialog");
+                               $display.= "<input type=submit name=\"edit\" value=\""._("Edit")."\">\n";
+                       }
+                       $display.= "<input type=\"hidden\" name=\"ignore\">\n";
+               }
+               $display.= "</p>\n";
+               $display.= "<input type=\"hidden\" name=\"ignore\">\n";
+       }
+
+       /* Page header*/
+       $display= print_header(get_template_path('images/phone.png'), _("Phone settings"), $info).$display;
+
+}
+?>
diff --git a/gosa-core/plugins/gofon/phoneaccount/paste_generic.tpl b/gosa-core/plugins/gofon/phoneaccount/paste_generic.tpl
new file mode 100644 (file)
index 0000000..d643e9f
--- /dev/null
@@ -0,0 +1,55 @@
+<h2>{t}Phone settings{/t}</h2>
+<table summary="{t}Phone numbers{/t}" style="width:100%" cellspacing=0>
+ <tr>
+  <td style="vertical-align:top; border-right:1px solid #A0A0A0; width:50%">
+   <h2>
+    <img class="center" alt="" align="middle" src="images/banana.png" />&nbsp;{t}Phone numbers{/t}
+   </h2>
+  </td>
+ </tr>
+ <tr>
+  <td style="vertical-align:top; border-right:1px solid #A0A0A0; width:50%">
+   <select style="width:100%;" name="phonenumber_list[]" size=7 multiple>
+    {html_options options=$phoneNumbers}
+     <option disabled>&nbsp; </option>
+   </select>
+   <br>
+   <input name="phonenumber" size=20 align=middle maxlength=60 value="">
+   <input type="submit" value="{t}Add{/t}" name="add_phonenumber"> 
+   <input type="submit" value="{t}Delete{/t}" name="delete_phonenumber">
+  </td>
+  <td style="vertical-align:top; width:50%;">
+   <table summary="" style="width:100%" border=0>
+    <tr>
+     <td style="vertical-align:top;">
+      <h2> 
+       <img class="center" alt="" align="middle" src="images/hardware.png" />
+       &nbsp;{t}Telephone hardware{/t}
+      </h2>
+      <table summary="{t}Telephone{/t}" border=0>
+       <tr>
+        <td>
+         <label for="goFonVoicemailPIN">{t}Voicemail PIN{/t}{$must}</label>
+        </td>
+        <td>
+         <input type="password" id="goFonVoicemailPIN" name="goFonVoicemailPI" value="{$goFonVoicemailPIN}">
+        </td>
+       </tr>
+       <tr>
+        <td>
+         <label for="goFonPIN">{t}Phone PIN{/t}{$must}</label>
+        </td>
+        <td>
+         <input type="password" id="goFonPIN" name="goFonPIN" value="{$goFonPIN}">
+        </td>
+       </tr>
+      </table>
+     </td>
+    </tr>
+   </table>
+  </td>
+ </tr>
+</table>
+<input type="hidden" name="phoneTab" value="phoneTab">
+<br>
+<br>
diff --git a/gosa-core/plugins/personal/connectivity/class_connectivity.inc b/gosa-core/plugins/personal/connectivity/class_connectivity.inc
new file mode 100644 (file)
index 0000000..70cfd87
--- /dev/null
@@ -0,0 +1,190 @@
+<?php
+/*! \brief   connectivity plugin
+  \author  Cajus Pollmeier <pollmeier@gonicus.de>
+  \version 2.30
+  \date    29.03.2005
+
+  This class provides the functionality to read and write all attributes
+  relevant for connectivity settings from/to the LDAP. It does syntax checking
+  and displays the formulars required.
+ */
+
+class connectivity extends plugin
+{
+  /* Definitions */
+  var $plHeadline= "Connectivity";
+  var $plDescription= "This does something";
+
+  /* attribute list for save action */
+  var $attributes= array();
+  var $objectclasses= array();
+
+  var $ignore_account= TRUE;
+  var $plugin= array();
+  var $plugin_name= array();
+  var $CopyPasteVars = array("plugin","plugin_name");
+
+
+  function connectivity (&$config, $dn= NULL,$parent =NULL)
+  {
+    /* Preseed permissions */
+    $this->dn= $dn;
+    $ui= get_userinfo();
+
+    /* Load accounts */
+    foreach ($config->data['TABS']['CONNECTIVITY'] as $plug){
+      $name= $plug['CLASS'];
+      $this->plugin_name[]= $name;
+      $this->plugin[$name]= new $name($config, $dn,$parent);
+
+      /* Acl base && category configuration, 
+          these settings will be overloaded in main.inc, 
+          if we are editing ourself */
+      $this->plugin[$name]-> set_acl_category("users");
+      $this->plugin[$name]-> set_acl_base($this->dn);
+    }
+  }
+
+  function execute()
+  {
+       /* Call parent execute */
+       plugin::execute();
+
+    $display= "";
+
+    /* Prepare templating */
+    $smarty= get_smarty();
+
+    /* Do we represent a valid account? */
+    if ($this->parent === NULL){
+      $enabled= true;
+      foreach ($this->plugin_name as $name){
+        if ($this->plugin[$name]->is_account){
+          $enabled= true;
+          break;
+        }
+      }
+      if (!$enabled){
+        $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\">&nbsp;<b>".
+          _("This account has no connectivity extensions.")."</b>";
+        $display.= back_to_main();
+        return ($display);
+      }
+    }
+
+    /* Remove checkboxes in single edit mode */
+    if ($this->parent !== NULL){
+      foreach ($this->plugin_name as $name){
+        $this->plugin[$name]->parent= $this->parent;
+      }
+    }
+
+    /* Execude  objects */
+    $is_first= true;
+
+    $ReadOnly = (!isset($this->parent) || !$this->parent) && !isset($_SESSION['edit']);
+
+    foreach ($this->plugin_name as $name){
+      $this->plugin[$name]->ReadOnly = $ReadOnly;
+      if (!$is_first){
+        $display.= '<p class="seperator">&nbsp;</p>';
+      } else {
+        $is_first= false;
+      }
+      $display.= $this->plugin[$name]->execute();
+    }
+
+    /* Mark me as connectivity tab */
+    $display.= "<input type='hidden' name='connectivityTab'>";
+
+    return($display);
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    if (isset($_POST['connectivityTab'])){
+      foreach ($this->plugin_name as $name){
+        $this->plugin[$name]->save_object();
+      }
+    }
+  }
+
+  function check()
+  {
+    $message= plugin::check();
+
+    foreach ($this->plugin_name as $name){
+      $tmp= $this->plugin[$name]->check();
+
+      $message= array_merge($message, $tmp);
+    }
+
+    return ($message);
+  }
+
+  function set_acl_category($cat)
+  {
+    plugin::set_acl_category($cat);
+    foreach ($this->plugin_name as $name){
+      $this->plugin[$name]->set_acl_category( $cat);
+    }
+  }
+
+  function set_acl_base($base)
+  {
+    plugin::set_acl_base($base);
+    foreach ($this->plugin_name as $name){
+      $this->plugin[$name]->set_acl_base( $base);
+    }
+  }
+
+  /* Save to LDAP */
+  function save()
+  {
+    /* Save objects */
+    foreach ($this->plugin_name as $name){
+      $this->plugin[$name]->dn= $this->dn;
+      
+      if ($this->plugin[$name]->is_account){
+        $this->plugin[$name]->save();
+      } else {
+        $this->plugin[$name]->remove_from_parent();
+      }
+    }
+  }
+
+  function remove_from_parent()
+  {
+    /* Remove objects */
+    foreach ($this->plugin_name as $name){
+      $this->plugin[$name]->dn= $this->dn;
+      $this->plugin[$name]->remove_from_parent();
+    }
+  }
+
+  function adapt_from_template($dn)
+  {
+    /* Adapt objects */
+    foreach ($this->plugin_name as $name){
+      $this->plugin[$name]->dn= $this->dn;
+      $this->plugin[$name]->adapt_from_template($dn);
+    }
+  }
+
+  /* Prepare the connectivity obj 
+   */
+  function PrepareForCopyPaste($obj)
+  { 
+    $tmp = $this->plugin;
+    plugin::PrepareForCopyPaste($obj);
+    $this->plugin = $tmp;
+    foreach( $this->plugin as $key => $plug){
+      $this->plugin[$key]->PrepareForCopyPaste($obj);
+    }
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/personal/connectivity/class_intranetAccount.inc b/gosa-core/plugins/personal/connectivity/class_intranetAccount.inc
new file mode 100644 (file)
index 0000000..c2b9573
--- /dev/null
@@ -0,0 +1,213 @@
+<?php
+
+
+
+/*!
+  \author  Harald Falk <hf@doellken-weimar.de>
+  \version 1.00
+  \date    1.07.2005
+
+  \brief   Enables Apache authentification for Intranet through openldap with .htaccess files   
+ */
+
+class intranetAccount extends plugin
+{
+  /*! Definitions */
+  var $plHeadline= "Intranet";
+  /*! Definitions */
+  var $plDescription= "This does something";
+
+  /* attribute list for save action */
+  var $attributes= array();
+  /* ObjectClasses list for save action */
+  var $objectclasses= array("gosaIntranetAccount");
+  var $ReadOnly = false;  
+
+  var $uid ="";
+
+  var $view_logged = FALSE;
+
+  /*! \brief Konstructor  
+
+    \param $config     The Config Object used to initialise plugin
+    \param $dn                 The DN of the currently edited entry    
+    \author  Harald Falk <hf@doellken-weimar.de>
+    \version 1.00
+    \date    1.07.2005
+   */
+  function intranetAccount (&$config, $dn= NULL, $parent=NULL)
+  {
+    plugin::plugin ($config, $dn,$parent);
+
+    /* Setting uid to default */
+    if(isset($this->attrs['uid'][0])){
+      $this->uid = $this->attrs['uid'][0];
+    }
+  }
+
+  /*!
+    \brief General execution 
+    \author  Harald Falk <hf@doellken-weimar.de>
+    \version 1.00
+    \date    1.07.2005
+
+    Load smarty Template and assign needed smarty vars
+   */
+
+
+  function execute()
+  {
+    /* Call parent execute */
+    // plugin::execute();
+
+    /* Log view */
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","users/".get_class($this),$this->dn);
+    }
+
+    $display= "";
+
+    $smarty= get_smarty();
+
+    if ($this->is_account){
+      $smarty->assign("intranetState", "checked");
+      $smarty->assign("wstate", "");
+    } else {
+      $smarty->assign("wstate", "disabled");
+      $smarty->assign("intranetState", "");
+    }
+
+    //! Ever assign vars to smarty in both cases, to avoid php errors (missing variable aso. ) 
+    if ($this->parent !== NULL){
+      $smarty->assign("tabbed", 1);
+    }else{
+      $smarty->assign("tabbed", 0);    
+    }
+
+
+    $smarty->assign('gosaIntranetACL', " disabled ");
+    if((!$this->ReadOnly) && (    ($this->is_account && $this->acl_is_removeable()) 
+                               || (!$this->is_account && $this->acl_is_createable()))){
+      $smarty->assign('gosaIntranetACL', "");
+    }
+
+    $display.= $smarty->fetch (get_template_path('intranet.tpl', TRUE, dirname(__FILE__)));
+    return ($display);
+  }
+
+  /*! 
+    \brief Delete ext from User
+    \author  Harald Falk <hf@doellken-weimar.de>
+    \version 1.00
+    \date    1.07.2005
+    Handles deletion of this object
+   */
+  function remove_from_parent()
+  {
+    if($this->acl_is_removeable() && $this->initially_was_account){ 
+      plugin::remove_from_parent();
+      $ldap= $this->config->get_ldap_link();
+
+      $ldap->cd($this->dn);
+      @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
+          $this->attributes, "Save");
+      $this->cleanup();
+      $ldap->modify ($this->attrs); 
+
+      /* Log last action */
+      new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+
+      show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/intranet account with dn '%s' failed."),$this->dn));
+
+      /* Optionally execute a command after we're done */
+      $this->postremove(array("uid"=>$this->uid));
+    }
+  }
+
+
+  /*!
+    \brief handles Post data 
+    \author  Harald Falk <hf@doellken-weimar.de>
+    \version 1.00
+    \date    1.07.2005
+    Save data to object 
+   */
+  function save_object()
+  {
+    /* Do we need to flip is_account state? */
+    if (isset($_POST['connectivityTab'])){
+      if (isset($_POST['intranet'])){
+        if (!$this->is_account && $_POST['intranet'] == "B"){
+          if($this->acl_is_createable()){
+            $this->is_account= TRUE;
+          }
+        }
+      } else {
+        if($this->acl_is_removeable()){
+          $this->is_account= FALSE;
+        }
+      }
+    }
+
+    plugin::save_object();
+    if (isset($_POST["INTRANETStatus"])){
+      $this->INTRANETStatus = "disabled";
+    } else {
+      $this->INTRANETStatus = "enabled";
+    }
+  }
+
+
+  /*! \brief Handles LDAP saves 
+    \author  Harald Falk <hf@doellken-weimar.de>
+    \version 1.00
+    \date    1.07.2005
+    Save objectClass for User in LDAP 
+
+   */
+  function save()
+  {
+      plugin::save();
+
+      /* Write back to ldap */
+      $ldap= $this->config->get_ldap_link();
+      $ldap->cd($this->dn);
+      $this->cleanup();
+      $ldap->modify ($this->attrs); 
+
+      /* Log last action */
+      if($this->initially_was_account){
+        new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+      }else{
+        new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+      }
+
+      show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/intranet account with dn '%s' failed."),$this->dn));
+
+      /* Optionally execute a command after we're done */
+      $this->postcreate(array("uid" => $this->uid));
+  }
+
+
+  /* Return plugin informations for acl handling */ 
+  static function plInfo()
+  {
+    return (array(     
+          "plShortName"     => _("Intranet"),
+          "plDepends"       => array("user"),
+          "plPriority"      => 25,                                 // Position in tabs
+          "plSection"     => array("personal" => _("My account")),
+          "plCategory"    => array("users"),
+          "plOptions"       => array(),
+
+          "plDescription"       => _("Intranet account settings")."&nbsp;:&nbsp;<u>"._("Connectivity addon")."</u>",
+          "plSelfModify"        => TRUE,
+
+          "plProvidedAcls"  => array()
+          ));
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/personal/connectivity/class_kolabAccount.inc b/gosa-core/plugins/personal/connectivity/class_kolabAccount.inc
new file mode 100644 (file)
index 0000000..c72977d
--- /dev/null
@@ -0,0 +1,486 @@
+<?php
+class kolabAccount extends plugin
+{
+  /* Definitions */
+  var $plHeadline       = "Kolab";
+  var $plDescription    = "This does something";
+
+  /* Kolab attributes */
+  var $kolabInvitationPolicy  = array();
+  var $kolabFreeBusyFuture    = 60;
+  var $unrestrictedMailSize   = 0;
+  var $calFBURL               = "";
+  var $kolabDelegate          = array();
+
+  /* attribute list for save action */
+  var $attributes     = array("kolabFreeBusyFuture", "unrestrictedMailSize", "calFBURL","kolabDelegate","kolabInvitationPolicy");
+  var $objectclasses  = array("kolabInetOrgPerson");
+
+  /* Helper */
+  var $imapping= array();
+  var $mail_Account   = false;
+  var $ReadOnly = false;
+  var $view_logged = FALSE;
+  var $uid = "";
+
+  function kolabAccount (&$config, $dn= NULL,$parent = NULL)
+  {
+    plugin::plugin ($config, $dn, $parent);
+
+    /* Setting uid to default */
+    if(isset($this->attrs['uid'][0])){
+      $this->uid = $this->attrs['uid'][0];
+    }
+
+    /* Pull arrays */
+    foreach(array("kolabDelegate", "kolabInvitationPolicy") as $attr){
+      if (isset($this->attrs["$attr"]["count"])){
+        $tmp = array();
+        for ($i= 0; $i<$this->attrs["$attr"]["count"]; $i++){
+          $tmp[]=$this->attrs["$attr"][$i];
+        }
+        $this->$attr = $tmp;
+      }
+    }
+
+    /* If this one is empty, preset with ACT_MANUAL for anonymous users */
+    if (count ($this->kolabInvitationPolicy) == 0){
+       $this->kolabInvitationPolicy= array("ACT_MANUAL");
+    }
+
+    /* Check is account state */
+    $this->is_account = false;
+    if(count($this->kolabDelegate)){
+      $this->is_account = true;
+    }
+    foreach(array("calFBURL","unrestrictedMailSize") as $attr){
+      if(!empty($this->$attr)){
+        $this->is_account = true;
+      }
+    } 
+
+    /* Transfer account states for this union */
+    if (isset($this->parent->by_object['mailAccount']) && $this->parent->by_object['mailAccount']->is_account){
+      $this->mail_Account = true;
+     }elseif( isset($this->attrs) && isset($this->attrs['kolabHomeServer'])){
+       $this->mail_Account= true;
+     }else{
+       $this->is_account  = false;
+      $this->mail_Account = false;
+    }
+  }
+
+
+  function execute()
+  {
+         /* Call parent execute */
+       plugin::execute();
+
+    /* Log view */
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","users/".get_class($this),$this->dn);
+    }
+
+    /* Show tab dialog headers */
+    $display= "";
+
+    /* Show main page */
+    $smarty= get_smarty();
+
+    /* Load attributes */
+    foreach($this->attributes as $val){
+      $smarty->assign("$val", $this->$val);
+    }
+
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $acl => $description){
+      $smarty->assign($acl."ACL",$this->getacl($acl,$this->ReadOnly));
+      $smarty->assign($acl."_W", $this->acl_is_writeable($acl,$this->ReadOnly));
+    }
+    $smarty->assign("is_account" ,  $this->is_account); 
+
+    if($this->ReadOnly){
+      $smarty->assign("is_removeable",false); 
+      $smarty->assign("is_createable",false); 
+    }else{
+      $smarty->assign("is_removeable",$this->acl_is_removeable()); 
+      $smarty->assign("is_createable",$this->acl_is_createable()); 
+    }
+
+    /* Check for invitation action */
+    $nr= 0;
+    while (isset($_POST["policy$nr"])){
+      if (isset($_POST["add$nr"])){
+        $this->kolabInvitationPolicy[]= ": ACT_MANUAL";
+      }
+      if (isset($_POST["remove$nr"])){
+        $new= array();
+        foreach ($this->kolabInvitationPolicy as $entry){
+          if (!preg_match("/^".$this->imapping[$nr].":/", $entry)){
+            $new[]= $entry;
+          }
+        }
+        $this->kolabInvitationPolicy= $new;
+      }
+      $nr++;
+    }
+
+    /* Unify addresses */
+    $new= array();
+    foreach($this->kolabInvitationPolicy as $value){
+      $address= preg_replace('/^([^:]+:).*$/', '\1', $value);
+      $new[$address]= $value;
+    }
+    $this->kolabInvitationPolicy= array();
+    foreach($new as $value){
+      $this->kolabInvitationPolicy[]= $value;
+    }
+
+    /* Add delegation */
+    if (isset($_POST['add_delegation'])){
+      if ($_POST['delegate_address'] != ""){
+
+        /* Valid email address specified? */
+        $address= $_POST['delegate_address'];
+        $valid= FALSE;
+        if (!is_email($address)){
+          if (!is_email($address, TRUE)){
+              print_red (_("You're trying to add an invalid email address to the list of delegations."));
+          }
+        } else {
+
+          $ldap= $this->config->get_ldap_link();
+          $ldap->cd ($this->config->current['BASE']);
+          $ldap->search('(mail='.$address.')',array("mail"));
+          if ($ldap->count() == 0){
+            print_red (_("The mail address you're trying to add is no primary mail address of an existing user."));
+          } else {
+            $valid= TRUE;
+          }
+        }
+
+        if ($valid){
+          /* Add it */
+          if ($this->acl_is_writeable("kolabDelegate")){
+            $this->addDelegate ($address);
+            $this->is_modified= TRUE;
+          }
+
+        }
+      }
+    }
+
+    /* Delete forward email addresses */
+    if ((isset($_POST['delete_delegation'])) && (isset($_POST['delegate_list']))){
+      if (count($_POST['delegate_list']) && $this->acl_is_writeable("kolabDelegate")){
+        $this->delDelegate ($_POST['delegate_list']);
+      }
+    }
+
+    /* Assemble policies */
+    $policies= array( 'ACT_ALWAYS_ACCEPT'       => _("Always accept"),
+                      'ACT_ALWAYS_REJECT'       => _("Always reject"),
+                      'ACT_REJECT_IF_CONFLICTS' => _("Reject if conflicts"),
+                      'ACT_MANUAL_IF_CONFLICTS' => _("Manual if conflicts"),
+                      'ACT_MANUAL'              => _("Manual"));
+    $smarty->assign('policies', $policies);
+
+    /* Adjust checkbox */
+    if ($this->unrestrictedMailSize){
+      $smarty->assign('unrestrictedMailSizeState', "checked");
+    } else {
+      $smarty->assign('unrestrictedMailSizeState', "");
+    }
+
+    /* Transfer delegation list */
+    if (!count($this->kolabDelegate)){
+      /* Smarty will produce <option value=""></option> and tidy don't like that, so tell smarty to create no option (array();)*/
+      $smarty->assign("kolabDelegate", array());
+    } else {
+      $smarty->assign("kolabDelegate", $this->kolabDelegate);
+    }
+
+    $smarty->assign("mail_account",$this->mail_Account);
+
+    /* Create InvitationPolicy table */
+    $invitation= "";
+    $this->imapping= array();
+    $nr= 0;
+    $changeState  = "";
+    foreach ($this->kolabInvitationPolicy as $entry){
+
+      if($this->acl_is_writeable("kolabInvitationPolicy")){
+        $changeState .= "changeState('address".$nr."'); \n changeState('policy".$nr."'); \n
+          changeState('add".$nr."'); \n changeState('remove".$nr."'); \n";
+      }
+
+      if(!$this->acl_is_writeable("kolabInvitationPolicy")){
+        $dis = " disabled ";
+      }else{
+        if($this->is_account){
+          $dis = " ";
+        }else{
+          $dis = " disabled ";
+        }
+      }
+      $invitation.= "<tr><td>";
+
+      if(!$this->acl_is_readable("kolabInvitationPolicy"))    {
+      }
+
+      /* The default entry does not have colons... */
+      if (!preg_match('/:/', $entry)){
+        $invitation.= _("Anonymous");
+        $name= "";
+        $mode= $entry;
+      } else {
+        $name= preg_replace('/:.*$/', '', $entry);
+        $mode= preg_replace('/^[^:]*: */', '', $entry);
+
+        if(!$this->acl_is_readable("kolabInvitationPolicy")){
+          $name='';
+        }
+        $invitation.= "<input name=\"address$nr\" size=16 maxlength=60  value=\"$name\" id='address".$nr."' ".$dis.">";
+      }
+      $invitation.= "</td>";
+
+      /* Add mode switch */
+      $invitation.= "<td><select size=\"1\" name=\"policy$nr\" id='policy".$nr."' ".$dis.">";
+      foreach($policies as $key => $value){
+        if ($key == $mode){
+          $invitation.= "<option value=\"$key\" selected>$value</option>";
+        } else {
+          $invitation.= "<option value=\"$key\">$value</option>";
+        }
+      }
+      
+      /* Assign buttons */
+      $button= "";
+      if ($nr == count($this->kolabInvitationPolicy)-1){
+        $button= "<input type=submit name=\"add$nr\" value=\""._("Add")."\" id='add".$nr."' ".$dis.">";
+      }
+      if ($nr != 0) {
+        $button.= "<input type=submit name=\"remove$nr\" value=\""._("Remove")."\" id='remove".$nr."' ".$dis.">";
+      }
+      
+      $invitation.= "</select>&nbsp;$button</td></tr>\n";
+      $this->imapping[$nr]= $name;
+      $nr++;
+    }
+    $smarty->assign("invitation", $invitation);
+    $smarty->assign("changeState", $changeState);
+    $smarty->assign("kolabState",$this->is_account);
+    $display.= $smarty->fetch (get_template_path('kolab.tpl', TRUE, dirname(__FILE__)));
+
+
+    return ($display);
+  }
+
+  function remove_from_parent()
+  {
+    if(!$this->initially_was_account){
+      return;
+    }
+  
+    /* Optionally execute a command after we're done */
+    plugin::remove_from_parent();
+    
+    if(!in_array("kolabInetOrgPerson",$this->attrs['objectClass'])){
+      $this->attrs['objectClass'][] = "kolabInetOrgPerson";
+    }
+
+    $ldap = $this->config->get_ldap_linK(); 
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->cd ($this->dn);
+    $ldap->modify($this->attrs);
+
+    /* Log last action */
+    new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+
+    $this->handle_post_events('remove',array("uid" => $this->uid));
+    show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/kolab account with dn '%s' failed."),$this->dn));
+  }
+
+
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    /* FBFuture is in days... */
+    if ($this->kolabFreeBusyFuture != "" && !preg_match('/^[0-9]+$/', $this->kolabFreeBusyFuture)){
+      $message[]= _("The value specified as Free Busy future needs to be an integer.");
+    }
+
+    /* Check for URL scheme... */
+    if(!empty($this->calFBURL) && !preg_match("/http+(s)*:\/\//",$this->calFBURL)){
+      $message[]= _("The value specified as Free Busy Information URL is invalid.");
+    }
+
+    /* Check invitation policy for existing mail addresses */
+    foreach($this->kolabInvitationPolicy as $policy){
+      
+      /* Ignore anonymous string */
+      if (!preg_match('/:/', $policy)){
+        continue;
+      }
+      
+      $address= preg_replace('/^([^:]+).*$/', '\1', $policy);
+      if (!is_email($address)){
+        if (!is_email($address, TRUE)){
+          $message[]= sprintf(_("The invitation policy entry for address '%s' is not valid."), $address);
+        }
+      } else {
+
+        $ldap= $this->config->get_ldap_link();
+        $ldap->cd ($this->config->current['BASE']);
+        $ldap->search('(mail='.$address.')',array("mail"));
+        if ($ldap->count() == 0){
+          $message[]= sprintf(_("There's no mail user with address '%s' for your invitation policy!"), $address);
+        } else {
+          $valid= TRUE;
+        }
+      }
+    }
+
+    return ($message);
+  }
+
+  /* Save data to object */
+  function save_object()
+  {
+    /* Do we need to flip is_account state? */
+    if (isset($_POST['connectivityTab'])){
+
+      if(isset($_POST["kolabState"])){
+        if($this->acl_is_createable()){
+          $this->is_account = true;
+        }
+      }else{
+        if($this->acl_is_removeable()){
+          $this->is_account = false;
+        }
+      }
+      
+      if ($this->acl_is_writeable("unrestrictedMailSize")){
+        if (isset($_POST['unrestrictedMailSize']) && $_POST['unrestrictedMailSize'] == 1){
+          $this->unrestrictedMailSize= 1;
+        } else {
+          $this->unrestrictedMailSize= 0;
+        }
+      }
+    }
+
+    plugin::save_object();
+
+    /* Save changes done in invitation policies */
+    if($this->acl_is_writeable("kolabInvitationPolicy")){
+      $nr= 0;
+      $this->kolabInvitationPolicy= array();
+      while (isset($_POST["policy$nr"])){
+
+        /* Anonymous? */
+        if (!isset($_POST["address$nr"])){
+          $this->kolabInvitationPolicy[]= $_POST["policy$nr"];
+        } else {
+          $this->kolabInvitationPolicy[]= $_POST["address$nr"].": ".$_POST["policy$nr"];
+        }
+
+        $nr++;
+      }
+
+      /* If this one is empty, preset with ACT_MANUAL for anonymous users */
+      if (count ($this->kolabInvitationPolicy) == 0){
+        $this->kolabInvitationPolicy= array("ACT_MANUAL");
+      }
+    }
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    /* Check mailmethod before doing something useful */
+    plugin::save();
+
+    /* Transfer arrays */
+    $this->attrs['kolabDelegate']= $this->kolabDelegate;
+    $this->attrs['kolabInvitationPolicy']= $this->kolabInvitationPolicy;
+
+    /* unrestrictedMailSize is boolean */
+    if($this->attrs['unrestrictedMailSize']){
+      $this->attrs['unrestrictedMailSize'] = "TRUE";
+    }else{
+      $this->attrs['unrestrictedMailSize'] = "FALSE";
+    }
+  
+    /* Write back to ldap */
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd($this->dn);
+    $this->cleanup();
+    $ldap->modify ($this->attrs); 
+
+    /* Log last action */
+    if($this->initially_was_account){
+      new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
+
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/kolab account 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",array("uid" => $this->uid));
+      }
+    } else {
+      $this->handle_post_events("add",array("uid" => $this->uid));
+    }
+  }
+
+
+  /* Add entry to delegation list */
+  function addDelegate($address)
+  {
+    $this->kolabDelegate[]= $address;
+    $this->kolabDelegate= array_unique ($this->kolabDelegate);
+
+    sort ($this->kolabDelegate);
+    reset ($this->kolabDelegate);
+    $this->is_modified= TRUE;
+  }
+
+  function delDelegate($addresses)
+  {
+    $this->kolabDelegate= array_remove_entries ($addresses, $this->kolabDelegate);
+    $this->is_modified= TRUE;
+  }
+
+
+  /* Return plugin informations for acl handling  */
+  static function plInfo()
+  {
+    return (array(     
+          "plShortName"     => _("Kolab"),
+          "plDescription"   => _("Kolab account settings")."&nbsp;:&nbsp;<u>"._("Connectivity addon")."</u>",
+          "plSelfModify"    => TRUE,
+          "plDepends"       => array("user"),
+          "plPriority"      => 20,                                 // Position in tabs
+          "plSection"     => array("personal" => _("My account")),
+          "plCategory"    => array("users"),
+          "plOptions"       => array(),
+
+          "plProvidedAcls"  => array(
+            "kolabFreeBusyFuture"   => _("Free busy future"),
+            "unrestrictedMailSize"  => _("Mail size restriction"),
+            "calFBURL"              => _("Free busy information"),
+            "kolabDelegate"         => _("Delegations"),
+            "kolabInvitationPolicy" => _("Invitation policy"))
+          ));
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/personal/connectivity/class_opengwAccount.inc b/gosa-core/plugins/personal/connectivity/class_opengwAccount.inc
new file mode 100644 (file)
index 0000000..ff96e45
--- /dev/null
@@ -0,0 +1,356 @@
+<?php
+
+class opengwAccount extends plugin
+{
+       /* Definitions */
+       var $plHeadline       = "Opengroupware account";
+       var $plDescription    = "This does something";
+
+       /* attribute list for save action */
+       var $attributes       = array();
+       var $objectclasses    = array();
+
+  var $SetPassword   = false;
+
+       /* Attribute mapping opengroupware->ldap  */
+       var $attrsToUse    = array( "salutation"  =>"vocation",
+                       "name"        =>"sn",
+                       "firstname"   =>"givenName",
+                       "login"       =>"uid",
+                       "degree"      =>"academicTitle",
+                       "birthday"    =>"dateOfBirth",
+                       "sex"         =>"gender",
+                       "street"      =>"street",
+                       "zip"         =>"postalCode",
+                       "value_string"=>"mail",
+                       "number"      =>"telephoneNumber"
+                       );
+
+       var $serverCon            =  false;
+       var $handle               = NULL;
+       var $is_account           = false;
+       var $initialy_was_account = false;
+  var $OGWPassword          = "";
+  var $ReadOnly = false;
+  var $view_logged = FALSE;  
+  var $uid = "";
+
+       function opengwAccount (&$config, $dn= NULL)
+       {
+               plugin::plugin ($config, $dn);
+
+    /* Setting uid to default */
+    if(isset($this->attrs['uid'][0])){
+      $this->uid = $this->attrs['uid'][0];
+    }
+
+               $this->info=array();
+
+               /* is no account and was no account */
+               $this->initialy_was_account = false;
+               $this->is_account           = false;
+
+               /* Get configurations */
+    if($this->config->search("opengwAccount", 'USERNAME',array('tabs'))){
+      $atr = array();
+      $atr['LOGIN']    =         $this->config->search("opengwAccount", 'USERNAME',array('tabs'));
+      $atr['PASSWORD']=        $this->config->search("opengwAccount", 'PASSWORD',array('tabs'));
+      $atr['SERVER']   =       $this->config->search("opengwAccount", 'DATAHOST',array('tabs'));
+      $atr['DB']               =         $this->config->search("opengwAccount", 'DATABASE',array('tabs'));
+      $this->serverCon = $atr;
+    }elseif(isset($this->config->data['SERVERS']['OPENGROUPWARE'])){
+      $this->serverCon  = $this->config->data['SERVERS']['OPENGROUPWARE'];
+    }else{
+      $this->serverCon = array();
+    }
+
+    /* check if datebase funktions are available, and if database configurations are available */ 
+               if(is_callable("pg_connect") && count($this->serverCon)){
+
+                       $this->handle     = new ogw($this->serverCon['LOGIN'],$this->serverCon['PASSWORD'],$this->serverCon['SERVER'],$this->serverCon['DB']);
+
+                       /* Check if current configuration allows database connection */
+                       if($this->handle->connected){
+
+                               /* Set login name, to check if this is_account */
+                               if(isset($this->attrs['uid'][0])){
+                                       $this->handle->info['login'] = $this->attrs['uid'][0];
+                               }else{
+                                       $this->handle->info['login'] = ""; 
+                               }
+
+                               /* If this is account get data from database first */
+                               if($this->handle->CheckExistence()){
+                                       $this->info = $this->handle->GetInfos($this->attrs['uid'][0]);
+
+                                       /* This is an account */
+                                       $this->initialy_was_account = true;
+                                       $this->is_account= true;
+                               }else{
+                                       /* this is no account */ 
+                                       $this->initialy_was_account = false;
+                                       $this->is_account= false;
+
+                                       /* Selectable in GOsa */
+                                       $this->info['template_user_id']   = 0;
+                                       $this->info['is_locked']          = 0;
+                                       $this->info['LocationTeamID']     = 0;
+                                       $this->info['TeamIDis']           = array();
+                               }
+
+                               /* Set settings from ldap */
+                               foreach($this->attrsToUse as $name=>$attr){
+                                       if(isset($this->attrs[$attr][0])){
+                                               $this->info[$name] = $this->attrs[$attr][0];
+                                       }else{
+                                               $this->info[$name] = false;
+                                       }
+                               } 
+
+                               /* Description is displayed as 'Nickname' */
+                               $this->info['description']          = $this->info['login'];
+
+                               if($this->info['sex'] == "F"){
+                                       $this->info['sex']                = "female";
+                               }else{
+                                       $this->info['sex']                = "male";
+                               }
+
+                       }
+
+                       /* Transmit data back to ogw handle */
+                       $this->handle->SetInfos($this->info);
+               }
+       }
+
+       function execute()
+       {
+    /* Log view */
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","users/".get_class($this),$this->dn);
+    }
+
+               /* Show tab dialog headers */
+               $display= "";
+               $smarty= get_smarty();
+
+    $smarty->assign("serverCon",count($this->serverCon));
+    $smarty->assign("validTeams","");
+    $smarty->assign("is_account", " ");
+    $smarty->assign("OGWstate"," disabled ");
+    $smarty->assign("validLocationTeam",array("&nbsp;"));
+    $smarty->assign("validLocationTeams",array("&nbsp;"));
+    $smarty->assign("LocationTeam",0);
+    $smarty->assign("validTemplateUser",array("&nbsp;"));
+    $smarty->assign("validTemplateUsers",array("&nbsp;"));
+    $smarty->assign("TemplateUser",0);
+    $smarty->assign("is_lockedCHK", "  ");
+    $smarty->assign("is_locked", "  ");
+               /* set default values */
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $acl => $desc){
+      $smarty->assign($acl."ACL",$this->getacl($acl,$this->ReadOnly));
+    } 
+
+    if((!$this->ReadOnly)&&(($this->is_account && $this->acl_is_removeable()) || (!$this->is_account && $this->acl_is_createable()))) {
+      $smarty->assign('opengwAccountACL', "");
+    }else{
+      $smarty->assign('opengwAccountACL', " disabled ");
+    }
+
+    if(count($this->serverCon))
+
+               /* Check database extension */    
+               if(!is_callable("pg_connect") && count($this->serverCon)){
+                       print_red(_("OpenGroupware: Your configuration is missing a postgresql extension. Can't perform any database queries."));
+               }elseif(count($this->serverCon)){
+
+                       /* Check if config exists */
+                       if($this->config->search("opengwAccount", 'DATABASE',array('tabs'))){
+                               print_red(_("OpenGroupware: Missing database configuration for opengroupware. Can't get or set any informations."));
+                       }else{
+
+                               /* Create handle */
+                               $this->handle     = new ogw($this->serverCon['LOGIN'],$this->serverCon['PASSWORD'],$this->serverCon['SERVER'],$this->serverCon['DB']);
+
+                               /* Check if we are successfully connected to db */
+                               if(!$this->handle->connected){
+                                       print_red(_("OpenGroupware: Can't connect to specified database. Please check given configuration twice."));
+                               }else{
+
+                                       /* Assign LocationTeams */
+                                       $tmp = array(""=>"none");
+                                       foreach($this->handle->validLocationTeam as $id){
+                                               $tmp[$id['company_id']] = $id['description']; 
+                                       }
+                                       $smarty->assign("validLocationTeam",$tmp);
+                                       $smarty->assign("validLocationTeams",array_flip($tmp));
+                                       $smarty->assign("LocationTeam",$this->info['LocationTeamID']);
+
+                                       /* Assign TemplateUsers*/
+                                       $tmp = array();
+                                       foreach($this->handle->validTemplateUser as $id){
+                                               $tmp[$id['company_id']] = $id['name']; 
+                                       }
+                                       $smarty->assign("validTemplateUser",$tmp);
+                                       $smarty->assign("validTemplateUsers",array_flip($tmp));
+                                       $smarty->assign("TemplateUser",$this->info['template_user_id']);
+
+                                       /* Create Team membership */ 
+                                       $str = "";
+                                       if(($this->is_account)==""){
+                                               $dis = "";
+                                       }else{
+                                               $dis = " disabled ";
+                                       }
+
+          if($this->acl_is_readable("Teams")){
+            foreach($this->handle->validTeams as $id){
+              if(in_array($id['company_id'],$this->info['TeamIDis'])){
+                $str .= "<input ".$dis." type='checkbox' value='".$id['company_id']."' 
+                  checked name='team_".base64_encode($id['description'])."'>".$id['description']."<br>";
+              }else{
+                $str .= "<input ".$dis." type='checkbox' value='".$id['company_id']."' 
+                  name='team_".base64_encode($id['description'])."'>".$id['description']."<br>";
+              }
+            }
+          }
+                                       $smarty->assign("validTeams",$str);
+
+                                       /* Assign ogw checkbox */
+                                       if($this->is_account){
+                                               $smarty->assign("OGWstate","");
+                                               $smarty->assign("is_account", " checked ");
+                                       }else{
+                                               $smarty->assign("is_account", " ");
+                                               $smarty->assign("OGWstate"," disabled ");
+                                       }
+
+                                       /* Assign lock status */
+                                       if($this->info['is_locked']){
+                                               $smarty->assign("is_lockedCHK", " checked ");
+                                       }else{
+                                               $smarty->assign("is_lockedCHK", "  ");
+                                       }
+                                       $smarty->assign("is_locked", $this->info['is_locked']);
+
+                               } 
+                       }
+    }
+               $display.= $smarty->fetch (get_template_path('opengw.tpl', TRUE, dirname(__FILE__)));
+               return ($display);
+       }
+
+       function remove_from_parent()
+       {
+               /* remove database entries */
+               if($this->initialy_was_account){
+                       $this->handle = new ogw($this->serverCon['LOGIN'],$this->serverCon['PASSWORD'],$this->serverCon['SERVER'],$this->serverCon['DB']);
+                       $this->handle->SetInfos($this->info);
+                       $this->handle->Perform("REMOVE");
+
+      new log("remove","users/".get_class($this),$this->dn);
+               }
+       }
+
+
+       /* Save data to object */
+       function save_object()
+       {
+               /* get post data */
+               if($this->is_account){
+
+      /* Get selected team chkboxes */
+      $this->info['TeamIDis'] = array();
+      if($this->acl_is_writeable("Teams")) {
+        foreach($_POST as $name => $value ){
+          if(preg_match("/team_/i",$name)){
+            if(!in_array($value,$this->info['TeamIDis'])){
+              $this->info['TeamIDis'][]=$value;
+            }
+          }
+        }
+      }
+
+
+                       /* Get location Team*/
+                       if(isset($_POST['LocationTeam']) && $this->acl_is_writeable("LocationTeam")){
+                               $this->info['LocationTeamID'] = $_POST['LocationTeam'];
+                       }
+
+                       /* Get template user */
+                       if(isset($_POST['TemplateUser']) && $this->acl_is_writeable("TemplateUser") ){
+                               $this->info['template_user_id'] = $_POST['TemplateUser'];
+                       }
+
+      /* get lock status */
+      if($this->acl_is_writeable("Locked")){
+        if(isset($_POST['is_locked'])){
+          $this->info['is_locked'] = $_POST['is_locked'];
+        }else{
+          $this->info['is_locked'] = 0;
+        }
+      }
+               }
+
+               /* change account status */
+               if(isset($_POST['is_account'])){
+      if($this->acl_is_createable()){
+        $this->is_account = $_POST['is_account'];
+      }
+    }else{
+      if($this->acl_is_removeable()){
+        $this->is_account = false;//$_POST['is_account'];
+      }
+               }
+       }
+
+
+       /* Save to LDAP */
+       function save()
+       {
+               /* Save data */ 
+               $this->handle = new ogw($this->serverCon['LOGIN'],$this->serverCon['PASSWORD'],$this->serverCon['SERVER'],$this->serverCon['DB']);
+               $this->handle->SetInfos($this->info);
+               $this->handle->checkInfos();
+               if($this->initialy_was_account){
+                       $this->handle->Perform("EDIT");
+      new log("modify","users/".get_class($this),$this->dn);
+               }else{
+                       $this->handle->Perform("ADD");
+      new log("create","users/".get_class($this),$this->dn);
+               }
+       }
+
+  
+  function PrepareForCopyPaste($src){
+    // Nothing to do, because this object can't be copied ... yet
+  }
+
+
+ /* Return plugin informations for acl handling 
+      #FIXME This is only an enable/disable checkbox for this account, there is possibly a better solution available later */  
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"     => _("Opengroupware"),
+          "plDescription"   => _("Open groupware account settings")."&nbsp;:&nbsp;<u>"._("Connectivity addon")."</u>",
+          "plSelfModify"    => TRUE,
+          "plDepends"       => array("user"),
+          "plPriority"      => 26,                                 // Position in tabs
+          "plSection"     => array("personal" => _("My account")),
+          "plCategory"    => array("users"),
+          "plOptions"       => array(),
+
+          "plProvidedAcls"  => array(
+            "LocationTeam"  => _("Location team"),
+            "TemplateUser"  => _("Template user"),
+            "Locked"        => _("Locked"),
+            "Teams"         => _("Teams"))
+          ));
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/personal/connectivity/class_oxchangeAccount.inc b/gosa-core/plugins/personal/connectivity/class_oxchangeAccount.inc
new file mode 100644 (file)
index 0000000..ce4288f
--- /dev/null
@@ -0,0 +1,981 @@
+<?php
+/*
+  This code is part of GOsa (https://gosa.gonicus.de)
+  Copyright (C) 2005 Alejandro Escanero Blanco
+
+  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 oxchangeAccount extends plugin
+{
+  /* Definitions */
+  var $plHeadline= "Open-Xchange";
+  var $plDescription= "This does something";
+
+  /* GW attributes */
+  var $OXAppointmentDays="500";
+  var $OXTaskDays="5";
+  var $OXTimeZone="GMT";
+  var $mailEnabled="OK";
+  var $dnModeValue = "";
+  var $view_logged = FALSE;
+
+  /* attribute list for save action */
+  var $attributes= array("OXAppointmentDays", "OXTaskDays", "OXTimeZone","mailEnabled");
+  var $objectclasses= array("OXUserObject");
+  var $ReadOnly =false;
+  var $oxconf = array();
+  var $timezones=array(
+      "Africa/Abidjan",
+      "Africa/Accra",
+      "Africa/Addis_Ababa",
+      "Africa/Algiers",
+      "Africa/Asmera",
+      "Africa/Bamako",
+      "Africa/Bangui",
+      "Africa/Banjul",
+      "Africa/Bissau",
+      "Africa/Blantyre",
+      "Africa/Brazzaville",
+      "Africa/Bujumbura",
+      "Africa/Cairo",
+      "Africa/Casablanca",
+      "Africa/Ceuta",
+      "Africa/Conakry",
+      "Africa/Dakar",
+      "Africa/Dar_es_Salaam",
+      "Africa/Djibouti",
+      "Africa/Douala",
+      "Africa/El_Aaiun",
+      "Africa/Freetown",
+      "Africa/Gaborone",
+      "Africa/Harare",
+      "Africa/Johannesburg",
+      "Africa/Kampala",
+      "Africa/Khartoum",
+      "Africa/Kigali",
+      "Africa/Kinshasa",
+      "Africa/Lagos",
+      "Africa/Libreville",
+      "Africa/Lome",
+      "Africa/Luanda",
+      "Africa/Lubumbashi",
+      "Africa/Lusaka",
+      "Africa/Malabo",
+      "Africa/Maputo",
+      "Africa/Maseru",
+      "Africa/Mbabane",
+      "Africa/Mogadishu",
+      "Africa/Monrovia",
+      "Africa/Nairobi",
+      "Africa/Ndjamena",
+      "Africa/Niamey",
+      "Africa/Nouakchott",
+      "Africa/Ouagadougou",
+      "Africa/Porto-Novo",
+      "Africa/Sao_Tome",
+      "Africa/Timbuktu",
+      "Africa/Tripoli",
+      "Africa/Tunis",
+      "Africa/Windhoek",
+      "America/Adak",
+      "America/Anchorage",
+      "America/Anguilla",
+      "America/Antigua",
+      "America/Araguaina",
+      "America/Aruba",
+      "America/Asuncion",
+      "America/Atka",
+      "America/Barbados",
+      "America/Belem",
+      "America/Belize",
+      "America/Boa_Vista",
+      "America/Bogota",
+      "America/Boise",
+      "America/Buenos_Aires",
+      "America/Cambridge_Bay",
+      "America/Cancun",
+      "America/Caracas",
+      "America/Catamarca",
+      "America/Cayenne",
+      "America/Cayman",
+      "America/Chicago",
+      "America/Chihuahua",
+      "America/Cordoba",
+      "America/Costa_Rica",
+      "America/Cuiaba",
+      "America/Curacao",
+      "America/Danmarkshavn",
+      "America/Dawson",
+      "America/Dawson_Creek",
+      "America/Denver",
+      "America/Detroit",
+      "America/Dominica",
+      "America/Edmonton",
+      "America/Eirunepe",
+      "America/El_Salvador",
+      "America/Ensenada",
+      "America/Fortaleza",
+      "America/Fort_Wayne",
+      "America/Glace_Bay",
+      "America/Godthab",
+      "America/Goose_Bay",
+      "America/Grand_Turk",
+      "America/Grenada",
+      "America/Guadeloupe",
+      "America/Guatemala",
+      "America/Guayaquil",
+      "America/Guyana",
+      "America/Halifax",
+      "America/Havana",
+      "America/Hermosillo",
+      "America/Indiana",
+      "America/Indiana/Indianapolis",
+      "America/Indiana/Knox",
+      "America/Indiana/Marengo",
+      "America/Indiana/Vevay",
+      "America/Indianapolis",
+      "America/Inuvik",
+      "America/Iqaluit",
+      "America/Jamaica",
+      "America/Jujuy",
+      "America/Juneau",
+      "America/Kentucky",
+      "America/Kentucky/Louisville",
+      "America/Kentucky/Monticello",
+      "America/Knox_IN",
+      "America/La_Paz",
+      "America/Lima",
+      "America/Los_Angeles",
+      "America/Louisville",
+      "America/Maceio",
+      "America/Managua",
+      "America/Manaus",
+      "America/Martinique",
+      "America/Mazatlan",
+      "America/Mendoza",
+      "America/Menominee",
+      "America/Merida",
+      "America/Mexico_City",
+      "America/Miquelon",
+      "America/Monterrey",
+      "America/Montevideo",
+      "America/Montreal",
+      "America/Montserrat",
+      "America/Nassau",
+      "America/New_York",
+      "America/Nipigon",
+      "America/Nome",
+      "America/Noronha",
+      "America/North_Dakota",
+      "America/North_Dakota/Center",
+      "America/Panama",
+      "America/Pangnirtung",
+      "America/Paramaribo",
+      "America/Phoenix",
+      "America/Port-au-Prince",
+      "America/Porto_Acre",
+      "America/Porto_Velho",
+      "America/Port_of_Spain",
+      "America/Puerto_Rico",
+      "America/Rainy_River",
+      "America/Rankin_Inlet",
+      "America/Recife",
+      "America/Regina",
+      "America/Rio_Branco",
+      "America/Rosario",
+      "America/Santiago",
+      "America/Santo_Domingo",
+      "America/Sao_Paulo",
+      "America/Scoresbysund",
+      "America/Shiprock",
+      "America/St_Johns",
+      "America/St_Kitts",
+      "America/St_Lucia",
+      "America/St_Thomas",
+      "America/St_Vincent",
+      "America/Swift_Current",
+      "America/Tegucigalpa",
+      "America/Thule",
+      "America/Thunder_Bay",
+      "America/Tijuana",
+      "America/Tortola",
+      "America/Vancouver",
+      "America/Virgin",
+      "America/Whitehorse",
+      "America/Winnipeg",
+      "America/Yakutat",
+      "America/Yellowknife",
+      "Antarctica/Casey",
+      "Antarctica/Davis",
+      "Antarctica/DumontDUrville",
+      "Antarctica/Mawson",
+      "Antarctica/McMurdo",
+      "Antarctica/Palmer",
+      "Antarctica/South_Pole",
+      "Antarctica/Syowa",
+      "Antarctica/Vostok",
+      "Arctic/Longyearbyen",
+      "Asia/Aden",
+      "Asia/Almaty",
+      "Asia/Amman",
+      "Asia/Anadyr",
+      "Asia/Aqtau",
+      "Asia/Aqtobe",
+      "Asia/Ashgabat",
+      "Asia/Ashkhabad",
+      "Asia/Baghdad",
+      "Asia/Bahrain",
+      "Asia/Baku",
+      "Asia/Bangkok",
+      "Asia/Beirut",
+      "Asia/Bishkek",
+      "Asia/Brunei",
+      "Asia/Calcutta",
+      "Asia/Choibalsan",
+      "Asia/Chongqing",
+      "Asia/Chungking",
+      "Asia/Colombo",
+      "Asia/Dacca",
+      "Asia/Damascus",
+      "Asia/Dhaka",
+      "Asia/Dili",
+      "Asia/Dubai",
+      "Asia/Dushanbe",
+      "Asia/Gaza",
+      "Asia/Harbin",
+      "Asia/Hong_Kong",
+      "Asia/Hovd",
+      "Asia/Irkutsk",
+      "Asia/Istanbul",
+      "Asia/Jakarta",
+      "Asia/Jayapura",
+      "Asia/Jerusalem",
+      "Asia/Kabul",
+      "Asia/Kamchatka",
+      "Asia/Karachi",
+      "Asia/Kashgar",
+      "Asia/Katmandu",
+      "Asia/Krasnoyarsk",
+      "Asia/Kuala_Lumpur",
+      "Asia/Kuching",
+      "Asia/Kuwait",
+      "Asia/Macao",
+      "Asia/Macau",
+      "Asia/Magadan",
+      "Asia/Manila",
+      "Asia/Muscat",
+      "Asia/Nicosia",
+      "Asia/Novosibirsk",
+      "Asia/Omsk",
+      "Asia/Oral",
+      "Asia/Phnom_Penh",
+      "Asia/Pontianak",
+      "Asia/Pyongyang",
+      "Asia/Qatar",
+      "Asia/Qyzylorda",
+      "Asia/Rangoon",
+      "Asia/Riyadh",
+      "Asia/Riyadh87",
+      "Asia/Riyadh88",
+      "Asia/Riyadh89",
+      "Asia/Saigon",
+      "Asia/Sakhalin",
+      "Asia/Samarkand",
+      "Asia/Seoul",
+      "Asia/Shanghai",
+      "Asia/Singapore",
+      "Asia/Taipei",
+      "Asia/Tashkent",
+      "Asia/Tbilisi",
+      "Asia/Tehran",
+      "Asia/Tel_Aviv",
+      "Asia/Thimbu",
+      "Asia/Thimphu",
+      "Asia/Tokyo",
+      "Asia/Ujung_Pandang",
+      "Asia/Ulaanbaatar",
+      "Asia/Ulan_Bator",
+      "Asia/Urumqi",
+      "Asia/Vientiane",
+      "Asia/Vladivostok",
+      "Asia/Yakutsk",
+      "Asia/Yekaterinburg",
+      "Asia/Yerevan",
+      "Atlantic/Azores",
+      "Atlantic/Bermuda",
+      "Atlantic/Canary",
+      "Atlantic/Cape_Verde",
+      "Atlantic/Faeroe",
+      "Atlantic/Jan_Mayen",
+      "Atlantic/Madeira",
+      "Atlantic/Reykjavik",
+      "Atlantic/South_Georgia",
+      "Atlantic/Stanley",
+      "Atlantic/St_Helena",
+      "Australia/ACT",
+      "Australia/Adelaide",
+      "Australia/Brisbane",
+      "Australia/Broken_Hill",
+      "Australia/Canberra",
+      "Australia/Darwin",
+      "Australia/Hobart",
+      "Australia/LHI",
+      "Australia/Lindeman",
+      "Australia/Lord_Howe",
+      "Australia/Melbourne",
+      "Australia/North",
+      "Australia/NSW",
+      "Australia/Perth",
+      "Australia/Queensland",
+      "Australia/South",
+      "Australia/Sydney",
+      "Australia/Tasmania",
+      "Australia/Victoria",
+      "Australia/West",
+      "Australia/Yancowinna",
+      "Brazil/Acre",
+      "Brazil/DeNoronha",
+      "Brazil/East",
+      "Brazil/West",
+      "Canada/Atlantic",
+      "Canada/Central",
+      "Canada/East-Saskatchewan",
+      "Canada/Eastern",
+      "Canada/Mountain",
+      "Canada/Newfoundland",
+      "Canada/Pacific",
+      "Canada/Saskatchewan",
+      "Canada/Yukon",
+      "CET",
+      "Chile/Continental",
+      "Chile/EasterIsland",
+      "CST6CDT",
+      "Cuba",
+      "EET",
+      "Egypt",
+      "Eire",
+      "EST",
+      "EST5EDT",
+      "Etc/GMT",
+      "Etc/GMT+0",
+      "Etc/GMT+1",
+      "Etc/GMT+10",
+      "Etc/GMT+11",
+      "Etc/GMT+12",
+      "Etc/GMT+2",
+      "Etc/GMT+3",
+      "Etc/GMT+4",
+      "Etc/GMT+5",
+      "Etc/GMT+6",
+      "Etc/GMT+7",
+      "Etc/GMT+8",
+      "Etc/GMT+9",
+      "Etc/GMT-0",
+      "Etc/GMT-1",
+      "Etc/GMT-10",
+      "Etc/GMT-11",
+      "Etc/GMT-12",
+      "Etc/GMT-13",
+      "Etc/GMT-14",
+      "Etc/GMT-2",
+      "Etc/GMT-3",
+      "Etc/GMT-4",
+      "Etc/GMT-5",
+      "Etc/GMT-6",
+      "Etc/GMT-7",
+      "Etc/GMT-8",
+      "Etc/GMT-9",
+      "Etc/GMT0",
+      "Etc/Greenwich",
+      "Etc/UCT",
+      "Etc/Universal",
+      "Etc/UTC",
+      "Etc/Zulu",
+      "Europe/Amsterdam",
+      "Europe/Andorra",
+      "Europe/Athens",
+      "Europe/Belfast",
+      "Europe/Belgrade",
+      "Europe/Berlin",
+      "Europe/Bratislava",
+      "Europe/Brussels",
+      "Europe/Bucharest",
+      "Europe/Budapest",
+      "Europe/Chisinau",
+      "Europe/Copenhagen",
+      "Europe/Dublin",
+      "Europe/Gibraltar",
+      "Europe/Helsinki",
+      "Europe/Istanbul",
+      "Europe/Kaliningrad",
+      "Europe/Kiev",
+      "Europe/Lisbon",
+      "Europe/Ljubljana",
+      "Europe/London",
+      "Europe/Luxembourg",
+      "Europe/Madrid",
+      "Europe/Malta",
+      "Europe/Minsk",
+      "Europe/Monaco",
+      "Europe/Moscow",
+      "Europe/Nicosia",
+      "Europe/Oslo",
+      "Europe/Paris",
+      "Europe/Prague",
+      "Europe/Riga",
+      "Europe/Rome",
+      "Europe/Samara",
+      "Europe/San_Marino",
+      "Europe/Sarajevo",
+      "Europe/Simferopol",
+      "Europe/Skopje",
+      "Europe/Sofia",
+      "Europe/Stockholm",
+      "Europe/Tallinn",
+      "Europe/Tirane",
+      "Europe/Tiraspol",
+      "Europe/Uzhgorod",
+      "Europe/Vaduz",
+      "Europe/Vatican",
+      "Europe/Vienna",
+      "Europe/Vilnius",
+      "Europe/Warsaw",
+      "Europe/Zagreb",
+      "Europe/Zaporozhye",
+      "Europe/Zurich",
+      "Factory",
+      "GB",
+      "GB-Eire",
+      "GMT",
+      "GMT+0",
+      "GMT-0",
+      "GMT0",
+      "Greenwich",
+      "Hongkong",
+      "HST",
+      "Iceland",
+      "Indian/Antananarivo",
+      "Indian/Chagos",
+      "Indian/Christmas",
+      "Indian/Cocos",
+      "Indian/Comoro",
+      "Indian/Kerguelen",
+      "Indian/Mahe",
+      "Indian/Maldives",
+      "Indian/Mauritius",
+      "Indian/Mayotte",
+      "Indian/Reunion",
+      "Iran",
+      "Israel",
+      "Jamaica",
+      "Japan",
+      "Kwajalein",
+      "Libya",
+      "MET",
+      "Mexico/BajaNorte",
+      "Mexico/BajaSur",
+      "Mexico/General",
+      "Mideast/Riyadh87",
+      "Mideast/Riyadh88",
+      "Mideast/Riyadh89",
+      "MST",
+      "MST7MDT",
+      "Navajo",
+      "NZ",
+      "NZ-CHAT",
+      "Pacific/Apia",
+      "Pacific/Auckland",
+      "Pacific/Chatham",
+      "Pacific/Easter",
+      "Pacific/Efate",
+      "Pacific/Enderbury",
+      "Pacific/Fakaofo",
+      "Pacific/Fiji",
+      "Pacific/Funafuti",
+      "Pacific/Galapagos",
+      "Pacific/Gambier",
+      "Pacific/Guadalcanal",
+      "Pacific/Guam",
+      "Pacific/Honolulu",
+      "Pacific/Johnston",
+      "Pacific/Kiritimati",
+      "Pacific/Kosrae",
+      "Pacific/Kwajalein",
+      "Pacific/Majuro",
+      "Pacific/Marquesas",
+      "Pacific/Midway",
+      "Pacific/Nauru",
+      "Pacific/Niue",
+      "Pacific/Norfolk",
+      "Pacific/Noumea",
+      "Pacific/Pago_Pago",
+      "Pacific/Palau",
+      "Pacific/Pitcairn",
+      "Pacific/Ponape",
+      "Pacific/Port_Moresby",
+      "Pacific/Rarotonga",
+      "Pacific/Saipan",
+      "Pacific/Samoa",
+      "Pacific/Tahiti",
+      "Pacific/Tarawa",
+      "Pacific/Tongatapu",
+      "Pacific/Truk",
+      "Pacific/Wake",
+      "Pacific/Wallis",
+      "Pacific/Yap",
+      "Poland",
+      "Portugal",
+      "PRC",
+      "PST8PDT",
+      "ROC",
+      "ROK",
+      "Singapore",
+      "SystemV/AST4",
+      "SystemV/AST4ADT",
+      "SystemV/CST6",
+      "SystemV/CST6CDT",
+      "SystemV/EST5",
+      "SystemV/EST5EDT",
+      "SystemV/HST10",
+      "SystemV/MST7",
+      "SystemV/MST7MDT",
+      "SystemV/PST8",
+      "SystemV/PST8PDT",
+      "SystemV/YST9",
+      "SystemV/YST9YDT",
+      "Turkey",
+      "UCT",
+      "Universal",
+      "US/Alaska",
+      "US/Aleutian",
+      "US/Arizona",
+      "US/Central",
+      "US/East-Indiana",
+      "US/Eastern",
+      "US/Hawaii",
+      "US/Indiana-Starke",
+      "US/Michigan",
+      "US/Mountain",
+      "US/Pacific",
+      "US/Samoa",
+      "UTC",
+      "W-SU",
+      "WET",
+      "Zulu"
+        );
+
+  var $dnmode= "";
+  var $uid ="";
+
+  function oxchangeAccount (&$config, $dn= NULL)
+  {
+    plugin::plugin ($config, $dn);
+    for ($i=0;$i<count($this->config->data['TABS']['CONNECTIVITY']);$i++){
+      if($this->config->data['TABS']['CONNECTIVITY'][$i]['CLASS']=='oxchangeAccount') {
+        $this->oxconf=$this->config->data['TABS']['CONNECTIVITY'][$i];
+        break;
+      }
+    }
+
+    /* Setting uid to default */
+    if(isset($this->attrs['uid'][0])){
+      $this->uid = $this->attrs['uid'][0];
+    }
+
+    $this->dnmode= $this->config->current['DNMODE'];
+    if(isset($this->attrs[$this->dnmode][0])){
+      $this->dnModeValue = $this->attrs[$this->dnmode][0];
+    }
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    //plugin::execute();
+
+    /* Log view */
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","users/".get_class($this),$this->dn);
+    }
+
+    $display="";
+
+    /* Show main page */
+    $smarty= get_smarty();
+
+    if (function_exists("pg_connect")){
+      $smarty->assign("pg", true);
+    }else{
+      $smarty->assign("pg", false);
+    }
+
+    /* Load attributes */
+    foreach($this->attributes as $val){
+      $smarty->assign("$val", $this->$val);
+    }
+    if ($this->is_account){
+      $smarty->assign("oxchangeState", "checked");
+      $smarty->assign("oxState", "");
+    } else {
+      $smarty->assign("oxchangeState", "");
+      $smarty->assign("oxState", "disabled");
+    }
+
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $key => $desc){
+      $smarty->assign($key."ACL",$this->getacl($key,$this->ReadOnly));
+      $smarty->assign($key."_W",$this->acl_is_writeable($key));
+    }
+
+    if((!$this->ReadOnly) && (($this->is_account && $this->acl_is_removeable()) || (!$this->is_account && $this->acl_is_createable())) ){
+      $smarty->assign('oxchangeAccountACL', "");
+    }else{
+      $smarty->assign('oxchangeAccountACL', " disabled ");
+    }
+
+    $smarty->assign("timezones", $this->timezones);
+
+
+    if ($this->parent !== NULL){
+      $smarty->assign("tabbed", 1);
+    }else{
+      $smarty->assign("tabbed", 0);
+       }
+
+       /* Trying to open a Postgresql Database Server */
+       if (function_exists("pg_connect")){
+               if(isset($this->oxconf["PGUSER"]) and isset($this->oxconf["PGHOST"]) and isset($this->oxconf["PGDBNAME"]) and isset($this->oxconf["PGPASSWD"])){
+                       $pgcon =  @pg_connect("host=".$this->oxconf["PGHOST"]." user=".$this->oxconf["PGUSER"]." password=".$this->oxconf["PGPASSWD"]." dbname=".$this->oxconf["PGDBNAME"]);
+                       if (! $pgcon){
+                               $smarty->assign("pg", false);
+                       }
+               }else{
+                       $smarty->assign("pg", false);
+               }
+       }else{
+               $smarty->assign("pg", false);
+       }
+
+    $display.= $smarty->fetch (get_template_path('oxchange.tpl', TRUE, dirname(__FILE__)));
+    return ($display);
+  }
+
+  function remove_from_parent()
+  {
+    if(!$this->acl_is_removeable())  return;
+    $this->attrs[$this->dnmode][0] = $this->dnModeValue;
+    $sqldeluser=array(
+        "delete from prg_notes where (user_right like '".$this->attrs[$this->dnmode][0]."') and (group_right like 's')",
+        "delete from prg_documents_read where (user_right like '".$this->attrs[$this->dnmode][0]."')",
+        "delete from prg_documents_mod where (user_right like '".$this->attrs[$this->dnmode][0]."')",
+        "delete from prg_docufolders_read where (user_right like '".$this->attrs[$this->dnmode][0]."')",
+        "delete from prg_docufolders_mod where (user_right like '".$this->attrs[$this->dnmode][0]."')",
+        "delete from prg_date_rights where (user_right like '".$this->attrs[$this->dnmode][0]."')",
+        "delete from prg_date_notification where (member_uid like '".$this->attrs[$this->dnmode][0]."')",
+        "delete from prg_dates_members where (member_uid like '".$this->attrs[$this->dnmode][0]."')",
+        "delete from prg_knowledge_read where (user_right like '".$this->attrs[$this->dnmode][0]."')",
+        "delete from prg_knowledge_mod where (user_right like '".$this->attrs[$this->dnmode][0]."')",
+        "delete from prg_knowledge_folder_read where (user_right like '".$this->attrs[$this->dnmode][0]."')",
+        "delete from prg_knowledge_folder_mod where (user_right like '".$this->attrs[$this->dnmode][0]."')",
+        "delete from prg_pin_board_read where (user_right like '".$this->attrs[$this->dnmode][0]."')",
+        "delete from prg_pin_board_mod where (user_right like '".$this->attrs[$this->dnmode][0]."')",
+        "delete from prg_bookmarks_read where (user_right like '".$this->attrs[$this->dnmode][0]."')",
+        "delete from prg_bookmarks_mod where (user_right like '".$this->attrs[$this->dnmode][0]."')",
+        "delete from prg_bookmarks_folder_read where (user_right like '".$this->attrs[$this->dnmode][0]."')",
+        "delete from prg_bookmarks_folder_mod where (user_right like '".$this->attrs[$this->dnmode][0]."')",
+        "delete from prg_tasks_rights where (user_right like '".$this->attrs[$this->dnmode][0]."')",
+        "delete from prg_tasks_notification where (member_uid like '".$this->attrs[$this->dnmode][0]."')",
+        "delete from prg_tasks_members where (member_uid like '".$this->attrs[$this->dnmode][0]."')",
+        "delete from prg_projects_rights where (user_right like '".$this->attrs[$this->dnmode][0]."')",
+        "delete from prg_projects_notification where (member_uid like '".$this->attrs[$this->dnmode][0]."')",
+        "delete        from prg_projects_members where (member_uid like '".$this->attrs[$this->dnmode][0]."')",
+        "delete from oxfolder_permissions where (entity like '".$this->attrs[$this->dnmode][0]."') AND ((role = 256) OR (role = 1024))",
+        "delete from oxfolder_standardfolders where owner like '".$this->attrs[$this->dnmode][0]."'",
+        "delete from prg_forum_read where user_right = '".$this->attrs[$this->dnmode][0]."'",
+        "delete from prg_forum_mod where user_right = '".$this->attrs[$this->dnmode][0]."'",
+        "delete from prg_forum_abo where user_right = '".$this->attrs[$this->dnmode][0]."'",
+        "delete from prg_forum_seen where username = '".$this->attrs[$this->dnmode][0]."'",
+        "delete from sys_holiday where (userid like '".$this->attrs[$this->dnmode][0]."')",
+        "delete from usr_holiday where (userid like '".$this->attrs[$this->dnmode][0]."')");
+
+    /* Trying to open a Postgresql Database Server */
+    if (function_exists("pg_connect")){
+      if(isset($this->oxconf["PGUSER"]) and 
+                isset($this->oxconf["PGHOST"]) and 
+            isset($this->oxconf["PGDBNAME"]) and 
+         isset($this->oxconf["PGPASSWD"])){
+        $pgcon = @pg_connect("host=".$this->oxconf["PGHOST"]." user=".$this->oxconf["PGUSER"]." password=".$this->oxconf["PGPASSWD"]." dbname=".$this->oxconf["PGDBNAME"]);
+        if (! $pgcon){
+          print_red(_("Connectivity")."&nbsp;"._("Openexchange")."&nbsp;:"._("Couldn't connect to postgresql database!"));
+          return;
+        }
+      }else{
+        print_red(_("Connectivity")."&nbsp;"._("Openexchange")."&nbsp;:"._("Needed parameters for openexchange connectivity plugin are missing!"));
+        return;
+      }
+    }else{
+      print_red(_("Connectivity")."&nbsp;"._("Openexchange")."&nbsp;:"._("PHP4 module for postgresql database is missing!"));
+      return;
+    }
+
+    plugin::remove_from_parent();
+    $ldap= $this->config->get_ldap_link();
+
+    if($ldap->dn_exists("ou=addr,".$this->dn)){
+       $ldap->rmdir_recursive("ou=addr,".$this->dn);
+                       show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/oxchange addressbook account with dn '%s' failed."),$this->dn));
+    }
+
+    $ldap->cd($this->dn);
+    @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
+        $this->attributes, "Save");
+    $this->cleanup();
+    $ldap->modify ($this->attrs); 
+
+    new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+
+               show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/oxchange addressbook account with dn '%s' failed."),$this->dn));
+
+    /* Optionally execute a command after we're done */
+    $this->postremove(array("uid" => $this->uid));
+
+    /* Finally remove data from postgresql server */
+    foreach ($sqldeluser as $sqls){
+       @pg_exec($pgcon,$sqls);
+    }
+    pg_close();
+  }
+
+  /* Save data to object */
+  function save_object()
+  {
+    /* Do we need to flip is_account state? */
+    if (isset($_POST['connectivityTab'])){
+      if (isset($_POST['oxchange'])){
+        if (!$this->is_account && $_POST['oxchange'] == "B") {
+          if($this->acl_is_createable()){
+            $this->is_account= TRUE;
+          }
+        }
+      } else {
+        if($this->acl_is_removeable()){
+          $this->is_account= FALSE;
+        }
+      }
+    }
+
+    /* Get objects */
+    foreach(array("OXTimeZone","OXTaskDays","OXAppointmentDays") as $name) {
+      if($this->acl_is_writeable($name) && isset($_POST[$name])){
+        $this->$name = $_POST[$name];
+      } 
+    }
+  
+//    plugin::save_object();
+    if (isset($_POST["oxchangeStatus"])){
+      $this->oxchangeStatus = "disabled";
+    } else {
+      $this->oxchangeStatus = "enabled";
+    }
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+
+    $needupdate=TRUE;
+    $istemplate=FALSE;
+
+
+/*      print "<pre>".print_r($this->attrs, true)."</pre>";*/
+
+
+    /*First at all, we must check if this is new or is updated */
+    /*Also check is we have a template, if is a template, is a new user */
+    if (isset($this->attrs['objectClass'])){
+      foreach ($this->attrs['objectClass'] as $object){
+        if($object=="OXUserObject") $needupdate=FALSE;
+       if($object=="gosaUserTemplate") $istemplate=TRUE;
+      }
+    }
+
+    $uidarray=array();
+    preg_match("/^(\w+(?=\=))=((\w|\s|\.)+(?=\,)),.*/",$this->dn,$uidarray);
+    $uid=$uidarray[2];
+    if (trim($uid) == "") {
+      print_red(_("The Open-Xchange accountname is empty and thus invalid! Check to make sure that you are not using any strange characters in the loginname."));
+      return;
+    }
+       
+    if ($istemplate) $needupdate=TRUE;
+
+    if($needupdate){
+      /* Trying to open a Postgresql Database Server */
+      if (function_exists("pg_connect")){
+        if(isset($this->oxconf["PGUSER"]) and isset($this->oxconf["PGHOST"]) and isset($this->oxconf["PGDBNAME"]) and isset($this->oxconf["PGPASSWD"])){
+          $pgcon =  @pg_connect("host=".$this->oxconf["PGHOST"]." user=".$this->oxconf["PGUSER"]." password=".$this->oxconf["PGPASSWD"]." dbname=".$this->oxconf["PGDBNAME"]);
+          if (! $pgcon){
+            print_red(_("Couldn't connect to postgresql database!"));
+            return;
+          }
+        }else{
+          print_red(_("Needed parameters for openexchange connectivity plugin are missing!"));
+          return;
+        }
+      }else{
+        print_red(_("PHP4 module for postgresql database is missing!"));
+        return;
+      }
+    }
+
+    plugin::save();
+
+    /* Write back to ldap */
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd($this->dn);
+    $this->cleanup();
+    $ldap->modify ($this->attrs); 
+
+    if($this->initially_was_account){
+      new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
+
+               show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/oxchange account with dn '%s' failed."),$this->dn));
+
+    /* Optionally execute a command after we're done */
+    $this->postcreate(array("uid" => $this->uid));
+
+    if($needupdate){
+      $ldap->create_missing_trees("ou=addr,".$this->dn);
+                       show_ldap_error($ldap->get_error(), sprintf(_("Creating of user/oxchange account with dn '%s' failed."),$this->dn));
+      /* Finally save data to postgresql server */
+      pg_set_client_encoding ("UNICODE");
+      $nv = "SELECT nextval ('serial_id')";
+      $ot = "insert into oxfolder_tree (fuid, parent, fname, module, type, owner, creator, creating_date, created_from, changing_date, changed_from) VALUES (%d, 1, '%s', '%s', 'private', '%s', '%s', 'now', 'System', 'now', 'System')";
+      $op = "INSERT INTO oxfolder_permissions (puid, pid, role, entity, sealed, fp, orp, owp, odp) VALUES (%d, %d, 32768,  '%s', 0, 128, 128, 128, 128)";
+      $os = "insert into oxfolder_standardfolders (owner,module_calendar,module_contact,module_task) VALUES ('%s',%d,%d,%d)";
+      $ugr= "INSERT INTO usr_general_rights SELECT creating_date, created_from, changing_date, changed_from,text('%s'),  addr_u, addr_r, addr_d, cont_u, cont_r, cont_d, data_u, data_r, data_d, serie_u, serie_r, serie_d, task_u, task_r, task_d,  refer, proj_u, proj_r, proj_d, dfolder_u, dfolder_r, dfolder_d, doc_u, doc_r, doc_d, knowl_u, knowl_r, knowl_d, bfolder_u,  bfolder_r, bfolder_d, bookm_u, bookm_r, bookm_d, pin_u, pin_r, pin_d, forum_n, fentrie_n, setup, pin_public, internal,  int_groups, kfolder_u, kfolder_r, kfolder_d, webmail FROM sys_gen_rights_template WHERE login LIKE 'default_template'";
+
+      $error = FALSE;
+      $res=@pg_exec($pgcon,$nv); 
+
+      if(!$res){
+        $error = TRUE;
+      }else{
+        $calendarid=pg_fetch_row($res); 
+        pg_freeresult($res);
+
+        $q=sprintf($ot,$calendarid[0],'My Appointments','calendar',$uid,$uid);
+        @pg_exec($pgcon,$q);
+      }
+
+      $res=@pg_exec($pgcon,$nv); 
+
+      if(!$res){
+        $error = TRUE;
+      }else{
+        $nid=pg_fetch_row($res); 
+        pg_freeresult($res);
+
+        $q=sprintf($op,$nid[0],$calendarid[0],$uid);
+        @pg_exec($pgcon,$q);
+      }
+
+      $res=@pg_exec($pgcon,$nv); 
+      if(!$res){
+        $error = TRUE;
+      }else{
+        $contactsid=pg_fetch_row($res); 
+        pg_freeresult($res);
+
+        $q=sprintf($ot,$contactsid[0],'My Contacts','contact',$uid,$uid);
+        @pg_exec($pgcon,$q);
+      }
+
+      $res=@pg_exec($pgcon,$nv); 
+      if(!$res){
+        $error = TRUE;
+      }else{
+        $nid=pg_fetch_row($res); 
+        pg_freeresult($res);
+
+        $q=sprintf($op,$nid[0],$contactsid[0],$uid);
+        @pg_exec($pgcon,$q);
+      }
+
+      $res=@pg_exec($pgcon,$nv); 
+      if(!$res){
+        $error = TRUE;
+      }else{
+        $tasksid=pg_fetch_row($res); 
+        pg_freeresult($res);
+
+        $q=sprintf($ot,$tasksid[0],'My Tasks','task',$uid,$uid);
+        @pg_exec($pgcon,$q);
+      }
+
+      $res=@pg_exec($pgcon,$nv); 
+      if(!$res){
+        $error = TRUE;
+      }else{
+        $nid=pg_fetch_row($res); 
+        pg_freeresult($res);
+
+        $q=sprintf($op,$nid[0],$tasksid[0],$uid);
+        @pg_exec($pgcon,$q);
+      
+        $q=sprintf($os,$uid,$calendarid[0],$contactsid[0],$tasksid[0]);
+        @pg_exec($pgcon,$q);
+      
+        $q=sprintf($ugr,$uid);
+        @pg_exec($pgcon,$q);
+      }
+    
+      @pg_close($pgcon);
+
+      if($error){
+        print_red(_("Something went wrong while saving oxchange account. Please check the error log file."));
+      }
+    }
+  }
+
+
+  /* Return plugin informations for acl handling */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"     => _("Open xchange"),
+          "plDescription"   => _("Open xchange account settings")."&nbsp;:&nbsp;<u>"._("Connectivity addon")."</u>",
+          "plSelfModify"    => TRUE,
+          "plDepends"       => array("user"),
+          "plPriority"      => 27,                                 // Position in tabs
+          "plSection"     => array("personal" => _("My account")),
+          "plCategory"    => array("users"),
+          "plOptions"       => array(),
+
+          "plProvidedAcls"  => array(
+            "OXAppointmentDays" => _("OXAppointmentDays"),
+            "OXTaskDays"           => _("OXTaskDays"),
+            "OXTimeZone"           => _("OXTimeZone"))
+          ));
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/personal/connectivity/class_phpgwAccount.inc b/gosa-core/plugins/personal/connectivity/class_phpgwAccount.inc
new file mode 100644 (file)
index 0000000..7c5cf6e
--- /dev/null
@@ -0,0 +1,172 @@
+<?php
+class phpgwAccount extends plugin
+{
+  /* Definitions */
+  var $plHeadline= "PHPGroupware";
+  var $plDescription= "This does something";
+
+  /* GW attributes */
+  var $phpgwAccountExpires= "-1";
+  var $phpgwAccountStatus= "A";
+  var $phpgwAccountType= "u";
+
+  /* attribute list for save action */
+  var $attributes= array("phpgwAccountExpires", "phpgwAccountStatus", "phpgwAccountType");
+  var $objectclasses= array("phpgwAccount");
+  var $ReadOnly = false;
+
+  var $uid  = "";
+  var $view_logged = FALSE;
+
+  function phpgwAccount (&$config, $dn= NULL)
+  {
+    plugin::plugin ($config, $dn);
+
+    /* Setting uid to default */
+    if(isset($this->attrs['uid'][0])){
+      $this->uid = $this->attrs['uid'][0];
+    }
+  }
+
+  function execute()
+  {
+       /* Call parent execute */
+//     plugin::execute();
+    /* Log view */
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","users/".get_class($this),$this->dn);
+    }
+    /* Show tab dialog headers */
+    $display= "";
+
+    /* Show main page */
+    $smarty= get_smarty();
+
+    /* Load attributes */
+    foreach($this->attributes as $val){
+      $smarty->assign("$val", $this->$val);
+    }
+    if ($this->is_account){
+      $smarty->assign("phpgwState", "checked");
+    } else {
+      $smarty->assign("phpgwState", "");
+    }
+
+    if((!$this->ReadOnly)&&(($this->is_account && $this->acl_is_removeable()) || (!$this->is_account && $this->acl_is_createable()))) {
+      $smarty->assign('phpgwAccountACL', "");
+    }else{
+      $smarty->assign('phpgwAccountACL', " disabled ");
+    }
+
+    $display.= $smarty->fetch (get_template_path('phpgw.tpl', TRUE, dirname(__FILE__)));
+    return ($display);
+  }
+
+  function remove_from_parent()
+  {
+    if($this->acl_is_removeable()){
+      /* Cancel if there's nothing to do here */
+      if (!$this->initially_was_account){
+        return;
+      }
+
+      plugin::remove_from_parent();
+      $ldap= $this->config->get_ldap_link();
+
+      $ldap->cd($this->dn);
+      @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
+          $this->attributes, "Save");
+      $this->cleanup();
+      $ldap->modify ($this->attrs); 
+
+      show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/PHPgw account with dn '%s' failed."),$this->dn));
+
+      new log("remove","users/".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',array("uid" => $this->uid));
+    }
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    /* Do we need to flip is_account state? */
+    if (isset($_POST['connectivityTab'])){
+      if (isset($_POST['phpgw'])){
+        if (!$this->is_account && $_POST['phpgw'] == "B"){
+          if($this->acl_is_createable()){
+            $this->is_account= TRUE;
+          }
+        }
+      } else {
+        if($this->acl_is_removeable()){
+          $this->is_account= FALSE;
+        }
+      }
+    }
+
+    plugin::save_object();
+    if (isset($_POST["phpgwStatus"])){
+      $this->phpgwStatus = "disabled";
+    } else {
+      $this->phpgwStatus = "enabled";
+    }
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    plugin::save();
+
+    /* Write back to ldap */
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd($this->dn);
+    $this->cleanup();
+    $ldap->modify ($this->attrs); 
+
+    if($this->initially_was_account){
+      new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
+
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/PHPgw account 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",array("uid" => $this->uid));
+      }
+    } else {
+      $this->handle_post_events("add",array("uid" => $this->uid));
+    }
+
+  }
+
+
+  /* Return plugin informations for acl handling */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"     => _("PHP GW"),
+          "plDescription"   => _("PHP GW account settings")."&nbsp;:&nbsp;<u>"._("Connectivity addon")."</u>",
+          "plSelfModify"    => TRUE,
+          "plDepends"       => array("user"),
+          "plPriority"      => 24,                                 // Position in tabs
+          "plSection"     => array("personal" => _("My account")),
+          "plCategory"    => array("users"),
+          "plOptions"       => array(),
+
+          "plProvidedAcls"  => array()
+          ));
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/personal/connectivity/class_phpscheduleitAccount.inc b/gosa-core/plugins/personal/connectivity/class_phpscheduleitAccount.inc
new file mode 100644 (file)
index 0000000..41454ea
--- /dev/null
@@ -0,0 +1,175 @@
+<?php
+
+/*
+  This code is part of GOsa (https://gosa.gonicus.de)
+  Copyright (C) 2005 Guillaume Delecourt
+  Copuright (C) 2005 Benoit Mortier
+
+  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 phpscheduleitAccount extends plugin
+{
+  /* Definitions */
+  var $plHeadline= "PHPscheduleit";
+  var $plDescription= "This does something";
+
+  /* attribute list for save action */
+  var $attributes= array();
+  var $objectclasses= array("phpscheduleitAccount");
+  var $ReadOnly =false;
+  var $view_logged = FALSE;
+
+  function phpscheduleitAccount (&$config, $dn= NULL)
+  {
+    plugin::plugin ($config, $dn);
+  }
+
+  function execute()
+  {
+    /* Log view */
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","users/".get_class($this),$this->dn);
+    }
+
+    /* Show tab dialog headers */
+    $display= "";
+
+    /* Show main page */
+    $smarty= get_smarty();
+
+    if ($this->is_account){
+      $smarty->assign("phpscheduleitState", "checked");
+    } else {
+      $smarty->assign("phpscheduleitState", "");
+      $smarty->assign("wstate", "disabled");
+    }
+
+    if((!$this->ReadOnly) && (($this->is_account && $this->acl_is_removeable()) || (!$this->is_account && $this->acl_is_createable()))) {
+      $smarty->assign('gosaphpscheduleitACL', "");
+    }else{
+      $smarty->assign('gosaphpscheduleitACL', " disabled ");
+    }
+
+    $display.= $smarty->fetch (get_template_path('phpscheduleit.tpl', TRUE, dirname(__FILE__)));
+    return ($display);
+  }
+
+  function remove_from_parent()
+  {
+    /* Cancel if there's nothing to do here */
+    if ($this->acl_is_removeable()){
+
+      plugin::remove_from_parent();
+      $ldap= $this->config->get_ldap_link();
+
+      $ldap->cd($this->dn);
+      @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
+          $this->attributes, "Save");
+      $this->cleanup();
+      $ldap->modify ($this->attrs); 
+      show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/PHPscheduleit account with dn '%s' failed."),$this->dn));
+
+      if($this->is_account){
+        new log("remove","users/".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',array("uid" => $this->uid));
+    }
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    /* Do we need to flip is_account state? */
+    if (isset($_POST['connectivityTab'])){
+      if (isset($_POST['phpscheduleit'])){
+        if (!$this->is_account && $_POST['phpscheduleit'] == "B"){
+          if($this->acl_is_createable()) {
+            $this->is_account= TRUE;
+          }
+        }
+      } else {
+        if($this->acl_is_removeable()){
+          $this->is_account= FALSE;
+        }
+      }
+    }
+
+    plugin::save_object();
+    if (isset($_POST["phpscheduleitStatus"])){
+      $this->pptpStatus = "disabled";
+    } else {
+      $this->pptpStatus = "enabled";
+    }
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    plugin::save();
+
+    /* Write back to ldap */
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd($this->dn);
+    $this->cleanup();
+    $ldap->modify ($this->attrs); 
+
+    if($this->initially_was_account){
+      new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
+
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/PHPscheduleit account 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",array("uid" => $this->uid));
+      }
+    } else {
+      $this->handle_post_events("add",array("uid" => $this->uid));
+    }
+
+  }
+
+
+  /* Return plugin informations for acl handling 
+      #FIXME This is only an enable/disable checkbox for this account, there is possibly a better solution available later */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"     => _("PHP Schedule it"),
+          "plDescription"   => _("PHP Schedule it settings")."&nbsp;:&nbsp;<u>"._("Connectivity addon")."</u>",
+          "plSelfModify"    => TRUE,
+          "plDepends"       => array("user"),
+          "plPriority"      => 29,                                 // Position in tabs
+          "plSection"     => array("personal" => _("My account")),
+          "plCategory"    => array("users"),
+
+          "plOptions"       => array(),
+
+          "plProvidedAcls"  => array()
+          ));
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/personal/connectivity/class_pptpAccount.inc b/gosa-core/plugins/personal/connectivity/class_pptpAccount.inc
new file mode 100644 (file)
index 0000000..0c8c659
--- /dev/null
@@ -0,0 +1,188 @@
+<?php
+
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2005 Guillaume Delecourt
+   Copyright (C) 2005 Benoit Mortier
+
+   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 pptpAccount extends plugin
+{
+  /* Definitions */
+  var $plHeadline= "PPTP";
+  var $plDescription= "This does something";
+
+  /* attribute list for save action */
+  var $attributes= array();
+  var $objectclasses= array("pptpServerAccount");
+
+  var $ReadOnly = false;
+  var $view_logged = FALSE;
+  var $uid ="";
+
+  function pptpAccount (&$config, $dn= NULL)
+  {
+    plugin::plugin ($config, $dn);
+    
+    /* Setting uid to default */
+    if(isset($this->attrs['uid'][0])){
+      $this->uid = $this->attrs['uid'][0];
+    }
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    // plugin::execute();
+
+    /* Log view */
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","users/".get_class($this),$this->dn);
+    }
+
+    /* Show tab dialog headers */
+    $display= "";
+
+    /* Show main page */
+    $smarty= get_smarty();
+
+    if ($this->is_account){
+      $smarty->assign("pptpState", "checked");
+    } else {
+      $smarty->assign("pptpState", "");
+      $smarty->assign("wstate", "disabled");
+    }
+
+    if((!$this->ReadOnly) && (($this->is_account && $this->acl_is_removeable()) || (!$this->is_account && $this->acl_is_createable()))) {
+      $smarty->assign('gosapptpACL', "");
+    }else{
+      $smarty->assign('gosapptpACL', " disabled ");
+    }
+
+    $display.= $smarty->fetch (get_template_path('pptp.tpl', TRUE, dirname(__FILE__)));
+    return ($display);
+  }
+
+  function remove_from_parent()
+  {
+    if($this->acl_is_removeable()){
+      /* Cancel if there's nothing to do here */
+      if (!$this->initially_was_account){
+        return;
+      }
+
+      plugin::remove_from_parent();
+      $ldap= $this->config->get_ldap_link();
+
+      $ldap->cd($this->dn);
+      @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
+          $this->attributes, "Save");
+      $this->cleanup();
+      $ldap->modify ($this->attrs); 
+
+      /* Log last action */
+      new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+
+      show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/PPTP account with dn '%s' failed."),$this->dn));
+
+      /* Optionally execute a command after we're done */
+      $this->handle_post_events('remove',array("uid" => $this->uid));
+    }
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    /* Do we need to flip is_account state? */
+    if (isset($_POST['connectivityTab'])){
+      if (isset($_POST['pptp'])){
+        if (!$this->is_account && $_POST['pptp'] == "B"){
+          if($this->acl_is_createable()){
+            $this->is_account= TRUE;
+          }
+        }
+      } else {
+        if($this->acl_is_removeable()){
+          $this->is_account= FALSE;
+        }
+      }
+    }
+
+    plugin::save_object();
+    if (isset($_POST["pptpStatus"])){
+      $this->pptpStatus = "disabled";
+    } else {
+      $this->pptpStatus = "enabled";
+    }
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    if($this->acl_is_createable()){
+      plugin::save();
+
+      /* Write back to ldap */
+      $ldap= $this->config->get_ldap_link();
+      $ldap->cd($this->dn);
+      $this->cleanup();
+      $ldap->modify ($this->attrs); 
+
+      /* Log last action */
+      if($this->initially_was_account){
+        new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+      }else{
+        new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+      }
+
+      show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/PPTP account 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",array("uid" => $this->uid));
+        }
+      } else {
+        $this->handle_post_events("add",array("uid" => $this->uid));
+      }
+    }
+  }
+
+
+  /* Return plugin informations for acl handling */ 
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"     => _("PPTP"),
+          "plDescription"   => _("PPTP account")."&nbsp;:&nbsp;<u>"._("Connectivity addon")."</u>",
+          "plSelfModify"    => TRUE,
+          "plDepends"       => array("user"),
+          "plPriority"      => 28,                                 // Position in tabs
+          "plSection"     => array("personal" => _("My account")),
+          "plCategory"    => array("users"),
+          "plOptions"       => array(),
+
+          "plProvidedAcls"  => array()
+          ));
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/personal/connectivity/class_proxyAccount.inc b/gosa-core/plugins/personal/connectivity/class_proxyAccount.inc
new file mode 100644 (file)
index 0000000..455bb53
--- /dev/null
@@ -0,0 +1,325 @@
+<?php
+class proxyAccount extends plugin
+{
+  /* Definitions */
+  var $plHeadline= "Proxy";
+  var $plDescription= "This does something";
+
+  /* Proxy attributes */
+  var $gosaProxyAcctFlags= "[N    ]";
+  var $gosaProxyID= "";
+  var $gosaProxyWorkingStart= 420;
+  var $gosaProxyWorkingStop= 1020;
+  var $gosaProxyQuota= "5g";
+  var $gosaProxyQuotaPeriod= "m";
+
+  /* attribute list for save action */
+  var $attributes= array(   "gosaProxyID", "gosaProxyAcctFlags", "gosaProxyWorkingStart",
+                            "gosaProxyWorkingStop", "gosaProxyQuota", "gosaProxyQuotaPeriod");
+
+  var $objectclasses= array("gosaProxyAccount");
+  var $ReadOnly = false;
+
+  var $uid = "";
+  var $view_logged = FALSE;
+
+  function proxyAccount (&$config, $dn= NULL)
+  {
+    plugin::plugin ($config, $dn);
+    
+    /* Setting uid to default */
+    if(isset($this->attrs['uid'][0])){
+      $this->uid = $this->attrs['uid'][0];
+    }
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* Log view */
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","users/".get_class($this),$this->dn);
+    }
+
+    $display= "";
+
+    /* Prepare templating */
+    $smarty= get_smarty();
+
+    $smarty->assign('proxyAccountACL', " disabled ");
+    
+    if((!$this->ReadOnly)&& (($this->is_account && $this->acl_is_removeable()) || (!$this->is_account && $this->acl_is_createable()))){
+      $smarty->assign('proxyAccountACL', "");
+    }
+
+    /* Assign radio boxes */
+    foreach (array("F", "T", "B", "N") as $val){
+
+      if (is_integer(strpos($this->gosaProxyAcctFlags, "$val"))) {
+        $smarty->assign("filter$val", "checked");
+
+        /* Add state variables for on-the-fly state-changing of checkboxes */
+        $smarty->assign($val."state", "");
+        
+      } else {
+        $smarty->assign("filter$val", "");
+
+        /* Same as above */
+        if($_SESSION['js']==1){
+          $smarty->assign($val."state", "disabled");
+        }else{
+          $smarty->assign($val."state", "");
+        }
+      }
+    }
+
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $acl => $desc){
+      $smarty->assign($acl."ACL",$this->getacl($acl,$this->ReadOnly));
+      $smarty->assign($acl."_W",$this->acl_is_writeable($acl,$this->ReadOnly));
+    }
+
+    /* Assign working time */
+    $smarty->assign("starthour", (int)($this->gosaProxyWorkingStart / 60));
+    $smarty->assign("startminute", (int)($this->gosaProxyWorkingStart % 60));
+    $smarty->assign("stophour", (int)($this->gosaProxyWorkingStop / 60));
+    $smarty->assign("stopminute", (int)($this->gosaProxyWorkingStop % 60));
+    $hours= array();
+    for($i=0; $i<24; $i++){
+      $hours[]= sprintf("%02d",$i);
+    }
+    $smarty->assign("hours", $hours);
+    $smarty->assign("minutes", array("00","15","30","45"));
+
+    /* Assign quota values */
+    $smarty->assign("quota_unit", array("k" => _("KB"), "m" => _("MB"), "g" => _("GB")));
+    $smarty->assign("quota_time", array("h" => _("hour"), "d" => _("day"), "w" => _("week"), "m" => _("month")));
+    $smarty->assign("gosaProxyQuotaPeriod", $this->gosaProxyQuotaPeriod);
+    $smarty->assign("quota_size", preg_replace("/[a-z]$/i", "", $this->gosaProxyQuota));
+    $smarty->assign("quota_u", preg_replace("/^[0-9]+/", "", $this->gosaProxyQuota));
+    if ($this->is_account){
+      $smarty->assign("proxyState", "checked");
+    } else {
+      $smarty->assign("proxyState", "");
+    }
+
+    /* Prepare correct state */
+    if (!$this->is_account){
+      $smarty->assign("pstate", "disabled");
+    } else {
+      $smarty->assign("pstate", "");
+    }
+
+    $changeA = "";
+  
+    $ProxyWorkingStateChange ="\n";
+    if($this->acl_is_writeable("gosaProxyFlagT")){
+      $changeA .= "changeState('filterT');\n";
+
+      $ProxyWorkingStateChange.=  "changeState('startHour'); \n";
+      $ProxyWorkingStateChange.=  "changeState('startMinute'); \n";
+      $ProxyWorkingStateChange.=  "changeState('stopHour'); \n";
+      $ProxyWorkingStateChange.=  "changeState('stopMinute'); \n";
+    }
+
+    if(preg_match("/F/",$this->gosaProxyAcctFlags)){
+      $changeA .= $ProxyWorkingStateChange;
+    }
+  
+    $smarty->assign("ProxyWorkingStateChange",$ProxyWorkingStateChange);
+
+    $changeB = "";
+    if($this->acl_is_writeable("gosaProxyFlagB")){
+      $changeA .= "changeState('filterB');";
+      $changeB = 
+        "changeSubselectState('filterB', 'quota_size');
+         changeSubselectState('filterB', 'quota_unit');
+         changeSubselectState('filterB', 'gosaProxyQuotaPeriod');";
+    }
+
+    $smarty->assign("changeB",$changeB);
+    $smarty->assign("changeA",$changeA);
+
+    /* Show main page */
+    $display.= $smarty->fetch(get_template_path('proxy.tpl', TRUE, dirname(__FILE__)));
+    return($display);
+  }
+
+  function remove_from_parent()
+  {
+    if($this->acl_is_removeable() && $this->initially_was_account){   
+
+      plugin::remove_from_parent();
+
+      $ldap= $this->config->get_ldap_link();
+      @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
+          $this->attributes, "Save");
+      $ldap->cd($this->dn);
+      $this->cleanup();
+      $ldap->modify ($this->attrs); 
+
+      /* Log last action */
+      new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+
+      show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/proxy account with dn '%s' failed."),$this->dn));
+
+      /* Optionally execute a command after we're done */
+      $this->handle_post_events("remove",array("uid" => $this->uid));
+    }
+  }
+
+  /* Check values */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+    
+    /* We've got only one value to check for positive integer or emtpy field */
+    if ($this->is_account){
+      if($this->acl_is_writeable("gosaProxyQuota")){
+        if (isset($_POST["quota_size"])){
+          if ($_POST["quota_size"] == "gosaProxyQuota"){
+            $message[]= _("Numerical value for Quota Setting is empty.");
+          }elseif ($_POST["quota_size"] <= 0){
+            $message[]= _("Numerical value for Quota Setting is not valid.");
+          }
+        }
+      }
+    }
+
+    return $message;
+  }
+
+  /* Save data to object */
+  function save_object()
+  {
+    /* Do we need to flip is_account state? */
+    if (isset($_POST['connectivityTab'])){
+      if (isset($_POST['proxy'])){
+        if (!$this->is_account && $_POST['proxy'] == "B"){
+          if($this->acl_is_createable()){
+            $this->is_account= TRUE;
+          }
+        }
+      } else {
+        if($this->acl_is_removeable()){
+          $this->is_account= FALSE;
+        }
+      }
+    }
+
+    /* Save flag value */
+    if ($this->is_account){
+
+      $flags= "";
+      $acl= "";
+      foreach(array("F", "T", "B") as $key){
+        if($this->acl_is_writeable("gosaProxyFlag".$key)){
+  
+          /* Add acl */
+          if (isset($_POST["filter$key"])){
+            $flags.= $key;
+          }
+        }else{
+          
+          /* Keep all flags that can't be written*/
+          if(preg_match("/".$key."/",$this->gosaProxyAcctFlags)){
+            $flags .=$key;
+          }
+        }
+      }
+      if ("[$flags]" != $this->gosaProxyAcctFlags){
+        $this->is_modified= TRUE;
+      }
+      $this->gosaProxyAcctFlags= "[$flags]";
+
+      /* Save time values */
+      if ($this->acl_is_writeable("gosaProxyFlagT")){
+        if(isset($_POST['startMinute'])){
+          $old= $this->gosaProxyWorkingStart;
+          $this->gosaProxyWorkingStart= $_POST["startHour"] * 60 + $_POST["startMinute"];
+          $this->is_modified= ($old != $this->gosaProxyWorkingStart)?TRUE:$this->is_modified;
+        }
+
+        if (isset($_POST['stopMinute'])){
+          $old= $this->gosaProxyWorkingStop;
+          $this->gosaProxyWorkingStop = $_POST["stopHour"]  * 60 + $_POST["stopMinute"];
+          $this->is_modified= ($old != $this->gosaProxyWorkingStop)?TRUE:$this->is_modified;
+        }
+      }
+
+      /* Save quota values */
+      if ($this->acl_is_writeable("gosaProxyFlagB")){
+        if(isset($_POST["quota_size"]) && isset($_POST["quota_unit"])){
+          $this->gosaProxyQuota= $_POST["quota_size"].$_POST["quota_unit"];
+        }
+      }
+  
+      /*Save quota period */
+      if($this->acl_is_writeable("gosaProxyFlagB")){
+        if(isset($_POST["gosaProxyQuotaPeriod"])){
+          $this->gosaProxyQuotaPeriod = $_POST["gosaProxyQuotaPeriod"];
+        }
+      }
+    }
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    plugin::save();
+
+    /* Write back to ldap */
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd($this->dn);
+    $this->cleanup();
+    $ldap->modify ($this->attrs); 
+
+    /* Log last action */
+    if($this->initially_was_account){
+      new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
+
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/proxy account 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",array("uid" => $this->uid));
+      }
+    } else {
+      $this->handle_post_events("add",array("uid" => $this->uid));
+    }
+
+  }
+
+  /* Return plugin informations for acl handling 
+      #FIME There possibly some attributes that can be combined to one acl. */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"     => _("Proxy"),
+          "plDescription"   => _("Proxy account")."&nbsp;:&nbsp;<u>"._("Connectivity addon")."</u>",
+          "plSelfModify"    => TRUE,
+          "plDepends"       => array("user"),
+          "plPriority"      => 21,                                 // Position in tabs
+          "plSection"     => array("personal" => _("My account")),
+          "plCategory"    => array("users"),
+          "plOptions"       => array(),
+
+          "plProvidedAcls"  => array(
+            "gosaProxyFlagF"       => _("Filter unwanted content"), 
+            "gosaProxyFlagT"       => _("Limit proxy access"),
+            "gosaProxyFlagB"       => _("Restrict proxy usage by quota"))
+          ));
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/personal/connectivity/class_pureftpdAccount.inc b/gosa-core/plugins/personal/connectivity/class_pureftpdAccount.inc
new file mode 100644 (file)
index 0000000..68de2e8
--- /dev/null
@@ -0,0 +1,256 @@
+<?php
+
+class pureftpdAccount extends plugin
+{
+  /* Definitions */
+  var $plHeadline= "FTP";
+  var $plDescription= "This does something";
+
+  /* FTP attributes */
+  var $FTPQuotaFiles = 0;
+  var $FTPQuotaMBytes = 0;
+  var $FTPUploadRatio = 0;
+  var $FTPDownloadRatio = 0;
+  var $FTPUploadBandwidth = 0;
+  var $FTPDownloadBandwidth = 0;
+  var $FTPStatus = "enabled";
+  var $FTPuid = "";
+  var $FTPgid = "";
+
+  var $uid = "";
+
+  /* attribute list for save action */
+  var $attributes= array("FTPQuotaFiles","FTPQuotaMBytes","FTPUploadRatio","FTPDownloadRatio",
+      "FTPUploadBandwidth","FTPDownloadBandwidth","FTPStatus","FTPuid","FTPgid");
+  var $objectclasses= array("PureFTPdUser");
+  var $ReadOnly;
+  var $view_logged = FALSE;
+
+  function pureftpdAccount (&$config, $dn= NULL, $parent= NULL)
+  {
+    plugin::plugin ($config, $dn, $parent);
+    
+    /* Setting uid to default */
+    if(isset($this->attrs['uid'][0])){
+      $this->uid = $this->attrs['uid'][0];
+    }
+  }
+
+  function execute()
+  {
+    /* Log view */
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","users/".get_class($this),$this->dn);
+    }
+
+    /* Show tab dialog headers */
+    $display= "";
+
+    /* Show main page */
+    $smarty= get_smarty();
+
+    /* Load attributes */
+    foreach($this->attributes as $val){
+      $smarty->assign("$val", $this->$val);
+    }
+
+
+    $tmp = $this->plInfo();
+    $changeState = "";
+    foreach($tmp['plProvidedAcls'] as $key => $desc){
+      $smarty->assign($key."ACL", $this->getacl($key,$this->ReadOnly));
+      $smarty->assign($key."_W", $this->acl_is_writeable($key,$this->ReadOnly));
+  
+      if($this->acl_is_writeable($key)){
+        $changeState.= " changeState('".$key."'); \n";
+      }
+    }
+    $smarty->assign("changeState",$changeState);
+
+
+    $smarty->assign("fstate", "");
+    if ($this->is_account){
+      $smarty->assign("pureftpdState", "checked");
+      $smarty->assign("fstate", "");
+    } else {
+      $smarty->assign("pureftpdState", "");
+      if($_SESSION['js']==1){
+        if($this->acl!="#none#")
+        $smarty->assign("fstate", "disabled");
+      }else{
+        $smarty->assign("fstate", "");
+      }
+    }
+    $smarty->assign("use_FTPStatus", ($this->FTPStatus == "disabled") ? "checked" : "");
+    
+    if((!$this->ReadOnly)&&(($this->is_account && $this->acl_is_removeable()) || (!$this->is_account && $this->acl_is_createable())) ){
+      $smarty->assign('pureftpdACL', "");
+    }else{
+      $smarty->assign('pureftpdACL', " disabled ");
+    }
+
+    $display.= $smarty->fetch (get_template_path('pureftpd.tpl', TRUE, dirname(__FILE__)));
+    return ($display);
+  }
+
+  function remove_from_parent()
+  {
+    /* Cancel if there's nothing to do here */
+    if ((!$this->initially_was_account) || (!$this->acl_is_removeable())){
+      return;
+    }
+
+    plugin::remove_from_parent();
+    $ldap= $this->config->get_ldap_link();
+
+    $ldap->cd($this->dn);
+    @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
+        $this->attributes, "Save");
+    $this->cleanup();
+    $ldap->modify ($this->attrs); 
+
+    /* Log last action */
+    new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+  
+    show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/pureftpd account with dn '%s' failed."),$this->dn));
+
+    /* Optionally execute a command after we're done */
+    $this->handle_post_events('remove',array("uid" => $this->uid));
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    /* Do we need to flip is_account state? */
+    if (isset($_POST['connectivityTab'])){
+      if (isset($_POST['pureftpd'])){
+        if (!$this->is_account && $_POST['pureftpd'] == "B"){
+          $this->is_account= TRUE;
+        }
+      } else {
+        $this->is_account= FALSE;
+      }
+
+      plugin::save_object();
+
+      $old= $this->FTPStatus;
+      if (isset($_POST["FTPStatus"])){
+        $this->FTPStatus = "disabled";
+      } else {
+        $this->FTPStatus = "enabled";
+      }
+      $this->is_modified= ($old != $this->FTPStatus)?TRUE:$this->is_modified;
+
+      /* Ensure that these vars are numeric. Values starting with 0 like '0123' cause ldap errors */
+      foreach(array("FTPQuotaFiles","FTPQuotaMBytes","FTPUploadRatio","FTPDownloadRatio","FTPUploadBandwidth","FTPDownloadBandwidth") as $testVar){
+        $this->$testVar = (int) ($this->$testVar);
+      }
+    
+
+    }
+  }
+
+
+  /* Check values */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    /* Check for positive integer values */
+    if ($this->is_account){
+
+      if($this->acl_is_writeable("FTPUploadBandwidth") && !is_id($this->FTPUploadBandwidth)){
+        $message[]= _("Value specified as 'Upload bandwidth' is not valid.");
+      }
+      if($this->acl_is_writeable("FTPDownloadBandwidth") && !is_id($this->FTPDownloadBandwidth)){
+        $message[]= _("Value specified as 'Download bandwidth' is not valid.");
+      }
+
+      if($this->acl_is_writeable("FTPQuotaFiles") && !is_id($this->FTPQuotaFiles)){
+        $message[]= _("Value specified as 'Quota files' is not valid.");
+      }
+      if($this->acl_is_writeable("FTPQuotaMBytes") && !is_id($this->FTPQuotaMBytes)){
+        $message[]= _("Value specified as 'Quota size' is not valid.");
+      }
+      if($this->acl_is_writeable("FTPUploadRatio") && !is_id($this->FTPUploadRatio)){
+        $message[]= _("Value specified as 'Upload ratio' is not valid.");
+      }
+      if($this->acl_is_writeable("FTPDownloadRatio") && !is_id($this->FTPDownloadRatio)){
+        $message[]= _("Value specified as 'Download ratio' is not valid.");
+      }
+    }
+
+    return $message;
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    plugin::save();
+
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $key => $desc){
+      if(!$this->acl_is_writeable($key)){
+        unset($this->attrs[$key]);
+      }
+    }
+
+    /* Write back to ldap */
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd($this->dn);
+    $this->cleanup();
+    $ldap->modify ($this->attrs); 
+    
+    /* Log last action */
+    if($this->initially_was_account){
+      new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
+
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/pureftpd account 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",array("uid" => $this->uid));
+      }
+    } else {
+      $this->handle_post_events("add",array("uid" => $this->uid));
+    }
+
+  }
+
+
+  /* Return plugin informations for acl handling
+  #FIME There possibly some attributes that can be combined to one acl. */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"     => _("Ftp"),
+          "plDescription"   => _("Pure ftp account")."&nbsp;:&nbsp;<u>"._("Connectivity addon")."</u>",
+          "plSelfModify"    => TRUE,
+          "plDepends"       => array("user"),
+          "plPriority"      => 22,                                 // Position in tabs
+          "plSection"     => array("personal" => _("My account")),
+          "plCategory"    => array("users"),
+          "plOptions"       => array(),
+
+          "plProvidedAcls"  => array(
+            "FTPQuotaFiles"         => _("Quota files"),
+            "FTPUploadRatio"        => _("Upload ratio"),
+            "FTPQuotaMBytes"        => _("Quota MBytes"),
+            "FTPDownloadRatio"      => _("Download ratio"),
+            "FTPUploadBandwidth"    => _("Upload bandwith"),
+            "FTPDownloadBandwidth"  => _("Download bandwith"),
+            "FTPStatus"             => _("Status"))
+          ));
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/personal/connectivity/class_webdavAccount.inc b/gosa-core/plugins/personal/connectivity/class_webdavAccount.inc
new file mode 100644 (file)
index 0000000..59fdb60
--- /dev/null
@@ -0,0 +1,171 @@
+<?php
+
+class webdavAccount extends plugin
+{
+  /* Definitions */
+  var $plHeadline= "WebDAV";
+  var $plDescription= "This does something";
+
+  /* attribute list for save action */
+  var $attributes= array();
+  var $objectclasses= array("gosaWebdavAccount");
+  var $ReadOnly = false;
+  var $view_logged = FALSE;
+  var $uid ="";
+
+  function webdavAccount (&$config, $dn= NULL)
+  {
+    plugin::plugin ($config, $dn);
+    
+    /* Setting uid to default */
+    if(isset($this->attrs['uid'][0])){
+      $this->uid = $this->attrs['uid'][0];
+    }
+  }
+
+  function execute()
+  {
+       /* Call parent execute */
+//     plugin::execute();
+
+    /* Log view */
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","users/".get_class($this),$this->dn);
+    }
+
+    /* Show tab dialog headers */
+    $display= "";
+
+    /* Show main page */
+    $smarty= get_smarty();
+
+    if ($this->is_account){
+      $smarty->assign("webdavState", "checked");
+    } else {
+      $smarty->assign("webdavState", "");
+      $smarty->assign("wstate", "disabled");
+    }
+
+    if ($this->parent !== NULL){
+      $smarty->assign("tabbed", 1);
+    }
+
+    if((!$this->ReadOnly) && (($this->is_account && $this->acl_is_removeable()) || (!$this->is_account && $this->acl_is_createable()))) {
+      $smarty->assign('webdavAccountACL', "");
+    }else{
+      $smarty->assign('webdavAccountACL', " disabled ");
+    }
+
+    $display.= $smarty->fetch (get_template_path('webdav.tpl', TRUE, dirname(__FILE__)));
+    return ($display);
+  }
+
+  function remove_from_parent()
+  {
+    if($this->acl_is_createable() || $this->is_account){
+      /* Cancel if there's nothing to do here */
+      if (!$this->initially_was_account){
+        return;
+      }
+
+      plugin::remove_from_parent();
+      $ldap= $this->config->get_ldap_link();
+
+      $ldap->cd($this->dn);
+      @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
+          $this->attributes, "Save");
+      $this->cleanup();
+      $ldap->modify ($this->attrs); 
+
+      /* Log last action */
+      new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+
+      show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/webDAV account with dn '%s' failed."),$this->dn));
+
+      /* Optionally execute a command after we're done */
+      $this->handle_post_events('remove',array("uid" => $this->uid));
+    }
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    /* Do we need to flip is_account state? */
+    if (isset($_POST['connectivityTab'])){
+      if (isset($_POST['webdav'])){
+        if (!$this->is_account && $_POST['webdav'] == "B"){
+          if($this->acl_is_createable()){
+            $this->is_account= TRUE;
+          }
+        }
+      } else {
+        if($this->acl_is_removeable()){
+          $this->is_account= FALSE;
+        }
+      }
+    }
+
+    plugin::save_object();
+    if (isset($_POST["WEBDAVStatus"])){
+      $this->WEBDAVStatus = "disabled";
+    } else {
+      $this->WEBDAVStatus = "enabled";
+    }
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    if($this->acl_is_createable()){
+      plugin::save();
+
+      /* Write back to ldap */
+      $ldap= $this->config->get_ldap_link();
+      $ldap->cd($this->dn);
+      $this->cleanup();
+      $ldap->modify ($this->attrs); 
+
+      /* Log last action */
+      if($this->initially_was_account){
+        new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+      }else{
+        new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+      }
+
+      show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/webDAV account 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",array("uid" => $this->uid));
+        }
+      } else {
+        $this->handle_post_events("add",array("uid" => $this->uid));
+      }
+    }
+  }
+
+  /* Return plugin informations for acl handling
+      #FIXME This is only an enable/disable checkbox for this account, there is possibly a better solution available later */
+  static function plInfo()
+  {
+    return (array(  
+          "plShortName"     => _("WebDAV"),
+          "plDescription"   => _("WebDAV account")."&nbsp;:&nbsp;<u>"._("Connectivity addon")."</u>",
+          "plSelfModify"    => TRUE,
+          "plDepends"       => array("user"),
+          "plPriority"      => 23,                                 // Position in tabs
+          "plSection"     => array("personal" => _("My account")),
+          "plCategory"    => array("users"),
+          "plOptions"       => array(),
+
+          "plProvidedAcls"  => array()
+          ));
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/personal/connectivity/glpi.tpl b/gosa-core/plugins/personal/connectivity/glpi.tpl
new file mode 100644 (file)
index 0000000..245b903
--- /dev/null
@@ -0,0 +1 @@
+<h2>{if $tabbed eq 1}<input type="checkbox" name="glpi" value="B" {$glpiState} {$glpiACL}>{/if}{t}GLPI account{/t}</h2>
diff --git a/gosa-core/plugins/personal/connectivity/intranet.tpl b/gosa-core/plugins/personal/connectivity/intranet.tpl
new file mode 100644 (file)
index 0000000..f768285
--- /dev/null
@@ -0,0 +1,4 @@
+<h2>
+       <input type="checkbox" name="intranet" value="B" {$intranetState} {$gosaIntranetACL}>
+       {t}Intranet account{/t}
+</h2>
diff --git a/gosa-core/plugins/personal/connectivity/kolab.tpl b/gosa-core/plugins/personal/connectivity/kolab.tpl
new file mode 100644 (file)
index 0000000..8b7bd6e
--- /dev/null
@@ -0,0 +1,104 @@
+
+{if !$mail_account}
+       <h2>{t}Kolab account{/t}</h2>
+       {t}The kolab account is currently disabled. It's features can be adjusted if you add a mail account.{/t}
+{else}
+
+
+
+<input type="checkbox" id="kolabState" name="kolabState" value="1" {if $kolabState} checked {/if} 
+       {if (!$is_account && $is_createable) || ($is_account && $is_removeable)}
+       {else}
+               disabled        
+       {/if}
+       onClick="
+       {if $kolabDelegate_W}
+       changeState('delegate_list');
+       changeState('delegate_address');
+       changeState('add_delegation');
+       changeState('delete_delegation');
+       {/if}
+       {if $unrestrictedMailSize_W}
+       changeState('unrestrictedMailSize');
+       {/if}
+       {if $calFBURL_W}
+       changeState('calFBURL');
+       {/if}
+       {if $kolabFreeBusyFuture_W}
+       changeState('kolabFreeBusyFuture');
+       {/if}
+       {if $kolabInvitationPolicy_W}
+       {$changeState}
+       {/if}">
+
+
+<b>{t}Kolab account{/t}</b>
+<br>
+<br>
+<table summary="" style="width:100%">
+ <tr>
+  <td style="width:50%; vertical-align:top;">
+   <b><LABEL for="delegate_list">{t}Delegations{/t}</LABEL></b><br>
+{render acl=$kolabDelegateACL}
+   <select id="delegate_list" style="width:350px; height:100px;" name="delegate_list[]" size=15 multiple  {if !$kolabState}disabled{/if} >
+    {html_options values=$kolabDelegate output=$kolabDelegate}
+       <option disabled>&nbsp;</option>
+   </select>
+{/render}
+   <br>
+{render acl=$kolabDelegateACL}
+   <input name="delegate_address" size=30 align=middle maxlength=60 {if !$kolabState} disabled {/if} value="" id="delegate_address">
+{/render}
+{render acl=$kolabDelegateACL}
+   <input type=submit value="{t}Add{/t}" name="add_delegation" {if !$kolabState} disabled {/if} id="add_delegation">&nbsp;
+{/render}
+{render acl=$kolabDelegateACL}
+   <input type=submit value="{t}Delete{/t}" name="delete_delegation" {if !$kolabState} disabled {/if} id="delete_delegation">
+{/render}
+   <p>
+    <b>{t}Mail size{/t}</b><br>
+{render acl=$unrestrictedMailSizeACL}
+     &nbsp;<input type="checkbox" id='unrestrictedMailSize' name="unrestrictedMailSize" value="1" {if !$kolabState} disabled {/if}
+       {$unrestrictedMailSizeState}> {t}No mail size restriction for this account{/t}
+{/render}
+    </p>
+  </td>
+  <td rowspan=2 style="border-left:1px solid #A0A0A0">
+   &nbsp;
+  </td>
+  <td style="vertical-align:top;">
+
+ <b>{t}Free Busy information{/t}</b><br>
+ <table summary="">
+  <tr>
+   <td><LABEL for="calFBURL">{t}URL{/t}</LABEL></td>
+   <td>
+{render acl=$calFBURLACL}
+   <input id="calFBURL" name="calFBURL" size=30 maxlength=60 value="{$calFBURL}" {if !$kolabState} disabled {/if}>
+{/render}
+   </td>
+  </tr>
+  <tr>
+  <td><LABEL for="kolabFreeBusyFuture">{t}Future{/t}</LABEL></td>
+  <td>
+{render acl=$kolabFreeBusyFutureACL}
+   <input id="kolabFreeBusyFuture" name="kolabFreeBusyFuture" size=5 maxlength=6 {if !$kolabState} disabled {/if} value="{$kolabFreeBusyFuture}"> 
+       {t}days{/t}
+{/render}
+   </td>
+  </tr>
+ </table>
+
+
+ <b>{t}Invitation policy{/t}</b><br>
+{render acl=$kolabInvitationPolicyACL}
+ <table summary="">
+   {$invitation}
+ </table>
+{/render}
+
+  </td>
+ </tr>
+</table>
+
+{/if}
diff --git a/gosa-core/plugins/personal/connectivity/main.inc b/gosa-core/plugins/personal/connectivity/main.inc
new file mode 100644 (file)
index 0000000..14472f2
--- /dev/null
@@ -0,0 +1,124 @@
+<?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
+ */
+
+if (!$remove_lock){
+  /* Reset requested? */
+  if (isset($_POST['edit_cancel']) ||
+      (isset($_GET['reset']) && $_GET['reset'] == 1)){
+
+    del_lock ($ui->dn);
+    sess_del ('edit');
+    sess_del ('connectivity');
+  }
+
+  /* Create connectivity object on demand */
+  if (!isset($_SESSION['connectivity']) || (isset($_GET['reset']) &&
+      $_GET['reset'] == 1)){
+    $_SESSION['connectivity']= new connectivity ($config, $ui->dn);
+    $_SESSION['connectivity']->enable_CSN_check();
+    $_SESSION['connectivity']->set_acl_base($ui->dn);
+    $_SESSION['connectivity']->set_acl_category("users");
+
+    /* Adjust acl's to mode */
+    foreach ($_SESSION['connectivity']->plugin_name as $name){
+      $_SESSION['connectivity']->plugin[$name]->set_acl_category( "users");
+      $_SESSION['connectivity']->plugin[$name]->set_acl_base($ui->dn);
+    }
+  }
+  $connectivity= $_SESSION['connectivity'];
+
+  /* save changes back to object */
+  if (isset ($_SESSION['edit'])){
+    $connectivity->save_object ();
+  }
+
+  /* Enter edit mode? */
+  if (isset($_POST['edit'])){
+
+    /* Check locking */
+    if ((($username= get_lock($ui->dn)) != "") && (!isset($_SESSION['edit']))){
+      $_SESSION['back_plugin']= $plug;
+      gen_locked_message ($username, $ui->dn);
+      exit ();
+    }
+
+
+    /* Lock the current entry */
+    add_lock ($ui->dn, $ui->dn);
+    $_SESSION['dn']= $ui->dn;
+    $_SESSION['edit']= TRUE;
+  }
+
+  /* save changes to LDAP and disable edit mode */
+  if (isset($_POST['edit_finish'])){
+
+    /* Perform checks */
+    $message= $connectivity->check ();
+
+    /* No errors, save object */
+    if (count ($message) == 0){
+      $connectivity->save ();
+      del_lock ($ui->dn);
+      sess_del ('edit');
+
+      /* Remove from session */
+      sess_del ('connectivity');
+    } else {
+      /* Errors found, show message */
+      show_errors ($message);
+    }
+  }
+
+  /* Execute formular */
+  $display= $connectivity->execute ();
+
+  /* Store changes  in session */
+  if (isset ($_SESSION['edit'])){
+    $_SESSION['connectivity']= $connectivity;
+  }
+
+  $info= "";
+
+  $display.="<div align='right'>";
+  if (isset($_SESSION['edit'])){
+    $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
+    $display.= "&nbsp;";
+    $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+    $info= "<img class=\"center\" alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png').
+      "\"> ".$ui->dn."&nbsp;";
+  } else {
+    $info= "<img class=\"center\" alt=\"\" align=\"middle\" src=\"".get_template_path('images/openlock.png').
+      "\"> ".$ui->dn."&nbsp;";
+
+    $info.= "<img class=\"center\" alt=\"\" align=\"middle\" src=\"".get_template_path('images/lamp.png').
+      "\">"._("Click the 'Edit' button below to change informations in this dialog");
+    $display.= "<input type=submit name=\"edit\" value=\""._("Edit")."\">\n";
+    $display.= "<input type=\"hidden\" name=\"ignore\">\n";
+  }
+  $display.="</div>";
+
+  /* Page header*/
+  $display= print_header(get_template_path('images/proxy.png'),
+      _("Connectivity"), $info).$display;
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/personal/connectivity/opengw.tpl b/gosa-core/plugins/personal/connectivity/opengw.tpl
new file mode 100644 (file)
index 0000000..5687417
--- /dev/null
@@ -0,0 +1,59 @@
+<h2><input type="checkbox" value="1" name="is_account" {$is_account} {$opengwAccountACL} onClick="document.mainform.submit();">&nbsp;{t}Opengroupware{/t}</h2>
+<table width="100%" summary="">
+       <tr>
+               <td width="50%">
+                       <table summary="">
+                               <tr>
+                                       <td>
+                                               {t}Location team{/t} &nbsp;
+                                       </td>
+                                       <td>
+{render acl=$LocationTeamACL}
+                                               <select size="1" id="LocationTeam" name="LocationTeam"
+                                                       {if $OGWstate!=""} disabled {/if}>
+                                                       {html_options values=$validLocationTeams output=$validLocationTeam selected=$LocationTeam}
+                                               </select>
+{/render}
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>
+                                               {t}Template user{/t} &nbsp;
+                                       </td>
+                                       <td>
+{render acl=$TemplateUserACL}
+                                               <select size="1" id="TemplateUser" name="TemplateUser" {if $OGWstate!=""} disabled {/if}>
+                                                       {html_options values=$validTemplateUsers output=$validTemplateUser selected=$TemplateUser}
+                                               </select>
+{/render}
+                                       </td>
+                               </tr>   
+                               <tr>
+                                       <td valign="top">
+                                               {t}Locked{/t} &nbsp; 
+                                       </td>
+                                       <td valign="top">
+{render acl=$LockedACL}
+                                               <input type="checkbox" value="1" name="is_locked" {$is_lockedCHK}  
+                                                  {if $OGWstate!=""} disabled {/if}>
+{/render}
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+               <td valign="top" style="border-left: 1px solid rgb(160, 160, 160);">
+                       <table summary="">
+                               <tr>
+                                       <td valign="top">
+                                               {t}Teams{/t} &nbsp; 
+                                       </td>
+                                       <td valign="top">
+{render acl=$TeamsACL}
+                                               {$validTeams}   
+{/render}
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+       </tr>
+</table>
diff --git a/gosa-core/plugins/personal/connectivity/oxchange.tpl b/gosa-core/plugins/personal/connectivity/oxchange.tpl
new file mode 100644 (file)
index 0000000..2bd2049
--- /dev/null
@@ -0,0 +1,84 @@
+{if !$pg}
+<h2>{t}Open-Xchange Account{/t} - {t}disabled, no Postgresql support detected. Or the specified database can't be reached{/t}</h2>
+{else}
+<h2>
+<input type="checkbox" name="oxchange" value="B" 
+       {$oxchangeState} {$oxchangeAccountACL} 
+       onCLick="       
+       {if $OXAppointmentDays_W} 
+               changeState('OXAppointmentDays');
+       {/if}
+       {if $OXTaskDays_W} 
+               changeState('OXTaskDays');
+       {/if}
+       {if $OXTimeZone_W} 
+               changeState('OXTimeZone'); 
+       {/if}
+       ">
+{t}Open-Xchange account{/t}</h2>
+
+
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=0 border=0>
+
+ <!-- Headline container -->
+ <tr>
+   <td style="width:50%; vertical-align:top;">
+     <table summary="" style="margin-left:4px;">
+       <tr>
+         <td colspan=2 style="vertical-align:top;">
+           <b>{t}Remember{/t}</b>
+         </td>
+       </tr>
+       <tr>
+         <td><LABEL for="OXAppointmentDays">{t}Appointment Days{/t}</LABEL></td>
+        <td>
+
+{render acl=$OXAppointmentDaysACL}     
+<input name="OXAppointmentDays" id="OXAppointmentDays" size=7 maxlength=7 value="{$OXAppointmentDays}" {$oxState} >
+{/render}
+        {t}days{/t}</td>
+       </tr>
+       <tr>
+         <td><LABEL for="OXTaskDays">{t}Task Days{/t}</LABEL></td>
+        <td>
+
+{render acl=$OXTaskDaysACL}    
+<input name="OXTaskDays" id="OXTaskDays" size=7 maxlength=7 value="{$OXTaskDays}" {$oxState} >
+{/render}
+
+        {t}days{/t}
+       </td>
+       </tr>
+     </table>
+   </td>
+   <td rowspan=2 style="border-left:1px solid #A0A0A0">
+     &nbsp;
+   </td>
+   <td style="vertical-align:top;">
+     <table summary="">
+       <tr>
+         <td colspan=2 style="vertical-align:top;">
+           <b>{t}User Information{/t}</b>
+         </td>
+       </tr>
+       <tr>
+         <td><LABEL for="OXTimeZone">{t}User Timezone{/t}</LABEL></td>
+        <td>
+
+{render acl=$OXTimeZoneACL}    
+<select size="1" name="OXTimeZone" id="OXTimeZone" {$oxState} > 
+ {html_options values=$timezones output=$timezones selected=$OXTimeZone}
+ </select>
+{/render}
+
+        </td>
+       </tr>
+       <tr>
+         <td></td>
+        <td></td>
+       </tr>
+     </table>
+   </td>
+ </tr>
+</table>
+{/if}
diff --git a/gosa-core/plugins/personal/connectivity/phpgw.tpl b/gosa-core/plugins/personal/connectivity/phpgw.tpl
new file mode 100644 (file)
index 0000000..299da67
--- /dev/null
@@ -0,0 +1,4 @@
+<h2>
+       <input type="checkbox" name="phpgw" value="B" {$phpgwState} {$phpgwAccountACL}>
+       {t}PHPGroupware account{/t}
+</h2>
diff --git a/gosa-core/plugins/personal/connectivity/phpscheduleit.tpl b/gosa-core/plugins/personal/connectivity/phpscheduleit.tpl
new file mode 100644 (file)
index 0000000..7e5510c
--- /dev/null
@@ -0,0 +1,4 @@
+<h2>
+       <input type="checkbox" name="phpscheduleit" value="B" {$phpscheduleitState} {$gosaphpscheduleitACL}>
+       {t}PHPscheduleit account{/t}
+</h2>
diff --git a/gosa-core/plugins/personal/connectivity/pptp.tpl b/gosa-core/plugins/personal/connectivity/pptp.tpl
new file mode 100644 (file)
index 0000000..15d28a7
--- /dev/null
@@ -0,0 +1,4 @@
+<h2>
+       <input type="checkbox" name="pptp" value="B" {$pptpState} {$gosapptpACL}>
+       {t}PPTP account{/t}
+</h2>
diff --git a/gosa-core/plugins/personal/connectivity/proxy.tpl b/gosa-core/plugins/personal/connectivity/proxy.tpl
new file mode 100644 (file)
index 0000000..5178237
--- /dev/null
@@ -0,0 +1,114 @@
+<h2>
+ <input type="checkbox" id="proxy" name="proxy" value="B" {$proxyState} {$proxyAccountACL} 
+   onClick="
+
+{if $gosaProxyFlagF_W}
+    changeState('filterF');
+{/if}
+
+{if $gosaProxyFlagT_W}
+       changeState('filterT'); 
+       changeTripleSelectState('proxy', 'filterT', 'startHour'); 
+       changeTripleSelectState('proxy', 'filterT', 'startMinute'); 
+       changeTripleSelectState('proxy', 'filterT', 'stopMinute'); 
+       changeTripleSelectState('proxy', 'filterT', 'stopHour'); 
+{/if}
+{if $gosaProxyFlagB_W}
+       changeState('filterB'); 
+       changeTripleSelectState('proxy', 'filterB', 'quota_unit'); 
+       changeTripleSelectState('proxy', 'filterB', 'quota_size');
+       changeTripleSelectState('proxy', 'filterB', 'gosaProxyQuotaPeriod');
+{/if}
+   ">
+ {t}Proxy account{/t}</h2>
+
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=0 border=0>
+ <tr>
+   <td>
+    <table summary="" border=0 width="100%" cellpadding=0>
+    <tr><td colspan=2>
+
+{render acl=$gosaProxyFlagFACL}
+    <input type="checkbox" name="filterF" id="filterF" value="F" {$filterF} {$pstate} >
+{/render}
+    {t}Filter unwanted content (i.e. pornographic or violence related){/t}
+    </td></tr>
+     <tr>
+      <td width="50%">
+
+{render acl=$gosaProxyFlagTACL}
+    <input type="checkbox" name="filterT" id="filterT" value="T" {$filterT} {$pstate}  onClick="javascript:
+ {$ProxyWorkingStateChange}">
+{/render}
+
+    <LABEL for="startHour">{t}Limit proxy access to working time{/t}</LABEL>
+    <br>
+    <table summary="" style="margin-left:20px;">
+     <tr>
+      <td>
+
+{render acl=$gosaProxyFlagTACL}
+        <select size="1" id="startHour" name="startHour" {if $Tstate!="" || $pstate!=""} disabled {/if}  >
+         {html_options values=$hours output=$hours selected=$starthour}
+        </select>
+{/render}
+        &nbsp;:&nbsp;
+{render acl=$gosaProxyFlagTACL}
+        <select size="1" id="startMinute" name="startMinute" {if $Tstate!="" || $pstate!=""} disabled {/if}  >
+         {html_options values=$minutes output=$minutes selected=$startminute}
+        </select>
+{/render}
+        &nbsp;-&nbsp;
+{render acl=$gosaProxyFlagTACL}
+        <select size="1" id="stopHour" name="stopHour" {if $Tstate!="" || $pstate!=""} disabled {/if} >
+   {html_options values=$hours output=$hours selected=$stophour}
+        </select>
+{/render}
+        &nbsp;:&nbsp;
+{render acl=$gosaProxyFlagTACL}
+        <select size="1" id="stopMinute" name="stopMinute" {if $Tstate!="" || $pstate!=""} disabled {/if}>
+         {html_options values=$minutes output=$minutes selected=$stopminute}
+        </select>
+{/render}
+      </td>
+     </tr>
+    </table>
+      </td>
+   <td rowspan=2 style="border-left:1px solid #A0A0A0">
+     &nbsp;
+   </td>
+      <td>
+{render acl=$gosaProxyFlagBACL}
+    <input type="checkbox" id="filterB" name="filterB" value="B" {$filterB} {if $pstate=="disabled"} disabled {/if} onClick="{$changeB}">
+{/render}
+    <LABEL for="quota_size">{t}Restrict proxy usage by quota{/t}</LABEL>
+    <br>
+    <table summary="" style="margin-left:20px;">
+     <tr>
+      <td>
+{render acl=$gosaProxyFlagBACL}
+       <input name="quota_size" id="quota_size" size=7 maxlength=10 value="{$quota_size}" {if $Tstate!="" || $pstate!=""} disabled {/if} >
+{/render}
+       &nbsp;
+{render acl=$gosaProxyFlagBACL}
+       <select size="1" name="quota_unit" id="quota_unit" {if $Tstate!="" || $pstate!=""} disabled {/if} >
+       {html_options options=$quota_unit selected=$quota_u}
+       </select>
+{/render}
+    
+       <LABEL for="gosaProxyQuotaPeriod">{t}per{/t}</LABEL>
+{render acl=$gosaProxyFlagBACL}
+       <select size="1" name="gosaProxyQuotaPeriod" id="gosaProxyQuotaPeriod" {if $Tstate!="" || $pstate!=""} disabled {/if} >
+        {html_options options=$quota_time selected=$gosaProxyQuotaPeriod}
+       </select>
+{/render}
+      </td>
+     </tr>
+    </table>
+   </td>
+   </tr>
+   </table>
+  </td>
+ </tr>
+</table>
+
diff --git a/gosa-core/plugins/personal/connectivity/pureftpd.tpl b/gosa-core/plugins/personal/connectivity/pureftpd.tpl
new file mode 100644 (file)
index 0000000..714ef78
--- /dev/null
@@ -0,0 +1,112 @@
+<h2>
+       <input type="checkbox" name="pureftpd" value="B" {$pureftpdState} {$pureftpdACL} 
+               onclick="{$changeState}" >
+       {t}FTP account{/t}
+</h2>
+
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=0 border=0>
+
+ <!-- Headline container -->
+ <tr>
+   <td style="width:50%; vertical-align:top;">
+     <table summary="" style="margin-left:4px;">
+       <tr>
+         <td colspan=2 style="vertical-align:top;">
+           <b>{t}Bandwidth{/t}</b>
+         </td>
+       </tr>
+       <tr>
+         <td>{t}Upload bandwidth{/t}</td>
+        <td>
+{render acl=$FTPUploadBandwidthACL}
+<input name="FTPUploadBandwidth" id="FTPUploadBandwidth" size=7 maxlength=7 value="{$FTPUploadBandwidth}" {$fstate} >
+{/render}
+        {t}kb/s{/t}</td>
+       </tr>
+       <tr>
+         <td>{t}Download bandwidth{/t}</td>
+        <td>
+{render acl=$FTPDownloadBandwidthACL}
+<input name="FTPDownloadBandwidth" id="FTPDownloadBandwidth" size=7 maxlength=7 value="{$FTPDownloadBandwidth}" {$fstate} >
+{/render}
+        {t}kb/s{/t}</td>
+       </tr>
+     </table>
+   </td>
+   <td rowspan=2 style="border-left:1px solid #A0A0A0">
+     &nbsp;
+   </td>
+   <td>
+     <table summary="">
+       <tr>
+         <td colspan=2 style="vertical-align:top;">
+           <b>{t}Quota{/t}</b>
+         </td>
+       </tr>
+       <tr>
+         <td>{t}Files{/t}</td>
+        <td>
+{render acl=$FTPQuotaFilesACL}
+<input name="FTPQuotaFiles" id="FTPQuotaFiles" size=7 maxlength=10 value="{$FTPQuotaFiles}" {$fstate} >
+{/render}
+       </td>
+       </tr>
+       <tr>
+         <td>{t}Size{/t}</td>
+        <td>
+{render acl=$FTPQuotaMBytesACL}
+<input name="FTPQuotaMBytes" id="FTPQuotaMBytes" size=7 maxlength=10 value="{$FTPQuotaMBytes}" {$fstate} > 
+{/render}
+       {t}MB{/t}
+       </td>
+       </tr>
+     </table>
+   </td>
+ </tr>
+ <tr>
+   <td>
+     <table summary="" style="margin-left:4px;">
+       <tr>
+         <td colspan=2 style="vertical-align:top;">
+           <b>{t}Ratio{/t}</b>
+         </td>
+       </tr>
+       <tr>
+         <td>{t}Uploaded / downloaded files{/t}</td>
+        <td>
+
+{render acl=$FTPUploadRatioACL}
+<input name="FTPUploadRatio" id="FTPUploadRatio" size=5 maxlength=20 value="{$FTPUploadRatio}" {$fstate} >
+{/render}
+        / 
+{render acl=$FTPDownloadRatioACL}
+<input name="FTPDownloadRatio" id="FTPDownloadRatio" size=5 maxlength=20 value="{$FTPDownloadRatio}" {$fstate} >
+{/render}
+       </td>
+       </tr>
+     </table>
+   </td>
+   <td>
+     <table summary="">
+       <tr>
+         <td colspan=2 style="vertical-align:top;">
+           <b>{t}Miscellaneous{/t}</b>
+         </td>
+       <tr>
+         <td>
+{render acl=$FTPStatusACL}
+<input type=checkbox name="FTPStatus" id="FTPStatus" value="disabled" {$use_FTPStatus} title="{t}Check to disable FTP Access{/t}" {$fstate} >
+{/render}
+{t}Temporary disable FTP access{/t}</td>
+       </tr>
+     </table>
+   </td>
+ </tr>
+</table>
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('FTPUploadBandwidth');
+  -->
+</script>
diff --git a/gosa-core/plugins/personal/connectivity/webdav.tpl b/gosa-core/plugins/personal/connectivity/webdav.tpl
new file mode 100644 (file)
index 0000000..ecd567c
--- /dev/null
@@ -0,0 +1,4 @@
+<h2>
+       <input type="checkbox" name="webdav" value="B" {$webdavState} {$webdavAccountACL}>
+       {t}WebDAV account{/t}
+</h2>
diff --git a/gosa-core/plugins/personal/environment/class_environment.inc b/gosa-core/plugins/personal/environment/class_environment.inc
new file mode 100644 (file)
index 0000000..3d5de28
--- /dev/null
@@ -0,0 +1,1367 @@
+<?php
+
+class environment 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 $plHeadline           = "Environment";
+  var $plDescription        = "This does something";
+  var $dialog               = false;    // Indicates that we are currently editing in an seperate dialog
+  
+  var $in_dialog            = false;
+  var $uid                  = "";
+
+  var $is_group             = false;
+  var $view_logged = FALSE;
+  
+  /* Attribute definition
+   */
+
+  /* profile management */
+  var $useProfile         = false;  // Specifies if we want to use a Server 
+  var $gotoProfileServer  = "";     // Specifies the selected profile server
+  var $gotoProfileServers = array();// Specifies all available and selectable servers
+  var $gotoProfileFlags   = "";     // Flags enabled  ? only used to set ACL and save 
+  var $gotoProfileFlagC  = "";     // Flag is set to C if we have the profile caching fucntion enabled 
+  
+  var $gotoXResolution    = "auto";     // The selected resolution eg: 1024x768
+  var $gotoXResolutions   = array();// Contains all available resolutions for this account
+  var $gotoProfileFlagL  = "";     // Flag is set to L to enable runtime resolution change 
+  var $gotoProfileQuota   = "";     // User Quota Settings
+
+  /* Logon script section*/
+  var $gotoLogonScripts   = array();// Contains all available Logon Scripts  
+  var $gotoLogonScript    = "";     // The selected Logon Script
+
+  /* Printer */
+  var $gotoPrinter        = array();// All available Printer, with their configurations
+  var $gotoPrinterSel     = "";     //  The selected Printer
+  var $gosaDefaultPrinter = "";     // Default printer
+
+  /* Share */
+  var $gotoShares         = array();// Current Share Options
+  var $gotoShare          = "";     // currently selected Share Option
+  var $gotoShareSelections= array();// Available Shares for this account in Listbox format
+  var $gotoAvailableShares= array();// Available Shares for this account
+
+  /* Kiosk profile */
+  var $kiosk_enabled      = FALSE;
+  var $gotoKioskProfile   = "";     // The selected Kiosk Profile
+  var $gotoKioskProfile_Server    = "";     // The selected Kiosk Profile
+  var $gotoKioskProfile_Profile   = "";     // The selected Kiosk Profile
+  var $gotoKioskProfiles  = array();// All available Kiosk profiles
+
+  /* Hotplug Devices */
+  var $gotoHotplugDevice  = array();     // Selected hotplug
+  var $gotoHotplugDevices = array();// Already configured hotplug devices 
+  var $gotoHotplugDeviceDN= array();
+
+  var $NewAddedPrinters   = array();
+  var $NewDeletedPrinters = array();
+
+  /* general settings */
+  // Sets the attributes which will kept on page reload, which will be saved, ...
+
+  var $CopyPasteVars      = array("gotoHotplugDevices","gotoAvailableShares","gotoShareSelections","gotoPrinterSel","gotoProfileFlagL","gotoXResolutions","gotoProfileFlagC","gotoProfileServers","useProfile","is_group","in_dialog","OrigCn","gotoKioskProfile_Server","gotoKioskProfile_Profile");
+
+  var $attributes         = array("uid","gotoProfileServer","gotoProfileFlags","gotoHotplugDeviceDN",
+      "gotoXResolution","gotoProfileQuota",
+      "gotoLogonScripts","gotoLogonScript",
+      "gotoPrinter", "gosaDefaultPrinter",
+      "gotoShares","gotoShare",
+      "gotoKioskProfile");
+  var $objectclasses      = array("gotoEnvironment"); // Specifies the objectClass which contains the attributes edited here 
+  var $cn;
+  var $OrigCn;
+  var $add_del_printer_member_was_called = false;
+
+  function environment (&$config, $dn= NULL)
+  {
+    plugin::plugin ($config, $dn);
+
+    /* Setting uid to default */
+    if(isset($this->attrs['uid'][0])){
+      $this->uid = $this->attrs['uid'][0];
+    }
+
+    /* Check : Are we currently editing a group or user dialog */
+    if((isset($this->attrs['cn'][0]))&&(!isset($this->attrs['uid'][0]))){
+      $suffix="Group";
+      $this->uid          = $this->attrs['cn'][0];
+      $this->attrs['uid'] = $this->attrs['cn'][0];
+      $this->OrigCn = $this->attrs['cn'][0];
+    }else{
+      $suffix="User";
+    }
+
+    /* Get all Printer assignments */
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(&(objectClass=gotoPrinter)(goto".$suffix."Printer=".$this->uid."))",array("*"));
+    while($printer = $ldap->fetch()){
+      $this->gotoPrinter[$printer['cn'][0]]=$printer;
+      $this->gotoPrinter[$printer['cn'][0]]['mode']="user";
+    }
+    $ldap->search("(&(objectClass=gotoPrinter)(goto".$suffix."AdminPrinter=".$this->uid."))",array("*"));
+    while($printer = $ldap->fetch()){
+      $this->gotoPrinter[$printer['cn'][0]]=$printer;
+      $this->gotoPrinter[$printer['cn'][0]]['mode']="admin";
+    }
+
+
+    /* Prepare hotplugs */
+    if(isset($this->attrs['gotoHotplugDeviceDN']) && is_array($this->attrs['gotoHotplugDeviceDN'])){
+      $ldap = $this->config->get_ldap_link();
+      $ldap->cd($this->config->current['BASE']);
+      for($i = 0 ; $i < $this->attrs['gotoHotplugDeviceDN']['count'] ; $i ++){
+        $ldap->cat($this->attrs['gotoHotplugDeviceDN'][$i]);
+        if($ldap->count()){
+          $attrs = $ldap->fetch(); 
+
+          if(isset($attrs['gotoHotplugDevice'][0])){
+            $tmp      = preg_split("/\|/",$attrs['gotoHotplugDevice'][0]);
+            $tmp2     = array();
+            $tmp2['name']         = $attrs['cn'][0];
+            $tmp2['description']  = $tmp[0];
+            $tmp2['id']           = $tmp[1];
+            $tmp2['produkt']      = $tmp[2];
+            $tmp2['vendor']       = $tmp[3];
+            $tmp2['dn']           = $attrs['dn'];
+            $this->gotoHotplugDevices[] = $tmp2; 
+          }
+        }else{
+          print_red(sprintf(_("The selected hotplug device %s is no longer available, it will be removed when you save this account."),$this->attrs['gotoHotplugDeviceDN'][$i]));
+        }
+      }
+    }
+
+    /* prepare LogonScripts */
+    if((isset($this->attrs['gotoLogonScript']))&&(is_array($this->attrs['gotoLogonScript']))){
+      unset($this->attrs['gotoLogonScript']['count']);
+      foreach($this->attrs['gotoLogonScript'] as $device){
+        $tmp = $tmp2 = array();
+        $tmp = split("\|",$device);
+        $tmp2['LogonName']        = $tmp[0]; 
+        $tmp2['LogonPriority']    = $tmp[2]; 
+        if(preg_match("/O/i",$tmp[1])){
+          $tmp2['LogonOverload'] = "O";
+        }else{
+          $tmp2['LogonOverload'] = "";
+        }
+        if(preg_match("/L/i",$tmp[1])){
+          $tmp2['LogonLast'] = "L";
+        }else{
+          $tmp2['LogonLast'] = "";
+        }
+        $tmp2['LogonData']        = base64_decode($tmp[3]); 
+        $tmp2['LogonDescription'] = $tmp[4];
+        $this->gotoLogonScripts[$tmp[0]]=$tmp2;
+      }
+    }
+
+    /* Prepare Shares */
+    if((isset($this->attrs['gotoShare']))&&(is_array($this->attrs['gotoShare']))){
+      unset($this->attrs['gotoShare']['count']);
+      foreach($this->attrs['gotoShare'] as $share){
+        $tmp = $tmp2 = array();
+        $tmp = split("\|",$share);
+        $tmp2['server']      =$tmp[0];
+        $tmp2['name']        =$tmp[1];
+
+        /* Decode base64 if needed */
+        if (!preg_match('%/%', $tmp[2])){
+          $tmp2['mountPoint']  =base64_decode($tmp[2]);
+        } else {
+          $tmp2['mountPoint']  =$tmp[2];
+        }
+
+        if(isset($tmp[3])){
+          $tmp2['PwdHash']  =$tmp[3];
+        }else{
+          $tmp2['PwdHash']  ="";
+        }
+        if(isset($tmp[4])){
+          $tmp2['Username']  =$tmp[4];
+        }else{
+          $tmp2['Username']  ="";
+        }
+        $this->gotoShares[$tmp[1]."|".$tmp[0]]=$tmp2;
+      }
+    }
+
+    for($i = 0 ; $i < strlen($this->gotoProfileFlags) ; $i ++){
+      $chr = $this->gotoProfileFlags[$i];
+      $name = "gotoProfileFlag".$chr;
+      $this->$name=$chr;
+    }
+
+    if((!empty($this->gotoProfileServer))||($this->gotoProfileFlagC=="C")){
+      $this->useProfile = true;
+    }else{
+      $this->useProfile = false;
+    }
+
+    /* Set resolutions */
+    $this->gotoXResolutions = array("auto"=>_("auto"),
+                                    "640x480"   =>  "640x480",
+                                    "800x600"   =>  "800x600",
+                                    "1024x768"  =>  "1024x768",
+                                    "1152x864"  =>  "1152x864",
+                                    "1280x768"  =>  "1280x768",
+                                    "1280x1024" =>  "1280x1024");
+
+    if(isset($this->config->data['MAIN']['RESOLUTION_HOOK'])){
+      $file = $this->config->data['MAIN']['RESOLUTION_HOOK'];
+
+      if(is_readable($file)){
+        $str = file_get_contents($file);
+        $lines = split("\n",$str);
+        foreach($lines as $line){
+          $line = trim($line);
+          if(!empty($line)){
+            $this->gotoXResolutions[$line]=$line;
+          }
+        }
+        //natcasesort($this->gotoXResolutions);
+      }else{
+        print_red(sprintf(_("You have specified an external resolution hook which can't be read, please check the permission of the file '%s'."),$file));
+      }
+    }
+
+    $this->gotoProfileServers= $config->getShareServerList() ;
+    $this->gotoShareSelections= $config->getShareList(true);
+    $this->gotoAvailableShares= $config->getShareList(false);  
+
+    $this->update_kiosk_profiles();
+  
+    $this->gotoKioskProfile= preg_replace("/^.*\//i","",$this->gotoKioskProfile);
+  }
+
+
+  function update_kiosk_profiles()
+  { 
+    $tmp1  = array("none" => array(_("disabled")));
+    $tmp2  = array("none" => _("disabled"));
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(&(objectClass=goEnvironmentServer)(gotoKioskProfile=*)(cn=*))",array("cn","gotoKioskProfile"));
+    $cnt = 0;
+    while($attrs = $ldap->fetch()){
+      for($i = 0 ; $i < $attrs['gotoKioskProfile']['count'] ; $i ++){
+        $name = preg_replace("/^.*kiosk\//","",$attrs['gotoKioskProfile'][$i]);
+        $tmp1[$attrs['cn'][0]][] = $name;
+      }
+      $tmp2[$attrs['cn'][0]]= $attrs['cn'][0];
+      $cnt ++;
+    }
+
+    if($cnt && $this->config->search("environment","kioskpath",array('menu','tabs'))){
+      $this->kiosk_enabled = TRUE;
+    }
+
+    $this->gotoKioskProfiles['BY_SERVER'] = $tmp1;
+    $this->gotoKioskProfiles['SERVERS']   = $tmp2;
+  
+    $this->gotoKioskProfile_Server = preg_replace("/^.*:\/\/([^\/]*).*$/","\\1",$this->gotoKioskProfile);
+    $this->gotoKioskProfile_Profile= preg_replace("/^.*\//","",$this->gotoKioskProfile);
+
+    $error = false;
+    if(!in_array($this->gotoKioskProfile_Server, $this->gotoKioskProfiles['SERVERS'])){
+      $this->gotoKioskProfile_Server = key($this->gotoKioskProfiles['SERVERS']);
+      $error = true;
+    }
+    if(!in_array($this->gotoKioskProfile_Profile, $this->gotoKioskProfiles['BY_SERVER'][$this->gotoKioskProfile_Server])){
+      $this->gotoKioskProfile_Profile = $this->gotoKioskProfiles['BY_SERVER'][$this->gotoKioskProfile_Server][0];
+      $error = true;
+    }
+    if($error && !empty($this->gotoKioskProfile)){
+      print_red(sprintf(_("The selected kiosk profile wasn't available anymore. The current profile is now 'none'."),
+            $this->gotoKioskProfile_Server,$this->gotoKioskProfile_Profile));
+    }
+  }
+
+
+  /* Detect type of edited object (user|group)*/
+  function detect_grouptype()
+  {
+    if((!isset($this->parent))&&(!$this->is_account)){
+      $this->is_group     = false;
+    }elseif((isset($this->parent))&&(!isset($this->parent->by_object['posixAccount']))){
+      $this->is_group     = true;
+    }else{
+      $this->is_group     = false;
+    }
+  }
+
+
+  function execute()
+  {
+
+    /* Call parent execute */
+    plugin::execute();
+    /* Log view */
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      if(isset($this->parent->by_object['user']) || (isset($this->attrs['objectClass']) &&in_array("gosaAccount",$this->attrs['objectClass']))){
+        new log("view","users/".get_class($this),$this->dn);
+      }else{
+        new log("view","groups/".get_class($this),$this->dn);
+      }
+    }
+
+    /* Are we editing from MyAccount and not editing a user */
+    $WriteOnly = (!isset($this->parent)|| !$this->parent) && !isset($_SESSION['edit']);
+
+    /* Check profile server */
+    if($this->acl_is_writeable("gotoProfileServer",$WriteOnly)){
+      if(!empty($this->gotoProfileServer) && !isset($this->gotoProfileServers[$this->gotoProfileServer])){
+        if(count($this->gotoProfileServers)){
+
+          /* Get First Profile */
+          $new = key($this->gotoProfileServers);
+
+          /* Another profile server found */
+          print_red(sprintf(_("Your selected profile server '%s' is no longer available. Setting profile server to '%s'."),
+                $this->gotoProfileServer,$new));
+        }else{
+
+          /* No other profile servers found */
+          print_red(sprintf(_("Your selected profile server '%s' is no longer available. Profile server configuration is resetted."),
+                $this->gotoProfileServer));
+          $this->gotoProfileServer = "";
+        }
+      }
+    }    
+
+    $this->detect_grouptype();
+
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+    $smarty->assign("kiosk_enabled",$this->kiosk_enabled);
+    $display= "";
+
+    $smarty->assign("is_group",$this->is_group);
+
+    /* Prepare all variables for smarty */
+    foreach($this->attributes as $s_attr){
+      /* Set value*/
+      $smarty->assign($s_attr,$this->$s_attr);
+
+      /* Set checkbox state*/
+      if(empty($this->$s_attr)){
+        $smarty->assign($s_attr."CHK","");
+      }else{
+        $smarty->assign($s_attr."CHK"," checked ");
+      }
+
+      /* Prepare ACL settings*/
+      $smarty->assign($s_attr."ACL",$this->getacl($s_attr,$WriteOnly));
+    }
+
+    /* Is accout enabled | are we editing from usermenu or admin menu 
+       All these tab management is done here
+     */
+
+
+    /* Working from Usermenu an the Account is currently disbled
+     * this->parent :  is only set if we are working in a list of tabs
+     * is_account   :  is only true if the needed objectClass is given
+     */
+    if((!isset($this->parent))&&(!$this->is_account)){
+      /* We are currently editing this tab from usermenu, but this account is not enabled */
+      $smarty->assign("is_account",$this->is_account);
+      /* Load template */
+      $display .= $smarty->fetch(get_template_path('environment.tpl', TRUE));
+      /* Avoid the "You are currently editing ...." message when you leave this tab */
+      $display .= back_to_main(); 
+      /* Display our message to the user */
+      return $display;
+
+
+      /* We are currently editing from group tabs, because 
+       * $this->parent is set
+       * posixAccount is not set, so we are not in usertabs.
+       */
+    }elseif((isset($this->parent))&&(!isset($this->parent->by_object['posixAccount']))){
+      $smarty->assign("is_account","true");
+      $this->uid          = $this->cn;
+      $this->attrs['uid'] = $this->cn;
+
+      /* Change state if needed */
+      if (isset($_POST['modify_state'])){
+        if(($this->acl_is_createable() && !$this->is_account) || 
+            ($this->acl_is_removeable() &&  $this->is_account)){
+          $this->is_account= !$this->is_account;
+        }
+      }
+      /* Group Dialog with enabled environment options */
+      if ($this->is_account){
+        $display= $this->show_enable_header(_("Remove environment extension"),
+            _("Environment extension enabled. You can disable it by clicking below."));
+      } else {
+
+        /* Environment is disabled 
+           If theres is no posixAccount enabled, you won't be able to enable 
+           environment extensions
+         */
+        if((isset($this->parent->by_object['group']))||(isset($this->attrs['objectClass']))&&((in_array("posixAccount",$this->attrs['objectClass'])))){
+          // 4. There is a PosixAccount
+          $display= $this->show_enable_header(_("Add environment extension"),
+              _("Environment extension disabled. You can enable it by clicking below."));
+          return $display;
+        }else{
+          // 4. There is no PosixAccount
+          $display= $this->show_enable_header(_("Add environment extension"),
+              _("Environment extension disabled. You have to setup a posix account before you can enable this feature."));
+          return $display;
+        }
+      }
+    }else{
+      /* Editing from Usermenu 
+       *  Tell smarty that this accoutn is enabled 
+       */
+      $smarty->assign("is_account","true");
+
+      /* Change state if needed */
+      if (isset($_POST['modify_state'])){
+        if(($this->acl_is_createable() && !$this->is_account) || 
+            ($this->acl_is_removeable() &&  $this->is_account)){
+          $this->is_account= !$this->is_account;
+        }
+      }
+
+      if(isset($this->parent)){
+
+        // 3. Account enabled . Editing from adminmenu
+        if ($this->is_account){
+          $display= $this->show_disable_header(_("Remove environment extension"),
+              _("Environment extension enabled. You can disable it by clicking below."));
+        } else {
+
+          if($this->parent->by_object['posixAccount']->is_account==true){
+            // 4. There is a PosixAccount
+            $display= $this->show_disable_header(_("Add environment extension"),
+                _("Environment extension disabled. You can enable it by clicking below."));
+            return $display;
+          }else{
+            // 4. There is a PosixAccount
+            $display= $this->show_disable_header(_("Add environment extension"),
+                _("Environment extension disabled. You have to setup a posix account before you can enable this feature."),TRUE,TRUE);
+            return $display;
+          }
+        }
+      }
+    }
+    /* Account is Account : is_accounbt=true.
+     * Else we won't reach this. 
+     */
+
+    /* Prepare all variables for smarty */
+    foreach($this->attributes as $s_attr){
+      /* Set value*/
+      $smarty->assign($s_attr,$this->$s_attr);
+
+      /* Set checkbox state*/
+      if(empty($this->$s_attr)){
+        $smarty->assign($s_attr."CHK","");
+      }else{
+        $smarty->assign($s_attr."CHK"," checked ");
+      }
+
+      /* Prepare ACL settings*/
+      $smarty->assign($s_attr."ACL",$this->getacl($s_attr,$WriteOnly));
+    }
+
+    foreach(array("gotoHotplugDevice","gotoProfileFlagC","gotoProfileFlagL") as $s_attr){
+      $smarty->assign($s_attr."ACL",$this->getacl($s_attr,$WriteOnly));
+    }
+
+    if($WriteOnly) {
+      $smarty->assign("gotoPrinterACL","r");
+    }else{
+      $smarty->assign("gotoPrinterACL","rw");
+    }
+
+    if(empty($this->useProfile)){
+      $smarty->assign("useProfileCHK","");
+      $smarty->assign("gotoProfileServerACL" , preg_replace("/w/","",$this->getacl("gotoProfileServer",$WriteOnly)));
+      $smarty->assign("gotoProfileQuotaACL" , preg_replace("/w/","",$this->getacl("gotoProfileQuota",$WriteOnly)));
+      $smarty->assign("gotoProfileFlagCACL" , preg_replace("/w/","",$this->getacl("gotoProfileFlagC",$WriteOnly)));
+    }else{
+      $smarty->assign("useProfileCHK"," checked ");
+    }
+    
+    $smarty->assign("gotoProfileServerWriteable", $this->acl_is_writeable("gotoProfileServer",$WriteOnly));
+    $smarty->assign("gotoProfileACL", $this->getacl("gotoProfileServer",$WriteOnly).$this->getacl("gotoProfileQuota",$WriteOnly));
+
+    /* HANDLE Profile Settings here 
+     * Assign available Quota and resolution settings
+     * Get all available profile server
+     * Get cache checkbox
+     * Assign this all to Smarty 
+     */
+
+    if(empty($this->gotoProfileFlagL)){
+      $smarty->assign("gotoProfileFlagLCHK"," ");
+    }else{
+      $smarty->assign("gotoProfileFlagLCHK"," checked ");
+    }
+
+    if(empty($this->gotoProfileFlagC)){
+      $smarty->assign("gotoProfileFlagCCHK"," ");
+    }else{
+      $smarty->assign("gotoProfileFlagCCHK"," checked ");
+    }
+
+
+    $smarty->assign("gotoXResolutions"    , $this->gotoXResolutions);
+    $smarty->assign("gotoXResolutionKeys" , array_flip($this->gotoXResolutions));
+
+    $smarty->assign("gotoProfileServers",$this->gotoProfileServers);
+    if(!is_array($this->gotoProfileServers)){
+      $this->gotoProfileServers =array();
+    }
+    $smarty->assign("gotoProfileServerKeys",array_flip($this->gotoProfileServers));
+
+    /* Handle kiosk profiles*/
+    $smarty->assign("kiosk_servers" , $this->gotoKioskProfiles['SERVERS']);
+    $smarty->assign("kiosk_server" ,  $this->gotoKioskProfile_Server);
+    $smarty->assign("kiosk_profiles" , $this->gotoKioskProfiles['BY_SERVER'][$this->gotoKioskProfile_Server]);
+    $smarty->assign("kiosk_profile" ,  $this->gotoKioskProfile_Profile);
+  
+
+    /* Logonscript Management
+     * Get available LogonScripts (possibly grey out (or mark) these script that are defined for the group) 
+     * Perform add Delete edit Posts 
+     */
+
+    /* Dialog Save */
+    if(isset($_POST['LogonSave'])){
+
+      if(!$this->acl_is_writeable("gotoLogonScript")){
+        print_red(_("You are not allowed to write Logon scripts."));
+        unset($this->dialog);
+        $this->dialog=FALSE;
+        $this->is_dialog=false;
+      }else{
+        $this->dialog->save_object();
+        if(count($this->dialog->check())!=0){
+          foreach($this->dialog->check() as $msg){
+            print_red($msg);
+          }
+        }else{
+          $tmp = $this->dialog->save();
+          unset($this->dialog);
+          $this->dialog=FALSE;
+          $this->is_dialog=false;
+          $this->gotoLogonScripts[$tmp['LogonName']]=$tmp; 
+        }
+      }
+    }
+    
+
+    /* Dialog Quit without saving */
+    if(isset($_POST['LogonCancel'])){
+      $this->is_dialog= false;
+      unset($this->dialog);
+      $this->dialog= FALSE;
+    }
+
+    /* Check Edit Del New Posts for a selected LogonScript */ 
+    if($this->acl_is_writeable("gotoLogonScript") && 
+        (isset($_POST['gotoLogonScriptNew'])) || isset($_POST['gotoLogonScriptEdit']) ||isset($_POST['gotoLogonScriptDel'])){
+
+      /* New Logon Script: Open an edit dialog, we don't need a $_POST['gotoLogonScript'] here.
+       * In this case we create a new Logon Script.
+       */
+      if(isset($_POST['gotoLogonScriptNew'])){
+        $this->is_dialog = true;
+        $this->dialog = new logonManagementDialog($this->config,$this->dn);
+      }
+
+      /* If we receive a Delete request and there is a Script selected in the selectbox, delete this one.
+       * We only can delete if there is an entry selected.
+       */
+      if((isset($_POST['gotoLogonScriptDel']))&&(isset($_POST['gotoLogonScript']))){
+        unset($this->gotoLogonScripts[$_POST['gotoLogonScript']]);
+      }
+
+      /* In this case we want to edit an existing entry, we open a new Dialog to allow editing.
+       * There must be an entry selected to perform edit request.
+       */
+      if((isset($_POST['gotoLogonScriptEdit']))&&(isset($_POST['gotoLogonScript']))){
+        $is_entry = $this->gotoLogonScripts[$_POST['gotoLogonScript']];
+        $this->is_dialog = true;
+        $this->dialog = new logonManagementDialog($this->config,$this->dn,$is_entry);
+      }
+    }
+
+    /* Append List to smarty*/
+    $ls = $this->printOutLogonScripts();
+    $smarty->assign("gotoLogonScripts",  $ls);
+    $smarty->assign("gotoLogonScriptKeys",array_flip($ls));
+    $smarty->assign("gotoLogonScriptKeysCnt",count($ls));
+
+    /* In this section server shares will be defined 
+     * A user can select one of the given shares and a mount point
+     *  and attach this combination to his setup.
+     */
+
+    $smarty->assign("gotoShareSelections",    $this->gotoShareSelections);
+    if(!is_array($this->gotoShareSelections)){
+      print $this->gotoShareSelections;
+      $this->gotoShareSelections = array();
+    }
+    $smarty->assign("gotoShareSelectionKeys", array_flip($this->gotoShareSelections));
+
+    /* if $_POST['gotoShareAdd'] is set, we will try to add a new entry 
+     * This entry will be, a combination of mountPoint and sharedefinitions 
+     */
+    if(isset($_POST['gotoShareAdd']) && $this->acl_is_writeable("gotoShare")){
+
+      /* We assign a share to this user, if we don't know where to mount the share */
+      if(!isset($_POST['gotoShareSelection']) || get_post('gotoShareSelection') == ""){
+        print_red(_("You must select a valid share."));
+      }elseif((!isset($_POST['gotoShareMountPoint']))||(empty($_POST['gotoShareMountPoint']))||(preg_match("/[\|]/i",$_POST['gotoShareMountPoint']))){
+        print_red(_("You must specify a valid mount point."));
+      }elseif(preg_match('/ /', $_POST['gotoShareMountPoint'])){
+        print_red(_("Spaces are not allowed in the mount path!"));
+      }elseif(!(
+            preg_match("/^\//",$_POST['gotoShareMountPoint'])  ||
+            preg_match("/^~/",$_POST['gotoShareMountPoint']) ||
+            preg_match("/^\$HOME/",$_POST['gotoShareMountPoint']) ||
+            preg_match("/^.HOME/",$_POST['gotoShareMountPoint']) ||
+            preg_match("/^\$USER/",$_POST['gotoShareMountPoint']) ||
+            preg_match("/^.USER/",$_POST['gotoShareMountPoint']) ||
+            preg_match("/^%/",$_POST['gotoShareMountPoint'])
+            )
+          ){
+        print_red(_("You must specify a valid mount point.")); 
+      }else{
+        $a_share = $this->gotoAvailableShares[$_POST['gotoShareSelection']];
+        $s_mount = $_POST['gotoShareMountPoint'];
+        $s_user  = $_POST['ShareUser'];
+        /* Preparing the new assignment */ 
+        $this->gotoShares[$a_share['name']."|".$a_share['server']]=$a_share;
+        $this->gotoShares[$a_share['name']."|".$a_share['server']]['Username']=$s_user;
+        $this->gotoShares[$a_share['name']."|".$a_share['server']]['PwdHash']="";
+        $this->gotoShares[$a_share['name']."|".$a_share['server']]['mountPoint']=$s_mount;
+      }
+    }  
+
+    /* if the Post  gotoShareDel is set, someone asked GOsa to delete the selected entry (if there is one selected)
+     * If there is no defined share selected, we will abort the deletion without any message 
+     */
+    $once = true;
+    if($this->acl_is_writeable("gotoShare")){
+      foreach($_POST as $name => $value){
+        if((preg_match("/^gotoShareDel_/",$name)) && ($once)){
+          $once = false;  
+          $key  = preg_replace("/^gotoShareDel_/","",$name);
+          $key  = preg_replace("/_+[xy]$/","",$key);
+          $key  = base64_decode($key);
+          if(isset($this->gotoShares[$key])) {
+            unset($this->gotoShares[$key]);
+          }
+
+          /* Remove corresponding password entry, too. This is a workaround
+             to get rid of old-style entries. */
+          $key= preg_replace("/\|/", "|!", $key);
+          if(isset($this->gotoShares[$key])) {
+            unset($this->gotoShares[$key]);
+          }
+        }
+        if((preg_match("/^gotoShareResetPwd_/",$name)) && ($once)){
+          $once = false;
+          $key  = preg_replace("/^gotoShareResetPwd_/","",$name);
+          $key  = preg_replace("/_+[xy]$/","",$key);
+          $key  = base64_decode($key);
+          $this->gotoShares[$key]['PwdHash'] = "";
+          if(preg_match("/^!/",$this->gotoShares[$key]['server'])){
+            unset($this->gotoShares[$key]);
+          }
+        }
+      }
+    }
+    $divlistShares = new divSelectBox("gotoShares");
+    $divlistShares->SetHeight(100);
+
+
+    $tmp = array();
+    if($this->acl_is_readable("gotoShares")){
+      $tmp = $this->printOutAssignedShares();
+    }
+
+    
+    foreach($tmp as $key => $value){
+      $img = "";
+
+      /* Skip apssword only entries */
+      if( empty($this->gotoShares[$key]['server']) && 
+          empty($this->gotoShares[$key]['name']) &&
+          empty($this->gotoShares[$key]['mountPoint']) &&
+          empty($this->gotoShares[$key]['Username'])){
+        continue;
+      } 
+
+      /* Check if entry starts with an ! */
+      if(preg_match("/^!/",$this->gotoShares[$key]['server'])){
+
+        /* If we are currently editing groups environment, skip those ! entries */ 
+        if($this->is_group) continue;
+
+        /* Create pwd reset images */
+        if($this->gotoShares[$key]['PwdHash'] != ""){
+          $img.= "<input type='image' name='gotoShareResetPwd_".base64_encode($key)." 'src='images/list_reset_password.png' alt='"._("Reset password hash")."' 
+            title='"._("Reset password hash")."'>";
+        }
+        $field1 = array("string" => "<font style=\"color:#C0C0C0\">".$value."</font>" );
+        $field2 = array("string" => $img   , "attach" => "style='border-right:0px;'");
+      }else{
+
+        /* Create pwd reset img && delete image */
+        if($this->gotoShares[$key]['PwdHash'] != ""){
+          $img.= "<input type='image' name='gotoShareResetPwd_".base64_encode($key)." 'src='images/list_reset_password.png' alt='"._("Reset password hash")."' 
+            title='"._("Reset password hash")."'>";
+          $img.= "&nbsp;";
+        }
+        $img.= "<input type='image' name='gotoShareDel_".base64_encode($key)." 'src='images/edittrash.png' alt='"._("Delete")."' 
+          title='"._("Delete share entry")."'>";
+        $field1 = array("string" => $value);
+        $field2 = array("string" => $img   , "attach" => "style='border-right:0px;'");
+      }
+      $divlistShares->AddEntry(array($field1,$field2));
+    }
+    $smarty->assign("divlistShares",$divlistShares->DrawList());
+
+    /* Hotplug devices will be handled here 
+     * There are 3 possible methods for this feature
+     * Create a new Hotplug, A Dialog will open where you can specify some hotplug information
+     * Delete will erase an entry, the entry must be selcted in the ListBox first
+     * Editing an entry will open a dialog where the informations about the selcted entry can be changed
+     */
+
+    /* We have to delete the selected hotplug from the list*/
+    if((isset($_POST['gotoHotplugDeviceDel']))&&(isset($_POST['gotoHotplugDevice_post'])) && $this->acl_is_writeable("gotoHotplugDevice")){
+      if($this->acl_is_writeable("gotoHotplugDevice")){
+        foreach($_POST['gotoHotplugDevice_post'] as $name){
+          unset($this->gotoHotplugDevices[$name]);
+        }
+      }
+    }
+
+    /* There are already defined hotplugs from other users we could use */
+    if(isset($_POST['gotoHotplugDeviceUse']) && $this->acl_is_writeable("gotoHotplugDevice")){
+      $tmp  =array();
+      foreach($this->gotoHotplugDevices as $plugs){
+        $tmp[] = $plugs['name'];
+      }
+      $this->dialog = new hotplugDialog($this->config,$tmp);
+      $this->is_dialog = true;
+    }
+
+    /* Dialog Aborted */
+    if(isset($_POST['HotPlugCancel'])){
+      unset($this->dialog);
+      $this->dialog= FALSE;
+      $this->is_dialog = false;
+    }
+
+    /* Dialod saved */
+    if(isset($_POST['HotPlugSave'])){
+
+      $this->dialog->save_object();
+      if(count($this->dialog->check())!=0){
+        foreach($this->dialog->check() as $msg){
+          print_red($msg);
+        }
+      }else{
+        $this->dialog->save_object();
+        $a_tmp = $this->dialog->save();
+
+        if(is_array($a_tmp)){
+          foreach($a_tmp as $name => $hotplug){
+            $this->gotoHotplugDevices[$name]= $hotplug; 
+          }
+        }
+        unset($this->dialog);
+        $this->dialog= FALSE;
+        $this->is_dialog = false;
+      }
+    }
+    $smarty->assign("gotoHotplugDevices",$this->printOutHotPlugDevices());
+    $smarty->assign("gotoHotplugDeviceKeys",array_flip($this->printOutHotPlugDevices()));
+
+    /* Printer Assignment will managed below 
+     * A printer can be assigned in two different ways and two different types
+     * There are 2 types of users assigned to a printer : user and admin
+     * They only differ in the member attribute they will be assigned to. user: gotoUserPrinter admin: gotoadminPrinter
+     * The different types of assigning a user are : 1 assigning a user to a printer 2. assigning a group to a printer
+     */ 
+
+    /* First handle Add Post. Open a dialog that allows us to select a printer or two */ 
+    if(isset($_POST['gotoPrinterAdd'])){
+
+      $this->is_dialog=true;
+      $this->dialog = new selectPrinterDialog($this->config,$this->dn,$this->gotoPrinter);
+    }
+
+    if(isset($_POST['PrinterCancel'])){
+      $this->is_dialog=false;
+      unset($this->dialog);
+      $this->dialog=FALSE;
+    }
+
+    if(isset($_POST['PrinterSave'])){
+      if(count($this->dialog->check())!=0){
+        $tmp = $this->dialog->check();
+        foreach($tmp as $msg){
+          print_red($msg);
+        } 
+      }else{
+        $this->dialog->save_object();
+        $tmp = $this->dialog->save();
+        $tmp2= $this->dialog->getPrinter(true);
+
+        foreach($tmp as $pname){
+          $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$tmp2[$pname]['dn'],"printer");
+          $printerObj->set_acl_base($tmp2[$pname]['dn']);
+
+          $type = false;
+
+          if($this->is_group){
+            if($this->dn == "new"){  
+              $type = "AddGroup";
+            }elseif(isset($this->NewDeletedPrinters[$pname])){
+              $type = "AddGroup";
+            }elseif($printerObj->by_object['printgeneric']->AddMember("AddGroup",$this->dn)){
+              $type = "AddGroup";
+            }
+          }else{
+            if(isset($this->NewDeletedPrinters[$pname])){
+              $type = "AddUser";
+            }elseif($printerObj->by_object['printgeneric']->AddMember("AddUser",$this->dn)){
+              $type = "AddUser";
+            }
+          }
+
+          if($type){
+            $this->gotoPrinter[$pname]=$tmp2[$pname];
+            $this->gotoPrinter[$pname]['mode']="user";
+            $this->add_del_printer_member_was_called = true;
+
+            $this->NewAddedPrinters[$pname] = $pname;
+            if(isset($this->NewDeletedPrinters[$pname])){
+              unset($this->NewDeletedPrinters[$pname]);
+            }
+          }
+        }
+
+        $this->is_dialog=false;
+        unset($this->dialog);
+        $this->dialog   =FALSE;
+      }
+    }
+
+    if((isset($_POST['gotoPrinterDel']))&&(isset($_POST['gotoPrinterSel']))&&(!empty($_POST['gotoPrinterSel']))){
+      $printer = $_POST['gotoPrinterSel'];
+      foreach($printer as $pname){
+
+        $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$this->gotoPrinter[$pname]['dn'],"printer");
+        $printerObj->set_acl_base($this->gotoPrinter[$pname]['dn']);
+
+        $type = false;
+        if($this->is_group){
+          if(isset($this->NewAddedPrinters[$pname])){
+            $type = "Group";
+          }elseif($printerObj->by_object['printgeneric']->DelMember("AddGroup",$this->cn)){
+            $type = "Group";
+          }
+        }else{
+          if(isset($this->NewAddedPrinters[$pname])){
+            $type = "User";
+          }elseif($printerObj->by_object['printgeneric']->DelMember("AddUser",$this->uid)){
+            $type = "User";
+          }
+        }
+        if($type){
+          $this->add_del_printer_member_was_called = true;
+          unset($this->gotoPrinter[$pname]);
+
+          $this->NewDeletedPrinters[$pname] = $pname;
+          if(isset($this->NewAddedPrinters[$pname])){
+            UNSET($this->NewAddedPrinters[$pname]);
+          }
+        }
+      }
+    }
+
+    if((isset($_POST['gotoPrinterEdit']))&&(isset($_POST['gotoPrinterSel']))&&(!empty($_POST['gotoPrinterSel']))){
+      $printers = $_POST['gotoPrinterSel'];
+      $this->add_del_printer_member_was_called = true;
+      foreach($printers as $printer){
+        if($this->gotoPrinter[$printer]['mode']=="user"){
+          $this->gotoPrinter[$printer]['mode']="admin";
+        }else{
+          $this->gotoPrinter[$printer]['mode']="user";
+        }
+      }
+    }
+
+    if((isset($_POST['gotoPrinterDefault']))&&(isset($_POST['gotoPrinterSel']))&&(!empty($_POST['gotoPrinterSel']))){
+      if($this->is_group){
+        print_red(_("GOsa default printer flag is not allowed within groups."));
+      }else{
+        if ($this->gosaDefaultPrinter == $_POST['gotoPrinterSel'][0]){
+          $this->gosaDefaultPrinter= "";
+        } else {
+          $this->gosaDefaultPrinter= $_POST['gotoPrinterSel'][0];
+        }
+      }
+    }
+
+    $smarty->assign("gotoPrinter",$this->printOutPrinterDevices());
+    $smarty->assign("gotoPrinterKeys",array_flip($this->printOutPrinterDevices()));
+
+    /* General behavior */
+    if(is_object($this->dialog)){
+      $this->dialog->save_object();
+      $disp =$this->dialog->execute();
+      return($disp);
+    }
+
+    /* Als smarty vars are set. Get smarty template and generate output */
+    $display.= $smarty->fetch(get_template_path('environment.tpl', TRUE,dirname(__FILE__)));
+    return($display);
+  }
+
+  function remove_from_parent()
+  {
+    /* only if it was an account*/
+    if (!$this->initially_was_account){
+      return;
+    }
+
+    /* include global link_info */
+    $ldap= $this->config->get_ldap_link();
+
+    /* Remove and write to LDAP */
+    plugin::remove_from_parent();
+
+    /* Don't save our template variables */
+    $skip = array("uid","gotoLogonScripts","gotoPrinter","gotoShares","gotoHotplugDevices" );
+
+    /* Skip all these attributes */
+    foreach($skip as $del){
+      unset($this->attrs[$del]);
+    }
+
+    @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,$this->attributes, "Save");
+
+    $ldap->cd($this->dn);
+    $this->cleanup();
+    $ldap->modify ($this->attrs); 
+
+    if($this->is_group){
+      new log("remove","groups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
+
+    show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/environment account with dn '%s' failed."),$this->dn));
+
+    /* Optionally execute a command after we're done */
+    $this->handle_post_events("remove",array("uid" => $this->uid));
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    /* Get all Posted vars 
+     * Setup checkboxes 
+     */
+    $WriteOnly = (!isset($this->parent)|| !$this->parent) && !isset($_SESSION['edit']);
+    if(isset($_POST['iamposted'])){
+
+      $PACL =  $this->getacl("gotoProfileServer",$WriteOnly).$this->getacl("gotoProfileQuota",$WriteOnly);
+
+      if(isset($_POST['kiosk_server'])){
+        $tmp = $_POST['kiosk_server'];
+        if(isset($this->gotoKioskProfiles['SERVERS'][$tmp])){
+          $this->gotoKioskProfile_Server = $_POST['kiosk_server'];
+        }
+      }
+      if(isset($_POST['kiosk_profile'])){
+        $tmp = $_POST['kiosk_profile'];
+        if(in_array($tmp,$this->gotoKioskProfiles['BY_SERVER'][$this->gotoKioskProfile_Server])){
+          $this->gotoKioskProfile_Profile = $_POST['kiosk_profile'];
+        }
+      }
+
+      if(preg_match("/w/",$PACL)){
+        if(isset($_POST['useProfile'])){
+          $this->useProfile = true;
+        }else{
+          $this->useProfile = false;
+        }
+      }
+
+      if($this->acl_is_writeable("gotoProfileFlagC")){
+        if(isset($_POST['gotoProfileFlagC'])){
+          $this->gotoProfileFlagC = $_POST['gotoProfileFlagC'];
+        }else{
+          $this->gotoProfileFlagC = false;
+        }
+      }
+
+      if($this->acl_is_writeable("gotoProfileFlagL")){
+        if(isset($_POST['gotoProfileFlagL'])){
+          $this->gotoProfileFlagL = $_POST['gotoProfileFlagL'];
+        }else{
+          $this->gotoProfileFlagL = false;
+        }
+      }
+
+      plugin::save_object();
+      foreach($this->attributes as $s_attr){
+        if((!isset($_POST[$s_attr])) || 
+            in_array($s_attr,array("gosaDefaultPrinter","gotoShares","gotoHotplugDevices","gotoPrinter","gotoLogonScripts","uid"))) continue;
+        if(!$this->acl_is_writeable($s_attr)){
+          continue;
+        }else{ 
+          if(isset($_POST[$s_attr])){
+            $this->$s_attr = $_POST[$s_attr];
+          }else{
+            $this->$s_attr = false;
+          }
+        }
+      }
+    }
+  }
+
+
+  /* Check supplied data */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    $this->detect_grouptype();
+
+    if(preg_match("/[^0-9]/",$this->gotoProfileQuota)) {
+      $message[]=_("Please set a valid profile quota size.");
+    } 
+    if(!isset($this->attrs['objectClass'])){
+      $this->attrs['objectClass']=array();
+    } 
+    if(!$this->is_group){
+      if((!((in_array("posixAccount",$this->attrs['objectClass']))||($this->parent->by_object['posixAccount']->is_account==true)))&&(!$this->is_group)){
+        $message[]=(_("You need to setup a valid posix extension in order to enable evironment features."));  
+      }
+    }
+    return ($message);
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    /* If group was renamed, all printer settings get lost
+     */ 
+    /* only save changed variables ....*/
+    if ($this->gotoKioskProfile_Server != "none"){
+      if(preg_match("/https/i",$_SERVER['HTTP_REFERER'])){
+        $method="https://".$this->gotoKioskProfile_Server."/kiosk/".$this->gotoKioskProfile_Profile;
+      }else{
+        $method="http://".$this->gotoKioskProfile_Server."/kiosk/".$this->gotoKioskProfile_Profile;
+      }
+      $this->gotoKioskProfile= $method;
+    }else{
+      $this->gotoKioskProfile= array();
+    }
+
+    plugin::save();
+    $ldap= $this->config->get_ldap_link();
+
+    $realyUsedAttrs= array();
+
+    /* Save already used objectClasses */
+    $ocs        = $this->attrs['objectClass'];
+    unset($ocs['count']);
+    $this->attrs = array();
+    $this->attrs['objectClass']= gosa_array_merge($ocs,$this->objectclasses);
+
+    /* 1. Search all printers that have our uid/cn as member 
+     * 2. Delete this uid/cn from every single entry and save it again.
+     * 2.1 There are different types of members: Users / Groups, this will be defined in $suffix
+     * 2.2 And each type has two modes, Admin (e.g. 'gotoUserAdminPrinter') and Normal 
+     */
+    
+    $this->detect_grouptype();
+
+    if($this->add_del_printer_member_was_called){
+
+      $types = array( "gotoUserPrinter"       => "AddUser",
+          "gotoGroupPrinter"      => "AddGroup",
+          "gotoUserAdminPrinter"  => "AddAdminUser",
+          "gotoGroupAdminPrinter" => "AddAdminGroup");
+
+      if($this->is_group){
+        $s_suffix = "Group";
+        $useVar   = "cn";
+      }else{
+        $useVar   = "uid";
+        $s_suffix = "User";
+      }
+
+      /* Remove old entries */
+      $ldap->search("(&(objectClass=gotoPrinter)(goto".$s_suffix."Printer=".$this->$useVar."))",array("*"));
+      while($attr = $ldap->fetch()){
+        $printerObj = NULL;
+        $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$attr['dn'],"printer");
+        $printerObj->set_acl_base($attr['dn']);
+        $printerObj->by_object['printgeneric']->DelMember($types["goto".$s_suffix."Printer"],$this->$useVar);
+        $printerObj->by_object['printgeneric']->save();
+      }
+
+      $ldap->search("(&(objectClass=gotoPrinter)(goto".$s_suffix."AdminPrinter=".$this->$useVar."))",array("*"));
+      while($attr = $ldap->fetch()){
+        $printerObj = NULL;
+        $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$attr['dn'],"printer");
+        $printerObj->set_acl_base($attr['dn']);
+        $printerObj->by_object['printgeneric']->DelMember($types["goto".$s_suffix."AdminPrinter"],$this->$useVar);
+        $printerObj->by_object['printgeneric']->save();
+      }
+
+      foreach($this->gotoPrinter as $printer){
+        $printerObj = NULL;
+        $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$printer['dn'],"printer");
+        $printerObj->set_acl_base($printer['dn']);
+
+
+        if($printer['mode'] == "admin") {
+          $attribute = "goto".$s_suffix."AdminPrinter";
+        }else{
+          $attribute = "goto".$s_suffix."Printer";
+        }
+
+        $printerObj->by_object['printgeneric']->AddMember($types[$attribute],$this->dn);
+        $printerObj->by_object['printgeneric']->save();
+      }
+    }    
+
+    /* Prepare HotPlug devices */
+    $this->attrs['gotoHotplugDeviceDN'] = array();
+    foreach($this->gotoHotplugDevices as $name => $device){
+      $this->attrs['gotoHotplugDeviceDN'][]= $device['dn'];
+    }
+
+    /* Prepare LogonScripts */
+    $this->attrs['gotoLogonScript'] = array();
+    foreach($this->gotoLogonScripts as $name => $script){
+      $this->attrs['gotoLogonScript'][] =   $script['LogonName']."|".
+        $script['LogonOverload'].$script['LogonLast']."|".
+        $script['LogonPriority']."|".
+        base64_encode($script['LogonData'])."|".
+        $script['LogonDescription'];
+    }
+
+    /* Prepare Shares */
+    $this->attrs['gotoShare']=array();
+    foreach($this->gotoShares as $name => $share){
+      $mntp= $share['mountPoint'];
+      if (!preg_match('=^[a-z0-9+\._/%-]+$=i', $mntp)){
+        $mntp= base64_encode($mntp);
+      }
+      $this->attrs['gotoShare'][] =$share['server']."|".$share['name']."|".$mntp."|".$share['PwdHash']."|".$share['Username'];
+    }
+
+
+    if($this->gotoXResolution == "auto") $this->gotoXResolution ="";
+    $saveThis = array("gotoProfileQuota","gotoXResolution","gotoProfileServer","gotoKioskProfile","gosaDefaultPrinter");
+
+    foreach($saveThis as $tosave){
+      if(!empty($this->$tosave)){
+        $this->attrs[$tosave]=$this->$tosave;
+      }else{
+        $this->attrs[$tosave]=array();
+      }
+    }
+
+    /* Prepare Flags */
+    $this->attrs['gotoProfileFlags'] = array($this->gotoProfileFlagC.$this->gotoProfileFlagL);
+    if(empty($this->attrs['gotoProfileFlags'][0])){
+      $this->attrs['gotoProfileFlags']=array();
+    }
+
+    if($this->useProfile == false){
+      $this->attrs['gotoProfileFlags'] = preg_replace("/C/i","",$this->attrs['gotoProfileFlags']);
+      $this->attrs['gotoProfileServer']= array(); 
+    }
+
+    $ldap->cat ($this->dn, array('dn'));
+    if ($ldap->fetch()){
+      $mode= "modify";
+    } else {
+      $mode= "add";
+      $ldap->cd($this->config->current['BASE']);
+      $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
+    }
+
+    $ldap->cd($this->dn);
+    $this->cleanup();
+    $ldap->$mode($this->attrs);
+  
+    $cat = "users";
+    if($this->is_group){
+      $cat = "groups";
+    }
+
+    /* Log last action */ 
+    if($this->initially_was_account){
+      new log("modify",$cat."/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      new log("create",$cat."/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
+
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/environment account with dn '%s' failed."),$this->dn));
+    $this->handle_post_events($mode,array("uid"=>$this->uid));
+  }
+
+  /* Generate ListBox frindly output for the defined shares 
+   * Possibly Add or remove an attribute here, 
+   */
+  function printOutAssignedShares()
+  {
+    $a_return = array();
+    if(is_array($this->gotoShares)){
+      foreach($this->gotoShares as $share){
+        if(preg_match("/^!/",$share['server'])){
+          $a_return[$share['name']."|".$share['server']]= preg_replace("/^!/","",$share['server'])."://".$share['name']." - "._("group share"); 
+        }else{
+          $a_return[$share['name']."|".$share['server']]= $share['server']."://".$share['name']." on ".$share['mountPoint']." as ".$share['Username'];
+        }
+      }
+      natcasesort($a_return);
+    }
+    return($a_return);
+  }
+
+  /* Generate ListBox frindly output for the definedhotplugs 
+   * Possibly Add or remove an attribute here,
+   */
+  function printOutHotPlugDevices()
+  {
+    $a_return= array();
+    if(is_array($this->gotoHotplugDevices)){
+      foreach($this->gotoHotplugDevices as $key=>$device){
+        $a_return[$key] = $device['name']." - ".$device['id'];
+      }
+    }
+    return($a_return);
+  }
+
+  /* Generates ListBox frienly output of used printer devices 
+   * Append ' - admin' if printer is used in admin mode
+   */
+  function printOutPrinterDevices()
+  {
+    $a_return = array();
+    
+    if($this->acl_is_readable("gotoPrinter")){
+
+      if(is_array($this->gotoPrinter)){
+        foreach($this->gotoPrinter as $printer){
+          if($printer['mode'] == "admin"){
+            $a_return[$printer['cn'][0]]= $printer['cn'][0]." - "._("Administrator");
+          }else{
+            $a_return[$printer['cn'][0]]= $printer['cn'][0]; 
+          }
+          if ($printer['cn'][0] == $this->gosaDefaultPrinter){
+            $a_return[$printer['cn'][0]].=" - "._("Default printer");
+          }
+        }
+      }
+    }
+    return($a_return);
+  }
+
+
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);
+
+    $class= get_class($this);
+    $o_source = new $class($this->config,$source['dn']);
+    foreach($this->CopyPasteVars as $attr){
+      $this->$attr = $o_source->$attr;  
+    }
+  }
+
+
+  function saveCopyDialog()
+  {
+    if(isset($_POST['cn'])){
+      $this->cn = $_POST['cn'];
+      $this->uid = $_POST['cn'];
+    }
+  }
+
+
+  /* Generates ListBox frienly output of used logonscripts 
+   */
+  function printOutLogonScripts()
+  {
+    $a_return = array();
+    if(is_array($this->gotoLogonScripts)){
+      foreach($this->gotoLogonScripts as $script){
+        $a_return[$script['LogonName']]= $script['LogonPriority']." - ".$script['LogonName']; 
+      }
+    }
+    return($a_return);
+  }
+
+
+  /* Return plugin informations for acl handling 
+#FIXME these ACLs should work for groups too */ 
+  static function plInfo()
+  {
+    return (array("plShortName"     => _("Environment"),
+          "plDescription"   => _("Environment settings"),         // Description
+          "plSelfModify"    => TRUE,                              
+          "plDepends"       => array("user", "posixAccount"),     // This plugin depends on 
+          "plPriority"      => 3,                                 // Position in tabs 
+          "plSection"     => array("personal" => _("My account")),
+          "plCategory"    => array("users",
+                                   "groups"),
+          "plOptions"       => array("resolution_hook" => array("type" => "string",
+              "description" => _("Command to extend the list of possible screen resolutions"))),
+
+          "plProvidedAcls"  => array(
+
+            "gotoProfileFlagL"    => _("Resolution changeable during session") ,
+            "gotoProfileFlagC"    => _("Cache profile localy") ,
+
+            "gotoProfileQuota"    => _("Profile quota") ,
+            "gotoProfileServer"   => _("Profile server") ,
+
+            "gotoXResolution"     => _("Resolution") ,
+            "gotoKioskProfile"    => _("Kiosk profile") ,
+
+            "gosaDefaultPrinter"  => _("Default printer") ,
+            "gotoLogonScript"     => _("Logon script") ,
+            "gotoHotplugDevice"   => _("Hotplug devices"),
+            "gotoShare"           => _("Shares"))
+            ));
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/personal/environment/class_hotplugDialog.inc b/gosa-core/plugins/personal/environment/class_hotplugDialog.inc
new file mode 100644 (file)
index 0000000..0dd418e
--- /dev/null
@@ -0,0 +1,112 @@
+<?php
+
+class hotplugDialog 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 $hotplugDevices           = ""; 
+  var $hotplugDeviceList        = array(); 
+  var $regex                    = "*";
+  var $depselect                = "/";
+  var $deplist                  = "/";
+  var $skipThese                = array();
+
+  function hotplugDialog (&$config,$skipThese = array())
+  {
+    $this->skipThese  = $skipThese;
+    $this->config     = $config;
+    $this->depselect  = $_SESSION['CurrentMainBase'];
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+    $display= "";
+
+    if(isset($_POST['dialogissubmitted'])){
+      $this->regex=$_POST['regexHot'];
+      $this->depselect = $_POST['depselectHot'];
+    }
+
+    if((isset($_GET['search']))&&(!empty($_GET['search']))){
+      $this->regex=$_GET['search']."*";
+      $this->regex=preg_replace("/\*\*/","*",$this->regex);
+    }
+
+    $this->deplist=$this->config->idepartments;
+
+    $this->hotplugDevices = $this->getHotplugs();
+    $smarty->assign("regexHot"    ,$this->regex);
+    $smarty->assign("deplistHot"  ,$this->deplist);
+    $smarty->assign("depselectHot",$this->depselect);
+    $smarty->assign("apply", apply_filter());
+    $smarty->assign("alphabet", generate_alphabet());
+    $smarty->assign("search_image", get_template_path('images/search.png'));
+    $smarty->assign("tree_image", get_template_path('images/tree.png'));
+    $smarty->assign("launchimage", get_template_path('images/small_filter.png'));
+    $smarty->assign("deplist", $this->config->idepartments);
+
+
+    $smarty->assign("hotplugDevices",$this->hotplugDevices);
+    $smarty->assign("hotplugDeviceKeys",array_flip($this->hotplugDevices));
+    $display.= $smarty->fetch(get_template_path('hotplugDialog.tpl', TRUE,dirname(__FILE__)));
+    return($display);
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    $entries = array();
+    foreach($_POST['hotplugName'] as $name){
+      $entries[$name] = $this->hotplugDeviceList[$name];
+    }
+    return $entries;
+  }
+
+  function getHotplugs()
+  {
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd("ou=devices,".$this->depselect);
+    $ldap->search("(&(objectClass=gotoDevice)(|(cn=".$this->regex.")(description=".$this->regex.")))",array("gotoHotplugDevice","cn","dn")); 
+
+    $a_return = array();  
+    $this->hotplugDeviceList = array();
+    while($attr = $ldap->fetch()){
+
+      if(isset($attr['gotoHotplugDevice'][0])){
+
+        $hot_plug = $attr['gotoHotplugDevice'][0];
+        $tmp      = preg_split("/\|/",$hot_plug);
+        $tmp2     = array();
+          
+        if(in_array($attr['cn'][0],$this->skipThese)){
+          continue;
+        }
+
+        $tmp2['name']         = $attr['cn'][0];
+        $tmp2['description']  = $tmp[0];
+        $tmp2['id']           = $tmp[1];
+        $tmp2['produkt']      = $tmp[2];
+        $tmp2['vendor']       = $tmp[3];
+        $tmp2['dn']           = $attr['dn'];
+
+        $a_return[$attr['cn'][0]]= $attr['cn'][0]." [".$tmp[0]."] ".$tmp[1];
+
+        $this->hotplugDeviceList[$attr['cn'][0]]=$tmp2;
+      }
+    }
+    return($a_return);
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/personal/environment/class_logonManagementDialog.inc b/gosa-core/plugins/personal/environment/class_logonManagementDialog.inc
new file mode 100644 (file)
index 0000000..f125ad0
--- /dev/null
@@ -0,0 +1,139 @@
+<?php
+class logonManagementDialog 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("LogonName","LogonPriority","LogonLast","LogonOverload","LogonData","LogonDescription");
+  var $objectclasses        = array("whatever");
+  var $use_existing         = false;  
+
+  var $LogonName        ="";  // Name for the LogonScript
+  var $LogonPriority    ="";  // Priority defines the order in which the scripts will be processed 
+  var $LogonLast        ="";  // Is this script marked as the last, all following scripts will be skipped
+  var $LogonOverload    ="";  // If Overload is activated this script is overlaodable by a group script with same prio
+  var $LogonData        ="";  // The script itself
+  var $LogonDescription ="";
+    
+  var $nameIsEditable = true;
+
+  var $real_LogonName = "";
+
+  function logonManagementDialog (&$config, $dn= NULL,$data=false)
+  {
+    plugin::plugin ($config, $dn);
+    
+    if($data){
+      $this->LogonName        = $data['LogonName'];
+      $this->LogonPriority    = $data['LogonPriority'];
+      $this->LogonOverload    = $data['LogonOverload'];
+      $this->LogonLast        = $data['LogonLast'];
+      $this->LogonData        = $data['LogonData'];
+      $this->LogonDescription = $data['LogonDescription'];
+      $this->nameIsEditable   = false;
+      $this->real_LogonName   = $data['LogonName'];
+    }
+  }
+
+  function execute()
+  {
+       /* Call parent execute */
+       plugin::execute();
+
+    $smarty= get_smarty();
+    $display= "";
+
+    if((isset($_POST['StartImport']))&&(isset($_FILES['importFile']))){
+      $this->LogonData = file_get_contents($_FILES['importFile']['tmp_name']);
+      @unlink($_FILES['importFile']['tmp_name']);
+    }
+
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr,$this->$attr);
+      if($this->$attr){
+        $smarty->assign($attr."CHK"," checked ");
+      }else{
+        $smarty->assign($attr."CHK","");
+      }
+    }
+    $prios=array(1,2,3,4,5,6,7,8,9,10);
+    $smarty->assign("LogonPrioritys",$prios);
+    $smarty->assign("LogonPriorityKeys",$prios);
+
+    if(!$this->nameIsEditable){
+      $smarty->assign("LogonNameACL"," disabled ");
+    }else{
+      $smarty->assign("LogonNameACL","");
+    }
+  
+
+    $display.= $smarty->fetch(get_template_path('logonManagement.tpl', TRUE,dirname(__FILE__)));
+    return($display);
+  }
+
+  function save_object()
+  {
+    if(isset($_POST['dialogissubmitted'])){
+      foreach($this->attributes as $attr){
+
+        if(!$this->nameIsEditable && $attr == 'LogonName'){
+          continue;
+        }
+        if(isset($_POST[$attr])){
+          $this->$attr = stripslashes($_POST[$attr]); 
+        }
+      }
+
+      foreach(array("LogonLast","LogonOverload") as $checkBoxes){
+        if(isset($_POST[$checkBoxes])){
+          $this->$checkBoxes = stripslashes($_POST[$checkBoxes]);
+        }else{
+          $this->$checkBoxes = "";
+        }
+
+      }
+    }
+  }
+
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+  
+    if(preg_match("/[^a-zA-Z]/",$this->LogonName)){
+      $message[] = _("Specified name should only consist of upper-/lowercase characters.");
+    }
+
+    if(empty($this->LogonName)){
+      $message[] = _("Please specify a valid script name.");
+    }
+
+    if(preg_match("/[^a-z0-9,\.-;:_\(\)!\? ]/i",$this->LogonDescription)){
+      $message[] = _("Specified description contains invalid characters.");
+    }
+
+    return $message;
+  }
+
+
+  function save()
+  {
+    $a_return= array();
+    foreach($this->attributes as $attr){
+      $a_return[$attr]=$this->$attr;
+    }  
+
+    if(!$this->nameIsEditable){
+      $a_return['LogonName']=$this->real_LogonName;
+    }
+
+    return($a_return); 
+  }
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/personal/environment/class_selectPrinterDialog.inc b/gosa-core/plugins/personal/environment/class_selectPrinterDialog.inc
new file mode 100644 (file)
index 0000000..fea177b
--- /dev/null
@@ -0,0 +1,169 @@
+<?php
+
+class selectPrinterDialog 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 $AlreadyAssigned      = array();  
+  var $regex                = "*";
+  var $depselect            = "/";
+  var $deplist              = array("/");
+  var $module               = array("printer");
+  var $ui                   = NULL;
+  var $subtreesearch        = FALSE;
+
+  function selectPrinterDialog (&$config, $dn= NULL,$alreadyused=array() )
+  {
+    $this->AlreadyAssigned = $alreadyused;
+    plugin::plugin ($config, $dn);
+
+    /* Get all departments within this subtree */
+    $base = $this->config->current['BASE'];
+
+    /* Add base */
+    $tmp = array();
+    $tmp[] = array("dn"=>$this->config->current['BASE']);
+    $tmp=  array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
+                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
+
+    $deps = array();
+    foreach($tmp as $tm){
+      $deps[$tm['dn']] = $tm['dn'];
+    }
+
+
+    /* Load possible departments */
+    $ui= get_userinfo();
+    $this->ui = $ui;
+    $tdeps= $ui->get_module_departments("users");
+    $ids = $this->config->idepartments;
+    $first = "";
+    $found = FALSE;
+    $res = array();
+    foreach($ids as $dep => $name){
+      if(isset($deps[$dep]) && in_array_ics($dep, $tdeps)){
+        $res[$dep] = $ids[$dep]; //$tdeps[$dep];
+      }
+    }
+    $this->deplist = $res;
+    $this->depselect = key($res);
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+    $display= "";
+
+    if(isset($_POST['dialogissubmitted'])){
+      foreach(array('regexPrinter' => 'regex','depselectPrinter'=>'depselect') as $attr => $name){
+        if(isset($_POST[$attr])){
+          $this->$name      =$_POST[$attr];
+        }
+      }
+    }
+
+    if(isset($_POST['subtrees'])){
+      $this->subtreesearch= TRUE;
+    } else {
+      $this->subtreesearch= FALSE;
+    }
+
+    if((isset($_GET['search']))&&(!empty($_GET['search']))){
+      $this->regex=$_GET['search']."*";
+      $this->regex=preg_replace("/\*\*/","*",$this->regex);
+    }
+
+    $smarty->assign("regexPrinter"    ,$this->regex);
+    $smarty->assign("deplistPrinter"  ,$this->deplist);
+    $smarty->assign("depselectPrinter",$this->depselect);
+    $smarty->assign("gotoPrinters",$this->getPrinter());
+    $smarty->assign("gotoPrinterKeys",array_flip($this->getPrinter()));
+    $smarty->assign("apply", apply_filter());
+    $smarty->assign("alphabet", generate_alphabet());
+    $smarty->assign("subtrees", $this->subtreesearch?"checked":"");
+    $smarty->assign("search_image", get_template_path('images/search.png'));
+    $smarty->assign("tree_image", get_template_path('images/tree.png'));
+    $smarty->assign("infoimage", get_template_path('images/info.png'));
+    $smarty->assign("launchimage", get_template_path('images/small_filter.png'));
+    $smarty->assign("deplist", $this->config->idepartments);
+
+    $display.= $smarty->fetch(get_template_path('selectPrinterDialog.tpl', TRUE,dirname(__FILE__)));
+    return($display);
+  }
+
+  function check(){
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    if(empty($_POST['gotoPrinter'])){
+      $message[] = _("Please select a printer or press cancel.");
+    }
+    return $message;
+  }
+
+  /* Save to LDAP */
+  function save()
+  {
+    return($_POST['gotoPrinter']);
+  }
+
+  /* This function generates the Printerlist
+   * All printers are returned that match regex and and depselect
+   */
+  function getPrinter($detailed = false)
+  {
+    $a_return=array();
+
+
+    $filter = "(&(objectClass=gotoPrinter)(cn=".$this->regex."))";
+    $module = $this->module;
+    $base   = $this->depselect;
+    $attrs  = array("cn","description");
+    if ($this->subtreesearch){
+      $res    = get_list($filter,$module,$base,$attrs, GL_SIZELIMIT, GL_SUBSEARCH);
+    } else {
+      $base= "ou=printers,ou=systems,".$base;
+      $res    = get_list($filter,$module,$base,$attrs, GL_SIZELIMIT);
+    }
+
+    foreach($res as $printer)  {
+
+      $acl = $this->ui->get_permissions($printer['dn'],"printer/printgeneric","gotoUserPrinter");
+
+      if(!preg_match("/w/",$acl)){
+        continue;
+      }
+
+      if(isset($this->AlreadyAssigned[$printer['cn'][0]])) continue;
+
+      if($detailed ==true){
+        $a_return[$printer['cn'][0]] = $printer;
+      }else{
+        if(isset($printer['description'][0])){
+          $a_return[$printer['cn'][0]] = $printer['cn'][0]." - ".$printer['description'][0];  
+        }else{
+          $a_return[$printer['cn'][0]] = $printer['cn'][0];  
+        }
+      }
+    }
+    return($a_return);
+  }
+}
+
+
+
+
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/personal/environment/environment.tpl b/gosa-core/plugins/personal/environment/environment.tpl
new file mode 100644 (file)
index 0000000..ba6c356
--- /dev/null
@@ -0,0 +1,294 @@
+{if $is_account ne 'true'}
+ <img alt="" class="center" src="images/stop.png" align="middle">
+ {t}The environment extension is currently disabled.{/t}
+{else}
+
+
+<input type="hidden" name="iamposted" value="1">
+
+<h2> 
+ <img class="center" alt="" src="images/fai_profile.png" align="middle" /> 
+ {t}Profiles{/t}
+</h2>
+
+<table summary="{t}Environment managment settings{/t}" width="100%">
+ <tr>
+  <td style="width:50%;border-right:1px solid #B0B0B0;vertical-align:top;">
+   <table summary="{t}Profile managment{/t}">
+    <tr>
+     <td style="vertical-align:top">
+{render acl=$gotoProfileACL}
+      <input class="center" type="checkbox" value="1" {$useProfileCHK} name="useProfile" id="useProfile" onclick="changeState('gotoProfileServer');changeState('gotoProfileFlagC');changeState('gotoProfileQuota');">
+{/render}
+     </td>
+     <td style="vertical-align:middle;">
+      <label for="useProfile">{t}Use profile managment{/t}</label>
+     </td>
+    </tr>
+    <tr>
+     <td>&nbsp;
+     </td>
+     <td>
+      <table summary="{t}Profile server managment{/t}">
+       <tr>
+        <td> 
+         <label for="gotoProfileServer">{t}Profil path{/t}</label>
+        </td>
+        <td>
+{render acl=$gotoProfileServerACL}
+
+{if $gotoProfileServerWriteable}
+         <select id="gotoProfileServer" name="gotoProfileServer">
+          {html_options values=$gotoProfileServerKeys output=$gotoProfileServers selected=$gotoProfileServer}
+          <option disabled>&nbsp;</option>
+         </select>
+{else}
+         <select id="gotoProfileServer" name="gotoProfileServer">
+          {html_options values=$gotoProfileServer output=$gotoProfileServer selected=$gotoProfileServer}
+          <option disabled>&nbsp;</option>
+         </select>
+{/if}
+{/render}
+        </td>
+       </tr>
+       <tr>
+        <td>
+         <label for="gotoProfileQuota">{t}Profil quota{/t}</label> 
+         <br>
+         <br>
+        </td>
+        <td>
+{render acl=$gotoProfileQuotaACL}
+         <input type="text" name="gotoProfileQuota" value="{$gotoProfileQuota}" size="6" id="gotoProfileQuota">{t}MB{/t}
+{/render}
+         <br>
+         <br>
+        </td>
+       </tr>
+       <tr>
+        <td colspan=2> 
+{render acl=$gotoProfileFlagCACL}
+         <input class="center" type="checkbox" name="gotoProfileFlagC" value="C" {$gotoProfileFlagCCHK} id="gotoProfileFlagC">&nbsp;
+{/render}
+         <label for="gotoProfileFlagC">{t}Cache profile localy{/t}</label>
+        </td>
+       </tr>
+      </table>
+     </td>
+    </tr>
+   </table>
+  </td>
+  <td style="vertical-align:top">
+
+  <table summary="{t}Kiosk profile settings{/t}">
+{if $kiosk_enabled }
+    <tr>
+     <td colwidth=2>
+      <label for="kiosk_server">{t}Kiosk profile{/t}</label>
+     </td>
+    </tr>
+    <tr>
+     <td>
+      {t}Server{/t}
+      <select name='kiosk_server' id="kiosk_server" onChange='document.mainform.submit();'>
+       {html_options options=$kiosk_servers selected=$kiosk_server}
+      </select>
+     </td>
+     <td>
+      {if $kiosk_server != "none"}
+      {t}Profile{/t}
+      <select name='kiosk_profile'>
+       {html_options values=$kiosk_profiles output=$kiosk_profiles selected=$kiosk_profile}
+      </select>
+      {else}
+        &nbsp;
+      {/if}
+     </td>
+    </tr>
+ {else}
+       <tr>
+               <td>
+                       <label for="dummy1">{t}Kiosk profile{/t}</label>
+               </td>
+               <td>
+                       <select name="dummy1" disabled id="dummy1"><option disabled>&nbsp;</option></select>
+                       <input type="button" disabled name="dummy2" value="{t}Manage{/t}">
+               </td>
+       </tr>
+{/if}
+    <tr>
+     <td colspan=2>
+      <br>
+{render acl=$gotoProfileFlagLACL}
+      <input type="checkbox" name="gotoProfileFlagL" id="gotoProfileFlagL" value="L" {$gotoProfileFlagLCHK}>
+{/render}
+      <label for="gotoProfileFlagL">{t}Resolution changeable during session{/t}</label>
+     </td>
+    </tr>
+    <tr>
+     <td>
+      <label for="gotoXResolution">{t}Resolution{/t}</label>
+     </td>
+     <td>
+{render acl=$gotoXResolutionACL}
+      <select name="gotoXResolution" id="gotoXResolution">
+       {html_options values=$gotoXResolutionKeys output=$gotoXResolutions selected=$gotoXResolution}
+      <option disabled>&nbsp;</option>
+      </select>
+{/render}
+     </td>
+    </tr>
+   </table> 
+
+
+
+
+
+
+  </td>
+ </tr>
+</table>
+
+<p class="seperator">&nbsp;</p>
+
+<table summary="{t}Environment managment settings{/t}" width="100%">
+ <tr>
+  <td style="width:50%;border-right:1px solid #B0B0B0">
+   <h2>
+    <img class="center" alt="" src="images/fai_partitionTable.png" align="middle" />&nbsp;
+    <label for="gotoShare">{t}Shares{/t}</label>
+   </h2>
+   <table summary="" style="width:100%">
+    <tr>
+     <td>
+       
+{render acl=$gotoShareACL}
+      {$divlistShares}
+{/render}
+{render acl=$gotoShareACL}
+      <input type="text" size=15 name="ShareUser" value="%u" title="{t}User used to connect to the share{/t}">@
+{/render}
+{render acl=$gotoShareACL}
+      <select name="gotoShareSelection" title="{t}Select a share{/t}">
+       {html_options values=$gotoShareSelectionKeys output=$gotoShareSelections}
+       <option disabled>&nbsp;</option>
+      </select>
+{/render}
+      :
+{render acl=$gotoShareACL}
+      <input type="text" size=15 name="gotoShareMountPoint" value="%H/Netzlaufwerke/%L/%S"
+      title="{t}Mount path{/t}">
+{/render}
+{render acl=$gotoShareACL}
+      <input type="submit" name="gotoShareAdd" value="{t}Add{/t}"> 
+{/render}
+      <!--   <input type="submit" name="gotoShareDel" value="{t}Remove{/t}"> -->
+     </td>
+    </tr>
+   </table>
+  </td>
+  <td style="vertical-align:top">
+   <h2>
+    <img class="center" alt="" src="images/fai_script.png" align="middle" />&nbsp;
+    <label for="gotoLogonScript">{t}Logon scripts{/t}</label>
+   </h2>
+   <table summary="{t}Logon script management{/t}" style="width:100%">
+    <tr>
+     <td>
+{render acl=$gotoLogonScriptACL}
+      <select style="width:100%;" name="gotoLogonScript" multiple size=5 id="gotoLogonScript">
+       {html_options values=$gotoLogonScriptKeys output=$gotoLogonScripts }
+       <option disabled>&nbsp;</option>
+      </select>
+{/render}
+
+      <br>
+{render acl=$gotoLogonScriptACL}
+      <input type="submit" name="gotoLogonScriptNew" value="{t}Add{/t}">
+{/render}
+{render acl=$gotoLogonScriptACL}
+      <input type="submit" name="gotoLogonScriptEdit"  value="{t}Edit{/t}" {if $gotoLogonScriptKeysCnt ==0} disabled {/if}>
+{/render}
+{render acl=$gotoLogonScriptACL}
+      <input type="submit" name="gotoLogonScriptDel"  value="{t}Delete{/t}" {if $gotoLogonScriptKeysCnt ==0} disabled {/if}>
+{/render}
+     </td>
+    </tr>
+   </table> 
+  </td>
+ </tr>
+</table>
+
+<p class="seperator">&nbsp;</p>
+
+<table summary="{t}Environment managment settings{/t}" width="100%">
+ <tr>
+  <td style="border-right:1px solid #B0B0B0; width:50%; vertical-align:top">
+   <h2>
+    <img alt="" src="images/hotplug.png" align="middle" class="center" />&nbsp;
+    <label for="gotoHotplugDevice_post">{t}Hotplug devices{/t}</label>
+   </h2> 
+   <table style="width:100%" summary="{t}Hotplug device settings{/t}">
+    <tr>
+     <td>
+{render acl=$gotoHotplugDeviceACL}
+      <select name="gotoHotplugDevice_post[]" size=5  style="width:100%;" id="gotoHotplugDevice_post" multiple>
+       {html_options values=$gotoHotplugDeviceKeys output=$gotoHotplugDevices}
+       <option disabled>&nbsp;</option>
+      </select>
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td>
+{render acl=$gotoHotplugDeviceACL}
+      <input type="submit" name="gotoHotplugDeviceUse" value="{t}Add{/t}">
+{/render}
+{render acl=$gotoHotplugDeviceACL}
+      <input type="submit" name="gotoHotplugDeviceDel" value="{t}Delete{/t}"
+      {if !$gotoHotplugDevices} disabled {/if}>
+{/render}
+     </td>
+    </tr>
+   </table>
+  </td>
+  <td>
+   <h2>
+    <img alt="" src="images/select_printer.png" align="middle" class="center" />&nbsp;
+    <label for="gotoPrinter">{t}Printer{/t}</label>
+   </h2>
+   <table style="width:100%" summary="{t}Printer settings{/t}">
+    <tr>
+     <td>
+{render acl=$gotoPrinterACL}
+      <select style="width:100%;" name="gotoPrinterSel[]" multiple size=5 id="gotoPrinter">
+       {html_options values=$gotoPrinterKeys output=$gotoPrinter}
+       <option disabled>&nbsp;</option>
+      </select>
+{/render}
+      <br>
+{render acl=$gotoPrinterACL}
+      <input type="submit"  name="gotoPrinterAdd"     value="{t}Add{/t}">
+{/render}
+{render acl=$gotoPrinterACL}
+      <input type="submit" name="gotoPrinterDel"     value="{t}Delete{/t}" {if !$gotoPrinter } disabled {/if}>
+{/render}
+{render acl=$gotoPrinterACL}
+      <input type="submit" name="gotoPrinterEdit"    value="{t}Toggle admin{/t}" {if !$gotoPrinter } disabled {/if}>
+{/render}
+{render acl=$gosaDefaultPrinterACL}
+      <input type="submit" name="gotoPrinterDefault"    value="{t}Toggle default{/t}" {if !$gotoPrinter | $is_group} disabled {/if}>
+{/render}
+     </td>
+    </tr>
+   </table>
+  </td>
+ </tr>
+</table>
+<script language="JavaScript" type="text/javascript">
+<!-- // First input field on page
+focus_field('useProfile');
+-->
+</script>
+{/if}
+
diff --git a/gosa-core/plugins/personal/environment/hotplugDialog.tpl b/gosa-core/plugins/personal/environment/hotplugDialog.tpl
new file mode 100644 (file)
index 0000000..868e72b
--- /dev/null
@@ -0,0 +1,70 @@
+<h2><img class="center" alt="" src="images/hotplug.png" align="middle">&nbsp;{t}Add hotplug devices{/t}</h2>
+
+    <input type="hidden" name="dialogissubmitted" value="1">
+
+       <table summary="{t}Hotplug management{/t}" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4 cellspacing=2>
+        <tr>
+            <td width="50%" style="vertical-align:top;">
+                               <div class="contentboxh" style="height:20px;">
+                               <p class="contentboxh" style="font-size:12px">
+                                       <b><LABEL for="hotplugName">{t}Select hotplug device to add{/t}</LABEL></b>
+                               </p>
+                               </div>
+                               <div class="contentboxb">
+                               <p class="contentboxb" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+                                               <select style="width:600px;height:450px" size=20 name="hotplugName[]" id="hotplugName" multiple>
+                                                       {html_options values=$hotplugDeviceKeys output=$hotplugDevices}
+                                               <option disabled>&nbsp;</option>
+                                               </select><br>
+                                       </p>
+                               </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]">{t}Filters{/t}</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>
+                            <img class="center" alt="" src="{$tree_image}" align=middle>&nbsp;
+                            <select name="depselectHot" size=1 onChange="mainform.submit()" title="{t}Choose the department the search will be based    on{/t}">
+                              {html_options options=$deplistHot selected=$depselectHot}
+                            </select>
+                        </td>
+                    </tr>
+                </table>
+                        <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+                            <tr>
+                                <td>
+                                    <LABEL for='filter'><img class="center" alt="Search" src="{$search_image}" align="middle" title="{t}Display users matching{/t}">
+                                    </LABEL>
+                                </td>
+                                <td width="99%">
+                                    <input id='filter' style='width:99%' type='text' name='regexHot' maxlength='20' value='{$regexHot}'
+                                            title='{t}Regular expression for        matching hotplugs{/t}' onChange="mainform.submit()">
+                                </td>
+                            </tr>
+                        </table>
+                    {$apply}
+                </div>
+            </td>
+
+
+               </tr>
+       </table>
+
+    <p class="seperator">&nbsp;</p>
+
+    <p align="right">
+    <input type="submit" name="HotPlugSave"     value="{t}Add{/t}">
+    <input type="submit" name="HotPlugCancel"   value="{t}Cancel{/t}">
+    </p>
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('hotplugName');
+  -->
+</script>
diff --git a/gosa-core/plugins/personal/environment/logonManagement.tpl b/gosa-core/plugins/personal/environment/logonManagement.tpl
new file mode 100644 (file)
index 0000000..746be6f
--- /dev/null
@@ -0,0 +1,84 @@
+<h2><img class="center" alt="" src="images/fai_script.png" align="middle">&nbsp;{t}Logon script management{/t}</h2>
+
+    <input type="hidden" name="dialogissubmitted" value="1">
+
+    <table summary="{t}Logon script management{/t}" width="100%">
+       <tr>
+                       <td width="50%" style="vertical-align:top;border-right:1px solid #B0B0B0">
+                                       <table summary="{t}Logon script settings{/t}">
+                                               <tr>
+                                                       <td><LABEL for="LogonName">{t}Skript name{/t}</LABEL>
+                                                       </td>
+                                                       <td>
+                                                               <input type="text" size=20 value="{$LogonName}" name="LogonName" {$LogonNameACL} id="LogonName">
+                                                       </td>
+                                               </tr>
+                                               <tr>
+                                                       <td><LABEL for="LogonDescription">{t}Description{/t}</LABEL>
+                                                       </td>
+                                                       <td>
+                                                               <input type="text" size=40 value="{$LogonDescription}" name="LogonDescription" id="LogonDescription"> 
+                                                       </td>
+                                               </tr>
+                                               <tr>
+                                                       <td><LABEL for="LogonPriority">{t}Priority{/t}</LABEL>
+                                                       </td><td>
+                                               <select name="LogonPriority" id="LogonPriority">
+                                                       {html_options values=$LogonPriorityKeys output=$LogonPrioritys}
+                                               </select>
+                                                       </td>
+                                               </tr>
+                                       </table>
+                       </td>
+                       <td style="vertical-align:top">
+                                       <table summary="{t}Logon script flags{/t}">
+                                               <tr>
+                                                       <td>
+                                                               <input type="checkbox" value="L" name="LogonLast" {$LogonLastCHK} id="LogonLast">
+                                                       <LABEL for="LogonLast">{t}Last script{/t}</LABEL>
+                                                       </td>
+                                               </tr>
+                                               <tr>
+                                                       <td>
+                                                               <input type="checkbox" value="O" name="LogonOverload" {$LogonOverloadCHK} id="LogonOverload">
+                                                               <LABEL for="LogonOverload">{t}Script can be replaced by user{/t}</LABEL>
+                                                       </td>
+                                               </tr>
+                                       </table>
+                       </td>
+               </tr>
+       </table>
+       <p class="seperator">&nbsp;</p>
+       <table width="100%" summary="">
+               <tr>
+                       <td colspan="2">
+                       <h2><img class="center" alt="" src="images/fai_script.png" align="middle">&nbsp;{t}Script{/t}</h2>
+                                       <table width="100%" summary="{t}Logon script{/t}">
+                                               <tr>
+                                                       <td>
+                                                               <textarea style="width:100%;height:400px;" name="LogonData">{$LogonData}</textarea>
+                                                       </td>
+                                               </tr>
+                                               <tr>
+                                                       <td>
+                                                               <input type="file" name="importFile" id="importFile">
+                                                               <input type="submit" value="{t}Import{/t}" name="StartImport" >
+                                                       </td>
+                                               </tr>
+                                       </table>
+                       </td>
+               </tr>
+       </table>        
+
+       <p class="seperator">&nbsp;</p>
+    <p align="right">
+    <input type="submit" name="LogonSave"     value="{t}Apply{/t}">
+    <input type="submit" name="LogonCancel"   value="{t}Cancel{/t}">
+    </p>
+
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('LogonName');
+  -->
+</script>
+
diff --git a/gosa-core/plugins/personal/environment/main.inc b/gosa-core/plugins/personal/environment/main.inc
new file mode 100644 (file)
index 0000000..6b5d936
--- /dev/null
@@ -0,0 +1,125 @@
+<?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
+ */
+$lock_msg = "";
+if (!$remove_lock){
+  /* Reset requested? */
+  if (isset($_POST['edit_cancel']) || 
+      (isset($_GET['reset']) && $_GET['reset'] == 1)){
+#    del_lock ($ui->dn);
+    sess_del ('edit');
+    sess_del ('environment');
+  }
+
+  /* Create mail object on demand */
+  if (!isset($_SESSION['environment']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+    $_SESSION['environment']= new environment ($config, $ui->dn);
+    $_SESSION['environment']->enable_CSN_check();
+    $_SESSION['environment']->set_acl_category('users');
+    $_SESSION['environment']->set_acl_base($ui->dn);
+  }
+  $environment= $_SESSION['environment'];
+
+  /* save changes back to object */
+  if (isset($_SESSION['edit'])){
+    $environment->save_object ();
+  }
+
+  /* Enter edit mode? */
+  if (isset($_POST['edit'])){
+  
+   /* Check locking */
+    if (($username= get_lock($ui->dn)) != ""){
+      $_SESSION['back_plugin']= $plug;
+      $_SESSION['LOCK_VARS_TO_USE'] = array("/^edit$/","/^plug$/");
+      $lock_msg =  gen_locked_message ($username, $ui->dn);
+
+    }else{
+
+      /* Lock the current entry */
+      add_lock ($ui->dn, $ui->dn);
+      $_SESSION['dn']= $ui->dn;
+      $_SESSION['edit']= TRUE;
+    }
+  }
+
+  /* save changes to LDAP and disable edit mode */
+  if (isset($_POST['edit_finish'])){
+
+    /* Perform checks */
+    $message= $environment->check ();
+
+    /* No errors, save object */
+    if (count ($message) == 0){
+      $environment->save ();
+      del_lock ($ui->dn);
+      sess_del ('edit');
+
+      /* Remove object */
+      sess_del ('environment');
+    } else {
+      /* Errors found, show message */
+      show_errors ($message);
+    }
+  }
+
+  /* Execute formular */
+  if($lock_msg){
+    $display = $lock_msg;
+  }else{
+    $display = $environment->execute();
+  }
+
+  /* Store changes  in session */
+  if (isset ($_SESSION['edit'])){
+    $_SESSION['environment']= $environment;
+  }
+
+  $info= "";
+  /* Show page footer depending on the mode */
+  if (!$environment->in_dialog && $environment->is_account  && empty($lock_msg)){
+    $display.= "<p class=\"plugbottom\">";
+
+    /* Are we in edit mode? */
+    if ((isset($_SESSION['edit']))&&($environment->dialog===NULL)){
+      $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
+      $display.= "&nbsp;";
+      $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+      $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png').
+             "\"> ".$ui->dn."&nbsp;";
+    } else {
+      $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/openlock.png').
+        "\"> ".$ui->dn."&nbsp;";
+      if(preg_match("/w/",$ui->get_permissions($ui->dn,"users/environment"))){
+        $info.= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/lamp.png').
+          "\"> "._("Click the 'Edit' button below to change informations in this dialog");
+        $display.= "<input type=submit name=\"edit\" value=\""._("Edit")."\">\n";
+      }
+      $display.= "<input type=\"hidden\" name=\"ignore\">\n";
+    }
+    $display.= "</p>\n";
+  }
+
+  /* Page header*/
+  $display= print_header(get_template_path('images/email.png'), _("User environment settings"), $info).$display;
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/personal/environment/selectPrinterDialog.tpl b/gosa-core/plugins/personal/environment/selectPrinterDialog.tpl
new file mode 100644 (file)
index 0000000..f07674d
--- /dev/null
@@ -0,0 +1,72 @@
+<h2><img class="center" alt="" src="images/select_printer.png" align="middle">&nbsp;{t}Add printer devcies{/t}</h2>
+
+    <input type="hidden" name="dialogissubmitted" value="1">
+
+       <table summary="{t}Select printer to add{/t}" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
+        <tr>
+            <td width="50%">
+                               <div class="contentboxh" style="height:20px;">
+                               <p class="contentboxh" style="font-size:12px">
+                                       <b><LABEL for="gotoPrinter">{t}Select printer to add{/t}</LABEL></b>
+                               </p>
+                               </div>
+                               <div class="contentboxb">
+                               <p class="contentboxb" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+                               <select style="width:600px;height:450px" size=20 name="gotoPrinter[]" id="gotoPrinter" multiple>
+                               {html_options values=$gotoPrinterKeys output=$gotoPrinters}
+                               <option disabled>&nbsp;</option>
+                                        </select><br>
+                                       </p>
+                               </div>
+            </td>
+            <td valign="top">
+                               <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;background-color:#F8F8F8">
+                               {$alphabet}
+                               </table>
+                               <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+                                       <tr>
+                                               <td>
+                                                       <img class="center" alt="" src="{$tree_image}" align=middle>&nbsp;
+                                                       <select name="depselectPrinter" size=1 onChange="mainform.submit()" title="{t}Choose the department the search will be based on{/t}">
+                                                         {html_options options=$deplistPrinter selected=$depselectPrinter}
+                                                       </select>
+                                               </td>
+                                       </tr>
+                               </table>
+                               <table summary="" style="width:100%;border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+                               <tr><td>
+                               <input type=checkbox name="subtrees" value="1" {$subtrees} onClick="mainform.submit()" title="{t}Select to search within subtrees{/t}">{t}Search in subtrees{/t}
+                               </tr></td>
+                               </table>
+                                       <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+                                                       <tr>
+                                                               <td>
+                                                                       <LABEL for='filter'><img class="center" alt="Search" src="{$search_image}" align="middle" title="{t}Display printers matching{/t}">
+                                                                       </LABEL>
+                                                               </td>
+                                                       <td width="99%">
+                                                                       <input id='filter' style='width:99%' type='text' name='regexPrinter' maxlength='20' value='{$regexPrinter}' 
+                                                                                       title='{t}Regular expression for matching printer names{/t}' onChange="mainform.submit()">
+                                                               </td>
+                                                       </tr>
+                                               </table>
+                                       {$apply}
+                               </div>
+               </td>
+       </tr>
+    </table>
+
+    <p class="seperator">&nbsp;</p>
+    <p align="right">
+    <input type="submit" name="PrinterSave"     value="{t}Add{/t}">
+    <input type="submit" name="PrinterCancel"   value="{t}Cancel{/t}">
+    </p>
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('gotoPrinter');
+  -->
+</script>
diff --git a/gosa-core/plugins/personal/generic/class_user.inc b/gosa-core/plugins/personal/generic/class_user.inc
new file mode 100644 (file)
index 0000000..57414ef
--- /dev/null
@@ -0,0 +1,1572 @@
+<?php
+/*!
+  \brief   user plugin
+  \author  Cajus Pollmeier <pollmeier@gonicus.de>
+  \version 2.00
+  \date    24.07.2003
+
+  This class provides the functionality to read and write all attributes
+  relevant for person, organizationalPerson, inetOrgPerson and gosaAccount
+  from/to the LDAP. It does syntax checking and displays the formulars required.
+ */
+
+class user extends plugin
+{
+  /* Definitions */
+  var $plHeadline= "Generic";
+  var $plDescription= "This does something";
+
+  /* CLI vars */
+  var $cli_summary= "Handling of GOsa's user base object";
+  var $cli_description= "Some longer text\nfor help";
+  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* Plugin specific values */
+  var $base= "";
+  var $orig_base= "";
+  var $cn= "";
+  var $new_dn= "";
+  var $personalTitle= "";
+  var $academicTitle= "";
+  var $homePostalAddress= "";
+  var $homePhone= "";
+  var $labeledURI= "";
+  var $o= "";
+  var $ou= "";
+  var $departmentNumber= "";
+  var $employeeNumber= "";
+  var $employeeType= "";
+  var $roomNumber= "";
+  var $telephoneNumber= "";
+  var $facsimileTelephoneNumber= "";
+  var $mobile= "";
+  var $pager= "";
+  var $l= "";
+  var $st= "";
+  var $postalAddress= "";
+  var $dateOfBirth;
+  var $use_dob= "0";
+  var $gender="0";
+  var $preferredLanguage="0";
+
+  var $jpegPhoto= "*removed*";
+  var $photoData= "";
+  var $old_jpegPhoto= "";
+  var $old_photoData= "";
+  var $cert_dialog= FALSE;
+  var $picture_dialog= FALSE;
+  var $pwObject= NULL;
+
+  var $userPKCS12= "";
+  var $userSMIMECertificate= "";
+  var $userCertificate= "";
+  var $certificateSerialNumber= "";
+  var $old_certificateSerialNumber= "";
+  var $old_userPKCS12= "";
+  var $old_userSMIMECertificate= "";
+  var $old_userCertificate= "";
+
+  var $gouvernmentOrganizationalUnit= "";
+  var $houseIdentifier= "";
+  var $street= "";
+  var $postalCode= "";
+  var $vocation= "";
+  var $ivbbLastDeliveryCollective= "";
+  var $gouvernmentOrganizationalPersonLocality= "";
+  var $gouvernmentOrganizationalUnitDescription= "";
+  var $gouvernmentOrganizationalUnitSubjectArea= "";
+  var $functionalTitle= "";
+  var $role= "";
+  var $publicVisible= "";
+
+  var $orig_dn;
+  var $dialog;
+
+  /* variables to trigger password changes */
+  var $pw_storage= "crypt";
+  var $last_pw_storage= "unset";
+  var $had_userCertificate= FALSE;
+
+  var $view_logged = FALSE;
+
+  /* attribute list for save action */
+  var $attributes= array("sn", "givenName", "uid", "personalTitle", "academicTitle",
+      "homePostalAddress", "homePhone", "labeledURI", "ou", "o", "dateOfBirth", "gender","preferredLanguage",
+      "departmentNumber", "employeeNumber", "employeeType", "l", "st","jpegPhoto",
+      "roomNumber", "telephoneNumber", "mobile", "pager", "cn", "userPKCS12",
+      "postalAddress", "facsimileTelephoneNumber", "userSMIMECertificate");
+
+  var $objectclasses= array("top", "person", "organizationalPerson", "inetOrgPerson",
+      "gosaAccount");
+
+  /* attributes that are part of the government mode */
+  var $govattrs= array("gouvernmentOrganizationalUnit", "houseIdentifier", "vocation",
+      "ivbbLastDeliveryCollective", "gouvernmentOrganizationalPersonLocality",
+      "gouvernmentOrganizationalUnitDescription","gouvernmentOrganizationalUnitSubjectArea",
+      "functionalTitle", "certificateSerialNumber", "publicVisible", "street", "role",
+      "postalCode");
+
+  var $multiple_support = TRUE;
+
+  /* constructor, if 'dn' is set, the node loads the given
+     'dn' from LDAP */
+  function user (&$config, $dn= NULL)
+  {
+    $this->config= $config;
+    /* Configuration is fine, allways */
+    if ($this->config->current['GOVERNMENTMODE']){
+      $this->attributes=array_merge($this->attributes,$this->govattrs);
+    }
+
+    /* Load base attributes */
+    plugin::plugin ($config, $dn);
+
+    $this->orig_dn  = $this->dn;
+    $this->new_dn   = $dn;
+
+    if ($this->config->current['GOVERNMENTMODE']){
+      /* Fix public visible attribute if unset */
+      if (!isset($this->attrs['publicVisible'])){
+        $this->publicVisible == "nein";
+      }
+    }
+
+    /* Load government mode attributes */
+    if ($this->config->current['GOVERNMENTMODE']){
+      /* Copy all attributs */
+      foreach ($this->govattrs as $val){
+        if (isset($this->attrs["$val"][0])){
+          $this->$val= $this->attrs["$val"][0];
+        }
+      }
+    }
+
+    /* Create me for new accounts */
+    if ($dn == "new"){
+      $this->is_account= TRUE;
+    }
+
+    /* Make hash default to md5 if not set in config */
+    if (!isset($this->config->current['HASH'])){
+      $hash= "md5";
+    } else {
+      $hash= $this->config->current['HASH'];
+    }
+
+    /* Load data from LDAP? */
+    if ($dn !== NULL){
+
+      /* Do base conversation */
+      if ($this->dn == "new"){
+        $ui= get_userinfo();
+        $this->base= dn2base($ui->dn);
+      } else {
+        $this->base= dn2base($dn);
+      }
+
+      /* get password storage type */
+      if (isset ($this->attrs['userPassword'][0])){
+       /* Initialize local array */
+       $matches= array();
+        if (preg_match ("/^{([^}]+)}(.+)/", $this->attrs['userPassword'][0], $matches)){
+          $this->pw_storage= strtolower($matches[1]);
+        } else {
+          if ($this->attrs['userPassword'][0] != ""){
+            $this->pw_storage= "clear";
+          } else {
+            $this->pw_storage= $hash;
+          }
+        }
+      } else {
+        /* Preset with vaule from configuration */
+        $this->pw_storage= $hash;
+      }
+
+      /* Load extra attributes: certificate and picture */
+      $this->load_cert();
+      $this->load_picture();
+      if ($this->userCertificate != ""){
+        $this->had_userCertificate= TRUE;
+      }
+    }
+
+    /* Reset password storage indicator, used by password_change_needed() */
+    if ($dn == "new"){
+      $this->last_pw_storage= "unset";
+    } else {
+      $this->last_pw_storage= $this->pw_storage;
+    }
+
+    /* Generate dateOfBirth entry */
+    if (isset ($this->attrs['dateOfBirth'])){
+      /* This entry is ISO 8601 conform */
+      list($year, $month, $day)= split("-", $this->attrs['dateOfBirth'][0], 3);
+    
+      $this->dateOfBirth=array( 'mon'=> $month,"mday"=> $day,"year"=> $year);
+      $this->use_dob= "1";
+    } else {
+      $this->use_dob= "0";
+    }
+
+    /* Put gender attribute to upper case */
+    if (isset ($this->attrs['gender'])){
+      $this->gender= strtoupper($this->attrs['gender'][0]);
+    }
+    $this->orig_base = $this->base;
+  }
+
+
+
+
+  /* execute generates the html output for this node */
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* Log view */
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","users/".get_class($this),$this->dn);
+    }
+
+    $smarty= get_smarty();
+
+    /* Fill calendar */
+    if ($this->dateOfBirth == "0"){
+      $date= getdate();
+    } else {
+      if(is_array($this->dateOfBirth)){
+        $date = $this->dateOfBirth;
+  
+        // Trigger on dates like 1985-04-01, getdate only understands timestamps
+      } else if (!empty($this->dateOfBirth) && !is_numeric($this->dateOfBirth)){
+        $date= getdate(strtotime($this->dateOfBirth));
+
+      } else {
+        $date = getdate($this->dateOfBirth);
+      }
+    }
+
+    $days= array();
+    for($d= 1; $d<32; $d++){
+      $days[$d]= $d;
+    }
+    $years= array();
+
+    if(($date['year']-100)<1901){
+      $start = 1901;
+    }else{
+      $start = $date['year']-100;
+    }
+
+    $end = $start +100;
+    
+    for($y= $start; $y<=$end; $y++){
+      $years[]= $y;
+    }
+    $years['-']= "-&nbsp;";
+    $months= array(_("January"), _("February"), _("March"), _("April"),
+        _("May"), _("June"), _("July"), _("August"), _("September"),
+        _("October"), _("November"), _("December"), '-' => '-&nbsp;');
+    $smarty->assign("day", $date["mday"]);
+    $smarty->assign("days", $days);
+    $smarty->assign("months", $months);
+    $smarty->assign("month", $date["mon"]-1);
+    $smarty->assign("years", $years);
+    $smarty->assign("year", $date["year"]);
+
+    /* Assign sex */
+    $sex= array(0 => "&nbsp;", "F" => _("female"), "M" => _("male"));
+    $smarty->assign("gender_list", $sex);
+    $language= array_merge(array(0 => "&nbsp;") ,get_languages(TRUE));
+    $smarty->assign("preferredLanguage_list", $language);
+
+    /* Get random number for pictures */
+    srand((double)microtime()*1000000); 
+    $smarty->assign("rand", rand(0, 10000));
+
+
+    /* Do we represent a valid gosaAccount? */
+    if (!$this->is_account){
+      echo "<img alt=\"\" src=\"images/stop.png\" align=\"middle\">&nbsp;<b>".
+        _("This account has no valid GOsa extensions.")."</b>";
+      return;
+    }
+
+    /* Base select dialog */
+    $once = true;
+    foreach($_POST as $name => $value){
+      if(preg_match("/^chooseBase/",$name) && $once){
+        $once = false;
+        $this->dialog = new baseSelectDialog($this->config,$this,$this->allowedBasesToMoveTo());
+        $this->dialog->setCurrentBase($this->base);
+      }
+    }
+
+    /* Password configure dialog handling */
+    if(is_object($this->pwObject) && $this->pwObject->display){
+      $output= $this->pwObject->configure();
+      if ($output != ""){
+        $this->dialog= TRUE;
+        return $output;
+      }
+      $this->dialog= false;
+    }
+
+    /* Dialog handling */
+    if(is_object($this->dialog)){
+      /* Must be called before save_object */
+      $this->dialog->save_object();
+   
+      if($this->dialog->isClosed()){
+        $this->dialog = false;
+      }elseif($this->dialog->isSelected()){
+
+        /* check if selected base is allowed to move to / create a new object */
+        $tmp = $this->get_allowed_bases();
+        if(isset($tmp[$this->dialog->isSelected()])){
+          $this->base = $this->dialog->isSelected();
+        }
+        $this->dialog= false;
+      }else{
+        return($this->dialog->execute());
+      }
+    }
+
+    /* Want password method editing? */
+    if ($this->acl_is_writeable("userPassword")){
+      if (isset($_POST['edit_pw_method'])){
+        if (!is_object($this->pwObject) || $this->pw_storage != $this->pwObject->get_hash_name()){
+          $temp= passwordMethod::get_available_methods();
+          $this->pwObject= new $temp[$this->pw_storage]($this->config,$this->dn);
+        }
+        $this->pwObject->display = TRUE;
+        $this->dialog= TRUE;
+        return ($this->pwObject->configure());
+      }
+    }
+
+    /* Want picture edit dialog? */
+    if($this->acl_is_writeable("userPicture")) {
+      if (isset($_POST['edit_picture'])){
+        /* Save values for later recovery, in case some presses
+           the cancel button. */
+        $this->old_jpegPhoto= $this->jpegPhoto;
+        $this->old_photoData= $this->photoData;
+        $this->picture_dialog= TRUE;
+        $this->dialog= TRUE;
+      }
+    }
+
+    /* Remove picture? */
+    if($this->acl_is_writeable("userPicture",(!is_object($this->parent) && !isset($_SESSION['edit']))) ){
+      if (isset($_POST['picture_remove'])){
+        $this->set_picture ();
+        $this->jpegPhoto= "*removed*";
+        $this->is_modified= TRUE;
+        return($smarty->fetch (get_template_path('generic_picture.tpl', TRUE, dirname(__FILE__))));
+      }
+    }
+
+    /* Save picture */
+    if (isset($_POST['picture_edit_finish'])){
+
+      /* Check for clean upload */
+      if ($_FILES['picture_file']['name'] != ""){
+        if (!is_uploaded_file($_FILES['picture_file']['tmp_name'])) {
+          print_red(_("The specified file has not been uploaded via HTTP POST! Aborted."));
+        }else{
+          /* Activate new picture */
+          $this->set_picture($_FILES['picture_file']['tmp_name']);
+        }
+      }
+      $this->picture_dialog= FALSE;
+      $this->dialog= FALSE;
+      $this->is_modified= TRUE;
+    }
+
+
+    /* Cancel picture */
+    if (isset($_POST['picture_edit_cancel'])){
+
+      /* Restore values */
+      $this->jpegPhoto= $this->old_jpegPhoto;
+      $this->photoData= $this->old_photoData;
+
+      /* Update picture */
+      $_SESSION['binary']= $this->photoData;
+      $_SESSION['binarytype']= "image/jpeg";
+      $this->picture_dialog= FALSE;
+      $this->dialog= FALSE;
+    }
+
+    /* Toggle dateOfBirth information */
+    if (isset($_POST['set_dob'])){
+      $this->use_dob= ($this->use_dob == "0")?"1":"0";
+    }
+
+
+    /* Want certificate= */
+    if ((isset($_POST['edit_cert'])) && $this->acl_is_readable("Certificate")){
+
+      /* Save original values for later reconstruction */
+      foreach (array("certificateSerialNumber", "userCertificate",
+            "userSMIMECertificate", "userPKCS12") as $val){
+
+        $oval= "old_$val";
+        $this->$oval= $this->$val;
+      }
+
+      $this->cert_dialog= TRUE;
+      $this->dialog= TRUE;
+    }
+
+
+    /* Cancel certificate dialog */
+    if (isset($_POST['cert_edit_cancel'])){
+
+      /* Restore original values in case of 'cancel' */
+      foreach (array("certificateSerialNumber", "userCertificate",
+            "userSMIMECertificate", "userPKCS12") as $val){
+
+        $oval= "old_$val";
+        $this->$val= $this->$oval;
+      }
+      $this->cert_dialog= FALSE;
+      $this->dialog= FALSE;
+    }
+
+
+    /* Remove certificate? */
+    if($this->acl_is_writeable("Certificate",(!is_object($this->parent) && !isset($_SESSION['edit'])))){ 
+      foreach (array ("userCertificate", "userSMIMECertificate", "userPKCS12") as $val){
+        if (isset($_POST["remove_$val"])){
+
+          /* Reset specified cert*/
+          $this->$val= "";
+          $this->is_modified= TRUE;
+        }
+      }
+    }
+
+    /* Upload new cert and close dialog? */    
+    if($this->acl_is_writeable("Certificate",(!is_object($this->parent) && !isset($_SESSION['edit'])))){ 
+      if (isset($_POST['cert_edit_finish'])){
+
+        /* for all certificates do */
+        foreach (array ("userCertificate", "userSMIMECertificate", "userPKCS12")
+            as $val){
+
+          /* Check for clean upload */
+          if (array_key_exists($val."_file", $_FILES) &&
+              array_key_exists('name', $_FILES[$val."_file"]) &&
+              $_FILES[$val."_file"]['name'] != "" &&
+              is_uploaded_file($_FILES[$val."_file"]['tmp_name'])) {
+            $this->set_cert("$val", $_FILES[$val."_file"]['tmp_name']);
+          }
+        }
+
+        /* Save serial number */
+        if (isset($_POST["certificateSerialNumber"]) &&
+            $_POST["certificateSerialNumber"] != ""){
+
+          if (!is_id($_POST["certificateSerialNumber"])){
+            print_red (_("Please enter a valid serial number"));
+
+            foreach(array("userCertificate", "userSMIMECertificate", "userPKCS12") as $cert){
+              if ($this->$cert != ""){
+                $smarty->assign("$cert"."_state", "true");
+              } else {
+                $smarty->assign("$cert"."_state", "");
+              }
+            }
+            return ($smarty->fetch (get_template_path('generic_certs.tpl', TRUE, dirname(__FILE__))));
+          }
+
+          $this->certificateSerialNumber= $_POST["certificateSerialNumber"];
+          $this->is_modified= TRUE;
+        }
+
+        $this->cert_dialog= FALSE;
+        $this->dialog= FALSE;
+      }
+    }
+    /* Display picture dialog */
+    if ($this->picture_dialog){
+      return($smarty->fetch (get_template_path('generic_picture.tpl', TRUE, dirname(__FILE__))));
+    }
+
+    /* Display cert dialog */
+    if ($this->cert_dialog){
+      $smarty->assign("CertificateACL",$this->getacl("Certificate",(!is_object($this->parent) && !isset($_SESSION['edit']))));
+      $smarty->assign("Certificate_readable",$this->acl_is_readable("Certificate"));
+
+      foreach(array("userCertificate", "userSMIMECertificate", "userPKCS12") as $cert){
+        if ($this->$cert != ""){
+          /* import certificate */
+          $certificate = new certificate;
+          $certificate->import($this->$cert);
+      
+          /* Read out data*/
+          $timeto   = $certificate->getvalidto_date();
+          $timefrom = $certificate->getvalidfrom_date();
+         
+          
+          /* Additional info if start end time is '0' */
+          $add_str_info = "";
+          if($timeto == 0 && $timefrom == 0){
+            $add_str_info = "<br><i>"._("(Some types of certificates are currently not supported and may be displayed as 'invalid'.)")."</i>";
+          }
+
+          $str = "<table summary=\"\" border=0>
+                    <tr>
+                      <td style='vertical-align:top'>CN</td>
+                      <td>".preg_replace("/ /", "&nbsp;", $certificate->getname())."</td>
+                    </tr>
+                  </table><br>".
+
+                  sprintf(_("Certificate is valid from %s to %s and is currently %s."),
+                        "<b>".date('d M Y',$timefrom)."</b>",
+                        "<b>".date('d M Y',$timeto)."</b>",
+                        $certificate->isvalid()?"<b><font style='color:green'>"._("valid")."</font></b>":
+                                                "<b><font style='color:red'>"._("invalid")."</font></b>").$add_str_info;
+
+          $smarty->assign($cert."info",$str);
+          $smarty->assign($cert."_state","true");
+        } else {
+          $smarty->assign($cert."info", "<i>"._("No certificate installed")."</i>");
+          $smarty->assign($cert."_state","");
+        }
+      }
+      $smarty->assign("governmentmode", "false");
+      return($smarty->fetch (get_template_path('generic_certs.tpl', TRUE, dirname(__FILE__))));
+    }
+
+    /* Prepare password hashes */
+    if ($this->pw_storage == ""){
+      $this->pw_storage= $this->config->current['HASH'];
+    }
+
+    $temp= passwordMethod::get_available_methods();
+    $is_configurable= FALSE;
+    $hashes = $temp['name'];
+    if(isset($temp[$this->pw_storage])){
+      $test= new $temp[$this->pw_storage]($this->config);
+      $is_configurable= $test->is_configurable();
+    }else{
+      new msg_dialog(_("Password method"),_("The selected password method is no longer available."),WARNING_DIALOG);
+    }
+    
+    /* Load attributes and acl's */
+    $ui =get_userinfo();
+    foreach($this->attributes as $val){
+      $smarty->assign("$val", $this->$val);
+      if(in_array($val,$this->multi_boxes)){
+        $smarty->assign("use_".$val,TRUE);
+      }else{
+        $smarty->assign("use_".$val,FALSE);
+      }
+    }
+    foreach(array("base","pw_storage","edit_picture") as $val){
+      if(in_array($val,$this->multi_boxes)){
+        $smarty->assign("use_".$val,TRUE);
+      }else{
+        $smarty->assign("use_".$val,FALSE);
+      }
+    }
+
+    /* Set acls */
+    $tmp = $this->plinfo();
+    foreach($tmp['plProvidedAcls'] as $val => $translation){
+      $smarty->assign("$val"."ACL", $this->getacl($val,(!is_object($this->parent) && !isset($_SESSION['edit']))));
+    }
+
+    $smarty->assign("pwmode", $hashes);
+    $smarty->assign("pwmode_select", $this->pw_storage);
+    $smarty->assign("pw_configurable", $is_configurable);
+    $smarty->assign("passwordStorageACL", $this->getacl("userPassword",(!is_object($this->parent) && !isset($_SESSION['edit']))));
+    $smarty->assign("base_select",      $this->base);
+    $smarty->assign("CertificatesACL",  $this->getacl("Certificate",(!is_object($this->parent) && !isset($_SESSION['edit']))));
+    $smarty->assign("userPictureACL",   $this->getacl("userPicture",(!is_object($this->parent) && !isset($_SESSION['edit']))));
+    $smarty->assign("userPicture_is_readable",   $this->acl_is_readable("userPicture",(!is_object($this->parent) && !isset($_SESSION['edit']))));
+
+    /* Create base acls */
+    $tmp = @$this->allowedBasesToMoveTo();
+    $smarty->assign("bases", $tmp);
+
+    /* Save government mode attributes */
+    if (isset($this->config->current['GOVERNMENTMODE']) &&
+        preg_match('/true/i', $this->config->current['GOVERNMENTMODE'])){
+      $smarty->assign("governmentmode", "true");
+      $ivbbmodes= array("nein", "ivbv", "testa", "ivbv,testa", "internet",
+          "internet,ivbv", "internet,testa", "internet,ivbv,testa");
+      $smarty->assign("ivbbmodes", $ivbbmodes);
+      foreach ($this->govattrs as $val){
+        $smarty->assign("$val", $this->$val);
+        $smarty->assign("$val"."ACL", $this->getacl($val,(!is_object($this->parent) && !isset($_SESSION['edit']))));
+      }
+    } else {
+      $smarty->assign("governmentmode", "false");
+    }
+
+    /* Special mode for uid */
+    $uidACL= $this->getacl("uid",(!is_object($this->parent) && !isset($_SESSION['edit'])));
+    if (isset ($this->dn)){
+      if ($this->dn != "new"){
+        $uidACL= preg_replace("/w/","",$uidACL);
+      }
+    }  else {
+      $uidACL= preg_replace("/w/","",$uidACL);
+    }
+    
+    $smarty->assign("uidACL", $uidACL);
+    $smarty->assign("is_template", $this->is_template);
+    $smarty->assign("use_dob", $this->use_dob);
+
+    if (isset($this->parent)){
+      if (isset($this->parent->by_object['phoneAccount']) &&
+          $this->parent->by_object['phoneAccount']->is_account){
+        $smarty->assign("has_phoneaccount", "true");
+      } else {
+        $smarty->assign("has_phoneaccount", "false");
+      }
+    } else {
+      $smarty->assign("has_phoneaccount", "false");
+    }
+    $smarty->assign("multiple_support" , $this->multiple_support_active);
+    return($smarty->fetch (get_template_path('generic.tpl', TRUE, dirname(__FILE__))));
+  }
+
+
+  /* remove object from parent */
+  function remove_from_parent()
+  {
+    /* Remove password extension */
+    $temp= passwordMethod::get_available_methods();
+    $this->pwObject= new $temp[$this->pw_storage]($this->config,$this->dn);
+    $this->pwObject->remove_from_parent();
+
+    /* Remove user */
+    $ldap= $this->config->get_ldap_link();
+    $ldap->rmdir ($this->dn);
+    show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/generic account with dn '%s' failed."),$this->dn));
+  
+    new log("remove","users/".get_class($this),$this->dn,$this->attributes,$ldap->get_error());
+  
+    /* Delete references to groups */
+    $ldap->cd ($this->config->current['BASE']);
+    $ldap->search ("(&(objectClass=posixGroup)(memberUid=".$this->uid."))", array("uid"));
+    while ($ldap->fetch()){
+      $g= new group($this->config, $ldap->getDN());
+      $g->removeUser($this->uid);
+      $g->save ();
+    }
+
+    /* Delete references to object groups */
+    $ldap->cd ($this->config->current['BASE']);
+    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
+    while ($ldap->fetch()){
+      $og= new ogroup($this->config, $ldap->getDN());
+      unset($og->member[$this->dn]);
+      $og->save ();
+    }
+
+    /* If needed, let the password method do some cleanup */
+    $tmp = new passwordMethod($_SESSION['config']);
+    $available = $tmp->get_available_methods();
+    if (in_array_ics($this->pw_storage, $available['name'])){
+      $test= new $available[$this->pw_storage]($this->config);
+      $test->attrs= $this->attrs;
+      $test->dn= $this->dn;
+      $test->remove_from_parent();
+    }
+
+    /* Remove ACL dependencies too */
+    $tmp = new acl($this->config,$this->parent,$this->dn);
+    $tmp->remove_acl();
+
+    /* Optionally execute a command after we're done */
+    $this->handle_post_events("remove",array("uid" => $this->uid));
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    if(isset($_POST['generic']) || isset($_POST['multiple_user_posted'])){
+
+      /* Make a backup of the current selected base */
+      $base_tmp = $this->base;
+
+      /* Parents save function */
+      plugin::save_object ();
+
+      /* Save government mode attributes */
+      if ($this->config->current['GOVERNMENTMODE']){
+        foreach ($this->govattrs as $val){
+          if ($this->acl_is_writeable($val,(!is_object($this->parent) && !isset($_SESSION['edit']))) && isset($_POST["$val"])){
+            $data= stripcslashes($_POST["$val"]);
+            if ($data != $this->$val){
+              $this->is_modified= TRUE;
+            }
+            $this->$val= $data;
+          }
+        }
+      }
+
+      /* In template mode, the uid is autogenerated... */
+      if ($this->is_template){
+        $this->uid= strtolower($this->sn);
+        $this->givenName= $this->sn;
+      }
+
+      /* Save base and pw_storage, since these are no LDAP attributes */
+      if (isset($_POST['base'])){
+
+        $tmp = $this->get_allowed_bases();
+        if(isset($tmp[$_POST['base']])){
+          $base= validate($_POST['base']);
+          if ($base != $this->base){
+            $this->is_modified= TRUE;
+          }
+          $this->base= $base;
+        }else{
+          $this->base = $base_tmp;
+          print_red(sprintf(_("You are not allowed to move this object to '%s'."),LDAP::fix($_POST['base'])));
+          $this->set_acl_base('dummy,'.$this->base);
+        }
+      }
+
+      /* Get pw_storage mode */
+      if (isset($_POST['pw_storage'])){
+        foreach(array("pw_storage") as $val){
+          if(isset($_POST[$val])){
+            $data= validate($_POST[$val]);
+            if ($data != $this->$val){
+              $this->is_modified= TRUE;
+            }
+            $this->$val= $data;
+          }
+        }
+      }
+
+      $this->set_acl_base('dummy,'.$this->base);
+    }
+  }
+
+  function rebind($ldap, $referral)
+  {
+    $credentials= LDAP::get_credentials($referral, $this->config->current['REFERRAL']);
+    if (ldap_bind($ldap, $credentials['ADMIN'], $credentials['PASSWORD'])) {
+      $this->error = "Success";
+      $this->hascon=true;
+      $this->reconnect= true;
+      return (0);
+    } else {
+      $this->error = "Could not bind to " . $credentials['ADMIN'];
+      return NULL;
+    }
+  }
+
+  
+  /* Save data to LDAP, depending on is_account we save or delete */
+  function save()
+  {
+    /* Only force save of changes .... 
+       If this attributes aren't changed, avoid saving.
+     */
+    if($this->gender=="0") $this->gender ="";
+    if($this->preferredLanguage=="0") $this->preferredLanguage ="";
+
+    /* First use parents methods to do some basic fillup in $this->attrs */
+    plugin::save ();
+
+    if ($this->use_dob == "1"){
+      /* If it is an array, the generic page has never been loaded - so there's no difference. Using an array would cause an error btw. */
+      if(!is_array($this->attrs['dateOfBirth'])) {
+        $this->attrs['dateOfBirth'] = date("Y-m-d", $this->dateOfBirth);
+      }
+    }
+
+    /* Remove additional objectClasses */
+    $tmp= array();
+    foreach ($this->attrs['objectClass'] as $key => $set){
+      $found= false;
+      foreach (array("ivbbentry", "gosaUserTemplate") as $val){
+        if (preg_match ("/^$set$/i", $val)){
+          $found= true;
+          break;
+        }
+      }
+      if (!$found){
+        $tmp[]= $set;
+      }
+    }
+
+    /* Replace the objectClass array. This is done because of the
+       separation into government and normal mode. */
+    $this->attrs['objectClass']= $tmp;
+
+    /* Add objectClasss for template mode? */
+    if ($this->is_template){
+      $this->attrs['objectClass'][]= "gosaUserTemplate";
+    }
+
+    /* Hard coded government mode? */
+    if ($this->config->current['GOVERNMENTMODE'] != 'false'){
+      $this->attrs['objectClass'][]= "ivbbentry";
+
+      /* Copy standard attributes */
+      foreach ($this->govattrs as $val){
+        if ($this->$val != ""){
+          $this->attrs["$val"]= $this->$val;
+        } elseif (!$this->is_new) {
+          $this->attrs["$val"]= array();
+        }
+      }
+
+      /* Remove attribute if set to "nein" */
+      if ($this->publicVisible == "nein"){
+        $this->attrs['publicVisible']= array();
+        if($this->is_new){
+          unset($this->attrs['publicVisible']);
+        }else{
+          $this->attrs['publicVisible']=array();
+        }
+
+      }
+
+    }
+
+    /* Special handling for attribute userCertificate needed */
+    if ($this->userCertificate != ""){
+      $this->attrs["userCertificate;binary"]= $this->userCertificate;
+      $remove_userCertificate= false;
+    } else {
+      $remove_userCertificate= true;
+    }
+
+    /* Special handling for dateOfBirth value */
+    if ($this->use_dob != "1"){
+      if ($this->is_new) {
+        unset($this->attrs["dateOfBirth"]);
+      } else {
+        $this->attrs["dateOfBirth"]= array();
+      }
+    }
+    if (!$this->gender){
+      if ($this->is_new) {
+        unset($this->attrs["gender"]);
+      } else {
+        $this->attrs["gender"]= array();
+      }
+    }
+    if (!$this->preferredLanguage){
+      if ($this->is_new) {
+        unset($this->attrs["preferredLanguage"]);
+      } else {
+        $this->attrs["preferredLanguage"]= array();
+      }
+    }
+
+    /* Special handling for attribute jpegPhote needed, scale image via
+       image magick to 147x200 pixels and inject resulting data. */
+    if ($this->jpegPhoto == "*removed*"){
+    
+      /* Reset attribute to avoid writing *removed* as value */    
+      $this->attrs["jpegPhoto"] = array();
+
+    } else {
+
+      /* Fallback if there's no image magick inside PHP */
+      if (!function_exists("imagick_blob2image")){
+        /* Get temporary file name for conversation */
+        $fname = tempnam ("/tmp", "GOsa");
+  
+        /* Open file and write out photoData */
+        $fp = fopen ($fname, "w");
+        fwrite ($fp, $this->photoData);
+        fclose ($fp);
+
+        /* Build conversation query. Filename is generated automatically, so
+           we do not need any special security checks. Exec command and save
+           output. For PHP safe mode, you'll need a configuration which respects
+           image magick as executable... */
+        $query= "convert -size 147x200 $fname -resize 147x200 +profile \"*\" -";
+        @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__,
+            $query, "Execute");
+  
+        /* Read data written by convert */
+        $output= "";
+        $sh= popen($query, 'r');
+        while (!feof($sh)){
+          $output.= fread($sh, 4096);
+        }
+        pclose($sh);
+
+        unlink($fname);
+
+        /* Save attribute */
+        $this->attrs["jpegPhoto"] = $output;
+
+      } else {
+
+        /* Load the new uploaded Photo */
+        if(!$handle  =  imagick_blob2image($this->photoData))  {
+          new log("debug","users/".get_class($this),$this->dn,array(),"Could not access uploaded image");
+        }
+
+        /* Resizing image to 147x200 and blur */
+        if(!imagick_resize($handle,147,200,IMAGICK_FILTER_GAUSSIAN,0)){
+          new log("debug","users/".get_class($this),$this->dn,array(),"Could not resize uploaded image");
+        }
+
+        /* Converting image to JPEG */
+        if(!imagick_convert($handle,"JPEG")) {
+          new log("debug","users/".get_class($this),$this->dn,array(),"Could not convert uploaded image to jepg");
+        }
+
+        /* Creating binary Code for the Image */
+        if(!$dump = imagick_image2blob($handle)){
+          new log("debug","users/".get_class($this),$this->dn,array(),"Could not create new user image");
+        }
+
+        /* Sending Image */
+        $output=  $dump;
+
+        /* Save attribute */
+        $this->attrs["jpegPhoto"] = $output;
+      }
+
+    }
+
+    /* This only gets called when user is renaming himself */
+    $ldap= $this->config->get_ldap_link();
+    if ($this->dn != $this->new_dn){
+
+      /* Write entry on new 'dn' */
+      $this->update_acls($this->dn,$this->new_dn);
+      $this->move($this->dn, $this->new_dn);
+
+      /* Happen to use the new one */
+      change_ui_dn($this->dn, $this->new_dn);
+      $this->dn= $this->new_dn;
+    }
+
+
+    /* Save data. Using 'modify' implies that the entry is already present, use 'add' for
+       new entries. So do a check first... */
+    $ldap->cat ($this->dn, array('dn'));
+    if ($ldap->fetch()){
+      $mode= "modify";
+    } else {
+      $mode= "add";
+      $ldap->cd($this->config->current['BASE']);
+      $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
+    }
+
+    /* Set password to some junk stuff in case of templates */
+    if ($this->is_template){
+      $this->attrs['userPassword']= '{crypt}N0T$3T4N0W';
+    }
+
+    @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
+        $this->attributes, "Save via $mode");
+
+    /* Finally write data with selected 'mode' */
+    $this->cleanup();
+
+    if(isset($this->attrs['preferredLanguage'])){
+      $_SESSION['ui']->language = $this->preferredLanguage;
+      $_SESSION['Last_init_lang'] = "update";
+    }
+
+    $ldap->cd ($this->dn);
+    $ldap->$mode ($this->attrs);
+    if (show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/generic account with dn '%s' failed."),$this->dn))){
+      return (1);
+    }
+
+    /* Remove ACL dependencies too */
+    if($this->dn != $this->orig_dn && $this->orig_dn != "new"){
+      $tmp = new acl($this->config,$this->parent,$this->dn);
+      $tmp->update_acl_membership($this->orig_dn,$this->dn);
+    }
+
+    if($mode == "modify"){
+      new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
+
+    /* Remove cert? 
+       For some reason, the 'ldap' class doesn't want to remove binary entries, so I need
+       to work around myself. */
+    if ($remove_userCertificate == true && !$this->is_new && $this->had_userCertificate){
+
+      /* Reset array, assemble new, this should be reworked */
+      $this->attrs= array();
+      $this->attrs['userCertificate;binary']= array();
+
+      /* Prepare connection */
+      if (!($ds = ldap_connect($this->config->current['SERVER']))) {
+        die ("Could not connect to LDAP server");
+      }
+      ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
+      if (function_exists("ldap_set_rebind_proc") && isset($this->config->current['RECURSIVE']) && $this->config->current['RECURSIVE'] == "true") {
+        ldap_set_option($this->cid, LDAP_OPT_REFERRALS, 1);
+        ldap_set_rebind_proc($ds, array(&$this, "rebind"));
+      }
+      if(isset($config->current['TLS']) && $config->current['TLS'] == "true"){
+        ldap_start_tls($ds);
+      }
+      if (!($res = @ldap_bind($ds, $this->config->current['ADMIN'],
+              $this->config->current['PASSWORD']))) {
+        die ("Could not bind to LDAP");
+      }
+
+      /* Modify using attrs */
+      ldap_mod_del($ds,$this->dn,$this->attrs);
+      ldap_close($ds);
+    }
+
+    /* If needed, let the password method do some cleanup */
+    if ($this->pw_storage != $this->last_pw_storage){
+      $tmp = new passwordMethod($_SESSION['config']);
+      $available = $tmp->get_available_methods();
+      if (in_array_ics($this->last_pw_storage, $available['name'])){
+        $test= new $available[$this->last_pw_storage]($this->config,$this->dn);
+        $test->attrs= $this->attrs;
+        $test->remove_from_parent();
+      }
+    }
+
+    /* Maybe the current password method want's to do some changes... */
+    if (is_object($this->pwObject)){
+      $this->pwObject->save($this->dn);
+    }
+
+    /* Optionally execute a command after we're done */
+    if ($mode == "add"){
+      $this->handle_post_events("add", array("uid" => $this->uid));
+    } elseif ($this->is_modified){
+      $this->handle_post_events("modify", array("uid" => $this->uid));
+    }
+
+    /* Fix tagging if needed */
+    $this->handle_object_tagging();
+
+    return (0);
+  }
+
+  
+  function update_new_dn()
+  {
+    $pt= "";
+    if(isset($this->config->current['INCLUDE_PERSONAL_TITLE']) && preg_match("/true/i",$this->config->current['INCLUDE_PERSONAL_TITLE'])){
+      if(!empty($this->personalTitle)){
+        $pt = $this->personalTitle." ";
+      }
+    }
+    $this->cn= $pt.$this->givenName." ".$this->sn;
+
+    /* Permissions for that base? */
+    if (isset($this->config->current['DNMODE']) && $this->config->current['DNMODE'] == "uid"){
+      $this->new_dn= 'uid='.$this->uid.','.get_people_ou().$this->base;
+    } else {
+      /* Don't touch dn, if cn hasn't changed */
+      if (isset($this->saved_attributes['cn']) && $this->saved_attributes['cn'] == $this->cn &&
+          $this->orig_base == $this->base ){
+        $this->new_dn= $this->dn;
+      } else {
+        $this->new_dn= $this->create_unique_dn('cn', get_people_ou().$this->base);
+      }
+    }
+  }
+  
+
+  /* Check formular input */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    $this->update_new_dn();
+
+    /* Set the new acl base */
+    if($this->dn == "new") {
+      $this->set_acl_base($this->base);
+    }
+
+    /* UID already used? */
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(uid=$this->uid)", array("uid"));
+    $ldap->fetch();
+    if ($ldap->count() != 0 && $this->dn == 'new'){
+      $message[]= _("There's already a person with this 'Login' in the database.");
+    }
+
+    /* In template mode, the uid and givenName are autogenerated... */
+    if (!$this->is_template){
+      if ($this->sn == ""){
+        $message[]= _("The required field 'Name' is not set.");
+      }
+      if ($this->givenName == ""){
+        $message[]= _("The required field 'Given name' is not set.");
+      }
+      if ($this->uid == ""){
+        $message[]= _("The required field 'Login' is not set.");
+      }
+      if (!(isset($this->config->current['DNMODE']) && $this->config->current['DNMODE'] == "uid")){
+        $ldap->cat($this->new_dn);
+        if ($ldap->count() != 0 && $this->dn != $this->new_dn && $this->dn == 'new'){
+          $message[]= _("There's already a person with this 'Name'/'Given name' combination in the database.");
+        }
+      }
+    }
+
+    /* Check for valid input */
+    if ($this->is_modified && !is_uid($this->uid)){
+      $message[]= _("The field 'Login' contains invalid characters. Lowercase, numbers and dashes are allowed.");
+    }
+    if (!is_url($this->labeledURI)){
+      $message[]= _("The field 'Homepage' contains an invalid URL definition.");
+    }
+    if (preg_match ("/[\\\\]/", $this->sn)){
+      $message[]= _("The field 'Name' contains invalid characters.");
+    }
+    if (preg_match ("/[\\\\]/", $this->givenName)){
+      $message[]= _("The field 'Given name' contains invalid characters.");
+    }
+
+    /* Check phone numbers */
+    if (!is_phone_nr($this->telephoneNumber)){
+      $message[]= _("The field 'Phone' contains an invalid phone number.");
+    }
+    if (!is_phone_nr($this->facsimileTelephoneNumber)){
+      $message[]= _("The field 'Fax' contains an invalid phone number.");
+    }
+    if (!is_phone_nr($this->mobile)){
+      $message[]= _("The field 'Mobile' contains an invalid phone number.");
+    }
+    if (!is_phone_nr($this->pager)){
+      $message[]= _("The field 'Pager' contains an invalid phone number.");
+    }
+
+    /* Check for reserved characers */
+    if (preg_match ('/[,+"?\'()=<>;]/', $this->givenName)){
+      $message[]= _("The field 'Given name' contains invalid characters.");
+  }
+  if (preg_match ('/[,+"?\'()=<>;]/', $this->sn)){
+    $message[]= _("The field 'Name' contains invalid characters.");
+  }
+
+  return $message;
+  }
+
+
+  /* Indicate whether a password change is needed or not */
+  function password_change_needed()
+  {
+    if(in_array("pw_storage",$this->multi_boxes)){
+      return(TRUE);
+    }
+    return($this->pw_storage != $this->last_pw_storage);
+  }
+
+
+  /* Load a jpegPhoto from LDAP, this is going to be simplified later on */
+  function load_picture()
+  {
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd ($this->dn);
+    $data = $ldap->get_attribute($this->dn,"jpegPhoto");
+
+    if((!$data) || ($data == "*removed*")){ 
+
+      /* In case we don't get an entry, load a default picture */
+      $this->set_picture ();//"./images/default.jpg");
+      $this->jpegPhoto= "*removed*";
+    }else{
+
+      /* Set picture */
+      $this->photoData= $data;
+      $_SESSION['binary']= $this->photoData;
+      $_SESSION['binarytype']= "image/jpeg";
+      $this->jpegPhoto= "";
+    }
+  }
+
+
+  /* Load a certificate from LDAP, this is going to be simplified later on */
+  function load_cert()
+  {
+    $ds= ldap_connect($this->config->current['SERVER']);
+    ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
+    if (function_exists("ldap_set_rebind_proc") && isset($this->config->current['RECURSIVE']) && $this->config->current['RECURSIVE'] == "true") {
+      ldap_set_option($this->cid, LDAP_OPT_REFERRALS, 1);
+      ldap_set_rebind_proc($ds, array(&$this, "rebind"));
+    }
+    if(isset($this->config->current['TLS']) &&
+        $this->config->current['TLS'] == "true"){
+
+      ldap_start_tls($ds);
+    }
+
+    $r= ldap_bind($ds);
+    $sr= @ldap_read($ds, $this->dn, "userCertificate=*", array("userCertificate"));
+
+    if ($sr) {
+      $ei= @ldap_first_entry($ds, $sr);
+      
+      if ($ei) {
+        if (!$info = @ldap_get_values_len($ds, $ei, "userCertificate;binary")){
+          $this->userCertificate= "";
+        } else {
+          $this->userCertificate= $info[0];
+        }
+      }
+    } else {
+      $this->userCertificate= "";
+    }
+
+    ldap_unbind($ds);
+  }
+
+
+  /* Load picture from file to object */
+  function set_picture($filename ="")
+  {
+    if (!is_file($filename) || $filename =="" ){
+      $filename= "./images/default.jpg";
+      $this->jpegPhoto= "*removed*";
+    }
+
+    $fd = fopen ($filename, "rb");
+    $this->photoData= fread ($fd, filesize ($filename));
+    $_SESSION['binary']= $this->photoData;
+    $_SESSION['binarytype']= "image/jpeg";
+    $this->jpegPhoto= "";
+
+    fclose ($fd);
+  }
+
+
+  /* Load certificate from file to object */
+  function set_cert($cert, $filename)
+  {
+    if(!$thsi->acl_is_writeable("Certificate",(!is_object($this->parent) && !isset($_SESSION['edit'])))) return;
+    $fd = fopen ($filename, "rb");
+    if (filesize($filename)>0) {
+      $this->$cert= fread ($fd, filesize ($filename));
+      fclose ($fd);
+      $this->is_modified= TRUE;
+    } else {
+      print_red(_("Could not open specified certificate!"));
+    }
+  }
+
+  /* Adapt from given 'dn' */
+  function adapt_from_template($dn)
+  {
+    plugin::adapt_from_template($dn);
+
+    /* Get base */
+    $this->base= preg_replace('/^[^,]+,'.get_people_ou().'/i', '', $dn);
+
+    if ($this->config->current['GOVERNMENTMODE']){
+
+      /* Walk through govattrs */
+      foreach ($this->govattrs as $val){
+
+        if (isset($this->attrs["$val"][0])){
+
+          /* If attribute is set, replace dynamic parts: 
+             %sn, %givenName and %uid. Fill these in our local variables. */
+          $value= $this->attrs["$val"][0];
+
+          foreach (array("sn", "givenName", "uid") as $repl){
+            if (preg_match("/%$repl/i", $value)){
+              $value= preg_replace ("/%$repl/i",
+                  $this->parent->$repl, $value);
+            }
+          }
+          $this->$val= $value;
+        }
+      }
+    }
+
+    /* Get back uid/sn/givenName */
+    if ($this->parent !== NULL){
+      $this->uid= $this->parent->uid;
+      $this->sn= $this->parent->sn;
+      $this->givenName= $this->parent->givenName;
+    }
+  }
+
+  /* This avoids that users move themselves out of their rights. 
+   */
+  function allowedBasesToMoveTo()
+  {
+    /* Get bases */
+    $bases  = $this->get_allowed_bases();
+    return($bases);
+  } 
+
+
+  function getCopyDialog()
+  {
+    $str = "";
+
+    $_SESSION['binary'] = $this->photoData; 
+    $_SESSION['binarytype']= "image/jpeg";
+
+    /* Get random number for pictures */
+    srand((double)microtime()*1000000); 
+    $rand = rand(0, 10000);
+
+    $smarty = get_smarty();
+
+    $smarty->assign("passwordTodo","clear");
+
+    if(isset($_POST['passwordTodo'])){
+      $smarty->assign("passwordTodo",$_POST['passwordTodo']);
+    }
+
+    $smarty->assign("sn",       $this->sn);
+    $smarty->assign("givenName",$this->givenName);
+    $smarty->assign("uid",      $this->uid);
+    $smarty->assign("rand",     $rand);
+    $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE,dirname(__FILE__)));
+
+
+    $ret = array();
+    $ret['string'] = $str;
+    $ret['status'] = "";  
+    return($ret);
+  }
+
+  function saveCopyDialog()
+  {
+    /* Set_acl_base */
+    $this->set_acl_base("cn=dummy,".get_people_ou().$this->base);
+
+    if((isset($_FILES['picture_file']['tmp_name'])) && ($_FILES['picture_file']['size'] > 0)){
+      $this->set_picture($_FILES['picture_file']['tmp_name']);
+    }
+
+    /* Remove picture? */
+    if (isset($_POST['picture_remove'])){
+      $this->jpegPhoto= "*removed*";
+      $this->set_picture ("./images/default.jpg");
+      $this->is_modified= TRUE;
+    }
+
+    $attrs = array("uid","givenName","sn");
+    foreach($attrs as $attr){
+      if(isset($_POST[$attr])){
+        $this->$attr = $_POST[$attr];
+      }
+    } 
+  }
+
+
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);
+
+    /* Reset certificate information addepted from source user
+       to avoid setting the same user certificate for the destination user. */
+    $this->userPKCS12= "";
+    $this->userSMIMECertificate= "";
+    $this->userCertificate= "";
+    $this->certificateSerialNumber= "";
+    $this->old_certificateSerialNumber= "";
+    $this->old_userPKCS12= "";
+    $this->old_userSMIMECertificate= "";
+    $this->old_userCertificate= "";
+  }
+
+
+  static function plInfo()
+  {
+  
+    $govattrs= array(
+        "gouvernmentOrganizationalUnit"             =>  _("Unit"), 
+        "houseIdentifier"                           =>  _("House identifier"), 
+        "vocation"                                  =>  _("Vocation"),
+        "ivbbLastDeliveryCollective"                =>  _("Last delivery"), 
+        "gouvernmentOrganizationalPersonLocality"   =>  _("Person locality"),
+        "gouvernmentOrganizationalUnitDescription"  =>  _("Unit description"),
+        "gouvernmentOrganizationalUnitSubjectArea"  =>  _("Subject area"),
+        "functionalTitle"                           =>  _("Functional title"),
+        "certificateSerialNumber"                   =>  _("Certificate serial number"),
+        "publicVisible"                             =>  _("Public visible"),
+        "street"                                    =>  _("Street"),
+        "role"                                      =>  _("Role"),
+        "postalCode"                                =>  _("Postal code"));
+
+    $ret = array(
+        "plShortName" => _("Generic"),
+        "plDescription" => _("Generic user settings"),
+        "plSelfModify"  => TRUE,
+        "plDepends"     => array(),
+        "plPriority"    => 1,
+        "plSection"     => array("personal" => _("My account")),
+        "plCategory"    => array("users" => array("description" => _("Users"),
+                                                  "objectClass" => "gosaAccount")),
+
+        "plProvidedAcls" => array(
+          "base"              => _("Base"), 
+          "userPassword"      => _("User password"), 
+          "sn"                => _("Surename"),
+          "givenName"         => _("Given name"),
+          "uid"               => _("User identification"),
+          "personalTitle"     => _("Personal title"),
+          "academicTitle"     => _("Academic title"),
+          "homePostalAddress" => _("Home postal address"),
+          "homePhone"         => _("Home phone number"),
+          "labeledURI"        => _("Homepage"),
+          "o"                 => _("Organization"),
+          "ou"                => _("Department"),
+          "dateOfBirth"       => _("Date of birth"),
+          "gender"            => _("Gender"),
+          "preferredLanguage" => _("Preferred language"),
+          "departmentNumber"  => _("Department number"),
+          "employeeNumber"    => _("Employee number"),
+          "employeeType"      => _("Employee type"),
+          "l"                 => _("Location"),
+          "st"                => _("State"),
+          "userPicture"       => _("User picture"),
+          "roomNumber"        => _("Room number"),
+          "telephoneNumber"   => _("Telefon number"),
+          "mobile"            => _("Mobile number"),
+          "pager"             => _("Pager number"),
+          "Certificate"        => _("User certificates"),
+
+          "postalAddress"                => _("Postal address"),
+          "facsimileTelephoneNumber"     => _("Fax number"))
+        );
+
+    /* Append government attributes if required */
+      global $config;
+    if (isset($config->current['GOVERNMENTMODE']) &&  preg_match('/true/i', $config->current['GOVERNMENTMODE'])){
+      foreach($govattrs as $attr => $desc){
+        $ret["plProvidedAcls"][$attr] = $desc;
+      }
+    }
+    return($ret);
+  }
+
+  function get_multi_edit_values()
+  {
+    $ret = plugin::get_multi_edit_values();
+    if(in_array("pw_storage",$this->multi_boxes)){
+      $ret['pw_storage'] = $this->pw_storage;
+    }
+    if(in_array("edit_picture",$this->multi_boxes)){
+      $ret['jpegPhoto'] = $this->jpegPhoto;
+      $ret['photoData'] = $this->photoData;
+      $ret['old_jpegPhoto'] = $this->old_jpegPhoto;
+      $ret['old_photoData'] = $this->old_photoData;
+    }
+    if(isset($ret['dateOfBirth'])){
+      unset($ret['dateOfBirth']);
+    }
+    if(isset($ret['cn'])){
+      unset($ret['cn']);
+    }
+    $ret['is_modified'] = $this->is_modified;
+    if(in_array("base",$this->multi_boxes)){
+      $ret['orig_base']="Changed_by_Multi_Plug";
+      $ret['base']=$this->base;
+    }
+    return($ret); 
+  }
+
+
+  function multiple_save_object()
+  {
+    plugin::multiple_save_object();
+
+    /* Get pw_storage mode */
+    if (isset($_POST['pw_storage'])){
+      foreach(array("pw_storage") as $val){
+        if(isset($_POST[$val])){
+          $data= validate(get_post($val));
+          if ($data != $this->$val){
+            $this->is_modified= TRUE;
+          }
+          $this->$val= $data;
+        }
+      }
+    }
+    if(isset($_POST['base'])){
+      $this->base = get_post('base');
+    }
+
+    if(isset($_POST['user_mulitple_edit'])){
+      foreach(array("base","pw_storage","edit_picture") as $val){
+        if(isset($_POST["use_".$val])){
+          $this->multi_boxes[] = $val;
+        }
+      }
+    }
+  }
+
+  
+  function multiple_check()
+  {
+    /* Call check() to set new_dn correctly ... */
+    $message = plugin::multiple_check();
+
+    /* Set the new acl base */
+    if($this->dn == "new") {
+      $this->set_acl_base($this->base);
+    }
+    if (!is_url($this->labeledURI) && in_array("labeledURI",$this->multi_boxes)){
+      $message[]= _("The field 'Homepage' contains an invalid URL definition.");
+    }
+    if (preg_match ("/[\\\\]/", $this->sn) && in_array("sn",$this->multi_boxes)){
+      $message[]= _("The field 'Name' contains invalid characters.");
+    }
+    if (preg_match ("/[\\\\]/", $this->givenName) && in_array("givenName",$this->multi_boxes)){
+      $message[]= _("The field 'Given name' contains invalid characters.");
+    }
+    if (!is_phone_nr($this->telephoneNumber) && in_array("telephoneNumber",$this->multi_boxes)){
+      $message[]= _("The field 'Phone' contains an invalid phone number.");
+    }
+    if (!is_phone_nr($this->facsimileTelephoneNumber) &&  in_array("facsimileTelephoneNumber",$this->multi_boxes)){
+      $message[]= _("The field 'Fax' contains an invalid phone number.");
+    }
+    if (!is_phone_nr($this->mobile) && in_array("mobile",$this->multi_boxes)){
+      $message[]= _("The field 'Mobile' contains an invalid phone number.");
+    }
+    if (!is_phone_nr($this->pager) && in_array("pager",$this->multi_boxes)){
+      $message[]= _("The field 'Pager' contains an invalid phone number.");
+    }
+    if (preg_match ('/[,+"?\'()=<>;]/', $this->givenName) && in_array("givenName",$this->multi_boxes)){
+      $message[]= _("The field 'Given name' contains invalid characters.");
+    }
+    if (preg_match ('/[,+"?\'()=<>;]/', $this->sn) && in_array("sn",$this->multi_boxes)){
+      $message[]= _("The field 'Name' contains invalid characters.");
+    }
+    return($message);
+  }
+
+
+
+  function multiple_execute()
+  {
+    return($this->execute());
+  }
+
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/personal/generic/generic.tpl b/gosa-core/plugins/personal/generic/generic.tpl
new file mode 100644 (file)
index 0000000..1127e94
--- /dev/null
@@ -0,0 +1,568 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding="4" border="0">
+
+ <!-- Headline container -->
+ <tr>
+  <td colspan="4">
+   <h2><img alt="" align="middle" src="images/head.png" class="center"> {t}Personal information{/t}</h2>
+  </td>
+ </tr>
+
+ <!-- Base 1 container -->
+ <tr>
+
+  <!-- Image container -->
+       <!-- Image container -->
+       <td style="vertical-align:top">
+         <table>
+          <tr>
+               <td width="147" height="200" bgcolor="gray">
+               {if !$userPicture_is_readable}
+                       <img class='center' border="0" width="100%" src="images/default.jpg" alt="{t}Personal picture{/t}">
+               {else}
+                       <img class='center' border="0" width="100%" src="getbin.php?rand={$rand}" alt="{t}Personal picture{/t}">
+               {/if}
+               </td>
+          </tr>
+          <tr>
+               <td>
+{render acl=$userPictureACL checkbox=$multiple_support checked=$use_edit_picture}
+                       <input style='vertical-align:top;' type="submit" name="edit_picture" value="{t}Change picture{/t}...">
+{/render}
+               </td>
+          </tr>
+         </table>
+       </td>
+       <!--
+       Old image container, with incorrect image scaling.
+  <td style="vertical-align:top">
+   <img align="bottom" border="1" width="145" height="200" src="getbin.php?rand={$rand}" alt="{t}Personal picture{/t}">
+   <br>
+   <input type="submit" name="edit_picture" value="{t}Change picture{/t}...">
+  </td>
+       -->
+
+  <!-- Name, ... -->
+  <td style="vertical-align:top;">
+   <table summary=""> 
+    {if $is_template ne "true"}
+    <tr>
+     <td><label for="sn">{t}Last name{/t}{$must}</label></td>
+     <td>
+{if $multiple_support}
+        <input id="sn" name="dummy2" size=25 maxlength=60 value="{t}Multiple edit{/t}" disabled>
+{else}
+{render acl=$snACL}
+        <input id="sn" name="sn" size=25 maxlength=60 value="{$sn}">
+{/render}
+{/if}
+        </td>
+    </tr>
+    {else}
+    <tr>
+     <td><label for="sn">{t}Template name{/t}{$must}</label></td>
+     <td>{render acl=$snACL}<input id="sn" name="sn" size=25 maxlength=60 value="{$sn}">{/render}</td>
+    </tr>
+    {/if}
+
+    {if $is_template ne "true"}
+    <tr>
+     <td><label for="givenName">{t}First name{/t}{$must}</label></td>
+     <td>
+
+{if $multiple_support}
+        <input id="givenName" name="dummy3" size=25 maxlength=60 value="{t}Multiple edit{/t}" disabled>
+{else}
+{render acl=$givenNameACL}
+        <input id="givenName" name="givenName" size=25 maxlength=60 value="{$givenName}">
+{/render}
+{/if}
+        </td>
+    </tr>
+    <tr>
+     <td><label for="uid">{t}Login{/t}{$must}</label></td>
+     <td>
+               {if !$multiple_support}
+{render acl=$uidACL}
+                       <input id="uid" name="uid" size=25 maxlength=60  value="{$uid}">
+{/render}
+               {else}
+                       <input id="uid" name="dummy1" size=25 maxlength=60  value="{t}Multiple edit{/t}" disabled>
+               {/if}
+        </td>
+    </tr>
+    {/if}
+      
+    <tr>
+     <td>
+      <div style="height:10px;"></div>
+      <label for="personalTitle">{t}Personal title{/t}</label>
+     </td>
+     <td>
+      <div style="height:10px;"></div>
+{render acl=$personalTitleACL checkbox=$multiple_support checked=$use_personalTitle}
+               <input id="personalTitle" name="personalTitle" size=25 maxlength=60 value="{$personalTitle}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><label for="academicTitle">{t}Academic title{/t}</label></td>
+     <td>
+{render acl=$academicTitleACL checkbox=$multiple_support checked=$use_academicTitle}
+             <input id="academicTitle" name="academicTitle" size=25 maxlength=60 value="{$academicTitle}">
+{/render}
+     </td>
+    </tr>
+{if !$multiple_support}
+    <tr>
+     <td>
+      <div style="height:10px;"></div>
+      <label for="day">{t}Date of birth{/t}</label>
+     </td>
+     <td>
+      <div style="height:10px;"></div>
+{render acl=$dateOfBirthACL}
+             {if $use_dob eq 1}
+             <select id="day" name=day onChange="createResult(this.form,this.form.dateOfBirth);"> 
+              {html_options values=$days output=$days selected=$day}
+             </select>
+             <select name=month onChange="populate(this.form,this.form.dateOfBirth);" >
+              {html_options options=$months selected=$month}
+             </select>
+             <select name=year onChange="populate(this.form,this.form.dateOfBirth);" >
+              {html_options values=$years output=$years selected=$year}
+             </select>
+             <input type="hidden" name="dateOfBirth" value="{$dateOfBirth}">
+             <input type="submit" name="set_dob" value="-" >
+             {else}
+             <input type="submit" name="set_dob" value="{t}Set{/t}" >
+             {/if}
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td>
+      <label for="gender">{t}Sex{/t}</label>
+     </td>
+     <td>
+{render acl=$genderACL}
+             <select size="1" id="gender" name="gender">
+              {html_options options=$gender_list selected=$gender}
+             </select>
+{/render}
+     </td>
+    </tr>
+{/if}
+    <tr>
+     <td>
+      <label for="preferredLanguage">{t}Preferred langage{/t}</label>
+     </td>
+     <td>
+{render acl=$preferredLanguageACL checkbox=$multiple_support checked=$use_preferredLanguage}
+             <select size="1" id="preferredLanguage" name="preferredLanguage">
+              {html_options options=$preferredLanguage_list selected=$preferredLanguage}
+             </select>
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td>
+      <div style="height:10px;"></div>
+      <label for="base">{t}Base{/t}</label>
+     </td>
+     <td>
+      <div style="height:10px;"></div>
+{render acl=$baseACL checkbox=$multiple_support checked=$use_base}
+               <select id="base" size="1" name="base" title="{t}Choose subtree to place user in{/t}">
+                       {html_options options=$bases selected=$base_select}
+               </select>
+{/render}
+{render acl=$baseACL disable_picture='images/folder_gray.png'}
+               <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
+{/render}
+     </td>
+    </tr>
+   </table>
+  </td>
+  <td style="border-left:1px solid #A0A0A0">
+   &nbsp;
+  </td>
+  <td style="vertical-align:top;">
+
+   <!-- Address, ... -->
+   <table summary="" style="width:100%"> 
+    <tr>
+     <td style="vertical-align:top;"><label for="homePostalAddress">{t}Address{/t}</label></td>
+      <td>
+{render acl=$homePostalAddressACL checkbox=$multiple_support checked=$use_homePostalAddress}
+            <textarea id="homePostalAddress" name="homePostalAddress" rows="3" style="width:100%">{$homePostalAddress}</textarea>
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><label for="homePhone">{t}Private phone{/t}</label>
+     </td><td>
+{render acl=$homePhoneACL checkbox=$multiple_support checked=$use_homePhone}
+            <input id="homePhone" name="homePhone" size=25 maxlength=60 value="{$homePhone}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><label for="labeledURI">{t}Homepage{/t}</label></td>
+     <td>
+{render acl=$labeledURIACL checkbox=$multiple_support checked=$use_labeledURI}
+               <input id="labeledURI" name="labeledURI" size=25 maxlength=60 value="{$labeledURI}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td colspan=2>
+      <div style="height:20px;"></div>
+     </td>
+    </tr>
+    <tr>
+     <td><label for="pw_storage">{t}Password storage{/t}</label></td>
+     <td>
+{render acl=$passwordStorageACL checkbox=$multiple_support checked=$use_pw_storage}
+             <select size="1" id="pw_storage" name="pw_storage" onchange='document.mainform.submit()'>
+              {html_options values=$pwmode output=$pwmode selected=$pwmode_select}
+             </select>
+       {if $pw_configurable eq "true"}
+             &nbsp; <input id="edit_pw_method" type="submit" name="edit_pw_method" value="{t}Configure{/t}...">
+       {/if}
+{/render}
+     </td>
+    </tr>
+
+    {if $is_template ne "true" && !$multiple_support}
+    <tr>
+     <td><label for="edit_cert">{t}Certificates{/t}</label></td>
+     <td>
+{render acl=$CertificatesACL mode=read_active}
+               <input id="edit_cert" type="submit" name="edit_cert" value="{t}Edit certificates{/t}...">
+{/render}
+     </td>
+    </tr>
+    {/if}
+
+   </table>
+  </td>
+ </tr>
+</table>
+
+<p class="seperator">&nbsp;</p>
+
+<table summary="" class="line" style="width:100%; vertical-align:top; text-align:left;" cellpadding="4" border="0">
+
+ <!-- Headline container -->
+ <tr>
+  <td colspan="3">
+   <h2><img alt="" align="middle" src="images/house.png" class="center">&nbsp;{t}Organizational information{/t}</h2>
+  </td>
+ </tr>
+
+ <!-- Base 2 container -->
+ <tr>
+
+  {if $governmentmode ne "true"}
+  <!-- Company, ... -->
+  <td style="vertical-align:top;">
+   <table summary=""> 
+    <tr>
+     <td><label for="o">{t}Organization{/t}</label></td>
+     <td>      
+{render acl=$oACL checkbox=$multiple_support checked=$use_o}
+               <input id="o" name="o" size=22 maxlength=60 value="{$o}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><label for="ou">{t}Department{/t}</label></td>
+     <td>
+{render acl=$ouACL checkbox=$multiple_support checked=$use_ou}
+               <input id="ou" name="ou" size=22 maxlength=60 value="{$ou}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><label for="departmentNumber">{t}Department No.{/t}</label></td>
+     <td>
+{render acl=$departmentNumberACL checkbox=$multiple_support checked=$use_departmentNumber}
+             <input id="departmentNumber" name="departmentNumber" size=22 maxlength=60 value="{$departmentNumber}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><label for="employeeNumber">{t}Employee No.{/t}</label></td>
+     <td>
+{render acl=$employeeNumberACL checkbox=$multiple_support checked=$use_employeeNumber}
+               <input id="employeeNumber" name="employeeNumber" size=22 maxlength=60 value="{$employeeNumber}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><label for="employeeType">{t}Employee type{/t}</label></td>
+     <td>
+{render acl=$employeeTypeACL checkbox=$multiple_support checked=$use_employeeType}
+               <input id="employeeType" name="employeeType" size=22 maxlength=60 value="{$employeeType}">
+{/render}
+     </td>
+    </tr>
+   </table>
+  </td>
+   
+  <td style="border-left:1px solid #A0A0A0">
+   &nbsp;
+  </td>
+
+  <!-- Phone, ... -->
+  <td style="vertical-align:top;">
+   <table summary=""> 
+    <tr>
+     <td><label for="roomNumber">{t}Room No.{/t}</label></td>
+     <td>
+{render acl=$roomNumberACL checkbox=$multiple_support checked=$use_roomNumber}
+               <input id="roomNumber" name="roomNumber" size=22 maxlength=60 value="{$roomNumber}">
+{/render}
+     </td>
+    </tr>
+    {if $has_phoneaccount ne "true"}
+    <tr>
+     <td><label for="telephoneNumber">{t}Phone{/t}</label></td>
+     <td>
+{render acl=$telephoneNumberACL checkbox=$multiple_support checked=$use_telephoneNumber}
+               <input id="telephoneNumber" name="telephoneNumber" size=22 maxlength=60 value="{$telephoneNumber}">
+{/render}
+     </td>
+    </tr>
+    {/if}
+    <tr>
+     <td><label for="mobile">{t}Mobile{/t}</label></td>
+     <td>
+{render acl=$mobileACL checkbox=$multiple_support checked=$use_mobile}
+               <input id="mobile" name="mobile" size=22 maxlength=60 value="{$mobile}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><label for="pager">{t}Pager{/t}</label></td>
+     <td>
+{render acl=$pagerACL checkbox=$multiple_support checked=$use_pager}
+               <input id="pager" name="pager" size=22 maxlength=60 value="{$pager}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><label for="facsimileTelephoneNumber">{t}Fax{/t}</label></td>
+     <td>
+{render acl=$facsimileTelephoneNumberACL checkbox=$multiple_support checked=$use_facsimileTelephoneNumber}
+               <input id="facsimileTelephoneNumber" name="facsimileTelephoneNumber" size=22 maxlength=60 value="{$facsimileTelephoneNumber}">
+{/render}
+     </td>
+    </tr>
+   </table>
+  </td>
+
+  <td style="border-left:1px solid #A0A0A0">
+   &nbsp;
+  </td>
+
+  <!-- Location, ... -->
+  <td style="vertical-align:top;">
+   <table summary="" style="width:100%"> 
+    <tr>
+     <td><label for="l">{t}Location{/t}</label></td>
+     <td>
+{render acl=$lACL checkbox=$multiple_support checked=$use_l}
+               <input id="l" name="l" size=22 maxlength=60 value="{$l}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><label for="st">{t}State{/t}</label></td>
+     <td>
+{render acl=$stACL checkbox=$multiple_support checked=$use_st}
+               <input id="st" name="st" size=22 maxlength=60 value="{$st}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td style="vertical-align:top;"><label for="postalAddress">{t}Address{/t}</label></td>
+     <td>
+{render acl=$postalAddressACL checkbox=$multiple_support checked=$use_postalAddress}
+               <textarea id="postalAddress" name="postalAddress" rows=3 style="width:100%">{$postalAddress}</textarea>
+{/render}
+     </td>
+    </tr>
+   </table>
+  </td>
+
+  {else} 
+
+  <!-- Beschreibung, ... -->
+  <td style="vertical-align:top;border-right:1px solid #b0b0b0">
+   <table summary=""> 
+    <tr>
+     <td><label for="vocation">{t}Vocation{/t}</label></td>
+     <td>
+{render acl=$vocationACL checkbox=$multiple_support checked=$use_vocation}
+               <input id="vocation" name="vocation" size=22 maxlength=60 value="{$vocation}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><label for="gouvernmentOrganizationalUnitDescription">{t}Unit description{/t}</label></td>
+     <td>
+{render acl=$gouvernmentOrganizationalUnitDescriptionACL checkbox=$multiple_support checked=$use_gouvernmentOrganizationalUnitDescription}
+               <input id="gouvernmentOrganizationalUnitDescription" name="gouvernmentOrganizationalUnitDescription" size=22 maxlength=60
+               value="{$gouvernmentOrganizationalUnitDescription}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><label for="gouvernmentOrganizationalUnitSubjectArea">{t}Subject area{/t}</label></td>
+     <td>
+{render acl=$gouvernmentOrganizationalUnitSubjectAreaACL checkbox=$multiple_support checked=$use_gouvernmentOrganizationalUnitSubjectArea}
+               <input id="gouvernmentOrganizationalUnitSubjectArea" name="gouvernmentOrganizationalUnitSubjectArea" size=22 maxlength=60
+               value="{$gouvernmentOrganizationalUnitSubjectArea}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><label for="functionalTitle">{t}Functional title{/t}</label></td>
+     <td>
+{render acl=$functionalTitleACL checkbox=$multiple_support checked=$use_functionalTitle}
+               <input name="functionalTitle" id="functionalTitle"  size=22 maxlength=60
+               value="{$functionalTitle}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><label for="role">{t}Role{/t}</label></td>
+     <td>
+{render acl=$roleACL checkbox=$multiple_support checked=$use_role}
+               <input id="role" name="role" size=22 maxlength=60 value="{$role}">
+{/render}
+     </td>
+    </tr>
+   </table>
+  </td>
+  
+  <!-- Phone, ... -->
+  <td style="vertical-align:top;border-right:1px solid #b0b0b0">
+   <table summary=""> 
+    <tr>
+     <td><label for="gouvernmentOrganizationalPersonLocality">{t}Person locality{/t}</label></td>
+     <td>
+{render acl=$gouvernmentOrganizationalPersonLocalityACL checkbox=$multiple_support checked=$use_gouvernmentOrganizationalPersonLocality}
+               <input id="gouvernmentOrganizationalPersonLocality" name="gouvernmentOrganizationalPersonLocality" size=22 maxlength=60
+                value="{$gouvernmentOrganizationalPersonLocality}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><label for="gouvernmentOrganizationalUnit">{t}Unit{/t}</label></td>
+     <td>
+{render acl=$gouvernmentOrganizationalUnitACL checkbox=$multiple_support checked=$use_gouvernmentOrganizationalUnit}
+               <input id="gouvernmentOrganizationalUnit" name="gouvernmentOrganizationalUnit" size=22 maxlength=60 
+               value="{$gouvernmentOrganizationalUnit}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><label for="street">{t}Street{/t}</label></td>
+     <td>
+{render acl=$streetACL checkbox=$multiple_support checked=$use_street}
+               <input name="street" id="street" size=22 maxlength=60 value="{$street}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><label for="postalCode">{t}Postal code{/t}</label></td>
+     <td> 
+{render acl=$postalCodeACL checkbox=$multiple_support checked=$use_postalCode}
+               <input name="postalCode" id="postalCode" size=22 maxlength=60 value="{$postalCode}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><label for="houseIdentifier">{t}House identifier{/t}</label></td>
+     <td>
+{render acl=$houseIdentifierACL checkbox=$multiple_support checked=$use_houseIdentifier}
+               <input id="houseIdentifier" name="houseIdentifier" size=22 maxlength=60
+               value="{$houseIdentifier}">
+{/render}
+     </td>
+    </tr>
+   </table>
+  </td>
+
+  <!-- Location, ... -->
+  <td style="vertical-align:top;">
+   <table summary=""> 
+    <tr>
+     <td><label for="roomNumber">{t}Room No.{/t}</label></td>
+     <td>
+{render acl=$roomNumberACL checkbox=$multiple_support checked=$use_roomNumber}
+               <input id="roomNumber" name="roomNumber" size=22 maxlength=60 value="{$roomNumber}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><label for="telephoneNumber">{t}Phone{/t}</label></td>
+     <td>
+{render acl=$telephoneNumberACL checkbox=$multiple_support checked=$use_telephoneNumber}
+             {if $has_phoneaccount ne "true"}
+                       <input id="telephoneNumber" name="telephoneNumber" size=22 maxlength=60 value="{$telephoneNumber}">
+             {else}
+                       <i>{t}Please use the phone tab{/t}</i>
+             {/if}
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><label for="facsimileTelephoneNumber">{t}Fax{/t}</label></td>
+     <td>
+{render acl=$facsimileTelephoneNumberACL checkbox=$multiple_support checked=$use_facsimileTelephoneNumber}
+               <input id="facsimileTelephoneNumber" name="facsimileTelephoneNumber" size=22 maxlength=60 
+                value="{$facsimileTelephoneNumber}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><label for="ivbbLastDeliveryCollective">{t}Last delivery{/t}</label></td>
+     <td>
+{render acl=$ivbbLastDeliveryCollectiveACL checkbox=$multiple_support checked=$use_ivbbLastDeliveryCollective}
+               <input name="ivbbLastDeliveryCollective" size=22 maxlength=60 id="ivbbLastDeliveryCollective" 
+               value="{$ivbbLastDeliveryCollective}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><label for="publicVisible">{t}Public visible{/t}</label></td>
+     <td>
+{render acl=$publicVisibleACL checkbox=$multiple_support checked=$use_publicVisible}
+             <select size="1" id="publicVisible" name="publicVisible">
+              {html_options values=$ivbbmodes output=$ivbbmodes selected=$publicVisible}
+             </select>
+{/render}
+     </td>
+    </tr>
+   </table>
+  </td>
+ {/if} 
+ </tr>
+</table>
+
+{if $multiple_support}
+       <input type="hidden" name="user_mulitple_edit" value="1">
+{/if}
+<input type=hidden name="generic">
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('sn');
+       if (document.mainform.yearSel != "")
+                               populate(document.mainform,document.mainform.dateOfBirth);
+  -->
+</script>
diff --git a/gosa-core/plugins/personal/generic/generic_certs.tpl b/gosa-core/plugins/personal/generic/generic_certs.tpl
new file mode 100644 (file)
index 0000000..0b5e759
--- /dev/null
@@ -0,0 +1,96 @@
+<input type="hidden" name="MAX_FILE_SIZE" value="2000000">
+ <!-- Headline container -->
+<h2><img alt="" class="center" align="middle" src="images/certs.png"> {t}Certificates{/t}</h2>
+
+<table summary="" style="vertical-align:top; text-align:left;border-top: 1px solid rgb(176,176,176);" width="100%" cellpadding=4 border=0>
+ <tr>
+   <td width="12%" style="vertical-align:top">
+      {t}Standard certificate{/t}
+   </td>
+  
+   <td style="vertical-align:top">
+        <LABEL for="userCertificate_file">{if $Certificate_readable}{$userCertificateinfo}{/if}</LABEL>
+        </td>
+        <td style="vertical-align:top;text-align:right">
+        {if $userCertificate_state ne "true"}
+       {render acl=$CertificateACL}
+     <input id="userCertificate_file" name="userCertificate_file" type="file" size="20" maxlength="255" accept="text/*.*">
+       {/render}
+     {else}
+       {render acl=$CertificateACL}
+     <input type=submit name="remove_userCertificate" value="{t}Remove{/t}">
+       {/render}
+     {/if}
+   </td>
+ </tr>
+ </table>
+
+<br>
+
+ <table summary="" style="vertical-align:top; text-align:left;border-top: 1px solid rgb(176,176,176);" width="100%" cellpadding=4 border=0>
+ <tr>
+   <td width="12%" style="vertical-align:top">
+      {t}S/MIME certificate{/t} 
+   </td>
+   <td style="vertical-align:top">
+     <LABEL for="userSMIMECertificate_file">{if $Certificate_readable}{$userSMIMECertificateinfo}{/if}</LABEL>
+   </td>
+   <td style="vertical-align:top;text-align:right">
+        {if $userSMIMECertificate_state ne "true"}
+       {render acl=$CertificateACL}
+     <input id="userSMIMECertificate_file" name="userSMIMECertificate_file" type="file" size="20" maxlength="255" accept="text/*.*">
+       {/render}
+     {else}
+       {render acl=$CertificateACL}
+     <input type=submit name="remove_userSMIMECertificate" value="{t}Remove{/t}">
+       {/render}
+        {/if}
+   </td>
+ </tr>
+ </table>
+
+<br>
+
+<table summary="" style="vertical-align:top; text-align:left;border-top: 1px solid rgb(176,176,176);" width="100%" cellpadding=4 border=0> 
+ <tr>
+   <td width="12%" style="vertical-align:top">
+      {t}PKCS12 certificate{/t} 
+   </td>
+   <td style="vertical-align:top">
+     <LABEL for="userPKCS12_file">{if $Certificate_readable}{$userPKCS12info}{/if}</LABEL>
+   </td>
+   <td style="vertical-align:top;text-align:right">
+        {if $userPKCS12_state ne "true"}
+       {render acl=$CertificateACL}
+     <input id="userPKCS12_file" name="userPKCS12_file" type="file" size="20" maxlength="255" accept="text/*.*">
+       {/render}
+        {else}
+       {render acl=$CertificateACL}
+     <input type=submit name="remove_userPKCS12" value="{t}Remove{/t}">
+       {/render}
+        {/if}
+   </td>
+ </tr>
+ {if $governmentmode eq "true"}
+ <tr>
+   <td>
+     <LABEL for="certificateSerialNumber">{t}Certificate serial number{/t}</LABEL>
+   </td>
+   <td>
+       {render acl=$CertificateACL}
+     <input id="certificateSerialNumber" name="certificateSerialNumber" size=10 maxlength=20 value="{$certificateSerialNumber}">
+       {/render}
+   </td>
+ </tr>
+ {/if}
+</table>
+
+<p class="plugbottom">
+       {render acl=$CertificateACL}
+  <input type=submit name="cert_edit_finish" value="{t}Save{/t}">
+       {/render}
+  &nbsp;
+  <input type=submit name="cert_edit_cancel" value="{t}Cancel{/t}">
+</p>
+
diff --git a/gosa-core/plugins/personal/generic/generic_picture.tpl b/gosa-core/plugins/personal/generic/generic_picture.tpl
new file mode 100644 (file)
index 0000000..0e2b06c
--- /dev/null
@@ -0,0 +1,37 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4 border=0>
+ <!-- Headline container -->
+ <tr>
+   <td colspan=2>
+     <h2><img alt="" class="center" align="middle" src="images/head.png"> {t}Personal picture{/t}</h2>
+   </td>
+ </tr>
+ <!-- Base container -->
+ <tr>
+ <!-- Image container -->
+  <td>
+   <table>
+    <tr>
+     <td width="147" height="200" bgcolor="gray">
+      <img class="center" border="0" width="100%" src="getbin.php?rand={$rand}" alt="{t}Personal picture{/t}">
+     </td>
+    </tr>
+   </table>
+  </td>
+       </tr>
+       <tr>
+   <!-- Name, ... -->
+   <td style="vertical-align:bottom; width:100%;">
+     <input type="hidden" name="MAX_FILE_SIZE" value="2000000">
+     <input id="picture_file" name="picture_file" type="file" size="20" maxlength="255" accept="image/*.jpg">
+     &nbsp;
+     <input type=submit name="picture_remove" value="{t}Remove picture{/t}">
+   </td>
+ </tr>
+</table>
+<br>
+<p class="plugbottom">
+  <input type=submit name="picture_edit_finish" value="{t}Save{/t}">
+  &nbsp;
+  <input type=submit name="picture_edit_cancel" value="{t}Cancel{/t}">
+</p>
+
diff --git a/gosa-core/plugins/personal/generic/main.inc b/gosa-core/plugins/personal/generic/main.inc
new file mode 100644 (file)
index 0000000..e35ee1e
--- /dev/null
@@ -0,0 +1,198 @@
+<?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
+ */
+
+
+/* Preset display */
+$display  = "";
+$lock_msg = "";
+if (!$remove_lock){
+  /* Reset requested? */
+  if (isset($_POST['edit_cancel']) || isset($_POST['password_cancel']) || 
+      (isset($_GET['reset']) && $_GET['reset'] == 1)){
+    del_lock ($ui->dn);
+    sess_del ('edit');
+    sess_del ('user');
+  }
+
+  /* Create user object on demand */
+  if (!isset($_SESSION['user']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+    $_SESSION['user']= new user ($config, $ui->dn);
+    $_SESSION['user']->enable_CSN_check();
+    $_SESSION['user']->set_acl_base($ui->dn);
+    $_SESSION['user']->set_acl_category("users");
+  }
+  $user= $_SESSION['user'];
+
+  /* save changes back to object */
+  if (isset ($_SESSION['edit'])){
+    $user->save_object ();
+  }
+
+  /* Enter edit mode? */
+  if ((isset($_POST['edit'])) && (!isset( $_SESSION['edit'])) &&preg_match("/w/",$ui->get_permissions($ui->dn,"users/user"))){
+
+    /* Check locking */
+    if (($username= get_lock($ui->dn)) != ""){
+      $_SESSION['back_plugin']= $plug;
+      $_SESSION['LOCK_VARS_TO_USE'] = array("/^edit$/","/^plug$/");
+      $lock_msg =  gen_locked_message ($username, $ui->dn);
+  
+    }else{
+
+      /* Lock the current entry */
+      add_lock ($ui->dn, $ui->dn);
+      $_SESSION['dn']= $ui->dn;
+      $_SESSION['edit']= TRUE;
+    }
+  }
+
+  /* Perform password change */
+  if (isset($_POST['password_finish'])){
+
+    /* For security reasons, check if user is allowed to set password again */
+    if ($user->acl_is_writeable("userPassword") || $user->acl_is_createable()){
+
+      /* Check input and feed errors into 'message' */
+      $message= array();
+
+      /* Sanity checks... */
+      if ($_POST['new_password'] != $_POST['repeated_password']){
+
+        /* Matching passwords in new and repeated? */
+        $message[]= _("The passwords you've entered as 'New password' and 'Repeated new password' do not match.");
+      } else {
+
+        /* Empty password is not permitted by default. */
+        if ($_POST['new_password'] == ""){
+          $message[]= _("The password you've entered as 'New password' is empty.");
+        }
+      }
+
+      /* Errors, or change password? */
+      if (count($message) != 0){
+
+        /* Show error message and continue editing */
+        show_errors ($message);
+        $display.= $smarty->fetch(get_template_path('password.tpl', TRUE));
+        return ($display);
+      }
+      change_password ($user->dn, $_POST['new_password'], 0, $user->pw_storage);
+      new log("modify","users/password","",array(),"Password has been changed");
+
+    } else {
+
+      /* Missing permissions, show message */
+      print_red (_("You are not allowed to set your password!"));
+    }
+
+    del_lock ($ui->dn);
+    sess_del ('user');
+  }
+
+  /* save changes to LDAP and disable edit mode */
+  if (isset($_POST['edit_finish'])){
+
+    /* Perform checks */
+    $message= $user->check ();
+
+    /* No errors, save object */
+    if (count ($message) == 0){
+      $user->save ();
+      del_lock ($ui->dn);
+      sess_del ('edit');
+
+      /* Need to reset the password? */
+      if($user->password_change_needed()){
+        /* Save object */
+        $_SESSION['user']= $user;
+
+        $display.= $smarty->fetch(get_template_path('password.tpl', TRUE));
+        return ($display);
+      } else {
+       sess_del ('user');
+      }
+
+    } else {
+      /* Errors found, show message */
+      show_errors ($message);
+    }
+  }
+
+  /* Execute formular */
+  if($lock_msg){
+    $display.= $lock_msg;
+  }else{
+    $display.= $user->execute ();
+  }
+
+  /* Store changes  in session */
+  if (isset ($_SESSION['edit'])){
+    $_SESSION['user']= $user;
+  }
+
+  $info = "";
+
+  /* Show page footer depending on the mode */
+  if (!$user->cert_dialog && !$user->picture_dialog && !$user->dialog && $user->is_account && empty($lock_msg)){
+    $display.= "<p class=\"plugbottom\">";
+
+    /* Are we in edit mode? */
+    if (isset($_SESSION['edit'])){
+      $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
+      $display.= "&nbsp;";
+      $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+
+      $info= "<img class=\"center\" alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png').
+             "\"> ".$ui->dn."&nbsp;";
+    } else {
+      /* 'viewid' may be set by i.e. the phonelist plugin. This
+         means that we want to go back... */
+      if (isset ($viewid)){
+        $str= _("Back");
+        $fn = "back";
+      } else {
+        $str= _("Edit");
+        $fn = "edit";
+        $info= "<img class=\"center\" alt=\"\" align=\"middle\" src=\"".get_template_path('images/openlock.png').
+               "\"> ".$ui->dn."&nbsp;";
+      }
+
+      /* Only display edit button if there is at least one attribute editable */
+      if(preg_match("/w/",$ui->get_permissions($ui->dn,"users/user"))){
+        if ($fn == "edit"){
+          $info.= "<img class=\"center\" alt=\"\" align=\"middle\" src=\"".get_template_path('images/lamp.png')."\"> ".
+            _("Click the 'Edit' button below to change informations in this dialog");
+          $display.= "<input type=submit name=\"$fn\" value=\"$str\">\n";
+        }
+      }
+
+      $display.= "<input type=\"hidden\" name=\"ignore\">\n";
+    }
+    $display.= "</p>\n";
+  }
+
+  /* Page header*/
+  $display= print_header(get_template_path('images/personal.png'),
+                         _("Generic user information"), $info).$display;
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/personal/generic/multiple_generic.tpl b/gosa-core/plugins/personal/generic/multiple_generic.tpl
new file mode 100644 (file)
index 0000000..d6f4f03
--- /dev/null
@@ -0,0 +1,482 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding="4" border="0">
+ <tr>
+  <td colspan="4">
+    <img alt="" align="middle" src="images/head.png" class="center">
+       <h2>{t}Personal information{/t}</h2>
+  </td>
+ </tr>
+ <tr>
+  <td style="vertical-align:top">
+   <table>
+    <tr>
+     <td width="147" height="200" bgcolor="gray">
+      <img class='center' border="0" width="100%" src="images/default.jpg" alt="{t}Personal picture{/t}">
+     </td>
+    </tr>
+   </table>
+  </td>
+  <td style="vertical-align:top;">
+   <table>
+    <tr>
+     <td>
+      <label for="academicTitle">
+      {t}Academic title{/t}</label>
+     </td>
+     <td>
+       <input type="checkbox" name="use_academicTitle" value="1" {if $use_academicTitle} checked {/if}>
+      <input id="academicTitle" name="academicTitle" size=25 maxlength=60 value="{$academicTitle}">
+     </td>
+    </tr>
+    <tr>
+     <td>
+      <label for="preferredLanguage">
+      {t}Preferred langage{/t}</label>
+     </td>
+     <td>
+       <input type="checkbox" name="use_preferredLanguage" value="1" {if $use_preferredLanguage} checked {/if}>
+      <select size="1" id="preferredLanguage" name="preferredLanguage">
+       {html_options options=$preferredLanguage_list selected=$preferredLanguage}
+      </select>
+     </td>
+    </tr>
+    <tr>
+     <td>
+      <div style="height:10px;">
+      </div>
+      <label for="base">
+      {t}Base{/t}</label>
+     </td>
+     <td>
+      <div style="height:10px;">
+      </div>
+       <input type="checkbox" name="use_base" value="1" {if $use_base} checked {/if}>
+      <select id="base" size="1" name="base" title="{t}Choose subtree to place user in{/t}">
+       {html_options options=$bases selected=$base_select}
+      </select>
+      <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
+     </td>
+    </tr>
+   </table>
+  </td>
+  <td style="vertical-align:top;">
+   <!-- Address, ... -->
+   <table summary="" style="width:100%">
+    <tr>
+     <td style="vertical-align:top;">
+      <label for="homePostalAddress">
+      {t}Address{/t}</label>
+     </td>
+     <td>
+       <input type="checkbox" name="use_homePostalAddress" value="1" {if $use_homePostalAddress} checked {/if}>
+      <textarea id="homePostalAddress" name="homePostalAddress" rows="3" style="width:100%">
+      {$homePostalAddress}</textarea>
+     </td>
+    </tr>
+    <tr>
+     <td>
+      <label for="homePhone">
+      {t}Private phone{/t}</label>
+     </td>
+     <td>
+       <input type="checkbox" name="use_homePhone" value="1" {if $use_homePhone} checked {/if}>
+      <input id="homePhone" name="homePhone" size=25 maxlength=60 value="{$homePhone}">
+     </td>
+    </tr>
+    <tr>
+     <td>
+      <label for="labeledURI">
+      {t}Homepage{/t}</label>
+     </td>
+     <td>
+       <input type="checkbox" name="use_labeledURI" value="1" {if $use_labeledURI} checked {/if}>
+      <input id="labeledURI" name="labeledURI" size=25 maxlength=60 value="{$labeledURI}">
+     </td>
+    </tr>
+    <tr>
+     <td colspan=2>
+      <div style="height:20px;">
+      </div>
+     </td>
+    </tr>
+<!--
+    <tr>
+     <td>
+      <label for="pw_storage">
+      {t}Password storage{/t}</label>
+     </td>
+     <td>
+       <input type="checkbox" name="use_pw_storage" value="1" {if $use_pw_storage} checked {/if}>
+      <select size="1" id="pw_storage" name="pw_storage" onchange='document.mainform.submit()'>
+       {html_options values=$pwmode output=$pwmode selected=$pwmode_select}
+      </select>
+     </td>
+    </tr>
+    <tr>
+     <td>
+      <label for="edit_cert">
+      {t}Certificates{/t}</label>
+     </td>
+     <td>
+       <input type="checkbox" name="use_edit_cert" value="1" {if $use_edit_cert} checked {/if}>
+      <input id="edit_cert" type="submit" name="edit_cert" value="{t}Edit certificates{/t}...">
+     </td>
+    </tr>
+-->
+   </table>
+  </td>
+ </tr>
+</table>
+<p class="seperator">
+&nbsp;</p>
+<table summary="" class="line" style="width:100%; vertical-align:top; text-align:left;" cellpadding="4" border="0">
+ <!-- Headline container -->
+ <tr>
+  <td colspan="3">
+   <h2>
+    <img alt="" align="middle" src="images/house.png" class="center">
+   &nbsp;{t}Organizational information{/t}</h2>
+  </td>
+ </tr>
+ <!-- Base 2 container -->
+ <tr>
+  {if $governmentmode ne "true"}
+  <!-- Company, ... -->
+  <td style="vertical-align:top;">
+   <table summary="">
+    <tr>
+     <td>
+      <label for="o">
+      {t}Organization{/t}</label>
+     </td>
+     <td>
+       <input type="checkbox" name="use_o" value="1" {if $use_o} checked {/if}>
+      <input id="o" name="o" size=22 maxlength=60 value="{$o}">
+     </td>
+    </tr>
+    <tr>
+     <td>
+      <label for="ou">
+      {t}Department{/t}</label>
+     </td>
+     <td>
+       <input type="checkbox" name="use_ou" value="1" {if $use_ou} checked {/if}>
+      <input id="ou" name="ou" size=22 maxlength=60 value="{$ou}">
+     </td>
+    </tr>
+    <tr>
+     <td>
+      <label for="departmentNumber">
+      {t}Department No.{/t}</label>
+     </td>
+     <td>
+       <input type="checkbox" name="use_departmentNumber" value="1" {if $use_departmentNumber} checked {/if}>
+      <input id="departmentNumber" name="departmentNumber" size=22 maxlength=60 value="{$departmentNumber}">
+     </td>
+    </tr>
+    <tr>
+     <td>
+      <label for="employeeNumber">
+      {t}Employee No.{/t}</label>
+     </td>
+     <td>
+       <input type="checkbox" name="use_employeeNumber" value="1" {if $use_employeeNumber} checked {/if}>
+      <input id="employeeNumber" name="employeeNumber" size=22 maxlength=60 value="{$employeeNumber}">
+     </td>
+    </tr>
+    <tr>
+     <td>
+      <label for="employeeType">
+      {t}Employee type{/t}</label>
+     </td>
+     <td>
+       <input type="checkbox" name="use_employeeType" value="1" {if $use_employeeType} checked {/if}>
+      <input id="employeeType" name="employeeType" size=22 maxlength=60 value="{$employeeType}">
+     </td>
+    </tr>
+   </table>
+  </td>
+  <td style="border-left:1px solid #A0A0A0">
+   &nbsp;
+  </td>
+  <!-- Phone, ... -->
+  <td style="vertical-align:top;">
+   <table summary="">
+    <tr>
+     <td>
+      <label for="roomNumber">
+      {t}Room No.{/t}</label>
+     </td>
+     <td>
+       <input type="checkbox" name="use_roomNumber" value="1" {if $use_roomNumber} checked {/if}>
+      <input id="roomNumber" name="roomNumber" size=22 maxlength=60 value="{$roomNumber}">
+     </td>
+    </tr>
+    <tr>
+     <td>
+      <label for="telephoneNumber">
+      {t}Phone{/t}</label>
+     </td>
+     <td>
+       <input type="checkbox" name="use_telephoneNumber" value="1" {if $use_telephoneNumber} checked {/if}>
+      <input id="telephoneNumber" name="telephoneNumber" size=22 maxlength=60 value="{$telephoneNumber}">
+     </td>
+    </tr>
+    <tr>
+     <td>
+      <label for="mobile">
+      {t}Mobile{/t}</label>
+     </td>
+     <td>
+       <input type="checkbox" name="use_mobile" value="1" {if $use_mobile} checked {/if}>
+      <input id="mobile" name="mobile" size=22 maxlength=60 value="{$mobile}">
+     </td>
+    </tr>
+    <tr>
+     <td>
+      <label for="pager">
+      {t}Pager{/t}</label>
+     </td>
+     <td>
+       <input type="checkbox" name="use_pager" value="1" {if $use_pager} checked {/if}>
+      <input id="pager" name="pager" size=22 maxlength=60 value="{$pager}">
+     </td>
+    </tr>
+    <tr>
+     <td>
+      <label for="facsimileTelephoneNumber">
+      {t}Fax{/t}</label>
+     </td>
+     <td>
+       <input type="checkbox" name="use_facsimileTelephoneNumber" value="1" {if $use_facsimileTelephoneNumber} checked {/if}>
+      <input id="facsimileTelephoneNumber" name="facsimileTelephoneNumber" size=22 maxlength=60 value="{$facsimileTelephoneNumber}">
+     </td>
+    </tr>
+   </table>
+  </td>
+  <td style="border-left:1px solid #A0A0A0">
+   &nbsp;
+  </td>
+  <!-- Location, ... -->
+  <td style="vertical-align:top;">
+   <table summary="" style="width:100%">
+    <tr>
+     <td>
+      <label for="l">
+      {t}Location{/t}</label>
+     </td>
+     <td>
+       <input type="checkbox" name="use_l" value="1" {if $use_l} checked {/if}>
+      <input id="l" name="l" size=22 maxlength=60 value="{$l}">
+     </td>
+    </tr>
+    <tr>
+     <td>
+      <label for="st">
+      {t}State{/t}</label>
+     </td>
+     <td>
+       <input type="checkbox" name="use_st" value="1" {if $use_st} checked {/if}>
+      <input id="st" name="st" size=22 maxlength=60 value="{$st}">
+     </td>
+    </tr>
+    <tr>
+     <td style="vertical-align:top;">
+      <label for="postalAddress">
+      {t}Address{/t}</label>
+     </td>
+     <td>
+       <input type="checkbox" name="use_postalAddress" value="1" {if $use_postalAddress} checked {/if}>
+      <textarea id="postalAddress" name="postalAddress" rows=3 style="width:100%">
+      {$postalAddress}</textarea>
+     </td>
+    </tr>
+   </table>
+  </td>
+  {else} 
+  <!-- Beschreibung, ... -->
+  <td style="vertical-align:top;border-right:1px solid #b0b0b0">
+   <table summary="">
+    <tr>
+     <td>
+      <label for="vocation">
+      {t}Vocation{/t}</label>
+     </td>
+     <td>
+       <input type="checkbox" name="use_vocation" value="1" {if $use_vocation} checked {/if}>
+      <input id="vocation" name="vocation" size=22 maxlength=60 value="{$vocation}">
+     </td>
+    </tr>
+    <tr>
+     <td>
+      <label for="gouvernmentOrganizationalUnitDescription">
+      {t}Unit description{/t}</label>
+     </td>
+     <td>
+       <input type="checkbox" name="use_gouvernmentOrganizationalUnitDescription" value="1" {if $use_gouvernmentOrganizationalUnitDescription} checked {/if}>
+      <input id="gouvernmentOrganizationalUnitDescription" name="gouvernmentOrganizationalUnitDescription" size=22 maxlength=60
+      value="{$gouvernmentOrganizationalUnitDescription}">
+     </td>
+    </tr>
+    <tr>
+     <td>
+      <label for="gouvernmentOrganizationalUnitSubjectArea">
+      {t}Subject area{/t}</label>
+     </td>
+     <td>
+       <input type="checkbox" name="use_gouvernmentOrganizationalUnitSubjectArea" value="1" {if $use_gouvernmentOrganizationalUnitSubjectArea} checked {/if}>
+      <input id="gouvernmentOrganizationalUnitSubjectArea" name="gouvernmentOrganizationalUnitSubjectArea" size=22 maxlength=60
+      value="{$gouvernmentOrganizationalUnitSubjectArea}">
+     </td>
+    </tr>
+    <tr>
+     <td>
+      <label for="functionalTitle">
+      {t}Functional title{/t}</label>
+     </td>
+     <td>
+       <input type="checkbox" name="use_functionalTitle" value="1" {if $use_functionalTitle} checked {/if}>
+      <input name="functionalTitle" id="functionalTitle"  size=22 maxlength=60
+      value="{$functionalTitle}">
+     </td>
+    </tr>
+    <tr>
+     <td>
+      <label for="role">
+      {t}Role{/t}</label>
+     </td>
+     <td>
+       <input type="checkbox" name="use_role" value="1" {if $use_role} checked {/if}>
+      <input id="role" name="role" size=22 maxlength=60 value="{$role}">
+     </td>
+    </tr>
+   </table>
+  </td>
+  <!-- Phone, ... -->
+  <td style="vertical-align:top;border-right:1px solid #b0b0b0">
+   <table summary="">
+    <tr>
+     <td>
+      <label for="gouvernmentOrganizationalPersonLocality">
+      {t}Person locality{/t}</label>
+     </td>
+     <td>
+       <input type="checkbox" name="use_gouvernmentOrganizationalPersonLocality" value="1" {if $use_gouvernmentOrganizationalPersonLocality} checked {/if}>
+      <input id="gouvernmentOrganizationalPersonLocality" name="gouvernmentOrganizationalPersonLocality" size=22 maxlength=60
+      value="{$gouvernmentOrganizationalPersonLocality}">
+     </td>
+    </tr>
+    <tr>
+     <td>
+      <label for="gouvernmentOrganizationalUnit">
+      {t}Unit{/t}</label>
+     </td>
+     <td>
+       <input type="checkbox" name="use_gouvernmentOrganizationalUnit" value="1" {if $use_gouvernmentOrganizationalUnit} checked {/if}>
+      <input id="gouvernmentOrganizationalUnit" name="gouvernmentOrganizationalUnit" size=22 maxlength=60 
+      value="{$gouvernmentOrganizationalUnit}">
+     </td>
+    </tr>
+    <tr>
+     <td>
+      <label for="street">
+      {t}Street{/t}</label>
+     </td>
+     <td>
+       <input type="checkbox" name="use_street" value="1" {if $use_street} checked {/if}>
+      <input name="street" id="street" size=22 maxlength=60 value="{$street}">
+     </td>
+    </tr>
+    <tr>
+     <td>
+      <label for="postalCode">
+      {t}Postal code{/t}</label>
+     </td>
+     <td>
+       <input type="checkbox" name="use_postalCode" value="1" {if $use_postalCode} checked {/if}>
+      <input name="postalCode" id="postalCode" size=22 maxlength=60 value="{$postalCode}">
+     </td>
+    </tr>
+    <tr>
+     <td>
+      <label for="houseIdentifier">
+      {t}House identifier{/t}</label>
+     </td>
+     <td>
+       <input type="checkbox" name="use_houseIdentifier" value="1" {if $use_houseIdentifier} checked {/if}>
+      <input id="houseIdentifier" name="houseIdentifier" size=22 maxlength=60
+      value="{$houseIdentifier}">
+     </td>
+    </tr>
+   </table>
+  </td>
+  <!-- Location, ... -->
+  <td style="vertical-align:top;">
+   <table summary="">
+    <tr>
+     <td>
+      <label for="roomNumber">
+      {t}Room No.{/t}</label>
+     </td>
+     <td>
+       <input type="checkbox" name="use_roomNumber" value="1" {if $use_roomNumber} checked {/if}>
+      <input id="roomNumber" name="roomNumber" size=22 maxlength=60 value="{$roomNumber}">
+     </td>
+    </tr>
+    <tr>
+     <td>
+      <label for="telephoneNumber">
+      {t}Phone{/t}</label>
+     </td>
+     <td>
+       <input type="checkbox" name="use_telephoneNumber" value="1" {if $use_telephoneNumber} checked {/if}>
+      <input id="telephoneNumber" name="telephoneNumber" size=22 maxlength=60 value="{$telephoneNumber}">
+     </td>
+    </tr>
+    <tr>
+     <td>
+      <label for="facsimileTelephoneNumber">
+      {t}Fax{/t}</label>
+     </td>
+     <td>
+       <input type="checkbox" name="use_facsimileTelephoneNumber" value="1" {if $use_facsimileTelephoneNumber} checked {/if}>
+      <input id="facsimileTelephoneNumber" name="facsimileTelephoneNumber" size=22 maxlength=60 
+      value="{$facsimileTelephoneNumber}">
+     </td>
+    </tr>
+    <tr>
+     <td>
+      <label for="ivbbLastDeliveryCollective">
+      {t}Last delivery{/t}</label>
+     </td>
+     <td>
+       <input type="checkbox" name="use_ivbbLastDeliveryCollective" value="1" {if $use_ivbbLastDeliveryCollective} checked {/if}>
+      <input name="ivbbLastDeliveryCollective" size=22 maxlength=60 id="ivbbLastDeliveryCollective" 
+      value="{$ivbbLastDeliveryCollective}">
+     </td>
+    </tr>
+    <tr>
+     <td>
+      <label for="publicVisible">
+      {t}Public visible{/t}</label>
+     </td>
+     <td>
+       <input type="checkbox" name="use_publicVisible" value="1" {if $use_publicVisible} checked {/if}>
+      <select size="1" id="publicVisible" name="publicVisible">
+       {html_options values=$ivbbmodes output=$ivbbmodes selected=$publicVisible}
+      </select>
+     </td>
+    </tr>
+   </table>
+  </td>
+  {/if} 
+ </tr>
+</table>
+<input type=hidden name="multiple_user_posted" value="1">
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+<!-- // First input field on page
+focus_field('academicTitle');
+if (document.mainform.yearSel != "")
+populate(document.mainform,document.mainform.dateOfBirth);
+-->
+</script>
diff --git a/gosa-core/plugins/personal/generic/password.tpl b/gosa-core/plugins/personal/generic/password.tpl
new file mode 100644 (file)
index 0000000..3d26511
--- /dev/null
@@ -0,0 +1,28 @@
+<p>
+ {t}You have changed the method your password is stored in the ldap database. For that reason you've to enter your password at this point again. GOsa will then encode it with the selected method.{/t}
+</p>
+
+<table summary="" style="vertical-align:top; text-align:left;" cellpadding=4 border=0>
+  <tr>
+    <td><b><LABEL for="new_password">{t}New password{/t}</LABEL></b></td>
+    <td><input id="new_password" type="password" name="new_password" size="30" maxlength="40" onFocus="nextfield= 'repeated_password';"></td>
+  </tr>
+  <tr>
+    <td><b><LABEL for="repeated_password">{t}Repeat new password{/t}</LABEL></b></td>
+    <td><input id="repeated_password" type="password" name="repeated_password" size="30" maxlength="40" onFocus="nextfiled= 'password_finish'"></td>
+  </tr>
+</table>
+<br>
+<p class="plugbottom">
+  <input type=submit name="password_finish" value="{t}Set password{/t}">
+  &nbsp;
+  <input type=submit name="password_cancel" value="{t}Cancel{/t}">
+</p>
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       nextfield= "new_password";
+       focus_field('new_password');
+  -->
+</script>
diff --git a/gosa-core/plugins/personal/generic/paste_generic.tpl b/gosa-core/plugins/personal/generic/paste_generic.tpl
new file mode 100644 (file)
index 0000000..0fc1608
--- /dev/null
@@ -0,0 +1,59 @@
+<h2>{t}User settings{/t}</h2>
+<table width="100%">
+  <tr>
+       <td style="vertical-align:top; border-right:1px solid #AAA; width:50%">
+         <table>
+               <tr>
+                 <td><label for="sn">{t}Last name{/t}</label></td>
+                 <td><input id="sn" name="sn" size=25 maxlength=60  value="{$sn}"></td>
+               </tr>
+               <tr>
+                 <td><label for="givenName">{t}First name{/t}</label></td>
+                 <td><input id="givenName" name="givenName" size=25 maxlength=60 value="{$givenName}"></td>
+               </tr>
+               <tr>
+                 <td><label for="uid">{t}Login{/t}</label></td>
+                 <td><input id="uid" name="uid" size=25 maxlength=60 value="{$uid}"></td>
+               </tr>
+               <tr>
+                       <td style='vertical-align:top;'>
+                               {t}Password{/t}
+                       </td>
+                       <td>
+                               <input type="radio" {if $passwordTodo=="clear"} checked{/if} name="passwordTodo" value="clear">{t}Clear password{/t}<br>
+                               <input type="radio" {if $passwordTodo=="new"}   checked{/if} name="passwordTodo" value="new">{t}Set new password{/t}
+                       </td>
+               </tr>
+         </table>
+       </td>
+       <td style="vertical-align:top ">
+         <table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4 border=0>
+               <tr>
+               <!-- Image container -->
+                 <td colspan="2">
+                       <table>
+                         <tr>
+                               <td width="147" height="200" bgcolor="gray">
+                                 <img align="middle" border="0" width="100%" src="getbin.php?rand={$rand}" alt="{t}Personal picture{/t}">
+                               </td>
+                         </tr>
+                       </table>
+                 </td>
+               </tr>
+               <tr>
+                 <!-- Name, ... -->
+                 <td style="vertical-align:top;">
+                       <input type="hidden" name="MAX_FILE_SIZE" value="2000000">
+                        {t}User picture{/t}
+                 </td>
+                 <td>
+                       <input id="picture_file" name="picture_file" type="file" size="20" maxlength="255" accept="image/*.jpg">
+                       &nbsp;
+                       <input type=submit name="picture_remove" value="{t}Remove picture{/t}">
+                 </td>
+               </tr>
+         </table>
+       </td>
+  </tr>
+</table>
+<br>
diff --git a/gosa-core/plugins/personal/mail/class_mailAccount.inc b/gosa-core/plugins/personal/mail/class_mailAccount.inc
new file mode 100644 (file)
index 0000000..4b6a7b9
--- /dev/null
@@ -0,0 +1,1208 @@
+<?php
+/*! \brief   mail plugin
+  \author  Cajus Pollmeier <pollmeier@gonicus.de>
+  \version 2.00
+  \date    24.07.2003
+
+  This class provides the functionality to read and write all attributes
+  relevant for gosaMailAccounts from/to the LDAP. It does syntax checking
+  and displays the formulars required.
+ */
+
+class mailAccount extends plugin
+{
+  /* Definitions */
+  var $plHeadline         = "Mail";
+  var $plDescription      = "This does something";
+  var $method             = "mailMethod";
+
+  /* CLI vars */
+  var $gosaVacationStart                  = 0;
+  var $gosaVacationStop                   = 0;
+  var $view_logged = FALSE;
+
+  /* plugin specific values */
+  var $mail                               = "";
+  var $gosaMailAlternateAddress           = array();
+  var $gosaMailForwardingAddress          = array();
+  var $gosaMailDeliveryMode               = "[L        ]";
+  var $gosaMailServer                     = "";
+  var $gosaMailQuota                      = "";
+  var $gosaMailMaxSize                    = "";
+  var $gosaVacationMessage                = "";
+  var $gosaSpamSortLevel                  = "";
+  var $gosaSpamMailbox                    = "";
+
+  var $quotaUsage                         = 0;
+  var $forward_dialog                     = FALSE;
+  var $folder_prefix                      = "";
+  var $mailboxList                        = array("INBOX");
+  var $default_permissions                = "none";
+  var $member_permissions                 = "post";
+  var $members                            = array();
+  var $admins                             = array();
+  var $vacations                          = array();
+  var $perms                              = array(  "lrs"       => "read", 
+                                                    "lrsp"      => "post", 
+                                                    "lrsip"     => "append",
+                                                    "lrswipcd"  => "write", 
+                                                    "lrswipcda" => "all" );
+
+  /* attribute list for save action */
+  var $attributes= array("mail", "gosaMailServer", "gosaMailQuota", "gosaMailMaxSize","gosaMailForwardingAddress",
+      "gosaMailDeliveryMode", "gosaSpamSortLevel", "gosaSpamMailbox","gosaMailAlternateAddress","gosaVacationStart","gosaVacationStop",
+      "gosaVacationMessage", "gosaMailAlternateAddress", "gosaMailForwardingAddress");
+  var $objectclasses= array("gosaMailAccount");
+  var $uid              = "";
+
+  var $sieve_management = NULL;
+
+  /* constructor, if 'dn' is set, the node loads the given
+     'dn' from LDAP */
+  function mailAccount (&$config, $dn= NULL)
+  {
+    global $class_mapping;
+
+    /* Load bases attributes */
+    plugin::plugin($config, $dn);
+
+    /* Set uid */
+    if(isset($this->attrs['uid'])){
+      $this->uid = $this->attrs['uid'][0];
+    }
+    if(is_array($this->gosaMailServer) && isset($this->gosaMailServer[0])){
+      $this->gosaMailServer = $this->gosaMailServer[0];
+    }
+
+    /* Save initial account state */
+    $this->initially_was_account= $this->is_account;
+
+    /*  Set mailMethod to the one defined in gosa.conf */
+    if (isset($this->config->current['MAILMETHOD'])){
+      $method= $this->config->current['MAILMETHOD'];
+
+      $cls = get_correct_class_name("mailMethod$method");
+      if ($cls && class_exists($cls)){
+        $this->method= $cls;
+      } else {
+        print_red(sprintf(_("There is no mail method '%s' specified in your gosa.conf available."), $method));
+      }
+    }
+
+    
+    /* Create the account prefix  user. user/ 
+       Preset folder prefix. Will change it later to respect
+       altnamespace. */
+    if (isset($this->config->current['CYRUSUNIXSTYLE']) && $this->config->current['CYRUSUNIXSTYLE'] == "true"){
+      $this->folder_prefix= "user/";
+    }elseif (isset($this->config->data['MAIN']['CYRUSUNIXSTYLE']) && $this->config->data['MAIN']['CYRUSUNIXSTYLE'] == "true"){
+      $this->folder_prefix= "user/";
+    } else {
+      $this->folder_prefix= "user.";
+    }
+    
+    /* This is not a new account, parse additional attributes */
+    if (($dn !== NULL) && ($dn != "new") && $this->is_account){
+
+      /* Load attributes containing arrays */
+      foreach (array("gosaMailAlternateAddress", "gosaMailForwardingAddress") as $val){
+        $this->$val= array();
+        if (isset($this->attrs["$val"]["count"])){
+          for ($i= 0; $i<$this->attrs["$val"]["count"]; $i++){
+            array_push($this->$val, $this->attrs["$val"][$i]);
+          }
+        }
+      }
+
+
+      /* Only do IMAP actions if gosaMailServer attribute is set */
+      if (isset ($this->attrs["gosaMailServer"][0])){
+
+        $method = new $this->method($this->config);
+        $id     = $method->uattrib;
+
+        /* Adapt attributes if needed */
+        $method->fixAttributesOnLoad($this);
+
+        /* FixAttributesOnLoad possibly creates an array out of gosaMailServer.
+            If the mail tab wasn't opened once before saving, the account can't be saved */
+        if(is_array($this->gosaMailServer)){
+          $this->gosaMailServer = $this->gosaMailServer[0];
+        }
+
+        if ($method->connect($this->attrs["gosaMailServer"][0])){
+
+          /* Update quota values */
+          $quota= $method->getQuota($this->folder_prefix.$this->$id);
+         
+          if($quota){
+            if ($quota['gosaMailQuota'] == 2147483647){
+              $this->quotaUsage     = "";
+              $this->gosaMailQuota  = "";
+            } else {
+              $this->quotaUsage     = $quota['quotaUsage'];
+              $this->gosaMailQuota  = $quota['gosaMailQuota'];
+            }
+          }else{
+            $this->quotaUsage     = "";
+            $this->gosaMailQuota  = "";
+//            print_red(sprintf(_("Can't get quota information for '%s'."),$this->folder_prefix.$this->$id));
+          }
+
+          /* Get mailboxes / folder like INBOX ..*/
+          $this->mailboxList= $method->getMailboxList($this->folder_prefix.$this->$id,$this->$id);
+          
+          $method->disconnect();
+        }else{
+          /* Could not connect to ldap.
+           */
+          if (isset($this->attrs['gosaMailQuota'][0])){
+            $this->gosaMailQuota = $this->attrs['gosaMailQuota'][0];
+          }
+        }
+      }
+    }
+
+    /* Fill vacation array */
+    $this->vacation= array();
+    if (isset($this->config->current['VACATIONDIR'])){
+      $dir= $this->config->current['VACATIONDIR'];
+      if (is_dir($dir) && is_readable($dir)){
+
+        /* Look for files and build the vacation array */
+        $dh= opendir($dir);
+        while ($file = readdir($dh)){
+          $description= $this->parse_vacation("$dir/$file");
+          if ($description != ""){
+            $this->vacation["$dir/$file"]= $description;
+          }
+        }
+        closedir($dh);
+      }
+    }
+
+    /* Create sieve management class */
+    $method = new $this->method($this->config);
+    $id     = $method->uattrib;
+    $this->sieve_management = new sieveManagement($this->config,$this->dn,$this,$id);
+
+    /* Get global filter config */
+    if (!is_global("mailfilter")){
+      $ui= get_userinfo();
+      $base= get_base_from_people($ui->dn);
+      $mailfilter= array( "depselect"       => $base,
+          "muser"            => "",
+          "regex"           => "*");
+      register_global("mailfilter", $mailfilter);
+    }
+  }
+
+
+  function parse_vacation($file)
+  {
+    $desc= "";
+
+    if (is_file($file)){
+      $fh = fopen($file, "r");
+      $line= fgets($fh, 256);
+
+      if (!preg_match('/^DESC:/', $line)){
+        print_red (_("No DESC tag in vacation file:")." $file");
+        return $desc;
+      }
+      fclose ($fh);
+
+      $desc= trim(preg_replace('/^DESC:\s*/', '', $line));
+    }
+
+    return $desc;
+  }
+
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* Log view */
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","users/".get_class($this),$this->dn);
+    }
+
+    /* Initialise vars */
+
+    /* Load templating engine */
+    $smarty= get_smarty();
+    $display= "";
+
+    /* Get available mailserver */
+    $mailserver= array();
+    foreach ($this->config->data['SERVERS']['IMAP'] as $key => $val){
+      $mailserver[]= $key;
+    }
+
+    /* 
+     * Sieve Management 
+     */
+    if(isset($_POST['sieveManagement']) 
+        && preg_match("/C/",$this->gosaMailDeliveryMode)
+        && $this->acl_is_writeable("sieveManagement")) {
+
+      $this->dialog = $this->sieve_management;
+    }
+   
+    /* Cancel sieve edit */
+    if(isset($_POST['sieve_cancel'])){
+      $this->dialog = FALSE;
+    }
+    /* Save sieve changes */
+    if(isset($_POST['sieve_finish'])){
+      $this->sieve_management = $this->dialog;
+      $this->dialog = FALSE;
+    }
+    if(is_object($this->dialog)){
+      $this->dialog->save_object();
+      return($this->dialog->execute());
+    } 
+
+
+    /* Handle account state */
+    /* 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;
+      }
+    }
+
+    /* Do we represent a valid account? */
+    if (!$this->is_account && $this->parent === NULL){
+      $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\">&nbsp;<b>".
+        _("This account has no mail extensions.")."</b>";
+
+      $display.= back_to_main();
+      return ($display);
+    }
+
+    /* Show tab dialog headers */
+    if ($this->parent !== NULL){
+      if ($this->is_account){
+        if($this->accountDelegationsConfigured()){
+          $display= $this->show_disable_header(_("Remove mail account"),
+              _("This account can't be removed while there are delegations configured. Remove those delegations first."),TRUE,TRUE);
+        }else{
+          $display= $this->show_disable_header(_("Remove mail account"),
+              _("This account has mail features enabled. You can disable them by clicking below."));
+        }
+      } else {
+        $display= $this->show_enable_header(_("Create mail account"), _("This account has mail features disabled. You can enable them by clicking below."));
+        return ($display);
+      }
+    }
+
+
+    /* Forwarder  subdialog */
+
+    /* Trigger forward add dialog? */
+    if (isset($_POST['add_local_forwarder'])){
+      $this->forward_dialog= TRUE;
+      $this->dialog= TRUE;
+    }
+
+    /* Cancel forward add dialog? */
+    if (isset($_POST['add_locals_cancel'])){
+      $this->forward_dialog= FALSE;
+      $this->dialog= FALSE;
+    }
+
+    /* Finished adding of locals? */
+    if (isset($_POST['add_locals_finish'])){
+
+      /* Check if we are able to write gosaMailForwardingAddress */
+      if($this->acl_is_writeable("gosaMailForwardingAddress")){
+
+        /* Walk through list of forwarders, ignore own addresses */
+        foreach ($_POST['local_list'] as $val){
+          if (!in_array ($val, $this->gosaMailAlternateAddress) &&
+              $val != $this->mail){
+
+            $this->addForwarder($val);
+            $this->is_modified= TRUE;
+          }
+        }
+      }
+      $this->forward_dialog= FALSE;
+      $this->dialog= FALSE;
+    }
+
+    /* Add forward email addresses */
+    if (isset($_POST['add_forwarder'])){
+      if ($_POST['forward_address'] != ""){
+
+        /* Valid email address specified? */
+        $address= $_POST['forward_address'];
+        $valid= FALSE;
+        if (!is_email($address)){
+          if (!is_email($address, TRUE)){
+            if ($this->is_template){
+              $valid= TRUE;
+            } else {
+              print_red (_("You're trying to add an invalid email address to the list of forwarders."));
+            }
+          }
+        } elseif ($address == $this->mail
+            || in_array($address, $this->gosaMailAlternateAddress)) {
+
+          print_red (_("Adding your one of your own addresses to the forwarders makes no sense."));
+
+        } else {
+          $valid= TRUE;
+        }
+
+        if ($valid){
+
+          /* Add it, if we are able to write gosaMailForwardingAddress */
+          if($this->acl_is_writeable("gosaMailForwardingAddress")){
+            $this->addForwarder ($address);
+            $this->is_modified= TRUE;
+          }
+        }
+      }
+    }
+
+    /* Delete forward email addresses */
+    if (isset($_POST['delete_forwarder'])){
+      $this->delForwarder ($_POST['forwarder_list']);
+    }
+
+
+    /* Add alternate email addresses */
+    if (isset($_POST['add_alternate'])){
+
+      $valid= FALSE;
+      if (!is_email($_POST['alternate_address'])){
+        if ($this->is_template){
+          if (!(is_email($_POST['alternate_address'], TRUE))){
+            print_red (_("You're trying to add an invalid email address to the list of alternate addresses."));
+          } else {
+            $valid= TRUE;
+          }
+        } else {
+          print_red (_("You're trying to add an invalid email address to the list of alternate addresses."));
+        }
+
+      } else {
+        $valid= TRUE;
+      }
+
+      if ($valid && ($user= $this->addAlternate ($_POST['alternate_address'])) != ""){
+        $ui= get_userinfo();
+        if ($user != $ui->username){
+          print_red (_("The address you're trying to add is already used by user")." '$user'.");
+        }
+      }
+    }
+
+    /* Delete alternate email addresses */
+    if (isset($_POST['delete_alternate']) && isset($_POST['alternates_list'])){
+      $this->delAlternate ($_POST['alternates_list']);
+    }
+
+  
+    /* Vacation message */
+  
+    /* Import vacation message? */
+    if (isset($_POST["import_vacation"]) && isset($this->vacation[$_POST["vacation_template"]])){
+      $contents= "";
+      $lines= file($_POST["vacation_template"]);
+      foreach ($lines as $line){
+        if (!preg_match('/^DESC:/', $line)){
+          $contents.= $line;
+        }
+      }
+
+      /* Replace attributes */
+      $attrs= $this->parent->by_object['user']->attributes;
+      foreach ($attrs as $val){
+        
+        if(preg_match("/dateOfBirth/",$val)){
+          if($this->parent->by_object['user']->use_dob){
+            $contents= preg_replace("/%$val/",date("Y-d-m",$this->parent->by_object['user']->dateOfBirth),$contents);
+          }
+        }else {
+          $contents= preg_replace("/%$val/",
+              $this->parent->by_object['user']->$val, $contents);
+        }
+        
+        /* Replace vacation start and end time */
+        if(preg_match("/%start/",$contents)){
+          $contents = preg_replace("/%start/",date("d.m.Y",$this->gosaVacationStart),$contents);
+        }
+        if(preg_match("/%end/",$contents)){
+          $contents = preg_replace("/%end/",date("d.m.Y",$this->gosaVacationStop),$contents);
+        }
+      }
+
+      /* Save message */
+      $this->gosaVacationMessage= htmlspecialchars($contents);
+    }
+
+  
+    /* Display forward dialog if requested above */
+
+    /* Show forward add dialog */
+    if ($this->forward_dialog){
+      $ldap= $this->config->get_ldap_link();
+
+      /* Save data */
+      $mailfilter= get_global("mailfilter");
+      foreach( array("depselect", "muser", "regex") as $type){
+        if (isset($_POST[$type])){
+          $mailfilter[$type]= $_POST[$type];
+        }
+      }
+      if (isset($_GET['search'])){
+        $s= mb_substr($_GET['search'], 0, 1, "UTF8")."*";
+        if ($s == "**"){
+          $s= "*";
+        }
+        $mailfilter['regex']= $s;
+      }
+      register_global("mailfilter", $mailfilter);
+
+      /* Get actual list */
+      $mailusers= array ();
+      if ($mailfilter['regex'] != '*' && $mailfilter['regex'] != ""){
+        $regex= $mailfilter['regex'];
+        $filter= "(|(mail=$regex)(gosaMailAlternateAddress=$regex))";
+      } else {
+        $filter= "";
+      }
+      if ($mailfilter['muser'] != ""){
+        $user= $mailfilter['muser'];
+        $filter= "$filter(|(uid=$user)(cn=$user)(givenName=$user)(sn=$user))";
+      }
+
+      /* Add already present people to the filter */
+      $exclude= "";
+      foreach ($this->gosaMailForwardingAddress as $mail){
+        $exclude.= "(mail=$mail)";
+      }
+      if ($exclude != ""){
+        $filter.= "(!(|$exclude))";
+      }
+
+      $res= get_list("(&(objectClass=gosaMailAccount)$filter)", "users", $mailfilter['depselect'], 
+                     array("sn", "mail", "givenName"), GL_SIZELIMIT | GL_SUBSEARCH);
+      $ldap->cd($mailfilter['depselect']);
+      $ldap->search ("(&(objectClass=gosaMailAccount)$filter)", array("sn", "mail", "givenName"));
+      error_reporting (0);
+      while ($attrs= $ldap->fetch()){
+        if(preg_match('/%/', $attrs['mail'][0])){
+          continue;
+        }
+        $name= $this->make_name($attrs);
+        $mailusers[$attrs['mail'][0]]= $name."&lt;".
+          $attrs['mail'][0]."&gt;";
+      }
+      error_reporting (E_ALL | E_STRICT);
+      natcasesort ($mailusers);
+      reset ($mailusers);
+
+      /* Show dialog */
+      $smarty->assign("search_image", get_template_path('images/search.png'));
+      $smarty->assign("usearch_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.png'));
+      $smarty->assign("launchimage", get_template_path('images/small_filter.png'));
+      $smarty->assign("mailusers", $mailusers);
+      if (isset($_POST['depselect'])){
+        $smarty->assign("depselect", $_POST['depselect']);
+      }
+      $smarty->assign("deplist", $this->config->idepartments);
+      $smarty->assign("apply", apply_filter());
+      $smarty->assign("alphabet", generate_alphabet());
+      $smarty->assign("hint", print_sizelimit_warning());
+      foreach( array("depselect", "muser", "regex") as $type){
+        $smarty->assign("$type", $mailfilter[$type]);
+      }
+      $smarty->assign("hint", print_sizelimit_warning());
+
+      $display.= $smarty->fetch (get_template_path('mail_locals.tpl', TRUE, dirname(__FILE__)));
+      return ($display);
+    }
+
+    /* Display mail account tab */
+
+    $smarty->assign("mailServers", $mailserver);
+    $SkipWrite = (!isset($this->parent) || !$this->parent) && !isset($_SESSION['edit']);
+
+    $tmp  = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $transl){
+      $smarty->assign("$name"."ACL", $this->getacl($name,$SkipWrite));
+    }
+
+    foreach(array("gosaMailServer", "gosaMailQuota", "perms", "mail",
+          "gosaMailAlternateAddress", "gosaMailForwardingAddress",
+          "gosaVacationMessage", "gosaMailDeliveryMode", "gosaVacationStart",
+          "gosaVacationStop", "gosaMailMaxSize", "gosaSpamSortLevel", "gosaSpamMailbox") as $val){
+      $smarty->assign("$val", $this->$val);
+    }
+
+    if (is_numeric($this->gosaMailQuota) && $this->gosaMailQuota != 0){
+      $smarty->assign("quotausage", progressbar(round(($this->quotaUsage * 100)/ $this->gosaMailQuota),100,15,true));
+      $smarty->assign("quotadefined", "true");
+    } else {
+      $smarty->assign("quotadefined", "false");
+    }
+
+    /* Disable mail field if needed */
+    $method= new $this->method($this->config);
+    if ($method->uattrib == "mail" && $this->initially_was_account){
+      $smarty->assign("mailACL", preg_replace("/w/","",$this->getacl("mail",$SkipWrite)));
+    }
+
+    /* Disable/Enable range select, but do not disable them twice 
+     *  if they are already diabled by "use own sieve script"
+     */
+    if (preg_match('/V/', $this->gosaMailDeliveryMode) || preg_match("/C/",$this->gosaMailDeliveryMode)){
+      $smarty->assign('rangeEnabled', "");
+    } else {
+      $smarty->assign('rangeEnabled', "disabled");
+    }
+
+    if (!preg_match("/L/", $this->gosaMailDeliveryMode)) {
+      $smarty->assign("only_local", "checked");
+    } else {
+      $smarty->assign("only_local", "");
+    }
+
+    $types = array(
+          "V"=>"use_vacation",
+          "S"=>"use_spam_filter",
+          "R"=>"use_mailsize_limit",
+          "I"=>"drop_own_mails",
+          "C"=>"own_script");
+
+    /* Fill checkboxes */
+    foreach($types as $option => $varname){
+      if (preg_match("/".$option."/", $this->gosaMailDeliveryMode)) {
+        $smarty->assign($varname, "checked");
+      } else {
+        $smarty->assign($varname, "");
+      }
+    }
+   
+    /* Display mail account tab */
+    if($this->gosaVacationStart ==0){
+      $date= getdate(time());
+    }else{
+      $date= getdate($this->gosaVacationStart);
+    }
+    $days= array();
+    for($d= 1; $d<32; $d++){
+      $days[$d]= $d;
+    }
+    $years= array();
+    for($y= $date['year']-10; $y<$date['year']+10; $y++){
+      $years[]= $y;
+    }
+    $months= array(_("January"), _("February"), _("March"), _("April"),
+        _("May"), _("June"), _("July"), _("August"), _("September"),
+        _("October"), _("November"), _("December"));
+    $smarty->assign("start_day", $date["mday"]);
+    $smarty->assign("days", $days);
+    $smarty->assign("months", $months);
+    $smarty->assign("start_month", $date["mon"]-1);
+    $smarty->assign("years", $years);
+    $smarty->assign("start_year", $date["year"]);
+
+    if($this->gosaVacationStop ==0){
+      $date= getdate(time());
+      $date["mday"]++;
+    }else{
+      $date= getdate($this->gosaVacationStop);
+    }
+    $smarty->assign("end_day", $date["mday"]);
+    $smarty->assign("end_month", $date["mon"]-1);
+    $smarty->assign("end_year", $date["year"]);
+
+
+    /* Have vacation templates? */
+    $smarty->assign("template", "");
+    if (count($this->vacation)){
+      $smarty->assign("show_templates", "true");
+      $smarty->assign("vacationtemplates", $this->vacation);
+      if (isset($_POST['vacation_template'])){
+        $smarty->assign("template", $_POST['vacation_template']);
+      }
+    } else {
+      $smarty->assign("show_templates", "false");
+    }
+
+    /* Fill spam selector */
+    $spamlevel= array();
+    for ($i= 0; $i<21; $i++){
+      $spamlevel[]= $i;
+    }
+    $smarty->assign("spamlevel", $spamlevel);
+    $smarty->assign("spambox", $this->mailboxList);
+
+    $display.= $smarty->fetch (get_template_path('generic.tpl', TRUE, dirname(__FILE__)));
+    return ($display);
+  }
+
+
+  /* remove object from parent */
+  function remove_from_parent()
+  {
+    /* Cancel if there's nothing to do here */
+    if (!$this->initially_was_account){
+      return;
+    }
+    
+    /* include global link_info */
+    $ldap= $this->config->get_ldap_link();
+
+    /* Remove and write to LDAP */
+    plugin::remove_from_parent();
+
+    /* Zero arrays */
+    $this->attrs['gosaMailAlternateAddress']= array();
+    $this->attrs['gosaMailForwardingAddress']= array();
+
+    /* Adapt attributes if needed */
+    $method= new $this->method($this->config);
+    $method->fixAttributesOnRemove($this);
+
+    @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,$this->attributes, "Save");
+    $ldap->cd($this->dn);
+    $this->cleanup();
+
+    $ldap->modify ($this->attrs); 
+
+    /* Add "view" to logging class */ 
+    new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+
+    show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/mail account with dn '%s' failed."),$this->dn));
+
+    /* Connect to IMAP server for account deletion */
+    if ($this->gosaMailServer != ""){
+      $method= new $this->method($this->config);
+      $id= $method->uattrib;
+      if ($method->connect($this->gosaMailServer)){
+
+        /* Remove account from IMAP server */
+        $method->deleteMailbox($this->folder_prefix.$this->$id);
+        $method->disconnect();
+      }
+    }
+
+    /* Update shared folder membership, ACL may need to be updated */
+    $this->updateSharedFolder(); 
+
+    /* Optionally execute a command after we're done */
+    $this->handle_post_events("remove",array("uid" => $this->uid));
+  }
+
+  
+  /* check if we have some delegations configured, those delegations must be removed first */
+  function accountDelegationsConfigured()
+  { 
+    /* We are in administrational edit mode.
+        Check tab configurations directly */
+    if(isset($this->attrs)){
+      $checkArray  = array("kolabInvitationPolicy","unrestrictedMailSize", "calFBURL","kolabDelegate","kolabFreeBusyFuture");
+      foreach($checkArray as $index){
+        if(isset($this->attrs[$index])){
+           return(true);
+        }
+      }
+    }
+    return(false); 
+  }
+
+  /* Save data to object */
+  function save_object()
+  {
+    if (isset($_POST['mailTab'])){
+
+      /* Save ldap attributes */
+      plugin::save_object();
+
+
+      if(isset($_POST['own_script'])){
+
+        if(!preg_match("/C/",$this->gosaMailDeliveryMode)){
+          $str= preg_replace("/[\[\]]/","",$this->gosaMailDeliveryMode);
+          $this->gosaMailDeliveryMode = "[".$str."C]";
+        }
+
+      }else{
+
+        /* Assemble mail delivery mode
+           The mode field in ldap consists of values between braces, this must
+           be called when 'mail' is set, because checkboxes may not be set when
+           we're in some other dialog.
+
+          Example for gosaMailDeliveryMode [LR        ]
+          L: Local delivery
+          R: Reject when exceeding mailsize limit
+          S: Use spam filter
+          V: Use vacation message
+          C: Use custm sieve script
+          I: Only insider delivery */
+
+        $tmp= preg_replace("/[^a-z]/i","",$this->gosaMailDeliveryMode);
+
+
+        /* Handle delivery flags */
+        if($this->acl_is_writeable("gosaMailDeliveryModeL")){
+          if(!preg_match("/L/",$tmp) && !isset($_POST['only_local'])){
+            $tmp.="L";
+          }elseif(preg_match("/L/",$tmp) && isset($_POST['only_local'])){
+            $tmp = preg_replace("/L/","",$tmp);
+          }
+        }
+
+        $opts = array(     
+            "R"   => "use_mailsize_limit",
+            "S"   => "use_spam_filter",
+            "V"   => "use_vacation",
+            "C"   => "own_script",
+            "I"   => "drop_own_mails");
+
+        foreach($opts as $flag => $post){
+          if($this->acl_is_writeable("gosaMailDeliveryMode".$flag)){
+            if(!preg_match("/".$flag."/",$tmp) && isset($_POST[$post])){
+              $tmp.= $flag;
+            }elseif(preg_match("/".$flag."/",$tmp) && !isset($_POST[$post])){
+              $tmp = preg_replace("/".$flag."/","",$tmp);
+            }
+          }
+        }
+
+        $tmp= "[$tmp]";
+        if ($this->gosaMailDeliveryMode != $tmp){
+          $this->is_modified= TRUE;
+        }
+        $this->gosaMailDeliveryMode= $tmp;
+      }
+    }
+
+  }
+
+
+  /* Save data to LDAP, depending on is_account we save or delete */
+  function save()
+  {
+    $ldap= $this->config->get_ldap_link();
+
+    /* Call parents save to prepare $this->attrs */
+    plugin::save();
+
+    /* Save arrays */
+    $this->attrs['gosaMailAlternateAddress']= $this->gosaMailAlternateAddress;
+    $this->attrs['gosaMailForwardingAddress']= $this->gosaMailForwardingAddress;
+
+    /* Adapt attributes if needed */
+    $method= new $this->method($this->config);
+    $id= $method->uattrib;
+
+    $method->fixAttributesOnStore($this);
+
+    /* Remove Mailquota if = "" or "0"  */
+    if((isset($this->attrs['gosaMailQuota']))&&(!$this->attrs['gosaMailQuota'])) {
+      $this->attrs['gosaMailQuota']=0;
+    }
+
+    if(empty($this->attrs['gosaSpamMailbox'])){
+      unset($this->attrs['gosaSpamMailbox']);
+    }
+
+    $this->attrs['mail'] = strtolower($this->attrs['mail']); 
+
+        /* Remove attributes - if not needed */
+    if (!preg_match('/V/', $this->gosaMailDeliveryMode)){
+      unset($this->attrs['gosaVacationStart']);
+      unset($this->attrs['gosaVacationStop']);
+    }
+
+
+    /* Remove attributes - if not needed */
+    if (!preg_match('/V/', $this->gosaMailDeliveryMode)){
+      unset($this->attrs['gosaVacationStart']);
+      unset($this->attrs['gosaVacationStop']);
+    }
+
+    /* Save data to LDAP */
+    $ldap->cd($this->dn);
+    $this->cleanup();
+    $ldap->modify ($this->attrs); 
+
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/mail account with dn '%s' failed."),$this->dn));
+
+    /* Log last action */ 
+    if($this->initially_was_account){
+      new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
+
+    /* Only do IMAP actions if we are not a template */
+    if (!$this->is_template){
+
+      if ($method->connect($this->gosaMailServer)){
+        $method->updateMailbox($this->folder_prefix.$this->$id);
+        
+        $method->setQuota($this->folder_prefix.$this->$id, $this->gosaMailQuota);
+        $method->disconnect();
+
+        /* Ensure that this is an existing account */
+        if(1==1 || $this->initially_was_account){
+
+          /* Write sieve information only if not in C mode */
+          if (!is_integer(strpos($this->gosaMailDeliveryMode, "C"))){
+            $method->configureFilter($this->$id,
+                $this->gosaMailDeliveryMode,
+                $this->mail,
+                $this->gosaMailAlternateAddress,
+                $this->gosaMailMaxSize,
+                $this->gosaSpamMailbox,
+                $this->gosaSpamSortLevel,
+                $this->gosaVacationMessage);
+            $this->is_modified = TRUE;
+          }else{
+            $this->sieve_management->save();
+          }
+        }
+      }
+    }
+
+    /* 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", array("uid" => $this->uid));
+      }
+    } else {
+      $this->handle_post_events("add", array("uid" => $this->uid));
+    }
+
+    $this->updateSharedFolder();
+  }
+
+
+  /* Check formular input */
+  function check()
+  {
+    if(!$this->is_account) return(array());
+
+    $ldap= $this->config->get_ldap_link();
+
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    if(empty($this->gosaMailServer)){
+      $message[]= _("There is no valid mailserver specified, please add one in the system setup.");
+    }
+
+    /* must: mail */
+    if ($this->mail == ""){
+      $message[]= _("The required field 'Primary address' is not set.");
+    }
+    if ($this->is_template){
+      if (!is_email($this->mail, TRUE)){
+        $message[]= _("Please enter a valid email address in 'Primary address' field.");
+      }
+    } else {
+      if (!is_email($this->mail)){
+        $message[]= _("Please enter a valid email address in 'Primary address' field.");
+      }
+    }
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search ("(&(!(objectClass=gosaUserTemplate))(objectClass=gosaMailAccount)(|(mail=".$this->mail.")(gosaMailAlternateAddress=".$this->mail."))(!(uid=".$this->uid."))(!(cn=".$this->uid.")))", array("uid"));
+    if ($ldap->count() != 0){
+      $message[]= _("The primary address you've entered is already in use.");
+    }
+
+    /* Check quota */
+    if ($this->gosaMailQuota != '' && $this->acl_is_writeable("gosaMailQuota")){
+      if (!is_numeric($this->gosaMailQuota)) {
+        $message[]= _("Value in 'Quota size' is not valid.");
+      } else {
+        $this->gosaMailQuota= (int) $this->gosaMailQuota;
+      }
+    }
+
+    /* Check rejectsize for integer */
+    if ($this->gosaMailMaxSize != '' && $this->acl_is_writeable("gosaMailMaxSize")){
+      if (!is_numeric($this->gosaMailMaxSize)){
+        $message[]= _("Please specify a vaild mail size for mails to be rejected.");
+      } else {
+        $this->gosaMailMaxSize= (int) $this->gosaMailMaxSize;
+      }
+    }
+
+    /* Need gosaMailMaxSize if use_mailsize_limit is checked */
+    if (is_integer(strpos($this->gosaMailDeliveryMode, "R")) && 
+        $this->gosaMailMaxSize == ""){
+
+      $message[]= _("You need to set the maximum mail size in order to reject anything.");
+    }
+
+    if((preg_match("/S/", $this->gosaMailDeliveryMode))&&(empty($this->gosaSpamMailbox))) {
+      $message[]= _("You specified Spam settings, but there is no Folder specified.");
+    }
+
+    if (preg_match('/V/', $this->gosaMailDeliveryMode) && $this->gosaVacationStart > $this->gosaVacationStop){
+      $message[]= _("Time interval to show vacation message is not valid.");
+    }
+
+    return ($message);
+  }
+
+
+  /* Adapt from template, using 'dn' */
+  function adapt_from_template($dn)
+  {
+    plugin::adapt_from_template($dn);
+
+    foreach (array("gosaMailAlternateAddress", "gosaMailForwardingAddress") as $val){
+      $this->$val= array();
+      if (isset($this->attrs["$val"]["count"])){
+        for ($i= 0; $i<$this->attrs["$val"]["count"]; $i++){
+          $value= $this->attrs["$val"][$i];
+          foreach (array("sn", "givenName", "uid") as $repl){
+            if (preg_match("/%$repl/i", $value)){
+              $value= preg_replace ("/%$repl/i", $this->parent->$repl, $value);
+            }
+          }
+          array_push($this->$val, strtolower(rewrite($value)));
+        }
+      }
+    }
+    $this->mail= strtolower(rewrite($this->mail));
+  }
+
+
+  /* Add entry to forwarder list */
+  function addForwarder($address)
+  {
+    if($this->acl_is_writeable("gosaMailForwardingAddress")){
+      $this->gosaMailForwardingAddress[]= $address;
+      $this->gosaMailForwardingAddress= array_unique ($this->gosaMailForwardingAddress);
+      sort ($this->gosaMailForwardingAddress);
+      reset ($this->gosaMailForwardingAddress);
+      $this->is_modified= TRUE;
+    }else{
+      print_red(_("You are not allowed to write mail forwarding."));
+    }
+  }
+
+
+  /* Remove list of addresses from forwarder list */
+  function delForwarder($addresses)
+  {
+    if($this->acl_is_writeable("gosaMailForwardingAddress")){
+      $this->gosaMailForwardingAddress= array_remove_entries ($addresses, $this->gosaMailForwardingAddress);
+      $this->is_modified= TRUE;
+    }else{
+      print_red(_("You are not allowed to write mail forwarding."));
+    }
+  }
+
+
+  /* Add given mail address to the list of alternate adresses , 
+     check if this mal address is used, skip adding in this case */
+  function addAlternate($address)
+  {
+    if($this->acl_is_writeable("gosaMailAlternateAddress")){
+      $ldap= $this->config->get_ldap_link();
+      $address= strtolower($address);
+
+      /* Is this address already assigned in LDAP? */
+      $ldap->cd ($this->config->current['BASE']);
+      $ldap->search ("(&(objectClass=gosaMailAccount)(|(mail=$address)"."(gosaMailAlternateAddress=$address)))", array("uid"));
+      $ldap->search ("(&(!(objectClass=gosaUserTemplate))(objectClass=gosaMailAccount)(|(mail=$address)"."(gosaMailAlternateAddress=$address)))", array("uid"));
+
+      if ($ldap->count() > 0){
+        $attrs= $ldap->fetch ();
+        return ($attrs["uid"][0]);
+      }
+
+      /* Add to list of alternates */
+      if (!in_array($address, $this->gosaMailAlternateAddress)){
+        $this->gosaMailAlternateAddress[]= $address;
+        $this->is_modified= TRUE;
+      }
+
+      sort ($this->gosaMailAlternateAddress);
+      reset ($this->gosaMailAlternateAddress);
+      return ("");
+    }else{
+      print_red(_("You are not allowed to write mail alternate address."));
+    }
+  }
+
+
+  function delAlternate($addresses)
+  {
+    if($this->acl_is_writeable("gosaMailAlternateAddress")){
+      $this->gosaMailAlternateAddress= array_remove_entries ($addresses,$this->gosaMailAlternateAddress);
+      $this->is_modified= TRUE;
+    }else{
+      print_red(_("You are not allowed to write mail alternate address."));
+    }
+  }
+
+  function make_name($attrs)
+  {
+    $name= "";
+    if (isset($attrs['sn'][0])){
+      $name= $attrs['sn'][0];
+    }
+    if (isset($attrs['givenName'][0])){
+      if ($name != ""){
+        $name.= ", ".$attrs['givenName'][0];
+      } else {
+        $name.= $attrs['givenName'][0];
+      }
+    }
+    if ($name != ""){
+      $name.= " ";
+    }
+
+    return ($name);
+  }
+
+  
+  /* Create the mail part for the copy & paste dialog */
+  function getCopyDialog()
+  {
+    if(!$this->is_account) return("");
+    $smarty = get_smarty();
+    $smarty->assign("mail",$this->mail); 
+    $smarty->assign("gosaMailAlternateAddress",$this->gosaMailAlternateAddress);
+    $smarty->assign("gosaMailForwardingAddress",$this->gosaMailForwardingAddress);
+    $str = $smarty->fetch(get_template_path("copypaste.tpl",TRUE, dirname(__FILE__)));
+
+    $ret = array();
+    $ret['status'] = "";
+    $ret['string'] = $str;
+    return($ret);
+  }
+
+  function saveCopyDialog()
+  {
+    if(!$this->is_account) return;  
+
+    /* Execute to save mailAlternateAddress && gosaMailForwardingAddress */
+    $this->execute();
+    
+    if(isset($_POST['mail'])){
+      $this->mail = $_POST['mail'];
+    }
+
+  }
+
+  function allow_remove()
+  {
+    if (isset($this->config->current['MAILMETHOD'])){
+      $method= $this->config->current['MAILMETHOD'];
+      if(preg_match("/olab/i",$method)){
+        $ldap = $this->config->get_ldap_link();
+        $ldap->cd($this->config->current['BASE']);
+        $ldap->cat($this->dn);
+        if($ldap->count()){
+          $attrs = $ldap->fetch();
+          if(isset($attrs['kolabDeleteFlag'])){ 
+            return(_("Waiting for kolab to remove mail properties."));
+          }elseif(in_array("gosaMailAccount",$attrs['objectClass'])){
+            return(_("Please remove the mail account first, to allow kolab to call its remove methods."));
+          }
+        }
+      }
+    }
+  }
+
+   
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);
+
+    /* Reset alternate mail addresses */
+    $this->gosaMailAlternateAddress = array();    
+   }
+
+
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"     => _("Mail"),
+          "plDescription"   => _("Mail settings"),
+          "plSelfModify"    => TRUE,
+          "plDepends"       => array("user"),                     // This plugin depends on
+          "plPriority"      => 4,                                 // Position in tabs
+          "plSection"     => array("personal" => _("My account")),
+          "plCategory"    => array("users"),
+          "plOptions"       => array(),
+  
+          "plProvidedAcls"  => array(
+            "mail"                      =>  _("Mail address"),
+            "gosaMailServer"            =>  _("Mail server"),
+            "gosaMailQuota"             =>  _("Quota size"),
+
+            "gosaMailDeliveryModeV"     =>  _("Add vacation information"),  // This is flag of gosaMailDeliveryMode
+            "gosaVacationMessage"       =>  _("Vacation message"),
+
+            "gosaMailDeliveryModeS"     =>  _("Use spam filter"),           // This is flag of gosaMailDeliveryMode
+            "gosaSpamSortLevel"         =>  _("Spam level"),
+            "gosaSpamMailbox"           =>  _("Spam mail box"),
+
+            "sieveManagement"           =>  _("Sieve management"),
+
+            "gosaMailDeliveryModeR"     =>  _("Reject due to mailsize"),    // This is flag of gosaMailDeliveryMode
+            "gosaMailMaxSize"           =>  _("Mail max size"),
+
+            "gosaMailForwardingAddress" =>  _("Forwarding address"),
+            "gosaMailDeliveryModeL"     =>  _("Local delivery"),            // This is flag of gosaMailDeliveryMode
+            "gosaMailDeliveryModeI"     =>  _("No delivery to own mailbox "),     // This is flag of gosaMailDeliveryMode
+            "gosaMailAlternateAddress"  =>  _("Mail alternative addresses"),
+
+            "gosaMailForwardingAddress" =>  _("Forwarding address"),
+            "gosaMailDeliveryModeC"     =>  _("Use custom sieve script"))   // This is flag of gosaMailDeliveryMode
+        ));
+  }
+
+  /* Upated shared folder ACLs 
+   */
+  function updateSharedFolder()
+  {
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(&(objectClass=posixGroup)(objectClass=gosaMailAccount)(memberUid=".$this->uid."))",array('dn','cn'));
+    if(class_exists("grouptabs")){
+      while($attrs = $ldap->fetch()){
+        $tmp = new grouptabs($this->config, $this->config->data['TABS']['GROUPTABS'], $attrs['dn']);
+        if(isset($tmp->by_object['mailgroup'])){
+          $tmp->by_object['mailgroup']->members= $tmp->by_object['group']->memberUid;
+          if(!$this->is_account){
+            $tmp->by_object['mailgroup']->removeUserAcl($this->uid);
+            $tmp->by_object['mailgroup']->removeUserAcl($this->mail);
+          }
+          $tmp->by_object['mailgroup']->save();
+        }
+      }
+    } 
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/personal/mail/copypaste.tpl b/gosa-core/plugins/personal/mail/copypaste.tpl
new file mode 100644 (file)
index 0000000..56ec107
--- /dev/null
@@ -0,0 +1,70 @@
+<h2>{t}Mail settings{/t}</h2>
+<table style='width:100%;' cellspacing=0>
+       <tr>
+               <td style='width:50%;vertical-align:top; border-right:1px solid #AAA'>
+                       <table style="width:100%;">
+                               <tr>
+                                       <td><label for="mail">{t}Primary address{/t}</label>{$must}</td>
+                                       <td><input id="mail" name="mail" size=35 maxlength=65 value="{$mail}"></td>
+                               </tr>
+                               <tr>
+                                       <td colspan="2">
+                                               <p style="margin-bottom:0px;">
+                                                       <b><label for="forwarder_list">{t}Forward messages to{/t}</label></b>
+                                               </p>
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+               <td style="vertical-align:bottom;border-left:1px solid #A0A0A0">
+                       <table style="width:100%;">
+                               <tr>
+                                       <td style="vertical-align:top;">
+                                               <h2>
+                                                       <img class="center" alt="" align="middle" src="images/alternatemail.png" />
+                                                       <label for="alternates_list">{t}Alternative addresses{/t}</label>
+                                               </h2>
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+       </tr>
+       <tr>
+               <td>
+                       <table style='width:100%;'>
+                               <tr>
+                                       <td colspan="2">
+                                               <select id="gosaMailForwardingAddress" style="width:100%; height:100px;" name="forwarder_list[]" size=15 multiple >
+                                                               {html_options values=$gosaMailForwardingAddress output=$gosaMailForwardingAddress}
+                                                               <option disabled>&nbsp;</option>
+                                               </select>
+                                               <br>
+                                           <input name="forward_address" size=20 align="middle" maxlength=65   value="">
+                                           <input type="submit" value="{t}Add{/t}" name="add_forwarder"        >&nbsp;
+                                           <input type="submit" value="{t}Add local{/t}" name="add_local_forwarder"    >&nbsp;
+                                           <input type="submit" value="{t}Delete{/t}" name="delete_forwarder"  >
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+               <td style="vertical-align:bottom;border-left:1px solid #A0A0A0">
+                       <table style='width:100%;'>
+                               <tr>
+                                       <td colspan="2" >
+                                               <select id="alternates_list" style="width:100%;height:100px;" name="alternates_list[]" size="15"
+                                                        multiple title="{t}List of alternative mail addresses{/t}"> 
+                                                               {html_options values=$gosaMailAlternateAddress output=$gosaMailAlternateAddress}
+                                                               <option disabled>&nbsp;</option>
+                                               </select>
+                                               <br/>
+                                               <input name="alternate_address" size="30" align="middle" maxlength="65" value="">
+                                               <input type=submit value="{t}Add{/t}" name="add_alternate">
+                                               <input type=submit value="{t}Delete{/t}" name="delete_alternate">
+                                       </td>
+                               </tr>
+                       </table>
+               </td>           
+       </tr>
+</table>
+<br>
+<br>
diff --git a/gosa-core/plugins/personal/mail/generic.tpl b/gosa-core/plugins/personal/mail/generic.tpl
new file mode 100644 (file)
index 0000000..785fd44
--- /dev/null
@@ -0,0 +1,314 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding="0" border="0">
+ <tr>
+  <td style="width:50%; vertical-align:top;">
+
+   <h2><img class="center" alt="" align="middle" src="images/rightarrow.png" />&nbsp;{t}Generic{/t}</h2>
+   <table summary="">
+    <tr>
+     <td><label for="mail">{t}Primary address{/t}</label>{$must}</td>
+     <td>
+{render acl=$mailACL}
+       <input id="mail" name="mail" size=35 maxlength=65 value="{$mail}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><label for="gosaMailServer">{t}Server{/t}</label></td>
+     <td>
+{render acl=$gosaMailServerACL}
+      <select size="1" id="gosaMailServer" name="gosaMailServer" title="{t}Specify the mail server where the user will be hosted on{/t}">
+       {html_options values=$mailServers output=$mailServers selected=$gosaMailServer}
+       <option disabled>&nbsp;</option>
+      </select>
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td>
+      <br>
+      {t}Quota usage{/t}
+     </td>
+     <td>
+      <br>
+      {if $quotadefined eq "true"}
+       {$quotausage}
+      {else}
+      {t}not defined{/t}
+      {/if}
+     </td>
+    </tr>
+    <tr>
+     <td><label for="gosaMailQuota">{t}Quota size{/t}</label></td>
+     <td>
+{render acl=$gosaMailQuotaACL}
+      <input id="gosaMailQuota" name="gosaMailQuota" size="6" align="middle" maxlength="60" 
+               value="{$gosaMailQuota}"> MB
+{/render}
+     </td>
+    </tr>
+       </table>
+  </td>
+
+
+  <td style="border-left:1px solid #A0A0A0;vertical-align:top;">
+       &nbsp;
+  </td>
+       <td>    
+   <h2><img class="center" alt="" align="middle" src="images/alternatemail.png" /><label for="alternates_list"> {t}Alternative addresses{/t}</label></h2>
+{render acl=$gosaMailAlternateAddressACL}
+   <select id="alternates_list" style="width:100%;height:100px;" name="alternates_list[]" size="15" multiple 
+       title="{t}List of alternative mail addresses{/t}">
+       {html_options values=$gosaMailAlternateAddress output=$gosaMailAlternateAddress}
+       <option disabled>&nbsp;</option>
+{/render}
+   </select>
+   <br />
+{render acl=$gosaMailAlternateAddressACL}
+   <input name="alternate_address" size="30" align="middle" maxlength="65" value="">
+{/render}
+{render acl=$gosaMailAlternateAddressACL}
+   <input type=submit value="{t}Add{/t}" name="add_alternate">
+{/render}
+{render acl=$gosaMailAlternateAddressACL}
+   <input type=submit value="{t}Delete{/t}" name="delete_alternate">
+{/render}
+  </td>
+ </tr>
+</table>
+<!-- SIEVE -->
+<p class="seperator">&nbsp;</p>
+<h2><img class="center" alt="" align="middle" src="images/envelope.png" />&nbsp;{t}Mail options{/t}</h2>
+<table summary="" style="vertical-align:top; text-align:left;" cellpadding=4 border=0>
+ <tr>
+  <td>
+{render acl=$gosaMailDeliveryModeCACL}
+   <input type=checkbox name="own_script" value="1" {$own_script} 
+               onClick="       
+                       changeState('sieveManagement');
+                       changeState('drop_own_mails');
+                       changeState('use_vacation');
+                       changeState('use_spam_filter');
+                       changeState('use_mailsize_limit');
+                       changeState('import_vacation');
+                       changeState('vacation_template');
+//                     changeState('forward_address');
+//                     changeState('add_forwarder');
+//                     changeState('add_local_forwarder');
+//                     changeState('delete_forwarder');
+                       changeState('only_local');
+                       changeState('gosaVacationMessage');
+                       changeState('gosaSpamSortLevel');
+                       changeState('gosaSpamMailbox');
+                       changeState('gosaMailMaxSize');
+                       changeStates();
+
+               "
+
+> {t}Use custom sieve script{/t} <b>({t}disables all Mail options!{/t})</b>
+{/render}
+  </td>
+ </tr>
+ <tr>
+  <td>
+{render acl=$sieveManagementACL}       
+   <input {if $own_script == ""} disabled {/if} id='sieveManagement' type='submit' name='sieveManagement' value='{t}Sieve Management{/t}'>
+{/render}
+  </td>
+ </tr>
+</table>
+
+
+<p class="seperator">&nbsp;</p>
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4 border=0>
+ <tr style="padding-bottom:0px;">
+  <td style="width:50%">
+{render acl=$gosaMailDeliveryModeIACL}
+   <input {if $own_script != ""} disabled {/if} id='drop_own_mails' type=checkbox name="drop_own_mails" value="1" {$drop_own_mails} title="{t}Select if you want to forward mails without getting own copies of them{/t}"> {t}No delivery to own mailbox{/t}
+{/render}
+
+<br>
+{render acl=$gosaMailDeliveryModeVACL}
+ <input type=checkbox name="use_vacation" value="1" {$use_vacation} id="use_vacation" {if $own_script != ""} disabled {/if}
+    title="{t}Select to automatically response with the vacation message defined below{/t}"
+onclick="changeState('day'); changeState('month'); changeState('year'); changeState('sday'); changeState('smonth'); changeState('syear');
+"> {t}Activate vacation message{/t}
+{/render}
+
+   <br>
+
+    <table>
+         <tr>
+          <td>
+    {t}from{/t}
+          </td>
+          <td>
+{render acl=$gosaVacationMessageACL}
+    <select {if $own_script != ""} disabled {/if} name=day id="day" onChange="createResult(this.form,this.form.gosaVacationStart);" {$rangeEnabled}>
+        {html_options values=$days output=$days selected=$start_day}
+    </select>
+{/render}
+{render acl=$gosaVacationMessageACL}
+    <select  {if $own_script != ""} disabled {/if} name=month id="month" onChange="populate(this.form,this.form.gosaVacationStart);" {$rangeEnabled}>
+        {html_options options=$months selected=$start_month}
+    </select>
+{/render}
+{render acl=$gosaVacationMessageACL}
+    <select  {if $own_script != ""} disabled {/if} name=year id="year" onChange="populate(this.form,this.form.gosaVacationStart);" {$rangeEnabled}>
+        {html_options values=$years output=$years selected=$start_year}
+    </select>
+{/render}
+    <input type="hidden" name="gosaVacationStart" value="{$gosaVacationStart}">
+          </td>
+         </tr>
+         <tr>
+          <td>
+    {t}till{/t}
+          </td>
+          <td>
+{render acl=$gosaVacationMessageACL}
+    <select  {if $own_script != ""} disabled {/if} name=sday id="sday" onChange="createResult2(this.form,this.form.gosaVacationStop);" {$rangeEnabled}>
+        {html_options values=$days output=$days selected=$end_day}
+    </select>
+{/render}
+{render acl=$gosaVacationMessageACL}
+    <select  {if $own_script != ""} disabled {/if} name=smonth id="smonth" onChange="populate2(this.form,this.form.gosaVacationStop);" {$rangeEnabled}>
+        {html_options options=$months selected=$end_month}
+    </select>
+{/render}
+{render acl=$gosaVacationMessageACL}
+    <select {if $own_script != ""} disabled {/if}  name=syear id="syear" onChange="populate2(this.form,this.form.gosaVacationStop);" {$rangeEnabled}>
+        {html_options values=$years output=$years selected=$end_year}
+    </select>
+{/render}
+    <input type="hidden" name="gosaVacationStop" value="{$gosaVacationStop}">
+          </td>
+         </tr>
+        </table>
+
+
+   <td rowspan=2 style="border-left:1px solid #A0A0A0">
+   &nbsp;
+  </td>
+  <td style="vertical-align:top;">
+{render acl=$gosaMailDeliveryModeSACL}
+   <input {if $own_script != ""} disabled {/if} id='use_spam_filter' type=checkbox name="use_spam_filter" value="1" {$use_spam_filter} title="{t}Select if you want to filter this mails through spamassassin{/t}">
+{/render}
+ <label for="gosaSpamSortLevel">{t}Move mails tagged with spam level greater than{/t}</label>
+       
+{render acl=$gosaSpamSortLevelACL}
+   <select {if $own_script != ""} disabled {/if} id="gosaSpamSortLevel" size="1" name="gosaSpamSortLevel" title="{t}Choose spam level - smaller values are more sensitive{/t}">
+        {html_options values=$spamlevel output=$spamlevel selected=$gosaSpamSortLevel}
+   </select>
+{/render}
+   <label for="gosaSpamMailbox">{t}to folder{/t}</label>
+{render acl=$gosaSpamMailboxACL}
+   <select {if $own_script != ""} disabled {/if} size="1" id="gosaSpamMailbox" name="gosaSpamMailbox">
+               {html_options values=$spambox output=$spambox selected=$gosaSpamMailbox}
+                       <option disabled>&nbsp;</option>
+   </select>
+{/render}
+   <br>
+{render acl=$gosaMailDeliveryModeRACL}
+   <input {if $own_script != ""} disabled {/if} id='use_mailsize_limit' type=checkbox name="use_mailsize_limit" value="1" {$use_mailsize_limit} >
+{/render}
+       <label for="gosaMailMaxSize">{t}Reject mails bigger than{/t}</label> 
+{render acl=$gosaMailMaxSizeACL}
+   <input {if $own_script != ""} disabled {/if} id="gosaMailMaxSize" name="gosaMailMaxSize" size="6" align="middle" maxlength="30" value="{$gosaMailMaxSize}"> {t}MB{/t}
+{/render}
+  </td>
+ </tr>
+ <tr>
+  <td style="vertical-align:top; width:45%">
+   <p style="margin-bottom:0px;">
+    <b><label for="gosaVacationMessage">{t}Vacation message{/t}</label></b>
+   </p>
+{render acl=$gosaVacationMessageACL}
+   <textarea {if $own_script != ""} disabled {/if} id="gosaVacationMessage" style="width:99%; height:100px;" name="gosaVacationMessage" rows="4" cols="512">{$gosaVacationMessage}</textarea>
+{/render}
+   <br>
+
+   {if $show_templates eq "true"}
+{render acl=$gosaVacationMessageACL}
+   <select id='vacation_template' name="vacation_template" {if $own_script != ""} disabled {/if}>
+               {html_options options=$vacationtemplates selected=$template}
+               <option disabled>&nbsp;</option>
+   </select>
+{/render}
+{render acl=$gosaVacationMessageACL}
+   <input {if $own_script != ""} disabled {/if} id='import_vacation' type="submit" value="{t}Import{/t}" name="import_vacation">
+{/render}
+   {/if}
+  </td>
+  <td>
+   <p style="margin-bottom:0px;">
+    <b><label for="forwarder_list">{t}Forward messages to{/t}</label></b>
+   </p>
+{render acl=$gosaMailForwardingAddressACL}
+   <select id="gosaMailForwardingAddress" style="width:100%; height:100px;" name="forwarder_list[]" size=15 multiple>
+                       {html_options values=$gosaMailForwardingAddress output=$gosaMailForwardingAddress selected=$template}        
+                       <option disabled>&nbsp;</option>
+   </select>
+{/render}
+   <br>
+{render acl=$gosaMailForwardingAddressACL}
+   <input id='forward_address' name="forward_address" size=20 align="middle" maxlength=65 value="">
+{/render}
+{render acl=$gosaMailForwardingAddressACL}
+   <input id='add_forwarder' type="submit" value="{t}Add{/t}" name="add_forwarder" >&nbsp;
+{/render}
+{render acl=$gosaMailForwardingAddressACL}
+   <input id='add_local_forwarder' type="submit" value="{t}Add local{/t}" name="add_local_forwarder" >&nbsp;
+{/render}
+{render acl=$gosaMailForwardingAddressACL}
+   <input id='delete_forwarder' type="submit" value="{t}Delete{/t}" name="delete_forwarder">
+{/render}
+  </td>
+ </tr>
+</table>
+<p class="seperator">&nbsp;</p>
+
+<h2><img class="center" alt="" align="middle" src="images/false.png" />&nbsp;{t}Advanced mail options{/t}</h2>
+
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding="4" border="0">
+ <tr>
+  <td>
+{render acl=$gosaMailDeliveryModeLACL}
+   <input {if $own_script != ""} disabled {/if} id='only_local' type=checkbox name="only_local" value="1" {$only_local} title="{t}Select if user can only send and receive inside his own domain{/t}">
+{/render}
+   {t}User is only allowed to send and receive local mails{/t}
+  </td>
+ </tr>
+</table>
+
+<input type="hidden" name="mailTab" value="mailTab">
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+
+       {literal}
+       function changeStates()
+       {
+
+               if(document.getElementById('use_vacation').checked){
+                       changeState('day');
+                       changeState('month');
+                       changeState('year');
+                       changeState('sday');
+                       changeState('smonth');
+                       changeState('syear');
+               }else{
+                       changeSubselectState('use_vacation','day');
+                       changeSubselectState('use_vacation','month');
+                       changeSubselectState('use_vacation','year');
+                       changeSubselectState('use_vacation','sday');
+                       changeSubselectState('use_vacation','smonth');
+                       changeSubselectState('use_vacation','syear');
+               }
+       }
+
+       {/literal}
+
+<!-- // First input field on page
+       focus_field('mail');
+  -->
+</script>
diff --git a/gosa-core/plugins/personal/mail/mail_locals.tpl b/gosa-core/plugins/personal/mail/mail_locals.tpl
new file mode 100644 (file)
index 0000000..d277ceb
--- /dev/null
@@ -0,0 +1,81 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
+  <tr>
+    <td style="vertical-align:top;width:600px">
+      <div class="contentboxh" style="height:20px;">
+        <p class="contentboxh" style="font-size:12px">
+          <b>
+            <LABEL for="local_list">{t}Select addresses to add{/t}</LABEL> 
+            {$hint}
+          </b>
+          <br>
+        </p>
+      </div>
+      <div class="contentboxb">
+        <p class="contentboxb" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+          <select id="local_list" style="width:600px; margin-top:4px; height:450px;" name="local_list[]" size="15" multiple>
+                 {html_options options=$mailusers}
+          </select>
+        </p>
+      </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" style="background-color:#F8F8F8">
+        <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>
+              <LABEL for="depselect">{t}Select department{/t}</LABEL>
+              <img alt="" src="{$tree_image}" align=middle>&nbsp;
+              <select id="depselect" name="depselect" size=1 onChange="mainform.submit()" 
+                title="{t}Choose the department the search will be based on{/t}">
+                      {html_options options=$deplist selected=$depselect}
+                  </select>
+            </td>
+          </tr>
+        </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">
+            </td>
+            <td>
+              <input type='text' name='regex' maxlength='20' style="width:99%" value='{$regex}' 
+                title='{t}Regular expression for matching addresses{/t}' onChange="mainform.submit()">
+            </td>
+          </tr>
+        </table>
+
+        <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+          <tr>
+            <td style="width:18px;">
+              <img src="{$usearch_image}" align=middle alt="{t}Display addresses of user{/t}">
+            </td>
+            <td>
+              <input type='text' name='muser' maxlength='20' style="width:99%" value='{$muser}' 
+                title='{t}User name of which addresses are shown{/t}' onChange="mainform.submit()">
+            </td>
+          </tr>
+        </table>
+        {$apply}
+      </div>
+    </td>
+  </tr>
+</table>
+
+<p class="plugbottom">
+  <input type=submit name="add_locals_finish" value="{t}Add{/t}">
+  &nbsp;
+  <input type=submit name="add_locals_cancel" value="{t}Cancel{/t}">
+</p>
+<!-- 
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+-->
diff --git a/gosa-core/plugins/personal/mail/main.inc b/gosa-core/plugins/personal/mail/main.inc
new file mode 100644 (file)
index 0000000..dda8cd7
--- /dev/null
@@ -0,0 +1,130 @@
+<?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
+ */
+
+$lock_msg ="";
+$display  =""; 
+if (!$remove_lock){
+  /* Reset requested? */
+  if (isset($_POST['edit_cancel']) || 
+      (isset($_GET['reset']) && $_GET['reset'] == 1)){
+    del_lock ($ui->dn);
+    sess_del ('edit');
+    sess_del ('mailAccount');
+  }
+
+  /* Create mail object on demand */
+  if (!isset($_SESSION['mailAccount']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+    $_SESSION['mailAccount']= new mailAccount ($config, $ui->dn);
+    $_SESSION['mailAccount']->enable_CSN_check();
+    $_SESSION['mailAccount']->set_acl_base($ui->dn);
+    $_SESSION['mailAccount']->set_acl_category("users");
+  }
+  $mailAccount= $_SESSION['mailAccount'];
+
+  /* save changes back to object */
+  if (isset ($_SESSION['edit'])){
+    $mailAccount->save_object ();
+  }
+
+  /* Enter edit mode? */
+  if (isset($_POST['edit']) && preg_match("/w/",$ui->get_permissions($ui->dn,"users/mailAccount"))){
+
+    /* Check locking */
+    if (($username= get_lock($ui->dn)) != ""){
+      $_SESSION['back_plugin']= $plug;
+      $_SESSION['LOCK_VARS_TO_USE'] = array("/^edit$/","/^plug$/");
+      $lock_msg =  gen_locked_message ($username, $ui->dn);
+
+    }else{
+
+      /* Lock the current entry */
+      add_lock ($ui->dn, $ui->dn);
+      $_SESSION['dn']= $ui->dn;
+      $_SESSION['edit']= TRUE;
+    }
+  }
+
+  /* save changes to LDAP and disable edit mode */
+  if (isset($_POST['edit_finish'])){
+
+    /* Perform checks */
+    $message= $mailAccount->check ();
+
+    /* No errors, save object */
+    if (count ($message) == 0){
+      $mailAccount->save ();
+      del_lock ($ui->dn);
+      sess_del ('edit');
+
+      /* Remove object */
+      sess_del ('mailAccount');
+    } else {
+      /* Errors found, show message */
+      show_errors ($message);
+    }
+  }
+
+  /* Execute formular */
+  if($lock_msg){
+    $display.= $lock_msg;
+  }else{
+    $display.= $mailAccount->execute ();
+  }
+
+  /* Store changes  in session */
+  if (isset ($_SESSION['edit'])){
+    $_SESSION['mailAccount']= $mailAccount;
+  }
+
+  $info= "";
+  /* Show page footer depending on the mode */
+  if (!$mailAccount->forward_dialog && $mailAccount->is_account && empty($lock_msg)){
+    $display.= "<p class=\"plugbottom\">";
+
+    /* Are we in edit mode? */
+    if (isset($_SESSION['edit'])){
+      $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
+      $display.= "&nbsp;";
+      $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+      $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png').
+             "\"> ".$ui->dn."&nbsp;";
+    } else {
+      $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/openlock.png').
+             "\"> ".$ui->dn."&nbsp;";
+      
+        $info.= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/lamp.png').
+            "\"> "._("Click the 'Edit' button below to change informations in this dialog");
+
+        if(preg_match("/w/",$ui->get_permissions($ui->dn,"users/mailAccount"))){
+          $display.= "<input type=submit name=\"edit\" value=\""._("Edit")."\">\n";
+        }
+
+      $display.= "<input type=\"hidden\" name=\"ignore\">\n";
+    }
+    $display.= "</p>\n";
+  }
+
+  /* Page header*/
+  $display= print_header(get_template_path('images/email.png'), _("User mail settings"), $info).$display;
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/personal/mail/sieve-discard.txt b/gosa-core/plugins/personal/mail/sieve-discard.txt
new file mode 100644 (file)
index 0000000..8ac4db6
--- /dev/null
@@ -0,0 +1,3 @@
+# Do not deliver to own mailbox
+discard;
+
diff --git a/gosa-core/plugins/personal/mail/sieve-header.txt b/gosa-core/plugins/personal/mail/sieve-header.txt
new file mode 100644 (file)
index 0000000..5222282
--- /dev/null
@@ -0,0 +1,3 @@
+###GOSA
+require ["fileinto", "reject", "vacation"];
+
diff --git a/gosa-core/plugins/personal/mail/sieve-mailsize.txt b/gosa-core/plugins/personal/mail/sieve-mailsize.txt
new file mode 100644 (file)
index 0000000..de639c2
--- /dev/null
@@ -0,0 +1,17 @@
+#  Reject mails with bigger size
+if size :over {$maxsize}M{
+        reject text:
+Dear sender,
+
+the mail you sent to our mailsystem has been rejected due
+to a user configured maximum mail size ($maxsize MB).
+
+Either ask the user to remove the sizelimit, or send smaller pieces.
+
+Thank you,
+ the mailserver
+.
+        ;
+        discard;
+}
+
diff --git a/gosa-core/plugins/personal/mail/sieve-spam.txt b/gosa-core/plugins/personal/mail/sieve-spam.txt
new file mode 100644 (file)
index 0000000..63392d0
--- /dev/null
@@ -0,0 +1,5 @@
+# Sort mails with higher spam level
+if header :contains "X-Spam-Level" "$spamlevel" {
+  fileinto "$spambox";
+}
+
diff --git a/gosa-core/plugins/personal/mail/sieve-vacation.txt b/gosa-core/plugins/personal/mail/sieve-vacation.txt
new file mode 100644 (file)
index 0000000..3aed3a9
--- /dev/null
@@ -0,0 +1,4 @@
+# Vacation message
+vacation :addresses [$addrlist]
+"$vacmsg" ;
+
diff --git a/gosa-core/plugins/personal/nagios/class_nagiosAccount.inc b/gosa-core/plugins/personal/nagios/class_nagiosAccount.inc
new file mode 100644 (file)
index 0000000..41b2de3
--- /dev/null
@@ -0,0 +1,313 @@
+<?php
+
+/*! \brief   mail plugin
+  \author  Guillame Delecourt <guillaume@opensides.be>
+  \author  Benoit Mortier <benoit.mortier@opensides.be>
+  \author  Vincent Seynhaeve <vincent@opensides.be>  
+  \version 1.00
+  \date    25.09.2005
+
+  This class provides the functionality to read and write all attributes
+  relevant for nagiosAccount from/to the LDAP. It does syntax checking
+  and displays the formulars required.
+ */
+
+class nagiosAccount extends plugin
+{
+  /* Definitions */
+  var $plHeadline= "Nagios";
+  var $plDescription= "This does something";
+
+  /* CLI vars */
+  var $cli_summary= "Manage users nagios account";
+  var $cli_description= "Manage Account and autorization\nfor Nagios";
+  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* plugin specific values */
+  var $NagiosAlias  = "";
+  var $NagiosPager  = "";
+  var $NagiosMail   = "";
+
+  var $HostNotificationOptions      = "";
+  var $HostNotificationPeriod       = "";
+  var $ServiceNotificationPeriod    = "";
+  var $ServiceNotitificationPeriod  = "";
+  var $HostNotificationCommands     = "";
+  var $ServiceNotificationCommands  = "";
+  var $HostNotitificationOptions    = "";
+  var $ServiceNotificationOptions   = "";
+
+  var $AuthorizedAllHosts                 = "unchecked";
+  var $AuthorizedAllServices              = "unchecked";
+  var $AuthorizedSystemCommands           = "unchecked";
+  var $AuthorizedAllHostCommands          = "unchecked";
+  var $AuthorizedAllServiceCommands       = "unchecked";
+  var $AuthorizedConfigurationInformation = "unchecked";
+  var $AuthorizedSystemInformation        = "unchecked";
+
+  /* attribute list for save action */
+
+  var $attributes= array("NagiosAlias", "NagiosPager", "NagiosMail", "HostNotificationPeriod",
+      "ServiceNotificationPeriod", "HostNotificationCommands", "ServiceNotificationCommands",
+      "HostNotificationOptions", "ServiceNotificationOptions", "AuthorizedAllHosts", "AuthorizedAllServices",
+      "AuthorizedSystemCommands", "AuthorizedAllHostCommands", "AuthorizedAllServiceCommands",
+      "AuthorizedConfigurationInformation", "AuthorizedSystemInformation");
+
+  var $is_chk_box = array("AuthorizedAllHosts","AuthorizedAllServices","AuthorizedSystemCommands",
+      "AuthorizedAllHostCommands","AuthorizedAllServiceCommands",
+      "AuthorizedConfigurationInformation","AuthorizedSystemInformation");
+
+  var $objectclasses= array("nagiosContact","nagiosAuth");
+
+  var $uid = "";
+  var $view_logged = FALSE;
+
+  /* constructor, if 'dn' is set, the node loads the given
+     'dn' from LDAP */
+  function nagiosAccount (&$config, $dn= NULL)
+  {
+    /* Configuration is fine, allways */
+    $this->config= $config;
+
+    plugin::plugin ($config, $dn);
+
+    /* Setting uid to default */
+    if(isset($this->attrs['uid'][0])){
+      $this->uid = $this->attrs['uid'][0];
+    }
+
+    /* Save initial account state */  
+    $this->initially_was_account= $this->is_account;
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* Log view */
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","users/".get_class($this),$this->dn);
+    }
+
+    /* Load templating engine */
+    $smarty= get_smarty();
+    $display= "";
+
+    /* 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;
+      }
+    }    
+
+    /* Do we represent a valid account? */
+    if (!$this->is_account && $this->parent === NULL){
+      $display= "<img alt=\"\"src=\"images/stop.png\" align=\"middle\">&nbsp;<b>".
+        _("This account has no nagios extensions.")."</b>";
+
+      $display.= back_to_main();
+      return ($display);
+    }
+
+    /* Show tab dialog headers */
+    if ($this->parent !== NULL){
+      if ($this->is_account){
+        $display= $this->show_disable_header(_("Remove nagios account"),
+            _("This account has nagios features enabled. You can disable them by clicking below."));
+      } else {
+        $display= $this->show_enable_header(_("Create nagios account"), _("This account has nagios features disabled. You can enable them by clicking below."));
+        return($display);
+      }
+    }
+
+    /* Assign acls */
+    $tmp = $this->plInfo();
+    $SkipWrite = (!isset($this->parent) || !$this->parent) && !isset($_SESSION['edit']);
+    foreach($tmp['plProvidedAcls'] as $acl => $desc){
+      $smarty->assign($acl."ACL",$this->getacl($acl,$SkipWrite));
+    }
+
+    /* Assign attributes an ACL to smarty */
+    foreach($this->attributes as $val) { 
+      $smarty->assign("$val", $this->$val);
+      if(in_array($val,$this->is_chk_box)){
+        if($this->$val == "checked"){
+          $smarty->assign($val."CHK", " checked ");
+        }else{
+          $smarty->assign($val."CHK", "");
+        }
+      }
+    }
+    $smarty->assign('ServiceNotificationOptionsValues'  ,array("d,u,r,v"=>"d,u,r,v" ,"d,u,r"=>"d,u,r" ,"d,u"=>"d,u"));
+    $smarty->assign('HostNotificationOptionsValues'     ,array("w,u,c,r"=>"w,u,c,r" ,"w,u,c"=>"w,u,c" ,"c,w"=>"c,w"));
+    $smarty->assign('ServiceNotificationPeriodValues'   ,array("24x7"=>"24x7" ,"24x5"=>"24x5" ,"8x5"=>"8x5"));
+    $smarty->assign('HostNotificationPeriodValues'      ,array("24x7"=>"24x7" ,"24x5"=>"24x5" ,"8x5"=>"8x5"));
+    $display.= $smarty->fetch (get_template_path('nagios.tpl', TRUE, dirname(__FILE__)));
+    return ($display);
+  }
+
+  /* Save to LDAP */
+  function save()
+  {
+    $ldap= $this->config->get_ldap_link();
+
+    /* Call parents save to prepare $this->attrs */
+    plugin::save();
+
+    /* Adapt attributes if needed */
+    //$method= new $this->method($this->config);
+    //$id= $method->uattrib;
+    //$method->fixAttributesOnStore($this);
+
+    /* Write back to ldap */
+    $ldap->cd($this->dn);
+    $this->cleanup();
+    $ldap->modify ($this->attrs); 
+
+    /* Log last action */
+    if($this->initially_was_account){
+      new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
+
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/nagios account 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",array("uid" => $this->uid));
+      }
+    } else {
+      $this->handle_post_events("add", array("uid" => $this->uid));
+    }
+  }
+
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    $ldap= $this->config->get_ldap_link();
+    /* must: mail */
+    if ($this->NagiosAlias == ""){
+      $message[]= _("The required field 'NagiosAlias' is not set.");
+    }
+    if ($this->NagiosMail == ""){
+      $message[]= _("The required field 'NagiosMail' is not set.");
+    }
+    if ($this->is_template){
+      if (!is_email($this->NagiosMail, TRUE)){
+        $message[]= _("Please enter a valid email address in 'NagiosMail' field.");
+      }
+    } else {
+      if (!is_email($this->NagiosMail)){
+        $message[]= _("Please enter a valid email address in 'NagiosMail' field.");
+      }
+    }
+    return($message);
+  }
+
+
+  /* Use Save_object for every Post handling */
+  function save_object()
+  {
+    if (isset($_POST['nagiosTab'])){
+      /* Save ldap attributes */
+      plugin::save_object();
+
+      /* Specialhandling for checkboxes */
+      foreach($this->is_chk_box as $val){
+        if($this->acl_is_writeable($val)){
+          if(isset($_POST[$val])){
+            $this->$val = "checked";
+          }else{
+            $this->$val = "unchecked";
+          }
+        }
+      }
+    }
+  }
+
+  function remove_from_parent()
+  {
+    /* Cancel if there's nothing to do here */
+    if (!$this->initially_was_account){
+      return;
+    }
+
+    /* include global link_info */
+    $ldap= $this->config->get_ldap_link();
+
+    /* Remove and write to LDAP */
+    plugin::remove_from_parent();
+
+    /* Adapt attributes if needed */
+    //     $method= new $this->method($this->config);
+    //     $method->fixAttributesOnRemove($this);
+
+    @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
+        $this->attributes, "Save");
+    $ldap->cd($this->dn);
+    $this->cleanup();
+    $ldap->modify ($this->attrs); 
+
+    new log("view","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+
+    show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/nagios account with dn '%s' failed."),$this->dn));
+
+    /* remove the entry from LDAP */
+    unset ($this->attrs['uid']);
+
+    /* Optionally execute a command after we're done */
+    $this->handle_post_events('remove',array("uid" => $this->uid));
+  }
+
+
+
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"     => _("Nagios"),
+          "plDescription"   => _("Nagios account settings"),
+          "plSelfModify"    => TRUE,
+          "plDepends"       => array("user"),
+          "plPriority"      => 8,                                 // Position in tabs
+          "plSection"     => array("personal" => _("My account")),
+          "plCategory"    => array("users"),
+          "plOptions"       => array(),
+
+          "plProvidedAcls"  => array(
+
+            "NagiosAlias"                       =>  _("Alias"),
+            "NagiosPager"                       =>  _("Pager number"),
+            "NagiosMail"                        =>  _("Mail address"),
+
+            "HostNotificationCommands"          =>  _("Host notification commands"),
+            "HostNotificationOptions"           =>  _("Host notification options"),
+            "HostNotificationPeriod"            =>  _("Host notification period"),
+
+            "ServiceNotificationCommands"       =>  _("Service notification commands"),
+            "ServiceNotificationOptions"        =>  _("Service notification options"),
+            "ServiceNotificationPeriod"         =>  _("Service notification period"),
+
+            "AuthorizedAllHosts"                =>  _("View all hosts"),
+            "AuthorizedAllServices"             =>  _("View all services"),
+
+            "AuthorizedSystemCommands"          =>  _("Trigger system commands"),
+            "AuthorizedAllHostCommands"         =>  _("Trigger all host commands"),
+            "AuthorizedAllServiceCommands"      =>  _("Trigger all service commands"),
+
+            "AuthorizedConfigurationInformation"=>  _("View configuration information"),
+            "AuthorizedSystemInformation"       =>  _("View system informations"))
+      ));
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+
+?>
diff --git a/gosa-core/plugins/personal/nagios/main.inc b/gosa-core/plugins/personal/nagios/main.inc
new file mode 100644 (file)
index 0000000..c6a61b3
--- /dev/null
@@ -0,0 +1,129 @@
+<?php
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2005  Benoit Mortier
+
+   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
+ */
+
+$display    = "";
+$lock_msg   = "";
+
+if (!$remove_lock){
+  /* Reset requested? */
+  if (isset($_POST['edit_cancel']) || 
+      (isset($_GET['reset']) && $_GET['reset'] == 1)){
+    del_lock ($ui->dn);
+    sess_del ('edit');
+    sess_del ('nagiosAccount');
+  }
+
+  /* Create mail object on demand */
+  if (!isset($_SESSION['nagiosAccount']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+    $_SESSION['nagiosAccount']= new nagiosAccount ($config, $ui->dn);
+    $_SESSION['nagiosAccount']->enable_CSN_check();
+    $_SESSION['nagiosAccount']->set_acl_base($ui->dn);
+    $_SESSION['nagiosAccount']->set_acl_category("users");
+  }
+  $nagiosAccount= $_SESSION['nagiosAccount'];
+
+  /* save changes back to object */
+  if (isset ($_SESSION['edit'])){
+    $nagiosAccount->save_object ();
+  }
+
+  /* Enter edit mode? */
+  if (isset($_POST['edit'])){
+
+    /* Check locking */
+    if (($username= get_lock($ui->dn)) != ""){
+      $_SESSION['back_plugin']= $plug;
+      $_SESSION['LOCK_VARS_TO_USE'] = array("/^edit$/","/^plug$/");
+      $lock_msg =  gen_locked_message ($username, $ui->dn);
+
+    }else{
+
+      /* Lock the current entry */
+      add_lock ($ui->dn, $ui->dn);
+      $_SESSION['dn']= $ui->dn;
+      $_SESSION['edit']= TRUE;
+    }
+  }
+
+  /* save changes to LDAP and disable edit mode */
+  if (isset($_POST['edit_finish'])){
+
+    /* Perform checks */
+    $message= $nagiosAccount->check ();
+
+    /* No errors, save object */
+    if (count ($message) == 0){
+      $nagiosAccount->save ();
+      del_lock ($ui->dn);
+      sess_del ('edit');
+
+      /* Remove object */
+      sess_del ('nagiosAccount');
+    } else {
+      /* Errors found, show message */
+      show_errors ($message);
+    }
+  }
+
+  /* Execute formular */
+  if($lock_msg){
+    $display.= $lock_msg;
+  }else{
+    $display.= $nagiosAccount->execute ();
+  }
+
+  /* Store changes  in session */
+  if (isset ($_SESSION['edit'])){
+    $_SESSION['nagiosAccount']= $nagiosAccount;
+  }
+
+  $info= "";
+  /* Show page footer depending on the mode */
+  if ($nagiosAccount->is_account && empty($lock_msg)){
+    $display.= "<p class=\"plugbottom\">";
+
+    /* Are we in edit mode? */
+    if (isset($_SESSION['edit'])){
+      $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
+      $display.= "&nbsp;";
+      $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+      $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png').
+             "\"> ".$ui->dn."&nbsp;";
+    } else {
+      $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/openlock.png').
+             "\"> ".$ui->dn."&nbsp;";
+
+      if(preg_match("/w/",$ui->get_permissions($ui->dn,"users/nagiosAccount"))){
+        $info.= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/lamp.png').
+          "\"> "._("Click the 'Edit' button below to change informations in this dialog");
+        $display.= "<input type=submit name=\"edit\" value=\""._("Edit")."\">\n";
+      }
+      $display.= "<input type=\"hidden\" name=\"ignore\">\n";
+    }
+    $display.= "</p>\n";
+  }
+
+  /* Page header*/
+  $display= print_header(get_template_path('images/monitoring.png'), _("Nagios settings"), $info).$display;
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/personal/nagios/nagios.tpl b/gosa-core/plugins/personal/nagios/nagios.tpl
new file mode 100644 (file)
index 0000000..e77529a
--- /dev/null
@@ -0,0 +1,192 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding="0" border="0">
+ <tr>
+  <td style="width:50%; vertical-align:top;">
+   <h2>
+    <img class="center" alt="" align="middle" src="images/rightarrow.png" />&nbsp;{t}Nagios Account{/t}</h2>
+   <table summary="">
+    <tr>
+     <td><label for="NagiosAlias">{t}Alias{/t}</label>{$must}</td>
+     <td>
+{render acl=$NagiosAliasACL}
+      <input id="NagiosAlias" name="NagiosAlias" size=25 maxlength=65 value="{$NagiosAlias}">
+{/render}
+     </td>
+    </tr>
+
+    <tr>
+     <td><label for="NagiosMail">{t}Mail address{/t}</label>{$must}</td>
+     <td>
+{render acl=$NagiosMailACL}
+      <input id="NagiosMail" name="NagiosMail" size=25 maxlength=65 value="{$NagiosMail}">
+{/render}
+     </td>
+    </tr>
+
+    <tr>
+     <td>
+      <label for="HostNotificationPeriod">{t}Host notification period{/t}</label>{$must}
+     </td>
+     <td>
+{render acl=$HostNotificationPeriodACL}
+      <select name="HostNotificationPeriod" id="HostNotificationPeriod">
+       {html_options options=$HostNotificationPeriodValues values=$HostNotificationPeriodValues selected=$HostNotificationPeriod }
+      </select>
+{/render}
+     </td>
+    </tr>
+
+    <tr>
+     <td>
+      <label for="ServiceNotificationPeriod">{t}Service notification period{/t}</label>{$must}
+     </td>
+     <td>
+{render acl=$ServiceNotificationPeriodACL}
+      <select name="ServiceNotificationPeriod" id="ServiceNotificationPeriod">
+       {html_options options=$ServiceNotificationPeriodValues values=$ServiceNotificationPeriodValues selected=$ServiceNotificationPeriod}
+      </select>
+{/render}
+     </td>
+    </tr>
+
+    <tr>
+     <td>
+      <label for="ServiceNotificationOptions">{t}Service notification options{/t}</label>{$must}
+     </td>
+     <td>
+{render acl=$ServiceNotificationOptionsACL}
+      <select name="ServiceNotificationOptions" id="ServiceNotificationOptions">
+       {html_options options=$ServiceNotificationOptionsValues values=$ServiceNotificationOptionsValues selected=$ServiceNotificationOptions}
+      </select>
+{/render}
+     </td>
+    </tr>
+
+    <tr>
+     <td>
+      <label for="HostNotificationOptions">{t}Host notification options{/t}</label>{$must}
+     </td>
+     <td>
+{render acl=$HostNotificationOptionsACL}
+      <select name="HostNotificationOptions" id="HostNotificationOptions">
+       {html_options options=$HostNotificationOptionsValues values=$HostNotificationOptionsValues selected=$HostNotificationOptions }
+      </select>
+{/render}
+     </td>
+    </tr>
+
+    <tr>
+     <td>
+      <label for="NagiosPager">{t}Pager{/t}</label>
+     </td>
+     <td>
+{render acl=$NagiosPagerACL}
+      <input id="NagiosPager" name="NagiosPager" size=25 maxlength=65 value="{$NagiosPager}">
+{/render}
+     </td>
+    </tr>
+
+    <tr>
+     <td>
+      <label for="ServiceNotificationCommands">{t}Service notification commands{/t}</label>
+     </td>
+     <td>
+{render acl=$ServiceNotificationCommandsACL}
+      <input id="ServiceNotificationCommands" disabled name="ServiceNotificationCommands" size=25 maxlength=65  value="{$ServiceNotificationCommands}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td>
+      <label for="HostNotificationCommands">{t}Host notification commands{/t}</label>
+     </td>
+     <td>
+{render acl=$HostNotificationCommandsACL}
+      <input id="HostNotificationCommands" disabled name="HostNotificationCommands" size=25 maxlength=65  value="{$HostNotificationCommands}">
+{/render}
+     </td>
+    </tr>
+   </table>
+  </td>
+  <td style="border-left:1px solid #A0A0A0">
+   &nbsp;
+  </td>
+  <td style="width:100%; vertical-align:top;">
+   <h2> 
+    <img class="center" alt="" align="middle" src="images/rightarrow.png" />&nbsp;{t}Nagios authentification{/t}
+   </h2>
+   <table summary="">
+    <tr>
+     <td>
+{render acl=$AuthorizedSystemInformationACL}
+      <input type="checkbox" name="AuthorizedSystemInformation" value="1" {$AuthorizedSystemInformationCHK}>{t}view system informations{/t}
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td>
+{render acl=$AuthorizedConfigurationInformationACL}
+      <input type="checkbox" name="AuthorizedConfigurationInformation" value="1" 
+       {$AuthorizedConfigurationInformationCHK}>{t}view configuration information{/t}
+{/render}
+     </td>
+    </tr>
+       
+    <tr>
+     <td>
+{render acl=$AuthorizedSystemCommandsACL}
+      <input type="checkbox" name="AuthorizedSystemCommands" value="1" 
+       {$AuthorizedSystemCommandsCHK}>{t}trigger system commands{/t}
+{/render}
+     </td>
+    </tr>
+       
+    <tr>
+     <td>
+{render acl=$AuthorizedAllServicesACL}
+      <input type="checkbox" name="AuthorizedAllServices" value="1" 
+       {$AuthorizedAllServicesCHK}>{t}view all services{/t}
+{/render}
+     </td>
+    </tr>
+       
+    <tr>
+     <td>
+{render acl=$AuthorizedAllHostsACL}
+      <input type="checkbox" name="AuthorizedAllHosts" value="1" 
+       {$AuthorizedAllHostsCHK}>{t}view all hosts{/t}
+{/render}
+     </td> 
+    </tr>
+       
+    <tr>
+     <td>
+{render acl=$AuthorizedAllServiceCommandsACL}
+      <input type="checkbox" name="AuthorizedAllServiceCommands" value="1" 
+       {$AuthorizedAllServiceCommandsCHK}>{t}trigger all service commands{/t}
+{/render}
+     </td>
+    </tr>
+       
+    <tr>
+     <td>
+{render acl=$AuthorizedAllHostCommandsACL}
+      <input type="checkbox" name="AuthorizedAllHostCommands" value="1" 
+       {$AuthorizedAllHostCommandsCHK}>{t}trigger all host commands{/t}
+{/render}
+     </td>
+    </tr>
+   </table>
+  </td>
+ </tr>
+</table>
+
+<input type="hidden" name="nagiosTab" value="nagiosTab">
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('NagiosAlias');
+  -->
+</script>
+
diff --git a/gosa-core/plugins/personal/netatalk/class_netatalk.inc b/gosa-core/plugins/personal/netatalk/class_netatalk.inc
new file mode 100644 (file)
index 0000000..3693fda
--- /dev/null
@@ -0,0 +1,387 @@
+<?php
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2006  Gina Haeussge <osd@foosel.net>
+   Copyright (C) 2006  Bernd Zeimetz <bernd@zeimetz.de>
+
+   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
+ */
+
+/*! \brief   netatalk plugin
+  \author  Gina Haeussge <osd@foosel.net>
+  \author  Bernd Zeimetz <bernd@zeimetz.de>
+  \version 0.1
+  \date    21.3.2006
+
+  This class provides the functionality to read and write all attributes
+  relevant for netatalk from/to the LDAP. It does syntax checking
+  and displays the formulars required.
+ */
+
+class netatalk extends plugin {
+
+  /* Definitions */
+  var $plHeadline = "Netatalk";
+  var $plDescription = "Manage netatalk account";
+
+  /* CLI vars */
+  var $cli_summary = "Manage netatalk account";
+  var $cli_description = "Manage Account \nfor netatalk";
+  var $cli_parameters = array ("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+  var $view_logged = FALSE;
+
+  /* Plugin specific values */
+  var $apple_user_homepath_raw   = "";
+  var $apple_user_homeurl_raw     = "";
+  var $apple_user_homeurl_xml     = "";
+  var $apple_user_homeurl       = "";
+  var $apple_user_homeDirectory   = "";
+  var $apple_user_share       = "";
+  var $shares             = array();
+  var $shares_settings        = array();
+  var $selectedshare        = "";
+  var $mountDirectory         = "/Network/Servers";
+
+  /* Attributes to save to LDAP */
+  var $attributes = array ("apple-user-homeurl", "apple-user-homeDirectory");
+  var $CopyPasteVars= array("apple_user_homeurl", "apple_user_homeDirectory","apple_user_share","shares_settings","apple_user_homepath_raw",
+      "apple_user_homeurl_raw","apple_user_homeurl_xml","apple_user_homeurl","selectedshare","mountDirectory");
+
+  /* Attributes to use in smarty template */
+  var $smarty_attributes = array ("apple_user_homepath_raw", "shares", "selectedshare");
+
+  /* Attributes to save from $_POST */
+  var $post_attributes = array ("apple_user_share", "apple_user_homepath_raw");
+
+  /* Objectclasses */
+  var $objectclasses = array ("apple-user");
+
+  /* Checkboxes */
+  var $is_chk_box = array ();
+
+  var $uid ="";  
+
+  /* The constructor just saves a copy of the config. You may add what ever you need. */
+  function netatalk(&$config, $dn = NULL) {
+
+    /* Include config object */
+    $this->config = $config;
+    plugin::plugin($config, $dn);
+
+    /* set user id */    
+    if(isset($this->attrs['uid'])){
+      $this->uid = $this->attrs['uid'][0];
+    }
+
+    /* Copy needed attributes */
+    foreach($this->attributes as $val) {
+      if (isset($this->attrs["$val"][0])) {
+        $name = str_replace('-', '_', $val);
+        $this->$name = $this->attrs["$val"][0];
+      }
+    }
+
+    if (strlen($this->apple_user_homeDirectory) >0) {
+      $this->apple_user_homepath_raw = substr($this->apple_user_homeDirectory, strrpos($this->apple_user_homeDirectory, '/') + 1 );
+    }
+
+    /* get share list an set default values */
+    $this->get_netatalk_shares(); 
+    $this->apple_user_share = $this->selectedshare;
+
+    /* Save initial account state */
+    $this->initially_was_account = $this->is_account;
+  }
+
+
+
+  /* Get netatalk shares */
+  function get_netatalk_shares()
+  {
+    /* Get netatalk shares */
+    $this->shares = array();
+    $ldap = $this->config->get_ldap_link();
+
+    if($this->dn === "new" || $this->dn === NULL) {
+      $base = $_SESSION['CurrentMainBase'];
+    } else {
+      $base = preg_replace("/^[^,]+,".normalizePreg(get_people_ou())."/","",$this->dn);
+    }
+
+    $ldap->cd($base);
+    $ldap->search ("(&(objectClass=mount)(|(mountType=url)(mountType=nfs))(cn=*))");
+
+    while ($attrs = $ldap->fetch()){
+      $tmp  = split(":", $attrs["cn"][0]);
+      $host = trim($tmp[0]);
+      $dir  = trim($tmp[1]);
+      $mountType = trim($attrs["mountType"][0]);
+      if ($mountType == "url") {
+        $mountTypeReal = "netatalk";
+      } else {
+        $mountTypeReal = $mountType;
+      } 
+      $share = $attrs["cn"][0]. " (" . $mountTypeReal . ")";
+      $this->shares[$share] = $share;
+      $this->shares_settings[$share]["mountType"]=$mountType;
+      $this->shares_settings[$share]["dir"]=$dir;
+      $this->shares_settings[$share]["host"]=$host;
+
+      $oldShare=substr($this->apple_user_homeDirectory, 0, strrpos($this->apple_user_homeDirectory, '/'));
+      $newShare=($this->mountDirectory . "/". $host . $dir );
+      if (strcmp($oldShare, $newShare)==0) {
+        $this->selectedshare = $share;
+      }
+    }
+    asort($this->shares);
+  }
+
+
+  /* Execute the plugin, produce the output. */
+  function execute() 
+  {
+    plugin :: execute();
+
+    /* Log view */
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","users/".get_class($this),$this->dn);
+    }
+
+    /* Use the smarty templating engine here... */
+    $smarty = get_smarty();
+    $display = "";
+
+    /* Do we need to flip is_account state? */
+    if (isset ($_POST['modify_state'])) {
+      $this->is_account = !$this->is_account;
+    }
+
+    /* Do we represent a valid account? */
+    if (!$this->is_account && $this->parent === NULL) {
+      $display = "<img alt=\"\"src=\"images/stop.png\" align=\"middle\">&nbsp;<b>"._("This account has no netatalk extensions.")."</b>";
+
+      $display .= back_to_main();
+      return ($display);
+    }
+
+    /* Show tab dialog headers */
+    if ($this->parent !== NULL) {
+      if ($this->is_account) {
+        $display = $this->show_disable_header(_("Remove netatalk account"), _("This account has netatalk features enabled. You can disable them by clicking below."));
+      } else {
+        $errmsg="";
+        $obj = $this->parent->by_object['posixAccount'];
+        if  (!($obj->is_account) ) {
+          $errmsg.="Posix features are needed for netatalk accounts, enable them first. ";
+        }
+        if (count($this->shares)== 0) {
+          $errmsg.="At least one share with netatalk or NFS mount entry needed.";
+        }
+        if($errmsg==""){
+          $display = $this->show_enable_header(_("Create netatalk account"), _("This account has netatalk features disabled. You can enable them by clicking below."));
+        } else {
+          $display = $this->show_enable_header(_("Create netatalk account"), _($errmsg), TRUE);
+        }
+        return ($display);
+      }
+    }
+
+    /* Assign attributes and ACL to smarty */
+    $SkipWrite = (!isset($this->parent) || !$this->parent) && !isset($_SESSION['edit']);
+    $smarty->assign("netatalkShareACL", $this->getacl("netatalkShare",$SkipWrite));
+    $smarty->assign("netatalkUserHomepathACL", $this->getacl("netatalkUserHomepath",$SkipWrite));
+
+    foreach ($this->smarty_attributes as $val) {
+      $smarty->assign("$val", $this-> $val);
+      if (in_array($val, $this->is_chk_box)) {
+        if ($this-> $val == "checked") {
+          $smarty->assign($val."CHK", " checked ");
+        } else {
+          $smarty->assign($val."CHK", "");
+        }
+      }
+    }
+
+    /* Let smarty fetch and process the page. */
+    $display .= ($smarty->fetch(get_template_path('netatalk.tpl', TRUE, dirname(__FILE__))));
+    return ($display);
+  }
+
+
+  /* Check if we have correct data */
+  function check() {
+    $message = array ();
+
+    if (strlen($this->apple_user_share) == 0) {
+      $message[] = _("You must select a share to use.");
+    }
+
+    return ($message);
+  }
+
+  /* Save to LDAP */
+  function save() {
+    /* remove a / at the end of the homepath, we neither need it there nor
+     * do we want to check for it later.
+     */
+    if(substr($this->apple_user_homepath_raw, -1, 1) === '/') {
+      $this->apple_user_homepath_raw=substr($this->apple_user_homepath_raw, 0, -1);
+    }
+
+    $mountType=$this->shares_settings[$this->apple_user_share]["mountType"];
+    $dir=$this->shares_settings[$this->apple_user_share]["dir"];
+    $host=$this->shares_settings[$this->apple_user_share]["host"];
+
+    /* Convert raw data to wished format */
+    if ($this->is_account) {
+      if($mountType=="url") {
+        $this->apple_user_homeurl_xml = '<home_dir><url>afp://'.$host.$dir . '</url><path>'.$this->apple_user_homepath_raw.'</path></home_dir>';
+        $this->apple_user_homeurl = base64_encode($this->apple_user_homeurl_xml);
+      } else {
+        $this->apple_user_homeurl = "";
+      }
+      $this->apple_user_homeDirectory = $this->mountDirectory . '/' . $host .$dir . '/' . $this->apple_user_homepath_raw;
+    } else {
+      $this->apple_user_homeurl = "";
+      $this->apple_user_homeDirectory = "";
+    }
+
+    $ldap = $this->config->get_ldap_link();
+
+    /* Reset array of used attributes, because plugin::save() 
+       will not work with '-' in attributes names 
+       after calling save restore attributes array */
+    $attributes = $this->attributes;
+    $this->attributes = array();
+    plugin :: save();
+    $this->attributes = $attributes;
+
+    /* Do attribute conversion */
+    foreach ($this->attributes as $val) {
+      $name = str_replace('-', '_', $val);
+      if ($this->$name != "") {
+        $this->attrs[$val] = $this->$name;
+      } else {
+        $this->attrs[$val] = array();
+      }
+      unset ($this->attrs[$name]);
+    }
+
+    /* Write back to ldap */
+    $ldap->cd($this->dn);
+    $this->cleanup();
+    $ldap->modify($this->attrs);
+
+    if($this->initially_was_account){
+      new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
+
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/netatalk account 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",array("uid" => $this->uid));
+      }
+    } else {
+      $this->handle_post_events("add",array("uid" => $this->uid));
+    }
+  }
+
+  /* Use Save_object for every Post handling */
+  function save_object() {
+    if (isset ($_POST['netatalkTab'])) {
+      /* Save ldap attributes */
+      plugin :: save_object();
+
+      foreach($this->post_attributes as $val) {
+        if (isset ($_POST[$val])) {
+          $this->$val = $_POST[$val];
+        } else {
+          $this->$val = "";
+        }
+      }
+
+      /* Specialhandling for checkboxes */
+      foreach ($this->is_chk_box as $val) {
+        if (isset ($_POST[$val])) {
+          $this-> $val = "checked";
+        } else {
+          $this-> $val = "unchecked";
+        }
+      }
+
+      $this->apple_user_homeurl_raw = 'afp://' . $this->apple_user_share;
+    }
+  }
+
+  function remove_from_parent() {
+    /* Cancel if there's nothing to do here */
+    if (!$this->initially_was_account) {
+      return;
+    }
+
+    /* include global link_info */
+    $ldap = $this->config->get_ldap_link();
+
+    /* Remove and write to LDAP */
+    plugin :: remove_from_parent();
+
+    /* Adapt attributes if needed */
+    //     $method= new $this->method($this->config);
+    //     $method->fixAttributesOnRemove($this);
+
+    @ DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->attributes, "Save");
+    $ldap->cd($this->dn);
+    $this->cleanup();
+    $ldap->modify($this->attrs);
+
+    new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+
+    show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/netatalk account with dn '%s' failed."),$this->dn));
+
+    /* remove the entry from LDAP */
+    unset ($this->attrs['uid']);
+
+    /* Optionally execute a command after we're done */
+    $this->handle_post_events('remove', array("uid" => $this->uid));
+  }
+
+
+  /* Return plugin informations for acl handling*/
+  static function plInfo()
+  {
+    return (array(
+          "plDescription"     => _("Netatalk"),
+          "plSelfModify"      => TRUE,
+          "plDepends"         => array("user"),
+          "plPriority"        => 6,
+          "plSection"     => array("personal" => _("My account")),
+          "plCategory"    => array("users"),
+          "plOptions"         => array(),
+
+          "plProvidedAcls"  => array(
+            "netatalkUserHomepath"   =>  _("User home path"),
+            "netatalkShare"          =>  _("Share"))
+          ));
+  }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/personal/netatalk/main.inc b/gosa-core/plugins/personal/netatalk/main.inc
new file mode 100644 (file)
index 0000000..e1a62c9
--- /dev/null
@@ -0,0 +1,117 @@
+<?php
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2006  Gina Haeussge <osd@foosel.net>
+   Copyright (C) 2006  Bernd Zeimetz <bernd@zeimetz.de>
+
+   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
+ */
+
+if (!$remove_lock) {
+  /* Reset requested? */
+  if (isset ($_POST['edit_cancel']) || (isset ($_GET['reset']) && $_GET['reset'] == 1)) {
+    del_lock($ui->dn);
+    sess_del('edit');
+    sess_del('netatalk');
+  }
+
+  /* Create netatalk object on demand */
+  if (!isset ($_SESSION['netatalk']) || (isset ($_GET['reset']) && $_GET['reset'] == 1)) {
+    $_SESSION['netatalk'] = new netatalk($config, $ui->dn);
+    $_SESSION['netatalk']->enable_CSN_check();
+    $_SESSION['netatalk']->set_acl_base($ui->dn);
+    $_SESSION['netatalk']->set_acl_category("users");
+  }
+  $netatalk = $_SESSION['netatalk'];
+
+  /* save changes back to object */
+  if (isset ($_SESSION['edit'])) {
+    $netatalk->save_object();
+  }
+
+  /* Enter edit mode? */
+  if (isset ($_POST['edit'])) {
+
+    /* Check locking */
+    if (($username = get_lock($ui->dn)) != "") {
+      $_SESSION['back_plugin'] = $plug;
+      gen_locked_message($username, $ui->dn);
+      exit ();
+    }
+
+    /* Lock the current entry */
+    add_lock($ui->dn, $ui->dn);
+    $_SESSION['dn'] = $ui->dn;
+    $_SESSION['edit'] = TRUE;
+  }
+
+  /* save changes to LDAP and disable edit mode */
+  if (isset ($_POST['edit_finish'])) {
+
+    /* Perform checks */
+    $message = $netatalk->check();
+
+    /* No errors, save object */
+    if (count($message) == 0) {
+      $netatalk->save();
+      del_lock($ui->dn);
+      sess_del('edit');
+
+      /* Remove object */
+      sess_del('netatalk');
+    } else {
+      /* Errors found, show message */
+      show_errors($message);
+    }
+  }
+
+  /* Execute formular */
+  $display = $netatalk->execute();
+
+  /* Store changes  in session */
+  if (isset ($_SESSION['edit'])) {
+    $_SESSION['netatalk'] = $netatalk;
+  }
+
+  $info = "";
+  /* Show page footer depending on the mode */
+  if ($netatalk->is_account) {
+    $display .= "<p class=\"plugbottom\">";
+
+    /* Are we in edit mode? */
+    if (isset ($_SESSION['edit'])) {
+      $display .= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
+      $display .= "&nbsp;";
+      $display .= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+      $info = "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".$ui->dn."&nbsp;";
+    } else {
+      $info = "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/openlock.png')."\"> ".$ui->dn."&nbsp;";
+      if(preg_match("/w/",$ui->get_permissions($ui->dn,"users/netatalk"))){
+        $info .= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/lamp.png')."\"> "._("Click the 'Edit' button below to change informations in this dialog");
+        $display .= "<input type=submit name=\"edit\" value=\""._("Edit")."\">\n";
+      }
+
+      $display .= "<input type=\"hidden\" name=\"ignore\">\n";
+    }
+    $display .= "</p>\n";
+  }
+
+  /* Page header*/
+  $display = print_header(get_template_path('images/netatalk.png'), _("Netatalk settings"), $info).$display;
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/personal/netatalk/netatalk.tpl b/gosa-core/plugins/personal/netatalk/netatalk.tpl
new file mode 100644 (file)
index 0000000..c5bcc8e
--- /dev/null
@@ -0,0 +1,33 @@
+<table summary="">
+<tr>
+       <td>
+               <label for="apple_user_share">{t}Share{/t}</label>
+       </td>
+       <td>
+
+{render acl=$netatalkShareACL}
+               <select name="apple_user_share" id="apple_user_share">
+                       {html_options options=$shares selected=$selectedshare}
+               </select>
+{/render}
+       </td>
+<tr>
+       <td>
+               <label for="apple_user_homepath_raw">{t}Path{/t}</label>
+       </td>
+       <td>
+{render acl=$netatalkUserHomepathACL}
+               <input name="apple_user_homepath_raw" id="apple_user_homepath_raw" type="text" value="{$apple_user_homepath_raw}" size="25" maxlength="65"/>
+{/render}
+       </td>
+</tr>
+</table>
+
+<input type="hidden" name="netatalkTab" value="netatalkTab">
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('apple_user_homeurl_raw');
+  -->
+</script>
diff --git a/gosa-core/plugins/personal/password/changed.tpl b/gosa-core/plugins/personal/password/changed.tpl
new file mode 100644 (file)
index 0000000..16db300
--- /dev/null
@@ -0,0 +1,12 @@
+
+<p>
+ <b>{t}You've successfully changed your password. Remember to change all programms configured to use it as well.{/t}</b>
+</p>
+
+<br>
+
+<p class="plugbottom">
+  <input type=submit name="password_back" value="{t}Back{/t}">
+</p>
+
+<input type="hidden" name="ignore">
diff --git a/gosa-core/plugins/personal/password/class_password.inc b/gosa-core/plugins/personal/password/class_password.inc
new file mode 100644 (file)
index 0000000..f9d5ac4
--- /dev/null
@@ -0,0 +1,154 @@
+<?php
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2007 Fabian Hickert
+
+   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 password extends plugin
+{
+  /* Definitions */
+  var $plHeadline     = "Password";
+  var $plDescription  = "This does something";
+
+  function password(&$config, $dn= NULL, $parent= NULL)
+  {
+    plugin::plugin($config, $dn, $parent);
+  }
+
+
+  function execute()
+  {
+    plugin::execute();
+    $smarty = get_smarty();
+    $ui = get_userinfo();
+
+    /* Get acls */
+    $password_ACLS = $ui->get_permissions($ui->dn,"users/password");
+    $smarty->assign("ChangeACL" ,  $password_ACLS);
+    $smarty->assign("NotAllowed" , !preg_match("/w/i",$password_ACLS));
+
+    /* Display expiration template */
+    if((isset($this->config->data['MAIN']['ACCOUNT_EXPIRATION'])) &&
+        preg_match('/true/i', $this->config->data['MAIN']['ACCOUNT_EXPIRATION'])){
+      $expired= ldap_expired_account($this->config, $ui->dn, $ui->username);
+      if($expired == 4){
+        return($smarty->fetch(get_template_path("nochange.tpl", TRUE)));
+      }
+    }
+
+    /* Pwd change requested */
+    if (isset($_POST['password_finish'])){
+
+      /* Should we check different characters in new password */
+      $check_differ = isset($this->config->data['MAIN']['PWDIFFER']);
+      $differ       = @$this->config->data['MAIN']['PWDIFFER'];
+
+      /* Enable length check ? */
+      $check_length = isset($this->config->data['MAIN']['PWMINLEN']);
+      $length       = @$this->config->data['MAIN']['PWMINLEN'];
+
+      /* Call external password quality hook ?*/
+      $check_hook   = isset($this->config->data['MAIN']['EXTERNALPWDHOOK']);
+      $hook         = @$this->config->data['MAIN']['EXTERNALPWDHOOK']." ".$ui->username." ".$_POST['current_password']." ".$_POST['new_password'];
+      if($check_hook){
+        exec($hook,$resarr);
+        $check_hook_output = "";
+        if(count($resarr) > 0) {
+          $check_hook_output= join('\n', $resarr);
+        }
+      }
+
+      /* Check given values */    
+      if(!isset($_POST['current_password']) || empty($_POST['current_password'])){
+        msg_dialog::display(_("User password"),
+                            _("You need to specify your current password in order to proceed."),WARNING_DIALOG);
+      }elseif ($_POST['new_password'] != $_POST['repeated_password']){
+        msg_dialog::display(_("User password"),
+                            _("The passwords you've entered as 'New password' and 'Repeated new password' do not match."),WARNING_DIALOG);
+      } elseif ($_POST['new_password'] == ""){
+        msg_dialog::display(_("User password"),
+                            _("The password you've entered as 'New password' is empty."),WARNING_DIALOG);
+      }elseif($check_differ && (substr($_POST['current_password'], 0, $differ) == substr($_POST['new_password'], 0, $differ))){
+        msg_dialog::display(_("User password"),
+                            _("The password used as new and current are too similar."),WARNING_DIALOG);
+      }elseif($check_length && (strlen($_POST['new_password']) < $length)){
+        msg_dialog::display(_("User password"),
+                            _("The password used as new is to short."),WARNING_DIALOG);
+      }elseif($check_hook && $check_hook_output != ""){
+        msg_dialog::display(_("User password"),
+                    sprintf(_("External password changer reported a problem: %s."),$check_hook_output),WARNING_DIALOG);
+      }else{
+
+        /* Try to connect via current password */
+        $tldap = new LDAP(
+            $ui->dn, 
+            $_POST['current_password'],
+            $this->config->current['SERVER'],
+            isset($this->config->current['RECURSIVE'])  && preg_match("/true/i",$this->config->current['RECURSIVE']),
+            isset($this->config->current['TLS'])        && preg_match("/true/i",$this->config->current['TLS']));
+
+        /* connection Successfull ? */
+        if ($tldap->error != "Success"){
+          msg_dialog::display(_("User password"),
+                              _("The password you've entered as your current password doesn't match the real one."),WARNING_DIALOG);
+        }else{
+
+          /* Check GOsa permissions */
+          if (!preg_match("/w/i",$password_ACLS)){
+            msg_dialog::display(_("User password"),
+                                _("You have no permissions to change your password."),WARNING_DIALOG);
+          }else{
+            change_password ($ui->dn, $_POST['new_password']);
+            gosa_log ("User/password has been changed");
+            $ui->password= $_POST['new_password'];
+            $_SESSION['ui']= $ui;
+#$this->handle_post_events("modify",array("userPassword" => $_POST['new_password']));
+            return($smarty->fetch(get_template_path("changed.tpl", TRUE)));
+          }
+        }
+      }
+    }
+    return($smarty->fetch(get_template_path("password.tpl", TRUE)));
+  } 
+
+  function remove_from_parent()
+  {
+    $this->handle_post_events("remove");
+  }
+
+  function save()
+  {
+  }
+
+  static function plInfo()
+  {
+    return (array(
+          "plDescription"     => _("User password"),
+          "plSelfModify"      => TRUE,
+          "plDepends"         => array("user"),
+          "plPriority"        => 10,
+          "plSection"     => array("personal" => _("My account")),
+          "plCategory"    => array("users"),
+          "plOptions"         => array(),
+
+          "plProvidedAcls"  => array())
+        );
+  }
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/personal/password/main.inc b/gosa-core/plugins/personal/password/main.inc
new file mode 100644 (file)
index 0000000..b8135bc
--- /dev/null
@@ -0,0 +1,51 @@
+<?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
+ */
+
+/* Clear display */
+$display= "";
+
+if (!$remove_lock){
+
+  /* Reset requested? */
+  if (isset($_POST['edit_cancel']) ||
+      (isset($_GET['reset']) && $_GET['reset'] == 1)){
+
+    del_lock ($ui->dn);
+    sess_del ('edit');
+    sess_del ('password');
+  }
+
+  /* Create password object on demand */
+  if (!isset($_SESSION['password']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+    $_SESSION['password']= new password ($config, $ui->dn);
+  }
+  $password= $_SESSION['password'];
+
+  /* Execute formular */
+  $display.= $password->execute ();
+
+  /* Page header*/
+  $display= print_header(get_template_path('images/password.png'),
+                         _("Password settings"), "").$display;
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/personal/password/nochange.tpl b/gosa-core/plugins/personal/password/nochange.tpl
new file mode 100644 (file)
index 0000000..d7164f6
--- /dev/null
@@ -0,0 +1,11 @@
+<div class="plugtop">
+  <img class="center" alt="" src="images/error.png" align="middle">{t}Password change not allowed{/t}>
+</div>
+
+<p>
+ <b>{t}You are not allowed to change your password at this time{/t}</b>
+</p>
+
+<br>
+
+<input type="hidden" name="ignore">
diff --git a/gosa-core/plugins/personal/password/password.tpl b/gosa-core/plugins/personal/password/password.tpl
new file mode 100644 (file)
index 0000000..0787b70
--- /dev/null
@@ -0,0 +1,44 @@
+<p>
+  {t}To change your personal password use the fields below. The changes take effect immediately. Please memorize the new password, because you wouldn't be able to login without it.{/t}
+</p>
+
+<p>
+  {t}Changing the password affects your authentification on mail, proxy, samba and unix services.{/t}
+</p>
+
+<table summary="" style="vertical-align:top; text-align:left;" cellpadding=4 border=0>
+  <tr>
+    <td><b><LABEL for="current_password">{t}Current password{/t}</LABEL></b></td>
+    <td><input id="current_password" type="password" name="current_password" size="30" maxlength="40"
+               onFocus="nextfield= 'new_password';"></td>
+  </tr>
+  <tr>
+    <td><b><LABEL for="new_password">{t}New password{/t}</LABEL></b></td>
+    <td><input id="new_password" type="password" name="new_password" size="30" maxlength="40"
+               onFocus="nextfield= 'repeated_password';"></td>
+  </tr>
+  <tr>
+    <td><b><LABEL for="repeated_password">{t}Repeat new password{/t}</LABEL></b></td>
+    <td><input id="repeated_password" type="password" name="repeated_password" size="30" maxlength="40"
+               onFocus="nextfield= 'password_finish';"></td>
+  </tr>
+</table>
+
+<br>
+
+<p class="plugbottom">
+  <input type=submit name="password_finish" value="{t}Set password{/t}">
+  &nbsp;
+  <input type=reset id="password_cancel" name="password_cancel" value="{t}Clear fields{/t}">
+</p>
+
+<input type="hidden" name="ignore">
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+  nextfield= 'current_password';
+       focus_field('current_password');
+  -->
+</script>
+
diff --git a/gosa-core/plugins/personal/posix/class_posixAccount.inc b/gosa-core/plugins/personal/posix/class_posixAccount.inc
new file mode 100644 (file)
index 0000000..e1a5412
--- /dev/null
@@ -0,0 +1,1433 @@
+<?php
+/*!
+  \brief   posixAccount plugin
+  \author  Cajus Pollmeier <pollmeier@gonicus.de>
+  \version 2.00
+  \date    24.07.2003
+
+  This class provides the functionality to read and write all attributes
+  relevant for posixAccounts and shadowAccounts from/to the LDAP. It
+  does syntax checking and displays the formulars required.
+ */
+
+class posixAccount extends plugin
+{
+  /* Definitions */
+  var $plHeadline= "UNIX";
+  var $plDescription= "This does something";
+
+  /* CLI vars */
+  var $cli_summary= "Manage users posix account";
+  var $cli_description= "Some longer text\nfor help";
+  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* Plugin specific values */
+  var $homeDirectory= "";
+  var $loginShell= "/bin/bash";
+  var $uidNumber= "";
+  var $gidNumber= "";
+  var $gecos= "";
+  var $shadowMin= "0";
+  var $shadowMax= "0";
+  var $shadowWarning= "0";
+  var $shadowLastChange= "0";
+  var $shadowInactive= "0";
+  var $shadowExpire= "0";
+  var $gosaDefaultPrinter= "";
+  var $accessTo= array();
+  var $trustModel= "";
+
+  var $glist=array();
+  var $status= "";
+  var $loginShellList= array();
+  var $groupMembership= array();
+  var $savedGroupMembership= array();
+  var $savedUidNumber= "";
+  var $savedGidNumber= "";
+  var $use_shadowMin= "0";
+  var $use_shadowMax= "0";
+  var $use_shadowWarning= "0";
+  var $use_shadowInactive= "0";
+  var $use_shadowExpire= "0";
+  var $mustchangepassword= "0";
+  var $force_ids= 0;
+  var $group_dialog= FALSE;
+  var $show_ws_dialog= FALSE;
+  var $secondaryGroups= array();
+  var $primaryGroup= 0;
+  var $was_trust_account= FALSE;
+  var $memberGroup = array();
+  var $grouplist  = array();
+  var $ui         = array();
+
+  var $GroupRegex       = "*";
+  var $GroupUserRegex   = "*";
+  var $SubSearch        = false;
+
+  var $view_logged = FALSE;
+
+  /* attribute list for save action */
+  var $CopyPasteVars  = 
+      array("grouplist","groupMembership","use_shadowMin",
+      "use_shadowMax","use_shadowWarning","use_shadowInactive","use_shadowExpire",
+      "must_change_password","printerList","grouplist","savedGidNumber","savedUidNumber");
+
+  var $attributes     = array("homeDirectory", "loginShell", "uidNumber", "gidNumber", "gecos",
+      "shadowMin", "shadowMax", "shadowWarning", "shadowInactive", "shadowLastChange",
+      "shadowExpire", "gosaDefaultPrinter", "uid","accessTo","trustModel");
+
+  var $objectclasses= array("posixAccount", "shadowAccount");
+
+  var $uid= "";
+  var $multiple_support = TRUE;
+
+  /* constructor, if 'dn' is set, the node loads the given
+     'dn' from LDAP */
+  function posixAccount (&$config, $dn= NULL)
+  {
+    /* Configuration is fine, allways */
+    $this->config= $config;
+
+    /* Load bases attributes */
+    plugin::plugin($config, $dn);
+
+    /* Setting uid to default */
+    if(isset($this->attrs['uid'][0])){
+      $this->uid = $this->attrs['uid'][0];
+    }
+
+    $ldap= $this->config->get_ldap_link();
+
+    if ($dn !== NULL){
+
+      /* Correct is_account. shadowAccount is not required. */
+      if (isset($this->attrs['objectClass']) &&
+          in_array ('posixAccount', $this->attrs['objectClass'])){
+
+        $this->is_account= TRUE;
+      }
+
+      /* Is this account a trustAccount? */
+      if ($this->is_account && isset($this->attrs['trustModel'])){
+        $this->trustModel= $this->attrs['trustModel'][0];
+        $this->was_trust_account= TRUE;
+      } else {
+        $this->was_trust_account= FALSE;
+        $this->trustModel= "";
+      }
+
+      $this->accessTo = array(); 
+      if ($this->is_account && isset($this->attrs['accessTo'])){
+        for ($i= 0; $i<$this->attrs['accessTo']['count']; $i++){
+          $tmp= $this->attrs['accessTo'][$i];
+          $this->accessTo[$tmp]= $tmp;
+        }
+      }
+      $this->initially_was_account= $this->is_account;
+
+      /* Fill group */
+      $this->primaryGroup= $this->gidNumber;
+
+      /* Generate status text */
+      $current= date("U");
+
+      $current= floor($current / 60 /60 / 24);
+
+      if (($current >= $this->shadowExpire) && $this->shadowExpire){
+        $this->status= _("expired");
+        if (($current - $this->shadowExpire) < $this->shadowInactive){
+          $this->status.= ", "._("grace time active");
+        }
+      } elseif (($this->shadowLastChange + $this->shadowMin) >= $current){
+        $this->status= _("active, password not changable");
+      } elseif (($this->shadowLastChange + $this->shadowMax) >= $current){
+        $this->status= _("active, password expired");
+      } else {
+        $this->status= _("active");
+      }
+
+      /* Get group membership */
+      $ldap->cd($this->config->current['BASE']);
+      $ldap->search("(&(objectClass=posixGroup)(memberUid=".$this->uid."))", array("cn", "description"));
+
+      while ($this->attrs= $ldap->fetch()){
+        if (!isset($this->attrs["description"][0])){
+          $entry= $this->attrs["cn"][0];
+        } else {
+          $dsc= preg_replace ('/^Group of user/', _("Group of user"), $this->attrs["description"][0]);
+          $entry= $this->attrs["cn"][0]." [$dsc]";
+        }
+        $this->groupMembership[$ldap->getDN()]= $entry;
+      }
+      asort($this->groupMembership);
+      reset($this->groupMembership);
+      $this->savedGroupMembership= $this->groupMembership;
+      $this->savedUidNumber= $this->uidNumber;
+      $this->savedGidNumber= $this->gidNumber;
+    }
+
+    /* Adjust shadow checkboxes */
+    foreach (array("shadowMin", "shadowMax", "shadowWarning", "shadowInactive",
+          "shadowExpire") as $val){
+
+      if ($this->$val != 0){
+        $oval= "use_".$val;
+        $this->$oval= "1";
+      }
+    }
+
+    /* Convert to seconds */
+    $this->shadowExpire= $this->convertToSeconds($this->shadowExpire);
+
+    /* Generate shell list from CONFIG_DIR./shells */
+    if (file_exists(CONFIG_DIR.'/shells')){
+      $shells = file (CONFIG_DIR.'/shells');
+      foreach ($shells as $line){
+        if (!preg_match ("/^#/", $line)){
+          $this->loginShellList[]= trim($line);
+        }
+      }
+    } else {
+      if ($this->loginShell == ""){
+        $this->loginShellList[]= _("unconfigured");
+      }
+    }
+
+    /* Insert possibly missing loginShell */
+    if ($this->loginShell != "" && !in_array($this->loginShell, $this->loginShellList)){
+      $this->loginShellList[]= $this->loginShell;
+    }
+
+    /* Generate group list */
+    $this->ui = get_userinfo(); 
+    $this->secondaryGroups[]= "- "._("automatic")." -";
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(objectClass=posixGroup)", array("cn", "gidNumber"));
+    while($attrs = $ldap->fetch()){
+      $this->secondaryGroups[$attrs['gidNumber'][0]]= $attrs['cn'][0];
+    }
+    asort ($this->secondaryGroups);
+
+    /* Get global filter config */
+    if (!is_global("sysfilter")){
+      $ui= get_userinfo();
+      $base= get_base_from_people($ui->dn);
+      $sysfilter= array( "depselect"       => $base,
+          "regex"           => "*");
+      register_global("sysfilter", $sysfilter);
+    }
+    $this->ui = get_userinfo();
+  }
+
+
+  /* execute generates the html output for this node */
+  function execute($isCopyPaste = false)
+  {
+    /* Call parent execute */
+    plugin::execute();
+    $display= "";
+
+    /* Log view */
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","users/".get_class($this),$this->dn);
+    }
+
+    /* Department has changed? */
+    if(isset($_POST['depselect'])){
+      $_SESSION['CurrentMainBase']= validate($_POST['depselect']);
+    }
+
+    if($this->multiple_support_active){
+      $this->is_account = TRUE;
+    }
+
+    if(!$isCopyPaste && ! $this->multiple_support_active){
+
+      /* 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;
+        }
+      }
+
+      /* Do we represent a valid posixAccount? */
+      if (!$this->is_account && $this->parent === NULL ){
+        $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\">&nbsp;<b>".
+          _("This account has no unix extensions.")."</b>";
+        $display.= back_to_main();
+        return ($display);
+      }
+
+
+      /* Show tab dialog headers */
+      if ($this->parent !== NULL){
+        if ($this->is_account){
+          if (isset($this->parent->by_object['sambaAccount'])){
+            $obj= $this->parent->by_object['sambaAccount'];
+          }
+          if (isset($obj) && $obj->is_account == TRUE &&
+              ((isset($this->parent->by_object['sambaAccount']))&&($this->parent->by_object['sambaAccount']->is_account))
+              ||(isset($this->parent->by_object['environment'] ))&&($this->parent->by_object['environment'] ->is_account)){
+
+            /* Samba3 dependency on posix accounts are enabled
+               in the moment, because I need to rely on unique
+               uidNumbers. There'll be a better solution later
+               on. */
+            $display= $this->show_disable_header(_("Remove posix account"),
+                _("This account has unix features enabled. To disable them, you'll need to remove the samba / environment account first."), TRUE);
+          } else {
+            $display= $this->show_disable_header(_("Remove posix account"),
+                _("This account has posix features enabled. You can disable them by clicking below."));
+          }
+        } else {
+          $display= $this->show_enable_header(_("Create posix account"),
+              _("This account has posix features disabled. You can enable them by clicking below."));
+          return($display);
+        }
+      }
+    }
+    /* Trigger group edit? */
+    if (isset($_POST['edit_groupmembership'])){
+      $this->group_dialog= TRUE;
+      $this->dialog= TRUE;
+    }
+
+    /* Cancel group edit? */
+    if (isset($_POST['add_groups_cancel']) ||
+        isset($_POST['add_groups_finish'])){
+      $this->group_dialog= FALSE;
+      $this->dialog= FALSE;
+    }
+
+    /* Add selected groups */
+    if (isset($_POST['add_groups_finish']) && isset($_POST['groups']) &&
+        count($_POST['groups'])){
+
+      $this->addGroup ($_POST['groups']);
+    }
+
+    /* Delete selected groups */
+    if (isset($_POST['delete_groupmembership']) && 
+        isset($_POST['group_list']) && count($_POST['group_list'])){
+
+      $this->delGroup ($_POST['group_list']);
+    }
+
+    /* Add user workstation? */
+    if (isset($_POST["add_ws"])){
+      $this->show_ws_dialog= TRUE;
+      $this->dialog= TRUE;
+    }
+
+    /* Add user workstation? */
+    if (isset($_POST["add_ws_finish"]) && isset($_POST['wslist'])){
+      foreach($_POST['wslist'] as $ws){
+        $this->accessTo[$ws]= $ws;
+      }
+      ksort($this->accessTo);
+      $this->is_modified= TRUE;
+    }
+
+    /* Remove user workstations? */
+    if (isset($_POST["delete_ws"]) && isset($_POST['workstation_list'])){
+      foreach($_POST['workstation_list'] as $name){
+        unset ($this->accessTo[$name]);
+      }
+      $this->is_modified= TRUE;
+    }
+
+    /* Add user workstation finished? */
+    if (isset($_POST["add_ws_finish"]) || isset($_POST["add_ws_cancel"])){
+      $this->show_ws_dialog= FALSE;
+      $this->dialog= FALSE;
+    }
+
+    /* Templates now! */
+    $smarty= get_smarty();
+
+    /* Show ws dialog */
+    if ($this->show_ws_dialog){
+      /* Save data */
+      $sysfilter= get_global("sysfilter");
+      foreach( array("depselect", "regex") as $type){
+        if (isset($_POST[$type])){
+          $sysfilter[$type]= $_POST[$type];
+        }
+      }
+      if (isset($_GET['search'])){
+        $s= mb_substr($_GET['search'], 0, 1, "UTF8")."*";
+        if ($s == "**"){
+          $s= "*";
+        }
+        $sysfilter['regex']= $s;
+      }
+      register_global("sysfilter", $sysfilter);
+
+      /* Get workstation list */
+      $exclude= "";
+      foreach($this->accessTo as $ws){
+        $exclude.= "(cn=$ws)";
+      }
+      if ($exclude != ""){
+        $exclude= "(!(|$exclude))";
+      }
+      $regex= $sysfilter['regex'];
+      $filter= "(&(|(objectClass=goServer)(objectClass=gotoWorkstation)(objectClass=gotoTerminal))$exclude(cn=*)(cn=$regex))";
+      $res= get_list($filter, "groups", $sysfilter['depselect'], array("cn"), GL_SUBSEARCH | GL_SIZELIMIT);
+      $wslist= array();
+      foreach ($res as $attrs){
+        $wslist[]= preg_replace('/\$/', '', $attrs['cn'][0]);
+      }
+      asort($wslist);
+      $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("deplist", $this->config->idepartments);
+      $smarty->assign("alphabet", generate_alphabet());
+      foreach( array("depselect", "regex") as $type){
+        $smarty->assign("$type", $sysfilter[$type]);
+      }
+      $smarty->assign("hint", print_sizelimit_warning());
+      $smarty->assign("wslist", $wslist);
+      $smarty->assign("apply", apply_filter());
+      $display= $smarty->fetch (get_template_path('trust_machines.tpl', TRUE, dirname(__FILE__)));
+      return ($display);
+    }
+
+    /* Manage group add dialog */
+    if ($this->group_dialog){
+
+      /* Get global filter config */
+      $this->reload();
+
+      /* remove already assigned groups */
+      $glist= array();
+      foreach ($this->grouplist as $key => $value){
+        if (!isset($this->groupMembership[$key]) && obj_is_writable($key,"groups/group","memberUid")){
+          $glist[$key]= $value;
+        }
+      }
+
+      if($this->SubSearch){
+        $smarty->assign("SubSearchCHK"," checked ");
+      }else{
+        $smarty->assign("SubSearchCHK","");
+      }
+
+      $smarty->assign("regex",$this->GroupRegex);
+      $smarty->assign("guser",$this->GroupUserRegex);
+      $smarty->assign("groups", $glist);
+      $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("deplist", $this->config->idepartments);
+      $smarty->assign("alphabet", generate_alphabet());
+      $smarty->assign("depselect",$_SESSION['CurrentMainBase']);
+      $smarty->assign("hint", print_sizelimit_warning());
+
+      $smarty->assign("apply", apply_filter());
+      $display.= $smarty->fetch (get_template_path('posix_groups.tpl', TRUE, dirname(__FILE__)));
+      return ($display);
+    }
+
+    /* Show main page */
+    $smarty= get_smarty();
+
+    /* In 'MyAccount' mode, we must remove write acls if we are not in editing mode. */ 
+    $SkipWrite = (!isset($this->parent) || !$this->parent) && !isset($_SESSION['edit']);
+
+    /* Depending on pwmode, currently hardcoded because there are no other methods */
+    if ( 1 == 1 ){
+      $smarty->assign("pwmode", dirname(__FILE__)."/posix_shadow");
+
+      $shadowMinACL     =  $this->getacl("shadowMin",$SkipWrite);
+      $smarty->assign("shadowmins", sprintf(_("Password can't be changed up to %s days after last change"), 
+                                              "<input name=\"shadowMin\" size=3 maxlength=4 value=\"".$this->shadowMin."\">"));
+
+      $shadowMaxACL     =  $this->getacl("shadowMax",$SkipWrite);
+      $smarty->assign("shadowmaxs", sprintf(_("Password must be changed after %s days"), 
+                                              "<input name=\"shadowMax\" size=3 maxlength=4 value=\"".$this->shadowMax."\">"));
+
+      $shadowInactiveACL=  $this->getacl("shadowInactive",$SkipWrite);
+      $smarty->assign("shadowinactives", sprintf(_("Disable account after %s days of inactivity after password expiery"), 
+                                              "<input name=\"shadowInactive\" size=3 maxlength=4 value=\"".$this->shadowInactive."\">"));
+
+      $shadowWarningACL =  $this->getacl("shadowWarning",$SkipWrite);
+      $smarty->assign("shadowwarnings", sprintf(_("Warn user %s days before password expiery"), 
+                                              "<input name=\"shadowWarning\" size=3 maxlength=4 value=\"".$this->shadowWarning."\">"));
+
+      foreach( array("use_shadowMin", "use_shadowMax",
+                     "use_shadowExpire", "use_shadowInactive","use_shadowWarning") as $val){
+        if ($this->$val == 1){
+          $smarty->assign("$val", "checked");
+        } else {
+          $smarty->assign("$val", "");
+        }
+        $smarty->assign("$val"."ACL", $this->getacl($val,$SkipWrite));
+      }
+
+      if($this->mustchangepassword){
+        $smarty->assign("mustchangepassword", "checked");
+      } else {
+        $smarty->assign("mustchangepassword", "");
+      }
+      $smarty->assign("mustchangepasswordACL", $this->getacl("mustchangepassword",$SkipWrite));
+    }
+
+    /* Fill calendar */
+    /* If this $this->shadowExpire is empty 
+        use current date as base for calculating selectbox values.
+       (This attribute is empty if this is a new user )*/ 
+    if(empty($this->shadowExpire)){
+      $date= getdate(time());
+    }else{
+      $date= getdate($this->shadowExpire);
+    }
+    $days= array();
+    for($d= 1; $d<32; $d++){
+      $days[$d]= $d;
+    }
+    $years= array();
+    for($y= $date['year']-10; $y<$date['year']+10; $y++){
+      $years[]= $y;
+    }
+    $months= array(_("January"), _("February"), _("March"), _("April"),
+        _("May"), _("June"), _("July"), _("August"), _("September"),
+        _("October"), _("November"), _("December"));
+    $smarty->assign("day", $date["mday"]);
+    $smarty->assign("days", $days);
+    $smarty->assign("months", $months);
+    $smarty->assign("month", $date["mon"]-1);
+    $smarty->assign("years", $years);
+    $smarty->assign("year", $date["year"]);
+
+    /* Fill arrays */
+    $smarty->assign("shells", $this->loginShellList);
+    $smarty->assign("secondaryGroups", $this->secondaryGroups);
+    $smarty->assign("primaryGroup", $this->primaryGroup);
+    if (!count($this->groupMembership)){
+      $smarty->assign("groupMembership", array("&nbsp;"));
+    } else {
+      $smarty->assign("groupMembership", $this->groupMembership);
+    }
+    if (count($this->groupMembership) > 16){
+      $smarty->assign("groups", "too_many_for_nfs");
+    } else {
+      $smarty->assign("groups", "");
+    }
+
+    /* Avoid "Undefined index: forceMode" */
+    $smarty->assign("forceMode", "");
+
+    /* Checkboxes */
+    if ($this->force_ids == 1){
+      $smarty->assign("force_ids", "checked");
+      if ($_SESSION['js']){
+        $smarty->assign("forceMode", "");
+      }
+    } else {
+      if ($_SESSION['js']){
+        $smarty->assign("forceMode", "disabled");
+      }
+      $smarty->assign("force_ids", "");
+    }
+
+    
+
+    $smarty->assign("force_idsACL", $this->getacl("uidNumber",$SkipWrite).$this->getacl("gidNumber",$SkipWrite));
+
+    foreach(array("primaryGroup") as $val){
+      if(in_array($val,$this->multi_boxes)){
+        $smarty->assign("use_".$val,TRUE);
+      }else{
+        $smarty->assign("use_".$val,FALSE);
+      }
+    }
+
+
+    /* Load attributes and acl's */
+    foreach($this->attributes as $val){
+      if(in_array($val,$this->multi_boxes)){
+        $smarty->assign("use_".$val,TRUE);
+      }else{
+        $smarty->assign("use_".$val,FALSE);
+      }
+
+      if(($_SESSION["js"])&&(($val=="uidNumber")||($val=="gidNumber")))
+      {
+        $smarty->assign("$val"."ACL",$this->getacl($val,$SkipWrite));
+        $smarty->assign("$val", $this->$val);
+        continue;
+      }
+      $smarty->assign("$val", $this->$val);
+      $smarty->assign("$val"."ACL", $this->getacl($val,$SkipWrite));
+    }
+    if($SkipWrite){
+      $smarty->assign("groupMembershipACL","r");
+    }else{
+      $smarty->assign("groupMembershipACL","rw");
+    }
+    $smarty->assign("status", $this->status);
+
+    /* Work on trust modes */
+    $smarty->assign("trusthide", " disabled ");
+    $smarty->assign("trustmodeACL",  $this->getacl("trustModel",$SkipWrite));
+    if ($this->trustModel == "fullaccess"){
+      $trustmode= 1;
+      // pervent double disable tag in html code, this will disturb our clean w3c html
+      $smarty->assign("trustmode",  $this->getacl("trustModel",$SkipWrite));
+
+    } elseif ($this->trustModel == "byhost"){
+      $trustmode= 2;
+      $smarty->assign("trusthide", "");
+    } else {
+      // pervent double disable tag in html code, this will disturb our clean w3c html
+      $smarty->assign("trustmode",  $this->getacl("trustModel",$SkipWrite));
+      $trustmode= 0;
+    }
+    $smarty->assign("trustmode", $trustmode);
+    $smarty->assign("trustmodes", array( 0 => _("disabled"), 1 => _("full access"),
+          2 => _("allow access to these hosts")));
+
+
+
+    if((count($this->accessTo))==0)
+      $smarty->assign("emptyArrAccess",true);
+    else
+      $smarty->assign("emptyArrAccess",false);
+
+
+
+    $smarty->assign("workstations", $this->accessTo);
+
+    $smarty->assign("apply", apply_filter());
+    $smarty->assign("multiple_support" , $this->multiple_support_active);
+    $display.= $smarty->fetch (get_template_path('generic.tpl', TRUE, dirname(__FILE__)));
+    return($display);
+  }
+
+
+  /* remove object from parent */
+  function remove_from_parent()
+  {
+    /* Cancel if there's nothing to do here */
+    if ((!$this->initially_was_account) || (!$this->acl_is_removeable())){
+      return;
+    }
+
+    /* include global link_info */
+    $ldap= $this->config->get_ldap_link();
+
+    /* Remove and write to LDAP */
+    plugin::remove_from_parent();
+
+    /* Zero out array */
+    $this->attrs['gosaHostACL']= array();
+
+    /* Keep uid, because we need it for authentification! */
+    unset($this->attrs['uid']);
+    unset($this->attrs['trustModel']);
+
+    @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
+        $this->attributes, "Save");
+    $ldap->cd($this->dn);
+    $this->cleanup();
+    $ldap->modify ($this->attrs); 
+
+    new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+
+    show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/posix account with dn '%s' failed."),$this->dn));
+
+    /* Delete group only if cn is uid and there are no other
+       members inside */
+    $ldap->cd ($this->config->current['BASE']);
+    $ldap->search ("(&(objectClass=posixGroup)(gidNumber=".$this->gidNumber."))", array("cn", "memberUid"));
+    if ($ldap->count() != 0){
+      $attrs= $ldap->fetch();
+      if ($attrs['cn'][0] == $this->uid &&
+          !isset($this->attrs['memberUid'])){
+
+        $ldap->rmDir($ldap->getDN());
+      }
+    }
+
+    /* Optionally execute a command after we're done */
+    $this->handle_post_events("remove",array("uid" => $this->uid));
+  }
+
+
+  function save_object()
+  {
+    if (isset($_POST['posixTab'])){
+      /* Save values to object */
+      plugin::save_object();
+
+
+      /* Save force GID checkbox */
+      if($this->acl_is_writeable("gidNumber") || $this->acl_is_writeable("uidNumber")){
+        if (isset ($_POST['force_ids'])){
+          $data= 1;
+        } else {
+          $data= 0;
+        }
+        if ($this->force_ids != $data){
+          $this->is_modified= TRUE;
+        }
+        $this->force_ids= $data;
+      }
+
+      /*Save primary group settings */
+      if($this->acl_is_writeable("primaryGroup") && isset($_POST['primaryGroup'])){
+        $data= $_POST['primaryGroup'];
+        if ($this->primaryGroup != $data){
+          $this->is_modified= TRUE;
+        }
+        $this->primaryGroup= $_POST['primaryGroup'];
+      }
+
+      foreach(array("shadowMin","shadowMax","shadowExpire","shadowInactive","shadowWarning","mustchangepassword") as $var) {
+        if($this->acl_is_writeable($var)){
+          $use_var = "use_".$var;
+          if(isset($_POST['use_'.$var])){
+            $this->$use_var  = true;
+            $this->$var      = $_POST[$var];
+          }else{
+            $this->$use_var  = false;
+            $this->$var      = 0;
+          }
+        }
+      }
+
+      /* Trust mode - special handling */
+      if($this->acl_is_writeable("trustModel")){
+        if (isset($_POST['trustmode'])){
+          $saved= $this->trustModel;
+          if ($_POST['trustmode'] == "1"){
+            $this->trustModel= "fullaccess";
+          } elseif ($_POST['trustmode'] == "2"){
+            $this->trustModel= "byhost";
+          } else {
+            $this->trustModel= "";
+          }
+          if ($this->trustModel != $saved){
+            $this->is_modified= TRUE;
+          }
+        }
+      }
+    }
+
+    /* Get regex from alphabet */
+    if(isset($_GET['search'])){
+      $this->GroupRegex = $_GET['search']."*";
+    }
+
+    /* Check checkboxes and regexes */
+    if(isset($_POST["PosixGroupDialogPosted"])){
+
+      if(isset($_POST['SubSearch']) && ($_POST['SubSearch'])){
+        $this->SubSearch = true;
+      }else{
+        $this->SubSearch = false;
+      }
+      if(isset($_POST['guser'])){
+        $this->GroupUserRegex = $_POST['guser'];
+      }
+      if(isset($_POST['regex'])){
+        $this->GroupRegex = $_POST['regex'];
+      }
+    }
+    $this->GroupRegex = preg_replace("/\*\**/","*",$this->GroupRegex);
+    $this->GroupUserRegex = preg_replace("/\*\**/","*",$this->GroupUserRegex);
+  }
+
+
+  /* Save data to LDAP, depending on is_account we save or delete */
+  function save()
+  {
+
+    /* include global link_info */
+    $ldap= $this->config->get_ldap_link();
+
+    /* Adapt shadow values */
+    if (!$this->use_shadowExpire){
+      $this->shadowExpire= "0";
+    } else {
+      /* Transform seconds to days here */
+      $this->shadowExpire= (int)($this->shadowExpire / (60 * 60 * 24)) ;
+    }
+    if (!$this->use_shadowMax){
+      $this->shadowMax= "0";
+    }
+    if ($this->mustchangepassword){
+      $this->shadowLastChange= (int)(date("U") / 86400) - $this->shadowMax - 1;
+    } else {
+      $this->shadowLastChange= (int)(date("U") / 86400);
+    }
+    if (!$this->use_shadowWarning){
+      $this->shadowWarning= "0";
+    }
+
+    /* Check what to do with ID's */
+    if ($this->force_ids == 0){
+
+      /* Use id's that are already set */
+      if ($this->savedUidNumber != ""){
+        $this->uidNumber= $this->savedUidNumber;
+        $this->gidNumber= $this->savedGidNumber;
+      } else {
+
+        /* Calculate new id's. We need to place a lock before calling get_next_id
+           to get real unique values. */
+        $wait= 10;
+        while (get_lock("uidnumber") != ""){
+          sleep (1);
+
+          /* Oups - timed out */
+          if ($wait-- == 0){
+            print_red (_("Failed: overriding lock"));
+            break;
+          }
+        }
+
+        add_lock ("uidnumber", "gosa");
+        $this->uidNumber= $this->get_next_id("uidNumber", $this->dn);
+        if ($this->savedGidNumber != ""){
+          $this->gidNumber= $this->savedGidNumber;
+        } else {
+          $this->gidNumber= $this->get_next_id("gidNumber", $this->dn);
+        }
+      }
+
+      if ($this->primaryGroup != 0){
+        $this->gidNumber= $this->primaryGroup;
+      }
+    }
+
+    if ($this->use_shadowMin != "1" ) {
+      $this->shadowMin = "";
+    }
+
+    if (($this->use_shadowMax != "1") && ($this->mustchangepassword != "1")) {
+      $this->shadowMax = "";
+    }
+
+    if ($this->use_shadowWarning != "1" ) {
+      $this->shadowWarning = "";
+    }
+
+    if ($this->use_shadowInactive != "1" ) {
+      $this->shadowInactive = "";
+    }
+
+    if ($this->use_shadowExpire != "1" ) {
+      $this->shadowExpire = "";
+    }
+
+    /* Fill gecos */
+    if (isset($this->parent) && $this->parent !== NULL){
+      $this->gecos= rewrite($this->parent->by_object['user']->cn);
+      if (!preg_match('/^[a-z0-9 -]+$/i', $this->gecos)){
+        $this->gecos= "";
+      }
+    }
+
+    foreach(array("shadowMin","shadowMax","shadowWarning","shadowInactive","shadowExpire") as $attr){
+      $this->$attr = (int) $this->$attr;
+    }
+    /* Call parents save to prepare $this->attrs */
+    plugin::save();
+
+    /* Trust accounts */
+    $objectclasses= array();
+    foreach ($this->attrs['objectClass'] as $key => $class){
+      if (preg_match('/trustAccount/i', $class)){
+        continue;
+      }
+      $objectclasses[]= $this->attrs['objectClass'][$key];
+    }
+    $this->attrs['objectClass']= $objectclasses;
+    if ($this->trustModel != ""){
+      $this->attrs['objectClass'][]= "trustAccount";
+      $this->attrs['trustModel']= $this->trustModel;
+      $this->attrs['accessTo']= array();
+      if ($this->trustModel == "byhost"){
+        foreach ($this->accessTo as $host){
+          $this->attrs['accessTo'][]= $host;
+        }
+      }
+    } else {
+      if ($this->was_trust_account){
+        $this->attrs['accessTo']= array();
+        $this->attrs['trustModel']= array();
+      }
+    }
+
+    if(empty($this->attrs['gosaDefaultPrinter'])){
+      $thid->attrs['gosaDefaultPrinter']=array();
+    }
+
+
+    /* Save data to LDAP */
+    $ldap->cd($this->dn);
+    $this->cleanup();
+    unset($this->attrs['uid']);
+    $ldap->modify ($this->attrs); 
+
+    /* Log last action */ 
+    if($this->initially_was_account){
+      new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
+
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/posix account with dn '%s' failed."),$this->dn));
+
+    /* Remove lock needed for unique id generation */
+    del_lock ("uidnumber");
+
+    /* Posix accounts have group interrelationship, 
+       take care about these here if this is a new user without forced gidNumber. */
+    if ($this->force_ids == 0 && $this->primaryGroup == 0 && !$this->initially_was_account){
+      $ldap->cd($this->config->current['BASE']);
+      $ldap->search("(&(objectClass=posixGroup)(gidNumber=".$this->gidNumber."))", array("cn"));
+
+      /* Create group if it doesn't exist */
+      if ($ldap->count() == 0){
+        $groupdn= preg_replace ('/^'.$this->config->current['DNMODE'].'=[^,]+,'.get_people_ou().'/i', 'cn='.$this->uid.','.get_groups_ou(), $this->dn);
+
+        $g= new group($this->config, $groupdn);
+        $g->cn= $this->uid;
+        $g->force_gid= 1;
+        $g->gidNumber= $this->gidNumber;
+        $g->description= "Group of user ".$this->givenName." ".$this->sn;
+        $g->save ();
+      }
+    }
+
+    /* Take care about groupMembership values: add to groups */
+    foreach ($this->groupMembership as $key => $value){
+      if (!isset($this->savedGroupMembership[$key])){
+        $g= new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], $key,"groups");
+        $g->set_acl_base($key);
+        $g->by_object['group']->addUser($this->uid);
+        $g->save();
+      }
+    }
+
+    /* Remove from groups not listed in groupMembership */
+    foreach ($this->savedGroupMembership as $key => $value){
+      if (!isset($this->groupMembership[$key])){
+        $g= new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], $key,"groups");
+        $g->set_acl_base($key);
+        $g->by_object['group']->removeUser ($this->uid);
+        $g->save();
+      }
+    }
+
+    /* 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",array("uid" => $this->uid));
+      }
+    } else {
+      $this->handle_post_events("add" ,array("uid"=> $this->uid));
+    }
+  }
+
+  /* Check formular input */
+  function check()
+  {
+    /* Include global link_info */
+    $ldap= $this->config->get_ldap_link();
+
+    /* Append groups as memberGroup: to check hook 
+     */
+    $tmp_attributes  = $this->attributes;    
+    $this->attributes[] = "memberGroup";
+    $this->memberGroup = array();
+    foreach($this->groupMembership as $dn => $name){
+      $this->memberGroup[] = $name;
+    }
+
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+    $this->attributes = $tmp_attributes;
+
+    /* must: homeDirectory */
+    if ($this->homeDirectory == ""){
+      $message[]= _("The required field 'Home directory' is not set.");
+    }
+    if (!is_path($this->homeDirectory)){
+      $message[]= _("Please enter a valid path in 'Home directory' field.");
+    }
+
+    /* Check ID's if they are forced by user */
+    if ($this->force_ids == "1"){
+
+      /* Valid uid/gid? */
+      if (!is_id($this->uidNumber)){
+        $message[]= _("Value specified as 'UID' is not valid.");
+      } else {
+        if ($this->uidNumber < $this->config->current['MINID']){
+          $message[]= _("Value specified as 'UID' is too small.");
+        }
+      }
+      if (!is_id($this->gidNumber)){
+        $message[]= _("Value specified as 'GID' is not valid.");
+      } else {
+        if ($this->gidNumber < $this->config->current['MINID']){
+          $message[]= _("Value specified as 'GID' is too small.");
+        }
+      }
+    }
+
+    /* Check shadow settings, well I like spaghetties... */
+    if ($this->use_shadowMin){
+      if (!is_id($this->shadowMin)){
+        $message[]= _("Value specified as 'shadowMin' is not valid.");
+      }
+    }
+    if ($this->use_shadowMax){
+      if (!is_id($this->shadowMax)){
+        $message[]= _("Value specified as 'shadowMax' is not valid.");
+      }
+    }
+    if ($this->use_shadowWarning){
+      if (!is_id($this->shadowWarning)){
+        $message[]= _("Value specified as 'shadowWarning' is not valid.");
+      }
+      if (!$this->use_shadowMax){
+        $message[]= _("'shadowWarning' without 'shadowMax' makes no sense.");
+      }
+      if ($this->shadowWarning > $this->shadowMax){
+        $message[]= _("Value specified as 'shadowWarning' should be smaller than 'shadowMax'.");
+      }
+      if ($this->use_shadowMin && $this->shadowWarning < $this->shadowMin){
+        $message[]= _("Value specified as 'shadowWarning' should be greater than 'shadowMin'.");
+      }
+    }
+    if ($this->use_shadowInactive){
+      if (!is_id($this->shadowInactive)){
+        $message[]= _("Value specified as 'shadowInactive' is not valid.");
+      }
+      if (!$this->use_shadowMax){
+        $message[]= _("'shadowInactive' without 'shadowMax' makes no sense.");
+      }
+    }
+    if ($this->use_shadowMin && $this->use_shadowMax){
+      if ($this->shadowMin > $this->shadowMax){
+        $message[]= _("Value specified as 'shadowMin' should be smaller than 'shadowMax'.");
+      }
+    }
+
+    //  if(empty($this->gosaDefaultPrinter)){
+    //    $message[]= _("You need to specify a valid default printer.");
+    //  }
+
+    return ($message);
+  }
+
+  function addGroup ($groups)
+  {
+    /* include global link_info */
+    $ldap= $this->config->get_ldap_link();
+
+    /* Walk through groups and add the descriptive entry if not exists */
+    foreach ($groups as $value){
+      if (!array_key_exists($value, $this->groupMembership)){
+        $ldap->cat($value, array('cn', 'description', 'dn'));
+        $attrs= $ldap->fetch();
+        error_reporting (0);
+        if (!isset($attrs['description'][0])){
+          $entry= $attrs["cn"][0];
+        } else {
+          $dsc= preg_replace ('/^Group of user/', _("Group of user"), $attrs["description"][0]);
+          $entry= $attrs["cn"][0]." [$dsc]";
+        }
+        error_reporting (E_ALL | E_STRICT);
+
+        if(obj_is_writable($attrs['dn'],"groups/group","memberUid")){
+          $this->groupMembership[$attrs['dn']]= $entry;
+        }
+      }
+    }
+
+    /* Sort groups */
+    asort ($this->groupMembership);
+    reset ($this->groupMembership);
+  }
+
+
+  /* Del posix user from some groups */
+  function delGroup ($groups)
+  {
+    $dest= array();
+    foreach($groups as $dn_to_del){
+      if(isset($this->groupMembership[$dn_to_del]) && obj_is_writable($dn_to_del,"groups/group","memberUid")){
+        unset($this->groupMembership[$dn_to_del]);
+      }
+    }
+  }
+
+
+  /* Adapt from template, using 'dn' */
+  function adapt_from_template($dn)
+  {
+    /* Include global link_info */
+    $ldap= $this->config->get_ldap_link();
+
+    plugin::adapt_from_template($dn);
+    $template= $this->attrs['uid'][0];
+
+    /* Adapt group membership */
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(&(objectClass=posixGroup)(memberUid=".$this->attrs["uid"][0]."))", array("description", "cn"));
+
+    while ($this->attrs= $ldap->fetch()){
+      if (!isset($this->attrs["description"][0])){
+        $entry= $this->attrs["cn"][0];
+      } else {
+        $entry= $this->attrs["cn"][0]." [".$this->attrs["description"][0]."]";
+      }
+      $this->groupMembership[$ldap->getDN()]= $entry;
+    }
+
+    /* Fix primary group settings */
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(&(objectClass=posixGroup)(cn=$template)(gidNumber=".$this->gidNumber."))", array("cn"));
+    if ($ldap->count() != 1){
+      $this->primaryGroup= $this->gidNumber;
+    }
+
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(&(objectClass=gosaUserTemplate)(uid=".$template.")(accessTo=*))", array("cn","accessTo"));
+    while($attr = $ldap->fetch()){
+      $tmp = $attr['accessTo'];
+      unset ($tmp['count']);
+      $this->accessTo = $tmp;  
+    }
+
+    /* Adjust shadow checkboxes */
+    foreach (array("shadowMin", "shadowMax", "shadowWarning", "shadowInactive") as $val){
+      if ($this->$val != 0){
+        $oval= "use_".$val;
+        $this->$oval= "1";
+      }
+    }
+
+    /* FIXME: NEED review of this section */
+    /* Need to check shadowExpire separately */
+
+    /* 
+     * If shadowExpire is not enabled in the template, it's a UNIX timestamp - so don't convert it to seconds.
+     * The check is a hack - if difference between timestamp generated above and here is max 1 day.
+     */
+    if(abs($this->shadowExpire - time())>86400) {
+      $this->shadowExpire= $this->convertToSeconds($this->shadowExpire);
+    }
+    
+    /* Only enable checkbox, if shadowExpire is in the future */
+    if($this->shadowExpire > time()) {
+      $this->use_shadowExpire= "1";
+    }
+  }
+
+  function convertToSeconds($val)
+  {
+    if ($val != 0){
+      $val*= 60 * 60 * 24;
+    } else {
+      $date= getdate();
+      $val= floor($date[0] / (60*60*24)) * 60 * 60 * 24;
+    }
+    return($val);
+  }
+
+
+  function get_next_id($attrib, $dn)
+  {
+    $ids= array();
+    $ldap= $this->config->get_ldap_link();
+
+    $ldap->cd ($this->config->current['BASE']);
+    if (preg_match('/gidNumber/i', $attrib)){
+      $oc= "posixGroup";
+    } else {
+      $oc= "posixAccount";
+    }
+    $ldap->search ("(&(objectClass=$oc)($attrib=*))", array("$attrib"));
+
+    /* Get list of ids */
+    while ($attrs= $ldap->fetch()){
+      $ids[]= (int)$attrs["$attrib"][0];
+    }
+
+    /* Add the nobody id */
+    $ids[]= 65534;
+
+    /* get the ranges */
+    $tmp = array('0'=> 1000); 
+    if (preg_match('/posixAccount/', $oc) && isset($this->config->current['UIDBASE'])) {
+      $tmp= split('-',$this->config->current['UIDBASE']);
+    } elseif(isset($this->config->current['GIDBASE'])){
+      $tmp= split('-',$this->config->current['GIDBASE']);
+    }
+
+    /* Set hwm to max if not set - for backward compatibility */
+    $lwm= $tmp[0];
+    if (isset($tmp[1])){
+      $hwm= $tmp[1];
+    } else {
+      $hwm= pow(2,32);
+    }
+
+    /* Find out next free id near to UID_BASE */
+    if (!isset($this->config->current['BASE_HOOK'])){
+      $base= $lwm;
+    } else {
+      /* Call base hook */
+      $base= get_base_from_hook($dn, $attrib);
+    }
+    for ($id= $base; $id++; $id < pow(2,32)){
+      if (!in_array($id, $ids)){
+        return ($id);
+      }
+    }
+
+    /* Should not happen */
+    if ($id == $hwm){
+      print_red(_("Too many users, can't allocate a free ID!"));
+      exit;
+    }
+
+  }
+
+  function reload()
+  {
+    /* Set base for all searches */
+    $base     = $_SESSION['CurrentMainBase'];
+    $base     = $base;
+    $ldap     = $this->config->get_ldap_link();    
+    $attrs    =  array("cn", "description", "gidNumber");
+    $Flags    = GL_SIZELIMIT;
+
+    /* Get groups */
+    if ($this->GroupUserRegex == '*'){
+      $filter = "(&(objectClass=posixGroup)(cn=".$this->GroupRegex."))";
+    } else {
+      $filter= "(&(objectClass=posixGroup)(cn=".$this->GroupRegex.")(memberUid=".$this->GroupUserRegex."))";
+    }
+    if($this->SubSearch){
+      $Flags |= GL_SUBSEARCH;
+    }else{
+      $base = get_groups_ou().$base;
+    }
+
+    $res= get_list($filter, "groups", $base,$attrs, $Flags);
+  
+    /* check sizelimit */
+    if (preg_match("/size limit/i", $ldap->error)){
+      $_SESSION['limit_exceeded']= TRUE;
+    }
+
+    /* Create a list of users */
+    $this->grouplist = array();
+    foreach ($res as $value){
+      $this->grouplist[$value['gidNumber'][0]]= $value;
+    }
+
+    $tmp=array();
+    foreach($this->grouplist as $tkey => $val ){
+      $tmp[strtolower($val['cn'][0]).$val['cn'][0]]=$val;
+    }
+
+    /* Sort index */
+    ksort($tmp);
+
+    /* Recreate index array[dn]=cn[description]*/
+    $this->grouplist=array();
+    foreach($tmp as $val){
+      if(isset($val['description'])){
+        $this->grouplist[$val['dn']]=$val['cn'][0]."&nbsp;[".$val['description'][0]."]";
+      }else{
+        $this->grouplist[$val['dn']]=$val['cn'][0];
+      }
+    }
+
+    reset ($this->grouplist);
+  }
+
+
+  /* Get posts from copy & paste dialog */ 
+  function saveCopyDialog()
+  {
+    if(isset($_POST['homeDirectory'])){
+      $this->homeDirectory = $_POST['homeDirectory'];
+      if (isset ($_POST['force_ids'])){
+        $data= 1;
+        $this->gidNumber = $_POST['gidNumber'];
+        $this->uidNumber = $_POST['uidNumber'];
+      } else {
+        $data= 0;
+      }
+      if ($this->force_ids != $data){
+        $this->is_modified= TRUE;
+      }
+      $this->force_ids= $data;
+    }
+  }
+
+  /* Create the posix dialog part for copy & paste */
+  function getCopyDialog()
+  {
+    /* Skip dialog creation if this is not a valid account*/
+    if(!$this->is_account) return("");
+    if ($this->force_ids == 1){
+      $force_ids = "checked";
+      if ($_SESSION['js']){
+        $forceMode = "";
+      }
+    } else {
+      if ($_SESSION['js']){
+        if($this->acl != "#none#")
+          $forceMode ="disabled";
+      }
+      $force_ids = "";
+    }
+
+    $sta = "";
+
+    /* Open group add dialog */
+    if(isset($_POST['edit_groupmembership'])){
+      $this->group_dialog = TRUE;
+      $sta = "SubDialog";
+    }
+
+    /* If the group-add dialog is closed, call execute 
+       to ensure that the membership is updatd */
+    if(isset($_POST['add_groups_finish']) || isset($_POST['add_groups_cancel'])){
+      $this->execute();
+      $this->group_dialog =FALSE;
+    }
+
+    if($this->group_dialog){
+      $str = $this->execute(true);
+      $ret = array();
+      $ret['string'] = $str;
+      $ret['status'] = $sta;
+      return($ret);
+    }
+
+    /* If a group member should be deleted, simply call execute */
+    if(isset($_POST['delete_groupmembership'])){
+      $this->execute();
+    }
+
+    /* Assigned informations to smarty */
+    $smarty = get_smarty();
+    $smarty->assign("homeDirectory",$this->homeDirectory);
+    $smarty->assign("uidNumber",$this->uidNumber);
+    $smarty->assign("gidNumber",$this->gidNumber);
+    $smarty->assign("forceMode",$forceMode);
+    $smarty->assign("force_ids",$force_ids);
+    if (!count($this->groupMembership)){
+      $smarty->assign("groupMembership", array("&nbsp;"));
+    } else {
+      $smarty->assign("groupMembership", $this->groupMembership);
+    }
+
+    /* Display wars message if there are more than 16 group members */
+    if (count($this->groupMembership) > 16){
+      $smarty->assign("groups", "too_many_for_nfs");
+    } else {
+      $smarty->assign("groups", "");
+    }
+    $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE,dirname(__FILE__)));
+
+    $ret = array();
+    $ret['string'] = $str;
+    $ret['status'] = $sta;
+    return($ret);
+  }
+
+
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);
+
+    /* Avoid using the same gid/uid number as source user */
+    $this->savedUidNumber = $this->get_next_id("gidNumber", $this->dn);
+    $this->savedGidNumber = $this->get_next_id("uidNumber", $this->dn);
+  }
+
+
+  function multiple_execute()
+  {
+    return($this->execute());
+  }
+
+
+  static function plInfo()
+  {
+    return (array(
+          "plDescription"     => _("POSIX account"),
+          "plSelfModify"      => TRUE,
+          "plDepends"         => array("user"),
+          "plPriority"        => 2,
+          "plSection"         => array("personal" => _("My account")),
+          "plCategory"        => array("users"),
+          "plOptions"         => array(),
+
+          "plProvidedAcls"  => array(
+
+            "homeDirectory"       =>  _("Home directory"), 
+            "loginShell"          =>  _("Shell"),
+            "uidNumber"           =>  _("User ID"),
+            "gidNumber"           =>  _("Group ID"),
+
+            "mustchangepassword"=>  _("Force password change on login"),
+            "shadowMin"           =>  _("Shadow min"),
+            "shadowMax"           =>  _("Shadow max"),
+            "shadowWarning"       =>  _("Shadow warning"),
+            "shadowInactive"      =>  _("Shadow inactive"),
+            "shadowExpire"        =>  _("Shadow expire"),
+            "trustModel"          =>  _("System trust model")))
+            );
+  }
+
+  function get_multi_edit_values()
+  {
+    $ret = plugin::get_multi_edit_values();
+    return($ret);
+  }
+
+
+  function multiple_save_object()
+  {
+    if(isset($_POST['posix_mulitple_edit'])){
+      plugin::multiple_save_object();
+      foreach(array("primaryGroup") as $val){
+        if(isset($_POST["use_".$val])){
+          $this->multi_boxes[] = $val;
+        }
+      }
+
+      /* Save primary group settings */
+      if($this->acl_is_writeable("primaryGroup") && isset($_POST['primaryGroup'])){
+        $data= $_POST['primaryGroup'];
+        if ($this->primaryGroup != $data){
+          $this->is_modified= TRUE;
+        }
+        $this->primaryGroup= $_POST['primaryGroup'];
+      }
+    }
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/personal/posix/generic.tpl b/gosa-core/plugins/personal/posix/generic.tpl
new file mode 100644 (file)
index 0000000..c9dc98d
--- /dev/null
@@ -0,0 +1,156 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=0 border=0>
+ <tr>
+  <td style="width:50%; vertical-align:top;">
+   <h2><img class="center" alt="" align="middle" src="images/rightarrow.png" /> {t}Generic{/t}</h2>
+   <table summary="">
+    <tr>
+     <td><label for="homeDirectory">{t}Home directory{/t}</label>{$must}</td>
+     <td>
+{render acl=$homeDirectoryACL checkbox=$multiple_support checked=$use_homeDirectory}
+      <input id="homeDirectory" name="homeDirectory" size=40 maxlength=120 value="{$homeDirectory}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><label for="loginShell">{t}Shell{/t}</label></td>
+     <td>
+{render acl=$loginShellACL checkbox=$multiple_support checked=$use_loginShell}
+      <select id="loginShell" size="1" name="loginShell">
+       {html_options values=$shells output=$shells selected=$loginShell}
+      </select> 
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><label for="">{t}Primary group{/t}</label></td>
+     <td>
+{render acl=$gidNumberACL checkbox=$multiple_support checked=$use_primaryGroup}
+      <select id="primaryGroup" size="1" name="primaryGroup">
+       {html_options options=$secondaryGroups selected=$primaryGroup}
+      </select> 
+{/render}
+     </td>
+    </tr>
+{if !$multiple_support}
+    <tr>
+     <td>{t}Status{/t}</td>
+     <td>{$status}</td>
+    </tr>
+{/if}
+   </table>
+
+{if !$multiple_support}
+
+   <table summary="">
+    <tr>
+     <td>
+{render acl=$force_idsACL}
+      <input id="force_ids" type=checkbox name="force_ids" value="1" {$force_ids} onclick="changeState('uidNumber'); changeState('gidNumber');">
+{/render}
+                                       </td>
+                                       <td>
+      <label for="force_ids">{t}Force UID/GID{/t}</label>
+     </td>
+                                       <td style="width:20px;"></td>
+                                       <td>
+                                               <label for="uidNumber">{t}UID{/t}</label>
+                                       </td>
+                                       <td>
+{render acl=$uidNumberACL}
+                                               <input id="uidNumber" name="uidNumber" size=9 maxlength=9 {$forceMode} value="{$uidNumber}">
+{/render}
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td colspan="3"></td>
+                                       <td>
+                                               <label for="gidNumber">{t}GID{/t}</label>
+                                       </td>
+     <td>
+{render acl=$gidNumberACL}
+                                               <input id="gidNumber" name="gidNumber" size=9 maxlength=9 {$forceMode} value="{$gidNumber}">
+{/render}
+                                       </td>
+                               </tr>
+   </table>
+{/if}
+  </td>
+  <td style="border-left:1px solid #A0A0A0">
+    &nbsp;
+  </td>
+  <td style="vertical-align:top;">
+   <h2><img alt="" class="center" align="middle" src="images/members.png" /> {t}Group membership{/t}</h2>
+   {if $groups eq "too_many_for_nfs"}
+    <b style="color:red">{t}(Warning: more than 16 groups are not supported by NFS!){/t}</b>
+    <br>
+   {/if}
+{render acl=$groupMembershipACL}
+   <select style="width:100%; height:130px;" name="group_list[]" size=16 multiple >
+{if !$multiple_support}
+    {html_options options=$groupMembership}
+{else}
+
+       
+{/if}
+   </select>
+{/render}
+   <br>
+{render acl=$groupMembershipACL}
+   <input type=submit value="{t}Add{/t}" name="edit_groupmembership" >&nbsp;
+{/render}
+{render acl=$groupMembershipACL}
+   <input type=submit value="{t}Delete{/t}" name="delete_groupmembership" >
+{/render}
+  </td>
+ </tr>
+</table>
+
+<p class="seperator">&nbsp;</p>
+
+<table summary="" style="width:100% ; vertical-align:top; text-align:left;" cellpadding=0 border=0>
+ <tr>
+  <td style='width:50%;vertical-align:top'>
+   <h2><img alt="" class="center" align="middle" src="images/terminal_small.png" /> {t}Account{/t}</h2>
+   {include file="$pwmode.tpl"}
+  </td>
+  <td style="border-left:1px solid #A0A0A0">
+    &nbsp;
+  </td>
+  <td style="vertical-align:top;">
+   <h2><img alt="" class="center" align="middle" src="images/closedlock.png" /> {t}System trust{/t}</h2>
+    {t}Trust mode{/t}&nbsp;
+{render acl=$trustmodeACL}
+       <select name="trustmode" id="trustmode" size=1 onchange="changeSelectState('trustmode', 'wslist'); changeSelectState('trustmode', 'add_ws'); changeSelectState('trustmode', 'del_ws');">
+      {html_options options=$trustmodes selected=$trustmode}
+    </select>
+{/render}
+{render acl=$trustmodeACL}
+   <select style="width:100%" id="wslist" name="workstation_list[]" size=8 multiple {$trusthide}>
+    {html_options values=$workstations output=$workstations}
+       {if $emptyArrAccess}
+               <option disabled>&nbsp;</option>
+       {/if}
+   </select>
+{/render}
+   <br>
+{render acl=$trustmodeACL}
+   <input type="submit" id="add_ws" value="{t}Add{/t}" name="add_ws" {$trusthide}>&nbsp;
+{/render}
+{render acl=$trustmodeACL}
+   <input type="submit" id="del_ws" value="{t}Delete{/t}" name="delete_ws" {$trusthide}>
+{/render}
+  </td>
+ </tr>
+</table>
+{if $multiple_support}
+       <input type="hidden" name="posix_mulitple_edit" value="1">
+{/if}
+
+<input type="hidden" name="posixTab" value="posixTab">
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('homeDirectory');
+  -->
+</script>
diff --git a/gosa-core/plugins/personal/posix/main.inc b/gosa-core/plugins/personal/posix/main.inc
new file mode 100644 (file)
index 0000000..31994ef
--- /dev/null
@@ -0,0 +1,133 @@
+<?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
+ */
+
+/* Clear display */
+$display  = "";
+$lock_msg = "";
+if (!$remove_lock){
+
+  /* Reset requested? */
+  if (isset($_POST['edit_cancel']) ||  (isset($_GET['reset']) && $_GET['reset'] == 1)){
+    del_lock ($ui->dn);
+    sess_del ('edit');
+    sess_del ('posixAccount');
+  }
+
+  /* Create posixAccount object on demand */
+  if (!isset($_SESSION['posixAccount']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+    $_SESSION['posixAccount']= new posixAccount ($config, $ui->dn);
+    $_SESSION['posixAccount']->enable_CSN_check();
+    $_SESSION['posixAccount']->set_acl_base($ui->dn);
+    $_SESSION['posixAccount']->set_acl_category("users");
+  }
+  $posixAccount= $_SESSION['posixAccount'];
+
+  /* save changes back to object */
+  if (isset ($_SESSION['edit'])){
+    $posixAccount->save_object ();
+  }
+
+  /* Enter edit mode? */
+  if ((isset($_POST['edit'])) && (!isset($_SESSION['edit']))){
+    
+    /* Check locking */
+    if (($username= get_lock($ui->dn)) != ""){
+      $_SESSION['back_plugin']= $plug;
+      $_SESSION['LOCK_VARS_TO_USE'] = array("/^edit$/","/^plug$/");
+      $lock_msg =  gen_locked_message ($username, $ui->dn);
+
+    }else{
+
+      /* Lock the current entry */
+      add_lock ($ui->dn, $ui->dn);
+      $_SESSION['dn']= $ui->dn;
+      $_SESSION['edit']= TRUE;
+    }
+  }
+
+  /* save changes to LDAP and disable edit mode */
+  $info= "";
+  if (isset($_POST['edit_finish'])){
+
+    /* Perform checks */
+    $message= $posixAccount->check ();
+
+    /* No errors, save object */
+    if (count ($message) == 0){
+      $posixAccount->save ();
+      del_lock ($ui->dn);
+      sess_del ('edit');
+
+      /* Remove from session */
+      sess_del ('posixAccount');
+    } else {
+      /* Errors found, show message */
+      show_errors ($message);
+    }
+  }
+
+  /* Execute formular */
+  if($lock_msg){
+    $display = $lock_msg;
+  }else{
+    $display.= $posixAccount->execute ();
+  }
+
+  /* Store changes  in session */
+  if (isset ($_SESSION['edit'])){
+    $_SESSION['posixAccount']= $posixAccount;
+  }
+
+  /* Show page footer depending on the mode */
+  if (!$posixAccount->group_dialog && !$posixAccount->show_ws_dialog && $posixAccount->is_account && empty($lock_msg)){
+
+    $display.= "<p class=\"plugbottom\">";
+
+    /* Are we in edit mode? */
+    if (isset($_SESSION['edit'])){
+      $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
+      $display.= "&nbsp;";
+      $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+      $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png').
+             "\"> ".$ui->dn."&nbsp;";
+    } else {
+      $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/openlock.png').
+             "\"> ".$ui->dn."&nbsp;";
+
+      /* Only display edit button if there is at least one attribute editable */
+      if(preg_match("/w/",$ui->get_permissions($ui->dn,"users/posixAccount"))){
+        $info.= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/lamp.png')."\"> ".
+          _("Click the 'Edit' button below to change informations in this dialog");
+
+        $display.= "<input type=submit name=\"edit\" value=\""._("Edit")."\">\n";
+      }
+      $display.= "<input type=\"hidden\" name=\"ignore\">\n";
+    }
+    $display.= "</p>\n";
+  }
+
+  /* Page header*/
+  $display= print_header(get_template_path('images/posix.png'),
+                         _("Unix settings"), $info).$display;
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/personal/posix/paste_generic.tpl b/gosa-core/plugins/personal/posix/paste_generic.tpl
new file mode 100644 (file)
index 0000000..b08feb5
--- /dev/null
@@ -0,0 +1,70 @@
+<table width='100%'>
+       <tr>
+               <td style='vertical-align:top;'>
+                       <h2>{t}Posix settings{/t}</h2>
+                       <table>
+                               <tr>
+                                       <td>
+                                               <label for="homeDirectory">{t}Home directory{/t}</label>
+                                       </td>
+                                       <td>
+                                               <input id="homeDirectory" name="homeDirectory" size=40 maxlength=120 value="{$homeDirectory}">
+                                       </td>
+                               </tr>
+                       </table>
+                       <table style='width:100%;'>
+                               <tr>
+                                       <td>
+                                               <input id="force_ids" type=checkbox name="force_ids" value="1"  {$force_ids}
+                                                                onclick="changeState('uidNumber');changeState('gidNumber');">
+                                       </td>
+                                       <td>
+                                               <label for="force_ids">
+                                               {t}Force UID/GID{/t}
+                                               </label>
+                                       </td>
+                                       <td>&nbsp;</td>
+                                       <td>
+                                               <label for="uidNumber">{t}UID{/t}</label>
+                                       </td>
+                                       <td>
+                                               <input id="uidNumber" name="uidNumber" size=9 maxlength=9 {$forceMode} value="{$uidNumber}">
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td colspan="3">&nbsp;</td>
+                                       <td>
+                                               <label for="gidNumber">{t}GID{/t}</label>
+                                       </td>
+                                       <td>
+                                               <input id="gidNumber" name="gidNumber" size=9 maxlength=9 {$forceMode} value="{$gidNumber}">
+                                       </td>
+                               </tr>
+                       </table>
+                       <table width="50%">
+                               <tr>
+                                       <td style="vertical-align:top;" colspan="4">
+                                               <h2><img alt="" class="center" align="middle" src="images/members.png" /> {t}Group membership{/t}</h2>
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td style="vertical-align:top;" colspan="4">
+                                               
+                                               {if $groups eq "too_many_for_nfs"}
+                                                       <b style="color:red">{t}(Warning: more than 16 groups are not supported by NFS!){/t}</b>
+                                                       <br>
+                                               {/if}
+                                               <select style="width:100%; height:130px;" name="group_list[]" size=16 multiple>
+                                                       {html_options options=$groupMembership}
+                                               </select>
+                                               <br>
+                                               <input type=submit value="{t}Add{/t}" name="edit_groupmembership">&nbsp;
+                                               <input type=submit value="{t}Delete{/t}" name="delete_groupmembership">
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+       </tr>
+</table>
+<br>
+<br>
diff --git a/gosa-core/plugins/personal/posix/posix_groups.tpl b/gosa-core/plugins/personal/posix/posix_groups.tpl
new file mode 100644 (file)
index 0000000..841d8a8
--- /dev/null
@@ -0,0 +1,83 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
+       <tr>
+               <td style="vertical-align:top;">
+                       <div class="contentboxh" style="height:20px;">
+                       <p class="contentboxh" style="font-size:12px">
+                               <b>{t}Select groups to add{/t} {$hint}</b>
+                               </p>
+                       </div>
+                       <div class="contentboxb" style="">
+                       <p class="contentboxb" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+                                       <select style="width:100%; height:430px; margin-top:4px;" name="groups[]" size="15" multiple>
+                                               {html_options options=$groups}
+                                       </select>
+                               <input type=hidden name="edit_helper">
+                       </p>
+                       </div>
+               </td>
+               <td style="vertical-align:top; width:400px;">
+                       <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" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+                       <table summary="" style="width:100%;">
+                               {$alphabet}
+                       </table>
+
+                               <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+                                       <tr>
+                                               <td width="50%">
+                                                       <img alt="" src="{$tree_image}" align=middle>&nbsp;{t}Display groups of department{/t}
+                                               </td>
+                                               <td>
+                                                       <select name="depselect" size=1 onChange="mainform.submit()" title="{t}Choose the department the search will be based on{/t}">
+                                                         {html_options options=$deplist selected=$depselect}
+                                                       </select>
+                                               </td>
+                                       </tr>
+                               </table>
+                               <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+                                       <tr>
+                                               <td width="50%">
+                                                       <img alt="" src="{$search_image}" align=middle>&nbsp;{t}Display groups matching{/t}
+                                               </td>
+                                               <td>
+                                                       <input type='text' name='regex' maxlength='20' value='{$regex}' 
+                                                               title='{t}Regular expression for matching group names{/t}' onChange="mainform.submit()">
+                                               </td>
+                                       </tr>
+                               </table>
+                               <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+                                       <tr>
+                                               <td width="50%">
+                                                       <img alt="" src="{$search_image}" align=middle>&nbsp;{t}Display groups of user{/t}
+                                               </td>
+                                               <td>
+                                                       <input type='text' name='guser' maxlength='20' value='{$guser}' 
+                                                               title='{t}User name of which groups are shown{/t}' onChange="mainform.submit()">
+                                               </td>
+                                       </tr>
+                               </table>
+                               <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+                    <tr>
+                                               <td>
+                                                       <input type="checkbox" name="SubSearch" value="1" {$SubSearchCHK}
+                                                               onClick="mainform.submit();">
+                                                       {t}Search in subtrees{/t}
+                                               </td>
+                                       </tr>
+                </table>
+                          {$apply}
+                       </div>
+               </td>
+       </tr>
+</table>
+<input type="hidden" value="1" name="PosixGroupDialogPosted">
+<p class="plugbottom">
+  <input type=submit name="add_groups_finish" value="{t}Add{/t}">
+  &nbsp;
+  <input type=submit name="add_groups_cancel" value="{t}Cancel{/t}">
+</p>
+
diff --git a/gosa-core/plugins/personal/posix/posix_shadow.tpl b/gosa-core/plugins/personal/posix/posix_shadow.tpl
new file mode 100644 (file)
index 0000000..bd7862c
--- /dev/null
@@ -0,0 +1,79 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=0 border=0>
+ <tr>
+  <td style="width:50%; vertical-align:top;">
+
+<!-- must_change_password  -->
+{render acl=$mustchangepasswordACL}
+   <input type=checkbox name="mustchangepassword" value="1" {$mustchangepassword}>
+{/render}
+   {t}User must change password on first login{/t}
+   <br>
+
+<!-- shadowMin -->
+{render acl=$shadowMinACL}
+   <input type=checkbox name="use_shadowMin" value="1" {$use_shadowMin}>
+{/render}
+{render acl=$shadowMinACL}
+   {$shadowmins}
+{/render}
+   <br>
+
+<!-- use_shadowMax -->
+{render acl=$shadowMaxACL}
+   <input type=checkbox name="use_shadowMax" value="1" {$use_shadowMax}>
+{/render}
+{render acl=$shadowMaxACL}
+   {$shadowmaxs}
+{/render}
+   <br>
+
+<!-- use_shadowExpire -->
+{render acl=$shadowExpireACL}
+   <input type=checkbox name="use_shadowExpire" value="1" {$use_shadowExpire}>
+{/render}
+   {t}Password expires on{/t}
+{render acl=$shadowExpireACL}
+   <select name=day onChange="createResult(this.form,this.form.shadowExpire);">
+    {html_options values=$days output=$days selected=$day}
+   </select>
+{/render}
+{render acl=$shadowExpireACL}
+   <select name=month onChange="populate(this.form,this.form.shadowExpire);">
+    {html_options options=$months selected=$month}
+   </select>
+{/render}
+{render acl=$shadowExpireACL}
+   <select name=year onChange="populate(this.form,this.form.shadowExpire);">
+    {html_options values=$years output=$years selected=$year}
+   </select>
+   <input type="hidden" name="shadowExpire" value="{$shadowExpire}">
+{/render}
+   <br>
+
+<!-- shadowInactive -->
+{render acl=$shadowInactiveACL}
+   <input type=checkbox name="use_shadowInactive" value="1" {$use_shadowInactive}>
+{/render}
+{render acl=$shadowInactiveACL}
+   {$shadowinactives}
+{/render}
+   <br>
+
+<!-- use_shadowWarning -->
+{render acl=$shadowWarningACL}
+   <input type=checkbox name="use_shadowWarning" value="1" {$use_shadowWarning}>
+{/render}
+{render acl=$shadowWarningACL}
+   {$shadowwarnings}
+{/render}
+  </td>
+ </tr>
+</table>
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!--
+  // Populate expiery dialog
+  populate(document.mainform,document.mainform.shadowExpire);
+  -->
+</script>
diff --git a/gosa-core/plugins/personal/posix/trust_machines.tpl b/gosa-core/plugins/personal/posix/trust_machines.tpl
new file mode 100644 (file)
index 0000000..3550fcf
--- /dev/null
@@ -0,0 +1,42 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
+<tr>
+  <td style="vertical-align:top;">
+   <div class="contentboxh" style="height:20px;">
+    <p class="contentboxh" style="font-size:12px">
+     <b>{t}Select systems to add{/t} {$hint}</b><br>
+    </p>
+   </div>
+   <div class="contentboxb">
+    <p class="contentboxb" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+     <select style="width:600px; margin-top:4px; height:450px;" name="wslist[]" size="15" multiple>
+       {html_options values=$wslist output=$wslist}
+     </select>
+    </p>
+   </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" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+     <table summary="" style="width:100%;">
+      {$alphabet}
+     </table>
+    <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8"><tr><td width="50%"><img alt="" src="{$tree_image}" align=middle>&nbsp;{t}Display systems of department{/t}</td>
+    <td><select name="depselect" size=1 onChange="mainform.submit()" title="{t}Choose the department the search will be based on{/t}">
+      {html_options options=$deplist selected=$depselect}
+    </select></td></tr></table>
+    <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8"><tr><td width="50%"><img alt="" src="{$search_image}" align=middle>&nbsp;{t}Display systems matching{/t}</td>
+    <td><input type='text' name='regex' maxlength='20' value='{$regex}' title='{t}Regular expression for matching addresses{/t}' onChange="mainform.submit()"></td></tr></table>
+   {$apply}
+   </div>
+  </td>
+</tr>
+</table>
+
+<p class="plugbottom">
+  <input type=submit name="add_ws_finish" value="{t}Add{/t}">
+  &nbsp;
+  <input type=submit name="add_ws_cancel" value="{t}Cancel{/t}">
+</p>
diff --git a/gosa-core/plugins/personal/samba/class_sambaAccount.inc b/gosa-core/plugins/personal/samba/class_sambaAccount.inc
new file mode 100644 (file)
index 0000000..bd71c8f
--- /dev/null
@@ -0,0 +1,1142 @@
+<?php
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2004-2005 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 sambaAccount extends plugin
+{
+  /* Definitions */
+  var $plHeadline= "Samba";
+  var $plDescription= "This does something";
+  var $view_logged = FALSE;
+
+  /* CLI vars */
+  var $cli_summary= "Manage users samba account";
+  var $cli_description= "Some longer text\nfor help";
+  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* Switch for Samba version */
+  var $samba3= FALSE;
+  var $uidNumber= 65535;
+  var $gidNumber= 65535;
+
+  /* Samba 2 attributes */
+  var $pwdLastSet= "0";
+  var $logonTime= "0";
+  var $logoffTime= "2147483647";
+  var $kickoffTime= "2147483647";
+  var $pwdCanChange= "0";
+  var $pwdMustChange= "0";
+  var $password_expires= 0;
+  var $acctFlags= "[UX        ]";
+  var $smbHome= "";
+  var $homeDrive= "";
+  var $scriptPath= "";
+  var $profilePath= "";
+  var $rid= "";
+  var $primaryGroupID= "";
+
+  /* Samba 3 attributes */
+  var $SID= "";
+  var $ridBase= 0;
+  var $sambaSID= "";
+  var $sambaPwdLastSet= "0";
+  var $sambaLogonTime= "0";
+  var $sambaLogoffTime= "2147483647";
+  var $sambaKickoffTime= "2147483647";
+  var $sambaPwdCanChange= "";
+  var $sambaPwdMustChange= "0";
+  var $sambaAcctFlags= "[UX        ]";
+  var $sambaHomePath= "";
+  var $sambaHomeDrive= "";
+  var $sambaLogonScript= "";
+  var $sambaProfilePath= "";
+  var $sambaPrimaryGroupSID= "";
+  var $sambaDomainName= "";
+  var $sambaUserWorkstations= "";
+  var $sambaBadPasswordCount= "";
+  var $sambaBadPasswordTime= "";
+  var $sambaPasswordHistory= "";
+  var $sambaLogonHours= "";
+  var $orig_sambaDomainName= "";
+  var $sambaMungedDial= "";
+  var $mungedObject;
+
+  /* Helper */
+  var $show_ws_dialog= FALSE;
+  var $logon_time_set= 0;
+  var $logoff_time_set= 0;
+  var $kickoff_time_set= 0;
+
+  /* attribute list for save action */
+  var $ctxattributes= array();
+  var $attributes= array();
+  var $objectclasses= array();
+  
+  var $uid= "";
+  var $CopyPasteVars = array("kickoff_time_set","logoff_time_set","logon_time_set","mungedObject","orig_sambaDomainName");
+
+  function sambaAccount (&$config, $dn= NULL)
+  {
+    /* Load attributes depending on the samba version */
+    $this->samba3= ($config->current['SAMBAVERSION'] == 3);
+
+    if ($this->samba3){
+      $this->attributes= array ("sambaSID", "sambaPwdLastSet", "sambaLogonTime",
+          "sambaLogoffTime", "sambaKickoffTime", "sambaPwdCanChange",
+          "sambaPwdMustChange", "sambaAcctFlags", "uid", "sambaMungedDial",
+          "sambaHomePath", "sambaHomeDrive", "sambaLogonScript",
+          "sambaProfilePath", "sambaPrimaryGroupSID", "sambaDomainName",
+          "sambaUserWorkstations", "sambaPasswordHistory",
+          "sambaLogonHours", "sambaBadPasswordTime",
+          "sambaBadPasswordCount");
+      $this->objectclasses= array ("sambaSamAccount");
+      $this->mungedObject= new sambaMungedDial;
+      $this->ctxattributes= $this->mungedObject->ctxattributes;
+    } else {
+      $this->attributes= array ("pwdLastSet", "logonTime", "logoffTime", "kickoffTime",
+          "pwdCanChange", "pwdMustChange", "acctFlags", "profilePath", "uid",
+          "smbHome", "homeDrive", "scriptPath", "rid", "primaryGroupID");
+      $this->objectclasses= array ("sambaAccount");
+    }
+
+    plugin::plugin ($config, $dn);
+
+    /* Setting uid to default */
+    if(isset($this->attrs['uid'][0])){
+      $this->uid = $this->attrs['uid'][0];
+    }
+
+    /* Get samba Domain in case of samba 3 */
+    if ($this->samba3 && $this->sambaSID != ""){
+      $this->SID= preg_replace ("/-[^-]+$/", "", $this->sambaSID);
+      $ldap= $this->config->get_ldap_link();
+      $ldap->cd($this->config->current['BASE']);
+      $ldap->search ("(&(objectClass=sambaDomain)(sambaSID=$this->SID))",array("sambaAlgorithmicRidBase","sambaDomainName"));
+      if ($ldap->count() != 0){
+        $attrs= $ldap->fetch();
+        $this->ridBase= $attrs['sambaAlgorithmicRidBase'][0];
+        if ($this->sambaDomainName == ""){
+          $this->sambaDomainName= $attrs['sambaDomainName'][0];
+        }
+      } else {
+        if ($this->sambaDomainName == ""){
+          $this->sambaDomainName= "DEFAULT";
+        }
+        $this->ridBase= $this->config->current['RIDBASE'];
+        $this->SID= $this->config->current['SID'];
+      }
+
+      /* Save in order to compare later on */
+      $this->orig_sambaDomainName= $this->sambaDomainName;
+    }
+
+    /* Fill mungedDial field */
+    if ($this->samba3 && isset($this->attrs['sambaMungedDial'])){
+      $this->mungedObject->load($this->sambaMungedDial);
+    }
+
+    /* Password expiery */
+    if(isset($this->attrs['sambaPwdMustChange']) &&
+        $this->attrs['sambaPwdMustChange'][0] != 0){
+      $this->password_expires= 1;
+    }
+
+    if(isset($this->attrs['sambaLogonTime']) && ! (
+        $this->attrs['sambaLogonTime'][0] == 0 ||
+        $this->attrs['sambaLogonTime'][0] == 2147483647
+      )){
+      $this->logon_time_set= 1;
+    }
+    if(isset($this->attrs['sambaLogoffTime']) && ! (
+        $this->attrs['sambaLogoffTime'][0] == 0 ||
+        $this->attrs['sambaLogoffTime'][0] == 2147483647
+      )){
+      $this->logoff_time_set= 1;
+    }
+    
+    /* Account expiery */
+    if(isset($this->attrs['sambaKickoffTime']) && ! (
+        $this->attrs['sambaKickoffTime'][0] == 0 ||
+        $this->attrs['sambaKickoffTime'][0] == 2147483647
+      )){
+      $this->kickoff_time_set= 1;
+    }
+
+    /* Get global filter config */
+    if (!is_global("sambafilter")){
+      $ui= get_userinfo();
+      $base= get_base_from_people($ui->dn);
+      $sambafilter= array( "depselect" => $base, "regex" => "*");
+      register_global("sambafilter", $sambafilter);
+    }
+
+    /* Save initial account state */
+    $this->initially_was_account= $this->is_account;
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* Log view */
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","users/".get_class($this),$this->dn);
+    }
+
+    /* Do we need to flip is_account state? */
+    if (isset($_POST['modify_state'])){
+      $this->is_account= !$this->is_account;
+    }
+    /* Do we represent a valid account? */
+    if (!$this->is_account && $this->parent === NULL){
+      $display= "<img alt=\"\"src=\"images/stop.png\" align=\"middle\">&nbsp;<b>".
+        _("This account has no samba extensions.")."</b>";
+      $display.= back_to_main();
+      return ($display);
+    }
+
+    /* Show tab dialog headers */
+    $display= "";
+    if ($this->parent !== NULL){
+      if ($this->is_account){
+        $display= $this->show_disable_header(_("Remove samba account"),
+            _("This account has samba features enabled. You can disable them by clicking below."));
+      } else {
+        $obj= $this->parent->by_object['posixAccount'];
+
+        /* Samba3 dependency on posix accounts are enabled
+           in the moment, because I need to rely on unique
+           uidNumbers. There'll be a better solution later
+           on. */
+        if ($obj->is_account){
+
+          $display= $this->show_enable_header(_("Create samba account"),
+              _("This account has samba features disabled. You can enable them by clicking below."));
+        } else {
+          $display= $this->show_enable_header(_("Create samba account"),
+              _("This account has samba features disabled. Posix features are needed for samba accounts, enable them first."), TRUE);
+        }
+        return ($display);
+      }
+    }
+
+    $SkipWrite = (!isset($this->parent) || !$this->parent) && !isset($_SESSION['edit']);
+
+    /* Open Samaba Logong hours dialog */
+    if(isset($_POST['SetSambaLogonHours']) && $this->samba3 && $this->acl_is_writeable("sambaLogonHours")){
+      $this->dialog = new sambaLogonHours($this->config,$this->dn,$this->sambaLogonHours);
+    }
+
+    /* Cancel dialog */
+    if(isset($_POST['cancel_logonHours'])){
+      $this->dialog = FALSE;
+    }
+
+    /* Save selected logon hours */
+    if(isset($_POST['save_logonHours'])){
+      $this->dialog->save_object();
+      if($this->acl_is_writeable("sambaLogonHours")){
+        $this->sambaLogonHours = $this->dialog->save();
+      }
+      $this->dialog = FALSE;
+    }
+
+    /* Display dialog */
+    if((isset($this->dialog)) && (is_object($this->dialog))){
+      $this->dialog->save_object();
+      return($this->dialog->execute());
+    }
+
+
+    /* Prepare templating */
+    $smarty= get_smarty();
+
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $var => $rest){
+      $smarty->assign($var."ACL",$this->getacl($var,$SkipWrite));
+    }
+
+    if ($this->sambaPwdMustChange=="0"){
+      $date= getdate();
+    } else {
+      $date= getdate($this->sambaPwdMustChange);
+    }
+
+    if ($this->sambaLogonTime=="2147483647" || $this->sambaLogonTime=="0"){
+      $sambaLogonTime_date= getdate();
+    } else {
+      $sambaLogonTime_date= getdate($this->sambaLogonTime);
+    }
+    
+    if ($this->sambaLogoffTime=="2147483647" || $this->sambaLogoffTime=="0"){
+      $sambaLogoffTime_date= getdate();
+    } else {
+      $sambaLogoffTime_date= getdate($this->sambaLogoffTime);
+    }
+    
+    if ($this->sambaKickoffTime=="2147483647" || $this->sambaKickoffTime=="0"){
+      $sambaKickoffTime_date= getdate();
+    } else {
+      $sambaKickoffTime_date= getdate($this->sambaKickoffTime);
+    }
+
+    /* Remove user workstations? */
+    if (isset($_POST["delete_ws"]) && isset($_POST['workstation_list'])){
+
+      if($this->acl_is_writeable("sambaUserWorkstations",$SkipWrite)){
+
+        $tmp= $this->sambaUserWorkstations;
+        foreach($_POST['workstation_list'] as $name){
+          $tmp= preg_replace("/$name/", '', $tmp);
+          $this->is_modified= TRUE;
+        }
+        $tmp= preg_replace('/,+/', ',', $tmp);
+        $this->sambaUserWorkstations= trim($tmp, ',');
+      }
+    }
+
+    /* Add user workstation? */
+    if (isset($_POST["add_ws"])){
+      if($this->acl_is_writeable("sambaUserWorkstations",$SkipWrite)){
+        $this->show_ws_dialog= TRUE;
+        $this->dialog= TRUE;
+      }
+    }
+
+    /* Add user workstation finished? */
+    if (isset($_POST["add_ws_finish"]) || isset($_POST["add_ws_cancel"])){
+      $this->show_ws_dialog= FALSE;
+      $this->dialog= FALSE;
+    }
+
+    /* Add user workstation? */
+    if (isset($_POST["add_ws_finish"]) && isset($_POST['wslist'])){
+      $tmp= $this->sambaUserWorkstations;
+      foreach($_POST['wslist'] as $ws){
+        $tmp.= ",$ws";
+      }
+      $tmp= preg_replace('/,+/', ',', $tmp);
+      $this->sambaUserWorkstations= trim($tmp, ',');
+      $this->is_modified= TRUE;
+    }
+
+    /* Show ws dialog */
+    if ($this->show_ws_dialog){
+
+      /* Save data */
+      $sambafilter= get_global("sambafilter");
+      foreach( array("depselect", "regex") as $type){
+        if (isset($_POST[$type])){
+          $sambafilter[$type]= $_POST[$type];
+        }
+      }
+      if (isset($_GET['search'])){
+        $s= mb_substr($_GET['search'], 0, 1, "UTF8")."*";
+        if ($s == "**"){
+          $s= "*";
+        }
+        $sambafilter['regex']= $s;
+      }
+      register_global("sambafilter", $sambafilter);
+
+      /* Get workstation list */
+      $exclude= "";
+      foreach(split(',', $this->sambaUserWorkstations) as $ws){
+        $exclude.= "(cn=$ws$)";
+      }
+      if ($exclude != ""){
+        $exclude= "(!(|$exclude))";
+      }
+      $regex= $sambafilter['regex'];
+      $filter= "(&(objectClass=sambaSAMAccount)$exclude(uid=*$)(|(uid=$regex)(cn=$regex)))";
+      $res= get_list($filter, "winworkstation", $sambafilter['depselect'], array("uid"), GL_SUBSEARCH | GL_SIZELIMIT);
+        
+      $wslist= array();
+      foreach ($res as $attrs){
+        $wslist[]= preg_replace('/\$/', '', $attrs['uid'][0]);
+      }
+      asort($wslist);
+
+      $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("deplist", $this->config->idepartments);
+      $smarty->assign("alphabet", generate_alphabet());
+      foreach( array("depselect", "regex") as $type){
+        $smarty->assign("$type", $sambafilter[$type]);
+      }
+      $smarty->assign("hint", print_sizelimit_warning());
+      $smarty->assign("wslist", $wslist);
+      $smarty->assign("apply", apply_filter());
+      $display= $smarty->fetch (get_template_path('samba3_workstations.tpl', TRUE,
+                                dirname(__FILE__)));
+      return ($display);
+    }
+
+    /* Fill calendar */
+    $days= array();
+    for($d= 1; $d<32; $d++){
+      $days[]= $d;
+    }
+    $years= array();
+    for($y= $date['year']-4; $y<$date['year']+4; $y++){
+      $years[]= $y;
+    }
+    $months= array(_("January"), _("February"), _("March"), _("April"),
+        _("May"), _("June"), _("July"), _("August"), _("September"),
+        _("October"), _("November"), _("December"));
+    $smarty->assign("day", $date["mday"]);
+    $smarty->assign("days", $days);
+    $smarty->assign("months", $months);
+    $smarty->assign("month", $date["mon"]-1);
+    $smarty->assign("years", $years);
+    $smarty->assign("year", $date["year"]);
+    
+    $sambaLogonTime_days= array();
+    for($d= 1; $d<32; $d++){
+      $sambaLogonTime_days[]= $d;
+    }
+    $sambaLogonTime_years= array();
+    for($y= $date['year']-4; $y<$date['year']+4; $y++){
+      $sambaLogonTime_years[]= $y;
+    }
+    $sambaLogonTime_months= array(_("January"), _("February"), _("March"), _("April"),
+        _("May"), _("June"), _("July"), _("August"), _("September"),
+        _("October"), _("November"), _("December"));
+    $smarty->assign("sambaLogonTime_day", $sambaLogonTime_date["mday"]);
+    $smarty->assign("sambaLogonTime_days", $sambaLogonTime_days);
+    $smarty->assign("sambaLogonTime_months", $sambaLogonTime_months);
+    $smarty->assign("sambaLogonTime_month", $sambaLogonTime_date["mon"]-1);
+    $smarty->assign("sambaLogonTime_years", $sambaLogonTime_years);
+    $smarty->assign("sambaLogonTime_year", $sambaLogonTime_date["year"]);
+    
+    $sambaLogoffTime_days= array();
+    for($d= 1; $d<32; $d++){
+      $sambaLogoffTime_days[]= $d;
+    }
+    $sambaLogoffTime_years= array();
+    for($y= $date['year']-4; $y<$date['year']+4; $y++){
+      $sambaLogoffTime_years[]= $y;
+    }
+    $sambaLogoffTime_months= array(_("January"), _("February"), _("March"), _("April"),
+        _("May"), _("June"), _("July"), _("August"), _("September"),
+        _("October"), _("November"), _("December"));
+    $smarty->assign("sambaLogoffTime_day", $sambaLogoffTime_date["mday"]);
+    $smarty->assign("sambaLogoffTime_days", $sambaLogoffTime_days);
+    $smarty->assign("sambaLogoffTime_months", $sambaLogoffTime_months);
+    $smarty->assign("sambaLogoffTime_month", $sambaLogoffTime_date["mon"]-1);
+    $smarty->assign("sambaLogoffTime_years", $sambaLogoffTime_years);
+    $smarty->assign("sambaLogoffTime_year", $sambaLogoffTime_date["year"]);
+    
+    $sambaKickoffTime_days= array();
+    for($d= 1; $d<32; $d++){
+      $sambaKickoffTime_days[]= $d;
+    }
+    $sambaKickoffTime_years= array();
+    for($y= $date['year']-4; $y<$date['year']+4; $y++){
+      $sambaKickoffTime_years[]= $y;
+    }
+    $sambaKickoffTime_months= array(_("January"), _("February"), _("March"), _("April"),
+        _("May"), _("June"), _("July"), _("August"), _("September"),
+        _("October"), _("November"), _("December"));
+    //$smarty->assign("sambaKickoffTime_day", $sambaKickoffTime_date["mday"]-1);
+    $smarty->assign("sambaKickoffTime_day", $sambaKickoffTime_date["mday"]); // hickert
+    $smarty->assign("sambaKickoffTime_days", $sambaKickoffTime_days);
+    $smarty->assign("sambaKickoffTime_months", $sambaKickoffTime_months);
+    $smarty->assign("sambaKickoffTime_month", $sambaKickoffTime_date["mon"]-1);
+    $smarty->assign("sambaKickoffTime_years", $sambaKickoffTime_years);
+    $smarty->assign("sambaKickoffTime_year", $sambaKickoffTime_date["year"]);
+     
+    /* Fill boxes */
+    if ($this->samba3){
+      $domains= array();
+      foreach($this->config->data['SERVERS']['SAMBA'] as $name => $content){
+        $domains[]= $name;
+      }
+      $smarty->assign("domains", $domains);
+    }
+    $letters= array();
+    for ($i= 68; $i<91; $i++){
+      $letters[]= chr($i).":";
+    }
+    $smarty->assign("drives", $letters);
+
+    /* Fill terminal server settings */
+    if ($this->samba3){
+      foreach ($this->ctxattributes as $attr){
+        /* Fill common attributes */
+        if (isset($this->mungedObject->ctx[$attr])){
+          $smarty->assign("$attr", $this->mungedObject->ctx[$attr]);
+          // Set field  to blank if value is 0
+          if(in_array($attr, array("CtxMaxConnectionTime", "CtxMaxDisconnectionTime", "CtxMaxIdleTime"))) {
+            if($this->mungedObject->ctx[$attr] == 0) {
+              $smarty->assign("$attr", "");
+            }
+          }
+        } else {
+          $smarty->assign("$attr", "");
+        }
+      }
+
+      /* Assign enum values for preset items */
+      $shadowModeVals= array( "0" => _("disabled"),
+          "1" => _("input on, notify on"),
+          "2" => _("input on, notify off"),
+          "3" => _("input off, notify on"),
+          "4" => _("input off, nofify off"));
+
+      $brokenConnModeVals= array(      "0" => _("disconnect"),
+          "1" => _("reset"));
+
+      $reConnModeVals= array( "0" => _("from any client"),
+          "1" => _("from previous client only"));
+
+      /* Fill preset items */
+      $smarty->assign("shadow", $shadowModeVals);
+      $smarty->assign("brokenconn", $brokenConnModeVals);
+      $smarty->assign("reconn", $reConnModeVals);
+
+      /* Fill preset items with values */
+      $smarty->assign("shadowmode", $this->mungedObject->getShadow());
+      $smarty->assign("brokenconnmode", $this->mungedObject->getBrokenConn());
+      $smarty->assign("reconnmode", $this->mungedObject->getReConn());
+
+      if($_SESSION['js']){
+        /* Set form elements to disabled/enable state */
+        $smarty->assign("tsloginstate", $this->mungedObject->getTsLogin()?"":"disabled");
+
+        $smarty->assign("inheritstate", "");
+        if($this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite)){
+          $smarty->assign("inheritstate", $this->mungedObject->getInheritMode()?"disabled":"");
+        }
+  
+
+  
+      }else{
+        $smarty->assign("tsloginstate", "");
+        $smarty->assign("inheritstate", "");
+      }      
+
+      /* Set checkboxes to checked or unchecked state */
+      $smarty->assign("tslogin", $this->mungedObject->getTsLogin()?"checked":"");
+      $smarty->assign("inherit", $this->mungedObject->getInheritMode()?"checked":"");
+      $smarty->assign("connectclientdrives",
+                      $this->mungedObject->getConnectClientDrives()?"checked":"");
+      $smarty->assign("connectclientprinters",
+                      $this->mungedObject->getConnectClientPrinters()?"checked":"");
+      $smarty->assign("defaultprinter",
+                      $this->mungedObject->getDefaultPrinter()?"checked":"");
+      $smarty->assign("CtxMaxConnectionTimeF",
+                      $this->mungedObject->getCtxMaxConnectionTimeF()?"checked":"");
+      $smarty->assign("CtxMaxDisconnectionTimeF",
+                      $this->mungedObject->getCtxMaxDisconnectionTimeF()?"checked":"");
+      $smarty->assign("CtxMaxIdleTimeF",
+                      $this->mungedObject->getCtxMaxIdleTimeF()?"checked":"");
+
+      /* Fill sambaUserWorkstations */
+      $ws= split(",", $this->sambaUserWorkstations);
+      sort($ws);
+      
+      /* Tidy checks for empty option, and smarty will produce one if array[0]="" */
+      if(($ws[0]=="")&&(count($ws)==1)) $ws=array();
+
+
+      $smarty->assign("workstations", $ws);
+    }
+
+    /* Variables */
+    foreach($this->attributes as $val){
+      $smarty->assign("$val", $this->$val);
+    }
+
+    /* 'sambaAcctFlags' checkboxes */
+    /* Check for 'lock-account'-flag: 'D' or 'L' */
+    if (is_integer(strpos($this->sambaAcctFlags, "D")) ||
+        is_integer(strpos($this->sambaAcctFlags, "L"))) {
+        $smarty->assign("flagsD", "checked");
+    } else {
+        $smarty->assign("flagsD", "");
+    }
+    
+    /* Check for no_password_required flag 'N' */
+    if (is_integer(strpos($this->sambaAcctFlags, "N"))) {
+        $smarty->assign("flagsN", "checked");
+    } else {
+        $smarty->assign("flagsN", "");
+    }
+
+    if($this->samba3){
+      if ($this->sambaPwdCanChange=="1"){
+        $smarty->assign("flagsP", "checked");
+      } else {
+        $smarty->assign("flagsP", "");
+      }
+    }else{
+      if ($this->pwdCanChange=="1"){
+        $smarty->assign("flagsP", "checked");
+      } else {
+        $smarty->assign("flagsP", "");
+      }
+    }
+
+    if ($this->password_expires=="1"){
+      $smarty->assign("flagsC", "checked");
+    } else {
+      $smarty->assign("flagsC", "");
+    }
+    if ($this->logon_time_set=="1"){
+      $smarty->assign("flagsT", "checked");
+    } else {
+      $smarty->assign("flagsT", "");
+    }
+    if ($this->logoff_time_set=="1"){
+      $smarty->assign("flagsO", "checked");
+    } else {
+      $smarty->assign("flagsO", "");
+    }
+    if ($this->kickoff_time_set=="1"){
+      $smarty->assign("flagsK", "checked");
+    } else {
+      $smarty->assign("flagsK", "");
+    }
+   
+
+    /* In case of javascript, disable some fields on demand */
+    if ($this->samba3){
+      foreach($this->mungedObject->getOnDemandFlags() as $key => $value) {
+        $smarty->assign("$key", "$value");
+      }
+    }
+
+    /* Show main page */
+    if ($this->samba3){
+      $display.= $smarty->fetch (get_template_path('samba3.tpl', TRUE, dirname(__FILE__)));
+    } else {
+      $display.= $smarty->fetch (get_template_path('samba2.tpl', TRUE, dirname(__FILE__)));
+    }
+
+    return ($display);
+  }
+
+  function remove_from_parent()
+  {
+    /* Cancel if there's nothing to do here */
+   if (!$this->initially_was_account){
+     return;
+   }
+    
+    /* include global link_info */
+    $ldap= $this->config->get_ldap_link();
+
+    plugin::remove_from_parent();
+
+    /* Keep uid attribute for gosaAccount */
+    unset($this->attrs['uid']);
+    unset($this->attrs['uidNumber']);
+    unset($this->attrs['gidNumber']);
+
+    /* Remove objectClass for sambaIdmapEntry */
+    $tmp= array();
+    for ($i= 0; $i<count($this->attrs["objectClass"]); $i++){
+      if ($this->attrs['objectClass'][$i] != 'sambaIdmapEntry'){
+        $tmp[]= $this->attrs['objectClass'][$i];
+      }
+    }
+    $this->attrs['objectClass']= $tmp;
+
+    @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
+        $this->attributes, "Save");
+    $ldap->cd($this->dn);
+    $this->cleanup();
+    $ldap->modify ($this->attrs); 
+
+    new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+
+    show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/samba account with dn '%s' failed."),$this->dn));
+
+    /* Optionally execute a command after we're done */
+    $this->handle_post_events("remove", array("uid" => $this->uid));
+  }
+
+
+  /* Check for input problems */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    if ($this->samba3){
+
+      /* Strings */
+      foreach (array( "sambaHomePath" => _("Home directory"),
+            "sambaProfilePath" => _("Profile path")) as $key => $val){
+        if (!$this->mungedObject->is_samba_path($this->$key)){
+          $message[]= sprintf(_("The value specified as '%s' contains invalid characters!"), $val);
+        }
+      }
+
+      /* Numeric values */
+      foreach (array(  "CtxMaxConnectionTime" => _("Connection"),
+            "CtxMaxDisconnectionTime" => _("Disconnection"),
+            "CtxMaxIdleTime" => _("IDLE")) as $key => $val){
+
+        if (isset($this->mungedObject->ctx[$key]) && !is_id($this->mungedObject->ctx[$key]) && $val != 0){
+          $message[]= sprintf(_("The timeout property '%s' is checked and contains invalid or no characters!"), $val);
+        }
+      }
+
+      /* Too many workstations? Windows usrmgr only supports eight */
+      if (substr_count($this->sambaUserWorkstations, ",") >= 8){
+        $message[]= _("The windows user manager only allows eight clients. You've specified more than eight.");
+      }
+    }
+
+    return ($message);
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+
+    $SkipWrite = (!isset($this->parent) || !$this->parent) && !isset($_SESSION['edit']);
+
+    /* We only care if we are on the sambaTab... */
+    if (isset($_POST['sambaTab'])){
+      plugin::save_object();
+
+      /* Take care about access options */
+      if ($this->acl_is_writeable("sambaAcctFlagsL",$SkipWrite) || ($this->acl_is_writeable("sambaAcctFlagsN",$SkipWrite))){
+        if ($this->samba3){
+          $attrname= "sambaPwdCanChange";
+        } else {
+          $attrname= "pwdCanChange";
+        }
+        if (isset($_POST["allow_pwchange"]) && $_POST["allow_pwchange"] == 1){
+          $tmp= 1;
+        } else {
+          $tmp= 0;
+        }
+        if ($this->$attrname != $tmp){
+          $this->is_modified= TRUE;
+        }
+        $this->pwdCanChange= $tmp;
+        $this->sambaPwdCanChange= $tmp;
+      }
+      $tmp= "UX";
+      if (isset($_POST["no_password_required"])){
+        if ($_POST["no_password_required"] == 1){
+          $tmp.= "N";
+        }
+      }
+      if (isset($_POST["password_expires"])){
+        if ($_POST["password_expires"] == 1){
+          $this->password_expires= 1;
+        }
+      } else {
+        $this->password_expires= 0;
+      }
+      if (isset($_POST["temporary_disable"])){
+        if ($_POST["temporary_disable"] == 1){
+          if (is_integer(strpos($this->sambaAcctFlags, "L"))) {
+            $tmp.= "L";
+          } else {
+            $tmp.= "D";
+          }
+        }
+      }
+      if (isset($_POST["logon_time_set"])){
+        if ($_POST["logon_time_set"] == 1){
+          $this->logon_time_set= 1;
+        }
+      } else {
+        $this->logon_time_set= 0;
+      }
+      if (isset($_POST["logoff_time_set"])){
+        if ($_POST["logoff_time_set"] == 1){
+          $this->logoff_time_set= 1;
+        }
+      } else {
+        $this->logoff_time_set= 0;
+      }
+      if (isset($_POST["kickoff_time_set"])){
+        if ($_POST["kickoff_time_set"] == 1){
+          $this->kickoff_time_set= 1;
+        }
+      } else {
+        $this->kickoff_time_set= 0;
+      }
+      
+      $fill= "";
+      for ($i= strlen($tmp); $i<12; $i++){
+        $fill.= " ";
+      }
+
+      $tmp= "[$tmp$fill]";
+
+      /* Only save if acl's are set */
+      if ($this->acl_is_writeable("sambaAcctFlagsL",$SkipWrite) || ($this->acl_is_writeable("sambaAcctFlagsN",$SkipWrite))){
+        if ($this->samba3){
+          $attrname= "sambaAcctFlags";
+        } else {
+          $attrname= "acctFlags";
+        }
+        if ($this->$attrname != $tmp){
+          $this->is_modified= TRUE;
+        }
+        $this->$attrname= $tmp;
+      }
+
+      /* Save sambaDomain attribute */
+      if ($this->acl_is_writeable("sambaDomainName",$SkipWrite) && $this->samba3 && isset ($_POST['sambaDomainName'],$SkipWrite)){
+        $this->sambaDomainName= validate($_POST['sambaDomainName']);
+      }
+
+      /* Save CTX values */
+      if ($this->samba3){
+
+        /* Save obvious values */
+        foreach($this->ctxattributes as $val){
+          if (isset($_POST[$val]) && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite)){
+            if (get_magic_quotes_gpc()) {
+              $this->mungedObject->ctx[$val]= stripcslashes(validate($_POST[$val]));
+            } else {
+              $this->mungedObject->ctx[$val]= validate($_POST[$val]);
+            }
+          }
+        }
+
+        /* Save checkbox states. */
+        $this->mungedObject->setTsLogin(!isset($_POST['tslogin'])
+                        && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite));
+        // Need to do some index checking to avoid messages like "index ... not found"
+        if(isset($_POST['brokenconn'])) {
+          $this->mungedObject->setBrokenConn($_POST['brokenconn'] == '1'
+                        && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite));
+        }
+        if(isset($_POST['reconn'])) {
+          $this->mungedObject->setReConn($_POST['reconn'] == '1'
+                        && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite));
+        }
+        $this->mungedObject->setInheritMode(isset($_POST['inherit'])
+                        && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite));
+        $this->mungedObject->setCtxMaxConnectionTimeF(!isset($_POST['CtxMaxConnectionTimeF'])
+                        && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite));
+        $this->mungedObject->setCtxMaxDisconnectionTimeF(
+                        !isset($_POST['CtxMaxDisconnectionTimeF']) 
+                        && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite));
+        $this->mungedObject->setCtxMaxIdleTimeF(!isset($_POST['CtxMaxIdleTimeF'])
+                        && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite));
+        $this->mungedObject->setConnectClientDrives(isset($_POST['connectclientdrives'])
+                        && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite));
+        $this->mungedObject->setConnectClientPrinters(isset($_POST['connectclientprinters'])  
+                        && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite));
+        $this->mungedObject->setDefaultPrinter(isset($_POST['defaultprinter'])
+                        && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite));
+
+        /* Save combo boxes. Takes two values */
+        if(isset($_POST['reconn'])) {
+          $this->mungedObject->setShadow(isset($_POST['shadow']) && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite),$_POST['shadow']);
+        }
+
+        /* Check for changes */
+        if ($this->sambaMungedDial != $this->mungedObject->getMunged()){
+          $this->is_modified= TRUE;
+        }
+      }
+    }
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    /* Load uid and gid of this 'dn' */
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cat($this->dn, array('uidNumber', 'gidNumber'));
+    $tmp= $ldap->fetch();
+    $this->uidNumber= $tmp['uidNumber'][0];
+    $this->gidNumber= $tmp['gidNumber'][0];
+
+    plugin::save();
+
+    /* Remove objectClass for sambaIdmapEntry */
+    $tmp= array();
+    for ($i= 0; $i<count($this->attrs["objectClass"]); $i++){
+      if ($this->attrs['objectClass'][$i] != 'sambaIdmapEntry'){
+        $tmp[]= $this->attrs['objectClass'][$i];
+      }
+    }
+    $this->attrs['objectClass']= $tmp;
+
+    /* Generate rid / primaryGroupId */
+    if ($this->samba3){
+      if (!isset($this->config->data['SERVERS']['SAMBA'][$this->sambaDomainName]['SID'])){
+        print_red (_("Warning: This account has an undefined samba SID assigned. The problem can not be fixed by GOsa!"));
+      } else {
+        $this->SID= $this->config->data['SERVERS']['SAMBA'][$this->sambaDomainName]['SID'];
+        $this->ridBase= $this->config->data['SERVERS']['SAMBA'][$this->sambaDomainName]['RIDBASE'];
+      }
+
+      /* Need to generate a new uniqe uid/gid combination? */
+      if ($this->sambaSID == "" || $this->orig_sambaDomainName != $this->sambaDomainName){
+        $uidNumber= $this->uidNumber;
+        while(TRUE){
+          $sid= $this->SID."-".($uidNumber*2 + $this->ridBase);
+          $ldap->cd($this->config->current['BASE']);
+          $ldap->search("(sambaSID=$sid)", array("sambaSID"));
+          if ($ldap->count() == 0){
+            break;
+          }
+          $uidNumber++;
+        }
+        $this->attrs['sambaSID']= $sid;
+
+        /* Check for users primary group */
+        $ldap->cd($this->config->current['BASE']);
+        $ldap->search("(&(objectClass=posixGroup)(gidNumber=".$this->gidNumber."))", array("cn"));
+        if ($ldap->count() != 1){
+          print_red(_("Warning: Can't identify users primary group - no conversion to a samba group possible!"));
+        } else {
+          $attrs= $ldap->fetch();
+          $g= new group($this->config, $ldap->getDN());
+          if ($g->sambaSID == ""){
+            $g->sambaDomainName= $this->sambaDomainName;
+            $g->smbgroup= TRUE;
+            $g->save ();
+          }
+          $this->attrs['sambaPrimaryGroupSID']= $g->sambaSID;
+        }
+      }
+
+      if ($this->sambaHomeDrive == ""){
+        $this->attrs["sambaHomeDrive"]= array();
+      }
+
+      /* Generate munged dial value */
+      $this->attrs["sambaMungedDial"]= $this->mungedObject->getMunged();
+
+      /* User wants me to fake the idMappings? This is useful for
+         making winbind resolve the user names in a reasonable amount
+         of time in combination with larger databases. */
+      if (isset($this->config->current['SAMBAIDMAPPING']) &&
+          preg_match('/true/i', $this->config->current['SAMBAIDMAPPING'])){
+        $this->attrs['objectClass'][]= "sambaIdmapEntry";
+      }
+
+
+      /* Password expiery */
+      if ($this->password_expires == "1"){
+        $this->attrs['sambaPwdMustChange']= $this->sambaPwdMustChange;
+      } else {
+        $this->attrs['sambaPwdMustChange']= array();
+      }
+      /* Make sure not to save zero in sambaPwdLastset */
+      if ($this->sambaPwdLastSet != "0"){
+        $this->attrs['sambaPwdLastSet']= $this->sambaPwdLastSet;
+      } else {
+        $this->attrs['sambaPwdLastSet']= array();
+      }
+      /* Account expiery */
+      if ($this->logon_time_set == "1"){
+        $this->attrs['sambaLogonTime']= $this->sambaLogonTime;
+      } else {
+        $this->attrs['sambaLogonTime']= array();
+      }
+      if ($this->logoff_time_set == "1"){
+        $this->attrs['sambaLogoffTime']= $this->sambaLogoffTime;
+      } else {
+        $this->attrs['sambaLogoffTime']= array();
+      }
+      if ($this->kickoff_time_set == "1"){
+        # Add one day in unixtime format to be compatible with usrmgr
+        //$this->attrs['sambaKickoffTime']= $this->sambaKickoffTime + 86400; 
+        $this->attrs['sambaKickoffTime']= $this->sambaKickoffTime; //hickert 
+      } else {
+        $this->attrs['sambaKickoffTime']= array();
+      }
+    } else {
+    /* Not samba3 */
+      $this->attrs['rid']= $this->uidNumber*2 + 1000;
+      $this->attrs['primaryGroupID']= $this->gidNumber*2 +1001;
+
+      if ($this->homeDrive == ""){
+        $this->attrs["homeDrive"]= array();
+      }
+
+      /* Password expiery */
+      if ($this->password_expires == "1"){
+        $this->attrs['pwdMustChange']= $this->pwdMustChange;
+      } else {
+        $this->attrs['pwdMustChange']= 2147483647;
+      }
+      /* Make sure not to save zero in pwdLastset */
+      if ($this->pwdLastSet != "0"){
+        $this->attrs['pwdLastSet']= $this->pwdLastSet;
+      } else {
+        $this->attrs['pwdLastSet']= array();
+      }
+      /* Account expiery */
+      if ($this->logon_time_set == "1"){
+        $this->attrs['logonTime']= $this->logonTime;
+      } else {
+        $this->attrs['logonTime']= array();
+      }
+      if ($this->logoff_time_set == "1"){
+        $this->attrs['logoffTime']= $this->logoffTime;
+      } else {
+        $this->attrs['logoffTime']= array();
+      }
+      if ($this->kickoff_time_set == "1"){
+        # Add one day in unixtime format to be compatible with usrmgr
+        $this->attrs['kickoffTime']= $this->kickoffTime + 86400;
+      } else {
+        $this->attrs['kickoffTime']= array();
+      }
+    }
+
+    /* Write back to ldap */
+    $ldap->cd($this->dn);
+    $this->cleanup();
+    $ldap->modify ($this->attrs); 
+
+    if($this->initially_was_account){
+      new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
+
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/samba account 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", array("uid" => $this->uid));
+      }
+    } else {
+      $this->handle_post_events("add", array("uid" => $this->uid));
+    }
+  }
+
+
+  /* Force password set, if this account doesn't have any samba passwords  */
+  function password_change_needed()
+  {
+    if(!$this->initially_was_account && $this->is_account){
+      $ldap = $this->config->get_ldap_link();
+      $ldap->cat($this->dn,array("sambaLMPassword","sambaNTPassword"));
+      $attrs = $ldap->fetch();
+      if(!isset($attrs['sambaLMPassword']) || !isset($attrs['sambaNTPassword'])){
+        return(TRUE);
+      }
+    }
+    return(FALSE);
+  }
+
+
+  function adapt_from_template($dn)
+  {
+    plugin::adapt_from_template($dn);
+    $this->sambaSID= "";
+    $this->sambaPrimaryGroupSID= "";
+
+      /* Fill mungedDial field */
+    if ($this->samba3 && isset($this->attrs['sambaMungedDial'])){
+      $this->mungedObject->load($this->sambaMungedDial);
+    }
+
+    /* Password expiery */
+    if(isset($this->attrs['sambaPwdMustChange']) &&
+        $this->attrs['sambaPwdMustChange'][0] != 0){
+      $this->password_expires= 1;
+    }
+
+    if(isset($this->attrs['sambaLogonTime']) && ! (
+        $this->attrs['sambaLogonTime'][0] == 0 ||
+        $this->attrs['sambaLogonTime'][0] == 2147483647
+      )){
+      $this->logon_time_set= 1;
+    }
+    if(isset($this->attrs['sambaLogoffTime']) && ! (
+        $this->attrs['sambaLogoffTime'][0] == 0 ||
+        $this->attrs['sambaLogoffTime'][0] == 2147483647
+      )){
+      $this->logoff_time_set= 1;
+    }
+
+    /* Account expiery */
+    if(isset($this->attrs['sambaKickoffTime']) && ! (
+        $this->attrs['sambaKickoffTime'][0] == 0 ||
+        $this->attrs['sambaKickoffTime'][0] == 2147483647
+      )){
+      $this->kickoff_time_set= 1;
+    }
+
+    /* Get global filter config */
+    if (!is_global("sambafilter")){
+      $ui= get_userinfo();
+      $base= get_base_from_people($ui->dn);
+      $sambafilter= array( "depselect" => $base, "regex" => "*");
+      register_global("sambafilter", $sambafilter);
+    }
+  }
+
+  
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"     => _("Samba"),
+          "plDescription"   => _("Samba settings"),
+          "plSelfModify"    => TRUE,
+          "plDepends"       => array("user"),
+          "plPriority"      => 5,
+          "plSection"     => array("personal" => _("My account")),
+          "plCategory"    => array("users"),
+          "plOptions"       => array(),
+
+          "plProvidedAcls"  => array(
+            "AllowLoginOnTerminalServer"  => _("Allow login on terminal server"),
+            "InheritClientConfig"         => _("Inherit client config"),
+
+            "sambaPwdCanChange"     => _("Allow user to change password") ,
+            "sambaAcctFlagsN"            => _("Login from windows client requires no password"),
+            "sambaAcctFlagsL"            => _("Lock samba account"),
+
+
+            "sambaKickoffTime"      => _("Account expires") ,
+            "sambaPwdMustChange"    => _("Password expires") ,
+
+            "sambaLogonTime"        => _("Limit Logon Time") ,
+            "sambaLogoffTime"       => _("Limit Logoff Time") ,
+            "sambaLogonHours"       => _("Logon hours") ,
+
+            "sambaHomePath"         => _("Generic home directory") ,
+            "sambaHomeDrive"        => _("Generic samba home drive") ,
+            "sambaLogonScript"      => _("Generic script path") ,
+            "sambaProfilePath"      => _("Generic profile path") ,
+            "sambaDomainName"       => _("Domain") ,
+            "sambaUserWorkstations" => _("Allow connection from")))
+              );
+  }    
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/personal/samba/class_sambaLogonHours.inc b/gosa-core/plugins/personal/samba/class_sambaLogonHours.inc
new file mode 100644 (file)
index 0000000..95de60d
--- /dev/null
@@ -0,0 +1,148 @@
+<?php
+
+class sambaLogonHours extends plugin
+{
+
+  var $sambaLogonHours = "";
+  var $Matrix          = array();
+  var $timezone        = 0; 
+  var $config;
+
+  function sambaLogonHours (&$config, $dn, $slh)
+  {
+    plugin::plugin($config,$dn);
+    $this->sambaLogonHours = $slh;
+
+    /* Get default timezone */
+    $zone = get_default_timezone();
+    $this->timezone = $zone['value'];
+
+    /* Convert to bin */
+    $tmp = '';
+    for($i = 0 ; $i < strlen($slh) ; $i ++){
+      $tmp .= str_pad(base_convert($slh[$i],16,2),4,'0',STR_PAD_LEFT);
+    }
+    $slh = $tmp;
+
+    /* Set to default if value is empty or seams to be broken */
+    if(strlen($slh) != 168){
+      $slh = str_pad('',168 , "1");
+    }
+
+    /* Rework string, because it was stored in little endian */
+    $new = '';
+    for($i = 0 ; $i < 21 ; $i ++ ){
+      $part         = strrev(substr($slh, $i * 8, 8));
+      $byte['hi']   = substr($part,0,4);
+      $byte['low']  = substr($part,4,4);
+      $new .= $byte['hi'].$byte['low'];
+    }
+
+    /* Shift string to match given timezone settings */
+    $shift_by = (168 + $this->timezone) % 168;
+    for($i = 0 ; $i < $shift_by; $i ++){
+      $new = $new[167].$new;
+      $new = substr($new,0,168);
+    }
+
+    /* Create matrix */ 
+    $this->Matrix = array();
+    for($day = 0 ; $day < 7 ; $day ++ ){
+      for($hour  = 0 ; $hour < 24 ; $hour ++){
+        $bitpos  = ($day * 24 + $hour) % 168;
+        $this->Matrix[$day][$hour] = $new[$bitpos]; 
+      }
+    }
+  }
+
+  function execute()
+  {
+
+    $week_days = array();
+    $week_days[0]= _("Sunday");
+    $week_days[1]= _("Monday");
+    $week_days[2]= _("Tuesday");
+    $week_days[3]= _("Wednesday");
+    $week_days[4]= _("Thursday");
+    $week_days[5]= _("Friday");
+    $week_days[6]= _("Saturday");
+
+    $hours = array();
+    for($i = 0 ; $i <24 ; $i++ ){
+      $hours[$i] = $i ;
+    }
+    $ui =get_userinfo();
+
+    $smarty = get_smarty();
+    $smarty->assign("sambaLogonHoursACL",$ui->get_permissions($this->acl_base,"user/generic","sambaLogonHours"));
+    $smarty->assign("Matrix",$this->Matrix);
+    $smarty->assign("Days"  ,$week_days);
+    $smarty->assign("Hours" ,$hours);
+    return($smarty->fetch(get_template_path("sambaLogonHours.tpl",TRUE,dirname(__FILE__))));
+  }
+
+  function save_object()
+  {
+    /* Get userinfo */
+    $ui = get_userinfo();
+  
+    /* Check if dialog was opened and if there were any changes */
+    if(isset($_POST['sambaLogonHoursPosted']) && preg_match("/w/i",$ui->get_permissions($this->acl_base,"user/generic","sambaLogonHours"))){
+      foreach($this->Matrix as $day_key => $days){
+        foreach($days as $hour_key => $hour){
+          if(isset($_POST['day_'.$day_key.'_'.$hour_key])){
+            $this->Matrix[$day_key][$hour_key] = 1;
+          }else{
+            $this->Matrix[$day_key][$hour_key] = 0;
+          }
+        }
+      }
+    }
+  }
+  
+  function save()
+  {
+
+    /* Convert Matrix to Hex */
+    $slh = "";
+    foreach($this->Matrix as $day_key => $days){
+      foreach($days as $hour_key => $hour){
+        $slh .= $hour;
+      }
+    }
+
+    /* Shift string to match given timezone settings */
+    $shift_by = (168 + ($this->timezone*(-1))) % 168;
+    for($i = 0 ; $i < $shift_by; $i ++){
+      $slh = $slh[167].$slh;
+      $slh = substr($slh,0,168);
+    }
+    /* Rework string, because it was stored in little endian */
+    $new = '';
+    for($i = 0 ; $i < 21 ; $i ++ ){
+      $part         = strrev(substr($slh, $i * 8, 8));
+      $byte['hi']   = substr($part,0,4);
+      $byte['low']  = substr($part,4,4);
+      $new .= $byte['hi'].$byte['low'];
+    }
+
+    /* Convert to bin */
+    $tmp = '';
+    for($i = 0 ; $i < 21 ; $i ++){
+      $tmp .= str_pad(base_convert(substr($new,$i*8,8),2,16),2,'0',STR_PAD_LEFT);
+    }
+
+    /* Create uppercase HEX chars */
+    $ret = strtoupper( $tmp);
+    
+    /* All hours and days selected */
+    if(substr_count($ret,'F') == 42){
+      $ret = "";
+    }
+
+    return($ret);
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/personal/samba/main.inc b/gosa-core/plugins/personal/samba/main.inc
new file mode 100644 (file)
index 0000000..0c198dc
--- /dev/null
@@ -0,0 +1,130 @@
+<?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
+ */
+
+$display  = "";
+$lock_msg = "";
+if (!$remove_lock){
+  /* Reset requested? */
+  if (isset($_POST['edit_cancel']) ||
+      (isset($_GET['reset']) && $_GET['reset'] == 1)){
+
+    del_lock ($ui->dn);
+    sess_del ('edit');
+    sess_del ('sambaAccount');
+  }
+
+  /* Create sambaAccount object on demand */
+  if (!isset($_SESSION['sambaAccount']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+    $_SESSION['sambaAccount']= new sambaAccount ($config, $ui->dn);
+    $_SESSION['sambaAccount']->enable_CSN_check();
+    $_SESSION['sambaAccount']->set_acl_base($ui->dn);
+    $_SESSION['sambaAccount']->set_acl_category("users");
+  }
+  $sambaAccount= $_SESSION['sambaAccount'];
+
+  /* save changes back to object */
+  if (isset ($_SESSION['edit'])){
+    $sambaAccount->save_object ();
+  }
+
+  /* Enter edit mode? */
+  if (isset($_POST['edit'])){
+
+    /* Check locking */
+    if (($username= get_lock($ui->dn)) != ""){
+      $_SESSION['back_plugin']= $plug;
+      $_SESSION['LOCK_VARS_TO_USE'] = array("/^edit$/","/^plug$/");
+      $lock_msg =  gen_locked_message ($username, $ui->dn);
+
+    }else{
+
+      /* Lock the current entry */
+      add_lock ($ui->dn, $ui->dn);
+      $_SESSION['dn']= $ui->dn;
+      $_SESSION['edit']= TRUE;
+    }
+  }
+
+  /* save changes to LDAP and disable edit mode */
+  if (isset($_POST['edit_finish'])){
+
+    /* Perform checks */
+    $message= $sambaAccount->check ();
+
+    /* No errors, save object */
+    if (count ($message) == 0){
+      $sambaAccount->save ();
+      del_lock ($ui->dn);
+      sess_del ('edit');
+
+      /* Remove from session */
+      sess_del ('sambaAccount');
+    } else {
+      /* Errors found, show message */
+      show_errors ($message);
+    }
+  }
+
+  /* Execute formular */
+  if($lock_msg){
+    $display.= $lock_msg;
+  }else{
+    $display.= $sambaAccount->execute ();
+  }
+
+  /* Store changes  in session */
+  if (isset ($_SESSION['edit'])){
+    $_SESSION['sambaAccount']= $sambaAccount;
+  }
+
+  $info= "";
+  if (($sambaAccount->is_account) && (!$sambaAccount->show_ws_dialog) && empty($lock_msg)){
+    $display.= "<p class=\"plugbottom\">";
+
+    /* Are we in edit mode? */
+    if (isset($_SESSION['edit'])){
+      $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
+      $display.= "&nbsp;";
+      $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+      $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png').
+             "\"> ".$ui->dn."&nbsp;";
+    } else {
+      $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/openlock.png').
+             "\"> ".$ui->dn."&nbsp;";
+
+      if(preg_match("/w/",$ui->get_permissions($ui->dn,"users/sambaAccount"))){
+
+        $info.= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/lamp.png')."\"> ".
+                _("Click the 'Edit' button below to change informations in this dialog");
+        $display.= "<input type=submit name=\"edit\" value=\""._("Edit")."\">\n";
+      }
+      $display.= "<input type=\"hidden\" name=\"ignore\">\n";
+    }
+    $display.= "</p>\n";
+  }
+
+  /* Page header*/
+  $display= print_header(get_template_path('images/samba.png'), _("Samba settings"),
+                         $info).$display;
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/personal/samba/samba2.tpl b/gosa-core/plugins/personal/samba/samba2.tpl
new file mode 100644 (file)
index 0000000..11b28d8
--- /dev/null
@@ -0,0 +1,116 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding="0" border="0">
+
+ <!-- Headline container -->
+ <tr>
+  <td colspan="2" style="width:50%; vertical-align:top;">
+   <h2><p class="center"><img class="center" alt="" align="middle" src="images/rightarrow.png" />&nbsp;{t}Generic{/t}</p></h2>
+  </td>
+ </tr>
+ <tr>
+  <td style="vertical-align:top;">
+   <table summary="">
+    <tr>
+     <td><label for="smbHome">{t}Samba home{/t}</label></td>
+     <td>
+
+{render acl=$smbHomeACL}
+      <input id="smbHome" name="smbHome" size=30 maxlength=60 value="{$smbHome}">
+{/render}
+
+{render acl=$smbDriveACL}
+      <select size="1" name="homeDrive">
+       <option disabled>&nbsp;</option>
+       {html_options values=$drives output=$drives selected=$homeDrive}
+      </select>
+{/render}
+
+     </td>
+    </tr>
+   </table>
+  </td>
+  <td style="border-left:1px solid #A0A0A0">
+    &nbsp;
+  </td>
+  <td style="vertical-align:top;">
+   <table summary="">
+    <tr>
+     <td><label for="scriptPath">{t}Script path{/t}</label></td>
+     <td>
+{render acl=$scriptPathACL}
+      <input id="scriptPath" name="scriptPath" size=35 maxlength=60 value="{$scriptPath}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><label for="profilePath">{t}Profile path{/t}</label></td>
+     <td>
+{render acl=$profilePathACL}
+      <input id="profilePath" name="profilePath" size=35 maxlength=60 value="{$profilePath}">
+{/render}
+     </td>
+    </tr>
+   </table>
+  </td>
+ </tr>
+</table>
+
+<p class="seperator">&nbsp;</p>
+
+<h2><p class="center"><img class="center" alt="" align="middle" src="images/certs.png" />&nbsp;{t}Access options{/t}</p></h2>
+
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding="4" border="0">
+ <tr>
+  <td style="width:50%;">
+{render acl=$allow_pwchangeACL}
+   <input id="allow_pwchange" type=checkbox name="allow_pwchange" value="1" {$flagsP}>
+{/render}
+   <label for="allow_pwchange">{t}Allow user to change password from client{/t}</label>
+   <br>
+{render acl=$no_password_requiredACL}
+   <input id="no_password_required" type=checkbox name="no_password_required" value="1" {$flagsN}>
+{/render}
+   <label for="no_password_required">{t}Login from windows client requires no password{/t}</label>
+   <br>
+{render acl=$temporary_disableACL}
+   <input id="temporary_disable" type=checkbox name="temporary_disable" value="1" {$flagsD}>
+{/render}
+   <label for="temporary_disable">{t}Temporary disable samba account{/t}</label>
+   <br>
+  </td>
+  <td style="border-left:1px solid #A0A0A0">
+   &nbsp;
+  </td>
+  <td style="vertical-align:top; width:50%">
+{render acl=$password_expiresACL}
+   <input type=checkbox name="password_expires" value="1" {$flagsC}>
+{/render}
+   <label for="day">{t}Password expires on{/t}</label>
+{render acl=$sambaPwdMustChangeACL}
+   <select id="day" name=day onChange="createResult(this.form,this.form.sambaPwdMustChange);">
+    {html_options values=$days output=$days selected=$day}
+   </select>
+{/render}
+{render acl=$sambaPwdMustChangeACL}
+   <select name=month onChange="populate(this.form,this.form.sambaPwdMustChange);">
+    {html_options options=$months selected=$month}
+   </select>
+{/render}
+{render acl=$sambaPwdMustChangeACL}
+   <select name=year onChange="populate(this.form,this.form.sambaPwdMustChange);">
+    {html_options values=$years output=$years selected=$year}
+   </select>
+{/render}
+   <input type="hidden" name="sambaPwdMustChange" value="{$sambaPwdMustChange}">
+  </td>
+ </tr>
+</table>
+
+<input type="hidden" name="sambaTab" value="sambaTab">
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- 
+  // Populate expiery dialog
+  populate(document.mainform,document.mainform.sambaPwdMustChange);
+  -->
+</script>
diff --git a/gosa-core/plugins/personal/samba/samba3.tpl b/gosa-core/plugins/personal/samba/samba3.tpl
new file mode 100644 (file)
index 0000000..251cf53
--- /dev/null
@@ -0,0 +1,434 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding="0" border="0">
+
+ <!-- Headline container -->
+ <tr>
+  <td colspan="2" style="width:50%; vertical-align:top;">
+   <h2><img class="center" alt="" align="middle" src="images/rightarrow.png"/>&nbsp;{t}Generic{/t}</h2>
+  </td>
+ </tr>
+ <tr>
+  <td style="vertical-align:top;">
+   <table summary="">
+    <tr>
+     <td><label for="sambaHomePath">{t}Home directory{/t}</label></td>
+     <td>
+{render acl=$sambaHomePathACL}
+      <input id="sambaHomePath" name="sambaHomePath" size=30 maxlength=60 value="{$sambaHomePath}">
+{/render}
+{render acl=$sambaHomeDriveACL}
+      <select size="1" name="sambaHomeDrive">
+       <option disabled>&nbsp;</option>
+       {html_options values=$drives output=$drives selected=$sambaHomeDrive}
+      </select>
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><label for="sambaDomainName">{t}Domain{/t}</label></td>
+     <td>
+{render acl=$sambaDomainNameACL}
+      <select id="sambaDomainName" size="1" name="sambaDomainName">
+       {html_options values=$domains output=$domains selected=$sambaDomainName}
+      </select>
+{/render}
+     </td>
+    </tr>
+   </table>
+  </td>
+  <td style="border-left:1px solid #A0A0A0">
+   &nbsp;
+  </td>
+  <td style="vertical-align:top;">
+   <table summary="">
+    <tr>
+     <td><label for="">{t}Script path{/t}</label></td>
+     <td>
+{render acl=$sambaLogonScriptACL}
+      <input id="sambaLogonScript" name="sambaLogonScript" size=35 maxlength=60 value="{$sambaLogonScript}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><label for="">{t}Profile path{/t}</label></td>
+     <td>
+{render acl=$sambaProfilePathACL}
+      <input id="sambaProfilePath" name="sambaProfilePath" size=35 maxlength=60 value="{$sambaProfilePath}">
+{/render}
+     </td>
+    </tr>
+   </table>
+  </td>
+ </tr>
+</table>
+
+<p class="seperator">&nbsp;</p>
+
+<h2><img class="center" alt="" align="middle" src="images/display.png" />&nbsp;{t}Terminal Server{/t}</h2>
+
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=0 border=0>
+ <tr>
+  <td style="vertical-align:top;width:50%">
+{render acl=$AllowLoginOnTerminalServerACL}
+   <input type=checkbox name="tslogin" id="tslogin" value="1" {$tslogin}
+       onclick="
+               changeState('CtxWFHomeDir');
+               changeState('CtxWFHomeDirDrive');
+               changeState('CtxWFProfilePath');
+               changeState('inherit');                 
+               changeTripleSelectState_2nd_neg('tslogin','inherit','CtxInitialProgram');
+               changeTripleSelectState_2nd_neg('tslogin','inherit','CtxWorkDirectory');
+               changeState('CtxMaxConnectionTimeF');
+               changeState('CtxMaxDisconnectionTimeF');
+               changeState('CtxMaxIdleTimeF');
+               changeTripleSelectState('tslogin','CtxMaxConnectionTimeF','CtxMaxConnectionTime');
+               changeTripleSelectState('tslogin','CtxMaxDisconnectionTimeF','CtxMaxDisconnectionTime');
+               changeTripleSelectState('tslogin','CtxMaxIdleTimeF','CtxMaxIdleTime');
+               changeState('connectclientdrives');
+               changeState('connectclientprinters');
+               changeState('defaultprinter');
+               changeState('shadow');
+               changeState('brokenconn');
+               changeState('reconn');
+       ">
+{/render}
+   <i>{t}Allow login on terminal server{/t}</i>
+   <table summary="">
+    <tr>
+     <td><label for="CtxWFHomeDir">{t}Home directory{/t}</label></td>
+     <td>
+{render acl=$AllowLoginOnTerminalServerACL}
+      <input id="CtxWFHomeDir" name="CtxWFHomeDir" size=30 maxlength=60 value="{$CtxWFHomeDir}" {$tsloginstate}>
+{/render}
+{render acl=$AllowLoginOnTerminalServerACL}
+      <select size="1" id="CtxWFHomeDirDrive" name="CtxWFHomeDirDrive"  {$tsloginstate}>
+       <option disabled>&nbsp;</option>
+       {html_options values=$drives output=$drives selected=$CtxWFHomeDirDrive}
+      </select>
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><label for="CtxWFProfilePath">{t}Profile path{/t}</label></td>
+     <td>
+{render acl=$AllowLoginOnTerminalServerACL}
+      <input id="CtxWFProfilePath" name="CtxWFProfilePath" size=35 maxlength=60 value="{$CtxWFProfilePath}" {$tsloginstate}>
+{/render}
+     </td>
+    </tr>
+   </table>
+  </td>
+  <td style="border-left:1px solid #A0A0A0">
+   &nbsp;
+  </td>
+  <td style="vertical-align:top;">
+{render acl=$AllowLoginOnTerminalServerACL}
+   <input type=checkbox id="inherit" name="inherit" {if $inheritstate} checked {/if}
+       onClick="changeState('CtxInitialProgram');
+                changeState('CtxWorkDirectory');"
+       
+       > 
+{/render}
+   <i>{t}Inherit client config{/t}</i>
+   <table summary="">
+    <tr>
+     <td><label for="CtxInitialProgram">{t}Initial program{/t}</label></td>
+     <td>
+{render acl=$AllowLoginOnTerminalServerACL}
+      <input id="CtxInitialProgram" name="CtxInitialProgram" size=35 maxlength=60 value="{$CtxInitialProgram}" {$inheritstate}>
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><label for="CtxWorkDirectory">{t}Working directory{/t}</label></td>
+     <td>
+{render acl=$AllowLoginOnTerminalServerACL}
+      <input id="CtxWorkDirectory" name="CtxWorkDirectory" size=35 maxlength=60        value='{$CtxWorkDirectory}' {$inheritstate}>
+{/render}
+     </td>
+    </tr>
+   </table>
+  </td>
+ </tr>
+</table>
+
+<p class="seperator">&nbsp;</p>
+
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=0 border=0>
+ <tr>
+  <td style="vertical-align:top;">
+   <i>{t}Timeout settings (in minutes){/t}</i>
+   <table summary="">
+    <tr>
+     <td>
+{render acl=$AllowLoginOnTerminalServerACL}
+      <input           id="CtxMaxConnectionTimeF"      type=checkbox                   name="CtxMaxConnectionTimeF" 
+                       value="1"                       {$CtxMaxConnectionTimeF}        
+                       onclick="changeState('CtxMaxConnectionTime')" {$tsloginstate}>
+{/render}
+
+      <label for="CtxMaxConnectionTimeF">{t}Connection{/t}</label>
+     </td>
+     <td>
+{render acl=$AllowLoginOnTerminalServerACL}
+      <input name="CtxMaxConnectionTime" id="CtxMaxConnectionTime" size=5 maxlength=5 value="{$CtxMaxConnectionTime}" {$tsloginstate}
+                       { if !$CtxMaxConnectionTimeF } disabled  {/if}>
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td>
+{render acl=$AllowLoginOnTerminalServerACL}
+      <input id="CtxMaxDisconnectionTimeF" type=checkbox name="CtxMaxDisconnectionTimeF" value="1" {$CtxMaxDisconnectionTimeF} onclick="changeState('CtxMaxDisconnectionTime')" {$tsloginstate}>
+{/render}
+      <label for="CtxMaxDisconnectionTimeF">{t}Disconnection{/t}</label>
+     </td>
+     <td>
+{render acl=$AllowLoginOnTerminalServerACL}
+      <input name="CtxMaxDisconnectionTime" id="CtxMaxDisconnectionTime" size=5 maxlength=5 value="{$CtxMaxDisconnectionTime}" {$tsloginstate}
+                       { if !$CtxMaxDisconnectionTimeF } disabled  {/if}>
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td>
+{render acl=$AllowLoginOnTerminalServerACL}
+      <input id="CtxMaxIdleTimeF" type=checkbox name="CtxMaxIdleTimeF" value="1" {$CtxMaxIdleTimeF} onclick="changeState('CtxMaxIdleTime')" {$tsloginstate}>
+{/render}
+      <label for="CtxMaxIdleTimeF">{t}IDLE{/t}</label>
+     </td>
+     <td>
+{render acl=$AllowLoginOnTerminalServerACL}
+      <input name="CtxMaxIdleTime" id="CtxMaxIdleTime" size=5 maxlength=5 value="{$CtxMaxIdleTime}" {$tsloginstate}
+                       { if !$CtxMaxIdleTimeF } disabled  {/if}>
+{/render}
+     </td>
+    </tr>
+   </table>
+  </td>
+  <td style="border-left:1px solid #A0A0A0">
+   &nbsp;
+  </td>
+  <td style="vertical-align:top;">
+
+   <i>{t}Client devices{/t}</i>
+   <table summary="">
+    <tr>
+     <td>
+{render acl=$AllowLoginOnTerminalServerACL}
+      <input id="connectclientdrives" type=checkbox name="connectclientdrives" value="1" {$connectclientdrives} {$tsloginstate}>
+{/render}
+      <label for="connectclientdrives">{t}Connect client drives at logon{/t}</label>
+     </td>
+    </tr>
+    <tr>
+     <td>
+{render acl=$AllowLoginOnTerminalServerACL}
+      <input id="connectclientprinters" type=checkbox name="connectclientprinters" value="1" {$connectclientprinters}{$tsloginstate}>
+{/render}
+      <label for="connectclientprinters">{t}Connect client printers at logon{/t}</label>
+     </td>
+    </tr>
+    <tr>
+     <td>
+{render acl=$AllowLoginOnTerminalServerACL}
+      <input id="defaultprinter" type=checkbox name="defaultprinter" value="1" {$defaultprinter}>
+{/render}
+      <label for="defaultprinter">{t}Default to main client printer{/t}</label>
+     </td>
+    </tr>
+   </table>
+
+  </td>
+  <td style="border-left:1px solid #A0A0A0">
+   &nbsp;
+  </td>
+  <td style="vertical-align:top;width:50%">
+   <i>{t}Miscellaneous{/t}</i>
+   <table summary="">
+    <tr>
+     <td>
+      <label for="shadow">{t}Shadowing{/t}</label>
+     </td>
+     <td>
+{render acl=$AllowLoginOnTerminalServerACL}
+      <select id="shadow" size="1" name="shadow" >
+       {html_options options=$shadow selected=$shadowmode}
+      </select>
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><label for="brokenconn">{t}On broken or timed out{/t}</label></td>
+     <td>
+{render acl=$AllowLoginOnTerminalServerACL}
+      <select id="brokenconn" size="1" name="brokenconn">
+       {html_options options=$brokenconn selected=$brokenconnmode}
+      </select>
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><label for="reconn">{t}Reconnect if disconnected{/t}</label></td>
+     <td>
+{render acl=$AllowLoginOnTerminalServerACL}
+      <select id="reconn" size="1" name="reconn">
+       {html_options options=$reconn selected=$reconnmode}
+      </select>
+{/render}
+     </td>
+    </tr>
+   </table>
+
+  </td>
+ </tr>
+</table>
+
+<p class="seperator">&nbsp;</p>
+
+<h2><img class="center" alt="" align="middle" src="images/certs.png" />&nbsp;{t}Access options{/t}</h2>
+
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4 border=0>
+ <tr>
+  <td style="width:50%; vertical-align:top;">
+{render acl=$sambaPwdCanChangeACL}
+   <input id="allow_pwchange" type=checkbox name="allow_pwchange" value="1" {$flagsP}>
+{/render}
+   <label for="allow_pwchange">{t}Allow user to change password from client{/t}</label>
+   <br>
+{render acl=$sambaAcctFlagsNACL}
+   <input id="no_password_required" type=checkbox name="no_password_required" value="1" {$flagsN}>
+{/render}
+   <label for="no_password_required">{t}Login from windows client requires no password{/t}</label>
+   <br>
+{render acl=$sambaAcctFlagsLACL}
+   <input id="temporary_disable" type=checkbox name="temporary_disable" value="1" {$flagsD}>
+{/render}
+   <label for="temporary_disable">{t}Lock samba account{/t}</label>
+   <br>
+{render acl=$sambaPwdMustChangeACL}
+   <input id="password_expires" type=checkbox name="password_expires" value="1" {$flagsC}>
+{/render}
+   <label for="password_expires">{t}Password expires on{/t}</label>
+{render acl=$sambaPwdMustChangeACL}
+   <select name=day onChange="createResult(this.form,this.form.sambaPwdMustChange);">
+    {html_options values=$days output=$days selected=$day}
+   </select>
+{/render}
+{render acl=$sambaPwdMustChangeACL}
+   <select name=month onChange="populate(this.form,this.form.sambaPwdMustChange);">
+    {html_options options=$months selected=$month}
+   </select>
+{/render}
+{render acl=$sambaPwdMustChangeACL}
+   <select name=year onChange="populate(this.form,this.form.sambaPwdMustChange);">
+    {html_options values=$years output=$years selected=$year}
+   </select>
+{/render}
+   <br>
+{render acl=$sambaLogonTimeACL}
+   <input id="logon_time_set" type=checkbox name="logon_time_set" value="1" {$flagsT}>
+{/render}
+   <label for="logon_time_set">{t}Limit Logon Time{/t}</label>
+{render acl=$sambaLogonTimeACL}
+   <select name=sambaLogonTime_day onChange="createResult_sambaLogonTime(this.form,this.form.sambaLogonTime);">
+   {html_options values=$sambaLogonTime_days output=$sambaLogonTime_days selected=$sambaLogonTime_day}
+   </select>
+{/render}
+{render acl=$sambaLogonTimeACL}
+   <select name=sambaLogonTime_month onChange="populate_sambaLogonTime(this.form,this.form.sambaLogonTime);">
+   {html_options options=$sambaLogonTime_months output=$sambaLogonTime_months selected=$sambaLogonTime_month}
+   </select>
+{/render}
+{render acl=$sambaLogonTimeACL}
+   <select name=sambaLogonTime_year onChange="populate_sambaLogonTime(this.form,this.form.sambaLogonTime);">
+   {html_options values=$sambaLogonTime_years output=$sambaLogonTime_years selected=$sambaLogonTime_year}
+   </select>
+{/render}
+   <br>
+{render acl=$sambaLogoffTimeACL}
+   <input id="logoff_time_set" type=checkbox name="logoff_time_set" value="1" {$flagsO}>
+{/render}
+   <label for="logoff_time_set">{t}Limit Logoff Time{/t}</label>
+{render acl=$sambaLogoffTimeACL}
+   <select name=sambaLogoffTime_day onChange="createResult_sambaLogoffTime(this.form,this.form.sambaLogoffTime);">
+   {html_options values=$sambaLogoffTime_days output=$sambaLogoffTime_days selected=$sambaLogoffTime_day}
+   </select>
+{/render}
+{render acl=$sambaLogoffTimeACL}
+   <select name=sambaLogoffTime_month onChange="populate_sambaLogoffTime(this.form,this.form.sambaLogoffTime);">
+   {html_options options=$sambaLogoffTime_months output=$sambaLogoffTime_months selected=$sambaLogoffTime_month}
+   </select>
+{/render}
+{render acl=$sambaLogoffTimeACL}
+   <select name=sambaLogoffTime_year onChange="populate_sambaLogoffTime(this.form,this.form.sambaLogoffTime);">
+   {html_options values=$sambaLogoffTime_years output=$sambaLogoffTime_years selected=$sambaLogoffTime_year}
+   </select>
+{/render}
+   <br>
+   
+{render acl=$sambaKickoffTimeACL}
+   <input id="kickoff_time_set" type=checkbox name="kickoff_time_set" value="1" {$flagsK}>
+{/render}
+   <label for="kickoff_time_set">{t}Account expires after{/t}</label>
+{render acl=$sambaKickoffTimeACL}
+   <select name=sambaKickoffTime_day onChange="createResult_sambaKickoffTime(this.form,this.form.sambaKickoffTime);">
+   {html_options values=$sambaKickoffTime_days output=$sambaKickoffTime_days selected=$sambaKickoffTime_day}
+   </select>
+{/render}
+{render acl=$sambaKickoffTimeACL}
+   <select name=sambaKickoffTime_month onChange="populate_sambaKickoffTime(this.form,this.form.sambaKickoffTime);">
+   {html_options options=$sambaKickoffTime_months output=$sambaKickoffTime_months selected=$sambaKickoffTime_month}
+   </select>
+{/render}
+{render acl=$sambaKickoffTimeACL}
+   <select name=sambaKickoffTime_year onChange="populate_sambaKickoffTime(this.form,this.form.sambaKickoffTime);">
+   {html_options values=$sambaKickoffTime_years output=$sambaKickoffTime_years selected=$sambaKickoffTime_year}
+   </select>
+{/render}
+   <br>
+   <input type="hidden" name="sambaPwdMustChange" value="{$sambaPwdMustChange}">
+   <input type="hidden" name="sambaLogonTime" value="{$sambaLogonTime}">
+   <input type="hidden" name="sambaLogoffTime" value="{$sambaLogoffTime}">
+   <input type="hidden" name="sambaKickoffTime" value="{$sambaKickoffTime}">
+<br>
+{render acl=$sambaLogonHoursACL mode=read_active}
+   {t}Samba logon times{/t}&nbsp;<input type='submit' name='SetSambaLogonHours' value='{t}Edit settings...{/t}'>
+{/render}
+
+  </td>        
+  <td style="border-left:1px solid #A0A0A0">
+   &nbsp;
+  </td>
+  <td style="vertical-align:top;">
+   <label for="workstation_list">{t}Allow connection from these workstations only{/t}</label>
+   <br>
+{render acl=$sambaUserWorkstationsACL}
+   <select id="workstation_list" style="width:100%;" name="workstation_list[]" size=10 multiple>
+    {html_options values=$workstations output=$workstations}
+   </select>
+{/render}
+   <br>
+{render acl=$sambaUserWorkstationsACL}
+   <input type="submit" value="{t}Add{/t}" name="add_ws">
+{/render}
+{render acl=$sambaUserWorkstationsACL}
+   <input type="submit" value="{t}Delete{/t}" name="delete_ws">
+{/render}
+  </td>
+ </tr>
+</table>
+
+<input type="hidden" name="sambaTab" value="sambaTab">
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- 
+  // Populate expiery dialog
+  populate(document.mainform,document.mainform.sambaPwdMustChange);
+
+  // Populate samba Time dialogs
+  populate_sambaLogonTime(document.mainform,document.mainform.sambaLogonTime);
+  populate_sambaLogoffTime(document.mainform,document.mainform.sambaLogoffTime);
+  populate_sambaKickoffTime(document.mainform,document.mainform.sambaKickoffTime);
+  -->
+</script>
diff --git a/gosa-core/plugins/personal/samba/samba3_workstations.tpl b/gosa-core/plugins/personal/samba/samba3_workstations.tpl
new file mode 100644 (file)
index 0000000..f2ecfcc
--- /dev/null
@@ -0,0 +1,42 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding="4">
+<tr>
+  <td style="vertical-align:top;width:600px">
+   <div class="contentboxh" style="height:20px;">
+    <p class="contentboxh" style="font-size:12px">
+     <b><label for="wslist">{t}Select workstations to add{/t}</label> {$hint}</b><br />
+    </p>
+   </div>
+   <div class="contentboxb">
+    <p class="contentboxb" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+     <select id="wslist" style="width:600px; margin-top:4px; height:450px;" name="wslist[]" size="15" multiple>
+       {html_options values=$wslist output=$wslist}
+     </select>
+    </p>
+   </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><img class="center" alt="{t}Display workstations of department{/t}" src="{$tree_image}" align="middle">&nbsp;
+    <select name="depselect" size=1 onChange="mainform.submit()" title="{t}Choose the department the search will be based on{/t}">
+      {html_options options=$deplist selected=$depselect}
+    </select></td></tr></table>
+    <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8"><tr><td width="18"><img class="center" alt="" src="{$search_image}" align="middle">&nbsp;</td>
+    <td><input type='text' name='regex' maxlength='20' style="width:99%" value='{$regex}' title='{t}Regular expression for matching addresses{/t}' onChange="mainform.submit()"></td></tr></table>
+   {$apply}
+   </div>
+  </td>
+</tr>
+</table>
+
+<p class="plugbottom">
+  <input type=submit name="add_ws_finish" value="{t}Add{/t}">
+  &nbsp;
+  <input type=submit name="add_ws_cancel" value="{t}Cancel{/t}">
+</p>
diff --git a/gosa-core/plugins/personal/samba/sambaLogonHours.tpl b/gosa-core/plugins/personal/samba/sambaLogonHours.tpl
new file mode 100644 (file)
index 0000000..1eb7306
--- /dev/null
@@ -0,0 +1,111 @@
+
+<!-- Javacript function used to switch a complete row or col of selected hours -->
+<script language="javascript" type="text/javascript">
+  {literal}
+  var $regex = new Array();
+  function toggle_chk($reg)
+  {
+    if(!$regex[$reg]){
+      $regex[$reg] =1;
+    }
+    $regex[$reg] *= -1;
+    if($regex[$reg] == 1){
+      chk_set_all($reg,true);
+    }else{
+      chk_set_all($reg,false);
+    }
+  }
+  {/literal}
+</script>
+
+<h1>{t}Specify the hours this user is allowed to log in{/t}</h1>
+<br>
+
+<table cellspacing=0 cellpadding=0 style='border: solid 1px #B0B0B0; background-color: #EEEEEE; width :100%;' >
+  <tr>
+    <td>&nbsp;</td>
+    <td colspan=24 style='text-align:center;height:24px;border-bottom: solid 1px #B0B0B0;'><b>{t}Hour{/t}</b></td>
+  </tr>
+  <tr>
+    <td style='text-align: left;' class='list0'>&nbsp;</td>
+    {foreach from=$Hours item=hours key=key_hours}
+      {if (($hours)%2) == 0 }
+        <td style="text-align:center;height: 22px; background-color: rgb(226, 226, 226); ">
+      {else}
+        <td style="text-align:center;height: 22px; background-color: rgb(245, 245, 245); border-right: solid 1px #B0B0B0;">
+      {/if}
+      {$hours}
+    </td>
+    {/foreach}
+  </tr>
+
+  <!-- Add toggle buttons for hours -->
+  <tr>
+    <td style='text-align: left;' class='list0'>
+      &nbsp;
+    </td>
+    {foreach from=$Hours item=hours key=key_hours}
+      {if (($hours)%2) == 0 }
+        <td style="text-align:center; height: 22px; background-color: rgb(226, 226, 226); text-align: right;">
+      {else}
+        <td style="text-align:center; height: 22px; background-color: rgb(245, 245, 245); border-right: solid 1px #B0B0B0; text-align: right;">
+      {/if}
+
+{render acl=$sambaLogonHoursACL}
+      <input type='button' onClick="toggle_chk('^day_[0-9]*_{$hours}$');" value='+/-' style='width:100%;'>
+{/render}
+    </td>
+    {/foreach}
+    <td>
+
+{render acl=$sambaLogonHoursACL}
+      <input type='button' onClick="toggle_chk('^day_[0-9]*_[0-9]*$');" value='+/-' style='width:100%;'>
+{/render}
+    </td>
+  </tr>
+
+  <!-- Add Entries -->
+{foreach from=$Matrix item=days key=key_day}
+  <tr>
+    <td class='list0'>
+      <b>{$Days[$key_day]}</b>
+    </td>
+    {foreach from=$days item=hours key=key_hour}
+      {if (($key_hour)%2) == 0 }
+        <td style="text-align:center;height: 22px; background-color: rgb(226, 226, 226); ">
+      {else}
+        <td style="text-align:center;height: 22px; background-color: rgb(245, 245, 245); border-right: solid 1px;">
+      {/if}
+        {if $Matrix[$key_day].$key_hour}
+{render acl=$sambaLogonHoursACL}
+          <input id='day_{$key_day}_{$key_hour}' type='checkbox' name='day_{$key_day}_{$key_hour}' checked >
+{/render}
+        {else}
+{render acl=$sambaLogonHoursACL}
+          <input id='day_{$key_day}_{$key_hour}' type='checkbox' name='day_{$key_day}_{$key_hour}' >
+{/render}
+        {/if}
+      </td>
+    {/foreach}
+
+    <!-- Add toggle button for days -->
+    <td>  
+{render acl=$sambaLogonHoursACL}
+      <input type='button' onClick="toggle_chk('^day_{$key_day}_[0-9]*$')" value='+/-'  style='padding:0px;margin:0px;'>
+{/render}
+    </td>
+  </tr>
+{/foreach}
+</table>
+<br>
+<input type='hidden' name='sambaLogonHoursPosted' value='1'> 
+<br>
+<p class="plugbottom">
+  <input type=submit name="save_logonHours" value="{t}Apply{/t}">
+  &nbsp;
+  <input type=submit name="cancel_logonHours" value="{t}Cancel{/t}">
+</p>
+
+<!--  
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: 
+-->
diff --git a/gosa-core/plugins/personal/scalix/class_scalixAccount.inc b/gosa-core/plugins/personal/scalix/class_scalixAccount.inc
new file mode 100644 (file)
index 0000000..2d85f0d
--- /dev/null
@@ -0,0 +1,509 @@
+<?php
+/*! \brief   scalix plugin
+  \author  Jörn Dreyer <gosa.jfd@butonic.de>,
+           based on work by Cajus Pollmeier <pollmeier@gonicus.de>
+  \version 0.01
+  \date    20.10.2006
+
+  This class provides the functionality to read and write all attributes
+  relevant for scalixAccounts from/to the LDAP. It does syntax checking
+  and displays the formulars required.
+ */
+
+class scalixAccount extends plugin
+{
+  /* Definitions */
+  var $plHeadline   = "Scalix";
+  var $plDescription= "This does something";
+
+  /* plugin specific values - scalixUserClass */
+  /* MUST */
+  var $scalixScalixObject= TRUE; //TRUE or FALSE
+  var $scalixMailnode= "";
+  /* INDIRECT MUST, scalix will complain if no email was specified */
+  
+  /* MAY */
+  var $scalixAdministrator= FALSE;
+  var $scalixMailboxAdministrator = FALSE;
+  var $scalixServerLanguage= "";
+  var $scalixEmailAddress= array();
+  var $scalixLimitMailboxSize= "";
+  var $scalixLimitOutboundMail= FALSE;
+  var $scalixLimitInboundMail= FALSE;
+  var $scalixLimitNotifyUser= FALSE;
+  var $scalixHideUserEntry= FALSE;
+  var $scalixMailboxClass= "";
+
+  var $uid  ="";
+  var $default_permissions= "none";
+  var $member_permissions= "post";
+  var $members= array();
+  var $admins= array();
+  var $vacations= array();
+  var $perms= array(  "lrs"       => "read", 
+                      "lrsp"      => "post", 
+                      "lrsip"     => "append",
+                      "lrswipcd"  => "write", 
+                      "lrswipcda" => "all" );
+
+  /* attribute list for save action */
+  var $attributes           = array("scalixMailnode", "scalixServerLanguage", "scalixLimitMailboxSize", "scalixMailboxClass");
+  var $fakeBooleanAttributes= array("scalixAdministrator", "scalixMailboxAdministrator", "scalixLimitOutboundMail",
+                                    "scalixLimitInboundMail", "scalixLimitNotifyUser", "scalixHideUserEntry");
+  var $objectclasses        = array("scalixUserClass");
+
+
+  /* constructor, if 'dn' is set, the node loads the given
+     'dn' from LDAP */
+  function scalixAccount (&$config, $dn= NULL)
+  {
+    /* dn shouldn't be NULL */
+    if($dn === NULL){
+      trigger_error("Initialising scalixAccount without valid dn.");
+    }
+
+    /* Load bases attributes */
+    plugin::plugin($config, $dn);
+
+    /* Load attributes */
+    if ($dn != "new"){
+
+      /* Set user id */
+      if(isset($this->attrs['uid'][0])){
+        $this->uid = $this->attrs['uid'][0];
+      }
+       
+      foreach ($this->fakeBooleanAttributes as $val){
+        if (isset($this->attrs["$val"][0])&&$this->attrs["$val"][0]=="TRUE"){
+          $this->$val = TRUE;
+        } else {
+          $this->$val = FALSE;
+        }
+      }
+
+      /* Load attributes containing arrays */
+      foreach (array("scalixEmailAddress") as $val){
+        if (isset($this->attrs["$val"]["count"])){
+          for ($i= 0; $i<$this->attrs["$val"]["count"]; $i++){
+            array_push($this->$val, $this->attrs["$val"][$i]);
+          }
+        }
+      }
+    }
+
+    /* Save initial account state */
+    $this->initially_was_account= $this->is_account;
+  }
+
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* Load templating engine */
+    $smarty= get_smarty();
+    $display= "";
+
+    /* Do we need to flip is_account state? */
+    if (isset($_POST['modify_state'])){
+      $this->is_account= !$this->is_account;
+    }
+
+    /* Show main page */
+    $mailboxClasses = array("", "LIMITED", "FULL");
+    $serverLanguages= array("", "GERMAN", "ENGLISH");
+
+    /* Do we represent a valid account? */
+    if (!$this->is_account && $this->parent === NULL){
+      $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\">&nbsp;<b>".
+        _("This account has no scalix extensions.")."</b>";
+
+      $display.= back_to_main();
+      return ($display);
+    }
+
+    /* Show tab dialog headers */
+    if ($this->parent !== NULL){
+      if ($this->is_account){
+        $display= $this->show_disable_header(_("Remove scalix account"),
+            _("This account has scalix synchronization enabled. You can disable it by clicking below."));
+      } else {
+        $display= $this->show_enable_header(_("Create scalix account"), _("This account has scalix synchronization disabled. You can enable it by clicking below."));
+        return ($display);
+      }
+    }
+
+    /* Trigger forward add dialog? */
+    if (isset($_POST['add_local_forwarder'])){
+      $this->forward_dialog= TRUE;
+      $this->dialog= TRUE;
+    }
+
+    /* Cancel forward add dialog? */
+    if (isset($_POST['add_locals_cancel'])){
+      $this->forward_dialog= FALSE;
+      $this->dialog= FALSE;
+    }
+
+
+    $smarty->assign("mailboxClasses", $mailboxClasses);
+    $smarty->assign("serverLanguages", $serverLanguages);
+    foreach(array("perms", "scalixScalixObject", "scalixMailnode", "scalixAdministrator", "scalixMailboxAdministrator",
+      "scalixServerLanguage", "scalixLimitMailboxSize", "scalixLimitOutboundMail", "scalixEmailAddress",
+      "scalixLimitInboundMail", "scalixLimitNotifyUser", "scalixHideUserEntry", "scalixMailboxClass") as $val){
+
+      $smarty->assign("$val", $this->$val);
+      $smarty->assign("$val"."ACL", $this->getacl($val));
+    }
+
+    /* Fill checkboxes */
+    if ($this->scalixAdministrator) {
+      $smarty->assign("scalixAdministrator", "checked");
+    } else {
+      $smarty->assign("scalixAdministrator", "");
+    }
+    if ($this->scalixMailboxAdministrator) {
+      $smarty->assign("scalixMailboxAdministrator", "checked");
+    } else {
+      $smarty->assign("scalixMailboxAdministrator", "");
+    }
+    if ($this->scalixLimitOutboundMail) {
+      $smarty->assign("scalixLimitOutboundMail", "checked");
+    } else {
+      $smarty->assign("scalixLimitOutboundMail", "");
+    }
+    if ($this->scalixLimitInboundMail) {
+      $smarty->assign("scalixLimitInboundMail", "checked");
+    } else {
+      $smarty->assign("scalixLimitInboundMail", "");
+    }
+    if ($this->scalixLimitNotifyUser) {
+      $smarty->assign("scalixLimitNotifyUser", "checked");
+    } else {
+      $smarty->assign("scalixLimitNotifyUser", "");
+    }
+    if ($this->scalixHideUserEntry) {
+      $smarty->assign("scalixHideUserEntry", "checked");
+    } else {
+      $smarty->assign("scalixHideUserEntry", "");
+    }
+
+    $display.= $smarty->fetch (get_template_path('generic.tpl', TRUE, dirname(__FILE__)));
+    return ($display);
+  }
+
+
+  /* remove object from parent */
+  function remove_from_parent()
+  {
+    /* Cancel if there's nothing to do here */
+    if (!$this->initially_was_account){
+      return;
+    }
+    
+    /* include global link_info */
+    $ldap= $this->config->get_ldap_link();
+
+    /* Remove and write to LDAP */
+    plugin::remove_from_parent();
+
+    /* Zero arrays */
+    $this->attrs['scalixEmailAddress']= array();
+
+    /* Unset fake boolean attributes from entry */
+    foreach ($this->fakeBooleanAttributes as $val){
+      $this->attrs["$val"]= array();
+    }
+
+    /*unset scalixScalixObject*/
+    $this->attrs['scalixScalixObject']=array();
+
+    @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,$this->attributes, "Save");
+    $ldap->cd($this->dn);
+    $ldap->modify($this->attrs);
+    show_ldap_error($ldap->get_error());
+
+    /* Optionally execute a command after we're done */
+    $this->handle_post_events("remove");
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    if (isset($_POST['scalixTab'])){
+
+      /* Save ldap attributes */
+      plugin::save_object();
+
+      /* Save fakeBooleanAttributes*/
+      foreach ($this->fakeBooleanAttributes as $val){
+        if ($this->acl_is_writeable($val)) {
+          if( isset ($_POST["$val"])) {
+            $data = TRUE;
+          } else {
+            $data = FALSE;
+          }
+          if ($this->$val != $data){
+            $this->is_modified= TRUE;
+          }
+
+          $this->$val= $data;
+        }
+      }
+    }
+  }
+
+
+  /* Save data to LDAP, depending on is_account we save or delete */
+  function save()
+  {
+    $ldap= $this->config->get_ldap_link();
+
+    /* Call parents save to prepare $this->attrs */
+    plugin::save();
+
+    /* Save arrays */
+    $this->attrs['scalixEmailAddress']= $this->scalixEmailAddress;    
+    
+    /* Save boolean vars ... the scalix schema expects them as strings */
+    $this->attrs['scalixScalixObject'] = $this->scalixScalixObject?"TRUE":"FALSE";
+    $this->attrs['scalixAdministrator'] = $this->scalixAdministrator?"TRUE":"FALSE";
+    $this->attrs['scalixMailboxAdministrator'] = $this->scalixMailboxAdministrator?"TRUE":"FALSE";
+    $this->attrs['scalixLimitOutboundMail'] = $this->scalixLimitOutboundMail?"TRUE":"FALSE";
+    $this->attrs['scalixLimitInboundMail'] = $this->scalixLimitInboundMail?"TRUE":"FALSE";
+    $this->attrs['scalixLimitNotifyUser'] = $this->scalixLimitNotifyUser?"TRUE":"FALSE";
+    $this->attrs['scalixHideUserEntry'] = $this->scalixHideUserEntry?"TRUE":"FALSE";
+
+    /* Remove Mailquota if = "" */
+    if((isset($this->attrs['scalixLimitMailboxSize']))&&($this->attrs['scalixLimitMailboxSize']=="")) {
+      $this->attrs['scalixLimitMailboxSize']=array();
+    }
+
+    /* Save data to LDAP */
+    $ldap->cd($this->dn);
+    $ldap->modify($this->attrs);
+    show_ldap_error($ldap->get_error());
+
+    /* 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");
+    }
+
+  }
+
+  /* Check formular input */
+  function check()
+  {
+    $ldap= $this->config->get_ldap_link();
+
+    $message= array();
+
+    if(empty($this->scalixMailnode)){
+      $message[]= _("There is no scalix mailnode specified.");
+    }
+    if(empty($this->scalixScalixObject)){
+      $message[]= _("scalixScalixObject must be set!");
+    }
+
+    $ldap->cd($this->config->current['BASE']);
+    foreach($this->scalixEmailAddress as $k => $mail) {        
+      $ldap->search ("(&(!(objectClass=gosaUserTemplate))(objectClass=scalixUserClass)(scalixEmailAddress=".
+        $mail.")(!(uid=".$this->uid."))(!(cn=".$this->uid.")))", array("uid"));
+  
+      if ($ldap->count() != 0){
+        $message[]= _("The email address '$mail' you've entered is already in use.");
+      }
+    }
+
+    /* Check quota */
+    if ($this->scalixLimitMailboxSize != '' && $this->acl_is_writeable("scalixLimitMailboxSize")){
+      if (!is_numeric($this->scalixLimitMailboxSize)) {
+        $message[]= _("Value in 'Limit Mailbox size' is not valid.");
+      } else {
+        $this->scalixLimitMailboxSize= (int) $this->scalixLimitMailboxSize;
+      }
+    }
+
+    return ($message);
+  }
+
+  /* Adapt from template, using 'dn' */
+  function adapt_from_template($dn)
+  {
+    plugin::adapt_from_template($dn);
+
+    foreach (array("scalixEmailAddress") as $val){
+      $this->$val= array();
+      if (isset($this->attrs["$val"]["count"])){
+        for ($i= 0; $i<$this->attrs["$val"]["count"]; $i++){
+          $value= $this->attrs["$val"][$i];
+          foreach (array("sn", "givenName", "uid") as $repl){
+            if (preg_match("/%$repl/i", $value)){
+              $value= preg_replace ("/%$repl/i", $this->parent->$repl, $value);
+            }
+          }
+          array_push($this->$val, strtolower(rewrite($value)));
+        }
+      }
+    }
+    $this->mail= strtolower(rewrite($this->mail));
+  }
+
+  function addEmail($address)
+  {
+    $ldap= $this->config->get_ldap_link();
+
+    $address= strtolower($address);
+
+    /* Is this address already assigned in LDAP? */
+    $ldap->cd ($this->config->current['BASE']);
+    $ldap->search ("(&(objectClass=scalixUserClass)(|(scalixEmailAddress=$address)".
+        "(scalixEmailAddress=$address)))", array("uid"));
+
+    if ($ldap->count() > 0){
+      $attrs= $ldap->fetch ();
+      return ($attrs["uid"][0]);
+    }
+
+    /* Add to list of alternates */
+    if (!in_array($address, $this->scalixEmailAddress)){
+      $this->scalixEmailAddress[]= $address;
+      $this->is_modified= TRUE;
+    }
+
+    //sort ($this->scalixEmailAddress); //scalix makes the first email the destination, all others can receive
+    reset ($this->scalixEmailAddress);
+
+    return ("");
+  }
+
+
+  function delEmail($addresses)
+  {
+    $this->scalixEmailAddress= array_remove_entries ($addresses, $this->scalixEmailAddress);
+    $this->is_modified= TRUE;
+  }
+
+
+  static function plInfo()
+  {
+    return (array(
+          "plDescription"     => _("Scalix account"),
+          "plSelfModify"      => TRUE,
+          "plDepends"         => array("user"),
+          "plPriority"        => 2,
+          "plSection"         => array("personal" => _("My account")),
+          "plCategory"        => array("users"),
+          "plOptions"         => array(),
+
+          "plProvidedAcls"  => array(
+
+            "scalixMailnode"            => _("Scalix Mail node"),
+            "scalixMailboxClass"        => _("Mailbox class"),
+            "scalixServerLanguage"      => _("Server language"),
+            "scalixAdministrator"       => _("Administrator"),
+            "scalixMailboxAdministrator"=> _("Mailbox administrator"),
+            "scalixHideUserEntry"       => _("Hide user entry in Scalix"),
+            "scalixLimitMailboxSize"    => _("Mailbox size limitations"),
+            "scalixLimitOutboundMail"   => _("Limit outbound"),
+            "scalixLimitInboundMail"    => _("Limit inbound"),
+            "scalixLimitNotifyUser"     => _("Notify user"),
+            "scalixEmailAddress"        => _("Scalix email addresses"))
+
+            ));
+  }
+
+
+  function saveCopyDialog()
+  {
+    if (isset($_POST['scalixTab'])){
+
+      /* Add email addresses */
+      if (isset($_POST['add_email'])){
+
+        /* Check write access */
+#        if(!$this->acl_is_writeable("scalixEmailAddress")){
+#          print_red(_("You are not allowed to modify alternate addresses"));
+#        }else{
+
+          /* Check if given value is not empty */
+          if ($_POST['email_address'] != ""){
+            $valid= FALSE;
+
+            /* Valid mail address */
+            if( ($this->is_template && !is_email($_POST['email_address'], TRUE)) || 
+                (!$this->is_template && !is_email($_POST['email_address'])) ){
+              print_red (_("You're trying to add an invalid email address to the list of alternate addresses."));
+            }else{
+              $valid = TRUE;
+            }
+
+            /* Mail address already in use ? */
+            if ($valid && ($user= $this->addEmail ($_POST['email_address'])) != ""){
+              $ui= get_userinfo();
+              if ($user != $ui->username){
+                print_red (_("The address you're trying to add is already used by user")." '$user'.");
+              }
+            }
+#          }
+        }
+      }
+  
+      /* Delete email addresses */
+      if (isset($_POST['delete_email']) && isset ($_POST['emails_list'])){
+#        if(!$this->acl_is_writeable("scalixEmailAddress")){
+#          print_red(_("You are not allowed to modify alternate addresses"));
+#        }else{
+          if (count($_POST['emails_list'])){
+            $this->delEmail ($_POST['emails_list']);
+#          }
+        }
+      }
+    }
+  }
+
+
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);
+    foreach ($this->fakeBooleanAttributes as $val){
+      if (isset($source["$val"][0])&&$source["$val"][0]=="TRUE"){
+        $this->$val = TRUE;
+      } else {
+        $this->$val = FALSE;
+      }
+    }
+
+    /* Load attributes containing arrays */
+    foreach (array("scalixEmailAddress") as $val){
+      if (isset($source["$val"]["count"])){
+        for ($i= 0; $i<$source["$val"]["count"]; $i++){
+          array_push($this->$val, $source["$val"][$i]);
+        }
+      }
+    }
+  }
+
+
+  /* Create the posix dialog part for copy & paste */
+  function getCopyDialog()
+  {
+    $smarty = get_smarty(); 
+    $smarty->assign("scalixEmailAddress",$this->scalixEmailAddress);
+    $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE,dirname(__FILE__)));    
+    $ret = array();
+    $ret['string'] = $str;
+    $ret['status'] = "";
+    return($ret);
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:rulere
+?>
diff --git a/gosa-core/plugins/personal/scalix/generic.tpl b/gosa-core/plugins/personal/scalix/generic.tpl
new file mode 100644 (file)
index 0000000..669d2ea
--- /dev/null
@@ -0,0 +1,127 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding="0" border="0">
+ <tr>
+  <td style="width:50%; vertical-align:top;">
+   <h2><img class="center" alt="" align="middle" src="images/rightarrow.png" />&nbsp;{t}Generic{/t}</h2>
+   <table summary="">
+    <tr>
+     <td><label for="scalixMailnode">{t}Scalix mailnode{/t}</label>{$must}</td>
+     <td>
+{render acl=$scalixMailnodeACL}
+               <input id="scalixMailnode" name="scalixMailnode" size=35 maxlength=65 value="{$scalixMailnode}">
+{/render}
+        </td>
+    </tr>
+    <tr>
+     <td><label for="scalixMailboxClass">{t}Salix mailbox class{/t}</label></td>
+     <td>
+{render acl=$scalixMailboxClassACL}
+      <select size="1" id="scalixMailboxClass" name="scalixMailboxClass"  
+                       title="{t}Limited users con not make use of the group calendar functionality in Scalix{/t}">
+                   {html_options values=$mailboxClasses output=$mailboxClasses selected=$scalixMailboxClass}
+      </select>
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><label for="scalixServerLanguage">{t}Scalix server language{/t}</label></td>
+     <td>
+{render acl=$scalixServerLanguageACL}
+      <select size="1" id="scalixServerLanguage" name="scalixServerLanguage" 
+                       title="{t}Message catalog language for client.{/t}">
+                   {html_options values=$serverLanguages output=$serverLanguages selected=$scalixServerLanguage}
+      </select>
+{/render}
+     </td>
+    </tr>
+   </table>
+   
+   <p class="seperator">&nbsp;</p>
+   
+   <table summary="">
+    <tr>
+     <td>
+{render acl=$scalixAdministratorACL}
+         <input type=checkbox name="scalixAdministrator" value="1" {$scalixAdministrator}
+          title="{t}Select for admin capability.{/t}"> {t}Scalix Administrator{/t}
+{/render}
+         <br>
+{render acl=$scalixMailboxAdministratorACL}
+         <input type=checkbox name="scalixMailboxAdministrator" value="1" {$scalixMailboxAdministrator}
+          title="{t}Select for mailbox admin capability.{/t}"> {t}Scalix Mailbox Administrator{/t}
+{/render}
+         <br>
+{render acl=$scalixHideUserEntryACL}
+         <input type=checkbox name="scalixHideUserEntry" value="1" {$scalixHideUserEntry}
+          title="{t}Hide user entry from addressbook.{/t}"> {t}Hide this user entry in Scalix{/t}
+{/render}
+         <br>
+   </table>
+   
+   <p class="seperator">&nbsp;</p>
+   
+   <table summary="">
+    <tr>
+     <td><label for="scalixLimitMailboxSize">{t}Limit mailbox size{/t}</label></td>
+     <td>
+{render acl=$scalixLimitMailboxSizeACL}
+               <input id="scalixLimitMailboxSize" name="scalixLimitMailboxSize" size=5 maxlength=10 value="{$scalixLimitMailboxSize}">&nbsp;{t}MB{/t}
+{/render}
+        </td>
+    </tr>
+    <tr>
+     <td >
+{render acl=$scalixLimitOutboundMailACL}
+         <input type=checkbox name="scalixLimitOutboundMail" value="1" {$scalixLimitOutboundMail}
+          title="{t}As sanction on mailbox quota overuse, stop user from sending mail.{/t}"> {t}Limit Outbound Mail{/t}
+{/render}
+         <br>
+{render acl=$scalixLimitInboundMailACL}
+         <input type=checkbox name="scalixLimitInboundMail" value="1" {$scalixLimitInboundMail}
+          title="{t}As sanction on mailbox quota overuse, stop user from receiving mail.{/t}"> {t}Limit Inbound Mail{/t}
+{/render}
+         <br>
+{render acl=$scalixLimitNotifyUserACL}
+         <input type=checkbox name="scalixLimitNotifyUser" value="1" {$scalixLimitNotifyUser}
+          title="{t}As sanction on mailbox quota overuse, notify the user by eMail.{/t}"> {t}Notify User{/t}
+{/render}
+         <br>
+     </td>
+    </tr>
+   </table>
+  </td>
+
+  <td style="border-left:1px solid #A0A0A0">
+   &nbsp;
+  </td>
+
+  <td style="vertical-align:top;">
+   <h2><img class="center" alt="" align="middle" src="images/envelope.png" /><label for="emails_list"> {t}Scalix email addresses{/t}</label></h2>
+{render acl=$scalixEmailAddressACL}
+   <select id="emails_list" style="width:100%;height:100px;" name="emails_list[]" size="15"
+                multiple title="{t}List of scalix email addresses{/t}" >
+            {html_options values=$scalixEmailAddress output=$scalixEmailAddress}
+                       <option disabled>&nbsp;</option>
+   </select>
+{/render}
+   <br />
+{render acl=$scalixEmailAddressACL}
+   <input name="email_address" size="30" align="middle" maxlength="65" value="">
+{/render}
+{render acl=$scalixEmailAddressACL}
+   <input type=submit value="{t}Add{/t}" name="add_email">&nbsp;
+{/render}
+{render acl=$scalixEmailAddressACL}
+   <input type=submit value="{t}Delete{/t}" name="delete_email">
+{/render}
+  </td>
+ </tr>
+</table>
+
+<input type="hidden" name="scalixTab" value="scalixTab">
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('scalixMailnode');
+  -->
+</script>
diff --git a/gosa-core/plugins/personal/scalix/main.inc b/gosa-core/plugins/personal/scalix/main.inc
new file mode 100644 (file)
index 0000000..0d2558a
--- /dev/null
@@ -0,0 +1,129 @@
+<?php
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2006  Jörn Dreyer, based on work by
+                       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
+ */
+
+if (!$remove_lock){
+  /* Reset requested? */
+  if (isset($_POST['edit_cancel']) || 
+      (isset($_GET['reset']) && $_GET['reset'] == 1)){
+    del_lock ($ui->dn);
+    sess_del ('edit');
+    sess_del ('scalixAccount');
+  }
+
+  /* Create mail object on demand */
+  if (!isset($_SESSION['scalixAccount']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+    $_SESSION['scalixAccount']= new scalixAccount ($config, $ui->dn);
+    $_SESSION['scalixAccount']->enable_CSN_check();
+    $_SESSION['scalixAccount']->set_acl_base($ui->dn);
+    $_SESSION['scalixAccount']->set_acl_category("users");
+  }
+  $scalixAccount= $_SESSION['scalixAccount'];
+
+  /* save changes back to object */
+  if (isset ($_SESSION['edit'])){
+    $scalixAccount->save_object ();
+  }
+
+  /* Enter edit mode? */
+  if (isset($_POST['edit'])){
+
+    /* Check locking */
+    if (($username= get_lock($ui->dn)) != ""){
+      $_SESSION['back_plugin']= $plug;
+      $_SESSION['LOCK_VARS_TO_USE'] = array("/^edit$/","/^plug$/");
+      $lock_msg =  gen_locked_message ($username, $ui->dn);
+
+    }else{
+
+      /* Lock the current entry */
+      add_lock ($ui->dn, $ui->dn);
+      $_SESSION['dn']= $ui->dn;
+      $_SESSION['edit']= TRUE;
+    }
+  }
+
+  /* save changes to LDAP and disable edit mode */
+  if (isset($_POST['edit_finish'])){
+
+    /* Perform checks */
+    $message= $scalixAccount->check ();
+
+    /* No errors, save object */
+    if (count ($message) == 0){
+      $scalixAccount->save ();
+      gosa_log ("User/scalix object'".$ui->dn."' has been saved");
+      $scalixAccount->acl= "#none#";
+      del_lock ($ui->dn);
+      sess_del ('edit');
+
+      /* Remove object */
+      sess_del ('scalixAccount');
+    } else {
+      /* Errors found, show message */
+      show_errors ($message);
+    }
+  }
+
+  /* Execute formular */
+  $display= $scalixAccount->execute ();
+
+  /* Store changes  in session */
+  if (isset ($_SESSION['edit'])){
+    $_SESSION['scalixAccount']= $scalixAccount;
+  }
+
+ /* Show page footer depending on the mode */
+  if ($scalixAccount->is_account){
+
+    $display.= "<p class=\"plugbottom\">";
+
+    /* Are we in edit mode? */
+    if (isset($_SESSION['edit'])){
+      $display.= "<input type=submit name=\"edit_finish\" value=\""._("Save")."\">\n";
+      $display.= "&nbsp;";
+      $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+      $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png').
+             "\"> ".$ui->dn."&nbsp;";
+    } else {
+      $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/openlock.png').
+             "\"> ".$ui->dn."&nbsp;";
+
+      if(preg_match("/w/",$ui->get_permissions($ui->dn,"users/scalix"))){
+        $info.= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/lamp.png')."\"> ".
+                _("Click the 'Edit' button below to change informations in this dialog");
+
+        $display.= "<input type=submit name=\"edit\" value=\""._("Edit")."\">\n";
+      }
+      $display.= "<input type=\"hidden\" name=\"ignore\">\n";
+    }
+    $display.= "</p>\n";
+  }
+
+
+  $info= "";
+
+  /* Page header*/
+  $display= print_header(get_template_path('images/scalix.png'), _("Scalix settings"), $info).$display;
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/plugins/personal/scalix/paste_generic.tpl b/gosa-core/plugins/personal/scalix/paste_generic.tpl
new file mode 100644 (file)
index 0000000..4bdf489
--- /dev/null
@@ -0,0 +1,25 @@
+<table>
+       <tr>
+  <td style="vertical-align:top;">
+   <h2><img class="center" alt="" align="middle" src="images/envelope.png" /><label for="emails_list"> {t}Scalix email addresses{/t}</label></h2>
+   <select id="emails_list" style="width:100%;height:100px;" name="emails_list[]" size="15"
+                multiple title="{t}List of scalix email addresses{/t}" >
+            {html_options values=$scalixEmailAddress output=$scalixEmailAddress}
+                       <option disabled>&nbsp;</option>
+   </select>
+   <br />
+   <input name="email_address" size="30" align="middle" maxlength="65" value="">
+   <input type=submit value="{t}Add{/t}" name="add_email">&nbsp;
+   <input type=submit value="{t}Delete{/t}" name="delete_email">
+  </td>
+ </tr>
+</table>
+
+<input type="hidden" name="scalixTab" value="scalixTab">
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+  document.mainform.scalixMailnode.focus();
+  -->
+</script>
diff --git a/gosa-core/setup/class_setup.inc b/gosa-core/setup/class_setup.inc
new file mode 100644 (file)
index 0000000..753751c
--- /dev/null
@@ -0,0 +1,306 @@
+<?php
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2007 Fabian Hickert
+
+   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
+*/
+
+
+require_once("class_setupStep.inc");
+
+
+class setup 
+{
+  var $i_steps  = 9;  // Number of setup steps 
+  var $i_current= 1;  // Current step
+  var $i_last   = 1;  // Last setup step;
+  var $o_steps  = array(); 
+  var $captured_values = array();
+
+  function setup()
+  {
+    $i = 1; 
+    $this->o_steps[$i++] = new Step_Welcome();
+    $this->o_steps[$i++] = new Step_Language();
+    $this->o_steps[$i++] = new Step_Checks();
+    $this->o_steps[$i++] = new Step_License();
+    $this->o_steps[$i++] = new Step_Ldap();
+    $this->o_steps[$i++] = new Step_Schema();
+    $this->o_steps[$i++] = new Step_Config1();
+    $this->o_steps[$i++] = new Step_Config2();
+    $this->o_steps[$i++] = new Step_Config3();
+    $this->o_steps[$i++] = new Step_Migrate();
+    $this->o_steps[$i++] = new Step_Feedback();
+    $this->o_steps[$i++] = new Step_Finish();
+    $this->i_steps = $i-1;
+
+    /* Ensure that setup is not reachable if gosa.conf (CONFIG_FILE) */
+    if(file_exists(CONFIG_DIR."/".CONFIG_FILE)){
+      session_destroy();
+      header("Location: index.php")    ;
+      exit();
+    }
+    
+    foreach($this->o_steps as $key => $step){
+      $this->o_steps[$key]->parent = &$this;
+    }
+  }
+
+  function execute()
+  {
+    /* Display phpinfo() dialog when $_GET['info'] is set,
+     *  but only do this, if user is allowed to use the setup.
+     * If setupStep_Welcome is_completed, we are allowed to view those infos-
+     */
+    if(isset($_GET['info']) &&  preg_match("/Step_Welcome/i",get_class($this->o_steps[1])) && $this->o_steps[1]->is_completed()){
+      phpinfo();
+      exit();
+    }
+
+    /* display step error msgs */
+    $msgs = $this->o_steps[$this->i_current]->check();
+    foreach($msgs as $msg){
+      print_red($msg);
+    }
+
+    $this->o_steps[$this->i_last]->set_active(FALSE);
+    $this->o_steps[$this->i_current]->set_active();
+    $content = $this->o_steps[$this->i_current]->execute();
+    return($content);
+  }
+
+
+  /* Save posted attributes  */
+  function save_object()
+  {
+    /* Call save_object for current setup step */
+    $this->o_steps[$this->i_current] -> save_object();
+
+    /* Get attributes from setup step */
+    $tmp = $this->o_steps[$this->i_current]->get_attributes();
+    foreach($tmp as $name => $value){
+      $this->captured_values[$name] = $value;
+    }
+
+    /* Set parent */
+    foreach($this->o_steps as $key => $value){
+      $this->o_steps[$key]->parent = $this;
+    }
+
+    /* Check if image button requests next page */
+    foreach($_POST as $name => $value){
+      if(preg_match("/^next_(x|y)/",$name)){
+        $_POST['next'] = TRUE;
+      }
+      if(preg_match("/^last_(x|y)/",$name)){
+        $_POST['last'] = TRUE;
+      }
+    }
+
+    /* Check if step was selected */
+    if(isset($_GET['step']) || isset($_POST['next']) || isset($_POST['last'])){
+
+      /* check if current setup step is completed now 
+          and activate the next step if possible */
+      for($i = 1 ; $i <= $this->i_steps ; $i ++ ){
+        if($this->o_steps[$i]->is_completed()){
+          if(isset($this->o_steps[($i+1)])){
+            $this->o_steps[($i+1)]->set_enabled();
+          }
+        }else{
+          $this->disable_steps_from($i+1);
+        }
+      }
+    }
+    /* Disable all following steps, if one step isn't compelted right now .*/
+    for($i = 1 ; $i <= $this->i_steps ; $i ++ ){
+      if($this->o_steps[$i]->is_completed()){
+      }else{
+        $this->disable_steps_from($i+1);
+      }
+    }
+    $step = -1;
+
+    if(isset($_POST['setup_goto_step'])){
+      $step= $_POST['setup_goto_step'];
+    }
+
+    if(isset($_GET['step'])){
+      $step = $_GET['step'];
+    }elseif(isset($_POST['next'])){
+      $step = $this->i_current + 1;
+    }elseif(isset($_POST['last'])){
+      $step = $this->i_current - 1;
+    }
+  
+    $once = true;
+    foreach($_POST as $name => $value){
+      if(preg_match("/^step_[0-9]*$/",$name) && $once ){
+        $step = preg_replace("/^step_/","",$name);
+      }
+    }
+
+    if($this->selectable_step($step)){
+      $this->i_last    = $this->i_current;
+      $this->i_current = $step;
+    }
+  }
+
+
+  function disable_steps_from($start)
+  {
+    $found = false;
+    foreach($this->o_steps as $key => $step){
+      if($key == $start){
+        $found = true;
+      }
+
+      if($found){ 
+        $this->o_steps[$key]->set_enabled(false);
+        $this->o_steps[$key]->set_completed(false);
+      }
+    }
+  }
+
+
+  /* Create navigation menu */
+  function get_navigation_html()
+  {
+    $str = "";
+    foreach($this->o_steps as $key => $step){
+
+      $step -> update_strings();
+
+      $s_title    = $step -> get_title();
+      $s_info     = $step -> get_small_info();
+      $b_active   = $step -> is_active();
+      $b_enabled  = $step -> is_enabled();
+      $b_completed= $step -> is_completed();
+
+      if($b_completed){
+        $s = "<img src='images/true.png' alt='"._("Completed")."' class='center'>&nbsp;"; 
+      }else{
+        $s = "<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
+      }
+
+      if($_SESSION['js']){
+
+        $str .="<div >";
+    
+        if($b_enabled){
+          if($b_active){
+            $str .= "<div class='navigation_element_active'>";
+            $str .= "<div class='navigation_title_active'>".$s.$s_title."</div>";
+            $str .= "<div class='navigation_info'>".$s_info."</div>";
+            $str .= "</div>";
+          }else{
+            $str .= "<div class='navigation_element'>";
+            $str .= "<div onClick='document.mainform.setup_goto_step.value=\"$key\";document.mainform.submit();'
+              class='navigation_title_inactive'>".$s.$s_title."</div>";
+            $str .= "</div>";
+          }
+        }else{
+          $str .= "<div class='navigation_element'>";
+          $str .= "<div class='navigation_title_disabled'>".$s.$s_title."</div>";
+          $str .= "</div>";
+        }
+        $str .= "</div>" ;
+      }else{
+        $str .="<div >";
+        if($b_enabled){
+          if($b_active){
+            $str .= "<div class='navigation_element_active'>";
+            $str .= "<input style='text-align: left; color: #00008F; font-weight: bold; width:100%;' 
+                        type='button' value='".$s_title."' name='step_".$key."'>";
+            $str .= "</div>";
+          }else{
+            $str .= "<div class='navigation_element'>";
+            $str .= "<input style='text-align: left; color: #00008F; font-weight: bold; width:100%;' 
+                        type='submit' value='".$s_title."' name='step_".$key."'>";
+            $str .= "</div>";
+          }
+        }else{
+          $str .= "<div class='navigation_element'>";
+          $str .= "<div class='navigation_title_disabled'>".$s_title."</div>";
+          $str .= "</div>";
+        }
+        $str .= "</div>" ;
+      }
+    }
+    return($str);
+  }
+
+  
+
+  function get_bottom_html()
+  {
+    /* Skip adding forward/backward button,   
+     *  if the currently opened step is a sub dialog 
+     */
+    if($this->o_steps[$this->i_current]->dialog){
+      $str ="";
+    }else{
+      $str ="<p class='seperator' style='margin-bottom:10px;'>&nbsp;</p>";
+      $str.="   <div style='text-align:right;float:top;'>";
+      if(isset($this->o_steps[$this->i_current -1]) && $this->o_steps[$this->i_current -1]->is_enabled()){
+        $str .= "<input type='submit' name='last' value='"._("Back")."'>";
+      }else{
+        $str .= "<input type='button' name='last' value='"._("Back")."' disabled>";
+      }
+      $str.= "&nbsp;";
+        $str .= "<input type='submit' name='next' value='"._("Continue")."'>";
+      $str .="</div>";
+    }
+    return($str);
+  }
+
+  
+  /* Create header entry */
+  function get_header_html()
+  {
+    $str=   $this->o_steps[$this->i_current]->print_header();
+    return ($str);
+  }
+
+
+  /* Check if the given step id is valid and selectable */
+  function selectable_step($id)
+  {
+    if(isset($this->o_steps[$id]) && $this->o_steps[$id]->is_enabled()){
+      return(true);
+    }
+    return(false);
+  }
+
+  function step_name_to_id($name)
+  {
+    foreach($this->o_steps as $id => $class){
+      if(get_class($class) == $name){
+        return($id);
+      }
+    }
+    return(0);
+  }
+  
+}
+
+
+
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/setup/class_setupStep.inc b/gosa-core/setup/class_setupStep.inc
new file mode 100644 (file)
index 0000000..5364187
--- /dev/null
@@ -0,0 +1,130 @@
+<?php
+
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2007 Fabian Hickert
+
+   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 setup_step extends plugin
+{
+  var $s_title      = "Still undefined";
+  var $s_title_long = "This is a still undefined long title";
+  var $s_info       = "This info is still undefined. This setup step detect the type of your ldap. This is a basic requirement for gosa.";
+  var $is_active    = false;
+  var $is_enabled   = false;
+  var $is_completed = false;
+
+  var $header_image = "images/personal.png";
+
+  var $attributes   = array();
+  var $parent       = NULL;
+  var $dialog       = FALSE;
+  
+  function setup_step()
+  {
+  }
+
+  function execute()
+  { 
+  }
+
+  function save_object()
+  {
+    /* Do not call plugin::save_object. This causes acl trouble  */
+  }
+
+  function get_title()
+  { 
+    return($this->s_title);
+  }
+
+  function get_long_title()
+  { 
+    return($this->s_title_long);
+  }
+
+  function get_small_info()
+  { 
+    return($this->s_info);
+  }
+  
+  function is_active()
+  {
+    return($this->is_active);
+  }
+
+  function is_enabled()
+  {
+    return($this->is_enabled);
+  }
+
+  function is_completed()
+  {
+    return($this->is_completed);
+  }
+
+  function set_active($value = TRUE)
+  {
+    if($value){ 
+      $this->is_active = TRUE;  
+    }else{
+      $this->is_active = FALSE;  
+    }
+  }
+
+  function set_enabled($value = TRUE)
+  {
+    if($value){ 
+      $this->is_enabled = TRUE;  
+    }else{
+      $this->is_enabled = FALSE;  
+    }
+  }
+
+  function set_completed($value = TRUE)
+  {
+    if($value){ 
+      $this->is_completed = TRUE;  
+    }else{
+      $this->is_completed = FALSE;  
+    }
+  }
+
+  /* Return attributes handled by this setup step */
+  function get_attributes()
+  {
+    $tmp = array();
+    foreach($this->attributes as $attr){
+      $tmp[$attr] = $this->$attr;
+    }
+    return($tmp);
+  }
+
+  function print_header()
+  {
+    $image= get_template_path($this->header_image);
+    $display= "<div style='padding:3px;'>";
+    $display.= "  <p class=\"center\" style=\"margin:0px 0px 0px 5px;padding:0px;font-size:24px;font-weight:bold;\"><img class=\"center\" src=\"$image\" align=\"middle\" alt=\"*\">&nbsp;".$this->s_title_long."</p>\n";
+    $display.= "</div>\n";
+
+    return($display);
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/setup/class_setupStep_Checks.inc b/gosa-core/setup/class_setupStep_Checks.inc
new file mode 100644 (file)
index 0000000..99e34dd
--- /dev/null
@@ -0,0 +1,312 @@
+<?php
+
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2007 Fabian Hickert
+
+   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 Step_Checks extends setup_step
+{
+  var $basic_checks = array();
+  var $config_checks= array();
+  var $is_writeable = array();
+  var $header_image = "images/system.png";
+
+  function Step_Checks()
+  {
+    $this->update_strings();
+  }
+
+  function update_strings()
+  {
+    $this->s_title      = _("Installation check");
+    $this->s_title_long = _("Installation check");
+    $this->s_info       = _("Basic checks for PHP version and required extensions.");
+  }
+  
+  
+  /* Execute and display template */ 
+  function execute()
+  {
+    $this->run_checks();
+    $smarty = get_smarty();
+    $smarty->assign("basic"       ,$this->basic_checks);
+    $smarty->assign("config"      ,$this->config_checks);
+    $smarty->assign("is_writeable",$this->is_writeable);
+    return($smarty->fetch(get_template_path("setup_checks.tpl",TRUE,dirname(__FILE__))));
+  }
+
+
+  /* Execute all checks */ 
+  function run_checks()
+  {
+    $this->basic_checks = array();
+    $this->config_checks = array();
+    $this->is_writeable = array();
+    /* PHP version check */
+    $N = _("Checking PHP version"); 
+    $D = sprintf(_("PHP must be of version %s or above."), "5.2.0");
+    $S = _("GOsa requires functionality that is not available (or buggy) in older PHP versions. Please update to a supported version.");
+    $R = $this->check_php_version();
+    $M = TRUE;
+    $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
+    /* Checking imap extension */
+    $N = _("Checking for LDAP support");
+    $D = _("This is the main extension used by GOsa and therefore really required.");
+    $S = _("The ldap extension (php5-ldap) is required to communicate with your LDAP server.");
+    $R = is_callable("ldap_bind");
+    $M = TRUE;
+    $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
+    /* Check for gettext support */
+    $N = _("Checking for gettext support");
+    $D = _("Gettext support is required for internationalization.");
+    $S = _("Please make sure that the extension is activated.");
+    $R = is_callable("bindtextdomain");
+    $M = TRUE;
+    $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
+    /* Checing for iconv */
+    $N = _("Checking for iconv support");
+    $D = _("This module is used by GOsa to convert samba munged dial informations and is therefore required. ");
+    $S = _("Please make sure that the extension is activated.");
+    $R = is_callable("iconv");
+    $M = TRUE;
+    $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
+    /* Check for installed mhash module */
+    $N = _("Checking for mhash support");
+    $D = _("You'll need this module to make use of SSHA encryption");
+    $S = _("The mhash module for PHP 5 is not available.Please install php5-mhash.");
+    $R = is_callable("mhash");
+    $M = FALSE;
+    $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
+    /* Is imap module available */
+    $N = _("Checking for IMAP support");
+    $D = _("The IMAP module is needed to communicate with the IMAP server. GOsa retrieves status information, creates and deletes mail users, etc.");
+    $S = _("This module is used to communicate with your mail server. Please install php5-imap.");
+    $R = is_callable("imap_open");
+    $M = TRUE;
+    $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
+    /* Check getacl in imap module */
+    $N = _("Checking for getacl in IMAP implementation");
+    $D = _("The getacl support is needed to handle shared folder permissions. Old IMAP extensions are not capable of reading acl's. You need a recent PHP version to use this feature.");
+    $S = $D;
+    $R = is_callable("imap_getacl");
+    $M = TRUE;
+    $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
+    /* Mysql module loaded ? */
+    $N = _("Checking for MySQL support");
+    $D = _("MySQL support is needed to communicate with several supported databases.");
+    $S = _("This module is required to communicate with database servers (GOfax, asterisk, GLPI, etc.). Please install php5-mysql");
+    $R = is_callable("mysql_query");
+    $M = TRUE;
+    $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
+    /* Checking for kadm5 module */
+    $N = _("Checking for kadm5 support");
+    $D = _("Managing users in kerberos requires the kadm5 module which is downloadable via PEAR network.");
+    $S = _("This module is required to manage user in kerberos, it is downloadable via PEAR network");
+    $R = is_callable("kadm5_init_with_password");
+    $M = FALSE;
+    $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
+    /* Snmp module available ? */
+    $N = _("Checking for SNMP support");
+    $D = _("The simple network management protocol is needed to get status information from clients.");
+    $S = _("This module is required for client monitoring. Please install php5-snmp.");
+    $R = is_callable("snmpget");
+    $M = FALSE;
+    $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
+    /* Checking for Cups module */
+    $N = _("Checking for CUPS support");
+    $D = _("In order to read available printers via the IPP protocol instead of printcap files, you've to install the CUPS module.");
+    $S = $D; 
+    $R = is_callable("cups_get_dest_list");
+    $M = FALSE;
+    $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
+    /* Checking for F ping utility */
+    $query= "LC_ALL=C LANG=C fping -v 2>&1";
+    $output= shell_exec ($query);
+    $N = _("Checking for fping utility");
+    $D = _("The fping utility is used if you've got a thin client based terminal environment.");
+    $S = _("The fping utility is only used in thin client based terminal environment.");
+    $R = preg_match("/^fping:/", $output);
+    $M = FALSE;
+    $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
+    /* Checking generate LM/NT password hashes */
+    $query= "mkntpwd 2>&1";
+    $output= shell_exec ($query);
+    $have_mkntpwd= preg_match("/^Usage: mkntpwd /", $output);
+    if (!$have_mkntpwd){
+      $query= 'LC_ALL=C LANG=C perl -MCrypt::SmbHash -e "print join(q[:], ntlmgen $ARGV[0]), $/;" &>/dev/null';
+      system ($query, $ret);
+      $have_mkntpwd |= ($ret == 0);
+    }
+
+    $N = _("SAMBA password hash generation");
+    $D = _("In order to use SAMBA 2/3 passwords, you've to install additional packages to generate password hashes.");
+    $S = _("In order to use SAMBA 2/3 you've to install additional perl libraries. Take a look at mkntpasswd.");
+    $R = $have_mkntpwd;
+    $M = TRUE;
+    $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
+
+    /* PHP Configuration checks 
+     */
+
+    /* Register_globals off */
+    $N = "register_globals = <b>"._("Off")."</b>";
+    $D = _("register_globals is a PHP mechanism to register all global variables to be accessible from scripts without changing the scope. This may be a security risk.");
+    $S = _("Search for 'register_globals' in your php.ini and switch it to 'Off'.");
+    $R = ini_get("register_globals") == 0;
+    $M = FALSE;
+    $this->config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
+
+    /* session lifetime set to >=86400 seconds ? */
+    $N = "session.gc_maxlifetime &gt;= <b>86400</b>";
+    $D = _("PHP uses this value for the garbage collector to delete old sessions.")." ".
+         _("Setting this value to one day will prevent loosing session and cookies before they really timeout.");
+    $S = _("Search for 'session.gc_maxlifetime' in your php.ini and set it to 86400 or higher.");
+    $R = ini_get("session.gc_maxlifetime") >= 86400;
+    $M = FALSE;
+    $this->config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
+    /* Session auto start must be turned off */
+    $session_auto_start = ini_get('session.auto_start');
+    $N = "session.auto_start = <b>"._("Off")."</b>";
+    $D = _("In Order to use GOsa without any trouble, the session.auto_register option in your php.ini should be set to 'Off'.");
+    $S = _("Search for 'session.auto_start' in your php.ini and set it to 'Off'.");
+    $R = !$session_auto_start['local_value'];
+    $M = TRUE;
+    $this->config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
+    /* Check if memory limit is set to 32 or > */
+    $N = "memory_limit &gt;= <b>32</b>";
+    $D = _("GOsa needs at least 32MB of memory. Setting it below this limit may cause errors that are not reproducable! Increase it for larger setups.");
+    $S = _("Search for 'memory_limit' in your php.ini and set it to '32M' or higher.");
+    $R = ini_get('memory_limit') >= 32 ;
+    $M = TRUE;
+    $this->config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
+    /* Implicit Flush disabled can increase performance */
+    $N = "implicit_flush = <b>"._("Off")."</b>";
+    $D = _("This option influences the PHP output handling. Turn this Option off, to increase performance.");
+    $S = _("Search for 'implicit_flush' in your php.ini and set it to 'Off'."); 
+    $R = !ini_get('implicit_flush');
+    $M = FALSE;
+    $this->config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
+    /* Check if execution time is set to 30 */
+    $N = "max_execution_time &gt;= <b>30</b>";
+    $D = _("The Execution time should be at least 30 seconds.");
+    $S = _("Search for 'max_execution_time' in your php.ini and set it to '30' or higher.");
+    $R = ini_get("max_execution_time") >= 30 ;
+    $M = TRUE;
+    $this->config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
+    /* Expose php should be set to off */
+    $N = "expose_php = <b>"._("Off")."</b>";
+    $D = _("Increase the server security by setting expose_php to 'off'. PHP won't send any information about the server you are running in this case.");
+    $S = _("Search for 'expose_php' in your php.ini and set if to 'Off'.");
+    $R = !ini_get("expose_php");
+    $M = FALSE;
+    $this->config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
+    /* Automatic quoting must be turned on */
+    $N = "magic_quotes_gpc = <b>"._("On")."</b>";
+    $D = _("Increase your server security by setting magic_quotes_gpc to 'on'. PHP will escape all quotes in strings in this case."); 
+    $S = _("Search for 'magic_quotes_gpc' in your php.ini and set it to 'On'."); 
+    $R = ini_get('magic_quotes_gpc'); 
+    $M = TRUE;
+    $this->config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
+    /* Emulating old stuff? */
+    $N = "zend.ze1_compatibility_mode = <b>"._("Off")."</b>";
+    $D = _("Increase your server performance by setting magic_quotes_gpc to 'off'."); 
+    $S = _("Search for 'zend.ze1_compatibility_mode' in your php.ini and set it to 'Off'."); 
+    $R = !ini_get('zend.ze1_compatibility_mode'); 
+    $M = FALSE;
+    $this->config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
+
+    /* Configuration file  
+     */
+
+    /* Check if we can create a config file.*/
+    $N = _("Configuration writeable");
+    $D = _("The configuration file can't be written");
+    $S = sprintf(_("GOsa reads its configuration from a file located in (%s/%s). The setup can write the configuration directly if it is writeable."),CONFIG_DIR,CONFIG_FILE); 
+    $R =    ( file_exists(CONFIG_DIR."/".CONFIG_FILE) && is_writeable(CONFIG_DIR."/".CONFIG_FILE)) // is there a config file ? 
+        ||  (!file_exists(CONFIG_DIR."/".CONFIG_FILE) && is_writeable(CONFIG_DIR));  // There is non, but can we create a file there ?
+    $M = FALSE;
+    $this->is_writeable[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
+    /* If we have writeaccess to the config dir, check if there is already a config file */
+#    if($R){
+#
+#      /* check if there is already a config file. */
+#      $N = _("No old configuration file.");
+#      $D = "";//_("");
+#      $S = _("If there is already a configuration file, this file will be overwritten when GOsa setup finishes. Please move your old config file away.");
+#      $R =  !file_exists(CONFIG_DIR."/".CONFIG_FILE);
+#      $M = FALSE;
+#      $this->is_writeable[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+#    }
+  }
+
+  function save_object()
+  {
+     /* If everything is fine, set this step to completed
+     *  and allow switching to next setup step
+     */
+    $failed = false;
+    foreach(array("basic_checks","config_checks","is_writeable") as $type){
+      foreach($this->$type as $obj){
+
+        if($obj['MUST'] && !$obj['RESULT']){
+          $failed = true;
+          break;
+        }
+      }
+    }
+    $this->is_completed = !$failed;
+  }
+
+  /* Check if current PHP version is compatible 
+      with the current version of GOsa */
+  function check_php_version()
+  {
+    return(version_compare(phpversion(),"5.2.0",">=")); 
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/setup/class_setupStep_Config1.inc b/gosa-core/setup/class_setupStep_Config1.inc
new file mode 100644 (file)
index 0000000..1087b6a
--- /dev/null
@@ -0,0 +1,245 @@
+<?php
+
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2007 Fabian Hickert
+
+   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 Step_Config1 extends setup_step
+{
+
+  var $peopleou   = "ou=people";
+  var $groupou    =  "ou=groups";
+  var $peopledn   = "cn";
+  var $uidbase    = 1000;
+  var $krbsasl    = FALSE;
+  var $strict     = TRUE;
+  var $compressed = TRUE;
+
+  var $header_image = "images/ldapserver.png";
+  var $account_expiration  =FALSE;
+  var $base_hook         = ""; 
+  var $base_hook_active  = FALSE; 
+
+  var $encryption = "crypt";
+  var $theme      = "default"; 
+
+  var $include_personal_title = FALSE;
+
+  var $pwd_rules  = array("pwminlen" => 6, 
+                          "pwminlen_active" => FALSE,
+                          "pwdiffer" => 5,
+                          "pwdiffer_active" => FALSE,
+                          "externalpwdhook" => "",
+                          "externalpwdhook_active" => FALSE);
+
+  var $id_settings = array(       "idgen"         => "{%sn}-{%givenName[2-4]}",
+                                  "idgen_active"  => FALSE,
+                                  "minid"         => "100",
+                                  "minid_active"  => FALSE);
+
+  var $crypt_methods  = array();
+
+  var $attributes = array("compressed","peopleou","groupou","peopledn","uidbase","encryption","theme","krbsasl",
+                          "base_hook","base_hook_active","account_expiration","strict","include_personal_title");
+
+  function Step_Config1()
+  {
+    $this->update_strings();
+
+    $tmp = @passwordMethod::get_available_methods();
+    foreach($tmp['name'] as $name){
+      $this->crypt_methods[$name] = $name;
+    }
+  }
+
+
+  function update_strings()
+  {
+    $this->s_title      = _("GOsa settings 1/3");
+    $this->s_title_long = _("GOsa settings 1/3");
+    $this->s_info       = _("GOsa generic settings");
+  }
+
+  
+  function execute()
+  {
+    $smarty = get_smarty();
+    $smarty->assign("peopledns",array("uid","cn"));
+    $smarty->assign("id_settings",$this->id_settings);
+    $smarty->assign("crypt_methods",$this->crypt_methods);
+    $smarty->assign("themes",$this->get_themes());
+    $smarty->assign("pwd_rules",$this->pwd_rules);
+    $smarty->assign("bool",array(FALSE => _("No"), TRUE => _("Yes")));
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr,$this->$attr);
+    }
+
+    /* !!! Attention strict is inverse. If you change this, 
+     *  don't forget to change save_object too 
+     */
+    $smarty->assign("strict",!$this->strict);
+    return($smarty -> fetch (get_template_path("../setup/setup_config1.tpl")));
+  }
+
+
+  function get_themes()
+  {
+    $dir = opendir( "../ihtml/themes/");
+    $themes = array();
+    while (($file = readdir($dir)) !== false){
+      if(is_dir("../ihtml/themes/".$file) && !preg_match("/^\./",$file)){
+        $themes[$file] = $file;
+      }      
+    }
+    return($themes);
+  }
+
+  function check()
+  {
+    $message = array();
+
+    if(isset($this->id_settings['minid_active']) && !is_numeric($this->id_settings['minid'])){
+      $message[] = sprintf(_("The specified value for '%s' must be a numeric value"),_("GID / UID min id"));
+    }
+
+    if(preg_match("/,$/",$this->peopleou)){
+      $message[] =sprintf(_("Don't add a trailing comma to '%s'."),_("People storage ou"));
+    }
+
+    if(preg_match("/,$/",$this->groupou)){
+      $message[] =sprintf(_("Don't add a trailing comma to '%s'."),_("Group storage ou"));
+    }
+
+    if(!is_numeric($this->uidbase)){
+      $message[] = _("Uid base must be numeric");
+    }
+
+    if(($this->pwd_rules['pwminlen_active']) && !is_numeric($this->pwd_rules['pwminlen'])){
+      $message[] = _("The given password minimum length is not numeric.");
+    }
+    if(($this->pwd_rules['pwdiffer_active']) && !is_numeric($this->pwd_rules['pwdiffer'])){
+      $message[] = _("The given password differ value is not numeric.");
+    }
+    return($message);
+  }
+
+  function save_object()
+  {
+    if(isset($_POST['step5_posted'])){
+
+      /* Get attributes */
+      foreach($this->attributes as $attr){
+        if(isset($_POST[$attr])){
+          $this->$attr = validate(get_post($attr));
+        }
+      }
+
+      /* !!! Attention strict is inverse. If you change this, 
+       *  don't forget to change the smarty assignment too 
+       */
+      if(isset($_POST['strict'])){
+        if($_POST['strict']){
+          $this->strict = FALSE;
+        }else{
+          $this->strict = TRUE;
+        }
+      }
+
+      if(isset($_POST['minid_active'])){
+        $this->id_settings['minid_active'] = TRUE;
+        if(isset($_POST['minid'])){
+          $this->id_settings['minid'] = get_post('minid');
+        }
+      }else{
+        $this->id_settings['minid_active'] = FALSE;
+      }
+
+      /* Generic settings */
+      if(isset($_POST['idgen_active'])){
+        $this->id_settings['idgen_active'] = TRUE;
+        if(isset($_POST['idgen'])){
+          $this->id_settings['idgen'] = get_post('idgen');
+        }
+      }else{
+        $this->id_settings['idgen_active'] = FALSE;
+      }
+
+      /* Get password settings */ 
+      if(isset($_POST['pwdiffer_active'])){
+        $this->pwd_rules['pwdiffer_active'] = TRUE;
+        if(isset($_POST['pwdiffer'])){
+          $this->pwd_rules['pwdiffer'] = get_post('pwdiffer');
+        }
+      }else{
+        $this->pwd_rules['pwdiffer_active'] = FALSE;
+      }
+
+      /* Get password minimum length posts */
+      if(isset($_POST['pwminlen_active'])){
+        $this->pwd_rules['pwminlen_active'] = TRUE;
+        if(isset($_POST['pwminlen'])){
+          $this->pwd_rules['pwminlen'] = get_post('pwminlen');
+        }
+      }else{
+        $this->pwd_rules['pwminlen_active'] = FALSE;
+      }
+
+      /* External pwd settings */
+      if(isset($_POST['externalpwdhook_active'])){
+        $this->pwd_rules['externalpwdhook_active'] = TRUE;
+        if(isset($_POST['externalpwdhook'])){
+          $this->pwd_rules['externalpwdhook'] = get_post('externalpwdhook');
+        }
+      }else{
+        $this->pwd_rules['externalpwdhook_active'] = FALSE;
+      }
+
+      /* base hook settings */
+      if(isset($_POST['base_hook_active'])){
+        $this->pwd_rules['base_hook_active'] = TRUE;
+        if(isset($_POST['base_hook'])){
+          $this->pwd_rules['base_hook'] = get_post('base_hook');
+        }
+      }else{
+        $this->pwd_rules['base_hook_active'] = FALSE;
+      }
+    }
+
+    $tmp = $this->check(); 
+    if(count($tmp) == 0){
+      $this->is_completed = TRUE;
+    }else{
+      $this->is_completed = FALSE;
+    }
+  }// if tempalte posted 
+
+
+  /* Attributes that are interesting for configuration generation */
+  function get_attributes()
+  {
+    $tmp = setup_step::get_attributes();
+    foreach(array("pwd_rules","id_settings") as $attr){
+      $tmp[$attr]= $this->$attr;
+    }
+    return($tmp);
+  }
+}// CLass
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/setup/class_setupStep_Config2.inc b/gosa-core/setup/class_setupStep_Config2.inc
new file mode 100644 (file)
index 0000000..e6b96b1
--- /dev/null
@@ -0,0 +1,312 @@
+<?php
+
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2007 Fabian Hickert
+
+   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 Step_Config2 extends setup_step
+{
+  var $governmentmode = FALSE;
+  var $sambaidmapping = FALSE;
+  var $header_image = "images/ldapserver.png";
+
+  var $cyrusunixstyle = FALSE;
+  var $mail       = "none";
+  var $mail_methods   = array();
+  var $mail_settings = array("vacationdir"        => "/etc/gosa/vacation",
+                             "vacationdir_active" => FALSE);
+
+  var $generic_settings  = array( "enableCopyPaste" => false,
+                                  "enableDNS"      => false,
+                                  "enableDHCP"      => false,
+                                  "wws_ou"        => "ou=winstations",
+                                  "wws_ou_active" => FALSE,
+                                  "snapshot_active"     => FALSE,
+                                  "snapshot_base"       => "ou=snapshots,%base%",
+                                  "snapshot_user"       => "%admin%",
+                                  "snapshot_password"   => "",
+                                  "snapshot_server"     => "%connection%");
+
+  var $samba_settings    = array( "samba_sid"        => "0-815-4711",
+                                  "samba_sid_active" => FALSE,
+                                  "samba_rid"        => 1000,
+                                  "smbhash"          => 'SMBHASH',
+                                  "samba_rid_active" => FALSE); 
+
+  var $sambaDomain_found    = FALSE;
+  var $use_netatalk         = FALSE;
+  var $enableFAI_management = FALSE;
+  var $enableMimeType       = FALSE;
+
+  var $timezone       = "Europe/Berlin";
+  var $timezones      = array();
+
+  var $attributes = array("governmentmode","sambaidmapping","cyrusunixstyle","mail","use_netatalk","enableFAI_management","timezone","enableMimeType");
+  var $called = FALSE;
+
+  function Step_Config2()
+  {
+    $this->update_strings();
+    $tmp = $this->get_available_mail_classes();
+    foreach($tmp['name'] as $name){
+      $this->mail_methods[$name] = $name;
+    }
+
+    /* Look for samba password generation method */
+    if(file_exists("/usr/bin/mkntpasswd")){
+      $pwdhash  = "/usr/bin/mkntpasswd";
+    } elseif (preg_match("/^Usage: mkntpwd /", shell_exec ("mkntpwd 2>&1"))){
+      $pwdhash= "mkntpwd";
+    } else {
+      $pwdhash= 'perl -MCrypt::SmbHash -e "print join(q[:], ntlmgen \$ARGV[0]), $/;"';
+    }
+
+    $this->timezones = _get_tz_zones();
+    $this->samba_settings['smbhash'] = $pwdhash;
+  }
+
+  function update_strings()
+  {
+    $this->s_title      = _("GOsa settings 2/3");
+    $this->s_title_long = _("GOsa settings 2/3");
+    $this->s_info       = _("Customize special parameters");
+  }
+
+  function execute()
+  {
+    /* On first call check for rid/sid base */
+    $cv = $this->parent->captured_values;
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+
+    $ldap->cd($cv['base']);
+    $ldap->search("(objectClass=sambaDomain)",array("dn"));
+    if($ldap->count()){
+      $this->sambaDomain_found =TRUE;
+    }else{
+      $this->sambaDomain_found =FALSE;
+    }
+
+    if(!$this->called){
+      if(!$this->sambaDomain_found){
+        $this->samba_settings['samba_sid_active'] = TRUE;
+        $this->samba_settings['samba_rid_active'] = TRUE;
+      }
+  
+      /* Check if we can enable netatalk plugin */
+      $tmp = $ldap->get_objectclasses();
+      if(is_array($tmp) && isset($tmp['apple-user'])) {
+        $this->use_netatalk = TRUE;
+      }
+
+      /* Check the FAI schema is used */
+      if(is_array($tmp) && isset($tmp['FAIclass'])){
+#        $this->enableFAI_management = TRUE;
+      }
+
+      /* Check the MimeType schema is used */
+      if(is_array($tmp) && isset($tmp['gotoMimeType'])){
+        $this->enableMimeType = TRUE;
+      }
+
+      if(is_array($tmp) && isset($tmp['dhcpClass'])){
+        $this->generic_settings['enableDHCP'] = TRUE;
+      }
+
+      if(is_array($tmp) && isset($tmp['dNSZone'])){
+        $this->generic_settings['enableDNS'] = TRUE;
+      }
+
+      $this->called = TRUE;
+    }
+
+    /* Update snapshot values, with already collected values */
+    foreach($this->generic_settings as $key => $value){
+      foreach(array("snapshot_base","snapshot_user","snapshot_server") as $attr){
+        foreach($this->parent->captured_values as $replace_name => $replace_value){
+          if(is_string($replace_value))  {
+            $this->generic_settings[$attr] = preg_replace("/%".$replace_name."%/",$replace_value,$this->generic_settings[$attr]);
+          }
+        }
+      }
+    }
+
+    $smarty = get_smarty();
+    $smarty->assign("sambaDomain_found",$this->sambaDomain_found);
+    $smarty->assign("generic_settings",$this->generic_settings);
+    $smarty->assign("mail_settings",$this->mail_settings);
+    $smarty->assign("mail_methods",$this->mail_methods);
+    $smarty->assign("samba_settings",$this->samba_settings);
+    $smarty->assign("bool",array(FALSE => _("No"), TRUE => _("Yes")));
+        foreach($this->attributes as $attr){
+      $smarty->assign($attr,$this->$attr);
+    }
+    $smarty->assign("timezone"     ,$this->timezone);
+    $smarty->assign("timezones"    ,$this->timezones);
+    return($smarty -> fetch (get_template_path("../setup/setup_config2.tpl")));
+  }
+
+  function save_object()
+  {
+    if(isset($_POST['step6_posted'])){
+
+      if(isset($_POST['timezone']) && isset($this->timezones['TIMEZONES'][$_POST['timezone']])){
+        $this->timezone = $_POST['timezone'];
+      }
+
+      /* Get attributes */
+      foreach($this->attributes as $attr){
+        if(isset($_POST[$attr])){
+          $this->$attr = validate(get_post($attr));
+        }
+      }
+
+      /* Mail settings */
+      if(isset($_POST['vacationdir_active'])){
+        $this->mail_settings['vacationdir_active'] = TRUE;
+        if(isset($_POST['vacationdir'])){
+          $this->mail_settings['vacationdir'] = get_post('vacationdir');
+        }
+      }else{
+        $this->mail_settings['vacationdir_active'] = FALSE;
+      }
+
+      if(isset($_POST['enableCopyPaste'])){
+        $this->generic_settings['enableCopyPaste'] = get_post('enableCopyPaste');
+      }
+      if(isset($_POST['enableDNS'])){
+        $this->generic_settings['enableDNS'] = get_post('enableDNS');
+      }
+      if(isset($_POST['enableDHCP'])){
+        $this->generic_settings['enableDHCP'] = get_post('enableDHCP');
+      }
+
+      if(isset($_POST['wws_ou_active'])){
+        $this->generic_settings['wws_ou_active'] = TRUE;
+        if(isset($_POST['wws_ou'])){
+          $this->generic_settings['wws_ou'] = get_post('wws_ou');
+        }
+      }else{
+        $this->generic_settings['wws_ou_active'] = FALSE;
+      }
+
+      if(isset($_POST['snapshot_active'])){
+        $this->generic_settings['snapshot_active'] = TRUE;
+        if(isset($_POST['snapshot_base'])){
+          $this->generic_settings['snapshot_base'] = get_post('snapshot_base');
+        }
+        if(isset($_POST['snapshot_user'])){
+          $this->generic_settings['snapshot_user'] = get_post('snapshot_user');
+        }
+        if(isset($_POST['snapshot_password'])){
+          $this->generic_settings['snapshot_password'] = get_post('snapshot_password');
+        }
+        if(isset($_POST['snapshot_server'])){
+          $this->generic_settings['snapshot_server'] = get_post('snapshot_server');
+        }
+      }else{
+        $this->generic_settings['snapshot_active'] = FALSE;
+      }
+
+      /* Samba settings */
+      if(isset($_POST['samba_sid_active'])){
+        $this->samba_settings['samba_sid_active'] = TRUE;
+        if(isset($_POST['samba_sid'])){
+          $this->samba_settings['samba_sid'] = get_post('samba_sid');
+        }
+      }else{
+        $this->samba_settings['samba_sid_active'] = FALSE;
+      }
+      if(isset($_POST['samba_rid_active'])){
+        $this->samba_settings['samba_rid_active'] = TRUE;
+        if(isset($_POST['samba_rid'])){
+          $this->samba_settings['samba_rid'] = get_post('samba_rid');
+        }
+      }else{
+        $this->samba_settings['samba_rid_active'] = FALSE;
+      }
+      if(isset($_POST['smbhash'])){
+        $this->samba_settings['smbhash'] = get_post('smbhash');
+      }
+
+      if(!$this->sambaDomain_found){
+        $this->samba_settings['samba_sid_active'] = TRUE;
+        $this->samba_settings['samba_rid_active'] = TRUE;
+      }
+    }
+
+    $tmp = $this->check();
+    if(count($tmp) == 0){
+      $this->is_completed = TRUE;
+    }else{
+      $this->is_completed = FALSE;
+    }
+  }
+
+
+  function check()
+  {
+    $message = array();
+    return($message);
+  }
+  
+
+  /* Attributes that are interesting for configuration generation */
+  function get_attributes()
+  {
+    $tmp = setup_step::get_attributes();
+    foreach(array("samba_settings","generic_settings","mail_settings") as $attr){
+      $tmp[$attr]= $this->$attr;
+    }
+    return($tmp);
+  }
+
+/* Returns the classnames auf the mail classes */
+  function get_available_mail_classes()
+  {
+    $dir = opendir( "../include");
+    $methods = array();
+    $suffix = "class_mail-methods-";
+    $lensuf = strlen($suffix);
+    $prefix = ".inc";
+    $lenpre = strlen($prefix);
+    $i = 0;
+    while (($file = readdir($dir)) !== false){
+
+      if(stristr($file,$suffix)) {
+        $lenfile = strlen($file);
+        $methods['name'][$i] = substr($file,$lensuf,($lenfile-$lensuf)-$lenpre);
+        $methods['file'][$i] = $file;
+        $methods[$i]['file'] = $file;
+        $methods[$i]['name'] = substr($file,$lensuf,($lenfile-$lensuf)-$lenpre);
+        $i++;
+      }
+    }
+    return($methods);
+  }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/setup/class_setupStep_Config3.inc b/gosa-core/setup/class_setupStep_Config3.inc
new file mode 100644 (file)
index 0000000..eaa5368
--- /dev/null
@@ -0,0 +1,229 @@
+<?php
+
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2007 Fabian Hickert
+
+   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 Step_Config3 extends setup_step
+{
+  var $header_image= "images/ldapserver.png";
+
+  var $errorlvl   = TRUE;
+
+  var $login_attributes = array("uid"       => "uid", 
+                                "mail"      => "mail",
+                                "uid,mail"  => "both");
+  var $optional = array(
+              "login_attribute" => "uid",
+              "strict_units" => false,
+              "list_summary" => false,
+              "forceglobals" => true,
+              "forcessl" => false,
+              "ldapstats" => false,
+              "warnssl" => true,
+              "user_filter_cookie" => true,
+              "ppd_path" => "/var/spool/ppd/",
+              "ppd_path_active" => FALSE,
+              "compile" =>  "/var/spool/gosa",
+              "snmpcommunity" =>  "goto",
+              "debuglevel" => 0,
+              "session_lifetime" => 7200,
+              "max_ldap_query_time" => "5.0",
+              "max_ldap_query_time_active" => FALSE,
+
+              "mailQueueScriptPath" => "/usr/bin/sudo /usr/local/sbin/mailqueue %action %id %server",
+              "mailQueueScriptPath_active" => FALSE,
+
+              "auto_network_hook" => "/usr/bin/net-resolver.sh",
+              "auto_network_hook_active" => FALSE,
+
+              "notifydir" => "",
+              "notifydir_active" => FALSE,
+
+              "uniq_identifier" => "entryCSN",
+              "uniq_identifier_active" => TRUE,
+
+              "kioskpath" => "/var/spool/kiosk",
+              "kioskpath_active" => FALSE,
+
+              "gotomasses_file"   => "/etc/gosa/gotomasses",
+              "gotomasses_active" => FALSE,
+
+              "noprimarygroup"  => FALSE);
+
+  var $attributes = array("errorlvl");
+
+  function Step_Config3()
+  {
+    $this->update_strings();
+  }
+
+
+  function update_strings()
+  {
+    $this->s_title      = _("GOsa settings 3/3");
+    $this->s_title_long = _("GOsa settings 3/3");
+    $this->s_info       = _("Tweak some GOsa core behaviour");
+  }
+  
+
+  function execute()
+  {
+    $smarty = get_smarty();
+    $smarty->assign("bool",array(FALSE => _("No"), TRUE => _("Yes")));
+    $smarty->assign("uniq_identifiers",array( "entryCNS" => "entryCSN",
+                                              "contextCSN"=>"contextCSN" ));
+    $smarty->assign("optional", $this->optional);
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr,$this->$attr);
+    }
+    $smarty->assign("login_attributes",$this->login_attributes);
+    return($smarty -> fetch (get_template_path("../setup/setup_config3.tpl")));
+  }
+
+
+  function save_object()
+  {
+    if(isset($_POST['step6a_posted'])){
+
+      /* Get attributes */
+      foreach($this->attributes as $attr){
+        if(isset($_POST[$attr])){
+          $this->$attr = validate(get_post($attr));
+        }
+      }
+      
+      foreach(array("login_attribute","list_summary","strict_units","snmpcommunity","noprimarygroup","forceglobals","forcessl","ldapstats","user_filter_cookie","warnssl","compile","debuglevel","session_lifetime") as $name){
+        if(isset($_POST[$name])){
+          $this->optional[$name] = get_post($name);
+        }
+      } 
+
+      if(isset($_POST['ppd_path_active'])){
+        $this->optional['ppd_path_active'] = TRUE;
+        if(isset($_POST['ppd_path'])){
+          $this->optional['ppd_path'] = get_post('ppd_path');
+        }
+      }else{
+        $this->optional['ppd_path_active'] = FALSE;
+      }
+
+      if(isset($_POST['max_ldap_query_time_active'])){
+        $this->optional['max_ldap_query_time_active'] = TRUE;
+        if(isset($_POST['max_ldap_query_time'])){
+          $this->optional['max_ldap_query_time'] = get_post('max_ldap_query_time');
+        }
+      }else{
+        $this->optional['max_ldap_query_time_active'] = FALSE;
+      }
+
+      if(isset($_POST['mailQueueScriptPath_active'])){
+        $this->optional['mailQueueScriptPath_active'] = TRUE;
+        if(isset($_POST['mailQueueScriptPath'])){
+          $this->optional['mailQueueScriptPath'] = get_post('mailQueueScriptPath');
+        }
+      }else{
+        $this->optional['mailQueueScriptPath_active'] = FALSE;
+      }
+
+      if(isset($_POST['kioskpath_active'])){
+        $this->optional['kioskpath_active'] = TRUE;
+        if(isset($_POST['kioskpath'])){
+          $this->optional['kioskpath'] = get_post('kioskpath');
+        }
+      }else{
+        $this->optional['kioskpath_active'] = FALSE;
+      }
+
+      if(isset($_POST['gotomasses_active'])){
+        $this->optional['gotomasses_active'] = TRUE;
+        if(isset($_POST['gotomasses_file'])){
+          $this->optional['gotomasses_file'] = get_post('gotomasses_file');
+        }
+      }else{
+        $this->optional['gotomasses_active'] = FALSE;
+      }
+
+      if(isset($_POST['auto_network_hook_active'])){
+        $this->optional['auto_network_hook_active'] = TRUE;
+        if(isset($_POST['auto_network_hook'])){
+          $this->optional['auto_network_hook'] = get_post('auto_network_hook');
+        }
+      }else{
+        $this->optional['auto_network_hook_active'] = FALSE;
+      }
+
+      if(isset($_POST['notifydir_active'])){
+        $this->optional['notifydir_active'] = TRUE;
+        if(isset($_POST['notifydir'])){
+          $this->optional['notifydir'] = get_post('notifydir');
+        }
+      }else{
+        $this->optional['notifydir_active'] = FALSE;
+      }
+
+      if(isset($_POST['uniq_identifier_active'])){
+        $this->optional['uniq_identifier_active'] = TRUE;
+        if(isset($_POST['uniq_identifier'])){
+          $this->optional['uniq_identifier'] = get_post('uniq_identifier');
+        }
+      }else{
+        $this->optional['uniq_identifier_active'] = FALSE;
+      }
+    }
+
+    $tmp = $this->check();
+    if(count($tmp) == 0){
+      $this->is_completed = TRUE;
+    }else{
+      $this->is_completed = FALSE;
+    }
+  }
+
+
+  function check()
+  {
+    $message = array();
+
+    if(!is_numeric( $this->optional['session_lifetime'])){
+      $message[] = _("Session lifetime must be a numeric value.");
+    }
+
+    if(!is_numeric( $this->optional['max_ldap_query_time'])){
+      $message[] = _("Maximal ldap query time must be a numeric value. ");
+    }
+  
+    return($message);
+  }
+  
+
+  /* Attributes that are interesting for configuration generation */
+  function get_attributes()
+  {
+    $tmp = setup_step::get_attributes();
+    foreach(array("optional") as $attr){
+      $tmp[$attr]= $this->$attr;
+    }
+    return($tmp);
+  }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/setup/class_setupStep_Feedback.inc b/gosa-core/setup/class_setupStep_Feedback.inc
new file mode 100644 (file)
index 0000000..fbcfb4c
--- /dev/null
@@ -0,0 +1,274 @@
+<?php
+
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2007 Fabian Hickert
+
+   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 Step_Feedback  extends setup_step
+{
+  var $languages      = array();
+  var $header_image   = "images/welcome.png";
+
+  var $organization       = "";
+  var $eMail              = "";
+  var $name               = "";
+  var $subscribe          = FALSE;
+  var $use_gosa_announce  = FALSE;
+
+  var $feedback_url         = "http://oss.gonicus.de/gosa-feedback/";
+  var $get_started          = TRUE;
+  var $problems_encountered = "";
+  
+  var $first_use            = TRUE;
+  var $use_since            = "";
+
+  var $distribution         = "";
+  var $web_server           = "";
+  var $php_version          = "";
+
+  var $ldap_server          = "";
+  var $object_count         = "";
+    
+  var $want_to_see_next     = "";
+
+  var $features_used        = array();  
+  var $initialized          = FALSE; 
+
+  var $attributes = array("organization","eMail","name","subscribe","use_gosa_announce","get_started","problems_encountered","features_used",
+                          "first_use","use_since","distribution","web_server","php_version","ldap_server","object_count","want_to_see_next");
+  
+
+  function Step_Feedback()
+  {
+    $this->is_enabled     = TRUE;
+    $this->is_active      = TRUE;
+    $this->update_strings(); 
+  }
+
+
+  function init()
+  {
+    $cv = $this->parent->captured_values;
+
+    /* Initialize values */
+    $this->use_since      = date("Y");
+    $this->organization   = preg_replace("/^[^=]*+=(.*),.*$/","\\1",$cv['base']);
+    $this->distribution   = "";
+    $this->web_server     = $_SERVER['SERVER_SOFTWARE'];
+    $this->php_version    = PHP_VERSION;
+
+    /* On first call check for rid/sid base */
+    $cv = $this->parent->captured_values;
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+    $ldap->cd($cv['base']);
+    $ldap->search("(objectClass=*)",array("dn"));
+    $this->object_count=$ldap->count();
+
+    /* Preselect used features */
+    $oc = $ldap->get_objectclasses();
+    $this->features_used                = array();
+    $this->features_used['posix']       = array("USED" => isset($oc['posixAccount']) , 
+                                                "NAME" => _("UNIX accounts/groups"));
+    $this->features_used['samba']       = array("USED" => isset($oc['sambaSamAccount']) || isset($oc['sambaAccount']) , 
+                                                "NAME" => _("Samba management"));
+    $this->features_used['mail']        = array("USED" => $cv['mail']  != "none", 
+                                                "NAME" => _("Mailsystem management"));
+    $this->features_used['fax']         = array("USED" => isset($oc['goFaxAccount']) , 
+                                                "NAME" => _("FAX system administration"));
+    $this->features_used['asterisk']    = array("USED" => isset($oc['goFonAccount']), 
+                                                "NAME" => _("Asterisk administration"));
+    $this->features_used['inventory']   = array("USED" => isset($oc['glpiAccount']) , 
+                                                "NAME" => _("System inventory"));
+    $this->features_used['system']      = array("USED" => FALSE , 
+                                                "NAME" => _("System-/Configmanagement"));
+    $this->features_used['addressbook'] = array("USED" => FALSE , 
+                                                "NAME" => _("Addressbook"));
+  }
+
+
+  function update_strings()
+  {
+    $this->s_title      = _("Notification and feedback");
+    $this->s_info       = _("Get notifications or send feedback");
+    $this->s_title_long = _("Notification and feedback");
+  }
+
+  
+  function execute()
+  {
+    if(!$this->initialized){
+      $this->initialized = TRUE;
+      $this->init();
+    }
+
+    $additional_info ="";
+
+    if(isset($_POST['send_feedback'])){
+
+      $msgs = $this->check_feedback();
+      if(count($msgs)){
+        foreach($msgs as $msg){
+          print_red($msg);
+        }
+      }else{
+        $str = $this->create_serialise_data_string(); 
+        $feedback_url = $this->feedback_url."?data=".base64_encode($str);
+
+        $ret = @fopen($feedback_url,"r");
+
+        if(!$ret){
+          print_red(sprintf(_("Could not connect to feedback server (%s). There is possibly no connection to the internet."),$this->feedback_url));
+        }else{
+          $ret_value="";
+          while($ret && !feof($ret)){
+            $ret_value.= fgets($ret,256);
+          }
+          if(!preg_match("/successful/i",$ret_value)){
+            print_red(_("Error while sending your feedback. The service is possible temporary unavailable"));
+          }else{
+            $additional_info = "<font color='green'>"._("Feedback sucessfully send")."</font>";
+          }
+        }
+        @fclose($ret);
+      }
+    }
+
+    $years = array();
+    for($i = date("Y") ; $i >= 2001; $i--){
+      $years[$i] = $i;
+    }
+
+    $this->is_completed=TRUE;
+    $smarty = get_smarty();
+
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr, $this->$attr);
+    }
+    $smarty->assign("years",$years);
+    $smarty->assign("features_used",$this->features_used);
+    $smarty->assign("additional_info",$additional_info);
+    $smarty->assign ("must", "<font class=\"must\">*</font>");
+    return($smarty->fetch(get_template_path("setup_feedback.tpl",TRUE,dirname(__FILE__))));
+  }
+
+
+  function check_feedback()
+  {
+    $msgs = array();
+    if(!is_email($this->eMail) || empty($this->eMail)){
+      $msgs[] = _("Please specify a valid email address.");
+    }
+
+    if(!$this->subscribe && !$this->use_gosa_announce){
+      $msgs[] = _("You should have enabled at least one option, to subscribe or send your feedback.");
+    }
+
+    return($msgs);
+  }
+  
+
+  function save_object()
+  {
+    if(isset($_POST['step_feedback'])){
+      foreach($this->attributes as $attr){
+        if(isset($_POST[$attr])){
+          $this->$attr = get_post($attr);
+        }
+      }
+
+      if(isset($_POST['subscribe'])){
+        $this->subscribe = TRUE;
+      }else{
+        $this->subscribe = FALSE;
+      }
+
+      if(isset($_POST['use_gosa_announce'])){
+        $this->use_gosa_announce = TRUE;
+      }else{
+        $this->use_gosa_announce = FALSE;
+      }
+    
+      foreach($this->features_used as $key => $data){
+        if(isset($_POST['feature_'.$key])){
+          $this->features_used[$key]['USED'] = TRUE;
+        }else{
+          $this->features_used[$key]['USED'] = FALSE;
+        }
+      }
+    }
+  }
+
+
+  function create_serialise_data_string()
+  {
+    $str = "#FEEDBACK ".date("H:i:s d:m:Y");
+    if($this->subscribe){
+
+      $str.= "\n\nSubscribe";
+      $str .= "\nOrganization: ".$this->organization; 
+      $str .= "\nName: ".$this->name;
+      $str .= "\neMail: ".$this->eMail;
+    }
+  
+    if($this->use_gosa_announce){
+
+      $str.= "\n\nFeedback";    
+  
+      if($this->get_started) {
+        $str .= "\nGet started: TRUE";
+      }else{
+        $str .= "\nGet started: FALSE";
+      }
+      $str .= "\nProblems : ".($this->problems_encountered);
+
+      if($this->first_use){
+        $str .= "\nFirst use: TRUE";
+      }else{
+        $str .= "\nFirst use: FALSE";
+      }
+      $str .= "\nUsing GOsa since: ".$this->use_since;
+
+      $str .="\nDistribution: ".$this->distribution;
+      $str .="\nWeb Server: ".$this->web_server;
+      $str .="\nPHP_Version: ".$this->php_version;
+      $str .="\nLDAP Server: ".$this->ldap_server;
+      $str .="\nObject count: ".$this->object_count;
+      $str .="\nMissing features: ".($this->want_to_see_next);
+    }
+
+    $str .= "\n\nFeatures used";
+    foreach($this->features_used as $name => $data){
+      $str.="\n".$name.": ";
+      if($data['USED']){
+        $str .= "TRUE";
+      }else{
+        $str .= "FALSE";
+      }
+    }
+
+    return($str);  
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/setup/class_setupStep_Finish.inc b/gosa-core/setup/class_setupStep_Finish.inc
new file mode 100644 (file)
index 0000000..3898c55
--- /dev/null
@@ -0,0 +1,143 @@
+<?php
+
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2007 Fabian Hickert
+
+   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 Step_Finish extends setup_step
+{
+  var $gosa_conf_contrib   = "/gosa.conf";
+  var $cfg_file_written = FALSE;
+  var $header_image= 'images/ldapserver.png';
+
+  function Step_Finish()
+  {
+    $this->update_strings();
+  }
+
+  
+  function update_strings()
+  {
+    $this->s_title      = _("Finish");
+    $this->s_info       = _("Write configuration file");
+    $this->s_title_long = _("Finish - write the configuration file");
+  }
+
+
+  function get_conf_data()
+  {
+    $smarty = get_smarty();
+    $smarty->assign("cv",$this->parent->captured_values);
+    $str =  $smarty->fetch(CONFIG_TEMPLATE_DIR.$this->gosa_conf_contrib);
+    return($str);
+  }  
+
+
+  function execute()
+  {
+
+    $info= posix_getgrgid(posix_getgid());
+    $webgroup = $info['name'];
+      
+    
+    /* Check if there is currently an active gosa.conf 
+     */
+    $exists = file_exists(CONFIG_DIR."/".CONFIG_FILE); 
+
+    /* Redirect to GOsa login, if : 
+     *   - gosa.conf exists
+     *   - Permisssion are set correctly 
+     */ 
+    if(isset($_POST['next']) && $exists && !$this->is_world_readable(CONFIG_DIR."/".CONFIG_FILE)){
+      session_destroy();
+      header("Location: index.php");
+      exit();
+    }
+
+    /* Downlaod config */
+    if(isset($_POST['getconf'])){
+
+      header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
+      header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
+      header("Cache-Control: no-cache");
+      header("Pragma: no-cache");
+      header("Cache-Control: post-check=0, pre-check=0");
+      header("Content-type: text/plain");
+     
+      if (preg_match('/MSIE 5.5/', $_SERVER['HTTP_USER_AGENT']) ||
+          preg_match('/MSIE 6.0/', $_SERVER['HTTP_USER_AGENT'])){
+        header('Content-Disposition: filename="'.CONFIG_FILE.'"');
+      } else {
+        header('Content-Disposition: attachment; filename="'.CONFIG_FILE.'"');
+      }
+
+      $str = $this->get_conf_data();
+      $str = preg_replace("/\n[ ]*\n/","",$str);
+
+      echo $this->get_conf_data();
+      exit();
+    }
+   
+    $err_msg= "";
+    
+    if($exists && $this->is_world_readable(CONFIG_DIR."/".CONFIG_FILE)){
+      $err_msg = _("Your configuration file is currently world readable. Please updated the file permissions!");
+    }elseif(!$exists){
+      $err_msg = _("The configuration is currently not readable or it does not exists.");
+    }
+
+    $smarty = get_smarty();
+    $smarty->assign("err_msg",$err_msg);
+    $smarty->assign("webgroup", $webgroup);
+    $smarty->assign("CONFIG_DIR",CONFIG_DIR);
+    $smarty->assign("CONFIG_FILE" , CONFIG_FILE);
+
+    $smarty->assign("msg2", sprintf(_("After downloading and placing the file under %s, please make sure that the user the webserver is running with is able to read %s, while other users shouldn't. You may want to execute these commands to achieve this requirement:"),CONFIG_DIR,CONFIG_FILE));
+
+    $smarty->assign("cv",$this->parent->captured_values);
+    return($smarty -> fetch (get_template_path("../setup/setup_finish.tpl")));
+  }
+
+
+  /* check if given file is world readable */
+  function is_world_readable($file)
+  {
+    clearstatcache();
+    $p = fileperms($file);
+    $w_r = (decbin($p & 4) == TRUE);
+    return($w_r);
+  }
+
+
+  function save_object()
+  {
+    if(isset($_POST['step8_posted'])){
+
+      /* Get attributes */
+      foreach($this->attributes as $attr){
+        if(isset($_POST[$attr])){
+          $this->$attr = validate($_POST[$attr]);
+        }
+      }
+    }
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/setup/class_setupStep_Language.inc b/gosa-core/setup/class_setupStep_Language.inc
new file mode 100644 (file)
index 0000000..e1b5e72
--- /dev/null
@@ -0,0 +1,72 @@
+<?php
+
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2007 Fabian Hickert
+
+   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 Step_Language extends setup_step
+{
+  var $lang_selected  = "";       /* Language selected from select box  */
+  var $lang           = "en_EN";  /* Detected language */
+  var $languages      = array();
+  var $attributes     = array("lang","lang_selected");
+  var $header_image   = "images/locale.png";
+
+  function Step_Language()
+  {
+    $this->lang           = get_browser_language();
+    $this->lang_selected  = "";
+    $this->update_strings(); 
+  }
+
+  function update_strings()
+  {
+    $this->s_title      = _("Language setup");
+    $this->s_title_long = _("Language setup");
+    $this->s_info       = _("This step allows you to select your preferred language.");
+  }
+  
+  function execute()
+  {
+    $this->languages = array_merge(array(""      => _("Automatic")),get_languages(TRUE));
+    asort($this->languages);
+    $smarty = get_smarty();
+    $smarty->assign("languages",    $this->languages);
+    $smarty->assign("lang",         $this->lang);
+    $smarty->assign("lang_selected",$this->lang_selected);
+    return($smarty->fetch(get_template_path("setup_language.tpl",TRUE,dirname(__FILE__))));
+  }
+
+  function save_object()
+  {
+    if((isset($_POST['lang_selected'])) && isset($this->languages[$_POST['lang_selected']])) {
+      $this->lang_selected = $_POST['lang_selected'];
+      $this->is_completed = TRUE;
+
+      if($this->lang_selected != ""){
+        $_SESSION['lang'] = $this->lang_selected;
+      }else{
+        $_SESSION['lang'] = $this->lang;
+      }
+    }
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/setup/class_setupStep_Ldap.inc b/gosa-core/setup/class_setupStep_Ldap.inc
new file mode 100644 (file)
index 0000000..9b5f670
--- /dev/null
@@ -0,0 +1,208 @@
+<?php
+
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2007 Fabian Hickert
+
+   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 Step_Ldap extends setup_step
+{
+  var $connection = "ldap://localhost:389";
+  var $location   = "default";
+  var $admin      = "";
+  var $password   = "";
+  var $base       = "";
+  var $append_base_to_admin_dn = FALSE;
+  var $admin_given = "";
+
+  var $connect_id = FALSE;
+  var $bind_id    = FALSE;
+
+  var $resolve_filter = "*";
+  var $resolve_user   = FALSE;
+  var $tls            = FALSE;
+
+  var $rfc2307bis             = FALSE;
+  var $attributes = array("connection","location","admin","password","base","admin_given","append_base_to_admin_dn","tls","rfc2307bis");
+
+  var $header_image= "images/proxy.png";
+
+  function Step_Ldap()
+  {
+    $this->update_strings();
+  }
+
+  
+  function update_strings()
+  {
+    $this->s_title      = _("LDAP setup");
+    $this->s_title_long = _("LDAP connection setup");
+    $this->s_info       = _("This dialog performs the basic configuration of the LDAP connectivity for GOsa.");
+  }
+  
+  
+  function execute()
+  {
+    $smarty = get_smarty();
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr,$this->$attr);
+    }
+
+    /* Assign connection status */
+    $smarty->assign("connection_status",$this->get_connection_status());
+
+    /* Handle namingContext detection */
+    $attr = @LDAP::get_naming_contexts($this->connection);
+    unset($attr['count']);
+    $smarty->assign("namingContexts",$attr);
+    $smarty->assign("namingContextsCount",count($attr));
+    $smarty->assign("bool",array(FALSE => _("No"), TRUE => _("Yes")));
+
+    /* Addign resolved users */
+    $smarty->assign("resolve_user",$this->resolve_user);
+    if($this->resolve_user){
+      $tmp = $this->resolve_user();
+      $smarty->assign("resolved_users",$tmp);
+      $smarty->assign("resolved_users_count",count($tmp));
+      $smarty->assign("resolve_filter",$this->resolve_filter);
+    }
+
+    $base_to_append = $this->base;
+    if(strlen($base_to_append) > 20){
+      $base_to_append = substr($base_to_append,0,17)."...";
+    }
+    $smarty->assign("base_to_append",$base_to_append);
+    return($smarty -> fetch (get_template_path("../setup/setup_ldap.tpl")));
+  }
+
+  function get_connection_status()
+  {
+    $this->connect_id = FALSE;
+    $this->bind_id    = FALSE;
+
+    @ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7);
+    $this->connect_id = @ldap_connect($this->connection);
+      
+    @ldap_set_option($this->connect_id, LDAP_OPT_PROTOCOL_VERSION, 3);
+    $this->bind_id = @ldap_bind($this->connect_id, $this->admin, $this->password);
+    
+    if(!$this->bind_id){
+      $str = sprintf(_("Anonymous bind failed on server '%s'."),$this->connection); 
+      if(!empty($this->admin)){
+        $str = sprintf(_("Bind as user '%s' failed on server '%s'."),$this->admin,$this->connection);
+      }      
+      return("<font color='red'>".$str."</font>");
+    }else{
+      if(empty($this->admin)){
+        $str = sprintf(_("Anonymous bind on server '%s' succeeded."), $this->connection);
+        return("<font color='blue'>".$str."</font> <font color='red'>"._("Please specify user and password.")."</font>");
+      }else{
+        $str = sprintf(_("Bind as user '%s' on server '%s' succeeded."),$this->admin,$this->connection);
+        return("<font color='green'>".$str."</font>");
+      }      
+    }
+  }
+
+  
+  function resolve_user()
+  {
+    $filter  = $this->resolve_filter;
+    $ldap = new LDAP("","",$this->connection);
+    $ldap->cd($this->base);
+    $ldap->search("(&(objectClass=person)(|(uid=".$filter.")(cn=".$filter.")))");
+    $tmp = array();
+    while($attrs = $ldap->fetch()){
+      $tmp[base64_encode($attrs['dn'])]= @LDAP::fix($attrs['dn']);
+      natcasesort($tmp);
+    }
+    return($tmp);
+  }   
+
+
+  function save_object()
+  {
+    $reset = FALSE;
+    foreach($this->attributes as $attr){
+      if(isset($_POST[$attr])){
+        if(in_array($attr,array("base","connection")) && $this->$attr != get_post($attr)){
+          $reset = TRUE;
+        }
+        $this->$attr = get_post($attr);
+      }
+    }
+
+    if($reset){
+      $this->parent->disable_steps_from(($this->parent->step_name_to_id(get_class($this))) +1);
+      $attr = @LDAP::get_naming_contexts($this->connection);
+      if(is_array($attr) && !in_array(get_post("base"),$attr)){
+        if(isset($attr[0])){
+          $this->base = $attr[0];
+        }
+      }
+    }
+
+    if(isset($_POST['resolve_user_x'])){
+      $this->resolve_user = !$this->resolve_user;
+    }
+    if(isset($_POST['resolve_user'])){
+      $this->resolve_user = !$this->resolve_user;
+    }
+  
+    /* Hide backward forward button*/
+    $this->dialog = $this->resolve_user;
+    if(isset($_POST['resolve_filter'])){
+      $this->resolve_filter = get_post('resolve_filter');
+    }
+
+    if(isset($_POST['use_selected_user'])){
+
+      if(isset($_POST['admin_to_use'])){
+        $this->admin = base64_decode(get_post('admin_to_use'));
+        $this->resolve_user = false;
+      }
+    }
+
+    if(isset($_POST['append_base_to_admin_dn'])){
+      $this->append_base_to_admin_dn = TRUE;
+    }else{
+      $this->append_base_to_admin_dn = FALSE;
+    }
+    if($this->append_base_to_admin_dn){
+      $base = $this->base;      
+      if(!preg_match("/,$/",$this->admin_given)){
+        $base = ",".$base;
+      }
+      $this->admin = $this->admin_given.$base;
+    }else{
+      $this->admin = $this->admin_given;
+    }
+
+    $this->get_connection_status();
+    if($this->bind_id && !empty($this->admin) && !empty($this->base)){
+      $this->is_completed =TRUE;
+    }else{
+      $this->is_completed =FALSE;
+    }
+
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/setup/class_setupStep_License.inc b/gosa-core/setup/class_setupStep_License.inc
new file mode 100644 (file)
index 0000000..d46768c
--- /dev/null
@@ -0,0 +1,94 @@
+<?php
+
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2007 Fabian Hickert
+
+   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 Step_License extends setup_step
+{
+  var $license_found  = false;
+  var $License        = "";
+  var $header_image   = "images/ldif.png";
+  var $accepted       = FALSE;
+  var $attributes     = array("accepted");
+  
+
+  function Step_License()
+  {
+    $this->update_strings();
+  }
+
+  
+  function load_license()
+  {
+    if(!file_exists("../setup/license.txt")){
+      $this->License = "<font color='red'>License not found. Setup stops here.</font>";
+      $this->license_found = false;
+    }else{
+      $fp = fopen("../setup/license.txt","r");
+      $this->License = "";
+      while (!feof($fp)){
+        $this->License .= fread($fp, 255);
+      }
+      $this->license_found = true;
+    }
+  }
+
+
+  function update_strings()
+  {
+    $this->s_title      = _("License");
+    $this->s_title_long = _("License");
+    $this->s_info       = _("Terms and conditions for usage");
+  }
+
+  function execute()
+  {
+    $this->load_license();
+
+    $smarty = get_smarty();
+    $smarty -> assign("License",nl2br($this->License));
+    $smarty -> assign("license_found",$this->license_found);
+    $smarty -> assign("accepted",$this->accepted);
+
+    return($smarty -> fetch (get_template_path("../setup/setup_license.tpl")));
+  }
+
+  
+  function save_object()
+  {
+    if(isset($_POST['step_license'])){
+      if(isset($_POST['accepted'])){
+        $this->accepted = TRUE;
+      }else{
+        $this->accepted = FALSE;
+      }
+    } 
+  
+    if($this->license_found && $this->accepted){
+      $this->is_completed = true;
+    }else{
+      $this->is_completed = false;
+    }
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/setup/class_setupStep_Migrate.inc b/gosa-core/setup/class_setupStep_Migrate.inc
new file mode 100644 (file)
index 0000000..5dcd8e6
--- /dev/null
@@ -0,0 +1,1946 @@
+<?php
+
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2007 Fabian Hickert
+
+   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
+ */
+
+
+
+/****************
+ * FUNCTIONS 
+
+Step_Migrate                - Constructor.
+update_strings              - Used to update the displayed step informations.
+initialize_checks           - Initialize migration steps.
+check_ldap_permissions      - Check if the used admin account has full access to the ldap database.
+check_gosaAccounts          - Check if there are users without the required objectClasses.
+migrate_gosaAccounts        - Migrate selected users to GOsa user accounts.
+check_organizationalUnits   - Check if there are departments, that are not visible for GOsa
+migrate_organizationalUnits - Migrate selected departments 
+check_administrativeAccount - Check if there is at least one acl entry available                  
+checkBase                   - Check if there is a root object available 
+
+get_user_list               - Get list of available users
+get_group_list              - Get list of groups
+  
+create_admin                
+create_admin_user           
+
+execute                     - Generate html output of this plugin
+save_object                 - Save posts 
+array_to_ldif               - Create ldif output of an ldap result array 
+ ****************/
+
+
+
+class Step_Migrate extends setup_step
+{
+  var $languages      = array();
+  var $attributes     = array();
+  var $header_image   = "images/monitoring.png";
+  var $checks         = array();
+
+  /* Department migration attributes */
+  var $dep_migration_dialog = FALSE;
+  var $deps_to_migrate      = array();
+  var $show_details         = FALSE;
+
+  /* Department migration attributes */
+  var $users_migration_dialog= FALSE;
+  var $users_to_migrate      = array();
+
+  /* Create Acl attributes */
+  var $acl_create_dialog  = FALSE;
+  var $acl_create_selected= ""; // Currently selected element, that should receive admin rights 
+  var $acl_create_changes = ""; // Contains ldif information about changes 
+  var $acl_create_confirmed= FALSE;
+
+  /* Checks initialised ? */
+  var $checks_initialised = FALSE;
+
+  /* Users outside to people ou */
+  var $outside_users        = array();
+  var $outside_users_dialog = FALSE;
+
+  /* Users outside to groups ou */
+  var $outside_groups        = array();
+  var $outside_groups_dialog = FALSE;
+
+  /* Win-Workstations outside to reserved ou */
+  var $outside_winstations        = array();
+  var $outside_winstations_dialog = FALSE;
+
+  /* check for multiple use of same uidNumber */
+  var $check_uidNumbers        = array();
+  var $check_uidNumbers_dialog = FALSE;
+
+  /* check for multiple use of same gidNumber */
+  var $check_gidNumbers        = array();
+  var $check_gidNumbers_dialog = FALSE;
+
+
+  function Step_Migrate()
+  {
+    $this->update_strings(); 
+  }
+
+  function update_strings()
+  {
+    $this->s_title      = _("LDAP inspection");
+    $this->s_title_long = _("LDAP inspection");
+    $this->s_info       = _("Analyze your current LDAP for GOsa compatibility");
+  }
+
+  function initialize_checks()
+  {
+    $this->checks = array();
+    $this->checks['root']['TITLE']     = _("Checking for root object");
+    $this->checks['root']['STATUS']    = FALSE;
+    $this->checks['root']['STATUS_MSG']= "";
+    $this->checks['root']['ERROR_MSG'] = "";
+    $this->checkBase();
+
+    $this->checks['permissions']['TITLE']     = _("Checking permissions on LDAP database");
+    $this->checks['permissions']['STATUS']    = FALSE;
+    $this->checks['permissions']['STATUS_MSG']= "";
+    $this->checks['permissions']['ERROR_MSG'] = "";
+    $this->check_ldap_permissions();
+
+    $this->checks['deps_visible']['TITLE']     = _("Checking for invisible deparmtments");
+    $this->checks['deps_visible']['STATUS']    = FALSE;
+    $this->checks['deps_visible']['STATUS_MSG']= "";
+    $this->checks['deps_visible']['ERROR_MSG'] = "";
+    $this->check_organizationalUnits();
+
+    $this->checks['users_visible']['TITLE']     = _("Checking for invisible users");
+    $this->checks['users_visible']['STATUS']    = FALSE;
+    $this->checks['users_visible']['STATUS_MSG']= "";
+    $this->checks['users_visible']['ERROR_MSG'] = "";
+    $this->check_gosaAccounts();
+
+    $this->checks['acls']['TITLE']     = _("Checking for super administrator");
+    $this->checks['acls']['STATUS']    = FALSE;
+    $this->checks['acls']['STATUS_MSG']= "";
+    $this->checks['acls']['ERROR_MSG'] = "";
+    $this->check_administrativeAccount();
+
+    $this->checks['outside_users']['TITLE']     = _("Checking for users outside the people tree");
+    $this->checks['outside_users']['STATUS']    = FALSE;
+    $this->checks['outside_users']['STATUS_MSG']= "";
+    $this->checks['outside_users']['ERROR_MSG'] = "";
+    $this->search_outside_users();
+    
+    $this->checks['outside_groups']['TITLE']     = _("Checking for groups outside the groups tree");
+    $this->checks['outside_groups']['STATUS']    = FALSE;
+    $this->checks['outside_groups']['STATUS_MSG']= "";
+    $this->checks['outside_groups']['ERROR_MSG'] = "";
+    $this->search_outside_groups();
+
+    $this->checks['outside_winstations']['TITLE']     = _("Checking for windows workstations outside the winstation tree");
+    $this->checks['outside_winstations']['STATUS']    = FALSE;
+    $this->checks['outside_winstations']['STATUS_MSG']= "";
+    $this->checks['outside_winstations']['ERROR_MSG'] = "";
+    $this->search_outside_winstations();
+
+    $this->checks['uidNumber_usage']['TITLE']     = _("Checking for duplicate uid numbers");
+    $this->checks['uidNumber_usage']['STATUS']    = FALSE;
+    $this->checks['uidNumber_usage']['STATUS_MSG']= "";
+    $this->checks['uidNumber_usage']['ERROR_MSG'] = "";
+    $this->check_uidNumber();
+    
+    $this->checks['gidNumber_usage']['TITLE']     = _("Checking for duplicate gid numbers");
+    $this->checks['gidNumber_usage']['STATUS']    = FALSE;
+    $this->checks['gidNumber_usage']['STATUS_MSG']= "";
+    $this->checks['gidNumber_usage']['ERROR_MSG'] = "";
+    $this->check_gidNumber();
+  }
+
+
+  /* Check if there are uidNumbers which are used more than once. 
+   */
+  function check_uidNumber()
+  {
+    $cv = $this->parent->captured_values;
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+
+    $ldap->cd($cv['base']);
+    $res = $ldap->search("uidNumber=*",array("dn","uidNumber"));
+    if(!$res){
+      $this->checks['uidNumber_usage']['STATUS']    = FALSE;
+      $this->checks['uidNumber_usage']['STATUS_MSG']= _("LDAP query failed");
+      $this->checks['uidNumber_usage']['ERROR_MSG'] = _("Possibly the 'root object' is missing.");
+      return(false);
+    }
+
+    $this->check_uidNumbers= array(); 
+    $tmp = array();
+    while($attrs = $ldap->fetch()){
+      $tmp[$attrs['uidNumber'][0]][] = $attrs;
+    }
+
+    foreach($tmp as $id => $entries){
+      if(count($entries) > 1){
+        foreach($entries as $entry){
+          $this->check_uidNumbers[base64_encode($entry['dn'])] = $entry;
+        }
+      }
+    }
+
+    if($this->check_uidNumbers){
+      $this->checks['uidNumber_usage']['STATUS']    = FALSE;
+      $this->checks['uidNumber_usage']['STATUS_MSG']= "<font style='color:#F0A500'>"._("Warning")."</font>";
+      $this->checks['uidNumber_usage']['ERROR_MSG'] =
+        sprintf(_("Found %s duplicate values for attribute 'uidNumber'."),count($this->check_uidNumbers));
+      return(false);
+    }else{
+      $this->checks['uidNumber_usage']['STATUS']    = TRUE;
+      $this->checks['uidNumber_usage']['STATUS_MSG']= _("Ok");
+      $this->checks['uidNumber_usage']['ERROR_MSG'] = "";
+      return(TRUE);
+    }
+  }
+
+  
+  /* Check if there are duplicated gidNumbers present in ldap
+   */
+  function check_gidNumber()
+  {
+    $cv = $this->parent->captured_values;
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+
+    $ldap->cd($cv['base']);
+    $res = $ldap->search("(&(objectClass=posixGroup)(gidNumber=*))",array("dn","gidNumber"));
+    if(!$res){
+      $this->checks['gidNumber_usage']['STATUS']    = FALSE;
+      $this->checks['gidNumber_usage']['STATUS_MSG']= _("LDAP query failed");
+      $this->checks['gidNumber_usage']['ERROR_MSG'] = _("Possibly the 'root object' is missing.");
+      return(false);
+    }
+
+    $this->check_gidNumbers= array(); 
+    $tmp = array();
+    while($attrs = $ldap->fetch()){
+      $tmp[$attrs['gidNumber'][0]][] = $attrs;
+    }
+
+    foreach($tmp as $id => $entries){
+      if(count($entries) > 1){
+        foreach($entries as $entry){
+          $this->check_gidNumbers[base64_encode($entry['dn'])] = $entry;
+        }
+      }
+    }
+
+    if($this->check_gidNumbers){
+      $this->checks['gidNumber_usage']['STATUS']    = FALSE;
+      $this->checks['gidNumber_usage']['STATUS_MSG']= "<font style='color:#F0A500'>"._("Warning")."</font>";
+      $this->checks['gidNumber_usage']['ERROR_MSG'] =
+        sprintf(_("Found %s duplicate values for attribute 'gidNumber'."),count($this->check_gidNumbers));
+      return(false);
+    }else{
+      $this->checks['gidNumber_usage']['STATUS']    = TRUE;
+      $this->checks['gidNumber_usage']['STATUS_MSG']= _("Ok");
+      $this->checks['gidNumber_usage']['ERROR_MSG'] = "";
+      return(TRUE);
+    }
+  }
+
+
+  /* Search for winstations outside the winstation ou 
+   */
+  function search_outside_winstations()
+  {
+    $cv = $this->parent->captured_values;
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+
+    /* Get winstation ou */
+    if($cv['generic_settings']['wws_ou_active']) {
+      $winstation_ou = $cv['generic_settings']['ws_ou'];
+    }else{
+      $winstation_ou = "ou=winstations";
+    }
+
+    if($cv['samba_version'] == 3){
+      $oc = "sambaSamAccount";
+    }else{
+      $oc = "sambaAccount";
+    }
+    $ldap->cd($cv['base']);
+    $res = $ldap->search("(&(objectClass=".$oc.")(uid=*$))",array("dn","sambaSID"));
+    if(!$res){
+      $this->checks['outside_winstations']['STATUS']    = FALSE;
+      $this->checks['outside_winstations']['STATUS_MSG']= _("LDAP query failed");
+      $this->checks['outside_winstations']['ERROR_MSG'] = _("Possibly the 'root object' is missing.");
+      return(false);
+    }
+
+    $this->outside_winstations = array();
+    while($attrs = $ldap->fetch()){
+      if((!preg_match("/^[^,]+,".normalizePreg($winstation_ou)."/",$attrs['dn'])) && !preg_match("/,dc=addressbook,/",$attrs['dn'])){
+        $attrs['selected'] = FALSE;
+        $attrs['ldif']     = "";
+        $this->outside_winstations[base64_encode($attrs['dn'])] = $attrs;
+      }
+    }
+
+    if(count($this->outside_winstations)){
+      $this->checks['outside_winstations']['STATUS']    = FALSE;
+      $this->checks['outside_winstations']['STATUS_MSG']= _("Failed");
+      $this->checks['outside_winstations']['ERROR_MSG'] = 
+        sprintf(_("Found %s winstations outside the predefined winstation department ou '%s'."),count($this->outside_winstations),$winstation_ou);
+      $this->checks['outside_winstations']['ERROR_MSG'].= "<input type='submit' name='outside_winstations_dialog' value='"._("Migrate")."...'>";
+      return(false);
+    }else{
+      $this->checks['outside_winstations']['STATUS']    = TRUE;
+      $this->checks['outside_winstations']['STATUS_MSG']= _("Ok");
+      $this->checks['outside_winstations']['ERROR_MSG'] = "";
+      return(TRUE);
+    }
+  }
+
+
+  /* Search for groups outside the group ou 
+   */
+  function search_outside_groups()
+  {
+    $cv = $this->parent->captured_values;
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+
+    $group_ou = $cv['groupou'];
+    $ldap->cd($cv['base']);
+
+    /***********
+     * Get all gosaDepartments to be able to
+     *  validate correct ldap tree position of every single user
+     ***********/
+    $valid_deps = array();
+    $valid_deps['/'] = $cv['base'];
+    $ldap->search("(&(objectClass=gosaDepartment)(ou=*))",array("dn","ou"));
+    while($attrs = $ldap->fetch()){
+      $valid_deps[] = $attrs['dn'];
+    }
+
+    /***********
+     * Get all groups
+     ***********/
+    $res = $ldap->search("(objectClass=posixGroup)",array("dn"));
+    if(!$res){
+      $this->checks['outside_groups']['STATUS']    = FALSE;
+      $this->checks['outside_groups']['STATUS_MSG']= _("LDAP query failed");
+      $this->checks['outside_groups']['ERROR_MSG'] = _("Possibly the 'root object' is missing.");
+      return(false);
+    }
+
+    $this->outside_groups = array();
+    while($attrs = $ldap->fetch()){
+      $group_db_base = preg_replace("/^[^,]+,".normalizePreg($group_ou)."+,/i","",$attrs['dn']);
+
+      /* Check if entry is not an addressbook only user
+       *  and verify that he is in a valid department
+       */
+      if( !preg_match("/".normalizePreg("dc=addressbook,")."/",$group_db_base) &&
+          !in_array($group_db_base,$valid_deps)
+        ){
+        $attrs['selected'] = FALSE;
+        $attrs['ldif']     = "";
+        $this->outside_groups[base64_encode($attrs['dn'])] = $attrs;
+      }
+    }
+
+    if(count($this->outside_groups)){
+      $this->checks['outside_groups']['STATUS']    = FALSE;
+      $this->checks['outside_groups']['STATUS_MSG']= "<font style='color:#F0A500'>"._("Warning")."</font>";
+      $this->checks['outside_groups']['ERROR_MSG'] =
+        sprintf(_("Found %s groups outside the configured tree '%s'."),count($this->outside_groups),$group_ou);
+      $this->checks['outside_groups']['ERROR_MSG'].= "&nbsp;<input type='submit' name='outside_groups_dialog' value='"._("Move")."...'>";
+      return(false);
+    }else{
+      $this->checks['outside_groups']['STATUS']    = TRUE;
+      $this->checks['outside_groups']['STATUS_MSG']= _("Ok");
+      $this->checks['outside_groups']['ERROR_MSG'] = "";
+      return(TRUE);
+    }
+  }
+
+ /* Search for users outside the people ou
+   */
+  function search_outside_users()
+  {
+    $cv = $this->parent->captured_values;
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+
+    $ldap->cd($cv['base']);
+
+
+    /***********
+     * Get all gosaDepartments to be able to
+     *  validate correct ldap tree position of every single user
+     ***********/
+    $valid_deps = array();
+    $valid_deps['/'] = $cv['base'];
+    $ldap->search("(&(objectClass=gosaDepartment)(ou=*))",array("dn","ou"));
+    while($attrs = $ldap->fetch()){
+      $valid_deps[] = $attrs['dn'];
+    }
+
+    /***********
+     * Search for all users
+     ***********/
+    $res = $ldap->search("(&(objectClass=gosaAccount)(!(uid=*$)))",array("dn"));
+    if(!$res){
+      $this->checks['outside_users']['STATUS']    = FALSE;
+      $this->checks['outside_users']['STATUS_MSG']= _("LDAP query failed");
+      $this->checks['outside_users']['ERROR_MSG'] = _("Possibly the 'root object' is missing.");
+      return(false);
+    }
+
+    /***********
+     * Check if returned users are within a valid GOsa deparmtment. (peopleou,gosaDepartment,base)
+     ***********/
+    $this->outside_users = array();
+    $people_ou = trim($cv['peopleou']);
+    if(!empty($people_ou)){
+      $people_ou = $people_ou.",";
+    }
+
+    while($attrs = $ldap->fetch()){
+      $people_db_base = preg_replace("/^[^,]+,".normalizePreg($people_ou)."/i","",$attrs['dn']);
+
+      /* Check if entry is not an addressbook only user
+       *  and verify that he is in a valid department
+       */
+      if( !preg_match("/".normalizePreg("dc=addressbook,")."/",$people_db_base) &&
+          !in_array($people_db_base,$valid_deps)
+         ){
+        $attrs['selected'] = FALSE;
+        $attrs['ldif']     = "";
+        $this->outside_users[base64_encode($attrs['dn'])] = $attrs;
+      }
+    }
+
+    if(count($this->outside_users)){
+      $this->checks['outside_users']['STATUS']    = FALSE;
+      $this->checks['outside_users']['STATUS_MSG']= "<font style='color:#F0A500'>"._("Warning")."</font>";
+      $this->checks['outside_users']['ERROR_MSG'] =
+        sprintf(_("Found %s user(s) outside the configured tree '%s'."),count($this->outside_users),$people_ou);
+      $this->checks['outside_users']['ERROR_MSG'].= "<input type='submit' name='outside_users_dialog' value='"._("Move")."...'>";
+      return(false);
+    }else{
+      $this->checks['outside_users']['STATUS']    = TRUE;
+      $this->checks['outside_users']['STATUS_MSG']= _("Ok");
+      $this->checks['outside_users']['ERROR_MSG'] = "";
+      return(TRUE);
+    }
+  }
+
+
+  /* Check ldap accessibility 
+   * Create and remove a dummy object, 
+   *  to ensure that we have the necessary permissions
+   */
+  function check_ldap_permissions()
+  {
+    $cv = $this->parent->captured_values;
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+
+    /* Create dummy entry 
+     */
+    $name     = "GOsa_setup_text_entry_".session_id().rand(0,999999);
+    $dn       = "ou=".$name.",".$cv['base'];
+    $testEntry= array();
+    $testEntry['objectClass'][]= "top";
+    $testEntry['objectClass'][]= "organizationalUnit";
+    $testEntry['objectClass'][]= "gosaDepartment";
+    $testEntry['description']= "Created by GOsa setup, this object can be removed.";
+    $testEntry['ou']  = $name;
+
+    /* check if simple ldap cat will be successful 
+     */
+    $res = $ldap->cat($cv['base']);  
+    if(!$res){
+      $this->checks['permissions']['STATUS']    = FALSE;
+      $this->checks['permissions']['STATUS_MSG']= _("LDAP query failed");
+      $this->checks['permissions']['ERROR_MSG'] = _("Possibly the 'root object' is missing.");
+      return(false);
+    }
+  
+    /* Try to create dummy object 
+     */ 
+    $ldap->cd ($dn);
+    $ldap->create_missing_trees($dn);
+    $res = $ldap->add($testEntry);
+    $ldap->cat($dn);
+    if(!$ldap->count()){
+      new log("view","setup/".get_class($this),$dn,array(),$ldap->get_error());
+
+      $this->checks['permissions']['STATUS']    = FALSE;
+      $this->checks['permissions']['STATUS_MSG']= _("Failed");
+      $this->checks['permissions']['ERROR_MSG'] = 
+        sprintf(_("The specified user '%s' does not have full access to your ldap database."),$cv['admin']);
+      return(false);
+    }
+
+    /* Try to remove created entry 
+     */
+    $res = $ldap->rmDir($dn);
+    $ldap->cat($dn);
+    if($ldap->count()){
+      new log("view","setup/".get_class($this),$dn,array(),$ldap->get_error());
+      $this->checks['permissions']['STATUS']    = FALSE;
+      $this->checks['permissions']['STATUS_MSG']= _("Failed");
+      $this->checks['permissions']['ERROR_MSG'] = 
+        sprintf(_("The specified user '%s' does not have full access to your ldap database."),$cv['admin']);
+      return(false);
+    }
+
+    /* Create & remove of dummy object was successful */
+    $this->checks['permissions']['STATUS']    = TRUE;
+    $this->checks['permissions']['STATUS_MSG']= _("Ok");
+    $this->checks['permissions']['ERROR_MSG'] = "";
+    return(true);
+  } 
+
+
+  /* Check if there are users which will 
+   *  be invisible for GOsa 
+   */
+  function check_gosaAccounts()
+  {
+    /* Remember old list of ivisible users, to be able to set 
+     *  the 'html checked' status for the checkboxes again 
+     */
+    $cnt_ok = 0;
+    $old    = $this->users_to_migrate;
+    $this->users_to_migrate = array();
+
+    /* Get collected configuration settings */
+    $cv = $this->parent->captured_values;
+
+    /* Establish ldap connection */
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+
+    /* Get all invisible users 
+     */
+    $ldap->cd($cv['base']); 
+    $res =$ldap->search("(&(|(objectClass=posixAccount)(&(objectClass=inetOrgPerson)(objectClass=organizationalPerson)))(!(objectClass=gosaAccount))(uid=*))",array("sn","givenName","cn","uid"));
+    while($attrs = $ldap->fetch()){
+      if(!preg_match("/,dc=addressbook,/",$attrs['dn'])){
+        $attrs['checked'] = FALSE;
+        $attrs['before']  = "";
+        $attrs['after']   = "";
+
+        /* Set objects to selected, that were selected before reload */
+        if(isset($old[base64_encode($attrs['dn'])])){
+          $attrs['checked'] = $old[base64_encode($attrs['dn'])]['checked'];
+        }
+        $this->users_to_migrate[base64_encode($attrs['dn'])] = $attrs;
+      }
+    }
+
+    /* No invisible */
+    if(!$res){
+      $this->checks['users_visible']['STATUS']    = FALSE;
+      $this->checks['users_visible']['STATUS_MSG']= _("LDAP query failed");
+      $this->checks['users_visible']['ERROR_MSG'] = _("Possibly the 'root object' is missing.");
+    }elseif(count($this->users_to_migrate) == 0){
+      $this->checks['users_visible']['STATUS']    = TRUE;
+      $this->checks['users_visible']['STATUS_MSG']= _("Ok");
+      $this->checks['users_visible']['ERROR_MSG'] = "";
+    }else{
+      $this->checks['users_visible']['STATUS']    = FALSE;
+      $this->checks['users_visible']['STATUS_MSG']= "<font style='color:#F0A500'>"._("Warning")."</font>";
+      $this->checks['users_visible']['ERROR_MSG'] = sprintf(_("Found %s user(s) that will not be visible in GOsa."), 
+          count($this->users_to_migrate));
+      $this->checks['users_visible']['ERROR_MSG'] .= "<input type='submit' name='users_visible_migrate' value='"._("Migrate")."...'>";
+    }
+  }
+
+
+  /* Start user account migration 
+   */  
+  function migrate_gosaAccounts($only_ldif = FALSE)
+  {
+    $this->show_details= $only_ldif;
+
+    /* Get collected configuration settings */
+    $cv = $this->parent->captured_values;
+
+    /* Establish ldap connection */
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+
+    /* Add gosaAccount objectClass to the selected users  
+     */
+    foreach($this->users_to_migrate as $key => $dep){
+      if($dep['checked']){
+
+        /* Get old objectClasses */
+        $ldap->cat($dep['dn'],array("objectClass"));
+        $attrs      = $ldap->fetch();
+
+        /* Create new objectClass array */
+        $new_attrs  = array();
+        $new_attrs['objectClass']= array("gosaAccount","inetOrgPerson","organizationalPerson");
+        for($i = 0 ; $i < $attrs['objectClass']['count']; $i ++ ){
+          if(!in_array_ics($attrs['objectClass'][$i], $new_attrs['objectClass'])){
+            $new_attrs['objectClass'][]   = $attrs['objectClass'][$i];
+          }
+        }
+
+        /* Set info attributes for current object, 
+         *  or write changes to the ldap database 
+         */
+        if($only_ldif){
+          $this->users_to_migrate[$key]['before'] = $this->array_to_ldif($attrs);
+          $this->users_to_migrate[$key]['after']  = $this->array_to_ldif($new_attrs);
+        }else{
+          $ldap->cd($attrs['dn']);
+          if(!$ldap->modify($new_attrs)){
+            print_red(sprintf(_("Failed to migrate the department '%s' into GOsa, error message is as follows '%s'."),$attrs['dn'],$ldap->get_error()));
+            return(false);
+          }
+        }
+      }
+    }
+    return(TRUE);
+  }
+
+
+  /* Check if there are invisible organizational Units 
+   */
+  function check_organizationalUnits()
+  {
+    $cnt_ok = 0;
+    $old = $this->deps_to_migrate;
+    $this->deps_to_migrate = array();
+
+    /* Get collected configuration settings */
+    $cv = $this->parent->captured_values;
+
+    /* Establish ldap connection */
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+
+    /* Skip GOsa internal departments */
+    $skip_dns = array("/".$cv['peopleou']."/","/".$cv['groupou']."/","/^ou=people,/","/^ou=groups,/",
+        "/(,|)ou=configs,/","/(,|)ou=systems,/",
+        "/(,|)ou=apps,/","/(,|)ou=mime,/","/(,|)ou=devices/","/^ou=aclroles,/","/^ou=incoming,/",
+        "/ou=snapshots,/","/(,|)dc=addressbook,/","/^(,|)ou=machineaccounts,/",
+        "/(,|)ou=winstations,/");
+
+    /* Get all invisible departments */
+    $ldap->cd($cv['base']); 
+    $res = $ldap->search("(&(objectClass=organizationalUnit)(!(objectClass=gosaDepartment)))",array("ou","description","dn"));
+    while($attrs = $ldap->fetch()){
+      $attrs['checked'] = FALSE;
+      $attrs['before']  = "";
+      $attrs['after']   = "";
+
+      /* Set objects to selected, that were selected before reload */
+      if(isset($old[base64_encode($attrs['dn'])])){
+        $attrs['checked'] = $old[base64_encode($attrs['dn'])]['checked'];
+      }
+      $this->deps_to_migrate[base64_encode($attrs['dn'])] = $attrs;
+    }
+
+    /* Filter returned list of departments and ensure that 
+     *  GOsa internal departments will not be listed 
+     */
+    foreach($this->deps_to_migrate as $key => $attrs){
+      $dn = $attrs['dn'];
+      $skip = false;;
+      foreach($skip_dns as $skip_dn){
+        if(preg_match($skip_dn,$dn)){
+          $skip = true;
+        }
+      }
+      if($skip){
+        unset($this->deps_to_migrate[$key]);
+      }
+    }
+
+    /* If we have no invisible departments found  
+     *  tell the user that everything is ok 
+     */
+    if(!$res){
+      $this->checks['deps_visible']['STATUS']    = FALSE;
+      $this->checks['deps_visible']['STATUS_MSG']= _("LDAP query failed");
+      $this->checks['deps_visible']['ERROR_MSG'] = _("Possibly the 'root object' is missing.");
+    }elseif(count($this->deps_to_migrate) == 0 ){
+      $this->checks['deps_visible']['STATUS']    = TRUE;
+      $this->checks['deps_visible']['STATUS_MSG']= _("Ok");
+      $this->checks['deps_visible']['ERROR_MSG'] = "";
+    }else{
+      $this->checks['deps_visible']['STATUS']    = TRUE;
+      $this->checks['deps_visible']['STATUS_MSG']= '<font style="color:#FFA500">'._("Warning").'</font>';
+      $this->checks['deps_visible']['ERROR_MSG'] = sprintf(_("Found %s department(s) that will not be visible in GOsa."),count($this->deps_to_migrate));
+      $this->checks['deps_visible']['ERROR_MSG'] .= "&nbsp;<input type='submit' name='deps_visible_migrate' value='"._("Migrate")."...'>";
+    }
+  }
+
+
+
+  /* Start deparmtment migration */  
+  function migrate_organizationalUnits($only_ldif = FALSE)
+  {
+    $this->show_details= $only_ldif;
+
+    /* Get collected configuration settings */
+    $cv = $this->parent->captured_values;
+
+    /* Establish ldap connection */
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+
+    /* Add gosaDepartment objectClass to each selected entry 
+     */
+    foreach($this->deps_to_migrate as $key => $dep){
+      if($dep['checked']){
+
+        /* Get current objectClasses */
+        $ldap->cat($dep['dn'],array("objectClass","description"));
+        $attrs      = $ldap->fetch();
+
+        /* Create new objectClass attribute including gosaDepartment*/
+        $new_attrs  = array();
+        for($i = 0 ; $i < $attrs['objectClass']['count']; $i ++ ){
+          $new_attrs['objectClass'][]   = $attrs['objectClass'][$i];
+        }
+        $new_attrs['objectClass'][] = "gosaDepartment";
+
+        /* Append description it is missing */
+        if(!isset($attrs['description'])){
+          $new_attrs['description'][] = "GOsa department";
+        }
+
+        /* Depending on the parameter >only_diff< we save the changes as ldif
+         *  or we write our changes directly to the ldap database
+         */
+        if($only_ldif){
+          $this->deps_to_migrate[$key]['before'] = $this->array_to_ldif($attrs);
+          $this->deps_to_migrate[$key]['after']  = $this->array_to_ldif($new_attrs);
+        }else{
+          $ldap->cd($attrs['dn']);
+          if(!$ldap->modify($new_attrs)){
+            print_red(sprintf(_("Failed to migrate the department '%s' into GOsa, error message is as follows '%s'."),$attrs['dn'],$ldap->get_error()));
+            return(false);
+          }
+        }
+      }
+    }
+    return(TRUE);
+  }
+
+
+  /* Check Acls if there is at least one object with acls defined 
+   */
+  function check_administrativeAccount()
+  {
+    /* Establish ldap connection */
+    $cv = $this->parent->captured_values;
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+
+    /* Search for gosaAcls */ 
+    $ldap->cd($cv['base']);
+    $res = $ldap->cat($cv['base']);
+    
+    if(!$res){
+      $this->checks['acls']['STATUS']    = FALSE;
+      $this->checks['acls']['STATUS_MSG']= _("LDAP query failed");
+      $this->checks['acls']['ERROR_MSG'] = _("Possibly the 'root object' is missing.");
+    }else{
+      $found = false;
+      $username = "";
+      $attrs = $ldap->fetch();
+      if(isset($attrs['gosaAclEntry'])){
+        $acls = $attrs['gosaAclEntry'];
+        for($i = 0 ; $i < $acls['count'] ; $i++){
+          $acl = $acls[$i];
+          $tmp = split(":",$acl);
+          if($tmp[1] == "psub"){
+            $members = split(",",$tmp[2]);
+            foreach($members as $member){
+              $member = base64_decode($member);
+
+              /* Check if acl owner is a valid GOsa user account */
+              $ldap->cat($member,array("objectClass","uid","cn"));
+              $ret = $ldap->fetch();
+
+              if(isset($ret['objectClass']) && in_array("posixGroup",$ret['objectClass'])){
+                $found = TRUE;
+                $username .= "ACL-Group:&nbsp;".$ret['cn'][0]."<br>";
+              }elseif(isset($ret['objectClass']) && in_array("gosaAccount",$ret['objectClass']) &&
+                  in_array("organizationalPerson",$ret['objectClass']) &&
+                  in_array("inetOrgPerson",$ret['objectClass'])){
+                $found = TRUE;
+                $username .= "ACL:&nbsp;".$ret['uid'][0]."<br>";
+              }
+            }
+          }elseif($tmp[1] == "role"){
+
+            /* Check if acl owner is a valid GOsa user account */
+            $ldap->cat(base64_decode($tmp[2]),array("gosaAclTemplate"));
+            $ret = $ldap->fetch();
+
+            if(isset($ret['gosaAclTemplate'])){
+              $cnt = $ret['gosaAclTemplate']['count'];
+              for($e = 0 ; $e < $cnt ; $e++){
+
+                $a_str = $ret['gosaAclTemplate'][$e];
+                if(preg_match("/^[0-9]*:psub:/",$a_str) && preg_match("/:all;cmdrw$/",$a_str)){
+
+                  $members = split(",",$tmp[3]);
+                  foreach($members as $member){
+                    $member = base64_decode($member);
+
+                    /* Check if acl owner is a valid GOsa user account */
+                    $ldap->cat($member,array("objectClass","uid"));
+                    $ret = $ldap->fetch();
+  
+                    if(isset($ret['objectClass']) && in_array("gosaAccount",$ret['objectClass']) &&
+                        in_array("organizationalPerson",$ret['objectClass']) &&
+                        in_array("inetOrgPerson",$ret['objectClass'])){
+                      $found = TRUE;
+                      $username .= "ACL Role:&nbsp;".$ret['uid'][0]."<br>";
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+
+      # For debugging
+      #echo $username;
+
+      if($found){
+        $this->checks['acls']['STATUS']    = TRUE;
+        $this->checks['acls']['STATUS_MSG']= _("Ok");
+        $this->checks['acls']['ERROR_MSG'] = "";
+      }else{
+        $this->checks['acls']['STATUS']    = FALSE;
+        $this->checks['acls']['STATUS_MSG']= _("Failed");
+        $this->checks['acls']['ERROR_MSG']= _("There is no GOsa administrator account inside your LDAP.")."&nbsp;";
+        $this->checks['acls']['ERROR_MSG'].= "<input type='submit' name='create_acls' value='"._("Create")."'>";
+      }
+    }
+    return($ldap->count()>=1);
+  }
+
+
+
+  function create_admin($only_ldif = FALSE)
+  {
+    /* Reset '' */
+    $this->acl_create_changes="";
+
+    /* Object that should receive admin acls */
+    $dn = $this->acl_create_selected;
+
+    /* Get collected configuration settings */
+    $cv = $this->parent->captured_values;
+
+    /* Establish ldap connection */
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+
+    /* Get current base attributes */
+    $ldap->cd($cv['base']);
+    $ldap->cat($cv['base'],array("dn","objectClass","gosaAclEntry"));
+    $attrs = $ldap->fetch();
+
+    /* Add acls for the selcted user to the base */
+    $attrs_new['objectClass'] = array("gosaACL");
+
+    for($i = 0; $i < $attrs['objectClass']['count']; $i ++){
+      if(!in_array_ics($attrs['objectClass'][$i],$attrs_new['objectClass'])){
+        $attrs_new['objectClass'][] = $attrs['objectClass'][$i];
+      }
+    }
+
+    $acl = "0:psub:".base64_encode($dn).":all;cmdrw";    
+    $attrs_new['gosaAclEntry'][] = $acl;
+    if(isset($attrs['gosaAclEntry'])){
+      for($i = 0 ; $i < $attrs['gosaAclEntry']['count']; $i ++){
+          
+        $prio = preg_replace("/[:].*$/","",$attrs['gosaAclEntry'][$i]);
+        $rest = preg_replace("/^[^:]/","",$attrs['gosaAclEntry'][$i]);
+        $data = ($prio+1).$rest;
+        $attrs_new['gosaAclEntry'][] = $data;
+      }
+    }
+
+    if($only_ldif){
+      $this->acl_create_changes ="\n".($ldap->fix($cv['base']))."\n";
+      $this->acl_create_changes.=$this->array_to_ldif($attrs)."\n";
+      $this->acl_create_changes.="\n".($ldap->fix($cv['base']))."\n";
+      $this->acl_create_changes.=$this->array_to_ldif($attrs_new);
+    }else{
+   
+      $ldap->cd($cv['base']);
+      if(!$ldap->modify($attrs_new)){
+        print_red(sprintf(_("Adding acls for user '%s' failed, ldap says '%s'."),$dn,$ldap->get_error()));
+        return(FALSE);
+      }else{
+        return(TRUE);
+      }
+    }
+  }
+  
+  function create_admin_user()
+  {
+    $pw1 = $pw2 = "";
+    $uid = "";
+  
+    if(isset($_POST['new_user_uid'])){
+      $uid = $_POST['new_user_uid'];
+    }
+    if(isset($_POST['new_user_password'])){
+      $pw1 = $_POST['new_user_password'];
+    }
+    if(isset($_POST['new_user_password2'])){
+      $pw2 = $_POST['new_user_password2'];
+    }
+  
+    if(empty($pw1) || empty($pw2) | ($pw1 != $pw2)){
+      print_red(_("Specified passwords are empty or not equal."));
+      return false;
+    }
+    if(!is_uid($uid) || empty($uid)){
+      print_red(_("Please specify a valid uid."));
+      return false;
+    }
+    
+
+    /* Establish ldap connection */
+    $cv = $this->parent->captured_values;
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+
+    /* Get current base attributes */
+    $ldap->cd($cv['base']);
+  
+    $people_ou = trim($cv['peopleou']);
+    if(!empty($people_ou)){
+      $people_ou = trim($people_ou).",";
+    }
+
+    if($cv['peopledn'] == "cn"){
+      $dn = "cn=System Administrator,".$people_ou.$cv['base'];
+    }else{
+      $dn = "uid=".$uid.",".$people_ou.$cv['base'];
+    }
+
+    $methods = @passwordMethod::get_available_methods();
+    $p_m = $methods[$cv['encryption']];
+    $p_c = new $p_m(array());
+    $hash = $p_c->generate_hash($pw2);
+
+    $new_user=array();
+    $new_user['objectClass']= array("top","person","gosaAccount","organizationalPerson","inetOrgPerson");
+    $new_user['givenName']  = "System";
+    $new_user['sn']  = "Administrator";
+    $new_user['cn']  = "System Administrator";
+    $new_user['uid'] = $uid;
+    $new_user['userPassword'] = $hash;
+   
+    $ldap->cd($cv['base']);
+  
+    $ldap->cat($dn,array("dn"));
+    if($ldap->count()){
+      print_red(sprintf(_("Could not add administrative user, there is already an object with the same dn '%s' in your ldap database."),$dn));
+      return(FALSE);  
+    }
+
+    $ldap->create_missing_trees(preg_replace("/^[^,]+,/","",$dn));
+    $ldap->cd($dn);  
+    $res = $ldap->add($new_user);
+    $this->acl_create_selected = $dn;
+    $this->create_admin();
+    
+    if(!$res){
+      print_red($ldap->get_error());
+      return(FALSE);
+    }
+  
+    $this->acl_create_dialog=FALSE;        
+    $this->check_administrativeAccount();
+    return(TRUE);
+  }
+
+  function migrate_outside_winstations($perform = FALSE)
+  {
+    /* Establish ldap connection */
+    $cv = $this->parent->captured_values;
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+
+    $ldap->cd($cv['base']);
+
+    /* Check if there was a destination department posted */
+    if(isset($_POST['move_winstation_to'])){
+      $destination_dep = $_POST['move_winstation_to'];
+    }else{
+      print_red(_("Couldn't move users to specified department."));
+      return(false);
+    }
+    foreach($this->outside_winstations as $b_dn => $data){
+      $this->outside_winstations[$b_dn]['ldif'] ="";
+      if($data['selected']){
+        $dn = base64_decode($b_dn);
+        $d_dn = preg_replace("/,.*$/",",".base64_decode($destination_dep),$dn);
+        if(!$perform){
+          $this->outside_winstations[$b_dn]['ldif'] = _("Winstation will be moved from").":<br>\t".($ldap->fix($dn))."<br>"._("to").":<br>\t".($ldap->fix($d_dn));
+
+
+          /* Check if there are references to this object */
+          $ldap->search("(&(member=".$dn.")(|(objectClass=gosaGroupOfNames)(objectClass=groupOfNames)))",array('dn'));
+          $refs = "";
+          while($attrs = $ldap->fetch()){
+            $ref_dn = $attrs['dn'];
+            $refs .= "<br />\t".$ref_dn;
+          } 
+          if(!empty($refs)){ 
+            $this->outside_winstations[$b_dn]['ldif'] .= "<br /><br /><i>"._("Updating following references too").":</i>".$refs;
+          }
+
+        }else{
+          $this->move($dn,$d_dn);
+        }
+      }
+    }
+  }
+  
+
+  function migrate_outside_groups($perform = FALSE)
+  {
+    /* Establish ldap connection */
+    $cv = $this->parent->captured_values;
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+
+    $ldap->cd($cv['base']);
+
+    /* Check if there was a destination department posted */
+    if(isset($_POST['move_group_to'])){
+      $destination_dep = $_POST['move_group_to'];
+    }else{
+      print_red(_("Couldn't move users to specified department."));
+      return(false);
+    }
+    foreach($this->outside_groups as $b_dn => $data){
+      $this->outside_groups[$b_dn]['ldif'] ="";
+      if($data['selected']){
+        $dn = base64_decode($b_dn);
+        $d_dn = preg_replace("/,.*$/",",".base64_decode($destination_dep),$dn);
+        if(!$perform){
+
+          $this->outside_groups[$b_dn]['ldif'] = _("Group will be moved from").":<br>\t".($ldap->fix($dn))."<br>"._("to").":<br>\t".($ldap->fix($d_dn));
+
+          /* Check if there are references to this object */
+          $ldap->search("(&(member=".$dn.")(|(objectClass=gosaGroupOfNames)(objectClass=groupOfNames)))",array('dn'));
+          $refs = "";
+          while($attrs = $ldap->fetch()){
+            $ref_dn = $attrs['dn'];
+            $refs .= "<br />\t".$ref_dn;
+          } 
+          if(!empty($refs)){ 
+            $this->outside_groups[$b_dn]['ldif'] .= "<br /><br /><i>"._("Updating following references too").":</i>".$refs;
+          }
+
+        }else{
+          $this->move($dn,$d_dn);
+        }
+      }
+    }
+  }
+  
+
+  function migrate_outside_users($perform = FALSE)
+  {
+    /* Establish ldap connection */
+    $cv = $this->parent->captured_values;
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+
+    $ldap->cd($cv['base']);
+
+    /* Check if there was a destination department posted */
+    if(isset($_POST['move_user_to'])){
+      $destination_dep = $_POST['move_user_to'];
+    }else{
+      print_red(_("Couldn't move users to specified department."));
+      return(false);
+    }
+      
+    foreach($this->outside_users as $b_dn => $data){
+      $this->outside_users[$b_dn]['ldif'] ="";
+      if($data['selected']){
+        $dn = base64_decode($b_dn);
+        $d_dn = preg_replace("/,.*$/",",".base64_decode($destination_dep),$dn);
+        if(!$perform){
+          $this->outside_users[$b_dn]['ldif'] = _("User will be moved from").":<br>\t".($ldap->fix($dn))."<br>"._("to").":<br>\t".($ldap->fix($d_dn));
+
+          /* Check if there are references to this object */
+          $ldap->search("(&(member=".$dn.")(|(objectClass=gosaGroupOfNames)(objectClass=groupOfNames)))",array('dn'));
+          $refs = "";
+          while($attrs = $ldap->fetch()){
+            $ref_dn = $attrs['dn'];
+            $refs .= "<br />\t".$ref_dn;
+          } 
+          if(!empty($refs)){ 
+            $this->outside_users[$b_dn]['ldif'] .= "<br /><br /><i>"._("The following references will be updated").":</i>".$refs;
+          }
+
+        }else{
+          $this->move($dn,$d_dn);
+        }
+      }
+    }
+  }
+  
+
+  function execute()
+  {
+    /* Initialise checks if this is the first call */
+    if(!$this->checks_initialised || isset($_POST['reload'])){
+      $this->initialize_checks();
+      $this->checks_initialised = TRUE;
+    }
+
+    /*************
+     * Winstations outside the group ou 
+     *************/
+    
+    if(isset($_POST['outside_winstations_dialog_cancel'])){
+      $this->outside_winstations_dialog = FALSE;
+      $this->dialog = FALSE;
+      $this->show_details = FALSE;
+    }
+   
+    if(isset($_POST['outside_winstations_dialog_whats_done'])){
+      $this->migrate_outside_winstations(FALSE);
+    }
+    if(isset($_POST['outside_winstations_dialog_perform'])){
+      $this->migrate_outside_winstations(TRUE);
+      $this->search_outside_winstations();
+      $this->dialog = FALSE;
+      $this->show_details = FALSE;
+      $this->outside_winstations_dialog = FALSE;
+    }
+
+    if(isset($_POST['outside_winstations_dialog'])){
+      $this->outside_winstations_dialog = TRUE;
+      $this->dialog = TRUE;
+    }
+    
+    if($this->outside_winstations_dialog){
+
+      /* Fix displayed dn syntax */ 
+      $tmp = $this->outside_winstations;
+      foreach($tmp as $key => $data){
+        $tmp[$key]['dn'] = @LDAP::fix($data['dn']);
+      }
+
+      $smarty = get_smarty();
+      $smarty->assign("ous",$this->get_all_winstation_ous());
+      $smarty->assign("method","outside_winstations");
+      $smarty->assign("outside_winstations",$tmp);
+      return($smarty->fetch(get_template_path("setup_migrate.tpl",TRUE,dirname(__FILE__))));
+    }
+    /*************
+     * Groups outside the group ou 
+     *************/
+    
+    if(isset($_POST['outside_groups_dialog_cancel'])){
+      $this->outside_groups_dialog = FALSE;
+      $this->show_details = FALSE;
+      $this->dialog = FALSE;
+    }
+   
+    if(isset($_POST['outside_groups_dialog_whats_done'])){
+      $this->show_details= TRUE;
+      $this->migrate_outside_groups(FALSE);
+    }
+    if(isset($_POST['outside_groups_dialog_refresh'])){
+      $this->show_details= FALSE;
+    }
+
+    if(isset($_POST['outside_groups_dialog_perform'])){
+      $this->migrate_outside_groups(TRUE);
+      $this->dialog = FALSE;
+      $this->show_details = FALSE;
+      $this->outside_groups_dialog = FALSE;
+      $this->initialize_checks();
+    }
+
+    if(isset($_POST['outside_groups_dialog'])){
+      $this->outside_groups_dialog = TRUE;
+      $this->dialog = TRUE;
+    }
+    
+    if($this->outside_groups_dialog){
+
+      /* Fix displayed dn syntax */ 
+      $tmp = $this->outside_groups;
+      foreach($tmp as $key => $data){
+        $tmp[$key]['dn'] = @LDAP::fix($data['dn']);
+      }
+
+      $smarty = get_smarty();
+      $smarty->assign("ous",$this->get_all_group_ous());
+      $smarty->assign("method","outside_groups");
+      $smarty->assign("outside_groups",$tmp);
+      $smarty->assign("group_details", $this->show_details);
+      return($smarty->fetch(get_template_path("setup_migrate.tpl",TRUE,dirname(__FILE__))));
+    }
+    /*************
+     * User outside the people ou 
+     *************/
+    
+    if(isset($_POST['outside_users_dialog_cancel'])){
+      $this->outside_users_dialog = FALSE;
+      $this->dialog = FALSE;
+      $this->show_details = FALSE;
+    }
+   
+    if(isset($_POST['outside_users_dialog_whats_done'])){
+      $this->show_details= TRUE;
+      $this->migrate_outside_users(FALSE);
+    }
+    if(isset($_POST['outside_users_dialog_perform'])){
+      $this->migrate_outside_users(TRUE);
+      $this->initialize_checks();
+      $this->dialog = FALSE;
+      $this->show_details = FALSE;
+      $this->outside_users_dialog = FALSE;
+    }
+
+    if (isset($_POST['outside_users_dialog_refresh'])){
+      $this->show_details= FALSE;
+    }
+
+    if(isset($_POST['outside_users_dialog'])){
+      $this->outside_users_dialog = TRUE;
+      $this->dialog = TRUE;
+    }
+    
+    if($this->outside_users_dialog){
+
+      /* Fix displayed dn syntax */ 
+      $tmp = $this->outside_users;
+      foreach($tmp as $key => $data){
+        $tmp[$key]['dn'] = @LDAP::fix($data['dn']);
+      }
+
+      $smarty = get_smarty();
+      $smarty->assign("ous",$this->get_all_people_ous());
+      $smarty->assign("method","outside_users");
+      $smarty->assign("outside_users",$tmp);
+      $smarty->assign("user_details", $this->show_details);
+      return($smarty->fetch(get_template_path("setup_migrate.tpl",TRUE,dirname(__FILE__))));
+    }
+    /*************
+     * Root object check  
+     *************/
+  
+    if(isset($_POST['retry_root_create'])){
+
+      $state = $this->checks['root']['STATUS'];
+      $this->checkBase(FALSE);
+      if($state != $this->checks['root']['STATUS']){
+        $this->initialize_checks();
+      }
+    }
+    /*************
+     * User Migration handling 
+     *************/
+
+    if(isset($_POST['retry_acls'])){
+      $this->check_administrativeAccount();
+    }
+
+    if(isset($_POST['create_acls'])){
+      $this->acl_create_dialog = TRUE;
+      $this->dialog = TRUE;
+    }
+  
+    if(isset($_POST['create_acls_cancel'])){
+      $this->acl_create_dialog = FALSE;
+      $this->dialog = FALSE;
+      $this->show_details = FALSE;
+    }
+
+#    if(isset($_POST['create_acls_create_confirmed'])){
+#      if($this->create_admin()){
+#        $this->acl_create_dialog = FALSE;
+#        $this->dialog = FALSE;
+#      $this->show_details = FALSE;
+#        $this->initialize_checks();
+#      }
+#    }
+
+    if(isset($_POST['create_acls_create'])){
+      $this->create_admin(TRUE);
+    }
+
+    if(isset($_POST['create_admin_user'])){
+      if($this->create_admin_user()){
+        $this->dialog = FALSE;
+      $this->show_details = FALSE;
+      }
+    }
+
+    if($this->acl_create_dialog){
+      $smarty = get_smarty();
+  
+      $uid = "admin";
+      if(isset($_POST['new_user_uid'])){
+        $uid = $_POST['new_user_uid'];
+      }
+
+      $smarty->assign("new_user_uid",$uid);
+      $smarty->assign("new_user_password",@$_POST['new_user_password']);
+      $smarty->assign("new_user_password2",@$_POST['new_user_password2']);
+      $smarty->assign("method","create_acls");
+      $smarty->assign("acl_create_selected",$this->acl_create_selected);
+      $smarty->assign("what_will_be_done_now",$this->acl_create_changes);
+      return($smarty->fetch(get_template_path("setup_migrate.tpl",TRUE,dirname(__FILE__))));
+    }
+
+    /*************
+     * User Migration handling 
+     *************/
+
+    /* Refresh list of deparments */
+    if(isset($_POST['users_visible_migrate_refresh'])){
+      $this->check_gosaAccounts();
+    }
+
+    /* Open migration dialog */
+    if(isset($_POST['users_visible_migrate'])){
+      $this->show_details= FALSE;
+      $this->users_migration_dialog = TRUE;
+      $this->dialog =TRUE;
+    }
+
+    /* Close migration dialog */
+    if(isset($_POST['users_visible_migrate_close'])){
+      $this->users_migration_dialog = FALSE;
+      $this->dialog =FALSE;
+      $this->show_details = FALSE;
+    }
+
+    /* Start migration */
+    if(isset($_POST['users_visible_migrate_migrate'])){
+      if($this->migrate_gosaAccounts()){
+        $this->initialize_checks();
+        $this->dialog = FALSE;
+        $this->show_details = FALSE;
+        $this->users_migration_dialog = FALSE;
+      }
+    }
+
+    /* Start migration */
+    if(isset($_POST['users_visible_migrate_whatsdone'])){
+      $this->migrate_gosaAccounts(TRUE);
+    }
+
+    /* Display migration dialog */
+    if($this->users_migration_dialog){
+
+      /* Fix displayed dn syntax */ 
+      $tmp = $this->users_to_migrate;
+      foreach($tmp as $key => $data){
+        $tmp[$key]['dn'] = @LDAP::fix($data['dn']);
+      }
+
+      $smarty = get_smarty();
+      $smarty->assign("users_to_migrate",$tmp);
+      $smarty->assign("method","migrate_users");
+      $smarty->assign("user_details", $this->show_details);
+      return($smarty->fetch(get_template_path("setup_migrate.tpl",TRUE,dirname(__FILE__))));
+    }
+
+
+    /*************
+     * Department Migration handling 
+     *************/
+
+    /* Refresh list of deparments */
+    if(isset($_POST['deps_visible_migrate_refresh'])){
+      $this->check_organizationalUnits();
+      $this->show_details= FALSE;
+    }
+
+    /* Open migration dialog */
+    if(isset($_POST['deps_visible_migrate'])){
+      $this->dep_migration_dialog = TRUE;
+      $this->dialog =TRUE;
+    }
+
+    /* Close migration dialog */
+    if(isset($_POST['deps_visible_migrate_close'])){
+      $this->dep_migration_dialog = FALSE;
+      $this->dialog =FALSE;
+      $this->show_details = FALSE;
+    }
+
+    /* Start migration */
+    if(isset($_POST['deps_visible_migrate_migrate'])){
+      if($this->migrate_organizationalUnits()){
+        $this->show_details= FALSE;
+        $this->check_organizationalUnits();
+        $this->dialog = FALSE;
+        $this->dep_migration_dialog = FALSE;
+      }
+    }
+
+    /* Start migration */
+    if(isset($_POST['deps_visible_migrate_whatsdone'])){
+      $this->migrate_organizationalUnits(TRUE);
+    }
+
+    /* Display migration dialog */
+    if($this->dep_migration_dialog){
+      $smarty = get_smarty();
+   
+      /* Fix displayed dn syntax */ 
+      $tmp = $this->deps_to_migrate;
+      foreach($tmp as $key => $data){
+        $tmp[$key]['dn'] = @LDAP::fix($data['dn']);
+      }
+
+      $smarty->assign("deps_to_migrate",$tmp);
+      $smarty->assign("method","migrate_deps");
+      $smarty->assign("deps_details", $this->show_details);
+      return($smarty->fetch(get_template_path("setup_migrate.tpl",TRUE,dirname(__FILE__))));
+    }
+
+    $smarty = get_smarty();
+    $smarty->assign("checks",$this->checks);
+    $smarty->assign("method","default");
+    return($smarty->fetch(get_template_path("setup_migrate.tpl",TRUE,dirname(__FILE__))));
+  }
+
+
+  function save_object()
+  {
+    $this->is_completed= TRUE;
+
+    /* Capture all selected winstations from outside_winstations_dialog */
+    if($this->outside_winstations_dialog){
+      foreach($this->outside_winstations as $dn => $data){
+        if(isset($_POST['select_winstation_'.$dn])){
+          $this->outside_winstations[$dn]['selected'] = TRUE;
+        }else{
+          $this->outside_winstations[$dn]['selected'] = FALSE;
+        }
+      }
+    }
+
+    /* Capture all selected groups from outside_groups_dialog */
+    if($this->outside_groups_dialog){
+      foreach($this->outside_groups as $dn => $data){
+        if(isset($_POST['select_group_'.$dn])){
+          $this->outside_groups[$dn]['selected'] = TRUE;
+        }else{
+          $this->outside_groups[$dn]['selected'] = FALSE;
+        }
+      }
+    }
+
+    /* Capture all selected users from outside_users_dialog */
+    if($this->outside_users_dialog){
+      foreach($this->outside_users as $dn => $data){
+        if(isset($_POST['select_user_'.$dn])){
+          $this->outside_users[$dn]['selected'] = TRUE;
+        }else{
+          $this->outside_users[$dn]['selected'] = FALSE;
+        }
+      }
+    }
+
+    /* Get "create acl" dialog posts */
+    if($this->acl_create_dialog){
+
+      if(isset($_POST['create_acls_create_abort'])){
+        $this->acl_create_selected = "";
+      }
+    }
+
+    /* Get selected departments */
+    if($this->dep_migration_dialog){
+      foreach($this->deps_to_migrate as $id => $data){
+        if(isset($_POST['migrate_'.$id])){
+          $this->deps_to_migrate[$id]['checked'] = TRUE;
+        }else{
+          $this->deps_to_migrate[$id]['checked'] = FALSE;
+        }
+      }
+    }
+
+    /* Get selected users */
+    if($this->users_migration_dialog){
+      foreach($this->users_to_migrate as $id => $data){
+        if(isset($_POST['migrate_'.$id])){
+          $this->users_to_migrate[$id]['checked'] = TRUE;
+        }else{
+          $this->users_to_migrate[$id]['checked'] = FALSE;
+        }
+      }
+    }
+  }
+
+
+  /* Check if the root object exists.
+   * If the parameter just_check is true, then just check if the 
+   *  root object is missing and update the info messages.
+   * If the Parameter is false, try to create a new root object.
+   */
+  function checkBase($just_check = TRUE)
+  {
+    /* Get collected setup informations */
+    $cv = $this->parent->captured_values;
+
+    /* Establish ldap connection */
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+
+    /* Check if root object exists */
+    $ldap->cd($cv['base']);
+    $res = $ldap->search("(objectClass=*)");
+    $err = ldap_errno($ldap->cid); 
+
+    if( !$res || 
+        $err == 0x20 ||  # LDAP_NO_SUCH_OBJECT
+        $err == 0x40) {  # LDAP_NAMING_VIOLATION
+
+      /* Root object doesn't exists 
+       */
+      if($just_check){
+        $this->checks['root']['STATUS']    = FALSE;
+        $this->checks['root']['STATUS_MSG']= _("Failed");
+        $this->checks['root']['ERROR_MSG'] =  _("The LDAP root object is missing. It is required to use your LDAP service.").'&nbsp;';
+        $this->checks['root']['ERROR_MSG'].=  "<input type='submit' name='retry_root_create' value='"._("Try to create root object")."'>";
+        return(FALSE);
+      }else{
+
+        /* Add root object */ 
+        $ldap->cd($cv['base']);
+        $res = $ldap->create_missing_trees($cv['base']);
+
+        /* If adding failed, tell the user */
+        if(!$res){
+          $this->checks['root']['STATUS']    = FALSE;
+          $this->checks['root']['STATUS_MSG']= _("Failed");
+          $this->checks['root']['ERROR_MSG'] = _("Root object couldn't be created, you should try it on your own.");
+          $this->checks['root']['ERROR_MSG'].= "&nbsp;<input type='submit' name='retry_root_create' value='"._("Try to create root object")."'>";
+          return($res);;
+        }
+      }
+    }
+
+    /* Create & remove of dummy object was successful */
+    $this->checks['root']['STATUS']    = TRUE;
+    $this->checks['root']['STATUS_MSG']= _("Ok");
+  }
+
+
+  /* Return ldif information for a 
+   * given attribute array 
+   */
+  function array_to_ldif($atts)
+  {
+    $ret = "";
+    unset($atts['count']);
+    unset($atts['dn']);
+    foreach($atts as $name => $value){
+      if(is_numeric($name)) {
+        continue;
+      }
+      if(is_array($value)){
+        unset($value['count']);
+        foreach($value as $a_val){
+          $ret .= $name.": ". $a_val."\n";
+        }
+      }else{
+        $ret .= $name.": ". $value."\n";
+      }
+    }
+    return(preg_replace("/\n$/","",$ret));
+  }
+
+
+  function get_user_list()
+  {
+    /* Get collected configuration settings */
+    $cv = $this->parent->captured_values;
+
+    /* Establish ldap connection */
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+    
+    $ldap->cd($cv['base']);
+    $ldap->search("(objectClass=gosaAccount)",array("dn"));
+  
+    $tmp = array();
+    while($attrs = $ldap->fetch()){
+      $tmp[base64_encode($attrs['dn'])] = @LDAP::fix($attrs['dn']);
+    }
+    return($tmp);
+  }
+
+
+ function get_all_people_ous()
+  {
+    /* Get collected configuration settings */
+    $cv = $this->parent->captured_values;
+    $people_ou = trim($cv['peopleou']);
+
+    /* Establish ldap connection */
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+
+
+    /*****************
+     * If people ou is NOT empty
+     * search for for all objects matching the given container
+     *****************/
+    if(!empty($people_ou)){
+      $ldap->search("(".$people_ou.")",array("dn"));
+
+      /* Create people ou if there is currently none */
+      if($ldap->count() == 0 ){
+        $add_dn = $cv['peopleou'].",".$cv['base'];
+        $naming_attr = preg_replace("/=.*$/","",$add_dn);
+        $naming_value = preg_replace("/^[^=]*+=([^,]*).*$/","\\1",$add_dn);
+        $add = array();
+        $add['objectClass'] = array("organizationalUnit");
+        $add[$naming_attr] = $naming_value;
+        $ldap->cd($cv['base']);
+        $ldap->create_missing_trees(preg_replace("/^[^,]+,/","",$add_dn));
+        $ldap->cd($add_dn);
+        $ldap->add($add);
+      }
+
+      /* Create result */
+      $ldap->search("(".$cv['peopleou'].")",array("dn"));
+      $tmp = array();
+      while($attrs= $ldap->fetch()){
+        if(!preg_match("/ou=snapshots,/",$attrs['dn'])){
+          $tmp[base64_encode($attrs['dn'])] = $ldap->fix($attrs['dn']);
+        }
+      }
+    } else{
+
+      /************
+       * If people ou is empty
+       * Get all valid gosaDepartments
+       ************/
+      $ldap->cd($cv['base']);
+      $tmp = array();
+      $ldap->search("(&(objectClass=gosaDepartment)(ou=*))",array("dn"));
+      $tmp[base64_encode($cv['base'])] = $ldap->fix($cv['base']);
+      while($attrs = $ldap->fetch()){
+        $tmp[base64_encode($attrs['dn'])] = $ldap->fix($attrs['dn']);;
+      }
+    }
+    return($tmp);
+  }
+
+
+  function get_all_winstation_ous()
+  {
+    /* Get collected configuration settings */
+    $cv = $this->parent->captured_values;
+
+    /* Establish ldap connection */
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+
+    /* Get winstation ou */
+    if($cv['generic_settings']['wws_ou_active']) {
+      $winstation_ou = $cv['generic_settings']['ws_ou'];
+    }else{
+      $winstation_ou = "ou=winstations";
+    }
+
+    $ldap->cd($cv['base']);
+    $ldap->search("(".$winstation_ou.")",array("dn"));
+  
+    if($ldap->count() == 0 ){
+      $add_dn = $winstation_ou.",ou=systems,".$cv['base'];
+      $naming_attr = preg_replace("/=.*$/","",$add_dn);
+      $naming_value = preg_replace("/^[^=]*+=([^,]*).*$/","\\1",$add_dn);
+      $add = array();
+      $add['objectClass'] = array("organizationalUnit");
+      $add[$naming_attr] = $naming_value;
+
+      $ldap->cd($cv['base']);
+      $ldap->create_missing_trees(preg_replace("/^[^,]+,/","",$add_dn));
+      $ldap->cd($add_dn);
+      $ldap->add($add);
+    }
+
+    $ldap->search("(".$winstation_ou.")",array("dn"));
+    $tmp = array();
+    while($attrs= $ldap->fetch()){
+      if(!preg_match("/ou=snapshots,/",$attrs['dn'])){
+        $tmp[base64_encode($attrs['dn'])] = $ldap->fix($attrs['dn']);
+      }
+    }
+    return($tmp); 
+  }
+
+
+ function get_all_group_ous()
+  {
+    /* Get collected configuration settings */
+    $cv = $this->parent->captured_values;
+
+    /* Establish ldap connection */
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+
+    $group_ou = trim($cv['groupou']);
+    if(!empty($group_ou)){
+      $group_ou = trim($group_ou);
+    }
+
+    /************
+     * If group ou is NOT empty
+     * Get all valid group ous, create one if necessary
+     ************/
+    $ldap->cd($cv['base']);
+    if(!empty($group_ou)){
+      $ldap->search("(".$group_ou.")",array("dn"));
+      if($ldap->count() == 0 ){
+        $add_dn = $group_ou.$cv['base'];
+        $naming_attr = preg_replace("/=.*$/","",$add_dn);
+        $naming_value = preg_replace("/^[^=]*+=([^,]*).*$/","\\1",$add_dn);
+        $add = array();
+        $add['objectClass'] = array("organizationalUnit");
+        $add[$naming_attr] = $naming_value;
+
+        $ldap->cd($cv['base']);
+        $ldap->create_missing_trees(preg_replace("/^[^,]+,/","",$add_dn));
+        $ldap->cd($add_dn);
+        $ldap->add($add);
+      }
+      $ldap->search("(".$group_ou.")",array("dn"));
+      $tmp = array();
+      while($attrs= $ldap->fetch()){
+        if(!preg_match("/ou=snapshots,/",$attrs['dn'])){
+          $tmp[base64_encode($attrs['dn'])] = $ldap->fix($attrs['dn']);
+        }
+      }
+    }else{
+      /************
+       * If group ou is empty
+       * Get all valid gosaDepartments
+       ************/
+      $ldap->cd($cv['base']);
+      $tmp = array();
+      $ldap->search("(&(objectClass=gosaDepartment)(ou=*))",array("dn"));
+      $tmp[base64_encode($cv['base'])] = $ldap->fix($cv['base']);
+      while($attrs = $ldap->fetch()){
+        $tmp[base64_encode($attrs['dn'])] = $ldap->fix($attrs['dn']);;
+      }
+    }
+    return($tmp);
+  }
+
+
+  function get_group_list()
+  {
+    /* Get collected configuration settings */
+    $cv = $this->parent->captured_values;
+
+    /* Establish ldap connection */
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+    
+    $ldap->cd($cv['base']);
+    $ldap->search("(objectClass=posixGroup)",array("dn"));
+  
+    $tmp = array();
+    while($attrs = $ldap->fetch()){
+      $tmp[base64_encode($attrs['dn'])] = @LDAP::fix($attrs['dn']);
+    }
+    return($tmp);
+  }
+
+
+  function move($source,$destination)
+  {
+    /* Get collected configuration settings */
+    $cv = $this->parent->captured_values;
+
+    /* Establish ldap connection */
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+
+     /* Update object references in gosaGroupOfNames */
+    $ogs_to_fix = array();
+    $ldap->cd($cv['base']);
+    $ldap->search('(&(objectClass=gosaGroupOfNames)(member='.@LDAP::fix($source).'))', array('cn','member'));
+    while ($attrs= $ldap->fetch()){
+      $dn = $attrs['dn'];
+      $attrs = $this->cleanup_array($attrs);
+      $member_new = array($destination);
+      foreach($attrs['member'] as $member){
+        if($member != $source){
+          $member_new[] = $member;
+        }
+      }
+      $attrs['member'] = $member_new;
+      $ogs_to_fix[$dn] = $attrs;
+    }
+
+    /* Copy source to destination dn */
+    $ldap->cat($source);
+    $new_data = $this->cleanup_array($ldap->fetch());
+    $ldap->cd($destination);
+    $res = $ldap->add($new_data);
+
+    /* Display warning if copy failed */
+    if(!$res){
+      print_red(_("Failed to copy '%s' to '%s'. LDAP says '%s'."),$source,$destination,$ldap->get_error());
+    }else{
+      $res = $ldap->rmDir($source);
+      show_ldap_error($ldap->get_error(),_("Something went wrong while copying dns."));
+
+      /* Object is copied, so update its references */
+      foreach($ogs_to_fix as $dn => $data){
+        $ldap->cd($dn);
+        $ldap->modify($data);
+      }
+    }
+  }
+
+  
+  /* Cleanup ldap result to be able to write it be to ldap */
+  function cleanup_array($attrs)
+  {
+    foreach($attrs as $key => $value) {
+      if(is_numeric($key) || in_array($key,array("count","dn"))){
+        unset($attrs[$key]);
+      }
+      if(is_array($value) && isset($value['count'])){
+        unset($attrs[$key]['count']);
+      }
+    }
+    return($attrs);
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/setup/class_setupStep_Schema.inc b/gosa-core/setup/class_setupStep_Schema.inc
new file mode 100644 (file)
index 0000000..2008128
--- /dev/null
@@ -0,0 +1,110 @@
+<?php
+
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2007 Fabian Hickert
+
+   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 Step_Schema extends setup_step
+{
+  var $checked = array();
+  var $not_checked = array();
+  var $schema_readable  = FALSE;
+  var $attributes       = array("enable_schema_check","samba_version");
+  var $enable_schema_check = TRUE;
+  var $samba_version       = 3;
+
+  function Step_Schema()
+  {
+    $this->update_strings();
+  }
+
+  
+  function update_strings()
+  {
+    $this->s_title      = _("LDAP schema check");
+    $this->s_title_long = _("LDAP schema check");
+    $this->s_info       = _("Perform test on your current LDAP schema");
+  }
+
+  
+  function execute()
+  {
+    $this->check_schema();
+    $failed_checks = 0 ; 
+    foreach($this->checked as $val) {
+      if(!$val['STATUS']){
+        $failed_checks ++;
+      }
+    }
+
+    if($failed_checks == 0){
+      $this->is_completed = TRUE;
+    }else{
+      $this->is_completed = TRUE;
+    }
+
+    $smarty = get_smarty();
+    $smarty->assign("bool",array(FALSE => _("No"), TRUE => _("Yes")));
+    $smarty->assign("schema_readable",$this->schema_readable);
+    $smarty->assign("enable_schema_check",$this->enable_schema_check);
+    $smarty->assign("checks",$this->checked);
+    $smarty->assign("not_checked",$this->not_checked);
+    $smarty->assign("failed_checks",$failed_checks);
+    return($smarty -> fetch (get_template_path("../setup/setup_schema.tpl")));
+  }
+
+  function save_object()
+  {
+    if(isset($_POST['step7_posted'])){
+
+      /* Get attributes */
+      foreach($this->attributes as $attr){
+        if(isset($_POST[$attr])){
+          $this->$attr = validate($_POST[$attr]);
+        }
+      }
+    }
+  }
+
+  function check_schema()
+  {
+    $cfg = $this->parent->captured_values;
+    $rfc2307bis = $cfg['rfc2307bis'];
+    $this->checked = check_schema($cfg,$rfc2307bis);
+
+    /* Get objectclasses */
+    $ldap = new LDAP($cfg['admin'],$cfg['password'],$cfg['connection'] ,FALSE,$cfg['tls']);
+    $objectclasses = $ldap->get_objectclasses();
+    if(count($objectclasses) == 0){
+      print_red(_("Can't get schema information from server. No schema check possible!"));
+    }
+
+    /* Which samba version do we use? */
+    if(isset($objectclasses['sambaSamAccount'])){
+      $this->samba_version = 3;
+    } elseif(isset($objectclasses['sambaAccount'])) {
+      $this->samba_version = 2;
+    }else{
+      $this->samba_version = 0;
+    }
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/setup/class_setupStep_Welcome.inc b/gosa-core/setup/class_setupStep_Welcome.inc
new file mode 100644 (file)
index 0000000..f030f31
--- /dev/null
@@ -0,0 +1,71 @@
+<?php
+
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2007 Fabian Hickert
+
+   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 Step_Welcome  extends setup_step
+{
+  var $languages      = array();
+  var $attributes     = array();
+  var $header_image   = "images/welcome.png";
+
+  function Step_Welcome()
+  {
+    $this->is_enabled     = TRUE;
+    $this->is_active      = TRUE;
+    $this->update_strings(); 
+  }
+
+  function update_strings()
+  {
+    $this->s_title      = _("Welcome");
+    $this->s_info       = _("The welcome message");
+    $this->s_title_long = _("Welcome to GOsa setup wizard");
+  }
+  
+  function execute()
+  {
+    $smarty = get_smarty();
+    $smarty->assign('auth_id', session_id());
+    return($smarty->fetch(get_template_path("setup_welcome.tpl",TRUE,dirname(__FILE__))));
+  }
+
+  function save_object()
+  {
+    $id = "";
+    
+    /* Get auth ID from file */
+    if (file_exists('/tmp/gosa.auth') && is_readable('/tmp/gosa.auth')){
+      $contents= file('/tmp/gosa.auth');
+      $id= chop($contents[0]);
+    }
+
+    /* Continue if we've the correct ID */
+    if ($id == session_id()){
+      $this->is_completed = true;
+    } else {
+      $this->is_completed = false;
+    }
+
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/setup/license.txt b/gosa-core/setup/license.txt
new file mode 100644 (file)
index 0000000..9140f02
--- /dev/null
@@ -0,0 +1,147 @@
+Table of Contents
+
+    * GNU GENERAL PUBLIC LICENSE
+          o Preamble
+          o TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+          o How to Apply These Terms to Your New Programs
+
+GNU GENERAL PUBLIC LICENSE
+
+Version 2, June 1991
+
+Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
+
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
+
+Preamble
+
+The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too.
+
+When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.
+
+To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.
+
+For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
+
+We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.
+
+Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.
+
+Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.
+
+The precise terms and conditions for copying, distribution and modification follow.
+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.
+
+1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
+
+2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
+
+    * a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
+    * b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
+    * c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
+
+3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:
+
+    * a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
+    * b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
+    * c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
+
+If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.
+
+4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
+
+5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.
+
+6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.
+
+7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
+
+This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
+
+8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
+
+9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.
+
+10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
+
+NO WARRANTY
+
+11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+END OF TERMS AND CONDITIONS
+How to Apply These Terms to Your New Programs
+
+If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
+
+To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
+
+one line to give the program's name and an idea of what it does.
+Copyright (C) yyyy  name of author
+
+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.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this when it starts in an interactive mode:
+
+Gnomovision version 69, Copyright (C) year name of author
+Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
+type `show w'.  This is free software, and you are welcome
+to redistribute it under certain conditions; type `show c'
+for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names:
+
+Yoyodyne, Inc., hereby disclaims all copyright
+interest in the program `Gnomovision'
+(which makes passes at compilers) written
+by James Hacker.
+
+signature of Ty Coon, 1 April 1989
+Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License.
+
+Linking Joomla! statically or dynamically with other modules is making a combined work based on Joomla!. Thus, the terms and conditions of the GNU General Public License cover the whole combination.
+
+In addition, as a special exception, the copyright holders of Joomla! give you permission to combine Joomla! with free software programs or libraries that are released under the GNU LGPL and with independent modules that communicate with Joomla! solely through the Joomla! extension interface. You may copy and distribute such a system following the terms of the GNU GPL for Joomla! and the licenses of the other code concerned, provided that you include the source code of that other code when and as the GNU GPL requires distribution of source code.
+
+Note that people who make modified versions of Joomla! are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU General Public License gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
diff --git a/gosa-core/setup/main.inc b/gosa-core/setup/main.inc
new file mode 100644 (file)
index 0000000..bce41ef
--- /dev/null
@@ -0,0 +1,35 @@
+<?php
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2007 Fabian Hickert
+
+   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
+ */
+
+/* Create a new setup class if necessary  */
+if (!isset($_SESSION['setup']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+  $_SESSION['setup']= new setup ();
+}
+$setup= $_SESSION['setup'];
+
+/* Execute formular */
+$setup->save_object();
+$display= $setup->execute();
+
+/* Store changes  in session */
+$_SESSION['setup']= $setup;
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-core/setup/setup.tpl b/gosa-core/setup/setup.tpl
new file mode 100644 (file)
index 0000000..3bb21f7
--- /dev/null
@@ -0,0 +1,4 @@
+<div style='background-color: #009900;'>
+{$php_errors}
+sadffasdsdfa
+</div>
diff --git a/gosa-core/setup/setup_checks.tpl b/gosa-core/setup/setup_checks.tpl
new file mode 100644 (file)
index 0000000..90275fc
--- /dev/null
@@ -0,0 +1,122 @@
+<!-- 
+       Div container with PHP module checks 
+-->
+<div style='float:left;width:50%;'> 
+
+       <!-- Set content styles -->     
+       <div class='default' style='margin:10px;'>
+               <!-- Beginning PHP module check output -->
+               <h2 class='step2_container_title'>{t}PHP module and extension checks{/t}</h2>
+               <!-- {cycle reset=true values="#F0F0F0, #FFF"} -->
+               {foreach from=$basic item=val key=key}
+                       <!-- Entry {$key} -->           
+                       {if $basic[$key].SOLUTION != "" && !$basic[$key].RESULT}
+               
+                               <!-- Add ability to display info popup -->      
+                               <div class='step2_entry_container_info' style='background-color:{cycle values="#F0F0F0, #FFF"}'>
+                       {else}
+
+                               <!-- Normal entry everything is fine -->
+                               <div class='step2_entry_container' style='background-color:{cycle values="#F0F0F0, #FFF"}'>     
+                       {/if}
+                       
+                       <div class='step2_entry_name'>{$basic[$key].NAME}</div>
+                       <div class='step2_entry_status'>
+
+                       {if $basic[$key].RESULT}
+                               <div class='step2_successful'>{t}Ok{/t}</div>
+                       {else}
+                               {if $basic[$key].MUST}
+                                       <div class='step2_failed'>{t}Error{/t}</div>
+                               {else}
+                                       <div class='step2_warning'>{t}Warning{/t}</div>
+                               {/if}
+                               {if $basic[$key].SOLUTION != ""}
+       
+                               <!-- Inforamtion popup -->
+                               <div class='solution_visible' id='sol_{$key}'>
+                                       {if $basic[$key].MUST}
+                                               <div class='step2_failed_text' style="background-image: url('images/small_error.png')">
+                                               {$basic[$key].SOLUTION}
+                                               <b>{t}GOsa will NOT run without fixing this.{/t}</b>
+                                       {else}
+                                               <div class="step2_warning_text" style="background-image: url('images/small_warning.png')">
+                                               {$basic[$key].SOLUTION}
+                                               <b>{t}GOsa will run without fixing this.{/t}</b>
+                                       {/if}
+                                       </div>
+                               </div>
+                               {/if}
+                       {/if}
+                               </div>
+                       </div>
+               {/foreach}
+       </div>
+</div>
+
+
+<!-- 
+       Div container with PHP config checks 
+-->
+<div style='width:50%; float:left;'>
+
+       <!-- Set content styles -->     
+       <div class='default' style='margin:10px;'>
+
+               <!-- Beginning PHP config check output -->
+               <h2 class='step2_container_title'>{t}PHP setup configuration{/t} (<a style='text-decoration:underline' href='?info' target='_blank'>{t}show information{/t})</a></h2>
+
+               <!-- {cycle reset=true values="#F0F0F0, #FFF"} -->
+               {foreach from=$config item=val key=key}
+
+                       <!-- Entry {$key} -->
+            {if $config[$key].SOLUTION != "" && !$config[$key].RESULT}
+
+                <!-- Add ability to display info popup -->
+                <div class='step2_entry_container_info' style='background-color:{cycle values="#FFF, #F0F0F0"}'>
+            {else}
+
+                <!-- Normal entry everything is fine -->
+                <div class='step2_entry_container' style='background-color:{cycle values="#FFF, #F0F0F0"}'>
+            {/if}
+
+
+                       <div class='step2_entry_name'>{$config[$key].NAME}</div>
+                       <div class='step2_entry_status'>
+                       {if $config[$key].RESULT}
+                               <div class='step2_successful'>{t}Ok{/t}</div>
+                       {else}
+
+                               {if $config[$key].MUST}
+                                       <div class='step2_failed'>{t}Error{/t}</div>
+                               {else}
+                                       <div class='step2_warning'>{t}Warning{/t}</div>
+                               {/if}
+
+                               {if $config[$key].SOLUTION != ""}
+       
+                               <!-- Inforamtion popup -->
+                               <div class='solution_visible' id='sol_config_{$key}'>
+                                       {if $config[$key].MUST}
+                                               <div class='step2_failed_text' style="background-image: url('images/small_error.png')">
+                                               {$config[$key].SOLUTION}
+                                               <b>{t}GOsa will NOT run without fixing this.{/t}</b>
+                                       {else}
+                                               <div class='step2_warning_text' style="background-image: url('images/small_warning.png')">
+                                               {$config[$key].SOLUTION}
+                                               <b>{t}GOsa will run without fixing this.{/t}</b>
+                                       {/if}
+                                       </div>
+                               </div>
+                               {/if}
+                       {/if}
+                       </div>
+                       </div>
+               {/foreach}
+
+
+       </div>
+</div>
+
+<div style="clear:both"></div>
+
diff --git a/gosa-core/setup/setup_config1.tpl b/gosa-core/setup/setup_config1.tpl
new file mode 100644 (file)
index 0000000..d041ae3
--- /dev/null
@@ -0,0 +1,225 @@
+<div class='default'>
+    <p><b>{t}Look and feel{/t}</b></p>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Theme{/t}
+        </div>
+        <div class='step4_value'>
+            <select name="theme">
+                {html_options options=$themes selected=$theme}
+            </select>
+        </div>
+    </div>
+
+    <p><b>{t}Apache{/t}</b></p>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Compress output send to browser{/t}
+        </div>
+        <div class='step4_value'>
+            <select name="compressed">
+                {html_options options=$bool selected=$compressed}
+            </select>
+        </div>
+    </div>
+    <p><b>{t}People and group storage{/t}</b></p>
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}People DN attribute{/t}
+        </div>
+        <div class='step4_value'>
+            <select size="1" name="peopledn">
+                {html_options values=$peopledns output=$peopledns selected=$peopledn}
+            </select>
+        </div>
+    </div>
+
+       <div class='step4_container'>
+        <div class='step4_name'>
+            {t}People storage subtree{/t}
+        </div>
+        <div class='step4_value'>
+            <input type='text' name='peopleou' maxlength='40' size='40' value='{$peopleou}'>
+        </div>
+    </div>
+
+       <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Group storage subtree{/t}
+        </div>
+        <div class='step4_value'>
+            <input type='text' name='groupou' maxlength='40' size='40' value='{$groupou}'>
+        </div>
+    </div>
+
+       <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Include personal title in user DN{/t}
+        </div>
+        <div class='step4_value'>
+            <select name="include_personal_title" size="1" title="">
+            {html_options options=$bool selected=$include_personal_title}
+            </select>
+        </div>
+    </div>
+
+       <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Relaxed naming policies{/t}
+        </div>
+        <div class='step4_value'>
+            <select name="strict" size="1" title="">
+            {html_options options=$bool selected=$strict}
+            </select>
+        </div>
+    </div>
+
+       <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Automatic uids{/t}
+        </div>
+        <div class='step4_value'>
+            {if $id_settings.idgen_active == FALSE}
+                <input type='checkbox' value='1' name='idgen_active'
+                    onClick='changeState("idgen");'>
+                <input size='20' id='idgen' name='idgen' type='text' value='{$id_settings.idgen}' disabled>
+            {else}
+                <input type='checkbox' value='1' name='idgen_active' checked>
+                <input size='20' id='idgen' name='idgen' type='text' value='{$id_settings.idgen}'  >
+            {/if}
+        </div>
+    </div>
+
+       <div class='step4_container'>
+        <div class='step4_name'>
+            {t}GID / UID min id{/t}
+        </div>
+        <div class='step4_value'>
+            {if $id_settings.minid_active == FALSE}
+                <input type='checkbox' value='1' name='minid_active'
+                    onClick='changeState("minid");'>
+                <input size='10' id='minid' name='minid' type='text' value='{$id_settings.minid}' disabled>
+            {else}
+                <input type='checkbox' value='1' name='minid_active' checked>
+                <input size='10' id='minid' name='minid' type='text' value='{$id_settings.minid}'  >
+            {/if}
+        </div>
+    </div>
+
+    <div class='step4_container' style="margin-bottom:5px;">
+        <div class='step4_name'>
+            {t}Number base for people/groups{/t}
+        </div>
+        <div class='step4_value'>
+            <input type='text' name='uidbase' maxlength='20' size='10' value='{$uidbase}'>
+        </div>
+     </div>
+    <div class='step4_container' style="margin-bottom:5px;">
+        <div class='step4_name'>
+                {t}Hook for number base{/t}
+       </div>
+        <div class='step4_value'>
+            {if $base_hook_active == FALSE}
+                <input type='checkbox' value='1' name='base_hook_active'
+                    onClick='changeState("base_hook");'>
+                <input id='base_hook' name='base_hook' size=40 type='text' value='{$base_hook}'      disabled>
+            {else}
+                <input type='checkbox' value='1' name='base_hook_active' checked>
+                <input id='base_hook' name='base_hook' size=40 type='text' value='{$base_hook}'  >
+            {/if}
+     </div>
+        </div>
+    </div>
+
+    <p><b>{t}Password settings{/t}</b></p>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Password encryption algorithm{/t}
+        </div>
+        <div class='step4_value'>
+            <select name="encryption" size="1" title="">
+                {html_options options=$crypt_methods selected=$encryption}
+            </select>
+        </div>
+    </div>
+
+    <div class='step4_container' style='height:4em;'>
+        <div class='step4_name' style='height:4em;'>
+            {t}Password restrictions{/t}
+        </div>
+        <div class='step4_value' style='height:4em;'>
+
+                       {if $pwd_rules.pwminlen_active == FALSE}
+                               <input type='checkbox' value='1' name='pwminlen_active'
+                                       onClick='changeState("pwminlen");'>
+                                       {t}Password minimum length{/t}
+                               <input id='pwminlen' name='pwminlen' type='text' value='{$pwd_rules.pwminlen}' size=3 disabled>
+                       {else}
+                               <input type='checkbox' value='1' name='pwminlen_active' checked>
+                               {t}Password minimum length{/t}
+                               <input id='pwminlen' name='pwminlen' type='text' value='{$pwd_rules.pwminlen}' size=3 >
+                       {/if}
+                       <br>
+                       {if $pwd_rules.pwdiffer_active == FALSE}
+                               <input type='checkbox' value='1' name='pwdiffer_active' 
+                                       onClick='changeState("pwdiffer");'>
+                               {t}Different characters from old password{/t}
+                               <input id='pwdiffer' name='pwdiffer' type='text' value='{$pwd_rules.pwdiffer}' size=3 disabled>
+                       {else}
+                               <input type='checkbox' value='1' name='pwdiffer_active' checked>
+                               {t}Different characters from old password{/t}
+                               <input id='pwdiffer' name='pwdiffer' type='text' value='{$pwd_rules.pwdiffer}' size=3 >
+                       {/if}
+       
+        </div>
+    </div>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+                {t}Password change hook{/t}
+        </div>
+        <div class='step4_value'>
+            {if $pwd_rules.externalpwdhook_active == FALSE}
+                <input type='checkbox' value='1' name='externalpwdhook_active'
+                    onClick='changeState("externalpwdhook");'>
+                <input size=40 id='externalpwdhook' name='externalpwdhook' type='text' value='{$pwd_rules.externalpwdhook}' disabled>
+            {else}
+                <input type='checkbox' value='1' name='externalpwdhook_active' checked>
+                <input size=40 id='externalpwdhook' name='externalpwdhook' type='text' value='{$pwd_rules.externalpwdhook}'  >
+            {/if}
+        </div>
+    </div>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Use SASL for kerberos{/t}
+        </div>
+        <div class='step4_value'>
+            <select name="krbsasl" size="1" title="">
+            {html_options options=$bool selected=$krbsasl}
+            </select>
+        </div>
+    </div>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Use account expiration{/t}
+        </div>
+        <div class='step4_value'>
+            <select name="account_expiration" size="1" title="">
+            {html_options options=$bool selected=$account_expiration}
+            </select>
+        </div>
+    </div>
+
+
+<input type='hidden' value='1' name='step5_posted'>
+<!--
+         {t}GOsa supports several encryption types for your passwords. Normally this is adjustable via user templates, but you can specify a default method to be used here, too.{/t}
+         {t}GOsa always acts as admin and manages access rights internally. This is a workaround till OpenLDAP's in directory ACI's are    fully implemented. For this to work, we need the admin DN and the corresponding password.{/t}
+         {t}Some basic LDAP parameters are tunable and affect the locations where GOsa saves people and groups, including the way accounts get created. Check the values below if the fit your needs.{/t}
+         {t}GOsa has modular support for several mail methods. These methods provide interfaces to users mailboxes and general handling    for quotas. You can choose the dummy plugin to leave all your mail settings untouched.{/t}-->
+
diff --git a/gosa-core/setup/setup_config2.tpl b/gosa-core/setup/setup_config2.tpl
new file mode 100644 (file)
index 0000000..80c5cf6
--- /dev/null
@@ -0,0 +1,323 @@
+<div class='default' style='margin:12px; '>  
+    <p><b>{t}Samba settings{/t}</b></p>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Samba hash generator{/t}
+        </div>
+        <div class='step4_value'>
+                <input size=40 id='smbhash' name='smbhash' type='text' value='{$samba_settings.smbhash}'  >
+        </div>
+    </div>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Samba SID{/t}
+        </div>
+        <div class='step4_value'>
+            {if $samba_settings.samba_sid_active == FALSE}
+                <input type='checkbox' value='1' name='samba_sid_active'
+                    onClick='changeState("samba_sid");'>
+                <input size=20 id='samba_sid' name='samba_sid' type='text' value='{$samba_settings.samba_sid}' disabled>
+            {else}
+                <input type='checkbox' value='1' name='samba_sid_active' checked {if !$sambaDomain_found} disabled {/if}>
+                <input size=20 id='samba_sid' name='samba_sid' type='text' value='{$samba_settings.samba_sid}'  >
+            {/if}
+        </div>
+    </div>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}RID base{/t}
+        </div>
+        <div class='step4_value'>
+            {if $samba_settings.samba_rid_active == FALSE}
+                <input type='checkbox' value='1' name='samba_rid_active'
+                    onClick='changeState("samba_rid");'>
+                <input size=20 id='samba_rid' name='samba_rid' type='text' value='{$samba_settings.samba_rid}' disabled>
+            {else}
+                <input type='checkbox' value='1' name='samba_rid_active' checked {if !$sambaDomain_found} disabled {/if}>
+                <input size=20 id='samba_rid' name='samba_rid' type='text' value='{$samba_settings.samba_rid}'  >
+            {/if}
+        </div>
+    </div>
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Workstation container{/t}
+        </div>
+        <div class='step4_value'>
+            {if $generic_settings.wws_ou_active == FALSE}
+                <input type='checkbox' value='1' name='wws_ou_active'
+                    onClick='changeState("wws_ou");'>
+                <input size=40 id='wws_ou' name='wws_ou' type='text' value='{$generic_settings.wws_ou}' disabled>
+            {else}
+                <input type='checkbox' value='1' name='wws_ou_active' checked>
+                <input size=40 id='wws_ou' name='wws_ou' type='text' value='{$generic_settings.wws_ou}'  >
+            {/if}
+        </div>
+    </div>
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Samba SID mapping{/t}
+        </div>
+        <div class='step4_value'>
+            <select name="sambaidmapping" size="1" title="">
+                       {html_options options=$bool selected=$sambaidmapping}
+            </select>
+        </div>
+    </div>
+       <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Timezone{/t}
+        </div>
+        <div class='step4_value'>
+            <select name='timezone' title='{t}Please your preferred timezone here{/t}' style="width:100%">
+               {foreach from=$timezones.TIMEZONES item=val key=key}
+            {if $key == $timezone}
+                {if isset($timezones.DST_ZONES.$key)}
+                    <option selected value="{$key}">{$key} (DST)</option>
+                {else}
+                    <option selected value="{$key}">{$key} (GMT)</option>
+                {/if}
+            {else}
+                {if isset($timezones.DST_ZONES.$key)}
+                    <option value="{$key}">{$key} (DST)</option>
+                {else}
+                    <option value="{$key}">{$key} (GMT)</option>
+                {/if}
+            {/if}
+        {/foreach}
+
+            </select>
+        </div>
+    </div>
+
+
+    <p><b>{t}Additional GOsa settings{/t}</b></p>
+
+       <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Enable Copy & Paste{/t}
+        </div>
+        <div class='step4_value'>
+
+            <select name="enableCopyPaste" size="1" title="">
+                {html_options options=$bool selected=$generic_settings.enableCopyPaste}
+            </select>
+        </div>
+    </div>
+
+       <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Enable DNS extension{/t}
+        </div>
+        <div class='step4_value'>
+
+            <select name="enableDNS" size="1" title="">
+                {html_options options=$bool selected=$generic_settings.enableDNS}
+            </select>
+        </div>
+    </div>
+
+       <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Enable DHCP extension{/t}
+        </div>
+        <div class='step4_value'>
+
+            <select name="enableDHCP" size="1" title="">
+                {html_options options=$bool selected=$generic_settings.enableDHCP}
+            </select>
+        </div>
+    </div>
+
+       <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Enable mime type management{/t}
+        </div>
+        <div class='step4_value'>
+
+            <select name="enableMimeType" size="1" title="">
+                {html_options options=$bool selected=$enableMimeType}
+            </select>
+        </div>
+    </div>
+
+       <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Enable FAI release management{/t}
+        </div>
+        <div class='step4_value'>
+
+            <select name="enableFAI_management" size="1" title="">
+                {html_options options=$bool selected=$enableFAI_management}
+            </select>
+        </div>
+    </div>
+
+       <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Enable user netatalk plugin{/t}
+        </div>
+        <div class='step4_value'>
+            <select name="use_netatalk" size="1" title="">
+                {html_options options=$bool selected=$use_netatalk}
+            </select>
+        </div>
+    </div>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Government mode{/t}
+        </div>
+        <div class='step4_value'>
+            <select name="governmentmode" size="1" title="">
+                       {html_options options=$bool selected=$governmentmode}
+                       </select>
+        </div>
+    </div>
+
+    <p><b>{t}Mail settings{/t}</b></p>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Mail method{/t}
+        </div>
+        <div class='step4_value'>
+            <select name="mail" size="1" title="">
+                <option  value="disabled">{t}disabled{/t}</option>
+                {html_options options=$mail_methods selected=$mail}
+            </select>
+        </div>
+        <div class='step4_status'>
+        </div>
+    </div>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Vacation templates{/t}
+        </div>
+        <div class='step4_value'>
+            {if $mail_settings.vacationdir_active == FALSE}
+                <input type='checkbox' value='1' name='vacationdir_active'
+                    onClick='changeState("vacationdir");'>
+                <input size=40 id='vacationdir' name='vacationdir' type='text' value='{$mail_settings.vacationdir}' disabled>
+            {else}
+                <input type='checkbox' value='1' name='vacationdir_active' checked>
+                <input size=40 id='vacationdir' name='vacationdir' type='text' value='{$mail_settings.vacationdir}'  >
+            {/if}
+        </div>
+    </div>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Use Cyrus UNIX style{/t}
+        </div>
+        <div class='step4_value'>
+            <select name="cyrusunixstyle" size="1" title="">
+            {html_options options=$bool selected=$cyrusunixstyle}
+            </select>
+        </div>
+    </div>
+
+
+        <p><b>{t}Snapshots / Undo{/t}</b></p>
+            {if $generic_settings.snapshot_active == FALSE}
+        <div class='step4_container'>
+         <div class='step4_name'>
+                <input type='checkbox' value='1' name='snapshot_active'
+                    onClick='
+                                                                changeState("snapshot_base");
+                                                                changeState("snapshot_server");
+                                                                changeState("snapshot_user");
+                                                                changeState("snapshot_password");'>{t}Enable snapshots{/t}
+         </div>
+        </div>
+        <div style='margin-left:10px;'>
+        <div class='step4_container'>
+         <div class='step4_name'>
+                {t}Snapshot base{/t}
+         </div>
+         <div class='step4_value'>
+                <input style='width:220' id='snapshot_base' name='snapshot_base'
+                                        type='text' value='{$generic_settings.snapshot_base}' disabled>
+         </div>
+        </div>
+        <div class='step4_container'>
+         <div class='step4_name'>
+                    {t}Server{/t}
+         </div>
+         <div class='step4_value'>
+                                <input style='width:220' id='snapshot_server' name='snapshot_server'
+                                        type='text' value='{$generic_settings.snapshot_server}' disabled>
+        </div>
+        </div>
+        <div class='step4_container'>
+         <div class='step4_name'>
+                        {t}User{/t}
+         </div>
+         <div class='step4_value'>
+                                <input style='width:220' id='snapshot_user' name='snapshot_user'
+                                        type='text' value='{$generic_settings.snapshot_user}' disabled>
+        </div>
+        </div>
+        <div class='step4_container'>
+         <div class='step4_name'>
+                        {t}Password{/t}
+         </div>
+         <div class='step4_value'>
+                                <input style='width:220' id='snapshot_password' name='snapshot_password'
+                                        type='password' value='{$generic_settings.snapshot_password}' disabled>
+        </div>
+        </div>
+        </div>
+
+            {else}
+        <div class='step4_container'>
+         <div class='step4_name'>
+                <input type='checkbox' value='1' name='snapshot_active' checked>{t}Enable snapshots{/t}
+        </div>
+        </div>
+        <div style='margin-left:10px;'>
+        <div class='step4_container'>
+         <div class='step4_name'>
+                    {t}Snapshot base{/t}
+        </div>
+         <div class='step4_value'>
+           <input style='width:220' id='snapshot_base' name='snapshot_base'
+                                        type='text' value='{$generic_settings.snapshot_base}'>
+        </div>
+        </div>
+        <div class='step4_container'>
+         <div class='step4_name'>
+                        {t}Server{/t}
+        </div>
+         <div class='step4_value'>
+                                <input style='width:220' id='snapshot_server' name='snapshot_server'
+                                        type='text' value='{$generic_settings.snapshot_server}'>
+        </div>
+        </div>
+        <div class='step4_container'>
+         <div class='step4_name'>
+                    {t}User{/t}
+        </div>
+         <div class='step4_value'>
+                                <input style='width:220' id='snapshot_user' name='snapshot_user'
+                                        type='text' value='{$generic_settings.snapshot_user}'>
+        </div>
+        </div>
+        <div class='step4_container'>
+         <div class='step4_name'>
+                        {t}Password{/t}
+        </div>
+         <div class='step4_value'>
+                                <input style='width:220;' id='snapshot_password' name='snapshot_password'
+                                        type='password' value='{$generic_settings.snapshot_password}'>
+        </div>
+        </div>
+        </div>
+            {/if}
+</div>
+
+<input type='hidden' value='1' name='step6_posted'>
+<div style="clear:both"></div>
diff --git a/gosa-core/setup/setup_config3.tpl b/gosa-core/setup/setup_config3.tpl
new file mode 100644 (file)
index 0000000..a3d2a55
--- /dev/null
@@ -0,0 +1,324 @@
+<div class='default' style='margin:12px; '>
+     <p><b>{t}GOsa core settings{/t}</b></p>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Disable primary group filter{/t}
+        </div>
+        <div class='step4_value'>
+       
+            <select name="noprimarygroup" size="1" title="">
+               {html_options options=$bool selected=$optional.noprimarygroup}
+            </select>
+        </div>
+    </div>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Display summary in listings{/t}
+        </div>
+        <div class='step4_value'>
+       
+            <select name="list_summary" size="1" title="">
+               {html_options options=$bool selected=$optional.list_summary}
+            </select>
+        </div>
+    </div>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Honour administrative units{/t}
+        </div>
+        <div class='step4_value'>
+       
+            <select name="strict_units" size="1" title="">
+               {html_options options=$bool selected=$optional.strict_units}
+            </select>
+        </div>
+    </div>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Smarty compile directory{/t}
+        </div>
+        <div class='step4_value'>
+                       <input size=40 id='compile' name='compile' 
+                               type='text' value='{$optional.compile}'>
+        </div>
+    </div>
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}SNMP community{/t}
+        </div>
+        <div class='step4_value'>
+                       <input size=40 id='compile' name='snmpcommunity' 
+                               type='text' value='{$optional.snmpcommunity}'>
+        </div>
+    </div>
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Path for PPD storage{/t}
+        </div>
+        <div class='step4_value'>
+            {if $optional.ppd_path_active == FALSE}
+                <input type='checkbox' value='1' name='ppd_path_active'
+                    onClick='changeState("ppd_path");'>
+                <input size=40 id='ppd_path' name='ppd_path' type='text' value='{$optional.ppd_path}' disabled>
+            {else}
+                <input type='checkbox' value='1' name='ppd_path_active' checked
+                                       onClick='changeState("ppd_path");'>
+                <input size=40 id='ppd_path' name='ppd_path' type='text' value='{$optional.ppd_path}'  >
+            {/if}
+        </div>
+    </div>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Path for kiosk profile storage{/t}
+        </div>
+        <div class='step4_value'>
+            {if $optional.kioskpath_active == FALSE}
+                <input type='checkbox' value='1' name='kioskpath_active'
+                    onClick='changeState("kioskpath");'>
+                <input size=40 id='kioskpath' name='kioskpath' 
+                                       type='text' value='{$optional.kioskpath}' disabled>
+            {else}
+                <input type='checkbox' value='1' name='kioskpath_active' checked
+                                       onClick='changeState("kioskpath");'>
+                <input size=40 id='kioskpath' name='kioskpath' 
+                                       type='text' value='{$optional.kioskpath}'  >
+            {/if}
+        </div>
+    </div>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Enable system deployment{/t}
+        </div>
+        <div class='step4_value'>
+            {if $optional.gotomasses_active == FALSE}
+                <input type='checkbox' value='1' name='gotomasses_active'
+                    onClick='changeState("gotomasses_file");'>
+                <input size=40 id='gotomasses_file' name='gotomasses_file' 
+                                       type='text' value='{$optional.gotomasses_file}' disabled>
+            {else}
+                <input type='checkbox' value='1' name='gotomasses_active' checked
+                                       onClick='changeState("gotomasses_file");'>
+                <input size=40 id='gotomasses_file' name='gotomasses_file' 
+                                       type='text' value='{$optional.gotomasses_file}'  >
+            {/if}
+        </div>
+    </div>
+
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Network resolv hook{/t}
+        </div>
+        <div class='step4_value'>
+            {if $optional.auto_network_hook_active == FALSE}
+                <input type='checkbox' value='1' name='auto_network_hook_active'
+                    onClick='changeState("auto_network_hook");'>
+                <input size=40 id='auto_network_hook' name='auto_network_hook' 
+                                       type='text' value='{$optional.auto_network_hook}' disabled>
+            {else}
+                <input type='checkbox' value='1' name='auto_network_hook_active' checked
+                                       onClick='changeState("auto_network_hook");'>
+                <input size=40 id='auto_network_hook' name='auto_network_hook' type='text' 
+                                       value='{$optional.auto_network_hook}'  >
+            {/if}
+        </div>
+    </div>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Mail queue script{/t}
+        </div>
+        <div class='step4_value'>
+            {if $optional.mailQueueScriptPath_active == FALSE}
+                <input type='checkbox' value='1' name='mailQueueScriptPath_active'
+                    onClick='changeState("mailQueueScriptPath");'>
+                <input size=40 id='mailQueueScriptPath' name='mailQueueScriptPath' 
+                                       type='text' value='{$optional.mailQueueScriptPath}' disabled>
+            {else}
+                <input type='checkbox' value='1' name='mailQueueScriptPath_active' checked 
+                                       onClick='changeState("mailQueueScriptPath");'>
+                <input size=40 id='mailQueueScriptPath' name='mailQueueScriptPath' type='text' 
+                                       value='{$optional.mailQueueScriptPath}'  >
+            {/if}
+        </div>
+    </div>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Notification script{/t}
+        </div>
+        <div class='step4_value'>
+            {if $optional.notifydir_active == FALSE}
+                <input type='checkbox' value='1' name='notifydir_active'
+                    onClick='changeState("notifydir");'>
+                <input size=40 id='notifydir' name='notifydir' 
+                                       type='text' value='{$optional.notifydir}' disabled>
+            {else}
+                <input type='checkbox' value='1' name='notifydir_active' checked 
+                                       onClick='changeState("notifydir");'>
+                <input size=40 id='notifydir' name='notifydir' 
+                                       type='text' value='{$optional.notifydir}'  >
+            {/if}
+        </div>
+    </div>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Enable edit locking{/t}
+        </div>
+        <div class='step4_value'>
+            {if $optional.uniq_identifier_active == FALSE}
+                <input type='checkbox' value='1' name='uniq_identifier_active'
+                    onClick='changeState("uniq_identifier");'>
+                               <select name="uniq_identifier" id="uniq_identifier" disabled>
+                                       {html_options options=$uniq_identifiers selected=$optional.uniq_identifier}
+                               </select>
+            {else}
+                <input type='checkbox' value='1' name='uniq_identifier_active' checked
+                                       onClick='changeState("uniq_identifier");'>
+                               <select name="uniq_identifier" id="uniq_identifier" >
+                                       {html_options options=$uniq_identifiers selected=$optional.uniq_identifier}
+                               </select>
+            {/if}
+        </div>
+    </div>
+
+    <p><b>{t}Login and session{/t}</b></p>
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Login attribute{/t}
+        </div>
+        <div class='step4_value'>
+            <select name="login_attribute" size="1" title="">
+               {html_options options=$login_attributes selected=$optional.login_attribute}
+            </select>
+        </div>
+    </div>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Enforce register_globals to be deactivated{/t}
+        </div>
+        <div class='step4_value'>
+       
+            <select name="forceglobals" size="1" title="">
+               {html_options options=$bool selected=$optional.forceglobals}
+            </select>
+        </div>
+    </div>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Enforce encrypted connections{/t}
+        </div>
+        <div class='step4_value'>
+       
+            <select name="forcessl" size="1" title="">
+               {html_options options=$bool selected=$optional.forcessl}
+            </select>
+        </div>
+    </div>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Warn if session is not encrypted{/t}
+        </div>
+        <div class='step4_value'>
+       
+            <select name="warnssl" size="1" title="">
+               {html_options options=$bool selected=$optional.warnssl}
+            </select>
+        </div>
+    </div>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Remember dialog filter settings{/t}
+        </div>
+        <div class='step4_value'>
+       
+            <select name="user_filter_cookie" size="1" title="">
+               {html_options options=$bool selected=$optional.user_filter_cookie}
+            </select>
+        </div>
+    </div>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Session lifetime{/t}
+        </div>
+        <div class='step4_value'>
+                       <input size=10 id='session_lifetime' name='session_lifetime' 
+                               type='text' value='{$optional.session_lifetime}'>
+        </div>
+    </div>
+
+    <p><b>{t}Debugging{/t}</b></p>
+       
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Show PHP errors{/t}
+        </div>
+        <div class='step4_value'>
+            <select name="errorlvl" size="1" title="">
+            {html_options options=$bool selected=$errorlvl}
+            </select>
+        </div>
+    </div>
+
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Maximum LDAP query time{/t}
+        </div>
+        <div class='step4_value'>
+            {if $optional.max_ldap_query_time_active == FALSE}
+                <input type='checkbox' value='1' name='max_ldap_query_time_active'
+                    onClick='changeState("max_ldap_query_time");'>
+                <input size=10 id='max_ldap_query_time' name='max_ldap_query_time' 
+                                       type='text' value='{$optional.max_ldap_query_time}' disabled>
+            {else}
+                <input type='checkbox' value='1' name='max_ldap_query_time_active' checked>
+                <input size=10 id='max_ldap_query_time' name='max_ldap_query_time' 
+                                       type='text' value='{$optional.max_ldap_query_time}'  >
+            {/if}
+        </div>
+    </div>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Log LDAP statistics{/t}
+        </div>
+        <div class='step4_value'>
+       
+            <select name="ldapstats" size="1" title="">
+               {html_options options=$bool selected=$optional.ldapstats}
+            </select>
+        </div>
+    </div>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Debug level{/t}
+        </div>
+        <div class='step4_value'>
+                       <select name='debuglevel'>
+                               {if $optional.debuglevel == 0}
+                                       <option value='0' selected>0 {t}Disabled{/t}</option>
+                                       <option value='1'>1 {t}Enabled{/t}</option>
+                               {else}
+                                       <option value='0'>0 {t}Disabled{/t}</option>
+                                       <option value='1' selected>1 {t}Enabled{/t}</option>
+                               {/if}
+                       </select>               
+        </div>
+    </div>
+</div>
+
+<input type='hidden' value='1' name='step6a_posted'>
diff --git a/gosa-core/setup/setup_feedback.tpl b/gosa-core/setup/setup_feedback.tpl
new file mode 100644 (file)
index 0000000..20fae54
--- /dev/null
@@ -0,0 +1,144 @@
+<div class='default' style='margin:12px; '>  
+
+       <h2>{$additional_info}</h2>
+
+       <h2>
+               <input {if $subscribe} checked {/if} type='checkbox' name='subscribe' value='1' class='center'>&nbsp;{t}Subscribe to the gosa-announce mailinglist{/t}
+       </h2>
+       <p>
+       {t}When checking this option, GOsa will try to connect http://oss.gonicus.de in order to subscribe you to the gosa-announce mailing list. You've to confirm this by mail.{/t}
+       </p>
+       <table> 
+               <tr>
+                       <td>
+                               {t}Organization{/t}
+                       </td>
+                       <td>
+                               <input name='organization' type='text' value='{$organization}' style='width:300px;'>
+                       </td>
+               </tr>
+               <tr>
+                       <td>
+                               {t}Name{/t}
+                       </td>
+                       <td>
+                               <input name='name' type='text' value='{$name}' style='width:300px;'>
+                       </td>
+               </tr>
+               <tr>
+                       <td>
+                               {t}Mail address{/t}{$must}
+                       </td>
+                       <td>
+                               <input name='eMail' type='text' value='{$eMail}' style='width:300px;'>  
+                       </td>
+               </tr>
+       </table>
+
+
+       <p>&nbsp;</p>
+       <h2>
+               <input {if $use_gosa_announce} checked {/if} type='checkbox' name='use_gosa_announce' value='1' class='center'>&nbsp;{t}Send feedback to the GOsa project team{/t}
+       </h2>
+       <p>
+       {t}When checking this option, GOsa will try to connect http://oss.gonicus.de in order to submit your form anonymously.{/t}
+       </p>
+       <b>{t}Generic{/t}</b>
+       <table> 
+               <tr>
+                       <td style='vertical-align:top'>
+                               {t}Did the setup procedure help you to get started?{/t}   
+                       </td>
+                       <td>
+                               <input {if $get_started} checked {/if} type='radio' name='get_started' value='1'>{t}Yes{/t}
+                               <br>
+                               <input {if !$get_started} checked {/if} type='radio' name='get_started' value='0'>{t}No{/t}
+                       </td>
+               </tr>
+               <tr>
+                       <td style='vertical-align:top'>
+                               {t}If not, what problems did you encounter{/t}:
+                       </td>
+                       <td>
+                               <textarea name='problems_encountered' rows='4' cols='50' style='width:100%'>{$problems_encountered}</textarea>
+                       </td>
+               </tr>
+               <tr>
+                       <td style='vertical-align:top'>
+                               {t}Is this the first time you use GOsa?{/t}
+                       </td>
+                       <td>
+                               <input {if $first_use} checked {/if} type='radio' name='first_use' value='1'>{t}Yes{/t}
+                               <br>
+                               <input {if !$first_use} checked {/if} type='radio' name='first_use' value='0'>{t}No{/t},
+                               {t}I use it since{/t}
+                               <select name='use_since' title='{t}Select the year since when you are using GOsa{/t}'> 
+                                       {html_options options=$years}
+                               </select>
+                       </td>   
+               </tr>
+               <tr>
+                       <td style='vertical-align:top'>
+                               {t}What operating system / distribution do you use?{/t}
+                       </td>
+                       <td>
+                               <input type='text' name='distribution' size=50 value='{$distribution}'>
+                       </td>
+               </tr>
+               <tr>
+                       <td style='vertical-align:top'>
+                               {t}What web server do you use?{/t}
+                       </td>
+                       <td>
+                               <input type='text' size=50 name='web_server' value='{$web_server}'>
+                       </td>
+               </tr>
+               <tr>
+                       <td style='vertical-align:top'>
+                               {t}What PHP version do you use?{/t}
+                       </td>
+                       <td>
+                               <input type='text' size=50 name='php_version' value='{$php_version}'>
+                       </td>
+               </tr>
+       </table>
+
+       <br><b>{t}LDAP{/t}</b>
+       <table>
+               <tr>
+                       <td style='vertical-align:top'>
+                       {t}What kind of LDAP server(s) do you use?{/t}
+                       </td>
+                       <td><input type='text' name='ldap_server' size=50 value='{$ldap_server}'>
+                       </td>
+               </tr>
+               <tr>
+                       <td>{t}How many objects are in your LDAP?{/t}
+                       </td>
+                       <td><input type='text' name='object_count' size=50 value='{$object_count}'>
+                       </td>
+               </tr>
+       </table>
+
+       <br><b>{t}Features{/t}</b>
+       <table>
+               <tr>
+                       <td style='vertical-align:top'>{t}What features of GOsa do you use?{/t}
+                       </td>
+                       <td>
+                               {foreach from=$features_used item=data key=key}
+                                       <input type='checkbox' name='feature_{$key}' {if $data.USED} checked {/if}>
+                                       {$data.NAME}<br>
+                               {/foreach}
+                       </td>
+               </tr>
+               <tr>
+                       <td style="vertical-align:top">{t}What features do you want to see in future versions of GOsa?{/t}
+                       </td>
+                       <td><textarea name='want_to_see_next' cols=50 rows=3>{$want_to_see_next}</textarea>
+                       </td>
+               </tr>
+       </table>
+</div>
+<input type='submit' name='send_feedback' value='{t}Send feedback{/t}'>
+<input type='hidden' name='step_feedback' value='1'>
diff --git a/gosa-core/setup/setup_finish.tpl b/gosa-core/setup/setup_finish.tpl
new file mode 100644 (file)
index 0000000..87b6732
--- /dev/null
@@ -0,0 +1,23 @@
+<div class='default'>
+       <p>
+               <b>{t}Create your configuration file{/t}</b>
+       </p>
+       <p>     
+               {$msg2}
+       </p>
+       <tt>
+       chown root.{$webgroup} {$CONFIG_DIR}/{$CONFIG_FILE}<br>
+       chmod 640 {$CONFIG_DIR}/{$CONFIG_FILE}
+       </tt>
+       <p>     
+               <input type='submit' name='getconf' value='{t}Download configuration{/t}'>
+       </p>
+               {if $err_msg != ""}
+                       <p class="seperator">&nbsp;</p>
+                       <br>
+                       {t}Status: {/t}
+                       <a style='color:red ; font-weight:bold '>{$err_msg}</a>
+               {/if}
+
+</div>
+<input type='hidden' value='1' name='step8_posted'>
diff --git a/gosa-core/setup/setup_frame.tpl b/gosa-core/setup/setup_frame.tpl
new file mode 100644 (file)
index 0000000..7da5205
--- /dev/null
@@ -0,0 +1,47 @@
+<body class='setup_body'>
+{$php_errors}
+<form action='setup.php' name='mainform' method='post' enctype='multipart/form-data'>
+       {$msg_dialogs}
+<input id='focus' name='focus' type='image' src='images/empty.png' style='width:0px; height:0px;' >
+<div class='setup_dialog'>
+       <div class='setup_header'>
+               <div style="float:left;"><img src='themes/default/images/go_logo.png' class='center' alt='GOsa'></div>
+               <div style="padding-top:8px;text-align:right;height:28px">{$version}</div>
+       </div>
+       <div class='setup_menu'>
+               <b>{t}GOsa setup wizard{/t}</b>
+       </div>
+
+       <div style="padding:10px;background-color:white;">
+
+               <div class='setup_navigation'>
+                       <div style='padding:4px'>
+                               <img src='images/fai.png' class='center' alt='{t}Installation{/t}'>&nbsp;&nbsp;<font style="font-size:24px;">{t}Steps{/t}</font>
+                       </div>
+                       {$navigation}           
+               </div>
+       
+               <div class='setup_contents'>
+                       <div style='border-bottom:1px dashed #AAAAAA'>
+                               {$errors}
+                               {$header}
+                       </div>
+                       <div style='padding-left:12px;'>
+                               {$contents}
+                               {$bottom}
+                               <br>
+                       </div>
+               </div>
+               <div style="clear:both">        </div>
+       </div>
+</div>
+
+
+<input type='hidden' name='setup_goto_step' value=''>
+</form>
+
+<script type='javascript'>
+       document.getElementById('focus').focus();
+</script>
+</body>
+</html>
diff --git a/gosa-core/setup/setup_language.tpl b/gosa-core/setup/setup_language.tpl
new file mode 100644 (file)
index 0000000..6d1b30b
--- /dev/null
@@ -0,0 +1,13 @@
+<div>
+       <div class='default'>
+               <p><b>{t}Please select the preferred language{/t}</b></p>
+               <p>
+               {t}At this point, you can select the site wide default language. Choosing 'automatic' will use the language requested by the browser. This setting can be overriden per user.{/t}
+               </p>
+       </div>
+       <div class='default' style='padding-right:10px; margin-bottom:20px;'>
+               <select name='lang_selected' title='{t}Please your preferred language here{/t}' size=20 style="width:100%">
+               {html_options options=$languages selected=$lang_selected}
+               </select>
+       </div>
+</div>
diff --git a/gosa-core/setup/setup_ldap.tpl b/gosa-core/setup/setup_ldap.tpl
new file mode 100644 (file)
index 0000000..b1ef46e
--- /dev/null
@@ -0,0 +1,136 @@
+<div class='default' style="width:100%; margin-right:20px;">
+
+       {if $resolve_user}
+
+       <div style='float:left; width:99%; margin-bottom:20px;'>
+               <p>
+               <b>{t}Please choose the LDAP user to be used by GOsa{/t}</b>
+               </p>
+               <select name='admin_to_use' size=20 style="width:100%; margin-bottom:10px;">                            
+                       {html_options options=$resolved_users selected=$admin}
+               </select>
+               <input type='text' value='{$resolve_filter}' name='resolve_filter'>
+               <input type='submit' value='{t}Search{/t}' name='resolve_search'>
+               <p class='seperator' style='margin-bottom:10px;'>&nbsp;</p>
+               <div style='text-align:right'>
+               <input type='submit' value='{t}Apply{/t}' name='use_selected_user'>
+               <input type='submit' value='{t}Cancel{/t}' name='resolve_user'>
+               </div>
+       </div>          
+       
+       <div style="clear:both;"></div>
+
+       {else}
+       <p>
+       <b>{t}LDAP connection{/t}</b>
+       </p>
+       <div class='step4_container'>
+               <div class='step4_name'>
+                       {t}Location name{/t}
+               </div>
+               <div class='step4_value'>
+                       <input type='text' name='location' maxlength='80' size='40' value='{$location}'>
+               </div>
+       </div>
+       <div class='step4_container'>
+               <div class='step4_name'>
+                       <div style='vertical-align:middle;height:100%;'>{t}Connection URL{/t}</div>
+               </div>
+               <div class='step4_value'>
+                       <input type='text' name='connection' maxlength='80' size='40' value='{$connection}'>
+               </div>
+       </div>
+        <div class='step4_container'>
+          <div class='step4_name'>
+            {t}TLS connection{/t}
+          </div>
+          <div class='step4_value'>
+            <select name="tls" size="1" title="">
+                       {html_options options=$bool selected=$tls}
+            </select>
+          </div>
+        </div>
+       <div class='step4_container'>
+               <div class='step4_name'> 
+                       {t}Base{/t}
+               </div>
+               <div class='step4_value'>
+                       {if $namingContextsCount >= 1}
+                               <select name='base'>            
+                                       {html_options values=$namingContexts output=$namingContexts selected=$base}
+                               </select>
+                       {else}
+                               <input type='text' name='base' maxlength='80' size='40' value='{$base}'>
+                       {/if}
+                       <input type='image' class='center' src='images/list_reload.png' title='{t}Reload{/t}' name='reload' alt='{t}Reload{/t}'>
+               </div>
+       </div>
+       <p style="margin-top:20px">
+       <b>{t}Authentication{/t}</b>
+       </p>
+       <div class='step4_container'>
+               <div class='step4_name'> 
+                       {t}Admin DN{/t}
+               </div>
+               <div class='step4_value'>
+                       <input type='text' name='admin_given' maxlength='160' size='40' value='{$admin_given}'>
+                       {if $append_base_to_admin_dn},{$base_to_append}{/if}
+                       <input type='image' class='center' src='images/folder.png' title='{t}Select user{/t}' name='resolve_user' alt='{t}Select user{/t}'>
+               </div>
+       </div>
+
+       <div class='step4_container'>
+               <div class='step4_name'> 
+               </div>
+               <div class='step4_value'>
+                       <input onClick='document.mainform.submit();' {if $append_base_to_admin_dn} checked {/if} type='checkbox' name='append_base_to_admin_dn' value='1'>&nbsp;{t}Automatically append LDAP base to admin DN{/t}
+               </div>
+       </div>
+
+
+       <div class='step4_container'>
+               <div class='step4_name'>
+                       {t}Admin password{/t}
+               </div>
+               <div class='step4_value'>
+                       <input type='password' name='password' maxlength='20' size='20' value='{$password}'>
+               </div>
+       </div>
+
+       <p style="margin-top:20px">
+       <b>{t}Schema based settings{/t}</b>
+       </p>
+           <div class='step4_container'>
+               <div class='step4_name'>
+                   {t}Use rfc2307bis compliant groups{/t}
+               </div>
+               <div class='step4_value'>
+                   <select name="rfc2307bis" size="1" title="">
+                   {html_options options=$bool selected=$rfc2307bis}
+                   </select>
+               </div>
+           </div>
+       {/if}
+
+       {if ! $resolve_user}
+       <p style="margin-top:20px">
+       <b>{t}Current status{/t}</b>
+       </p>
+    <div class='step4_container' style='height:45px;'>
+        <div class='step4_name' style='height:45px;'>
+            {t}Information{/t}
+        </div>
+        <div class='step4_value' style='height:45px;'>
+                       {$connection_status}
+        </div>
+    </div>
+       {/if}
+
+</div>
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('location');
+  -->
+</script>
+
diff --git a/gosa-core/setup/setup_license.tpl b/gosa-core/setup/setup_license.tpl
new file mode 100644 (file)
index 0000000..47e7937
--- /dev/null
@@ -0,0 +1,11 @@
+<div style='float:left'>
+       <div class='default' style='margin:10px; border:1px solid #A0A0A0'>
+               <div style='height:450px;padding:5px;overflow:auto; '>
+                       {$License}
+               </div>
+       </div>  
+       <div style='width:95%; text-align: right'>
+               <input {if $accepted} checked {/if} type='checkbox' name='accepted' class="center">{t}I have read the license and accept it{/t}
+       </div>
+</div>
+<input type='hidden' name='step_license' value='1'>
diff --git a/gosa-core/setup/setup_migrate.tpl b/gosa-core/setup/setup_migrate.tpl
new file mode 100644 (file)
index 0000000..a165216
--- /dev/null
@@ -0,0 +1,364 @@
+<div>
+    <div class='default'>
+
+       {if $method == "default"}
+                       <p>{t}During the LDAP inspection, we're going to check for several common pitfalls that may occur when migration to GOsa base LDAP administration. You may want to fix the problems below, in order to provide smooth services.{/t}
+                       </p>
+
+                       {foreach from=$checks item=val key=key}
+                               <div style='width:98%; padding:4px; background-color:{cycle values="#F0F0F0, #FFF"}'>
+
+                       {if $checks.$key.ERROR_MSG}
+                                <!-- Add ability to display info popup -->
+                                <div class='step2_entry_container_info'>
+                        {else}
+                                <!-- Normal entry everything is fine -->
+                                <div class='step2_entry_container'>
+                        {/if}
+                               <div class='step2_entry_name'><b>{$checks.$key.TITLE}</b></div>
+                               <div class='step2_entry_status'>
+                               {if $checks.$key.STATUS}
+                                       <div class='step2_successful'>{$checks.$key.STATUS_MSG}</div>
+                               {else}
+                                       <div class='step2_failed'>{$checks.$key.STATUS_MSG}</div>
+                               {/if}
+                               </div>
+                                       {if $checks.$key.ERROR_MSG}
+                                               {$checks.$key.ERROR_MSG}
+                                       {/if}
+                               </div>
+                               </div>
+                       {/foreach}
+               <br>
+               <input type='submit' name='reload' value='{t}Check again{/t}'>
+
+               {elseif $method == "outside_winstations"}
+
+                       <h2>{t}Move windows workstations into a valid windows workstation department{/t}</h2>
+
+                       {t}This dialog allows you to move the displayed windows workstations into a valid department{/t}
+                       <br>
+                       {t}Be careful with this tool, there may be references pointing to this workstations that can't be migrated.{/t}
+                       <br>
+                       <br>    
+
+                       {foreach from=$outside_winstations item=val key=key}
+                               {if $outside_winstations.$key.selected}
+                                       <input id='select_winstation_{$key}' type='checkbox' name='select_winstation_{$key}' checked>
+                               {else}
+                                       <input id='select_winstation_{$key}' type='checkbox' name='select_winstation_{$key}'>
+                               {/if}
+
+                               &nbsp;{$outside_winstations.$key.dn}
+                               {if $outside_winstations.$key.ldif != ""}
+                    <div class="step2_entry_container_info" id="sol_8">
+                                               <div style='padding-left:20px;'>
+                                                       <pre>
+                                                               {$outside_winstations.$key.ldif}
+                                                       </pre>
+                                               </div>
+                                       </div>
+                               {/if}
+                               <br>
+                       {/foreach}
+                       <input type='checkbox' id='toggle_calue' onClick="toggle_all_('^select_winstation_','toggle_calue')">
+                       {t}Select all{/t}
+                       <p>
+                       <b>{t}Move selected windows workstations into the following GOsa department{/t} : </b>
+                       <select name='move_winstation_to'>
+                               {html_options options=$ous}
+                       </select>
+                       <br>
+                       <input type='submit' name='outside_winstations_dialog_perform' value='{t}Move selected workstations{/t}'>
+                       <input type='submit' name='outside_winstations_dialog_whats_done' value='{t}What will be done here{/t}'>
+                       </p>
+                               
+
+                       <p class='seperator'>&nbsp;</p> 
+                       <div style='width:100%; text-align:right; padding:5px;'>
+                               <input type='submit' name='outside_winstations_dialog_cancel' value='{t}Close{/t}'>
+                       </div>
+               
+
+               {elseif $method == "outside_groups"}
+
+                       <h2>{t}Move groups into configured group tree{/t}</h2>
+
+                        <p>
+                        {t}This dialog allows moving a couple of groups to the configured group tree. Doing this may straighten your LDAP service.{/t}
+                        </p>
+                        <p style='color:red'>
+                        {t}Be careful with this option! There may be references pointing to these groups. The GOsa setup can't migrate references, so you may want to cancel the migration in this case in this case.{/t}
+                        </p>
+                       <p>
+                       {t}Move selected groups into this group tree{/t}: 
+                       <select name='move_group_to'>
+                               {html_options options=$ous}
+                       </select>
+                       </p>
+
+                       {foreach from=$outside_groups item=val key=key}
+                               {if $outside_groups.$key.selected}
+                                       <input id='select_group_{$key}' type='checkbox' name='select_group_{$key}' checked>
+                               {else}
+                                       <input id='select_group_{$key}' type='checkbox' name='select_group_{$key}'>
+                               {/if}
+
+                               &nbsp;{$outside_groups.$key.dn}
+                               {if $outside_groups.$key.ldif != "" && $group_details}
+                      <div class="step2_entry_container_info" id="sol_8">
+<div style='padding-left:20px;'>
+<pre>
+{$outside_groups.$key.ldif}
+</pre>
+</div>
+</div>
+                               {/if}
+                               <br>
+                       {/foreach}
+
+                       <input type='checkbox' id='toggle_calue' onClick="toggle_all_('^select_group_','toggle_calue')">
+                       {t}Select all{/t}
+                       <br>
+                       <p>
+                        {if $group_details}
+                        <input type='submit' name='outside_groups_dialog_refresh' value='{t}Hide changes{/t}'>
+                        {else}
+                        <input type='submit' name='outside_groups_dialog_whats_done' value='{t}Show changes{/t}'>
+                        {/if}
+                       </p>
+
+                       <p class='seperator'>&nbsp;</p> 
+                       <div style='width:99%; text-align:right; padding:5px;'>
+                               <input type='submit' name='outside_groups_dialog_perform' value='{t}Apply{/t}'>
+                               &nbsp;
+                               <input type='submit' name='outside_groups_dialog_cancel' value='{t}Cancel{/t}'>
+                       </div>
+               
+               {elseif $method == "outside_users"}
+
+                       <h2>{t}Move users into configured user tree{/t}</h2>
+                       <p>
+                       {t}This dialog allows moving a couple of users to the configured user tree. Doing this may straighten your LDAP service.{/t}
+                       </p>
+                       <p style='color:red'>
+                       {t}Be careful with this option! There may be references pointing to these users. The GOsa setup can't migrate references, so you may want to cancel the migration in this case.{/t}
+                       </p>    
+                       <p>
+                       {t}Move selected users into this people tree{/t}: 
+                       <select name='move_user_to'>
+                               {html_options options=$ous}
+                       </select>
+                       </p>
+                       {foreach from=$outside_users item=val key=key}
+                               {if $outside_users.$key.selected}
+                                       <input id='select_user_{$key}' type='checkbox' name='select_user_{$key}' checked>
+                               {else}
+                                       <input id='select_user_{$key}' type='checkbox' name='select_user_{$key}'>
+                               {/if}
+
+                               &nbsp;{$outside_users.$key.dn}
+                               {if $outside_users.$key.ldif != "" && $user_details}
+                      <div class="step2_entry_container_info" id="sol_8">
+<div style='padding-left:20px;'>
+<pre>
+{$outside_users.$key.ldif}
+</pre>
+</div>
+</div>
+                               {/if}
+                               <br>
+                       {/foreach}
+                       <input type='checkbox' id='toggle_calue' onClick="toggle_all_('^select_user_','toggle_calue')">
+                       {t}Select all{/t}
+                       <br>
+
+                       {if $user_details}
+                       <input type='submit' name='outside_users_dialog_refresh' value='{t}Hide changes{/t}'>
+                        {else}
+                       <input type='submit' name='outside_users_dialog_whats_done' value='{t}Show changes{/t}'>
+                       {/if}
+
+                       <p class='seperator'>&nbsp;</p> 
+                       <div style='width:99%; text-align:right; padding:5px;'>
+                               <input type='submit' name='outside_users_dialog_perform' value='{t}Apply{/t}'>
+                               &nbsp;
+                               <input type='submit' name='outside_users_dialog_cancel' value='{t}Cancel{/t}'>
+                       </div>
+               
+
+               {elseif $method == "create_acls"}
+
+               {if $acl_create_selected != "" && $what_will_be_done_now!=""}
+                       <div>
+<pre>
+{$what_will_be_done_now}
+</pre>
+                       </div>          
+                       <input type='submit' name='create_acls_create_confirmed' value='{t}Next{/t}'>
+                       <input type='submit' name='create_acls_create_abort' value='{t}Abort{/t}'>
+               {else}
+                       <h2>{t}Create a new GOsa administrator account{/t}</h2>
+       
+                       <p>
+                       {t}This dialog will automatically add a new super administrator to your LDAP tree.{/t}
+                       </p>
+                       <table>
+                               <tr>
+                                       <td>
+                                               {t}Name{/t}:&nbsp;
+                                       </td>
+                                       <td>
+                                               <i>System administrator</i>
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>
+                                               {t}User ID{/t}:&nbsp;
+                                       </td>
+                                       <td>
+                                               <input type='text' value='{$new_user_uid}' name='new_user_uid'><br>
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>
+                                               {t}Password{/t}:&nbsp;
+                                       </td>
+                                       <td>
+                                               <input type='password' value='{$new_user_password}' name='new_user_password'><br>
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>
+                                               {t}Password (again){/t}:&nbsp;
+                                       </td>
+                                       <td>
+                                               <input type='password' value='{$new_user_password2}' name='new_user_password2'><br>
+                                       </td>
+                               </tr>
+                       </table>
+       
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('new_user_password');
+  -->
+</script>
+
+                       <p class='seperator'>&nbsp;</p> 
+                       <div style='width:99%; text-align:right; padding:5px;'>
+                               <input type='submit' name='create_admin_user' value='{t}Apply{/t}'>     
+                               <input type='submit' name='create_acls_cancel' value='{t}Cancel{/t}'>
+                       </div>
+                       {/if}   
+               {elseif $method == "migrate_deps"}
+       
+                       <h2>Department migration</h2>
+
+                       <p>{t}The listed departments are currenlty invisble in the GOsa user interface. If you want to change this for a couple of entries, select them and use the migrate button below.{/t}</p>
+                       <p>{t}If you want to know what will be done when migrating the selected entries, use the 'Show changes' button to see the LDIF.{/t}</p>
+                                       
+                       {foreach from=$deps_to_migrate item=val key=key}
+
+                               {if $deps_to_migrate.$key.checked}
+                                       <input id='migrate_{$key}' type='checkbox' name='migrate_{$key}' checked>
+                                       {$deps_to_migrate.$key.dn}
+                                       {if $deps_to_migrate.$key.after != ""}
+                                               <div class="step2_entry_container_info" id="sol_8">
+
+{t}Current{/t}
+<div style='padding-left:20px;'>
+<pre>
+dn: {$deps_to_migrate.$key.dn}
+{$deps_to_migrate.$key.before}
+</pre>
+</div>
+{t}After migration{/t}
+<div style='padding-left:20px;'>
+<pre>
+dn: {$deps_to_migrate.$key.dn}
+{$deps_to_migrate.$key.after}
+</pre>
+</div>
+                                               </div>
+                                       {/if}
+                               {else}
+                                       <input id='migrate_{$key}' type='checkbox' name='migrate_{$key}'>
+                                       {$deps_to_migrate.$key.dn}
+                               {/if}
+                               
+                       <br>
+                       {/foreach}
+                       <input type='checkbox' id='toggle_calue' onClick="toggle_all_('^migrate_','toggle_calue')">
+                       {t}Select all{/t}
+                       <br>
+
+                       {if $deps_details}
+                       <input type='submit' name='deps_visible_migrate_refresh' value='{t}Hide changes{/t}'>
+                       {else}
+                       <input type='submit' name='deps_visible_migrate_whatsdone' value='{t}Show changes{/t}'>
+                       {/if}
+
+                       <p class='seperator'>&nbsp;</p> 
+
+                       <div style='width:99%; text-align:right; padding:5px;'>
+                               <input type='submit' name='deps_visible_migrate_migrate' value='{t}Apply{/t}'>
+                               &nbsp;
+                               <input type='submit' name='deps_visible_migrate_close' value='{t}Cancel{/t}'>
+                       </div>
+               {elseif $method == "migrate_users"}
+       
+                       <h2>User migration</h2>
+
+                       <p>{t}The listed users are currenlty invisble in the GOsa user interface. If you want to change this for a couple of users, just select them and use the 'Migrate' button below.{/t}</p>
+                       <p>{t}If you want to know what will be done when migrating the selected entries, use the 'Show changes' button to see the LDIF.{/t}</p>
+                       {foreach from=$users_to_migrate item=val key=key}
+
+                               {if $users_to_migrate.$key.checked}
+                                       <input type='checkbox' name='migrate_{$key}' checked id='migrate_{$key}'>
+                                       {$users_to_migrate.$key.dn}
+                                       {if $users_to_migrate.$key.after != ""}
+                                               <div class="step2_entry_container_info" id="sol_8">
+
+{t}Current{/t}
+<div style='padding-left:20px;'>
+<pre>
+dn: {$users_to_migrate.$key.dn}
+{$users_to_migrate.$key.before}
+</pre>
+</div>
+{t}After migration{/t}
+<div style='padding-left:20px;'>
+<pre>
+dn: {$users_to_migrate.$key.dn}
+{$users_to_migrate.$key.after}
+</pre>
+</div>
+                                               </div>
+                                       {/if}
+                               {else}
+                                       <input type='checkbox' name='migrate_{$key}' id='migrate_{$key}'>
+                                       {$users_to_migrate.$key.dn}
+                               {/if}
+                               <br>
+                       {/foreach}
+                       <input type='checkbox' id='toggle_calue' onClick="toggle_all_('^migrate_','toggle_calue')">
+                       {t}Select all{/t}
+                       <br>
+
+                       {if $user_details}
+                       <input type='submit' name='users_visible_migrate_refresh' value='{t}Hide changes{/t}'>
+                       {else}
+                       <input type='submit' name='users_visible_migrate_whatsdone' value='{t}Show changes{/t}'>
+                       {/if}
+
+                       <p class='seperator'>&nbsp;</p> 
+
+                       <div style='width:99%; text-align:right; padding-top:5px;'>
+                               <input type='submit' name='users_visible_migrate_migrate' value='{t}Apply{/t}'>
+                               &nbsp;
+                               <input type='submit' name='users_visible_migrate_close' value='{t}Cancel{/t}'>
+                       </div>
+       {/if}
+    </div>
+</div>
diff --git a/gosa-core/setup/setup_schema.tpl b/gosa-core/setup/setup_schema.tpl
new file mode 100644 (file)
index 0000000..e56538b
--- /dev/null
@@ -0,0 +1,40 @@
+<div class='default'>
+    <p>
+     <b>{t}Schema specific settings{/t}</b>
+    </p>
+    <div class='step4_container'>
+        <div class='step4_name' style='width:30%'>
+            {t}Enable schema validation when logging in{/t}
+        </div>
+        <div class='step4_value'>
+                       <select name='enable_schema_check'>
+                               {html_options options=$bool selected=$enable_schema_check}
+            </select>
+        </div>
+    </div>
+    <p>
+     <b>{t}Check status{/t}</b>
+    </p>
+       <div>
+               {if $failed_checks == 0}
+                       <font style="color:green">{t}Schema check succeeded{/t}</font>
+               {else}
+                       <img src='images/small_warning.png' class='center'>
+                               <font style="color:red">{t}Schema check failed{/t}</font>
+               {/if}
+       </div>
+       <div style="margin-left:20px;">
+               {foreach from=$checks item=val key=key}
+                               {if !$checks[$key].STATUS}
+                               <br>
+                                       {if $checks[$key].IS_MUST_HAVE}
+                                               <font color='red'>{$checks[$key].MSG}</font>
+                                       {else}
+                                               {$checks[$key].MSG}
+                                       {/if}
+                               <br>
+                               {/if}
+               {/foreach}
+       </div>
+</div>
+<input type='hidden' value='1' name='step7_posted'>
diff --git a/gosa-core/setup/setup_welcome.tpl b/gosa-core/setup/setup_welcome.tpl
new file mode 100644 (file)
index 0000000..e6f76c7
--- /dev/null
@@ -0,0 +1,37 @@
+<div>
+    <div class='default'>
+       <p>
+       {t}This seems to be the first time you start GOsa - we didn't find any configuration right now. This simple wizard intends to help you while setting it up.{/t}
+       </p>
+       
+       <p style='border-top:1px solid #AAAAAA; padding-top:10px;'>
+       <b>{t}What will the wizard do for you?{/t}</b>
+       </p>
+       <ul>
+        <li>{t}Create a basic, single site configuration{/t}</li>
+        <li>{t}Tries to find problems within your PHP and LDAP setup{/t}</li>
+        <li>{t}Let you choose from a set of basic and advanced configuration switches{/t}</li>
+        <li>{t}Guided migration of existing LDAP trees{/t}</li>
+       </ul>
+       <p>
+       <b>{t}What will the wizard NOT do for you?{/t}</b>
+       </p>
+       <ul>
+        <li>{t}Find every possible configuration error{/t}</li>
+        <li>{t}Migrate every possible LDAP setup - create backup dumps!{/t}</li>
+       </ul>
+
+       <p style='border-top:1px solid #AAAAAA; padding-top:10px;'>
+       <b>{t}To continue...{/t}</b>
+       </p>
+       <p>
+       {t}For security reasons you need to authenticate for the installation by creating the file '/tmp/gosa.auth', containing the current session ID on the servers local filesystem. This can be done by executing the following command:{/t}
+       </p>
+       <tt>
+       echo -n <b>{$auth_id}</b> &gt; /tmp/gosa.auth
+       </tt>
+       <p>
+       {t}Click the 'Continue' button when you've finished.{/t}
+       </p>
+     </div>
+</div>
diff --git a/plugins/addons/addressbook/address_edit.tpl b/plugins/addons/addressbook/address_edit.tpl
deleted file mode 100644 (file)
index 8b51230..0000000
+++ /dev/null
@@ -1,274 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left; border:1px solid #B0B0B0;" cellpadding=4 cellspacing=0 border=0>
-       <tr style="background-color: #E8E8E8; height:26px;font-weight:bold;">
-               <td align=left width="100%">
-                       <LABEL for="storage_base">
-                               {$storage_info}
-                       </LABEL>
-                       <select id="storage_base" name="storage_base" size="1" title="{t}Choose the department to store entry in{/t}">
-                               {html_options options=$deplist selected=$storage_base}
-                       </select>
-               </td>
-               <td>
-                       <a href="{$url}">
-                               X
-                       </a>
-               </td>
-       </tr>
-       <tr style="background-color: white">
-               <td colspan=2>
-                       <table summary="" width="100%" cellspacing=2 cellpadding=4>
-                               <tr>
-                                       <td style="width:50%; vertical-align:top; background-color: #F0F0F0">
-                                               <h2>
-                                                       <img class="center" alt="" src="{$personal_image}" align=middle>
-                                                               &nbsp;{t}Personal{/t}
-                                               </h2>
-                                               <table summary="" width="100%">
-                                                       <tr>
-                                                               <td>
-                                                                       <LABEL for="sn">
-                                                                               {t}Last name{/t}{$must}
-                                                                       </LABEL>, 
-                                                                       <LABEL for="givenName">
-                                                                               {t}First name{/t}{$must}
-                                                                       </LABEL>
-                                                               </td>
-                                                               <td>
-{render acl=$snACL}    
-                                                                       <input id="sn" name="sn" size=10 maxlength=60 value="{$info_sn}">, 
-{/render}
-{render acl=$givenNameACL}
-                                                                       <input id="givenName" name="givenName" size=10 maxlength=60 value="{$info_givenName}">
-{/render}
-                                                               <td>
-                                                       </tr>
-                                                       <tr>
-                                                               <td>
-                                                                       <LABEL for="initials">
-                                                                               {t}Initials{/t}
-                                                                       </LABEL>
-                                                               </td>
-                                                               <td>
-{render acl=$initialsACL}
-                                                                       <input id="initials" name="initials" size=5 maxlength=20 value="{$info_initials}">
-{/render}
-                                                               </td>
-                                                       </tr>
-                                                       <tr>
-                                                               <td>
-                                                                       <LABEL for="title">
-                                                                               {t}Personal title{/t}
-                                                                       </LABEL>
-                                                               </td>
-                                                               <td>
-{render acl=$titleACL}
-                                                                       <input id="title" name="title" size=10 maxlength=20 value="{$info_title}">
-{/render}
-                                                               </td>
-                                                       </tr>
-                                               </table>
-                                       </td>
-                                       <td style="width:50%; vertical-align:top;background-color:#E8E8E8">
-                                               <h2>
-                                                       <img class="center" alt="" src="{$home_image}" align=middle>
-                                                       &nbsp;{t}Private{/t}
-                                               </h2>
-                                               <table summary="" width="100%">
-                                                       <tr>
-                                                               <td>
-                                                                       <LABEL for="homePostalAddress">
-                                                                               {t}Address{/t}
-                                                                       </LABEL>
-                                                               <br>
-                                                               <br>
-                                                               </td>
-                                                               <td style="vertical-align:top;">
-{render acl=$homePostalAddressACL}
-                                                                       <textarea id="homePostalAddress" name="homePostalAddress" rows=1 cols=20>{$info_homePostalAddress}</textarea>
-{/render}
-                                                               </td>
-                                                       </tr>
-                                                       <tr>
-                                                               <td>
-                                                                       <LABEL for="homePhone">
-                                                                               {t}Phone{/t}
-                                                                       </LABEL>
-                                                               </td>
-                                                               <td>
-{render acl=$homePhoneACL}
-                                                                       <input id="homePhone" name="homePhone" size=15 maxlength=60 value="{$info_homePhone}">
-{/render}
-                                                               </td>
-                                                       </tr>
-                                                       <tr>
-                                                               <td>
-                                                                       <LABEL for="mobile">
-                                                                               {t}Mobile{/t}
-                                                                       </LABEL>
-                                                               </td>
-                                                               <td>
-{render acl=$mobileACL}
-                                                                       <input id="mobile" name="mobile" size=15 maxlength=60 value="{$info_mobile}">
-{/render}
-                                                               </td>
-                                                       </tr>
-                                                       <tr>
-                                                               <td>
-                                                                       <LABEL for="mail">
-                                                                               {t}Email{/t}
-                                                                       </LABEL>
-                                                               </td>
-                                                               <td>
-{render acl=$mailACL}
-                                                                       <input id="mail" name="mail" size=15 maxlength=60 value="{$info_mail}">
-{/render}
-                                                               </td>
-                                                       </tr>
-                                                </table>
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td style="width:100%; vertical-align:top; background-color: #E4E4E4" colspan=2>
-                                               <h2>
-                                                       <img class="center" alt="" src="{$company_image}" align=middle>
-                                                       &nbsp;{t}Organizational{/t}
-                                               </h2>
-                                               <table summary="" width="100%">
-                                                       <tr>
-                                                               <td>
-                                                                       <table summary="" width="100%">
-                                                                               <tr>
-                                                                                       <td>
-                                                                                               <LABEL for="">  
-                                                                                                       {t}Company{/t}
-                                                                                               </LABEL>
-                                                                                       </td>
-                                                                                       <td>
-{render acl=$oACL}
-                                                                                               <input id="o" name="o" size=15 maxlength=60 value="{$info_o}">
-{/render}
-                                                                                       </td>
-                                                                               </tr>
-                                                                               <tr>
-                                                                                       <td>
-                                                                                               <LABEL for="">
-                                                                                                       {t}Department{/t}
-                                                                                               </LABEL>
-                                                                                       </td>
-                                                                                       <td>
-{render acl=$ouACL}
-                                                                                               <input id="ou" name="ou" size=15 maxlength=60 value="{$info_ou}">
-{/render}
-                                                                                       </td>
-                                                                               </tr>
-                                                                               <tr>
-                                                                                       <td>
-                                                                                               <LABEL for="">
-                                                                                                       {t}City{/t}
-                                                                                               </LABEL>
-                                                                                       </td>
-                                                                                       <td>
-{render acl=$lACL}
-                                                                                               <input id="l" name="l" size=15 maxlength=60 value="{$info_l}">
-{/render}
-                                                                                       </td>
-                                                                               </tr>
-                                                                               <tr>
-                                                                                       <td>
-                                                                                               <LABEL for="">
-                                                                                                       {t}Postal code{/t}
-                                                                                               </LABEL>
-                                                                                       </td>
-                                                                                       <td>
-{render acl=$postalCodeACL}
-                                                                                               <input id="postalCode" name="postalCode" size=15 maxlength=60 value="{$info_postalCode}">
-{/render}
-                                                                                       </td>
-                                                                               </tr>
-                                                                               <tr>
-                                                                                       <td>
-                                                                                               <LABEL for="">
-                                                                                                       {t}Country{/t}
-                                                                                               </LABEL>
-                                                                                       </td>
-                                                                                       <td>
-{render acl=$stACL}
-                                                                                               <input id="st" name="st" size=15 maxlength=60 value="{$info_st}">
-{/render}
-                                                                                       </td>
-                                                                               </tr>
-                                                                       </table>
-                                                                       </td>
-                                                                       <td style="vertical-align:top">
-                                                                       <table summary="" width="100%">
-                                                                               <tr>
-                                                                                       <td>
-                                                                                               <LABEL for="">
-                                                                                                       {t}Address{/t}
-                                                                                               </LABEL>
-                                                                                               <br>
-                                                                                               <br>
-                                                                                       </td>
-                                                                                       <td style="vertical-align:top;">
-{render acl=$postalAddressACL}
-                                                                                               <textarea id="postalAddress" name="postalAddress" rows=1 cols=20 >{$info_postalAddress}</textarea>
-{/render}
-                                                                                       </td>
-                                                                               </tr>
-                                                                               <tr>
-                                                                                       <td>
-                                                                                               <LABEL for="">
-                                                                                                       {t}Phone{/t}    
-                                                                                               </LABEL>
-                                                                                       </td>
-                                                                                       <td>
-{render acl=$telephoneNumberACL}
-                                                                                               <input id="telephoneNumber" name="telephoneNumber" size=15 maxlength=60 value="{$info_telephoneNumber}">
-{/render}
-                                                                                       </td>
-                                                                               </tr>
-                                                                               <tr>
-                                                                                       <td>
-                                                                                               <LABEL for="">
-                                                                                                       {t}FAX{/t}
-                                                                                               </LABEL>
-                                                                                       </td>
-                                                                                       <td>
-{render acl=$facsimileTelephoneNumberACL}
-                                                                                               <input id="facsimileTelephoneNumber" name="facsimileTelephoneNumber"
-                                                                                                       size=15 maxlength=60 value="{$info_facsimileTelephoneNumber}">
-{/render}
-                                                                                       </td>
-                                                                               </tr>
-                                                                               <tr>
-                                                                                       <td>
-                                                                                               <LABEL for="">
-                                                                                                       {t}Pager{/t}
-                                                                                               </LABEL>
-                                                                                       </td>
-                                                                                       <td>
-{render acl=$pagerACL}
-                                                                                               <input id="pager" name="pager" size=15 maxlength=60 value="{$info_pager}">
-{/render}
-                                                                                       </td>
-                                                                               </tr>
-                                                                       </table>
-                                                               </td>
-                                                       </tr>
-                                               </table>
-                                       </td>
-                               </tr>
-                       </table>
-
-                       <p align=right>
-                       <input type="submit" name="save" value="{t}Save{/t}">
-                       <input type="submit" name="cancel" value="{t}Cancel{/t}">
-                       </p>
-
-               </td>
-       </tr>
-</table>
-
-<!--
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
--->
diff --git a/plugins/addons/addressbook/address_info.tpl b/plugins/addons/addressbook/address_info.tpl
deleted file mode 100644 (file)
index 3bb3a22..0000000
+++ /dev/null
@@ -1,196 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left; border:1px solid #B0B0B0;" cellpadding=4 cellspacing=0 border=0>
- <tr style="background-color: #E8E8E8; height:26px;font-weight:bold;">
-  <td align=left width="100%">{$storage_info}
-  </td>
-  <td>
-   <a href="{$url}">X</a>
-  </td>
- </tr>
-
- <tr style="background-color: white">
-  <td colspan=2>
-
-   <table summary="" width="100%" cellspacing=2 cellpadding=4>
-    <tr>
-     <td style="width:50%; vertical-align:top; background-color: #F0F0F0">
-      <h2>
-       <img class="center" alt="" src="{$personal_image}" align=middle> 
-       {t}Personal{/t}
-      </h2>
-      <table summary="" width="100%">
-       <tr>
-        <td style='width:40%;'>
-         {t}Name{/t}
-        </td> 
-        <td>
-         <i>{$info_sn}, {$info_givenName}</i>
-        </td>
-       </tr>
-       <tr>
-        <td>
-         {t}Initials{/t}
-        </td> 
-        <td>
-         <i>{$info_initials}</i>
-        </td>
-       </tr>
-       <tr>
-        <td>
-         {t}Personal title{/t}
-        </td>
-        <td>
-         <i>{$info_title}</i>
-        </td>
-       </tr>
-      </table>
-
-     </td>
-     <td style="vertical-align:top; background-color: #E8E8E8">
-
-      <h2>
-       <img class="center" alt="" src="{$home_image}" align=middle> 
-       {t}Private{/t}
-      </h2>
-
-      <table summary="" width="100%">
-        <tr>
-         <td style='vertical-align:top; width: 40%;'>
-          {t}Address{/t}
-         </td>
-         <td style="vertical-align:top;">
-          <i>{$info_homePostalAddress}</i>
-         </td>
-        </tr>
-        <tr>
-         <td>
-          {t}Phone{/t}
-         </td>
-         <td>
-          <i>{$info_homePhone}</i>
-         </td>
-        </tr>
-        <tr>
-         <td>
-          {t}Mobile{/t}
-         </td>
-         <td>
-          <i>{$info_mobile}</i>
-         </td>
-        </tr>
-        <tr>
-         <td>
-          {t}Email{/t}
-         </td>
-         <td>
-          <i><a href="mailto:{$info_givenName}%20{$info_sn}%20%3C{$info_mail}%3E">{$info_mail}</a></i>
-         </td>
-        </tr>
-       </table>
-
-      </td>
-     </tr>
-
-     <tr>
-      <td style="vertical-align:top; background-color: #E4E4E4" colspan=2>
-
-       <h2>
-        <img class="center" alt="" src="{$company_image}" align=middle> 
-        {t}Organizational{/t}
-       </h2>
-
-       <table summary="" width="100%">
-        <tr>
-         <td width='50%'>
-  
-          <table summary="" width="100%">
-           <tr>
-            <td style='width:40%;'>
-             {t}Company{/t}
-            </td>
-            <td>
-             <i>{$info_o}</i>
-            </td>
-           </tr>
-           <tr>
-            <td>
-             {t}Department{/t}
-            </td>
-            <td>
-             <i>{$info_ou}</i>
-            </td>
-           </tr>
-           <tr>
-            <td> 
-             {t}City{/t}
-            </td>
-            <td>
-             <i>{$info_l}</i>
-            </td>
-           </tr>
-           <tr>
-            <td>
-             {t}Postal code{/t}
-            </td>
-            <td>
-             <i>{$info_postalCode}</i>
-            </td>
-           </tr>
-           <tr>
-            <td>
-             {t}Country{/t}
-            </td>
-            <td>
-             <i>{$info_st}</i>
-            </td>
-           </tr>
-          </table>
-
-         </td>
-         <td style="vertical-align:top">
-
-          <table summary="" width="100%">
-           <tr>
-            <td style='vertical_align:top; width:40%;'>
-             {t}Address{/t}
-            </td>
-            <td style="vertical-align:top;">
-             <i>{$info_postalAddress}</i>
-            </td>
-           </tr>
-           <tr>
-            <td>
-             {t}Phone{/t}
-            </td>
-            <td>
-             <i>{$info_telephoneNumber}</i>
-            </td>
-           </tr>
-           <tr>
-            <td>
-             {t}FAX{/t}
-            </td>
-            <td>
-             <i>{$info_facsimileTelephoneNumber}</i>
-            </td>
-           </tr>
-           <tr>
-            <td>
-             {t}Pager{/t}
-            </td>
-            <td>
-             <i>{$info_pager}</i>
-            </td>
-           </tr>
-          </table>
-         </td>
-        </tr>
-       </table>
-
-      </td> 
-     </tr>
-    </table>
-
-   </td>
- </tr>
-</table>
diff --git a/plugins/addons/addressbook/class_addressbook.inc b/plugins/addons/addressbook/class_addressbook.inc
deleted file mode 100644 (file)
index 67bb345..0000000
+++ /dev/null
@@ -1,835 +0,0 @@
-<?php
-
-class addressbook extends plugin
-{
-       /* Definitions */
-       var $plHeadline   = "Addressbook";
-       var $plDescription= "This does something";
-
-  /* Generic */
-  var $ui;  
-
-       /* Phonelist attributes */
-       var $telephone_list   = array();
-       var $new_dn           = "";
-       var $orig_cn          = "";
-       var $storage_base     = "";
-       var $orig_storage_base= "";
-
-  /* Filter attributes */
-       var $start            = 0;
-       var $search_for       = "*";
-       var $search_base      = "";
-       var $search_type      = "";
-       var $range            = 20;
-
-  /* Currently edited/added entry attributes */
-       var $sn                       = "";
-       var $cn                       = "";
-       var $givenName                = "";
-       var $mail                     = "";
-       var $title                    = "";
-       var $personalTitle            = "";
-       var $initials                 = "";
-       var $homePostalAddress        = "";
-       var $homePhone                = "";
-       var $mobile                   = "";
-       var $o                        = "";
-       var $postalAddress            = "";
-       var $l                        = "";
-       var $postalCode               = "";
-       var $st                       = "";
-       var $ou                       = "";
-       var $telephoneNumber          = "";
-       var $facsimileTelephoneNumber = "";
-       var $pager                    = "";
-  var $view_logged              = FALSE;
-
-       /* attribute list for save action */
-       var $attributes= array("sn", "givenName", "mail", "title",
-                       "initials", "homePostalAddress", "displayName",
-                       "homePhone", "mobile", "o", "postalAddress", "l",
-                       "postalCode", "st", "ou", "telephoneNumber",
-                       "facsimileTelephoneNumber", "pager");
-
-       var $objectclasses= array("top", "person", "organizationalPerson", "inetOrgPerson");
-
-       var $abobjectclass= "dc=addressbook";
-
-  function addressbook (&$config, $dn= NULL)
-  {
-    /* Include config object */
-    $this->config= &$config;
-
-    /* Check if there is a special ldap-sub-tree specified, instead of dc=addressbook, */
-    $aoc = $this->config->search("addressbook", "LDAP_OBJECT_CLASS",array('menu'));
-    if ($aoc != ""){
-      $this->abobjectclass  = $aoc;
-    }
-
-    /* Get global filter config */
-    if (!is_global("phonefilter")){
-      $ui         = get_userinfo();
-      $base       = get_base_from_people($ui->dn);
-      $phonefilter= array(
-          "search_base"       => $base,
-          "organizational"    => "checked",
-          "global"            => "checked",
-          "search_for"        => "*",
-          "object_type"       => "*");
-      register_global("phonefilter", $phonefilter);
-    }
-     
-    $this->ui = get_userinfo();
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    $smarty= get_smarty();
-
-    /* Prevent empty variables for smarty */
-    foreach($this->attributes as $atr) {
-      $smarty->assign($atr,"");
-    }
-
-    /* Save formular information */
-    $phonefilter= get_global("phonefilter");
-    foreach( array("search_for", "search_base", "object_type") as $type){
-      if (isset($_POST[$type])){
-        $phonefilter[$type]= $_POST[$type];
-      }
-      $this->$type= $phonefilter[$type];
-    }
-    if (isset($_POST['search_base'])){
-      foreach( array("organizational", "global") as $type){
-        if (isset($_POST[$type])){
-          $phonefilter[$type]= "checked";
-        } else {
-          $phonefilter[$type]= "";
-        }
-      }
-    }
-
-    /* Search string */
-    $s= $phonefilter['search_for'];
-    if ($s == "") {
-      $s= "*";
-    }
-    if (isset($_GET['search'])){
-      $s= validate(mb_substr($_GET['search'], 0, 1, "UTF8"))."*";
-      if ($s == "**"){
-        $s= "*";
-      }
-      $this->search_for= $s;
-      $phonefilter['search_for']= $s;
-    }
-    register_global("phonefilter", $phonefilter);
-
-    /* Assign create acl */
-    $acl = $this->get_entry_acls($this->abobjectclass.",".$phonefilter['search_base']);
-    $smarty->assign("internal_createable", preg_match("/c/",$acl));
-    $smarty->assign("internal_removeable", preg_match("/d/",$acl));
-    $smarty->assign("internal_editable",   preg_match("/w/",$acl));
-
-    /* Perform actions with CTI hook */
-    if (isset($_GET['target'])
-        && isset($_GET['dial'])
-        && isset($this->config->current['CTIHOOK'])){
-
-      $dialmode= $_GET['dial'];
-      if ($dialmode == "telephoneNumber" ||
-          $dialmode == "mobile" ||
-          $dialmode == "homePhone"){
-
-        /* Get target */
-        $ldap= $this->config->get_ldap_link();
-        $ldap->cat(base64_decode($_GET['target']), array('telephoneNumber', 'mobile', 'homePhone'));
-        $attrs= $ldap->fetch();
-        if (isset($attrs["$dialmode"])){
-          $target= $attrs[$dialmode][0];
-        } else {
-          $target= "";
-        }
-
-        /* Get source */
-        $ui= get_userinfo();
-        $ldap->cat($ui->dn, array('telephoneNumber'));
-        $attrs= $ldap->fetch();
-        if (isset($attrs["telephoneNumber"])){
-          $source= $attrs['telephoneNumber'][0];
-        } else {
-          $source= "";
-        }
-
-        /* Save to session */
-        $_SESSION['source']= $source;
-        $_SESSION['target']= $target;
-
-        /* Perform call */
-        if ($target != "" && $source != ""){
-          $smarty->assign("phone_image", get_template_path('images/phone.png'));
-          $smarty->assign("dial_info", sprintf(_("Dial from %s to %s now?"), "<b style='font-size:22px; color:red'>".$source."</b>", "<b style='font-size:22px;color:red'>".$target."</b>"));
-          return($smarty->fetch(get_template_path('dial.tpl', TRUE)));
-          return;
-        } else {
-          print_red (_("You have no personal phone number set. Please change that in order to perform direct dials."));
-        }
-      }
-
-    }
-
-    /* Finally dial */
-    if (isset($_POST['dial']) && isset($_SESSION['source']) && isset($_SESSION['target'])){
-      exec ($this->config->current['CTIHOOK']." '".$_SESSION['source']."' '".$_SESSION['target']."'", $dummy, $retval);
-      unset($_SESSION['source']);
-      unset($_SESSION['target']);
-    }
-
-
-    /* Delete entry? */
-    if (isset($_POST['delete_entry_confirm'])){
-
-      /* Some nice guy may send this as POST, so we've to check
-         for the permissions again. */
-      
-      $acl = $this->get_entry_acls($this->dn);
-      if(preg_match("/d/",$acl)){
-
-        /* Delete request is permitted, perform LDAP action */
-        $ldap= $this->config->get_ldap_link();
-        $ldap->rmdir ($this->dn);
-        new log("remove","addressbook/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-        show_ldap_error($ldap->get_error(), sprintf(_("Removing of addressbook entry '%s' failed."),$this->dn));
-        new log("remove","addressbook/".get_class($this),$this->dn,array(),"Address book object'".$this->dn."' has been removed");
-  
-      } else {
-
-        /* Normally this shouldn't be reached, send some extra
-           logs to notify the administrator */
-        print_red (_("You are not allowed to delete this entry!"));
-        new log("remove","addressbook/".get_class($this),$this->dn,array(),"Warning: '".$this->ui->uid."' tried to trick address book deletion.");
-      }
-
-      /* Remove lock file after successfull deletion */
-      del_lock ($this->dn);
-
-      /* Clean up */
-      if (isset($_SESSION['saved_start'])){
-        $_GET['start']= $_SESSION['saved_start'];
-      }
-      unset($_SESSION['show_info']);
-      unset($_SESSION['saved_start']);
-    }
-
-
-    /* Delete entry? */
-    if (isset($_POST['delete_cancel'])){
-      del_lock ($this->dn);
-    }
-
-
-    /* Save address entry? */
-    if (isset($_POST['save'])){
-      $this->save_object();
-      $this->storage_base= $_POST['storage_base'];
-
-      /* Perform checks */
-      $message= $this->check ();
-
-      /* No errors, save object */
-      if (count ($message) == 0){
-        $this->save();
-
-        /* Clean up */
-        if (isset($_SESSION['saved_start'])){
-          $_GET['start']= $_SESSION['saved_start'];
-        }
-        $_SESSION['show_info']= $this->dn;
-        unset($_SESSION['saved_start']);
-      } else {
-        /* Errors found, show message */
-        show_errors ($message);
-      }
-    }
-
-
-    /* Close info window */
-    if (isset($_GET['close']) || isset($_POST['cancel'])){
-      if (isset($_SESSION['saved_start'])){
-        $_GET['start']= $_SESSION['saved_start'];
-      }
-      unset($_SESSION['show_info']);
-      unset($_SESSION['saved_start']);
-    }
-
-
-    /* Start address book edit mode? */
-    if (isset($_GET['global'])){
-      if (!isset($_SESSION['saved_start']) && isset($_GET['start'])){
-        $_SESSION['saved_start']= $_GET['start'];
-      }
-      switch ($_GET['global']){
-        case "add":
-          $this->dn= "new";
-        $this->orig_cn= "";
-
-        /* Clean values */
-        foreach ($this->attributes as $name){
-          $this->$name= "";
-        }
-        $this->saved_attributes= array();
-        $this->storage_base= $this->config->current["BASE"];
-        break;
-
-        case "edit":
-          /* Clean values */
-          foreach ($this->attributes as $name){
-            $this->$name= "";
-          }
-        $this->dn= $_SESSION['show_info']; 
-        $this->load();
-        $this->orig_cn= $this->cn;
-        break;
-        case "remove":
-          $this->dn= $_SESSION['show_info']; 
-        $this->load();
-
-        /* Load permissions for selected 'dn' and check if
-           we're allowed to remove this 'dn' */
-        $acl = $this->get_entry_acls($this->dn);
-        if(preg_match("/d/",$acl)){
-
-          /* Check locking, save current plugin in 'back_plugin', so
-             the dialog knows where to return. */
-          if (($user= get_lock($this->dn)) != ""){
-            return(gen_locked_message ($user, $this->dn));
-          }
-
-          /* Lock the current entry, so nobody will edit it during deletion */
-          $ui= get_userinfo();
-          add_lock ($this->dn, $ui->dn);
-          $smarty->assign("info", sprintf(_("You're about to delete the entry %s."), $this->dn));
-          return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
-        } else {
-
-          /* Obviously the user isn't allowed to delete. Show message and
-             clean session. */
-          print_red (_("You are not allowed to delete this entry!"));
-        }
-      }
-      $_SESSION['show_info']= "ADD";
-    }
-
-
-    /* Open info window */
-    if (isset($_GET['show'])){
-      if (!isset($_SESSION['saved_start'])){
-        $_SESSION['saved_start']= $_GET['start'];
-      }
-      $this->dn = base64_decode($_GET['show']);
-      $this->view_logged =FALSE;
-      if(!$this->view_logged){
-        $this->view_logged = TRUE;
-        new log("view","addressbook/".get_class($this),$this->dn);
-      }
-      $_SESSION['show_info']= base64_decode($_GET['show']);
-    }
-
-
-    /* Get ldap link / build filter */
-    $ldap= $this->config->get_ldap_link();
-    $this->telephone_list= array ();
-
-
-    /* Assemble bases 
-        (Depending on checkboxes, we search for organisational entries or seperated 
-        adressbook entries within dc=adressbook, ) */
-    $bases= array();
-    $filter= "";
-    if ($phonefilter['global'] == "checked"){
-      $bases[]= preg_replace("/".$this->config->current['BASE']."/", $this->abobjectclass.",".$this->config->current['BASE'], $this->search_base);
-    } else {
-      $filter= '(objectClass=gosaAccount)';
-    }
-    if ($phonefilter['organizational'] == "checked"){
-      $bases[]= $this->search_base;
-    }
-
-
-    /* Only display those entries that have at least on of this attributes set */
-    $must_have_this = array("telephoneNumber","facsimileTelephoneNumber","mobile","homePhone","mail");
-
-    /* Requested attributes in ldap search */
-    $attributes = array("sn", "givenName", "telephoneNumber", "facsimileTelephoneNumber", "mobile", "homePhone", "uid", "mail", "cn");
-
-    /* Create attribute filter part */
-    $attribute_filter = "";
-    foreach($attributes as $att){
-      $attribute_filter .= "(".$att."=".$s.")";
-    }
-
-    /* Walk through bases an check for usable entries */
-    foreach ($bases as $base){
-
-      $ldap->cd ($base);
-
-      if ($phonefilter['object_type'] == '*'){
-        $ldap->search (
-            "(&(objectClass=person)$filter(!(objectClass=gosaUserTemplate))".   // Skip templates etc ..
-            "(!(uid=*$))".                                                      // Skip entries with ...$ as uid 
-            "(|".$attribute_filter."))"                                         
-          ,$attributes); 
-      } else {
-        $ldap->search ("(&$filter(!(uid=*$))(!(objectClass=gosaUserTemplate))".                     //array
-            "(".$phonefilter['object_type']."=$s))", $attributes);
-      }
-
-      /* Walk through LDAP results */
-      while ($attrs= $ldap->fetch()){
-
-        /* prevent empty vaiables */
-        foreach($this->attributes as $atr)          {
-          if(!isset($attrs[$atr][0])) {
-            $attrs[$atr][0] = "";
-          }
-        }
-
-        /* Check if page number was posted */
-        if(!isset($_GET['start'])) {
-          $_GET['start']="";
-        }
-
-        /* Check if at least one attribute is specified */
-        $skip = false;
-
-        foreach($must_have_this as $attr)      {
-          if(isset($attrs[$attr][0]) && !empty($attrs[$attr][0])){
-            $skip =false;
-            break;
-          }
-        }
-
-        /* Skip all attributes that we are not allowed to read */
-        $any = false;
-        foreach($attributes as $attr){
-    
-          $acls = $this->get_entry_acls($attrs['dn'],$attr);  
-          if(!preg_match("/r/",$acls)){
-            $attrs[$attr][0] = "";
-          }else{
-            $any = true;
-          }
-        }
-        /* Only show lines that have set any mail or phone informations */
-        if(!$skip && $any){      
-  
-          $this->telephone_list[$attrs['sn'][0].$attrs['dn']]=
-
-            "<td class=\"phonelist\" title=\"".$attrs['sn'][0].", ".$attrs['givenName'][0].
-              "\"onClick='location.href=\"main.php?plug=".validate($_GET['plug']).
-                          "&amp;start=".validate($_GET['start']).
-                          "&amp;show=".urlencode(base64_encode($attrs['dn']))."\"'>
-              <a style='vertical-align:middle;' href=\"main.php?plug=".validate($_GET['plug']).
-                          "&amp;start=".validate($_GET['start']).
-                          "&amp;show=".urlencode(base64_encode($attrs['dn']))."\">".
-               $attrs['sn'][0].", ".$attrs['givenName'][0].
-            "</a>
-            &nbsp;</td>
-            <td class=\"phonelist\" title=\""._("Dial")." ".$attrs['telephoneNumber'][0]."\">
-            <a style='vertical-align:middle;' href=\"main.php?plug=".validate($_GET['plug'])."&amp;dial=telephoneNumber&amp;start=".validate($_GET['start'])."&amp;target=".base64_encode($attrs['dn'])."\">".$attrs['telephoneNumber'][0]."
-            </a>
-            &nbsp;</td>
-            <td class=\"phonelist\" title=\"".$attrs['facsimileTelephoneNumber'][0]."\">
-            ".$attrs['facsimileTelephoneNumber'][0]."
-            &nbsp;</td>
-            <td class=\"phonelist\" title=\""._("Dial")." ".$attrs['mobile'][0]."\">
-            <a style='vertical-align:middle;' href=\"main.php?plug=".validate($_GET['plug'])."&amp;dial=mobile&amp;start=".validate($_GET['start'])."&amp;target=".base64_encode($attrs['dn'])."\">".$attrs['mobile'][0]."
-            </a>
-            &nbsp;</td>
-            <td class=\"phonelist\" title=\""._("Dial")." ".$attrs['homePhone'][0]."\">
-            <a style='vertical-align:middle;' href=\"main.php?plug=".validate($_GET['plug'])."&amp;dial=homePhone&amp;start=".validate($_GET['start'])."&amp;target=".base64_encode($attrs['dn'])."\">".$attrs['homePhone'][0]."
-            </a>
-            &nbsp;</td>
-            <td>
-            <a href=\"getvcard.php?dn=".base64_encode($attrs['dn'])."\">
-            <img align=\"top\" border=0 src=\"images/save.png\" alt=\"vcf\" title=\"".sprintf(_("Save contact for %s as vcard"), $attrs['givenName'][0]." ".$attrs['sn'][0])."\">
-            </a>";
-
-
-          if(preg_match("/r/",$this->get_entry_acls($attrs['dn'],"mail"))){
-            if (isset($attrs['mail'][0]) && !empty($attrs['mail'][0])){
-              $dest= sprintf(_("Send mail to %s"), $attrs['mail'][0]);
-              $this->telephone_list[$attrs['sn'][0].$attrs['dn']].=
-
-                "<a href=\"mailto:".htmlentities($attrs['mail'][0])."\">".
-                "<img  align=\"top\" border=0 src=\"images/mailto.png\" alt=\"vcf\" title=\"$dest\"></a>";
-            }
-          }
-          $this->telephone_list[$attrs['sn'][0].$attrs['dn']].= "&nbsp;</td>";
-        }
-      }
-      error_reporting(E_ALL | E_STRICT);
-    }
-
-    /* Sort up list */
-    ksort ($this->telephone_list);
-    reset ($this->telephone_list);
-
-    /* Fill template variables */
-    $smarty->assign("search_for", $this->search_for);
-    $smarty->assign("object_type", $this->object_type);
-
-    $this->base = $phonefilter['search_base'];
-    $smarty->assign("deplist", $this->get_allowed_bases());
-    $smarty->assign("depselect", $this->search_base);
-    $smarty->assign("global", $phonefilter['global']);
-    $smarty->assign("organizational", $phonefilter['organizational']);
-    $smarty->assign("search_image", get_template_path('images/search.png'));
-    $smarty->assign("obj_image", get_template_path('images/list_ogroup.png'));
-    $smarty->assign("tree_image", get_template_path('images/tree.png'));
-    $smarty->assign("infoimage", get_template_path('images/info.png'));
-    $smarty->assign("actionimage", get_template_path('images/action.png'));
-    $smarty->assign("launchimage", get_template_path('images/launch.png'));
-
-    /* Generate alphabet */
-    $alphabet= generate_alphabet();
-
-    /* Build list output */
-    $output= "";
-    $mod= 0;
-
-
-    /* View detailed infos */
-    $smarty->assign("show_info", "");
-    if (isset($_SESSION['show_info'])){
-
-      $range= 4;
-      $smarty->assign("show_info", "1");
-      $smarty->assign("url", "main.php?plug=".validate($_GET['plug'])."&amp;close=1");
-
-      $tmp = $this->plInfo();
-
-      if(isset($_POST['storage_base'])){
-        $this->storage_base = $_POST['storage_base'];  
-      }
-
-      switch ($_SESSION['show_info']){
-
-        case "ADD":
-
-          $a_bases = $this->get_allowed_bases();
-  
-          if(!isset($a_bases[$this->storage_base])){
-            $base = key($this->get_allowed_bases());
-            $this->storage_base = $base;
-          } 
-
-          $smarty->assign ('storage_base', $this->storage_base);
-          $smarty->assign ('address_info', get_template_path('address_edit.tpl', TRUE));
-
-          foreach($tmp['plProvidedAcls'] as $name => $translated){
-            $smarty->assign($name."ACL",$this->get_entry_acls($this->abobjectclass.",".$base,$name));
-          }
-        break;
-
-        default:
-          $smarty->assign ('address_info', get_template_path('address_info.tpl', TRUE));
-          foreach($tmp['plProvidedAcls'] as $name => $translated){
-            $smarty->assign($name."ACL",$this->get_entry_acls($this->dn,$name));
-          }
-        break;
-      }
-
-      /* Fill variables from LDAP */
-      if ($_SESSION['show_info'] != "ADD"){
-        $ldap->cat($_SESSION['show_info'], $this->attributes);
-        $info= $ldap->fetch();
-      }
-      foreach ($this->attributes as $name){
-
-        /* Skip entries we are not allowed to read */
-        if(!preg_match("/r/",$this->get_entry_acls($this->dn,$name))){
-          $smarty->assign("info_$name", "");
-        }else
-
-        if ($_SESSION['show_info'] != "ADD" && isset($info["$name"][0])){
-          error_reporting(0);
-          /* Special treatment for phone attributes */
-          if ($name == "mobile" ||
-              $name == "homePhone" ||
-              $name == "telephoneNumber"){
-            $smarty->assign("info_$name",
-                "<a title=\""._("Dial")." ".$info["$name"][0]."\" href=\"main.php?plug=".validate($_GET['plug'])."&amp;dial=$name&amp;start=".validate($_GET['start'])."&amp;target=".base64_encode($_SESSION['show_info'])."\">".$info["$name"][0]."</a>");
-          } else {
-            $smarty->assign("info_$name", preg_replace("/\n/", "<br>", $info["$name"][0]));
-          }
-          error_reporting(E_ALL | E_STRICT);
-        } elseif ($_SESSION['show_info'] == "ADD" && isset($this->$name)) {
-          $smarty->assign("info_$name", $this->$name);
-        } else {
-          $smarty->assign("info_$name", "-");
-        }
-      }
-      if (preg_match("/,".$this->abobjectclass.",/", $_SESSION['show_info'])){
-        $storage= _("global addressbook");
-        $smarty->assign("internal", 0);
-      } else {
-        $storage= _("user database");
-        $smarty->assign("internal", 1);
-      }
-      if ($_SESSION['show_info'] != "ADD"){
-        $smarty->assign("storage_info", sprintf(_("Contact stored in '%s'"), $storage));
-      } else {
-        $smarty->assign("storage_info", _("Creating new entry in"));
-      }
-    } else {
-
-
-      if(isset($_POST['EntryPerPage'])){
-        $this->range = $_POST['EntryPerPage'];
-      }
-      $range = $this->range;   
-      $smarty->assign("internal", 1);
-    }
-    if (isset($_GET['start'])){
-      $this->start= validate($_GET['start']);
-    }
-    foreach ($this->telephone_list as $val){
-      if ($mod < $this->start) {
-        $mod++;
-        continue;
-      }
-      if ($mod >= ($this->start + $range)){
-        $mod++;
-        break;
-      }
-      if ( ($mod++) & 1){
-        $col= "style=\"background-color: #ECECEC;\"";
-      } else {
-        $col= "style=\"background-color: #F5F5F5;\"";
-      }
-      $output.= "<tr $col>\n$val</tr>\n";
-    }
-
-    $smarty->assign("search_result", $output);
-    $smarty->assign("apply", apply_filter());
-    $smarty->assign("alphabet", $alphabet);
-    if($range < 20){
-      $smarty->assign("range_selector", range_selector(count($this->telephone_list), $this->start, $range));
-    }else{
-      $smarty->assign("range_selector", range_selector(count($this->telephone_list), $this->start, $range, "EntryPerPage"));
-    }
-    $tmp= array("*" => _("All"), "sn" => _("Name"), "givenName" => _("Given name"),
-        "telephoneNumber" => _("Work phone"), "mobile" => _("Cell phone"),
-        "homePhone" => _("Home phone"), "uid" => _("User ID"));
-    natsort($tmp);
-    $smarty->assign("objlist", $tmp);
-
-    /* Show main page */
-    $smarty->assign ('personal_image', get_template_path('images/addr_personal.png'));
-    $smarty->assign ('home_image', get_template_path('images/addr_home.png'));
-    $smarty->assign ('company_image', get_template_path('images/addr_company.png'));
-    $smarty->assign ('add_image', get_template_path('images/editpaste.png'));
-    $smarty->assign ('edit_image', get_template_path('images/edit.png'));
-    $smarty->assign ('delete_image', get_template_path('images/editdelete.png'));
-    return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
-  }
-
-  function save_object()
-  {
-    plugin::save_object();
-    foreach($this->attributes as $attr){
-
-      /* save attributes depending on acls */
-      $acl = $this->get_entry_acls($this->dn,$attr);
-
-      if(preg_match("/w/",$acl)){
-        if(isset($_POST[$attr])){
-          $this->$attr = $_POST[$attr];
-        }
-      }
-
-    }
-  }
-
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    /* must: sn, givenName */
-    if ($this->sn == ""){
-      $message[]= _("The required field 'Name' is not set.");
-      return ($message);
-    }
-    if ($this->givenName == ""){
-      $message[]= _("The required field 'Given name' is not set.");
-      return ($message);
-    }
-
-    /* Check for valid name definition */
-    if (preg_match ("/[\\\\]/", $this->sn)){
-      $message[]= _("The field 'Name' contains invalid characters.");
-    }
-    if (preg_match ("/[\\\\]/", $this->givenName)){
-      $message[]= _("The field 'Given name' contains invalid characters.");
-    }
-
-    /* Check phone numbers */
-    if (!is_phone_nr($this->homePhone)){
-      $message[]= _("The field 'Phone' contains an invalid phone number.");
-    }
-    if (!is_phone_nr($this->telephoneNumber)){
-      $message[]= _("The field 'Phone' contains an invalid phone number.");
-    }
-    if (!is_phone_nr($this->facsimileTelephoneNumber)){
-      $message[]= _("The field 'Fax' contains an invalid phone number.");
-    }
-    if (!is_phone_nr($this->mobile)){
-      $message[]= _("The field 'Mobile' contains an invalid phone number.");
-    }
-    if (!is_phone_nr($this->pager)){
-      $message[]= _("The field 'Pager' contains an invalid phone number.");
-    }
-
-    /* Check for reserved characers */
-    if (preg_match ('/[,+"<>;]/', $this->givenName)){
-      $message[]= _("The field 'Given name' contains invalid characters.");
-  }
-  if (preg_match ('/[,+"<>;]/', $this->sn)){
-    $message[]= _("The field 'Name' contains invalid characters.");
-  }
-
-  /* Check mail */
-  if (!is_email($this->mail)){
-    $message[]= _("Please enter a valid email address in 'Primary address' field.");
-  }
-
-  /* Assemble cn/dn */
-  $this->cn= $this->givenName." ".$this->sn;
-  if ($this->orig_cn != $this->cn || $this->storage_base != $this->orig_storage_base){
-    $this->new_dn= $this->create_unique_dn("cn", preg_replace("/,*".$this->config->current['BASE']."$/", "", $this->storage_base).",".$this->abobjectclass.",".$this->config->current['BASE']);
-    if ($this->new_dn == "none"){
-      $message[]= _("Cannot create a unique DN for your entry. Please fill more formular fields.");
-      return ($message);
-    }
-  } else {
-    $this->new_dn= $this->dn;
-  }
-
-  return ($message);
-  }
-
-
-  function load()
-  {
-    /* Load base attributes */
-    plugin::plugin ($this->config, $this->dn);
-    $this->view_logged = FALSE;
-    $this->storage_base= preg_replace('/^[^,]+,/', '', preg_replace('/'.$this->abobjectclass.',/', '', $this->dn));
-  }
-
-
-  function save()
-  {
-    /* First use parents methods to do some basic fillup in $this->attrs */
-    plugin::save ();
-
-    $this->attrs['cn']= $this->cn;
-    $this->attrs['displayName']= $this->givenName." ".$this->sn;
-
-    /* Move entry if it got another name... */
-    if ($this->dn != "new" && $this->dn != $this->new_dn){
-      $this->move($this->dn, $this->new_dn);
-    }
-    $this->dn= $this->new_dn;
-
-    /* Save data. Using 'modify' implies that the entry is already present, use 'add' for
-       new entries. So do a check first... */
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cat ($this->dn,array('dn'));
-    if ($ldap->fetch()){
-      $mode= "modify";
-    } else {
-      $mode= "add";
-      $ldap->cd($this->config->current['BASE']);
-      $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
-    }
-
-    /* Finally write data with selected 'mode' */
-    $ldap->cd ($this->dn);
-    $this->cleanup();
-    $ldap->$mode ($this->attrs);
-    if (show_ldap_error($ldap->get_error(), sprintf(_("Removing of addressbook entry '%s' failed."),$this->dn))){
-      return (1);
-    }
-
-    if($mode == "add"){
-      new log("create","addressbook/".get_class($this),$this->dn, array_keys($this->attrs),$ldap->get_error());
-    }else{
-      new log("modify","addressbook/".get_class($this),$this->dn, array_keys($this->attrs),$ldap->get_error());
-    }
-  }
-
-  
-  /* Return entry acls */
-  function get_entry_acls($dn,$attr = "")
-  {
-    $acls = "";
-  
-    /* Use addressbook acls */
-    if(preg_match("/".normalizePreg($this->abobjectclass)."/",$dn))  {
-      $dn = preg_replace("/".normalizePreg($this->abobjectclass).",/","",$dn);
-      $acls = $this->ui->get_permissions($dn,"addressbook/addressbook",$attr);
-    }
-    
-    /* Use Organizational Person acls */
-    else{
-      $acls = $this->ui->get_permissions($dn,"users/user",$attr);
-    }
-
-    return($acls);
-  }
-
-
-  /* Return plugin informations for acl handling  */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName" => _("Addressbook"),
-          "plDescription" => _("Addressbook entry acls"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 0,
-          "plSection"     => array("addons" => _("Addons")),
-          "plCategory"    => array("addressbook" => array("objectClass" => "inetOrgPerson", "description" => _("Addressbook"))),
-
-          "plProvidedAcls"    => array(
-            "sn"                        => _("Surename"),         
-            "givenName"                 => _("Given name"), 
-            "telephoneNumber"           => _("Telefon number"), 
-            "facsimileTelephoneNumber"  => _("Fax number"), 
-            "mobile"                    => _("Mobile number"), 
-            "homePhone"                 => _("Home phone number"), 
-            "uid"                       => _("User identification"), 
-            "mail"                      => _("Mail address"), 
-            "pager"                     => _("Pager"),
-            "o"                         => _("Organization"),
-            "ou"                        => _("Department"),
-            "l"                         => _("Location"),
-            "postalAddress"             => _("Postal address"),
-            "postalCode"                => _("Postal address"),
-            "st"                        => _("State"),
-            "initials"                  => _("Initials"), 
-            "title"                     => _("Title"), 
-            "homePostalAddress"         => _("Home postal address"), 
-            "cn"                        => _("Common name"))
-            ));
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/addons/addressbook/contents.tpl b/plugins/addons/addressbook/contents.tpl
deleted file mode 100644 (file)
index 004e3d2..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-<table summary="" style="table-layout:fixed; width:100%; vertical-align:top; text-align:left; table-layout:auto;" cellpadding="4" border="0">
-<tr>
-  <td style="vertical-align:top;">
-   <table summary="" style="border:1px solid #B0B0B0; width:100%; vertical-align:top; text-align:left;"  cellpadding="4" cellspacing="0">
-    <colgroup>
-        <col width="32%">
-        <col width="14%">
-        <col width="14%">
-        <col width="14%">
-        <col width="14%">
-        <col width="8%">
-    </colgroup>
-    <tr style="background-color: #E8E8E8; height:26px;font-weight:bold;">
-     <td class="tbhead">{t}Name{/t}</td><td class="tbhead">{t}Phone{/t}</td><td class="tbhead">{t}Fax{/t}</td>
-     <td class="tbhead">{t}Mobile{/t}</td><td class="tbhead">{t}Private{/t}</td><td class="tbrhead">{t}Contact{/t}</td>
-    </tr>
-    {$search_result}
-   </table>
-
-   <table summary="" style="vertical-align:top; text-align:center; width:100%;" cellpadding="4" cellspacing="0" border="0">
-    <tr>
-     <td>{$range_selector}</td>
-    </tr>
-   </table>
-
-   {if $show_info eq 1}
-    {include file=$address_info}
-   {/if}
-
-  </td>
-  <td style="vertical-align:top; width:270px;">
-   <div class="contentboxh" style="border-bottom:1px solid #B0B0B0;">
-    <p class="contentboxh"><img src="{$infoimage}" align="right" alt="[i]">{t}Information{/t}</p>
-   </div>
-   <div class="contentboxb">
-    <p class="contentboxb">
-     {t}The telephone list plugin provides list and search facilities for the people in your site. You may want to specify the asterisk [*] like in 'Go*us' to find 'Gonicus'. Use the filters below to narrow down your search.{/t}
-    </p>
-   </div>
-   <br>
-   <div class="contentboxh">
-    <p class="contentboxh" style="vertical-align:middle;"><img src="{$actionimage}" style="vertical-align:middle;" align="right" alt="[a]">{t}Actions{/t}</p>
-   </div>
-   <div class="contentboxb">
-    <p class="contentboxb" style="vertical-align:middle;">
-{if $internal_createable}
-     <img class="center" alt="" src="{$add_image}">&nbsp;
-     <a href="main.php{$plug}&amp;global=add" style="text-align:center;vertical-align:middle;">{t}Add entry{/t}</a><br>
-{/if}
-
-{if $internal eq 0}
- {if $internal_editable}
-     <img alt="" src="{$edit_image}" class="center">&nbsp;
-     <a href="main.php{$plug}&amp;global=edit">{t}Edit entry{/t}</a><br>
- {/if}
- {if $internal_removeable}
-            <img alt="" src="{$delete_image}" class="center">&nbsp;
-            <a href="main.php{$plug}&amp;global=remove" style="vertical-align:middle;">{t}Remove entry{/t}</a><br>
- {/if}
-{/if}
-    </p>
-   </div>
-   <br>
-   <div class="contentboxh">
-    <p class="contentboxh"><img src="{$launchimage}" align="right" alt="[F]">{t}Filters{/t}</p>
-   </div>
-   <div class="contentboxb">
-    <table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
-     {$alphabet}
-    </table>
-    
-<table summary=""  style="width:100%;border-top:1px solid #B0B0B0;">
-       <tr>
-               <td>
-<input type="checkbox" name="organizational" value="1" {$organizational} onClick="mainform.submit()" title="{t}Select to see regular users{/t}">{t}Show organizational entries{/t}<br>
-    <input type="checkbox" name="global" value="1" {$global} onClick="mainform.submit()" title="{t}Select to see users in addressbook{/t}">{t}Show addressbook entries{/t}<br>
-               </td>
-       </tr>
-</table>
-
-<table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
-       <tr>
-               <td>
-                       <label for="search_base"><img class="center" alt="" src="{$tree_image}" align=middle title='{t}Display results for department{/t}'></label>
-               </td>
-       <td>
-                       <select name="search_base" style='width:220px' onChange="mainform.submit()" title="{t}Choose the department the search will be based on{/t}">
-                       {html_options options=$deplist selected=$depselect}
-                               <option disabled>&nbsp;</option>
-               </select>
-               </td>
-       </tr>
-</table>
-<table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
-       <tr>
-               <td>
-                       <label for="object_type"><img class="center" alt="" src="{$obj_image}" align=middle title='{t}Match object{/t}'></label>
-               </td>
-           <td>
-                       <select id="object_type" style='width:220px' name="object_type" onChange="mainform.submit()" title="{t}Choose the object that will be searched in{/t}">
-                       {html_options options=$objlist selected=$object_type}
-                               <option disabled>&nbsp;</option>
-               </select>
-           </td>
-       </tr>
-</table>
-<table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
-       <tr>
-               <td><label for="search_for"><img class="center" alt="" src="{$search_image}" style="text-align:center;" title='{t}Search for{/t}'></label>
-               </td>
-           <td>
-                       <input id="search_for" style='width:99%' type='text' name='search_for' maxlength='20' value='{$search_for}' title='{t}Search string{/t}' onChange="mainform.submit()">
-               </td>
-       </tr>
-</table>
-   {$apply}
-   </div>
-  </td>
-</tr>
-</table>
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('search_for');
-  -->
-</script>
diff --git a/plugins/addons/addressbook/dial.tpl b/plugins/addons/addressbook/dial.tpl
deleted file mode 100644 (file)
index b10b8db..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left; border:1px solid #B0B0B0;" cellpadding=4 cellspacing=0 border=0>
-<tr style="background-color: #E8E8E8; height:26px;font-weight:bold;">
-<td align=left width="100%"><LABEL for="dial">{t}Dial connection...{/t}</LABEL></td>
-</tr>
-<tr style="background-color: white">
-<td style="text-align:center;">
- <div style="height:50px;">&nbsp;</div>
- <a style="font-size:22px"><img alt="" src="{$phone_image}" align=middle>{$dial_info}</a>
- <div style="height:60px;">&nbsp;</div>
- <input type='submit' name='dial' id="dial" value='{t}Dial{/t}'>&nbsp;<input type='submit' name='cancel' value='{t}Cancel{/t}'>
-
-</td>
-
-</tr>
-</table>
diff --git a/plugins/addons/addressbook/main.inc b/plugins/addons/addressbook/main.inc
deleted file mode 100644 (file)
index dbfd760..0000000
+++ /dev/null
@@ -1,41 +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
-*/
-
-if (!$remove_lock){
-       /* Create phonelist object on demand */
-       if (!isset($_SESSION['addressbook']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
-               $_SESSION['addressbook']= new addressbook ($config);
-               $_SESSION['addressbook']->set_acl_base($ui->dn);
-               $_SESSION['addressbook']->set_acl_category("addressbook");
-               unset($_SESSION['show_info']);
-       }
-       $addressbook= $_SESSION['addressbook'];
-
-       /* Execute formular */
-       $display= $addressbook->execute ();
-       $display.= "<input type=\"hidden\" name=\"ignore\">\n";
-
-       /* Page header*/
-       $display= print_header(get_template_path('images/addressbook.png'), _("Address book")).$display;
-
-       /* Store changes  in session */
-       $_SESSION['addressbook']= $addressbook;
-}
-?>
diff --git a/plugins/addons/addressbook/remove.tpl b/plugins/addons/addressbook/remove.tpl
deleted file mode 100644 (file)
index ba37685..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<div style="font-size:18px;">
- <img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
-</div>
-<p>
-  {$info}
-  {t}This includes all addressbook data in this entry. 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}So - if you're sure - press 'Delete' to continue or 'Cancel' to abort.{/t}
-</p>
-
-<p class="plugbottom">
-  <input type=submit name="delete_entry_confirm" value="{t}Delete{/t}">
-  &nbsp;
-  <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
-</p>
-
diff --git a/plugins/addons/bugsubmitter/class_bugsubmitter.inc b/plugins/addons/bugsubmitter/class_bugsubmitter.inc
deleted file mode 100644 (file)
index c9dbebd..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<?php
-
-class bugsubmitter extends plugin
-{
-       var $plHeadline= "<a href='https://oss.gonicus.de/labs/gosa/newticket' target='_blank'>Bugsubmitter</a>";
-}
-
-?>
diff --git a/plugins/addons/bugsubmitter/main.inc b/plugins/addons/bugsubmitter/main.inc
deleted file mode 100644 (file)
index 82efded..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<?php
-header('location:?');
-exit();
-$display = "";
-?>
diff --git a/plugins/addons/godfs/class_dfsManagment.inc b/plugins/addons/godfs/class_dfsManagment.inc
deleted file mode 100644 (file)
index 913b270..0000000
+++ /dev/null
@@ -1,263 +0,0 @@
-<?php
-
-/* Create a class (name must be unique inside GOsa) which extends plugin. The plugin base
-    class contains all methods that are used by GOsa and it provides the mechanism to load data
-    from LDAP to local variables and prepare the save to ldap routine for you. */
-class dfsManagment extends plugin {
-  /* Definitions */
-  var $plHeadline = "DFS Managment";
-  var $plDescription = "This does something";
-   
-  /* These contain attributes to be loaded. We're not doing an LDAP plugin currently, so we don't
-     care... */
-  var $attributes = array();
-  var $objectclasses = array();
-  var $dfstab = NULL;
-
-  /* The constructor just saves a copy of the config. You may add what ever you need. */
-  function dfsManagment (&$config, &$ui) {
-    /* save config for later use */
-    $this->config = &$config;
-    $this->ui = &$ui;
-    
-  }
-
-  /* Execute is the function all plugins need. It fills the plugin with life and produces the output. */
-  function execute() {
-       
-    /* Normally you would react to user input here. */
-    plugin::execute();    
-
-    $action = "";
-    $s_action= "";
-    $options = "";
-    $regex = "";
-       
-    $icon         = 'folder.gif';
-    $expandedIcon = 'folder-expanded.gif';
-    $base = get_base_from_people($this->ui->dn);
-    $smarty= get_smarty();
-
-    foreach ($_POST as $key => $val) {
-      # delete
-      if (preg_match("/dfs_del.*/", $key)) {
-        $s_action = "del";
-        $s_entry = preg_replace("/dfs_".$s_action."_/i", "", $key);
-        $s_entry = preg_replace("/_.*$/", "", $s_entry);
-        $s_entry = base64_decode($s_entry);
-      # edit  
-      } elseif (preg_match("/dfs_edit.*/", $key)) {
-        $s_action = "edit";
-        $s_entry = preg_replace("/dfs_".$s_action."_/i", "", $key);
-        $s_entry = preg_replace("/_.*$/", "", $s_entry);
-        $s_entry = base64_decode($s_entry);
-      # new
-      } elseif (preg_match("/dfs_new.*/", $key)) {
-        $s_action = "new";
-      # back
-      } elseif (preg_match("/dfs_back.*/", $key)) {
-        $s_action = "back";
-      # home
-      } elseif (preg_match("/dfs_home.*/", $key)) {
-        $s_action = "home";
-      # root
-      } elseif (preg_match("/dfs_root.*/", $key)) {
-        $s_action = "root";
-      }
-    }  
-
-    $tree  = new HTML_TreeMenu();
-
-    if ((isset($_GET['act'])) && ($_GET['act'] == "edit_entry")) {
-      $s_action = "edit";
-      $dfs_share = $_GET['id'];
-    }
-
-    # new
-    if ($s_action == "new") {
-      $this->dn = "new";
-      $this->dfstab = new dfstabs($this->config, $this->config->data['TABS']['DFSTABS'], $this->dn);
-    }
-
-    # edit
-    if (($_SERVER['REQUEST_METHOD'] == "POST") || ($_SERVER['REQUEST_METHOD'] == "GET")) {
-      if ($s_action == "edit") {
-
-        $this->dn = $dfs_share;
-
-        if (($user = get_lock($this->dn)) != "") {  
-          return (gen_locked_message ($user, $this->dn));
-        } else {
-          add_lock ($this->dn, $this->ui->dn);
-        }
-
-        $this->acl = get_permissions($this->dn, $this->ui->subtreeACL);
-
-        $this->dfstab = new dfstabs($this->config, $this->config->data['TABS']['DFSTABS'], $this->dn);
-        $this->dfstab->set_acl($this->acl);
-        $this->dfstab->save_object();
-        $_SESSION['objectinfo']= $this->dn;
-      }
-    } 
-      
-    # save pressed
-    if (isset($_POST['edit_finish'])) {
-      $this->dfstab->last = $this->dfstab->current;
-      $this->dfstab->save_object(); 
-      #$disp = $this->by_object[''];
-      #var_dump($disp);
-    
-      $message = $this->dfstab->check();
-     
-      # any errors?
-      if (count($message) == 0) {
-        # write to ldap
-        $this->dfstab->save();
-      } else {
-        show_errors($message);
-      }
-    }
-
-    # cancel pressed
-    if (isset($_POST['edit_cancel'])) {
-      del_lock ($_SESSION['objectinfo']);
-      unset ($this->dfstab);
-      $this->dfstab = NULL;
-      $this->dn = "";
-      unset($_SESSION['objectinfo']);
-    }
-
-    # delete pressed
-    if (isset($_POST['edit_delete'])) {
-      
-      # get the current values
-      $this->sambasharename = $_POST['sambaShareName'];
-      $this->sharedescription = $_POST['description'];
-      $this->fileserver = $_POST['fileserver'];
-      $this->share = $_POST['fileservershare'];
-      $this->loc = $_POST['location'];
-          
-      $base = get_base_from_people($this->ui->dn);
-      $ou = get_ou("DFS");
-      $this->basedn = "sambaShareName=$this->sambasharename,ou=$this->loc,$ou$base";
-
-      $ldap = $this->config->get_ldap_link();
-      $ldap->cd($this->basedn);
-      $ldap->rmdir($this->basedn);
-                       show_ldap_error($ldap->get_error(), sprintf(_("Removing of DFS share with dn '%s' failed."),$this->dn));
-      
-      del_lock ($_SESSION['objectinfo']);
-      unset ($this->dfstab);
-      $this->dfstab = NULL;
-      $this->dn = "";
-      unset($_SESSION['objectinfo']);
-    }
-
-    # generate main page no tabs
-
-    $ldap = $this->config->get_ldap_link();
-
-    $ou = get_ou("DFS");
-    
-    $ldap->cd("$ou$base");
-    $ldap->search(("ou=*"), array("dn"));
-    
-    if ($ldap->count() == 0) {
-      $message[] = _("No DFS entries found");
-      show_errors ($message);
-    } else {
-      $have_tree= false;
-      while ($dfs = $ldap->fetch()) {
-        if (preg_match("/^ou=DFS.*/", $dfs["dn"])) {
-          $dfs_root_node = new HTML_TreeNode(array('text' => "DFS", 'icon' => $icon, 'expandedIcon' => $expandedIcon, 'expanded' => false));
-         $have_tree= true;
-        } elseif ($have_tree) {
-          preg_match("/^ou=(.*),/U", $dfs["dn"], $reg);
-          $loc = $reg[1];
-          $node = $dfs_root_node->addItem(new HTML_TreeNode(array('text' => "$loc", 'icon' => $icon, 'expandedIcon' => $expandedIcon)));
-          
-          $sub_node_ldap = $this->config->get_ldap_link();
-          $sub_node_ldap->cd("ou=$loc, $ou$base");
-          $sub_node_ldap->search("(objectclass=sambaShare)", array("sambaShareName", "description", "documentLocation"));
-          
-          while ($dfs_loc = $sub_node_ldap->fetch()) {
-            $share_name = $dfs_loc["sambaShareName"][0];
-            $desc = $dfs_loc["description"][0];
-            $srv_loc = preg_replace("/msdfs:/", "", $dfs_loc["documentLocation"][0]);
-            #$srv_loc = preg_replace("/\\/", "\\\\", $srv_loc);
-            $link = "main.php\?plug=".$_GET['plug']."\&id=$loc\/$share_name\&act=edit_entry"; 
-            $share_node = &$node->addItem(new HTML_TreeNode(array('text' => "$share_name - $desc", 'link' => "$link", 'icon' => $icon, 'expandedIcon' => $expandedIcon)));
-            $srv_loc_node = &$share_node->addItem(new HTML_TreeNode(array('text' => "$srv_loc", 'icon' => $icon, 'expandedIcon' => $expandedIcon)));
-          }
-        }
-      }
-    }
-
-    $tree->addItem($dfs_root_node);
-
-    // Create the presentation class
-    $treeMenu = new HTML_TreeMenu_DHTML($tree, array('images' => 'images', 'defaultClass' => 'treeMenuDefault'));
-    $tree_html = $treeMenu->toHTML();
-    
-    if ($this->dfstab === NULL) {
-
-      if (($message = check_sizelimit()) != "") {
-        return ($message);
-      }
-  
-      $listhead = "<div style='background:#F0F0F9;padding:5px;'>".
-         " <input type='image' class='center' src='images/list_up.png' align='middle' title='"._("Go up one dfsshare")."' name='dfs_back' alt='"._("Up")."'>&nbsp;".
-         " <input type='image' class='center' src='images/list_root.png' align='middle' title='"._("Go to dfs root")."' name='dfs_root' alt='"._("Root")."'>&nbsp;".
-         " <input class='center' type='image' src='images/dtree.png' align='middle' alt='"._("Create new dfsshare")."' name='dfs_new'>&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>";
-
-
-      /* Use the smarty templating engine here... */
-
-      $smarty->assign('tree', $tree_html);
-      $smarty->assign('search_image', get_template_path('images/search.png'));
-      $smarty->assign('infoimage', get_template_path('images/info.png'));
-      $smarty->assign('launchimage', get_template_path('images/launch.png'));
-      $smarty->assign('alphabet', generate_alphabet());
-      $smarty->assign('hint', print_sizelimit_warning());
-      $smarty->assign('apply', apply_filter());
-      $smarty->assign('dfshead', $listhead);
-
-      /* Let smarty fetch and process the page. Always seperate PHP and HTML as much as
-         you can. */
-      return ($smarty->fetch (get_template_path('contents.tpl', TRUE)));
-    }
-
-    /* TABS */
-
-    $display = $this->dfstab->execute();
-   
-    $display .= "<p>\n";
-    $display .= "  <table width=100\%>\n";
-    $display .= "    <tbody>\n";
-    $display .= "      <tr>\n";
-    $display .= "        <td style=\"text-align: right\">\n";
-    $display .= "          <input type=submit name=\"edit_finish\" value=\""._("Finish")."\">\n";
-    $display .= "          &nbsp;\n";
-    $display .= "          <input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
-    $display .= "        </td>\n";
-    $display .= "      </tr>\n";
-    $display .= "    </tbody>\n";
-    $display .= "  </table>\n";
-    $display .= "</p>\n";
-    
-    return ($display);
-
-  }
-
-  function remove_lock() {
-    if (isset($this->dn)) {
-      del_lock ($this->dn);
-    }
-  }
-
-}
-?>
diff --git a/plugins/addons/godfs/class_dfsgeneric.inc b/plugins/addons/godfs/class_dfsgeneric.inc
deleted file mode 100644 (file)
index 12a2ed2..0000000
+++ /dev/null
@@ -1,223 +0,0 @@
-<?php
-
-  class dfsgeneric extends plugin {
-    /* CLI vars */
-    var $cli_summary      = "Manage terminal base objects";
-    var $cli_description  = "Some longer text\nfor help";
-    var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-    /* Needed values and lists */
-    var $base             = "";
-    var $cn               = "";
-
-    /* attribute list for save action */
-    var $attributes     = array();
-    var $objectclasses  = array();
-
-    function dfsgeneric(&$config, $dn) {
-      plugin::plugin($config, $dn);
-      $this->dn = $dn;
-      $this->orig_dn = $dn;
-    }
-    function execute() {
-      /* Call parent execute */
-      plugin::execute();
-      
-      $smarty= get_smarty();
-
-      if (($this->dn == "new") || ($this->dn == "")) {
-        $smarty->assign("sambasharename", "");
-        $smarty->assign("sharedescription", "");
-        $smarty->assign("fileserver", "");
-        $smarty->assign("fileservershare", "");
-        $smarty->assign("location", "");
-        $smarty->assign("dfsdescription", "");
-      } else {
-        $ldap = $this->config->get_ldap_link();
-
-        $base = get_base_from_people($this->dn);
-        $ou = get_ou("DFS");
-
-        $tmp = preg_split('/\//', $this->dn, 2);
-        $this->loc = $tmp[0];
-        $this->sambasharename = $tmp[1];
-
-        $ldap->cd("$ou $base");
-        $ldap->search(("ou=$this->loc"), array("description"));
-        $dfs_desc = $ldap->fetch();
-        $this->dfsdescription = $dfs_desc['description'][0];
-
-        $ldap->cd("ou=$this->loc, $ou $base");
-        $ldap->search("(&(sambaShareName=$this->sambasharename)(objectclass=sambaShare))", array("description", "documentLocation"));
-
-        $details = $ldap->fetch();
-        $this->sharedescription = $details['description'][0];
-        $tmp = preg_split('/\\\\/', $details['documentLocation'][0], 2);
-
-        $this->fileserver = preg_replace("/msdfs:/", "", $tmp[0]);
-        $this->share = preg_replace("/\\\/", "", $tmp[1]);
-      
-        #var_dump($this->dn);
-        #echo "<BR>\n";
-
-        /* Fill array */
-        #$this->reload();
-        $smarty->assign("sambasharename", $this->sambasharename);
-        $smarty->assign("sharedescription", $this->sharedescription);
-        $smarty->assign("fileserver", $this->fileserver);
-        $smarty->assign("fileservershare", $this->share);
-        $smarty->assign("location", $this->loc);
-        $smarty->assign("dfsdescription", $this->dfsdescription);
-      }
-
-      /* Show main page */
-      return ($smarty->fetch (get_template_path('generic.tpl', TRUE)));
-      #, dirname(__FILE__))));
-    }
-
-    function check() 
-       {
-      plugin::check(); 
-      $message = array();
-
-      ## permission
-      #if (chkacl($this->acl, "create") != "") {
-      #  $message[] = _("You have no premissions to create a dfs share.");
-      #}
-
-      # existance
-      
-      $ldap = $this->config->get_ldap_link();
-      $base = get_base_from_people($this->ui->dn);
-      $ou = get_ou("DFS");
-      $dn_explode = explode("/", $this->dn);
-      $sub_ou = $dn_explode[0];
-      $sambaShareName = $dn_explode[1] . "/" . $dn_explode[2] . "/" . $dn_explode[3];
-      $dn = "sambaShareName=$sambaShareName,ou=$sub_ou,$ou$base";
-      $ldap->cat($dn);
-      $attrs = $ldap->fetch();
-      
-      if ($this->orig_dn == "new" && !($attrs == FALSE)) {
-        $message[] = _("Dfs share already exists.");
-      } elseif ($this->orig_dn != $this->dn && !($attrs == FALSE)) {
-        $message[] = _("Dfs share already exists.");
-      }
-      
-      if ($this->dn == "new" || $this->dn == "") {
-        $this->sambasharename = $_POST['sambaShareName'];
-        $this->sharedescription = $_POST['description'];
-        $this->fileserver = $_POST['fileserver'];
-        $this->share = $_POST['fileservershare'];
-        $this->loc = $_POST['location'];
-      }
-      
-      # required fields set?
-      if ($this->sambasharename == "") {
-        $message[] = _("Required Field \"Name of dfs Share\" is not set.");
-      }
-      if ($this->sharedescription == "") {
-        $message[] = _("Required Field \"Description\" is not set.");
-      }
-      if ($this->fileserver == "") {
-        $message[] = _("Required Field \"Fileserver\" is not set.");
-      }
-      if ($this->share == "") {
-        $message[] = _("Required Field \"Share on fileserver\" is not set.");
-      }
-      if ($this->loc == "") {
-        $message[] = _("Required Field \"Location\" is not set.");
-      }
-
-      return $message;
-    }
-    
-    function save() {
-      
-      plugin::save();
-
-      # get the current values
-      $this->sambasharename = $_POST['sambaShareName'];
-      $this->sharedescription = $_POST['description'];
-      $this->fileserver = $_POST['fileserver'];
-      $this->share = $_POST['fileservershare'];
-      $this->loc = $_POST['location'];
-          
-      # set the attribs
-      $this->attrs["sambaShareName"]   = "$this->sambasharename,ou=$this->loc,$ou$base";
-      $this->attrs["objectClass"][]    = "top";
-      $this->attrs["objectClass"][]    = "SambaShare";
-      $this->attrs["objectClass"][]    = "extensibleObject"; 
-      $this->attrs["sambaShareName"]   = $this->sambasharename;
-      $this->attrs["description"]      = $this->sharedescription;
-      $this->attrs["documentLocation"] = "msdfs:$this->fileserver\\\\$this->share";
-
-      $ldap = $this->config->get_ldap_link();
-
-      if ($this->dn == "new" || $this->dn == "") {
-        echo "new<br>\n";
-        $base = get_base_from_people($this->ui->dn);
-        $ou = get_ou("DFS");
-        $this->basedn = "sambaShareName=$this->sambasharename,ou=$this->loc,$ou$base";
-        $ldap->cd($this->basedn);
-        $ldap->add($this->attrs);
-      } else {
-        # try to find entry
-        $base = get_base_from_people($this->ui->dn);
-        $ou = get_ou("DFS");
-        #$dn_explode = explode("/", $this->sambasharename);
-        #$sub_ou = $dn_explode[0];
-        #$sambaShareName = $dn_explode[1] . "/" . $dn_explode[2] . "/" . $dn_explode[3];
-        $dn = "sambaShareName=$this->sambasharename,ou=$this->loc,$ou$base";
-        $ldap->cat($dn);
-        $attrs = $ldap->fetch();
-          
-        $this->basedn = "sambaShareName=$this->sambasharename,ou=$this->loc,$ou$base";
-        $ldap->cd($this->basedn);
-        $nr = count($attrs);
-        
-        if (count($attrs)) {
-          # modify if found
-          $ldap->modify($this->attrs);
-        } else {
-          # add
-          $ldap->add($this->attrs);
-        }
-                               show_ldap_error($ldap->get_error(), sprintf(_("Saving dfs/generic with dn '%s' failed."),$this->basedn));
-      }
-    }
-
-    function save_object() {
-      #if (isset($_POST['base'])) {
-        plugin::save_object();
-        #echo "base = ".$_POST['base']."<br>\n";
-      #}
-#      if (chkacl($this->acl, "create") == "") {
-        $this->base = $_POST['base'];
-#      }
-    }
-
-    function delete() {
-    
-      plugin::delete();
-
-      # get the current values
-      $this->sambasharename = $_POST['sambaShareName'];
-      $this->sharedescription = $_POST['description'];
-      $this->fileserver = $_POST['fileserver'];
-      $this->share = $_POST['fileservershare'];
-      $this->loc = $_POST['location'];
-          
-      $base = get_base_from_people($this->ui->dn);
-      $ou = get_ou("DFS");
-      $this->basedn = "sambaShareName=$this->sambasharename,ou=$this->loc,$ou$base";
-      echo "BASEDN: $this->basedn<br>\n";
-
-      $ldap = $this->config->get_ldap_link();
-      $ldap->cd($this->basedn);
-      $ldap->rmdir($this->basedn);
-                       show_ldap_error($ldap->get_error(), sprintf(_("Removing dfs/generic with dn '%s' failed."),$this->basedn));
-    }
-      
-  }
-
diff --git a/plugins/addons/godfs/contents.tpl b/plugins/addons/godfs/contents.tpl
deleted file mode 100644 (file)
index e5f2206..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-<script src="TreeMenu.js" language="JavaScript" type="text/javascript"></script>
-
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
-<tr>
-  <td style="vertical-align:top;width:600px">
-  <div class="contentboxh">
-    <p class="contentboxh">
-     {t}DFS Shares{/t} {$hint}
-    </p>
-  </div>
-  <div class="contentboxb">
-      {$dfshead}
-  </div>
-  <div style='height:4px;'></div>
-  <div class="contentboxb" style="border-top:1px solid #B0B0B0;">
-      {$tree}
-    <input type=hidden name="edit_helper">
-  </div>
-  </td>
-  <td style="vertical-align:top;">
-   <div class="contentboxh">
-    <p class="contentboxh"><img src="{$infoimage}" align="right" alt="[i]">{t}Information{/t}</p>
-   </div>
-   <div class="contentboxb">
-   <p class="contentboxb">
-     {t}This menu allows you to create, delete and edit selected dfs shares. Having a large numbers of dfs shares, you might prefer the range selectors on top of the dfs share list.{/t}
-   </p>
-   </div>
-   <br>
-   <div class="contentboxh">
-    <p class="contentboxh"><img src="{$launchimage}" align="right" alt="[F]">{t}Filters{/t}</p>
-   </div>
-   <div class="contentboxb">
-     <table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
-      {$alphabet}
-     </table>
-     <table summary=""  style="width:100%;border-top:1px solid #B0B0B0;">
-     <tr>
-     <td>
-     <LABEL for "regex"><img alt="{t}Display dfs shares matching{/t}" src="{$search_image}" align=middle title='{t}Display dfs shares matching{/t}'></LABEL>
-     </td>
-     <td width="99%">
-     <input type='text' name='regex' maxlength='20' style='width:99%' value='{*$regex*}' id='filter'
-     title='{t}Regular expression for matching dfs share names{/t}' onChange="mainform.submit()">
-     </td>
-     </tr>
-     </table>
-                            {$apply}
-   </div>
-  </td>
-</tr>
-</table summary="">
-
-<input type="hidden" name="ignore">
diff --git a/plugins/addons/godfs/generic.tpl b/plugins/addons/godfs/generic.tpl
deleted file mode 100644 (file)
index 4f3ded4..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
- <tr>
-   <td style="vertical-align:top; width:50%">
-     <h2><img alt="" align="top" src="images/rightarrow.png"> {t}DFS Properties{/t}</h2>
-     
-     <table summary="">
-      <tr>
-       <td><LABEL for="sambaShareName">{t}Name of dfs Share{/t}</LABEL>{$must}</td>
-       <td><input id="sambaShareName" name="sambaShareName" size=40 maxlength=100 value="{$sambasharename}"></td>
-      </tr>
-      <tr>
-       <td><LABEL for="descripition">{t}Description{/t}</LABEL>{$must}</td>
-       <td><input id="description" name="description" size=40 maxlength=100 value="{$sharedescription}"></td>
-      </tr>
-      <tr>
-       <td><LABEL for="fileserver">{t}Fileserver{/t}</LABEL>{$must}</td>
-       <td><input id="fileserver" name="fileserver" size=40 maxlength=100 value="{$fileserver}"></td>
-      </tr>
-      <tr>
-       <td><LABEL for="fileservershare">{t}Share on Fileserver{/t}</LABEL>{$must}</td>
-       <td><input id="fileservershare" name="fileservershare" size=40 maxlength=100 value="{$fileservershare}"></td>
-      </tr>
-     </table>
-
-   </td>
-   <td style="border-left:1px solid #A0A0A0">
-    &nbsp;
-   </td>
-   <td style="vertical-align:top; width:50%">
-     <h2><img alt="" align="top" src="images/house.png"> {t}DFS Location{/t}</h2>
-
-     <table summary="" style="width:100%">
-      <tr>
-       <td><LABEL for="location">{t}Location{/t}</LABEL>{$must}</td>
-       <td><input id="location" name="location" size=40 maxlength=100 value="{$location}"></td>
-      </tr>
-      <tr>
-       <td><LABEL for="dfsdescription">{t}Description{/t}</LABEL></td>
-       <td><input id="dfsdescription" name="dfsdescription" size=40 maxlength=100 value="{$dfsdescription}"></td>
-      </tr>
-     </table>
-
-   </td>
- </tr>
-</table>
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('ou');
-  -->
-</script>
diff --git a/plugins/addons/godfs/main.inc b/plugins/addons/godfs/main.inc
deleted file mode 100644 (file)
index 56fc3c0..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-   if ($remove_lock) {
-     if (isset($_SESSION['dfsManagment'])) {
-       $dfsManagment = $_SESSION['dfsManagment'];
-       $dfsManagment->remove_lock();
-       del_lock($ui->dn);
-       sess_del('dfsManagment');
-     }
-   } else {
-     # create dfsManagment object
-     if (!isset($_SESSION['dfsManagment']) || 
-        (isset($_GET['reset']) && $_GET['reset'] == 1)) {
-       $_SESSION['dfsManagment'] = new dfsManagment($config, $_SESSION['ui']);
-     }
-     $dfsManagment = $_SESSION['dfsManagment'];
-     $output = $dfsManagment->execute();
-
-     # do we have to reset
-     if (isset($_GET['reset']) && $_GET['reset'] == 1) {
-       del_lock ($ui->dn);
-       sess_del('dfsManagment');
-     }
-     # create page header
-     if (isset($_SESSION['objectinfo'])) {
-       $display = print_header(get_template_path('images/dfs.png'), 
-                                _("Distributed File System Administration"),
-                                "<img alt=\"\" class=\"center\" src=\"".
-                                get_template_path('images/closedlock.png').
-                                "\"> ".$_SESSION['objectinfo']);
-     } else {
-       $display = print_header(get_template_path('images/dfs.png'),
-                                _("Distributed File System Administration"));
-     }
-
-     $display.= $output;
-    
-     # show page
-     $_SESSION['dfsManagment'] = $dfsManagment;
-  }
-
-?>
diff --git a/plugins/addons/godfs/tabs_dfs.inc b/plugins/addons/godfs/tabs_dfs.inc
deleted file mode 100644 (file)
index ef5950e..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-
-class dfstabs extends tabs { 
-  var $base;
-
-  function dfstabs($config, $data, $dn) {
-    tabs::tabs($config, $data, $dn);
-    #$this->base = $this->by_object['dfsManagment']->base;
-  }
-
-  #function save_object() {
-  #  if (isset($_POST['base'])) {
-  #    plugin::save_object();
-  #  } else {
-  #    $this->base = $_POST['base'];
-  #  }
-  #}
-
-
-
-
-  function check($ignore_account= FALSE) {
-    return (tabs::check(TRUE));
-  }
-
-  function save($ignore_account= FALSE)
-  {
-    $baseobject = $this->by_object['dfsManagment'];
-    return tabs::save(TRUE);
-  }
-
-  function del() {
-    $baseobject = $this->by_object['dfsManagment'];
-    return tabs::delete(TRUE); 
-  }
-
-}
-
-?>
diff --git a/plugins/addons/gotomasses/class_divListMasses.inc b/plugins/addons/gotomasses/class_divListMasses.inc
deleted file mode 100644 (file)
index f32f76b..0000000
+++ /dev/null
@@ -1,170 +0,0 @@
-<?php
-
-class divListMasses extends MultiSelectWindow
-{
-
-  /* Current base */
-  var $selectedBase       = "";
-  var $departments        = array();
-
-  var $parent             ;
-  var $ui                 ;
-
-  var $wake = TRUE;  
-  
-  function divListMasses (&$config,$parent)
-  {
-    MultiSelectWindow::MultiSelectWindow($config, "gotoMasses", array("gotomasses"));
-
-    $this->parent       = $parent;
-    $this->ui           = get_userinfo();
-    $this->SetSummary(_("List of system deployment tasks"));
-    $this->SetHeadpageMode();
-    $this->EnableCloseButton(FALSE);
-    $this->EnableSaveButton(FALSE);
-    $this->SetInformation(_("This menu allows you to add, remove and change the properties of system deployment tasks."));
-
-    foreach($this->parent->get_actions() as $name => $desc){
-      $this->$name = TRUE;
-      $this->AddCheckBox($name,sprintf(_("Display entries with action %s."),$desc),
-                               sprintf(_("Display entries with action %s."),$desc),TRUE);
-    }
-    $plug  = $_GET['plug'];
-
-    /* Toggle all selected / deselected */
-    $chk = "<input type='checkbox' id='select_all' name='select_all'
-               onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
-
-    /* set Page header */
-    $this->AddHeader(array("string"=> $chk,          "attach"=>"style='width:20px;'"));
-    $this->AddHeader(array("string"=>"<a href='?plug=".$plug."&amp;sort=QueuePosition'>"._("#")."</a>",
-                           "attach"=>"style='width:20px;'"));
-    $this->AddHeader(array("string"=>"<a href='?plug=".$plug."&amp;sort=TargetName'>"._("Target")."</a>&nbsp;/&nbsp;".
-                                     "<a href='?plug=".$plug."&amp;sort=TaskID'>"._("Task")."</a>"));
-    $this->AddHeader(array("string"=>"<a href='?plug=".$plug."&amp;sort=Schedule'>"._("Schedule")."</a>",
-                                      "attach"=>"style='width:100px;'"));
-    $this->AddHeader(array("string"=>"<a href='?plug=".$plug."&amp;sort=Action'>"._("Type")."</a>",
-                                      "attach"=>"style='width:80px;'"));
-    $this->AddHeader(array("string"=>_("Action"),
-                                      "attach"=>"style='border-right:0px;width:120px;'"));
-  }
-
-  function GenHeader()
-  {
-    
-    /* Display add button if allowed */
-    $header = "<div style='padding:5px'>";
-    if($this->parent->acl_is_createable()){
-      $header .= "<input type='image' src='images/gotomasses_new_task.png' name='new_task' class='center'>&nbsp;";
-    }
-
-    /* Display add button if allowed */
-    if($this->parent->acl_is_removeable()){
-      $header .= "<input type='image' src='images/edittrash.png' name='remove_multiple_task' class='center'>&nbsp;";
-    }
-
-    /* Add priority options */
-    if(preg_match("/w/",$this->parent->getacl(""))){
-      $header .= "<input type='image' src='images/prio_top.png'       name='multiple_prio_top'      class='center'>&nbsp;";
-      $header .= "<input type='image' src='images/prio_increase.png'  name='multiple_prio_increase' class='center'>&nbsp;";
-      $header .= "<input type='image' src='images/prio_decrease.png'  name='multiple_prio_decrease' class='center'>&nbsp;";
-      $header .= "<input type='image' src='images/prio_bottom.png'    name='multiple_prio_bottom'   class='center'>&nbsp;";
-    }
-    $header .= "</div>";
-    
-    /* Create divlist */
-    $this->SetListHeader($header);
-
-  }
-
-  function execute()
-  {
-    $this->ClearElementsList();
-    $this->GenHeader();
-  }
-
-
-  function setEntries($tasks)
-  {
-    /* Create edit link */
-    $plug = $_GET['plug'];
-    $edit_link = "<div style='width:100%;overflow:hidden;'><nobr><a href='?plug=".$_GET['plug']."&act=edit&id=%id%'>%str%</nobr></div>";
-
-    /* Create action filter array, to sort out those actions we do not want to see */
-    $allowed_action = array();
-    foreach($this->parent->get_actions() as $name => $desc){
-      if($this->$name){
-        $allowed_action[] = $name;
-      }
-    }
-
-    $colors[0] = "#DDDDDD";
-    $colors[1] = "#EEEEEE";
-    $c_keys = array();
-    $last_c = 0;
-    if($this->parent->sort_dir=="down"){
-      $last_c = !$last_c; 
-    }
-  
-    foreach($tasks as $key => $task){
-
-      /* Skip unchecked actions */ 
-      if(!in_array($task['Action'],$allowed_action)){
-        continue;
-      }
-
-      /* Handle coloring */
-      $color="";
-      if($this->parent->sort_by == "TaskID"){
-        if(!in_array($task['TASK_ID'],$c_keys)){
-          $c_keys[] = $task['TASK_ID'];
-          $last_c = !$last_c;
-        }
-        $color = "background-color: ".$colors[$last_c];
-      }
-
-      /* Create actions */
-      $id         = $task['ID'];
-      $queue_pos  = $task['Queue_Position'];
-      $prio_actions = "<input class='center' type='image' src='images/prio_top.png'      name='prio_top_".$id."'>&nbsp;";
-      $prio_actions.= "<input class='center' type='image' src='images/prio_increase.png' name='prio_increase_".$id."'>&nbsp;";
-      $prio_actions.= "<input class='center' type='image' src='images/prio_decrease.png' name='prio_decrease_".$id."'>&nbsp;";
-      $prio_actions.= "<input class='center' type='image' src='images/prio_bottom.png'   name='prio_bottom_".$id."'>&nbsp;";
-      $action = "<input type='image' src='images/edit.png' name='edit_task_".$id."' class='center' alt='"._("Edit")."'>";
-      if($this->parent->acl_is_removeable()){
-        $action.= "<input type='image' src='images/edittrash.png' name='remove_task_".$id."' class='center' alt='"._("Reomve")."'>";
-      }
-
-      $display = preg_replace(array("/%id%/","/%str%/"),array($id,$this->parent->target_to_string($task)),$edit_link);
-      $display2= $this->parent->get_additional_entry_informations($task);
-
-      /* Create each field */
-      $field0 = array("string" => "<input type='checkbox' id='item_selected_".$id."' name='item_selected_".$id."'>" ,
-                      "attach" => "style='width:20px;".$color."'");
-      $field0a= array("string" => $queue_pos ,"attach" => "style='width:20px;".$color."'");
-      $field1 = array("string" => $display,
-                      "attach" => "style='".$color."'");
-      $field1a= array("string" => $display2,
-                      "attach" => "style='".$color.";width:80px;'");
-      $field2 = array("string" => $this->parent->time_to_string($task),"attach" => "style='".$color.";width:100px;'");
-      $field3 = array("string" => $this->parent->action_to_string($task),"attach" => "style='".$color.";width:80px;'");
-      $field4 = array("string" => $prio_actions.$action,"attach" => "style='".$color.";text-align:right;width:120px;border-right:0px;'");
-      $this->AddElement(array($field0,$field0a,$field1,$field1a,$field2,$field3,$field4));
-    }
-  }
-
-
-  function Save()
-  {
-    MultiSelectWindow :: Save();  
-  }
-
-
-  function save_object()
-  {
-    /* Save automatic created POSTs like regex, checkboxes */
-    MultiSelectWindow :: save_object();  
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/addons/gotomasses/class_goto_task.inc b/plugins/addons/gotomasses/class_goto_task.inc
deleted file mode 100644 (file)
index d53a4c2..0000000
+++ /dev/null
@@ -1,485 +0,0 @@
-<?php
-
-class goto_task extends plugin
-{
-  /* Definitions */
-  var $plHeadline     = "System mass deployment";
-  var $plDescription  = "This does something";
-  var $parent   = NULL;
-  var $Minute   = "*";
-  var $Hour     = "*";
-  var $Day      = "*";
-  var $Month    = "*";
-  var $Weekday  = "*";
-  var $Action   = "install";
-
-  var $Zone     = "";
-  var $Section  = "";
-
-  var $Zones    = array();
-  var $Sections = array();
-
-  var $Comment  = "";
-  var $OGroup   = "keep_current";
-  var $OGroups  = array();
-  var $Target   = array();
-  var $Initial_Target   = array();
-  var $Actions  = array();
-  var $new      = FALSE;
-  var $ID = 0;
-  var $TASK_ID =0;
-  var $attributes     = array("ID","TASK_ID","Zone","Section","OGroup","Minute","Hour","Day",
-                              "Month","Weekday","Action","Comment","Target","Initial_Target");
-
-  var $configure_dhcp = FALSE;
-  var $configure_dns  = FALSE;
-
-
-  function goto_task(&$config, &$parent, $data = array())
-  {
-    /* Set parent object */
-    $this->parent = &$parent;
-
-    /* Intialize plugin */
-    $this->config = &$config;
-    if(count($data)){
-      $tmp = $this->get_array_values();
-      foreach($this->attributes as $attr){
-        if(!isset($data[$attr])){
-          trigger_error("Missing parameter: '".$attr."' for goto_task contruction.");
-        }else{
-          $this->$attr = $data[$attr];
-        }
-      }
-    }else{
-      $this->new = TRUE;
-    }
-
-    if(!empty($this->Zone) && !preg_match("/^\"\"$/",$this->Zone)){
-      $this->configure_dns = TRUE;
-    }
-    if(!empty($this->Section) && !preg_match("/^\"\"$/",$this->Section)){
-      $this->configure_dhcp = TRUE;
-    }
-
-    /* Set dns and dhcp attributes */
-    foreach(getAvailableZones($this->config) as $zone){
-      $name = preg_replace("#^[^/]+/#","",$zone);
-      $this->Zones[$name] = $zone; 
-    }
-    $this->Sections = $this->get_dhcp_sections();
-
-    /* Create ogroup select list */
-    $this->OGroups = array("\"\""     => "["._("Keep current")."]");
-    $this->OGroups = array_merge($this->OGroups,$this->parent->get_object_groups());
-
-    /* Prepare list of available actions */
-    $this->Actions = $this->parent->get_actions();
-  }
-
-
-  function execute()
-  {
-    /********
-     * Handle Posts  
-     ********/
-  
-    /* Handle Target options */
-    foreach($_POST as $name => $value){
-      if(preg_match("/^remove_/",$name)){
-        $value = preg_replace("/^remove_([0-9]*)_(x|y)$/i","\\1",$name);
-        if(isset($this->Target[$value]) && $this->Action != "initial_install"){
-          unset($this->Target[$value]);
-        }elseif(isset($this->Initial_Target[$value]) && $this->Action == "initial_install"){
-          unset($this->Initial_Target[$value]);
-        }
-      }
-    }
-
-    if($this->Action != "initial_install"){
-      
-      /* Add target */
-      if($this->ID == 0 && isset($_POST['add_target']) && !empty($_POST['target_text'])){
-        $target = get_post("target_text");
-        if($this->is_valid_target($target) && !in_array($target,$this->Target)){
-          $this->Target[] = $target;
-        }else{
-          print_red(_("You must specify a valid MAC address or host name."));
-        }
-      }
-    }else{
-
-      /* Add target */
-      if($this->ID ==0 && isset($_POST['add_target']) && !empty($_POST['task_MAC'])){
-        $MAC = $_POST['task_MAC'];
-        $NAME= "";
-        $IP  = "";
-        $DNS   = "";
-        $DHCP  = "";
-        if(isset($_POST['task_Name'])){
-          $NAME = $_POST['task_Name'];
-        }
-        if(isset($_POST['task_IP']) && is_ip($_POST['task_IP'])){
-          $IP = $_POST['task_IP'];
-        }
-        if(isset($_POST['configure_dns']) && isset($_POST['Zone']) && isset($this->Zones[$_POST['Zone']])){
-          $DNS = $_POST['Zone'];
-        }
-        if(isset($_POST['configure_dhcp']) && isset($_POST['Section']) && isset($this->Sections[$_POST['Section']])){
-          $DHCP = $_POST['Section'];
-        }
-        if(is_mac($MAC)){
-          $this->Initial_Target[] = array("MAC"=>$MAC,"IP"=>$IP,"NAME"=>$NAME);
-        }
-      }
-    }
-
-    /* Add via csv */
-    if($this->ID == 0 && isset($_FILES['import_file'])){
-      $file = $_FILES['import_file']['tmp_name'];
-      if(file_exists($file) && is_readable($file)){
-        $str ="";
-        $fp = fopen($file,"r");
-        while(!feof($fp)){
-          $line = fgets($fp,512);
-          $tmp = preg_split("/(,|;)/",$line);
-
-          $MAC = $IP = $NAME; 
-          if(isset($tmp[0])){
-            $MAC = trim($tmp[0]);
-          }
-          if(isset($tmp[1])){
-            $IP = trim($tmp[1]);
-          }
-          if(isset($tmp[2])){
-            $NAME = trim($tmp[2]);
-          }
-          if(is_mac($MAC)){
-            $this->Initial_Target[] = array("MAC"=>$MAC,"IP"=>$IP,"NAME"=>$NAME);
-          }
-        }
-      }
-    }
-  
-    /********
-     * Add target from list 
-     ********/
-
-    /* If add from list is was requsted, display this list */ 
-    if(isset($_POST['add_from_list'])){
-      $this->dialog = new target_list($this->config,$this->Target);
-    }
-
-    /* Save selected objects as target */
-    if(isset($_POST['SaveMultiSelectWindow']) && is_object($this->dialog)){
-      $this->dialog->save_object();
-      $ret = $this->dialog->save();
-      foreach($ret as $entry){
-        $this->Target[] = $entry['cn'][0];
-      }
-      $this->dialog = FALSE;
-    }
-
-    /* Cancel object listing */
-    if(isset($_POST['CloseMultiSelectWindow'])){
-      $this->dialog = FALSE;
-    }
-
-    /* Display object Listing */
-    if(is_object($this->dialog)){
-      $this->dialog->save_object();
-      return($this->dialog->execute());
-    }
-
-    /********
-     * Display this plugin  
-     ********/
-
-    $divlist = new divlist("goto_task");
-#    $divlist->SetPluginMode(); 
-    $divlist->setHeight(200);
-    $divlist->SetWidth("100%");
-    $divlist->SetEntriesPerPage(0);
-
-    $acl_target = $this->parent->getacl("Target");
-    if(preg_match("/w/i",$acl_target)){
-      $field_del = array("string" => "<input type='image' src='images/edittrash.png' name='remove_%KEY%'>" , 
-          "attach" => "style='width:44px;border-right:0px;'");
-    }else{
-      $field_del = array("string" => "",
-          "attach" => "style='width:44px;border-right:0px;'");
-    }
-
-    /* Add entries to divlist */
-    if($this->Action == "initial_install"){
-      $divlist->SetHeader(array(
-                            array("string" => _("Target systems") ,"attach" => "style='width:120px;'"),
-                            array("string" => _("IP")      , "attach" => "style='width:90px;'"),
-                            array("string" => _("Name")    , "attach" => "style='width:150px;'"),
-                            array("string" => _("Actions") , "attach" => "style='width:44px;border-right:0px;text-align:right;'")));
-      foreach($this->Initial_Target as $key => $target){
-        $field1 = array("string" => $target['MAC']  ,"attach" => "style='width:120px;'");
-        $field2 = array("string" => $target['IP']   ,"attach" => "style='width:90px;'");
-        $field3 = array("string" =>  $target['NAME'] ,"attach" => "style='width:150px;'");
-        $divlist->AddEntry(array($field1,$field2,$field3,preg_replace("/%KEY%/",$key,$field_del)));
-      } 
-    }else{
-      $divlist->SetHeader(array(
-                            array("string" => "Target", "attach" => "style=''"),
-                            array("string" => "Actions" , "attach" => "style='width:44px;border-right:0px;text-align:right;'")));
-      foreach($this->Target as $key => $target){
-        $field1 = array("string" => $target);
-        $divlist->AddEntry(array($field1,preg_replace("/%KEY%/",$key,$field_del)));
-      } 
-    }
-
-    $smarty = get_smarty();
-    foreach($this->attributes as $attr){
-      $smarty->assign($attr."ACL", $this->parent->getacl($attr));
-      $smarty->assign($attr,$this->$attr);
-    }
-
-    $smarty->assign("Zones", $this->Zones);
-    $smarty->assign("Sections", $this->Sections);
-
-    $smarty->assign("ID",$this->ID);
-  
-    $smarty->assign("Zone", $this->Zone);
-    $smarty->assign("Section", $this->Section);
-
-    $smarty->assign("configure_dhcp", $this->configure_dhcp);
-    $smarty->assign("configure_dns", $this->configure_dns);
-
-    $tmp = $this->get_array_values();
-    $smarty->assign("JS"      , $_SESSION['js']);
-    $smarty->assign("Minutes" , $tmp['Minute']);
-    $smarty->assign("Hours"   , $tmp['Hour']);
-    $smarty->assign("Days"    , $tmp['Day']);
-    $smarty->assign("Months"  , $tmp['Month']);
-    $smarty->assign("Weekdays", $tmp['Weekday']);
-    $smarty->assign("OGroups" , $this->OGroups);
-    $smarty->assign("Actions"     , $this->Actions);
-    $smarty->assign("Target_list" , $divlist->DrawList());
-    $smarty->assign("new"      , $this->new);
-    return ($smarty->fetch (get_template_path('goto_task.tpl', TRUE)));
-  }
-
-
-  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 get_dhcp_sections()
-  {
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(objectClass=dhcpService)",array("dhcpPrimaryDN"));
-
-    $tmp   = array();
-    $tmp2  = array();
-
-    $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();
-      $dhcp_dns[$key] = $tmp['cn'][0];
-    }
-
-    foreach($dhcp_dns as $dn => $cn){
-      $ldap->cd($dn);
-      $ldap->search("(|(objectClass=dhcpService)(objectClass=dhcpGroup)".
-                    "(objectClass=dhcpSubnet)(objectClass=dhcpSharedNetwork))",array("cn"));
-      $tmp = array();
-      while($attr = $ldap->fetch()){
-        $tmp[$attr['dn']] = $attr['cn'][0];
-      }
-      $tmp2 = $this->create_tree($tmp,preg_replace("/^[^,]+,/i","",$dn),"(".$cn.")&nbsp;");
-    }
-    $ret = array();
-    foreach($tmp2 as $key => $label){
-      $ret[$tmp[$key]] = $label;
-    }
-    return($ret);
-  }
-
-  
-  /* check given values */
-  function check()
-  {
-    $message = plugin::check();
-    $tmp = array(
-      "OGroup" => _("Object group") ,"Minute" => _("Minute"),
-      "Hour"   => _("Hour")         ,"Day"    => _("Day"),
-      "Month"  => _("Month")        ,"Weekday"=> _("Week day"),
-      "Action" => _("Action")       ,"Comment"=> _("Description"));
-    
-    foreach($tmp as $name => $desc){
-      if(empty($this->$name) && $this->$name != 0){
-        $message[] = sprintf(_("The given value for attribute '%s' is invalid."),$desc);
-      }
-    }
-    if(count($this->Target) == 0 && $this->Action != "initial_install"){
-      $message[] = sprintf(_("You must specify at least one target"));
-    }
-    if(count($this->Initial_Target) == 0 && $this->Action == "initial_install"){
-      $message[] = sprintf(_("You must specify at least one target"));
-    }
-    return($message);
-  }
-  
-
-  /* Map acl function, to be able to use plugin::save_object() */
-  function acl_is_writeable($attribute,$skip_write = FALSE)
-  {
-    return($this->parent->acl_is_writeable($attribute,$skip_write));
-  }
-
-
-  function save_object()
-  {
-    if(isset($_POST['goto_task_posted'])){
-
-      if($this->Action == "initial_install"){
-        if(isset($_POST['configure_dns'])){
-          $this->configure_dns = TRUE;
-          if(isset($_POST['Zone'])){
-            $this->Zone = get_post("Zone");
-          }
-        }else{
-          $this->Zone = "\"\"";
-          $this->configure_dns = FALSE;
-        }
-
-        if(isset($_POST['configure_dhcp'])){
-          $this->configure_dhcp = TRUE;
-          if(isset($_POST['Section'])){
-            $this->Section = get_post("Section");
-          }
-        }else{
-          $this->configure_dhcp = FALSE;
-          $this->Section = "\"\"";
-        }
-      }
-      plugin::save_object();
-    }
-  }  
-
-
-  /* Check if given target is vald.
-   * It must either be a valid MAC address or an existing object group
-   */
-  function is_valid_target($str)
-  {
-    if(is_mac($str)){
-      return(TRUE);
-    }else{
-      $ldap = $this->config->get_ldap_link();
-      $ldap->cd($this->config->current['BASE']);
-      $ldap->search("(&(objectClassgosaGroupOfNames)(cn=".$str."))",array("cn"));
-      if($ldap->count()){
-        return(TRUE);
-      }
-    }
-  }
-
-  function save()
-  {
-    $tmp = array();
-    foreach($this->attributes as $attr){
-      $tmp[$attr] = $this->$attr;
-    }
-
-    if($this->Action != "initial_install" || !$this->configure_dns){
-      $tmp['Zone'] = "\"\"";
-    }
-    if($this->Action != "initial_install" || !$this->configure_dhcp){
-      $tmp['Section'] = "\"\"";
-    }
-    return($tmp);
-  }
-
-
-  /* Return values for listboxes. 
-   */
-  function get_array_values()
-  {
-    $ret = array();    
-
-    /* Create minute array */
-    $Minute = array( "*"    => "*",
-                      "*/1"  => "*/1",
-                      "*/3"  => "*/3",
-                      "*/5"  => "*/5",
-                      "*/10" => "*/10",
-                      "*/15" => "*/15",
-                      "*/30" => "*/30",
-                      "*/45" => "*/45",
-                      "*/60" => "*/60"); 
-    for($i = 0; $i < 60 ; $i ++){
-      $Minute[$i] = $i;
-    }
-
-    /* Create hour array */
-    $Hour = array(   "*" => "*");
-    for($i = 1 ; $i < 24 ; $i ++ ){
-      $Hour["*/".$i] = "*/".$i;
-    } 
-    for($i = 0 ; $i < 24 ; $i ++ ){
-      $Hour[$i] = $i;
-    } 
-
-    /* Create hour array */
-    $Day = array( "*" => "*");
-    for($i = 1 ; $i < 32 ; $i ++ ){
-      $Day["*/".$i] = "*/".$i;
-    } 
-    for($i = 1 ; $i < 32 ; $i ++ ){
-      $Day[$i] = $i;
-    } 
-   
-    /* Create month array */
-    $Month = array( "*" => "*");
-    for($i = 1 ; $i <= 12 ; $i ++ ){
-      $Month["*/".$i] = "*/".$i;
-    } 
-    for($i = 1 ; $i <= 12 ; $i ++ ){
-      $Month[$i] = $i;
-    } 
-   
-    /* Create week day array */
-    $Weekday = array( "*" => "*");
-    for($i = 1 ; $i <= 7 ; $i ++ ){
-      $Weekday["*/".$i] = "*/".$i;
-    } 
-    for($i = 0 ; $i <= 7 ; $i ++ ){
-      $Weekday[$i] = $i;
-    } 
-   
-    foreach(array("Minute","Weekday","Hour","Day","Month") as $var){
-      $ret[$var] = $$var;
-    }
-    return($ret);
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/addons/gotomasses/class_gotomasses.inc b/plugins/addons/gotomasses/class_gotomasses.inc
deleted file mode 100644 (file)
index adf2218..0000000
+++ /dev/null
@@ -1,431 +0,0 @@
-<?php
-
-class gotomasses extends plugin
-{
-  /* Definitions */
-  var $plHeadline     = "System deployment";
-  var $plDescription  = "This does something";
-
-  /* attribute list for save action */
-  var $attributes= array();
-  var $objectclasses= array();
-
-  /* Queue tasks */
-  var $current =false;
-  var $dialog = FALSE;
-  var $ids_to_remove = array();
-  var $divlist = NULL;
-
-  var $sort_by = "QueuePosition";
-  var $sort_dir= "up";
-
-  function gotomasses(&$config, $dn= NULL)
-  {
-    /* Include config object */
-    $this->config= &$config;
-    $this->divlist = new divListMasses($this->config,$this);
-    $this->o_queue = new hostActionQueue(&$config);
-  }
-
-
-  function execute()
-  {
-    $smarty = get_smarty();
-    /************
-     * Handle posts 
-     ************/
-
-    $s_entry = $s_action = "";
-    $arr = array( 
-                  "/^prio_top_/"      => "prio_top",
-                  "/^prio_increase_/" => "prio_increase",
-                  "/^prio_decrease_/" => "prio_decrease",
-                  "/^prio_bottom_/"   => "prio_bottom",
-
-                  "/^multiple_prio_top_/"      => "mprio_top",
-                  "/^multiple_prio_increase_/" => "mprio_increase",
-                  "/^multiple_prio_decrease_/" => "mprio_decrease",
-                  "/^multiple_prio_bottom_/"   => "mprio_bottom",
-
-                  "/^edit_task_/"=>"edit","/^remove_task_/"=>"remove",
-                  "/^new_task_/"=>"new_task","/^remove_multiple_task_/" => "remove_multiple");
-    foreach($arr as $regex => $action){
-      foreach($_POST as $name => $value){
-        if(preg_match($regex,$name)){
-          $s_action = $action;
-          $s_entry  = preg_replace($regex,"",$name);
-          $s_entry  = preg_replace("/_(x|y)$/","",$s_entry);
-        }
-      }
-    }
-
-    /* Edit posted from list link */
-    if(isset($_GET['act']) && $_GET['act'] == "edit" && isset($_GET['id']) && isset($this->tasks[$_GET['id']])){
-      $s_action = "edit";
-      $s_entry = $_GET['id'];
-    }
-
-    /************
-     * REMOVE 
-     ************/
-    
-    if(preg_match("/^mprio_/",$s_action) || preg_match("/^prio_/",$s_action)){
-
-      switch($s_action){
-        case 'mprio_top'       : foreach($this->list_get_selected_items() as $id ){
-                                   $this->o_queue->max_entry_priority($id);
-                                 }
-                                 break;
-        case 'mprio_increase'  : foreach($this->list_get_selected_items() as $id ){
-                                   $this->o_queue->increase_entry_priority($id);
-                                 }
-                                 break;
-        case 'mprio_decrease'  : foreach($this->list_get_selected_items() as $id ){
-                                   $this->o_queue->decrease_entry_priority($id);
-                                 }
-                                 break;
-        case 'mprio_bottom'    : foreach($this->list_get_selected_items() as $id ){
-                                   $this->o_queue->min_entry_priority($id);
-                                 }
-                                 break;
-        case 'prio_top'       : $this->o_queue->max_entry_priority($s_entry);break;
-        case 'prio_increase'  : $this->o_queue->increase_entry_priority($s_entry);break;
-        case 'prio_decrease'  : $this->o_queue->decrease_entry_priority($s_entry);break;
-        case 'prio_bottom'    : $this->o_queue->min_entry_priority($s_entry);break;
-        default : trigger_error("Undefined priority setting used.");
-      }
-      if($this->o_queue->is_error()){
-        print_red($this->o_queue->get_error());
-      }
-    }
-
-    /************
-     * REMOVE 
-     ************/
-
-    /* Remove multiple */
-    if($s_action == "remove_multiple" || $s_action == "remove"){
-
-      if(!$this->acl_is_removeable()){
-        print_red(_("You are not allowed to remove a task."));
-      }else{
-
-        if($s_action == "remove"){
-          $ids = array($s_entry);
-        }else{
-          $ids = $this->list_get_selected_items();
-        }
-  
-
-        $this->ids_to_remove = $ids;
-        $tmp = "";
-        foreach($this->ids_to_remove as $key => $id){
-          if($this->o_queue->id_exists($id)){
-            $task = $this->o_queue->get_entry($id);
-            $tmp.= "\n".$this->target_to_string($task);
-          }else{
-            unset($this->ids_to_remove[$key]);
-          }
-        }
-        $smarty->assign("multiple", TRUE); 
-        $smarty->assign("info",sprintf(_("Your are about to delete the following tasks: %s"),"<pre>".$tmp."</pre>"));
-        $this->current = $s_entry;
-        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
-      }
-    }
-
-    /* Remove specified tasks */
-    if(count($this->ids_to_remove) && isset($_POST['delete_multiple_confirm'])){
-      foreach($this->ids_to_remove as $id){
-        if($this->o_queue->id_exists($id)){
-          $this->o_queue->remove_entry($id);
-        }
-      }
-      $this->save();
-    }
-
-    /* Remove aborted */
-    if(isset($_POST['delete_cancel'])){
-      $this->ids_to_remove = array();;
-    }
-
-
-    /************
-     * EDIT 
-     ************/
-
-    /* Edit selected entry */
-    if($s_action == "edit"){
-      $entry = $this->o_queue->get_entry($s_entry);
-      if($entry){
-        $this->dialog = new goto_task($this->config,$this,$entry);
-        $this->current = $s_entry;
-      }
-    }
-
-    /* New entry */
-    if($s_action== "new_task" && $this->acl_is_createable()){
-      $this->dialog = new goto_task($this->config,$this);
-      $this->current = -1;
-    }
-  
-    /* Close dialog */
-    if(isset($_POST['close_goto_task'])){
-      $this->dialog = FALSE;
-      $this->current = -1;
-    }
-
-    /* Close dialog */
-    if((isset($_POST['save_goto_task']) || isset($_POST['apply_goto_task'])) && is_object($this->dialog) ){
-      $this->dialog->save_object();
-      $msgs = $this->dialog->check();
-      if(count($msgs)){
-        foreach($msgs as $msg){
-          print_red($msg);  
-        }
-      }else{  
-        
-        if($this->o_queue->id_exists($this->current)){
-          $this->o_queue->update_entry($this->current,$this->dialog->save());
-        }else{
-          $tmp = $this->dialog->save();
-          $tmp2= array();
-          $targets =$tmp['Target'];
-          foreach($targets as $target){
-            $tmp['Target'] = array($target);
-            $tmp2[] = $tmp;
-          }
-          if(!$this->o_queue->add_multiple($tmp2)){
-            print_red($this->o_queue->get_error());
-          }
-        }
-        if(!isset($_POST['apply_goto_task'])){
-          $this->dialog = FALSE;
-          $this->current = -1;
-        }
-        $this->save();
-      }
-    }
-
-    /* Display dialogs if currently opened */
-    if(is_object($this->dialog)){
-      $this->dialog->save_object();
-      return($this->dialog->execute());
-    }
-
-    /************
-     * Handle Divlist 
-     ************/
-
-    $this->divlist->execute();
-    $this->divlist->SetEntries($this->get_queue_entries()); 
-    $str = 
-      "<script type=\"text/javascript\">
-      <!--
-        var time = null
-        function move() {
-          window.location = '?plug=".$_GET['plug']."'
-        }
-        setInterval(\"move()\",20000);
-        //-->
-        </script>";
-    return($str.$this->divlist->Draw());
-  }
-
-    
-  function get_queue_entries()
-  {
-    if(!$this->o_queue->load()){
-      print_red("ERROR:".$this->o_queue->get_error());
-      return(array());
-    }
-
-    $queue_pos = 1;
-    $tasks = array();
-    $ret = array();
-    while($entry = $this->o_queue->fetch()){
-      $task = $entry['TASK_ID']; 
-      if(!isset($tasks[$task])){
-        $tasks[$task] = dechex(rand(100,240)).dechex(rand(100,240)).dechex(rand(100,240));
-      }
-      $entry['Queue_Position'] = $queue_pos;
-      $entry['color'] = $tasks[$task]; 
-      $ret[]= $entry;
-      $queue_pos ++;
-    }
-  
-    /* Sort entries */
-    $simple_map = array("QueuePosition" => "Queue_Position",
-                        "Action"        => "Action",
-                        "TaskID"        => "TASK_ID");
-    $sort_arr = array();
-    if(isset($simple_map[$this->sort_by])){
-      foreach($ret as $id => $entry){
-        $sort_arr[$entry[$simple_map[$this->sort_by]]][] = $id;
-      }
-    }
-    if($this->sort_by == "TargetName"){
-      foreach($ret as $id => $entry){
-        $name = $this->target_to_string($entry);
-        $sort_arr[$name][] = $id;
-      }
-    }
-    if($this->sort_by == "Schedule"){
-      foreach($ret as $id => $entry){
-        $name = $entry['Minute'].$entry['Hour'].$entry['Day'].$entry['Month'].$entry['Weekday'];
-        $sort_arr[$name][] = $id;
-      }
-    }
-    if($this->sort_dir == "up"){
-      ksort($sort_arr);
-    }else{
-      krsort($sort_arr);
-    }
-    $ret2 = array();
-    foreach($sort_arr as $key => $entries){
-      foreach($entries as $entry_id){
-        $ret2[] = $ret[$entry_id];
-      }
-    }
-    return($ret2);
-  }
-
-
-  function get_additional_entry_informations($data)
-  {
-    $i = rand(0,3);
-    if($i == 0){
-      return("<div style='width:80px;background-color:#999999;'><div style='background-color:#00FF00;width:40%'>&nbsp;</div></div>");
-    }
-    if($i == 1){
-      return("<font style='color: #FF0000;'>Failed</font>");
-    }
-    if($i == 1){
-      return("<font style='color: #00FF00;'>OK</font>");
-    }
-    return("-");
-  }
-
-
-  function target_to_string($data)
-  {
-    $ret = "";
-    if($data['Action'] == "initial_install"){
-      foreach($data['Initial_Target'] as $target){
-        $ret .= $target['MAC'].", ";
-      } 
-    }else{
-      foreach($data['Target'] as $target){
-        $ret .= $target.", ";
-      } 
-    }
-    return(preg_replace("/, $/","",$ret));
-  }
-
-  
-  function time_to_string($data)
-  {
-    return($data['Minute']." ".$data['Hour']." ".$data['Day']." ".$data['Month']." ".$data['Weekday']);
-  }
-
-  
-  function action_to_string($data)
-  {
-    $tmp = $this->get_actions();
-    if(isset($tmp[$data['Action']])){
-      return($tmp[$data['Action']]);
-    }else{
-      return(_("Unknown"));
-    }
-  }
-
-  
-  function save_object()
-  {
-    $this->divlist->save_object();
-    $sort_vals = array("Action","QueuePosition","TargetName","Schedule","TaskID");
-    if(isset($_GET['sort']) && in_array($_GET['sort'],$sort_vals)){
-      $sort = $_GET['sort'];
-      if($this->sort_by == $sort){
-        if($this->sort_dir == "up"){
-           $this->sort_dir = "down";
-        }else{
-           $this->sort_dir = "up";
-        }
-      }
-      $this->sort_by = $sort;
-    }
-  }
-
-
-  /* Return list of object groups */
-  function get_object_groups()
-  {
-    $ret = array();
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(&(objectClass=gosaGroupOfNames)(cn=*))",array("cn"));
-    while($attrs = $ldap->fetch()){
-      $ret[$attrs['cn'][0]] = $attrs['cn'][0];
-    }
-    return($ret); 
-  }
-
-  
-  function save()
-  {
-  }
-
-
-  function list_get_selected_items()
-  {
-    $ids = array();
-    foreach($_POST as $name => $value){
-      if(preg_match("/^item_selected_[0-9]*$/",$name)){
-        $id   = preg_replace("/^item_selected_/","",$name);
-        $ids[$id] = $id;
-      }
-    }
-    return($ids);
-  }
-
-
-  function get_actions()
-  {
-    /* Prepare list of available actions */
-    $actions = array(       "reboot"          => _("Reboot"),
-                            "localboot"       => _("Localboot"),
-                            "halt"            => _("Halt system"),
-                            "initial_install" => _("Initial installation"),
-                            "update"          => _("Update"),
-                            "reinstall"       => _("(Re)Install"),
-                            "rescan"          => _("Rescan"),
-                            "wake"            => _("Wake"),
-                            "memcheck"        => _("Memory check"));
-    return($actions);
-  }
-
-
-  static function plInfo()
-  {
-    return (array(
-        "plShortName"   => _("System mass deployment"),
-        "plDescription" => _("Provide a mechanism to automatically activate a set of systems"),
-        "plSelfModify"  => FALSE,
-        "plDepends"     => array(),
-        "plPriority"    => 0,
-        "plSection"     => array("addon"),
-        "plCategory"    => array("gotomasses" => array("objectClass" => "none", "description" => _("System mass deployment"))),
-        "plProvidedAcls" => array("Comment"   => _("Description"), 
-                                  "Action"    => _("Action"),
-                                  "Day"       => _("Day"),
-                                  "Minute"    => _("Minute"),
-                                  "Hour"      => _("Hour"),
-                                  "Month"     => _("Month"),
-                                  "Weekday"   => _("Week day"),
-                                  "Target"    => _("Target"))
-        ));
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/addons/gotomasses/class_target_list.inc b/plugins/addons/gotomasses/class_target_list.inc
deleted file mode 100644 (file)
index 6ecd300..0000000
+++ /dev/null
@@ -1,303 +0,0 @@
-<?php
-
-class target_list extends MultiSelectWindow
-{
-  var $config;
-  var $list         =array();
-  var $Targets_used =array();
-
-  /* Current base */
-  var $selectedBase       = "";
-  var $departments        = array();
-
-  /* Regex */
-  var $Regex              = "*";
-  var $IP_start           = "0.0.0.0";
-  var $IP_end             = "255.255.255.255";
-
-  /* CheckBoxes, to change default values modify $this->AddCheckBox */
-  var $ogroups        ;
-  var $servers        ;
-  var $workstations   ;
-
-
-  /* Subsearch checkbox */
-  var $SubSearch          ;
-  var $IPMatch            ;
-  var $parent             ;
-  var $ui                 ;
-  function target_list(&$config,$Targets_used)
-  {
-    MultiSelectWindow::MultiSelectWindow($config, "Targetselection", array("ogroup","gotomasses"));
-
-    $this->Targets_used = $Targets_used;
-    
-    $this->SetInformation(  _("Select the target objects for your scheduled action."));
-    $this->SetTitle(        _("Available targets"));
-    $this->SetSummary(      _("Available targets"));
-    $this->SetHeadpageMode(FALSE);
-    
-    /* set Page header */
-    $chk = "<input type='checkbox' id='select_all' name='select_all'
-               onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
-    $this->AddHeader(array("string"=> $chk,          "attach"=>"style='width:20px;'"));
-
-    $this->AddHeader(array("string" => "&nbsp;", "attach" => "style='text-align:center;width:20px;'"));
-    $this->AddHeader(array("string" => _("Object name"), "attach" => "style=''"));
-
-    /* Text ,Value, Name, Is selected */
-    $this->AddCheckBox("ogroups",       _("Select to see object groups"),  _("Show object groups"), true);
-    $this->AddCheckBox("servers",       _("Select to see servers")  ,   _("Show servers"), true);
-    $this->AddCheckBox("workstations",  _("Select to see workstations"),_("Show workstations"), true);
-
-    /* Add SubSearch checkbox */
-    $this->AddCheckBox(SEPERATOR);
-    $this->AddCheckBox("SubSearch",  _("Select to search within subtrees"), _("Search in subtrees"), false);
-    $this->AddCheckBox("IPMatch",    _("Select to search for a specific IP range only"), _("Match IP range"), false);
-
-    /* Name,Text,Default  , Connect with alphabet  */
-    $this->AddRegex   ("Regex",     _("Regular expression for matching group names"), "*" , true);
-    $this->AddRegex   ("IP_start",  _("IP range start"),  "0.0.0.0" , true);
-    $this->AddRegex   ("IP_end",    _("IP range end"),    "255.255.255.255" , true);
-    $this->EnableAplhabet(TRUE);
-  }
-
-
-  function GenHeader()
-  {
-    $options= "";
-
-    /* Get all departments within this subtree */
-    $ui= get_userinfo();
-    $first = "";
-    $found = FALSE;
-    $base = $this->config->current['BASE'];
-
-    /* Add base */
-    $tmp = array();
-    $tmp[] = array("dn"=>$this->config->current['BASE']);
-    $tmp=  array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
-                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
-
-    $deps = array();
-    foreach($tmp as $tm){
-      $deps[$tm['dn']] = $tm['dn'];
-    }
-
-    /* Load possible departments */
-    $ui= get_userinfo();
-    $tdeps= $ui->get_module_departments("ogroups");
-    $ids = $this->config->idepartments;
-    $first = "";
-    $found = FALSE;
-    foreach($ids as $dep => $name){
-      if(isset($deps[$dep]) && in_array_ics($dep, $tdeps)){
-
-        /* Keep first base dn in mind, we could need this
-         *  info if no valid base was found
-         */
-        if(empty($first)) {
-          $first = $dep['dn'];
-        }
-
-        $value = $ids[$dep];
-        if ($this->selectedBase == $dep){
-          $found = TRUE;
-          $options.= "<option selected='selected' value='".$dep."'>$value</option>";
-        } else {
-          $options.= "<option value='".$dep."'>$value</option>";
-        }
-      }
-    }
-
-    /* The currently used base is not visible with your acl setup.
-     * Set base to first useable base.
-     */
-    if(!$found){
-      $this->selectedBase = $first;
-    }
-
-    /* Get copy & paste icon */
-    $acls  = $ui->get_permissions($this->selectedBase,"ogroups/ogroup");
-    $acl_all= $ui->has_complete_category_acls($this->selectedBase,"ogroups");
-
-    /* Add default header */
-    $listhead = MultiSelectWindow::get_default_header();
-
-    /* Add department selector */
-    $listhead .= _("Base")."&nbsp;<select name='CurrentMainBase' 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;";
-    $listhead .="</div>";
-
-    $this->SetListHeader($listhead);
-  }
-
-
-  function execute()
-  {
-    $this->ClearElementsList();
-    $this->GenHeader();
-    $this->reload();
-    $this->SetEntries($this->list);
-    return($this->Draw());
-  }
-
-  
-  function SetEntries($list)
-  {
-      /* Add Copy & Paste buttons if copy&paste is enabled
-     */
-    // Defining Links
-    $linkopen = "<a href='?plug=".$_GET['plug']."&amp;act=dep_open&amp;dep_id=%s'>%s</a>";
-    $editlink = "<a href='?plug=".$_GET['plug']."&amp;id=%s&amp;act=edit_entry'>%s</a>";
-
-    $ui = get_userinfo();
-
-    // Assigning ogroups
-    foreach($list as $key => $val){
-
-      if(in_array($val['cn'][0],$this->Targets_used) || 
-         isset($val['macAddress'][0]) && in_array($val['macAddress'][0],$this->Targets_used)) continue;
-
-      $title = "title='".preg_replace('/ /', '&nbsp;', @LDAP::fix($val['dn']))."'";
-      if(!isset($val['description'][0])){
-        $desc = "";
-      }else{
-        $desc = " - [ ".$val['description'][0]." ]";
-      }
-      if(!isset($val['ipHostNumber'][0])){
-        $desc.= "";
-      }else{
-        $desc.= " - ".$val['ipHostNumber'][0]."";
-      }
-
-
-      $img ="Hmm";
-      if(in_array("goServer",$val['objectClass'])){
-        $img = "<img src='images/select_server.png' alt='"._("Server")."' ".$title.">";
-      }elseif(in_array("gotoWorkstation",$val['objectClass'])){
-        $img = "<img src='images/select_workstation.png' alt='"._("Workstation")."' ".$title.">";
-      }elseif(in_array("gosaGroupOfNames",$val['objectClass'])){
-        $img = "<img src='images/list_ogroup.png' alt='"._("Object group")."' ".$title.">";
-      }
-
-      /* Create each field */
-      $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
-                      "attach" => "style='width:20px;'");
-      $field1 = array("string" => $img, 
-                      "attach" => "style='text-   align:center;width: 20px;'");
-      $field2 = array("string" => $val['cn'][0].$desc, 
-                      "attach" => "style='border-right:0px;' ".$title);
-
-      $this->AddElement(array($field0,$field1,$field2));
-    }
-  }
-
-  
-  function save()
-  { 
-    $ret = array();
-    $items = $this->list_get_selected_items();
-    foreach($items as $item){
-      $ret[] = $this->list[$item];
-    }
-    return($ret);
-  }
-
-
-  function save_object()
-  {
-    MultiSelectWindow::save_object();
-  }
-
-  
-  function reload()
-  {
-    /* Set base for all searches && initialise some vars */
-    $this->list= array();
-    $base     = $this->selectedBase;
-    $filter   = "";
-    $Regex    = $this->Regex;
-    $IP_start = $this->IP_start;
-    $IP_end   = $this->IP_end;
-
-    if($this->IPMatch){
-      if(!is_ip($IP_start)){
-        print_red(_("Please specify a valid IP range."));
-        return;
-      }
-      if(!is_ip($IP_end)){
-        print_red(_("Please specify a valid IP range."));
-        return;
-      }
-    }
-  
-
-    $chk = array(
-        "ogroups"       => "(&(objectClass=gosaGroupOfNames)(|(gosaGroupObjects=*S*)(gosaGroupObjects=*W*)))" ,
-        "servers"       => "(objectClass=goServer)" ,
-        "workstations"  => "(objectClass=gotoWorkstation)");
-
-    /* Create filter */
-    foreach($chk as $chkBox => $FilterPart){
-      if($this->$chkBox){
-        $filter .=  $FilterPart;
-      }
-    }
-    $filter= "(&(cn=".$Regex.")(|".$filter."))";
-
-    if($this->SubSearch){
-      $res= get_list($filter, array("ogroups","workstations","servers"), $base, 
-            array("cn","objectClass","gosaGroupObjects","ipHostNumber","description"), GL_SIZELIMIT | GL_SUBSEARCH);
-    }else{
-      $res= get_list($filter, "ogroups", get_groups_ou().$base, 
-            array("cn","objectClass","ipHostNumber","description"), GL_SIZELIMIT );
-      $res= array_merge($res,get_list($filter, "workstation",  "ou=workstations,ou=systems,".$base, 
-            array("cn","objectClass","ipHostNumber","description"), GL_SIZELIMIT ));
-      $res= array_merge($res,get_list($filter, "server", "ou=servers,ou=systems,".$base, 
-            array("cn","objectClass","ipHostNumber","description"), GL_SIZELIMIT ));
-    }
-
-    $this->list= $res;
-    ksort ($this->list);
-    reset ($this->list);
-    $tmp=array();
-    foreach($this->list as $tkey => $val ){
-
-      if($this->IPMatch){
-        if(isset($val['ipHostNumber'][0])){
-          if(is_ip_range($IP_start,$val['ipHostNumber'][0]) && is_ip_range($val['ipHostNumber'][0],$IP_end)){
-            $tmp[strtolower($val['cn'][0]).$val['cn'][0]]=$val;
-          }
-        }
-      }else{
-        $tmp[strtolower($val['cn'][0]).$val['cn'][0]]=$val;
-      }
-    }
-    ksort($tmp);
-    $this->list=array();
-    foreach($tmp as $val){
-      $this->list[]=$val;
-    }
-    reset ($this->list);
-  }
-
-  function list_get_selected_items()
-  {
-    $ids = array();
-    foreach($_POST as $name => $value){
-      if(preg_match("/^item_selected_[0-9]*$/",$name)){
-        $id   = preg_replace("/^item_selected_/","",$name);
-        $ids[$id] = $id;
-      }
-    }
-    return($ids);
-  }
-}
-
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/addons/gotomasses/goto_task.tpl b/plugins/addons/gotomasses/goto_task.tpl
deleted file mode 100644 (file)
index f841a4f..0000000
+++ /dev/null
@@ -1,235 +0,0 @@
-<table style='width:100%'>
-       <tr>
-               <td colspan="2">
-                       <h2><img alt="" src="images/head.png" class="center" align="middle"> {t}Generic{/t}</h2>
-               </td>
-       </tr>
-       <tr>
-               <td style='width:50%;border-right: 1px solid rgb(160, 160, 160);'>
-                       <table>
-                               <tr>
-                                       <td>
-                                               {t}Description{/t}
-                                       </td>
-                                       <td>
-                                               {render acl=$CommentACL}
-                                               <input type="text" name="Comment" value="{$Comment}">
-                                               {/render}
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>
-                                               {t}Object group membership{/t}
-                                       </td>
-                                       <td>
-                                               {render acl=$OGroupACL}
-                                               <select name="OGroup">
-                                                       {html_options options=$OGroups selected=$OGroup}
-                                               </select>
-                                               {/render}
-                                       </td>
-                               </tr>
-                               {if $Action == "initial_install"}
-                               <tr>
-                                       <td><input class='center' {if $configure_dns} checked {/if} id='configure_dns'
-                                               type='checkbox' name='configure_dns' value='1' onClick="changeState('Zone');">
-                                               <label for='configure_dns'>{t}Configure DNS{/t}</label>
-                                       </td>
-                                       <td>
-                                               <select name="Zone" id="Zone" {if !$configure_dns} disabled {/if}>
-                                                       {html_options options=$Zones selected=$Zone}
-                                               </select>
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td><input class='center' {if $configure_dhcp} checked {/if} id='configure_dhcp' 
-                                                       type='checkbox' name='configure_dhcp' value='1' onClick="changeState('Section');">
-                                               <label for='configure_dhcp'>{t}Configure DHCP{/t}</label>
-                                       </td>
-                                       <td>
-                                               <select name="Section" id="Section" {if !$configure_dhcp} disabled {/if}>
-                                                       {html_options options=$Sections selected=$Section}
-                                               </select>
-                                       </td>
-                               </tr>
-                               {/if}
-                       </table>
-               </td>
-               <td style='vertical-align:top'>
-                       <table>
-                               <tr>
-                                       <td>
-                                               {t}Action{/t}
-                                       </td>
-                                       <td>
-                                               {render acl=$ActionACL}
-                                               <select name="Action" onChange="document.mainform.submit();">
-                                                       {html_options options=$Actions selected=$Action}
-                                               </select>
-                                               {/render}
-                                               {if !$JS}
-                                                       <input type='image' src='images/list_reload.png' class='center'>
-                                               {/if}
-                                       </td>
-                               </tr>
-                       </table>
-
-               </td>
-       </tr>
-</table>
-{if $Action == "initial_install"}
-{if $ID == 0}
-<p class='seperator'>&nbsp;</p>
-<table style='width:100%;'>
-       <tr>
-               <td colspan="2" style='padding-top:5px;'>
-                       <h2><img alt="" src="images/select_workstation.png" class="center" align="middle"> {t}Systems{/t}</h2>
-               </td>
-       </tr>
-       <tr>
-               <td colspan="2">
-            <table  summary="" style="border:1px solid #B0B0B0;width:100%; " cellspacing=0 cellpadding=0>
-                <tr>   
-                    <td>
-                                               {render acl=$TargetACL}
-                                               {$Target_list}  
-                                               {/render}
-                                       </td>
-                               </tr>
-                       </table>
-               </td>
-       </tr>
-       <tr>
-               <td style="width:50%; border-right: 1px solid #A0A0A0;">
-                       <table>
-                               <tr>
-                                       <td>{t}MAC address{/t}{$must}
-                                       </td>
-                                       <td><input type="text" name="task_MAC" value="">        
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>{t}Name{/t}
-                                       </td>
-                                       <td><input type="text" name="task_Name" value="">       
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>{t}IP address{/t}
-                                       </td>
-                                       <td><input type="text" name="task_IP" value=""> 
-                                               {render acl=$TargetACL}
-                                               <input type="submit" name="add_target" value="{t}Add{/t}">
-                                               {/render}
-                                       </td>
-                               </tr>
-                       </table>
-               </td>
-               <td style='vertical-align:top'>
-                       <table>
-                               <tr><td>{t}CVS import from file{/t}</td></tr>
-                               <tr>
-                                       <td>
-            &nbsp;
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>
-                                               <input type="hidden" name="MAX_FILE_SIZE" value="2000000">
-                                   <input name="import_file" type="file" size="20" maxlength="255" accept="*.csv">
-                                               {render acl=$TargetACL}
-                                               <input type="submit" name="add_import" value="{t}Import{/t}">
-                                               {/render}
-                                       </td>
-                               </tr>
-                       </table>
-               </td>
-       </tr>
-</table>
-{/if}
-{else}
-<p class='seperator'>&nbsp;</p>
-<table style='width:100%;'>
-       <tr>
-               <td colspan="2">
-                       <h2><img alt="" src="images/time.png" class="center" align="middle"> {t}Schedule{/t}</h2>
-               </td>
-       </tr>
-       <tr>
-               <td colspan="2">
-                       {t}Minute{/t}
-                       {render acl=$MinuteACL}
-                               <select name='Minute'>
-                               {html_options options=$Minutes selected=$Minute}
-                               </select>
-                       {/render}
-                       {t}Hour{/t}
-                       {render acl=$HourACL}
-                               <select name='Hour'>
-                               {html_options options=$Hours selected=$Hour}
-                               </select>
-                       {/render}
-                       {t}Day{/t}
-                       {render acl=$DayACL}
-                               <select name='Day'>
-                               {html_options options=$Days selected=$Day}
-                               </select>
-                       {/render}
-                       {t}Month{/t}
-                       {render acl=$MonthACL}
-                               <select name='Month'>
-                               {html_options options=$Months selected=$Month}
-                               </select>
-                       {/render}
-                       {t}Week day{/t}
-                       {render acl=$WeekdayACL}
-                               <select name='Weekday'>
-                               {html_options options=$Weekdays selected=$Weekday}
-                               </select>
-                       {/render}
-               </td>
-       </tr>
-</table>
-{if $ID == 0}
-<p class='seperator'>&nbsp;</p>
-<table style='width:100%;'>
-       <tr>
-               <td colspan="2" style='padding-top:5px;'>
-                       <h2><img alt="" src="images/select_workstation.png" class="center" align="middle"> {t}Target systems{/t}</h2>
-               </td>
-       </tr>
-       <tr>
-               <td colspan="2">
-            <table  summary="" style="border:1px solid #B0B0B0;width:100%; " cellspacing=0 cellpadding=0>
-                <tr>
-                    <td>
-                                               {render acl=$TargetACL}
-                                               {$Target_list}  
-                                               {/render}
-                                       </td>
-                               </tr>
-                       </table>
-                                               {render acl=$TargetACL}
-                                               <input type="text" name="target_text" value="">
-                                               {/render}
-                                               {render acl=$TargetACL}
-                                               <input type="submit" name="add_target" value="{t}Add{/t}">
-                                               {/render}
-                                               {render acl=$TargetACL}
-                                               <input type="submit" name="add_from_list" value="{t}Add from list{/t}">
-                                               {/render}
-
-               </td>
-       </tr>
-</table>
-{/if}
-{/if}
-<p class='seperator'>&nbsp;</p>
-<input type='hidden' name='goto_task_posted' value='1'>
-<p style="text-align:right">
-       <input type='submit' name='save_goto_task' value='{t}Ok{/t}'>
-{if !$new}
-       <input type='submit' name='apply_goto_task' value='{t}Apply{/t}'>
-{/if}
-       <input type='submit' name='close_goto_task' value='{t}Cancel{/t}'>
-</p>
diff --git a/plugins/addons/gotomasses/main.inc b/plugins/addons/gotomasses/main.inc
deleted file mode 100644 (file)
index abe913f..0000000
+++ /dev/null
@@ -1,55 +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
-*/
-
-if (!$remove_lock){
-
-       /* Create gotomasses object on demand */
-       if (!isset($_SESSION['gotomasses']) || (isset($_GET['reset']) && $_GET['reset'] == 1) || isset($_POST['reload_gotomass_data'])){
-               $_SESSION['gotomasses']= new gotomasses ($config);
-               $_SESSION['gotomasses']->set_acl_category("gotomasses");
-
-        /* Check root dn and user dn for acl informations */
-        $_SESSION['gotomasses']->set_acl_base($config->current['BASE']);
-        if($_SESSION['gotomasses']->getacl("") == ""){
-            $_SESSION['gotomasses']->set_acl_base($ui->dn);
-        }
-               
-               /* Check if we have acl on our own base */
-        if($_SESSION['gotomasses']->getacl("") == ""){
-            $_SESSION['gotomasses']->set_acl_base(dn2base($ui->dn));
-        }
-       
-       
-       }
-       $gotomasses= $_SESSION['gotomasses'];
-
-       /* Execute formular */
-       $display= $gotomasses->save_object();
-       if(isset($_POST['save_gotomass_changes'])){
-               $gotomasses->save();
-       }
-       $display= $gotomasses->execute ();
-
-       /* Page header*/
-       $display= print_header(get_template_path('images/system.png'), _("System deployment")).$display;
-
-       /* Store changes  in session */
-       $_SESSION['gotomasses']= $gotomasses;
-}
diff --git a/plugins/addons/gotomasses/remove.tpl b/plugins/addons/gotomasses/remove.tpl
deleted file mode 100644 (file)
index 023142f..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-<div style="font-size:18px;">
- <img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
-</div>
-<p>
-  {$info}
-  {t}This includes all account data, system access rules, imap settings, etc. for this user. 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}So - if you're sure - press 'Delete' to continue or 'Cancel' to abort.{/t}
-</p>
-
-<p class="plugbottom">
-{if $multiple}
-  <input type=submit name="delete_multiple_confirm" value="{t}Delete{/t}">
-{else}
-  <input type=submit name="delete_confirm" value="{t}Delete{/t}">
-{/if}
-  <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
-</p>
-
diff --git a/plugins/addons/ldapmanager/class_csvimport.inc b/plugins/addons/ldapmanager/class_csvimport.inc
deleted file mode 100644 (file)
index 66131ca..0000000
+++ /dev/null
@@ -1,508 +0,0 @@
-<?php
-
-class csvimport extends plugin
-{
-  /* Definitions */
-  var $plHeadline= "LDIF export";
-  var $plDescription= "This does something";
-  var $access= "";
-
-  /* Array with csv informations*/
-  var $csvinfo=array();
-
-  /* attribute list for save action */
-  var $attributes= array();
-  var $objectclasses= array();
-  var $view_logged = FALSE;
-
-  function csvimport (&$config, $dn= NULL)
-  {
-    /* Include config object */
-    $this->config= &$config;
-
-    $this->ui = get_userinfo();
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* Log view */
-    if(!$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","all/".get_class($this),$this->dn);
-    }
-
-    /* initiate smarty */
-    $smarty= get_smarty();
-    $smarty->assign("selectedattrs",array(0=>""));
-    $smarty->assign("data",array(0=>""));
-    $smarty->assign("head",array(0=>""));
-    $smarty->assign("sorted",0);
-    $smarty->assign("fileup",0);
-
-    /* Get the LDAP link, to generate the Export */
-    $ldap = $this->config->get_ldap_link();
-
-    $arrtemplates = array();
-    $tempvar =0;
-
-    /* Array to fill in Formfields */
-    $arrtemplates[$tempvar] = "None";
-    if(!is_array($this->csvinfo)){
-      $this->csvinfo=array();
-    }
-
-    /* Set Usertemplate information and get all Attribute from userclass */
-    unset ($this->csvinfo['arrtemplates']);
-    unset ($this->csvinfo['arrtempls']);
-
-    /* Generate Template Array, Attribute Array */
-    if(!isset($this->csvinfo['arrtempls'])){
-
-      /* Generating attributes */
-      $attrs = @get_class_vars("user");
-      $this->csvinfo['attr']  = $attrs['attributes'];
-
-      /* Attach the choise none to discard a csv col */
-      $new = array();
-      $new[0]="none";
-      $new[1]="userPassword";
-      for($c = 0; $c < count($this->csvinfo['attr']);$c++){
-        $new[$c+2]=$this->csvinfo['attr'][$c];
-      }
-
-      $this->csvinfo['attr'] = $new;
-
-      /* Search all Templates    */
-      $this->csvinfo['templates'] = $ldap->search("(objectClass=gosaUserTemplate)",array("*"));
-
-      /* Array to handle selected Form fiels */
-      $this->csvinfo['arrtempls'][$tempvar]['name'] = "";
-      $this->csvinfo['arrtempls'][$tempvar]['dn']   = "";
-
-      $this->csvinfo['arrtemplates'][]="None";
-
-      while($temp = $ldap->fetch($this->csvinfo['templates'])){
-        $tempvar ++;
-        $this->csvinfo['arrtemplates'][$tempvar] = $temp['sn'][0]." - ".$this->config->idepartments[preg_replace("/^[^,]+,".get_people_ou()."/i", "", $temp['dn'])];
-        $this->csvinfo['arrtempls']   [$tempvar]['name'] = $temp['sn'][0]; 
-        $this->csvinfo['arrtempls']   [$tempvar]['dn']   = $temp['dn'];
-      }
-    }
-
-    $arr_temp  = array_flip($this->csvinfo['attr']);
-    $this->csvinfo['arr_selected']= array($arr_temp['uid'],$arr_temp['sn'],$arr_temp['givenName'],$arr_temp['userPassword']);
-
-    $smarty->assign("templates",$this->csvinfo['arrtemplates']);
-    $smarty->assign("attrs",$this->csvinfo['attr']);
-
-    /* Check permissions for import */
-    $acl = $this->ui->get_permissions($this->config->current['BASE'],"all/all");
-    if(!preg_match("/w/",$acl)){
-      if(isset($_POST['userfile']) || isset($_POST['sorted']) || isset($_POST['fileup'])){
-        print_red(_("You've no permission to do CSV imports."));
-      }
-      return ($smarty->fetch (get_template_path('contentcsv.tpl', TRUE)));
-    }
-
-    /* If the given dat from the csv File are sorted by the attributes */
-    if(isset($_POST['sorted'])) {
-
-      /* Template Handling */
-      $smarty->assign("fileup",TRUE); 
-      $smarty->assign("sorted",TRUE); 
-
-      for($i = 0 ; $i < $this->csvinfo['rows'];$i++){
-        /* Preparing given Data */
-        $this->csvinfo['sorteddata'][$i]=array(); 
-
-        /* Go through every col */
-        for($a = 0; $a <= ($this->csvinfo['cols']); $a ++) {
-          /* Append a status col at last, to show possibly errors */
-          if($a==($this->csvinfo['cols'])){
-            $this->csvinfo['sorteddata'][$i]["status"]="-";            
-          } else {
-            $cc = ($i * ($this->csvinfo['cols']))+$a;
-
-            /* If theres a Attribut given for this col */
-            if(!empty($_POST[('row'.($a))])) {
-              $this->csvinfo['sorteddata'][$i][$this->csvinfo['attr'][$_POST[('row'.($a))]]]=$this->csvinfo['data'][($cc)]; 
-            }
-          }
-        }
-      } 
-
-      /* aleast one entry */
-      $rowcnt=0;      
-      if(isset($this->csvinfo['sorteddata'])){
-        $rowcnt ++;
-
-        /* Set the col count */
-        $tblcolcount= count ($this->csvinfo['cols']);
-
-        /* entrie count */
-        $tbl_entries= count ($this->csvinfo['count']);
-
-        /* row count */
-        $tbl_rows   = $tbl_entries / $tblcolcount;
-
-        /* No error occurred */
-        $failing = FALSE;
-
-        /* For every row */
-        for($i = 0; $i < $this->csvinfo['rows']; $i++){
-
-          /* Get elemenet */
-          $dat = $this->csvinfo['sorteddata'][$i];
-
-          /* If not all needed vars set .... */
-          if(         ( empty($dat['sn']))||( empty($dat['givenName']))||( empty($dat['uid']))||
-              (!isset($dat['sn']))||(!isset($dat['givenName']))||(!isset($dat['uid']))){
-
-            /* Output Error */
-
-            print_red (_("Need 'sn','givenName' and 'uid' to create user."));
-          } else {
-
-            /* Register usertab to trigger edit dialog */
-            $this->usertab= new usertabs($this->config, $this->config->data['TABS']['USERTABS'], 'new');
-            $keys = array_keys($dat);
-
-
-            /* Set all submitted vars  */
-            if(is_array($keys))
-              foreach($keys as $key) {
-                if($key != "status"){
-                  $this->usertab->$key = $dat[$key];
-                }
-              }
-
-            /* Initialize template */
-            if($this->csvinfo['tplid']!=0){
-              $this->usertab->adapt_from_template($this->csvinfo['arrtempls'][$this->csvinfo['tplid']]['dn']);
-              $this->usertab->save_object();
-            } else {
-
-              /* Reset vars */
-              if(is_array($keys))
-                foreach($keys as $key) {
-                  if($key != "status"){
-                    $this->usertab->by_object['user']->$key = $dat[$key];
-                  }
-                }
-            }
-
-            // Setting user Password 
-            if((isset($dat['userPassword']))&&(!empty($dat['userPassword'])))
-              $password = $dat['userPassword']; 
-            else
-            {
-              $rand_str="";
-              $feed = "0123456789abcdefghijklmnopqrstuvwxyz";
-              for ($i=0; $i < 8; $i++)
-              {
-                $rand_str .= substr($feed, rand(0, strlen($feed)-1), 1);
-              }
-              $password = $rand_str;
-            }
-
-            /* Insert in the LDAP tree */
-            if(count($this->usertab->check())) {
-              show_errors($this->usertab->check());
-              $this->csvinfo['sorteddata'][$i]['status']="<b>"._("failed")."</b>";
-              $failing = $i+1;
-              break;
-            } else {
-              $this->csvinfo['sorteddata'][$i]['status']=_("ok");
-              $this->usertab->save();
-              change_password($this->usertab->dn,$password); 
-            }
-          }
-        }
-
-        $pointsbefore = FALSE;
-        $pointsafter  = FALSE;
-
-        /* Get Attributs for Tableheadline  */
-        $this->csvinfo['colsstr'] = array();
-        for($i =0; $i <= $this->csvinfo['cols']; $i++) {
-          if(!empty($_POST[('row'.$i)])){
-            $this->csvinfo['colsstr'][$i] = $this->csvinfo['attr'][$_POST[('row'.$i)]];
-          }
-        }
-
-        /*Create array with data for the template */
-        if($failing == FALSE){
-
-          $dataouts= array();
-          for($i =1; $i <= $this->csvinfo['shownrowscount']; $i++) {
-            if(is_array($this->csvinfo['sorteddata'][($i-1)])){
-              foreach($this->csvinfo['sorteddata'][($i-1)] as $dat){
-                $dataouts[]=$dat;
-              }
-            }
-          }
-
-          if($this->csvinfo['rows']> $this->csvinfo['shownrowscount']){
-            $pointsafter = TRUE;
-          }
-        } else {
-          $pointsbefore = TRUE;
-          $pointsafter  = TRUE;
-
-          $begin = $failing -3;
-
-          if($begin <0) {
-            $begin =0;
-            $pointsbefore = FALSE;
-          }
-
-          $end = $failing + 2;
-
-          if($end > $this->csvinfo['rows']) {
-            $end = $this->csvinfo['rows']+1;
-            $pointsafter = FALSE;
-          }
-          $this->csvinfo['shownrowscount']=$end - $begin;
-
-          if($this->csvinfo['shownrowscount']> $this->csvinfo['rows'])$this->csvinfo['shownrowscount']=$this->csvinfo['rows'];
-
-          $dataouts = array(); 
-          for($i =$begin; $i <= $end; $i++) {
-            if(is_array($this->csvinfo['sorteddata'][($i-1)])){
-              foreach($this->csvinfo['sorteddata'][($i-1)] as $dat){
-                $dataouts[]=$dat;
-              }
-            }
-          }
-        }
-        $tmparr2  = $this->csvinfo['colsstr'];
-        $tmparr2[]=_("status");
-
-        /* Error? */
-        if ($failing){
-          print_red(sprintf(_("An Error Occured while inserting entry %s - process aborted"), $failing));
-        }
-        $smarty->assign("error",$failing);
-
-        /* Set vars to smarty */
-        $smarty->assign("cols",count($tmparr2));
-        $smarty->assign("anz" ,$this->csvinfo['count']);
-        $smarty->assign("rows",$this->csvinfo['shownrowscount']);
-
-
-        $cnt = 0 ;
-        $tmp2 = $tmp3 = array();
-        if(is_array($dataouts))
-          foreach($dataouts as $tmp){
-            $tmp2[] = $tmp;
-            $cnt ++ ;
-            if($cnt >= count($tmparr2)){
-              $tmp3[] = $tmp2;
-              $tmp2= array();
-              $cnt = 0; 
-            }
-          }  
-        $smarty->assign("head",$tmparr2);
-        $smarty->assign("data",$tmp3);
-
-        /* Set other vars  */
-        $smarty->assign("i",1);
-        $smarty->assign("ie",0);
-        $smarty->assign("tplid",$this->csvinfo['tplid']);
-
-        $smarty->assign("pointsafter",$pointsafter);
-        $smarty->assign("pointsbefore",$pointsbefore);
-      } else {
-        /* Set Template ID */
-        $tplid = $_POST['tplid'];
-
-
-        $smarty->assign("tpl",$arrtemplates[$tplid]);
-        print_red (_("Nothing to import!"));
-      }
-
-      /* If theres a File uploaded */
-    } else {
-      /* Check if theres a file uploaded */
-      if(!empty($_FILES['userfile']['name'])){
-
-        $handle = NULL;
-
-        if((!isset($_FILES['userfile']['name']))||(!isset($_POST['fileup'])))
-        {
-          print_red(_("There is no file uploaded."));
-          $smarty->assign("LDIFError",TRUE);
-        }
-        elseif(!$_FILES['userfile']['size'] > 0 )
-        {
-          print_red(_("The specified file is empty."));
-          $smarty->assign("LDIFError",TRUE);
-        }
-        /* Is there a tmp file, which we can use ? */
-        elseif(!file_exists($_FILES['userfile']['tmp_name']))
-        {
-          print_red(_("There is no file uploaded."));
-          $smarty->assign("LDIFError",TRUE);
-        }
-        elseif(!$handle = @fopen($_FILES['userfile']['tmp_name'],"r"))
-        {
-          print_red(_("There is no file uploaded."));
-          $smarty->assign("LDIFError",TRUE);
-        }
-        else
-        {
-          $smarty->assign("fileup",TRUE);
-          $str = "";
-
-
-          /* Reading content */
-          while(!feof($handle)) {
-            $str .= fread($handle,1024);
-          }
-
-          $lines = split("\n",$str);
-          $anz  = 0;
-          $rest = 0;
-          $data = array();
-
-          /* check colum count */
-          if(is_array($lines))
-            foreach($lines as $line) {
-              /* continue if theres a comment */
-              if(substr(trim($line),0,1)=="#"){
-                continue;
-              }
-
-              $line= str_replace ("\t","",$line);
-              $cells  = split(",",$line )  ;
-
-              if(count($cells)> $anz ){
-                $anz = count($cells);
-              }
-            }
-
-          /* At least one entry */
-          if($anz >1) {
-
-            /* Generate array with outpu info  */
-            if(is_array($lines))
-              foreach($lines as $line) {
-                $rest = 0;
-                $cnt  = 0;
-
-                /* dont use comments or empty lines */
-                if((substr(trim($line),0,1)=="#")||(empty($line))){
-                  continue;
-                }
-
-                /* replace \t to , */
-                $line= str_replace ("\t"  ,"" ,$line);
-
-                /* get all elements  */
-                $cells  = split(",",$line )  ;
-
-                /* attach all elements to data array */
-                if(is_array($cells))
-                  foreach($cells as $cell) {
-                    if(!empty($cell)) {
-                      $cnt++; 
-                      $data[]=trim($cell);
-                    }
-                  }
-
-                /* cell count less than anz, attach some empty fields */
-                if(($cnt != $anz)&&(!empty($cnt))) {
-                  $rest = $anz - $cnt;
-                  for($i = 0 ; $i < $rest ; $i ++){
-                    $data[] = " ";
-                  }
-                }
-              }    
-
-            unset($this->csvinfo['sorteddata']);
-            unset($this->csvinfo['colsstr']);
-            unset($this->csvinfo['sorteddata']);
-
-            $this->csvinfo['cols']        = $anz;
-            $this->csvinfo['data']        = array();
-            $this->csvinfo['data']        = $data;
-            $this->csvinfo['count']       = count($this->csvinfo['data']);
-
-            if($this->csvinfo['count']> (6* $this->csvinfo['cols'])) {
-              /* only show 6 rows in ouptuttablei */
-              $datouttemp =  array_chunk($this->csvinfo['data'],(6* $this->csvinfo['cols']));
-              $this->csvinfo['dataout']=$datouttemp[0];
-              $this->csvinfo['shownrowscount'] = 6;
-            } else {
-              $this->csvinfo['shownrowscount'] = (count($this->csvinfo['data']))/$this->csvinfo['cols'];
-              $this->csvinfo['dataout']= $this->csvinfo['data'];  
-            }
-
-            $this->csvinfo['tplid']       = $_POST['template'];
-            $this->csvinfo['templatestr'] = $this->csvinfo['arrtemplates' ][$this->csvinfo['tplid']];
-            $this->csvinfo['count']       = count($this->csvinfo['data']);
-            $this->csvinfo['rows']        = (count($this->csvinfo['data'])/$anz);
-
-            $i =  0; 
-            $tmp = $tmp2= array();
-            if(is_array($this->csvinfo['dataout']))
-              foreach($this->csvinfo['dataout'] as $dat){
-                $tmp[]= $dat;
-                $i++;
-                if($i >=$this->csvinfo['cols']){
-                  $i = 0;
-                  $tmp2[] = $tmp;
-                  $tmp = array();
-                }
-
-              }
-
-            /* Set Templateid  */
-            $smarty->assign("tplid",$this->csvinfo['tplid']);
-
-            /* Set Template  */
-            $smarty->assign("tpl",$this->csvinfo['templatestr']);
-
-            /* Temp var 1 */
-            $smarty->assign("ia",1); 
-
-            /* Temp var 2 */
-            $smarty->assign("i",0); 
-
-            /* Num rows    */
-            $smarty->assign("rows",$this->csvinfo['shownrowscount']);
-
-
-            for($i  = 0 ; $i < $anz; $i ++)
-              $this->csvinfo['arr_selected'][]="0";
-
-            $smarty->assign("selectedattrs",$this->csvinfo['arr_selected']);
-
-            /* Entrie count5 */
-            $smarty->assign("anz",$this->csvinfo['cols']);                                                    
-
-            /* Array with data */
-            $smarty->assign("data",$tmp2);   
-
-            @fclose($handle);
-          } else {
-            $smarty->assign("tpl",$this->csvinfo['attr'][$_POST['template']]);
-            $smarty->assign("LDIFError",TRUE);
-            $smarty->assign("fileup",FALSE);
-            print_red(_("The selected file does not contain any CSV Data..."));  
-          }
-        }
-      }
-    }                                              
-
-    /* Show main page */
-    return ($smarty->fetch (get_template_path('contentcsv.tpl', TRUE)));
-  }
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/addons/ldapmanager/class_export.inc b/plugins/addons/ldapmanager/class_export.inc
deleted file mode 100644 (file)
index aa988a3..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-<?php
-
-class ldifexport extends plugin
-{
-  /* Definitions */
-  var $plHeadline= "CSV import";
-  var $plDescription= "This does something";
-
-  /* attribute list for save action */
-  var $attributes= array();
-  var $objectclasses= array();
-  var $view_logged = FALSE;
-
-  function ldifexport (&$config, $dn= NULL)
-  {
-    /* Include config object */
-    $this->config= &$config;
-    $this->ui = get_userinfo();
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* Log view */
-    if(!$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","all/".get_class($this),$this->dn);
-    }
-
-    /* Set government mode */
-    $smarty= get_smarty();
-
-    $smarty->assign("type",FALSE);
-    $smarty->assign("depselectivbb","");
-
-    // fill in old vars in the Export form
-    if((isset($_POST['single']))&&(isset($_POST['sfrmgetsingle']))){
-      $smarty->assign("single",$_POST['single']);
-      $smarty->assign("type","single");
-      $dn = $_POST['single'];
-    }
-    if((isset($_POST['selfull']))&&(isset($_POST['sfrmgetfull']))){
-      $smarty->assign("depselectfull",$_POST['selfull']);
-      $smarty->assign("type","full");
-      $dn = $_POST['selfull'];
-    } else {
-      $smarty->assign("depselectfull", "");
-    }
-    if((isset($_POST['selivbb']))&&(isset($_POST['sfrmgetivbb']))){
-      $smarty->assign("depselectivbb",$_POST['selivbb']);
-      $smarty->assign("type","ivbb");
-      $dn = $_POST['selivbb'];
-    } else {
-      $smarty->assign("depselectivbb", "");
-    }
-
-    // Set values for optionlist in form
-    $bases      = array();
-    $acl_bases  = $this->ui->get_module_departments("all");
-    foreach($this->config->idepartments as $base_dn => $name){
-      if(in_array_ics($base_dn,$acl_bases)){
-        $bases[$base_dn] = $name;
-      }
-    }
-    $smarty->assign("deplist", $bases);
-
-    // Get the LDAP link, to generate the Export
-    $ldap = $this->config->get_ldap_link();
-
-    if ($this->config->current['GOVERNMENTMODE'] == 'true'){
-      $smarty->assign ("govmode", "true");
-    } else {
-      $smarty->assign ("govmode", "false");
-    }
-
-    $smarty->assign("LDIFError",FALSE);
-
-    if(isset($dn))
-    {
-      if(!($ldap->dn_exists($dn) && $dn != "")){
-        $smarty->assign("LDIFError",TRUE);
-        print_red (_("Error while exporting the requested entries!"));
-      }
-    }
-
-    /* check alcs for given dn */
-    $acls ="";
-    if(isset($dn)){
-      $acls = $this->ui->get_permissions($dn,"all/all");
-    }
-    if((!preg_match("/r/",$acls)) && (isset($dn))){
-
-      /* Show error msg */      
-      print_red(sprintf(_("You are not allowed to export the given ldap entry (%s)"),@LDAP::fix($dn)));
-
-      /* Show main page */
-      $smarty->assign("LDIFError",TRUE);
-      $smarty->assign("para","");
-    }else{
-
-      // Export a single LDAP entry
-      if(isset($_POST['sfrmgetsingle']))
-      {
-        $smarty->assign("para","?ivbb=2&amp;dn=".base64_encode($_POST['single']));
-      }
-      elseif(isset($_POST['sfrmgetfull']))
-      {
-        $smarty->assign("para","?ivbb=3&amp;dn=".base64_encode($_POST['selfull']));
-      }
-      elseif(isset($_POST['sfrmgetivbb']))
-      {
-        $smarty->assign("para","?ivbb=4&amp;dn=".base64_encode($_POST['selivbb']));
-      }
-    }
-
-    /* Show main page */
-    return ($smarty->fetch (get_template_path('contentexport.tpl', TRUE)));
-  }
-}
-
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/addons/ldapmanager/class_exportxls.inc b/plugins/addons/ldapmanager/class_exportxls.inc
deleted file mode 100644 (file)
index 3331cba..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
-<?php
-
-
-class xlsexport extends plugin
-{
-  /* Definitions */
-  var $plHeadline= "XLS import";
-  var $plDescription= "This does something";
-  var $access= "";
-
-  /* attribute list for save action */
-  var $attributes= array();
-  var $objectclasses= array();
-  var $ui;
-  var $view_logged = FALSE;
-
-  function xlsexport (&$config, $dn= NULL)
-  {
-    /* Include config object */
-    $this->config= &$config;
-
-    $this->ui = get_userinfo();
-  }
-
-  function execute()
-  {
-       /* Call parent execute */
-       plugin::execute();
-
-    /* Log view */
-    if(!$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","all/".get_class($this),$this->dn);
-    }
-
-    $dn = $this->config->current['BASE'];
-
-    /* Set government mode */
-    $smarty= get_smarty();
-    $smarty->assign("type",FALSE);
-    $smarty->assign("depselectivbb","");
-    
-    if(!isset($_POST['selfull'])) $_POST['selfull'] = "Somehow not posted";
-
-    /* Check permissions for export */
-    // fill in old vars in the Export form
-    if((isset($_POST['single']))&&(isset($_POST['sfrmgetsingle']))){
-      $smarty->assign("single",$_POST['single']);
-      $smarty->assign("type","single");
-      $a=$_POST['single'];
-      $b=$_POST['selfull'];
-
-    }
-    if((isset($_POST['selfull']))&&(isset($_POST['sfrmgetfull']))){
-      $smarty->assign("depselectfull",$_POST['selfull']);
-      $smarty->assign("type","full");
-      $dn = $_POST['selfull'];
-    } else {
-      $smarty->assign("depselectfull", "");
-    }
-    if((isset($_POST['selivbb']))&&(isset($_POST['sfrmgetivbb']))){
-      $smarty->assign("depselectivbb",$_POST['selivbb']);
-      $smarty->assign("type","ivbb");
-      $dn = $_POST['selivbb'];
-    } else {
-      $smarty->assign("depselectivbb", "");
-    }
-
-    // Set values for optionlist in form
-    $bases      = array();
-    $acl_bases  = $this->ui->get_module_departments("all");
-    foreach($this->config->idepartments as $base_dn => $name){
-      if(in_array_ics($base_dn,$acl_bases)){
-        $bases[$base_dn] = $name;
-      }
-    }
-    $smarty->assign("deplist", $bases);
-    $smarty->assign("choicelist",array( get_people_ou()             =>"users" ,
-                                        "ou=groups,"                =>"groups" ,
-                                        "ou=systems,"               =>"computers",
-                                        "ou=servers,ou=systems,"    =>"servers",
-                                        "dc=addressbook,"           =>"addressbook"));
-
-    // Get the LDAP link, to generate the Export
-    $ldap = $this->config->get_ldap_link();
-
-    if ($this->config->current['GOVERNMENTMODE'] == 'true'){
-      $smarty->assign ("govmode", "true");
-    } else {
-      $smarty->assign ("govmode", "false");
-    }
-
-    $smarty->assign("LDIFError",FALSE);
-
-    if(isset($dn))
-    {
-      if(!($ldap->dn_exists($dn) && $dn != "")){
-        $smarty->assign("LDIFError",TRUE);
-       print_red (_("Error while exporting the requested entries!"));
-      }
-    }
-   
-    /* check alcs for given dn */
-    $acls ="";
-    if(isset($dn)){
-      $acls = $this->ui->get_permissions($dn,"all/all");
-    }
-    if(!preg_match("/r/",$acls) && (isset($_POST['sfrmgetsingle']) || isset($_POST['sfrmgetfull']) || isset($_POST['sfrmgetivbb']))){
-
-      /* Show error msg */      
-      print_red(sprintf(_("You are not allowed to export the given ldap entry (%s)"),@LDAP::fix($dn)));
-
-      /* Show main page */
-      $smarty->assign("LDIFError",TRUE);
-      $smarty->assign("para","");
-    }else{
-
-      // Export a single LDAP entry
-      if(isset($_POST['sfrmgetsingle']))
-      {
-        $smarty->assign("para","?ivbb=2&amp;d=".base64_encode($_POST['single'])."&n=".base64_encode($_POST['selfull']));       
-      }
-      elseif(isset($_POST['sfrmgetfull']))
-      {
-        $smarty->assign("para","?ivbb=3&amp;dn=".base64_encode($_POST['selfull']));
-      }
-      elseif(isset($_POST['sfrmgetivbb']))
-      {
-        $smarty->assign("para","?ivbb=4&amp;dn=".base64_encode($_POST['selivbb']));
-      }
-    }
-
-    /* Show main page */
-    return ($smarty->fetch (get_template_path('contentexportxls.tpl', TRUE)));
-  }
-
-}
-
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/addons/ldapmanager/class_import.inc b/plugins/addons/ldapmanager/class_import.inc
deleted file mode 100644 (file)
index 71edbb2..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-<?php
-
-class ldifimport extends plugin
-{
-  /* Definitions */
-  var $plHeadline= "LDIF export";
-  var $plDescription= "This does something";
-  var $access= "";
-
-  /* attribute list for save action */
-  var $attributes= array();
-  var $objectclasses= array();
-  var $ui;
-  var $view_logged = FALSE;
-
-  function ldifimport (&$config, $dn= NULL)
-  {
-    /* Include config object */
-    $this->config= &$config;
-
-    $this->ui = get_userinfo();
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* Log view */
-    if(!$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","all/".get_class($this),$this->dn);
-    }
-
-    /* Set government mode */
-    $smarty= get_smarty();
-
-    // Get the LDAP link, to generate the Export
-    $ldap = $this->config->get_ldap_link();
-
-    $smarty->assign("LDIFError",FALSE);
-    $smarty->assign("type",FALSE);
-
-    /* Get acls */
-    $acl = $this->ui->get_permissions($this->config->current['BASE'],"all/all");
-    
-    /* Import requested check file and acls */
-    if((isset($_FILES['userfile']['name']))&&(isset($_POST['fileup']))){
-
-      /* Check acls */
-      if(!preg_match("/w/",$acl)){
-        print_red(_("You need full access to all objects, to execute the import command."));
-      }else{
-
-        $smarty->assign("type","importfile");
-        $handle = NULL;
-
-        // Check if there is a file submitted
-        if(!$_FILES['userfile']['size'] > 0 )
-        {
-          print_red(_("The specified file is empty."));
-          $smarty->assign("LDIFError",TRUE);  
-        }
-
-        // Is there a tmp file, which we can use ?
-        elseif(!file_exists($_FILES['userfile']['tmp_name']))  
-        {
-          print_red(_("There is no file uploaded."));
-          $smarty->assign("LDIFError",TRUE);
-
-        }
-
-        // Can we open the tmp file, for reading
-        elseif(!$handle = @fopen($_FILES['userfile']['tmp_name'],"r"))
-        {
-          print_red(_("There is no file uploaded."));
-          $smarty->assign("LDIFError",TRUE);  
-        }
-        else
-        {
-          // Everything just fine :)
-          $str = ""; 
-
-          // Reading content 
-          while(!feof($handle))
-          {
-            $str .= fread($handle,1024);
-          }
-          @fclose($handle);
-
-          // Should we use Overwrite ?
-          if(!empty($_POST['overwrite'])) $overwrite = true; else $overwrite = false;;
-          if(!empty($_POST['cleanup']))   $cleanup   = true; else $cleanup = false;
-
-          $ErrorStr="";
-          $check = $ldap->import_complete_ldif($str,$ErrorStr,$overwrite,$cleanup);
-
-          if($check == INSERT_OK  )
-            $smarty->assign("LDIFError",FALSE);
-          else
-            $smarty->assign("LDIFError",TRUE);
-
-          switch($check)
-          {
-            case INSERT_OK : break;
-            case ALREADY_EXISTING_ENTRY      : print_red($ErrorStr); break;
-            case UNKNOWN_TOKEN_IN_LDIF_FILE  : print_red($ErrorStr);break;
-
-            default : print_red(_("Unknown Error"));break;
-          }
-        }
-      }
-    }
-    return ($smarty->fetch (get_template_path('contentimport.tpl', TRUE)));
-  }
-}
-
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/addons/ldapmanager/class_ldif.inc b/plugins/addons/ldapmanager/class_ldif.inc
deleted file mode 100644 (file)
index 3451f81..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-
-class ldif extends plugin
-{
-  /* Definitions */
-  var $plHeadline= "LDAP manager";
-  var $plDescription= "This does something";
-
-  /* attribute list for save action */
-  var $attributes= array();
-  var $objectclasses= array();
-  var $ldif;
-
-  function ldif (&$config)
-  {
-    /* Include config object */
-    $this->ldif= new ldiftab($config, $config->data['TABS']['LDIFTAB'], "");
-  }
-
-  function execute()
-  {
-       /* Call parent execute */
-       plugin::execute();
-
-    /* Show main page */
-    return ($this->ldif->execute());
-  }
-
-  /* Return plugin informations for acl handling
-     #FIXME You can only read attributes within this report plugin */
-  static function plInfo()
-  {
-    return (array(
-        "plShortName"   => _("Ldap manager"),
-        "plDescription" => "Dummy entry for menu creation functions, later",
-        "plSelfModify"  => FALSE,
-        "plDepends"     => array(),
-        "plPriority"    => 1,
-        "plSection"     => array("addon"),
-        "plCategory"    => array("ldapmanager" => array("objectClass" => "none", "description" => _("Ldap manager addon"))),
-
-        "plProvidedAcls" => array()
-        ));
-  }
-
-
-
-}
-
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/addons/ldapmanager/contentcsv.tpl b/plugins/addons/ldapmanager/contentcsv.tpl
deleted file mode 100644 (file)
index fbfdfef..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-<p>
-  {t}The CSV import plugin provides methods to generate user accounts from a file containing Comma Seperated Values. The administrator can decide which columns should be transfered to which attribute. Note that you must have at least the UID, GIVENNAME and SURENAME set.{/t}
-</p>
-<p class="seperator">&nbsp;</p>
-
-{if $fileup != TRUE}
-<table summary="">
-       <tr>
-               <td>
-                       <LABEL for="userfile">{t}Select CSV file to import{/t}</LABEL>
-               </td>
-               <td>
-               <input type="hidden" name="MAX_FILE_SIZE" value="2097152">
-               <input id="userfile" name="userfile" type="file" value="{t}Browse{/t}">
-               </td>
-       </tr>
-       <tr>
-               <td>
-               <LABEL for="template">{t}Select template{/t}</LABEL>
-               </td>
-               <td>
-               <select id="template" name="template" size="1" title="">
-                       {html_options options=$templates selected=""}   
-               </select>
-               </td>
-               
-       </tr>
-</table>
-{elseif $sorted != FALSE}
-
-
-<br>
-    {if $error == FALSE}
-        <b>{t}All entries have been written to the LDAP database successfully.{/t}</b>
-    {else}
-        <b style="color:red">{t}Oups. There was an error during the import of your data.{/t}</b>
-       {/if}
-
-<b>{t}Here is the status report for the import:{/t} </b>
-<br>
-<br>
-
-
-       <table summary="" cellspacing="1" border=0 cellpadding="4"  bgcolor="#FEFEFE">
-               <tr>
-                       {foreach from=$head item=h}
-                       <td bgcolor="#BBBBBB">
-                               <b>{$h}</b>
-                       </td>
-                       {/foreach}
-               </tr>
-               {if $pointsbefore == TRUE}
-               <tr>
-                       <td colspan={$i} bgcolor = "#EEEEEE">
-                               ...     
-                       </td>
-               </tr>
-               {/if}
-               
-               {foreach from=$data item=row key=key}   
-               <tr>
-                       {foreach from=$data[$key] item=col key=key2}
-                       <td bgcolor="#EEEEEE">
-                               {$data[$key][$key2]}
-                       </td>
-                       {/foreach}
-               </tr>
-               {/foreach}
-           {if $pointsafter == TRUE}
-           <tr>
-               <td colspan={$i} bgcolor = "#EEEEEE">
-               ...
-               </td>
-           </tr>
-           {/if}
-                                                                                                                                                  
-       </table>
-
-{else}
-<br><b>{t}Selected Template{/t}:</b> {$tpl}
-<br>
-<br>
-       <table summary="" cellspacing="1" border=0 cellpadding="4" bgcolor="#FEFEFE">
-               <tr>
-                       {foreach from=$data[0] item=item key=key}
-                       <td bgcolor="#BBBBBB">
-                               <select name="row{$key}" size="1" title="">
-                                {html_options options=$attrs selected=$selectedattrs[$key]}
-                               </select>
-                       </td>
-                       {/foreach}
-               </tr>
-               {foreach from=$data item=val key=key}
-               <tr>
-                       {foreach from=$data[$key] item=val2 key=key2}
-                       <td bgcolor="#EEEEEE">
-                               {$data[$key][$key2]}&nbsp;
-                       </td>
-                       {/foreach}
-               </tr>
-               {/foreach}
-               
-       </table>
-
-<!-- {html_table loop=$data cols=$anz table_attr='border="1"'}-->
-{/if}
-<p class="plugbottom">
-{if $fileup != TRUE}
-  <input type="submit" value="{t}Import{/t}" name="fileup" >
-{else}
-{if $sorted == FALSE}
-  <input name="sorted" value="{t}Import{/t}" type ="submit">
-{else}
-  <input type=submit name="back{$plug}" value="{t}Back{/t}">
-{/if}
-{/if}
-</p>
-<input type="hidden" name="ignore">
diff --git a/plugins/addons/ldapmanager/contentexport.tpl b/plugins/addons/ldapmanager/contentexport.tpl
deleted file mode 100644 (file)
index 5cd2301..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-{if $LDIFError != FALSE || $type == FALSE}
-<p style="margin-top:5px;">
-  {t}The LDIF export plugin provides methods to download a complete snapshot of the running LDAP directory as ldif. You may save these files for backup purpose or when initializing a new server.{/t}
-</p>
-<p class="seperator">&nbsp;</p>
-
-<table summary="" style="width:100%;">
-<tr>
-       <td width="30%">
-               <LABEL for="text" >{t}Export single entry{/t}</LABEL>
-       </td>
-       <td>
-               <input id="text" type="text" value="" name="single">
-       </td>
-       <td>
-               <input type="submit" value="{t}Export{/t}" name="sfrmgetsingle">
-       </td>
-</tr>
-<tr>
-       <td width="30%">
-               <LABEL for="selfull">{t}Export complete LDIF for{/t}</LABEL>
-       </td>
-       <td>
-               <select id="selfull" name="selfull" size="1" title="{t}Choose the department you want to Export{/t}">
-                       {html_options options=$deplist selected=0}
-               </select>
-       </td>
-       <td>
-               <input type="submit" value="{t}Export{/t}" name="sfrmgetfull">
-       </td>
-</tr>
-       
-{if $govmode eq "true"}
-<tr>
-       <td width="30%">
-               <LABEL for="selivbb">{t}Export IVBB LDIF for{/t}</LABEL>
-       </td>
-       <td>
-               <select id="selivbb" name="selivbb" size="1" title="{t}Choose the department you want to Export{/t}">
-                       {html_options options=$deplist selected=$depselectivbb}
-               </select>
-       </td>
-       <td>
-               <input type="submit" value="{t}Export{/t}" name="sfrmgetivbb">
-       </td>
-</tr>
-{/if}
-</table> 
-
-
-{else}
-
-
-<br>
-       <h1>{t}Export successful{/t}</h1>
-<br>
-       <div>
-               <img alt="" border="0" align=middle src="images/filesaveas.png">
-               <a href = "getldif.php{$para}" title="{t}Click here to save the complete LDAP database to a file{/t} ">{t}Click here to save the LDAP Export {/t}</a>
-
-
-               <br>
-               <br>
-       </div>
-       <div align="right">
-               <input type="submit" value="{t}Back{/t}" name='back'>
-       </div>
-{/if}
-<p class="plugbottom">
-  &nbsp;
-</p>
-
-<input type="hidden" name="ignore">
diff --git a/plugins/addons/ldapmanager/contentexportxls.tpl b/plugins/addons/ldapmanager/contentexportxls.tpl
deleted file mode 100644 (file)
index bb115c7..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-{if $LDIFError != FALSE || $type == FALSE}
-<p style="margin-top:5px;">
-  {t}The XLS export plugin provides methods to download a complete snapshot of the running LDAP directory as xls. You may save these files for documentation.{/t}
-</p>
-<p class="seperator">&nbsp;</p>
-
-<table summary="" style="width:100%;">
-<tr>
-       <td width="30%">
-               <LABEL for="single" >{t}Export single entry{/t}</LABEL>
-       </td>
-       <td>
-               {*<input id="text" type="text" value="" name="single">*}
-               <select id="single" name="single" size="1" title="{t}Choose the data you want to Export{/t}">
-                       {html_options options=$choicelist selected=0}
-               </select>
-       </td>
-       <td>
-               <input type="submit" value="{t}Export{/t}" name="sfrmgetsingle">
-       </td>
-</tr>
-<tr>
-       <td width="30%">
-               <LABEL for="selfull">{t}Export complete XLS for{/t}</LABEL>
-       </td>
-       <td>
-               <select id="selfull" name="selfull" size="1" title="{t}Choose the department you want to Export{/t}">
-                       {html_options options=$deplist selected=0}
-               </select>
-       </td>
-       <td>
-               <input type="submit" value="{t}Export{/t}" name="sfrmgetfull">
-       </td>
-</tr>
-       
-{if $govmode eq "true"}
-<tr>
-       <td width="30%">
-               <LABEL for="selivbb">{t}Export IVBB LDIF for{/t}</LABEL>
-       </td>
-       <td>
-               <select id="selivbb" name="selivbb" size="1" title="{t}Choose the department you want to Export{/t}">
-                       {html_options options=$deplist selected=$depselectivbb}
-               </select>
-       </td>
-       <td>
-               <input type="submit" value="{t}Export{/t}" name="sfrmgetivbb">
-       </td>
-</tr>
-{/if}
-</table> 
-
-
-{else}
-
-
-<br>
-       <h1>{t}Export successful{/t}</h1>
-<br>
-       <div>
-               <img alt="" border="0" align=middle src="images/filesaveas.png">
-               <a href = "getxls.php{$para}" title="{t}Click here to save the complete LDAP database to a xls file{/t} ">{t}Click here to save the LDAP Export to a xls file{/t}</a>
-
-
-               <br>
-               <br>
-       </div>
-       <div align="right">
-               <input type="submit" value="{t}Back{/t}" name='back'>
-       </div>
-{/if}
-<p class="plugbottom">
-  &nbsp;
-</p>
-
-<input type="hidden" name="ignore">
diff --git a/plugins/addons/ldapmanager/contentimport.tpl b/plugins/addons/ldapmanager/contentimport.tpl
deleted file mode 100644 (file)
index b7d5afc..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-{if $type == FALSE || $LDIFError != FALSE}
-<p style="margin-top:5px;">
-  {t}The LDIF import plugin provides methods to upload a set of entries to your running LDAP directory as ldif. You may use this to add new or modify existing entries. Remember that GOsa will not check your ldifs for GOsa conformance.{/t}
-</p>
-
-<p class="seperator">&nbsp;</p>
-<table summary="" width="100%">
-<tr>
-    <td width="180">
-               <LABEL for="userfile">{t}Import LDIF File{/t}</LABEL>
-    </td>
-    <td>
-                       <input type="hidden" name="ignore">
-                       <input type="hidden" name="MAX_FILE_SIZE" value="2097152">
-                       <input name="userfile" id="userfile" type="file" value="{t}Browse{/t}">
-    </td>
-</tr>
-<tr>
-       <td>
-               &nbsp;
-       </td>
-       <td>
-<!--        <input type="checkbox" name="overwrite" value="1" id="overwrite">-->
-               <input type="radio" name="overwrite" value="1" checked>{t}Modify existing objects, keep untouched attributes{/t}<br>
-               <input type="radio" name="overwrite" value="0">{t}Overwrite existing objects, all not listed attributes will be removed{/t}
-       </td>
-</tr>
-<tr>
-       <td>
-               &nbsp;
-       </td>
-       <td>
-        <input type="checkbox" name="cleanup" value="1" id="cleanup">
-               <LABEL for="cleanup">{t}Remove existing entries first{/t}</LABEL>
-       </td>
-</tr>
-</table>
-{else}
-
-<br>
-    <h1>{t}Import successful{/t}</h1>
-<br>
-
-<div align="right">
-               <input type="submit" value="{t}Back{/t}" name='back'>
-</div>
-               
-{/if}
-<p class="plugbottom">
-<input type="submit" value="{t}Import{/t}" name="fileup" >
-</p>
-<input type="hidden" name="ignore">
diff --git a/plugins/addons/ldapmanager/main.inc b/plugins/addons/ldapmanager/main.inc
deleted file mode 100644 (file)
index 696c14a..0000000
+++ /dev/null
@@ -1,39 +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
-*/
-
-if (!$remove_lock){
-       /* Create phonelist object on demand */
-       if (!isset($_SESSION['ldif']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
-               $_SESSION['ldif']= new ldif ($config);
-               $_SESSION['ldif']->set_acl_category("logview");
-       }
-       $ldif= $_SESSION['ldif'];
-
-       /* Execute formular */
-       $display= $ldif->execute ();
-       $display.= "<input type=\"hidden\" name=\"ignore\">\n";
-
-       /* Page header*/
-       $display= print_header(get_template_path('images/ldif.png'), _("LDAP manager")).$display;
-
-       /* Store changes  in session */
-       $_SESSION['ldif']= $ldif;
-}
-?>
diff --git a/plugins/addons/ldapmanager/tabs_ldif.inc b/plugins/addons/ldapmanager/tabs_ldif.inc
deleted file mode 100644 (file)
index 2f6b70f..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-
-class ldiftab extends tabs
-{
-
-  function ldiftab($config, $data, $dn)
-  {
-    tabs::tabs($config, $data, $dn);
-  }
-
-  function save_object($save_current= FALSE)
-  {
-    tabs::save_object($save_current);
-  }
-
-
-  function save($ignore_account= FALSE)
-  {
-  }
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/addons/logview/class_gosa_logview.inc b/plugins/addons/logview/class_gosa_logview.inc
deleted file mode 100644 (file)
index 87d234a..0000000
+++ /dev/null
@@ -1,398 +0,0 @@
-<?php
-
-class gosa_logview extends plugin
-{
-  /* Definitions */
-  var $plHeadline= "System logs";
-  var $plDescription= "This does something";
-
-  /* attribute list for save action */
-  var $attributes     = array();
-  var $objectclasses  = array();
-
-  var $server         = "";
-  var $action         = "modify";
-  var $time           = 2;
-  var $regex          = "*";
-
-  var $start  = 0;
-  var $sort   = 1;
-
-  var $sort_direction = "down";
-  var $fields         = array("action","timestamp","user","objecttype","object","result","repeated");
-  var $range          = 25;
-  var $view_logged    = FALSE;
-
-  var $timezone_offset  = 0;
-
-  var $uid_map = array();
-  
-
-  function gosa_logview (&$config, $dn= NULL)
-  {
-    /* Include config object */
-    $this->config= &$config;
-    $this->ui = get_userinfo();
-
-    /* Restore last filter settings */
-    foreach(array("action","server","time","regex") as $attr){
-      if(isset($_SESSION['logview']['gosa_log'][$attr])){
-        $this->$attr = $_SESSION['logview']['gosa_log'][$attr];
-      }
-    }
-
-    $tz = get_default_timezone();
-    $this->timezone_offset = $tz['value'] * 60 * 60 ;
-
-    $ldap = $this->config->get_ldap_link();
-    $ldap->search("(&(objectClass=person)(uid=*))",array("uid","dn"));
-    while($attrs = $ldap->fetch()){
-      $this->uid_map[$attrs['dn']] = $attrs['uid'][0];
-    }
-  }
-
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* Log view */
-    if(!$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","logview/".get_class($this),$this->dn);
-    }
-
-    /* Time interval */
-    $date_select = array(
-        "0" => _("one hour"), "1" => _("6 hours"),
-        "2" => _("12 hours"), "3" => _("24 hours"),
-        "4" => _("2 days"),   "5" => _("one week"),
-        "6" => _("2 weeks"),  "7" => _("one month"));
-
-
-    $time = time();
-    $date_select_ = array(
-        "0" => $time - 3600, 
-        "1" => $time - 21600,
-        "2" => $time - 43200,
-        "3" => $time - 86400,
-        "4" => $time - 172800,
-        "5" => $time - 604800,
-        "6" => $time - 1209600,
-        "7" => $time - 2419200);
-
-    $smarty= get_smarty();
-    $smarty->assign("search_result", "");
-    $smarty->assign("plug", "?plug=".validate($_GET['plug']));
-    $smarty->assign("search_image", get_template_path('images/search.png'));
-    $smarty->assign("time_image", get_template_path('images/time.png'));
-    $smarty->assign("server_image", get_template_path('images/server.png'));
-    $smarty->assign("log_image", get_template_path('images/log_warning.png'));
-    $smarty->assign("ruleset_image", get_template_path('images/edit.png'));
-    $smarty->assign("launchimage", get_template_path('images/launch.png'));
-    $smarty->assign("date_select", $date_select);
-    $smarty->assign("actions", array());
-    $smarty->assign("direction", "up");
-    $smarty->assign("mode0", "");
-    $smarty->assign("mode1", "");
-    $smarty->assign("mode2", "");
-    $smarty->assign("mode3", "");
-    $smarty->assign("mode4", "");
-    $smarty->assign("mode5", "");
-    $smarty->assign("mode6", "");
-
-    /* Assign select option content */
-    foreach( array("server", "action", "time", "regex") as $type){
-      $smarty->assign("$type", $this->$type);
-    }
-
-    /**** 
-     * Check if defined servers 
-     *  and mysql extension 
-     ****/
-    if (!isset($this->config->data['SERVERS']['LOGGING']) || !count($this->config->data['SERVERS']['LOGGING'])){
-      print_red (_("No GOsa LOG servers defined!"));
-      return ($smarty->fetch (get_template_path('gosa_log_contents.tpl', TRUE)));
-    }
-    
-    if(!is_callable("mysql_connect")){
-      print_red(_("There is no mysql extension available, please check your php setup."));
-      return ($smarty->fetch (get_template_path('gosa_log_contents.tpl', TRUE)));
-    }
-
-    /****
-     * Get Configurations 
-     ****/
-    $list_of_servers = $this->config->data['SERVERS']['LOGGING']; 
-    $servers         = array();
-    foreach($list_of_servers as $servername => $data){
-      $servers[$servername] = $servername;
-    }
-    $smarty->assign("servers", $servers);
-    
-    /* Set a default server, if there is currently no valid server selected */
-    if(empty($this->server) || !in_array($this->server,$servers)){
-      $this->server = key($servers);
-    }
-   
-    /**** 
-     * Connect to currently selected server 
-     ****/
-    $cfg = $list_of_servers[$this->server];
-    $link = @mysql_pconnect($this->server, $cfg['USER'], $cfg['PWD']);
-    if ($link === FALSE){
-      print_red(_("Can't connect to log database, no logs can be shown!"));
-      new log("debug","logview","",array(),@mysql_error());
-      return ($smarty->fetch (get_template_path('gosa_log_contents.tpl', TRUE)));
-    }
-
-    /* check of log database is available */
-    if (! @mysql_select_db($cfg['DB'])){
-      print_red(_("Can't select log database for log generation!"));
-      new log("debug","logview","",array(),@mysql_error());
-      return ($smarty->fetch (get_template_path('gosa_log_contents.tpl', TRUE)));
-    }
-
-    
-    /****
-     * Get all action types 
-     ****/
-
-    $actions = array("!ALL" => _("All"));
-    $query = "SELECT distinct(action) FROM gosa_log;";
-    $res = @mysql_query($query);
-    while($attrs = @mysql_fetch_assoc($res)){
-      $actions[$attrs['action']] = $attrs['action'];
-    } 
-
-
-    /****
-     * Check Acls 
-     ****/
-
-    $ui = get_userinfo();
-    $dn = $list_of_servers[$this->server]['DN'];
-    $acls = $ui->get_permissions($dn,"server/gosaLogServer","viewEntries");
-    
-    if(!preg_match("/r/",$acls)){
-      $res = "<tr>
-        <td colspan=".count($this->fields).">
-        "._("You have insufficient permissions to view syslog entries.")."
-        </td>
-        </tr>";
-
-      /* Show main page */
-      $smarty->assign("range_selector", "");
-      $smarty->assign("search_result", $res);
-      return ($smarty->fetch (get_template_path('gosa_log_contents.tpl', TRUE)));
-    }
-
-
-    /****
-     * Query stuff 
-     ****/
-    $res= "";
-    $cfg    = $list_of_servers[$this->server];
-    $link   = @mysql_pconnect($this->server, $cfg['USER'], $cfg['PWD']);
-
-    /* Test connection object && create up query string */
-    if ($link === FALSE){
-      print_red(_("Can't connect to log database, no logs can be shown!"));
-      new log("debug","logview","",array(),@mysql_error());
-    } else {
-
-      if (! @mysql_select_db($cfg['DB'])){
-        print_red(_("Can't select log database for log generation!"));
-        new log("debug","logview","",array(),@mysql_error());
-      } else {
-
-        /* Prepare order setting */
-        if ($this->sort_direction == "down"){
-          $desc= "DESC";
-          $sort_sign = "<img src='images/sort_down.png' alt='\/' class='center' title='down' border=0>";
-        } else {
-          $desc= "";
-          $sort_sign = "<img src='images/sort_up.png' alt='/\' class='center' title='up' border=0>";
-        }
-
-        /* Get start time */
-        $start = $date_select_[$this->time];
-        
-        /* Prepare search filter */
-        $sql_regex =trim(preg_replace("/\*/","%",$this->regex));
-        $sql_regex = "%".trim($sql_regex,"%")."%";
-
-        /* Create search filter */
-        $query_base= "FROM  gosa_log WHERE timestamp >= $start ";
-  
-        /* Append action filter */
-        if($this->action != "!ALL"){
-          $query_base .=" AND action like '".$this->action."' ";
-        }
-
-        /* Append search filter */
-        if($sql_regex != "%%"){
-          $query_base .=" AND ( result like '".$sql_regex."' OR user like '".$sql_regex."') ";
-        }
-
-        /* Get number of entries */
-        $query= "SELECT COUNT(`user`) ".$query_base.";";
-        $result = mysql_query($query);
-        if(!$result){
-          new log("debug","logview","",array(),@mysql_error());
-        }
-        $line= mysql_fetch_array($result, MYSQL_ASSOC);
-        $count= $line['COUNT(`user`)'];
-        if ($count > 25){
-          $smarty->assign("range_selector", range_selector($count, $this->start, $this->range,"EntriesPerPage"));
-        } else {
-          $smarty->assign("range_selector", "");
-        }
-
-        /* Query results that will be displayed */
-        $query= "SELECT * ".$query_base." ORDER BY ".$this->fields[$this->sort]." ".$desc." LIMIT  ".$this->start.",".$this->range.";";
-        @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__, $query, "Database query");
-        $result = @mysql_query($query);
-        if(!$result){
-          new log("debug","logview","",array(),@mysql_error());
-        }
-
-        /* Display results */
-        $mod= 0;
-
-        /* Add entries to result str */
-        while ($line = mysql_fetch_array($result, MYSQL_ASSOC)){
-
-          /* Toggle background color */
-          if ( ($mod++) & 1){
-            $col= "background-color: #ECECEC;";
-          } else {
-            $col= "background-color: #F5F5F5;";
-          }
-
-          $base = ", ".substr($this->config->current['BASE'],0,5)."...";
-  
-          if(isset($this->uid_map[$line['user']])){
-            $user = $this->uid_map[$line['user']];
-          }else{
-            $user = preg_replace("/,".normalizePreg($this->config->current['BASE'])."/",$base,$line['user']);
-          }
-          $object = preg_replace("/,".normalizePreg($this->config->current['BASE'])."/",$base,$line['object']);
-
-          $res.=" <tr style=\"$col\">\n";
-          $res.="   <td title='".$line['objecttype']."'>".$line['action']."</td>";
-          $res.="   <td>".date("H:i:s d.m.Y",($line['timestamp'] + $this->timezone_offset))."</td>";
-          $res.="   <td title='".$line['user']."'>".preg_replace("/,/",", ",$user)."</td>"; 
-          $res.="   <td title='".$line['objecttype']."'>".$line['objecttype']."</td>"; 
-          $res.="   <td title='".$line['object']."'>".preg_replace("/,/",", ",$object)."</td>"; 
-          $res.="   <td>".$line['result']."</td>";
-#         if($line['repeated'] == 1){
-#           $res.="   <td>-</td>";
-#         }else{
-#           $res.="   <td>".($line['repeated']-1)."</td>";
-#         }
-          $res.=" </tr>\n";
-        }
-        mysql_close($link);
-        $smarty->assign("mode".$this->sort, $sort_sign);
-        $smarty->assign("search_result", $res);
-      }
-    }
-
-    $smarty->assign("regex", $this->regex);
-    $smarty->assign("server",$this->server);
-    $smarty->assign("servers",$servers);
-    $smarty->assign("action",$this->action);
-    $smarty->assign("actions",$actions);
-    $smarty->assign("date_select", $date_select);
-
-    $smarty->assign("direction", $this->sort_direction);
-
-    /* Show main page */
-    return ($smarty->fetch (get_template_path('gosa_log_contents.tpl', TRUE)));
-  }
-
-
-  function save_object()
-  {
-    if(isset($_POST['gosa_log_contents_posted'])){
-
-      /* Get submitted range */        
-      if(isset($_POST['EntriesPerPage'])){
-        if(is_numeric($_POST['EntriesPerPage'])){
-          $this->range = $_POST['EntriesPerPage'];
-        }
-      }
-
-      /* Get actual select boxe values */
-      $logfilter_changed = FALSE;
-      foreach( array("server", "action","time","regex") as $type){
-        if(isset($_POST[$type])){
-          $this->$type = $_POST[$type];   
-        }
-      }
-
-      /* Filter regex values */
-      if ($this->regex == ""){
-        $this->regex= '*';
-      } else {
-        $new = preg_replace('/\*\**/', '*', $this->regex);
-        $this->regex= $new;
-      }
-
-      /* Set start value */
-      if (isset($_GET['start'])){
-        $this->start= (int)$_GET['start'];
-      }
-
-      /* Reset page number if filter has changed */
-      if ($logfilter_changed > 0){
-        $this->start= 0;
-      }
-
-      /* Adapt sorting */
-      if (isset($_GET['sort'])){
-
-        if($_GET['direction'] == "up"){
-          $this->sort_direction = "down";
-        }else{
-          $this->sort_direction = "up";
-        }
-
-        $this->sort= (int)$_GET['sort'];
-        if ($this->sort < 0 || $this->sort > count($this->fields)){
-          $this->sort= 0;
-        }
-      }
-
-      /* Save attributes in Sessiob, so we are able to recontruct filter on plugin reload */
-      $_SESSION['logview']['gosa_log'] = array();
-      foreach(array("action","server","time","regex") as $attr){
-        $_SESSION['logview']['gosa_log'][$attr] = $this->$attr;
-      }
-
-    }
-  }
-
-
-  /* Return plugin informations for acl handling
-     #FIXME You can only read attributes within this report plugin 
-  static function plInfo()
-  {
-    return (array(
-        "plShortName"   => _("Log view"),
-        "plDescription" => _("Log view addon"),
-        "plSelfModify"  => FALSE,
-        "plDepends"     => array(),
-        "plPriority"    => 0,
-        "plSection"     => array("addon"),
-        "plCategory"    => array("logview" => array("objectClass" => "none", "description" => _("System logs"))),
-
-        "plProvidedAcls" => array()
-        ));
-  }
-  */
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/addons/logview/class_logview.inc b/plugins/addons/logview/class_logview.inc
deleted file mode 100644 (file)
index 8716ee7..0000000
+++ /dev/null
@@ -1,415 +0,0 @@
-<?php
-
-class logview extends plugin
-{
-  /* Definitions */
-  var $plHeadline= "System logs";
-  var $plDescription= "This does something";
-
-  /* attribute list for save action */
-  var $attributes= array();
-  var $objectclasses= array();
-  var $start= 0;
-  var $sort= 2;
-  var $sort_direction= "down";
-  var $hostlist= array();
-  var $loglevellist= array();
-  var $tilist= array();
-  var $fields= array("log_level", "host", "time_stamp", "message");
-  var $last= array("log_level", "host", "time", "regex");
-  var $range = 25;
-  var $view_logged = FALSE;
-
-  function logview (&$config, $dn= NULL)
-  {
-    /* Include config object */
-    $this->config= &$config;
-
-    /* Get global filter config */
-    if (!is_global("logfilter")){
-      $logfilter= array(
-          "time" => "1",
-          "log_level" => "!All",
-          "host" => "!All",
-          "regex" => "*");
-
-      register_global("logfilter", $logfilter);
-    }
-
-    $this->ui = get_userinfo();
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* Log view */
-    if(!$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","logview/".get_class($this),$this->dn);
-    }
-
-    $logfilter= get_global("logfilter");
-    $smarty= get_smarty();
-    $smarty->assign("search_result", "");
-    $smarty->assign("plug", "?plug=".validate($_GET['plug']));
-    $smarty->assign("search_image", get_template_path('images/search.png'));
-    $smarty->assign("time_image", get_template_path('images/time.png'));
-    $smarty->assign("server_image", get_template_path('images/server.png'));
-    $smarty->assign("log_image", get_template_path('images/log_warning.png'));
-    $smarty->assign("ruleset_image", get_template_path('images/edit.png'));
-    $smarty->assign("launchimage", get_template_path('images/launch.png'));
-    $smarty->assign("hostlist", $this->hostlist);
-    $smarty->assign("loglevellist", $this->loglevellist);
-    $smarty->assign("tilist", $this->tilist);
-    $smarty->assign("mode0", "");
-    $smarty->assign("mode1", "");
-    $smarty->assign("mode2", "");
-    $smarty->assign("mode3", "");
-
-    /* Assign select option content */
-    foreach( array("host", "log_level", "time", "regex") as $type){
-      $smarty->assign("$type", $logfilter[$type]);
-    }
-
-    /* Test connection to log database */
-    if (!isset($this->config->data['SERVERS']['LOG'])){
-      print_red (_("No LOG servers defined!"));
-      return ($smarty->fetch (get_template_path('contents.tpl', TRUE)));
-
-    }elseif(!is_callable("mysql_connect")){
-      print_red(_("There is no mysql extension available, please check your php setup."));
-      return ($smarty->fetch (get_template_path('contents.tpl', TRUE)));
-
-    }else{
-
-      /* Cehck connection informations */      
-      $cfg= $this->config->data['SERVERS']['LOG'];
-
-      /* Open link to database  and check if it is valid */    
-      $link = @mysql_pconnect($cfg['SERVER'], $cfg['LOGIN'], $cfg['PASSWORD']);
-      if ($link === FALSE){
-        print_red(_("Can't connect to log database, no logs can be shown!"));
-        new log("debug","logview","",array(),@mysql_error());
-        return ($smarty->fetch (get_template_path('contents.tpl', TRUE)));
-      }
-
-      /* check of log database is available */
-      if (! @mysql_select_db("gomon")){
-        print_red(_("Can't select log database for log generation!"));
-        new log("debug","logview","",array(),@mysql_error());
-        return ($smarty->fetch (get_template_path('contents.tpl', TRUE)));
-      }
-
-      /* Get Host list, if still empty */
-      if(count($this->hostlist) == 0){
-
-        /* Query database and check results */
-        $query= "SELECT DISTINCT host FROM golog LIMIT 200;";
-        @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__, $query, "Database query");
-        $result = @mysql_query($query);
-        if ($result === false){
-          print_red(_("Query for log database failed!. Requesting host names failed."));
-          new log("debug","logview","",array(),@mysql_error());
-          return ($smarty->fetch (get_template_path('contents.tpl', TRUE)));
-        }
-
-        /* Add hostnames to list */    
-        while ($line = mysql_fetch_array($result, MYSQL_ASSOC)){
-          $this->hostlist[$line['host']]= $line['host'];
-        }
-        $this->hostlist['!All']= _("All");
-        ksort($this->hostlist);
-        $smarty->assign("hostlist", $this->hostlist);
-      }
-
-      /* Get log level list */
-      if(count($this->loglevellist) == 0){
-
-        /* Try to get all used log level types */
-        $query= "SELECT DISTINCT log_level FROM golog LIMIT 200;";
-        @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__, $query, "Database query");
-        $result = @mysql_query($query);
-        if ($result === false){
-          new log("debug","logview","",array(),@mysql_error());
-          print_red(_("Query for log database failed!"));
-          return ($smarty->fetch (get_template_path('contents.tpl', TRUE)));
-        }
-
-        /* Add each etry to log level list */
-        while ($line = mysql_fetch_array($result, MYSQL_ASSOC)){
-          $this->loglevellist[$line['log_level']]= $line['log_level'];
-        }
-        $this->loglevellist['!All']= _("All");
-        ksort($this->loglevellist);
-        $smarty->assign("loglevellist", $this->loglevellist);
-      }
-    }
-
-    /* Set list of available time sequences */
-    if(count($this->tilist) == 0){
-
-      /* Time interval */
-      $this->tilist= array("0" => _("one hour"), "1" => _("6 hours"),
-          "2" => _("12 hours"), "3" => _("24 hours"),
-          "4" => _("2 days"), "5" => _("one week"),
-          "6" => _("2 weeks"), "7" => _("one month"));
-      $smarty->assign("tilist", $this->tilist);
-    }
-
-    $smarty->assign("regex", $logfilter['regex']);
-
-
-    /* Get acls */
-    
-    $tmp_cat_bases = $this->ui->get_module_departments("logview");
-    $all_acls = "";
-    foreach($tmp_cat_bases as $acl_base){
-      $all_acls .= $this->ui->get_permissions($acl_base,"logview/logview");
-    }
-    if(count($tmp_cat_bases) == 0 || !preg_match("/r/",$all_acls)){
-      $res = "<tr>
-        <td colspan=4>
-        "._("You have insufficient permissions to view syslog entries.")."
-        </td>
-        </tr>";
-
-      /* Show main page */
-      $smarty->assign("range_selector", "");
-      $smarty->assign("search_result", $res);
-      return ($smarty->fetch (get_template_path('contents.tpl', TRUE)));
-    }
-
-    /* Query stuff */
-    $res= "";
-    $cfg    = $this->config->data['SERVERS']['LOG'];
-    $tmp    = set_error_handler('dummy_error_handler');
-    $link   = @mysql_pconnect($cfg['SERVER'], $cfg['LOGIN'], $cfg['PASSWORD']);
-    set_error_handler($tmp);
-
-    /* Test connection object && create up query string */
-    if ($link === FALSE){
-      print_red(_("Can't connect to log database, no logs can be shown!"));
-      new log("debug","logview","",array(),@mysql_error());
-    } else {
-      if (! @mysql_select_db("gomon")){
-        print_red(_("Can't select log database for log generation!"));
-        new log("debug","logview","",array(),@mysql_error());
-      } else {
-
-        /* Assemble time query */
-        switch ($logfilter['time']){
-          case '0':
-            $start= date ("YmdHis", time() - 3600);
-            break;
-            ;;
-          case '1':
-            $start= date ("YmdHis", time() - 21600);
-            break;
-            ;;
-          case '2':
-            $start= date ("YmdHis", time() - 43200);
-            break;
-            ;;
-          case '3':
-            $start= date ("YmdHis", time() - 86400);
-            break;
-            ;;
-          case '4':
-            $start= date ("YmdHis", time() - 172800);
-            break;
-            ;;
-          case '5':
-            $start= date ("YmdHis", time() - 604800);
-            break;
-            ;;
-          case '6':
-            $start= date ("YmdHis", time() - 1209600);
-            break;
-            ;;
-          case '7':
-            $start= date ("YmdHis", time() - 2419200);
-            break;
-            ;;
-        }
-
-        /* Assemble log level query */
-        if ($logfilter['log_level'] == '!All'){
-          $ll= "";
-        } else {
-          $ll= "AND log_level='".$logfilter['log_level']."'";
-        }
-        if ($logfilter['host'] == '!All'){
-          $hf= "";
-        } else {
-          $hf= "AND host='".$logfilter['host']."'";
-        }
-
-        /* Order setting */
-        if ($this->sort_direction == "down"){
-          $desc= "DESC";
-          $sort_sign = "\\/";
-        } else {
-          $desc= "";
-          $sort_sign="/\\";
-        }
-        $end= date ("YmdHis");
-        $query_base= "  FROM 
-          golog 
-          WHERE 
-          message like '".preg_replace("/\*/","%",$logfilter['regex'])."' 
-          $ll 
-          $hf 
-          AND 
-          time_stamp <= $end AND time_stamp >= $start";
-
-        /* Get number of entries */
-        $query= "SELECT COUNT(*)".$query_base.";";
-        $result = @mysql_query($query);
-        if(!$result){
-          new log("debug","logview","",array(),@mysql_error());
-        }
-        $line= mysql_fetch_array($result, MYSQL_ASSOC);
-        $count= $line['COUNT(*)'];
-        if ($count > 25){
-          $smarty->assign("range_selector", range_selector($count, $this->start, $this->range,"EntriesPerPage"));
-        } else {
-          $smarty->assign("range_selector", "");
-        }
-
-        /* Query results */
-        $query= "SELECT *".$query_base." ORDER BY ".$this->fields[$this->sort]." $desc LIMIT ".$this->start.",".$this->range.";";
-        @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__, $query, "Database query");
-        $result = @mysql_query($query);
-        if(!$result){
-          new log("debug","logview","",array(),@mysql_error());
-        }
-        /* Display results */
-        $mod= 0;
-
-        /* Add entries to result str */
-        while ($line = mysql_fetch_array($result, MYSQL_ASSOC)){
-
-          /* Toggle background color */
-          if ( ($mod++) & 1){
-            $col= "background-color: #ECECEC;";
-          } else {
-            $col= "background-color: #F5F5F5;";
-          }
-
-          $res.=" <tr style=\"$col\">\n";
-          $res.="   <td style=\"text-align:center\">
-            <img alt=\"".$line['log_level']."\" 
-            src=\"".get_template_path('images/log_'.strtolower($line['log_level'])).".png\" 
-            title=\"Log level is '".$line['log_level']."'\">
-            </td>";
-          $res.="   <td>".
-            $line['host']."
-            </td>"; 
-            $res.=" <td>".
-            $line['time_stamp']."
-            </td>";
-          $res .= "<td width=\"100%\">".
-            $line['message']."
-            </td>";
-          $res.=" </tr>\n";
-        }
-        mysql_close($link);
-        $smarty->assign("mode".$this->sort, $sort_sign);
-        $smarty->assign("host", $logfilter['host']);
-        $smarty->assign("log_level", $logfilter['log_level']);
-
-        $smarty->assign("search_result", $res);
-      }
-    }
-
-    /* Show main page */
-    return ($smarty->fetch (get_template_path('contents.tpl', TRUE)));
-  }
-
-
-  function save_object()
-  {
-    /* Get submitted range */  
-    if(isset($_POST['EntriesPerPage'])){
-      if(is_numeric($_POST['EntriesPerPage'])){
-        $this->range = $_POST['EntriesPerPage'];
-      }
-    }
-
-    /* Save data */
-    $logfilter= get_global("logfilter");
-
-    /* Get actual select boxe values */
-    $logfilter_changed = 0;
-    foreach( array("host", "time", "log_level", "regex") as $type){
-    
-      /* Set new value and test if value has changed */
-      $last[$type] = $logfilter[$type];
-      if (isset($_POST[$type])){
-        $logfilter[$type]= $_POST[$type];
-      }
-  
-      if ($last[$type] != $logfilter[$type]){
-        $logfilter_changed = 1;
-      }
-    }
-
-    /* Filter regex values */
-    if ($logfilter['regex'] == ""){
-      $logfilter['regex']= '%';
-    } else {
-      $new = preg_replace('/\*\**/', '*', $logfilter['regex']);
-      $logfilter['regex']= $new;
-    }
-
-    /* Store filter values */
-    register_global("logfilter", $logfilter);
-
-    /* Set start value */
-    if (isset($_GET['start'])){
-      $this->start= (int)$_GET['start'];
-    }
-  
-    /* Reset page number if filter has changed */
-    if ($logfilter_changed > 0){
-      $this->start= 0;
-    }
-
-    /* Adapt sorting */
-    if (isset($_GET['sort'])){
-      if ($this->sort == (int)$_GET['sort']){
-        if ($this->sort_direction == "down"){
-          $this->sort_direction= "up";
-        } else {
-          $this->sort_direction= "down";
-        }
-      }
-      $this->sort= (int)$_GET['sort'];
-      if ($this->sort < 0 || $this->sort > 3){
-        $this->sort= 0;
-      }
-    }
-  }
-
-
-  /* Return plugin informations for acl handling
-     #FIXME You can only read attributes within this report plugin */
-  static function plInfo()
-  {
-    return (array(
-        "plShortName"   => _("Log view"),
-        "plDescription" => _("Log view addon"),
-        "plSelfModify"  => FALSE,
-        "plDepends"     => array(),
-        "plPriority"    => 0,
-        "plSection"     => array("addon"),
-        "plCategory"    => array("logview" => array("objectClass" => "none", "description" => _("System logs"))),
-
-        "plProvidedAcls" => array()
-        ));
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/addons/logview/contents.tpl b/plugins/addons/logview/contents.tpl
deleted file mode 100644 (file)
index 9a03544..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-<div class="contentboxh">
- <p class="contentboxh"><img src="{$launchimage}" align="right" alt="[F]">{t}Filter{/t}</p>
-</div>
-<div class="contentboxb">
-
- <table summary="" width="100%" class="contentboxb" style="border-top:1px solid #B0B0B0; padding:0px;">
-  <tr>
-   <td width="33%">
-    <table summary="">
-     <tr>
-      <td><img class="center" alt="" align="middle" border=0 src="{$server_image}">&nbsp;<LABEL FOR="host">{t}Show hosts{/t}</LABEL></td>
-      <td>
-       <select id="host" name="host" size=1 onChange="mainform.submit()">
-                      {html_options options=$hostlist selected=$host}
-                          <option disabled>&nbsp; </option>
-       </select>
-      </td>
-     </tr>
-     <tr>
-      <td><img class="center" alt="" align="middle" border=0 src="{$log_image}">&nbsp;<LABEL for="log_level">{t}Log level{/t}</label></td>
-      <td>
-       <select id="log_level" name="log_level" size=1 onChange="mainform.submit()">
-               {html_options options=$loglevellist selected=$log_level}
-            <option disabled>&nbsp;</option>
-       </select>
-      </td>
-     </tr>
-    </table>
-   </td>
-   
-   <td style="border-left:1px solid #A0A0A0">
-    &nbsp;
-   </td>
-   
-   <td width="33%">
-    <table summary="">
-     <tr>
-      <td><img class="center" alt="" align="middle" border=0 src="{$time_image}">&nbsp;<LABEL for="time" >{t}Time interval{/t}</LABEL></td>
-      <td>
-       <select id="time" name="time" size=1 onChange="mainform.submit()">
-               {html_options options=$tilist selected=$time}
-            <option disabled>&nbsp;</option>
-       </select>
-      </td>
-     </tr>
-     <tr>
-      <td><img class="center" alt="" align="middle" border=0 src="{$search_image}">&nbsp;<LABEL for="regex">{t}Search for{/t}</LABEL></td>
-      <td><input id="regex" name="regex" size=25 maxlength=60 value="{$regex}" title="{t}Enter string to search for{/t}"></td>
-     </tr>
-    </table>
-   </td>
-
-   <td style="border-left:1px solid #A0A0A0">
-    &nbsp;
-   </td>
-   <td>
-    <table summary="" width="100%">
-  <!-- 
-     <tr>
-      <td><img class="center" alt="" align="middle" border=0 src="{$ruleset_image}">&nbsp;<LABEL for="edit_rules">{t}Ruleset{/t}</LABEL></td>
-      <td width="100%">
-       <input id="edit_rules" name="edit_rules" type="submit" value="{t}Edit{/t}" disabled>
-      </td>
-     </tr>
--->
-     <tr>
-      <td colspan=2 style="text-align:right;">
-       <input name="search" type="submit" value="{t}Search{/t}">
-      </td>
-     </tr>
-    </table>
-   </td>
-  </tr>
- </table>
-</div>
-
-<br>
-
-{if $search_result ne ""}
- <table summary="" style="width:100%; vertical-align:top; text-align:left; border:1px solid #B0B0B0;" cellpadding=2 cellspacing=1 rules="cols">
-  <tr style="background-color: #E8E8E8; height:26px; font-weight:bold">
-   <td><a href=main.php{$plug}&amp;sort=0>{t}Level{/t} {$mode0}</a></td>
-   <td><a href=main.php{$plug}&amp;sort=1>{t}Hostname{/t} {$mode1}</a></td>
-   <td width=15%><a href=main.php{$plug}&amp;sort=2>{t}Date{/t} {$mode2}</a></td>
-   <td><a href=main.php{$plug}&amp;sort=3>{t}Message{/t} {$mode3}</a></td>
-  </tr>
-  {$search_result}
- </table>
-
- <table summary="" style="width:100%; vertical-align:top; text-align:center;" cellpadding=4 cellspacing=0 border=0>
-  <tr>
-   <td>{$range_selector}</td>
-  </tr>
- </table>
-
-{else}
-  <b>{t}Search returned no results...{/t}</b>
-{/if}
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('search_for');
-  -->
-</script>
diff --git a/plugins/addons/logview/gosa_log_contents.tpl b/plugins/addons/logview/gosa_log_contents.tpl
deleted file mode 100644 (file)
index 5d71d81..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-<div class="contentboxh">
- <p class="contentboxh"><img src="{$launchimage}" align="right" alt="[F]">{t}Filter{/t}</p>
-</div>
-<div class="contentboxb">
-
- <table summary="" width="100%" class="contentboxb" style="border-top:1px solid #B0B0B0; padding:0px;" border=0>
-  <tr>
-   <td width="33%">
-    <table summary="">
-     <tr>
-      <td><img class="center" alt="" align="middle" border=0 src="{$server_image}">&nbsp;<LABEL FOR="server">{t}Show hosts{/t}</LABEL></td>
-      <td>
-       <select id="server" name="server" size=1 onChange="mainform.submit()">
-                      {html_options options=$servers selected=$server}
-                          <option disabled>&nbsp; </option>
-       </select>
-      </td>
-     </tr>
-     <tr>
-      <td><img class="center" alt="" align="middle" border=0 src="{$log_image}">&nbsp;<LABEL for="action">{t}Action{/t}</label></td>
-      <td>
-       <select id="action" name="action" size=1 onChange="mainform.submit()">
-               {html_options options=$actions selected=$action}
-            <option disabled>&nbsp;</option>
-       </select>
-      </td>
-     </tr>
-    </table>
-   </td>
-   
-   <td style="border-left:1px solid #A0A0A0">
-    &nbsp;
-   </td>
-   
-   <td width="33%">
-    <table summary="">
-     <tr>
-      <td><img class="center" alt="" align="middle" border=0 src="{$time_image}">&nbsp;<LABEL for="time" >{t}Time interval{/t}</LABEL></td>
-      <td>
-       <select id="time" name="time" size=1 onChange="mainform.submit()">
-               {html_options options=$date_select selected=$time}
-            <option disabled>&nbsp;</option>
-       </select>
-      </td>
-     </tr>
-     <tr>
-      <td><img class="center" alt="" align="middle" border=0 src="{$search_image}">&nbsp;<LABEL for="regex">{t}Search for{/t}</LABEL></td>
-      <td><input id="regex" name="regex" size=25 maxlength=60 value="{$regex}" title="{t}Enter string to search for{/t}"></td>
-     </tr>
-    </table>
-   </td>
-
-   <td style="border-left:1px solid #A0A0A0">
-    &nbsp;
-   </td>
-   <td>
-    <table summary="" width="100%">
-  <!-- 
-     <tr>
-      <td><img class="center" alt="" align="middle" border=0 src="{$ruleset_image}">&nbsp;<LABEL for="edit_rules">{t}Ruleset{/t}</LABEL></td>
-      <td width="100%">
-       <input id="edit_rules" name="edit_rules" type="submit" value="{t}Edit{/t}" disabled>
-      </td>
-     </tr>
--->
-     <tr>
-      <td colspan=2 style="text-align:right;">
-       <input name="search" type="submit" value="{t}Search{/t}">
-      </td>
-     </tr>
-    </table>
-   </td>
-  </tr>
- </table>
-</div>
-
-<br>
-
-{if $search_result ne ""}
- <table style="width:100%;background-color: #B0B0B0;" cellspacing=1 cellpadding=2>
-  <tr style="background-color: #E8E8E8; height:26px; font-weight:bold">
-   <td><a href="main.php{$plug}&amp;sort=0&amp;direction={$direction}">{t}Action{/t} {$mode0}</a></td>
-   <td><a href="main.php{$plug}&amp;sort=1&amp;direction={$direction}">{t}Date{/t} {$mode1}</a></td>
-   <td><a href="main.php{$plug}&amp;sort=2&amp;direction={$direction}">{t}User{/t} {$mode2}</a></td>
-   <td><a href="main.php{$plug}&amp;sort=3&amp;direction={$direction}">{t}Object type{/t} {$mode3}</a></td>
-   <td><a href="main.php{$plug}&amp;sort=4&amp;direction={$direction}">{t}Object{/t} {$mode4}</a></td>
-   <td><a href="main.php{$plug}&amp;sort=5&amp;direction={$direction}">{t}Message{/t} {$mode5}</a></td>
-  </tr>
-  {$search_result}
- </table>
-
- <table summary="" style="width:100%; vertical-align:top; text-align:center;" cellpadding=4 cellspacing=0 border=0>
-  <tr>
-   <td>{$range_selector}</td>
-  </tr>
- </table>
-
-{else}
-  <b>{t}Search returned no results...{/t}</b>
-{/if}
-<input type='hidden' name='gosa_log_contents_posted' value='1'>
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-  focus_field('regex');
-  -->
-</script>
diff --git a/plugins/addons/logview/main.inc b/plugins/addons/logview/main.inc
deleted file mode 100644 (file)
index 9ecb316..0000000
+++ /dev/null
@@ -1,39 +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
-*/
-if (!$remove_lock){
-
-       /* Create logview object on demand */
-       if (!isset($_SESSION['log_tabs']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
-               $_SESSION['log_tabs']= new log_tabs($config, $config->data['TABS']['LOGTABS'],"");
-       }
-       $log_tabs= $_SESSION['log_tabs'];
-
-       /* Execute formular */
-#      $display= $log_tabs->save_object();
-       $display= $log_tabs->execute ();
-       $display.= "<input type=\"hidden\" name=\"ignore\">\n";
-
-       /* Page header*/
-       $display= print_header(get_template_path('images/logview.png'), _("System log view")).$display;
-
-       /* Store changes  in session */
-       $_SESSION['log_tabs']= $log_tabs;
-}
-?>
diff --git a/plugins/addons/logview/tabs_log.inc b/plugins/addons/logview/tabs_log.inc
deleted file mode 100644 (file)
index bb855d2..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-
-class log_tabs extends tabs
-{
-
-  function log_tabs($config, $data, $dn)
-  {
-    tabs::tabs($config, $data, $dn);
-  }
-
-  function save_object($save_current= FALSE)
-  {
-    tabs::save_object($save_current);
-  }
-
-
-  function save($ignore_account= FALSE)
-  {
-  }
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/addons/mailqueue/class_mailqueue.inc b/plugins/addons/mailqueue/class_mailqueue.inc
deleted file mode 100644 (file)
index 6b1e6e4..0000000
+++ /dev/null
@@ -1,418 +0,0 @@
-<?php
-
-class mailqueue extends plugin
-{
-  /* Definitions */
-  var $plHeadline= "Mail queue";
-  var $plDescription= "This does something";
-
-  /* attribute list for save action */
-  var $attributes     = array();
-  var $objectclasses  = array();
-  var $mailQueueScript= "";    
-  var $Server         = "all";
-  var $Time           = 0;
-  var $Search         = "*";
-  var $Page           = 0;
-  var $Stat           = "all";
-  var $OrderBy        = "Arrival";
-  var $SortType       = "up";
-  var $disp_header    = false;
-  var $range          = 20;   
-  var $view_logged = FALSE;
-
-  function mailqueue(&$config, $dn= NULL)
-  {
-    $this->config           = &$config;
-    if (isset($this->config->current['MAILQUEUESCRIPTPATH'])){
-      $this->mailQueueScript  = $this->config->current['MAILQUEUESCRIPTPATH'];    
-    }
-
-    if(isset($this->config->data['MAIN']['MAILQUEUESCRIPTPATH'])){
-       $this->mailQueueScript  = $this->config->data['MAIN']['MAILQUEUESCRIPTPATH'];
-    }
-
-    $this->Server           = "all";
-  }
-
-
-  function pass_cmd($str)
-  {
-//    print_red($str);
-    return(shell_exec($str));
-  }
-
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* Log view */
-    if(!$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","mailqueue/".get_class($this),$this->dn);
-    }
-
-    if(isset($_POST['EntriesPerPage'])){
-      $this->range = $_POST['EntriesPerPage'];
-    }
-
-    $smarty= get_smarty();
-    $error =false;
-
-    if(empty($this->mailQueueScript)){
-      print_red(_("Please check your 'gosa.conf', there is no 'MAILQUEUESCRIPTPATH' specified."));
-      $error = true;
-    }else{
-
-      /* If we have more than one server selected (all), 
-         create a string with all servers separated by ', '
-       */ 
-      if($this->Server=="all"){
-        $se = $this->getServer();
-
-        unset($se['all']);
-        $se_str = "";
-        foreach($se as $server) {
-          $se_str .= $server." ";
-        }
-      }else{
-        /* We have only one server selected */
-        $se_str = $this->Server;
-      }
-
-      /* Check all post that will effect all entries */
-      $only_once = true;
-      foreach(array("unhold_all","hold_all","del_all","requeue_all") as $attr){
-        foreach($_POST as $name => $value){
-          if((preg_match("/".$attr."/",$name))&&($only_once)){
-            if(!$this->acl_is_readable($attr)){
-              $only_once = false;
-              print_red(sprintf(_("You do not have permission to execute the command '%s' on the mailqueue."),$attr));
-            }else{
-              $only_once = false;
-              $act = preg_replace("/_.*$/i","",$attr);
-              $r_cmd = preg_replace("/%action/" , $act           ,$this->mailQueueScript);
-              $r_cmd = preg_replace("/%server/" , $se_str         ,$r_cmd);
-              $r_cmd = preg_replace("/%id/"     , "ALL"           ,$r_cmd);
-              if($this->pass_cmd($r_cmd)==false){
-                print_red(sprintf(_("Please check your 'gosa.conf' the given '%s' can't be executed."),$r_cmd));
-              }
-            }
-          }
-        }
-      }        
-
-      /* Check single entry manipulation  posts */
-      $only_once = true;
-
-      /* act specifies the command to execute */
-      if(isset($_GET['act'])){
-        $opt = $_GET['act'];  
-  
-        /* The option to exec should be one of these */
-        if(in_array($opt,array("unhold","hold","del","requeue","query","header"))){
-          $only_once = false;
-
-          if(!$this->acl_is_readable($opt)){
-              print_red(sprintf(_("You do not have permission to execute the command '%s' on the mailqueue."),$opt));
-          }else{
-            /* Create cmd */
-            $r_cmd = preg_replace("/%action/" , $opt            ,$this->mailQueueScript);
-            $r_cmd = preg_replace("/%server/" , $this->Server   ,$r_cmd);
-            $r_cmd = preg_replace("/%id/"     , $_GET['id']     ,$r_cmd);
-
-            /* Execute cmd */
-            if(!$str = $this->pass_cmd($r_cmd)){
-              print_red(sprintf(_("Please check your 'gosa.conf' the given '%s' can't be executed."),$r_cmd));
-            }else{
-            
-              /* Special handling for option='header' */
-              if($opt == "header"){
-          
-                /* Create table which displays the header informations */
-                $this->disp_header ="\n<table width='80%'>";
-                foreach(split("\n",$str) as $line){
-                  $line = trim($line);
-                  if(empty($line)) {
-                    continue;
-                  }
-                  $this->disp_header .= "\n<tr>";
-                  $tmp0 = preg_replace("/:.*$/","",$line);
-                  $tmp1 = preg_replace("/^.*:/","",$line);
-                  $this->disp_header .= "\n<td style='background-color:#EEEEEE;'>".$tmp0."</td><td>".$tmp1."</td>"; 
-                  $this->disp_header .= "\n</tr>";
-                }              
-                $this->disp_header .= "\n</table>";
-              }
-            }
-          }
-        }
-      }        
-
-
-      /* Back is posted from the header display page */
-      if(isset($_POST['back'])){
-        $this->disp_header = false;
-      }
-
-      /* If there is a header in disp_header, then display it */
-      if($this->disp_header){
-        $smarty->assign("header",$this->disp_header);
-        return ($smarty->fetch (get_template_path('header.tpl', TRUE)));
-      }
-
-      /* tell smarty to display the search results*/
-      $smarty->assign("all_ok"      , "true");
-      
-      /* A single server is selected */
-      if($this->Server != "all"){    
-
-        /* Create Query cmd */ 
-        $q_cmd = preg_replace("/%action/" ,"query"      ,$this->mailQueueScript);
-        $q_cmd = preg_replace("/%server/" ,$this->Server,$q_cmd);
-        $q_cmd = preg_replace("/%id/"     ,"all"        ,$q_cmd);
-
-        if(!$this->acl_is_readable("query")){
-          print_red(sprintf(_("You do not have permission to execute the command '%s' on the mailqueue."),"query"));
-          $mailQueueParser = new parseMailQueue("",$this->Server);
-        }else{
-
-          /* Only display this if the query cmd is executeable */
-          if($str = @$this->pass_cmd ($q_cmd)){
-            /* Parse returned data */
-            $mailQueueParser = new parseMailQueue($str,$this->Server);
-          }else{
-            /* On error/ no return value / false return value */
-            print_red(sprintf(_("Please check your 'gosa.conf' the given '%s' can't be executed."),$q_cmd));
-            $error = true;
-          }
-        }
-      }else{
-        $mailQueueParser = NULL;
-        foreach($this->getServer() as $ServerID=>$ServerName){
-
-          /* Don't query the server named all :) */
-          if($ServerID == "all") continue;
-
-          /* Prepare query cmd */
-          $q_cmd = preg_replace("/%action/" ,"query"      ,$this->mailQueueScript);
-          $q_cmd = preg_replace("/%server/" ,$ServerName  ,$q_cmd);
-          $q_cmd = preg_replace("/%id/"     ,"ALL"           ,$q_cmd);
-
-          
-          if(!$this->acl_is_readable("query")){
-            print_red(sprintf(_("You do not have permission to execute the command '%s' on the mailqueue."),"query"));
-            $mailQueueParser = new parseMailQueue("",$this->Server);
-          }else{
-
-            /* Shell exec this cmd */
-            if($str = @$this->pass_cmd ($q_cmd)){
-
-              /* If there is no parser available, create one  */
-              if($mailQueueParser === NULL){
-                $mailQueueParser = new parseMailQueue($str,$ServerID);
-              }else{
-                $mailQueueParser->parseAdditionalQueue($str,$ServerID);
-              }
-              /* On error/ no return value / false return value */
-            }else{
-              print_red(sprintf(_("Please check your 'gosa.conf' the given '%s' can't be executed."),$q_cmd));
-              $error = true;
-            }
-          }
-        }
-      }     
-
-      /* Check for existing servers 
-          objectClass=goMailServer is required at least for one server. 
-         Else display error   */
-      $server = $this->getServer();
-      if((count($server) == 1 ) && (isset($server['all']))){
-        print_red(_("There are no mail server specified."));
-        $error = true;
-      }
-
-      if(!$error){
-
-        /* Filter data with the given */
-        $mailQueueParser->OrderBy($this->OrderBy,$this->SortType);
-        $mailQueueParser->OnlyDaysAgo($this->Time);
-        $mailQueueParser->CreateDate();
-     
-        if($this->Stat == "hold"){
-          $mailQueueParser->Search(true,array("Hold"),true);
-        }
-        if($this->Stat == "unhold"){
-          $mailQueueParser->Search(false,array("Hold"),true);
-        }
-        if($this->Stat == "active"){
-          $mailQueueParser->Search(true,array("Active"),true);
-        }
-        if($this->Stat == "nonactive"){
-          $mailQueueParser->Search(false,array("Active"),true);
-        }
-
-        $mailQueueParser->Search($this->Search,array("MailID","Size","Sender","Recipient","Error","Arrival"));
-
-        /* */
-        $entries = $mailQueueParser->GetAll();
-  
-        if(count($entries) ==0 ){
-          $smarty->assign("all_ok",false);
-        }
-        $smarty->assign("entries"       , array_slice($entries,$this->Page,$this->range));
-        $smarty->assign("plug"          , "?plug=".$_GET['plug']);
-        $smarty->assign("r_stats"       , $this->getStats());
-        $smarty->assign("stats"         , array_flip($this->getStats()));
-        $smarty->assign("stat"          , $this->Stat);
-        $smarty->assign("p_server"      , $this->Server);
-        $smarty->assign("p_servers"     , $this->getServer());
-        $smarty->assign("p_serverKeys"  , array_flip($this->getServer()));
-        $smarty->assign("p_time"        , $this->Time);
-        $smarty->assign("p_times"       , $this->getTimes());
-        $smarty->assign("p_timeKeys"    , array_flip($this->getTimes()));
-        $smarty->assign("search_for"    , $this->Search);
-        $smarty->assign("range_selector", range_selector(count($entries), $this->Page, $this->range,"EntriesPerPage")); 
-        $smarty->assign("OrderBy"       , $this->OrderBy);
-
-        /* Display sort arrow */
-        if($this->SortType == "up"){
-          $smarty->assign("SortType","<img src='images/sort_up.png' alt='"._("up")."' border='0'>");
-        }else{
-          $smarty->assign("SortType","<img src='images/sort_down.png' alt='"._("down")."' border='0'>");
-        }
-      }
-    }
-
-    /* In case of an error */
-    if($error){  
-      $smarty->assign("all_ok"        , "false");
-      $smarty->assign("r_stats"       , $this->getStats());
-      $smarty->assign("stats"         , array_flip($this->getStats()));
-      $smarty->assign("stat"          , $this->Stat);
-      $smarty->assign("plug"          , "?plug=".$_GET['plug']);
-      $smarty->assign("p_server"      , $this->Server);
-      $smarty->assign("p_servers"     , $this->getServer());
-      $smarty->assign("p_serverKeys"  , array_flip($this->getServer()));
-      $smarty->assign("p_time"        , $this->Time);
-      $smarty->assign("p_times"       , $this->getTimes());
-      $smarty->assign("p_timeKeys"    , array_flip($this->getTimes()));
-      $smarty->assign("search_for"    , $this->Search);
-      $smarty->assign("OrderBy"       , $this->OrderBy);
-    }
-    return ($smarty->fetch (get_template_path('contents.tpl', TRUE)));
-  }
-
-
-  /* return selectable server */
-  function getServer()
-  {
-    $ret= array("all"=>_("All"));
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);    
-    $ldap->search("(objectClass=goMailServer)",array("cn"));
-    while($tmp = $ldap->fetch()){
-      $ret[$tmp['cn'][0]]= $tmp['cn'][0];
-    }
-    return($ret);
-  }
-
-
-  /* Return selectable times*/
-  function getTimes()
-  {
-    $ret = array();
-    $ret['nolimit']=_("no limit"); 
-    foreach(array(1,2,4,8,12,24,36,48) as $i){
-      if($i == 1){
-        $ret[$i] = $i."&nbsp;"._("hour");
-      }else{
-        $ret[$i] = $i."&nbsp;"._("hours");
-      }
-    }
-    return($ret);
-  }
-
-
-  /* Save post values*/
-  function save_object($save_current= FALSE)
-  {
-    if(isset($_POST['p_server'])){
-      $this->Server = $_POST['p_server'];
-    }
-    if(isset($_POST['p_time'])){
-      $this->Time = $_POST['p_time'];
-    }
-    if(isset($_POST['search_for'])){
-      $this->Search = $_POST['search_for'];
-    }
-    if(isset($_POST['Stat'])){
-      $this->Stat = $_POST['Stat'];
-    }
-    if((isset($_GET['start']))&&(is_numeric($_GET['start']))&&($_GET['start']>=0)){
-      $this->Page = $_GET['start'];
-    }
-
-    if((isset($_GET['sort']))&&(!empty($_GET['sort']))){
-      $old = $this->OrderBy;
-      $this->OrderBy = $_GET['sort'];
-      if($this->OrderBy == $old)
-      {
-        if($this->SortType== "up"){
-          $this->SortType = "down";
-        }else{
-          $this->SortType = "up";
-        }
-      }
-    }
-
-  }
-
-  /* Return stats */
-  function getStats()
-  {
-    return(array(
-          "all"     =>_("All"),
-          "hold"    =>_("Hold"),
-          "unhold"  =>_("Un hold"),
-          "active"  =>_("Active"),
-          "nonactive"  =>_("Not active")
-          ));
-  }
-
-  /* Return plugin informations for acl handling
-     #FIXME You can only read attributes within this report plugin */
-  static function plInfo()
-  {
-    return (array(
-        "plShortName"   => _("Mailqueue"),
-        "plDescription" => _("Mailqueue addon"),
-        "plSelfModify"  => FALSE,
-        "plDepends"     => array(),
-        "plPriority"    => 1,
-        "plSection"     => array("addon"),
-        "plCategory"    => array("mailqueue" => array("objectClass" => "none", "description" => _("Mail queue addon"))),
-
-        "plProvidedAcls" => array(
-            "unhold_all"      => _("Unhold all messages"),
-            "hold_all"        => _("Hold all messages"),
-            "del_all"         => _("Delete all messages"),
-            "requeue_all"     => _("Requeue all messages"),
-            "unhold"          => _("Unhold message"),
-            "hold"            => _("Hold message"),
-            "del"             => _("Delete message"),
-            "requeue"         => _("Requeue message"),
-            "query"           => _("Gathering queue data"),
-            "header"          => _("Get header information")
-          )
-        ));
-  }
-
-
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/addons/mailqueue/class_parseMailQueue.inc b/plugins/addons/mailqueue/class_parseMailQueue.inc
deleted file mode 100644 (file)
index b510cb3..0000000
+++ /dev/null
@@ -1,237 +0,0 @@
-<?php
-
-class parseMailQueue
-{
-       var $s_dataToParse;
-       var $a_parsedData;
-  var $i_count;        
-
-  /* Contructor
-   * $s_data specifies the data that shuold be parse
-   */
-       function parseMailQueue($s_data,$server)
-       {
-    $this->s_dataToParse = $s_data;            
-         $this->a_parsedData = array();
-    $this->_parse($s_data,$server);
-  }
-
-
-  /* Remove all entries which are older than the last x hours
-   */
-  function OnlyDaysAgo($str)
-  {
-    /* Get current time */
-    $cur = time();
-  
-    /* Only perform this filter, if the given parameter is valid */
-    if((is_numeric($str))&&($str != 0)){
-
-      /* hours are given as parameter */
-      $cur = $cur - ($str*(60*60));
-
-      /* Remove old entries */
-      foreach($this->a_parsedData as $key => $data){
-        if($data['Arrival'] < $cur){
-          unset($this->a_parsedData[$key]);
-        }
-      }
-    }
-  }
-
-
-  /* Only keep entries that contains the $filter
-   * in any of the given $fields
-   */
-  function Search($filter,$fields,$bool = false)
-  {
-    /* Go through all entries */
-    foreach($this->a_parsedData as $key => $data){
-
-      /* not found yet */
-      $found = false;
-
-      foreach($fields as $attr){
-        if(($bool)&&($data[$attr]==$filter)){
-          $found = true;
-        }elseif(preg_match("/".str_replace("*",".*",$filter)."/i",$data[$attr])){
-          $found= true;
-        }
-      }
-  
-      /* if nothing found, delete this entry */
-      if($found == false){
-        unset($this->a_parsedData[$key]);
-      }
-    }
-  }
-
-  /* Convert date from timestamp to human readable */
-  function CreateDate()
-  {
-    foreach($this->a_parsedData as $key => $data){
-      $this->a_parsedData[$key]['Arrival'] = date("d.m.Y H:i:s",$data['Arrival']);
-    }
-  }
-
-  /* Order by specified field */
-  function OrderBy($str = "Arrival",$type = "up" )
-  {
-    $tmp = array();
-    /* If the given field is not valid */
-    if(!in_array($str,array("MailID","Size","Sender","Recipient","Arrival","Error","Server"))){
-      return(false);
-    }
-
-    /* Size need special handling, cause it contains numbers 
-     */
-    if($str == "Size"){
-      foreach($this->a_parsedData as $data){
-        $struse = "";
-        for($i = strlen($data['Size']); $i < 10 ; $i++  ){
-          $struse .="0";
-        }
-        $struse .= $data[$str].$data['MailID'].$data['Server'];
-        $tmp[$struse]= $data;
-      }
-    }else{
-      foreach($this->a_parsedData as $data){
-        $tmp[strtolower($data[$str]).$data['MailID']."-".$data['Server']]= $data;
-      }
-    } 
-    ksort($tmp);
-    if($type != "up"){
-      $tmp = array_reverse($tmp);
-    }
-    $this->a_parsedData = array();
-    foreach($tmp as $data){
-      $this->a_parsedData[$data['MailID']."-".$data['Server']] = $data;
-    }
-    return(true);
-  }
-  
-  function GetAll()
-  {
-    return($this->a_parsedData);
-  }
-
-  /* Checks if the given MailID exists */
-  function IDExists($id)
-  {
-    foreach($this->a_parsedData as $entry){
-      if($entry['MailID'] == $id) return(true);
-    }
-    return(false);
-  }
-
-  function parseAdditionalQueue($str, $server)
-  {
-    $this->_parse($str, $server);
-  }
-
-  /* This function parses the given data 
-   * it creates an array with all given queue entries
-   */
-  function _parse($str, $server)
-  {
-    $i              =  0;       // Temp var 
-    $entries        = array();  // Contains an array with the raw data for every single entry
-    $s_tmp          = "";       // Buffer
-
-    $s_mailID       = "";       // Queue ID 
-    $s_Size         = "";       // Mail size 
-    $s_Arrival      = "";       // Arrival time
-    $s_Sender       = "";       // Sender
-    $s_Recipient    = "";       // Recipient 
-    $s_Error        = "";       // Occured error
-
-    /* Remove header
-     */
-    $this->s_dataToParse = preg_replace("/^.*------\n/","",$str);
-
-    /* Create array with single entries
-     */
-    $entries = split("\n\n",$this->s_dataToParse);
-  
-    /* The last entry in this array is not realy an valid entry, its some kind of status.
-     * It would be something like this : -- 795 Kbytes in 124 Requests.
-     */
-    $this->i_count = (count($entries))-1;
-  
-    for($i = 0 ; $i < $this->i_count; $i ++ ){
-    
-      while(strstr($entries[$i],"  ")){
-        $entries[$i] = str_replace("  "," ",$entries[$i]);  
-      } 
-    
-      $s_buffer = split("\n",preg_replace("/[\\n\\r\\t]/s","\n",$entries[$i]));
-        
-      /* Get mailID */
-      $tmp = split(" ",$s_buffer[0]);
-
-      /* Get values */
-      $s_mailID   = $tmp[0];
-      $s_Size     = $tmp[1];
-      $s_Sender   = $tmp[6];
-
-      /* Parse time */
-      $tmp3 = split(":",$tmp[5]);
-      $tmp2 = strtotime($tmp[4]." ".$tmp[3]." ".date("Y"));
-      $s_Arrival= mktime($tmp3[0],$tmp3[1],$tmp3[2],date("d",$tmp2),date("m",$tmp2),date("Y",$tmp2));
-
-      $s_Error      = $s_buffer[1];
-      $s_Recipient  = $s_buffer[2];
-
-      /*
-              *      The message is in the active queue, i.e. the  message  is
-                     selected for delivery.
-
-              !      The  message is in the hold queue, i.e. no further deliv-delivery
-                     ery attempt will be made until  the  mail  is  taken  off
-                     hold.
-      */
-
-      $s_Hold = false;
-      if(preg_match("/\!/",$s_mailID)){
-        $s_mailID = preg_replace("/\!/","",$s_mailID);
-        $s_Hold = "true";
-      }
-      
-      $s_Active = false;
-      if(preg_match("/\*/",$s_mailID)){
-        $s_mailID = preg_replace("/\*/","",$s_mailID);
-        $s_Active = true;
-      }
-
-      /* Append data */
-      $this->a_parsedData[$s_mailID."-".$server]['Server']     = $server; 
-      $this->a_parsedData[$s_mailID."-".$server]['MailID']     = $s_mailID; 
-      $this->a_parsedData[$s_mailID."-".$server]['Size']       = $s_Size; 
-      $this->a_parsedData[$s_mailID."-".$server]['Arrival']    = $s_Arrival; 
-      $this->a_parsedData[$s_mailID."-".$server]['Sender']     = $s_Sender; 
-      $this->a_parsedData[$s_mailID."-".$server]['Recipient']  = $s_Recipient; 
-      $this->a_parsedData[$s_mailID."-".$server]['Hold']       = $s_Hold; 
-      $this->a_parsedData[$s_mailID."-".$server]['Active']     = $s_Active; 
-      $this->a_parsedData[$s_mailID."-".$server]['Error']      = $this->_parseError($s_Error); 
-    }
-    return($this->a_parsedData);
-  }
-
-  /* Parse Error part of the entry */
-  function _parseError($str)
-  {
-    $str   = trim(preg_replace("/[()]/","",$str));
-    $tmp2 = split(":",$str);
-    $tmp = array_reverse($tmp2);
-    $err  = preg_replace("/#.*$/","",$tmp[0]);
-    $text = preg_replace("/said$/i","",trim($tmp2[0])); 
-    return($err);
-  }
-
-}
-
-
-
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/addons/mailqueue/contents.tpl b/plugins/addons/mailqueue/contents.tpl
deleted file mode 100644 (file)
index 139bcd4..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-<div style="height: 5px;">&nbsp;</div>
-<div class="contentboxh">
- <p class="contentboxh"><img src="images/launch.png" alt="[F]" align="right">Filter</p>
-</div>
-<div class="contentboxb">
-  <div >
-       <table width="100%" summary="">
-               <tr>
-                       <td>
-       <img class="center" alt="{t}Search{/t}" src="images/search.png" align="middle" border="0">
-        &nbsp;{t}Search for{/t}
-    <input name="search_for" size="12" maxlength="60" value="{$search_for}" title="{t}Please enter a search string here.{/t}" onchange="mainform.submit()">
-        &nbsp;in 
-       <select size="1" name="p_server" title="{t}Select a server{/t}" onchange="mainform.submit()">
-        {html_options values=$p_serverKeys output=$p_servers selected=$p_server}
-       </select>
-       {t}with status{/t} : 
-       <select size="1" name="Stat" onchange="mainform.submit()">
-        {html_options values=$stats output=$r_stats selected=$stat}
-       </select>
-        &nbsp;{t}within the last{/t}&nbsp;
-       <select size="1" name="p_time" onchange="mainform.submit()">
-        {html_options values=$p_timeKeys output=$p_times selected=$p_time}
-       </select>
-        &nbsp;
-       <input name="search" value="{t}Search{/t}" type="submit">
-                       </td>
-                       <td style="border-left:1px solid #A0A0A0; text-align:right;">&nbsp;
-                               <input name="del_all"  src="images/edittrash.png"                       value="{t}Remove all messages{/t}"              type="image" 
-                                       title="{t}Remove all messages from selected servers queue{/t}">
-                               <input name="hold_all"    src="images/mailq_hold.png"                   value="{t}Hold all messages{/t}"                type="image"
-                                       title="{t}Hold all messages in selected servers queue{/t}">
-                               <input name="unhold_all"    src="images/mailq_unhold.png"               value="{t}Release all messages{/t}"     type="image"
-                                       title="{t}Release all messages in selected servers queue{/t}">
-                               <input name="requeue_all" src="images/mailq_requeue.png"                value="{t}Requeue all messages{/t}"     type="image"
-                                       title="{t}Requeue all messages in selected servers queue{/t}">
-                       </td>
-               </tr>
-       </table>
-       </div>
-</div>
-<br>
-
-
-{if $all_ok != "true"}
-<b>{t}Search returned no results{/t}...</b>
-{else}
-
-<table style="border: 1px solid rgb(176, 176, 176); width: 100%; vertical-align: top; text-align: left;" summary=""
- border="0" cellpadding="2" cellspacing="1" rules="cols">
-       <tr style="background-color: rgb(232, 232, 232); height: 26px; font-weight: bold;">
-               <td><a href="{$plug}&amp;sort=MailID"           >{t}ID{/t}                      {if $OrderBy == "MailID"}       {$SortType}{/if}</a></td>
-               <td><a href="{$plug}&amp;sort=Server"           >{t}Server{/t}          {if $OrderBy == "Server"}       {$SortType}{/if}</a></td>
-               <td><a href="{$plug}&amp;sort=Size"                     >{t}Size{/t}            {if $OrderBy == "Size"}         {$SortType}{/if}</a></td>
-               <td><a href="{$plug}&amp;sort=Arrival"          >{t}Arrival{/t}         {if $OrderBy == "Arrival"}      {$SortType}{/if}</a></td>
-               <td><a href="{$plug}&amp;sort=Sender"           >{t}Sender{/t}          {if $OrderBy == "Sender"}       {$SortType}{/if}</a></td>
-               <td><a href="{$plug}&amp;sort=Recipient"        >{t}Recipient{/t}       {if $OrderBy == "Recipient"}{$SortType}{/if}</a></td>
-               <td><a href="{$plug}&amp;sort=Error"            >{t}Error{/t}           {if $OrderBy == "Error"}        {$SortType}{/if}</a></td>
-               <td>&nbsp;</td>
-       </tr>
-
-{counter start=0 assign=i start=1}
-{foreach from=$entries item=val key=key}
-                       
-       {if ($i%2)== 0 }
-               <tr style="height: 22px; background-color: rgb(236, 236, 236);">
-       {else}
-               <tr style="height: 22px; background-color: rgb(245, 245, 245);">
-       {/if}
-               <td >
-<!-- onlick="javascript:       document.mainform.header_server.value='{$entries[$key].Server}';
-                                                               document.mainform.header_id.value='{$entries[$key].MailID}';
-                                                               document.mainform.submit();"
--->
-                       {if $entries[$key].Active == true}
-                               <img class="center" src="images/mailq_active.png" border=0 alt="{t}Active{/t}">
-                       {/if}
-                       
-                       {$entries[$key].MailID}</td>
-               <td> 
-<!-- onclick="javascript: document.location.href='{$plug}&amp;act=header&amp;id={$entries[$key].MailID}&amp;server={$entries[$key].Server}'"-->
-                       {$entries[$key].Server}</td>
-               <td>
-                       {$entries[$key].Size}</td>
-               <td>
-                       {$entries[$key].Arrival}</td>
-               <td>
-                       {$entries[$key].Sender}</td>
-               <td>
-                       {$entries[$key].Recipient}</td>
-               <td >{$entries[$key].Error}</td>
-               <td style="text-align:right">
-                       <a href="{$plug}&amp;act=del&amp;id={$entries[$key].MailID}&amp;server={$entries[$key].Server}">
-                               <img class="center" src="images/edittrash.png" border=0 alt="{t}delete{/t}" title="{t}Delete this message{/t}">
-                       </a>
-               {if $entries[$key].Hold == true}
-                       <a href="{$plug}&amp;act=unhold&amp;id={$entries[$key].MailID}&amp;server={$entries[$key].Server}">
-                               <img class="center" src="images/mailq_unhold.png" border=0 alt="{t}unhold{/t}" title="{t}Release message{/t}">
-                       </a>
-               {else}
-                       <a href="{$plug}&amp;act=hold&amp;id={$entries[$key].MailID}&amp;server={$entries[$key].Server}">
-                               <img class="center" src="images/mailq_hold.png" border=0 alt="{t}hold{/t}" title="{t}Hold message{/t}">
-                       </a>
-               {/if}
-                       <a href="{$plug}&amp;act=requeue&amp;id={$entries[$key].MailID}&amp;server={$entries[$key].Server}">
-                               <img class="center" src="images/mailq_requeue.png" border=0 alt="{t}requeue{/t}" title="{t}Requeue this message{/t}">
-                       </a>
-                       <a href="{$plug}&amp;act=header&amp;id={$entries[$key].MailID}&amp;server={$entries[$key].Server}">
-                               <img class="center" src="images/mailq_header.png" border=0 alt="{t}header{/t}" title="{t}Display header from this message{/t}">
-                       </a>
-               </td>
-       </tr>
-       {counter}
-{/foreach}
-</table>
-
- <table summary="" style="width:100%; vertical-align:top; text-align:center;" cellpadding=4 cellspacing=0 border=0>
-  <tr>
-   <td>{$range_selector}</td>
-  </tr>
- </table>
-<p class="plugbottom">&nbsp;</p>
-
-{/if}
-
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('search_for');
-  -->
-</script>
diff --git a/plugins/addons/mailqueue/header.tpl b/plugins/addons/mailqueue/header.tpl
deleted file mode 100644 (file)
index eeb8bcf..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-{$header}
-
-<p class="seperator">&nbsp;</p>
-<div style='text-align:right;'>
-       <input type="submit" name="back" value="{t}Back{/t}"> 
-</div>
diff --git a/plugins/addons/mailqueue/main.inc b/plugins/addons/mailqueue/main.inc
deleted file mode 100644 (file)
index 09bbe56..0000000
+++ /dev/null
@@ -1,47 +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
-*/
-
-if (!$remove_lock){
-       /* Create mailqueue object on demand */
-       if (!isset($_SESSION['mailqueue']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
-               $ui = get_userinfo();
-               $_SESSION['mailqueue']= new mailqueue ($config);
-               $_SESSION['mailqueue']->set_acl_category("mailqueue");
-               
-               /* Check root dn and user dn for acl informations */
-               $_SESSION['mailqueue']->set_acl_base($config->current['BASE']);
-               if($_SESSION['mailqueue']->getacl("") == ""){
-                       $_SESSION['mailqueue']->set_acl_base($ui->dn);
-               }
-       }
-       $mailqueue= $_SESSION['mailqueue'];
-
-       /* Execute formular */
-       $mailqueue->save_object();
-       $display= $mailqueue->execute ();
-       $display.= "<input type=\"hidden\" name=\"ignore\">\n";
-
-       /* Page header*/
-       $display= print_header(get_template_path('images/mailqueue.png'), _("Mail queue")).$display;
-
-       /* Store changes  in session */
-       $_SESSION['mailqueue']= $mailqueue;
-}
-?>
diff --git a/plugins/addons/notifications/class_msgplug.inc b/plugins/addons/notifications/class_msgplug.inc
deleted file mode 100644 (file)
index edbab55..0000000
+++ /dev/null
@@ -1,258 +0,0 @@
-<?php
-
-class msgplug extends plugin
-{
-  /* Definitions */
-  var $plHeadline= "Notifications";
-  var $plDescription= "This does something";
-
-  /* attribute list for save action */
-  var $attributes= array("target", "nmessage");
-  var $objectclasses= array();
-
-  /* Helpers */
-  var $target= "group";
-  var $nmessage= "";
-
-  var $targets= array();
-  var $users= array();
-  var $groups= array();
-  var $recipients= array();
-  var $show_templates= false;
-  var $templates= array();
-  var $template= "";
-  var $finalized= false;
-  var $module = "msgplug";
-  var $view_logged = FALSE;
-
-  function msgplug (&$config, $dn= NULL)
-  {
-    /* Include config object */
-    $this->config= &$config;
-    $ui= get_userinfo();
-    $tag= $ui->gosaUnitTag;
-
-    /* Preset values */
-    $this->targets= array("user" => _("Users"), "group" => _("Groups"));
-    asort($this->targets);
-
-    $res = get_list("(objectClass=gosaAccount)", "users", $this->config->current['BASE'],array('uid', 'cn'),GL_SUBSEARCH);
-    foreach($res as $key => $attrs){
-      $this->users['U:'.$attrs['uid'][0]]= $attrs['cn'][0].' ['.$attrs['uid'][0].']';
-    }
-    ksort($this->users);
-
-    $res = get_list("(objectClass=posixGroup)", "groups", $this->config->current['BASE'],array('cn','description'));
-    foreach($res as $key => $attrs){
-      $dsc= "";
-      if (isset($attrs['description'][0])){
-        $dsc= $attrs['description'][0];
-      }
-      $this->groups['G:'.$attrs['cn'][0]]= $attrs['cn'][0].' ['.$dsc.']';
-    }
-    ksort($this->users);
-
-
-    /* Load templates */
-    if (isset($this->config->current['NOTIFYDIR'])){
-      $dir= $this->config->current['NOTIFYDIR'];
-      if (is_dir($dir) && is_readable($dir)){
-
-        /* Look for files and build the vacation array */
-        $dh= opendir($dir);
-        while ($file = readdir($dh)){
-          $description= $this->parse_notification("$dir/$file");
-          if ($description != ""){
-            $this->templates["$dir/$file"]= $description;
-          }
-        }
-        closedir($dh);
-      }
-
-      /* Enable templates if there are some... */
-      if (count($this->templates)){
-        $this->show_templates= true;
-      }
-    }
-  }
-
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* Log view */
-    if(!$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","msgplug/".get_class($this),$this->dn);
-    }
-
-    /* Send message? */
-    if (isset($_POST['send']) && $this->acl_is_writeable("notify")){
-
-      /* Do we have recipients? */
-      if (count($this->recipients)){
-
-        /*Permissions ok? */
-        if (!$this->acl_is_writeable('notify')){
-          print_red(_("You have no permissions to send a message!"));
-        } else {
-          $cmd= $this->config->search("msgplug", "NOTIFY_COMMAND",array('menu'));
-          if ($cmd == ""){
-            print_red(_("No NOTIFY_COMMAND definition found in your gosa.conf"));
-          } else {
-            $parameters= base64_encode($this->nmessage) ." ";
-            foreach ($this->recipients as $key => $value){
-              $parameters.= "$key ";
-            }
-            exec ("$cmd $parameters", $dummy, $retval);
-            if ($retval != 0){
-              print_red(sprintf(_("Execution of '%s' failed!"), $cmd));
-            }
-            $this->finalized= true;
-          }
-        }
-      } else {
-        print_red(_("Please specify at least one recipient to send a message!"));
-      }
-    }
-
-    /* Bounce back to the original dialog */
-    if (isset($_POST['continue'])){
-      $this->finalized= false;
-    }
-
-    /* Add to list? */
-    if (isset($_POST['add']) && isset($_POST['source']) && $this->acl_is_writeable("notify")){
-      foreach ($_POST['source'] as $key){
-        if ($this->target == 'user'){
-          if(isset($this->users[$key])){
-            $this->recipients[$key]= $this->users[$key];
-          }
-        }
-        if ($this->target == 'group'){
-          if(isset($this->groups[$key])){
-            $this->recipients[$key]= $this->groups[$key];
-          }
-        }
-      }
-      ksort($this->recipients);
-    }
-
-    /* Remove from list? */
-    if (isset($_POST['del']) && isset($_POST['recipient'])){
-      foreach ($_POST['recipient'] as $key){
-          unset($this->recipients[$key]);
-      }
-    }
-
-    /* Import message? */
-    if (isset($_POST["import_template"]) && isset($this->templates[$_POST["nmessage_template"]])){
-      $contents= "";
-      $lines= file($_POST["nmessage_template"]);
-      foreach ($lines as $line){
-        if (!preg_match('/^DESC:/', $line)){
-          $contents.= $line;
-        }
-      }
-
-      /* Replace attributes */
-      $ui= get_userinfo();
-      $contents= preg_replace('/%self/', $ui->cn, $contents);
-
-      /* Save message */
-      $this->nmessage= htmlspecialchars($contents);
-    }
-
-    $smarty= get_smarty();
-
-    /* Assign possible target types */
-    $smarty->assign("targets", $this->targets);
-    foreach ($this->attributes as $attr){
-      $smarty->assign($attr, $this->$attr);
-    }
-
-    /* Generate list */
-    $tmp= array();
-    foreach (array("user" => "users", "group" => "groups") as $field => $arr){
-      if ($this->target == $field){
-        foreach ($this->$arr as $key => $value){
-          if (!isset($this->recipients[$key])){
-            $tmp[$key]= $value;
-          }
-        }
-      }
-    }
-    $smarty->assign('sources', $tmp);
-    $smarty->assign('recipients', $this->recipients);
-
-    /* Assign ACL */
-    $smarty->assign('nmessageACL', $this->getacl("notify"));
-
-    /* Handle templates */
-    $smarty->assign('show_templates', $this->show_templates?"true":"false");
-    $smarty->assign('message_templates', $this->templates);
-    $smarty->assign('template', $this->template);
-    $smarty->assign('finished', $this->finalized?"true":"false");
-
-    /* Show main page */
-    return ($smarty->fetch (get_template_path('contents.tpl', TRUE)));
-  }
-
-
-  function parse_notification($file)
-  {
-    $desc= "";
-
-    if (is_file($file)){
-      $fh = fopen($file, "r");
-      $line= fgets($fh, 256);
-
-      if (!preg_match('/^DESC:/', $line)){
-        print_red (_("No DESC tag in message file:")." $file");
-        return $desc;
-      }
-      fclose ($fh);
-
-      $desc= trim(preg_replace('/^DESC:\s*/', '', $line));
-    }
-
-    return $desc;
-  }
-
-  
-  function save_object()
-  {
-    plugin::save_object();
-    foreach($this->attributes as $attr){
-      if(isset($_POST[$attr])){
-        $this->$attr = $_POST[$attr];
-      }
-    }
-  }
-
-  
-  /* Return plugin informations for acl handling */
-  static function plInfo()
-  {
-    return (array(
-        "plShortName"   => _("Notification"),
-        "plDescription" => _("Notification plugin"),
-        "plSelfModify"  => FALSE,
-        "plDepends"     => array(),
-        "plPriority"    => 89,
-        "plSection"     => array("addon"),
-        "plCategory"    => array("msgplug" => array("objectClass" => "none", "description" => _("Notification plugin"))),
-
-        "plProvidedAcls" => array(
-            "notify"          => _("Allow sending notifications")
-          )
-        ));
-  }
-
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/addons/notifications/contents.tpl b/plugins/addons/notifications/contents.tpl
deleted file mode 100644 (file)
index 6898696..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-{if $finished eq "false"}
-<h2>{t}Notification target{/t}</h2>
-
-<table style="width:100%">
- <tr>
-  <td style="width:48%; vertical-align:top;">
-   {t}Use target from{/t}
-   <select name="target" onChange="document.mainform.submit()">
-        {html_options options=$targets selected=$target}
-        <option disabled>&nbsp;</option>
-   </select>
-   {if $javascript eq 'false'}<input type="submit" value="{t}Apply{/t}" name="refresh">{/if}<br><br>
-  </td>
-  <td>
-  </td>
-  <td>
-  </td>
- </tr>
- <tr>
-  <td>
-   {t}Available recipients{/t}<br>
-   <select style="width:100%;height:180px;" name="source[]" size="20" multiple title="{t}List message possible targets{/t}">
-            {html_options options=$sources}
-           <option disabled>&nbsp;</option>
-   </select>
-  </td>
-  <td style="vertical-align:center; text-align:center">
-   <input type="submit" value="&gt;" name="add">
-   <br><br>
-   <input type="submit" value="&lt;" name="del">
-  </td>
-  <td style="width:48%; vertical-align:top;">
-   {t}Recipients{/t}<br>
-   <select style="width:100%;height:180px;" name="recipient[]" size="20" multiple title="{t}List message recipients{/t}">
-            {html_options options=$recipients}
-           <option disabled>&nbsp;</option>
-   </select>
-  </td>
- </tr>
-</table>
-
-
-<p class="seperator">&nbsp;</p>
-<h2>{t}Message{/t}</h2>
-{render acl=$nmessageACL}
-  <textarea id="nmessage" style="width:99%; height:180px;" name="nmessage" rows="4" cols="512" >{$nmessage}</textarea>
-{/render}
-
-{if $show_templates eq "true"}
-<select name="nmessage_template">
-       {html_options options=$message_templates selected=$template}
-       <option disabled>&nbsp;</option>
-</select>
-<input type="submit" value="{t}Import{/t}" name="import_template">
-{/if}
-
-<p class="seperator">&nbsp;</p>
-<div style='text-align:right;margin-top:5px'>
-{render acl=$nmessageACL}
-        <input type="submit" name="send" value="{t}Send message{/t}">
-{/render}
-</div>
-
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-  document.mainform.nmessage.focus();
-  -->
-</script>
-{else}
-<h2>{t}Notification send!{/t}</h2>
-<p class="seperator">&nbsp;</p>
-<br>
-{t}Your message has been sent successfully. Press the continue button to get back to the notification plugin.{/t}
-<p class="seperator">&nbsp;</p>
-<div style='text-align:right;margin-top:5px'>
-        <input type="submit" name="continue" value="{t}Continue{/t}">
-</div>
-{/if}
diff --git a/plugins/addons/notifications/main.inc b/plugins/addons/notifications/main.inc
deleted file mode 100644 (file)
index c736985..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-<?php
-/*
-  This code is part of GOsa (https://gosa.gonicus.de)
-  Copyright (C) 2005  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
-*/
-
-if (!$remove_lock){
-        /* Create msgplug object on demand */
-        if (!isset($_SESSION['msgplug']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
-                $ui = get_userinfo();
-                $_SESSION['msgplug']= new msgplug ($config);
-                $_SESSION['msgplug']->set_acl_category("msgplug");
-
-                /* Check root dn and user dn for acl informations */
-                $_SESSION['msgplug']->set_acl_base($config->current['BASE']);
-                if($_SESSION['msgplug']->getacl("") == ""){
-                        $_SESSION['msgplug']->set_acl_base($ui->dn);
-                }
-        }
-       $msgplug= $_SESSION['msgplug'];
-
-       /* save changes back to object */
-       if (isset ($_POST['target'])){
-         $msgplug->save_object ();
-       }
-
-       /* Execute formular */
-       $display= $msgplug->execute ();
-       $display.= "<input type=\"hidden\" name=\"ignore\">\n";
-
-       /* Page header*/
-       $display= print_header(get_template_path('images/notifications.png'), _("Notifications")).$display;
-
-       /* Store changes  in session */
-       $_SESSION['msgplug']= $msgplug;
-}
-?>
diff --git a/plugins/admin/acl/acl_role.tpl b/plugins/admin/acl/acl_role.tpl
deleted file mode 100644 (file)
index 17a2704..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-{if $dialogState eq 'head'}
-
-<h1>{t}Assigned ACLs for current entry{/t}</h1>
-<table>
-<tr>
-       <td>
-               {t}Name{/t}
-       </td>
-       <td>    
-{render acl=$cnACL}
-               <input type="text" name='cn' value="{$cn}" style='width:200px;'>
-{/render}
-       </td>
-</tr>
-<tr>
-       <td>
-               {t}Description{/t}
-       </td>
-       <td>
-{render acl=$descriptionACL}
-               <input type="text" name='description' value="{$description}" style='width:200px;'>
-{/render}
-       </td>
-</tr>
-<tr>
-       <td>
-               {t}Base{/t}
-       </td>
-       <td>
-{render acl=$baseACL}
-             <select id="base" size="1" name="base" title="{t}Choose subtree to place group in{/t}">
-              {html_options options=$bases selected=$base_select}
-             </select>
-{/render}
-
-{render acl=$baseACL disable_picture='images/folder_gray.png'}
-               <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
-{/render}
-
-       </td>
-</tr>
-</table>
-{$aclList}
-<input type="submit" name="new_acl" value="{t}New ACL{/t}">
-
-{/if}
-
-{if $dialogState eq 'create'}
-<h1>{t}ACL type{/t} <select size="1" name="aclType" title="{t}Select an acl type{/t}" onChange="document.mainform.submit()">{html_options options=$aclTypes selected=$aclType}<option disabled>&nbsp;</option></select>&nbsp;{if $javascript eq 'false'}<input type="submit" value="{t}Apply{/t}" name="refresh">{/if}</h1>
-
-<p class="seperator">&nbsp;</p>
-
-
-<h1>{t}List of available ACL categories{/t}</h1>
-{$aclList}
-
-<p class="seperator">&nbsp;</p>
-<div style='text-align:right;margin-top:5px'>
-       <input type="submit" name="submit_new_acl" value="{t}Apply{/t}">
-       &nbsp;
-       <input type="submit" name="cancel_new_acl" value="{t}Cancel{/t}">
-</div>
-{/if}
-
-{if $dialogState eq 'edit'}
-
-<h1>{$headline}</h1>
-
-{$aclSelector}
-
-<p class="seperator">&nbsp;</p>
-<div style='text-align:right;margin-top:5px'>
-       <input type="submit" name="submit_edit_acl" value="{t}Apply{/t}">
-       &nbsp;
-       <input type="submit" name="cancel_edit_acl" value="{t}Cancel{/t}">
-</div>
-{/if}
-<input type='hidden' name='acl_role_posted' value='1'>
diff --git a/plugins/admin/acl/class_aclManagement.inc b/plugins/admin/acl/class_aclManagement.inc
deleted file mode 100644 (file)
index fd784ed..0000000
+++ /dev/null
@@ -1,656 +0,0 @@
-<?php
-/*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2003-2006 - Cajus Pollmeier <pollmeier@gonicus.de>
-
-   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 aclManagement extends plugin
-{
-  /* Plugin definitions */
-  var $plHeadline     = "ACLs";
-  var $plDescription  = "This does something";
-
-  /* Dialog attributes */
-  var $acltabs              = NULL;
-  var $ui                   = NULL;
-  var $acl                  = "";
-  var $DivListACL           = NULL;
-
-  var $CopyPasteHandler;
-  var $start_pasting_copied_objects = FALSE;
-
-  function aclManagement(&$config, &$ui)
-  {
-    /* Save configuration for internal use */
-    $this->config = &$config;
-    $this->ui     = &$ui;
-
-    /* Copy & Paste enabled ?*/
-    if((isset($this->config->data['MAIN']['ENABLECOPYPASTE']))&&(preg_match("/true/i",$this->config->data['MAIN']['ENABLECOPYPASTE']))){
-      $this->CopyPasteHandler = new CopyPasteHandler($this->config);
-    }
-
-    /* Creat dialog object */
-    $this->DivListACL = new divListACL($this->config,$this);
-  }
-
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    $_SESSION['LOCK_VARS_TO_USE'] = array("/^list/","/^id_/","/^list_acl_role_del/","/^list_acl_del/");
-
-    $smarty       = get_smarty();                 // Smarty instance
-    $s_action     = "";                           // Contains the action to be taken
-    $s_entry      = "";                           // The value for s_action
-
-    /* Edit entry button pressed? */
-    if( isset($_GET['act']) && $_GET['act'] == "list_edit_entry" ){
-      $s_action= "edit";
-      $s_entry= validate($_GET['id']);
-    }
-
-    /* Edit entry button pressed? */
-    if( isset($_GET['act']) && $_GET['act'] == "list_edit_role" ){
-      $s_action= "edit_role";
-      $s_entry= validate($_GET['id']);
-    }
-
-    $types = array( 
-                    "del"       =>"^list_acl_del",
-                    "edit"      =>"^list_acl_edit",
-                    "del_role"  =>"^list_acl_role_del",
-                    "edit_role" =>"^list_acl_role_edit",
-                    "copy"      =>"^copy",
-                    "cut"       =>"^cut",
-                    "copy_multiple"=> "^multiple_copy_objects",
-                    "cut_multiple" => "^multiple_cut_objects",
-                    "editPaste" =>"^editPaste",
-                    "addrole"   =>"^new_acl_role");
-
-    /* Test relevant POST values */  
-    foreach($_POST as $key => $val){
-
-      /* Get every possible POST combination and set s_action/s_entry accordingly */
-      foreach($types as $act => $name){
-
-        if (preg_match("/".$name.".*/", $key)){
-          $s_action= $act;
-          $s_entry= preg_replace("/".$name."_/i", "", $key);
-        }
-      }
-    } 
-
-    /* Remove coordinate prefix from POST, required by some browsers */
-    $s_entry= preg_replace("/_.$/", "", $s_entry);
-
-    /* Seperate possibly encoded tab and entry, default to tab "acl" */
-    if(preg_match("/.*-.*/", $s_entry)){
-      $s_tab= preg_replace("/^[^-]*-/i", "" ,$s_entry);
-      $s_entry= preg_replace("/-[^-]*$/i", "", $s_entry);
-    }else{
-      $s_tab= "generic";
-    }
-   
-
-    /* handle C&P from layers menu */
-    if(isset($_POST['menu_action']) && preg_match("/^multiple_copy_systems/",$_POST['menu_action'])){
-      $s_action = "copy_multiple";
-    }
-    if(isset($_POST['menu_action']) && preg_match("/^multiple_cut_systems/",$_POST['menu_action'])){
-      $s_action = "cut_multiple";
-    }
-    if(isset($_POST['menu_action']) && preg_match("/^editPaste/",$_POST['menu_action'])){
-      $s_action = "editPaste";
-    }
-
-    /* Create options */
-    if(isset($_POST['menu_action']) && $_POST['menu_action'] == "new_acl_role"){
-      $s_action = "new";
-    }
-
-    /* handle remove from layers menu */
-    if(isset($_POST['menu_action']) && preg_match("/^remove_multiple/",$_POST['menu_action'])){
-      $s_action = "del_multiple";
-    }
-    /********************
-      Copy & Paste Handling  ...
-     ********************/
-
-    /* Display the copy & paste dialog, if it is currently open */
-    $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
-    if($ret){
-      return($ret);
-    }
-
-
-    /********************
-     * Add new Role entry 
-     ********************/
-
-    if(($s_action == "addrole") && (!isset($this->acltabs->config))){
-
-      /* Get 'dn' from posted acl, must be unique */
-      $this->dn= "new";
-
-      /* Check permissions */
-      if(preg_match("/c/",$this->ui->get_permissions($this->DivListACL->selectedBase,"acl/acl"))){
-
-        /* Register acltabs to trigger edit dialog */
-        $this->acltabs= new aclroletab($this->config, NULL,$this->dn);
-        $this->acltabs->set_acl_base($this->DivListACL->selectedBase);
-      }else{
-        print_red(_("You are not allowed to create a new role."));
-      }
-    }
-
-    /********************
-      Edit existing entry 
-     ********************/
-
-    if (($s_action=="edit" || $s_action=="edit_role") && (!isset($this->acltabs->config))){
-
-      /* Get 'dn' from posted acl, must be unique */
-      $this->dn= $this->list[trim($s_entry)]['dn'];
-
-      /* Check permissions */
-      if(preg_match("/r/",$this->ui->get_permissions($this->dn,"acl/acl"))){
-      
-        /* Check locking, save current plugin in 'back_plugin', so
-           the dialog knows where to return. */
-        if (($acl= get_lock($this->dn)) != ""){
-          return(gen_locked_message ($acl, $this->dn));
-        }
-
-        /* Lock the current entry, so everyone will get the above dialog */
-        add_lock ($this->dn, $this->ui->dn);
-
-        /* Register acltabs to trigger edit dialog */ 
-        if($s_action=="edit_role"){
-          $this->acltabs= new aclroletab($this->config, NULL,$this->dn);
-          $this->acltabs-> set_acl_base($this->dn);
-        }else{
-          $this->acltabs= new acltab($this->config, NULL,$this->dn);
-          $this->acltabs-> set_acl_base($this->dn);
-        }
-
-        /* Set ACL and move DN to the headline */
-        $_SESSION['objectinfo']= $this->dn;
-      }else{
-        print_red(_("You are not allowed to edit this acl."));
-      }
-    }
-
-
-    /********************
-      Edit canceled 
-     ********************/
-    if(isset($_POST['delete_lock'])){
-      del_lock ($this->dn);
-      unset($_SESSION['objectinfo']);
-    }
-
-    /* Reset all relevant data, if we get a _cancel request */
-    if (isset($_POST['edit_cancel'])){
-      if (isset($this->acltabs)){
-        del_lock ($this->dn);
-        unset ($this->acltabs);
-      }
-      $this->acltabs= NULL;
-      unset ($_SESSION['objectinfo']);
-    }
-
-
-    /********************
-      Delete entry requested, display confirm dialog
-     ********************/
-
-    /* Remove acl was requested */
-    if ($s_action=="del_role"){
-
-      /* Get 'dn' from posted acl */
-      $this->dn= $this->list[trim($s_entry)]['dn'];
-
-      /* Check permissions */
-      if(preg_match("/d/",$this->ui->get_permissions($this->dn,"aclroles/aclrole"))){
-
-        /* Check locking, save current plugin in 'back_plugin', so
-           the dialog knows where to return. */
-        if (($acl= get_lock($this->dn)) != ""){
-          return(gen_locked_message ($acl, $this->dn));
-        }
-
-        /* Lock the current entry, so nobody will edit it during deletion */
-        add_lock ($this->dn, $this->ui->dn);
-        $smarty->assign("info", sprintf(_("You're about to delete the acl %s."), @LDAP::fix($this->dn)));
-        $smarty->assign("is_role",true);
-  
-        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
-      } else {
-
-        /* Obviously the acl isn't allowed to delete. Show message and
-           clean session. */
-        print_red (_("You are not allowed to delete this acl!"));
-      }
-    }
-
-
-    /********************
-      Delete entry confirmed 
-     ********************/
-
-    /* Confirmation for deletion has been passed. Acl should be deleted. */
-    if (isset($_POST['delete_acl_role_confirmed'])){
-
-      /* Check permissions */
-      if(preg_match("/d/",$this->ui->get_permissions($this->dn,"aclroles/aclrole"))){
-
-        /* Delete request is permitted, perform LDAP action */
-        $this->acltabs= new aclroletab($this->config, NULL,$this->dn);
-        $this->acltabs->delete();
-        unset ($this->acltabs);
-        $this->acltabs= NULL;
-      } else {
-
-        /* Normally this shouldn't be reached, send some extra
-           logs to notify the administrator */
-        print_red (_("You are not allowed to delete this acl role!"));
-
-        if(isset($this->ui->uid)){
-          new log("security","aclroles/".get_class($this),$this->dn,array(),"Warning: '".$this->ui->uid."' tried to trick acl role deletion.");
-        }
-      }
-
-      /* Remove lock file after successfull deletion */
-      del_lock ($this->dn);
-    }
-
-    /********************
-      Delete entry requested, display confirm dialog
-     ********************/
-
-    /* Remove acl was requested */
-    if ($s_action=="del"){
-
-      /* Get 'dn' from posted acl */
-      $this->dn= $this->list[trim($s_entry)]['dn'];
-
-      /* Check permissions */
-      if(preg_match("/d/",$this->ui->get_permissions($this->dn,"acl/acl"))){
-        /* Check locking, save current plugin in 'back_plugin', so
-           the dialog knows where to return. */
-        if (($acl= get_lock($this->dn)) != ""){
-          $_SESSION['LOCK_VARS_TO_USE'] = array("/^list_acl_edit/","/^list_acl_del/","/^id_/");
-          return(gen_locked_message ($acl, $this->dn));
-        }
-
-        /* Lock the current entry, so nobody will edit it during deletion */
-        add_lock ($this->dn, $this->ui->dn);
-        $smarty->assign("info", sprintf(_("You're about to delete the acl %s."), @LDAP::fix($this->dn)));
-        $smarty->assign("is_role",false);
-        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
-      } else {
-
-        /* Obviously the acl isn't allowed to delete. Show message and
-           clean session. */
-        print_red (_("You are not allowed to delete this acl!"));
-      }
-    }
-
-
-    /********************
-      Delete entry confirmed 
-     ********************/
-
-    /* Confirmation for deletion has been passed. Acl should be deleted. */
-    if (isset($_POST['delete_acl_confirm'])){
-
-      /* Check permissions */
-      if(preg_match("/d/",$this->ui->get_permissions($this->dn,"acl/acl"))){
-
-        /* Delete request is permitted, perform LDAP action */
-        $this->acltabs= new acl($this->config, NULL,$this->dn);
-        $this->acltabs->remove_from_parent();
-        unset ($this->acltabs);
-        $this->acltabs= NULL;
-      } else {
-
-        /* Normally this shouldn't be reached, send some extra
-           logs to notify the administrator */
-        print_red (_("You are not allowed to delete this acl!"));
-
-        if(isset($this->ui->uid)){
-          new log("security","aclroles/".get_class($this),$this->dn,array(),"Warning: '".$this->ui->uid."' tried to trick acl role      deletion.");
-          
-        }
-      }
-
-      /* Remove lock file after successfull deletion */
-      del_lock ($this->dn);
-    }
-
-    
-    /********************
-      Delete entry Canceled 
-     ********************/
-
-    /* Delete acl canceled? */
-    if (isset($_POST['delete_cancel'])){
-      del_lock ($this->dn);
-    }
-
-
-    /********************
-      Edit entry finished (Save) 
-     ********************/
-
-    /* Finish acl edit is triggered by the tabulator dialog, so
-       the acl wants to save edited data. Check and save at this
-       point. */
-    if ((isset($_POST['edit_finish']) || isset($_POST['edit_apply'])) && (isset($this->acltabs->config))){
-
-      /* Check tabs, will feed message array */
-      $this->acltabs->save_object();
-      $message= $this->acltabs->check();
-
-      /* Save, or display error message? */
-      if (count($message) == 0){
-
-        /* Save acl data to ldap */
-        if($this->acltabs->save() == 1){
-          return;
-        }
-
-        if (!isset($_POST['edit_apply'])){
-
-          /* ACl has been saved successfully, remove lock from LDAP. */
-          if ($this->dn != "new"){
-            del_lock ($this->dn);
-          }
-
-          unset ($this->acltabs);
-          $this->acltabs= NULL;
-          unset ($_SESSION['objectinfo']);
-        }
-      } else {
-        /* Ok. There seem to be errors regarding to the tab data,
-           show message and continue as usual. */
-        show_errors($message);
-      }
-    }
-
-
-    /********************
-      Display subdialog 
-     ********************/
-
-
-    /* Show tab dialog if object is present */
-    if(isset($this->acltabs->config)){
-      
-      /* Save object */
-      $this->acltabs->save_object();
-      $display= $this->acltabs->execute();
-
-      /* Don't show buttons if tab dialog requests this */
-      if(isset($this->acltabs)){
-
-        /* Skip displaying save/cancel if there is a sub dialog open */
-        if (!isset($this->acltabs->dialog) || !$this->acltabs->dialog){
-          $display.= "<p style=\"text-align:right\">\n";
-//          $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
-          $display.= "&nbsp;\n";
-
-          /* Skip Apply if it is a new entry */
-          #if ($this->dn != "new"){
-          #  $display.= "<input type=submit name=\"edit_apply\" value=\""._("Apply")."\">\n";
-          #  $display.= "&nbsp;\n";
-          #}
-
-  //        $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
-          $display.= "</p>";
-        }
-      }
-      return ($display);
-    }
-    
-    /* Check if there is a snapshot dialog open */
-    $base = $this->DivListACL->selectedBase;
-    if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases())){
-      return($str);
-    }
-  
-    /* Return rendered main page */
-        /* Display dialog with system list */
-    $this->DivListACL->parent = $this;
-    $this->DivListACL->execute();
-
-    /* Add departments if subsearch is disabled */
-    if(!$this->DivListACL->SubSearch){
-      $this->DivListACL->AddDepartments($this->DivListACL->selectedBase,3,1);
-    }
-    $this->reload();
-    $this->DivListACL->setEntries($this->list);
-    return($this->DivListACL->Draw());
-  }
-
-
-  function reload()
-  {
-    /* Get divlist informations from filter part */
-    $Regex      = $this->DivListACL -> Regex;
-    $SubSearch  = $this->DivListACL -> SubSearch;
-    $base       = $this->DivListACL -> selectedBase; 
-    $Attrs      = array("ou","cn","description","gosaAclEntry","objectClass");
-    $res        = array();
-    $tmp        = array();                                    // Will contain temporary results 
-    $ldap       = $this->config->get_ldap_link();
-    $Filter     = "(&(objectClass=gosaACL)(gosaAclEntry=*)(|(cn=".$Regex.")(ou=".$Regex.")))";
-    $FilterRoles= "(&(objectClass=gosaRole)(|(cn=".$Regex.")(ou=".$Regex.")))";
-
-    /* Fetch following structures, this will be used if !$SubSearch */
-    $fetch_this = array(
-      "ME"      => array("TYPE" => "cat"    , "FLAGS" => GL_SIZELIMIT                ,"BASE"=>""),
-      "SYSTEMS" => array("TYPE" => "search" , "FLAGS" => GL_SIZELIMIT | GL_SUBSEARCH ,"BASE"=>"ou=systems,"),
-      "APPS"    => array("TYPE" => "search" , "FLAGS" => GL_SIZELIMIT | GL_SUBSEARCH ,"BASE"=>"ou=apps,"),
-      "PEOPLE"  => array("TYPE" => "search" , "FLAGS" => GL_SIZELIMIT | GL_SUBSEARCH ,"BASE"=>get_people_ou()),
-      "GROUPS"  => array("TYPE" => "search" , "FLAGS" => GL_SIZELIMIT | GL_SUBSEARCH ,"BASE"=>get_groups_ou()));
-
-    /* Subsearch ? */
-    if($SubSearch){
-
-      /* Get all object in this base */
-      $Flags        = GL_SIZELIMIT | GL_SUBSEARCH;
-      $fetch_base   = $base;
-      $tmp  = get_list($Filter,   "acl", $fetch_base, $Attrs, $Flags);
-      $tmp2 = get_list($FilterRoles,  "acl", $fetch_base, $Attrs, $Flags);
-      foreach($tmp as $entry){
-        $res[] = $entry;
-      }
-      foreach($tmp2 as $entry){
-        $res[] = $entry;
-      }
-
-    }else{
-
-      $tmp_roles = get_list($FilterRoles,  "acl", "ou=aclroles,".$base, $Attrs,GL_SIZELIMIT);
-
-      foreach($tmp_roles as $entry){
-        $res[] = $entry;
-      }
-
-      /* Walk through all possible bases */
-      foreach($fetch_this as $type => $data){
-
-        /* Get requried attributes */
-        $Flags        = $data['FLAGS'];
-        $fetch_base   = $data['BASE'].$base;
-        $Type         = $data['TYPE'];
-
-        /* Check if method is cat or search */
-        if($Type == "search"){
-          $tmp = get_list($Filter, "acl", $fetch_base, $Attrs, $Flags);
-          foreach($tmp as $entry){
-            $res[] = $entry;
-          }
-        }else{
-          $ldap->cat($fetch_base,$Attrs);
-          $attrs = $ldap->fetch();
-          if($attrs && isset($attrs['gosaAclEntry'])){
-            $re2 = preg_replace("/\*/",".*",$Regex);
-
-            if(!isset($attrs['ou']) && !isset($attrs['cn'])){
-              $namingAttr= preg_replace("/^[^=]*+=([^,]*),.*$/","\\1",$fetch_base);
-              if(preg_match("/".$re2."/i",$namingAttr)){
-                $res[] = $attrs;
-              }
-            }elseif( (isset($attrs['cn'][0]) && preg_match("/".$re2."/i",$attrs['cn'][0]))
-               ||(isset($attrs['ou'][0]) && preg_match("/".$re2."/i",$attrs['ou'][0]))){
-              $res[] = $attrs;
-            }
-          }
-        }
-      }
-    }
-    $this->list = $res;
-  }
-
-
-  function copyPasteHandling_from_queue($s_action,$s_entry)
-  {
-    /* Check if Copy & Paste is disabled */
-    if(!is_object($this->CopyPasteHandler)){
-      return("");
-    }
-
-    /* Add a single entry to queue */
-    if($s_action == "cut" || $s_action == "copy"){
-
-      /* Cleanup object queue */
-      $this->CopyPasteHandler->cleanup_queue();
-      $dn = $this->list[$s_entry]['dn'];
-  
-      if(isset($this->list[$s_entry]['objectClass']) && in_array("gosaRole",$this->list[$s_entry]['objectClass'])){
-        $this->CopyPasteHandler->add_to_queue($dn,$s_action,"aclroletab","ACLROLETAB","aclroles");
-      }
-    }
-
-    /* Add entries to queue */
-    if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
-
-      /* Cleanup object queue */
-      $this->CopyPasteHandler->cleanup_queue();
-
-      /* Add new entries to CP queue */
-      foreach($this->list_get_selected_items() as $id){
-        $dn = $this->list[$id]['dn'];
-
-        if(isset($this->list[$id]['objectClass']) && in_array("gosaRole",$this->list[$id]['objectClass'])){
-
-          if($s_action == "copy_multiple"){
-            $this->CopyPasteHandler->add_to_queue($dn,"copy","aclroletab","ACLROLETAB","aclroles");
-          }
-          if($s_action == "cut_multiple"){
-            $this->CopyPasteHandler->add_to_queue($dn,"cut","aclroletab","ACLROLETAB","aclroles");
-          }
-        }
-      }
-    }
-
-    /* Start pasting entries */
-    if($s_action == "editPaste"){
-      $this->start_pasting_copied_objects = TRUE;
-    }
-    /* Return C&P dialog */
-    if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
-
-      /* Load entry from queue and set base */
-      $this->CopyPasteHandler->load_entry_from_queue();
-      $this->CopyPasteHandler->SetVar("base",$this->DivListACL->selectedBase);
-
-      /* Get dialog */
-      $data = $this->CopyPasteHandler->execute();
-
-      /* Return dialog data */
-      if(!empty($data)){
-        return($data);
-      }
-    }
-
-    /* Automatically disable status for pasting */
-    if(!$this->CopyPasteHandler->entries_queued()){
-      $this->start_pasting_copied_objects = FALSE;
-    }
-    return("");
-  }
-
-
-  function list_get_selected_items()
-  {
-    $ids = array();
-    foreach($_POST as $name => $value){
-      if(preg_match("/^item_selected_[0-9]*$/",$name)){
-        $id   = preg_replace("/^item_selected_/","",$name);
-        $ids[$id] = $id;
-      }
-    }
-    return($ids);
-  }
-
-
-  function remove_lock()
-  {
-    /* Remove acl lock if a DN is marked as "currently edited" */
-    if (isset($this->acltabs->dn)){
-      del_lock ($this->acltabs->dn);
-    }
-  }
-
-
-  function save_object()
-  {
-    /* Handle divlist filter && department selection*/
-    if(!is_object($this->acltabs)){
-      $this->DivListACL->save_object();
-    }
-  }
-
-  /* A set of disabled and therefore overloaded functions. They are
-     not needed in this class. */
-  function remove_from_parent() { } 
-  function check() { } 
-
-  function save() {
-    echo "SAVE ACL";
-  } 
-
-  function adapt_from_template($dn) { } 
-  function password_change_needed() { } 
-
-
-  /* Return departments, that will be included within snapshot detection */
-  function get_used_snapshot_bases()
-  {
-    return(array());
-  }  
-
-} 
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/acl/class_aclRole.inc b/plugins/admin/acl/class_aclRole.inc
deleted file mode 100644 (file)
index 18bf440..0000000
+++ /dev/null
@@ -1,686 +0,0 @@
-<?php
-
-class aclrole extends acl
-{
-  /* Definitions */
-  var $plHeadline= "Access control list templates";
-  var $plDescription= "This does something";
-
-  /* attribute list for save action */
-  var $attributes= array('gosaAclTemplate',"cn","description");
-  var $objectclasses= array('top','gosaRole');
-
-  /* Helpers */
-  var $dialogState= "head";
-  var $aclType= "";
-  var $aclObject= "";
-  var $aclContents= array();
-  var $target= "group";
-  var $aclTypes= array();
-  var $aclObjects= array();
-  var $recipients= array();
-  var $isContainer= TRUE;
-  var $currentIndex= 0;
-  var $wasNewEntry= FALSE;
-  var $ocMapping= array();
-  var $savedAclContents= array();
-  var $myAclObjects = array();
-
-  /* Role attributes */
-  var $gosaAclTemplate= "";
-  var $cn = "";
-  var $description = "";
-  var $orig_dn;
-  var $base ="";
-
-  function aclrole (&$config,  $dn= NULL)
-  {
-    /* Include config object */
-    plugin::plugin($config, $dn);
-
-    if($this->dn == "new"){
-      $this->base = $_SESSION['CurrentMainBase'];
-    }else{
-      $this->base = preg_replace("/^[^,]+,[^,]+,/","",$this->dn);
-      new log("view","aclroles/".get_class($this),$this->dn);
-    }
-   
-    /* Load ACL's */
-    $this->gosaAclTemplate= array();
-    if (isset($this->attrs["gosaAclTemplate"])){
-      for ($i= 0; $i<$this->attrs["gosaAclTemplate"]['count']; $i++){
-        $acl= $this->attrs["gosaAclTemplate"][$i];
-        $this->gosaAclTemplate= array_merge($this->gosaAclTemplate, $this->explodeACL($acl));
-      }
-    }
-    ksort($this->gosaAclTemplate);
-
-    /* Extract available categories from plugin info list */
-    $tmp= get_global('plist');
-    $plist= $tmp->info;
-    $oc = array();
-    foreach ($plist as $class => $acls){
-
-      /* Only feed categories */
-      if (isset($acls['plCategory'])){
-
-        /* Walk through supplied list and feed only translated categories */
-        foreach($acls['plCategory'] as $idx => $data){
-
-          /* Non numeric index means -> base object containing more informations */
-          if (preg_match('/^[0-9]+$/', $idx)){
-            if (!isset($this->ocMapping[$data])){
-              $this->ocMapping[$data]= array();
-              $this->ocMapping[$data][]= '0';
-            }
-            $this->ocMapping[$data][]= $class;
-          } else {
-            if (!isset($this->ocMapping[$idx])){
-              $this->ocMapping[$idx]= array();
-              $this->ocMapping[$idx][]= '0';
-            }
-            $this->ocMapping[$idx][]= $class;
-            $this->aclObjects[$idx]= $data['description'];
-
-            /* Additionally filter the classes we're interested in in "self edit" mode */
-            if (is_array($data['objectClass'])){
-              foreach($data['objectClass'] as $objectClass){
-                if (in_array_ics($objectClass, $oc)){
-                  $this->myAclObjects[$idx.'/'.$class]= $acls['plDescription'];
-                  break;
-                }
-              }
-            } else {
-              if (in_array_ics($data['objectClass'], $oc)){
-                $this->myAclObjects[$idx.'/'.$class]= $acls['plDescription'];
-              }
-            }
-          }
-
-        }
-      }
-    }
-    $this->aclObjects['all']= '*&nbsp;'._("All categories");
-    $this->ocMapping['all']= array('0' => 'all');
-
-    /* Sort categories */
-    asort($this->aclObjects);
-
-    /* Fill acl types */
-    $this->aclTypes= array( "reset" => _("Reset ACLs"),
-                             "one" => _("One level"),
-                             "base" => _("Current object"),
-                             "sub" => _("Complete subtree"),
-                             "psub" => _("Complete subtree (permanent)"));
-    asort($this->aclTypes);
-
-    /* Finally - we want to get saved... */
-    $this->is_account= TRUE;
-  }
-
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* Base select dialog */
-    $once = true;
-    foreach($_POST as $name => $value){
-      if((preg_match("/^chooseBase/",$name) && $once) && ($this->acl_is_moveable())){
-        $once = false;
-        $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
-        $this->dialog->setCurrentBase($this->base);
-      }
-    }
-
-    /* Dialog handling */
-    if(is_object($this->dialog)){
-      /* Must be called before save_object */
-      $this->dialog->save_object();
-
-      if($this->dialog->isClosed()){
-        $this->dialog = false;
-      }elseif($this->dialog->isSelected()){
-
-        /* Check if selected base is valid */
-        $tmp = $this->get_allowed_bases();
-        if(isset($tmp[$this->dialog->isSelected()])){
-          $this->base = $this->dialog->isSelected();
-        }
-        $this->dialog= false;
-      }else{
-        return($this->dialog->execute());
-      }
-    }
-
-    $tmp= get_global('plist');
-    $plist= $tmp->info;
-
-    /* Handle posts */
-    if (isset($_POST['new_acl'])){
-      $this->dialogState= 'create';
-      $this->dialog= TRUE;
-      $this->currentIndex= count($this->gosaAclTemplate);
-      $this->loadAclEntry(TRUE);
-    }
-
-    $new_acl= array();
-    $aclDialog= FALSE;
-    $firstedit= FALSE;
-    foreach($_POST as $name => $post){
-
-      /* Actions... */
-      if (preg_match('/^acl_edit_.*_x/', $name)){
-        $this->dialogState= 'create';
-        $firstedit= TRUE;
-        $this->dialog= TRUE;
-        $this->currentIndex= preg_replace('/^acl_edit_([0-9]+).*$/', '\1', $name);
-        $this->loadAclEntry();
-        continue;
-      }
-      if (preg_match('/^acl_del_.*_x/', $name)){
-        unset($this->gosaAclTemplate[preg_replace('/^acl_del_([0-9]+).*$/', '\1', $name)]);
-        continue;
-      }
-
-      if (preg_match('/^cat_edit_.*_x/', $name)){
-        $this->aclObject= preg_replace('/^cat_edit_([^_]+)_.*$/', '\1', $name);
-        $this->dialogState= 'edit';
-        foreach ($this->ocMapping[$this->aclObject] as $oc){
-          if (isset($this->aclContents[$oc])){
-            $this->savedAclContents[$oc]= $this->aclContents[$oc];
-          }
-        }
-        continue;
-      }
-      if (preg_match('/^cat_del_.*_x/', $name)){
-        $idx= preg_replace('/^cat_del_([^_]+)_.*$/', '\1', $name);
-        foreach ($this->ocMapping[$idx] as $key){
-          unset($this->aclContents["$idx/$key"]);
-        }
-        continue;
-      }
-
-      /* Sorting... */
-      if (preg_match('/^sortup_.*_x/', $name)){
-        $index= preg_replace('/^sortup_([0-9]+).*$/', '\1', $name);
-        if ($index > 0){
-          $tmp= $this->gosaAclTemplate[$index];
-          $this->gosaAclTemplate[$index]= $this->gosaAclTemplate[$index-1];
-          $this->gosaAclTemplate[$index-1]= $tmp;
-        }
-        continue;
-      }
-      if (preg_match('/^sortdown_.*_x/', $name)){
-        $index= preg_replace('/^sortdown_([0-9]+).*$/', '\1', $name);
-        if ($index < count($this->gosaAclTemplate)-1){
-          $tmp= $this->gosaAclTemplate[$index];
-          $this->gosaAclTemplate[$index]= $this->gosaAclTemplate[$index+1];
-          $this->gosaAclTemplate[$index+1]= $tmp;
-        }
-        continue;
-      }
-
-      /* ACL saving... */
-      if (preg_match('/^acl_.*_[^xy]$/', $name)){
-        $aclDialog= TRUE;
-        list($dummy, $object, $attribute, $value)= split('_', $name);
-
-        /* Skip for detection entry */
-        if ($object == 'dummy') {
-          continue;
-        }
-
-        /* Ordinary ACLs */
-        if (!isset($new_acl[$object])){
-          $new_acl[$object]= array();
-        }
-        if (isset($new_acl[$object][$attribute])){
-          $new_acl[$object][$attribute].= $value;
-        } else {
-          $new_acl[$object][$attribute]= $value;
-        }
-      }
-    }
-    
-    /* Only be interested in new acl's, if we're in the right _POST place */
-    if ($aclDialog && $this->aclObject != "" && is_array($this->ocMapping[$this->aclObject])){
-
-      foreach ($this->ocMapping[$this->aclObject] as $oc){
-        unset($this->aclContents[$oc]);
-        unset($this->aclContents[$this->aclObject.'/'.$oc]);
-        if (isset($new_acl[$oc])){
-          $this->aclContents[$oc]= $new_acl[$oc];
-        }
-        if (isset($new_acl[$this->aclObject.'/'.$oc])){
-          $this->aclContents[$this->aclObject.'/'.$oc]= $new_acl[$this->aclObject.'/'.$oc];
-        }
-      }
-    }
-
-    /* Save new acl in case of base edit mode */
-    if (1 == 0 && $this->aclType == 'base' && !$firstedit){
-      $this->aclContents= $new_acl;
-    }
-
-    /* Cancel new acl? */
-    if (isset($_POST['cancel_new_acl'])){
-      $this->dialogState= 'head';
-      $this->dialog= FALSE;
-      if ($this->wasNewEntry){
-        unset ($this->gosaAclTemplate[$this->currentIndex]);
-      }
-    }
-
-    /* Store ACL in main object? */
-    if (isset($_POST['submit_new_acl'])){
-      $this->gosaAclTemplate[$this->currentIndex]['type']= $this->aclType;
-      $this->gosaAclTemplate[$this->currentIndex]['members']= $this->recipients;
-      $this->gosaAclTemplate[$this->currentIndex]['acl']= $this->aclContents;
-      $this->dialogState= 'head';
-      $this->dialog= FALSE;
-    }
-
-    /* Cancel edit acl? */
-    if (isset($_POST['cancel_edit_acl'])){
-      $this->dialogState= 'create';
-      foreach ($this->ocMapping[$this->aclObject] as $oc){
-        if (isset($this->savedAclContents[$oc])){
-          $this->aclContents[$oc]= $this->savedAclContents[$oc];
-        }
-      }
-    }
-
-    /* Save edit acl? */
-    if (isset($_POST['submit_edit_acl'])){
-      $this->dialogState= 'create';
-    }
-
-    /* Add acl? */
-    if (isset($_POST['add_acl']) && $_POST['aclObject'] != ""){
-      $this->dialogState= 'edit';
-      $this->savedAclContents= array();
-      foreach ($this->ocMapping[$this->aclObject] as $oc){
-        if (isset($this->aclContents[$oc])){
-          $this->savedAclContents[$oc]= $this->aclContents[$oc];
-        }
-      }
-    }
-
-    /* Save common values */
-    foreach (array("aclType", "aclObject", "target") as $key){
-      if (isset($_POST[$key])){
-        $this->$key= validate($_POST[$key]);
-      }
-    }
-
-    /* Create templating instance */
-    $smarty= get_smarty();
-
-    $smarty->assign("bases", $this->get_allowed_bases());
-    $smarty->assign("base_select", $this->base);
-
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translation){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-
-    if ($this->dialogState == 'head'){
-      /* Draw list */
-      $aclList= new divSelectBox("aclList");
-      $aclList->SetHeight(350);
-      
-      /* Fill in entries */
-      foreach ($this->gosaAclTemplate as $key => $entry){
-        $field1= array("string" => $this->aclTypes[$entry['type']], "attach" => "style='width:100px'");
-        $field2= array("string" => $this->assembleAclSummary($entry));
-        $action= "<input type='image' name='sortup_$key' alt='up' title='"._("Up")."' src='images/sort_up.png' align='top'>";
-        $action.= "<input type='image' name='sortdown_$key' alt='down' title='"._("Down")."' src='images/sort_down.png'>";
-        $action.= "<input class='center' type='image' src='images/edit.png' alt='"._("edit")."' name='acl_edit_$key' title='"._("Edit ACL")."'>";
-        $action.= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."' name='acl_del_$key' title='"._("Delete ACL")."'>";
-
-        $field3= array("string" => $action, "attach" => "style='border-right:0px;width:50px;text-align:right;'");
-        $aclList->AddEntry(array($field1, $field2, $field3));
-      }
-
-      $smarty->assign("aclList", $aclList->DrawList());
-    }
-
-    if ($this->dialogState == 'create'){
-      /* Draw list */
-      $aclList= new divSelectBox("aclList");
-      $aclList->SetHeight(450);
-
-      /* Add settings for all categories to the (permanent) list */
-      foreach ($this->aclObjects as $section => $dsc){
-        $summary= "";
-        foreach($this->ocMapping[$section] as $oc){
-          if (isset($this->aclContents[$oc]) && count($this->aclContents[$oc]) && isset($this->aclContents[$oc][0]) &&
-              $this->aclContents[$oc][0] != ""){
-
-            $summary.= "$oc, ";
-            continue;
-          }
-          if (isset($this->aclContents["$section/$oc"]) && count($this->aclContents["$section/$oc"]) && isset($this->aclContents["$section/$oc"][0]) &&
-              $this->aclContents["$section/$oc"][0] != ""){
-
-            $summary.= "$oc, ";
-            continue;
-          }
-          if (isset($this->aclContents[$oc]) && !isset($this->aclContents[$oc][0]) && count($this->aclContents[$oc])){
-            $summary.= "$oc, ";
-          }
-        }
-
-        /* Set summary... */
-        if ($summary == ""){
-          $summary= '<i>'._("No ACL settings for this category").'</i>';
-        } else {
-          $summary= sprintf(_("Contains ACLs for these objects: %s"), preg_replace('/, $/', '', $summary));
-        }
-
-        $field1= array("string" => $dsc, "attach" => "style='width:140px'");
-        $field2= array("string" => $summary);
-        $action= "<input class='center' type='image' src='images/edit.png' alt='"._("edit")."' name='cat_edit_$section' title='"._("Edit categories ACLs")."'>";
-        $action.= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."' name='cat_del_$section' title='"._("Clear categories ACLs")."'>";
-        $field3= array("string" => $action, "attach" => "style='border-right:0px;width:50px'");
-        $aclList->AddEntry(array($field1, $field2, $field3));
-      }
-
-      $smarty->assign("aclList", $aclList->DrawList());
-      $smarty->assign("aclType", $this->aclType);
-      $smarty->assign("aclTypes", $this->aclTypes);
-      $smarty->assign("target", $this->target);
-
-      if ($this->aclType == 'base'){
-        $smarty->assign('aclSelector', $this->buildAclSelector($this->myAclObjects));
-      }
-    }
-
-    if ($this->dialogState == 'edit'){
-      $smarty->assign('headline', sprintf(_("Edit ACL for '%s', scope is '%s'"), $this->aclObjects[$this->aclObject], $this->aclTypes[$this->aclType]));
-
-      /* Collect objects for selected category */
-      foreach ($this->ocMapping[$this->aclObject] as $idx => $class){
-        if ($idx == 0){
-          continue;
-        }
-        $aclObjects[$this->aclObject.'/'.$class]= $plist[$class]['plDescription'];
-      }
-      if ($this->aclObject == 'all'){
-        $aclObjects['all']= _("All objects in current subtree");
-      }
-      $smarty->assign('aclSelector', $this->buildAclSelector($aclObjects));
-    }
-
-    /* Show main page */
-    $smarty->assign("dialogState", $this->dialogState);
-
-    /* Assign cn and decription if this is a role */
-    foreach(array("cn","description") as $name){
-      $smarty->assign($name,$this->$name);
-    }
-    return ($smarty->fetch (get_template_path('acl_role.tpl',dirname(__FILE__))));
-  }
-
-  function sort_by_priority($list)
-  {
-    $tmp= get_global('plist');
-    $plist= $tmp->info;
-    asort($plist);
-    $newSort = array();
-
-    foreach($list as $name => $translation){
-      $na  =  preg_replace("/^.*\//","",$name);
-      if (!isset($plist[$na]['plPriority'])){
-        $prio= 0;
-      } else {
-        $prio=  $plist[$na]['plPriority'] ;
-      }
-
-      $newSort[$name] = $prio;
-    }
-
-    asort($newSort);
-
-    $ret = array();
-    foreach($newSort as $name => $prio){
-      $ret[$name] = $list[$name];
-    }
-    return($ret);
-  }
-
-  function loadAclEntry($new= FALSE)
-  {
-    /* New entry gets presets... */
-    if ($new){
-      $this->aclType= 'sub';
-      $this->recipients= array();
-      $this->aclContents= array();
-    } else {
-      $acl= $this->gosaAclTemplate[$this->currentIndex];
-      $this->aclType= $acl['type'];
-      $this->recipients= $acl['members'];
-      $this->aclContents= $acl['acl'];
-    }
-
-    $this->wasNewEntry= $new;
-  }
-
-
-  function aclPostHandler()
-  {
-    if (isset($_POST['save_acl'])){
-      $this->save();
-      return TRUE;
-    }
-
-    return FALSE;
-  }
-
-
-  function save()
-  {
-    /* Assemble ACL's */
-    $tmp_acl= array();
-    foreach ($this->gosaAclTemplate as $prio => $entry){
-      $final= "";
-      $members= "";
-      if (isset($entry['members'])){
-        foreach ($entry['members'] as $key => $dummy){
-          $members.= base64_encode(preg_replace('/^.:/', '', $key)).',';
-        }
-      }
-      $final= $prio.":".$entry['type'].":".preg_replace('/,$/', '', $members);
-
-      /* ACL's if needed */
-      if ($entry['type'] != "reset" && $entry['type'] != "role"){
-        $acl= ":";
-        if (isset($entry['acl'])){
-          foreach ($entry['acl'] as $object => $contents){
-
-            /* Only save, if we've some contents in there... */
-            if (count($contents)){
-              $acl.= $object.";";
-
-              foreach($contents as $attr => $permission){
-
-                /* First entry? Its the one for global settings... */
-                if ($attr == '0'){
-                  $acl.= $permission;
-                } else {
-                  $acl.= '#'.$attr.';'.$permission;
-                }
-
-              }
-              $acl.= ',';
-            }
-            
-          }
-        }
-        $final.= preg_replace('/,$/', '', $acl);
-      }
-
-      $tmp_acl[]= $final;
-    } 
-
-    /* Call main method */
-    plugin::save();
-
-    /* Finally (re-)assign it... */
-    $this->attrs["gosaAclTemplate"]= $tmp_acl;
-
-    /* Remove acl from this entry if it is empty... */
-    if (!count($tmp_acl)){
-      /* Remove attribute */
-      if ($this->initially_was_account){
-        $this->attrs["gosaAclTempalte"]= array();
-      } else {
-        if (isset($this->attrs["gosaAclTemplate"])){
-          unset($this->attrs["gosaAclTemplate"]);
-        }
-      }
-    }
-
-    /* Do LDAP modifications */
-    $ldap= $this->config->get_ldap_link();
-
-    /* Check if object already exists */
-    $ldap->cat($this->dn);
-    if($ldap->count()){
-      $ldap->cd($this->dn);
-      $this->cleanup();
-      $ldap->modify ($this->attrs);
-      new log("modify","aclroles/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }else{
-      $ldap->cd($this->config->current['BASE']);
-      $ldap->create_missing_trees(preg_replace("/^[^,]+,/","",$this->dn));
-      $ldap->cd($this->dn);
-      $ldap->add($this->attrs);
-      new log("create","aclroles/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }
-
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving ACLs with dn '%s' failed."),$this->dn));
-
-    /* Refresh users ACLs */
-    $ui= get_userinfo();
-    $ui->loadACL();
-    $_SESSION['ui']= $ui;
-  }
-
-
-  function remove_from_parent()
-  {
-    $ldap = $this->config->get_ldap_link();
-    $serach_for = "*:role:".base64_encode($this->dn).":*"; 
-    $ldap->search ("(&(objectClass=gosaACL)(gosaAclEntry=".$serach_for."))",array('dn','cn','sn','givenName','uid'));
-    $all_names = "";
-
-
-    $cnt = 3;
-    while(($attrs = $ldap->fetch()) && $cnt){
-      $name = $attrs['dn'];
-      $name = preg_replace("/[ ]/","&nbsp;",$name);
-      $name = "<i>'".$name."'</i>";
-      $all_names .= $name.", ";
-      $cnt --;
-    }
-
-    if(!empty($all_names)){
-      $all_names = preg_replace("/, $/","",$all_names);
-      if(!$cnt){
-        $all_names .= ", ...";
-      }
-      $all_names = "<span style='text-align:left;'>".$all_names."</span>";
-      print_red(sprintf(_("This role can't be removed while it is in use. Follwing objects are using this role %s"),$all_names));
-      return;
-    }
-        
-    $ldap->rmDir($this->dn);
-    new log("remove","aclroles/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    show_ldap_error($ldap->get_error(), sprintf(_("Removing of aclRole with dn '%s' failed."),$this->dn));
-
-    /* Optionally execute a command after we're done */
-    $this->handle_post_events("remove");
-
-    /* Delete references to object groups */
-    $ldap->cd ($this->config->current['BASE']);
-    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
-    while ($ldap->fetch()){
-      $og= new ogroup($this->config, $ldap->getDN());
-      unset($og->member[$this->dn]);
-      $og->save ();
-      show_ldap_error($ldap->get_error(), sprintf(_("Removing aclRole from objectgroup '%s' failed"), $og->dn));
-    }
-  }
-
-
-  function save_object()
-  {
-    plugin::save_object();
-    if(isset($_POST['acl_role_posted'])){
-     
-      /* Get base selection */
-      if(isset($_POST['base'])){
-        $tmp = $this->get_allowed_bases();
-        if(isset($tmp[$_POST['base']])){
-          $this->base = $_POST['base'];
-        }
-      }
-    }
-  }
-
-
-  function saveCopyDialog()
-  {
-    if(isset($_POST['cn'])){
-      $this->cn = $_POST['cn'];
-    }
-  }
-  
-
-  function getCopyDialog()
-  {
-    $smarty = get_smarty();
-    $smarty->assign("cn",$this->cn);
-    $str = $smarty->fetch(get_template_path("paste_role.tpl",TRUE,dirname(__FILE__)));
-    $ret = array();
-    $ret['string'] = $str;
-    $ret['status'] = "";
-    return($ret);
-  }
-
-  
-  function PrepareForCopyPaste($source)
-  {
-    plugin::PrepareForCopyPaste($source);
-    
-    $source_o = new aclrole($this->config,$source['dn']);
-    $this->gosaAclTemplate = $source_o->gosaAclTemplate;
-  }
-  
-
-  /* Return plugin informations for acl handling  */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName" => _("Role"),
-          "plDescription" => _("ACL roles"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 0,
-          "plSection"     => array("admin"),
-          "plCategory"    => array("aclroles" => array("objectClass" => "gosaRole", "description" => _("Acl roles"))),
-
-          "plProvidedAcls"    => array(
-            "cn"                => _("Name"),
-            "base"              => _("Base"),
-            "description"       => _("Description"))
-        ));
-  }
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/acl/class_divListACL.inc b/plugins/admin/acl/class_divListACL.inc
deleted file mode 100644 (file)
index 7da9936..0000000
+++ /dev/null
@@ -1,306 +0,0 @@
-<?php
-
-class divListACL extends MultiSelectWindow
-{
-
-  /* Current base */
-  var $selectedBase       = "";
-  var $departments        = array();
-
-  /* Regex */
-  var $Regex              = "*";
-
-  /* CheckBoxes */
-
-  /* Subsearch checkbox */
-  var $SubSearch              = false;
-
-  var $parent             ;
-  var $ui                 ;
-  var $action_col_size;
-  
-
-  function divListACL (&$config, &$parent)
-  {
-    MultiSelectWindow::MultiSelectWindow($config, "ACLs", "acl");
-    
-    $this->parent       = &$parent;
-    $this->ui           = get_userinfo();
-
-    /* Set list strings */
-    $this->SetTitle(_("List of acl"));
-    $this->SetSummary(_("List of acls"));
-
-    /* Result page will look like a headpage */
-    $this->SetHeadpageMode();
-    $this->SetInformation(_("This menu allows you to edit and delete selected acls."));
-
-    $this->EnableAplhabet   (true);
-  
-    /* Disable buttonsm */
-    $this->EnableCloseButton(false);
-    $this->EnableSaveButton (false);
-
-    /* Dynamic action col */
-    $this->action_col_size = 120;
-
-    /* Toggle all selected / deselected */
-    $chk = "<input type='checkbox' id='select_all' name='select_all'
-      onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
-
-    /* set Page header */
-    $this->AddHeader(array("string"=> $chk,          "attach"=>"style='width:20px;'"));
-    $this->AddHeader(array("string"=>"&nbsp;",          "attach"=>"style='width:20px;'"));
-    $this->AddHeader(array("string"=>_("Summary")));
-    $this->AddHeader(array("string"=>_("Actions"),      "attach" => "style='width:".$this->action_col_size."px;border-right:0px;text-align:right;'"));
-
-    /* Set dynamically filter checkboxes */
-    $this->set_filter_objectclasses();   
-    /* Add SubSearch checkbox */
-    $this->AddCheckBox("SubSearch",  _("Select to search within subtrees"), _("Ignore subtrees"), false);
-
-
-    /*                  Name                 ,Text                              ,Default  , Connect with alphabet  */
-    $this->AddRegex   ("Regex",     _("Display acls matching"),"*" , true);
-  }
-
-
-  function GenHeader()
-  {
-     /* Prepare departments,
-       which are shown in the listbox on top of the listbox
-     */
-    $options= "";
-    $Copy_Paste = "";
-
-    /* Get all departments within this subtree */
-    $ui= get_userinfo();
-    $first = "";
-    $found = FALSE;
-    $base = $this->config->current['BASE'];
-
-    /* Add base */
-    $tmp = array();
-    $tmp[] = array("dn"=>$this->config->current['BASE']);
-    $tmp=  array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
-                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
-
-    $deps = array();
-    foreach($tmp as $tm){
-      $deps[$tm['dn']] = $tm['dn'];
-    }
-
-    /* Load possible departments */
-    $ui= get_userinfo();
-    $tdeps= $ui->get_module_departments("acl");
-    $ids = $this->config->idepartments;
-    $first = "";
-    $found = FALSE;
-    foreach($ids as $dep => $name){
-      if(isset($deps[$dep]) && in_array_ics($dep, $tdeps)){
-
-        /* Keep first base dn in mind, we could need this
-         *  info if no valid base was found
-         */
-        if(empty($first)) {
-          $first = $dep['dn'];
-        }
-
-        $value = $ids[$dep];
-        if ($this->selectedBase == $dep){
-          $found = TRUE;
-          $options.= "<option selected='selected' value='".$dep."'>$value</option>";
-        } else {
-          $options.= "<option value='".$dep."'>$value</option>";
-        }
-      }
-    }
-
-    /* The currently used base is not visible with your acl setup.
-     * Set base to first useable base.
-     */
-    if(!$found){
-      $this->selectedBase = $first;
-    }
-
-    /* Allow copy & paste for roles */ 
-    $acl_all  = $ui->has_complete_category_acls($this->selectedBase,"acl");
-    $acl      = $ui->get_permissions($this->selectedBase,"acl/acl");
-
-    /* Add default header */
-    $listhead = MultiSelectWindow::get_default_header();
-    $listhead .=  
-      _("Base")."&nbsp;<select name='CurrentMainBase' 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;";
-
-
-    /* Create Layers menu */
-    $s  = ".|"._("Actions")."|\n";
-    $s .= "..|<img src='images/list_new.png' alt='' border='0' class='center'>".
-      "&nbsp;"._("Create")."|\n";
-
-    /* Append create options */
-    if(preg_match("/c/",$acl)) {
-      $s.= "...|<input class='center' type='image' src='images/list_new_acl_role.png' alt=''>".
-        "&nbsp;"._("Role")."|new_acl_role|\n";
-    }
-
-    /* Multiple options */
-    $s.= "..|---|\n";
-    $s.= "..|<img src='images/edittrash.png' alt='' border='0' class='center'>".
-      "&nbsp;"._("Remove")."|"."remove_multiple|\n";
-
-    /* Add multiple copy & cut icons */
-    if(is_object($this->parent->CopyPasteHandler)){
-      $s.= "..|---|\n";
-      $s.= "..|<img src='images/editcopy.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Copy")."|"."multiple_copy_systems|\n";
-      $s.= "..|<img src='images/editcut.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Cut")."|"."multiple_cut_systems|\n";
-
-      if($this->parent->CopyPasteHandler->entries_queued()){
-        $img = "<img border='0' class='center' src='images/editpaste.png' alt=''>";
-        $s.="..|".$img."&nbsp;"._("Paste")."|editPaste|\n";
-      }else{
-        $img = "<img border='0' class='center' src='images/cant_editpaste.png' alt=''>";
-        $s.="..|".$img."&nbsp;"._("Paste")."\n";
-      }
-    }
-
-    /* Add snapshot icons */
-    if(preg_match("/(c.*w|w.*c)/",$acl_all)){
-      $str = $this->get_snapshot_header(TRUE) ;
-      if(!empty($str)){
-        $s .= "..|---|\n";
-        $s .= $str;
-      }
-    }
-
-    $this->SetDropDownHeaderMenu($s);
-    $this->SetListHeader($listhead);
-  }
-
-  /* so some basic settings */
-  function execute()
-  {
-    $this->ClearElementsList();
-    $this->GenHeader();
-  }
-
-  function setEntries($list)
-  {
-
-    foreach($list as $key => $acl_entry){
-
-      /* Get copy & paste icon */
-      $acl        = $this->ui->get_permissions($acl_entry['dn'],"acl/acl");
-      $acl_all    = $this->ui->has_complete_category_acls($acl_entry['dn'],"acl");
-      $action     = "";
-
-      if(in_array("gosaRole",$acl_entry['objectClass'])){
-
-        /* Role handling */
-        $editlink       = "<a href='?plug=".$_GET['plug']."&amp;id=%s&amp;act=list_edit_role'>%s</a>";
-        $list_left_icon = "<img src='images/select_acl_role.png' alt='"._("Role")."'>";
-        $cn = htmlentities(utf8_decode($acl_entry['cn'][0])) ;
-
-        if(isset($acl_entry['description'][0])){
-          $cn .= "&nbsp;[".$acl_entry['description'][0]."]";
-        }
-
-        /* Add copy & paste handler */
-        if(($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
-          $action.= "<input class='center' type='image'
-            src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
-          $action.= "<input class='center' type='image'
-            src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
-        }
-
-        /* Add actions depending on acls */
-        if(preg_match("/r/", $acl)){
-          $action.= "<input class='center' type='image' src='images/edit.png' alt='"._("edit")."'     
-            name='list_acl_role_edit_%KEY%' title='"._("Edit acl role")."'>";
-        }
-
-        /* Add snapshot functionality */
-        if(preg_match("/(c.*w|w.*c)/", $acl_all)){
-          $action.= $this->GetSnapShotActions($acl_entry['dn']);
-        }
-
-        if(preg_match("/d/", $acl)){
-          $action.= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."' 
-            name='list_acl_role_del_%KEY%' title='"._("Delete acl role")."'>";
-        }
-      }else{
-
-        /* Acl handling */
-        $editlink       = "<a href='?plug=".$_GET['plug']."&amp;id=%s&amp;act=list_edit_entry'>%s</a>";
-        $list_left_icon = "<img src='images/select_acl.png' alt='"._("Acl")."'>";
-        $cn = htmlentities(utf8_decode($acl_entry['dn'])); 
-
-        /* Add actions depending on acls */
-        if(preg_match("/r/", $acl)){
-          $action.= "<input class='center' type='image' src='images/edit.png' alt='"._("edit")."'     
-            name='list_acl_edit_%KEY%' title='"._("Edit acl")."'>";
-        }
-        if(preg_match("/d/", $acl)){
-          $action.= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."' 
-            name='list_acl_del_%KEY%' title='"._("Delete acl")."'>";
-        }
-      }
-
-      if(in_array("gosaRole",$acl_entry['objectClass'])){
-        $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
-            "attach" => "style='width:20px;'");
-      }else{
-        $field0 = array("string" => "", "attach" => "style='width:20px;'");
-      }
-
-      /* Cutted objects should be displayed in light grey */
-      $display = $cn;
-      if($this->parent->CopyPasteHandler){
-        foreach($this->parent->CopyPasteHandler->queue as $queue_key => $queue_data){
-          if($queue_data['dn'] == $acl_entry['dn']) {
-            $display = "<font color='#999999'>".$display."</font>";
-            break;
-          }
-        }
-      }
-  
-      $field1 = array("string" => $list_left_icon, "attach"=> "style='text-align:center;width:20px;'");
-      $field2 = array("string" => sprintf($editlink,$key,$display)."&nbsp;","attach" => "");
-      $field3 = array("string" => preg_replace("/%KEY%/",$key,$action), "attach"=> "style='text-align:right;width:".$this->action_col_size."px;border-right:0px;'");
-      $this->AddElement(array($field0,$field1,$field2,$field3));
-    }
-  }
-
-  function Save()
-  {
-    MultiSelectWindow :: Save();  
-  }
-
-  function save_object()
-  {
-    /* Save automatic created POSTs like regex, checkboxes */
-    MultiSelectWindow::save_object();   
-  }
-
-
-  /* Add some additional checkboxes to the filter part, this should be generated dynamically. */
-  function set_filter_objectclasses()
-  { 
-  }
-  
-  /* Return objectClass names used in filter part */  
-  function get_filter_objectclasses()
-  {
-    return(array("gosaAccount","gosaDepartment"));
-  }
-
-
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/acl/main.inc b/plugins/admin/acl/main.inc
deleted file mode 100644 (file)
index bea89a9..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-<?php
-/*
-  This code is part of GOsa (https://gosa.gonicus.de)
-  Copyright (C) 2006  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
-*/
-
-if ($remove_lock){
-        if(isset($_SESSION['macl'])){
-                $macl= $_SESSION['macl'];
-                $macl->remove_lock();
-                del_lock ($ui->dn);
-                sess_del ('macl');
-        }
-} else {
-       $display= "No headpage yet for this module";
-
-       /* Create usermanagement object on demand */
-if (!isset($_SESSION['macl']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
-       $_SESSION['macl']= new aclManagement($config, $ui);
-       }
-       $macl= $_SESSION['macl'];
-       
-       /* Show and save dialog */
-       $macl->save_object();
-       $output= $macl->execute();
-
-       /* Page header*/
-       if (isset($_SESSION['objectinfo'])){
-               $display= print_header(get_template_path('images/acl.png'), _("ACL management"), "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".@LDAP::fix($_SESSION['objectinfo']));
-       } else {
-               $display= print_header(get_template_path('images/acl.png'), _("ACL management"));
-       }
-
-       /* Reset requested? */
-       if (isset($_GET['reset']) && $_GET['reset'] == 1){
-               del_lock ($ui->dn);
-               sess_del ('macl');
-       }
-
-       $display.= $output;
-       $_SESSION['macl']= $macl;
-}
-?>
diff --git a/plugins/admin/acl/paste_role.tpl b/plugins/admin/acl/paste_role.tpl
deleted file mode 100644 (file)
index 41f4577..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<table>
-       <tr>
-               <td>
-                       {t}Name{/t}
-               </td>
-               <td>
-                       <input type="text" name='cn' value="{$cn}" style='width:200px;'>
-               </td>
-       </tr>
-</table>
diff --git a/plugins/admin/acl/remove.tpl b/plugins/admin/acl/remove.tpl
deleted file mode 100755 (executable)
index 0b5323d..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<div style="font-size:18px;">
-<img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
-</div>
-<p>
- {$info}
- {t}This includes all system and setup informations. 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">
-{if $is_role}
-  <input type=submit name="delete_acl_role_confirmed" value="{t}Delete{/t}">
-  &nbsp;
-  <input type=submit name="delete_acl_role_cancel" value="{t}Cancel{/t}">
-{else}
-  <input type=submit name="delete_acl_confirm" value="{t}Delete{/t}">
-  &nbsp;
-  <input type=submit name="delete_acl_cancel" value="{t}Cancel{/t}">
-{/if}
-</p>
diff --git a/plugins/admin/acl/tabs_acl.inc b/plugins/admin/acl/tabs_acl.inc
deleted file mode 100644 (file)
index db87979..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-
-class acltab extends tabs
-{
-
-  function acltab($config, $data, $dn)
-  {
-    $data = array(array("CLASS" => "acl" , "NAME" => _("Acl")));
-
-    /* Save dn */
-    $this->dn= $dn;
-    $this->config= $config;
-
-    $baseobject= NULL;
-
-    foreach ($data as $tab){
-      $this->by_name[$tab['CLASS']]= $tab['NAME'];
-
-      
-      if ($baseobject === NULL){
-        if($tab['CLASS'] == "acl"){
-          $baseobject= new $tab['CLASS']($this->config, $this, $this->dn);
-        }else{
-          $baseobject= new $tab['CLASS']($this->config,$this->dn);
-        }
-        $this->by_object[$tab['CLASS']]= $baseobject;
-      } else {
-        if($tab['CLASS'] == "acl"){
-          $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config,$this,$this->dn, $baseobject);
-        }else{
-          $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn, $baseobject);
-        }
-      }
-
-      $this->by_object[$tab['CLASS']]->parent= &$this;
-      $this->by_object[$tab['CLASS']]->set_acl_category("acl");
-
-      /* Initialize current */
-      if ($this->current == ""){
-        $this->current= $tab['CLASS'];
-      }
-    }
-  }
-
-  function save($ignore_account= FALSE)
-  {
-    $ret= tabs::save();
-    return $ret;
-  }
-
-  function save_object($ignore_account= FALSE)
-  {
-    tabs::save_object();
-  }
-  
-  function execute()
-  {
-    $display= tabs::execute();
-    if(!$this->by_object['acl']->dialog){
-      $display.= "<p style=\"text-align:right\">\n";
-      $display.= "  <input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
-      $display.= "  &nbsp;\n";
-      $display.= "  <input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
-      $display.= "</p>";
-    }
-    return($display);
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/acl/tabs_acl_role.inc b/plugins/admin/acl/tabs_acl_role.inc
deleted file mode 100644 (file)
index b113235..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php
-
-class aclroletab extends tabs
-{
-
-  function aclroletab($config, $data, $dn)
-  {
-    $data = array(array("CLASS" => "aclrole" , "NAME" => _("ACL Templates")));
-    tabs::tabs($config, $data, $dn,"acl");
-  }
-
-  function save($ignore_account= FALSE)
-  {
-    $baseobject= $this->by_object['aclrole'];
-
-    /* Check for new 'dn', in order to propagate the
-       'dn' to all plugins */
-    $new_dn= 'cn='.$baseobject->cn.",ou=aclroles,".$baseobject->base;
-
-    if ($this->dn != $new_dn){
-
-      /* Write entry on new 'dn' */
-      if ($this->dn != "new"){
-        $baseobject->move($this->dn, $new_dn);
-        $this->by_object['aclrole']= $baseobject;
-      }
-
-      /* Happen to use the new one */
-      $this->dn= $new_dn;
-    }
-
-    $ret= tabs::save();
-
-    /* Fix tagging if needed */
-    $baseobject->dn= $new_dn;
-    $baseobject->handle_object_tagging();
-
-    return $ret;
-  }
-
-  function save_object($ignore_account= FALSE)
-  {
-    tabs::save_object();
-  }
-  
-  function execute()
-  {
-    $display= tabs::execute();
-    if(!$this->by_object['aclrole']->dialog){
-      $display.= "<p style=\"text-align:right\">\n";
-      $display.= "  <input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
-      $display.= "  &nbsp;\n";
-      $display.= "  <input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
-      $display.= "</p>";
-    }
-    return($display);
-  }
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/applications/class_applicationGeneric.inc b/plugins/admin/applications/class_applicationGeneric.inc
deleted file mode 100644 (file)
index 22fcf10..0000000
+++ /dev/null
@@ -1,569 +0,0 @@
-<?php
-class application extends plugin
-{
-  /* CLI vars */
-  var $cli_summary= "Handling of GOsa's application object";
-  var $cli_description= "Some longer text\nfor help";
-  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* application attributes */
-  var $cn= "";
-  var $description= "";
-  var $base= "";
-  var $gosaApplicationExecute= "";
-  var $gosaApplicationName= "";
-  var $gosaApplicationFlags= "";
-  var $gosaApplicationIcon= "";
-  var $gotoLogonScript ="";
-  var $iconData;
-  var $view_logged = FALSE;
-
-  /* Headpage attributes */
-  var $last_sorting= "invalid";
-  var $applications= array();
-
-  /* attribute list for save action */
-  var $attributes= array("cn", "description", "gosaApplicationExecute", "gosaApplicationName","gosaApplicationIcon",
-      "gosaApplicationFlags","gotoLogonScript");
-  var $objectclasses= array("top", "gosaApplication");
-
-  var $isReleaseApplikation = false;
-
-  function application (&$config, $dn= NULL, $parent= NULL)
-  {
-    plugin::plugin ($config, $dn, $parent);
-
-    $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
-    if(!empty($tmp)) {
-      if(!preg_match("/^ou=apps,/",$_SESSION['appfilter']['release'])){
-        $this->isReleaseApplikation = true;  
-      }
-    }
-
-    /* Load icon */
-    $ldap= $config->get_ldap_link();
-    if ($dn != 'new'){
-      $this->iconData= $ldap->get_attribute($dn, "gosaApplicationIcon");
-      $this->saved_attributes['gosaApplicationIcon'] = $this->iconData;
-    }
-    if ($this->iconData == ""){
-      $this->set_picture("");
-    }
-    $_SESSION['binary']= $this->iconData;
-    $_SESSION['binarytype']= "image/jpeg";
-    $this->gosaApplicationIcon= $this->iconData;
-
-    /* This is always an account */
-    $this->is_account= TRUE;
-
-    if ($this->dn == "new"){
-      if(isset($_SESSION['CurrentMainBase'])){
-        $this->base= $_SESSION['CurrentMainBase'];
-      }else{
-        $ui= get_userinfo();
-        $this->base= dn2base($ui->dn);
-      }
-    } else {
-
-      if($this->isReleaseApplikation){
-        $this->base = preg_replace("/^.*,ou=apps,/","",$this->dn);
-      }else{
-        $this->base= preg_replace ("/^[^,]+,[^,]+,/", "", $this->dn);
-      }
-    }
-  }
-
-
-  function generateTemplate()
-  {
-    $str= "# This code is part of GOsa (https://gosa.gonicus.de)\n#\n";
-
-    $values = array();
-    $names     = array();
-    if($this->parent->by_object['applicationParameters']->is_account){
-      $names = $this->parent->by_object['applicationParameters']->option_name;
-      $values = $this->parent->by_object['applicationParameters']->option_value;
-    }
-
-    if (count($names)){
-      $str .="# This plugin handles these environment variables:\n";
-    } else {
-      $str .="# This plugin handles no environment variables.\n";
-    }
-
-    foreach($names as $index => $name){
-
-      // Fix length
-      for($i = strlen($name) ; $i < 30 ; $i++){
-        $name= $name." ";
-      }
-      if((isset($values[$index]))&&(!empty($values[$index]))){
-        $str.= "# ".$name."\t(e.g. '".$values[$index]."')\n";
-      }else{
-        $str.= "# ".$name."\t("._("no example").")\n";
-      }
-    }
-    $str .= "#\n".
-      "# Don't remove the following tag, it is used for header update.\n".
-      "### END HEADER ###";
-
-    return($str);
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* Log view */
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","application/".get_class($this),$this->dn);
-    }
-
-    $smarty= get_smarty();
-
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translation){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-    /* Do we represent a valid group? */
-    if (!$this->is_account && $this->parent === NULL){
-      $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\">&nbsp;<b>".
-        _("This 'dn' is no application.")."</b>";
-      return ($display);
-    }
-
-    /* Download requested */
-    foreach($_POST as $name => $value){
-      if(preg_match("/^downloadScript/",$name)){
-        $_SESSION['binary']       = $this->gotoLogonScript;
-        $_SESSION['binarytype']   = "octet-stream";
-        $_SESSION['binaryfile']   = $this->cn.".gosaApplication";
-        header("location: getbin.php ");
-        exit();
-      }
-    }
-
-    /* Reassign picture data, sometimes its corrupt cause we started a download of application scripts */
-    $_SESSION['binary']     = $this->iconData;
-    $_SESSION['binarytype'] = "image/jpeg";
-    
-    $smarty->assign("rand", rand(0, 10000));
-    $head = $this->generateTemplate();
-    $this->gotoLogonScript= $this->generateTemplate().preg_replace('/.*### END HEADER ###/s', '', $this->gotoLogonScript);
-
-    if((isset($_POST['upLoad']))&&(isset($_FILES['ScriptFile']))){
-      $str = file_get_contents($_FILES['ScriptFile']['tmp_name']);
-      $this->gotoLogonScript = $str;
-    }
-
-    /* Fill templating stuff */
-    $smarty->assign("cn", $this->cn);
-    $smarty->assign("bases", $this->get_allowed_bases());
-    if ($this->dn == "new"){
-      $smarty->assign("selectmode", "");
-      $smarty->assign("namemode", "");
-    } else {
-      $smarty->assign("namemode", "readonly");
-      $smarty->assign("selectmode", "disabled");
-    }
-    
-    /* Base select dialog */
-    $once = true;
-    foreach($_POST as $name => $value){
-      if(preg_match("/^chooseBase/",$name) && $once){
-        $once = false;
-        $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
-        $this->dialog->setCurrentBase($this->base);
-      }
-    }
-
-    /* Dialog handling */
-    if(is_object($this->dialog)){
-      /* Must be called before save_object */
-      $this->dialog->save_object();
-
-      if($this->dialog->isClosed()){
-        $this->dialog = false;
-      }elseif($this->dialog->isSelected()){
-        /* Just allow selection valid bases */ 
-        $tmp = $this->get_allowed_bases();
-        if(isset($tmp[$this->dialog->isSelected()])){
-          $this->base = $this->dialog->isSelected();
-        }
-        $this->dialog= false;
-      }else{
-        return($this->dialog->execute());
-      }
-    }
-
-    /* Get random number for pictures */
-    srand((double)microtime()*1000000);
-    $smarty->assign("rand", rand(0, 10000));
-
-    /* Variables */
-    foreach(array("description", "gosaApplicationExecute", "gosaApplicationName","cn") as $val){
-      $smarty->assign($val, $this->$val);
-    }
-
-    /* Checkboxes */
-    foreach (array("G" => "exec_for_groupmembers", "O" => "overwrite_config",
-          "L" => "place_on_kicker",
-          "D" => "place_on_desktop", "M" => "place_in_startmenu") as $key => $val){
-      if (preg_match("/$key/", $this->gosaApplicationFlags)){
-        $smarty->assign("$val", "checked");
-      } else {
-        $smarty->assign("$val", "");
-      }
-    }
-
-    $smarty->assign("isReleaseApplikation" , $this->isReleaseApplikation);
-    $smarty->assign("gotoLogonScript",htmlentities($this->gotoLogonScript, ENT_COMPAT, 'UTF-8'));
-    $smarty->assign("base_select", $this->base);
-    /* Show main page */
-    return($smarty->fetch (get_template_path('generic.tpl', TRUE)));
-  }
-
-
-  function remove_from_parent()
-  {
-    $ldap= $this->config->get_ldap_link();
-    $ldap->rmDir($this->dn);
-    new log("remove","application/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    show_ldap_error($ldap->get_error(), sprintf(_("Removing of application with dn '%s' failed."),$this->dn));
-
-    /* Optionally execute a command after we're done */
-    $this->handle_post_events("remove");
-
-    /* Delete references to object groups */
-    $ldap->cd ($this->config->current['BASE']);
-    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
-    while ($ldap->fetch()){
-      $og= new ogroup($this->config, $ldap->getDN());
-      unset($og->member[$this->dn]);
-      $og->save ();
-      show_ldap_error($ldap->get_error(), sprintf(_("Removing application from objectgroup '%s' failed"), $og->dn));
-    }
-    $ldap->search ("(&(objectClass=posixGroup)(gosaMemberApplication=".$this->cn."))", array("cn"));
-    while ($attrs= $ldap->fetch()){
-      $ag= new appgroup($this->config, $ldap->getDN());
-      $ag->removeApp($this->cn);
-      $ag->save ();
-      show_ldap_error($ldap->get_error(), sprintf(_("Removing application from group '%s' failed"), $ag->dn));
-    }
-
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    if (isset($_POST['cn'])){
-
-      /* Create a base backup and reset the
-         base directly after calling plugin::save_object();
-         Base will be set seperatly a few lines below */
-      $base_tmp = $this->base;
-      plugin::save_object();
-      $this->base = $base_tmp;
-
-      /* Save attributes */
-      parent::save_object();
-
-      /* Save application flags */
-      $flag= "";
-      if (isset($_POST['exec_for_groupmembers']) && $_POST['exec_for_groupmembers'] == 1){
-        $flag.= "G";
-      }
-      if (isset($_POST['place_on_desktop']) && $_POST['place_on_desktop'] == 1){
-        $flag.= "D";
-      }
-      if (isset($_POST['place_on_kicker']) && $_POST['place_on_kicker'] == 1){
-        $flag.= "L";
-      }
-      if (isset($_POST['place_in_startmenu']) && $_POST['place_in_startmenu'] == 1){
-        $flag.= "M";
-      }
-      if (isset($_POST['overwrite_config']) && $_POST['overwrite_config'] == 1){
-        $flag.= "O";
-      }
-      if ($this->acl_is_writeable("gosaApplicationFlags")){
-        $this->gosaApplicationFlags= "[$flag]";
-      }
-
-      /* Remove current picture */
-      if(isset($_POST['remove_picture'])){
-        $this->set_picture("");
-      }
-
-      /* Check for picture upload */
-      if (isset($_FILES['picture_file']['name']) && $_FILES['picture_file']['name'] != ""){
-
-        if (!is_uploaded_file($_FILES['picture_file']['tmp_name'])) {
-          print_red (_("The specified picture has not been uploaded correctly."));
-        }
-
-        if (!function_exists("imagick_blob2image")){
-          /* Get temporary file name for conversation */
-          $fname = tempnam ("/tmp", "GOsa");
-
-          /* Open file and write out photoData */
-          $fp = fopen ($fname, "w");
-          fwrite ($fp, $_FILES['picture_file']['tmp_name']);
-          fclose ($fp);
-
-          /* Build conversation query. Filename is generated automatically, so
-             we do not need any special security checks. Exec command and save
-             output. For PHP safe mode, you'll need a configuration which respects
-             image magick as executable... */
-          $query= "convert -size 48x48 $fname -resize 48x48 +profile \"*\" -";
-          @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $query, "Execute");
-
-          /* Read data written by convert */
-          $output= "";
-          $sh= popen($query, 'r');
-          while (!feof($sh)){
-            $output.= fread($sh, 4096);
-          }
-          pclose($sh);
-
-          unlink($fname);      
-        } else {
-
-          /* Load the new uploaded Photo */
-          if(!$handle  =  imagick_ReadImage($_FILES['picture_file']['tmp_name'])){
-            print_red(_("Can't access uploaded image."));
-          }
-
-          /* Resizing image to 147x200 and blur */
-          if(!imagick_resize($handle,48,48,IMAGICK_FILTER_GAUSSIAN,0)){
-            print_red(_("Uploaded image could not be resized, possilby the image magick extension is missing."));
-          }
-
-          /* Converting image to JPEG */
-          if(!imagick_convert($handle,"PNG")) {
-            print_red(_("Could not convert image to png, possilby the image magick extension is missing."));
-          }
-
-          if(!imagick_writeimage($handle,$_FILES['picture_file']['tmp_name'])){
-            print_red(sprintf(_("Could not save uploaded image to %s."),$_FILES['picture_file']['tmp_name']));
-          }
-
-          imagick_free($handle);
-        }
-
-        /* Activate new picture */
-        $this->set_picture($_FILES['picture_file']['tmp_name']);
-      }        
-
-      if(!$this->isReleaseApplikation){
-        $tmp = $this->get_allowed_bases();
-        if(isset($_POST['base'])){
-          if(isset($tmp[$_POST['base']])){
-            $this->base= $_POST['base'];
-          }
-        }
-      }
-    }
-  }
-
-
-  /* Check values */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    if(!preg_match("#^/#",$this->gosaApplicationExecute)){
-      $message[]=(_("Specified execute path must start with '/'."));
-    }
-
-    /* Permissions for that base? */
-    if ($this->base != ""){
-      $new_dn= "cn=".$this->cn.",ou=apps,".$this->base;
-    } else {
-      $new_dn= $this->dn;
-    }
-
-
-    if($this->dn == "new"){
-      $this->set_acl_base($this->base);
-    }
-
-    /* All required fields are set? */
-    if ($this->cn == ""){
-      $message[]= _("Required field 'Name' is not filled.");
-    }
-
-    if(preg_match("/[^a-z0-9]/",$this->cn))    {
-      $message[]=_("Invalid character in application name. Only a-z 0-9 are allowed.");
-    }
-
-    if ($this->gosaApplicationExecute == ""){
-      $message[]= _("Required field 'Execute' is not filled.");
-    }
-
-    /* Check for existing application */
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd($this->config->current["BASE"]);
-
-    $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
-    if((!empty($tmp)) && (isset($_SESSION['appfilter']['release']))){
-      $baseDn = str_replace($this->config->current['BASE'],$this->base,$_SESSION['appfilter']['release']);
-      $baseDn = preg_replace("/ou=apps,.*/","ou=apps,".$this->base,$_SESSION['appfilter']['release']);
-      $ldap->ls("(&(objectClass=gosaApplication)(cn=".$this->cn."))",$baseDn,array("cn"));
-      if($ldap->count()){
-        $attrs = $ldap->fetch();
-        if($this->dn != $attrs['dn']) {
-          $message[]= _("There's already an application with this 'Name'.");
-        }
-      }
-    }else{
-      $ldap->ls("(&(objectClass=gosaApplication)(cn=".$this->cn."))","ou=apps,".$this->base,array("cn"));
-      if ($ldap->count()){
-        $attrs = $ldap->fetch();
-        if($this->dn != $attrs['dn']) {
-          $message[]= _("There's already an application with this 'Name'.");
-        }
-      }
-    }
-    return $message;
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    /* Get application script without header part, to check if we must save the script itself */
-    $script = preg_replace('/.*### END HEADER ###/s', '', $this->gotoLogonScript);
-
-    plugin::save();
-    $this->attrs["gosaApplicationIcon"]= $this->gosaApplicationIcon;
-
-    /* Write back to ldap */
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cat($this->dn, array('dn'));
-
-    $a= $ldap->fetch();
-    if (count($a)){
-
-      /* Remove gotoLogonScript if it is empty */
-      if(empty($script))    {
-        $this->attrs['gotoLogonScript'] = array();
-      }
-
-      $ldap->cd($this->dn);
-      $this->cleanup();
-      $ldap->modify ($this->attrs); 
-      $this->handle_post_events("modify");
-      new log("modify","application/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    } else {
-      
-      /* Remove gotoLogonScript if it is empty */
-      if(empty($script))    {
-        unset($this->attrs['gotoLogonScript']);
-      }
-
-      $ldap->cd($this->config->current['BASE']);
-      $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
-      $ldap->cd($this->dn);
-      $ldap->add($this->attrs);
-      new log("create","application/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-      $this->handle_post_events("add");
-    }
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of application with dn '%s' failed."),$this->dn));
-  }
-
-  function set_picture($filename)
-  {
-    if (!is_file($filename)){
-      $filename= "./images/default_icon.png";
-      $this->gosaApplicationIcon= "*removed*";
-    }
-
-    if (file_exists($filename)){
-      $fd = fopen ($filename, "rb");
-      $this->iconData= fread ($fd, filesize ($filename));
-      $_SESSION['binary']= $this->iconData;
-      $_SESSION['binarytype']= "image/jpeg";
-      $this->gosaApplicationIcon= $this->iconData;
-
-      fclose ($fd);
-    }
-  }
-
-  function getCopyDialog()
-  {
-    $vars = array("cn");
-
-    $str ="<h2>"._("Application settings")."</h2>
-      <table>
-      <tr>
-      <td>".
-      _("Application name"). 
-      "</td>  
-      <td>
-      <input id='gosaApplicationName' name='cn' size='35' maxlength='60' 
-      value='".$this->cn."' 
-      title='"._("Application name to be displayed (i.e. below icons)")."'>                     
-      </td>
-      </tr>
-      </table>";
-    $ret = array();
-    $ret['status'] = "";
-    $ret['string'] = $str;
-    return($ret);
-  }
-
-  function saveCopyDialog()
-  {
-    if(isset($_POST['cn'])){
-      $this->cn = $_POST['cn'];
-    }
-  }
-
-
-  function PrepareForCopyPaste($source)
-  {
-    plugin::PrepareForCopyPaste($source);
-    $source_o = new application($this->config,$source['dn']);
-    $this->gosaApplicationIcon = $source_o->gosaApplicationIcon;     
-  }
-
-
-  /* Return plugin informations for acl handling
-      #FIXME FAIscript seams to ununsed within this class... */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("Generic"),
-          "plDescription" => _("Application generic"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 0,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("application" => array("description"  => _("Application"),
-                                                          "objectClass"  => "gosaApplication")),
-          "plProvidedAcls"=> array(
-            "cn"                => _("Name"),
-            "base"              => _("Base"),
-            "description"       => _("Description"),
-            "gosaApplicationExecute"  => _("Execute"),
-            "gosaApplicationName"     => _("Name"),
-            "gosaApplicationIcon"     => _("Icon"),
-            "gosaApplicationFlags"    => _("Flag"),
-            "gotoLogonScript"         => _("Script content"),
-
-            "exec_for_groupmembers" => _("Only executable for members"),              // G
-            "place_on_desktop"      => _("Place icon on members desktop"),            // D
-            "place_on_kicker"       => _("Place entry in members launch bar"),        // L
-            "place_in_startmenu"    => _("Place entry in members startmenu"),         // M
-            "overwrite_config"      => _("Replace user configuration on startup"))  // O
-            ));
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/applications/class_applicationManagement.inc b/plugins/admin/applications/class_applicationManagement.inc
deleted file mode 100644 (file)
index 69a4c0f..0000000
+++ /dev/null
@@ -1,645 +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 applicationManagement extends plugin
-{
-  /* Definitions */
-  var $plHeadline     = "Applications";
-  var $plDescription  = "This does something";
-
-  /* Dialog attributes */
-  var $apptabs                  = NULL;
-  var $ui                       = NULL;
-  var $CopyPasteHandler         = NULL;
-  var $DivListApplication       = NULL;
-  var $applications             = array();
-  var $enableReleaseManagement  = false;
-  var $start_pasting_copied_objects = FALSE;
-
-  function IsReleaseManagementActivated()
-  {
-    /* Check if we should enable the release selection */
-    $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
-    if(!empty($tmp)){
-      return(true);
-    }
-    return(false);
-  }
-
-  function applicationManagement (&$config, &$ui)
-  {
-    /* Save configuration for internal use */
-    $this->config   = &$config;
-    $this->ui       = &$ui;
-
-    /* Check if copy & paste is activated */
-    if($this->config->boolValueIsTrue("MAIN","ENABLECOPYPASTE")){
-      $this->CopyPasteHandler = new CopyPasteHandler($this->config);
-    }
-
-    /* Creat dialog object */
-    $this->DivListApplication = new divListApplication($this->config,$this);
-
-    if($this->IsReleaseManagementActivated()){
-    /* Check if we should enable the release selection */
-      $this->enableReleaseManagement = true;
-
-      /* Hide SubSearch checkbox */
-      $this->DivListApplication->DisableCheckBox("SubSearch");
-    }
-  }
-
-  function getReleases($base)
-  {
-    $ldap                   = $this->config->get_ldap_link();
-    $dn                     = "ou=apps,".$base;
-    $ret                    = array();
-    $ret ["ou=apps,".$base] = "/";
-
-    $ldap->cd($dn);
-    $ldap->search("objectClass=organizationalUnit",array("ou"));
-
-    while($attrs = $ldap->fetch()){
-      $str = str_replace($dn,"",$attrs['dn']);
-      $tmp = array_reverse( split("ou=",$str));
-      $str = "";
-      foreach($tmp as $val){
-        $val = trim(preg_replace("/,/","",$val));
-        if(empty($val)) break;
-        $str .= "/".$val;
-      } 
-      if(!empty($str)){
-        $ret[$attrs['dn']]= preg_replace("/^\//","",$str);
-      }
-    }
-    asort($ret);
-    return($ret);
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-
-    /**************** 
-      Variable init 
-     ****************/
-
-    /* These vars will be stored if you try to open a locked app, 
-        to be able to perform your last requests after showing a warning message */
-    $_SESSION['LOCK_VARS_TO_USE'] = array("/^act$/","/^id$/","/^appl_edit_/","/^appl_del_/","/^item_selected/","/^remove_multiple_applications/");
-
-    $smarty       = get_smarty();             // Smarty instance
-    $s_action     = "";                       // Contains the action to proceed
-    $s_entry      = "";                       // The value for s_action
-    $base_back    = "";                       // The Link for Backbutton
-    
-    /* Test Posts */
-    foreach($_POST as $key => $val){
-      // Post for delete
-      if(preg_match("/appl_del.*/",$key)){
-        $s_action = "del";
-        $s_entry  = preg_replace("/appl_".$s_action."_/i","",$key);
-        // Post for edit
-      }elseif(preg_match("/appl_edit_.*/",$key)){
-        $s_action="edit";
-        $s_entry  = preg_replace("/appl_".$s_action."_/i","",$key);
-        // Post for new
-      }elseif(preg_match("/^copy_.*/",$key)){
-        $s_action="copy";
-        $s_entry  = preg_replace("/^copy_/i","",$key);
-      }elseif(preg_match("/^cut_.*/",$key)){
-        $s_action="cut";
-        $s_entry  = preg_replace("/^cut_/i","",$key);
-        // Post for new
-      }elseif(preg_match("/^appl_new.*/",$key)){
-        $s_action="new";
-      }elseif(preg_match("/^remove_multiple_applications/",$key)){
-        $s_action="del_multiple";
-      }elseif(preg_match("/^editPaste.*/i",$key)){
-        $s_action="editPaste";
-      }elseif(preg_match("/^multiple_copy_groups/",$key)){
-        $s_action = "copy_multiple";
-      }elseif(preg_match("/^multiple_cut_groups/",$key)){
-        $s_action = "cut_multiple";
-      }
-    }
-
-    if((isset($_GET['act']))&&($_GET['act']=="edit_entry")){
-      $s_action ="edit";
-      $s_entry  = $_GET['id'];
-    }
-
-    $s_entry  = preg_replace("/_.$/","",$s_entry);
-
-
-    /* handle C&P from layers menu */
-    if(isset($_POST['menu_action']) && preg_match("/^multiple_copy_systems/",$_POST['menu_action'])){
-      $s_action = "copy_multiple";
-    }
-    if(isset($_POST['menu_action']) && preg_match("/^multiple_cut_systems/",$_POST['menu_action'])){
-      $s_action = "cut_multiple";
-    }
-    if(isset($_POST['menu_action']) && preg_match("/^editPaste/",$_POST['menu_action'])){
-      $s_action = "editPaste";
-    }
-
-    /* Create options */
-    if(isset($_POST['menu_action']) && $_POST['menu_action'] == "appl_new"){
-      $s_action = "new";
-    }
-
-    /* handle remove from layers menu */
-    if(isset($_POST['menu_action']) && preg_match("/^remove_multiple/",$_POST['menu_action'])){
-      $s_action = "del_multiple";
-    }
-
-    /**************** 
-      Copy & Paste handling  
-     ****************/
-
-    /* Display the copy & paste dialog, if it is currently open */
-    $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
-    if($ret){
-      return($ret);
-    }
-
-    /**************** 
-      Create a new app 
-     ****************/
-
-    /* New application? */
-    if ($s_action=="new"){
-
-      /* By default we set 'dn' to 'new', all relevant plugins will
-         react on this. */
-      $this->dn= "new";
-
-      /* Create new usertab object */
-      $this->apptabs= new apptabs($this->config,$this->config->data['TABS']['APPSTABS'], $this->dn,"application");
-      $this->apptabs->set_acl_base($this->DivListApplication->selectedBase);
-    }
-
-
-    /**************** 
-      Edit entry canceled 
-     ****************/
-
-    /* Cancel dialogs */
-    if (isset($_POST['edit_cancel']) || isset($_POST['password_cancel'])){
-      del_lock ($this->apptabs->dn);
-      unset ($this->apptabs);
-      $this->apptabs= NULL;
-      unset ($_SESSION['objectinfo']);
-    }
-
-
-    /**************** 
-      Edit entry finished 
-     ****************/
-
-    /* Finish apps edit is triggered by the tabulator dialog, so
-       the user wants to save edited data. Check and save at this
-       point. */
-    if ((isset($_POST['edit_finish']) || isset($_POST['edit_apply']) ) && (isset($this->apptabs->config))){
-
-      /* Check tabs, will feed message array */
-      $this->apptabs->last= $this->apptabs->current;
-      $this->apptabs->save_object();
-      $message= $this->apptabs->check();
-
-      /* Save, or display error message? */
-      if (count($message) == 0){
-
-        /* Save data data to ldap */
-        $this->apptabs->set_release($this->DivListApplication->selectedRelease);
-        $this->apptabs->save();
-
-        if (!isset($_POST['edit_apply'])){
-          /* Application has been saved successfully, remove lock from
-             LDAP. */
-          if ($this->dn != "new"){
-            del_lock ($this->dn);
-          }
-          unset ($this->apptabs);
-          $this->apptabs= NULL;
-          unset ($_SESSION['objectinfo']);
-        }
-      } else {
-        /* Ok. There seem to be errors regarding to the tab data,
-           show message and continue as usual. */
-        show_errors($message);
-      }
-    }
-
-
-    /**************** 
-      Edit entry  
-     ****************/
-
-    /* User wants to edit data? */
-    if (($s_action=="edit") && (!isset($this->apptabs->config))){
-
-      /* Get 'dn' from posted 'applist', must be unique */
-      $this->dn= $this->applications[$s_entry]['dn'];
-
-      /* Check locking, save current plugin in 'back_plugin', so
-         the dialog knows where to return. */
-      if (($user= get_lock($this->dn)) != ""){
-        return(gen_locked_message ($user, $this->dn));
-      }
-
-      /* Lock the current entry, so everyone will get the
-         above dialog */
-      add_lock ($this->dn, $this->ui->dn);
-
-      /* Register apptabs to trigger edit dialog */
-      $this->apptabs= new apptabs($this->config,$this->config->data['TABS']['APPSTABS'], $this->dn,"application");
-      $this->apptabs->set_acl_base($this->dn);
-      $_SESSION['objectinfo']= $this->dn;
-    }
-
-
-
-    /********************
-      Delete MULTIPLE entries requested, display confirm dialog
-     ********************/
-
-    if ($s_action=="del_multiple"){
-      $ids = $this->list_get_selected_items();
-
-      if(count($ids)){
-
-        foreach($ids as $id){
-          $dn = $this->applications[$id]['dn'];
-          if (($user= get_lock($dn)) != ""){
-            return(gen_locked_message ($user, $dn));
-          }
-          $this->dns[$id] = $dn;
-        }
-
-        $dns_names = "<br><pre>";
-        foreach($this->dns as $dn){
-          add_lock ($dn, $this->ui->dn);
-          $dns_names .= $dn."\n";
-        }
-        $dns_names .="</pre>";
-
-        /* Lock the current entry, so nobody will edit it during deletion */
-        if (count($this->dns) == 1){
-          $smarty->assign("intro",     sprintf(_("You're about to delete the following entry %s"), @LDAP::fix($dns_names)));
-        } else {
-          $smarty->assign("intro",     sprintf(_("You're about to delete the following entries %s"), @LDAP::fix($dns_names)));
-        }
-        $smarty->assign("multiple", true);
-        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
-      }
-    }
-
-
-    /********************
-      Delete MULTIPLE entries confirmed
-     ********************/
-
-    /* Confirmation for deletion has been passed. Users should be deleted. */
-    if (isset($_POST['delete_multiple_application_confirm'])){
-
-      /* Remove user by user and check acls before removeing them */
-      foreach($this->dns as $key => $dn){
-
-        $ui = get_userinfo();
-        $acl = $ui->get_permissions($dn ,"application/application");
-        if (preg_match('/d/', $acl)){
-
-          /* Delete request is permitted, perform LDAP action */
-          $this->apptabs= new apptabs($this->config, $this->config->data['TABS']['APPSTABS'], $dn,"application");
-          $this->apptabs->set_acl_base($dn);
-          $this->apptabs->delete ();
-          unset ($this->apptabs);
-          $this->apptabs= NULL;
-
-        } else {
-          /* Normally this shouldn't be reached, send some extra
-             logs to notify the administrator */
-          print_red (_("You are not allowed to delete this application!"));
-          new log("security","application/".get_class($this),$dn,array(),"Tried to trick deletion.");
-        }
-        /* Remove lock file after successfull deletion */
-        del_lock ($dn);
-        unset($this->dns[$key]);
-      }
-    }
-
-
-    /********************
-      Delete MULTIPLE entries Canceled
-     ********************/
-
-    /* Remove lock */
-    if(isset($_POST['delete_multiple_application_cancel'])){
-      foreach($this->dns as $key => $dn){
-        del_lock ($dn);
-        unset($this->dns[$key]);
-      }
-    }
-
-    /**************** 
-      Delete app 
-     ****************/
-
-    /* Remove user was requested */
-    if ($s_action == "del"){
-
-      /* Get 'dn' from posted 'uid' */
-      $this->dn= $this->applications[$s_entry]['dn'];
-
-      /* Load permissions for selected 'dn' and check if
-         we're allowed to remove this 'dn' */
-      $ui = get_userinfo();
-      $acl = $ui->get_permissions($this->dn ,"application/application");
-
-      if(preg_match("/d/",$acl)){
-        /* Check locking, save current plugin in 'back_plugin', so
-           the dialog knows where to return. */
-        if (($user= get_lock($this->dn)) != ""){
-          return (gen_locked_message ($user, $this->dn));
-        }
-
-        /* Lock the current entry, so nobody will edit it during deletion */
-        add_lock ($this->dn, $this->ui->dn);
-        $smarty= get_smarty();
-        $smarty->assign("intro", sprintf(_("You're about to delete the application '%s'."), @LDAP::fix($this->dn)));
-        $smarty->assign("multiple", false);
-        return($smarty->fetch (get_template_path('remove.tpl', TRUE)));
-      } else {
-
-        /* Obviously the user isn't allowed to delete. Show message and
-           clean session. */
-        print_red (_("You are not allowed to delete this application!"));
-      }
-    }
-
-
-    /**************** 
-      Delete app confirmed 
-     ****************/
-
-    /* Confirmation for deletion has been passed. Group should be deleted. */
-    if (isset($_POST['delete_app_confirm'])){
-
-      /* Some nice guy may send this as POST, so we've to check
-         for the permissions again. */
-      $ui = get_userinfo();
-      $acl = $ui->get_permissions($this->dn ,"application/application");
-
-      if(preg_match("/d/",$acl)){
-
-        /* Delete request is permitted, perform LDAP action */
-        $this->apptabs= new apptabs($this->config, $this->config->data['TABS']['APPSTABS'], $this->dn,"application");
-        $this->apptabs->set_acl_base($this->dn);
-        $this->apptabs->delete ();
-        unset ($this->apptabs);
-        $this->apptabs= NULL;
-
-      } else {
-
-        /* Normally this shouldn't be reached, send some extra
-           logs to notify the administrator */
-        print_red (_("You are not allowed to delete this application!"));
-        new log("security","application/".get_class($this),$dn,array(),"Tried to trick deletion.");
-      }
-
-      /* Remove lock file after successfull deletion */
-      del_lock ($this->dn);
-    }
-
-
-    /**************** 
-      Delete app canceled 
-     ****************/
-
-    /* Delete application canceled? */
-    if (isset($_POST['delete_cancel'])){
-      del_lock ($this->dn);
-      unset($_SESSION['objectinfo']);
-    }
-
-    /* Show tab dialog if object is present */
-    if (($this->apptabs) && (isset($this->apptabs->config))){
-      $display= $this->apptabs->execute();
-
-      /* Don't show buttons if tab dialog requests this */
-      if (!$this->apptabs->by_object[$this->apptabs->current]->dialog){
-        $display.= "<p style=\"text-align:right\">\n";
-        $display.= "<input type=\"submit\" name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
-        $display.= "&nbsp;\n";
-        if ($this->dn != "new"){
-          $display.= "<input type=submit name=\"edit_apply\" value=\""._("Apply")."\">\n";
-          $display.= "&nbsp;\n";
-        }
-        $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
-        $display.= "</p>";
-      }
-      return ($display);
-    }
-
-
-    /****************
-      Dialog display
-     ****************/
-
-    /* Check if there is a snapshot dialog open */
-    $base = $this->DivListApplication->selectedBase;
-    if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases($base))){
-      return($str);
-    }
-
-    /* Display dialog with system list */
-    $this->DivListApplication->parent = $this;
-    $this->DivListApplication->execute();
-    $this->DivListApplication->AddDepartments($this->DivListApplication->selectedBase,3,1);
-    $this->reload();
-    $this->DivListApplication->setEntries($this->applications);
-    return($this->DivListApplication->Draw());
-  }
-
-
-  /* Return departments, that will be included within snapshot detection */
-  function get_used_snapshot_bases(){
-    if($this->DivListApplication->selectedRelease == "main"){
-      return(array($this->DivListApplication->selectedBase));
-    }else{
-      return(array($this->DivListApplication->selectedRelease));
-    }
-  }
-
-
-  function reload()
-  {
-    $this->applications= array();
-
-    /* Set base for all searches */
-    $base       = $this->DivListApplication->selectedBase;
-    $release    = $this->DivListApplication->selectedRelease;
-    $Regex      = $this->DivListApplication->Regex;
-    $SubSearch  = $this->DivListApplication->SubSearch; 
-    $Flags      =  GL_NONE | GL_SIZELIMIT;
-    $Filter     = "(&(cn=".$Regex.")(objectClass=gosaApplication))";
-    $tmp        = array();
-    $Releases   = $this->getReleases($base);
-
-    if(!$this->enableReleaseManagement){
-      $use_base = "ou=apps,".$base;
-    }else{
-      if(isset($Releases[$release])){
-        $use_base  = $release;
-      }else{
-        $use_base  = "ou=apps,".$base;
-      }
-    }
-
-    if($SubSearch){
-      $Flags    |= GL_SUBSEARCH;  
-    }
-   
-    $res= get_list($Filter, "application", $use_base, array("cn","description","dn","objectClass"), $Flags);
-    foreach ($res as $val){
-      $tmp[strtolower($val['cn'][0]).$val['cn'][0].$val['dn']]=$val;
-    }
-
-    ksort($tmp);
-    $this->applications=array();
-    foreach($tmp as $val){
-      $this->applications[]=$val;
-    }
-    reset ($this->applications);
-  }
-
-  function remove_from_parent()
-  {
-    /* Optionally execute a command after we're done */
-    $this->postremove();
-  }
-
-
-  function copyPasteHandling_from_queue($s_action,$s_entry)
-  {
-    /* Check if Copy & Paste is disabled */
-    if(!is_object($this->CopyPasteHandler)){
-      return("");
-    }
-
-    /* Add a single entry to queue */
-    if($s_action == "cut" || $s_action == "copy"){
-
-      /* Cleanup object queue */
-      $this->CopyPasteHandler->cleanup_queue();
-      $dn = $this->applications[$s_entry]['dn'];
-      $this->CopyPasteHandler->add_to_queue($dn,$s_action,"apptabs","APPSTABS","application");
-    }
-
-
-    /* Add entries to queue */
-    if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
-
-      /* Cleanup object queue */
-      $this->CopyPasteHandler->cleanup_queue();
-
-      /* Add new entries to CP queue */
-      foreach($this->list_get_selected_items() as $id){
-        $dn = $this->applications[$id]['dn'];
-
-        if($s_action == "copy_multiple"){
-          $this->CopyPasteHandler->add_to_queue($dn,"copy","apptabs","APPSTABS","application");
-        }
-        if($s_action == "cut_multiple"){
-          $this->CopyPasteHandler->add_to_queue($dn,"cut","apptabs","APPSTABS","application");
-        }
-      }
-    }
-
-    /* Start pasting entries */
-    if($s_action == "editPaste"){
-      $this->start_pasting_copied_objects = TRUE;
-    }
-
-
-    /* Return C&P dialog */
-    if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
-
-      /* Load entry from queue and set base */
-      $this->CopyPasteHandler->load_entry_from_queue();
-      $this->CopyPasteHandler->SetVar("base",$this->DivListApplication->selectedBase);
-
-      /* Get dialog */
-      $data = $this->CopyPasteHandler->execute();
-
-      /* Return dialog data */
-      if(!empty($data)){
-        return($data);
-      }
-    }
-
-    /* Automatically disable status for pasting */
-    if(!$this->CopyPasteHandler->entries_queued()){
-      $this->start_pasting_copied_objects = FALSE;
-    }
-    return("");
-  }
-
-
-  function list_get_selected_items()
-  {
-    $ids = array();
-    foreach($_POST as $name => $value){
-      if(preg_match("/^item_selected_[0-9]*$/",$name)){
-        $id   = preg_replace("/^item_selected_/","",$name);
-        $ids[$id] = $id;
-      }
-    }
-    return($ids);
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    /* Optionally execute a command after we're done */
-    $this->postcreate();
-  }
-
-  function remove_lock()
-  {
-    if (isset($this->apptabs->dn)){
-      del_lock ($this->apptabs->dn);
-    }
-  }
-
-  function save_object() {
-    $this->DivListApplication->save_object();
-  }
-
-  function check() {}
-  function adapt_from_template($dn) {}
-  function password_change_needed() {}
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/applications/class_applicationParameters.inc b/plugins/admin/applications/class_applicationParameters.inc
deleted file mode 100644 (file)
index 9f11eb6..0000000
+++ /dev/null
@@ -1,248 +0,0 @@
-<?php
-class applicationParameters extends plugin
-{
-  /* CLI vars */
-  var $cli_summary= "Manage application class parameters";
-  var $cli_description= "Some longer text\nfor help";
-  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* Parameters  */
-  var $option_name= array();
-  var $option_value= array();
-
-  /* attribute list for save action */
-  var $attributes= array("gosaApplicationParameter");
-  var $objectclasses= array();
-
-  var $CopyPasteVars = array("option_name","option_value");
-
-  function applicationParameters (&$config, $dn= NULL, $parent= NULL)
-  {
-    plugin::plugin ($config, $dn, $parent);
-
-    $this->gosaApplicationParameter = array();
-
-    if (isset($this->attrs['gosaApplicationParameter'])){
-      $this->is_account= TRUE;
-      for ($i= 0; $i<$this->attrs['gosaApplicationParameter']['count']; $i++){
-        $option= preg_replace('/^[^:]+:/', '',
-            $this->attrs['gosaApplicationParameter'][$i]);
-        $name= preg_replace('/:.*$/', '',
-            $this->attrs['gosaApplicationParameter'][$i]);
-        $this->option_name[$i]= $name;
-        $this->option_value[$i]= $option;
-      }
-    } else {
-      $this->is_account= FALSE;
-    }
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* Do we need to flip is_account state? */
-    if (isset($_POST['modify_state'])){
-      $this->is_account= !$this->is_account;
-    }
-
-    /* Show tab dialog headers */
-    $display= "";
-    if ($this->parent !== NULL){
-      if ($this->is_account){
-        $display= $this->show_disable_header(_("Remove options"),
-            _("This application has options. You can disable them by clicking below."));
-      } else {
-        $display= $this->show_enable_header(_("Create options"),
-            _("This application has options disabled. You can enable them by clicking below."));
-        $this->parent->by_object['application']->generateTemplate();
-        return ($display);
-      }
-    }
-
-    /* Add option to list */
-    if (isset($_POST['add_option'])){
-      $i= count($this->option_name);
-      $this->option_name[$i]= "";
-      $this->option_value[$i]= "";
-    }
-
-    /* Remove value from list */
-    for ($i= 0; $i<count($this->option_name); $i++){
-      if (isset($_POST["remove$i"])){
-        $k= 0;
-        $on= array();
-        $ov= array();
-        for ($j= 0; $j<count($this->option_name); $j++){
-          if ($j != $i){
-            $on[$k]= $this->option_name[$j];
-            $ov[$k]= $this->option_value[$j];
-            $k++;
-          }
-        }
-        $this->option_name= $on;
-        $this->option_value= $ov;
-        break;
-      }
-    }
-
-    /* Generate list of attributes */
-    if (count($this->option_name) == 0){
-      $this->option_name[]= "";
-      $this->option_value[]= "";
-    }
-
-
-    $acl = $this->getacl("gosaApplicationParameter")   ;
-    $table= "<table summary=\"\"><tr><td>"._("Variable")."</td><td>"._("Default value")."</td><td></td></tr>";
-    if (count ($this->option_name)){
-
-      for ($i= 0; $i < count($this->option_name); $i++){
-        $name = $this->option_name[$i];
-        $value= $this->option_value[$i];
-
-        $tag = "";
-        if(!preg_match("/w/",$acl)){
-          $tag = " disabled ";
-        }
-
-        if(!preg_match("/r/",$acl)){
-          $name = "";
-          $value= "";
-        }
-
-        $table.="<tr>".
-          " <td>".
-          "  <input name=\"option$i\" size=25 maxlength=50 value=\"".$name."\" ".$tag.">".
-          " </td>".
-          " <td>".
-          "  <input name=\"value$i\" size=60 maxlength=250 value=\"".$value."\" ".$tag.">".
-          "  <br>".
-          " </td>".
-          " <td>".
-          "  <input type=\"submit\" name=\"remove$i\" value=\""._("Remove")."\" ".$tag.">".
-          " </td>".
-          "</tr>";
-      }
-    }
-    $table.= "</table>";
-    $table.="<input type=\"submit\" name=\"add_option\" value=\""._("Add option")."\">";
-
-    /* Show main page */
-    $smarty= get_smarty();
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translation){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-
-    $smarty->assign("table", $table);
-    $display.= $smarty->fetch(get_template_path('parameters.tpl', TRUE));
-    $this->parent->by_object['application']->generateTemplate();
-    return ($display);
-  }
-
-  function remove_from_parent()
-  {
-    $ldap= $this->config->get_ldap_link();
-
-    /* Zero attributes */
-    $this->attrs= array();
-    $this->attrs['gosaApplicationParameter']= array();
-
-    $ldap->cd($this->dn);
-    @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
-        $this->attributes, "Save");
-    $this->cleanup();
-    $ldap->modify ($this->attrs); 
-
-    show_ldap_error($ldap->get_error(), sprintf(_("Removing of application parameters with dn '%s' failed."),$this->dn));
-
-    /* Optionally execute a command after we're done */
-    $this->handle_post_events('remove');
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    if (isset($_POST['option0'])){
-      for ($i= 0; $i<count($this->option_name); $i++){
-        $this->option_name[$i]= $_POST["option$i"];
-        $this->option_value[$i]= "";
-        if ($_POST["value$i"] != ""){
-          $this->option_value[$i]= $_POST["value$i"];
-        }
-      }
-    }
-  }
-
-
-  /* Check values */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    /* Check for valid option names */
-    for ($i= 0; $i<count($this->option_name); $i++){
-      if (!preg_match ("/^[a-z0-9_]+$/i", $this->option_name[$i])){
-        $message[]= sprintf(_("Value '%s' specified as option name is not valid."), 
-            $this->option_name[$i]);
-      }
-    }
-
-    return $message;
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    /* Generate values */
-    $this->attrs= array();
-    if (count($this->option_name) == 0){
-      $this->attrs['gosaApplicationParameter']= array();
-    } else {
-      for ($i= 0; $i<count($this->option_name); $i++){
-        $this->attrs['gosaApplicationParameter'][]= $this->option_name[$i].
-          ":".$this->option_value[$i];
-      }
-    }
-
-    /* Write back to ldap */
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd($this->dn);
-    @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
-        $this->attributes, "Save");
-    $this->cleanup();
-    $ldap->modify ($this->attrs); 
-
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of application parameters with dn '%s' failed."),$this->dn));
-
-    /* Optionally execute a command after we're done */
-    $this->handle_post_events('modify');
-  }
-
-  /* Return plugin informations for acl handling
-#FIXME FAIscript seams to ununsed within this class... */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("Parameter"),
-          "plDescription" => _("Parameter configuration"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 0,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("application"),
-
-          "plProvidedAcls"=> array(
-            "gosaApplicationParameter"      => _("Application parameter settings"))  
-          ));
-  }
-
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/applications/class_divListApplication.inc b/plugins/admin/applications/class_divListApplication.inc
deleted file mode 100755 (executable)
index 15b09c6..0000000
+++ /dev/null
@@ -1,321 +0,0 @@
-<?php
-
-class divListApplication extends MultiSelectWindow
-{
-  /* Current base */
-  var $selectedBase       = "";
-  var $selectedRelease    = "main";
-  var $AvailableReleases  = array();
-  var $departments        = array();
-  var $parent               ;
-  var $ui                   ;
-
-  /* Regex */
-  var $Regex           = "*";
-
-  /* Subsearch checkbox */
-  var $SubSearch;
-
-  var $SaveAdditionalVars = array("selectedRelease");
-
-  function divListApplication (&$config,&$parent)
-  {
-    MultiSelectWindow::MultiSelectWindow($config,"Application", "application");
-   
-    $this->selectedRelease = "ou=apps,".$_SESSION['CurrentMainBase'];
-    $this->parent       = &$parent;
-    $this->ui           = get_userinfo();
-
-    /* Set list strings */
-    $this->SetTitle(_("List of Applications"));
-    $this->SetSummary(_("This table displays all applications in the selected tree."));
-
-    /* Result page will look like a headpage */
-    $this->SetHeadpageMode();
-    $this->SetInformation(_("This menu allows you to add, edit and remove selected applications. You may want to use the range selector on top of the application listbox, when working with a large number of applications."));
-
-    $this->EnableAplhabet(true);
-  
-    /* Disable buttonsm */
-    $this->EnableCloseButton(false);
-    $this->EnableSaveButton (false);
-
-    /* set Page header */
-    $action_col_size = 80;
-    if($this->parent->snapshotEnabled()){
-      $action_col_size += 38;
-    }
-
-
-    /* Toggle all selected / deselected */
-    $chk = "<input type='checkbox' id='select_all' name='select_all'
-               onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
-
-    /* set Page header */
-    $this->AddHeader(array("string"=> $chk,          "attach"=>"style='width:20px;'"));
-    $this->AddHeader(array("string" => "&nbsp;",                "attach" => "style='text-align:center;width:20px;'"));
-    $this->AddHeader(array("string" => _("Application name")." / "._("Department"), "attach" => "style=''"));
-    $this->AddHeader(array("string" => _("Actions"),            "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'"));
-
-    /* Add SubSearch checkbox */
-    $this->AddCheckBox("SubSearch",  _("Select to search within subtrees"), _("Search in subtrees"), false);
-
-    /*                  Name                 ,Text                              ,Default  , Connect with alphabet  */
-    $this->AddRegex   ("Regex",     _("Display users matching"),"*" , true);
-  }
-
-  function AddUserBoxToFilter($position){
-    $str = "";
-    if(($position  == 2) && ($this->parent->IsReleaseManagementActivated($this->config))){
-      $smarty = get_smarty();
-      $smarty->assign("selectedRelease",$this->selectedRelease);
-      $smarty->assign("branchimage","images/branch.png");
-      $smarty->assign("releases",$this->AvailableReleases);
-      $str = $smarty->fetch(get_template_path('release_select.tpl', TRUE));
-    }
-    return($str);
-  }
-
-  function GenHeader()
-  {
-    /* Prepare departments,
-       which are shown in the listbox on top of the listbox
-    */
-    $options= "";
-
-    /* Get all departments within this subtree */
-    $base = $this->config->current['BASE'];
-
-    /* Add base */
-    $tmp = array();
-    $tmp[] = array("dn"=>$this->config->current['BASE']);
-    $tmp=  array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
-                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
-
-    $deps = array();
-    foreach($tmp as $tm){
-      $deps[$tm['dn']] = $tm['dn'];
-    }
-
-    /* Load possible departments */
-    $ui= get_userinfo();
-    $tdeps= $ui->get_module_departments("application");
-    $ids = $this->config->idepartments;
-    $first = "";
-    $found = FALSE;
-    foreach($ids as $dep => $name){
-      if(isset($deps[$dep]) && in_array_ics($dep, $tdeps)){
-
-        /* Keep first base dn in mind, we could need this
-         *  info if no valid base was found
-         */
-        if(empty($first)) {
-          $first = $dep['dn'];
-        }
-
-        $value = $ids[$dep];
-        if ($this->selectedBase == $dep){
-          $found = TRUE;
-          $options.= "<option selected='selected' value='".$dep."'>$value</option>";
-        } else {
-          $options.= "<option value='".$dep."'>$value</option>";
-        }
-      }
-    }
-
-    /* The currently used base is not visible with your acl setup.
-     * Set base to first useable base.
-     */
-    if(!$found){
-      $this->selectedBase = $first;
-    }
-
-    /* Get acls */
-    $ui       = get_userinfo();
-    $acl      = $ui->get_permissions("cn=dummy,".$this->selectedBase,"application/application");
-    $acl_all  = $ui->has_complete_category_acls($this->selectedBase,"application");
-
-    /* Add default header */
-    $listhead = MultiSelectWindow::get_default_header();
-
-    /* And the rest, a base selection box */
-    $listhead .= _("Base")."&nbsp;<select name='CurrentMainBase' 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;";
-
-    /* Create Layers menu */
-    $s  = ".|"._("Actions")."|\n";
-    $s .= "..|<img src='images/list_new.png' alt='' border='0' class='center'>".
-      "&nbsp;"._("Create")."|\n";
-
-    /* Append create options */
-    if(preg_match("/c/",$acl)) {
-      $s.= "...|<input class='center' type='image' src='images/list_new_app' alt=''>".
-        "&nbsp;"._("Application")."|appl_new|\n";
-    }
-
-    /* Multiple options */
-    $s.= "..|---|\n";
-    $s.= "..|<img src='images/edittrash.png' alt='' border='0' class='center'>".
-      "&nbsp;"._("Remove")."|"."remove_multiple|\n";
-
-    /* Add multiple copy & cut icons */
-    if(is_object($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
-      $s.= "..|---|\n";
-      $s.= "..|<img src='images/editcopy.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Copy")."|"."multiple_copy_systems|\n";
-      $s.= "..|<img src='images/editcut.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Cut")."|"."multiple_cut_systems|\n";
-
-      if($this->parent->CopyPasteHandler->entries_queued()){
-        $img = "<img border='0' class='center' src='images/editpaste.png' alt=''>";
-        $s.="..|".$img."&nbsp;"._("Paste")."|editPaste|\n";
-      }else{
-        $img = "<img border='0' class='center' src='images/cant_editpaste.png' alt=''>";
-        $s.="..|".$img."&nbsp;"._("Paste")."\n";
-      }
-    }
-
-    /* Add snapshot icons */
-    if(preg_match("/(c.*w|w.*c)/",$acl_all)){
-      $s .= "..|---|\n";
-      $s .= $this->get_snapshot_header(TRUE);
-    }
-
-    $this->SetDropDownHeaderMenu($s);
-    $this->SetListHeader($listhead);
-
-    $this->SetListHeader($listhead);
-  }
-
-  /* so some basic settings */
-  function execute()
-  {
-    $this->ClearElementsList();
-    $this->GenHeader();
-    $this->AvailableReleases = $this->parent->getReleases($this->selectedBase);
-  }
-
-  function setEntries($list)
-  {
-    /********************
-      Variable init
-     ********************/
-  
-    /* Create links */
-    $linkopen = "<a href='?plug=".$_GET['plug']."&amp;act=dep_open&amp;dep_id=%s'>%s</a>";
-    $editlink = "<a href='?plug=".$_GET['plug']."&amp;id=%s&amp;act=edit_entry'>%s</a>";
-    $userimg  = "<img class='center' src='images/select_groups.png' alt='User'    title='%s'>";
-    $applimg  = "<img class='center' src='images/select_application.png' alt='A'  title='"._("Application")."'>";
-    $empty    = "<img class='center' src='images/empty.png' style='width:16px;height:16px;' alt=''>";
-
-    /* set Page header */
-    $action_col_size = 80;
-    if($this->parent->snapshotEnabled()){
-      $action_col_size += 38;
-    }
-
-    /********************
-      Attach objects
-     ********************/
-    
-    $ui = get_userinfo();
-    foreach($list as $key => $val){
-
-      $acl = $ui->get_permissions($val['dn'],"application/application");
-      $acl_all= $ui->has_complete_category_acls($val['dn'],"application");
-
-      /* Create action icons */
-      $actions= "";
-
-      /* Add Copy & Paste icon */
-      if(($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
-        /* Only add cut icon, if we are allowed to move this user */
-        if(preg_match("/m/",$acl)){
-          $actions.= "<input class='center' type='image'
-            src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
-
-          $actions.= "<input class='center' type='image'
-            src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
-        }
-      }
-
-      /* Add edit icon */
-      $actions.= "<input class='center' type='image'
-        src='images/edit.png' alt='"._("edit")."' name='appl_edit_%KEY%' title='"._("Edit this entry")."'>";
-
-
-      if(preg_match("/(c.*w|w.*c)/",$acl_all)){
-        $actions.= $this->GetSnapShotActions($val['dn']);
-      }
-
-      /* If we are allowed to remove the application account, display remove icon */
-      if(preg_match("/d/",$acl)){
-        $actions.= "<input class='center' type='image'
-          src='images/edittrash.png' alt='"._("delete")."' name='appl_del_%KEY%' title='"._("Delete this entry")."'>";
-      }else{
-        $actions.= "<img src='images/empty.png' alt='&nbsp;'>";
-      }
-
-      $title = "title='".preg_replace('/ /', '&nbsp;', @LDAP::fix($val['dn']))."'";
-
-      if(!isset($val['description'][0])){
-        $desc = "";
-      }else{
-        $desc = " - [ ".$val['description'][0]." ]";
-      }
-
-      /* Cutted objects should be displayed in light grey */
-      $display = $val['cn'][0].$desc;
-      if($this->parent->CopyPasteHandler){
-        foreach($this->parent->CopyPasteHandler->queue as $queue_key => $queue_data){
-          if($queue_data['dn'] == $val['dn']) {
-            $display = "<font color='#999999'>".$display."</font>";
-            break;
-          }
-        }
-      }
-
-      /* Create each field */
-      $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
-                      "attach" => "style='width:20px;'");
-      $field1 = array("string" => sprintf($applimg,$val['dn']), "attach" => "style='text-align:center;width:20px;'");
-      $field2 = array("string" => sprintf($editlink,$key,$display), "attach" => "style='' ".$title);
-      $field3 = array("string" => preg_replace("/%KEY%/", $key, $actions), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'");
-      $this->AddElement(array($field0,$field1,$field2,$field3));
-    }
-
-    /* Create summary string for list footer */
-    $num_deps=0;
-    if(!$this->SubSearch){
-      $num_deps = count($this->Added_Departments);
-    }
-    $num_apps = count($list);
-
-    $num_app_str = _("Number of listed applications");
-    $num_dep_str = _("Number of listed departments");
-  
-    $str = "<img class='center' src='images/select_application.png' 
-              title='".$num_app_str."' alt='".$num_app_str."'>&nbsp;".$num_apps."&nbsp;&nbsp;&nbsp;&nbsp;";
-    $str.= "<img class='center' src='images/folder.png' 
-              title='".$num_dep_str."' alt='".$num_dep_str."'>&nbsp;".$num_deps."&nbsp;&nbsp;&nbsp;&nbsp;";
-
-    $this->set_List_Bottom_Info($str);
-  }
-
-  function Save()
-  {
-    MultiSelectWindow::Save();  
-  }
-
-  function save_object()
-  {
-    /* Save automatic created POSTs like regex, checkboxes */
-    MultiSelectWindow::save_object(); 
-    $_SESSION['appfilter']['release']  = $this->selectedRelease;
-  }
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/applications/generic.tpl b/plugins/admin/applications/generic.tpl
deleted file mode 100644 (file)
index b50ed7e..0000000
+++ /dev/null
@@ -1,152 +0,0 @@
-<table summary="" style="width:100%;">
- <tr>
-  <td style="width:50%;">
-
-   <table summary="">
-     <tr>
-      <td><LABEL for="cn">{t}Application name{/t}{$must}</LABEL></td>
-      <td>
-{render acl=$cnACL}
-       <input id="cn" name="cn" size=25 maxlength=60 value="{$cn}" title="{t}Application name{/t}">
-{/render}
-      </td>
-    </tr>
-    <tr>
-     <td><LABEL for="gosaApplicationName">{t}Display name{/t}</LABEL></td>
-     <td>
-{render acl=$gosaApplicationNameACL}
-        <input id="gosaApplicationName" name="gosaApplicationName" size=35 maxlength=60 
-         value="{$gosaApplicationName}" title="{t}Application name to be displayed (i.e. below icons){/t}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><LABEL for="gosaApplicationExecute">{t}Execute{/t}{$must}</LABEL></td>
-     <td>
-{render acl=$gosaApplicationExecuteACL}
-        <input id="gosaApplicationExecute" name="gosaApplicationExecute" size=35 maxlength=120 
-         value="{$gosaApplicationExecute}" title="{t}Path and/or binary name of application{/t}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><LABEL for="description">{t}Description{/t}</LABEL></td>
-     <td>
-{render acl=$descriptionACL}
-      <input id="description" name="description" size=35 maxlength=80 value="{$description}">
-{/render}
-     </td>
-    </tr>
-    <tr><td colspan=2><div style="height:15px;"></div></td></tr>
-    <tr>
-      <td><LABEL for="base">{t}Base{/t}{$must}</LABEL></td>
-      <td>
-{render acl=$baseACL}
-       <select size="1" id="base" name="base" title="{t}Choose subtree to place application in{/t}" 
-        {if $isReleaseApplikation} disabled {/if}>
-        {html_options options=$bases selected=$base_select}
-       </select>
-{/render}
-{if !$isReleaseApplikation}
-{render acl=$baseACL disable_picture='images/folder_gray.png'}
-      <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
-{/render}
-{/if}
-      </td>
-     </tr>
-   </table>
-  </td>
-  <td style="border-left:1px solid #A0A0A0">
-   &nbsp;
-  </td>
-  <td style="vertical-align:top;">
-   <table summary="">
-    <tr>
-    <td>
-    <LABEL for="picture_file">{t}Icon{/t}</LABEL>
-    <br>
-    <img alt="" src="getbin.php?rand={$rand}" border=1 style="width:48px; height:48; background-color:white; vertical-align:bottom;">
-    </td>
-    <td style="vertical-align:top">
-    &nbsp;<br>
-
-    <input type="hidden" name="MAX_FILE_SIZE" value="100000">
-{render acl=$gosaApplicationIconACL}
-    <input name="picture_file" type="file" size="20" maxlength="255" accept="image/*.png" id="picture_file">
-{/render}
-{render acl=$gosaApplicationIconACL}
-<input type="submit" name="update" value="{t}Update{/t}" title="{t}Reload picture from LDAP{/t}">
-{/render}
-{render acl=$gosaApplicationIconACL}
-<input type="submit" name="remove_picture" value="{t}Remove picture{/t}" title="{t}Remove picture from LDAP{/t}">
-{/render}
-    </td>
-    </tr>
-   </table>
-  </td>
- </tr>
-</table>
-
-<p class="plugbottom" style="height:4px; margin-bottom:0px;">&nbsp;</p>
-
-<h2><img src="images/lamp.png" alt="{t}Options{/t}" align="middle">&nbsp;{t}Options{/t}</h2>
-<table summary="" style="width:100%;">
-  <tr>
-    <td style="width:50%;border-right:1px solid #B0B0B0; vertical-align:top">
-{render acl=$gosaApplicationFlagsACL}
-      <input type=checkbox name="exec_for_groupmembers" value="1" {$exec_for_groupmembers}>
-{/render}
-       {t}Only executable for members{/t}
-      <br>
-{render acl=$gosaApplicationFlagsACL}
-      <input type=checkbox name="overwrite_config" value="1" {$overwrite_config}>
-{/render}
-       {t}Replace user configuration on startup{/t}
-    </td>
-    <td>
-{render acl=$gosaApplicationFlagsACL}
-      <input type=checkbox name="place_on_desktop" value="1" {$place_on_desktop}>
-{/render}
-      {t}Place icon on members desktop{/t}
-      <br>
-{render acl=$gosaApplicationFlagsACL}
-      <input type=checkbox name="place_in_startmenu" value="1" {$place_in_startmenu}>
-{/render}
-      {t}Place entry in members startmenu{/t}
-      <br>
-{render acl=$gosaApplicationFlagsACL}
-      <input type=checkbox name="place_on_kicker" value="1" {$place_on_kicker}>
-{/render}
-      {t}Place entry in members launch bar{/t}
-    </td>
-  </tr>
-</table>
-
-<p class="plugbottom" style="height:4px; margin-bottom:0px;">&nbsp;</p>
-
-<table width="99%" summary="">
-       <tr>
-               <td>
-                       <h2><img src="images/fai_script.png" alt="{t}Script{/t}" align="middle">&nbsp;{t}Script{/t}</h2>
-{render acl=$gotoLogonScriptACL}
-                       <textarea name="gotoLogonScript" style='width:99%;height:220px;'>{$gotoLogonScript}</textarea>
-{/render}
-{render acl=$gotoLogonScriptACL}
-                       <input type="file" name="ScriptFile" value="{t}Import{/t}">
-{/render}
-{render acl=$gotoLogonScriptACL}
-                       <input type="submit" name="upLoad" value="{t}Upload{/t}">
-{/render}
-                       <input type='image' name='downloadScript'  src='images/save.png' title='{t}Download{/t}' class='center'>
-               </td>
-       </tr>
-</table>
-
-<div style="height:20px;"></div>
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('cn');
-  -->
-</script>
diff --git a/plugins/admin/applications/main.inc b/plugins/admin/applications/main.inc
deleted file mode 100644 (file)
index 2df7377..0000000
+++ /dev/null
@@ -1,55 +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
-*/
-
-if ($remove_lock){
-        if(isset($_SESSION['applicationManagement'])){
-                $applicationManagement= $_SESSION['applicationManagement'];
-                $applicationManagement->remove_lock();
-                del_lock ($ui->dn);
-                sess_del ('applicationManagement');
-        }
-} else {
-       /* Create applicationManagement object on demand */
-       if (!isset($_SESSION['applicationManagement']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
-               $_SESSION['applicationManagement']= new applicationManagement ($config, $_SESSION['ui']);
-       }
-       $applicationManagement= $_SESSION['applicationManagement'];
-       $applicationManagement->save_object();
-       $output= $applicationManagement->execute();
-
-       /* Page header*/
-       if (isset($_SESSION['objectinfo'])){
-               $display= print_header(get_template_path('images/application.png'), _("Application management"), "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".@LDAP::fix($_SESSION['objectinfo']));
-       } else {
-               $display= print_header(get_template_path('images/application.png'), _("Application management"));
-       }
-
-       /* Reset requested? */
-       if (isset($_GET['reset']) && $_GET['reset'] == 1){
-               del_lock ($ui->dn);
-               sess_del ('applicationManagement');
-       }
-
-       /* Show and save dialog */
-       $display.= $output;
-       $_SESSION['applicationManagement']= $applicationManagement;
-}
-
-?>
diff --git a/plugins/admin/applications/parameters.tpl b/plugins/admin/applications/parameters.tpl
deleted file mode 100644 (file)
index 57c2219..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-{$table}
-<div style="height:20px"></div>
diff --git a/plugins/admin/applications/release_select.tpl b/plugins/admin/applications/release_select.tpl
deleted file mode 100755 (executable)
index d58738f..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-<br> 
-<div class="contentboxh" style="border-bottom:1px solid #B0B0B0;">
- <p class="contentboxh"><img src="{$branchimage}" align="right" alt="[F]">{t}Branches{/t}</p>
-</div>
-<div class="contentboxb">
- <table summary="" style="width:100%;">
-  <tr>
-   <td>
-    {t}Current release{/t}&nbsp;
-    <select name="selectedRelease" onChange="document.mainform.submit();">
-     {html_options options=$releases selected=$selectedRelease}
-    </select>
-   </td>
-  </tr>
- </table>
-</div>
diff --git a/plugins/admin/applications/remove.tpl b/plugins/admin/applications/remove.tpl
deleted file mode 100644 (file)
index 8598ed8..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<div style="font-size:18px;">
-  <img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
-</div>
-<p>
- {$intro}
- {t}This may be used by several groups. 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}So - if you're sure - press 'Delete' to continue or 'Cancel' to abort.{/t}
-</p>
-
-<p class="plugbottom">
-       {if $multiple}
-               <input type=submit name="delete_multiple_application_confirm" value="{t}Delete{/t}">
-               &nbsp;
-               <input type=submit name="delete_multiple_application_cancel" value="{t}Cancel{/t}">
-       {else}
-               <input type=submit name="delete_app_confirm" value="{t}Delete{/t}">
-               &nbsp;
-               <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
-       {/if}
-</p>
-
diff --git a/plugins/admin/applications/tabs_application.inc b/plugins/admin/applications/tabs_application.inc
deleted file mode 100644 (file)
index 059e683..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-<?php
-
-class apptabs extends tabs
-{
-  var $Release= "";
-
-  function apptabs($config, $data, $dn,$category)
-  {
-    tabs::tabs($config, $data, $dn,$category);
-
-    /* Add references/acls/snapshots */
-    $this->addSpecialTabs();
-  }
-
-  function set_release($newRelease)
-  {
-    $this->Release= preg_replace('/,ou=apps,.*$/', '', $newRelease);
-    if ($this->Release != ""){
-      $this->Release= ",".$this->Release;
-    }
-  }
-
-  function save($ignore_account= FALSE)
-  {
-    $baseobject= $this->by_object['application'];
-
-    /* Check for new 'dn', in order to propagate the
-       'dn' to all plugins */
-    $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
-    if((!empty($tmp)) && (isset($_SESSION['appfilter']['release']))){
-      if(!$baseobject->isReleaseApplikation){
-        $new_dn= "cn=".$baseobject->cn.",ou=apps,".$baseobject->base;
-      }else{
-        $new_dn ="cn=".$baseobject->cn.",".$_SESSION['appfilter']['release'];
-      }
-    }else{
-      $new_dn= "cn=".$baseobject->cn.",ou=apps,".$baseobject->base;
-    }
-
-    /* Move group? */
-    if ($this->dn != $new_dn){
-
-      /* Write entry on new 'dn' */
-      if ($this->dn != "new"){
-        $baseobject->move($this->dn, $new_dn);
-        $this->by_object['application']= $baseobject;
-      }
-
-      /* Happen to use the new one */
-      $this->dn= $new_dn;
-    }
-
-    tabs::save();
-
-    /* Fix tagging if needed */
-    $baseobject->dn= $this->dn;
-    $baseobject->handle_object_tagging();
-  }
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/departments/class_departmentGeneric.inc b/plugins/admin/departments/class_departmentGeneric.inc
deleted file mode 100644 (file)
index 668da2f..0000000
+++ /dev/null
@@ -1,610 +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 department extends plugin
-{
-       /* department attributes */
-       var $ou= "";
-       var $description= "";
-       var $base= "";
-       var $st= "";
-       var $l= "";
-       var $postalAddress= "";
-       var $businessCategory= "";
-       var $telephoneNumber= "";
-       var $facsimileTelephoneNumber= "";
-       var $orig_dn= "";
-       var $is_administrational_unit= false;
-       var $gosaUnitTag= "";
-  var $view_logged = FALSE;
-       var $rec_dst=false;     // Destination for recursive move
-       var $rec_src=false;     // Source for recursive move 
-       var $rec_cpy=false;     // Is recursive move requested ? 
-
-       /* Headpage attributes */
-       var $last_dep_sorting= "invalid";
-       var $departments= array();
-
-  var $must_be_tagged = false;
-
-       /* attribute list for save action */
-       var $attributes= array("ou", "description", "businessCategory", "st", "l", "postalAddress",
-                       "telephoneNumber", "facsimileTelephoneNumber", "gosaUnitTag");
-       var $objectclasses= array("top", "gosaDepartment", "organizationalUnit");
-  var $initially_was_tagged = false;
-
-  
-  /* Temporary disable the Unit Tag functionalityi.
-     This is not used anymore, cause of the new acl implementation. 
-     Setting this to TRUE will disable 
-      all POST / GET activity, "Department tagging" and the checkbox within the generic template.
-   */
-  var $UnitTagDiabled     = TRUE;
-  var $orig_base = "";
-  var $orig_ou = "";
-
-       function department (&$config, $dn)
-       {
-
-               plugin::plugin($config, $dn);
-               $this->is_account= TRUE;
-               $this->ui= get_userinfo();
-               $this->dn= $dn;
-               $this->orig_dn= $dn;
-               $this->orig_ou= $this->ou;
-               $this->config= $config;
-
-               /* Set base */
-               if ($this->dn == "new"){
-                       $ui= get_userinfo();
-                       if(isset($_SESSION['CurrentMainBase'])){
-                               $this->base= $_SESSION['CurrentMainBase'];
-                       }else{
-                               $this->base= dn2base($ui->dn);
-                       }
-               } else {
-                       $this->base= preg_replace ("/^[^,]+,/", "", $this->dn);
-               }
-
-    $this->orig_base = $this->base;
-
-               /* Is administrational Unit? */
-               if ($dn != "new" && in_array_ics('gosaAdministrativeUnit', $this->attrs['objectClass'])){
-                       $this->is_administrational_unit= true;
-      $this->initially_was_tagged = true;
-               }
-       }
-
-       function execute()
-       {
-               /* Call parent execute */
-               plugin::execute();
-
-    /* Log view */
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","department/".get_class($this),$this->dn);
-    }
-
-               /* Reload departments */
-               $this->config->get_departments($this->dn);
-               $this->config->make_idepartments();
-               $smarty= get_smarty();
-
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translation){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-
-               /* Base select dialog */
-               $once = true;
-               foreach($_POST as $name => $value){
-                       if((preg_match("/^chooseBase/",$name) && $once) && ($this->acl_is_moveable())){
-                               $once = false;
-                               $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
-                               $this->dialog->setCurrentBase($this->base);
-                       }
-               }
-
-               /* Dialog handling */
-               if(is_object($this->dialog)){
-                       /* Must be called before save_object */
-                       $this->dialog->save_object();
-
-                       if($this->dialog->isClosed()){
-                               $this->dialog = false;
-                       }elseif($this->dialog->isSelected()){
-
-        /* A new base was selected, check if it is a valid one */
-        $tmp = $this->get_allowed_bases();
-        if(isset($tmp[$this->dialog->isSelected()])){
-          $this->base = $this->dialog->isSelected();
-        }
-  
-                               $this->dialog= false;
-                       }else{
-                               return($this->dialog->execute());
-                       }
-               }
-
-               /* Hide all departments, that are subtrees of this department */
-    $bases = $this->get_allowed_bases();
-               if(($this->dn == "new")||($this->dn == "")){
-                       $tmp = $bases;
-               }else{
-                       $tmp    = array();      
-                       foreach($bases as $dn=>$base){
-                               $fixed = str_replace("/","\\",$this->dn);
-                               /* Only attach departments which are not a subtree of this one */
-                               if(!preg_match("/".$fixed."/",$dn)){
-                                       $tmp[$dn]=$base;
-                               }
-                       }
-               }
-               $smarty->assign("bases", $tmp);
-
-               foreach ($this->attributes as $val){
-                       $smarty->assign("$val", $this->$val);
-               }
-               $smarty->assign("base_select", $this->base);
-
-    /* Set admin unit flag */
-    $smarty->assign("UnitTagDiabled",$this->UnitTagDiabled);
-    if(!$this->UnitTagDiabled){
-      if ($this->is_administrational_unit) {
-        $smarty->assign("unitTag", "checked");
-      } else {
-        $smarty->assign("unitTag", "");
-      }
-    }
-
-               return($smarty->fetch (get_template_path('generic.tpl', TRUE)));
-       }
-
-       function clear_fields()
-       {
-               $this->dn   = "";
-               $this->base = "";
-
-               foreach ($this->attributes as $val){
-                       $this->$val= "";
-               }
-       }
-
-       function remove_from_parent()
-       {
-               $ldap= $this->config->get_ldap_link();
-               $ldap->cd ($this->dn);
-               $ldap->recursive_remove();
-    new log("remove","department/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    show_ldap_error($ldap->get_error(), sprintf(_("Removing of department with dn '%s' failed."),$this->dn));
-
-               /* Optionally execute a command after we're done */
-               $this->handle_post_events('remove');
-       }
-
-       function must_be_tagged()
-       {
-               return $this->must_be_tagged;
-       }
-
-       function am_i_moved()
-       {
-               return $this->rec_cpy;
-       }
-
-
-       /* Save data to object */
-       function save_object()
-       {
-               if (isset($_POST['dep_generic_posted'])){
-
-      /* Create a base backup and reset the
-         base directly after calling plugin::save_object();
-         Base will be set seperatly a few lines below */
-      $base_tmp = $this->base;
-      plugin::save_object();
-      $this->base = $base_tmp;
-
-      /* Set new base if allowed */
-      $tmp = $this->get_allowed_bases();
-      if(isset($_POST['base'])){
-        if(isset($tmp[$_POST['base']])){
-          $this->base= $_POST['base'];
-        }
-      }
-
-      /* Save tagging flag */
-      if(!$this->UnitTagDiabled){
-        if ($this->acl_is_writeable("unitTag")){
-          if (isset($_POST['unitTag'])){
-            $this->is_administrational_unit= true;
-          } else {
-            $this->is_administrational_unit= false;
-          }
-        }
-      }
-    }
-       }
-
-
-       /* Check values */
-       function check()
-       {
-               /* Call common method to give check the hook */
-               $message= plugin::check();
-
-               /* Check for presence of this department */
-               $ldap= $this->config->get_ldap_link();
-    $ldap->ls ("(&(ou=".$this->ou.")(objectClass=organizationalUnit))", $this->base, array('dn'));
-    if ($this->orig_dn == "new" && $ldap->count()){
-                       $message[]= _("Department with that 'Name' already exists.");
-               } elseif ($this->orig_dn != $this->dn && !($attrs === FALSE)){
-                       $message[]= _("Department with that 'Name' already exists.");
-               }
-
-               /* All required fields are set? */
-               if ($this->ou == ""){
-                       $message[]= _("Required field 'Name' is not set.");
-               }
-               if ($this->description == ""){
-                       $message[]= _("Required field 'Description' is not set.");
-               }
-
-    if(is_department_name_reserved($this->ou,$this->base)){
-      $message[]= sprintf(_("The field 'Name' contains the reserved word '%s'. Please choose another name."),$this->ou);
-    }
-
-               if (preg_match ('/[#+:=>\\\\\/]/', $this->ou)){
-                       $message[]= _("The field 'Name' contains invalid characters.");
-               }
-               if (!is_phone_nr($this->telephoneNumber)){
-                       $message[]= _("The field 'Phone' contains an invalid phone number.");
-               }
-               if (!is_phone_nr($this->facsimileTelephoneNumber)){
-                       $message[]= _("The field 'Fax' contains an invalid phone number.");
-               }
-
-               return $message;
-       }
-
-
-       /* Save to LDAP */
-       function save()
-       {
-               $ldap= $this->config->get_ldap_link();
-
-    if(!$this->UnitTagDiabled){
-
-      /* Add tag objects if needed */
-      if ($this->is_administrational_unit){
-
-        /* If this wasn't tagged before add oc an reset unit tag */
-        if(!$this->initially_was_tagged){
-          $this->objectclasses[]= "gosaAdministrativeUnit";
-          $this->gosaUnitTag= "";
-
-          /* It seams that this method is called twice, 
-             set this to true. to avoid adding this oc twice */
-          $this->initially_was_tagged = true;
-        }
-
-        if ($this->gosaUnitTag == ""){
-
-          /* It's unlikely, but check if already used... */
-          $try= 5;
-          $ldap->cd($this->config->current['BASE']);
-          while ($try--){
-
-            /* Generate microtime stamp as tag */
-            list($usec, $sec)= explode(" ", microtime());
-            $time_stamp= preg_replace("/\./", "", $sec.$usec);
-
-            $ldap->search("(&(objectClass=gosaAdministrativeUnit)(gosaUnitTag=$time_stamp))",array("gosaUnitTag"));
-            if ($ldap->count() == 0){
-              break;
-            }
-          }
-          if($try == 0) {
-            print_red(_("Fatal error: Can't find an unused tag to mark the administrative unit!"));
-            return;
-          }
-          $this->gosaUnitTag= preg_replace("/\./", "", $sec.$usec);
-        }
-      }
-    }
-               plugin::save();
-
-    if(!$this->UnitTagDiabled){
-
-      /* Remove tag information if needed */
-      if (!$this->is_administrational_unit){
-        $tmp= array();
-
-        /* Remove gosaAdministrativeUnit from this plugin */
-        $has_unit_tag= false;
-        foreach($this->attrs['objectClass'] as $oc){
-          if (!preg_match("/^gosaAdministrativeUnit$/i", $oc)){
-            $tmp[]= $oc;
-          }
-          if (preg_match("/^gosaAdministrativeUnitTag$/i", $oc)){
-            $has_unit_tag= true;
-          }
-        }
-        $this->attrs['objectClass']= $tmp;
-
-        if(!$has_unit_tag && isset($this->attrs['gosaUnitTag'])){
-          $this->attrs['gosaUnitTag']= array();
-        }
-        $this->gosaUnitTag = "";
-      }
-    }
-
-               /* Write back to ldap */
-               $ldap= $this->config->get_ldap_link();
-               $ldap->cat($this->dn, array('dn'));
-               $a= $ldap->fetch();
-               $ldap->cd($this->dn);
-
-               if (count($a)){
-                       $this->cleanup();
-                       $ldap->modify ($this->attrs); 
-      new log("modify","department/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-                       $this->handle_post_events('modify');
-               } else {
-                       $ldap->add($this->attrs);
-                       $this->handle_post_events('add');
-      new log("create","department/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-               }
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of department with dn '%s' failed."),$this->dn));
-
-
-    if(!$this->UnitTagDiabled){
-      /* The parameter forces only to set must_be_tagged, and don't touch any objects 
-         This will be done later */
-      $this->tag_objects(true);
-
-      /* Fix tagging if needed */
-      if (!$this->is_administrational_unit){
-        $this->handle_object_tagging();
-      }
-    }
-    
-    /* Optionally execute a command after we're done */
-               $this->postcreate();
-    return(false);
-       }
-
-
-  function ShowMoveFrame()
-  {
-    $smarty = get_smarty();
-    $smarty->assign("src","?plug=".$_GET['plug']."&amp;PerformRecMove");
-    $smarty->assign("message","As soon as the move operation has finished, you can scroll down to end of the page and press the 'Continue' button to continue with the department management dialog.");
-    $display=  $smarty->fetch(get_template_path("dep_iframe.tpl",TRUE));
-    return($display);
-  }
-
-  function ShowTagFrame()
-  {
-    $smarty = get_smarty();
-    $smarty->assign("src","?plug=".$_GET['plug']."&TagDepartment");
-    $smarty->assign("message","As soon as the tag operation has finished, you can scroll down to end of the page and press the 'Continue' button to continue with the department management dialog.");
-    $display=  $smarty->fetch(get_template_path("dep_iframe.tpl",TRUE));
-    return($display);
-  }
-
-       /* Tag objects to have the gosaAdministrativeUnitTag */
-       function tag_objects($OnlySetTagFlag = false)
-       {
-    if(!$OnlySetTagFlag){
-      $smarty= get_smarty();
-      /* Print out html introduction */
-      echo '  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
-        <html>
-        <head>
-        <title></title>
-        <style type="text/css">@import url("themes/default/style.css");</style>
-        <script language="javascript" src="include/focus.js" type="text/javascript"></script>
-        </head>
-        <body style="background: none; margin:4px;" id="body" >
-        ';
-      echo "<h3>".sprintf(_("Tagging '%s'."),"<i>".@LDAP::fix($this->dn)."</i>")."</h3>";
-    }
-
-               $add= $this->is_administrational_unit;
-               $len= strlen($this->dn);
-               $ldap= $this->config->get_ldap_link();
-               $ldap->cd($this->dn);
-               if ($add){
-                       $ldap->search('(!(&(objectClass=gosaAdministrativeUnitTag)(gosaUnitTag='.
-                                                               $this->gosaUnitTag.')))', array('dn'));
-               } else {
-                       $ldap->search('objectClass=gosaAdministrativeUnitTag', array('dn'));
-               }
-
-               while ($attrs= $ldap->fetch()){
-
-                       /* Skip self */
-                       if ($attrs['dn'] == $this->dn){
-                               continue;
-                       }
-
-                       /* Check for confilicting administrative units */
-                       $fix= true;
-                       foreach ($this->config->adepartments as $key => $tag){
-                               /* This one is shorter than our dn, its not relevant... */
-                               if ($len >= strlen($key)){
-                                       continue;
-                               }
-
-                               /* This one matches with the latter part. Break and don't fix this entry */
-                               if (preg_match('/(^|,)'.normalizePreg($key).'$/', $attrs['dn'])){
-                                       $fix= false;
-                                       break;
-                               }
-                       }
-
-      /* Fix entry if needed */
-      if ($fix){
-        if($OnlySetTagFlag){
-          $this->must_be_tagged =true;
-          return;
-        }
-                               $this->handle_object_tagging($attrs['dn'], $this->gosaUnitTag, TRUE );
-                       }
-               }
-    if(!$OnlySetTagFlag){
-      echo '<p class="seperator">&nbsp;</p>';
-      echo "<div style='width:100%;text-align:right;'><form name='form' method='post' action='?plug=".$_GET['plug']."' target='_parent'>
-        <br><input type='submit' name='back' value='"._("Continue")."'>
-        </form></div>";
-    }
-       }
-
-
-       /* Move/Rename complete trees */
-       function recursive_move($src_dn, $dst_dn,$force = false)
-       {
-    /* If force == false prepare to recursive move this object from src to dst 
-        on the next call. */
-               if(!$force){
-                       $this->rec_cpy  = true;
-                       $this->rec_src  = $src_dn;
-                       $this->rec_dst  = $dst_dn;
-               }else{
-
-      /* If this is called, but not wanted, abort */
-                       if(!$this->rec_cpy){ 
-                               return;
-                       }
-
-                       $src_dn = $this->rec_src;
-                       $dst_dn = $this->rec_dst;
-
-                       /* Print header to have styles included */
-                       $smarty= get_smarty();
-
-      echo '  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
-        <html>
-        <head>
-        <title></title>
-        <style type="text/css">@import url("themes/default/style.css");</style>
-        <script language="javascript" src="include/focus.js" type="text/javascript"></script>
-        </head>
-        <body style="background: none; margin:4px;" id="body" >
-        ';
-                       echo "<h3>".sprintf(_("Moving '%s' to '%s'"),"<i>".@LDAP::fix($src_dn)."</i>","<i>".@LDAP::fix($dst_dn)."</i>")."</h3>";
-
-
-                       /* Check if the destination entry exists */
-                       $ldap= $this->config->get_ldap_link();
-
-                       /* Check if destination exists - abort */
-                       $ldap->cat($dst_dn, array('dn'));
-                       if ($ldap->fetch()){
-                               trigger_error("Recursive_move ".@LDAP::fix($dst_dn)." already exists.",
-                                               E_USER_WARNING);
-                               echo sprintf("Recursive_move: '%s' already exists", @LDAP::fix($dst_dn))."<br>"; 
-                               return (FALSE);
-                       }
-
-                       /* Perform a search for all objects to be moved */
-                       $objects= array();
-                       $ldap->cd($src_dn);
-                       $ldap->search("(objectClass=*)", array("dn"));
-                       while($attrs= $ldap->fetch()){
-                               $dn= $attrs['dn'];
-                               $objects[$dn]= strlen($dn);
-                       }
-
-                       /* Sort objects by indent level */
-                       asort($objects);
-                       reset($objects);
-
-                       /* Copy objects from small to big indent levels by replacing src_dn by dst_dn */
-                       foreach ($objects as $object => $len){
-
-
-                               $src= str_replace("\\","\\\\",$object);
-                               $dst= preg_replace("/".str_replace("\\","\\\\",$src_dn)."$/", "$dst_dn", $object);
-                               $dst= str_replace($src_dn,$dst_dn,$object);
-
-                               echo "<b>"._("Object").":</b> ".@LDAP::fix($src)."<br>";
-
-        $this->update_acls($object, $dst,TRUE);
-
-                               if (!$this->copy($src, $dst)){
-                                       echo "<font color='#FF0000'><br>".sprintf(_("FAILED to copy %s, aborting operation"),@LDAP::fix($src))."</font>";
-                                       return (FALSE);
-                               }
-        echo "<script language=\"javascript\" type=\"text/javascript\">scrollDown2();</script>" ;
-                               flush();
-                       }
-
-                       /* Remove src_dn */
-                       $ldap->cd($src_dn);
-                       $ldap->recursive_remove();
-      $this->dn = $this->rec_dst;
-                       $this->rec_src = $this->rec_dst = "";
-                       $this->rec_cpy =false;
-
-                       echo '<p class="seperator">&nbsp;</p>';
-
-                       echo "<div style='width:100%;text-align:right;'><form name='form' method='post' action='?plug=".$_GET['plug']."' target='_parent'>
-                               <br><input type='submit' name='back' value='"._("Continue")."'>
-                               </form></div>";
-
-      echo "<script language=\"javascript\" type=\"text/javascript\">scrollDown2();</script>" ;
-                       echo "</body></html>";
-
-                       return (TRUE);
-               }
-       }
-
-
-  /* Return plugin informations for acl handling */ 
-  static function plInfo()
-  {
-    return (array("plShortName"   => _("Generic"),
-                  "plDescription" => _("Departments"),
-                  "plSelfModify"  => FALSE,
-                  "plPriority"    => 0,
-                  "plDepends"     => array(),
-                  "plSection"     => array("admin"),
-                  "plCategory"    => array("department" => array("objectClass" => "gosaDepartment", "description" => _("Departments"))),
-            
-                  "plProvidedAcls" => array(
-                    "description"       => _("Description"),
-                    "c"                 => _("Country"),
-                    "base"              => _("Base"),
-                    "l"                 => _("Location"),
-                    "telephoneNumber"   => _("Telephone"),
-                    "ou"                => _("Department name"),
-                    "businessCategory"  => _("Category"),
-                    "st"                => _("State"),
-                    "postalAddress"     => _("Address"),
-                    "gosaUnitTag"       => _("Administrative settings"),
-                    "facsimileTelephoneNumber" => _("Fax"))
-                  ));
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/departments/class_departmentManagement.inc b/plugins/admin/departments/class_departmentManagement.inc
deleted file mode 100644 (file)
index e2db188..0000000
+++ /dev/null
@@ -1,535 +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 departmentManagement extends plugin
-{
-  /* Definitions */
-  var $plHeadline= "Departments";
-  var $plDescription= "This does something";
-
-  /* CLI vars */
-  var $cli_summary= "Handling of LDAP subtrees";
-  var $cli_description= "Some longer text\nfor help";
-  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* Headpage attributes */
-  var $last_dep_sorting= "invalid";
-  var $departments= array();
-  var $deptabs= NULL;
-
-  /* attribute list for save action */
-  var $attributes= array();
-  var $objectclasses= array();
-
-  /* Vars to handle operations after saving the department 
-     Recursive move && tagging   */
-  var $ObjectInSaveMode         = false;    // Is true, if current object wasn't saved right now
-  var $ObjectTaggingRequested   = false;    // Object must be tagged, an iframe will be shown. 
-  var $RecursiveRemoveRequested = false;    // Is true, if this object must be moved, an iframe will be displayed in this case
-
-  function departmentManagement (&$config, &$ui)
-  {
-    $this->ui= &$ui;
-    $this->dn= "";
-    $this->config= &$config;
-    $this->DivListDepartment = new divListDepartment($this->config,$this);
-  }
-
-  function execute()
-  {
-    global $config;
-  
-    /* Call parent execute */
-    plugin::execute();
-
-    /***************
-      Var init 
-     ***************/
-
-    $_SESSION['LOCK_VARS_TO_USE'] = array("/^act$/","/^id$/","/^dep_edit_.*/","/^dep_del_.*/","/^item_selected/","/^remove_multiple_departments/");
-
-    /* Reload departments */
-    $smarty                                            = get_smarty();
-    $display                                   = "";
-    $s_action                                  = "";  // Will contain an action, like del or edit
-    $s_entry                                   = "";  // The entry name for edit delete -...
-
-
-    /***************
-      Check posts  
-     ***************/
-
-    // Check Post action
-    foreach($_POST as $key => $val){
-      // Post for delete
-      if(preg_match("/dep_del.*/",$key)){
-        $s_action = "del";
-        $s_entry  = preg_replace("/dep_".$s_action."_/i","",$key);
-        $s_entry  = preg_replace("/_.*$/","",$s_entry);
-        $s_entry  = base64_decode($s_entry);
-        // Post for edit
-      }elseif(preg_match("/dep_edit_.*/",$key)){
-        $s_action="edit";
-        $s_entry  = preg_replace("/dep_".$s_action."_/i","",$key);
-        $s_entry  = preg_replace("/_.*$/","",$s_entry);
-        $s_entry  = base64_decode($s_entry);
-        // Post for new
-      }elseif(preg_match("/^remove_multiple_departments/",$key)){
-        $s_action="del_multiple";
-      }elseif(preg_match("/dep_new.*/",$key)){
-        $s_action="new";
-      }
-    }
-
-    /* Create options */
-    if(isset($_POST['menu_action']) && $_POST['menu_action'] == "dep_new"){
-      $s_action = "new";
-    }
-
-    /* handle remove from layers menu */
-    if(isset($_POST['menu_action']) && preg_match("/^remove_multiple/",$_POST['menu_action'])){
-      $s_action = "del_multiple";
-    }
-
-
-    /***************
-      Create a new department
-     ***************/
-
-    /* New Entry if Posted action (s_action) == new
-     */
-    if ($s_action=="new"){
-      $this->dn= "new";
-      $this->deptabs= new deptabs($this->config,$this->config->data['TABS']['DEPTABS'], $this->dn,"department");
-      $this->deptabs->set_acl_base($this->DivListDepartment->selectedBase);
-    }
-
-
-    /***************
-      Edit entry
-     ***************/
-
-    /* Edit Entry if Posted action (s_action) == edit 
-     * The entry which will be edited is defined in $s_entry
-     */
-    if (( $s_action=="edit") && (!isset($this->deptabs->config))){
-      $this->dn= $this->config->departments[trim($s_entry)];
-
-      if (($user= get_lock($this->dn)) != ""){
-        return(gen_locked_message ($user, $this->dn));
-      }
-
-      /* Lock the current entry, so everyone will get the  above dialog */
-      add_lock ($this->dn, $this->ui->dn);
-
-      /* Register deptabs to trigger edit dialog */
-      $this->deptabs= new deptabs($this->config,$this->config->data['TABS']['DEPTABS'], $this->dn,"department");
-      $this->deptabs->set_acl_base($this->dn);
-
-      $_SESSION['objectinfo']= $this->dn;
-    }
-
-
-    /********************
-      Delete MULTIPLE entries requested, display confirm dialog
-     ********************/
-
-    if ($s_action=="del_multiple"){
-      $ids = $this->list_get_selected_items();
-
-
-      if(count($ids)){
-        foreach($ids as $id){
-          $id = base64_decode($id);
-          $dn = $this->config->departments[$id];
-  
-          if (($user= get_lock($dn)) != ""){
-            return(gen_locked_message ($user, $dn));
-          }
-          $this->dns[$id] = $dn;
-        }
-
-        $dns_names = "<br><pre>";
-        foreach($this->dns as $dn){
-          add_lock ($dn, $this->ui->dn);
-          $dns_names .= $dn."\n";
-        }
-        $dns_names .="</pre>";
-
-        /* Lock the current entry, so nobody will edit it during deletion */
-        if (count($this->dns) == 1){
-          $smarty->assign("info",     sprintf(_("You're about to delete the following entry %s"), @LDAP::fix($dns_names)));
-        } else {
-          $smarty->assign("info",     sprintf(_("You're about to delete the following entries %s"), @LDAP::fix($dns_names)));
-        }
-        $smarty->assign("multiple", true);
-        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
-      }
-    }
-   
-
-    /********************
-      Delete MULTIPLE entries confirmed
-     ********************/
-
-    /* Confirmation for deletion has been passed. Users should be deleted. */
-    if (isset($_POST['delete_multiple_department_confirm'])){
-
-      /* Remove user by user and check acls before removeing them */
-      foreach($this->dns as $key => $dn){
-        $acl = $this->ui->get_permissions($dn,"department/department");
-        if (preg_match('/d/', $acl)){
-
-          /* Delete request is permitted, perform LDAP action */
-          $this->deptabs= new deptabs($this->config,$this->config->data['TABS']['DEPTABS'], $dn,"department");
-          $this->deptabs->set_acl_base();
-          $this->deptabs->delete ();
-          $this->deptabs = NULL;
-        } else {
-          print_red (_("You have no permission to remove this department."));
-        }
-        /* Remove lock file after successfull deletion */
-        del_lock ($dn);
-        unset($this->dns[$key]);
-      }
-    }
-
-    /********************
-      Delete MULTIPLE entries Canceled
-     ********************/
-
-    /* Remove lock */
-    if(isset($_POST['delete_multiple_department_cancel'])){
-      foreach($this->dns as $key => $dn){
-        del_lock ($dn);
-        unset($this->dns[$key]);
-      }
-    }
-
-
-    /***************
-      Delete entry 
-     ***************/
-
-    /* Delete Entry if Posted action (s_action) == del 
-     * The entry which will be deleted is defined in $s_entry
-     */
-    if ($s_action =="del"){
-      $this->dn= $this->config->departments[trim($s_entry)];
-
-      /* check acls */
-      $acl = $this->ui->get_permissions($this->dn,"department/department");
-      if(preg_match("/d/",$acl)){
-
-        /* Check locking */
-        if (($user= get_lock($this->dn)) != ""){
-          $_SESSION['dn']= $this->dn;
-          return(gen_locked_message($user, $this->dn));
-        } else {
-          add_lock ($this->dn, $this->ui->dn);
-          $smarty->assign("info", sprintf(_("You're about to delete the whole LDAP subtree placed under '%s'."), @LDAP::fix($this->dn)));
-          $smarty->assign("multiple", false);
-          $display.= $smarty->fetch (get_template_path('remove.tpl', TRUE));
-          return ($display);
-        }
-      }else{
-        print_red (_("You have no permission to remove this department."));
-      }
-    }
-
-
-    /***************
-      Delete department confirmed  
-     ***************/
-
-    /* If department deletion is accepted ...
-     * Finally delete department 
-     */
-    if (isset($_POST['delete_department_confirm'])){
-
-      /* check acls */
-      $acl = $this->ui->get_permissions($this->dn,"department/department");
-      if(preg_match("/d/",$acl)){
-        $this->remove_from_parent();
-      } else {
-        print_red (_("You have no permission to remove this department."));
-      }
-    }
-
-
-    /***************
-      Edit department finished 
-     ***************/
-
-    if ((isset($_POST['edit_finish'])) && (isset($this->deptabs->config)) && !isset($_POST['dep_move_confirm'])){
-      $this->deptabs->save_object();
-      $obj = $this->deptabs->by_object['department'];
-      if($obj->orig_dn != "new"){
-        if($obj->orig_ou != $obj->ou || $obj->base != $obj->orig_base){
-          return($smarty->fetch(get_template_path("dep_move_confirm.tpl",TRUE)));
-        }
-      }
-    }
-
-    /* Save changes */
-    if ((isset($_POST['edit_finish'])|| isset($_POST['dep_move_confirm'])) && (isset($this->deptabs->config))){
-
-      /* Check tabs, will feed message array */
-      $message= $this->deptabs->check();
-
-      /* Save, or display error message? */
-      if (count($message) == 0){
-
-        $this->deptabs->save(true);
-        global $config;
-        $config->get_departments();
-        $config->make_idepartments();
-        $this->config = $config;
-
-        /* This object must be tagged, so set ObjectTaggingRequested to true */
-        if($this->deptabs->by_object['department']->must_be_tagged()){
-          $this->ObjectTaggingRequested   = true; 
-        }              
-
-        /* Get recursive move is required, set RecursiveRemoveRequested to true */
-        if($this->deptabs->by_object['department']->am_i_moved()){     
-          $this->RecursiveRemoveRequested = true;
-        }              
-      
-        /* This var indicated that there is an object which isn't saved right now. */
-        $this->ObjectInSaveMode = true;
-
-      } else {
-        /* Ok. There seem to be errors regarding to the tab data,
-           show message and continue as usual. */
-        show_errors($message);
-      }
-    }
-
-
-    /***************
-      Handle Tagging (Return output for an iframe)
-     ***************/
-
-    /* This department must be tagged (Is called from iframe, generates output)*/
-    if(isset($_GET['TagDepartment'])){
-      $this->deptabs->by_object['department']->tag_objects();
-      exit();  
-    }
-
-
-    /***************
-      Handle recursive move (Return output for an iframe)
-     ***************/
-
-    /* initiate recursive remove  (Is called from iframe, generates output)*/
-    if(isset($_GET['PerformRecMove'])){
-      $this->deptabs->by_object['department']->recursive_move("","",true);
-      $this->DivListDepartment->selectedBase = $this->deptabs->by_object['department']->dn;  
-      exit();
-    }
-
-
-    /***************
-      Return iframes, which call tagging / recusrsive move 
-     ***************/
-
-    /* While one of these vars below isset, we must return an iframe, 
-       to perform requested operation */
-    if($this->ObjectTaggingRequested){
-      $this->ObjectTaggingRequested = false;
-      return($this->deptabs->by_object['department']->ShowTagFrame());
-    }
-    if($this->RecursiveRemoveRequested){
-      $this->RecursiveRemoveRequested = false;
-      return($this->deptabs->by_object['department']->ShowMoveFrame());
-    }
-
-
-    /***************
-      In case of tagging/moving the object wasn't deleted, do it know
-     ***************/
-
-    /* If there is an unsaved object and all operations are done
-       remove locks & save object tab & unset current object */
-    if($this->ObjectInSaveMode && (!$this->RecursiveRemoveRequested) && (!$this->ObjectTaggingRequested)){
-      $this->deptabs->save();
-      $this->config->get_departments();
-      $this->ObjectInSaveMode = false;
-      if ($this->dn != "new"){
-        del_lock ($this->dn);
-      }
-      unset ($this->deptabs);
-      $this->deptabs= NULL;
-      unset ($_SESSION['objectinfo']);
-    }
-
-
-    /***************
-      Dialog canceled  
-     ***************/
-
-    /* User canceled edit oder delete
-     * Cancel dialog 
-     */
-    if (isset($_POST['edit_cancel']) || isset($_POST['delete_cancel']) || isset($_POST['delete_department_confirm'])){
-      del_lock ($this->dn);
-      unset($this->depdabs);
-      $this->deptabs= NULL;
-      unset ($_SESSION['objectinfo']);
-    }
-
-    /* Headpage or normal plugin screen? */
-    if ($this->deptabs !== NULL){
-
-      /* Show main page (tabs) */
-      $display= $this->deptabs->execute();
-      if (!$this->deptabs->by_object[$this->deptabs->current]->dialog){
-        $display.= "<p style=\"text-align:right\">\n";
-        $display.= "<input type=submit name=\"edit_finish\" value=\""._("Save")."\">\n";
-        $display.= "&nbsp;\n";
-        $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
-        $display.= "</p>";
-      }
-      return ($display);
-    }else{
-      /* Display dialog with group list */
-      $this->DivListDepartment->parent = $this;
-      $this->DivListDepartment->execute();
-      $this->reload();
-      $this->DivListDepartment->DepartmentsAdded = true;
-      $this->DivListDepartment->setEntries($this->departments);
-      return($this->DivListDepartment->Draw());
-    }
-  }
-
-
-  function reload()
-  {
-    /* Vairaible init */
-    $base         = $this->DivListDepartment->selectedBase;
-    $base_back    = preg_replace("/^[^,]+,/","",$base);
-    $Regex        = $this->DivListDepartment->Regex;
-  
-    // Create Array to Test if we have a valid back button
-    $tmp = $_SESSION['config']->idepartments;
-
-    // In case of a valid back button create entry
-    if(isset($tmp[$base_back])){
-      $tmp2    ['dn']          = convert_department_dn($base_back);
-
-      // If empty always go to top
-      if(empty($tmp2['dn'])){
-        $tmp2['dn']="/";
-      }
-      $tmp2    ['description'][0] = ".. "._("Back");
-      $result[$tmp[$base_back]]=$tmp2;
-    }
-
-    if($this->DivListDepartment->SubSearch){
-      $res= get_list("(&(|(ou=$Regex)(description=$Regex))(objectClass=gosaDepartment))",
-          "department", $base, array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH);
-    }else{
-      $res= get_list("(&(|(ou=$Regex)(description=$Regex))(objectClass=gosaDepartment))",
-          "department", $base, array("ou", "description"), GL_SIZELIMIT );
-    }
-
-    $this->departments= array();
-
-    /* Add current base to the list of available departments, but only if its naming attribute is 'ou' */
-    if(preg_match("/^ou=/",$base)){
-      $this->departments [ convert_department_dn($base) ] = ".";
-    }
-
-    foreach ($res as $key => $value){
-
-      /* Don't display base as entry on subsearch */
-      if(($value['dn'] == $base) && ($this->DivListDepartment->SubSearch)){
-        continue;
-      }
-
-      $cdn= convert_department_dn($value['dn']);
-
-      /* Append to dep list */
-      if(isset($value["description"][0])){
-        $this->departments[$cdn]= get_sub_department($cdn)." - [".$value["description"][0]."]";
-      }else{
-        $this->departments[$cdn]= get_sub_department($cdn);//$value["description"][0];
-      }
-    }
-    natcasesort ($this->departments);
-    reset ($this->departments);
-  }
-
-  function remove_from_parent()
-  {
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd ($this->dn);
-    $ldap->recursive_remove();
-
-    /* Optionally execute a command after we're done */
-    $this->postremove();
-
-    /* Delete references to object groups */
-    $ldap->cd ($this->config->current['BASE']);
-    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
-    while ($ldap->fetch()){
-      $og= new ogroup($this->config, $ldap->getDN());
-      unset($og->member[$this->dn]);
-      $og->save ();
-    }
-
-  }
-
-
-  function list_get_selected_items()
-  {
-    $ids = array();
-    foreach($_POST as $name => $value){
-      if(preg_match("/^item_selected_[a-z0-9\\/\=]*$/i",$name)){
-        $id   = preg_replace("/^item_selected_/","",$name);
-        $ids[$id] = $id;
-      }
-    }
-    return($ids);
-  }
-
-
-  function remove_lock()
-  {
-    if (isset($this->dn)){
-      del_lock ($this->dn);
-    }
-  }
-
-  function save_object()
-  {
-    /* reload department */
-    $this->config->get_departments();
-
-    $this->config->make_idepartments();
-    $this->DivListDepartment->config= $this->config;
-    $this->DivListDepartment->save_object();
-  }
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/departments/class_divListDepartment.inc b/plugins/admin/departments/class_divListDepartment.inc
deleted file mode 100755 (executable)
index b1f642d..0000000
+++ /dev/null
@@ -1,228 +0,0 @@
-<?php
-
-class divListDepartment extends MultiSelectWindow
-{
-
-  /* Current base */
-  var $selectedBase       = "";
-  var $departments        = array();
-
-  /* Regex */
-  var $Regex              = "*";
-  
-  /* Subsearch checkbox */
-  var $SubSearch          = false;
-
-  var $parent             ;
-  var $ui                 ;
-
-  function divListDepartment (&$config, &$parent)
-  {
-    MultiSelectWindow::MultiSelectWindow($config, "Department", "department");
-    
-    $this->parent       = &$parent;
-    $this->ui           = get_userinfo();
-
-    /* Set list strings */
-    $this->SetTitle(_("List of departments"));
-    $this->SetSummary(_("List of departments"));
-    $this->EnableAplhabet   (true);
-
-    /* Result page will look like a headpage */
-    $this->SetHeadpageMode();
-    $this->SetInformation(_("This menu allows you to create, delete and edit selected departments. Having a large number of departments, you might prefer the range selectors on top of the department list."));
-  
-    /* Disable buttonsm */
-    $this->EnableCloseButton(false);
-    $this->EnableSaveButton (false);
-
-
-
-   /* Toggle all selected / deselected */
-    $chk = "<input type='checkbox' id='select_all' name='select_all'
-               onClick='toggle_all_(\"^item_selected_[a-zA-Z0-9\\/\=]*$\",\"select_all\");' >";
-
-    /* set Page header */
-    $this->AddHeader(array("string"=> $chk,          "attach"=>"style='width:20px;'"));
-    $this->AddHeader(array("string" => "&nbsp;", "attach" => "style='text-align:center;width:20px;'"));
-    $this->AddHeader(array("string"=>_("Department name"), "attach" => "style=''"));
-    $this->AddHeader(array("string" =>_("Actions"), "attach" => "style='width:60px;border-right:0px;text-align:right;'"));
-
-
-    /* Add SubSearch checkbox */    
-    $this->AddCheckBox("SubSearch",  _("Select to search within subtrees"), _("Search in subtrees"), false);
-
-    /*                  Name                 ,Text                              ,Default  , Connect with alphabet  */
-    $this->AddRegex   ("Regex",     _("Regular expression for matching department names"), "*" , true);
-  }
-
-
-  function GenHeader()
-  {
-    /* Prepare departments,
-       which are shown in the listbox on top of the listbox
-    */
-    $options= "";
-
-    /* Get all departments within this subtree */
-    $ui= get_userinfo();
-    $first = "";
-    $found = FALSE;
-    $base = $this->config->current['BASE'];
-
-    /* Add base */
-    $tmp = array();
-    $tmp[] = array("dn"=>$this->config->current['BASE']);
-    $tmp=  array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
-                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
-
-    $deps = array();
-    foreach($tmp as $tm){
-      $deps[$tm['dn']] = $tm['dn'];
-    }
-
-    /* Load possible departments */
-    $ui= get_userinfo();
-    $tdeps= $ui->get_module_departments("department");
-    $ids = $this->config->idepartments;
-    $first = "";
-    $found = FALSE;
-    foreach($ids as $dep => $name){
-      if(isset($deps[$dep]) && in_array_ics($dep, $tdeps)){
-
-        /* Keep first base dn in mind, we could need this
-         *  info if no valid base was found
-         */
-        if(empty($first)) {
-          $first = $dep['dn'];
-        }
-
-        $value = $ids[$dep];
-        if ($this->selectedBase == $dep){
-          $found = TRUE;
-          $options.= "<option selected='selected' value='".$dep."'>$value</option>";
-        } else {
-          $options.= "<option value='".$dep."'>$value</option>";
-        }
-      }
-    }
-
-    /* The currently used base is not visible with your acl setup.
-     * Set base to first useable base.
-     */
-    if(!$found){
-      $this->selectedBase = $first;
-    }
-
-    /* Generate list head */
-    $ui = get_userinfo();
-    $acl = $ui->get_permissions("ou=dummy,".$this->selectedBase  ,"department/department");
-      
-    /* Add default header */
-    $listhead = MultiSelectWindow::get_default_header();
-
-    $listhead .=  
-      " "._("Base")."&nbsp;<select name='CurrentMainBase' 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;";
-
-    /* Create Layers menu */
-    $s  = ".|"._("Actions")."|\n";
-    $s .= "..|<img src='images/list_new.png' alt='' border='0' class='center'>".
-      "&nbsp;"._("Create")."|\n";
-
-    /* Append create options */
-    if(preg_match("/c/",$acl)) {
-      $s.= "...|<input class='center' type='image' src='images/list_new_department' alt=''>".
-        "&nbsp;"._("Department")."|dep_new|\n";
-    }
-    $s.= "..|---|\n";
-    $s.= "..|<img src='images/edittrash.png' alt='' border='0' class='center'>".
-      "&nbsp;"._("Remove")."|"."remove_multiple|\n";
-
-
-    $this->SetDropDownHeaderMenu($s);
-    $this->SetListHeader($listhead);
-  }
-
-  function execute()
-  {
-    $this->ClearElementsList();
-    $this->GenHeader();
-  }
-
-  function setEntries($list)
-  {
-    $linkopen = "<a href='?plug=".$_GET['plug']."&amp;act=dep_open&amp;dep_id=%s'>%s</a>";
-
-    $ui = get_userinfo();
-    foreach($list as $key => $val) {
-
-      $actions= "";      
-
-      $acl = $ui->get_permissions($this->config->departments[$key] ,"department/department");
-      if(preg_match("/r/",$acl)){
-        $actions.= "<input class='center' type='image' src='images/edit.png'
-          alt='"._("edit")."'   name='dep_edit_%KEY%' title='"._("Edit this entry")."'>";
-      }
-
-      if(preg_match("/c/",$acl)){
-        $actions.= "<input class='center' type='image' src='images/edittrash.png'
-          alt='"._("delete")."'   name='dep_del_%KEY%' title='"._("Delete this entry")."'>";
-      }
-
-      if(!isset($this->config->departments[trim($key)])){
-        $this->config->departments[trim($key)]="";
-      }
-
-      /* check if this department contains sub-departments
-         Display different image in this case
-       */
-      $non_empty="";
-      $nkey= normalizePreg($key);
-      foreach($this->config->departments as $keyd=>$vald ){
-        if(preg_match('/$nkey\/.*/',$keyd)){
-          $non_empty="full";
-        }
-      }
-
-      $title = preg_replace('/ /', '&nbsp;', @LDAP::fix($this->config->departments[$key]));
-
-      if($val == "."){
-        $field01 = array("string" => "&nbsp;",
-            "attach" => "style='width:20px;'");
-      }else{
-        $field01 = array("string" => "<input type='checkbox' id='item_selected_".base64_encode($key)."' 
-            name='item_selected_".base64_encode($key)."'>" ,
-            "attach" => "style='width:20px;'");
-      }
-
-      $field0 = array("string" => "<img src='images/".$non_empty."folder.png' title='"._("department")."' alt='department'>", "attach" => "style='text-align:center;width:20px;'");
-      $field1 = array("string" => sprintf($linkopen,base64_encode($key),$val), "attach" => "style='' title='".$title."'");
-      $field2 = array("string" => preg_replace("/%KEY%/", base64_encode($key), $actions), "attach" => "style='width:60px;border-right:0px;text-align:
-          right;'");
-
-      $this->AddElement( array($field01,$field0,$field1,$field2));
-    }
-
-    /* Create summary string for list footer */
-    $num_deps=count($list);
-    $num_dep_str = _("Number of listed departments");
-    $str = "<img class='center' src='images/folder.png'
-              title='".$num_dep_str."' alt='".$num_dep_str."'>&nbsp;".$num_deps."&nbsp;&nbsp;&nbsp;&nbsp;";
-    $this->set_List_Bottom_Info($str);
-
-  }
-  function Save()
-  {
-    MultiSelectWindow::Save();
-  }
-
-  function save_object()
-  {
-    /* Save automatic created POSTs like regex, checkboxes */
-    MultiSelectWindow::save_object();   
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/departments/dep_iframe.tpl b/plugins/admin/departments/dep_iframe.tpl
deleted file mode 100644 (file)
index 396cf2c..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-<h2>{t}Processing the requested operation{/t}</h2>
-{$message}
-<br>
-<br>
-<div style="margin:3px;background-color:white; border:1px solid #A0A0A0">
-<iframe src="{$src}" style="width:100%;height:450px;background-color:#FFFFFF;" name="status">
-       <p>{t}Your browser doesn't support iframes, please use this link to perform the requested operation.{/t}
-       <br>
-       <a href="{$src}">{$src}</a>
-       </p>
-</iframe>
-</div>
-
-<!--
-<p class="seperator">&nbsp;</p>
-<div style="text-align:right;">
-       <p>
-               <input type="submit" name="back" value="{t}Back{/t}">
-       </p>
-</div>
--->
diff --git a/plugins/admin/departments/dep_move_confirm.tpl b/plugins/admin/departments/dep_move_confirm.tpl
deleted file mode 100644 (file)
index 9338b76..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-<div style="font-size:18px;">
- <img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t} - {t}You are currently moving/renaming this department.{/t}
-</div>
-<p>
-{t}Modifying a departments naming attribute 'ou' or base may corrupt acls and snapshot entries for all entire objects.{/t}
-</p>
-<p>
-{t}GOsa can NOT fix this for you, yet.{/t}
-</p>
-<p>
-{t}Before you confirm this action, ensure that everything will be as expected, possibly the best solution is a backup.{/t} 
-</p>
-
-<p class="plugbottom">
-       <input type='submit' name='dep_move_confirm' value='{t}Save{/t}'>
-       &nbsp;
-       <input type='submit' name='cancel_save' value='{t}Cancel{/t}'>
-</p>
-
diff --git a/plugins/admin/departments/generic.tpl b/plugins/admin/departments/generic.tpl
deleted file mode 100644 (file)
index 7e353be..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
- <tr>
-   <td style="vertical-align:top; width:50%">
-     <h2><img class="center" alt="" align="middle" src="images/rightarrow.png"> {t}Properties{/t}</h2>
-     
-     <table summary="">
-      <tr>
-       <td><LABEL for="ou">{t}Name of department{/t}</LABEL>{$must}</td>
-       <td>
-{render acl=$ouACL}
-       <input id="ou" name="ou" size=25 maxlength=60 value="{$ou}" title="{t}Name of subtree to create{/t}">
-{/render}
-       </td>
-      </tr>
-      <tr>
-       <td><LABEL for="description">{t}Description{/t}</LABEL>{$must}</td>
-       <td>
-{render acl=$descriptionACL}
-        <input id="description" name="description" size=25 maxlength=80 value="{$description}" title="{t}Descriptive text for department{/t}">
-{/render}
-       </td>
-      </tr>
-      <tr>
-       <td><LABEL for="businessCategory">{t}Category{/t}</LABEL></td>
-       <td>
-{render acl=$businessCategoryACL}
-        <input id="businessCategory" name="businessCategory" size=25 maxlength=80 value="{$businessCategory}" title="{t}Category for this subtree{/t}">
-{/render}
-       </td>
-      </tr>
-      <tr>
-        <td colspan="2"><br></td>
-      </tr>
-      <tr>
-        <td><LABEL for="base">{t}Base{/t}</LABEL>{$must}</td>
-
-        <td>
-{render acl=$baseACL}
-         <select id="base" size="1" name="base" title="{t}Choose subtree to place department in{/t}"> 
-          {html_options options=$bases selected=$base_select}
-         </select>
-{/render}
-
-{render acl=$baseACL disable_picture='images/folder_gray.png'}
-        <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
-{/render}
-       </td>
-       </tr>
-     </table>
-
-   </td>
-   <td style="border-left:1px solid #A0A0A0">
-    &nbsp;
-   </td>
-   <td>
-     <h2><img class="center" alt="" align="middle" src="images/house.png"> {t}Location{/t}</h2>
-
-     <table summary="" style="width:100%">
-      <tr>
-       <td><LABEL for="st">{t}State{/t}</LABEL></td>
-       <td>
-{render acl=$stACL}
-       <input id="st" name="st" size=25 maxlength=60 value="{$st}" title="{t}State where this subtree is located{/t}">
-{/render}
-       </td>
-      </tr>
-      <tr>
-       <td><LABEL for="l">{t}Location{/t}</LABEL></td>
-       <td>
-{render acl=$lACL}
-       <input id="l" name="l" size=25 maxlength=60 value="{$l}" title="{t}Location of this subtree{/t}">
-{/render}
-       </td>
-      </tr>
-      <tr>
-       <td style="vertical-align:top;"><LABEL for="postalAddress">{t}Address{/t}</LABEL></td>
-       <td>
-{render acl=$postalAddressACL}
-       <textarea id="postalAddress" name="postalAddress" style="width:100%" rows=3 cols=22 title="{t}Postal address of this subtree{/t}">{$postalAddress}</textarea>
-{/render}
-      </tr>
-      <tr>
-       <td><LABEL for="telephoneNumber">{t}Phone{/t}</LABEL></td>
-       <td>
-{render acl=$telephoneNumberACL}
-       <input id="telephoneNumber" name="telephoneNumber" size=25 maxlength=60 value="{$telephoneNumber}" title="{t}Base telephone number of this subtree{/t}">
-{/render}
-       </td>
-      </tr>
-      <tr>
-       <td><LABEL for="facsimileTelephoneNumber">{t}Fax{/t}</LABEL></td>
-       <td>
-{render acl=$facsimileTelephoneNumberACL}
-       <input id="facsimileTelephoneNumber" name="facsimileTelephoneNumber" size=25 maxlength=60 value="{$facsimileTelephoneNumber}" title="{t}Base facsimile telephone number of this subtree{/t}">
-{/render}
-       </td>
-      </tr>
-     </table>
-
-   </td>
- </tr>
-</table>
-
-
-{if !$UnitTagDiabled}
-
-<!--
-This is not used anymore cause of the new acl implementation
-Its functionality is disabled in class_departmentGeneric.inc
--->
-
-<p class='seperator'>&nbsp;</p>
-
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
- <tr>
-   <td style="vertical-align:top; width:100%">
-     <h2><img class="center" alt="" align="middle" src="images/closedlock.png"> {t}Administrative settings{/t}</h2>
-{render acl=$gosaUnitTagACL}
-     <input id="unitTag" type=checkbox name="unitTag" value="1" {$unitTag}><label for="unitTag">{t}Tag department as an independent administrative unit{/t}</label>
-{/render}
-   </td>
-  </tr>
-</table>
-
-{/if}
-<!-- Place cursor -->
-<input type='hidden' name='dep_generic_posted' value='1'>
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('ou');
-  -->
-</script>
diff --git a/plugins/admin/departments/main.inc b/plugins/admin/departments/main.inc
deleted file mode 100644 (file)
index 5db6278..0000000
+++ /dev/null
@@ -1,57 +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
-*/
-
-if ($remove_lock){
-        if(isset($_SESSION['department'])){
-                $department= $_SESSION['department'];
-                $department->remove_lock();
-                del_lock ($ui->dn);
-                sess_del ('department');
-        }
-} else {
-       /* Create usermanagement object on demand */
-       if (!isset($_SESSION['department']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
-               $_SESSION['department']= new departmentManagement($config, $ui);
-       }
-       $department= $_SESSION['department'];
-       
-       /* Show and save dialog */
-       $department->save_object();
-       $output= $department->execute();
-
-       /* Page header*/
-       if (isset($_SESSION['objectinfo'])){
-               $display= print_header(get_template_path('images/department.png'), _("Department management"), "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".@LDAP::fix($_SESSION['objectinfo']));
-       } else {
-               $display= print_header(get_template_path('images/department.png'), _("Department management"));
-       }
-
-       /* Reset requested? */
-       if (isset($_GET['reset']) && $_GET['reset'] == 1){
-               del_lock ($ui->dn);
-               sess_del ('department');
-       }
-
-       $display.= $output;
-       $_SESSION['department']= $department;
-       $config = $department->config;
-}
-
-?>
diff --git a/plugins/admin/departments/remove.tpl b/plugins/admin/departments/remove.tpl
deleted file mode 100644 (file)
index e4e075a..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-<div style="font-size:18px;">
- <img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
-</div>
-<p>
- {$info}
- {t}This includes 'all' accounts, systems, etc. in this subtree. 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">
-       {if $multiple}
-               <input type=submit name="delete_multiple_department_confirm" value="{t}Delete{/t}">
-               &nbsp;
-               <input type=submit name="delete_multiple_department_cancel" value="{t}Cancel{/t}">
-               {else}
-               <input type=submit name="delete_department_confirm" value="{t}Delete{/t}">
-               &nbsp;
-               <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
-       {/if}
-</p>
-
diff --git a/plugins/admin/departments/tabs_department.inc b/plugins/admin/departments/tabs_department.inc
deleted file mode 100644 (file)
index cf04bd2..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-
-class deptabs extends tabs
-{
-  var $base= "";
-
-  function deptabs($config, $data, $dn,$category)
-  {
-    tabs::tabs($config, $data, $dn,$category);
-    $this->base= $this->by_object['department']->base;
-
-    /* Add references/acls/snapshots */
-    $this->addSpecialTabs();
-  }
-
-  function check($ignore_account= FALSE)
-  {
-    return (tabs::check(TRUE));
-  }
-
-
-  function save($ignore_account= FALSE)
-  {
-    $baseobject= $this->by_object['department'];
-    $ou= preg_replace('/,/', '\,', $baseobject->ou);
-    $new_dn= @LDAP::convert('ou='.$ou.','.$baseobject->base);
-    
-    if($ignore_account){
-      if ($this->dn != $new_dn && $this->dn != "new"){
-        /* if( new_dn is subtree of this->dn ) */
-        $cnt1 = count(split(",",$this->dn));
-        $cnt2 = count(split(",",$new_dn));
-        if((strstr($new_dn,$this->dn))&&($cnt1<$cnt2)){
-          print_red(_("Try to move tree failed. Destination tree is subtree of source tree."));
-        }else{
-          /* Prepare to be moved */
-          $baseobject->recursive_move($this->dn, $new_dn);                     
-          $this->by_object['department'] = $baseobject;
-          return;
-        }
-      }
-    }
-    $this->dn= $new_dn;
-    $baseobject->dn= $this->dn;
-    $this->by_object['department']= $baseobject;
-    return(tabs::save(TRUE));
-  }
-
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/devices/class_deviceGeneric.inc b/plugins/admin/devices/class_deviceGeneric.inc
deleted file mode 100644 (file)
index 095adf7..0000000
+++ /dev/null
@@ -1,241 +0,0 @@
-<?php
-
-class deviceGeneric extends plugin
-{
-  public $dn            = "";
-  public $cn            = "";
-  public $orig_cn       = "";
-  public $description   = "";
-  public $vendor        = "";
-  public $dev_id        = "";
-  public $serial        = "";
-  public $base          = "";  
-
-  public $posts           = array("description","dev_id","serial","vendor");
-  public $attributes      = array("cn");
-  public $objectclasses   = array("top","gotoDevice");
-
-  public $CopyPasteVars   = array("orig_cn","description","vendor","dev_id","serial","base");
-
-  public function deviceGeneric(&$config,$dn = NULL)
-  {
-    plugin::plugin($config,$dn);
-
-    $this->is_account = TRUE;
-
-    /* Set class values */
-    if(isset($this->attrs['gotoHotplugDevice'][0])){
-      $tmp = preg_split("/\|/",$this->attrs['gotoHotplugDevice'][0]);
-      $this->cn         = $this->attrs['cn'][0];
-      $this->description= $tmp[0];
-      $this->dev_id     = $tmp[1];
-      $this->serial     = $tmp[2];
-      $this->vendor     = $tmp[3];
-    }     
-
-    $this->orig_cn = $this->cn;
-
-    /* Set Base */
-    if ($this->dn == "new"){
-      if(isset($_SESSION['CurrentMainBase'])){
-        $this->base= $_SESSION['CurrentMainBase'];
-      }else{
-        $ui= get_userinfo();
-        $this->base= dn2base($ui->dn);
-      }
-    } else {
-      $this->base =preg_replace ("/^[^,]+,ou=devices,/","",$this->dn);
-    }
-  }
-
-
-  public function execute()
-  {
-    $smarty = get_smarty();
-    $smarty->assign("base",$this->base);
-    $smarty->assign("bases",$this->get_allowed_bases());
-    foreach($this->attributes as $attr){
-      $smarty->assign($attr,$this->$attr);
-    }
-    foreach($this->posts as $attr){
-      $smarty->assign($attr,$this->$attr);
-    }
-    return($smarty->fetch(get_template_path("deviceGeneric.tpl",TRUE,dirname(__FILE__))));
-  }
-
-  
-  public function check()
-  {
-    $message = plugin::check();
-
-    if(empty($this->cn)||(preg_match("/[^a-z0-9]/i",$this->cn))){
-      $message[]=_("Please specify a valid name. Only 0-9 a-Z is allowed.");
-    }
-    if(preg_match("/[^a-z0-9!\"?.,;:-_\(\) ]/i",$this->description)){
-      $message[]=_("Invalid character in description. Please specify a valid description.");
-    }
-
-    /* Skip serial check if vendor and product id are given */
-    if(preg_match("/^\s+$/i",$this->dev_id)){
-      $message[]=_("Please specify a valid iSerial.");
-    }
-    if(empty($this->serial) || !$this->is_2byteHex($this->serial)){
-      $message[]=_("Please specify a valid vendor ID. (2 byte hex like '0xFFFF')");
-    }
-    if(empty($this->vendor) || !$this->is_2byteHex($this->vendor)){
-      $message[]=_("Please specify a valid product ID. (2 byte hex like '0xFFFF')");
-    }
-   
-    /* Check if entry already exists */ 
-    if($this->cn != $this->orig_cn){
-      $ldap = $this->config->get_ldap_link();
-      $ldap->search("(&(objectClass=gotoDevice)(cn=".$this->cn."*))",array("cn"));
-      if($ldap->count()){
-        $message[]=_("An Entry with this name already exists.");
-      }
-    }
-
-    return($message);
-  }
-
-
-  public function save_object()
-  {
-    if(isset($_POST['deviceGeneric_posted'])){
-      plugin::save_object();
-  
-      if(isset($_POST['base'])){
-        $tmp = $this->get_allowed_bases();
-        if(isset($tmp[get_post("base")])){
-          $this->base = get_post("base");
-        }
-      }
-    
-      foreach($this->posts as $post){
-        if(isset($_POST[$post])){
-          $this->$post = get_post($post);
-        }
-      }
-    }
-  }
-
-  
-  public function remove_from_parent()
-  {
-    plugin::remove_from_parent();
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-
-    $ldap->search("(&(objectClass=gotoEnvironment)(gotoHotplugDeviceDN=".$this->dn."))",array("cn","gotoHotplugDeviceDN"));
-    $skip = FALSE;
-    $str ="";
-    $cnt = 3;
-    while($cnt && $attrs = $ldap->fetch()){
-      $skip =TRUE;
-      $str .= $attrs['cn'][0].", ";
-      $cnt --;
-    }
-    if($skip){
-      $str  = preg_replace("/, $/","",$str);
-      if($cnt == 0){
-        $str .= "...";
-      }
-      print_red(sprintf(_("Can't remove the device '%s' it is still in use be this user(s) : %s"),$this->cn,$str));
-    }else{
-      $ldap->rmdir_recursive($this->dn);
-    }
-  }
-
-
-  public function save()
-  {
-    plugin::save();
-
-    $this->attrs['gotoHotplugDevice'] = "";
-    foreach($this->posts as $post){
-      $this->attrs['gotoHotplugDevice'] .= $this->$post."|"; 
-    }
-    $this->attrs['gotoHotplugDevice'] = preg_replace("/\|$/","",$this->attrs['gotoHotplugDevice']);
-
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->cat($this->dn);
-    if($ldap->count()){
-      $ldap->cd($this->dn);
-      $ldap->modify($this->attrs);
-    }else{
-      $ldap->create_missing_trees(preg_replace("/^[^,]+,/","",$this->dn));
-      $ldap->cd($this->dn);
-      $ldap->add($this->attrs);
-    }
-    show_ldap_error($ldap->get_error(),_("Device could not be saved."));
-  }
-
-
-  /* check if given str in like this 0xffff*/
-  function is_2byteHex($str)
-  {
-    return !strlen($str) || preg_match("/^(0x|x|)[a-f0-9][a-f0-9][a-f0-9][a-f0-9]/i",$str);
-  }
-
-
-  function PrepareForCopyPaste($source)
-  {
-    plugin::PrepareForCopyPaste($source);
-    $source_o = new deviceGeneric($this->config,$source['dn']);
-    foreach($this->CopyPasteVars as $post){
-      $this->$post = $source_o->$post;
-    }
-  }
-
-
-  /* Return a dialog with all fields that must be changed,
-     if we want to copy this entry */
-  function getCopyDialog()
-  {
-    $str = "";
-    $smarty = get_smarty();
-    $smarty->assign("cn",         $this->cn);
-    $str = $smarty->fetch(get_template_path("paste_deviceGeneric.tpl",TRUE,dirname(__FILE__)));
-
-    $ret = array();
-    $ret['string'] = $str;
-    $ret['status'] = "";
-    return($ret);
-  }
-
-
-  /* Save all */
-  function saveCopyDialog()
-  {
-    $attrs = array("cn");
-    foreach($attrs as $attr){
-      if(isset($_POST[$attr])){
-        $this->$attr = $_POST[$attr];
-      }
-    }
-  }
-
-
-
-  /* Return plugin informations for acl handling  */
-  public static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("Generic"),
-          "plDescription" => _("Device generic"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 0,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("devices" => array("description"  => _("Devices"),
-                                                        "objectClass"  => "gotoHotplugDevice")),
-          "plProvidedAcls"=> array(
-            "cn"                          => _("Name"))
-          ));
-
-  }
-       
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/devices/class_deviceManagement.inc b/plugins/admin/devices/class_deviceManagement.inc
deleted file mode 100644 (file)
index dbdfc0f..0000000
+++ /dev/null
@@ -1,554 +0,0 @@
-<?php
-
-class deviceManagement extends plugin
-{
-
-  /* Definitions */
-  var $plHeadline     = "Devices";
-  var $plDescription  = "Manage devices";
-
-  /* Dialog attributes */
-  var $ui                             = NULL;
-  var $DivListDevices               = NULL;
-  var $enableReleaseManagement        = false;
-  var $devicetabs                       = NULL;
-  var $snapDialog                     = NULL;
-  var $CopyPasteHandler               = NULL;
-  var $start_pasting_copied_objects;
-  var $dn ="";
-
-  function deviceManagement(&$config, $dn= NULL)
-  {
-    plugin::plugin ($config, $dn);
-    $this->ui = get_userinfo();  
-
-    /* Check if copy & paste is activated */
-    if($this->config->boolValueIsTrue("MAIN","ENABLECOPYPASTE")){
-      $this->CopyPasteHandler = new CopyPasteHandler($this->config);
-    }
-
-    /* Creat dialog object */
-    $this->DivListDevices = new divListDevices($this->config,$this);
-  }
-
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /****************
-      Variable init
-     ****************/
-
-    /* These vars will be stored if you try to open a locked device,
-        to be able to perform your last requests after showing a warning message */
-    $_SESSION['LOCK_VARS_TO_USE'] = array("/^act$/","/^id$/","/^device_edit_/",
-                                          "/^device_del_/","/^item_selected/","/^remove_multiple_devices/");
-
-    $smarty       = get_smarty();             // Smarty instance
-    $s_action     = "";                       // Contains the action to proceed
-    $s_entry      = "";                       // The value for s_action
-    $base_back    = "";                       // The Link for Backbutton
-
-    /* Test Posts */
-    foreach($_POST as $key => $val){
-
-      if(preg_match("/device_del.*/",$key)){
-        $s_action = "del";
-        $s_entry  = preg_replace("/device_".$s_action."_/i","",$key);
-      }elseif(preg_match("/device_edit_.*/",$key)){
-        $s_action="edit";
-        $s_entry  = preg_replace("/device_".$s_action."_/i","",$key);
-      }elseif(preg_match("/^copy_.*/",$key)){
-        $s_action="copy";
-        $s_entry  = preg_replace("/^copy_/i","",$key);
-      }elseif(preg_match("/^cut_.*/",$key)){
-        $s_action="cut";
-        $s_entry  = preg_replace("/^cut_/i","",$key);
-      }elseif(preg_match("/^device_new.*/",$key)){
-        $s_action="new";
-      }elseif(preg_match("/^remove_multiple_devices/",$key)){
-        $s_action="del_multiple";
-      }elseif(preg_match("/^editPaste.*/i",$key)){
-        $s_action="editPaste";
-      }elseif(preg_match("/^multiple_copy_devices/",$key)){
-        $s_action = "copy_multiple";
-     }elseif(preg_match("/^multiple_cut_devices/",$key)){
-        $s_action = "cut_multiple";
-      }
-    }
-
-    if((isset($_GET['act']))&&($_GET['act']=="edit_entry")){
-      $s_action ="edit";
-      $s_entry  = $_GET['id'];
-    }
-
-    $s_entry  = preg_replace("/_.$/","",$s_entry);
-
-
-    /* handle C&P from layers menu */
-    if(isset($_POST['menu_action']) && preg_match("/^multiple_copy_systems/",$_POST['menu_action'])){
-      $s_action = "copy_multiple";
-    }
-    if(isset($_POST['menu_action']) && preg_match("/^multiple_cut_systems/",$_POST['menu_action'])){
-      $s_action = "cut_multiple";
-    }
-    if(isset($_POST['menu_action']) && preg_match("/^editPaste/",$_POST['menu_action'])){
-      $s_action = "editPaste";
-    }
-
-    /* Create options */
-    if(isset($_POST['menu_action']) && $_POST['menu_action'] == "device_new"){
-      $s_action = "new";
-    }
-
-    /* handle remove from layers menu */
-    if(isset($_POST['menu_action']) && preg_match("/^remove_multiple/",$_POST['menu_action'])){
-      $s_action = "del_multiple";
-    }
-
-    /****************
-      Copy & Paste handling
-     ****************/
-
-    /* Display the copy & paste dialog, if it is currently open */
-    $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
-    if($ret){
-      return($ret);
-    }
-
-    /****************
-      Create a new device type
-     ****************/
-
-    /* New device type? */
-    $ui = get_userinfo();
-    $acl = $ui->get_permissions($this->DivListDevices->selectedBase,"devices/deviceGeneric");
-    if (($s_action=="new") && preg_match("/c/",$acl)){
-
-      /* By default we set 'dn' to 'new', all relevant plugins will
-         react on this. */
-      $this->dn= "new";
-
-      /* Create new usertab object */
-      $this->devicetabs= new devicetabs($this->config, $this->config->data['TABS']['DEVICETABS'], $this->dn,"devices");
-      $this->devicetabs->set_acl_base($this->DivListDevices->selectedBase);
-    }
-
-
-    /****************
-      Edit entry canceled
-     ****************/
-
-    /* Cancel dialogs */
-    if (isset($_POST['edit_cancel']) && is_object($this->devicetabs)){
-      del_lock ($this->devicetabs->dn);
-      unset ($this->devicetabs);
-      $this->devicetabs= NULL;
-      unset ($_SESSION['objectinfo']);
-    }
-
-
-    /****************
-      Edit entry finished
-     ****************/
-
-    /* Finish device edit is triggered by the tabulator dialog, so
-       the user wants to save edited data. Check and save at this point. */
-    if ((isset($_POST['edit_finish']) || isset($_POST['edit_apply']) ) && (isset($this->devicetabs->config))){
-
-      /* Check tabs, will feed message array */
-      $this->devicetabs->save_object();
-      $message= $this->devicetabs->check();
-
-      /* Save, or display error message? */
-      if (count($message) == 0){
-
-        /* Save data data to ldap */
-#        $this->devicetabs->set_release($this->DivListDevices->selectedRelease);
-        $this->devicetabs->save();
-
-        if (!isset($_POST['edit_apply'])){
-          /* device type has been saved successfully, remove lock from LDAP. */
-          if ($this->dn != "new"){
-            del_lock ($this->dn);
-          }
-          unset ($this->devicetabs);
-          $this->devicetabs= NULL;
-          unset ($_SESSION['objectinfo']);
-        }
-      } else {
-       /* Ok. There seem to be errors regarding to the tab data,
-           show message and continue as usual. */
-        show_errors($message);
-      }
-    }
-
-
-    /****************
-      Edit entry
-     ****************/
-
-    /* User wants to edit data? */
-    if (($s_action=="edit") && (!isset($this->devicetabs->config))){
-
-      /* Get 'dn' from posted 'devicelist', must be unique */
-      $this->dn= $this->devices[$s_entry]['dn'];
-
-      /* Check locking, save current plugin in 'back_plugin', so
-         the dialog knows where to return. */
-      if (($user= get_lock($this->dn)) != ""){
-        return(gen_locked_message ($user, $this->dn));
-      }
-
-      /* Lock the current entry, so everyone will get the
-         above dialog */
-      add_lock ($this->dn, $this->ui->dn);
-
-
-      /* Register devicetabs to trigger edit dialog */
-      $this->devicetabs= new devicetabs($this->config,$this->config->data['TABS']['DEVICETABS'], $this->dn,"devices");
-      $this->devicetabs->set_acl_base($this->dn);
-      $_SESSION['objectinfo']= $this->dn;
-    }
-
-
-    /********************
-      Delete MULTIPLE entries requested, display confirm dialog
-     ********************/
-    if ($s_action=="del_multiple"){
-      $ids = $this->list_get_selected_items();
-
-      if(count($ids)){
-
-        foreach($ids as $id){
-          $dn = $this->devices[$id]['dn'];
-          if (($user= get_lock($dn)) != ""){
-            return(gen_locked_message ($user, $dn));
-          }
-          $this->dns[$id] = $dn;
-        }
-
-        $dns_names = "<br><pre>";
-        foreach($this->dns as $dn){
-          add_lock ($dn, $this->ui->dn);
-          $dns_names .= $dn."\n";
-        }
-        $dns_names .="</pre>";
-
-        /* Lock the current entry, so nobody will edit it during deletion */
-        if (count($this->dns) == 1){
-          $smarty->assign("intro",     sprintf(_("You're about to delete the following entry %s"), @LDAP::fix($dns_names)));
-        } else {
-          $smarty->assign("intro",     sprintf(_("You're about to delete the following entries %s"), @LDAP::fix($dns_names)));
-        }
-        $smarty->assign("multiple", true);
-        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
-      }
-    }
-
-
-    /********************
-      Delete MULTIPLE entries confirmed
-     ********************/
-
-    /* Confirmation for deletion has been passed. Users should be deleted. */
-    if (isset($_POST['delete_multiple_device_confirm'])){
-
-      $ui = get_userinfo();
-
-      /* Remove user by user and check acls before removeing them */
-      foreach($this->dns as $key => $dn){
-
-        $acl = $ui->get_permissions($dn,"devices/deviceGeneric");
-        if(preg_match("/d/",$acl)){
-
-          /* Delete request is permitted, perform LDAP action */
-          $this->devicetabs= new devicetabs($this->config, $this->config->data['TABS']['DEVICETABS'], $dn,"devices");
-          $this->devicetabs->set_acl_base($dn);
-          $this->devicetabs->delete ();
-          unset ($this->devicetabs);
-          $this->devicetabs= NULL;
-
-        } else {
-          /* Normally this shouldn't be reached, send some extra
-             logs to notify the administrator */
-          print_red (_("You are not allowed to delete this device type!"));
-          new log("security","devices/".get_class($this),$dn,array(),"Tried to trick deletion.");
-        }
-        /* Remove lock file after successfull deletion */
-        del_lock ($dn);
-        unset($this->dns[$key]);
-      }
-    }
-
-
-    /********************
-      Delete MULTIPLE entries Canceled
-     ********************/
-
-    /* Remove lock */
-    if(isset($_POST['delete_multiple_device_cancel'])){
-      foreach($this->dns as $key => $dn){
-        del_lock ($dn);
-        unset($this->dns[$key]);
-      }
-    }
-
-
-    /****************
-      Delete device type
-     ****************/
-
-    /* Remove user was requested */
-    if ($s_action == "del"){
-
-      /* Get 'dn' from posted 'uid' */
-      $this->dn= $this->devices[$s_entry]['dn'];
-
-      /* Load permissions for selected 'dn' and check if
-         we're allowed to remove this 'dn' */
-      $ui = get_userinfo();
-      $acl = $ui->get_permissions($this->dn,"devices/deviceGeneric");
-      if (preg_match("/d/",$acl)){
-
-        /* Check locking, save current plugin in 'back_plugin', so
-           the dialog knows where to return. */
-        if (($user= get_lock($this->dn)) != ""){
-          return (gen_locked_message ($user, $this->dn));
-        }
-
-        /* Lock the current entry, so nobody will edit it during deletion */
-        add_lock ($this->dn, $this->ui->dn);
-        $smarty= get_smarty();
-        $smarty->assign("intro", sprintf(_("You're about to delete the device '%s'."), @LDAP::fix($this->dn)));
-        $smarty->assign("multiple", false);
-        return($smarty->fetch (get_template_path('remove.tpl', TRUE)));
-      } else {
-
-        /* Obviously the user isn't allowed to delete. Show message and
-           clean session. */
-       print_red (_("You are not allowed to delete this device!"));
-      }
-    }
-
-
-    /****************
-      Delete device confirmed
-     ****************/
-
-    /* Confirmation for deletion has been passed. Group should be deleted. */
-    if (isset($_POST['delete_device_confirm'])){
-
-      /* Some nice guy may send this as POST, so we've to check
-         for the permissions again. */
-      $ui = get_userinfo();
-      $acl = $ui->get_permissions($this->dn,"devices/deviceGeneric");
-      if(preg_match("/d/",$acl)){
-
-        /* Delete request is permitted, perform LDAP action */
-        $this->devicetabs= new devicetabs($this->config, $this->config->data['TABS']['DEVICETABS'], $this->dn,"devices");
-        $this->devicetabs->set_acl_base($this->dn);
-        $this->devicetabs->delete ();
-        unset ($this->devicetabs);
-        $this->devicetabs= NULL;
-
-      } else {
-
-        /* Normally this shouldn't be reached, send some extra
-           logs to notify the administrator */
-        print_red (_("You are not allowed to delete this device!"));
-        new log("security","devices/".get_class($this),$dn,array(),"Tried to trick deletion.");
-      }
-
-      /* Remove lock file after successfull deletion */
-      del_lock ($this->dn);
-    }
-
-
-    /****************
-      Delete device canceled
-     ****************/
-
-    /* Delete device canceled? */
-    if (isset($_POST['delete_cancel'])){
-      del_lock ($this->dn);
-      unset($_SESSION['objectinfo']);
-  }
-
-    /* Show tab dialog if object is present */
-    if (($this->devicetabs) && (isset($this->devicetabs->config))){
-      $display= $this->devicetabs->execute();
-
-      /* Don't show buttons if tab dialog requests this */
-      if (!$this->devicetabs->by_object[$this->devicetabs->current]->dialog){
-        $display.= "<p style=\"text-align:right\">\n";
-        $display.= "<input type=\"submit\" name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
-        $display.= "&nbsp;\n";
-        if ($this->dn != "new"){
-          $display.= "<input type=submit name=\"edit_apply\" value=\""._("Apply")."\">\n";
-          $display.= "&nbsp;\n";
-        }
-        $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
-        $display.= "</p>";
-      }
-      return ($display);
-    }
-
-
-    /****************
-      Dialog display
-     ****************/
-
-        /* Check if there is a snapshot dialog open */
-    $base = $this->DivListDevices->selectedBase;
-    if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases())){
-      return($str);
-    }
-
-    /* Display dialog with system list */
-    $this->DivListDevices->parent = $this;
-    $this->DivListDevices->execute();
-    $this->DivListDevices->AddDepartments($this->DivListDevices->selectedBase,3,1);
-    $this->reload();
-    $this->DivListDevices->setEntries($this->devices);
-    return($this->DivListDevices->Draw());
-
-  }
-
-  function save_object() {
-    $this->DivListDevices->save_object();
-  }
-
-
-  /* Return departments, that will be included within snapshot detection */
-  function get_used_snapshot_bases()
-  {
-    return(array("ou=devices,".$this->DivListDevices->selectedBase));
-  }
-
-  function copyPasteHandling_from_queue($s_action,$s_entry)
-  {
-    /* Check if Copy & Paste is disabled */
-    if(!is_object($this->CopyPasteHandler)){
-      return("");
-    }
-
-    /* Add a single entry to queue */
-    if($s_action == "cut" || $s_action == "copy"){
-
-      /* Cleanup object queue */
-      $this->CopyPasteHandler->cleanup_queue();
-      $dn = $this->devices[$s_entry]['dn'];
-      $this->CopyPasteHandler->add_to_queue($dn,$s_action,"devicetabs","DEVICETABS","devices");
-    }
-
-    /* Add entries to queue */
-    if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
-
-      /* Cleanup object queue */
-      $this->CopyPasteHandler->cleanup_queue();
-
-      /* Add new entries to CP queue */
-      foreach($this->list_get_selected_items() as $id){
-        $dn = $this->devices[$id]['dn'];
-
-        if($s_action == "copy_multiple"){
-          $this->CopyPasteHandler->add_to_queue($dn,"copy","devicetabs","DEVICETABS","devices");
-        }
-        if($s_action == "cut_multiple"){
-          $this->CopyPasteHandler->add_to_queue($dn,"cut","devicetabs","DEVICETABS","devices");
-        }
-      }
-    }
-
-    /* Start pasting entries */
-    if($s_action == "editPaste"){
-      $this->start_pasting_copied_objects = TRUE;
-    }
-
-    /* Return C&P dialog */
-    if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
-
-      /* Load entry from queue and set base */
-      $this->CopyPasteHandler->load_entry_from_queue();
-      $this->CopyPasteHandler->SetVar("base",$this->DivListDevices->selectedBase);
-
-      /* Get dialog */
-      $data = $this->CopyPasteHandler->execute();
-
-      /* Return dialog data */
-      if(!empty($data)){
-        return($data);
-      }
-    }
-
-    /* Automatically disable status for pasting */
-    if(!$this->CopyPasteHandler->entries_queued()){
-      $this->start_pasting_copied_objects = FALSE;
-    }
-    return("");
-  }
-
-
-
-  function reload()
-  {
-    /* Set base for all searches */
-    $base       = $this->DivListDevices->selectedBase;
-    $Regex      = $this->DivListDevices->Regex;
-    $SubSearch  = $this->DivListDevices->SubSearch;
-    $Flags      =  GL_NONE | GL_SIZELIMIT;
-    $Filter     = "(&(|(cn=".$Regex.")(description=".$Regex."))(objectClass=gotoDevice))";
-    $tmp        = array();
-
-    /* In case of subsearch, add the subsearch flag */
-    if($SubSearch){
-      $Flags    |= GL_SUBSEARCH;
-    }else{
-      $base ="ou=devices,".$base;
-    }
-
-    /* Get results and create index */
-    $res= get_list($Filter, "devices", $base, array("cn","description","dn","objectClass"), $Flags);
-    foreach ($res as $val){
-      $tmp[strtolower($val['cn'][0]).$val['cn'][0].$val['dn']]=$val;
-    }
-
-    /* sort entries */
-    ksort($tmp);
-    $this->devices=array();
-    foreach($tmp as $val){
-      $this->devices[]=$val;
-    }
-    reset ($this->devices);
-  }
-
-  function remove_lock()
-  {
-    if (isset($this->devicetabs->dn)){
-      del_lock ($this->devicetabs->dn);
-    }
-  }
-
-  function list_get_selected_items()
-  {
-    $ids = array();
-    foreach($_POST as $name => $value){
-      if(preg_match("/^item_selected_[0-9]*$/",$name)){
-        $id   = preg_replace("/^item_selected_/","",$name);
-        $ids[$id] = $id;
-      }
-    }
-    return($ids);
-  }
-
-
-  function remove_from_parent()
-  {
-    /* This cannot be removed... */
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/devices/class_divListDevices.inc b/plugins/admin/devices/class_divListDevices.inc
deleted file mode 100755 (executable)
index fb09fe8..0000000
+++ /dev/null
@@ -1,303 +0,0 @@
-<?php
-
-class divListDevices extends MultiSelectWindow
-{
-  /* Current base */
-  var $selectedBase       = "";
-  var $departments        = array();
-  var $parent               ;
-  var $ui                   ;
-
-  /* Regex */
-  var $Regex              = "*";
-
-  /* Subsearch checkbox */
-  var $SubSearch;
-
-  function divListDevices (&$config, &$parent)
-  {
-    /* Create divlist and setup */
-    MultiSelectWindow::MultiSelectWindow($config, "Devices", "devices");
-    /* initialize required attributes */ 
-    $this->parent           = &$parent;
-    $this->ui               = get_userinfo();
-
-    /* set Page header */
-    $action_col_size = 80;
-    if($this->parent->snapshotEnabled()){
-      $action_col_size += 38;
-    }
-
-    /* Set list strings */
-    $this->SetTitle       (_("List of defined devices"));
-    $this->SetSummary     (_("List of defined devices"));
-    $this->SetInformation (_("This menu allows you to add, edit and remove selected devices. You may want to use the range selector on top of the device listbox, when working with a large number of devices."));
-
-    /* Result page will look like a headpage */
-    $this->SetHeadpageMode();
-    $this->EnableAplhabet(true);
-  
-    /* Disable buttonsm */
-    $this->EnableCloseButton(false);
-    $this->EnableSaveButton (false);
-
-    /* Toggle all selected / deselected */
-    $chk = "<input type='checkbox' id='select_all' name='select_all'
-               onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
-
-    /* set Page header */
-    $this->AddHeader(array("string"=> $chk,          "attach"=>"style='width:20px;'"));
-    $this->AddHeader(array("string" => "&nbsp;",                "attach" => "style='text-align:center;width:20px;'"));
-    $this->AddHeader(array("string" => _("Device name")." / "._("Department"), "attach" => "style=''"));
-    $this->AddHeader(array("string" => _("Actions"),            "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'"));
-
-    /* Add SubSearch checkbox */
-    $this->AddCheckBox("SubSearch",  _("Select to search within subtrees"), _("Search in subtrees"), false);
-
-    /*                  Name                 ,Text                              ,Default  , Connect with alphabet  */
-    $this->AddRegex   ("Regex",     _("Display devices matching"),"*" , true);
-  }
-
-
-  /* Create list header, with create / copy & paste etc*/
-  function GenHeader()
-  {
-    /* Prepare departments,
-       which are shown in the listbox on top of the listbox
-     */
-    $options= "";
-
-    /* Get all departments within this subtree */
-    $ui= get_userinfo();
-    $first = "";
-    $found = FALSE;
-    $base = $this->config->current['BASE'];
-
-    /* Add base */
-    $tmp = array();
-    $tmp[] = array("dn"=>$this->config->current['BASE']);
-    $tmp=  array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
-                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
-
-    $deps = array();
-    foreach($tmp as $tm){
-      $deps[$tm['dn']] = $tm['dn'];
-    }
-
-    /* Load possible departments */
-    $ui= get_userinfo();
-    $tdeps= $ui->get_module_departments($this->module);
-    $ids = $this->config->idepartments;
-    $first = "";
-    $found = FALSE;
-    foreach($ids as $dep => $name){
-      if(isset($deps[$dep]) && in_array_ics($dep, $tdeps)){
-
-        /* Keep first base dn in mind, we could need this
-         *  info if no valid base was found
-         */
-        if(empty($first)) {
-          $first = $dep['dn'];
-        }
-
-        $value = $ids[$dep];
-        if ($this->selectedBase == $dep){
-          $found = TRUE;
-          $options.= "<option selected='selected' value='".$dep."'>$value</option>";
-        } else {
-          $options.= "<option value='".$dep."'>$value</option>";
-        }
-      }
-    }
-
-    /* The currently used base is not visible with your acl setup.
-     * Set base to first useable base.
-     */
-    if(!$found){
-      $this->selectedBase = $first;
-    }
-
-    /* Get acls */
-    $ui       = get_userinfo();
-    $acl      = $ui->get_permissions("cn=dummy,ou=devices,".$this->selectedBase,"devices/deviceGeneric");
-    $acl_all  = $ui->has_complete_category_acls($this->selectedBase,"devices") ;
-
-
-    /* If this is true we add an additional seperator. Just look a few lines below */  
-    $listhead = MultiSelectWindow::get_default_header();
-
-    /* And at least add a department selection box */
-    $listhead .=  _("Base")."&nbsp;<select name='CurrentMainBase' 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;";
-
-    /* Create Layers menu */
-    $s  = ".|"._("Actions")."|\n";
-    $s .= "..|<img src='images/list_new.png' alt='' border='0' class='center'>".
-      "&nbsp;"._("Create")."|\n";
-
-    /* Append create options */
-    if(preg_match("/c/",$acl)) {
-      $s.= "...|<input class='center' type='image' src='images/list_new_device.png' alt=''>".
-        "&nbsp;"._("Device")."|device_new|\n";
-    }
-
-    /* Multiple options */
-    $s.= "..|---|\n";
-    $s.= "..|<img src='images/edittrash.png' alt='' border='0' class='center'>".
-      "&nbsp;"._("Remove")."|"."remove_multiple|\n";
-
-    /* Add multiple copy & cut icons */
-    if(is_object($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
-      $s.= "..|---|\n";
-      $s.= "..|<img src='images/editcopy.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Copy")."|"."multiple_copy_systems|\n";
-      $s.= "..|<img src='images/editcut.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Cut")."|"."multiple_cut_systems|\n";
-
-      if($this->parent->CopyPasteHandler->entries_queued()){
-        $img = "<img border='0' class='center' src='images/editpaste.png' alt=''>";
-        $s.="..|".$img."&nbsp;"._("Paste")."|editPaste|\n";
-      }else{
-        $img = "<img border='0' class='center' src='images/cant_editpaste.png' alt=''>";
-        $s.="..|".$img."&nbsp;"._("Paste")."\n";
-      }
-    }
-
-    /* Add snapshot icons */
-    if(preg_match("/(c.*w|w.*c)/",$acl_all)){
-      $s .= "..|---|\n";
-      $s .= $this->get_snapshot_header(TRUE);
-    }
-
-    $this->SetDropDownHeaderMenu($s);
-                                                                       
-    $this->SetListHeader($listhead);
-  }
-
-
-  /* Some basic settings */
-  function execute()
-  {
-    $this->ClearElementsList();
-    $this->GenHeader();
-  }
-
-
-  function setEntries($list)
-  {
-    /********************
-      Variable init
-     ********************/
-
-    /* Create links */
-    $linkopen = "<a href='?plug=".$_GET['plug']."&amp;act=dep_open&amp;dep_id=%s'>%s</a>";
-    $editlink = "<a href='?plug=".$_GET['plug']."&amp;id=%s&amp;act=edit_entry'>%s</a>";
-    $userimg  = "<img class='center' src='images/select_groups.png' alt='User'    title='%s'>";
-    $deviceimg  = "<img class='center' src='images/select_device.png' alt='A'  title='"._("Device")."'>";
-    $empty    = "<img class='center' src='images/empty.png' style='width:16px;height:16px;' alt=''>";
-
-    /* set Page header */
-    $action_col_size = 80;
-    if($this->parent->snapshotEnabled()){
-      $action_col_size += 38;
-    }
-
-    /********************
-      Attach objects
-     ********************/
-
-    foreach($list as $key => $val){
-
-      $ui       = get_userinfo();
-      $acl      = $ui->get_permissions($val['dn'],"devices/deviceGeneric");
-      $acl_all  = $ui->has_complete_category_acls($val['dn'],"devices") ;
-
-      /* Create action icons */
-      $actions = "";
-      if(preg_match("/(c.*w|w.*c)/",$acl_all)){
-        $actions .= $this->GetSnapShotActions($val['dn']);
-      }
-
-      /* Get copy Paste icons */
-      if(($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
-        $actions.= "<input class='center' type='image'
-          src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
-        $actions.= "<input class='center' type='image'
-          src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
-      }
-
-      $actions.= "<input class='center' type='image'
-        src='images/edit.png' alt='"._("edit")."' name='device_edit_%KEY%' title='"._("Edit this entry")."'>";
-
-      /* Add delete button */
-      if(preg_match("/d/",$acl)){
-        $actions.= "<input class='center' type='image'
-          src='images/edittrash.png' alt='"._("delete")."' name='device_del_%KEY%' title='"._("Delete this entry")."'>";
-      }else{
-        $actions.= "<img src='images/empty.png' alt='&nbsp;' class='center'>";
-      }
-
-      $title = "title='".preg_replace('/ /', '&nbsp;', @LDAP::fix($val['dn']))."'";
-
-      if(!isset($val['description'][0])){
-        $desc = "";
-      }else{
-        $desc = " - [ ".$val['description'][0]." ]";
-      }
-
-      /* Cutted objects should be displayed in light grey */
-      $display = $val['cn'][0].$desc;
-      if($this->parent->CopyPasteHandler){
-        foreach($this->parent->CopyPasteHandler->queue as $queue_key => $queue_data){
-          if($queue_data['dn'] == $val['dn']) {
-            $display = "<font color='#999999'>".$display."</font>";
-            break;
-          }
-        }
-      }
-
-
-      /* Create each field */
-      $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
-                      "attach" => "style='width:20px;'");
-      $field1 = array("string" => sprintf($deviceimg,$val['dn']), "attach" => "style='text-align:center;width:20px;'");
-      $field2 = array("string" => sprintf($editlink,$key,$display), "attach" => "style='' ".$title);
-      $field3 = array("string" => preg_replace("/%KEY%/", $key, $actions), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'");
-      $this->AddElement(array($field0,$field1,$field2,$field3));
-    }
-
-
-    /* Create summary string for list footer */
-    $num_deps=0;
-    if(!$this->SubSearch){
-      $num_deps = count($this->Added_Departments);
-    }
-    $num_objs = count($list);
-
-    $num_obj_str = _("Number of listed devices");
-    $num_dep_str = _("Number of listed departments");
-
-    $str = "<img class='center' src='images/select_devices.png'
-              title='".$num_obj_str."' alt='".$num_obj_str."'>&nbsp;".$num_objs."&nbsp;&nbsp;&nbsp;&nbsp;";
-    $str.= "<img class='center' src='images/folder.png'
-              title='".$num_dep_str."' alt='".$num_dep_str."'>&nbsp;".$num_deps."&nbsp;&nbsp;&nbsp;&nbsp;";
-
-    $this->set_List_Bottom_Info($str);
-  }
-
-  function Save()
-  {
-    MultiSelectWindow::Save();  
-  }
-
-  function save_object()
-  {
-    /* Save automatic created POSTs like regex, checkboxes */
-    MultiSelectWindow::save_object(); 
-  }
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/devices/deviceGeneric.tpl b/plugins/admin/devices/deviceGeneric.tpl
deleted file mode 100644 (file)
index 59f7b9c..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-
-<h2>{t}Devices{/t}</h2>
-
-<table width="100%" summary="">
- <tr>
-  <td width="50%" style="vertical-align:top">
-    <table style="border-right:1px solid #B0B0B0;width:100%">
-        <tr>
-            <td><LABEL for="base">{t}Base{/t}</LABEL>
-            </td>
-            <td>
-                               <select name="base">
-                                       {html_options options=$bases selected=$base}
-                               </select>
-            </td>
-        </tr>
-        <tr>
-            <td><LABEL for="cn">{t}Device name{/t}</LABEL>{$must}
-            </td>
-            <td>
-                <input type="text" size=40 value="{$cn}" name="cn" id="cn">
-            </td>
-        </tr>
-        <tr>
-            <td><LABEL for="description">{t}Description{/t}</LABEL>
-            </td>
-            <td>
-                <input type="text" size=40 value="{$description}" name="description" id="description">
-            </td>
-        </tr>
-    </table>
-   </td>
-   <td style="vertical-align:top">
-    <table summary="">
-        <tr>
-            <td><LABEL for="dev_id">{t}Serial number{/t}&nbsp;{t}(iSerial){/t}</LABEL>{$must}
-            </td>
-            <td>
-                <input type="text" value="{$dev_id}" name="dev_id" id="dev_id">
-            </td>
-            <td colspan="2">&nbsp;</td>
-        </tr>
-        <tr>
-            <td><LABEL for="vendor">{t}Vendor-ID{/t}&nbsp;{t}(idVendor){/t}</LABEL>{$must}
-            </td>
-            <td>
-                <input type="text" value="{$vendor}" name="vendor" id="vendor">
-            </td>
-        </tr>
-        <tr>
-          <td><LABEL for="produkt">{t}Product-ID{/t}&nbsp;{t}(idProduct){/t}</LABEL>{$must}
-            </td>
-            <td>
-                <input type="text" value="{$serial}" name="serial" id="serial">
-            </td>
-        </tr>
-    </table>
-</table>
-<input type='hidden' value="1" name="deviceGeneric_posted">
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-    focus_field('name');
-  -->
-</script>
-
-
diff --git a/plugins/admin/devices/main.inc b/plugins/admin/devices/main.inc
deleted file mode 100755 (executable)
index 92f901d..0000000
+++ /dev/null
@@ -1,57 +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
- */
-
-if ($remove_lock){
-               if(isset($_SESSION['DeviceManagement'])){
-                               $DeviceManagement= $_SESSION['DeviceManagement'];
-                               $DeviceManagement->remove_lock();
-                               del_lock ($ui->dn);
-                               sess_del ('DeviceManagement');
-               }
-} else {
-
-               /* Create DeviceManagement object on demand */
-               if (!isset($_SESSION['DeviceManagement']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
-                               $_SESSION['DeviceManagement']= new deviceManagement ($config);
-               }
-
-               /* Get object */
-               $DeviceManagement= $_SESSION['DeviceManagement'];
-               $DeviceManagement->save_object();
-               $output= $DeviceManagement->execute();
-
-               /* Page header*/
-               if (isset($_SESSION['objectinfo'])){
-                               $display= print_header(get_template_path('images/devices.png'), _("Device management"), "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".@LDAP::fix($_SESSION['objectinfo']));
-               } else {
-                               $display= print_header(get_template_path('images/devices.png'), _("Device management"));
-               }
-
-               /* Reset requested? */
-               if (isset($_GET['reset']) && $_GET['reset'] == 1){
-                               del_lock ($ui->dn);
-                               sess_del ('DeviceManagement');
-               }
-
-               /* Show and save dialog */
-               $display.= $output;
-               $_SESSION['DeviceManagement']= $DeviceManagement;
-}
-?>
diff --git a/plugins/admin/devices/paste_deviceGeneric.tpl b/plugins/admin/devices/paste_deviceGeneric.tpl
deleted file mode 100644 (file)
index 44d6882..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-
-<h2>{t}Devices{/t}</h2>
-
-<table width="100%" summary="">
- <tr>
-  <td width="50%" style="vertical-align:top">
-    <table style="border-right:1px solid #B0B0B0;width:100%">
-        <tr>
-            <td><LABEL for="cn">{t}Device name{/t}</LABEL>{$must}
-            </td>
-            <td>
-                <input type="text" size=40 value="{$cn}" name="cn" id="cn">
-            </td>
-        </tr>
-    </table>
-   </td>
-</table>
-<input type='hidden' value="1" name="deviceGeneric_posted">
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-    focus_field('name');
-  -->
-</script>
-
-
diff --git a/plugins/admin/devices/remove.tpl b/plugins/admin/devices/remove.tpl
deleted file mode 100755 (executable)
index 643056c..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<div style="font-size:18px;">
-  <img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
-</div>
-<p>
- {$intro}
- {t}This may be used by several users/groups. 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}So - if you're sure - press 'Delete' to continue or 'Cancel' to abort.{/t}
-</p>
-
-<p class="plugbottom">
-       {if $multiple}
-               <input type=submit name="delete_multiple_device_confirm" value="{t}Delete{/t}">
-               &nbsp;
-               <input type=submit name="delete_multiple_device_cancel" value="{t}Cancel{/t}">
-       {else}
-               <input type=submit name="delete_device_confirm" value="{t}Delete{/t}">
-               &nbsp;
-               <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
-       {/if}
-</p>
-
diff --git a/plugins/admin/devices/tabs_devices.inc b/plugins/admin/devices/tabs_devices.inc
deleted file mode 100755 (executable)
index 9cb2e90..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-<?php
-
-class devicetabs extends tabs
-{
-  var $Release= "";
-
-  function devicetabs($config, $data, $dn,$category)
-  {
-    tabs::tabs($config, $data, $dn,$category);
-
-    /* Add references/acls/snapshots */
-    $this->addSpecialTabs();
-  }
-
-  function save($ignore_account= FALSE)
-  {
-    $baseobject= $this->by_object['deviceGeneric'];
-    $new_dn= "cn=".$baseobject->cn.",ou=devices,".$baseobject->base;
-
-    /* Move group? */
-    if ($this->dn != $new_dn){
-
-      /* Write entry on new 'dn' */
-      if ($this->dn != "new"){
-        $baseobject->move($this->dn, $new_dn);
-        $this->by_object['deviceGeneric']= $baseobject;
-      }
-
-      /* Happen to use the new one */
-      $this->dn= $new_dn;
-    }
-
-    tabs::save();
-
-    /* Fix tagging if needed */
-    $baseobject->dn= $this->dn;
-    $baseobject->handle_object_tagging();
-    $this->by_object['deviceGeneric'] = $baseobject;
-  }
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/fai/askClassName.tpl b/plugins/admin/fai/askClassName.tpl
deleted file mode 100644 (file)
index 7975e10..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-<div style="font-size: 18px;">
-       {$headline}
-</div>
-<br>
-<p class="seperator">
-{t}Adding a new class to the FAI management, requires a class name. You have to specify a unique class name for unique types of FAI classes, while you can use the same class name for different types of FAI classes. In the laste case, FAI will automatically enclose all these different class types to one unique class name.{/t}
-<br>
-<br>
-</p>
-<p class="seperator">
-<br>
-<b>{t}Please use one of the following methods to choose the name for the new FAI class.{/t}</b>
-<br>
-<br>
-</p>
-<br>
-<table summary="" style='width:100%'>
- <tr>
-  <td style='width:49%'>
-   <table summary="">
-    <tr>
-     <td>
-       <input type=radio name="classSelector" value="1" checked>
-     </td>
-     <td> 
-       <h1>{t}Enter FAI class name manually{/t}</h1>
-     </td>
-   </tr>
-   <tr>
-     <td>&nbsp;</td>
-     <td>
-      {t}Class name{/t}&nbsp;<input type="text"         name="UseTextInputName" value="{$ClassName}" style="width:120px;">
-     </td>
-    </tr>
-   </table>
-   <br>
-   <br>
-  </td>
-  <td style='border-left:1px solid #909090'>
-  </td>
-  <td>
-   <table summary="" {$grey}>
-    <tr>
-     <td>
-       <input type=radio name="classSelector" value="2" {$ClassNamesAvailable}>
-     </td>
-     <td>
-      <h1 {$grey}>{t}Choose FAI class name from a list of existing classes{/t}</h1>
-     </td>
-    </tr>
-    <tr>
-     <td>&nbsp;</td>
-     <td>
-      {t}Class name{/t}&nbsp;<select name="SelectedClass" title="{t}Choose class name{/t}" style="width:120px;" {$ClassNamesAvailable}>
-       {html_options options=$ClassNames}
-      </select>
-     </td>
-    </tr>
-   </table>
-   <br>
-   <br>
-  </td>
- </tr>
-</table>
-
-<!--
-<table summary="">
-       <tr>
-               <td>
-               <input type="submit" name="UseSelectedClass" value="{t}Use{/t}" {$ClassNamesAvailable}> 
-               </td>
-       </tr>
-       <tr>
-               <td><b>{t}A new class name.{/t}</b>
-               </td>
-               <td>
-               <input type="submit" name="UseNewClass" value="{t}Use{/t}"> 
-               </td>
-       </tr>
-</table>
--->
-<p class="seperator">&nbsp;</p>
-       
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-       <!--
-       focus_field('UseTextInputName');
-       -->
-</script>
diff --git a/plugins/admin/fai/branch_selector.tpl b/plugins/admin/fai/branch_selector.tpl
deleted file mode 100644 (file)
index addb5a7..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-<br>
- <div class="contentboxh" style="border-bottom:1px solid #B0B0B0;">
-    <p class="contentboxh"><img src="{$branchimage}" align="right" alt="[F]">{t}Branches{/t}</p>
-   </div>
-   <div class="contentboxb">
-        <table summary="" style="width:100%;border-bottom:1px solid #B0B0B0;">
-     <tr>
-      <td>
-    {t}Current release{/t}&nbsp;
-    <select name="selectedBranch" onChange="document.mainform.submit();">
-        {html_options options=$branches selected=$selectedBranch}
-    </select>
-      </td>
-     </tr>
-        </table>
-        <table summary="" style="width:100%;">
-     <tr>
-      <td>
-    {if $allow_create}
-        <input class="center" type="image" name="branch_branch" src="images/branch_small.png">
-        <a href="?plug={$plug_id}&act=branch_branch">{t}Create new branch{/t}</a>
-        <br>
-        <input class="center" type="image" name="freeze_branch" src="images/freeze.png">
-               <a href="?plug={$plug_id}&act=freeze_branch">{t}Create new locked branch{/t}</a>
-    {else}
-        <img src="images/branch_small_grey.png" alt='{t}Branch{/t}' class='center'>
-        {t}Create new branch{/t}
-        <br>
-        <img src="images/freeze_grey.png" alt='{t}Freeze{/t}' class='center'>
-               {t}Create new locked branch{/t}
-    {/if}
-
-    {if $selectedBranch != "main" && $allow_remove}
-    <br>
-        <input class="center" type="image" name="remove_branch" src="images/edittrash.png">
-           <a href="?plug={$plug_id}&act=remove_branch">{t}Delete current release{/t}</a>
-    {/if}
-      </td>
-     </tr>
-        </table>
-   </div>
-
diff --git a/plugins/admin/fai/class_askClassName.inc b/plugins/admin/fai/class_askClassName.inc
deleted file mode 100644 (file)
index 4225869..0000000
+++ /dev/null
@@ -1,172 +0,0 @@
-<?php
-
-class askClassName 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 $objectClass        = false;
-  var $forbidden          = array();
-  var $ClassName          = "";  
-  var $ClassAlreadyExists = false;
-
-  function askClassName (&$config,$dn,$ui,$objectClass)
-  {
-    $this->ui = $ui;
-    $this->objectClass = $objectClass;
-    plugin::plugin ($config, $dn);
-    if(!isset($_SESSION['CurrentMainBase'])){
-      $_SESSION['CurrentMainBase'] = $this->config->current['BASE'];
-    }
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* Fill templating stuff */
-    $smarty = get_smarty();
-    $display= "";
-
-    /* The faifilter contais 
-     * The base for all fai objects 
-     */
-    $faifilter = $_SESSION['faifilter'];
-
-    /* First search for every ou, in given fai base
-     * With a second search detect all object that belong to the different ous. 
-     */
-
-    $base = "ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase'];
-    if($faifilter['branch'] != "main"){
-      $base = $faifilter['branch'];
-    }
-    $ldap = $this->config->get_ldap_link();
-    
-    $res= get_list("(&(objectClass=organizationalUnit)(!(objectClass=FAIbranch)))", "fai", $base,
-                   array("cn","description","objectClass"), GL_SIZELIMIT );
-
-    $delete = array();
-    $used   = array();
-    foreach($res as $objecttypes){
-      $res2= get_list("(objectClass=*)", "fai", $objecttypes['dn'],
-                      array("cn","description","objectClass","FAIclass","FAIstate"), GL_SIZELIMIT | GL_CONVERT );
-      foreach($res2 as $object){
-
-        /* skip class names with this name */ 
-        if(in_array($this->objectClass,$object['objectClass']) || in_array("FAIprofile",$object['objectClass'])){
-          if(isset($object['FAIstate'][0]) && preg_match("/removed$/",$object['FAIstate'][0])){
-            continue;
-          }
-          $delete[] = $object['cn'][0];
-        }
-    
-        /* Skip profiles */
-        if(!in_array("FAIprofile",$object['objectClass'])){
-          if(isset($object['cn'])){
-            $used[$object['cn'][0]]= $object['cn'][0];
-          }
-        }
-      }
-    }
-
-    /* Create headline
-     * Depending on the object type we want to create, a different headline will be shown
-     */ 
-    switch($this->objectClass) {
-      case "FAIpartitionTable":  $str =_("Create new FAI object - partition table.");break;
-      case "FAIpackageList"   :  $str =_("Create new FAI object - package bundle.");break;
-      case "FAIscript"        :  $str =_("Create new FAI object - script bundle.");break;
-      case "FAIvariable"      :  $str =_("Create new FAI object - variable bundle.");break;
-      case "FAIhook"          :  $str =_("Create new FAI object - hook bundle.");break;
-      case "FAIprofile"       :  $str =_("Create new FAI object - profile.");break;
-      case "FAItemplate"      :  $str =_("Create new FAI object - template.");break;
-      default                 :  $str =_("Create new FAI object");break;
-    }
-    $smarty->assign("headline",$str);
-    
-    /* Save forbidden class names
-     */
-    $this->forbidden = $delete;
-
-    /* Delete all class names which already have this type of object 
-     */
-    foreach($delete as $del){
-      unset($used[$del]);
-    }
-   
-    /* if there is no class name which is missing for this type 
-     *  of objectClass, we only can create a new one, disable selectBox 
-     */
-    if(count ($used)==0){
-      $smarty->assign("ClassNamesAvailable", " disabled ");
-      $smarty->assign("grey", 'style="color:#C0C0C0"');
-    }else{
-      $smarty->assign("ClassNamesAvailable", "");
-      $smarty->assign("grey", "");
-    }
-    ksort($used);
-    $smarty->assign("ClassNames", $used);
-    $smarty->assign("ClassName",  $this->ClassName);
-    $display.= $smarty->fetch(get_template_path('askClassName.tpl', TRUE));
-    return($display);
-  }
-
-  /* Get posts and set class name 
-   */ 
-  function save_object()
-  {
-    if(isset($_POST['classSelector']) && $_POST['classSelector'] == 1 
-       && isset($_POST['edit_continue'])){
-      $this->ClassName          = $_POST['UseTextInputName'];
-      $this->ClassAlreadyExists = true;
-    }
-  
-    if(isset($_POST['classSelector']) && $_POST['classSelector'] == 2 
-       && isset($_POST['edit_continue'])){
-      $this->ClassAlreadyExists = false;
-      $this->ClassName          = $_POST['SelectedClass'];
-    }
-  }
-
-  /* Check given class name 
-   */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-  
-    if($this->ClassName != preg_replace("/ /","",trim($this->ClassName))){
-      $message[] = _("Spaces are not allowed within class names.");
-    }
-
-    if(empty($this->ClassName)){
-      $message[]=_("The given class name is empty.");
-    }
-
-    if(in_array($this->ClassName,$this->forbidden)){
-      $message[]=_("The specified class name is already in use for this object type.");
-    }
-
-    return ($message);
-  }
-
-
-  /* Return the class name */
-  function save()
-  {
-    return($this->ClassName);
-  }
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/fai/class_divListFai.inc b/plugins/admin/fai/class_divListFai.inc
deleted file mode 100644 (file)
index b15485c..0000000
+++ /dev/null
@@ -1,419 +0,0 @@
-<?php
-
-class divListFai extends MultiSelectWindow
-{
-  /* Current base */
-  var $selectedBase       = "";
-  var $selectedBranch     = "main";
-  var $AvailableBranches  = array();
-  var $departments        = array();
-
-  /* Regex */
-  var $Regex              = "*";
-  var $ShowProfiles;
-  var $ShowTemplates;
-  var $ShowScripts;
-  var $ShowHooks;
-  var $ShowVariables;
-  var $ShowPackages;
-  var $ShowPartitions;
-
-  /* Subsearch checkbox */
-  var $SubSearch;
-
-  var $parent             ;
-  var $ui                 ;
-
-  var $SaveAdditionalVars = array("selectedBranch");
-
-  function divListFai (&$config,$parent)
-  {
-    MultiSelectWindow::MultiSelectWindow($config, "Fai", "fai");
-    
-    $this->parent       = $parent;
-    $this->ui           = get_userinfo();
-
-    /* Set default base */
-    if(!isset($_SESSION['CurrentMainBase'])){
-      $_SESSION['CurrentMainBase'] = $this->config->current['BASE'];
-    }
-    $this->selectedBase = $_SESSION['CurrentMainBase'];
-
-    /* Set list strings */
-    $this->SetTitle(_("List of FAI classes"));
-    $this->SetSummary(_("This table displays all FAI classes in the selected tree."));
-
-    /* Result page will look like a headpage */
-    $this->SetHeadpageMode();
-    $this->SetInformation(_("This menu allows you to create, delete and edit FAI classes."));
-
-    $this->EnableAplhabet   (true);
-  
-    /* Disable buttonsm */
-    $this->EnableCloseButton(false);
-    $this->EnableSaveButton (false);
-
-    /* Dynamic action col, depending on snapshot icons */
-    $action_col_size = 80;
-#   if($this->parent->snapshotEnabled()){
-#     $action_col_size += 32;
-#   }
-
-    /* Toggle all selected / deselected */
-    $chk = "<input type='checkbox' id='select_all' name='select_all'
-               onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
-
-    /* set Page header */
-    $this->AddHeader(array("string"=> $chk,          "attach"=>"style='width:20px;'"));
-    $this->AddHeader(array("string" => "&nbsp;",                "attach" => "style='text-align:center;width:20px;'"));
-    $this->AddHeader(array("string" => _("Name of FAI class"),  "attach" => "style=''"));
-    $this->AddHeader(array("string" => _("Class type"),         "attach" => "style='width:200px;'"));
-    $this->AddHeader(array("string" => _("Actions"),            "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'"));
-
-    $this->AddCheckBox("ShowProfiles"   , _("Display FAI profile objects")    ,_("Show profiles")     ,true);
-    $this->AddCheckBox("ShowTemplates"  , _("Display FAI template objects")   ,_("Show templates")    ,true);
-    $this->AddCheckBox("ShowScripts"    , _("Display FAI scripts")            ,_("Show scripts")      ,true);
-    $this->AddCheckBox("ShowHooks"      , _("Display FAI hooks")              ,_("Show hooks")        ,true);
-    $this->AddCheckBox("ShowVariables"  , _("Display FAI variables")          ,_("Show variables")    ,true);
-    $this->AddCheckBox("ShowPackages"   , _("Display FAI packages")           ,_("Show packages")     ,true);
-    $this->AddCheckBox("ShowPartitions" , _("Display FAI partitions")         ,_("Show partitions")   ,true);
-
-    /* Add SubSearch checkbox */
-    //$this->AddCheckBox(SEPERATOR);
-    //$this->AddCheckBox("SubSearch",  _("Select to search within subtrees"), _("Search in subtrees"), false);
-
-    /*                  Name                 ,Text                              ,Default  , Connect with alphabet  */
-    $this->AddRegex   ("Regex",     _("Display users matching"),"*" , true);
-  }
-
-  function AddUserBoxToFilter($position)
-  {
-    $str = "";
-    if($position  == 2){
-
-      /* Check if there are post commands available for fai management.
-       * If not, grey out freeze/branch and release remove buttons.
-       */
-      $r = $this->config->search("faiManagement", "POSTREMOVE",array('menu','tabs'));
-      $c = $this->config->search("faiManagement", "POSTCREATE",array('menu','tabs'));
-
-      $smarty = get_smarty();
-      $smarty->assign("allow_create", $c);
-      $smarty->assign("allow_remove", $r);
-      $smarty->assign("selectedBranch",$this->selectedBranch);
-      $smarty->assign("branchimage","images/branch.png");
-      $smarty->assign("branches",$this->AvailableBranches);
-      $plug_id = 0;       
-      if(isset($_GET['plug'])){
-        $plug_id = $_GET['plug'];
-      }
-      $smarty->assign("plug_id",$plug_id);
-      $str = $smarty->fetch(get_template_path('branch_selector.tpl', TRUE));
-    }
-    return($str);
-  }
-
-  function GenHeader()
-  {
-    /* Prepare departments,
-       which are shown in the listbox on top of the listbox
-     */
-    $options= "";
-
-    /* Get all departments within this subtree */
-    $ui= get_userinfo();
-    $first = "";
-    $found = FALSE;
-    $base = $this->config->current['BASE'];
-
-    /* Add base */
-    $tmp = array();
-    $tmp[] = array("dn"=>$this->config->current['BASE']);
-    $tmp=  array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
-                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
-
-    $deps = array();
-    foreach($tmp as $tm){
-      $deps[$tm['dn']] = $tm['dn'];
-    }
-
-    /* Load possible departments */
-    $ui= get_userinfo();
-    $tdeps= $ui->get_module_departments("fai");
-    $ids = $this->config->idepartments;
-    $first = "";
-    $found = FALSE;
-    foreach($ids as $dep => $name){
-      if(isset($deps[$dep]) && in_array_ics($dep, $tdeps)){
-
-        /* Keep first base dn in mind, we could need this
-         *  info if no valid base was found
-         */
-        if(empty($first)) {
-          $first = $dep['dn'];
-        }
-
-        $value = $ids[$dep];
-        if ($this->selectedBase == $dep){
-          $found = TRUE;
-          $options.= "<option selected='selected' value='".$dep."'>$value</option>";
-        } else {
-          $options.= "<option value='".$dep."'>$value</option>";
-        }
-      }
-    }
-
-    /* The currently used base is not visible with your acl setup.
-     * Set base to first useable base.
-     */
-    if(!$found){
-      $this->selectedBase = $first;
-    }
-
-    /* Add seperator */
-    $add_sep = false;
-
-    /* Get complete fai acls, to be able to check if we must show or hide the snapshot abilities */ 
-    $acl_all = $ui->has_complete_category_acls($this->selectedBase,$this->module);
-
-    /* Add default header */
-    $listhead = MultiSelectWindow::get_default_header();
-
-    /* Add additional seperator */
-    if($add_sep){
-      $listhead .=" <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;";
-    }
-
-    $listhead .=  _("Base")."&nbsp;<select name='CurrentMainBase' 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;";
-
-
-    $s  = ".|"._("Actions")."|\n";
-    $s .= "..|<img src='images/list_new.png' alt='' border='0' class='center'>".
-      "&nbsp;"._("Create")."|\n";
-
-    $acl = $ui->get_permissions($this->selectedBase,"fai/faiProfile");
-    if(preg_match("/c/",$acl)){
-      $s.= "...|<input class='center' type='image' src='images/fai_new_profile.png' alt=''>".
-        "&nbsp;"._("Profile")."|Create_profile|\n";
-    }
-
-    /* Append create icons for each fai component */
-    $arr = array(
-        array("images/fai_new_partitionTable.png" , _("Partition table")  ,"Create_partition" , _("PT") , "faiPartitionTable"),
-        array("images/fai_new_script.png"         , _("Scripts")          ,"Create_script"    , _("S")  , "faiScript"),
-        array("images/fai_new_hook.png"           , _("Hooks")            ,"Create_hook"      , _("H")  , "faiHook"),
-        array("images/fai_new_variable.png"       , _("Variables")        ,"Create_variable"  , _("V")  , "faiVariable"),
-        array("images/fai_new_template.png"       , _("Templates ")       ,"Create_template"  , _("I")  , "faiTemplate"),
-        array("images/fai_new_packages.png"       , _("Package list")     ,"Create_package"   , _("PK") , "faiPackage"));
-
-    foreach($arr as $ar){
-      $acl = $ui->get_permissions($this->selectedBase,"fai/".$ar[4]);
-      if(preg_match("/c/",$acl)){
-        $s.= "...|<input class='center' type='image' src='".$ar[0]."' alt=''>".
-          "&nbsp;".$ar[1]."|".$ar[2]."|\n";
-      }
-    }
-
-    /* Multiple options */
-    $s.= "..|<img src='images/edittrash.png' alt='' border='0' class='center'>".
-      "&nbsp;"._("Remove")."|"."remove_multiple|\n";
-
-    /* Add multiple copy & cut icons */
-    if(is_object($this->parent->CopyPasteHandler)){
-      $s.= "..|---|\n";
-      $s.= "..|<img src='images/editcopy.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Copy")."|"."multiple_copy_systems|\n";
-      $s.= "..|<img src='images/editcut.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Cut")."|"."multiple_cut_systems|\n";
-    }
-
-    /* Add copy & paste icons, currently disabled, this ability is not implemeneted yet */
-    if(preg_match("/(c.*w|w.*c)/",$acl_all) &&  isset($this->parent->CopyPasteHandler) && $this->parent->CopyPasteHandler){
-      $s .= "..|---|\n";
-      if($this->parent->CopyPasteHandler->entries_queued()){
-        $img = "<img border='0' class='center' src='images/editpaste.png' alt=''>";
-        $s.="..|".$img."&nbsp;"._("Paste")."|editPaste|\n";
-      }else{
-        $img = "<img border='0' class='center' src='images/cant_editpaste.png' alt=''>";
-        $s.="..|".$img."&nbsp;"._("Paste")."\n";
-      }
-    }
-
-#   /* Add snapshot icons, if we are allowed to write and create the complete fai module ($ui->has_complete_category_acls) */ 
-#   if(preg_match("/(c.*w|w.*c)/",$acl_all)){ 
-#     if($this->parent->snapshotEnabled()){
-#       $s .= "..|---|\n";
-#       $s .= $this->get_snapshot_header(TRUE);
-#     }
-#   }
-
-    $this->SetDropDownHeaderMenu($s);
-    $this->SetListHeader($listhead);
-  }
-
-  /* so some basic settings */
-  function execute()
-  {
-    $this->ClearElementsList();
-    $this->GenHeader();
-    $this->AvailableBranches = $this->parent->getBranches();
-  }
-
-  function setEntries($list)
-  {
-    /********************
-      Variable init
-     ********************/
-
-     $objects = array(
-           "FAIpartitionTable"  => array("IMG"=> "images/fai_partitionTable.png", "NAME"=>_("Partition table"),"KZL"=> "PT", "VAR"=>"ShowPartitions"),
-           "FAIpackageList"     => array("IMG"=> "images/fai_packages.png",       "NAME"=>_("Package list") ,  "KZL"=> "PL", "VAR"=>"ShowPackages"),
-           "FAIscript"          => array("IMG"=> "images/fai_script.png",         "NAME"=>_("Scripts") ,       "KZL"=> "S",  "VAR"=>"ShowScripts"),
-           "FAIvariable"        => array("IMG"=> "images/fai_variable.png",       "NAME"=>_("Variables") ,     "KZL"=> "V",  "VAR"=>"ShowVariables"),
-           "FAIhook"            => array("IMG"=> "images/fai_hook.png",           "NAME"=>_("Hooks"),          "KZL"=> "H",  "VAR"=>"ShowHooks"),
-           "FAIprofile"         => array("IMG"=> "images/fai_profile.png",        "NAME"=>_("Profile") ,       "KZL"=> "P",  "VAR"=>"ShowProfiles"),
-           "FAItemplate"        => array("IMG"=> "images/fai_template.png",       "NAME"=>_("Templates") ,     "KZL"=> "T",  "VAR"=>"ShowTemplates"));
-
-    $editlink ="<a href='?plug=".$_GET['plug']."&amp;edit_entry=%KEY%' title='%TITLE%'>%NAME%</a>";
-
-    /* Dynamic action col, depending on snapshot icons */
-    $action_col_size = 80;
-#   if($this->parent->snapshotEnabled()){
-#     $action_col_size += 32;
-#   }
-
-    /********************
-      Attach objects
-     ********************/
-
-    $cnts = array();
-    foreach($objects as $key => $data){
-      $cnts[$key] = 0;
-    }
-
-     foreach($list as $key => $value){
-       $info     = "";
-       $img      = "";
-       $type     = $value['type'];
-       $abort    =false;
-
-       $cnts[$type] ++;
-
-       if(isset($objects[$type])){
-         $img   = "<img class='center' src='".$objects[$type]['IMG']."' title='".$objects[$type]['NAME']."' alt='".$objects[$type]['KZL']."'>";
-         $info  = $objects[$type]['NAME'];
-         $var   = $objects[$type]['VAR'];
-       }else{
-         $img   = "<img class='center' src='images/empty.png' alt=''>";
-         $info  = "";
-         $var   = "";
-       }
-
-       if((isset($value['description']))&&(!empty($value['description']))){
-         $desc= " [".$value['description']."]";
-       }else{
-         $desc= "";
-       }
-
-       /* Add copy & cut icons */
-       $ui = get_userinfo();
-       $action ="";
-       $acl_all = $ui->has_complete_category_acls($this->selectedBase,$this->module);
-       if(preg_match("/(c.*w|w.*c)/",$acl_all) && $this->parent->CopyPasteHandler){
-         $action .= "<input class='center' type='image'
-           src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
-         $action.= "<input class='center' type='image'
-           src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
-       }
-
-       if($value['FAIstate'] == "freeze"){
-         $action.=  "<img src='images/closedlock.png' alt='F' class='center'><img src='images/empty.png' width='38' height='2' class='center' alt=''>";
-         $action.= "<input class='center' type='image' src='images/edit.png'  alt='"._("edit")."'
-           name='entry_edit_%KEY%' title='"._("Edit class")."'>";
-       }else{
-         $action.= "<input class='center' type='image' src='images/edit.png'  alt='"._("edit")."'
-           name='entry_edit_%KEY%' title='"._("Edit class")."'>";
-
-#        if(preg_match("/(c)/",$value['acl']) && preg_match("/(w)/",$value['acl'])){
-#          $action.= $this->GetSnapShotActions($value['dn']);;
-#        }
-
-         if(preg_match("/d/",$value['acl'])){
-           $action.= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."'
-             name='entry_delete_%KEY%' title='"._("Delete class")."'>";
-         }
-       }
-
-       /* Cutted objects should be displayed in light grey */
-       $display = $value['cn'].$desc;
-       if($this->parent->CopyPasteHandler){
-         foreach($this->parent->CopyPasteHandler->queue as $queue_key => $queue_data){
-           if($queue_data['dn'] == $value['dn']) {
-             $display = "<font color='#999999'>".$display."</font>";
-             break;
-           }
-         }
-       }
-       $edi = $editlink;
-       $acti = $action;
-
-       /* Create each field */
-       $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
-           "attach" => "style='width:20px;'");
-       $field1 = array("string" => $img , "attach" => "style='text-align:center;width:20px;'");
-       $field2 = array("string" => preg_replace(array("/%KEY%/","/%NAME%/","/%TITLE%/"),array($key,$display,preg_replace('/ /', '&nbsp;', @LDAP::fix($value['dn']))),$edi) , "attach" => "style=''");
-       $field3 = array("string" => $info, "attach" => "style='width:200px;'");
-       $field4 = array("string" => preg_replace("/%KEY%/",$key,$acti) , "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'");
-       $this->AddElement(array($field0,$field1,$field2,$field3,$field4));
-     }
-
-     /* Create summary string for list footer */
-     $num_deps=0;
-     if(!$this->SubSearch){
-       $num_deps = count($this->Added_Departments);
-     }
-
-     $profile_str    = _("Number of listed profiles");
-     $partition_str  = _("Number of listed partitions");
-     $script_str     = _("Number of listed scripts");
-     $hook_str       = _("Number of listed hooks");
-     $variable_str   = _("Number of listed variables");
-     $template_str   = _("Number of listed templates");
-     $package_str    = _("Number of listed packages");
-     $dep_str        = _("Number of listed departments");
-
-     $str = "<img class='center' src='".$objects['FAIprofile']['IMG']."'
-       title='".$profile_str."' alt='".$profile_str."'>&nbsp;".$cnts['FAIprofile']."&nbsp;&nbsp;&nbsp;&nbsp;";
-     $str.= "<img class='center' src='".$objects['FAIpartitionTable']['IMG']."'
-       title='".$partition_str."' alt='".$partition_str."'>&nbsp;".$cnts['FAIpartitionTable']."&nbsp;&nbsp;&nbsp;&nbsp;";
-     $str.= "<img class='center' src='".$objects['FAIscript']['IMG']."'
-       title='".$script_str."' alt='".$script_str."'>&nbsp;".$cnts['FAIscript']."&nbsp;&nbsp;&nbsp;&nbsp;";
-     $str.= "<img class='center' src='".$objects['FAIhook']['IMG']."'
-       title='".$hook_str."' alt='".$hook_str."'>&nbsp;".$cnts['FAIhook']."&nbsp;&nbsp;&nbsp;&nbsp;";
-     $str.= "<img class='center' src='".$objects['FAIvariable']['IMG']."'
-       title='".$variable_str."' alt='".$variable_str."'>&nbsp;".$cnts['FAIvariable']."&nbsp;&nbsp;&nbsp;&nbsp;";
-     $str.= "<img class='center' src='".$objects['FAItemplate']['IMG']."'
-       title='".$template_str."' alt='".$template_str."'>&nbsp;".$cnts['FAItemplate']."&nbsp;&nbsp;&nbsp;&nbsp;";
-     $str.= "<img class='center' src='".$objects['FAIpackageList']['IMG']."'
-       title='".$package_str."' alt='".$package_str."'>&nbsp;".$cnts['FAIpackageList']."&nbsp;&nbsp;&nbsp;&nbsp;";
-     $str.= "<img class='center' src='images/folder.png'
-       title='".$dep_str."' alt='".$dep_str."'>&nbsp;".$num_deps."&nbsp;&nbsp;&nbsp;&nbsp;";
-     $this->set_List_Bottom_Info($str);
-  }
-
-  function Save()
-  {
-    MultiSelectWindow::Save();  
-  }
-
-  function save_object()
-  {
-    /* Save automatic created POSTs like regex, checkboxes */
-    MultiSelectWindow::save_object(); 
-    $_SESSION['faifilter']['branch'] = $this->selectedBranch; 
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/fai/class_faiHook.inc b/plugins/admin/fai/class_faiHook.inc
deleted file mode 100644 (file)
index ce60202..0000000
+++ /dev/null
@@ -1,608 +0,0 @@
-<?php
-
-class faiHook 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;
-
-  /* Attributes for this Object */
-  var $attributes       = array("cn","description");
-
-  /* ObjectClasses for this Object*/
-  var $objectclasses    = array("top","FAIclass","FAIhook");
-
-  /* Class name of the Ldap ObjectClass for the Sub Object */
-  var $subClass         = "FAIhookEntry";
-  var $subClasses       = array("top","FAIclass","FAIhookEntry");
-
-  /* Class name of the php class which allows us to edit a Sub Object */
-  var $subClassName     = "faiHookEntry";      
-
-  /* Attributes to initialise for each subObject */
-  var $subAttributes    = array("cn","description","FAItask"); 
-  var $sub_Load_Later   = array("FAIscript");
-  var $sub64coded       = array();
-  var $subBinary        = array("FAIscript");
-
-  /* Specific attributes */
-  var $cn               = "";       // The class name for this object
-  var $description      = "";       // The description for this set of partitions
-  var $is_dialog        = false;    // specifies which buttons will be shown to save or abort
-  var $SubObjects       = array();  // All leafobjects of this object
-  var $view_logged      = FALSE;
-  var $FAIstate         = "";  
-  var $ui;
-
-  function faiHook (&$config, $dn= NULL)
-  {
-    /* Load Attributes */
-    plugin::plugin ($config, $dn);
-
-    /* If "dn==new" we try to create a new entry
-     * Else we must read all objects from ldap which belong to this entry.
-     */
-    if($dn != "new"){
-      $this->dn =$dn;
-    
-      /* Get FAIstate
-       */
-      if(isset($this->attrs['FAIstate'][0])){
-        $this->FAIstate = $this->attrs['FAIstate'][0];
-      }
-
-      /* Read all leaf objects of this object (For FAIscript this would be FAIscriptEntry)
-       */
-      $ldap     = $this->config->get_ldap_link();
-      $ldap->cd ($this->dn);
-      $attrs_to_search = $this->subAttributes;
-      $attrs_to_search[] = "FAIstate";
-      $ldap->search("(&(objectClass=FAIclass)(objectClass=".$this->subClass."))", $attrs_to_search);
-
-      while($object = $ldap->fetch()){
-
-       /* Skip objects, that are tagged as removed */
-        if(isset($object['FAIstate'][0])){
-          if(preg_match("/removed$/",$object['FAIstate'][0])){
-            continue;
-          }
-        }
-
-        /* Set status for save management */
-        $objects = array();
-        $objects['status']      = "FreshLoaded";
-        $objects['dn']          = $object['dn'];
-        $objects                = $this->get_object_attributes($objects,$this->subAttributes);
-        $this->SubObjects[$objects['cn']] = $objects;
-      }
-    }
-    $this->ui = get_userinfo();
-  }
-
-
-  /* Reload some attributes */
-  function get_object_attributes($object,$attributes)
-  {
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->cat($object['dn'],$attributes);
-    $tmp  = $ldap->fetch();
-
-    foreach($attributes as $attrs){
-      if(isset($tmp[$attrs][0])){
-        $var = $tmp[$attrs][0];
-
-        /* Check if we must decode some attributes */
-        if(in_array_ics($attrs,$this->sub64coded)){
-          $var = base64_decode($var);
-        }
-
-        /*  check if this is a binary entry */
-        if(in_array_ics($attrs,$this->subBinary)){
-          $var = $ldap->get_attribute($object['dn'], $attrs,$r_array=0);
-        }
-
-        /* Fix slashes */
-        $var = addslashes($var);
-        $object[$attrs] = $var;
-      }
-    }
-    return($object);
-  }
-
-
-  function acl_base_for_current_object($dn)
-  {
-    if($dn == "new"){
-      if($this->dn == "new"){
-        $dn= $_SESSION['CurrentMainBase'];
-      }else{
-        $dn = $this->dn;
-      }
-    }
-    return($dn);
-  }
-
-
-  function getUsedFAItask($cn)
-  {
-    $ret = array();
-    foreach($this->SubObjects as $name => $class){
-      if($class['cn'] == $cn){
-        continue;
-      } 
-      if($class['status'] != "delete"){
-        $ret[$class['FAItask']] = $class['FAItask'];
-      }
-    }
-    return($ret);
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","fai/".get_class($this),$this->dn);
-    }
-
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-    $display= "";
-
-    /* New Listhandling
-     */
-    $once = true;
-    foreach($_POST as $name => $value){
-      if(preg_match("/^editscript_/",$name)&&($once)){
-        $once = false;
-        $entry = preg_replace("/^editscript_/","",$name);
-        $entry = base64_decode(preg_replace("/_.*/","",$entry));
-
-        $obj  = $this->SubObjects[$entry];
-        if($obj['status'] == "FreshLoaded"){
-          $obj  = $this->get_object_attributes($obj,$this->sub_Load_Later);
-        }
-
-        $this->dialog= new $this->subClassName($this->config,$this->dn,$obj);
-        $this->dialog->set_acl_base($this->acl_base_for_current_object($obj['dn']));
-        $this->dialog->set_acl_category("fai");
-
-        $_SESSION['objectinfo'] = $obj['dn'];
-        $this->dialog->parent = &$this;
-        $this->is_dialog=true;
-      }
-      if(preg_match("/^deletescript_/",$name)&&($once)){
-        $entry = preg_replace("/^deletescript_/","",$name);
-        $entry = base64_decode(preg_replace("/_.*/","",$entry));
-
-        $dn = $this->acl_base_for_current_object($this->SubObjects[$entry]['dn']);
-        $acl = $this->ui -> get_permissions($dn,"fai/faiScriptEntry")  ;
-
-        if(preg_match("/d/",$acl)){
-          $once = false;
-
-          $status = $this->SubObjects[$entry]['status'];
-          if($status == "edited" || $status == "FreshLoaded"){
-            $this->SubObjects[$entry]['status']= "delete";
-          }else{
-            unset($this->SubObjects[$entry]);
-          }
-        }
-      }
-    }
-
-    /* Edit entries via GET */
-    if(isset($_GET['act']) && isset($_GET['id'])){
-      if($_GET['act'] == "edit" && isset($this->SubObjects[$_GET['id']])){
-        $obj = $this->SubObjects[$_GET['id']];
-          if($obj['status'] == "FreshLoaded"){
-          $obj  = $this->get_object_attributes($obj,$this->sub_Load_Later);
-        }
-        $this->dialog= new $this->subClassName($this->config,$this->dn,$obj);
-        $this->dialog->acl = $this->acl;
-        $_SESSION['objectinfo'] = $obj['dn'];
-        $this->dialog->parent = &$this;
-        $this->is_dialog=true;
-      }
-    }
-
-    ///// Ende new list handling
-
-    /* Add new sub object */
-    if(isset($_POST['AddSubObject'])){
-
-      $c_dn = $this->acl_base_for_current_object($this->dn);
-      $this->dialog= new $this->subClassName($this->config,"new");
-      $this->dialog->set_acl_base($c_dn);
-      $this->dialog->set_acl_category("fai");
-      $this->dialog->parent = &$this;
-      $this->is_dialog=true;
-    }
-
-
-    /* Save Dialog */
-    if(isset($_POST['SaveSubObject'])){
-
-      /* Perform post check*/
-      $this->dialog->save_object();
-
-      /* Get messages */
-      $msgs = $this->dialog->check();
-
-      /* print errors */
-      if(count($msgs)>0){
-        foreach($msgs as $msg){
-          print_red($msg);
-        }
-      }else{
-
-        /* Get return object */
-        $obj = $this->dialog->save();
-        if(isset($obj['remove'])){
-
-          $old_stat = $this->SubObjects[$obj['remove']['from']]['status'];
-  
-          /* Depending on status, set new status */
-          if($old_stat == "edited" || $old_stat == "FreshLoaded"){
-            $this->SubObjects[$obj['remove']['from']]['status'] = "delete";
-          }elseif($this->SubObjects[$obj['remove']['from']]['status']=="new"){
-            unset($this->SubObjects[$obj['remove']['from']]);
-          }
-          $obj['status'] = "new";
-          $this->SubObjects[$obj['remove']['to']] = $obj;
-          unset($this->SubObjects[$obj['remove']['to']]['remove']);
-        }else{
-          if($obj['status'] == "FreshLoaded"){
-            $obj['status'] = "edited";
-          }
-          $this->SubObjects[$obj['cn']]=$obj;
-        }
-        $this->is_dialog=false;
-        unset($this->dialog);
-        $this->dialog=FALSE;
-      }
-    }
-
-    /* Sort entries */
-    $tmp = $keys = array();
-    foreach($this->SubObjects as $key => $entry){
-      $keys[$key]=$key;
-    }
-    natcasesort($keys);
-    foreach($keys as $key){
-      $tmp[$key]=$this->SubObjects[$key];
-    }
-    $this->SubObjects = $tmp;
-
-    /* Cancel Dialog */
-    if(isset($_POST['CancelSubObject'])){
-      $this->is_dialog=false; 
-      unset($this->dialog);
-      $this->dialog=FALSE;
-    }
-
-    /* Print dialog if $this->dialog is set */
-    if(is_object($this->dialog)){
-      $this->dialog->save_object();
-      $display = $this->dialog->execute();
-      return($display);
-    }
-
-
-
-    /* Divlist            added 28.02.2006
-       Containing FAIscripts
-     */
-
-    $divlist = new divSelectBox("FAIhooks");
-    $divlist->setHeight(400);
-
-    foreach($this->getList(true) as $key => $name){
-
-      $dn= $this->acl_base_for_current_object($name['dn']);
-      $acl = $this->ui->get_permissions($dn,"fai/faiHookEntry")  ;
-      $act = "";
-
-      /* Check if this object is freezed, in this case hide the delete icon */
-      if($this->FAIstate == "freeze"){
-        $act .= "<input type='image' src='images/edit.png'      name='editscript_%s'    title='"._("edit")."' alt='"._("edit")."'>";
-      }else{
-        $act .= "<input type='image' src='images/edit.png'      name='editscript_%s'    title='"._("edit")."' alt='"._("edit")."'>";
-        if(preg_match("/d/",$acl)){
-          $act .="<input type='image' src='images/edittrash.png' name='deletescript_%s'  title='"._("delete")."' alt='"._("delete")."'>";
-        }
-      }
-
-      /* Check if we are allowed to use the export button for this object */
-      $s_acl = $this->ui->get_permissions($dn,"fai/faiHookEntry","FAIscript")  ;
-      if(($this->SubObjects[$key]['status'] == "new") || ($this->SubObjects[$key]['dn'] == "new") || !preg_match("/r/",$s_acl)){
-        $down = "";
-      }else{
-        $down = "<a href='getFAIscript.php?id=".base64_encode($name['dn'])."'>
-          <img src='images/save.png' alt='"._("Download")."' title='"._("Download")."' border=0>
-          </a>";
-      }
-
-      /* Check if we are allowed to view the object */
-      $s_acl = $this->ui->get_permissions($dn,"fai/faiHookEntry","cn")  ;
-      if(preg_match("/r/",$s_acl)){
-
-        $edit_link = "<a href='?plug=".$_GET['plug']."&amp;act=edit&amp;id=".$key."'>".$name['name']."</a>";
-        $divlist->AddEntry(array( array("string"=>$edit_link),
-              array("string"=>$down , "attach" => "style='width:20px;'"),
-              array("string"=>str_replace("%s",base64_encode($key),$act),
-                "attach"=>"style='border-right: 0px;width:50px;text-align:right;'")));
-      }
-    }
-    $smarty->assign("Entry_divlist",$divlist->DrawList());
-    /* Divlist creation complete
-     */
-
-    $smarty->assign("SubObjects",$this->getList());
-
-    /* Magic quotes GPC, escapes every ' " \, to solve some security risks
-     * If we post the escaped strings they will be escaped again
-     */
-    foreach($this->attributes as $attrs){
-      if(get_magic_quotes_gpc()){
-        $smarty->assign($attrs,stripslashes($this->$attrs));
-      }else{
-        $smarty->assign($attrs,($this->$attrs));
-      }
-    }
-
-    $tmp = $this->plInfo();
-      
-    $c_dn = $this->acl_base_for_current_object($this->dn);
-    $smarty->assign("sub_object_is_addable", preg_match("/c/",$this->ui->get_permissions($c_dn,"fai/faiHookEntry")) && $this->FAIstate!="freeze");
-    foreach($tmp['plProvidedAcls'] as $name => $translation){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-
-    $display.= $smarty->fetch(get_template_path('faiHook.tpl', TRUE));
-    return($display);
-  }
-
-  /* Generate listbox friendly SubObject list
-   */
-  function getList($use_dns=false){
-    $a_return=array();
-    foreach($this->SubObjects as $obj){
-      if($obj['status'] != "delete"){
-        if($use_dns){
-          if((isset($obj['description']))&&(!empty($obj['description']))){
-            $a_return[$obj['cn']]['name']= $obj['cn']." [".stripslashes($obj['description'])."]";
-          }else{
-            $a_return[$obj['cn']]['name']= $obj['cn'];
-          }
-          $a_return[$obj['cn']]['dn']= $obj['dn'];
-        }else{
-          if((isset($obj['description']))&&(!empty($obj['description']))){
-            $a_return[$obj['cn']]= $obj['cn']." [".stripslashes($obj['description'])."]";
-          }else{
-            $a_return[$obj['cn']]= $obj['cn'];
-          }
-        }
-      }
-    }
-    return($a_return);
-  }
-
-
-  /* Delete me, and all my subtrees
-   */
-  function remove_from_parent()
-  {
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd ($this->dn);
-
-#    $use_dn = str_ireplace( get_release_dn($this->dn), $_SESSION['faifilter']['branch'], $this->dn);
-    $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $this->dn);
-    if($_SESSION['faifilter']['branch'] == "main"){
-      $use_dn = $this->dn;
-    }
-
-    prepare_to_save_FAI_object($use_dn,array(),true);
-
-    new log("remove","fai/".get_class($this),$use_dn,$this->attributes);
-
-    foreach($this->SubObjects as $name => $obj){
-#      $use_dn = str_ireplace( get_release_dn($this->dn), $_SESSION['faifilter']['branch'], $obj['dn']);
-      $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $obj['dn']);
-      if($_SESSION['faifilter']['branch'] == "main"){
-        $use_dn = $obj['dn'];
-      }
-      prepare_to_save_FAI_object($use_dn,array(),true);
-    }
-    $this->handle_post_events("remove");    
-  }
-
-
-  /* Save data to object 
-   */
-  function save_object()
-  {
-    if((isset($_POST['FAIhook_posted'])) && ($this->FAIstate != "freeze")){
-      plugin::save_object();
-      foreach($this->attributes as $attrs){
-        if(isset($_POST[$attrs])){
-          $this->$attrs = $_POST[$attrs];
-        }
-      }
-    }
-  }
-
-
-  /* Check supplied data */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    return ($message);
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    plugin::save();
-
-    $ldap = $this->config->get_ldap_link();
-
-    prepare_to_save_FAI_object($this->dn,$this->attrs);
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of FAI/hook with dn '%s' failed."),$this->dn));
-
-    if($this->initially_was_account){
-      new log("modify","fai/".get_class($this),$this->dn,$this->attributes);
-    }else{
-      new log("create","fai/".get_class($this),$this->dn,$this->attributes);
-    }
-
-    /* Do object tagging */
-    $this->handle_object_tagging();
-
-    $ldap->cd($this->dn);
-
-    /* Prepare FAIscriptEntry to write it to ldap
-     * First sort array.
-     *  Because we must delete old entries first.
-     * After deletion, we perform add and modify 
-     */
-    $Objects = array();
-
-    /* We do not need to save untouched objects */
-    foreach($this->SubObjects as $name => $obj){
-      if($obj['status'] == "FreshLoaded"){
-        unset($this->SubObjects[$name]);
-      }
-    }
-
-    foreach($this->SubObjects as $name => $obj){
-      if($obj['status'] == "delete"){
-        $Objects[$name] = $obj; 
-      }
-    }
-    foreach($this->SubObjects as $name => $obj){
-      if($obj['status'] != "delete"){
-        $Objects[$name] = $obj; 
-      }
-    }
-
-    foreach($Objects as $name => $obj){
-
-      foreach($this->sub64coded as $codeIt){
-        $obj[$codeIt]=base64_encode(stripslashes($obj[$codeIt]));
-      }
-
-      $tmp = array();
-      $attributes = array_merge($this->sub_Load_Later,$this->subAttributes);
-      foreach($attributes as $attrs){
-        if(empty($obj[$attrs])){
-          $obj[$attrs] = array();
-        }
-        if(!is_array($obj[$attrs])){
-          $tmp[$attrs] = stripslashes($obj[$attrs]);
-        }else{
-          $tmp[$attrs] = $obj[$attrs];
-        }
-      }    
-
-      $tmp['objectClass'] = $this->subClasses;
-
-      $sub_dn = "cn=".$obj['cn'].",".$this->dn;
-
-      if($obj['status']=="new"){
-        $ldap->cat($sub_dn,array("objectClass"));
-        if($ldap->count()){
-          $obj['status']="edited";
-        }
-      }
-
-      /* Check if gosaAdministrativeUnitTag is required as object class */
-      if($obj['status'] == "edited"){
-        $ldap->cat($sub_dn,array("objectClass"));
-        $attrs = $ldap->fetch();
-        if(isset($attrs['objectClass'])){
-          if(in_array_ics("gosaAdministrativeUnitTag",$attrs['objectClass'])){
-            $tmp['objectClass'][] = "gosaAdministrativeUnitTag";
-          }
-        }
-      }
-
-      if($obj['status'] == "delete"){
-        prepare_to_save_FAI_object($sub_dn,array(),true);
-        $this->handle_post_events("remove");
-      }elseif($obj['status'] == "edited"){
-        prepare_to_save_FAI_object($sub_dn,$tmp);
-        $this->handle_post_events("modify");
-      }elseif($obj['status']=="new"){
-        prepare_to_save_FAI_object($sub_dn,$tmp);
-        $this->handle_post_events("add");
-      }
-      $this->handle_object_tagging($sub_dn, $this->gosaUnitTag);
-    }
-  }
-
-
-  function PrepareForCopyPaste($source)
-  {
-    plugin::PrepareForCopyPaste($source);
-
-    /* Read all leaf objects of this object (For FAIscript this would be FAIscriptEntry)
-     */
-    $ldap     = $this->config->get_ldap_link();
-    $ldap->cd ($source['dn']);
-
-    $attrs_to_search = $this->subAttributes;
-    $attrs_to_search[] = "FAIstate";
-    $ldap->search("(&(objectClass=FAIclass)(objectClass=".$this->subClass."))",$attrs_to_search);
-
-    while($object = $ldap->fetch()){
-
-      /* Skip objects, that are tagged as removed */
-      if(isset($object['FAIstate'][0])){
-        if(preg_match("/removed$/",$object['FAIstate'][0])){
-          continue;
-        }
-      }
-
-      /* Set status for save management */
-      $objects = array();
-      $objects['status']      = "edited";
-      $objects['dn']          = $object['dn'];
-      $objects                = $this->get_object_attributes($objects,$this->subAttributes);
-      $objects                = $this->get_object_attributes($objects,$this->sub_Load_Later);
-
-      $this->SubObjects[$objects['cn']] = $objects;
-    }
-  }
-
-
-  /* Return plugin informations for acl handling */ 
-  static function plInfo()
-  {
-    return (array( 
-          "plShortName" => _("Hook"),
-          "plDescription" => _("FAI hook"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 20,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("fai"),
-          "plProvidedAcls" => array(
-            "cn"                => _("Name")." ("._("Read only").")",
-            "description"       => _("Description"))
-          ));
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/fai/class_faiHookEntry.inc b/plugins/admin/fai/class_faiHookEntry.inc
deleted file mode 100644 (file)
index 84b326e..0000000
+++ /dev/null
@@ -1,206 +0,0 @@
-<?php
-
-class faiHookEntry 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","description","FAIscript","FAItask");
-  var $objectclasses= array();
-
-  var $orig_cn              = "";
-  var $tasks                = array("chboot", "configure", "debconf", "extrbase", "faiend", "finish",
-                                    "install", "instsoft", "mirror", "mountdisks", "partition", "prepareapt",
-                                    "savelog", "softupdate", "sysinfo","updatebase");
-  var $dn            = "";
-  var $cn            = "";
-  var $FAItask       = "chboot";
-  var $FAIscript     = "";
-  var $description   = "";
-  var $status        = "new";
-  var $parent        = NULL;
-  var $FAIstate      = "";
-  
-  function faiHookEntry (&$config, $dn= NULL,$object=false)
-  {
-    plugin::plugin ($config, $dn);
-    if($dn != "new"){
-      $this->orig_cn= $object['cn'];
-      $this->dn=$object['dn'];
-      foreach($object as $name=>$value){
-        $oname = $name;
-        $this->$oname=$value;
-      }
-
-      if(isset($this->attrs['FAIstate'][0])){
-        $this->FAIstate = $this->attrs['FAIstate'][0];
-      }
-
-    }elseif(is_array($object)){
-      if(count($object)){
-        $this->orig_cn= $object['cn'];
-        $this->dn=$object['dn'];
-        foreach($object as $name=>$value){
-          $oname = $name;
-          $this->$oname=$value;
-        }
-      }else{
-
-        $this->status = "new";
-        $this->orig_cn       = false;
-      }
-    }
-  }
-
-
-  function execute()
-  {
-       /* Call parent execute */
-       plugin::execute();
-
-    /* Fill templating stuff */
-    $smarty     = get_smarty();
-    $display = "";
-        
-    if(isset($_POST['ImportUpload'])){
-      if(($_FILES['ImportFile']['error']!=0)){
-        print_red(_("Please select a valid file."));
-      }else
-      if(($_FILES['ImportFile']['size']==0)){
-        print_red(_("Selected file is empty."));
-      }else{
-        $str = utf8_encode(file_get_contents($_FILES['ImportFile']['tmp_name']));
-        $this->FAIscript = $str;
-      }
-    }
-
-    /* Create download button*/
-    if($this->dn != "new" && $this->acl_is_readable("FAIscript")){
-      $smarty->assign("DownMe","<a href='getFAIscript.php?id=".base64_encode($this->dn)."'>
-          <img src='images/save.png' alt='"._("Download")."' title='"._("Download")."' border=0 class='center'>
-        </a>");
-    }else{
-      $smarty->assign("DownMe","");  
-    }
-
-    $used_tasks = $this->parent->getUsedFAItask($this->cn);
-    $tasks = $this->tasks;
-    foreach($this->tasks as $id => $task){
-      if(in_array($task,$used_tasks)){
-        unset($tasks[$id]);
-      }
-    }
-    $smarty->assign("tasks", $tasks);
-
-     /* Magic quotes GPC, escapes every ' " \, to solve some security risks
-     * If we post the escaped strings they will be escaped again
-     */
-    foreach($this->attributes as $attrs){
-      if(get_magic_quotes_gpc()){
-        $smarty->assign($attrs,(stripslashes($this->$attrs)));
-      }else{
-        $smarty->assign($attrs,($this->$attrs));
-      }
-    }
-
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translated){
-      $acl = $this->getacl($name);
-      if($this->FAIstate == "freezed"){
-        $acl = preg_replace("/w/","",$acl);
-      }
-      $smarty->assign($name."ACL",$acl);
-    }
-   
-    if(get_magic_quotes_gpc()){
-      $smarty->assign("FAIscript" , htmlentities(stripslashes($this->FAIscript)));
-    }else{
-      $smarty->assign("FAIscript" , htmlentities($this->FAIscript));
-    }
-    $display.= $smarty->fetch(get_template_path('faiHookEntry.tpl', TRUE));
-    return($display);
-  }
-
-  /* Save data to object */
-  function save_object()
-  {
-    if((isset($_POST['SubObjectFormSubmitted'])) && ($this->FAIstate != "freeze")){
-      foreach($this->attributes as $attrs){
-        if($this->acl_is_writeable($attrs)){
-          if(isset($_POST[$attrs])){
-            $this->$attrs = $_POST[$attrs];
-          }else{
-            $this->$attrs = "";
-          }
-        }
-      }
-    }
-  }
-
-  /* Check supplied data */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    if(isset($this->parent->SubObjects[$this->cn]) && $this->cn != $this->orig_cn){
-      $message[] =_("There is already a hook with the given name.");
-    }
-
-    if(empty($this->FAIscript)) {
-      $message[]=_("Please enter a value for script.");
-    }
-
-    if(empty($this->cn)){
-      $message[] = _("Please enter a name.");
-    }
-
-    return ($message);
-  }
-  function save()
-  {
-    $tmp=array();
-    foreach($this->attributes as $attrs){ 
-      $tmp[$attrs] = $this->$attrs;
-    }
-
-    /* Strip out dos newlines */
-    $tmp['FAIscript']= strtr($this->FAIscript, array("\x0D" => ""));
-
-    if(($this->orig_cn)&&($tmp['cn']!=$this->orig_cn)){
-      $tmp['remove']['from']  = $this->orig_cn;
-      $tmp['remove']['to']    = $tmp['cn'];
-    }
-  
-    $tmp['dn']      = $this->dn;  
-    $tmp['status']  = $this->status;  
-    return($tmp);
-  }
-
-    /* Return plugin informations for acl handling */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName" => _("Hook entry"),
-          "plDescription" => _("FAI hook entry"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 21,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("fai"),
-          "plProvidedAcls" => array(
-            "cn"                => _("Name"),
-            "description"       => _("Description"),
-            "FAItask"           => _("Task"),
-            "FAIscript"         => _("FAI script"))
-          ));
-  }
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/fai/class_faiManagement.inc b/plugins/admin/fai/class_faiManagement.inc
deleted file mode 100644 (file)
index b9c0271..0000000
+++ /dev/null
@@ -1,1156 +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 faiManagement extends plugin
-{
-       /* Definitions */
-       var $plHeadline                 = "FAI";
-       var $plDescription              = "Fully Automatic Installation - management";
-
-       /* CLI vars */
-       var $cli_summary                  = "Handling of FAI entries";
-       var $cli_description    = "This plugin represents a management tool\n
-               which allows us to manage all needed attributes for fully automatic installations (FAI)";
-       var $cli_parameters             = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-       /* Headpage attributes */
-  var $lock_type    = "";    // should be branch/freeze
-  var $lock_name    = "";
-  var $lock_dn      = "";  
-
-       /* attribute list for save action */
-       var $attributes         = array("lock_type","lock_name","lock_dn");     //      Attributes Managed by this plugin 
-       var $objectclasses= array();    //      ObjectClasses which the attributes are related to
-       var $dialog                             = array();      //      This object contains every dialog we have currently opened
-
-       var $objects                    = array();      //      This array contains all available objects shown in divlist
-       var $is_dialog          = false;
-
-  var $dispNewBranch= false;
-  var $dispNewFreeze= false;
-
-  var $DivListFai;
-  var $start_pasting_copied_objects = FALSE;
-  var $CopyPasteHandler = FALSE;
-  var $base = "";
-
-       /* construction/reconstruction 
-        */
-       function faiManagement (&$config, $ui)
-       {
-               /* Set defaults */
-               $this->dn                       = "";
-               $this->config   = $config;
-               $this->ui                       = $ui;  
-    
-    /* Creat dialog object */
-    $this->DivListFai = new divListFai($this->config,$this);
-
-    /* Copy & Paste handler */
-    if ($this->config->boolValueIsTrue("main", "enableCopyPaste")){
-      $this->CopyPasteHandler= new CopyPasteHandler($this->config);
-    }
-       }
-
-       function execute()
-       {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* Initialise vars and smarty */
-               $smarty         = get_smarty();
-               $smarty->assign("BranchName","");
-    
-               $display        = "";
-    $s_action  = "";
-               $s_entry        = "";
-    
-    /* If an entry was locked, these vars will be stored in a session to allow direct edit */
-    $_SESSION['LOCK_VARS_TO_USE'] = array("/^edit_entry$/","/^id$/","/^entry_edit_/","/^entry_delete_/","/^item_selected/","/^remove_multiple_fai_objects/");
-
-
-    /****************
-      Handle posts 
-     ****************/
-
-               /* Check ImageButton posts
-                * Create new tab ich new_xx is posted
-                */
-    $posts = array( "/remove_branch/"=>"remove_branch",    "/branch_branch/"=>"branch_branch",
-                    "/freeze_branch/"=>"freeze_branch",    "/create_partition/i"=>"new_partition",
-                    "/create_script/i"=>"new_script",      "/create_hook/i"=>"new_hook",
-                    "/create_variable/i"=>"new_variable",  "/create_template/i"=>"new_template",
-                    "/create_package/i"=>"new_package",    "/create_profile/i"=>"new_profile",
-                    "/edit_continue/"=>"select_class_name_finished",
-                    "/^multiple_copy_fai/" => "copy_multiple", 
-                    "/^multiple_cut_fai/" => "cut_multiple", 
-                    "/^copy/" => "copy",
-                    "/^cut/" => "cut",
-                    "/^remove_multiple_fai_objects/" => "del_multiple");
-
-               foreach($_POST as $name => $value){
-      foreach($posts as $reg => $act ){
-        if(preg_match($reg,$name)){
-          $s_action = $act;
-          $s_entry = ltrim(preg_replace($reg,"",$name),"_");
-          $s_entry = preg_replace("/_.*$/","",$s_entry);
-        }
-      }
-                       if(preg_match("/^entry_edit_.*/",$name)){
-                               $s_entry = preg_replace("/^entry_edit_/","",$name);
-                               $s_entry = preg_replace("/_.*$/","",$s_entry);
-                               $s_action = "edit";
-                       }elseif(preg_match("/^entry_delete_.*/",$name)){
-                               $s_entry = preg_replace("/^entry_delete_/","",$name);
-                               $s_entry = preg_replace("/_.*$/","",$s_entry);
-        $s_action = "delete";
-      }
-    }
-
-               if(isset($_GET['edit_entry'])){
-                       $s_entry = $_GET['edit_entry'];
-                       $s_action = "edit";
-               }
-
-    if(isset($_GET['act']) && $_GET['act'] == "freeze_branch"){
-      $s_action = "freeze_branch";
-    }
-    if(isset($_GET['act']) && $_GET['act'] == "branch_branch"){
-      $s_action = "branch_branch";
-    }
-    if(isset($_GET['act']) && $_GET['act'] == "remove_branch"){
-      $s_action = "remove_branch";
-    }
-    
-    if((isset($_POST['CancelBranchName'])) || (isset($_POST['CloseIFrame']))){
-      $this->dispNewBranch = false;
-      $this->dispNewFreeze = false;
-    }
-
-
-    $type_acl_mapping = array(
-        "FAIpartitionTable"  => "faiPartitionTable", 
-        "FAIpackageList"     => "faiPackage",
-        "FAIscript"          => "faiScript",
-        "FAIvariable"        => "faiVariable",
-        "FAIhook"            => "faiHook",
-        "FAIprofile"         => "faiProfile",
-        "FAItemplate"        => "faiTemplate");
-
-
-    /* handle C&P from layers menu */
-    if(isset($_POST['menu_action']) && preg_match("/^multiple_copy_systems/",$_POST['menu_action'])){
-      $s_action = "copy_multiple";
-    }
-    if(isset($_POST['menu_action']) && preg_match("/^multiple_cut_systems/",$_POST['menu_action'])){
-      $s_action = "cut_multiple";
-    }
-    if(isset($_POST['menu_action']) && preg_match("/^editPaste/",$_POST['menu_action'])){
-      $s_action = "editPaste";
-    }
-
-    /* Create options */
-    if(isset($_POST['menu_action']) && preg_match("/^Create_/",$_POST['menu_action'])){
-      $s_action = "new_".preg_replace("/^Create_/","",$_POST['menu_action']);;
-      $s_entry  = preg_replace("/^Create_/","",$_POST['menu_action']);
-    }
-
-    /* handle remove from layers menu */
-    if(isset($_POST['menu_action']) && preg_match("/^remove_multiple/",$_POST['menu_action'])){
-      $s_action = "del_multiple";
-    }
-
-    /********************
-      Copy & Paste
-     ********************/
-
-    /* Display the copy & paste dialog, if it is currently open */
-    $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
-    if($ret){
-      return($ret);
-    }
-
-
-    /****************
-      Delete confirme dialog 
-     ****************/
-
-               if ($s_action=="delete"){
-
-      /* Get 'dn' from posted termlinst */
-      $this->dn= $this->objects[$s_entry]['dn'];
-
-                       /* Load permissions for selected 'dn' and check if
-                          we're allowed to remove this 'dn' */
-      $acl  = $this->ui->get_permissions($this->dn,"fai/".$type_acl_mapping[$this->objects[$s_entry]['type']]);
-      if(preg_match("/d/",$acl)){
-
-                               /* Check locking, save current plugin in 'back_plugin', so the dialog knows where to return. */
-                               if (($user= get_lock($this->dn)) != ""){
-                                       return(gen_locked_message ($user, $this->dn));
-                               }
-
-                               /* Lock the current entry, so nobody will edit it during deletion */
-                               add_lock ($this->dn, $this->ui->dn);
-                               $smarty->assign("warning", sprintf(_("You're about to delete all information about the FAI class at '%s'."), @LDAP::fix($this->dn)));
-        $smarty->assign("multiple", false);
-                               return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
-                       } else {
-
-                               /* Obviously the user isn't allowed to delete. Show message and
-                                  clean session. */
-                               print_red (_("You are not allowed to delete this component!"));
-                       }
-               }
-
-
-    /********************
-      Delete MULTIPLE entries requested, display confirm dialog
-     ********************/
-
-    if ($s_action=="del_multiple"){
-      $this->dns = array();
-      $ids = $this->list_get_selected_items();
-
-      if(count($ids)){
-
-        foreach($ids as $id){
-          $dn = $this->objects[$id]['dn'];
-          if (($user= get_lock($dn)) != ""){
-            return(gen_locked_message ($user, $dn));
-          }
-          $this->dns[$id] = $dn;
-        }
-
-        $dns_names = "<br><pre>";
-        foreach($this->dns as $dn){
-          add_lock ($dn, $this->ui->dn);
-          $dns_names .= $dn."\n";
-        }
-        $dns_names .="</pre>";
-
-        /* Lock the current entry, so nobody will edit it during deletion */
-        if (count($this->dns) == 1){
-          $smarty->assign("warning",     sprintf(_("You're about to delete the following entry %s"), @LDAP::fix($dns_names)));
-        } else {
-          $smarty->assign("warning",     sprintf(_("You're about to delete the following entries %s"), @LDAP::fix($dns_names)));
-        }
-        $smarty->assign("multiple", true);
-        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
-      }
-    }
-
-
-    /********************
-      Delete MULTIPLE entries confirmed
-     ********************/
-
-    /* Confirmation for deletion has been passed. Users should be deleted. */
-    if (isset($_POST['delete_multiple_fai_object_confirm'])){
-
-      /* Find out more about the object type */
-      $ldap   = $this->config->get_ldap_link();
-
-      /* Remove user by user and check acls before removeing them */
-      foreach($this->dns as $key => $dn){
-
-        $ldap->cat($dn, array('objectClass'));
-        $attrs  = $ldap->fetch();
-        $type   = $this->get_type($attrs);
-
-        $acl  = $this->ui->get_permissions($dn,"fai/".$type[1]);
-        if(preg_match("/d/",$acl)){
-
-          $this->dialog = new $type[0]($this->config, $this->config->data['TABS'][$type[2]], $dn,"fai");
-          $this->dialog->set_acl_base($dn);
-          $this->dialog->by_object[$type[1]]->remove_from_parent ();
-          unset ($this->dialog);
-          $this->dialog= FALSE;
-          $to_del = clean_up_releases($dn);
-          save_release_changes_now();
-
-          foreach($to_del as $dn){
-            $ldap->rmdir_recursive($dn);
-          }
-
-        } else {
-
-          /* Normally this shouldn't be reached, send some extra
-             logs to notify the administrator */
-          print_red (_("You are not allowed to delete this component!"));
-          new log("security","fai/".get_class($this),$dn,array(),"Tried to trick deletion.");
-        }
-
-        /* Remove lock file after successfull deletion */
-        del_lock ($dn);
-        unset($this->dns[$key]);
-      }
-    }
-
-
-    /********************
-      Delete MULTIPLE entries Canceled
-     ********************/
-
-    /* Remove lock */
-    if(isset($_POST['delete_multiple_fai_object_cancel'])){
-      foreach($this->dns as $key => $dn){
-        del_lock ($dn);
-        unset($this->dns[$key]);
-      }
-    }
-
-
-    /****************
-      Delete aborted  
-     ****************/
-
-               /* Delete canceled? */
-               if (isset($_POST['delete_cancel'])){
-                       del_lock ($this->dn);
-               }
-
-
-    /****************
-      Delete confirmed 
-     ****************/
-
-               /* Deltetion was confirmed, so delete this entry
-     */
-    if (isset($_POST['delete_terminal_confirm'])){
-
-      /* Some nice guy may send this as POST, so we've to check
-         for the permissions again. */
-
-      /* Find out more about the object type */
-      $ldap      = $this->config->get_ldap_link();
-      $ldap->cat($this->dn, array('objectClass'));
-      if($ldap->count()){
-        $attrs = $ldap->fetch();
-        $type    = $this->get_type($attrs);                    
-
-        $acl  = $this->ui->get_permissions($this->dn,"fai/".$type[1]);
-        if(preg_match("/d/",$acl)){
-
-          $this->dialog = new $type[0]($this->config,  $this->config->data['TABS'][$type[2]], $this->dn,"fai");
-          $this->dialog->set_acl_base($this->dn);
-          $this->dialog->by_object[$type[1]]->remove_from_parent ();
-          unset ($this->dialog);
-          $this->dialog= FALSE;
-          $to_del = clean_up_releases($this->dn);
-          save_release_changes_now();
-
-          foreach($to_del as $dn){
-            $ldap->rmdir_recursive($dn);
-          }
-
-        } else {
-
-          /* Normally this shouldn't be reached, send some extra
-             logs to notify the administrator */
-          print_red (_("You are not allowed to delete this component!"));
-          new log("security","fai/".get_class($this),$dn,array(),"Tried to trick deletion.");
-        }
-
-      }else{
-        print_red(sprintf(_("Object could not be deleted '%s', object does not exist."),$this->dn));
-      }
-      /* Remove lock file after successfull deletion */
-      del_lock ($this->dn);
-    }
-
-
-    /****************
-      Edit entry 
-     ****************/
-
-               if(($s_action == "edit") && (!isset($this->dialog->config))){
-                       $entry    = $this->objects[$s_entry];
-                       $a_setup  = $this->get_type($entry);
-                       $this->dn = $entry['dn'];
-
-                       /* Check locking, save current plugin in 'back_plugin', so the dialog knows where to return. */
-                       if (($user= get_lock($this->dn)) != ""){
-                               return(gen_locked_message ($user, $this->dn));
-                       }
-                       add_lock ($this->dn, $this->ui->dn);
-
-                       $this->dialog     = new $a_setup[0]($this->config,$this->config->data['TABS'][$a_setup[2]],$this->dn,"fai");
-      $this->dialog->set_acl_base($this->dn);
-                       $this->is_dialog  = true;
-
-      if($entry['FAIstate'] == "freeze"){
-        #$this->dialog->set_acl(array("*none*"))  ;    
-        echo "Dawn it is freezed.";
-      }
-                       $_SESSION['objectinfo'] = $this->dn;
-               }
-
-
-    /*  Branch handling 
-        09.01.2006
-    */
-
-    /****************
-      Remove branch
-     ****************/
-
-    /* Remove branch 
-     */
-    if($s_action == "remove_branch"){
-      $base= $this->DivListFai->selectedBranch;
-
-      /* Check if we have a post remove method configured
-       *  else skip this operation. (Skip:Button in the ui should be disabled in this case too)
-       */
-      if("" != $this->config->search("faiManagement", "POSTREMOVE",array('menu','tabs'))){
-        /* Load permissions for selected 'dn' and check if
-           we're allowed to remove this 'dn' */
-        if($this->acl_is_removeable()){
-
-          $smarty->assign("info", sprintf(_("You're about to delete a fai branch / freeze  '%s'."), $this->DivListFai->selectedBranch));
-          return($smarty->fetch(get_template_path('remove_branch.tpl',TRUE)));
-        } else {
-          print_red (_("You are not allowed to delete this release!"));
-        }
-      }
-    }
-
-    
-    /****************
-      Remove branch confirmed
-     ****************/
-
-    if(isset($_POST['delete_branch_confirm'])){
-
-      /* Check if we have a post remove method configured
-       *  else skip this operation. (Skip:Button in the ui should be disabled in this case too)
-       */
-      if("" != $this->config->search("faiManagement", "POSTREMOVE",array('menu','tabs'))){
-
-        $bb =  $this->DivListFai->selectedBranch;
-        if(!isset($ldap)){
-          $ldap = $this->config->get_ldap_link();
-        }
-
-        $br = $this->getBranches();
-
-        if(isset($br[$bb]) && $this->acl_is_removeable()){
-          $name = $br[$bb];
-          $ldap->cd($bb);
-          $ldap->recursive_remove();
-          $ldap->cd(preg_replace('/,ou=fai,ou=configs,ou=systems,/', ',ou=apps,', $bb));
-          $ldap->recursive_remove();
-          $this->DivListFai->selectedBranch = "main";
-
-          /* Post remove */
-          $this->lock_name   = $name;
-          $this->lock_dn     = $bb;
-          $this->postremove();
-
-          new log("remove","fai/".get_class($this),$br[$bb],array(),"Release removed");
-        }
-      }
-    }
-
-
-    /****************
-      Create a new branch "insert Name"
-     ****************/
-
-    if((isset($_POST['UseBranchName']))&&(($this->dispNewBranch)||($this->dispNewFreeze))){
-      $_SESSION['LASTPOST'] = $_POST;
-
-      if($this->dispNewBranch){
-        $type = "branch";
-      }else{
-        $type = "freeze";
-      }
-
-      /* Check branch name */
-      $name = $_POST['BranchName'];
-      $is_ok = true;
-      $smarty->assign("BranchName",$name);
-      $base= "ou=fai,ou=configs,ou=systems,".$this->DivListFai->selectedBase;
-
-      /* Check used characters */
-      if(preg_match("/[^0-9a-z \ö\ä\ü\.-_:,]/i",$name)){
-        if($type == "branch"){
-          print_red(_("Specified branch name is invalid."));
-        }else{
-          print_red(_("Specified freeze name is invalid."));
-        }
-        $is_ok = false;
-      }
-
-      /* Check if this name is already in use */
-      if(!$this->CheckNewBranchName($_POST['BranchName'],$this->DivListFai->selectedBranch)){
-        print_red(_("This name is already in use."));
-        $is_ok = false;
-      }
-
-      if($is_ok){
-        $_SESSION['LASTPOST']['base'] = $base;
-        $_SESSION['LASTPOST']['type'] = $type;
-        $smarty->assign("iframe", true);
-        $smarty->assign("plugID", $_GET['plug']);
-        $display       = $smarty->fetch(get_template_path('faiNewBranch.tpl', TRUE, dirname(__FILE__)));
-        return($display);
-      }
-    }
-
-
-    /****************
-      Create a new branch 
-     ****************/
-
-    if(isset($_GET['PerformBranch'])){
-    
-      if(!$this->acl_is_createable()){
-        print_red(_("You are not allowed to create a new branch."));
-      }else{
-
-        /* Create it know */
-        $this->dispNewBranch = false;
-        $this->dispNewFreeze = false;
-        $base = $_SESSION['LASTPOST']['base'];
-        $_POST = $_SESSION['LASTPOST'];      
-        $name = $_POST['BranchName'];
-
-        $type = $_SESSION['LASTPOST']['type'];
-        $ldap = $this->config->get_ldap_link();
-
-        $baseToUse = $base;
-        if($this->DivListFai->selectedBranch != "main" ){
-          $baseToUse = $this->DivListFai->selectedBranch;
-        }
-
-        /* Create new Release name to be able to set faidebianRelease for FAIpackageList */
-
-        $CurrentReleases  = $this->getBranches();
-        $NewReleaseName   = $name;
-        if(isset($CurrentReleases[$this->DivListFai->selectedBranch])) {
-          if($this->DivListFai->selectedBranch != "main"){
-            $NewReleaseName = $CurrentReleases[$this->DivListFai->selectedBranch]."/".$name;
-            $NewReleaseName = preg_replace("#\/#","/",$NewReleaseName); 
-          }else{
-            $NewReleaseName   = $name;
-          }
-        }
-
-        $appsrc = preg_replace("/ou=fai,ou=configs,ou=systems,/","ou=apps,",$baseToUse); 
-        $appdst = preg_replace("/ou=fai,ou=configs,ou=systems,/","ou=apps,","ou=".$name.",".$baseToUse) ; 
-
-        $mimesrc = preg_replace("/ou=fai,ou=configs,ou=systems,/","ou=mime,",$baseToUse); 
-        $mimedst = preg_replace("/ou=fai,ou=configs,ou=systems,/","ou=mime,","ou=".$name.",".$baseToUse) ; 
-
-        /* Check if source depeartments exist */
-        foreach(array($baseToUse,$appsrc,$mimesrc) as $dep){
-          $ldap->cd($this->config->current['BASE']);
-          $ldap->cat($dep);
-          if(!$ldap->count()){
-            $ldap->create_missing_trees($dep);
-          }
-        }
-
-        /* Print header to have styles included */
-        echo '  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
-          <html>
-          <head>
-          <title></title>
-          <style type="text/css">@import url("themes/default/style.css");</style>
-          <script language="javascript" src="include/focus.js" type="text/javascript"></script>
-          </head>
-          <body style="background: none;margin:3px;color:black">
-          ';
-
-        new log("create","fai/".get_class($this),$NewReleaseName,array(),"New $type created");
-
-        /* Duplicate applications 
-         */
-        $ldap->cat($appsrc,array("dn")) ;
-        if($ldap->count()){
-          $ldap->cd ($appdst);
-          $ldap->recursive_remove();
-          $ldap->cd ($this->config->current['BASE']);
-          $ldap->copy_FAI_resource_recursive($appsrc,$appdst,$NewReleaseName,$type,true);
-        }
-
-        /* Duplicate mime types 
-         */
-        $ldap->cat($mimesrc,array("dn")) ;
-        if($ldap->count()){
-          $ldap->cd ($mimedst);
-          $ldap->recursive_remove();
-          $ldap->cd ($this->config->current['BASE']);
-          $ldap->copy_FAI_resource_recursive($mimesrc,$mimedst,$NewReleaseName,$type,true);
-        }
-
-        $attr = array();
-        $attr['objectClass'] = array("organizationalUnit","FAIbranch");
-        $attr['ou']       = $name;
-        $attr['FAIstate'] = $type;
-        $ldap->cd($this->config->current['BASE']);
-        $ldap->cd("ou=".$name.",".$baseToUse);
-        $ldap->cat("ou=".$name.",".$baseToUse);
-        if($ldap->count()){
-          $ldap->modify($attr);
-        }else{
-          $ldap->add($attr);
-        }
-
-        /* Duplicate fai objects 
-         */
-        //      $ldap->cd ("ou=".$name.",".$baseToUse);
-        //      $ldap->recursive_remove();
-        //      $ldap->cd ($this->config->current['BASE']);
-        //      $ldap->copy_FAI_resource_recursive($baseToUse,"ou=".$name.",".$baseToUse,$NewReleaseName,$type,true);
-
-        echo "<div style='width:100%;text-align:right;'><form name='form' method='post' action='?plug=".$_GET['plug']."' target='_parent'>
-          <br><input type='submit' name='CloseIFrame' value='"._("Continue")."'>
-          </form></div>";
-
-        echo "<script language=\"javascript\" type=\"text/javascript\">scrollDown2();</script>" ;
-
-        /* Print footer to have valid html */
-        echo "</body></html>";
-
-        $this->dispNewFreeze = false; 
-
-        /* Postcreate */ 
-
-        /* Assign possible attributes */
-        $this->lock_type  = $type; 
-        $this->lock_name  = $name; 
-        $this->lock_dn    = $baseToUse;
-        $this->postcreate();
-        exit();
-      }
-    }
-
-    /****************
-      Display dialog to enter new Branch name
-     ****************/
-
-    /* Check if we have a post create method configured
-     *  else skip this operation. (Skip:Button in the ui should be disabled in this case too)
-     */
-    if("" != $this->config->search("faiManagement", "POSTCREATE",array('menu','tabs'))){
-      if(($s_action == "branch_branch")||($this->dispNewBranch)){
-        if(!$this->acl_is_createable()){
-          print_red(_("You are not allowed to create a new branch."));
-        }else{
-          $this->dispNewBranch=true;
-          $smarty->assign("iframe",false);
-          $display     .= $smarty->fetch(get_template_path('faiNewBranch.tpl', TRUE, dirname(__FILE__)));
-          return($display);
-        }
-      } 
-    }
-
-    /****************
-      Display dialog to enter new Freeze name
-     ****************/
-
-    /* Check if we have a post create method configured
-     *  else skip this operation. (Skip:Button in the ui should be disabled in this case too)
-     */
-    if("" != $this->config->search("faiManagement", "POSTCREATE",array('menu','tabs'))){
-      if(($s_action == "freeze_branch")||($this->dispNewFreeze)){
-        if(!$this->acl_is_createable()){
-          print_red(_("You are not allowed to create a new branch."));
-        }else{
-          $this->dispNewFreeze = true;
-          $smarty->assign("iframe",false);
-          $display     .= $smarty->fetch(get_template_path('faiNewBranch.tpl', TRUE, dirname(__FILE__)));
-          return($display);
-        }
-      }
-    }
-
-
-    /****************
-      Create a new object 
-     ****************/
-
-    $types = array( "new_partition"     =>  "FAIpartitionTable",
-                    "new_script"        =>  "FAIscript",
-                    "new_hook"          =>  "FAIhook",
-                    "new_variable"      =>  "FAIvariable",
-                    "new_template"      =>  "FAItemplate",
-                    "new_package"       =>  "FAIpackageList");
-
-    if(isset($types[$s_action])){
-      $acl = $this->ui->get_permissions($this->DivListFai->selectedBase,"fai/".$type_acl_mapping[$types[$s_action]]);
-      if(preg_match("/c/",$acl)){
-        $this->dialog = new askClassName($this->config,$this->dn,$this->ui,$types[$s_action]);
-      }else{
-        print_red(sprintf(_("You are not allowed to create a new '%s' object."),$types[$s_action]));
-      }
-    }
-
-    /* New Profile */
-    if($s_action == "new_profile"){
-      $this->dn = "new" ;
-
-      $acl = $this->ui->get_permissions($this->DivListFai->selectedBase,"fai/faiProfile");
-      if(preg_match("/c/",$acl)){
-        $a_setup= $this->get_type(array("objectClass"=>array("FAIprofile")));
-        $this->dialog = new $a_setup[0]($this->config,$this->config->data['TABS'][$a_setup[2]],$this->dn,"fai");
-        $this->dialog->set_acl_base($this->base);
-
-        $this->is_dialog = false;
-      }else{
-        print_red(sprintf(_("You are not allowed to create a new '%s' object."),"FAIprofile"));
-      }
-    }
-
-
-    /****************
-      Get from ask class name dialog 
-     ****************/
-
-    if($s_action == "select_class_name_finished"){
-      $this->dialog->save_object();
-      if(count($this->dialog->check())!=0){
-        foreach($this->dialog->check() as $msg){
-          print_red($msg);
-        }              
-      }elseif(isset($this->dialog->objectClass)){
-        $this->dn = "new" ;
-        $a_setup= $this->get_type(array("objectClass"=>array($this->dialog->objectClass)));
-        $name = $this->dialog->save();
-
-        if(class_exists($a_setup[0])){
-          $this->dialog = new $a_setup[0]($this->config,$this->config->data['TABS'][$a_setup[2]],$this->dn,"fai");
-          $this->dialog->set_acl_base($this->base);
-          $this->dialog->by_object[$a_setup[1]]->cn = $name;
-          $this->is_dialog = true;
-        }
-      }                
-    }  
-
-
-    /****************
-     Cancel dialogs 
-     ****************/
-
-               if(isset($_POST['edit_cancel'])){
-                       unset($this->dialog);
-                       $this->dialog=FALSE;
-                       $this->is_dialog = false;
-                       unset($_SESSION['objectinfo']);
-                       del_lock ($this->dn);
-               }
-
-
-    /****************
-      Save sub dialogs 
-     ****************/
-
-               /* This check if the given tab could be saved 
-                * If it was possible to save it, remove dialog object. 
-                * If it wasn't possible, show errors and keep dialog.
-                */
-               if((isset($_POST['edit_finish']) || isset($_POST['edit_apply'])) && (isset($this->dialog->config))){
-                       $this->dialog->save_object();
-      $msgs= $this->dialog->check();
-                       if(count($msgs)!=0){
-                               foreach($msgs as $msg){
-                                       print_red($msg);
-                               }
-                       }else{
-                               $this->dialog->save();
-        save_release_changes_now();
-        if (!isset($_POST['edit_apply'])){
-          del_lock ($this->dn);
-          unset($this->dialog);
-          $this->dialog=FALSE;
-          $this->is_dialog=false;
-          unset($_SESSION['objectinfo']);
-        }
-                       }
-               }
-
-
-    /****************
-      Display currently open dialog 
-     ****************/
-
-               /* If dialog is set, but $this->is_dialog==false, then 
-                *  only the "abort" button is shown, this are dialogs that must not be saved.  
-                * If is_dialog == true, we are currently editing tab objects.
-                *  Here we need both, save and cancel
-                */ 
-
-               if(is_object($this->dialog)){
-                       $display .= $this->dialog->execute();
-                       /* Don't show buttons if tab dialog requests this */
-
-      if(isset($this->dialog->current)){
-
-        $obj = $this->dialog->by_object[$this->dialog->current];
-
-        if((isset($obj->is_dialog) && (!$obj->is_dialog)) || (isset($obj->dialog) && (!$obj->dialog))){
-
-          $display.= "<p style=\"text-align:right\">\n";
-          $display.= "<input type=\"submit\" name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
-          $display.= "&nbsp;\n";
-          if ($this->dn != "new"){
-            $display.= "<input type=submit name=\"edit_apply\" value=\""._("Apply")."\">\n";
-            $display.= "&nbsp;\n";
-          }
-          $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
-          $display.= "</p>";
-        }elseif(!isset($this->dialog->current)){
-          $display.= "<p style=\"text-align:right\">\n";
-          $display.= "<input type=\"submit\" name=\"edit_continue\" value=\""._("Continue")."\">&nbsp;";
-          $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
-          $display.= "</p>";
-        }
-      }else{
-        $display.= "<p style=\"text-align:right\">\n";
-        $display.= "<input type=\"submit\" name=\"edit_continue\" value=\""._("Continue")."\">&nbsp;";
-        $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
-        $display.= "</p>";
-
-      }
-      return($display);
-               }
-               
-
-    /****************
-      Dialog display
-     ****************/
-
-    /* Check if there is a snapshot dialog open */
-    $base = $this->DivListFai->selectedBase;
-    if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases())){
-      return($str);
-    }
-
-    /* Display dialog with system list */
-    $this->DivListFai->parent = $this;
-    $this->DivListFai->execute();
-    $this->DivListFai->AddDepartments($this->DivListFai->selectedBase,4,1);
-    $this->reload();
-    $this->DivListFai->setEntries($this->objects);
-    return($this->DivListFai->Draw());
-       }
-
-
-  /* Return departments, that will be included within snapshot detection */
-  function get_used_snapshot_bases()
-  {
-    $tmp = array();
-    $types = array("hooks","scripts","disk","packages","profiles","templates","variables");
-    foreach($types as $type){
-      if($this->DivListFai->selectedBranch == "main"){
-        $tmp[] = "ou=".$type.",ou=fai,ou=configs,ou=systems,".$this->DivListFai->selectedBase;
-      }else{
-        $tmp[] = "ou=".$type.",".$this->DivListFai->selectedBranch;
-      }
-    }
-    return($tmp);
-  }
-
-
-  /* Get available branches for current base */
-  function getBranches($base = false,$prefix = "")
-  {
-    $ret = array("/"=>"main");
-    $ldap = $this->config->get_ldap_link();
-    if(!$base){
-      $base= $_SESSION['CurrentMainBase'];
-    }
-    $tmp = get_all_releases_from_base($base,true);
-    foreach($tmp as $dn => $name){
-      $ret[$name]=$dn;
-    }
-    ksort($ret);
-    $ret = array_flip($ret);
-
-    return ($ret);
-  }
-  
-
-  function list_get_selected_items()
-  {
-    $ids = array();
-    foreach($_POST as $name => $value){
-      if(preg_match("/^item_selected_[0-9]*$/",$name)){
-        $id   = preg_replace("/^item_selected_/","",$name);
-        $ids[$id] = $id;
-      }
-    }
-    return($ids);
-  }
-
-
-  /* reload list of objects */
-  function reload()
-  {
-    /* Variable initialisation */
-    $str            = "";
-    $Regex          = $this->DivListFai->Regex;
-    $this->objects  = array();
-
-    /* Get base */
-    $base = "ou=fai,ou=configs,ou=systems,".$this->DivListFai->selectedBase;
-    if($this->DivListFai->selectedBranch != "main"){
-      $br = $this->getBranches();
-      if(isset($br[$this->DivListFai->selectedBranch])){
-        $base = $this->DivListFai->selectedBranch;
-      }else{
-        $base = "ou=fai,ou=configs,ou=systems,".$this->DivListFai->selectedBase;
-      }
-    }
-    $this->base = $base;
-    $this->set_acl_base($this->base);
-
-    $this->lock_type = get_release_tag(get_release_dn($base));
-
-    /* Create a new list of FAI object 
-     * Generate List of Partitions,Hooks,Scripts,Templates,Profiles ... 
-     */
-    $ObjectTypes = array(
-        "FAIpartitionTable"  => array("OU"=>"ou=disk,"        , "CHKBOX"=>"ShowPartitions"  ,"ACL" => "faiPartitionTable"),
-        "FAIpackageList"     => array("OU"=>"ou=packages,"    , "CHKBOX"=>"ShowPackages"    ,"ACL" => "faiPackage"),
-        "FAIscript"          => array("OU"=>"ou=scripts,"     , "CHKBOX"=>"ShowScripts"     ,"ACL" => "faiScript"),
-        "FAIvariable"        => array("OU"=>"ou=variables,"   , "CHKBOX"=>"ShowVariables"   ,"ACL" => "faiVariable"),
-        "FAIhook"            => array("OU"=>"ou=hooks,"       , "CHKBOX"=>"ShowHooks"       ,"ACL" => "faiHook"),
-        "FAIprofile"         => array("OU"=>"ou=profiles,"    , "CHKBOX"=>"ShowProfiles"    ,"ACL" => "faiProfile"),
-        "FAItemplate"        => array("OU"=>"ou=templates,"   , "CHKBOX"=>"ShowTemplates"   ,"ACL" => "faiTemplate"));
-
-    $filter = "";
-    foreach($ObjectTypes as $key => $data){
-      if($this->DivListFai->$data['CHKBOX']){
-        $filter.= "(objectClass=".$key.")";
-      }
-    }
-    $filter = "(&(|".$filter.")(cn=$Regex))";
-    
-    /* Get resolved release dependencies */
-    $tmp = get_all_objects_for_given_base($base,$filter);
-
-    /* Ge listed ldap objects */
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    foreach($tmp as $entry){
-
-      /* Get some more informations about the object */ 
-      $ldap->cat($entry['dn'], array("cn","description","objectClass","FAIclass","FAIstate","objectClass"));
-      $object  = $ldap->fetch();
-
-      /* Walk through possible types */
-      foreach($ObjectTypes as $type => $rest){  
-
-        $acl = $this->ui->get_permissions($object['dn'],"fai/".$rest ['ACL']);
-
-        if(in_array($type,$object['objectClass']) && preg_match("/r/",$acl)){
-
-          /* Prepare object */
-          unset($object['objectClass']['count']);
-          if(!isset($object['description'][0])){
-            $object['description'][0]="";
-          }
-
-          /* Clean up object informations */
-          $obj                  = array();
-          $obj['cn']                         = $object['cn'][0];
-          $obj['dn']                         = $object['dn'];
-          $obj['acl']                      = $acl;
-          $obj['description']   = $object['description'][0];
-          $obj['objectClass']   = $object['objectClass'];
-
-          /* Append type to this string, to be able to check if the selected 
-           * entry is of type 'freeze' or 'branch'
-           */
-          if(!isset($object['FAIstate'])){
-            $obj['FAIstate'] = $this->lock_type;
-          }else{
-            $obj['FAIstate'] = $object['FAIstate'][0]; 
-          }
-
-          $this->objects[strtolower($obj['cn']).$obj['cn'].$type] = $obj;
-          $this->objects[strtolower($obj['cn']).$obj['cn'].$type]['type']=$type;
-        }
-                       }
-               }
-
-               ksort($this->objects);
-               reset ($this->objects);
-       
-               /* use numeric index, thats a bit more secure */        
-               $tmp0 = array();
-               foreach($this->objects as $obj){
-                       $tmp0[]= $obj;
-               }
-               $this->objects = array();
-               $this->objects = $tmp0;
-       }
-
-       function remove_lock()
-       {
-               if (isset($this->dn)){
-                       del_lock ($this->dn);
-               }
-       }
-
-       function get_type($array){
-               if(in_array("FAIpartitionTable",$array['objectClass'])){
-                       return(array("tabsPartition","faiPartitionTable","FAIPARTITIONTABS"));
-               }
-               if(in_array("FAIscript",$array['objectClass'])){
-                       return(array("tabsScript","faiScript","FAISCRIPTTABS"));
-               }
-               if(in_array("FAItemplate",$array['objectClass'])){
-                       return(array("tabsTemplate","faiTemplate","FAITEMPLATETABS"));
-               }
-               if(in_array("FAIhook",$array['objectClass'])){
-                       return(array("tabsHook","faiHook","FAIHOOKTABS"));
-               }
-               if(in_array("FAIvariable",$array['objectClass'])){
-                       return(array("tabsVariable","faiVariable","FAIVARIABLETABS"));
-               }
-               if(in_array("FAIprofile",$array['objectClass'])){
-                       return(array("tabsProfile","faiProfile","FAIPROFILETABS"));
-               }
-               
-               if(in_array("FAIpackageList",$array['objectClass'])){
-                       return(array("tabsPackage","faiPackage","FAIPACKAGETABS"));
-               }
-       }
-
-  function CheckNewBranchName($name,$base)
-  {
-    $f = $this->DivListFai->selectedBranch;
-    if($name == ""){
-      return(false);
-    }elseif(in_array($name,$this->getBranches($f))) {
-      return(false);
-    }elseif(is_department_name_reserved($name,$base)){
-      return(false);
-    }
-    return(true);
-  }
-
-  function save_object()
-  {
-    $this->DivListFai->save_object();
-  }
-
-
-  function copyPasteHandling_from_queue($s_action,$s_entry)
-  {
-    /* Check if Copy & Paste is disabled */
-    if(!is_object($this->CopyPasteHandler)){
-      return("");
-    }
-
-    $base = $this->DivListFai->selectedBranch;
-    if($base == "main"){
-      $base = $this->DivListFai->selectedBase;
-    }
-
-    /* Add a single entry to queue */
-    if($s_action == "cut" || $s_action == "copy"){
-
-      /* Cleanup object queue */
-      $this->CopyPasteHandler->cleanup_queue();
-      $entry    = $this->objects[$s_entry];
-      $a_setup  = $this->get_type($entry);
-      $dn = $entry['dn'];
-      $this->CopyPasteHandler->add_to_queue($dn,$s_action,$a_setup[0],$a_setup[2],"fai");//$a_setup[1]);
-    }
-
-    /* Add entries to queue */
-    if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
-
-      /* Cleanup object queue */
-      $this->CopyPasteHandler->cleanup_queue();
-
-      /* Add new entries to CP queue */
-      foreach($this->list_get_selected_items() as $id){
-
-        /* Cleanup object queue */
-        $entry    = $this->objects[$id];
-        $a_setup  = $this->get_type($entry);
-        $dn = $entry['dn'];
-
-
-        if($s_action == "copy_multiple"){
-          $this->CopyPasteHandler->add_to_queue($dn,"copy",$a_setup[0],$a_setup[2],"fai");//$a_setup[1]);
-        }
-        if($s_action == "cut_multiple"){
-          $this->CopyPasteHandler->add_to_queue($dn,"cut",$a_setup[0],$a_setup[2],"fai");//$a_setup[1]);
-        }
-      }
-    }
-
-    /* Start pasting entries */
-    if($s_action == "editPaste"){
-      $this->start_pasting_copied_objects = TRUE;
-    }
-
-    /* Return C&P dialog */
-    if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
-
-      /* Load entry from queue and set base */
-      $this->CopyPasteHandler->load_entry_from_queue();
-      $this->CopyPasteHandler->SetVar("base",$base);
-
-      /* Get dialog */
-      $data = $this->CopyPasteHandler->execute();
-
-      save_release_changes_now();
-
-      /* Return dialog data */
-      if(!empty($data)){
-        return($data);
-      }
-    }
-
-    /* Automatically disable status for pasting */
-    if(!$this->CopyPasteHandler->entries_queued()){
-      $this->start_pasting_copied_objects = FALSE;
-    }
-    return("");
-  }
-
-
-  /* Return plugin informations for acl handling */ 
-  static function plInfo()
-  {
-    return (array( 
-          "plShortName"   => _("FAI releases"),
-          "plDescription" => _("FAI release management"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 0,
-          "plSection"     => array("administration"),           
-          "plCategory"    => array("fai"=> array("description" => _("FAI"),
-                                                 "objectClass" => "FAIclass")),
-          "plProvidedAcls"=> array()));
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/fai/class_faiPackage.inc b/plugins/admin/fai/class_faiPackage.inc
deleted file mode 100644 (file)
index bcd5eaa..0000000
+++ /dev/null
@@ -1,670 +0,0 @@
-<?php
-
-class faiPackage 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;
-
-  /* Attributes for this Object */
-  var $attributes       = array("cn","description","FAIpackage","FAIdebianRelease","FAIdebianSection", "FAIinstallMethod");
-
-  /* ObjectClasses for this Object*/
-  var $objectclasses    = array("top","FAIclass","FAIpackageList","FAIrepository");
-
-  /* Class name of the Ldap ObjectClass for the Sub Object */
-  var $subClass         = "";
-  var $subClasses       = array("top","FAIclass","FAIscriptEntry");
-
-  /* Class name of the php class which allows us to edit a Sub Object */
-  var $subClassName     = "";      
-
-  /* Attributes to initialise for each subObject */
-  var $subAttributes    = array("cn","description"); 
-  var $sub64coded       = array();
-
-  var $ConfiguredPackages = array();
-
-  /* Specific attributes */
-  var $cn               = "";       // The class name for this object
-  var $description      = "";       // The description for this set of partitions
-  var $is_dialog        = false;    // specifies which buttons will be shown to save or abort
-  var $SubObjects       = array();  // All leafobjects of this object
-
-  var $FAIdebianRelease          = ""; // The selected release
-  var $FAIdebianSection          = array(); // selected section
-  var $FAIinstallMethod          = "aptitude"; // hard coded
-  var $mirror                    = ""; // selected mirror
-
-  var $servers          = array();  // All available servers
-  var $releases         = array();  // All possible releases 
-  var $sections         = array();  // All section types
-
-  var $list             = NULL;
-
-  var $mirrors          = array();  // The combination of server/release/section
-  var $confDir          = "";
-  var $usedPackages     = array();
-  var $buffer           = NULL; 
-  var $strID            ="";
-  var $newDialogShown   =false;
-
-  var $FAIstate         = "";
-  var $view_logged      = FALSE;
-  var $base;
-
-  var $FAIinstallMethods  = array( "install", "ninstall", "remove", 
-      "dselect-upgrade", "taskinst", "taskrm",
-      "hold", "clean", "aptitude", "aptitude-r",
-      "pending", "dpkgc" );
-
-
-  function faiPackage (&$config, $dn= NULL)
-  {
-    /* Load Attributes */
-    plugin::plugin ($config, $dn);
-
-    /* If "dn==new" we try to create a new entry
-     * Else we must read all objects from ldap which belong to this entry.
-     * First read SubObjects from ldap ... and then the partition definitions for the SubObjects.
-     */
-    if($dn != "new"){
-      $this->dn =$dn;
-
-      /* Get FAIstate
-       */
-      if(isset($this->attrs['FAIstate'][0])){
-        $this->FAIstate = $this->attrs['FAIstate'][0];
-      }
-    }
-
-    if(isset($this->attrs['FAIpackage'])){
-      unset($this->attrs['FAIpackage']['count']);
-      foreach($this->attrs['FAIpackage'] as $pkg){
-        $this->usedPackages[$pkg] = $pkg;
-      }
-      ksort($this->usedPackages);
-    }else{
-      $this->usedPackages = array();
-    }  
-
-    if($dn != "new"){
-
-      /* Create one filter with all package names, 
-         instead of calling $ldap->search for every single package 
-       */
-      $PackageFilter = "";
-      foreach($this->usedPackages as $name){
-        $PackageFilter .= "(FAIpackage=".$name.")";
-      }
-      $PackageFilter = "(&(objectClass=FAIdebconfInfo)(|".$PackageFilter."))";
-
-      /* Search for configuration objects */ 
-      $ldap = $this->config->get_ldap_link();
-      $ldap->cd($this->dn);
-      $ldap->search($PackageFilter,array("FAIvariable","FAIvariableType","FAIvariableContent","FAIpackage","FAIdebianSection","FAIstate"));
-
-      /* Walk through configurations and append them to our list of ConfiguredPackages */
-      while($attr = $ldap->fetch()){
-
-        /* Skip objects, that are tagged as removed */
-        if(isset($object['FAIstate'][0])){
-          if(preg_match("/removed$/",$attr['FAIstate'][0])){
-            continue;
-          }
-        }
-
-        $tmp =array(); 
-        $tmp['Name']  = $attr['FAIvariable'][0];
-        $tmp['Type']  = $attr['FAIvariableType'][0];
-
-        if (isset($attr['FAIvariableContent'][0])){
-          if(!in_array($attr['FAIvariableType'],array("multiselect"))){
-            $tmp['Value'] = $attr['FAIvariableContent'][0];
-          }else{
-            $content = array();        
-            unset($attr['FAIvariableContent']['count']);
-            foreach($attr['FAIvariableContent'] as $attr){
-              $tmp['Value'][] = $attr;
-            }
-          }
-          $this->ConfiguredPackages[$attr['FAIpackage'][0]][$attr['FAIvariable'][0]]=$tmp;
-        }
-      }
-    }
-
-    if (isset($this->attrs['FAIdebianSection']['count'])){
-      unset($this->attrs['FAIdebianSection']['count']);
-    }
-    if((isset($this->attrs['FAIdebianSection']))&&(is_array($this->attrs['FAIdebianSection']))){
-      $this->FAIdebianSection = array();
-      foreach($this->attrs['FAIdebianSection'] as $sec){
-        $this->FAIdebianSection[$sec]=$sec;
-      }
-    }
-
-    if((isset($this->attrs['FAIdebianSection']))&&(is_string($this->attrs['FAIdebianSection']))){
-      $this->FAIdebianSection=array($this->attrs['FAIdebianSection']=>$this->attrs['FAIdebianSection']) ;
-    }
-    $this->confDir = CONFIG_DIR."/fai/";
-    $this->FAIpackage = array();
-
-
-    $methods = array();
-    foreach($this->FAIinstallMethods as $method){
-      $methods[$method] = $method;
-    }
-    $this->FAIinstallMethods = $methods;
-    /* Check if we exist already - no need to ask for revisions, etc. then */
-    if ($this->dn != "new"){
-      $this->newDialogShown= true;
-    }
-
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","fai/".get_class($this),$this->dn);
-    }
-
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-    $display= "";
-
-    $smarty->assign( "FAIinstallMethods", $this->FAIinstallMethods );
-
-    if(!$this->is_account){
-
-      /* Assemble release name */
-      $tmp= preg_replace('/,ou=fai,ou=configs,ou=systems,.*$/', '', $_SESSION['faifilter']['branch']);
-      $tmp= preg_replace('/ou=/', '', $tmp);
-      $rev= array_reverse(split(',', $tmp));
-      $this->FAIdebianRelease= "";
-      foreach ($rev as $part){
-        $this->FAIdebianRelease.= "/$part";
-      }
-      $this->FAIdebianRelease= preg_replace('#^/#', '', $this->FAIdebianRelease);
-
-      /* Assemble sections */
-      $repos= $this->getServerInfos();
-      if(isset($repos[$this->FAIdebianRelease])){
-        $this->FAIdebianSection= $repos[$this->FAIdebianRelease];
-        $this->FAIdebianSection= array_unique($this->FAIdebianSection);
-      }
-
-      /* Assign Repository settings*/ 
-      $this->is_account     = true;
-    }
-
-    /* Assign variables */
-    foreach($this->attributes as $attrs){
-      $smarty->assign($attrs,$this->$attrs);
-    }
-
-    /* Generate package list */
-    $this->list= $this->genPkgs();
-
-    /* + was pressed to open the package dialog */
-    if(isset($_POST['Addpkg']) && $this->acl_is_writeable("FAIpackage")){
-      $this->dialog = new faiPackageEntry($this->config, $this->dn,$this->list,$this->usedPackages);
-      $this->is_dialog =true;
-    }
-
-    /* Delte selected package */ 
-    if(isset($_POST['Delpkg']) && $this->acl_is_writeable("FAIpackage")){
-      if($this->FAIstate != "freeze"){
-        foreach($_POST['usedPackages'] as $del){
-          if(isset($this->usedPackages[$del])){
-            unset($this->usedPackages[$del]);
-          }
-        }
-      }
-    }
-
-    /* Abort package selection dialog */ 
-    if(isset($_POST['CancelSubObject'])){
-      $this->dialog = false;
-      $this->is_dialog=false;
-    }
-
-    /* attach new packages */
-    if(isset($_POST['SaveSubObject'])) {
-      if($this->FAIstate != "freeze"){
-        $this->dialog->save_object();
-        if(count($this->dialog->check())){
-          foreach($this->dialog->check() as $msgs){
-            print_red($msgs);
-          }
-        }else{
-          $use = $this->dialog->save();
-          $this->usedPackages = $use;
-          $this->dialog = false;
-          $this->is_dialog=false;
-          ksort($this->usedPackages);
-        }
-      }else{
-        $this->dialog = false;
-        $this->is_dialog=false;
-      }
-    }
-
-    /* Configuration dialog open*/
-    if((isset($_POST['Conpkg']))&&(isset($_POST['usedPackages']))&&(!empty($_POST['usedPackages'][0])) && $this->acl_is_writeable("FAIdebconfInfo")){
-      $path = CONFIG_DIR."/fai/".$this->FAIdebianRelease."/debconf.d";
-      $pkg_config = array();
-      $pkg = $_POST['usedPackages'][0];
-
-      if(isset($this->ConfiguredPackages[$pkg])){
-        $pkg_config = $this->ConfiguredPackages[$pkg];
-      }
-
-      $this->dialog = new faiPackageConfiguration($this->config, $this->dn,$pkg, $path, $pkg_config);
-      $this->is_dialog =true;
-    }
-
-    /* Configuration dialog open*/
-    if($this->FAIstate != "freeze" && $this->acl_is_writeable("FAIpackage")){
-      if((isset($_POST['Markpkg']))&&(isset($_POST['usedPackages']))&&(!empty($_POST['usedPackages']))){
-        foreach($_POST['usedPackages'] as $pkg){
-          if (isset($this->usedPackages[$pkg])){
-            unset($this->usedPackages[$pkg]);
-            if (preg_match('/^-/', $pkg)){
-              $pkg= preg_replace('/^-/', '', $pkg);
-            } else {
-              $pkg= preg_replace('/^/', '-', $pkg);
-            }
-            $this->usedPackages[$pkg]= $pkg;
-          }
-        }
-      }
-    }
-
-    /* Save Configuration */
-    if(isset($_POST['SaveObjectConfig'])){
-      if($this->FAIstate != "freeze"){
-        $this->ConfiguredPackages= array_merge($this->ConfiguredPackages,$this->dialog->save());
-      }
-      $this->dialog = false;
-      $this->is_dialog=false;
-    }
-
-    /* cancel configuration */     
-    if(isset($_POST['CancelObjectConfig'])){
-      $this->dialog = false;
-      $this->is_dialog=false;
-    }
-
-    /* Display dialog */ 
-    if($this->is_dialog){
-      return $this->dialog->execute();
-    }
-
-    /* Assign section to smarty */
-    $strsec = "";
-    foreach($this->FAIdebianSection as $sec){
-      $strsec .= $sec." ";
-    }
-
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translated){
-      $smarty->assign($name."ACL",$this->getacl($name,preg_match("/freeze/",$this->FAIstate)));
-    }
-
-    $smarty->assign("releases",$this->releases);
-    $smarty->assign("release" ,$this->FAIdebianRelease);
-    $smarty->assign("sections",$this->sections);
-    $smarty->assign("section" ,$strsec);
-    $smarty->assign("usedPackages",$this->printUsedPackages());
-    $display.= $smarty->fetch(get_template_path('faiPackage.tpl', TRUE));
-    return($display);
-  }
-
-  /* Delete me, and all my subtrees
-   */
-  function remove_from_parent()
-  {
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd ($this->dn);
-
-#    $use_dn = str_ireplace( get_release_dn($this->dn), $_SESSION['faifilter']['branch'], $this->dn);
-    $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $this->dn);
-    if($_SESSION['faifilter']['branch'] == "main"){
-      $use_dn = $this->dn;
-    }
-
-    prepare_to_save_FAI_object($use_dn,array(),true);
-
-    new log("remove","fai/".get_class($this),$use_dn,$this->attributes);
-
-    foreach($this->ConfiguredPackages as $pkgname => $attrs){
-      foreach($attrs as $name => $attr){
-        $pkgdn =  "FAIvariable=".$name.",".$this->dn;
-#        $use_dn = str_ireplace( get_release_dn($this->dn), $_SESSION['faifilter']['branch'], $pkgdn);
-        $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $pkgdn);
-        if($_SESSION['faifilter']['branch'] == "main"){
-          $use_dn = $obj['dn'];
-        }
-        prepare_to_save_FAI_object($use_dn,array(),true);
-      }
-    }
-    $this->handle_post_events("remove");
-  }
-
-
-  /* Save data to object 
-   */
-  function save_object()
-  {
-    if($this->FAIstate == "freeze") return;  
-    plugin::save_object();
-  }
-
-
-  /* Check supplied data */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    if(count($this->usedPackages)==0){
-      $message[]=_("Please select a least one Package.");
-    }
-
-    if((empty($this->FAIdebianRelease))||(empty($this->FAIdebianSection))){
-      $message[]=_("Please choose a valid combination for your repository setup.");
-    }
-
-    return ($message);
-  }
-
-  function printUsedPackages(){
-    $a_ret=array(); 
-    if(is_array($this->usedPackages)) {
-      foreach($this->usedPackages as $usedName){
-
-        $config = 0;
-
-        foreach($this->ConfiguredPackages as $name => $value){
-          if($name == $usedName){
-            $config ++;
-          }
-        }
-
-        $c_str ="";
-        if($config){
-          $c_str = " - "._("package is configured");
-        }
-
-        /* Adapt used name if we're marked for removal */
-        $dsc= "";
-        if (preg_match('/^-/', $usedName)){
-          $dsc= " - "._("Package marked for removal");
-          // Generally a bad idea here, because the toggel triggers on -, not on !
-          //$usedName= preg_replace('/^-/', '! ', $usedName);
-        }else{
-          $usedName2= $usedName;
-        }
-
-        if(isset($this->list[$usedName][1])){
-          $a_ret[$usedName] = $usedName2." [".$this->list[$usedName][1]."]".$c_str.$dsc;
-        }else{
-          $a_ret[$usedName] = $usedName2.$c_str.$dsc;
-        }
-      }
-    }
-    return($a_ret);
-  }
-
-  function genPkgs()
-  {
-    /* Generate a list off available packages for this mirror, section and release
-     */
-    /* Only read this file if it wasn't read before */
-    if($this->buffer === NULL){
-      $this->buffer=array();
-      $a_ret = array();
-      foreach($this->FAIdebianSection as $sec){
-        $strID= CONFIG_DIR."/fai/".$this->FAIdebianRelease."/".$sec;
-
-        if(!is_file($strID)){
-          print_red(sprintf(_("Package file '%s' does not exist."),$strID));
-          unset($this->buffer);
-          return(array());
-        }
-        $fp = fopen($strID,"r");
-
-        /* Parse every line and create an array */
-        while(!feof($fp)){
-          $str= fgets($fp,512);
-          $stra= split("\|",$str);
-          if(count($stra)==4){
-            $a_ret[$stra[0]] = $stra;
-          }
-        }
-        fclose($fp);
-        /* Save our Data, to avoid reading it again */
-      }
-      $this->buffer = $a_ret;
-      ksort($a_ret);
-      return($a_ret);
-    }else{
-      return $this->buffer;
-    }
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-
-    /* Assemble release name */
-    if($this->FAIdebianRelease == "ClearFromCopyPaste"){
-      $tmp= preg_replace('/,ou=fai,ou=configs,ou=systems,.*$/', '', $_SESSION['faifilter']['branch']);
-      $tmp= preg_replace('/ou=/', '', $tmp);
-      $rev= array_reverse(split(',', $tmp));
-      $this->FAIdebianRelease= "";
-      foreach ($rev as $part){
-        $this->FAIdebianRelease.= "/$part";
-      }
-      $this->FAIdebianRelease= preg_replace('#^/#', '', $this->FAIdebianRelease);
-    }
-
-    plugin::save();
-
-    $ldap = $this->config->get_ldap_link();
-
-    $this->attrs['FAIpackage'] = array();
-    foreach($this->usedPackages as $pkg => $obj){
-      $this->attrs['FAIpackage'][] = $pkg;
-    } 
-
-    $this->attrs['FAIdebianSection'] = array();
-    foreach($this->FAIdebianSection as $sec){
-      $this->attrs['FAIdebianSection'][] = $sec;
-    }
-
-    prepare_to_save_FAI_object($this->dn,$this->attrs);
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of FAI/package list with dn '%s' failed."),$this->dn));
-    
-    if($this->initially_was_account){
-      new log("modify","fai/".get_class($this),$this->dn,$this->attributes);
-    }else{
-      new log("create","fai/".get_class($this),$this->dn,$this->attributes);
-    }
-
-    /* Do object tagging */
-    $this->handle_object_tagging();
-    $ldap->cd($this->dn);
-
-    /* Save Package configurations */
-    foreach($this->ConfiguredPackages as $pkgname => $attrs){
-      foreach($attrs as $name => $attr){
-      
-        $pkgattrs = array();
-
-        foreach($attr as $n=>$v){
-          if(empty($v)) $v = array();
-        }
-
-        /* Set attributes */
-        $pkgattrs['objectClass'][]        = "FAIdebconfInfo";
-
-        $pkgattrs['FAIpackage']           = $pkgname;
-        $pkgattrs['FAIvariable']          = $name;
-        $pkgattrs['FAIvariableType']      = $attr['Type'];
-        $pkgattrs['FAIvariableContent']   = $attr['Value'];
-        $pkgdn =  "FAIvariable=".$name.",".$this->dn;
-
-        /* cehck if object already exists */
-        $ldap->cat($pkgdn,array("objectClass"));
-
-        /* Workaround for missing "gosaAdministrativeUnitTag" */
-        $attrs = $ldap->fetch();
-        if((isset($attrs['objectClass'])) && (in_array_ics("gosaAdministrativeUnitTag",$attrs['objectClass']))){
-          $pkgattrs['objectClass'][] = "gosaAdministrativeUnitTag";
-        }
-
-        if(in_array($pkgattrs['FAIvariableType'],array("boolean","multiselect","password","select","string","text"))){
-          prepare_to_save_FAI_object($pkgdn,$pkgattrs);
-        }
-  
-        /* Handle tagging */
-        $this->handle_object_tagging($pkgdn, $this->gosaUnitTag);
-      }
-    }
-  }
-
-  /* Return plugin informations for acl handling */ 
-  static function plInfo()
-  {
-    return (array( 
-          "plShortName" => _("Package"),
-          "plDescription" => _("FAI Package list"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 28,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("fai"),
-          "plProvidedAcls" => array(
-            "cn"                => _("Name"),
-            "description"       => _("Description"),
-            "FAIpackage"        => _("Packages"),
-            "FAIdebianSection"  => _("Section")."&nbsp;("._("Readonly").")",
-            "FAIinstallMethod"  => _("Install Method"),
-            "FAIdebconfInfo"    => _("Package configuration"),
-            "FAIdebianRelease"  => _("Release")."&nbsp;("._("Readonly").")")
-          ));
-  }
-
-
-
-
-  function PrepareForCopyPaste($source)
-  {
-    plugin::PrepareForCopyPaste($source);
-
-    if(isset($source['FAIstate'][0])){
-      $this->FAIstate = $source['FAIstate'][0];
-    }
-
-    $this->FAIdebianRelease = "ClearFromCopyPaste";
-
-    if(isset($source['FAIpackage'])){
-      unset($source['FAIpackage']['count']);
-      foreach($source['FAIpackage'] as $pkg){
-        $this->usedPackages[$pkg] = $pkg;
-      }
-      ksort($this->usedPackages);
-    }else{
-      $this->usedPackages = array();
-    }
-
-    if((isset($source['FAIdebianSection']))&&(is_array($source['FAIdebianSection']))){
-      $this->FAIdebianSection = array();
-      for($i = 0 ; $i < $source['FAIdebianSection']['count'] ; $i ++){
-        $this->FAIdebianSection[$source['FAIdebianSection'][$i]]=$source['FAIdebianSection'][$i];
-      }
-    }
-
-    /* Create one filter with all package names, 
-       instead of calling $ldap->search for every single package 
-     */
-    $PackageFilter = "";
-    foreach($this->usedPackages as $name){
-      $PackageFilter .= "(FAIpackage=".$name.")";
-    }
-    $PackageFilter = "(&(objectClass=FAIdebconfInfo)(|".$PackageFilter."))";
-
-    /* Search for configuration objects */ 
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($source['dn']);
-    $ldap->search($PackageFilter,array("FAIvariable","FAIvariableType","FAIvariableContent","FAIpackage","FAIdebianSection","FAIstate"));
-
-    /* Walk through configurations and append them to our list of ConfiguredPackages */
-    while($attr = $ldap->fetch()){
-
-      /* Skip objects, that are tagged as removed */
-      if(isset($object['FAIstate'][0])){
-        if(preg_match("/removed$/",$attr['FAIstate'][0])){
-          continue;
-        }
-      }
-
-      $tmp =array(); 
-      $tmp['Name']  = $attr['FAIvariable'][0];
-      $tmp['Type']  = $attr['FAIvariableType'][0];
-
-      if (isset($attr['FAIvariableContent'][0])){
-        if(!in_array($attr['FAIvariableType'],array("multiselect"))){
-          $tmp['Value'] = $attr['FAIvariableContent'][0];
-        }else{
-          $content = array();        
-          unset($attr['FAIvariableContent']['count']);
-          foreach($attr['FAIvariableContent'] as $attr){
-            $tmp['Value'][] = $attr;
-          }
-        }
-        $this->ConfiguredPackages[$attr['FAIpackage'][0]][$attr['FAIvariable'][0]]=$tmp;
-      }
-    }
-  }
-
-
-  function getServerInfos()
-  {
-    $ret = array();
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(objectClass=FAIrepositoryServer)",array("*"));
-    while($attrs = $ldap->fetch()){
-      if(isset($attrs['FAIrepository'])){
-        for($i =0 ; $i < $attrs['FAIrepository']['count']; $i++){
-          $obj = $attrs['FAIrepository'][$i];
-          $tmp = split("\|",$obj);
-          if(count($tmp)==4){
-            foreach(split(",",$tmp[3]) as $sec){
-              if(!empty($sec)){
-                $ret[$tmp[2]][] =  $sec;
-              }
-            }
-          }
-        }
-      }
-    }
-    return($ret);
-  }
-
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/fai/class_faiPackageConfiguration.inc b/plugins/admin/fai/class_faiPackageConfiguration.inc
deleted file mode 100644 (file)
index 18f3e2b..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-<?php
-
-class faiPackageConfiguration extends plugin
-{
-  /* CLI vars */
-  var $cli_summary        = "Manage server basic objects";
-  var $cli_description    = "Some longer text\nfor help";
-  var $cli_parameters     = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* attribute list for save action */
-  var $ignore_account = TRUE;
-  var $attributes     = array();
-  var $objectclasses  = array();
-
-  var $Debconf_handle = NULL;
-  var $pkg_config ;
-  var $obj;
-
-  function faiPackageConfiguration (&$config, $dn= NULL,$obj,$path,$pkg_config)
-  {
-    plugin::plugin ($config, $dn);
-    $this->obj = $obj;
-    $this->Debconf_handle = new debconf();
-    $this->Debconf_handle->set_template_directory($path);
-    $this->Debconf_handle->set_package($this->obj);
-    $this->Debconf_handle->set_language(preg_replace('/_.*$/', '', get_browser_language()));
-
-    if( $this->Debconf_handle->load() ) {
-      $this->pkg_config = $pkg_config;
-
-      foreach($this->pkg_config as $var){
-        $this->Debconf_handle->SetDefault($var['Name'],$var['Value']);
-      }
-    }
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* Fill templating stuff */
-    $smarty     = get_smarty();
-    $display = "";
-    $smarty->assign("headline", sprintf(_("Debconf information for package '%s'"), $this->obj));
-
-    $this->Debconf_handle->PostCheck();
-
-    $smarty->assign("Config",$this->Debconf_handle->get_dialog());
-
-    $display.= $smarty->fetch(get_template_path('faiPackageConfiguration.tpl', TRUE));
-    return($display);
-  }
-
-  /* Save data to object */
-  function save_object()
-  {
-  }
-
-  /* Check supplied data */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    return ($message);
-  }
-
-  function save()
-  {
-    $this->Debconf_handle->PostCheck();
-    $pkgs = $this->Debconf_handle->template;
-
-    $tmp = array();
-    foreach($pkgs as $pkg){
-      $tmp[$this->obj][$pkg['Name']]['Value']= $pkg['Default'];
-      $tmp[$this->obj][$pkg['Name']]['Name'] = $pkg['Name'];
-      $tmp[$this->obj][$pkg['Name']]['Type'] = $pkg['Type'];
-    }
-    return($tmp);
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/fai/class_faiPackageEntry.inc b/plugins/admin/fai/class_faiPackageEntry.inc
deleted file mode 100644 (file)
index 1b22ba8..0000000
+++ /dev/null
@@ -1,200 +0,0 @@
-<?php
-
-class faiPackageEntry extends plugin
-{
-  /* CLI vars */
-  var $cli_summary= "Manage server basic objects";
-  var $cli_description= "Some longer text\nfor help";
-  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* attribute list for save action */
-  var $ignore_account= TRUE;
-  var $attributes   = array();
-  var $objectclasses= array();
-  var $pkgs        = array();  
-
-  var $buffer       = array();
-  var $categories   = array();
-  var $searchStrPKG = "";
-  var $selected     = array();
-
-  /* Array with available class names */
-  var $FAIAllclasses        = array();
-
-  function faiPackageEntry (&$config, $dn= NULL,$pkgs,$selected=array())
-  {
-    plugin::plugin ($config, $dn);
-    
-    $this->pkgs=$pkgs;
-
-    if(isset($_SESSION['searchStrPKG'])){
-      $this->searchStrPKG=$_SESSION['searchStrPKG'];
-    }
-    $this->selected=$selected;
-
-    $this->searchStrPKG= _("Please enter your search string here");
-  }
-
-  function execute()
-  {
-       /* Call parent execute */
-       plugin::execute();
-
-    /* Fill templating stuff */
-    $smarty     = get_smarty();
-    $display = "";
-
-    $divlist = new divlist("PackageEntry");
-    $divlist->SetPluginMode();
-    $divlist->SetSummary(_("This list displays all assigned package names for this repository settings."));
-    $divlist->SetEntriesPerPage(0);
-    $divlist->SetHeight("650px;");
-    $divlist->SetHeader(array(array("string" => "&nbsp;", "attach" => "style='text-align:center;width:20px;'"),
-                              array("string" => "Name", "attach" => "style='width:180px;'"),
-                              array("string" => "Version", "attach" ),
-                              array("string" => "Description", "attach" => "style='width:240px;border-right:0px;text-align:left;'")));
-
-    if(isset($_GET['search'])){
-      $this->searchStrPKG= $_GET['search']."*";
-    }
-    
-    $pkgs= $this->pkgs;
-
-    unset($this->categories);
-    foreach($pkgs as $name => $entry){
-      $cat = $entry[2];
-      if(!empty($cat)){
-        if(!isset($this->categories[$cat])){  
-          $this->categories[$cat] = true;
-        }
-        if(isset($_POST['chkchange'])){
-          $this->searchStrPKG = $_POST['searchStrPKG'];
-          if(isset($_POST['CAT'.$cat])){
-            $this->categories[$cat]=true;
-          }else{
-            $this->categories[$cat]=false;
-          }
-        }
-      } 
-    }
-
-    $this->searchStrPKG = preg_replace("/^\+/","",$this->searchStrPKG);
-    if(empty($this->searchStrPKG)){
-      $this->searchStrPKG = "*";
-    }
-
-    @ksort($this->categories);
-
-$CHKS = "<input type='hidden' value='chkchange' name='chkchange'><table summary=''><tr>";
-    $i = 0;
-    if(is_array($this->categories)) 
-    foreach($this->categories as $cat => $selected){
-      if($i == 3){
-        $CHKS .="</tr><tr>";
-        $i = 0;
-      }
-      $i ++ ;
-      if($selected){
-        $CHKS .="<td><input type='checkbox' value='1' name='CAT".$cat."' checked onclick='document.mainform.submit()'>&nbsp;".$cat."&nbsp;</td>";
-      }else{
-        $CHKS .="<td><input type='checkbox' value='1' name='CAT".$cat."' onclick='document.mainform.submit()'>&nbsp;".$cat."&nbsp;</td>";
-      }
-    }
-    $CHKS .= "</tr></table>";
-
-
-    foreach($_POST as $name => $value){
-      if(preg_match("/^wasonpage_/i",$name)){
-        $name = preg_replace("/^wasonpage_/","",$name);
-        $n =base64_decode($name);
-
-        if(isset($_POST['use_'.$name])){
-          $this->selected[$n] = $n; 
-        }else{
-          if(isset($this->selected[$n])){
-            unset($this->selected[$n]);
-          }
-        }
-
-      }
-    }
-
-    /* Prepare search filter */
-    $search_str = preg_replace("/\\\\\*/",".*",normalizePreg($this->searchStrPKG));
-
-    $cnt = 0; 
-    foreach($pkgs as $pkg){
-      if($cnt > 200) {
-        print_red(sprintf(_("Your specified search string '%s' returned too many results. Only the first 200 entries are shown, to keep the memory usage low."),$this->searchStrPKG));
-        break;
-      }
-      if((preg_match("/^".$search_str."/i",$pkg[0]))||
-         (preg_match("/^".$search_str."/i",$pkg[3]))){
-        if($this->categories[$pkg[2]]){
-          if(in_array($pkg[0],$this->selected)){
-            $check = " checked ";
-          }else{
-            $check = "";
-          }
-          $cnt ++ ;
-          $chkbox = "<input type='checkbox' value='1' name='use_".base64_encode($pkg[0])."' ".$check.">
-                   <input type='hidden' value='1' name='wasonpage_".base64_encode($pkg[0])."'>";
-          $divlist->AddEntry(array(array("string"=>$chkbox, "attach" => "style='text-align:center;width:20px;'"),
-                               array("string"=>$pkg[0], "attach" => "style='width:180px;'"),
-                               array("string"=>htmlentities($pkg[1])),
-                               array("string"=>htmlentities($pkg[3]), "attach" => "style='width:221px;border-right:0px;text-align:left;'")));
-        }
-      }
-    }
-
-    $_SESSION['searchStrPKG']       = $this->searchStrPKG;
-    $smarty->assign("CHKS"          , $CHKS);
-    $smarty->assign("searchStrPKG"  , $this->searchStrPKG);
-    $smarty->assign("faihead"       , "");
-    $smarty->assign("failist"       , $divlist->DrawList());
-    $smarty->assign("infoimage"     , get_template_path('images/info.png'));
-    $smarty->assign("launchimage"   , get_template_path('images/launch.png'));
-    $smarty->assign("alphabet"      , generate_alphabet());
-    $smarty->assign("apply"         , apply_filter(TRUE));
-    $smarty->assign("search_image"  , get_template_path('images/search.png'));
-
-    $display.= $smarty->fetch(get_template_path('faiPackageEntry.tpl', TRUE));
-    return($display);
-  }
-
-  /* Save data to object */
-  function save_object()
-  {
-    foreach($_POST as $name => $value){
-      if(preg_match("/^wasonpage_/i",$name)){
-        $name = preg_replace("/^wasonpage_/","",$name);
-        $n =base64_decode($name);
-        if(isset($_POST['use_'.$name])){
-          $this->selected[$n] = $n;
-        }else{
-          if(isset($this->selected[$n])){
-            unset($this->selected[$n]);
-          }
-        }
-
-      }
-    }
-
-  }
-
-  /* Check supplied data */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-        
-    return ($message);
-  }
-
-  function save()
-  {
-    return($this->selected);
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/fai/class_faiPartitionTable.inc b/plugins/admin/fai/class_faiPartitionTable.inc
deleted file mode 100644 (file)
index 216d6c3..0000000
+++ /dev/null
@@ -1,621 +0,0 @@
-<?php
-
-class faiPartitionTable 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","description");
-  var $objectclasses    = array("top","FAIclass","FAIpartitionTable");
-
-  /* Specific attributes */
-  var $cn               = "";       // The class name for this object
-  var $description      = "";       // The description for this set of partitions
-  var $disks            = array();  // All defined Disks 
-  var $is_dialog        = false;    // specifies which buttons will be shown to save or abort
-
-  var $FAIstate         = "";
-  var $ui;
-
-  var $view_logged      = FALSE;
-
-  function faiPartitionTable (&$config, $dn= NULL)
-  {
-    /* Load Attributes */
-    plugin::plugin ($config, $dn);
-
-    $this->acl ="#all#";
-
-    $this->ui = get_userinfo();    
-
-    /* If "dn==new" we try to create a new entry
-     * Else we must read all objects from ldap which belong to this entry.
-     * First read disks from ldap ... and then the partition definitions for the disks.
-     */
-    if($dn != "new"){
-      $this->dn =$dn;
-
-      /* Get FAIstate
-       */
-      if(isset($this->attrs['FAIstate'][0])){
-        $this->FAIstate = $this->attrs['FAIstate'][0];
-      }
-
-      /* Read all disks from ldap taht are defined fot this partition table 
-       */
-      $ldap = $this->config->get_ldap_link();
-      $ldap->cd ($this->dn);
-      $ldap->search("(&(objectClass=FAIclass)(objectClass=FAIpartitionDisk))",array("*"));
-      while($object = $ldap->fetch()){
-
-        /* Skip objects, that are tagged as removed */
-        if(isset($object['FAIstate'][0])){
-          if(preg_match("/removed$/",$object['FAIstate'][0])){
-            continue;
-          }
-        }
-
-        $this->disks[$object['cn'][0]]['status']      = "edited";
-        $this->disks[$object['cn'][0]]['dn']          = $object['dn'];
-        $this->disks[$object['cn'][0]]['cn']          = $object['cn'][0];
-        if(isset($object['description'][0])){
-          $this->disks[$object['cn'][0]]['description'] = $object['description'][0];
-        }else{
-          $this->disks[$object['cn'][0]]['description'] = "";
-        }
-        $this->disks[$object['cn'][0]]['partitions']   = array();
-      }
-  
-      /* read all partitions for each disk 
-       */
-      foreach($this->disks as $name => $disk){
-        $ldap->cd ($disk['dn']);
-        $ldap->search("(&(objectClass=FAIclass)(objectClass=FAIpartitionEntry))",array("*"));
-        while($partition = $ldap->fetch()){
-
-          /* Skip objects, that are tagged as removed */
-          if(isset($partition['FAIstate'][0])){
-            if(preg_match("/removed$/",$partition['FAIstate'][0])){
-              continue;
-            }
-          }
-
-          /* remove count ... from ldap result 
-           */
-          foreach($partition as $key=>$val){
-            if((is_numeric($key))||($key=="count")||($key=="dn")){
-              unset($partition[$key]);
-            }else{
-              $partition[$key] = $val[0];
-            }
-          }
-
-          /* Append fetched partitions
-           */
-          $partition['status']="edited";
-          $this->disks[$name]['partitions'][$partition['FAIpartitionNr']] = $partition; 
-        }  
-      }
-    }
-    ksort($this->disks);
-  }
-
-
-  function acl_base_for_current_object($dn)
-  {
-    if($dn == "new"){
-      if($this->dn == "new"){
-        $dn= $_SESSION['CurrentMainBase'];
-      }else{
-        $dn = $this->dn;
-      }
-    }
-    return($dn);
-  }
-
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","fai/".get_class($this),$this->dn);
-    }
-
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-    $display= "";
-    /* Add Disk to this Partitionset
-     * This code adds a new HDD to the disks 
-     * A new Dialog will be opened 
-     */
-    if(isset($_POST['AddDisk'])){
-      $usedDiskNames =array();
-      foreach($this->disks as $key=>$disk){
-        $usedDiskNames[]= $key;
-      }
-      $this->dialog = new faiPartitionTableEntry($this->config,$this->dn,$usedDiskNames); 
-      $this->dialog->set_acl_base($this->acl_base_for_current_object($this->dn));
-      $this->dialog->set_acl_category("fai");
-      $this->dialog->FAIstate = $this->FAIstate;
-      $this->is_dialog = true;
-    }
-
-    /* Edit disk.
-     * Open dialog which allows us to edit the selected entry 
-     */    
-
-    if($this->dn != "new"){
-      $_SESSION['objectinfo']= $this->dn;
-    }
-
-    if((isset($_POST['EditDisk']))&&(isset($_POST['disks']))){
-      $usedDiskNames =array();
-      $Udisk = $_POST['disks'][0];
-      if(isset($this->disks[$Udisk])){
-
-        foreach($this->disks  as $key=>$disk){
-          if($key != $Udisk){
-            $usedDiskNames[]= $key;
-          }
-        }
-
-        /* Set object info string, which will be displayed in plugin info line */ 
-        if(isset($this->disks[$Udisk]['dn'])){
-          $_SESSION['objectinfo'] = $this->disks[$Udisk]['dn'];
-          $dn = $this->disks[$Udisk]['dn'];
-        }else{
-          $_SESSION['objectinfo'] = "";
-          $dn = "new";
-        }
-
-        $this->dialog = new faiPartitionTableEntry($this->config,$this->dn,$usedDiskNames,$this->disks[$Udisk]); 
-        $this->dialog->set_acl_base($this->acl_base_for_current_object($dn));
-        $this->dialog->set_acl_category("fai");
-        $this->dialog->FAIstate = $this->FAIstate;
-
-        $this->is_dialog = true;
-      }
-    }
-
-    /* Edit aborted, close dialog, without saving anything
-     */
-    if(isset($_POST['CancelDisk'])){
-      unset($this->dialog);
-      $this->dialog = FALSE;
-      $this->is_dialog=false;
-    }
-
-    /* Dialog saved
-     * Save given data from Dialog, if no error is occurred
-     */
-    if(isset($_POST['SaveDisk'])){
-
-      if($this->FAIstate != "freeze"){
-        $this->dialog->save_object();
-        if(count($this->dialog->check())){
-          foreach($this->dialog->check() as $msg){
-            print_red($msg);
-          }
-        }else{
-          $disk = $this->dialog->save();
-          if(isset($disk['rename'])){
-            if($this->disks[$disk['rename']['from']]['status']=="edited"){
-              $this->disks[$disk['rename']['from']]['status']="delete";
-            }else{
-              unset($this->disks[$disk['rename']['from']]);
-            }
-
-            foreach($disk['partitions'] as $key => $val){
-              if($disk['partitions'][$key]['status']!="delete"){
-                $disk['partitions'][$key]['status']= "new";
-              }
-            }
-
-            $disk['status']="new";
-            $disk['cn']= $disk['rename']['to'];
-          }
-
-          $this->disks[$disk['cn']]=$disk; 
-          unset($this->dialog);
-          $this->dialog = FALSE;
-          $this->is_dialog=false;
-          ksort($this->disks);
-        }
-      }else{
-        $this->dialog = FALSE;
-        $this->is_dialog=false;
-      }
-    }
-
-    /* Delete selected disk drive from list
-     * Assign delete status for all its partitions      
-     */
-    if((isset($_POST['DelDisk']))&&(!empty($_POST['disks']))){
-      if($this->FAIstate != "freeze"){
-        foreach($_POST['disks'] as $disk) {
-
-          if(isset($this->disks[$disk])){
-            if($this->disks[$disk]['status']=="edited"){
-              $this->disks[$disk."-delete"]=$this->disks[$disk];
-              unset($this->disks[$disk]);
-              $disk = $disk."-delete";        
-              $this->disks[$disk]['status']="delete";
-              foreach($this->disks[$disk]['partitions'] as $name => $value ){
-                if($value['status']=="edited"){
-                  $this->disks[$disk]['partitions'][$name]['status']="delete"; 
-                }else{
-                  unset($this->disks[$disk]['partitions'][$name]);
-                }
-              }
-            }else{
-              unset($this->disks[$disk]);
-            }
-          }
-        }
-      }
-    }
-
-    /* Display dialog if one is defined
-     */
-    if(is_object($this->dialog)){
-      $this->dialog->save_object();
-      return($this->dialog->execute());
-    }
-
-    /* Assign all attributes to smarty engine
-     */
-    foreach($this->attributes as $attrs){
-      $smarty->assign($attrs,$this->$attrs);
-      if($this->$attrs){
-        $smarty->assign($attrs."CHK"," ");
-      }else{
-        $smarty->assign($attrs."CHK"," disabled ");
-      }
-    }
-   
-    $dn = $this->acl_base_for_current_object($this->dn);
-    $smarty->assign("sub_object_is_addable",
-        preg_match("/c/",$this->ui->get_permissions($dn,"fai/faiPartitionTableEntry")) &&
-        !preg_match("/freeze/",$this->FAIstate));
-
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translated){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-    $disks = $this->getDisks();
-    $smarty->assign("disks"   ,$disks);
-    $display.= $smarty->fetch(get_template_path('faiPartitionTable.tpl', TRUE));
-    return($display);
-  }
-
-  function getDisks(){
-    /* Return all available disks for this partition table
-     * Return in listBox friendly array
-     */
-    $a_return = array();
-    foreach($this->disks as $key => $disk){
-
-      $dn = "new";
-      if(isset($obj['dn'])){
-        $dn = $obj['dn'];
-      }
-      $dn = $this->acl_base_for_current_object($dn);
-      $acl = $this->ui->get_permissions($dn,"fai/faiPartitionTableEntry");
-      if(preg_match("/(r|w)/",$acl)) {
-
-        if($disk['status'] != "delete"){
-          $cnt=0;
-          foreach($disk['partitions'] as $val){
-            if($val['status']!="delete"){
-              $cnt ++;
-            }
-          }
-          if(!empty($disk['description'])){
-            if($cnt == 1){
-              $a_return[$key]=  $disk['cn']." [".$disk['description']."], ".sprintf(_("%s partition"), $cnt);
-            }else{
-              $a_return[$key]=  $disk['cn']." [".$disk['description']."], ".sprintf(_("%s partition(s)"), $cnt);
-            }
-          }else{
-            if($cnt == 1){
-              $a_return[$key]=  $disk['cn'].", ".sprintf(_("%s partition"), $cnt);
-            }else{
-              $a_return[$key]=  $disk['cn'].", ".sprintf(_("%s partition(s)"), $cnt);
-            }
-          }
-        }
-      }
-    }
-    return($a_return);
-  }
-
-
-  /* Delete me, and all my subtrees
-   */
-  function remove_from_parent()
-  {
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd ($this->dn);
-
-#    $use_dn = str_ireplace( get_release_dn($this->dn), $_SESSION['faifilter']['branch'], $this->dn);
-    $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $this->dn);
-    if($_SESSION['faifilter']['branch'] == "main"){
-      $use_dn = $this->dn;
-    }
-
-    prepare_to_save_FAI_object($use_dn,array(),true);
-
-    new log("remove","fai/".get_class($this),$use_dn,$this->attributes);   
-    foreach($this->disks as $disk){
-
-      $disk_dn = "cn=".$disk['cn'].",".$this->dn;
-#      $use_dn = str_ireplace( get_release_dn($this->dn), $_SESSION['faifilter']['branch'], $disk_dn);
-      $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $disk_dn);
-      if($_SESSION['faifilter']['branch'] == "main"){
-        $use_dn = $disk_dn;
-      }
-      prepare_to_save_FAI_object($use_dn,array(),true);
-
-      foreach($disk['partitions'] as $key => $partition){    
-     
-        $partition_dn= "FAIpartitionNr=".$partition['FAIpartitionNr'].",".$disk_dn;      
-#        $use_dn = str_ireplace( get_release_dn($this->dn), $_SESSION['faifilter']['branch'], $partition_dn);
-        $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $partition_dn);
-        if($_SESSION['faifilter']['branch'] == "main"){
-          $use_dn = $disk_dn;
-        }
-        prepare_to_save_FAI_object($use_dn,array(),true);
-      }
-    }
-  }
-
-
-  /* Save data to object 
-   */
-  function save_object()
-  {
-    if($this->FAIstate == "freeze") return;
-    plugin::save_object();
-    foreach($this->attributes as $attrs){
-      if(isset($_POST[$attrs])){
-        $this->$attrs = $_POST[$attrs];
-      }
-    }
-  }
-
-
-  /* Check supplied data */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    return ($message);
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-
-    plugin::save();
-    /* Save current settings.
-     * 1 : We must save the partition table, with its description and cn 
-     * 2 : Append Disk with cn and  description.
-     * 3 : Save partitions for each disk
-     */  
-
-    $ldap = $this->config->get_ldap_link();
-
-    prepare_to_save_FAI_object($this->dn,$this->attrs);
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of FAI/partition table with dn '%s' failed."),$this->dn));
-
-    if($this->initially_was_account){
-      new log("modify","fai/".get_class($this),$this->dn,$this->attributes);
-    }else{
-      new log("create","fai/".get_class($this),$this->dn,$this->attributes);
-    }
-    /* Do object tagging */
-    $this->handle_object_tagging();
-  
-    /* Sort entries, because we must delete entries with status="delete" first */
-    $order = array();
-    foreach($this->disks as $key => $disk){
-      if($disk['status'] == "delete"){
-        $order[$key] = $disk;
-      }
-    }
-    foreach($this->disks as $key => $disk){
-      if($disk['status'] != "delete"){
-        $order[$key] = $disk;
-      }
-    }
-
-    /* Append all disks to ldap */
-    foreach($order as $cn=>$disk){
-      $disk_dn                    = "cn=".$disk['cn'].",".$this->dn;
-      $disk_attrs['cn']           =  $disk['cn'];
-      $disk_attrs['description']  =  $disk['description']; 
-      $disk_attrs['objectClass']  =  array("top","FAIclass","FAIpartitionDisk");
-
-      if($disk['status']=="new"){
-        $ldap->cat($disk_dn,array("objectClass"));
-        if($ldap->count()){
-          $disk['status']="edited";
-        }
-      }
-
-      /* Fix problem with missing objectClass "gosaAdministrativeUnitTag" for disks */
-      $ldap->cat($disk_dn,array("objectClass"));
-      $attrs = $ldap->fetch();
-      if(isset($attrs['objectClass']) && in_array_ics("gosaAdministrativeUnitTag",$attrs['objectClass'])){
-        $disk_attrs['objectClass'][] = "gosaAdministrativeUnitTag";
-      }
-
-      if($disk['status'] == "delete"){
-        prepare_to_save_FAI_object($disk_dn,array(),true);
-        $this->handle_post_events("remove");
-      }elseif($disk['status'] == "edited"){
-        prepare_to_save_FAI_object($disk_dn,$disk_attrs);
-        $this->handle_post_events("modify");
-      }elseif($disk['status']=="new"){
-        prepare_to_save_FAI_object($disk_dn,$disk_attrs);
-        $this->handle_post_events("add");
-      }
-
-      $this->handle_object_tagging($disk_dn, $this->gosaUnitTag);
-
-      if($disk['status']!="delete")
-      /* Add all partitions */
-      foreach($disk['partitions'] as $key => $partition){
-        $partition_attrs = array();
-
-        foreach($partition as $key => $value){
-          if(!empty($value)){
-            $partition_attrs[$key]=$value;        
-          }else{
-            unset($partition_attrs[$key]);        
-          }
-        }
-
-        $partition_dn= "FAIpartitionNr=".$partition_attrs['FAIpartitionNr'].",".$disk_dn;      
-        $partition_attrs['objectClass']= array("top","FAIclass","FAIpartitionEntry");
-        $partition_attrs['cn']= $partition_attrs['FAIpartitionNr'];
-        
-        unset($partition_attrs['status']);
-        unset($partition_attrs['old_cn']);
-
-        if($partition['status']=="new"){
-          $ldap->cat($partition_dn,array("objectClass"));
-          if($ldap->count()){
-            $partition['status']="edited";
-          }
-        }
-
-        if((!isset($partition['FAImountPoint']))||(empty($partition['FAImountPoint']))){
-          $partition_attrs['FAImountPoint']="swap";
-        }
-
-        /* Fix problem with missing objectClass "gosaAdministrativeUnitTag" for partitions */
-        $ldap->cat($partition_dn,array("objectClass"));
-        $attrs = $ldap->fetch();
-        if(isset($attrs['objectClass']) && in_array_ics("gosaAdministrativeUnitTag",$attrs['objectClass'])){
-          $partition_attrs['objectClass'][] = "gosaAdministrativeUnitTag";
-        }
-
-        if($partition['status'] == "delete"){
-          prepare_to_save_FAI_object($partition_dn,array(),true);
-          $this->handle_post_events("remove");
-        }elseif($partition['status'] == "edited"){
-          prepare_to_save_FAI_object($partition_dn,$partition_attrs);
-          $this->handle_post_events("modify");
-        }elseif($partition['status']=="new"){
-          prepare_to_save_FAI_object($partition_dn,$partition_attrs);
-          $this->handle_post_events("add");
-        }
-
-        $this->handle_object_tagging($partition_dn, $this->gosaUnitTag);
-      }
-    }
-    $this->handle_post_events("add");
-  }
-
-
-  function PrepareForCopyPaste($source)
-  {
-    plugin::PrepareForCopyPaste($source);
-    /* Get FAIstate
-     */
-    if(isset($source['FAIstate'][0])){
-      $this->FAIstate = $source['FAIstate'][0];
-    }
-
-    /* Read all disks from ldap taht are defined fot this partition table 
-     */
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd ($source['dn']);
-    $ldap->search("(&(objectClass=FAIclass)(objectClass=FAIpartitionDisk))",array("*"));
-    while($object = $ldap->fetch()){
-
-      /* Skip objects, that are tagged as removed */
-      if(isset($object['FAIstate'][0])){
-        if(preg_match("/removed$/",$object['FAIstate'][0])){
-          continue;
-        }
-      }
-
-      $this->disks[$object['cn'][0]]['status']      = "edited";
-      $this->disks[$object['cn'][0]]['dn']          = $object['dn'];
-      $this->disks[$object['cn'][0]]['cn']          = $object['cn'][0];
-      if(isset($object['description'][0])){
-        $this->disks[$object['cn'][0]]['description'] = $object['description'][0];
-      }else{
-        $this->disks[$object['cn'][0]]['description'] = "";
-      }
-      $this->disks[$object['cn'][0]]['partitions']   = array();
-    }
-
-    /* read all partitions for each disk 
-     */
-    foreach($this->disks as $name => $disk){
-      $ldap->cd ($disk['dn']);
-      $ldap->search("(&(objectClass=FAIclass)(objectClass=FAIpartitionEntry))",array("*"));
-      while($partition = $ldap->fetch()){
-
-        /* Skip objects, that are tagged as removed */
-        if(isset($partition['FAIstate'][0])){
-          if(preg_match("/removed$/",$partition['FAIstate'][0])){
-            continue;
-          }
-        }
-
-        /* remove count ... from ldap result 
-         */
-        foreach($partition as $key=>$val){
-          if((is_numeric($key))||($key=="count")||($key=="dn")){
-            unset($partition[$key]);
-          }else{
-            $partition[$key] = $val[0];
-          }
-        }
-
-        /* Append fetched partitions
-         */
-        $partition['status']="edited";
-        $this->disks[$name]['partitions'][$partition['FAIpartitionNr']] = $partition; 
-      }  
-    }
-    ksort($this->disks);
-  }
-
-
-  /* Return plugin informations for acl handling */ 
-  static function plInfo()
-  {
-    return (array( 
-          "plShortName" => _("Partition table"),
-          "plDescription" => _("FAI partition table"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 26,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("fai"),
-          "plProvidedAcls" => array(
-            "cn"                => _("Name")."&nbsp;("._("Read only").")",
-            "description"       => _("Description"))
-          ));
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/fai/class_faiPartitionTableEntry.inc b/plugins/admin/fai/class_faiPartitionTableEntry.inc
deleted file mode 100644 (file)
index 431157c..0000000
+++ /dev/null
@@ -1,516 +0,0 @@
-<?php
-
-class faiPartitionTableEntry 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("DISKcn","DISKdescription");
-  var $objectclasses= array();
-
-  var $DISKcn              = "";
-  var $DISKdescription     = "";
-  
-  var $partitions           = array();
-  var $UsedAttrs            = array();
-  var $is_edit              = false;
-  var $old_cn               = "";
-  var $status               = "new";
-  var $deletePartitions     = array();
-
-  var $FAIstate             = "";
-
-  function faiPartitionTableEntry (&$config, $dn= NULL,$usedDiskNames=array(),$disk=false)
-  {
-    plugin::plugin ($config, $dn);
-    $this->UsedAttrs  = array("cn","description","FAIpartitionType","FAIpartitionNr","FAIfsType","FAImountPoint","FAIpartitionSize",
-                         "FAImountOptions","FAIfsOptions","FAIpartitionFlags");
-
-    /* Default status is new */
-    $this->status = "new";    
-    /* We want to edit an entry */
-    if($disk){
-
-      /* Set disk status */      
-      $this->status = $disk['status'];
-
-      /* Walk through partitions */
-      foreach($disk['partitions'] as $name => $values){
-
-        /* If a partition is already marked as delete, attach it to deletePartitions only. */
-        if($values['status'] == "delete"){
-          unset($disk['partitions'][$name]);
-          $this->deletePartitions[]=$values;
-        }else{
-
-          /* Set status, to know which partition must be deleted from ldap
-             new    : Neu partition entry // save
-             edited : Update partition entry in ldap
-             deleted: Remove partition from ldap
-           */
-    
-          /* If status is not new, set to edit mode. 
-           * New means that this partition currently wasn't saved to ldap.
-           */
-          if($disk['partitions'][$name]['status']!="new"){
-            $disk['partitions'][$name]['status']="edited";
-          }
-     
-          $disk['partitions'][$name]['old_cn']= $disk['partitions'][$name]['cn'];
-          /* Assign empty attributes, if attribute is missing */
-          foreach($this->UsedAttrs as $attr){
-            if(!isset($values[$attr])){
-              $disk['partitions'][$name][$attr]="";  
-            }
-          }
-
-          if (preg_match('/^_/', $disk['partitions'][$name]['FAIfsType'])){
-            $disk['partitions'][$name]['FAIfsType']= preg_replace('/^_/', '', $disk['partitions'][$name]['FAIfsType']);
-            $disk['partitions'][$name]['FAIencrypted']= true;
-          } else {
-            $disk['partitions'][$name]['FAIencrypted']= false;
-          }
-        }
-      }
-
-      /* Set default attributes */
-      $this->DISKcn          = $disk['cn'];
-      $this->DISKdescription = $disk['description'];
-      $this->partitions       = $disk['partitions'];
-      $this->is_edit          = true;
-      $this->old_cn           = $disk['cn'];
-    }
-  }
-
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* Fill templating stuff */
-    $smarty     = get_smarty();
-    $s_action   = "";
-    $s_entry    = "";
-    $display    = "";
-    
-    /* Assign values 
-     * And Checkbox selection
-     */
-    foreach($this->attributes as $attrs){
-      $smarty->assign($attrs,$this->$attrs);
-      if($this->$attrs){
-        $smarty->assign($attrs."CHK"," ");
-      }else{
-        $smarty->assign($attrs."CHK"," disabled ");
-      }
-    }
-
-    /* Check all Posts if there is something usefull for us,
-     * For example : Delete is posted as Delete_1 
-     * The number specifies the index we want to delete
-     */
-    foreach($_POST as $name => $value){
-      if((preg_match("/Delete_.*/",$name)) && $this->acl_is_removeable()){
-        $tmp = split("_",$name);
-        $s_action = "remove";
-        $s_entry  = $tmp[1]; 
-      }
-    }
-
-    /* To remove a partition we unset the index posted.
-     * We must sort the index again, else we possibly got problems 
-     * with partitions order.
-     */
-    if($s_action == "remove" && $this->acl_is_removeable()){
-      if($this->partitions[$s_entry]['status'] == "edited"){
-        $this->deletePartitions[$s_entry]= $this->partitions[$s_entry];
-        $this->deletePartitions[$s_entry]['FAIpartitionNr']=$s_entry;
-        unset($this->partitions[$s_entry]);
-      }else{
-        unset($this->partitions[$s_entry]);
-      }
-      $tmp= array();
-      foreach($this->partitions as $part){
-        $tmp[count($tmp)+1]=$part;
-      }
-      $this->partitions = $tmp;
-    }
-
-    /* To add a partitions we only append an empty 
-     *  array to the already defined partitions.
-     */
-    if(isset($_POST['AddPartition']) && $this->acl_is_createable()){
-      foreach($this->UsedAttrs as $attr){
-        $tmp[$attr]                = "";     
-      }
-      $tmp["old_cn"]               = "";     
-      $tmp["FAIencrypted"] = FALSE;     
-      $tmp['status']="new";
-      $this->partitions[count($this->partitions)+1]=$tmp;
-    }
-
-    /* $setup contains a table with the partitions. 
-     */
-    $smarty->assign("setup", $this->generateParts());
-    foreach($this->attributes as $attr){
-      $smarty->assign($attr,$this->$attr);
-    }
-
-    $tmp = $this->plInfo();
-    $sacl = "";
-    foreach($tmp['plProvidedAcls'] as $name => $translated){
-
-      $acl = $this->getacl($name);
-      $sacl .= $acl;
-      if($this->FAIstate == "freezed"){
-        $acl = preg_replace("/w/","",$acl);
-      }
-      $smarty->assign($name."ACL",$acl);
-    }
-    $smarty->assign("allowSave",$sacl);
-   
-    $smarty->assign("sub_object_is_createable",$this->acl_is_createable());
-    /* Fetch template and show the result
-     */
-    $display.= $smarty->fetch(get_template_path('faiPartitionTableEntry.tpl', TRUE));
-    return($display);
-  }
-
-  function generateParts()
-  {
-    /* Define Arrays with allowed syntax */
-    $PartitionTypes   = array("primary"=>_("primary"),"logical"=>_("logical"));
-    $FAIfsTypes       = array("ext2","ext3","xfs","swap","reiser","dosfat16","winfat32");
-
-    /* Display Header */
-    $str = "";
-    if (count($this->partitions)){
-      $str .= "<tr>";
-      $str .= "<td><b>"._("Type")."</b></td>";
-      $str .= "<td><b>"._("FS type")."</b></td>";
-      $str .= "<td><b>"._("Mount point")."</b></td>";
-      $str .= "<td><b>"._("Size in MB")."</b></td>";
-      $str .= "<td><b>"._("Mount options")."</b></td>";
-      $str .= "<td><b>"._("FS option")."</b></td>";
-      $str .= "<td><b>"._("Preserve")."</b></td>";
-      $str .= "<td><b>"._("Encrypted")."</b></td>";
-      $str .= "<td>&nbsp;</td>";
-      $str .= "</tr>";
-    }
-    
-    /* Walk through all defined partitions.
-     * Create a new row for each partition and append it to 
-     *  the header defined above.
-     * To be able to check the posts later, we append a key to each single postfield. like cn_1 ... cn_2
-     */
-    foreach($this->partitions as $key => $part){
-      
-      $dis = "";
-      if($part['FAIpartitionFlags'] == "preserve"){
-        $dis = " disabled ";
-      }
-
-      $disableALL = "";
-      if($this->FAIstate =="freeze"){
-        $disableALL = " disabled ";
-      }
-
-      if($part['status']!="delete"){
-
-        /* Generate Partition select box  
-         */
-        $PartitionType = "";
-        if($this->acl_is_writeable("FAIpartitionType")){
-          $PartitionType = "<select name='FAIpartitionType_".$key."' id='FAIpartitionType_".$key."' ".$disableALL.">";
-          foreach($PartitionTypes as $type => $PTname){
-            if($part['FAIpartitionType'] == $type){
-              $PartitionType .="<option value='".$type."' selected >".$PTname."</option>";
-            }else{
-              $PartitionType .="<option value='".$type."'>".$PTname."</option>";
-            }
-          }        
-          $PartitionType.="</select>";   
-        }elseif($this->acl_is_readable("FAIpartitionType")){
-          $PartitionType = $part['FAIpartitionType'];
-        }
-
-
-        /* Generate fsType select box  
-         */
-        $FAIfsType= "";
-        if($this->acl_is_writeable("FAIfsType")){
-          $FAIfsType= "<select name='FAIfsType_".$key."' id='FAIfsType_".$key."' ".$dis." ".$disableALL.">";
-          foreach($FAIfsTypes as $type){
-            if($part['FAIfsType'] == $type){
-              $FAIfsType  .="<option value='".$type."' selected >".$type."</option>";
-            }else{
-              $FAIfsType .="<option value='".$type."'>".$type."</option>";
-            }
-          }        
-          $FAIfsType.="</select>";   
-        }elseif($this->acl_is_readable("FAIfsType")){
-          $FAIfsType = $part['FAIfsType'];
-        }
-
-        foreach(array("FAImountPoint","FAIpartitionSize","FAImountOptions","FAIfsOptions") as $attr){
-          $$attr  = "";
-          if($this->acl_is_writeable($attr)){
-            $$attr = "<input name='".$attr."_".$key."'  ".$disableALL."  ".$dis."
-                        value='".$part[$attr]."'    id='".$attr."_".$key."'>";
-
-          }elseif($this->acl_is_readable($attr)){
-            $$attr = $part[$attr];
-          }
-        }
-
-
-        $str .= "\n<tr>";
-        $str .= "\n<td>".$PartitionType."</td>";
-        $str .= "\n<td>".$FAIfsType."</td>";
-        $str .= "\n<td>".$FAImountPoint."</td>";
-        $str .= "\n<td>".$FAIpartitionSize."</td>";
-        $str .= "\n<td>".$FAImountOptions."</td>";
-        $str .= "\n<td>".$FAIfsOptions."</td>";
-
-        $changeState = "onClick=\"changeState('FAImountPoint_".$key."') ; ".
-                                 "changeState('FAIpartitionSize_".$key."') ; ".
-                                 "changeState('FAImountOptions_".$key."') ; ".
-                                 "changeState('FAIfsType_".$key."') ; ".
-                                 "changeState('FAIfsOptions_".$key."') ; \"";
-  
-        if($this->acl_is_writeable("FAIpartitionFlags")){
-          if($part['FAIpartitionFlags']!=false){
-            $str .= "\n<td><input type='checkbox' name='FAIpartitionFlags_".$key."' value='preserve' checked ".$changeState." ".$disableALL."></td>";
-          }else{
-            $str .= "\n<td><input type='checkbox' name='FAIpartitionFlags_".$key."' value='preserve' ".$changeState." ".$disableALL."></td>";
-          }
-          if($part['FAIencrypted']!=false){
-            $str .= "\n<td><input type='checkbox' name='FAIencrypted_".$key."' value='encrypted' checked></td>";
-          }else{
-            $str .= "\n<td><input type='checkbox' name='FAIencrypted_".$key."' value='encrypted'></td>";
-          }
-        }else{
-          if($part['FAIpartitionFlags']!=false){
-            $str .= "<td>"._("False")."</td>";
-          }else{
-            $str .= "<td>"._("True")."</td>";
-          }
-          if($part['FAIencrypted']!=false){
-            $str .= "<td>"._("False")."</td>";
-          }else{
-            $str .= "<td>"._("True")."</td>";
-          }
-        }
-        if($this->acl_is_removeable()){
-          $str .= "\n<td><input type='submit' name='Delete_".$key."' value='"._("Remove")."' ".$disableALL."></td>";    
-        }else{
-          $str .= "\n<td><input type='submit' name='restricted' disabled value='"._("Remove")."'></td>";    
-        }
-        $str .= "\n</tr>";    
-      }
-    }
-    
-    if(!empty($str)){
-      $str = "<table summary='' style='width:100%'>".$str."</table>";
-    }
-    return($str);
-
-  }
-
-  function save()
-  {
-    $tmp = array();
-    $tmp['cn']          = $this->DISKcn;
-
-    /* Attach partitions */
-    foreach($this->partitions as $key=>$val) {
-      if (isset($this->partitions[$key]['FAIencrypted']) && $this->partitions[$key]['FAIencrypted']){
-        unset ($this->partitions[$key]['FAIencrypted']);
-        $this->partitions[$key]['FAIfsType']= "_".$this->partitions[$key]['FAIfsType'];
-      }
-      $this->partitions[$key]['FAIpartitionNr']=$key;
-    }
-
-    /* Attach deleted */
-    foreach($this->deletePartitions as $key=>$val) {
-      $this->partitions[$key."-delete"]=$val;
-      $this->partitions[$key."-delete"]['status']="delete";
-    }
-
-    $tmp['description'] = $this->DISKdescription;
-    $tmp['partitions']  = $this->partitions;
-    $tmp['status']      = $this->status;
-
-    /* If hdd name has changed, tell partitionTable to rename it */
-    if(($this->is_edit)&&($this->old_cn != $this->DISKcn)){
-      $tmp['rename']['from']  = $this->old_cn;
-      $tmp['rename']['to']    = $this->DISKcn;
-    }
-    return($tmp);
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-
-
-    if((isset($_POST['TableEntryFrameSubmitted'])) && ($this->FAIstate != "freeze") ){
-      plugin::save_object();
-
-      foreach($this->partitions as $key => $part){
-        foreach($this->UsedAttrs as $attrs){
-
-          if($this->acl_is_writeable($attrs)){
-
-            if(isset($_POST[$attrs."_".$key])){
-              $this->partitions[$key][$attrs] = $_POST[$attrs."_".$key];
-            }else{
-              $this->partitions[$key][$attrs] = false;
-            }
-          }
-        }
-
-        if($this->acl_is_writeable("FAIencrypted")){
-
-          if(isset($_POST["FAIencrypted_".$key])){
-            $this->partitions[$key]["FAIencrypted"] = $_POST["FAIencrypted_".$key];
-          }else{
-            $this->partitions[$key]["FAIencrypted"] = false;
-          }
-        }
-      }
-    }
-  }
-
-
-  /* Check supplied data */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-  
-    /* Check for an empty disk name */
-    if(empty($this->DISKcn)){
-      $message[] = _("Please specify a valid disc name.");
-    }
-       
-    /* check every partition.
-     * if there is an invalid value defined, append an errorstr to message
-     */
-
-    /* Array that contain every partitionname mountpoint etc already assigned */
-    $alreadyUsed    = array();
-    foreach($this->UsedAttrs as $attrs){
-      $alreadyUsed[$attrs] = array();
-    }      
-
-    foreach($this->partitions as $key => $part){
-  
-      /* Skip all checks, if preserve is set */ 
-      if($part['FAIpartitionFlags'] == "preserve"){
-        $this->partitions[$key]['FAIfsType']        = "preserve";
-        $this->partitions[$key]['FAIpartitionSize'] = "preserve";
-        continue;
-      }
-      if((in_array($part['FAImountPoint'],$alreadyUsed['FAImountPoint']))&&($part['FAIfsType']!="swap")){
-        $message[]=sprintf(_("please enter a unique mount point for partition %s"),($key));
-      }
-
-      if($part['FAIfsType']!="swap" && $part['FAImountPoint'] != "-"){
-        if((empty($part['FAImountPoint']))||(!((preg_match("/^\/.*/",$part['FAImountPoint']))||(preg_match("/^swap$/",$part['FAImountPoint']))))){
-          $message[]=sprintf(_("Please enter a valid mount point for partition %s." ),($key));
-        }
-      }
-      if($part['FAIfsType'] == "swap"){
-        if(in_array($part['FAIfsType'],$alreadyUsed['FAIfsType'])){
-          $message[]=sprintf(_("File system type 'swap' is already used, change file system type for partition %s."),$key);
-        }
-      }
-      if(($part['FAIfsType'] == "swap")&&(!empty($part['FAImountPoint']))&&($part['FAImountPoint']!="swap")){
-        $message[]=_("Please use 'swap' as mount point, if 'swap' is used as fs-type.");
-      }
-
-      $tmp = split("-",$part['FAIpartitionSize']);
-      switch (count($tmp)){
-        case 0:
-                $message[]= sprintf(_("Please enter a valid partition size for partition %s."),($key));
-                break;
-        case 1:
-                if (!is_id(is_id($tmp[0])) &&(!empty($tmp[1]))){
-                  $message[]= sprintf(_("Please enter a valid partition size for partition %s."),($key));
-                }
-                break;
-                
-        case 2:
-                if((!is_id($tmp[0]))&&(!is_id($tmp[1])) &&(!empty($tmp[1]))){
-                  $message[]=sprintf(_("Please enter a valid range for partition %s."),($key)); 
-                }elseif($tmp[0]>=$tmp[1]){
-                  $message[]=sprintf(_("Please enter a valid range for partition %s."),($key));
-                }
-                break;
-
-        default:
-                $message[]=sprintf(_("Please enter a range for partition size for partition %s."),($key));
-      }
-
-      foreach($this->UsedAttrs as $attrs){
-        $alreadyUsed[$attrs][$key] = $part[$attrs];
-      }      
-    }
-
-    $cnt = 0;
-    foreach($this->partitions as $key => $part){
-      if($part['FAIpartitionType'] == "primary"){
-        $cnt ++ ; 
-      }
-    }
-    if($cnt > 3){
-      $message[] = _("You have more than 3 primary partition table entries in your configuration, please check your configuration twice.");
-    }
-
-    return ($message);
-  }
-
-  
-
-  /* Return plugin informations for acl handling */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName" => _("Partition table entry"),
-          "plDescription" => _("FAI partition table entry"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 27,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("fai"),
-          "plProvidedAcls" => array(
-            "DISKcn"           => _("Name"),
-            "DISKdescription"  => _("Description"),
-            "FAIpartitionType"  => _("Partition type"),
-            "FAIpartitionNr"    => _("Partition no."),
-            "FAIfsType"         => _("File system type"),
-            "FAImountPoint"     => _("Mount point"),
-            "FAIpartitionSize"  => _("Partition size"),
-            "FAImountOptions"   => _("Mount options"),
-            "FAIfsOptions"      => _("File system options"),
-            "FAIencrypted"      => _("File system encryption"),
-            "FAIpartitionFlags" => _("Partition flags"))
-          ));
-  }
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/fai/class_faiProfile.inc b/plugins/admin/fai/class_faiProfile.inc
deleted file mode 100644 (file)
index 4b5daea..0000000
+++ /dev/null
@@ -1,501 +0,0 @@
-<?php
-
-class faiProfile 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;
-
-  /* Attributes for this Object */
-  var $attributes       = array("cn","description","FAIclass");
-
-  /* ObjectClasses for this Object*/
-  var $objectclasses    = array("top","FAIclass","FAIprofile");
-
-  /* Specific attributes */
-  var $old_cn           = "";
-  var $cn               = "";       // The class name for this object
-  var $description      = "";       // The description for this set of partitions
-  var $is_dialog        = false;    // specifies which buttons will be shown to save or abort
-  var $FAIclass         = "";       // Classnames used for this profile
-  var $FAIclasses       = array();  // Contains classname seperated in an array
-  var $FAIAllclasses    = array();  // Contains all possible Classnames
-  var $ui               ;
-  var $FAIstate      = "";
-  var $view_logged      = FALSE;
-
-  function faiProfile(&$config, $dn= NULL)
-  {
-    /* Load Attributes */
-    plugin::plugin ($config, $dn);
-    $ldap=$this->config->get_ldap_link();
-
-    $this->ui = get_userinfo();
-
-    /* Parse ldap attribute to get all assigned classes */
-    $tmp = split(" ",$this->FAIclass);
-    $tmp2 = array();
-    foreach($tmp as $class){
-      if(!empty($class)){
-        $tmp2[trim($class)] = trim($class);
-      }
-    }
-
-    if(isset($this->attrs['FAIstate'][0])){
-      $this->FAIstate = $this->attrs['FAIstate'][0];
-    }
-
-    /* Sort assigned classes */ 
-    if(is_array($tmp2)){
-      foreach($tmp2 as $class){
-        $this->FAIclasses[$class]=$class;
-      }
-    }
-
-    $categories = array("FAIscript","FAItemplate","FAIhook","FAIvariable","FAIpartitionTable","FAIpackageList");
-
-    /* Build filter */
-    $filter= "";
-    foreach ($categories as $cat){
-      $filter.= "(objectClass=$cat)";
-    }
-    
-    /* Get ldap connection */ 
-    $base = $_SESSION['CurrentMainBase'];
-    $ldap->cd($base);
-    $sort = array();
-
-    /* search all FAI classes */
-    $ldap->search("(|$filter)",array("*"));
-    while($attrs = $ldap->fetch()){
-
-      /* Sort by categorie */
-      foreach($categories as $cat){
-        if(in_array($cat,$attrs['objectClass'])){
-
-          /* Append entry */
-          $this->FAIAllclasses[$attrs['cn'][0]][$cat]=$attrs;
-  
-          /* Create sort array, because the array above is a multidimensional array, and can't be sorted by php sorting functions*/
-          $sort[strtolower($attrs['cn'][0])] = $attrs['cn'][0];
-        }
-      }
-    } 
-
-    /* Sort the sort array */
-    //ksort($sort);
-
-    /* Reorder the FAIclasses array */
-    foreach($sort as $name){
-      $tmp[$name] =$this->FAIAllclasses[$name];
-    }
-
-    /* Assign sorted classes */
-    $this->FAIAllclasses = array();
-    $this->FAIAllclasses = $tmp;
-
-    if($dn != "new"){
-      $this->dn =$dn;
-    }
-    $this->old_cn   = $this->cn;
-  }
-
-
-  /* Combine new array, used for up down buttons */
-  function combineArrays($ar0,$ar1,$ar2)
-  {
-    $ret = array();
-    if(is_array($ar0))
-      foreach($ar0 as $ar => $a){
-        $ret[$ar]=$a;
-      }
-    if(is_array($ar1))
-      foreach($ar1 as $ar => $a){
-        $ret[$ar]=$a;
-      }
-    if(is_array($ar2))
-      foreach($ar2 as $ar => $a){
-        $ret[$ar]=$a;
-      }
-    return($ret);
-  }
-
-
-  function acl_base_for_current_object($dn)
-  {
-    if($dn == "new"){
-      if($this->dn == "new"){
-        $dn= $_SESSION['CurrentMainBase'];
-      }else{
-        $dn = $this->dn;
-      }
-    }
-    return($dn);
-  }
-
-
-  /* returns position in array */
-  function getpos($atr,$attrs)
-  {
-    $i = 0;
-    foreach($attrs as $attr => $name)    {
-      $i++;
-      if($attr == $atr){
-        return($i);
-      }
-    }
-    return(-1);
-  }
-
-  /* Transports the given 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 given Arraykey one position down*/
-  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);
-  }
-
-  /* class one position up */
-  function catUp($id)
-  {
-    /* Get all cats depinding on current dir */
-    $cats = $this->FAIclasses;
-    $this->FAIclasses =$this->ArrayUp($id,$cats);
-  }
-
-  /* Class one position down */
-  function catDown($id)
-  {
-    /* Get all cats depinding on current dir */
-    $cats = $this->FAIclasses;
-    $this->FAIclasses =$this->ArrayDown($id,$cats);
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","fai/".get_class($this),$this->dn);
-    }
-
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-    $display= "";
-
-    $s_entry = "";
-    $s_action = "";
-
-    /* Remove class name From list */
-    $sort_once = false;
-    foreach($_POST as $name => $post){
-      if(preg_match("/DEL_/i",$name) && $this->acl_is_writeable("FAIclass")){
-        $s_action = "delete";
-        $s_entry  = preg_replace("/DEL_/","",$name);
-        $s_entry  = base64_decode(preg_replace("/_.*$/","",$s_entry));
-      }elseif(preg_match("/Add_class/i",$name)&& $this->acl_is_writeable("FAIclass")){
-        $s_action  = "add";
-      }elseif(preg_match("/DelClass/i",$name) && $this->acl_is_writeable("FAIclass")){
-        $s_action  = "delete";
-        $s_entry = $_POST['FAIclass'];
-      }elseif(preg_match("/AddClass/i",$name) && $this->acl_is_writeable("FAIclass")){
-        $s_action  = "add";
-      }
-
-      /* Check if a list element should be pushed one position up */
-      if((preg_match("/sortup_/",$name))&&(!$sort_once) && $this->acl_is_writeable("FAIclass")){
-        $sort_once = true;
-        $val = preg_replace("/sortup_/","",$name);
-        $val = preg_replace("/_.*$/","",$val);
-        $val = base64_decode($val);
-        $this->catUp($val);
-      }
-      
-      /* Check if a list element should be pushed one position down */
-      if((preg_match("/sortdown_/",$name))&&(!$sort_once) && $this->acl_is_writeable("FAIclass")){
-        $sort_once = true;
-        $val = preg_replace("/sortdown_/","",$name);
-        $val = preg_replace("/_.*$/","",$val);
-        $val = base64_decode($val);
-        $this->catDown($val);
-      }
-
-    }
-
-    if($s_action == "delete" && $this->acl_is_writeable("FAIclass")){
-      unset($this->FAIclasses[$s_entry]);
-    }
-
-    if($s_action == "add" && $this->acl_is_writeable("FAIclass")){
-      $this->dialog = new faiProfileEntry($this->config,$this->dn,$this->FAIclasses);
-      $this->is_dialog  =true;
-    }
-
-    /* Save Dialog */
-    if(isset($_POST['SaveSubObject'])){
-      $this->dialog->save_object();
-      $msgs= $this->dialog->check();
-      if(count($msgs)){
-        print_red($msgs);
-      }else{
-        $ret = $this->dialog->save();
-        foreach($ret as $class){
-          $this->FAIclasses[$class] =$class; 
-        }
-        $this->is_dialog=false;
-        unset($this->dialog);
-        $this->dialog=FALSE;
-        //ksort($this->FAIclasses);
-      }
-    }
-
-    /* Cancel Dialog */
-    if(isset($_POST['CancelSubObject'])){
-      $this->is_dialog=false;
-      unset($this->dialog);
-      $this->dialog=FALSE;
-    }
-
-    if(is_object($this->dialog)){
-      $this->dialog->save_object();
-      return($this->dialog->execute());
-    }
-
-    $divlist  =new divSelectBox("Profile");
-    $divlist->SetSummary(_("This list displays all assigned class names for this profile."));
-
-    /* item images */
-    $objTypes['FAIhook']            = "<img src='images/fai_hook.png' title='"._("Hook bundle")."' alt=''>";
-    $objTypes['FAItemplate']        = "<img src='images/fai_template.png' title='"._("Template bundle")."' alt=''>";
-    $objTypes['FAIscript']          = "<img src='images/fai_script.png' title='"._("Script bundle")."' alt=''>";
-    $objTypes['FAIvariable']        = "<img src='images/fai_variable.png' title='"._("Variable bundle")."' alt=''>";
-    $objTypes['FAIpackageList']        = "<img src='images/fai_packages.png' title='"._("Packages bundle")."' alt=''>";
-    $objTypes['FAIpartitionTable']  = "<img src='images/fai_partitionTable.png' title='"._("Partition table")."' alt=''>";
-
-    /* Delete button */
-    $actions = "<input type='image' src='images/edittrash.png' title='"._("Remove class from profile")."' name='DEL_%KEY%'>"; 
-    
-    /* Up down buttons */
-    $linkupdown = "&nbsp;<input type='image' name='sortup_%s'   alt='up'    title='"._("Up")."'   src='images/sort_up.png' align='top' >";
-    $linkupdown.= "<input type='image' name='sortdown_%s' alt='down'  title='"._("Down")."' src='images/sort_down.png' >";
-
-    /* Append fai classes to divlist */
-    if($this->acl_is_readable("FAIclass")){
-      foreach($this->FAIclasses as $usedClass){
-        $str = "&nbsp;";
-        $act = "";
-
-        if(isset($this->FAIAllclasses[$usedClass])){
-          foreach($this->FAIAllclasses[$usedClass] as $class => $obj){
-            $str.= $objTypes[$class]; 
-          }
-        }
-
-        $field1 = array("string"=> $usedClass,"attach"=>"");
-        $field2 = array("string"=> $str,"attach"=>"");
-        if(($this->FAIstate != "freeze") && $this->acl_is_writeable("FAIclass")){
-          $field3 = array("string"=> preg_replace("/%KEY%/",base64_encode($usedClass),$actions).
-              preg_replace("/%s/",base64_encode($usedClass),$linkupdown),
-              "attach"=>"style='border-right:none;'");
-        }else{
-          $field3 = array("string"=>"&nbsp;", "attach"=>"style='border-right:none;'");
-        }
-        $divlist->AddEntry(array($field1,$field2,$field3));
-      }
-    }
-
-    $smarty->assign("FAIclasses"  ,$this->FAIclasses);
-    $smarty->assign("divlist"     ,$divlist->DrawList());
-
-    /* Magic quotes GPC, escapes every ' " \, to solve some security risks
-     * If we post the escaped strings they will be escaped again
-     */
-    foreach($this->attributes as $attrs){
-      if(get_magic_quotes_gpc()){
-        $smarty->assign($attrs,stripslashes($this->$attrs));
-      }else{
-        $smarty->assign($attrs,($this->$attrs));
-      }
-    }
-
-    
-    $dn = $this->acl_base_for_current_object($this->dn);
-    $smarty->assign("sub_object_is_addable",
-        preg_match("/c/",$this->ui->get_permissions($dn,"fai/faiScriptEntry")) &&
-        !preg_match("/freeze/",$this->FAIstate));
-
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translated){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-
-    $display.= $smarty->fetch(get_template_path('faiProfile.tpl', TRUE));
-    return($display);
-  }
-
-  function remove_from_parent()
-  {
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd ($this->dn);
-
-#    $use_dn = str_ireplace( get_release_dn($this->dn), $_SESSION['faifilter']['branch'], $this->dn);
-    $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $this->dn);
-    if($_SESSION['faifilter']['branch'] == "main"){
-      $use_dn = $this->dn;
-    }
-
-    new log("remove","fai/".get_class($this),$use_dn,$this->attributes);
-    prepare_to_save_FAI_object($use_dn,array(),true);
-    $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();
-
-    if(count($this->FAIclasses) == 0){
-      $message[]=_("Please assign at least one class to this  profile.");
-    }
-
-    if(empty($this->cn)){
-      $message[]=_("Please enter a valid name.");
-    }
-
-    $ldap = $this->config->get_ldap_link();
-
-    $base = $_SESSION['faifilter']['branch'];
-    if($base == "main"){
-      $base =$_SESSION['CurrentMainBase'];
-    }
-    $base = "ou=profiles,".$base;
-  
-    $ldap->cd($base);
-    if ($this->old_cn == ""){
-      $ldap->ls("(&(objectClass=FAIprofile)(cn=".$this->cn."))",$base,array("*"));
-    } else {
-      $ldap->ls("(&(objectClass=FAIprofile)(cn=".$this->cn.")(!cn=".$this->old_cn."))",$base,array("*"));
-    }
-
-    if($ldap->count() || isset($this->FAIAllclasses[$this->cn])){
-      $message[]=_("There is already a FAI object with this class name defined.");
-    }
-
-    return ($message);
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    plugin::save();
-
-    $ldap = $this->config->get_ldap_link();
-
-    $this->FAIclass = "";
-    foreach($this->FAIclasses as $class){
-      $this->FAIclass.=$class." ";
-    }
-
-    $this->attrs['FAIclass']=trim($this->FAIclass);
-
-    prepare_to_save_FAI_object($this->dn,$this->attrs);
-   
-    if($this->initially_was_account){
-      new log("modify","fai/".get_class($this),$this->dn,$this->attributes);
-    }else{
-      new log("create","fai/".get_class($this),$this->dn,$this->attributes);
-    }
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of FAI/profile with dn '%s' failed."),$this->dn));
-
-    /* Do object tagging */
-    $this->handle_object_tagging();
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of FAI/profile with dn '%s' failed."),$this->dn));
-  }
-
-
-  function PrepareForCopyPaste($source)
-  {
-    plugin::PrepareForCopyPaste($source);
-
-    /* Parse ldap attribute to get all assigned classes */
-    $tmp = split(" ",$this->FAIclass);
-    $tmp2 = array();
-    foreach($tmp as $class){
-      if(!empty($class)){
-        $tmp2[trim($class)] = trim($class);
-      }
-    }
-
-    /* Sort assigned classes */
-    if(is_array($tmp2)){
-      foreach($tmp2 as $class){
-        $this->FAIclasses[$class]=$class;
-      }
-    }
-  }
-
-
-  /* Return plugin informations for acl handling */ 
-  static function plInfo()
-  {
-    return (array( 
-          "plShortName" => _("Profile"),
-          "plDescription" => _("FAI profile"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 30,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("fai"),
-          "plProvidedAcls" => array(
-            "cn"                => _("Name"),
-            "description"       => _("Description"),
-            "FAIclass"          => _("FAI classes"))
-          ));
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/fai/class_faiProfileEntry.inc b/plugins/admin/fai/class_faiProfileEntry.inc
deleted file mode 100644 (file)
index 2d9b097..0000000
+++ /dev/null
@@ -1,277 +0,0 @@
-<?php
-
-class faiProfileEntry 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();
-
-  /* Array with available class names */
-  var $FAIAllclasses        = array();
-  var $ui;
-
-  function faiProfileEntry (&$config, $dn= NULL,$used=array(),$objects=false)
-  {
-    plugin::plugin ($config, $dn);
-
-    /* Search only in fai tree */
-    $base = "ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase'];
-    if($_SESSION['faifilter']['branch']!="main"){
-      $base = $_SESSION['faifilter']['branch'];
-    }
-  
-    $this->ui = get_userinfo();
-
-    $filter = "(|(objectClass=FAIscript)(objectClass=FAItemplate)(objectClass=FAIhook)".
-                "(objectClass=FAIvariable)(objectClass=FAIpartitionTable)(objectClass=FAIpackageList))";
-
-    $FAI_objects = get_all_objects_for_given_base($base,$filter,true);
-
-    /* Create array with categories to be able to sort different types of objects */
-    $categories = array("FAIscript"         => "faiScript",
-                        "FAItemplate"       => "faiTemplate",
-                        "FAIhook"           => "faiHook",
-                        "FAIvariable"       => "faiVariable",
-                        "FAIpartitionTable" => "faiPartitionTable",
-                        "FAIpackageList"    => "faiPackageList");
-
-    /* Read out all objects from fai tree */
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd($base);
-    $sort=array();
-    foreach($FAI_objects as $obj){
-
-      $ldap->cat($obj['dn']);
-      $attrs = $ldap->fetch();
-
-      /* Only use objects which have cn set */
-      if((isset($attrs['cn'][0]))&&(!in_array($attrs['cn'][0],$used))){
-        foreach($categories as $cat => $acl){
-          if(in_array($cat,$attrs['objectClass'])){
-
-            $acl =  $this->ui->get_permissions($attrs['dn'],"fai/".$acl); 
-
-            /* Append different types of objects */
-            $this->FAIAllclasses[$attrs['cn'][0]]['objects'][$cat]=$cat;
-
-            if(!isset($this->FAIAllclasses[$attrs['cn'][0]]['acl'])){
-              $this->FAIAllclasses[$attrs['cn'][0]]['acl']="";
-            }
-            $this->FAIAllclasses[$attrs['cn'][0]]['acl'].=$acl;
-
-            /* Set selected status to false */
-            $this->FAIAllclasses[$attrs['cn'][0]]['status']=false;
-
-            $sort[strtolower($attrs['cn'][0])] = $attrs['cn'][0];
-          }
-        } 
-      }
-    }
-
-
-    $tmp = array();
-    ksort($sort);
-    foreach($sort as $name){
-      $tmp[$name] =$this->FAIAllclasses[$name];
-    }
-    $this->FAIAllclasses = array();
-    $this->FAIAllclasses = $tmp;
-
-    /* If no search filter is set, create one */
-    if (!is_global("SUBfaifilter")){
-      $SUBfaifilter= array("base" => "ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase'], "Sregex" => "*");
-      $SUBfaifilter['SShowTemplates'] = true;
-      $SUBfaifilter['SShowScripts']   = true;
-      $SUBfaifilter['SShowHooks']     = true;
-      $SUBfaifilter['SShowVariables'] = true;
-      $SUBfaifilter['SShowPackages']  = true;
-      $SUBfaifilter['SShowPartitions']= true;
-      register_global("SUBfaifilter", $SUBfaifilter);
-    }
-  }
-
-  function execute()
-  {
-       /* Call parent execute */
-       plugin::execute();
-
-    /* Fill templating stuff */
-    $smarty     = get_smarty();
-    $display = "";
-
-    $SUBfaifilter = $_SESSION['SUBfaifilter'];
-
-    /* If someone used the apply button, update searchfilter */
-    if(isset($_POST['Sregex'])){
-      foreach($SUBfaifilter as $key => $val){
-        if(!isset($_POST[$key])){
-          $SUBfaifilter[$key] = false;
-        }else{
-          $SUBfaifilter[$key] =$_POST[$key];
-        }
-      }
-      $SUBfaifilter['Sregex']= $_POST['Sregex'];
-      if(!strstr($SUBfaifilter['Sregex'],"*")){
-        $SUBfaifilter['Sregex'] = $SUBfaifilter['Sregex']."*";
-      }
-    }
-  
-    /* Save current searchfilter in session*/
-    $_SESSION['SUBfaifilter']= $SUBfaifilter;
-
-    /* Check if we used a checkboxe from the list, to select dselect an entry */
-    foreach($_POST as $name => $value){
-      foreach($this->FAIAllclasses as $class => $obj){
-        $bclass = base64_encode($class);
-        if(isset($_POST["ON_PAGE_".$bclass])){
-          if(isset($_POST['USE_'.$bclass])){
-            $this->FAIAllclasses[$class]['status']=true;  
-          }else{
-            $this->FAIAllclasses[$class]['status']=false;  
-          }    
-        }
-      }
-    }
-
-    /* Create different picture for each object type */
-    $objTypes['FAIhook']            = "<img src='images/fai_hook.png' title='"._("Hook bundle")."' alt=''>&nbsp;";
-    $objTypes['FAItemplate']        = "<img src='images/fai_template.png' title='"._("Template bundle")."' alt=''>&nbsp;";
-    $objTypes['FAIscript']          = "<img src='images/fai_script.png' title='"._("Script bundle")."' alt=''>&nbsp;";
-    $objTypes['FAIvariable']        = "<img src='images/fai_variable.png' title='"._("Variable bundle")."' alt=''>&nbsp;";
-    $objTypes['FAIpackageList']     = "<img src='images/fai_packages.png' title='"._("Package bundle")."' alt=''>&nbsp;";
-    $objTypes['FAIpartitionTable']  = "<img src='images/fai_partitionTable.png' title='"._("Partition table")."' alt=''>&nbsp;";
-
-    /* Magic quotes GPC, escapes every ' " \, to solve some security risks
-     * If we post the escaped strings they will be escaped again
-     */
-    foreach($this->attributes as $attrs){
-      if(get_magic_quotes_gpc()){
-        $smarty->assign($attrs,stripslashes($this->$attrs));
-      }else{
-        $smarty->assign($attrs,($this->$attrs));
-      }
-    }
-
-    /* Assign all filter attributes to smarty */
-    foreach($SUBfaifilter as $key => $val){
-      if(($key != "base")&&($key != "Sregex")){
-        if($val){
-          $smarty->assign($key."CHK", " checked ");
-        }else{
-          $smarty->assign($key."CHK", "");
-        }
-      }else{
-        $smarty->assign($key,$val);
-      }
-    }
-  
-    /* Create a divlist to display all available class names with the depending object types */
-    $divlist = new divlist("ProfileEntry");
-    $divlist->SetPluginMode();
-    $divlist->SetSummary(_("This list displays all assigned class names for this profile."));
-    $divlist->SetEntriesPerPage(0);
-    $divlist->SetHeader(array(array("string"=> _("Class name")),
-                              array("string"=> _("Objects"),"attach"=>"style='border-right:0px;'")));
-
-    /* Action button allows us to delete an entry */
-    $action = "<input type='hidden' name='ON_PAGE_%KEY%' value='1'>
-              <input type='checkbox' name='USE_%KEY%' value='%KEY%' onClick='document.mainform.submit();' %CHECK%>";
-
-    /* Check every single class name to match the current search filter */
-    foreach($this->FAIAllclasses as $usedClass => $classes){
-
-      /* Skip those entries that we are not allowed to read. */
-      if(!preg_match("/r/",$classes['acl'])){
-        continue;
-      }
-
-      $fi = str_replace("*",".*",$SUBfaifilter['Sregex']);  
-      $abort = true; 
-      if(!preg_match("/".$fi."/",$usedClass)){
-        $abort = false;
-      }
-      if((isset($classes['objects']['FAIscript']))&&($SUBfaifilter['SShowScripts'])){
-        $abort = false;
-      }
-      if((isset($classes['objects']['FAItemplate']))&&($SUBfaifilter['SShowTemplates'])){
-        $abort = false;
-      }
-      if((isset($classes['objects']['FAIhook']))&&($SUBfaifilter['SShowHooks'])){
-        $abort = false;
-      }
-      if((isset($classes['objects']['FAIvariable']))&&($SUBfaifilter['SShowVariables'])){
-        $abort = false;
-      }
-      if((isset($classes['objects']['FAIpartitionTable']))&&($SUBfaifilter['SShowPartitions'])){
-        $abort = false;
-      }
-      if((isset($classes['objects']['FAIpackageList']))&&($SUBfaifilter['SShowPackages'])){
-        $abort = false;
-      }
-
-      if(!$abort){
-        $str = "";
-        foreach($classes['objects'] as $class => $obj){
-          $str.= $objTypes[$obj];
-        }
-
-        /* Is this entry selected */ 
-        if($classes['status']==true){
-          $action_check = preg_replace("/%CHECK%/"," checked ",$action);
-        }else{
-          $action_check = preg_replace("/%CHECK%/","",$action);
-        }      
-        
-        /* Append to list */
-        $field1 = array("string"=> str_replace("%KEY%",base64_encode($usedClass),$action_check).$usedClass,"attach"=>"");
-        $field2 = array("string"=> $str,"attach"=>"style='border-right:0px;'");
-        $divlist->AddEntry(array($field1,$field2));
-      }
-    }
-
-    $smarty->assign("faihead"       , "");
-    $smarty->assign("failist"       , $divlist->DrawList());
-    $smarty->assign("infoimage"     , get_template_path('images/info_small.png'));
-    $smarty->assign("launchimage"   , get_template_path('images/small_filter.png'));
-    $smarty->assign("alphabet"      , generate_alphabet());
-    $smarty->assign("apply"         , apply_filter(TRUE));
-    $smarty->assign("search_image"  , get_template_path('images/search.png'));
-
-    $display.= $smarty->fetch(get_template_path('faiProfileEntry.tpl', TRUE));
-    return($display);
-  }
-
-  /* Save data to object */
-  function save_object()
-  {
-  }
-
-  /* Check supplied data */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    return ($message);
-  }
-
-  function save()
-  {
-    $tmp = array();
-    foreach($this->FAIAllclasses as $class => $obj){
-      if($obj['status']==true){
-        $tmp[$class]=$class;
-      }
-    }
-    return($tmp);
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/fai/class_faiScript.inc b/plugins/admin/fai/class_faiScript.inc
deleted file mode 100644 (file)
index 928aa0e..0000000
+++ /dev/null
@@ -1,658 +0,0 @@
-<?php
-
-class faiScript 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;
-
-  /* Attributes for this Object */
-  var $attributes       = array("cn","description");
-
-  /* ObjectClasses for this Object*/
-  var $objectclasses    = array("top","FAIclass","FAIscript");
-
-  /* Class name of the Ldap ObjectClass for the Sub Object */
-  var $subClass         = "FAIscriptEntry";
-  var $subClasses       = array("top","FAIclass","FAIscriptEntry");
-
-  /* Class name of the php class which allows us to edit a Sub Object */
-  var $subClassName     = "faiScriptEntry";      
-
-  /* Attributes to initialise for each subObject */
-  var $subAttributes    = array("cn","description","FAIpriority"); 
-  var $sub_Load_Later   = array("FAIscript");
-  var $sub64coded       = array();
-  var $subBinary        = array("FAIscript");
-
-  /* Specific attributes */
-  var $cn               = "";       // The class name for this object
-  var $description      = "";       // The description for this set of partitions
-  var $is_dialog        = false;    // specifies which buttons will be shown to save or abort
-  var $SubObjects       = array();  // All leafobjects of this object
-
-  var $FAIstate         = "";
-  var $sort_by          = "name";
-  var $sort_order       = "up";
-
-  var $view_logged = FALSE;
-  var $ui;
-
-  function faiScript (&$config, $dn= NULL)
-  {
-    /* Load Attributes */
-    plugin::plugin ($config, $dn);
-
-    /* If "dn==new" we try to create a new entry
-     * Else we must read all objects from ldap which belong to this entry.
-     * First read SubObjects from ldap ... and then the partition definitions for the SubObjects.
-     */
-    if($dn != "new"){
-
-      $this->dn =$dn;
-
-      /* Get FAIstate
-       */
-      if(isset($this->attrs['FAIstate'][0])){
-        $this->FAIstate = $this->attrs['FAIstate'][0];
-      }
-
-      /* Read all leaf objects of this object (For FAIscript this would be FAIscriptEntry)
-       */
-      $ldap     = $this->config->get_ldap_link();
-      $ldap->cd ($this->dn);
-      
-      $attrs_to_search = $this->subAttributes;
-      $attrs_to_search[] = "FAIstate";
-      $ldap->search("(&(objectClass=FAIclass)(objectClass=".$this->subClass."))",$attrs_to_search);
-
-      while($object = $ldap->fetch()){
-
-        /* Skip objects, that are tagged as removed */
-        if(isset($object['FAIstate'][0])){
-          if(preg_match("/removed$/",$object['FAIstate'][0])){
-            continue;
-          }
-        }
-
-        /* Set status for save management */
-        $objects = array();
-        $objects['status']      = "FreshLoaded";
-        $objects['dn']          = $object['dn'];
-        $objects                = $this->get_object_attributes($objects,$this->subAttributes);
-        $this->SubObjects[$objects['cn']] = $objects;
-      }
-    
-    }
-    $this->ui = get_userinfo();
-  }
-
-
-  /* Reload some attributes */
-  function get_object_attributes($object,$attributes)
-  {
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->cat($object['dn'],$attributes);
-    $tmp  = $ldap->fetch();
-
-    foreach($attributes as $attrs){
-      if(isset($tmp[$attrs][0])){
-        $var = $tmp[$attrs][0];
-
-        /* Check if we must decode some attributes */
-        if(in_array_ics($attrs,$this->sub64coded)){
-          $var = base64_decode($var);
-        }
-
-        /*  check if this is a binary entry */
-        if(in_array_ics($attrs,$this->subBinary)){
-          $var = $ldap->get_attribute($object['dn'], $attrs,$r_array=0);
-        }
-
-        /* Fix slashes */
-        $var = addslashes($var);
-        $object[$attrs] = $var;
-      }
-    }
-    return($object);
-  }
-
-  
-  /* Return a valid dn to fetch acls. Because 'new' will not work. */
-  function acl_base_for_current_object($dn)
-  {
-    if($dn == "new"){
-      if($this->dn == "new"){
-        $dn= "cn=dummy,".$_SESSION['CurrentMainBase'];
-      }else{
-        $dn = $this->dn;
-      }
-    }
-    return($dn);
-  }
-
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","fai/".get_class($this),$this->dn);
-    }
-
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-    $display= "";
-
-    /* Add new sub object */
-    if(isset($_POST['AddSubObject'])){
-      $this->dialog= new $this->subClassName($this->config,"new");
-      $this->dialog->set_acl_base($this->acl_base);
-      $this->dialog->set_acl_category("fai");
-      $this->dialog->parent = &$this;
-      $this->is_dialog=true;
-    }
-
-    if($this->dn != "new"){
-      $_SESSION['objectinfo']= $this->dn;
-    }
-
-    /* Handle posts */
-    $s_action = $s_entry = "";
-    foreach($_POST as $name => $value){
-
-      /* Edit script posted */
-      if(preg_match("/^editscript_/",$name)){
-        $s_action = "edit";
-        $s_entry = preg_replace("/^editscript_/","",$name);
-        $s_entry = base64_decode(preg_replace("/_.*/","",$s_entry));
-        break;
-      }
-
-      /* Delete script requested */
-      if(preg_match("/^deletescript_/",$name)){
-        $s_action = "remove";
-        $s_entry = preg_replace("/^deletescript_/","",$name);
-        $s_entry = base64_decode(preg_replace("/_.*/","",$s_entry));
-        break;
-      }
-    }
-
-    if(isset($_GET['act']) && $_GET['act'] == "edit" && isset($_GET['id'])){
-      $s_entry = $_GET['id'];
-      if(isset($this->SubObjects[$s_entry])){
-        $s_action = "edit";
-      }
-    }
-
-    if($s_action =="edit" && isset($this->SubObjects[$s_entry])){
-
-      /* Get object, and load missing entry values */
-      $obj  = $this->SubObjects[$s_entry];
-      if($obj['status'] == "FreshLoaded"){
-        $obj  = $this->get_object_attributes($obj,$this->sub_Load_Later);
-      }
-
-      /* Create new dialog and set acl attributes  */
-      $this->dialog= new $this->subClassName($this->config,$this->dn,$obj);
-      $this->dialog->set_acl_base($this->acl_base_for_current_object($obj['dn']));
-      $this->dialog->set_acl_category("fai");
-
-      /* Assign some additional dialog informations like headline and parent  */
-      $_SESSION['objectinfo'] = $obj['dn'];
-      $this->dialog->parent = &$this;
-      $this->is_dialog=true;
-    }
-
-    /* Check acls, are we allowed to delete an entry */
-    if($s_action == "remove" && isset($this->SubObjects[$s_entry])){
-      $entry = $this->SubObjects[$s_entry];  
-      $acl = $this->ui->get_permissions($this->acl_base_for_current_object($entry['dn']),"fai/faiScriptEntry")  ;
-      if(preg_match("/d/",$acl)){
-        $status = $entry['status'];
-        if($status == "edited" || $status == "FreshLoaded"){
-          $this->SubObjects[$s_entry]['status']= "delete";
-        }else{
-          unset($this->SubObjects[$s_entry]);
-        }
-      }
-    }
-
-      /* Save the edited entry */
-    if(isset($_POST['SaveSubObject'])){
-
-      /* Check if there are still errors remaining that must be fixed before saving */
-      $this->dialog->save_object();
-      $msgs = $this->dialog->check();
-      if(count($msgs)>0){
-        foreach($msgs as $msg){
-          print_red($msg);
-        }
-      }else{
-
-        /* Get return object */
-        $obj = $this->dialog->save();
-
-        /* If we have renamed the script entry, we must remove the old entry */
-        if(isset($obj['remove'])){
-
-          /* Get old entry values */
-          $old_stat = $this->SubObjects[$obj['remove']['from']]['status'];
-
-          /* Depending on status, set new status */
-          if($old_stat == "edited" || $old_stat == "FreshLoaded"){
-            $this->SubObjects[$obj['remove']['from']]['status'] = "delete";
-          }elseif($this->SubObjects[$obj['remove']['from']]['status']=="new"){
-            unset($this->SubObjects[$obj['remove']['from']]);
-          }
-
-          /* Append the new entry */
-          $obj['status'] = "new";
-          $this->SubObjects[$obj['remove']['to']] = $obj;
-          unset($this->SubObjects[$obj['remove']['to']]['remove']);
-        }else{
-  
-          /* Set new status and append the entry */
-          if($obj['status'] == "FreshLoaded"){
-            $obj['status'] = "edited";
-          }
-          $this->SubObjects[$obj['cn']]=$obj;
-        }
-        $this->is_dialog=false;
-        unset($this->dialog);
-        $this->dialog=FALSE;
-
-      }
-    }
-
-    /* Sort entries */
-    $tmp = $keys = array();
-
-    if($this->sort_by == "name"){
-      foreach($this->SubObjects as $key => $entry){
-        $keys[$key]=$entry['cn'];
-      }
-    }elseif($this->sort_by == "priority"){
-      foreach($this->SubObjects as $key => $entry){
-        $keys[$key]=$entry['FAIpriority'];
-      }
-    }
-
-    natcasesort($keys);
-
-    if($this->sort_order == "down"){
-      $keys =array_reverse($keys);
-    }
-
-    foreach($keys as $key => $order_var){
-      $tmp[$key]=$this->SubObjects[$key];
-    }
-    $this->SubObjects = $tmp;
-
-    /* Cancel Dialog */
-    if(isset($_POST['CancelSubObject'])){
-      $this->is_dialog=false; 
-      unset($this->dialog);
-      $this->dialog=FALSE;
-    }
-
-    /* Print dialog if $this->dialog is set */
-    if(is_object($this->dialog)){
-      $this->dialog->save_object();
-      $display = $this->dialog->execute();
-      return($display);
-    }
-
-    /* Divlist            added 23.02.2006 
-       Containing FAIscripts 
-     */
-    $divlist = new divlist("FAIscripts");
-    $divlist->SetEntriesPerPage(0);
-    $plug = $_GET['plug'];
-   
-    if($this->sort_order == "up"){
-      $dir = "<img src='images/sort_up.png' title='"._("Sort direction")."' alt='\/' border=0>";
-    }else{
-      $dir = "<img src='images/sort_down.png' title='"._("Sort direction")."' alt='/\' border=0>";
-    }
-    if($this->sort_by == "name"){
-      $sort_name = $dir;
-      $sort_prio = "";
-    }else{
-      $sort_name = "";
-      $sort_prio = $dir;
-    }
-
-    $divlist->SetHeader(array(  array("string"=>"<a href='?plug=".$plug."&amp;sort=name'>"._("Name").$sort_name."</a>"),
-                                array("string"=>"<a href='?plug=".$plug."&amp;sort=priority'>".$sort_prio._("Priority")."</a>",
-                                      "attach"=>"style='width:100px;'"),
-                                array("string"=>_("Download"),
-                                      "attach"=>"style='width:100px;'"),
-                                array("string"=>_("Action"),
-                                      "attach"=>"style='border-right: 0px;width:100px;text-align:right;'")));
-    $divlist->SetHeight(300);
-    $divlist->SetWidth("100%");
-    foreach($this->getList(true) as $key => $name){
-
-      $dn= $this->acl_base_for_current_object($name['dn']);
-      $acl = $this->ui->get_permissions($dn,"fai/faiScriptEntry")  ;
-      $act = "";
-      
-      /* Hide delete icon if this object is freezed */
-      if($this->FAIstate == "freeze"){
-        $act .= "<input type='image' src='images/edit.png'      name='editscript_%s'    title='"._("edit")."' alt='"._("edit")."'>";
-      }else{
-        $act .= "<input type='image' src='images/edit.png'      name='editscript_%s'    title='"._("edit")."' alt='"._("edit")."'>";
-        if(preg_match("/d/",$acl)){
-          $act .="<input type='image' src='images/edittrash.png' name='deletescript_%s'  title='"._("delete")."' alt='"._("delete")."'>";
-        }
-      }
-
-      /* Check acls for download icon */
-      $s_acl = $this->ui->get_permissions($dn,"fai/faiScriptEntry","FAIscript")  ;
-      if(($this->SubObjects[$key]['status'] == "new") || ($this->SubObjects[$key]['dn'] == "new") || !preg_match("/r/",$s_acl)){
-        $down = "";
-      }else{
-        $down = "<a href='getFAIscript.php?id=".base64_encode($name['dn'])."' >
-          <img src='images/save.png' alt='"._("Download")."' title='"._("Download")."' border=0>
-          </a>"; 
-      } 
-
-      /* Check if we are allowed to view this object */
-      $s_acl = $this->ui->get_permissions($dn,"fai/faiScriptEntry","cn")  ;
-      if(preg_match("/r/",$s_acl)){
-        $divlist->AddEntry(array( array("string"=>"<a href='?plug=".$_GET['plug']."&amp;act=edit&amp;id=".$key."'>".$name['name']."</a>"),
-              array("string"=>$name['FAIpriority'] , "attach" => "style='width:100px;'"),
-              array("string"=>$down , "attach" => "style='width:100px;'"),
-              array("string"=>str_replace("%s",base64_encode($key),$act),
-                "attach"=>"style='border-right: 0px;width:100px;text-align:right;'")));
-      }
-    }
-    $smarty->assign("Entry_divlist",$divlist->DrawList());
-
-
-    /* Magic quotes GPC, escapes every ' " \, to solve some security risks
-     * If we post the escaped strings they will be escaped again
-     */
-    foreach($this->attributes as $attrs){
-      if(get_magic_quotes_gpc()){
-        $smarty->assign($attrs,stripslashes($this->$attrs));
-      }else{
-        $smarty->assign($attrs,($this->$attrs));
-      }
-    }
-
-    $dn = $this->acl_base_for_current_object($this->dn);
-    $smarty->assign("sub_object_is_addable",  
-        preg_match("/c/",$this->ui->get_permissions($dn,"fai/faiScriptEntry")) && 
-        !preg_match("/freeze/",$this->FAIstate));
-
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translated){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-
-    $display.= $smarty->fetch(get_template_path('faiScript.tpl', TRUE));
-    return($display);
-  }
-
-  /* Generate listbox friendly SubObject list
-   */
-  function getList($use_dns=false){
-    $a_return=array();
-    foreach($this->SubObjects as $obj){
-      if($obj['status'] != "delete"){
-        if($use_dns){
-          if((isset($obj['description']))&&(!empty($obj['description']))){
-            $a_return[$obj['cn']]['name']= $obj['cn']." [".stripslashes($obj['description'])."]";
-          }else{
-            $a_return[$obj['cn']]['name']= $obj['cn'];
-          }
-          $a_return[$obj['cn']]['dn']= $obj['dn'];
-          $a_return[$obj['cn']]['FAIpriority']= $obj['FAIpriority'];
-        }else{
-          if((isset($obj['description']))&&(!empty($obj['description']))){
-            $a_return[$obj['cn']]= $obj['cn']." [".stripslashes($obj['description'])."]";
-          }else{
-            $a_return[$obj['cn']]= $obj['cn'];
-          }
-        }
-      }
-    }
-    return($a_return);
-  }
-
-  /* Delete me, and all my subtrees
-   */
-  function remove_from_parent()
-  {
-    if($this->acl_is_removeable()){
-      $ldap = $this->config->get_ldap_link();
-      $ldap->cd ($this->dn);
-
-      $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $this->dn);
-      if($_SESSION['faifilter']['branch'] == "main"){
-        $use_dn = $this->dn;
-      }
-   
-      new log("remove","fai/".get_class($this),$use_dn,$this->attributes);
-      prepare_to_save_FAI_object($use_dn,array(),true);
-      
-      foreach($this->SubObjects as $name => $obj){
-        $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $obj['dn']);
-        if($_SESSION['faifilter']['branch'] == "main"){
-          $use_dn = $obj['dn'];
-        }
-        prepare_to_save_FAI_object($use_dn,array(),true);
-      }
-      $this->handle_post_events("remove");
-    }
-  }
-
-
-  /* Save data to object 
-   */
-  function save_object()
-  {
-    if((isset($_POST['FAIscript_posted'])) && ($this->FAIstate != "freeze")){
-      plugin::save_object();
-      foreach($this->attributes as $attrs){
-        if(isset($_POST[$attrs])){
-          $this->$attrs = $_POST[$attrs];
-        }
-      }
-    }
-    
-    /* Get sort order */
-    if(isset($_GET['sort']) && in_array($_GET['sort'],array("name","priority"))){
-      if($this->sort_by == $_GET['sort']){
-        if($this->sort_order == "up"){
-          $this->sort_order = "down";
-        }elseif($this->sort_order == "down"){
-          $this->sort_order = "up";
-        }
-      }
-      $this->sort_by = $_GET['sort'];
-    }
-  }
-
-
-  /* Check supplied data */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    return ($message);
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    plugin::save();
-
-    $ldap = $this->config->get_ldap_link();
-
-    prepare_to_save_FAI_object($this->dn,$this->attrs);
-    show_ldap_error($ldap->get_error(), sprintf(_("Creating of FAI/script with dn '%s' failed."),$this->dn));
-
-    if($this->initially_was_account){
-      new log("modify","fai/".get_class($this),$this->dn,$this->attributes);
-    }else{
-      new log("create","fai/".get_class($this),$this->dn,$this->attributes);
-    }
-
-    /* Do object tagging */
-    $this->handle_object_tagging();
-
-    /* Prepare FAIscriptEntry to write it to ldap
-     * First sort array.
-     *  Because we must delete old entries first.
-     * After deletion, we perform add and modify 
-     */
-    $Objects = array();
-
-    /* We do not need to save untouched objects */
-    foreach($this->SubObjects as $name => $obj){
-      if($obj['status'] == "FreshLoaded"){
-        unset($this->SubObjects[$name]);
-      }
-    }
-
-    foreach($this->SubObjects as $name => $obj){
-      if($obj['status'] == "delete"){
-        $Objects[$name] = $obj; 
-      }
-    }
-    foreach($this->SubObjects as $name => $obj){
-      if($obj['status'] != "delete"){
-        $Objects[$name] = $obj; 
-      }
-    }
-
-    foreach($Objects as $name => $obj){
-
-      foreach($this->sub64coded as $codeIt){
-        $obj[$codeIt]=base64_encode(stripslashes($obj[$codeIt]));
-      }
-
-      $tmp = array();
-      $attributes = array_merge($this->sub_Load_Later,$this->subAttributes);
-      foreach($attributes as $attrs){
-
-        if(empty($obj[$attrs])){
-          $obj[$attrs] = array();
-        }
-        if(!is_array($obj[$attrs])){
-          $tmp[$attrs] = stripslashes($obj[$attrs]);
-        }else{
-          $tmp[$attrs] = $obj[$attrs];
-        }
-      }    
-
-      $tmp['objectClass'] = $this->subClasses;
-
-      $sub_dn = "cn=".$obj['cn'].",".$this->dn;
-
-      if($obj['status']=="new"){
-        $ldap->cat($sub_dn,array("objectClass"));
-        if($ldap->count()){
-          $obj['status']="edited";
-        }
-      }
-
-      if(empty($tmp['FAIpriority'])){
-        $tmp['FAIpriority']  ="0";
-      }
-
-      /* Check if gosaAdministrativeUnitTag is required as object class */
-      if($obj['status'] == "edited"){
-        $ldap->cat($sub_dn,array("objectClass"));
-        $attrs = $ldap->fetch();
-        if(isset($attrs['objectClass'])){
-          if(in_array_ics("gosaAdministrativeUnitTag",$attrs['objectClass'])){
-            $tmp['objectClass'][] = "gosaAdministrativeUnitTag";
-          }
-        }
-      }
-
-      if($obj['status'] == "delete"){
-        prepare_to_save_FAI_object($sub_dn,array(),true);
-        $this->handle_post_events("remove");
-      }elseif($obj['status'] == "edited"){
-        prepare_to_save_FAI_object($sub_dn,$tmp);
-        $this->handle_post_events("modify");
-      }elseif($obj['status']=="new"){
-        prepare_to_save_FAI_object($sub_dn,$tmp);
-        $this->handle_post_events("add");
-      }
-
-      $this->handle_object_tagging($sub_dn, $this->gosaUnitTag);
-    }
-  }
-
-
-  function PrepareForCopyPaste($source)
-  {
-    plugin::PrepareForCopyPaste($source);
-
-    /* Read all leaf objects of this object (For FAIscript this would be FAIscriptEntry)
-     */
-    $ldap     = $this->config->get_ldap_link();
-    $ldap->cd ($source['dn']);
-
-    $attrs_to_search = $this->subAttributes;
-    $attrs_to_search[] = "FAIstate";
-    $ldap->search("(&(objectClass=FAIclass)(objectClass=".$this->subClass."))",$attrs_to_search);
-
-    while($object = $ldap->fetch()){
-
-      /* Skip objects, that are tagged as removed */
-      if(isset($object['FAIstate'][0])){
-        if(preg_match("/removed$/",$object['FAIstate'][0])){
-          continue;
-        }
-      }
-
-      /* Set status for save management */
-      $objects = array();
-      $objects['status']      = "edited";
-      $objects['dn']          = $object['dn'];
-      $objects                = $this->get_object_attributes($objects,$this->subAttributes);
-      $objects                = $this->get_object_attributes($objects,$this->sub_Load_Later);
-  
-      $this->SubObjects[$objects['cn']] = $objects;
-    }
-  }
-  
-
-  /* Return plugin informations for acl handling */ 
-  static function plInfo()
-  {
-    return (array( 
-          "plShortName" => _("Script"),
-          "plDescription" => _("FAI script"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 18,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("fai"),
-          "plProvidedAcls" => array(
-            "cn"                => _("Name")." ("._("Readonly").")",
-            "description"       => _("Description"))
-          ));
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/fai/class_faiScriptEntry.inc b/plugins/admin/fai/class_faiScriptEntry.inc
deleted file mode 100644 (file)
index 0321329..0000000
+++ /dev/null
@@ -1,198 +0,0 @@
-<?php
-
-class faiScriptEntry 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","description","FAIpriority","FAIscript");
-  var $objectclasses= array();
-
-  var $orig_cn              = "";
-
-  var $dn            = "";
-  var $cn            = "";
-  var $FAIpriority   = "0";
-  var $FAIscript     = "";
-  var $description   = "";
-  var $status        = "new";
-  var $parent        = NULL;
-  var $FAIstate      = "";
-  
-  function faiScriptEntry (&$config, $dn= NULL,$object=false)
-  {
-    plugin::plugin ($config, $dn);
-    if($dn != "new"){
-      $this->orig_cn= $object['cn'];
-      $this->dn=$object['dn'];
-      foreach($object as $name=>$value){
-        $oname = $name;
-        $this->$oname=$value;
-      }
-
-      if(isset($this->attrs['FAIstate'][0])){
-        $this->FAIstate = $this->attrs['FAIstate'][0];
-      }
-
-    }else{
-      if(is_array($object)&&count($object)){
-        $this->orig_cn= $object['cn'];
-        $this->dn=$object['dn'];
-        foreach($object as $name=>$value){
-          $oname = $name;
-          $this->$oname=$value;
-        }
-      }else{
-
-        $this->status = "new";
-        $this->orig_cn       = false;
-      }
-    }
-  }
-
-  function execute()
-  {
-       /* Call parent execute */
-       plugin::execute();
-
-    /* Fill templating stuff */
-    $smarty     = get_smarty();
-    $display = "";
-  
-    if(isset($_POST['ImportUpload']) && $this->acl_is_writeable("FAIscript")){
-      if(($_FILES['ImportFile']['error']!=0)){
-        print_red(_("Please select a valid file."));
-      }else
-      if(($_FILES['ImportFile']['size']==0)){
-        print_red(_("Selected file is empty."));
-      }else{
-        $str = utf8_encode(addslashes(file_get_contents($_FILES['ImportFile']['tmp_name'])));
-        $this->FAIscript = $str;
-      }
-    }
-  
-    foreach($this->attributes as $attrs){
-      if(get_magic_quotes_gpc()){
-       $smarty->assign($attrs,stripslashes($this->$attrs));
-      }else{
-       $smarty->assign($attrs,($this->$attrs));
-      } 
-    }
-
-     /* Create download button*/
-    if($this->dn != "new" && $this->acl_is_readable("FAIscript")){
-      $smarty->assign("DownMe","<a href='getFAIscript.php?id=".base64_encode($this->dn)."'>
-        <input type='button' value='"._("Download")."'>
-        </a>");
-    }else{
-      $smarty->assign("DownMe","");
-    }
-
-    for($i =0 ; $i < 100 ; $i++){
-      $FAIprioritys[$i]=$i;
-    }
-
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translated){
-      $acl = $this->getacl($name);
-      if($this->FAIstate == "freezed"){
-        $acl = preg_replace("/w/","",$acl);
-      }
-      $smarty->assign($name."ACL",$acl);
-    }
-
-    $smarty->assign("FAIprioritys",$FAIprioritys);
-    if(get_magic_quotes_gpc()){
-      $smarty->assign("FAIscript" , htmlentities(stripslashes($this->FAIscript)));
-    }else{
-      $smarty->assign("FAIscript" , htmlentities($this->FAIscript));
-    }
-    $display.= $smarty->fetch(get_template_path('faiScriptEntry.tpl', TRUE));
-    return($display);
-  }
-
-  /* Save data to object */
-  function save_object()
-  {
-    if((isset($_POST['SubObjectFormSubmitted'])) && ($this->FAIstate != "freeze")){
-      foreach($this->attributes as $attrs){
-        if($this->acl_is_writeable($attrs)){
-          if(isset($_POST[$attrs])){
-            $this->$attrs = $_POST[$attrs];
-          }else{
-            $this->$attrs = "";
-          }
-        }
-      }
-    }
-  }
-
-  /* Check supplied data */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-  
-    if(isset($this->parent->SubObjects[$this->cn]) && $this->cn != $this->orig_cn){
-      $message[] =_("There is already a script with the given name.");
-    }
-
-    if(empty($this->cn)){
-      $message[] = _("Please enter a name.");
-    }
-
-    if(empty($this->FAIscript)){
-      $message[]=_("Please enter a script.");
-    }
-
-    return ($message);
-  }
-  function save()
-  {
-    $tmp=array();
-    foreach($this->attributes as $attrs){ 
-      $tmp[$attrs] = $this->$attrs;
-    }
-
-    /* Strip out dos newlines */
-    $tmp['FAIscript']= strtr($this->FAIscript, array("\x0D" => ""));
-
-    if(($this->orig_cn)&&($tmp['cn']!=$this->orig_cn)){
-      $tmp['remove']['from']  = $this->orig_cn;
-      $tmp['remove']['to']    = $tmp['cn'];
-    }
-  
-    $tmp['dn']      = $this->dn;  
-    $tmp['status']  = $this->status; 
-    return($tmp);
-  }
-
-  
-  /* Return plugin informations for acl handling */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName" => _("Script entry"),
-          "plDescription" => _("FAI script entry"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 19,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("fai"),
-          "plProvidedAcls" => array(
-            "cn"              => _("Name"),
-            "description"     => _("Description"),
-            "FAIscript"       => _("Script entry"),
-            "FAIpriority"     => _("Script Priority"))
-          ));
-  }
-
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/fai/class_faiSummaryTab.inc b/plugins/admin/fai/class_faiSummaryTab.inc
deleted file mode 100644 (file)
index a9bfbb8..0000000
+++ /dev/null
@@ -1,583 +0,0 @@
-<?php
-/*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) Fabian Hickert 
-
-   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 faiSummaryTab extends plugin{
-
-  var $Classes        = array();
-  var $Release        = "";
-  var $Releases       = array();
-  var $Result         = array();
-  var $objs              = array();
-  var $ObjectList     = "";
-  var $is_dialog      = false;
-  var $InitCalled     = false;
-  var $usedClasses    = array();
-  var $base           = ""; 
-  var $parent         = NULL; 
-  var $ui             = NULL;
-
-  function faiSummaryTab(&$config,$dn)//,$parent)
-  {
-    plugin::plugin($config,$dn);//,$parent);
-
-    $this->ui = get_userinfo();
-
-    /* Base object configuration */
-    $this->objs = array(       
-        "FAIscript"                => array(   "Image" =>"images/fai_script.png",        "Name"=>_("Scripts")      ,"Tree"     =>"ou=scripts,") ,
-        "FAIhook"                          => array(   "Image" =>"images/fai_hook.png" ,         "Name"=>_("Hooks")        ,"Tree"     =>"ou=hooks,"),
-        "FAIvariable"            => array(     "Image" =>"images/fai_variable.png",      "Name"=>_("Variables")    ,"Tree"     =>"ou=variables,") ,
-        "FAItemplate"            => array(     "Image" =>"images/fai_template.png",      "Name"=>_("Templates")    ,"Tree"     =>"ou=templates,") ,
-        "FAIpartitionTable" => array(  "Image" =>"images/fai_partitionTable.png","Name"=>_("Partition table")  ,"Tree" =>"ou=disk,") ,
-        "FAIpackageList"         => array(     "Image" =>"images/fai_packages.png",      "Name"=>_("Package list") ,"Tree"     =>"ou=packages,") ,
-        "FAIprofile"               => array(   "Image" =>"images/fai_profile.png",       "Name"=>_("Profiles")     ,"Tree"     =>"ou=profiles,"));
-  }
-
-
-  /* Init the fai tree with objects.
-     If this method is called, all assigned classes and the release name 
-      will be read from parent object. */
-  function init()
-  {
-    $this->InitCalled = true;
-    $this->Result = array();
-    $_SESSION['faiSummaryTab']['UniqueID'] = 0; 
-  
-    /* Get classes & release name 
-       There are 2 different tabs which use the summary tab
-       faiProfile / Workstations */
-    
-    /* Check if given parent object is fai profile tabs */
-    if(isset($this->parent->by_name['faiProfile'])){
-      
-      /* Get Classes and release */
-      $this->Classes = $this->parent->by_object['faiProfile']->FAIclasses;
-      $this->base    = $this->parent->by_object['faiProfile']->base;
-      $str = preg_replace("/^.*ou=profiles,/","",$this->dn);
-  
-    /* Check if parent tab is work tab */
-    }elseif(isset($this->parent->by_name['workstartup'])){
-      $this->Classes = $this->parent->by_object['workstartup']->FAIclass;
-      $this->Release = $this->parent->by_object['workstartup']->FAIrelease;
-
-      /* Check if this is a workstation or an object group */
-      if(isset($this->parent->by_object['workgeneric'])){
-        $this->base    = $this->parent->by_object['workgeneric']->base;
-      }elseif(isset($this->parent->by_object['ogroup'])){
-        $this->base    = $this->parent->by_object['ogroup']->base;
-      }elseif(isset($this->parent->by_object['servgeneric'])){
-        $this->base    = $this->parent->by_object['servgeneric']->base;
-      }else{
-        print_red(_("Unknown type of FAI source information. This is not a profile, workstation nor a ogroup."));
-      }
-      
-      /* Append workstation class && LAST */
-      if(isset($this->parent->by_object['workgeneric']->cn)){
-        $this->Classes[] = $this->parent->by_object['workgeneric']->cn;
-      }
-    }
-
-    $tmp = array_flip($this->getBranches());
-
-    $this->Classes[] = "LAST";
-
-    /* You need full access to complete collection of fai acls to view this summary */
-    $acl = $this->ui->has_complete_category_acls($this->base,"fai");
-    if(!preg_match("/r/",$acl)){
-      $this->Classes = array();
-    }
-
-    /* Set all available releases */
-    $this->Releases = $tmp;
-    $this->usedClasses = array();
-
-    /* Check the configuration */
-    if(count($this->Classes) && (!empty($this->Release))){
-      foreach($this->Classes as $class){
-        $this->resolveObject($class);
-      }
-    }
-  }
-
-
-  /* Capture posts, and call opnen close tag */
-  function save_object()
-  {
-    $once = true;
-
-    if(isset($_GET['expand']) && isset($_GET['id'])){
-      if(isset($this->Result[$_GET['id']])){
-        $this->Result[$_GET['id']]['Open'] =true  ;
-      }
-    }
-
-    if(isset($_GET['compress']) && isset($_GET['id'])){
-      if(isset($this->Result[$_GET['id']])){
-        unset($this->Result[$_GET['id']]['Open']);
-      }
-    }
-
-    foreach($_POST as $name => $value ){
-
-      /* check for open tag request */
-      if(preg_match("/^open_/",$name) && $once){
-        $once  = false;
-        $value = preg_replace("/^open_/","",$name);
-        $value = preg_replace("/_.*$/","",$value); 
-        $this->Result[$value]['Open'] =true  ;
-      }
-      /* Check for close tag request */
-      if(preg_match("/^close_/",$name) && $once){
-        $once  = false;
-        $value = preg_replace("/^close_/","",$name);
-        $value = preg_replace("/_.*$/","",$value); 
-        unset($this->Result[$value]['Open']);
-      }
-      if(preg_match("/^reloadList/",$name)){
-        $this->InitCalled = false;
-      }
-    }
-  }
-
-
-  /* returns an array with all possibly release types */
-  function getBranches($base = false,$prefix = "")
-  {
-    if(!$base){
-      $base = $this->base;
-    }
-    return(get_all_releases_from_base($base,true));
-  }
-
-
-  /* This function calls all nescessary functions to generate the fai class summary tree */
-  function execute() 
-  {
-
-    /* Skip this if fai is deactivated */
-    $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
-    if(empty($tmp)){
-      $str = "<h2>"._("You can't use this plugin until FAI is activated.")."</h2>";
-      return $str;
-    }    
-
-    /* Check if we must (re)init the this tab */
-    if(!$this->InitCalled){
-      $this->init();
-    }
-
-    if(isset($_GET['show'])){
-      $ldap = $this->config->get_ldap_link();
-      $ldap->cat(base64_decode($_GET['id']), array('FAIscript', 'FAIhook', 'FAItemplateFile'));
-      $attrs = $ldap->fetch();
-      if($_GET['type'] == "FAIscript"){
-        $str = $attrs['FAIscript'][0];
-      }elseif($_GET['type'] == "FAIhook"){
-        $str = $attrs['FAIscript'][0];
-      }elseif($_GET['type'] == "FAItemplate"){
-        $str = $attrs['FAItemplateFile'][0];
-      }
-      echo "<pre>".$str."</pre>";
-      exit();
-    }
-
-    /* Get smarty class & assign created summary results */
-    $smarty = get_smarty();
-    $acl = $this->ui->has_complete_category_acls($this->base,"fai");
-    $smarty->assign("readable", preg_match("/r/",$acl));
-
-    $this->ObjectList = $this->createSummary($this->Result);
-    $smarty->assign("objectList",$this->ObjectList);
-    return($smarty->fetch (get_template_path('faiSummary.tpl', TRUE, dirname(__FILE__))));
-  }
-
-
-  /* Create output of from resolved fai objects */
-  function createSummary($data)
-  {
-    /* Don't generate any output, if there is no result */ 
-    $str ="<table cellspacing=0 cellpadding=2 style='width:100%;background:#F5F5F5;'> ";
-    if(!count($this->Result)){
-      $str.="<tr><td>"; 
-      $str.= (_("This object has no FAI classes assigned."));
-      $str.= "</tr></td></table>";
-      return($str);
-    }
-
-    /* walk through all classes */     
-    foreach($data as $key => $entry){
-      
-      $image = "<img src='".$this->objs[$key]['Image']."' class='center' alt='".$this->objs[$key]['Name']."' border=0>";
-      if(!isset($entry['Open'])){
-        $str .= "<tr>
-                  <td colspan=2>
-                   <a href='?plug=".$_GET['plug']."&amp;expand&amp;id=".$key."'>
-                    <img border=0 class='center' src='images/expand.png' alt='"._("Open")."'>&nbsp;";
-        $str .=     $image."&nbsp;";
-        $str .= "   <b>".$this->objs[$key]['Name']."</b></a></td></tr>";
-      }else{
-        $str .= "<tr><td colspan=2>
-                    <a href='?plug=".$_GET['plug']."&amp;compress&amp;id=".$key."'>
-                   <img border=0 class='center' src='images/sort_down.png' alt='"._("Close")."'>&nbsp;";
-        $str .= $image."&nbsp;";
-        $str .= "<b>".$this->objs[$key]['Name']."</b></a></td></tr>";
-   
-        /* Display FAItemplate FAIhook FAIscript entries */ 
-        if(in_array($key,array("FAItemplate","FAIhook","FAIscript"))){
-
-          $nums = array();          
-          $tmp  = array();
-          if($key == "FAIscript"){
-            if(is_array($entry['Entries'])){
-              foreach($entry['Entries'] as $scripts){
-                foreach($scripts as $script){
-
-                  if(!isset($nums[$script['cn'][0]])){
-                    $nums[$script['cn'][0]]= 0;
-                  } 
-                  $nums[$script['cn'][0]] ++;
-
-                  $tmp[$script['FAIpriority'][0].$script['cn'][0].$script['CLASS']] = $script;
-                }
-              }
-            }
-            krsort($tmp);;
-            
-            $entry['Entries'] = $tmp;
-          }else{
-            $tmp = array();
-            foreach($entry['Entries'] as $script){
-              $tmp[$script['cn'][0].$script['CLASS']] = $script;
-              if(!isset($nums[$script['cn'][0]])){
-                $nums[$script['cn'][0]]= 0;
-              } 
-              $nums[$script['cn'][0]] ++;
-            }
-             ksort($tmp);
-            $entry['Entries'] = $tmp;
-          }
-
-          foreach($entry['Entries'] as $cn => $data){
-
-            if(isset($nums[$data['cn'][0]]) && ($nums[$data['cn'][0]] > 1)){
-              $str .="<tr style='background: #EE3434;'><td style='padding-left:20px;'>";
-            }else{
-              $str .="<tr><td style='padding-left:20px;'>";
-            }
-
-            $str .= "<a target='_blank' href='?plug=".$_GET['plug']."&amp;show&amp;type=".$key."&amp;id=".base64_encode($data['dn'])."'>";
-            $str .= $image."&nbsp;";
-            if(isset($data['FAIpriority'][0])){
-              $str .= "(".$data['FAIpriority'][0].")";
-            }
-
-            $str .= "&nbsp;".$data['cn'][0];
-            if(isset($data['description'][0])){
-              $str .= " [".$data['description'][0]."]";
-            }
-            $str .= "</a>";
-            $str .= "</td><td><i>".$data['CLASS']."</i>";
-            $str .= "</td></tr>";
-          }
-        }
-
-        /* Create variable entries */
-        if(in_array($key,array("FAIvariable"))) {
-          foreach($entry['Entries'] as $cn => $data){
-            $str .="<tr><td style='padding-left:20px;'>";
-            $str .= $image."&nbsp;".$data['cn'][0];
-            if(isset($data['description'][0])){
-              $str .= " [".$data['description'][0]."] ";
-            }
-            /* Only display FAIvariableContent if description dosn't contain [*] */ 
-            if(isset($data['description'][0]) && !preg_match("#\[\*\]#",$data['description'][0])){
-              $str .=" = '".$data['FAIvariableContent'][0]."'";
-            }
-            $str .= "</td><td><i>".$data['CLASS']."</i>";
-            $str .="</td></tr>";
-          }
-        }
-
-        /* Create packagelist entries */ 
-        if(in_array($key,array("FAIpackageList"))) {
-          ksort($entry['Entries']);
-          foreach($entry['Entries'] as $data){
-            $str .="<tr><td style='padding-left:20px;'>";
-            $str .= $image."&nbsp;".$data['cn'][0];
-            $str .= "</td><td><i>".$data['CLASS']."</i>";
-            $str .= "</td></tr>";;
-          }
-        }
-
-        /* Create partition table entries */
-        if(in_array($key,array("FAIpartitionTable"))) {
-          foreach($entry['Entries'] as $cn => $data){
-            $str .= "<tr><td style='padding-left:20px;'>";
-            $str .= $image."&nbsp;".$data['name'];
-            $str .= "</td><td><i>".$data['CLASS']."</i>";
-            $str .= "</td></tr>";
-            ksort($data['partitions']);
-
-            $str .= "<tr><td colspan=2  style='padding-left:20px;'>";
-            $str .= "<table cellspacing=0 cellpadding=2 style='background:#FFFFFF;border:1px solid #B0B0B0'>
-                      <tr style='background-color:#DBDBDB;'>
-                       <td class='tbhead'>"._("No.")."</td>
-                       <td class='tbhead'>"._("Name")."</td>
-                       <td class='tbhead'>"._("FS options")."</td>
-                       <td class='tbhead'>"._("Mount options")."</td>
-                       <td class='tbhead'>"._("Size in MB")."</td>
-                       <td class='tbhead'>"._("Mount point")."</td>
-                       <td class='tbrhead'>"._("Type")."</td>
-                      </tr>";
-
-            $i = 0;
-            foreach($data['partitions'] as $key => $part){
-              $i ++;
-
-              if($i%2 == 1){
-                $c = " class='rowxp1'";
-                $d = " class='list1'";
-              }else{
-                $c = " class='rowxp0'";
-                $d = " class='list0'";
-              }
-
-              $str.="<tr $c style='height:10px;'>
-                      <td $d>".$i."</td> 
-                      <td $d>".$part['cn'][0]."</td> 
-                      <td $d>".$part['FAIfsType'][0]."</td> 
-                      <td $d>".$part['FAIfsOptions'][0]."</td> 
-                      <td $d>".$part['FAIpartitionSize'][0]."</td> 
-                      <td $d>".$part['FAImountPoint'][0]."</td> 
-                      <td $d style='border:none'>".$part['FAIpartitionType'][0]."</td> 
-                    </tr>";
-            }
-            $str .="</table>";
-          }
-        }
-      }
-    }
-    $str .="</table>"; 
-    return($str);
-  }
-
-
-  /* resolve specified object to append it to our object tree */
-  function resolveObject($class)
-  {
-    $ldap                = $this->config->get_ldap_link();
-    $dn                    = $this->Releases [$this->Release];
-    $resolvedClasses  = get_all_objects_for_given_base($dn,"(&(objectClass=FAIclass)(cn=".$class."))");
-
-    /* Try to fetch all types of fai objects with the given cn  */
-    foreach($resolvedClasses as $obj){
-
-      $dn = $obj['dn'];
-      $ldap->cat($dn);
-
-      while($attrs = $ldap->fetch()){
-
-        foreach($this-> objs as $key => $rest){
-          if(in_array($key,$attrs['objectClass'])){
-
-            if(!isset($this->usedClasses[$key][$class])){
-              $this->usedClasses[$key][$class] = true;
-              switch($key){
-                case "FAIprofile":                     $this->prepare_FAIprofile($attrs);break;
-                case "FAIscript":                      $this->prepare_FAIscript($attrs);break;
-                case "FAIhook":                          $this->prepare_FAIhook($attrs);break;
-                case "FAIvariable":                    $this->prepare_FAIvariable($attrs);break;
-                case "FAItemplate":                    $this->prepare_FAItemplate($attrs);break;
-                case "FAIpackageList":       $this->prepare_FAIpackageList($attrs);break;
-                case "FAIpartitionTable":          $this->prepare_FAIpartitionTable($attrs);break;
-              }
-            }
-
-          }
-        }
-      }
-    }
-  }
-
-  /* Prepare fai script */
-  function prepare_FAIscript($data)
-  {
-    if(isset($this->Result['FAIscript']['Entries'])){
-      $current = $this->Result['FAIscript']['Entries'];
-    }else{
-      $current = array();
-    }
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($data['dn']);
-    $ldap->search("(objectClass=FAIscriptEntry)",array("cn","description","FAIpriority"));
-    while($attrs = $ldap->fetch()){
-      $attrs['CLASS'] = $data['cn'][0];
-      $current[$attrs['FAIpriority'][0]][] = $attrs;
-    }
-    $this->Result['FAIscript']['Entries'] = $current ;
-  }
-
-
-  /* Prepare fai script */
-  function prepare_FAIpartitionTable($data)
-  {
-    if(isset($this->Result['FAIpartitionTable']['Entries'])){
-      $current = $this->Result['FAIpartitionTable']['Entries'];
-    }else{
-      $current = array();
-    }
-
-    /* get subentries */
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($data['dn']);
-    $ldap->search("(objectClass=FAIpartitionDisk)",array("cn","description"));
-    $disks = array();
-
-    /* Create an array which is sortable by priority */
-    while($attrs = $ldap->fetch()){
-      $attrs['CLASS'] = $data['cn'][0];
-      $disks[$attrs['cn'][0]]= $attrs;
-      if(isset($attrs['description'][0])){
-        $disks[$attrs['cn'][0]]['name'] = $attrs['cn'][0]." [".$attrs['description'][0]."]";
-      }else{
-        $disks[$attrs['cn'][0]]['name'] = $attrs['cn'][0];
-      }
-      $disks[$attrs['cn'][0]]['dn'] = $attrs['dn'];
-      $disks[$attrs['cn'][0]]['partitions'] = array();
-    }
-
-    /* Sort by priority */
-    foreach($disks as $key => $disk){
-      $ldap->cd($disk['dn']);
-      $ldap->search("(objectClass=FAIpartitionEntry)",array("*"));
-      while($attrs = $ldap->fetch()){
-        if(!isset($attrs['FAIfsOptions'][0])){
-          $attrs['FAIfsOptions'][0] = "";
-        }
-        $attrs['CLASS'] = $data['cn'][0];
-        $disks[$key]['partitions'][$attrs['cn'][0]] = $attrs;
-      }
-    }
-    $this->Result['FAIpartitionTable']['Entries'] = $disks;
-  }
-
-
-  /* Create template entry */  
-  function prepare_FAItemplate($data)
-  {
-    $current = array();
-    if(isset($this->Result['FAItemplate']['Entries'])){
-      $current = $this->Result['FAItemplate']['Entries'];
-    }
-
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($data['dn']);
-    $ldap->search("(objectClass=FAItemplateEntry)",array("cn","description"));
-    while($attrs = $ldap->fetch()){
-      $attrs['CLASS'] = $data['cn'][0];
-      $current[] = $attrs;
-    }
-    $this->Result['FAItemplate']['Entries'] = $current ;
-  }
-
-
-  /* Create a package list  */ 
-  function prepare_FAIpackageList($data)
-  {
-    $current = array();
-    if(isset($this->Result['FAIpackageList']['Entries'])){
-      $current = $this->Result['FAIpackageList']['Entries'];
-    }
-    if(isset($data['FAIpackage'])){
-      unset($data['FAIpackage']['count']);
-      foreach($data['FAIpackage'] as $pkg){
-        $attrs['CLASS'] = $data['cn'][0];
-        $attrs['cn'][0] = $pkg;
-        $current[$pkg] = $attrs;
-      }
-    }
-    $this->Result['FAIpackageList']['Entries'] = $current ;
-  }
-
-
-  /* Create a variable entry */        
-  function prepare_FAIvariable($data)
-  {
-    $current = array();
-    if(isset($this->Result['FAIvariable']['Entries'])){
-      $current = $this->Result['FAIvariable']['Entries'];
-    }
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($data['dn']);
-    $ldap->search("(objectClass=FAIvariableEntry)",array("cn","description","FAIvariableContent"));
-    while($attrs = $ldap->fetch()){
-      $attrs['CLASS'] = $data['cn'][0];
-      $current[] = $attrs;
-    }
-    $this->Result['FAIvariable']['Entries'] = $current ;
-  }
-
-  /* Create a hook entry */    
-  function prepare_FAIhook($data)
-  {
-    $current = array();
-    if(isset($this->Result['FAIhook']['Entries'])){
-      $current = $this->Result['FAIhook']['Entries'];
-    }
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($data['dn']);
-    $ldap->search("(objectClass=FAIhookEntry)",array("cn","description"));
-    while($attrs = $ldap->fetch()){
-      $attrs['CLASS'] = $data['cn'][0];
-      $current[$attrs['cn'][0]] = $attrs;
-    }
-    $this->Result['FAIhook']['Entries'] = $current ;
-  }
-
-
-  /* Create a new Profile entry */
-  function prepare_FAIprofile($data)
-  {
-    $classes = split("\ ",$data['FAIclass'][0]);
-    foreach($classes as $class){
-      $class = trim($class);
-      $this->resolveObject($class);
-    }
-  }
-
-  /* Return plugin informations for acl handling * /
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("Summary"),
-          "plDescription" => _("FAI summary"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 15,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("workstation","server","fai","ogroups") ,
-          "plProvidedAcls"=> array(
-            "readable" => _("Viewable")),
-          ));
-  }
-  */
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/fai/class_faiTemplate.inc b/plugins/admin/fai/class_faiTemplate.inc
deleted file mode 100644 (file)
index 5f4fcbf..0000000
+++ /dev/null
@@ -1,579 +0,0 @@
-<?php
-
-class faiTemplate 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;
-
-  /* Attributes for this Object */
-  var $attributes       = array("cn","description");
-
-  /* ObjectClasses for this Object*/
-  var $objectclasses    = array("top","FAIclass","FAItemplate");
-
-  /* Class name of the Ldap ObjectClass for the Sub Object */
-  var $subClass         = "FAItemplateEntry";
-  var $subClasses       = array("top","FAIclass","FAItemplateEntry");
-
-  /* Class name of the php class which allows us to edit a Sub Object */
-  var $subClassName     = "faiTemplateEntry";      
-
-  /* Attributes to initialise for each subObject */
-  var $subAttributes    = array("cn","description","FAItemplatePath","FAIowner","FAImode");
-  var $sub_Load_Later   = array("FAItemplateFile"); 
-  var $sub64coded       = array();
-  var $subBinary        = array("FAItemplateFile");
-
-  /* Specific attributes */
-  var $cn               = "";       // The class name for this object
-  var $description      = "";       // The description for this set of partitions
-  var $is_dialog        = false;    // specifies which buttons will be shown to save or abort
-  var $SubObjects       = array();  // All leafobjects of this object
-
-  var $FAIstate         = "";
-  var $ui;
-  var $view_logged      = FALSE;
-
-  function faiTemplate (&$config, $dn= NULL)
-  {
-    /* Load Attributes */
-    plugin::plugin ($config, $dn);
-
-    /* If "dn==new" we try to create a new entry
-     * Else we must read all objects from ldap which belong to this entry.
-     * First read SubObjects from ldap ... and then the partition definitions for the SubObjects.
-     */
-    if($dn != "new"){
-      $this->dn =$dn;
-
-      /* Get FAIstate
-       */
-      if(isset($this->attrs['FAIstate'][0])){
-        $this->FAIstate = $this->attrs['FAIstate'][0];
-      }
-
-      /* Read all leaf objects of this object (For FAIscript this would be FAIscriptEntry)
-       */
-      $ldap     = $this->config->get_ldap_link();
-      $ldap->cd ($this->dn);
-    
-      $attrs_to_search = $this->subAttributes;
-      $attrs_to_search[] = "FAIstate";
-      $ldap->search("(&(objectClass=FAIclass)(objectClass=".$this->subClass."))",$attrs_to_search);
-
-      while($object = $ldap->fetch()){
-
-        /* Skip objects, that are tagged as removed */
-        if(isset($object['FAIstate'][0])){
-          if(preg_match("/removed$/",$object['FAIstate'][0])){
-            continue;
-          }
-        }
-
-        /* Set status for save management */
-        $objects = array();
-        $objects['status']      = "FreshLoaded";
-        $objects['dn']          = $object['dn'];
-        $objects                = $this->get_object_attributes($objects,$this->subAttributes);
-        $this->SubObjects[$objects['cn']] = $objects;
-      }
-    }
-    $this->ui = get_userinfo();
-  }
-
-
-  /* Reload some attributes */
-  function get_object_attributes($object,$attributes)
-  {
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->cat($object['dn'],$attributes);
-    $tmp  = $ldap->fetch();
-
-    foreach($attributes as $attrs){
-      if(isset($tmp[$attrs][0])){
-        $var = $tmp[$attrs][0];
-
-        /* Check if we must decode some attributes */
-        if(in_array_ics($attrs,$this->sub64coded)){
-          $var = base64_decode($var);
-        }
-
-        /*  check if this is a binary entry */
-        if(in_array_ics($attrs,$this->subBinary)){
-          $var = $ldap->get_attribute($object['dn'], $attrs,$r_array=0);
-        }
-
-        $var = stripslashes($var);
-  
-        $object[$attrs] = $var;
-      }
-    }
-    return($object);
-  }
-
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","fai/".get_class($this),$this->dn);
-    }
-
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-    $display= "";
-
-    /* New Listhandling
-     */
-    $once = true;
-    foreach($_POST as $name => $value){
-      if(preg_match("/^editscript_/",$name)&&($once)){
-        $once = false;
-        $entry = preg_replace("/^editscript_/","",$name);
-        $entry = base64_decode(preg_replace("/_.*/","",$entry));
-        $obj  = $this->SubObjects[$entry];
-
-        $acl_dn = $this->acl_base_for_current_object($obj['dn']);
-        $acl = $this->ui->get_permissions($acl_dn,"fai/faiTemplateEntry");
-        if(preg_match("/r/",$acl)){
-          if($obj['status'] == "FreshLoaded"){
-            $obj  = $this->get_object_attributes($obj,$this->sub_Load_Later);
-          }
-          $this->dialog= new $this->subClassName($this->config,$this->dn,$obj);
-          $this->dialog->set_acl_base($this->acl_base);
-          $this->dialog->set_acl_category("fai");
-
-          $_SESSION['objectinfo'] = $obj['dn'];
-          $this->dialog->parent = &$this;
-          $this->is_dialog=true;
-        }
-      }
-      if(preg_match("/^deletescript_/",$name)&&($once)){
-        $once = false;
-        $entry = preg_replace("/^deletescript_/","",$name);
-        $entry = base64_decode(preg_replace("/_.*/","",$entry));
-        $obj  = $this->SubObjects[$entry];
-
-        $acl_dn = $this->acl_base_for_current_object($obj['dn']);
-        $acl = $this->ui->get_permissions($acl_dn,"fai/faiTemplateEntry");
-        if(preg_match("/d/",$acl)){
-          $status = $this->SubObjects[$entry]['status'];
-          if($status == "edited" || $status == "FreshLoaded"){
-            $this->SubObjects[$entry]['status']= "delete";
-          }else{
-            unset($this->SubObjects[$entry]);
-          }
-        }
-      }
-    }
-
-    /* Edit entries via GET */
-    if(isset($_GET['act']) && isset($_GET['id'])){
-      if($_GET['act'] == "edit" && isset($this->SubObjects[$_GET['id']])){
-        $obj = $this->SubObjects[$_GET['id']];
-          if($obj['status'] == "FreshLoaded"){
-          $obj  = $this->get_object_attributes($obj,$this->sub_Load_Later);
-        }
-        $this->dialog= new $this->subClassName($this->config,$this->dn,$obj);
-        $this->dialog->acl = $this->acl;
-        $_SESSION['objectinfo'] = $obj['dn'];
-        $this->dialog->parent = &$this;
-        $this->is_dialog=true;
-      }
-    }
-
-    /* Add new sub object */
-    if(isset($_POST['AddSubObject'])){
-      $acl_dn = "cn=dummy,".$this->acl_base_for_current_object($this->dn);
-      $acl    = $this->ui->get_permissions($acl_dn,"fai/faiTemplateEntry");
-
-      if(preg_match("/c/",$acl)){
-        $this->dialog= new $this->subClassName($this->config,"new");
-        $this->dialog->set_acl_base($this->acl_base);
-        $this->dialog->set_acl_category("fai");
-        $this->dialog->parent = &$this;
-        $this->is_dialog=true;
-      }
-    }
-
-    if($this->dn != "new"){
-      $_SESSION['objectinfo']= $this->dn;
-    }
-
-    /* Save Dialog */
-    if(isset($_POST['SaveSubObject']) && is_object($this->dialog)){
-      $this->dialog->save_object();
-      $msgs = $this->dialog->check();
-      if(count($msgs)>0){
-        foreach($msgs as $msg){
-          print_red($msg);
-        }
-      }else{
-        /* Get return object */
-        $obj = $this->dialog->save();
-        if(isset($obj['remove'])){
-
-          $old_stat = $this->SubObjects[$obj['remove']['from']]['status'];
-
-          /* Depending on status, set new status */
-          if($old_stat == "edited" || $old_stat == "FreshLoaded"){
-            $this->SubObjects[$obj['remove']['from']]['status'] = "delete";
-          }elseif($this->SubObjects[$obj['remove']['from']]['status']=="new"){
-            unset($this->SubObjects[$obj['remove']['from']]);
-          }
-          $obj['status'] = "new";
-          $this->SubObjects[$obj['remove']['to']] = $obj;
-          unset($this->SubObjects[$obj['remove']['to']]['remove']);
-        }else{
-          if($obj['status'] == "FreshLoaded"){
-            $obj['status'] = "edited";
-          }
-          $this->SubObjects[$obj['cn']]=$obj;
-        }
-        $this->is_dialog=false;
-        unset($this->dialog);
-        $this->dialog=FALSE;
-      }
-    }
-
-    /* Sort entries */
-    $tmp = $keys = array();
-    foreach($this->SubObjects as $key => $entry){
-      $keys[$key]=$key;
-    }
-    natcasesort($keys);
-    foreach($keys as $key){
-      $tmp[$key]=$this->SubObjects[$key];
-    }
-    $this->SubObjects = $tmp;
-
-    /* Cancel Dialog */
-    if(isset($_POST['CancelSubObject'])){
-      $this->is_dialog=false; 
-      unset($this->dialog);
-      $this->dialog=FALSE;
-    }
-
-    /* Print dialog if $this->dialog is set */
-    if(is_object($this->dialog)){
-      $this->dialog->save_object();
-      $display = $this->dialog->execute();
-      return($display);
-    }
-
-     /* Divlist Containing FAItemplates */
-    $divlist = new divSelectBox("FAItemplates");
-    $divlist->setHeight(400);
-
-    $tmp = $this->getList(true);
-  
-    /* Create div list with all sub entries listed */
-    foreach($this->SubObjects as $key => $name){
-
-      /* Skip removed entries */ 
-      if($name['status'] == "delete") continue;
-
-      /* Get permissions */
-      $dn  = $this->acl_base_for_current_object($name['dn']);
-      $acl = $this->ui->get_permissions($dn,"fai/faiTemplateEntry")  ;
-      $act = "";
-
-      /* Hide delete icon if this object is freezed */
-      if(preg_match("/freeze/",$this->FAIstate)){
-        $act .= "<input type='image' src='images/edit.png'      name='editscript_%s'    title='"._("edit")."' alt='"._("edit")."'>";
-      }else{
-        $act .= "<input type='image' src='images/edit.png'      name='editscript_%s'    title='"._("edit")."' alt='"._("edit")."'>";
-        if(preg_match("/d/",$acl)){
-          $act .="<input type='image' src='images/edittrash.png' name='deletescript_%s'  title='"._("delete")."' alt='"._("delete")."'>";
-        }
-      }
-
-      /* Check acls for download icon */
-      $s_acl = $this->ui->get_permissions($dn,"fai/faiTemplateEntry","FAItemplateFile")  ;
-      if(($this->SubObjects[$key]['status'] == "new") || ($this->SubObjects[$key]['dn'] == "new") || !preg_match("/r/",$s_acl)){
-        $down = "";
-      }else{
-        $down = "<a href='getFAIscript.php?is_template&amp;id=".base64_encode($dn)."'>
-          <img src='images/save.png' alt='"._("Download")."' title='"._("Download")."' border=0>
-          </a>";
-      }
-
-      /* Check if we are allowed to view this object */
-      $s_acl = $this->ui->get_permissions($dn,"fai/faiTemplateEntry","cn")  ;
-      if(preg_match("/r/",$s_acl)){
-
-        $edit_link = "<a href='?plug=".$_GET['plug']."&amp;act=edit&amp;id=".$key."'>".$tmp[$key]."</a>";
-        $divlist->AddEntry(array( array("string"=> $edit_link), 
-              array("string"=>$down , "attach" => "style='width:20px;'"),
-              array("string"=>str_replace("%s",base64_encode($key),$act),
-                "attach"=>"style='border-right: 0px;width:50px;text-align:right;'")));
-      }
-    }
-    $smarty->assign("Entry_divlist",$divlist->DrawList());
-    /* Divlist creation complete
-     */
-
-     /* Magic quotes GPC, escapes every ' " \, to solve some security risks
-     * If we post the escaped strings they will be escaped again
-     */
-    foreach($this->attributes as $attrs){
-      if(get_magic_quotes_gpc()){
-        $smarty->assign($attrs,stripslashes($this->$attrs));
-      }else{
-        $smarty->assign($attrs,($this->$attrs));
-      }
-    }
-
-    $dn = $this->acl_base_for_current_object($this->dn);
-    $smarty->assign("sub_object_is_addable", 
-            preg_match("/c/",$this->ui->get_permissions($dn,"fai/faiTemplateEntry")) && 
-            !preg_match("/freeze/",$this->FAIstate));
-
-    foreach($this->attributes as $attr){
-      $smarty->assign($attr."ACL",$this->getacl($attr));
-    }
-
-    $display.= $smarty->fetch(get_template_path('faiTemplate.tpl', TRUE));
-    return($display);
-  }
-
-
-  function acl_base_for_current_object($dn)
-  {
-    if($dn == "new"){
-      if($this->dn == "new"){
-        $dn= $_SESSION['CurrentMainBase'];
-      }else{
-        $dn = $this->dn;
-      }
-    }
-    return($dn);
-  }
-
-
-  /* Generate listbox friendly SubObject list
-  */
-  function getList(){
-    $a_return=array();
-    foreach($this->SubObjects as $obj){
-      if($obj['status'] != "delete"){
-      
-        if((isset($obj['description']))&&(!empty($obj['description']))){
-          if(strlen($obj['description']) > 40){
-            $obj['description'] = substr($obj['description'],0,40)."...";
-          }
-          $a_return[$obj['cn']]= $obj['cn']." [".$obj['description']."]";
-        }else{
-          $a_return[$obj['cn']]= $obj['cn'];
-        }
-      }
-    }
-    return($a_return);
-  }
-
-  /* Delete me, and all my subtrees
-   */
-  function remove_from_parent()
-  {
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd ($this->dn);
-
-#    $use_dn = str_ireplace( get_release_dn($this->dn), $_SESSION['faifilter']['branch'], $this->dn);
-    $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $this->dn);
-    if($_SESSION['faifilter']['branch'] == "main"){
-      $use_dn = $this->dn;
-    }
-
-    prepare_to_save_FAI_object($use_dn,array(),true);
-    new log("remove","fai/".get_class($this),$use_dn,$this->attributes);
-
-    foreach($this->SubObjects as $name => $obj){
-#      $use_dn = str_ireplace( get_release_dn($this->dn), $_SESSION['faifilter']['branch'], $obj['dn']);
-      $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $obj['dn']);
-      if($_SESSION['faifilter']['branch'] == "main"){
-        $use_dn = $obj['dn'];
-      }
-      prepare_to_save_FAI_object($use_dn,array(),true);
-    }
-    $this->handle_post_events("remove");    
-  }
-
-
-  /* Save data to object 
-   */
-  function save_object()
-  {
-    if((isset($_POST['FAItemplate_posted'])) && (!preg_match("/freeze/",$this->FAIstate))){
-      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()
-  {
-    plugin::save();
-
-    $ldap = $this->config->get_ldap_link();
-
-    prepare_to_save_FAI_object($this->dn,$this->attrs);
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of FAI/template with dn '%s' failed."),$this->dn));
-
-    if($this->initially_was_account){
-      new log("modify","fai/".get_class($this),$this->dn,$this->attributes);
-    }else{
-      new log("create","fai/".get_class($this),$this->dn,$this->attributes);
-    }
-
-    /* Do object tagging */
-    $this->handle_object_tagging();
-
-    /* Prepare FAIscriptEntry to write it to ldap
-     * First sort array.
-     *  Because we must delete old entries first.
-     * After deletion, we perform add and modify 
-     */
-    $Objects = array();
-    foreach($this->SubObjects as $name => $obj){
-      if($obj['status'] == "FreshLoaded"){
-        unset($this->SubObjects[$name]);
-      }
-    }
-
-    foreach($this->SubObjects as $name => $obj){
-      if($obj['status'] == "delete"){
-        $Objects[$name] = $obj; 
-      }
-    }
-    foreach($this->SubObjects as $name => $obj){
-      if($obj['status'] != "delete"){
-        $Objects[$name] = $obj; 
-      }
-    }
-
-    foreach($Objects as $name => $obj){
-
-      foreach($this->sub64coded as $codeIt){
-        $obj[$codeIt]=base64_encode($obj[$codeIt]);
-      }
-      $tmp = array();
-      $attributes = array_merge($this->sub_Load_Later,$this->subAttributes);
-      foreach($attributes as $attrs){
-        if(empty($obj[$attrs])){
-          $obj[$attrs] = array();
-        }
-        $tmp[$attrs] =($obj[$attrs]);
-      }    
-        
-      $tmp['objectClass'] = $this->subClasses;
-
-      $sub_dn = "cn=".$obj['cn'].",".$this->dn;
-
-      if($obj['status']=="new"){
-        $ldap->cat($sub_dn,array("objectClass"));
-        if($ldap->count()){
-          $obj['status']="edited";
-        }
-      }
-
-       /* Check if gosaAdministrativeUnitTag is required as object class */
-      if($obj['status'] == "edited"){
-        $ldap->cat($sub_dn,array("objectClass"));
-        $attrs = $ldap->fetch();
-        if(isset($attrs['objectClass'])){
-          if(in_array_ics("gosaAdministrativeUnitTag",$attrs['objectClass'])){
-            $tmp['objectClass'][] = "gosaAdministrativeUnitTag";
-          }
-        }
-      }
-
-      if($obj['status'] == "delete"){
-        prepare_to_save_FAI_object($sub_dn,array(),true);
-        $this->handle_post_events("remove");
-      }elseif($obj['status'] == "edited"){
-        prepare_to_save_FAI_object($sub_dn,$tmp);
-        $this->handle_post_events("modify");
-      }elseif($obj['status']=="new"){
-        prepare_to_save_FAI_object($sub_dn,$tmp);
-        $this->handle_post_events("add");
-      }
-
-
-      $this->handle_object_tagging($sub_dn, $this->gosaUnitTag);
-    }
-  }
-
-
-  function PrepareForCopyPaste($source)
-  {
-    plugin::PrepareForCopyPaste($source);
-
-    /* Read all leaf objects of this object (For FAIscript this would be FAIscriptEntry)
-     */
-    $ldap     = $this->config->get_ldap_link();
-    $ldap->cd ($source['dn']);
-
-    $attrs_to_search = $this->subAttributes;
-    $attrs_to_search[] = "FAIstate";
-    $ldap->search("(&(objectClass=FAIclass)(objectClass=".$this->subClass."))",$attrs_to_search);
-
-    while($object = $ldap->fetch()){
-
-      /* Skip objects, that are tagged as removed */
-      if(isset($object['FAIstate'][0])){
-        if(preg_match("/removed$/",$object['FAIstate'][0])){
-          continue;
-        }
-      }
-
-      /* Set status for save management */
-      $objects = array();
-      $objects['status']      = "edited";
-      $objects['dn']          = $object['dn'];
-      $objects                = $this->get_object_attributes($objects,$this->subAttributes);
-      $objects                = $this->get_object_attributes($objects,$this->sub_Load_Later);
-
-      $this->SubObjects[$objects['cn']] = $objects;
-    }
-  }
-  
-
-  /* Return plugin informations for acl handling */ 
-  static function plInfo()
-  {
-    return (array( 
-          "plShortName" => _("Template"),
-          "plDescription" => _("FAI template"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 24,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("fai"),
-          "plProvidedAcls" => array(
-            "cn"                => _("Name")." ("._("Readonly").")",
-            "description"       => _("Description"))
-          ));
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/fai/class_faiTemplateEntry.inc b/plugins/admin/fai/class_faiTemplateEntry.inc
deleted file mode 100644 (file)
index 05c6b72..0000000
+++ /dev/null
@@ -1,275 +0,0 @@
-<?php
-
-class faiTemplateEntry 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","description","FAItemplateFile","FAItemplatePath","FAImode","user","group","binary","FAIowner");
-  var $objectclasses= array();
-
-  var $orig_cn              = "";
-
-  var $dn            = "";
-  var $cn            = "";
-  var $FAItemplateFile   = "";
-  var $FAItemplatePath   = "";
-  var $description   = "";
-  var $status        = "new";
-  var $FAImode       = "0640";
-  var $FAIowner      = "root.root";
-  var $user          = "root";
-  var $group         = "root";
-  var $binary        = false;
-  var $parent        = NULL;
-  var $FAIstate      = "";
-  
-  function faiTemplateEntry (&$config, $dn= NULL,$object=false)
-  {
-    plugin::plugin ($config, $dn);
-
-    if((isset($object['cn'])) && (!empty($object['cn']))){
-      $this->orig_cn= $object['cn'];
-      $this->dn=$object['dn'];
-      foreach($object as $name=>$value){
-        $oname = $name;
-        $this->$oname=$value;
-      }
-
-      if(isset($this->attrs['FAIstate'][0])){
-        $this->FAIstate = $this->attrs['FAIstate'][0];
-      }
-
-    }else{
-      $this->status = "new";
-      $this->orig_cn= false;
-    }
-
-    $this->user = explode( '.', $this->FAIowner );
-    $this->group = $this->user[1];
-    $this->user = $this->user[0];
-
-    $_SESSION['binary'] = $this->FAItemplateFile;
-    $_SESSION['binarytype'] = 'octet-stream';
-    $_SESSION['binaryfile'] = basename( $this->FAItemplatePath );
-
-    if(!empty($this->dn) && $this->dn != "new"){
-      $ldap = $this->config->get_ldap_link();
-      $_SESSION['binary'] =$ldap->get_attribute($this->dn,"FAItemplateFile");
-      $this->FAItemplateFile = $_SESSION['binary'];
-    }
-    
-    $this->FAImode= sprintf("%0.4s", $this->FAImode)." ";
-  }
-
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* Fill templating stuff */
-    $smarty     = get_smarty();
-    $smarty->assign("rand", rand(0, 10000));
-    $display = "";
-
-    if(isset($_POST['TmpFileUpload']) && $this->acl_is_writeable("FAItemplateFile")){
-      if($str=file_get_contents($_FILES['FAItemplateFile']['tmp_name'])){
-        $this->FAItemplateFile = $str;
-
-        /* If we don't have a filename set it from upload filename. */
-        if( 0 == strlen( $this->FAItemplatePath )){
-          $this->FAItemplatePath = $_FILES['FAItemplateFile']['name'];
-        }
-
-        $_SESSION['binary']     = $this->FAItemplateFile;
-        $_SESSION['binarytype'] = 'octet-stream';
-        $_SESSION['binaryfile'] = basename( $this->FAItemplatePath );
-      }
-    }
-    
-    $status= _("no file uploaded yet");
-
-    $bStatus = false; // Hide download icon on default 
-    
-    if(strlen($this->FAItemplateFile)){
-
-      $status= sprintf(_("exists in database (size: %s bytes)"),strlen($this->FAItemplateFile));
-      $bStatus = true;  // Display download icon 
-    }
-    $smarty->assign("status",$status);
-    $smarty->assign("bStatus",$bStatus);
-
-    /* Magic quotes GPC, escapes every ' " \, to solve some security risks 
-     * If we post the escaped strings they will be escaped again
-     */
-    foreach($this->attributes as $attrs){
-      if(get_magic_quotes_gpc()){
-        $smarty->assign($attrs,stripslashes($this->$attrs));
-      }else{
-        $smarty->assign($attrs,($this->$attrs));
-      }
-    }
-
-    /* Assign file modes */
-    $tmode= "$this->FAImode ";
-    foreach (array("s", "u", "g", "o") as $type){
-      $current= substr($tmode, 0, 1);
-      $tmode=   preg_replace("/^./", "", $tmode);
-      $nr= 1;
-      while ($nr < 5){
-        if ($current & $nr){
-          $smarty->assign($type.$nr, "checked");
-        } else {
-          $smarty->assign($type.$nr, "");
-        }
-        $nr+= $nr;
-      }
-    }
-
-    $smarty->assign("FAItemplateFile","");
-
-    foreach($this->attributes as $attr){
-      $smarty->assign($attr."ACL",$this->getacl($attr,preg_match("/freeze/",$this->FAIstate)));
-    }
-
-    /* We now split cn/FAItemplatePath to make things more clear... */
-    $smarty->assign("cn", basename($this->FAItemplatePath));
-    $smarty->assign("templatePath", dirname($this->FAItemplatePath));
-
-    $display.=  $smarty->fetch(get_template_path('faiTemplateEntry.tpl', TRUE));
-    return($display);
-  }
-
-  /* Save data to object */
-  function save_object()
-  {
-    /* Check if form is posted and we are not freezed */
-    if((isset($_POST['SubObjectFormSubmitted'])) && ($this->FAIstate != "freeze")){
-
-      plugin::save_object();
-
-      /* Set user.group (FAIowner) attribute */  
-      if(isset($_POST['group']) && isset($_POST["user"]) && $this->acl_is_writeable("FAIowner")){
-        $this->FAIowner = $_POST["user"].'.'.$_POST["group"];
-        $this->user = $_POST['user'];
-        $this->group= $_POST['group'];
-      }
-
-      /* Check if permissions have changed */
-      if($this->acl_is_writeable("FAImode")){
-
-        /* Save mode */
-        $tmode= "";
-        foreach (array("s", "u", "g", "o") as $type){
-          $nr= 1;
-          $dest= 0;
-          while ($nr < 5){
-            if (isset($_POST["$type$nr"])){
-              $dest+= $nr;
-            }
-            $nr+= $nr;
-          }
-          $tmode= $tmode.$dest;
-        }
-        $this->FAImode= $tmode;
-
-        /* Assemble cn/FAItemplatePath */
-        $this->cn= preg_replace('/\/+/', '/', $this->FAItemplatePath.'/'.$this->cn);
-        $this->FAItemplatePath= $this->cn;
-      }
-    }
-  }
-
-
-  /* Check supplied data */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    if(isset($this->parent->SubObjects[$this->cn]) && $this->cn != $this->orig_cn){
-      $message[] =_("There is already a template with the given name.");
-    }
-
-    if(empty($this->FAItemplateFile)){
-      $message[]=_("Please specify a value for attribute 'file'.");
-    } 
-
-    if(!preg_match('/^\//', $this->FAItemplatePath)){
-      $message[]=_("Please specify a valid value for attribute 'Destination path'.");
-    } 
-  
-    if(empty($this->cn)){
-      $message[] = _("Please enter a file name.");
-    }
-
-#    echo $this->cn;
-#    if(preg_match('/\//', $this->cn)){
-#      $message[] = _("The file name should not contain / characters.");
-# #   }
-
-    if(empty($this->user)){
-      $message[] = _("Please enter a user.");
-    }
-    elseif(preg_match("/[^0-9a-z]/i",$this->user)){
-      $message[] = _("Please enter a valid user. Only a-z/0-9 are allowed.");
-    }
-
-    if(empty($this->group)){
-      $message[] = _("Please enter a group.");
-    }
-    elseif(preg_match("/[^0-9a-z]/i",$this->group)){
-      $message[] = _("Please enter a valid group. Only a-z/0-9 are allowed.");
-    }
-
-    return ($message);
-  }
-  function save()
-  {
-    $tmp=array();
-    foreach($this->attributes as $attrs){ 
-      $tmp[$attrs] = $this->$attrs;
-    }
-
-    if(($this->orig_cn)&&($tmp['cn']!=$this->orig_cn)){
-      $tmp['remove']['from']  = $this->orig_cn;
-      $tmp['remove']['to']    = $tmp['cn'];
-    }
-  
-    $tmp['dn']      = $this->dn;  
-    $tmp['status']  = $this->status;  
-
-    return($tmp);
-  }
-
-  
-  /* Return plugin informations for acl handling */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName" => _("Template entry"),
-          "plDescription" => _("FAI template entry"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 25,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("fai"),
-          "plProvidedAcls" => array(
-            "cn"                => _("Name"),
-            "description"       => _("Description"),
-            "FAItemplateFile"   => _("Template file"),
-            "FAItemplatePath"   => _("Template path"),
-            "FAIowner"          => _("File owner"),
-            "FAImode"           => _("File permissions"))
-          ));
-  }
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/fai/class_faiVariable.inc b/plugins/admin/fai/class_faiVariable.inc
deleted file mode 100644 (file)
index ae6b79a..0000000
+++ /dev/null
@@ -1,475 +0,0 @@
-<?php
-
-class faiVariable 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;
-
-  /* Attributes for this Object */
-  var $attributes       = array("cn","description");
-
-  /* ObjectClasses for this Object*/
-  var $objectclasses    = array("top","FAIclass","FAIvariable");
-
-  /* Class name of the Ldap ObjectClass for the Sub Object */
-  var $subClass         = "FAIvariableEntry";
-  var $subClasses       = array("top","FAIclass","FAIvariableEntry");
-
-  /* Class name of the php class which allows us to edit a Sub Object */
-  var $subClassName     = "faiVariableEntry";      
-
-  /* Attributes to initialise for each subObject */
-  var $subAttributes    = array("cn","description","FAIvariableContent"); 
-  var $sub64coded       = array();  
-
-  /* Specific attributes */
-  var $cn               = "";       // The class name for this object
-  var $description      = "";       // The description for this set of partitions
-  var $is_dialog        = false;    // specifies which buttons will be shown to save or abort
-  var $SubObjects       = array();  // All leafobjects of this object
-
-  var $FAIstate         = "";
-  var $ui   ;
-  var $view_logged      = FALSE;
-
-  function faiVariable (&$config, $dn= NULL)
-  {
-    /* Load Attributes */
-    plugin::plugin ($config, $dn);
-
-    if($dn != "new"){
-      $this->dn =$dn;
-
-      /* Get FAIstate
-       */
-      if(isset($this->attrs['FAIstate'][0])){
-        $this->FAIstate = $this->attrs['FAIstate'][0];
-      }
-
-      /* Read all leaf objects of this object (For FAIscript this would be FAIscriptEntry)
-       */
-      $ldap     = $this->config->get_ldap_link();
-      $ldap->cd ($this->dn);
-
-      $attrs_to_search = $this->subAttributes;
-      $attrs_to_search[] = "FAIstate";
-      $ldap->search("(&(objectClass=FAIclass)(objectClass=".$this->subClass."))",$attrs_to_search);
-
-      while($object = $ldap->fetch()){
-      
-        /* Skip objects, that are tagged as removed */
-        if(isset($object['FAIstate'][0])){
-          if(preg_match("/removed$/",$object['FAIstate'][0])){
-            continue;
-          }
-        }
-
-        /* Set status for save management */
-        foreach($this->subAttributes as $attrs){
-          if(!isset($object[$attrs][0])){
-            $this->SubObjects[$object['cn'][0]][$attrs]="";
-          }else{
-            $this->SubObjects[$object['cn'][0]][$attrs]=$object[$attrs][0];
-          }
-        }
-     
-        foreach($this->sub64coded as $codeIt){
-          $this->SubObjects[$object['cn'][0]][$codeIt]=base64_decode($this->SubObjects[$object['cn'][0]][$codeIt]);
-        }
-        $this->SubObjects[$object['cn'][0]]['status']      = "edited";
-        $this->SubObjects[$object['cn'][0]]['dn']          = $object['dn'];
-      }
-
-    }
-    $this->ui = get_userinfo();
-  }
-
-
-  function acl_base_for_current_object($dn)
-  {
-    if($dn == "new"){
-      if($this->dn == "new"){
-        $dn= $_SESSION['CurrentMainBase'];
-      }else{
-        $dn = $this->dn;
-      }
-    }
-    return($dn);
-  }
-
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","fai/".get_class($this),$this->dn);
-    }
-
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-    $display= "";
-
-    /* Add new sub object */
-    if(isset($_POST['AddSubObject'])){
-      $this->dialog= new $this->subClassName($this->config,"new");
-      $this->dialog->set_acl_base($this->acl_base_for_current_object($this->dn));
-      $this->dialog->set_acl_category("fai");
-      $this->dialog->parent = &$this;
-      $this->is_dialog=true;
-    }
-
-    if($this->dn != "new"){
-      $_SESSION['objectinfo']= $this->dn;
-    }
-
-
-    /* Edit selected Sub Object */
-    if((isset($_POST['EditSubObject']))&&(isset($_POST['SubObject']))){
-
-      $var = $_POST['SubObject'][0];
-      $c_dn = $this->acl_base_for_current_object($this->SubObjects[$var]['dn']);
-      $this->dialog= new $this->subClassName($this->config,$this->dn,$this->SubObjects[$var]);
-      $this->dialog->set_acl_category("fai");
-      $this->dialog->set_acl_base($c_dn);
-      $this->dialog->parent = &$this;
-      $_SESSION['objectinfo'] = $this->SubObjects[$var]['dn'];
-      $this->is_dialog=true;
-    }
-    
-    /* Remove Sub object */
-    if((isset($_POST['DelSubObject']))&&(isset($_POST['SubObject']))){
-      foreach($_POST['SubObject'] as $var){
-
-        $c_dn = $this->acl_base_for_current_object($this->SubObjects[$var]['dn']);
-        $acl = $this->ui->get_permissions($c_dn,"fai/faiVariable");
-        if(preg_match("/d/",$acl)){
-          if($this->SubObjects[$var]['status'] == "edited"){
-            $this->SubObjects[$var]['status']= "delete";
-          }else{
-            unset($this->SubObjects[$var]);
-          }
-        }
-      }
-    }
-
-    /* Save Dialog */
-    if(isset($_POST['SaveSubObject'])){
-      $this->dialog->save_object();
-      $msgs = $this->dialog->check();
-      if(count($msgs)>0){
-        foreach($msgs as $msg){
-          print_red($msg);
-        }
-      }else{
-        $obj = $this->dialog->save();
-        if(isset($obj['remove'])){
-          if($this->SubObjects[$obj['remove']['from']]['status']=="edited"){
-            $this->SubObjects[$obj['remove']['from']]['status'] = "delete";
-          }elseif($this->SubObjects[$obj['remove']['from']]['status']=="new"){
-            unset($this->SubObjects[$obj['remove']['from']]);
-          }
-          $obj['status'] = "new";
-          $this->SubObjects[$obj['remove']['to']] = $obj;
-          unset($this->SubObjects[$obj['remove']['to']]['remove']);
-        }else{
-          $this->SubObjects[$obj['cn']]=$obj;
-        }
-        $this->is_dialog=false;
-        unset($this->dialog);
-        $this->dialog=FALSE;
-      }
-    }
-
-    /* Sort entries */
-    $tmp = $keys = array();
-    foreach($this->SubObjects as $key => $entry){
-      $keys[$key]=$key;
-    }
-    natcasesort($keys);
-    foreach($keys as $key){
-      $tmp[$key]=$this->SubObjects[$key];
-    } 
-    $this->SubObjects = $tmp;
-
-    /* Cancel Dialog */
-    if(isset($_POST['CancelSubObject'])){
-      $this->is_dialog=false; 
-      unset($this->dialog);
-      $this->dialog=FALSE;
-    }
-
-    /* Print dialog if $this->dialog is set */
-    if(is_object($this->dialog)){
-      $this->dialog->save_object();
-      $display = $this->dialog->execute();
-      return($display);
-    }
-
-    $ui = get_userinfo();
-    $ret = $this->getList();
-    $tmp = array();
-    foreach($this->SubObjects as $key => $obj){
-      $acl = $ui->get_permissions($obj['dn'],"fai/faiVariableEntry");
-      if(preg_match("/r/",$acl) || $obj['dn'] == "new"){
-        $tmp[$key] = $ret[$key];
-      } 
-    }
-    $smarty->assign("SubObjects",$tmp);
-
-
-    /* Magic quotes GPC, escapes every ' " \, to solve some security risks
-     * If we post the escaped strings they will be escaped again
-     */
-    foreach($this->attributes as $attrs){
-      if(get_magic_quotes_gpc()){
-        $smarty->assign($attrs,htmlentities (stripslashes(utf8_decode($this->$attrs))));
-      }else{
-        $smarty->assign($attrs,htmlentities (utf8_decode($this->$attrs)));
-      }
-    }
-
-    $c_dn = $this->acl_base_for_current_object($this->dn);
-    $smarty->assign("is_createable",     preg_match("/c/",$this->ui->get_permissions($c_dn,"fai/faiVariableEntry")) && $this->FAIstate!="freeze");
-    $smarty->assign("is_removeable",  preg_match("/d/",$this->ui->get_permissions($c_dn,"fai/faiVariableEntry")) && $this->FAIstate!="freeze");
-
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translation) {
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-    
-
-    $display.= $smarty->fetch(get_template_path('faiVariable.tpl', TRUE));
-    return($display);
-  }
-
-  /* Generate listbox friendly SubObject list
-  */
-  function getList(){
-    $a_return=array();
-    foreach($this->SubObjects as $obj){
-      if($obj['status'] != "delete"){
-
-        if((isset($obj['description']))&&(!empty($obj['description']))&&(!preg_match("/\[\*\]/",$obj['description']))){
-          if (preg_match("/\[\*\]/", $obj['description'])){
-            $a_return[$obj['cn']]= $obj['cn']." [".preg_replace("/\s*\[\*\]\s*/", "", $obj['description'])."]";
-          } else {
-            $a_return[$obj['cn']]= $obj['cn']."=".$obj['FAIvariableContent']." [".$obj['description']."]";
-          }
-        }else{
-          if (preg_match("/\[\*\]/", $obj['description'])){
-            $a_return[$obj['cn']]= $obj['cn'];
-          } else {
-            $a_return[$obj['cn']]= $obj['cn']."=".$obj['FAIvariableContent'];
-          }
-        }
-      }
-    }
-    return($a_return);
-  }
-
-  /* Delete me, and all my subtrees
-   */
-  function remove_from_parent()
-  {
-    if($this->acl_is_removeable()){
-      $ldap = $this->config->get_ldap_link();
-      $ldap->cd ($this->dn);
-
-      $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $this->dn);
-      if($_SESSION['faifilter']['branch'] == "main"){
-        $use_dn = $this->dn;
-      }
-  
-      prepare_to_save_FAI_object($use_dn,array(),true);
-      new log("remove","fai/".get_class($this),$use_dn,$this->attributes);
-
-      foreach($this->SubObjects as $name => $obj){
-        $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $obj['dn']);
-        if($_SESSION['faifilter']['branch'] == "main"){
-          $use_dn = $obj['dn'];
-        }
-        prepare_to_save_FAI_object($use_dn,array(),true);
-      }
-      $this->handle_post_events("remove");
-    }
-  }
-
-
-  /* Save data to object 
-   */
-  function save_object()
-  {
-    if((isset($_POST['FAIvariable_posted'])) && ($this->FAIstate != "freeze") ){
-      plugin::save_object();
-      foreach($this->attributes as $attrs){
-        if(isset($_POST[$attrs])){
-          $this->$attrs = $_POST[$attrs];
-        }
-      }
-    }
-  }
-
-
-  /* Check supplied data */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    return ($message);
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    plugin::save();
-    $ldap = $this->config->get_ldap_link();
-    prepare_to_save_FAI_object($this->dn,$this->attrs);
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of FAI/variable with dn '%s' failed."),$this->dn));
-
-    if($this->initially_was_account){
-      new log("modify","fai/".get_class($this),$this->dn,$this->attributes);
-    }else{
-      new log("create","fai/".get_class($this),$this->dn,$this->attributes);
-    }
-    /* Do object tagging */
-    $this->handle_object_tagging();
-    /* Prepare FAIscriptEntry to write it to ldap
-     * First sort array.
-     *  Because we must delete old entries first.
-     * After deletion, we perform add and modify 
-     */
-    $Objects = array();
-    foreach($this->SubObjects as $name => $obj){
-      if($obj['status'] == "delete"){
-        $Objects[$name] = $obj; 
-      }
-    }
-    foreach($this->SubObjects as $name => $obj){
-      if($obj['status'] != "delete"){
-        $Objects[$name] = $obj; 
-      }
-    }
-
-    foreach($Objects as $name => $obj){
-
-      foreach($this->sub64coded as $codeIt){
-        $obj[$codeIt]=base64_encode($obj[$codeIt]);
-      }
-
-      $tmp = array();
-      foreach($this->subAttributes as $attrs){
-        if(empty($obj[$attrs])){
-          $obj[$attrs] = array();
-        }
-        $tmp[$attrs] = $obj[$attrs];
-      }    
-        
-      $tmp['objectClass'] = $this->subClasses;
-
-      $sub_dn = "cn=".$obj['cn'].",".$this->dn;
-
-      if($obj['status']=="new"){
-        $ldap->cat($sub_dn,array("objectClass"));
-        if($ldap->count()){
-          $obj['status']="edited";
-        }
-      }
-
-      /* Check if gosaAdministrativeUnitTag is required as object class */
-      if($obj['status'] == "edited"){
-        $ldap->cat($sub_dn,array("objectClass"));
-        $attrs = $ldap->fetch();
-        if(isset($attrs['objectClass'])){
-          if(in_array_ics("gosaAdministrativeUnitTag",$attrs['objectClass'])){
-            $tmp['objectClass'][] = "gosaAdministrativeUnitTag";
-          }
-        }
-      }
-      
-      if($obj['status'] == "delete"){
-        prepare_to_save_FAI_object($sub_dn,array(),true);
-        $this->handle_post_events("remove");
-      }elseif($obj['status'] == "edited"){
-        prepare_to_save_FAI_object($sub_dn,$tmp);
-        $this->handle_post_events("modify");
-      }elseif($obj['status']=="new"){
-        prepare_to_save_FAI_object($sub_dn,$tmp);
-        $this->handle_post_events("add");
-      }
-
-      $this->handle_object_tagging($sub_dn, $this->gosaUnitTag);
-    }
-  }
-
-
-  function PrepareForCopyPaste($source)
-  {
-    plugin::PrepareForCopyPaste($source);
-
-    /* Read all leaf objects of this object (For FAIscript this would be FAIscriptEntry)
-     */
-    $ldap     = $this->config->get_ldap_link();
-    $ldap->cd ($source['dn']);
-    $attrs_to_search = $this->subAttributes;
-    $attrs_to_search[] = "FAIstate";
-    $ldap->search("(&(objectClass=FAIclass)(objectClass=".$this->subClass."))",$attrs_to_search);
-    while($object = $ldap->fetch()){
-
-      /* Skip objects, that are tagged as removed */
-      if(isset($object['FAIstate'][0])){
-        if(preg_match("/removed$/",$object['FAIstate'][0])){
-          continue;
-        }
-      }
-
-      /* Set status for save management */
-      foreach($this->subAttributes as $attrs){
-        if(!isset($object[$attrs][0])){
-          $this->SubObjects[$object['cn'][0]][$attrs]="";
-        }else{
-          $this->SubObjects[$object['cn'][0]][$attrs]=$object[$attrs][0];
-        }
-      }
-      foreach($this->sub64coded as $codeIt){
-        $this->SubObjects[$object['cn'][0]][$codeIt]=base64_decode($this->SubObjects[$object['cn'][0]][$codeIt]);
-      }
-      $this->SubObjects[$object['cn'][0]]['status']      = "edited";
-      $this->SubObjects[$object['cn'][0]]['dn']          = $object['dn'];
-    }
-  } 
-
-  /* Return plugin informations for acl handling */ 
-  static function plInfo()
-  {
-    return (array( 
-          "plShortName" => _("Variable"),
-          "plDescription" => _("FAI variable"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 22,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("fai"),
-          "plProvidedAcls" => array(
-            "cn"                => _("Name")." ("._("Read only").")",
-            "description"       => _("Description"))
-          ));
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/fai/class_faiVariableEntry.inc b/plugins/admin/fai/class_faiVariableEntry.inc
deleted file mode 100644 (file)
index 5fc6ef0..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-<?php
-
-class faiVariableEntry 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","description","FAIvariableContent");
-  var $objectclasses= array();
-
-  var $orig_cn              = "";
-  var $dn            = "";
-  var $cn            = "";
-  var $FAIvariableContent   = "";
-  var $description   = "";
-  var $status        = "new";
-  var $parent        = NULL;
-  var $FAIstate      = "";
-  
-  function faiVariableEntry (&$config, $dn= NULL,$object=false)
-  {
-    plugin::plugin ($config, $dn);
-    if((isset($object['cn'])) && (!empty($object['cn']))){
-      $this->orig_cn= $object['cn'];
-      $this->dn=$object['dn'];
-      foreach($object as $name=>$value){
-        $oname = $name;
-        $this->$oname=addslashes($value);
-      }
-
-      if(isset($this->attrs['FAIstate'][0])){
-        $this->FAIstate = $this->attrs['FAIstate'][0];
-      }
-
-    }else{
-      $this->status = "new";
-      $this->orig_cn       = false;
-    }
-  }
-
-  function execute()
-  {
-       /* Call parent execute */
-       plugin::execute();
-
-    /* Fill templating stuff */
-    $smarty     = get_smarty();
-    $display = "";
-
-     /* Magic quotes GPC, escapes every ' " \, to solve some security risks
-     * If we post the escaped strings they will be escaped again
-     */
-    foreach($this->attributes as $attrs){
-      if(get_magic_quotes_gpc()){
-        $smarty->assign($attrs,htmlentities (stripslashes(utf8_decode($this->$attrs))));
-      }else{
-        $smarty->assign($attrs,htmlentities (utf8_decode($this->$attrs)));
-      }
-    }
-
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translated){
-      $acl = $this->getacl($name);
-      if($this->FAIstate == "freezed"){
-        $acl = preg_replace("/w/","",$acl);
-      }
-      $smarty->assign($name."ACL",$acl);
-    }
-
-
-
-    $display.= $smarty->fetch(get_template_path('faiVariableEntry.tpl', TRUE));
-    return($display);
-  }
-
-  /* Save data to object */
-  function save_object()
-  {
-     if((isset($_POST['SubObjectFormSubmitted'])) && ($this->FAIstate != "freeze")){
-      foreach($this->attributes as $attrs){
-        if($this->acl_is_writeable($attrs)){
-          if(isset($_POST[$attrs])){
-            $this->$attrs = $_POST[$attrs];
-          }else{
-            $this->$attrs = "";
-          }
-        }
-      }
-    }
-  }
-
-  /* Check supplied data */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    if(isset($this->parent->SubObjects[$this->cn]) && $this->cn != $this->orig_cn){
-      $message[] =_("There is already a variable with the given name.");
-    }
-    
-    if(empty($this->FAIvariableContent)) {
-      $message[]=_("Please specify a value for the attribute 'content'."); 
-    }
-   
-    if(empty($this->cn)){
-      $message[] = _("Please enter a name.");
-    }
-
-    return ($message);
-  }
-  function save()
-  {
-    $tmp=array();
-    foreach($this->attributes as $attrs){ 
-      $tmp[$attrs] = stripslashes( $this->$attrs);
-    }
-
-    if(($this->orig_cn)&&($tmp['cn']!=$this->orig_cn)){
-      $tmp['remove']['from']  = $this->orig_cn;
-      $tmp['remove']['to']    = $tmp['cn'];
-    }
-  
-    $tmp['dn']      = $this->dn;  
-    $tmp['status']  = $this->status;  
-    return($tmp);
-  }
-
-  /* Return plugin informations for acl handling */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName" => _("Variable entry"),
-          "plDescription" => _("FAI variable entry "),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 23,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("fai"),
-          "plProvidedAcls" => array(
-            "cn"                => _("Name"),
-            "description"       => _("Description"),
-            "FAIvariableContent"=> _("Variable content") )
-          ));
-  }
-
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/fai/faiHook.tpl b/plugins/admin/fai/faiHook.tpl
deleted file mode 100644 (file)
index 6768ad9..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-<table width="100%" summary=''>
-       <tr>
-               <td width="50%" valign="top">
-                               <h2><img class="center" alt="" src="images/fai_small.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2>
-                               <table summary="" cellspacing="4">
-                                       <tr>
-                                               <td>
-                                                       <LABEL for="cn">
-                                                       {t}Name{/t}
-                                                       </LABEL>
-                                               </td>
-                                               <td>
-{render acl=$cnACL}
-                                                       <input value="{$cn}" size="45" maxlength="80" disabled id="cn">
-{/render}
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td>
-                                                       <LABEL for="description">
-                                                       {t}Description{/t}
-                                                       </LABEL>
-                                               </td>
-                                               <td>
-{render acl=$descriptionACL}
-                                                       <input value="{$description}" size="45" maxlength="80" name="description" id="description">
-{/render}
-                                               </td>
-                                       </tr>
-                               </table>
-               </td>
-       </tr>
-</table>
-<p class="seperator">&nbsp;</p>
-<table width="100%" summary=''>
-       <tr>
-               <td>
-                               <h2><img class="center" alt="" src="images/fai_hook.png" align="middle" title="{t}Objects{/t}">&nbsp;
-                                       {t}List of hook scripts{/t}
-                               </h2>
-                               <table width="100%" summary=''>
-                               <tr>
-                                       <td>
-                                               {$Entry_divlist}
-{if $sub_object_is_addable}
-                                               <input type="submit" name="AddSubObject"     value="{t}Add{/t}" title="{t}Add{/t}">
-{else}
-                                               <input type="submit" name="AddSubObject"     value="{t}Add{/t}" title="{t}Add{/t}" disabled>
-{/if}
-                                       </td>
-                               </tr>
-                               </table>
-               </td>
-       </tr>
-</table>
-<input type="hidden" value="1" name="FAIhook_posted">
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('cn','description');
-  -->
-</script>
-
diff --git a/plugins/admin/fai/faiHookEntry.tpl b/plugins/admin/fai/faiHookEntry.tpl
deleted file mode 100644 (file)
index 882da26..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-<input type="hidden" name="SubObjectFormSubmitted" value="1">
-<table width="100%" summary="">
-       <tr>
-               <td valign="top" width="50%">
-                       <h2><img class="center" alt="" src="images/forward.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2>
-                               <table summary="">
-                                       <tr>
-                                               <td>
-                                                       {t}Name{/t}{$must}&nbsp;
-                                               </td>
-                                               <td>
-{render acl=$cnACL}
-                                                       <input value="{$cn}" size="45" name="cn">
-{/render}
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td>
-                                                       {t}Description{/t}&nbsp;
-                                               </td>
-                                               <td>
-{render acl=$descriptionACL}
-                                                       <input value="{$description}" size="45" name="description">
-{/render}
-                                               </td>
-                                       </tr>
-                               </table>
-               </td>
-               <td style="border-left: 1px solid rgb(160, 160, 160);">
-           &nbsp;
-        </td>
-               <td style="vertical-align:top">
-                               <h2><img class="center" alt="" src="images/fai_hook.png" align="middle" title="{t}Hook attributes{/t}">&nbsp;{t}Hook attributes{/t}</h2>
-                               <table width="100%" summary="">
-                                       <tr>
-                                               <td>
-                                                       <LABEL for="FAItask">
-                                                       {t}Task{/t}&nbsp;
-                                                       </LABEL>
-{render acl=$FAItaskACL}
-                                                       <select id="FAItask" name="FAItask" title="{t}Choose an existing FAI task{/t}">
-                                                               {html_options values=$tasks output=$tasks selected=$FAItask}
-                                                       </select>
-{/render}
-                                               </td>
-                                       </tr>
-                               </table>
-               </td>
-       </tr>
-</table>
-
-
-<p class="seperator">&nbsp;</p>
-<h2><img class="center" alt="" src="images/fai_hook.png" align="middle" title="{t}Hook attributes{/t}">&nbsp;
-    <LABEL for="FAIscript">
-        {t}Script{/t}
-    </LABEL>
-    </h2>
-<table width="99%" summary="">
-    <tr>
-        <td>
-{render acl=$FAIscriptACL}
-            <textarea name="FAIscript" style="width:100%;height:300px;" id="FAIscript" 
-                               rows=20 cols=120>{$FAIscript}</textarea>
-{/render}
-        </td>
-    </tr>
-</table>
-<br>
-<div>
-{render acl=$FAIscriptACL}
-    <input type="file" name="ImportFile">&nbsp;
-{/render}
-{render acl=$FAIscriptACL}
-    <input type="submit" name="ImportUpload" value="{t}Import script{/t}" >
-{/render}
-{render acl=$FAIscriptACL}
-       {$DownMe}
-{/render}
-</div>
-
-<p class="seperator">&nbsp;</p>
-<br>
-<div style="align:right;" align="right">
-       <input type="submit" value="{t}Apply{/t}"       name="SaveSubObject">&nbsp;
-       <input type="submit" value="{t}Cancel{/t}"      name="CancelSubObject">
-</div>
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('cn','description');
-  -->
-</script>
-
diff --git a/plugins/admin/fai/faiNewBranch.tpl b/plugins/admin/fai/faiNewBranch.tpl
deleted file mode 100755 (executable)
index 831e028..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-{if $iframe == false}
-
-<br>
-<p class="seperator">
-{t}You are now going to create a branch or locked branch. This action clones the existing release to another release name. Branches can be modified as usual. FAI classes of locked branches cannot be modified, just additional classes are possible. Branch names should be alphanumeric, excluding the reserved names 'scripts', 'hooks', 'partitions', 'variables', 'templates' and 'fai'.{/t}
-<br>
-{t}Branches are created as subreleases of the currently selected branch. Creating a new branch named 1.0.2 in SARGE for example, will result in a new release called SARGE/1.0.2.{/t}
- <br>
-<br>
-</p>
-<p class="seperator">
-<br>
-<b>{t}Please enter a name for the branch{/t}</b> &nbsp;
-<input type="text" id="BranchName" name="BranchName" value="{$BranchName}" style="width:120px;">
-<br>
-<br>
-</p>
-
-<div align="right">
-       <p>
-               <input type="submit" value="{t}Apply{/t}"       name="UseBranchName">           
-               <input type="submit" value="{t}Cancel{/t}"      name="CancelBranchName">                
-       </p>
-</div>
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-       <!--
-       focus_field('BranchName');
-       -->
-</script>
-{else}
-
-<h2>{t}Processing the requested operation{/t}</h2>
-{t}As soon as the copy operation has finished, you can scroll down to end of the page and press the 'Continue' button to continue with the fai management dialog.{/t}
-<br>
-<br>
-<div style="margin:3px;background-color:white; border:1px solid #A0A0A0">
-<iframe src="?plug={$plugID}&amp;PerformBranch=1" width="100%" name="status" style="height:450px;background-color:#FFFFFF;">
-
-       <p>{t}Your browser doesn't support iframes, please use this link to perform the requested operation.{/t}
-               <br>
-               <a href='?plug={$plugID}&amp;PerformBranch=1' target="_blank" title="{t}Perform requested operation.{/t}"><b>{t}Initiate operation{/t}</b></a>
-       </p>    
-</iframe>
-</div>
-<!--
-<p class="seperator">&nbsp;</p>
-<div style="text-align: right;width:99%;">
-       <p>
-               <input type="submit" name="CancelBranchName" value="{t}Back{/t}">
-       </p>
-</div>
--->
-{/if}
diff --git a/plugins/admin/fai/faiPackage.tpl b/plugins/admin/fai/faiPackage.tpl
deleted file mode 100644 (file)
index 87c83d9..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-<table width="100%" summary="">
-       <tr>
-               <td width="50%" valign="top" style="border-right:1px solid #A0A0A0">
-                               <h2><img class="center" alt="" src="images/forward.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2>
-                               <table summary="" cellspacing="4">
-                                       <tr>
-                                               <td>
-                                                       <LABEL for="cn">
-                                                       {t}Name{/t}
-                                                       </LABEL>
-                                               </td>
-                                               <td>
-{render acl=$cnACL}
-                                                       <input value="{$cn}" size="45" disabled id="cn">
-{/render}
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td>
-                                                       <LABEL for="description">
-                                                       {t}Description{/t}
-                                                       </LABEL>
-                                               </td>
-                                               <td>
-{render acl=$descriptionACL}
-                                                       <input value="{$description}" size="45" name="description" id="description">
-{/render}
-                                               </td>
-                                       </tr>
-                               </table>
-               </td>
-               <td width="50%" valign="top">
-                       <h2><img class="center" alt="" src="images/network.png" align="middle" title="{t}Repository{/t}">&nbsp;{t}Repository{/t}</h2>
-                               <table summary="" cellspacing="4">
-                                       <tr>
-                                               <td>
-                                                       {t}Release{/t} : 
-                                               </td>
-                                               <td>
-                                                       {$release}
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td>
-                                                       {t}Section{/t} : 
-                                               </td>
-                                               <td>
-                                                       {$section}
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                           <td>
-                                                 {t}Install method{/t} :
-                                               </td>
-                                               <td>
-{render acl=$FAIinstallMethodACL}
-                                                       <select name="FAIinstallMethod" title='{t}Please select the installation method{/t}'>
-                                                         {html_options options=$FAIinstallMethods output=$FAIinstallMethod selected=$FAIinstallMethod}
-                                                       </select>
-{/render}
-                                               </td>
-                                       </tr>
-                               </table>
-               </td>
-       </tr>
-</table>
-<p class="seperator">&nbsp;</p>
-<table width="99%" summary="">
-       <tr>
-               <td> 
-                       <h2><img class="center" alt="" src="images/fai_packages.png" align="middle" title="{t}Used packages{/t}">&nbsp;{t}Used packages{/t}</h2>
-                       <br>
-                       <select id="usedPackages" name="usedPackages[]" title="{t}Choosen packages{/t}" multiple style="width:100%;height:300px;">
-                               {html_options options=$usedPackages}
-                               <option value="">&nbsp;</option>
-               </select>
-                       <br>
-{render acl=$FAIpackageACL}
-                       <input type="submit" name="Addpkg" value="{t}Add{/t}">
-{/render}
-{render acl=$FAIpackageACL}
-                       <input type="submit" name="Delpkg" value="{t}Remove{/t}">
-{/render}
-{render acl=$FAIdebconfInfoACL}
-                       <input type="submit" name="Conpkg" value="{t}Configure{/t}">
-{/render}
-{render acl=$FAIpackageACL}
-                       <input type="submit" name="Markpkg" value="{t}Toggle remove flag{/t}">
-{/render}
-               </td>
-       </tr>
-</table>
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('cn','description');
-  -->
-</script>
-
diff --git a/plugins/admin/fai/faiPackageConfiguration.tpl b/plugins/admin/fai/faiPackageConfiguration.tpl
deleted file mode 100644 (file)
index db04759..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<h1><img class="center" alt="" src="images/forward.png" align="middle" title="{t}Package{/t}">&nbsp;{$headline}</h1>
-{$Config}
-<p class="seperator">&nbsp;</p>
-<br>
-<div align="right" style="align:right;">
-    <input name="SaveObjectConfig" value="{t}Apply{/t}" type="submit">
-    <input name="CancelObjectConfig" value="{t}Cancel{/t}" type="submit">
-</div>
-
diff --git a/plugins/admin/fai/faiPackageEntry.tpl b/plugins/admin/fai/faiPackageEntry.tpl
deleted file mode 100644 (file)
index 79f47c6..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
-<tr>
-       <td style="vertical-align:top;width:600px">
-               <div class="contentboxh">
-               <p class="contentboxh">
-                       {t}List of available packages{/t}
-               </p>
-               </div>
-               <div class="contentboxb">
-               {$faihead}
-               </div>
-               <div style='height:4px;'>
-               </div>
-               <div class="contentboxb" style="border-top:1px solid #B0B0B0;">
-               {$failist}
-               <input type="hidden" name="edit_helper">
-               </div>
-       </td>
-       <td style="vertical-align:top;">
-               <div class="contentboxh" style="border-bottom:1px solid #B0B0B0;">
-               <p class="contentboxh">
-                               <img src="{$infoimage}" align="right" alt="[i]">{t}Information{/t}
-                       </p>
-               </div>
-               <div class="contentboxb" style="padding:4px;">
-                       {t}This menu allows you to select multiple packages to add them to the currently edited package list.{/t}
-               </div>
-               <br>
-               <div class="contentboxh">
-               <p class="contentboxh">
-                               <img src="{$launchimage}" align="right" alt="[F]">
-                               {t}Filters{/t}
-                       </p>
-               </div>
-               <div class="contentboxb"> 
-                       {$CHKS}
-               </div>
-               <div class="contentboxb">
-               <table summary=""  style="width:100%;">
-                       <tr>
-                               <td>
-                                               <img alt="{t}Display objects matching{/t}" src="{$search_image}" align=middle title='{t}Display objects matching{/t}'>
-                               </td>
-                               <td width="99%">
-                                       <input type='text' name='searchStrPKG' maxlength='40' style='width:99%' value='{$searchStrPKG}' id='filter' 
-                                            title='{t}Regular expression for matching object names{/t}' onClick="mainform.filter.value='';" onChange="mainform.submit()">
-                               </td>
-                       </tr>
-               </table>
-                {$apply}
-               </div>
-       </td>
-</tr>
-</table>
-<div align="right" style="align:right;">
-       <input id="SaveSubObject" name="SaveSubObject" value="{t}Apply{/t}" type="submit">
-       <input id="CancelSubObject" name="CancelSubObject" value="{t}Cancel{/t}" type="submit">
-</div>
-<input type="hidden" name="ignore">
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('filter');
-  -->
-</script>
-
diff --git a/plugins/admin/fai/faiPartitionTable.tpl b/plugins/admin/fai/faiPartitionTable.tpl
deleted file mode 100644 (file)
index f330fe6..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-<table width="100%" summary="">
-       <tr>
-               <td width="50%" valign="top">
-                               <h2><img class="center" alt="" src="images/fai_small.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2>
-                               <table summary="" cellspacing="4">
-                                       <tr>
-                                               <td>
-                                                       <LABEL for="cn">
-                                                       {t}Name{/t}{$must}
-                                                       </LABEL>
-                                               </td>
-                                               <td>
-{render acl=$cnACL}
-                                                       <input value="{$cn}" size="45" maxlength="80" id='cn' disabled >
-{/render}
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td>
-                                                       <LABEL for="description">
-                                                       {t}Description{/t}
-                                                       </LABEL>
-                                               </td>
-                                               <td>
-{render acl=$descriptionACL}
-                                                       <input value="{$description}" size="45" maxlength="80" name="description" id="description">
-{/render}
-                                               </td>
-                                       </tr>
-                               </table>
-               </td>
-               <td style="border-left: 1px solid rgb(160, 160, 160);">
-                  &nbsp;
-               </td>
-               <td>
-                               <h2><img class="center" alt="" src="images/fai_partitionTable.png" align="middle" title="{t}Objects{/t}">&nbsp;
-                                       <LABEL for="SubObject">
-                                               {t}Discs{/t}
-                                       </LABEL>
-                               </h2>
-                               <table width="100%" summary="">
-                               <tr>
-                                       <td>
-                                               <select name="disks[]" title="{t}Choose a disk to delete or edit{/t}" style="width:100%" size="20" id="SubObject" multiple>
-                                                       {html_options options=$disks}
-                                                       <option>&nbsp;</option>
-                                               </select><br>
-{if $sub_object_is_addable}
-                                               <input type="submit" name="AddDisk"     value="{t}Add{/t}"     title="{t}Add{/t}">
-{else}
-                                               <input type="submit" name="AddDisk"     value="{t}Add{/t}"     title="{t}Add{/t}" disabled >
-{/if}
-
-                                               <input type="submit" name="EditDisk"    value="{t}Edit{/t}"    title="{t}Edit{/t}">
-                                               <input type="submit" name="DelDisk"     value="{t}Delete{/t}"  title="{t}Delete{/t}">
-                                       </td>
-                               </tr>
-                               </table>
-               </td>
-       </tr>
-</table>
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('cn','description');
-  -->
-</script>
-
diff --git a/plugins/admin/fai/faiPartitionTableEntry.tpl b/plugins/admin/fai/faiPartitionTableEntry.tpl
deleted file mode 100644 (file)
index 4379b66..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-<input type="hidden" name="TableEntryFrameSubmitted" value="1">
-<h2><img class="center" alt="" src="images/fai_partitionTable.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Device{/t}</h2>
-<table style='width:100%' summary="">
-       <tr>
-               <td style='width:50%;border-right:1px solid #909090;'><LABEL for="DISKcn">
-                       {t}Name{/t}
-                       </LABEL>{$must}&nbsp;
-{render acl=$DISKcnACL}
-                       <input value="{$DISKcn}" size="45" maxlength="80" name="DISKcn" id="DISKcn">
-{/render}
-               </td>
-               <td><LABEL for="DISKdescription">
-                       &nbsp;{t}Description{/t}
-                       </LABEL>&nbsp;
-{render acl=$DISKdescriptionACL}
-                       <input value="{$DISKdescription}" size="45" maxlength="80" name="DISKdescription" id="DISKdescription">
-{/render}
-               </td>
-       </tr>
-</table>
-<br>
-<p class="seperator">&nbsp;</p>
-<br>
-<h2><img class="center" alt="" src="images/editpaste.png" align="middle" title="{t}Partition entries{/t}">&nbsp;{t}Partition entries{/t}</h2>
-{$setup}
-<br>
-{if $sub_object_is_createable}
-       <input type="submit" name="AddPartition" value="{t}Add partition{/t}">
-{else}
-       <input type="submit" name="restricted" value="{t}Add partition{/t}" disabled>
-{/if}
-<br>   
-<br>
-<p class="seperator">&nbsp;</p>
-<br>
-<div style="align:right;" align="right">
-{render acl=$allowSave}
-<input type="submit" name="SaveDisk" value="{t}Save{/t}">
-{/render}
-<input type="submit" name="CancelDisk" value="{t}Cancel{/t}" >
-</div>
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('DISK_cn');
-  -->
-</script>
-
diff --git a/plugins/admin/fai/faiProfile.tpl b/plugins/admin/fai/faiProfile.tpl
deleted file mode 100644 (file)
index 090d968..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-<table width="100%" summary="">
-       <tr>
-               <td width="50%" valign="top">
-                       <h2><img class="center" alt="" src="images/forward.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2>
-                       <table summary="" cellspacing="4">
-                               <tr>
-                                       <td>
-                                               <LABEL for="cn">
-                                               {t}Name{/t}{$must}
-                                               </LABEL>
-                                       </td>
-                                       <td>
-{render acl=$cnACL}
-                                               <input value="{$cn}" size="45" maxlength="80" id="cn" name="cn">
-{/render}
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>
-                                               <LABEL for="description">
-                                               {t}Description{/t}
-                                               </LABEL>
-                                       </td>
-                                       <td>
-{render acl=$descriptionACL}
-                                               <input value="{$description}" size="45" maxlength="80" name="description" id="description">
-{/render}
-                                       </td>
-                               </tr>
-                       </table>
-               </td>
-               <td valign="top" style="border-left: 1px solid rgb(160, 160, 160);">
-                       <table summary="" style="vertical-align:top; text-align:left;" cellpadding=4 width="100%">
-                               <tr>
-                                       <td style="vertical-align:top;">
-                                               <h2><img class="center" alt="" src="images/fai_template.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}FAI classes{/t}</h2> 
-<!--                                           <select name="FAIclass" title="{t}Choose a priority{/t}" size="20" style="width:100%;" multiple>
-                                                       {html_options values=$FAIclasses output=$FAIclasses}
-                                               </select>-->
-                                               {$divlist}
-                                               <br>
-{render acl=$FAIclassACL}
-                                               <input type="submit" name="AddClass" value="{t}Add{/t}">
-{/render}
-                                               <input type="hidden" name="edit_helper">
-                                       </td>
-                               </tr>
-                       </table>
-               </td>
-       </tr>
-</table>
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('cn','description');
-  -->
-</script>
-
diff --git a/plugins/admin/fai/faiProfileEntry.tpl b/plugins/admin/fai/faiProfileEntry.tpl
deleted file mode 100644 (file)
index 72e865b..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
-<tr>
-  <td style="vertical-align:top;width:600px">
-       <div class="contentboxh" style="height:20px">
-       <p class="contentboxh" style="font-size:12px">
-               {t}List of FAI objects (Fully Automatic Installation){/t}
-       </p>
-       </div>
-       <div class="contentboxb">
-       {$faihead}
-       </div>
-       <div style='height:4px;'></div>
-       <div class="contentboxb" style="border-top:1px solid #B0B0B0;">
-       {$failist}
-               <input type=hidden name="edit_helper">
-       </div>
-  </td>
-  <td style="vertical-align:top;">
-       <div class="contentboxh" style="height:20px;border-bottom:1px solid #B0B0B0">
-       <p class="contentboxh" style="font-size:12px">
-                       <img src="{$infoimage}" align="right" alt="[i]">{t}Information{/t}
-               </p>
-       </div>
-       <div class="contentboxb">
-               <p class="contentboxb" style="border-color:#f0f0f0;">
-               {t}This menu allows you to select FAI class names and to add them to the currently edited profile.{/t}
-               </p>
-       </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><input onClick='document.mainform.submit()' 
-                                                               type="checkbox" name="SShowTemplates"   {$SShowTemplatesCHK}>{t}Show only classes with templates{/t}</td></tr>
-                       <tr><td><input onClick='document.mainform.submit()'
-                                                                       type="checkbox" name="SShowScripts"             {$SShowScriptsCHK}>{t}Show only classes with scripts{/t}</td></tr>
-                       <tr><td><input onClick='document.mainform.submit()'
-                                                                       type="checkbox" name="SShowHooks"               {$SShowHooksCHK}>{t}Show only classes with hooks{/t}</td></tr>
-                       <tr><td><input onClick='document.mainform.submit()'
-                                                                       type="checkbox" name="SShowVariables"   {$SShowVariablesCHK}>{t}Show only classes with variables{/t}</td></tr>
-                       <tr><td><input onClick='document.mainform.submit()'
-                                                                       type="checkbox" name="SShowPackages"    {$SShowPackagesCHK}>{t}Show only classes with packages{/t}</td></tr>
-                       <tr><td><input onClick='document.mainform.submit()'
-                                                               type="checkbox" name="SShowPartitions"  {$SShowPartitionsCHK}>{t}Show only classes with partitions{/t}</td></tr>
-                </table>
-        <table summary=""  style="width:100%;border-top:1px solid #B0B0B0;">
-               <tr>
-                       <td>
-                                       <img alt="{t}Display objects matching{/t}" src="{$search_image}" 
-                                                       align=middle title='{t}Display objects matching{/t}'>
-                       </td>
-                       <td width="99%">
-                                       <input type='text' name='Sregex' maxlength='20' style='width:99%' value='{$Sregex}' id='filter' 
-                                               title='{t}Regular expression for matching object names{/t}' onClick="mainform.submit()">
-                       </td>
-               </tr>
-       </table>
-               {$apply}
-               </div>
-       </td>
-</tr>
-</table>
-
-<div align="right" style="align:right;">
-       <input name="SaveSubObject" value="{t}Apply{/t}" type="submit">
-       <input name="CancelSubObject" value="{t}Cancel{/t}" type="submit">
-</div>
-<!-- Place cursor -->
diff --git a/plugins/admin/fai/faiScript.tpl b/plugins/admin/fai/faiScript.tpl
deleted file mode 100644 (file)
index c0ff247..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-<table width="100%" summary="">
-       <tr>
-               <td width="50%" valign="top">
-                               <h2><img class="center" alt="" src="images/fai_small.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2>
-                               <table summary="" cellspacing="4">
-                                       <tr>
-                                               <td>
-                                                       <LABEL for="cn">
-                                                       {t}Name{/t}{$must}
-                                                       </LABEL>
-                                               </td>
-                                               <td>
-{render acl=$cnACL}
-                                                       <input value="{$cn}"  maxlength="80" size="45" disabled id="cn">
-{/render}
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td>
-                                                       <LABEL for="description">
-                                                       {t}Description{/t}
-                                                       </LABEL>
-                                               </td>
-                                               <td>
-{render acl=$descriptionACL}
-                                                       <input size="45" maxlength="80" value="{$description}" name="description" id="description" >
-{/render}
-                                               </td>
-                                       </tr>
-                               </table>
-               </td>
-       </tr>
-</table>
-<p class="seperator">&nbsp;</p>
-<table width="100%" summary="">
-       <tr>
-               <td>
-                               <h2><img class="center" alt="" src="images/fai_script.png" align="middle" title="{t}Objects{/t}">&nbsp;
-                                               {t}List of scripts{/t}
-                               </h2>
-                               <table width="100%" summary="" style="border:1px solid #B0B0B0; " cellspacing=0 cellpadding=0>
-                               <tr>
-                                       <td>
-                                               {$Entry_divlist}
-{if $sub_object_is_addable}
-                                               <input type="submit" name="AddSubObject"     value="{t}Add{/t}" title="{t}Add{/t}" >
-{else}
-                                               <input type="submit" name="AddSubObject"     value="{t}Add{/t}" title="{t}Add{/t}" disabled>
-{/if}
-                                       </td>
-                               </tr>
-                               </table>
-               </td>
-       </tr>
-</table>
-<input type="hidden" value="1" name="FAIscript_posted" >
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-<!--
-       focus_field("cn","description");
--->
-</script>
-
diff --git a/plugins/admin/fai/faiScriptEntry.tpl b/plugins/admin/fai/faiScriptEntry.tpl
deleted file mode 100644 (file)
index cddb2bb..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-<input type="hidden" name="SubObjectFormSubmitted" value="1">
-<table width="100%" summary="">
-       <tr>
-               <td valign="top" width="50%">
-                       <h2><img class="center" alt="" src="images/forward.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2>
-                               <table summary="">
-                                       <tr>
-                                               <td>
-                                                       {t}Name{/t}{$must}&nbsp;
-                                               </td>
-                                               <td>
-{render acl=$cnACL}
-                                                       <input value="{$cn}" size="45" maxlength="80" name="cn">
-{/render}
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td>
-                                                       {t}Description{/t}&nbsp;
-                                               </td>
-                                               <td>
-{render acl=$descriptionACL}
-                                                       <input size="45" maxlength="80" value="{$description}" name="description">
-{/render}
-                                               </td>
-                                       </tr>
-                               </table>
-               </td>
-               <td style="border-left: 1px solid rgb(160, 160, 160);">
-           &nbsp;
-        </td>
-               <td valign="top">
-                               <h2><img class="center" alt="" src="images/fai_script.png" align="middle" title="{t}Properties{/t}">&nbsp;{t}Script attributes{/t}</h2>
-                               <table summary="" width="100%">
-                                       <tr>
-                                               <td>
-                                                       <LABEL for="FAIpriority">
-                                                       {t}Priority{/t}
-                                                       </LABEL>
-                                               </td>
-                                               <td>
-{render acl=$FAIpriorityACL}
-                                                   <select id="FAIpriority" name="FAIpriority" title="{t}Choose a priority. Low values result in earlyer, high values in later excecution.{/t}">
-                                               {html_options options=$FAIprioritys selected=$FAIpriority}
-                                       </select>
-{/render}
-                                               </td>
-                                       </tr>
-                               </table>
-               </td>
-       </tr>
-</table>
-<p class="seperator">&nbsp;</p>
-<h2><img class="center" alt="" src="images/fai_script.png" align="middle" title="{t}Script attributes{/t}">&nbsp;
-       <LABEL for="FAIscript">
-               {t}Script{/t}
-       </LABEL>
-       </h2>
-<table summary="" width="99%">
-    <tr>
-        <td>
-{render acl=$FAIscriptACL}
-            <textarea name="FAIscript" style="width:100%;height:300px;" id="FAIscript"  
-                               rows="20" cols="120">{$FAIscript}</textarea>
-{/render}
-        </td>
-    </tr>
-</table>
-<br>
-<div>
-{render acl=$FAIscriptACL}
-       <input type="file" name="ImportFile">&nbsp;
-{/render}
-{render acl=$FAIscriptACL}
-       <input type="submit" name="ImportUpload" value="{t}Import script{/t}">
-{/render}
-{render acl=$FAIscriptACL}
-       {$DownMe}
-{/render}
-</div>
-<br>
-<div style="align:right;" align="right">
-       <input type="submit" value="{t}Apply{/t}"       name="SaveSubObject">&nbsp;
-       <input type="submit" value="{t}Cancel{/t}"      name="CancelSubObject">
-</div>
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('cn','description');
-  -->
-</script>
-
diff --git a/plugins/admin/fai/faiSummary.tpl b/plugins/admin/fai/faiSummary.tpl
deleted file mode 100644 (file)
index 196f7ca..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left; border:1px solid #B0B0B0;"  cellpadding=0 cellspacing=0 border=0>
-
- <tr style="background-color: #E8E8E8; height:26px;font-weight:bold;">
-  <td style="padding:5px;">{t}FAI object tree{/t}</td>
- </tr>
-
-{if $readable}
- <tr>
-       <td style="padding-left:5px;padding-top:5px;padding-bottom:12px;border-bottom:1px solid #B0B0B0">
-               <input type="image" src="images/list_reload.png" name="reloadList" class="center">      
-               {t}Reload class and release configuration from parent object.{/t}
-       </td>
- </tr>
- <tr style="background-color: #E8E8E8; ">
-       <td>
- {$objectList}
-       </td>
- </tr>
-{else}
-<tr>
-       <td style='padding:6px;'>
-               {t}You are not allowed to view the fai summary.{/t}
-       </td>
-</tr>
-{/if}
-</table>
-
diff --git a/plugins/admin/fai/faiTemplate.tpl b/plugins/admin/fai/faiTemplate.tpl
deleted file mode 100644 (file)
index 627c5dd..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-<table summary="" width="100%">
-       <tr>
-               <td valign="top" style="border-right:1px solid #A0A0A0; width:50%">
-                               <h2><img class="center" alt="" src="images/fai_small.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2>
-                               <table summary="" cellspacing="4">
-                                       <tr>
-                                               <td>
-                                                       <LABEL for="cn">
-                                                       {t}Name{/t}{$must}
-                                                       </LABEL>
-                                               </td>
-                                               <td>
-{render acl=$cnACL}
-                                                       <input value="{$cn}" size="45" maxlength="80" disabled id="cn">
-{/render}
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td>
-                                                       <LABEL for="description">
-                                                       {t}Description{/t}
-                                                       </LABEL>
-                                               </td>
-                                               <td>
-{render acl=$descriptionACL}
-                                                       <input value="{$description}" size="45" maxlength="80" name="description" id="description">
-{/render}
-                                               </td>
-                                       </tr>
-                               </table>
-               </td>
-               <td style="width:50%">
-                               <h2><img class="center" alt="" src="images/fai_template.png" align="middle" title="{t}Objects{/t}">&nbsp;
-                                       {t}List of template files{/t}
-                               </h2>
-                       {$Entry_divlist}
-{if $sub_object_is_addable}
-                               <input type="submit" name="AddSubObject"     value="{t}Add{/t}"         title="{t}Add{/t}">
-{else}
-                               <input type="submit" name="AddSubObject"     value="{t}Add{/t}"         title="{t}Add{/t}" disabled>
-{/if}
-               </td>
-       </tr>
-</table>
-<input type="hidden" value="1" name="FAItemplate_posted">
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('cn','description');
-  -->
-</script>
-
diff --git a/plugins/admin/fai/faiTemplateEntry.tpl b/plugins/admin/fai/faiTemplateEntry.tpl
deleted file mode 100644 (file)
index b8ee41a..0000000
+++ /dev/null
@@ -1,203 +0,0 @@
-<input type="hidden" name="SubObjectFormSubmitted" value="1">
-
-<h2><img class="middle" alt="" src="images/forward.png" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2>
-<table width="100%" summary="">
-<tr>
-       <td width="50%">
-               <table>
-                 <tr>
-                   <td>
-               {t}File name{/t}{$must}&nbsp;
-                   </td>
-                   <td>
-{render acl=$cnACL}
-               <input value="{$cn}" name="cn" size="45" maxlength="80">&nbsp;&nbsp;
-{/render}
-                   </td>
-                  </tr>
-                 <tr>
-                       <td>
-                               <LABEL for="templatePath">
-                                       {t}Destination path{/t}{$must}&nbsp;
-                               </LABEL>
-                               </td>
-                       <td>
-{render acl=$FAItemplatePathACL}
-                               <input type="text" name="FAItemplatePath" value="{$templatePath}" id="templatePath" size="45">
-{/render}
-                               </td>
-                 </tr>
-               </table>
-       </td>
-       <td>
-               {t}Description{/t}&nbsp;
-{render acl=$descriptionACL}
-               <input size="45" maxlength="80" value="{$description}" name="description">
-{/render}
-       </td>
-</tr>
-</table>
-
-<p class="seperator">&nbsp;</p>
-
-<table width="100%" summary="">
-<tr>
-  <td colspan=2><h2><img class="middle" alt="" src="images/fai_template.png" title="{t}Template attributes{/t}">&nbsp;{t}Template attributes{/t}</h2></td>
-</tr>
-<tr>
-  <td style="vertical-align:top;width:50%;border-right:1px solid #B0B0B0">
-   <table summary="">
-    <tr>
-               <td style="vertical-align:top">
-                       <LABEL for="FAItemplateFile">
-                               {t}File{/t}{$must}&nbsp;
-                       </LABEL>
-                       </td>
-               <td style="vertical-align:top" class="center">
-                       {$status}
-                       {if $bStatus}
-                         <a href="getbin.php?rand={$rand}">
-                               <img class="center" alt="{t}Save template{/t}..." title="{t}Save template{/t}..." src="images/save.png" border="0" />
-                         </a>
-                       {/if}
-                       <br>
-                       <br>
-{render acl=$FAItemplateFileACL}
-                       <input type="file" name="FAItemplateFile" value="{$FAItemplateFile}" id="FAItemplateFile">
-{/render}
-{render acl=$FAItemplateFileACL}
-                       &nbsp;<input type="submit" value="{t}Upload{/t}" name="TmpFileUpload">
-{/render}
-                       <br>
-                       <br>
-                       </td>
-       </tr><tr>
-                       <td>
-                               {t}Full path{/t}&nbsp;
-                               </td>
-                       <td>
-{render acl=$FAItemplatePathACL}
-                               <i>{$FAItemplatePath}</i>
-{/render}
-                               </td>
-               </tr>
-               </table>
-       </td>
-       <td>
-         <table summary="">
-               <tr>
-       
-               <td>
-                       <LABEL for="user">
-                               {t}Owner{/t}{$must}&nbsp;
-                       </LABEL>
-                       </td>
-               <td>
-{render acl=$FAIownerACL}
-                       <input type="text" name="user" value="{$user}" id="user" size="15">
-{/render}
-               </td>
-       </tr><tr>
-               <td style="vertical-align:top">
-                       <LABEL for="group">
-                               {t}Group{/t}{$must}&nbsp;
-                       </LABEL>
-                       </td>
-               <td>
-{render acl=$FAIownerACL}
-                       <input type="text" name="group" value="{$group}" id="group" size="15">
-{/render}
-                       <br>
-                       <br>
-               </td>
-       </tr><tr>
-               <td style="vertical-align:top">{t}Access{/t}{$must}&nbsp; </td>
-               <td>
-         <table summary="" style="border:1px solid #B0B0B0">
-              <colgroup width="55" span="3">
-               </colgroup>
-               <tr>
-                       <th>{t}Class{/t}</th>
-                       <th>{t}Read{/t}</th>
-                       <th>{t}Write{/t}</th>
-                       <th>{t}Execute{/t}</th>
-                       <th>&nbsp;</th>
-                       <th>{t}Special{/t}</th>
-                       <th>&nbsp;</th>
-               </tr>
-               <tr><td>{t}User{/t}</td>
-{render acl=$FAImodeACL}
-                       <td align="center"><input type="checkbox" name="u4" value="4" {$u4}></td>
-{/render}
-{render acl=$FAImodeACL}
-                       <td align="center"><input type="checkbox" name="u2" value="2" {$u2}></td>
-{/render}
-{render acl=$FAImodeACL}
-                       <td align="center"><input type="checkbox" name="u1" value="1" {$u1}></td>
-{/render}
-                       <td>&nbsp;</td>
-{render acl=$FAImodeACL}
-                       <td align="center"><input type="checkbox" name="s4" value="4" {$s4}></td>
-{/render}
-                       <td>({t}SUID{/t})</td>
-                       </tr>
-
-               <tr><td>{t}Group{/t}</td>
-{render acl=$FAImodeACL}
-                       <td align="center"><input type="checkbox" name="g4" value="4" {$g4}></td>
-{/render}
-{render acl=$FAImodeACL}
-                       <td align="center"><input type="checkbox" name="g2" value="2" {$g2}></td>
-{/render}
-{render acl=$FAImodeACL}
-                       <td align="center"><input type="checkbox" name="g1" value="1" {$g1}></td>
-{/render}
-                       <td>&nbsp;</td>
-{render acl=$FAImodeACL}
-                       <td align="center"><input type="checkbox" name="s2" value="2" {$s2}></td>
-{/render}
-                       <td>({t}SGID{/t})</td>
-                       </tr>
-
-               <tr><td>{t}Others{/t}</td>
-{render acl=$FAImodeACL}
-                       <td align="center"><input type="checkbox" name="o4" value="4" {$o4}></td>
-{/render}
-{render acl=$FAImodeACL}
-                       <td align="center"><input type="checkbox" name="o2" value="2" {$o2}></td>
-{/render}
-{render acl=$FAImodeACL}
-                       <td align="center"><input type="checkbox" name="o1" value="1" {$o1}></td>
-{/render}
-                       <td>&nbsp;</td>
-{render acl=$FAImodeACL}
-                       <td align="center"><input type="checkbox" name="s1" value="1" {$s1}></td>
-{/render}
-                       <td>({t}sticky{/t})</td>
-       </tr></table>
-       
-               </td></tr></table>
-       </td>
-</tr>
-<tr>
-<td colspan=2>
-<br>
-<p class="seperator">&nbsp;</p>
-<br>
-<div style="align:right;" align="right">
-       <input type="submit" value="{t}Apply{/t}"       name="SaveSubObject">&nbsp;
-       <input type="submit" value="{t}Cancel{/t}"      name="CancelSubObject">
-</div>
-</td>
-</tr>
-</table>
-
-<input type='hidden' name='FAItemplateEntryPosted' value='1'>
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('cn','description');
-  -->
-</script>
-
diff --git a/plugins/admin/fai/faiVariable.tpl b/plugins/admin/fai/faiVariable.tpl
deleted file mode 100644 (file)
index cdbdab9..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-<table summary="" width="100%">
-       <tr>
-               <td width="50%" valign="top">
-                               <h2><img class="center" alt="" src="images/fai_small.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2>
-                               <table summary="" cellspacing="4">
-                                       <tr>
-                                               <td>
-                                                       <LABEL for="cn">
-                                                       {t}Name{/t}{$must}
-                                                       </LABEL>
-                                               </td>
-                                               <td>
-{render acl=$cnACL}
-                                                       <input value="{$cn}" size="45" maxlength="80" disabled id="cn">
-{/render}
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td>
-                                                       <LABEL for="description">
-                                                       {t}Description{/t}
-                                                       </LABEL>
-                                               </td>
-                                               <td>
-{render acl=$descriptionACL}
-                                                       <input size="45" maxlength="80" value="{$description}" name="description" id="description">
-{/render}
-                                               </td>
-                                       </tr>
-                               </table>
-               </td>
-               <td style="border-left: 1px solid rgb(160, 160, 160);">
-                  &nbsp;
-               </td>
-               <td>
-                               <h2><img class="center" alt="" src="images/fai_variable.png" align="middle" title="{t}Objects{/t}">&nbsp;
-                                       <LABEL for="SubObject">
-                                               {t}List of assigned variables{/t}
-                                       </LABEL>
-                               </h2>
-                               <table summary="" width="100%">
-                               <tr>
-                                       <td>
-                                               <select name="SubObject[]" multiple  title="{t}Choose a variable to delete or edit{/t}" 
-                                                       style="width:100%;" size="20" id="SubObject">
-                                                       {html_options options=$SubObjects}
-                                               </select><br>
-{if $is_createable}
-                                       <input type="submit" name="AddSubObject"     value="{t}Add{/t}"         title="{t}Add{/t}">
-{else}
-                                       <input disabled type="submit" name="AddSubObject"     value="{t}Add{/t}"                title="{t}Add{/t}">
-{/if}
-                                       <input type="submit" name="EditSubObject"    value="{t}Edit{/t}"    title="{t}Edit{/t}" >
-{if $is_removeable}
-                                       <input type="submit" name="DelSubObject"     value="{t}Delete{/t}"  title="{t}Delete{/t}">
-{else}
-                                       <input disabled type="submit" name="DelSubObject"     value="{t}Delete{/t}"  title="{t}Delete{/t}">
-{/if}
-                                       </td>
-                               </tr>
-                               </table>
-               </td>
-       </tr>
-</table>
-<input type="hidden" value="1" name="FAIvariable_posted">
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('cn','description');
-  -->
-</script>
-
diff --git a/plugins/admin/fai/faiVariableEntry.tpl b/plugins/admin/fai/faiVariableEntry.tpl
deleted file mode 100644 (file)
index 0fd8a4a..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-<input type="hidden" name="SubObjectFormSubmitted" value="1">
-<table width="100%" summary="">
-       <tr>
-               <td valign="top" width="50%">
-                       <h2><img class="center" alt="" src="images/fai_small.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2>
-                               <table summary="">
-                                       <tr>
-                                               <td>
-                                                       {t}Name{/t}{$must}&nbsp;
-                                               </td>
-                                               <td>
-{render acl=$cnACL}
-                                                       <input value="{$cn}" size="45" maxlength="80" name="cn">
-{/render}
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td>
-                                                       {t}Description{/t}&nbsp;
-                                               </td>
-                                               <td>
-{render acl=$descriptionACL}
-                                                       <input value="{$description}" size="45" maxlength="80" name="description">
-{/render}
-                                               </td>
-                                       </tr>
-                               </table>
-               </td>
-               <td style="border-left: 1px solid rgb(160, 160, 160);">
-           &nbsp;
-        </td>
-               <td valign="top">
-                               <h2><img class="center" alt="" src="images/fai_variable.png" align="middle" title="{t}Variable attributes{/t}">&nbsp;{t}Variable attributes{/t}</h2>
-                               <table  summary="" width="100%">
-                                       <tr>
-                                               <td>
-                                                       <LABEL for="Content">
-                                                       {t}Variable content{/t}{$must}&nbsp;
-                                                       </LABEL>
-                                               </td>
-                                               <td>
-{render acl=$FAIvariableContentACL}
-                                                       <input type="text" name="FAIvariableContent" value="{$FAIvariableContent}" id="Content" style="width:250px;">
-{/render}
-                                               </td>
-                                       </tr>
-                               </table>
-               </td>
-       </tr>
-</table>
-<p class="seperator">&nbsp;</p>
-<br>
-<div style="align:right;" align="right">
-       <input type="submit" value="{t}Apply{/t}"       name="SaveSubObject" >&nbsp;
-       <input type="submit" value="{t}Cancel{/t}"      name="CancelSubObject">
-</div>
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('cn','description');
-  -->
-</script>
-
diff --git a/plugins/admin/fai/main.inc b/plugins/admin/fai/main.inc
deleted file mode 100644 (file)
index ab6749d..0000000
+++ /dev/null
@@ -1,55 +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
-*/
-
-if ($remove_lock){
-        if(isset($_SESSION['FAI'])){
-                $FAI= $_SESSION['FAI'];
-                $FAI->remove_lock();
-                del_lock ($ui->dn);
-                sess_del ('FAI');
-        }
-} else {
-       /* Create usermanagement object on demand */
-       if (!isset($_SESSION['FAI']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
-               $_SESSION['FAI']= new faiManagement($config, $ui);
-               $_SESSION['FAI']->set_acl_category("fai");
-               $_SESSION['FAI']->set_acl_base($_SESSION['CurrentMainBase']);
-       }
-       $FAI= $_SESSION['FAI'];
-       $FAI->save_object();
-       $output= $FAI->execute();
-
-       /* Reset requested? */
-       if (isset($_GET['reset']) && $_GET['reset'] == 1){
-               del_lock ($ui->dn);
-               sess_del ('FAI');
-       }
-       /* Page header*/
-       if (isset($_SESSION['objectinfo'])){
-               $display= print_header(get_template_path('images/fai.png'), _("Fully Automatic Installation"), "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".@LDAP::fix($_SESSION['objectinfo']));
-       } else {
-               $display= print_header(get_template_path('images/fai.png'), _("Fully Automatic Installation"));
-       }
-       $display.= $output;
-
-       $_SESSION['FAI']= $FAI;
-}
-
-?>
diff --git a/plugins/admin/fai/remove.tpl b/plugins/admin/fai/remove.tpl
deleted file mode 100644 (file)
index 10bf93d..0000000
+++ /dev/null
@@ -1,24 +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' object information. 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">
-{if $multiple}
-       <input type=submit name="delete_multiple_fai_object_confirm" value="{t}Delete{/t}">
-       &nbsp;
-       <input type=submit name="delete_multiple_fai_object_cancel" value="{t}Cancel{/t}">
-{else}
-       <input type=submit name="delete_terminal_confirm" value="{t}Delete{/t}">
-       &nbsp;
-       <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
-{/if}
-</p>
diff --git a/plugins/admin/fai/remove_branch.tpl b/plugins/admin/fai/remove_branch.tpl
deleted file mode 100755 (executable)
index 3ed7f23..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<div style="font-size:18px;">
- <img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
-</div>
-<p>
-  {$info}
-  {t}This includes all account data, system access, etc. for this branch. 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}So - if you're sure - press 'Delete' to continue or 'Cancel' to abort.{/t}
-</p>
-
-<p class="plugbottom">
-  <input type=submit name="delete_branch_confirm" value="{t}Delete{/t}">
-  &nbsp;
-  <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
-</p>
-
diff --git a/plugins/admin/fai/tabsHook.inc b/plugins/admin/fai/tabsHook.inc
deleted file mode 100644 (file)
index 1857854..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-
-class tabsHook extends tabs
-{
-  var $base= "";
-
-  function tabsHook($config, $data, $dn,$category)
-  {
-       tabs::tabs($config, $data, $dn,$category);
-       /* Add references/acls/snapshots */
-       $this->addSpecialTabs();
-  }
-
-  function check($ignore_account= FALSE)
-  {
-       return (tabs::check(TRUE));
-  }
-  
-
-  function save($ignore_account= FALSE)
-  {
-       $baseobject= $this->by_object['faiHook'];
-
-       $new_dn= 'cn='.$baseobject->cn.",ou=hooks,ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase'];
-       
-       if($_SESSION['faifilter']['branch']!="main"){
-               $new_dn ='cn='.$baseobject->cn.",ou=hooks,".$_SESSION['faifilter']['branch'];
-       }
-
-       if ($this->dn != $new_dn && $this->dn != "new"){
-               
-               /* if( new_dn is subtree of this->dn ) */
-               $cnt1 = count(split(",",$this->dn));
-               $cnt2 = count(split(",",$new_dn));
-               if((strstr($new_dn,$this->dn))&&($cnt1<$cnt2)){
-                       print_red(_("Try to move tree failed. Destination tree is subtree of source tree."));
-               }else{
-//                     $baseobject->recursive_move($this->dn, $new_dn);
-               }
-       }
-       $this->dn= $new_dn;
-
-       tabs::save(TRUE);
-  }
-
-}
-
-?>
diff --git a/plugins/admin/fai/tabsPackage.inc b/plugins/admin/fai/tabsPackage.inc
deleted file mode 100644 (file)
index 8731835..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-
-class tabsPackage extends tabs
-{
-  var $base= "";
-
-  function tabsPackage($config, $data, $dn,$category)
-  {
-       tabs::tabs($config, $data, $dn,$category);
-
-       /* Add references/acls/snapshots */
-       $this->addSpecialTabs();
-  }
-
-  function check($ignore_account= FALSE)
-  {
-       return (tabs::check(TRUE));
-  }
-  
-
-  function save($ignore_account= FALSE)
-  {
-       $baseobject= $this->by_object['faiPackage'];
-
-       $new_dn= 'cn='.$baseobject->cn.",ou=packages,ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase'];
-       if($_SESSION['faifilter']['branch']!="main"){
-               $new_dn ='cn='.$baseobject->cn.",ou=packages,".$_SESSION['faifilter']['branch'];
-       }
-                       
-       if ($this->dn != $new_dn && $this->dn != "new"){
-               
-               /* if( new_dn is subtree of this->dn ) */
-               $cnt1 = count(split(",",$this->dn));
-               $cnt2 = count(split(",",$new_dn));
-               if((strstr($new_dn,$this->dn))&&($cnt1<$cnt2)){
-                       print_red(_("Try to move tree failed. Destination tree is subtree of source tree."));
-               }else{
-//                     $baseobject->recursive_move($this->dn, $new_dn);
-               }
-       }
-       $this->dn= $new_dn;
-
-       tabs::save(TRUE);
-  }
-
-}
-
-?>
diff --git a/plugins/admin/fai/tabsPartition.inc b/plugins/admin/fai/tabsPartition.inc
deleted file mode 100644 (file)
index 9d2312d..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-
-class tabsPartition extends tabs
-{
-  var $base= "";
-
-  function tabsPartition($config, $data, $dn,$category)
-  {
-       tabs::tabs($config, $data, $dn,$category);
-
-       /* Add references/acls/snapshots */
-       $this->addSpecialTabs();
-  }
-
-  function check($ignore_account= FALSE)
-  {
-       return (tabs::check(TRUE));
-  }
-  
-
-  function save($ignore_account= FALSE)
-  {
-       $baseobject= $this->by_object['faiPartitionTable'];
-
-       $new_dn= 'cn='.$baseobject->cn.",ou=disk,ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase'];
-       
-       if($_SESSION['faifilter']['branch']!="main"){
-               $new_dn ='cn='.$baseobject->cn.",ou=disk,".$_SESSION['faifilter']['branch'];
-       }
-
-       if ($this->dn != $new_dn && $this->dn != "new"){
-               
-               /* if( new_dn is subtree of this->dn ) */
-               $cnt1 = count(split(",",$this->dn));
-               $cnt2 = count(split(",",$new_dn));
-               if((strstr($new_dn,$this->dn))&&($cnt1<$cnt2)){
-                       print_red(_("Try to move tree failed. Destination tree is subtree of source tree."));
-               }else{
-//                     $baseobject->recursive_move($this->dn, $new_dn);
-               }
-       }
-       $this->dn= $new_dn;
-
-       tabs::save(TRUE);
-  }
-
-}
-
-?>
diff --git a/plugins/admin/fai/tabsProfile.inc b/plugins/admin/fai/tabsProfile.inc
deleted file mode 100644 (file)
index cbc3abd..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-
-class tabsProfile extends tabs
-{
-  var $base= "";
-
-  function tabsProfile($config, $data, $dn,$category)
-  {
-       tabs::tabs($config, $data, $dn,$category);
-
-       /* Add references/acls/snapshots */
-       $this->addSpecialTabs();
-  }
-
-  function check($ignore_account= FALSE)
-  {
-       return (tabs::check(TRUE));
-  }
-  
-
-  function save($ignore_account= FALSE)
-  {
-       $baseobject= $this->by_object['faiProfile'];
-
-       $new_dn= 'cn='.$baseobject->cn.",ou=profiles,ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase'];
-
-       if($_SESSION['faifilter']['branch']!="main"){
-               $new_dn ='cn='.$baseobject->cn.",ou=profiles,".$_SESSION['faifilter']['branch'];
-       }
-                       
-       if ($this->dn != $new_dn && $this->dn != "new"){
-               
-               /* if( new_dn is subtree of this->dn ) */
-               $cnt1 = count(split(",",$this->dn));
-               $cnt2 = count(split(",",$new_dn));
-               if((strstr($new_dn,$this->dn))&&($cnt1<$cnt2)){
-                       print_red(_("Try to move tree failed. Destination tree is subtree of source tree."));
-               }else{
-//                     $baseobject->recursive_move($this->dn, $new_dn);
-               }
-       }
-       $this->dn= $new_dn;
-
-       tabs::save(TRUE);
-  }
-
-}
-
-?>
diff --git a/plugins/admin/fai/tabsScript.inc b/plugins/admin/fai/tabsScript.inc
deleted file mode 100644 (file)
index 28ebd22..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-
-class tabsScript extends tabs
-{
-  var $base= "";
-
-  function tabsScript($config, $data, $dn,$category)
-  {
-       tabs::tabs($config, $data, $dn,$category);
-
-       /* Add references/acls/snapshots */
-       $this->addSpecialTabs();
-  }
-
-  function check($ignore_account= FALSE)
-  {
-       return (tabs::check(TRUE));
-  }
-  
-
-  function save($ignore_account= FALSE)
-  {
-       $baseobject= $this->by_object['faiScript'];
-
-       $new_dn= 'cn='.$baseobject->cn.",ou=scripts,ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase'];
-
-       if($_SESSION['faifilter']['branch']!="main"){
-               $new_dn ='cn='.$baseobject->cn.",ou=scripts,".$_SESSION['faifilter']['branch'];
-       }
-       
-       if ($this->dn != $new_dn && $this->dn != "new"){
-               
-               /* if( new_dn is subtree of this->dn ) */
-               $cnt1 = count(split(",",$this->dn));
-               $cnt2 = count(split(",",$new_dn));
-               if((strstr($new_dn,$this->dn))&&($cnt1<$cnt2)){
-                       print_red(_("Try to move tree failed. Destination tree is subtree of source tree."));
-               }else{
-//                     $baseobject->recursive_move($this->dn, $new_dn);
-               }
-       }
-       $this->dn= $new_dn;
-
-       tabs::save(TRUE);
-  }
-
-}
-
-?>
diff --git a/plugins/admin/fai/tabsTemplate.inc b/plugins/admin/fai/tabsTemplate.inc
deleted file mode 100644 (file)
index 2ff5819..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-
-class tabsTemplate extends tabs
-{
-  var $base= "";
-
-  function tabsTemplate($config, $data, $dn,$category)
-  {
-       tabs::tabs($config, $data, $dn, $category);
-
-       /* Add references/acls/snapshots */
-       $this->addSpecialTabs();
-  }
-
-  function check($ignore_account= FALSE)
-  {
-       return (tabs::check(TRUE));
-  }
-  
-
-  function save($ignore_account= FALSE)
-  {
-       $baseobject= $this->by_object['faiTemplate'];
-       
-       $new_dn= 'cn='.$baseobject->cn.",ou=templates,ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase'];
-
-       if($_SESSION['faifilter']['branch']!="main"){
-               $new_dn ='cn='.$baseobject->cn.",ou=templates,".$_SESSION['faifilter']['branch'];
-       }
-
-       if ($this->dn != $new_dn && $this->dn != "new"){
-               
-               /* if( new_dn is subtree of this->dn ) */
-               $cnt1 = count(split(",",$this->dn));
-               $cnt2 = count(split(",",$new_dn));
-               if((strstr($new_dn,$this->dn))&&($cnt1<$cnt2)){
-                       print_red(_("Try to move tree failed. Destination tree is subtree of source tree."));
-               }else{
-//                     $baseobject->recursive_move($this->dn, $new_dn);
-               }
-       }
-       $this->dn= $new_dn;
-
-       tabs::save(TRUE);
-  }
-
-}
-
-?>
diff --git a/plugins/admin/fai/tabsVariable.inc b/plugins/admin/fai/tabsVariable.inc
deleted file mode 100644 (file)
index c872f2d..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-
-class tabsVariable extends tabs
-{
-  var $base= "";
-
-  function tabsVariable($config, $data, $dn,$category)
-  {
-       tabs::tabs($config, $data, $dn, $category);
-
-       /* Add references/acls/snapshots */
-       $this->addSpecialTabs();
-  }
-
-  function check($ignore_account= FALSE)
-  {
-       return (tabs::check(TRUE));
-  }
-  
-
-  function save($ignore_account= FALSE)
-  {
-       $baseobject= $this->by_object['faiVariable'];
-
-       $new_dn= 'cn='.$baseobject->cn.",ou=variables,ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase'];
-       
-       if($_SESSION['faifilter']['branch']!="main"){
-               $new_dn ='cn='.$baseobject->cn.",ou=variables,".$_SESSION['faifilter']['branch'];
-       }
-                       
-       if ($this->dn != $new_dn && $this->dn != "new"){
-               
-               /* if( new_dn is subtree of this->dn ) */
-               $cnt1 = count(split(",",$this->dn));
-               $cnt2 = count(split(",",$new_dn));
-               if((strstr($new_dn,$this->dn))&&($cnt1<$cnt2)){
-                       print_red(_("Try to move tree failed. Destination tree is subtree of source tree."));
-               }else{
-//                     $baseobject->recursive_move($this->dn, $new_dn);
-               }
-       }
-       $this->dn= $new_dn;
-
-       tabs::save(TRUE);
-  }
-
-}
-
-?>
diff --git a/plugins/admin/groups/application.tpl b/plugins/admin/groups/application.tpl
deleted file mode 100644 (file)
index 87d8050..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-{if $enableReleaseManagement == true}
-       <br>
-       <b>{t}Release focus{/t}</b>&nbsp;
-       {if $ReleaseSelectAble}
-{render acl=$FAIreleaseACL}
-               <select name="FAIrelease" title="{t}Select release name{/t}" onChange="javascript: document.mainform.submit();">
-                       {html_options output=$Releases values=$Releases selected=$FAIrelease}
-               </select>
-{/render}
-       {else}
-               {$Release}
-       {/if}
-       <p class="seperator">&nbsp;</p>
-{
-/if}
-<table summary="" style="width:100%;">
- <tr>
-  <td style="width:48%; vertical-align:top;">
-   <b>
-       <LABEL for="used_apps">{t}Used applications{/t}</LABEL>
-   </b>
-   {$UsedApps}
-{render acl=$gosaMemberApplicationACL} 
-   <input type="text" value="" size="30" name='CatName'>
-{/render}
-{render acl=$gosaMemberApplicationACL} 
-   <input type="submit" value="{t}Add category{/t}" name='AddCat'>
-{/render}
-  </td>
-  <td>&nbsp;
-  </td>
-  <td style="width:48%;vertical-align:top;">
-   <b>
-    <LABEL for="apps">{t}Available applications{/t}</LABEL>
-   </b>
-   <br>
-   {$List}
-{render acl=$gosaMemberApplicationACL} 
-   <input type="submit" value="{t}Add{/t}" name='AddApps'>
-{/render}
-  </td>
- </tr>
-</table>
-
diff --git a/plugins/admin/groups/application_options.tpl b/plugins/admin/groups/application_options.tpl
deleted file mode 100644 (file)
index aa55221..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-<br>
-<b>{t}Application options{/t}</b>
-<br>
-<br>
-
-{$table}
-
-<div style="height:20px;"></div>
-
-<p class="plugbottom">
-  <input type=submit name="edit_options_finish" value="{t}Apply{/t}">
-  &nbsp;
-  <input type=submit name="edit_options_cancel" value="{t}Cancel{/t}">
-</p>
-
diff --git a/plugins/admin/groups/class_divListGroup.inc b/plugins/admin/groups/class_divListGroup.inc
deleted file mode 100644 (file)
index fcf32f8..0000000
+++ /dev/null
@@ -1,351 +0,0 @@
-<?php
-
-class divListGroup extends MultiSelectWindow
-{
-
-  /* Current base */
-  var $selectedBase       = "";
-  var $departments        = array();
-
-  /* Regex */
-  var $Regex              = "*";
-  var $UserRegex          = "*";
-
-  /* CheckBoxes, to change default values modify $this->AddCheckBox */
-  var $ShowPrimaryGroups;
-  var $ShowSambaGroups;  
-  var $ShowApplicationGroups; 
-  var $ShowMailGroups;
-  var $ShowFunctionalGroups;
-
-  /* Subsearch checkbox */
-  var $SubSearch              = false;
-
-  var $parent             ;
-  var $ui                 ;
-
-  function divListGroup (&$config, &$parent)
-  {
-    MultiSelectWindow::MultiSelectWindow($config, "Groups", "groups");
-    
-    $this->parent       = &$parent;
-    $this->ui           = get_userinfo();
-
-    /* Set list strings */
-    $this->SetTitle(_("List of groups"));
-    $this->SetSummary(_("List of groups"));
-    $this->EnableAplhabet   (true);
-
-    /* Result page will look like a headpage */
-    $this->SetHeadpageMode();
-    $this->SetInformation(_("This menu allows you to add, edit and remove selected groups. You may want to use the range selector on top of the group listbox, when working with a large number of groups."));
-  
-    /* Disable buttonsm */
-    $this->EnableCloseButton(false);
-    $this->EnableSaveButton (false);
-
-    /* Dynamic action col, depending on snapshot icons */
-    $action_col_size = 80;
-    if($this->parent->snapshotEnabled()){
-      $action_col_size += 38;
-    }
-
-    /* Toggle all selected / deselected */
-    $chk = "<input type='checkbox' id='select_all' name='select_all'
-               onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
-
-    /* set Page header */
-    $this->AddHeader(array("string"=> $chk,          "attach"=>"style='width:20px;'"));
-    $this->AddHeader(array("string"=>"&nbsp;","attach"=>"style='width:20px;'"));
-    $this->AddHeader(array("string"=>_("Groupname / Department")));
-    $this->AddHeader(array("string"=>_("Properties"),"attach"=>"style='width:136px;'"));
-    $this->AddHeader(array("string"=>_("Actions"),"attach"=>"style='width:".$action_col_size."px;border-right:0px;'"));
-
-    /*                  Text        ,Value    ,Name         ,Is selected */
-    $this->AddCheckBox("ShowPrimaryGroups",     _("Select to see groups that are primary groups of users"),          _("Show primary groups"),      true);
-    $this->AddCheckBox("ShowSambaGroups",       _("Select to see groups that have samba groups mappings"),          _("Show samba groups"),      true);
-    $this->AddCheckBox("ShowApplicationGroups", _("Select to see groups that have applications configured"),        _("Show application groups"),true);
-    $this->AddCheckBox("ShowMailGroups",        _("Select to see groups that have mail settings"),                  _("Show mail groups"),       true);
-    $this->AddCheckBox("ShowFunctionalGroups",  _("Select to see normal groups that have only functional aspects"), _("Show functional groups"), true);
-    $this->AddCheckBox(SEPERATOR);
-
-    /* Add SubSearch checkbox */    
-    $this->AddCheckBox("SubSearch",  _("Select to search within subtrees"), _("Search in subtrees"), false);
-
-    /*                  Name                 ,Text                              ,Default  , Connect with alphabet  */
-    $this->AddRegex   ("Regex",     _("Regular expression for matching group names"), "*" , true);
-    $this->AddRegex   ("UserRegex", _("User name of which groups are shown"),         "*" , false, "images/search_user.png");
-  }
-
-
-  function GenHeader()
-  {
-    /* Prepare departments,
-       which are shown in the listbox on top of the listbox
-     */
-    $options= "";
-
-
-    
-    /* Get all departments within this subtree */
-    $ui= get_userinfo();
-    $first = "";
-    $found = FALSE;
-    $base = $this->config->current['BASE'];
-
-
-    
-    /* Add base */
-    $tmp = array();
-    $tmp[] = array("dn"=>$this->config->current['BASE']);
-    $tmp=  array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
-                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
-
-    $deps = array();
-    foreach($tmp as $tm){
-      $deps[$tm['dn']] = $tm['dn'];
-    }
-
-        /* Load possible departments */
-    $ui= get_userinfo();
-    $tdeps= $ui->get_module_departments("groups");
-    $ids = $this->config->idepartments;
-    $first = "";
-    $found = FALSE;
-    foreach($ids as $dep => $name){
-      if(isset($deps[$dep]) && in_array_ics($dep, $tdeps)){
-
-        /* Keep first base dn in mind, we could need this
-         *  info if no valid base was found
-         */
-        if(empty($first)) {
-          $first = $dep['dn'];
-        }
-
-        $value = $ids[$dep];
-        if ($this->selectedBase == $dep){
-          $found = TRUE;
-          $options.= "<option selected='selected' value='".$dep."'>$value</option>";
-        } else {
-          $options.= "<option value='".$dep."'>$value</option>";
-        }
-      }
-    }
-
-    /* The currently used base is not visible with your acl setup.
-     * Set base to first useable base.
-     */
-    if(!$found){
-      $this->selectedBase = $first;
-    }
-  
-    /* Get acls */
-    $acls   = $ui->get_permissions($this->selectedBase,"groups/group");
-    $acl_all= $ui->has_complete_category_acls($this->selectedBase,"groups");
-
-
-    /* Add default header */
-    $listhead = MultiSelectWindow::get_default_header();
-    
-    /* Add department selection */
-    $listhead .= _("Base")."&nbsp;<select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
-      " <input type='image' class='center' src='images/list_submit.png' title='"._("Submit department")."' name='submit_department' alt='"._("Submit").
-      "'>&nbsp;";
-
-
-        /* Create Layers menu */
-    $s  = ".|"._("Actions")."|\n";
-    $s .= "..|<img src='images/list_new.png' alt='' border='0' class='center'>".
-      "&nbsp;"._("Create")."|\n";
-
-
-    /* Append create options */
-    if(preg_match("/c/",$acl_all)) {
-      $s.= "...|<input class='center' type='image' src='images/list_new_group.png' alt=''>".
-        "&nbsp;"._("Group")."|group_new|\n";
-    }
-
-    /* Multiple options */
-    $s.= "..|---|\n";
-    $s.= "..|<img src='images/edittrash.png' alt='' border='0' class='center'>".
-      "&nbsp;"._("Remove")."|"."remove_multiple|\n";
-
-    /* Add multiple copy & cut icons */
-    if(is_object($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
-      $s.= "..|---|\n";
-      $s.= "..|<img src='images/editcopy.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Copy")."|"."multiple_copy_systems|\n";
-      $s.= "..|<img src='images/editcut.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Cut")."|"."multiple_cut_systems|\n";
-
-      if($this->parent->CopyPasteHandler->entries_queued()){
-        $img = "<img border='0' class='center' src='images/editpaste.png' alt=''>";
-        $s.="..|".$img."&nbsp;"._("Paste")."|editPaste|\n";
-      }else{
-        $img = "<img border='0' class='center' src='images/cant_editpaste.png' alt=''>";
-        $s.="..|".$img."&nbsp;"._("Paste")."\n";
-      }
-    }
-
-    /* Add snapshot icons */
-    if(preg_match("/(c.*w|w.*c)/",$acl_all)){
-      $s .= "..|---|\n";
-      $s .= $this->get_snapshot_header(TRUE);
-    }
-
-    $this->SetDropDownHeaderMenu($s);
-
-    $this->SetListHeader($listhead);
-  }
-
-  function execute()
-  {
-    $this->ClearElementsList();
-    $this->GenHeader();
-  }
-
-  function setEntries($groups)
-  {
-    // Defining Links
-    $linkopen = "<a href='?plug=".$_GET['plug']."&amp;act=dep_open&amp;dep_id=%s'>%s</a>";
-
-    // image Buttons
-    $editlink = "<a href='?plug=".$_GET['plug']."&amp;id=%s&amp;act=edit_entry'>%s</a>";
-    $userimg  = "<img class='center' src='images/select_groups.png' alt='User'    title='%s'>";
-
-    /* Dynamic action col, depending on snapshot icons */
-    $action_col_size = 80;
-    if($this->parent->snapshotEnabled()){
-      $action_col_size += 38;
-    }
-
-    /* Assign extension images */
-    $posiximg = "<input type='image' class='center' src='images/select_groups.png'
-                 name='group_group_edit_%KEY%' alt='P'  title='"._("Posix")  ."'>";
-    $mailimg  = "<input type='image' class='center' src='images/mailto.png'
-                 name='mailgroup_group_edit_%KEY%' alt='M'  title='"._("Mail")   ."'>";
-    $sambaimg = "<input type='image'  class='center' src='images/select_winstation.png'
-                 name='group_group_edit_%KEY%' alt='S'  title='"._("Samba")  ."'>";
-    $applimg  = "<input type='image'  class='center' src='images/select_application.png'
-                 name='appgroup_group_edit_%KEY%' alt='A'  title='"._("Application")."'>";
-    $phoneimg = "<input type='image'  class='center' src='images/select_phone.png'
-                 name='group_group_edit_%KEY%' alt='Ph' title='"._("Phone")  ."'>";
-    $envimg   = "<input type='image'  class='center' src='images/smallenv.png'
-                 name='environment_group_edit_%KEY%' alt='E' title='"._("Environment")  ."'>";
-
-    // Space
-    $empty    = "<img class='center' src='images/empty.png' style='width:16px;height:16px;' alt=''>";
-
-    // User and Template  Images
-    $editlink = "<a href='?plug=".$_GET['plug']."&amp;id=%s&amp;act=edit_entry'>%s</a>";
-
-    $ui = get_userinfo();
-
-    // Test Every Entry and generate divlist Array
-    foreach($groups as $key => $val){
-    
-      /* Create action icons - copy & paste icons */
-      $acl = $ui->get_permissions($val['dn'],"groups/group");
-      $acl_all= $ui->has_complete_category_acls($val['dn'],"groups");
-
-      $actions= "";
-      if(($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
-        $actions.= "<input class='center' type='image'
-          src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
-        $actions.= "<input class='center' type='image'
-          src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
-      }
-
-      /* Add edit icon */
-      $actions.= "<input class='center' type='image'
-        src='images/edit.png' alt='"._("edit")."' name='group_edit_%KEY%' title='"._("Edit this entry")."'>";
-
-      /* Add snapshot functionality */
-      if(preg_match("/(c.*w|w.*c)/", $acl_all)){
-        $actions.= $this->GetSnapShotActions($val['dn']);
-      }
-
-      if(preg_match("/d/",$acl)){
-        $actions.= "<input class='center' type='image'
-          src='images/edittrash.png' alt='"._("delete")."' name='group_del_%KEY%' title='"._("Delete this entry")."'>";
-      }
-
-
-      $posix=$mail=$samba=$appl=$phone=$enviro=$empty;
-
-      if(isset($val['objectClass'])){
-        if(in_array("posixGroup",           $val['objectClass']))   $posix = $posiximg;
-        if(in_array("gosaMailAccount",      $val['objectClass']))   $mail  = $mailimg;
-        if(in_array("sambaGroupMapping",    $val['objectClass']))   $samba = $sambaimg;
-        if(in_array("gosaApplicationGroup", $val['objectClass']))   $appl  = $applimg;
-        if(in_array("goFonPickupGroup",     $val['objectClass']))   $phone = $phoneimg;
-        if(in_array("gotoEnvironment",      $val['objectClass']))   $enviro= $envimg;
-      }
-
-      $title = "title='".preg_replace('/ /', '&nbsp;', @LDAP::fix($val['dn']))."'";
-
-      if(!isset($val['description'][0])){
-        $desc = "";
-      }else{
-        $desc = " - [ ".$val['description'][0]." ]";
-      }
-
-      /* FAIrelease tag from groupApplications */
-      if(isset($val['FAIrelease'][0])){
-        $desc .= " (".$val['FAIrelease'][0].")";
-      }
-
-      $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
-          "attach" => "style='width:20px;'");
-
-      /* Cutted objects should be displayed in light grey */
-      $display = $val['cn'][0].$desc;
-      if($this->parent->CopyPasteHandler){
-        foreach($this->parent->CopyPasteHandler->queue as $queue_key => $queue_data){
-          if($queue_data['dn'] == $val['dn']) {
-            $display = "<font color='#999999'>".$display."</font>";
-            break;
-          }
-        }
-      }
-
-      $field1 = array("string" => sprintf($userimg,$val['dn']), "attach" => "style='text-align:center;width:20px;'");
-      $field2 = array("string" => sprintf($editlink,$key,$display), "attach" => "style='' ".$title);
-      $field3 = array("string" => preg_replace("/%KEY%/", $key, $posix."&nbsp;".$enviro."&nbsp;".$mail."&nbsp;".$samba."&nbsp;".$appl."&nbsp;".$phone),     "attach" => "style='width:136px;'");
-      $field4 = array("string" => preg_replace("/%KEY%/", $key, $actions), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'");
-
-      $this->AddElement(array($field0,$field1,$field2,$field3,$field4));
-    }
-
-    /* Create summary string for list footer */
-    $num_deps=0;
-    if(!$this->SubSearch){
-      $num_deps = count($this->Added_Departments);
-    }
-    $num_grps = count($groups);
-
-    $num_grp_str = _("Number of listed groups");
-    $num_dep_str = _("Number of listed departments");
-
-    $str = "<img class='center' src='images/select_groups.png'
-              title='".$num_grp_str."' alt='".$num_grp_str."'>&nbsp;".$num_grps."&nbsp;&nbsp;&nbsp;&nbsp;";
-    $str.= "<img class='center' src='images/folder.png'
-              title='".$num_dep_str."' alt='".$num_dep_str."'>&nbsp;".$num_deps."&nbsp;&nbsp;&nbsp;&nbsp;";
-
-    $this->set_List_Bottom_Info($str);
-
-  }
-
-  function Save()
-  {
-    MultiSelectWindow :: Save();  
-  }
-
-  function save_object()
-  {
-    /* Save automatic created POSTs like regex, checkboxes */
-    MultiSelectWindow::save_object();   
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/groups/class_groupApplication.inc b/plugins/admin/groups/class_groupApplication.inc
deleted file mode 100644 (file)
index 12b80fa..0000000
+++ /dev/null
@@ -1,1230 +0,0 @@
-<?php
-class appgroup extends plugin
-{
-  /* CLI vars */
-  var $cli_summary= "Manage application groups";
-  var $cli_description= "Some longer text\nfor help";
-  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* Appgroup attributes */
-  var $gosaMemberApplication= array();
-
-  /* Helpers */
-  var $departments        = "";       // All departments within $this->curbase;
-  var $apps               = array();  // All available applications
-  var $used_apps          = array();  // Specifies which applications are currently assigned 
-
-  var $option_name          = array();
-  var $option_value         = array();
-  var $appoption            = array();
-
-  var $table                  = "";
-  var $curbase                = "";
-  var $curCatDir                  ;
-  var $curCatDepth              =0;         //
-  var $Categories;
-
-  /* attribute list for save action */
-  var $attributes               = array("gosaMemberApplication","gosaApplicationParameter");
-  var $objectclasses            = array("gosaApplicationGroup");
-
-  var $FAIrelease               = "/";
-  var $InitialFAIrelease           = "/";
-  var $Releases                 = array();
-  var $enableReleaseManagement  = false;
-
-  var $AllAppsForRelease        = array();
-  var $AllAppsForReleaseParameter = array();
-  var $view_logged = FALSE;
-  var $CopyPasteVars            = array("Categories");
-  var $gosaApplicationParameter ;
-  var $ui                       = NULL;
-  var $no_release_acls          = false;
-
-  function appgroup (&$config, $dn= NULL, $parent= NULL)
-  {
-   
-    /* Check if we have relase mangement enabled and prepare group application for release management */ 
-    $tmp = $config->search("faiManagement", "CLASS",array('menu','tabs'));
-    if(!empty($tmp)){
-      $this->enableReleaseManagement = true;
-      $this->objectclasses  [] = "FAIreleaseTag";
-      $this->attributes     [] = "FAIrelease";
-    }
-
-    plugin::plugin ($config, $dn, $parent);
-
-    /* set userinfo object */
-    $this->ui = get_userinfo();
-
-    /* Compatibility check 
-        In some case of old applikations with old release tag saving, 
-          we must reassign is_account state.
-          (Or if release management wasn't activated before creating this app) */
-    if($this->enableReleaseManagement){
-  
-      /* Release management is activated && this is a valid group app account,
-          but no release class was found, so activate is_account flag  */
-      if(isset($this->attrs['objectClass'])){
-        if($dn != "new" && ( in_array("gosaApplicationGroup",$this->attrs['objectClass'])) && 
-            (!in_array("FAIreleaseTag",$this->attrs['objectClass']))){
-          $this->is_account =true;
-        }
-      }
-    }
-    
-    /* Load member applications */
-    if (isset ($this->attrs["gosaMemberApplication"][0])){
-      $this->gosaMemberApplication = array();
-      for ($i= 0; $i<$this->attrs["gosaMemberApplication"]["count"]; $i++){
-        $this->gosaMemberApplication[]=
-          $this->attrs["gosaMemberApplication"][$i];
-      }
-    }
-
-    /* Load application options */
-    if (isset($this->attrs['gosaApplicationParameter'])){
-      for ($i= 0; $i<$this->attrs['gosaApplicationParameter']['count']; $i++){
-        $option= preg_replace('/^[^:]+:/', '',
-            $this->attrs['gosaApplicationParameter'][$i]);
-        $name= preg_replace('/:.*$/', '',
-            $this->attrs['gosaApplicationParameter'][$i]);
-        $this->appoption[$name]= $option;
-      }
-    }
-
-    /* Parse MemberApplication*/
-    $tmp    = array();
-    $tmp2   = array();
-    $prios  = array();
-    $cats   = array();
-
-    foreach($this->gosaMemberApplication as $memberApp){
-      if(preg_match("/\|/i",$memberApp)){
-    
-        $tmp = split("\|",$memberApp);
-        if(!empty($tmp[0])){
-          $tmp2[$tmp[1]][$tmp[2]] = array("App"=>$tmp[0]);
-        }
-        if(!empty($tmp[1])){
-          $n = split("/",$tmp[1]);
-          $c = count($n);
-          $cats [$tmp[1]] = $n[$c-1];
-        }
-        $prios[$tmp[1]][$tmp[2]] = $tmp[2];
-      }else{
-        $tmp2[]['App'] = $memberApp;
-      }
-    }
-
-    /* Assign collected category and application settings */
-    $this->Categories = $cats;
-    $this->gosaMemberApplication = $tmp2;
-
-    /* Sort application by category */
-    $cats[""]="";
-    foreach($cats as $cat ){
-      if((isset($prios[$cat]))&&(count($prios[$cat]))){
-        $max = max($prios[$cat]);
-        $min = 1;//min($prios[$cat]);  
-        $last = false;
-        for($i = $min ; $i < $max ; $i++){
-          if(!isset($prios[$cat][$i])){
-            if($last == false){
-              $this->gosaMemberApplication[$cat][$i]['App'] = "__SEPARATOR__".$i;
-            
-              $last = true;
-            }
-          }else{
-            $last = false;
-          }
-        }
-      }
-    } 
-
-    /* Sort application by priority */
-    $tmp = array();
-    foreach($this->gosaMemberApplication as $key =>  $entries){
-      ksort ($entries);
-      foreach($entries as $entry){
-        $tmp[$key][]= $entry;
-      }
-    }
-    $this->gosaMemberApplication = $tmp;
-    $this->curbase = $this->config->current['BASE'];
-    
-    /* Get required release informations */
-    if($this->enableReleaseManagement){
-      $this->InitialFAIrelease  = $this->FAIrelease;
-      $this->Releases           = $this->getReleases();
-    }
-
-  }
-
-
-  /* Combine new array */
-  function combineArrays($ar0,$ar1,$ar2)
-  {
-    $ret = array();
-    if(is_array($ar0))
-    foreach($ar0 as $ar => $a){
-        $ret[$ar]=$a;
-    }
-    if(is_array($ar1))
-    foreach($ar1 as $ar => $a){
-        $ret[$ar]=$a;
-    }
-    if(is_array($ar2))
-    foreach($ar2 as $ar => $a){
-        $ret[$ar]=$a;
-    }
-    return($ret);
-  }
-
-  /* Returns element position within given array */
-  function getpos($atr,$attrs)
-  {
-    $i = 0;
-    foreach($attrs as $attr => $name)    {
-      $i++;
-      if($attr == $atr){
-        return($i);
-      }
-    }
-    return(-1);
-  }
-
-
-  /* Check current combination of application && release 
-      Are all application available?, application parameter changed? ... */
-  function diffAppsInReleases()
-  {
-    /* Only diff if it is required  */
-    $ret =array();
-
-    /* If current release has changed */
-    if($this->FAIrelease != $this->InitialFAIrelease){
-
-      /* Walk through all apps which are currently displayed */
-      if(isset($this->gosaMemberApplication[$this->curCatDir])){
-
-        foreach($this->gosaMemberApplication[$this->curCatDir] as $entry){
-
-          /* If application is also available in new release, check if parameter differs */
-          if(in_array($entry['App'],$this->AllAppsForRelease)){ 
-
-            $old = array();   // Old application parameter
-            $new = array();   // New parameters 
-
-            /* There are possibly no parameters specified */
-            if(isset($this->AllAppsForReleaseParameter[$this->InitialFAIrelease][$entry['App']])){
-              $old = $this->AllAppsForReleaseParameter[$this->InitialFAIrelease][$entry['App']];
-            }
-
-            if(isset($this->AllAppsForReleaseParameter[$this->FAIrelease][$entry['App']])){
-              $new = $this->AllAppsForReleaseParameter[$this->FAIrelease][$entry['App']];
-            }
-
-            /*  Both (old & new) have no gosaApplicationParameter
-             */
-            if((!isset($old['gosaApplicationParameter'])) && (!isset($new['gosaApplicationParameter']))){
-              $ret[$entry['App']] = false; 
-
-              /* Both got gosaApplicationParameter */
-            }elseif((isset($old['gosaApplicationParameter'])) && (isset($new['gosaApplicationParameter']))){
-              if(array_differs($old['gosaApplicationParameter'],$new['gosaApplicationParameter'])){
-                $ret[$entry['App']]  = true;
-              }else{
-                $ret[$entry['App']]  = false;
-              }
-            }
-            /* Initially had gosaApplicationParameter bot in new release not */
-          }elseif((isset($old['gosaApplicationParameter'])) && (!isset($new['gosaApplicationParameter']))){
-            $ret[$entry['App']]  = true;
-
-            /* Old release had no gosaApplicationParameter but new got some */
-          }elseif((!isset($old['gosaApplicationParameter'])) && (isset($new['gosaApplicationParameter']))){
-            $ret[$entry['App']]  = true;
-          }
-        }
-      }
-    }
-    return($ret);
-  }
-
-  /* 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);
-  }
-
-    
-  /* Sort category on position up  */
-  function catUp($id)
-  {
-    /* Get all cats depinding on current dir */
-    $cats = $this->GetSubdirs($this->curCatDir);
-    $newcats =$this->ArrayUp($id,$cats);
-    foreach($newcats as $cat => $name){
-      unset($this->Categories[$cat]);
-    }
-    foreach($newcats as $cat => $name){
-      $this->Categories[$cat]=$name;
-    }
-  }
-
-
-  /* Sort category on position down */
-  function catDown($id)
-  {
-    /* Get all cats depinding on current dir */
-    $cats = $this->GetSubdirs($this->curCatDir);
-    $newcats =$this->ArrayDown($id,$cats);
-    foreach($newcats as $cat => $name){
-      unset($this->Categories[$cat]);
-    }
-    foreach($newcats as $cat => $name){
-      $this->Categories[$cat]=$name;
-    }
-  }
-
-
-  /* Increase application priority */
-  function getOneUp($appl)
-  { 
-    $cat  = $this->curCatDir;
-    $apps = $this->gosaMemberApplication[$cat];
-    $appsA = array();
-    foreach ($apps as $appkey => $name){
-      $appsA[$name['App']] =$name['App'];
-    }
-    $result = $this->ArrayUp($appl,$appsA);
-    $ret = array();
-    foreach($result as $app){
-      $ret[]=array("App"=>$app);
-    }
-    $this->gosaMemberApplication[$cat] = $ret;
-  }
-
-
-  /* Decrease application priority */
-  function getOneDown($appl)
-  {
-    $cat  = $this->curCatDir;
-    $apps = $this->gosaMemberApplication[$cat];
-    $appsA = array();
-    foreach ($apps as $appkey => $name){
-      $appsA[$name['App']] =$name['App'];
-    }
-    $result = $this->ArrayDown($appl,$appsA);
-    $ret = array();
-    foreach($result as $app){
-      $ret[]=array("App"=>$app);
-    }
-    $this->gosaMemberApplication[$cat] = $ret;
-  } 
-
-
-  /* Add seperator to application list */
-  function AddSeperator($id)
-  {
-    $found  = false;
-    $cat    = "";
-    $tmp = array();
-    foreach($this->gosaMemberApplication[$this->curCatDir] as $appID => $app){  
-      $tmp[] = $app;    
-      if(($app['App'] == $id)&&(!$found)){
-        $cnt = count($this->gosaMemberApplication[$this->curCatDir]);
-        $tmp[] = array("App" => "__SEPARATOR__".($cnt+1));
-        $found = true;
-      }
-    }
-    if($found){
-      $this->gosaMemberApplication[$this->curCatDir]=$tmp;
-    }
-  }
-
-
-  /* Check if application acls are readable */
-  function check_acls()
-  {
-    return(count($this->ui->get_module_departments("application")));
-  }
-
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* Log view */
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","groups/".get_class($this),$this->dn);
-    }
-
-    /* Check if department was selected */ 
-    if((isset($_GET['act']))&&($_GET['act']=="depopen")){
-      $dep = base64_decode($_GET['depid']); 
-      $this->curbase =$dep;
-    }
-
-    /* Check if category was selected */
-    if((isset($_GET['act']))&&($_GET['act']=="open") && (empty($_GET['id']) || isset($this->Categories[base64_decode($_GET['id'])]))){
-      $this->curCatDir = base64_decode($_GET['id']);
-    }
-
-    /* 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;
-      }
-    }
-
-    /* Do we represent a valid group? */
-    if (!$this->is_account && $this->parent === NULL){
-      $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\">&nbsp;<b>".
-        _("This 'dn' is no appgroup.")."</b>";
-      return ($display);
-    }
-
-    /* Show tab dialog headers */
-    $display= "";
-    if ($this->parent !== NULL){
-      if ($this->is_account){
-        $display= $this->show_disable_header(_("Remove applications"),
-            _("This group has application features enabled. You can disable them by clicking below."));
-      } else {
-        $display.= $this->show_enable_header(_("Create applications"),
-            _("This group has application features disabled. You can enable them by clicking below."));
-        return ($display);
-      }
-    }
-
-    /* Check acl, applications must be readable */
-    if(!$this->check_acls()){
-      $display .= "<img src='images/button_cancel.png' alt='"._("ACL")."' class='center'>
-                  <b>"._("Insufficient permissions")."</b>
-                  <p>".
-                  _("You do not have permission to query application entries. All your changes will not be saved.").
-                  "</p><p class='seperator'>&nbsp;</p>";
-      $this->no_release_acls = true;
-    }
-    
-
-    /* Add Categorie */ 
-    if((isset($_POST['AddCat']))&&(isset($_POST['CatName']))&&(!empty($_POST['CatName']))){
-
-      /* Only allow adding a category, if it is allowed */  
-      if($this->acl_is_writeable("gosaMemberApplication",$this->no_release_acls)){
-
-        if(preg_match("/[\\\\\/]/i",$_POST['CatName'])){
-          print_red(_("Invalid character in category name."));
-        }elseif(!in_array($_POST['CatName'],$this->Categories)){ 
-          if(empty($this->curCatDir)){
-            $this->Categories[$_POST['CatName']]=$_POST['CatName'];
-          }else{
-            $this->Categories[$this->curCatDir."/".$_POST['CatName']]=$_POST['CatName'];
-          }
-        }else{
-          print_red(_("The specified category already exists."));
-        }
-      }
-    }
-
-
-    $this->reload();
-    $this->diffAppsInReleases();
-
-    /* Check POST variables for commands 
-        to add/remove some applications */
-    $only_once = false;
-    if($this->acl_is_writeable("gosaMemberApplication",$this->no_release_acls)){
-
-      /* Walk through posts */
-      foreach($_POST as $name => $value){
-
-        /* Add a seperator to current category */
-        if((preg_match("/AddSep_/",$name))&&(!$only_once)){
-          $only_once = true;
-          $n = preg_replace("/AddSep_/","",$name);
-          $val= preg_replace("/_.*$/","",$n);
-          $this->AddSeperator($val);
-        }
-
-        /* Delete application | seperator entry */
-        if((preg_match("/DelApp_/",$name))&&(!$only_once)){
-          $only_once = true;
-
-          if(preg_match("/DelApp___SEPARATOR__/",$name)) {
-            $n=  preg_replace("/DelApp___SEPARATOR__/","",$name);
-            $val= "__SEPARATOR__".preg_replace("/_.*$/","",$n);
-          }else{
-            $n = preg_replace("/DelApp_/","",$name);
-            $val= preg_replace("/_.*$/","",$n);
-          }
-
-          foreach($this->gosaMemberApplication as $key =>  $cat){
-            foreach($cat as $key2 => $app){
-              if($app['App'] == $val){
-                unset($this->gosaMemberApplication[$key][$key2]);
-                if(isset($this->used_apps[$val])){
-                  foreach($this->getParameters($val) as $para){
-                    if(isset($this->appoption[$para])){
-                      unset($this->appoption[$para]);
-                    }
-                  }
-                  unset($this->used_apps[$val]);
-                }
-              }
-            }
-          }
-        }
-
-        if(preg_match("/DelCat_/",$name) && !$only_once){
-          $only_once =TRUE;
-          $cat = preg_replace("/DelCat_/","",$name);
-          $cat = trim(base64_decode( preg_replace("/_.*$/","",$cat)));
-
-          $free_apps = array();
-
-          if(isset($this->gosaMemberApplication[$cat]) && is_array($this->gosaMemberApplication[$cat])){
-            foreach($this->gosaMemberApplication[$cat] as $app){
-              $free_apps[] = $app['App'];
-            }
-            unset($this->gosaMemberApplication[$cat]);
-            unset($this->Categories[$cat]);
-          }
-          foreach($this->Categories as $key => $name){
-            if(preg_match("/^".normalizePreg($cat)."\/.*/",$key)){
-              foreach($this->gosaMemberApplication[$key] as $app){
-                $free_apps[] = $app['App'];
-              }
-              unset($this->gosaMemberApplication[$key]);
-              unset($this->Categories[$key]);
-            }
-          }
-          foreach($free_apps as $app){
-            if(isset($this->used_apps[$app])){
-              unset($this->used_apps[$app]);
-            }
-          }
-        }
-
-        /* Edit application parameter */
-        if((preg_match("/EdiApp_/",$name))&&(!$only_once)){
-
-          $only_once = true;
-          $appname = $value;
-          $appname = preg_replace("/EdiApp_/","",$name);  
-          $appname = preg_replace("/_.*$/","",$appname);
-
-          /* We've got the appname, get parameters from ldap */
-          $ldap= $this->config->get_ldap_link();
-
-          /* Check if we have release management enabled */
-          $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
-          if(!empty($tmp)){
-    
-            /* Get application parameter from ldap */
-            $tmp = array_flip($this->Releases);
-            $base = $tmp[$this->FAIrelease];
-            $ldap->cd($base);
-            $ldap->search("(&(objectClass=gosaApplication)(cn=$appname))",array("gosaApplicationParameter"));
-            $found = "";
-            while($attrs = $ldap->fetch()) {
-              if(preg_match("/cn=".$appname.",".$base."/",$attrs['dn'])){
-                $found = $attrs['dn'];
-              }
-            }
-            $ldap->cat($found, array("gosaApplicationParameter"));
-          }else{
-
-            /* Get application parameter from ldap */
-            $ldap->cd($this->config->current['BASE']);
-            $ldap->search("(&(objectClass=gosaApplication)(cn=$appname))",array("gosaApplicationParameter"));
-          }
-
-          /* Check if this application is unique */
-          if ($ldap->count() != 1){
-            print_red (_("The selected application name is not uniq. Please check your LDAP."));
-          } else {
-
-            /* Get parameter */
-            $attrs= $ldap->fetch();
-            if(isset($attrs['gosaApplicationParameter'])){
-              $this->dialog= TRUE;
-
-              /* Fill name and value arrays */
-              for ($i= 0; $i<$attrs['gosaApplicationParameter']['count']; $i++){
-                $option= preg_replace('/^[^:]+:/', '',
-                    $attrs['gosaApplicationParameter'][$i]);
-                $name= preg_replace('/:.*$/', '', 
-                    $attrs['gosaApplicationParameter'][$i]);
-                $this->option_name[$i]= $name;
-
-                /* Fill with values from application, default should be
-                   loaded by the external scripts */
-                if (isset($this->appoption[$name])){
-                  $this->option_value[$i]= $this->appoption[$name];
-                }
-              }
-
-              /* Create edit field */
-              $table= "<table summary=\"\">";
-              for ($i= 0; $i < count($this->option_name); $i++){
-                if (isset($this->option_value[$i])){
-                  $value= $this->option_value[$i];
-                } else {
-                  $value= "";
-                }
-                $table.="<tr><td>".$this->option_name[$i]."</td><td>".
-                  "<input name=\"value$i\" size=60 maxlength=250 ".
-                  "value=\"".$value."\"><br></td></tr>";
-              }
-              $table.= "</table>";
-              $this->table= $table;
-            } else {
-              print_red (_("The selected application has no options."));
-            }
-          }
-        }
-      }
-    }
-
-    /* Add multiple */
-    if(isset($_POST['AddApps'])){
-      foreach($_POST as $name => $value){
-        if(preg_match("/AddApp_/",$name)){
-          $app = preg_replace("/AddApp_/","",$name);
-          $this->addApp($app);
-        }
-      }
-    }
-
-    /* Add application with post */
-    if((isset($_GET['act']))&&($_GET['act']=="add")){
-      $this->used_apps[$_GET['id']]= $_GET['id'];
-      asort($this->used_apps);
-      $this->addApp($_GET['id']);
-    }
-
-    /* Cancel edit options? */
-    if (isset($_POST['edit_options_cancel'])){
-      $this->dialog= FALSE;
-    }
-
-    /* Finish edit options? */
-    if (isset($_POST['edit_options_finish'])){
-      $this->dialog= FALSE;
-
-      /* Save informations passed by the user */
-      $this->option_value= array();
-      for ($i= 0; $i<count($this->option_name); $i++){
-        $this->appoption[$this->option_name[$i]]= $_POST["value$i"];
-        $this->is_modified= TRUE;
-      }
-    }
-
-    /* Prepare templating stuff */
-    $smarty= get_smarty();
-    $smarty->assign("used_apps", $this->used_apps);
-    $apps= array();
-    foreach ($this->apps as $key => $value){
-      if (!array_key_exists($key, $this->used_apps)){
-        $apps["$key"]= "$value";
-      }
-    }
-
-
-    /* Create application list */
-    $div = new divSelectBox("appgroup");    
-    $div->SetHeight(300);
-    $departments = array();
-    $res = get_list("(objectClass=gosaDepartment)", "application", $this->curbase,array("description","cn","ou"),GL_SIZELIMIT);
-    foreach($res as $value){
-      $fdn = $value['dn'];
-      $fdn = preg_replace("/".normalizePreg($this->curbase)."/","",$fdn);
-      $fdn= @LDAP::fix($fdn);
-      if($value["description"][0]!=".."){
-        $departments[$value['dn']]= convert_department_dn($fdn)." - [".$value["description"][0]."]";
-      }else{
-        $departments[$value['dn']]=convert_department_dn($fdn)." ["._("Back")."]";
-      }
-    }
-
-    /* Create 'open' and 'add' links */
-    if($this->acl_is_writeable("gosaMemberApplication",$this->no_release_acls)){
-      $linkadd  = "<a href='?plug=".$_GET['plug']."&amp;act=add&amp;id=%s'>%s</a>";
-    }else{
-      $linkadd = "%s";
-    }
-    $linkopen = "<a href='?plug=".$_GET['plug']."&amp;act=depopen&amp;depid=%s'>%s</a>";
-
-    /* Create base back entry */
-    $base_back = preg_replace("/^[^,]+,/","",$this->curbase);
-    if((strlen($base_back)>= strlen($this->config->current['BASE']))&&($this->curbase!=$this->config->current['BASE'])){
-      $div->AddEntry(array(
-            array("string"=>sprintf($linkopen,base64_encode($base_back),".. ["._("back")."]"),
-              "attach"=>"style='border:0px;'")
-            ));
-    }
-
-    /* Append departments for current base */
-    foreach($departments as $key => $app){
-      $div->AddEntry(array(
-            array("string"=>"<img class='center' src='images/folder.png' alt='"._("department")."'>&nbsp;".sprintf($linkopen,base64_encode($key),$app),
-              "attach"=>"style='border:0px;'")
-            ));
-    }
-
-    /* Add applications found on this base */
-    foreach($apps as $key => $app){
-      $div->AddEntry(array(
-            array("string"=>sprintf("<input class='center' type='checkbox' value='1' name='AddApp_%s'>",$key).
-              "<img class='center' src='images/select_application.png' alt='"._("application")."'>&nbsp;".sprintf($linkadd,$key,$app),
-              "attach"=>"style='border:0px;'")
-            ));
-    }
-
-    /* Create list of used/assigned applications */
-    $div2 = new divSelectBox("appgroup");
-    $div2->SetHeight(300);
-
-    /* Check acls to create "edit/remove" category links */
-    if(!$this->acl_is_writeable("gosaMemberApplication",$this->no_release_acls)){
-      $linkopen       = "<img class='center' src='images/folder.png' alt=\"\">&nbsp;<a href='?plug=".$_GET['plug']."&amp;act=open&amp;id=%s'>%s</a>";
-      $catremove      = "&nbsp;<img src='images/empty.png' alt='&nbsp;'>";
-      $catupdown      = "";
-    }else{
-      $linkopen       = "<img class='center' src='images/folder.png' alt=\"\">&nbsp;<a href='?plug=".$_GET['plug']."&amp;act=open&amp;id=%s'>%s</a>";
-      $catremove      = "&nbsp;<input type='image' src='images/edittrash.png' title='"._("Delete entry")."' name='DelCat_%s' value='%s'>";
-      $catupdown      = "<a href='?plug=".$_GET['plug']."&amp;act=cat_up&amp;id=%s'>".
-        "<img align='top' alt=\"\" src='images/sort_up.png' border=0 title='"._("Move up")."'>".
-        "</a>&nbsp;".
-        "<a href='?plug=".$_GET['plug']."&amp;act=cat_down&amp;id=%s'>".
-        "<img alt=\"\" src='images/sort_down.png' title='"._("Move down")."' border=0>".
-        "</a>";
-    }
-
-    /* Add back category for current category */
-    if(empty($this->curCatDir)){
-      $cnt =0;
-    }else{
-      $cnt = count(split("/",$this->curCatDir));
-      $tmp = split("/",$this->curCatDir);
-      $bbk = "";
-      for($i = 0 ; $i < ($cnt -1 ) ; $i++){
-        $bbk .= $tmp[$i]."/";
-      }
-      $bbk = preg_replace("/\/$/","",$bbk);
-      $div2 ->AddEntry(array(array("string"=>sprintf($linkopen,base64_encode($bbk),".. ["._("Back")."]")),array("string"=>"&nbsp;","attach"=>"style='border-right:0px;'")));
-    }
-
-    /* Add sub categories */ 
-    $this->GetSubdirs($this->curCatDir);
-    foreach($this->GetSubdirs($this->curCatDir) as $path => $name){
-      $div2 ->AddEntry(array( 
-            array("string"=>sprintf($linkopen,base64_encode($path),$name)),
-            array("string"=>preg_replace("/%s/",base64_encode($path),$catupdown.$catremove),
-              "attach"=>"align='right' style='width:80px;border-right:0px;'"))); 
-    }
-
-    /* Create priority & seperator links */
-    $separator ="<hr size=1>"; 
-    if($this->acl_is_writeable("gosaMemberApplication",$this->no_release_acls)){
-      $sep      = "<input type='image' src='images/back.png' title='"._("Insert seperator")."' value='%s' name='AddSep_%s'>";
-      $upudown  = "<a href='?plug=".$_GET['plug']."&amp;act=one_up&amp;id=%s'>".
-                  " <img alt='{t}sort{/t}' align='top' src='images/sort_up.png' title='"._("Move up")."' border=0>".
-                  "</a>&nbsp;".
-                  "<a href='?plug=".$_GET['plug']."&amp;act=one_down&amp;id=%s'>".
-                  " <img alt='{t}sort{/t}' src='images/sort_down.png' title='"._("Move down")."' border=0>".
-                  "</a>&nbsp;".
-                  "<input type='image' src='images/edittrash.png' title='"._("Delete entry")."' name='DelApp_%s' value='%s' alt='{t}delete{/t}' >";
-    }else{
-      $sep      = "";
-      $upudown  = "";
-    }
-     
-    /* Create edit link */ 
-    if($this->acl_is_writeable("gosaApplicationParameter",$this->no_release_acls)){
-      $edit=      "&nbsp;<input type='image' src='images/edit.png' title='"._("Edit entry")."' name='EdiApp_%s' value='%s' alt='{t}edit{/t}' >";
-    }else{
-      $edit=      "";
-    }
-
-    /* Get differences to mark those entries that have changed from last edit. */
-    $Differences = $this->diffAppsInReleases();
-
-    /* Walk through entries an append them to list */
-    if(isset($this->gosaMemberApplication[$this->curCatDir])){
-      foreach($this->gosaMemberApplication[$this->curCatDir] as $cat => $entry){
-
-        /* Add seperator */ 
-        if(preg_match("/__SEPARATOR__/",$entry['App'])){
-          $div2 ->AddEntry(array(array("string"=>$separator),
-                array("string"=>preg_replace("/\%s/",htmlentities($entry['App']),$upudown),"attach"=>"align='right' style='border-right:0px;'")));
-        }else{
-
-          /* Add application */
-
-          $image = "";
-          /* Check if application was available within selected release
-           *  or application list if release management is not active
-           */
-          if(!in_array($entry['App'],$this->AllAppsForRelease)){
-
-            /*  release managent is active
-             */
-            if(!$this->enableReleaseManagement){
-              $image = "<img class='center' alt='R' src='images/select_invalid_application.png' 
-                          title='"._("This application is no longer available.")."'>&nbsp;";
-            }else{
-              $image = "<img class='center' alt='F' src='images/select_invalid_application.png' 
-                          title=\"".sprintf(_("This application is not available in any release named %s."),$this->FAIrelease)."\">&nbsp;";
-            }
-      
-          }elseif(isset($Differences[$entry['App']]) && ($Differences[$entry['App']] == true)) {
-            $entry['App'].=" <i>["._("Check parameter")."]</i>";
-              $image = "<img class='center' src='images/select_invalid_application.png' 
-                          title='"._("This application has changed parameters.")."'>&nbsp;";
-          }else{
-            $image = "<img class='center' src='images/select_application.png' alt=\"\">&nbsp;"; 
-          }
-          
-          $div2->AddEntry(array(array("string"=>sprintf($image."%s",$entry['App'])),
-                array("string"=>preg_replace("/\%s/",htmlentities($entry['App']),$sep.$edit.$upudown),
-                      "attach"=>"align='right' style='width:100px;border-right:0px;'")));
-        }
-      }
-    }
-
-    /* Assign created div lists to template */
-    $smarty->assign("UsedApps", $div2->DrawList());
-    $smarty->assign("List", $div->DrawList());
-    $smarty->assign("apps", $apps);
-   
-    $smarty->assign("enableReleaseManagement",$this->enableReleaseManagement);
-
-    $smarty->assign("ReleaseSelectAble", false);
-    $smarty->assign("Release", $this->FAIrelease);
-    if($this->enableReleaseManagement){
-      $smarty->assign("FAIrelease",  $this->FAIrelease);
-      $smarty->assign("Releases", $this->Releases);
-
-      if(!$this->no_release_acls && count($this->Releases)){
-        $smarty->assign("ReleaseSelectAble", true);
-      }
-    }
-  
-    /* Set acls to  template */
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $acl => $translation){
-      $smarty->assign($acl."ACL",$this->getacl($acl,$this->no_release_acls));
-    }
-
-    /* Show main page */
-    if (is_object($this->dialog)){
-      $smarty->assign("table", $this->table);
-      $display.= $smarty->fetch (get_template_path('application_options.tpl', TRUE,dirname(__FILE__)));
-    } else {
-      $display.= $smarty->fetch (get_template_path('application.tpl', TRUE,dirname(__FILE__)));
-    }
-    
-    return ($display);
-  }
-
-
-  function getReleases()
-  {
-    /* Only display those releases that we are able to read */
-    $dn     = $this->config->current['BASE'];
-    $filter = "(&(objectClass=organizationalUnit)(objectClass=FAIbranch))";
-    $res    = get_list($filter,"application", $dn, array("ou"), GL_SUBSEARCH);
-
-    $ret =array();
-    foreach($res as $attrs){
-      if(preg_match("/ou=apps,/",$attrs['dn'])){
-        $bb     = preg_replace("/ou=apps,.*/","",$attrs['dn']);
-        $parts  = array_reverse(split("ou=",$bb));
-
-        $str ="";
-        foreach($parts as $part){
-          if(empty($part)) {
-            continue;
-          }
-          $str .= str_replace(",","",$part)."/";
-        }    
-        $name = preg_replace("/\/$/","",$str);
-        if(empty($name)) {
-          $name ="/";
-        }
-        $ret[$attrs['dn']] = $name;
-      }
-    }
-    return($ret);
-  }
-
-  function save_object()
-  {
-
-    /* Move category one position up or down */
-    if((isset($_GET['act']))&&(($_GET['act'] == "cat_up")||($_GET['act']=="cat_down"))){
-      if($_GET['act']=="cat_up"){
-        $this->catUp(base64_decode($_GET['id']));
-      }
-      if($_GET['act']=="cat_down"){
-        $this->catDown(base64_decode($_GET['id']));
-      }
-    }
-
-    /* Move application one position up or down */
-    if((isset($_GET['act']))&&(($_GET['act'] == "one_up")||($_GET['act']=="one_down"))){
-      if(isset($_GET['id'])){
-        $id   = $_GET['id'];
-        $act  = $_GET['act']; 
-
-        if($act == "one_up"){
-          $this->getOneUp($id);
-        }elseif($act == "one_down")   { 
-          $this->getOneDown($id);
-        }
-      }
-    }
-
-
-    plugin::save_object();
-  }
-
-  function remove_from_parent()
-  {
-    if(!$this->initially_was_account){
-      return;
-    }
-
-    plugin::remove_from_parent();
-
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd($this->dn);
-    $this->cleanup();
-    
-    $ldap->modify ($this->attrs); 
-    new log("remove","group/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    show_ldap_error($ldap->get_error(), sprintf(_("Removing of groups/applications with dn '%s' failed."),$this->dn));
-
-    /* Optionally execute a command after we're done */
-    $this->handle_post_events("remove");
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    /* Skip saving application settings, if we do not have release acls */
-    if($this->no_release_acls){
-      new log("security","groups/".get_class($this),$this->dn,array(),"Skip saving group application extension. Caused by insufficient acls");
-      
-      return;
-    }
-
-    plugin::save();
-
-
-
-    /* Copy members */
-    $this->Categories[""]=""; 
-    $this->attrs["gosaMemberApplication"]= array();
-    $this->attrs["gosaApplicationParameter"]= array();
-    $cat_id= 0 ;
-    foreach($this->Categories as $name => $cats){
-      $i =0;
-      if(isset($this->gosaMemberApplication[$name])){
-        foreach($this->gosaMemberApplication[$name] as $entry){
-          if(!preg_match("/__SEPARATOR__/",$entry['App'])){
-            $this->attrs["gosaMemberApplication"][]= $entry['App']."|".$name."|".$i;
-            $i ++;
-          }
-        }
-      }
-      if(($i==0)&&(!empty($name))){
-        $this->attrs["gosaMemberApplication"][]= "|".$name."|".$cat_id;
-      }
-      $cat_id++;
-    }
-
-
-
-    /* Are there application parameters to be saved */
-    $this->attrs['gosaApplicationParameter']= array();
-    foreach($this->appoption as $name => $value){
-      if ($value != ""){
-        $this->attrs['gosaApplicationParameter'][]= "$name:$value";
-      }
-    }
-
-    /* Write back to LDAP */
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd($this->dn);
-    $this->cleanup();
-    $ldap->modify ($this->attrs); 
-
-    if($this->initially_was_account){
-      new log("modify","group/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }else{
-      new log("create","group/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); 
-    }   
-
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of groups/applications 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 check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    return ($message);
-  }
-
-
-  function reload()
-  {
-    /* Generate applist */
-    $this->apps= array();
-
-    /* Special handling for release managed apps */
-    $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
-    if(!empty($tmp) && count($this->Releases)){
-      $this->enableReleaseManagement = true;
-
-      /* Check if release is available */
-      $tmp = array_flip($this->Releases);
-      if(isset($tmp[$this->FAIrelease])){
-        $base =  $tmp[$this->FAIrelease];
-      }else{
-
-        /* Release is not available, check if there is an alternative */
-        $old_r =  $this->FAIrelease;
-        $k = key($tmp);
-
-        if(isset($tmp[$k])){
-      
-          /* We have found an alternative release name */
-          $r = $tmp[$k];
-          $this->FAIrelease = $k;
-          $base = $r; 
-
-          /* Display msg */
-          if(!(!$this->initially_was_account && $old_r =="/")){
-            print_red(sprintf(_("Can't resolve the release name '%s', setting release name to '%s'. Possibly the objects base has changed."),$old_r,$k));   
-          }
-        }else{
-          
-          /* There are no releases available ... */
-          print_red(_("There are no releases available. You will not be able to select another release."));
-          return;
-        }
-      }
-
-      /* Get applications for this release */
-      $base = preg_replace("/ou=apps,.*$/","ou=apps,".$this->curbase,$base);
-      $res = get_list("(objectClass=gosaApplication)","application",$base,array("*"));
-    }else{
-    
-      /* Get applications for this base */
-      $res = get_list("(objectClass=gosaApplication)","application","ou=apps,".$this->curbase,array("*"));
-    }
-    
-    /* Append applications */
-    foreach($res as $attrs){
-      if (isset($attrs["description"][0])){    
-        $this->apps[$attrs["cn"][0]]=
-          $attrs["cn"][0]." (".
-          $attrs["description"][0].")";
-      } else {
-        $this->apps[$attrs["cn"][0]]=
-          $attrs["cn"][0];
-      }
-    }
-
-    /* Get all apps ... */
-    $res = get_list("objectClass=gosaApplication","application",$this->config->current['BASE'],array("gosaApplicationParameter","cn"),GL_SUBSEARCH); 
-    $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
-    $this->AllAppsForRelease = array();
-    if(!empty($tmp)){
-      $tmp = array_flip($this->Releases);
-      foreach($res as $attrs){
-        
-        $testdn = preg_replace("/ou=apps,.*$/","ou=apps",$attrs['dn']);
-        $testdn = preg_replace("/^[^,]+/","",$testdn);
-        $testdn = preg_replace("/^,/","",$testdn);
-
-        if($testdn == preg_replace("/ou=apps,.*$/","ou=apps",$tmp[$this->FAIrelease])){
-          $this->AllAppsForRelease[$attrs['dn']] = $attrs['cn'][0];
-          $this->AllAppsForReleaseParameter[$this->FAIrelease][$attrs['cn'][0]] = $attrs;
-        }
-      }
-    }else{
-      foreach($res as $attrs){
-        $this->AllAppsForRelease[$attrs['dn']] = $attrs['cn'][0];
-      }
-    }
-
-    natcasesort ($this->apps);
-    reset ($this->apps);
-
-    if(is_array($this->gosaMemberApplication))
-      foreach ($this->gosaMemberApplication as $cat){   
-        if(is_array($cat))
-          foreach($cat as $entry){
-            $this->used_apps[$entry['App']]= $entry['App'];
-          }
-      }
-  }
-
-
-  function addApp($cn)
-  {
-    if((isset($this->gosaMemberApplication[$this->curCatDir]))&&(is_array($this->gosaMemberApplication[$this->curCatDir]))){
-      foreach($this->gosaMemberApplication[$this->curCatDir] as $entry){
-        if($entry['App'] == $cn) return;
-      }
-    }
-    $this->gosaMemberApplication[$this->curCatDir][]= array("App"=>$cn);
-    $this->used_apps[$cn]=$cn;
-    $this->is_modified= TRUE;
-  }
-
-
-  function removeApp($cn)
-  {
-    $temp= array();
-    foreach ($this->gosaMemberApplication as $value){
-      if ($value != $cn){
-        $temp[]= $value;
-      }
-    }
-    $this->gosaMemberApplication= $temp;
-    $this->is_modified= TRUE;
-  }
-
-  function getParameters($app)
-  {
-    $tmp = $this->getReleases();
-    $ret = array();
-    if(in_array($this->FAIrelease,$tmp)){
-      $tmp2 = array_flip($tmp);
-      $base = $tmp2[$this->FAIrelease];
-      $ldap = $this->config->get_ldap_link();
-      $ldap->cd($this->config->current['BASE']);
-      $ldap->search("(&(objectClass=gosaApplication)(cn=".$app.")(gosaApplicationParameter=*))",array("gosaApplicationParameter"));
-      if($ldap->count()){
-        $attrs = $ldap->fetch();
-        for($i = 0 ; $i < $attrs['gosaApplicationParameter']['count'] ; $i ++ ){
-          $name = preg_replace("/:.*$/","",$attrs['gosaApplicationParameter'][$i]);
-          $ret[$name] = $name;
-        } 
-      }
-    }
-    return($ret);
-  }
-
-  function GetSubdirs($dir)
-  {
-    $ret = array();
-    $tmp1 = split("/",$this->curCatDir);
-    foreach($this->Categories as $path=>$cat){
-      $tmp2 = split("/",$path);
-      
-      if((empty($this->curCatDir))&&(!preg_match("/\//",$path))){
-        $abort = false;
-      }elseif(((count($tmp1))+1) == (count($tmp2))){
-        $abort = false;
-        for($i = 0 ; $i < count($tmp1) ; $i++){
-          if($tmp1[$i] != $tmp2[$i]){
-            $abort = true;
-          }
-        }
-      }else{
-        $abort= true;
-      }
-      if(!$abort){
-        $ret[$path]=$cat;
-      } 
-    }
-    return($ret);
-  }
-
-
-  function PrepareForCopyPaste($source)
-  {
-    $s = new appgroup($this->config,$source['dn']);
-    $this->FAIrelease = $this->InitialFAIrelease = $s->FAIrelease;
-    $this->gosaMemberApplication = $s->gosaMemberApplication;
-    $this->appoption = $s->appoption;
-    $this->Categories = $s->Categories;
-  }
-
-
-  /* Return plugin informations for acl handling  */ 
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("Applications"),
-          "plDescription" => _("Group applications"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 0,
-          "plSection"     => array("admin"),
-          "plCategory"    => array("groups"),
-          "plProvidedAcls"=> array(
-            "gosaMemberApplication"     => _("Application"),
-            "FAIrelease"                => _("Release"),
-            "gosaApplicationParameter"  => _("Application parameter"))
-          ));
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/groups/class_groupGeneric.inc b/plugins/admin/groups/class_groupGeneric.inc
deleted file mode 100644 (file)
index 095d3be..0000000
+++ /dev/null
@@ -1,978 +0,0 @@
-<?php
-
-class group extends plugin
-{
-  /* CLI vars */
-  var $cli_summary= "Handling of GOsa's base group object";
-  var $cli_description= "Some longer text\nfor help";
-  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* Group attributes */
-  var $cn= "";
-  var $description= "";
-  var $gidNumber= "";
-  var $memberUid= array();
-
-  /* Helpers */
-  var $base= "";
-  var $force_gid= FALSE;
-  var $fon_group= FALSE;
-  var $smbgroup= FALSE;
-  var $groupType= FALSE;
-  var $samba3= FALSE;
-  var $sambaSID= "";
-  var $sambaDomainName= "DEFAULT";
-  var $SID= "";
-  var $ridBase= 0;
-  var $members= array();
-  var $users= array();
-  var $member= array();
-  var $allusers= array();
-  var $saved_gidNumber= "";
-  var $oldgroupType= "";
-  var $orig_dn= "";
-  var $orig_cn= "";
-  var $has_mailAccount= FALSE;
-  var $group_dialog= FALSE;
-  var $nagios_group =FALSE;
-  var $sambaGroupType;
-  var $dialog;
-  var $rfc2307bis= FALSE;
-  var $OnlyShowFirstEntries =200;
-  var $dnMapping= array();
-  var $view_logged = FALSE;
-  var $allowGroupsWithSameNameInOtherSubtrees = true;
-
-  /* attribute list for save action */
-  var $attributes= array("cn", "description", "gidNumber","memberUid","sambaGroupType","sambaSID");
-  var $objectclasses= array("top", "posixGroup");
-
-  var $CopyPasteVars  = array("force_gid","fon_group","smbgroup","groupType","sambaSID","sambaDomainName","SID","nagios_group","sambaGroupType");
-
-  function group (&$config, $dn= NULL)
-  {
-     /* Set rfc2307bis flag */
-     if (isset($config->current['RFC2307BIS']) && ($config->current['RFC2307BIS']== "true")){
-       $this->rfc2307bis= TRUE;
-       $this->attributes[]= "member";
-       $this->objectclasses[]= "groupOfNames";
-     }
-
-    plugin::plugin ($config, $dn);
-
-    /* Load attributes depending on the samba version */
-    $this->samba3= ($config->current['SAMBAVERSION'] == 3);
-    $this->orig_dn= $dn;
-    $this->orig_cn= $this->cn;
-
-    /* Get member list */
-    if (isset($this->attrs['memberUid'][0])){
-      $tmp= array();
-      for ($i= 0; $i<$this->attrs['memberUid']['count']; $i++){
-        $tmp[]= $this->attrs['memberUid'][$i];
-      }
-      $this->memberUid= $tmp;
-      sort ($this->memberUid);
-    }
-
-    /* Save gidNumber for later use */
-    if (isset($this->attrs['gidNumber'])){
-      $this->saved_gidNumber= $this->attrs['gidNumber'][0];
-    }
-
-    /* Is a samba group? */
-    if (isset($this->attrs['objectClass'])){
-      if (array_search ('sambaGroupMapping', $this->attrs['objectClass']) == FALSE ){
-        $this->smbgroup= FALSE;
-      } else {
-        $this->smbgroup= TRUE;
-        if (isset($this->attrs['sambaSID'])){
-          $this->sambaSID= $this->attrs['sambaSID'][0];
-        }
-      }
-      if (array_search ('goFonPickupGroup', $this->attrs['objectClass']) == FALSE ){
-        $this->fon_group= FALSE;
-      } else {
-        $this->fon_group= TRUE;
-      }
-      if (array_search ('nagiosContactGroup', $this->attrs['objectClass']) == FALSE ){
-        $this->nagios_group= FALSE;
-      } else {
-        $this->nagios_group= TRUE;
-      }
-    }
-
-    /* Set mail flag */
-    if (isset($this->attrs['objectClass']) && in_array('gosaMailAccount', $this->attrs['objectClass'])){
-      $this->has_mailAccount= TRUE;
-    }
-
-    /* Get samba Domain in case of samba 3 */
-    if ($this->samba3 && $this->sambaSID != ""){
-      $this->SID= preg_replace ("/-[^-]+$/", "", $this->sambaSID);
-      $ldap= $this->config->get_ldap_link();
-      $ldap->cd($this->config->current['BASE']);
-      $ldap->search ("(&(objectClass=sambaDomain)(sambaSID=$this->SID))",array("sambaAlgorithmicRidBase"));
-      if ($ldap->count() != 0){
-        $attrs= $ldap->fetch();
-        $this->ridBase= $attrs['sambaAlgorithmicRidBase'][0];
-
-        /* Get domain name for SID */
-        $this->sambaDomainName= "DEFAULT";
-        foreach ($this->config->data['SERVERS']['SAMBA'] as $key => $val){
-          if ($val['SID'] == $this->SID){
-            $this->sambaDomainName= $key;
-            break;
-          }
-        }
-      } else {
-        if (isset($this->config->current['RIDBASE'])){
-          $this->sambaDomainName= "DEFAULT";
-          $this->ridBase= $this->config->current['RIDBASE'];
-          $this->SID= $this->config->current['SID'];
-        } else {
-          print_red(_("Can't find this groups SID in LDAP or in your configuration file!"));
-        }
-      }
-
-      /* Get group type */
-      $this->groupType= (int)substr(strrchr($this->sambaSID, "-"), 1);
-      if ($this->groupType < 500 || $this->groupType > 553){
-        $this->groupType= 0;
-      }
-      $this->oldgroupType= $this->groupType;
-    }
-
-    /* Get global filter config */
-    if (!is_global("gufilter")){
-      $ui= get_userinfo();
-      $base= get_base_from_people($ui->dn);
-      $gufilter= array( "dselect"       => $base,
-          "regex"           => "*");
-      register_global("gufilter", $gufilter);
-    }
-    $gufilter= get_global('gufilter');
-
-    $gufilter['SubSearchGroup'] = false;
-    $gufilter['dselect'] = $_SESSION['gufilter']['dselect'];  
-
-    register_global('gufilter',$gufilter);
-  
-    if ($this->dn == "new"){
-      if(isset($_SESSION['CurrentMainBase'])){
-        $this->base= $_SESSION['CurrentMainBase'];
-      }else{
-        $ui= get_userinfo();
-        $this->base= dn2base($ui->dn);
-      }
-    } else {
-
-      /* Get object base */
-      $this->base =preg_replace ("/^[^,]+,".normalizePreg(get_groups_ou())."/","",$this->dn);
-    }
-
-    /* This is always an account */
-    $this->is_account= TRUE;
-    $this->reload();
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* Log view */
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","groups/".get_class($this),$this->dn);
-    }
-
-    /* Do we represent a valid group? */
-    if (!$this->is_account && $this->parent === NULL){
-      $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\">&nbsp;<b>".
-        _("This 'dn' is no group.")."</b>";
-      return ($display);
-    }
-
-    /* Delete user from group */
-    if (isset($_POST['del_users']) && isset($_POST['members'])){
-      foreach ($_POST['members'] as $value){
-        unset ($this->members["$value"]);
-        $this->removeUser($value);
-      }
-      $this->reload();
-    }
-
-    /* Add objects? */
-    if (isset($_POST["edit_membership"])){
-      $this->group_dialog= TRUE;
-      $this->dialog= TRUE;
-    }
-
-    /* Add objects finished? */
-    if (isset($_POST["add_users_finish"]) || isset($_POST["add_users_cancel"])){
-      $this->group_dialog= FALSE;
-      $this->dialog= FALSE;
-    }
-
-    /* Add user to group */
-    if (isset($_POST['add_users_finish']) && isset($_POST['users'])){
-      foreach ($_POST['users'] as $value){
-        $this->members["$value"]= $this->allusers[$value];
-        asort($this->members);
-        $this->addUser($value);
-      }
-      $this->reload();
-    }
-
-    /* Base select dialog */
-    $once = true;
-    foreach($_POST as $name => $value){
-      if((preg_match("/^chooseBase/",$name) && $once) && ($this->acl_is_moveable())){
-          
-        $once = false;
-        $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
-        $this->dialog->setCurrentBase($this->base);
-      }
-    }
-
-    /* Dialog handling */
-    if(is_object($this->dialog)){
-      /* Must be called before save_object */
-      $this->dialog->save_object();
-
-      if($this->dialog->isClosed()){
-        $this->dialog = false;
-      }elseif($this->dialog->isSelected()){
-
-        /* Check if selected base is valid */
-        $tmp = $this->get_allowed_bases();
-        if(isset($tmp[$this->dialog->isSelected()])){
-          $this->base = $this->dialog->isSelected();
-        }
-        $this->dialog= false;
-      }else{
-        return($this->dialog->execute());
-      }
-    }
-
-   /* Assign templating stuff */
-    $smarty= get_smarty();
-    if ($this->samba3){
-      $smarty->assign("samba3", "true");
-    } else {
-      $smarty->assign("samba3", "");
-    }
-
-    if($this->config->search("nagiosaccount", "CLASS",array('menu'))){
-      $smarty->assign("nagios",true);
-    }else{
-      $smarty->assign("nagios",false);
-    }
-    
-    if($this->config->search("phoneAccount", "CLASS",array('menu'))){
-      $smarty->assign("pickupGroup",true);
-    }else{
-      $smarty->assign("pickupGroup",false);
-    }
-
-    /* Manage object add dialog */
-    if ($this->group_dialog){
-
-      /* Save data */
-      $gufilter= get_global("gufilter");
-      foreach( array("dselect", "regex") as $type){
-        if (isset($_POST[$type])){
-          $gufilter[$type]= $_POST[$type];
-        }
-      }
-      if(isset($_POST['regex'])){
-        if(isset($_POST['SubSearchGroup'])){
-          $gufilter['SubSearchGroup'] = true;
-        }else{
-          $gufilter['SubSearchGroup'] = false;
-        }
-      }
-
-      if (isset($_GET['search'])){
-        $s= mb_substr($_GET['search'], 0, 1, "UTF8")."*";
-        if ($s == "**"){
-          $s= "*";
-        }
-        $gufilter['regex']= $s;
-      }
-      register_global("gufilter", $gufilter);
-      $this->reload();
-
-      /* Show dialog */
-      $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("deplist", $this->get_allowed_bases("users/user"));
-      $smarty->assign("alphabet", generate_alphabet());
-      foreach( array("dselect", "regex","SubSearchGroup") as $type){
-        $smarty->assign("$type", $gufilter[$type]);
-      }
-      $smarty->assign("hint", print_sizelimit_warning());
-      $smarty->assign("users", $this->displayUsers);
-      $smarty->assign("apply", apply_filter());
-      $display= $smarty->fetch (get_template_path('group_objects.tpl', TRUE, dirname(__FILE__)));
-      return ($display);
-    }
-
-    $smarty->assign("bases", $this->get_allowed_bases());
-    $smarty->assign("base_select", $this->base);
-
-    if ($this->samba3){
-      $domains= array();
-      foreach($this->config->data['SERVERS']['SAMBA'] as $name => $content){
-        $domains[$name]= $name;
-      }
-      $smarty->assign("sambaDomains", $domains);
-      $smarty->assign("sambaDomainName", $this->sambaDomainName);
-      $groupTypes= array(0 => _("Samba group"), 512 => _("Domain admins"), 513 => _("Domain users"),
-          514 => _("Domain guests"));
-
-      /* Don't loose special groups! If not key'ed above, add it to
-         the combo box... */   
-      if ($this->groupType >= 500 && $this->groupType <= 553 && !isset($groupTypes[$this->groupType])){
-        $groupTypes[$this->groupType]= sprintf(_("Special group (%d)"), $this->groupType);
-      }
-
-      $smarty->assign("groupTypes", $groupTypes);
-      $smarty->assign("groupType", $this->groupType);
-    }
-
-    /* Members and users */
-    $smarty->assign("members", $this->members);
-
-    /* Checkboxes */
-    foreach (array("force_gid", "smbgroup") as $val){
-      if ($this->$val == "1"){
-        $smarty->assign("$val", "checked");
-      } else {
-        $smarty->assign("$val", "");
-      }
-    }
-    if ($this->force_gid != "1"){
-      $smarty->assign("forceMode", "disabled");
-    }else{
-      $smarty->assign("forceMode", "");
-    }
-    if ($this->fon_group){
-      $smarty->assign("fon_group", "checked");
-    } else {
-      $smarty->assign("fon_group", "");
-    }
-
-    if ($this->nagios_group){
-      $smarty->assign("nagios_group", "checked");
-    } else {
-      $smarty->assign("nagios_group", "");
-    }
-
-    /* Fields */
-    foreach (array("cn", "description", "gidNumber") as $val){
-      $smarty->assign("$val", $this->$val);
-    }
-
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translation){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-    
-    if($this->acl_is_writeable("base")){
-      $smarty->assign("baseSelect",true);
-    }else{
-      $smarty->assign("baseSelect",false);
-    }
-
-    /* Show main page */
-    $smarty->assign("alphabet", generate_alphabet(10));
-    $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("deplist", $this->config->idepartments);
-    return($smarty->fetch (get_template_path('generic.tpl', TRUE)));
-  }
-
-  function addUser($uid)
-  {
-    $this->memberUid[]= $uid;
-    $this->memberUid= array_unique($this->memberUid);
-  }
-
-  function removeUser($uid)
-  {
-    $temp= array();
-    foreach ($this->memberUid as $value){
-      if ($value != $uid){
-        $temp[]= $value;
-      }
-    }
-    $this->memberUid= $temp;
-  }
-
-
-  /* Reload data */
-  function reload()
-  {
-    /* Fix regex string */
-    $gufilter = get_global("gufilter");
-    $regex    = normalizeLdap($gufilter['regex']);
-    $MaxUser  = $this->OnlyShowFirstEntries;
-
-    /* Prepare ldap link */
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd($gufilter['dselect']);
-
-
-    /* Resolve still unresolved memberuids to fill the list with sn/giveName attributes 
-        (Store gathered sn/givenName informations in $this->allusers too, 
-         to be prepared when adding/deleting users)
-     */    
-    $filter = "";
-    foreach ($this->memberUid as $value){
-      if(!isset($this->members[$value])){
-        $filter .= "(uid=".normalizeLdap($value).")";
-      }
-    }
-    if(!empty($filter)){    
-      $ldap->cd($this->config->current['BASE']);
-      $ldap->search("(&(objectClass=gosaAccount)(!(objectClass=gosaUserTemplate))(|".$filter."))",array("dn", "uid","sn","givenName"));
-      while($attrs = $ldap->fetch()){
-        $this->dnMapping[$attrs['uid'][0]] = $attrs['dn'];
-        $this->members[$attrs['uid'][0]] = $this->createResultName($attrs);
-        $this->allusers[$attrs['uid'][0]]= $this->createResultName($attrs);
-      } 
-    }
-  
-    /* check if all uids are resolved */
-    foreach ($this->memberUid as $value){
-      if(!isset($this->members[$value])){
-        $this->members[$value] =  _("! unknown id")." [".$value."]"; 
-      }
-    }  
-
-    /* Create display list of users matching regex & filter 
-     */
-    $this->displayUsers = array();
-    $filter = "(&(objectClass=gosaAccount)(!(objectClass=gosaUserTemplate))(!(uid=*$))(|(uid=".$regex.")(sn=".$regex.")(givenName=".$regex.")))";
-
-    /* Search in current tree or within subtrees depending on the checkbox from filter section */
-    if($gufilter['SubSearchGroup']){
-      $flag = GL_SIZELIMIT | GL_SUBSEARCH;
-      $base = $gufilter['dselect'];
-    }else{
-      $flag = GL_SIZELIMIT ;
-      $base = get_people_ou().$gufilter['dselect'];
-    }
-    $i = 0;
-  
-
-    $res = get_list($filter,"users",$base,array("dn", "uid", "sn", "givenName"),$flag);
-
-    /* Fetch all users and skip already used users */
-    foreach($res as $attrs){
-      if(in_array($attrs['uid'][0], $this->memberUid)) {
-        continue;
-      }
-      $i ++;
-      if($i > $MaxUser) {
-        break;
-      }
-      $this->dnMapping[$attrs['uid'][0]]= $attrs["dn"];
-      $this->allusers[$attrs['uid'][0]]     = $this->createResultName($attrs);
-      $this->displayUsers[$attrs['uid'][0]] = $this->createResultName($attrs);
-    }
-  
-    /* If more than max users are found, display a message to warn the user */
-    if(($i == $MaxUser)){
-      print_red(sprintf(_("Your search method returned more than '%s' users, only '%s' users are shown.") , $MaxUser,$MaxUser));
-    }
-    
-    /* Sort lists */
-    natcasesort($this->members);
-    reset($this->members);
-    natcasesort ($this->displayUsers);
-    reset ($this->displayUsers);
-  }
-
-
-  /* Create display name, this was used so often that it is excluded into a seperate function */
-  function createResultName($attrs)
-  {
-    if (isset($attrs["givenName"][0]) && isset($attrs["sn"][0])){
-      $ret =  $attrs["sn"][0].", ".$attrs["givenName"][0]." [".$attrs["uid"][0]."]";
-    } else {
-      $ret= $attrs['uid'][0];
-    }
-    return($ret);
-  }
-
-
-  function remove_from_parent()
-  {
-    plugin::remove_from_parent();
-
-    $ldap= $this->config->get_ldap_link();
-    $ldap->rmdir($this->dn);
-    show_ldap_error($ldap->get_error(), sprintf(_("Removing of groups/generic with dn '%s' failed."),$this->dn));
-
-    new log("remove","groups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-
-    /* Delete references to object groups */
-    $ldap->cd ($this->config->current['BASE']);
-    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
-    while ($ldap->fetch()){
-      $og= new ogroup($this->config, $ldap->getDN());
-      unset($og->member[$this->dn]);
-      $og->save ();
-    }
-
-    /* Remove ACL dependencies too,
-     */
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(&(objectClass=gosaAcl)(gosaAclEntry=*".base64_encode($this->dn)."*))",array("gosaAclEntry","dn"));
-    while($attrs = $ldap->fetch()){
-      $acl = new acl($this->config,$this->parent,$attrs['dn']);
-      foreach($acl->gosaAclEntry as $id => $entry){
-        foreach($entry['members'] as $m_id => $member){
-          if($m_id == "G:".$this->dn || $m_id == "U:".$this->dn){
-            unset($acl->gosaAclEntry[$id]['members'][$m_id]);
-            gosa_log("modify","groups/acl",$attrs['dn'],array(),sprintf("Removed acl for %s on object %s.",$this->dn,$attrs['dn']));
-          }
-        }
-      }
-      $acl -> save();
-    }
-
-    /* Remove ACL dependencies too,
-     */
-    $tmp = new acl($this->config,$this->parent,$this->dn);
-    $tmp->remove_acl();
-
-    /* Send signal to the world that we've done */
-    $this->handle_post_events("remove");
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    /* Save additional values for possible next step */
-    if (isset($_POST['groupedit'])){
-
-      /* Create a base backup and reset the 
-          base directly after calling plugin::save_object();  
-         Base will be set seperatly a few lines below */
-      $base_tmp = $this->base;
-      plugin::save_object();
-      $this->base = $base_tmp;
-
-      $this->force_gid= 0;
-
-      /* Only reset sambagroup flag if we are able to write this flag */
-      if($this->acl_is_writeable("sambaGroupType")){
-        $this->smbgroup = 0;
-      }
-
-      /* Get base selection */
-      if(isset($_POST['base'])){
-        $tmp = $this->get_allowed_bases();
-        if(isset($tmp[$_POST['base']])){
-          $this->base = $_POST['base'];
-        }
-      }
-
-      foreach (array(
-            "force_gid"  => "gidNumber", 
-            "smbgroup"   => "sambaGroupType") as $val => $aclname) {
-        if ($this->acl_is_writeable($aclname)  && isset($_POST["$val"])){
-          $this->$val= $_POST["$val"];
-        }
-      }
-
-      /* Save sambaDomain attribute */
-      if ($this->acl_is_writeable("sambaDomainName") && $this->samba3 && isset ($_POST['sambaDomainName'])){
-        $this->sambaDomainName= $_POST['sambaDomainName'];
-        $this->groupType= $_POST['groupType'];
-      }
-
-      /* Save fon attribute */
-      if ($this->acl_is_writeable("fon_group")){
-        if (isset ($_POST['fon_group'])){
-          $this->fon_group= TRUE;
-        } else {
-          $this->fon_group= FALSE;
-        }
-      }
-      if ($this->acl_is_writeable("nagios_group")){
-        if (isset ($_POST['nagios_group'])){
-          $this->nagios_group= TRUE;
-        } else {
-          $this->nagios_group= FALSE;
-        }
-      }
-    }
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-
-    /* ID handling */
-    if ($this->force_gid == 0){
-      if ($this->saved_gidNumber != ""){
-        $this->gidNumber= $this->saved_gidNumber;
-      } else {
-        /* Calculate new, lock uids */
-        $wait= 10;
-        while (get_lock("uidnumber") != ""){
-          sleep (1);
-
-          /* timed out? */
-          if ($wait-- == 0){
-            break;
-          }
-        }
-        add_lock ("uidnumber", "gosa");
-        $this->gidNumber= $this->get_next_id("gidNumber", $this->dn);
-      }
-    }
-  
-    plugin::save(); 
-
-    /* Remove objectClass for samba/phone support */
-    $tmp= array();
-    for ($i= 0; $i<count($this->attrs["objectClass"]); $i++){
-      if ($this->attrs['objectClass'][$i] != 'sambaGroupMapping' &&
-          $this->attrs['objectClass'][$i] != 'sambaIdmapEntry' &&
-          $this->attrs['objectClass'][$i] != 'goFonPickupGroup' &&
-        $this->attrs['objectClass'][$i] != 'nagiosContactGroup'){
-        $tmp[]= $this->attrs['objectClass'][$i];
-      }
-    }
-    $this->attrs['objectClass']= $tmp;
-    $ldap= $this->config->get_ldap_link();
-
-    /* Add samba group functionality */
-    if ($this->samba3 && $this->smbgroup){
-  
-      /* Fixed undefined index ... 
-       */ 
-      $this->SID = $this->ridBase = "";
-      if(isset($this->config->data['SERVERS']['SAMBA'][$this->sambaDomainName]['SID'])){
-        $this->SID    = $this->config->data['SERVERS']['SAMBA'][$this->sambaDomainName]['SID'];
-      }else{
-        print_red(sprintf(_("No configured SID found for '%s'."),$this->sambaDomainName));
-      }
-      if(isset($this->config->data['SERVERS']['SAMBA'][$this->sambaDomainName]['RIDBASE'])){
-        $this->ridBase= $this->config->data['SERVERS']['SAMBA'][$this->sambaDomainName]['RIDBASE']; 
-      }else{
-        print_red(sprintf(_("No configured RIDBASE found for '%s'."),$this->sambaDomainName));
-      }
-
-      $this->attrs['objectClass'][]= 'sambaGroupMapping';
-      $this->attrs['sambaGroupType']= "2";
-
-      /* Check if we need to create a special entry */
-      if ($this->groupType == 0){
-
-        if ($this->sambaSID == "" || $this->oldgroupType != $this->groupType){
-          $gidNumber= $this->gidNumber;
-          while(TRUE){
-            $sid= $this->SID."-".($gidNumber*2 + $this->ridBase+1);
-            $ldap->cd($this->config->current['BASE']);
-            $ldap->search("(sambaSID=$sid)",array("sambaSID"));
-            if ($ldap->count() == 0){
-              break;
-            }
-            $gidNumber++;
-          }
-          $this->attrs['sambaSID']= $sid;
-          $this->sambaSID= $sid;
-        }
-
-      } else {
-        $this->attrs['sambaSID']=$this->SID."-".$this->groupType;
-      }
-
-      /* User wants me to fake the idMappings? This is useful for
-         making winbind resolve the group names in a reasonable amount
-         of time in combination with larger databases. */
-      if (isset($this->config->current['SAMBAIDMAPPING']) &&
-          preg_match('/true/i', $this->config->current['SAMBAIDMAPPING'])){
-        $this->attrs['objectClass'][]= "sambaIdmapEntry";
-      }
-
-    }
-
-    /* Add phone functionality */
-    if ($this->fon_group){
-      $this->attrs['objectClass'][]= "goFonPickupGroup";
-    }
-
-    /* Add nagios functionality */
-    if ($this->nagios_group){
-      $this->attrs['objectClass'][]= "nagiosContactGroup";
-    }
-
-    /* Take members array */
-    if (count ($this->memberUid)){
-      $this->attrs['memberUid']= array_unique($this->memberUid);
-    }
-
-    /* New accounts need proper 'dn', propagate it to remaining objects */
-    if ($this->dn == 'new'){
-      $this->dn= 'cn='.$this->cn.','.get_groups_ou().$this->base;
-    }
-
-    /* Add member dn's for RFC2307bis Support */
-    if ($this->rfc2307bis){
-      if (count($this->memberUid)){
-        $this->attrs['member'] = array();
-        foreach($this->attrs['memberUid'] as $uid) {
-          $this->attrs['member'][]= $this->dnMapping[$uid];
-        }
-      } else {
-        $this->attrs['member'][]= $this->dn;
-      }
-    }
-
-    /* Save data. Using 'modify' implies that the entry is already present, use 'add' for
-       new entries. So do a check first... */
-    $ldap->cat ($this->dn, array('dn'));
-    if ($ldap->fetch()){
-      /* Modify needs array() to remove values :-( */
-      if (!count ($this->memberUid)){
-        $this->attrs['memberUid']= array();
-      }
-      if ($this->samba3){
-        if (!$this->smbgroup){
-          $this->attrs['sambaGroupType']= array();
-          $this->attrs['sambaSID']= array();
-        }
-      }
-      $mode= "modify";
-    } else {
-      $mode= "add";
-      $ldap->cd($this->config->current['BASE']);
-      $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
-    }
-
-    /* Write back to ldap */
-    $ldap->cd($this->dn);
-    $this->cleanup();
-    $ldap->$mode($this->attrs);
-
-    /* Remove ACL dependencies too,
-     */
-    if($this->dn != $this->orig_dn && $this->orig_dn != "new"){
-      $tmp = new acl($this->config,$this->parent,$this->dn);
-      $tmp->update_acl_membership($this->orig_dn,$this->dn);
-    }
-
-    if($this->initially_was_account){
-      new log("modify","groups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }else{
-      new log("create","groups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }
-
-    $ret= 0;
-    if ( show_ldap_error($ldap->get_error(), sprintf(_("Removing of groups/generic with dn '%s' failed."),$this->dn))){
-      $ret= 1;
-    }
-
-    /* Remove uid lock */
-    del_lock ("uidnumber");
-
-    /* Post that we've done*/
-    $this->handle_post_events($mode);
-
-    return ($ret);
-  }
-
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    /* Permissions for that base? */
-    if ($this->base != ""){
-      $new_dn= 'cn='.$this->cn.','.get_groups_ou().$this->base;
-    } else {
-      $new_dn= $this->dn;
-    }
-
-    /* must: cn */
-    if ($this->cn == "" && $this->acl_is_writeable("cn")){
-      $message[]= "The required field 'Name' is not set.";
-    }
-
-    /* Check for valid input */
-    if (!is_uid($this->cn)){
-      $message[]= _("The field 'Name' contains invalid characters. Lowercase, numbers and dashes are allowed.");
-    }
-
-    if($this->allowGroupsWithSameNameInOtherSubtrees == true){
-
-      /* Check for used 'cn' */
-      $ldap= $this->config->get_ldap_link();
-      if(($this->cn  != $this->orig_cn) || ($this->orig_dn == "new")){
-        $ldap->cd("ou=groups,".$this->base);
-        $ldap->ls("(&(|(objectClass=gosaGroupOfNames)(objectClass=posixGroup))(cn=$this->cn))",get_groups_ou().$this->base,array("cn"));
-        if ($ldap->count() != 0){
-          $message[]= _("Value specified as 'Name' is already used.");
-        }
-      }
-
-    }else{
-
-      /* Check for used 'cn' */
-      $ldap= $this->config->get_ldap_link();
-      $ldap->cd($this->config->current['BASE']);
-      $ldap->search("(&(|(objectClass=gosaGroupOfNames)(objectClass=posixGroup))(cn=$this->cn))",array("cn"));
-      if ($ldap->count() != 0){
-
-        /* New entry? */
-        if ($this->dn == 'new'){
-          $message[]= _("Value specified as 'Name' is already used.");
-        }
-
-        /* Moved? */
-        elseif ($new_dn != $this->orig_dn){
-          $ldap->fetch();
-          if ($ldap->getDN() != $this->orig_dn){
-            $message[]= _("Value specified as 'Name' is already used.");
-          }
-        }
-      }
-    }
-     
-    /* Check ID */
-    if ($this->force_gid == "1"){
-      if (!is_id($this->gidNumber)){
-        $message[]= _("Value specified as 'GID' is not valid.");
-      } else {
-        if ($this->gidNumber < $this->config->current['MINID']){
-          $message[]= _("Value specified as 'GID' is too small.");
-        }
-
-      }
-    }
-
-    return ($message);
-  }
-
-  function get_next_id($attrib, $dn)
-  {
-    $ids= array();
-    $ldap= $this->config->get_ldap_link();
-
-    $ldap->cd ($this->config->current['BASE']);
-    if (preg_match('/gidNumber/i', $attrib)){
-      $oc= "posixGroup";
-    } else {
-      $oc= "posixAccount";
-    }
-    $ldap->search ("(&(objectClass=$oc)($attrib=*))", array("$attrib"));
-
-    /* Get list of ids */
-    while ($attrs= $ldap->fetch()){
-      $ids[]= (int)$attrs["$attrib"][0];
-    }
-
-    /* Find out next free id near to UID_BASE */
-    if (!isset($this->config->current['BASE_HOOK'])){
-      $base= $this->config->current['UIDBASE'];
-    } else {
-      /* Call base hook */
-      $base= get_base_from_hook($dn, $attrib);
-    }
-    for ($id= $base; $id++; $id < pow(2,32)){
-      if (!in_array($id, $ids)){
-        return ($id);
-      }
-    }
-
-    /* Check if id reached maximum */
-    if ($id >= pow(2,32)){
-      print_red(_("Too many users, can't allocate a free ID!"));
-      exit;
-    }
-  }
-
-  function getCopyDialog()
-  {
-    $vars = array("cn");
-  
-    if($this ->force_gid){
-      $used = " checked ";
-      $dis  = "";
-    }else{
-      $used = "";
-      $dis  = " disabled ";
-    }
-
-    $smarty = get_smarty();
-    $smarty->assign("used",$used);
-    $smarty->assign("dis" ,$dis);
-    $smarty->assign("cn" ,$this->cn);
-    $smarty->assign("gidNumber",$this->gidNumber);
-    $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE));
-    $ret = array();
-    $ret['string'] = $str;
-    $ret['status'] = "";
-    return($ret);
-  }
-
-  function saveCopyDialog()
-  {
-    if(isset($_POST['cn'])){
-      $this->cn = $_POST['cn'];
-    }
-    if(isset($_POST['force_gid'])){
-      $this->force_gid  = 1;
-      $this->gidNumber= $_POST['gidNumber'];
-    }else{
-      $this->force_gid  = 0;
-      $this->gidNumber  = false;
-    }
-  }
-
-  
-  /* Return plugin informations for acl handling  */ 
-  static function plInfo()
-  {
-    return (array(  
-          "plShortName" => _("Generic"),
-          "plDescription" => _("Generic group settings"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 0,
-          "plSection"     => array("admin"),
-          "plCategory"    => array("groups" => array("objectClass" => "posixGroup", "description" => _("Groups"))),
-
-          "plProvidedAcls"    => array(
-            "cn"                => _("Name"),
-            "base"              => _("Base"),
-            "description"       => _("Description"),
-
-            "fonGroup"          => _("Phone pickup group"),
-            "nagiosGroup"       => _("Nagios group"),
-
-            "gidNumber"         => _("GID"),
-            "memberUid"         => _("Group member"),
-            "sambaGroupType"    => _("Samba group type"),
-            "sambaDomainName"   => _("Samba domain name"),
-            "sambaSID"          => _("Samba SID"))
-        ));
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/groups/class_groupMail.inc b/plugins/admin/groups/class_groupMail.inc
deleted file mode 100644 (file)
index be6f7b3..0000000
+++ /dev/null
@@ -1,1162 +0,0 @@
-<?php
-
-class mailgroup extends plugin
-{
-  /* CLI vars */
-  var $cli_summary        = "Manage mail groups/shared folders";
-  var $cli_description    = "Some longer text\nfor help";
-  var $cli_parameters     = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  var $uid                        = "";       // User id 
-  var $cn                         = "";       // cn
-  var $orig_cn                    = "";       // cn
-
-  var $method                     = "mailMethod"; // Used Mail method 
-  var $mmethod                    = "";           // Contains the gosa.conf MAILMETHOD
-  var $mail                       = "";           // Default mail address 
-
-  var $gosaMailAlternateAddress   = array();  // Set default Alternate Mail Adresses to empty array
-  var $gosaMailForwardingAddress  = array();  // Forwarding also empty
-
-  var $gosaMailServer             = "";       // Selected mailserver 
-  var $gosaMailQuota              = "";       // Defined Quota 
-  var $quotaUsage                 = 0;        // Currently used quota
-
-  var $gosaVacationMessage        = "";       // Vocation message 
-
-  var $imapacl                    = array('anyone'    => 'p',     // Set acls for everyone
-      '%members%' => 'lrswp',  // %members% are all group-members
-      ''          => 'p');    // Every user added gets this right
-
-  var $kolabFolderType_SubType = "";
-  var $kolabFolderType_Type = "";
-
-  var $gosaSpamSortLevel          = "";     
-  var $gosaSpamMailbox            = "";
-  var $gosaSharedFolderTarget     ;
-
-  var $forward_dialog             = FALSE;    
-
-  var $members                    = array();  // Group members
-
-  var $mailusers                  = array();
-  var $perms                      = array();
-  var $gosaMailDeliveryMode       = "[L        ]";   // 
-  var $gosaMailMaxSize            = "";       // 
-  
-  var $remove_folder_from_imap    = true;
-
-  /* Helper */
-  var $indexed_acl= array();
-  var $indexed_user= array();
-
-  var $view_logged = FALSE;
-
-  /* attribute list for save action */
-  var $attributes= array( "mail",   "gosaMailServer", "gosaMailQuota", "gosaMailMaxSize",
-      "gosaMailAlternateAddress", "gosaMailForwardingAddress",
-      "gosaMailDeliveryMode", "gosaSpamSortLevel", "gosaSpamMailbox",
-      "acl","gosaSharedFolderTarget", "gosaVacationMessage");
-
-  var $objectclasses= array("gosaMailAccount");
-  var $CopyPasteVars          = array("quotaUsage","imapacl");
-
-  function mailgroup (&$config, $dn= NULL, $ui= NULL)
-  {
-    /* Initialise all available attributes ... if possible
-     */
-    plugin::plugin($config, $dn);
-    $this->orig_cn = $this->cn;
-
-    /* Set mailMethod to the one defined in gosa.conf 
-     */
-    if (isset($this->config->current['MAILMETHOD'])){
-      $this->mmethod= $this->config->current['MAILMETHOD'];
-    }
-
-    /* Check if selected mail method exists 
-     */
-    $cls = get_correct_class_name("mailMethod$this->mmethod");
-    if ($cls && class_exists($cls)){
-      $this->method= $cls;
-    } else {
-      print_red(sprintf(_("There is no mail method '%s' specified in your gosa.conf available."), $this->mmethod));
-    }
-
-    /* Load Mailserver  
-     */
-    if(isset($this->attrs['gosaMailServer'][0])){
-      $this->gosaMailServer =  $this->attrs['gosaMailServer'][0];
-    }
-
-    /* Convert cn to uid in case of existing entry
-     */
-    if (isset($this->attrs['cn'][0])){
-      $this->uid= $this->attrs['cn'][0];
-    }
-
-    /* Get folder type */
-    if(isset($this->config->current['MAILMETHOD'])&&preg_match("/olab/i",$this->config->current['MAILMETHOD'])){
-      if(isset($this->attrs['kolabFolderType'])){
-        $tmp = split("\.",$this->attrs['kolabFolderType'][0]);
-        $this->kolabFolderType_Type = $tmp[0];
-        $this->kolabFolderType_SubType = $tmp[1];
-      }
-    }
-
-    /* If this ins't new mailgroup, read all required data from ldap
-     */
-    if (($dn != "new")&&($dn !== NULL)){
-
-      /* Load attributes which represent multiple entries  
-       */
-      foreach (array("gosaMailAlternateAddress", "gosaMailForwardingAddress") as $val){
-        $this->$val = array();
-        if (isset($this->attrs["$val"]["count"])){
-          for ($i= 0; $i<$this->attrs["$val"]["count"]; $i++){
-            array_push($this->$val, $this->attrs["$val"][$i]);
-          }
-        }
-      }
-
-      /* Only do IMAP actions if gosaMailServer attribute is set 
-       */
-      if (isset ($this->attrs["gosaMailServer"][0])){
-
-        /* Create new instance of our defined mailclass
-         */
-        $method= new $this->method($this->config);
-
-        if ($method->connect($this->attrs["gosaMailServer"][0])){
-        
-
-          /* Maybe the entry is not saved in new style, get
-             permissions from IMAP and convert them to acl attributes */
-          if (!isset($this->attrs['acl'])){
-            $this->imapacl=  $method->getSharedFolderPermissions($this->uid);
-
-            /* Need to filter what a member acl could be... */
-            $vote= array();
-            $peak= 0;
-            $leader= "";
-            foreach ($this->imapacl as $user => $acl){
-
-              if ($user != "anyone" ){
-                if (!isset($vote[$acl])){
-                  $vote[$acl]= 1;
-                } else {
-                  $vote[$acl]++;
-                }
-                if ($vote[$acl] > $peak){
-                  $leader= $acl;
-                  $peek= $vote[$acl];
-                }
-              }
-
-            }
-
-            /* Highest count wins as %members%, remove all members
-               with the same acl */
-            if(!empty($leader)){
-              $this->imapacl['%members%']= $leader;
-            }
-            foreach ($this->imapacl as $user => $acl){
-              if ($this->acl == $leader && in_array($user, $this->attrs['memberUid'])){
-                unset($this->imapacl[$user]);
-              }
-            }
-
-          } // ENDE ! isset ($this->attrs['acl'])
-          
-          /* Adapt attributes if needed */
-          $method->fixAttributesOnLoad($this);
-          
-          /*  get Quota */
-          $quota= $method->getQuota($this->uid);
-
-          /* Update quota values */
-          if(is_array($quota)){
-            if ($quota['gosaMailQuota'] == 2147483647){
-              $this->quotaUsage= "";
-              $this->gosaMailQuota= "";
-            } else {
-              $this->quotaUsage= $quota['quotaUsage'];
-              $this->gosaMailQuota= $quota['gosaMailQuota'];
-            }
-          }else{
-            $this->quotaUsage     = "";
-            $this->gosaMailQuota  = "";
-//            print_red(sprintf(_("Can't get quota information for '%s'."),$this->uid));
-          }
-          $method->disconnect();
-        }   // ENDE $method->connect($this->attrs["gosaMailServer"][0])){
-
-      }   // ENDE gosaMailServer
-
-    }   // ENDE dn != "new"
-
-
-    /* Get global filter config */
-    if (!is_global("gmailfilter")){
-      $ui= get_userinfo();
-      $base= get_base_from_people($ui->dn);
-      $gmailfilter= array( "depselect"       => $base,
-          "muser"            => "",
-          "regex"           => "*");
-      register_global("gmailfilter", $gmailfilter);
-    }
-
-    /* Load permissions */
-    $tmp = array();
-    if(preg_match("/olab/i",$this->mmethod)){
-      $ldap = $this->config->get_ldap_link();
-
-      if (isset($this->attrs['acl'])){
-
-        for ($i= 0; $i<$this->attrs['acl']['count']; $i++){
-          list($user, $permission)= split(' ', $this->attrs['acl'][$i]);
-
-          /* Add to list */
-          $this->imapacl[$user]= $permission;
-
-          /* Get all user permissions sorted by acl, to detect the most used acl
-             This acl is then used for %members%
-           */
-          if ($user != "anyone" && $user != "%members%"){
-            $tmp[$permission][] = $user;
-          }
-
-          /* There is an entry in $this->imapacl like this this ... 
-             $this->attrs['imapacl']['anyone'] = "p";
-             $this->attrs['imapacl']['%members%'] = "lprs";
-             $this->attrs['imapacl'][''] = ""; <------ This is used to diplay an empty 
-             Field for special acls in our template.
-             If there is at least one special acl in out imapacl,
-             we don't need this entry anymore, because it is already displayed. 
-           */
-          if ($user != "anyone" && $user != "%members%"){
-            unset($this->imapacl['']);
-          }
-        }
-      }
-
-      /* In this section we dectect which acl is tho most used 
-         This will be used as %members% acl  
-       */
-      $tmp2 = array(); 
-      foreach($tmp as $acl => $user){
-        $tmp2[count($tmp[$acl])]=$acl;
-      }
-      /* Most used at last 
-       */
-      ksort($tmp2);      
-  
-      /* Assign last (most used acl) to %members% acl 
-       */
-      $str = array_pop($tmp2);
-      if(!empty($str)) {
-        $this->imapacl['%members%']=$str;
-      }
-
-      /* Open ldap connection 
-       */
-      $ldap = $this->config->get_ldap_link();
-      $ldap->cd($this->config->current['BASE']);
-
-      /* Remove those users, that use %members% acl && are member of this group. */
-      foreach($this->imapacl as $mail => $permission){
-        $ldap->search("(&(objectClass=person)(mail=".$mail."))",array("uid"));
-        $atr = $ldap->fetch();
-        if((isset($this->attrs['memberUid'])) && (is_array($this->attrs['memberUid']))){
-          if((isset($atr['uid'][0]))&&(in_array($atr['uid'][0],$this->attrs['memberUid']))&&($permission == $this->imapacl['%members%'])){
-            unset($this->imapacl[$mail]);
-          }
-        }
-      }
-      /* Append an empty entry, for special acl handling */
-      if(count($this->imapacl)==2){
-        $this->imapacl[''] ="";
-      }
-  
-    }else{ // Not kolab 
-      /* Load permissions */ 
-      if (isset($this->attrs['acl'])){
-        for ($i= 0; $i<$this->attrs['acl']['count']; $i++){
-          list($user, $permission)= split(' ', $this->attrs['acl'][$i]);
-          $this->imapacl[$user]= $permission;
-          if ($user != "anyone" && $user != "%members%"){
-            unset($this->imapacl['']);
-          }
-        }
-      }
-    }
-
-    /* Load Mailserver  
-     */
-    if(isset($this->attrs['gosaMailServer'][0])){
-      $this->gosaMailServer =  $this->attrs['gosaMailServer'][0];
-    }
-    /* Fill translations */
-    $this->perms["lrsw"]= _("read");
-    $this->perms["lrspw"]= _("post");
-    $this->perms["p"]= _("external post");
-    $this->perms["lrsipw"]= _("append");
-    $this->perms["lrswipcd"]= _("write");
-    $this->perms["lrswipcda"]= _("admin");
-    $this->perms[""]= _("none");
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    //plugin::execute();
-
-    /* Log view */
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","groups/".get_class($this),$this->dn);
-    }
-
-    /* Load templating engine */
-    $smarty= get_smarty();
-
-    /* Assign acls */
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translation) {
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-
-    if ($_SESSION['js']==FALSE){
-      $smarty->assign("javascript", "false");
-    } else {
-      $smarty->assign("javascript", "true");
-    }
-
-    /* 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;
-      }
-    }
-
-    $display = "";
-
-    /* Do we represent a valid account? */
-    if (!$this->is_account && $this->parent === NULL){
-
-      $display.= "<img alt=\"\" src=\"images/stop.png\" align=middle>&nbsp;<b>".
-        _("This 'dn' has no valid mail extensions.")."</b>";
-      return ($display);
-    }
-
-    /* Show tab dialog headers */
-    $display= "";
-    if ($this->parent !== NULL){
-      if ($this->is_account){
-        $display.= $this->show_disable_header(_("Remove mail account"),
-            _("This account has mail features enabled. You can disable them by clicking below."));
-      } else {
-        $display.= $this->show_enable_header(_("Create mail account"),
-            _("This account has mail features disabled. You can enable them by clicking below."));
-  
-        /* Show checkbox that allows us to remove imap entry too*/
-        if($this->initially_was_account){
-          $c = "";
-          if($this->remove_folder_from_imap){
-            $c= " checked ";
-          }
-          $display .= "<h2>Shared folder delete options</h2>
-                       <input class='center' type='checkbox' name='remove_folder_from_imap' value='1' ".$c."
-                        title='"._("Remove shared folder from mail server database when entry gets removed in LDAP")."'>";
-          $display .= _("Remove the shared folder and all its contents after saving this account");
-        }
-        return ($display);
-      }
-    }
-
-    /* Add ACL? */
-    if($this->acl_is_writeable("acl")){
-      foreach ($this->indexed_user as $nr => $user){
-        if (isset($_POST["add_$nr"])){
-          $this->imapacl[""]= "l";
-        }
-        if (isset($_POST["del_$nr"])){
-          unset ($this->imapacl[$user]);
-        }
-      }
-    }
-
-    /* Trigger forward add dialog? */
-    if($this->acl_is_writeable("gosaMailForwardingAddress")){
-      if (isset($_POST['add_local_forwarder'])){
-        $this->forward_dialog= TRUE;
-        $this->dialog= TRUE;
-      }
-    }
-
-    /* Cancel forward add dialog? */
-    if($this->acl_is_writeable("gosaMailForwardingAddress")){
-      if (isset($_POST['add_locals_cancel'])){
-        $this->forward_dialog= FALSE;
-        $this->dialog= FALSE;
-      }
-    }
-
-    /* Finished adding of locals? */
-    if ((isset($_POST['add_locals_finish'])) && ($this->acl_is_writeable("gosaMailForwardingAddress"))) {
-      if (count ($_POST['local_list']) && $this->acl_is_writeable("gosaMailForwardingAddress")){
-
-        /* Walk through list of forwarders, ignore own addresses */
-        foreach ($_POST['local_list'] as $val){
-          if (!in_array ($val, $this->gosaMailAlternateAddress) &&
-              $val != $this->mail){
-
-            $this->addForwarder($val);
-          }
-        }
-      }
-      $this->forward_dialog= FALSE;
-      $this->dialog= FALSE;
-    }
-
-    /* Add forward email addresses */
-    if ((isset($_POST['add_forwarder'])) && ($this->acl_is_writeable("gosaMailForwardingAddress"))){
-      if ($_POST['forward_address'] != ""){
-
-        /* Valid email address specified? */
-        $address= $_POST['forward_address'];
-        if (!is_email($address)){
-
-          print_red (_("You're trying to add an invalid email address ".
-                "to the list of forwarders."));
-
-        } elseif ($address == $this->mail
-            || in_array($address, $this->gosaMailAlternateAddress)) {
-
-          print_red (_("Adding your one of your own addresses to the forwarders makes no sense."));
-
-        } else {
-
-          /* Add it */
-          if ($this->acl_is_writeable("gosaMailForwardingAddress")){
-            $this->addForwarder ($address);
-          }
-
-        }
-      }
-    }
-
-    /* Delete forward email addresses */
-    if (isset($_POST['delete_forwarder']) && ($this->acl_is_writeable("gosaMailForwardingAddress"))){
-      if (count($_POST['forwarder_list'])&& $this->acl_is_writeable("gosaMailForwardingAddress")){
-
-        $this->delForwarder ($_POST['forwarder_list']);
-      }
-    }
-
-    /* Add alternate email addresses */
-    if (isset($_POST['add_alternate'])){
-      if ($_POST['alternate_address'] != "" && $this->acl_is_writeable("gosaMailAlternateAddress")){
-
-        if (!is_email($_POST['alternate_address'])){
-          print_red (_("You're trying to add an invalid email address to the list of alternate addresses."));
-
-        } elseif (($user= $this->addAlternate ($_POST['alternate_address'])) != ""){
-          $ui= get_userinfo();
-          if ($user != $ui->username){
-            print_red (_("The address you're trying to add is already used by user")." '$user'.");
-          }
-        }
-      }
-    }
-
-    /* Delete alternate email addresses */
-    if($this->acl_is_writeable("gosaMailAlternateAddress")){
-      if (isset($_POST['delete_alternate']) && isset ($_POST['alternates_list'])){
-        if (count($_POST['alternates_list']) && $this->acl_is_writeable("gosaMailAlternateAddress")){
-          $this->delAlternate ($_POST['alternates_list']);
-        }
-      }
-    }
-
-    /* Show forward add dialog */
-    if ($this->forward_dialog){
-      $ldap= $this->config->get_ldap_link();
-
-      /* Save data */
-      $gmailfilter= get_global("gmailfilter");
-      foreach( array("depselect", "muser", "regex") as $type){
-        if (isset($_POST[$type])){
-          $gmailfilter[$type]= $_POST[$type];
-        }
-      }
-      if (isset($_GET['search'])){
-        $s= mb_substr($_GET['search'], 0, 1, "UTF8")."*";
-        if ($s == "**"){
-          $s= "*";
-        }
-        $gmailfilter['regex']= $s;
-      }
-      register_global("gmailfilter", $gmailfilter);
-
-      /* Get actual list */
-      $mailusers= array ();
-      if ($gmailfilter['regex'] != '*' && $gmailfilter['regex'] != ""){
-        $regex= $gmailfilter['regex'];
-        $filter= "(|(mail=$regex)(gosaMailAlternateAddress=$regex))";
-      } else {
-        $filter= "";
-      }
-      if ($gmailfilter['muser'] != ""){
-        $user= $gmailfilter['muser'];
-        $filter= "$filter(|(uid=$user)(cn=$user)(givenName=$user)(sn=$user))";
-      }
-
-      /* Add already present people to the filter */
-      $exclude= "";
-      foreach ($this->gosaMailForwardingAddress as $mail){
-        $exclude.= "(mail=$mail)";
-      }
-      if ($exclude != ""){
-        $filter.= "(!(|$exclude))";
-      }
-
-      $res= get_list("(&(objectClass=gosaMailAccount)$filter)", "users", $gmailfilter['depselect'],
-                     array("sn", "mail", "givenName"), GL_SUBSEARCH | GL_SIZELIMIT);
-      $ldap->cd($gmailfilter['depselect']);
-      $ldap->search ("(&(objectClass=gosaMailAccount)$filter)", array("sn", "mail", "givenName"));
-      error_reporting (0);
-      while ($attrs= $ldap->fetch()){
-        if(preg_match('/%/', $attrs['mail'][0])){
-          continue;
-        }
-        $name= $this->make_name($attrs);
-        $mailusers[$attrs['mail'][0]]= $name."&lt;".
-          $attrs['mail'][0]."&gt;";
-      }
-      error_reporting (E_ALL | E_STRICT);
-      natcasesort ($mailusers);
-      reset ($mailusers);
-
-      /* Show dialog */
-      $smarty->assign("search_image", get_template_path('images/search.png'));
-      $smarty->assign("usearch_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.png'));
-      $smarty->assign("launchimage", get_template_path('images/small_filter.png'));
-      $smarty->assign("mailusers", $mailusers);
-      $smarty->assign("deplist", $this->config->idepartments);
-      $smarty->assign("apply", apply_filter());
-      $smarty->assign("alphabet", generate_alphabet());
-      $smarty->assign("hint", print_sizelimit_warning());
-      foreach( array("depselect", "muser", "regex") as $type){
-        $smarty->assign("$type", $gmailfilter[$type]);
-      }
-      $smarty->assign("hint", print_sizelimit_warning());
-      $display.= $smarty->fetch (get_template_path('mail_locals.tpl', TRUE));
-      return ($display);
-    }
-
-    /* Assemble normal permissions */
-    if (isset($this->imapacl['anyone'])){
-      $smarty->assign("default_permissions", $this->imapacl['anyone']);
-    }
-    $smarty->assign("member_permissions", "lrsp");
-    if (isset($this->imapacl['%members%'])){
-      $smarty->assign("member_permissions", $this->imapacl['%members%']);
-    }
-
-    /* Assemble extra attributes */
-    $perm= $this->getacl( "permissions");
-    $tmp= "";
-    $nr= 0;
-    $count= count($this->imapacl);
-    $this->indexed_user= array();
-    $this->indexed_acl= array();
-    foreach($this->imapacl as $user => $acl){
-
-      /* Add additional acl settings */
-      if ($user != "anyone" && $user != "%members%"){
-
-        $Dis  = "";
-        if(!preg_match("/w/",$perm)){
-          $Dis = " disabled ";
-        }
-  
-        /* Reset given Acls to ensure that nobody can read username and acls if not allwoed */
-        if(!preg_match("/r/",$perm)){
-          $user = "";
-          $nr   = "none";
-          $key  = "none";  
-        }
-
-        $tmp.= "<tr>  
-                 <td>
-                  <input name=\"user_$nr\" size=20 maxlength=60 value=\"$user\" ".$Dis.">
-                 </td>
-                 <td>
-                 <select size=\"1\" name=\"perm_$nr\" ".$Dis.">";
-
-        /* Add acl options for this additional acl setting */
-        if(preg_match("/r/",$perm)){
-          foreach ($this->perms as $key => $value){
-            if ($acl == $key){
-              $tmp.= "<option value=\"$key\" selected>$value</option>";
-            } else {
-              $tmp.= "<option value=\"$key\">$value</option>";
-            }
-          }
-        }
-        $tmp.= "</select>&nbsp;";
-
-
-        
-        if ($nr == $count - 1){
-          if($this->acl_is_writeable("acl")){
-            $tmp.= "<input type=submit value=\""._("Add")."\" ".
-              "name=\"add_$nr\" >";
-          }
-        }
-        if ($count > 3){
-          if($this->acl_is_writeable("acl")){
-            $tmp.= "<input type=submit value=\""._("Remove")."\" ".
-              "name=\"del_$nr\" ></td></tr>";        
-          }
-        }
-      }
-      $this->indexed_user[$nr]= $user;
-      $this->indexed_acl[$nr++]= $acl;
-    }
-    $smarty->assign("plusattributes", $tmp);
-
-    /* Show main page */
-    $mailserver= array();
-    foreach ($this->config->data['SERVERS']['IMAP'] as $key => $val){
-      $mailserver[]= $key;
-    }
-    $smarty->assign("mailServers", $mailserver);
-    foreach(array("gosaMailServer", "gosaMailQuota", "perms", "mail",
-          "gosaMailAlternateAddress", "gosaMailForwardingAddress") as $val){
-      $smarty->assign("$val", $this->$val);
-    }
-    if (is_numeric($this->gosaMailQuota) && $this->gosaMailQuota != 0){
-      if($this->acl_is_readable("gosaMailQuota")){
-        $smarty->assign("quotausage", progressbar(round(($this->quotaUsage * 100)/ $this->gosaMailQuota),100,15,true));
-        $smarty->assign("quotadefined", "true");
-      }else{
-        $smarty->assign("quotadefined", "true");
-        $smarty->assign("quotausage", "-");
-      }
-    } else {
-      $smarty->assign("quotadefined", "false");
-    }
-
-    if(isset($this->config->current['MAILMETHOD'])&&preg_match("/olab/i",$this->config->current['MAILMETHOD'])){
-
-      $smarty->assign("kolab", TRUE);
-      $smarty->assign("JS",$_SESSION['js']);
-      $smarty->assign("kolabFolderType_Types",    array (   ''      => _('Unspecified'),  'mail' => _('Mails'),
-                                                            'task'  => _('Tasks') ,       'journal' => _('Journals'),
-                                                            'calendar' => _('Calendar'),       'contact' => _('Contacts'), 
-                                                            'note'  => _('Notes')));
-      if($this->kolabFolderType_Type == "mail"){
-        $smarty->assign("kolabFolderType_SubTypes", array(    
-              ''          => _('Unspecified'),  'inbox'     => _("Inbox")   , 
-              'drafts'    => _("Drafts"),       'sentitems' => _("Sent items"),
-              'junkemail' => _("Junk mail")));
-      }else{
-        $smarty->assign("kolabFolderType_SubTypes", array(  'default' => _("Default")));
-      }
-      $smarty->assign("kolabFolderType_Type",     $this->kolabFolderType_Type);
-      $smarty->assign("kolabFolderType_SubType",  $this->kolabFolderType_SubType);
-    }else{
-      $smarty->assign("kolab", FALSE);
-    }
-
-
-    $display.= $smarty->fetch (get_template_path('mail.tpl', TRUE));
-    return ($display);
-  }
-
-
-  /* remove object from parent */
-  function remove_from_parent()
-  {
-    if(!$this->initially_was_account){
-      return;
-    }
-  
-    /* Added these ObjectClass and Attributes, because they were not 
-       removed correctly, only in case of kolab ... 
-     */
-    if(isset($this->config->current['MAILMETHOD'])&&preg_match("/olab/i",$this->config->current['MAILMETHOD'])){
-      $this->attributes[]="acl";
-      $this->objectclasses[] = "kolabSharedFolder";
-    }
-    /* include global link_info */
-    $ldap= $this->config->get_ldap_link();
-
-    /* Remove and write to LDAP */
-    plugin::remove_from_parent();
-
-    /* Zero arrays */
-    $this->attrs['gosaMailAlternateAddress']= array();
-    $this->attrs['gosaMailForwardingAddress']= array();
-    $this->attrs['gosaSharedFolderTarget']= array();
-
-    /* Connect to IMAP server for account deletion */
-    if ($this->initially_was_account){
-      $method= new $this->method($this->config);
-      $method->fixAttributesOnRemove($this);
-      if ($method->connect($this->gosaMailServer) && $this->remove_folder_from_imap){
-
-        /* Remove account from IMAP server */
-        $method->deleteMailbox($this->uid);
-        $method->disconnect();
-      }
-    }
-    /* Keep uid */
-    unset ($this->attrs['uid']);
-
-    $ldap->cd($this->dn);
-    $ldap->modify ($this->attrs); 
-    show_ldap_error($ldap->get_error(), sprintf(_("Removing of groups/mail with dn '%s' failed."),$this->dn));
-
-
-    new log("remove","groups/".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");
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-
-    /* Add special kolab attributes */    
-    if(isset($this->config->current['MAILMETHOD'])&&preg_match("/olab/i",$this->config->current['MAILMETHOD'])){
-      if(isset($_POST['kolabFolderType_Type'])){
-        $this->kolabFolderType_Type = get_post("kolabFolderType_Type");
-        $this->kolabFolderType_SubType = get_post("kolabFolderType_SubType");
-      }
-    }
-  
-    /* Check if user wants to remove the shared folder from imap too */
-    if($this->initially_was_account && !$this->is_account){
-      if(isset($_POST['remove_folder_from_imap'])){
-        $this->remove_folder_from_imap = true;
-      }else{
-        $this->remove_folder_from_imap = false;
-      }
-    }
-
-    /* Assemble mail delivery mode
-       The mode field in ldap consists of values between braces, this must
-       be called when 'mail' is set, because checkboxes may not be set when
-       we're in some other dialog.
-
-       Example for gosaMailDeliveryMode [LR        ]
-L: Local delivery
-R: Reject when exceeding mailsize limit
-S: Use spam filter
-V: Use vacation message
-C: Use custom sieve script
-I: Only insider delivery */
-    if (isset($_POST['mailedit'])){
-
-      plugin::save_object();
-
-      $tmp= preg_replace("/[^a-z]/i","",$this->gosaMailDeliveryMode);
-
-      /* Handle delivery flags */
-      if($this->acl_is_writeable("gosaMailDeliveryModeL")){
-        if(!preg_match("/L/",$tmp) && !isset($_POST['drop_own_mails'])){
-          $tmp.="L";
-        }elseif(preg_match("/L/",$tmp) && isset($_POST['drop_own_mails'])){
-          $tmp = preg_replace("/L/","",$tmp);
-        }
-      }
-
-      $opts = array(
-          "R"   => "use_mailsize_limit",
-          "S"   => "use_spam_filter",
-          "V"   => "use_vacation",
-          "C"   => "own_script",
-          "I"   => "only_local");
-
-      foreach($opts as $flag => $post){
-        if($this->acl_is_writeable("gosaMailDeliveryMode".$flag)){
-          if(!preg_match("/".$flag."/",$tmp) && isset($_POST[$post])){
-            $tmp.= $flag;
-          }elseif(preg_match("/".$flag."/",$tmp) && !isset($_POST[$post])){
-            $tmp = preg_replace("/".$flag."/","",$tmp);
-          }
-        }
-      }
-
-      $tmp= "[$tmp]";
-      if ($this->gosaMailDeliveryMode != $tmp){
-        $this->is_modified= TRUE;
-      }
-      $this->gosaMailDeliveryMode= $tmp;
-
-      /* Collect data and re-assign it to the imapacl array */
-      if ($this->acl_is_writeable("acl")){
-        $this->imapacl= array();
-        $this->imapacl['%members%']= $_POST['member_permissions'];
-        $this->imapacl['anyone']= $_POST['default_permissions'];
-        foreach ($this->indexed_user as $nr => $user){
-          if (!isset($_POST["user_$nr"])){
-            continue;
-          }
-          if ($_POST["user_$nr"] != $user ||
-              $_POST["perm_$nr"] != $this->indexed_acl[$nr]){
-            $this->is_modified= TRUE;
-          }
-          $this->imapacl[$_POST["user_$nr"]]= $_POST["perm_$nr"];
-        }
-      }
-    }
-
-  }
-
-
-
-  /* Save data to LDAP, depending on is_account we save or delete */
-  function save()
-  {
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-
-    /* Call parents save to prepare $this->attrs */
-    plugin::save();
-
-    /* Save arrays */
-    $this->attrs['gosaMailAlternateAddress']  = $this->gosaMailAlternateAddress;
-    $this->attrs['gosaMailForwardingAddress'] = $this->gosaMailForwardingAddress;
-    $this->attrs['gosaSharedFolderTarget']    = "share+".$this->uid;
-
-    /* Only do IMAP actions if we are not a template */
-    if(preg_match("/olab/i",$this->mmethod)){
-      if (empty($this->gosaMailServer)||is_array($this->gosaMailServer)){
-        if(isset($this->attrs['gosaMailServer'][0])){
-          $this->gosaMailServer = $this->attrs['gosaMailServer'][0];
-        }
-      }
-    }  
-
-    /* Exchange '%member%' pseudo entry */
-    $memberacl= $this->imapacl['%members%'];
-
-    foreach ($this->members as $user){
-      if (!isset($this->imapacl[$user])){
-        $this->imapacl[$user]= $memberacl;
-      }
-    }
-    if(preg_match("/olab/i",$this->mmethod)){
-
-      /* Save acl's */
-      $this->attrs['acl']= array();
-      foreach ($this->imapacl as $user => $acl){
-        if ($user == "" || preg_match("/%members%/",$user)){
-          continue;
-        }
-        $ldap->search("(&(objectClass=person)(|(uid=".$user.")(mail=".$user.")))",array("mail"));
-        $mail = $ldap->fetch();
-        if(isset($mail['mail'][0])){
-          $sacl = $mail['mail'][0]." ".$acl;
-        }else{
-          $sacl= "$user $acl";
-        }
-        if(!in_array($sacl,$this->attrs['acl'])){
-          $this->attrs['acl'][]= $sacl;
-        }
-      }
-   
-      if(!empty($this->kolabFolderType_Type)){ 
-        $this->attrs['kolabFolderType'] = $this->kolabFolderType_Type.".".$this->kolabFolderType_SubType;
-      }else{
-        $this->attrs['kolabFolderType'] = array();
-      }
-    }else{
-
-      /* Save acl's */
-      $this->attrs['acl']= array();
-      foreach ($this->imapacl as $user => $acl){
-        if ($user == "" || preg_match("/%members%/",$user)){
-          continue;
-        }
-        $this->attrs['acl'][]= "$user $acl";
-      }
-    }
-
-    if ((!$this->is_template)&&(!empty($this->gosaMailServer))){
-      $method= new $this->method($this->config);
-      $method->fixAttributesOnStore($this);
-      if (($method->connect($this->gosaMailServer))){
-        $method->updateMailbox($this->uid);
-        $method->setQuota($this->uid, $this->gosaMailQuota);
-        $method->setSharedFolderPermissions($this->uid, $this->imapacl);
-        $method->disconnect();
-      }
-    }
-
-    /* Save data to LDAP */
-    $ldap->cd($this->dn);
-    $this->cleanup();
-    $ldap->modify ($this->attrs); 
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of groups/mail with dn '%s' failed."),$this->dn));
-    
-    if($this->initially_was_account){
-      new log("modify","groups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }else{
-      new log("create","groups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());  
-    }
-    
-
-    /* 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");
-    }
-  }
-
-  /* Check formular input */
-  function check()
-  {
-    $ldap= $this->config->get_ldap_link();
-
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    if(!$this->is_account) return array();
-    
-    //$message[] = $str;      
-
-    /* must: mail */
-    if ($this->mail == ""){
-      $message[]= _("The required field 'Primary address' is not set.");
-    }
-    if (!is_email($this->mail)){
-      $message[]= _("Please enter a valid email addres in 'Primary address' field.");
-    }
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search ("(&(!(objectClass=gosaUserTemplate))(objectClass=gosaMailAccount)(|(mail=".$this->mail.")(gosaMailAlternateAddress=".
-        $this->mail."))(!(uid=".$this->orig_cn."))(!(cn=".$this->orig_cn.")))");
-    if ($ldap->count() != 0){
-      $message[]= _("The primary address you've entered is already in use.");
-    }
-  
-    /* Check quota */
-    if ($this->gosaMailQuota != '' && $this->acl_is_writeable("gosaMailQuota")){
-      if (!is_numeric($this->gosaMailQuota)) {
-        $message[]= _("Value in 'Quota size' is not valid.");
-      } else {
-        $this->gosaMailQuota= (int) $this->gosaMailQuota;
-      }
-    }
-
-    /* Check rejectsize for integer */
-    if ($this->gosaMailMaxSize != '' && $this->acl_is_writeable("gosaMailQuota")){
-      if (!is_numeric($this->gosaMailMaxSize)){
-        $message[]= _("Please specify a vaild mail size for mails to be rejected.");
-      } else {
-        $this->gosaMailMaxSize= (int) $this->gosaMailMaxSize;
-      }
-    }
-
-    /* Need gosaMailMaxSize if use_mailsize_limit is checked */
-    if (is_integer(strpos($this->gosaMailDeliveryMode, "reject")) && $this->gosaMailMaxSize == ""){
-      $message[]= _("You need to set the maximum mail size in order to reject anything.");
-    }
-
-    if(ord($this->imapacl['anyone'][0])==194){
-      $message[] = _("Please choose valid permission settings. Default permission can't be emtpy.");
-    }
-
-    if(empty($this->gosaMailServer)){
-      $message[] = _("Please select a valid mail server.");
-    }
-
-    return ($message);
-  }
-
-  /* Adapt from template, using 'dn' */
-  function adapt_from_template($dn)
-  {
-    plugin::adapt_from_template($dn);
-
-    foreach (array("gosaMailAlternateAddress", "gosaMailForwardingAddress") as $val){
-      $this->$val= array();
-      if (isset($this->attrs["$val"]["count"])){
-        for ($i= 0; $i<$this->attrs["$val"]["count"]; $i++){
-          $value= $this->attrs["$val"][$i];
-          foreach (array("sn", "givenName", "uid") as $repl){
-            if (preg_match("/%$repl/i", $value)){
-              $value= preg_replace ("/%$repl/i", $this->parent->$repl, $value);
-            }
-          }
-          array_push($this->$val, $value);
-        }
-      }
-    }
-  }
-
-  /* Add entry to forwarder list */
-  function addForwarder($address)
-  {
-    $this->gosaMailForwardingAddress[]= $address;
-    $this->gosaMailForwardingAddress= array_unique ($this->gosaMailForwardingAddress);
-
-    sort ($this->gosaMailForwardingAddress);
-    reset ($this->gosaMailForwardingAddress);
-    $this->is_modified= TRUE;
-  }
-
-  /* Remove list of addresses from forwarder list */
-  function delForwarder($addresses)
-  {
-    $this->gosaMailForwardingAddress= array_remove_entries ($addresses,
-        $this->gosaMailForwardingAddress);
-    $this->is_modified= TRUE;
-  }
-
-
-
-  function addAlternate($address)
-  {
-    $ldap= $this->config->get_ldap_link();
-
-    $address= strtolower($address);
-
-    /* Is this address already assigned in LDAP? */
-    $ldap->cd ($this->config->current['BASE']);
-    $ldap->search ("(&(objectClass=gosaMailAccount)(|(mail=$address)".
-        "(gosaMailAlternateAddress=$address)))");
-
-    if ($ldap->count() > 0){
-      $attrs= $ldap->fetch ();
-      return ($attrs["uid"][0]);
-    }
-
-    /* Add to list of alternates */
-    if (!in_array($address, $this->gosaMailAlternateAddress)){
-      $this->gosaMailAlternateAddress[]= $address;
-    }
-
-    sort ($this->gosaMailAlternateAddress);
-    reset ($this->gosaMailAlternateAddress);
-    $this->is_modified= TRUE;
-
-    return ("");
-  }
-
-
-  function delAlternate($addresses)
-  {
-    $this->gosaMailAlternateAddress= array_remove_entries ($addresses,
-        $this->gosaMailAlternateAddress);
-    $this->is_modified= TRUE;
-  }
-
-
-  function make_name($attrs)
-  {
-    $name= "";
-    if (isset($attrs['sn'][0])){
-      $name= $attrs['sn'][0];
-    }
-    if (isset($attrs['givenName'][0])){
-      if ($name != ""){
-        $name.= ", ".$attrs['givenName'][0];
-      } else {
-        $name.= $attrs['givenName'][0];
-      }
-    }
-    if ($name != ""){
-      $name.= " ";
-    }
-
-    return ($name);
-  }
-
-  function getCopyDialog()
-  {
-    if(!$this->is_account) return("");
-
-    $smarty = get_smarty();
-    $smarty->assign("gosaMailAlternateAddress",$this->gosaMailAlternateAddress);
-    $smarty->assign("gosaMailForwardingAddress",$this->gosaMailForwardingAddress);
-    $smarty->assign("mail",$this->mail);
-    $display= $smarty->fetch (get_template_path('paste_mail.tpl', TRUE));
-    $ret = array();
-    $ret['string'] = $display;
-    $ret['status'] = "";
-    return($ret);
-  }
-
-  function saveCopyDialog()
-  {
-    if(!$this->is_account) return;
-
-    /* Perform ADD / REMOVE ... for mail alternate / mail forwarding addresses 
-    */
-    $this->execute();
-    if(isset($_POST['mail'])){
-      $this->mail = $_POST['mail'];
-    }
-  }
-
-
-  function PrepareForCopyPaste($source)
-  {
-    plugin::PrepareForCopyPaste($source);
-    /* Reset alternate mail addresses */
-    $this->gosaMailAlternateAddress = array();
-  }
-
-
-  /* Return plugin informations for acl handling  */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("Mail"),
-          "plDescription" => _("Group mail"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 0,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("groups"), 
-          "plProvidedAcls"=> array(
-            "mail"                      => _("Mail address"),
-            "gosaMailAlternateAddress"  => _("Alternate addresses"),
-            "gosaMailForwardingAddress" => _("Forwarding addresses"),
-            "gosaMailQuota"             => _("Quota size"),
-            "gosaMailServer"            => _("Mail server"),
-            "acl"                       => _("Permissions"))
-          ));
-  }
-
-  
-  /* Remove given ACL for given member (uid,mail) ..
-   */
-  function removeUserAcl($index )
-  {
-    if(isset($this->imapacl[$index])){
-      unset($this->imapacl[$index]);
-    }
-  }
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/groups/class_groupManagement.inc b/plugins/admin/groups/class_groupManagement.inc
deleted file mode 100644 (file)
index f146ad6..0000000
+++ /dev/null
@@ -1,720 +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 groupManagement extends plugin
-{
-  /* Definitions */
-  var $plHeadline= "Groups";
-  var $plDescription= "This does something";
-
-  /* Dialog attributes */
-  var $grouptab           = NULL;
-  var $grouplist          = array();
-  var $ui                 = NULL;
-  var $CopyPasteHandler   = NULL;
-  var $DivListGroup       = NULL;
-  var $ShowPrimaryCheckBox= false; 
-  var $start_pasting_copied_objects = FALSE;
-
-  function groupManagement (&$config, &$ui)
-  {
-    /* Save configuration for internal use */
-    $this->config = &$config;
-    $this->ui     = &$ui;
-
-    /* Copy & Paste enabled ?*/
-    if((isset($this->config->data['MAIN']['ENABLECOPYPASTE']))&&(preg_match("/true/i",$this->config->data['MAIN']['ENABLECOPYPASTE']))){
-      $this->CopyPasteHandler = new CopyPasteHandler($this->config);
-    }
-    
-    /* Detect if we have to display the primary group checkbox */
-    $tmp = "";
-    if (isset($this->config->data['MAIN']['NOPRIMARYGROUP'])){
-      $tmp = $this->config->data['MAIN']['NOPRIMARYGROUP'];
-    }
-    if(preg_match("/true/i",$tmp)|| (preg_match("/yes/",$tmp))){ 
-      $this->ShowPrimaryCheckBox = false;
-    } else {
-      $this->ShowPrimaryCheckBox = true;
-    }
-
-    /* Create dialog object */
-    $this->DivListGroup = new divListGroup($this->config,$this);
-    $this->DivListGroup->DisableCheckBox("ShowPrimaryGroups",$this->ShowPrimaryCheckBox);
-  }
-
-
-  function execute()
-  {
-       /* Call parent execute */
-       plugin::execute();
-
-    /* Store these posts if the current object is locked (used by somebody else)*/
-    $_SESSION['LOCK_VARS_TO_USE'] = array("/^act$/","/^id$/","/^group_edit_/","/^group_del_/","/^item_selected/","/^remove_multiple_groups/");
-
-    /* Save data */
-    $s_action   = "";
-    $s_entry    = "";
-
-    /* Test Posts */
-    foreach($_POST as $key => $val){
-      // Post for delete
-      if(preg_match("/^group_del.*/",$key)){
-        $s_action = "del";
-        $s_entry  = preg_replace("/group_".$s_action."_/i","",$key);
-        // Post for edit
-      }elseif(preg_match("/^group_edit_.*/",$key)){
-        $s_action="edit";
-        $s_entry  = preg_replace("/group_".$s_action."_/i","",$key);
-        // Post for new
-      }elseif(preg_match("/^group_new.*/",$key)){
-        $s_action="new";
-      }elseif(preg_match("/^dep_home.*/i",$key)){
-        $s_action="home";
-      }elseif(preg_match("/^group_tplnew.*/i",$key)){
-        $s_action="new_tpl";
-      }elseif(preg_match("/^group_chgpw.*/i",$key)){
-        $s_action="change_pw";
-        $s_entry  = preg_replace("/group_chgpw_/i","",$key);
-      }elseif(preg_match("/_group_edit_/",$key)){
-        $type = preg_replace("/_group_edit_.*$/","",$key);
-        $s_action="edit";
-        $s_entry  = preg_replace("/".$type."_group_edit_/i","",$key); 
-        $_POST['arg'] = $type;
-      }elseif(preg_match("/^editPaste.*/i",$key)){
-        $s_action="editPaste";
-      }elseif(preg_match("/^copy_.*/",$key)){
-        $s_action="copy";
-        $s_entry  = preg_replace("/^copy_/i","",$key);
-      }elseif(preg_match("/^cut_.*/",$key)){
-        $s_action="cut";
-        $s_entry  = preg_replace("/^cut_/i","",$key);
-      }elseif(preg_match("/^remove_multiple_groups/",$key)){
-        $s_action="del_multiple";
-      }elseif(preg_match("/^multiple_copy_groups/",$key)){
-        $s_action = "copy_multiple";
-      }elseif(preg_match("/^multiple_cut_groups/",$key)){
-        $s_action = "cut_multiple";
-      }
-    }
-    $s_entry  = preg_replace("/_.$/","",$s_entry); 
-
-    /* Check for posted gets */
-    if((isset($_GET['act'])) && ($_GET['act'] == "edit_entry")){
-      $s_entry    = $_GET['id'];
-      $s_action = "edit";
-    }
-
-    /* handle C&P from layers menu */
-    if(isset($_POST['menu_action']) && preg_match("/^multiple_copy_systems/",$_POST['menu_action'])){
-      $s_action = "copy_multiple";
-    }
-    if(isset($_POST['menu_action']) && preg_match("/^multiple_cut_systems/",$_POST['menu_action'])){
-      $s_action = "cut_multiple";
-    }
-    if(isset($_POST['menu_action']) && preg_match("/^editPaste/",$_POST['menu_action'])){
-      $s_action = "editPaste";
-    }
-
-    /* Create options */
-    if(isset($_POST['menu_action']) && $_POST['menu_action'] == "group_new"){
-      $s_action = "new";
-    }
-
-    /* handle remove from layers menu */
-    if(isset($_POST['menu_action']) && preg_match("/^remove_multiple/",$_POST['menu_action'])){
-      $s_action = "del_multiple";
-    }
-
-
-
-    $smarty= get_smarty();
-
-    /********************
-      Copy & Paste Handling  ...
-     ********************/
-
-    /* Display the copy & paste dialog, if it is currently open */
-    $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
-    if($ret){
-      return($ret);
-    }
-
-
-    /********************
-      Create a new group  ...
-     ********************/
-
-    /* New group? */
-    if ($s_action=="new"){
-
-      /* Check create permissions */
-      $acl = $this->ui->get_permissions($this->DivListGroup->selectedBase,"groups/group");
-      if(preg_match("/c/",$acl)){
-
-        /* By default we set 'dn' to 'new', all relevant plugins will
-           react on this. */
-        $this->dn= "new";
-
-        /* Create new usertab object */
-        $this->grouptab= new grouptabs($this->config, $this->config->data['TABS']['GROUPTABS'], $this->dn);
-
-        /* Set up the group ACL's for this 'dn' */
-        $this->grouptab->set_acl_base($this->DivListGroup->selectedBase);
-      }
-    }
-
-
-    /********************
-      Save Group Tab/Object Changes
-     ********************/
-
-    /* Finish group edit is triggered by the tabulator dialog, so
-       the user wants to save edited data. Check and save at this
-       point. */
-    if ((isset($_POST['edit_finish']) || isset($_POST['edit_apply'])) && (isset($this->grouptab->config)) ){
-
-      /* Check tabs, will feed message array 
-         Save, or display error message? */
-      $message= $this->grouptab->check();
-      if (count($message) == 0){
-
-        /* Save user data to ldap */
-        $this->grouptab->save();
-
-        if (!isset($_POST['edit_apply'])){
-          /* Group has been saved successfully, remove lock from LDAP. */
-          if ($this->dn != "new"){
-            del_lock ($this->dn);
-          }
-
-          /* There's no page reload so we have to read new groups at this point. */
-          //$this->reload ();
-          unset ($this->grouptab);
-          $this->grouptab= NULL;
-          unset ($_SESSION['objectinfo']);
-        }
-      } else {
-        /* Ok. There seem to be errors regarding to the tab data,
-           show message and continue as usual. */
-        show_errors($message);
-      }
-    }
-
-
-    /********************
-      Edit existing group 
-     ********************/
-
-    /* User wants to edit data? */
-    if (($s_action=="edit") && (!isset($this->grouptab-> config))){
-
-      /* Get 'dn' from posted 'uid', must be unique */
-      $this->dn= $this->grouplist[trim($s_entry)]['dn'];
-
-      /* Check locking & lock entry if required */
-      $user = get_lock($this->dn);
-      if ($user != ""){
-        return(gen_locked_message ($user, $this->dn));
-      }
-      add_lock ($this->dn, $this->ui->dn);
-
-      /* Register grouptab to trigger edit dialog */
-      $this->grouptab= new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], $this->dn);
-      $this->grouptab->set_acl_base($this->dn);
-      $_SESSION['objectinfo']= $this->dn;
-    }
-
-
-    /********************
-      Delete MULTIPLE entries requested, display confirm dialog
-     ********************/
-
-    if ($s_action=="del_multiple"){
-      $ids = $this->list_get_selected_items();
-
-      if(count($ids)){
-
-        foreach($ids as $id){
-          $dn = $this->grouplist[$id]['dn'];
-          if (($user= get_lock($dn)) != ""){
-            return(gen_locked_message ($user, $dn));
-          }
-          $this->dns[$id] = $dn;
-        }
-
-        $dns_names = "<br><pre>";
-        foreach($this->dns as $dn){
-          add_lock ($dn, $this->ui->dn);
-          $dns_names .= $dn."\n";
-        }
-        $dns_names .="</pre>";
-
-        /* Lock the current entry, so nobody will edit it during deletion */
-        if (count($this->dns) == 1){
-          $smarty->assign("info",     sprintf(_("You're about to delete the following entry %s"), @LDAP::fix($dns_names)));
-        } else {
-          $smarty->assign("info",     sprintf(_("You're about to delete the following entries %s"), @LDAP::fix($dns_names)));
-        }
-        $smarty->assign("multiple", true);
-        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
-      }
-    }
-
-
-    /********************
-      Delete MULTIPLE entries confirmed
-     ********************/
-
-      /* Confirmation for deletion has been passed. Groups should be deleted. */
-      if (isset($_POST['delete_multiple_groups_confirm'])){
-
-        /* Remove user by user and check acls before removeing them */
-        foreach($this->dns as $key => $dn){
-
-          /* Load permissions for selected 'dn' and check if
-             we're allowed to remove this 'dn' */
-          $acl = $this->ui->get_permissions($dn,"groups/group");
-          if(preg_match("/d/",$acl)){
-
-            /* Delete request is permitted, perform LDAP action */
-            $this->grouptab= new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], $dn);
-            $this->grouptab->set_acl_base($dn);
-            $this->grouptab->delete ();
-            unset ($this->grouptab);
-            $this->grouptab= NULL;
-
-          } else {
-
-            /* Normally this shouldn't be reached, send some extra
-               logs to notify the administrator */
-            print_red (_("You are not allowed to delete this group!"));
-            new log("security","groups/".get_class($this),$dn,array(),"Tried to trick deletion.");
-          }
-          /* Remove lock file after successfull deletion */
-          del_lock ($dn);
-          unset($this->dns[$key]);
-        }
-      }
-
-
-      /********************
-        Delete MULTIPLE entries Canceled
-       ********************/
-
-      /* Remove lock */
-    if(isset($_POST['delete_multiple_user_cancel'])){
-      foreach($this->dns as $key => $dn){
-        del_lock ($dn);
-        unset($this->dns[$key]);
-      }
-    }
-
-
-    /********************
-      Delete group 
-     ********************/
-
-    /* Remove group was requested */
-    if ($s_action=="del"){
-
-      /* Get 'dn' from posted 'uid' */
-      $this->dn= $this->grouplist[trim($s_entry)]['dn'];
-
-      /* Load permissions for selected 'dn' and check if
-         we're allowed to remove this 'dn' */
-      $acl = $this->ui->get_permissions($this->dn,"groups/group");
-      if(preg_match("/d/",$acl)){
-
-        /* Check locking, save current plugin in 'back_plugin', so
-           the dialog knows where to return. */
-        if (($user= get_lock($this->dn)) != ""){
-          return(gen_locked_message ($user, $this->dn));
-        }
-
-        /* Lock the current entry, so nobody will edit it during deletion */
-        add_lock ($this->dn, $this->ui->dn);
-        $smarty->assign("info", sprintf(_("You're about to delete the group '%s'."), @LDAP::fix($this->dn)));
-        $smarty->assign("multiple", false);
-        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
-
-      } else {
-        
-        /* Obviously the user isn't allowed to delete. Show message and clean session. */
-        print_red (_("You are not allowed to delete this group!"));
-      }
-    }
-
-
-    /********************
-      Delete group confirmed  
-     ********************/
-
-    /* Confirmation for deletion has been passed. Group should be deleted. */
-    if (isset($_POST['delete_group_confirm'])){
-
-      /* Some nice guy may send this as POST, so we've to check
-         for the permissions again. */
-      $acl = $this->ui->get_permissions($this->dn,"groups/group");
-      if(preg_match("/d/",$acl)){
-
-        /* Delete request is permitted, perform LDAP action */
-        $this->grouptab= new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], $this->dn);
-        $this->grouptab->set_acl_base($this->dn);
-        $this->grouptab->delete ();
-        unset ($this->grouptab);
-        $this->grouptab= NULL;
-
-        /* Group list has changed, reload it. */
-        //$this->reload ();
-
-      } else {
-
-        /* Normally this shouldn't be reached, send some extra
-           logs to notify the administrator */
-        print_red (_("You are not allowed to delete this group!"));
-        new log("security","groups/".get_class($this),$dn,array(),"Tried to trick deletion.");
-      }
-
-      /* Remove lock file after successfull deletion */
-      del_lock ($this->dn);
-      unset($_SESSION['objectinfo']);
-    }
-
-
-    /********************
-      Delete group canceled  
-     ********************/
-
-    /* Delete group canceled? */
-    if (isset($_POST['delete_cancel'])){
-      del_lock ($this->dn);
-      unset($_SESSION['objectinfo']);
-    }
-    
-
-    /********************
-      A dialog was canceled  
-     ********************/
-
-    /* Cancel dialogs */
-    if (isset($_POST['edit_cancel']) || isset($_POST['password_cancel'])){
-      if(isset($this->grouptab->dn)){
-        del_lock ($this->grouptab->dn);
-      }
-      unset ($this->grouptab);
-      $this->grouptab= NULL;
-      unset($_SESSION['objectinfo']);
-    }
-
-
-    /********************
-      If there is currently a dialog open, display it
-     ********************/
-
-    /* Show tab dialog if object is present */
-    if (isset($this->grouptab->config)){
-      $display= $this->grouptab->execute();
-
-      /* Don't show buttons if tab dialog requests this */
-      if(isset($this->grouptab->by_object)){
-        if (!$this->grouptab->by_object[$this->grouptab->current]->dialog){
-          $display.= "<p style=\"text-align:right\">\n";
-          $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
-          $display.= "&nbsp;\n";
-          if ($this->dn != "new"){
-            $display.= "<input type=submit name=\"edit_apply\" value=\""._("Apply")."\">\n";
-            $display.= "&nbsp;\n";
-          }
-          $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
-          $display.= "</p>";
-        }
-      }
-      return ($display);
-    }
-
-
-    /* Check if there is a snapshot dialog open */
-    $base = $this->DivListGroup->selectedBase;
-    if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases())){
-      return($str);
-    }
-   
-    /* Display dialog with group list */
-    $this->DivListGroup->parent = $this;
-    $this->DivListGroup->execute();
-
-    /* Add departments if subsearch is disabled */
-    if(!$this->DivListGroup->SubSearch){
-      $this->DivListGroup->AddDepartments($this->DivListGroup->selectedBase,4,1);
-    }
-    $this->reload ();
-    $this->DivListGroup->setEntries($this->grouplist);
-    return($this->DivListGroup->Draw());
-  }
-
-
-  /* Return departments, that will be included within snapshot detection */
-  function get_used_snapshot_bases()
-  {
-    return(array(get_groups_ou().$this->DivListGroup->selectedBase));
-  }
-
-
-  function list_get_selected_items()
-  {
-    $ids = array();
-    foreach($_POST as $name => $value){
-      if(preg_match("/^item_selected_[0-9]*$/",$name)){
-        $id   = preg_replace("/^item_selected_/","",$name);
-        $ids[$id] = $id;
-      }
-    }
-    return($ids);
-  }
-
-
-  function reload($CreatePosixsList=false)
-  {
-    $this->grouplist        = array();
-    $primaries              = array();
-    $functional             = array();
-    $error= $error2         = "";
-    $filter                 = "(objectclass=posixGroup)";
-
-    $base                   = $this->DivListGroup->selectedBase;
-    $Regex                  = $this->DivListGroup->Regex;
-    $UserRegex              = $this->DivListGroup->UserRegex;
-    $SubSearch              = $this->DivListGroup->SubSearch;
-    $ShowPrimaryGroups      = $this->DivListGroup->ShowPrimaryGroups;
-    $ShowSambaGroups        = $this->DivListGroup->ShowSambaGroups;
-    $ShowApplicationGroups  = $this->DivListGroup->ShowApplicationGroups;
-    $ShowMailGroups         = $this->DivListGroup->ShowMailGroups;
-    $ShowFunctionalGroups   = $this->DivListGroup->ShowFunctionalGroups;
-
-    /* Prepare ldap class */
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd($base);
-    $ldap->set_size_limit($_SESSION['size_limit']);
-
-
-    /********************
-      Create filter depending on selected checkboxes 
-     ********************/
-
-    /* Add application groups */
-    if ($ShowApplicationGroups){
-      $filter.= "(objectClass=gosaApplicationGroup)";
-    }
-    
-    /* Add Mail Groups */
-    if ($ShowMailGroups){
-      $filter.= "(objectClass=gosaMailAccount)";
-    }
-
-    $sfilter= "";
-    if ($this->config->current['SAMBAVERSION'] == 3){
-      if (!$ShowPrimaryGroups){
-        $sfilter= "(objectClass=sambaGroupMapping)";
-      } elseif ($ShowSambaGroups){
-        $filter.= "(objectClass=sambaGroupMapping)";
-      }
-    }
-
-    /* Prepare filter for given Regex && UserRegex */
-    if ($filter != ""){
-      $filter= "(&(cn=$Regex)(objectClass=posixGroup)(|$filter))";
-      if ($UserRegex != ""){
-        $filter= "(&(|(memberUID=".$UserRegex.")(cn=".$UserRegex."))$filter)";
-      }
-    }
-
-
-    /********************
-      Collect some groupids to be able to skip primary & functional groups 
-     ********************/
-
-    /* Collect primary groupIDs to show primary groups 
-       if this option is enabled in gosa conf && the checkbox is checked */  
-    if ($this->ShowPrimaryCheckBox){
-      $res = get_list("(&(uid=$Regex)(!(uid=*$))(objectClass=posixAccount)(gidNumber=*))",
-            "groups", $base,array("gidNumber", "cn"),  GL_SUBSEARCH);
-      foreach ($res as $attrs){
-        $primaries[$attrs['gidNumber'][0]]= $attrs['cn'][0];
-      }
-    }
-
-    /* Collect all GroupIDs from those groups which are functional.
-       Only perfrom this search if  ShowFunctionalGroups  is unchecked, else leave arre empty  */ 
-    $ff = "(&(cn=$Regex)(objectClass=posixGroup)(!(|(objectClass=gosaMailAccount)(objectClass=gosaApplicationGroup)$sfilter)))";
-    if ($SubSearch){
-      $res = get_list($ff, "groups", $base,array("gidNumber", "cn", "description"), GL_SUBSEARCH);
-    } else {
-      $res = get_list($ff, "groups", $base,array("gidNumber", "cn", "description"), GL_NONE);
-    }
-    foreach($res as $attrs){
-      if (!isset($primaries[$attrs['gidNumber'][0]])){
-        $functional[$attrs['gidNumber'][0]]= $attrs['gidNumber'][0];
-      }
-    }
-   
-
-    /********************
-      Search for the prepared filter 
-     ********************/
-   
-    /* Attributes to search for */    
-    $attrs = array("cn", "description", "gidNumber", "objectClass");
-    /* If subsearch is activated search for subobjects too */
-    $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
-    if(!empty($tmp)){
-      $attrs [] = "FAIrelease";
-    }
-
-    if ($SubSearch){
-      $res= get_list($filter, "groups", $base, $attrs, GL_SIZELIMIT| GL_SUBSEARCH);
-    } else {
-      $res= get_list($filter, "groups", get_groups_ou().$base, $attrs, GL_SIZELIMIT);
-    }
-
-    /* Sort values into grouplist*/
-    $tmp = $tmp2 = array();
-    foreach ($res as $value){
-      /* Skip functional groups if checkbox isn't checked */
-      if (!$ShowFunctionalGroups && isset($functional[$value['gidNumber'][0]])){
-        continue;
-      }
-      
-      /* If gidNumber is in $primaries skip this entry */
-      if (($ShowPrimaryGroups)   ||   (!$ShowPrimaryGroups && !isset($primaries[$value['gidNumber'][0]]))){
-        $tmp2[$value['cn'][0]] = $value;
-        $tmp [$value['cn'][0]] = $value['cn'][0];
-      }
-    }
-    natcasesort($tmp);
-    foreach($tmp as $name){
-      $this->grouplist[] = $tmp2[$name]; 
-    }
-    reset ($this->grouplist);
-  }
-
-
-  function copyPasteHandling_from_queue($s_action,$s_entry)
-  {
-    /* Check if Copy & Paste is disabled */
-    if(!is_object($this->CopyPasteHandler)){
-      return("");
-    }
-
-    /* Add a single entry to queue */
-    if($s_action == "cut" || $s_action == "copy"){
-
-      /* Cleanup object queue */
-      $this->CopyPasteHandler->cleanup_queue();
-      $dn = $this->grouplist[$s_entry]['dn'];
-      $this->CopyPasteHandler->add_to_queue($dn,$s_action,"grouptabs","GROUPTABS","groups");
-    }
-
-
-    /* Add entries to queue */
-    if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
-
-      /* Cleanup object queue */
-      $this->CopyPasteHandler->cleanup_queue();
-
-      /* Add new entries to CP queue */
-      foreach($this->list_get_selected_items() as $id){
-        $dn = $this->grouplist[$id]['dn'];
-
-        if($s_action == "copy_multiple"){
-          $this->CopyPasteHandler->add_to_queue($dn,"copy","grouptabs","GROUPTABS","groups");
-        }
-        if($s_action == "cut_multiple"){
-          $this->CopyPasteHandler->add_to_queue($dn,"cut","grouptabs","GROUPTABS","groups");
-        }
-      }
-    }
-
-    /* Start pasting entries */
-    if($s_action == "editPaste"){
-      $this->start_pasting_copied_objects = TRUE;
-    }
-
-    /* Return C&P dialog */
-    if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
-
-      /* Load entry from queue and set base */
-      $this->CopyPasteHandler->load_entry_from_queue();
-      $this->CopyPasteHandler->SetVar("base",$this->DivListGroup->selectedBase);
-
-      /* Get dialog */
-      $data = $this->CopyPasteHandler->execute();
-
-      /* Return dialog data */
-      if(!empty($data)){
-        return($data);
-      }
-    }
-
-    /* Automatically disable status for pasting */
-    if(!$this->CopyPasteHandler->entries_queued()){
-      $this->start_pasting_copied_objects = FALSE;
-    }
-    return("");
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    $this->DivListGroup->save_object();
-  }
-
-
-  function remove_lock()
-  {
-    if (isset($this->grouptab->dn)){
-      del_lock ($this->grouptab->dn);
-    }
-  }
-
-
-  function remove_from_parent()
-  {
-    /* Optionally execute a command after we're done */
-    $this->postremove();
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    /* Optionally execute a command after we're done */
-    $this->postcreate();
-  }
-
-  /* Unused functions  */
-  function check()  { }
-  function adapt_from_template($dn) { }
-  function password_change_needed()  { }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/groups/generic.tpl b/plugins/admin/groups/generic.tpl
deleted file mode 100644 (file)
index 4d67c86..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-<table summary="" style="width:100%;">
- <tr>
-  <td style="width:50%; vertical-align:top;">
-   <table summary="" style="width:100%">
-    <tr>
-     <td><LABEL for="cn">{t}Group name{/t}</LABEL>{$must}</td>
-     <td>
-{render acl=$cnACL}
-       <input id="cn" name="cn" size=25 maxlength=60 value="{$cn}" title="{t}Posix name of the group{/t}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td>
-      <LABEL for="description">{t}Description{/t}</LABEL>
-     </td>
-     <td>
-{render acl=$descriptionACL}
-      <input id="description" name="description" size=40 maxlength=80 value="{$description}" title="{t}Descriptive text for this group{/t}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td colspan=2> 
-      <div style="height:15px;"></div> 
-     </td>
-    </tr>
-    <tr>
-     <td>
-      <LABEL for="base">{t}Base{/t}</LABEL>{$must}
-     </td>
-     <td>
-{render acl=$baseACL}
-      <select id="base" size="1" name="base" title="{t}Choose subtree to place group in{/t}">
-       {html_options options=$bases selected=$base_select}
-      </select>
-{/render}
-
-{render acl=$baseACL disable_picture='images/folder_gray.png'}
-       <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-      <td colspan=2> <div style="height:15px; width:100%; border-bottom:1px solid #909090;"></div> </td>
-    </tr>
-    <tr>
-      <td colspan=2> <div style="height:15px; width:100%;"></div> </td>
-    </tr>
-    <tr>
-     <td colspan=2>
-{render acl=$gidNumberACL}
-      <input type=checkbox name="force_gid" value="1" title="{t}Normally IDs are autogenerated, select to specify manually{/t}" 
-       {$force_gid} onclick="changeState('gidNumber')">
-{/render}
-       <LABEL for="gidNumber">{t}Force GID{/t}</LABEL>
-      &nbsp;
-{render acl=$gidNumberACL}
-      <input name="gidNumber" size=9 maxlength=9 id="gidNumber" {$forceMode} value="{$gidNumber}" title="{t}Forced ID number{/t}">
-{/render}
-     </td>
-    </tr>
-
-    {if $samba3 ne ""}
-    <tr>
-     <td colspan=2>
-{render acl=$sambaGroupTypeACL}
-      <input type=checkbox name="smbgroup" value="1" {$smbgroup}  title="{t}Select to create a samba conform group{/t}">
-{/render}
-{render acl=$sambaGroupTypeACL}
-      <select size="1" name="groupType">
-       {html_options options=$groupTypes selected=$groupType}
-      </select>
-{/render}
-      &nbsp;
-      <LABEL for="">{t}in domain{/t}</LABEL>
-      &nbsp;
-{render acl=$sambaDomainNameACL}
-      <select id="sambaDomainName" size="1" name="sambaDomainName">
-       {html_options values=$sambaDomains output=$sambaDomains selected=$sambaDomainName}
-      </select>
-{/render}
-     </td>
-    </tr>
-    {/if}
-       {if $pickupGroup == "true"}
-    <tr>
-      <td colspan=2> <div style="height:15px; width:100%; border-bottom:1px solid #909090;"></div> </td>
-    </tr>
-    <tr>
-      <td colspan=2> <div style="height:15px; width:100%;"></div> </td>
-    </tr>
-    <tr>
-     <td colspan=2>
-{render acl=$fonGroupACL}
-      <input type=checkbox name="fon_group" value="1" {$fon_group}>{t}Members are in a phone pickup group{/t}
-{/render}
-     </td>
-    </tr>
-       {/if}
-       {if $nagios == "true"}
-    <tr>
-      <td colspan=2> <div style="height:15px; width:100%; border-bottom:1px solid #909090;"></div> </td>
-    </tr>
-    <tr>
-      <td colspan=2> <div style="height:15px; width:100%;"></div> </td>
-    </tr>
-    <tr>
-     <td colspan=2>
-{render acl=$nagiosGroupACL}
-      <input type=checkbox name="nagios_group" value="1" {$nagios_group}>{t}Members are in a nagios group{/t}
-{/render}
-     </td>
-    </tr>
-       {/if}
-   </table>
-
-  </td>
-  <td style="border-left:1px solid #A0A0A0">
-   &nbsp;
-  </td>
-
-  <td style="vertical-align:top;">
-
-   <table summary="" style="width:100%">
-    <tr>
-     <td style="vertical-align:top; width:50%">
-      <b><LABEL for="members">{t}Group members{/t}</LABEL></b>
-      <br>
-{render acl=$memberUidACL}
-      <select style="width:100%; height:380px;" id="members" name="members[]" size=15 multiple>
-       {html_options options=$members}
-               <option disabled>&nbsp;</option>
-      </select>
-{/render}
-      <br>
-      <input type=submit name="edit_membership" value="{t}Add{/t}">
-      &nbsp;
-      <input type=submit name="del_users" value="{t}Delete{/t}">
-     </td>
-    </tr> 
-   </table>
-  </td>
-
- </tr>
-</table>
-
-<input type="hidden" name="groupedit" value="1">
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('cn');
-  -->
-</script>
diff --git a/plugins/admin/groups/group_objects.tpl b/plugins/admin/groups/group_objects.tpl
deleted file mode 100644 (file)
index 5fcdc73..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
-<tr>
-  <td style="vertical-align:top; width:600px">
-   <div class="contentboxh" style="height:20px;">
-    <p class="contentboxh" style="font-size:12px">
-     <b><LABEL for="users">{t}Select users to add{/t}</LABEL> {$hint}</b>
-    </p>
-   </div>
-   <div class="contentboxb">
-    <p class="contentboxb" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-     <select id="users" style="width:600px; height:450px; margin-top:4px;" name="users[]" size="15" multiple>
-      {html_options options=$users}
-     </select>
-     <input type=hidden name="edit_helper">
-    </p>
-   </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>
-                               <input type=checkbox name="SubSearchGroup"  value="1" {if $SubSearchGroup == 1} checked {/if} 
-                                        onClick="mainform.submit()" title="{t}Select to see servers{/t}">{t}Search within subtree{/t}<br>
-                       </td>
-               </tr>   
-       </table>
-    <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-               <tr>
-                       <td>
-                               <img alt="" src="{$tree_image}" align=middle title="{t}Display users of department{/t}">
-                               &nbsp;
-                               <select name="dselect" id="dselect" size=1 onChange="mainform.submit()" 
-                                       title="{t}Choose the department the search will be based on{/t}">
-                               {html_options options=$deplist selected=$dselect}
-                       </select>
-                       </td>
-               </tr>
-       </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 users matching{/t}"></td>
-    <td><input type='text' name='regex' maxlength='20' style='width:99%' value='{$regex}' title='{t}Regular expression for matching user names{/t}' onChange="mainform.submit()"></td></tr></table>
-   {$apply}
-   </div>
-  </td>
-</tr>
-</table>
-
-<p class="plugbottom">
-  <input type=submit name="add_users_finish" value="{t}Add{/t}">
-  &nbsp;
-  <input type=submit name="add_users_cancel" value="{t}Cancel{/t}">
-</p>
-
diff --git a/plugins/admin/groups/mail.tpl b/plugins/admin/groups/mail.tpl
deleted file mode 100644 (file)
index e7eb708..0000000
+++ /dev/null
@@ -1,170 +0,0 @@
-<input type="hidden" name="mailedit" value="1">
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=0 border=0>
-
- <!-- Headline container -->
- <tr>
-  <td style="width:50%; border-right:1px solid #A0A0A0; vertical-align:top">
-   <h2><img class="center" alt="" align="middle" src="images/rightarrow.png"> {t}Generic{/t}</h2>
-   <table summary="">
-    <tr>
-     <td><LABEL for="mail">{t}Primary address{/t}</LABEL>{$must}</td>
-     <td>
-{render acl=$mailACL}
-       <input id="mail" name="mail" size="25" maxlength="65" value="{$mail}" title="{t}Primary mail address for this shared folder{/t}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><LABEL for="gosaMailServer">{t}Server{/t}</LABEL></td>
-     <td>
-{render acl=$gosaMailServerACL}
-      <select size="1" name="gosaMailServer" title="{t}Select mail server to place user on{/t}">
-       {html_options values=$mailServers output=$mailServers selected=$gosaMailServer}
-          <option disabled>&nbsp;</option>
-      </select>
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td>
-      <br>
-       <LABEL for="gosaMailQuota"> {t}Quota usage{/t}</LABEL>
-     </td>
-     <td>
-      <br>
-{if $quotadefined eq "true"}
-       {$quotausage}
-{else}
-       {t}not defined{/t}
-{/if}
-     </td>
-    </tr>
-    <tr>
-     <td>{t}Quota size{/t}</td>
-     <td>
-{render acl=$gosaMailQuotaACL}
-       <input id="gosaMailQuota" name="gosaMailQuota" size="6" align=middle maxlength="30" value="{$gosaMailQuota}">
-{/render}
- {t}MB{/t}
-</td>
-    </tr>
-       {if $kolab}
-       <tr>
-               <td>
-                       {t}Folder type{/t}
-               </td>
-               <td>
-                       <select name="kolabFolderType_Type" onChange="document.mainform.submit();">
-                               {html_options options=$kolabFolderType_Types selected=$kolabFolderType_Type}
-                       </select>
-                       <select name="kolabFolderType_SubType" onChange="document.mainform.submit();">
-                               {html_options options=$kolabFolderType_SubTypes selected=$kolabFolderType_SubType}
-                       </select>
-                       {if !$JS}
-                               <input type='image' src='images/list_reload.png' class='center' alt='{t}Reload{/t}'>
-                       {/if}
-               </td>
-       </tr>
-       {/if}
-   </table>
-     
-  </td>
-  <td style="vertical-align:top;padding-left:2px;">
-   <h2><img class="center" alt="" align="middle" src="images/alternatemail.png"> {t}Alternative addresses{/t}</h2>
-
-{render acl=$gosaMailAlternateAddressACL}
-   <select style="width:100%;" name="alternates_list[]" size=10 multiple title="{t}List of alternative mail addresses{/t}">
-    {html_options values=$gosaMailAlternateAddress output=$gosaMailAlternateAddress}
-       <option disabled>&nbsp;</option>
-   </select>
-{/render}
-
-   <br>
-
-{render acl=$gosaMailAlternateAddressACL}
-   <input name="alternate_address" size="30" align=middle maxlength="60" value="">
-{/render}
-
-{render acl=$gosaMailAlternateAddressACL}
-   <input type=submit value="{t}Add{/t}" name="add_alternate">&nbsp;
-{/render}
-
-{render acl=$gosaMailAlternateAddressACL}
-   <input type=submit value="{t}Delete{/t}" name="delete_alternate">
-{/render}
-
-  </td>
- </tr>
-
-</table>
-
-<p class="seperator">&nbsp;</p>
-
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4 border=0>
- <tr>
-  <td style="vertical-align:top;width:50%; border-right:1px solid #A0A0A0">
-   <h2><img class="center" alt="" align="middle" src="images/members.png"> {t}IMAP shared folders{/t}</h2>
-
-   <table summary="" cellpadding=0 border=0>
-    <tr>
-     <td><LABEL for="default_permissions">{t}Default permission{/t}</LABEL></td>
-     <td>
-{render acl=$aclACL}
-      <select size="1" id="default_permissions" name="default_permissions">
-       {html_options options=$perms selected=$default_permissions}
-          <option disabled>&nbsp;</option>
-      </select>
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><LABEL for="member_permissions">{t}Member permission{/t}</LABEL></td>
-     <td>
-{render acl=$aclACL}
-      <select id="member_permissions" size="1" name="member_permissions">
-       {html_options options=$perms selected=$member_permissions}
-      </select>
-{/render}
-     </td>
-    </tr>
-       {$plusattributes}
-   </table>
-      
-  </td>
-  <td style="vertical-align:top;width:50%">
-   <h2>
-       <img class="center" alt="" align="middle" src="images/envelope.png">
-       {t}Forward messages to non group members{/t}
-   </h2>
-
-{render acl=$gosaMailForwardingAddressACL}
-   <select style="width:100%;" name="forwarder_list[]" size=10 multiple>
-    {html_options values=$gosaMailForwardingAddress output=$gosaMailForwardingAddress}
-       <option disabled>&nbsp;</option>
-   </select>
-{/render}
-
-   <br>
-
-{render acl=$gosaMailForwardingAddressACL}
-   <input name="forward_address" size=20 align=middle maxlength=65 value="">
-{/render}
-{render acl=$gosaMailForwardingAddressACL}
-   <input type=submit value="{t}Add{/t}" name="add_forwarder">&nbsp;
-{/render}
-{render acl=$gosaMailForwardingAddressACL}
-   <input type=submit value="{t}Add local{/t}" name="add_local_forwarder">&nbsp;
-{/render}
-{render acl=$gosaMailForwardingAddressACL}
-   <input type=submit value="{t}Delete{/t}" name="delete_forwarder">
-{/render}
-  </td>
- </tr>
-</table>
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('mail');
-  -->
-</script>
diff --git a/plugins/admin/groups/mail_admins.tpl b/plugins/admin/groups/mail_admins.tpl
deleted file mode 100644 (file)
index 8c95cb0..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-<table summary="" style="width:100%;">
- <tr>
-  <td style="width:45%; vertical-align:top;">
-  <LABEL for="admins"> {t}Folder administrators{/t}</LABEL>
-   <br>
-   <select id="admins" style="width:380px; height:300px;" name="admins[]" size=15 multiple>
-    {html_options options=$admins}
-   </select>
-  </td>
-
-  <td style="width:10%; vertical-align:middle; text-align:center;">
-   <input type=submit name="add_users" value="&larr;" style="width:50px;">
-   <br>
-   <br>
-   <input type=submit name="del_users" value="&rarr;" style="width:50px;">
-  </td>
-
-  <td style="width:45%; vertical-align:top;">
-   <br>
-   <select style="width:380px; height:275px;" name="users[]" size=15 multiple>
-    {html_options options=$mailusers}
-   </select>
-   <br>
-       <LABEL for="department">{t}Select a specific department{/t}</LABEL>:
-   <select id="department" name="department" size=1 onChange="mainform.submit()">
-    {html_options options=$departments selected=$department}
-   </select>
-
-   {if $javascript ne "true"}
-   <input type=submit name="goButton" value="{t}Choose{/t}">
-   {/if}
-  </td>
- </tr>
-</table>
-
-<p class="plugbottom">
- <input type=submit name="edit_admins_finish" value="{t}Apply{/t}">
- &nbsp;
- <input type=submit name="edit_admins_cancel" value="{t}Cancel{/t}">
-</p>
diff --git a/plugins/admin/groups/mail_locals.tpl b/plugins/admin/groups/mail_locals.tpl
deleted file mode 100644 (file)
index 09d734a..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
-<tr>
-  <td style="vertical-align:top; width:600px">
-   <div class="contentboxh" style="height:20px;">
-    <p class="contentboxh" style="font-size:12px">
-     <b><LABEL for="local_list">{t}Select addresses to add{/t} {$hint}</LABEL ></b><br>
-    </p>
-   </div>
-   <div class="contentboxb">
-    <p class="contentboxb" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-     <select style="width:600px; margin-top:4px; height:450px;" id="local_list" name="local_list[]" size="15" multiple>
-               {html_options options=$mailusers}
-               <option disabled>&nbsp;</option>
-     </select>
-    </p>
-   </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="width:100%;border-top:1px solid #B0B0B0; background-color:#F8F8F8">
-               <tr>
-                       <td>
-                               <img alt="" src="{$tree_image}" align=middle title="{t}Display addresses of department{/t}">&nbsp;
-                               <select name="depselect" size=1 onChange="mainform.submit()" title="{t}Choose the department the search will be based on{/t}">
-                       {html_options options=$deplist selected=$depselect}
-                               </select>
-                       </td>
-               </tr>
-       </table>
-    <table summary="" width="100%" style="width:100%;border-top:1px solid #B0B0B0; background-color:#F8F8F8">
-               <tr>
-                       <td width="18">
-                               <img alt="" src="{$search_image}" align=middle title="{t}Display addresses matching{/t}">
-                       </td>
-               <td>
-                               <input type='text' name='regex' maxlength='20' style="width:99%"value='{$regex}' title='{t}Regular expression for matching addresses{/t}' onChange="mainform.submit()">
-                       </td>
-               </tr>
-       </table>
-    <table summary="" width="100%"  style="width:100%;border-top:1px solid #B0B0B0; background-color:#F8F8F8">
-               <tr>
-                       <td width="18">
-                               <img alt="" src="{$usearch_image}" align=middle title="{t}Display addresses of user{/t}">
-                       </td>
-               <td>
-                               <input type='text' name='muser' maxlength='20' value='{$muser}' style="width:99%" title='{t}User name of which addresses are shown{/t}' onChange="mainform.submit()">
-                       </td>
-               </tr>
-       </table>
-   {$apply}
-   </div>
-  </td>
-</tr>
-</table>
-
-<p class="plugbottom">
-  <input type=submit name="add_locals_finish" value="{t}Add{/t}">
-  &nbsp;
-  <input type=submit name="add_locals_cancel" value="{t}Cancel{/t}">
-</p>
diff --git a/plugins/admin/groups/main.inc b/plugins/admin/groups/main.inc
deleted file mode 100644 (file)
index 3a12101..0000000
+++ /dev/null
@@ -1,60 +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
- */
-
-if ($remove_lock){
-  if(isset($_SESSION['groupManagement'])){
-    $groupManagement= $_SESSION['groupManagement'];
-    $groupManagement->remove_lock();
-    del_lock ($ui->dn);
-    sess_del ('groupManagement');
-  }
-} else {
-  /* Create groupManagement object on demand */
-  if (!isset($_SESSION['groupManagement']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
-    $_SESSION['groupManagement']= new groupManagement ($config, $_SESSION['ui']);
-  }
-  $groupManagement= $_SESSION['groupManagement'];
-  $groupManagement->save_object();
-  $output= $groupManagement->execute();
-
-  /* Page header*/
-  if (isset($_SESSION['objectinfo'])){
-    $display= print_header(get_template_path('images/group.png'),
-                           _("Group administration"), "<img alt=\"\" align=\"middle\" src=\"".
-                            get_template_path('images/closedlock.png')."\"> ".
-                            @LDAP::fix($_SESSION['objectinfo']));
-  } else {
-    $display= print_header(get_template_path('images/group.png'), _("Group administration"));
-  }
-
-  $display.= $output;
-
-  /* Reset requested? */
-  if (isset($_GET['reset']) && $_GET['reset'] == 1){
-    del_lock ($ui->dn);
-    sess_del ('groupManagement');
-  }
-
-  /* Show and save dialog */
-  $_SESSION['groupManagement']= $groupManagement;
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/groups/paste_generic.tpl b/plugins/admin/groups/paste_generic.tpl
deleted file mode 100644 (file)
index 26477de..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-<h2>{t}Group settings{/t}</h2>
-<table width='100%'>
-       <tr>
-               <td style='width:150px;'>
-                       {t}Group name{/t}
-               </td>
-               <td>
-                       <input id='cn' name='cn' size='35' maxlength='60' value='{$cn}' title='{t}Posix name of the group{/t}'>
-               </td>
-       </tr>
-       <tr>
-               <td>
-                       <input type=checkbox name='force_gid' value='1' {$used} title='{t}Normally IDs are autogenerated, select to specify manually{/t}' 
-                               onclick='changeState("gidNumber")'>
-                       <LABEL for='gidNumber'>{t}Force GID{/t}</LABEL>
-               </td>
-               <td>
-                       <input name='gidNumber' size=9 maxlength=9 id='gidNumber' {$dis} value='{$gidNumber}' title='{t}Forced ID number{/t}'>
-               </td>
-       </tr>
-</table>
-
-<script language="JavaScript" type="text/javascript">
-       focus_field('cn');
-</script>
diff --git a/plugins/admin/groups/paste_mail.tpl b/plugins/admin/groups/paste_mail.tpl
deleted file mode 100644 (file)
index e30ba9a..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-<h2>{t}Mail settings{/t}</h2>
-<table summary="" style="width:100%; vertical-align:top; text-align:left;">
-       <tr>
-               <td colspan=2>   
-                       <table summary="">
-                       <tr>
-                               <td>
-                                               <LABEL for="mail">{t}Primary address{/t}</LABEL>{$must}
-                                       </td>
-                               <td>
-                                               <input id="mail" name="mail" size="25" maxlength="65" 
-                                                       value="{$mail}" title="{t}Primary mail address for this shared folder{/t}">
-                                       </td>
-                       </tr>
-                       </table>
-               </td>
-       </tr>
-       <tr>
-               <td>
-                       <table style="width:100%; vertical-align:top; text-align:left;">
-                               <tr>
-                                       <td style="width:50%; border-right:1px solid #A0A0A0; vertical-align:top">
-                                                       {t}Alternative addresses{/t}
-                                               <select style="width:100%;" name="alternates_list[]" size=10 multiple title="{t}List of alternative mail addresses{/t}">
-                                                       {html_options values=$gosaMailAlternateAddress output=$gosaMailAlternateAddress}
-                                                       <option disabled>&nbsp;</option>
-                                               </select>
-                                               <br>
-                                               <input name="alternate_address" size="30" align=middle maxlength="60" value="">
-                                               <input type=submit value="{t}Add{/t}" name="add_alternate">&nbsp;
-                                               <input type=submit value="{t}Delete{/t}" name="delete_alternate">
-                                       </td>
-                                       <td style="vertical-align:top;width:50%">
-                                                       {t}Forward messages to non group members{/t}
-                                               <select style="width:100%;" name="forwarder_list[]" size=10 multiple>
-                                                       {html_options values=$gosaMailForwardingAddress output=$gosaMailForwardingAddress}
-                                                       <option disabled>&nbsp;</option>
-                                               </select>
-                                               <br>
-                                               <input name="forward_address" size=20 align=middle maxlength=65 value="">
-                                               <input type=submit value="{t}Add{/t}" name="add_forwarder">&nbsp;
-                                               <input type=submit value="{t}Add local{/t}" name="add_local_forwarder">&nbsp;
-                                               <input type=submit value="{t}Delete{/t}" name="delete_forwarder">
-                                       </td>
-                               </tr>
-                       </table>
-               <td>
-       </tr>
-</table>
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('mail');
-  -->
-</script>
diff --git a/plugins/admin/groups/remove.tpl b/plugins/admin/groups/remove.tpl
deleted file mode 100644 (file)
index 1c93834..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-<div style="font-size:18px;">
-  <img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
-</div>
-<p>
-  {$info}
-  {t}This may be a primary user group. Please double check if you really want to do this since there is no way for GOsa to get your data back.{/t}
-</p>
-
-<p>
-  {t}So - if you're sure - press 'Delete' to continue or 'Cancel' to abort.{/t}
-</p>
-
-<p class="plugbottom">
-
-  {if $multiple}
-  <input type=submit name="delete_multiple_groups_confirm" value="{t}Delete{/t}">
-  &nbsp;
-  <input type=submit name="delete_multiple_group_cancel" value="{t}Cancel{/t}">
-  {else}
-  <input type=submit name="delete_group_confirm" value="{t}Delete{/t}">
-  &nbsp;
-  <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
-  {/if}
-
-
-</p>
-
diff --git a/plugins/admin/groups/tabs_group.inc b/plugins/admin/groups/tabs_group.inc
deleted file mode 100644 (file)
index 094551d..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-<?php
-
-class grouptabs extends tabs
-{
-
-       function grouptabs($config, $data, $dn)
-       {
-               tabs::tabs($config, $data, $dn,"groups");
-               $this->addSpecialTabs();
-       }
-
-       function save_object($save_current= FALSE)
-       {
-               tabs::save_object($save_current);
-
-               /* Update reference, transfer variables */
-               $baseobject= $this->by_object['group'];
-               foreach ($this->by_object as $name => $obj){
-                       /* Don't touch base object */
-                       if ($name != 'group'){
-                               $obj->parent= &$this;
-                               $obj->cn= $baseobject->cn;
-                               $this->by_object[$name]= $obj;
-                       }
-               }
-       }
-
-       function delete()
-       {
-               /* Put baseobjects 'cn' to mailobjects 'uid' */
-               $baseobject= $this->by_object['group'];
-               if (isset($this->by_object['mailgroup'])){
-                       $this->by_object['mailgroup']->uid= $baseobject->cn;
-               }
-               tabs::delete();
-       }
-
-  function save($ignore_account= FALSE)
-       {
-               $baseobject= $this->by_object['group'];
-
-               /* Check for new 'dn', in order to propagate the
-                  'dn' to all plugins */
-               $new_dn= 'cn='.$baseobject->cn.','.get_groups_ou().$baseobject->base;
-
-               /* Put baseobjects 'cn' to mailobjects 'uid' */
-               if (isset($this->by_object['mailgroup'])){
-                       $this->by_object['mailgroup']->uid= $baseobject->cn;
-               }
-
-
-               /* Update reference, transfer variables */
-               foreach ($this->by_object as $name => $obj){
-                       /* Transfer attributes for mailgroup account */
-                       if ($name == 'mailgroup'){
-                               $this->by_object['mailgroup']->members= $baseobject->memberUid;;
-                       }
-               }
-
-               /* Move group? */
-               if ($this->dn != $new_dn){
-
-                       /* Write entry on new 'dn' */
-                       if ($this->dn != "new"){
-                               $baseobject->update_acls($this->dn,$new_dn);
-                               $baseobject->move($this->dn, $new_dn);
-                               $this->by_object['group']= $baseobject;
-                       }
-
-                       /* Happen to use the new one */
-                       $this->dn= $new_dn;
-               }
-
-               $ret= tabs::save();
-
-               /* Fix tagging if needed */
-               $baseobject->dn= $new_dn;
-               $baseobject->handle_object_tagging();
-
-               return $ret;
-       }
-
-       function saveCopyDialog()
-       {
-               tabs::saveCopyDialog();
-               
-               /* Update reference, transfer variables */
-               $baseobject= $this->by_object['group'];
-               foreach ($this->by_object as $name => $obj){
-                       /* Don't touch base object */
-                       if ($name != 'group'){
-                               $obj->parent= &$this;
-                               $obj->cn= $baseobject->cn;
-                               $this->by_object[$name]= $obj;
-                       }
-               }
-       }
-       
-}
-
-?>
diff --git a/plugins/admin/mimetypes/class_divListMimeTypes.inc b/plugins/admin/mimetypes/class_divListMimeTypes.inc
deleted file mode 100755 (executable)
index 1c8677f..0000000
+++ /dev/null
@@ -1,343 +0,0 @@
-<?php
-
-class divListMimeTypes extends MultiSelectWindow
-{
-  /* Current base */
-  var $selectedBase       = "";
-  var $selectedRelease    = "main";
-  var $AvailableReleases  = array();
-  var $departments        = array();
-  var $parent               ;
-  var $ui                   ;
-
-  /* Regex */
-  var $Regex              = "*";
-
-  /* Subsearch checkbox */
-  var $SubSearch;
-
-  /* These vars should be saved too */
-  var $SaveAdditionalVars = array("selectedRelease");
-
-
-  function divListMimeTypes (&$config, &$parent)
-  {
-    /* Create divlist and setup */
-    MultiSelectWindow::MultiSelectWindow($config, "Mimetypes", "mimetypes");
-  
-    /* initialize required attributes */ 
-    $this->selectedRelease  = "ou=mime,".$_SESSION['CurrentMainBase'];
-    $this->parent           = &$parent;
-    $this->ui               = get_userinfo();
-    $this->AvailableReleases= $this->parent->getReleases($this->selectedBase);
-
-    /* Set list strings */
-    $this->SetTitle       (_("List of defined mime types"));
-    $this->SetSummary     (_("List of defined mime types"));
-    $this->SetInformation (_("This menu allows you to add, edit and remove selected mime types. You may want to use the range selector on top of the mime type listbox, when working with a large number of mime types."));
-
-    /* Result page will look like a headpage */
-    $this->SetHeadpageMode();
-    $this->EnableAplhabet(true);
-  
-    /* Disable buttonsm */
-    $this->EnableCloseButton(false);
-    $this->EnableSaveButton (false);
-
-    /* set Page header */
-    $action_col_size = 80;
-    if($this->parent->snapshotEnabled()){
-      $action_col_size += 38;
-    }
-
-    /* Toggle all selected / deselected */
-    $chk = "<input type='checkbox' id='select_all' name='select_all'
-               onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
-
-    /* set Page header */
-    $this->AddHeader(array("string"=> $chk,          "attach"=>"style='width:20px;'"));
-    $this->AddHeader(array("string" => "&nbsp;",                "attach" => "style='text-align:center;width:20px;'"));
-    $this->AddHeader(array("string" => _("Mime type name")." / "._("Department"), "attach" => "style=''"));
-    $this->AddHeader(array("string" => _("Actions"),            "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'"));
-
-    /* Add SubSearch checkbox */
-    $this->AddCheckBox("SubSearch",  _("Select to search within subtrees"), _("Search in subtrees"), false);
-
-    /*                  Name                 ,Text                              ,Default  , Connect with alphabet  */
-    $this->AddRegex   ("Regex",     _("Display mime types matching"),"*" , true);
-  }
-
-
-  /* This function allows us to add a user defined filter part at position $position*/
-  function AddUserBoxToFilter($position)
-  {
-    $str = "";
-    if(($position  == 2) && ($this->parent->IsReleaseManagementActivated($this->config))){
-      $smarty = get_smarty();
-      $smarty->assign("selectedRelease",$this->selectedRelease);
-      $smarty->assign("branchimage","images/branch.png");
-      $smarty->assign("releases",$this->AvailableReleases);
-      $str = $smarty->fetch(get_template_path('release_select.tpl', TRUE,dirname(__FILE__)));
-    }
-    return($str);
-  }
-
-
-  /* Create list header, with create / copy & paste etc*/
-  function GenHeader()
-  {
-    /* Prepare departments,
-       which are shown in the listbox on top of the listbox
-     */
-    $options= "";
-
-    /* Get all departments within this subtree */
-    $ui= get_userinfo();
-    $first = "";
-    $found = FALSE;
-    $base = $this->config->current['BASE'];
-
-    /* Add base */
-    $tmp = array();
-    $tmp[] = array("dn"=>$this->config->current['BASE']);
-    $tmp=  array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
-                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
-
-    $deps = array();
-    foreach($tmp as $tm){
-      $deps[$tm['dn']] = $tm['dn'];
-    }
-
-    /* Load possible departments */
-    $ui= get_userinfo();
-    $tdeps= $ui->get_module_departments($this->module);
-    $ids = $this->config->idepartments;
-    $first = "";
-    $found = FALSE;
-    foreach($ids as $dep => $name){
-      if(isset($deps[$dep]) && in_array_ics($dep, $tdeps)){
-
-        /* Keep first base dn in mind, we could need this
-         *  info if no valid base was found
-         */
-        if(empty($first)) {
-          $first = $dep['dn'];
-        }
-
-        $value = $ids[$dep];
-        if ($this->selectedBase == $dep){
-          $found = TRUE;
-          $options.= "<option selected='selected' value='".$dep."'>$value</option>";
-        } else {
-          $options.= "<option value='".$dep."'>$value</option>";
-        }
-      }
-    }
-
-    /* The currently used base is not visible with your acl setup.
-     * Set base to first useable base.
-     */
-    if(!$found){
-      $this->selectedBase = $first;
-    }
-
-    /* Get acls */
-    $ui       = get_userinfo();
-    $acl      = $ui->get_permissions("cn=dummy,ou=mimetypes,".$this->selectedBase,"mimetypes/mimetype");
-    $acl_all  = $ui->has_complete_category_acls($this->selectedBase,"mimetypes") ;
-
-
-    /* If this is true we add an additional seperator. Just look a few lines below */  
-    $add_sep = false;
-    /* Get copy & paste icon */
-    $Copy_Paste ="";
-    if(preg_match("/(c.*w|w.*c)/",$acl_all) &&  $this->parent->CopyPasteHandler){
-      $Copy_Paste = $this->parent->CopyPasteHandler->generatePasteIcon();
-      $add_sep = true;
-    }
-
-    /* Add default header */
-    $listhead = MultiSelectWindow::get_default_header();
-
-    /* And at least add a department selection box */
-    $listhead .=  _("Base")."&nbsp;<select name='CurrentMainBase' 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;";
-
-    /* Create Layers menu */
-    $s  = ".|"._("Actions")."|\n";
-    $s .= "..|<img src='images/list_new.png' alt='' border='0' class='center'>".
-      "&nbsp;"._("Create")."|\n";
-
-    /* Append create options */
-    if(preg_match("/c/",$acl)) {
-      $s.= "...|<input class='center' type='image' src='images/list_new_mime.png' alt=''>".
-        "&nbsp;"._("Mime type")."|mime_new|\n";
-    }
-
-    /* Multiple options */
-    $s.= "..|---|\n";
-    $s.= "..|<img src='images/edittrash.png' alt='' border='0' class='center'>".
-      "&nbsp;"._("Remove")."|"."remove_multiple|\n";
-
-    /* Add multiple copy & cut icons */
-    if(is_object($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
-      $s.= "..|---|\n";
-      $s.= "..|<img src='images/editcopy.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Copy")."|"."multiple_copy_systems|\n";
-      $s.= "..|<img src='images/editcut.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Cut")."|"."multiple_cut_systems|\n";
-
-      if($this->parent->CopyPasteHandler->entries_queued()){
-        $img = "<img border='0' class='center' src='images/editpaste.png' alt=''>";
-        $s.="..|".$img."&nbsp;"._("Paste")."|editPaste|\n";
-      }else{
-        $img = "<img border='0' class='center' src='images/cant_editpaste.png' alt=''>";
-        $s.="..|".$img."&nbsp;"._("Paste")."\n";
-      }
-    }
-
-    /* Add snapshot icons */
-    if(preg_match("/(c.*w|w.*c)/",$acl_all)){
-      $s .= "..|---|\n";
-      $s .= $this->get_snapshot_header(TRUE);
-    }
-
-    $this->SetDropDownHeaderMenu($s);
-    $this->SetListHeader($listhead);
-  }
-
-
-  /* Some basic settings */
-  function execute()
-  {
-    $this->ClearElementsList();
-    $this->GenHeader();
-  }
-
-
-  function setEntries($list)
-  {
-    /********************
-      Variable init
-     ********************/
-
-    /* Create links */
-    $linkopen = "<a href='?plug=".$_GET['plug']."&amp;act=dep_open&amp;dep_id=%s'>%s</a>";
-    $editlink = "<a href='?plug=".$_GET['plug']."&amp;id=%s&amp;act=edit_entry'>%s</a>";
-    $userimg  = "<img class='center' src='images/select_groups.png' alt='User'    title='%s'>";
-    $mimeimg  = "<img class='center' src='images/select_mimetype.png' alt='A'  title='"._("Mime type")."'>";
-    $empty    = "<img class='center' src='images/empty.png' style='width:16px;height:16px;' alt=''>";
-
-    /* set Page header */
-    $action_col_size = 80;
-    if($this->parent->snapshotEnabled()){
-      $action_col_size += 38;
-    }
-
-    /********************
-      Attach objects
-     ********************/
-
-    foreach($list as $key => $val){
-
-      $ui       = get_userinfo();
-      $acl      = $ui->get_permissions($val['dn'],"mimetypes/mimetype");
-      $acl_all  = $ui->has_complete_category_acls($val['dn'],"mimetypes") ;
-
-      /* Create action icons */
-      $actions = "";
-      if(preg_match("/(c.*w|w.*c)/",$acl_all)){
-        $actions .= $this->GetSnapShotActions($val['dn']);
-      }
-
-      /* Get copy Paste icons */
-      if(($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
-        $actions.= "<input class='center' type='image'
-          src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
-        $actions.= "<input class='center' type='image'
-          src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
-      }
-
-      $actions.= "<input class='center' type='image'
-        src='images/edit.png' alt='"._("edit")."' name='mime_edit_%KEY%' title='"._("Edit this entry")."'>";
-
-      /* Add delete button */
-      if(preg_match("/d/",$acl)){
-        $actions.= "<input class='center' type='image'
-          src='images/edittrash.png' alt='"._("delete")."' name='mime_del_%KEY%' title='"._("Delete this entry")."'>";
-      }else{
-        $actions.= "<img src='images/empty.png' alt='&nbsp;' class='center'>";
-      }
-
-      $title = "title='".preg_replace('/ /', '&nbsp;', @LDAP::fix($val['dn']))."'";
-
-      if(!isset($val['description'][0])){
-        $desc = "";
-      }else{
-        $desc = " - [ ".$val['description'][0]." ]";
-      }
-
-      /* Cutted objects should be displayed in light grey */
-      $display = $val['cn'][0].$desc;
-      if($this->parent->CopyPasteHandler){
-        foreach($this->parent->CopyPasteHandler->queue as $queue_key => $queue_data){
-          if($queue_data['dn'] == $val['dn']) {
-            $display = "<font color='#999999'>".$display."</font>";
-            break;
-          }
-        }
-      }
-
-
-      /* Create each field */
-      $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
-                      "attach" => "style='width:20px;'");
-      $field1 = array("string" => sprintf($mimeimg,$val['dn']), "attach" => "style='text-align:center;width:20px;'");
-      $field2 = array("string" => sprintf($editlink,$key,$display), "attach" => "style='' ".$title);
-      $field3 = array("string" => preg_replace("/%KEY%/", $key, $actions), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'");
-      $this->AddElement(array($field0,$field1,$field2,$field3));
-    }
-
-
-    /* Create summary string for list footer */
-    $num_deps=0;
-    if(!$this->SubSearch){
-      $num_deps = count($this->Added_Departments);
-    }
-    $num_objs = count($list);
-
-    $num_obj_str = _("Number of listed mimetypes");
-    $num_dep_str = _("Number of listed departments");
-
-    $str = "<img class='center' src='images/select_mimetype.png'
-              title='".$num_obj_str."' alt='".$num_obj_str."'>&nbsp;".$num_objs."&nbsp;&nbsp;&nbsp;&nbsp;";
-    $str.= "<img class='center' src='images/folder.png'
-              title='".$num_dep_str."' alt='".$num_dep_str."'>&nbsp;".$num_deps."&nbsp;&nbsp;&nbsp;&nbsp;";
-
-    $this->set_List_Bottom_Info($str);
-  }
-
-  function Save()
-  {
-    MultiSelectWindow::Save();  
-  }
-
-  function save_object()
-  {
-    /* Save automatic created POSTs like regex, checkboxes */
-    MultiSelectWindow::save_object(); 
-
-    /* check if returned selectedRelease is a valid release.
-        If it isn't set to a valid release */
-    $this->AvailableReleases = $this->parent->getReleases($this->selectedBase);
-    if(!isset($this->AvailableReleases[$this->selectedRelease])){
-      $this->selectedRelease =key($this->AvailableReleases);
-    }
-    $_SESSION['mimefilter']['release']  = $this->selectedRelease;
-  }
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/mimetypes/class_mimetypeGeneric.inc b/plugins/admin/mimetypes/class_mimetypeGeneric.inc
deleted file mode 100644 (file)
index 38b695e..0000000
+++ /dev/null
@@ -1,755 +0,0 @@
-<?php
-class mimetype extends plugin
-{
-       /* CLI vars */
-       var $cli_summary                  = "This tab allows you to modify, add or remove mime types in the selected department.";
-       var $cli_description    = "Management dialog to handle mime types";
-       var $ignore_account     = true; // This is always a valid account
-       var $cli_parameters             = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-       var $objectclasses              = array("top","gotoMimeType");
-       var $attributes                   = array("cn","gotoMimeApplication","gotoMimeLeftClickAction","gotoMimeIcon",
-                                                                       "description","gotoMimeFilePattern","gotoMimeEmbeddedApplication",
-                                                                       "gotoMimeGroup");       
-
-       /* Class vars */
-       var $ui;
-       var $cn                                                                               = "";                                     
-       var $gotoMimeLeftClickAction                        = "I";
-       var $gotoMimeLeftClickAction_I              = true;
-       var $gotoMimeLeftClickAction_E              = false;
-       var $gotoMimeLeftClickAction_Q              = false;
-       var $gotoMimeIcon                                                         = "*removed*";
-       var $description                                                          = "";
-       var $gotoMimeFilePattern                                      = array();
-       var $gotoMimeApplication                                      = array();
-       var $gotoMimeEmbeddedApplication            = array();
-       var $gotoMimeGroup                                                      = "";
-       var $iconData                                                               = NULL;     
-       var $base                                                                             = "";
-  var $ApplicationList                  = array();  
-
-
-  /* To prevent errors when using the 'apply' button, we use this variables 
-      to manage array attributes */
-       var $use_gotoMimeIcon                                           = NULL;
-       var $use_gotoMimeFilePattern                        = array();
-       var $use_gotoMimeApplication                        = array();
-       var $use_gotoMimeEmbeddedApplication    = array();
-
-  /* divLists */
-  var $DivPatterns                                                       = NULL;
-  var $DivApps                                                             = NULL;
-  var $DivEApps                                                                    = NULL;
-
-  /* Mime type release mode */
-  var $isReleaseMimeType                                             = false;
-
-  /* These vars will be copied too, if you use copy&paste mode */
-  var $CopyPasteVars        = array("use_gotoMimeFilePattern","use_gotoMimeApplication","use_gotoMimeEmbeddedApplication","iconData",
-                                    "gotoMimeLeftClickAction_I","gotoMimeLeftClickAction_E","gotoMimeLeftClickAction_Q","use_gotoMimeIcon");
-
-  var $view_logged  = FALSE;
-
-  /* Select options */
-  var $MimeGroups                            = array("application","audio","chemical","image","inode","message","model",
-                                      "multipart","text","video","x-conference","x-world");
-
-  /* Orig_Dn is used to verify if this object is new or only edited */         
-  var $orig_dn                 = "";
-
-  function mimetype(&$config,$dn= NULL)
-  {
-    plugin::plugin ($config, $dn);
-
-    /* Save original dn */
-    $this->orig_dn = $dn;      
-
-    /* get gotoMimeLeftClickActions I/E/Q */
-    if(isset($this->gotoMimeLeftClickAction)){
-      $str = $this->gotoMimeLeftClickAction;
-      for($i = 0 ; $i < strlen($str) ; $i ++ ){
-        $varna = "gotoMimeLeftClickAction_". $str[$i];
-        if(isset($this->$varna)){
-          $this->$varna = true;
-        }
-      }
-    }
-
-    /* Create list of defined applications in GOsa */
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(&(objectClass=gosaApplication)(cn=*))",array('cn'));
-    $this->ApplicationList = array();
-    while($attrs = $ldap->fetch()){
-      $this->ApplicationList[$attrs['cn'][0]] = $attrs['cn'][0];
-    }
-
-    /* If both radio buttons arn't set, set option I */
-    if(!$this->gotoMimeLeftClickAction_I && !$this->gotoMimeLeftClickAction_E){
-      $this->gotoMimeLeftClickAction_I = true;
-    }
-
-    /* Get list of array attributes */
-    foreach(array("gotoMimeFilePattern") as $attr){
-      $this->$attr = array();
-      if(isset($this->attrs[$attr])){
-        $tmp = array();
-        for($i = 0 ; $i < $this->attrs[$attr]['count'] ; $i ++){
-          $str = $this->attrs[$attr][$i];
-          $tmp[] = $str;
-        }
-        $use_attr = "use_".$attr;
-        $this->$use_attr = $tmp;
-      }
-    }
-
-    /* Get list of array attributes with priority tag ( Test|32 )*/
-    foreach(array("gotoMimeApplication","gotoMimeEmbeddedApplication") as $attr){
-      $this->$attr = array();
-      if(isset($this->attrs[$attr])){
-        $tmp = array();
-        for($i = 0 ; $i < $this->attrs[$attr]['count'] ; $i ++){
-          $str = $this->attrs[$attr][$i];
-          $tmp2= split("\|",$str);
-
-          if(count($tmp2) == 2){
-            $name = $tmp2[0];
-            $prio = $tmp2[1];
-            $tmp[$prio] = $name;
-          }
-        }
-        ksort($tmp);
-        $use_attr = "use_".$attr;
-        $this->$use_attr = $tmp;
-      }
-    }
-
-    /* Check if release Management is enabled */
-    $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
-    if(!empty($tmp)) {
-      $this->isReleaseMimeType= true;
-    }
-
-    /* Set base */     
-    if ($this->dn == "new"){
-      if(isset($_SESSION['CurrentMainBase'])){
-        $this->base= $_SESSION['CurrentMainBase'];
-      }else{
-        $ui= get_userinfo();
-        $this->base= dn2base($ui->dn);
-      }
-    } else {
-      $this->base= preg_replace ("/^[^,]+,[^,]+,/", "", $this->dn);
-    }
-
-    /* Get icon data */
-    if(isset($this->attrs['gotoMimeIcon'])){
-      $ldap = $this->config->get_ldap_link();
-      $this->iconData = $ldap->get_attribute($this->dn,"gotoMimeIcon");
-      $this->saved_attributes['gotoMimeIcon'] = $this->iconData;
-    }
-    if ($this->iconData == ""){
-      $this->set_new_picture("");
-    }
-    $_SESSION['binary']                        = $this->iconData;
-    $_SESSION['binarytype']            = "image/jpeg";
-  }
-
-
-  function execute()
-  {
-    $smarty = get_smarty();
-
-    if(!$this->view_logged){
-      $this->view_logged =TRUE;
-      new log("view","mimetypes/".get_class($this),$this->dn);
-    }
-
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translation){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-
-    /* Base select dialog */
-    $once = true;
-    foreach($_POST as $name => $value){
-      if(preg_match("/^chooseBase/",$name) && $once){
-        $once = false;
-        $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
-        $this->dialog->setCurrentBase($this->base);
-      }
-    }
-
-    /* Dialog handling */
-    if(is_object($this->dialog)){
-
-      /* Must be called before save_object */
-      $this->dialog->save_object();
-
-      if($this->dialog->isClosed()){
-        $this->dialog = false;
-      }elseif($this->dialog->isSelected()){
-
-        /* A new base was selected, check if it is a valid one */
-        $tmp = $this->get_allowed_bases();
-        if(isset($tmp[$this->dialog->isSelected()])){
-          $this->base = $this->dialog->isSelected();
-        }
-
-        $this->dialog= false;
-      }else{
-        return($this->dialog->execute());
-      }
-    }
-
-    /* Check Posts */
-    $posts = array(    
-        "/^Pattern_SortUp_/"   => array("Action" => "Pattern_SortUp",  "Func" => "ArrayUp",    "Attr" => "use_gotoMimeFilePattern"),
-        "/^Pattern_SortDown_/"         => array("Action" => "Pattern_SortDown","Func" => "ArrayDown",  "Attr" => "use_gotoMimeFilePattern"),
-        "/^Pattern_Remove_/"   => array("Action" => "Pattern_Remove",  "Func" => "ArrayRemove","Attr" => "use_gotoMimeFilePattern"),
-        "/^Apps_SortUp_/"              => array("Action" => "Apps_SortUp",             "Func" => "ArrayUp",    "Attr" => "use_gotoMimeApplication"),
-        "/^Apps_SortDown_/"    => array("Action" => "Apps_SortDown",   "Func" => "ArrayDown",  "Attr" => "use_gotoMimeApplication"),
-        "/^Apps_Remove_/"              => array("Action" => "Apps_Remove",             "Func" => "ArrayRemove","Attr" => "use_gotoMimeApplication"),
-        "/^EApps_SortUp_/"             => array("Action" => "EApps_SortUp",    "Func" => "ArrayUp",    "Attr" => "use_gotoMimeEmbeddedApplication"),
-        "/^EApps_SortDown_/"   => array("Action" => "EApps_SortDown",  "Func" => "ArrayDown",  "Attr" => "use_gotoMimeEmbeddedApplication"),
-        "/^EApps_Remove_/"             => array("Action" => "EApps_Remove",    "Func" => "ArrayRemove","Attr" => "use_gotoMimeEmbeddedApplication"));          
-    $once = true;
-
-    /* Walk through posts and try to find some commands for us. */
-    foreach($_POST as $name => $value){
-
-      /* Walk through possible commands */
-      foreach($posts as $regex => $action){
-
-        /* Check if there is a command posted */
-        if(preg_match($regex,$name) && $once){
-          $once = false;
-
-          /* Get action vars */
-          $func                = $action['Func'];              // Get function name 
-          $attr                = $action['Attr'];              // Get attribute name
-
-          /* Get entry id */
-          $s_entry     = preg_replace($regex,"",$name);
-          $s_entry     = preg_replace("/_[xy]$/","",$s_entry); 
-
-          /* Execute a command with the given attribute and entry 
-             e.g. $this->gotoMimeFilePattern = $this->ArrayUp(3,$this->gotoMimeFilePattern) */
-          if($this->acl_is_writeable($attr)){
-            $this->$attr= $this->$func($s_entry,$this->$attr,true);                                     
-          }
-        }
-      }
-    }
-
-    /* Set a new icon was requested */
-    if(isset($_POST['update_icon']) && (isset($_FILES['picture_file']['name']))){
-      $this->set_new_picture($_FILES['picture_file']['tmp_name']);             
-    }
-
-    /* Add gotoMimeFilePattern */
-    if(isset($_POST['AddNewFilePattern']) && isset($_POST['NewFilePattern'])){
-      if($this->acl_is_writeable("gotoMimeFilePattern")){
-        $str = $_POST['NewFilePattern'];
-        if(!empty($str)){
-          $this->use_gotoMimeFilePattern[] = $str;
-        }
-      }
-    }  
-
-    /* Add gotoMimeFilePattern */
-    if(isset($_POST['AddNewApplication']) && 
-            (isset($_POST['NewApplication']) || isset($_POST['NewApplicationSelect']))){
-      if($this->acl_is_writeable("gotoMimeApplication")){
-        $str = "";
-        if(isset($_POST['NewApplicationSelect']) && !empty($_POST['NewApplicationSelect'])){
-          $str = get_post("NewApplicationSelect");
-        }
-        if(isset($_POST['NewApplication']) && !empty($_POST['NewApplication'])){
-          $str = get_post("NewApplication");
-        }
-        if(!empty($str) && !in_array($str,$this->use_gotoMimeApplication)){
-          $this->use_gotoMimeApplication[] = $str;
-        }
-      }
-    }  
-
-    /* Add embedded application 
-     *  - From input or from select box 
-     */
-    if(isset($_POST['AddNewEmbeddedApplication']) && 
-            (isset($_POST['NewEmbeddedApplication']) || isset($_POST['NewEmbeddedApplicationSelect']))){
-      if($this->acl_is_writeable("gotoMimeEmbeddedApplication")){
-        $str = "";
-        if(isset($_POST['NewEmbeddedApplicationSelect']) && !empty($_POST['NewEmbeddedApplicationSelect'])){
-          $str = get_post('NewEmbeddedApplicationSelect');
-        }
-        if(isset($_POST['NewEmbeddedApplication']) && !empty($_POST['NewEmbeddedApplication'])){
-          $str = get_post('NewEmbeddedApplication');
-        }
-        if(!empty($str) && !in_array($str,$this->use_gotoMimeEmbeddedApplication)){
-          $this->use_gotoMimeEmbeddedApplication[] = $str;
-        }
-      }
-    }  
-
-    /* Create divlists */
-    $DivPatterns       = new divSelectBox("gotoMimePatterns");
-    $DivApps           = new divSelectBox("gotoMimeApplications");
-    $DivEApps          = new divSelectBox("gotoMimeEmbeddedApplications");
-    $DivPatterns       -> SetHeight(100);
-    $DivApps           -> SetHeight(100);
-    $DivEApps          -> SetHeight(100);
-
-
-    if($this->acl_is_writeable("gotoMimeFilePattern")){
-      $Pattern_Actions= " <input type='image' src='images/sort_up.png'         class='center'  name='Pattern_SortUp_%s' >&nbsp;
-      <input type='image' src='images/sort_down.png'   class='center'  name='Pattern_SortDown_%s'>&nbsp;
-      <input type='image' src='images/edittrash.png'   class='center'  name='Pattern_Remove_%s'>";
-    }else{
-      $Pattern_Actions= "";    
-    }
-
-    if($this->acl_is_writeable("gotoMimeApplication")){
-      $Apps_Actions    = " <input type='image' src='images/sort_up.png'        class='center'  name='Apps_SortUp_%s' >&nbsp;
-      <input type='image' src='images/sort_down.png'   class='center'  name='Apps_SortDown_%s'>&nbsp;
-      <input type='image' src='images/edittrash.png'   class='center'  name='Apps_Remove_%s'>";
-    }else{
-      $Apps_Actions= "";       
-    }
-
-    if($this->acl_is_writeable("gotoMimeEmbeddedApplication")){
-      $EApps_Actions   = " <input type='image' src='images/sort_up.png'        class='center'  name='EApps_SortUp_%s' >&nbsp;
-      <input type='image' src='images/sort_down.png'   class='center'  name='EApps_SortDown_%s'>&nbsp;
-      <input type='image' src='images/edittrash.png'   class='center'  name='EApps_Remove_%s'>";
-    }else{
-      $EApps_Actions= "";      
-    }
-
-    /* Before adding some entries check acls */
-    if($this->acl_is_readable("gotoMimeFilePattern")){
-      foreach($this->use_gotoMimeFilePattern as $key => $pattern){
-        $field1 = array("string" => $pattern);
-        $field2 = array("string" => preg_replace("/%s/",$key,$Pattern_Actions),"attach"=>"style='border-right:0px;width:50px;'");
-        $fields = array($field1,$field2);
-        $DivPatterns -> AddEntry($fields);
-      }                        
-    }
-
-    if($this->acl_is_readable("gotoMimeApplication")){
-      foreach($this->use_gotoMimeApplication as $key => $pattern){
-        $field1 = array("string" => $pattern);
-        $field2 = array("string" => preg_replace("/%s/",$key,$Apps_Actions),"attach"=>"style='border-right:0px;width:50px;'");
-        $fields = array($field1,$field2);
-        $DivApps -> AddEntry($fields);
-      }                        
-    }                  
-    if($this->acl_is_readable("gotoMimeEmbeddedApplication")){
-      foreach($this->use_gotoMimeEmbeddedApplication as $key => $pattern){
-        $field1 = array("string" => $pattern);
-        $field2 = array("string" => preg_replace("/%s/",$key,$EApps_Actions),"attach"=>"style='border-right:0px;width:50px;'");
-        $fields = array($field1,$field2);
-        $DivEApps -> AddEntry($fields);
-      }
-    }                  
-    $smarty->assign("bases",                                           $this->get_allowed_bases());            
-    $smarty->assign("base_select",                                     $this->base);           
-    $smarty->assign("isReleaseMimeType",                       $this->isReleaseMimeType);
-    $smarty->assign("gotoMimeFilePatterns",                    $DivPatterns->DrawList());
-    $smarty->assign("gotoMimeApplications",                    $DivApps->DrawList());
-    $smarty->assign("gotoMimeEmbeddedApplications",    $DivEApps->DrawList());
-
-    $smarty->assign("ApplicationList",$this->ApplicationList);
-  
-    /* Assign class vars to smarty */
-    foreach($this->attributes as $attr){
-      $smarty->assign($attr,$this->$attr);
-    }  
-
-    /* Assign additional vars that are not included in attributes*/
-    foreach(array("gotoMimeLeftClickAction_I","gotoMimeLeftClickAction_E","gotoMimeLeftClickAction_Q") as $attr){
-      $smarty->assign($attr,$this->$attr);
-    }  
-
-    /* Assign select box options */
-    $smarty->assign("gotoMimeGroups",$this->MimeGroups);
-    $smarty->assign("gotoMimeIcon"     ,$this->get_picture());
-    return($smarty->fetch(get_template_path("generic.tpl",TRUE,dirname(__FILE__))));
-  }
-
-
-  function save_object()
-  {
-    if(isset($_POST['MimeGeneric'])){
-
-      /* Create a base backup and reset the
-         base directly after calling plugin::save_object();
-         Base will be set seperatly a few lines below */
-      $base_tmp = $this->base;
-      plugin::save_object();
-      $this->base = $base_tmp;
-  
-      /* Only save base if we are not in release mode */
-      if(!$this->isReleaseMimeType){
-
-        /* Set new base if allowed */
-        $tmp = $this->get_allowed_bases();
-        if(isset($_POST['base'])){
-          if(isset($tmp[$_POST['base']])){
-            $this->base= $_POST['base'];
-          }
-        }
-
-      }
-
-      /* Save radio buttons */
-      if($this->acl_is_writeable("gotoMimeLeftClickAction")){
-        if(isset($_POST['gotoMimeLeftClickAction_IE'])){
-          $chr = $_POST['gotoMimeLeftClickAction_IE'];
-          if($chr == "E"){
-            $this->gotoMimeLeftClickAction_E = true;
-            $this->gotoMimeLeftClickAction_I = false;
-          }else{
-            $this->gotoMimeLeftClickAction_E = false;
-            $this->gotoMimeLeftClickAction_I = true;
-          }
-        }
-        if(isset($_POST['gotoMimeLeftClickAction_Q'])){
-          $this->gotoMimeLeftClickAction_Q = true;
-        }else{
-          $this->gotoMimeLeftClickAction_Q = false;
-        }
-      }
-    }
-  }
-
-
-  /* save current changes */
-  function save()
-  {
-    /* Create gotoMimeLeftClickAction out of checkboxes and radio buttons */   
-    $arr = array ("E","I","Q");
-    $str = "";
-    foreach ($arr as $Chr){
-      $var = "gotoMimeLeftClickAction_".$Chr;
-      if($this->$var){
-        $str .= $Chr;
-      }
-    }
-    $this->gotoMimeLeftClickAction = $str;
-
-    /* Create array entries with priority tag ( Test|3 )*/
-    foreach(array("gotoMimeEmbeddedApplication","gotoMimeApplication") as $attr){
-      $i                               = 0;
-      $use_attr                = "use_".$attr;
-      $tmp                     = array();
-      $this->$attr     = array();
-      foreach($this->$use_attr as $entry){
-        $tmp[] = $entry."|".$i ++;
-      }
-      $this->$attr = $tmp;
-    }
-
-    /* Create array entries */
-    foreach(array("gotoMimeFilePattern") as $attr){
-      $i                               = 0;
-      $use_attr                = "use_".$attr;
-      $tmp                     = array();
-      $this->$attr     = array();
-      foreach($this->$use_attr as $entry){
-        $tmp[] = $entry;
-      }
-      $this->$attr = $tmp;
-    }
-
-    /* Remove Icon if requested  */
-    if($this->use_gotoMimeIcon != "*removed*"){
-      $this->gotoMimeIcon = $this->iconData;
-    }else{
-      $this->gotoMimeIcon = "";
-    }
-
-    plugin::save();
-
-    /* If this is a newly created object, skip storing those 
-       attributes that contain an empty array */
-    if($this->orig_dn == "new"){
-      foreach(array("gotoMimeEmbeddedApplication","gotoMimeApplication","gotoMimeFilePattern") as $attr){
-        if(!count($this->$attr)){
-          unset($this->attrs[$attr]);
-        }
-      }
-    }
-
-    $ldap = $this->config->get_ldap_link();
-    $ldap-> cd ( $this->config->current['BASE']);
-    $ldap->cat($this->dn);
-    if($ldap->count()){
-      $ldap->cd($this->dn);
-      $this->cleanup();
-      $ldap->modify($this->attrs);
-      new log("modify","mimetypes/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }else{
-      $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
-      $ldap->cd($this->dn);
-      $ldap->add($this->attrs);
-      new log("create","mimetypes/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of mime type/generic with dn '%s' failed."),$this->dn));
-  }
-
-
-  /* Remove current mime type */
-  function remove_from_parent()
-  {
-    plugin::remove_from_parent();
-    $ldap = $this->config->get_ldap_link();
-    $ldap->rmDir($this->dn);
-    show_ldap_error($ldap->get_error(), sprintf(_("Removing of mime type/generic with dn '%s' failed."),$this->dn));
-    new log("remove","mimetypes/".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");
-
-    /* Delete references to object groups */
-    $ldap->cd ($this->config->current['BASE']);
-    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
-    while ($ldap->fetch()){
-      $og= new ogroup($this->config, $ldap->getDN());
-      unset($og->member[$this->dn]);
-      $og->save ();
-      show_ldap_error($ldap->get_error(), sprintf(_("Removing mime type from objectgroup '%s' failed"), $og->dn));
-    }
-  }
-
-
-  /* Check given values */
-  function check()
-  {
-    $message = plugin::check();
-    if(empty($this->cn)){
-      $message[] = _("Please specify a valid name for this mime type.");
-    }
-    if(!count($this->use_gotoMimeFilePattern)){
-      $message[] = _("Please specify at least one file pattern.") ;
-    }
-
-    /* Check if there is already a mime type with this cn */
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->config->current["BASE"]);
-    if($this->isReleaseMimeType && (isset($_SESSION['mimefilter']['release']))){
-      $baseDn = str_replace($this->config->current['BASE'],$this->base,$_SESSION['mimefilter']['release']);
-      $baseDn = preg_replace("/ou=mime,.*/","ou=mime,".$this->base,$_SESSION['mimefilter']['release']);
-      $ldap->ls("(&(objectClass=gotoMimeType)(cn=".$this->cn."))",$baseDn,array("cn"));
-      if($ldap->count()){
-        $attrs = $ldap->fetch();
-        if($this->dn != $attrs['dn']) {
-          $message[]= _("There's already a mime type with this 'Name'.");
-        }
-      }
-    }else{
-      $ldap->ls("(&(objectClass=gotoMimeType)(cn=".$this->cn."))","ou=mime,".$this->base,array("cn"));
-      if ($ldap->count()){
-        $attrs = $ldap->fetch();
-        if($this->dn != $attrs['dn']) {
-          $message[]= _("There's already an mime with this 'Name'.");
-        }
-      }
-    }
-
-    return($message);
-  }
-
-  /** Helper functions **/
-
-  /* Set a new picture */      
-  function set_new_picture($filename)
-  {
-    if (empty($filename)){
-      $filename= "./images/default_icon.png";
-      $this->use_gotoMimeIcon= "*removed*";
-    }else{
-      $this->use_gotoMimeIcon= $filename;
-    }
-
-    if (file_exists($filename)){
-      $fd = fopen ($filename, "rb");
-      $this->iconData= fread ($fd, filesize ($filename));
-      $_SESSION['binary']= $this->iconData;
-      $_SESSION['binarytype']= "image/jpeg";
-      fclose ($fd);
-    }
-  }
-
-  /* Get picture link */
-  function get_picture()
-  {
-    $_SESSION['binary']= $this->iconData;
-    $_SESSION['binarytype']= "image/jpeg";
-    return("getbin.php");
-  }
-
-  /* Transports the given 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 given Arraykey one position down*/
-  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);
-  }
-
-
-  /* return the position of the element in the array */
-  function getpos($atr,$attrs)
-  {
-    $i = 0;
-    foreach($attrs as $attr => $name)    {
-      $i++;
-      if($attr == $atr){
-        return($i);
-      }
-    }
-    return(-1);
-  }
-
-
-  /* Remove this element from array */
-  function ArrayRemove($key,$array,$reorder = false)   
-  {
-    if(isset($array[$key])){
-      unset($array[$key]);
-      if($reorder){
-        $tmp = array();
-        foreach($array as $entry){
-          $tmp[] = $entry;
-        }
-        $array = $tmp;
-      }
-    }  
-    return($array);
-  }
-
-
-  /* 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);
-  }
-
-
-  /* Return a dialog with all fields that must be changed, 
-     if we want to copy this entry */
-  function getCopyDialog()
-  {
-    $str = "";
-
-    $smarty = get_smarty();
-    $smarty->assign("cn",              $this->cn);
-    $smarty->assign("description",  $this->description);
-    $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE,dirname(__FILE__)));
-
-    $ret = array();
-    $ret['string'] = $str;
-    $ret['status'] = "";
-    return($ret);
-  }
-
-
-  /* Save all */
-  function saveCopyDialog()
-  {
-    $attrs = array("cn","description");
-    foreach($attrs as $attr){
-      if(isset($_POST[$attr])){
-        $this->$attr = $_POST[$attr];
-      }
-    }
-  }
-
-  /* Return plugin informations for acl handling  */ 
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("Generic"),
-          "plDescription" => _("Mime type generic"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 0,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("mimetypes" => array("description"  => _("Mime types"),
-                                                        "objectClass"  => "gotoMimeType")),
-          "plProvidedAcls"=> array(
-            "cn"                          => _("Name"),
-            "gotoMimeGroup"               => _("Mime group"),
-            "description"                 => _("Description"),
-            "base"                        => _("Base"),
-            "gotoMimeApplication"         => _("Application"),
-            "gotoMimeLeftClickAction"     => _("Left click action"),
-            "gotoMimeIcon"                => _("Icon"),
-            "gotoMimeFilePattern"         => _("File patterns"),
-            "gotoMimeEmbeddedApplication" => _("Embedded applications"))
-          ));
-
-  }
-
-  function PrepareForCopyPaste($source)
-  {
-    plugin::PrepareForCopyPaste($source);
-
-    $source_o = new mimetype($this->config,$source['dn'],$this->parent);
-
-    foreach(array("gotoMimeLeftClickAction_Q","gotoMimeEmbeddedApplication","gotoMimeApplication","gotoMimeFilePattern","gotoMimeIcon","iconData") as $name){
-      $use_attr     = "use_".$name;
-      if(isset($this->$use_attr)){
-        $this->$use_attr= $source_o->$use_attr;
-      }
-      $this->$name = $source_o->$name;
-    } 
-    foreach($this->attributes as $name){
-      $this->$name = $source_o->$name;
-    }
-
-    if($this->iconData){
-      $this->use_gotoMimeIcon ="Not emtpy, causes icon to be written.";
-    }
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/mimetypes/class_mimetypeManagement.inc b/plugins/admin/mimetypes/class_mimetypeManagement.inc
deleted file mode 100755 (executable)
index 5cd9c15..0000000
+++ /dev/null
@@ -1,664 +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 mimetypeManagement extends plugin
-{
-  /* Definitions */
-  var $plHeadline     = "Mime types";
-  var $plDescription  = "Manage mime types";
-
-  /* Dialog attributes */
-  var $ui                             = NULL;
-  var $DivListMimeTypes               = NULL;
-  var $enableReleaseManagement        = false;
-  var $mimetabs                       = NULL;
-  var $snapDialog                     = NULL;
-  var $CopyPasteHandler               = NULL;
-  var $start_pasting_copied_objects = FALSE;
-
-
-  function mimetypeManagement (&$config, &$ui)
-  {
-    /* Save configuration for internal use */
-    $this->config   = &$config;
-    $this->ui       = &$ui;
-
-    /* Check if copy & paste is activated */
-    if($this->config->boolValueIsTrue("MAIN","ENABLECOPYPASTE")){
-      $this->CopyPasteHandler = new CopyPasteHandler($this->config);
-    }
-
-    /* Creat dialog object */
-    $this->DivListMimeTypes = new divListMimeTypes($this->config,$this);
-
-    if($this->IsReleaseManagementActivated()){
-
-      /* Check if we should enable the release selection */
-      $this->enableReleaseManagement = true;
-
-      /* Hide SubSearch checkbox */
-      $this->DivListMimeTypes->DisableCheckBox("SubSearch");
-    }
-
-  }
-
-
-  /* Get all releases */
-  function getReleases($base)
-  {
-    $ldap                   = $this->config->get_ldap_link();
-    $dn                     = "ou=mime,".$base;
-    $ret                    = array();
-    $ret ["ou=mime,".$base] = "/";    
-
-    $ldap->cd($dn);
-    $ldap->search("objectClass=organizationalUnit",array("ou"));
-
-    while($attrs = $ldap->fetch()){
-      $str = str_replace($dn,"",$attrs['dn']);
-      $tmp = array_reverse( split("ou=",$str));
-      $str = "";
-      foreach($tmp as $val){
-        $val = trim(preg_replace("/,/","",$val));
-        if(empty($val)) break;
-        $str .= "/".$val;
-      } 
-      if(!empty($str)){
-        $ret[$attrs['dn']]= preg_replace("/^\//","",$str);
-      }
-    }
-    asort($ret);
-    return($ret);
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-
-    /**************** 
-      Variable init 
-     ****************/
-
-    /* These vars will be stored if you try to open a locked mime, 
-        to be able to perform your last requests after showing a warning message */
-    $_SESSION['LOCK_VARS_TO_USE'] = array("/^act$/","/^id$/","/^mime_edit_/","/^mime_del_/","/^item_selected/","/^remove_multiple_mimetypes/");
-
-    $smarty       = get_smarty();             // Smarty instance
-    $s_action     = "";                       // Contains the action to proceed
-    $s_entry      = "";                       // The value for s_action
-    $base_back    = "";                       // The Link for Backbutton
-    
-    /* Test Posts */
-    foreach($_POST as $key => $val){
-      // Post for delete
-      if(preg_match("/mime_del.*/",$key)){
-        $s_action = "del";
-        $s_entry  = preg_replace("/mime_".$s_action."_/i","",$key);
-        // Post for edit
-      }elseif(preg_match("/mime_edit_.*/",$key)){
-        $s_action="edit";
-        $s_entry  = preg_replace("/mime_".$s_action."_/i","",$key);
-        // Post for new
-      }elseif(preg_match("/^copy_.*/",$key)){
-        $s_action="copy";
-        $s_entry  = preg_replace("/^copy_/i","",$key);
-      }elseif(preg_match("/^cut_.*/",$key)){
-        $s_action="cut";
-        $s_entry  = preg_replace("/^cut_/i","",$key);
-        // Post for new
-      }elseif(preg_match("/^mime_new.*/",$key)){
-        $s_action="new";
-      }elseif(preg_match("/^remove_multiple_mimetypes/",$key)){
-        $s_action="del_multiple";
-      }elseif(preg_match("/^editPaste.*/i",$key)){
-        $s_action="editPaste";
-      }elseif(preg_match("/^multiple_copy_mimetypes/",$key)){
-        $s_action = "copy_multiple";
-      }elseif(preg_match("/^multiple_cut_mimetypes/",$key)){
-        $s_action = "cut_multiple";
-      }
-    }
-
-    if((isset($_GET['act']))&&($_GET['act']=="edit_entry")){
-      $s_action ="edit";
-      $s_entry  = $_GET['id'];
-    }
-
-    $s_entry  = preg_replace("/_.$/","",$s_entry);
-
-
-    /* handle C&P from layers menu */
-    if(isset($_POST['menu_action']) && preg_match("/^multiple_copy_systems/",$_POST['menu_action'])){
-      $s_action = "copy_multiple";
-    }
-    if(isset($_POST['menu_action']) && preg_match("/^multiple_cut_systems/",$_POST['menu_action'])){
-      $s_action = "cut_multiple";
-    }
-    if(isset($_POST['menu_action']) && preg_match("/^editPaste/",$_POST['menu_action'])){
-      $s_action = "editPaste";
-    }
-
-    /* Create options */
-    if(isset($_POST['menu_action']) && $_POST['menu_action'] == "mime_new"){
-      $s_action = "new";
-    }
-
-    /* handle remove from layers menu */
-    if(isset($_POST['menu_action']) && preg_match("/^remove_multiple/",$_POST['menu_action'])){
-      $s_action = "del_multiple";
-    }
-
-    /**************** 
-      Copy & Paste handling  
-     ****************/
-
-    /* Display the copy & paste dialog, if it is currently open */
-    $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
-    if($ret){
-      return($ret);
-    }
-
-
-    /**************** 
-      Create a new mime type 
-     ****************/
-
-    /* New mime type? */
-    $ui = get_userinfo();
-    $acl = $ui->get_permissions($this->DivListMimeTypes->selectedBase,"mimetypes/mimetype");
-    if (($s_action=="new") && preg_match("/c/",$acl)){
-
-      /* By default we set 'dn' to 'new', all relevant plugins will
-         react on this. */
-      $this->dn= "new";
-
-      /* Create new usertab object */
-      $this->mimetabs= new mimetabs($this->config, $this->config->data['TABS']['MIMETABS'], $this->dn,"mimetypes");
-      $this->mimetabs->set_acl_base($this->DivListMimeTypes->selectedBase);
-    }   
-
-
-    /**************** 
-      Edit entry canceled 
-     ****************/
-
-    /* Cancel dialogs */
-    if (isset($_POST['edit_cancel'])){
-      del_lock ($this->mimetabs->dn);
-      unset ($this->mimetabs);
-      $this->mimetabs= NULL;
-      unset ($_SESSION['objectinfo']);
-    }
-
-
-    /**************** 
-      Edit entry finished 
-     ****************/
-
-    /* Finish mime edit is triggered by the tabulator dialog, so
-       the user wants to save edited data. Check and save at this point. */
-    if ((isset($_POST['edit_finish']) || isset($_POST['edit_apply']) ) && (isset($this->mimetabs->config))){
-
-      /* Check tabs, will feed message array */
-      $this->mimetabs->save_object();
-      $message= $this->mimetabs->check();
-
-      /* Save, or display error message? */
-      if (count($message) == 0){
-
-        /* Save data data to ldap */
-        $this->mimetabs->set_release($this->DivListMimeTypes->selectedRelease);
-        $this->mimetabs->save();
-
-        if (!isset($_POST['edit_apply'])){
-          /* Mime type has been saved successfully, remove lock from LDAP. */
-          if ($this->dn != "new"){
-            del_lock ($this->dn);
-          }
-          unset ($this->mimetabs);
-          $this->mimetabs= NULL;
-          unset ($_SESSION['objectinfo']);
-        }
-      } else {
-        /* Ok. There seem to be errors regarding to the tab data,
-           show message and continue as usual. */
-        show_errors($message);
-      }
-    }
-
-
-    /**************** 
-      Edit entry  
-     ****************/
-
-    /* User wants to edit data? */
-    if (($s_action=="edit") && (!isset($this->mimetabs->config))){
-
-      /* Get 'dn' from posted 'mimelist', must be unique */
-      $this->dn= $this->mimetypes[$s_entry]['dn'];
-
-      /* Check locking, save current plugin in 'back_plugin', so
-         the dialog knows where to return. */
-      if (($user= get_lock($this->dn)) != ""){
-        return(gen_locked_message ($user, $this->dn));
-      }
-
-      /* Lock the current entry, so everyone will get the
-         above dialog */
-      add_lock ($this->dn, $this->ui->dn);
-
-
-      /* Register mimetabs to trigger edit dialog */
-      $this->mimetabs= new mimetabs($this->config,$this->config->data['TABS']['MIMETABS'], $this->dn,"mimetypes");
-      $this->mimetabs->set_acl_base($this->dn);
-      $_SESSION['objectinfo']= $this->dn;
-    }
-
-
-    /********************
-      Delete MULTIPLE entries requested, display confirm dialog
-     ********************/
-
-    if ($s_action=="del_multiple"){
-      $ids = $this->list_get_selected_items();
-
-      $this->dns = array();
-      if(count($ids)){
-
-        foreach($ids as $id){
-          $dn = $this->mimetypes[$id]['dn'];
-          if (($user= get_lock($dn)) != ""){
-            return(gen_locked_message ($user, $dn));
-          }
-          $this->dns[$id] = $dn;
-        }
-
-        $dns_names = "<br><pre>";
-        foreach($this->dns as $dn){
-          add_lock ($dn, $this->ui->dn);
-          $dns_names .= $dn."\n";
-        }
-        $dns_names .="</pre>";
-
-        /* Lock the current entry, so nobody will edit it during deletion */
-        if (count($this->dns) == 1){
-          $smarty->assign("intro",     sprintf(_("You're about to delete the following entry %s"), @LDAP::fix($dns_names)));
-        } else {
-          $smarty->assign("intro",     sprintf(_("You're about to delete the following entries %s"), @LDAP::fix($dns_names)));
-        }
-        $smarty->assign("multiple", true);
-        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
-      }
-    }
-
-
-
-
-    /********************
-      Delete MULTIPLE entries confirmed
-     ********************/
-
-    /* Confirmation for deletion has been passed. Users should be deleted. */
-    if (isset($_POST['delete_multiple_mimetype_confirm'])){
-
-      $ui = get_userinfo();
-
-      /* Remove user by user and check acls before removeing them */
-      foreach($this->dns as $key => $dn){
-
-        $acl = $ui->get_permissions($dn,"mimetypes/mimetype");
-        if(preg_match("/d/",$acl)){
-
-          /* Delete request is permitted, perform LDAP action */
-          $this->mimetabs= new mimetabs($this->config, $this->config->data['TABS']['MIMETABS'], $dn,"mimetypes");
-          $this->mimetabs->set_acl_base($dn);
-          $this->mimetabs->delete ();
-          unset ($this->mimetabs);
-          $this->mimetabs= NULL;
-
-        } else {
-          /* Normally this shouldn't be reached, send some extra
-             logs to notify the administrator */
-          print_red (_("You are not allowed to delete this mime type!"));
-          new log("security","mimetypes/".get_class($this),$dn,array(),"Tried to trick deletion.");
-        }
-        /* Remove lock file after successfull deletion */
-        del_lock ($dn);
-        unset($this->dns[$key]);
-      }
-    }
-
-
-    /********************
-      Delete MULTIPLE entries Canceled
-     ********************/
-
-    /* Remove lock */
-    if(isset($_POST['delete_multiple_mimetype_cancel'])){
-      foreach($this->dns as $key => $dn){
-        del_lock ($dn);
-        unset($this->dns[$key]);
-      }
-    }
-
-
-    /**************** 
-      Delete mime type 
-     ****************/
-
-    /* Remove user was requested */
-    if ($s_action == "del"){
-
-      /* Get 'dn' from posted 'uid' */
-      $this->dn= $this->mimetypes[$s_entry]['dn'];
-
-      /* Load permissions for selected 'dn' and check if
-         we're allowed to remove this 'dn' */
-      $ui = get_userinfo();
-      $acl = $ui->get_permissions($this->dn,"mimetypes/mimetype");
-      if (preg_match("/d/",$acl)){
-
-        /* Check locking, save current plugin in 'back_plugin', so
-           the dialog knows where to return. */
-        if (($user= get_lock($this->dn)) != ""){
-          return (gen_locked_message ($user, $this->dn));
-        }
-
-        /* Lock the current entry, so nobody will edit it during deletion */
-        add_lock ($this->dn, $this->ui->dn);
-        $smarty= get_smarty();
-        $smarty->assign("intro", sprintf(_("You're about to delete the mime type '%s'."), @LDAP::fix($this->dn)));
-        $smarty->assign("multiple", false);
-        return($smarty->fetch (get_template_path('remove.tpl', TRUE)));
-      } else {
-
-        /* Obviously the user isn't allowed to delete. Show message and
-           clean session. */
-        print_red (_("You are not allowed to delete this mime type!"));
-      }
-    }
-
-
-    /**************** 
-      Delete mime confirmed 
-     ****************/
-
-    /* Confirmation for deletion has been passed. Group should be deleted. */
-    if (isset($_POST['delete_mime_confirm'])){
-
-      /* Some nice guy may send this as POST, so we've to check
-         for the permissions again. */
-      $ui = get_userinfo();
-      $acl = $ui->get_permissions($this->dn,"mimetypes/mimetype");
-      if(preg_match("/d/",$acl)){
-
-        /* Delete request is permitted, perform LDAP action */
-        $this->mimetabs= new mimetabs($this->config, $this->config->data['TABS']['MIMETABS'], $this->dn,"mimetypes");
-        $this->mimetabs->set_acl_base($this->dn);
-        $this->mimetabs->delete ();
-        unset ($this->mimetabs);
-        $this->mimetabs= NULL;
-
-      } else {
-
-        /* Normally this shouldn't be reached, send some extra
-           logs to notify the administrator */
-        print_red (_("You are not allowed to delete this mime type!"));
-        new log("security","mimetypes/".get_class($this),$dn,array(),"Tried to trick deletion.");
-      }
-
-      /* Remove lock file after successfull deletion */
-      del_lock ($this->dn);
-    }
-
-
-    /**************** 
-      Delete mime canceled 
-     ****************/
-
-    /* Delete mime type canceled? */
-    if (isset($_POST['delete_cancel'])){
-      del_lock ($this->dn);
-      unset($_SESSION['objectinfo']);
-    }
-
-    /* Show tab dialog if object is present */
-    if (($this->mimetabs) && (isset($this->mimetabs->config))){
-      $display= $this->mimetabs->execute();
-
-      /* Don't show buttons if tab dialog requests this */
-      if (!$this->mimetabs->by_object[$this->mimetabs->current]->dialog){
-        $display.= "<p style=\"text-align:right\">\n";
-        $display.= "<input type=\"submit\" name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
-        $display.= "&nbsp;\n";
-        if ($this->dn != "new"){
-          $display.= "<input type=submit name=\"edit_apply\" value=\""._("Apply")."\">\n";
-          $display.= "&nbsp;\n";
-        }
-        $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
-        $display.= "</p>";
-      }
-      return ($display);
-    }
-
-
-    /****************
-      Dialog display
-     ****************/
-
-        /* Check if there is a snapshot dialog open */
-    $base = $this->DivListMimeTypes->selectedBase;
-    if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases())){
-      return($str);
-    }
-
-    /* Display dialog with system list */
-    $this->DivListMimeTypes->parent = $this;
-    $this->DivListMimeTypes->execute();
-    $this->DivListMimeTypes->AddDepartments($this->DivListMimeTypes->selectedBase,3,1);
-    $this->reload();
-    $this->DivListMimeTypes->setEntries($this->mimetypes);
-    return($this->DivListMimeTypes->Draw());
-  }
-
-    
-  /* Return departments, that will be included within snapshot detection */
-  function get_used_snapshot_bases()
-  {
-    return(array($this->DivListMimeTypes->selectedRelease));
-  }
-
-
-
-  function reload()
-  {
-    $this->mimetypes= array();
-
-    /* Set base for all searches */
-    $base       = $this->DivListMimeTypes->selectedBase;
-    $release    = $this->DivListMimeTypes->selectedRelease;
-    $Regex      = $this->DivListMimeTypes->Regex;
-    $SubSearch  = $this->DivListMimeTypes->SubSearch; 
-    $Flags      =  GL_NONE | GL_SIZELIMIT;
-    $Filter     = "(&(|(cn=".$Regex.")(description=".$Regex."))(objectClass=gotoMimeType))";
-    $tmp        = array();
-    $Releases   = $this->getReleases($base);
-
-
-    /* If release management is enabled, use release as base. */
-    if(!$this->enableReleaseManagement){
-      $use_base = $base;
-    }else{
-      if(isset($Releases[$release])){
-        $use_base  = $release;
-      }else{
-        $use_base  = $base;
-      }
-    }
-
-    /* In case of subsearch, add the subsearch flag */
-    if($SubSearch){
-      $Flags    |= GL_SUBSEARCH;  
-    }else{
-      if(!$this->enableReleaseManagement){
-        $use_base ="ou=mime,".$use_base;
-      }
-    }
-  
-    /* Get results and create index */ 
-    $res= get_list($Filter, "mimetypes", $use_base, array("cn","description","dn","objectClass"), $Flags);
-    foreach ($res as $val){
-      $tmp[strtolower($val['cn'][0]).$val['cn'][0].$val['dn']]=$val;
-    }
-
-    /* sort entries */
-    ksort($tmp);
-    $this->mimetypes=array();
-    foreach($tmp as $val){
-      $this->mimetypes[]=$val;
-    }
-    reset ($this->mimetypes);
-  }
-
-  function remove_from_parent()
-  {
-    /* Optionally execute a command after we're done */
-    $this->postremove();
-  }
-
-
-  function copyPasteHandling_from_queue($s_action,$s_entry)
-  {
-    /* Check if Copy & Paste is disabled */
-    if(!is_object($this->CopyPasteHandler)){
-      return("");
-    }
-
-    /* Add a single entry to queue */
-    if($s_action == "cut" || $s_action == "copy"){
-
-      /* Cleanup object queue */
-      $this->CopyPasteHandler->cleanup_queue();
-      $this->start_pasting_copied_objects = FALSE;
-      $dn = $this->mimetypes[$s_entry]['dn'];
-      $this->CopyPasteHandler->add_to_queue($dn,$s_action,"mimetabs","MIMETABS","mimetypes");
-    }
-
-    /* Add entries to queue */
-    if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
-
-      /* Cleanup object queue */
-      $this->CopyPasteHandler->cleanup_queue();
-      $this->start_pasting_copied_objects = FALSE;
-  
-      /* Add new entries to CP queue */
-      foreach($this->list_get_selected_items() as $id){
-        $dn = $this->mimetypes[$id]['dn'];
-
-        if($s_action == "copy_multiple"){
-          $this->CopyPasteHandler->add_to_queue($dn,"copy","mimetabs","MIMETABS","mimetypes");
-        }
-        if($s_action == "cut_multiple"){
-          $this->CopyPasteHandler->add_to_queue($dn,"cut","mimetabs","MIMETABS","mimetypes");
-        }
-      }
-    }
-
-    /* Start pasting entries */
-    if($s_action == "editPaste"){
-      $this->start_pasting_copied_objects = TRUE;
-    }
-
-    /* Return C&P dialog */
-    if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
-
-      /* Load entry from queue and set base */
-      $this->CopyPasteHandler->load_entry_from_queue();
-      $this->CopyPasteHandler->SetVar("base",$this->DivListMimeTypes->selectedBase);
-
-      /* Get dialog */
-      $data = $this->CopyPasteHandler->execute();
-
-      /* Return dialog data */
-      if(!empty($data)){
-        return($data);
-      }
-    }
-
-    /* Automatically disable status for pasting */
-    #if(!$this->CopyPasteHandler->entries_queued()){
-    #  $this->start_pasting_copied_objects = FALSE;
-    #}
-    return("");
-  }
-
-
-  /* Check if the release management is activated. */
-  function IsReleaseManagementActivated()
-  {
-    /* Check if we should enable the release selection */
-    $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
-    if(!empty($tmp)){
-      return(true);
-    }
-    return(false);
-  }
-
-
-  function list_get_selected_items()
-  {
-    $ids = array();
-    foreach($_POST as $name => $value){
-      if(preg_match("/^item_selected_[0-9]*$/",$name)){
-        $id   = preg_replace("/^item_selected_/","",$name);
-        $ids[$id] = $id;
-      }
-    }
-    return($ids);
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    /* Optionally execute a command after we're done */
-    $this->postcreate();
-  }
-
-  function remove_lock()
-  {
-    if (isset($this->mimetabs->dn)){
-      del_lock ($this->mimetabs->dn);
-    }
-  }
-
-  function save_object() {
-    $this->DivListMimeTypes->save_object();
-  }
-
-  function check() {}
-  function adapt_from_template($dn) {}
-  function password_change_needed() {}
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/mimetypes/generic.tpl b/plugins/admin/mimetypes/generic.tpl
deleted file mode 100644 (file)
index 1cb6d75..0000000
+++ /dev/null
@@ -1,199 +0,0 @@
-<table style="width:100%">
-       <tr>
-               <td colspan="2">
-                       <h2><img src='images/list_mime.png' class='center' alt='[M]'>&nbsp;{t}Generic{/t}</h2>
-               </td>
-       </tr>
-       <tr>
-               <td style='width:50%; vertical-align:top;' >
-                       <table>
-                               <tr>
-                                       <td>
-                                               {t}Mime type{/t}{$must}
-                                       </td>
-                                       <td>
-{render acl=$gotoMimeGroupACL}
-                                               <input type="text" name='cn' value="{$cn}" title='{t}Please enter a name for the mime type here{/t}'>
-{/render}
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>
-                                               {t}Mime group{/t}
-                                       </td>
-                                       <td>
-{render acl=$gotoMimeGroupACL}
-                                               <select name='gotoMimeGroup' title='{t}Categorize this mime type{/t}'>
-                                                       {html_options output=$gotoMimeGroups values=$gotoMimeGroups selected=$gotoMimeGroup}
-                                               </select>
-{/render}
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>
-                                               {t}Description{/t}
-                                       </td>
-                                       <td>
-{render acl=$descriptionACL}
-                                               <input type="text" name='description' value="{$description}" title='{t}Please specify a description{/t}'>
-{/render}
-                                       </td>
-                               </tr>
-{if !$isReleaseMimeType} 
-                               <tr>
-                                       <td><LABEL for="base">{t}Base{/t}{$must}</LABEL></td>
-                                       <td>
-       {render acl=$baseACL}
-               <select size="1" id="base" name="base" title="{t}Choose subtree to place application in{/t}">
-                       {html_options options=$bases selected=$base_select}
-               </select>
-       {/render}
-       {if !$isReleaseMimeType}
-               {render acl=$baseACL disable_picture='images/folder_gray.png'}
-                       <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
-               {/render}
-       {/if}
-                                       </td>
-                                </tr>
-
-{/if}
-                       </table>
-                       
-               </td>
-               <td style="border-left:1px solid #A0A0A0;vertical-align:top;">
-                       <table summary="">
-                               <tr>
-                                       <td>
-                                               <LABEL for="picture_file">{t}Icon{/t}</LABEL><br>
-                                               <img src="{$gotoMimeIcon}" border=1 alt='{t}Mime icon{/t}' 
-                                                       style="width:48px; height:48; background-color:white; vertical-align:bottom;">
-                                       </td>
-                                       <td style="vertical-align:top">
-                                               &nbsp;<br>
-                                               <input type="hidden" name="MAX_FILE_SIZE" value="100000">
-{render acl=$gotoMimeIconACL}
-                                               <input name="picture_file" type="file" size="20" maxlength="255" 
-                                                       accept="image/*.png" id="picture_file">
-{/render}
-{render acl=$gotoMimeIconACL}
-                                               <input type="submit" name="update_icon" value="{t}Update{/t}" 
-                                                       title="{t}Update mime type icon{/t}">
-{/render}
-                                       </td>
-                               </tr>
-                       </table>
-               </td>
-       </tr>
-       <tr>
-               <td colspan="2">
-                       <p class='seperator'>&nbsp;</p>
-               </td>
-       </tr>
-       <tr>
-               <td colspan="2">
-                       <h2><img src='images/mime_leftclick.png' class='center' alt='{t}Left click{/t}'>&nbsp;{t}Left click{/t}</h2>
-               </td>
-       </tr>
-       <tr>
-               <td style='width:50%; vertical-align:top;' >
-                       {t}File patterns{/t}{$must}
-{render acl=$gotoMimeFilePatternACL}   
-                       {$gotoMimeFilePatterns} 
-{/render}
-
-{render acl=$gotoMimeFilePatternACL}   
-                       <input type='text'       name='NewFilePattern'    value='' title='{t}Please specify a new file pattern{/t}'>
-{/render}
-{render acl=$gotoMimeFilePatternACL}   
-                       <input type='submit' name='AddNewFilePattern' value='{t}Add{/t}' title='{t}Add a new file pattern{/t}'>
-{/render}
-               </td>
-               <td style="border-left:1px solid #A0A0A0;vertical-align:top;">
-                       {t}Applications{/t}
-{render acl=$gotoMimeApplicationACL}   
-                       {$gotoMimeApplications}         
-{/render}
-
-{render acl=$gotoMimeApplicationACL}   
-                       <select name="NewApplicationSelect">
-                               <option value="">-</option>
-                               {html_options options=$ApplicationList}
-                       </select>
-{/render}
-{render acl=$gotoMimeApplicationACL}   
-                       <input type='text'       name='NewApplication'    value='' title='{t}Enter an application name here{/t}'>
-{/render}
-{render acl=$gotoMimeApplicationACL}   
-                       <input type='submit' name='AddNewApplication' value='{t}Add{/t}' title='{t}Add application{/t}'>
-{/render}
-               </td>
-       </tr>
-       <tr>    
-               <td colspan="2">
-                       <p class='seperator'>&nbsp;</p>
-               </td>
-       </tr>
-       <tr>    
-               <td colspan="2">
-                       <h2><img src='images/mime_embedding.png' class='center' alt='{t}Embedding{/t}'>&nbsp;{t}Embedding{/t}</h2>
-               </td>
-       </tr>
-       <tr>
-               <td style='width:50%; vertical-align:top;' >
-                               
-                       <table>
-                               <tr>
-                                       <td style='vertical-align:top; '>
-{render acl=$gotoMimeLeftClickActionACL}
-                                               <input type='radio' name='gotoMimeLeftClickAction_IE' value='I' 
-                                                       {if $gotoMimeLeftClickAction_I} checked {/if}>
-{/render}
-                                               {t}Show file in embedded viewer{/t}
-                                               <br>
-
-{render acl=$gotoMimeLeftClickActionACL}
-                                               <input type='radio' name='gotoMimeLeftClickAction_IE' value='E' 
-                                                       {if $gotoMimeLeftClickAction_E} checked {/if}>
-{/render}
-                                               {t}Show file in external viewer{/t}
-                                               <br>
-
-{render acl=$gotoMimeLeftClickActionACL}
-                                               <input type='checkbox' name='gotoMimeLeftClickAction_Q' value='1' 
-                                                       {if $gotoMimeLeftClickAction_Q} checked {/if}>
-{/render}
-                                               {t}Ask whether to save to local disk{/t}
-                                       </td>
-                               </tr>
-                       </table>
-                       
-               </td>
-               <td style="border-left:1px solid #A0A0A0;vertical-align:top;">
-                       {t}Applications{/t}
-{render acl=$gotoMimeEmbeddedApplicationACL}
-                       {$gotoMimeEmbeddedApplications}         
-{/render}
-{render acl=$gotoMimeEmbeddedApplicationACL}
-                       <select name="NewEmbeddedApplicationSelect">
-                               <option value="">-</option>
-                               {html_options options=$ApplicationList}
-                       </select>
-{/render}
-{render acl=$gotoMimeEmbeddedApplicationACL}
-                       <input type='text'       name='NewEmbeddedApplication'    value='' 
-                               title='{t}Enter an application name here{/t}'>
-{/render}
-{render acl=$gotoMimeEmbeddedApplicationACL}
-                       <input type='submit' name='AddNewEmbeddedApplication' value='{t}Add{/t}' 
-                               title='{t}Add application{/t}'>
-{/render}
-               </td>
-       </tr>
-</table>
-<input type="hidden" name="MimeGeneric" value="1">
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('cn');
-  -->
-</script>
diff --git a/plugins/admin/mimetypes/main.inc b/plugins/admin/mimetypes/main.inc
deleted file mode 100755 (executable)
index 1595f18..0000000
+++ /dev/null
@@ -1,57 +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
- */
-
-if ($remove_lock){
-               if(isset($_SESSION['MimeTypeManagement'])){
-                               $MimeTypeManagement= $_SESSION['MimeTypeManagement'];
-                               $MimeTypeManagement->remove_lock();
-                               del_lock ($ui->dn);
-                               sess_del ('MimeTypeManagement');
-               }
-} else {
-
-               /* Create MimeTypeManagement object on demand */
-               if (!isset($_SESSION['MimeTypeManagement']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
-                               $_SESSION['MimeTypeManagement']= new mimetypeManagement ($config, $_SESSION['ui']);
-               }
-
-               /* Get object */
-               $MimeTypeManagement= $_SESSION['MimeTypeManagement'];
-               $MimeTypeManagement->save_object();
-               $output= $MimeTypeManagement->execute();
-
-               /* Page header*/
-               if (isset($_SESSION['objectinfo'])){
-                               $display= print_header(get_template_path('images/mimetypes.png'), _("Mimetype management"), "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".@LDAP::fix($_SESSION['objectinfo']));
-               } else {
-                               $display= print_header(get_template_path('images/mimetypes.png'), _("Mimetype management"));
-               }
-
-               /* Reset requested? */
-               if (isset($_GET['reset']) && $_GET['reset'] == 1){
-                               del_lock ($ui->dn);
-                               sess_del ('MimeTypeManagement');
-               }
-
-               /* Show and save dialog */
-               $display.= $output;
-               $_SESSION['MimeTypeManagement']= $MimeTypeManagement;
-}
-?>
diff --git a/plugins/admin/mimetypes/paste_generic.tpl b/plugins/admin/mimetypes/paste_generic.tpl
deleted file mode 100644 (file)
index 34b5e07..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-<table style="width:100%">
-       <tr>
-               <td colspan="2">
-                       <h2><img src='images/head.png' class='center'>&nbsp;{t}Generic{/t}</h2>
-               </td>
-       </tr>
-       <tr>
-               <td style='width:50%; vertical-align:top;' >
-                               
-                       <table>
-                               <tr>
-                                       <td>
-                                               {t}Mime type{/t}
-                                       </td>
-                                       <td>
-                                               <input type="text" name='cn' value="{$cn}" title='{t}Please enter a name for the mime type here{/t}'>
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>
-                                               {t}Description{/t}
-                                       </td>
-                                       <td>
-                                               <input type="text" name='description' value="{$description}" title='{t}Please specify a description for this mime type here{/t}'>
-                                       </td>
-                               </tr>
-                       </table>
-                       
-               </td>
-       </tr>
-</table>
diff --git a/plugins/admin/mimetypes/release_select.tpl b/plugins/admin/mimetypes/release_select.tpl
deleted file mode 100755 (executable)
index d58738f..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-<br> 
-<div class="contentboxh" style="border-bottom:1px solid #B0B0B0;">
- <p class="contentboxh"><img src="{$branchimage}" align="right" alt="[F]">{t}Branches{/t}</p>
-</div>
-<div class="contentboxb">
- <table summary="" style="width:100%;">
-  <tr>
-   <td>
-    {t}Current release{/t}&nbsp;
-    <select name="selectedRelease" onChange="document.mainform.submit();">
-     {html_options options=$releases selected=$selectedRelease}
-    </select>
-   </td>
-  </tr>
- </table>
-</div>
diff --git a/plugins/admin/mimetypes/remove.tpl b/plugins/admin/mimetypes/remove.tpl
deleted file mode 100755 (executable)
index 30c4233..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<div style="font-size:18px;">
-  <img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
-</div>
-<p>
- {$intro}
- {t}This may be used by several groups. 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}So - if you're sure - press 'Delete' to continue or 'Cancel' to abort.{/t}
-</p>
-
-<p class="plugbottom">
-       {if $multiple}
-               <input type=submit name="delete_multiple_mimetype_confirm" value="{t}Delete{/t}">
-               &nbsp;
-               <input type=submit name="delete_multiple_mimetype_cancel" value="{t}Cancel{/t}">
-       {else}
-               <input type=submit name="delete_mime_confirm" value="{t}Delete{/t}">
-               &nbsp;
-               <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
-       {/if}
-</p>
-
diff --git a/plugins/admin/mimetypes/tabs_mimetypes.inc b/plugins/admin/mimetypes/tabs_mimetypes.inc
deleted file mode 100755 (executable)
index 6c1cd34..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-<?php
-
-class mimetabs extends tabs
-{
-  var $Release= "";
-
-  function mimetabs($config, $data, $dn,$category)
-  {
-    tabs::tabs($config, $data, $dn,$category);
-
-    /* Add references/acls/snapshots */
-    $this->addSpecialTabs();
-  }
-
-  function set_release($newRelease)
-  {
-    $this->Release= preg_replace('/,ou=mime,.*$/', '', $newRelease);
-    if ($this->Release != ""){
-      $this->Release= ",".$this->Release;
-    }
-  }
-
-  function save($ignore_account= FALSE)
-  {
-    $baseobject= $this->by_object['mimetype'];
-
-    /* Check for new 'dn', in order to propagate the
-       'dn' to all plugins */
-    $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
-
-    if((!empty($tmp)) && (isset($_SESSION['mimefilter']['release']))){
-      if(!$baseobject->isReleaseMimeType){
-        $new_dn= "cn=".$baseobject->cn.",ou=mime,".$baseobject->base;
-      }else{
-        $new_dn ="cn=".$baseobject->cn.",".$_SESSION['mimefilter']['release'];
-      }
-    }else{
-      $new_dn= "cn=".$baseobject->cn.",ou=mime,".$baseobject->base;
-    }
-
-    /* Move group? */
-    if ($this->dn != $new_dn){
-
-      /* Write entry on new 'dn' */
-      if ($this->dn != "new"){
-        $baseobject->move($this->dn, $new_dn);
-        $this->by_object['mimetype']= $baseobject;
-      }
-
-      /* Happen to use the new one */
-      $this->dn= $new_dn;
-    }
-
-    tabs::save();
-
-    /* Fix tagging if needed */
-    $baseobject->dn= $this->dn;
-    $baseobject->handle_object_tagging();
-    $this->by_object['mimetype'] = $baseobject;
-  }
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/ogroups/class_divListOGroup.inc b/plugins/admin/ogroups/class_divListOGroup.inc
deleted file mode 100755 (executable)
index c0e96a7..0000000
+++ /dev/null
@@ -1,331 +0,0 @@
-<?php
-
-class divListOGroup extends MultiSelectWindow
-{
-
-  /* Current base */
-  var $selectedBase       = "";
-  var $departments        = array();
-
-  /* Regex */
-  var $Regex              = "*";
-
-  /* CheckBoxes, to change default values modify $this->AddCheckBox */
-  var $UserGroups         ;
-  var $GroupGroups        ;
-  var $ApplicationGroups  ;
-  var $DepartmentGroups   ; 
-  var $ServerGroups       ;
-  var $WorkstationGroups  ;
-  var $TerminalGroups     ;
-  var $PrinterGroups      ;
-  var $PhoneGroups        ;
-  
-
-  /* Subsearch checkbox */
-  var $SubSearch          ;
-  var $parent             ;
-  var $ui                 ;
-
-  function divListOGroup (&$config,$parent)
-  {
-    MultiSelectWindow::MultiSelectWindow($config, "OGroups", "ogroups");
-    
-    $this->parent       = $parent;
-    $this->ui           = get_userinfo();
-
-    /* Set list strings */
-    $this->SetTitle(_("List of object groups"));
-    $this->SetSummary(_("List of object groups"));
-    $this->EnableAplhabet(true);
-
-    /* Result page will look like a headpage */
-    $this->SetHeadpageMode();
-    $this->SetInformation(_("This menu allows you to add, edit or remove selected groups. You may want to use the range selector on top of the group listbox, when working with  a large number of groups."));
-  
-    /* Disable buttonsm */
-    $this->EnableCloseButton(false);
-    $this->EnableSaveButton (false);
-
-    /* Dynamic action col, depending on snapshot icons */
-    $action_col_size = 80;
-    if($this->parent->snapshotEnabled()){
-      $action_col_size += 38; 
-    }
-
-    /* Toggle all selected / deselected */
-    $chk = "<input type='checkbox' id='select_all' name='select_all'
-               onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
-
-    /* set Page header */
-    $this->AddHeader(array("string"=> $chk,          "attach"=>"style='width:20px;'"));
-    $this->AddHeader(array("string" => "&nbsp;", "attach" => "style='text-align:center;width:20px;'"));
-    $this->AddHeader(array("string" => _("Name of object groups")." / "._("Departments"), "attach" => "style=''"));
-    $this->AddHeader(array("string" => _("Properties"), "attach" => "style='width:136px;'"));
-    $this->AddHeader(array("string" => _("Actions"), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'"));
-
-    /*                  Text        ,Value    ,Name         ,Is selected */
-    $this->AddCheckBox("UserGroups" ,       _("Select to see groups containing users")       , _("Show groups containing users"), true);
-    $this->AddCheckBox("GroupGroups" ,      _("Select to see groups containing groups")      , _("Show groups containing groups"), true);
-    $this->AddCheckBox("ApplicationGroups", _("Select to see groups containing applications"), _("Show groups containing applications"), true);
-    $this->AddCheckBox("DepartmentGroups" , _("Select to see groups containing departments") , _("Show groups containing departments"), true);
-    $this->AddCheckBox("ServerGroups" ,     _("Select to see groups containing servers")     , _("Show groups containing servers"), true);
-    $this->AddCheckBox("WorkstationGroups", _("Select to see groups containing workstations"), _("Show groups containing workstations"), true);
-    $this->AddCheckBox("TerminalGroups" ,   _("Select to see groups containing terminals")   , _("Show groups containing terminals"), true);
-    $this->AddCheckBox("PrinterGroups" ,    _("Select to see groups containing printer")     , _("Show groups containing printer"), true);
-    $this->AddCheckBox("PhoneGroups" ,      _("Select to see groups containing phones")      , _("Show groups containing phones"), true);
-
-    /* Add SubSearch checkbox */    
-    $this->AddCheckBox(SEPERATOR);
-    $this->AddCheckBox("SubSearch",  _("Select to search within subtrees"), _("Search in subtrees"), false);
-
-    /*                  Name                 ,Text                              ,Default  , Connect with alphabet  */
-    $this->AddRegex   ("Regex",     _("Regular expression for matching group names"), "*" , true);
-  }
-
-
-  function GenHeader()
-  {
-    /* Prepare departments,
-       which are shown in the listbox on top of the listbox
-     */
-    $options= "";
-
-    /* Get all departments within this subtree */
-    $ui= get_userinfo();
-    $first = "";
-    $found = FALSE;
-    $base = $this->config->current['BASE'];
-
-    /* Add base */
-    $tmp = array();
-    $tmp[] = array("dn"=>$this->config->current['BASE']);
-    $tmp=  array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
-                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
-
-    $deps = array();
-    foreach($tmp as $tm){
-      $deps[$tm['dn']] = $tm['dn'];
-    }
-
-    /* Load possible departments */
-    $ui= get_userinfo();
-    $tdeps= $ui->get_module_departments("ogroups");
-    $ids = $this->config->idepartments;
-    $first = "";
-    $found = FALSE;
-    foreach($ids as $dep => $name){
-      if(isset($deps[$dep]) && in_array_ics($dep, $tdeps)){
-
-        /* Keep first base dn in mind, we could need this
-         *  info if no valid base was found
-         */
-        if(empty($first)) {
-          $first = $dep['dn'];
-        }
-
-        $value = $ids[$dep];
-        if ($this->selectedBase == $dep){
-          $found = TRUE;
-          $options.= "<option selected='selected' value='".$dep."'>$value</option>";
-        } else {
-          $options.= "<option value='".$dep."'>$value</option>";
-        }
-      }
-    }
-
-    /* The currently used base is not visible with your acl setup.
-     * Set base to first useable base.
-     */
-    if(!$found){
-      $this->selectedBase = $first;
-    }
-
-    /* Add a seperator after displaying c&p and snapshot icons ? */
-    $add_sep = false;
-  
-    /* Get copy & paste icon */
-    $acls  = $ui->get_permissions($this->selectedBase,"ogroups/ogroup");
-    $acl_all= $ui->has_complete_category_acls($this->selectedBase,"ogroups");
-    $Copy_Paste ="";
-    if(preg_match("/(c.*w|w.*c)/",$acl_all) &&  $this->parent->CopyPasteHandler){
-      $Copy_Paste = $this->parent->CopyPasteHandler->generatePasteIcon();
-      $add_sep = true;
-    }
-
-    /* Add default header */
-    $listhead = MultiSelectWindow::get_default_header();
-
-  
-    /* Add department selector */
-    $listhead .= _("Base")."&nbsp;<select name='CurrentMainBase' 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;";
-
-
-    /* Create Layers menu */
-    $s  = ".|"._("Actions")."|\n";
-    $s .= "..|<img src='images/list_new.png' alt='' border='0' class='center'>".
-      "&nbsp;"._("Create")."|\n";
-
-    /* Append create options */
-    if(preg_match("/c/",$acls)) {
-      $s.= "...|<input class='center' type='image' src='images/list_new_ogroup.png' alt=''>".
-        "&nbsp;"._("Object group")."|group_new|\n";
-    }
-
-    /* Multiple options */
-    $s.= "..|---|\n";
-#    $s.= "..|<img src='images/edit.png' alt='' border='0' class='center'>".
-#      "&nbsp;"._("Edit")."|"."multiple_edit|\n";
-
-    $s.= "..|<img src='images/edittrash.png' alt='' border='0' class='center'>".
-      "&nbsp;"._("Remove")."|"."remove_multiple_ogroups/|\n";
-
-    /* Add multiple copy & cut icons */
-    if(is_object($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
-      $s.= "..|---|\n";
-      $s.= "..|<img src='images/editcopy.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Copy")."|"."multiple_copy_systems|\n";
-      $s.= "..|<img src='images/editcut.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Cut")."|"."multiple_cut_systems|\n";
-
-      if($this->parent->CopyPasteHandler->entries_queued()){
-        $img = "<img border='0' class='center' src='images/editpaste.png' alt=''>";
-        $s.="..|".$img."&nbsp;"._("Paste")."|editPaste|\n";
-      }else{
-        $img = "<img border='0' class='center' src='images/cant_editpaste.png' alt=''>";
-        $s.="..|".$img."&nbsp;"._("Paste")."\n";
-      }
-    }
-
-    /* Add snapshot icons */
-    if(preg_match("/(c.*w|w.*c)/",$acl_all)){
-      $s .= "..|---|\n";
-      $s .= $this->get_snapshot_header(TRUE);
-    }
-
-    $this->SetDropDownHeaderMenu($s);
-    $this->SetListHeader($listhead);
-  }
-
-  function execute()
-  {
-    $this->ClearElementsList();
-    $this->GenHeader();
-  }
-
-  function setEntries($list)
-  {
-    /* Add Copy & Paste buttons if copy&paste is enabled
-     */
-    // Defining Links
-    $linkopen = "<a href='?plug=".$_GET['plug']."&amp;act=dep_open&amp;dep_id=%s'>%s</a>";
-    $editlink = "<a href='?plug=".$_GET['plug']."&amp;id=%s&amp;act=edit_entry'>%s</a>";
-    $userimg  = "<img class='center' src='images/select_groups.png' alt='User'    title='%s'>";
-    $mailimg  = "<img class='center' src='images/mailto.png'             alt='M'  title='"._("Mail")   ."'>";
-    $empty    = "<img class='center' src='images/empty.png' style='width:16px;height:16px;' alt=''>";
-
-    /* Dynamic action col, depending on snapshot icons */
-    $action_col_size = 80;
-    if($this->parent->snapshotEnabled()){
-      $action_col_size += 38; 
-    }
-  
-    $ui = get_userinfo();
-
-    // Assigning ogroups
-    foreach($list as $key => $val){
-
-      /* Create action icons */
-      $actions= "";
-      $acl_all= $ui->has_complete_category_acls($val['dn'],"ogroups");
-      if(($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
-        $actions.= "<input class='center' type='image'
-          src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
-        $actions.= "<input class='center' type='image'
-          src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
-      }
-
-      $actions.= "<input class='center' type='image'
-        src='images/edit.png' alt='"._("edit")."' name='group_edit_%KEY%' title='"._("Edit this entry")."'>";
-    
-      if(preg_match("/(c.*w|w.*c)/", $acl_all)){
-        $actions.= $this->GetSnapShotActions($val['dn']);
-      }
-
-      if(preg_match("/d/",$ui->get_permissions($val['dn'],"ogroups/ogroup"))) {
-        $actions.= "<input class='center' type='image'
-          src='images/edittrash.png' alt='"._("delete")."' name='group_del_%KEY%' title='"._("Delete this entry")."'>";
-      }else{
-        $actions.= "<img class='center' src='images/empty.png' alt='&nbsp;'
-          title='"._("You are not allowed to remove this entry.")."'>";
-      }
-
-
-      if(isset($val['mail'])){
-        $mail = $mailimg;
-      }else{
-        $mail = $empty;
-      }
-      $title = "title='".preg_replace('/ /', '&nbsp;', @LDAP::fix($val['dn']))."'";
-      if(!isset($val['description'][0])){
-        $desc = "";
-      }else{
-        $desc = " - [ ".$val['description'][0]." ]";
-      }
-
-      /* Cutted objects should be displayed in light grey */
-      $display = $val['cn'][0].$desc;
-      if($this->parent->CopyPasteHandler){
-        foreach($this->parent->CopyPasteHandler->queue as $queue_key => $queue_data){
-          if($queue_data['dn'] == $val['dn']) {
-            $display = "<font color='#999999'>".$display."</font>";
-            break;
-          }
-        }
-      }
-
-      /* Create each field */
-      $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
-                      "attach" => "style='width:20px;'");
-      $field1 = array("string" => "<img src='images/list_ogroup.png' alt='"._("Object group")."' ".$title.">", "attach" => "style='text-align:center;width: 20px;'");
-      $field2 = array("string" => sprintf($editlink,$key,$display), "attach" => "style='' ".$title);
-      $field3 = array("string" => preg_replace("/%KEY/", $key, $this->parent->convert_list($val))."&nbsp;".$mail, "attach" => "style='width:136px;'");
-      $field4 = array("string" => preg_replace("/%KEY%/", $key, $actions), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'");
-
-      $this->AddElement(array($field0,$field1,$field2,$field3,$field4));
-    }
-   
-    /* Create summary string for list footer */
-    $num_deps=0;
-    if(!$this->SubSearch){
-      $num_deps = count($this->Added_Departments);
-    }
-    $num_objs = count($list);
-
-    $num_obj_str = _("Number of listed object groups");
-    $num_dep_str = _("Number of listed departments");
-
-    $str = "<img class='center' src='images/select_ogroup.png'
-              title='".$num_obj_str."' alt='".$num_obj_str."'>&nbsp;".$num_objs."&nbsp;&nbsp;&nbsp;&nbsp;";
-    $str.= "<img class='center' src='images/folder.png'
-              title='".$num_dep_str."' alt='".$num_dep_str."'>&nbsp;".$num_deps."&nbsp;&nbsp;&nbsp;&nbsp;";
-
-    $this->set_List_Bottom_Info($str);
-  }
-
-  function Save()
-  {
-    MultiSelectWindow :: Save();  
-  }
-
-  function save_object()
-  {
-    /* Save automatic created POSTs like regex, checkboxes */
-    MultiSelectWindow::save_object();   
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/ogroups/class_mailogroup.inc b/plugins/admin/ogroups/class_mailogroup.inc
deleted file mode 100644 (file)
index ebf5697..0000000
+++ /dev/null
@@ -1,199 +0,0 @@
-<?php
-
-class mailogroup extends plugin
-{
-  /* plugin specific values */
-  var $mail= "";
-  var $cn= "";
-
-  /* attribute list for save action */
-  var $attributes= array("mail");
-  var $objectclasses= array("kolabGroupOfNames");
-  var $members= array();
-  var $view_logged = FALSE;
-
-  function mailogroup (&$config, $dn= NULL, $parent= NULL)
-  {
-    plugin::plugin($config, $dn, $parent);
-
-    /* Include config object */
-    $this->config= $config;
-
-    /* Save initial account state */
-    $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","ogroups/".get_class($this),$this->dn);
-    }
-
-
-    /* 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->parent !== NULL){
-      if ($this->is_account){
-        $display= $this->show_disable_header(_("Remove mail account"),
-            _("This group has mail features enabled. You can disable them by clicking below."));
-      } else {
-        $display= $this->show_enable_header(_("Create mail account"), _("This group has mail features disabled. You can enable them by clicking below."));
-        return ($display);
-      }
-    }
-    
-    /* Initialize templating engine */
-    $smarty= get_smarty();
-
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translation){
-      $smarty->assign($name."ACL",$this->getacl("mail"));
-    }
-
-    /* Assign mail attribute */
-    $smarty->assign("mail", $this->mail);
-
-    /* Show main page */
-    return ($display.$smarty->fetch (get_template_path('mail.tpl', TRUE)));
-  }
-
-
-  /* Check formular input */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    if ($this->is_account){
-      $ldap= $this->config->get_ldap_link();
-
-      /* Check if mail address is valid */
-      if (!is_email($this->mail) || $this->mail == ""){
-        $message[]= _("Please enter a valid email address in 'Primary address' field.");
-      }
-
-      /* Check if mail address is already in use */
-      $ldap->cd($this->config->current['BASE']);
-      $ldap->search ("(&(!(objectClass=gosaUserTemplate))(|(mail=".$this->mail.")(gosaMailAlternateAddress=".$this->mail."))(!(cn=".$this->cn.")))", array("uid"));
-      if ($ldap->count() != 0){
-        $message[]= _("The primary address you've entered is already in use.");
-      }
-    }
-
-    return ($message);
-  }
-
-
-  function save()
-  {
-    $ldap= $this->config->get_ldap_link();
-
-    /* Call parents save to prepare $this->attrs */
-    plugin::save();
-
-    /* Save data to LDAP */
-    $ldap->cd($this->dn);
-    $this->cleanup();
-    $ldap->modify ($this->attrs); 
-
-    if($this->initially_was_account){
-      new log("modify","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }else{
-      new log("create","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }
-
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of object group/mail 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");
-    }
-  }
-
-
-  /* remove object from parent */
-  function remove_from_parent()
-  {
-    /* Cancel if there's nothing to do here */
-    if (!$this->initially_was_account){
-      return;
-    }
-
-    /* include global link_info */
-    $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); 
-
-    new log("remove","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-
-    show_ldap_error($ldap->get_error(), sprintf(_("Removing of object group/mail with dn '%s' failed."),$this->dn));
-  }
-
-
-  function getCopyDialog()
-  {
-    $str = "";
-    $smarty = get_smarty();
-    $smarty->assign("mail",     $this->mail);
-    $str = $smarty->fetch(get_template_path("paste_mail.tpl",TRUE,dirname(__FILE__)));
-    $ret = array();
-    $ret['string'] = $str;
-    $ret['status'] = "";
-    return($ret);
-  }
-
-
-  function saveCopyDialog()
-  {
-    if(isset($_POST['mail'])){
-      $this->mail = $_POST['mail'];
-    }
-  }
-
-
-   static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("Mail"),
-          "plDescription" => _("Mail group"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 4,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("ogroups"),
-          "plProvidedAcls"=> array(
-            "mail" => _("Mail address"))
-          ));
-  }
-
-
-
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/ogroups/class_ogroup.inc b/plugins/admin/ogroups/class_ogroup.inc
deleted file mode 100644 (file)
index e74b398..0000000
+++ /dev/null
@@ -1,765 +0,0 @@
-<?php
-
-
-/* Sort multidimensional arrays for key 'text' */
-function sort_list($val1, $val2)
-{
-  $v1= strtolower($val1['text']);
-  $v2= strtolower($val2['text']);
-  if ($v1 > $v2){
-    return 1;
-  }
-  if ($v1 < $v2){
-    return -1;
-  }
-  return 0;
-}
-
-
-class ogroup extends plugin
-{
-  /* Variables */
-  var $cn= "";
-  var $description= "";
-  var $base= "";
-  var $gosaGroupObjects= "";
-  var $department= "";
-  var $objects= array();
-  var $objcache= array();
-  var $memberList= array();
-  var $member= array();
-  var $orig_dn= "";
-  var $group_dialog= FALSE;
-  var $view_logged = FALSE;
-
-  /* attribute list for save action */
-  var $attributes= array("cn", "description", "gosaGroupObjects","member");
-  var $objectclasses= array("top", "gosaGroupOfNames");
-
-  function ogroup (&$config, $dn= NULL)
-  {
-    plugin::plugin ($config, $dn);
-    $this->orig_dn= $dn;
-
-    $this->member = array();
-
-    /* Load member objects */
-    if (isset($this->attrs['member'])){
-      foreach ($this->attrs['member'] as $key => $value){
-        if ("$key" != "count"){
-          $value= @LDAP::convert($value);
-          $this->member["$value"]= "$value";
-        }
-      }
-    }
-    $this->is_account= TRUE;
-
-    /* Get global filter config */
-    if (!is_global("ogfilter")){
-      $ui= get_userinfo();
-      $base= get_base_from_people($ui->dn);
-      $ogfilter= array( "dselect"       => $base,
-          "regex"           => "*");
-      register_global("ogfilter", $ogfilter);
-    }
-    $ogfilter= get_global('ogfilter');
-
-    /* Adjust flags */
-    foreach( array(   "U" => "accounts",
-          "G" => "groups",
-          "A" => "applications",
-          "D" => "departments",
-          "S" => "servers",
-          "W" => "workstations",
-          "T" => "terminals",
-          "F" => "phones",
-          "_" => "subtrees",
-          "P" => "printers") as $key => $val){
-
-      if (preg_match("/$key/", $this->gosaGroupObjects)){
-        $ogfilter[$val]= "checked";
-      } else {
-        $ogfilter[$val]= "";
-      }
-    }
-    register_global("ogfilter", $ogfilter);
-  
-    if(isset($_SESSION['CurrentMainBase'])){
-     $this->base = $_SESSION['CurrentMainBase'];
-    }
-
-    /* Set base */
-    if ($this->dn == "new"){
-      $this->base= $_SESSION['CurrentMainBase'];
-    } else {
-      $this->base= preg_replace("/^[^,]+,".get_groups_ou()."/","",$this->dn);
-    }
-
-    /* Load member data */
-    $this->reload();
-  }
-
-  function AddDelMembership($NewMember = false){
-
-    if($NewMember){
-
-      /* Add member and force reload */
-      $this->member[$NewMember]= $NewMember;
-      $this->reload(); 
-
-      $this->memberList[$NewMember]= $this->objcache[$NewMember];
-      unset ($this->objects[$NewMember]);
-      uasort ($this->memberList, 'sort_list');
-      reset ($this->memberList);
-    }else{
-      /* Delete objects from group */
-      if (isset($_POST['delete_membership']) && isset($_POST['members'])){
-        foreach ($_POST['members'] as $value){
-          $this->objects["$value"]= $this->memberList[$value];
-          unset ($this->memberList["$value"]);
-          unset ($this->member["$value"]);
-          uasort ($this->objects, 'sort_list');
-          reset ($this->objects);
-        }
-        $this->reload();
-      }
-
-      /* Add objects to group */
-      if (isset($_POST['add_object_finish']) && isset($_POST['objects'])){
-        foreach ($_POST['objects'] as $value){
-          $this->memberList["$value"]= $this->objects[$value];
-          $this->member["$value"]= $value;
-          unset ($this->objects[$value]);
-          uasort ($this->memberList, 'sort_list');
-          reset ($this->memberList);
-        }
-        $this->reload();
-      }
-    }
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    if(!$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","ogroups/".get_class($this),$this->dn);
-    }
-
-
-    /* Do we represent a valid group? */
-    if (!$this->is_account){
-      $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\">&nbsp;<b>".
-        _("This 'dn' is no object group.")."</b>";
-      return ($display);
-    }
-
-    /* Delete objects from group */
-    if (isset($_POST['delete_membership']) && isset($_POST['members'])){
-      foreach ($_POST['members'] as $value){
-        if(isset($this->memberList[$value])){
-          $this->objects["$value"]= $this->memberList[$value];
-          unset ($this->memberList["$value"]);
-          unset ($this->member["$value"]);
-          uasort ($this->objects, 'sort_list');
-          reset ($this->objects);
-        }
-      }
-      $this->reload();
-    }
-
-    /* Add objects to group */
-    if (isset($_POST['add_object_finish']) && isset($_POST['objects'])){
-      foreach ($_POST['objects'] as $value){
-        if(isset($this->objects[$value])){
-          $this->memberList["$value"]= $this->objects[$value];
-          $this->member["$value"]= $value;
-          unset ($this->objects[$value]);
-          uasort ($this->memberList, 'sort_list');
-          reset ($this->memberList);
-        }
-      }
-      $this->reload();
-    }
-
-    /* Load templating engine */
-    $smarty= get_smarty();
-
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translation){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-
-    /* Base select dialog */
-    $once = true;
-    foreach($_POST as $name => $value){
-      if(preg_match("/^chooseBase/",$name) && $once && $this->acl_is_moveable()){
-        $once = false;
-        $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
-        $this->dialog->setCurrentBase($this->base);
-      }
-    }
-
-    /* Dialog handling */
-    if(is_object($this->dialog) && $this->acl_is_moveable()){
-      /* Must be called before save_object */
-      $this->dialog->save_object();
-
-      if($this->dialog->isClosed()){
-        $this->dialog = false;
-      }elseif($this->dialog->isSelected()){
-
-        /* A new base was selected, check if it is a valid one */
-        $tmp = $this->get_allowed_bases();
-        if(isset($tmp[$this->dialog->isSelected()])){
-          $this->base = $this->dialog->isSelected();
-        }
-        $this->dialog= false;
-      }else{
-        return($this->dialog->execute());
-      }
-    }
-
-    /* Add objects? */
-    if (isset($_POST["edit_membership"])){
-      $this->group_dialog= TRUE;
-      $this->dialog= TRUE;
-    }
-
-    /* Add objects finished? */
-    if (isset($_POST["add_object_finish"]) || isset($_POST["add_object_cancel"])){
-      $this->group_dialog= FALSE;
-      $this->dialog= FALSE;
-    }
-
-    /* Manage object add dialog */
-    if ($this->group_dialog){
-
-      /* Save data */
-      $ogfilter= get_global("ogfilter");
-      foreach( array("dselect", "regex") as $type){
-        if (isset($_POST[$type])){
-          $ogfilter[$type]= $_POST[$type];
-        }
-      }
-      if (isset($_POST['dselect'])){
-        foreach( array("accounts", "groups", "applications", "departments",
-              "servers", "workstations", "terminals", "printers","subtrees",
-              "phones") as $type){
-
-          if (isset($_POST[$type])) {
-            $ogfilter[$type]= "checked";
-          } else {
-            $ogfilter[$type]= "";
-          }
-        }
-      }
-      if (isset($_GET['search'])){
-        $s= mb_substr($_GET['search'], 0, 1, "UTF8")."*";
-        if ($s == "**"){
-          $s= "*";
-        }
-        $ogfilter['regex']= $s;
-      }
-      register_global("ogfilter", $ogfilter);
-      $this->reload();
-
-      /* Calculate actual groups */
-      $smarty->assign("objects", $this->convert_list($this->objects));
-
-      /* Show dialog */
-      $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("deplist", $this->config->idepartments);
-      $smarty->assign("alphabet", generate_alphabet());
-      foreach( array("dselect", "regex", "accounts", "groups", "applications",
-            "departments", "servers", "workstations", "terminals","subtrees",
-            "printers", "phones") as $type){
-        $smarty->assign("$type", $ogfilter[$type]);
-      }
-      $smarty->assign("hint", print_sizelimit_warning());
-      $smarty->assign("apply", apply_filter());
-
-      $display= $smarty->fetch (get_template_path('ogroup_objects.tpl', TRUE, dirname(__FILE__)));
-      return ($display);
-    }
-
-    /* Bases / Departments */
-      if ((isset($_POST['base'])) && ($this->acl_is_moveable())){
-        $this->base= $_POST['base'];
-      }
-
-    /* Assemble combine string */
-    if ($this->gosaGroupObjects == "[]"){
-      $smarty->assign("combinedObjects", _("none"));
-    } elseif (strlen($this->gosaGroupObjects) > 4){
-      $smarty->assign("combinedObjects", "<font color=red>"._("too many different objects!")."</font>");
-    } else {
-      $conv= array(   "U" => _("users"),
-          "G" => _("groups"),
-          "A" => _("applications"),
-          "D" => _("departments"),
-          "S" => _("servers"),
-          "W" => _("workstations"),
-          "T" => _("terminals"),
-          "F" => _("phones"),
-          "P" => _("printers"));
-
-      $type= preg_replace('/[\[\]]/', '', $this->gosaGroupObjects);
-      $p1= $conv[$type[0]];
-      error_reporting(0);
-      if (isset($type[1]) && preg_match('/[UGADSFWTP]/', $type[1])){
-        $p2= $conv[$type[1]];
-        $smarty->assign("combinedObjects", "$p1 "._("and")." $p2");
-      } else {
-        $smarty->assign("combinedObjects", "$p1");
-      }
-      error_reporting(E_ALL | E_STRICT);
-    }
-
-    /* Assign variables */
-    $smarty->assign("bases", $this->get_allowed_bases());
-    $smarty->assign("base_select", $this->base);
-    $smarty->assign("department", $this->department);
-    $smarty->assign("members", $this->convert_list($this->memberList));
-
-    /* Objects have to be tuned... */
-    $smarty->assign("objects", $this->convert_list($this->objects));
-
-    /* Fields */
-    foreach ($this->attributes as $val){
-      $smarty->assign("$val", $this->$val);
-    }
-
-    return ($smarty->fetch (get_template_path('generic.tpl', TRUE)));
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    /* Save additional values for possible next step */
-    if (isset($_POST['ogroupedit'])){
-
-      /* Create a base backup and reset the
-         base directly after calling plugin::save_object();
-         Base will be set seperatly a few lines below */
-      $base_tmp = $this->base;
-      plugin::save_object();
-      $this->base = $base_tmp;
-
-      /* Save base, since this is no LDAP attribute */
-      $tmp = $this->get_allowed_bases();
-      if(isset($_POST['base'])){
-        if(isset($tmp[$_POST['base']])){
-          $this->base= $_POST['base'];
-        }
-      }
-    }
-  }
-
-
-  /* (Re-)Load objects */
-  function reload()
-  {
-    /*###########
-      Variable initialisation 
-      ###########*/
-
-    $this->objects                = array();
-    $this->ui                     = get_userinfo();
-    $filter                       = "";
-    $objectClasses                = array();
-    
-    $ogfilter               = get_global("ogfilter");
-    $regex                  = $ogfilter['regex'];
-
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd ($ogfilter['dselect']);
-
-
-    /*###########
-      Generate Filter 
-      ###########*/
-
-    $p_f= array("accounts"        => array("CLASS"=>"gosaAccount"    ,"DN"=> get_people_ou()                  ,"ACL" => "users"), 
-                "groups"          => array("CLASS"=>"posixGroup"     ,"DN"=> get_groups_ou()                  ,"ACL" => "groups"), 
-                "applications"    => array("CLASS"=>"gosaApplication","DN"=> "ou=apps,"                       ,"ACL" => "application"), 
-                "departments"     => array("CLASS"=>"gosaDepartment" ,"DN"=> ""                               ,"ACL" => "department"), 
-                "servers"         => array("CLASS"=>"goServer"       ,"DN"=> "ou=servers,ou=systems,"         ,"ACL" => "server"),
-                "workstations"    => array("CLASS"=>"gotoWorkstation","DN"=> "ou=workstations,ou=systems,"    ,"ACL" => "workstation"),
-                "terminals"       => array("CLASS"=>"gotoTerminal"   ,"DN"=> "ou=terminals,ou=systems,"       ,"ACL" => "terminal"),
-                "printers"        => array("CLASS"=>"gotoPrinter"    ,"DN"=> "ou=printers,ou=systems,"        ,"ACL" => "printer"),
-                "phones"          => array("CLASS"=>"goFonHardware"  ,"DN"=> "ou=phones,ou=systems,"          ,"ACL" => "phone"));
-
-
-    /*###########
-      Perform search for selected objectClasses & regex to fill list with objects   
-      ###########*/
-
-    $Get_list_flags = 0;
-    if($ogfilter['subtrees'] == "checked"){
-      $Get_list_flags |= GL_SUBSEARCH;
-    }    
-
-    foreach($p_f as $post_name => $data){
-
-      if($ogfilter[$post_name] == "checked"){
-
-        if($ogfilter['subtrees']){
-          $base =  $ogfilter['dselect'];
-        }else{
-          $base =  $data['DN'].$ogfilter['dselect'];
-        }
-    
-        $filter = "(&(objectClass=".$data['CLASS'].")(|(uid=$regex)(cn=$regex)(ou=$regex)))";
-        $res    = get_list($filter, $data['ACL']  , $base, 
-                    array("description", "objectClass", "sn", "givenName", "uid","ou","cn"),$Get_list_flags);
-
-        /* fetch results and append them to the list */
-        foreach($res as $attrs){
-
-          $type= $this->getObjectType($attrs);
-          $name= $this->getObjectName($attrs);
-
-          /* Fill array */
-          if (isset($attrs["description"][0])){
-            $this->objects[$attrs["dn"]]= array("text" => "$name [".$attrs["description"][0]."]", "type" => "$type");
-          } elseif (isset($attrs["uid"][0])) {
-            $this->objects[$attrs["dn"]]= array("text" => "$name [".$attrs["uid"][0]."]", "type" => "$type");
-          } else {
-            $this->objects[$attrs["dn"]]= array("text" => "$name", "type" => "$type");
-          }
-        }
-      }
-    }
-    uasort ($this->objects, 'sort_list');
-    reset ($this->objects);
-
-    
-    /*###########
-      Build member list and try to detect obsolete entries 
-      ###########*/
-
-    $this->memberList = array();
-  
-    /* Walk through all single member entry */
-    foreach($this->member as $dn){
-
-      /* The dn for the current member can't be resolved 
-         it seams that this entry was removed 
-       */ 
-      /* Try to resolv the entry again, if it still fails, display error msg */
-      $ldap->cat($dn, array("cn", "sn", "givenName", "ou", "description", "objectClass"));
-
-      /* It has failed, add entry with type flag I (Invalid)*/
-      if ($ldap->error != "Success"){
-        $this->memberList[$dn]= array('text' => _("Non existing dn:")." ".@LDAP::fix($dn),"type" => "I");
-
-      } else {
-
-        /* Append this entry to our all object list */
-
-        /* Fetch object */
-        $attrs= $ldap->fetch();
-
-        $type= $this->getObjectType($attrs);
-        $name= $this->getObjectName($attrs);
-
-        if (isset($attrs["description"][0])){
-          $this->objcache[$attrs["dn"]]= array("text" => "$name [".$attrs["description"][0]."]", "type" => "$type");
-        } elseif (isset($attrs["uid"][0])) {
-          $this->objcache[$attrs["dn"]]= array("text" => "$name [".$attrs["uid"][0]."]", "type" => "$type");
-        } else {
-          $this->objcache[$attrs["dn"]]= array("text" => "$name", "type" => "$type");
-        }
-        $this->objcache[$attrs["dn"]]['objectClass']  = $attrs['objectClass'];
-        if(isset($attrs['uid'])){
-          $this->objcache[$attrs["dn"]]['uid']          = $attrs['uid'];
-        }
-
-        /* Fill array */
-        if (isset($attrs["description"][0])){
-          $this->objects[$attrs["dn"]]= array("text" => "$name [".$attrs["description"][0]."]", "type" => "$type");
-        } else {
-          $this->objects[$attrs["dn"]]= array("text" => "$name", "type" => "$type");
-        }
-
-        $this->memberList[$dn]= $this->objects[$attrs["dn"]];
-      }
-    }
-    uasort ($this->memberList, 'sort_list');
-    reset ($this->memberList);
-
-    /* Assemble types of currently combined objects */
-    $objectTypes= "";
-    foreach ($this->memberList as $dn => $desc){
-
-      /* Invalid object? */
-      if ($desc['type'] == 'I'){
-        continue;
-      }
-
-      /* Fine. Add to list. */
-      if (!preg_match('/'.$desc['type'].'/', $objectTypes)){
-        $objectTypes.= $desc['type'];
-      }
-    }
-    $this->gosaGroupObjects= "[$objectTypes]";
-  }
-
-
-  function convert_list($input)
-  {
-    $temp= "";
-    $conv= array(  "U" => "select_user.png",
-        "G" => "select_groups.png",
-        "A" => "select_application.png",
-        "D" => "select_department.png",
-        "S" => "select_server.png",
-        "W" => "select_workstation.png",
-        "T" => "select_terminal.png",
-        "F" => "select_phone.png",
-        "I" => "flag.png",
-        "P" => "select_printer.png");
-
-    foreach ($input as $key => $value){
-      /* Generate output */
-      $temp.= "<option title='".addslashes( $key)."' value=\"$key\" class=\"select\" style=\"background-image:url('".get_template_path("images/".$conv[$value['type']])."');\">".$value['text']."</option>\n";
-    }
-
-    return ($temp);
-  }
-
-
-  function getObjectType($attrs)
-  {
-    $type= "I";
-
-    foreach(array(  "U" => "gosaAccount",
-          "G" => "posixGroup",
-          "A" => "gosaApplication",
-          "D" => "gosaDepartment",
-          "S" => "goServer",
-          "W" => "gotoWorkstation",
-          "T" => "gotoTerminal",
-          "F" => "goFonHardware",
-          "P" => "gotoPrinter") as $index => $class){
-      if (in_array($class, $attrs['objectClass'])){
-        $type= $index;
-        break;
-      }
-    }
-
-    return ($type);
-  }
-
-
-  function getObjectName($attrs)
-  {
-    /* Person? */
-    $name =""; 
-    if (in_array('gosaAccount', $attrs['objectClass'])){
-      if(isset($attrs['sn']) && isset($attrs['givenName'])){
-        $name= $attrs['sn'][0].", ".$attrs['givenName'][0];
-      } else {
-        $name= $attrs['uid'][0];
-      }
-    } else {
-      if(isset($attrs["cn"][0])) {
-        $name= $attrs['cn'][0];
-      } else {
-        $name= $attrs['ou'][0];
-      }
-    }
-
-    return ($name);
-  }
-
-
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    /* Permissions for that base? */
-    if ($this->base != ""){
-      $new_dn= 'cn='.$this->cn.','.get_groups_ou().$this->base;
-    } else {
-      $new_dn= $this->dn;
-    }
-
-
-    $ldap = $this->config->get_ldap_link();
-    if($this->dn != $new_dn){
-      $ldap->cat ($new_dn, array('dn'));
-    }
-    
-    if($ldap->count() !=0){
-      $message[]= _("There is already an object with this cn.");
-    } 
-
-    /* Set new acl base */
-    if($this->dn == "new") {
-      $this->set_acl_base($this->base);
-    }
-
-    /* must: cn */
-    if ($this->cn == ""){
-      $message[]= "The required field 'Name' is not set.";
-    }
-
-    /* To many different object types? */
-    if (strlen($this->gosaGroupObjects) > 4){
-      $message[]= _("You can combine two different object types at maximum only!");
-    }
-
-    return ($message);
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    plugin::save();
-
-    /* Move members to target array */
-    $this->attrs['member'] =array();
-    foreach ($this->member as $key => $desc){
-      $this->attrs['member'][]= @LDAP::fix($key);
-    }
-
-    $ldap= $this->config->get_ldap_link();
-
-    /* New accounts need proper 'dn', propagate it to remaining objects */
-    if ($this->dn == 'new'){
-      $this->dn= 'cn='.$this->cn.','.get_groups_ou().$this->base;
-    }
-
-    /* Save data. Using 'modify' implies that the entry is already present, use 'add' for
-       new entries. So do a check first... */
-    $ldap->cat ($this->dn, array('dn'));
-    if ($ldap->fetch()){
-      /* Modify needs array() to remove values :-( */
-      if (!count ($this->member)){
-        $this->attrs['member']= array();
-      }
-      $mode= "modify";
-
-    } else {
-      $mode= "add";
-      $ldap->cd($this->config->current['BASE']);
-      $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
-    }
-
-    /* Write back to ldap */
-    $ldap->cd($this->dn);
-    $this->cleanup();
-    $ldap->$mode($this->attrs);
-
-    if($mode == "add"){
-      new log("create","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }else{
-      new log("modify","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }
-
-    /* Trigger post signal */
-    $this->handle_post_events($mode);
-
-    $ret= 0;
-    if (show_ldap_error($ldap->get_error(), sprintf(_("Saving of object group/generic with dn '%s' failed."),$this->dn))){
-      $ret= 1;
-    }
-
-    return ($ret);
-  }
-
-  function remove_from_parent()
-  {
-    plugin::remove_from_parent();
-
-    $ldap= $this->config->get_ldap_link();
-    $ldap->rmdir($this->dn);
-    show_ldap_error($ldap->get_error(), sprintf(_("Removing of object group/generic with dn '%s' failed."),$this->dn));
-
-    new log("remove","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-
-    /* Trigger remove signal */
-    $this->handle_post_events("remove");
-  }
-
-  
-  function PrepareForCopyPaste($source)
-  {
-    /* Update available object types */
-    if(isset($source['gosaGroupObjects'][0])){
-      $this->gosaGroupObjects =  $source['gosaGroupObjects'][0];
-    }
-
-    /* Reload tabs */
-    $this->parent->reload($this->gosaGroupObjects );
-   
-    /* Reload plugins */ 
-    foreach($this->parent->by_object as $name => $class ){
-      if(get_class($this) != $name) {
-        $this->parent->by_object[$name]->PrepareForCopyPaste($source);
-      }
-    }
-
-    /* Load member objects */
-    if (isset($source['member'])){
-      foreach ($source['member'] as $key => $value){
-        if ("$key" != "count"){
-          $value= @LDAP::convert($value);
-          $this->member["$value"]= "$value";
-        }
-      }
-    }
-
-  }
-
-
-  function getCopyDialog()
-  {
-    $smarty = get_smarty();
-    $smarty->assign("cn",     $this->cn);
-    $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE,dirname(__FILE__)));
-    $ret = array();
-    $ret['string'] = $str;
-    $ret['status'] = "";
-    return($ret);
-  }
-
-  function saveCopyDialog()
-  {
-    if(isset($_POST['cn'])){
-      $this->cn = $_POST['cn'];
-    }
-  }
-
-
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("Generic"),
-          "plDescription" => _("Object group generic"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 1,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("ogroups" => array("description"  => _("Object groups"),
-                                                      "objectClass"  => "gosaGroupOfNames")),
-          "plProvidedAcls"=> array(
-            "cn"                => _("Name"),
-            "base"              => _("Base"),
-            "description"       => _("Description"),
-            "member"            => _("Member"))
-          ));
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/ogroups/class_ogroupManagement.inc b/plugins/admin/ogroups/class_ogroupManagement.inc
deleted file mode 100644 (file)
index 5740877..0000000
+++ /dev/null
@@ -1,632 +0,0 @@
-<?php
-/*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2004 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 ogroupManagement extends plugin
-{
-  /* Definitions */
-  var $plHeadline= "Object groups";
-  var $plDescription= "This does something";
-
-  /* attribute list for save action */
-  var $attributes= array();
-  var $objectclasses= array();
-  var $obtypes= array();
-  var $ogroup;
-
-  var $CopyPasteHandler = NULL;
-  var $DivListOGroup    = NULL;
-  var $start_pasting_copied_objects = FALSE;
-
-  function ogroupManagement (&$config, $dn= NULL)
-  {
-    /* Include config object */
-    $this->config= &$config;
-    $this->ui= get_userinfo();
-
-    /* Copy & Paste enabled ?
-     */
-    if((isset($this->config->data['MAIN']['ENABLECOPYPASTE']))&&(preg_match("/true/i",$this->config->data['MAIN']['ENABLECOPYPASTE'] ))){
-      $this->CopyPasteHandler = new CopyPasteHandler($this->config);
-    }
-
-    /* Div lsit management */
-    $this->DivListOGroup = new divListOGroup($this->config,$this);
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /****************
-      Variable intialisation && Check posts for commands  
-     ****************/
-
-    $_SESSION['LOCK_VARS_TO_USE'] = array("/^act$/","/^id$/","/^group_edit_/","/^group_del_/","/^item_selected/","/^remove_multiple_ogroups/");
-
-    $smarty     = get_smarty();
-    $s_action   = "";
-    $s_entry    = "";
-
-    /* Test Posts */
-    foreach($_POST as $key => $val){
-      // Post for delete
-      if(preg_match("/^group_del.*/",$key)){
-        $s_action = "del";
-        $s_entry  = preg_replace("/^group_".$s_action."_/i","",$key);
-        // Post for edit
-      }elseif(preg_match("/^group_edit_.*/",$key)){
-        $s_action="edit";
-        $s_entry  = preg_replace("/^group_".$s_action."_/i","",$key);
-        // Post for new
-      }elseif(preg_match("/^group_new.*/",$key)){
-        $s_action="new";
-      }elseif(preg_match("/^editPaste.*/i",$key)){
-        $s_action="editPaste";
-      }elseif(preg_match("/^copy_.*/",$key)){
-        $s_action="copy";
-        $s_entry  = preg_replace("/^copy_/i","",$key);
-      }elseif(preg_match("/^cut_.*/",$key)){
-        $s_action="cut";
-        $s_entry  = preg_replace("/^cut_/i","",$key);
-      }elseif(preg_match("/^remove_multiple_ogroups/",$key)){
-        $s_action="del_multiple";
-      }elseif(preg_match("/^multiple_cut_ogroups/",$key)){
-        $s_action = "cut_multiple";
-      }elseif(preg_match("/^multiple_copy_ogroups/",$key)){
-        $s_action = "copy_multiple";
-      }elseif(preg_match("/_group_edit_/",$key)){
-        $type = preg_replace("/_group_edit_.*$/","",$key);
-        $s_action="edit";
-        $s_entry  = preg_replace("/".$type."_group_edit_/i","",$key);
-        $_POST['arg'] = $type;
-      }
-    }
-    $s_entry  = preg_replace("/_.$/","",$s_entry);
-
-    // Edit if
-    if((isset($_GET['act']))&&($_GET['act']=="edit_entry")){
-      $s_action ="edit";
-      $s_entry  = $_GET['id'];
-    }
-
-
-
-    /* handle C&P from layers menu */
-    if(isset($_POST['menu_action']) && preg_match("/^multiple_copy_systems/",$_POST['menu_action'])){
-      $s_action = "copy_multiple";
-    }
-    if(isset($_POST['menu_action']) && preg_match("/^multiple_cut_systems/",$_POST['menu_action'])){
-      $s_action = "cut_multiple";
-    }
-    if(isset($_POST['menu_action']) && preg_match("/^editPaste/",$_POST['menu_action'])){
-      $s_action = "editPaste";
-    }
-
-    /* Create options */
-    if(isset($_POST['menu_action']) && $_POST['menu_action'] == "group_new"){
-      $s_action = "new";
-    }
-
-    /* handle remove from layers menu */
-    if(isset($_POST['menu_action']) && preg_match("/^remove_multiple/",$_POST['menu_action'])){
-      $s_action = "del_multiple";
-    }
-
-
-    /****************
-      Copy & Paste handling 
-     ****************/
-
-    /* Display the copy & paste dialog, if it is currently open */
-    $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
-    if($ret){
-      return($ret);
-    }
-
-
-    /***************
-      Create a new object group 
-     ****************/
-
-    /* New group? */
-    if ($s_action=="new"){
-
-      /* By default we set 'dn' to 'new', all relevant plugins will
-         react on this. */
-      $this->dn= "new";
-
-      /* Create new usertab object */
-      $this->ogroup= new ogrouptabs($this->config,$this->config->data['TABS']['OGROUPTABS'], $this->dn,"ogroups");
-      $this->ogroup->set_acl_base($this->DivListOGroup->selectedBase);
-    }
-
-
-    /********************
-      Delete MULTIPLE entries requested, display confirm dialog
-     ********************/
-    if ($s_action=="del_multiple"){
-      $ids = $this->list_get_selected_items();
-      if(count($ids)){
-        foreach($ids as $id){
-          $dn = $this->ogrouplist[$id]['dn'];
-          if (($user= get_lock($dn)) != ""){
-            return(gen_locked_message ($user, $dn));
-          }
-          $this->dns[$id] = $dn;
-        }
-        $dns_names = "<br><pre>";
-        foreach($this->dns as $dn){
-          add_lock ($dn, $this->ui->dn);
-          $dns_names .= $dn."\n";
-        }
-        $dns_names .="</pre>";
-        /* Lock the current entry, so nobody will edit it during deletion */
-        if (count($this->dns) == 1){
-          $smarty->assign("info",     sprintf(_("You're about to delete the following object entry %s"), @LDAP::fix($dns_names)));
-        } else {
-          $smarty->assign("info",     sprintf(_("You're about to delete the following object entries %s"), @LDAP::fix($dns_names)));
-        }
-        $smarty->assign("multiple", true);
-        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
-      }
-    }
-
-
-    /********************
-      Delete MULTIPLE entries confirmed
-     ********************/
-
-    /* Confirmation for deletion has been passed. Users should be deleted. */
-    if (isset($_POST['delete_multiple_ogroup_confirm'])){
-
-      /* Remove user by user and check acls before removeing them */
-      foreach($this->dns as $key => $dn){
-
-        $acl = $this->ui->get_permissions($dn, "ogroups");
-        if (preg_match('/d/', $acl)){
-
-          /* Delete request is permitted, perform LDAP action */
-          $this->ogroup= new ogrouptabs($this->config,$this->config->data['TABS']['OGROUPTABS'], $dn);
-          $this->ogroup->delete ();
-          unset ($this->ogroup);
-          $this->ogroup= NULL;
-        } else {
-
-          /* Normally this shouldn't be reached, send some extra
-             logs to notify the administrator */
-          print_red (_("You are not allowed to delete this object group!"));
-          new log("security","ogroups/".get_class($this),$dn,array(),"Tried to trick deletion.");
-        }
-        /* Remove lock file after successfull deletion */
-        del_lock ($dn);
-        unset($this->dns[$key]);
-      }
-    }
-
-
-    /********************
-      Delete MULTIPLE entries Canceled
-     ********************/
-
-    /* Remove lock */
-    if(isset($_POST['delete_multiple_ogroup_cancel'])){
-      foreach($this->dns as $key => $dn){
-        del_lock ($dn);
-        unset($this->dns[$key]);
-      }
-    }
-
-
-    /****************
-      Delete object group
-     ****************/
-
-    if ($s_action=="del"){
-
-      /* Get 'dn' from posted 'uid' */
-      $this->dn= $this->ogrouplist[$s_entry]['dn'];
-
-      /* Load permissions for selected 'dn' and check if
-         we're allowed to remove this 'dn' */
-      $acl = $this->ui->get_permissions($this->dn,"ogroups");
-      if(preg_match("/d/",$acl)){
-
-        /* Check locking, save current plugin in 'back_plugin', so
-           the dialog knows where to return. */
-        if (($user= get_lock($this->dn)) != ""){
-          return(gen_locked_message ($user, $this->dn));
-        }
-
-        /* Lock the current entry, so nobody will edit it during deletion */
-        add_lock ($this->dn, $this->ui->dn);
-        $smarty->assign("info", sprintf(_("You're about to delete the object group '%s'."), @LDAP::fix($this->dn)));
-        $smarty->assign("multiple", false);
-        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
-      } else {
-
-        /* Obviously the user isn't allowed to delete. Show message and
-           clean session. */
-        print_red (_("You are not allowed to delete this object group!"));
-      }
-    }
-
-
-    /****************
-      Delete confirmed 
-     ****************/
-
-    /* Confirmation for deletion has been passed. Group should be deleted. */
-    if (isset($_POST['delete_group_confirm'])){
-
-      /* Some nice guy may send this as POST, so we've to check
-         for the permissions again. */
-      $acl = $this->ui->get_permissions($this->dn,"ogroups");
-      if(preg_match("/d/",$acl)){
-
-        /* Delete request is permitted, perform LDAP action */
-        $this->ogroup= new ogrouptabs($this->config,
-            $this->config->data['TABS']['OGROUPTABS'], $this->dn);
-        $this->ogroup->delete ();
-        unset ($this->ogroup);
-        $this->ogroup= NULL;
-      } else {
-
-        /* Normally this shouldn't be reached, send some extra
-           logs to notify the administrator */
-        print_red (_("You are not allowed to delete this object group!"));
-        new log("security","ogroups/".get_class($this),$dn,array(),"Tried to trick deletion.");
-      }
-
-      /* Remove lock file after successfull deletion */
-      del_lock ($this->dn);
-      unset($_SESSION['objectinfo']);
-    }
-
-
-    /****************
-      Delete object group Canceled
-     ****************/
-
-    /* Delete group canceled? */
-    if (isset($_POST['delete_cancel'])){
-      del_lock ($this->dn);
-      unset($_SESSION['objectinfo']);
-    }
-
-
-    /****************
-      Edit group
-     ****************/
-
-    if (($s_action=="edit") && (! isset($this->ogroup->config)) ){
-
-      /* Get 'dn' from posted 'uid', must be unique */
-      $this->dn= $this->ogrouplist[$s_entry]['dn'];
-
-      /* Check locking, save current plugin in 'back_plugin', so
-         the dialog knows where to return. */
-      if (($user= get_lock($this->dn)) != ""){
-        return(gen_locked_message ($user, $this->dn));
-      }
-
-      /* Lock the current entry, so everyone will get the
-         above dialog */
-      add_lock ($this->dn, $this->ui->dn);
-
-      /* Register grouptab to trigger edit dialog */
-      $this->ogroup= new ogrouptabs($this->config, $this->config->data['TABS']['OGROUPTABS'], $this->dn, "ogroups");
-      $this->ogroup->set_acl_base($this->dn);
-      $_SESSION['objectinfo']= $this->dn;
-    }
-
-
-    /****************
-      Edit finished save 
-     ****************/
-
-    /* Finish button has been pressed */
-    if ((isset($_POST['edit_finish']) || isset($_POST['edit_apply'])) && (isset($this->ogroup->config)) ){
-
-      /* Check tabs, will feed message array */
-      $message= $this->ogroup->check();
-
-      /* Save, or display error message? */
-      if (count($message) == 0){
-
-        /* Save user data to ldap */
-        $this->ogroup->save();
-
-        if (!isset($_POST['edit_apply'])){
-          /* Group has been saved successfully, remove lock from
-             LDAP. */
-          if ($this->dn != "new"){
-            del_lock ($this->dn);
-          }
-
-          unset ($this->ogroup);
-          $this->ogroup= NULL;
-          unset ($_SESSION['objectinfo']);
-        }
-      } else {
-        /* Ok. There seem to be errors regarding to the tab data,
-           show message and continue as usual. */
-        show_errors($message);
-      }
-    }
-
-
-    /****************
-      Cancel edit object group
-     ****************/
-
-    /* Cancel dialogs */
-    if ((isset($_POST['edit_cancel']))  && (isset($this->ogroup->dn))){
-      del_lock ($this->ogroup->dn);
-      unset ($this->ogroup);
-      $this->ogroup= NULL;
-      unset($_SESSION['objectinfo']);
-    }
-
-
-    /****************
-      Display open dialogs 
-     ****************/
-
-    /* Show dialog if object is present */
-    if (isset($this->ogroup->config)){
-      $display= $this->ogroup->execute();
-
-      /* Don't show buttons if tab dialog requests this */
-      if (!$this->ogroup->by_object[$this->ogroup->current]->dialog){
-        $display.= "<p style=\"text-align:right\">\n";
-        $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
-        $display.= "&nbsp;\n";
-        if ($this->dn != "new"){
-          $display.= "<input type=submit name=\"edit_apply\" value=\""._("Apply")."\">\n";
-          $display.= "&nbsp;\n";
-        }
-        $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
-        $display.= "</p>";
-      }
-      return ($display);
-    }
-
-
-    /****************
-      Display list 
-     ****************/
-
-    /* Check if there is a snapshot dialog open */
-    $base = $this->DivListOGroup->selectedBase;
-    if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases())){
-      return($str);
-    }
-
-    /* Display dialog with group list */
-    $this->DivListOGroup->parent = $this;
-    $this->DivListOGroup->execute();
-
-    /* Add departments if subsearch is disabled */
-    if(!$this->DivListOGroup->SubSearch){
-      $this->DivListOGroup->AddDepartments($this->DivListOGroup->selectedBase,4,1);
-    }
-    $this->reload ();
-    $this->DivListOGroup->setEntries($this->ogrouplist);
-    return($this->DivListOGroup->Draw());
-  }
-
-
-  /* Return departments, that will be included within snapshot detection */
-  function get_used_snapshot_bases()
-  {
-    return(array(get_groups_ou().$this->DivListOGroup->selectedBase));
-  }
-
-  
-
-  function convert_list($input)
-  {
-    $temp= "";
-
-    $conv= array(   
-        "U" => array("select_user.png"        ,_("User")        , "ogroup"),
-        "G" => array("select_groups.png"      ,_("Group")       , "ogroup"),
-        "A" => array("select_application.png" ,_("Application") , "ogroup"),
-        "D" => array("select_department.png"  ,_("Department")  , "ogroup"),
-        "S" => array("select_server.png"      ,_("Server")      , "ogroup"),
-        "F" => array("select_phone.png"       ,_("Phone")       , "phonequeue"),
-        "W" => array("select_workstation.png" ,_("Workstation") , "workstartup"),
-        "T" => array("select_terminal.png"    ,_("Terminal")    , "termgroup"),
-        "P" => array("select_printer.png"     ,_("Printer")     , "ogroup"));
-
-    /* Assemble picture */
-    $type= $input['gosaGroupObjects'][0];
-    $type= preg_replace("/[^A-Z]/i","",$type);
-    if (isset($type[0])){
-      $p1['pic']= $conv[$type[0]][0];
-      $p1['tit']= $conv[$type[0]][1];
-      $p1['alt']= $type[0];
-      $p1['lnk']= $conv[$type[0]][2];
-      $html_object_1 = "<input type='image' name='".$p1['lnk']."_group_edit_%KEY' ";
-    } else {
-      $p1['pic']= "empty.png";
-      $p1['tit']= "";
-      $p1['alt']= "";
-      $p1['lnk']= "";//$conv[$type[0]][2];
-      $html_object_1 = "<img ";
-    }
-
-    if (isset($type[1])){
-      $p2['pic']= $conv[$type[1]][0];
-      $p2['alt']= $type[1];
-      $p2['tit']= $conv[$type[1]][1];
-      $p2['lnk']= $conv[$type[1]][2];
-      $html_object_2 = "<input type='image' name='".$p2['lnk']."_group_edit_%KEY' ";
-    } else {
-      $p2['pic']= "empty.png";
-      $p2['alt']= "";
-      $p2['tit']= "";
-      $p2['lnk']= ""; //$conv[$type[0]][2];
-      $html_object_2 = "<img ";
-    }
-    
-    $temp = $html_object_1." class='center' id='iconA".preg_replace("/_/","",$p1['lnk']."_group_edit_%KEY")."' 
-      src='images/".$p1['pic']."' alt='".$p1['alt']."' title='".$p1['tit']."'>";
-    $temp.= $html_object_2." class='center' id='iconB".preg_replace("/_/","",$p2['lnk']."_group_edit_%KEY")."' 
-      src='images/".$p2['pic']."' alt='".$p2['alt']."' title='".$p2['tit']."'>";
-    return ($temp);
-  }
-
-
-  function reload()
-  {
-    /* Set base for all searches && initialise some vars */
-    $this->ogrouplist= array();
-    $base     = $this->DivListOGroup->selectedBase;
-    $filter   = "(gosaGroupObjects=[])";
-    $Regex    = $this->DivListOGroup->Regex;
-
-    $chk = array(
-        "UserGroups"          => "(gosaGroupObjects=*U*)" ,
-        "GroupGroups"         => "(gosaGroupObjects=*G*)" ,
-        "ApplicationGroups"   => "(gosaGroupObjects=*A*)" ,
-        "DepartmentGroups"    => "(gosaGroupObjects=*D*)" ,
-        "ServerGroups"        => "(gosaGroupObjects=*S*)" ,
-        "WorkstationGroups"   => "(gosaGroupObjects=*W*)" ,
-        "TerminalGroups"      => "(gosaGroupObjects=*T*)" ,
-        "PrinterGroups"       => "(gosaGroupObjects=*P*)" ,
-        "PhoneGroups"         => "(gosaGroupObjects=*F*)" );
-    /* Create filter */ 
-    foreach($chk as $chkBox => $FilterPart){
-      if($this->DivListOGroup->$chkBox){
-        $filter .=  $FilterPart;
-      }
-    }
-    $filter= "(&(cn=$Regex)(objectClass=gosaGroupOfNames)(|$filter))";
-
-    if($this->DivListOGroup->SubSearch){
-      $res= get_list($filter, "ogroups", $base, array("cn","objectClass","gosaGroupObjects"), GL_SIZELIMIT | GL_SUBSEARCH);
-    }else{
-      $res= get_list($filter, "ogroups", get_groups_ou().$base, array("cn","objectClass","gosaGroupObjects"), GL_SIZELIMIT );
-    }
-
-    $this->ogrouplist= $res;
-    ksort ($this->ogrouplist);
-    reset ($this->ogrouplist);
-    $tmp=array();
-    foreach($this->ogrouplist as $tkey => $val ){
-      $tmp[strtolower($val['cn'][0]).$val['cn'][0]]=$val;
-    }
-    ksort($tmp);
-    $this->ogrouplist=array();
-    foreach($tmp as $val){
-      $this->ogrouplist[]=$val;
-    }
-    reset ($this->ogrouplist);
-  }
-
-
-  function list_get_selected_items()
-  {
-    $ids = array();
-    foreach($_POST as $name => $value){
-      if(preg_match("/^item_selected_[0-9]*$/",$name)){
-        $id   = preg_replace("/^item_selected_/","",$name);
-        $ids[$id] = $id;
-      }
-    }
-    return($ids);
-  }
-
-
-  function copyPasteHandling_from_queue($s_action,$s_entry)
-  {
-    /* Check if Copy & Paste is disabled */
-    if(!is_object($this->CopyPasteHandler)){
-      return("");
-    }
-
-    /* Add a single entry to queue */
-    if($s_action == "cut" || $s_action == "copy"){
-
-      /* Cleanup object queue */
-      $this->CopyPasteHandler->cleanup_queue();
-      $dn = $this->ogrouplist[$s_entry]['dn'];
-      $this->CopyPasteHandler->add_to_queue($dn,$s_action,"ogrouptabs","OGROUPTABS","ogroups");
-    }
-
-
-    /* Add entries to queue */
-    if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
-
-      /* Cleanup object queue */
-      $this->CopyPasteHandler->cleanup_queue();
-
-      /* Add new entries to CP queue */
-      foreach($this->list_get_selected_items() as $id){
-        $dn = $this->ogrouplist[$id]['dn'];
-
-        if($s_action == "copy_multiple"){
-          $this->CopyPasteHandler->add_to_queue($dn,"copy","ogrouptabs","OGROUPTABS","ogroups");
-        }
-        if($s_action == "cut_multiple"){
-          $this->CopyPasteHandler->add_to_queue($dn,"cut","ogrouptabs","OGROUPTABS","ogroups");
-        }
-      }
-    }
-
-    /* Start pasting entries */
-    if($s_action == "editPaste"){
-      $this->start_pasting_copied_objects = TRUE;
-    }
-
-    /* Return C&P dialog */
-    if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
-
-      /* Load entry from queue and set base */
-      $this->CopyPasteHandler->load_entry_from_queue();
-      $this->CopyPasteHandler->SetVar("base",$this->DivListOGroup->selectedBase);
-
-      /* Get dialog */
-      $data = $this->CopyPasteHandler->execute();
-
-      /* Return dialog data */
-      if(!empty($data)){
-        return($data);
-      }
-    }
-    /* Automatically disable status for pasting */
-    if(!$this->CopyPasteHandler->entries_queued()){
-      $this->start_pasting_copied_objects = FALSE;
-    }
-    return("");
-  }
-
-
-  function save_object()
-  {
-    $this->DivListOGroup->save_object();
-  }
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/ogroups/class_phonequeue.inc b/plugins/admin/ogroups/class_phonequeue.inc
deleted file mode 100644 (file)
index f67ee78..0000000
+++ /dev/null
@@ -1,961 +0,0 @@
-<?php
-
-class phonequeue extends plugin
-{
-  /* plugin specific values */
-  var $mail= "";
-  var $cn= "";
-  var $old_cn ="";
-
-  var $goFonTimeOut             ="20"; 
-  var $goFonMaxLen              ="20"; // 
-  var $goFonAnnounceFrequency   ="60"; // Annouce Frequency in seconds
-  var $goFonDialOptiont         ="";
-  var $goFonDialOptionT         ="";
-  var $goFonDialOptionh         ="";
-  var $goFonDialOptionr         ="";
-  var $goFonDialOptionH         ="";
-  var $goFonQueueAnnounce       ="gonicus-berlin-welcome";
-  var $goFonMusiconHold         ="default";
-  var $goFonWelcomeMusic        ="gonicus-berlin-welcome";
-  var $goFonQueueReportHold     ="yes";
-  var $goFonQueueYouAreNext     ="queue-youarenext";
-  var $goFonQueueThereAre       ="queue-thereare";
-  var $goFonQueueCallsWaiting   ="queue-callswaiting";
-  var $goFonQueueThankYou       ="queue-thankyou";
-  var $goFonQueueMinutes        ="queue-minutes"; 
-  var $goFonQueueSeconds        ="queue-seconds";
-  var $goFonQueueLessThan       ="queue-lessthan";
-  var $goFonQueueLanguage       ="queue-holdtime";
-  var $goFonQueueStrategy       ="ringall";
-  var $goFonQueueAnnounceHoldtime="yes";
-  var $telephoneNumber          =array();
-  var $goFonQueueMember         =array(); 
-  var $goFonDialOption          ="";
-  var $goFonQueueRetry          =5;
-
-  var $goFonQueueStrategyOptions=array();
-  var $goFonQueueStrategyOptionsR=array();
-  
-  var $old_phone_numbers        =array();
-
-  var $goFonHomeServer  = "0";
-  var $init_HomeServer  = "0";
-  var $goFonHomeServers = array();
-
-  var $view_logged = FALSE;
-
-  /* attribute list for save action */
-  var $attributes= array( "goFonTimeOut","goFonMaxLen","goFonAnnounceFrequency","goFonDialOptiont","goFonDialOptionT",
-      "goFonDialOptionh","goFonDialOptionr","cn","goFonHomeServer",
-      "goFonDialOptionH","goFonMusiconHold","goFonWelcomeMusic","goFonQueueReportHold","goFonQueueYouAreNext",
-      "goFonQueueThereAre","goFonQueueCallsWaiting","goFonQueueThankYou","goFonQueueMinutes","goFonQueueSeconds","goFonQueueLessThan",
-      "telephoneNumber","goFonQueueLanguage","goFonQueueStrategy","goFonQueueAnnounceHoldtime","goFonQueueAnnounce","goFonDialOption","goFonQueueRetry");
-
-  /* ObjectClass */
-  var $objectclasses= array("goFonQueue");
-
-
-
-  /* Pluigin initialization 
-   * - Check currently selected and available home server.
-   * - Set default home server if necessary
-   * - Parse phone options flags
-   * - Get phone numbers 
-   */
-  function phonequeue (&$config, $dn= NULL)
-  {
-    plugin::plugin($config, $dn);
-
-    /* Check server configurations
-     * Load all server configuration in $this->goFonHomeServers if available
-     *  and use first server as default if necessary.
-     */
-    if(array_key_exists('config',$_SESSION) &&
-        array_key_exists('SERVERS',$_SESSION['config']->data) &&
-        array_key_exists('FON',$_SESSION['config']->data['SERVERS']) &&
-        count($_SESSION['config']->data['SERVERS']['FON']) &&
-        is_callable("mysql_connect")
-      ) {
-
-      /* Set available server */
-      $this->goFonHomeServers = $_SESSION['config']->data['SERVERS']['FON'];
-
-      /* Set default server */
-      if($this->dn == "new"){
-        $this->goFonHomeServer = $this->goFonHomeServers[0]['DN'];
-      }
-
-      /* Remember inital home server, to be able to remove old entries */
-      $this->init_HomeServer = $this->goFonHomeServer;
-
-      /* get config */
-      if(!isset($this->goFonHomeServers[$this->goFonHomeServer])){
-        print_red(sprintf(_("The specified home server '%s' is not available in GOsa server configuration. Saving this account will create a new entry on the server '%s'. Use cancel if you do not want to create a new entry while ignoring old accounts."), preg_replace("/,/",", ",$this->goFonHomeServer), preg_replace("/,/",", ",$this->goFonHomeServers[0]['DN'])));
-        $this->goFonHomeServer = $this->goFonHomeServers[0]['DN'];
-        $this->init_HomeServer = $this->goFonHomeServers[0]['DN'];
-      }
-      $cur_cfg = $this->goFonHomeServers[$this->goFonHomeServer];
-    }
-
-
-    /* Variable init  
-     *  Load phone nubmers and parse dial options 
-     */
-    if($this->is_account){
-      if(isset($this->attrs['telephoneNumber'])){
-        $this->telephoneNumber=$this->attrs['telephoneNumber'];
-        unset($this->telephoneNumber['count']); 
-      }
-      for($i = 0; $i < strlen($this->goFonDialOption); $i++){
-        $name = "goFonDialOption".$this->goFonDialOption[$i];
-        $this->$name=$this->goFonDialOption[$i];
-      }
-    }
-
-    /* Set Queue announce hold time to true/false */
-    if(preg_match("/no/i",$this->goFonQueueAnnounceHoldtime)){
-      $this->goFonQueueAnnounceHoldtime=false;
-    }else{
-      $this->goFonQueueAnnounceHoldtime=true;
-    }
-
-    /* Define all available ringdown types */
-    $types= array('ringall'    =>_("ring all"),
-        'roundrobin' =>_("round robin"),
-        'leastrecent'=>_("least recently called"),
-        'fewestcalls'=>_("fewest completed calls"),
-        'random'     =>_("random"),
-        'rrmemory'   =>_("round robin with memory"));
-    $i = 0;
-    foreach($types as $type => $name){
-      $i++;
-      $this->goFonQueueStrategyOptions[$i]    =$name;
-      $this->goFonQueueStrategyOptionsR[$i]   =$type;
-      $tmp[$type] = $i; 
-    }
-    $this->goFonQueueStrategy= $tmp[$this->goFonQueueStrategy];
-    $this->old_cn = $this->cn;
-    $this->old_phone_numbers = $this->telephoneNumber;
-  }
-
-
-  /* This function ensures that the selected home server 
-   * and the initially selected home server are reachable and accessible  
-   */
-  function check_database_accessibility()
-  {
-    /* Check if mysql extension is available */
-    if(!is_callable("mysql_pconnect")){
-      return(_("Can't save any changes to asterisk database, there is currently no mysql extension available in your php setup."));
-    }
-
-    /********************
-     * Check currently selected home server
-     ********************/
-
-    $cfg_Current  = $this->goFonHomeServers[$this->goFonHomeServer];
-    $r_current    =  @mysql_pconnect($cfg_Current['SERVER'],$cfg_Current['LOGIN'],$cfg_Current['PASSWORD']);
-    if(!$r_current){
-      new log("debug","ogroups/".get_class($this),"",array(),@mysql_error($r_current));
-      return(sprintf(_("The MySQL home server '%s' isn't reachable as user '%s', check GOsa log for mysql error."),
-            $cfg_Current['SERVER'],$cfg_Current['LOGIN']));
-    }
-    $db_current  =  @mysql_select_db($cfg_Current['DB'],$r_current);
-    if(!$db_current){
-      new log("debug","ogroups/".get_class($this),"",array(),@mysql_error($r_current));
-      mysql_close($r_current);
-      return( sprintf(_("Can't select database '%s' on home server '%s'."),$cfg_Current['DB'],$cfg_Current['SERVER']));
-    }
-
-    /********************
-     * Check init home server
-     ********************/
-
-    if($this->initially_was_account){
-      $cfg_Init  = $this->goFonHomeServers[$this->init_HomeServer] ;
-      $r_init    =  @mysql_pconnect($cfg_Init['SERVER'],$cfg_Init['LOGIN'],$cfg_Init['PASSWORD']);
-      if(!$r_init){
-        new log("debug","ogroups/".get_class($this),"",array(),@mysql_error($r_init));
-        return(sprintf(_("The MySQL initial home server '%s' isn't reachable as user '%s', check GOsa log for mysql error."),
-              $cfg_Init['SERVER'],$cfg_Init['LOGIN']));
-      }
-      $db_init  =  @mysql_select_db($cfg_Init['DB'],$r_init);
-      if(!$db_init){
-        new log("debug","ogroups/".get_class($this),"",array(),@mysql_error($r_init));
-        mysql_close($r_init);
-        return( sprintf(_("Can't select database '%s' on initial home server '%s'."),$cfg_Init['DB'],$cfg_Init['SERVER']));
-      }
-    }
-  }
-
-  
-  /* Display plugin ui */
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","ogroups/".get_class($this),$this->dn);
-    }
-
-    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->parent !== NULL){
-      if ($this->is_account){
-        $display= $this->show_disable_header(_("Remove the phone queue from this Account"),
-            _("Phone queue is enabled for this group. You can disable it by clicking below."));
-      } else {
-        $display= $this->show_enable_header(_("Create phone queue"),
-            _("For this group the phone queues are disabled. You can enable them by clicking below."));
-        return ($display);
-      }
-    }
-
-    if($this->acl_is_writeable("telephoneNumber")){
-
-      /* Add queue number */ 
-      if(isset($_POST['add_phonenumber'])&&(isset($_POST['phonenumber']))&&(!empty($_POST['phonenumber']))){
-        if((!in_array($_POST['phonenumber'],$this->telephoneNumber))&&(is_numeric($_POST['phonenumber']))){
-          $this->telephoneNumber[]=$_POST['phonenumber'];
-        }
-      }
-
-      /* Delete queue number */ 
-      if(isset($_POST['delete_phonenumber'])&&(isset($_POST['goFonQueueNumber_List']))){
-        unset($this->telephoneNumber[$_POST['goFonQueueNumber_List']]);
-      }
-
-      /* queue number up */ 
-      if(isset($_POST['up_phonenumber'])&&(isset($_POST['goFonQueueNumber_List']))){
-        if($_POST['goFonQueueNumber_List']>0){
-          $up   = $this->telephoneNumber[$_POST['goFonQueueNumber_List']];
-          $down = $this->telephoneNumber[$_POST['goFonQueueNumber_List']-1];
-          $this->telephoneNumber[$_POST['goFonQueueNumber_List']]    = $down;
-          $this->telephoneNumber[$_POST['goFonQueueNumber_List']-1]  = $up;
-        }
-      }
-
-      /* Queuenumber down */
-      if(isset($_POST['down_phonenumber'])&&(isset($_POST['goFonQueueNumber_List']))){
-        if(isset($this->telephoneNumber[($_POST['goFonQueueNumber_List']+1)])){
-          $up   = $this->telephoneNumber[$_POST['goFonQueueNumber_List']+1];
-          $down = $this->telephoneNumber[$_POST['goFonQueueNumber_List']];
-          $this->telephoneNumber[$_POST['goFonQueueNumber_List']+1]    = $down;
-          $this->telephoneNumber[$_POST['goFonQueueNumber_List']]  = $up;
-        }
-        $this->telephoneNumber[$_POST['goFonQueueNumber_List']]  = $up;
-      }
-    }
-
-    $tmp = array();
-    foreach($this->telephoneNumber as $val){
-      if(!empty($val)){
-        $tmp[]= $val;
-      }
-    }  
-    $this->telephoneNumber=$tmp;
-
-    /* Assign samrty variables */
-    $smarty= get_smarty();
-    $smarty->assign("goFonQueueLanguageOptions",get_languages(FALSE,TRUE));
-    $smarty->assign("goFonQueueStrategyOptions", $this->goFonQueueStrategyOptions);
-
-    /* Set acls */
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translated){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-
-    foreach($this->attributes as $key => $val){
-      $smarty->assign($val,$this->$val);  
-      if($this->$val == false){
-        $smarty->assign($val."CHK","");
-      }else{
-        $smarty->assign($val."CHK"," checked ");
-      }
-    }
-    
-    /* Create array with goFonHomeServer */
-    $tmp = array();
-    foreach($this->goFonHomeServers as $dn => $val){
-      if(!is_numeric($dn)){
-        $tmp[$dn]  = $val['SERVER'];
-      }
-    }
-    $smarty->assign("goFonHomeServers",$tmp);
-
-    return ($display.$smarty->fetch (get_template_path('phonequeue.tpl', TRUE)));
-  }
-
-
-  /* Check formular input */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-    if(!count($this->goFonHomeServers)){
-      $message[] = _("There must be at least one server with an asterisk database to create a phone queue.");
-    }
-    if(empty($this->goFonHomeServer)){
-      $message[] = _("Please select a valid goFonHomeServer.");
-    }
-    if($this->is_number_used()){
-      $message[] = $this->is_number_used();
-    }
-    if(!((is_numeric($this->goFonTimeOut))||(empty($this->goFonTimeOut)))){
-      $message[] = _("Timeout must be numeric");
-    }
-    if(!((is_numeric($this->goFonQueueRetry))||(empty($this->goFonQueueRetry)))){
-      $message[] = _("Retry must be numeric");
-    }
-    if(!((is_numeric($this->goFonMaxLen))||(empty($this->goFonMaxLen)))){
-      $message[] = _("Max queue length must be numeric");
-    }
-    if(!((is_numeric($this->goFonAnnounceFrequency))||(empty($this->goFonAnnounceFrequency)))){
-      $message[] = _("Announce frequency must be numeric");
-    }
-    if(count($this->telephoneNumber)==0){
-      $message[] = _("There must be least one queue number defined.");
-    }
-
-    /* check if add to database could be successfull  */
-    $str = $this->add_to_database();
-    if(!empty($str)){
-      $message[] = $str;
-    }
-    return $message;
-  }
-
-
-  /* This function removes the old database entries. 
-   * If this entry should be removed or the home server has changed
-   *  this function is called to ensure that all old entries will be deleted.
-   */
-  function remove_from_database($save = false)
-  {
-    /* Check if we must remove old entries */
-    if($this->initially_was_account){
-
-      /* Check if there is at least on server configuration */
-      if(!count($this->goFonHomeServers)){
-        return( _("There is currently no asterisk server defined. Possibly you are missing a server that handles the asterisk management (goFonServer). Your settings can't be saved to asterisk database."));
-      }
-
-      /********************
-       * Get configuration and check it
-       ********************/
-
-      /* Check if databases are reachable, returns an error string if anything fails  */
-      $error_str = $this->check_database_accessibility();
-      if($error_str){
-        return($error_str);
-      }
-
-      /* Connect to current database to be able to add new entries */
-      $cfg_Current  = $this->goFonHomeServers[$this->init_HomeServer] ;
-      $res_cur      =  @mysql_pconnect($cfg_Current['SERVER'],$cfg_Current['LOGIN'],$cfg_Current['PASSWORD']);
-      $db_cur       =  @mysql_select_db($cfg_Current['DB'],$res_cur);
-
-      /* Create sql entries */
-      $delete[]=    "DELETE FROM ".$cfg_Current['EXT_TABLE']."    WHERE exten='".$this->old_cn."';\n";
-      $delete[]=    "DELETE FROM ".$cfg_Current['QUEUE_TABLE']."  WHERE name='".$this->old_cn."'; \n";
-      $delete[]=    "DELETE FROM ".$cfg_Current['QUEUE_MEMBER_TABLE']." WHERE queue_name='".$this->old_cn."';\n";
-      foreach($this->old_phone_numbers as $number){
-        $delete[]=    "DELETE FROM ".$cfg_Current['EXT_TABLE']."    WHERE exten='".$number."';\n";
-      }
-
-      /* Execute the queries */  
-      if($save){
-        foreach($delete as $sql){
-          $res = @mysql_query($sql,$res_cur);
-          if(!$res){
-            new log("debug","ogroups/".get_class($this),"",array(),@mysql_error($r_current));
-            return(_("Error while removing old queue entries from database.").
-                "&nbsp;"._("Please have a look a the gosa logfiles."));
-          }
-        }
-      }
-    }
-  }
-
-
-  /* This function handles the database entries for this 
-   *  queue. 
-   * Existing entries will be updated if possible.
-   */
-  function add_to_database($save = false)
-  {
-    /* Check if there is at least on server configuration */
-    if(!count($this->goFonHomeServers)){
-      return( _("There is currently no asterisk server defined. Possibly you are missing a server that handles the asterisk management (goFonServer). Your settings can't be saved to asterisk database."));
-    }
-
-    /********************
-     * Get configuration and check it
-     ********************/
-
-    /* Check if databases are reachable, returns an error string if anything fails  */
-    $error_str = $this->check_database_accessibility();
-    if($error_str){
-      return($error_str);
-    }
-
-    /* Connect to current database to be able to add new entries */
-    $cfg_Current  = $this->goFonHomeServers[$this->goFonHomeServer] ;
-    $res_cur      =  @mysql_pconnect($cfg_Current['SERVER'],$cfg_Current['LOGIN'],$cfg_Current['PASSWORD']);
-    $db_cur       =  @mysql_select_db($cfg_Current['DB'],$res_cur);
-
-    /* Connect to old home server and remove old entries if necessary */
-    if(($this->initially_was_account) && ($this->init_HomeServer != $this->goFonHomeServer)){
-      $str = $this->remove_from_database($save); 
-      if(!empty($str)){
-        return($str);;
-      }
-    }
-
-    /* Ensure that we have the new cn in $this->cn and the old cn in $this->old_cn */
-    $this->cn = $this->parent->by_object['ogroup']->cn;
-
-    if($save){
-  
-      /*****************
-       * Create queue table entry 
-       *****************/
-      /* Check if QUEUE_TABLE entry exists.
-       * If this entry is missing - create it 
-       *  else update the entry with new values.
-       */
-      $query = "SELECT * FROM ".$cfg_Current['QUEUE_TABLE']."  WHERE name='".$this->old_cn."';";
-      $res   = mysql_query($query,$res_cur);
-      if(!$res){
-        new log("debug","ogroups/".get_class($this),"",array(),@mysql_error($res_cur));
-        return(_("Could not detect old queue entry, query failed.")."&nbsp;"._("Please have a look a the gosa logfiles."));
-      }
-      $cnt = mysql_affected_rows($res_cur);
-
-
-      /* Create queue table entry 
-       * Leave unused options empty. 
-       */
-      $queue["announce"]              = "";
-      $queue["monitor_join"]          = "";
-      $queue["monitor_format"]        = "";
-      $queue["announce_round_seconds"]= "";   
-      $queue["wrapuptime"]            = "";
-      $queue["servicelevel"]          = "";
-      $queue["eventmemberstatus"]     = "";
-      $queue["eventwhencalled"]       = "";
-      $queue["memberdelay"]           = "";
-      $queue["weight"]                = "";
-      $queue["timeoutrestart"]        = "";
-
-      $queue["queue_holdtime"]        = $this->goFonQueueAnnounce;
-      $queue["queue_lessthan"]        = $this->goFonQueueLessThan;   
-      $queue["retry"]                 = $this->goFonQueueRetry;
-      $queue["reportholdtime"]        = "1";
-      $queue["joinempty"]             = "no";
-      $queue["leavewhenempty"]        = "yes";   
-
-      $queue["context"]               = "default";
-      $queue["name"]                  = $this->cn;  
-      $queue["timeout"]               = $this->goFonTimeOut; 
-      $queue["maxlen"]                = $this->goFonMaxLen;
-      $queue["strategy" ]             = $this->goFonQueueStrategyOptionsR[$this->goFonQueueStrategy];
-      $queue["queue_thankyou"]        = $this->goFonQueueThankYou;   
-      $queue["queue_reporthold"]      = $this->goFonQueueReportHold; 
-      $queue["announce_frequency"]    = $this->goFonAnnounceFrequency;
-      $queue["queue_youarenext"]      = $this->goFonQueueYouAreNext;   
-      $queue["queue_thereare"]        = $this->goFonQueueThereAre;   
-      $queue["queue_callswaiting"]    = $this->goFonQueueCallsWaiting;
-      $queue["queue_minutes"]         = $this->goFonQueueMinutes;
-      $queue["queue_seconds"]         = $this->goFonQueueSeconds;   
-      $queue["announce_holdtime"]     = $this->goFonQueueAnnounceHoldtime;   
-      $queue["musiconhold"]           = $this->goFonMusiconHold;
-
-
-      /* Check if we must create a new queue entry 
-       *  or if we can update an existing entry 
-       *  $cnt contains the number of entries matching this cn
-       */
-
-      /* Create new queue table entry 
-       */
-      if($cnt == 0){
-
-        /* Parse and Add Queue */
-        $entries = "";
-        $values  = "";
-        foreach($queue as $attr=>$val){
-          if($val == "") continue;
-          $entries.= "`".$attr."`,";
-          $values .= "'".$val."',";
-        }
-        $values  = preg_replace("/,$/","",$values);
-        $entries = preg_replace("/,$/","",$entries );
-        $SQL[]="INSERT INTO ".$cfg_Current['QUEUE_TABLE']." (".$entries.") VALUES (".$values.");";
-      }elseif($cnt == 1){
-
-        /* Update queue table entry 
-         */
-        $queue_old = @mysql_fetch_assoc($res);
-        foreach($queue_old as $name => $value){
-          if(isset($queue[$name]) && $queue[$name] == $value){
-            unset($queue[$name]);
-          }
-        }
-
-        /* Parse and Add Queue */
-        if(count($queue)){
-          $query = "UPDATE ".$cfg_Current['QUEUE_TABLE']." SET ";
-          foreach($queue as $key => $val){
-            $query.= "".$key."='".$val."',";
-          }
-          $query = preg_replace("/,$/","",$query);
-          $query.= " WHERE name='".$this->old_cn."';";
-          $SQL[] = $query;
-        }
-      }else{
-        return(sprintf(_("More than one entry in queue table found, that uses the name ('%s'). Please fix this issue manually first."),$this->cn));
-      }
-
-
-      /*****************
-       * Create queue member entries
-       *****************/
-      
-      /* Add the queue member entries 
-       * First we must remove all old user entries. 
-       * to be able to add a clean set of members.
-       */ 
-      $SQL[]= "DELETE FROM ".$cfg_Current['QUEUE_MEMBER_TABLE']." WHERE queue_name='".$this->cn."';";
-      $SQL[]= "DELETE FROM ".$cfg_Current['QUEUE_MEMBER_TABLE']." WHERE queue_name='".$this->old_cn."';";
-      
-      /* Append new Member for this queue */ 
-      $queueuser =array();
-      $i = 0;
-      $parent = $this->parent->by_object['ogroup'];
-
-      
-      $ldap = $this->config->get_ldap_link();
-      foreach($parent->memberList as $member => $mem_data){
-        $ldap->cat($member,array("goFonHomeServer","objectClass","dn","uid"));
-        if($ldap->count()){
-
-          $obj = $ldap->fetch();
-
-          /* Calculate server and account dependencies */
-          $is_acc = in_array("goFonAccount",$obj['objectClass']);
-          $is_home= isset($obj['goFonHomeServer'][0]) && $obj['goFonHomeServer'][0] == $this->goFonHomeServer; 
-
-          /* Append user to list of queue member,
-           *  only if user has phoneAccount extension && is on same home server */
-          if($is_acc && $is_home){
-            $i ++ ;
-            $queueuser[$i]['queue_name']  = $this->cn; 
-            $queueuser[$i]['interface']   = "SIP/".$obj['uid'][0]; 
-            $queueuser[$i]['penalty']     = 1; 
-          }
-        }
-      }
-
-      /* Parse and Add members to query Array */
-      if(is_array($queueuser)){
-        foreach($queueuser as $user){
-          $entries = "";
-          $values  = "";
-          foreach($user as $attr => $val){
-            $entries.= "`".$attr."`,"; 
-            $values .= "'".$val."',";
-          }
-          $values  = preg_replace("/,$/","",$values);
-          $entries = preg_replace("/,$/","",$entries );
-
-          $SQL[]="INSERT INTO ".$cfg_Current['QUEUE_MEMBER_TABLE']." (".$entries.") VALUES (".$values.")"; 
-        }
-      }
-      
-
-      /*****************
-       * Create extension entries
-       *****************/
-      
-      /* Add the extension entries 
-       * First we must remove all old entensions. 
-       */ 
-      $SQL[]=  "DELETE FROM ".$cfg_Current['EXT_TABLE']."  WHERE exten='".$this->cn."';\n";
-      $SQL[]=  "DELETE FROM ".$cfg_Current['EXT_TABLE']."  WHERE exten='".$this->old_cn."';\n";
-
-      /* Delete old enxtension entries for the old telephone nubmer  */
-      if(is_array($this->old_phone_numbers)){
-        foreach($this->old_phone_numbers as $phone){
-          $SQL[]= "DELETE FROM ".$cfg_Current['EXT_TABLE']." WHERE exten='".$phone."';\n";
-        }
-      }
-      
-      /* Delete enxtension entries for telephone numbers  */
-      if(is_array($this->telephoneNumber)){
-        foreach($this->telephoneNumber as $phone){
-          $SQL[]= "DELETE FROM ".$cfg_Current['EXT_TABLE']." WHERE exten='".$phone."';\n";
-        }
-      }
-
-      /* Create a extension entry fpr each telephoneNumber */
-      $i_insert_only_once = false;
-      $prio = 11;   // This represents the priority for each telephoneNumber 
-      foreach($this->telephoneNumber as $num){
-
-        /* The naming refrences */
-        if($i_insert_only_once == false){
-          $i_insert_only_once = true;
-          $a_ext[$i]['context']  = 'GOsa';
-          $a_ext[$i]['exten']    = $this->cn;
-          $a_ext[$i]['priority'] = 1;
-          $a_ext[$i]['app']      = "Goto";
-          $a_ext[$i]['appdata']  = $num."|1";
-          $i ++ ; 
-        }
-
-        /* If there is currently no user for this queue 
-         * Play no service sound file and return to default context.  
-         */
-        if(count($queueuser)==0){
-          $a_ext[$i]['context']  = 'GOsa';
-          $a_ext[$i]['exten']    = $num;
-          $a_ext[$i]['priority'] = 1;
-          $a_ext[$i]['app']      = "SetLanguage";
-          $a_ext[$i]['appdata']  = "de";
-          $i ++ ; 
-
-          $a_ext[$i]['context']  = 'GOsa';
-          $a_ext[$i]['exten']    = $num;
-          $a_ext[$i]['priority'] = 2;
-          $a_ext[$i]['app']      = "Playback";
-          $a_ext[$i]['appdata']  = "ss-noservice";
-          $i ++ ; 
-
-          $a_ext[$i]['context']  = 'GOsa';
-          $a_ext[$i]['exten']    = $num;
-          $a_ext[$i]['priority'] = 3;
-          $a_ext[$i]['app']      = "Goto";
-          $a_ext[$i]['appdata']  = "default";
-          $i ++ ; 
-        }else{
-
-          /* Dcrement priority to avoid using same priority twice */
-          $prio --;
-
-          /* Wait for 2 seconds */
-          $a_ext[$i]['context']  = 'GOsa';
-          $a_ext[$i]['exten']    = $num;
-          $a_ext[$i]['priority'] = 1;
-          $a_ext[$i]['app']      = "Wait";
-          $a_ext[$i]['appdata']  = "2";
-          $i ++ ; 
-    
-          /* Set language to queue language */
-          $a_ext[$i]['context']  = 'GOsa';
-          $a_ext[$i]['exten']    = $num;
-          $a_ext[$i]['priority'] = 2;
-          $a_ext[$i]['app']      = "SetLanguage";
-          $a_ext[$i]['appdata']  = $this->goFonQueueLanguage;
-          $i ++ ; 
-  
-          /* Play welcome sound file */
-          $a_ext[$i]['context']  = 'GOsa';
-          $a_ext[$i]['exten']    = $num;
-          $a_ext[$i]['priority'] = 3;
-          $a_ext[$i]['app']      = "Playback";
-          $a_ext[$i]['appdata']  = $this->goFonWelcomeMusic;
-          $i ++ ; 
-
-          /* Set CID name */
-          $a_ext[$i]['context']  = 'GOsa';
-          $a_ext[$i]['exten']    = $num;
-          $a_ext[$i]['priority'] = 4;
-          $a_ext[$i]['app']      = "SetCIDName";
-          if(!empty($this->parent->by_object['ogroup']->description)){
-            $a_ext[$i]['appdata']  = $this->parent->by_object['ogroup']->description;
-          }else{
-            $a_ext[$i]['appdata']  = $this->cn." - ".$num;
-          }
-          $i ++ ; 
-
-          /* Set queue priority */
-          $a_ext[$i]['context']  = 'GOsa';
-          $a_ext[$i]['exten']    = $num;
-          $a_ext[$i]['priority'] = 5;
-          $a_ext[$i]['app']      = "SetVar";
-          $a_ext[$i]['appdata']  = "QUEUE_PRIO=".$prio;
-          $i ++ ; 
-
-          /* Open queue */
-          $a_ext[$i]['context']  = 'GOsa';
-          $a_ext[$i]['exten']    = $num;
-          $a_ext[$i]['priority'] = 6;
-          $a_ext[$i]['app']      = "Queue";
-          $a_ext[$i]['appdata']  =  $this->cn;
-            "|".
-            $this->goFonDialOptiont.
-            $this->goFonDialOptionT.
-            $this->goFonDialOptionh.
-            $this->goFonDialOptionH.
-            $this->goFonDialOptionr;
-        }
-
-        $i++;
-      }
-
-      /* Parse and Add Extension entries */
-      foreach($a_ext as $ext){
-        $entries = "";
-        $values  = "";
-        foreach($ext as $attr => $val){
-          $entries.= "`".$attr."`,";
-          $values .= "'".$val."',";
-        }
-        $values  = preg_replace("/,$/","",$values);
-        $entries = preg_replace("/,$/","",$entries );
-        $SQL[]="INSERT INTO ".$cfg_Current['EXT_TABLE']." (".$entries.") VALUES (".$values.")";
-      }
-
-      /* Do all collected mysql queries 
-       */
-      foreach($SQL as $query)
-      $res   = mysql_query($query,$res_cur);
-      if(!$res){
-        new log("debug","ogroups/".get_class($this),"",array(),@mysql_error($res_cur));
-        return(_("Mysql query failed.")."&nbsp;"._("Please have a look a the gosa logfiles."));
-      }
-    }
-    @mysql_close($r_con);
-    return(false);
-  }
-
-
-  /* This function checks if the given phonenumbers 
-   *  are available or already in use
-   */
-  function is_number_used()
-  {
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(&(& (!(uid=".$this->cn."))
-                        (!(cn=".$this->cn.")))
-                     (| (objectClass=goFonAccount)
-                        (objectClass=goFonQueue)
-                        (objectClass=goFonConference)))", array("telephoneNumber","cn","uid"));
-    while($attrs = $ldap->fetch()) {
-      unset($attrs['telephoneNumber']['count']);
-      foreach($attrs['telephoneNumber'] as $tele){
-        if(!isset($attrs['cn'][0])) $attrs['cn'][0]=$attrs['dn'];
-        if(!isset($attrs['uid'][0])) $attrs['uid'][0]=$attrs['dn'];
-        $numbers[$tele]=$attrs;
-      }
-    }
-
-    foreach($this->telephoneNumber as $num){
-      if((isset($numbers[$num]))&&(($numbers[$num]['cn'][0]!= $this->attrs['cn'][0]))){
-        if(isset($numbers[$num]['uid'][0])){
-          return sprintf(_("The specified telephonenumber '%s' is already assigned to '%s'."),$num,$numbers[$num]['uid'][0]);
-        }else{
-          return sprintf(_("The specified telephonenumber '%s' is already assigned to '%s'."),$num,$numbers[$num]['cn'][0]);
-        }
-      }
-    }
-  }
-
-
-  /* Get posted attributes */
-  function save_object()
-  {
-    plugin::save_object();  
-    if(isset($_POST['phonenumber'])){
-      foreach(array("goFonDialOptiont","goFonDialOptionT","goFonDialOptionh","goFonDialOptionr","goFonDialOptionH","goFonMusiconHold") as $val){
-        if(isset($_POST[$val])){
-          $this->$val = $_POST[$val];
-        }else{
-          $this->$val = false;
-        }
-      }
-      if(isset($_POST['goFonQueueAnnounceHoldtime'])){
-        $this->goFonQueueAnnounceHoldtime = "yes";
-      }else{
-        $this->goFonQueueAnnounceHoldtime = false;
-      }
-    }
-  }
-
-
-  function save()
-  {
-    $ldap= $this->config->get_ldap_link();
-
-    plugin::save();
-
-    /* Create dial option attribute */
-    $this->attrs['goFonDialOption'] = "";
-    foreach(array("goFonDialOptiont","goFonDialOptionT","goFonDialOptionr","goFonDialOptionh","goFonDialOptionH","cn") as $val){
-      $this->attrs['goFonDialOption'].=$this->$val; 
-      unset($this->attrs[$val]); 
-    }
-    if(empty($this->attrs['goFonDialOption'])) {
-      $this->attrs['goFonDialOption']=array();
-    }
-
-    /* Set announce hold time to yes no .. */
-    if($this->goFonQueueAnnounceHoldtime != "no" ){
-      $this->attrs['goFonQueueAnnounceHoldtime'] = "yes";
-    }else{
-      $this->attrs['goFonQueueAnnounceHoldtime'] = "no";
-    }
-
-    /* Set strategy */
-    $this->attrs['goFonQueueStrategy'] = $this->goFonQueueStrategyOptionsR[$this->goFonQueueStrategy];
-
-    /* Add database entry, display error and abort if this fails */
-    $str = $this->add_to_database(true);
-    if(!empty($str)){
-      print_red($str);
-    }
-
-    /* Save data to LDAP */
-    $ldap->cd($this->dn);
-    $this->cleanup();
-    $ldap->modify ($this->attrs); 
-
-    if($this->initially_was_account){
-      new log("modify","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }else{
-      new log("modify","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }
-
-    show_ldap_error($ldap->get_error(), _("Saving phone queue 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");
-    }
-  }
-
-
-  /* remove object from parent */
-  function remove_from_parent()
-  {
-    /* Cancel if nothing is to do here */
-    if (!$this->initially_was_account){
-      return;
-    }
-
-    /* Remove database entries, 
-     *  if fails display errors and abort
-     */
-    $str = $this->remove_from_database(true);
-    if(!empty($str)){
-      print_red($str);
-      return false;
-    }
-  
-    /* Remove all temporary attributes */
-    $tmp = array_flip($this->attributes);
-    foreach(array("goFonDialOptiont","goFonDialOptionT","goFonDialOptionr","goFonDialOptionh","goFonDialOptionH","cn") as $val){
-      unset($this->$val);
-      unset($this->attrs[$val]);
-      unset($tmp[$val]);
-    }   
-    foreach(array_flip($tmp) as $key => $val){
-      $tmp2[]=$val;
-    } 
-    $this->attributes = $tmp2;
-
-    /* include global link_info */
-    $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); 
-    new log("remove","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    show_ldap_error($ldap->get_error(), _("Removing phone queue failed"));
-  }
-
-  
-  function getCopyDialog()
-  {
-    $str  = "";
-    $str .= _("Phone number");
-    $str .= "&nbsp;<input type='text' name='telephoneNumber' value='".$this->telephoneNumber."'>";
-    return($str);
-  }
-
-
-  function saveCopyDialog()
-  {
-    if(isset($_POST['telephoneNumber'])){
-      $this->telephoneNumber = $_POST['telephoneNumber'];
-    }
-  }
-
-
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("Phone"),
-          "plDescription" => _("Phone group"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 3,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("ogroups"),
-          "plProvidedAcls"=> array(
-
-            "goFonTimeOut"              => _("Timeout"),
-            "goFonMaxLen"               => _("Max queue length"),
-            "goFonHomeServer"           => _("Home server"),
-            "goFonAnnounceFrequency"    => _("Announce frequency"),
-            "goFonDialOptiont"          => _("Allow the called user to transfer his call"),
-            "goFonDialOptionT"          => _("Allows calling user to transfer call"),
-            "goFonDialOptionh"          => _("Allow the called to hangup by pressing *"),
-            "goFonDialOptionr"          => _("Ring instead of playing background music"),
-            "goFonDialOptionH"          => _("Allows calling to hangup by pressing *"),
-
-            "goFonMusiconHold"          => _("Music on hold"),
-            "goFonWelcomeMusic"         => _("Welcome music"),
-            "goFonQueueReportHold"      => _("Report hold time"),
-            "goFonQueueYouAreNext"      => _("'You are next' sound"),
-            "goFonQueueThereAre"        => _("'There are' sound"),
-            "goFonQueueCallsWaiting"    => _("'Call waiting' sound"),
-            "goFonQueueThankYou"        => _("'Thank you' sound"),
-            "goFonQueueMinutes"         => _("'Minutes' sound"),
-            "goFonQueueSeconds"         => _("'Seconds' sound"),
-            "goFonQueueLessThan"        => _("'Less than' sound"),
-            "telephoneNumber"           => _("Queue phone number"),
-            "goFonQueueLanguage"        => _("Language"),
-            "goFonQueueStrategy"        => _("Method"),
-            "goFonQueueAnnounceHoldtime"=> _("Announce holdtime"),
-            "goFonQueueAnnounce"        => _("Announce"),
-            "goFonQueueRetry"           => _("Retry"))
-              ));
-  }
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/ogroups/class_termgroup.inc b/plugins/admin/ogroups/class_termgroup.inc
deleted file mode 100644 (file)
index 53c59ec..0000000
+++ /dev/null
@@ -1,432 +0,0 @@
-<?php
-
-class termgroup extends plugin
-{
-  /* attribute list for save action */
-  var $members= array();
-
-  var $gotoMode           = "locked";
-  var $gotoSyslogServer   = "";
-  var $gotoNtpServer      = array();
-  var $gotoNtpServers     = array();
-  var $modes              = array();
-  var $inheritTimeServer  = true;
-  var $is_account                    = true; 
-  var $orig_dn            = "";
-  var $didAction          = FALSE;
-  var $mapActions   = array("reboot"          => "localboot",
-                            "instant_update"  => "softupdate",
-                            "update"          => "sceduledupdate",
-                            "reinstall"       => "install",
-                            "rescan"          => "",
-                            "memcheck"        => "memcheck",
-                            "sysinfo"         => "sysinfo");
-
-  var $attributes     = array("gotoMode","gotoSyslogServer", "gotoNtpServer");
-  var $objectclasses  = array("gotoWorkstationTemplate");
-  var $CopyPasteVars  = array("gotoNtpServers","modes","inheritTimeServer","members");
-  var $view_logged    = FALSE;
-
-
-  function termgroup (&$config, $dn= NULL, $parent= NULL)
-  {
-    /***************
-      Some  initialisations
-     ***************/
-
-    plugin::plugin($config, $dn, $parent);
-
-    $ldap= $config->get_ldap_link();
-
-    $this->is_account = true;
-    $this->modes["active"]= _("Activated");
-    $this->modes["locked"]= _("Locked");
-//    $this->modes["memcheck"]= _("Memory test");
-//    $this->modes["sysinfo"]= _("System analysis");
-
-    $this->orig_dn =   $this->dn;
-
-    /*************** 
-      Get mac addresses from member objects  
-     ***************/
-
-    /* We're only interested in the terminal members here, evaluate
-       these... */
-    if(isset($this->attrs['member'])){
-      for ($i= 0; $i<$this->attrs['member']['count']; $i++){
-        $member= $this->attrs['member'][$i];
-        $ldap->cat($member, array('objectClass', 'macAddress', 'cn'));
-        if (preg_match("/success/i", $ldap->error)){
-          $attrs = $ldap->fetch();
-          if (in_array("gotoTerminal", $attrs['objectClass']) ||
-              in_array("gotoWorkstation", $attrs['objectClass'])){
-            if (isset($attrs['macAddress'])){
-              $this->members[$attrs['cn'][0]]= $attrs['macAddress'][0];
-            } else {
-              $this->members[$attrs['cn'][0]]= "";
-            }
-          }
-        }
-      }
-    }
-
-    /*************** 
-      Perpare NTP settings 
-     ***************/
-
-    /* Create used ntp server array */
-    $this->gotoNtpServer= array();
-    if(isset($this->attrs['gotoNtpServer'])){
-      $this->inheritTimeServer = false;
-      unset($this->attrs['gotoNtpServer']['count']);
-      foreach($this->attrs['gotoNtpServer'] as $server){
-        $this->gotoNtpServer[$server] = $server;
-      }
-    }
-
-    /* Set inherit checkbox state */
-    if(in_array("default",$this->gotoNtpServer)){
-      $this->inheritTimeServer = true;
-      $this->gotoNtpServer=array();
-    }
-
-    /* Create available ntp options */
-    $this->gotoNtpServers = $this->config->data['SERVERS']['NTP'];
-    foreach($this->gotoNtpServers as $key => $server){
-      if($server == "default"){
-        unset($this->gotoNtpServers[$key]);
-      }
-    }
-  }
-
-  function check()
-  {
-     /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    if (!$this->acl_is_createable() && $this->dn == "new"){
-      $message[]= _("You have no permissions to create a workstation on this 'Base'.");
-    }
-
-    /* Check for valid ntpServer selection */
-    if((!$this->inheritTimeServer) && (!count($this->gotoNtpServer))){
-      $message[]= _("There must be at least one NTP server selected.");
-    }
-    return($message);
-  }
-
-  function remove_from_parent()
-  {
-    /* Workstation startup is using gotoWorkstationTemplate too,
-        if we remove this oc all other not manged attributes will cause errors */
-    if(isset($this->attrs['gotoKernelParameters'])){
-      $this->objectclasses = array();
-    }
-
-    /* Remove acc */
-    plugin::remove_from_parent();
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->orig_dn);
-    $ldap->modify($this->attrs);
-    $this->handle_post_events("remove");
-    new log("remove","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-  }
-
-
-  function update_term_member_FAIstate($act)
-  {
-    /* Get required informations */
-    $og     = $this->parent->by_object['ogroup'];
-    $allobs = $og->objcache;
-
-    /* Get correct value for FAIstate */
-    $action = $this->mapActions[$act];
-
-    /* Get ldap connection */
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd ($this->config->current['BASE']);
-
-    /* Foreach member of mthis ogroup  ... */
-    foreach($og->member  as $key ){
-  
-      /* check objectClasses and create attributes array */
-      $attrs = array("FAIstate"=>$action);  
-      for($i = 0; $i < $allobs[$key]['objectClass']['count'] ; $i ++){
-        $attrs['objectClass'][] = $allobs[$key]['objectClass'][$i];
-      }
-      if(($attrs['FAIstate'] != "") && (!in_array("FAIobject",$attrs['objectClass']))){
-        $attrs['objectClass'][] = "FAIobject";
-      }
-      if($attrs['FAIstate'] == ""){
-        $attrs['FAIstate'] = array();
-      }
-
-      /* If this objects is workstation,terminal or server upodate FAIstate */ 
-      if(preg_match("/(w|t|s)/i",$allobs[$key]['type'])){
-        $ldap->cd ($key);
-        $ldap->modify($attrs);
-        show_ldap_error($ldap->get_error(),sprintf(_("Setting action state (FAIstate) failed for object '%s', value was '%s'."),$key,$action));
-      }
-    }
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    if(!$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","ogroups/".get_class($this),$this->dn);
-    }
-
-    /*************** 
-      Handle requested action
-     ***************/
-
-    /* Watch for events */
-    if (isset($_POST['action'])){
-      $macaddresses="";
-      $names="";
-      foreach ($this->members as $cn => $macAddress){
-        $macaddresses.= "$macAddress ";
-        $names.= "$cn ";
-      }
-
-      if (isset($_POST['action'])){
-  
-        /* Update members fai state */
-        $this->update_term_member_FAIstate(trim($_POST['saction']));
-
-        $cmd = $this->config->search("workgeneric", "ACTIONCMD",array('tabs'));
-
-        if ($cmd == ""){
-          print_red(_("No ACTIONCMD definition found in your gosa.conf"));
-        } else {
-          exec ($cmd." ".$macaddresses." ".escapeshellarg($_POST['saction']), $dummy, $retval);
-          if ($retval != 0){
-            print_red(sprintf(_("Execution of '%s' failed!"), $cmd));
-          } else {
-            $this->didAction= TRUE;
-
-            /* Get dns from member objects. Create ldap object  */
-            $member = $this->parent->by_object['ogroup']->member;
-            $ldap = $this->config->get_ldap_link();
-            $ldap->cd($this->config->current['BASE']);
-
-            /* walk trough members and add FAIstate */ 
-            foreach($member as $dn =>  $object){
-
-              /* Get object */
-              $ldap->cat($dn,array("objectClass"));
-              $res                = $ldap->fetch();
-              $attrs              = array();
-
-              /* Add FAI state */
-              $attrs['FAIstate']  = "";
-              if(isset($this->mapActions[$_POST['saction']])){
-                $attrs['FAIstate'] = $this->mapActions[$_POST ['saction']];
-              }
-
-              /* Fix objectClass index */
-              for($i = 0; $i < $res['objectClass']['count'] ; $i ++){
-                $attrs['objectClass'][] = $res['objectClass'][$i];
-              }
-
-              /* Check if we must add the objectClass */
-              if(($attrs['FAIstate'] != "") && (!in_array("FAIobject",$attrs['objectClass']))){
-                $attrs['objectClass'][] = "FAIobject";
-              }
-
-              if($attrs['FAIstate'] == ""){
-                $attrs['FAIstate'] = array();
-              }
-
-              $ldap->cd($dn);
-              $ldap->modify($attrs);
-              show_ldap_error($ldap->get_error(), sprintf(_("Saving of system workstation/generic (FAIstate) with dn '%s' failed."),$dn));
-            }
-            $this->didAction= TRUE;
-          }
-        }
-      }
-    }
-
-
-    /*************** 
-      Add remove NTP server
-     ***************/
-
-    /* Add new ntp Server to our list */
-    if((isset($_POST['addNtpServer'])) && (isset($_POST['gotoNtpServers']))){
-      $this->gotoNtpServer[$_POST['gotoNtpServers']] = $_POST['gotoNtpServers'];
-    }
-
-    /* Delete selected NtpServer for list of used servers  */
-    if((isset($_POST['delNtpServer'])) && (isset($_POST['gotoNtpServerSelected']))){
-      foreach($_POST['gotoNtpServerSelected'] as $name){
-        unset($this->gotoNtpServer[$name]);
-      }
-    }
-
-
-    /*************** 
-      Prepare smarty 
-     ***************/
-
-    /* Set government mode */
-    $smarty= get_smarty();
-
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translated) {
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-
-    foreach($this->attributes as $attr){
-      $smarty->assign($attr,      $this->$attr);
-    }
-
-    /* Variables */
-    foreach(array("gotoMode","gotoNtpServer") as $val){
-      $smarty->assign($val."_select", $this->$val);
-    }
-
-    $smarty->assign("actions", array("halt" => _("Switch off"), "reboot" => _("Reboot"),
-          "instant_update" => _("Instant update"),
-          "update" => _("Scheduled update"),
-          "reinstall" => _("Reinstall"),
-          "rescan" => _("Rescan hardware"),
-          "memcheck" => _("Memory test"),
-          "sysinfo"  => _("System analysis")));
-
-    $smarty->assign("inheritTimeServer",$this->inheritTimeServer);
-    $smarty->assign("modes", $this->modes);
-
-    $tmp = array();
-    foreach($this->gotoNtpServers as $server){
-      if(!in_array($server,$this->gotoNtpServer)){
-        $tmp[$server] = $server;
-      }
-    }
-
-    $smarty->assign("gotoNtpServers",$tmp); 
-    $smarty->assign("syslogservers", $this->config->data['SERVERS']['SYSLOG']); 
-    $smarty->assign("gotoSyslogServer_select", $this->gotoSyslogServer); 
-
-    /* Show main page */
-    return ($smarty->fetch (get_template_path('termgroup.tpl', TRUE)));
-  }
-
-  function save_object()
-  {
-    plugin::save_object();  
-    /* Set inherit mode */
-    if(isset($_POST['workgeneric_posted'])){
-      if(isset($_POST["inheritTimeServer"])){
-        $this->inheritTimeServer = true;
-      }else{
-        $this->inheritTimeServer = false;
-      }
-    }
-  }
-
-  /* Save to LDAP */
-  function save()
-  {
-    plugin::save();
-
-    /***************
-      Prepare special vars 
-     ***************/
-
-    /* Unset some special vars ... */
-    foreach (array("gotoSyslogServer") as $val){
-      if ($this->attrs[$val] == "default"){
-        $this->attrs[$val]= array();
-      }
-    }
-
-    /* Update ntp server settings */
-    if($this->inheritTimeServer){
-      $this->attrs['gotoNtpServer'] = "default";
-    }else{
-      /* Set ntpServers */
-      $this->attrs['gotoNtpServer'] = array();
-      foreach($this->gotoNtpServer as $server){
-        $this->attrs['gotoNtpServer'][] = $server;
-      }
-    }
-
-
-    /***************
-      Write to ldap 
-     ***************/
-
-    /* Write back to ldap */
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd($this->dn);
-    $this->cleanup();
-    $ldap->modify ($this->attrs);
-
-    if($this->initially_was_account){
-      new log("modify","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }else{
-      new log("create","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }
-
-    if(!$this->didAction){
-      $this->handle_post_events("modify");
-    }
-    show_ldap_error($ldap->get_error(), _("Saving workstation failed"));
-
-  }
-  
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("System"),
-          "plDescription" => _("System group"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 5,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("ogroups"),
-          "plProvidedAcls"=> array(
-            "gotoMode"          => _("Mode"),     
-            "gotoSyslogServer"  => _("Syslog server"), 
-            "FAIstate"          => _("Action flag"), 
-            "gotoNtpServer"     => _("Ntp server"))
-          ));
-  }
-
-  function PrepareForCopyPaste($source)
-  {
-    /* Create used ntp server array */
-    $this->gotoNtpServer= array();
-
-    if(isset($source['gotoNtpServer'])){
-      $this->inheritTimeServer = false;
-      unset($source['gotoNtpServer']['count']);
-      foreach($source['gotoNtpServer'] as $server){
-        $this->gotoNtpServer[$server] = $server;
-      }
-    }
-
-    /* Set inherit checkbox state */
-    if(in_array("default",$this->gotoNtpServer)){
-      $this->inheritTimeServer = true;
-      $this->gotoNtpServer=array();
-    }
-
-    /* Create available ntp options */
-    $this->gotoNtpServers = $this->config->data['SERVERS']['NTP'];
-    foreach($this->gotoNtpServers as $key => $server){
-      if($server == "default"){
-        unset($this->gotoNtpServers[$key]);
-      }
-    }
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/ogroups/generic.tpl b/plugins/admin/ogroups/generic.tpl
deleted file mode 100644 (file)
index f6f75bc..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-<table summary="" style="width:100%;">
- <tr>
-  <td style="width:50%; vertical-align:top">
-   <input type="hidden" name="ogroupedit" value="1">
-   <table summary="">
-    <tr>
-     <td><LABEL for="cn">{t}Group name{/t}</LABEL>{$must}</td>
-     <td>
-{render acl=$cnACL}
-       <input name="cn" id="cn" size=25 maxlength=60 value="{$cn}" title="{t}Name of the group{/t}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><LABEL for="description">{t}Description{/t}</LABEL></td>
-     <td>
-{render acl=$descriptionACL}
-       <input id="description" name="description" size=40 maxlength=80 value="{$description}" title="{t}Descriptive text for this group{/t}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td colspan=2>&nbsp;</td>
-    </tr>
-    <tr>
-     <td><LABEL for="base">{t}Base{/t}</LABEL>{$must}</td>
-     <td>
-{render acl=$baseACL}
-      <select size="1" id="base" name="base" title="{t}Choose subtree to place group in{/t}">
-       {html_options options=$bases selected=$base_select}
-      </select>
-{/render}
-{render acl=$baseACL disable_picture='images/folder_gray.png'}
-      <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
-{/render}
-     </td>
-    </tr>
-   </table>
-
-  </td>
-  <td style="border-left:1px solid #A0A0A0; padding-left:10px;">
-   <b><LABEL for="members">{t}Member objects{/t}</LABEL></b>&nbsp;({$combinedObjects})
-   <br>
-{render acl=$memberACL}
-   <select style="width:100%; height:450px;" id="members" name="members[]" size="15" multiple>
-    {$members}
-   </select>
-{/render}
-   <br>
-{render acl=$memberACL}
-   <input type=submit value="{t}Add{/t}" name="edit_membership">&nbsp;
-{/render}
-{render acl=$memberACL}
-   <input type=submit value="{t}Delete{/t}" name="delete_membership">
-{/render}
-  </td>
- </tr>
-</table>
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('cn');
-  -->
-</script>
diff --git a/plugins/admin/ogroups/mail.tpl b/plugins/admin/ogroups/mail.tpl
deleted file mode 100644 (file)
index a28d0ac..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-<input type="hidden" name="mailedit" value="1">
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=0 border=0>
-
- <!-- Headline container -->
- <tr>
-  <td style="width:50%; vertical-align:top;">
-   <h2><img class="center" alt="" align="middle" src="images/rightarrow.png"> {t}Mail distribution list{/t}</h2>
-   <table summary="">
-    <tr>
-     <td><LABEL for="mail">{t}Primary address{/t}</LABEL>{$must}</td>
-     <td>
-{render acl=$mailACL}
-       <input id="mail" name="mail" size=50 maxlength=65 value="{$mail}" title="{t}Primary mail address for this distribution list{/t}">
-{/render}
-     </td>
-    </tr>
-   </table>
-  </td>
- </tr>
-</table>
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('mail');
-  -->
-</script>
diff --git a/plugins/admin/ogroups/main.inc b/plugins/admin/ogroups/main.inc
deleted file mode 100644 (file)
index 7969077..0000000
+++ /dev/null
@@ -1,50 +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
- */
-
-if (!$remove_lock){
-  /* Create object object on demand */
-  if (!isset($_SESSION['ogroup']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
-    $_SESSION['ogroup']= new ogroupManagement ($config);
-  }
-  $ogroup= $_SESSION['ogroup'];
-
-  /* Execute formular */
-  $ogroup->save_object();
-  $output= $ogroup->execute ();
-
-  /* Page header*/
-  if (isset($_SESSION['objectinfo'])){
-    $display= print_header(get_template_path('images/ogroup.png'),
-                          _("Object groups"),
-                          "<img alt=\"\" align=\"middle\" src=\"".
-                          get_template_path('images/closedlock.png').
-                          "\"> ".@LDAP::fix($_SESSION['objectinfo']));
-  } else {
-    $display= print_header(get_template_path('images/ogroup.png'), _("Object groups"));
-  }
-
-  $display.= $output;
-
-  /* Store changes  in session */
-  $_SESSION['ogroup']= $ogroup;
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/ogroups/ogroup_objects.tpl b/plugins/admin/ogroups/ogroup_objects.tpl
deleted file mode 100644 (file)
index 663b602..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
-<tr>
-  <td style="vertical-align:top; width:600px;">
-   <div class="contentboxh" style="height:20px;">
-    <p class="contentboxh" style="font-size:12px">
-     <b>{t}Select objects to add{/t} {$hint}</b>
-    </p>
-   </div>
-   <div class="contentboxb">
-    <p class="contentboxb" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-     <select style="width:600px; height:450px; margin-top:4px;" name="objects[]" size="15" multiple>
-      {$objects}
-     </select>
-     <input type=hidden name="edit_helper">
-    </p>
-   </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>
-    <p class="contentboxb" style="border-top:1px solid #B0B0B0; background-color:#F8F8F8">
-    <input type=checkbox name="departments" value="1" {$departments} onClick="mainform.submit()" title="{t}Select to see departments{/t}">{t}Show departments{/t}<br>
-    <input type=checkbox name="accounts" value="1" {$accounts} onClick="mainform.submit()" title="{t}Select to see GOsa accounts{/t}">{t}Show people{/t}<br>
-    <input type=checkbox name="groups" value="1" {$groups} onClick="mainform.submit()" title="{t}Select to see GOsa groups{/t}">{t}Show groups{/t}<br>
-    <input type=checkbox name="applications" value="1" {$applications} onClick="mainform.submit()" title="{t}Select to see applications{/t}">{t}Show applications{/t}<br>
-    <input type=checkbox name="servers" value="1" {$servers} onClick="mainform.submit()" title="{t}Select to see servers{/t}">{t}Show servers{/t}<br>
-    <input type=checkbox name="workstations" value="1" {$workstations} onClick="mainform.submit()" title="{t}Select to see workstations{/t}">{t}Show workstations{/t}<br>
-    <input type=checkbox name="terminals" value="1" {$terminals} onClick="mainform.submit()" title="{t}Select to see terminals{/t}">{t}Show terminals{/t}<br>
-    <input type=checkbox name="printers" value="1" {$printers} onClick="mainform.submit()" title="{t}Select to see printers{/t}">{t}Show printers{/t}<br>
-    <input type=checkbox name="phones" value="1" {$phones} onClick="mainform.submit()" title="{t}Select to see phones{/t}">{t}Show phones{/t}<br>
- </p>
- <p class="contentboxb" style="border-top:1px solid #B0B0B0; background-color:#F8F8F8">
-    <input type=checkbox name="subtrees" value="1" {$subtrees} onClick="mainform.submit()" title="{t}Select to search within subtrees{/t}">{t}Search in subtrees{/t}<br>
- </p>
-
-    <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8"><tr><td width="50%"><img alt="" src="{$tree_image}" align=middle title="{t}Display objects of department{/t}">&nbsp;
-    <select name="dselect" size=1 onChange="mainform.submit()" title="{t}Choose the department the search will be based on{/t}">
-      {html_options options=$deplist selected=$dselect}
-    </select></td></tr></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' name='regex' maxlength='20' style="width:99%" 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="add_object_finish" value="{t}Add{/t}">
-  &nbsp;
-  <input type=submit name="add_object_cancel" value="{t}Cancel{/t}">
-</p>
-
diff --git a/plugins/admin/ogroups/paste_generic.tpl b/plugins/admin/ogroups/paste_generic.tpl
deleted file mode 100644 (file)
index 91f84d8..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-<table width='100%'>
-       <tr>
-               <td width='120'>
-                       <LABEL for="cn">{t}Group name{/t}</LABEL>{$must}
-               </td>
-               <td>
-                       <input type='text' id='cn' name='cn' value='{$cn}' size='40' title='{t}Please enter the new object group name{/t}'> 
-               </td>
-       </tr>
-</table>
-
-<script language="JavaScript" type="text/javascript">
-       focus_field('cn');
-</script>
diff --git a/plugins/admin/ogroups/paste_mail.tpl b/plugins/admin/ogroups/paste_mail.tpl
deleted file mode 100644 (file)
index 737d707..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-<table width='100%'>
-        <tr>
-                <td width='120'>
-                       <LABEL for="mail">{t}Mail{/t}</LABEL>{$must}
-               </td>
-               <td>
-                       <input type='text' id='main' name='mail' value='{$mail}' size='40' title='{t}Please enter a mail address{/t}'> 
-               </td>
-       </tr>
-</table>
-
-<script language="JavaScript" type="text/javascript">
-       focus_field('mail');
-</script>
diff --git a/plugins/admin/ogroups/phonequeue.tpl b/plugins/admin/ogroups/phonequeue.tpl
deleted file mode 100644 (file)
index 643b4a3..0000000
+++ /dev/null
@@ -1,328 +0,0 @@
-<p style='padding-left:7px;'>
- <img class='center' src='images/lamp.png' alt='!'>&nbsp;<b>{t}Only users with the same asterisk home server will be included to this queue.{/t}</b>
-</p>
-
-<table summary="{t}Queue Settings{/t}" style="width: 100%; vertical-align: top; text-align: left;" border="0" cellpadding="4">
-<tr>
-<td valign='top'>
-               <h2><img class="center" alt="" src="images/select_phone.png" align="middle">&nbsp;{t}Phone numbers{/t}</h2>
-               <table summary="">
-               <tr>
-               <td colspan=2>
-                 <table summary="{t}Generic queue Settings{/t}">
-                  <tr>
-                   <td>
-{render acl=$telephoneNumberACL}
-                       <select style="width:300px; height:60px;" name="goFonQueueNumber_List" size=6>
-                       {html_options options=$telephoneNumber}
-                       <option disabled>&nbsp;</option>
-                       </select>
-{/render}
-               </td>
-               <td style="vertical-align:center">
-{render acl=$telephoneNumberACL}
-                       <input type="submit" value="{t}Up{/t}"          name="up_phonenumber"><br>
-{/render}
-{render acl=$telephoneNumberACL}
-                       <input type="submit" value="{t}Down{/t}"        name="down_phonenumber">
-{/render}
-               </td>
-               </tr>
-               <tr>
-                <td colspan=2>
-{render acl=$telephoneNumberACL}
-                       <input name="phonenumber" size=20 align=middle maxlength=60 value="">
-{/render}
-{render acl=$telephoneNumberACL}
-                       <input type="submit" value="{t}Add{/t}"         name="add_phonenumber" >&nbsp;
-{/render}
-{render acl=$telephoneNumberACL}
-                       <input type="submit" value="{t}Delete{/t}"      name="delete_phonenumber" >
-{/render}
-            </td>
-               </tr>
-               </table>
-               </tr>
-               <tr>
-                 <td colspan=2><h2><img class="center" alt="" src="images/select_ogroup.png" align="middle">&nbsp;{t}Options{/t}</h2></td>
-               </tr>
-                <tr>
-                <td><LABEL for="goFonHomeServer">{t}Home server{/t}</LABEL>{$must}</td>
-                <td>
-{render acl=$goFonHomeServerACL}
-                        <select name='goFonHomeServer'>
-                         {html_options options=$goFonHomeServers selected=$goFonHomeServer}
-                        </select>
-{/render}
-                </td>
-                </tr>
-
-               <tr>
-               <td>
-                       {t}Language{/t} 
-               </td>
-               <td>
-{render acl=$goFonQueueLanguageACL}
-                       <select name="goFonQueueLanguage">
-                       {html_options options=$goFonQueueLanguageOptions selected=$goFonQueueLanguage}
-                       <option disabled>&nbsp;</option>
-                       </select>
-{/render}
-               </td>
-               </tr>
-               <tr>
-               <td>
-                       {t}Timeout{/t}
-               </td>
-               <td>
-{render acl=$goFonTimeOutACL}
-                       <input name='goFonTimeOut' value='{$goFonTimeOut}'>
-{/render}
-               </td>
-               </tr>
-               <tr>
-               <td>
-                       {t}Retry{/t}
-               </td>
-               <td>
-{render acl=$goFonQueueRetryACL}
-                       <input name='goFonQueueRetry' value='{$goFonQueueRetry}'>
-{/render}
-               </td>
-               </tr>
-               <tr>
-               <td>
-                       {t}Strategy{/t} 
-               </td>
-               <td>
-{render acl=$goFonQueueStrategyACL}
-                       <select name="goFonQueueStrategy">
-            {html_options options=$goFonQueueStrategyOptions selected=$goFonQueueStrategy}
-            <option disabled>&nbsp;</option>
-            </select>
-{/render}
-       
-               </td>
-               </tr>
-               <tr>
-               <td>
-                       {t}Max queue length{/t}
-               </td>
-               <td>
-{render acl=$goFonMaxLenACL}
-                       <input name='goFonMaxLen' value='{$goFonMaxLen}'>       
-{/render}
-               </td>
-               </tr>
-               <tr>
-               <td>
-                       {t}Announce frequency{/t}
-               </td>
-               <td>
-{render acl=$goFonAnnounceFrequencyACL}
-                       <input name='goFonAnnounceFrequency' value='{$goFonAnnounceFrequency}'>
-{/render}
-                       {t}(in seconds){/t}     
-               </td>
-               </tr>
-               </table>
-</td>
-<td valign='top' style="border-left: 1px solid rgb(160, 160, 160);">
-       <h2>
-    <img class="center" alt="" src="images/sound.png" align="middle">
-    {t}Queue sound setup{/t}
-    </h2>
-       <table summary="{t}Generic queue Settings{/t}">
-               <!--<tr>
-               <td>
-                       {t}Use music on hold instead of ringing{/t}
-               </td>
-               <td>
-{render acl=goFonMusiconHoldACL}
-                       <input type="checkbox" name='goFonMusiconHold' value='1' {$goFonMusiconHoldCHK}>
-{/render}
-               </td>
-               </tr>
-               -->
-               <tr>
-               <td>
-                       {t}Music on hold{/t}
-               </td>
-               <td>
-{render acl=$goFonMusiconHoldACL}
-                       <input type="text" style='width:250px;' name='goFonMusiconHold' value='{$goFonMusiconHold}'>
-{/render}
-               </td>
-               </tr>
-               <tr>
-               <td>
-                       {t}Welcome sound file{/t}
-               </td>
-               <td>
-{render acl=$goFonWelcomeMusicACL}
-                       <input type="text" style='width:250px;' name='goFonWelcomeMusic' value='{$goFonWelcomeMusic}'>
-{/render}
-               </td>
-               </tr>
-               <tr>
-               <td>
-                       {t}Announce message{/t}
-               </td>
-               <td>
-{render acl=$goFonQueueAnnounceACL}
-                       <input type="text" style='width:250px;' name='goFonQueueAnnounce' value='{$goFonQueueAnnounce}'>
-{/render}
-               </td>
-               </tr>
-               <tr>
-               <td>
-                       {t}Sound file for 'You are next ...'{/t}
-               </td>
-               <td>
-{render acl=$goFonQueueYouAreNextACL}
-                       <input type="text" style='width:250px;' name='goFonQueueYouAreNext' value='{$goFonQueueYouAreNext}'>
-{/render}
-               </td>
-               </tr>
-               <tr>
-               <td>
-                       {t}'There are ...'{/t}
-               </td>
-               <td>
-{render acl=$goFonQueueThereAreACL}
-                       <input type="text" style='width:250px;' name='goFonQueueThereAre' value='{$goFonQueueThereAre}'>
-{/render}
-               </td>
-               </tr>
-               <tr>
-               <td>
-                       {t}'... calls waiting'{/t}
-               </td>
-               <td>
-{render acl=$goFonQueueCallsWaitingACL}
-                       <input type="text" style='width:250px;' name='goFonQueueCallsWaiting' value='{$goFonQueueCallsWaiting}'>
-{/render}
-               </td>
-               </tr>
-               <tr>
-               <td>
-                       {t}'Thank you' message{/t}
-               </td>
-               <td>
-{render acl=$goFonQueueThankYouACL}
-                       <input type="text" style='width:250px;' name='goFonQueueThankYou' value='{$goFonQueueThankYou}'>
-{/render}
-               </td>
-               </tr>
-               <tr>
-               <td>
-                       {t}'minutes' sound file{/t}
-               </td>
-               <td>
-{render acl=$goFonQueueMinutesACL}
-                       <input type="text" style='width:250px;' name='goFonQueueMinutes' value='{$goFonQueueMinutes}'>
-{/render}
-               </td>
-               </tr>
-               <tr>
-               <td>
-                       {t}'seconds' sound file{/t}
-               </td>
-               <td>
-{render acl=$goFonQueueSecondsACL}
-                       <input type="text" style='width:250px;' name='goFonQueueSeconds' value='{$goFonQueueSeconds}'>
-{/render}
-               </td>
-               </tr>
-               <tr>
-               <td>
-                       {t}Hold sound file{/t}
-               </td>
-               <td>
-{render acl=$goFonQueueReportHoldACL}
-                       <input type="text" style='width:250px;' name='goFonQueueReportHold' value='{$goFonQueueReportHold}'>
-{/render}
-               </td>
-               </tr>
-               <tr>
-               <td>
-                       {t}Less Than sound file{/t}
-               </td>
-               <td>
-{render acl=$goFonQueueLessThanACL}
-                       <input type="text" style='width:250px;' name='goFonQueueLessThan' value='{$goFonQueueLessThan}'>
-{/render}
-               </td>
-               </tr>
-
-               </table>
-</td>
-</tr>
-<tr>
-       <td colspan=2>
-               <p class="seperator">
-       </td>
-</tr>
-<tr>
-<td colspan=2><h2 style='margin-bottom:0px;'><img class="center" alt="" src="images/select_ogroup.png" align="middle">&nbsp;{t}Phone attributes {/t}</h2></td>
-</tr>
-<tr>
-<td>
-               <table summary="" style="width: 100%; vertical-align: top; text-align: left;" border="0" cellpadding="0">
-        <tr>
-        <td colspan=2>
-{render acl=$goFonQueueAnnounceHoldtimeACL}
-            <input type="checkbox" name='goFonQueueAnnounceHoldtime' value='yes'  {$goFonQueueAnnounceHoldtimeCHK}>
-{/render}
-            {t}Announce holdtime{/t}
-        </td>
-        </tr>
-        <tr>
-        <td colspan=2>
-{render acl=$goFonDialOptiontACL}
-            <input type="checkbox" name='goFonDialOptiont' value='t'  {$goFonDialOptiontCHK}>
-{/render}
-            {t}Allow the called user to transfer his call{/t}
-        </td>
-        </tr>
-        <tr>
-        <td colspan=2>
-{render acl=$goFonDialOptionTACL}
-            <input type="checkbox" name='goFonDialOptionT' value='T' {$goFonDialOptionTCHK}>
-{/render}
-            {t}Allows calling user to transfer call{/t}
-        </td>
-        </table>
-
-</td>
-<td valign='top' style="border-left: 1px solid rgb(160, 160, 160);">
-               <table summary=""  style="width: 100%; vertical-align: top; text-align: left;" border="0" cellpadding="0">
-        <tr>
-        <td colspan=2>
-{render acl=$goFonDialOptionhACL}
-            <input type="checkbox" name='goFonDialOptionh' value='h' {$goFonDialOptionhCHK}>
-{/render}
-            {t}Allow the called to hangup by pressing *{/t}
-        </td>
-        </tr>
-        <tr>
-        <td colspan=2>
-{render acl=$goFonDialOptionHACL}
-            <input type="checkbox" name='goFonDialOptionH' value='H' {$goFonDialOptionHCHK}>
-{/render}
-            {t}Allows calling to hangup by pressing *{/t}
-        </td>
-        </tr>
-        <tr>
-        <td colspan=2>
-{render acl=$goFonDialOptionrACL}
-            <input type="checkbox" name='goFonDialOptionr' value='r' {$goFonDialOptionrCHK}>
-{/render}
-            {t}Ring instead of playing background music{/t}
-        </td>
-        </tr>
-        </table>
-</td>
-</tr>
-
-</table>
diff --git a/plugins/admin/ogroups/remove.tpl b/plugins/admin/ogroups/remove.tpl
deleted file mode 100644 (file)
index 720156b..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-<div style="font-size:18px;">
-  <img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
-</div>
-
-<p>
-  {$info}
-  {t}Please double check if you really want to do this since there is no way for GOsa to get your data back.{/t}
-</p>
-<p>
-  {t}So - if you're sure - press 'Delete' to continue or 'Cancel' to abort.{/t}
-</p>
-
-<p class="plugbottom">
-       {if $multiple}
-               <input type=submit name="delete_multiple_ogroup_confirm" value="{t}Delete{/t}">
-               &nbsp;
-               <input type=submit name="delete_multiple_ogroup_cancel" value="{t}Cancel{/t}">
-       {else}
-               <input type=submit name="delete_group_confirm" value="{t}Delete{/t}">
-               &nbsp;
-               <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
-       {/if}
-</p>
-
diff --git a/plugins/admin/ogroups/tabs_ogroups.inc b/plugins/admin/ogroups/tabs_ogroups.inc
deleted file mode 100644 (file)
index 3485bb7..0000000
+++ /dev/null
@@ -1,309 +0,0 @@
-<?php
-
-class ogrouptabs extends tabs
-{
-  var $base= "";
-  var $acl_category; 
-  function reload($dd){
-    $objects= preg_replace('/[\[\]]/', '', $dd);
-    
-    /* If there is a phonequeue,
-     * but there is no user left with goPhoneAccount ... remove it.
-     */
-    $usePhoneTab = false;
-    foreach($this->by_object['ogroup']->memberList as $dn => $val){
-
-      if(isset($this->by_object['ogroup']->objcache[$dn])){
-        $obj = $this->by_object['ogroup']->objcache[$dn];
-        if(isset($obj['objectClass'])){
-          if(in_array("goFonAccount",$obj['objectClass'])){
-            $usePhoneTab = true;
-          }
-        }
-      }
-    }
-    if(((!$usePhoneTab)&&(isset($this->by_object['phonequeue'])))||((!preg_match("/U/",$objects))&&(isset($this->by_object['phonequeue'])))){
-      $this->by_object['phonequeue']->remove_from_parent();
-      unset($this->by_object['phonequeue']);
-      unset($this->by_name['phonequeue']);
-    }
-    /* Remove mail group if there is no user anymore */
-    if((!preg_match("/U/",$objects))&&(isset($this->by_object['mailogroup']))){
-      $this->by_object['mailogroup']->remove_from_parent();
-      unset($this->by_object['mailogroup']);
-      unset($this->by_name['mailogroup']);
-    }
-    
-    /* Remove terminal group, if theres no terminal left in the object list */
-    if(((!preg_match("/T/",$objects)) && (!preg_match("/W/",$objects)))&&(isset($this->by_object['termgroup']))){
-      $this->by_object['termgroup']->remove_from_parent();
-      unset($this->by_object['termgroup']);
-      unset($this->by_name['termgroup']);
-    }
-    
-    /* Remove ws tabs, if theres no ws left in the object list */
-    if((!preg_match("/W/",$objects))&&(isset($this->by_object['workservice']))){
-      $this->by_object['workservice']->remove_from_parent();
-      unset($this->by_object['workservice']);
-      unset($this->by_name['workservice']);
-    }
-    if((!preg_match("/S/",$objects) && !preg_match("/W/",$objects))&&(isset($this->by_object['workstartup']))){
-      $this->by_object['workstartup']->remove_from_parent();
-      unset($this->by_object['workstartup']);
-      unset($this->by_name['workstartup']);
-      $this->by_object['faiSummary']->remove_from_parent();
-      unset($this->by_object['faiSummary']);
-      unset($this->by_name['faiSummary']);
-    }
-  
-    /* Create goPhoneAccount if theres an user with goPhoneAccount
-     * but only if there is currently no queue enabled.
-     */
-    if(!isset($this->by_object['phonequeue'])){
-      foreach($this->by_object['ogroup']->memberList as $dn => $val){
-
-        if(isset($this->by_object['ogroup']->objcache[$dn])){
-          $obj = $this->by_object['ogroup']->objcache[$dn];
-
-          if(isset($obj['objectClass'])){
-            if(in_array("goFonAccount",$obj['objectClass'])){
-              $this->by_name['phonequeue']= _("Phone queue");
-              $this->by_object['phonequeue']= new phonequeue($this->config, $this->dn);
-              $this->by_object['phonequeue']->parent= &$this;
-              break;
-            }
-          }
-        }
-      }
-    }
-
-    /* Add mail group tab , if there is curerntly no mail tab defined */ 
-    if((preg_match("/U/",$objects))&&(!isset($this->by_object['mailogroup']))){
-      if(isset($this->config->current['MAILMETHOD'])){
-        if (preg_match('/kolab/i', $this->config->current['MAILMETHOD'])){
-          $this->by_name['mailogroup']= _("Mail");
-          $this->by_object['mailogroup']= new mailogroup($this->config, $this->dn);
-          $this->by_object['mailogroup']->parent= &$this;
-        }
-      }
-    }
-
-    /* Add Terminal tab */
-    if(((preg_match("/T/",$objects)) || (preg_match("/W/",$objects)))&&(!isset($this->by_object['termgroup']))){
-      if(!isset($this->by_object['termgroup'])){
-        $this->by_name['termgroup']= _("System");
-        $this->by_object['termgroup']= new termgroup($this->config, $this->dn);
-        $this->by_object['termgroup']->inheritTimeServer = false;
-        $this->by_object['termgroup']->parent= &$this;
-      }
-    }
-    
-    /* Add Workstation tabs */
-    if((preg_match("/W/",$objects))&&(!isset($this->by_object['workservice']))){
-        $this->by_name['workservice']= _("Devices");
-        $this->by_object['workservice']= new workservice($this->config, $this->dn);
-        $this->by_object['workservice']->inheritTimeServer = false;
-        $this->by_object['workservice']->parent= &$this;
-        $this->by_object['workservice']->acl = "#all#";
-    }
-    if((preg_match("/S/",$objects) || preg_match("/W/",$objects))&&(!isset($this->by_object['workstartup']))){
-        $this->by_name['workstartup']= _("Startup");
-        $this->by_object['workstartup']= new workstartup($this->config, $this->dn);
-        $this->by_object['workstartup']->parent= &$this;
-        $this->by_object['workstartup']->acl = "#all#";
-        $this->by_name['faiSummary']= _("Summary");
-        $this->by_object['faiSummary']= new faiSummaryTab($this->config, $this->dn);
-        $this->by_object['faiSummary']->parent= &$this;
-    }
-
-    /* Add application tab if user or group is member in this object group*/
-    if((preg_match("/G/",$objects) || preg_match("/U/",$objects)) && !isset($this->by_name['appgroup'])){
-      $this->by_name['appgroup']= _("Application");
-      $this->by_object['appgroup']= new appgroup($this->config, $this->dn);
-      $this->by_object['appgroup']->acl = "#all#";
-      $this->by_object['appgroup']->parent= &$this;
-    }
-
-    /* Remove application tab if not required any longer */
-    if(!preg_match("/G/",$objects) && !preg_match("/U/",$objects) && isset($this->by_name['appgroup'])){
-      $this->by_object['appgroup']->remove_from_parent();
-      unset($this->by_name['appgroup']);
-      unset($this->by_object['appgroup']);
-    }
-
-    /* Add environment tab if user or group is member in this object group*/
-    if((preg_match("/G/",$objects) || preg_match("/U/",$objects)) && !isset($this->by_name['environment'])){
-      $this->by_name['environment']= _("Environment");
-      $this->by_object['environment']= new environment($this->config, $this->dn);
-      $this->by_object['environment']->acl = "#all#";
-      $this->by_object['environment']->parent= &$this;
-    }
-
-    /* Remove environment tab if not required any longer */
-    if(!preg_match("/G/",$objects) && !preg_match("/U/",$objects) && isset($this->by_name['environment'])){
-      $this->by_object['environment']->remove_from_parent();
-      unset($this->by_name['environment']);
-      unset($this->by_object['environment']);
-    }
-    /* Move reference tab to second position from right */
-    if(isset($this->by_name['acl'])){
-      $tmp = $this->by_name['acl'];
-      unset($this->by_name['acl']);
-      $this->by_name['acl'] = $tmp;
-    }
-  
-    /* Move reference tab to last position*/
-    if(isset($this->by_name['reference'])){
-      $tmp = $this->by_name['reference'];
-      unset($this->by_name['reference']);
-      $this->by_name['reference'] = $tmp;
-    }
-
-    /* Reset acls */
-    $this->set_acl_base($this->base);
-    foreach($this->by_object as $name => $obj){
-      $this->by_object[$name]->set_acl_category($this->acl_category);
-    }
-  }
-
-  function execute(){
-    $str = "";
-    $this->by_object['ogroup']->AddDelMembership();
-    $this->reload($this->by_object['ogroup']->gosaGroupObjects);
-    $str .= tabs::execute();
-    return ( $str);
-  }  
-
-  function ogrouptabs($config, $data, $dn,$category ="ogroups")
-  {
-
-    tabs::tabs($config, $data, $dn, $category);
-    $this->base= $this->by_object['ogroup']->base;
-    $this->acl_category = $category;
-
-    /* Insert extra tabs for several object types - if present */
-
-    $objects= preg_replace('/[\[\]]/', '', $this->by_object['ogroup']->gosaGroupObjects);
-   
-    for ($n= 0; $n<strlen($objects); $n++){
-      switch ($objects[$n]){
-        case "T":
-          /* Add a terminal tab */
-          $this->by_name['termgroup']= _("Terminals");
-          $this->by_object['termgroup']= new termgroup($this->config, $this->dn);
-          $this->by_object['termgroup']->parent= &$this;
-
-          break;
-
-          case "U":
-            /* Append a PhoneQueue, if objectClass = goFonAccount */
-            $use = false;
-          foreach($this->by_object['ogroup']->memberList as $dn => $val){
-
-            $obj = $this->by_object['ogroup']->objcache[$dn];
-            
-            if(isset($obj['objectClass'])){
-              if(in_array("goFonAccount",$obj['objectClass'])){
-                $use = true; 
-              }
-            }
-          }
-
-          /* We found goFonAccount in users objectClasses*/
-          if($use){
-            $this->by_name['phonequeue']= _("Phone queue");
-            $this->by_object['phonequeue']= new phonequeue($this->config, $this->dn);
-            $this->by_object['phonequeue']->parent= &$this;
-          } 
-          /* Add a user tab used for mail distribution lists */
-          if(isset($this->config->current['MAILMETHOD'])){
-            if (preg_match('/kolab/i', $this->config->current['MAILMETHOD'])){
-              $this->by_name['mailogroup']= _("Mail");
-              $this->by_object['mailogroup']= new mailogroup($this->config, $this->dn);
-              $this->by_object['mailogroup']->parent= &$this;
-            }
-          }
-
-          break;
-      }
-    }
-
-    /* Add references/acls/snapshots */
-    $this->reload($this->by_object['ogroup']->gosaGroupObjects);
-    $this->addSpecialTabs();
-  }
-
-
-  function check($ignore_account= FALSE)
-  {
-    return (tabs::check(FALSE));
-  }
-
-
-  function save_object($save_current= FALSE)
-  {
-    tabs::save_object($save_current);
-
-    /* Update reference, transfer variables */
-    $baseobject= $this->by_object['ogroup'];
-    foreach ($this->by_object as $name => $obj){
-
-      /* Don't touch base object */
-      if ($name != 'ogroup'){
-        $obj->parent    = &$this;
-        $obj->uid       = $baseobject->uid;
-        $obj->cn        = $baseobject->cn;
-        $obj->sn        = $baseobject->uid;
-        $obj->givenName = $baseobject->uid;
-        $this->by_object[$name]= $obj;
-      }
-
-      /* Update parent in base object */
-      $this->by_object['ogroup']->parent= &$this;
-    }
-  }
-
-
-  function save($ignore_account= FALSE)
-  {
-    $baseobject= $this->by_object['ogroup'];
-
-    /* Check for new 'dn', in order to propagate the
-       'dn' to all plugins */
-    $new_dn= 'cn='.$baseobject->cn.','.get_groups_ou().$baseobject->base;
-
-    /* Move group? */
-    if ($this->dn != $new_dn){
-
-      /* Write entry on new 'dn' */
-      if ($this->dn != "new"){
-        $baseobject->move($this->dn, $new_dn);
-        $this->by_object['ogroup']= $baseobject;
-      }
-
-      /* Happen to use the new one */
-      $this->dn= $new_dn;
-    }
-
-    if ($this->dn == "new"){
-      $this->dn= 'cn='.$baseobject->cn.','.get_groups_ou().$baseobject->base;
-    }
-
-    tabs::save();
-
-    /* Fix tagging if needed */
-               $baseobject->dn= $new_dn;
-    $baseobject->handle_object_tagging();
-  }
-
-  function getCopyDialog()
-  {
-    $this->reload($this->by_object['ogroup']->gosaGroupObjects); 
-    return(tabs::getCopyDialog());
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/ogroups/termgroup.tpl b/plugins/admin/ogroups/termgroup.tpl
deleted file mode 100644 (file)
index b35458c..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-<br>
-<b>{t}Warning{/t}:</b> {t}Actions you choose here influence all systems in this object group. Additionally, all values editable here can be inherited by the clients assigned to this object group.{/t}
-<br>
-<br>
-<p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
-<h2><img class="center" alt="" align="middle" src="images/select_terminal.png"> {t}Generic{/t}</h2>
-
-<table width="100%">
-       <tr>
-               <td style='width:50%;'>
-               <!-- Upper left -->
-                          <table width="100%">
-                               <tr>
-                                <td colspan="2" style='padding-top:5px;'><LABEL for="gotoNtpServerSelected">{t}NTP server{/t}</LABEL><br>
-{render acl=$gotoNtpServerACL}
-                                 <select name="gotoNtpServerSelected[]" id="gotoNtpServerSelected" multiple size=5 style="width:100%;"
-                                               title="{t}Choose server to use for synchronizing time{/t}" {if $inheritTimeServer} disabled {/if}>
-                                  {html_options options=$gotoNtpServer_select}
-                                 </select>
-{/render}
-                                <br>
-{render acl=$gotoNtpServerACL}
-                                 <select name="gotoNtpServers" id="gotoNtpServers" {if $inheritTimeServer} disabled {/if} >
-                                  {html_options output=$gotoNtpServers values=$gotoNtpServers}
-                                 </select>
-{/render}
-{render acl=$gotoNtpServerACL}
-                                       <input type="submit" name="addNtpServer" value="{t}Add{/t}"     id="addNtpServer"
-                                        {if ($inheritTimeServer) || (!$gotoNtpServers)} disabled {/if}>
-{/render}
-
-{render acl=$gotoNtpServerACL}
-                                       <input type="submit" name="delNtpServer" value="{t}Delete{/t}"  id="delNtpServer"
-                                        {if ($inheritTimeServer) || (!$gotoNtpServer_select)} disabled {/if} >
-{/render}
-                                </td>
-                               </tr>
-                          </table>
-
-
-               </td>
-               <td style="vertical-align:top;border-left:1px solid #A0A0A0;">
-               <!-- Upper right -->
-                               
-                       <table summary="">
-                               <tr>
-                                <td>{t}Mode{/t}</td>
-                                <td>
-{render acl=$gotoModeACL}
-                                 <select name="gotoMode" title="{t}Select terminal mode{/t}">
-                                  {html_options options=$modes selected=$gotoMode_select}
-                                 </select>
-{/render}
-                                </td>
-                               </tr>
-                               <tr><td colspan="2">&nbsp;</td></tr>
-                               <tr>
-                                <td><LABEL for="gotoSyslogServer">{t}Syslog server{/t}</LABEL></td>
-                                <td>
-{render acl=$gotoSyslogServerACL}
-                                 <select id="gotoSyslogServer" name="gotoSyslogServer" title="{t}Choose server to use for logging{/t}">
-                                  {html_options values=$syslogservers output=$syslogservers selected=$gotoSyslogServer_select}
-                                 </select>
-{/render}
-                                </td>
-                               </tr>
-                               </table>
-               </td>
-       </tr>
-       <tr>
-               <td colspan=2>
-                       <p class="seperator">&nbsp;</p>
-               </td>
-       </tr>
-       <tr>
-               <td>
-               <!-- Bottom left -->                    
-
-               </td>
-               <td style="vertical-align:top;border-left:1px solid #A0A0A0;">
-               <!-- Bottom right -->                   
-               </td>
-       </tr>
-</table>
-<input name="workgeneric_posted" value="1" type="hidden">
-
-
-<h2><img class="center" alt="" align="middle" src="images/rocket.png"> {t}Action{/t}</h2>
-                               <table summary="">
-                                <tr>
-                                 <td>
-{render acl=$FAIstateACL}
-                                  <select size="1" name="saction" {$FAIstateACL} title="{t}Select action to execute for this terminal{/t}">
-                                       <option>&nbsp;</option>
-                                       {html_options options=$actions}
-                                  </select>
-{/render}
-                                 </td>
-                                 <td>
-{render acl=$FAIstateACL}
-                                  <input type=submit name="action" value="{t}Execute{/t}">
-{/render}
-                                 </td>
-                                </tr>
-                               </table>
-       
-
-
-
-
diff --git a/plugins/admin/systems/ArpNewDevice.tpl b/plugins/admin/systems/ArpNewDevice.tpl
deleted file mode 100644 (file)
index 8e4bf44..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-<h2><img class="center" alt="" align="middle" src="images/rightarrow.png"> {t}Integrating unknown devices{/t}</h2>
-<p>
- {t}The current device has been detected by the ARP monitor used by GOsa. You can integrate this device into your running DHCP/DNS infrastructure by submitting this form. The device entry will disapear from the list of the systems and move to the DNS/DHCP configuration.{/t}
-</p>
-<table summary="" style="width:100%">
-<tr>
- <td style>
-  <LABEL for="cn">
-   {t}DNS name{/t}{$must}
-  </LABEL>
- </td>
- <td style='width:35%;border-right:1px solid #aaa'>
-  <input name="cn" id="cn" size=18 maxlength=60 value="{$cn}">
- </td>
- <td style='width:15%'>
-  <LABEL for="description">
-   {t}Description{/t}
-  </LABEL>
- </td>
- <td style='width:35%'>
-  <input name="description" id="description" size=18 maxlength=60 value="{$description}">
- </td>
-</tr>
-</table>
-<br>
-<p class="seperator"></p>
-{$netconfig}
-
-<input type='hidden' name='ArpNewDevice_posted' value='1'>
-
-<p class="seperator"></p>
diff --git a/plugins/admin/systems/SelectDeviceType.tpl b/plugins/admin/systems/SelectDeviceType.tpl
deleted file mode 100644 (file)
index d25acbf..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-<br>
-<p class="seperator">
-{t}This is a new system which currently has no system type defined. Please choose a system type for this entry and press the 'continue' button. If this system should be added to a group of system settings, specify the preferred object group below.{/t}
-<br>
-<br>
-</p>
-<p class="seperator">
-<br>
-<b>{t}Please select a system type and an optional bundle of predefined settings to be inherited.{/t}</b>
-<br>
-<br>
-</p>
-<br>
-<table summary="" style='width:100%'>
- <tr>
-  <td style='width:49%'>
-   <table summary="">
-    <tr>
-     <td> 
-      {t}System type{/t}&nbsp;
-         <select name="SystemType" title="{t}Choose a system type{/t}" style="width:120px;">
-       {html_options values=$SystemTypeKeys output=$SystemTypes selected=$SystemType}
-      </select>
-     </td>
-    </tr>
-   </table>
-  </td>
-  <td>
-   <table summary="">
-    <tr>
-     <td> 
-      {t}Choose an object group as template{/t}&nbsp;
-         <select name="ObjectGroup" title="{t}Choose an object group{/t}" style="width:120px;">
-       {html_options values=$ObjectGroupKeys output=$ObjectGroups selected=$ObjectGroup}
-      </select>
-     </td>
-    </tr>
-   </table>
-  </td>
- </tr>
-</table>
-<p class="seperator">&nbsp;</p>
-<div style="align: right;" align="right"><p>
-       <input type="submit" name="SystemTypeChoosen" value="{t}Continue{/t}">
-       <input type="submit" name="SystemTypeAborted" value="{t}Cancel{/t}">
-</p></div>
diff --git a/plugins/admin/systems/chooser.tpl b/plugins/admin/systems/chooser.tpl
deleted file mode 100644 (file)
index 3e8bf95..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-<h1>{t}Choose the kind of system component you want to create{/t}</h1>
-
-<p>
- {t}Linux terminals and workstations are autocreated on bootup. For this reason you're only be able to create templates for a specific tree. Servers are normally automatically added too, but in some special cases you may need to create a faked server entry to provide GOsa with some informations. Other network components may be used for Nagios setups to create component dependencies.{/t}
-</p>
-
-<input type="radio" name="system" value="terminal" checked>{t}Linux thin client template{/t}<br>
-<input type="radio" name="system" value="workstation">{t}Linux workstation template{/t}<br>
-<input type="radio" name="system" value="server">{t}Linux Server{/t}<br>
-<!--<input type="radio" name="system" value="machineaccount">{t}Windows workstation{/t}<br>-->
-<input type="radio" name="system" value="printer">{t}Network printer{/t}<br>
-<input type="radio" name="system" value="phone">{t}Phone{/t}<br>
-<input type="radio" name="system" value="component">{t}Other network component{/t}<br>
-
-<p class="plugbottom">
- <input type=submit name="create_system" value="{t}Create{/t}">
- &nbsp;
- <input type=submit name="cancel" value="{t}Cancel{/t}">
-</p>
-
-<input type="hidden" name="ignore">
diff --git a/plugins/admin/systems/class_ArpNewDevice.inc b/plugins/admin/systems/class_ArpNewDevice.inc
deleted file mode 100644 (file)
index 7900990..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-<?php 
-class ArpNewDevice extends plugin
-{
-  var $cn= "";
-  var $description = "";
-  var $netConfigDNS = NULL;
-  var $attributes= array("cn","description");
-  var $objectclasses = array("gotoHard");
-  var $ignore_account = TRUE;
-
-  function ArpNewDevice ($config, $dn= NULL, $parent= NULL)
-  {
-    plugin :: plugin($config,$dn);
-    $this->cn ="";
-    $this->netConfigDNS = new termDNS($this->config,$this,$this->objectclasses);
-    $this->acl = "#all#";
-    $this->netConfigDNS->acl = $this->acl;
-    $this->netConfigDNS->force_dns();
-  }
-
-  function execute()
-  {
-    $smarty = get_smarty();
-    foreach($this->attributes as $attr){
-      $smarty->assign($attr,$this->$attr);
-    }
-    $this->netConfigDNS->cn= $this->cn;
-    $smarty->assign("netconfig", $this->netConfigDNS->execute());
-
-    /* Display sub dialog from network settings */
-    $this->netConfigDNS->acl = $this->acl;
-    if($this->netConfigDNS->dialog){
-      $this->dialog = TRUE;
-      return($this->netConfigDNS->execute());
-    }else{
-      $this->dialog = FALSE;
-    }
-
-    return($smarty->fetch (get_template_path('ArpNewDevice.tpl', TRUE)));
-  }
-
-  function check()
-  {
-    $message= plugin::check();
-    $message= array_merge($message, $this->netConfigDNS->check());
-    if(empty($this->cn)){
-      $message[] = _("Please specify a valid dns name.");
-    }
-    return($message);
-  }
-
-  function save_object()
-  {
-    if(isset($_POST['ArpNewDevice_posted'])){
-      plugin::save_object();
-      $this->netConfigDNS->save_object();
-    }
-  }
-
-  function save()
-  {
-    $this->netConfigDNS->acl = $this->acl;
-    plugin::save();
-    $this->netConfigDNS->cn = $this->cn;    
-    $this->netConfigDNS->save($this->dn);
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->rmdir_recursive($this->dn);
-    show_ldap_error($ldap->get_error(),_("Could not remove arp-alert device after writing dns and dhcp configuration."));
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_SelectDeviceType.inc b/plugins/admin/systems/class_SelectDeviceType.inc
deleted file mode 100644 (file)
index c17b8ef..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-<?php
-
-class SelectDeviceType 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("ObjectGroup","SystemType");
-  var $objectclasses= array("whatever");
-
-  var $ObjectGroups   = array();
-  var $SystemTypes       = array();
-
-  var $ObjectGroup    = "";
-  var $SystemType        = "";
-
-  function SelectDeviceType  (&$config, $dn= NULL)
-  {
-    plugin::plugin ($config, $dn);
-
-    /* Get object groups */
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd ($this->config->current['BASE']);
-    $ldap->search("(&(objectClass=gosaGroupOfNames)(cn=*))",array("cn"));
-    $this->ObjectGroups['none']=_("none");
-    while($attrs = $ldap->fetch()){
-      $this->ObjectGroups[$attrs['dn']]= $attrs['cn'][0];
-    }
-
-    $this->SystemTypes =array("workstation"=>_("Workstation"), "terminal"=>_("Terminal"), "server"=>_("Server"));
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-    $display= "";
-
-    $smarty->assign("ObjectGroups"    ,$this->ObjectGroups);
-    $smarty->assign("ObjectGroupKeys" ,array_flip($this->ObjectGroups));
-    $smarty->assign("SystemTypes"     ,$this->SystemTypes);
-    $smarty->assign("SystemTypeKeys"  ,array_flip($this->SystemTypes)); 
-
-    $smarty->assign("ObjectGroup",$this->ObjectGroup);
-    $smarty->assign("SystemType",$this->SystemType);
-
-    $display.= $smarty->fetch(get_template_path('SelectDeviceType.tpl', TRUE));
-    return($display);
-  }
-
-  /* Save data to object */
-  function save_object()
-  {
-    plugin::save_object();
-    foreach($this->attributes as $attr){
-      if(isset($_POST[$attr])){
-        $this->$attr = $_POST[$attr];
-      }
-    }
-  }
-
-  /* Check supplied data */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    return ($message);
-  }
-
-  /* Save to LDAP */
-  function save()
-  {
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_baseSelectDialog.inc b/plugins/admin/systems/class_baseSelectDialog.inc
deleted file mode 100644 (file)
index 04275e0..0000000
+++ /dev/null
@@ -1,197 +0,0 @@
-<?php
-
-class baseSelectDialog extends MultiSelectWindow
-{
-  var $selectedBase        = ""; // Used for navigation 
-  var $base_selection_regex = "*"; // Used regex ... 
-  var $BaseToUse         = false;  // used to specify the selected base, 
-                                      // false if none is selected
-
-  var $allowedBases         = array();
-  var $parent               = NULL;
-  function baseSelectDialog (&$config,$parent,$onlyAllowThisBases = array())
-  {
-    $module= "all";
-    MultiSelectWindow::MultiSelectWindow($config, "BASEselectWindow", $module);
-   
-    $this->parent = $parent;
-    $this->selectedBase = $config->current['BASE'];
-    $this->allowedBases  = $onlyAllowThisBases;
-
-    $this->SetTitle("Base");
-    $this->SetSummary(_("Choose a base"));
-    $this->SetListHeader("<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;".
-        "</div>");
-
-    $this->SetInformation(_("Step in the prefered tree and click save to use the current subtree as base. Or click the image at the end of each entry."));
-
-    $this->EnableAplhabet   (true);
-    $this->EnableCloseButton(true);
-    $this->EnableSaveButton (true);
-
-    $this->SetSaveButtonString(_("Use"));
-    $this->SetCloseButtonString(_("Cancel"));
-
-    $this->AddHeader(array("string"=>"&nbsp;","attach"=>"style='width:20px;'"));
-    $this->AddHeader(array("string"=>_("Base")));
-    $this->AddHeader(array("string"=>_("Action"),"attach"=>"style='width:50px;border-right:0px;'"));
-
-    /*                  Text        ,Value    ,Name         ,Is selected */
-//  $this->AddCheckBox("Doesnothing","servers","Doesnothing",true);
-
-    /*                  Name                 ,Text                              ,Default  , Connect with alphabet  */
-    $this->AddRegex   ("base_selection_regex",_("Filter entries with this syntax"),"*"      , true);
-  }
-
-  function execute()
-  {
-    $this->setEntries();
-    return($this->Draw());
-  }
-
-  function setEntries()
-  {
-    $this->ClearElementsList();
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->selectedBase);
-    $ldap->ls("(&(objectClass=gosaDepartment)
-                 (|(ou=".$this->base_selection_regex.")
-                   (cn=".$this->base_selection_regex.")
-                   (description=".$this->base_selection_regex.")))",
-              $this->selectedBase,array("ou","description","cn"));
-
-    $link = "<a href='?plug=".$_GET['plug']."&open_dep=%s'>%s</a>";
-
-    $base_back          = preg_replace("/^[^,]+,/","",$this->selectedBase);
-    $base_back          = convert_department_dn($base_back);
-  
-    /* Add departments, to be able to switch into them
-     */
-    while($attrs = $ldap->fetch()){
-      $key = $attrs['dn']  ;
-      $val = $attrs['ou'][0];
-    
-      if(count($this->allowedBases) != 0){
-        if(!isset($this->allowedBases[$key])){
-          continue;
-          break;
-        }
-      }
-      /* Append description */ 
-      if(isset($attrs['description'][0])){
-        $val.=" [".$attrs['description'][0]."]";
-      }
-
-      /* Add missing entries ... */
-      if(!isset($this->config->departments[trim($key)])){
-        $this->config->departments[trim($key)]="";
-      }
-
-      /* check if this department contains sub-departments
-         Display different image in this case
-       */
-      $non_empty="";
-      $keys= str_replace("/","\/",$key);
-      foreach($this->config->departments as $keyd ){
-        if(preg_match("/,".$keys."/",$keyd)){
-          $non_empty="full";
-        }
-      }
-
-      /* Add to divlist */
-      $field1 = array("string" => "<img src='images/".$non_empty."folder.png' alt='department'>", 
-                      "attach" => "style='text-align:center;width:20px;'");
-      $field2 = array("string" => sprintf($link,base64_encode($key),$val), "attach" => "style=''");
-      $field3 = array("string" => sprintf("&nbsp;<input title='"._("Select this base")."' type='image' img src='images/save.png' name='usebase_%s'>",base64_encode($key)), 
-                      "attach" => "style='width:50px;border-right:0px;text-align:right;'");
-      $this->AddElement(array($field1,$field2,$field3));
-    }
-  }
-
-  function Save()
-  {
-    MultiSelectWindow :: Save();  
-    $this->BaseToUse = $this->selectedBase;
-  }
-
-  function isSelected() 
-  {
-    return($this->BaseToUse);
-  }
-
-  function setCurrentBase($base)
-  {
-    $this->selectedBase = $base;
-  }
-
-  function save_object()
-  {
-    /* Save current base */
-    $old_base = $this->selectedBase;
-  
-    /* Save automatic created POSTs like regex, checkboxes */
-    MultiSelectWindow::save_object();   
-    
-    if(isset($_GET['open_dep'])){
-      $this->selectedBase = base64_decode($_GET['open_dep']);
-    } 
-
-    $s_action ="";
-    foreach($_POST as $key => $value){
-      if(preg_match("/^dep_back.*/i",$key)){
-        $s_action="back";
-      }elseif(preg_match("/^dep_root.*/",$key)){
-        $s_action="root";
-      }elseif(preg_match("/^dep_home.*/i",$key)){
-        $s_action="home";
-      }elseif(preg_match("/^usebase_/",$key)){
-        $tmp = preg_replace("/^usebase_/","",$key);
-        $tmp = preg_replace("/_.*$/","",$tmp);
-        $tmp = base64_decode($tmp);
-        $this->BaseToUse = $tmp;
-      }
-    }
-
-    $ui= get_userinfo();
-    /* Homebutton is posted */
-    if($s_action=="home"){
-      $this->selectedBase=(preg_replace("/^[^,]+,/","",$ui->dn));
-      $this->selectedBase=(preg_replace("/^[^,]+,/","",$this->selectedBase));
-    }
-
-    /* back to the roots ^^ */
-    if($s_action=="root"){
-      $this->selectedBase=($this->config->current['BASE']);
-    }
-
-    /* If Backbutton is Posted */
-    if($s_action=="back"){
-      $base_back          = preg_replace("/^[^,]+,/","",$this->selectedBase);
-      $base_back          = convert_department_dn($base_back);
-
-      if(isset($this->config->departments[trim($base_back)])){
-        $this->selectedBase= $this->config->departments[trim($base_back)];
-      }else{
-        $this->selectedBase= $this->config->departments["/"];
-      }
-    }
-
-    /* Restore old base, if selected base is not allowed */
-    if(count($this->allowedBases) && !isset($this->allowedBases[$this->selectedBase])){
-      $this->selectedBase = $old_base;
-    }
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_componentGeneric.inc b/plugins/admin/systems/class_componentGeneric.inc
deleted file mode 100644 (file)
index 8a65bdd..0000000
+++ /dev/null
@@ -1,331 +0,0 @@
-<?php
-
-class componentGeneric extends plugin
-{
-  /* CLI vars */
-  var $cli_summary= "Manage component base objects";
-  var $cli_description= "Some longer text\nfor help";
-  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* Generic terminal attributes */
-  var $interfaces= array();
-  var $ignore_account= TRUE;
-
-  /* Needed values and lists */
-  var $base= "";
-  var $cn= "";
-  var $description= "";
-  var $orig_dn= "";
-
-  /* attribute list for save action */
-  var $attributes= array("cn", "description");
-  var $objectclasses= array("top", "device", "ipHost", "ieee802Device");
-  var $netConfigDNS;
-  var $view_logged  = FALSE;
-
-  function componentGeneric (&$config, $dn= NULL, $parent= NULL)
-  {
-    plugin::plugin ($config, $dn, $parent);
-
-    /* Set base */
-    if ($this->dn == "new"){
-      $ui= get_userinfo();
-      $this->base= dn2base($ui->dn);
-      $this->cn= "";
-    } else {
-      $this->base= preg_replace ("/^[^,]+,[^,]+,[^,]+,/", "", $this->dn);
-    }
-    $this->netConfigDNS = new termDNS($this->config,$this,$this->objectclasses, true);
-    /* Save dn for later references */
-    $this->orig_dn= $this->dn;
-  }
-
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","component/".get_class($this),$this->dn);
-    }
-
-    /* Do we represent a valid phone? */
-    if (!$this->is_account && $this->parent === NULL){
-      $display= "<img alt=\"\" src=\"images/stop.png\" align=middle>&nbsp;<b>".
-        _("This 'dn' has no network features.")."</b>";
-      return($display);
-    }
-
-    /* Base select dialog */
-    $once = true;
-    foreach($_POST as $name => $value){
-      if(preg_match("/^chooseBase/",$name) && $once){
-        $once = false;
-        $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
-        $this->dialog->setCurrentBase($this->base);
-      }
-    }
-
-    /* Dialog handling */
-    if(is_object($this->dialog)){
-      /* Must be called before save_object */
-      $this->dialog->save_object();
-
-      if($this->dialog->isClosed()){
-        $this->dialog = false;
-      }elseif($this->dialog->isSelected()){
-
-        /* A new base was selected, check if it is a valid one */
-        $tmp = $this->get_allowed_bases();
-        if(isset($tmp[$this->dialog->isSelected()])){
-          $this->base = $this->dialog->isSelected();
-        }
-
-        $this->dialog= false;
-      }else{
-        return($this->dialog->execute());
-      }
-    }
-
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-    $smarty->assign("bases", $this->config->idepartments);
-
-    /* Set acls */
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translation){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-
-    $smarty->assign("bases", $this->get_allowed_bases());
-
-    /* Assign attributes */
-    foreach ($this->attributes as $attr){
-      $smarty->assign("$attr", $this->$attr);
-    }
-    $smarty->assign("base_select", $this->base);
-
-    /* Show main page */
-    $str = $this->netConfigDNS->execute();
-    if(is_object($this->netConfigDNS->dialog)){
-      return($str);
-    }
-    $smarty->assign("netconfig", $str);
-    return($smarty->fetch (get_template_path('component.tpl', TRUE)));
-  }
-
-  function set_acl_base($base)
-  {
-    plugin::set_acl_base($base);
-    $this->netConfigDNS->set_acl_base($base);
-  }
-
-  function set_acl_category($cat)
-  {
-    plugin::set_acl_category($cat);
-    $this->netConfigDNS->set_acl_category($cat);
-  }
-
-  function remove_from_parent()
-  {
-    $ldap= $this->config->get_ldap_link();
-    $this->netConfigDNS->remove_from_parent();
-    $ldap->rmdir($this->dn);
-    
-    new log("remove","component/".get_class($this),$this->dn,$this->attributes,$ldap->get_error());
-
-    show_ldap_error($ldap->get_error(), sprintf(_("Removing of system component/generic with dn '%s' failed."),$this->dn));
-    $this->handle_post_events(array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
-
-    /* Delete references to object groups */
-    $ldap->cd ($this->config->current['BASE']);
-    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
-    while ($ldap->fetch()){
-      $og= new ogroup($this->config, $ldap->getDN());
-      unset($og->member[$this->dn]);
-      $og->save ();
-    }
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    
-    /* Create a base backup and reset the
-       base directly after calling plugin::save_object();
-       Base will be set seperatly a few lines below */
-    $base_tmp = $this->base;
-    plugin::save_object();
-    $this->base = $base_tmp;
-
-    $this->netConfigDNS->save_object();
-
-    /* Set new base if allowed */
-    $tmp = $this->get_allowed_bases();
-    if(isset($_POST['base'])){
-      if(isset($tmp[$_POST['base']])){
-        $this->base= $_POST['base'];
-      }
-    }
-  }
-
-
-  /* Check supplied data */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-    $message= array_merge($message,$this->netConfigDNS->check());
-
-    $this->dn= "cn=".$this->cn.",ou=netdevices,ou=systems,".$this->base;
-
-    if ($this->cn == "" ){
-      $message[]= _("The required field 'Component name' is not set.");
-    }
-
-    /* Check if given name is a valid host/dns name */
-    if(!is_dns_name($this->cn)){
-      $message[] = _("Please specify a valid name for this object.");
-    }
-
-    /* To check for valid ip*/
-    if($this->netConfigDNS->ipHostNumber == ""){
-       $message[]= _("The required field IP address is empty.");
-    } else {
-      if (!is_ip($this->netConfigDNS->ipHostNumber)){
-        $message[]= _("The field IP address contains an invalid address.");
-      }
-    }
-
-    if ($this->orig_dn != $this->dn){
-      $ldap= $this->config->get_ldap_link();
-      $ldap->cd ($this->base);
-      $ldap->search ("(cn=".$this->cn.")", array("cn"));
-      if ($ldap->count() != 0){
-        while ($attrs= $ldap->fetch()){
-          if(preg_match("/cn=dhcp,/",$attrs['dn'])){
-            continue;
-          }
-          if ($attrs['dn'] != $this->orig_dn){
-            $message[]= sprintf (_("There is already an entry '%s' in the base choosen by you"), $this->cn);
-            break;
-          }
-        }
-      }
-    }
-
-    return ($message);
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    plugin::save();
-
-    /* Remove all empty values */
-    if ($this->orig_dn == 'new'){
-      $attrs= array();
-      foreach ($this->attrs as $key => $val){
-        if (is_array($val) && count($val) == 0){
-          continue;
-        }
-        $attrs[$key]= $val;
-      }
-      $this->attrs= $attrs;
-    }
-
-    /* If this is a new Object IP & Mac aren't set.
-         IP & Mac are msut attributes, so we set this values by here. */
-    if($this->orig_dn == 'new'){
-      $this->attrs['ipHostNumber'] = $this->netConfigDNS->ipHostNumber;
-      $this->attrs['macAddress']  = $this->netConfigDNS->macAddress;
-    }
-
-    /* Write back to ldap */
-    $ldap= $this->config->get_ldap_link();
-    if ($this->orig_dn == 'new'){
-      $ldap->cd($this->config->current['BASE']);
-      $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
-      $ldap->cd($this->dn);
-      $ldap->add($this->attrs);
-      new log("create","component/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-      $this->handle_post_events("add",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
-      
-    } else {
-      if ($this->orig_dn != $this->dn){
-        $this->move($this->orig_dn, $this->dn);
-      }
-
-      $ldap->cd($this->dn);
-      $this->cleanup();
-      $ldap->modify ($this->attrs); 
-      new log("modify","component/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-      $this->handle_post_events("modify",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
-    }
-
-    $this->netConfigDNS->cn = $this->cn;
-    $this->netConfigDNS->save();
-
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of system component/generic with dn '%s' failed."),$this->dn));
-  }
-
-  /* Return plugin informations for acl handling */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("Generic"),
-          "plDescription" => _("Component generic"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 1,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("component" => array("description"  => _("Network device"),
-                                                        "objectClass"  => array("device", "ipHost", "ieee802Device"))),
-          "plProvidedAcls"=> array(
-            "cn"                  => _("Name"),
-            "base"                => _("Base"),
-            "description"         => _("Description"))
-          ));
-  }
-
-  /* Display generic part for server copy & paste */
-  function getCopyDialog()
-  {
-    $vars = array("cn");
-    $smarty = get_smarty();
-    $smarty->assign("cn" ,$this->cn);
-    $smarty->assign("object","component");
-    $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE));
-    $ret = array();
-    $ret['string'] = $str;
-    $ret['status'] = "";
-    return($ret);
-  }
-
-
-  function saveCopyDialog()
-  {
-    if(isset($_POST['cn'])){
-      $this->cn = $_POST['cn'];
-    }
-  }
-
-
-  function PrepareForCopyPaste($source)
-  {
-    plugin::PrepareForCopyPaste($source);
-    if(isset($source['macAddress'][0])){
-      $this->netConfigDNS->macAddress = $source['macAddress'][0];
-    }
-    if(isset($source['ipHostNumber'][0])){
-      $this->netConfigDNS->ipHostNumber = $source['ipHostNumber'][0];
-    }
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_divListRepositories.inc b/plugins/admin/systems/class_divListRepositories.inc
deleted file mode 100644 (file)
index 6e43dc1..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-<?php
-
-class divListRepository extends MultiSelectWindow
-{
-  /* CheckBoxes, to change default values modify $this->AddCheckBox */
-  var $parent             ;
-  var $ui                 ;
-
-  var $regex ="*";
-
-  function divListRepository ($config,$parent)
-  {
-    MultiSelectWindow::MultiSelectWindow($config,"Repository", "server");
-    
-    $this->parent       = $parent;
-    $this->ui           = get_userinfo();
-
-    $this->SetTitle("repositories");
-    $this->SetSummary(_("List of configured repositories."));
-    $this->SetInformation(_("This menu allows you to create, delete and edit repository settings."));
-    $this->EnableCloseButton(FALSE);
-    $this->EnableSaveButton(FALSE);
-    $this->AddHeader(array("string"=>_("Release"),"attach"=>"style='width:80px;'"));
-    $this->AddHeader(array("string"=>_("Sections")));
-    $this->AddHeader(array("string"=>_("Options"),"attach"=>"style='border-right:0px;width:55px;'"));
-    $this->AddRegex("regex",_("Regular expression for matching object names"),"*",TRUE);
-    $this->EnableAplhabet(TRUE);
-  }
-
-  function GenHeader()
-  {
-    if($this->parent->acl_is_createable()){
-      $this->SetListHeader("<input type=\"image\" src=\"images/fai_new_packages.png\" title=\""._("Add repository")."\"                 name=\"AddRepository\">");
-    }
-  }
-
-  function execute()
-  {
-    $this->ClearElementsList();
-    $this->GenHeader();
-  }
-
-  function setEntries($list)
-  {
-    $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->parent->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;'>";
-    }
-
-    foreach($list as $name => $reps){
-
-      $str = " ";
-      if(preg_match("/".str_replace("*",".*",$this->regex)."/",$reps['Release'])){
-        foreach($reps['Sections'] as $sec){
-          $str.=$sec." ";
-        }
-        $this->AddElement(array(
-              array("string"=>sprintf($link,base64_encode($name),$name),"attach"=>"style='width:80px;'"),
-              array("string"=>sprintf($link,base64_encode($name),_("Sections")." :".$str)),
-              array("string"=>preg_replace("/%s/",base64_encode($name),$edit.$delete),"attach"=>"style='border-right:0px;width:55px;text-  align:right;'")
-              ));
-      }
-    }
-
-  }
-
-  function Save()
-  {
-    MultiSelectWindow :: Save();  
-  }
-
-  function save_object()
-  {
-    /* Save automatic created POSTs like regex, checkboxes */
-    MultiSelectWindow :: save_object();   
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_divListSystem.inc b/plugins/admin/systems/class_divListSystem.inc
deleted file mode 100644 (file)
index 61871b7..0000000
+++ /dev/null
@@ -1,468 +0,0 @@
-<?php
-
-class divListSystem extends MultiSelectWindow
-{
-
-  /* Current base */
-  var $selectedBase       = "";
-  var $departments        = array();
-
-  /* Regex */
-  var $Regex              = "*";
-  var $UserRegex          = "*";
-
-  /* CheckBoxes, to change default values modify $this->AddCheckBox */
-  var $ShowServers;
-  var $ShowTerminals;
-  var $ShowWorkstations;
-  var $ShowWinWorkstations;
-  var $ShowPrinters;
-  var $ShowDevices;
-  var $ShowPhones;
-
-  /* Subsearch checkbox */
-  var $SubSearch;
-
-  var $parent             ;
-  var $ui                 ;
-
-  function divListSystem (&$config,$parent)
-  {
-    MultiSelectWindow::MultiSelectWindow($config, "System", array("server",
-                                                                  "workstation",
-                                                                  "terminal",
-                                                                  "phone",
-                                                                  "incoming",
-                                                                  "printer"));
-
-    $this->parent       = $parent;
-    $this->ui           = get_userinfo();
-
-    /* Set list strings */
-    $this->SetTitle(_("List of systems"));
-    $this->SetSummary(_("List of systems"));
-
-    /* Result page will look like a headpage */
-    $this->SetHeadpageMode();
-    $this->SetInformation(_("This menu allows you to add, remove and change the properties of specific systems. You can only add systems which have already been started once."));
-
-    $this->EnableAplhabet   (true);
-
-    /* Disable buttonsm */
-    $this->EnableCloseButton(false);
-    $this->EnableSaveButton (false);
-
-    /* Dynamic action col, depending on snapshot icons */
-    $action_col_size = 110;
-    if($this->parent->snapshotEnabled()){
-      $action_col_size += 38;
-    }
-
-    /* Toggle all selected / deselected */
-    $chk = "<input type='checkbox' id='select_all' name='select_all'
-               onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
-
-    /* set Page header */
-    $this->AddHeader(array("string"=> $chk,          "attach"=>"style='width:20px;'"));
-    $this->AddHeader(array("string"=>"&nbsp;","attach"=>"style='width:20px;'"));
-    $this->AddHeader(array("string"=>_("System / Department")));
-    $this->AddHeader(array("string"=>_("Actions"),"attach"=>"style='width:".$action_col_size."px;border-right:0px;'"));
-
-    /*                  Text        ,Value    ,Name         ,Is selected */
-    $this->AddCheckBox("ShowServers",         _("Select to see servers"),            _("Show servers"),          true);
-    $this->AddCheckBox("ShowTerminals",       _("Select to see Linux terminals"),    _("Show terminals") ,       true);
-    $this->AddCheckBox("ShowWorkstations",    _("Select to see Linux workstations"), _("Show workstations"),     true);
-    $this->AddCheckBox("ShowWinWorkstations", _("Select to see MicroSoft Windows based workstations"), _("Show windows based workstations"),true);
-    $this->AddCheckBox("ShowPrinters",        _("Select to see network printers"),    _("Show network printers") ,true);
-    $this->AddCheckBox("ShowPhones",          _("Select to see VOIP phones"),         _("Show phones") ,          true);
-    $this->AddCheckBox("ShowDevices",         _("Select to see network devices"),     _("Show network devices"),  true);
-
-    /* Add SubSearch checkbox */
-    $this->AddCheckBox(SEPERATOR);
-    $this->AddCheckBox("SubSearch",  _("Select to search within subtrees"), _("Search in subtrees"), false);
-
-    /*                  Name                 ,Text                              ,Default  , Connect with alphabet  */
-    $this->AddRegex   ("Regex",     _("Display systems matching"),"*" , true);
-    $this->AddRegex   ("UserRegex", _("Display systems of user"), "*" , false, "images/search_user.png");
-  }
-
-  function GenHeader()
-  {
-   /* Prepare departments,
-       which are shown in the listbox on top of the listbox
-     */
-    $options= "";
-
-    /* Get all departments within this subtree */
-    $base = $this->config->current['BASE'];
-
-    /* Add base */
-    $tmp = array();
-    $tmp[] = array("dn"=>$this->config->current['BASE']);
-    $tmp=  array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
-                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
-
-    $deps = array();
-    foreach($tmp as $tm){
-      $deps[$tm['dn']] = $tm['dn'];
-    }
-
-    /* Load possible departments */
-    $ui= get_userinfo();
-    $first = "";
-    $found = FALSE;
-    $department = $departments = array();
-    foreach($this->module as $module){
-      $d = $ui->get_module_departments($module);      
-      foreach($d as $department){
-        $departments[$department] = $department;
-      }
-    }
-
-    /* Load possible departments */
-    $ui= get_userinfo();
-    $ids = $this->config->idepartments;
-    $first = "";
-    $found = FALSE;
-    foreach($ids as $dep => $name){
-      if(isset($deps[$dep]) && in_array_ics($dep, $departments)){
-
-        /* Keep first base dn in mind, we could need this
-         *  info if no valid base was found
-         */
-        if(empty($first)) {
-          $first = $dep['dn'];
-        }
-
-        $value = $ids[$dep];
-        if ($this->selectedBase == $dep){
-          $found = TRUE;
-          $options.= "<option selected='selected' value='".$dep."'>$value</option>";
-        } else {
-          $options.= "<option value='".$dep."'>$value</option>";
-        }
-      }
-    }
-
-
-    /* The currently used base is not visible with your acl setup.
-     * Set base to first useable base.
-     */
-    if(!$found){
-      $this->selectedBase = $first;
-    }
-
-    /* If there is at least one c (Create) and one w (Write) acl in this combination
-        display the snapshot paste icon. BUT check the correct acls in the management plugin */
-    $all_module_acls = "";
-    foreach($this->module as $module){
-      $all_module_acls .= $ui->has_complete_category_acls($this->selectedBase,$module);
-    }
-
-    /* Must we add an additional seperator */
-    $add_sep = false;
-   
-    /* Add default header */
-    $listhead = MultiSelectWindow::get_default_header();
-
-    /* Add base selection */
-    $listhead .= _("Base")."&nbsp; <select name='CurrentMainBase' 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;";
-
-    /* Handle create icons */ 
-    $s = ".|"._("Actions")."|\n";
-    $s.= "..|<img src='images/list_new.png' alt='' border='0' class='center'>".
-      "&nbsp;"._("Create")."|\n";
-    if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"terminal/termgeneric"))){
-      $s.= "...|<img src='images/select_terminal.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Terminal")."|"."newsystem_terminal|\n";
-    }
-    if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"workstation/workgeneric"))){
-      $s.= "...|<img src='images/select_workstation.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Workstation")."|"."newsystem_workstation|\n";
-    }
-    if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"workstation/workgeneric"))){
-      $s.= "...|<img src='images/select_server.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Server")."|"."newsystem_server|\n";
-    }
-    if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"phone/phoneGeneric"))){
-      $s.= "...|<img src='images/select_phone.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Phone")."|"."newsystem_phone|\n";
-    }
-    if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"printer/printgeneric"))){
-      $s.= "...|<img src='images/select_printer.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Printer")."|"."newsystem_printer|\n";
-    }
-    if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"component/componentGeneric"))){
-      $s.= "...|<img src='images/select_component.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Component")."|"."newsystem_component|\n";
-    }
-    $s.= "..|<img src='images/edittrash.png' alt='' border='0' class='center'>".
-      "&nbsp;"._("Remove")."|"."remove_multiple|\n";
-
-    /* Add multiple copy & cut icons */
-    if(is_object($this->parent->CopyPasteHandler)){
-      $s.= "..|---|\n";
-      $s.= "..|<img src='images/editcopy.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Copy")."|"."multiple_copy_systems|\n";
-      $s.= "..|<img src='images/editcut.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Cut")."|"."multiple_cut_systems|\n";
-    }
-
-    /* Get copy & paste icon */
-    $Copy_Paste ="";
-    if(preg_match("/(c.*w|w.*c)/",$all_module_acls) &&  $this->parent->CopyPasteHandler){
-      $s .= "..|---|\n";
-      if($this->parent->CopyPasteHandler->entries_queued()){
-        $img = "<img border='0' class='center' src='images/editpaste.png' alt=''>";
-        $s.="..|".$img."&nbsp;"._("Paste")."|editPaste|\n";
-      }else{
-        $img = "<img border='0' class='center' src='images/cant_editpaste.png' alt=''>";
-        $s.="..|".$img."&nbsp;"._("Paste")."\n";
-      }
-    }
-
-    /* Add snapshot icons */
-    if(preg_match("/(c.*w|w.*c)/",$all_module_acls)){
-      $s .= "..|---|\n";
-      $s .= $this->get_snapshot_header(TRUE);
-    }
-
-    $this->SetDropDownHeaderMenu($s);
-    $this->SetListHeader($listhead);
-  }
-
-  function execute()
-  {
-    $this->ClearElementsList();
-    $this->GenHeader();
-  }
-
-  function setEntries($terminals)
-  {
-    $img1  = "<img class='center' src='images/printer.png'            alt='C' title='"._("Cups Server")  ."'>";
-    $img2  = "<img class='center' src='images/scanner.png'            alt='L' title='"._("Log Db") ."'>";
-    $img3  = "<img class='center' src='images/select_terminal.png'    alt='L' title='"._("Syslog Server") ."'>";
-    $img4  = "<img class='center' src='images/mailto.png'             alt='M' title='"._("Mail Server")  ."'>";
-    $img5  = "<img class='center' src='images/select_phone.png'       alt='I' title='"._("Imap Server") ."'>";
-    $img6  = "<img class='center' src='images/fax_small.png'          alt='F' title='"._("Nfs Server")   ."'>";
-    $img7  = "<img class='center' src='images/select_winstation.png'  alt='K' title='"._("Kerberos Server") ."'>";
-    $img8  = "<img class='center' src='images/select_phone.png'       alt='A' title='"._("Asterisk Server") ."'>";
-    $img9  = "<img class='center' src='images/fax_small.png'          alt='F' title='"._("Fax Server") ."'>";
-    $img10 = "<img class='center' src='images/save.png'               alt='L' title='"._("Ldap Server") ."'>";
-
-    $empty    ="<img src='images/empty.png' style='width:16px ; height: 16px;' class='center' alt=''>";
-
-    /* Dynamic action col, depending on snapshot icons */
-    $action_col_size = 110;
-    if($this->parent->snapshotEnabled()){
-      $action_col_size += 38;
-    }
-
-    // User and Template  Images
-    $editlink = "<a href='?plug=".$_GET['plug']."&amp;id=%s&amp;act=edit_entry'>%s</a>";
-
-    /* ACL mapping */
-    $ui = get_userinfo();
-    $tabs = array(
-          "terminal"    => array("CLASS"=>"TERMTABS",     "TABCLASS" =>"termtabs",      "ACL"=> "terminal/termgeneric"),
-          "workstation" => array("CLASS"=>"WORKTABS",     "TABCLASS" =>"worktabs",      "ACL"=> "workstation/workgeneric"),
-          "server"      => array("CLASS"=>"SERVTABS",     "TABCLASS" =>"servtabs",      "ACL"=> "server/servgeneric"),
-          "printer"     => array("CLASS"=>"PRINTTABS",    "TABCLASS" =>"printtabs",     "ACL"=> "printer/printgeneric"),
-          "phone"       => array("CLASS"=>"PHONETABS",    "TABCLASS" =>"phonetabs",     "ACL"=> "phone/phoneGeneric"),
-          "winstation"  => array("CLASS"=>"WINTABS",      "TABCLASS" =>"wintabs",       "ACL"=> "winworkstation/wingeneric"),
-          "incoming"    => array("CLASS"=>"",             "TABCLASS" =>"",              "ACL"=> "incoming/systems"),
-          "component"   => array("CLASS"=>"COMPONENTTABS","TABCLASS" =>"componenttabs", "ACL"=> "component/componentGeneric"));
-
-
-    $cnts = array("component" => 0 , "terminal" => 0 , "workstation" => 0 , 
-                  "printer" => 0 , "phone" => 0 , "server" => 0,
-                  "NewDevice" => 0, "winstation"=> 0);
-
-    // Test Every Entry and generate divlist Array
-    foreach($terminals as $key => $val){
-
-      /* Get system type, it is used to fetch the acls for the current object.
-          "winstation" acls are stored as 2winworkstation", so we have to map this here */
-      $type     = $this->parent->get_system_type($val);
-      if($type == "winstation") {
-        $acl_type = "winworkstation";
-      }else{
-        $acl_type = $type;
-      }
-
-      /* Map NewDevice acls to workstation acls */
-      if($type == "NewDevice" || $type == "ArpNewDevice"){
-        $type     = "incoming";
-        $acl_type = "incoming";
-      }
-
-      /* Get complete category acls */
-      $acl_all  = $ui->has_complete_category_acls($val['dn'],$acl_type) ;
-  
-      /* Get specific generic acls */
-      $acl      = $ui->get_permissions($val['dn'],$tabs[$type]['ACL']);
-
-      $action ="";
-      if(($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
-        $action.= "<input class='center' type='image'
-          src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
-        $action.= "<input class='center' type='image'
-          src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
-      }
-      $action.= "<input class='center' type='image' src='images/edit.png' 
-                    alt='"._("edit")."'     name='system_edit_%KEY%' title='"._("Edit system")."'>";
-      if(preg_match("/(c.*w|w.*c)/",$acl_all)){
-        $action.= $this->GetSnapShotActions($val['dn']);
-      }else{
-        $action.= $empty."&nbsp;".$empty."&nbsp;";
-      }
-
-
-      if(preg_match("/d/",$acl)){
-        $action.= "<input class='center' type='image' src='images/edittrash.png' 
-          alt='"._("delete")."'   name='system_del_%KEY%' title='"._("Delete system")."'>";
-      }else{
-        $action.= $empty;    
-      }
-
-      /* Generate picture list, which is currently disabled */
-      if(in_array("goCupsServer"    ,$val['objectClass'])) $cups    = $img1;   else $cups  =$empty;
-      if(in_array("goLogDBServer"   ,$val['objectClass'])) $logdb   = $img2;   else $logdb =$empty;
-      if(in_array("goSyslogServer"  ,$val['objectClass'])) $syslog  = $img3;   else $syslog=$empty;
-      if(in_array("goImapServer"    ,$val['objectClass'])) $imap    = $img4;   else $imap  =$empty;
-      if(in_array("sambaSamAccount" ,$val['objectClass'])) $samba   = $img5;   else $samba =$empty;
-      if(in_array("goShareServer"   ,$val['objectClass'])) $nfs     = $img6;   else $nfs   =$empty;
-      if(in_array("goKrbServer"     ,$val['objectClass'])) $krb     = $img7;   else $krb   =$empty;
-      if(in_array("goFonServer"     ,$val['objectClass'])) $fon     = $img8;   else $fon   =$empty;
-      if(in_array("goFaxServer"     ,$val['objectClass'])) $fax     = $img9;   else $fax   =$empty;
-      if(in_array("goLdapServer"    ,$val['objectClass'])) $ldap     = $img10;   else $ldap   =$empty;
-
-      $pics = $cups.$logdb.$syslog.$imap.$samba.$nfs.$krb.$fon.$fax.$ldap;
-      $pics = ""; // Pictures currently hidden
-
-      $val['cn'][0]= preg_replace('/\$$/', '', $val['cn'][0]);
-
-      // Generate Array to Add
-      $dsc= "";
-      if (isset($val['description'][0])){
-        $dsc= " [".$val['description'][0]."]";
-      }
-      if((isset($val['is_new']))&&(!empty($val['is_new']))){
-        $display= $val["cn"][0]." ".$val['is_new'].$dsc;
-      }else{
-        $display= $val["cn"][0].$dsc;
-      }
-
-     
-      /* Check if this is a terminal/workstation && if we are allowed to change the gotoRootPasswd */
-      $pwd_acl =""; 
-      if(in_array("gotoWorkstation",$val['objectClass'])){
-        $pwd_acl = $ui->get_permissions($val['dn'],"workstation/workgeneric","gotoRootPasswd");
-      }    
-      if(in_array("gotoTerminal",$val['objectClass'])){
-        $pwd_acl = $ui->get_permissions($val['dn'],"terminal/termgeneric","gotoRootPasswd");
-      }    
-      if(preg_match("/w/",$pwd_acl)){
-        $action2 = "<input class='center' type='image' src='images/certs.png' alt='"._("Password")."'   name='system_setpwd_%KEY%' title='"._("Set root password")."'>";
-      }else{
-        $action2 = $empty;
-      }
-
-
-      if(in_array("gotoWorkstation",$val['objectClass'])){
-        $action2= "<input class='center' type='image' src='images/cdrom.png' alt='"._("Create CD")."'   
-                      name='gen_cd_%KEY%' title='"._("Create FAI CD")."'>&nbsp;".$action2;
-      }else{
-        $action2= $empty.$action2;
-      }
-
-      if(isset($val['message'])){
-        $display.= "  (".$val['message'].")";
-      }
-
-      $img    = $this->parent->convert_list($val);
-
-      /* Cutted objects should be displayed in light grey */
-      if($this->parent->CopyPasteHandler){
-        foreach($this->parent->CopyPasteHandler->queue as $queue_key => $queue_data){
-          if($queue_data['dn'] == $val['dn']) {
-            $display = "<font color='#999999'>".$display."</font>";
-            break;
-          }
-        }
-      }
-
-      $type = $this->parent->get_system_type($val);
-      if($type == "ArpNewDevice"){
-        $type = "NewDevice";
-      }
-      $cnts[$type] ++;
-
-
-      /* Create each field */
-      $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
-                      "attach" => "style='width:20px;'");
-
-      $field1 = array("string" => sprintf($img['img'],$val['dn']), "attach" => "style='text-align:center;width:20px;'");
-      $field2 = array("string" => sprintf($editlink,$key,$display), "attach" => "style='' title='".preg_replace('/ /', '&nbsp;', @LDAP::fix($val['dn']))."'");
-      $field3 = array("string" => preg_replace("/%KEY%/", "$key", $action2.$action), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'");
-      $this->AddElement( array($field0,$field1,$field2,$field3));
-    }
-
-    /* Create summary string for list footer */
-    $num_deps=0;
-    if(!$this->SubSearch){
-      $num_deps = count($this->Added_Departments);
-    }
-
-    $num_ser_str = _("Number of listed servers");
-    $num_ws_str  = _("Number of listed workstations");
-    $num_ter_str = _("Number of listed terminals");
-    $num_pho_str = _("Number of listed phones");
-    $num_prt_str = _("Number of listed printers");
-    $num_com_str = _("Number of listed network components");
-    $num_new_str = _("Number of listed new devices");
-    $num_wws_str = _("Number of listed windows workstations");
-    $num_dep_str = _("Number of listed departments");
-
-    $str = "<img class='center' src='images/select_server.png'
-      title='".$num_ser_str."' alt='".$num_ser_str."'>&nbsp;".$cnts['server']."&nbsp;&nbsp;&nbsp;&nbsp;";
-    $str.= "<img class='center' src='images/select_workstation.png'
-      title='".$num_ws_str."' alt='".$num_ws_str."'>&nbsp;".$cnts['workstation']."&nbsp;&nbsp;&nbsp;&nbsp;";
-    $str.= "<img class='center' src='images/select_terminal.png'
-      title='".$num_ter_str."' alt='".$num_ter_str."'>&nbsp;".$cnts['terminal']."&nbsp;&nbsp;&nbsp;&nbsp;";
-    $str.= "<img class='center' src='images/select_phone.png'
-      title='".$num_pho_str."' alt='".$num_pho_str."'>&nbsp;".$cnts['phone']."&nbsp;&nbsp;&nbsp;&nbsp;";
-    $str.= "<img class='center' src='images/select_printer.png'
-      title='".$num_prt_str."' alt='".$num_prt_str."'>&nbsp;".$cnts['printer']."&nbsp;&nbsp;&nbsp;&nbsp;";
-    $str.= "<img class='center' src='images/select_component.png'
-      title='".$num_com_str."' alt='".$num_com_str."'>&nbsp;".$cnts['component']."&nbsp;&nbsp;&nbsp;&nbsp;";
-    $str.= "<img class='center' src='images/select_newsystem.png'
-      title='".$num_new_str."' alt='".$num_new_str."'>&nbsp;".$cnts['NewDevice']."&nbsp;&nbsp;&nbsp;&nbsp;";
-    $str.= "<img class='center' src='images/select_winstation.png'
-      title='".$num_wws_str."' alt='".$num_wws_str."'>&nbsp;".$cnts['winstation']."&nbsp;&nbsp;&nbsp;&nbsp;";
-    $str.= "<img class='center' src='images/folder.png'
-      title='".$num_dep_str."' alt='".$num_dep_str."'>&nbsp;".$num_deps."&nbsp;&nbsp;&nbsp;&nbsp;";
-
-    $this->set_List_Bottom_Info($str);
-  }
-
-
-  function Save()
-  {
-    MultiSelectWindow :: Save();  
-  }
-
-
-  function save_object()
-  {
-    /* Save automatic created POSTs like regex, checkboxes */
-    MultiSelectWindow :: save_object();  
-
-
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_divListSystemService.inc b/plugins/admin/systems/class_divListSystemService.inc
deleted file mode 100644 (file)
index ca31601..0000000
+++ /dev/null
@@ -1,152 +0,0 @@
-<?php
-
-class divListSystemService extends MultiSelectWindow
-{
-  /* CheckBoxes, to change default values modify $this->AddCheckBox */
-  var $parent             ;
-  var $ui                 ;
-
-  function divListSystemService ($config,$parent)
-  {
-    MultiSelectWindow::MultiSelectWindow($config,"SystemService", "server");
-    
-    $this->parent       = $parent;
-    $this->ui           = get_userinfo();
-    $this->EnableJSLeaveMsg(TRUE);
-
-    /* Set list strings */
-    $this->SetTitle(_("Installed services"));
-    $this->SetSummary(_("Installed services"));
-
-    /* Result page will look like a headpage */
-    $this->SetInformation(_("This menu allows you to add, remove and configure the properties of a specific service."));
-
-    /* Disable buttonsm */
-    $this->EnableCloseButton(false);
-    $this->EnableSaveButton (false);
-
-    /* set Page header */
-    $this->AddHeader(array("string"=>"&nbsp;","attach"=>"style='width:20px;'"));
-    $this->AddHeader(array("string"=>_("Service name")));
-    $this->AddHeader(array("string"=>_("Actions"),"attach"=>"style='width:100px;border-right:0px;'"));
-    $this->HideFilterPart();
-  }
-
-  function GenHeader()
-  {
-    /* Prepare departments,
-       which are shown in the listbox on top of the listbox
-     */
-    $listhead = "<div style='background:#F0F0F9;height:16px;padding:0px;'>".
-    " <input type='image' align='middle' src='images/select_new_server.png' class='center' 
-        name='addNewService' alt='"._("Add service")."' title='"._("Add new service")."'>&nbsp;".
-    " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;".
-    " <input type='image' align='middle' src='images/status_start_all.png' class='center'
-        name='startServices' alt='"._("Start all")."' title='"._("Start all services")."'>&nbsp;".
-    " <input type='image' align='middle' src='images/status_stop_all.png'  class='center'   
-        name='stopServices' alt='"._("Stop service")."' title='"._("Stop all services")."'>&nbsp;".
-    " <input type='image' align='middle' src='images/status_restart_all.png'    class='center'
-        name='restartServices' alt='"._("Restart service")."' title='"._("Restart all services")."'>&nbsp;".
-    "</div>";
-    $this->SetListHeader($listhead);
-  }
-
-  function execute()
-  {
-    $this->ClearElementsList();
-    $this->GenHeader();
-  }
-
-  function setEntries($list)
-  {
-    $tmp = array();
-    foreach($list as $name => $entry){
-      $tmp[$name] = $entry['Message']; 
-    }
-
-    natcasesort($tmp);
-    $tmp2 = array();
-    foreach($tmp as $name => $value){
-      $tmp2[$name] = $list[$name];
-    }
-
-    $ui = get_userinfo();
-
-    foreach($tmp2 as $name => $entry){
-      switch($entry['Status']){
-        case ''      : $str ="&nbsp;";break;
-        case SERVICE_STOPPED  : $str ="<img src='images/status_stopped.png' title='"._("Stopped")."'>"; break;
-        case SERVICE_STARTED  : $str ="<img src='images/status_running.png' title='"._("Started")."'>"; break;
-        case SERVICE_RESTARTED : $str ="<img src='images/status_restarting.png' title='"._("Restarting")."' alt='R'>"; break;
-        default: $str= "<img src='images/select_user.png' alt='".$entry['Status']."' title='"._("User status")." : ".$entry['Status']."'>";
-      }
-
-      /* Get acls */
-      $acl = $ui->get_permissions($this->parent->dn,"server/".$name);
-      if(preg_match("/w/i",$acl) && !preg_match("/r/i",$acl)){
-        continue;
-      }
-  
-      $WasAccount = $this->parent->plugins[$name] -> initially_was_account;    
-  
-      $plug = $_GET['plug'];
-      $link = "<a href='?plug=".$plug."&amp;act=open&amp;id=".$name."'>".$entry['Message']."</a>";
-
-      $field1 = array("string" => $str ,"attach" => "style='width:20px;'");
-      $field2 = array("string" => $link);
-
-      $actions ="";
-      if($entry['AllowStart'] && $WasAccount){
-        $actions .= "&nbsp;<input type='image' name='StartSingleService_".$name."' src='images/status_start.png'
-                            title='"._("Start service")."'>";
-      }else{
-        $actions .= "&nbsp;<img src='images/empty.png' width='16' alt=''>";
-      }
-      if($entry['AllowStart'] && $WasAccount){
-        $actions .= "&nbsp;<input type='image' name='StopSingleService_".$name."' src='images/status_stop.png'
-                            title='"._("Stop service")."'>";
-      }else{
-        $actions .= "&nbsp;<img src='images/empty.png' width='16' alt=''>";
-      }
-      if($entry['AllowStart'] && $WasAccount){
-        $actions .= "&nbsp;<input type='image' name='RestartSingleService_".$name."' src='images/status_restart.png'
-                            title='"._("Restart service")."'>";
-      }else{
-        $actions .= "&nbsp;<img src='images/empty.png' width='16' alt=''>";
-      }
-
-      /* Check if edit is enabled and allowed for current service */
-      if($entry['AllowEdit'] && preg_match("/(r|w)/i",$acl)){
-        $actions .= "&nbsp;<input type='image' name='EditSingleService_".$name."' src='images/edit.png'
-                            title='"._("Edit service")."'>";
-      }else{
-        $actions .= "&nbsp;<img src='images/empty.png' width='16' alt=''>";
-      }
-
-      /* Check if remove is enabled and allowed for current service */
-      if($entry['AllowRemove'] && preg_match("/d/i",$acl)){
-        $actions .= "&nbsp;<input type='image' name='RemoveSingleService_".$name."' src='images/edittrash.png'
-                            title='"._("Remove service")."'>";
-      }else{
-        $actions .= "&nbsp;<img src='images/empty.png' width='16' alt=''>";
-      }
-
-      $field3 = array("string" => $actions ,"attach" => "style='width:100px;border-right:0px;'");
-      $this->AddElement(array($field1,$field2,$field3));
-    }
-  }
-
-  function Save()
-  {
-    MultiSelectWindow :: Save();  
-  }
-
-  function save_object()
-  {
-    /* Save automatic created POSTs like regex, checkboxes */
-    MultiSelectWindow :: save_object();   
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_phoneGeneric.inc b/plugins/admin/systems/class_phoneGeneric.inc
deleted file mode 100644 (file)
index f169c0e..0000000
+++ /dev/null
@@ -1,521 +0,0 @@
-<?php
-
-class phoneGeneric extends plugin
-{
-  /* CLI vars */
-  var $cli_summary= "Manage phone base objects";
-  var $cli_description= "Some longer text\nfor help";
-  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* Generic terminal attributes */
-  var $interfaces= array();
-  var $ignore_account= TRUE;
-
-  /* Needed values and lists */
-  var $base             = "";
-  var $cn               = "";
-  var $description      = "";
-  var $orig_dn          = "";
-  var $goFonType        = "";
-  var $goFonDmtfMode    = "";
-  var $goFonHost        = "";
-  var $goFonDefaultIP   = "dynamic";
-  var $goFonQualify     = "";
-  var $goFonAuth        = "";
-  var $goFonSecret      = "";
-  var $goFonInkeys      = "";
-  var $goFonPermit      = array();
-  var $goFonDeny        = array();
-  var $goFonOutkey      = "";
-  var $goFonTrunk       = "";
-  var $goFonAccountCode = "";
-  var $goFonMSN         = "";
-  var $selected_categorie    = 0;
-  var $netConfigDNS;
-  var $view_logged      = FALSE;
-
-  /* attribute list for save action */
-  var $attributes= array("cn", "description",
-                          "goFonType","goFonDmtfMode","goFonHost","goFonDefaultIP",
-                          "goFonQualify","goFonAuth","goFonSecret","goFonInkeys","goFonOutkey",
-                          "goFonTrunk","goFonAccountCode","goFonMSN","selected_categorie","goFonPermit","goFonDeny" 
-                         );
-
-  /* this array defines which attributes are schown / saved for the different type of phones */ 
-  var $usedattrs =    array( "0"=>array("cn", "description", 
-                                  "goFonType","goFonDmtfMode","goFonHost","goFonDefaultIP",
-                                  "goFonQualify"),
-                             "1"=>array("cn", "description", 
-                                  "goFonType","goFonHost","goFonDefaultIP",
-                                  "goFonQualify","goFonAuth","goFonSecret","goFonInkeys","goFonOutkey",
-                                  "goFonTrunk","goFonAccountCode","selected_categorie","goFonPermit","goFonDeny"),
-                             "2"=>array("cn", "description", "goFonMSN"));
-  
-
-  var $objectclasses= array("top", "goFonHardware");
-
-  function phoneGeneric (&$config, $dn= NULL, $parent= NULL)
-  {
-    plugin::plugin ($config, $dn, $parent);
-    $this->netConfigDNS = new termDNS($this->config,$this,$this->objectclasses, true);
-
-    /* Set base */
-    if ($this->dn == "new"){
-      $ui= get_userinfo();
-      $this->base= dn2base($ui->dn);
-      $this->cn= "";
-    } else {
-      $this->base= preg_replace ("/^[^,]+,[^,]+,[^,]+,/", "", $this->dn);
-    }
-  
-    if($this->goFonMSN != ""){
-      $this->selected_categorie = 2;
-    }elseif($this->goFonAccountCode != ""){
-      $this->selected_categorie = 1 ;
-    
-      if(isset($this->attrs['goFonPermit']['count'])){
-        unset ($this->attrs['goFonPermit']['count']);
-        $this->goFonPermit=$this->attrs['goFonPermit'];
-      }  
-     
-      if(isset($this->attrs['goFonDeny']['count'])){
-        unset ($this->attrs['goFonDeny']['count'])   ;
-        $this->goFonDeny=$this->attrs['goFonDeny'];
-      } 
-
-    } else {
-      $this->selected_categorie = 0;
-    }
-
-    if($this->goFonDefaultIP!="dynamic"){
-      $this->goFonDefaultIP = "network";
-    }
-
-    /* Save dn for later references */
-    $this->orig_dn= $this->dn;
-  }
-
-  function set_acl_base($base)
-  {
-    plugin::set_acl_base($base);
-    $this->netConfigDNS->set_acl_base($base);
-  }
-
-  function set_acl_category($cat)
-  {
-    plugin::set_acl_category($cat);
-    $this->netConfigDNS->set_acl_category($cat);
-  }
-
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","phone/".get_class($this),$this->dn);
-    }
-
-    /* Do we represent a valid phone? */
-    if (!$this->is_account && $this->parent === NULL){
-      $display= "<img alt=\"\" src=\"images/stop.png\" align=middle>&nbsp;<b>".
-        _("This 'dn' has no phone features.")."</b>";
-      return($display);
-    }
-
-    /* Base select dialog */
-    $once = true;
-    foreach($_POST as $name => $value){
-      if(preg_match("/^chooseBase/",$name) && $once){
-        $once = false;
-        $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
-        $this->dialog->setCurrentBase($this->base);
-      }
-    }
-
-    /* Dialog handling */
-    if(is_object($this->dialog)){
-      /* Must be called before save_object */
-      $this->dialog->save_object();
-
-      if($this->dialog->isClosed()){
-        $this->dialog = false;
-      }elseif($this->dialog->isSelected()){
-        
-        /* A new base was selected, check if it is a valid one */
-        $tmp = $this->get_allowed_bases();
-        if(isset($tmp[$this->dialog->isSelected()])){
-          $this->base = $this->dialog->isSelected();
-        }
-
-        $this->dialog= false;
-      }else{
-        return($this->dialog->execute());
-      }
-    }
-
-    /* handle Permit Add*/
-    if(isset($_POST['goFonPermitAdd']) && $this->acl_is_writeable("goFonPermit")){
-      if(isset($_POST['goFonPermitNew'])){
-        if(is_string($this->goFonPermit)){
-          $this->goFonPermit=array();
-        }
-        $new = $_POST['goFonPermitNew'];
-        if(strlen($new)> 1) {
-          $this->goFonPermit[]= $new;
-        }
-      }
-    }
-      
-    /* handle Deny Add*/
-    if(isset($_POST['goFonDenyAdd']) && $this->acl_is_writeable("goFonDeny")){
-      if(isset($_POST['goFonDenyNew'])){
-        if(is_string($this->goFonDeny)){
-          $this->goFonDeny=array();
-        }
-        $new = $_POST['goFonDenyNew'];
-        if(strlen($new)> 1) {
-          $this->goFonDeny[]= $new;
-        }
-      }
-    }
-
-    /* Handle Permit Deletion*/
-    if(isset($_POST['goFonPermitDel']) && $this->acl_is_writeable("goFonPermit")){
-      if(isset($_POST['goFonPermitS'])){
-        if(is_string($this->goFonPermit)){
-          $this->goFonPermit=array();
-        }
-        $new = $_POST['goFonPermitS'];
-        $tmp = array_flip($this->goFonPermit);
-        unset($tmp[$new]);
-        $this->goFonPermit=array();
-        foreach(array_flip($tmp) as $tm){
-          $this->goFonPermit[]=$tm;
-        }
-      }
-    }
-
-
-    /* Handle Permit Deletion*/
-    if(isset($_POST['goFonDenyDel']) && $this->acl_is_writeable("goFonDeny")){
-      if(isset($_POST['goFonDenyS'])){
-        if(is_string($this->goFonDeny)){
-          $this->goFonDeny=array();
-        }
-        $new = $_POST['goFonDenyS'];
-        $tmp = array_flip($this->goFonDeny);
-        unset($tmp[$new]);
-        $this->goFonDeny=array();
-        foreach(array_flip($tmp) as $tm){
-          $this->goFonDeny[]=$tm;
-        }
-      }
-    }
-  
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-
-    $smarty->assign("bases", $this->get_allowed_bases());
-
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translation){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-
-    $smarty->assign("staticAddress","<font class=\"must\">*</font>");// $this->config->idepartments);
-
-    /* Create Arrays for samrty select boxes */
-    $smarty->assign("categories",     array("SIP","IAX","CAPI"));
-    $smarty->assign("goFonTypes",     array("peer"      =>"peer"      ,"user"   =>"user"    ,"friend" =>"friend"));
-    $smarty->assign("goFonDmtfModes", array("inband"    =>"inband"    ,"rfc2833"=>"rfc2833" ,"info"   =>"info"));
-    $smarty->assign("goFonAuths",     array("plaintext" =>"plaintext" ,"md5"    =>"md5"     /*,"rsa"    =>"rsa"*/));
-    $smarty->assign("goFonTrunks",    array("yes" =>_("yes") ,"no" => _("no")));
-
-    /* deativate all fields that are not used by the specified type */
-    foreach($this->attributes as $att){
-      if((!in_array($att,$this->usedattrs[$this->selected_categorie]))){
-        $smarty->assign($att."USED", "disabled" );
-        $smarty->assign($att, "");
-      }else{
-        $smarty->assign($att."USED", "" );
-        $smarty->assign($att, $this->$att);
-      }
-    }
-    
-    $smarty->assign("selected_categorie",$this->selected_categorie);
-
-    /* Assign attributes */
-    $smarty->assign("base_select", $this->base);
-    $smarty->assign("goFonDefaultIPs",array("dynamic"=>_("dynamic"),"network"=>_("Networksettings")));
-    /* Show main page */
-    $str = $this->netConfigDNS->execute();
-    if(is_object($this->netConfigDNS->dialog)){
-      return($str);
-    }
-    $smarty->assign("netconfig", $str);
-    $smarty->assign("phonesettings", dirname(__FILE__)."/phonesettings.tpl");
-    return($smarty->fetch (get_template_path('phone.tpl', TRUE)));
-  }
-
-  function remove_from_parent()
-  {
-    if($this->acl_is_removeable()){
-      $ldap= $this->config->get_ldap_link();
-      $ldap->cd($this->config->current['BASE']);
-
-      $ldap->search ("(&(objectClass=goFonAccount)(goFonHardware=".$this->cn."))", array("uid","cn"));
-      while ($attr =  $ldap->fetch()){
-        print_red(sprintf(_("Can't delete because there are users which are depending on this phone. One of them is user '%s'."),
-              ($attr['uid'][0]." - ".$attr['cn'][0])));
-        return;
-      }
-
-      $this->netConfigDNS->remove_from_parent();
-      $ldap->rmdir($this->dn);
-  
-      new log("remove","phone/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-
-      show_ldap_error($ldap->get_error(), sprintf(_("Removing of system phone/generic with dn '%s' failed."),$this->dn));
-      $this->handle_post_events("remove",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
-
-      /* Delete references to object groups */
-      $ldap->cd ($this->config->current['BASE']);
-      $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
-      while ($ldap->fetch()){
-        $og= new ogroup($this->config, $ldap->getDN());
-        unset($og->member[$this->dn]);
-        $og->save ();
-      }
-    }
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    /* Create a base backup and reset the
-       base directly after calling plugin::save_object();
-       Base will be set seperatly a few lines below */
-    $base_tmp = $this->base;
-    plugin::save_object();
-    $this->base = $base_tmp;
-
-    $this->netConfigDNS->save_object();
-
-    /* Set new base if allowed */
-    $tmp = $this->get_allowed_bases();
-    if(isset($_POST['base'])){
-      if(isset($tmp[$_POST['base']])){
-        $this->base= $_POST['base'];
-      }
-    }
-  }
-
-
-  /* Check supplied data */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-    $message= array_merge($message, $this->netConfigDNS->check());
-
-    $this->dn= "cn=".$this->cn.",ou=phones,ou=systems,".$this->base;
-
-    /* To check for valid ip*/
-    if($this->netConfigDNS->ipHostNumber == ""){
-       $message[]= _("The required field IP address is empty.");
-    } else {
-      if (!is_ip($this->netConfigDNS->ipHostNumber)){
-        $message[]= _("The field IP address contains an invalid address.");
-      }
-    }
-
-    /* Check if given name is a valid host/dns name */
-    if(!is_dns_name($this->cn) ){
-      $message[] = _("Please specify a valid name for this object.");
-    }
-
-    if ($this->cn == ""){
-      $message[]= _("The required field 'Phone name' is not set.");
-    }
-    if ($this->cn == "0"){ 
-      $message[]= _("The 'Phone name' '0' is reserved and cannot be used.");
-    }
-
-    if ($this->orig_dn != $this->dn){
-      $ldap= $this->config->get_ldap_link();
-      $ldap->cd ($this->base);
-      $ldap->search ("(cn=".$this->cn.")", array("cn"));
-      if ($ldap->count() != 0){
-        while ($attrs= $ldap->fetch()){
-
-          if(preg_match("/cn=dhcp,/",$attrs['dn'])){
-            continue;
-          }
-  
-          if ($attrs['dn'] != $this->orig_dn){
-            $message[]= sprintf (_("There is already an entry '%s' in the base choosen by you"), $this->cn);
-            break;
-          }
-        }
-      }
-    }
-
-    return ($message);
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    plugin::save();
-   
-   
-    /* only to define which attrs to save*/ 
-    $mode = $this->selected_categorie;
-
-    /* Remove all unwanted attrs */
-    foreach($this->attributes as $att){
-      
-      /* Check all attributes, if they are needed for this type of phone */
-      if(!in_array($att,$this->usedattrs[$mode])){
-        $this->attrs[$att] = array();
-      }
-    }
-
-    /* unset the categorie*/
-    unset($this->attrs['selected_categorie']);
-    
-    /* Remove all empty values */
-    if ($this->orig_dn == 'new'){
-      $attrs= array();
-      foreach ($this->attrs as $key => $val){
-        if (is_array($val) && count($val) == 0){
-          continue;
-        }
-        $attrs[$key]= $val;
-      }
-      $this->attrs= $attrs;
-    }
-
-    if($this->goFonDefaultIP!="dynamic"){
-      $this->attrs['goFonDefaultIP'] = $this->netConfigDNS->ipHostNumber;
-    }    
-
-    $this->attrs = $this->netConfigDNS->getVarsForSaving($this->attrs);
-
-    /* Write back to ldap */
-    $ldap= $this->config->get_ldap_link();
-    if ($this->orig_dn == 'new'){
-      $ldap->cd($this->config->current['BASE']);
-      $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
-      $ldap->cd($this->dn);
-      $ldap->add($this->attrs);
-      new log("create","phone/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-      $this->handle_post_events("add",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
-    } else {
-      if ($this->orig_dn != $this->dn){
-        $this->move($this->orig_dn, $this->dn);
-      }
-
-      $ldap->cd($this->dn);
-      $this->cleanup();
-      $ldap->modify ($this->attrs); 
-      new log("modify","phone/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-
-      // $user_phone_reload   
-      $ldap->cd ($this->config->current['BASE']); 
-      $user_phone_assignment = $ldap->fetch($ldap->search("(&(objectClass=goFonAccount)(goFonHardware=".$this->cn."))",array("uid")));
-      if($user_phone_assignment){
-        $usertab= new usertabs($this->config,$this->config->data['TABS']['USERTABS'], $user_phone_assignment['dn']);
-        $usertab->by_object['phoneAccount']->is_modified = true;
-        $usertab->save();
-        unset($usertab);
-      }
-      $this->handle_post_events("modify",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
-    }
-    $this->netConfigDNS->cn = $this->cn;    
-    $this->netConfigDNS->save();
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of system phone/generic with dn '%s' failed."),$this->dn));
-  }
-
-
-  /* Display generic part for server copy & paste */
-  function getCopyDialog()
-  {
-    $vars = array("cn");
-    $smarty = get_smarty();
-    $smarty->assign("cn" ,$this->cn);
-    $smarty->assign("object","phone");
-    $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE));
-    $ret = array();
-    $ret['string'] = $str;
-    $ret['status'] = "";
-    return($ret);
-  }
-
-
-  function saveCopyDialog()
-  {
-    if(isset($_POST['cn'])){
-      $this->cn = $_POST['cn'];
-    }
-  }
-
-
-  function PrepareForCopyPaste($source)
-  {
-    plugin::PrepareForCopyPaste($source);
-    if(isset($source['macAddress'][0])){
-      $this->netConfigDNS->macAddress = $source['macAddress'][0];
-    }
-    if(isset($source['ipHostNumber'][0])){
-      $this->netConfigDNS->ipHostNumber = $source['ipHostNumber'][0];
-    }
-
-    $source_o = new phoneGeneric($this->config, $source['dn']);
-    $this->selected_categorie = $source_o->selected_categorie;
-  }
-
-
-  /* Return plugin informations for acl handling
-      #FIXME FAIscript seams to ununsed within this class... */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("Generic"),
-          "plDescription" => _("Phone generic"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 0,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("phone" => array("description"  => _("Phone hardware"),
-                                                    "objectClass"  => "goFonHardware")),
-          "plProvidedAcls"=> array(
-            "cn"                  => _("Name"),
-            "base"                => _("Base"),
-            "description"         => _("Description"),
-            "goFonType"           => _("SIP Mode"),
-            "goFonDmtfMode"       => _("SIP DTMF mode"),
-            "goFonDefaultIP"      => _("SIP Default ip"),
-            "goFonQualify"        => _("SIP Qualify"),
-            "goFonAuth"           => _("IAX authentication type"),
-            "goFonSecret"         => _("IAX secret"),
-            "goFonAccountCode"    => _("IAX account code"),
-            "goFonTrunk"          => _("IAX trunk lines"),
-            "goFonPermit"         => _("IAX permit settings"),
-            "goFonDeny"           => _("IAX deny settings"),
-            "goFonMSN"            => _("CAPI MSN"),
-            "categorie"  => _("Hardware type"))
-          ));
-  }
-
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_printGeneric.inc b/plugins/admin/systems/class_printGeneric.inc
deleted file mode 100644 (file)
index 54092c6..0000000
+++ /dev/null
@@ -1,1048 +0,0 @@
-<?php
-
-class printgeneric extends plugin
-{
-  /* CLI vars */
-  var $cli_summary      = "Manage terminal base objects";
-  var $cli_description  = "Some longer text\nfor help";
-  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* Generic terminal attributes */
-  var $interfaces     = array();
-  var $ignore_account = FALSE;
-
-  /* Needed values and lists */
-  var $base             = "";
-  var $cn               = "";
-  var $l                = "";
-  var $description      = "";
-  var $labeledURI       = "";
-  var $gotoPrinterPPD   = "";
-  var $initial_PPD      = "";
-  var $orig_dn          = "";
-
-  var $UserMember       ="";
-  var $UserMembers      =array();
-  var $UserMemberKeys   =array();
-
-  var $AdminMember      ="";
-  var $AdminMembers     =array();
-  var $AdminMemberKeys  =array();
-
-  var $PPDdialogToSave  = NULL;
-  var $BelongsTo        = "unknown"; //  Specifies if this is a standalone printer, or belongs to a terminal / WS
-
-  var $member           =array();
-  var $strings          = "";
-  var $netConfigDNS;
-  var $baseSelection    = false;
-  var $macAddress       = "";
-
-  var $gotoUserAdminPrinter;
-  var $gotoGroupAdminPrinter ;
-  var $gotoGroupPrinter;
-  var $gotoUserPrinter ;
-
-  /* attribute list for save action */
-  var $attributes     = array("cn", "description", "l", "labeledURI", "gotoPrinterPPD","gotoUserPrinter", "macAddress", 
-                              "gotoUserAdminPrinter","gotoGroupAdminPrinter","gotoUserPrinter","gotoGroupPrinter");
-  var $objectclasses  = array("top", "gotoPrinter");
-  var $view_logged    = FALSE;
-  var $parent;
-
-  function printgeneric (&$config, $dn,$parent_init,$parent)
-  {
-    $this->config = &$config;
-    $this->dn = $dn; 
-    /* If parent was posted(the tabs object) we can detect the printer type. */
-    if($parent){
-      $this->parent = $parent;
-      $this->getTypeOfPrinter();
-    }else{
-      $this->BelongsTo = "unknown";
-      return;
-    }
-
-    /* Update dn, to ensure storing as printer instead of WS / terminal */
-    if(preg_match("/Terminal/i",$this->BelongsTo) || preg_match("/TerminalTemplate/i",$this->BelongsTo)){
-      $this->dn= preg_replace("/ou=terminals,/","ou=printers,",$this->dn);
-    }
-
-    if(preg_match("/Workstation/i",$this->BelongsTo) || preg_match("/WorkstationTemplate/i",$this->BelongsTo)){
-      $this->dn= preg_replace("/ou=workstations,/","ou=printers,",$this->dn);
-    }
-
-    $this->orig_dn = $this->dn;
-
-    /* Get printer settings, possibly dn has changed */
-    plugin::plugin ($config, $this->dn);
-
-    /* Get is_account initially_was_account status */
-    $this->getTypeOfPrinter(true);
-
-    /* set orig dn to new if object is new */
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cat($this->dn, array('dn'));
-    if(!$ldap->count()){
-      $this->orig_dn = "new";
-    }
-    
-    /* create dns object */
-    $this->netConfigDNS = new termDNS($this->config, $this,$this->objectclasses);
-
-    /* Set base */
-    if ($this->dn == "new"){
-      $ui= get_userinfo();
-      $this->base= dn2base($ui->dn);
-      $this->cn= "";
-    } else {
-    
-      /* Set base and check if the extracted base exists */
-      if(preg_match("/ou=incoming,/",$this->dn)){
-        $this->base= preg_replace("/ou=incoming,/","",dn2base($this->dn));
-      }else{
-        $this->base= preg_replace("/ou=printers,ou=systems,/","",dn2base($this->dn));
-      }
-
-      if(!isset($this->config->idepartments[$this->base])){
-        print_red(_("Can't extract a valid base out of object dn, setting base to '%s'."),$_SESSION['CurrentMainBase']);
-        $this->base = $_SESSION['CurrentMainBase'];
-      }
-    }
-
-    /* Extract selected ppd */
-    if(isset($this->gotoPrinterPPD)){
-      $this->gotoPrinterPPD = preg_replace("/^http.*ppd\//i","",$this->gotoPrinterPPD);
-    }
-
-    $this->initial_PPD = $this->gotoPrinterPPD;
-
-    /* Prepare different member types */ 
-    foreach(array("AddUser"       =>"gotoUserPrinter",
-          "AddGroup"      =>"gotoGroupPrinter",
-          "AddAdminUser"  =>"gotoUserAdminPrinter",
-          "AddAdminGroup" =>"gotoGroupAdminPrinter") as $type => $attr){
-
-      /* $this->members contains all members */
-      $this->member[$type]=array();
-
-      if (isset($this->attrs[$attr]['count'])) {
-        unset($this->attrs[$attr]['count']);
-      }
-
-      if(isset($this->attrs[$attr])){
-        foreach($this->attrs[$attr] as $mem){
-          if(preg_match("/Group/",$type)){
-            $ldap->search("(&(objectClass=posixGroup)(cn=".$mem."))",array("cn","description"));
-            if($ldap->count()){
-              $entry = $ldap->fetch();
-              $this->member[$type][$entry['cn'][0]]=$entry;
-            }
-          }else{
-            $ldap->search("(&(objectClass=person)(objectClass=inetOrgPerson)(uid=".$mem."))",array("cn","uid"));
-            if($ldap->count()){
-              $entry = $ldap->fetch();
-              $this->member[$type][$entry['uid'][0]]=$entry;
-            }
-          }
-        }
-      }
-    }
-  }
-
-  function set_acl_base($base)
-  {
-    plugin::set_acl_base($base);
-    if(is_object($this->netConfigDNS)){
-      $this->netConfigDNS->set_acl_base($base);
-    }
-  }
-
-  function set_acl_category($cat)
-  {
-    plugin::set_acl_category($cat);
-    if(is_object($this->netConfigDNS)){
-      $this->netConfigDNS->set_acl_category($cat);
-    }
-  }
-
-  /* Detect type of printer.
-   * Printer can be stand alone, belong to a workstation or belong to a terminal. 
-   * We can detect the type printer type when comparing the tabs objects
-   */
-  function getTypeOfPrinter($UpdateAccountStatus = false)
-  {
-    /* Disable account as default
-     */  
-    $this->is_account = $this->initially_was_account = false;
-
-    /* Detect type of printer via parent tabs.
-     */
-
-    $class = get_class($this->parent);
-    if(isset($this->parent->by_object['workgeneric'])){
-
-      /* Exclude templates 
-       */
-      $this->cn = $this->parent->by_object['workgeneric']->cn;
-      if($this->parent->by_object['workgeneric']->cn == "wdefault"){
-        $this->BelongsTo = "WorkstationTemplate";
-      }else{
-        $this->BelongsTo = "Workstation";
-      }
-    }elseif(isset($this->parent->by_object['termgeneric'])){
-
-      /* Exclude templates 
-       */
-      $this->cn = $this->parent->by_object['termgeneric']->cn;
-      if($this->parent->by_object['termgeneric']->cn == "default"){
-        $this->BelongsTo = "TerminalTemplate";  
-      }else{
-        $this->BelongsTo = "Terminal";
-      }
-    }elseif(isset($this->parent->by_name['printgeneric'])){
-      $this->BelongsTo  = "Printer";
-    }
-
-    if($UpdateAccountStatus){
-
-      /* Set is_account / was account 
-       */
-      if($this->dn == "new"){
-        $this->initially_was_account = false;
-      }
-
-      /* If is printer it must be a true account.
-       */
-      if(preg_match("/printer/i",$this->BelongsTo)){
-        $this->is_account = true;
-      }
-
-      /* Update dn, to ensure storing as printer instead of WS / terminal
-       */
-      if(preg_match("/terminal/i",$this->BelongsTo)){
-        $this->dn= preg_replace("/ou=terminals,/","ou=printers,",$this->dn);
-      }
-
-      if(preg_match("/workstation/i",$this->BelongsTo)){
-        $this->dn= preg_replace("/ou=workstations,/","ou=printers,",$this->dn);
-      }
-
-      /* Detect if this is a valid printer account;
-       */
-      $ldap = $this->config->get_ldap_link();
-      $ldap->cat($this->dn, array('objectClass'));
-
-      if($ldap->count()){
-        $attrs = $ldap->fetch();
-        if(in_array("gotoPrinter",$attrs['objectClass'])){
-          $this->initially_was_account = true;
-          $this->is_account             = true;
-        }else{
-          $this->is_account = false;
-        }
-      }
-    }
-  }
-
-  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);
-    }
-
-
-    /* If type of printer couldn't be detected (because of missing parent object in construction) 
-     * hide this tab.
-     */
-    if(preg_match("/unknown/i",$this->BelongsTo)){
-      $display= $this->show_enable_header(_("Add printer extension"),
-          _("Could not initialize printer tab, parameter parent was missing while construction."),TRUE,TRUE);
-      return($display);
-    }
-
-    /* Templates can't have printer extensions 
-     */
-    if(preg_match("/WorkstationTemplate/i",$this->BelongsTo)){
-      $display= $this->show_enable_header(_("Add printer extension"),
-          _("This is a workstation template, printer tab is disabled."),TRUE,TRUE);
-      return($display);
-    }
-    if(preg_match("/TerminalTemplate/i",$this->BelongsTo)){
-      $display= $this->show_enable_header(_("Add printer extension"),
-          _("This is a terminal template, printer tab is disabled."),TRUE,TRUE);
-      return($display);
-    }
-
-    /* Get cn from base object */
-    if(preg_match("/^Workstation$/i",$this->BelongsTo)){
-      $this->cn = $this->parent->by_object['workgeneric']->cn;
-    }
-    if(preg_match("/^Terminal$/i",$this->BelongsTo)){
-      $this->cn = $this->parent->by_object['termgeneric']->cn;
-    }
-
-    $smarty= get_smarty();
-
-    /* Assign acls */
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translation){
-      $smarty->assign($name."ACL", $this->getacl($name));
-    }
-
-    $display="";
-
-    /* Tell smarty if this is a standalone object or a terminal / WS depending printer */
-    if(preg_match("/^Printer$/i",$this->BelongsTo)){    
-      $smarty->assign("StandAlone",true);
-    }else{
-      $smarty->assign("StandAlone",false);
-    }
-
-    /* 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;
-      }
-    }
-
-    /* Do we represent a valid printer? */
-    if (!$this->is_account && $this->parent === NULL){
-      $display= "<img alt=\"\" src=\"images/stop.png\" align=middle>&nbsp;<b>".
-        _("This 'dn' has no printer features.")."</b>";
-      return($display);
-    }
-
-    /* If this is a WS / Terminal depending printer, display account state button */
-    if(!preg_match("/^Printer$/i",$this->BelongsTo)){
-      if((empty($this->cn)) && ($this->dn != "new")){
-        $display= $this->show_enable_header(_("Add printer extension"),
-            _("This object has printer extension disabled. You can't enable it while 'cn' is not present in entry. Possibly you are currently creating a new terminal template"),TRUE,TRUE);
-        $this->is_account= false;
-        return $display;
-      }
-
-      if (($this->is_account)){
-        if(preg_match("/^Workstation$/i",$this->BelongsTo)){
-          $display= $this->show_disable_header(_("Remove printer extension"),
-              _("This workstation has printer extension enabled.You can disable it by clicking below."));
-        }elseif(preg_match("/^Terminal$/i",$this->BelongsTo)){
-          $display= $this->show_disable_header(_("Remove printer extension"),
-              _("This terminal has printer extension enabled. You can disable it by clicking below."));
-        }
-      }else{
-        if(preg_match("/^Workstation$/i",$this->BelongsTo)){
-          $display= $this->show_disable_header(_("Add printer extension"),
-              _("This workstation has printer extension disabled. You can enable it by clicking below."));
-        }elseif(preg_match("/^Terminal$/i",$this->BelongsTo)){
-          $display= $this->show_enable_header(_("Add printer extension"),
-              _("This terminal has printer extension disabled. You can enable it by clicking below."));
-        }  
-        return ($display);
-      }
-    }
-
-    /* Base select dialog */
-    $once = true;
-    foreach($_POST as $name => $value){
-      if(preg_match("/^chooseBase/",$name) && $once && $this->acl_is_moveable()){
-        $once = false;
-        $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
-        $this->dialog->setCurrentBase($this->base);
-        $this->baseSelection = true;
-      }
-    }
-
-    /* Dialog handling for base select dialog
-     * Check if base was selected, dialog aborted etc */
-    if(is_object($this->dialog)){
-
-      $this->dialog->save_object();
-      if($this->baseSelection){
-        if($this->dialog->isClosed()){
-          $this->dialog = false;
-          $this->baseSelection = false;
-        }elseif($this->dialog->isSelected()){
-
-          /* A new base was selected, check if it is a valid one */
-          $tmp = $this->get_allowed_bases();
-          if(isset($tmp[$this->dialog->isSelected()])){
-            $this->base = $this->dialog->isSelected();
-          }
-
-          $this->dialog= false;
-          $this->baseSelection = false;
-        }else{
-          return($this->dialog->execute());
-        }
-      }
-    }
-
-    /* Fill templating stuff */
-    $smarty->assign("bases", $this->get_allowed_bases());
-    $smarty->assign("base_select", $this->base);
-
-    /* Assign attributes */
-    foreach ($this->attributes as $attr){
-      $smarty->assign("$attr", $this->$attr);
-    }
-
-    if(isset($_POST['AddUser'])){
-      $this->dialog = new selectUserToPrinterDialog($this->config, NULL,"AddUser");
-    }
-    if(isset($_POST['AddGroup'])){
-      $this->dialog = new selectUserToPrinterDialog($this->config, NULL,"AddGroup");
-    }
-    if(isset($_POST['AddAdminUser'])){
-      $this->dialog = new selectUserToPrinterDialog($this->config, NULL,"AddAdminUser");
-    }
-    if(isset($_POST['AddAdminGroup'])){
-      $this->dialog = new selectUserToPrinterDialog($this->config, NULL,"AddAdminGroup");
-    }
-
-    /* Display ppd configure/select dialog      */
-    if(isset($_POST['EditDriver'])){
-      if($this->PPDdialogToSave && is_object($this->PPDdialogToSave)){
-        $this->dialog = $this->PPDdialogToSave;
-      }else{
-        $this->dialog = new printerPPDDialog($this->config, $this->dn,$this->gotoPrinterPPD);
-        $this->dialog->cn= $this->cn;
-      }
-    }
-
-    /* remove ppd */
-    if(isset($_POST['RemoveDriver'])){
-      $this->gotoPrinterPPD = array();
-      $this->PPDdialogToSave = NULL;
-    }
-
-    /* Close ppd dialog */
-    if(isset($_POST['ClosePPD'])){
-      unset($this->dialog);
-      $this->dialog=FALSE;
-    }
-
-    /* Save selected ppd */
-    if(isset($_POST['SavePPD'])){
-      $this->dialog->save_object();
-      if(count($this->dialog->check())){
-        foreach($this->dialog->check() as $msg){
-          print_red($msg);
-        }
-      }else{
-        $this->gotoPrinterPPD = array();
-        $this->gotoPrinterPPD = $this->dialog->save();
-        $this->PPDdialogToSave = $this->dialog;
-        unset($this->dialog);
-        $this->dialog=FALSE;
-      }
-    }
-
-     /* Member management, delete user / group / admin ..*/
-    if((isset($_POST['DelUser']))&&(isset($_POST['UserMember']))){
-      foreach($_POST['UserMember'] as $mem){
-        $this->DelMember('AddUser',$mem);
-      }
-    }
-
-    if((isset($_POST['DelUser']))&&(isset($_POST['UserMember']))){
-      foreach($_POST['UserMember'] as $mem){
-        $this->DelMember('AddGroup',$mem);
-      }
-    }
-
-    if((isset($_POST['DelAdmin']))&&(isset($_POST['AdminMember']))){
-      foreach($_POST['AdminMember'] as $mem){
-        $this->DelMember('AddAdminUser',$mem);
-      }
-    }
-
-    if((isset($_POST['DelAdmin']))&&(isset($_POST['AdminMember']))){
-      foreach($_POST['AdminMember'] as $mem){
-        $this->DelMember('AddAdminGroup',$mem);
-      }
-    }
-
-    /* Abort user / group adding dialog */
-    if(isset($_POST['PrinterCancel'])){
-      unset($this->dialog);
-      $this->dialog= FALSE;
-    }
-
-    /* Save selected users / groups */
-    if(isset($_POST['PrinterSave'])){
-      $this->dialog->save_object();
-      if(count($this->dialog->check())){
-        foreach($this->dialog->check() as $msg){
-          print_red($msg);
-        }
-      }else{
-        $data= $new = $this->dialog->save();
-        unset($data['type']);
-        foreach($data as $mem){
-          $this->AddMember($new['type'], $mem['dn']);
-        }
-        unset($this->dialog);
-        $this->dialog=FALSE;
-      }
-    }
-
-    /* Display dialog, if there is currently one open*/
-    if(is_object($this->dialog)){
-      $this->dialog->save_object();
-      $display = $this->dialog->execute();
-      return $display;
-    }
-
-    /* Parse selected ppd file */
-    if((isset($_SESSION['config']->data['MAIN']['PPD_PATH']))&&(is_dir($_SESSION['config']->data['MAIN']['PPD_PATH']))){
-
-      $path = $_SESSION['config']->data['MAIN']['PPD_PATH'];
-      if(!preg_match("/\/$/",$path)){
-        $path = $path."/";
-      }
-
-      $ppdManager= new ppdManager($path);
-      if(!empty($this->gotoPrinterPPD)){
-        if((!file_exists($path.$this->gotoPrinterPPD))){
-          $smarty->assign("driverInfo", "<b>".sprintf(_("Your currently selected PPD file '%s' doesn't exist."),$path.$this->gotoPrinterPPD)."</b>");
-        }else{
-          $smarty->assign("driverInfo", $ppdManager->loadDescription($path.$this->gotoPrinterPPD));
-        }
-      }else{
-        $smarty->assign("driverInfo", _("Not defined"));
-      }
-    }else{
-      $smarty->assign("driverInfo",_("Can't get ppd informations."));
-    }
-
-    /* Create user & admin user list */
-    $list=$this->generateList();
-    $userlist   = array_merge($list['AddUser'],$list['AddGroup']);
-    $adminlist  = array_merge($list['AddAdminUser'],$list['AddAdminGroup']);
-
-    asort($userlist);
-    asort($adminlist);
-
-    if(!preg_match("/Printer/i",$this->BelongsTo)){
-      if(preg_match("/Terminal/i",$this->BelongsTo)){
-        $smarty->assign("desc"    ,sprintf(_("This printer belongs to terminal %s. You can't rename this printer."),"<b>".$this->cn."</b>"));
-      }else{
-        $smarty->assign("desc"    ,sprintf(_("This printer belongs to workstation %s. You can't rename this printer."),"<b>".$this->cn."</b>"));
-      }
-      $smarty->assign("cnACL"    , $this->getacl("cn",true));
-    }else{
-      $smarty->assign("desc"    ,"");
-    }
-    $smarty->assign("UserMember"    ,$this->UserMember);
-    $smarty->assign("UserMembers"   ,$userlist);
-    $smarty->assign("UserMemberKeys",array_flip($userlist));
-
-    $smarty->assign("AdminMember"    ,$this->AdminMember);
-    $smarty->assign("AdminMembers"   ,$adminlist);
-    $smarty->assign("AdminMemberKeys",array_flip($adminlist));
-    if(preg_match("/Printer/i",$this->BelongsTo)){
-
-      /* Show main page */
-      $str = $this->netConfigDNS->execute();
-      if(is_object($this->netConfigDNS->dialog)){
-        return($str);
-      }
-      $smarty->assign("netconfig", $str);
-    } else {
-      $smarty->assign("netconfig", "");
-    }
-
-    return($display.$smarty->fetch (get_template_path('printer.tpl', TRUE)));
-  }
-
-  function remove_from_parent()
-  {
-    /* Only remove if there was initially an account */
-    if($this->initially_was_account){
-
-      /* Update dn, to ensure storing as printer instead of WS / terminal
-       */
-      if(preg_match("/terminal/i",$this->BelongsTo)){
-        $this->dn= preg_replace("/ou=terminals,/","ou=printers,",$this->dn);
-      }
-
-      if(preg_match("/workstation/i",$this->BelongsTo)){
-        $this->dn= preg_replace("/ou=workstations,/","ou=printers,",$this->dn);
-      }
-
-      /* Check if this dn points to a printer, to avoid deleting something else */
-      $ldap= $this->config->get_ldap_link();
-      $ldap->cat($this->dn, array('dn',"objectClass"));
-      if(!$ldap->count()){
-        print_red("Trying to remove printer object which isn't a printer. Aborted to avoid data loss.");
-        return;
-      }
-
-      /* Check if obejct is a printer */
-      $CheckPrinter = $ldap->fetch();
-      if(!in_array("gotoPrinter",$CheckPrinter['objectClass'])){
-        print_red("Trying to remove printer object which isn't a printer. Aborted to avoid data loss.");
-        return;
-      }
-
-      /* Remove account & dns extension */ 
-      $this->netConfigDNS->remove_from_parent();
-      $ldap->rmdir($this->dn);
-
-      new log("remove","printer/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-  
-      show_ldap_error($ldap->get_error(), sprintf(_("Removing of system print/generic with dn '%s' failed."),$this->dn));
-      $this->handle_post_events("remove",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
-
-      /* Delete references to object groups */
-      $ldap->cd ($this->config->current['BASE']);
-      $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
-      while ($ldap->fetch()){
-        $og= new ogroup($this->config, $ldap->getDN());
-        unset($og->member[$this->dn]);
-        $og->save ();
-      }
-
-      /* Remove previously selected ppd file.*/
-      if(!empty($this->initial_PPD)){
-        $tmp = new printerPPDDialog($this->config, $this->dn,$this->initial_PPD);
-        $tmp->removeModifiedPPD();
-      }
-    }
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    /* Create a base backup and reset the
-       base directly after calling plugin::save_object();
-       Base will be set seperatly a few lines below */
-    $base_tmp = $this->base;
-    plugin::save_object();
-    $this->base = $base_tmp;
-
-    if(is_object($this->netConfigDNS)){
-      $this->netConfigDNS->save_object();
-    }
-    
-    /* Set new base if allowed */
-    $tmp = $this->get_allowed_bases();
-    if(isset($_POST['base'])){
-      if(isset($tmp[$_POST['base']])){
-        $this->base= $_POST['base'];
-      }
-    }
-  }
-
-  /* Check supplied data */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-    if (preg_match("/printer/i",$this->BelongsTo)){
-      $message= array_merge($message, $this->netConfigDNS->check());
-    }
-
-    /* Don't display check messages if this is a template object */
-    if(isset($this->parent->by_object['workgeneric'])){
-      if($this->parent->by_object['workgeneric']->cn == "wdefault"){
-        return $message;
-      }
-    }elseif(isset($this->parent->by_object['termgeneric'])){
-      if($this->parent->by_object['termgeneric']->cn == "default"){
-        return $message;
-      }
-    }
-
-    $dn= "cn=".$this->cn.",ou=printers,ou=systems,".$this->base;
-
-    /* must: cn */
-    if(($this->BelongsTo == "Printer") && (empty($this->cn))){
-      $message[]= _("The required field 'Printer name' is not set.");
-    }
-
-    /* must: cn */
-    if(($this->BelongsTo == "Printer") && !is_dns_name($this->cn)){
-      $message[]= _("Invalid character in printer name.");
-    }
-
-    /* must: labeledURI */
-    if(empty($this->labeledURI)){
-      $message[]= "The required field 'Printer URL' is not set.";
-    }
-    
-    /* Check if there is already an entry with this cn*/
-    if (($this->orig_dn != $dn)&&( preg_match("/printer/i",$this->BelongsTo))){
-      $ldap= $this->config->get_ldap_link();
-      $ldap->cd ($this->base);
-      $ldap->ls("(cn=".$this->cn.")","ou=printers,ou=systems,".$this->base, array("cn"));
-      if ($ldap->count() != 0){
-        while ($attrs= $ldap->fetch()){
-          if(preg_match("/cn=dhcp,/",$attrs['dn'])){
-            continue;
-          }
-          if ($attrs['dn'] != $this->orig_dn){
-            $message[]= sprintf (_("There is already an entry '%s' in the base choosen by you"), $this->cn);
-            break;
-          }
-        }
-      }
-    }
-
-    return ($message);
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    /* Update dn, to ensure storing as printer instead of WS / terminal
-     */
-    if(preg_match("/terminal/i",$this->BelongsTo)){
-      $this->dn= preg_replace("/ou=terminals,/","ou=printers,",$this->dn);
-    }
-
-    if(preg_match("/workstation/i",$this->BelongsTo)){
-      $this->dn= preg_replace("/ou=workstations,/","ou=printers,",$this->dn);
-    }
-    
-    if(!$this->is_account) return;
-    if(isset($this->parent->by_object['workgeneric'])){
-      if($this->parent->by_object['workgeneric']->cn == "wdefault"){
-        return;
-      }
-    }elseif(isset($this->parent->by_object['termgeneric'])){
-      if($this->parent->by_object['termgeneric']->cn == "default"){
-        return;
-      }
-    }
-
-    /* If type is still unknown, the initialisation of this printer failed, abort. */
-    if(preg_match("/unknown/i",$this->BelongsTo)){
-      return;
-    }
-
-    /* save ppd configuration */
-    if($this->PPDdialogToSave && is_object($this->PPDdialogToSave)){
-      $this->PPDdialogToSave->save_ppd();
-    }
-    if($this->orig_dn != $this->dn){
-      if(!empty($this->gotoPrinterPPD)) {
-        $this->PPDdialogToSave = new printerPPDDialog($this->config, $this->dn,$this->gotoPrinterPPD);
-        $this->PPDdialogToSave->cn = $this->cn;
-        $this->PPDdialogToSave->generateProperties();
-        $this->PPDdialogToSave->update_ppd_url();
-      }
-    }
-
-    /* Remove previously selected ppd file.*/
-    if($this->initial_PPD != $this->gotoPrinterPPD){
-      if(!empty($this->initial_PPD)){
-        $tmp = new printerPPDDialog($this->config, $this->dn,$this->initial_PPD);
-        $tmp->removeModifiedPPD();
-      }
-    }
-
-    if(preg_match("/https/i",$_SERVER['HTTP_REFERER'])){
-      $method="https://";
-    }else{
-      $method="http://";
-    }
-
-    /* If no ppd is selected, remove this attribute */
-    if(!empty($this->gotoPrinterPPD)) {
-      $this->gotoPrinterPPD = $method.str_replace("//","/",$_SERVER['SERVER_NAME']."/ppd/".$this->gotoPrinterPPD);
-    }else{
-      $this->gotoPrinterPPD = array();
-    }
-
-    $dn= $this->dn;
-    plugin::save();
-    $ldap= $this->config->get_ldap_link();
-
-    /* reduce objectClasses to minimun */
-    $this->attrs['objectClass']= $this->objectclasses;
-
-    /* Remove all empty values */
-    if ($this->orig_dn == 'new'){
-      $attrs= array();
-      foreach ($this->attrs as $key => $val){
-        if (is_array($val) && count($val) == 0){
-          continue;
-        }
-        $attrs[$key]= $val;
-      }
-      $this->attrs= $attrs;
-    }
-
-    /* Append printer user 
-     */
-    $this->attrs['gotoUserPrinter']=array();
-    foreach($this->member['AddUser'] as $mem){
-      $this->attrs['gotoUserPrinter'][]=$mem['uid'][0];
-    }
-
-    /* Append printer group 
-     */
-    $this->attrs['gotoGroupPrinter'] = array();
-    foreach($this->member['AddGroup'] as $mem){
-      $this->attrs['gotoGroupPrinter'][]=$mem['cn'][0];
-    }
-
-    /* Append printer admin user 
-     */
-    $this->attrs['gotoUserAdminPrinter'] = array();
-    foreach($this->member['AddAdminUser'] as $mem){
-      $this->attrs['gotoUserAdminPrinter'][]=$mem['uid'][0];
-    }
-
-    /* Append printer admin group 
-     */
-    $this->attrs['gotoGroupAdminPrinter']= array();
-    foreach($this->member['AddAdminGroup'] as $mem){
-      $this->attrs['gotoGroupAdminPrinter'][]=$mem['cn'][0];
-    }
-
-    if($this->orig_dn == 'new'){
-      foreach(array("gotoGroupPrinter","gotoUserAdminPrinter","gotoGroupAdminPrinter","gotoUserPrinter") as $checkVar){
-        if(count($this->attrs[$checkVar])  == 0 || empty($this->attrs[$checkVar])){
-          unset($this->attrs[$checkVar]);
-        }
-      }
-    }else{
-      if(($this->gosaUnitTag) && (!in_array_ics("gosaAdministrativeUnitTag",$this->attrs['objectClass']))){
-        $this->attrs['objectClass'][] = "gosaAdministrativeUnitTag";
-      }
-    }
-
-    /* Ensure to create a new object */
-    if(preg_match("/ou=incoming,/",$this->orig_dn)){
-      $this->orig_dn = "new";
-    }
-
-    /* Move object in necessary*/
-    if (($this->orig_dn != $this->dn) && ($this->orig_dn != 'new')){
-      $this->move($this->orig_dn, $this->dn);
-    }
-
-    /* Write back to ldap */
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cat($this->dn);
-    if(!$ldap->count()){
-      $ldap->cd($this->config->current['BASE']);
-      $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
-      $ldap->cd($this->dn);
-
-      /* Remove empty values */ 
-      foreach($this->attrs as $name => $value){
-        if(empty($value)){
-          unset($this->attrs[$name]);
-        }
-      }
-
-      $ldap->add($this->attrs);
-      $this->handle_post_events("add",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
-      new log("create","printer/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    } else {
-      $ldap->cd($this->dn);
-      $this->cleanup();
-      $ldap->modify ($this->attrs); 
-      $this->handle_post_events("modify",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
-      new log("modify","printer/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of system print/generic with dn '%s' failed."),$this->dn));
-
-    if(preg_match("/printer/i",$this->BelongsTo)){
-      $this->netConfigDNS->cn = $this->cn;
-      $this->netConfigDNS->dn = $this->dn;
-      $this->netConfigDNS->save();
-    }
-
-    /* This is a multi object. Handle tagging here... */
-    $this->handle_object_tagging();
-  }
-
-  function generateList(){
-    $a_return=array();
-
-    foreach($this->member as $type => $values){
-      $a_return[$type]=array();
-      foreach($values as $value){
-        if((preg_match("/Group/i",$type))){
-          if(!isset($value['description'])){
-            $a_return[$type][$value['cn'][0]]= _("Group")." : ".$value['cn'][0];
-          }else{
-            $a_return[$type][$value['cn'][0]]= _("Group")." : ".$value['cn'][0]." [".$value['description'][0]."]";
-          }
-        }else{
-          $a_return[$type][$value['uid'][0]]=_("User")." : ".$value['cn'][0];
-        }
-      }
-    }
-    return($a_return);
-  }
-
-  /* Return plugin informations for acl handling
-      #FIXME FAIscript seams to ununsed within this class... */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("Generic"),
-          "plDescription" => _("Print generic"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 4,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("printer" => array("description"  => _("Printer"),
-                                                    "objectClass"  => "gotoPrinter"),"workstation","terminal"),
-          "plProvidedAcls"=> array(
-            "cn"                => _("Name"),
-            "base"                => _("Base") ,         
-            "description"       => _("Description"), 
-            "l"                 => _("Location"), 
-            "labeledURI"        => _("LabeledURL"), 
-            "gotoPrinterPPD"    => _("Printer PPD"),
-            "gotoUserPrinter"   => _("Permissions")) 
-          ));
-  }
-
-
-  /* Delete member */
-  function DelMember($type,$id)
-  {
-    /* Check if there was a printer "dn" given, or the "cn" */
-    foreach($this->member[$type] as $key => $printer){
-      if($printer['dn'] == $id) {
-        $id = $key;
-      }
-    }
-  
-    if(!$this->acl_is_writeable("gotoUserPrinter")){
-      print_red(sprintf(_("You are not allowed to remove the given object '%s' from the list of members of printer '%s'."),$id,$this->dn));
-      return(FALSE);
-    }
-    if(isset($this->member[$type][$id])){
-      unset($this->member[$type][$id]);
-      return(TRUE);
-    }
-    return(FALSE);
-  }
-
-
-  /* Add given obejct to members */
-  function AddMember($type,$dn)
-  {
-    $types = array("AddUser","AddGroup","AddAdminUser","AddAdminGroup");
-    if(!in_array_ics($type, $types)){
-      print_red(sprintf(_("Illegal printer type while adding '%s' to the list of '%s' printers,"),$dn,$type));
-      return(FALSE);
-    }
-
-    if(!$this->acl_is_writeable("gotoUserPrinter")){
-      print_red(sprintf(_("You are not allowed to add the given object '%s' to the list of members of '%s'."),$dn,$this->dn));
-      return(FALSE);
-    }
-
-    /* Get name of index attributes */
-    if(preg_match("/user/i",$type)){
-      $var = "uid";
-    }else{
-      $var = "cn";
-    }
-
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($dn);
-    $ldap->cat($dn,array($var,"cn"));
-    if($ldap->count()){
-
-      $attrs = $ldap->fetch();
-
-      if(isset($attrs[$var][0])){
-        $name = $attrs[$var][0];
-
-        /* Check if this uid/cn is already assigned to any permission */
-        foreach($types as $ctype){
-
-          /* If we want to add a user, only check user/userAdmin members */
-          if((preg_match("/user/i",$type)) && (!preg_match("/user/i",$ctype))){
-            continue;
-          }
-
-          /* If we want to add a group, only check groups/adminGroups .. */
-          if((preg_match("/group/i",$type)) && (!preg_match("/group/i",$ctype))){
-            continue;
-          }
-
-          if(isset(  $this->member[$ctype][$name])){
-            print_red(sprintf(_("Can't add '%s' to the list of members, it is already used."),$attrs[$var][0]));
-            return(FALSE);
-          }
-        }
-
-        /* Everything is fine. So add the given object to members */
-        $this->member[$type][$attrs[$var][0]] = $attrs ;
-      }else{
-        print_a($attrs);
-      }
-    }else{
-      print_red(sprintf(_("Can't add '%s' to list of members, it is not reachable."),$dn));
-      return(FALSE);
-    }
-    return(TRUE);
-  }
-
-
-   /* Display generic part for server copy & paste */
-  function getCopyDialog()
-  {
-    $vars = array("cn");
-    $smarty = get_smarty();
-    $smarty->assign("cn" ,$this->cn);
-    $smarty->assign("object","printer");
-    $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE));
-    $ret = array();
-    $ret['string'] = $str;
-    $ret['status'] = "";
-    return($ret);
-  }
-
-
-  function saveCopyDialog()
-  {
-    if(isset($_POST['cn'])){
-      $this->cn = $_POST['cn'];
-    }
-  }
-
-  function PrepareForCopyPaste($source)
-  {
-    plugin::PrepareForCopyPaste($source);
-    if(isset($source['macAddress'][0])){
-      $this->netConfigDNS->macAddress = $source['macAddress'][0];
-    }
-    if(isset($source['ipHostNumber'][0])){
-      $this->netConfigDNS->ipHostNumber = $source['ipHostNumber'][0];
-    }
-
-    $source_o = new printgeneric($this->config,$source['dn'],NULL,$this->parent);
-    foreach($this->attributes as $attr){
-      $this->$attr = $source_o->$attr;
-    }
-    $this->member = $source_o -> member;
-
-    $this->gotoPrinterPPD = "";
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_selectUserToPrinterDialog.inc b/plugins/admin/systems/class_selectUserToPrinterDialog.inc
deleted file mode 100644 (file)
index 1f110e3..0000000
+++ /dev/null
@@ -1,198 +0,0 @@
-<?php
-
-class selectUserToPrinterDialog 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 $regex                = "*";
-  var $subtree              = FALSE;
-  var $depselect            = "/";
-  var $deplist              = "/";
-
-  var $searchObjects        = "";
-  var $searchAttrs          = "";
-  var $searchAppend         = "";
-  var $baseAddition         = "";
-  var $type                 = "";
-  var $search_cat           = ""; 
-  function selectUserToPrinterDialog (&$config, $dn= NULL,$type=false )
-  {
-    plugin::plugin ($config, $dn);
-    $this->depselect = $this->config->current['BASE'];
-
-    switch($type){
-      case "AddUser" : 
-        $this->searchObjects = "(objectClass=gosaAccount)(!(uid=*$))";
-        $this->searchAttrs   = array("cn","uid");
-        $this->searchAppend  = "uid"; 
-        $this->baseAddition  = get_people_ou(); 
-        $this->search_cat    = "users";
-          ;break;
-      case "AddGroup" :
-        $this->searchObjects = "(objectClass=posixGroup)";
-        $this->searchAttrs   = array("cn","description");
-        $this->searchAppend  = "cn"; 
-        $this->baseAddition  = get_groups_ou(); 
-        $this->search_cat    = "groups";
-          ;break;
-      case "AddAdminUser" : 
-        $this->searchObjects = "(objectClass=gosaAccount)(!(uid=*$))";
-        $this->searchAttrs   = array("cn","uid");
-        $this->searchAppend  = "uid"; 
-        $this->baseAddition  = get_people_ou(); 
-        $this->search_cat    = "users";
-          ;break;
-      case "AddAdminGroup" :
-        $this->searchObjects = "(objectClass=posixGroup)";
-        $this->searchAttrs   = array("cn","description");
-        $this->searchAppend  = "cn"; 
-        $this->baseAddition  = get_groups_ou(); 
-        $this->search_cat    = "groups";
-          ;break;
-    }
-    $this->type = $type;
-
-  }
-
-  function execute()
-  {
-       /* Call parent execute */
-       plugin::execute();
-
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-    $display= "";
-
-    if(isset($_POST['dialogissubmitted'])){
-      $this->regex=$_POST['regexPrinter'];
-      $this->depselect = $_POST['depselectPrinter'];
-    }
-    $this->subtree= isset($_POST['SubSearch']);
-
-    if((isset($_GET['search']))&&(!empty($_GET['search']))){
-      $this->regex=$_GET['search']."*";
-      $this->regex=preg_replace("/\*\*/","*",$this->regex);
-    }
-
-
-    /* Get all departments within this subtree */
-    $base = $this->config->current['BASE'];
-    $deps_res[] = array("dn"=>$this->config->current['BASE']);
-    $deps_res= array_merge($deps_res,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", array("users","groups"), $this->config->current['BASE'],
-                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
-
-    /* Load possible departments */
-    $ui     = get_userinfo();
-  
-    /* Allowed user departments */
-    $udeps  = $ui->get_module_departments("users");
-
-    /* Allowed groups department */
-    $gdeps  = $ui->get_module_departments("groups");
-
-    /* Combine both arrays */
-    $tdeps  = array_unique(array_merge($udeps,$gdeps));
-
-    /* Create usable departments array */
-    $ids = $this->config->idepartments;
-    $deps = array();
-    foreach($deps_res as $dep){
-      if(isset($ids[$dep['dn']]) && in_array_ics($dep['dn'], $tdeps)){
-        $value = $ids[$dep['dn']];
-        $deps[$dep['dn']] = $value;
-      }
-    }
-    if(!isset($deps[$this->depselect])){
-      $this->depselect = key($deps);
-    }
-
-
-
-    $tmp_printers= $this->getPrinter();
-    natcasesort($tmp_printers);
-    $smarty->assign("regexPrinter"        , $this->regex);
-    $smarty->assign("deplistPrinter"      , $deps);;//deplist);
-    $smarty->assign("depselectPrinter"    , $this->depselect);
-    $smarty->assign("gotoPrinters"        , $tmp_printers);
-    $smarty->assign("gotoPrinterKeys"     , array_flip($tmp_printers));
-    $smarty->assign("apply"               , apply_filter());
-    $smarty->assign("alphabet"            , generate_alphabet());
-    $smarty->assign("search_image"        , get_template_path('images/search.png'));
-    $smarty->assign("tree_image"          , get_template_path('images/tree.png'));
-    $smarty->assign("infoimage"           , get_template_path('images/info.png'));
-    $smarty->assign("launchimage"         , get_template_path('images/small_filter.png'));
-    $smarty->assign("deplist"             , $deps);
-    $smarty->assign("subtree", $this->subtree?"checked":"");
-
-    $display.= $smarty->fetch(get_template_path('selectUserToPrinterDialog.tpl', TRUE,dirname(__FILE__)));
-    return($display);
-  }
-
-  function check(){
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    if(empty($_POST['gotoPrinter'])){
-      $message[] = _("Please select a printer or press cancel.");
-    }
-    return $message;
-  }
-
-  /* Save to LDAP */
-  function save()
-  {
-    $a_return['type']=$this->type;
-    
-    foreach($_POST['gotoPrinter'] as $name){
-      $data = $this->getPrinter(true);
-      $a_return[$name]= $data[$name];
-    }
-    return($a_return);
-  }
-
-  /* This function generates the Printerlist
-   * All printers are returned that match regex and and depselect
-   */
-  function getPrinter($detailed = false)
-  {
-    $a_return=array();
-
-    $filter = "(&".$this->searchObjects."(cn=".$this->regex."))";
-    $base   = $this->baseAddition.$this->depselect;
-    $attrs  = $this->searchAttrs;
-    $cat    = $this->search_cat;
-
-    if ($this->subtree){
-      $res= get_list($filter,$cat,$this->depselect,$attrs, GL_SUBSEARCH);
-    } else {
-      $res= get_list($filter,$cat,$base,$attrs);
-    }
-    foreach($res as $printer){
-      if(($detailed ==true)){
-        if(isset($printer[$this->searchAppend])){
-          $a_return[$printer[$this->searchAppend][0]] = $printer;
-        }
-      }else{
-        if(isset($printer[$this->searchAppend])){
-          if(isset($printer['description'][0])){
-            $a_return[$printer[$this->searchAppend][0]] = $printer['cn'][0]." - ".$printer['description'][0]; 
-          }else{
-            $a_return[$printer[$this->searchAppend][0]] = $printer['cn'][0];
-          }
-        }
-      }
-    }
-    return($a_return);
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_servGeneric.inc b/plugins/admin/systems/class_servGeneric.inc
deleted file mode 100644 (file)
index 9d29f5e..0000000
+++ /dev/null
@@ -1,444 +0,0 @@
-<?php
-
-class servgeneric extends plugin
-{
-  /* 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");
-
-  /* Generic terminal attributes */
-  var $ignore_account= TRUE;
-  var $interfaces= array();
-
-  /* Needed values and lists */
-  var $base= "";
-  var $cn= "";
-  var $l= "";
-  var $description= "";
-  var $orig_dn= "";
-  var $didAction= FALSE;
-
-  /* attribute list for save action */
-  var $attributes= array("cn", "description","gotoMode");
-  var $objectclasses= array("top", "GOhard", "goServer");
-
-  var $gotoMode= "locked";
-
-  var $netConfigDNS;
-  var $modes = array();
-  var $ui   ;
-  var $mapActions   = array("reboot"          => "",
-                            "instant_update"  => "softupdate",
-                            "localboot"       => "localboot",
-                            "update"          => "sceduledupdate",
-                            "reinstall"       => "install",
-                            "rescan"          => "",
-                            "memcheck"        => "memcheck",
-                            "sysinfo"         => "sysinfo");
-
-  var $fai_activated  =FALSE;
-  var $view_logged = FALSE;
-
-  function servgeneric (&$config, $dn= NULL, $parent= NULL)
-  {
-    /* Check if FAI is activated */
-    $tmp = $config->search("faiManagement", "CLASS",array('menu','tabs'));
-    
-    if(!empty($tmp)){
-      $this->fai_activated = TRUE;
-    }
-
-    plugin::plugin ($config, $dn, $parent);
-
-    $this->ui = get_userinfo();
-    $this->modes["active"]= _("Activated");
-    $this->modes["locked"]= _("Locked");
-
-    /* Set base */
-    if ($this->dn == "new"){
-      $ui= get_userinfo();
-      $this->base= dn2base($ui->dn);
-      $this->cn= "";
-    } else {
-      $this->base= preg_replace ("/^[^,]+,[^,]+,[^,]+,/", "", $this->dn);
-    }
-    $this->netConfigDNS = new termDNS($this->config,$this,$this->objectclasses);
-    $this->netConfigDNS->set_acl_category("server");
-    $this->netConfigDNS->set_acl_base($this->base);
-       
-    /* Save dn for later references */
-    $this->orig_dn= $this->dn;
-  }
-
-
-  function set_acl_base($base)
-  {
-    plugin::set_acl_base($base);
-    $this->netConfigDNS->set_acl_base($base);
-  }
-
-
-  function set_acl_category($cat)
-  {
-    plugin::set_acl_category($cat);
-    $this->netConfigDNS->set_acl_category($cat);
-  }
-
-
-  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);
-    }
-
-    /* Do we represent a valid server? */
-    if (!$this->is_account && $this->parent === NULL){
-      $display= "<img alt=\"\" src=\"images/stop.png\" align=middle>&nbsp;<b>".
-        _("This 'dn' has no server features.")."</b>";
-      return($display);
-    }
-
-    /* Check for action */
-    if (isset($_POST['action']) && $this->acl_is_writeable("FAIstate")){
-      $cmd = $this->config->search("workgeneric", "ACTIONCMD",array('tabs'));
-      if ($cmd == ""){
-        print_red(_("No ACTIONCMD definition found in your gosa.conf"));
-      } else {
-
-        exec ($cmd." ".$this->netConfigDNS->macAddress." ".escapeshellarg($_POST['saction']), $dummy, $retval);
-        if ($retval != 0){
-          print_red(sprintf(_("Execution of '%s' failed!"), $cmd));
-        } else {
-          $this->didAction= TRUE;
-
-          /* Set FAIstate */
-          if($this->fai_activated && $this->dn != "new"){
-            $ldap = $this->config->get_ldap_link();
-            $ldap->cd($this->config->current['BASE']);
-            $ldap->cat($this->dn,array("objectClass"));
-            $res = $ldap->fetch();
-
-            $attrs = array();
-            $attrs['FAIstate'] = "";
-            if(isset($this->mapActions[$_POST['saction']])){
-              $attrs['FAIstate'] = $this->mapActions[$_POST ['saction']];
-            }
-
-            for($i = 0; $i < $res['objectClass']['count'] ; $i ++){
-              $attrs['objectClass'][] = $res['objectClass'][$i];
-            }
-
-            if(($attrs['FAIstate'] != "") && (!in_array("FAIobject",$attrs['objectClass']))){
-              $attrs['objectClass'][] = "FAIobject";
-            }
-
-            if($attrs['FAIstate'] == ""){
-#FIXME we should check if FAIobject is used anymore
-              $attrs['FAIstate'] = array();
-            }
-
-            $ldap->cd($this->dn);
-            $ldap->modify($attrs);
-          }
-          show_ldap_error($ldap->get_error(), sprintf(_("Saving of system server/generic (FAIstate) with dn '%s' failed."),$this->dn)); 
-        }
-      }
-    }
-
-    /* Base select dialog */
-    $once = true;
-    foreach($_POST as $name => $value){
-      if(preg_match("/^chooseBase/",$name) && $once ){
-        $once = false;
-        $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
-        $this->dialog->setCurrentBase($this->base);
-      }
-    }
-
-    /* Dialog handling */
-    if(is_object($this->dialog)){
-      /* Must be called before save_object */
-      $this->dialog->save_object();
-
-      if($this->dialog->isClosed()){
-        $this->dialog = false;
-      }elseif($this->dialog->isSelected()){
-  
-        /* Only accept allowed bases */
-        $tmp = $this->get_allowed_bases();
-        if($tmp[$this->dialog->isSelected()]){
-          $this->base = $this->dialog->isSelected();
-        }
-        $this->dialog= false;
-      }else{
-        return($this->dialog->execute());
-      }
-    }
-
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translated){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-
-    /* Assign base ACL */
-    $smarty->assign("bases"   , $this->get_allowed_bases());
-
-    /* Assign attributes */
-    foreach ($this->attributes as $attr){
-      $smarty->assign("$attr", $this->$attr);
-    }
-
-    $smarty->assign("staticAddress", "");
-    $smarty->assign("base_select", $this->base);
-
-    /* Assign status */
-    $query= "fping -q -r 1 -t 500 ".$this->cn;
-    exec ($query, $dummy, $retval);
-
-    /* Offline */
-    if ($retval == 0){
-      $smarty->assign("actions", array("halt" => _("Switch off"), "reboot" => _("Reboot"),
-                                       "instant_update" => _("Instant update"),
-                                       "update" => _("Scheduled update"),
-                                       "reinstall" => _("Reinstall"),
-                                       "rescan" => _("Rescan hardware"),
-                                       "memcheck" => _("Memory test"),
-                                       "localboot" => _("Force localboot"),
-                                       "sysinfo"  => _("System analysis")));
-    } else {
-      $smarty->assign("actions", array("wake" => _("Wake up"),
-                                       "reinstall" => _("Reinstall"),
-                                       "update" => _("Scheduled update"),
-                                       "memcheck" => _("Memory test"),
-                                       "localboot" => _("Force localboot"),
-                                       "sysinfo"  => _("System analysis")));
-    }
-
-    /* Show main page */
-    $smarty->assign("fai_activated",$this->fai_activated);
-
-    $str = $this->netConfigDNS->execute();
-    if(is_object($this->netConfigDNS->dialog)){
-      return($str);
-    }
-    $smarty->assign("netconfig", $str);
-    $smarty->assign("modes", $this->modes);
-
-    return($smarty->fetch (get_template_path('server.tpl', TRUE)));
-  }
-
-  function remove_from_parent()
-  {
-    /* Cancel if there's nothing to do here */
-    if ((!$this->initially_was_account) || (!$this->acl_is_removeable())){
-      return;
-    }
-
-    $this->netConfigDNS->remove_from_parent();
-    $ldap= $this->config->get_ldap_link();
-    $ldap->rmdir($this->dn);
-
-    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 system server/generic with dn '%s' failed."),$this->dn)); 
-
-    /* Delete references to object groups */
-    $ldap->cd ($this->config->current['BASE']);
-    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
-    while ($ldap->fetch()){
-      $og= new ogroup($this->config, $ldap->getDN());
-      unset($og->member[$this->dn]);
-      $og->save ();
-    }
-    $this->handle_post_events("remove",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    /* Save current base, to be able to revert to last base, 
-        if new base is invalid or not allowed to be selected */
-    $base_tmp = $this->base;
-    plugin::save_object();
-    $this->netConfigDNS->save_object();
-
-    /* Get base selection */
-    $tmp = $this->get_allowed_bases();
-    if(isset($_POST['base'])){
-      if($tmp[$_POST['base']]){
-        $this->base = $_POST['base'];
-      }else{
-        $this->base = $base_tmp;
-      }
-    }
-  }
-
-
-  /* Check supplied data */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-    $message= array_merge($message, $this->netConfigDNS->check());
-    $this->dn= "cn=".$this->cn.",ou=servers,ou=systems,".$this->base;
-
-    /* must: cn */
-    if ($this->cn == ""){
-      $message[]= _("The required field 'Server name' is not set.");
-    }
-    
-    /* Check if given name is a valid host/dns name */
-    if(!is_dns_name($this->cn)){
-      $message[] = _("Please specify a valid name for this object.");
-    }
-
-    if ($this->orig_dn != $this->dn){
-      $ldap= $this->config->get_ldap_link();
-      $ldap->cd ($this->base);
-      $ldap->search ("(cn=".$this->cn.")", array("cn"));
-      if ($ldap->count() != 0){
-        while ($attrs= $ldap->fetch()){
-          if ($attrs['dn'] != $this->orig_dn){
-            if(!preg_match("/cn=dhcp,/",$attrs['dn']) && !preg_match("/,ou=incoming,/",$attrs['dn']) && preg_match("/,ou=servers,ou=systems,/",$attrs['dn'])){
-              $message[]= sprintf (_("There is already an entry '%s' in the base choosen by you"), $this->cn);
-              break;
-            }
-          }
-        }
-      }
-    }
-
-    return ($message);
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    plugin::save();
-
-    /* Remove all empty values */
-    if ($this->orig_dn == 'new'){
-      $attrs= array();
-      foreach ($this->attrs as $key => $val){
-        if (is_array($val) && count($val) == 0){
-          continue;
-        }
-        $attrs[$key]= $val;
-      }
-      $this->attrs= $attrs;
-    }
-
-    /* Write back to ldap */
-    $ldap= $this->config->get_ldap_link();
-    if ($this->orig_dn == 'new'){
-      $ldap->cd($this->config->current['BASE']);
-      $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
-      $ldap->cd($this->dn);
-      $ldap->add($this->attrs);
-      new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-      $mode= "add";
-    } else {
-   
-      /* cn is not case sensitive for ldap, but for php it is!! */ 
-      if($this->config->current['DNMODE'] == "cn"){
-        if (strtolower($this->orig_dn) != (strtolower($this->dn))){
-          $this->recursive_move($this->orig_dn, $this->dn);
-          plugin::save();
-        }
-      }else{
-        if ($this->orig_dn != $this->dn){
-          $this->recursive_move($this->orig_dn, $this->dn);
-          plugin::save();
-        }
-      }
-  
-      $ldap->cd($this->dn);
-      $this->cleanup();
-      $ldap->modify ($this->attrs); 
-      new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-
-      $mode= "modify";
-    }
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of system server/generic with dn '%s' failed."),$this->dn)); 
-    $this->netConfigDNS->cn = $this->cn;
-    $this->netConfigDNS->save();
-
-    /* Optionally execute a command after we're done */
-    if(!$this->didAction){
-      $this->handle_post_events($mode,array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
-    }
-  }
-
-
-  /* Display generic part for server copy & paste */
-  function getCopyDialog()
-  {
-    $vars = array("cn");
-
-    $smarty = get_smarty();
-    $smarty->assign("cn" ,$this->cn);
-    $smarty->assign("object","server");
-    $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE));
-    $ret = array();
-    $ret['string'] = $str;
-    $ret['status'] = "";
-    return($ret);
-  }
-
-
-  function saveCopyDialog()
-  {
-    if(isset($_POST['cn'])){
-      $this->cn = $_POST['cn'];
-    }
-  }
-
-  
-  function PrepareForCopyPaste($source)  
-  {
-    plugin::PrepareForCopyPaste($source);
-    if(isset($source['macAddress'][0])){
-      $this->netConfigDNS->macAddress = $source['macAddress'][0];
-    }
-    if(isset($source['ipHostNumber'][0])){
-      $this->netConfigDNS->ipHostNumber = $source['ipHostNumber'][0];
-    }
-
-  }
-  
-
-
-  /* Return plugin informations for acl handling */ 
-  static function plInfo()
-  {
-    return (array( 
-          "plShortName"   => _("Generic"),
-          "plDescription" => _("Server generic"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 1,
-          "plSection"     => array("administration"),           
-          "plCategory"    => array("server" => array("description"  => _("Server"),
-                                                     "objectClass"  => "goServer")),
-          "plProvidedAcls"=> array(
-            "cn"           => _("Name"),
-            "description"  => _("Description"),
-            "gotoMode"     => _("Goto mode"),
-            "base"         => _("Base"),
-            "FAIstate"     => _("Action flag"))
-          ));
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_serverService.inc b/plugins/admin/systems/class_serverService.inc
deleted file mode 100644 (file)
index 338052b..0000000
+++ /dev/null
@@ -1,442 +0,0 @@
-<?php
-
-define("START_SERVICE",1);
-define("STOP_SERVICE",2);
-define("RESTART_SERVICE",3);
-
-define("SERVICE_STOPPED",_("Stop"));
-define("SERVICE_STARTED",_("Start"));
-define("SERVICE_RESTARTED",_("Restart"));
-
-define("ALL_SERVICES",100);
-
-class ServerService extends plugin
-{
-  /* CLI vars */
-  var $cli_summary      = "Manage server services";
-  var $cli_description  = "Managing services by adding,removing and configuring services. Allows to start/stop used services.";
-  var $cli_parameters   = array("config"=>"Config object" , "dn"=>"Object dn");
-
-  /* attribute list for save action */
-  var $ignore_account   = TRUE;
-  var $attributes       = array();
-  var $objectclasses    = array();
-
-  var $divList          = NULL;
-
-  var $plugins          = array();
-  var $pluign_names     = array();
-
-  var $current          = "";
-  var $backup           = NULL;
-  var $acl              ;
-  var $cn;
-
-  function ServerService (&$config, $dn)
-  {
-    plugin::plugin($config);
-    $this->dn= $dn;
-    foreach ($config->data['TABS']['SERVERSERVICE'] as $plug){
-      $name= $plug['CLASS'];
-      $this->plugin_names[]= $name;
-      $this->plugins[$name]= new $name($config, $dn);
-      /* Capture all service objectClases, necessary for acl handling */ 
-      if(isset($this->plugins[$name]->objectclasses)){
-        foreach($this->plugins[$name]->objectclasses as $oc){
-          $this->objectclasses[] = $oc;
-        }
-      }
-    }
-    $this->divList = new divListSystemService($config,$this);
-       }
-
-  function set_acl_base($base)
-  {
-    plugin::set_acl_base($base);
-    foreach($this->plugins as $name => $obj){
-      $this->plugins[$name]->set_acl_base($base);
-    }
-  }
-
-  function set_acl_category($category)
-  {
-    plugin::set_acl_category($category);
-    foreach($this->plugins as $name => $obj){
-      $this->plugins[$name]->set_acl_category($category);
-    }
-  }
-
-  function execute()
-  {
-    /* Variable initialisation */  
-    $s_action = "";
-    $s_entry  = "";
-
-    /* Walk through posts and check if there are some introductions for us */
-    $PossiblePosts = array("addNewService"  => "", 
-                           "startServices"  => "",
-                           "stopServices"   => "",
-                           "restartServices"  => "",
-                           "removeServices" => "",
-
-                           "StartSingleService"  => "/^StartSingleService_(.*)_[xy]$/",
-                           "StopSingleService"   => "/^StopSingleService_(.*)_[xy]$/",
-                           "RestartSingleService"  => "/^RestartSingleService_(.*)_[xy]$/",
-                           "RemoveSingleService" => "/^RemoveSingleService_(.*)_[xy]$/",
-                           "EditSingleService"   => "/^EditSingleService_(.*)_[xy]$/");
-
-  
-    $once = true;
-    foreach($_POST as $name => $value){
-      foreach($PossiblePosts as $pregCheck => $idPreg) {
-        if(preg_match("/^".$pregCheck."/",$name) && $once){
-          $once     = false;
-          $s_action = $pregCheck;
-          
-          if(!empty($idPreg)){
-            $s_entry = preg_replace($idPreg,"\\1",$name);
-          }
-        }
-      }
-    }
-
-
-    /* Handle state changes for services */
-    $map =  array(    "startServices"         => array("type" => START_SERVICE ,   "service" => ALL_SERVICES),
-                      "stopServices"          => array("type" => STOP_SERVICE  ,   "service" => ALL_SERVICES),
-                      "restartServices"       => array("type" => RESTART_SERVICE , "service" => ALL_SERVICES),                 
-                      "StartSingleService"    => array("type" => START_SERVICE ,   "service" => $s_entry),
-                      "StopSingleService"     => array("type" => STOP_SERVICE ,    "service" => $s_entry),
-                      "RestartSingleService"  => array("type" => RESTART_SERVICE , "service" => $s_entry));
-    if(isset($map[$s_action])){
-      $type     = $map[$s_action]['type'];
-      $service  = $map[$s_action]['service'];
-      $this->ServiceStatusUpdate($type,$service);
-    }
-
-    /* Handle actions linked via href */
-    if(isset($_GET['act']) && $_GET['act'] == "open" && isset($_GET['id'])){
-      $id = $_GET['id'];
-      if(isset($this->plugins[$id])){
-        $s_entry = $id;
-        $s_action = "EditSingleService";
-      } 
-    }
-
-    /* Open service add dialog */
-    if($s_action == "addNewService"){
-      $this->dialog = new ServiceAddDialog($this->config,$this->dn,$this);
-    }
-
-
-    /* Remove service */
-    if($s_action == "RemoveSingleService"){
-
-      /* Create resetted obj */
-      $new_obj = new $s_entry($this->config,$this->dn);
-      $new_obj -> set_acl_base($this->acl_base);
-      $new_obj -> set_acl_category(preg_replace("/\/$/","",$this->acl_category));
-      $tmp     = $new_obj->getListEntry();
-
-      if($tmp['AllowRemove']){
-
-        /* Check if we are allowed to remove this service
-         */
-        $str = $this->plugins[$s_entry]->allow_remove();
-
-        if(empty($str)){
-          $this->plugins[$s_entry] = $new_obj;
-          $this->plugins[$s_entry]->is_account = false;
-        }else{
-          print_red($str);
-        }
-      }
-    }
-
-
-    /* Edit a service and make a backup from all attributes, 
-       to be able to restore old values after aborting dialog */ 
-    if($s_action == "EditSingleService"){
-      $this->backup   = get_object_vars($this->plugins[$s_entry]);
-      $this->dialog   = $this->plugins[$s_entry];
-      $this->current  = $s_entry;
-    }
-
-   
-    /* Abort service add */
-    if(isset($_POST['CancelServiceAdd'])){
-      $this->dialog   = FALSE;
-      $this->backup   = NULL;
-      $this->current  = "";
-    }
-
-    /* Abort dialog 
-       Restore vars with values before editing */
-    if(isset($_POST['CancelService']) && !empty($this->current)){
-      if($this->backup == NULL){
-        $this->plugins[$this->current] = new $this->current($this->config,$this->dn);
-        $this->plugins[$this->current]-> set_acl_base($this->acl_base);
-        $this->plugins[$this->current]-> set_acl_category(preg_replace("/\/$/","",$this->acl_category));
-
-      }else{
-        foreach($this->backup as $name => $value){
-          $this->plugins[$this->current]->$name = $value;
-        }
-      }
-      $this->dialog   = FALSE;
-      $this->backup   = NULL;
-      $this->current  = ""; 
-    }
-  
-
-    /* Abort dialog */
-    if(isset($_POST['SaveService']) && is_object($this->dialog)){
-      $this->dialog->save_object();
-      $msgs = $this->dialog->check();
-      if(count($msgs)){
-        foreach($msgs as $msg){
-          print_red($msg);
-        }
-      }else{
-        $this->plugins[$this->current] = $this->dialog;
-        $tmp  = get_object_vars($this->dialog);
-        foreach($tmp as $name => $value){
-          $this->plugins[$this->current]->$name = $value;
-        }
-        $this->current = "";
-        $this->dialog = FALSE;
-        $this->backup = NULL;
-      }
-    }
-
-
-    /* Abort dialog */
-    if((isset($_POST['SaveServiceAdd'])) && (!empty($_POST['ServiceName']))){
-      $serv = $_POST['ServiceName'];    
-      $this->plugins[$serv]->is_account = true;
-      $this->dialog  = $this->plugins[$serv];
-      $this->current = $serv;
-    }
-
-
-    /* There is currently a subdialog open, display this dialog */
-    if(is_object($this->dialog)){
-      $this->dialog->save_object();
-      return($this->dialog->execute());
-    }
-
-
-    /* Dispaly services overview */
-    $this->divList->execute();
-    $list = array();
-
-    foreach($this->plugins as $name => $obj){
-      if($obj->is_account){
-        $list[$name] = $this->plugins[$name]->getListEntry(); 
-      }
-    }
-    $this->divList -> setEntries($list);
-    return("<table style='width:100%;'><tr><td>".$this->divList->Draw()."</td></tr></table>");
-  }
-
-
-  /* Get all used services 
-      CLASSNAME => _($this->plugins[*]->DisplayName);   */
-  function getAllUsedServices()
-  {
-    $ret = array();
-    foreach($this->plugins as $name => $obj){
-      if($obj->is_account){
-        if(isset($obj->DisplayName)){
-          $ret[$name] = $obj->DisplayName;
-        }else{
-          $ret[$name] = $name;
-        }
-      }
-    }
-    return($ret);
-  }
-
-
-  /* Get all unused services 
-      CLASSNAME => _($this->plugins[*]->DisplayName);  */
-  function getAllUnusedServices()
-  {
-    $tmp = $this->getAllUsedServices();
-    $pool_of_ocs =array();
-    foreach($tmp as $name => $value){
-      if(isset($this->plugins[$name]->conflicts)){
-        $pool_of_ocs[]= get_class($this->plugins[$name]);
-      }
-    }
-   
-    $ret = array();
-    foreach($this->plugins as $name => $obj){
-
-      /* Skip all pluigns that will lead into conflicts */
-      $skip = false;
-      if(isset($obj->conflicts)){
-        foreach($obj->conflicts as $oc){
-          if(in_array_ics($oc,$pool_of_ocs)){
-            $skip = true;
-          }
-        }
-      }
-
-      /* Only show createable services */
-      if(!$obj->acl_is_createable()){
-        $skip = true;
-      }
-
-      if(!$skip){
-        if(isset($obj->DisplayName)){
-          $ret[$name] = $obj->DisplayName;
-        }else{
-          $ret[$name] = $name;
-        }
-      }
-    }
-    return($ret);
-  }
-  /* This function sets the status var for each used 
-     service && calls an external hook if specified in gosa.conf*/
-  function ServiceStatusUpdate($method , $service)
-  {
-    /* Skip if this is a new server */
-    if($this->dn == "new"){
-      print_red(_("Can't set status while this server is not saved."));
-      return;
-    }
-
-    $action = "";
-    if($method == START_SERVICE){
-      $action = SERVICE_STARTED;
-    }elseif($method== STOP_SERVICE){
-      $action = SERVICE_STOPPED;
-    }elseif($method == RESTART_SERVICE){
-      $action = SERVICE_RESTARTED;
-    }else{
-      print_red(sprintf(_("The specified method '%s' can't executed for services."),$action));
-      return;
-    }
-    
-    $caseVars = array("cn","dn");
-    if($service == ALL_SERVICES){
-      foreach($this->plugins as $name => $obj){
-        foreach($caseVars as $var){
-          if(isset($this->$var)){
-            $this->plugins[$name]->$var = $this->$var;  
-          }
-        }
-
-        /* check if services can be restarted */
-        $map =array(SERVICE_STARTED=> "AllowStart" ,
-                    SERVICE_STOPPED => "AllowStop",
-                    SERVICE_RESTARTED => "AllowRestart");
-
-        /* get plugins informations, restart/start/stop actions allowed ?*/
-        $tmp = $this->plugins[$name]->getListEntry();
-
-        /* Check if given action is allowed for this service */
-        if($tmp[$map[$action]]){
-          if($this->plugins[$name]->initially_was_account && $this->plugins[$name]->is_account){
-            $this->plugins[$name]->setStatus($action);
-          }
-        }
-      }
-    }else{
-      foreach($caseVars as $var){
-        if(isset($this->$var)){
-          $this->plugins[$service]->$var = $this->$var;  
-        }
-      }
-      if($this->plugins[$service]->is_account){
-        $this->plugins[$service]->setStatus($action);
-      }
-    }
-  }
-
-
-  function check()
-  {
-    $message = plugin::check();
-    return $message;
-  }
-
-
-  function save_object()
-  {
-    foreach($this->plugins as $name => $obj){
-      if($obj->is_account){
-        $this->plugins[$name]->save_object();
-      }
-    }
-  }
-
-
-  function remove_from_parent()
-  {
-    $caseVars = array("cn","dn");
-    foreach($this->plugins as $name => $obj){
-      foreach($caseVars as $var){
-        if(isset($this->$var)){
-          $this->plugins[$name]->$var = $this->$var;  
-        }
-      }
-      if($this->plugins[$name]->initially_was_account){
-        $this->plugins[$name]->remove_from_parent();
-      }
-    }
-  }
-
-
-  function save()
-  {
-    $caseVars = array("cn","dn");
-    foreach($this->plugins as $name => $obj){
-
-      foreach($caseVars as $var){
-        if(isset($this->$var)){
-          $this->plugins[$name]->$var = $this->$var;
-        }
-      }
-
-      if($this->plugins[$name]->is_account){
-        $this->plugins[$name]->save();
-      }else{
-        if($this->plugins[$name]->initially_was_account){
-          $this->plugins[$name]->remove_from_parent();
-        }
-      }
-    }
-  }
-
-  
-  function PrepareForCopyPaste($source)
-  {
-    plugin::PrepareForCopyPaste($source);
-
-    foreach($this->plugins as $name => $plugin){
-      $this->plugins[$name]->PrepareForCopyPaste($source);
-    }
-  }
-
-
-  /* Check if all plugins allow a remove ..  */
-  function allow_remove()
-  {
-    foreach($this->plugins as $name => $obj){
-      $str = $obj->allow_remove();
-      if(!empty($str)){
-        return($str);
-      }
-    }
-  }
-  
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_systemManagement.inc b/plugins/admin/systems/class_systemManagement.inc
deleted file mode 100644 (file)
index 60a577e..0000000
+++ /dev/null
@@ -1,1398 +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 systems extends plugin
-{
-  /* Definitions */
-  var $plHeadline     = "Systems";
-  var $plDescription  = "This does something";
-  var $departments    = array();
-
-  /* Dialog attributes */
-  var $systab   = NULL;
-  var $terminals= array();
-  var $ui       = NULL;
-  var $DivListSystem;
-  var $start_pasting_copied_objects = FALSE;
-  var $CopyPasteHandler   = NULL;
-
-  /* Arp hanlding activated */
-  var $arp_handling_active = FALSE;
-
-  function systems (&$config, $ui)
-  {
-    /* Save configuration for internal use */
-    $this->config= $config;
-    $this->ui= $ui;
-
-    /* Creat dialog object */
-    $this->DivListSystem = new divListSystem($this->config,$this);
-
-    /* Copy & Paste enabled ?*/
-    if((isset($this->config->data['MAIN']['ENABLECOPYPASTE']))&&(preg_match("/true/i",$this->config->data['MAIN']['ENABLECOPYPASTE']))){
-      $this->CopyPasteHandler = new CopyPasteHandler($this->config);
-    }
-
-    /* Check whether the arp handling active or not */
-    if($this->config->search("ArpNewDevice","CLASS",array('tabs')) != ""){
-      $this->arp_handling_active = TRUE;
-    }
-
-  }
-
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    $_SESSION['LOCK_VARS_TO_USE'] = array("/^system_edit_/i","/^system_del_/","/^act/","/^id/","/^item_selected/","/^remove_multiple_systems/");
-
-    /********************
-      Check for functional posts, edit|delete|add|... system devices 
-     ********************/
-    $s_action     = "";                       // Contains the action to proceed
-    $s_entry      = "";                       // The value for s_action
-    $base_back    = "";                       // The Link for Backbutton
-    $smarty       = get_smarty();
-
-    /* Test Posts */
-    foreach($_POST as $key => $val){
-      // Post for delete
-      if(preg_match("/system_del.*/",$key)){
-        $s_action = "del";
-        $s_entry  = preg_replace("/system_del_/i","",$key);
-        // Post for edit
-      }elseif(preg_match("/system_edit_.*/",$key)){
-        $s_action="edit";
-        $s_entry  = preg_replace("/system_edit_/i","",$key);
-        // Post for new
-      }elseif(preg_match("/system_new.*/",$key)){
-        $s_action="new";
-      }elseif(preg_match("/system_tplnew.*/i",$key)){
-        $s_action="new_tpl";
-      }elseif(preg_match("/system_setpwd_.*/i",$key)){
-        $s_action="change_pw";
-        $s_entry  = preg_replace("/system_setpwd_/i","",$key);
-      }elseif(preg_match("/gen_cd_.*/i",$key)){
-        $s_action="gen_cd";
-        $s_entry  = preg_replace("/gen_cd_/i","",$key);
-      }elseif(preg_match("/^copy_.*/",$key)){
-        $s_action="copy";
-        $s_entry  = preg_replace("/^copy_/i","",$key);
-      }elseif(preg_match("/^cut_.*/",$key)){
-        $s_action="cut";
-        $s_entry  = preg_replace("/^cut_/i","",$key);
-      }
-    }
-   
-    /* Incoming handling  
-     * If someone made a systemtype and ogroup selection 
-     * Display the new requested entry type ... servtab  in case of server and so on.
-     */
-    if(isset($_POST['SystemTypeChoosen'])){
-      $s_action = "SelectedSystemType";
-      $s_entry  = $_POST['SystemType'];
-      $_SESSION['SelectedSystemType']['ogroup'] = $_POST['ObjectGroup'];
-      $this->systab = NULL;
-    }
-
-    /* remove image tags from posted entry  (posts looks like this 'name_x')*/
-    $s_entry  = preg_replace("/_.$/","",$s_entry);
-
-    /* Edit was requested by pressing the name(link) of an item */
-    if((isset($_GET['act']))&&($_GET['act']=="edit_entry")){
-      $s_action ="edit";
-      $s_entry  = $_GET['id'];
-    }
-    /* Create options */
-    if(isset($_POST['menu_action']) && preg_match("/^newsystem_/",$_POST['menu_action'])){
-      $s_action = "newsystem";
-      $s_entry  = preg_replace("/^newsystem_/","",$_POST['menu_action']);
-    }
-
-    /* handle C&P from layers menu */
-    if(isset($_POST['menu_action']) && preg_match("/^multiple_copy_systems/",$_POST['menu_action'])){
-      $s_action = "copy_multiple";
-    }
-    if(isset($_POST['menu_action']) && preg_match("/^multiple_cut_systems/",$_POST['menu_action'])){
-      $s_action = "cut_multiple";
-    }
-    if(isset($_POST['menu_action']) && preg_match("/^editPaste/",$_POST['menu_action'])){
-      $s_action = "editPaste";
-    }
-
-    /* handle remove from layers menu */
-    if(isset($_POST['menu_action']) && preg_match("/^remove_multiple/",$_POST['menu_action'])){
-      $s_action = "del_multiple";
-    }
-    
-
-    /* Check for exeeded sizelimit */
-    if (($message= check_sizelimit()) != ""){
-      return($message);
-    }
-
-    /* Try to get informations about what kind of system to create */
-    if ($s_action=="new") {
-      return ($smarty->fetch(get_template_path('chooser.tpl', TRUE)));
-    }
-
-
-    /********************
-      Copy & Paste Handling  ...
-     ********************/
-
-    /* Display the copy & paste dialog, if it is currently open */
-    $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
-    if($ret){
-      return($ret);
-    }
-  
-
-    /********************
-      Create FAI CD ...   
-     ********************/
-    if ($s_action=="gen_cd"){
-      $this->dn= $this->terminals[$s_entry]['dn'];
-      $_SESSION['objectinfo']= $this->dn;
-      return ($smarty->fetch(get_template_path('gencd.tpl', TRUE)));
-    }
-
-
-    /* Start CD-Creation */
-    if ((isset($_POST["cd_create"])) && !empty($this->dn)){
-      $smarty->assign("src", "?plug=".$_GET['plug']."&amp;PerformIsoCreation");
-      return ($smarty->fetch(get_template_path('gencd_frame.tpl', TRUE)));
-    }
-
-
-    if ($this->dn != "" && isset($_GET['PerformIsoCreation'])){
-
-      $return_button   = "<form method='get' action='main.php' target='_parent'>
-        <input type='submit' value='"._("Back")."'>
-        <input type='hidden' name='plug' value='".$_GET['plug']."'/>
-        </form>";
-
-      $dsc             = array(0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w"));
-
-      /* Get and check command */
-      $command= $this->config->search("workgeneric", "ISOCMD",array('tabs'));
-      
-      if (check_command($command)){
-        @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, "Execute");
-
-        /* Print out html introduction */
-        echo '  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
-          <html>
-          <head>
-          <title></title>
-          <style type="text/css">@import url("themes/default/style.css");</style>
-          <script language="javascript" src="include/focus.js" type="text/javascript"></script>
-          </head>
-          <body style="background: none; margin:4px;" id="body" >
-          <pre>';
-
-        /* Open process handle and check if it is a valid process */
-        $process= proc_open($command." '".$this->dn."'", $dsc, $pipes);
-        if (is_resource($process)) {
-          fclose($pipes[0]);
-
-          /* Print out returned lines && write JS to scroll down each line */
-          while (!feof($pipes[1])){
-            $cur_dat = fgets($pipes[1], 1024);
-            echo $cur_dat;
-            echo '<script language="javascript" type="text/javascript">scrollDown2();</script>' ;
-            flush();
-          }
-        }
-
-        /* Get error string && close streams */
-        $buffer= stream_get_contents($pipes[2]);
-
-        fclose($pipes[1]);
-        fclose($pipes[2]);
-        echo "</pre>";
-
-        /* Check return code */
-        $ret= proc_close($process);
-        if ($ret != 0){
-          echo "<h1 style='color:red'>"._("Creating the image failed. Please see the report below.")."</h1>";
-          echo "<pre style='color:red'>$buffer</pre>";
-        }
-
-
-
-        echo $return_button."<br>";
-
-      } else {
-        $tmp= "<h1 style='color:red'>".sprintf(_("Command '%s', specified for ISO creation doesn't seem to exist."), $command)."</h1>";
-        echo $tmp;
-      }
-
-      /* Scroll down completly */
-      echo '<script language="javascript" type="text/javascript">scrollDown2();</script>' ;
-      echo '</body></html>';
-      flush();
-      exit;
-    }
-
-
-    /********************
-      Create new system ...   
-     ********************/
-    /* Create new default terminal 
-     * Or create specified object of selected system type, from given incoming object  
-     */
-
-    $save_object_directly = false;
-    if(($s_action == "SelectedSystemType") && (isset($_POST['ObjectGroup']) && ($_POST['ObjectGroup'] != "none"))){
-      $save_object_directly = true;
-    }
-
-    if (isset($_POST['create_system'])||$s_action=="newsystem"||$s_action == "SelectedSystemType") {
-
-      /* If the current entry is an incoming object 
-       * $sw = System type as posted in new incoming handling dialog 
-       */ 
-      if($s_action == "SelectedSystemType") {
-        $sw         = $s_entry;
-      }else{
-        if(isset($_POST['system'])){
-          $sw = $_POST['system'];
-        }else{
-          $sw = $s_entry;
-        }
-        $this->dn= "new";
-      }
-
-      $tabs = array(
-          "terminal"    => array("CLASS"=>"TERMTABS",     "TABNAME"=>"termgeneric",     "TABCLASS" =>"termtabs",      "ACL"=> "terminal"),
-          "workstation" => array("CLASS"=>"WORKTABS",     "TABNAME"=>"workgeneric",     "TABCLASS" =>"worktabs",      "ACL"=> "workstation"),
-          "server"      => array("CLASS"=>"SERVTABS",     "TABNAME"=>"servgeneric",     "TABCLASS" =>"servtabs",      "ACL"=> "server"),
-          "printer"     => array("CLASS"=>"PRINTTABS",    "TABNAME"=>"printgeneric",    "TABCLASS" =>"printtabs",     "ACL"=> "printer"),
-          "phone"       => array("CLASS"=>"PHONETABS",    "TABNAME"=>"phoneGeneric",    "TABCLASS" =>"phonetabs",     "ACL"=> "phone"),
-          "component"   => array("CLASS"=>"COMPONENTTABS","TABNAME"=>"componentGeneric","TABCLASS" =>"componenttabs", "ACL"=> "component"));
-
-      if(isset($tabs[$sw])){
-        $class    = $tabs[$sw]["CLASS"];
-        $tabname  = $tabs[$sw]["TABNAME"];
-        $tabclass = $tabs[$sw]["TABCLASS"];
-        $acl_cat  = $tabs[$sw]["ACL"];
-
-        /* Load permissions for selected 'dn' and check if
-           we're allowed to remove this 'dn' */
-        $ui       = get_userinfo();
-        $tabacl   = $ui->get_permissions($this->DivListSystem->selectedBase,$acl_cat."/".$tabname);
-        if(preg_match("/c/",$tabacl)){
-          $this->systab= new $tabclass($this->config, $this->config->data['TABS'][$class], $this->dn,$sw);
-          $this->systab->set_acl_base($this->DivListSystem->selectedBase);
-          $this->systab->by_object[$tabname]->base = $this->DivListSystem->selectedBase;
-          $this->systab->base = $this->DivListSystem->selectedBase;
-        }else{
-          print_red(_("You are not allowed to create a new object of this type."));
-        }
-      }
-    }
-
-    /********************
-      Edit system ...   
-     ********************/
-
-    /* User wants to edit data? */
-    if (($s_action == "edit") && (!isset($this->systab->config))){
-
-      $this->dn= $this->terminals[$s_entry]['dn'];
-
-      /* Check locking, save current plugin in 'back_plugin', so
-         the dialog knows where to return. */
-      if (($user= get_lock($this->dn)) != ""){
-        return(gen_locked_message ($user, $this->dn));
-      }
-
-      /* Find out more about the object type */
-      $ldap= $this->config->get_ldap_link();
-      $ldap->cat($this->dn, array('objectClass','gotoMode'));
-      $attrs= $ldap->fetch();
-      $type= $this->get_system_type($attrs);
-
-      /* Lock the current entry, so everyone will get the
-         above dialog */
-      $tabs = array(
-          "terminal"    => array("CLASS"=>"TERMTABS",     "TABCLASS" =>"termtabs",      "ACL"=> "terminal"),
-          "workstation" => array("CLASS"=>"WORKTABS",     "TABCLASS" =>"worktabs",      "ACL"=> "workstation"),
-          "server"      => array("CLASS"=>"SERVTABS",     "TABCLASS" =>"servtabs",      "ACL"=> "server"),
-          "printer"     => array("CLASS"=>"PRINTTABS",    "TABCLASS" =>"printtabs",     "ACL"=> "printer"),
-          "phone"       => array("CLASS"=>"PHONETABS",    "TABCLASS" =>"phonetabs",     "ACL"=> "phone"),
-          "winstation"  => array("CLASS"=>"WINTABS",      "TABCLASS" =>"wintabs",       "ACL"=> "winworkstation"),
-          "component"   => array("CLASS"=>"COMPONENTTABS","TABCLASS" =>"componenttabs", "ACL"=> "component"));
-
-
-      if($type == "ArpNewDevice"){
-        $this->systab = new ArpNewDeviceTabs($this->config,$this->config->data['TABS']['ARPNEWDEVICETABS'],$this->dn);
-      }elseif($type == "NewDevice"){
-        $this->systab = new SelectDeviceType($this->config,$this->dn) ;
-      }elseif(isset($tabs[$type])){
-
-        $class    = $tabs[$type]["CLASS"];
-        $acl_cat  = $tabs[$type]["ACL"];
-        $tabclass = $tabs[$type]["TABCLASS"];
-
-        $this->systab= new $tabclass($this->config, $this->config->data['TABS'][$class], $this->dn,$acl_cat);
-        $this->systab->set_acl_base($this->dn);
-        $_SESSION['objectinfo']= $this->dn;
-        add_lock ($this->dn, $this->ui->dn);
-      }else{ 
-        print_red (_("You can't edit this object type yet!"));
-        del_lock($this->dn);
-      }
-    }
-
-
-    /********************
-      Change password ...   
-     ********************/
-
-    /* Set terminals root password */
-    if ($s_action=="change_pw"){
-      $tabs = array(
-          "terminal"    => array("CLASS"=>"TERMTABS",     "TABNAME"=>"termgeneric",     "TABCLASS" =>"termtabs",      "ACL"=> "terminal"),
-          "workstation" => array("CLASS"=>"WORKTABS",     "TABNAME"=>"workgeneric",     "TABCLASS" =>"worktabs",      "ACL"=> "workstation"));
-
-      $type = $this->get_system_type($this->terminals[$s_entry]);
-      $class    = $tabs[$type]["CLASS"];
-      $tabname  = $tabs[$type]["TABNAME"];
-      $acl_cat  = $tabs[$type]["ACL"];
-      $tabclass = $tabs[$type]["TABCLASS"];
-      $ui       = get_userinfo();
-      $tabacl   = $ui->get_permissions($this->DivListSystem->selectedBase,$acl_cat."/".$tabname,"gotoRootPasswd");
-      if(preg_match("/w/",$tabacl)){
-        $this->dn= $this->terminals[$s_entry]['dn'];
-        $_SESSION['objectinfo']= $this->dn;
-        return ($smarty->fetch(get_template_path('password.tpl', TRUE)));
-      }else{
-        print_red(_("You are not allowed to change the password for this object."));
-      }
-    }
-
-
-    /********************
-      Password change finish, but check if entered data is ok 
-     ********************/
-
-    /* Correctly specified? */
-    if (isset($_POST['password_finish'])){
-      if ($_POST['new_password'] != $_POST['repeated_password']){
-        print_red (_("Passwords entered as new and repeated do not match!"));
-        return($smarty->fetch(get_template_path('password.tpl', TRUE)));
-      }
-    }
-
-    /********************
-      Password change finish
-     ********************/
-
-    /* Change terminal password */
-    if (isset($_POST['password_finish']) && 
-        $_POST['new_password'] == $_POST['repeated_password']){
-
-      /* Check if user is allowed to set password */
-      $tabs = array(
-          "terminal"    => array("CLASS"=>"TERMTABS",     "TABNAME"=>"termgeneric",     "TABCLASS" =>"termtabs",      "ACL"=> "terminal"),
-          "workstation" => array("CLASS"=>"WORKTABS",     "TABNAME"=>"workgeneric",     "TABCLASS" =>"worktabs",      "ACL"=> "workstation"));
-
-      /* Detect object type */
-      $type = "";
-      foreach($this->terminals as $terminal){
-        if($terminal['dn'] == $this->dn){
-          $type = $this->get_system_type($terminal);
-          break;
-        } 
-      }
-
-      /* Type detected */
-      if(!empty($type)){
-
-        /* Get infos */
-        $class    = $tabs[$type]["CLASS"];
-        $tabname  = $tabs[$type]["TABNAME"];
-        $acl_cat  = $tabs[$type]["ACL"];
-        $tabclass = $tabs[$type]["TABCLASS"];
-    
-        /* Get acls */
-        $ui       = get_userinfo();
-        $tabacl   = $ui->get_permissions($this->DivListSystem->selectedBase,$acl_cat."/".$tabname,"gotoRootPasswd");
-
-        /* Check acls */
-        if(preg_match("/w/",$tabacl)){
-          $ldap = $this->config->get_ldap_link();
-          $ldap->cd($this->dn);
-
-          $attrs= array();
-          if ($_POST['new_password'] == ""){
-            $attrs['gotoRootPasswd']= array();
-          } else {
-            $attrs['gotoRootPasswd']= crypt($_POST['new_password'],substr(session_id(),0,2));
-          }
-          $ldap->modify($attrs);
-          new log("security","systems/".get_class($this),$this->dn,array_keys($attrs),$ldap->get_error());
-        }else{
-          print_red(_("You are not allowed to change the password for this object."));
-        }
-      }else{
-        print_red(_("Can't detect object to change password."));
-      }
-      unset($_SESSION['objectinfo']);
-    }
-
-
-    /********************
-      Delete system cancel
-     ********************/
-
-    /* Delete terminal canceled? */
-    if (isset($_POST['delete_cancel']) || isset($_POST['password_cancel'])){
-      del_lock ($this->dn);
-      unset($_SESSION['objectinfo']);
-    }
-
-
-    /********************
-      Delete MULTIPLE entries requested, display confirm dialog
-     ********************/
-
-    if ($s_action=="del_multiple"){
-      $this->dns = array();
-      $ids = $this->list_get_selected_items();
-
-      if(count($ids)){
-
-        foreach($ids as $id){
-          $dn = $this->terminals[$id]['dn'];
-          if (($user= get_lock($dn)) != ""){
-            return(gen_locked_message ($user, $dn));
-          }
-          $this->dns[$id] = $dn;
-        }
-
-        $dns_names = "<br><pre>";
-        foreach($this->dns as $dn){
-          add_lock ($dn, $this->ui->dn);
-          $dns_names .= $dn."\n";
-        }
-        $dns_names .="</pre>";
-
-        /* Lock the current entry, so nobody will edit it during deletion */
-        if (count($this->dns) == 1){
-          $smarty->assign("warning",     sprintf(_("You're about to delete the following entry %s"), @LDAP::fix($dns_names)));
-        } else {
-          $smarty->assign("warning",     sprintf(_("You're about to delete the following entries %s"), @LDAP::fix($dns_names)));
-        }
-        $smarty->assign("multiple", true);
-        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
-      }
-    }
-
-
-    /********************
-      Delete MULTIPLE entries confirmed
-     ********************/
-
-    /* Confirmation for deletion has been passed. Users should be deleted. */
-    if (isset($_POST['delete_multiple_system_confirm'])){
-
-      $ui = get_userinfo();
-      $tabs = array(
-          "terminal"    => array("CLASS"=>"TERMTABS",     "TABCLASS" =>"termtabs",      "ACL"=> "terminal/termgeneric"),
-          "workstation" => array("CLASS"=>"WORKTABS",     "TABCLASS" =>"worktabs",      "ACL"=> "workstation/workgeneric"),
-          "server"      => array("CLASS"=>"SERVTABS",     "TABCLASS" =>"servtabs",      "ACL"=> "server/servgeneric"),
-          "printer"     => array("CLASS"=>"PRINTTABS",    "TABCLASS" =>"printtabs",     "ACL"=> "printer/printgeneric"),
-          "phone"       => array("CLASS"=>"PHONETABS",    "TABCLASS" =>"phonetabs",     "ACL"=> "phone/phoneGeneric"),
-          "winstation"  => array("CLASS"=>"WINTABS",      "TABCLASS" =>"wintabs",       "ACL"=> "winworkstation/wingeneric"),
-          "component"   => array("CLASS"=>"COMPONENTTABS","TABCLASS" =>"componenttabs", "ACL"=> "component/componentGeneric"));
-
-
-      /* Remove user by user and check acls before removeing them */
-      foreach($this->dns as $key => $dn){
-
-        /* Get 'dn' from posted termlinst */
-        $attrs    = $this->terminals[$key];
-        $type= $this->get_system_type($attrs);
-
-        /* get object type */
-        $tabtype  = "termtabs";
-        $tabobj   = "TERMTABS";
-        $tabacl   = "";
-        if(isset($tabs[$type])){
-          $tabtype = $tabs[$type]['TABCLASS'];
-          $tabobj  = $tabs[$type]['CLASS'];
-          $tabacl  = $ui->get_permissions($dn,$tabs[$type]['ACL']);
-
-          /* Load permissions for selected 'dn' and check if
-             we're allowed to remove this 'dn' */
-          if(preg_match("/d/",$tabacl)){ 
-
-            /* Delete request is permitted, perform LDAP action */
-            if($tabtype=="phonetabs"){
-              $this->systab= new $tabtype($this->config, $this->config->data['TABS'][$tabobj], $dn,$type);
-              $this->systab->set_acl_base($dn);
-              $this->systab->by_object['phoneGeneric']->remove_from_parent ();
-            }else{
-              $this->systab= new $tabtype($this->config,$this->config->data['TABS'][$tabobj], $dn,$type);
-              $this->systab->set_acl_base($dn);
-              $this->systab->delete();
-            }
-            unset ($this->systab);
-            $this->systab= NULL;
-
-          } else {
-            /* Normally this shouldn't be reached, send some extra
-               logs to notify the administrator */
-            print_red (_("You are not allowed to delete this component!"));
-            new log("security","systems/".get_class($this),$dn,array(),"Tried to trick deletion.");
-          }
-          /* Remove lock file after successfull deletion */
-          del_lock ($dn);
-          unset($this->dns[$key]);
-        }
-      }
-    }
-
-    /********************
-      Delete MULTIPLE entries Canceled
-     ********************/
-
-    /* Remove lock */
-   if(isset($_POST['delete_multiple_system_cancel'])){
-      foreach($this->dns as $key => $dn){
-        del_lock ($dn);
-        unset($this->dns[$key]);
-      }
-    }
-
-
-    /********************
-      Delete system, confirm dialog
-     ********************/
-
-    /* Remove terminal was requested */
-    if ($s_action=="del"){
-
-      /* Get 'dn' from posted termlinst */
-      $this->dn = $this->terminals[$s_entry]['dn'];
-      $attrs    = $this->terminals[$s_entry];
-
-      $type= $this->get_system_type($attrs);
-      $ui = get_userinfo();
-      $tabs = array(
-          "terminal"    => array("CLASS"=>"TERMTABS",     "TABCLASS" =>"termtabs",      "ACL"=> "terminal/termgeneric"),
-          "workstation" => array("CLASS"=>"WORKTABS",     "TABCLASS" =>"worktabs",      "ACL"=> "workstation/workgeneric"),
-          "server"      => array("CLASS"=>"SERVTABS",     "TABCLASS" =>"servtabs",      "ACL"=> "server/servgeneric"),
-          "printer"     => array("CLASS"=>"PRINTTABS",    "TABCLASS" =>"printtabs",     "ACL"=> "printer/printgeneric"),
-          "phone"       => array("CLASS"=>"PHONETABS",    "TABCLASS" =>"phonetabs",     "ACL"=> "phone/phoneGeneric"),
-          "winstation"  => array("CLASS"=>"WINTABS",      "TABCLASS" =>"wintabs",       "ACL"=> "winworkstation/wingeneric"),
-          "component"   => array("CLASS"=>"COMPONENTTABS","TABCLASS" =>"componenttabs", "ACL"=> "component/componentGeneric"));
-
-
-      /* get object type */
-      $tabtype  = "termtabs";
-      $tabobj   = "TERMTABS";
-      $tabacl   = "";
-      if(isset($tabs[$type])){
-        $tabtype = $tabs[$type]['TABCLASS'];
-        $tabobj  = $tabs[$type]['CLASS'];
-        $tabacl  = $ui->get_permissions($this->dn,$tabs[$type]['ACL']);
-      }
-
-      /* Load permissions for selected 'dn' and check if
-         we're allowed to remove this 'dn' */
-      if(preg_match("/d/",$tabacl)){ 
-
-        /* Check locking, save current plugin in 'back_plugin', so
-           the dialog knows where to return. */
-        if (($user= get_lock($this->dn)) != ""){
-          return(gen_locked_message ($user, $this->dn));
-        }
-
-        /* Lock the current entry, so nobody will edit it during deletion */
-        add_lock ($this->dn, $this->ui->dn);
-        $smarty->assign("warning", sprintf(_("You're about to delete all information about the component at '%s'."), @LDAP::fix($this->dn)));
-        $smarty->assign("multiple", false);
-        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
-      } else {
-
-        /* Obviously the user isn't allowed to delete. Show message and
-           clean session. */
-        print_red (_("You are not allowed to delete this component!"));
-      }
-    }
-
-
-    /********************
-      Delete system, confirmed
-     ********************/
-    /* Confirmation for deletion has been passed. Terminal should be deleted. */
-    if (isset($_POST['delete_terminal_confirm'])){
-
-      /* Find out more about the object type */
-      $ldap= $this->config->get_ldap_link();
-      $ldap->cat($this->dn, array('objectClass'));
-      $attrs= $ldap->fetch();
-      $type= $this->get_system_type($attrs);
-
-      $ui = get_userinfo();
-
-      $tabs = array(
-          "terminal"    => array("CLASS"=>"TERMTABS",     "TABCLASS" =>"termtabs",      "ACL"=> "terminal/termgeneric"),
-          "workstation" => array("CLASS"=>"WORKTABS",     "TABCLASS" =>"worktabs",      "ACL"=> "workstation/workgeneric"),
-          "server"      => array("CLASS"=>"SERVTABS",     "TABCLASS" =>"servtabs",      "ACL"=> "server/servgeneric"),
-          "printer"     => array("CLASS"=>"PRINTTABS",    "TABCLASS" =>"printtabs",     "ACL"=> "printer/printgeneric"),
-          "phone"       => array("CLASS"=>"PHONETABS",    "TABCLASS" =>"phonetabs",     "ACL"=> "phone/phoneGeneric"),
-          "winstation"  => array("CLASS"=>"WINTABS",      "TABCLASS" =>"wintabs",       "ACL"=> "winworkstation/wingeneric"),
-          "component"   => array("CLASS"=>"COMPONENTTABS","TABCLASS" =>"componenttabs", "ACL"=> "component/componentGeneric"));
-
-      /* get object type */
-      $tabtype  = "termtabs";
-      $tabobj   = "TERMTABS";
-      $tabacl   = "";
-      if(isset($tabs[$type])){
-        $tabtype = $tabs[$type]['TABCLASS'];
-        $tabobj  = $tabs[$type]['CLASS'];
-        $tabacl  = $ui->get_permissions($this->dn,$tabs[$type]['ACL']);
-      }
-
-      /* Check if we are allowed to remove this object */
-      if(preg_match("/d/",$tabacl)){
-
-        /* Delete request is permitted, perform LDAP action */
-        if($tabtype=="phonetabs"){
-          $this->systab= new $tabtype($this->config, $this->config->data['TABS'][$tabobj], $this->dn,$type);
-          $this->systab->set_acl_base($this->dn);
-          $this->systab->by_object['phoneGeneric']->remove_from_parent ();
-        }else{  
-          $this->systab= new $tabtype($this->config,$this->config->data['TABS'][$tabobj], $this->dn,$type);
-          $this->systab->set_acl_base($this->dn);
-          $this->systab->delete();
-        }
-        unset ($this->systab);
-        $this->systab= NULL;
-
-        /* Terminal list has changed, reload it. */
-      } else {
-
-        /* Normally this shouldn't be reached, send some extra
-           logs to notify the administrator */
-        print_red (_("You are not allowed to delete this component!"));
-        new log("security","systems/".get_class($this),$dn,array(),"Tried to trick deletion.");
-      }
-
-      /* Remove lock file after successfull deletion */
-      del_lock ($this->dn);
-    }
-
-
-
-
-
-
-
-
-
-   /********************
-      Edit system type finished, check if everything went ok
-     ********************/
-    /* Finish user edit is triggered by the tabulator dialog, so
-       the user wants to save edited data. Check and save at this
-       point. */
-    if ((isset($_POST['edit_finish'])) && (isset($this->systab->config)) || $save_object_directly){
-
-      /* Check tabs, will feed message array */
-      $message = array();
-      if(!$save_object_directly){
-        $message = $this->systab->check();
-      }else{
-        $found = false;
-
-        /* Set gotoMode to active if we there was an ogroup selected . (save_object_directly) */
-        foreach(array("workgeneric"=>"active","servgeneric"=>"active","termgeneric"=>"graphic") as $tab => $value){
-          if(isset($this->systab->by_object[$tab]->gotoMode)) {
-            $found = true;
-            $this->systab->by_object[$tab]->gotoMode = $value;
-          }
-        }
-        if(!$found){
-          print_red(sprintf(_("Can't set gotoMode to status 'active', the current object couldn't be identified.")));
-        }
-
-      }
-      /* Save, or display error message? */
-      if (count($message) == 0){
-
-        /* Incoming behavior; you can select a system type and an ogroup membership.
-         * If this object is an Incoming object, $_SESSION['SelectedSystemType'] isset.
-         * Check if we must add the new object to an object group.
-         *
-         * If this is done, delete the old incoming entry... it is still there, because this is a new
-         * entry and not an edited one, so we will delete it.
-         *
-         */
-
-        if(isset($_SESSION['SelectedSystemType'])){
-          $SelectedSystemType= $_SESSION['SelectedSystemType'];
-          if($SelectedSystemType['ogroup'] != "none"){
-            $og = new ogroup($this->config,$SelectedSystemType['ogroup']);
-            if($og){
-              $og->AddDelMembership($this->systab->dn);
-              $og->save();
-            }
-          }
-        }
-
-        /* Save terminal data to ldap */
-        if(isset($_SESSION['SelectedSystemType']['ogroup']) && $_SESSION['SelectedSystemType']['ogroup'] != 'none'){
-          foreach (array("workservice", "termservice") as $cls){
-            if (isset($this->systab->by_object[$cls])){
-              $this->systab->by_object[$cls]->gotoXMouseport= "";
-              $this->systab->by_object[$cls]->gotoXMouseType= "";
-              $this->systab->by_object[$cls]->gotoXResolution= "";
-              $this->systab->by_object[$cls]->gotoXColordepth= "";
-            }
-          }
-        }
-
-        $this->systab->save();
-
-        if(isset($_SESSION['SelectedSystemType'])){
-          unset($_SESSION['SelectedSystemType']);
-          if(!isset($ldap)){
-            $ldap = $this->config->get_ldap_link();
-          }
-          $ldap->cd ($this->dn);
-          $ldap->cat($this->dn, array('dn'));
-          if(count($ldap->fetch())){
-            $ldap->cd($this->dn);
-            $ldap->rmDir($this->dn);
-          }
-          $ldap->cd($this->config->current['BASE']);
-        }
-
-        /* Terminal has been saved successfully, remove lock from
-           LDAP. */
-        if ($this->dn != "new"){
-          del_lock ($this->dn);
-        }
-
-        unset ($this->systab);
-        $this->systab= NULL;
-        unset($_SESSION['objectinfo']);
-      } else {
-        /* Ok. There seem to be errors regarding to the tab data,
-           show message and continue as usual. */
-        show_errors($message);
-      }
-    }
-
-
-    /********************
-      Edit system was canceled 
-     ********************/
-    /* Cancel dialogs */
-    if (isset($_POST['edit_cancel']) || isset($_POST['password_cancel']) || isset($_POST['SystemTypeAborted'])){
-      if (isset($this->systab)){
-        del_lock ($this->systab->dn);
-        unset ($this->systab);
-      }
-      $this->systab= NULL;
-      unset($_SESSION['objectinfo']);
-
-      /* Remove ogroup selection, which was set while editing a new incoming entry */
-      if(isset($_SESSION['SelectedSystemType'])){
-        unset($_SESSION['SelectedSystemType']);
-      }
-    }
-
-    /********************
-      Display edit dialog, or some other
-     ********************/
-
-    /* Show tab dialog if object is present */
-    if (isset($this->systab->config)){
-      $display= $this->systab->execute();
-
-      /* Don't show buttons if tab dialog requests this */
-
-      $dialog     = FALSE;
-      $hide_apply = $this->dn == "new";
-      if(is_object($this->systab) && !isset($this->systab->by_object)){
-        $dialog = TRUE;
-        $hide_apply = TRUE;
-      }elseif(isset($this->systab->by_object[$this->systab->current]->dialog)){
-        $dia = $this->systab->by_object[$this->systab->current]->dialog;
-        if($dia === TRUE || is_object($dia)){
-          $dialog = TRUE;
-        }  
-      }
-      if(isset($this->systab->by_object[$this->systab->current]->netConfigDNS) && 
-        $this->systab->by_object[$this->systab->current]->netConfigDNS->dialog){
-        $dialog = TRUE;
-      }
-
-      if (!$dialog){
-        $display.= "<p style=\"text-align:right\">\n";
-        $display.= "<input type=\"submit\" name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
-        $display.= "&nbsp;\n";
-        if (!$hide_apply){
-          $display.= "<input type=submit name=\"edit_apply\" value=\""._("Apply")."\">\n";
-          $display.= "&nbsp;\n";
-        }
-        $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
-        $display.= "</p>";
-      }
-      return ($display);
-    }
-
-    /* Check if there is a snapshot dialog open */
-    $base = $this->DivListSystem->selectedBase;
-    if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases())){
-      return($str);
-    }
-
-    /* Display dialog with system list */
-    $this->DivListSystem->parent = $this;
-    $this->DivListSystem->execute();
-
-    /* Add departments if subsearch is disabled */
-    if(!$this->DivListSystem->SubSearch){
-      $this->DivListSystem->AddDepartments($this->DivListSystem->selectedBase,3,1);
-    }
-    $this->reload();
-    $this->DivListSystem->setEntries($this->terminals);
-    return($this->DivListSystem->Draw());
-  }
-
-
-  /* Return departments, that will be included within snapshot detection */
-  function get_used_snapshot_bases()
-  {
-    $tmp = array();
-
-    /* Check acls, if we are not allowed to create and write each plugin tab, skip this object */
-
-    $tabs = array(
-        "terminal"        => "ou=terminals,ou=systems,",
-        "workstation"     => "ou=workstations,ou=systems,",
-        "incoming"        => "ou=incoming,",
-        "server"          => "ou=servers,ou=systems,",
-        "printer"         => "ou=printers,ou=systems,",
-        "phone"           => "ou=phones,ou=systems,",
-        "winworkstation"  => get_winstations_ou(),
-        "component"       => "ou=netdevices,ou=systems,"
-        ); 
-
-    foreach($tabs as $acl_cat => $dn){
-
-      $acl_all = $this->ui->has_complete_category_acls($dn.$this->DivListSystem->selectedBase,$acl_cat);
-      if(preg_match("/(c.*w|w.*c)/",$acl_all)){
-        $tmp[] = $dn.$this->DivListSystem->selectedBase;
-      }
-    }
-    return($tmp); 
-  }
-
-
-  function remove_from_parent()
-  {
-    /* Optionally execute a command after we're done */
-    $this->postremove();
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    $this->DivListSystem->save_object();
-  }
-
-
-  /* Check values */
-  function check()
-  {
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-  }
-
-  function adapt_from_template($dn)
-  {
-  }
-
-  function password_change_needed()
-  {
-  }
-
-  function reload()
-  {
-    /* some var init */
-    $ui = get_userinfo();
-    $res              = array();
-    $this->terminals  = array();
-    $userregex        = "";
-
-    /* Set base for all searches */
-    $base=  $this->DivListSystem->selectedBase;
-
-    /* Prepare samba class name */
-    $samba  ="";
-    if ($this->DivListSystem->ShowWinWorkstations){
-      if ($this->config->current['SAMBAVERSION'] == "3"){
-        $samba= "sambaSamAccount";
-      } else {
-        $samba= "sambaAccount";
-      }
-    }
-
-    /* This array represents the combination between checkboxes and search filters */
-    $objs = array( "ShowServers"        => array("CLASS" => "goServer"        ,"TREE" => "ou=servers,ou=systems," ),
-        "ShowTerminals"      => array("CLASS" => "gotoTerminal"    ,"TREE" => "ou=terminals,ou=systems,"), 
-        "ShowPrinters"       => array("CLASS" => "gotoPrinter"     ,"TREE" => "ou=printers,ou=systems," ),
-        "ShowDevices"        => array("CLASS" => "ieee802Device"   ,"TREE" => "ou=netdevices,ou=systems," ),
-        "ShowPhones"         => array("CLASS" => "goFonHardware"   ,"TREE" => "ou=phones,ou=systems," ),
-        "ShowWorkstations"   => array("CLASS" => "gotoWorkstation" ,"TREE" => "ou=workstations,ou=systems," ),
-        "ShowWinWorkstations"=> array("CLASS" => $samba            ,"TREE" => get_winstations_ou() ));
-
-    /* Include the 'Display Systems of user' attribute */ 
-    if ((!empty($this->DivListSystem->UserRegex)) && ($this->DivListSystem->UserRegex!= "*")){
-      $userregex = "(gotoLastUser=".$this->DivListSystem->UserRegex.")";
-    }
-
-    /* Attributes to fetch */
-    $sys_attrs        = array("cn", "description", "macAddress", "objectClass", "sambaDomainName","gotoMode");
-    $sys_categories   = array("terminal", "workstation", "server", "phone" ,"printer");
-
-    /* Add FAIstate to attributes if FAI is activated */
-    $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
-    if(!empty($tmp)){
-      $sys_attrs[] = "FAIstate";
-    }    
-
-    /* Walk through all possible search combinations, and search for some objects if the checkbox is enabled  */
-    foreach($objs as $checkBox => $oc){
-      if($this->DivListSystem->$checkBox){
-        if($this->DivListSystem->SubSearch){
-          if($oc['CLASS'] != ""){
-            $filter = "(&".$userregex."(objectClass=".$oc['CLASS'].")(cn=".$this->DivListSystem->Regex."))";
-            $new_res = get_list($filter, $sys_categories , $base,$sys_attrs, GL_NONE | GL_SUBSEARCH | GL_SIZELIMIT);
-      
-            /* Remove all objects that are not in the expected sub department */
-            foreach($new_res as $key => $obj){
-              if(preg_match("/^[^,]+,".normalizePreg($oc['TREE'])."/",$obj['dn'])){
-                $res[$obj['dn']] = $obj;
-              }
-            }
-          }
-        }else{
-          /* User filter? */
-          if($oc['CLASS'] != ""){
-            $filter = "(&".$userregex."(objectClass=".$oc['CLASS'].")(cn=".$this->DivListSystem->Regex."))";
-            $res = array_merge($res,get_list($filter,$sys_categories,$oc['TREE'].$base, $sys_attrs, GL_NONE | GL_SIZELIMIT));
-          }
-        }
-      } 
-    }
-
-    /* Search for incoming objects */ 
-    $filter = "(|(&".$userregex."(objectClass=goHard)(cn=".$this->DivListSystem->Regex.")))";
-    $res = array_merge($res,get_list($filter,$sys_categories,"ou=incoming,".$base,$sys_attrs, GL_NONE | GL_SIZELIMIT));
-
-    /* Get all gotoTerminal's */
-    foreach ($res as $value){
-
-      $tmp= $value['dn'];
-      $add= "";
-
-      /* Extract base */
-      foreach($objs as $obj){
-        if(preg_match("/,".$obj['TREE']."/i",$value['dn'])){
-          $tmp = trim( preg_replace("/^[^,]+,[^o]*".$obj['TREE']."/i","",$value['dn']));
-        }
-      }
-
-      /* Create a string containing the last part of the department. */
-      $dn_name = preg_replace("#^([^/]+/)*#","",convert_department_dn(@LDAP::fix($tmp)));
-      if(empty($dn_name)){
-        $dn_name = "/";
-      }
-
-      /* check if current object is a new one */
-      if (preg_match ("/,ou=incoming,/i", $tmp)){
-        if (in_array_ics('gotoTerminal', $value['objectClass'])){
-          $add= "- "._("New terminal");
-        }elseif (in_array_ics('gotoWorkstation', $value['objectClass'])){
-          $add= "- "._("New workstation");
-        }elseif (in_array_ics('GOhard', $value['objectClass']) && !isset($value['gotoMode'])){
-          $add= "- "._("Unknown device");
-        }elseif (in_array_ics('GOhard', $value['objectClass'])){
-          $add= "- "._("New Device");
-        }
-      } 
-
-      /* Detect type of object and create an entry for $this->terminals */
-      $terminal = array();
-
-      if (in_array_ics('gotoTerminal', $value["objectClass"])){
-
-        /* check acl */
-        $acl = $ui->get_permissions($value['dn'],"terminal/termgeneric");
-        if($add != "" || preg_match("/r/",$acl)) {
-          if (isset($value["macAddress"][0]) && $value["macAddress"][0] != "-"){
-            $terminal             = $value;
-            $terminal['type']     = "T";
-            $terminal['is_new']   = $add;
-          } else {
-            $terminal             = $value;
-            $terminal['type']     = "D";
-            $terminal['message']  = _("Terminal template for")."&nbsp;'".$dn_name."'&nbsp;";
-            $terminal['location'] = array_search($tmp, $this->config->departments); 
-          }
-        }
-      } elseif (in_array_ics('gotoWorkstation', $value["objectClass"])){
-
-        $acl = $ui->get_permissions($value['dn'],"workstation/workgeneric");
-        if($add != "" || preg_match("/r/",$acl)) {
-          if (isset($value["macAddress"][0]) &&  $value["macAddress"][0] != "-"){
-            $terminal             = $value;
-            $terminal['type']     = "L";
-            $terminal['is_new']   = $add;
-          } else {
-            $terminal             = $value;
-            $terminal['type']     = "D";
-            $terminal['location'] = array_search($tmp, $this->config->departments);
-            $terminal['message']  = _("Workstation template for")."&nbsp;'".$dn_name."'&nbsp;";
-          }
-          if (isset($value["FAIstate"][0])){
-            $terminal['type']= $this->getState($terminal['type'], $value["FAIstate"][0]);
-          }
-        }
-      } elseif (in_array_ics('gotoPrinter', $value["objectClass"])){
-       
-   
-        $acl = $ui->get_permissions($value['dn'],"printer/printgeneric");
-        if($add != "" || preg_match("/r/",$acl)) {
-
-          $terminal             = $value;
-          $terminal['type']     = "P";
-        }
-      } elseif (in_array_ics('goServer', $value["objectClass"])){
-
-        $acl = $ui->get_permissions($value['dn'],"server/servgeneric");
-        if($add != "" || preg_match("/r/",$acl)) {
-
-          $terminal             = $value;
-          $terminal['type']     = "S";
-          if (isset($value["FAIstate"][0])){
-            $terminal['type']= $this->getState($terminal['type'], $value["FAIstate"][0]);
-          }
-        }
-      } elseif (in_array_ics('goFonHardware', $value["objectClass"])){
-
-        $acl = $ui->get_permissions($value['dn'],"phone/phoneGeneric");
-        if($add != "" || preg_match("/r/",$acl)) {
-
-          $terminal             = $value;
-          $terminal['type']     = "F";
-        }
-      }elseif (in_array_ics("GOhard",$value['objectClass'])){
-
-        $acl =  $ui->get_permissions($value['dn'],"server/servgeneric"). 
-                $ui->get_permissions($value['dn'],"terminal/termgeneric").
-                $ui->get_permissions($value['dn'],"workstation/workgeneric");
-        if($add != "" || preg_match("/r/",$acl)) {
-
-          $terminal = $value;
-          $terminal['type']   = "Q";
-          $terminal['is_new'] = $add;
-        }
-      } elseif (in_array_ics('ieee802Device', $value["objectClass"])){
-
-        $acl = $ui->get_permissions($value['dn'],"component/componentGeneric");
-        if($add != "" || preg_match("/r/",$acl)) {
-
-          $terminal             = $value;
-          $terminal['type']     = "C";
-        }
-      } else{
-
-        $name= preg_replace('/\$$/', '', $value['cn'][0]);
-        if (isset($value['sambaDomainName'])){
-          $domain= " [".$value['sambaDomainName'][0]."]";
-        } else {
-          $domain= "";
-        }
-        $terminal=$value;
-        $terminal['type']     ="W";
-        $terminal['domain']   = $name.$domain;
-      }
-
-      if(count($terminal)){
-        $this->terminals[]=$terminal;
-      }
-    }
-
-    $tmp=array();
-    foreach($this->terminals as $tkey => $val ){
-      $tmp[strtolower($val['cn'][0]).$val['dn']]=$val;
-    }
-    ksort($tmp);
-    $this->terminals=array();
-    foreach($tmp as $val){
-      $this->terminals[]=$val;
-    }
-    reset ($this->terminals);
-  }
-
-  function remove_lock()
-  {
-    if (isset($this->systab->dn)){
-      del_lock ($this->systab->dn);
-    }
-  }
-
-
-  function copyPasteHandling_from_queue($s_action,$s_entry)
-  {
-    /* Check if Copy & Paste is disabled */
-    if(!is_object($this->CopyPasteHandler)){
-      return("");
-    }
-
-
-    $tabs = array(
-        "terminal"    => array( "CLASS"     =>"TERMTABS",     "TABNAME" =>"termgeneric",     
-          "TABCLASS"  =>"termtabs",     "ACL"     =>"terminal"),
-        "workstation" => array( "CLASS"     =>"WORKTABS",     "TABNAME" =>"workgeneric",     
-          "TABCLASS"  =>"worktabs",     "ACL"     =>"workstation"),
-        "server"      => array( "CLASS"     =>"SERVTABS",     "TABNAME" =>"servgeneric",     
-          "TABCLASS"  =>"servtabs",     "ACL"     =>"server"),
-        "printer"     => array( "CLASS"     =>"PRINTTABS",    "TABNAME" =>"printgeneric",    
-          "TABCLASS"  =>"printtabs",    "ACL"     =>"printer"),
-        "phone"       => array( "CLASS"     =>"PHONETABS",    "TABNAME" =>"phoneGeneric",    
-          "TABCLASS"  =>"phonetabs",    "ACL"     =>"phone"),
-        "component"   => array( "CLASS"     =>"COMPONENTTABS","TABNAME" =>"componentGeneric",
-          "TABCLASS"  =>"componenttabs","ACL"     =>"component"));
-
-    /* Add a single entry to queue */
-    if($s_action == "cut" || $s_action == "copy"){
-
-      /* Cleanup object queue */
-      $this->CopyPasteHandler->cleanup_queue();
-      $dn     = $this->terminals[$s_entry]['dn'];
-      $oc     = $this->terminals[$s_entry]['objectClass'];
-      $type   = $this->get_system_type($this->terminals[$s_entry]);
-
-      $tab_o  = $tabs[$type]['CLASS'];
-      $tab_c  = $tabs[$type]['TABCLASS'];
-      $acl    = $tabs[$type]['ACL'];
-
-      $this->CopyPasteHandler->add_to_queue($dn,$s_action,$tab_c,$tab_o,$acl);
-    }
-
-    /* Add entries to queue */
-    if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
-
-      /* Cleanup object queue */
-      $this->CopyPasteHandler->cleanup_queue();
-
-      /* Add new entries to CP queue */
-      foreach($this->list_get_selected_items() as $id){
-        $dn = $this->terminals[$id]['dn'];
-        $oc = $this->terminals[$id]['objectClass']; 
-        $type = $this->get_system_type($this->terminals[$id]);
-
-        if(isset($tabs[$type])){
-          $tab_o  = $tabs[$type]['CLASS'];
-          $tab_c  = $tabs[$type]['TABCLASS'];
-          $acl    = $tabs[$type]['ACL'];
-
-          if($s_action == "copy_multiple"){
-            $this->CopyPasteHandler->add_to_queue($dn,"copy",$tab_c,$tab_o,$acl);
-          }
-          if($s_action == "cut_multiple"){
-            $this->CopyPasteHandler->add_to_queue($dn,"cut",$tab_c,$tab_o,$acl);
-          }
-        }
-      }
-    }
-
-    /* Start pasting entries */
-    if($s_action == "editPaste"){
-      $this->start_pasting_copied_objects = TRUE;
-    }
-  
-    /* Return C&P dialog */
-    if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
-    
-      /* Load entry from queue and set base */
-      $this->CopyPasteHandler->load_entry_from_queue();
-      $this->CopyPasteHandler->SetVar("base",$this->DivListSystem->selectedBase);
-
-      /* Get dialog */
-      $data = $this->CopyPasteHandler->execute();
-
-      /* Return dialog data */
-      if(!empty($data)){
-        return($data);
-      }
-    }
-
-    /* Automatically disable status for pasting */
-    if(!$this->CopyPasteHandler->entries_queued()){
-      $this->start_pasting_copied_objects = FALSE;
-    }
-    return("");
-  }
-
-
-  function get_system_type($attrs)
-  {
-    $classes = $attrs['objectClass'];
-
-    $type= "";
-    if (in_array_ics('ieee802Device', $classes)){
-      $type= "component";
-    }elseif (in_array_ics('gotoTerminal', $classes)){
-      $type= "terminal";
-    }elseif (in_array_ics('gotoWorkstation', $classes)){
-      $type= "workstation";
-    }elseif (in_array_ics('gotoPrinter', $classes)){
-      $type= "printer";
-    }elseif (in_array_ics('goFonHardware', $classes)){
-      $type= "phone";
-    }elseif (in_array_ics('goServer', $classes)){
-      $type= "server";
-    }elseif (in_array_ics('GOhard', $classes) && !isset($attrs['gotoMode']) && $this->arp_handling_active){
-      $type= "ArpNewDevice";
-    }elseif (in_array_ics('GOhard', $classes)){
-      $type= "NewDevice";
-    }elseif (in_array_ics('sambaAccount', $classes) ||
-        in_array_ics('sambaSamAccount', $classes)){
-      $type= "winstation";
-    }
-    return ($type);
-  }
-
-
-  function convert_list($input)
-  {
-    $temp= "";
-    $conv= array(      
-        "NQ" => array("select_newsystem.png",_("New System from incoming")),
-        "D" => array("select_default.png",_("Template")),
-        "T" => array("select_terminal.png",_("Terminal")),
-        "L" => array("select_workstation.png",_("Workstation")),
-        "GL" => array("select_workstation_green.png",_("Workstation is installing")),
-        "YL" => array("select_workstation_yellow.png",_("Workstation is waiting for action")),
-        "RL" => array("select_workstation_red.png",_("Workstation installation failed")),
-        "F" => array("select_phone.png",_("Phone")),
-        "S" => array("select_server.png",_("Server")),
-        "GS" => array("select_server_green.png",_("Server is installing")),
-        "YS" => array("select_server_yellow.png",_("Server is waiting for action")),
-        "RS" => array("select_server_red.png",_("Server installation failed")),
-        "W" => array("select_winstation.png",_("Winstation")),
-        "C" => array("select_component.png",_("Network Device")),
-        "NT"=> array("select_new_terminal.png",_("New Terminal")),
-        "NL"=> array("select_new_workstation.png",_("New Workstation")),
-        "P" => array("select_printer.png",_("Printer")));
-
-    if((isset($input['is_new']))&&(!empty($input['is_new']))){
-      $input['type']="N".$input['type'];
-    }
-    foreach ($conv  as $key => $value){
-      if($input['type']==$key){
-        $tmp['img'] ="<img class='center' src='images/".$value[0]."' alt='".$key."' title='".$value['1']."'>";
-        $tmp['class']=$key;
-        return $tmp;
-      }
-    }
-  }
-
-  
-  function getState($type, $state)
-  {
-    switch (preg_replace('/:.*$/', '', $state)) {
-      case 'installing':
-                $type= 'G'.$type;
-                break;
-      case 'error':
-                $type= 'R'.$type;
-                break;
-      case 'install':
-      case 'sysinfo':
-      case 'softupdate':
-      case 'scheduledupdate':
-                $type= 'Y'.$type;
-                break;
-    }
-
-
-    return ($type);
-  }
-
-
-  function list_get_selected_items()
-  {
-    $ids = array();
-    foreach($_POST as $name => $value){
-      if(preg_match("/^item_selected_[0-9]*$/",$name)){
-        $id   = preg_replace("/^item_selected_/","",$name);
-        $ids[$id] = $id;
-      }
-    }
-    return($ids);
-  }
-
-
-  /* !! Incoming dummy acls, required to defined acls for incoming objects
-   */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("Incoming objects"),
-          "plDescription" => _("Incoming objects"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 99,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("incoming"   => array( "description"  => _("Incoming"),
-                                                          "objectClass"  => "")),
-          "plProvidedAcls"=> array()
-            
-          ));
-  }
-
-
-  
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_terminalGeneric.inc b/plugins/admin/systems/class_terminalGeneric.inc
deleted file mode 100644 (file)
index be12d59..0000000
+++ /dev/null
@@ -1,682 +0,0 @@
-<?php
-
-class termgeneric extends plugin
-{
-  /* CLI vars */
-  var $cli_summary= "Manage terminal base objects";
-  var $cli_description= "Some longer text\nfor help";
-  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* Generic terminal attributes */
-  var $gotoMode= "disabled";
-  var $gotoTerminalPath= "";
-  var $gotoSwapServer= "";
-  var $gotoSyslogServer= "";
-  var $gotoSyslogServers = array();
-  var $gotoNtpServer= array();
-  var $gotoNtpServers= array();
-  var $gotoSndModule= "";
-  var $gotoFloppyEnable= "";
-  var $gotoCdromEnable= "";
-  var $ghCpuType= "-";
-  var $ghMemSize= "-";
-  var $ghUsbSupport= "-";
-  var $ghNetNic= array();
-  var $ghIdeDev= array();
-  var $ghScsiDev= array();
-  var $ghGfxAdapter= "-";
-  var $ghSoundAdapter= "-";
-  var $gotoLastUser= "-";
-  var $netConfigDNS;
-  /* Needed values and lists */
-  var $base= "";
-  var $cn= "";
-  var $orig_dn= "";
-
-  var $inheritTimeServer = true;
-
-  /* Plugin side filled */
-  var $modes= array();
-
-  /* attribute list for save action */
-  var $ignore_account= TRUE;
-  var $attributes= array("gotoMode", "gotoTerminalPath", 
-      "gotoSwapServer", "gotoSyslogServer", "gotoNtpServer",
-      "gotoFloppyEnable", "gotoCdromEnable", "cn", "gotoSndModule",
-      "ghCpuType", "ghMemSize","ghUsbSupport",
-      "ghGfxAdapter", "ghSoundAdapter", "gotoLastUser");
-  var $objectclasses= array("top", "gotoTerminal", "GOhard");
-
-  var $mapActions   = array("reboot"          => "",
-                            "instant_update"  => "softupdate",
-                            "update"          => "sceduledupdate",
-                            "reinstall"       => "install",
-                            "rescan"          => "",
-                            "memcheck"        => "memcheck",
-                            "sysinfo"         => "sysinfo");
-
-  var $fai_activated = FALSE;
-  var $view_logged = FALSE;
-
-  var $member_of_ogroup = FALSE;
-
-  function termgeneric (&$config, $dn= NULL, $parent= NULL)
-  {
-    /* Check if FAI is activated */
-    $tmp= $config->search("faiManagement", "CLASS",array('menu','tabs'));
-    if(!empty($tmp)){
-      $this->fai_activated = TRUE;
-    }
-
-    plugin::plugin ($config, $dn, $parent);
-
-    if(!isset($this->parent->by_object['ogroup'])){
-      $ldap = $this->config->get_ldap_link();
-      $ldap->cd ($this->config->current['BASE']);
-      $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".$this->dn."))",array("cn"));
-      $this->member_of_ogroup = $ldap->count() >= 1;
-    }
-
-    $this->netConfigDNS = new termDNS($this->config,$this,$this->objectclasses);
-    /* Read arrays */
-    foreach (array("ghNetNic", "ghIdeDev", "ghScsiDev") as $val){
-      if (!isset($this->attrs[$val])){
-        continue;
-      }
-      for ($i= 0; $i<$this->attrs[$val]['count']; $i++){
-        array_push($this->$val, $this->attrs[$val][$i]);
-      }
-    }
-
-    /* Create used ntp server array */
-    $this->gotoNtpServer= array();
-    if(isset($this->attrs['gotoNtpServer'])){
-      $this->inheritTimeServer = false;
-      unset($this->attrs['gotoNtpServer']['count']);
-      foreach($this->attrs['gotoNtpServer'] as $server){
-        $this->gotoNtpServer[$server] = $server;
-      }
-    }
-
-    /* Set inherit checkbox state */
-    if((in_array("default",$this->gotoNtpServer)) || (count($this->gotoNtpServer)==0)){
-      $this->inheritTimeServer = true;
-      $this->gotoNtpServer=array();
-    }
-
-    /* You can't inherit the NTP service, if we are not member in an object group */
-    if(!$this->member_of_ogroup){
-      $this->inheritTimeServer = FALSE;
-    }
-
-    /* Create available ntp options */
-    $this->gotoNtpServers = $this->config->data['SERVERS']['NTP'];
-    foreach($this->gotoNtpServers as $key => $server){
-      if($server == "default"){
-        unset($this->gotoNtpServers[$key]);
-      }
-    }
-
-    $this->modes["disabled"]= _("disabled");
-    $this->modes["text"]= _("text");
-    $this->modes["graphic"]= _("graphic");
-
-    /* Set base */
-    if ($this->dn == "new"){
-      $ui= get_userinfo();
-      $this->base= dn2base($ui->dn);
-    } else {
-      $this->base= preg_replace ("/^[^,]+,[^,]+,[^,]+,/", "", $this->dn);
-    }
-
-    /* Create an array of all Syslog servers */
-    $tmp = $this->config->data['SERVERS']['SYSLOG'];
-    foreach($tmp as $server){
-      $visible = $server;
-      if($server == "default" && $this->member_of_ogroup) {
-        $visible = "["._("inherited")."]";
-      }
-      $this->gotoSyslogServers[$server] = $visible;
-    }
-
-    $this->orig_dn= $this->dn;
-  }
-
-  function set_acl_base($base)
-  {
-    plugin::set_acl_base($base);
-    $this->netConfigDNS->set_acl_base($base);
-  }
-
-  function set_acl_category($cat)
-  {
-    plugin::set_acl_category($cat);
-    $this->netConfigDNS->set_acl_category($cat);
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","terminal/".get_class($this),$this->dn);
-    }
-
-    /* Do we need to flip is_account state? */
-    if (isset($_POST['modify_state'])){
-      $this->is_account= !$this->is_account;
-    }
-
-    if (isset($_POST['action']) && $this->acl_is_writeable("FAIstate")){
-
-      /* Set FAIstate */
-      if($this->fai_activated && $this->dn != "new"){
-        $ldap = $this->config->get_ldap_link();
-        $ldap->cd($this->config->current['BASE']);
-        $ldap->cat($this->dn,array("objectClass"));
-        $res = $ldap->fetch();
-
-        $attrs = array();
-        $attrs['FAIstate'] = "";
-        if(isset($this->mapActions[$_POST['saction']])){
-          $attrs['FAIstate'] = $this->mapActions[$_POST ['saction']];
-        }
-
-        for($i = 0; $i < $res['objectClass']['count'] ; $i ++){
-          $attrs['objectClass'][] = $res['objectClass'][$i];
-        }
-
-        if(($attrs['FAIstate'] != "") && (!in_array("FAIobject",$attrs['objectClass']))){
-          $attrs['objectClass'][] = "FAIobject";
-        }
-
-        if($attrs['FAIstate'] == ""){
-#FIXME we should check if FAIobject is used anymore
-          $attrs['FAIstate'] = array();
-        }
-
-        $ldap->cd($this->dn);
-        $ldap->modify($attrs);
-        show_ldap_error($ldap->get_error(), sprintf(_("Saving of system terminal/generic (FAIstate) with dn '%s' failed."),$this->dn));
-      }
-
-      switch($_POST['saction']){
-        case 'wake':
-          $cmd= $this->config->search("termgeneric", "WAKECMD",array('tabs'));
-
-          if ($cmd == ""){
-            print_red(_("No WAKECMD definition found in your gosa.conf"));
-          } else {
-            exec ($cmd." ".$this->netConfigDNS->macAddress, $dummy, $retval);
-            if ($retval != 0){
-              print_red(sprintf(_("Execution of '%s' failed!"), $cmd));
-            }
-          }
-          break;
-
-        case 'reboot':
-          $cmd= $this->config->search("termgeneric", "REBOOTCMD",array('tabs'));
-          if ($cmd == ""){
-            print_red(_("No REBOOTCMD definition found in your gosa.conf"));
-          } else {
-            exec ($cmd." ".$this->cn, $dummy, $retval);
-            if ($retval != 0){
-              print_red(sprintf(_("Execution of '%s' failed!"), $cmd));
-            }
-          }
-          break;
-
-        case 'halt':
-          $cmd= $this->config->search("termgeneric", "HALTCMD",array('tabs'));
-          if ($cmd == ""){
-            print_red(_("No HALTCMD definition found in your gosa.conf"));
-          } else {
-            exec ($cmd." ".$this->cn, $dummy, $retval);
-            if ($retval != 0){
-              print_red(sprintf(_("Execution of '%s' failed!"), $cmd));
-            }
-          }
-          break;
-      }
-    }
-
-    /* Base select dialog */
-    $once = true;
-    foreach($_POST as $name => $value){
-      if(preg_match("/^chooseBase/",$name) && $once && $this->acl_is_moveable()){
-        $once = false;
-        $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
-        $this->dialog->setCurrentBase($this->base);
-      }
-    }
-
-    /* Dialog handling */
-    if(is_object($this->dialog)){
-      /* Must be called before save_object */
-      $this->dialog->save_object();
-
-      if($this->dialog->isClosed()){
-        $this->dialog = false;
-      }elseif($this->dialog->isSelected()){
-
-        /* A new base was selected, check if it is a valid one */
-        $tmp = $this->get_allowed_bases();
-        if(isset($tmp[$this->dialog->isSelected()])){
-          $this->base = $this->dialog->isSelected();
-        }
-        $this->dialog= false;
-      }else{
-        return($this->dialog->execute());
-      }
-    }
-
-    /* Do we represent a valid terminal? */
-    if (!$this->is_account && $this->parent === NULL){
-      $display= "<img alt=\"\" src=\"images/stop.png\" align=middle>&nbsp;<b>".
-        _("This 'dn' has no terminal features.")."</b>";
-      return($display);
-    }
-
-    /* Add new ntp Server to our list */
-    if((isset($_POST['addNtpServer'])) && (isset($_POST['gotoNtpServers'])) && $this->acl_is_writeable("gotoNtpServer")){
-      $this->gotoNtpServer[$_POST['gotoNtpServers']] = $_POST['gotoNtpServers'];
-    }
-
-    /* Delete selected NtpServer for list of used servers  */
-    if((isset($_POST['delNtpServer'])) && (isset($_POST['gotoNtpServerSelected'])) && $this->acl_is_writeable("gotoNtpServer")){
-      foreach($_POST['gotoNtpServerSelected'] as $name){
-        unset($this->gotoNtpServer[$name]);
-      } 
-    }
-
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-    
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translation){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-
-    $smarty->assign("cn", $this->cn);
-    $smarty->assign("staticAddress", "");
-
-    $smarty->assign("bases", $this->get_allowed_bases());
-
-    /* tell smarty the inherit checkbox state */
-    $smarty->assign("inheritTimeServer",$this->inheritTimeServer);
-
-    /* Check if terminal is online */
-    $query= "fping -q -r 1 -t 500 ".$this->cn;
-    exec ($query, $dummy, $retval);
-
-    /* Offline */
-    if ($retval == 0){
-      $smarty->assign("actions", array( "halt" => _("Switch off"), 
-                                        "reboot" => _("Reboot"),
-                                        "memcheck" => _("Memory test"),
-                                        "sysinfo"  => _("System analysis")));
-    } else {
-      $smarty->assign("actions", array("wake" => _("Wake up"),
-                                       "memcheck" => _("Memory test"),
-                                       "sysinfo"  => _("System analysis")));
-    }
-
-    /* Arrays */
-    $smarty->assign("modes", $this->modes);
-
-    $tmp2 = array(); 
-    foreach($this->config->data['SERVERS']['NFS'] as $server){
-      if($server != "default"){
-        $tmp2[$server]= $server;
-      }else{
-        if($this->member_of_ogroup){
-          $tmp2[$server]="["._("inherited")."]";
-        }
-      }
-    }
-  
-    $smarty->assign("nfsservers",     $tmp2);
-    $smarty->assign("syslogservers",  $this->gotoSyslogServers);
-
-    $tmp = array();
-    foreach($this->gotoNtpServers as $server){
-      if(!in_array($server,$this->gotoNtpServer)){
-        $tmp[$server] = $server;
-      }
-    }
-    
-    $smarty->assign("ntpservers",     $tmp);
-    $smarty->assign("fai_activated",$this->fai_activated);
-
-    /* Variables */
-    foreach(array("base", "gotoMode", "gotoTerminalPath", "gotoSwapServer","gotoSyslogServer", "gotoNtpServer") as $val){
-      $smarty->assign($val."_select", $this->$val);
-    }
-
-    $smarty->assign("member_of_ogroup",$this->member_of_ogroup);
-
-    /* Show main page */
-    $str = $this->netConfigDNS->execute();
-    if(is_object($this->netConfigDNS->dialog)){
-      return($str);
-    }
-    $smarty->assign("netconfig", $str);
-    return($smarty->fetch (get_template_path('terminal.tpl', TRUE)));
-  }
-
-  function remove_from_parent()
-  {
-    if($this->acl_is_removeable()){   
-      $ldap= $this->config->get_ldap_link();
-      $ldap->cd($this->dn);
-      $ldap->cat($this->dn, array('dn'));
-      if($ldap->count()){
-        $this->netConfigDNS->remove_from_parent();
-        $ldap->rmDir($this->dn);
-  
-        new log("remove","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-  
-        show_ldap_error($ldap->get_error(), sprintf(_("Removing of object system terminal/generic with dn '%s' failed."),$this->dn));
-
-        /* Optionally execute a command after we're done */
-        $this->handle_post_events("remove",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
-
-        /* Delete references to object groups */
-        $ldap->cd ($this->config->current['BASE']);
-        $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
-        while ($ldap->fetch()){
-          $og= new ogroup($this->config, $ldap->getDN());
-          unset($og->member[$this->dn]);
-          $og->save ();
-        }
-      }
-    }
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    /* Create a base backup and reset the
-       base directly after calling plugin::save_object();
-       Base will be set seperatly a few lines below */
-    $base_tmp = $this->base;
-    plugin::save_object();
-    $this->base = $base_tmp;
-
-    /* Set new base if allowed */
-    $tmp = $this->get_allowed_bases();
-    if(isset($_POST['base'])){
-      if(isset($tmp[$_POST['base']])){
-        $this->base= $_POST['base'];
-      }
-    }
-    
-    $this->netConfigDNS->save_object();
-
-    /* Save terminal path to parent since it is used by termstartup, too */
-    if(isset($this->parent->by_object['termstartup'])){
-      $this->parent->by_object['termstartup']->gotoTerminalPath= $this->gotoTerminalPath;
-    }
-    
-    if(isset($_POST['termgeneric_posted'])){
-      if(isset($_POST["inheritTimeServer"]) && $this->member_of_ogroup){
-        $this->inheritTimeServer = true;
-      }else{
-        $this->inheritTimeServer = false;
-      }
-    }  
-
-    if(isset($_POST["inheritAll"])){
-      $this->set_everything_to_inherited();
-    }
-
-  }
-
-
-  /* Check supplied data */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    /* Skip IP & Mac checks if this is a template */
-    if($this->cn != "default"){
-      $message= array_merge($message, $this->netConfigDNS->check());
-    }
-
-    /* Permissions for that base? */
-    $this->dn= "cn=".$this->cn.",ou=terminals,ou=systems,".$this->base;
-
-    if ($this->cn == ""){
-      $message[]= _("The required field 'Terminal name' is not set.");
-    }
-
-    /* Check if given name is a valid host/dns name */
-    if(!is_dns_name($this->cn) ){
-      $message[] = _("Please specify a valid name for this object.");
-    }
-
-    if ($this->orig_dn == 'new'){
-      $ldap= $this->config->get_ldap_link();
-      $ldap->cd ($this->base);
-
-      /* It is possible to have a 'default' terminal on every base */
-      if($this->cn == "default"){
-        $ldap->cat($this->dn);
-      }else{
-        $ldap->search ("(&(objectClass=gotoTerminal)(cn=".$this->cn."))", array("cn"));
-      }
-      if ($ldap->count() != 0){
-        while ($attrs= $ldap->fetch()){
-          if (preg_match("/cn=dhcp,/",$attrs['dn']) || preg_match ("/,ou=incoming,/", $ldap->getDN())){
-            continue;
-          } else {
-            if ($attrs['dn'] != $this->orig_dn){
-              $message[]= sprintf (_("There is already an entry '%s' in the base choosen by you"), $this->cn);
-              break;
-            }
-          }
-        }
-      }
-    }
-
-    /* Check for valid ntpServer selection */
-    if((!$this->inheritTimeServer) && (!count($this->gotoNtpServer))){
-      $message[]= _("There must be at least one NTP server selected, or the inherit mode activated.");
-    }
-
-    return ($message);
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-
-    /* Move object if requested */
-    if( $this->orig_dn != 'new' && $this->dn != $this->orig_dn){
-      $this->move($this->orig_dn, $this->dn);
-    }
-
-    plugin::save();
-
-    /* Strip out 'default' values */
-    foreach (array("gotoTerminalPath", "gotoSwapServer", "gotoSyslogServer") as $val){
-      if(isset($this->attrs[$val])){
-        if ($this->attrs[$val] == "default"){
-          $this->attrs[$val]= array();
-        }
-      }
-    }
-
-    /* Add missing arrays */
-    foreach (array("ghScsiDev", "ghIdeDev", "ghNetNic") as $val){
-      if (isset ($this->$val) && count ($this->$val) != 0){
-        $this->attrs["$val"]= $this->$val;
-      }
-    }
-
-    /* Remove all empty values */
-    if ($this->orig_dn == 'new'){
-      $attrs= array();
-      foreach ($this->attrs as $key => $val){
-        if (is_array($val) && count($val) == 0){
-          continue;
-        }
-        $attrs[$key]= $val;
-      }
-      $this->attrs= $attrs;
-    }
-
-    /* Set ntpServers */
-    $this->attrs['gotoNtpServer'] = array();
-    if(!$this->inheritTimeServer){
-      foreach($this->gotoNtpServer as $server){
-        $this->attrs['gotoNtpServer'][] = $server;
-      }
-    }
-
-    /* Append gosaAdministrativeUnitTag to objectClass if gosaUnitTag isset */
-    if(($this->gosaUnitTag) && (!in_array_ics("gosaAdministrativeUnitTag",$this->attrs['objectClass']))){
-      $this->attrs['objectClass'][] = "gosaAdministrativeUnitTag";
-    }
-
-    /* Write back to ldap */
-    $ldap= $this->config->get_ldap_link();
-    if ($this->orig_dn == 'new'){
-      $ldap->cd($this->config->current['BASE']);
-      $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
-      $ldap->cd($this->dn);
-      if (!count($this->attrs['gotoNtpServer'])){
-        unset($this->attrs['gotoNtpServer']);
-      }
-      $ldap->add($this->attrs);
-      new log("create","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-      $this->handle_post_events("add",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
-    } else {
-      $ldap->cd($this->dn);
-      $this->cleanup();
-      $ldap->modify ($this->attrs); 
-      new log("modify","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-      $this->handle_post_events("modify",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
-    }
-    
-    /* cn=default and macAddress=- indicates that this is a template */
-    if($this->cn == "default"){
-      $this->netConfigDNS->macAddress = "-";
-    }
-
-    $this->netConfigDNS->cn = $this->cn;
-    $this->netConfigDNS->save();
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of object system terminal/generic with dn '%s' failed."),$this->dn));
-  }
-
-
-
-
-
-  /* Display generic part for server copy & paste */
-  function getCopyDialog()
-  {
-    $vars = array("cn");
-    $smarty = get_smarty();
-    $smarty->assign("cn" ,$this->cn);
-    $smarty->assign("object","terminal");
-    $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE));
-    $ret = array();
-    $ret['string'] = $str;
-    $ret['status'] = "";
-    return($ret);
-  }
-
-
-  function saveCopyDialog()
-  {
-    if(isset($_POST['cn'])){
-      $this->cn = $_POST['cn'];
-    }
-  }
-
-
-  function PrepareForCopyPaste($source)
-  {
-    plugin::PrepareForCopyPaste($source);
-    if(isset($source['macAddress'][0])){
-      $this->netConfigDNS->macAddress = $source['macAddress'][0];
-    }
-    if(isset($source['ipHostNumber'][0])){
-      $this->netConfigDNS->ipHostNumber = $source['ipHostNumber'][0];
-    }
-
-    /* Create used ntp server array */
-    $this->gotoNtpServer= array();
-    if(isset($source['gotoNtpServer'])){
-      $this->inheritTimeServer = false;
-      unset($source['gotoNtpServer']['count']);
-      foreach($source['gotoNtpServer'] as $server){
-        $this->gotoNtpServer[$server] = $server;
-      }
-    }
-
-    /* Set inherit checkbox state */
-    if((in_array("default",$this->gotoNtpServer)) || (count($this->gotoNtpServer)==0)){
-      $this->inheritTimeServer = true;
-      $this->gotoNtpServer=array();
-    }
-  }
-
-
-  /* Return plugin informations for acl handling */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("Terminal"),
-          "plDescription" => _("Terminal generic"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 1,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("terminal" => array( "description"  => _("Terminal"),
-                                                        "objectClass"  => "gotoTerminal")),
-          "plProvidedAcls"=> array(
-            "gotoMode"            => _("Mode"),
-            "gotoTerminalPath"    => _("Root server"),
-            "gotoSwapServer"      => _("Swap server"),
-            "gotoSyslogServer"    => _("Syslog server enabled"),
-            "gotoNtpServer"       => _("Ntp server settings"),
-            "base"                => _("Base"),
-            "cn"                  => _("Name"),
-            "gotoRootPasswd"      => _("Root password"),
-            "FAIstate"            => _("Action flag"))
-          ));
-  }
-
-
-  function set_everything_to_inherited()
-  {
-    $this->gotoTerminalPath  = "default";
-    $this->gotoSwapServer    = "default" ;
-    $this->gotoSyslogServer  = "default";
-    $this->inheritTimeServer = TRUE;
-
-    /* Set workstation service attributes to inherited */
-    if($this->member_of_ogroup && isset($this->parent->by_object['termservice'])){
-      foreach(array("gotoXKbLayout","gotoXKbModel","gotoXKbVariant",
-            "gotoXResolution","gotoXColordepth","gotoXMouseType","gotoXMouseport") as $name){
-        $this->parent->by_object['termservice']->$name = "default";
-      }
-    }
-
-    /* Set workstation startup attributes to inherited */
-    if($this->member_of_ogroup && isset($this->parent->by_object['termstartup'])){
-      $this->parent->by_object['termstartup']->gotoBootKernel = "default-inherited";
-      $this->parent->by_object['termstartup']->gotoLdapServer = "default-inherited";
-    }
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_terminalInfo.inc b/plugins/admin/systems/class_terminalInfo.inc
deleted file mode 100644 (file)
index 0a21884..0000000
+++ /dev/null
@@ -1,255 +0,0 @@
-<?php
-
-class terminfo extends plugin
-{
-  /* CLI vars */
-  var $cli_summary= "Retrieve informations about terminals";
-  var $cli_description= "Some longer text\nfor help";
-  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* Generic terminal attributes */
-  var $ghCpuType= "-";
-  var $ghMemSize= "-";
-  var $macAddress= "-";
-  var $ghUsbSupport= "-";
-  var $ghNetNic= array();
-  var $ghIdeDev= array();
-  var $ghScsiDev= array();
-  var $ghGfxAdapter= "-";
-  var $ghSoundAdapter= "-";
-  var $ghInventoryNumber= "-";
-  var $gotoLastUser= "-";
-  var $gotoFloppyEnable= "";
-  var $gotoCdromEnable= "";
-
-  /* Needed values and lists */
-  var $base= "";
-  var $cn= "";
-  var $view_logged = FALSE;
-
-  /* attribute list for save action */
-  var $ignore_account= TRUE;
-  var $attributes= array("cn", "gotoMode", "gotoTerminalPath", "gotoFloppyEnable",
-      "gotoCdromEnable", "ghInventoryNumber",
-      "gotoSwapServer", "gotoSyslogServer", "gotoNtpServer",
-      "ghCpuType", "ghMemSize", "macAddress", "ghUsbSupport",
-      "ghGfxAdapter", "ghSoundAdapter", "gotoLastUser");
-  var $objectclasses= array("GOhard");
-
-  function terminfo (&$config, $dn= NULL, $parent= NULL)
-  {
-    plugin::plugin ($config,$dn);
-
-    /* Read arrays */
-    foreach (array("ghNetNic", "ghIdeDev", "ghScsiDev") as $val){
-      if (!isset($this->attrs[$val])){
-        continue;
-      }
-      for ($i= 0; $i<$this->attrs[$val]['count']; $i++){
-        array_push($this->$val, $this->attrs[$val][$i]);
-      }
-    }
-
-    /* Fix USB entry */
-    if ($this->ghUsbSupport == "true"){
-      $this->ghUsbSupport= _("present");
-    }
-  }
-
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","terminal/".get_class($this),$this->dn);
-    }
-
-    /* Do we represent a valid terminal? */
-    if (!$this->is_account && $this->parent === NULL){
-      echo "<img alt=\"\" src=\"images/stop.png\" align=middle>&nbsp;<b>".
-        _("This 'dn' has no terminal features.")."</b>";
-      return;
-    }
-
-    $smarty= get_smarty();
-    $display= "";
-    if(!is_callable("snmpget")){
-      print_red(_("There is no php snmp module installed, can't gather any informations."));
-
-      $smarty->assign("load", progressbar(0,100,15,true));
-      $smarty->assign("mem", progressbar(0,100,15,true));
-      $smarty->assign("swap", progressbar(0,100,15,true));
-      foreach(array("uptime", "sshd", "X", "saned", "artsd", "cupsd","status","ghNetNic", "ghIdeDev", "ghScsiDev","FloppyDevice", "CdromDevice","active") as $val){
-        $smarty->assign("$val", "<i>"._("unknown status")."</i>");
-      }
-
-
-      $display ="";
-    }else
-      /* Default entry? */
-      if ($this->cn == "default"){
-        $display= "<div style='height:150px;'><br><b>";
-        $display.= _("This is a virtual terminal which has no properties to show here.");
-        $display.= "</b></div>";
-      } else {
-
-        /* Get template object */
-        $smarty->assign("staticAddress", "");
-
-        /* Prevent undefined variable .... */ 
-        $smarty->assign("load", progressbar(0,100,15,true));
-        $smarty->assign("mem", progressbar(0,100,15,true));
-        $smarty->assign("swap", progressbar(0,100,15,true));
-
-        /* Check if terminal is online */
-        $query= "fping -q -r 1 -t 500 ".$this->cn;
-        exec ($query, $dummy, $retval);
-
-        if ($retval == 0){
-          $smarty->assign("status", _("online"));
-          $smarty->assign("active", "true");
-
-          /* Fill data if we have snmp */
-          $host= $this->cn;
-
-          /* Use 'goto' as snmp community or the configured value from the config */
-          $community= 'goto';
-          $str = search_config($this->config->data['TABS'],"terminfo","SNMPCOMMUNITY");
-          if(!empty($str)){
-            $community = $str;
-          }
-
-          /* Get memory informations */
-          if(!is_callable("snmpget")){
-            $MemFree = false;
-          }else{
-            $MemFree= @snmpget($host, $community, "UCD-SNMP-MIB::memory.memAvailReal.0");
-          }
-          if ($MemFree != FALSE){
-            $MemFree= preg_replace('/^.*[=:] ([0-9.]+)$/', '\\1', $MemFree);
-            $MemTotal= @snmpget($host, $community, "UCD-SNMP-MIB::memory.memTotalReal.0");
-            $MemTotal= preg_replace('/^.*[=:] ([0-9.]+)$/', '\\1', $MemTotal);
-            if ($MemTotal != 0){
-              $smarty->assign("mem",progressbar( (int)(($MemTotal - $MemFree)*100/$MemTotal),100,15,true));
-              ;
-            }
-            $SwapFree= @snmpget($host, $community, "UCD-SNMP-MIB::memory.memAvailSwap.0");
-            $SwapFree= preg_replace('/^.*[=:] ([0-9.]+)$/', '\\1', $SwapFree);
-            $SwapTotal= @snmpget($host, $community, "UCD-SNMP-MIB::memory.memTotalSwap.0");
-            $SwapTotal= preg_replace('/^.*[=:] ([0-9.]+)$/', '\\1', $SwapTotal);
-            if ($SwapTotal != 0){
-#$smarty->assign("swap", (int)(($SwapTotal - $SwapFree)*100/$SwapTotal));
-              $smarty->assign("swap", progressbar(0,100,15,true));
-            }
-
-            /* Get system uptime */
-            $sysup= @snmpget($host, $community, "SNMPv2-MIB::sysUpTime.0");
-            $smarty->assign("uptime", preg_replace('/^.* ([0-9:]+)\..*$/', '\\1', $sysup));
-
-            /* Get system load */
-            $sysload= @snmpget($host, $community, "UCD-SNMP-MIB::laLoad.2");
-            $sysload= preg_replace('/^.*[=:] ([0-9.]+)$/', '\\1', $sysload);
-
-            $smarty->assign("load", progressbar($sysload*100,100,15,true));
-
-            /* Get status for key processes */
-            $processes= @snmpwalk($host, $community, "UCD-SNMP-MIB::prNames");
-            $check4= array("sshd", "cupsd", "artsd", "X", "saned");
-            foreach ($check4 as $pname){
-              $eflag= -1;
-              foreach ($processes as $key => $val){
-                $process= preg_replace('/^.*[:=] (.*)$/', '\\1', $val);
-                if ($process == $pname){
-                  $index= preg_replace('/^.*\.([0-9]+) [:=] .*$/', '\\1', $val);
-                  $res= @snmpget($host, $community, "UCD-SNMP-MIB::prErrorFlag.$index");
-                  $eflag= preg_replace('/^.*[:=] /', '', $res);
-                  break;
-                }
-              }
-              switch ($eflag){
-                case 0:
-                  $smarty->assign("$pname", "<img alt=\""._("running")."\" src=\"images/true.png\">");
-                  break;
-                case 1:
-                  $smarty->assign("$pname", "<img alt=\""._("not running")."\" src=\"images/false.png\">");
-                  break;
-                default:
-                  $smarty->assign("$pname", _("not defined"));
-              }
-            }
-          } else {
-            foreach(array("uptime", "sshd", "X", "saned", "artsd", "cupsd") as $val){
-              $smarty->assign("$val", "<i>"._("unknown status")."</i>");
-            }
-          }
-          /* Check for mounted partitions (show max 8 partitions) */
-          $partitions= "";
-          for ($n= 1; $n<9; $n++){
-            $device= @snmpget($host, $community, "UCD-SNMP-MIB::dskDevice.$n");
-            if ($device == ""){
-              break;
-            }
-            $device= preg_replace('/^STRING: */', '', $device);
-            $usage= @snmpget($host, $community, "UCD-SNMP-MIB::dskPercent.$n");
-            $usage= preg_replace('/^INTEGER: */', '', $usage);
-            $partitions.= "<tr><td><b>$device</b></td><td>".progressbar($usage,100,16,true)."</td></tr>\n";
-          }
-          $smarty->assign("partitions", $partitions);
-        } else {
-          $smarty->assign("status", _("offline"));
-          $smarty->assign("active", "false");
-        }
-
-        /* Set floppy and cdrom status */
-        foreach(array("Floppy", "Cdrom") as $val){
-          $name= "goto".$val."Enable";
-          if ($this->$name == "YES"){
-            $status= _("present");
-          } else {
-            $status= "-";
-          }
-          $smarty->assign($val."Device", $status);
-        }
-
-        /* Show main page */
-        foreach(array("ghNetNic", "ghIdeDev", "ghScsiDev") as $val){
-          if (!count($this->$val)){
-            $this->$val= "-";
-          }
-          $smarty->assign($val, $this->$val);
-        }
-      }
-      foreach(array("ghCpuType", "ghMemSize", "macAddress", "ghUsbSupport",
-            "ghGfxAdapter", "ghSoundAdapter", "gotoLastUser", "ghInventoryNumber") as $val){
-
-        $smarty->assign($val, $this->$val);
-      }
-      $display= $smarty->fetch (get_template_path('info.tpl', TRUE));
-
-    return ($display);
-  }
-
-  function remove_from_parent()
-  {
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    plugin::save_object();
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-  }
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_terminalService.inc b/plugins/admin/systems/class_terminalService.inc
deleted file mode 100644 (file)
index 49f8046..0000000
+++ /dev/null
@@ -1,527 +0,0 @@
-<?php
-
-class termservice extends plugin
-{
-  /* CLI vars */
-  var $cli_summary= "Manage terminal service aspects";
-  var $cli_description= "Some longer text\nfor help";
-  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* Generic terminal attributes */
-  var $gotoLpdEnable= FALSE;
-  var $gotoXMonitor= "";
-  var $gotoXMethod= "";
-  var $gotoXdmcpServer= "";
-  var $gotoFontPath= "";
-  var $gotoXDriver= "";
-  var $gotoXResolution= "";
-  var $gotoXColordepth= "";
-  var $gotoXHsync= "";
-  var $gotoXVsync= "";
-  var $gotoXKbModel= "";
-  var $gotoXKbLayout= "";
-  var $gotoXKbVariant= "";
-  var $gotoXMouseType= "";
-  var $gotoXMouseport= "";
-  var $gotoLpdServer= "";
-  var $gotoScannerEnable= "";
-  var $gotoScannerModel= "";
-  var $gotoScannerClients= "";
-  var $gotoScannerBackend= "";
-  var $goFonHardware= "automatic";
-
-  var $AutoSync = false;
-  var $view_logged = FALSE;
-
-  /* Needed values and lists */
-  var $ignore_account= TRUE;
-  var $base= "";
-  var $cn= "";
-  var $orig_dn= "";
-  var $XMethods= array();
-  var $XDrivers= array();
-  var $XResolutions= array();
-  var $XColordepths= array();
-  var $XKbModels= array ();
-  var $XKbLayouts= array ();
-  var $XKbVariants= array ();
-  var $MouseTypes= array();
-  var $MousePorts= array();
-  var $gotoScannerModels= array();
-  var $hardware_list= array();
-  var $used_hardware= array();
-
-
-  /* attribute list for save action */
-  var $attributes= array("cn", "gotoLpdEnable", "gotoXMonitor", "gotoXMethod", "gotoXdmcpServer",
-      "gotoFontPath", "gotoXDriver", "gotoXResolution", "gotoXColordepth",
-      "gotoXHsync", "gotoXVsync", "gotoLpdEnable", "gotoLpdServer",
-      "gotoScannerEnable", "gotoScannerModel", "gotoScannerClients",
-      "gotoScannerBackend", "gotoXKbModel", "gotoXKbLayout", "gotoXKbVariant",
-      "gotoXMouseType", "gotoXMouseport", "goFonHardware");
-  var $objectclasses= array("GOhard");
-
-
-  function termservice (&$config, $dn= NULL, $parent= NULL)
-  {
-    plugin::plugin ($config, $dn, $parent);
-   
-    /* Get list of available xdrivers */
-    $this->XDrivers = $this->getListOfXDrivers();
-    array_unshift($this->XDrivers, "["._("unknown")."]");
-    
-    $this->XResolutions= array(
-        "default"   =>  "["._("inherited")."]"  ,
-        "640x480"   =>  "640x480",
-        "800x600"   =>  "800x600",
-        "1024x768"  =>  "1024x768",
-        "1152x864"  =>  "1152x864",
-        "1280x1024" =>  "1280x1024",
-        "1400x1050" =>  "1400x1050",
-        "1600x1200" =>  "1600x1200");
-
-    if(isset($this->config->data['MAIN']['RESOLUTION_HOOK'])){
-      $file = $this->config->data['MAIN']['RESOLUTION_HOOK'];
-
-      if(is_readable($file)){
-        $str = file_get_contents($file);
-        $lines = split("\n",$str);
-        foreach($lines as $line){
-          $line = trim($line);
-          if(!empty($line)){
-            $this->XResolutions[$line]=$line;
-          }
-        }
-        //natcasesort($this->gotoXResolutions);
-      }else{
-        print_red(sprintf(_("You have specified an external resolution hook which can't be read, please check the permission of the file '%s'."),$file));
-      }
-    }
-
-    $this->XColordepths= array(
-        "default"  => "["._("inherited")."]",
-        "8"        => "8 " ._("bit"),
-        "15"       => "15 "._("bit"),
-        "16"       => "16 "._("bit"),
-        "24"       => "24 "._("bit"));
-
-    $this->XKbModels['default']= "["._("inherited")."]";
-    foreach(array ("btc9000", "chicony", "compaq", "dell", "dell101", "everex",
-          "flexpro", "geniuscomfy", "hp", "itouch", "jp106", "logicordless",
-          "logiinetnav", "logiinternet", "macintosh", "microsoft",
-          "microsoftpro", "omnikey101", "pc101", "pc102", "pc104",
-          "pc105", "rapidaccess", "rapidaccess2", "winbook") as $type){
-      $this->XKbModels[$type] = $type;
-    }
-
-    /* Additional values will be extracted from CONFIG_DIR.keyboardLayouts */
-    $this->XKbLayouts= array ("default"=>"["._("inherited")."]","de"=> "de","intl" =>"intl","us" =>"us");
-    $this->XKbVariants= array ("default"=>"["._("inherited")."]", "nodeadkeys"=>"nodeadkeys", "basic"=>"basic");
-
-    $this->MouseTypes= array( "AUTO"      =>  "["._("inherited")."]" ,  "ImPS/2"      => "ImPS/2", 
-                              "PS/2"      =>  "PS/2"                 ,  "Microsoft"   => "Microsoft", 
-                              "Logitech"  =>  "Logitech");
-
-    $this->MousePorts= array("AUTO"             =>"["._("inherited")."]"   , "/dev/ttyS0"  => "/dev/ttyS0", 
-                             "/dev/ttyS1"       => "/dev/ttyS1"            , "/dev/psaux"  => "/dev/psaux", 
-                             "/dev/input/mice"  =>"/dev/input/mice");
-
-    /* try to read additional keyboard layouts
-     */
-    if(file_exists(CONFIG_DIR."/keyboardLayouts")){
-      if(is_readable(CONFIG_DIR."/keyboardLayouts")){
-        $str = file_get_contents(CONFIG_DIR."/keyboardLayouts");
-        $tmp = split("\n",$str);
-        foreach($tmp as $entry){
-          if((!empty($entry)) && (!preg_match("/^#/",$entry))){
-            $entry = trim($entry);
-            $tmp2 = split ("\:",$entry);
-            $la =   trim($tmp2[0]);   // What would be saved to ldap
-            $da =   trim($tmp2[1]);   // This wis displayed in the listbox
-            $this->XKbLayouts [ $la] = $da;
-          }
-        }
-      }
-    }
-
-    /* Load scanner models */
-    $fcontents = file ($this->config->basedir."/include/scanner.inc");
-    while (list ($line_num, $line) = each ($fcontents)) {
-      preg_match('/^(\w+) "([^"]+)" "([^"]+)" "([^"]+)"/', "$line", $matches);
-      $this->gotoScannerModels[$matches[2]." - ".$matches[3]]= $matches[1]."|".$matches[4];
-    }
-    ksort ($this->gotoScannerModels);
-
-    /* Initialize methods */
-    $this->XMethods["default"]= _("default");
-    $this->XMethods["indirect"]= _("show chooser");
-    $this->XMethods["query"]= _("direct");
-#$this->XMethods["squery"]= _("direct via ssh");
-#$this->XMethods["nquery"]= _("direct via nx");
-    $this->XMethods["load"]= _("load balanced");
-#$this->XMethods["sload"]= _("load balanced via ssh");
-#$this->XMethods["nload"]= _("load balanced via nx");
-    $this->XMethods["rdp"]= _("Windows RDP");
-    $this->XMethods["citrix"]= _("ICA client");
-
-    $this->orig_dn= $this->dn;
-
-    /* Load hardware list */
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(objectClass=goFonHardware)", array('cn', 'description'));
-    while ($attrs= $ldap->fetch()){
-      $cn= $attrs['cn'][0];
-      if (isset($attrs['description'])){
-        $description= " - ".$attrs['description'][0];
-      } else {
-        $description= "";
-      }
-      $this->hardware_list[$cn]= "$cn$description";
-    }
-
-    /* Eventually colorize phones */
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(goFonHardware=*)",array('cn','dn','goFonHardware'));
-    while($attrs = $ldap->fetch()){
-        $cn = $attrs['goFonHardware'][0];
-        if(isset($this->hardware_list[$cn])){
-          $this->used_hardware[$cn]= $cn;
-        }
-    }
-
-    $this->hardware_list["automatic"]= _("automatic");
-    ksort($this->hardware_list);
-
-    /* Convert gotoLpdEnable */
-    $this->gotoLpdEnable= preg_match("/yes/i",$this->gotoLpdEnable);
-
-    /* Load hardware list */
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".$this->dn."))");
-    if ($ldap->count() == 1){
-      $map= array("gotoXResolution", "gotoXColordepth", "gotoXKbModel", "gotoXKbLayout",
-                  "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport");
-      $attrs= $ldap->fetch();
-
-      foreach ($map as $name){
-        if (!isset($attrs[$name][0])){
-          continue;
-        }
-
-        switch ($name){
-          case 'gotoXResolution':
-            $this->XResolutions['default'] = _("inherited").' ['.$attrs[$name][0].']' ;
-            break;
-          case 'gotoXColordepth':
-            $this->XColordepths['default'] =  _("inherited").' ['.$attrs[$name][0].' '._('Bit').']';
-            break;
-          case 'gotoXKbModel':
-            $this->XKbModels['default'] =  _("inherited").' ['.$attrs[$name][0].']';
-            break;
-          case 'gotoXKbLayout':
-            $this->XKbLayouts['default'] =  _("inherited").' ['.$attrs[$name][0].']';
-            break;
-          case 'gotoXKbVariant':
-            $this->XKbVariants['default'] = _("inherited").' ['.$attrs[$name][0].']' ;
-            break;
-          case 'gotoXMouseType':
-            $this->MouseTypes['AUTO'] = _("inherited").' ['.$attrs[$name][0].']' ;
-            break;
-          case 'gotoXMouseport':
-            $this->MousePorts['AUTO'] = _("inherited").' ['.$attrs[$name][0].']' ;
-            break;
-        }
-      }
-    }
-    if(preg_match("/\+/",$this->gotoXHsync)){
-      $this->AutoSync = true;
-      $this->gotoXHsync = preg_replace("/\+/","-",$this->gotoXHsync);
-      $this->gotoXVsync = preg_replace("/\+/","-",$this->gotoXVsync);
-    }
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","terminal/".get_class($this),$this->dn);
-    }
-
-    /* Do we need to flip is_account state? */
-    if (isset($_POST['modify_state'])){
-      $this->is_account= !$this->is_account;
-    }
-
-    /* Do we represent a valid terminal? */
-    if (!$this->is_account && $this->parent === NULL){
-      $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\">&nbsp;<b>".
-        _("This 'dn' has no terminal features.")."</b>";
-      return ($display);
-    }
-
-    /* Show main page */
-    $smarty= get_smarty();
-
-    /* Assign acls */
-    $tmp= $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translation){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-
-
-    /* Arrays */ 
-    foreach(array("XMethods", "XDrivers", "XResolutions", "XColordepths",
-          "gotoScannerModels", "XKbModels","XKbVariants",
-          "MouseTypes", "MousePorts") as $val){
-      $smarty->assign("$val", $this->$val);
-    }
-    $smarty->assign("XKbLayouts",   $this->XKbLayouts);
-    $smarty->assign("XKbLayoutKeys",array_flip($this->XKbLayouts));
-  
-    $smarty->assign("xdmcpservers", $this->config->data['SERVERS']['TERMINAL']);
-    $smarty->assign("fontservers", $this->config->data['SERVERS']['FONT']);
-    $smarty->assign("nfsservers", $this->config->data['SERVERS']['NFS']);
-    $smarty->assign("nfsservers", $this->config->data['SERVERS']['NFS']);
-
-    /* Variables - select */
-    foreach(array("gotoXMethod", "gotoXdmcpServer", "gotoFontPath", 
-          "gotoXDriver", "gotoXResolution", "gotoXColordepth", 
-          "gotoLpdServer", "gotoScannerModel", "gotoXKbModel", "gotoXKbLayout",
-          "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport") as $val){
-
-      $smarty->assign($val."_select", $this->$val);
-    }
-
-    /* Variables */
-    foreach(array("gotoXHsync", "gotoXVsync") as $val){
-      $smarty->assign($val, $this->$val);
-    }
-    $smarty->assign("staticAddress", "");
-
-    /* Checkboxes */
-    foreach(array("gotoLpdEnable", "gotoScannerEnable") as $val){
-      if ($this->$val == TRUE) {
-        $smarty->assign("$val", "checked");
-      } else {
-        $smarty->assign("$val", "");
-      }
-    }
-
-    /* Phone stuff */
-    $smarty->assign ("goFonHardware", $this->goFonHardware);
-    $hl= "<select size=\"1\" name=\"goFonHardware\" title=\"".
-         _("Choose the phone located at the current terminal")."\" >\n";
-    foreach ($this->hardware_list as $cn => $description){
-      if ($cn == $this->goFonHardware){
-        $selected= "selected";
-      } else {
-        $selected= "";
-      }
-      if (isset($this->used_hardware[$cn])){
-        $color= "style=\"color:#A0A0A0\"";
-      } else {
-        $color= "";
-      }
-      $hl.= "  <option $color label=\"$cn\" value=\"$cn\" $selected>$description</option>\n";
-    }
-    $hl.= "</select>\n";
-    $smarty->assign ("hardware_list", $hl);
-    $smarty->assign ("gotoXMonitor", $this->gotoXMonitor);
-
-    $smarty->assign("AutoSyncACL",$this->getacl("AutoSync"));
-
-    $smarty->assign("AutoSyncCHK"," ");
-    if($this->AutoSync){
-      $smarty->assign("AutoSyncCHK"," checked ");
-      $smarty->assign("gotoXVsyncACL", preg_replace("/w/","",$this->getacl("gotoXVsync")));
-      $smarty->assign("gotoXHsyncACL", preg_replace("/w/","",$this->getacl("gotoXHsync")));
-    }
-
-    /* Show main page */
-    return($smarty->fetch (get_template_path('terminalService.tpl', TRUE)));
-  }
-
-  function remove_from_parent()
-  {
-    new log("remove","terminal/".get_class($this),$this->dn,array_keys($this->attrs));
-    $this->handle_post_events("remove");
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    plugin::save_object();
-
-    /* Save checkbox state */
-    if (isset ($_POST['gotoXMethod'])){
-      foreach (array("gotoLpdEnable", "gotoScannerEnable") as $val){
-
-        if($this->acl_is_writeable($val)){
-          if (!isset ($_POST["$val"])){
-            $this->$val= FALSE;
-          } else {
-            $this->$val= TRUE;
-          }
-        }
-      }
-    } 
-
-    if(isset($_POST['gotoXDriver'])){
-      if(isset($_POST['AutoSync'])){
-        $this->AutoSync = true;
-      }else{
-        $this->AutoSync = false;
-      }
-    }
-
-    /* Default entries can use blank hsync/vsync entries */
-    if ($this->dn != "" && $this->cn != "default" && $this->cn != "default"){
-
-      /* But only if no auto sync is enabled... */
-      if (!$this->AutoSync){
-
-        /* Check vsync for correct usage */
-        $val= preg_replace ("/\s/", "", $this->gotoXVsync);
-        if (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val) && $this->acl_is_writeable("gotoXVsync")){
-
-          $message[]= _("Please specify a valid VSync range.");
-        } elseif ($this->acl_is_writeable("gotoXVsync")){
-          list($v1,$v2)= preg_split ("/[-+]/", $val);
-          if ($v2 != ""){
-            if ($v1 > $v2){
-              $message[]= _("Please specify a valid VSync range.");
-            }
-          }
-        }
-
-        /* Check hsync for correct usage */
-        $val= preg_replace ("/\s/", "", $this->gotoXHsync);
-        if (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val) && $this->acl_is_writeable("gotoXHsync")){
-
-          $message[]= _("Please specify a valid HSync range.");
-        } elseif ($this->acl_is_writeable("gotoXHsync")){
-          list($v1,$v2)= preg_split ("/[-+]/", $val);
-          if ($v2 != ""){
-            if ($v1 > $v2){
-              $message[]= _("Please specify a valid HSync range.");
-            }
-          }
-        }
-      }
-    }
-  }
-
-
-  /* Check supplied data */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-    return ($message);
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    /* Convert to string */
-    $this->gotoLpdEnable= $this->gotoLpdEnable?"Yes":"No";
-
-    plugin::save();
-
-    /* Strip out 'default' values */
-    foreach(array("gotoXMethod", "gotoXdmcpServer", "gotoFontPath",
-          "gotoXDriver", "gotoXResolution", "gotoXColordepth",
-          "gotoLpdServer", "gotoScannerModel", "gotoXKbModel", "gotoXKbLayout",
-          "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport") as $val){
-
-      if ($this->attrs[$val] == "default"){
-        $this->attrs[$val]= array();
-      }
-    }
-
-    if($this->AutoSync){
-      $this->attrs['gotoXHsync'] = "30+55";
-      $this->attrs['gotoXVsync'] = "50+70";
-    }
-
-    /* Write back to ldap */
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd($this->dn);
-    $this->cleanup();
-    $ldap->modify ($this->attrs); 
-    new log("modify","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of object system terminal/service with dn '%s' failed."),$this->dn));
-    $this->handle_post_events("modify");
-  }
-
-
-  function getListOfXDrivers()
-  {
-    $drivers = array();
-
-    /* Generate a list of xdrivers from CONFIG_DIR/xdrivers */
-    if (file_exists(CONFIG_DIR.'/xdrivers')){
-      $xdrivers = file (CONFIG_DIR.'/xdrivers');
-      foreach ($xdrivers as $line){
-        if (!preg_match ("/^#/", $line)){
-          $drivers[]= trim($line);
-        }
-      }
-    } else {
-      $drivers = array("ati", "atimisc", "chips", "cirrus", "cyrix", "fbdev", "fglrx",
-          "i128", "i740", "i810", "imstt", "mga", "neomagic", "newport", "nsc",  "nv", "nvidia",
-          "r128", "radeon", "rendition", "s3", "s3virge", "savage", "siliconmotion",
-          "sis", "tdfx", "tga", "trident", "tseng", "vesa", "vga", "vmware");
-    }
-    return($drivers);
-  }
-
-
-  /* Return plugin informations for acl handling */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("Service"),
-          "plDescription" => _("Terminal service"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 3,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("terminal"),
-
-          "plProvidedAcls"=> array(
-            "gotoXMonitor"            => _("Monitor"),
-            "gotoXMethod"             => _("Method"),
-            "gotoXdmcpServer"         => _("Remote desktop"),
-            "gotoFontPath"            => _("Font path"),
-            "gotoXDriver"             => _("Gfx driver"),
-            "gotoXResolution"         => _("Gfx resolution"),
-            "gotoXColordepth"         => _("Gfx color depth"),
-            "gotoXHsync"              => _("Hsync"),
-            "gotoXVsync"              => _("Vsync"),
-            "AutoSync"                => _("Auto-Sync"),
-            "gotoLpdEnable"           => _("Printer service enabled"),
-            "gotoLpdServer"           => _("Spool server"),
-            "gotoScannerEnable"       => _("Scanner enabled"),
-            "gotoScannerModel"        => _("Scanner model"),
-            "gotoXKbModel"            => _("Keyboard model"),
-            "gotoXKbLayout"           => _("Keyboard layout"),
-            "gotoXKbVariant"          => _("Keyboard variant"),
-            "gotoXMouseType"          => _("Mouse type"),
-            "gotoXMouseport"          => _("Mouse port"),
-            "goFonHardware"           => _("Telephone hardware"))
-          ));
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_terminalStartup.inc b/plugins/admin/systems/class_terminalStartup.inc
deleted file mode 100644 (file)
index 0174459..0000000
+++ /dev/null
@@ -1,582 +0,0 @@
-<?php
-class termstartup extends plugin
-{
-  /* CLI vars */
-  var $cli_summary= "Manage terminal startup options";
-  var $cli_description= "Some longer text\nfor help";
-  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* Generic terminal attributes */
-  var $bootmode= "G";
-  var $goLdapServerList= array();
-  var $gotoBootKernel= "default-inherit";
-  var $gotoKernelParameters= "";
-  var $gotoLdapServer= "";
-  var $gotoModules= array();
-  var $gotoTerminalPath= "";
-  var $gotoBootKernels= array();
-
-  /* Ldap server list */
-  var $gotoLdapServers    = array();
-  var $gotoLdapServerList = array();
-  var $gotoLdap_inherit   = FALSE;
-
-  /* Share */
-  var $gotoShares         = array();// Currently Share Option
-  var $gotoShare          = "";     // currently selected Share Option
-  var $gotoShareSelections= array();// Available Shares for this account in Listbox format
-  var $gotoAvailableShares= array();// Available Shares for this account
-
-
-  /* attribute list for save action */
-  var $attributes= array("gotoLdapServer", "gotoBootKernel", "gotoKernelParameters","gotoModules");
-  var $objectclasses= array("GOhard");
-  var $view_logged = FALSE;
-
-  /* Helper */
-  var $customParameters= "";
-  var $orig_dn= "";
-  var $ignore_account= TRUE;
-
-  function termstartup (&$config, $dn= NULL, $parent= NULL)
-  {
-    plugin::plugin ($config, $dn, $parent);
-
-    $this->gotoBootKernels = array("default-inherit"=>"["._("inherited")."]");
-
-    /* Get arrays */
-    foreach (array("gotoModules") as $val){
-      $this->$val = array();
-      if (isset($this->attrs["$val"]["count"])){
-        for ($i= 0; $i<$this->attrs["count"]; $i++){
-          if (isset($this->attrs["$val"][$i])){
-            array_push($this->$val, $this->attrs["$val"][$i]);
-          }
-        }
-      }
-      sort ($this->$val);
-      $this->$val= array_unique($this->$val);
-    }
-
-    /* Parse Kernel Parameters to decide what boot mode is enabled */
-    if (preg_match("/ splash=silent/", $this->gotoKernelParameters)){
-      $this->bootmode= "G";
-    } elseif (preg_match("/ debug/", $this->gotoKernelParameters)){
-      $this->bootmode= "D";
-    } elseif ($this->gotoKernelParameters == "") {
-      $this->bootmode= "G";
-    } else {
-      $this->bootmode= "T";
-    }
-    if (preg_match("/ o /", $this->gotoKernelParameters)){
-      $this->customParameters= preg_replace ("/^.* o /", "", $this->gotoKernelParameters);
-    } else {
-      $this->customParameters= "";
-    }
-
-    /* Prepare Shares */
-    if((isset($this->attrs['gotoShare']))&&(is_array($this->attrs['gotoShare']))){
-      unset($this->attrs['gotoShare']['count']);
-      foreach($this->attrs['gotoShare'] as $share){
-        $tmp = $tmp2 = array();
-        $tmp = split("\|",$share);
-        $tmp2['server']      =$tmp[0];
-        $tmp2['name']        =$tmp[1];
-        $tmp2['mountPoint']  =$tmp[2];
-        $this->gotoShares[$tmp[1]."|".$tmp[0]]=$tmp2;
-      }
-    }
-
-    $this->gotoShareSelections= $config->getShareList(true);
-    $this->gotoAvailableShares= $config->getShareList(false);
-
-    $this->orig_dn= $this->dn;
-
-    /* Get list of boot kernels */
-    if (isset($this->config->data['TABS'])){
-      $command= $this->config->search(get_class($this), "KERNELS",array('tabs'));
-
-      if (!check_command($command)){
-        $message[]= sprintf(_("Command '%s', specified as KERNELS hook for plugin '%s' doesn't seem to exist."), $command,
-            get_class($this));
-      } else {
-        $fh= popen($command, "r");
-        while (!feof($fh)) {
-          $buffer= trim(fgets($fh, 256));
-          
-          if(!empty($buffer)){
-          
-            $name=$value = $buffer;
-
-            if(preg_match("/:/",$buffer)){
-              $name = preg_replace("/:.*$/","",$buffer);
-              $value= preg_replace("/^.*:/","",$buffer);
-              $this->gotoBootKernels[$name]= $name.":".$value;
-            }else{
-              $this->gotoBootKernels[$name]= $value;
-            }
-          }
-        }
-        pclose($fh);
-      }
-
-    }
-    
-    foreach($this->config->data['SERVERS']['LDAP'] as $server) {
-      $this->gotoLdapServerList[]= $server;
-    }
-    if(isset($this->attrs['gotoLdapServer'])){
-      unset($this->attrs['gotoLdapServer']['count']);
-      sort($this->attrs['gotoLdapServer']);
-      foreach($this->attrs['gotoLdapServer'] as $value){
-        $this->gotoLdapServers[] = preg_replace("/^[0-9]*:/","",$value);
-      }
-    }
-    if(!count($this->gotoLdapServers)){
-      $this->gotoLdap_inherit = TRUE;
-    }
-
-    /* Load hardware list */
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".$this->dn."))");
-    if ($ldap->count() == 1){
-      $map= array("gotoLdapServer");
-      $attrs= $ldap->fetch();
-
-      foreach ($map as $name){
-        if (!isset($attrs[$name][0])){
-          continue;
-        }
-
-        switch ($name){
-          case 'gotoLdapServer':
-            $this->goLdapServerList= array_merge(array('default-inherit' => _("inherited").' ['.$attrs[$name][0].']' ), $this->goLdapServerList);
-            break;
-        }
-      }
-    }
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","terminal/".get_class($this),$this->dn);
-    }
-
-    /* Do we need to flip is_account state? */
-    if (isset($_POST['modify_state'])){
-      $this->is_account= !$this->is_account;
-    }
-
-    /* Do we represent a valid terminal? */
-    if (!$this->is_account && $this->parent === NULL){
-      $display= "<img alt=\"\" src=\"images/stop.png\" align=middle>&nbsp;<b>".
-        _("This 'dn' has no terminal features.")."</b>";
-      return ($display);
-    }
-
-    /* Add module */
-    if (isset ($_POST['add_module'])){
-      if ($_POST['module'] != "" && $this->acl_is_writeable("gotoMode")){
-        $this->add_list ($this->gotoModules, $_POST['module']);
-      }
-    }
-
-    /* Delete module */
-    if (isset ($_POST['delete_module'])){
-      if (count($_POST['modules_list']) && $this->acl_is_writeable("gotoMode")){
-        $this->del_list ($this->gotoModules, $_POST['modules_list']);
-      }
-    }
-
-    /* Show main page */
-    $smarty= get_smarty();
-
-    /* Assign acls */
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translation){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-
-
-       /* In this section server shares will be defined
-     * A user can select one of the given shares and a mount point
-     *  and attach this combination to his setup.
-     */
-    $smarty->assign("gotoShareSelections",    $this->gotoShareSelections);
-    $smarty->assign("gotoShareSelectionKeys", array_flip($this->gotoShareSelections));
-    $smarty->assign("gotoBootKernels",$this->gotoBootKernels);
-
-    /* if $_POST['gotoShareAdd'] is set, we will try to add a new entry
-     * This entry will be, a combination of mountPoint and sharedefinitions
-     */
-    if(isset($_POST['gotoShareAdd']) && $this->acl_is_writeable("gotoShare")){
-      /* We assign a share to this user, if we don't know where to mount the share */
-      if((!isset($_POST['gotoShareMountPoint']))||(empty($_POST['gotoShareMountPoint']))||(preg_match("/[\|]/i",$_POST['gotoShareMountPoint']))){
-        print_red(_("You must specify a valid mount point."));
-      }else{
-        $a_share = $this->gotoAvailableShares[$_POST['gotoShareSelection']];
-        $s_mount = $_POST['gotoShareMountPoint'];
-        /* Preparing the new assignment */
-        $this->gotoShares[$a_share['name']."|".$a_share['server']]=$a_share;
-        $this->gotoShares[$a_share['name']."|".$a_share['server']]['mountPoint']=$s_mount;
-      }
-    }
-
-    /* if the Post  gotoShareDel is set, someone asked GOsa to delete the selected entry (if there is one selected)
-     * If there is no defined share selected, we will abort the deletion without any message
-     */
-    if((isset($_POST['gotoShareDel']))&&(isset($_POST['gotoShare'])) && $this->acl_is_writeable("gotoShare")){
-      unset($this->gotoShares[$_POST['gotoShare']]);
-    }
-
-    $smarty->assign("gotoShares",$this->printOutAssignedShares());
-    $smarty->assign("gotoShareKeys",array_flip($this->printOutAssignedShares()));
-
-    /* Create divSelectBox for ldap server selection
-     */
-    $SelectBoxLdapServer = new divSelectBox("LdapServer");
-    $SelectBoxLdapServer->SetHeight(80);
-
- /* Add new ldap server to the list */
-    if(!$this->gotoLdap_inherit && isset($_POST['add_ldap_server']) && isset($_POST['ldap_server_to_add'])){
-      if(isset($this->gotoLdapServerList[$_POST['ldap_server_to_add']])){
-        $to_add = $this->gotoLdapServerList[$_POST['ldap_server_to_add']];
-        if(!in_array($to_add,$this->gotoLdapServers)){
-          $this->gotoLdapServers[] = $to_add;
-        }
-      }
-    }
-
-    /* Move ldap servers up and down */
-    if(!$this->gotoLdap_inherit){
-      foreach($_POST as $name => $value){
-        if(preg_match("/sort_ldap_up_/",$name)){
-          $id = preg_replace("/^sort_ldap_up_([0-9]*)_(x|y)$/","\\1",$name);
-          $from =  $id;
-          $to   =  $id -1;
-          $tmp = $this->array_switch_item($this->gotoLdapServers,$from,$to);
-          if($tmp){
-            $this->gotoLdapServers = $tmp;
-          }
-          break;
-        }
-        if(preg_match("/sort_ldap_down_/",$name)){
-          $id = preg_replace("/^sort_ldap_down_([0-9]*)_(x|y)$/","\\1",$name);
-          $from =  $id;
-          $to   =  $id +1;
-          $tmp = $this->array_switch_item($this->gotoLdapServers,$from,$to);
-          if($tmp){
-            $this->gotoLdapServers = $tmp;
-          }
-          break;
-        }
-        if(preg_match("/gotoLdapRemove_/",$name)){
-          $id = preg_replace("/^gotoLdapRemove_([0-9]*)_(x|y)$/","\\1",$name);
-          $value = $this->gotoLdapServers[$id];
-          $this->gotoLdapServers = array_remove_entries(array($value),$this->gotoLdapServers);
-          break;
-        }
-      }
-    }
-  /* Add Entries
-     */
-    foreach($this->gotoLdapServers as $key => $server){
-      if(!in_array($server,$this->gotoLdapServerList)){
-        $server = $server."&nbsp;<font style='color:red'>(missing)</font>";
-      }
-
-      $SelectBoxLdapServer->AddEntry(
-          array(array("string" => $server),
-            array("string" =>
-              "<input class='center' type='image' src='images/sort_up.png' name='sort_ldap_up_".$key."'>&nbsp;".
-              "<input class='center' type='image' src='images/sort_down.png' name='sort_ldap_down_".$key."'>&nbsp;".
-              "<input class='center' type='image' src='images/edittrash.png' name='gotoLdapRemove_".$key."'>",
-              "attach" => "style='text-align:right;width:40px;border-right:0px;'")));
-    }
-
-    if($this->gotoLdap_inherit){
-      $smarty->assign("gotoLdapServerACL_inherit", preg_replace("/w/","",$this->getacl("gotoLdapServer")));;
-    }else{
-      $smarty->assign("gotoLdapServerACL_inherit", $this->getacl("gotoLdapServer"));
-    }
-
-    $list = array();
-    foreach($this->gotoLdapServerList as $key => $entry){
-      if(!in_array($entry,$this->gotoLdapServers)){
-        $list[$key] = $entry;
-      }
-    }
-    $smarty->assign("gotoLdapServers",    $SelectBoxLdapServer->DrawList());
-    $smarty->assign("gotoLdapServerList", $list);
-    $smarty->assign("gotoLdap_inherit",   $this->gotoLdap_inherit);
-    $smarty->assign("JS",  $_SESSION['js']);
-
-    foreach (array("gotoModules" ) as $val){
-      $smarty->assign("$val", $this->$val);
-    }
-
-    /* Values */
-    foreach(array("gotoBootKernel", "customParameters") as $val){
-      $smarty->assign($val, $this->$val);
-    }
-
-    /* Radio button group */
-    if (preg_match("/G/", $this->bootmode)) {
-      $smarty->assign("graphicalbootup", "checked");
-    } else {
-      $smarty->assign("graphicalbootup", "");
-    }
-    if (preg_match("/T/", $this->bootmode)) {
-      $smarty->assign("textbootup", "checked");
-    } else {
-      $smarty->assign("textbootup", "");
-    }
-    if (preg_match("/D/", $this->bootmode)) {
-      $smarty->assign("debugbootup", "checked");
-    } else {
-      $smarty->assign("debugbootup", "");
-    }
-
-    /* Show main page */
-    return($smarty->fetch (get_template_path('terminalStartup.tpl', TRUE)));
-  }
-
-  function remove_from_parent()
-  {
-    if($this->acl_is_removeable()){
-      $this->handle_post_events("remove");
-      new log("remove","terminal/".get_class($this),$this->dn,array_keys($this->attrs));
-    }
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    plugin::save_object();
-
-    if(isset($_POST['TerminalStarttabPosted'])){
-      if(isset($_POST['gotoLdap_inherit'])){
-        $this->gotoLdap_inherit = TRUE;
-      }else{
-        $this->gotoLdap_inherit = FALSE;
-      }
-
-      /* Save group radio buttons */
-      if ($this->acl_is_writeable("bootmode") && isset($_POST["bootmode"])){
-        $this->bootmode= $_POST["bootmode"];
-      }
-
-      /* Save kernel parameters */
-      if ($this->acl_is_writeable("gotoKernelParameters") && isset($_POST["customParameters"])){
-        $this->customParameters= $_POST["customParameters"];
-      }
-    }
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    /* Find proper terminal path for tftp configuration
-       FIXME: This is suboptimal when the default has changed to
-       another location! */
-    if ($this->gotoTerminalPath == "default-inherit"){
-      $ldap= $this->config->get_ldap_link();
-
-      /* Strip relevant part from dn, keep trailing ',' */
-      $tmp= preg_replace("/^cn=[^,]+,ou=terminals,ou=systems,/i", "", $this->dn);
-      $tmp= preg_replace("/".$this->config->current['BASE']."$/i", "", $tmp);
-
-      /* Walk from top to base and try to load default values for
-         'gotoTerminalPath'. Abort when an entry is found. */
-      while (TRUE){
-        $tmp= preg_replace ("/^[^,]+,/", "", $tmp);
-
-        $ldap->cat("cn=default,ou=terminals,ou=systems,$tmp".
-            $this->config->current['BASE'], array('gotoTerminalPath'));
-        $attrs= $ldap->fetch();
-        if (isset($attrs['gotoTerminalPath'])){
-          $this->gotoTerminalPath= $attrs['gotoTerminalPath'][0];
-          break;
-        }
-
-        /* Nothing left? */
-        if ($tmp == ""){
-          break;
-        }
-      }
-    }
-    
-    /* Add semi automatic values */
-    // FIXME: LDAP Server may not be set here...
-    $this->gotoKernelParameters= "root=/dev/nfs nfsroot=".
-      $this->gotoTerminalPath.
-      ",ro,hard,nolock,fg,rsize=8192 ".
-      "ip=::::::dhcp ldap=".base64_encode($this->gotoLdapServer);
-
-    switch ($this->bootmode){
-      case "D":
-        $this->gotoKernelParameters.= " debug";
-      break;
-      case "G":
-        $this->gotoKernelParameters.= " splash=silent";
-      break;
-    }
-    if ($this->customParameters != ""){
-      $this->gotoKernelParameters.= " o ".$this->customParameters;
-    }
-
-    plugin::save();
-
-    /* Add missing arrays */
-    foreach (array("gotoModules") as $val){
-      if (isset ($this->$val) && count ($this->$val) != 0){
-    
-        $this->attrs["$val"]= array_unique($this->$val);
-      }
-      if(!isset($this->attrs["$val"])){
-       $this->attrs["$val"]=array();
-      }
-    }
-
-    /* Prepare list of ldap servers */
-    $this->attrs['gotoLdapServer'] = array();
-    if(!$this->gotoLdap_inherit){
-      $i = 0;
-      foreach($this->gotoLdapServers as $server){
-        $i ++;
-        $this->attrs['gotoLdapServer'][] = $i.":".$server;
-      }
-    }
-
-    /* Strip out 'default' values */
-    foreach(array("gotoBootKernel") as $value){
-      if (!isset($this->attrs[$value]) || $this->attrs[$value] == "default-inherit"){
-        $this->attrs[$value] = array();
-      } 
-    }
-
-     /* prepare share settings */
-    $tmp = array();
-    foreach($this->gotoShares as $name => $settings){
-      $tmp2 = split("\|",$name);
-      $name = $tmp2[0];
-      $tmp[] = $settings['server']."|".$name."|".$settings['mountPoint'];
-    }
-    $this->attrs['gotoShare']=$tmp;
-
-    /* Write back to ldap */
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd($this->dn);
-    
-    $this->cleanup();
-    $ldap->modify ($this->attrs); 
-
-    new log("modify","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of system terminal/startup with dn '%s' failed."),$this->dn));
-    $this->handle_post_events("modify");
-  }
-
-  /* Add value to array, check if unique */
-  function add_list (&$array, $value)
-  {
-    if ($value != ""){
-      $array[]= $value;
-      sort($array);
-      array_unique ($array);
-    }
-  }
-
-
-  /* Delete value to array, check if unique */
-  function del_list (&$array, $list)
-  {
-    $tmp= array();
-    foreach ($array as $mod){
-      if (!in_array($mod, $list)){
-        $tmp[]= $mod;
-      }
-    }
-    $array= $tmp;
-  }
-
-   /* Generate ListBox frindly output for the defined shares
-   * Possibly Add or remove an attribute here,
-   */
-  function printOutAssignedShares()
-  {
-    $a_return = array();
-    if(is_array($this->gotoShares)){
-      foreach($this->gotoShares as $share){
-        $a_return[$share['name']."|".$share['server']]= $share['name']." [".$share['server']."]";
-      }
-    }
-    return($a_return);
-  }
-
-
-  function PrepareForCopyPaste($source)
-  {
-    plugin::PrepareForCopyPaste($source);
-
-    $source_o = new termstartup ($this->config, $source['dn']);
-
-    foreach(array("gotoModules", "gotoKernelParameters","gotoShares","customParameters","bootmode","gotoTerminalPath","gotoShares","goLdapServerList","gotoBootKernel","gotoLdapServer","gotoBootKernels") as $attr){
-      $this->$attr = $source_o->$attr;
-    }
-  }
-
-
-  function array_switch_item($ar,$from,$to)
-  {
-    if(!is_array($ar)){
-      return(false);
-    }
-    if(!isset($ar[$from])){
-      return(false);
-    }
-    if(!isset($ar[$to])){
-      return(false);
-    }
-
-    $tmp = $ar[$from];
-    $ar[$from] = $ar[$to];
-    $ar[$to] = $tmp;
-    return($ar);
-  }
-
-
-  /* Return plugin informations for acl handling */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("Startup"),
-          "plDescription" => _("Terminal startup"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 5,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("terminal"),
-
-          "plProvidedAcls"=> array(
-            "gotoLdapServer"      => _("Ldap server"),
-            "gotoShare"           => _("Shares"),
-            "gotoModules"         => _("Kernel modules"),
-            "gotoBootKernel"      => _("Boot kernel"), 
-            "gotoKernelParameters"=> _("Kernel parameter"))
-          ));
-  }
-
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_winGeneric.inc b/plugins/admin/systems/class_winGeneric.inc
deleted file mode 100644 (file)
index 8a15e93..0000000
+++ /dev/null
@@ -1,306 +0,0 @@
-<?php
-
-class wingeneric extends plugin
-{
-  /* CLI vars */
-  var $cli_summary        = "Manage component base objects";
-  var $cli_description    = "Some longer text\nfor help";
-  var $cli_parameters     = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* Generic terminal attributes */
-  var $interfaces= array();
-
-  /* Needed values and lists */
-  var $base= "";
-  var $cn= "";
-  var $description= "";
-  var $orig_dn= "";
-  var $shadowLastChange="";
-  var $uidNumber="";
-  var $gidNumber="";
-  var $loginShell="";
-  var $gecos="";
-  var $shadowMin="";
-  var $shadowWarning="";
-  var $shadowInactive="";
-  var $uid="";
-  var $sn="";
-  var $givenName="";
-  var $homeDirectory="";
-  var $sambaSID="";
-  var $sambaPrimaryGroupSID="";
-  var $displayName="";
-  var $sambaPwdMustChange="";
-  var $sambaNTPassword="";
-  var $sambaPwdLastSet="";
-  var $sambaAcctFlags="";
-  var $netConfigDNS;
-  /* attribute list for save action */
-  var $ignore_account= TRUE;
-  var $attributes   = array("cn", "description","shadowLastChange",
-                            "uidNumber","gidNumber","loginShell","gecos","shadowMin","shadowWarning",
-                            "shadowInactive","uid","cn","sn","givenName","homeDirectory","sambaSID",
-                            "sambaPrimaryGroupSID","displayName", "sambaPwdMustChange",
-                            "sambaNTPassword","sambaPwdLastSet","sambaAcctFlags");
-  var $objectclasses= array("posixAccount","person","organizationalPerson","inetOrgPerson","gosaAccount","shadowAccount","sambaSamAccount","top");
-
-  var $view_logged = FALSE;
-
-  function wingeneric (&$config, $dn= NULL, $parent= NULL)
-  {
-    plugin::plugin ($config, $dn, $parent);
-    $this->netConfigDNS = new termDNS($this->config,$this,$this->objectclasses);
-    /* Set base */
-    if ($this->dn == "new"){
-      $ui= get_userinfo();
-      $this->base= dn2base($ui->dn);
-      $this->cn= "";
-    } else {
-      $this->base= preg_replace ("/^[^,]+,".normalizePreg(get_winstations_ou())."/", "", $this->dn);
-    }
-
-    /* Save dn for later references */
-    $this->orig_dn= $this->dn;
-
-    $this->cn= preg_replace("/\\\$\$/","",$this->cn);
-  }
-
-
-  function set_acl_base($base)
-  {
-    plugin::set_acl_base($base);
-    $this->netConfigDNS->set_acl_base($base);
-  }
-
-  function set_acl_category($cat)
-  {
-    plugin::set_acl_category($cat);
-    $this->netConfigDNS->set_acl_category($cat);
-  }
-
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","winworkstation/".get_class($this),$this->dn);
-    }
-
-
-    /* Do we represent a valid phone? */
-    if (!$this->is_account && $this->parent === NULL){
-      $display= "<img alt=\"\" src=\"images/stop.png\" align=middle>&nbsp;<b>".
-        _("This 'dn' has no network features.")."</b>";
-      return($display);
-    }
-
-    /* Base select dialog */
-    $once = true;
-    foreach($_POST as $name => $value){
-      if(preg_match("/^chooseBase/",$name) && $once){
-        $once = false;
-        $this->dialog = new baseSelectDialog($this->config,$this);
-        $this->dialog->setCurrentBase($this->base);
-      }
-    }
-
-    /* Dialog handling */
-    if(is_object($this->dialog)){
-      /* Must be called before save_object */
-      $this->dialog->save_object();
-
-      if($this->dialog->isClosed()){
-        $this->dialog = false;
-      }elseif($this->dialog->isSelected()){
-
-        /* A new base was selected, check if it is a valid one */
-        $tmp = $this->get_allowed_bases();
-        if(isset($tmp[$this->dialog->isSelected()])){
-          $this->base = $this->dialog->isSelected();
-        }
-
-        $this->dialog= false;
-      }else{
-        return($this->dialog->execute());
-      }
-    }
-
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-
-    // Undefined index in wingeneric.tpl ... 
-    $smarty->assign("bases", $this->config->idepartments);
-
-    /* Assign attributes */
-    foreach ($this->attributes as $attr){
-      $smarty->assign("$attr", $this->$attr);
-    }
-    
-    $smarty->assign("base_select", $this->base);
-
-    /* Show main page */
-    $str = $this->netConfigDNS->execute();
-    if(is_object($this->netConfigDNS->dialog)){
-      return($str);
-    }
-    $smarty->assign("netconfig", $str);
-    return($smarty->fetch (get_template_path('wingeneric.tpl', TRUE)));
-  }
-
-  function remove_from_parent()
-  {
-    $this->netConfigDNS->remove_from_parent();
-    $ldap= $this->config->get_ldap_link();
-    $ldap->rmdir($this->dn);
-    new log("remove","winworkstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    show_ldap_error($ldap->get_error(), sprintf(_("Removing of system wingeneric/generic with dn '%s' failed."),$this->dn));
-    $this->handle_post_events("remove");
-
-    /* Delete references to object groups */
-    $ldap->cd ($this->config->current['BASE']);
-    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
-    while ($ldap->fetch()){
-      $og= new ogroup($this->config, $ldap->getDN());
-      unset($og->member[$this->dn]);
-      $og->save ();
-    }
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    /* Create a base backup and reset the
-       base directly after calling plugin::save_object();
-       Base will be set seperatly a few lines below */
-    $base_tmp = $this->base;
-    plugin::save_object();
-    $this->base = $base_tmp;
-
-    $this->netConfigDNS->save_object();
-
-    /* Set new base if allowed */
-    $tmp = $this->get_allowed_bases();
-    if(isset($_POST['base'])){
-      if(isset($tmp[$_POST['base']])){
-        $this->base= $_POST['base'];
-      }
-    }
-  }
-
-
-  /* Check supplied data */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-    $message= array_merge($message, $this->netConfigDNS->check());
-    $this->dn= "cn=".$this->cn.",ou=netdevices,ou=systems,".$this->base;
-    
-    /* Set new acl base */
-    if($this->dn == "new") {
-      $this->set_acl_base($this->base);
-    }
-
-    if(!$this->acl_is_createable() && $this->dn == "new"){
-      $message[]= _("You have no permissions to create a component on this 'Base'.");
-    }
-
-    if ($this->orig_dn != $this->dn){
-      $ldap= $this->config->get_ldap_link();
-      $ldap->cd ($this->base);
-      $ldap->search ("(cn=".$this->cn.")", array("cn"));
-      if ($ldap->count() != 0){
-        while ($attrs= $ldap->fetch()){
-          if(preg_match("/cn=dhcp,/",$attrs['dn'])){
-            continue;
-          }
-          if ($attrs['dn'] != $this->orig_dn){
-            $message[]= sprintf (_("There is already an entry '%s' in the base choosen by you"), $this->cn);
-            break;
-          }
-        }
-      }
-    }
-
-    return ($message);
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    plugin::save();
-
-    /* Remove all empty values */
-    if ($this->orig_dn == 'new'){
-      $attrs= array();
-      foreach ($this->attrs as $key => $val){
-        if (is_array($val) && count($val) == 0){
-          continue;
-        }
-        $attrs[$key]= $val;
-      }
-      $this->attrs= $attrs;
-    }
-
-    if(($this->gosaUnitTag) && (!in_array_ics("gosaAdministrativeUnitTag",$this->attrs['objectClass']))){
-      $this->attrs['objectClass'][] = "gosaAdministrativeUnitTag";
-    }
-
-    /* Write back to ldap */
-    $ldap= $this->config->get_ldap_link();
-    if ($this->orig_dn == 'new'){
-      $ldap->cd($this->config->current['BASE']);
-      $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
-      $ldap->cd($this->dn);
-      $ldap->add($this->attrs);
-      new log("create","winworkstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-      $this->handle_post_events("add");
-    } else {
-      if ($this->orig_dn != $this->dn){
-        $this->move($this->orig_dn, $this->dn);
-      }
-
-      $ldap->cd($this->dn);
-      $this->cleanup();
-      $ldap->modify ($this->attrs); 
-      new log("modify","winworkstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-      $this->handle_post_events("modify");
-    }
-
-    $this->netConfigDNS->cn =  preg_replace("/\\\$\$/","",$this->cn);
-    $this->netConfigDNS->save();
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of system wingeneric/generic with dn '%s' failed."),$this->dn));
-
-    /* Optionally execute a command after we're done */
-    $this->postcreate();
-  }
-
-  /* Return plugin informations for acl handling
-  #FIXME FAIscript seams to ununsed within this class... */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("Win generic"),
-          "plDescription" => _("Windows workstation generic"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 0,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("winworkstation" => array("description"  => _("Win workstation"),
-                                                          "objectClass"  => "gotoWorkstation")),
-          "plProvidedAcls"=> array(
-            "cn"                  => _("Workstation name"),
-            "description"         => _("Description"))
-          ));
-  }
-
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_workstationGeneric.inc b/plugins/admin/systems/class_workstationGeneric.inc
deleted file mode 100644 (file)
index 14641c0..0000000
+++ /dev/null
@@ -1,663 +0,0 @@
-<?php
-
-class workgeneric extends plugin
-{
-  /* CLI vars */
-  var $cli_summary= "Manage workstation base objects";
-  var $cli_description= "Some longer text\nfor help";
-  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* Generic terminal attributes */
-  var $gotoMode= "locked";
-  var $gotoSyslogServer= "";
-  var $gotoSyslogServers= array();
-  var $gotoNtpServer= array();
-  var $gotoNtpServers= array();
-  var $gotoSndModule= "";
-  var $gotoFloppyEnable= "";
-  var $gotoCdromEnable= "";
-  var $ghCpuType= "-";
-  var $ghMemSize= "-";
-  var $ghUsbSupport= "-";
-  var $ghNetNic= array();
-  var $ghIdeDev= array();
-  var $ghScsiDev= array();
-  var $ghGfxAdapter= "-";
-  var $ghSoundAdapter= "-";
-  var $gotoLastUser= "-";
-  var $FAIscript= "";
-  var $didAction= FALSE;
-  var $FAIstate= "";
-  var $view_logged = FALSE;
-
-  /* Needed values and lists */
-  var $base= "";
-  var $cn= "";
-  var $l= "";
-  var $orig_dn= "";
-
-  /* Plugin side filled */
-  var $modes= array();
-
-  var $netConfigDNS;
-
-  var $inheritTimeServer = true;
-
-  /* attribute list for save action */
-  var $ignore_account= TRUE;
-  var $attributes= array("gotoMode", "gotoSyslogServer", "gotoNtpServer",
-      "gotoFloppyEnable", "gotoCdromEnable", "cn", "gotoSndModule",
-      "ghCpuType", "ghMemSize", "ghUsbSupport",
-      "ghGfxAdapter", "ghSoundAdapter", "gotoLastUser", "l","FAIscript");
-  var $objectclasses= array("top", "gotoWorkstation", "GOhard");
-
-  var $mapActions   = array("reboot"          => "",
-                            "localboot"       => "localboot",
-                            "halt"            => "",
-                            "instant_update"  => "softupdate",
-                            "update"          => "scheduledupdate",
-                            "reinstall"       => "install",
-                            "rescan"          => "",
-                            "memcheck"        => "memcheck",
-                            "sysinfo"         => "sysinfo");
-
-  
-  var $fai_activated = FALSE;
-
-  var $member_of_ogroup = FALSE;
-
-  function workgeneric (&$config, $dn= NULL, $parent= NULL)
-  {
-    $tmp= $config->search("faiManagement", "CLASS",array('menu','tabs'));
-    if(!empty($tmp)){
-      $this->fai_activated = TRUE;
-    }
-
-    plugin::plugin ($config, $dn, $parent);
-
-    if(!isset($this->parent->by_object['ogroup'])){
-      $ldap = $this->config->get_ldap_link();
-      $ldap->cd ($this->config->current['BASE']);
-      $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".$this->dn."))",array("cn"));
-      $this->member_of_ogroup = $ldap->count() >= 1;
-    }
-
-    $this->netConfigDNS = new termDNS($this->config,$this,$this->objectclasses);
-
-    /* Read arrays */
-    foreach (array("ghNetNic", "ghIdeDev", "ghScsiDev") as $val){
-      if (!isset($this->attrs[$val])){
-        continue;
-      }
-      for ($i= 0; $i<$this->attrs[$val]['count']; $i++){
-        array_push($this->$val, $this->attrs[$val][$i]);
-      }
-    }
-
-    /* Create used ntp server array */
-    $this->gotoNtpServer= array();
-    if(isset($this->attrs['gotoNtpServer'])){
-      $this->inheritTimeServer = false;
-      unset($this->attrs['gotoNtpServer']['count']);
-      foreach($this->attrs['gotoNtpServer'] as $server){
-        $this->gotoNtpServer[$server] = $server;
-      }
-    }
-
-    /* Set inherit checkbox state */
-    if((in_array("default",$this->gotoNtpServer)) || (count($this->gotoNtpServer) == 0)){
-      $this->inheritTimeServer = true;
-      $this->gotoNtpServer=array();
-    }
-
-    /* You can't inherit the NTP service, if we are not member in an object group */
-    if(!$this->member_of_ogroup){
-      $this->inheritTimeServer = FALSE;
-    }
-
-    /* Create available ntp options */
-    $tmp = $this->config->data['SERVERS']['NTP'];
-    $this->gotoNtpServers = array();
-    foreach($tmp as $key => $server){
-      if($server == "default") continue;
-      $this->gotoNtpServers[$server] = $server;
-    }
-
-    $this->modes["active"]= _("Activated");
-    $this->modes["locked"]= _("Locked");
-
-    /* Set base */
-    if ($this->dn == "new"){
-      $ui= get_userinfo();
-      $this->base= dn2base($ui->dn);
-    } else {
-      $this->base= preg_replace ("/^[^,]+,[^,]+,[^,]+,/", "", $this->dn);
-    }
-
-    /* Create an array of all Syslog servers */
-    $tmp = $this->config->data['SERVERS']['SYSLOG'];
-    foreach($tmp as $server){
-      $visible = $server;
-      if($server == "default" && $this->member_of_ogroup) {
-        $visible = "["._("inherited")."]";
-      }
-      $this->gotoSyslogServers[$server] = $visible;
-    }
-
-    /* Save 'dn' for later referal */
-    $this->orig_dn= $this->dn;
-  }
-
-
-  function set_acl_base($base)
-  {
-    plugin::set_acl_base($base);
-    $this->netConfigDNS->set_acl_base($base);
-  }
-
-  function set_acl_category($cat)
-  {
-    plugin::set_acl_category($cat);
-    $this->netConfigDNS->set_acl_category($cat);
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","workstation/".get_class($this),$this->dn);
-    }
-
-    /* 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;
-      }
-    }
-
-    if ((isset($_POST['action'])) && ($this->acl_is_writeable("FAIstate"))){
-      $cmd= $this->config->search("workgeneric", "ACTIONCMD",array('tabs'));
-      if ($cmd == ""){
-        print_red(_("No ACTIONCMD definition found in your gosa.conf"));
-      } else {
-        exec ($cmd." ".$this->netConfigDNS->macAddress." ".escapeshellarg($_POST['saction']), $dummy, $retval);
-        if ($retval != 0){
-          print_red(sprintf(_("Execution of '%s' failed!"), $cmd));
-        } elseif ($_POST['saction'] != "wake") {
-
-          /* Set FAIstate */
-          if($this->fai_activated && $this->dn != "new"){
-            $ldap = $this->config->get_ldap_link();
-            $ldap->cd($this->config->current['BASE']);
-            $ldap->cat($this->dn,array("objectClass"));
-            $res = $ldap->fetch();
-
-            $attrs = array();
-            $attrs['FAIstate'] = $this->FAIstate;
-            if(isset($this->mapActions[$_POST['saction']]) && $this->mapActions[$_POST['saction']] != ""){
-              $attrs['FAIstate'] = $this->mapActions[$_POST ['saction']];
-            }
-
-            for($i = 0; $i < $res['objectClass']['count'] ; $i ++){
-              $attrs['objectClass'][] = $res['objectClass'][$i];
-            }
-
-            if(($attrs['FAIstate'] != "") && (!in_array("FAIobject",$attrs['objectClass']))){
-              $attrs['objectClass'][] = "FAIobject";
-            }
-
-            if($attrs['FAIstate'] == ""){
-#FIXME we should check if FAIobject is not used anymore
-              $attrs['FAIstate'] = array();
-            }
-
-            $ldap->cd($this->dn);
-            $ldap->modify($attrs);
-            show_ldap_error($ldap->get_error(), sprintf(_("Saving of system workstation/generic (FAIstate) with dn '%s' failed."),$this->dn));
-
-          }
-          $this->didAction= TRUE;
-        }
-      }
-    }
-
-    /* Do we represent a valid terminal? */
-    if (!$this->is_account && $this->parent === NULL){
-      $display= "<img alt=\"\" src=\"images/stop.png\" align=middle>&nbsp;<b>".
-        _("This 'dn' has no workstation features.")."</b>";
-      return($display);
-    }
-
-    /* Base select dialog */
-    $once = true;
-    foreach($_POST as $name => $value){
-      if(preg_match("/^chooseBase/",$name) && $once && $this->acl_is_writeable("base")){
-        $once = false;
-        $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
-        $this->dialog->setCurrentBase($this->base);
-      }
-    }
-
-    /* Dialog handling */
-    if(is_object($this->dialog)){
-      /* Must be called before save_object */
-      $this->dialog->save_object();
-
-      if($this->dialog->isClosed()){
-        $this->dialog = false;
-      }elseif($this->dialog->isSelected()){
-
-        /* A new base was selected, check if it is a valid one */
-        $tmp = $this->get_allowed_bases();
-        if(isset($tmp[$this->dialog->isSelected()])){
-          $this->base = $this->dialog->isSelected();
-        }
-
-        $this->dialog= false;
-      }else{
-        return($this->dialog->execute());
-      }
-    }
-
-    /* Add new ntp Server to our list */ 
-    if((isset($_POST['addNtpServer'])) && (isset($_POST['gotoNtpServers'])) && $this->acl_is_writeable("gotoNtpServer")){
-      $this->gotoNtpServer[$_POST['gotoNtpServers']] = $_POST['gotoNtpServers'];
-    }
-
-    /* Delete selected NtpServer for list of used servers  */
-    if((isset($_POST['delNtpServer'])) && (isset($_POST['gotoNtpServerSelected'])) && $this->acl_is_writeable("gotoNtpServer")){
-      foreach($_POST['gotoNtpServerSelected'] as $name){
-        unset($this->gotoNtpServer[$name]);
-      }
-    }
-
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-
-    /* Set acls */
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translation){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-
-    $smarty->assign("cn", $this->cn);
-    $smarty->assign("l", $this->l);
-    $smarty->assign("bases", $this->get_allowed_bases());
-    $smarty->assign("staticAddress", "");
-
-    $tmp = array();
-    foreach($this->gotoNtpServers as $server){
-      if(!in_array($server,$this->gotoNtpServer)){
-        $tmp[$server] = $server;
-      }
-    }
-    $smarty->assign("gotoNtpServers",$tmp);
-        
-    /* Check if workstation is online */
-    $query= "fping -q -r 1 -t 500 ".$this->cn;
-    exec ($query, $dummy, $retval);
-
-    /* Offline */
-    if ($retval == 0){
-      $smarty->assign("actions", array("halt" => _("Switch off"), "reboot" => _("Reboot"),
-                                       "instant_update" => _("Instant update"),
-                                       "update" => _("Scheduled update"),
-                                       "reinstall" => _("Reinstall"),
-                                       "rescan" => _("Rescan hardware"),
-                                       "memcheck" => _("Memory test"),
-                                       "localboot" => _("Force localboot"),
-                                       "sysinfo"  => _("System analysis")));
-    } else {
-      $smarty->assign("actions", array("wake" => _("Wake up"),
-                                       "reinstall" => _("Reinstall"),
-                                       "update" => _("Scheduled update"),
-                                       "memcheck" => _("Memory test"),
-                                       "localboot" => _("Force localboot"),
-                                       "sysinfo"  => _("System analysis")));
-    }
-    /* Arrays */
-    $smarty->assign("modes", $this->modes);
-    $smarty->assign("nfsservers", $this->config->data['SERVERS']['NFS']);
-    $smarty->assign("syslogservers", $this->gotoSyslogServers);
-    $smarty->assign("fai_activated",$this->fai_activated);
-
-    $ntpser = array();
-    foreach($this->gotoNtpServers as $server){
-      if(!in_array($server,$this->gotoNtpServer)){
-        $ntpser[$server] = $server;
-      }
-    }
-    $smarty->assign("gotoNtpServers", $ntpser);
-
-    /* Variables */
-    foreach(array("base", "gotoMode", "gotoSyslogServer", "gotoNtpServer") as $val){
-      $smarty->assign($val."_select", $this->$val);
-    }
-
-    /* tell smarty the inherit checkbox state */
-    $smarty->assign("inheritTimeServer",$this->inheritTimeServer);
-    $smarty->assign("member_of_ogroup",$this->member_of_ogroup);
-
-    $str = $this->netConfigDNS->execute();
-    if(is_object($this->netConfigDNS->dialog)){
-      return($str);
-    }
-    $smarty->assign("netconfig", $str);
-
-    /* Show main page */
-    return($smarty->fetch (get_template_path('workstation.tpl', TRUE)));
-  }
-
-  function remove_from_parent()
-  {
-    if($this->acl_is_removeable()){
-
-      $this->netConfigDNS->remove_from_parent();
-      $ldap= $this->config->get_ldap_link();
-      $ldap->rmdir($this->dn);
-      new log("remove","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-      show_ldap_error($ldap->get_error(), sprintf(_("Removing of system workstation/generic with dn '%s' failed."),$this->dn));
-
-      /* Optionally execute a command after we're done */
-      $this->handle_post_events("remove", array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
-
-      /* Delete references to object groups */
-      $ldap->cd ($this->config->current['BASE']);
-      $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
-      while ($ldap->fetch()){
-        $og= new ogroup($this->config, $ldap->getDN());
-        unset($og->member[$this->dn]);
-        $og->save ();
-      }
-    }
-
-    if(isset($_POST["inheritAll"])){
-      $this->set_everything_to_inherited();
-    }
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-
-    /* Create a base backup and reset the
-       base directly after calling plugin::save_object();
-       Base will be set seperatly a few lines below */
-    $base_tmp = $this->base;
-    plugin::save_object();
-    $this->base = $base_tmp;
-
-    /* Save base, since this is no LDAP attribute */
-    $tmp = $this->get_allowed_bases();
-    if(isset($_POST['base'])){
-      if(isset($tmp[$_POST['base']])){
-        $this->base= $_POST['base'];
-      }
-    }
-
-    $this->netConfigDNS->save_object();
-
-    /* Set inherit mode */
-    if((isset($_POST['workgeneric_posted'])) && ($this->acl_is_writeable("gotoNtpServer"))){
-      if(isset($_POST["inheritTimeServer"]) && $this->member_of_ogroup){
-        $this->inheritTimeServer = true;
-      }else{
-        $this->inheritTimeServer = false;
-      }
-    }
-    
-    if(isset($_POST["inheritAll"])){
-      $this->set_everything_to_inherited();
-    }
-  }
-
-
-  /* Check supplied data */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-  
-    /* Skip IP & Mac checks if this is a template */
-    if($this->cn != "wdefault"){
-      $message= array_merge($message, $this->netConfigDNS->check());
-    }
-
-    $this->dn= "cn=".$this->cn.",ou=workstations,ou=systems,".$this->base;
-
-    if ($this->cn == ""){
-      $message[]= _("The required field 'Workstation name' is not set.");
-    }
-
-    /* Check if given name is a valid host/dns name */
-    if(!is_dns_name($this->cn)){
-      $message[] = _("Please specify a valid name for this object.");
-    }
-
-    if ($this->orig_dn != $this->dn){
-      $ldap= $this->config->get_ldap_link();
-      $ldap->cd ($this->base);
-
-      if($this->cn == "wdefault"){
-        $ldap->cat($this->dn);
-      }else{
-        $ldap->search ("(&(cn=".$this->cn.")(objectClass=gotoWorkstation))", array("cn"));
-      }
-      if ($ldap->count() != 0){
-        while ($attrs= $ldap->fetch()){
-          if (preg_match("/cn=dhcp,/",$attrs['dn']) || preg_match ("/,ou=incoming,/", $ldap->getDN())){
-            continue;
-          } else {
-            if ($attrs['dn'] != $this->orig_dn){
-              $message[]= sprintf (_("There is already an entry '%s' in the base choosen by you"), $this->cn);
-              break;
-            }
-          }
-        }
-      }
-    }
-
-    /* Check for valid ntpServer selection */
-    if((!$this->inheritTimeServer) && (!count($this->gotoNtpServer))){
-      $message[]= _("There must be at least one NTP server selected, or the inherit mode activated.");
-    }
-
-    return ($message);
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    plugin::save();
-
-    /* Strip out 'default' values */
-    foreach (array("gotoSyslogServer") as $val){
-
-      if (isset($this->attrs[$val]) && $this->attrs[$val] == "default"){
-        $this->attrs[$val]= array();
-      }
-    }
-
-    /* Add missing arrays */
-    foreach (array("ghScsiDev", "ghIdeDev", "ghNetNic") as $val){
-      if (isset ($this->$val) && count ($this->$val) != 0){
-        $this->attrs["$val"]= $this->$val;
-      }
-    }
-
-    /* Remove all empty values */
-    if ($this->orig_dn == 'new'){
-      $attrs= array();
-      foreach ($this->attrs as $key => $val){
-        if (is_array($val) && count($val) == 0){
-          continue;
-        }
-        $attrs[$key]= $val;
-      }
-      $this->attrs= $attrs;
-    }
-
-    /* Update ntp server settings */
-    if($this->inheritTimeServer){
-      if($this->is_new){
-        if(isset($this->attrs['gotoNtpServer'])){
-          unset($this->attrs['gotoNtpServer']);
-        }
-      }else{
-        $this->attrs['gotoNtpServer'] = array();
-      }
-    }else{
-      /* Set ntpServers */
-      $this->attrs['gotoNtpServer'] = array();
-      foreach($this->gotoNtpServer as $server){
-        $this->attrs['gotoNtpServer'][] = $server;
-      }
-    }
-
-    if(($this->gosaUnitTag) && (!in_array_ics("gosaAdministrativeUnitTag",$this->attrs['objectClass']))){
-      $this->attrs['objectClass'][] = "gosaAdministrativeUnitTag";
-    }
-
-    /* Write back to ldap */
-    $ldap= $this->config->get_ldap_link();
-    if ($this->orig_dn == 'new'){
-      $ldap->cd($this->config->current['BASE']);
-      $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
-      $ldap->cd($this->dn);
-      $ldap->add($this->attrs);
-      new log("create","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-      show_ldap_error($ldap->get_error(), sprintf(_("Saving of system workstation/generic with dn '%s' failed."),$this->dn));
-      if(!$this->didAction){
-        $this->handle_post_events("add",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
-      }
-    } else {
-      if ($this->orig_dn != $this->dn){
-        $this->move($this->orig_dn, $this->dn);
-      }
-      $ldap->cd($this->dn);
-      $this->cleanup();
-      $ldap->modify ($this->attrs); 
-      new log("modify","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-
-      if(!$this->didAction){
-        $this->handle_post_events("modify",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
-      }
-    }
-
-    /* cn=default and macAddress=- indicates that this is a template */
-    if($this->cn == "wdefault"){
-      $this->netConfigDNS->macAddress = "-";
-    }
-
-    $this->netConfigDNS->cn = $this->cn;
-    $this->netConfigDNS->save();
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of system workstation/generic with dn '%s' failed."),$this->dn));
-  }
-
-
-  /* Display generic part for server copy & paste */
-  function getCopyDialog()
-  {
-    $vars = array("cn");
-    $smarty = get_smarty();
-    $smarty->assign("cn" ,$this->cn);
-    $smarty->assign("object","workstation");
-    $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE));
-    $ret = array();
-    $ret['string'] = $str;
-    $ret['status'] = "";
-    return($ret);
-  }
-
-
-  function saveCopyDialog()
-  {
-    if(isset($_POST['cn'])){
-      $this->cn = $_POST['cn'];
-    }
-  }
-
-
-  function PrepareForCopyPaste($source)
-  {
-    plugin::PrepareForCopyPaste($source);
-    if(isset($source['macAddress'][0])){
-      $this->netConfigDNS->macAddress = $source['macAddress'][0];
-    }
-    if(isset($source['ipHostNumber'][0])){
-      $this->netConfigDNS->ipHostNumber = $source['ipHostNumber'][0];
-    }
-
-    /* Create used ntp server array */
-    $this->gotoNtpServer= array();
-    if(isset($source['gotoNtpServer'])){
-      $this->inheritTimeServer = false;
-      unset($source['gotoNtpServer']['count']);
-      foreach($source['gotoNtpServer'] as $server){
-        $this->gotoNtpServer[$server] = $server;
-      }
-    }
-
-    /* Set inherit checkbox state */
-    if((in_array("default",$this->gotoNtpServer)) || (count($this->gotoNtpServer)==0)){
-      $this->inheritTimeServer = true;
-      $this->gotoNtpServer=array();
-    }
-  }
-
-
-  /* Return plugin informations for acl handling 
-      #FIXME FAIscript seams to ununsed within this class... */ 
-  static function plInfo()
-  {
-    return (array(  
-          "plShortName"   => _("Generic"),
-          "plDescription" => _("Workstation generic"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 0,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("workstation" => array("description"  => _("Workstation"),
-                                                          "objectClass"  => "gotoWorkstation")),
-          "plProvidedAcls"=> array(
-            "cn"                  => _("Workstation name"),
-            "l"                   => _("Location") ,
-            "base"                => _("Base") ,
-            "gotoMode"            => _("Goto mode"), 
-            "gotoSyslogServer"    => _("Syslog server"), 
-            "gotoNtpServer"       => _("Ntp server"), 
-            "gotoRootPasswd"      => _("Root password"),
-            "FAIstate"            => _("Action flag"))
-          ));
-  }
-
-  function set_everything_to_inherited()
-  {
-    $this->gotoSyslogServer  = "default";
-    $this->inheritTimeServer = TRUE;
-
-    /* Set workstation service attributes to inherited */
-    if($this->member_of_ogroup && isset($this->parent->by_object['workservice'])){
-      foreach(array("gotoXKbLayout","gotoXKbModel","gotoXKbVariant",
-            "gotoXResolution","gotoXColordepth","gotoXMouseType","gotoXMouseport") as $name){
-        $this->parent->by_object['workservice']->$name = "default"; 
-      }
-    }
-
-    /* Set workstation startup attributes to inherited */
-    if($this->member_of_ogroup && isset($this->parent->by_object['workstartup'])){
-      $this->parent->by_object['workstartup']->gotoBootKernel = "default-inherited";
-      $this->parent->by_object['workstartup']->gotoLdapServer = "default-inherited";
-      $this->parent->by_object['workstartup']->FAIdebianMirror= "inherited";
-    }
-  }
-}
-  // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_workstationService.inc b/plugins/admin/systems/class_workstationService.inc
deleted file mode 100644 (file)
index 23698cf..0000000
+++ /dev/null
@@ -1,505 +0,0 @@
-<?php
-
-class workservice extends plugin
-{
-  /* CLI vars */
-  var $cli_summary= "Manage terminal service aspects";
-  var $cli_description= "Some longer text\nfor help";
-  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  var $gotoScannerEnable;
-  /* Generic terminal attributes */
-  var $gotoXMonitor= "";
-  var $gotoXDriver= "";
-  var $gotoXResolution= "";
-  var $gotoXColordepth= "";
-  var $gotoXHsync= "";
-  var $gotoXVsync= "";
-  var $AutoSync = false;
-  var $gotoXKbModel= "";
-  var $gotoXKbLayout= "";
-  var $gotoXKbVariant= "";
-  var $gotoXMouseType= "";
-  var $gotoXMouseport= "";
-  var $gotoScannerClients= "";
-  var $gotoScannerBackend= "";
-  var $goFonHardware= "automatic";
-  var $view_logged = FALSE;
-
-  /* Needed values and lists */
-  var $ignore_account= TRUE;
-  var $base= "";
-  var $cn= "";
-  var $orig_dn= "";
-  var $XMethods= array();
-  var $XDrivers= array();
-  var $XResolutions = array();
-  var $MouseTypes= array();
-  var $MousePorts= array();
-  var $hardware_list= array();
-  var $used_hardware= array();
-
-
-  /* attribute list for save action */
-  var $attributes= array("gotoXMonitor",
-      "gotoXDriver", "gotoXResolution", "gotoXColordepth",
-      "gotoXHsync", "gotoXVsync",
-      "gotoScannerEnable", "gotoScannerClients",
-      "gotoScannerBackend", "gotoXKbModel", "gotoXKbLayout", "gotoXKbVariant",
-      "gotoXMouseType", "gotoXMouseport", "goFonHardware");
-  var $objectclasses= array("GOhard");
-
-  var $XColordepths     =array();
-  var $XKbModels        =array();
-  var $XKbLayouts       =array();
-  var $XKbVariants      =array();
-
-  function workservice (&$config, $dn= NULL, $parent= NULL)
-  {
-    plugin::plugin ($config, $dn, $parent);
-
-    $this->XResolutions= array( 
-        "640x480"   =>  "640x480",
-        "800x600"   =>  "800x600",
-        "1024x768"  =>  "1024x768",
-        "1152x864"  =>  "1152x864", 
-        "1280x1024" =>  "1280x1024",
-        "1400x1050" =>  "1400x1050", 
-        "1600x1200" =>  "1600x1200");
-
-    if(isset($this->config->data['MAIN']['RESOLUTION_HOOK'])){
-      $file = $this->config->data['MAIN']['RESOLUTION_HOOK'];
-
-      if(is_readable($file)){
-        $str = file_get_contents($file);
-        $lines = split("\n",$str);
-        foreach($lines as $line){
-          $line = trim($line);
-          if(!empty($line)){
-            $this->XResolutions[$line]=$line;
-          }
-        }
-        //natcasesort($this->gotoXResolutions);
-      }else{
-        print_red(sprintf(_("You have specified an external resolution hook which can't be read, please check the permission of the file '%s'."),$file));
-      }
-    }
-
-    /* Get list of available xdrivers */
-    $this->XDrivers = $this->getListOfXDrivers();
-
-    array_unshift($this->XDrivers, "["._("unknown")."]");
-    $this->XColordepths= array( 
-        "8"        => "8 " ._("bit"), 
-        "15"       => "15 "._("bit"),      
-        "16"       => "16 "._("bit"),   
-        "24"       => "24 "._("bit"));
-
-    foreach(array ("btc9000", "chicony", "compaq", "dell", "dell101", "everex",
-          "flexpro", "geniuscomfy", "hp", "itouch", "jp106", "logicordless",
-          "logiinetnav", "logiinternet", "macintosh", "microsoft",
-          "microsoftpro", "omnikey101", "pc101", "pc102", "pc104",
-          "pc105", "rapidaccess", "rapidaccess2", "winbook") as $type){
-      $this->XKbModels[$type] = $type;
-    }
-
-    $this->MouseTypes= array("ImPS/2" => "ImPS/2", "PS/2" => "PS/2", "Microsoft" => "Microsoft", 
-                              "Logitech" => "Logitech");
-
-    $this->MousePorts= array("/dev/ttyS0"  =>"/dev/ttyS0", 
-                             "/dev/ttyS1"       => "/dev/ttyS1",          "/dev/psaux"  =>"/dev/psaux", 
-                             "/dev/input/mice"  => "/dev/input/mice");
-
-    /* Additional values will be extracted from CONFIG_DIR./keyboardLayouts */
-    $this->XKbLayouts= array ("de"=> "de","intl" =>"intl","us" =>"us");
-    $this->XKbVariants= array ("nodeadkeys"=>"nodeadkeys", "basic"=>"basic");
-
-    /* try to read additional keyboard layouts 
-     */
-    if(file_exists(CONFIG_DIR."/keyboardLayouts")){
-      if(is_readable(CONFIG_DIR."/keyboardLayouts")){
-        $str = file_get_contents(CONFIG_DIR."/keyboardLayouts");
-        $tmp = split("\n",$str);
-        foreach($tmp as $entry){
-          if((!empty($entry)) && (!preg_match("/^#/",$entry))){
-            $entry = trim($entry);
-            $tmp2 = split ("\:",$entry);
-            $la =   trim($tmp2[0]);   // What would be saved to ldap
-            $da =   trim($tmp2[1]);   // This wis displayed in the listbox
-            $this->XKbLayouts [ $la] = $da;  
-          } 
-        }
-      }
-    }
-
-    /* Initialize methods */
-    $this->XMethods["indirect"]= _("show chooser");
-    $this->XMethods["query"]= _("direct");
-    #$this->XMethods["squery"]= _("direct via ssh");
-    #$this->XMethods["nquery"]= _("direct via nx");
-    $this->XMethods["load"]= _("load balanced");
-    #$this->XMethods["sload"]= _("load balanced via ssh");
-    #$this->XMethods["nload"]= _("load balanced via nx");
-    $this->XMethods["rdp"]= _("Windows RDP");
-    $this->XMethods["citrix"]= _("ICA client");
-
-    $this->orig_dn= $this->dn;
-
-    /* Load hardware list */
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(objectClass=goFonHardware)", array('cn', 'description'));
-    while ($attrs= $ldap->fetch()){
-      $cn= $attrs['cn'][0];
-      if (isset($attrs['description'])){
-        $description= " - ".$attrs['description'][0];
-      } else {
-        $description= "";
-      }
-      $this->hardware_list[$cn]= "$cn$description";
-    }
-
-    /* Eventually colorize phones */
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(goFonHardware=*)",array('cn','dn','goFonHardware'));
-    while($attrs = $ldap->fetch()){
-        $cn = $attrs['goFonHardware'][0];
-        if(isset($this->hardware_list[$cn])){
-          $this->used_hardware[$cn]= $cn;
-        }
-    }
-
-    if(preg_match("/\+/",$this->gotoXHsync)){
-      $this->AutoSync = true;
-      $this->gotoXHsync = preg_replace("/\+/","-",$this->gotoXHsync);
-      $this->gotoXVsync = preg_replace("/\+/","-",$this->gotoXVsync);
-    }
-
-    $this->hardware_list["automatic"]= _("automatic");
-    ksort($this->hardware_list);
-
-    /* Load hardware list */
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".$this->dn."))");
-    if ($ldap->count() == 1){
-      $map= array("gotoXResolution", "gotoXColordepth", "gotoXKbModel", "gotoXKbLayout",
-                  "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport");
-      $attrs= $ldap->fetch();
-
-      foreach ($map as $name){
-        if (!isset($attrs[$name][0])){
-          continue;
-        }
-        
-        switch ($name){
-          case 'gotoXResolution':
-            $this->XResolutions= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XResolutions;
-            break;
-          case 'gotoXColordepth':
-            $this->XColordepths= array('default' => _("inherited").' ['.$attrs[$name][0].' '._('Bit').']') + $this->XColordepths;
-            break;
-          case 'gotoXKbModel':
-            $this->XKbModels= array('default' => _("inherited").' ['.$attrs[$name][0].']') + $this->XKbModels;
-            break;
-          case 'gotoXKbLayout':
-            $this->XKbLayouts= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XKbLayouts;
-            break;
-          case 'gotoXKbVariant':
-            $this->XKbVariants= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XKbVariants;
-            break;
-          case 'gotoXMouseType':
-            $this->MouseTypes= array('AUTO' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->MouseTypes;
-            break;
-          case 'gotoXMouseport':
-            $this->MousePorts= array('AUTO' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->MousePorts;
-            break;
-        }
-
-      }
-
-    }
-
-    /* Workaround to fill in inherited values if we've specified an objectclass */
-    if (isset($_SESSION['SelectedSystemType']['ogroup']) && $_SESSION['SelectedSystemType']['ogroup'] != 'none'){
-      $this->XResolutions= array('default' => _("inherited"));
-      $this->XColordepths= array('default' => _("inherited"));
-      $this->XKbModels= array('default' => _("inherited"));
-      $this->XKbLayouts= array('default' => _("inherited"));
-      $this->XKbVariants= array('default' => _("inherited"));
-      $this->MouseTypes= array('AUTO' => _("inherited"));
-      $this->MousePorts= array('AUTO' => _("inherited"));
-    }
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","workstation/".get_class($this),$this->dn);
-    }
-
-    /* Do we need to flip is_account state? */
-    if (isset($_POST['modify_state'])){
-      $this->is_account= !$this->is_account;
-    }
-
-    /* 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 main page */
-    $smarty= get_smarty();
-
-    /* Assign ACLs */
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translated){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-
-    /* Arrays */ 
-    foreach(array("XMethods", "XDrivers", "XResolutions", "XColordepths",
-          "XKbModels", "XKbVariants",
-          "MouseTypes", "MousePorts") as $val){
-      $smarty->assign("$val", $this->$val);
-    }
-    $smarty->assign("XKbLayouts"    ,$this->XKbLayouts);
-    $smarty->assign("XKbLayoutKeys" ,array_flip($this->XKbLayouts));
-
-    $smarty->assign("xdmcpservers", $this->config->data['SERVERS']['TERMINAL']);
-    $smarty->assign("fontservers", $this->config->data['SERVERS']['FONT']);
-    $smarty->assign("nfsservers", $this->config->data['SERVERS']['NFS']);
-    $smarty->assign("nfsservers", $this->config->data['SERVERS']['NFS']);
-
-    /* Variables - select */
-    foreach(array(
-          "gotoXDriver", "gotoXResolution", "gotoXColordepth", 
-          "gotoXKbModel", "gotoXKbLayout","gotoScannerEnable",
-          "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport") as $val){
-
-      $smarty->assign($val."_select", $this->$val);
-    }
-
-    /* Variables */
-    foreach(array("gotoXHsync", "gotoXVsync") as $val){
-      $smarty->assign($val, $this->$val);
-    }
-    $smarty->assign("staticAddress", "");
-
-    /* Checkboxes */
-    foreach(array("gotoScannerEnable") as $val){
-      if ($this->$val == TRUE) {
-        $smarty->assign("$val", "checked");
-      } else {
-        $smarty->assign("$val", "");
-      }
-    }
-
-    /* Phone stuff */
-    $smarty->assign ("goFonHardware", $this->goFonHardware);
-
-    $perms = "";
-    if($this->acl_is_writeable("goFonHardware")){
-      $perms = " disabled ";
-    }
-
-    $hl= "<select size=\"1\" name=\"goFonHardware\" ".$perms." title=\"".
-      _("Choose the phone located at the current terminal")."\" >";
-    foreach ($this->hardware_list as $cn => $description){
-      if ($cn == $this->goFonHardware){
-        $selected= "selected";
-      } else {
-        $selected= "";
-      }
-      if (isset($this->used_hardware[$cn])){
-        $color= "style=\"color:#A0A0A0\"";
-      } else {
-        $color= "";
-      }
-      $hl.= "  <option $color label=\"$cn\" value=\"$cn\" $selected>$description</option>\n";
-    }
-    $hl.= "</select>\n";
-    $smarty->assign ("hardware_list", $hl);
-    $smarty->assign ("gotoXMonitor", $this->gotoXMonitor);
-
-    if($this->AutoSync){
-      $smarty->assign("AutoSyncCHK"," checked ");
-      $smarty->assign("hiddenState"," disabled ");
-    }else{
-      $smarty->assign("AutoSyncCHK"," ");
-      $smarty->assign("hiddenState","");
-    }
-
-    /* Show main page */
-    return($smarty->fetch (get_template_path('workstationService.tpl',TRUE,dirname(__FILE__))));
-  }
-
-  function remove_from_parent()
-  {
-    $this->handle_post_events("remove");
-    new log("remove","workstation/".get_class($this),$this->dn);
-  }
-
-  /* Save data to object */
-  function save_object()
-  {
-    plugin::save_object();
-
-    if((isset($_POST['gotoXDriver'])) && $this->acl_is_writeable("AutoSync")) {
-      if(isset($_POST['AutoSync'])){
-        $this->AutoSync = true;
-      }else{
-        $this->AutoSync = false;
-      }
-    }
-  }
-
-  /* Check supplied data */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    /* Default entries can use blank hsync/vsync entries */
-    if ($this->dn != "" && $this->cn != "default" && $this->cn != "wdefault"){
-
-      /* But only if no auto sync is enabled... */
-      if (!$this->AutoSync){
-
-        /* Check vsync for correct usage */
-        $val= preg_replace ("/\s/", "", $this->gotoXVsync);
-
-        if($this->acl_is_writeable("gotoXVsync")){
-          if (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val)){
-            $message[]= _("Please specify a valid VSync range.");
-          } else{
-            list($v1,$v2)= preg_split ("/[-+]/", $val);
-            if ($v2 != ""){
-              if ($v1 > $v2){
-                $message[]= _("Please specify a valid VSync range.");
-              }
-            }
-          }
-        }
-
-        /* Check hsync for correct usage */
-        $val= preg_replace ("/\s/", "", $this->gotoXHsync);
-        if($this->acl_is_writeable("gotoXHsync")){
-          if (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val)){
-            $message[]= _("Please specify a valid HSync range.");
-          } else{
-            list($v1,$v2)= preg_split ("/[-+]/", $val);
-            if ($v2 != ""){
-              if ($v1 > $v2){
-                $message[]= _("Please specify a valid HSync range.");
-              }
-            }
-          }
-        }
-      }
-    }
-
-    return ($message);
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    /* remove objectclass GOhard if this is an ogroup tab */
-    if(isset($this->parent->by_object['ogroup'])){
-      $this->objectclasses = array();
-    }
-
-    plugin::save();
-
-    /* Strip out 'default' values */
-    foreach(array(
-          "gotoXDriver", "gotoXResolution", "gotoXColordepth",
-          "gotoXKbModel", "gotoXKbLayout",
-          "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport") as $val){
-
-      if ($this->attrs[$val] == "default"){
-        $this->attrs[$val]= array();
-      }
-    }
-
-    if($this->AutoSync){
-      $this->attrs['gotoXHsync'] = "30+55";
-      $this->attrs['gotoXVsync'] = "50+70";
-    }
-
-    /* Write back to ldap */
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd($this->dn);
-    $this->cleanup();
-    $ldap->modify ($this->attrs); 
-    new log("modify","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of system workstation/service with dn '%s' failed."),$this->dn));
-    $this->handle_post_events("modify");
-  }
-
-
-  function getListOfXDrivers()
-  {
-    /* Generate a list of xdrivers from CONFIG_DIR./xdrivers */
-    $drivers = array();
-    if (file_exists(CONFIG_DIR.'/xdrivers')){
-      $xdrivers = file (CONFIG_DIR.'/xdrivers');
-      foreach ($xdrivers as $line){
-        if (!preg_match ("/^#/", $line)){
-          $drivers[]= trim($line);
-        }
-      }
-    } else {
-      $drivers = array("ati", "atimisc", "chips", "cirrus", "cyrix", "fbdev", "fglrx",
-          "i128", "i740", "i810", "imstt", "mga", "neomagic", "newport", "nsc",  "nv", "nvidia",
-          "r128", "radeon", "rendition", "s3", "s3virge", "savage", "siliconmotion",
-          "sis", "tdfx", "tga", "trident", "tseng", "vesa", "vga", "vmware");
-    }
-    return($drivers);
-  }
-
-
-  /* Return plugin informations for acl handling */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("Service"),
-          "plDescription" => _("Workstation service"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 10,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("workstation","ogroups"), 
-
-          "plProvidedAcls"=> array(
-            "gotoXMonitor"          => _("Monitor"),
-            "gotoXDriver"           => _("Gfx driver"),
-            "gotoXResolution"       => _("Gfx resolution"),
-            "gotoXColordepth"       => _("Gfx color depth"),
-            "gotoXHsync"            => _("Hsync"),
-            "gotoXVsync"            => _("Vsync"),
-            "AutoSync"              => _("Use DDC"),
-            "gotoScannerEnable"     => _("Scanner enabled"),
-            "gotoXKbModel"          => _("Keyboard model"),
-            "gotoXKbLayout"         => _("Keyboard layout"),
-            "gotoXKbVariant"        => _("Keyboard variant"),
-            "gotoXMouseType"        => _("Mouse type"),
-            "gotoXMouseport"        => _("Mouse port"),
-            "goFonHardware"         => _("Telephone hardware")) 
-            ));
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_workstationStartup.inc b/plugins/admin/systems/class_workstationStartup.inc
deleted file mode 100644 (file)
index 8e9ed52..0000000
+++ /dev/null
@@ -1,1360 +0,0 @@
-<?php
-class workstartup extends plugin
-{
-  /* CLI vars */
-  var $cli_summary= "Manage terminal startup options";
-  var $cli_description= "Some longer text\nfor help";
-  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* Ldap server list */
-  var $gotoLdapServers    = array();
-  var $gotoLdapServerList = array();
-  var $gotoLdap_inherit   = FALSE;
-
-  /* Generic terminal attributes */
-  var $bootmode             = "G";
-  var $gotoBootKernel       = "default-inherited";
-  var $gotoKernelParameters = "";
-  var $gotoLdapServer       = "default-inherited";
-  var $gotoModules          = array();
-  var $gotoAutoFs           = array();
-  var $gotoFilesystem       = array();
-  var $gotoTerminalPath     = "";
-  var $FAIstatus            = "";
-  var $gotoBootKernels      = array();
-
-  /* attribute list for save action */
-  var $attributes     = array("gotoLdapServer", "gotoBootKernel", "gotoKernelParameters", "FAIclass", "FAIstatus", "gotoShare","FAIdebianMirror", "FAIrelease");
-  var $objectclasses  = array("GOhard", "FAIobject");
-
-  /* Share */
-  var $gotoShares         = array();// Currently Share Option
-  var $gotoShare          = "";     // currently selected Share Option
-  var $gotoShareSelections= array();// Available Shares for this account in Listbox format
-  var $gotoAvailableShares= array();// Available Shares for this account
-
-  /* Helper */
-  var $customParameters   = "";
-  var $orig_dn            = "";
-  var $ignore_account     = TRUE;
-  /* FAI class selection */ 
-  var $FAIclass           = array();
-  var $FAIclasses         = array();
-  var $FAIclassInfo       = array();
-  var $FAIrelease         = "";
-  var $FAIdebianMirror    = "auto";
-
-  var $unresolved_classes = array();
-  var $view_logged        = FALSE;
-  
-  /* FAI class selection */
-  var $InheritedFAIclass           = array();
-  var $InheritedFAIrelease         = "";
-  var $InheritedFAIdebianMirror    = "auto";
-
-  /* Contains all possible server/release/class settings */
-  var $FAIServRepConfig   = array();
-
-  var $CopyPasteVars = array("gotoModules","gotoShares");
-
-  var $fai_activated = FALSE;
-  var $o_group_dn     ="";
-  var $member_of_ogroup   = FALSE;
-
-  function workstartup (&$config, $dn= NULL, $parent= NULL)
-  {
-    /* Check if FAI is active */
-    $tmp= $config->search("faiManagement", "CLASS",array('menu','tabs'));
-    if(!empty($tmp)){
-      $this->fai_activated = TRUE;
-    }else{
-      $this->attributes = array("gotoLdapServer", "gotoBootKernel", "gotoKernelParameters", "gotoShare");
-      $this->objectclasses  = array("GOhard");
-    }
-
-    plugin::plugin ($config, $dn, $parent);
-
-    if(!isset($this->parent->by_object['ogroup'])){
-      $ldap = $this->config->get_ldap_link();
-      $ldap->cd ($this->config->current['BASE']);
-      $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".$this->dn."))",array("cn","dn"));
-      if($ldap->count()){
-        $this->member_of_ogroup = TRUE;
-        $attrs = $ldap->fetch();
-        $this->o_group_dn = $attrs['dn'];
-      }
-    }
-
-    /* Creating a list of valid Mirrors 
-     * none will not be saved to ldap.
-     */
-    $ldap   = $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-
-    foreach($this->config->data['SERVERS']['LDAP'] as $server) {
-      $this->gotoLdapServerList[]= $server; 
-    }
-    if(isset($this->attrs['gotoLdapServer'])){
-      unset($this->attrs['gotoLdapServer']['count']);
-      sort($this->attrs['gotoLdapServer']);
-      foreach($this->attrs['gotoLdapServer'] as $value){
-        $this->gotoLdapServers[] = preg_replace("/^[0-9]*:/","",$value);
-      }
-    }
-    if(!count($this->gotoLdapServers) && $this->member_of_ogroup){ 
-      $this->gotoLdap_inherit = TRUE;
-    }
-
-    /* FAI Initialization
-       Skip this if FAI is not activated 
-     */
-    if($this->fai_activated) {
-
-      $_SESSION['getAvailableClassesForThisRelease_CACHE'] = array();
-      $_SESSION['getAvailableClassesForThisRelease_CACHED_CLASSES'] = array();
-
-      /* Search all FAI objects */
-      $ldap->search("(|(objectClass=FAIpackageList)(objectClass=FAItemplate)(objectClass=FAIvariable)(objectClass=FAIscript)(objectClass=FAIhook)(objectClass=FAIprofile)(objectClass=FAIpartitionTable))",array("cn","objectClass","FAIdebianSection",'description'));
-      /* Sort all entries, and attach elementtype.
-       * To be able to show the types in the listbox.
-       */
-      while($attr = $ldap->fetch()){
-        $cn = $attr['cn'][0];
-      
-        if(!isset($attr['description'])){
-          $attr['description'][0] ="";
-        }
-
-        $_SESSION['getAvailableClassesForThisRelease_CACHED_CLASSES'][] = $attr;
-   
-        if(in_array('FAIpackageList',$attr['objectClass'])){
-          $tmp2[$cn]['FAIpackageList']['obj']   = 'FAIpackageList'; 
-          $tmp2[$cn]['FAIpackageList']['kzl']   = 'Pl';
-          $tmp2[$cn]['FAIpackageList']['sec']   = $attr['FAIdebianSection'];
-          $tmp2[$cn]['FAIpackageList']['desc']  = $attr['description'];
-          $this->FAIclasses[$attr['cn'][0]]=$attr['cn'][0];
-        }
-        if(in_array('FAItemplate',$attr['objectClass'])){
-          $tmp2[$cn]['FAItemplate']['obj']      = 'FAItemplate'; 
-          $tmp2[$cn]['FAItemplate']['kzl']      = 'T'; 
-          $tmp2[$cn]['FAItemplate']['desc']  = $attr['description'];
-          $this->FAIclasses[$attr['cn'][0]]=$attr['cn'][0];
-        }
-        if(in_array('FAIvariable',$attr['objectClass'])){
-          $tmp2[$cn]['FAIvariable']['obj']      = 'FAIvariable'; 
-          $tmp2[$cn]['FAIvariable']['kzl']      = 'V'; 
-          $tmp2[$cn]['FAIvariable']['desc']  = $attr['description'];
-          $this->FAIclasses[$attr['cn'][0]]=$attr['cn'][0];
-        }
-        if(in_array('FAIscript',$attr['objectClass'])){
-          $tmp2[$cn]['FAIscript']['obj']        = 'FAIscript'; 
-          $tmp2[$cn]['FAIscript']['kzl']        = 'S'; 
-          $tmp2[$cn]['FAIscript']['desc']  = $attr['description'];
-          $this->FAIclasses[$attr['cn'][0]]=$attr['cn'][0];
-        }
-        if(in_array('FAIhook',$attr['objectClass'])){
-          $tmp2[$cn]['FAIhook']['obj']          = 'FAIhook'; 
-          $tmp2[$cn]['FAIhook']['kzl']          = 'H'; 
-          $tmp2[$cn]['FAIhook']['desc']  = $attr['description'];
-          $this->FAIclasses[$attr['cn'][0]]=$attr['cn'][0];
-        }
-        if(in_array('FAIpartitionTable',$attr['objectClass'])){
-          $tmp2[$cn]['FAIpartitionTable']['obj']= 'FAIpartitionTable'; 
-          $tmp2[$cn]['FAIpartitionTable']['kzl']= 'Pt'; 
-          $tmp2[$cn]['FAIpartitionTable']['desc']  = $attr['description'];
-          $this->FAIclasses[$attr['cn'][0]]=$attr['cn'][0];
-        }
-        if(in_array('FAIprofile',$attr['objectClass'])){
-          $tmp2[$cn]['FAIprofile']['obj']= 'FAIprofile'; 
-          $tmp2[$cn]['FAIprofile']['kzl']= 'P'; 
-          $tmp2[$cn]['FAIprofile']['desc']  = $attr['description'];
-          $this->FAIclasses[$attr['cn'][0]]=$attr['cn'][0];
-        }
-      }
-      if(is_array($this->FAIclasses)){
-        natcasesort($this->FAIclasses);
-      }
-
-      if(isset($tmp2)){
-        $this->FAIclassInfo = $tmp2;
-      } else {
-        $this->FAIclassInfo = array();
-      }
-
-      /* Build up an array like this one :
-          [$url]['SERVER'] = 'srv1-002';
-          [$url]['RELEASE']['siga/rc9.0.2']
-                                             ['SECTIONS'][0] "main";
-                                             ['SECTIONS'][1] "non-free";
-          [$url]['RELEASE']['siga/rc9.0.2']
-                                             ['PACKAGES'][0] "pkg1";
-                                             ['PACKAGES'][1] "postfix";
-       */
-
-      $ldap->search("(&(FAIrepository=*)(objectClass=FAIrepositoryServer))",array("FAIrepository"));
-      $test = array();
-      while($attr = $ldap->fetch()){
-        if(isset($attr['FAIrepository'])){
-
-          unset($attr['FAIrepository']['count']);
-
-          foreach($attr['FAIrepository'] as $rep){
-            $tmp = split("\|",$rep);
-
-            if(count($tmp)==4){
-              $sections = split(",",$tmp[3]);
-              $release  = $tmp[2];
-              $server   = $tmp[1];
-              $url      = $tmp[0];
-             
-              $test[$url]['RELEASE'][$release]['SECTIONS'] = $sections;
-      
-              /* Result will be cached
-               */
-              $rel_classes = $this->getAvailableClassesForThisRelease($release);
-              $test[$url]['RELEASE'][$release]['PACKAGES'] = $rel_classes;
-              $test[$url]['SERVER'] = $server;
-
-              /* auto gets all releases/classes 
-               */
-              $test['auto']['RELEASE'][$release]['SECTION'] = $sections;
-              $test['auto']['RELEASE'][$release]['PACKAGES'] = $rel_classes;
-            }
-          }
-        }
-      }
-      
-      /* Add possible elements from hook */
-      $lines= $this->GetHookElements();
-      foreach ($lines as $hline){
-        $entries= split(";", $hline);
-        if (isset($entries[1]) && !isset($test[$entries[1]])){
-          $test[$entries[1]]['RELEASE']= array();
-
-          /* Split releases */
-          if (isset($entries[2])){
-            $releases= split(",", $entries[2]);
-
-            foreach ($releases as $release){
-              $rname= preg_replace('/:.*$/', '', $release);
-              $sections= split(':', preg_replace('/^[^:]+:([^|]+)|.*$/', '\1', $release));
-              $classes= split('\|', preg_replace('/^[^|]+\|(.*)$/', '\1', $release));
-              $test[$entries[1]]['RELEASE'][$rname]= array();
-              $test[$entries[1]]['RELEASE'][$rname]['SECTION']= $sections;
-              foreach ($classes as $class){
-                if ($class != ""){
-                  $test[$entries[1]]['RELEASE'][$rname]['PACKAGES'][$class]= $class;
-                }
-              }
-            }
-          }
-        }
-      }
-      
-      $this->FAIServRepConfig= $test;
-
-      if((isset($this->FAIclass))&&(!is_array($this->FAIclass))){
-        $tmp = array();
-        $tmp = split(" ",$this->FAIclass);
-        $tmp2 =array();  
-
-        foreach($tmp as $class){
-          if( ":" == $class[0] ) {
-            $this->FAIrelease = substr( $class, 1 );
-          }
-          else
-          {
-            $tmp2[$class] = $class;
-          }
-        }
-        $this->FAIclass = $tmp2;
-      }
-
-      if(!is_array($this->FAIclass)){
-        $this->FAIclass =array();
-      }
-    }// END of FAI initialization stuff 
-
-
-    /* Get arrays */
-    foreach (array("gotoModules", "gotoAutoFs", "gotoFilesystem") as $val){
-      if (isset($this->attrs["$val"]["count"])){
-        for ($i= 0; $i<$this->attrs["count"]; $i++){
-          if (isset($this->attrs["$val"][$i])){
-            array_push($this->$val, $this->attrs["$val"][$i]);
-          }
-        }
-      }
-      sort ($this->$val);
-      $this->$val= array_unique($this->$val);
-    }
-
-    /* Parse Kernel Parameters to decide what boot mode is enabled */
-    if (preg_match("/ splash=silent/", $this->gotoKernelParameters)){
-      $this->bootmode= "G";
-    } elseif (preg_match("/ debug/", $this->gotoKernelParameters)){
-      $this->bootmode= "D";
-    } elseif ($this->gotoKernelParameters == "") {
-      $this->bootmode= "G";
-    } else {
-      $this->bootmode= "T";
-    }
-    if (preg_match("/ o /", $this->gotoKernelParameters)){
-      $this->customParameters= preg_replace ("/^.* o /", "", $this->gotoKernelParameters);
-    } else {
-      $this->customParameters= "";
-    }
-
-    /* Prepare Shares */
-    if((isset($this->attrs['gotoShare']))&&(is_array($this->attrs['gotoShare']))){
-      unset($this->attrs['gotoShare']['count']);
-      foreach($this->attrs['gotoShare'] as $share){
-        $tmp = $tmp2 = array();
-        $tmp = split("\|",$share);
-        $tmp2['server']      =$tmp[0];
-        $tmp2['name']        =$tmp[1];
-        $tmp2['mountPoint']  =$tmp[2];
-        $this->gotoShares[$tmp[1]."|".$tmp[0]]=$tmp2;
-      }
-    }
-
-    $this->gotoShareSelections= $config->getShareList(true);
-    $this->gotoAvailableShares= $config->getShareList(false);
-    $tmp2 = array();
-  
-
-    $this->orig_dn= $this->dn;
-
-    /* Handle inheritance value "default" */
-    if ($this->member_of_ogroup){
-      $this->gotoBootKernels= array("default-inherited" => '['._("inherited").']'); 
-    }
-
-    /* Load hardware list */
-    if ($this->member_of_ogroup){
-
-      if(count($this->FAIclass)==0 && $this->FAIrelease == ""){
-        $this->FAIdebianMirror = "inherited";
-      }
-
-      if($this->fai_activated){
-        $map= array("gotoBootKernel","FAIclass","FAIdebianMirror");
-      }else{
-        $map= array("gotoBootKernel");
-      }
-
-      $ldap = $this->config->get_ldap_link();
-      $ldap->cat($this->o_group_dn);
-      $attrs= $ldap->fetch();
-
-      foreach ($map as $name){
-        if (!isset($attrs[$name][0])){
-          continue;
-        }
-
-        switch ($name){
-          case 'gotoBootKernel':
-            $this->gotoBootKernels['default-inherited']=  _("inherited").' ['.$attrs[$name][0].']' ;
-            break;
-
-          case 'FAIclass':
-            $str = split(":",$attrs[$name][0]);
-            $this->InheritedFAIclass    = split("\ ",trim($str[0]));
-            $this->InheritedFAIrelease  = trim($str[1]);
-            break;
-
-          case 'FAIdebianMirror':
-            $this->InheritedFAIdebianMirror = $attrs[$name][0];
-            break;
-        }
-      }
-    }
-
-    /* Get list of boot kernels */
-    if (isset($this->config->data['TABS'])){
-      $command= $this->config->search(get_class($this), "KERNELS",array('tabs'));
-
-      if (!check_command($command)){
-        $message[]= sprintf(_("Command '%s', specified as KERNELS hook for plugin '%s' doesn't seem to exist."), $command,
-            get_class($this));
-      } else {
-        $fh= popen($command, "r");
-        while (!feof($fh)) {
-          $buffer= trim(fgets($fh, 256));
-          
-          if(!empty($buffer)){
-          
-            $name=$value = $buffer;
-
-            if(preg_match("/:/",$buffer)){
-              $name = preg_replace("/:.*$/","",$buffer);
-              $value= preg_replace("/^.*:/","",$buffer);
-              $this->gotoBootKernels[$name]= $name.":".$value;
-            }else{
-              $this->gotoBootKernels[$name]= $value;
-            }
-          }
-
-        }
-        pclose($fh);
-      }
-    }
-
-    /* Turn to default, if we've nothing to inherit */
-    if (!isset($this->gotoBootKernels['default-inherited']) && $this->gotoBootKernel == "default-inherited"){
-      $this->gotoBootKernel= "default";
-    }
-
-    /* Preselect release if none was selected yet */
-    if(empty($this->FAIrelease) && $this->FAIdebianMirror == "auto"){
-      if(isset($this->FAIServRepConfig['auto']['RELEASE']) && is_array($this->FAIServRepConfig['auto']['RELEASE'])){
-        $this->FAIrelease = key($this->FAIServRepConfig['auto']['RELEASE']);
-      }
-    }
-  }
-
-  
-  /* This class is called by the contrucktor ONLY.
-   *   It return the available classes for each 
-   *    Server / Release combination ... 
-   *   (Release specifies which classes are available) 
-   */
-  function getAvailableClassesForThisRelease($release)
-  {
-    /* There could be more than one server providing this release,
-        so use cached result if available
-     */
-    if(isset($_SESSION['getAvailableClassesForThisRelease_CACHE'][$release]))  {
-      return($_SESSION['getAvailableClassesForThisRelease_CACHE'][$release]);
-    }
-
-    $test2  = array();
-    $bb     = $this->generateDNSyn($release);
-
-    $ldap   = $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-  
-    /* Get classes fpr given release */
-    $p_classes = get_all_objects_for_given_base($bb,
-        "(|(objectClass=FAIpackageList)(objectClass=FAItemplate)".
-          "(objectClass=FAIvariable)(objectClass=FAIscript)(objectClass=FAIhook)".
-          "(objectClass=FAIprofile)(objectClass=FAIpartitionTable))");
-
-    /* Create list of classes */
-    foreach($p_classes as $class){
-      $ldap->cat($class['dn'],array("cn"));
-      $attr = $ldap->fetch();
-      $test2[$attr['cn'][0]] = $attr['cn'][0];
-    }
-    $_SESSION['getAvailableClassesForThisRelease_CACHE'][$release] = $test2;
-    return($test2);
-  }
-
-
-  /*  Create array to display available classes/profiles in a selectbox 
-   *   This function only displays the available classes.
-   *   If a class is available is defined by these facts : 
-   *     1. Is this class available for the selected release ?
-   *       - if it is available, check if the release is available for the selected server 
-   *         (done by $this->getFAIreleases())
-   *     2. Is this class currently not assigned to $this->FAIclass
-   */
-  function selectFriendlyClasses(){
-    $tmp=array();
-
-    if($this->FAIdebianMirror == "inherited" || $this->FAIrelease == ""){
-      return($tmp);
-    }
-
-    /* check if the current release exists,
-        else select the first one ..
-     */
-    $tmp2 = $this->getFAIreleases();
-    if(!isset($tmp2[$this->FAIrelease]) || !$tmp2[$this->FAIrelease]['USE']){
-      foreach($tmp2 as $key => $data){
-        if($data['USE']){
-          $this->FAIrelease = $key;
-        }
-      }
-    }
-    if(!in_array($this->FAIrelease, $tmp2)){
-#  $this->FAIrelease = key($tmp2);
-    }
-
-    /* Get all Packages for this server/release combination
-     */
-    if(!isset($this->FAIServRepConfig[$this->FAIdebianMirror]['RELEASE'][$this->FAIrelease]['PACKAGES'])){
-      $pkgs = array();
-      print_red(_("There are packages in your configuration, which can't be resolved with current server/release settings."));
-    }else{
-      $pkgs = $this->FAIServRepConfig[$this->FAIdebianMirror]['RELEASE'][$this->FAIrelease]['PACKAGES'];
-    }
-
-    /* Check each and every single class name 
-     */
-    foreach($pkgs as $pkg){
-  
-      /* Class already assigned to the classes list ?
-       * If not ... go on
-       */
-      if(!in_array($pkg,$this->FAIclass)){
-        
-        /* Create the displayed list entry value
-            HKLMOP [-Pl P V T-] or something like that 
-         */
-        $str = "";
-        foreach($this->FAIclassInfo[$pkg] as $entry){
-          if(isset($entry['kzl'])){
-            $str .= $entry['kzl']." ";
-          }
-        }
-        
-        /* Append class if everyting was fine
-         */        
-        $tmp[$pkg] = $pkg." [-".trim($str)."-]";
-      }
-    }
-    /* Just sort and return new classes list ...
-       ( possibly we should cache the result ... )
-     */
-    natcasesort ($tmp);
-    return($tmp);
-  }
-
-  function check()
-  {
-    $messages = array();
-    
-    /* Call common method to give check the hook */
-    $messages= plugin::check();
-
-    /* If there are packages selected, but no mirror show error */   
-    if(($this->FAIdebianMirror == "none")&&(count($this->FAIclass)>0)){
-      $messages[]=_("Please select a 'FAI server' or remove the 'FAI classes'.");
-    }
-
-    return($messages);
-  }
-
-  function execute()
-  {
-       /* Call parent execute */
-       plugin::execute();
-
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","workstation/".get_class($this),$this->dn);
-    }
-
-    /* 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;
-      }
-    }
-
-    /* Do we represent a valid terminal? */
-    if (!$this->is_account && $this->parent === NULL){
-      $display= "<img alt=\"\" src=\"images/stop.png\" align=middle>&nbsp;<b>".
-        _("This 'dn' has no terminal features.")."</b>";
-      return ($display);
-    }
-
-    /* Add module */
-    if (isset ($_POST['add_module'])){
-      if ($_POST['module'] != "" && $this->acl_is_writeable("gotoModule")){
-        $this->add_list ($this->gotoModules, $_POST['module']);
-      }
-    }
-
-    /* Delete module */
-    if (isset ($_POST['delete_module'])){
-      if (count($_POST['modules_list']) && $this->acl_is_writeable("gotoModule")){
-        $this->del_list ($this->gotoModules, $_POST['modules_list']);
-      }
-    }
-
-    /* FAI class management */
-    if($this->fai_activated){
-      if(((isset($_POST['AddClass']))&&(isset($_POST['FAIclassesSel']))) && ($this->acl_is_writeable("FAIclass"))){
-        $found = 0 ; 
-
-        /* If this new class/profile will attach a second partition table
-         * to our list of classes, abort and show a message.
-         */
-        foreach($this->FAIclass as $name){
-          if(isset($this->FAIclassInfo[$name])){
-            foreach($this->FAIclassInfo[$name] as $atr){
-              if(isset($atr['obj'])){
-                if($atr['obj'] == "FAIpartitionTable"){
-                  $found ++ ; 
-                }
-              }
-            }
-          }
-        }
-
-        if((isset($this->FAIclassInfo[$_POST['FAIclassesSel']]['FAIpartitionTable']))&&($found>0)){
-          print_red(_("There is already a profile in your selection that contain partition table configurations."));
-        }else{
-          $this->FAIclass[$_POST['FAIclassesSel']]=$_POST['FAIclassesSel'];
-        }
-      }
-
-      $sort = false;
-
-      /* Move one used class class one position up or down */
-      if($this->acl_is_writeable("FAIclass")){
-        foreach($_POST as $name => $val){
-
-          $sort_type = false;
-          if((preg_match("/sort_up/",$name))&&(!$sort)){
-            $sort_type = "sort_up_";
-          }
-          if((preg_match("/sort_down/",$name))&&(!$sort)){
-            $sort_type = "sort_down_";
-          }
-
-          if(($sort_type)&&(!$sort)){
-            $value = base64_decode(preg_replace("/_.*$/i","",preg_replace("/".$sort_type."/i","",$name)));
-            $sort = true;
-
-            $last = -1;
-            $change_down  = -1;
-
-            /* Create array with numeric index */ 
-            $tmp = array();
-            foreach($this->FAIclass as $class){
-              $tmp [] = $class;
-            }
-
-            /* Walk trough array */
-            foreach($tmp as $key => $faiName){
-              if($faiName == $value){
-                if($sort_type == "sort_up_"){
-                  if($last != -1){
-                    $change_down= $last;
-                  }
-                }else{
-                  if(isset($tmp[$key+1])){
-                    $change_down = $key;
-                  }
-                }
-              }
-              $last = $key;
-            }
-
-            $tmp2 = array();
-            $skip = false;    
-
-            foreach($tmp as $ky => $vl){
-
-              if($ky == $change_down){
-                $skip = $vl;
-              }else{
-                $tmp2[$vl] = $vl;
-              }
-              if(($skip != false)&&($ky != $change_down)){
-                $tmp2[$skip]  = $skip;
-                $skip =false;
-              }
-            }   
-            $this->FAIclass = $tmp2; 
-          }
-
-          if(preg_match("/fai_remove/i",$name)){
-            $value = base64_decode(preg_replace("/_.*$/i","",preg_replace("/fai_remove_/i","",$name)));
-            unset($this->FAIclass[$value]);
-          }
-        }
-      }
-
-      /* Delete selected class from our list */
-      if($this->acl_is_writeable("FAIclass")){
-        if((isset($_POST['DelClass']))&&(isset($_POST['FAIclassSel']))){
-          if(isset($this->FAIclass[$_POST['FAIclassSel']])){
-            unset($this->FAIclass[$_POST['FAIclassSel']]);
-          }
-        }
-      }
-    }// END fai handling
-
-    /* Show main page */
-    $smarty= get_smarty();
-
-    /* Assign ACLs to smarty */
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translation){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    } 
-
-    $smarty->assign("member_of_ogroup",$this->member_of_ogroup);
-
-    /* In this section server shares will be defined
-     * A user can select one of the given shares and a mount point
-     *  and attach this combination to his setup.
-     */
-    $smarty->assign("gotoShareSelections",    $this->gotoShareSelections);
-    $smarty->assign("gotoShareSelectionKeys", array_flip($this->gotoShareSelections));
-
-    /* if $_POST['gotoShareAdd'] is set, we will try to add a new entry
-     * This entry will be, a combination of mountPoint and sharedefinitions
-     */
-    if((isset($_POST['gotoShareAdd'])) && ($this->acl_is_writeable("gotoShare"))) {
-      /* We assign a share to this user, if we don't know where to mount the share */
-      if((!isset($_POST['gotoShareMountPoint']))||(empty($_POST['gotoShareMountPoint']))||(preg_match("/[\|]/i",$_POST['gotoShareMountPoint']))){
-        print_red(_("You must specify a valid mount point."));
-      }else{
-        if(count($this->gotoAvailableShares)){
-          $a_share = $this->gotoAvailableShares[$_POST['gotoShareSelection']];
-          $s_mount = $_POST['gotoShareMountPoint'];
-          /* Preparing the new assignment */
-          $this->gotoShares[$a_share['name']."|".$a_share['server']]=$a_share;
-          $this->gotoShares[$a_share['name']."|".$a_share['server']]['mountPoint']=$s_mount;
-        }
-      }
-    }
-
-    /* if the Post  gotoShareDel is set, someone asked GOsa to delete the selected entry (if there is one selected)
-     * If there is no defined share selected, we will abort the deletion without any message
-     */
-    if(($this->acl_is_writeable("gotoShare"))&& (isset($_POST['gotoShareDel']))&&(isset($_POST['gotoShare']))){
-      unset($this->gotoShares[$_POST['gotoShare']]);
-    }
-
-    $smarty->assign("gotoShares",$this->printOutAssignedShares());
-    $smarty->assign("gotoSharesCount",count($this->printOutAssignedShares()));
-    $smarty->assign("gotoShareKeys",array_flip($this->printOutAssignedShares()));
-    $smarty->assign("gotoBootKernels",$this->gotoBootKernels);
-
-    /* Create divSelectBox for ldap server selection
-     */
-    $SelectBoxLdapServer = new divSelectBox("LdapServer");
-    $SelectBoxLdapServer->SetHeight(130);
-
-    /* Add new ldap server to the list */
-    if(!$this->gotoLdap_inherit && isset($_POST['add_ldap_server']) && isset($_POST['ldap_server_to_add'])){
-      if(isset($this->gotoLdapServerList[$_POST['ldap_server_to_add']])){
-        $to_add = $this->gotoLdapServerList[$_POST['ldap_server_to_add']];
-        if(!in_array($to_add,$this->gotoLdapServers)){
-          $this->gotoLdapServers[] = $to_add;
-        }
-      }
-    }
-    
-    /* Move ldap servers up and down */
-    if(!$this->gotoLdap_inherit){
-      foreach($_POST as $name => $value){
-        if(preg_match("/sort_ldap_up_/",$name)){
-          $id = preg_replace("/^sort_ldap_up_([0-9]*)_(x|y)$/","\\1",$name);
-          $from =  $id;  
-          $to   =  $id -1;
-          $tmp = $this->array_switch_item($this->gotoLdapServers,$from,$to);
-          if($tmp){
-            $this->gotoLdapServers = $tmp;
-          }
-          break;
-        }
-        if(preg_match("/sort_ldap_down_/",$name)){
-          $id = preg_replace("/^sort_ldap_down_([0-9]*)_(x|y)$/","\\1",$name);
-          $from =  $id;  
-          $to   =  $id +1;
-          $tmp = $this->array_switch_item($this->gotoLdapServers,$from,$to);
-          if($tmp){
-            $this->gotoLdapServers = $tmp;
-          }
-          break;
-        }
-        if(preg_match("/gotoLdapRemove_/",$name)){
-          $id = preg_replace("/^gotoLdapRemove_([0-9]*)_(x|y)$/","\\1",$name);
-          $value = $this->gotoLdapServers[$id];
-          $this->gotoLdapServers = array_remove_entries(array($value),$this->gotoLdapServers);
-          break;
-        }
-      } 
-    }
-  
-    /* Add Entries 
-     */
-    foreach($this->gotoLdapServers as $key => $server){
-      if(!in_array($server,$this->gotoLdapServerList)){
-        $server = $server."&nbsp;<font style='color:red'>(missing)</font>";
-      }
-
-      $SelectBoxLdapServer->AddEntry(
-          array(array("string" => $server),
-            array("string" => 
-              "<input class='center' type='image' src='images/sort_up.png' name='sort_ldap_up_".$key."'>&nbsp;".
-              "<input class='center' type='image' src='images/sort_down.png' name='sort_ldap_down_".$key."'>&nbsp;".
-              "<input class='center' type='image' src='images/edittrash.png' name='gotoLdapRemove_".$key."'>",
-              "attach" => "style='text-align:right;width:40px;border-right:0px;'")));
-    }    
-
-    if($this->gotoLdap_inherit){
-      $smarty->assign("gotoLdapServerACL_inherit", preg_replace("/w/","",$this->getacl("gotoLdapServer")));;
-    }else{
-      $smarty->assign("gotoLdapServerACL_inherit", $this->getacl("gotoLdapServer"));
-    }
-    
-    $list = array();
-    foreach($this->gotoLdapServerList as $key => $entry){
-      if(!in_array($entry,$this->gotoLdapServers)){
-        $list[$key] = $entry;
-      }
-    }
-    $smarty->assign("gotoLdapServers",    $SelectBoxLdapServer->DrawList());
-    $smarty->assign("gotoLdapServerList", $list);
-    $smarty->assign("gotoLdap_inherit",   $this->gotoLdap_inherit);
-    $smarty->assign("JS",  $_SESSION['js']);
-
-    foreach (array("gotoModules", "gotoAutoFs", "gotoFilesystem") as $val){
-      $smarty->assign("$val", $this->$val);
-    }
-
-    /* Values */
-    foreach(array("gotoBootKernel", "customParameters", "gotoShare","FAIclasses","FAIclass","FAIdebianMirror","FAIrelease") as $val){
-      $smarty->assign($val, $this->$val);
-    }
-
-    $smarty->assign("fai_activated",$this->fai_activated);
-
-    /* Create FAI output */
-    if($this->fai_activated){
-      $smarty->assign("FAIdebianMirrors",$this->getFAIdebianMirrors());
-      $smarty->assign("FAIdebianMirror",$this->FAIdebianMirror);
-      $smarty->assign("FAIreleases",$this->getFAIreleases());
-      $smarty->assign("FAIrelease",$this->FAIrelease);
-      $smarty->assign("FAIclasses",$this->selectFriendlyClasses());
-      $smarty->assign("FAIclassesKeys",array_flip($this->selectFriendlyClasses()));
-      $smarty->assign("FAIclassKeys",$this->FAIclass);
-
-      $inheritedRelease = array();
-      if(!empty($this->InheritedFAIrelease)){
-        $inheritedRelease[$this->InheritedFAIrelease]= $this->InheritedFAIrelease;
-      } 
-      $smarty->assign("InheritedFAIrelease",$inheritedRelease);
-
-      $div = new divSelectBox("WSFAIscriptClasses");
-      $div -> SetHeight("110");
-      $str_up     = " &nbsp;<input type='image' src='images/sort_up.png'    name='sort_up_%s'    value='%s'>";
-      $str_down   = " &nbsp;<input type='image' src='images/sort_down.png'  name='sort_down_%s'  value='%s'>";
-      $str_remove = " &nbsp;<input type='image' src='images/edittrash.png'  name='fai_remove_%s' value='%s'>";
-      $str_empty  = " &nbsp;<img src='images/empty.png' alt=\"\" width='7'>"; 
-
-      $i = 1;
-
-      if($this->FAIdebianMirror == "inherited"){
-        $tmp = $this->InheritedFAIclass;
-      }else{
-        $tmp = $this->FAIclass;
-      }
-
-      foreach($tmp as $class){
-
-        $marker = "";
-        if(in_array_ics($class,$this->unresolved_classes)){
-          $marker = "&nbsp;<font color='red'>("._("Not available in current setup").")</font>";
-        }
-
-        if($this->FAIdebianMirror == "inherited"){
-          $str = "";
-        }else{
-          if($i==1){
-            $str = $str_empty.$str_down.$str_remove;
-          }elseif($i == count($this->FAIclass)){
-            $str = $str_up.$str_empty.$str_remove;
-          }else{
-            $str = $str_up.$str_down.$str_remove;
-          }
-        }
-        $i ++ ; 
-  
-        $desc = ""; 
-        if(isset($this->FAIclassInfo[$class])){
-          foreach($this->FAIclassInfo[$class] as $types ){
-            if(isset($types['desc'][0])){
-              $desc.= $types['desc'][0]." ";
-            }
-          }
-        }
-        if(!empty($desc)){
-          $desc = "&nbsp;[".trim($desc)."]";
-        }        
-
-        $div->AddEntry(array(
-              array("string"=>$class.$desc.$marker),
-              array("string"=>preg_replace("/\%s/",base64_encode($class),$str),"attach"=>"style='width:50px;border-right:none;'")
-              ));
-      }  
-      $smarty->assign("FAIScriptlist",$div->DrawList()); 
-    }// END FAI output generation 
-
-    /* Radio button group */
-    if (preg_match("/G/", $this->bootmode)) {
-      $smarty->assign("graphicalbootup", "checked");
-    } else {
-      $smarty->assign("graphicalbootup", "");
-    }
-    if (preg_match("/T/", $this->bootmode)) {
-      $smarty->assign("textbootup", "checked");
-    } else {
-      $smarty->assign("textbootup", "");
-    }
-    if (preg_match("/D/", $this->bootmode)) {
-      $smarty->assign("debugbootup", "checked");
-    } else {
-      $smarty->assign("debugbootup", "");
-    }
-
-    /* Show main page */
-    return($smarty->fetch (get_template_path('workstationStartup.tpl', TRUE,dirname(__FILE__))));
-  }
-
-  function remove_from_parent()
-  {
-    $this->handle_post_events("remove");
-    new log("remove","workstation/".get_class($this),$this->dn);
-  }
-
-  function generateDNSyn($release)
-  {
-    $str = "";
-    $tmp = split("\/",$release);
-    $tmp = array_reverse($tmp);
-    $base = "ou=fai,ou=configs,ou=systems,";   
-    foreach($tmp as $departmentname){
-      $str .= ",ou=".$departmentname;
-    }
-    $str = preg_replace("/^,/","",($str.",".$base));
-
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(&(objectClass=FAIbranch))",array("ou"));
-    while($attrs = $ldap->fetch()){
-      if(preg_match("/".normalizePreg($str)."/",$attrs['dn'])){
-        return($attrs['dn']);
-      }
-    }
-
-    return($str.$this->config->current['BASE']);
-  }
-
-  function getFAIdebianMirrors()
-  {
-    $ret = array();
-
-    /* Only add inherit option, if we are part in an object group 
-     */
-    if($this->member_of_ogroup)    {
-      $ret['inherited']['NAME']="["._("inherited")."]";
-      $ret['inherited']['USE'] = TRUE;
-    }
-
-    $ret['auto']['NAME']=_("automatic");
-    $ret['auto']['USE'] = TRUE;
-    $secs  = array();
-
-    /* Walk through all available servers 
-        and check if they support the currently selected classes
-        if not, dont't add them to our list
-     */
-    foreach($this->FAIServRepConfig as $mirror => $rest){
-
-      /* Automatically selection is available everytime */
-      if($mirror == "auto"){
-        continue;
-      }
-
-      $use = false;
-      if(count($this->FAIclass) == 0){
-        $use = true;
-      }else{
-        $tmp = $this->getFAIreleases();
-        foreach($tmp as $release => $data){
-          if(isset($rest['RELEASE'][$release]) && $release == $this->FAIrelease){
-            $use = $data['USE']; 
-          }
-        } 
-      }
-
-      /* If current server, doesn't support this class
-          remove it from list
-       */
-      $ret[$mirror]['NAME'] = $mirror;
-      $ret[$mirror]['USE'] = $use;
-    }
-    return($ret);
-  }
-
-  function getFAIreleases() 
-  {
-    $ret = array();
-
-    if($this->FAIdebianMirror == "inherited") {
-      return(array());
-    }
-
-    if(!isset($this->FAIServRepConfig[$this->FAIdebianMirror])){
-      $this->FAIdebianMirror = "auto";
-    }
-
-    $errorClasses = array();
-    if(isset($this->FAIServRepConfig[$this->FAIdebianMirror]['RELEASE'])) {
-      foreach($this->FAIServRepConfig[$this->FAIdebianMirror]['RELEASE'] as $release => $sections){
-        $use = true;
-
-        if(!count($this->FAIclass) == 0){
-          foreach($this->FAIclass as $class){
-            if(!in_array($class, $sections['PACKAGES'])){
-              $use = false;
-              $errorClasses[$class] = $class;
-            }else{
-              if(isset($errorClasses[$class])){
-                unset($errorClasses[$class]);
-              }
-            }
-          }
-        }
-        $ret[$release]['NAME']=$release;
-        $ret[$release]['USE']=$use;
-      }
-    }
-
-    if((count($ret) == 0 ) && ($this->FAIdebianMirror != "auto")){
-      $eClasses = " ";
-      foreach($errorClasses as $class){
-        $eClasses .= $class." ";
-      }
-
-      print_red(sprintf(_("Can't resolve one or more of the given FAIclass(es) [%s] in FAI server '%s'. Server was reset to 'auto'."),$eClasses, $this->FAIdebianMirror));
-      $this->FAIdebianMirror = "auto";
-      return($this->getFAIreleases());
-    }elseif((count($ret) == 0 ) && ($this->FAIdebianMirror == "auto")){
-
-      $eClasses = " ";
-      foreach($errorClasses as $class){
-        $eClasses .= $class." ";
-      }
-
-      $eClasses = preg_replace("/  */","",$eClasses);
-     
-      if(!empty($eClasses)) {
-
-        $this->unresolved_classes = $errorClasses;
-        $this->FAIdebianMirror = "auto";
-        print_red(sprintf(_("Can't resolve the given FAIclass(es) [%s] anyway, please check your FAI configurations, possibly some classes where deleted or renamed. Server was reset to 'auto'."),$eClasses));
-      }
-    }
-    return($ret);
-  }
-
-  /* Save data to object */
-  function save_object()
-  {
-    plugin::save_object();
-
-    if(isset($_POST['WorkstationStarttabPosted'])){
-      if(isset($_POST['gotoLdap_inherit'])){
-        $this->gotoLdap_inherit = TRUE;
-      }else{
-        $this->gotoLdap_inherit = FALSE;
-      }
-
-      /* Save group radio buttons */
-      if ($this->acl_is_writeable("bootmode") && isset($_POST["bootmode"])){
-        $this->bootmode= $_POST["bootmode"];
-      }
-
-      /* Save kernel parameters */
-      if ($this->acl_is_writeable("gotoKernelParameters") && isset($_POST["customParameters"])){
-        $this->customParameters= $_POST["customParameters"];
-      }
-    }
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-
-    /* Depending on the baseobject (Ogroup / WS) we
-     *  use another set of objectClasses
-     * In case of WS itself, we use  "array("GOhard", "FAIobject");"
-     * if we are currently editing from ogroup menu we use (array("gotWorkstationTemplate","GOhard", "FAIobject"))
-     */
-    if(isset($this->parent->by_object['ogroup'])){
-      $this->objectclasses = array("gotoWorkstationTemplate");
-    }elseif(isset($this->parent->by_object['workgeneric'])){
-      $this->objectclasses = array("GOhard");
-    }elseif(isset($this->parent->by_object['servgeneric'])){
-      $this->objectclasses = array("GOhard","gotoWorkstationTemplate");
-    }else{
-      print "Object Type Configuration : unknown";
-      exit();
-    }
-
-    /* Append FAI class */
-    if($this->fai_activated){
-      $this->objectclasses[]  = "FAIobject";
-    }
-
-    /* Find proper terminal path for tftp configuration
-       FIXME: This is suboptimal when the default has changed to
-       another location! */
-    if (($this->gotoTerminalPath == "default")){
-      $ldap= $this->config->get_ldap_link();
-
-      /* Strip relevant part from dn, keep trailing ',' */
-      $tmp= preg_replace("/^cn=[^,]+,ou=terminals,ou=systems,/i", "", $this->dn);
-      $tmp= preg_replace("/".$this->config->current['BASE']."$/i", "", $tmp);
-
-      /* Walk from top to base and try to load default values for
-         'gotoTerminalPath'. Abort when an entry is found. */
-      while (TRUE){
-        $tmp= preg_replace ("/^[^,]+,/", "", $tmp);
-
-        $ldap->cat("cn=default,ou=terminals,ou=systems,$tmp".
-            $this->config->current['BASE'], array('gotoTerminalPath'));
-        $attrs= $ldap->fetch();
-        if (isset($attrs['gotoTerminalPath'])){
-          $this->gotoTerminalPath= $attrs['gotoTerminalPath'][0];
-          break;
-        }
-
-        /* Nothing left? */
-        if ($tmp == ""){
-          break;
-        }
-      }
-    }
-
-    /* Add semi automatic values */
-    // FIXME: LDAP Server may not be set here...
-    $this->gotoKernelParameters= "ldap=".base64_encode($this->gotoLdapServer);
-
-    switch ($this->bootmode){
-      case "D":
-        $this->gotoKernelParameters.= " debug";
-      break;
-      case "G":
-        $this->gotoKernelParameters.= " splash=silent";
-      break;
-    }
-    if ($this->customParameters != ""){
-      $this->gotoKernelParameters.= " o ".$this->customParameters;
-    }
-
-    plugin::save();
-
-    unset( $this->attrs['FAIrelease'] );
-    
-    $str = "";
-
-    /* Skip FAI attribute handling if not necessary */
-    if($this->fai_activated){
-      if($this->FAIdebianMirror == "inherited"){
-        $this->attrs['FAIclass'] = $this->attrs['FAIrelease'] =  $this->attrs['FAIdebianMirror'] = array(); 
-      }else{
-        foreach($this->FAIclass as $class){
-          $str .= $class." ";
-        }
-        $str .= ":" . $this->FAIrelease;
-        $this->attrs['FAIclass']= "";
-        $this->attrs['FAIclass']= trim($str);
-
-        if(empty($this->attrs['FAIclass'])){
-          $this->attrs['FAIclass'] = array();
-        }
-      }
-    }
-  
-    /* Add missing arrays */
-    foreach (array("gotoFilesystem", "gotoAutoFs", "gotoModules") as $val){
-      if (isset ($this->$val) && count ($this->$val) != 0){
-    
-        $this->attrs["$val"]= array_unique($this->$val);
-      }
-      if(!isset($this->attrs["$val"])) $this->attrs["$val"]=array();
-    }
-
-    /* Prepare list of ldap servers */
-    $this->attrs['gotoLdapServer'] = array();
-    if(!$this->gotoLdap_inherit){
-      $i = 0;
-      foreach($this->gotoLdapServers as $server){
-        $i ++;
-        $this->attrs['gotoLdapServer'][] = $i.":".$server;
-      }
-    }
-
-    if (($this->attrs['gotoBootKernel'] == "default-inherited") || ($this->attrs['gotoBootKernel'] == "%default%")){
-      $this->attrs['gotoBootKernel']= array();
-    }
-
-    /* if mirror == none stop saving this attribute */
-    if($this->FAIdebianMirror == "none"){
-      $this->FAIdebianMirror = "";
-    }
-   
-    /* Get FAIstate from object, the generic tab could have changed it during execute */
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd($this->dn);
-
-
-    /* Skip FAI attribute handling if not necessary */
-    if($this->fai_activated){
-      $ldap->cat($this->dn,array("FAIstate"));
-      $checkFAIstate = $ldap->fetch();
-
-      /* Remove FAI objects if no FAI class is selected */ 
-      if((count($this->FAIclass)==0) && (!isset($checkFAIstate['FAIstate']))){
-        $this->attrs['FAIclass']        = array();
-        $this->attrs['FAIdebianMirror'] = array();
-      }
-    }
-
-
-    /* prepare share settings */
-    $tmp = array();
-    foreach($this->gotoShares as $name => $settings){
-      $tmp2= split("\|",$name);
-      $name = $tmp2[0];
-      $tmp[] = $settings['server']."|".$name."|".$settings['mountPoint'];
-    }
-    $this->attrs['gotoShare']=$tmp;
-
-    $this->cleanup();
-    $ldap->modify ($this->attrs); 
-    new log("modify","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of system workstation/startup with dn '%s' failed."),$this->dn));
-    $this->handle_post_events("modify");
-  }
-
-  /* Add value to array, check if unique */
-  function add_list (&$array, $value)
-  {
-    if ($value != ""){
-      $array[]= $value;
-      sort($array);
-      array_unique ($array);
-    }
-  }
-
-
-  /* Delete value to array, check if unique */
-  function del_list (&$array, $list)
-  {
-    $tmp= array();
-    foreach ($array as $mod){
-      if (!in_array($mod, $list)){
-        $tmp[]= $mod;
-      }
-    }
-    $array= $tmp;
-  }
-
-  /* Generate ListBox frindly output for the defined shares
-   * Possibly Add or remove an attribute here,
-   */
-  function printOutAssignedShares()
-  {
-    $a_return = array();
-    if(is_array($this->gotoShares)){
-      foreach($this->gotoShares as $share){
-        $a_return[$share['name']."|".$share['server']]= $share['name']." [".$share['server']."]";
-      }
-    }
-    return($a_return);
-  }
-
-
-  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 $line){
-          if(empty($line)) continue;
-          $ret[]= $line;
-        }
-      }
-    }
-    return($ret);
-  }
-
-
-  function PrepareForCopyPaste($source)
-  {
-    plugin::PrepareForCopyPaste($source);    
-
-    $source_o = new workstartup ($this->config, $source['dn']);
-    
-    foreach(array("FAIclass","gotoModules", "gotoAutoFs", "gotoFilesystem","gotoKernelParameters","gotoShares","customParameters") as $attr){
-      $this->$attr = $source_o->$attr;
-    }
-  }
-
-  
-  function array_switch_item($ar,$from,$to)
-  {
-    if(!is_array($ar)){
-      return(false);
-    }
-    if(!isset($ar[$from])){
-      return(false);
-    }
-    if(!isset($ar[$to])){
-      return(false);
-    }
-
-    $tmp = $ar[$from];
-    $ar[$from] = $ar[$to];    
-    $ar[$to] = $tmp;    
-    return($ar);
-  }
-
-
-  /* Return plugin informations for acl handling */ 
-  static function plInfo()
-  {
-    return (array( 
-          "plShortName"   => _("Startup"),
-          "plDescription" => _("System startup"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 9,
-          "plSection"     => array("administration"),           
-          "plCategory"    => array("workstation","server","ogroups"),
-
-          "plProvidedAcls"=> array(
-            "gotoLdapServer"        => _("Ldap server"),
-            "gotoBootKernel"        => _("Boot kernel"),
-            "gotoKernelParameters"  => _("Kernel parameter"),
-
-            "gotoModules"           => _("Kernel modules"),
-            "gotoShare"             => _("Shares"),
-
-            "FAIclass"              => _("FAI classes"),
-            "FAIdebianMirror"       => _("Debian mirror"),
-            "FAIrelease"            => _("Debian release"),
-
-            "FAIstatus"             => _("FAI status flag")) // #FIXME is this acl realy necessary ?
-          ));
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/component.tpl b/plugins/admin/systems/component.tpl
deleted file mode 100644 (file)
index 3ddd506..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-<table summary="" width="100%">
- <tr>
-  <td style="vertical-align:top; width:50%; border-right:1px solid #A0A0A0">
-       <table summary="">
-        <tr>
-         <td><LABEL for="cn">{t}Device name{/t}</LABEL>{$must}</td>
-         <td>
-{render acl=$cnACL}
-          <input name="cn" id="cn" size=20 maxlength=60 value="{$cn}">
-{/render}
-         </td>
-        </tr>
-        <tr>
-          <td colspan=2>&nbsp;</td>
-        </tr>
-        <tr>
-         <td><LABEL for="base">{t}Base{/t}</LABEL>{$must}</td>
-         <td>
-{render acl=$baseACL}
-           <select id="base" size="1" name="base" title="{t}Choose subtree to place group in{/t}">
-            {html_options options=$bases selected=$base_select}
-           </select>
-{/render}
-{render acl=$baseACL disable_picture='images/folder_gray.png'}
-        <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
-{/render}
-
-          </td>
-         </tr>
-       </table>
-  </td>
-  <td style="vertical-align:top">
-       <table summary="">
-        <tr>
-         <td><LABEL for="description">{t}Description{/t}</LABEL></td>
-         <td>  
-{render acl=$descriptionACL}
-          <input id="description" name="description" size=25 maxlength=80 value="{$description}">
-{/render}
-          </td>
-        </tr>
-       </table>
-  </td>
- </tr>
-</table>
-
-<p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
-
-{$netconfig}
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('cn');
-  -->
-</script>
diff --git a/plugins/admin/systems/contents.tpl b/plugins/admin/systems/contents.tpl
deleted file mode 100644 (file)
index 001d50d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-{$Kekse} sind gesund
diff --git a/plugins/admin/systems/gencd.tpl b/plugins/admin/systems/gencd.tpl
deleted file mode 100644 (file)
index f0c4496..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<p>
- <b>{t}CD-Install-Image generation{/t}</b>
-</p>
-<p>
-  {t}This option enables you to generate FAI install CD images for the selected workstation. The procedure may take about 10 minutes to complete, so please be patient after pressing the 'Create ISO-Image' button.{/t}
-</p>
-
-<p class="plugbottom">
-  <input type=submit name="cd_create" value="{t}Create ISO-Image{/t}">
-  &nbsp;
-  <input type=submit name="cd_cancel" value="{t}Cancel{/t}">
-</p>
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       nextfield= 'new_password';
-       focus_field('new_password');
-  -->
-</script>
diff --git a/plugins/admin/systems/gencd_frame.tpl b/plugins/admin/systems/gencd_frame.tpl
deleted file mode 100644 (file)
index 4c53bda..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-<iframe src='{$src}' style='width:100%; height:550px;background-color:#FFFFFF;'>
-       {t}Your browser does not supprt iframes.{/t}
-</iframe>
diff --git a/plugins/admin/systems/info.tpl b/plugins/admin/systems/info.tpl
deleted file mode 100644 (file)
index e088c59..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-<h2><img class="center" alt="" align="middle" src="images/info_small.png"> {t}System information{/t}</h2>
-<table summary="" style="width:100%;">
- <tr>
-  <td style="vertical-align:top; width:50%">
-   <table summary="">
-    <tr>
-     <td style="vertical-align:top"><b>{t}CPU{/t}</b></td><td>{$ghCpuType}</td>
-    </tr>
-    <tr>
-     <td><b>{t}Memory{/t}</b></td><td>{$ghMemSize}</td>
-    </tr>
-    <tr>
-     <td><b>{t}Boot MAC{/t}</b></td><td>{$macAddress}</td>
-    </tr>
-    <tr>
-     <td style="vertical-align:top;"><b>{t}USB support{/t}</b></td><td>{$ghUsbSupport}<div style="height:20px;"></div></td>
-    </tr>
-    <tr>
-     <td><b>{t}System status{/t}</b></td>
-     <td>{$status}</td>
-    </tr>
-    <tr>
-     <td><b>{t}Inventory number{/t}</b></td>
-     <td>{$ghInventoryNumber}</td>
-    </tr>
-    <tr>
-     <td><b>{t}Last login{/t}</b></td>
-     <td>{$gotoLastUser}</td>
-    </tr>
-   </table>
-  </td>
-  <td style="border-left:1px solid #A0A0A0">
-   &nbsp;
-  </td>
-  <td>
-   <table summary="">
-    <tr>
-     <td style="vertical-align:top"><b>{t}Network devices{/t}</b></td>
-     <td>
-      {foreach item=netcard from=$ghNetNic}
-        {$netcard}<br>
-      {/foreach}
-     </td>
-    </tr>
-    <tr><td colspan=2><div style="height:10px;"></div></td></tr>
-    <tr>
-     <td style="vertical-align:top;"><b>{t}IDE devices{/t}</b></td>
-     <td>
-       {foreach item=idedev from=$ghIdeDev}
-         {$idedev}<br>
-       {/foreach}
-     </td>
-    </tr>
-    <tr><td colspan=2><div style="height:10px;"></div></td></tr>
-    <tr>
-     <td style="vertical-align:top;"><b>{t}SCSI devices{/t}</b></td>
-     <td>
-       {foreach item=scsidev from=$ghScsiDev}
-         {$scsidev}<br>
-       {/foreach}
-     </td>
-    </tr>
-    <tr>
-     <td><b>{t}Floppy device{/t}</b></td>
-     <td>{$FloppyDevice}</td>
-    </tr>
-    <tr>
-     <td><b>{t}CDROM device{/t}</b></td>
-     <td>{$CdromDevice}</td>
-    </tr>
-    <tr><td colspan=2><div style="height:10px;"></div></td></tr>
-    <tr>
-     <td style="vertical-align:top"><b>{t}Graphic device{/t}</b></td>
-     <td>{$ghGfxAdapter}</td>
-    </tr>
-    <tr>
-     <td style="vertical-align:top"><b>{t}Audio device{/t}</b></td>
-     <td>{$ghSoundAdapter}</td>
-    </tr>
-   </table>
-  </td>
- </tr>
-</table>
-
-{if $active eq "true"}
-<br>
-<h2 style="border-top:1px solid #A0A0A0; padding-top:5px;"><img class="center" alt="" align="middle" src="images/lamp.png"> {t}System status{/t}</h2>
-<table summary="" style="width:100%">
- <tr>
-  <td style="vertical-align:top; width:50%">
-   <table summary="">
-    <tr>
-     <td><b>{t}Up since{/t}</b></td><td>{$uptime}</td>
-    </tr>
-    <tr>
-     <td><b>{t}CPU load{/t}</b></td><td>{$load}</td>
-    </tr>
-    <tr>
-     <td><b>{t}Memory usage{/t}</b></td><td>{$mem}</td>
-    </tr>
-    <tr>
-     <td><b>{t}Swap usage{/t}</b></td><td>{$swap}</td>
-    </tr>
-    <tr>
-     <td colspan=2>&nbsp;</td>
-    </tr>
-    {$partitions}
-   </table>
-  </td>
-  <td style="border-left:1px solid #A0A0A0">
-   &nbsp;
-  </td>
-  <td style="vertical-align:top;">
-   <table summary="">
-    <tr>
-     <td><b>{t}SSH service{/t}</b></td><td>{$sshd}</td>
-    </tr>
-    <tr>
-     <td><b>{t}Print service{/t}</b></td><td>{$cupsd}</td>
-    </tr>
-    <tr>
-     <td><b>{t}Scan service{/t}</b></td><td>{$saned}</td>
-    </tr>
-    <tr>
-     <td><b>{t}Sound service{/t}</b></td><td>{$artsd}</td>
-    </tr>
-    <tr>
-     <td><b>{t}GUI{/t}</b></td><td>{$X}</td>
-    </tr>
-   </table>
-  </td>
- </tr>
-</table>
-{/if}
-
diff --git a/plugins/admin/systems/main.inc b/plugins/admin/systems/main.inc
deleted file mode 100644 (file)
index f9bd8fb..0000000
+++ /dev/null
@@ -1,55 +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
-*/
-
-if ($remove_lock){
-        if(isset($_SESSION['systems'])){
-                $systems= $_SESSION['systems'];
-                $systems->remove_lock();
-                del_lock ($ui->dn);
-                sess_del ('systems');
-        }
-} else {
-       /* Create usermanagement object on demand */
-       if (!isset($_SESSION['systems']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
-               $_SESSION['systems']= new systems($config, $ui);
-       }
-       $systems= $_SESSION['systems'];
-       $systems->save_object();
-       $output= $systems->execute();
-
-       /* Reset requested? */
-       if (isset($_GET['reset']) && $_GET['reset'] == 1){
-               del_lock ($ui->dn);
-               sess_del ('systems');
-       }
-
-       /* Page header*/
-       if (isset($_SESSION['objectinfo'])){
-               $display= print_header(get_template_path('images/system.png'), _("System management"), "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".@LDAP::fix($_SESSION['objectinfo']));
-       } else {
-               $display= print_header(get_template_path('images/system.png'), _("System management"));
-       }
-
-       /* Show and save dialog */
-       $display.= $output;
-       $_SESSION['systems']= $systems;
-}
-
-?>
diff --git a/plugins/admin/systems/network.tpl b/plugins/admin/systems/network.tpl
deleted file mode 100644 (file)
index 7cb6b3f..0000000
+++ /dev/null
@@ -1,152 +0,0 @@
-<h2><img       class="center"  alt=""  align="middle"  src="images/network.png">       {t}Network      settings{/t}</h2>
-
-
-<table summary=""      width="100%" cellspacing=0 cellpadding=0>
-       <tr>
-               <td     style="width:50%; vertical-align: top;">
-                       <table  summary="">
-                               <tr>
-                                       <td><LABEL      for="ipHostNumber">{t}IP-address{/t}{if $IPisMust}{$staticAddress}{/if}</LABEL></td>
-                                       <td>
-{render acl=$ipHostNumberACL}
-            <input     id="ipHostNumber"       name="ipHostNumber"     size=25 maxlength=80    value="{$ipHostNumber}">
-{/render}
-{render acl=$ipHostNumberACL}
-{if $DNSAccount == true}
-      <input id="propose_ip" type="submit" name="propose_ip" value="{t}Propose ip{/t}" style="visibility:visible;">
-      {else}
-      <input id="propose_ip" type="submit" name="propose_ip" value="{t}Propose ip{/t}" style="visibility:hidden;">
-      {/if}
-{/render}
-          </td>
-                               </tr>
-                               <tr>
-                                       <td><LABEL      for="macAddress">{t}MAC-address{/t}</LABEL>{$staticAddress}</td>
-                                       <td>
-{render acl=$macAddressACL}
-            <input     name="macAddress"       id="macAddress" size=25 maxlength=80    value="{$macAddress}">
-{/render}
-            {if $autonet==true}
-                                           <input type="submit" name="autonet" value="{t}Autodetect{/t}">
-            {/if}
-          </td>
-                               </tr>
-        {if $dhcpEnabled}
-        <tr>
-          <td colspan=2 style='padding-top:12px;'>
-            <table>
-              {if $dhcpParentNodeCnt}
-              <tr>
-                <td>
-                  <input onClick='document.mainform.submit();'
-                    {if $dhcp_is_Account} checked {/if} type='checkbox' name='dhcp_is_Account' class='center'>
-                </td>
-                <td>
-                  {t}Enable DHCP for this device{/t}
-                  <input type='image' src='images/list_reload.png' class='center'>
-                </td>
-              </tr>
-              {else}
-              <tr>
-                <td>
-                  <input type='checkbox' name='dummy' class='center' disabled>
-                  {t}Enable DHCP for this device{/t} ({t}not configured{/t})
-                  <input type='image' src='images/list_reload.png' class='center'>
-                </td>
-              </tr>
-              {/if}
-              {if $dhcp_is_Account}
-              <tr>
-                <td>&nbsp;</td>
-                <td>
-                  {t}Parent node{/t}
-                  <select name='dhcpParentNode'>      
-                    {html_options options=$dhcpParentNodes selected=$dhcpParentNode}
-                  </select>
-                  &nbsp;
-                  <input type='submit' name='dhcpEditOptions' value='{t}Edit settings{/t}'>
-                </td>
-              </tr>
-              {/if}
-            </table>
-          </td>
-        </tr>
-        {/if}
-      </table> 
-    </td>
-    {if $DNS_is_account==true}
-               <td     style="width:50%;vertical-align:top;border-left:1px solid #b0b0b0;" valign="top">
-
-    {if $ZoneCnt}
-      {if $DNSAccount == true}
-      <input type="checkbox" name="DNS_is_account" value="1"  
-        checked="checked"
-        onclick="toggle('test2');
-          changeState('zoneName');
-          changeState('dNSTTL');
-          toggle('propose_ip');
-          changeState('AddNewRecord');
-          {$changeStateForRecords}"/>
-        {else}
-      <input type="checkbox" name="DNS_is_account" value="1"  
-        onclick="toggle('test2');
-          changeState('zoneName');
-          changeState('dNSTTL');
-          toggle('propose_ip');
-          changeState('AddNewRecord');"/>
-        {/if}
-
-      {t}Enable DNS for this device{/t}
-      <input type='image' src='images/list_reload.png' class='center' name="reloadThisDNSStuff" >
-      {if $DNSAccount == true}
-      <div style="padding-left:20px;visibility:visible;" id="test2">
-      {else}
-      <div style="padding-left:20px;visibility:hidden;" id="test2">
-      {/if}
-                       <table summary="">
-                               <tr>
-                                       <td><LABEL      for="zoneName">{t}Zone{/t}</LABEL></td>
-                                       <td>
-{render acl=$zoneNameACL}
-              <select name="zoneName" id="zoneName" {if $DNSAccount == false} disabled {/if}>
-                {html_options values=$ZoneKeys output=$Zones selected=$zoneName}
-              </select>
-{/render}
-          </td>
-        </tr>
-        <tr>
-          <td>{t}TTL{/t}</td>
-          <td>
-{render acl=$dNSTTLACL}
-            <input type="text" name="dNSTTL" value="{$dNSTTL}" id="dNSTTL" {if $DNSAccount == false} disabled {/if}>
-{/render}
-          </td>
-        </tr>
-        <tr>
-          <td valign="top">{t}Dns records{/t}</td>
-          <td>
-            {if $DNS_is_account == true}
-{render acl=$RecordsACL}
-              {$records}
-{/render}
-            {/if}
-          </td>
-                               </tr>
-                       </table>
-      </div>
-    {else}        
-      <input type="checkbox" name="dummy" value="1" disabled class='center'>
-      {t}Enable DNS for this device{/t} ({t}not configured{/t})
-      <input type='image' src='images/list_reload.png' class='center'>
-    {/if}
-
-               </td>
-    {/if}
-    
-       </tr>
-</table>
-<input type="hidden" name="network_tpl_posted" value="1">
-
-<!--
-vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
--->
diff --git a/plugins/admin/systems/password.tpl b/plugins/admin/systems/password.tpl
deleted file mode 100644 (file)
index 734a4ae..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-<p>
- {t}To change the terminal root password use the fields below. The changes take effect during the next reboot. Please memorize the new password, because you wouldn't be able to log in.{/t}
-</p>
-<p>
- <b>{t}Leave fields blank for password inheritance from default entries.{/t}</b>
-</p>
-
-<p>
- {t}Changing the password impinges on authentification only.{/t}
-</p>
-
-<table summary="" style="vertical-align:top; text-align:left;" cellpadding=4 border=0>
-  <tr>
-    <td><b><LABEL for="new_password">{t}New password{/t}</LABEL></b></td>
-    <td><input id="new_password" type="password" name="new_password" size="30" maxlength="40"
-               onFocus="nextfield= 'repeated_password';"></td>
-  </tr>
-  <tr>
-    <td><b><LABEL for="repeated_password">{t}Repeat new password{/t}</LABEL></b></td>
-    <td><input type="password" id="repeated_password" name="repeated_password" size="30" maxlength="40"
-               onFocus="nextfield= 'password_finish';"></td>
-  </tr>
-</table>
-
-<br>
-
-<p class="plugbottom">
-  <input type=submit name="password_finish" value="{t}Set password{/t}">
-  &nbsp;
-  <input type=submit name="password_cancel" value="{t}Cancel{/t}">
-</p>
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       nextfield= 'new_password';
-       focus_field('new_password');
-  -->
-</script>
diff --git a/plugins/admin/systems/paste_generic.tpl b/plugins/admin/systems/paste_generic.tpl
deleted file mode 100644 (file)
index b15920a..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-{if $object == "server"}
-    <table summary="">
-     <tr>
-      <td><LABEL for="cn">{t}Server name{/t}</LABEL>{$must}</td>
-      <td>
-       <input name="cn" id="cn" size=20 maxlength=60 value="{$cn}">
-      </td>
-     </tr>
-       </table>
-{/if}
-{if $object == "workstation"}
-    <table summary="">
-     <tr>
-      <td><LABEL for="cn">{t}workstation name{/t}</LABEL>{$must}</td>
-      <td>
-       <input name="cn" id="cn" size=20 maxlength=60 value="{$cn}">
-      </td>
-     </tr>
-       </table>
-{/if}
-{if $object == "terminal"}
-    <table summary="">
-     <tr>
-      <td><LABEL for="cn">{t}Terminal name{/t}</LABEL>{$must}</td>
-      <td>
-       <input name="cn" id="cn" size=20 maxlength=60 value="{$cn}">
-      </td>
-     </tr>
-       </table>
-{/if}
-{if $object == "printer"}
-    <table summary="">
-     <tr>
-      <td><LABEL for="cn">{t}Printer name{/t}</LABEL>{$must}</td>
-      <td>
-       <input name="cn" id="cn" size=20 maxlength=60 value="{$cn}">
-      </td>
-     </tr>
-       </table>
-{/if}
-{if $object == "phone"}
-    <table summary="">
-     <tr>
-      <td><LABEL for="cn">{t}Phone name{/t}</LABEL>{$must}</td>
-      <td>
-       <input name="cn" id="cn" size=20 maxlength=60 value="{$cn}">
-      </td>
-     </tr>
-       </table>
-{/if}
-{if $object == "component"}
-    <table summary="">
-     <tr>
-      <td><LABEL for="cn">{t}Component name{/t}</LABEL>{$must}</td>
-      <td>
-       <input name="cn" id="cn" size=20 maxlength=60 value="{$cn}">
-      </td>
-     </tr>
-       </table>
-{/if}
diff --git a/plugins/admin/systems/phone.tpl b/plugins/admin/systems/phone.tpl
deleted file mode 100644 (file)
index 58fdd60..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-<table summary="" width="100%">
- <tr>
-  <td style="vertical-align:top; width:50%; border-right:1px solid #A0A0A0">
-       <table summary="">
-        <tr>
-         <td><LABEL for="cn">{t}Phone name{/t}</LABEL>{$must}</td>
-         <td>
-{render acl=$cnACL}
-          <input id="cn" name="cn" size=20 maxlength=60 value="{$cn}">
-{/render}
-         </td>
-        </tr>
-        <tr>
-          <td colspan=2>&nbsp;</td>
-        </tr>
-        <tr>
-         <td><LABEL for="base">{t}Base{/t}</LABEL>{$must}</td>
-         <td>
-{render acl=$baseACL}
-      <select id="base" size="1" name="base" title="{t}Choose subtree to place group in{/t}">
-       {html_options options=$bases selected=$base_select}
-      </select>
-{/render}
-{render acl=$baseACL disable_picture='images/folder_gray.png'}
-        <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
-{/render}
-          </td>
-         </tr>
-       </table>
-  </td>
-  <td style="vertical-align:top">
-       <table summary="">
-        <tr>
-         <td><LABEL for="description">{t}Description{/t}</LABEL></td>
-         <td>
-{render acl=$descriptionACL}
-          <input name="description" id="description" size=25 maxlength=80 value="{$description}">
-{/render}
-          </td>
-        </tr>
-       </table>
-  </td>
- </tr>
-</table>
-
-<p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
-{include file="$phonesettings"}
-
-<p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
-{$netconfig}
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('cn');
-  -->
-</script>
diff --git a/plugins/admin/systems/phonesettings.tpl b/plugins/admin/systems/phonesettings.tpl
deleted file mode 100644 (file)
index 19385ac..0000000
+++ /dev/null
@@ -1,260 +0,0 @@
-<h2><img class="center" alt="" align="middle" src="images/select_phone.png"> {t}Advanced phone settings{/t}</h2>
-
-<table summary="" style="width:100%" border=0>
-       <tr>
-               <td colspan="2">
-               <LABEL for="selected_categorie">{t}Phone type{/t}</LABEL>{$staticAddress}
-{render acl=$categorieACL}
-               <select id="selected_categorie" size="1" name="selected_categorie" title="{t}Choose a phone type{/t}" onchange="mainform.submit();">
-                       {html_options options=$categories selected=$selected_categorie}
-               </select>
-{/render}
-               {if $javascript eq 'false'}
-                       <input type="submit" value="{t}refresh{/t}" name="refresh">
-               {/if}
-               <br>
-               <br>
-       </td>
-       </tr>
-{if $selected_categorie eq '0'}
-       <tr>
-               <td style="width:50%; border-right:1px solid #A0A0A0">
-                       <table summary="" border=0>
-                        <tr>
-                               <td>
-                                       <LABEL for="goFonType">{t}Mode{/t}</LABEL>{$staticAddress}
-                                       
-                               </td>
-                               <td>
-{render acl=$goFonTypeACL}
-                                       <select id="goFonType" size="1" name="goFonType" title="{t}Choose a phone type{/t}" style="width:200px;" {$goFonTypeUSED}>
-                                               {html_options options=$goFonTypes selected=$goFonType}
-                                       </select>
-{/render}
-                               </td>
-                        </tr>
-                        <tr>
-                               <td >
-                                       <LABEL for="goFonDmtfMode">{t}DTMF mode{/t}</LABEL>
-                               </td>
-                               <td>
-{render acl=$goFonDmtfModeACL}
-                                       <select size="1" id="goFonDmtfMode" name="goFonDmtfMode" title="{t}Choose a phone type{/t}" style="width:200px;" {$goFonDmtfModeUSED}>
-                                               {html_options options=$goFonDmtfModes selected=$goFonDmtfMode}
-                                       </select>
-{/render}
-                               </td>
-                       </tr>
-               </table>
-          </td>
-          <td>
-               <table summary="" border=0>
-                       <tr>
-                               <td >
-                                       <LABEL for="goFonDefaultIP">{t}Default IP{/t}</LABEL>
-                               </td>
-                <td>
-{render acl=$goFonDefaultIPACL}
-                    <select id="goFonDefaultIP" size="1" name="goFonDefaultIP" title="{t}Choose a phone type{/t}" style="width:200px;" >
-                        {html_options options=$goFonDefaultIPs selected=$goFonDefaultIP}
-                    </select>
-{/render}
-                   </td>
-                       </tr>
-                       <tr>
-                               <td >
-                                       <LABEL for="goFonQualify">{t}Response timeout{/t}</LABEL>
-                               </td>
-                               <td>
-{render acl=$goFonQualifyACL}
-                                       <input id="goFonQualify" style="width:200px" name="goFonQualify" value="{$goFonQualify}" {$goFonQualifyUSED}>
-{/render}
-                               </td>
-                       </tr>
-                       </table>
-               </td>
-        </tr>
-</table>
-{/if}
-
-{if $selected_categorie eq '1'}
-               
-       <tr>
-               <td style="vertical-align:top; width:50%; border-right:1px solid #A0A0A0">
-                       <table summary="" width="100%">
-                        <tr>
-                               <td>
-                                       <LABEL for="goFonType">{t}Modus{/t}{$staticAddress}</LABEL>
-                               </td>
-                               <td >
-{render acl=$goFonTypeACL}
-                                       <select size="1" id="goFonType" name="goFonType" title="{t}Choose a phone type{/t}" style="width:200px;" {$goFonTypeUSED}>
-                                               {html_options options=$goFonTypes selected=$goFonType}
-                                       </select>
-{/render}
-                               </td>
-                        </tr>
-                       <tr>
-                               <td >
-                                       <LABEL for="goFonDefaultIP">{t}Default IP{/t}</LABEL>
-                               </td>
-                               <td>
-{render acl=$goFonDefaultIPACL}
-                                       <input id="goFonDefaultIP" style="width:200px" name="goFonDefaultIP" value="{$goFonDefaultIP}" {$goFonDefaultIPUSED}>
-{/render}
-                               </td>
-                       </tr>
-                       <tr>
-                               <td >
-                                       <LABEL for="goFonQualify">{t}Response timeout{/t}</LABEL>
-                               </td>
-                               <td>
-{render acl=$goFonQualifyACL}
-                                       <input id="goFonQualify" style="width:200px" name="goFonQualify" value="{$goFonQualify}" {$goFonQualifyUSED}>
-{/render}
-                               </td>
-                       </tr>
-                       <tr>
-                               <td colspan=2>
-                                       &nbsp;                                  
-                               </td>
-                       </tr>
-                       <tr>
-                               <td>
-                                       <LABEL for="goFonAuth">{t}Authtype{/t}</LABEL>
-                               </td>
-                               <td>
-{render acl=$goFonAuthACL}
-                                       <select size="1" id="goFonAuth" name="goFonAuth" title="{t}Choose a phone type{/t}" style="width:200px;" {$goFonAuthUSED}>
-                                               {html_options options=$goFonAuths selected=$goFonAuth}
-                                       </select>
-{/render}
-                               </td>
-                       </tr>
-                       <tr>
-                               <td>    
-                                        <LABEL for="goFonSecret">{t}Secret{/t}</LABEL>
-                               </td>
-                               <td>
-{render acl=$goFonSecretACL}
-                                       <input id="goFonSecret" style="width:200px" name="goFonSecret" value="{$goFonSecret}" {$goFonSecretUSED}>
-{/render}
-                               </td>
-                       </tr>
-<!--                   <tr>
-                               <td>
-                                        {t}GoFonInkeys{/t}
-                               </td>
-                               <td>
-                                       <input style="width:200px" name="goFonInkeys" value="{$goFonInkeys}" {$goFonInkeysUSED}>
-                               </td>
-                       </tr>
-                       <tr>
-                               <td>
-                                        {t}GoFonOutKeys{/t}
-                               </td>
-                               <td>
-                                       <input style="width:200px" name="goFonOutkey" value="{$goFonOutkey}" {$goFonOutkeyUSED}>
-                               </td>
-                       </tr> -->
-                       <tr>
-                <td colspan=2>
-                                       &nbsp;
-                </td>
-            </tr>
-            <tr>
-                <td>
-                    <LABEL for="goFonAccountCode">{t}Account code{/t}</LABEL>
-                </td>
-                <td>
-{render acl=$goFonAccountCodeACL}
-                    <input id="goFonAccountCode" style="width:200px" name="goFonAccountCode" value="{$goFonAccountCode}" {$goFonAccountCodeUSED}>
-{/render}
-                </td>
-            </tr>
-            <tr>
-                <td>
-                    <LABEL for="goFonTrunk">{t}Trunk lines{/t}</LABEL>
-                </td>
-                <td>
-{render acl=$goFonTrunkACL}
-                     <select size="1" id="goFonTrunk" name="goFonTrunk" title="{t}Choose a phone type{/t}" {$goFonTrunkUSED}>
-                        {html_options options=$goFonTrunks selected=$goFonTrunk}
-                     </select>
-{/render}
-                 </td>
-            </tr>
-
-                       </table>
-               </td>
-               <td valign="top" style="vertical-align:top">
-                        <table summary="" width="100%">
-               <tr>
-                    <td style="vertical-align:top;">
-                        <LABEL for="goFonPermitS">{t}Hosts that are allowed to connect{/t}</LABEL><br>
-{render acl=$goFonPermitACL}
-                        <select id="goFonPermitS" style="width:100%; height:80px;" name="goFonPermitS" size=15
-                            multiple title="{t}List of alternative mail addresses{/t}">
-                            {html_options values=$goFonPermit output=$goFonPermit}
-                            <option disabled>&nbsp;</option>
-                        </select>
-{/render}
-                        <br>
-{render acl=$goFonPermitACL}
-                            <input name="goFonPermitNew" size=30 align="middle" maxlength="65" value="">
-{/render}
-{render acl=$goFonPermitACL}
-                        <input type=submit value="{t}Add{/t}" name="goFonPermitAdd">
-{/render}
-{render acl=$goFonPermitACL}
-                        <input type=submit value="{t}Delete{/t}" name="goFonPermitDel">
-{/render}
-                                               <br><br>
-                    </td>
-                </tr>
-                               <tr>
-                    <td style="vertical-align:top;">
-                       <LABEL for="goFonDenyS">{t}Hosts that are not allowed to connect{/t}</LABEL><br>
-{render acl=$goFonDenyACL}
-                        <select id="goFonDenyS" style="width:100%; height:80px;" name="goFonDenyS" size=15
-                            multiple title="{t}List of alternative mail addresses{/t}">
-                            {html_options values=$goFonDeny output=$goFonDeny}
-                            <option disabled>&nbsp;</option>
-                        </select>
-{/render}
-                        <br>
-{render acl=$goFonDenyACL}
-                            <input name="goFonDenyNew" size=30 align="middle" maxlength="65" value="">
-{/render}
-{render acl=$goFonDenyACL}
-                        <input type=submit value="{t}Add{/t}" name="goFonDenyAdd">
-{/render}
-{render acl=$goFonDenyACL}
-                        <input type=submit value="{t}Delete{/t}" name="goFonDenyDel">
-{/render}
-                    </td>
-                </table>
-    </tr>
-</table>
-{/if}
-
-{if $selected_categorie eq '2'}
-       <tr>
-               <td style="width:50%">
-                       <table summary="" width="100%">
-                               <tr>
-                                       <td>
-                                               <LABEL for="goFonMSN">{t}MSN{/t}</LABEL>&nbsp;
-{render acl=$goFonMSNACL}
-                                               <input id="goFonMSN" style="width:200px" name="goFonMSN" value="{$goFonMSN}" {$goFonMSNUSED}>
-{/render}
-                                       </td>
-                               </tr>
-                       </table>
-               </td>
-               <td>
-                       &nbsp;
-               </td>
-       </tr>
-</table>
-{/if}
diff --git a/plugins/admin/systems/ppd/class_printerPPDDialog.inc b/plugins/admin/systems/ppd/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/ppd/class_printerPPDSelectionDialog.inc b/plugins/admin/systems/ppd/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/ppd/printerPPDDialog.tpl b/plugins/admin/systems/ppd/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/ppd/printerPPDSelectionDialog.tpl b/plugins/admin/systems/ppd/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/ppd/remove_ppd.tpl b/plugins/admin/systems/ppd/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/printer.tpl b/plugins/admin/systems/printer.tpl
deleted file mode 100644 (file)
index e4ba965..0000000
+++ /dev/null
@@ -1,150 +0,0 @@
-<table summary="" width="100%">
- <tr>
-  <td style="vertical-align:top; width:50%; border-right:1px solid #B0B0B0">
-{if $StandAlone }
-   <h2>{t}General{/t}</h2>
-   <table summary="">
-    <tr>
-     <td><LABEL for="cn" >{t}Printer name{/t}</LABEL>{$must}</td>
-     <td>
-{render acl=$cnACL}
-      <input name="cn" id="cn" size=20 maxlength=60 value="{$cn}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><LABEL for="description">{t}Description{/t}</LABEL></td>
-     <td>
-{render acl=$descriptionACL}
-      <input id="description" name="description" size=25 maxlength=80 value="{$description}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-      <td colspan=2>&nbsp;</td>
-    </tr>
-    <tr>
-     <td><LABEL for="base">{t}Base{/t}</LABEL>{$must}</td>
-     <td>
-{render acl=$baseACL}
-      <select id="base" size="1" name="base" title="{t}Choose subtree to place user in{/t}">
-       {html_options options=$bases selected=$base_select}
-      </select>
-{/render}
-{render acl=$baseACL disable_picture='images/folder_gray.png'}
-      <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
-{/render}
-     </td>
-    </tr>
-   </table>
-  </td>
-  <td>
-{/if}
-   <h2>{t}Details{/t}</h2>
-   <table summary="">
-     <tr>
-       <td><LABEL for="l">{t}Printer location{/t}</LABEL></td>
-       <td>
-{render acl=$lACL}
-        <input id="l" name="l" size=25 maxlength=80 value="{$l}">
-{/render}
-       </td>
-     </tr>
-     <tr>
-       <td><LABEL for="labeledURI">{t}Printer URL{/t}</LABEL>{$must}</td>
-       <td>
-{render acl=$labeledURIACL}
-        <input id="labeledURI" name="labeledURI" size=25 maxlength=80 value="{$labeledURI}">
-{/render}
-       </td>
-     </tr>
-   </table>
-   <table summary="">
-    <tr> 
-     <td>
-      <br>
-      {t}Driver{/t}: <i>{$driverInfo}</i>&nbsp;
-{render acl=$gotoPrinterPPDACL mode=read_active}
-       <input type="submit" name="EditDriver" value="{t}Edit{/t}">
-{/render}
-{render acl=$gotoPrinterPPDACL}
-       <input type="submit" name="RemoveDriver" value="{t}Remove{/t}">
-{/render}
-     </td>
-    </tr>
-   </table>
-  </td>
- </tr>
-</table>
-
-<p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
-
-<h2><img class="center" alt="" align="middle" src="images/closedlock.png"> {t}Permissions{/t}</h2>
-<table summary="" width="100%">
- <tr>
-  <td style="border-right:1px solid #B0B0B0; width:50%">
-   <table style="width:100%" summary=''>
-    <tr>
-     <td>
-      {t}Users which are allowed to use this printer{/t}<br>
-{render acl=$gotoUserPrinterACL}
-      <select size="1" name="UserMember[]" title="{t}Users{/t}" style="width:100%;height:120px;"  multiple>
-       {html_options options=$UserMembers values=$UserMemberKeys}
-      </select><br>
-{/render}
-{render acl=$gotoUserPrinterACL}
-      <input type="submit" value="{t}Add user{/t}"  name="AddUser">
-{/render}
-{render acl=$gotoUserPrinterACL}
-      <input type="submit" value="{t}Add group{/t}" name="AddGroup">
-{/render}
-{render acl=$gotoUserPrinterACL}
-      <input type="submit" value="{t}Delete{/t}" name="DelUser">
-{/render}
-     </td>
-    </tr>
-   </table> 
-  </td>
-  <td>
-   <table style="width:100%" summary=''>
-    <tr>
-     <td>
-      {t}Users which are allowed to administrate this printer{/t}<br>
-{render acl=$gotoUserPrinterACL}
-           <select size="1" name="AdminMember[]" title="{t}Admins{/t}" style="width:100%;height:120px;"  multiple>
-                    {html_options options=$AdminMembers values=$AdminMemberKeys}
-                   </select><br>
-{/render}
-{render acl=$gotoUserPrinterACL}
-       <input type="submit" value="{t}Add user{/t}"  name="AddAdminUser">
-{/render}
-{render acl=$gotoUserPrinterACL}
-       <input type="submit" value="{t}Add group{/t}" name="AddAdminGroup">
-{/render}
-{render acl=$gotoUserPrinterACL}
-       <input type="submit" value="{t}Delete{/t}" name="DelAdmin">
-{/render}
-  
-     </td>
-    </tr>
-   </table>
-   
-  </td>
- </tr>
-</table>
-
-
-{if $netconfig ne ''}
-<p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
-{$netconfig}
-{/if}
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-
-  <!-- // First input field on page
-  if(document.mainform.cn)
-       focus_field('cn');
-  -->
-</script>
diff --git a/plugins/admin/systems/remove.tpl b/plugins/admin/systems/remove.tpl
deleted file mode 100644 (file)
index dc5dbb2..0000000
+++ /dev/null
@@ -1,23 +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 system and setup informations. 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">
-       {if $multiple}
-               <input type=submit name="delete_multiple_system_confirm" value="{t}Delete{/t}">
-               &nbsp;
-               <input type=submit name="delete_multiple_system_cancel" value="{t}Cancel{/t}">
-       {else}
-               <input type=submit name="delete_terminal_confirm" value="{t}Delete{/t}">
-               &nbsp;
-               <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
-       {/if}
-</p>
diff --git a/plugins/admin/systems/selectUserToPrinterDialog.tpl b/plugins/admin/systems/selectUserToPrinterDialog.tpl
deleted file mode 100644 (file)
index c60be22..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-    <input type="hidden" name="dialogissubmitted" value="1">
-
-       <table summary="{t}Select printer to add{/t}" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
-        <tr>
-            <td style="width:600px">
-                               <div class="contentboxh" style="height:20px;">
-                               <p class="contentboxh" style="font-size:12px">
-                                       <b><LABEL for="gotoPrinter">{t}Select entries to add{/t}</LABEL></b>
-                               </p>
-                               </div>
-                               <div class="contentboxb">
-                               <p class="contentboxb" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-                               <select style="width:600px;height:450px;" size=20 name="gotoPrinter[]" id="gotoPrinter" multiple>
-                               {html_options values=$gotoPrinterKeys output=$gotoPrinters}
-                               <option disabled>&nbsp;</option>
-                                        </select><br>
-                                       </p>
-                               </div>
-            </td>
-            <td valign="top">
-                               <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;background-color:#F8F8F8">
-                               {$alphabet}
-                               </table>
-                                       <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-                                               <tr>
-                                                       <td>
-                                                               <input type='checkbox' name='SubSearch' value='1' title='{t}Select to search within subtrees{/t}' onClick='document.mainform.submit();' {$subtree}>&nbsp;{t}Search in subtrees{/t}
-                                                       </td>
-                                               </tr>
-                                       </table>
-                               <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-                                       <tr>
-                                               <td>
-                                                       <label for="dspselectPrinter"><img class="center" alt="" src="{$tree_image}" align="middle" title="{t}Display members of department{/t}"></label>
-                                               </td>
-                                               <td style="width:99%">
-                                                       <select style="width:99%" name="depselectPrinter" size=1 onChange="mainform.submit()" title="{t}Choose the department the search will be based on{/t}">
-                                                         {html_options options=$deplistPrinter selected=$depselectPrinter}
-                                                       </select>
-                                               </td>
-                                       </tr>
-                               </table>
-                                       <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-                                                       <tr>
-                                                               <td>
-                                                                       <LABEL for='filter'><img class="center" alt="Search" src="{$search_image}" align="middle" title="{t}Display members matching{/t}">
-                                                                       </LABEL>
-                                                               </td>
-                                                       <td width="99%">
-                                                                       <input id='filter' style='width:99%' type='text' name='regexPrinter' maxlength='20' value='{$regexPrinter}' 
-                                                                                       title='{t}Regular expression for matching member names{/t}' onChange="mainform.submit()">
-                                                               </td>
-                                                       </tr>
-                                               </table>
-                                       {$apply}
-                               </div>
-               </td>
-       </tr>
-    </table>
-
-       <p class="seperator">&nbsp;</p>
-    <p align="right">
-    <input type="submit" name="PrinterSave"     value="{t}Add{/t}">
-    <input type="submit" name="PrinterCancel"   value="{t}Cancel{/t}">
-    </p>
-
diff --git a/plugins/admin/systems/server.tpl b/plugins/admin/systems/server.tpl
deleted file mode 100644 (file)
index 4e2d9b6..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-<table summary="" width="100%">
- <tr>
-  <td style="vertical-align:top; width:50%;">
-       <table summary="">
-        <tr>
-         <td><LABEL for="cn">{t}Server name{/t}</LABEL>{$must}</td>
-         <td>
-{render acl=$cnACL}
-          <input name="cn" id="cn" size=20 maxlength=60 value="{$cn}">
-{/render}
-         </td>
-        </tr>
-        <tr>
-         <td><LABEL for="description">{t}Description{/t}</LABEL></td>
-         <td>
-{render acl=$descriptionACL}
-           <input name="description" id="description" size=25 maxlength=80 value="{$description}">
-{/render}
-          </td>
-        </tr>
-        <tr>
-         <td><br><LABEL for="base">{t}Base{/t}</LABEL>{$must}</td>
-         <td>
-          <br>
-{render acl=$baseACL}
-      <select id="base" size="1" name="base" title="{t}Choose subtree to place group in{/t}">
-       {html_options options=$bases selected=$base_select}
-      </select>
-{/render}
-
-{render acl=$baseACL disable_picture='images/folder_gray.png'}
-        <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
-{/render}
-          </td>
-         </tr>
-       </table>
-  </td>
-  <td  style="vertical-align:top;border-left:1px solid #A0A0A0;">
-       <table summary="">
-       <tr>
-     <td>{t}Mode{/t}</td>
-     <td>
-{render acl=$gotoModeACL}
-      <select name="gotoMode" title="{t}Select terminal mode{/t}">
-       {html_options options=$modes selected=$gotoMode}
-      </select>
-{/render}
-     </td>
-    </tr>
-       </table>
-  </td>
- </tr>
-</table>
-
-<p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
-
-{$netconfig}
-
-{if $fai_activated}
-<p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
-
-<h2><img class="center" alt="" align="middle" src="images/rocket.png"> {t}Action{/t}</h2>
-<table summary="">
- <tr>
-  <td>
-{render acl=$FAIstateACL}
-   <select size="1" name="saction" title="{t}Select action to execute for this server{/t}">
-    <option disabled>&nbsp;</option>
-    {html_options options=$actions}
-   </select>
-{/render}
-  </td>
-  <td>
-   <input type=submit name="action" value="{t}Execute{/t}">
-  </td>
- </tr>
-</table>
-{/if}
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('cn');
-  -->
-</script>
diff --git a/plugins/admin/systems/services/ServiceAddDialog.tpl b/plugins/admin/systems/services/ServiceAddDialog.tpl
deleted file mode 100644 (file)
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/services/class_ServiceAddDialog.inc b/plugins/admin/systems/services/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/services/class_goService.inc b/plugins/admin/systems/services/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/services/cups/class_goCupsServer.inc b/plugins/admin/systems/services/cups/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/services/cups/goCupsServer.tpl b/plugins/admin/systems/services/cups/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/services/dhcp/class_dhcpAdvanced.inc b/plugins/admin/systems/services/dhcp/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/services/dhcp/class_dhcpGroup.inc b/plugins/admin/systems/services/dhcp/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/services/dhcp/class_dhcpHost.inc b/plugins/admin/systems/services/dhcp/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/services/dhcp/class_dhcpNetwork.inc b/plugins/admin/systems/services/dhcp/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/services/dhcp/class_dhcpNewSectionDialog.inc b/plugins/admin/systems/services/dhcp/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/services/dhcp/class_dhcpPool.inc b/plugins/admin/systems/services/dhcp/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/services/dhcp/class_dhcpService.inc b/plugins/admin/systems/services/dhcp/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/services/dhcp/class_dhcpSharedNetwork.inc b/plugins/admin/systems/services/dhcp/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/services/dhcp/class_dhcpSubnet.inc b/plugins/admin/systems/services/dhcp/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/services/dhcp/class_servDHCP.inc b/plugins/admin/systems/services/dhcp/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/services/dhcp/dhcpNewSection.tpl b/plugins/admin/systems/services/dhcp/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/services/dhcp/dhcp_advanced.tpl b/plugins/admin/systems/services/dhcp/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/services/dhcp/dhcp_group.tpl b/plugins/admin/systems/services/dhcp/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/services/dhcp/dhcp_host.tpl b/plugins/admin/systems/services/dhcp/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/services/dhcp/dhcp_network.tpl b/plugins/admin/systems/services/dhcp/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/services/dhcp/dhcp_pool.tpl b/plugins/admin/systems/services/dhcp/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/services/dhcp/dhcp_service.tpl b/plugins/admin/systems/services/dhcp/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/services/dhcp/dhcp_sharedNetwork.tpl b/plugins/admin/systems/services/dhcp/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/services/dhcp/dhcp_subnet.tpl b/plugins/admin/systems/services/dhcp/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/services/dhcp/remove_dhcp.tpl b/plugins/admin/systems/services/dhcp/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/services/dhcp/servdhcp.tpl b/plugins/admin/systems/services/dhcp/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/services/dns/class_servDNS.inc b/plugins/admin/systems/services/dns/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/services/dns/class_servDNSeditZone.inc b/plugins/admin/systems/services/dns/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/services/dns/class_servDNSeditZoneEntries.inc b/plugins/admin/systems/services/dns/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/services/dns/class_termDNS.inc b/plugins/admin/systems/services/dns/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/services/dns/servDNSeditZoneEntries.tpl b/plugins/admin/systems/services/dns/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/services/dns/servdns.tpl b/plugins/admin/systems/services/dns/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/services/dns/servdnseditzone.tpl b/plugins/admin/systems/services/dns/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/glpi/class_glpiAccount.inc b/plugins/admin/systems/services/glpi/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/services/glpi/class_glpiAttachmentPool.inc b/plugins/admin/systems/services/glpi/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/services/glpi/class_glpiDeviceManagement.inc b/plugins/admin/systems/services/glpi/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/services/glpi/class_glpiManufacturer.inc b/plugins/admin/systems/services/glpi/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/services/glpi/class_glpiPrinterAccount.inc b/plugins/admin/systems/services/glpi/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/services/glpi/class_glpiPrinterCartridges.inc b/plugins/admin/systems/services/glpi/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/services/glpi/class_glpiPrinterCartridgesEdit.inc b/plugins/admin/systems/services/glpi/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/services/glpi/class_glpiSelectUser.inc b/plugins/admin/systems/services/glpi/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/services/glpi/class_goGlpiServer.inc b/plugins/admin/systems/services/glpi/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/services/glpi/glpi.tpl b/plugins/admin/systems/services/glpi/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/services/glpi/glpiAttachmentEdit.tpl b/plugins/admin/systems/services/glpi/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/services/glpi/glpiAttachmentPool.tpl b/plugins/admin/systems/services/glpi/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/services/glpi/glpiDeviceManagement.tpl b/plugins/admin/systems/services/glpi/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/services/glpi/glpiManufacturer.tpl b/plugins/admin/systems/services/glpi/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/services/glpi/glpiManufacturerAdd.tpl b/plugins/admin/systems/services/glpi/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/services/glpi/glpiPrinter.tpl b/plugins/admin/systems/services/glpi/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/services/glpi/glpiPrinterCartridges.tpl b/plugins/admin/systems/services/glpi/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/services/glpi/glpiPrinterCartridgesEdit.tpl b/plugins/admin/systems/services/glpi/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/services/glpi/glpiSelectUser.tpl b/plugins/admin/systems/services/glpi/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/services/glpi/glpi_devices.tpl b/plugins/admin/systems/services/glpi/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/services/glpi/glpi_edit_cartridge_type.tpl b/plugins/admin/systems/services/glpi/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/services/glpi/glpi_edit_os.tpl b/plugins/admin/systems/services/glpi/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/services/glpi/glpi_edit_printer_type.tpl b/plugins/admin/systems/services/glpi/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/services/glpi/glpi_edit_type.tpl b/plugins/admin/systems/services/glpi/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/services/glpi/goGlpiServer.tpl b/plugins/admin/systems/services/glpi/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/services/glpi/remove_glpi.tpl b/plugins/admin/systems/services/glpi/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/services/gofax/class_goFaxServer.inc b/plugins/admin/systems/services/gofax/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/services/gofax/goFaxServer.tpl b/plugins/admin/systems/services/gofax/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/services/gofon/class_goFonServer.inc b/plugins/admin/systems/services/gofon/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/services/gofon/goFonServer.tpl b/plugins/admin/systems/services/gofon/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/services/imap/class_goImapServer.inc b/plugins/admin/systems/services/imap/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/services/imap/goImapServer.tpl b/plugins/admin/systems/services/imap/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/services/kerberos/class_goKrbServer.inc b/plugins/admin/systems/services/kerberos/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/services/kerberos/goKrbServer.tpl b/plugins/admin/systems/services/kerberos/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/services/kiosk/class_goKioskService.inc b/plugins/admin/systems/services/kiosk/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/services/kiosk/goKioskService.tpl b/plugins/admin/systems/services/kiosk/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/services/kolab/class_servKolab.inc b/plugins/admin/systems/services/kolab/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/services/kolab/servkolab.tpl b/plugins/admin/systems/services/kolab/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/services/ldap/class_goLdapServer.inc b/plugins/admin/systems/services/ldap/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/services/ldap/goLdapServer.tpl b/plugins/admin/systems/services/ldap/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/services/log/class_gosaLogServer.inc b/plugins/admin/systems/services/log/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/services/log/gosaLogServer.tpl b/plugins/admin/systems/services/log/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/services/mail/class_goMailServer.inc b/plugins/admin/systems/services/mail/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/services/mail/goMailServer.tpl b/plugins/admin/systems/services/mail/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/services/nfs/class_servNfs.inc b/plugins/admin/systems/services/nfs/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/services/nfs/servnfs.tpl b/plugins/admin/systems/services/nfs/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'>
diff --git a/plugins/admin/systems/services/ntp/class_goNtpServer.inc b/plugins/admin/systems/services/ntp/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/services/ntp/goNtpServer.tpl b/plugins/admin/systems/services/ntp/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/services/repository/class_servRepository.inc b/plugins/admin/systems/services/repository/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/services/repository/class_servRepositorySetup.inc b/plugins/admin/systems/services/repository/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/services/repository/servRepository.tpl b/plugins/admin/systems/services/repository/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/services/repository/servRepositorySetup.tpl b/plugins/admin/systems/services/repository/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/services/shares/class_goShareServer.inc b/plugins/admin/systems/services/shares/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/services/shares/goShareServer.tpl b/plugins/admin/systems/services/shares/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/services/spam/class_goSpamServer.inc b/plugins/admin/systems/services/spam/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/services/spam/class_goSpamServerRule.inc b/plugins/admin/systems/services/spam/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/services/spam/goSpamServer.tpl b/plugins/admin/systems/services/spam/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/services/spam/goSpamServerRule.tpl b/plugins/admin/systems/services/spam/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/services/syslog/class_goLogDBServer.inc b/plugins/admin/systems/services/syslog/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/services/syslog/class_goSyslogServer.inc b/plugins/admin/systems/services/syslog/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/services/syslog/goLogDBServer.tpl b/plugins/admin/systems/services/syslog/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/services/syslog/goSyslogServer.tpl b/plugins/admin/systems/services/syslog/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/services/terminal/class_goTerminalServer.inc b/plugins/admin/systems/services/terminal/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/services/terminal/goTerminalServer.tpl b/plugins/admin/systems/services/terminal/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/services/virus/class_goVirusServer.inc b/plugins/admin/systems/services/virus/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/services/virus/goVirusServer.tpl b/plugins/admin/systems/services/virus/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/tabs_arpnewdevice.inc b/plugins/admin/systems/tabs_arpnewdevice.inc
deleted file mode 100644 (file)
index fe12b40..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-<?php
-
-class ArpNewDeviceTabs extends tabs
-{
-
-  function save($ignore_account= FALSE)
-  {
-    tabs::save($ignore_account);
-  }
-
-  function execute()
-  {
-    tabs::execute(); 
-    return($this->by_object[$this->current]->execute());
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/tabs_component.inc b/plugins/admin/systems/tabs_component.inc
deleted file mode 100644 (file)
index 941203e..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-
-class componenttabs extends tabs
-{
-
-  function componenttabs($config, $data, $dn,$category)
-  {
-    tabs::tabs($config, $data, $dn,$category);
-
-    /* Add references/acls/snapshots */
-    $this->addSpecialTabs();
-  }
-
-  function save_object($save_current= FALSE)
-  {
-    tabs::save_object($save_current);
-  }
-
-
-  function save($ignore_account= FALSE)
-  {
-    /* Check for new 'dn', in order to propagate the
-       'dn' to all plugins */
-    $baseobject= $this->by_object['componentGeneric'];
-    $this->dn= "cn=$baseobject->cn,ou=netdevices,ou=systems,".$baseobject->base;
-    $baseobject->dn= $this->dn;
-
-    foreach ($this->by_object as $key => $obj){
-      $this->by_object[$key]->dn= $this->dn;
-    }
-
-    tabs::save(TRUE);
-
-    /* Fix tagging if needed */
-    $baseobject->handle_object_tagging();
-  }
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/tabs_phone.inc b/plugins/admin/systems/tabs_phone.inc
deleted file mode 100644 (file)
index 13d5ac3..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-
-class phonetabs extends tabs
-{
-
-  function phonetabs($config, $data, $dn,$category)
-  {
-    tabs::tabs($config, $data, $dn,$category);
-
-    /* Add references/acls/snapshots */
-    $this->addSpecialTabs();
-  }
-
-  function save_object($save_current= FALSE)
-  {
-    tabs::save_object($save_current);
-  }
-
-
-  function save($ignore_account= FALSE)
-  {
-    /* Check for new 'dn', in order to propagate the
-       'dn' to all plugins */
-    $baseobject= $this->by_object['phoneGeneric'];
-    $this->dn= "cn=$baseobject->cn,ou=phones,ou=systems,".$baseobject->base;
-    $baseobject->dn= $this->dn;
-
-    foreach ($this->by_object as $key => $obj){
-      $this->by_object[$key]->dn= $this->dn;
-    }
-
-    tabs::save(TRUE);
-
-    /* Fix tagging if needed */
-    $baseobject->handle_object_tagging();
-  }
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/tabs_printers.inc b/plugins/admin/systems/tabs_printers.inc
deleted file mode 100644 (file)
index 92963d6..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-<?php
-
-class printtabs extends tabs
-{
-
-  function printtabs($config, $data, $dn,$category)
-  {
-
-    /* Save dn */
-    $this->dn= $dn;
-    $this->config= $config;
-
-    $baseobject= NULL;
-
-    foreach ($data as $tab){
-      $this->by_name[$tab['CLASS']]= $tab['NAME'];
-
-      if ($baseobject === NULL){
-        $baseobject= new $tab['CLASS']($this->config, $this->dn,NULL,$this);
-        $this->by_object[$tab['CLASS']]= $baseobject;
-      } else {
-        $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn, $baseobject,$this);
-      }
-
-      $this->by_object[$tab['CLASS']]->parent= &$this;
-      $this->by_object[$tab['CLASS']]->set_acl_category($category);
-
-      /* Initialize current */
-      if ($this->current == ""){
-        $this->current= $tab['CLASS'];
-      }
-    }
-
-    /* Add references/acls/snapshots */
-    $this->addSpecialTabs();
-  }
-
-  function save_object($save_current= FALSE)
-  {
-    tabs::save_object($save_current);
-  }
-
-
-  function save($ignore_account= FALSE)
-  {
-    /* Check for new 'dn', in order to propagate the
-       'dn' to all plugins */
-    $baseobject= $this->by_object['printgeneric'];
-    $this->dn= "cn=$baseobject->cn,ou=printers,ou=systems,".$baseobject->base;
-    $baseobject->dn= $this->dn;
-
-    foreach ($this->by_object as $key => $obj){
-      $this->by_object[$key]->dn= $this->dn;
-    }
-
-    tabs::save(FALSE);
-
-    /* Fix tagging if needed */
-    $baseobject->handle_object_tagging();
-  }
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/tabs_server.inc b/plugins/admin/systems/tabs_server.inc
deleted file mode 100644 (file)
index 564e925..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-
-class servtabs extends tabs
-{
-
-  function servtabs($config, $data, $dn,$category)
-  {
-    /* Save dn */
-    $this->dn= $dn;
-    $this->config= $config;
-
-    $baseobject= NULL;
-
-    foreach ($data as $tab){
-      $this->by_name[$tab['CLASS']]= $tab['NAME'];
-
-      if ($baseobject === NULL){
-        $baseobject= new $tab['CLASS']($this->config, $this->dn,NULL,$this);
-        $this->by_object[$tab['CLASS']]= $baseobject;
-      } else {
-        $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn, $baseobject,$this);
-      }
-
-      $this->by_object[$tab['CLASS']]->parent= &$this;
-      $this->by_object[$tab['CLASS']]->set_acl_category($category);
-
-      /* Initialize current */
-      if ($this->current == ""){
-        $this->current= $tab['CLASS'];
-      }
-    }
-
-    /* Add references/acls/snapshots */
-    $this->addSpecialTabs();
-  }
-
-  function save_object($save_current= FALSE)
-  {
-    tabs::save_object($save_current);
-  }
-
-
-  function save($ignore_account= FALSE)
-  {
-    /* Check for new 'dn', in order to propagate the
-       'dn' to all plugins */
-    $baseobject= $this->by_object['servgeneric'];
-    $this->dn= "cn=$baseobject->cn,ou=servers,ou=systems,".$baseobject->base;
-    $baseobject->dn= $this->dn;
-
-    foreach ($this->by_object as $key => $obj){
-      $this->by_object[$key]->dn= $this->dn;
-      $this->by_object[$key]->cn= $baseobject->cn;
-    }
-
-    tabs::save(FALSE);
-
-    /* Reload server settings after saving */
-    $config= $_SESSION['config'];
-    $config->load_servers();
-    $_SESSION['config']= $config;
-
-    /* Fix tagging if needed */
-    $baseobject->handle_object_tagging();
-  }
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/tabs_terminal.inc b/plugins/admin/systems/tabs_terminal.inc
deleted file mode 100644 (file)
index 3a3b774..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-<?php
-
-class termtabs extends tabs
-{
-
-  function termtabs($config, $data, $dn, $category)
-  {
-    /* Save dn */
-    $this->dn= $dn;
-    $this->config= $config;
-
-    $baseobject= NULL;
-
-    foreach ($data as $tab){
-      $this->by_name[$tab['CLASS']]= $tab['NAME'];
-
-      if ($baseobject === NULL){
-        $baseobject= new $tab['CLASS']($this->config, $this->dn,NULL,$this);
-        $this->by_object[$tab['CLASS']]= $baseobject;
-      } else {
-        $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn, $baseobject,$this);
-      }
-
-      $this->by_object[$tab['CLASS']]->parent= &$this;
-      $this->by_object[$tab['CLASS']]->set_acl_category($category);
-
-      /* Initialize current */
-      if ($this->current == ""){
-        $this->current= $tab['CLASS'];
-      }
-    }
-
-    /* Add references/acls/snapshots */
-    $this->addSpecialTabs();
-  }
-
-  function save_object($save_current= FALSE)
-  {
-    tabs::save_object($save_current);
-
-    /* Update reference, transfer variables */
-    if(isset($this->by_object['termstartup'])){
-      $this->by_object['termstartup']->gotoTerminalPath= $this->by_object['termgeneric']->gotoTerminalPath;
-    }
-    
-    $base_obj = $this->by_object['termgeneric'];
-    foreach($this->by_object as $name => $plug){
-      $this->by_object[$name]->cn = $base_obj->cn;
-    }
-  }
-
-
-  function save($ignore_account= FALSE)
-  {
-    /* Check for new 'dn', in order to propagate the
-       'dn' to all plugins */
-    $baseobject= $this->by_object['termgeneric'];
-    $this->dn= "cn=".$baseobject->cn.",ou=terminals,ou=systems,".$baseobject->base;
-    $baseobject->dn= $this->dn;
-
-    foreach ($this->by_object as $key => $obj){
-      $this->by_object[$key]->dn= $this->dn;
-      $this->by_object[$key]->cn= $baseobject->cn;
-    }
-
-    tabs::save(TRUE);
-    if(isset($this->by_object['printgeneric'])){
-      if(($this->by_object['printgeneric']->is_account==false)&&($this->by_object['printgeneric']->initially_was_account==true)){
-        $this->by_object['printgeneric']->remove_from_parent();
-      }
-    }
-
-    /* Fix tagging if needed */
-    $baseobject->handle_object_tagging();
-  }
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/tabs_winstation.inc b/plugins/admin/systems/tabs_winstation.inc
deleted file mode 100644 (file)
index cada48b..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-
-class wintabs extends tabs
-{
-
-  function wintabs($config, $data, $dn,$category)
-  {
-    tabs::tabs($config, $data, $dn,$category);
-
-    /* Add references/acls/snapshots */
-    $this->addSpecialTabs();
-  }
-
-  function save_object($save_current= FALSE)
-  {
-    tabs::save_object($save_current);
-  }
-
-
-  function save($ignore_account= FALSE)
-  {
-    /* Check for new 'dn', in order to propagate the
-       'dn' to all plugins */
-
-    /* add $ to end of name if mising */
-    $baseobject= $this->by_object['wingeneric'];
-    if(!preg_match("/\\\$\$/",$baseobject->cn)){
-      $baseobject->cn .= "$";
-    }
-
-    $this->dn= "uid=$baseobject->cn,".get_winstations_ou().$baseobject->base;
-    $baseobject->dn= $this->dn;
-
-    foreach ($this->by_object as $key => $obj){
-      $this->by_object[$key]->dn= $this->dn;
-    }
-
-    tabs::save(TRUE);
-
-    /* Fix tagging if needed */
-    $baseobject->handle_object_tagging();
-  }
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/tabs_workstation.inc b/plugins/admin/systems/tabs_workstation.inc
deleted file mode 100644 (file)
index 6c34fd1..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-<?php
-
-class worktabs extends tabs
-{
-
-  function worktabs($config, $data, $dn,$category)
-  {
-    
-    /* Save dn */
-    $this->dn= $dn;
-    $this->config= $config;
-
-    $baseobject= NULL;
-
-    foreach ($data as $tab){
-      $this->by_name[$tab['CLASS']]= $tab['NAME'];
-
-      if ($baseobject === NULL){
-        $baseobject= new $tab['CLASS']($this->config, $this->dn,NULL,$this);
-        $this->by_object[$tab['CLASS']]= $baseobject;
-      } else {
-        $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn, $baseobject,$this);
-      }
-
-      $this->by_object[$tab['CLASS']]->parent= &$this;
-      $this->by_object[$tab['CLASS']]->set_acl_category($category);
-
-      /* Initialize current */
-      if ($this->current == ""){
-        $this->current= $tab['CLASS'];
-      }
-    }
-
-    /* Add references/acls/snapshots */
-    $this->addSpecialTabs();
-  }
-
-  function save_object($save_current= FALSE)
-  {
-    tabs::save_object($save_current);
-
-    /* Assign current cn */
-    $baseobject= $this->by_object['workgeneric'];
-    foreach ($this->by_object as $key => $obj){
-      $this->by_object[$key]->cn= $baseobject->cn;
-    }
-  }
-
-
-  function save($ignore_account= FALSE)
-  {
-    /* Check for new 'dn', in order to propagate the
-       'dn' to all plugins */
-    $baseobject= $this->by_object['workgeneric'];
-    $this->dn= "cn=".$baseobject->cn.",ou=workstations,ou=systems,".$baseobject->base;
-    $baseobject->dn= $this->dn;
-
-    foreach ($this->by_object as $key => $obj){
-      $this->by_object[$key]->dn= $this->dn;
-      $this->by_object[$key]->cn= $baseobject->cn;
-    }
-
-    tabs::save(TRUE);
-
-    if(isset($this->by_object['printgeneric'])){
-      if(($this->by_object['printgeneric']->is_account==false)&&($this->by_object['printgeneric']->initially_was_account==true)){
-        $this->by_object['printgeneric']->remove_from_parent();
-      }
-    }
-
-    /* Fix tagging if needed */
-    $baseobject->handle_object_tagging();
-  }
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/terminal.tpl b/plugins/admin/systems/terminal.tpl
deleted file mode 100644 (file)
index dc088f8..0000000
+++ /dev/null
@@ -1,176 +0,0 @@
-<h2><img class="center" alt="" align="middle" src="images/rightarrow.png"> {t}Properties{/t}</h2>
-<table summary="" style="width:100%;">
- <tr>
-  <td style="width:50%; vertical-align:top;">
-   <table summary="">
-    <tr>
-     {if $cn eq 'default'}
-     <td colspan=2>{t}Terminal template{/t}</td>
-     {else}
-     <td><LABEL for="cn">{t}Terminal name{/t}</LABEL>{$must}</td>
-     <td>
-{render acl=$cnACL}
-      <input name="cn" id="cn" size=18 maxlength=60 value="{$cn}">
-{/render}
-     </td>
-     {/if}
-    </tr>
-    <tr>
-     <td><LABEL for="base">{t}Base{/t}</LABEL>{$must}</td>
-     <td>
-
-{render acl=$baseACL}
-      <select id="base" size="1" name="base" title="{t}Choose subtree to place group in{/t}">
-       {html_options options=$bases selected=$base_select}
-      </select>
-{/render}
-{render acl=$baseACL disable_picture='images/folder_gray.png'}
-        <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
-{/render}
-     </td>
-    </tr>
-   </table>
-{if $member_of_ogroup}
-   <br>
-   <br>
-   <br>
-   <input type='submit' name='inheritAll' value='{t}Inherit all{/t}'>
-{/if}
-  </td>
-  <td style="vertical-align:top;border-left:1px solid #A0A0A0;" >
-   <table summary="">
-    <tr>
-     <td><LABEL for="gotoMode">{t}Mode{/t}</LABEL></td>
-     <td>
-{render acl=$gotoModeACL}
-      <select id="gotoMode" name="gotoMode" title="{t}Select terminal mode{/t}">
-       {html_options options=$modes selected=$gotoMode_select}
-      </select>
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><LABEL for="gotoSyslogServer">{t}Syslog server{/t}</LABEL></td>
-     <td>
-{render acl=$gotoSyslogServerACL}
-      <select name="gotoSyslogServer" id="gotoSyslogServer" title="{t}Choose server to use for logging{/t}">
-       {html_options options=$syslogservers selected=$gotoSyslogServer_select}
-      </select>
-{/render}
-     </td>
-    </tr>
-       </table>
-  </td>
- </tr>
-</table>
-<p class="seperator" style="margin:0px; padding:0px;">&nbsp;</p>
-<table style="width:100%;">
- <tr>
-  <td style="width:50%;vertical-align:top;">
-   <table summary="">
-    <tr>
-     <td><LABEL for="gotoTerminalPath">{t}Root server{/t}</LABEL></td>
-     <td>
-{render acl=$gotoTerminalPathACL}
-      <select name="gotoTerminalPath" id="gotoTerminalPath" title="{t}Select NFS root filesystem to use{/t}">
-       {html_options options=$nfsservers selected=$gotoTerminalPath_select}
-      </select>
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><LABEL for="gotoSwapServer">{t}Swap server{/t}</LABEL></td>
-     <td>
-{render acl=$gotoSwapServerACL}
-      <select name="gotoSwapServer" id="gotoSwapServer" title="{t}Choose NFS filesystem to place swap files on{/t}">
-       {html_options options=$nfsservers selected=$gotoSwapServer_select}
-      </select>
-{/render}
-     </td>
-    </tr>
-   </table>
-  </td>
-  <td style="border-left:1px solid #A0A0A0;">
-       <table width="100%">
-    <tr>
-        <td colspan="2">
-{if $member_of_ogroup}
-{render acl=$gotoNtpServerACL}
-               <input type="checkbox" value="1" name="inheritTimeServer"
-                       {if $inheritTimeServer } checked {/if} 
-                       onClick="javascript:
-                                       changeState('gotoNtpServerSelected');
-                                       changeState('gotoNtpServers');
-                                       changeState('addNtpServer');
-                                       changeState('delNtpServer');">{t}Inherit time server attributes{/t}
-{/render}
-{else}
-       <input disabled type='checkbox' name='option_disabled'>{t}Inherit time server attributes{/t}
-{/if}
-        </td>
-       </tr>
-       <tr>
-     <td colspan="2" style='padding-left:14px;padding-top:5px;'><LABEL for="gotoNtpServerSelected">{t}NTP server{/t}</LABEL><br>
-{render acl=$gotoNtpServerACL}
-      <select name="gotoNtpServerSelected[]" id="gotoNtpServerSelected" multiple size=5 style="width:100%;"
-                       title="{t}Choose server to use for synchronizing time{/t}" {if $inheritTimeServer} disabled {/if}>
-       {html_options options=$gotoNtpServer_select}
-      </select>
-{/render}
-        <br>
-{render acl=$gotoNtpServerACL}
-      <select name="gotoNtpServers" id="gotoNtpServers" {if $inheritTimeServer} disabled {/if} >
-       {html_options values=$ntpservers output=$ntpservers }
-      </select>
-{/render}
-{render acl=$gotoNtpServerACL}
-               <input type="submit" name="addNtpServer" value="{t}Add{/t}"             id="addNtpServer"
-                {if $inheritTimeServer} disabled {/if}>
-{/render}
-{render acl=$gotoNtpServerACL}
-               <input type="submit" name="delNtpServer" value="{t}Delete{/t}"  id="delNtpServer" 
-                {if $inheritTimeServer} disabled {/if}>
-{/render}
-     </td>
-    </tr>
-   </table>
-
-  </td>
- </tr>
-</table>
-
-{if $cn neq 'default'}
-<p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
-
-{$netconfig}
-{/if}
-
-{if $fai_activated}
-<p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
-<h2><img class="center" alt="" align="middle" src="images/rocket.png"> {t}Action{/t}</h2>
-<table summary="">
- <tr>
-  <td>
-{render acl=$gotoNtpServerACL}
-   <select size="1" name="saction" title="{t}Select action to execute for this terminal{/t}">
-    <option disabled>&nbsp;</option>
-    {html_options options=$actions}
-   </select>
-{/render}
-  </td>
-  <td>
-{render acl=$gotoNtpServerACL}
-   <input type=submit name="action" value="{t}Execute{/t}">
-{/render}
-  </td>
- </tr>
-</table>
-{/if}
-
-<input type="hidden" name="termgeneric_posted" value="1">
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('cn');
-  -->
-</script>
diff --git a/plugins/admin/systems/terminalService.tpl b/plugins/admin/systems/terminalService.tpl
deleted file mode 100644 (file)
index 72ba28b..0000000
+++ /dev/null
@@ -1,269 +0,0 @@
-<table style="width:100%;" summary="">
- <tr>
-  <td style="width:33%; vertical-align:top;">
-   <h2><img class="center" alt="" align="middle" src="images/keyboard.png"> {t}Keyboard{/t}</h2>
-   <table summary="">
-    <tr>
-     <td><LABEL for="gotoXKbModel">{t}Model{/t}</LABEL></td>
-     <td>
-{render acl=$gotoXKbModelACL}
-      <select id="gotoXKbModel" name="gotoXKbModel" title="{t}Choose keyboard model{/t}" >
-       {html_options options=$XKbModels selected=$gotoXKbModel_select}
-      </select>
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><LABEL for="gotoXKbLayout">{t}Layout{/t}</LABEL></td>
-     <td>
-{render acl=$gotoXKbLayoutACL}
-      <select id="gotoXKbLayout" name="gotoXKbLayout" title="{t}Choose keyboard layout{/t}" >
-       {html_options options=$XKbLayouts selected=$gotoXKbLayout_select}
-      </select>
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><LABEL for="gotoXKbVariant">{t}Variant{/t}</LABEL></td>
-     <td>
-{render acl=$gotoXKbVariantACL}
-      <select id="gotoXKbVariant" name="gotoXKbVariant" title="{t}Choose keyboard variant{/t}" >
-       {html_options options=$XKbVariants selected=$gotoXKbVariant_select}
-      </select>
-{/render}
-     </td>
-    </tr>
-   </table>
-
-  </td>
-
-  <td style="border-left:1px solid #A0A0A0">
-   &nbsp;
-  </td>
-  
-  <td style="vertical-align:top;width:32%">
-   <h2><img class="center" alt="" align="middle" src="images/mouse.png"> {t}Mouse{/t}</h2>
-   <table summary="">
-    <tr>
-     <td><LABEL for="gotoXMouseType">{t}Type{/t}</LABEL></td>
-     <td>
-{render acl=$gotoXMouseTypeACL}
-      <select name="gotoXMouseType" id="gotoXMouseType" title="{t}Choose mouse type{/t}" >
-       {html_options options=$MouseTypes selected=$gotoXMouseType_select}
-      </select>
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><LABEL for="gotoXMouseport">{t}Port{/t}</LABEL></td>
-     <td>
-{render acl=$gotoXMouseportACL}
-      <select id="gotoXMouseport" name="gotoXMouseport" title="{t}Choose mouse port{/t}" >
-       {html_options options=$MousePorts selected=$gotoXMouseport_select}
-      </select>
-{/render}
-     </td>
-    </tr>
-   </table>
-
-  </td>
-
-  <td style="border-left:1px solid #A0A0A0">
-   &nbsp;
-  </td>
-  
-  <td style="vertical-align:top;width:33%">
-   <h2><img class="center" alt="" align="middle" src="images/select_phone.png"> {t}Telephone hardware{/t}</h2>
-   <table style="width:100%" border=0 summary="">
-    <tr>
-     <td>{t}Telephone{/t}&nbsp;
-{render acl=$goFonHardwareACL}
-         {$hardware_list}
-{/render}
-     </td>
-    </tr>
-   </table>
-
-  </td>
- </tr>
-</table>
-
-<table style="width:100%;" summary="">
- <tr><td colspan=5><p class="plugbottom" style="text-align:left;"></p></td></tr>
- <tr>
-   <td style="width:33%;vertical-align:top;">
-   <h2><img class="center" alt="" align="middle" src="images/hardware.png"> {t}Graphic device{/t}</h2>
-   <table summary="">
-    <tr>
-     <td><LABEL for="gotoXDriver">{t}Driver{/t}</LABEL></td>
-     <td>
-{render acl=$gotoXDriverACL}
-      <select id="gotoXDriver" name="gotoXDriver" title="{t}Choose graphic driver that is needed by the installed graphic board{/t}" >
-       {html_options values=$XDrivers output=$XDrivers selected=$gotoXDriver_select}
-      </select>
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><LABEL for="gotoXResolution">{t}Resolution{/t}</LABEL></td>
-     <td>
-{render acl=$gotoXResolutionACL}
-      <select id="gotoXResolution" name="gotoXResolution" title="{t}Choose screen resolution used in graphic mode{/t}" >
-       {html_options options=$XResolutions selected=$gotoXResolution_select}
-      </select>
-{/render }
-     </td>
-    </tr>
-    <tr>
-     <td><LABEL for="gotoXColordepth">{t}Color depth{/t}</LABEL></td>
-     <td>
-{render acl=$gotoXColordepthACL}
-      <select id="gotoXColordepth" name="gotoXColordepth" title="{t}Choose colordepth used in graphic mode{/t}" >
-       {html_options options=$XColordepths selected=$gotoXColordepth_select}
-      </select>
-{/render}
-     </td>
-    </tr>
-   </table>
-   </td>
-
-  <td style="border-left:1px solid #A0A0A0">
-   &nbsp;
-  </td>
-
-   <td style="width:32%; vertical-align:top;">
-   <h2><img class="center" alt="" align="middle" src="images/display.png"> {t}Display device{/t}</h2>
-   <table summary="">
-    <tr>
-     <td>{t}Type{/t}</td>
-     <td>{$gotoXMonitor}</td>
-    </tr>
-    <tr>
-     <td>
-{render acl=$AutoSyncACL}
-      <input type="checkbox" name="AutoSync" value="1" {$AutoSyncCHK} onChange="changeState('gotoXHsync');changeState('gotoXVsync');">
-{/render}
-     </td>
-     <td>{t}Use DDC for automatic detection{/t}</td>
-    </tr>
-    <tr>
-     <td><LABEL for="gotoXHsync">{t}HSync{/t}</LABEL></td>
-     <td>
-{render acl=$gotoXHsyncACL}
-       <input id="gotoXHsync" name="gotoXHsync" size=10 maxlength=60 
-                value="{$gotoXHsync}" title="{t}Horizontal refresh frequency for installed monitor{/t}"> kHz</td>
-{/render}
-    </tr>
-    <tr>
-     <td><LABEL for="gotoXVsync">{t}VSync{/t}</LABEL></td>
-     <td>
-{render acl=$gotoXVsyncACL}
-      <input id="gotoXVsync"  name="gotoXVsync" size=10 maxlength=60 
-                value="{$gotoXVsync}" title="{t}Vertical refresh frequency for installed monitor{/t}"> Hz</td>
-{/render}
-    </tr>
-   </table>
-
-   </td>
-  <td style="border-left:1px solid #A0A0A0">
-   &nbsp;
-  </td>
-
-  <td style="width:33%; vertical-align:top;">
-   <h2><img class="center" alt="" align="middle" src="images/server.png"> {t}Remote desktop{/t}</h2>
-   <table summary="">
-    <tr>
-     <td></td>
-     <td><LABEL for="gotoXMethod">{t}Connect method{/t}</LABEL></td>
-     <td>
-{render acl=$gotoXMethodACL}
-      <select name="gotoXMethod" id="gotoXMethod" title="{t}Choose method to connect to terminal server{/t}" >
-       {html_options options=$XMethods selected=$gotoXMethod_select}
-      </select>
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td></td>
-     <td><LABEL for="gotoXdmcpServer">{t}Terminal server{/t}</LABEL></td>
-     <td>
-{render acl=$gotoXdmcpServerACL}
-      <select id="gotoXdmcpServer" name="gotoXdmcpServer" title="{t}Select specific terminal server to use{/t}" >
-       {html_options values=$xdmcpservers output=$xdmcpservers selected=$gotoXdmcpServer_select}
-      </select>
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td></td>
-     <td><LABEL for="gotoFontPath">{t}Font server{/t}</LABEL></td>
-     <td>
-{render acl=$gotoFontPathACL}
-      <select name="gotoFontPath" id="gotoFontPath" title="{t}Select specific font server to use{/t}" >
-       {html_options values=$fontservers output=$fontservers selected=$gotoFontPath_select}
-      </select>
-{/render}
-     </td>
-    </tr>
-   </table>
-   
-  </td>
- </tr>
-</table>
-
-<table style="width:100%;" summary="">
- <tr><td colspan=3><p class="plugbottom" style="margin-top:0px;"></p></td></tr>
-
- <tr>
-  <td style="width:50%; vertical-align:top;">
-   <h2><img class="center" alt="" align="middle" src="images/printer.png"><LABEL for="gotoLpdEnable"> {t}Print device{/t}</LABEL></h2>
-{render acl=$gotoLpdEnableACL}
-   <input id="gotoLpdEnable" type=checkbox name="gotoLpdEnable" value="1" {$gotoLpdEnable} title="{t}Select to start IPP based printing service on terminal{/t}">
-{/render}
-   {t}Provide print services{/t}
-   <br>
-
-   <table summary="">
-   <tr>
-     <td><div style="width:20px;"></div></td>
-     <td><LABEL for="gotoLpdServer">{t}Spool server{/t}</LABEL></td>
-     <td>
-{render acl=$gotoLpdServerACL}
-      <select name="gotoLpdServer" id="gotoLpdServer" title="{t}Select NFS filesystem to place spool files on{/t}" >
-       {html_options values=$nfsservers output=$nfsservers selected=$gotoLpdServer_select}
-      </select>
-{/render}
-     </td>
-    </tr>
-  </table>
-
-  <td style="border-left:1px solid #A0A0A0">
-   &nbsp;
-  </td>
-
-  <td style="vertical-align:top;">
-   <h2><img class="center" alt="" align="middle" src="images/scanner.png"> {t}Scan device{/t}</h2>
-{render acl=$gotoScannerEnableACL}
-   <input type=checkbox name="gotoScannerEnable" value="1" title="{t}Select to start SANE scan service on terminal{/t}" {$gotoScannerEnable} >
-{/render}
-   {t}Provide scan services{/t}
-   <br>
-   <table summary="">
-    <tr>
-     <td><div style="width:20px;"></div></td>
-     <td><LABEL for="gotoScannerModel">{t}Model{/t}</LABEL></td>
-     <td>
-{render acl=$gotoScannerEnableACL}
-      <select name="gotoScannerModel" id="gotoScannerModel" title="{t}Select scanner driver to use{/t}" >
-       {html_options values=$gotoScannerModels output=$gotoScannerModels selected=$gotoScannerModel_select}
-      </select>
-{/render}
-     </td>
-    </tr>
-  </table>
-
-  </td>
- </tr>
-</table>
-
-<div style="height:40px;"></div>
diff --git a/plugins/admin/systems/terminalStartup.tpl b/plugins/admin/systems/terminalStartup.tpl
deleted file mode 100644 (file)
index ccfacfb..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
-<h2><img class="center" alt="" align="middle" src="images/penguin.png"> {t}Boot parameters{/t}</h2>
-<table summary="" style="width:100%;">
- <tr>
-  <td style="width:50%; vertical-align:top;">
-
-   <table summary="" style="width:100%">
-    <tr>
-     <td style="width:30%"><LABEL for="gotoBootKernel">{t}Boot kernel{/t}</LABEL></td>
-     <td>
-{render acl=$gotoBootKernelACL}
-       <select id="gotoBootKernel" name="gotoBootKernel">
-       {html_options options=$gotoBootKernels  selected=$gotoBootKernel}
-       <option disabled>&nbsp;</option>
-       </select>
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><LABEL for="customParameters">{t}Custom options{/t}</LABEL></td>
-     <td>
-{render acl=$gotoKernelParametersACL}
-      <input name="customParameters" id="customParameters"  size=25 maxlength=500
-                value="{$customParameters}" title="{t}Enter any parameters that should be passed to the kernel as append line during bootup{/t}"></td>
-{/render}
-    </tr>
-    <tr>
-     <td colspan="2" style='vertical-align:top;padding-top:3px;width:100%'><LABEL for="gotoLdapServer">{t}LDAP server{/t}</LABEL>
-{render acl=$gotoLdapServerACL}
-(<input type='checkbox' name='gotoLdap_inherit' {if $gotoLdap_inherit} checked {/if} value="1"
-      onClick="document.mainform.submit();" class='center'>
-&nbsp;{t}inherit from group{/t})
-{if !$JS}
-      <input type='image' src="images/list_reload.png" alt='{t}Reload{/t}' class='center'>
-{/if}
-{/render}
-{render acl=$gotoLdapServerACL_inherit}
-        {$gotoLdapServers}
-{/render}
-{render acl=$gotoLdapServerACL_inherit}
-      <select name='ldap_server_to_add' id='ldap_server_to_add'>
-        {html_options options=$gotoLdapServerList}
-    </select>
-{/render}
-{render acl=$gotoLdapServerACL_inherit}
-      <input type='submit' name='add_ldap_server' value="{t}Add{/t}" id='add_ldap_server'>
-{/render}
-     </td>
-    </tr>
-   </table>
-
-  </td>
-
-  <td style="border-left:1px solid #A0A0A0">
-     &nbsp;
-  </td>
-  
-  <td style="vertical-align:top;">
-{render acl=$gotoKernelParametersACL}
-    <input type="radio" name="bootmode" value="G" title="{t}Select if terminal supports graphical startup with progress bar{/t}" {$graphicalbootup}>
-{/render}
-    {t}use graphical bootup{/t}
-    <br>
-{render acl=$gotoKernelParametersACL}
-    <input type="radio" name="bootmode" value="T" title="{t}Select if terminal should boot in text mode{/t}" {$textbootup}>
-{/render}
-    {t}use standard linux textual bootup{/t}
-    <br>
-{render acl=$gotoKernelParametersACL}
-    <input type="radio" name="bootmode" value="D" title="{t}Select to get more verbose output during startup{/t}" {$debugbootup}>
-{/render}
-    {t}use debug mode for startup{/t}
-  </td>
- </tr>
-</table>
-
-<table summary="" style="width:100%;">
- <tr><td colspan=2><p class="plugbottom" style="margin-top:0px;"></p></td></tr>
-
- <tr>
-  <td style="width:50%; vertical-align:top;">
-   <h2>
-    <img class="center" alt="" align="middle" src="images/hardware.png"> {t}Kernel modules (format: name parameters){/t}
-   </h2>
-{render acl=$gotoModulesACL}
-    <select style="width:100%;" name="modules_list[]" size=15 multiple title="{t}Add additional modules to load on startup{/t}">
-     {html_options values=$gotoModules output=$gotoModules}
-        <option disabled>&nbsp;</option>
-    </select>
-{/render}
-    <br>
-{render acl=$gotoModulesACL}
-    <input name="module" size=30 align=middle maxlength=30>
-{/render}
-{render acl=$gotoModulesACL}
-    <input type=submit value="{t}Add{/t}" name="add_module">&nbsp;
-{/render}
-{render acl=$gotoModulesACL}
-    <input type=submit value="{t}Delete{/t}" name="delete_module">
-{/render}
-  </td>
-
-  <td style="padding-left:10px;border-left:1px solid #A0A0A0;vertical-align:top">
-        <h2><img class="center" alt="" src="images/fai_partitionTable.png" align="middle">&nbsp;<LABEL for="gotoShare">{t}Shares{/t}</LABEL></h2>
-        <table summary="" style="width:100%">
-                <tr>
-                        <td>
-{render acl=$gotoShareACL}
-                        <select style="width:100%;" name="gotoShare" multiple size=15 id="gotoShare">
-                               {html_options values=$gotoShareKeys output=$gotoShares}
-                               <option disabled>&nbsp;</option>
-                        </select>
-{/render}
-                                <br>
-{render acl=$gotoShareACL}
-                               <select name="gotoShareSelection">
-                                       {html_options values=$gotoShareSelectionKeys output=$gotoShareSelections}
-                                       <option disabled>&nbsp;</option>
-                                </select>
-{/render}
-{render acl=$gotoShareACL}
-                                <input type="text" size=15 name="gotoShareMountPoint" value="{t}Mountpoint{/t}">
-{/render}
-{render acl=$gotoShareACL}
-                                <input type="submit" name="gotoShareAdd" value="{t}Add{/t}">
-{/render}
-{render acl=$gotoShareACL}
-                                <input type="submit" name="gotoShareDel" value="{t}Remove{/t}">
-{/render}
-                        </td>
-                </tr>
-        </table>
-  </td>
- </tr>
-</table>
-<input type='hidden' name='TerminalStarttabPosted' value="1">
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('gotoLdapServer');
-  -->
-</script>
diff --git a/plugins/admin/systems/wingeneric.tpl b/plugins/admin/systems/wingeneric.tpl
deleted file mode 100644 (file)
index fb58a6d..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-<table summary="" width="100%">
- <tr>
-  <td style="vertical-align:top; width:50%;">
-       <table summary="">
-        <tr>
-         <td><LABEL for="cn">{t}Machine name{/t}</LABEL>{$must}</td>
-         <td><input id="cn" name="cn" size=20 maxlength=60 value="{$cn}"></td>
-        </tr>
-        <tr>
-          <td colspan=2>&nbsp;</td>
-        </tr>
-        <tr>
-         <td><LABEL for="base">{t}Base{/t}</LABEL>{$must}</td>
-         <td>
-          <select size="1" id="base" name="base" title="{t}Choose subtree to place terminal in{/t}">
-           {html_options options=$bases selected=$base_select}
-          </select>
-               <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
-         </tr>
-       </table>
-  </td>
-  <td style="vertical-align:top">
-       <table summary="">
-        <tr>
-         <td><LABEL for="description">{t}Description{/t}</LABEL></td>
-         <td><input id="description" name="description" size=25 maxlength=80 value="{$description}"></td>
-        </tr>
-       </table>
-  </td>
- </tr>
-</table>
-
-<p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
-
-{$netconfig}
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('cn');
-  -->
-</script>
diff --git a/plugins/admin/systems/workstation.tpl b/plugins/admin/systems/workstation.tpl
deleted file mode 100644 (file)
index ba84899..0000000
+++ /dev/null
@@ -1,157 +0,0 @@
-<h2><img class="center" alt="" align="middle" src="images/rightarrow.png"> {t}Properties{/t}</h2>
-<table summary="" style="width:100%;">
- <tr>
-  <td style="width:50%; vertical-align:top;">
-   <table summary="">
-    <tr>
-{if $cn eq 'wdefault'}
-     <td colspan=2>{t}Workstation template{/t}</td>
-{else}
-     <td><LABEL for="cn">{t}Workstation name{/t}</LABEL>{$must}</td>
-     <td>
-{render acl=$cnACL}
-      <input name="cn" id="cn" size=18 maxlength=60 value="{$cn}">
-{/render}
-     </td>
-{/if}
-    </tr>
-    <tr>
-     <td><LABEL for="cn">{t}Location{/t}</LABEL></td>
-     <td>
-{render acl=$lACL}
-      <input name="l" id="l" size=18 maxlength=60 value="{$l}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><LABEL for="base">{t}Base{/t}</LABEL>{$must}</td>
-     <td>
-{render acl=$baseACL}
-      <select id="base" size="1" name="base" title="{t}Choose subtree to place group in{/t}">
-       {html_options options=$bases selected=$base_select}
-      </select>
-{/render}
-{render acl=$baseACL disable_picture='images/folder_gray.png'}
-        <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
-{/render}
-     </td>
-    </tr>
-   </table>
-{if $member_of_ogroup}
-   <br>
-   <br>
-   <br>
-   <input type='submit' name='inheritAll' value='{t}Inherit all{/t}'>
-{/if}
-  </td>
-  <td  style="vertical-align:top;border-left:1px solid #A0A0A0;">
-   <table summary="">
-    <tr>
-     <td>{t}Mode{/t}</td>
-     <td>
-{render acl=$gotoModeACL}
-      <select name="gotoMode" title="{t}Select terminal mode{/t}">
-       {html_options options=$modes selected=$gotoMode_select}
-      </select>
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><LABEL for="gotoSyslogServer">{t}Syslog server{/t}</LABEL></td>
-     <td>
-{render acl=$gotoSyslogServerACL}
-      <select id="gotoSyslogServer" name="gotoSyslogServer" title="{t}Choose server to use for logging{/t}">
-       {html_options options=$syslogservers selected=$gotoSyslogServer_select}
-      </select>
-{/render}
-     </td>
-    </tr>
-   </table>
-<p class="seperator">&nbsp;</p>
-   <table width="100%">
-    <tr>
-     <td colspan="2">
-{if $member_of_ogroup}
-{render acl=$gotoNtpServerACL}
-        <input type="checkbox" value="1" name="inheritTimeServer"
-            {if $inheritTimeServer } checked {/if}
-            onClick="javascript:
-                    changeState('gotoNtpServerSelected');
-                    changeState('gotoNtpServers');
-                    changeState('addNtpServer');
-                    changeState('delNtpServer');">{t}Inherit time server attributes{/t}
-{/render}
-{else}
-       <input disabled type='checkbox' name='option_disabled'>{t}Inherit time server attributes{/t}
-{/if}
-     </td>
-    </tr>
-    <tr>
-     <td colspan="2" style='padding-left:14px;padding-top:5px;'><LABEL for="gotoNtpServerSelected">{t}NTP server{/t}</LABEL><br>
-{render acl=$gotoNtpServerACL}
-      <select name="gotoNtpServerSelected[]" id="gotoNtpServerSelected" multiple size=5 style="width:100%;"
-            title="{t}Choose server to use for synchronizing time{/t}" {if $inheritTimeServer} disabled {/if}>
-       {html_options options=$gotoNtpServer_select}
-      </select>
-{/render}
-     <br>
-{render acl=$gotoNtpServerACL}
-      <select name="gotoNtpServers" id="gotoNtpServers" {if $inheritTimeServer} disabled {/if} >
-       {html_options options=$gotoNtpServers}
-      </select>
-{/render}
-{render acl=$gotoNtpServerACL}
-        <input type="submit" name="addNtpServer" value="{t}Add{/t}"     id="addNtpServer"
-         {if $inheritTimeServer} disabled {/if}>
-{/render}
-{render acl=$gotoNtpServerACL}
-        <input type="submit" name="delNtpServer" value="{t}Delete{/t}"  id="delNtpServer" 
-         {if $inheritTimeServer} disabled {/if}>
-{/render}
-     </td>
-    </tr>
-   </table>
-  </td>
- </tr>
-</table>
-{if $cn neq 'wdefault'}
-<p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
-
-{$netconfig}
-{/if}
-<p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
-
-{if $fai_activated}
-<h2><img class="center" alt="" align="middle" src="images/rocket.png"> {t}Action{/t}</h2>
-<table summary="">
- <tr>
-  <td>
-{render acl=$FAIstateACL}
-   <select size="1" name="saction" title="{t}Select action to execute for this terminal{/t}">
-    <option>&nbsp;</option>
-    {html_options options=$actions}
-   </select>
-{/render}
-  </td>
-  <td>
-   <input type=submit name="action" value="{t}Execute{/t}">
-  </td>
- </tr>
-</table>
-{/if}
-<input type="hidden" name="workgeneric_posted" value="1">
- {if $cn eq 'wdefault'}
-<!-- Place cursor -->
-               <script language="JavaScript" type="text/javascript">
-                 <!-- // First input field on page
-                       focus_field('l');
-                 -->
-               </script>
-     {else}
-               <script language="JavaScript" type="text/javascript">
-                 <!-- // First input field on page
-                       focus_field('cn');
-                 -->
-               </script>
-     {/if}
-
diff --git a/plugins/admin/systems/workstationService.tpl b/plugins/admin/systems/workstationService.tpl
deleted file mode 100644 (file)
index e5171fe..0000000
+++ /dev/null
@@ -1,224 +0,0 @@
-<table style="width:100%;" summary="">
- <tr>
-  <td style="width:33%; vertical-align:top;">
-   <h2><img class="center" alt="" align="middle" src="images/keyboard.png"> {t}Keyboard{/t}</h2>
-   <table summary="">
-    <tr>
-     <td><LABEL for="gotoXKbModel">{t}Model{/t}</LABEL></td>
-     <td>
-
-{render acl=$gotoXKbModelACL}
-      <select id="gotoXKbModel" name="gotoXKbModel" title="{t}Choose keyboard model{/t}">
-       {html_options options=$XKbModels selected=$gotoXKbModel_select}
-      </select>
-{/render}
-
-     </td>
-    </tr>
-    <tr>
-     <td><LABEL for="gotoXKbLayout">{t}Layout{/t}</LABEL></td>
-     <td>
-
-{render acl=$gotoXKbLayoutACL}
-      <select id="gotoXKbLayout" name="gotoXKbLayout" title="{t}Choose keyboard layout{/t}">
-       {html_options options=$XKbLayouts selected=$gotoXKbLayout_select}
-      </select>
-{/render}
-
-     </td>
-    </tr>
-    <tr>
-     <td><LABEL for="gotoXKbVariant">{t}Variant{/t}</LABEL></td>
-     <td>
-
-{render acl=$gotoXKbVariantACL}
-      <select id="gotoXKbVariant" name="gotoXKbVariant" title="{t}Choose keyboard variant{/t}">
-       {html_options options=$XKbVariants selected=$gotoXKbVariant_select}
-      </select>
-{/render}
-
-     </td>
-    </tr>
-   </table>
-
-  </td>
-
-  <td style="border-left:1px solid #A0A0A0">
-   &nbsp;
-  </td>
-  
-  <td style="vertical-align:top;width:32%">
-   <h2><img class="center" alt="" align="middle" src="images/mouse.png"> {t}Mouse{/t}</h2>
-   <table summary="">
-    <tr>
-     <td><LABEL for="gotoXMouseType">{t}Type{/t}</LABEL></td>
-     <td>
-
-{render acl=$gotoXMouseTypeACL}
-      <select name="gotoXMouseType" id="gotoXMouseType" title="{t}Choose mouse type{/t}">
-       {html_options options=$MouseTypes selected=$gotoXMouseType_select}
-      </select>
-     </td>
-{/render}
-
-    </tr>
-    <tr>
-     <td><LABEL for="gotoXMouseport">{t}Port{/t}</LABEL></td>
-     <td>
-
-{render acl=$gotoXMouseportACL}
-      <select id="gotoXMouseport" name="gotoXMouseport" title="{t}Choose mouse port{/t}">
-       {html_options options=$MousePorts selected=$gotoXMouseport_select}
-      </select>
-{/render}
-
-     </td>
-    </tr>
-   </table>
-
-  </td>
-
-  <td style="border-left:1px solid #A0A0A0">
-   &nbsp;
-  </td>
-  
-  <td style="vertical-align:top;width:33%">
-   <h2><img class="center" alt="" align="middle" src="images/select_phone.png"> {t}Telephone hardware{/t}</h2>
-   <table style="width:100%" border=0 summary="">
-    <tr>
-     <td>{t}Telephone{/t}&nbsp;
-
-{render acl=$goFonHardwareACL}
-         {$hardware_list}
-{/render}
-
-     </td>
-    </tr>
-   </table>
-
-  </td>
- </tr>
-</table>
-
-<table style="width:100%;" summary="">
- <tr><td colspan=5><p class="plugbottom" style="text-align:left;"></p></td></tr>
- <tr>
-   <td style="width:33%;vertical-align:top;">
-   <h2><img class="center" alt="" align="middle" src="images/hardware.png"> {t}Graphic device{/t}</h2>
-   <table summary="">
-    <tr>
-     <td><LABEL for="gotoXDriver">{t}Driver{/t}</LABEL></td>
-     <td>
-
-{render acl=$gotoXDriverACL}
-      <select id="gotoXDriver" name="gotoXDriver" title="{t}Choose graphic driver that is needed by the installed graphic board{/t}">
-       {html_options values=$XDrivers output=$XDrivers selected=$gotoXDriver_select}
-      </select>
-{/render}
-
-     </td>
-    </tr>
-    <tr>
-     <td><LABEL for="gotoXResolution">{t}Resolution{/t}</LABEL></td>
-     <td>
-
-{render acl=$gotoXResolutionACL}
-      <select id="gotoXResolution" name="gotoXResolution" title="{t}Choose screen resolution used in graphic mode{/t}">
-       {html_options options=$XResolutions selected=$gotoXResolution_select}
-      </select>
-{/render}
-
-     </td>
-    </tr>
-    <tr>
-     <td><LABEL for="gotoXColordepth">{t}Color depth{/t}</LABEL></td>
-     <td>
-
-{render acl=$gotoXColordepthACL}
-      <select id="gotoXColordepth" name="gotoXColordepth" title="{t}Choose colordepth used in graphic mode{/t}">
-       {html_options options=$XColordepths selected=$gotoXColordepth_select}
-      </select>
-{/render}
-
-     </td>
-    </tr>
-   </table>
-   </td>
-
-  <td style="border-left:1px solid #A0A0A0">
-   &nbsp;
-  </td>
-
-   <td style="width:32%; vertical-align:top;">
-   <h2><img class="center" alt="" align="middle" src="images/display.png"> {t}Display device{/t}</h2>
-   <table summary="">
-    <tr>
-     <td>{t}Type{/t}</td>
-     <td>{if $gotoXMonitor==""}{t}unknown{/t}{/if}{$gotoXMonitor}</td>
-    </tr>
-    <tr>
-       <td>
-
-{render acl=$AutoSyncACL}
-        <input type="checkbox" name="AutoSync" value="1" {$AutoSyncCHK} onChange="changeState('gotoXHsync');changeState('gotoXVsync');">
-{/render}
-
-        </td>
-       <td>{t}Use DDC for automatic detection{/t}</td>
-    </tr>
-    <tr>
-     <td><LABEL for="gotoXHsync">{t}HSync{/t}</LABEL></td>
-     <td>
-
-{render acl=$gotoXHsyncACL}
-       <input id="gotoXHsync" name="gotoXHsync" size=10 maxlength=60 {$hiddenState}
-                value="{$gotoXHsync}" title="{t}Horizontal refresh frequency for installed monitor{/t}"> kHz
-{/render}
-
-     </td>
-    </tr>
-    <tr>
-     <td><LABEL for="gotoXVsync">{t}VSync{/t}</LABEL></td>
-     <td>
-
-{render acl=$gotoXVsyncACL}
-       <input id="gotoXVsync"  name="gotoXVsync" size=10 maxlength=60 {$hiddenState}
-                value="{$gotoXVsync}" title="{t}Vertical refresh frequency for installed monitor{/t}"> Hz
-{/render}
-
-     </td>
-    </tr>
-   </table>
-
-   </td>
-  <td style="border-left:1px solid #A0A0A0">
-   &nbsp;
-  </td>
-
-  <td style="width:33%; vertical-align:top;">
-  
-
-   <h2><img class="center" alt="" align="middle" src="images/scanner.png"> {t}Scan device{/t}</h2>
-
-{render acl=$gotoScannerEnableACL}
-   <input type=checkbox name="gotoScannerEnable" value="1" title="{t}Select to start SANE scan service on terminal{/t}" {$gotoScannerEnable}>
-{/render}
-
-   {t}Provide scan services{/t}
-   <br>
-       </td>
- </tr>
-</table>
-
-
-<div style="height:40px;"></div>
-
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('gotoXKbModel');
-  -->
-</script>
-
-
-
-
diff --git a/plugins/admin/systems/workstationStartup.tpl b/plugins/admin/systems/workstationStartup.tpl
deleted file mode 100644 (file)
index d69b2ec..0000000
+++ /dev/null
@@ -1,244 +0,0 @@
-<table summary="" style="width:100%;">
- <tr>
-  <td style="width:50%; vertical-align:top;">
-<h2><img class="center" alt="" align="middle" src="images/penguin.png"> {t}Boot parameters{/t}</h2>
-
-   <table summary="" style="width:100%">
-    <tr>
-     <td><LABEL for="gotoBootKernel">{t}Boot kernel{/t}</LABEL></td>
-     <td style="width:70%">
-{render acl=$gotoBootKernelACL}
-        <select id="gotoBootKernel" name="gotoBootKernel">
-         {html_options options=$gotoBootKernels selected=$gotoBootKernel}
-       </select>
-{/render}
-      </td>
-    </tr>
-    <tr>
-     <td><LABEL for="customParameters">{t}Custom options{/t}</LABEL></td>
-     <td>
-{render acl=$gotoKernelParametersACL}
-       <input name="customParameters" id="customParameters" size=25 maxlength=500
-                value="{$customParameters}" title="{t}Enter any parameters that should be passed to the kernel as append line during bootup{/t}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td colspan="2" style='vertical-align:top;padding-top:3px;'><LABEL for="gotoLdapServer">{t}LDAP server{/t}</LABEL>
-{render acl=$gotoLdapServerACL}
-{if $member_of_ogroup}
-(<input type='checkbox' name='gotoLdap_inherit' {if $gotoLdap_inherit} checked {/if} value="1"
-       onClick="document.mainform.submit();" class='center'>
-&nbsp;{t}inherit from group{/t})
-{if !$JS}
-       <input type='image' src="images/list_reload.png" alt='{t}Reload{/t}' class='center'>
-{/if}
-{/if}
-{/render}
-{render acl=$gotoLdapServerACL_inherit}
-         {$gotoLdapServers}    
-{/render}
-{render acl=$gotoLdapServerACL_inherit}
-       <select name='ldap_server_to_add' id='ldap_server_to_add'>
-         {html_options options=$gotoLdapServerList}    
-    </select>
-{/render}
-{render acl=$gotoLdapServerACL_inherit}
-       <input type='submit' name='add_ldap_server' value="{t}Add{/t}" id='add_ldap_server'>
-{/render}
-     </td>
-    </tr>
-   </table>
-
-  </td>
-
-  <td style="border-left:1px solid #A0A0A0">
-     &nbsp;
-  </td>
-  
-  <td style="vertical-align:top;">
-
-       {if $fai_activated}
-
-               {if $FAIdebianMirror == "inherited"}
-
-                       <table>
-                               <tr>
-                                       <td>
-                                               <h2><img class="center" alt="" align="middle" src="images/fai_profile.png">&nbsp;{t}FAI server{/t}
-                                               </h2>
-                                       </td>
-                                       <td>
-                                               <h2><img class="center" alt="" align="middle" src="images/fai_profile.png">&nbsp;{t}Release{/t}
-                                               </h2>
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>
-       {render acl=$FAIdebianMirrorACL}
-                                               <select name="FAIdebianMirror"   onchange='document.mainform.submit()'>
-                                                       {foreach from=$FAIdebianMirrors item=val key=key}
-                                                                       {if $val.USE}
-                                                                                       <option value="{$key}" {if $FAIdebianMirror == $key} selected {/if}>{$val.NAME}</option>
-                                                                       {else}
-                                                                                       <option value="auto" disabled>{$val.NAME}</option>
-                                                                       {/if}
-                                                       {/foreach}
-                                               </select>
-       {/render}
-                                       </td>
-                                       <td>
-                                               <select name="FAIrelease"  disabled>
-                                               {html_options options=$InheritedFAIrelease output=$InheritedFAIrelease selected=$InheritedFAIrelease}
-                                               </select>
-                                       </td>
-                               </tr>
-                       </table>
-                       <h2>
-                               <img class="center" alt="" align="middle" src="images/fai_profile.png">&nbsp;{t}Assigned FAI classes{/t}
-                       </h2>
-       {render acl=$FAIclassACL}
-                       {$FAIScriptlist}        
-       {/render}
-               {else}
-
-                       <table>
-                               <tr>
-                                       <td>
-                                               <h2><img class="center" alt="" align="middle" src="images/fai_profile.png">&nbsp;{t}FAI server{/t}
-                                               </h2>
-                                       </td>
-                                       <td>
-                                               <h2><img class="center" alt="" align="middle" src="images/fai_profile.png">&nbsp;{t}Release{/t}
-                                               </h2>
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>
-       {render acl=$FAIdebianMirrorACL}
-                                               <select name="FAIdebianMirror" {$FAIdebianMirrorACL} onchange='document.mainform.submit()'>
-                                                       {foreach from=$FAIdebianMirrors item=val key=key}
-                                                               {if $val.USE}
-                                                                       <option value="{$key}" {if $FAIdebianMirror == $key} selected {/if}>{$val.NAME}</option>
-                                                               {else}
-                                                                       <option value="auto" disabled>{$val.NAME}</option>
-                                                               {/if}
-                                                       {/foreach}
-                                                       <option disabled>&nbsp;</option>
-                                               </select>
-       {/render}
-       {if $javascript eq 'false'}
-       {render acl=$FAIdebianMirrorACL}
-               <input type="submit" value="{t}set{/t}" name="refresh">
-       {/render}
-       {/if}
-                                       </td>
-                                       <td>
-       {render acl=$FAIreleaseACL}
-                                               <select name="FAIrelease"  onchange='document.mainform.submit()' {$FAIclassACL}>
-                                                       {foreach from=$FAIreleases item=val key=key}
-                                                               {if $val.USE}
-                                                                       <option value="{$val.NAME}" {if $FAIrelease == $key} selected {/if}>{$val.NAME}</option>
-                                                               {else}
-                                                                       <option value="auto" disabled>{$val.NAME}</option>
-                                                               {/if}
-                                                       {/foreach}
-                                               </select>
-       {/render}
-                                       </td>
-                               </tr>
-                       </table>
-                       <h2>
-                               <img class="center" alt="" align="middle" src="images/fai_profile.png">&nbsp;{t}Assigned FAI classes{/t}
-                       </h2>
-       {render acl=$FAIclassACL}
-                       {$FAIScriptlist}        
-       {/render}
-
-       {render acl=$FAIclassACL}
-                       <select name="FAIclassesSel">
-                               {html_options values=$FAIclassesKeys output=$FAIclasses}
-                               <option disabled>&nbsp;</option>
-                       </select>       
-       {/render}
-       {render acl=$FAIclassACL}
-                       <input name="AddClass" value="{t}Add{/t}" type="submit"> 
-       {/render}
-       <!--            <input name="DelClass" value="{t}Delete{/t}" type="submit"> -->
-               {/if}
-
-               {else}
-
-                       <h2>{t}FAI Object assignment disabled. You can't use this feature until FAI is activated.{/t}</h2>                      
-
-               {/if}
-               </td>
-       </tr>
-</table>
-
-<table summary="" style="width:100%;">
- <tr><td colspan=2><p class="plugbottom" style="margin-top:0px;"></p></td></tr>
-
- <tr>
-  <td style="width:50%; vertical-align:top; border-right:1px solid #B0B0B0">
-   <h2>
-    <img class="center" alt="" align="middle" src="images/hardware.png"> {t}Kernel modules (format: name parameters){/t}
-   </h2>
-{render acl=$gotoModulesACL}
-    <select style="width:100%; height:150px;" name="modules_list[]" size=15 multiple title="{t}Add additional modules to load on startup{/t}">
-     {html_options values=$gotoModules output=$gotoModules}
-        <option disabled>&nbsp;</option>
-    </select>
-{/render}
-    <br>
-{render acl=$gotoModulesACL}
-    <input name="module" size=30 align=middle maxlength=30>
-{/render}
-{render acl=$gotoModulesACL}
-    <input type=submit value="{t}Add{/t}" name="add_module">&nbsp;
-{/render}
-{render acl=$gotoModulesACL}
-    <input type=submit value="{t}Delete{/t}" name="delete_module">
-{/render}
-  </td>
-
-  <td style="vertical-align:top;">
-        <h2><img class="center" alt="" src="images/fai_partitionTable.png" align="middle">&nbsp;<LABEL for="gotoShare">{t}Shares{/t}</LABEL></h2>
-        <table summary="" style="width:100%">
-                <tr>
-                        <td>
-{render acl=$gotoShareACL}
-                        <select style="width:100%;height:150px;" name="gotoShare" multiple size=4 id="gotoShare">
-                                            {html_options values=$gotoShareKeys output=$gotoShares}
-                                                               <option disabled>&nbsp;</option>
-                                </select>
-{/render}
-                                <br>
-{render acl=$gotoShareACL}
-                        <select name="gotoShareSelection">
-                                                   {html_options values=$gotoShareSelectionKeys output=$gotoShareSelections}
-                                                       <option disabled>&nbsp;</option>
-                                </select>
-{/render}
-{render acl=$gotoShareACL}
-                                <input type="text" size=15 name="gotoShareMountPoint" value="{t}Mountpoint{/t}">
-{/render}
-{render acl=$gotoShareACL}
-                                <input type="submit" name="gotoShareAdd" value="{t}Add{/t}">
-{/render}
-{render acl=$gotoShareACL}
-                                <input type="submit" name="gotoShareDel" value="{t}Remove{/t}" {if $gotoSharesCount == 0} disabled {/if}>
-{/render}
-                        </td>
-                </tr>
-        </table>
-  </td>
- </tr>
-</table>
-<input name="WorkstationStarttabPosted" type="hidden" value="1">
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('gotoLdapServer');
-  -->
-</script>
diff --git a/plugins/admin/users/class_divListUsers.inc b/plugins/admin/users/class_divListUsers.inc
deleted file mode 100644 (file)
index 6ba71d7..0000000
+++ /dev/null
@@ -1,435 +0,0 @@
-<?php
-
-class divListUsers extends MultiSelectWindow
-{
-
-  /* Current base */
-  var $selectedBase       = "";
-  var $departments        = array();
-
-  /* Regex */
-  var $Regex              = "*";
-
-  /* CheckBoxes */
-  var $ShowTemplates ;
-  var $ShowFunctionalUsers;
-  var $ShowUnixUsers;
-  var $ShowMailUsers;
-  var $ShowSambaUsers;
-  var $ShowProxyUsers;
-
-  /* Subsearch checkbox */
-  var $SubSearch              = false;
-
-  var $parent             ;
-  var $ui                 ;
-
-  function divListUsers (&$config,$parent)
-  {
-    MultiSelectWindow::MultiSelectWindow($config, "Users", "users");
-    
-    $this->parent       = $parent;
-    $this->ui           = get_userinfo();
-
-    /* Set list strings */
-    $this->SetTitle(_("List of users"));
-    $this->SetSummary(_("List of users"));
-
-    /* Result page will look like a headpage */
-    $this->SetHeadpageMode();
-    $this->SetInformation(_("This menu allows you to create, edit and delete selected users. Having a great number of users, you may want to use the range selectors on top of the user list."));
-
-    $this->EnableAplhabet   (true);
-  
-    /* Disable buttonsm */
-    $this->EnableCloseButton(false);
-    $this->EnableSaveButton (false);
-
-    /* Dynamic action col, depending on snapshot icons */
-    $action_col_size = 122;
-    if($this->parent->snapshotEnabled()){
-      $action_col_size += 38;
-    }
-
-    /* Toggle all selected / deselected */
-    $chk = "<input type='checkbox' id='select_all' name='select_all' 
-               onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
-
-    /* set Page header */
-    $this->AddHeader(array("string"=> $chk,          "attach"=>"style='width:20px;'"));
-    $this->AddHeader(array("string"=> "&nbsp;",          "attach"=>"style='width:20px;'"));
-    $this->AddHeader(array("string"=>_("Username")." / "._("Department")));
-    $this->AddHeader(array("string"=>_("Properties"),   "attach" => "style='width:166px;'"));
-    $this->AddHeader(array("string"=>_("Actions"),      "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'"));
-    
-    $this->AddCheckBox("ShowTemplates"      ,_("Select to see template pseudo users")               ,_("Show templates")        , false);
-    $this->AddCheckBox("ShowFunctionalUsers",_("Select to see users that have only a GOsa object"),_("Show functional users") , true);
-    $this->AddCheckBox("ShowUnixUsers"      ,_("Select to see users that have posix settings")      ,_("Show unix users")       , true);
-    $this->AddCheckBox("ShowMailUsers"      ,_("Select to see users that have mail settings")       ,_("Show mail users")       , true);
-    $this->AddCheckBox("ShowSambaUsers"     ,_("Select to see users that have samba settings")      ,_("Show samba users")      , true);
-    $this->AddCheckBox("ShowProxyUsers"     ,_("Select to see users that have proxy settings")      ,_("Show proxy users")      , true);
-
-    /* Add SubSearch checkbox */
-    $this->AddCheckBox(SEPERATOR);
-    $this->AddCheckBox("SubSearch",  _("Select to search within subtrees"), _("Search in subtrees"), false);
-
-    /*                  Name                 ,Text                              ,Default  , Connect with alphabet  */
-    $this->AddRegex   ("Regex",     _("Display users matching"),"*" , true);
-  }
-
-
-  function GenHeader()
-  {
-    /* Prepare departments,
-       which are shown in the listbox on top of the listbox
-     */
-    $options= "";
-
-    /* Get all departments within this subtree */ 
-    $base = $this->config->current['BASE'];
-
-    /* Add base */
-    $tmp = array();
-    $tmp[] = array("dn"=>$this->config->current['BASE']);
-    $tmp=  array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
-                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
-    
-    $deps = array();
-    foreach($tmp as $tm){
-      $deps[$tm['dn']] = $tm['dn'];
-    }    
-
-
-    /* Load possible departments */
-    $ui= get_userinfo();
-    $tdeps= $ui->get_module_departments("users");
-    $ids = $this->config->idepartments;
-    $first = "";
-    $found = FALSE;
-    foreach($ids as $dep => $name){
-      if(isset($deps[$dep]) && in_array_ics($dep, $tdeps)){
-
-        /* Keep first base dn in mind, we could need this
-         *  info if no valid base was found
-         */
-        if(empty($first)) {
-          $first = $dep['dn'];
-        }
-
-        $value = $ids[$dep]; 
-        if ($this->selectedBase == $dep){
-          $found = TRUE;
-          $options.= "<option selected='selected' value='".$dep."'>$value</option>";
-        } else {
-          $options.= "<option value='".$dep."'>$value</option>";
-        }
-      }
-    }
-
-    /* The currently used base is not visible with your acl setup.
-     * Set base to first useable base. 
-     */
-    if(!$found){
-      $this->selectedBase = $first;
-    }
-
-    /* Get copy & paste icon */
-    $acl_all  = $ui->has_complete_category_acls($this->selectedBase,"users") ;
-    $acl      = $ui->get_permissions($this->selectedBase,"users/user");
-
-    /* Add default header */
-    $listhead = MultiSelectWindow::get_default_header();
-    $listhead .=
-      _("Base")."&nbsp;<select name='CurrentMainBase' 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;";
-
-
-    /* Create Layers menu */
-    $s  = ".|"._("Actions")."|\n";
-    $s .= "..|<img src='images/list_new.png' alt='' border='0' class='center'>".
-      "&nbsp;"._("Create")."|\n";
-
-    /* Append create options */
-    if(preg_match("/c/",$acl)) {
-      $s.= "...|<input class='center' type='image' src='images/list_new_user.png' alt=''>".
-        "&nbsp;"._("User")."|user_new|\n";
-      $s.= "...|<input class='center' type='image' src='images/list_new.png' alt=''>".
-        "&nbsp;"._("Template")."|user_tplnew|\n";
-    }
-
-    /* Multiple options */ 
-    $s.= "..|---|\n";
-    $s.= "..|<img src='images/edit.png' alt='' border='0' class='center'>".
-      "&nbsp;"._("Edit")."|"."multiple_edit|\n";
-    $s.= "..|<img src='images/list_password.png' alt='' border='0' class='center'>".
-      "&nbsp;"._("Change password")."|"."multiple_password_change|\n";
-    $s.= "..|<img src='images/edittrash.png' alt='' border='0' class='center'>".
-      "&nbsp;"._("Remove")."|"."remove_multiple|\n";
-
-    /* Add multiple copy & cut icons */
-    if(is_object($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
-      $s.= "..|---|\n";
-      $s.= "..|<img src='images/editcopy.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Copy")."|"."multiple_copy_systems|\n";
-      $s.= "..|<img src='images/editcut.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Cut")."|"."multiple_cut_systems|\n";
-      
-      if($this->parent->CopyPasteHandler->entries_queued()){
-        $img = "<img border='0' class='center' src='images/editpaste.png' alt=''>";
-        $s.="..|".$img."&nbsp;"._("Paste")."|editPaste|\n";
-      }else{
-        $img = "<img border='0' class='center' src='images/cant_editpaste.png' alt=''>";
-        $s.="..|".$img."&nbsp;"._("Paste")."\n";
-      }
-    }
-
-    /* Add snapshot icons */
-    if(preg_match("/(c.*w|w.*c)/",$acl_all)){
-      $s .= "..|---|\n";
-      $s .= $this->get_snapshot_header(TRUE);
-    }
-
-    $this->SetDropDownHeaderMenu($s);
-    $this->SetListHeader($listhead);
-  }
-
-  /* so some basic settings */
-  function execute()
-  {
-    $this->ClearElementsList();
-    $this->GenHeader();
-  }
-
-  function setEntries($list)
-  {
-    /********************
-      Variable init
-     ********************/
-    
-    $num_users      = 0;
-    $num_templates  = 0;
-
-    /* Variable initialation */
-    $enviro     = $posix = $maila = $faxac = $samba = $netatalk = "";
-    $empty      = "<img class='center' src='images/empty.png' style='width:16px;height:16px;' alt='-'>";
-    $userimg    = "<img class='center' src='images/select_user.png' alt='User' title='%s'>";
-    $tplimg     = "<img class='center' src='images/select_template.png' alt='Template' title='%s'>";
-    $editlink   = "<a href='?plug=".validate($_GET['plug'])."&amp;id=%s&amp;act=edit_entry'>%s</a>";
-
-    /* Dynamic action col, depending on snapshot icons */
-    $action_col_size = 122;
-    if($this->parent->snapshotEnabled()){
-      $action_col_size += 38;
-    }
-
-    /* Possilbe objectClass image combinations */  
-    $possibleAccounts = array(
-            "posixAccount"    => array("VAR"=>"posix"     ,"IMG"=>"posiximg"),
-            "gotoEnvironment" => array("VAR"=>"enviro"    ,"IMG"=>"eviroimg"),
-            "gosaMailAccount" => array("VAR"=>"maila"     ,"IMG"=>"mailimg"),
-            "goFaxAccount"    => array("VAR"=>"faxac"     ,"IMG"=>"faximg"),
-            "sambaSamAccount" => array("VAR"=>"samba"     ,"IMG"=>"sambaimg"),
-            "apple-user"      => array("VAR"=>"netatalk"  ,"IMG"=>"netatalkimg"));
-
-     /* Pictures for Extensions */
-    $usrimg   ="<input class='center' type='image' src='images/select_user.png' alt='"._("GOsa")."'
-                    name='user_edit_%KEY%-user' title='"._("Edit generic properties")."'>";
-    $posiximg = "<input class='center' type='image' src='images/penguin.png' alt='"._("Posix")."'
-                    name='user_edit_%KEY%-posixAccount' title='"._("Edit UNIX properties")."'>";
-    $eviroimg = "<input class='center' type='image' src='images/smallenv.png' alt='"._("Environment")."'
-                    name='user_edit_%KEY%-environment' title='"._("Edit environment properties")."'>";
-    $mailimg  = "<input class='center' type='image' src='images/mailto.png' alt='"._("Mail")."'
-                    name='user_edit_%KEY%-mailAccount' title='"._("Edit mail properties")."'>";
-    $fonimg   = "<input class='center' type='image' src='images/%image%' alt='"._("Phone")."'
-                    name='user_edit_%KEY%-phoneAccount' title='"._("Edit phone properties")."%title%'>";
-    $faximg   = "<input class='center' type='image' src='images/fax_small.png' alt='"._("Fax")."'
-                    name='user_edit_%KEY%-gofaxAccount' title='"._("Edit fax properies")."'>";
-    $sambaimg = "<input class='center' type='image' src='images/select_winstation.png' alt='"._("Samba")."'
-                    name='user_edit_%KEY%-sambaAccount' title='"._("Edit samba properties")."'>";
-    $netatalkimg = "<input class='center' type='image' src='images/select_netatalk.png' alt='"._("Netatalk")."'
-                    name='user_edit_%KEY%-netatalk' title='"._("Edit netatalk properties")."'>";
-    $tplcreateuserimg  = "<input type='image' class='center' src='images/list_new.png' alt='"._("Create user from template")."'
-                    name='userfrom_tpl_%KEY%' title='"._("Create user with this template")."'>";
-
-    /********************
-      END :: Variable init
-     ********************/
-
-    /********************
-      Append entries to divlist 
-     ********************/
-    $ui = get_userinfo(); 
-  
-    // Test Every Entry and generate divlist Array
-    foreach($list as $key => $val){
-  
-      /* Create action icons */
-      $action= "";
-
-      /* Add copy & cut icons */     
-      $acl_all  = $ui->has_complete_category_acls($this->selectedBase,"users") ;
-      $acl      = $ui->get_permissions($val['dn'],"users/user");
-      if(preg_match("/(c.*w|w.*c)/",$acl_all) && $this->parent->CopyPasteHandler){
-        $action .= "<input class='center' type='image'
-          src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
-        $action.= "<input class='center' type='image'
-          src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
-      }
-
-      /* Add deactivate status */
-      $lock_status = "";
-
-      if(isset($val['userPassword'][0]) && preg_match("/^\{[^\}]/",$val['userPassword'][0])){
-        if(preg_match("/^[^\}]*+\}!/",$val['userPassword'][0])){
-          $lock_status = "<input class='center' type='image' src='images/closedlock.png'
-            alt='"._("Deactivated")."' name='toggle_lock_status_%KEY%'>";
-        }else{
-          $lock_status = "<input class='center' type='image' src='images/openlock.png'
-            alt='"._("Active")."' name='toggle_lock_status_%KEY%'>";
-        }
-      }else{
-        $lock_status = "<img src='images/empty.png' alt=' ' class='center'>";
-      }
-
-      /* Generate edit icon */
-      $action.= "<input class='center' type='image' src='images/edit.png' alt='"._("edit")."'
-        name='user_edit_%KEY%' title='"._("Edit user")."'>";
-
-      /* Add deactivate status if we are allowed to */
-      if (preg_match("/w/",$acl_all)){
-        $action.= $lock_status;
-      }
-
-      /* Add Password change icon, if we are able to write users/password */
-      if(!in_array_ics("gosaUserTemplate",$val['objectClass']) && preg_match("/w/",$ui->get_permissions($val['dn'],"users/password"))) {
-        $action.= "<input class='center' type='image' src='images/list_password.png' alt='"._("password")."'
-          name='user_chgpw_%KEY%' title='"._("Change password")."'>";
-      }else{
-        $action.= "<img class='center' src='images/empty.png' alt='&nbsp;' 
-          title='"._("You are not allowed to change the password for this user.")."'>";
-      }
-
-      /* Add snapshot icon */
-      if(preg_match("/(c.*w|w.*c)/",$acl_all)){
-        $action.= $this->GetSnapShotActions($val['dn']);
-      }
-
-      /* Add remove icon, if we are allowed to remove the current user */
-      if(preg_match("/d/",$ui->get_permissions($val['dn'],"users/user"))) {
-        $action.= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."'
-          name='user_del_%KEY%' title='"._("Delete user")."'>";
-      }else{
-        $action.= "<img class='center' src='images/empty.png' alt='&nbsp;'  
-          title='"._("You are not allowed to remove this user.")."'>";
-      }
-
-      /* Create phonaccopunt informationm, if conencted && is phoneAccount */ 
-      if((in_array("goFonAccount"    ,$val['objectClass']))){
-
-        /* Set defaults */
-        $fonac = preg_replace("/%image%/", "select_phone.png", $fonimg);
-        $fonac = preg_replace("/%KEY%/", "$key", $fonac);
-        $fonac = preg_replace("/%title%/", "", $fonac);
-
-      }else{
-        $fonac=$empty;
-      }
-
-      /* Set images for different types of objectClasses */
-      foreach($possibleAccounts as $objectClass => $Settigns){ 
-        if(in_array($objectClass ,$val['objectClass'])){
-          $$Settigns['VAR'] = preg_replace("/%KEY%/", "$key", $$Settigns['IMG']);
-        }else{
-          $$Settigns['VAR'] = $empty;
-        }
-      }
-
-      /* Create userimg */
-      if(in_array("gosaUserTemplate",$val['objectClass'])){
-        $tpl                          = preg_replace("/%KEY%/", "$key", $tplimg);
-        $s_img_create_from_template   = preg_replace("/%KEY%/", "$key", $tplcreateuserimg);
-        $num_templates ++;
-      }else{
-        $s_img_create_from_template   = "";
-        $tpl                          = $userimg;
-        $num_users ++;
-      }
-
-      /* Insert key into userimg */
-      $usrimg2 = preg_replace("/%KEY%/", "$key", $usrimg);
-
-      // Generate caption for rows
-      if (isset($val["sn"]) && isset($val["givenName"])){
-        $display= $val["sn"][0].", ".$val["givenName"][0]." [".$val["uid"][0]."]";
-      } else {
-        $display= "[".$val["uid"][0]."]";
-      }
-
-      /* Connect all images */
-      $UseImg = $usrimg2."&nbsp;".$posix."&nbsp;".$enviro."&nbsp;".$maila."&nbsp;".$fonac."&nbsp;".$faxac."&nbsp;".$samba."&nbsp;".$netatalk;
-
-      /* Cutted objects should be displayed in light grey */ 
-      if($this->parent->CopyPasteHandler){
-        foreach($this->parent->CopyPasteHandler->queue as $queue_key => $queue_data){
-          if($queue_data['dn'] == $val['dn']) {
-            $display = "<font color='#999999'>".$display."</font>";
-            break;
-          }
-        }
-      }
-
-      /* Create each field */
-      $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
-                      "attach" => "style='width:20px;'");
-      $field1 = array("string" => sprintf($tpl,$val['dn']), "attach" => "style='text-align:center;width:20px;'");
-      $field2 = array("string" => sprintf($editlink,$key,$display), "attach" => "style='' title='".preg_replace('/ /', '&nbsp;', @LDAP::fix($val['dn']))."'");
-      $field3 = array("string" => $UseImg, "attach" => "style='width:166px;'");
-      $field4 = array("string" => $s_img_create_from_template.preg_replace("/%KEY%/", "$key", $action),
-                      "attach" => "style='width:".$action_col_size."px;border-right:0px;    text-align:right;'");
-      /* Add to list */
-      $add = array($field0,$field1,$field2,$field3,$field4);
-      $this->AddElement($add);
-
-      // Template or User
-      if(in_array("gosaUserTemplate",$val['objectClass'])){
-        $tpls[strtolower( $val['sn']['0'].$val['uid']['0'])]=$add;
-      }else{
-        $users[strtolower( $val['sn']['0'].$val['uid']['0'])]=$add;
-      }
-    }
-
-
-    /* Create summary string for list footer */
-    $num_deps=0;
-    if(!$this->SubSearch){
-      $num_deps = count($this->Added_Departments);
-    }
-    $num_users = count($list);
-
-    $num_user_str = _("Number of listed users");
-    $num_dep_str = _("Number of listed departments");
-
-    $str = "<img class='center' src='images/select_user.png'
-              title='".$num_user_str."' alt='".$num_user_str."'>&nbsp;".$num_users."&nbsp;&nbsp;&nbsp;&nbsp;";
-    $str.= "<img class='center' src='images/folder.png'
-              title='".$num_dep_str."' alt='".$num_dep_str."'>&nbsp;".$num_deps."&nbsp;&nbsp;&nbsp;&nbsp;";
-
-    $this->set_List_Bottom_Info($str);
-  }
-
-  function Save()
-  {
-    MultiSelectWindow :: Save();  
-  }
-
-  function save_object()
-  {
-    /* Save automatic created POSTs like regex, checkboxes */
-    MultiSelectWindow::save_object();   
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/users/class_userManagement.inc b/plugins/admin/users/class_userManagement.inc
deleted file mode 100644 (file)
index a031e89..0000000
+++ /dev/null
@@ -1,1117 +0,0 @@
-<?php
-/*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2003-2006 - Cajus Pollmeier <pollmeier@gonicus.de>
-
-   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 userManagement extends plugin
-{
-  /* Plugin definitions */
-  var $plHeadline= "Users";
-  var $plDescription= "This does something";
-
-  /* Dialog attributes */
-  var $usertab              = NULL;
-  var $ui                   = NULL;
-  var $templates            = array();
-  var $got_uid              = false;
-  var $CopyPasteHandler     = NULL;
-  var $CPPasswordChange     = ""; // Contains the entry id which should get a new password
-  var $DivListUsers;
-
-  var $pwd_change_queue     = array();
-
-  var $start_pasting_copied_objects = FALSE;
-  var $current_action ="";
-  var $msg_dialog= NULL;
-  
-  function userManagement(&$config, $ui)
-  {
-    /* Save configuration for internal use */
-    $this->config= &$config;
-    $this->ui= &$ui;
-
-    /* Copy & Paste handler */
-    if ($this->config->boolValueIsTrue("main", "enableCopyPaste")){
-      $this->CopyPasteHandler= new CopyPasteHandler($this->config);
-    }
-
-    /* Creat dialog object */
-    $this->DivListUsers = new divListUsers($this->config,$this);
-
-  }
-
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* LOCK MESSAGE Vars */
-    $_SESSION['LOCK_VARS_TO_USE'] = array("/^act$/","/^id$/","/^user_edit_/","/^user_del_/","/^item_selected/","/^remove_multiple_users/","/^multiple_edit/","/menu_action/");
-
-    $smarty       = get_smarty();                 // Smarty instance
-    $s_action     = "";                           // Contains the action to be taken
-    $s_entry      = "";                           // The value for s_action
-
-    /* Edit entry button pressed? */
-    if( isset($_GET['act']) && $_GET['act'] == "edit_entry" ){
-      $s_action= "edit";
-      $s_entry= validate($_GET['id']);
-    }
-
-    /* Test relevant POST values */  
-    foreach($_POST as $key => $val){
-
-      /* Get every possible POST combination and set s_action/s_entry accordingly */
-      foreach(array("del"       => "user_del",    
-                    "edit"      => "user_edit",
-                    "new"       => "user_new",
-                    "new_tpl"   => "user_tplnew",
-                    "del_multiple" => "^remove_multiple_users",
-                    "create_user_from_tpl"          => "userfrom_tpl",
-                    "change_pw" => "user_chgpw", 
-                    "editPaste" => "editPaste",  
-                    "copy_multiple" => "multiple_copy_users",
-                    "multiple_edit" => "multiple_edit",
-                    "cut_multiple" => "multiple_cut_users",
-                    "multiple_password_change" => "multiple_password_change",
-                    "copy"      => "^copy",
-                    "toggle_lock_status" => "toggle_lock_status",
-                    "cut"       => "^cut") as $act => $name){
-
-        if (preg_match("/".$name.".*/", $key)){
-          $s_action= $act;
-          $s_entry= preg_replace("/".$name."_/i", "", $key);
-          break;
-        }
-      }
-      
-    } /* ...Test POST */
-
-    /* Remove coordinate prefix from POST, required by some browsers */
-    $s_entry= preg_replace("/_.$/", "", $s_entry);
-
-    /* Seperate possibly encoded tab and entry, default to tab "user" */
-    if(preg_match("/.*-.*/", $s_entry)){
-      $s_tab= preg_replace("/^[^-]*-/i", "" ,$s_entry);
-      $s_entry= preg_replace("/-[^-]*$/i", "", $s_entry);
-    }else{
-      $s_tab= "user";
-    }
-
-    if(!$this->config->search($s_tab, 'class',array('tabs'))){
-      $s_tab = "user";
-    }
-
-
-    /* handle C&P from layers menu */
-    if(isset($_POST['menu_action']) && preg_match("/^multiple_copy_systems/",$_POST['menu_action'])){
-      $s_action = "copy_multiple";
-    }
-    if(isset($_POST['menu_action']) && preg_match("/^multiple_cut_systems/",$_POST['menu_action'])){
-      $s_action = "cut_multiple";
-    }
-    if(isset($_POST['menu_action']) && preg_match("/^editPaste/",$_POST['menu_action'])){
-      $s_action = "editPaste";
-    }
-
-    /* Create options */
-    if(isset($_POST['menu_action']) && $_POST['menu_action'] == "user_new"){
-      $s_action = "new";
-    }
-    if(isset($_POST['menu_action']) && $_POST['menu_action'] == "user_tplnew"){
-      $s_action = "new_tpl";
-    }
-    if(isset($_POST['menu_action']) && $_POST['menu_action'] == "multiple_edit"){
-      $s_action = "multiple_edit";
-    }
-
-    /* handle remove from layers menu */
-    if(isset($_POST['menu_action']) && preg_match("/^multiple_password_change/",$_POST['menu_action'])){
-      $s_action = "multiple_password_change";
-    }
-
-    /* handle remove from layers menu */
-    if(isset($_POST['menu_action']) && preg_match("/^remove_multiple/",$_POST['menu_action'])){
-      $s_action = "del_multiple";
-    }
-
-
-    /********************
-      Copy & Paste 
-     ********************/
-
-    /* Display the copy & paste dialog, if it is currently open */
-    if($this->CPPasswordChange == ""){
-      $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
-      if($ret){
-        return($ret);
-      }
-    }
-
-
-    /********************
-      Change password confirmed
-     ********************/
-
-    /* Perform password change */
-    if (isset($_POST['password_finish'])){
-
-      /* For security reasons, check if user is allowed to set password again */
-      $dn  = $this->dn;
-      $acl = $this->ui->get_permissions($dn, "users/password");
-      $cacl= $this->ui->get_permissions($dn, "users/user");
-
-      if (preg_match('/w/', $acl) || preg_match('/c/', $cacl)){
-
-        /* Check input and feed errors into 'message' */
-        $message= array();
-
-        /* Sanity checks... */
-        if ($_POST['new_password'] != $_POST['repeated_password']){
-
-          /* Matching passwords in new and repeated? */
-          $message[]= _("The passwords you've entered as 'New password' and 'Repeated new password' do not match.");
-        } else {
-
-          /* Empty password is not permitted by default. */
-          if ($_POST['new_password'] == ""){
-            $message[]= _("The password you've entered as 'New password' is empty.");
-          }
-        }
-
-        /* Errors, or password change? */
-        if (count($message) != 0){
-
-          /* Show error message and continue editing */
-          show_errors ($message);
-          return($smarty->fetch(get_template_path('password.tpl', TRUE)));
-        }
-
-        $config= $this->config;
-        $ldap_ui= $this->config->get_ldap_link();
-        if(isset($this->usertab->dn)){
-          $ldap_ui->cat($this->usertab->dn,array("uid"));
-          $user = $ldap_ui->fetch();
-        }else{
-          $ldap_ui->cat($this->dn,array("uid"));
-          $user = $ldap_ui->fetch();
-        }
-        if((is_array($user))&&(isset($user['uid']))){
-          $username= $user['uid'][0];
-        }
-
-        /* Set password, perform required steps */
-        if ($this->usertab){
-          if ($this->usertab->password_change_needed()){
-            $obj= $this->usertab->by_object['user'];
-            change_password ($this->usertab->dn, $_POST['new_password'],0, $obj->pw_storage);
-            if (isset($config->data['MAIN']['EXTERNALPWDHOOK'])){
-              exec($config->data['MAIN']['EXTERNALPWDHOOK']." ".$username." ".$_POST['new_password'], $resarr);
-            }
-            new log("modify","users/".get_class($this),$this->usertab->dn,array(),"Password has been changed");
-            unset($this->usertab);
-            $this->usertab= NULL;
-          }
-        } else {
-          change_password ($this->dn, $_POST['new_password']);
-          if (isset($config->data['MAIN']['EXTERNALPWDHOOK'])){
-            exec($config->data['MAIN']['EXTERNALPWDHOOK']." ".$username." ".$_POST['new_password'], $resarr);
-          }
-          new log("modify","users/".get_class($this),$this->dn,array(),"Password has been changed");
-        }
-      } else {
-
-        /* Missing permissions, show message */
-        msg_dialog::display(_("Password change failed."),_("You are not allowed to set this users password!"),WARNING_DIALOG);
-      }
-      /* Clean session, delete lock */
-      del_lock ($this->dn);
-      unset ($this->usertab);
-      $this->usertab= NULL;
-      $this->lognames= array();;
-      $this->sn= "";
-      $this->givenName= "";
-      $this->uid= "";
-      unset ($_SESSION['objectinfo']);
-    }
-
-
-    /********************
-     Change multiple passwords requested 
-     ********************/
-  
-    if($s_action == "multiple_password_change"){
-      $this->pwd_change_queue = $this->list_get_selected_items();
-    }    
-
-
-    /********************
-      Change password requested  
-     ********************/
-
-    /* Password change requested */
-    if (($s_action == "change_pw") || (!empty($this->CPPasswordChange)) || count($this->pwd_change_queue)){
-
-      /* Get users whose passwords should be changed. */
-      if(count($this->pwd_change_queue)){
-        $s_entry= array_pop($this->pwd_change_queue);
-      }
-
-      if(!empty($this->CPPasswordChange)){
-        $s_entry = $this->CPPasswordChange;
-        $this->CPPasswordChange = "";
-      }
-
-      /* Get 'dn' from posted 'uid' */
-      $this->dn= $this->list[trim($s_entry)]['dn'];
-
-      /* Load permissions for selected 'dn' and check if
-         we're allowed to remove this 'dn' */
-      if (preg_match("/w/",$this->ui->get_permissions($this->dn,"users/password"))){
-
-        /* User is allowed to change passwords, save 'dn' and 'acl' for next
-           dialog. */
-        $_SESSION['objectinfo']= $this->dn;
-        return ($smarty->fetch(get_template_path('password.tpl', TRUE)));
-        
-
-      } else {
-        /* User is not allowed. Show message and cancel. */
-        msg_dialog::display(_("Password change"),_("You are not allowed to set this users password!"),WARNING_DIALOG);
-      }
-    }
-
-
-
-     /********************
-      Edit existing entry
-     ********************/
-
-    /* User wants to edit data? */
-    if (($s_action=="edit") && (!isset($this->usertab->config))){
-
-      /* Get 'dn' from posted 'uid', must be unique */
-      $this->dn= $this->list[trim($s_entry)]['dn'];
-
-      /* Check locking, save current plugin in 'back_plugin', so
-         the dialog knows where to return. */
-      if (($user= get_lock($this->dn)) != ""){
-        return(gen_locked_message ($user, $this->dn));
-      }
-
-      /* Lock the current entry, so everyone will get the
-         above dialog */
-      add_lock ($this->dn, $this->ui->dn);
-
-      /* Register usertab to trigger edit dialog */
-      $this->usertab= new usertabs($this->config,
-          $this->config->data['TABS']['USERTABS'], $this->dn);
-
-      /* Switch tab, if it was requested by the user */
-      $this->usertab->current = $s_tab;
-
-      /* Set ACL and move DN to the headline */
-      $this->usertab->set_acl_base($this->dn);
-      $_SESSION['objectinfo']= $this->dn;
-    }
-
-
-    /********************
-      Edit multiple entries
-     ********************/
-
-    /* User wants to edit data? */
-    if ($s_action == "multiple_edit" && !isset($this->usertab->config)){
-
-      $this->dn = array();
-      foreach($this->list_get_selected_items() as $id){
-        $this->dn[] = $this->list[$id]['dn'];;
-      }
-      $tmp = new multi_plug($this->config,"usertabs",$this->config->data['TABS']['USERTABS'],
-            $this->dn,$this->DivListUsers->selectedBase,"user");
-      if ($tmp->entries_locked()){
-        return($tmp->display_lock_message());
-      }
-      $tmp->lock_entries($this->ui->dn);
-      if($tmp->multiple_available()){
-        $this->usertab = $tmp;
-        $this->usertab->set_active_tab($s_tab);
-        $_SESSION['objectinfo']= $this->usertab->get_object_info();
-      }
-    }
-
-
-    /********************
-      Edit canceled 
-     ********************/
-
-    /* Reset all relevant data, if we get a _cancel request */
-    if (isset($_POST['edit_cancel']) || isset($_POST['password_cancel'])){
-      if (isset($this->usertab)){
-        del_lock ($this->usertab->dn);
-        unset ($this->usertab);
-      }
-      $this->usertab= NULL;
-      $this->lognames= array();;
-      $this->sn= "";
-      $this->givenName= "";
-      $this->uid= "";
-      unset ($_SESSION['objectinfo']);
-    }
-
-
-    /********************
-      Delete MULTIPLE entries requested, display confirm dialog
-     ********************/
-
-    if ($s_action=="del_multiple"){
-      $ids = $this->list_get_selected_items();
-      $this->dns = array();
-      if(count($ids)){
-
-        foreach($ids as $id){
-          $dn = $this->list[$id]['dn'];
-          if (($user= get_lock($dn)) != ""){
-            return(gen_locked_message ($user, $dn));
-          }
-          $this->dns[$id] = $dn; 
-        }
-
-        $dns_names = "<br><pre>";
-        foreach($this->dns as $dn){
-          $dns_names .= $dn."\n";
-        }
-        $dns_names .="</pre>";
-
-        /* Lock the current entry, so nobody will edit it during deletion */
-        if (count($this->dns) == 1){
-          $info = sprintf(_("You're about to delete the following entry: %s"), @LDAP::fix($dns_names));
-        } else {
-          $info = sprintf(_("You're about to delete the following entries: %s"), @LDAP::fix($dns_names));
-        }
-        $this->msg_dialog = new msg_dialog(_("Delete users"),$info,CONFIRM_DIALOG);
-        $this->current_action = $s_action;
-      }
-    }
-
-
-    /********************
-      Delete MULTIPLE entries confirmed 
-     ********************/
-
-      /* Confirmation for deletion has been passed. Users should be deleted. */
-      if ($this->current_action == "del_multiple" && is_object($this->msg_dialog) && $this->msg_dialog->is_confirmed()){
-        
-        $this->current_action = "";  
-        
-        /* Remove user by user and check acls before removeing them */
-        foreach($this->dns as $key => $dn){
-
-          $acl = $this->ui->get_permissions($dn, "users/user"); 
-          if (preg_match('/d/', $acl)){
-
-            /* Delete request is permitted, perform LDAP action */
-            $this->usertab= new usertabs($this->config, $this->config->data['TABS']['USERTABS'],$dn);
-            $this->usertab->set_acl_base();
-            $this->usertab->delete ();
-            unset ($this->usertab);
-            $this->usertab= NULL;
-          } else {
-            msg_dialog::display(_("User delete"),sprintf(_("You are not allowed to delete the user '%s'!"),$dn),WARNING_DIALOG);
-            if(isset($this->ui->uid)){
-              new log("security","users/".get_class($this),$dn,array(),"Tried to trick deletion.");
-            }
-          }
-          /* Remove lock file after successfull deletion */
-          del_lock ($dn);
-          unset($this->dns[$key]);
-      }
-    }
-
-
-    /********************
-      Delete MULTIPLE entries Canceled 
-     ********************/
-
-    /* Remove lock */
-    if(isset($_POST['delete_multiple_user_cancel'])){
-      foreach($this->dns as $key => $dn){
-        del_lock ($dn);
-        unset($this->dns[$key]);
-      }
-    }
-  
-  
-    /********************
-      Toggle lock status for user
-     ********************/
-  
-    if($s_action == "toggle_lock_status" && isset($this->list[$s_entry])){
-
-      /* Get entry check current status */
-      $val = $this->list[$s_entry];
-      $pwd = $val['userPassword'][0];
-
-      if(!preg_match("/^\{[^\}]/",$pwd)){
-        trigger_error("Can not deactivate user which is using clear password encryption.");
-      }else{
-
-        $locked = false;
-        if(preg_match("/^[^\}]*+\}!/",$pwd)){
-          $locked = true;
-        }
-
-        /* Create ldap array to update status */
-        $attrs = array("userPassword" => $pwd);
-        if($locked){
-          $attrs['userPassword'] = preg_replace("/(^[^\}]+\})!(.*$)/","\\1\\2",$attrs['userPassword']);
-        }else{
-          $attrs['userPassword'] = preg_replace("/(^[^\}]+\})(.*$)/","\\1!\\2",$attrs['userPassword']);
-        }
-
-        /* Write new status back to ldap */
-        $ldap = $this->config->get_ldap_link();
-        $ldap->cd($val['dn']);
-        $ldap->modify($attrs);
-        if($locked){
-          show_ldap_error($ldap->get_error(),_("Could not set user status from locked to unlocked."));
-        }else{
-          show_ldap_error($ldap->get_error(),_("Could not set user status from unlocked to locked."));
-        }
-      }
-    }
-
-
-    /********************
-      Delete entry requested, display confirm dialog
-     ********************/
-
-    /* Remove user was requested */
-    if ($s_action=="del"){
-
-      /* Get 'dn' from posted 'uid' */
-      $this->dn= $this->list[trim($s_entry)]['dn'];
-
-      /* Load permissions for selected 'dn' and check if
-         we're allowed to remove this 'dn' */
-
-      /* Check locking, save current plugin in 'back_plugin', so
-         the dialog knows where to return. */
-      if (($user= get_lock($this->dn)) != ""){
-        return(gen_locked_message ($user, $this->dn));
-      }
-
-  
-      /* Lock the current entry, so nobody will edit it during deletion */
-#      add_lock ($this->dn, $this->ui->dn);
-#      $smarty->assign("info", sprintf(_("You're about to delete the user %s."), @LDAP::fix($this->dn)));
-#      $smarty->assign("multiple", false);
-#      return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
-      $this->msg_dialog = new msg_dialog( _("Delete user"),sprintf(_("You're about to delete the user %s."), @LDAP::fix($this->dn)),CONFIRM_DIALOG);
-      $this->current_action = $s_action;
-    }
-
-
-    /********************
-      Delete entry confirmed 
-     ********************/
-
-    /* Confirmation for deletion has been passed. User should be deleted. */
-    if ($this->current_action == "del" && is_object($this->msg_dialog) && $this->msg_dialog->is_confirmed()){
-
-      $this->current_action = ""; 
-      /* Some nice guy may send this as POST, so we've to check
-         for the permissions again. */
-
-      $acl = $this->ui->get_permissions($this->dn, "users/user"); 
-      if (preg_match('/d/', $acl)){
-
-        /* Delete request is permitted, perform LDAP action */
-        $this->usertab= new usertabs($this->config, $this->config->data['TABS']['USERTABS'],$this->dn);
-        $this->usertab->set_acl_base();
-        $this->usertab->delete ();
-        unset ($this->usertab);
-        $this->usertab= NULL;
-        msg_dialog::display(_("User delted"),_("User successfully removed."),INFO_DIALOG);
-      } else {
-
-        /* Normally this shouldn't be reached, send some extra
-           logs to notify the administrator */
-        msg_dialog::display(_("User delete"),_("You are not allowed to delete this user!"),WARNING_DIALOG);
-
-        if(isset($this->ui->uid)){
-          new log("security","users/".get_class($this),$this->dn,array(),"Tried to trick deletion.");
-        }
-      }
-
-      /* Remove lock file after successfull deletion */
-      del_lock ($this->dn);
-    }
-
-    
-    /********************
-      Delete entry Canceled 
-     ********************/
-
-    /* Delete user canceled? */
-    if (isset($_POST['delete_cancel'])){
-      del_lock ($this->dn);
-    }
-
-
-    /********************
-      Edit entry finished (Save) 
-     ********************/
-
-    /* Finish user edit is triggered by the tabulator dialog, so
-       the user wants to save edited data. Check and save at this
-       point. */
-    if ((isset($_POST['edit_finish']) || isset($_POST['edit_apply'])) && (isset($this->usertab->config))){
-
-      /* Check tabs, will feed message array */
-      $this->usertab->last= $this->usertab->current;
-      $this->usertab->save_object();
-      $message= $this->usertab->check();
-
-      /* Save, or display error message? */
-      if (count($message) == 0){
-
-        /* No errors. Go ahead and prepare to ask for a password
-           in case we're creating a new user. 'dn' will be 'new'
-           in this case. It is set to the correct value later. */
-        if ($this->dn == "new"){
-          $set_pass= 1;
-        } else {
-          $set_pass= 0;
-        }
-
-        /* Save user data to ldap */
-        if($this->usertab->save() == 1){
-          return;
-        }
-
-        if (!isset($_POST['edit_apply'])){
-          /* User has been saved successfully, remove lock from LDAP. */
-          if ($this->dn != "new"){
-            del_lock ($this->dn);
-          }
-
-          /* In case of new users, ask for a password, skip this for templates */
-          if (($set_pass || $this->usertab->password_change_needed()) && !$this->is_template){
-            $this->dn = $this->usertab->dn;
-            return($smarty->fetch(get_template_path('password.tpl', TRUE)));
-          }
-
-          unset ($this->usertab);
-          $this->usertab= NULL;
-          unset ($_SESSION['objectinfo']);
-        }
-      } else {
-        /* Ok. There seem to be errors regarding to the tab data,
-           show message and continue as usual. */
-        show_errors($message);
-      }
-    }
-
-
-    /********************
-      We want to create a new user, so fetch all available user templates 
-     ********************/
-
-    /* Generate template list */
-    if (($s_action=="new")||($s_action=="create_user_from_tpl")){
-
-      $this->templates= array();
-      $ldap= $this->config->get_ldap_link();
-
-      /* Create list of templates */
-      foreach ($this->config->departments as $key => $value){
-    
-        /* Get acls from different ou's */
-        $acl = $this->ui->get_permissions("cn=dummy,".get_people_ou().$value,"users/user")       ; 
-        /* If creation of a new user is allowed, append this template */
-        if (preg_match("/c/",$acl)){
-          
-          /* Search all templates from the current dn */
-          $ldap->cd (get_people_ou().$value);
-          $ldap->search ("(objectClass=gosaUserTemplate)", array("uid"));
-
-          /* Append */
-          if ($ldap->count() != 0){
-            while ($attrs= $ldap->fetch()){
-              $this->templates[$ldap->getDN()]=
-                $attrs['uid'][0]." - ".@LDAP::fix($key);
-            }
-            $this->templates['none']= _("none");
-          }
-        }
-      }
-
-      /* Sort templates */
-      natcasesort ($this->templates);
-      reset ($this->templates);
-    }
-
-
-    /********************
-      Create a new user,template, user from template 
-     ********************/
-
-    /* Check selected options for template */
-    if (isset($_POST['template_continue'])){
-      $message = array();
-      if(!isset($_POST['template']) || (empty($_POST['template']))){
-        $message[] = _("Please select a valid template.");
-      }
-      if(!isset($_POST['sn']) || (empty($_POST['sn']))){
-        $message[]= _("The required field 'Name' is not set.");
-      }
-      if(!isset($_POST['givenName']) || (empty($_POST['givenName']))){
-        $message[]= _("The required field 'Given name' is not set.");
-      }
-    
-      /* Show error message / continue editing */
-      if (count($message) > 0){
-        show_errors ($message);
-
-        foreach(array("sn", "givenName", "uid", "template") as $attr){
-          if(isset($_POST[$attr])){
-            $smarty->assign("$attr", $_POST[$attr]);
-          }else{
-            $smarty->assign("$attr", "");
-          }
-        }
-        $smarty->assign("templates",$this->templates);
-        $smarty->assign("got_uid",$this->got_uid);
-        $smarty->assign("edit_uid",false);
-        return($smarty->fetch(get_template_path('template.tpl', TRUE)));
-
-      }
-    }
-
-    /* New user/template request */
-    if (($s_action=="create_user_from_tpl")||($s_action=="new") || ($s_action=="new_tpl")){
-      /* By default we set 'dn' to 'new', all relevant plugins will
-         react on this. */
-      $this->dn= "new";
-      
-      if (isset($this->config->current['IDGEN'])){
-        $this->got_uid= false;
-      } else {
-        $this->got_uid= true;
-      }
-
-      /* Create new usertab object */
-      $this->usertab= new usertabs($this->config,$this->config->data['TABS']['USERTABS'], $this->dn);
-      $this->usertab->by_object['user']->base= $this->DivListUsers->selectedBase;
-      $this->usertab->set_acl_base('dummy,'.$this->DivListUsers->selectedBase);
-
-      /* Take care about templates */
-      if ($s_action=="new_tpl"){
-        $this->is_template= TRUE;
-        $this->usertab->set_template_mode ();
-      } else {
-        $this->is_template= FALSE;
-      }
-
-      /* Use template if there are any of them */
-      if ((count($this->templates) && ($s_action!='new_tpl'))||($s_action=="create_user_from_tpl")){
-        foreach(array("sn", "givenName", "uid", "got_uid", "templates") as $attr){
-          $smarty->assign("$attr", $this->$attr);
-        }
-        if ($s_action=="create_user_from_tpl"){
-          $smarty->assign("template", $this->dn= $this->list[trim($s_entry)]['dn']);
-        } else {
-          $smarty->assign("template", "none");
-        }
-        $smarty->assign("edit_uid", "");
-        return($smarty->fetch(get_template_path('template.tpl', TRUE)));
-      }
-    }
-
-    /********************
-      Template selected continue edit
-     ********************/
-
-    /* Continue template editing */
-    if ((isset($_POST['template_continue'])) && ($_POST['template'] != 'none') && (!isset($_POST['uid']))){
-
-      $this->sn             = $_POST['sn'];
-      $this->givenName      = $_POST['givenName'];
-
-      /* Check for requred values */
-      $message= array();
-      if ($this->sn == "") {
-        $message[]= _("The required field 'Name' is not set.");
-      }
-      if ($this->givenName == "") {
-        $message[]= _("The required field 'Given name' is not set.");
-      }
-
-      /* Check if dn is used */
-      $dn= preg_replace("/^[^,]+,/i", "", $_POST['template']);
-      $ldap= $this->config->get_ldap_link();
-      $ldap->cd ($dn);
-      $ldap->search ("(&(sn=".normalizeLdap($this->sn).")(givenName=".normalizeLdap($this->givenName)."))", array("givenName"));
-      if ($ldap->count () != 0){
-        $message[]= _("A person with the choosen name is already used in this tree.");
-      }
-
-      /* Show error message / continue editing */
-      if (count($message) > 0){
-        show_errors ($message);
-      } else {
-        $attributes= array('sn' => $this->sn, 'givenName' => $this->givenName);
-        if (isset($this->config->current['IDGEN']) &&
-            $this->config->current['IDGEN'] != ""){
-          $uids= gen_uids ($this->config->current['IDGEN'], $attributes);
-          if (count($uids)){
-            $smarty->assign("edit_uid", "false");
-            $smarty->assign("uids", $uids);
-            $this->uid= current($uids);
-          }
-        } else {
-          $smarty->assign("edit_uid", "");
-          $this->uid= "";
-        }
-        $this->got_uid= true;
-      }
-
-      foreach(array("sn", "givenName", "uid", "got_uid", "templates") as $attr){
-        $smarty->assign("$attr", $this->$attr);
-      }
-      if (isset($_POST['template'])){
-        $smarty->assign("template", $_POST['template']);
-      }
-      return($smarty->fetch(get_template_path('template.tpl', TRUE)));
-    }
-
-    /********************
-      No template selected continue edit
-     ********************/
-
-    /* No template. Ok. Lets fill data into the normal user dialog */
-    if (isset($_POST['template_continue']) && $_POST['template'] == 'none'){
-      foreach(array("sn", "givenName", "uid") as $attr){
-        if (isset($_POST[$attr])){
-          $this->usertab->by_object['user']->$attr= $_POST[$attr];
-        }
-      }
-    }
-
-
-    /********************
-      Template selected continue edit
-     ********************/
-
-    /* Finish template preamble */
-    if (isset($_POST['template_continue']) && $_POST['template'] != 'none' && (isset($_POST['uid']))){
-
-      /* Might not be filled if IDGEN is unset */
-      $this->sn                 = $_POST['sn'];
-      $this->givenName          = $_POST['givenName'];
-
-      /* Move user supplied data to sub plugins */
-      $this->uid                = $_POST['uid'];
-      $this->usertab->uid       = $this->uid;
-      $this->usertab->sn        = $this->sn;
-      $this->usertab->givenName = $this->givenName;
-      $template_dn              = $_POST['template'];
-      $this->usertab->adapt_from_template($template_dn);
-      $template_base            = preg_replace("/^[^,]+,".normalizePreg(get_people_ou())."/", '', $template_dn);
-      $this->usertab->by_object['user']->base= $template_base;
-    }
-   
-    /********************
-      If no template was selected set base
-     ********************/
-
-    if (isset($_POST['template_continue']) && ($_POST['template'] == 'none')){
-      $this->usertab->by_object['user']->base= $this->DivListUsers->selectedBase;
-    }
-
-
-    /********************
-      Display subdialog 
-     ********************/
-
-    /* Show tab dialog if object is present */
-    if(isset($this->usertab->config)){
-      $display= $this->usertab->execute();
-
-      /* Don't show buttons if tab dialog requests this */
-      
-        $dia = FALSE;
-        if(isset($this->usertab->by_object[$this->usertab->current]->dialog)){
-          $dia = $this->usertab->by_object[$this->usertab->current]->dialog;
-        }
-
-        if(!is_object($dia) && $dia != TRUE){
-          $display.= "<p style=\"text-align:right\">\n";
-          $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
-          $display.= "&nbsp;\n";
-          if ($this->dn != "new"){
-            $display.= "<input type=submit name=\"edit_apply\" value=\""._("Apply")."\">\n";
-            $display.= "&nbsp;\n";
-          }
-          $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
-          $display.= "</p>";
-        }
-      return ($display);
-    }
-    
-    /* Check if there is a snapshot dialog open */
-    $base = $this->DivListUsers->selectedBase;
-    if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases())){
-      return($str);
-    }
-  
-    /* Return rendered main page */
-        /* Display dialog with system list */
-    $this->DivListUsers->parent = $this;
-    $this->DivListUsers->execute();
-
-    /* Add departments if subsearch is disabled */
-    if(!$this->DivListUsers->SubSearch){
-      $this->DivListUsers->AddDepartments($this->DivListUsers->selectedBase,4,1);
-    }
-    $this->reload();
-    $this->DivListUsers->setEntries($this->list);
-    return($this->DivListUsers->Draw());
-  }
-
-
-  /* Return departments, that will be included within snapshot detection */
-  function get_used_snapshot_bases()
-  {
-    return(array(get_people_ou().$this->DivListUsers->selectedBase));
-  }  
-
-
-  function reload()
-  {
-    /* Set base for all searches */
-    $base= $this->DivListUsers->selectedBase;
-    $this->list =array();
-
-    /* Get filter configuration */
-    $Regex                = $this->DivListUsers->Regex;
-    $SubSearch            = $this->DivListUsers->SubSearch;
-    $ShowTemplates        = $this->DivListUsers->ShowTemplates;
-    $ShowFunctionalUsers  = $this->DivListUsers->ShowFunctionalUsers;
-    $ShowUnixUsers        = $this->DivListUsers->ShowUnixUsers;
-    $ShowMailUsers        = $this->DivListUsers->ShowMailUsers;
-    $ShowSambaUsers       = $this->DivListUsers->ShowSambaUsers;
-    $ShowProxyUsers       = $this->DivListUsers->ShowProxyUsers;
-
-    /* Setup filter depending on selection */
-    $filter="";
-    if ($this->config->current['SAMBAVERSION'] == 3){
-      $samba= "sambaSamAccount";
-    } else {
-      $samba= "sambaAccount";
-    }
-
-    if ($ShowFunctionalUsers){
-      $filter.= "(&(objectClass=gosaAccount)(!(|(objectClass=posixAccount)".
-                "(objectClass=gosaMailAccount)(objectClass=$samba)".
-                "(objectClass=gosaProxyAccount))))";
-    }
-    if ($ShowUnixUsers){
-      $filter.= "(objectClass=posixAccount)";
-    }
-    if ($ShowMailUsers){
-      $filter.= "(objectClass=gosaMailAccount)";
-    }
-    if ($ShowSambaUsers){
-      $filter.= "(objectClass=$samba)";
-    }
-    if ($ShowProxyUsers){
-      $filter.= "(objectClass=gosaProxyAccount)";
-    }
-    if ($ShowTemplates){
-      $filter= "(|(objectClass=gosaUserTemplate)(&(objectClass=gosaAccount)(|$filter)))";
-    } else {
-      $filter= "(&(objectClass=gosaAccount)(!(objectClass=gosaUserTemplate))(|$filter))";
-    }
-    $filter= "(&(|(uid=".normalizeLdap($Regex).")(sn=".normalizeLdap($Regex).")(givenName=".normalizeLdap($Regex)."))$filter)";
-
-    /* Generate userlist */
-    $ldap= $this->config->get_ldap_link(TRUE);
-
-    if ($SubSearch){
-      $ListTemp =  get_list($filter, "users", $base,
-                            array("uid", "givenName", "sn", "objectClass","userPassword"), GL_SUBSEARCH | GL_SIZELIMIT);
-    } else {
-      $base= get_people_ou().$base;
-      $ListTemp = get_list($filter, "users", $base, 
-                            array("uid", "givenName", "sn", "objectClass","userPassword"), GL_SIZELIMIT);
-    }
-    $SortTemp = array();
-    $List = array();
-    foreach($ListTemp as $Key => $Entry){
-
-      /* Skip entries that are not located under the people ou (normaly 'ou=people,')
-       * Else winstations will be listed too, if you use the subtree flag. 
-       */
-      if(!preg_match("/".normalizePreg(get_people_ou())."/i",$Entry['dn'])){
-        continue;
-      }else{
-
-        // Generate caption for rows
-        if (isset($Entry["sn"]) && isset($Entry["givenName"])){
-          $display= $Entry["sn"][0].", ".$Entry["givenName"][0]." [".$Entry["uid"][0]."]";
-        } else {
-          $display= "[".$Entry["uid"][0]."]";
-        }
-
-        $display = strtolower($display);
-        $List[$display] = $Entry;
-        $SortTemp[$display] = $display;
-      }
-    }
-    sort($SortTemp);
-    reset($SortTemp);
-
-    $this->list = array();
-    foreach($SortTemp as $Key){
-      $this->list[] = $List[$Key];
-    }
-  }
-
-  function remove_lock()
-  {
-    /* Remove user lock if a DN is marked as "currently edited" */
-    if (isset($this->usertab->dn)){
-      del_lock ($this->usertab->dn);
-    }
-  }
-
-
-  function copyPasteHandling_from_queue($s_action,$s_entry)
-  {
-    /* Check if Copy & Paste is disabled */
-    if(!is_object($this->CopyPasteHandler)){
-      return("");
-    }
-
-    /* Add a single entry to queue */
-    if($s_action == "cut" || $s_action == "copy"){
-      /* Cleanup object queue */
-      $this->CopyPasteHandler->cleanup_queue();
-      $dn = $this->list[$s_entry]['dn'];
-      $this->CopyPasteHandler->add_to_queue($dn,$s_action,"usertabs","USERTABS","users");
-    }
-
-    /* Add entries to queue */
-    if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
-
-      /* Cleanup object queue */
-      $this->CopyPasteHandler->cleanup_queue();
-
-      /* Add new entries to CP queue */
-      foreach($this->list_get_selected_items() as $id){
-        $dn = $this->list[$id]['dn'];
-
-        if($s_action == "copy_multiple"){
-          $this->CopyPasteHandler->add_to_queue($dn,"copy","usertabs","USERTABS","users");
-        }
-        if($s_action == "cut_multiple"){
-          $this->CopyPasteHandler->add_to_queue($dn,"cut","usertabs","USERTABS","users");
-        }
-      }
-    }
-    
-    /* Start pasting entries */
-    if($s_action == "editPaste"){
-      $this->start_pasting_copied_objects = TRUE;
-    }
-
-    /* Return C&P dialog */ 
-    if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
-   
-      /* Load entry from queue and set base */
-      $this->CopyPasteHandler->load_entry_from_queue();
-      $this->CopyPasteHandler->SetVar("base",$this->DivListUsers->selectedBase); 
-
-      /* Get dialog */
-      $data = $this->CopyPasteHandler->execute();
-
-      /* Set CPPasswordChange to s_entry which indicates that this entry requires a new password. */
-      if(isset($_POST['passwordTodo']) && ($_POST['passwordTodo'] == "new")){
-        $s_entry = $this->CopyPasteHandler->last_entry();
-        $this->reload();
-        foreach($this->list as $key => $entry){
-          if($entry['dn'] == $s_entry){
-            $this->CPPasswordChange = $key;
-          }
-        }
-      }
-
-      /* Return dialog data */
-      if(!empty($data) && $this->CPPasswordChange == ""){
-        return($data);
-      }
-    }
-
-    /* Automatically disable status for pasting */ 
-    if(!$this->CopyPasteHandler->entries_queued()){
-      $this->start_pasting_copied_objects = FALSE;
-    }
-    return("");
-  }
-
-
-  function save_object()
-  {
-    /* Handle divlist filter && department selection*/
-    if(!is_object($this->usertab)){
-      $this->DivListUsers->save_object();
-    }
-  }
-
-    
-  function list_get_selected_items()
-  {
-    $ids = array();
-    foreach($_POST as $name => $value){
-      if(preg_match("/^item_selected_[0-9]*$/",$name)){
-        $id   = preg_replace("/^item_selected_/","",$name);
-        $ids[$id] = $id;
-      }
-    }
-    return($ids);
-  }
-  
-
-  /* A set of disabled and therefore overloaded functions. They are
-     not needed in this class. */
-  function remove_from_parent() { } 
-  function check() { } 
-  function save() { } 
-  function adapt_from_template($dn) { } 
-  function password_change_needed() { } 
-
-} /* ... class userManagement */
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/users/main.inc b/plugins/admin/users/main.inc
deleted file mode 100644 (file)
index d545835..0000000
+++ /dev/null
@@ -1,65 +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
- */
-
-if ($remove_lock){
-  if(isset($_SESSION['userManagement'])){
-    $userManagement= $_SESSION['userManagement'];
-    $userManagement->remove_lock();
-    del_lock ($ui->dn);
-    sess_del ('userManagement');
-  }
-} else {
-  /* Create usermanagement object on demand */
-  if (!isset($_SESSION['userManagement']) ||
-     (isset($_GET['reset']) && $_GET['reset'] == 1)){
-    $_SESSION['userManagement']= new userManagement ($config, $_SESSION['ui']);
-    $_SESSION['userManagement']->set_acl_category("users");
-  }
-  $userManagement= $_SESSION['userManagement'];
-  $userManagement->save_object();
-  $output= $userManagement->execute();
-
-  /* Page header*/
-  if (isset($_SESSION['objectinfo'])){
-    $display= print_header(get_template_path('images/user.png'),
-                           _("User administration"),
-                           "<img alt=\"\" class=\"center\" src=\"".
-                           get_template_path('images/closedlock.png').
-                           "\"> ".@LDAP::fix($_SESSION['objectinfo']));
-  } else {
-    $display= print_header(get_template_path('images/user.png'),
-                          _("User administration"));
-  }
-
-  /* Generate dialog output */
-  $display.= $output;
-
-  /* Reset requested? */
-  if (isset($_GET['reset']) && $_GET['reset'] == 1){
-    del_lock ($ui->dn);
-    sess_del ('userManagement');
-  }
-
-  /* Show and save dialog */
-  $_SESSION['userManagement']= $userManagement;
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/users/password.tpl b/plugins/admin/users/password.tpl
deleted file mode 100644 (file)
index 83dfc24..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-<p>
- {t}To change the user password use the fields below. The changes take effect immediately. Please memorize the new password, because the user wouldn't be able to login without it.{/t}
-</p>
-
-<p>
- {t}Changing the password affects your authentification on mail, proxy, samba and unix services.{/t}
-</p>
-
-<table summary="" style="vertical-align:top; text-align:left;" cellpadding=4 border=0>
-  <tr>
-    <td><b><LABEL for="new_password">{t}New password{/t}</LABEL></b></td>
-    <td><input type="password" id="new_password" name="new_password" size="30" maxlength="40" onFocus="nextfield= 'repeated_password';"></td>
-  </tr>
-  <tr>
-    <td><b><LABEL for="repeated_password">{t}Repeat new password{/t}</LABEL></b></td>
-    <td><input type="password" id="repeated_password" name="repeated_password" size="30" maxlength="40" onFocus="nextfiled= 'password_finish'"></td>
-  </tr>
-</table>
-<br>
-<p class="plugbottom">
-  <input type=submit name="password_finish" value="{t}Set password{/t}">
-  &nbsp;
-  <input type=submit name="password_cancel" value="{t}Cancel{/t}">
-</p>
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       nextfield= "new_password";
-       focus_field('new_password');
-  -->
-</script>
diff --git a/plugins/admin/users/remove.tpl b/plugins/admin/users/remove.tpl
deleted file mode 100644 (file)
index eb41471..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<div style="font-size:18px;">
- <img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
-</div>
-<p>
-  {$info}
-  {t}This includes all account data, system access rules, imap settings, etc. for this user. 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}So - if you're sure - press 'Delete' to continue or 'Cancel' to abort.{/t}
-</p>
-
-<p class="plugbottom">
-  {if $multiple}
-  <input type=submit name="delete_multiple_user_confirm" value="{t}Delete{/t}">
-  <input type=submit name="delete_multiple_user_cancel" value="{t}Cancel{/t}">
-  {else}
-  <input type=submit name="delete_user_confirm" value="{t}Delete{/t}">
-  <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
-  {/if}
-  &nbsp;
-</p>
-
diff --git a/plugins/admin/users/tabs_user.inc b/plugins/admin/users/tabs_user.inc
deleted file mode 100644 (file)
index c656533..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
-<?php
-
-class usertabs extends tabs
-{
-  var $base;
-
-  function usertabs($config, $data, $dn)
-  {
-    tabs::tabs($config, $data, $dn, 'users');
-    $this->base= $this->by_object['user']->base;
-
-    /* Add references/acls/snapshots */
-    $this->addSpecialTabs();
-
-  }
-
-  function save_object($save_current= FALSE)
-  {
-    tabs::save_object($save_current);
-
-    /* Update reference, transfer variables */
-    $baseobject= $this->by_object['user'];
-    foreach ($this->by_object as $name => $obj){
-
-      /* Adding uid to sub plugins of connectivity */
-      if($name == "connectivity"){
-        foreach ($obj->plugin_name as $plg_name){
-          if(isset($obj->plugin[$plg_name]->uid)){
-            $obj->plugin[$plg_name]->uid = $baseobject->uid;
-          }
-        }
-      }
-
-      /* Don't touch base object */
-      if ($name != 'user'){
-        $obj->parent= &$this;
-        $obj->uid= $baseobject->uid;
-        $obj->sn= $baseobject->uid;
-        $obj->givenName= $baseobject->uid;
-      }
-
-      /* Copy mail if needed */
-      if ($name == "gofaxAccount"){
-        if (isset($this->by_object['mailAccount']) && $this->by_object['mailAccount']->is_account){
-          $obj->mail= $this->by_object['mailAccount']->mail;
-        }
-      }
-
-      $this->by_object[$name]= $obj;
-
-      /* Update parent in base object */
-      $this->by_object['user']->parent= &$this;
-    }
-
-    /* Move facsimile / phone number if nessecary */
-    if ($this->last == "user" && isset($this->by_object['gofaxAccount'])){
-
-      /* Move number to fax plugin */
-      $this->by_object['gofaxAccount']->facsimileTelephoneNumber=
-        $this->by_object['user']->facsimileTelephoneNumber;
-
-      /* Move phone number if plugin exists */
-      if (isset($this->by_object['phoneAccount']) && 
-          !$this->by_object['phoneAccount']->is_account){
-        $this->by_object['phoneAccount']->phoneNumbers= array();
-        if ($this->by_object['user']->telephoneNumber != ""){
-          $this->by_object['phoneAccount']->phoneNumbers[$this->by_object['user']->telephoneNumber]= $this->by_object['user']->telephoneNumber;
-        }
-      }
-    }
-
-    /* Move number from fax plugin */
-    if ($this->last == "gofaxAccount"){
-
-      $this->by_object['user']->facsimileTelephoneNumber=
-        $this->by_object['gofaxAccount']->facsimileTelephoneNumber;
-    }
-
-    /* Move number from fax plugin */
-    if ($this->last == "phoneAccount" && $this->by_object['phoneAccount']->is_account){
-      reset($this->by_object['phoneAccount']->phoneNumbers);
-      $number= key($this->by_object['phoneAccount']->phoneNumbers);
-
-      /* Only the first phoneAccount number, if it is not empty */
-      if(!empty($number)){
-        $this->by_object['user']->telephoneNumber= $number;
-      }
-    }
-
-    /* Possibly change acl base */
-    $this->set_acl_base();
-  }
-
-  function save($ignore_account= FALSE)
-  {
-    /* Check for new 'dn', in order to propagate the
-       'dn' to all plugins */
-    $baseobject= $this->by_object['user'];
-    $baseobject->update_new_dn();
-    if ($this->dn != 'new'){
-
-      $new_dn= $baseobject->new_dn;
-
-      if (strtolower($this->dn) != strtolower($new_dn)){
-
-        /* Udpate acls */
-        $baseobject->update_acls($this->dn,$new_dn);
-        $baseobject->move($this->dn, $new_dn);
-        $this->by_object['user']= $baseobject;
-
-        /* Did we change ourselves? Update ui object. */
-        change_ui_dn($this->dn, $new_dn);
-      }
-    }
-
-    $this->dn= $baseobject->new_dn;
-
-    return tabs::save();
-  }
-
-
-  function set_template_mode()
-  {
-    foreach ($this->by_object as $key => $obj){
-      $this->by_object[$key]->is_template= TRUE;
-    }
-  }
-  
-  function saveCopyDialog()
-  {
-    tabs::saveCopyDialog();
-    $baseobject= $this->by_object['user'];
-    $uid = $baseobject->uid;
-    foreach($this->by_object as  $name => $obj){
-      $this->by_object[$name]->uid = $uid;
-    }
-  }
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/users/template.tpl b/plugins/admin/users/template.tpl
deleted file mode 100644 (file)
index 37237f9..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-<div style="font-size:18px;">
-  {t}Creating a new user using templates{/t}
-</div>
-
-<p>
- {t}Creating a new user can be assisted by using templates. Many database records will be filled automatically. Choose 'none' to skip the usage of templates.{/t}
-</p>
-
-<p class="seperator">&nbsp;</p>
-
-<br>
-
-<table summary="" style="vertical-align:top; text-align:left;" cellpadding=4 border=0>
-  <tr>
-    <td><b><LABEL for="template">{t}Template{/t}</LABEL></b></td>
-    <td>
-      <select size="1" name="template" id="template">
-       {html_options options=$templates selected=$template}
-      </select>
-    </td>
-  </tr>
-  <tr>
-    <td><b><LABEL for="sn">{t}Last name{/t}</LABEL></b></td>
-    <td><input name="sn" id="sn" size="30" maxlength="40" value="{$sn}"></td>
-  </tr>
-  <tr>
-    <td><b><LABEL for="givenName">{t}First name{/t}</LABEL></b></td>
-    <td><input name="givenName" id="givenName" size="30" maxlength="40" value="{$givenName}"></td>
-  </tr>
-  {if $got_uid eq "true"}
-  <tr>
-    <td><b>{t}Login{/t}</b></td>
-    <td>
-      {if $edit_uid eq "false"}
-      <select size="1" name="uid">
-        {html_options output=$uids values=$uids selected=$uid}
-      </select>
-      {else}
-      <input name="uid" size="30" maxlength="40" value="{$uid}">
-      {/if}
-    </td>
-  </tr>
-  {/if}
-</table>
-
-<br>
-<p class="plugbottom">
-  <input type=submit name="template_continue" value="{t}Continue{/t}">
-  &nbsp;
-  <input type=submit name="edit_cancel" value="{t}Cancel{/t}">
-</p>
-
-
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('sn');
-  -->
-</script>
diff --git a/plugins/generic/references/class_reference.inc b/plugins/generic/references/class_reference.inc
deleted file mode 100644 (file)
index 472e42e..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-<?php
-
-class reference extends plugin
-{
-  /* attribute list for save action */
-  var $attributes= array();
-  var $objectclasses= array();
-  var $objectlist= "";
-  var $obtypes= array();
-  var $fold= array();
-  var $objectCache= array();
-
-  function reference (&$config, $dn= NULL)
-  {
-       /* Include config object */
-       $this->config= &$config;
-       $this->dn= $dn;
-
-        /* Fill translation array */
-        $this->obtypes= array(  "gosaAccount" => array(           "text" => _("Generic"),
-                                                          "image" => "penguin.png"),
-                               "posixAccount" => array(   "text" =>_("UNIX"),
-                                                          "image" => "select_user.png"),
-                                "gosaMailAccount" => array("text" => _("Mail"),
-                                                          "image" => "mailto.png"),
-                                "sambaSamAccount" => array("text" => _("Samba"),
-                                                          "image" => "select_winstation.png"),
-                                "sambaAccount" => array(   "text" => _("Samba"),
-                                                          "image" => "select_winstation.png"),
-                                "goFaxAccount" => array(   "text" => _("FAX"),
-                                                          "image" => "fax_small.png"),
-                                "gosaProxyAccount" => array("text" => _("Proxy"),
-                                                          "image" => "select_proxy.png"),
-                                "PureFTPdUser" => array(   "text" => _("FTP"),
-                                                          "image" => "select_proxy.png"),
-                                "posixGroup" => array(     "text" => _("Group"),
-                                                          "image" => "select_groups.png"),
-                                "gosaDepartment" => array( "text" => _("Department"),
-                                                          "image" => "select_department.png"),
-                                "goFonHardware" => array(   "text" => _("Phone"),
-                                                          "image" => "select_phone.png"),
-                                "gosaApplication" => array("text" => _("Application"),
-                                                          "image" => "select_application.png"),
-                                "goServer" => array(      "text" => _("Server"),
-                                                          "image" => "select_server.png"),
-                                "gotoTerminal" => array(   "text" => _("Thin Client"),
-                                                          "image" => "select_terminal.png"),
-                                "gotoWorkstation" => array("text" => _("Workstation"),
-                                                          "image" => "select_workstation.png"),
-                                "gosaGroupOfNames" => array("text" => _("Object group"),
-                                                          "image" => "select_ogroup.png"),
-                                "gotoPrinter" => array(           "text" => _("Printer"),
-                                                          "image" => "select_printer.png"));
-  }
-
-  function execute()
-  {
-       /* Call parent execute */
-       plugin::execute();
-
-       /* Set government mode */
-       $smarty= get_smarty();
-
-       if (isset($_GET['show'])){
-               $dn= base64_decode($_GET['show']);
-               if (isset($this->fold["$dn"])){
-                       unset($this->fold["$dn"]);
-               } else {
-                       $this->fold["$dn"]= "$dn";
-               }
-       }
-
-       /* Fill array */
-       $this->reload();
-       $smarty->assign("objectList", $this->objectlist);
-
-       /* Show main page */
-       return ($smarty->fetch (get_template_path('contents.tpl', TRUE, dirname(__FILE__))));
-  }
-
-  function reload()
-  {
-       $ldap= $this->config->get_ldap_link();
-       $ldap->cd($this->config->current['BASE']);
-       $ldap->search("(|(member=".$this->dn.")(memberUid=".$this->uid."))",array("memberUid","member","cn","description","objectClass"));
-       
-       $cycle= array("F5F5F5", "ECECEC");
-       $id= 0;
-       $this->objectlist= "";
-       while ($attrs= $ldap->fetch()){
-
-               /* Add more information? */
-               $addon= "";
-               if (in_array($attrs['dn'], $this->fold)){
-                       $memberattr= "";
-                       if (isset($attrs['memberUid'])){
-                               unset($attrs['memberUid']['count']);
-                               $memberattr= "memberUid";
-                       } 
-                       if (isset($attrs['member'])){
-                               unset($attrs['member']['count']);
-                               $memberattr= "member";
-                       } 
-                       if ($memberattr == ""){
-                               continue;
-                       }
-                       foreach ($attrs[$memberattr] as $uid){
-                               $content= $this->getCacheObject($uid);
-                               if ($content === NULL) {
-                                       continue;
-                               }
-                               $addon.= '<tr style="background-color:'.$cycle[$id&1].';"><td title="'.$attrs['cn'][0].'">&nbsp;&nbsp;&nbsp;'.$content['name'].'</td><td>'.$content['description'].'</td><td>'.$content['type'].'</td> </tr>';
-                       }
-               }
-
-               /* Build final entry */
-               if (isset($attrs['description'])){
-                       $description= $attrs['description'][0];
-               } else {
-                       $description= "-";
-               }
-               $content= $this->createContentString($attrs['objectClass']);
-               if ($addon == ""){
-                       $img= "images/expand.png";
-               } else {
-                       $img= "images/sort_down.png";
-               }
-               $this->objectlist.= '<tr style="background-color:'.$cycle[$id&1].';"><td class="phonelist" title="'.$attrs['cn'][0].'"><a href="main.php?plug='.$_GET['plug'].'&amp;start=&amp;show='.base64_encode($attrs['dn']).'"><img alt="" src="'.$img.'" border=0>&nbsp;'.$attrs['cn'][0].'</a></td><td>'.$description.'</td><td>'.$content.'</td> </tr>'.$addon;
-
-               $id++;
-       }
-       
-  }
-
-  function getCacheObject($dn)
-  {
-       if (!isset($this->objectCache[$dn])){
-               $ldap= $this->config->get_ldap_link();
-               if (preg_match('/,/', $dn)){
-                       $ldap->cat($dn, array("cn", "objectClass", "description","ou"));
-               } else {
-                       $ldap->search("(uid=$dn)", array("cn", "objectClass", "description","ou"));
-               }
-               if ($ldap->count()){
-                       $attrs= $ldap->fetch();
-
-                       if(isset($attrs['ou']) && !isset($attrs['cn'])){
-                               $attrs['cn'] = $attrs['ou'];
-                       }
-                               
-                       if (isset($attrs['description'])){
-                               $description= $attrs['description'][0];
-                       } else {
-                               $description= "-";
-                       }
-                       $this->objectCache[$dn]= array( 'name' => $attrs['cn'][0],
-                                       'description' => "$description",
-                                       'type' => $this->createContentString($attrs['objectClass']));
-               } else {
-                       return NULL;
-               }
-       }
-       return ($this->objectCache[$dn]);
-  }
-
-  function createContentString($classes)
-  {
-       $result= "";
-       if(!is_null($classes)) {
-               foreach ($classes as $class){
-                       if (isset($this->obtypes[$class])){
-                               $result.= "<a><img alt=\"\" border=0 src='images/".$this->obtypes[$class]['image']."'>&nbsp;".$this->obtypes[$class]['text']."</a> ";
-                       }
-               }
-       }
-       return (preg_replace('/ $/', '', $result));
-  }
-  
-}
-
-?>
diff --git a/plugins/generic/references/contents.tpl b/plugins/generic/references/contents.tpl
deleted file mode 100644 (file)
index e953da1..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-{if $objectList ne ""}
-<table summary="" style="width:100%; vertical-align:top; text-align:left; border:1px solid #B0B0B0;"  cellpadding=4 cellspacing=0 border=0 rules="cols">
-
- <colgroup>
-  <col width="20%">
-  <col width="20%">
-  <col width="60%">
- </colgroup>
-
- <tr style="background-color: #E8E8E8; height:26px;font-weight:bold;">
-  <td>{t}Object name{/t}</td><td>{t}Description{/t}</td><td>{t}Contents{/t}</td>
- </tr>
-
- {$objectList}
-
-</table>
-{else}
-<b>{t}This object has no relationship to other objects.{/t}</b>
-{/if}
diff --git a/plugins/generic/welcome/main.inc b/plugins/generic/welcome/main.inc
deleted file mode 100644 (file)
index eb0c63c..0000000
+++ /dev/null
@@ -1,30 +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
-*/
-
-if (!$remove_lock){
-       $_SESSION['plugin_dir']= dirname(__FILE__);
-       $smarty->assign("iconmenu", $plist->show_iconmenu());
-       $smarty->assign("header", print_header(get_template_path('images/hdd_linux_unmount.png'), sprintf(_("Welcome %s!"), $ui->cn)));
-       $smarty->assign("year", date("Y"));
-       $smarty->assign("revision", get_gosa_version());
-       $display= $smarty->fetch(get_template_path('welcome.tpl', TRUE));
-}
-
-?>
diff --git a/plugins/generic/welcome/welcome.tpl b/plugins/generic/welcome/welcome.tpl
deleted file mode 100644 (file)
index 35a27ed..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-{$header}
-
-<p>
-  {t}This is the GOsa main menu. You can select your tasks from the menu on the left, or by choosing one of the pictograms below. All changes apply directly to your companies LDAP server.{/t}
-</p>
-
-<p>
-  {t}Use 'Sign out' on the upper left to close the connection and 'Main' to get back to the pictogram view.{/t}
-</p>
-{$iconmenu}
-
-<br>
-
-<div class="copynotice">&copy; 2002-{$year} <a href="http://gosa.gonicus.de">{t}The GOsa team{/t}, {$revision}</a>
-</div>
-
-<input type="hidden" name="ignore">
-
diff --git a/plugins/gofax/blocklists/class_blocklistGeneric.inc b/plugins/gofax/blocklists/class_blocklistGeneric.inc
deleted file mode 100644 (file)
index 1928466..0000000
+++ /dev/null
@@ -1,371 +0,0 @@
-<?php
-
-define("BLOCK_LIST_RECEIVE" , 0);
-define("BLOCK_LIST_SEND" , 1);
-
-class blocklistGeneric extends plugin
-{
-  /* Definitions */
-  var $plHeadline= "FAX Blocklists";
-  var $plDescription= "This does something";
-
-  var $cn ="";
-  var $description = "";
-  var $base = "";  
-
-  var $type;
-  var $goFaxBlocklist = array();
-  var $readonly = FALSE;
-  var $view_logged = FALSE;
-  var $attributes = array("cn","description");
-
-  var $ignore_account = TRUE;
-  
-  function __construct($config,$dn = "new")
-  {
-    plugin::plugin($config,$dn);
-
-    /* Set default list type */
-    $this->type = BLOCK_LIST_SEND;
-
-    /* Load defined numbers */
-    if($dn != "new"){
-  
-      /* We will not be able to rename edited blocklists */
-      $this->readonly = TRUE;
-  
-      /* Get blocklist type and defined numbers */
-      if (in_array("goFaxSBlock",$this->attrs['objectClass'])){
-        if(isset($this->attrs["goFaxSBlocklist"])){
-          for ($i= 0; $i<$this->attrs["goFaxSBlocklist"]["count"]; $i++){
-            $this->goFaxBlocklist[]= $this->attrs["goFaxSBlocklist"][$i];
-          }
-        }
-        $this->type= BLOCK_LIST_SEND;
-      } elseif (in_array("goFaxRBlock",$this->attrs['objectClass'])){
-        if(isset($this->attrs["goFaxRBlocklist"])){
-          for ($i= 0; $i<$this->attrs["goFaxRBlocklist"]["count"]; $i++){
-            $this->goFaxBlocklist[]= $this->attrs["goFaxRBlocklist"][$i];
-          }
-        }
-        $this->type= BLOCK_LIST_RECEIVE;
-      }
-    }
-
-    /* Set base */
-    if ($this->dn == "new"){
-      if(isset($_SESSION['CurrentMainBase'])){
-        $this->base= $_SESSION['CurrentMainBase'];
-      }else{
-        $ui= get_userinfo();
-        $this->base= dn2base($ui->dn);
-      }
-    } else {
-      $this->base =preg_replace ("/^[^,]+,[^,]+,[^,]+,/","",$this->dn);
-    }
-  }
-
-  public function execute()
-  {
-    /* Log view */
-    if(!$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","blocklist/".get_class($this),$this->dn);
-    }
-
-
-    /**************
-     * Base select dialog 
-     **************/
-
-    $once = true;
-    foreach($_POST as $name => $value){
-      if(preg_match("/^chooseBase/",$name) && $once){
-        $once = false;
-        $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
-        $this->dialog->setCurrentBase($this->base);
-      }
-    }
-
-    /* Dialog handling */
-    if(is_object($this->dialog)){
-      /* Must be called before save_object */
-      $this->dialog->save_object();
-
-      if($this->dialog->isClosed()){
-        $this->dialog = false;
-      }elseif($this->dialog->isSelected()){
-
-        /* A new base was selected, check if it is a valid one */
-        $tmp = $this->get_allowed_bases();
-        if(isset($tmp[$this->dialog->isSelected()])){
-          $this->base = $this->dialog->isSelected();
-        }
-        $this->dialog= false;
-
-      }else{
-        return($this->dialog->execute());
-      }
-    }
-
-
-    /***************
-      Add numer to blocklist
-     ***************/
-
-
-    /* Handle interactions: add */
-    if (isset($_POST['add_number']) && $_POST['number'] != ""){
-      if (is_phone_nr($_POST['number']) || preg_match ("/^[\/0-9 ()\^\.\$+*-]+$/",$_POST['number'])){
-        $this->addNumber ($_POST['number']);
-      } else {
-        print_red (_("Please specify a valid phone number."));
-      }
-    }
-
-
-    /***************
-      Delete number from list
-     ***************/
-
-    /* Handle interactions: delete */
-    if (isset($_POST['delete_number']) && isset($_POST['numbers']) && count($_POST['numbers']) > 0){
-      $this->delNumber ($_POST['numbers']);
-    }
-
-
-    /***************
-      Template output
-     ***************/
-
-    $smarty = get_smarty();
-    foreach($this->attributes as $name){
-      $smarty->assign($name,$this->$name);
-    }
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translation){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-    $smarty->assign("goFaxBlocklist",$this->goFaxBlocklist);
-    $smarty->assign("cnACL",$this->getacl("cn",$this->readonly));
-    $smarty->assign("typeACL",$this->getacl("type",$this->readonly));
-    $smarty->assign("base",$this->base);
-    $smarty->assign("bases", $this->get_allowed_bases());
-    $smarty->assign("types", array(BLOCK_LIST_SEND => _("send"), BLOCK_LIST_RECEIVE => _("receive")));
-    $smarty->assign("type", $this->type);
-    return($smarty->fetch(get_template_path('generic.tpl', TRUE)));
-  }
-
-
-  public function save_object()
-  {
-    if(isset($_POST['blocklist_posted'])){
-      $tmp_cn = $this->cn;
-      plugin::save_object();
-      $this->cn = $tmp_cn;
-
-      /* Save base, since this is no LDAP attribute */
-      $tmp = $this->get_allowed_bases();
-      if(isset($_POST['base'])){
-        if(isset($tmp[$_POST['base']])){
-          $this->base= $_POST['base'];
-        }
-      }
-      $tmp = $this->attributes;
-      $tmp[] = "type";
-      foreach($tmp as $attr){
-        if(in_array($attr,array("cn","type")) && $this->readonly){
-          continue;
-        }elseif(isset($_POST[$attr]) && $this->acl_is_writeable($attr)){
-          $this->$attr = $_POST[$attr];
-        }
-      }
-    }
-  }
-
-
-  function remove_from_parent()
-  {
-    $ldap= $this->config->get_ldap_link();
-    $ldap->rmDir($this->dn);
-    new log("remove","gofaxlist/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    show_ldap_error($ldap->get_error(), sprintf(_("Removing of blocklist with dn '%s' failed."),$this->dn));
-    $this->handle_post_events("remove");
-  }
-
-
-  /* Check values */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    /* check syntax: must cn */
-    if ($this->cn == ""){
-      $message[]= _("Required field 'Name' is not set.");
-    } else {
-      if (!is_uid($this->cn)){
-        $message[]= _("Required field 'Name' contains invalid characters");
-      }
-      if ($this->dn == 'new'){
-        $ldap= $this->config->get_ldap_link();
-        $ldap->cd ("ou=gofax,ou=systems,".$this->config->current["BASE"]);
-        $ldap->search ("(&(|(objectClass=goFaxSBlock)(objectClass=goFaxRBlock))(cn=".$this->cn."))", array("cn"));
-        if ($ldap->count() != 0){
-          $message[]= _("Specified name is already used.");
-        }
-      }
-    }
-    return $message;
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    plugin::save();
-
-    /* Type selection */
-    if ($this->type == BLOCK_LIST_SEND){
-      $type= "goFaxSBlocklist";
-      $this->attrs['objectClass']= "goFaxSBlock";
-    } else {
-      $type= "goFaxRBlocklist";
-      $this->attrs['objectClass']= "goFaxRBlock";
-    }
-
-    /* Add list */
-    if (count($this->goFaxBlocklist)){
-      $this->attrs[$type]= $this->goFaxBlocklist;
-    }
-
-    /* Write back to ldap */
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd($this->base);
-    $ldap->cat($this->dn, array('dn'));
-    if ($ldap->count()){
-      if (!isset($this->attrs[$type])){
-        $this->attrs[$type]= array();
-      }
-      $ldap->cd($this->dn);
-      $this->cleanup();
-      $ldap->modify($this->attrs);
-      new log("modify","faxblocklist/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-      $this->handle_post_events("modify");
-    } else {
-      $ldap->cd($this->config->current['BASE']);
-      $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
-      $ldap->cd($this->dn);
-      $ldap->add($this->attrs);
-      new log("create","gofaxlist/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-      $this->handle_post_events("add");
-    }
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of blocklist with dn '%s' failed."),$this->dn));
-  }
-
-
-  /* Add number */
-  function addNumber($number)
-  {
-    if (!in_array($number, $this->goFaxBlocklist)){
-      $this->goFaxBlocklist[]= $number;
-      sort($this->goFaxBlocklist);
-    }
-  }
-
-
-  /* Remove number from list */
-  function delNumber($numbers)
-  {
-    $tmp= array();
-    foreach ($this->goFaxBlocklist as $val){
-      if (!in_array($val, $numbers)){
-        $tmp[]= $val;
-      }
-    }
-    $this->goFaxBlocklist= $tmp;
-  }
-
-
-  function getCopyDialog()
-  { 
-    $smarty = get_smarty();
-    $smarty->assign("cn",$this->cn);
-    $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE,dirname(__FILE__)));
-    $ret = array();
-    $ret['string'] = $str;
-    $ret['status'] = "";
-    return($ret);
-  }
-
-  function saveCopyDialog()
-  {
-    if(isset($_POST['cn'])){
-      $this->cn = get_post('cn');
-    }
-  }
-
-  
-  function PrepareForCopyPaste($source)
-  {
-    plugin::PrepareForCopyPaste($source);
-
-    /* We will not be able to rename edited blocklists */
-    $this->readonly = TRUE;
-
-    /* Get blocklist type and defined numbers */
-    if (in_array("goFaxSBlock",$source['objectClass'])){
-      if(isset($source["goFaxSBlocklist"])){
-        for ($i= 0; $i<$source["goFaxSBlocklist"]["count"]; $i++){
-          $this->goFaxBlocklist[]= $source["goFaxSBlocklist"][$i];
-        }
-      }
-      $this->type= BLOCK_LIST_SEND;
-    } elseif (in_array("goFaxRBlock",$source['objectClass'])){
-      if(isset($source["goFaxRBlocklist"])){
-        for ($i= 0; $i<$source["goFaxRBlocklist"]["count"]; $i++){
-          $this->goFaxBlocklist[]= $source["goFaxRBlocklist"][$i];
-        }
-      }
-      $this->type= BLOCK_LIST_RECEIVE;
-    }
-
-    /* Set base */
-    if ($this->dn == "new"){
-      if(isset($_SESSION['CurrentMainBase'])){
-        $this->base= $_SESSION['CurrentMainBase'];
-      }else{
-        $ui= get_userinfo();
-        $this->base= dn2base($ui->dn);
-      }
-    } else {
-      $this->base =preg_replace ("/^[^,]+,[^,]+,[^,]+,/","",$this->dn);
-    }
-  }
-
-
-  /* Return plugin informations for acl handling */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"       => _("Fax"),
-          "plDescription"     => _("Fax blocklists"),
-          "plSelfModify"      => FALSE,
-          "plDepends"         => array(),
-
-          "plPriority"    => 0,
-          "plSection"     => array("administration" => _("FAX Blocklists")),
-          "plCategory"    => array("gofaxlist"      => array("description" => _("Fax blocklists"),
-              "objectClass" => array("goFaxRBlock","goFaxSBlock"))),
-          "plProvidedAcls" => array(
-            "cn"              => _("Name"),
-            "description"     => _("Description"),
-            "base"            => _("Base"),
-            "goFaxBlocklist"  => _("Blocklist"),
-            "type"            => _("Blocklist type"))
-          ));
-  }
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/gofax/blocklists/class_blocklistManagement.inc b/plugins/gofax/blocklists/class_blocklistManagement.inc
deleted file mode 100644 (file)
index f9b19ea..0000000
+++ /dev/null
@@ -1,477 +0,0 @@
-<?php
-class blocklist extends plugin
-{
-  /* Definitions */
-  var $plHeadline= "FAX Blocklists";
-  var $plDescription= "This does something";
-
-  var $blocklists       = array();
-  var $DivListBlocklist = NULL;
-  var $CopyPasteHandler = NULL;
-
-  var $start_pasting_copied_objects = FALSE;
-  
-  function blocklist (&$config, $ui)
-  {
-    $this->ui     = $ui;
-    $this->dn     = "";
-    $this->config = &$config;
-    $this->base = $_SESSION['CurrentMainBase']; 
-    $this->DivListBlocklist = new divListBlocklist($this->config,$this);
-
-    /* Initialize copy&paste queue */
-    if ($this->config->boolValueIsTrue("main", "enableCopyPaste")){
-      $this->CopyPasteHandler= new CopyPasteHandler($this->config);
-    }
-  }
-
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    $_SESSION['LOCK_VARS_TO_USE'] = array("/^goFaxBlocklist_/","/^act$/","/^id$/","/^remove_multiple_blocklists/","/^item_selected/");
-
-    /***************
-      Init vars 
-     ***************/
-
-    /* Get global smarty instance */
-    $smarty       = get_smarty();
-    $s_action     = "";                       // Contains the action to proceed
-    $s_entry      = "";                       // The value for s_action
-    $base_back    = "";                       // The Link for Backbutton
-
-
-    /***************
-      Fetch posts 
-     ***************/
-
-    /* Test Posts */
-    foreach($_POST as $key => $val){
-      // Post for delete
-      if(preg_match("/^goFaxBlocklist_del.*/",$key)){
-        $s_action = "del";
-        $s_entry  = preg_replace("/^goFaxBlocklist_del_/i","",$key);
-        // Post for edit
-      }elseif(preg_match("/^goFaxBlocklist_edit_.*/",$key)){
-        $s_action="edit";
-        $s_entry  = preg_replace("/^goFaxBlocklist_edit_/i","",$key);
-        // Post for new
-      }elseif(preg_match("/^goFaxBlocklist_new.*/",$key)){
-        $s_action="new";
-      }elseif(preg_match("/^remove_multiple_blocklists/",$key)){
-        $s_action="del_multiple";
-      }elseif(preg_match("/^copy/",$key)){
-        $s_action = "copy";
-        $s_entry= preg_replace("/^copy_/i", "", $key);
-      }elseif(preg_match("/^cut/",$key)){
-        $s_action = "cut";
-        $s_entry= preg_replace("/^cut_/i", "", $key);
-      }
-
-    }
-    if((isset($_GET['act']))&&($_GET['act']=="edit_entry")){
-      $s_action ="edit";
-      $s_entry  = $_GET['id'];
-    }
-
-    $s_entry  = preg_replace("/_.$/","",$s_entry);
-
-
-    /* handle C&P from layers menu */
-    if(isset($_POST['menu_action']) && preg_match("/^multiple_copy_systems/",$_POST['menu_action'])){
-      $s_action = "copy_multiple";
-    }
-    if(isset($_POST['menu_action']) && preg_match("/^multiple_cut_systems/",$_POST['menu_action'])){
-      $s_action = "cut_multiple";
-    }
-    if(isset($_POST['menu_action']) && preg_match("/^editPaste/",$_POST['menu_action'])){
-      $s_action = "editPaste";
-    }
-
-
-    /* Create options */
-    if(isset($_POST['menu_action']) && $_POST['menu_action'] == "goFaxBlocklist_new"){
-      $s_action = "new";
-    }
-
-    /* handle remove from layers menu */
-    if(isset($_POST['menu_action']) && preg_match("/^remove_multiple/",$_POST['menu_action'])){
-      $s_action = "del_multiple";
-    }
-
-
-    /***************
-      Handle copy & paste  
-     ***************/
-
-    $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
-    if($ret){
-      return($ret);
-    }
-
-
-    /***************
-      Cancel some dialogs  
-     ***************/
-
-    /* Cancel dialog */
-    if (isset($_POST['edit_cancel']) || 
-        isset($_POST['delete_blocklist_cancel']) ||
-        isset($_POST['delete_lock'])){
-
-      del_lock ($this->dn);
-      $this->dialog = NULL;
-      unset($_SESSION['objectinfo']);
-    }
-
-
-    /***************
-      Save blocklist 
-     ***************/
-
-    /* What about finish? */
-    if (isset($_POST['edit_finish']) || isset($_POST['edit_apply'])){
-
-      /* No errors, save object */
-      $this->dialog->save_object();
-      $message= $this->check();
-      if (count ($message) == 0){
-
-        $this->dialog->save ();
-
-        if (!isset($_POST['edit_apply'])){
-          del_lock ($this->dn);
-          $this->dn= "";
-          $this->dialog = NULL;
-          unset($_SESSION['objectinfo']);
-        }
-      } else {
-        /* Errors found, show message */
-        show_errors ($message);
-      }
-    }
-
-
-    /***************
-      Create a new blocklist (dialog)
-     ***************/
-
-    /* Create new blocklist? */
-    if ($s_action=="new"){
-      $this->dn= "new";
-      $this->dialog = new faxblocktabs($this->config,$this->config->data['TABS']['FAXBLOCKTABS'],$this->dn);
-      $this->dialog->set_acl_base($this->base);
-    }
-
-
-    /***************
-      Edit blocklist 
-     ***************/
-
-    if ($s_action=="edit" && !is_object($this->dialog)){
-
-      $this->dn=$this->blocklists[$s_entry]['dn'];
-
-      if (($user= get_lock($this->dn)) != ""){
-        return(gen_locked_message($user, $this->dn));
-      }else{
-        add_lock ($this->dn, $this->ui->dn);
-      }
-      $_SESSION['objectinfo']= trim($this->dn);
-      $this->dialog = new faxblocktabs($this->config,$this->config->data['TABS']['FAXBLOCKTABS'],$this->dn);
-      $this->dialog->set_acl_base($this->dn);
-    }    
-
-
-    /***************
-      Display dialog  
-     ***************/
-
-    if(is_object($this->dialog) && ($this->dialog instanceof faxblocktabs)){
-      $this->dialog->save_object();
-      return($this->dialog->execute());
-    }
-
-
-    /********************
-      Delete MULTIPLE entries requested, display confirm dialog
-     ********************/
-
-    if ($s_action=="del_multiple"){
-
-      $this->dns = array();
-      $ids = $this->list_get_selected_items();
-
-      if(count($ids)){
-        foreach($ids as $id){
-          $dn = $this->blocklists[$id]['dn'];
-          if (($user= get_lock($dn)) != ""){
-            return(gen_locked_message ($user, $dn));
-          }
-          $this->dns[$id] = $dn;
-        }
-
-        $dns_names = "<br><pre>";
-        foreach($this->dns as $dn){
-          add_lock ($dn, $this->ui->dn);
-          $dns_names .= $dn."\n";
-        }
-        $dns_names .="</pre>";
-
-        /* Lock the current entry, so nobody will edit it during deletion */
-        $smarty->assign("info",     sprintf(_("You're about to delete the following blocklists(s) %s"), @LDAP::fix($dns_names)));
-        $smarty->assign("multiple", true);
-        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
-      }
-    }
-
-
-    /********************
-      Delete MULTIPLE entries confirmed
-     ********************/
-
-    /* Confirmation for deletion has been passed. */
-    if (isset($_POST['delete_multiple_blocklist_confirm'])){
-
-      /* Remove user by user and check acls before removeing them */
-      foreach($this->dns as $key => $dn){
-        if (preg_match("/d/",$this->ui->get_permissions($this->dn,"gofaxlist/blocklistGeneric"))){
-          $this->dn = $dn;
-          $this->dialog = new faxblocktabs($this->config,$this->config->data['TABS']['FAXBLOCKTABS'],$this->dn);
-          $this->dialog->delete();
-          $this->dialog = NULL;
-        } else {
-          print_red (sprintf(_("You are not allowed to delete the blocklist '%s'!"),$dn));
-        }
-        /* Remove lock file after successfull deletion */
-        del_lock ($dn);
-        unset($this->dns[$key]);
-      }
-      $this->reload();
-    }
-
-
-    /********************
-      Delete MULTIPLE entries Canceled
-     ********************/
-
-    /* Remove lock */
-    if(isset($_POST['delete_multiple_blocklist_cancel'])){
-      foreach($this->dns as $key => $dn){
-        del_lock ($dn);
-        unset($this->dns[$key]);
-      }
-    }
-
-
-    /***************
-      Remove blocklist
-     ***************/
-
-    /* Delete blocklist requested */
-    if ($s_action=="del"){
-      $this->dn=$this->blocklists[$s_entry]['dn'];
-
-      /* Check locking */
-      if (($user= get_lock($this->dn)) != ""){
-        $_SESSION['dn']= $this->dn;
-        return(gen_locked_message($user, $this->dn));
-      } else {
-
-        // Lock this dn for editing
-        add_lock ($this->dn, $this->ui->dn);
-        $smarty->assign("info", sprintf(_("You're about to delete the blocklist '%s'."), $this->dn));
-        $smarty->assign("multiple", false);
-        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
-      }
-    }
-
-
-    /***************
-      Remove blocklist confirmed
-     ***************/
-
-    /* Finally delete blocklist */
-    if (isset($_POST['delete_blocklist_confirm'])){
-      if (preg_match("/d/",$this->ui->get_permissions($this->dn,"gofaxlist/blocklistGeneric"))){
-        $this->dialog = new faxblocktabs($this->config,$this->config->data['TABS']['FAXBLOCKTABS'],$this->dn);
-        $this->dialog->delete();
-        $this->dialog = NULL;
-        del_lock ($this->dn);
-      } else {
-        print_red (_("You have no permission to remove this blocklist."));
-      }
-    }
-
-    /***************
-      Divlist dialog 
-     ***************/
-
-    /* Check if there is a snapshot dialog open */
-    $base = $this->DivListBlocklist->selectedBase;
-    if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases())){
-      return($str);
-    }
-
-    /* Display dialog with system list */
-    $this->DivListBlocklist->parent = $this;
-    $this->DivListBlocklist->execute();
-
-    /* Add departments if subsearch is disabled */
-    if(!$this->DivListBlocklist->SubSearch){
-      $this->DivListBlocklist->AddDepartments($this->DivListBlocklist->selectedBase,3,1);
-    }
-    $this->reload();
-    $this->DivListBlocklist->setEntries($this->blocklists);
-    return($this->DivListBlocklist->Draw());
-  }
-
-
-  function list_get_selected_items()
-  {
-    $ids = array();
-    foreach($_POST as $name => $value){
-      if(preg_match("/^item_selected_[0-9]*$/",$name)){
-        $id   = preg_replace("/^item_selected_/","",$name);
-        $ids[$id] = $id;
-      }
-    }
-    return($ids);
-  }
-
-
-  /* Return departments, that will be included within snapshot detection */
-  function get_used_snapshot_bases()
-  {
-    return(array("ou=gofax,ou=systems,". $this->DivListBlocklist->selectedBase));
-  }
-
-
-  /* Reload the list of known blocklists */
-  function reload()
-  {
-    /* Init some vars */
-    $filter = $filter2      = "";
-    $base                   = $this->DivListBlocklist->selectedBase;
-    $Regex                  = $this->DivListBlocklist->Regex;
-    $SubSearch              = $this->DivListBlocklist->SubSearch;
-    $ShowSendBocklists      = $this->DivListBlocklist->ShowSendBocklists;
-    $ShowReceiveBlocklists  = $this->DivListBlocklist->ShowReceiveBlocklists;
-    $Flags                  = GL_SIZELIMIT;
-    $res = $res2            = array();
-
-    /* Append subsearch to Flags */
-    if($SubSearch){
-      $Flags |= GL_SUBSEARCH;
-    }else{
-      $base = "ou=gofax,ou=systems,".$base;
-    }  
-
-    /* Create filter */
-    if ($ShowSendBocklists){
-      $filter = "(&(objectClass=goFaxSBlock)(|(cn=".$Regex.")(goFaxSBlocklist=".$Regex.")))";
-      $res= get_list($filter, "gofaxlist", $base,array("*"), $Flags);
-    }
-    if ($ShowReceiveBlocklists){
-      $filter2= "(&(objectClass=goFaxRBlock)(|(cn=".$Regex.")(goFaxRBlocklist=".$Regex.")))";
-      $res2= get_list($filter2, "gofaxlist", $base,array("*"), $Flags);
-    }
-
-    $this->blocklists = array_merge($res,$res2);
-
-    /* appen && sort */
-    $tmp=array();
-    foreach($this->blocklists as $tkey => $val ){
-
-      $acl = $this->ui ->get_permissions($base,"gofaxlist/blocklist");
-      if(preg_match("/r/",$acl)){
-        $tmp[strtolower($val['cn'][0]).$val['cn'][0]]=$val;
-      }
-    }
-    ksort($tmp);
-    $this->blocklists=array();
-    foreach($tmp as $val){
-      $this->blocklists[]=$val;
-    }
-    reset ($this->blocklists);
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    $this->DivListBlocklist->save_object();
-  }
-
-
-
-
-
-  function copyPasteHandling_from_queue($s_action,$s_entry)
-  {
-    /* Check if Copy & Paste is disabled */
-    if(!is_object($this->CopyPasteHandler)){
-      return("");
-    }
-
-    /* Add a single entry to queue */
-    if($s_action == "cut" || $s_action == "copy"){
-      /* Cleanup object queue */
-      $this->CopyPasteHandler->cleanup_queue();
-      $dn = $this->blocklists[$s_entry]['dn'];
-      $this->CopyPasteHandler->add_to_queue($dn,$s_action,"faxblocktabs","FAXBLOCKTABS","gofaxlist");
-    }
-
-    /* Add entries to queue */
-    if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
-
-      /* Cleanup object queue */
-      $this->CopyPasteHandler->cleanup_queue();
-
-      /* Add new entries to CP queue */
-      foreach($this->list_get_selected_items() as $id){
-        $dn = $this->blocklists[$id]['dn'];
-
-        if($s_action == "copy_multiple"){
-          $this->CopyPasteHandler->add_to_queue($dn,"copy","faxblocktabs","FAXBLOCKTABS","gofaxlist");
-        }
-        if($s_action == "cut_multiple"){
-          $this->CopyPasteHandler->add_to_queue($dn,"cut","faxblocktabs","FAXBLOCKTABS","gofaxlist");
-        }
-      }
-    }
-
-    /* Start pasting entries */
-    if($s_action == "editPaste"){
-      $this->start_pasting_copied_objects = TRUE;
-    }
-
-    /* Return C&P dialog */
-    if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
-
-      /* Load entry from queue and set base */
-      $this->CopyPasteHandler->load_entry_from_queue();
-      $this->CopyPasteHandler->SetVar("base",$this->DivListBlocklist->selectedBase);
-
-      /* Get dialog */
-      $data = $this->CopyPasteHandler->execute();
-
-      /* Return dialog data */
-      if(!empty($data)){
-        return($data);
-      }
-    }
-
-    /* Automatically disable status for pasting */
-    if(!$this->CopyPasteHandler->entries_queued()){
-      $this->start_pasting_copied_objects = FALSE;
-    }
-    return("");
-  }
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/gofax/blocklists/class_divListBlocklists.inc b/plugins/gofax/blocklists/class_divListBlocklists.inc
deleted file mode 100755 (executable)
index 8b8a505..0000000
+++ /dev/null
@@ -1,291 +0,0 @@
-<?php
-
-class divListBlocklist extends MultiSelectWindow
-{
-
-  /* Current base */
-  var $selectedBase       = "";
-  var $departments        = array();
-
-  /* Regex */
-  var $Regex              = "*";
-
-  /* checkboxes */
-  var $ShowSendBocklists      ;
-  var $ShowReceiveBlocklists  ;
-
-  /* Subsearch checkbox */
-  var $SubSearch;
-
-  var $parent             ;
-  var $ui                 ;
-
-  function divListBlocklist (&$config, &$parent)
-  {
-    MultiSelectWindow::MultiSelectWindow($config, "Blocklists", "gofaxlist");
-    
-    $this->parent       = $parent;
-    $this->ui           = get_userinfo();
-
-    /* Set list strings */
-    $this->SetTitle(_("List of blocklists"));
-    $this->SetSummary(_("List of blocklists"));
-
-    /* Result page will look like a headpage */
-    $this->SetHeadpageMode();
-    $this->SetInformation(_("This menu allows you to create, delete and edit selected blocklists. Having a large size of lists, you might prefer the range selectors on top of the select box."));
-
-    $this->EnableAplhabet   (true);
-  
-    /* Disable buttonsm */
-    $this->EnableCloseButton(false);
-    $this->EnableSaveButton (false);
-
-    /* Dynamic action col, depending on snapshot icons */
-    $action_col_size = 100;
-    if($this->parent->snapshotEnabled()){
-      $action_col_size += 20;
-    }
-
-    /* Toggle all selected / deselected */
-    $chk = "<input type='checkbox' id='select_all' name='select_all'
-               onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
-
-    /* set Page header */
-    $this->AddHeader(array("string"=> $chk,          "attach"=>"style='width:20px;'"));
-    $this->AddHeader(array("string" => "&nbsp;", "attach" => "style='text-align:center;width:20px;'"));
-    $this->AddHeader(array("string" => _("Blocklist name")." / "._("Department"), "attach" => "style=''"));
-    $this->AddHeader(array("string" => _("Actions"), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'" ));
-
-    /* Add Checkboxes / SubSearch checkbox */
-    $this->AddCheckBox("ShowSendBocklists"     , _("Select to see send blocklists"),    _("Show send blocklists"),true);
-    $this->AddCheckBox("ShowReceiveBlocklists" , _("Select to see receive blocklists"), _("Show receive blocklists"),true);
-  
-    $this->AddCheckBox(SEPERATOR);
-    $this->AddCheckBox("SubSearch",  _("Select to search within subtrees"), _("Search in subtrees"), false);
-
-    /*                  Name                 ,Text                              ,Default  , Connect with alphabet  */
-    $this->AddRegex   ("Regex",     _("Regular expression for matching list names"),"*" , true);
-  }
-
-
-  function GenHeader()
-  {
-    /* Prepare departments,
-       which are shown in the listbox on top of the listbox
-     */
-    $options= "";
-
-    /* Get all departments within this subtree */
-    $base = $this->config->current['BASE'];
-
-    /* Add base */
-    $tmp = array();
-    $tmp[] = array("dn"=>$this->config->current['BASE']);
-    $tmp=  array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
-                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
-
-    $deps = array();
-    foreach($tmp as $tm){
-      $deps[$tm['dn']] = $tm['dn'];
-    }
-
-    /* Load possible departments */
-    $ui= get_userinfo();
-    $tdeps= $ui->get_module_departments("gofaxlist");
-    $ids = $this->config->idepartments;
-    $first = "";
-    $found = FALSE;
-    foreach($ids as $dep => $name){
-      if(isset($deps[$dep]) && in_array_ics($dep, $tdeps)){
-
-        /* Keep first base dn in mind, we could need this
-         *  info if no valid base was found
-         */
-        if(empty($first)) {
-          $first = $dep['dn'];
-        }
-
-        $value = $ids[$dep];
-        if ($this->selectedBase == $dep){
-          $found = TRUE;
-          $options.= "<option selected='selected' value='".$dep."'>$value</option>";
-        } else {
-          $options.= "<option value='".$dep."'>$value</option>";
-        }
-      }
-    }
-
-    /* The currently used base is not visible with your acl setup.
-     * Set base to first useable base.
-     */
-    if(!$found){
-      $this->selectedBase = $first;
-    }
-  
-    /* Get acls */
-    $ui       = get_userinfo();
-    $acl      = $ui->get_permissions($this->selectedBase,"gofaxlist/blocklist");
-    $acl_all  = $ui->has_complete_category_acls($this->selectedBase,"gofaxlist");
-
-    /* Add default header */
-    $listhead = MultiSelectWindow::get_default_header();
-
-    /* Append department selector */
-    $listhead .= "&nbsp;"._("Base")."&nbsp;<select name='CurrentMainBase' 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;";
-
-    /* Create Layers menu */
-    $s  = ".|"._("Actions")."|\n";
-    $s .= "..|<img src='images/list_new.png' alt='' border='0' class='center'>".
-      "&nbsp;"._("Create")."|\n";
-
-    /* Append create options */
-    if(preg_match("/c/",$acl)) {
-      $s.= "...|<input class='center' type='image' src='images/list_new_blocklist.png' alt=''>".
-        "&nbsp;"._("Blocklist")."|goFaxBlocklist_new|\n";
-    }
-
-    /* Multiple options */
-    $s.= "..|---|\n";
-    $s.= "..|<img src='images/edittrash.png' alt='' border='0' class='center'>".
-      "&nbsp;"._("Remove")."|"."remove_multiple|\n";
-
-    /* Add multiple copy & cut icons */
-    if(is_object($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
-      $s.= "..|---|\n";
-      $s.= "..|<img src='images/editcopy.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Copy")."|"."multiple_copy_systems|\n";
-      $s.= "..|<img src='images/editcut.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Cut")."|"."multiple_cut_systems|\n";
-
-      if($this->parent->CopyPasteHandler->entries_queued()){
-        $img = "<img border='0' class='center' src='images/editpaste.png' alt=''>";
-        $s.="..|".$img."&nbsp;"._("Paste")."|editPaste|\n";
-      }else{
-        $img = "<img border='0' class='center' src='images/cant_editpaste.png' alt=''>";
-        $s.="..|".$img."&nbsp;"._("Paste")."\n";
-      }
-    }
-
-    /* Add snapshot icons */
-    if(preg_match("/(c.*w|w.*c)/",$acl_all)){
-      $s .= "..|---|\n";
-      $s .= $this->get_snapshot_header(TRUE);
-    }
-
-    $this->SetDropDownHeaderMenu($s);
-
-    $this->SetListHeader($listhead);
-  }
-
-  function execute()
-  {
-    $this->ClearElementsList();
-    $this->GenHeader();
-  }
-
-  function setEntries($list)
-  {
-    // User and Template  Images
-    $blockimg = "<img class='center' src='images/list_blocklist.png' alt='User' title='%s'>";
-    $editlink = "<a href='?plug=".$_GET['plug']."&amp;id=%s&amp;act=edit_entry'>%s</a>";
-
-    /* Dynamic action col, depending on snapshot icons */
-    $action_col_size = 100;
-    if($this->parent->snapshotEnabled()){
-      $action_col_size += 20;
-    }
-
-    /* Append to list */
-    $ui = get_userinfo();
-    foreach($list as $key => $val){
-
-      $acl = $ui->get_permissions($val['dn'],"gofaxlist/blocklist");
-      if(!preg_match("/r/",$acl)){
-        continue;
-      }  
-
-      /* Edit link ; requires read access */
-      $action= "<input class='center' type='image' src='images/edit.png' alt='"._("edit")."'     name='goFaxBlocklist_edit_%KEY%' title='"._("Edit user")."'>";
-
-      
-      /* Create snapshot ; requires write access && create access */
-      if(preg_match("/w/",$acl) && preg_match("/c/",$acl)){
-        $action.= $this->GetSnapShotActions($val['dn']);
-      }
-     
-      /* Add copy & cut icons */
-      if(preg_match("/(c.*w|w.*c)/",$acl) && $this->parent->CopyPasteHandler){
-        $action .= "<input class='center' type='image'
-          src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
-        $action.= "<input class='center' type='image'
-          src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
-      }
-
-      /* Delete entry ; requires remove access */
-      if(preg_match("/d/",$acl)){
-        $action.= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."' name='goFaxBlocklist_del_%KEY%' title='"._("Delete user")."'>";
-      }
-      
-      // Generate Array to Add
-      if(isset($val["description"][0])){
-        $display= $val["cn"][0]." [".$val["description"][0]."]";
-      }else{
-        $display= $val["cn"][0];
-      }
-
-      /* Cutted objects should be displayed in light grey */
-      if(isset($this->parent->CopyPasteHandler->queue) && is_array($this->parent->CopyPasteHandler->queue)){
-        foreach($this->parent->CopyPasteHandler->queue as $queue_key => $queue_data){
-          if($queue_data['dn'] == $val['dn']) {
-            $display = "<font color='#999999'>".$display."</font>";
-            break;
-          }
-        }
-      }
-
-      
-      /* Create each field */
-      $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
-                      "attach" => "style='width:20px;'");
-      $field1 = array("string" => sprintf($blockimg,$val['dn']), "attach" => "style='text-align:center;width:20px;'");
-      $field2 = array("string" => sprintf($editlink,$key,$display), "attach" => "style='' title='".preg_replace('/ /', '&nbsp;', @LDAP::fix($val['dn']))."'");
-      $field3 = array("string" => preg_replace("/%KEY%/", "$key", $action), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'");
-      $this->AddElement( array($field0,$field1,$field2,$field3));
-    }
-
-    /* Create summary string for list footer */
-    $num_deps=0;
-    if(!$this->SubSearch){
-      $num_deps = count($this->Added_Departments);
-    }
-    $num_objs = count($list);
-
-    $num_obj_str = _("Number of listed blocklists");
-    $num_dep_str = _("Number of listed departments");
-
-    $str = "<img class='center' src='images/list_blocklist.png'
-              title='".$num_obj_str."' alt='".$num_obj_str."'>&nbsp;".$num_objs."&nbsp;&nbsp;&nbsp;&nbsp;";
-    $str.= "<img class='center' src='images/folder.png'
-              title='".$num_dep_str."' alt='".$num_dep_str."'>&nbsp;".$num_deps."&nbsp;&nbsp;&nbsp;&nbsp;";
-
-    $this->set_List_Bottom_Info($str);
-
-  }
-
-  function Save()
-  {
-    MultiSelectWindow :: Save();  
-  }
-
-  function save_object()
-  {
-    /* Save automatic created POSTs like regex, checkboxes */
-    MultiSelectWindow :: save_object();   
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/gofax/blocklists/generic.tpl b/plugins/gofax/blocklists/generic.tpl
deleted file mode 100644 (file)
index df9f84a..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-<h2><img class="center" alt="" align="middle" src="images/rightarrow.png"> {t}Generic{/t}</h2>
-<table summary="" style="width:100%; vertical-align:top; text-align:left;">
-
- <tr>
-   <td style="width:50%; vertical-align:top;">
-    <table summary="">
-     <tr>
-      <td><LABEL for="cn">{t}List name{/t}</LABEL>{$must}</td>
-      <td>
-
-{render acl=$cnACL}
-       <input name="cn" id="cn" size=25 maxlength=60 value="{$cn}" title="{t}Name of blocklist{/t}">
-{/render}
-      </td>
-     </tr>
-     <tr>
-      <td><LABEL for="base">{t}Base{/t}</LABEL>{$must}</td>
-      <td>
-{render acl=$baseACL}
-      <select id="base" size="1" name="base" title="{t}Choose subtree to place group in{/t}">
-       {html_options options=$bases selected=$base}
-      </select>
-{/render}
-
-{render acl=$baseACL disable_picture='images/folder_gray.png'}
-        <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
-{/render}
-      </td>
-     </tr>
-    </table>
-   </td>
-
-  <td style="border-left:1px solid #A0A0A0">
-   &nbsp;
-  </td>
-
-   <td style="vertical-align:top;">
-    <table summary="">
-     <tr>
-       <td><LABEL for="type">{t}Type{/t}</LABEL></td>
-       <td>
-{render acl=$typeACL}
-        <select size="1" id="type" name="type" title="{t}Select wether to filter incoming or outgoing calls{/t}">
-               {html_options options=$types selected=$type}
-               <option disabled>&nbsp;</option>
-        </select>
-{/render}
-        </td>
-      </tr>
-      <tr>
-       <td><LABEL for="description">{t}Description{/t}</LABEL></td>
-       <td>
-{render acl=$descriptionACL}
-         <input name="description" id="description" size=25 maxlength=80 value="{$description}" title="{t}Descriptive text for this blocklist{/t}">
-{/render}
-       </td>
-      </tr>
-    </table>
-   </td>
- </tr>
-</table>
-
-<p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
-
-<table summary="" style="width:100%">
- <tr>
-   <td style="width:50%;">
-     <h2><img class="center" alt="" align="middle" src="images/false.png"> {t}Blocked numbers{/t}</h2>
-{render acl=$goFaxBlocklistACL}
-     <select style="width:100%; height:200px;" name="numbers[]" size=15 multiple>
-      {html_options values=$goFaxBlocklist output=$goFaxBlocklist}
-         <option disabled>&nbsp;</option>
-     </select>
-{/render}
-     <br>
-{render acl=$goFaxBlocklistACL}
-     <input id="number" name="number" size=25 maxlength=60 >&nbsp;
-{/render}
-{render acl=$goFaxBlocklistACL}
-     <input type=submit value="{t}Add{/t}" name="add_number">&nbsp;
-{/render}
-{render acl=$goFaxBlocklistACL}
-     <input type=submit value="{t}Delete{/t}" name="delete_number">
-{/render}
-   </td>
-  <td style="border-left:1px solid #A0A0A0">
-   &nbsp;
-  </td>
-   <td style="vertical-align:top;" >
-     <h2><img class="center" alt="" align="middle" src="images/info_small.png"> {t}Information{/t}</h2>
-     <p>
-      {t}Numbers can also contain wild cards.{/t}
-     </p>
-   </td>
- </tr>
-</table>
-
-<p class="plugbottom">
-  <input type=submit name="edit_finish" style="width:80px" value="{t}Ok{/t}">
-  <input type=submit name="edit_apply" value="{t}Apply{/t}">
-  <input type=submit name="edit_cancel" value="{t}Cancel{/t}">
-</p>
-<input type='hidden' name='blocklist_posted' value="1">
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('n');
-  -->
-</script>
diff --git a/plugins/gofax/blocklists/main.inc b/plugins/gofax/blocklists/main.inc
deleted file mode 100644 (file)
index 71c0b81..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-if ($remove_lock){
-        if(isset($_SESSION['blocklist'])){
-                $blocklist= $_SESSION['blocklist'];
-                del_lock ($ui->dn);
-                sess_del ('blocklist');
-        }
-} else {
-       /* Create blocklist object on demand */
-       if (!isset($_SESSION['blocklist']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
-               $_SESSION['blocklist']= new blocklist($config, $ui);
-               $_SESSION['blocklist']->set_acl_category("gofaxlist");
-       }
-       $blocklist= $_SESSION['blocklist'];
-       $blocklist->save_object();
-       $output= $blocklist->execute();
-
-       /* Reset requested? */
-       if (isset($_GET['reset']) && $_GET['reset'] == 1){
-               del_lock ($ui->dn);
-               sess_del ('blocklist');
-       }
-
-       /* Page header*/
-       if (isset($_SESSION['objectinfo'])){
-               $display= print_header(get_template_path('images/blocklists.png'), _("Blocklist management"), "<img alt=\"\"align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".@LDAP::fix($_SESSION['objectinfo']));
-       } else {
-               $display= print_header(get_template_path('images/blocklists.png'), _("Blocklist management"));
-       }
-       $display.= $output;
-
-       $_SESSION['blocklist']= $blocklist;
-}
-?>
diff --git a/plugins/gofax/blocklists/paste_generic.tpl b/plugins/gofax/blocklists/paste_generic.tpl
deleted file mode 100644 (file)
index ac4cef9..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<table summary="">
- <tr>
-  <td><LABEL for="cn">{t}List name{/t}</LABEL></td>
-  <td>
-   <input name="cn" id="cn" size=25 maxlength=60 value="{$cn}" title="{t}Name of blocklist{/t}">
-  </td>
- </tr>
-</table>
diff --git a/plugins/gofax/blocklists/remove.tpl b/plugins/gofax/blocklists/remove.tpl
deleted file mode 100644 (file)
index ebea1e3..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-<div style="font-size:18px;">
- <img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
-</div>
-<p>
- {$info}
- {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}So - if you're sure - press 'Delete' to continue or 'Cancel' to abort.{/t}
-</p>
-
-<p class="plugbottom">
-       {if $multiple}
-               <input type=submit name="delete_multiple_blocklist_confirm" value="{t}Delete{/t}">
-               &nbsp;
-               <input type=submit name="delete_multiple_blocklist_cancel" value="{t}Cancel{/t}">
-       {else}
-               <input type=submit name="delete_blocklist_confirm" value="{t}Delete{/t}">
-               &nbsp;
-               <input type=submit name="delete_blocklist_cancel" value="{t}Cancel{/t}">
-       {/if}
-</p>
-
diff --git a/plugins/gofax/blocklists/tabs_blocklist.inc b/plugins/gofax/blocklists/tabs_blocklist.inc
deleted file mode 100644 (file)
index 9293903..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-
-class faxblocktabs extends tabs
-{
-  function faxblocktabs($config, $data, $dn)
-  {
-    tabs::tabs($config, $data, $dn, 'gofaxlist');
-
-    /* Add references/acls/snapshots */
-    $this->addSpecialTabs();
-  }
-
-  function save($ignore_account= FALSE)
-  {
-    $baseobject= $this->by_object['blocklistGeneric'];
-
-    /* Check for new 'dn', in order to propagate the 'dn' to all plugins */
-    $new_dn= "cn=".$baseobject->cn.",ou=gofax,ou=systems,".$baseobject->base;
-
-    /* Move group? */
-    if ($this->dn != $new_dn){
-
-      /* Write entry on new 'dn' */
-      if ($this->dn != "new"){
-        $baseobject->move($this->dn, $new_dn);
-        $this->by_object['blocklistGeneric']= $baseobject;
-      }
-
-      /* Happen to use the new one */
-      $this->dn= $new_dn;
-    }
-
-    tabs::save();
-  }
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/gofax/faxaccount/class_gofaxAccount.inc b/plugins/gofax/faxaccount/class_gofaxAccount.inc
deleted file mode 100644 (file)
index eca2228..0000000
+++ /dev/null
@@ -1,857 +0,0 @@
-<?php
-
-class gofaxAccount extends plugin
-{
-  /* Definitions */
-  var $plHeadline= "FAX";
-  var $plDescription= "This does something";
-
-  /* CLI vars */
-  var $cli_summary= "Manage users fax account";
-  var $cli_description= "Some longer text\nfor help";
-  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-
-  /* Department list shown in the divSelectList*/
-  var $departments;
-
-  /* Fax attributes */
-  var $goFaxDeliveryMode= "";
-  var $facsimileTelephoneNumber= "";
-  var $goFaxIsEnabled= 1;
-  var $goFaxPrinter= "";
-  var $goFaxDivertNumber= "";
-  var $goFaxLanguage= "";
-  var $goFaxFormat= "";
-  var $goFaxRBlocklist = array();
-  var $goFaxRBlockgroups= array();
-  var $goFaxSBlocklist= array();
-  var $goFaxSBlockgroups= array();
-  var $mail= "";
-  var $facsimileAlternateTelephoneNumber= array();
-  var $fax_formats = array("pdf","ps","png","mtiff","tiff");  
-
-  /* Internal variables */
-  var $printerList= array();
-  var $has_mailAccount= FALSE;
-  var $locals_dialog= FALSE;
-  var $in_blocklist_dialog= FALSE;
-  var $out_blocklist_dialog= FALSE;
-  var $current_blocklist= array();
-  var $view_logged = FALSE;
-
-  /* Copy & paste variables */
-  var $CopyPasteVars=array("facsimileTelephoneNumber");//,"goFaxRBlocklist","goFaxRBlockgroups","goFaxSBlocklist","goFaxSBlockgroups");
-
-  /* attribute list for save action */
-  var $attributes= array("goFaxDeliveryMode", "goFaxIsEnabled","facsimileAlternateTelephoneNumber","goFaxRBlocklist","goFaxRBlockgroups","goFaxSBlocklist","goFaxSBlockgroups","goFaxPrinter", "goFaxDivertNumber", "goFaxLanguage", "goFaxFormat", "mail","facsimileTelephoneNumber");
-
-  var $uid ="";
-
-  var $objectclasses= array("goFaxAccount");
-
-  function gofaxAccount (&$config, $dn= NULL)
-  {
-    /* General initialization */
-    plugin::plugin ($config, $dn);
-
-    /* Set uid, it is used in handle_post_events */
-    if(isset($this->attrs['uid'])){
-      $this->uid = $this->attrs['uid'][0];
-    }
-
-    /* Hickert : 11.11.05
-     * Added to be able to handle department selection in divSelelect
-     */
-    if(!isset($_SESSION["Fax_Filter"])){
-      $_SESSION['Fax_Filter']['depselect'] = $this->config->current['BASE'];
-    }
-
-    if ($dn != "new"){
-      /* Get arrays */
-      foreach (array("goFaxRBlocklist", "goFaxRBlockgroups", "goFaxSBlocklist",
-            "goFaxSBlockgroups", "facsimileAlternateTelephoneNumber") as $val){
-        $this->$val =array();
-        if (isset($this->attrs["$val"]["count"])){
-          for ($i= 0; $i<$this->attrs["$val"]["count"]; $i++){
-            array_push($this->$val, $this->attrs["$val"][$i]);
-          }
-        }
-      }
-
-      /* Set up has_mailAccount */
-      if (in_array("gosaMailAccount", $this->attrs['objectClass'])){
-        $this->has_mailAccount= TRUE;
-      }
-    }
-
-    /* Load printer list */
-    if (isset($this->config->data['SERVERS']['CUPS'])){
-      $this->printerList= get_printer_list ($this->config->data['SERVERS']['CUPS']);
-      asort ($this->printerList);
-    }
-
-    /* Check if the currently selected printer is still available. 
-       If not, append current printer to list of available.
-       It could be possible, that we are not allowed to view printers and so the list is empty ...  */
-    if(!empty($this->goFaxPrinter) && !isset($this->printerList[$this->goFaxPrinter])) {
-      $this->printerList[$this->goFaxPrinter] = "[".$this->goFaxPrinter."]";
-    }
-
-    /* Get global filter config */
-    if (!is_global("faxfilter")){
-      $ui= get_userinfo();
-      $base= get_base_from_people($ui->dn);
-      $faxfilter= array( "depselect"       => $base,
-          "fuser"            => "*",
-          "regex"           => "");
-      register_global("faxfilter", $faxfilter);
-    }
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* Log view */
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","users/".get_class($this),$this->dn);
-    }
-
-    /* Hickert : 11.11.05
-     * Added to be able to handle department selection in divSelelect
-     */
-    if((isset($_GET['act']))&&($_GET['act']=="dep_open")){
-
-      if(strlen(base64_decode($_GET['dep_id']))>= strlen($this->config->current['BASE'])){
-        $_SESSION['Fax_Filter']['depselect']= base64_decode($_GET['dep_id']);
-      }else{
-        $_SESSION['Fax_Filter']['depselect']= $this->config->current['BASE'];
-      }
-    }
-
-    /* Edit mode specifies if we are editing from my accout */
-    $edit_mode = (!is_object($this->parent) && !isset($_SESSION['edit']));
-
-    /* Load smarty stuff */
-    $smarty= get_smarty();
-
-    /* Check if mail account is active. We'll display an additional
-       mail address field if this is not the case. Some people may
-       want goFax, but have a mailserver which is not managed with
-       GOsa */
-    if (!@isset($this->parent->by_object['mailAccount'])) {
-      $smarty->assign("has_mailaccount", $this->has_mailAccount?"true":"false");
-    } elseif ( !$this->parent->by_object['mailAccount']->is_account){
-      $smarty->assign("has_mailaccount", "false");
-      $this->has_mailAccount= false;
-    } else {
-      $smarty->assign("has_mailaccount", "true");
-    }
-
-    /* Do we need to flip is_account state? */
-    if (isset($_POST['modify_state'])){
-      $this->is_account= !$this->is_account;
-    }
-
-    /* Do we represent a valid account? */
-    if (!$this->is_account && $this->parent === NULL){
-      $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\">&nbsp;<b>".
-        _("This account has no fax extensions.")."</b>";
-      $display.= back_to_main();
-      return ($display);
-    }
-
-    /* Show tab dialog headers */
-    $display= "";
-    if ($this->parent !== NULL){
-      if ($this->is_account){
-        $display= $this->show_disable_header(_("Remove fax account"),
-            _("This account has fax features enabled. You can disable them by clicking below."));
-      } else {
-        $display= $this->show_enable_header(_("Create fax account"),
-            _("This account has fax features disabled. You can enable them by clicking below."));
-        return ($display);
-      }
-    }
-
-    /* Trigger Add local fax alternatives dialog */
-    if (isset($_POST['add_local_alternate'])){
-      if($this->acl_is_writeable("facsimileAlternateTelephoneNumber",$edit_mode)){
-        $this->locals_dialog= TRUE;    
-        $this->dialog= TRUE;   
-      }
-    }
-
-    /* Add alternatives from dialog */
-    if (isset($_POST['add_locals_finish']) && isset($_POST['local_list'])){
-      if($this->acl_is_writeable("facsimileAlternateTelephoneNumber",$edit_mode)){
-        foreach ($_POST['local_list'] as $val){
-          $this->addAlternate($val);
-          $this->is_modified= TRUE;
-        }
-      }
-    }
-
-    /* Add alternatives */
-    if (isset($_POST['add_alternate']) && !empty($_POST['forward_address']) && is_phone_nr($_POST['forward_address'])){ 
-      if($this->acl_is_writeable("facsimileAlternateTelephoneNumber",$edit_mode)){
-        $this->addAlternate($_POST['forward_address']);
-      }
-    }
-
-    /* Delete alternate fax number */
-    if (isset($_POST['delete_alternate']) && isset($_POST['alternate_list']) && count($_POST['alternate_list'])){ 
-      if($this->acl_is_writeable("facsimileAlternateTelephoneNumber",$edit_mode)){
-        $this->delAlternate ($_POST['alternate_list']);
-      }
-    }
-
-
-    /* Edit incoming blocklists */
-    if (isset($_POST['edit_incoming'])){
-      if($this->acl_is_writeable("goFaxRBlocklist",$edit_mode))  {
-        $this->current_blocklist= array_merge($this->goFaxRBlocklist,$this->goFaxRBlockgroups);
-        sort($this->current_blocklist);
-        reset($this->current_blocklist);
-
-        $this->in_blocklist_dialog= TRUE;
-        $this->dialog= TRUE;
-      }
-    }
-
-    /* Edit outgoing blocklists */
-    if (isset($_POST['edit_outgoing'])){
-      $this->current_blocklist= array_merge($this->goFaxSBlocklist,$this->goFaxSBlockgroups);
-      sort($this->current_blocklist);
-      reset($this->current_blocklist);
-
-      $this->out_blocklist_dialog= TRUE;
-      $this->dialog= TRUE;
-    }
-
-    /* Add number to blocklist (dialog) */
-    if (isset($_POST['add_blocklist_number']) && $_POST['block_number'] != ""){
-      if (!is_phone_nr($_POST['block_number'])){
-        print_red (_("You're trying to add an invalid phone number."));
-      } else {
-        array_push($this->current_blocklist, $_POST['block_number']);
-        $this->current_blocklist= array_unique($this->current_blocklist);
-        sort($this->current_blocklist);
-        reset($this->current_blocklist);
-      }
-    }
-
-    /* Hickert : 11.11.05
-     * Add selection from divSelelect to our Blocklist 
-     */
-    /* Add list to blocklist */
-    if (isset($_POST['add_blocklist'])){
-      foreach($_POST as $name => $value){
-        if(preg_match("/ADDLIST_/i",$name)){
-          $this->current_blocklist= array_merge($this->current_blocklist, array(base64_decode($value)));
-
-        }
-      } 
-      $this->current_blocklist= array_unique($this->current_blocklist);
-      sort($this->current_blocklist);
-      reset($this->current_blocklist);
-    }
-
-    /* Add list to blocklist */
-    if (isset($_GET['add'])){
-      if(!is_array($this->current_blocklist)) $this->current_blocklist=array();
-      $this->current_blocklist= array_merge($this->current_blocklist, array( base64_decode($_GET['add'])));
-      $this->current_blocklist= array_unique($this->current_blocklist);
-      sort($this->current_blocklist);
-      reset($this->current_blocklist);
-    }
-
-    /* Delete from blocklist */
-    if (isset($_POST['delete_blocklist_number']) && isset($_POST['block_list'])){
-      $tmp= array();
-      foreach($this->current_blocklist as $val){
-        if (!in_array($val, $_POST['block_list'])){
-          $tmp[]= $val;
-        }
-      }
-      $this->current_blocklist= $tmp;
-    }
-
-
-    /* Blocklist edit finished */
-    if (isset($_POST['edit_blocklists_finish'])){
-
-      /* Incoming or outgoing? */
-      if ($this->in_blocklist_dialog){
-        $this->goFaxRBlocklist = array();
-        $this->goFaxRBlockgroups = array();
-
-        foreach ($this->current_blocklist as $val){
-          if (is_phone_nr($val)){
-            $this->goFaxRBlocklist[]=$val;
-          } else {
-            $this->goFaxRBlockgroups[]= $val;
-          }
-        }
-      } else {
-        $this->goFaxSBlocklist = array();
-        $this->goFaxSBlockgroups = array();
-
-        /* Transfer values to ourself */
-        foreach ($this->current_blocklist as $val){
-          if (is_phone_nr($val)){
-            $this->goFaxSBlocklist[]=$val;
-          } else {
-            $this->goFaxSBlockgroups[]= $val;
-          }
-        }
-      }
-      $this->is_modified= TRUE;
-    }
-
-
-    /* Set departments */
-    if ($this->locals_dialog || $this->in_blocklist_dialog || $this->out_blocklist_dialog){
-      
-      $list= array ();
-      $ldap= $this->config->get_ldap_link();
-      if (isset ($_POST['department'])){
-        $ldap->cd ($_POST['department']);
-      } else {
-        $ldap->cd ($this->config->current['BASE']);
-      }
-    }
-
-    /* Cancel  dialogs */
-    if (isset($_POST['add_locals_cancel']) || isset($_POST['edit_blocklists_finish']) ||
-        isset($_POST['edit_blocklists_cancel']) || isset($_POST['add_locals_finish'])){
-
-      $this->locals_dialog= FALSE;
-      $this->in_blocklist_dialog= FALSE;
-      $this->out_blocklist_dialog= FALSE;
-      $this->dialog= FALSE;
-    }
-
-    /* Manage locals dialog */
-    if ($this->locals_dialog){
-
-      /* Save data */
-      $faxfilter= get_global("faxfilter");
-      foreach( array("depselect", "fuser", "regex") as $type){
-        if (isset($_POST[$type])){
-          $faxfilter[$type]= $_POST[$type];
-        }
-      }
-      if (isset($_GET['search'])){
-        $s= mb_substr($_GET['search'], 0, 1, "UTF8")."*";
-        if ($s == "**"){
-          $s= "*";
-        }
-        $faxfilter['fuser']= $s;
-      }
-
-      if ($faxfilter['regex'] != '*' && $faxfilter['regex'] != ""){
-        $regex= $faxfilter['regex'];
-        $filter= "(facimileTelephoneNumber=$regex)";
-      } else {
-        $filter= "";
-      }
-      if ($faxfilter['fuser'] != ""){
-        $user= $faxfilter['fuser'];
-        $filter= "$filter(|(uid=$user)(cn=$user)(givenName=$user)(sn=$user))";
-      }
-
-      $base= $faxfilter['depselect'];
-      $res= get_list("(&(objectClass=goFaxAccount)$filter)", "gofax", $base, 
-                     array("sn", "givenName", "facsimileTelephoneNumber"), GL_SIZELIMIT | GL_SUBSEARCH);
-
-      foreach ($res as $attrs){
-        $list[$attrs['facsimileTelephoneNumber'][0]]=
-          $attrs['sn'][0].", ".
-          $attrs['givenName'][0]." [".
-          $attrs['facsimileTelephoneNumber'][0]."]";
-      }
-
-      /* Show dialog */
-      $smarty->assign("search_image", get_template_path('images/search.png'));
-      $smarty->assign("usearch_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.png'));
-      $smarty->assign("launchimage", get_template_path('images/small_filter.png'));
-      $smarty->assign("departments", $this->config->idepartments);
-      $smarty->assign("list", $list);
-      if (isset($_POST['depselect'])){
-        $smarty->assign("depselect", $_POST['depselect']);
-      }
-      $smarty->assign("deplist", $this->config->idepartments);
-      $smarty->assign("apply", apply_filter());
-      $smarty->assign("alphabet", generate_alphabet());
-      $smarty->assign("hint", print_sizelimit_warning());
-      foreach( array("depselect", "fuser", "regex") as $type){
-        $smarty->assign("$type", $faxfilter[$type]);
-      }
-      $smarty->assign("hint", print_sizelimit_warning());
-
-      $display.= $smarty->fetch (get_template_path('locals.tpl', TRUE, dirname(__FILE__)));
-      return ($display);
-    }
-
-
-    /* Manage incoming blocklists */
-    if ($this->in_blocklist_dialog){
-
-      /* This handles the divSelectBox */
-
-      /* The base specifies the current position in the ldap tree 
-       * The current base was specified by $_GET['dep_id'] before. Or contains the default value.
-       */
-      $base = $_SESSION['Fax_Filter']['depselect'];
-      $ldap->cd($base);
-
-      /* Ge all Blocklists */
-      $ldap->search ("(objectClass=goFaxRBlock)",array("cn","description"));
-      while ($attrs= $ldap->fetch()){
-
-        /* Generate list depending on description */
-        if(isset($attrs['description'][0])){
-          $list[$attrs['cn'][0]]=
-            $attrs['description'][0].
-            " [".$attrs['cn'][0]."]";
-        }else{
-          $list[$attrs['cn'][0]]= $attrs['cn'][0];
-        }
-      }
-
-      /* Create our divselect box */
-      $divSel = new divSelectBox("divSelectPredefined");
-      $divSel->setHeight(296);
-
-      /* NEW LIST MANAGMENT
-       * We also need to search for the departments
-       * So we are able to navigate like in konquerer
-       */
-      $this->departments= array();
-   
-      /* Get all departments within the current department */ 
-      $base = $_SESSION['Fax_Filter']['depselect'];
-      $ldap->ls("(objectClass=gosaDepartment)",$base);
-
-      /* Base back is used to go one department up in our ldap tree */
-      $base_back = preg_replace("/^[^,]+,/","",$base);
-
-      /* Only show base_back if it is needed */
-      if((strlen($base_back)>= strlen($this->config->current['BASE']))&&($base!=$this->config->current['BASE'])){
-        $this->departments[preg_replace("/^[^,]+,/","",$base)] = ".. - ["._("back")."]"; 
-      }
-
-      /* Fetch all returned departments an add them to our divlist */
-      while($value = $ldap->fetch()){
-        if($value["description"][0]!=".."){
-          $this->departments[$value['dn']]=@LDAP::fix(convert_department_dn($value['dn'])." - [".$value["description"][0]."]");
-        }else{
-          $this->departments[$value['dn']]=$value["description"][0];
-        }
-      }
-      /* END NEW LIST MANAGMENT
-       */
-
-      // This links specifies the department open link 
-      $linkopen = "<a href='?plug=".$_GET['plug']."&amp;act=dep_open&amp;dep_id=%s'>%s</a>";
-
-      /* Insert departments in divsel */
-      foreach($this->departments as $key=> $val){
-        if(!isset($this->config->departments[trim($key)])){
-          $this->config->departments[trim($key)]="";
-        }
-        $field1 = array("string" => "<img src='images/folder.png' alt='department'>","attach"=>"style='width:16px;text-align:center;'");
-        $field2 = array("string" => sprintf($linkopen,base64_encode($key),$val),"attach"=>" style='border:none'");
-        $divSel->AddEntry(array($field1,$field2));
-      }
-
-      /* Append predefined Blocklists */
-      foreach($list as $entry => $value){
-        $divSel->AddEntry(array(
-              array("string"=>"<input type='checkbox' value='".base64_encode($entry)."' name='ADDLIST_".base64_encode($entry)."'>"),
-              array("string"=>$value,"attach"=>"style='border:0px;'")
-              ));
-      }
-
-      /* Show dialog */
-      $smarty->assign("cblocklist", $this->current_blocklist);
-      $smarty->assign("departments", $this->config->idepartments);
-      $smarty->assign("divSelectPredefined", $divSel->DrawList());
-      $display.= $smarty->fetch (get_template_path('lists.tpl', TRUE, dirname(__FILE__)));
-      return ($display);
-    }
-
-    /* Manage outgoing blocklists */
-
-    if ($this->out_blocklist_dialog){
-
-      /* This handles the divSelectBox */
-
-      /* The base specifies the current position in the ldap tree
-       * The current base was specified by $_GET['dep_id'] before. Or contains the default value.
-       */
-      $base = $_SESSION['Fax_Filter']['depselect'];
-      $ldap->cd($base);
-
-      /* Ge all Blocklists */ 
-      $ldap->search ("(objectClass=goFaxSBlock)",array("cn","description"));
-      while ($attrs= $ldap->fetch()){
-        if(isset($attrs['description'][0])){
-          $list[$attrs['cn'][0]]=
-            $attrs['description'][0].
-            " [".$attrs['cn'][0]."]";
-        }else{
-          $list[$attrs['cn'][0]]= $attrs['cn'][0];
-        }
-      }
-
-      /*Create DivSel*/
-      $divSel = new divSelectBox("divSelectPredefined");
-      $divSel->setHeight(296);
-
-      /* NEW LIST MANAGMENT
-       * We also need to search for the departments
-       * So we are able to navigate like in konquerer
-       */
-      $this->departments= array();
-      $ldap->ls("(objectClass=gosaDepartment)",$base);
-
-      /* Generate Back url, and append if it is needed */
-      $base_back = preg_replace("/^[^,]+,/","",$base);
-      if((strlen($base_back)>= strlen($this->config->current['BASE']))&&($base!=$this->config->current['BASE'])){
-        $this->departments[preg_replace("/^[^,]+,/","",$base)] = ".. - ["._("back")."]";
-      }
-
-      /* Get all departments */
-      while($value = $ldap->fetch()){
-        if(isset($value["description"][0])){
-          $this->departments[$value['dn']]=@LDAP::fix(convert_department_dn($value['dn'])." - [".$value["description"][0]."]");
-        }else{
-          $this->departments[$value['dn']]=$value["description"][0];
-        }
-      }
-      /* END NEW LIST MANAGMENT
-       */
-
-      // Defining Links
-      $linkopen = "<a href='?plug=".$_GET['plug']."&amp;act=dep_open&amp;dep_id=%s'>%s</a>";
-
-      /* Insert departments in divlist*/
-      foreach($this->departments as $key=> $val){
-        if(!isset($this->config->departments[trim($key)])){
-          $this->config->departments[trim($key)]="";
-        }
-
-        $field1 = array("string" => "<img src='images/folder.png' alt='department'>","attach"=>"style='width:16px;text-align:center;'");
-        $field2 = array("string" => sprintf($linkopen,base64_encode($key),$val),"attach"=>" style='border:none'");
-        $divSel->AddEntry(array($field1,$field2));
-      }
-
-      /* Append Blocklits */
-      foreach($list as $entry => $value){
-        $divSel->AddEntry(array(
-              array("string"=>"<input type='checkbox' value='".base64_encode($entry)."' name='ADDLIST_".base64_encode($entry)."'>"),
-              array("string"=>$value,"attach"=>"style='border:0px;'")
-              ));
-      }
-
-      /* Show dialog */
-      $smarty->assign("cblocklist", $this->current_blocklist);
-      $smarty->assign("departments", $this->config->idepartments);
-      $smarty->assign("divSelectPredefined", $divSel->DrawList());
-      $display.= $smarty->fetch (get_template_path('lists.tpl', TRUE, dirname(__FILE__)));
-      return ($display);
-    }
-
-
-    /* Show main page */
-    $smarty->assign("languages", get_languages(TRUE));
-
-    $smarty->assign("formats",  $this->fax_formats);
-    $smarty->assign("printers", $this->printerList);
-
-    /* Load attributes */
-    foreach(array("goFaxIsEnabled", "goFaxDeliveryMode", "facsimileTelephoneNumber",
-          "goFaxPrinter", "goFaxLanguage", "goFaxFormat", 
-          "facsimileAlternateTelephoneNumber", "mail") as $val){
-
-      $smarty->assign("$val", $this->$val);
-    }
-
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $acl => $desc){
-      $smarty->assign($acl."ACL",$this->getacl($acl,$edit_mode));
-    }
-
-    /* Load checkboxes */
-    if ($this->goFaxIsEnabled == "1"){
-      $smarty->assign("goFaxIsEnabled", "");
-    } else {
-      $smarty->assign("goFaxIsEnabled", "checked");
-    }
-    /* goFaxAccount has "mail" as must! Block if no mailaddress is specified... */
-    if ($this->goFaxDeliveryMode & 32) {
-      $smarty->assign("faxtomail", "checked");
-    } else {
-      $smarty->assign("faxtomail", "");
-    }
-    if ($this->goFaxDeliveryMode & 64) {
-      $smarty->assign("faxtoprinter", "checked");
-    } else {
-      $smarty->assign("faxtoprinter", "");
-    }
-
-
-    $display.= $smarty->fetch (get_template_path('generic.tpl', TRUE, dirname(__FILE__)));
-    return ($display);
-  }
-
-  function remove_from_parent()
-  {
-    /* Cancel if there's nothing to do here */
-    if (!$this->initially_was_account){
-      return;
-    }
-
-    plugin::remove_from_parent();
-
-    /* Adapt mail settings if needed */
-    if ((isset($this->parent->by_object['mailAccount']->is_account)) && ($this->parent->by_object['mailAccount']->is_account)){
-      unset($this->attrs['mail']);
-    }
-
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd($this->dn);
-    $this->cleanup();
-    $ldap->modify ($this->attrs); 
-
-    new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-
-    show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/fax account with dn '%s' failed."),$this->dn));
-
-    /* Optionally execute a command after we're done */
-    $this->handle_post_events('remove',array("uid"=> $this->uid));
-  }
-
-
-  /* Check formular input */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    /* must: facsimileTelephoneNumber */
-    if ($this->facsimileTelephoneNumber == ""){
-      $message[]= _("The required field 'Fax' is not set.");
-    }
-
-    if (!is_phone_nr($this->facsimileTelephoneNumber)){
-      $message[]= _("Please enter a valid telephone number in the 'Fax' field.");
-    }
-
-    /* IF mail is specified (which is only the case if there's no mail account
-       present), check if it's valid..  */
-    if (@isset($this->parent->by_object['mailAccount']) &&
-        $this->goFaxDeliveryMode & 32){
-      if ($this->mail == ""){
-        $message[]= _("Mail delivery is checked, but no address has been specified.");
-      } elseif (!is_email($this->mail)){
-        $message[]= _("The mail address you've entered is invalid.");
-      }
-    }
-
-    // IE Fix, IE lets you choose disabled option, stupid browser ... 
-    if((empty($this->goFaxPrinter))&&($this->goFaxDeliveryMode & 64)){
-      $message[]= _("Deliver fax to printer, is only possible if valid printer is given. Please correct your choice.");
-    }
-
-    return ($message);
-  }
-
-  /* Save data to object */
-  function save_object()
-  {
-    $edit_mode = (!is_object($this->parent) && !isset($_SESSION['edit']));
-    if (isset($_POST['faxTab'])){
-      plugin::save_object();
-
-
-      $tmp = 0+$this->goFaxDeliveryMode;
-
-      if($this->acl_is_writeable("faxtomail",$edit_mode)){
-        if (isset($_POST["faxtomail"]) && $_POST["faxtomail"] == 1){  
-          $tmp |= 32;
-        }elseif($tmp & 32){
-          $tmp &= (!32);
-        }
-      }
-      if($this->acl_is_writeable("faxtoprinter",$edit_mode)){
-        if (isset($_POST["faxtoprinter"]) && $_POST["faxtoprinter"] == 1){  
-          $tmp |= 64;
-        }elseif($tmp & 64){
-          $tmp &= !64;
-        }
-      }
-      $this->goFaxDeliveryMode = $tmp;
-
-      if($this->acl_is_writeable("goFaxIsEnabled",$edit_mode)){
-        if (isset($_POST["goFaxIsEnabled"]) && $_POST["goFaxIsEnabled"] == "1"){
-          $this->goFaxIsEnabled= "0";
-        } else {
-          $this->goFaxIsEnabled= "1";
-        }
-      }
-
-    
-      if (isset($_POST['mail']) && $this->acl_is_writeable("faxtomail",$edit_mode)){
-        $this->mail= $_POST['mail'];
-      }
-
-      /* Check if mail account is active and correct the internal
-         reference to represent the current status. */
-      if(isset($this->parent)){
-        if (isset($this->parent->by_object['mailAccount']->is_account)&&($this->parent->by_object['mailAccount']->is_account)){
-          $this->has_mailAccount= TRUE;
-        }
-      }
-    }
-
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    plugin::save();
-
-    /* Save arrays */
-    foreach (array("goFaxRBlocklist", "goFaxRBlockgroups", "goFaxSBlocklist",
-          "goFaxSBlockgroups", "facsimileAlternateTelephoneNumber") as $val){
-
-      $this->attrs[$val]= $this->$val;
-    }
-
-    if(!$this->attrs['goFaxDeliveryMode']){
-      $this->attrs['goFaxDeliveryMode'] = 0;
-    }
-  
-    /* Do not save mail address ... it was possibly changed by mail plugin */
-    /* Adapt mail settings if needed */
-    if ((isset($this->parent->by_object['mailAccount']->is_account)) && ($this->parent->by_object['mailAccount']->is_account)){
-      unset($this->attrs['mail']);
-    }
-
-    /* Write back to ldap */
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd($this->dn);
-    $this->cleanup();
-    $ldap->modify ($this->attrs); 
-
-    /* Log last action */
-    if($this->initially_was_account){
-      new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }else{
-      new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }
-
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/fax account 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("mofidy",array("uid" => $this->uid));
-      }
-    } else {
-      $this->handle_post_events("add",array("uid" => $this->uid));
-    }
-
-  }
-
-
-  /* Adapt from template, using 'dn' */
-  function adapt_from_template($dn)
-  {
-    plugin::adapt_from_template($dn);
-
-    foreach (array("goFaxRBlocklist", "goFaxRBlockgroups", "goFaxSBlocklist",
-          "goFaxSBlockgroups", "facsimileAlternateTelephoneNumber") as $val){
-
-      if (isset($this->attrs[$val])){
-        $this->$val= $this->attrs[$val];
-      }
-    }
-  }
-
-
-
-  /* Add alternate fax recipient */
-  function addAlternate($number)
-  {
-    $this->facsimileAlternateTelephoneNumber[]= "$number";
-    $this->facsimileAlternateTelephoneNumber=
-      array_unique ($this->facsimileAlternateTelephoneNumber);
-
-    sort ($this->facsimileAlternateTelephoneNumber);
-    reset ($this->facsimileAlternateTelephoneNumber);
-  }
-
-  function delAlternate($numbers)
-  {
-    $this->facsimileAlternateTelephoneNumber= array_remove_entries ($numbers,
-        $this->facsimileAlternateTelephoneNumber);
-  }
-
-  function getCopyDialog()
-  {
-    $str    = "";
-    $smarty = get_smarty();
-    $smarty->assign("facsimileTelephoneNumber", $this->facsimileTelephoneNumber);
-    $str['string']   = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE,dirname(__FILE__)));
-    $str['status'] ="";
-    return($str);
-  }
-
-  function SaveCopyDialog()
-  {
-    if(isset($_POST['facsimileTelephoneNumber'])){
-      $this->facsimileTelephoneNumber = $_POST['facsimileTelephoneNumber'];
-    }
-  }
-
-
-  /* Return plugin informations for acl handling 
-      #FIXME some attributes are still missing in this plugin acls */
-  static function plInfo()
-  {
-    return (array(  
-          "plShortName"     => _("Fax"),
-          "plDescription"   => _("Fax account settings"),
-          "plSelfModify"    => TRUE,
-          "plDepends"       => array("user"),
-          "plPriority"      => 6,             
-          "plSection"       => "personal",  
-          "plCategory"      => array("users"),
-          "plOptions"       => array(),
-
-          "plProvidedAcls"  => array(
-            "goFaxIsEnabled"                    => _("Enable/Disable fax"),
-            "goFaxRBlocklist"                   => _("Receive blocklist"),
-            "goFaxSBlocklist"                   => _("Send blocklist"),
-            "facsimileTelephoneNumber"          => _("Fax number"), // goFaxDeliveryMode
-            "facsimileAlternateTelephoneNumber" => _("Alternate fax number"), // goFaxDeliveryMode
-            "faxtomail"                         => _("Deliver fax as mail"),
-            "faxtoprinter"                      => _("Deliver fax to printer"),
-            "goFaxFormat"                       => _("Delivery format"),
-            "goFaxLanguage"                     => _("Language"))
-          ));
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/gofax/faxaccount/generic.tpl b/plugins/gofax/faxaccount/generic.tpl
deleted file mode 100644 (file)
index cb56a6c..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding="0" border="0">
-
- <!-- Headline container -->
- <tr>
-   <td style="width:50%; vertical-align:top;">
-     <h2><img class="center" alt="" align="middle" src="images/rightarrow.png" />&nbsp;{t}Generic{/t}</h2>
-
-     <table summary="">
-       <tr>
-         <td><label for="facsimileTelephoneNumber">{t}Fax{/t}</label>{$must}</td>
-         <td>
-
-{render acl=$facsimileTelephoneNumberACL}
-           <input name="facsimileTelephoneNumber" id="facsimileTelephoneNumber" size=20 maxlength=65
-               value="{$facsimileTelephoneNumber}" title="{t}Fax number for GOfax to trigger on{/t}">
-{/render}
-
-         </td>
-       </tr>
-       <tr>
-         <td><label for="goFaxLanguage">{t}Language{/t}</label></td>
-        <td>
-
-{render acl=$goFaxLanguageACL}
-           <select size="1" name="goFaxLanguage" id="goFaxLanguage" 
-               title="{t}Specify the GOfax communication language for fax to mail gateway{/t}">
-                       {html_options options=$languages selected=$goFaxLanguage}
-           </select>
-{/render}
-
-         </td>
-       </tr>
-       <tr>
-         <td><label for="goFaxFormat">{t}Delivery format{/t}</label></td>
-         <td>
-
-{render acl=$goFaxFormatACL}
-           <select id="goFaxFormat" size="1" name="goFaxFormat" title="{t}Specify delivery format for fax to mail gateway{/t}">
-           {html_options values=$formats output=$formats selected=$goFaxFormat}
-           </select>
-{/render}
-         </td>
-       </tr>
-     </table>
-     
-   </td>
-   <td style="border-left:1px solid #A0A0A0">
-    &nbsp;
-   </td>
-   <td style="vertical-align:top; width:100%">
-     <h2><img class="center" alt="" align="middle" src="images/printer.png" />&nbsp;{t}Delivery methods{/t}</h2>
-
-{render acl=$goFaxIsEnabledACL}
-     <input type=checkbox name="goFaxIsEnabled" value="1" {$goFaxIsEnabled}>
-{/render}
-     {t}Temporary disable fax usage{/t}<br>
-
-     {if $has_mailaccount eq "false"}
-{render acl=$faxtomailACL}
-     <input type=checkbox name="faxtomail" value="1" {$faxtomail}>
-{/render}
-      <label for="mail">{t}Deliver fax as mail to{/t}</label>&nbsp;
-{render acl=$faxtomailACL}
-      <input name="mail" id="mail" size=25 maxlength=65 value="{$mail}">
-{/render}
-     {else}
-{render acl=$faxtomailACL}
-     <input type=checkbox name="faxtomail" value="1" {$faxtomail}>
-{/render}
-      {t}Deliver fax as mail{/t}
-     {/if}
-     <br>
-
-{render acl=$faxtoprinterACL}
-     <input type=checkbox name="faxtoprinter" value="1" {$faxtoprinter}>
-{/render}
-     {t}Deliver fax to printer{/t}&nbsp;
-{render acl=$faxtoprinterACL}
-     <select size="1" name="goFaxPrinter">
-      {html_options options=$printers selected=$goFaxPrinter}
-               <option disabled>&nbsp;</option>
-     </select>
-{/render}
-   </td>
- </tr>
-</table>
-
-<p class="seperator">&nbsp;</p>
-
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4 border=0>
-  <tr>
-    <td style="width:50%; border-right:1px solid #A0A0A0">
-    <h2><img class="center" alt="" align="middle" src="images/fax_small.png">&nbsp;{t}Alternate fax numbers{/t}</h2>
-{render acl=$facsimileAlternateTelephoneNumberACL}
-    <select style="width:100%" name="alternate_list[]" size="10" multiple>
-                       {html_options values=$facsimileAlternateTelephoneNumber output=$facsimileAlternateTelephoneNumber}
-                       <option disabled>&nbsp;</option>
-    </select>
-{/render}
-    <br>
-{render acl=$facsimileAlternateTelephoneNumberACL}
-    <input name="forward_address" size=20 align="middle" maxlength=65 value="">
-{/render}
-{render acl=$facsimileAlternateTelephoneNumberACL}
-    <input type=submit value="{t}Add{/t}" name="add_alternate">&nbsp;
-{/render}
-{render acl=$facsimileAlternateTelephoneNumberACL}
-    <input type=submit value="{t}Add local{/t}" name="add_local_alternate" >&nbsp;
-{/render}
-{render acl=$facsimileAlternateTelephoneNumberACL}
-    <input type=submit value="{t}Delete{/t}" name="delete_alternate">
-{/render}
-   </td>
-   <td style="vertical-align:top; width:50%">
-      <h2><img class="center" alt="" align="middle" src="images/false.png" />&nbsp;{t}Blocklists{/t}</h2>
-      <table summary="" style="width:100%">
-        <tr>
-          <td>{t}Blocklists for incoming fax{/t}</td>
-          <td>
-{render acl=$goFaxRBlocklistACL}
-            <input type=submit name="edit_incoming" value="{t}Edit{/t}">
-{/render}
-          </td>
-        </tr>
-        <tr>
-          <td>{t}Blocklists for outgoing fax{/t}</td>
-          <td>
-{render acl=$goFaxSBlocklistACL}
-            <input type=submit name="edit_outgoing" value="{t}Edit{/t}">
-{/render}
-          </td>
-        </tr>
-      </table>
-    </td>
-  </tr>
-</table>
-
-<input type="hidden" name="faxTab" value="faxTab">
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('facsimileTelephoneNumber');
-  -->
-</script>
diff --git a/plugins/gofax/faxaccount/lists.tpl b/plugins/gofax/faxaccount/lists.tpl
deleted file mode 100644 (file)
index 5817e6c..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4 border=0>
- <tr>
-  <td style="vertical-align:top;width:50%;border-right:1px solid #A0A0A0"> 
-   <b>{t}Blocked numbers/lists{/t}</b>
-   <br> 
-   <select style="width:100%; height:300px;" name="block_list[]" size=15 multiple>
-           {html_options values=$cblocklist output=$cblocklist}
-               <option disabled>&nbsp;</option>
-   </select>
-   <br>
-   <input name="block_number" size=25 align="middle" maxlength=30 value="">
-   <input type=submit value="{t}Add{/t}" name="add_blocklist_number" >&nbsp;
-   <input type=submit value="{t}Delete{/t}" name="delete_blocklist_number" >
-  </td>
-  <td>
-       <b>{t}List of predefined blocklists{/t}</b><br>
-       <table style="width:100%;height:300px;" summary="">
-               <tr>
-                       <td valign="top">
-                                       {$divSelectPredefined}
-                       </td>
-               </tr>
-       </table>
-   <input type=submit value="{t}Add the list to the blocklists{/t}" name="add_blocklist"><br>
-  </td>
- </tr>
-</table>
-
-<p class="plugbottom">
-  <input type=submit name="edit_blocklists_finish" value="{t}Apply{/t}">
-  &nbsp;
-  <input type=submit name="edit_blocklists_cancel" value="{t}Cancel{/t}">
-</p>
-
diff --git a/plugins/gofax/faxaccount/locals.tpl b/plugins/gofax/faxaccount/locals.tpl
deleted file mode 100644 (file)
index ebf9a89..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
-<tr>
-  <td style="vertical-align:top; width:600px">
-   <div class="contentboxh" style="height:20px;">
-    <p class="contentboxh" style="font-size:12px">
-     <b>{t}Select numbers to add{/t} {$hint}</b><br>
-    </p>
-   </div>
-   <div class="contentboxb">
-    <p class="contentboxb" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-     <select style="width:100%; margin-top:4px; height:450px;" name="local_list[]" size="15" multiple>
-       {html_options options=$list}
-     </select>
-    </p>
-   </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"  style="background-color:#F8F8F8">
-     <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>
-                               <img class="center" alt="" src="{$tree_image}" align="middle" title="{t}Display numbers of department{/t}">&nbsp;
-                               <select name="depselect" size="1" onChange="mainform.submit()" title="{t}Choose the department the search will be based on{/t}">
-                             {html_options options=$deplist selected=$depselect}
-                           </select>
-                       </td>
-               </tr>
-       </table>
-    <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-               <tr>
-                       <td width="18">
-                               <img class="center" alt="" src="{$search_image}" align="middle" title="{t}Display numbers matching{/t}">
-                       </td>
-               <td>
-                               <input type='text' name='regex' maxlength='20' value='{$regex}' style="width:99%" title='{t}Regular expression for matching numbers{/t}' onChange="mainform.submit()">  </td>
-               </tr>
-       </table>
-    <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-               <tr>
-                       <td width="18">
-                               <img class="center" alt="" src="{$usearch_image}" align="middle" title="{t}Display numbers of user{/t}">
-                       </td>
-                   <td>
-                               <input type='text' name='fuser' style="width:99%" maxlength='20' value='{$fuser}' title='{t}User name of which numbers are shown{/t}' onChange="mainform.submit()">     </td>
-               </tr>
-       </table>
-   {$apply}
-   </div>
-  </td>
-</tr>
-</table>
-
-<p class="plugbottom">
-  <input type=submit name="add_locals_finish" value="{t}Add{/t}">
-  &nbsp;
-  <input type=submit name="add_locals_cancel" value="{t}Cancel{/t}">
-</p>
-
diff --git a/plugins/gofax/faxaccount/main.inc b/plugins/gofax/faxaccount/main.inc
deleted file mode 100644 (file)
index d2786d8..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-<?php
-
-$display  ="";
-$lock_msg = "";
-
-if (!$remove_lock){
-
-       /* Reset requested? */
-       if (isset($_POST['edit_cancel']) ||
-               (isset($_GET['reset']) && $_GET['reset'] == 1)){
-
-               del_lock ($ui->dn);
-               sess_del ('edit');
-               sess_del ('gofaxAccount');
-       }
-
-       /* Create gofaxAccount object on demand */
-       if (!isset($_SESSION['gofaxAccount']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
-               $_SESSION['gofaxAccount']= new gofaxAccount ($config, $ui->dn);
-               $_SESSION['gofaxAccount']->set_acl_base($ui->dn);
-               $_SESSION['gofaxAccount']->set_acl_category("users");
-
-       }
-       $gofaxAccount= $_SESSION['gofaxAccount'];
-
-       /* save changes back to object */
-       if (isset ($_SESSION['edit'])){
-               $gofaxAccount->save_object ();
-       }
-
-       /* Enter edit mode? */
-       if (isset($_POST['edit'])){
-
-               /* Check locking */
-               if (($username= get_lock($ui->dn)) != ""){
-                       $_SESSION['back_plugin']= $plug;
-                       $_SESSION['LOCK_VARS_TO_USE'] = array("/^edit$/","/^plug$/");
-                       $lock_msg =  gen_locked_message ($username, $ui->dn);
-
-               }else{
-
-                       /* Lock the current entry */
-                       add_lock ($ui->dn, $ui->dn);
-                       $_SESSION['dn']= $ui->dn;
-                       $_SESSION['edit']= TRUE;
-               }
-       }
-
-       /* save changes to LDAP and disable edit mode */
-       if (isset($_POST['edit_finish'])){
-
-                /* Perform checks */
-                $message= $gofaxAccount->check ();
-
-                /* No errors, save object */
-                if (count ($message) == 0){
-                        $gofaxAccount->save ();
-                        del_lock ($ui->dn);
-                        sess_del ('edit');
-
-                } else {
-                        /* Errors found, show message */
-                        show_errors ($message);
-                }
-        }
-
-       /* Execute formular */
-       if($lock_msg){
-               $display.= $lock_msg;
-       }else{
-               $display.= $gofaxAccount->execute ();
-       }
-
-       $info= "";
-
-       /* Store changes  in session */
-       if (isset ($_SESSION['edit'])){
-               $_SESSION['gofaxAccount']= $gofaxAccount;
-       }
-
-       /* Show page footer depending on the mode */
-       if (!$gofaxAccount->locals_dialog &&
-               !$gofaxAccount->out_blocklist_dialog &&
-               !$gofaxAccount->in_blocklist_dialog &&
-               $gofaxAccount->is_account       && 
-               empty($lock_msg)){
-
-               $display.= "<p class=\"plugbottom\">\n";
-
-               /* Are we in edit mode? */
-               if (isset($_SESSION['edit'])){
-                       $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
-                       $display.= "&nbsp;\n";
-                       $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
-                       $info= "<img alt='' align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".$ui->dn."&nbsp;";
-               } else {
-                       $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/openlock.png')."\"> ".$ui->dn."&nbsp;";
-
-                       if(preg_match("/w/",$ui->get_permissions($ui->dn,"users/gofaxAccount"))){
-                               $info.= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/lamp.png')."\">"._("Click the 'Edit' button below to change informations in this dialog");
-                               $display.= "<input type=submit name=\"edit\" value=\""._("Edit")."\">";
-                       }
-                       $display.= "<input type=\"hidden\" name=\"ignore\">\n";
-               }
-               $display.= "</p>";
-       }
-       
-       /* Page header*/
-       $display= print_header(get_template_path('images/fax.png'), _("FAX settings"), $info).$display;
-
-}
-?>
diff --git a/plugins/gofax/faxaccount/paste_generic.tpl b/plugins/gofax/faxaccount/paste_generic.tpl
deleted file mode 100644 (file)
index 6efca1d..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding="0" border="0">
-       <tr>
-               <td style="width:50%; vertical-align:top;">
-               <h2><img class="center" alt="" align="middle" src="images/rightarrow.png" />&nbsp;{t}Generic{/t}</h2>
-               <table summary="">
-                               <tr>
-                               <td>
-                                       <label for="facsimileTelephoneNumber">{t}Fax{/t}</label>{$must}
-                               </td>
-                               <td>
-                                       <input name="facsimileTelephoneNumber" id="facsimileTelephoneNumber" 
-                                                       size=40 maxlength=65 value="{$facsimileTelephoneNumber}" 
-                                                       title="{t}Fax number for GOfax to trigger on{/t}">
-                               </td>
-                               </tr>
-                        <tr>
-                                <td colspan=2>
-                                      {t}Alternate fax numbers will not be copied{/t}
-                                </td>
-                        </tr>
-
-                       </table>
-               </td>
-       </tr>
-</table>
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('facsimileTelephoneNumber');
-  -->
-</script>
diff --git a/plugins/gofax/faxreports/class_faxreport.inc b/plugins/gofax/faxreports/class_faxreport.inc
deleted file mode 100644 (file)
index 41e0fc4..0000000
+++ /dev/null
@@ -1,507 +0,0 @@
-<?php
-
-class faxreport extends plugin
-{
-  /* Definitions */
-  var $plHeadline     = "FAX Reports";
-  var $plDescription  = "This does something";
-
-  /* For internal use */
-  var $start          = 0;
-  var $search_for     = "*";
-  var $search_base    = "";
-  var $year           = "";
-  var $month          = "";
-  var $sort           = 1;
-  var $sort_direction = "down";
-  var $report_list    = array();
-  var $ui             = NULL;
-  var $range          = 20;
-  var $view_logged = FALSE;
-
-  /* Constant stuff */
-  var $status= array( "SENT", "MAILED", "SERROR", "RERROR", "SBLOCK", "RBLOCK",
-      "DELETED", "REQUEUED", "DISABLED", "PRINTED", "DIVERTED",
-      "UNDEFINED", "UNDEFINED", "UNDEFINED", "UNDEFINED",
-      "UNDEFINED");
-  var $fields= array("uid", "queuing_time", "status", "sender_id", "receiver_id", "pages");
-
-  /* these vars will be stored in session to be able to remember last search config */
-  var $attributes_SO= array("search_for","search_base","month","year","start","year","month","sort","sort_direction","range");
-  var $objectclasses= array();
-  var $fax_users    = array();
-
-
-  /* Create class */
-  function faxreport (&$config, &$ui)
-  {
-    /* Include config object */
-    $this->config       = $config;
-    $this->ui           = &$ui;
-    $this->search_base  = get_base_from_people($ui->dn);
-    $this->year         = date("Y");
-    $this->month        = date("m");
-
-    /* Get global filter config and set class vars , 
-       or create a filter */
-    if (!is_global("faxreportfilter")){
-      $faxreportfilter = array();
-      foreach($this->attributes_SO as $name){
-        $faxreportfilter[$name] = $this->$name;
-      } 
-      register_global("faxreportfilter",$faxreportfilter);
-    }else{
-      $faxreportfilter = get_global("faxreportfilter");
-      foreach($this->attributes_SO as $name){
-        $this->$name = $faxreportfilter[$name];
-      }
-    }
-  }
-
-  
-  /* Create Filter & Search & Display results */
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* Log view */
-    if(!$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","users/".get_class($this),$this->dn);
-    }
-
-    /************ 
-      Variable initialisation 
-     ************/
-    /* Create months */ 
-    $months= array();
-    for($i = 1 ; $i <= 12 ; $i ++ ){
-      $months[$i] = _(date("F",gmmktime(0,0,0,$i,1)));
-    }
-
-    /* Create years */
-    $current= date("Y");
-    $years= array();
-    for ($y= $current - 5; $y<=$current; $y++){
-      $years[]= $y;
-    }
-
-    
-    /************ 
-      Set smarty defaults  
-     ************/
-
-    $smarty= get_smarty();
-    $smarty->assign("launchimage"              , get_template_path('images/launch.png'));
-    $smarty->assign("search_image"  , get_template_path('images/search.png'));
-    $smarty->assign("search_for"               , $this->search_for);
-    $smarty->assign("bases"                              , $this->config->idepartments);
-    $smarty->assign("base_select"              , $this->search_base);
-    $smarty->assign("months"                     , $months);
-    $smarty->assign("month_select"     , $this->month);
-    $smarty->assign("years"                              , $years);
-    $smarty->assign("year_select"              , $this->year);
-    $smarty->assign("search_result"    , "");
-
-    
-    /************ 
-      Check database accessibility 
-     ************/
-
-    /* Some checks */
-    if(!isset($this->config->data['SERVERS']['FAX'])){
-      print_red(_("No fax extension defined in your server configuration, no reports can be shown!"));
-      return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
-    }elseif(!is_callable("mysql_connect")){
-      print_red(_("There is no mysql extension available, please check your php setup."));
-      return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
-    }else{
-      /* Connecting, selecting database */
-      $cfg     = $this->config->data['SERVERS']['FAX'];
-      $link    = @mysql_pconnect($cfg['SERVER'], $cfg['LOGIN'], $cfg['PASSWORD']);
-      if ($link === FALSE){
-        print_red(_("Can't connect to fax database, no reports can be shown!"));
-        return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
-      }
-      if (! @mysql_select_db("gofax")){
-        print_red(_("Can't select fax database for report generation!"));
-        return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
-      }
-
-      if (! mysql_query("SELECT * FROM faxlog;")){
-        print_red(_("Can't query fax table 'faxlog' for report generation!"));
-        return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
-      }
-    }          
-
-    
-    /************ 
-      Perform a deatil view 
-     ************/
-
-    /* Do detail view? */
-    if (isset($_GET['detail'])){
-
-      /* Create query */
-      $query = "SELECT id,uid,date_format(queuing_time, '%Y%m%d%H%i%s') as queuing_time,status,sender_id,sender_msn,receiver_id,".
-        "receiver_msn,pages,status_message,transfer_time FROM faxlog WHERE id=".$_GET['detail'].";";
-
-      /* Connecting, selecting database */
-      $cfg= $this->config->data['SERVERS']['FAX'];
-
-      /* Check if everything went ok*/
-      $result = @mysql_query($query);
-      if ($result === false){
-        print_red(_("Query for fax database failed!"));
-        @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query, "Database query failed");
-        return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
-      }
-
-      $line = mysql_fetch_array($result, MYSQL_ASSOC);
-      mysql_close($link);
-
-      if (!preg_match ("/'".$line["uid"]."'/", $this->userfilter)){
-        print_red (_("You have no permission to retrieve informations about this fax id!"));
-        return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
-      }
-
-      /* Check acls */
-      $fax_uids = array_flip($this->fax_users);
-      $uid = $line['uid'];
-      $dn = $fax_uids[$uid];
-      $acls = $this->ui->get_permissions($dn,"faxreport/faxreport");
-      if(!preg_match("/r/",$acls)){
-        print_red (_("You have no permission to retrieve informations about this fax id!"));
-        return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
-      }
-
-      $parts= array( "id", "uid", "queuing_time", "status", "sender_id", "sender_msn",
-          "receiver_id", "receiver_msn", "pages", "status_message", "transfer_time" );
-
-      foreach ($parts as $vname) {
-
-        $final="fax_$vname";
-        if($vname != "uid"){
-          $v_acl = $this->ui->get_permissions($dn,"faxreport/faxreport",preg_replace("/_/","",$vname));
-        }else{
-          $v_acl = "r";
-        }
-
-        if ($line[$vname] != "" && preg_match("/r/",$v_acl)){
-          $smarty->assign("$final", $line[$vname]);
-        } else {
-          $smarty->assign("$final", "-");
-        }
-      }
-      $queuing_time= $line['queuing_time'];
-
-      /* The user is allowed to download all fax images from those users 
-          that are listed in $_SESSION['fuserfilter'] 
-         Don't forget to check getfax.php if you change somthing here */
-      $_SESSION['fuserfilter']= $this->userfilter;
-      $smarty->assign("plug", "?plug=".validate($_GET['plug']));
-      $smarty->assign("detail", validate($_GET['detail']));
-
-      $format= _("Y-M-D");
-      $date= preg_replace("/Y/", substr($queuing_time,0,4), $format);
-      $date= preg_replace("/M/", substr($queuing_time,4,2), $date);
-      $date= preg_replace("/D/", substr($queuing_time,6,2), $date);
-      $smarty->assign("date", $date);
-      $smarty->assign("time", substr($queuing_time,8,2).":".
-          substr($queuing_time,10,2).":".
-          substr($queuing_time,12,2));
-      return($smarty->fetch(get_template_path('detail.tpl', TRUE)));
-    }
-
-    
-    /************ 
-      Search for uids matching the filter  
-     ************/
-
-    /* Search button has been pressed */
-    if ($this->search_for != ""){
-
-      if (is_integer (strpos($this->search_for, "*"))){
-        $s= $this->search_for;
-      } else {
-        $s= "*".$this->search_for."*";
-      }
-      $ldap= $this->config->get_ldap_link();
-      $ldap->cd ($this->search_base);
-
-      /* Perform ldap search for potential users */
-      $filter= "(&(objectClass=gosaAccount)(!(objectClass=gosaUserTemplate))".
-          "(objectClass=goFaxAccount)".
-          "(|(uid=$s)(l=$s)(homePhone=$s)".
-          "(telephoneNumber=$s)(facsimileTelephoneNumber=$s)(mobile=$s)".
-          "(pager=$s)(cn=$s)(givenName=$s)(sn=$s)(personalTitle=$s)".
-          "(title=$s)))";
-  
-      $res = get_list($filter, "users", $this->search_base, array("uid"), GL_SUBSEARCH );
-
-      /* Check if we are allowed to collect fax data */
-      $fax_users= array();
-      foreach($res as $attrs){
-        $acl = $this->ui->get_permissions($attrs['dn'],"users/user","uid");
-        if(preg_match("/r/",$acl)){
-          $fax_users[ $attrs['dn']]= $attrs["uid"][0];
-        }
-      }
-
-      $this->fax_users = $fax_users;
-
-      /* Prepare SQL query */
-      $this->userfilter= "";
-      foreach ($fax_users as $user){
-        $this->userfilter.= "uid = '$user' OR ";
-      }
-      $this->userfilter= preg_replace("/OR $/", "", $this->userfilter);
-    }
-
-    /************ 
-      Create filter  
-     ************/
-
-    /* Perform SQL query */
-    if ($this->userfilter){
-      if ($this->sort_direction == "down"){
-        $desc= "DESC";
-      } else {
-        $desc= "";
-      }
-      $start= date ("YmdHis", mktime(0,0,0,$this->month,1,$this->year));
-      $end=   date ("YmdHis", mktime(23,59,59,$this->month+1,0,$this->year));
-      $query = "SELECT id,uid,date_format(queuing_time, '%Y%m%d%H%i%s') as queuing_time,status,sender_id,receiver_id,pages FROM faxlog ".
-        "WHERE ( ".$this->userfilter." ) AND queuing_time <= $end AND ".
-        "queuing_time >= $start ORDER BY ".$this->fields[$this->sort]." $desc;";
-
-      if(!is_callable("mysql_connect")){
-        print_red("There is no mysql extension configured in your php setup.");
-        return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
-      }
-
-    
-    /************ 
-      Create results  
-     ************/
-
-      /* Connecting, selecting database */
-      $cfg= $this->config->data['SERVERS']['FAX'];
-      $link = @mysql_pconnect($cfg['SERVER'], $cfg['LOGIN'], $cfg['PASSWORD']);
-      
-      @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query, "Database query");
-      $result = @mysql_query($query);
-      if ($result === false){
-        print_red(_("Query for fax database failed!"));
-        return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
-      }
-
-      $this->report_list= array();
-      $user_ids = array_flip($fax_users);
-      while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
-
-        /* Check permissions for each field */
-        $dn = $user_ids[$line['uid']];
-
-        /* Hide restricted attributes */ 
-        foreach(array("pages","receiverid","senderid","status","queuingtime","detailedView") as $attr){
-          $var = $attr."ACL";
-          $$var = $this->ui->get_permissions($dn,"faxreport/faxreport",$attr);
-        }
-
-        /* Restricted attributes will not be displayed, this will be displayed instead */
-        $no_acl = "<img class='center' src='images/closedlock.png' 
-                    title='"._("Insufficient permissions to view this attribute")."' alt='"._("Insufficient permissions")."'>";
-
-        /* Create date */ 
-        if((!empty($line["queuing_time"])) && preg_match("/r/",$queuingtimeACL)){
-          $hour=  substr($line["queuing_time"], 8, 2);
-          $minute=substr($line["queuing_time"], 10, 2);
-          $format= _("Y-M-D");
-          $date= preg_replace("/Y/", substr($line["queuing_time"], 0, 4), $format);
-          $date= preg_replace("/M/", substr($line["queuing_time"], 4, 2), $date);
-          $date= preg_replace("/D/", substr($line["queuing_time"], 6, 2), $date);
-          $str_date = $date." ".$hour.":".$minute;
-        }else{
-          $str_date = $no_acl;
-        }
-  
-        /* Create entry html str */
-
-        if(preg_match("/r/",$detailedViewACL)){
-          $str = "<td class=\"phonelist\">
-            <a href=\"main.php?plug=".validate($_GET['plug'])."&amp;detail=".$line["id"]."\">
-            <img class='center' alt=\"\" align=\"middle\" border=0 src=\"".get_template_path('images/info_small.png')."\">
-            &nbsp;".$line["uid"].
-            "</a>
-            </td>
-            <td>$str_date</td>";
-        }else{
-          $str = "<td>
-            <img class='center' alt=\"\" align=\"middle\" border=0 src=\"".get_template_path('images/info_small.png')."\">
-            &nbsp;".$line["uid"]."</td>
-            <td>$str_date</td>";
-        }
-        
-        /* Add Status td */
-        if(preg_match("/r/",$statusACL)){
-          $str.="<td>".$this->status[$line["status"]]."</td>";
-        }else{
-          $str.="<td>".$no_acl."</td>";
-        }
-
-        /* Add sender_id td */
-        if(preg_match("/r/",$senderidACL)){
-          $str.="<td>".$line["sender_id"]."</td>";
-        }else{
-          $str.="<td>".$no_acl."</td>";
-        }
-
-        /* Add receiver_id td */
-        if(preg_match("/r/",$receiveridACL)){
-          $str.="<td>".$line["receiver_id"]."</td>";
-        }else{
-          $str.="<td>".$no_acl."</td>";
-        }
-
-        /* Add receiver_id td */
-        if(preg_match("/r/",$pagesACL)){
-          $str.="<td>".$line["pages"]."</td>";
-        }else{
-          $str.="<td>".$no_acl."</td>";
-        }
-      $this->report_list[] =  $str;
-      }
-
-      mysql_close($link);
-    }
-
-    /************ 
-      Create output out of results  
-     ************/
-
-    /* Generate output */
-    $mod= 0;
-    $output= "";
-    foreach ($this->report_list as $val){
-      if ($mod < $this->start) {
-        $mod++;
-        continue;
-      }
-      if ($mod >= ($this->start + $this->range)){
-        $mod++;
-        break;
-      }
-      if ( ($mod++) & 1){
-        $col= "background-color: #ECECEC;";
-      } else {
-        $col= "background-color: #F5F5F5;";
-      }
-      $output.= "<tr style=\"height:22px; $col\">$val</tr>";
-    }
-
-    
-    /************ 
-      Display results  
-     ************/
-
-    if (isset($fax_users) && count($fax_users)){
-      $smarty->assign("search_result", $output);
-      $smarty->assign("range_selector", range_selector(count($this->report_list), $this->start, $this->range,"EntriesPerPage"));
-    }else{
-      $smarty->assign("search_result", "");
-    }
-
-    /* Show main page */
-    $smarty->assign("plug", "?plug=".validate($_GET['plug']));
-    for($i= 0; $i<7; $i++){
-      $smarty->assign("mode$i", "");
-    }
-    $smarty->assign("mode".$this->sort, "<img alt=\"\" src=\"images/sort_".$this->sort_direction.
-        ".png\" border=0 align=middle>");
-    return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
-  }
-
-
-  /* Save ui input, and store it in $_SESSION 
-     to remember last search next time*/
-  function save_object()
-  {
-    $faxreportfilter = get_global("faxreportfilter");
-    if(isset($_POST['EntriesPerPage'])){
-      $this->range = $_POST['EntriesPerPage'];
-    }
-
-    if (isset($_GET['start'])){
-      $this->start= (int)$_GET['start'];
-    }
-
-    /* Adapt sorting */
-    if (isset($_GET['sort'])){
-      if ($this->sort == (int)$_GET['sort']){
-        if ($this->sort_direction == "down"){
-          $this->sort_direction= "up";
-        } else {
-          $this->sort_direction= "down";
-        }
-      }
-      $this->sort= (int)$_GET['sort'];
-      if ($this->sort < 0 || $this->sort > 5){
-        $this->sort= 0;
-      }
-    }
-    foreach( array("year", "month", "search_for", "search_base") as $type){
-      if (isset($_POST[$type])){
-        $faxreportfilter[$type]= $_POST[$type];
-
-        /* reset start page, if filter has changed */ 
-        if(!isset($_GET['start'])){
-          $this->start = 0;
-        }
-      }
-      $this->$type= $faxreportfilter[$type];
-   
-    }
-    foreach($this->attributes_SO as $name){
-      $faxreportfilter[$name] = $this->$name;
-    }  
-    register_global("faxreportfilter",$faxreportfilter);
-  }
-
-
-  /* Return plugin informations for acl handling
-    #FIXME You can only read attributes within this report plugin */
-  static function plInfo()
-  {
-  
-    return (array(
-          "plShortName"     => _("Fax report"),
-          "plDescription"   => _("Fax report")."&nbsp;<i>"._("All entries are readonly")."</i>",
-          "plSelfModify"    => TRUE,
-          "plDepends"       => array(),
-          "plPriority"      => 1,                                 // Position in tabs
-          "plSection"       => array("administration"),                     // This belongs to personal
-          "plCategory"      => array("faxreport" => array("description" => _("Fax reports"),
-                                                         "objectClass" => array())),
-          "plOptions"       => array(),
-
-          "plProvidedAcls" => array(
-            "detailedView"   => _("Detailed view"),
-            "id"             => _("Fax ID"),
-            "queuingtime"    => _("Date")."&nbsp;/&nbsp;"._("Time"),
-            "status"         => _("Status"),
-            "senderid"       => _("Sender ID"),
-            "sendermsn"      => _("Sender MSN"),
-            "receiverid"     => _("Receiver ID"),
-            "receivermsn"    => _("Receiver MSN"),
-            "pages"          => _("Number of pages"),
-            "statusmessage"  => _("Status Message"),
-            "transfertime"   => _("Transfer time"))
-        ));
-  }
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/gofax/faxreports/contents.tpl b/plugins/gofax/faxreports/contents.tpl
deleted file mode 100644 (file)
index 197c5b8..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-<div class="contentboxh">
- <p class="contentboxh"><img src="{$launchimage}" align="right" alt="[F]">{t}Filter{/t}</p>
-</div>
-<div class="contentboxb">
- <p class="contentboxb" style="border-top:1px solid #B0B0B0; padding-top:5px;">
- <img class="center" alt="" align="middle" border=0 src="{$search_image}">&nbsp;{t}Search for{/t}
- <input name="search_for" size=25 maxlength=60 value="{$search_for}" title="{t}Enter user name to search for{/t}" onChange="mainform.submit()">
- {t}in{/t}
- <select size="1" name="search_base" title="{t}Select subtree to base search on{/t}" onChange="mainform.submit()">
-  {html_options options=$bases selected=$base_select}
- </select>
- {t}during{/t}
- <select size="1" name="month" onChange="mainform.submit()">
-  {html_options options=$months selected=$month_select}
- </select>
- {t}in{/t} 
- <select size="1" name="year" onChange="mainform.submit()">
-  {html_options values=$years output=$years selected=$year_select}
- </select>
- &nbsp;
- <input type=submit name="search" value="{t}Search{/t}">
-</p>
-</div>
-
-<br>
-
-{if $search_result ne ""}
- <table summary="" style="width:100%; vertical-align:top; text-align:left; border:1px solid #B0B0B0;" cellpadding=2 cellspacing=1 border=0 rules="cols">
-  <tr style="background-color: #E8E8E8; height:26px; font-weight:bold">
-   <td><a href="main.php{$plug}&amp;sort=0">{t}User{/t} {$mode0}</a></td>
-   <td><a href="main.php{$plug}&amp;sort=1">{t}Date{/t} {$mode1}</a></td>
-   <td><a href="main.php{$plug}&amp;sort=2">{t}Status{/t} {$mode2}</a></td>
-   <td><a href="main.php{$plug}&amp;sort=3">{t}Sender{/t} {$mode3}</a></td>
-   <td><a href="main.php{$plug}&amp;sort=4">{t}Receiver{/t} {$mode4}</a></td>
-   <td><a href="main.php{$plug}&amp;sort=5">{t}# pages{/t} {$mode5}</a></td>
-  </tr>
-  {$search_result}
- </table>
-
- <table summary="" style="width:100%; vertical-align:top; text-align:center;" cellpadding=4 cellspacing=0 border=0>
-  <tr>
-   <td>{$range_selector}</td>
-  </tr>
- </table>
-<p class="plugbottom">
- &nbsp;
-</p>
-
-{else}
-  <b>{t}Search returned no results...{/t}</b>
-{/if}
-
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('search_for');
-  -->
-</script>
diff --git a/plugins/gofax/faxreports/detail.tpl b/plugins/gofax/faxreports/detail.tpl
deleted file mode 100644 (file)
index 20b6123..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-<table summary="">
- <tr>
-  <td> 
-   <a href="getfax.php?id={$detail}&amp;download=1">
-     <img  align="bottom" width="420" height="594" src="getfax.php?id={$detail}" alt="{t}FAX preview - please wait{/t}" border=1>
-   </a>
-   <p style="margin-top-width:0px; text-align:center;">
-    {t}Click on fax to download{/t}
-   </p>
-  </td>
-  <td style="width:20px;">
-    &nbsp;
-  </td>
-  <td style="vertical-align:top">
-    <table summary="" border=0 cellspacing=5>
-     <tr>
-      <td><b>{t}FAX ID{/t}</b></td>
-      <td>{$fax_id}</td>
-     </tr>
-     <tr>
-      <td><b>{t}User{/t}</b></td>
-      <td>{$fax_uid}</td>
-     </tr>
-     <tr>
-      <td><b>{t}Date / Time{/t}</b></td>
-      <td>{$date} / {$time}</td>
-     </tr>
-     <tr>
-      <td><b>{t}Sender MSN{/t}</b></td>
-      <td>{$fax_sender_msn}</td>
-     </tr>
-     <tr>
-      <td><b>{t}Sender ID{/t}</b></td>
-      <td>{$fax_sender_id}</td>
-     </tr>
-     <tr>
-      <td><b>{t}Receiver MSN{/t}</b></td>
-      <td>{$fax_receiver_msn}</td>
-     </tr>
-     <tr>
-      <td><b>{t}Receiver ID{/t}</b></td>
-      <td>{$fax_receiver_id}</td>
-     </tr>
-     <tr>
-      <td><b>{t}Status{/t}</b></td>
-      <td>{$fax_status}</td>
-     </tr>
-     <tr>
-      <td><b>{t}Status message{/t}</b></td>
-      <td>{$fax_status_message}</td>
-     </tr>
-     <tr>
-      <td><b>{t}Transfer time{/t}</b></td>
-      <td>{$fax_transfer_time}</td>
-     </tr>
-     <tr>
-      <td><b>{t}# pages{/t}</b></td>
-      <td>{$fax_pages}</td>
-     </tr>
-    </table>
-
-  </td>
- </tr>
-</table>
-
-<p class="plugbottom">
-  <input type=submit name="bck_to_list" value="{t}Back{/t}">
-</p>
-
diff --git a/plugins/gofax/faxreports/main.inc b/plugins/gofax/faxreports/main.inc
deleted file mode 100644 (file)
index ac80ff3..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-<?php
-
-if (!$remove_lock){
-       /* Create faxreport object on demand */
-       if (!isset($_SESSION['faxreport']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
-               $_SESSION['faxreport']= new faxreport ($config, $ui);
-       }
-       $faxreport= $_SESSION['faxreport'];
-
-       /* Execute formular */
-       $faxreport->save_object();
-       $display= $faxreport->execute ();
-       $display.= "<input type=\"hidden\" name=\"ignore\">\n";
-       $display= print_header(get_template_path('images/reports.png'), _("FAX reports")).$display;
-
-       /* Store changes  in session */
-       $_SESSION['faxreport']= $faxreport;
-}
-?>
diff --git a/plugins/gofon/conference/class_divListConferences.inc b/plugins/gofon/conference/class_divListConferences.inc
deleted file mode 100755 (executable)
index cdcdcbc..0000000
+++ /dev/null
@@ -1,317 +0,0 @@
-<?php
-
-class divListConference extends MultiSelectWindow
-{
-
-  /* Current base */
-  var $selectedBase       = "";
-  var $departments        = array();
-
-  /* Regex */
-  var $Regex              = "*";
-
-  /* checkboxes */
-  var $ShowSendBocklists      ;
-  var $ShowReceiveMacros  ;
-
-  /* Subsearch checkbox */
-  var $SubSearch;
-
-  var $parent             ;
-  var $ui                 ;
-
-  function divListConference (&$config,$parent)
-  {
-    MultiSelectWindow::MultiSelectWindow($config,"Conferences", "gofonconference");
-    
-    $this->parent       = $parent;
-    $this->ui           = get_userinfo();
-
-    /* Set list strings */
-    $this->SetTitle(_("List of conference rooms"));
-    $this->SetSummary(_("List of conference rooms"));
-
-    /* Result page will look like a headpage */
-    $this->SetHeadpageMode();
-    $this->SetInformation(_("This menu allows you to create, delete and edit selected phone conferences. Having a large number of phone conferences, you might prefer the range selectors on top of the conferences list."));
-
-    $this->EnableAplhabet(true);
-  
-    /* Disable buttonsm */
-    $this->EnableCloseButton(false);
-    $this->EnableSaveButton (false);
-
-    /* Dynamic action col, depending on snapshot icons */
-    $action_col_size = 100;
-    if($this->parent->snapshotEnabled()){
-      $action_col_size += 20;
-    }
-
-    /* Toggle all selected / deselected */
-    $chk = "<input type='checkbox' id='select_all' name='select_all'
-      onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
-
-    /* set Page header */
-    $this->AddHeader(array("string"=> $chk,          "attach"=>"style='width:20px;'"));
-    $this->AddHeader(array("string" => "&nbsp;", "attach" => "style='text-align:center;width:20px;'"));
-    $this->AddHeader(array("string" =>_("Name - Number"), "attach" => "style=''"));
-    $this->AddHeader(array("string" => _("Owner"), "attach" => "style='width:200px;'"));
-    $this->AddHeader(array("string" => _("PIN"), "attach" => "style='width:50px;'"));
-    $this->AddHeader(array("string" =>_("Actions"), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'"));
-
-    /* Add Checkboxes / SubSearch checkbox */
-    $this->AddCheckBox("SubSearch",  _("Select to search within subtrees"), _("Search in subtrees"), false);
-
-    /*                  Name                 ,Text                              ,Default  , Connect with alphabet  */
-    $this->AddRegex   ("Regex",      _("Regular expression for matching conference names"),"*" , true);
-  }
-
-
-  function GenHeader()
-  {
-    /* Prepare departments,
-       which are shown in the listbox on top of the listbox
-     */
-    $options= "";
-
-    /* Get all departments within this subtree */
-    $base = $this->config->current['BASE'];
-
-    /* Add base */
-    $tmp = array();
-    $tmp[] = array("dn"=>$this->config->current['BASE']);
-    $tmp=  array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
-                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
-
-    $deps = array();
-    foreach($tmp as $tm){
-      $deps[$tm['dn']] = $tm['dn'];
-    }
-  
-    /* Load possible departments */
-    $ui= get_userinfo();
-    $tdeps= $ui->get_module_departments("gofonconference");
-    $ids = $this->config->idepartments;
-    $first = "";
-    $found = FALSE;
-    foreach($ids as $dep => $name){
-      if(isset($deps[$dep]) && in_array_ics($dep, $tdeps)){
-
-        /* Keep first base dn in mind, we could need this
-         *  info if no valid base was found
-         */
-        if(empty($first)) {
-          $first = $dep['dn'];
-        }
-
-        $value = $ids[$dep];
-        if ($this->selectedBase == $dep){
-          $found = TRUE;
-          $options.= "<option selected='selected' value='".$dep."'>$value</option>";
-        } else {
-          $options.= "<option value='".$dep."'>$value</option>";
-        }
-      }
-    }
-
-    /* The currently used base is not visible with your acl setup.
-     * Set base to first useable base.
-     */
-    if(!$found){
-      $this->selectedBase = $first;
-    }
-
-    /* Get acls */
-    $acls     = $ui->get_permissions($this->selectedBase,"gofonconference/conference");
-    $acl_all  = $ui->has_complete_category_acls($this->selectedBase,"gofonconference") ;
-
-    /* Add default header */
-    $listhead = MultiSelectWindow::get_default_header();
-
-    /* Add the rest (base select ....)*/
-    $listhead .= _("Base")."&nbsp;<select name='CurrentMainBase' 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;";
-
-    /* Create Layers menu */
-    $s  = ".|"._("Actions")."|\n";
-    $s .= "..|<img src='images/list_new.png' alt='' border='0' class='center'>".
-      "&nbsp;"._("Create")."|\n";
-
-    /* Append create options */
-    if(preg_match("/(c.*w|w.*c)/",$acl_all)){
-      $s.= "...|<input class='center' type='image' src='images/list_new_conference.png' alt=''>".
-        "&nbsp;"._("Conference")."|conference_new|\n";
-    }
-
-    /* Multiple options */
-    $s.= "..|---|\n";
-    $s.= "..|<img src='images/edittrash.png' alt='' border='0' class='center'>".
-      "&nbsp;"._("Remove")."|"."remove_multiple|\n";
-
-    /* Add multiple copy & cut icons */
-    if(is_object($this->parent->CopyPasteHandler)){
-      $s.= "..|---|\n";
-      $s.= "..|<img src='images/editcopy.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Copy")."|"."multiple_copy_systems|\n";
-      $s.= "..|<img src='images/editcut.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Cut")."|"."multiple_cut_systems|\n";
-
-      if($this->parent->CopyPasteHandler->entries_queued()){
-        $img = "<img border='0' class='center' src='images/editpaste.png' alt=''>";
-        $s.="..|".$img."&nbsp;"._("Paste")."|editPaste|\n";
-      }else{
-        $img = "<img border='0' class='center' src='images/cant_editpaste.png' alt=''>";
-        $s.="..|".$img."&nbsp;"._("Paste")."\n";
-      }
-    }
-
-    /* Add snapshot icons */
-    if(preg_match("/(c.*w|w.*c)/",$acls)){
-      $s .= "..|---|\n";
-      $s .= $this->get_snapshot_header(TRUE);
-    }
-
-    $this->SetDropDownHeaderMenu($s);
-    $this->SetListHeader($listhead);
-  }
-
-  function execute()
-  {
-    $this->ClearElementsList();
-    $this->GenHeader();
-  }
-
-  function setEntries($list)
-  {
-    $linkopen= "<a href='?plug=".$_GET['plug']."&amp;act=dep_open&amp;dep_id=%s'>%s</a>";
-
-    $userimg  = "<img class='center' src='images/select_conference.png' alt='User' title='%s'>";
-    $editlink = "<a href='?plug=".$_GET['plug']."&amp;id=%s&amp;act=edit_entry'>%s</a>";
-
-    /* Dynamic action col, depending on snapshot icons */
-    $action_col_size = 100;
-    if($this->parent->snapshotEnabled()){
-      $action_col_size += 20;
-    }
-
-    /* Insert conferneces*/
-    foreach($list as $conferencekey => $conference ){
-
-      $acl      = $this->ui->get_permissions($conference['dn'],"gofonconference/conference");
-      $acl_all  = $this->ui->has_complete_category_acls($conference['dn'],"gofonconference");
-
-      /* You will need at least read access for the 
-          current conference informations to display it */  
-      if(!preg_match("/r/",$acl)){
-        continue;
-      }
-
-      $actions ="";
-      if(($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
-        $actions.= "<input class='center' type='image'
-          src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
-        $actions.= "<input class='center' type='image'
-          src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
-      }
-
-      /* Add edit icon - This is allowed when we have at least read access. */
-      $actions.= "<input class='center' type='image' src='images/edit.png'     
-                    alt='"._("edit")."'    name='conference_edit_%KEY%' title='"._("Edit this entry")."'>";
-
-      /* Add snapshot icon - This is allowed when we have create and write access for the current entry */
-      if(preg_match("/(c.*w|w.*c)/",$acl_all)){
-        $actions.= $this->GetSnapShotActions($conference['dn']);
-      }
-
-      /* Create delete link - Only if we are allowed to delete this entry */
-      if(preg_match("/d/",$acl)){
-        $actions.= "<input class='center' type='image' src='images/edittrash.png' 
-          alt='"._("delete")."'   name='conference_del_%KEY%'  title='"._("Delete this entry")."'>";
-      }
-
-      /* Display PIN icon, only if we are the owner of the given conference */
-      $owner = $this->parent->ui->dn==$conference['goFonConferenceOwner'][0];
-      $p_acl = $this->ui->get_permissions($conference['dn'],"gofonconference/conference","goFonPIN");
-      if((isset($conference['goFonPIN'][0])) && $owner && preg_match("/r/",$p_acl)){
-        $pin = "<img class='center' src='images/list_password.png' title='PIN : ".$conference['goFonPIN'][0]."' alt='PIN'>";
-      }else{
-        $pin = "&nbsp;";
-      }
-
-      /* Display numer of the conference if we are allowed to view it */
-      $n_acl = $this->ui->get_permissions($conference['dn'],"gofonconference/conference","telephoneNumber");
-      if(isset($conference['telephoneNumber'][0]) && preg_match("/r/",$n_acl)){
-        $number = " - ".$conference['telephoneNumber'][0];
-      }else{
-        $number = "&nbsp; - ?";
-      }
-
-      /* Get conference owner name */
-      $ldap= $this->parent->config->get_ldap_link();
-      $ldap->cat($conference['goFonConferenceOwner'][0], array('cn'));
-      $data = $ldap->fetch();
-      if(isset($data['cn'][0])){
-        $cn = $data['cn'][0];
-      }else{
-        $cn = _("Unknown"); 
-      }  
-
-      /* Create title */
-      $title = " title='".preg_replace("/ /","&nbsp;",@LDAP::fix($data['dn']))."' ";
-
-      /* Cutted objects should be displayed in light grey */
-      $display = $conference['cn'][0].$number;
-      if($this->parent->CopyPasteHandler){
-        foreach($this->parent->CopyPasteHandler->queue as $queue_key => $queue_data){
-          if($queue_data['dn'] == $conference['dn']) {
-            $display = "<font color='#999999'>".$display."</font>";
-            break;
-          }
-        }
-      }
-
-      /* Create each field */
-      $field0 = array("string" => "<input type='checkbox' id='item_selected_".$conferencekey."' name='item_selected_".$conferencekey."'>" ,
-          "attach" => "style='width:20px;'");
-      $a_field1 = array("string"=>sprintf($userimg,_("Conference")), "attach" => $title." style='text-align:center;width:20px;'");
-      $a_field2 = array("string"=>sprintf($editlink,$conferencekey,$display), "attach" => $title." style=''");
-      $a_field3 = array("string"=> $cn , "attach" =>  $title." style='width:200px;'");
-      $a_field4 = array("string"=> $pin, "attach" =>  $title." style='width:50px;'");
-      $a_field5 = array("string"=> preg_replace("/%KEY%/",$conferencekey,$actions), 
-                        "attach"=> $title."style='width:".$action_col_size."px;border-right:0px;text-align:right;'");
-
-      $this->AddElement(array($field0,$a_field1,$a_field2,$a_field3,$a_field4,$a_field5));
-    }
-
-    /* Create summary string for list footer */
-    $num_deps=0;
-    if(!$this->SubSearch){
-      $num_deps = count($this->Added_Departments);
-    }
-    $num_objs = count($list);
-
-    $num_obj_str = _("Number of listed conferences");
-    $num_dep_str = _("Number of listed departments");
-
-    $str = "<img class='center' src='images/select_conference.png'
-              title='".$num_obj_str."' alt='".$num_obj_str."'>&nbsp;".$num_objs."&nbsp;&nbsp;&nbsp;&nbsp;";
-    $str.= "<img class='center' src='images/folder.png'
-              title='".$num_dep_str."' alt='".$num_dep_str."'>&nbsp;".$num_deps."&nbsp;&nbsp;&nbsp;&nbsp;";
-
-    $this->set_List_Bottom_Info($str);
-  }
-
-  function Save()
-  {
-    MultiSelectWindow :: Save();  
-  }
-
-  function save_object()
-  {
-    /* Save automatic created POSTs like regex, checkboxes */
-    MultiSelectWindow :: save_object();   
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/gofon/conference/class_phoneConferenceGeneric.inc b/plugins/gofon/conference/class_phoneConferenceGeneric.inc
deleted file mode 100644 (file)
index e0364dc..0000000
+++ /dev/null
@@ -1,794 +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 conference extends plugin
-{
-  /* department attributes */
-  var $cn                                                = "";
-  var $description             = "";
-  var $base                              = "";
-  var $old_base            = "";
-  var $ou                                              = "";
-  var $goFonPIN                                = "";
-  var $old_cn         = "";
-
-  var $goFonConferenceOption           = "";
-  var $goFonConferenceOption_P         = "";   // Set PIN 
-  var $goFonConferenceOption_r         = "";   // record Conference
-  var $goFonConferenceOption_M         = "";   // Play Music opn hold
-  var $goFonConferenceOption_s         = "";   // activate menu
-  var $goFonConferenceOption_i         = "";   // announce new and leaving user
-  var $goFonConferenceOption_c         = "";   // Count User
-  var $goFonConferenceOption_D         = "";   // Conference Type, no PIN/PIN
-
-  var $goFonConferenceOwner     = "";
-  var $goFonHomeServer          = "0";      // Home server of the conference
-  var $init_HomeServer          = "0";      // Initial home server of the conference
-  var $goFonHomeServers         = array();  // All available home servers
-
-  var $goFonConferenceOptionFormat             = "";
-  var $goFonConferenceOptionLifetime   = "";
-  var $telephoneNumber                 = "";
-
-  var $old_tele_number         = false;
-  var $old_dn;
-
-  /* Headpage attributes */
-  var $last_dep_sorting= "invalid";
-  var $departments= array();
-  var $view_logged = FALSE;
-  var $dialog ;
-
-  /* attribute list for save action */
-  var $attributes= array("cn","base", "description", "goFonPIN","goFonConferenceOption_P","goFonConferenceOption_r","goFonHomeServer",
-      "goFonConferenceOption_M","goFonConferenceOption_s","goFonConferenceOption_i","goFonConferenceOption_c","goFonHomeServer",
-      "goFonConferenceOption_D","goFonConferenceOptionFormat","goFonConferenceOptionLifetime","telephoneNumber","goFonConferenceOwner");
-
-  var $language  = "de";
-  var $languages = array();
-
-  var $objectclasses= array("top", "goFonConference");
-
-  function conference (&$config, $dn, $plugin= NULL)
-  {
-    plugin::plugin($config, $dn, $plugin);
-    $this->is_account  = TRUE;
-    $this->ui                      = get_userinfo();
-    $this->orig_dn             = $dn;
-
-    $this->languages= get_languages(TRUE,TRUE);
-
-
-    /* Check server configurations
-     * Load all server configuration in $this->goFonHomeServers if available
-     *  and use first server as default if necessary.
-     */
-    $a_SETUP= array();
-    if(array_key_exists('config',$_SESSION) &&
-       array_key_exists('SERVERS',$_SESSION['config']->data) &&
-       array_key_exists('FON',$_SESSION['config']->data['SERVERS']) &&
-       count($_SESSION['config']->data['SERVERS']['FON']) &&
-       is_callable("mysql_connect")
-       ) {
-
-      /* Set available server */
-      $this->goFonHomeServers = $_SESSION['config']->data['SERVERS']['FON'];
-
-      /* Set default server */
-      if($this->dn == "new"){
-        $this->goFonHomeServer = $this->goFonHomeServers[0]['DN'];
-      }
-
-      /* Remember inital home server, to be able to remove old entries */
-      $this->init_HomeServer = $this->goFonHomeServer;
-
-      /* get config */
-      if(!isset($this->goFonHomeServers[$this->goFonHomeServer])){
-        print_red(sprintf(_("The specified home server '%s' is not available in GOsa server configuration. Saving this account will create a new entry on the server '%s'. Use cancel if you do not want to create a new entry while ignoring old accounts."),$this->goFonHomeServer, $this->goFonHomeServers[0]['DN']));
-
-        $this->goFonHomeServer = $this->goFonHomeServers[0]['DN'];
-        $this->init_HomeServer = $this->goFonHomeServers[0]['DN'];
-      }
-      $cur_cfg = $this->goFonHomeServers[$this->goFonHomeServer]; 
-    }
-
-    /* Set base */
-    if ($this->dn == "new"){
-      $ui= get_userinfo();
-      if(isset($_SESSION['CurrentMainBase'])){
-        $this->base = $_SESSION['CurrentMainBase'];
-      }else{
-        $this->base= dn2base($ui->dn);
-      }
-    } else {
-
-      /* The base is something like this 
-          "cn=Confis,ou=conferences,ou=asterisk,ou=configs,ou=systems," */
-      $this->base= preg_replace ("/^[^,]+,[^,]+,[^,]+,[^,]+,[^,]+,/", "", $this->dn);
-    }
-
-    $this->goFonConferenceOwner=$this->ui->dn;
-
-    /* Parse Options ... 
-     * Parameter|Lifetime|number
-     */
-    if($this->dn!="new"){
-      $tmp1= split("\|",$this->attrs['goFonConferenceOption'][0]);
-
-      for($i = 0 ; $i < strlen($tmp1[0]);$i++){
-        $varname = "goFonConferenceOption_".$tmp1[0][$i];
-        if($tmp1[0][$i]=="d"){
-          $this->goFonConferenceOption_D = $tmp1[0][$i];    
-        }else{
-          $this->$varname = $tmp1[0][$i];    
-        }
-      }
-
-      $this->goFonConferenceOptionLifetime  = $tmp1[1];
-      if(isset($tmp1[2]) && isset($this->languages[$tmp1[2]])){
-        $this->language = $tmp1[2];
-      }
-  
-      $this->old_tele_number                = $this->telephoneNumber;
-    }
-    $this->old_dn = $this->dn;
-    $this->old_cn = $this->cn;
-    $this->old_base = $this->base;
-  }
-
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* Log last action */
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","gofonconference/".get_class($this),$this->dn);
-    }
-
-    $smarty= get_smarty();
-
-    $smarty->assign("bases" ,$this->config->idepartments);
-    $smarty->assign("base"  ,$this->base);
-
-    $once = true; 
-    foreach($_POST as $name => $value){
-      if(preg_match("/^chooseBase/",$name) && $once && $this->acl_is_writeable("base")){
-        $once = false;
-        $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
-        $this->dialog->setCurrentBase($this->base);
-      }
-    }
-
-    /* Dialog handling */
-    if(is_object($this->dialog)){
-      /* Must be called before save_object */
-      $this->dialog->save_object();
-
-      if($this->dialog->isClosed()){
-        $this->dialog = false;
-      }elseif($this->dialog->isSelected()){
-        $tmp = $this->get_allowed_bases();
-        if(isset($tmp[$this->dialog->isSelected()])){
-          $this->base = $this->dialog->isSelected();
-        }
-        $this->dialog= false;
-      }else{
-        return($this->dialog->execute());
-      }
-    }
-
-    foreach ($this->attributes as $val){
-      $smarty->assign("$val", $this->$val);
-      if(!$this->$val){
-        $smarty->assign($val."CHK", "");
-      }else{
-        $smarty->assign($val."CHK", " checked ");
-      }
-    }
-
-    /* Create array with goFonHomeServer */
-    $tmp = array();
-    foreach($this->goFonHomeServers as $dn => $val){
-      if(!is_numeric($dn)){
-        $tmp[$dn]  = $val['SERVER'];
-      }
-    }
-    $smarty->assign("language",$this->language);
-    $smarty->assign("languages",$this->languages);
-    $smarty->assign("goFonHomeServers",$tmp);
-    $smarty->assign("goFonConferenceOptions",              array("D"=>"Conference ","d"=>"Conference without PIN"));
-    $smarty->assign("goFonConferenceOptionFormats",    array("WAV"=>"Wave","GSM"=>"GSM","WAV49"=>"Wave49"));
-    $smarty->assign("goFonConferenceOption",        $this->goFonConferenceOption_D);
-
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translation){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-
-    if($this->acl_is_writeable("base")){
-      $smarty->assign("baseSelect",true);
-    }else{
-      $smarty->assign("baseSelect",false);
-    }
-
-    $smarty->assign("bases" ,$this->get_allowed_bases());
-    $smarty->assign("base_select"  ,$this->base);
-
-
-    if($_SESSION['js']==1){
-      if($this->goFonConferenceOption_P != "P"){
-        $smarty->assign("goFonPINACL", $this->getacl("goFonPIN",TRUE));
-        $smarty->assign("goFonPIN","");
-      }
-      if($this->goFonConferenceOption_r != "r"){
-        $smarty->assign("goFonConferenceOptionFormatACL", $this->getacl("goFonConferenceOptionr",TRUE));
-      }
-    }
-    return($smarty->fetch (get_template_path('generic.tpl', TRUE)));
-  }
-
-
-  function remove_from_parent()
-  {
-    /* Check if 'old' home server is available in gosa FON server configuration 
-     * Try to remove this entry from database and display errors.  
-     */
-    if(isset($this->goFonHomeServers[$this->goFonHomeServer])){
-      $str = $this->SQL_remove_me(true); 
-      if($str){
-        print_red($str);
-        return false;
-      }
-    }else{
-      print_red(_("Could not remove the conference entry from database on home server (%s). Please check your asterisk database configuration."));
-      return false;
-    }
-
-    /* Remove ldap entry */
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd ($this->dn);
-    $ldap->recursive_remove();
-
-    new log("remove","gofonconference/".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');
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    if(isset($_POST['phoneConferenceGeneric'])){
-
-      /* Get selected language */
-      if(isset($_POST['language']) && isset($this->languages[get_post('language')])){
-        $this->language = get_post('language');
-      }
-
-      /* Create a base backup and reset the
-         base directly after calling plugin::save_object();
-         Base will be set seperatly a few lines below */
-      $base_tmp = $this->base;
-      plugin::save_object();
-      $this->base = $base_tmp;
-
-      /* Save base, since this is no LDAP attribute */
-      $tmp = $this->get_allowed_bases();
-      if(isset($_POST['base'])){
-        if(isset($tmp[$_POST['base']])){
-          $this->base= $_POST['base'];
-        }
-      }
-      foreach(array("goFonConferenceOption_P","goFonConferenceOption_r","goFonConferenceOption_M","goFonConferenceOption_s",
-            "goFonConferenceOption_i","goFonConferenceOption_c","goFonConferenceOption_D") as $attrs){
-
-        /* Acl can't contain _ so we remove it here. */
-        $acl_name = preg_replace("/_/","",$attrs);
-
-        if($this->acl_is_writeable($acl_name)){
-
-          if(isset($_POST[$attrs])){
-            $this->$attrs = $_POST[$attrs];
-          }else{
-            $this->$attrs = false;
-          }
-        }
-      }
-    }
-  }
-
-
-  function check_database_accessibility()
-  {
-    /* Check if mysql extension is available */
-    if(!is_callable("mysql_pconnect")){
-      return(_("Can't save any changes to asterisk database, there is currently no mysql extension available in your php setup."));
-    }
-
-    /********************
-     * Check currently selected home server 
-     ********************/
-
-    $cfg_Current  = $this->goFonHomeServers[$this->goFonHomeServer];
-    $r_current    =  @mysql_pconnect($cfg_Current['SERVER'],$cfg_Current['LOGIN'],$cfg_Current['PASSWORD']);
-    if(!$r_current){
-      new log("debug","gofonconference/".get_class($this),"",array(),@mysql_error($r_current));
-
-      return(sprintf(_("The MySQL home server '%s' isn't reachable as user '%s', check GOsa log for mysql error."),
-            $cfg_Current['SERVER'],$cfg_Current['LOGIN']));
-    }
-    $db_current  =  @mysql_select_db($cfg_Current['DB'],$r_current);
-    if(!$db_current){
-      new log("debug","gofonconference/".get_class($this),"",array(),@mysql_error($r_current));
-      mysql_close($r_current);
-      return( sprintf(_("Can't select database '%s' on home server '%s'."),$cfg_Current['DB'],$cfg_Current['SERVER']));
-    }
-
-    /********************
-     * Check init home server 
-     ********************/
-
-    if($this->goFonHomeServers != $this->init_HomeServer){
-      $cfg_Init  = $this->goFonHomeServers[$this->init_HomeServer] ;
-      $r_init    =  @mysql_pconnect($cfg_Init['SERVER'],$cfg_Init['LOGIN'],$cfg_Init['PASSWORD']);
-      if(!$r_init){
-        new log("debug","gofonconference/".get_class($this),"",array(),@mysql_error($r_init));
-
-        return(sprintf(_("The MySQL initial home server '%s' isn't reachable as user '%s', check GOsa log for mysql error."),
-              $cfg_Init['SERVER'],$cfg_Init['LOGIN']));
-      }
-      $db_init  =  @mysql_select_db($cfg_Init['DB'],$r_init);
-      if(!$db_init){
-        new log("debug","gofonconference/".get_class($this),"",array(),@mysql_error($r_init));
-        mysql_close($r_init);
-        return( sprintf(_("Can't select database '%s' on initial home server '%s'."),$cfg_Init['DB'],$cfg_Init['SERVER']));
-      }
-    }
-  }
-
-  /* Check values */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    if($this->is_number_used()){
-      $message[] =  $this->is_number_used();
-    }
-
-    /* Check if previously selected server is still available */
-    if($this->initially_was_account && !isset($this->goFonHomeServers[$this->goFonHomeServer])){
-      $message[]= sprintf(_("The previously selected asterisk home server (%s) is no longer available."),preg_replace("/,/",", ",$this->goFonHomeServer));
-      return($message);
-    }
-
-    if((empty($this->goFonPIN))&&($this->goFonConferenceOption_P=="P")&&($this->goFonConferenceOption_D=="D")){
-      $message[]= _("Please enter a PIN.");
-    }
-
-    if(empty($this->cn)){
-      $message[] =_("Please enter a name for the conference.");
-    }
-
-    if(!is_numeric($this->telephoneNumber)){
-      $message[] =_("Only numeric chars are allowed in Number field.");
-    }
-
-    if(!((is_numeric($this->goFonConferenceOptionLifetime))||(empty($this->goFonConferenceOptionLifetime)))){
-      $message[] =_("Only numbers are allowed in Lifetime.");
-    }
-
-    /* Check if add could be successful */    
-    $str = $this->SQL_add_me(false);
-    if(!empty($str)){
-      $message[] = $str;
-    }
-
-    if($this->old_cn != $this->cn || $this->base != $this->old_base){
-      $ldap = $this->config->get_ldap_link();
-      $ldap->cd("ou=conferences,ou=asterisk,ou=configs,ou=systems,".$this->base);
-      $ldap->search("(&(objectClass=goFonConference)(cn=".$this->cn."))",array("cn"));
-      if($ldap->count()){
-        $message[] =_("There is already a conference with this name in the current tree.");
-      }
-    }
-    return $message;
-  }
-
-
-  function SQL_add_me($save)
-  {
-    /* Check if there is at least on server configuration */
-    if(!count($this->goFonHomeServers)){
-      return( _("There is currently no asterisk server defined. Possibly you are missing a server that handles the asterisk management (goFonServer). Your settings can't be saved to asterisk database."));
-    }
-  
-    /********************
-     * Get configuration and try to connect 
-     ********************/
-
-    /* Check if databases are reachable, returns an error string if anything fails  */
-    $error_str = $this->check_database_accessibility();
-    if($error_str){
-      return($error_str);
-    }
-
-    /* Remove old entries, returns an error string if anything fails  */
-    $error_str = $this->SQL_remove_me($save);
-    if($error_str){
-      return($error_str);
-    }
-
-    /* Connect to current database to be able to add new entries */
-    $cfg_Current  = $this->goFonHomeServers[$this->goFonHomeServer] ;
-    $res_cur      =  @mysql_pconnect($cfg_Current['SERVER'],$cfg_Current['LOGIN'],$cfg_Current['PASSWORD']);
-    $db_cur       =  @mysql_select_db($cfg_Current['DB'],$res_cur);
-
-    /********************
-     * Remove entries that could cause trouble  
-     ********************/
-
-    /* If the current home server is different to the initial home server,
-     *  there may be already some entries with the given telephoneNumber and/or cn.
-     * We must remove those entries to avoid duplicate use of the same extension name.
-     */
-    if($this->goFonHomeServer != $this->init_HomeServer){
-      $query = "SELECT id FROM ".$cfg_Current['EXT_TABLE']." WHERE exten='".$this->telephoneNumber."' OR exten='".$this->cn."';";
-      $res = @mysql_query($query,$res_cur);
-      @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query, "Database query");
-      if(!$res){
-        new log("debug","gofonconference/".get_class($this),"",array(),@mysql_error($res_cur));
-        return(_("Can not check if there are already some entries with given telephone number and/or cn in the destination home server.").
-            "&nbsp;"._("Please have a look a the gosa logfiles."));
-      }
-      if($save && mysql_affected_rows($res_cur)) {
-        $SQL = "DELETE FROM ".$cfg_Current['EXT_TABLE']." 
-          WHERE   (exten='".$this->telephoneNumber."') 
-          OR    (exten='".$this->cn."')";
-
-        /* Query and ensure that everything went fine */
-        $res =  @mysql_query($SQL,$res_cur);
-        @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$SQL, "Database query");
-        if(!$res){
-          new log("debug","gofonconference/".get_class($this),"",array(),@mysql_error($res_cur));
-          return(_("Can not remove entries with some telephone number and/or cn from destination home server.").
-              "&nbsp;"._("Please have a look a the gosa logfiles."));
-        }
-      }
-    }
-
-    /********************
-     * Add new conference entry  
-     ********************/
-    if((!empty($this->telephoneNumber))&&($save==true)){
-
-      /* Create string out of conference Flags */
-      $parameter  ="";
-      foreach(array("goFonConferenceOption_P","goFonConferenceOption_r","goFonConferenceOption_M","goFonConferenceOption_s",
-            "goFonConferenceOption_i","goFonConferenceOption_c","goFonConferenceOption_D") as $attrs){
-        $parameter .= $this->$attrs;
-      }
-
-      $i=1;
-      $EXT=array();
-      $context="GOsa";
-      // Set Language to German
-      $EXT[$i]['exten']   =$this->telephoneNumber;
-      $EXT[$i]['context'] = $context;
-      $EXT[$i]['priority']= $i;
-      $EXT[$i]['app']     ="SetLanguage";
-      $EXT[$i]['appdata'] =$this->language;
-      $i++;      
-
-      if($this->goFonConferenceOption_r == "r"){
-
-        // Recordingformat for conference
-        $EXT[$i]['exten']   =$this->telephoneNumber;
-        $EXT[$i]['context'] =$context;
-        $EXT[$i]['priority']= $i;
-        $EXT[$i]['app']     ="Setvar";
-        $EXT[$i]['appdata'] ="MEETME_RECORDINGFORMAT=".$this->goFonConferenceOptionFormat;
-        $i++;      
-
-      }
-
-      // Answer Call
-      $EXT[$i]['exten']   =$this->telephoneNumber;
-      $EXT[$i]['context'] =$context;
-      $EXT[$i]['priority']=$i;
-      $EXT[$i]['app']     ="answer";
-      $EXT[$i]['appdata'] ="";
-      $i++;      
-
-      // Start Conference 
-      $EXT[$i]['exten']   =$this->telephoneNumber;
-      $EXT[$i]['context'] =$context;
-      $EXT[$i]['priority']=$i;
-      $EXT[$i]['app']     ="MeetMe";
-
-      if(empty($this->goFonPIN)) {
-        $EXT[$i]['appdata'] =$this->telephoneNumber."|".$parameter;
-      }else{
-        $EXT[$i]['appdata'] =$this->telephoneNumber."|".$parameter."|".$this->goFonPIN;
-      }
-      $i++; 
-
-      // Start Conference 
-      $EXT[$i]['exten']   =$this->cn;
-      $EXT[$i]['context'] =$context;
-      $EXT[$i]['priority']=1;
-      $EXT[$i]['app']     ="Goto";
-      $EXT[$i]['appdata'] =$this->telephoneNumber."|1";
-      $SQL=array();
-
-      foreach($EXT as $keytop => $valtop){
-        $s_keys = "";
-        $s_values = ""; 
-        foreach($valtop as $key=>$val){
-          $s_keys   .="`".$key."`,";
-          $s_values .="'".$val."',";
-        }
-        $s_keys   =preg_replace("/\,$/","",$s_keys); 
-        $s_values =preg_replace("/\,$/","",$s_values); 
-        $SQL[]="INSERT INTO ".$cfg_Current['EXT_TABLE']." (".$s_keys.") VALUES (".$s_values.");"; 
-      }
-      foreach($SQL as $sqlsyn){
-        mysql_query($sqlsyn,$res_cur);
-        @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$sqlsyn, "Database query");
-      }
-    } 
-
-    @mysql_close($res_cur);
-  }
-
-
-  /* Remove initial entry from database 
-   * This function checks if there is an entry in the 
-   *  initial home server that uses this->old_cn or $this->old_tele_number
-   *  and removes this entries. 
-   * This function is called from save and remove_from parent.
-   * 
-   *  The parameter '$save' is false if we just 
-   *   want to check if a remove is possible. 
-   *  And true if we realy want to remove the entries.   
-   */
-  function SQL_remove_me($save)
-  {
-    /* check database access */
-    $str = $this->check_database_accessibility();
-    if($str){
-      return($str);
-    }
-
-    /* Connect to old database */
-    $cfg_Init  = $this->goFonHomeServers[$this->init_HomeServer] ;
-    $r_init    =  @mysql_pconnect($cfg_Init['SERVER'],$cfg_Init['LOGIN'],$cfg_Init['PASSWORD']);
-    $db_init   =  @mysql_select_db($cfg_Init['DB'],$r_init);
-   
-    /* Check if there is an old entry */
-    $query = "SELECT id FROM ".$cfg_Init['EXT_TABLE']." WHERE exten='".$this->old_tele_number."' OR exten='".$this->old_cn."';";
-    $res = @mysql_query($query,$r_init);
-    @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query, "Database query");
-    if(!$res){
-      new log("debug","gofonconference/".get_class($this),"",array(),@mysql_error($r_init));
-      return(_("Can not check if entry exists in old database. Please have a look a the gosa logfiles."));
-    }
-   
-    /* There are entries using this cn and/or phone number */
-    if($save && mysql_affected_rows($r_init)) {
-      $SQL = "DELETE FROM ".$cfg_Init['EXT_TABLE']." 
-      WHERE   (exten='".$this->old_tele_number."') 
-        OR    (exten='".$this->old_cn."')";
-  
-      /* Query and ensure that everything went fine */
-      $res =  @mysql_query($SQL,$r_init);
-      @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$SQL, "Database query");
-      if(!$res){
-        new log("debug","gofonconference/".get_class($this),"",array(),@mysql_error($r_init));
-        return(_("Can not remove old entries from initial home server. Please have a look a the gosa logfiles."));
-      }
-
-    }//ENDE  old num availiable ...
-    @mysql_close($r_init);
-    return(false);
-  }
-
-
-
-  /* This function checks if the given phonenumbers are available or already in use*/
-  function is_number_used()
-  {
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(|(objectClass=goFonAccount)(objectClass=goFonQueue)(objectClass=goFonConference))", array("telephoneNumber","cn","uid"));
-    while($attrs = $ldap->fetch()) {
-      unset($attrs['telephoneNumber']['count']);
-      foreach($attrs['telephoneNumber'] as $tele){
-        if(!isset($attrs['cn'][0])) $attrs['cn'][0]=$attrs['dn'];
-        if(!isset($attrs['uid'][0])) $attrs['uid'][0]=$attrs['dn'];
-        $numbers[$tele]=$attrs;
-      }
-    }
-
-    $num = $this->telephoneNumber;
-    if((isset($numbers[$num]))&&(($numbers[$num]['cn'][0]!=$this->old_cn))){
-      if(isset($numbers[$num]['uid'][0])){
-        return sprintf(_("The specified telephonenumber '%s' is already assigned to '%s'."),$num,$numbers[$num]['uid'][0]);
-      }else{
-        return sprintf(_("The specified telephonenumber '%s' is already assigned to '%s'."),$num,$numbers[$num]['cn'][0]);
-      }
-    }
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-
-    if((!isset($this->attrs['goFonPIN']))){
-      $pin_use = false;
-    }else{
-      $pin_use = true;
-    }
-
-    /* Unset PIN if this is a conference without PIN */
-    if((!empty($this->goFonPIN)||($this->goFonConferenceOption_P=="P"))&&($this->goFonConferenceOption_D=="d")){
-      $this->goFonPIN = "";
-    }
-
-    plugin::save();
-
-    if(empty($this->old_tele_number)){
-      $this->old_tele_number= $this->telephoneNumber;
-    }
-
-    $this->SQL_add_me(true);
-
-    if(empty($this->goFonConferenceOption_P)){
-      if($pin_use){
-        $this->attrs['goFonPIN']=array();
-      }else{
-        unset($this->attrs['goFonPIN']);
-      }
-    }
-    $this->attrs['goFonConferenceOption']="";
-    foreach(array("goFonConferenceOption_P","goFonConferenceOption_r","goFonConferenceOption_M","goFonConferenceOption_s",
-          "goFonConferenceOption_i","goFonConferenceOption_c","goFonConferenceOption_D","goFonConferenceOptionFormat") as $attrs){
-      $this->attrs['goFonConferenceOption'] .= $this->$attrs;
-      unset($this->attrs[$attrs]);         
-    }
-
-    $this->attrs['goFonConferenceOption'].="|".$this->goFonConferenceOptionLifetime;
-    $this->attrs['goFonConferenceOption'].="|".$this->language;
-    unset($this->attrs['goFonConferenceOptionLifetime']);
-
-    /* Write back to ldap */
-
-    unset($this->attrs['base']);
-
-    $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->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
-      $ldap->cd($this->dn);
-      $ldap->add($this->attrs);
-      $this->handle_post_events('add');
-    }
-
-    /* Log last action */
-    if($this->initially_was_account){
-      new log("modify","gofonconference/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }else{
-      new log("create","gofonconference/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }
-
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of goFonConference/generic with dn '%s' failed."),$this->dn));
-
-    /* Optionally execute a command after we're done */
-    $this->postcreate();
-  }
-
-
-  function getCopyDialog()
-  {
-    $smarty = get_smarty();
-    $smarty->assign("cn" ,$this->cn);
-    $smarty->assign("telephoneNumber" ,$this->telephoneNumber);
-    $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE));
-    $ret = array();
-    $ret['string'] = $str;
-    $ret['status'] = "";
-    return($ret);
-  }
-
-
-  function saveCopyDialog()
-  {
-    if(isset($_POST['cn'])){
-      $this->cn = $_POST['cn'];
-    }
-    if(isset($_POST['telephoneNumber'])){
-      $this->telephoneNumber = $_POST['telephoneNumber'];
-    }
-  }
-
-  function PrepareForCopyPaste($source)
-  {
-    plugin::PrepareForCopyPaste($source) ;
-
-    $source_o = new conference($this->config,$source['dn']);
-  
-    foreach($this->attributes as $attr){
-      $this->$attr = $source_o->$attr;
-    }
-  }
-
-
-  /* Return plugin informations for acl handling */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("Conference"),
-          "plDescription" => _("Phone conference management"),
-          "plSelfModify"  => TRUE,
-          "plDepends"     => array(),
-          "plPriority"    => 0,
-          "plSection"     => array("addons" => _("Addons")),
-          "plCategory"    => array("gofonconference" => array("description" => _("GOfon conference"),
-              "objectClass" => "gofonConference")),
-
-          "plProvidedAcls" => array(
-            "cn"                            => _("Name"),
-            "base"                          => _("Base"),
-            "description"                   => _("Description"),
-            "goFonPIN"                      => _("Conference PIN"),
-
-            "goFonHomeServer"              => _("Home server"),
-            "goFonConferenceOptionP"       => _("Preset PIN"),
-            "goFonConferenceOptionr"       => _("Record conference"),
-            "goFonConferenceOptionM"       => _("Play music on hold"),
-            "goFonConferenceOptions"       => _("Activate menu"),
-            "goFonConferenceOptioni"       => _("Announce user activity"),
-            "goFonConferenceOptionc"       => _("Count user"),
-            "goFonConferenceOptionD"       => _("Conference type"),
-
-            "goFonConferenceOptionFormat"   => _("Format"),
-            "goFonConferenceOptionLifetime" => _("Lifetime"),
-            "telephoneNumber"               => _("Telephone number"),
-            "goFonConferenceOwner"          => _("Owner"))
-            ));
-  }
-
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/gofon/conference/class_phoneConferenceManagment.inc b/plugins/gofon/conference/class_phoneConferenceManagment.inc
deleted file mode 100644 (file)
index 023e52e..0000000
+++ /dev/null
@@ -1,555 +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 phoneConferenceManagment extends plugin
-{
-  /* Definitions */
-  var $plHeadline                                = "Phone conferences";
-  var $plDescription                   = "Management";
-
-  /* CLI vars */
-  var $cli_summary                       = "Handling of LDAP subtrees";
-  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 $attributes                                = array();
-  var $objectclasses                   = array();
-
-  var $conferences                       = array();
-  var $conftab            = false;
-  var $ui                 = NULL;
-  var $DivListConference  = NULL;
-
-  var $CopyPasteHandler = NULL;
-  var $start_pasting_copied_objects = FALSE;
-
-  /* Initialise Class */
-  function phoneConferenceManagment (&$config, $ui)
-  {
-    $this->ui                    = $ui;
-    $this->dn                    = "";
-    $this->config              = $config;
-    $this->DivListConference = new divListConference($this->config,$this);
-
-    /* Copy & Paste enabled ?*/
-    if((isset($this->config->data['MAIN']['ENABLECOPYPASTE']))&&(preg_match("/true/i",$this->config->data['MAIN']['ENABLECOPYPASTE']))){
-      $this->CopyPasteHandler = new CopyPasteHandler($this->config);
-    }
-  }
-
-
-  /* Execute class and display something */
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    $_SESSION['LOCK_VARS_TO_USE'] = array("/^id$/","/^act$/","/^conference_/","/^item_selected/","/^remove_multiple_conferences/");
-
-    /***************
-      Variable initialisation
-     ***************/
-  
-    /* Reload departments */
-    $smarty                                                      = get_smarty();
-    $display                                             = "";
-    $s_action                                          = "";  // Will contain an action, like del or edit
-    $s_entry                                           = "";  // The entry name for edit delete -...
-
-
-    /***************
-      Check posts  
-     ***************/
-  
-    foreach($_POST as $key => $post){
-      if(preg_match("/^conference_new.*/i",$key)){
-        $s_action = "new";
-        // Post for delete
-      }elseif(preg_match("/^conference_del.*/",$key)){
-        $s_action = "del";
-        $s_entry  = preg_replace("/^conference_del_/i","",$key);
-        $s_entry  = preg_replace("/_.*$/","",$s_entry);
-        // Post for edit
-      }elseif(preg_match("/conference_edit_.*/",$key)){
-        $s_action="edit";
-        $s_entry  = preg_replace("/conference_edit_/i","",$key);
-        $s_entry  = preg_replace("/_.*$/","",$s_entry);
-      }elseif(preg_match("/^remove_multiple_conferences/",$key)){
-        $s_action="del_multiple";
-      }elseif(preg_match("/^editPaste.*/i",$key)){
-        $s_action="editPaste";
-      }elseif(preg_match("/^copy_.*/",$key)){
-        $s_action="copy";
-        $s_entry  = preg_replace("/^copy_/i","",$key);
-        $s_entry  = preg_replace("/_.$/","",$s_entry);
-      }elseif(preg_match("/^cut_.*/",$key)){
-        $s_action="cut";
-        $s_entry  = preg_replace("/^cut_/i","",$key);
-        $s_entry  = preg_replace("/_.$/","",$s_entry);
-      }elseif(preg_match("/^multiple_copy_objects/",$key)){
-        $s_action = "copy_multiple";
-      }elseif(preg_match("/^multiple_cut_objects/",$key)){
-        $s_action = "cut_multiple";
-      } 
-    }
-
-    /* Edit Entry */
-    if((isset($_GET['act']))&&($_GET['act']=="edit_entry")){
-      $s_action = "edit";
-      $s_entry  = $_GET['id'];
-    }
-
-    /* handle C&P from layers menu */
-    if(isset($_POST['menu_action']) && preg_match("/^multiple_copy_systems/",$_POST['menu_action'])){
-      $s_action = "copy_multiple";
-    }
-    if(isset($_POST['menu_action']) && preg_match("/^multiple_cut_systems/",$_POST['menu_action'])){
-      $s_action = "cut_multiple";
-    }
-    if(isset($_POST['menu_action']) && preg_match("/^editPaste/",$_POST['menu_action'])){
-      $s_action = "editPaste";
-    }
-
-    /* Create options */
-    if(isset($_POST['menu_action']) && $_POST['menu_action'] == "conference_new"){
-      $s_action = "new";
-    }
-
-    /* handle remove from layers menu */
-    if(isset($_POST['menu_action']) && preg_match("/^remove_multiple/",$_POST['menu_action'])){
-      $s_action = "del_multiple";
-    }
-
-
-    /***************
-      Cancel dialogs 
-     ***************/
-  
-    /* Reset requested? */
-    if (isset($_POST['edit_cancel'])){
-      if (isset($this->conftab)){
-        del_lock ($this->conftab->dn);
-        unset ($this->conftab);
-      }
-      $this->conftab= NULL;
-      $this->lognames= array();;
-      $this->cn= "";
-      unset ($_SESSION['objectinfo']);
-    }
-
-
-    /********************
-      Copy & Paste Handling  ...
-     ********************/
-
-    /* Display the copy & paste dialog, if it is currently open */
-    $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
-    if($ret){
-      return($ret);
-    }
-
-
-    /********************
-      Delete MULTIPLE entries requested, display confirm dialog
-     ********************/
-
-    if ($s_action=="del_multiple"){
-      $ids = $this->list_get_selected_items();
-
-      if(count($ids)){
-
-        foreach($ids as $id){
-          $dn = $this->conferences[$id]['dn'];
-          if (($user= get_lock($dn)) != ""){
-            return(gen_locked_message ($user, $dn));
-          }
-          $this->dns[$id] = $dn;
-        }
-
-        $dns_names = "<br><pre>";
-        foreach($this->dns as $dn){
-          add_lock ($dn, $this->ui->dn);
-          $dns_names .= $dn."\n";
-        }
-        $dns_names .="</pre>";
-
-        /* Lock the current entry, so nobody will edit it during deletion */
-        $smarty->assign("info",     sprintf(_("You're about to delete the following user(s) %s"), @LDAP::fix($dns_names)));
-        $smarty->assign("multiple", true);
-        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
-      }
-    }
-
-
-    /********************
-      Delete MULTIPLE entries confirmed
-     ********************/
-
-    /* Confirmation for deletion has been passed. Users should be deleted. */
-    if (isset($_POST['delete_multiple_conference_confirm'])){
-
-      /* Remove user by user and check acls before removeing them */
-      foreach($this->dns as $key => $dn){
-        $this->dn = $dn;
-        $acl = $this->ui->get_permissions($this->dn,"gofonconference/conference");
-        if(preg_match("/d/",$acl)){
-          $this->remove_from_parent();
-        } else {
-          print_red (_("You have no permission to remove this department."));
-        }
-        /* Remove lock file after successfull deletion */
-        del_lock ($dn);
-        unset($this->dns[$key]);
-      }
-    }
-
-
-    /********************
-      Delete MULTIPLE entries Canceled
-     ********************/
-
-    /* Remove lock */
-    if(isset($_POST['delete_multiple_conference_cancel'])){
-      foreach($this->dns as $key => $dn){
-        del_lock ($dn);
-        unset($this->dns[$key]);
-      }
-    }
-
-
-    /***************
-      Delete 
-     ***************/
-  
-    /* Delete Entry if Posted action (s_action) == del
-     * The entry which will be deleted is defined in $s_entry
-     */
-    if ($s_action =="del"){
-
-      $acl = $this->ui->get_permissions($this->conferences[$s_entry]['dn'],"gofonconference/conference"); 
-      if(preg_match("/d/",$acl)){
-        $this->dn= $this->conferences[$s_entry]['dn'];
-
-        /* Check locking */
-        if (($conf= get_lock($this->dn)) != ""){
-          $_SESSION['dn']= $this->dn;
-          return(gen_locked_message($conf, $this->dn));
-        } else {
-          add_lock ($this->dn, $this->ui->dn);
-          $smarty->assign("info", sprintf(_("You're about to delete the whole LDAP subtree placed under '%s'."), $this->dn));
-          $smarty->assign("multiple", false);
-          $display.= $smarty->fetch (get_template_path('remove.tpl', TRUE));
-          return ($display);
-        }
-      }
-    }
-
-
-    /***************
-      Delete confirmed  
-     ***************/
-  
-    /* If department deletion is accepted ...
-     * Finally delete department
-     */
-    if (isset($_POST['delete_department_confirm'])){
-      $acl = $this->ui->get_permissions($this->dn,"gofonconference/conference"); 
-      if(preg_match("/d/",$acl)){
-        $this->remove_from_parent();
-      } else {
-        print_red (_("You have no permission to remove this department."));
-      }
-    }
-
-
-    /***************
-      Edit
-     ***************/
-  
-    /* Edit Entry if Posted action (s_action) == edit
-     * The entry which will be edited is defined in $s_entry
-     */
-    if (($s_action=="edit") && (!isset($this->conftab->config))){
-
-      $this->dn= $this->conferences[$s_entry]['dn'];
-
-      if (($conf= get_lock($this->dn)) != ""){
-        return(gen_locked_message ($conf, $this->dn));
-      }
-
-      /* Lock the current entry, so everyone will get the  above dialog */
-      add_lock ($this->dn, $this->ui->dn);
-
-      /* Register conftab to trigger edit dialog */
-      $this->conftab= new conferencetabs($this->config,$this->config->data['TABS']['CONFERENCETABS'], $this->dn,"gofonconference");
-      $this->conftab->set_acl_base($this->dn);
-      $_SESSION['objectinfo']= $this->dn;
-    }
-
-
-    /***************
-      Create new  
-     ***************/
-  
-    /* Insert new entry*/    
-    if($s_action == "new" ){
-
-      $dummy_dn = "cn=dummy,ou=conferences,ou=asterisk,ou=configs,ou=systems,".$this->DivListConference->selectedBase;      
-      $acl = $this->ui->get_permissions($dummy_dn,"gofonconference/conference"); 
-      if(preg_match("/c/",$acl)){
-        /* Set up the users ACL's for this 'dn' */
-        $this->dn= "new";
-        $this->conftab= new conferencetabs($this->config,$this->config->data['TABS']['CONFERENCETABS'], $this->dn,"gofonconference");
-        $this->conftab->set_acl_base($dummy_dn);
-        unset($_SESSION['objectinfo']);
-      }
-    }
-
-
-    /***************
-      Save entry  
-     ***************/
-  
-    /* Edit finished, check and save changes */
-    if ((isset($_POST['edit_finish']) || isset($_POST['edit_apply'])) && (isset($this->conftab->config))){
-      /* Check tabs, will feed message array */
-      $this->conftab->last= $this->conftab->current;
-      $this->conftab->save_object();
-      $message= $this->conftab->check();
-
-      if (count($message) == 0){
-        if($this->conftab->save() == 1){
-          gosa_log ("goFonConference object '".$this->dn."' saving failed.");
-          return;
-        }
-        gosa_log ("goFonConference object '".$this->dn."' has been saved");
-
-        if (!isset($_POST['edit_apply'])){
-          if ($this->dn != "new"){
-            del_lock ($this->dn);
-          }
-        }
-
-        del_lock ($this->conftab->dn);;
-        unset ($this->conftab);
-        $this->conftab= NULL;
-        unset ($_SESSION['objectinfo']);
-      } else {
-        show_errors($message);
-      }
-    }
-
-
-    /***************
-      Display dialogs   
-     ***************/
-  
-    /* if edit or new, show dialog */
-    if(($this->conftab) && (isset($this->conftab->config))){
-      $display= $this->conftab->execute();
-
-      /* Don't show buttons if tab dialog requests this */
-      if (!$this->conftab->by_object[$this->conftab->current]->dialog){
-        $display.= "<p style=\"text-align:right\">\n";
-        $display.= "<input type=\"submit\" name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
-        $display.= "&nbsp;\n";
-        if ($this->dn != "new"){
-          $display.= "<input type=submit name=\"edit_apply\" value=\""._("Apply")."\">\n";
-          $display.= "&nbsp;\n";
-        }
-        $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
-        $display.= "</p>";
-      }
-      return ($display);
-    }
-
-
-    /***************
-      display divlist
-     ***************/
-
-    /* Check if there is a snapshot dialog open */
-    $base = $this->DivListConference->selectedBase;
-    if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases())){
-      return($str);
-    }
-
-    /* Return rendered main page */
-    /* Display dialog with system list */
-    $this->DivListConference->parent = $this;
-    $this->DivListConference->execute();
-
-    /* Add departments if subsearch is disabled */
-    if(!$this->DivListConference->SubSearch){
-      $this->DivListConference->AddDepartments($this->DivListConference->selectedBase,5,1);
-    }
-    $this->reload();
-    $this->DivListConference->setEntries($this->conferences);
-    return($this->DivListConference->Draw());
-  }
-
-
-  /* Return departments, that will be included within snapshot detection */
-  function get_used_snapshot_bases()
-  {
-    return(array("ou=conferences,ou=asterisk,ou=configs,ou=systems,".$this->DivListConference->selectedBase));
-  }
-
-
-  /* Reload entries for divlist.
-   * reload all conferences for the current base, with the given regex
-   */
-  function reload()
-  {
-    $Base             = "ou=conferences,ou=asterisk,ou=configs,ou=systems,".$this->DivListConference->selectedBase;
-    $SubSearch        = $this->DivListConference->SubSearch;
-    $Regex            = $this->DivListConference->Regex;
-    $Flags            = GL_SIZELIMIT ; 
-    $Filter           = "(&(|(cn=".$Regex.")(description=".$Regex."))(objectClass=goFonConference))";
-    $Attrs            = array("cn","goFonConferenceOwner","goFonPIN","telephoneNumber");
-    if($SubSearch){
-      $Flags |= GL_SUBSEARCH;
-    }
-
-    $this->conferences= get_list($Filter, "gofonconference", $Base, $Attrs, $Flags);
-  }
-
-  function remove_from_parent()
-  {
-    /* Ehm what are we doinf here ? */
-  
-    $cfg = new conference($this->config, $this->dn);
-    $cfg->set_acl_category("gofonconference");
-    $cfg->set_acl_base($this->dn);
-
-    $cfg->remove_from_parent();
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd ($this->dn);
-    $ldap->recursive_remove();
-
-    /* Optionally execute a command after we're done */
-    $this->postremove();
-
-    /* Delete references to object groups */
-    $ldap->cd ($this->config->current['BASE']);
-    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
-    while ($ldap->fetch()){
-      $og= new conftab($this->config, $ldap->getDN());
-      unset($og->member[$this->dn]);
-      $og->save ();
-    }
-
-  }
-
-
-  function copyPasteHandling_from_queue($s_action,$s_entry)
-  {
-    /* Check if Copy & Paste is disabled */
-    if(!is_object($this->CopyPasteHandler)){
-      return("");
-    }
-
-    /* Add a single entry to queue */
-    if($s_action == "cut" || $s_action == "copy"){
-
-      /* Cleanup object queue */
-      $this->CopyPasteHandler->cleanup_queue();
-      $dn = $this->conferences[$s_entry]['dn'];
-      $this->CopyPasteHandler->add_to_queue($dn,$s_action,"conferencetabs","CONFERENCETABS","gofonconference");
-    }
-
-    /* Add entries to queue */
-    if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
-
-      /* Cleanup object queue */
-      $this->CopyPasteHandler->cleanup_queue();
-
-      /* Add new entries to CP queue */
-      foreach($this->list_get_selected_items() as $id){
-        $dn = $this->conferences[$id]['dn'];
-
-        if($s_action == "copy_multiple"){
-          $this->CopyPasteHandler->add_to_queue($dn,"copy","conferencetabs","CONFERENCETABS","gofonconference");
-        }
-        if($s_action == "cut_multiple"){
-          $this->CopyPasteHandler->add_to_queue($dn,"cut","conferencetabs","CONFERENCETABS","gofonconference");
-        }
-      }
-    }
-
-    /* Start pasting entries */
-    if($s_action == "editPaste"){
-      $this->start_pasting_copied_objects = TRUE;
-    }
-    /* Return C&P dialog */
-    if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
-
-      /* Load entry from queue and set base */
-      $this->CopyPasteHandler->load_entry_from_queue();
-      $this->CopyPasteHandler->SetVar("base",$this->DivListConference->selectedBase);
-
-      /* Get dialog */
-      $data = $this->CopyPasteHandler->execute();
-
-      /* Return dialog data */
-      if(!empty($data)){
-        return($data);
-      }
-    }
-
-    /* Automatically disable status for pasting */
-    if(!$this->CopyPasteHandler->entries_queued()){
-      $this->start_pasting_copied_objects = FALSE;
-    }
-    return("");
-  }
-
-
-  function save_object()
-  {
-    $this->DivListConference->save_object();
-  }
-
-  function remove_lock()
-  {
-    if (isset($this->dn)){
-      del_lock ($this->dn);
-    }
-  }
-
-
-  function list_get_selected_items()
-  {
-    $ids = array();
-    foreach($_POST as $name => $value){
-      if(preg_match("/^item_selected_[0-9]*$/",$name)){
-        $id   = preg_replace("/^item_selected_/","",$name);
-        $ids[$id] = $id;
-      }
-    }
-    return($ids);
-  }
-
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/gofon/conference/generic.tpl b/plugins/gofon/conference/generic.tpl
deleted file mode 100644 (file)
index 63938a4..0000000
+++ /dev/null
@@ -1,249 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
-  <tr>
-    <td colspan=3>
-      <h2 style='margin:0px; padding:0px;'><img class="center" alt="" align="middle" src="images/rightarrow.png"> 
-        {t}Properties{/t}
-      </h2>
-    </td>
-  </tr>
-  <tr>
-    <td style="vertical-align:top">
-       <table summary="">
-        <tr>
-          <td>
-            <LABEL for="cn">
-              {t}Conference name{/t}
-            </LABEL>
-            {$must}
-          </td>
-          <td>
-{render acl=$cnACL}
-            <input id="cn" name="cn" size=25 maxlength=60 value="{$cn}" title="{t}Name of conference to create{/t}">
-{/render}
-          </td>
-        </tr>
-        <tr>
-          <td>
-            <LABEL for="goFonConferenceOption_D">
-              {t}Type{/t}
-            </LABEL>
-            {$must}
-          </td>
-          <td>
-{render acl=$goFonConferenceOptionDACL}
-            <select id="goFonConferenceOption_D" size="1" name="goFonConferenceOption_D" 
-              title="{t}Choose subtree to place conference in{/t}"> 
-              {html_options options=$goFonConferenceOptions selected=$goFonConferenceOption_D}
-            </select>
-{/render} 
-          </td>
-        </tr>
-        <tr>
-          <td colspan="2">
-            <br>
-          </td>
-        </tr>
-        <tr>
-          <td>
-            <LABEL for="base">
-              {t}Base{/t}
-            </LABEL>
-            {$must}
-          </td>
-          <td>
-
-{render acl=$baseACL}
-            <select id="base" size="1" name="base" title="{t}Select a base{/t}">
-              {html_options options=$bases selected=$base_select}
-            </select>
-{/render}
-
-{render acl=$baseACL disable_picture='images/folder_gray.png'}
-            <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
-{/render}
-
-          </td>
-        </tr>
-        <tr>
-          <td><LABEL for="goFonHomeServer">{t}Home server{/t}</LABEL>{$must}</td>
-          <td>
-{render acl=$goFonHomeServerACL}
-                <select name='goFonHomeServer'>
-                 {html_options options=$goFonHomeServers selected=$goFonHomeServer}
-                </select>
-{/render}
-          </td>
-        </tr>
-        <tr>
-          <td>{t}Language{/t}
-          </td>
-          <td>
-            <select name="language" title="{t}Select language{/t}">
-              {html_options options=$languages selected=$language}
-            </select>
-          </td>
-        </tr>
-      </table>
-    </td>
-    <td style="border-left:1px solid #A0A0A0">
-      &nbsp;
-    </td>
-    <td width="50%">
-      <table summary="">
-        <tr>
-          <td>
-            <LABEL for="description">
-              {t}Description{/t}
-            </LABEL>
-          </td>
-          <td>
-{render acl=$descriptionACL}
-            <input id="description" name="description" size=40 maxlength=80  
-              value="{$description}" title="{t}Descriptive text for department{/t}">
-{/render} 
-          </td>
-        </tr>
-        <tr>
-          <td>
-            {t}Lifetime (in days){/t}
-          </td>
-          <td>
-{render acl=$goFonConferenceOptionLifetimeACL}
-            <input name="goFonConferenceOptionLifetime" size=15 value="{$goFonConferenceOptionLifetime}">
-{/render} 
-          </td>
-        </tr>
-        <tr>
-          <td>
-            {t}Phone number{/t}
-            {$must}
-          </td>
-          <td>
-{render acl=$telephoneNumberACL}
-            <input name="telephoneNumber" value="{$telephoneNumber}" size=15>
-{/render} 
-          </td>
-        </tr>
-      </table>
-
-    </td>
-  </tr>
-  <tr>
-    <td colspan=3 style='width:100%;'>
-      <p class='seperator'>&nbsp;</p>
-    </td>
-  </tr>
-  <tr>
-    <td colspan=3>
-      <h2 style='margin:0px; padding:0px;'><img class="center" alt="" align="middle" src="images/select_ogroup.png"> 
-        {t}Options{/t}
-      </h2>
-    </td>
-  </tr>
-  <tr>
-    <td>
-
-           <table summary="">
-        <tr>
-               <td>
-{render acl=$goFonConferenceOptionPACL}
-                       <input type="checkbox" onclick="changeState('goFonPIN');" name="goFonConferenceOption_P" 
-                                           value="P" {$goFonConferenceOption_PCHK}> 
-{/render} 
-               </td>
-          <td>
-                       {t}Preset PIN{/t}
-               </td>
-             </tr>
-             <tr>
-               <td>
-                 &nbsp;
-               </td>
-               <td>
-                       {t}PIN{/t} 
-{render acl=$goFonPINACL}
-            <input type='password' name="goFonPIN" id="goFonPIN" value="{$goFonPIN}" title="{$goFonPIN}">
-{/render} 
-               </td>
-             </tr>
-        <tr>
-               <td colspan=2>
-{render acl=$goFonConferenceOptionrACL}
-                       <input type="checkbox" onclick="changeState('goFonConferenceOptionFormat');" name="goFonConferenceOption_r" 
-              value="r" {$goFonConferenceOption_rCHK}> 
-{/render} 
-             {t}Record conference{/t}
-               </td>
-             </tr>
-             <tr>
-               <td>
-                 &nbsp;
-               </td>
-               <td>
-                 {t}Sound file format{/t}&nbsp;
-{render acl=$goFonConferenceOptionFormatACL}
-                 <select id="goFonConferenceOptionFormat" size="1" name="goFonConferenceOptionFormat" 
-              title="{t}Choose subtree to place department in{/t}"> 
-                   {html_options options=$goFonConferenceOptionFormats selected=$goFonConferenceOptionFormat}
-               </select>
-{/render} 
-               </td>
-             </tr>
-           </table>
-
-    </td>
-    <td style="border-left:1px solid #A0A0A0">
-      &nbsp;
-         </td>
-    <td>
-
-      <table summary="">
-        <tr>
-          <td>
-{render acl=$goFonConferenceOptionMACL}
-            <input type="checkbox" name="goFonConferenceOption_M" value="M" {$goFonConferenceOption_MCHK}> 
-{/render} 
-            {t}Play music on hold{/t}
-          </td>
-        </tr>
-        <tr>
-          <td>
-{render acl=$goFonConferenceOptionsACL}
-            <input type="checkbox" name="goFonConferenceOption_s" value="s" {$goFonConferenceOption_sCHK}> 
-{/render} 
-            {t}Activate session menu{/t}
-          </td>
-        </tr>
-        <tr>
-          <td>
-{render acl=$goFonConferenceOptioniACL}
-            <input type="checkbox" name="goFonConferenceOption_i" value="i" {$goFonConferenceOption_iCHK}> 
-{/render} 
-            {t}Announce users joining or leaving the conference{/t}
-         </td>
-        </tr>
-        <tr>
-          <td>
-{render acl=$goFonConferenceOptioncACL}
-            <input type="checkbox" name="goFonConferenceOption_c" value="c" {$goFonConferenceOption_cCHK}>
-{/render} 
-            {t}Count users{/t}
-          </td>
-        </tr>
-      </table>
-
-    </td>
-  </tr>
-</table>
-
-<input type='hidden' name='phoneConferenceGeneric' value='1'>
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('cn');
-  -->
-</script>
-<!-- 
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: 
--->
diff --git a/plugins/gofon/conference/headpage.tpl b/plugins/gofon/conference/headpage.tpl
deleted file mode 100644 (file)
index 5b5a95a..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
-<tr>
-  <td style="vertical-align:top;width:600px">
-  <div class="contentboxh">
-    <p class="contentboxh">
-     {t}List of conference rooms{/t} {$hint}
-    </p>
-  </div>
-  <div class="contentboxb">
-      {$conferencehead}
-  </div>
-  <div style='height:4px;'></div>
-  <div class="contentboxb" style="border-top:1px solid #B0B0B0;">
-      {$conferences}
-    <input type=hidden name="edit_helper">
-  </div>
-  </td>
-  <td style="vertical-align:top;">
-   <div class="contentboxh" style="border-bottom:1px solid #B0B0B0;">
-    <p class="contentboxh"><img src="{$infoimage}" align="right" alt="[i]">{t}Information{/t}</p>
-   </div>
-   <div class="contentboxb">
-   <p class="contentboxb">
-     {t}This menu allows you to create, delete and edit selected phone conferences. Having a large number of phone conferences, you might prefer the range selectors on top of the conferences list.{/t}
-   </p>
-   </div>
-   <br>
-   <div class="contentboxh">
-    <p class="contentboxh"><img src="{$launchimage}" align="right" alt="[F]">{t}Filters{/t}</p>
-   </div>
-   <div class="contentboxb">
-     <table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
-      {$alphabet}
-     </table>
-    <table summary="" width="100%" style="border-top:1px solid #B0B0B0;"><tr><td><LABEL for='filter'><img class="center" alt="Search" src="{$search_image}" align="middle" title="{t}Display users matching{/t}"></LABEL></td>
-    <td width="99%"><input id='filter' style='width:99%' type='text' name='regexit' maxlength='20' value='{$regex}' title='{t}Regular expression for        matching user names{/t}' onChange="mainform.submit()"></td></tr></table>
-   {$apply}
-   </div>
-
-
-  </td>
-</tr>
-</table summary="">
-
-<input type="hidden" name="ignore">
diff --git a/plugins/gofon/conference/main.inc b/plugins/gofon/conference/main.inc
deleted file mode 100644 (file)
index d75fc78..0000000
+++ /dev/null
@@ -1,56 +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
-*/
-
-if ($remove_lock){
-        if(isset($_SESSION['conference'])){
-                $conference= $_SESSION['conference'];
-                $conference->remove_lock();
-                del_lock ($ui->dn);
-                sess_del ('conference');
-        }
-} else {
-       /* Create usermanagement object on demand */
-       if (!isset($_SESSION['conference']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
-               $_SESSION['conference']= new phoneConferenceManagment($config, $ui);
-       }
-       $conference= $_SESSION['conference'];
-       $conference->save_object();
-       $output= $conference->execute();
-
-       /* Page header*/
-       if (isset($_SESSION['objectinfo'])){
-               $display= print_header(get_template_path('images/conference.png'), _("Conference management"), "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".@LDAP::fix($_SESSION['objectinfo']));
-       } else {
-               $display= print_header(get_template_path('images/conference.png'), _("Conference management"));
-       }
-
-       /* Reset requested? */
-       if (isset($_GET['reset']) && $_GET['reset'] == 1){
-               del_lock ($ui->dn);
-               sess_del ('conference');
-       }
-
-       /* Show and save dialog */
-       $conference->save_object();
-       $display.= $output;
-       $_SESSION['conference']= $conference;
-}
-
-?>
diff --git a/plugins/gofon/conference/paste_generic.tpl b/plugins/gofon/conference/paste_generic.tpl
deleted file mode 100644 (file)
index fa72f3f..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<table summary="">
-       <tr>
-               <td>
-                       <LABEL for="cn">
-                               {t}Conference name{/t}
-                       </LABEL>
-                       {$must}
-               </td>
-               <td>
-                       <input id="cn" name="cn" size=25 maxlength=60 value="{$cn}" title="{t}Name of conference to create{/t}">
-               </td>
-       </tr>
-       <tr>
-               <td>
-                       {t}Phone number{/t}
-                       {$must}
-               </td>
-               <td>
-                       <input name="telephoneNumber" value="{$telephoneNumber}" size=15>
-               </td>
-       </tr>
-</table>
-
diff --git a/plugins/gofon/conference/remove.tpl b/plugins/gofon/conference/remove.tpl
deleted file mode 100644 (file)
index 970abd4..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-<div style="font-size:18px;">
- <img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
-</div>
- {$info}
-<p>
- {t}This includes 'all' accounts, systems, etc. in this subtree. 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">
-{if $multiple}
-       <input type=submit name="delete_multiple_conference_confirm" value="{t}Delete{/t}">
-       &nbsp;
-       <input type=submit name="delete_multiple_conference_cancel" value="{t}Cancel{/t}">
-{else}
-       <input type=submit name="delete_department_confirm" value="{t}Delete{/t}">
-       &nbsp;
-       <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
-{/if}
-</p>
-
diff --git a/plugins/gofon/conference/tabs_conference.inc b/plugins/gofon/conference/tabs_conference.inc
deleted file mode 100644 (file)
index 5b58065..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-
-class conferencetabs extends tabs
-{
-  var $base= "";
-
-  function conferencetabs($config, $data, $dn, $category)
-  {
-         tabs::tabs($config, $data, $dn,$category);
-         $this->base= $this->by_object['conference']->base; 
-
-    /* Add references/acls/snapshots */
-    $this->addSpecialTabs();
-  }
-
-  function check($ignore_account= FALSE)
-  {
-       return (tabs::check(TRUE));
-  }
-  
-
-  function save($ignore_account= FALSE)
-  {
-       $baseobject= $this->by_object['conference'];
-       $new_dn= 'cn='.$baseobject->cn.',ou=conferences,ou=asterisk,ou=configs,ou=systems,'.$baseobject->base;
-
-       if(strtolower($this->dn)==strtolower($new_dn)){
-               $this->dn=$new_dn;
-       }
-
-       if($this->dn != $new_dn){
-               $baseobject->recursive_move($this->dn, $new_dn);
-       }
-       $this->dn= $new_dn;
-
-       tabs::save(TRUE);
-  }
-
-}
-
-?>
diff --git a/plugins/gofon/fonreports/class_fonreport.inc b/plugins/gofon/fonreports/class_fonreport.inc
deleted file mode 100644 (file)
index a63a78f..0000000
+++ /dev/null
@@ -1,415 +0,0 @@
-<?php
-
-class fonreport extends plugin
-{
-  /* Definitions */
-  var $plHeadline= "Phone Reports";
-  var $plDescription= "This does something";
-
-  /* For internal use */
-  var $start                             = 0;
-  var $search_for                = "*";
-  var $search_base       = "";
-  var $fields                            = array("calldate", "src", "dst", "channel", "lastapp", "disposition", "duration");
-  var $year                                      = "";
-  var $month                             = "";
-  var $sort                                      = 0;
-  var $sort_direction  = "down";
-  var $report_list             = array();
-  var $userfilter                      = "";
-  var $ui                                          = NULL;
-  var $range                             = 20;
-  var $EntryPerPage   = 20;
-
-  /* attribute list for save action */
-  var $attributes_SO  = array("start","search_for","search_base","range","month","sort_direction","sort","year");
-  var $objectclasses  = array();
-  var $view_logged = FALSE;
-  
-  /* Construct class */
-  function fonreport (&$config, $ui)
-  {
-    /* Include config object */
-    $this->config                      = $config;
-    $this->ui                            = $ui;
-    $this->search_base= get_base_from_people($ui->dn);
-  
-    $this->month      = date("m");
-    $this->year       = date("Y");
-
-    /* Use filter settings if we have already searched */
-    if (!is_global("fonfilter")){
-      $fonfilter = array();
-      foreach($this->attributes_SO as $name){
-        $fonfilter[$name]=$this->$name;
-      }
-      register_global("fonfilter", $fonfilter);
-    }else{
-      $fonfilter = get_global("fonfilter");
-      foreach($this->attributes_SO as $name){
-        $this->$name = $fonfilter[$name];
-      }
-    }
-  }
-
-
-  /* Save ui interactions and store results in session, 
-      to remember settings */
-  function save_object()
-  {
-    $fonfilter= get_global("fonfilter");
-    if(isset($_POST['EntryPerPage'])){
-      $this->range = $_POST['EntryPerPage'];
-    }
-    if (isset($_GET['start'])){
-      $this->start= (int)$_GET['start'];
-    }
-    foreach( array("year", "month", "search_for", "search_base") as $type){
-      if (isset($_POST[$type])){
-        $this->$type= $_POST[$type];
-      }
-    }
-    
-    /* Adapt sorting */
-    if (isset($_GET['sort'])){
-      if ($this->sort == (int)$_GET['sort']){
-        if ($this->sort_direction == "down"){
-          $this->sort_direction= "up";
-        } else {
-          $this->sort_direction= "down";
-        }
-      }
-      $this->sort= (int)$_GET['sort'];
-      if ($this->sort < 0 || $this->sort > 6){
-        $this->sort= 0;
-      }
-    }
-
-    /* remove unwanted tags */
-    $this->search_for = stripslashes(preg_replace("/[^0-9a-z\*\+ \-]/i","",$this->search_for));
-  
-    foreach($this->attributes_SO as $name){
-      $fonfilter[$name] = $this->$name;
-    }
-    register_global("fonfilter", $fonfilter);
-  }
-
-
-  /* Search & display results */
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* GVet template engine */
-    $smarty= get_smarty();
-
-    /* Log view */
-    if(!$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","gofon/".get_class($this),$this->dn);
-    }
-
-    /*****************
-      Variable Init
-     *****************/
-
-    $fields_str = "";
-
-    $months= array();
-    for($i = 1 ; $i <= 12 ; $i ++ ){
-      $months[$i] = _(date("F",gmmktime(0,0,0,$i)));
-    }
-
-    /* Prepare template */
-    $current= date("Y");
-    $years= array();
-    for ($y= $current - 5; $y<=$current; $y++){
-      $years[$y]= $y;
-    }
-
-    /*****************
-      Smarty 
-     *****************/
-    $bases      = array();
-    $cat_bases  = $this->ui->get_module_departments("gofon");
-    foreach($this->config->idepartments as $dn => $name){
-      if(in_array_ics($dn,$cat_bases)){
-        $bases[$dn] = $name;
-      }
-    }
-
-    if(!isset($bases[$this->search_base])){
-      $this->search_base = key($bases);
-    }
-
-    $smarty->assign("plug",           "?plug=".validate($_GET['plug']));
-    $smarty->assign("launchimage",    get_template_path('images/launch.png'));
-    $smarty->assign("search_image",   get_template_path('images/search.png'));
-    $smarty->assign("search_for",     $this->search_for);
-    $smarty->assign("bases",          $bases);
-    $smarty->assign("base_select",    $this->search_base);
-    $smarty->assign("months",         $months);
-    $smarty->assign("month_select",   $this->month);
-    $smarty->assign("years",          $years);
-    $smarty->assign("year_select",    $this->year);
-    $smarty->assign("search_result",  "");
-
-
-    /*****************
-      Check Database , Table , Connection 
-     *****************/
-
-    /* Connecting, selecting database */
-    if (!isset($this->config->data['SERVERS']['FON'][0])){
-      print_red(_("Can't connect to phone database, no reports can be shown!"));
-      return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
-    }elseif(!is_callable("mysql_connect")){
-      print_red(_("There is no mysql extension available, please check your php setup."));
-      return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
-    }else{
-
-      $cfg= $this->config->data['SERVERS']['FON'][0];
-      $link = @mysql_pconnect($cfg['SERVER'], $cfg['LOGIN'], $cfg['PASSWORD']);
-      if ($link === FALSE){
-        print_red(_("Can't connect to phone database, no reports can be shown!"));
-        return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
-      }
-      if (! @mysql_select_db("gophone")){
-        print_red(_("Can't select phone database for report generation!"));
-        return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
-      }
-    }
-
-
-    /*****************
-      Get Query String && Search
-     *****************/
-
-    $query  = $this->CreateQuerySyntax();
-    $cfg    = $this->config->data['SERVERS']['FON'][0];
-    $link   = @mysql_pconnect($cfg['SERVER'], $cfg['LOGIN'], $cfg['PASSWORD']);
-
-    @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query, "Database query");
-
-    $result = @mysql_query($query);
-    if ($result === false){
-      print_red(_("Query for phone database failed!"));
-      return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
-    }
-
-    /*****************
-      Fetch results 
-     *****************/
-  
-    $report_list= array();
-    
-    /* Restricted attributes will not be displayed, this will be displayed instead */
-    $no_acl = "<img class='center' src='images/closedlock.png'
-      title='"._("Insufficient permissions to view this attribute")."' alt='"._("Insufficient permissions")."'>";
-
-    $no_acl = "&nbsp;";
-
-    while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
-
-      foreach($line as $attr => $value){
-
-        if($attr == "duration") continue;
-  
-        $acl = $this->ui->get_permissions($this->search_base,"gofon/fonreport",$attr);
-        if(!preg_match("/r/",$acl)){
-          $line[$attr] = $no_acl;
-        }
-      }
-
-      if($this->ui->get_permissions($this->search_base,"gofon/fonreport","calldate")){
-        $hour=  substr($line["calldate"], 11, 2);
-        $minute=substr($line["calldate"], 14, 2);
-        $format= _("Y-M-D");
-        $date= preg_replace("/Y/", substr($line["calldate"], 0, 4), $format);
-        $date= preg_replace("/M/", substr($line["calldate"], 5, 2), $date);
-        $date= preg_replace("/D/", substr($line["calldate"], 8, 2), $date);
-        $date_str = $date." ".$hour.":".$minute;
-      }else{
-        $date_str = $no_acl;
-      }
-  
-      $append_str = "";
-      $append_str .=   "<td>".$date_str."</td>";
-
-      foreach(array("src","dst","channel","lastapp","disposition") as $atr){
-        if(isset($line[$atr])){
-          $append_str .=       "<td>".$line[$atr]."</td>";
-        }
-      }
-
-      if($this->ui->get_permissions($this->search_base,"gofon/fonreport","duration")){
-        $append_str .=         "<td>".$this->gen_duration($line["duration"])."</td>";
-      }else{
-        $append_str .=         "<td>".$no_acl."</td>";
-      }
-      $report_list[] = $append_str;
-    }
-
-    $this->report_list= $report_list;
-    @mysql_close($link);
-
-
-    /*****************
-      Create list of results  
-     *****************/
-
-    /* Generate output */
-    $mod      = 0;
-    $output   = "";
-    if(count($this->report_list) < $this->start){
-      $this->start = 0;
-    }
-    foreach($this->report_list as $val){
-      if ($mod < $this->start) {
-        $mod++;
-        continue;
-      }
-      if ($mod >= ($this->start + $this->range)){
-        $mod++;
-        break;
-      }
-      if ( ($mod++) & 1){
-        $col= "background-color: #ECECEC;";
-      } else {
-        $col= "background-color: #F5F5F5;";
-      }
-      $output.= "<tr style=\"height:22px; $col\">$val</tr>";
-    }
-
-    /*****************
-      Tell smarty what we have found  
-     *****************/
-
-    if ($output != ""){
-      $smarty->assign("search_result", $output);
-      $smarty->assign("range_selector", range_selector(count($this->report_list), $this->start,$this->range,"EntryPerPage"));
-    } else {
-      $smarty->assign("search_result", "");
-    }
-
-    /* Show main page */
-    for($i= 0; $i<7; $i++){
-      $smarty->assign("mode$i", "");
-    }
-    $smarty->assign("mode".$this->sort, "<img alt=\"\" src=\"images/sort_".$this->sort_direction.".png\" border=0 align=middle>");
-
-    return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
-  }
-
-  
-  /* Create duration string   12'11" */
-  function gen_duration($seconds)
-  {
-    if ($seconds / 60 > 1){
-      $minutes= (int)($seconds / 60);
-      $seconds= $seconds % 60;
-      return ("$minutes&rsquo;$seconds&rdquo;");
-    }
-    return ("$seconds&rdquo;");
-  }
-
-
-  /* Create WHERE part for our mysql serach */
-  function GetUidMatchingFilter()
-  {
-    $ldap       = $this->config->get_ldap_link();
-    $ldap->cd     ($this->search_base);
-    $s          = $this->search_for;
-
-    $s          = preg_replace("/\%/","",$s);  
-    $s2         = preg_replace("/\*/","%",$s);  
-
-    $filter = "(&(objectClass=gosaAccount)(!(objectClass=gosaUserTemplate))".
-        "(|(uid=$s)(l=$s)(homePhone=$s)(telephoneNumber=$s)(facsimileTelephoneNumber=$s)(mobile=$s)".
-        "(pager=$s)(cn=$s)(givenName=$s)(sn=$s)(personalTitle=$s)(title=$s)))";
-
-    $attrs  = array("uid");
-    $res    = get_list($filter,"users",$this->search_base,$attrs);
-    
-    $str = " AND (";
-    $fields = array("dstchannel","channel");
-    if(count($res)){
-      foreach($res as $attrs){
-        $uid =  $attrs["uid"][0];
-        foreach($fields as $name){
-          $str .= $name." like '%".$uid."%' OR ";
-        }
-      }
-    }
-    $str .= " channel     like '%".$s."%' OR  
-              dstchannel  like '%".$s."%' OR  
-              dst         like '".$s2."' OR 
-              src         like '".$s2."' OR 
-              lastapp     like '".$s2."')"; 
-    return($str);
-  }
-
-
-  /* Create query string */
-  function CreateQuerySyntax()
-  {
-    /* Get extended search filter which contain uids and so on */
-    $uidstring = $this->GetUidMatchingFilter();
-
-    /* Create string with all fields seperated by ,*/
-    $fields_str ="";
-    foreach($this->fields as $field){
-      if($field == "calldate") {
-        continue;      
-      }
-      $fields_str .= $field.", ";
-    }
-    $fields_str = preg_replace("/, $/","",$fields_str);
-
-    /* Create Sort tag */
-    if ($this->sort_direction == "down"){
-      $desc= "DESC";
-    } else {
-      $desc= "ASC";
-    }
-    /* Create times */
-    $start= date ("YmdHis", mktime(0,0,0,$this->month,1,$this->year));
-    $end=   date ("YmdHis", mktime(23,59,59,($this->month +1),0,$this->year));
-    $query = "SELECT ".$fields_str.",calldate FROM cdr ".
-      "WHERE   
-      calldate <= $end 
-      AND 
-      calldate >= $start 
-      ". $uidstring." 
-      ORDER BY ".$this->fields[$this->sort]." $desc;";
-    return($query);
-  }
-
-
-  /* Return plugin informations for acl handling 
-     #FIXME You can only read attributes within this report plugin */
-  static function plInfo()
-  {
-    return (array(
-        "plShortName"   => _("Phone reports"),
-        "plDescription" => _("Phone reports")."&nbsp;<i>"._("All entries are readonly")."</i>",
-        "plSelfModify"  => TRUE,
-        "plDepends"     => array(),
-        "plPriority"    => 0,
-        "plSection"     => array("administration"),
-        "plCategory"    => array("fonreport"),
-  
-        "plProvidedAcls" => array(
-          "calldate"      =>_("Date"), 
-          "src"           =>_("Source"), 
-          "dst"           =>_("Destination"), 
-          "channel"       =>_("Channel"), 
-          "lastapp"       =>_("Application called"),
-          "disposition"   =>_("Disposition"), 
-          "duration"      =>_("Duration"))
-        ));
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/gofon/fonreports/contents.tpl b/plugins/gofon/fonreports/contents.tpl
deleted file mode 100644 (file)
index d8cf0a4..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-<div class="contentboxh">
- <p class="contentboxh"><img src="{$launchimage}" align="right" alt="[F]">{t}Filter{/t}</p>
-</div>
-<div class="contentboxb">
- <p class="contentboxb" style="border-top:1px solid #B0B0B0; padding-top:5px;">
- <img class="center" alt="" align="middle" border=0 src="{$search_image}">&nbsp;{t}Search for{/t}
- <input name="search_for" size=25 maxlength=60 value="{$search_for}" title="{t}Enter user name to search for{/t}" onChange="mainform.submit()">
- {t}in{/t}
- <select size="1" name="search_base" title="{t}Select subtree to base search on{/t}" onChange="mainform.submit()">
-  {html_options options=$bases selected=$base_select}
- </select>
- {t}during{/t}
- <select size="1" name="month" onChange="mainform.submit()">
-  {html_options options=$months selected=$month_select}
- </select>
- {t}in{/t} 
- <select size="1" name="year" onChange="mainform.submit()">
-  {html_options values=$years output=$years selected=$year_select}
- </select>
- &nbsp;
- <input type=submit name="search" value="{t}Search{/t}">
-</p>
-</div>
-
-<br>
-
-{if $search_result }
- <table style="width:100%; vertical-align:top; text-align:left; border:1px solid #B0B0B0;" cellpadding=2 cellspacing=1 border=0 rules="cols" summary="">
-  <tr style="background-color: #E8E8E8; height:26px; font-weight:bold">
-   <td><a href="main.php{$plug}&amp;sort=0">{t}Date{/t} {$mode0}</a></td>
-   <td><a href="main.php{$plug}&amp;sort=1">{t}Source{/t} {$mode1}</a></td>
-   <td><a href="main.php{$plug}&amp;sort=2">{t}Destination{/t} {$mode2}</a></td>       
-   <td><a href="main.php{$plug}&amp;sort=3">{t}Channel{/t} {$mode3}</a></td>   
-   <td><a href="main.php{$plug}&amp;sort=4">{t}Application{/t} {$mode4}</a></td>       
-   <td><a href="main.php{$plug}&amp;sort=5">{t}Status{/t} {$mode5}</a></td>    
-   <td><a href="main.php{$plug}&amp;sort=6">{t}Duration{/t} {$mode6}</a></td>  
-  </tr>
-  {$search_result}
- </table>
-
- <table style="width:100%; vertical-align:top; text-align:center;" cellpadding=4 cellspacing=0 border=0 summary="">
-  <tr>
-   <td>{$range_selector}</td>
-  </tr>
- </table>
-
-<p class="plugbottom">
- &nbsp;
-</p>
-{else}
-  <b>{t}Search returned no results...{/t}</b>
-{/if}
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('search_for');
-  -->
-</script>
diff --git a/plugins/gofon/fonreports/main.inc b/plugins/gofon/fonreports/main.inc
deleted file mode 100644 (file)
index 5d1741d..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-<?php
-
-if (!$remove_lock){
-       /* Create fonreport object on demand */
-       if (!isset($_SESSION['fonreport']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
-               $_SESSION['fonreport']= new fonreport ($config, $ui);
-       }
-       $fonreport= $_SESSION['fonreport'];
-
-       /* Execute formular */
-       $fonreport->save_object();
-       $display= $fonreport->execute ();
-       $display.= "<input type=\"hidden\" name=\"ignore\">\n";
-
-       /* Page header*/
-       $display= print_header(get_template_path('images/phonereport.png'), _("Phone reports")).$display;
-
-       /* Store changes  in session */
-       $_SESSION['fonreport']= $fonreport;
-}
-?>
diff --git a/plugins/gofon/macro/class_divListMacros.inc b/plugins/gofon/macro/class_divListMacros.inc
deleted file mode 100755 (executable)
index de822bb..0000000
+++ /dev/null
@@ -1,298 +0,0 @@
-<?php
-
-class divListMacro extends MultiSelectWindow
-{
-
-  /* Current base */
-  var $selectedBase       = "";
-  var $departments        = array();
-
-  /* Regex */
-  var $Regex              = "*";
-
-  /* checkboxes */
-  var $ShowSendBocklists      ;
-  var $ShowReceiveMacros  ;
-
-  /* Subsearch checkbox */
-  var $SubSearch;
-
-  var $parent             ;
-  var $ui                 ;
-
-  function divListMacro (&$config,$parent)
-  {
-    MultiSelectWindow::MultiSelectWindow($config,"Macros", "gofonmacro");
-    
-    $this->parent       = $parent;
-    $this->ui           = get_userinfo();
-
-    /* Set list strings */
-    $this->SetTitle(_("List of macros"));
-    $this->SetSummary(_("List of macros"));
-
-    /* Result page will look like a headpage */
-    $this->SetHeadpageMode();
-    $this->SetInformation(_("This menu allows you to add, edit and remove selected macros. You may want to use the range selector on top of the macro listbox, when working with a large number of macros."));
-
-    $this->EnableAplhabet   (true);
-  
-    /* Disable buttonsm */
-    $this->EnableCloseButton(false);
-    $this->EnableSaveButton (false);
-
-    /* Dynamic action col, depending on snapshot icons */
-    $action_col_size = 100;
-    if($this->parent->snapshotEnabled()){
-      $action_col_size += 20;
-    }
-
-    /* Toggle all selected / deselected */
-    $chk = "<input type='checkbox' id='select_all' name='select_all'
-               onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
-
-    /* set Page header */
-    $this->AddHeader(array("string"=> $chk,          "attach"=>"style='width:20px;'"));
-    $this->AddHeader(array("string" => "&nbsp;", "attach" => "style='text-align:center;width:20px;'"));
-    $this->AddHeader(array("string" => _("Macro name")." / "._("Department"), "attach" => "style=''"));
-    $this->AddHeader(array("string" => _("Visible"), "attach" => "style='width:50px;'"));
-    $this->AddHeader(array("string" => _("Actions"), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'" ));
-
-    /* Add Checkboxes / SubSearch checkbox */
-    $this->AddCheckBox("SubSearch",  _("Select to search within subtrees"), _("Search in subtrees"), false);
-
-    /*                  Name                 ,Text                              ,Default  , Connect with alphabet  */
-    $this->AddRegex   ("Regex",     _("Regular expression for matching macro names"),"*" , true);
-  }
-
-  function GenHeader()
-  {
-    /* Prepare departments,
-       which are shown in the listbox on top of the listbox
-     */
-    $options= "";
-
-    /* Get all departments within this subtree */
-    $base = $this->config->current['BASE'];
-    $first = "";
-    $found = FALSE;
-
-    /* Add base */
-    $tmp = array();
-    $tmp[] = array("dn"=>$this->config->current['BASE']);
-    $tmp=  array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
-                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
-
-    $deps = array();
-    foreach($tmp as $tm){
-      $deps[$tm['dn']] = $tm['dn'];
-    }
-
-    /* Load possible departments */
-    $ui= get_userinfo();
-    $tdeps= $ui->get_module_departments("gofonmacro");
-    $ids = $this->config->idepartments;
-    $first = "";
-    $found = FALSE;
-    foreach($ids as $dep => $name){
-      if(isset($deps[$dep]) && in_array_ics($dep, $tdeps)){
-
-        /* Keep first base dn in mind, we could need this
-         *  info if no valid base was found
-         */
-        if(empty($first)) {
-          $first = $dep['dn'];
-        }
-
-        $value = $ids[$dep];
-        if ($this->selectedBase == $dep){
-          $found = TRUE;
-          $options.= "<option selected='selected' value='".$dep."'>$value</option>";
-        } else {
-          $options.= "<option value='".$dep."'>$value</option>";
-        }
-      }
-    }
-
-    /* The currently used base is not visible with your acl setup.
-     * Set base to first useable base.
-     */
-    if(!$found){
-      $this->selectedBase = $first;
-    }
-
-    $acls  = $ui->get_permissions($this->selectedBase,"gofonmacro/macro");
-
-    /* Add default header */
-    $listhead = MultiSelectWindow::get_default_header();
-    $listhead .= _("Base")."&nbsp;<select name='CurrentMainBase' 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;";
-    
-    /* Create Layers menu */
-    $s  = ".|"._("Actions")."|\n";
-    $s .= "..|<img src='images/list_new.png' alt='' border='0' class='center'>".
-      "&nbsp;"._("Create")."|\n";
-
-    /* Append create options */
-    if(preg_match("/c/",$acls)){
-      $s.= "...|<input class='center' type='image' src='images/list_new_macro.png' alt=''>".
-        "&nbsp;"._("Macro")."|goFonMacro_new|\n";
-    }
-
-    /* Multiple options */
-    $s.= "..|---|\n";
-    $s.= "..|<img src='images/edittrash.png' alt='' border='0' class='center'>".
-      "&nbsp;"._("Remove")."|"."remove_multiple|\n";
-
-    /* Add multiple copy & cut icons */
-    if(preg_match("/(c.*w|w.*c)/",$acls) && is_object( $this->parent->CopyPasteHandler)){
-      $s.= "..|---|\n";
-      $s.= "..|<img src='images/editcopy.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Copy")."|"."multiple_copy_systems|\n";
-      $s.= "..|<img src='images/editcut.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Cut")."|"."multiple_cut_systems|\n";
-
-      if($this->parent->CopyPasteHandler->entries_queued()){
-        $img = "<img border='0' class='center' src='images/editpaste.png' alt=''>";
-        $s.="..|".$img."&nbsp;"._("Paste")."|editPaste|\n";
-      }else{
-        $img = "<img border='0' class='center' src='images/cant_editpaste.png' alt=''>";
-        $s.="..|".$img."&nbsp;"._("Paste")."\n";
-      }
-    }
-
-    /* Add snapshot icons */
-    if(preg_match("/(c.*w|w.*c)/",$acls)){
-      $s .= "..|---|\n";
-      $s .= $this->get_snapshot_header(TRUE);
-    }
-
-    $this->SetDropDownHeaderMenu($s);
-
-
-
-
-    $this->SetListHeader($listhead);
-  }
-
-  function execute()
-  {
-    $this->ClearElementsList();
-    $this->GenHeader();
-  }
-
-  function setEntries($list)
-  {
-  
-    $empty      = "<img class='center' src='images/nothing.png' style='width:16px;height:16px;' alt=''>";
-    $macroimg   = "<img class='center' src='images/list_macro.png' alt='"._("Macro")."' title='%s'>";
-    $visible    = "<img class='center' src='images/true.png' alt='"._("yes")."' title='"._("visible")."'>";
-    $invisible  = "<img class='center' src='images/false.png' alt='"._("no")."'title='"._("invisible")."'>";
-    $editlink   = "<a href='?plug=".$_GET['plug']."&amp;id=%s&amp;act=edit_entry'>%s</a>";
-
-    /* Dynamic action col, depending on snapshot icons */
-    $action_col_size = 100;
-    if($this->parent->snapshotEnabled()){
-      $action_col_size += 20;
-    }
-
-    $ui = get_userinfo();
-
-    foreach($list as $key => $val){
-       
-      $sacl  = $ui->get_permissions($val['dn'],"gofonmacro/macro");
-
-      $action = "";
-      if(!preg_match("/r/",$sacl)){
-        continue;
-      }
-
-      if(($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$sacl)){
-        $action.= "<input class='center' type='image'
-          src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
-        $action.= "<input class='center' type='image'
-          src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
-      }
-
-      $action.= "<input class='center' type='image' src='images/edit.png' alt='"._("edit")."'     
-        name='goFonMacro_edit_%KEY%' title='"._("Edit macro")."'>";
-
-      if(preg_match("/c/",$sacl) && preg_match("/w/",$sacl)){
-        $action.= $this->GetSnapShotActions($val['dn']); 
-      }
-
-      if(preg_match("/d/",$sacl)){
-        $action.= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."'   
-          name='goFonMacro_del_%KEY%' title='"._("Delete macro")."'>";
-      }
-
-      if(isset($val['goFonMacroVisible']['0'])&&($val['goFonMacroVisible']['0'] == "1")){
-        $pic1 = $visible;
-      }else{
-        $pic1 = $invisible;
-      }
-
-      $display= $val["displayName"][0]."&nbsp;(".$val["cn"][0].")";
-      if(isset($val['description'][0])){
-
-        $desc = $val['description'][0];
-        if(strlen($desc) > 55){
-          $desc = substr($desc,0,52)."...";
-        }
-
-        $display .= "&nbsp;[".$desc."]";
-      }
-
-      /* Cutted objects should be displayed in light grey */
-      if($this->parent->CopyPasteHandler){
-        foreach($this->parent->CopyPasteHandler->queue as $queue_key => $queue_data){
-          if($queue_data['dn'] == $val['dn']) {
-            $display = "<font color='#999999'>".$display."</font>";
-            break;
-          }
-        }
-      }
-
-      /* Create each field */
-      $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
-                      "attach" => "style='width:20px;'");
-      $field1 = array("string" => sprintf($macroimg,$val['dn']), "attach" => "style='text-align:center;width:20px;'");
-      $field2 = array("string" => sprintf($editlink,$key,$display), "attach" => "style='' title='".preg_replace('/ /', '&nbsp;', @LDAP::fix($val['dn']))."'");
-      $field3 = array("string" => $pic1, "attach" => "style='width:50px;'");
-      $field4 = array("string" => preg_replace("/%KEY%/", "$key", $action), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'");
-
-      $this->AddElement(array($field0,$field1,$field2,$field3,$field4));
-    }
-
-    /* Create summary string for list footer */
-    $num_deps=0;
-    if(!$this->SubSearch){
-      $num_deps = count($this->Added_Departments);
-    }
-    $num_objs = count($list);
-
-    $num_obj_str = _("Number of listed macros");
-    $num_dep_str = _("Number of listed departments");
-
-    $str = "<img class='center' src='images/select_macro.png'
-              title='".$num_obj_str."' alt='".$num_obj_str."'>&nbsp;".$num_objs."&nbsp;&nbsp;&nbsp;&nbsp;";
-    $str.= "<img class='center' src='images/folder.png'
-              title='".$num_dep_str."' alt='".$num_dep_str."'>&nbsp;".$num_deps."&nbsp;&nbsp;&nbsp;&nbsp;";
-
-    $this->set_List_Bottom_Info($str);
-  }
-
-  function Save()
-  {
-    MultiSelectWindow :: Save();  
-  }
-
-  function save_object()
-  {
-    /* Save automatic created POSTs like regex, checkboxes */
-    MultiSelectWindow :: save_object();   
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/gofon/macro/class_gofonMacro.inc b/plugins/gofon/macro/class_gofonMacro.inc
deleted file mode 100755 (executable)
index 1dbb4ee..0000000
+++ /dev/null
@@ -1,593 +0,0 @@
-<?php
-
-//!  The Phone Macro Class: Handles Macro Contents, and some attributes. 
-/*!
-     This class handles the basic information about phone macros, like
-     cn base description displayName goFonMacroContent goFonMacroVisible
-
-     This is not the only Class that manages phone Macros, there ist also the class_goFonMacroParameter.
-*/
-class macro extends plugin
-{
-  /*! CLI vars */
-  var $cli_summary= "Handling of GOsa's macro object";
-  /*! CLI vars */
-  var $cli_description= "Some longer text\nfor help";
-  /*! CLI vars */
-  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /*! Macro attributes,  */
-  var $generate_error= "";
-  
-  /*! The name of the Macro in the openldap drirectory */
-  var $cn               = ""; 
-  /*! Display error once */
-  var $error_shown = false; 
-
-  /*! This ist the variable that contains the description of the macro*/
-  var $description      = "";
-
-  /*! The base of the macro, is used to save the macro in the correct directory tree */
-  var $base             = "";
-
-  /*! This is the name of the macro which the enduser will see, instead of the cn */
-  var $displayName      = "";
-    
-  /*! Here is the macro content, the real macroscript */
-  var $goFonMacroContent= "";
-  
-  /*! To allow user to use this macro this var must be true, else false */
-  var $goFonMacroVisible= 0;
-
-  /*! attribute list for save action */
-  var $attributes     = array("cn","base", "description","displayName","goFonMacroContent","goFonMacroVisible");
-  var $view_logged = FALSE;
-  var $orig_cn = ""; 
-  /*! Objectclasses that this calls handles */
-  var $objectclasses  = array("top", "goFonMacro");
-
-  var $goFonHomeServers = array(); // Contains all available asterisk database server 
-
-  //! The Konstructor   
-  /*!  Konstructor, load class with  attributes of the given dn*/
-  function macro (&$config, $dn= NULL, $parent= NULL)
-  {
-    plugin::plugin ($config, $dn, $parent);
-
-    /* This is always an account */
-    $this->is_account= TRUE;
-
-    /* Edit or new one ?*/
-    if ($this->dn == "new"){
-      if(isset($_SESSION['CurrentMainBase'])){
-        $this->base = $_SESSION['CurrentMainBase'];
-      }else{
-        $ui= get_userinfo();
-        $this->base= dn2base($ui->dn);
-      }
-    } else {
-      $this->orig_cn=$this->cn;
-      $this->base= preg_replace ("/^[^,]+,[^,]+,[^,]+,[^,]+,[^,]+,/", "", $this->dn);
-    }
-
-    /* Check server configurations
-     * Load all server configuration in $this->goFonHomeServers if available
-     */
-    $a_SETUP= array();
-    if(array_key_exists('config',$_SESSION) &&
-       array_key_exists('SERVERS',$_SESSION['config']->data) &&
-       count($_SESSION['config']->data['SERVERS']['FON']) && 
-       array_key_exists('FON',$_SESSION['config']->data['SERVERS'])) {
-
-      /* Set available server */
-      $this->goFonHomeServers = $_SESSION['config']->data['SERVERS']['FON'];
-  
-      /* Remove default entry, not necessary here */
-      if(isset($this->goFonHomeServers[0])){
-        unset($this->goFonHomeServers[0]);  
-      }
-    }
-  }
-
-
-  /*!  Execute this plugin */
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* Log view */
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","gofonmacro/".get_class($this),$this->dn);
-    }
-
-    /* Variables */
-    $vars      = "";
-    $tmp       = array();
-    $number = 0; 
-
-    /* Base select dialog */
-    $once = true;
-    foreach($_POST as $name => $value){
-      if(preg_match("/^chooseBase/",$name) && $once){
-        $once = false;
-        $this->dialog = new baseSelectDialog($this->config,$this,$this->allowedBasesToMoveTo());
-        $this->dialog->setCurrentBase($this->base);
-      }
-    }
-
-    /* Dialog handling */
-    if(is_object($this->dialog)){
-      /* Must be called before save_object */
-      $this->dialog->save_object();
-
-      if($this->dialog->isClosed()){
-        $this->dialog = false;
-      }elseif($this->dialog->isSelected()){
-
-        /* A new base was selected, check if it is a valid one */
-        $tmp = $this->get_allowed_bases();
-        if(isset($tmp[$this->dialog->isSelected()])){
-          $this->base = $this->dialog->isSelected();
-        }
-
-        $this->dialog= false;
-      }else{
-        return($this->dialog->execute());
-      }
-    }
-
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-    $smarty->assign("bases", $this->get_allowed_bases());
-
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translation){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-
-    if($this->acl_is_writeable("base")){
-      $smarty->assign("baseSelect",true);
-    }else{
-      $smarty->assign("baseSelect",false);
-    }
-
-
-    /* Assign all vars to Smarty */
-    foreach($this->attributes as $ar){
-      $smarty->assign($ar, $this->$ar);
-    }
-    /* Checkboxes */
-    $smarty->assign("base_select", $this->base);
-    $smarty->assign("vars", $vars);
-
-    if($this->goFonMacroVisible){
-      $smarty->assign("goFonMacroVisibleChecked"," checked ");
-    }else{
-      $smarty->assign("goFonMacroVisibleChecked","");
-    }
-
-    $smarty->assign("cnACL",$this->getacl("cn",$this->initially_was_account));
-    $smarty->assign("cn",$this->cn);
-
-    /* Ensure that macro content is displayed correctly encoded */
-    $smarty->assign("goFonMacroContent",htmlentities(utf8_decode ($this->goFonMacroContent)));
-
-    /* Show main page */
-    return($smarty->fetch (get_template_path('generic.tpl', TRUE)));
-  }
-
-
-  /* This method check if all databases are reachable.  
-   *  Returns with error message or an empty string on success.
-   * 
-   * - Is mysql extension available  
-   * - Is every server reachable 
-   * - Does the database exists/is accessible
-   */
-  function check_database_accessibility()
-  {
-    /* Check if mysql extension is available */
-    if(!is_callable("mysql_pconnect")){
-      return(_("Can't save any changes to asterisk database, there is currently no mysql extension available in your php setup."));
-    }
-
-    /********************
-     * Check all home server
-     ********************/
-    foreach($this->goFonHomeServers as $goFonHomeServer => $cfg_Current){
-      $r_current    =  @mysql_pconnect($cfg_Current['SERVER'],$cfg_Current['LOGIN'],$cfg_Current['PASSWORD']);
-      if(!$r_current){
-        new log("debug","gofonmacro/".get_class($this),"",array(),@mysql_error($r_current));
-        return(sprintf(_("The MySQL home server '%s' isn't reachable as user '%s', check GOsa log for mysql error."),
-              $cfg_Current['SERVER'],$cfg_Current['LOGIN']));
-      }
-      $db_current  =  @mysql_select_db($cfg_Current['DB'],$r_current);
-      if(!$db_current){
-        new log("debug","gofonmacro/".get_class($this),"",array(),@mysql_error($r_current));
-        mysql_close($r_current);
-        return( sprintf(_("Can't select database '%s' on home server '%s'."),$cfg_Current['DB'],$cfg_Current['SERVER']));
-      }
-    }
-  }
-
-
-  /* Remove current macro from all asterisk server.
-   * First of all check if we have access to all databases. 
-   * - Remove old entries 
-   */ 
-  function remove_from_database($save)
-  {
-    /* Check if all databases are reachable */
-    $str = $this->check_database_accessibility();
-    if($str){
-      return($str);
-    }
-
-    /* Create query string */
-    $context  = addslashes("macro-".$this->cn);
-
-    /* Remove current macro from each server available */ 
-    if($save){
-      foreach($this->goFonHomeServers as $dn => $Server){
-        $query      = "DELETE FROM ".$Server['EXT_TABLE']." WHERE context='".$context."';";
-        $r_current  =  @mysql_pconnect($Server['SERVER'],$Server['LOGIN'],$Server['PASSWORD']);
-        $db_current =  @mysql_select_db($Server['DB'],$r_current);
-        $res = @mysql_query($query,$r_current);
-        @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query, "Database query");
-        if(!$res){
-          new log("debug","gofonmacro/".get_class($this),"",array(),@mysql_error($r_current));
-          return(sprintf(_("Removing macro from '%s' failed. Check GOsa log for mysql error."),$Server['SERVER']));
-        }
-        @mysql_close($r_current);
-      }
-    }
-  }
-
-  /* Add current macro to all asterisk server.
-   * First of all check if we have access to all databases. 
-   * - Remove old entries 
-   * - Add new entries 
-   */ 
-  function add_to_database($save)
-  {
-    /* Check if all databases are reachable */
-    $str = $this->check_database_accessibility();
-    if($str){
-      return($str);
-    }
-
-    /* Remove old entries first. Else we got duplicated entries */
-    $str = $this->remove_from_database($save);
-    if($str){
-      return($str);
-    }
-
-    /* Create query string */
-    $context      = "macro-".$this->cn;
-
-    /************
-     * Parse Macro content
-     ************/
-    $sql = 
-      "INSERT INTO %TABLENAME% ".
-      " (context,exten,priority,app,appdata) ".
-      " VALUES ";
-      
-    $a_contentLines = split("\n",$this->goFonMacroContent);
-    foreach($a_contentLines as $i_linenum => $s_linestr){
-
-      /* Remove the 'exten => ' string in front of the macro content line 
-       *  example line  'exten => s,2,GotoIf(${ARG3}?3:5)'
-       * Remove comments introduced by ;
-       * Skip empty lines 
-       */ 
-      $s_linestr = trim($s_linestr);
-      $s_linestr = preg_replace("/;.*$/","",$s_linestr) ;
-      $s_linestr = preg_replace ("/^.*=\> /","",$s_linestr);
-
-      if(empty($s_linestr)){
-        continue;
-      }
-
-      /* A line that passes the check above should look like this 
-       *  s,1,SetLanguage(de)
-       * 3 parts seperated by , 
-       * If there are more or less parts, abort.
-       * The preg_replace exclude parameters from split .. 
-       */
-      $tmp  = split(",", $s_linestr,3);
-
-      /* Check if there are exactly 2 , */ 
-#      if(substr_count($s_linestr,",") !=2){
-#        return(sprintf(_("More than two ',' given in line : '%s'. Remember that parameters are seperated by '|'."),$i_linenum));
-#      }
-      /* Multiple () are not supproted currently ... */  
-      if(substr_count($s_linestr,"(") >1 ){
-        return(sprintf(_("More than one '(' is currently not supported. Line : '%s'."),$i_linenum));
-      }
-      if(substr_count($s_linestr,")") >1 ){
-        return(sprintf(_("More than one ')' is currently not supported. Line : '%s'."),$i_linenum));
-      }
-      /* Check if there is an application given */
-      if(empty($tmp[1])){
-        return(sprintf(_("There is no application given in line : '%s'."),$i_linenum));
-      } 
-      /* Check if there is an extension given */
-      if(empty($tmp[0])){
-        return(sprintf(_("There is no extension type given in line : '%s'."),$i_linenum));
-      } 
-
-      /* Create extension entry for current line 
-       *  and add this line to an array that will be inserted 
-       *  to each database.
-       */
-      $exten  = addslashes($tmp[0]);
-      $prio   = addslashes($tmp[1]);
-      $app    = addslashes(preg_replace("/\(.*\).*$/","",$tmp[2]));
-      $para   = addslashes(preg_replace("/^.*\(/","",$tmp[2]));
-      $para   = preg_replace("/\).*$/","",$para);
-      $sql.= " ('".$context."','".$exten."','".$prio."','".$app."','".$para."'),";
-    }
-    
-    /* Remove last , from query string */
-    $sql = preg_replace("/,$/","",$sql);
-
-    /* Save current changes to the database */
-    if($save){
-    
-      /* Macro are spread to each asterisk server */
-      foreach($this->goFonHomeServers as $dn => $cfg){
-        $r_con  = @mysql_pconnect($cfg['SERVER'],$cfg['LOGIN'],$cfg['PASSWORD']); 
-        $db     = @mysql_select_db($cfg['DB'],$r_con);
-        $query  = preg_replace("/%TABLENAME%/",$cfg['EXT_TABLE'],$sql);
-        $res    = @mysql_query($query,$r_con);
-        @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query, "Database query");
-        if(!$res){
-          new log("debug","gofonmacro/".get_class($this),"",array(),@mysql_error($r_con));
-          return(sprintf(_("Insert of new macro failed for server '%s'."),$cfg['SERVER']));
-        }
-        @mysql_close($r_con);
-      }
-    }
-  }
-
-
-  function save_object()
-  {
-    if (isset($_POST['gofonMacroGenericPosted'])){
-
-      $old_cn       = $this->cn;
-      $old_visible  = $this->goFonMacroVisible;
-
-      /* Create a base backup and reset the
-         base directly after calling plugin::save_object();
-         Base will be set seperatly a few lines below */
-      $base_tmp = $this->base;
-      plugin::save_object();
-      $this->base = $base_tmp;
-
-      /* Save base, since this is no LDAP attribute */
-      $tmp = $this->get_allowed_bases();
-      if(isset($_POST['base'])){
-        if(isset($tmp[$_POST['base']])){
-          $this->base= $_POST['base'];
-        }
-      }
-
-      /* Restore old cn if we have insuficient acls to change cn ... */
-      if(!$this->acl_is_writeable("cn",$this->initially_was_account)){
-        $this->cn = $old_cn;
-      }
-
-      /* check if we are allowed to toggle visibility */
-      if($this->acl_is_writeable("goFonMacroVisible")) {
-
-        /* Checkbox selected ? */
-        if(isset($_POST['goFonMacroVisible'])) {
-          $this->goFonMacroVisible= 1 ;
-        }else  {
-          if(isset($_POST['displayName'])){
-            $this->goFonMacroVisible= 0 ;
-          }
-        }
-      }else{
-        $this->goFonMacroVisible = $old_visible;
-      }
-    }
-  }
-
-
-  /*! Check values */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    if(!count($this->goFonHomeServers)){
-      $message[] = _("There must be at least one server with an asterisk database to save this phone macro.");
-    }
-
-    /* Check if insert/replace is possible and all servers are available */
-    $str = $this->add_to_database(false);
-    if($str){
-      $message[] = $str;
-    }
-
-    /* Check if cn is already used  */
-    if(($this->dn=="new")||($this->orig_cn!=$this->cn)){
-      $ldap = $this->config->get_ldap_link();
-      $ldap->search("(&(objectClass=goFonMacro)(cn=".$this->cn."))",array("cn"));
-      if($ldap->count()>0){
-        $message[]=sprintf(_("The given cn '%s' already exists."),$this->cn);
-      }
-    }
-  
-    /* Check if display name is set */
-    if(empty($this->displayName)){
-      $message[] = _("You must specify the 'Display Name' in order to save this macro");
-    }  
-    /* CN is restricted to 20 chars */
-    if(strlen("Makro-".$this->cn)>20 ){
-      $message[]=_("The given cn is too long, to create a Makro entry, maximum 20 chars.");
-    }
-  
-    /* If this macro is still in use we should not change the visible for user flag to invisible */
-    if(!$this->goFonMacroVisible){
-      $ldap = $this->config->get_ldap_link();
-      $res = $ldap->search("(&(objectClass=goFonAccount)(objectClass=gosaAccount)(goFonMacro=*))", array("goFonMacro"));
-      while ($val = $ldap->fetch()){
-        if(strstr($val['goFonMacro'][0],$this->dn)){
-          $message[] = _("This macro is still in use. It is necessary to mark this macro as visible for users.");
-          return($message);
-        }
-      }
-    }
-
-    /* Macro content must be smaller than 100 lines */
-    if(count(split("\n",$this->goFonMacroContent))>100){
-      $message[] = _("Makro length must be lower than 100 lines");
-    }
-
-    /* Macro content must be smaller than 100 lines */
-    if(empty($this->goFonMacroContent)){
-      $message[] = _("You can't save an empty macro.");
-    }
-    return $message;
-  }
-
-
-  /*! Remove makro from all given databases 
-   *   and ldap too.
-   */
-  function remove_from_parent()
-  {
-    $ldap= $this->config->get_ldap_link();
-
-    /* Skip remove if this macro is still in use */
-    $res = $ldap->search("(&(objectClass=goFonAccount)(objectClass=gosaAccount)(goFonMacro=*))", array("goFonMacro"));
-    while ($val = $ldap->fetch()){ 
-      if(strstr($val['goFonMacro'][0],$this->dn)){ 
-        print_red(_("This macro is still in use. To delete this Macro ensure that nobody has selected it."));
-        return false;
-      }
-    }
-
-    /* Try to remove from database */
-    if(count($this->goFonHomeServers)){
-      $str = $this->remove_from_database(true);
-      if($str){ 
-        print_red($str);
-        return false;
-      }
-    }else{
-      print_red(_("Could not remove the macro entry from asterisk databases. Please check your asterisk database configurations."));
-      return false;
-    }
-
-    /* Remove phone macro */ 
-    $ldap->rmDir($this->dn);
-    new log("remove","gofonmacro/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); 
-    show_ldap_error($ldap->get_error(), sprintf(_("Removing of goFonMacro/generic account with dn '%s' failed."),$this->dn));
-
-    /* Delete references to object groups */
-    $ldap->cd ($this->config->current['BASE']);
-    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
-    while ($ldap->fetch()){
-      $og= new ogroup($this->config, $ldap->getDN());
-      unset($og->member[$this->dn]);
-      $og->save ();
-      show_ldap_error($ldap->get_error(), sprintf(_("Removing of goFonMacro/generic account with dn '%s' failed."),$this->dn));
-    }
-  }
-
-
-  /*! Save to LDAP */
-  function save()
-  {
-    plugin::save();
-    unset($this->attrs['base']);
-
-    /* Try to add entries to databases */
-    $str = $this->add_to_database(true);
-    if($str){
-      print_red($str);
-    }else{
-      /* Write back to ldap */
-      $ldap= $this->config->get_ldap_link();
-      $ldap->cat($this->dn, array('dn'));
-      $a= $ldap->fetch();
-
-      if (count($a)){
-        $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(preg_replace('/^[^,]+,/', '', $this->dn));
-        $ldap->cd($this->dn);
-        $ldap->add($this->attrs);
-        $this->handle_post_events("add");
-      }
-      show_ldap_error($ldap->get_error(), sprintf(_("Saving of goFonMacro/generic account with dn '%s' failed."),$this->dn));
-
-      /* Log last action */
-      if($this->initially_was_account){
-        new log("modify","gofonmacro/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-      }else{
-        new log("create","gofonmacro/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-      }
-    }
-  }
-
-
-  function getCopyDialog()
-  {
-    $smarty = get_smarty();
-    $smarty->assign("cn" ,$this->cn);
-    $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE));
-    $ret = array();
-    $ret['string'] = $str;
-    $ret['status'] = "";
-    return($ret);
-  }
-
-
-  function saveCopyDialog()
-  {
-    if(isset($_POST['cn'])){
-      $this->cn = $_POST['cn'];
-    }
-  }
-
-
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("Generic"),
-          "plDescription" => _("Asterisk macro management"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 0,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("gofonmacro" => array("description" => _("GOfon macro"),
-              "objectClass" => "gofonMacro")),
-
-          "plProvidedAcls" => array(
-            "cn"                            => _("Macro name"),
-            "base"                          => _("Base"),
-            "description"                   => _("Description"),
-            "displayName"                   => _("Display name"),
-            "goFonMacroContent"             => _("Macro content and parameter"),
-            "goFonMacroVisible"             => _("Visibility flag"))
-          ));
-  }
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/gofon/macro/class_gofonMacroManagement.inc b/plugins/gofon/macro/class_gofonMacroManagement.inc
deleted file mode 100755 (executable)
index f25f495..0000000
+++ /dev/null
@@ -1,555 +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 goFonMacro extends plugin
-{
-  /* Definitions */
-  var $plHeadline                  = "Phone macros";
-  var $plDescription     = "This does something";
-
-  /* Dialog attributes */
-  var $macrotabs                   = NULL;
-  var $macros                  = array();
-  var $ui                                      = NULL;
-  var $DivListMacro     = NULL;
-
-  var $CopyPasteHandler = NULL;
-  var $start_pasting_copied_objects = FALSE;
-
-  function gofonMacro(&$config, $ui)
-  {
-    /* Save configuration for internal use */
-    $this->config= $config;
-    $this->ui= $ui;
-
-    $this->DivListMacro = new divListMacro($this->config,$this);
-
-    /* Copy & Paste enabled ?*/
-    if((isset($this->config->data['MAIN']['ENABLECOPYPASTE']))&&(preg_match("/true/i",$this->config->data['MAIN']['ENABLECOPYPASTE']))){
-      $this->CopyPasteHandler = new CopyPasteHandler($this->config);
-    }
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    $_SESSION['LOCK_VARS_TO_USE'] = array("/^goFonMacro_/","/^act$/","/^id$/","/^item_selected/","/^remove_multiple_macros/");
-
-    /*****************
-      Variable initialisation
-     *****************/
-
-    $s_action     = "";                       // Contains the action to proceed
-    $s_entry      = "";                       // The value for s_action
-    $base_back    = "";                       // The Link for Backbutton
-    $smarty= get_smarty();
-
-
-    /*****************
-      Check Posts 
-     *****************/
-
-    /* Test Posts */
-    foreach($_POST as $key => $val){
-      // Post for delete
-      if(preg_match("/^goFonMacro_del/",$key)){
-        $s_action = "del";
-        $s_entry  = preg_replace("/^goFonMacro_del_/i","",$key);
-        // Post for edit
-      }elseif(preg_match("/^goFonMacro_edit_/",$key)){
-        $s_action="edit";
-        $s_entry  = preg_replace("/^goFonMacro_edit_/i","",$key);
-        // Post for new
-      }elseif(preg_match("/^goFonMacro_new/",$key)){
-        $s_action="new";
-      }elseif(preg_match("/^remove_multiple_macros/",$key)){
-        $s_action="del_multiple";
-      }elseif(preg_match("/^editPaste.*/i",$key)){
-        $s_action="editPaste";
-      }elseif(preg_match("/^copy_.*/",$key)){
-        $s_action="copy";
-        $s_entry  = preg_replace("/^copy_/i","",$key);
-      }elseif(preg_match("/^cut_.*/",$key)){
-        $s_action="cut";
-        $s_entry  = preg_replace("/^cut_/i","",$key);
-      }elseif(preg_match("/^multiple_copy_objects/",$key)){
-        $s_action = "copy_multiple";
-      }elseif(preg_match("/^multiple_cut_objects/",$key)){
-        $s_action = "cut_multiple";
-      }
-    }
-    if((isset($_GET['act']))&&($_GET['act']=="edit_entry")){
-      $s_action ="edit";
-      $s_entry  = $_GET['id'];
-    }
-    $s_entry  = preg_replace("/_.$/","",$s_entry);
-
-
-    /********************
-      Copy & Paste Handling  ...
-     ********************/
-
-    
-    /* handle C&P from layers menu */
-    if(isset($_POST['menu_action']) && preg_match("/^multiple_copy_systems/",$_POST['menu_action'])){
-      $s_action = "copy_multiple";
-    }
-    if(isset($_POST['menu_action']) && preg_match("/^multiple_cut_systems/",$_POST['menu_action'])){
-      $s_action = "cut_multiple";
-    }
-    if(isset($_POST['menu_action']) && preg_match("/^editPaste/",$_POST['menu_action'])){
-      $s_action = "editPaste";
-    }
-
-    /* Create options */
-    if(isset($_POST['menu_action']) && $_POST['menu_action'] == "goFonMacro_new"){
-      $s_action = "new";
-    }
-
-    /* handle remove from layers menu */
-    if(isset($_POST['menu_action']) && preg_match("/^remove_multiple/",$_POST['menu_action'])){
-      $s_action = "del_multiple";
-    }
-
-    /* Display the copy & paste dialog, if it is currently open */
-    $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
-    if($ret){
-      return($ret);
-    }
-
-
-    /*****************
-      Create a new Macro 
-     *****************/
-
-    /* New macro? */
-    if ($s_action=="new"){
-
-      /* By default we set 'dn' to 'new', all relevant plugins will
-         react on this. */
-      $this->dn= "new";
-
-      /* Create new usertab object */
-      $this->macrotabs= new macrotabs($this->config,$this->config->data['TABS']['MACROTABS'], $this->dn,"gofonmacro");
-      $this->macrotabs->set_acl_base($this->DivListMacro->selectedBase);
-    }
-
-    /*****************
-      Edit || Password canceled  
-     *****************/
-
-    /* Cancel dialogs */
-    if (isset($_POST['edit_cancel'])){
-      del_lock ($this->macrotabs->dn);
-      unset ($this->macrotabs);
-      $this->macrotabs= NULL;
-      unset ($_SESSION['objectinfo']);
-    }
-
-
-    /*****************
-      Edit finised
-     *****************/
-
-    /* Finish mac edit is triggered by the tabulator dialog, so
-       the user wants to save edited data. Check and save at this
-       point. */
-    if ((isset($_POST['edit_finish']) || isset($_POST['edit_apply'])) && (isset($this->macrotabs->config))){
-
-      /* Check tabs, will feed message array */
-      $this->macrotabs->last= $this->macrotabs->current;
-      $this->macrotabs->save_object();
-      $message= $this->macrotabs->check();
-
-      /* Save, or display error message? */
-      if (count($message) == 0){
-
-        /* Save data data to ldap */
-        $this->macrotabs->save();
-
-        if (!isset($_POST['edit_apply'])){
-          /* macro has been saved successfully, remove lock from
-             LDAP. */
-          if ($this->dn != "new"){
-            del_lock ($this->dn);
-          }
-
-          unset ($this->macrotabs);
-          $this->macrotabs= NULL;
-          unset ($_SESSION['objectinfo']);
-        }
-      } else {
-        /* Ok. There seem to be errors regarding to the tab data,
-           show message and continue as usual. */
-        show_errors($message);
-      }
-    }
-
-
-    /*****************
-      Edit macro 
-     *****************/
-
-    /* User wants to edit data */
-    if (($s_action=="edit") && (!isset($this->macrotabs->config))){
-
-      $dn  = $this->macros[$s_entry]['dn'];
-      $acl = $this->ui->get_permissions($dn,"gofonmacro/macro");
-      if(preg_match("/r/",$acl)){
-        $this->dn = $dn;
-
-        /* Check locking, save current plugin in 'back_plugin', so
-           the dialog knows where to return. */
-        if (($user= get_lock($this->dn)) != ""){
-          return(gen_locked_message ($user, $this->dn));
-        }
-
-        /* Lock the current entry, so everyone will get the
-           above dialog */
-        add_lock ($this->dn, $this->ui->dn);
-        /* Register macrotabs to trigger edit dialog */
-        $this->macrotabs= new macrotabs($this->config,
-            $this->config->data['TABS']['MACROTABS'], $this->dn,"gofonmacro");
-        $_SESSION['objectinfo']= $this->dn;
-      }
-    }
-
-
-
-    /********************
-      Delete MULTIPLE entries requested, display confirm dialog
-     ********************/
-
-    if ($s_action=="del_multiple"){
-      $ids = $this->list_get_selected_items();
-
-      if(count($ids)){
-
-        foreach($ids as $id){
-          $dn = $this->macros[$id]['dn'];
-          if (($user= get_lock($dn)) != ""){
-            return(gen_locked_message ($user, $dn));
-          }
-          $this->dns[$id] = $dn;
-        }
-
-        $dns_names = "<br><pre>";
-        foreach($this->dns as $dn){
-          add_lock ($dn, $this->ui->dn);
-          $dns_names .= $dn."\n";
-        }
-        $dns_names .="</pre>";
-
-        /* Lock the current entry, so nobody will edit it during deletion */
-        $smarty->assign("intro",     sprintf(_("You're about to delete the following user(s) %s"), @LDAP::fix($dns_names)));
-        $smarty->assign("multiple", true);
-        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
-      }
-    }
-
-
-    /********************
-      Delete MULTIPLE entries confirmed
-     ********************/
-
-    /* Confirmation for deletion has been passed. Users should be deleted. */
-    if (isset($_POST['delete_multiple_macro_confirm'])){
-
-      /* Remove user by user and check acls before removeing them */
-      foreach($this->dns as $key => $dn){
-
-        $acl = $this->ui->get_permissions($dn,"gofonmacro/macro");
-        if(preg_match("/d/",$acl)){
-
-          /* Delete request is permitted, perform LDAP action */
-          $this->macrotabs= new macrotabs($this->config,$this->config->data['TABS']['MACROTABS'], $dn,"gofonmacro");
-          $this->macrotabs->delete ();
-          unset ($this->macrotabs);
-          $this->macrotabs= NULL;
-
-        } else {
-          print_red (_("You are not allowed to delete this macro!"));
-        }
-
-        /* Remove lock file after successfull deletion */
-        del_lock ($dn);
-        unset($this->dns[$key]);
-      }
-    }
-
-
-    /********************
-      Delete MULTIPLE entries Canceled
-     ********************/
-
-    /* Remove lock */
-    if(isset($_POST['delete_multiple_macro_cancel'])){
-      foreach($this->dns as $key => $dn){
-        del_lock ($dn);
-        unset($this->dns[$key]);
-      }
-    }
-
-
-    /*****************
-      Remove macro
-     *****************/
-
-    /* Remove user was requested */
-    if ($s_action=="del"){
-
-      /* Get 'dn' from posted 'uid' */
-      $dn  = $this->macros[$s_entry]['dn'];
-      $acl = $this->ui->get_permissions($dn,"gofonmacro/macro");
-
-      if(preg_match("/d/",$acl)){
-
-        $this->dn = $dn;
-  
-        /* Check locking, save current plugin in 'back_plugin', so
-           the dialog knows where to return. */
-        if (($user= get_lock($this->dn)) != ""){
-          return (gen_locked_message ($user, $this->dn));
-        }
-
-        /* Lock the current entry, so nobody will edit it during deletion */
-        add_lock ($this->dn, $this->ui->dn);
-        $smarty= get_smarty();
-        $smarty->assign("intro", sprintf(_("You're about to delete the macro '%s'."), $this->dn));
-        $smarty->assign("multiple", false);
-        return($smarty->fetch (get_template_path('remove.tpl', TRUE)));
-      } else {
-
-        /* Obviously the user isn't allowed to delete. Show message and
-           clean session. */
-        print_red (_("You are not allowed to delete this macro!"));
-      }
-    }
-
-
-    /*****************
-      Remove macro
-     *****************/
-
-    /* Confirmation for deletion has been passed. Macro should be deleted. */
-    if (isset($_POST['delete_macro_confirm'])){
-
-      $acl = $this->ui->get_permissions($this->dn,"gofonmacro/macro");
-
-      if(preg_match("/r/",$acl)){
-
-        /* Delete request is permitted, perform LDAP action */
-        $this->macrotabs= new macrotabs($this->config,$this->config->data['TABS']['MACROTABS'], $this->dn,"gofonmacro");
-        $this->macrotabs->delete ();
-        unset ($this->macrotabs);
-        $this->macrotabs= NULL;
-      } else {
-        /* Normally this shouldn't be reached, send some extra
-           logs to notify the administrator */
-        print_red (_("You are not allowed to delete this macro!"));
-        new log("security","gofonmacro/".get_class($this),$this->dn,array(),"Tried to trick deletion.");
-      }
-      /* Remove lock file after successfull deletion */
-      del_lock ($this->dn);
-    }
-
-
-    /*****************
-      Display open dialogs  
-     *****************/
-
-    /* Show tab dialog if object is present */
-    if (($this->macrotabs) && (isset($this->macrotabs->config))){
-      $display= $this->macrotabs->execute();
-
-      /* Don't show buttons if tab dialog requests this */
-      if (!$this->macrotabs->by_object[$this->macrotabs->current]->dialog){
-        $display.= "<p style=\"text-align:right\">\n";
-        $display.= "<input type=\"submit\" name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
-        $display.= "&nbsp;\n";
-        if ($this->dn != "new"){
-          $display.= "<input type=submit name=\"edit_apply\" value=\""._("Apply")."\">\n";
-          $display.= "&nbsp;\n";
-        }
-        $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
-        $display.= "</p>";
-      }
-      return ($display);
-    }
-
-
-    /*****************
-      Display entry list 
-     *****************/
-
-    /* Check if there is a snapshot dialog open */
-    $base = $this->DivListMacro->selectedBase;
-    if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases())){
-      return($str);
-    }
-
-    /* Return rendered main page */
-    /* Display dialog with system list */
-    $this->DivListMacro->parent = $this;
-    $this->DivListMacro->execute();
-
-    /* Add departments if subsearch is disabled */
-    if(!$this->DivListMacro->SubSearch){
-      $this->DivListMacro->AddDepartments($this->DivListMacro->selectedBase,4,1);
-    }
-    $this->reload();
-    $this->DivListMacro->setEntries($this->macros);
-    return($this->DivListMacro->Draw());
-  }
-
-
-  function copyPasteHandling_from_queue($s_action,$s_entry)
-  {
-    /* Check if Copy & Paste is disabled */
-    if(!is_object($this->CopyPasteHandler)){
-      return("");
-    }
-
-    /* Add a single entry to queue */
-    if($s_action == "cut" || $s_action == "copy"){
-
-      /* Cleanup object queue */
-      $this->CopyPasteHandler->cleanup_queue();
-      $dn = $this->macros[$s_entry]['dn'];
-      $this->CopyPasteHandler->add_to_queue($dn,$s_action,"macrotabs","MACROTABS","gofonmacro");
-    }
-
-    /* Add entries to queue */
-    if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
-
-      /* Cleanup object queue */
-      $this->CopyPasteHandler->cleanup_queue();
-
-      /* Add new entries to CP queue */
-      foreach($this->list_get_selected_items() as $id){
-        $dn = $this->macros[$id]['dn'];
-
-        if($s_action == "copy_multiple"){
-          $this->CopyPasteHandler->add_to_queue($dn,"copy","macrotabs","MACROTABS","gofonmacro");
-        }
-        if($s_action == "cut_multiple"){
-          $this->CopyPasteHandler->add_to_queue($dn,"cut","macrotabs","MACROTABS","gofonmacro");
-        }
-      }
-    }
-
-    /* Start pasting entries */
-    if($s_action == "editPaste"){
-      $this->start_pasting_copied_objects = TRUE;
-    }
-
-    /* Return C&P dialog */
-    if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
-
-      /* Load entry from queue and set base */
-      $this->CopyPasteHandler->load_entry_from_queue();
-      $this->CopyPasteHandler->SetVar("base",$this->DivListMacro->selectedBase);
-
-      /* Get dialog */
-      $data = $this->CopyPasteHandler->execute();
-
-      /* Return dialog data */
-      if(!empty($data)){
-        return($data);
-      }
-    }
-
-    /* Automatically disable status for pasting */
-    if(!$this->CopyPasteHandler->entries_queued()){
-      $this->start_pasting_copied_objects = FALSE;
-    }
-    return("");
-  }
-
-
-
-  /* Return departments, that will be included within snapshot detection */
-  function get_used_snapshot_bases()
-  {
-    return(array("ou=macros,ou=asterisk,ou=configs,ou=systems,".$this->DivListMacro->selectedBase));
-  }
-
-
-  function reload()
-  {
-    /* Set base for all searches */
-    $base       = $this->DivListMacro->selectedBase;
-    $SubSearch  = $this->DivListMacro->SubSearch;
-    $Regex      = $this->DivListMacro->Regex;
-    $Filter     = "(&(cn=".$Regex.")(objectClass=goFonMacro))";
-    $Flags      = GL_SIZELIMIT;
-    $Attrs      = array("cn","description","displayName","goFonMacroVisible");
-
-    /* Prepare for ls or search*/        
-    if($SubSearch){
-      $Flags |= GL_SUBSEARCH;
-    }else{
-      $base = "ou=macros,ou=asterisk,ou=configs,ou=systems,".$base;
-    }
-
-    /* Generate macro list */
-    $res= get_list($Filter, "gofonmacro", $base, $Attrs, $Flags);
-
-    $tmp=array();
-    foreach($res as $tkey => $val ){
-      $tmp[strtolower($val['cn'][0]).$val['cn'][0]]=$val;
-    }
-    ksort($tmp);
-    $this->macros=array();
-    foreach($tmp as $val){
-      $this->macros[]=$val;
-    }
-
-    reset ($this->macros);
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    $this->DivListMacro->save_object();
-  }
-
-
-  function list_get_selected_items()
-  {
-    $ids = array();
-    foreach($_POST as $name => $value){
-      if(preg_match("/^item_selected_[0-9]*$/",$name)){
-        $id   = preg_replace("/^item_selected_/","",$name);
-        $ids[$id] = $id;
-      }
-    }
-    return($ids);
-  }
-
-
-  function adapt_from_template($dn)  { }
-  function check() { }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/gofon/macro/class_gofonMacroParameters.inc b/plugins/gofon/macro/class_gofonMacroParameters.inc
deleted file mode 100755 (executable)
index 5a08d3e..0000000
+++ /dev/null
@@ -1,414 +0,0 @@
-<?php
-//! This class handles the goFonMacroParameter
-/*! In this class all parameters from goFonMacroContent \n
-    and all (if given) already defined parameters are managed \n
-    \n
-    Parameters will be saved to openldap like this :\n
-    goFonMacroParameter: ID!NAME:!TYPE(string:combo:bool)!DEFAULT_VALUE\n    
-    In Case of type=combo the DEFAULT_VALUE specifies the entries in the listbox, like this\n
-    "first:second:third:last" \n
-*/
-class macroParameter extends plugin
-{
-  /*! CLI vars */
-  var $cli_summary= "Handling of GOsa's application object";
-  /*! CLI vars */
-  var $cli_description= "Some longer text\nfor help";
-  /*! CLI vars */
-  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* Parameter Count*/
-  var $para_count = 0 ; 
-  /*! macro base  */
-  var $base= "";
-  
-  /*! This array contains all Parameter defined for the macro*/
-  var $goFonMacroParameter =array();
-
-  /*! This are the available types for a macro */
-  var $type_shortcut= array("string" => array("selected", "", ""),
-      "combo"  => array("", "selected", ""),
-      "bool"   => array("", "", "selected"));
-
-  /*! attribute list for save action */
-  var $attributes= array("base","goFonMacroParameter");
-  
-  /*! Objectclasses needed by the class*/  
-  var $objectclasses= array("top", "goFonMacro");
-  var $ui;
-
-  //! The konstructor of macroParameter    
-  /*! The konstructor of macroParameter...
-     - reads goFonMacroParameter and parses them to an array 
-     - Set attributes from openldap (edit)
-     - Set attributes from default (new)
-  */
-  function macroParameter (&$config, $dn= NULL, $parent= NULL)
-  {
-    plugin::plugin ($config, $dn, $parent);
-
-    $tmp = array();  // temporary Var 
-    $tmp2 = array(); // temporary Var ...
-    $tmp3 = "";
-    $ldap= $config->get_ldap_link();
-
-    $this->dn = $dn;
-
-    /* This is always an account */
-    $this->is_account= TRUE;
-
-    /* Edit or new one ?*/
-    if ($this->dn == "new"){
-      $ui= get_userinfo();
-      $this->base= dn2base($ui->dn);
-    } else {
-      $this->base= dn2base($this->dn);
-    }
-
-    /* initialising macro parameter */
-    if(isset($this->attrs['goFonMacroParameter']) &&
-        isset($this->attrs['goFonMacroParameter']['count'])){
-      unset($this->attrs['goFonMacroParameter']['count']);
-    }
-
-    /* Set Parameters, or a new array if ther are no parameters */
-    if(isset($this->attrs['goFonMacroParameter'])){
-      $this->goFonMacroParameter = $this->attrs['goFonMacroParameter'];
-    }else{
-      $this->goFonMacroParameter =array();
-    }
-
-    /* Create an array for parameters if not given yet */
-    if(!is_array($this->goFonMacroParameter)){
-      $tmp3 = $this->goFonMacroParameter;
-      $this->goFonMacroParameter =array();     
-      if(!empty($tmp3)) {
-        $this->goFonMacroParameter[]  = $tmp3;
-      }
-    }
-
-    /* Load parametersettings*/
-    foreach($this->goFonMacroParameter as $para){
-      $tmp = split("!",$para);
-      $num = $tmp[0];
-      $tmp2[$num]['name']        = base64_decode($tmp[1]);
-      $tmp2[$num]['type']        = $tmp[2];
-      $tmp2[$num]['default']     = $tmp[3];
-      $tmp2[$num]['var']         = "var".$num;
-    }
-
-    
-    /* Assign this array */
-    $this->goFonMacroParameter = $tmp2;
-
-    $this->para_count = count ($tmp2);
-   
-    $this->ui= get_userinfo();
-  }
-
-  //! Perform Parameter check 
-  /*! 
-      Compares the given parameters (goFonMacroParameters) with the parameters defined in goFonContent\n 
-      -> Decide which attrs are new and which are unused\n
-      -> Sort result array (containing both parameters 'goFonMacroParameters/goFonContent' and new / unused info)\n
-      \param $content The given goFonContent for this macro\n
-      \param $goFonMacroParameter Array with the already given parameters \n
-   */
-  function check_paras($content,$goFonMacroParameter)
-  { 
-    /* Check contents for parameters */
-    preg_match_all("/[$]\{ARG[0-9]*\}/",$content,$res,PREG_OFFSET_CAPTURE);
-
-    $new = array();
-
-    /* Detect parameters with positions */
-    foreach($res[0] as $val){
-      $num = preg_replace("/[^0-9]/","",$val[0]); 
-      $new[$num]['val'] = $val[0];
-      $new[$num]['num'] = $num;
-    }
-
-    /* Compare content parameter and macro parameter */
-    foreach($goFonMacroParameter as $gokey => $goval){
-      foreach($new as $nkey => $nval){
-        if($gokey == $nval['num']){
-          /* sign this as OK */
-          $goFonMacroParameter[$gokey]['check']= true;
-        }
-      }
-    }
-
-    /* Now check if there is new parameter in the content, which is not assigned yet */
-    foreach($new as $key => $val){
-      /* Assign std values */
-      $goFonMacroParameter[$key]['var']="var".$key;
-      $goFonMacroParameter[$key]['check']= true;
-
-      /* If this is a new Parameter, name it ${ARG#} by default*/
-      if((!isset($goFonMacroParameter[$key]['name']))||(empty($goFonMacroParameter[$key]['name']))){
-        $goFonMacroParameter[$key]['name']="\${ARG".$key."}";
-      }
-    }  
-
-    foreach($goFonMacroParameter as $key => $val){
-      /* All attributes with check == false, are unneeded so mark them with ['check']= false */
-      if(!isset($goFonMacroParameter[$key]['check'])){
-        $goFonMacroParameter[$key]['check']= false;
-      }
-      /* Ah no default given assign ="" to prevent unsigned index  */
-      if(!isset($goFonMacroParameter[$key]['default'])){
-        $goFonMacroParameter[$key]['default'] = "";
-      }
-    }
-
-    /* Sort output for better reading */
-    asort($goFonMacroParameter);
-    return($goFonMacroParameter);
-
-  }
-
-  //! Execute this Plugin
-  /*! 
-      Perform Parameter check \n
-      Draw paramter table\n
-      Show tpl   \n 
-  */
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* Variables */
-    $vars      = "";
-    $tmp       = array();
-    $number = 0; 
-    /* Get acls for this tab, 
-        there is only one attribute to write,
-         so we use the acls from gofon/marco */
-    $ACLs = $this->ui->get_permissions($this->dn,"gofonmacro/macro","goFonMarcoContent");
-
-    /* get current content */ 
-    $content = $_SESSION['macroManagment']->macrotabs->by_object['macro']->goFonMacroContent;
-
-    if(strstr($content,"ARG")){
-      $vorpos = strpos($content,"ARG");
-      $rest   = substr($content,$vorpos, strlen($content));
-    }    
-
-    /* Do we represent a valid group? */
-    if (!$this->is_account && $this->parent === NULL){
-      $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\">&nbsp;<b>".
-        _("This 'dn' is no phone macro.")."</b>";
-      return ($display);
-    }
-
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-
-    /* Add an empty Parameter */
-    if(isset($_POST['addvar']) && preg_match("/w/",$ACLs)){
-      if(!is_array($this->goFonMacroParameter)){
-        $vars = $this->goFonMacroParameter;
-        $this->goFonMacroParameter = array();
-        $this->goFonMacroParameter[]= $vars;
-      }
-      $number= count($this->goFonMacroParameter);
-      $number++;
-      $this->goFonMacroParameter[]=array("var"=>"var","name"=>"new","type"=>"string","default"=>"test");
-    }
-
-    /*generate Table which shows als parameters */
-    $FonParas = $this->check_paras($content,$this->goFonMacroParameter); 
-
-    /* Sort by Parameterid, and keep keys */    
-    ksort($FonParas);
-
-    
-
-    if(!preg_match("/r/",$ACLs)){
-      $smarty->assign("readable",false);      
-    }else{
-      $smarty->assign("readable",true);      
-      foreach($FonParas as $key=>$para)        {
-
-        /* Select correct item of combobox */
-        if(isset($para['type'])){
-          list($sel1, $sel2, $sel3)= $this->type_shortcut[$para['type']];
-        }else{
-          list($sel1, $sel2, $sel3)= array("", "", "");
-        }
-   
-        /* Disable all input fields if we are not allowed to change the parameters */ 
-        $disabled = "";
-        if(!preg_match("/w/",$ACLs)){
-          $key = "";
-          $disabled = " disabled ";
-        }
-
-        /* Assemble output table */
-        $vars .="<tr>
-          <td>
-            <input name=\"number".$key."\" value='".$key."' type='hidden' ".$disabled.">
-            <input name='var".$key."' type='hidden'   value='".$para['var']."' ".$disabled.">ARG".$key."
-          </td>
-          <td><input size=\"45\" name='varname".$key."'  value='".$para['name']."' ".$disabled."></td>
-          <td>
-            <select name='vartype".$key."'  ".$disabled.">
-              <option  value='string' ".$sel1.">"._("String")."&nbsp;</option>
-              <option  value='combo'   ".$sel2.">"._("Combobox")."&nbsp;</option>
-              <option  value='bool'   ".$sel3.">"._("Bool")."&nbsp;</option>
-            </select>
-          </td>
-          <td><input size=\"45\" name='default".$key."'   value='".$para['default']."'  ".$disabled."></td>
-          <td>&nbsp;";
-        if($para['check']==false) {
-          $vars.="<input name='del".$key."' value='"._("Delete unused")."' type='submit'>";
-        }
-
-        $vars.=" </td></tr>";
-      }
-    }
-
-    /* Checkboxes */
-    $smarty->assign("base_select", $this->base);
-    $smarty->assign("vars", $vars);
-
-    /* Show main page */
-    return($smarty->fetch (get_template_path('parameter.tpl', TRUE)));
-  }
-  
-  //! Unused here 
-  /*!
-      Unused here because goFonMacro will remove this Macro\n 
-  */
-  function remove_from_parent()
-  {
-  }
-
-  //! Save our data
-  /*! 
-      Save POST data to object \n
-      This gives us the possibility to leave a tab, without losing our typed informations\n
-      \n
-      Read the POST fields for the parameters and saves their info the the class\n
-  */
-  function save_object()
-  {
-    if (isset($_POST['phoneparameters'])){
-      plugin::save_object();
-    }
-    /* read out post data, and assign it to the parameters */
-    /* And or delete */
-    foreach($_POST as $name=>$value){
-
-      /* Test if there is a variable begining with "del" */
-      if(preg_match("/del/",$name)){
-
-        /* Extract entry id to delete */
-        $nr = str_replace("del","",$name) ;
-
-        /* unset entry */
-        unset($this->goFonMacroParameter[$nr]);
-
-      }elseif(preg_match("/number/",$name)){
-
-        /* Set Post vars */
-        $key = $_POST[$name];
-    
-        $this->goFonMacroParameter[$key]['var']   = $_POST["var".$key];
-        $this->goFonMacroParameter[$key]['name']   = $_POST["varname".$key];
-        $this->goFonMacroParameter[$key]['type']   = $_POST["vartype".$key];
-        $this->goFonMacroParameter[$key]['default']= $_POST["default".$key];
-      }
-    }
-
-  }
-
-
-  //! Checks given values 
-  /*! 
-      Check values\n 
-      If a user enters an invalid value, then this function will output an error msg\n
-      (In better words :prepare the errormessages that will be put out )\n
-  */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    foreach($this->goFonMacroParameter as $key=>$val){
-      if((strstr($val['default'],"!"))||(strstr($val['default'],"#"))) {
-        $message[] = sprintf(_("The parameter %s contains invalid char. '!,#' is used as delimiter"),$val['name']);
-      }
-      switch($val['type']){
-        case 'bool'   :   $possible = array("","0","1");
-                          if(!in_array($val['default'],$possible)) {
-                            $message[] = sprintf(_("The parameter %s has incorrect value for type bool."),$val['name']);
-                          };break;
-        case 'string' :
-        case 'combo'  : 
-        default : ;
-
-      }
-    }
-    return $message;
-  }
-
-  //! Save changes to openldap
-  /*!
-      Save to LDAP 
-      This function saves given attributes to the ldap
-  */
-  function save()
-  {
-    /* Post checks */
-
-    plugin::save();
-
-    $this->attrs['goFonMacroParameter']=array();
-
-    foreach($this->goFonMacroParameter as $key=>$fonpara){
-      $this->attrs['goFonMacroParameter'][]=$key."!".base64_encode($fonpara['name'])."!".$fonpara['type']."!".$fonpara['default'];
-    }
-
-    if($this->para_count != count($this->attrs['goFonMacroParameter'])){
-      print_red(_("Parameter count of the macro changed, you must update each user which are using this macro '%s'."),$this->dn);
-    }
-
-    unset($this->attrs['base']);
-
-    /* Write back to ldap */
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cat($this->dn, array('dn'));
-    $a= $ldap->fetch();
-
-    if (count($a)){
-      $ldap->cd($this->dn);
-      $this->cleanup();
-      $ldap->modify ($this->attrs); 
-
-      $this->handle_post_events("modify");
-    } else {
-      if(count($this->attrs['goFonMacroParameter']==0)){
-        unset($this->attrs['goFonMacroParameter']);
-      }                
-      $ldap->cd($this->dn);
-      $ldap->create_missing_trees( $this->dn);
-      $ldap->cd($this->dn);
-      $ldap->add($this->attrs);
-      $this->handle_post_events("add");
-    }
-    show_ldap_error($ldap->get_error(), sprintf(_("Removing of goFonMacro/generic account with dn '%s' failed."),$this->dn));
-  }
-
-  function PrepareForCopyPaste($source)
-  {
-    plugin::PrepareForCopyPaste($source);
-
-    $source_o = new macroParameter($this->config,$source['dn']);
-    $this->goFonMacroParameter = $source_o-> goFonMacroParameter;
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/gofon/macro/generic.tpl b/plugins/gofon/macro/generic.tpl
deleted file mode 100755 (executable)
index 7bedc52..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-<table width="100%" summary="">
-  <tr>
-    <td>
-                       <table summary="">
-                       <tr>
-                               <td><LABEL for="cn">{t}Macro name{/t}</LABEL>{$must}</td>
-                               <td>
-{render acl=$cnACL}
-                                       <input name="cn" id="id" size=13 maxlength=13 value="{$cn}" title="{t}Macro name{/t}">
-{/render}
-                               </td>
-                       </tr>
-                       <tr>
-                               <td><LABEL for="displayName">{t}Display name{/t}</LABEL>{$must}</td>
-                               <td>
-{render acl=$displayNameACL}
-                                       <input name="displayName" id="displayName" size=35 maxlength=60 value="{$displayName}" 
-                                               title="{t}Macro name to be displayed{/t}">
-{/render}
-                               </td>
-                       </tr>
-                       <tr>
-                                       <td colspan=2>
-                                       </td>
-                               </tr>
-                       <tr>
-                               <td><LABEL for="base">{t}Base{/t}</LABEL>{$must}</td>
-                               <td>
-                                       {render acl=$baseACL}
-                                             <select id="base" size="1" name="base" title="{t}Choose subtree to place group in{/t}">
-                                              {html_options options=$bases selected=$base_select}
-                                             </select>
-                                       {/render}
-
-                                       {render acl=$baseACL disable_picture='images/folder_gray.png'}
-                                               <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
-                                       {/render}
-
-                               </td>
-                       </tr>
-                       </table>
-               </td>
-               <td style="border-left:1px solid #A0A0A0">
-                    &nbsp;
-               </td>
-               <td style="vertical-align:top;">
-                       <table summary="">
-                       <tr>
-                               <td><LABEL for="description">{t}Description{/t}</LABEL></td>
-                               <td>
-{render acl=$descriptionACL}
-                                       <input name="description" id="description" size=35 maxlength=80 value="{$description}">
-{/render}
-                               </td>
-                       </tr>
-                       <tr>
-                               <td colspan=2>
-{render acl=$goFonMacroVisibleACL}
-                                       <input type="checkbox" name="goFonMacroVisible" size=35 maxlength=60 value="1" 
-                                               {$goFonMacroVisibleChecked}> {t}Visible for user{/t}
-{/render}
-                               </td>
-                       </tr>
-                       </table>
-               </td>
-       </tr>
-</table>
-<p class="seperator">&nbsp;</p>
-<br>
-{t}Macro text{/t}
-<br>
-{render acl=$goFonMacroContentACL}
-<textarea name="goFonMacroContent" style="width:99%;height:300px;font-size:14px;font-family:Arial;">{$goFonMacroContent}</textarea>
-{/render}
-
-<input type='hidden' name='gofonMacroGenericPosted' value='1'>
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('cn');
-  -->
-</script>
diff --git a/plugins/gofon/macro/headpage.tpl b/plugins/gofon/macro/headpage.tpl
deleted file mode 100755 (executable)
index 79a6fa2..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
-<tr>
-  <td style="vertical-align:top;">
-  <div class="contentboxh">
-    <p class="contentboxh">
-     {t}List of macros{/t} {$hint}
-    </p>
-  </div>
-  <div class="contentboxb">
-      {$macroshead}
-  </div>
-  <div style='height:4px;'></div>
-  <div class="contentboxb" style="border-top:1px solid #B0B0B0;">
-      {$macros}
-    <input type=hidden name="edit_helper">
-  </div>
-  </td>
-  <td style="vertical-align:top">
-   <div class="contentboxh" style="border-bottom:1px solid #B0B0B0;">
-    <p class="contentboxh"><img src="{$infoimage}" align="right" alt="[i]">{t}Information{/t}</p>
-   </div>
-   <div class="contentboxb">
-   <p class="contentboxb">
-    {t}This menu allows you to add, edit and remove selected macros. You may want to use the range selector on top of the macro listbox, when working with a large number of macros.{/t}
-   </p>
-   </div>
-   <br>
-   <div class="contentboxh">
-    <p class="contentboxh"><img src="{$launchimage}" align="right" alt="[F]">{t}Filters{/t}</p>
-   </div>
-   <div class="contentboxb">
-     <table style="width:100%;border-top:1px solid #B0B0B0;" summary="">
-      {$alphabet}
-     </table>
-    <table style="width:100%;border-top:1px solid #B0B0B0;" summary="">
-               <tr>
-                       <td>
-                               <img alt="{t}Display macros matching{/t}" src="{$search_image}" align=middle title='{t}Display macros  matching{/t}'>
-                       </td>
-               <td width="99%">
-                               <input type='text' id='regex' name='regex' maxlength='20' value='{$regex}' style='width:99%;' title='{t}Regular expression for matching macro names{/t}' onChange="mainform.submit()">
-                       </td>
-               </tr>
-       </table>
-    {$apply}
-   </div>
-  </td>
-</tr>
-</table>
-
-<input type="hidden" name="ignore">
diff --git a/plugins/gofon/macro/main.inc b/plugins/gofon/macro/main.inc
deleted file mode 100755 (executable)
index f35e23b..0000000
+++ /dev/null
@@ -1,61 +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
- */
-
-if ($remove_lock){
-  if(isset($_SESSION['macroManagement'])){
-    $macroManagment= $_SESSION['macroManagment'];
-    $macroManagment->remove_lock();
-    del_lock ($ui->dn);
-    sess_del ('macroManagment');
-  }
-} else {
-
-  /* Create macroManagment object on demand */
-  if (!isset($_SESSION['macroManagment']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
-    $_SESSION['macroManagment']= new goFonMacro ($config, $_SESSION['ui']);
-  }
-
-  /* Get object */
-  $macroManagment= $_SESSION['macroManagment'];
-  $macroManagment->save_object();
-  $output= $macroManagment->execute();
-
-  /* Page header*/
-  if (isset($_SESSION['objectinfo'])){
-    $display= print_header( get_template_path('images/macros.png'), 
-                            _("Phone macro management"), 
-                            "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> 
-                            ".@LDAP::fix($_SESSION['objectinfo']));
-  } else {
-    $display= print_header(get_template_path('images/macros.png'), _("Phone macro management"));
-  }
-
-  /* Reset requested? */
-  if (isset($_GET['reset']) && $_GET['reset'] == 1){
-    del_lock ($ui->dn);
-    sess_del ('macroManagment');
-  }
-
-  /* Show and save dialog */
-  $display.= $output;
-  $_SESSION['macroManagment']= $macroManagment;
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/gofon/macro/parameter.tpl b/plugins/gofon/macro/parameter.tpl
deleted file mode 100755 (executable)
index 48e99cd..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-{if $readable}
-<table width="100%" summary="">
-       <tr>
-               <td>{t}Argument{/t}
-               </td>
-               <td>{t}Name{/t}
-               </td>
-               <td>{t}type{/t}
-               </td>
-               <td>{t}Default value{/t}
-               </td>
-               <td>
-               &nbsp;
-               </td>
-       </tr>
-               {$vars}
-</table>
-{else}
-       <h2>{t}You are not allowed to view the macro parameter settings{/t}</h2>
-{/if}
-<input type="hidden" name="phoneparemeters">
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('cn');
-  -->
-</script>
diff --git a/plugins/gofon/macro/paste_generic.tpl b/plugins/gofon/macro/paste_generic.tpl
deleted file mode 100644 (file)
index 0f5acf4..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<table summary="">
-       <tr>
-       <td>
-                       <LABEL for="cn">{t}Macro name{/t}</LABEL>{$must}</td>
-               <td>
-                       <input name="cn" id="id" size=13 maxlength=13 value="{$cn}" title="{t}Macro name{/t}">
-               </td>
-       </tr>
-</table>
diff --git a/plugins/gofon/macro/remove.tpl b/plugins/gofon/macro/remove.tpl
deleted file mode 100755 (executable)
index 4dbd248..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<div style="font-size:18px;">
-  <img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
-</div>
-<p>
- {$intro}
- {t}This may be used by several groups. 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}So - if you're sure - press 'Delete' to continue or 'Cancel' to abort.{/t}
-</p>
-
-<p class="plugbottom">
-       {if $multiple}
-               <input type=submit name="delete_multiple_macro_confirm" value="{t}Delete{/t}">
-               &nbsp;
-               <input type=submit name="delete_multiple_macro_cancel" value="{t}Cancel{/t}">
-       {else}
-               <input type=submit name="delete_macro_confirm" value="{t}Delete{/t}">
-               &nbsp;
-               <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
-       {/if}
-</p>
-
diff --git a/plugins/gofon/macro/tabs_macros.inc b/plugins/gofon/macro/tabs_macros.inc
deleted file mode 100755 (executable)
index 5c5bcf6..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-
-class macrotabs extends tabs
-{
-
-  function macrotabs($config, $data, $dn,$category)
-  {
-         tabs::tabs($config, $data, $dn,$category);
-
-         /* Add references/acls/snapshots */
-         $this->addSpecialTabs();
-  }
-
-  function save($ignore_account= FALSE)
-  {
-       $baseobject= $this->by_object['macro'];
-
-       /* Check for new 'dn', in order to propagate the
-          'dn' to all plugins */
-       $new_dn= "cn=".$baseobject->cn.",ou=macros,ou=asterisk,ou=configs,ou=systems,".$baseobject->base;
-
-        /* Move group? */
-        if ($this->dn != $new_dn){
-
-                /* Write entry on new 'dn' */
-                if ($this->dn != "new"){
-                        $baseobject->move($this->dn, $new_dn);
-                        $this->by_object['macro']= $baseobject;
-                }
-
-                /* Happen to use the new one */
-                $this->dn= $new_dn;
-        }
-               
-       tabs::save();
-  }
-
-}
-
-?>
diff --git a/plugins/gofon/phoneaccount/class_phoneAccount.inc b/plugins/gofon/phoneaccount/class_phoneAccount.inc
deleted file mode 100644 (file)
index 6871854..0000000
+++ /dev/null
@@ -1,1512 +0,0 @@
-<?php
-
-class phoneAccount extends plugin
-{
-  /* Definitions */
-  var $plHeadline= "Phone";
-  var $plDescription= "This does something";
-  var $has_mailAccount= FALSE;
-
-  /* Attributes */
-  var $telephoneNumber        = array();
-  var $goFonHardware          = "automatic";
-  var $goFonFormat            = "wav";
-  var $goFonPIN               = "";
-  var $goFonVoicemailPIN      = "";
-  var $goFonDeliveryMode      = "";
-  var $phoneNumbers           = array();
-  var $mail                   = "";
-  var $hardware_list          = array();
-  var $used_hardware          = array();
-  var $goFonMacro             = "";
-  var $macro                  = 0;              // Selected Macroi
-  var $lastmacro              = "";
-  var $macros                 = array();        // List of macros for smarty select box
-  var $macroarray             = array();        // All needed macro informations
-  var $macrostillavailable    = false;
-  var $generate_error         = "";
-  var $a_old_telenums         = array();
-  var $goFonPINVoice          = "";
-  var $goFonHomeServer        = "0";            // Contains the dn of the server that manage this account 
-  var $init_HomeServer        = "0";            // Contains the dn of the server that manage this account 
-  var $goFonHomeServers       = array();        // Contains all available server configurations 
-
-  /* CLI vars */
-  var $cli_summary            = "Manage users phone account";
-  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 $CopyPasteVars          = array("phoneNumbers","macroarray","macrostillavailable"/*"phoneNumbers" -Reset- */,
-                                      "hardware_list","used_hardware");
-
-  var $attributes             = array("goFonDeliveryMode", "goFonFormat","cn","goFonHomeServer",
-      "goFonHardware","goFonPIN","goFonVoicemailPIN","telephoneNumber", "goFonMacro","macro");
-  var $objectclasses= array("goFonAccount");
-
-  var $uid;
-
-  var $view_logged = FALSE;
-
-  function phoneAccount (&$config, $dn= NULL, $parent= NULL)
-  {
-    plugin::plugin ($config, $dn, $parent);
-
-    /* Assemble phone numbers */
-    if (isset($this->attrs['telephoneNumber'])){
-      for ($i= 0; $i<$this->attrs['telephoneNumber']['count']; $i++){
-        $number= $this->attrs['telephoneNumber'][$i];
-        $this->phoneNumbers[$number]= $number;
-      }
-    }
-
-    /* Set up has_mailAccount */
-    if (isset($this->attrs['objectClass'])){
-      if (in_array("gosaMailAccount", $this->attrs['objectClass'])){
-        $this->has_mailAccount= TRUE;
-      }
-    }
-
-    /* Set uid */
-    if((isset($this->parent->by_object['user']->uid))&&(!empty($this->parent->by_object['user']->uid))){
-      $this->uid = $this->parent->by_object['user']->uid;
-    }
-    if((isset($this->parent->by_object['user']->cn))&&(!empty($this->parent->by_object['user']->cn))){
-      $this->cn  = $this->parent->by_object['user']->cn;
-    }
-
-    /* Check server configurations 
-     * Load all server configuration in $this->goFonHomeServers if available
-     *  and first server as default if necessary.
-     * Check if connection is successfull for the selected server $this->goFonHomeServer
-     */
-
-  
-    /* Set available server */
-    if(isset($_SESSION['config']->data['SERVERS']['FON'])){
-      $this->goFonHomeServers = $_SESSION['config']->data['SERVERS']['FON'];
-    }
-
-    $a_SETUP= array();
-    if($this->is_account &&
-       array_key_exists('config',$_SESSION) &&
-       array_key_exists('SERVERS',$_SESSION['config']->data) &&
-       array_key_exists('FON',$_SESSION['config']->data['SERVERS']) &&
-       is_callable("mysql_connect")
-       ) {
-
-      /* Servers defined? Watch here... */
-      if (count($this->goFonHomeServers)){
-
-        /* Set default server */
-        if(empty($this->goFonHomeServer) || $this->goFonHomeServer == "0"){
-          $this->goFonHomeServer= $this->goFonHomeServers[0]['DN'];
-        }
-
-        /* Remember inital home server, to be able to remove old entries */
-        $this->init_HomeServer = $this->goFonHomeServer;
-
-        /* Get config */
-        if(!isset($this->goFonHomeServers[$this->goFonHomeServer])){
-          print_red(sprintf(_("The specified goFonHomeServer '%s' is not available in GOsa server configuration. Saving this account will create a new entry on the server '%s'. Use cancel if you do not want to create a new entry ignoring old accounts."),$this->goFonHomeServer, $this->goFonHomeServers[0]['DN']));
-
-          $this->goFonHomeServer = $this->goFonHomeServers[0]['DN'];
-          $this->init_HomeServer = $this->goFonHomeServers[0]['DN'];
-        }    
-        $cur_cfg = $this->goFonHomeServers[$this->goFonHomeServer];
-
-        $r_con =  @mysql_pconnect($cur_cfg['SERVER'],$cur_cfg['LOGIN'],$cur_cfg['PASSWORD']);
-        if(!$r_con){
-#          print_red( sprintf(_("The MySQL Server '%s' isn't reachable as user '%s', check GOsa log for mysql error."),
-#                $cur_cfg['SERVER'],$cur_cfg['LOGIN']));
-          new log("debug","gofonreport/".get_class($this),"",array(),@mysql_error());
-        }
-        $db  =  @mysql_select_db($cur_cfg['DB'],$r_con);
-        if(!$db){
-#          print_red(sprintf(_("Can't select database %s on %s."),$cur_cfg['DB'],$cur_cfg['SERVER']));
-          new log("debug","gofonreport/".get_class($this),"",array(),@mysql_error());
-        }
-
-        $first = false; 
-        foreach($this->phoneNumbers as $key => $val){
-          if(!$first){
-            $first = $key;
-          }
-        }
-      }
-    }
-
-    /* Get available phone hardware  
-     * Search for all available phone hardware  
-     */
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(objectClass=goFonHardware)", array('cn', 'description'));
-    while ($attrs= $ldap->fetch()){
-      $cn= $attrs['cn'][0];
-      if (isset($attrs['description'])){
-        $description= " - ".$attrs['description'][0];
-      } else {
-        $description= "";
-      }
-      $this->hardware_list[$cn]= "$cn$description";
-    }
-
-
-    /* Get available Macros  
-     * Search for all Marcos that are visible and create 
-     *  an array with name and parameters 
-     */
-    $ldap->search("(&(objectClass=goFonMacro)(goFonMacroVisible=1))", array("*"));
-
-    /* Add none for no macro*/
-    $this->macros['none']=_("no macro");    
-    $this->macro ="none";
-
-    /* Fetch all Macros*/
-    while ($attrs= $ldap->fetch()){
-
-      /* unset Count, we don't need that here */
-      unset($attrs['displayName']['count']);
-
-      /* Parse macro data, unset count for parameterarrays  */
-      if (isset($attrs['goFonMacroParameter']['count'])){
-        unset($attrs['goFonMacroParameter']['count']);
-      }
-
-      /* fill Selectfield variable with Macros */
-      if(isset($attrs['displayName'][0])){
-        $this->macros[$attrs['dn']] = $attrs['displayName'][0]." (".$attrs['cn'][0].")";
-      }else{
-        $this->macros[$attrs['dn']] = _("undefined");
-      }
-
-      /* Go through available parameters and parse all attributes, like parametername, type, default ...*/
-      if((isset($attrs['goFonMacroParameter']))&&(is_array($attrs['goFonMacroParameter']))){
-
-        foreach($attrs['goFonMacroParameter'] as $pkey=>$pval){
-          /* Split Data in readable values, by delimiter !  */
-          $data = split("!",$attrs['goFonMacroParameter'][$pkey]);
-
-          /* Set all attrs */
-          $id = $data[0];
-          $this->macroarray[$attrs['dn']][$id]['var']    ="var".$id;
-          $this->macroarray[$attrs['dn']][$id]['choosen']=$data[3]; 
-          $this->macroarray[$attrs['dn']][$id]['id']     =$id;
-          $this->macroarray[$attrs['dn']][$id]['name']   =$data[1];
-          $this->macroarray[$attrs['dn']][$id]['type']   =$data[2];
-          $this->macroarray[$attrs['dn']][$id]['default']=$data[3];
-          if($data[2] == "bool"){
-            $this->macroarray[$attrs['dn']][$id]['choosen']=$data[3];
-          }
-        }//foreach
-      }//is_array
-    }//while
-
-
-    /* Parse used Macro  
-     * If we have a macro selected, parse it and set values 
-     *  in $this->macroarray[$this->macro]. 
-     */
-    $tmp = split("!",$this->goFonMacro);
-    if(is_array($tmp)){
-
-      /* First value is the macroname */
-      $this->macro = $tmp[0];
-
-      /* Macroname saved, delete that index */
-      unset($tmp[0]);
-
-      /* Check if makro has been removed */
-      if(!isset($this->macros[$this->macro])){
-        $this->macrostillavailable = false;
-      }else{
-        $this->macrostillavailable = true;
-      }
-
-      /* for each parametervalues ( parameterID#value like 25#twentyfive) */
-      foreach($tmp as $var){
-
-        /* Split this, so we have $varar[0] = parameterID $varar[1] = SelectedValue */
-        $varar = split("#",$var);
-
-        /* Only insert if the parameter still exists */
-        if(isset($this->macroarray[$this->macro][$varar[0]])){
-          /* Assign value */
-          $this->macroarray[$this->macro][$varar[0]]['choosen']=$varar[1];
-        }
-      }
-    }
-
-
-    /* Colorize phones 
-     * Used phones will be colored in grey, 
-     *  so we must detect which phones are currently in use.
-     */
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(goFonHardware=*)",array('cn','dn','goFonHardware'));
-    while($attrs = $ldap->fetch()){
-        $cn = $attrs['goFonHardware'][0];
-        if(isset($this->hardware_list[$cn])){
-          $this->used_hardware[$cn]= $cn;
-        }
-    }
-    $this->hardware_list["automatic"]= _("automatic");
-    ksort($this->hardware_list);
-    $this->a_old_telenums = $this->phoneNumbers;
-
-    /* Get voicemail PIN from MySQL DB 
-     * Because every user can change his PIN directly from the phone
-     *  without any update to the ldap
-     * This means, the PIN in the DB is up to date
-     */
-    // Connect to DB server
-    if((is_callable("mysql_pconnect"))&&(isset($cur_cfg))&&(isset($cur_cfg['SERVER']))&&(isset($cur_cfg['LOGIN']))&&(isset($cur_cfg['PASSWORD']))){
-      $r_con =  @mysql_pconnect($cur_cfg['SERVER'],$cur_cfg['LOGIN'],$cur_cfg['PASSWORD']);
-      if($r_con){
-        $r_db  =  @mysql_select_db($cur_cfg['DB'],$r_con);
-  
-        $query_tmp = "SELECT ".$cur_cfg['VOICE_TABLE'].".password FROM  ".$cur_cfg['VOICE_TABLE'].", ".
-                     $cur_cfg['SIP_TABLE']."  WHERE customer_id = sip_users.mailbox AND name='".$this->uid."'";
-
-        $vp = mysql_fetch_row(mysql_query($query_tmp));
-        @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query_tmp, "Database query");
-        if((isset($vp[0]))&&(!empty($vp[0]))){
-          $this->goFonPINVoice = $vp[0];
-        }
-      }
-    }
-    $this->lastmacro=$this->macro;
-
-    if(is_callable("mysql_close")&&(isset($r_con))&&($r_con)){
-      @mysql_close($r_con) ;
-    }
-  }
-
-
-  /* This function generates the Database entries. 
-   * The Parameter 'save' could be true or false.
-   *  false - means only testing no database transactions.
-   *  true  - write database entries.
-   *
-   * 'sip_users','voice_mail' and 'extensions' table entries will be created.
-   * 
-   * If the phone hardware is 'automatic' the table entries will only be removed
-   *  and not added. 
-   */
-  function generate_mysql_entension_entries($save = false)
-  {
-    /* Check if there is at least one server available 
-     * If not, return and tell the user that saving failed 
-     */
-    if(!count($this->goFonHomeServers)){
-      if($save){
-        print_red(_("There is currently no asterisk server defined. Possibly you are missing a server that handles the asterisk management (goFonServer). Your settings can't be saved to asterisk database."));
-      }
-      return(true);
-    }
-
-    /* Check if Mysql extension is available */
-    if(!is_callable("mysql_pconnect")){
-      if($save)
-      print_red(_("Can't save any changes to asterisk database, there is no mysql extension available."));
-      return(true);
-    }
-    /********************** 
-     * Attribute Initialisation
-     **********************/
-
-    $old_connection = false;
-
-    // Get Configuration for Mysql database Server
-    $s_parameter    = "";                                           // Contains paramter for selected Macro 
-    $r_con          = false;                                        // DB connection
-    $r_db           = false;                                        // Selected DB
-    $r_res          = false;                                        // Result resource
-    $a_ldap_attrs   = array();                                      //  
-
-    $s_ip           = NULL;                   // Contains ip for Sip entry
-    $s_host         = NULL;                   // Contains host for Sip entry
-    $s_qualify      = "yes";                  // Qualify entry
-    $s_pin          = NULL;                   // Entry for secret
-    $s_type         = NULL;                   // Entry for phone type (friend , peer ..)
-
-    $sip_data_array = array();                // Contains complete sip entry, to generate SQL syntax
-    $i_old_key      = false;                  // Contains index for first old phonenumber, to delete old entries corectly
-    $i_new_key      = false;                  // Contains index for first new phonenumber, to generate new  entries corectly
-
-    $s_sip_values   = "";     // Contains string with all values for given attributes in SQL syntax
-    $s_sip_keys     = "";     // Contains all needed attributes to generate sip entry in DB
-
-    $s_sip_key      = "";     // Key for SIP entry index      
-    $s_sip_val      = "";     // Value for SIP entry index      
-
-    $b_first_deleted= false;  // Only delete first entry, 
-    $s_telenums     = "";     // for each value variable
-
-    $i_is_accounted = false;  // Ensure that extension entry, for name to number is only once in table
-
-    restore_error_handler();
-
-    /* Prepare some basic attributes */
-    foreach($this->a_old_telenums as $tele){
-      $oldnums[]= preg_replace("/[^0-9]/","",$tele);
-    }
-    foreach($this->phoneNumbers as $tele){
-      $newnums[]= preg_replace("/[^0-9]/","",$tele);
-    }
-
-    /* If deletion starts from userslist, cn uid are not set */
-    if((isset($this->parent->by_object['user']->uid))&&(!empty($this->parent->by_object['user']->uid))){
-      $this->uid = $this->parent->by_object['user']->uid;
-    }
-    if((isset($this->parent->by_object['user']->cn))&&(!empty($this->parent->by_object['user']->cn))){
-      $this->cn  = $this->parent->by_object['user']->cn;
-    }
-    /* Create voicemail entry 
-     */
-    if((!isset($this->cn))||(empty($this->cn))){
-      $CNname= $this->uid;
-    }else{
-      $CNname= $this->cn;
-    }
-
-    if((isset($this->parent))&&(isset($this->parent->by_object['mailAccount']))&&($this->parent->by_object['mailAccount']->is_account==true)){
-      $s_mail = $this->parent->by_object['mailAccount']->mail;
-    }else{
-      $s_mail = "";
-    }
-    /* Get phonehardware to setup sip entry  */
-    $ldap         = $this->config->get_ldap_link();
-    $r_res        = $ldap->search("(&(objectClass=goFonHardware)(cn=".$this->goFonHardware."))", array('*'));
-    $a_ldap_attrs = $ldap->fetch();
-
-    /* Check selected phone hardware, is a default IP set? */
-    if(((isset($a_ldap_attrs['goFonDefaultIP'][0]))&&($a_ldap_attrs['goFonDefaultIP'][0] != "dynamic"))){
-      $s_ip       = $a_ldap_attrs['goFonDefaultIP'][0];
-      $s_host     = $s_ip;
-    }else{
-      $s_ip       = NULL;
-      $s_host     = "dynamic";
-    }
-
-    // Attribute GoFonQualify set ?
-    if(isset($a_ldap_attrs['goFonQualify'])){
-      $s_qualify = $a_ldap_attrs['goFonQualify'][0];
-    }
-
-    // Attribute GoFonPIN set ?
-    if(isset($this->goFonPIN)){
-      $s_pin      = $this->goFonPIN;
-    }
-
-    // Attribute GoFonType set ?
-    if(isset($a_ldap_attrs['goFonType'])){
-      $s_type = $a_ldap_attrs['goFonType'][0];
-    }
-
-    if(isset($a_ldap_attrs['goFonDmtfMode'][0])){
-      $sip_data_array['dtmfmode']     = $a_ldap_attrs['goFonDmtfMode'][0];
-    }else{
-      $sip_data_array['dtmfmode']     ="rfc2833";
-    }
-
-    /* Check if phone number is used */
-    if($this->is_number_used()){
-      $this->generate_error = $this->is_number_used(); 
-      return false;
-    }
-
-
-
-    /********************** 
-     * Check Server Connection Information
-     **********************/
-    /* Create Mysql handle for the current goFonHomeServer, if possible  
-     * Get configuration to old asterisk home server 
-     */ 
-    $a_New = $this->goFonHomeServers[$this->goFonHomeServer];  // DB Configuration
-    $new_connection =  @mysql_pconnect($a_New['SERVER'],$a_New['LOGIN'],$a_New['PASSWORD']);
-    if(!$new_connection){
-      $this->generate_error = sprintf(
-          _("The MySQL Server '%s' isn't reachable as user '%s'. Abort saving entries to keep the database consistent, check GOsa log for mysql error."),
-          $a_New['SERVER'],$a_New['LOGIN']);
-      new log("debug","gofonreport/".get_class($this),"",array(),@mysql_error($new_connection));
-      return false;
-    }
-    $new_database  =  @mysql_select_db($a_New['DB'],$new_connection);
-    if(!$new_database){
-      $this->generate_error = sprintf(
-          _("Can't select database %s on %s. Abort saving entries to keep the database consistent, check GOsa log for mysql error."),
-          $a_New['DB'],$a_New['SERVER']);
-      new log("debug","gofonreport/".get_class($this),"",array(),@mysql_error($new_connection));
-      return false;
-    }
-
-    /* If the home server has changed, we must remove entries from old 
-     *  server and add new entries in new server.  
-     */
-    if($this->init_HomeServer != $this->goFonHomeServer){
-    
-      /* Get configuration to old asterisk home server */ 
-      $a_Remove = $this->goFonHomeServers[$this->init_HomeServer];  // DB Configuration
-      /* Create connection to the database that contains the old entry. 
-       */
-      $old_connection =  @mysql_pconnect($a_Remove['SERVER'],$a_Remove['LOGIN'],$a_Remove['PASSWORD']);
-      if(!$old_connection){
-        $this->generate_error = sprintf(
-            _("The old MySQL home server '%s' isn't reachable as user '%s'. Abort saving entries to keep the database consistent, check GOsa log for mysql error."),
-            $a_Remove['SERVER'],$a_Remove['LOGIN']);
-        new log("debug","gofonreport/".get_class($this),"",array(),@mysql_error($old_connection));
-        return false;
-      }
-      $old_database  =  @mysql_select_db($a_Remove['DB'],$old_connection);
-      if(!$old_database){
-        $this->generate_error = sprintf(
-            _("Can't select database %s on %s. Abort saving entries to keep the database consistent, check GOsa log for mysql error."),
-            $a_Remove['DB'],$a_Remove['SERVER']);
-        new log("debug","gofonreport/".get_class($this),"",array(),@mysql_error($old_connection));
-        return false;
-      }
-    }
-
-    /* Save means that we must save changes, not only test  */
-    if($save == true){
-    
-      /********************** 
-       * Remove entries from old home server 
-       **********************/
-
-      /* Check if there is an old entry 
-       * If there is an old entry, get callerid and remove voicemail and extensions 
-       */
-      if($old_connection){
-        $query  = "SELECT id,name,callerid FROM ".$a_Remove['SIP_TABLE']." WHERE name='".$this->uid."';";
-        $rid    = mysql_query($query,$old_connection);
-        @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query, "Database query");
-
-        /* Old entry found, remove it */
-        $query_a = array();
-        if(mysql_affected_rows($old_connection)){
-          $result = mysql_fetch_assoc($rid);
-          $query_a[]= "DELETE FROM ".$a_Remove['SIP_TABLE']." WHERE name='".$this->uid."';";
-          $query_a[]= "DELETE FROM ".$a_Remove['VOICE_TABLE']." WHERE customer_id='".$result['callerid']."';";
-          $query_a[]= "DELETE FROM ".$a_Remove['EXT_TABLE']." WHERE exten='".$this->uid."';";
-          foreach($oldnums as $s_telenums) {
-            $query_a[]= "DELETE FROM ".$a_Remove['EXT_TABLE']." WHERE exten='".$s_telenums."';";
-          }
-
-          foreach($query_a as $qry){
-                 @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$qry, "Database query");
-            if(!mysql_query($qry,$old_connection)){
-              echo mysql_error($old_connection);
-            } 
-          }
-        }
-      }
-
-      /********************** 
-       * Update / Insert sip_users entry  
-       **********************/
-
-      /* Set the first given phone number as callerid */
-      reset($newnums);        
-      $i_new_key = key($newnums);
-      $sip_data_array['callerid']  =$newnums[$i_new_key];
-      $sip_data_array['mailbox']   =$newnums[$i_new_key];
-
-      /* Check if there is already an entry in sip_users for this uid */
-      $SQL_query_array = array();
-      $query = "SELECT * FROM ".$a_New['SIP_TABLE']." WHERE name='".$this->uid."';\n"; 
-      $rid = mysql_query($query,$new_connection);
-      @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query, "Database query");
-      if(mysql_affected_rows($new_connection)){
-
-        /********************** 
-         * Update sip_users entry 
-         **********************/
-        $result                     = mysql_fetch_assoc($rid);
-        $sip_data_array['host']         = $s_host;
-        $sip_data_array['qualify']      = $s_qualify;
-        $sip_data_array['secret']       = $this->goFonPIN;
-        $sip_data_array['type']         = $s_type ;
-        $sip_data_array['username']     = $this->uid;
-        $sip_data_array['ipaddr']       = $s_ip;
-
-        /* Remove not changed attributes, to avoid updating table with same values */
-        foreach($sip_data_array as $name => $value){
-          if($result[$name] == $value){
-            unset($sip_data_array[$name]);
-          }
-        }
-        /* Only update entry if there is something to uopdate */
-        if(count($sip_data_array)){
-          $query = "UPDATE ".$a_New['SIP_TABLE']." SET ";
-          foreach($sip_data_array as $key => $val){
-            $query.= "".$key."='".$val."',"; 
-          } 
-          $query = preg_replace("/,$/","",$query);
-          $query.= " WHERE name='".$this->uid."';";
-          $SQL_query_array[] = $query;
-        }
-      } else {
-        /********************** 
-         * Insert sip_users entry 
-         **********************/
-        //generate SIP entry
-        $sip_data_array['id']           = "";
-        $sip_data_array['name']         = $this->uid;
-        $sip_data_array['accountcode']  = NULL;          
-        $sip_data_array['amaflags']     = NULL;
-        $sip_data_array['callgroup']    = NULL;
-        $sip_data_array['canreinvite']  = "no";
-        $sip_data_array['context']      = "default";
-        $sip_data_array['defaultip']    = NULL;
-        $sip_data_array['fromuser']     = NULL;
-        $sip_data_array['fromdomain']   = NULL;
-        $sip_data_array['host']         = $s_host;
-        $sip_data_array['insecure']     = NULL;
-        $sip_data_array['language']     = NULL;
-        $sip_data_array['mailbox']      = $newnums[$i_new_key];
-        $sip_data_array['md5secret']    = NULL;
-        $sip_data_array['nat']          = "no";
-        $sip_data_array['permit']       = NULL;
-        $sip_data_array['deny']         = NULL;
-        $sip_data_array['mask']         = NULL;
-        $sip_data_array['pickupgroup']  = NULL;
-        $sip_data_array['port']         = NULL;
-        $sip_data_array['qualify']      = $s_qualify;
-        $sip_data_array['restrictcid']  = "n";
-        $sip_data_array['rtptimeout']   = NULL;
-        $sip_data_array['rtpholdtimeout']=NULL;
-        $sip_data_array['secret']       = $this->goFonPIN;
-        $sip_data_array['type']         = $s_type ;
-        $sip_data_array['username']     = $this->uid;
-        $sip_data_array['disallow']     = NULL;
-        $sip_data_array['allow']        = NULL;
-        $sip_data_array['musiconhold']  = NULL;
-        $sip_data_array['regseconds']   = NULL;
-        $sip_data_array['ipaddr']       = $s_ip;
-        $sip_data_array['regexten']     = NULL;
-        $sip_data_array['cancallforward']=NULL;
-
-        /* There is currently no entry for this user in the sip_users table. 
-         * We should create one i
-         */
-        foreach($sip_data_array as $s_sip_key=>$s_sip_val){
-          if($s_sip_val === NULL) continue;
-          $s_sip_values.="'".$s_sip_val."',";
-          $s_sip_keys  .="`".$s_sip_key."`,";
-        }
-        $s_sip_values =  preg_replace("/,$/","",$s_sip_values);
-        $s_sip_keys   =  preg_replace("/,$/","",$s_sip_keys);
-
-        /* Add sip entries to mysql queries */
-        $SQL_query_array[] ="INSERT INTO ".$a_New['SIP_TABLE']." (".$s_sip_keys.") VALUES (".$s_sip_values.");";
-      }
-
-
-      /********************** 
-       * Update / Insert Voice mail entry  
-       **********************/
-
-      $customer_id = $newnums[$i_new_key];
-
-      $voice_data_array = array(
-          "customer_id" => $customer_id,
-          "mailbox"     => $customer_id,
-          "password"    => $this->goFonVoicemailPIN,
-          "fullname"    => $CNname,
-          "email"       => $s_mail);
-
-      /* Set pager number if available */
-      if(isset($this->parent->by_object['user']->pager)){
-        $voice_data_array['pager']   = $this->parent->by_object['user']->pager;
-      }
-
-      /* Check if there is already an entry in sip_users for this uid */
-      $query_tmp = "SELECT * FROM ".$a_New['VOICE_TABLE']." WHERE customer_id='".$customer_id."';\n";
-      $rid = mysql_query($query_tmp,$new_connection);
-      @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query_tmp, "Database query");
-      if(mysql_affected_rows($new_connection)){
-
-        /********************** 
-         * Update Voice mail entry  
-         **********************/
-        $result = mysql_fetch_assoc($rid)  ;
-
-        foreach($voice_data_array as $name => $value){
-          if($result[$name] == $value){
-            unset($voice_data_array[$name]);
-          }
-        }
-
-        /* Only update entry if there is something to uopdate */
-        if(count($voice_data_array)){
-          $query = "UPDATE ".$a_New['VOICE_TABLE']." SET ";
-          foreach($voice_data_array as $key => $val){
-            $query.= "".$key."='".$val."',"; 
-          } 
-          $query = preg_replace("/,$/","",$query);
-          $query.= " WHERE customer_id='".$customer_id."';";
-          $SQL_query_array[] = $query;
-        }
-      }else{
-
-        /********************** 
-         * Insert Voice mail entry  
-         **********************/
-        $voice_data_array['context'] = "default";
-  
-        /* There is currently no voice mail entry for this user. 
-         * We should create one 
-         */
-        $s_voi_values = $s_voi_keys = "";
-        foreach($voice_data_array as $s_voi_key=>$s_voi_val){
-          if($s_voi_val === NULL) continue;
-          $s_voi_values.="'".$s_voi_val."',";
-          $s_voi_keys  .="`".$s_voi_key."`,";
-        }
-        $s_voi_values =  preg_replace("/,$/","",$s_voi_values);
-        $s_voi_keys   =  preg_replace("/,$/","",$s_voi_keys);
-
-        /* Add sip entries to mysql queries */
-        $SQL_query_array[] ="INSERT INTO ".$a_New['VOICE_TABLE']." (".$s_voi_keys.") VALUES (".$s_voi_values.");";
-      }
-
-     
-      /********************** 
-       * Remove/Insert extension entries
-       **********************/
-      
-      /* Remove old entries */
-      $query = array();
-      $query[]= "DELETE FROM ".$a_New['EXT_TABLE']." WHERE exten=\"".$this->uid."\";";
-      foreach($oldnums as $s_telenums){
-        $query[]= "DELETE FROM ".$a_New['EXT_TABLE']." WHERE exten=\"".$s_telenums."\";";
-      }
-      foreach($newnums as $s_telenums){
-        $query[]= "DELETE FROM ".$a_New['EXT_TABLE']." WHERE exten=\"".$s_telenums."\";";
-      }
-      foreach($query as $qry){
-        @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$qry, "Database query");
-        if(!mysql_query($qry,$new_connection)){
-          echo mysql_error($new_connection);
-        } 
-      }
-      /********************** 
-       * Insert extension entries
-       **********************/
-      // Get selected Macro Parameter and create parameter entry 
-      if(isset($this->macroarray[$this->macro])){
-        foreach($this->macroarray[$this->macro] as $key => $val ){
-          $s_parameter .= $val['choosen']."|";
-        }
-        $s_parameter = preg_replace("/\|$/","",$s_parameter);
-      }
-     
-      $i = 0; 
-      $EXT = array();
-      if(!is_numeric($this->uid)){
-        $EXT[$i]['context'] = 'GOsa';
-        $EXT[$i]['exten']   = $this->uid;
-        $EXT[$i]['priority']= 1;
-        $EXT[$i]['app']     = "Goto";
-        $EXT[$i]['appdata'] = $newnums[$i_new_key]."|1";
-        $i ++;
-      }
-
-      // Entension entries  Hint / Dial / Goto
-      foreach($newnums as $s_telenums){
-
-        /* Hint Entry */
-        $EXT[$i]['context'] = 'GOsa';
-        $EXT[$i]['exten']   = $s_telenums;
-        $EXT[$i]['priority']= "Hint";
-        $EXT[$i]['app']     = 'SIP/'.$this->uid;
-        $i ++;  
-        /* SetCID */
-        //$EXT[$i]['context'] = 'GOsa';
-        //$EXT[$i]['exten']   = $s_telenums;
-        //$EXT[$i]['priority']= 1;
-        //$EXT[$i]['app']     = "SetCIDName";
-        //$EXT[$i]['appdata'] = $CNname;
-        //$i ++;  
-
-        // If no macro is selected use Dial
-        if($this->macro!="none"){ 
-          $macroname = preg_replace("/,.*$/","",$this->macro);        
-          $macroname = preg_replace("/^.*=/","",$macroname);        
-          $s_app = "Macro";$macroname;
-          $s_par = $macroname."|".$s_parameter; 
-        }else{
-          $s_app = "Dial";
-          $s_par = 'SIP/'.$this->uid."|20|r";
-        }
-
-        $EXT[$i]['context'] = 'GOsa';
-        $EXT[$i]['exten']   = $s_telenums;
-        $EXT[$i]['priority']= 1;
-        $EXT[$i]['app']     = $s_app;
-        $EXT[$i]['appdata'] = $s_par;
-        $i ++;
-      }
-
-      // Append all these Entries 
-      foreach($EXT as $entr){
-        $SQL_syn = "INSERT INTO ".$a_New['EXT_TABLE']." (";
-        foreach($entr as $key2 => $val2){
-          $SQL_syn.= "`".$key2."`,";
-        }
-        $SQL_syn = preg_replace("/,$/","",$SQL_syn);
-        $SQL_syn .= ") VALUES ("; 
-        foreach($entr as $key2 => $val2){
-          $SQL_syn .= "'".$val2."',";
-        }
-        $SQL_syn = preg_replace("/,$/","",$SQL_syn);
-        $SQL_syn .=");\n";
-
-        $SQL_query_array[] =$SQL_syn;
-        $SQL_syn ="";
-      }
-
-      // Perform queries ...
-      if($this->goFonHardware != "automatic"){
-        foreach($SQL_query_array as $query){
-          @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query, "Database query");
-          if(!@mysql_query($query,$new_connection)){
-            print_red(_("Error while performing query:")." ".mysql_error());
-            return false;
-          }
-        }
-      }
-    }
-    @mysql_close($new_connection);
-    return true;
-  }
-
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* Log view */
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","users/".get_class($this),$this->dn);
-    }
-
-    $display = "";
-    $SkipWrite = (!isset($this->parent) || !$this->parent) && !isset($_SESSION['edit']);
-    if(empty($this->macro)&&(!empty($this->goFonMacro))){
-
-      /* Go through already saved values, for a parameter */
-      $tmp = split("!",$this->goFonMacro);
-
-      /* it is possible that nothing has been saved yet */
-      if(is_array($tmp)){
-
-        /* First value is the macroname */
-        $this->macro = $tmp[0];
-
-        /* Macroname saved, delete that index */
-        unset($tmp[0]);
-
-        /* Check if macro has been removed */
-        if(!isset($this->macroarray[$this->macro])){
-          $this->macrostillavailable = false;
-        }else{
-          $this->macrostillavailable = true;
-        }
-
-        /* for each parametervalues ( parameterID#value like 25#twentyfive) */
-        foreach($tmp as $var){
-
-          /* Split this, so we have $varar[0] = parameterID $varar[1] = SelectedValue */
-          $varar = split("#",$var);
-
-          /* Only insert if the parameter still exists */
-          if(isset($this->macroarray[$this->macro][$varar[0]])){
-            /* Assign value */
-            $this->macroarray[$this->macro][$varar[0]]['choosen']=$varar[1];
-          }
-        }
-      }
-    }
-    
-    /* Do we represent a valid account? */
-    if (!$this->is_account && $this->parent === NULL){
-      $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\">&nbsp;<b>".
-        _("This account has no phone extensions.")."</b>";
-      $display.= back_to_main();
-      return ($display);
-    }
-
-    /* Do we need to flip is_account state? */
-    if (isset($_POST['modify_state'])){
-      $this->is_account= !$this->is_account;
-    }
-
-    /* Select no macro if, state is empty, this is the case, if the selected macro is no longer available */
-    if(empty($this->macro)){
-      $this->macro ="none";
-    }
-
-    /* Prepare templating */
-    $smarty= get_smarty();
-
-    /* tell user that the selected plugin is no longer available */
-    if((!$this->macrostillavailable)&&($this->macro!="none")){
-      print_red(_("The macro you selected, is no longer available for you, please choose another one."));
-    }
-
-    /* Assing macroselectbox values  */
-    $smarty->assign("macros",$this->macros);   
-    $smarty->assign("macro", $this->macro);   
-
-    /* check if there is a FON server created */
-    if(!count($this->goFonHomeServer)){
-      print_red(_("There is currently no asterisk server defined. Possibly you are missing a server that handles the asterisk management (goFonServer). Your settings can't be saved to asterisk database."));
-    }
-
-    /* Create html parameter table for selected macro parameters 
-     *  skip if no parameters given 
-     */
-    if(!isset($this->macroarray[$this->macro])){
-      $macrotab="";
-    }else{
-
-      $macrotab ="<table summary=\""._("Parameter")."\">";
-      /* for every single parameter-> display textfile,combo, or true false switch*/
-
-      foreach($this->phoneNumbers as $phonenum){
-        $tmp[] = $phonenum;
-      }
-    
-      if($this->macro != $this->lastmacro){
-        /* Go through all params */
-        foreach($this->macroarray[$this->macro] as $key => $paras){
-
-          $string = $paras['default'];
-
-          $string=preg_replace("/%uid/i",$this->uid,$string);
-
-          if(isset($this->cn)){
-            $string=preg_replace("/%cn/i",$this->cn,$string);
-          }
-
-          for($i = 0 ; $i < 10; $i++){
-            if(isset($tmp[$i])){
-              $string = preg_replace("/%telephoneNumber_".($i+1)."/i",$tmp[$i],$string);
-            }
-          }
-          if(isset($tmp[0])){
-            $string = preg_replace("/%telephoneNumber/i",$tmp[0],$string);
-          }
-          $this->macroarray[$this->macro][$key]['choosen']=$string;
-        }
-      }
-
-      foreach($this->macroarray[$this->macro] as $paras){
-
-        /* get al vars */
-        $var        = $paras['var'];           
-        $name       = $paras['name'];           
-        $default    = $paras['default'];
-        $type       = $paras['type'];
-        $choosen    = $paras['choosen'] ; 
-        $str        = $default;
-
-        $dis = "";
-        if(!$this->acl_is_writeable("goFonMacro",$SkipWrite)){
-          $dis = " disabled ";
-        }
-
-        /* in case of a combo box display a combobox with selected attr */
-        $macrotab.= "<tr>";
-        switch ($type){
-
-          case "combo":
-            $str= "<select name='".$var."' ".$dis." >";
-          foreach(split(":",$default) as $choice){
-            if($choosen==$choice){
-              $str.= "\n<option value='".$choice."' selected>".$choice."&nbsp;</option>";
-            }else{
-              $str.= "\n<option value='".$choice."'>".$choice."&nbsp;</option>";
-            }
-          }
-          $str.="</select>";
-          $macrotab.= "<td>".base64_decode($name)."</td><td>$str";
-          break;
-
-          case "bool":
-            if(!$choosen){
-              $str="\n<input type='checkbox' name='".$var."' value='1' ".$dis." >";
-            }else{
-              $str="\n<input type='checkbox' name='".$var."' value='1' checked  ".$dis.">";
-            }
-          $macrotab.= "<td colspan='2'>$str&nbsp;".base64_decode($name)."";
-          break;
-
-          case "string":
-            $str="<input name='".$var."' value='".$choosen."' ".$dis." style='width:340px;'>";
-          $macrotab.= "<td>".base64_decode($name)."</td><td>$str";
-          break;
-
-        }
-        $macrotab.= "</td></tr>";
-
-      }
-      $macrotab.="</table><input name='post_success' type='hidden' value='1'>";
-    }//is_array()
-
-    /* Give smarty the table */
-    $smarty->assign("macrotab",$macrotab);
-
-
-    /* Do we represent a valid account? */
-    if (!$this->is_account && $this->parent === NULL){
-      $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\">&nbsp;<b>".
-        _("This account has no phone extensions.")."</b>";
-      $display.= back_to_main();
-      return($display);
-    }
-
-    $display= "";
- /* Show tab dialog headers */
-    if ($this->parent !== NULL){
-      if ($this->is_account){
-        $display= $this->show_disable_header(_("Remove phone account"),
-            _("This account has phone features enabled. You can disable them by clicking below."));
-      } else {
-        if(empty($this->uid)){
-          $display= $this->show_enable_header(_("Create phone account"),
-              _("This account has phone features disabled. You can't enable them while no uid is set."),TRUE,TRUE);
-        }else{
-          $display= $this->show_enable_header(_("Create phone account"),
-              _("This account has phone features disabled. You can enable them by clicking below."));
-        }
-        return ($display);
-      }
-    }
-
-    /* Add phone number */
-    if (isset($_POST["add_phonenumber"]) && $_POST['phonenumber']){
-      if (is_phone_nr($_POST['phonenumber'])){
-        $number= $_POST["phonenumber"];
-        $this->phoneNumbers[$number]= $number;
-        $this->is_modified= TRUE;
-      } else {
-        print_red(_("Please enter a valid phone number!"));
-      }
-    }
-
-    /* Remove phone number */
-    if (isset($_POST["delete_phonenumber"]) && isset($_POST["phonenumber_list"])){
-      foreach ($_POST['phonenumber_list'] as $number){
-        unset($this->phoneNumbers[$number]);
-        $this->is_modified= TRUE;
-      }
-    }
-
-    /* Assign acls */
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translation){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-
-    /* Transfer ACL's */
-    foreach($this->attributes as $val){
-      if(isset($this->$val)){
-        $smarty->assign($val,$this->$val);
-      }else{
-        $smarty->assign($val,"");
-      }
-    }
-
-    /* Create home server array */
-    $tmp = array();
-    foreach($this->goFonHomeServers as $dn => $attrs){
-      if(!is_numeric($dn)){
-        $tmp[$dn] = $attrs['SERVER'];
-      }
-    }
-    $smarty->assign("goFonHomeServers",$tmp);
-
-    /* Fill arrays */
-    $smarty->assign ("goFonHardware", $this->goFonHardware);
-    if (!count($this->phoneNumbers)){
-      $smarty->assign ("phoneNumbers", array());
-    } else {
-      $smarty->assign ("phoneNumbers", $this->phoneNumbers);
-    }
-
-    $dis = "";
-    if(!$this->acl_is_writeable("goFonHardware",$SkipWrite)){
-      $dis= " disabled ";
-    }
-    $hl= "<select size=\"1\" name=\"goFonHardware\" ".$dis." title=\"".
-       _("Choose your private phone")."\">\n";
-
-    foreach ($this->hardware_list as $cn => $description){
-      if ($cn == $this->goFonHardware){
-        $selected= "selected";
-      } else {
-        $selected= "";
-      }
-      if (isset($this->used_hardware[$cn])){
-        $color= "style=\"color:#A0A0A0\"";
-      } else {
-        $color= "";
-      }
-      $hl.= "  <option $color label=\"$cn\" value=\"$cn\" $selected>$description&nbsp;</option>\n";
-    }
-    $hl.= "</select>\n";
-    $smarty->assign ("hardware_list", $hl);
-
-    /* Show main page */
-    $this->lastmacro = $this->macro;
-    $display.= $smarty->fetch(get_template_path('generic.tpl', TRUE, dirname(__FILE__)));
-    return($display);
-  }
-
-
-  function save_object()
-  {
-    $SkipWrite = (!isset($this->parent) || !$this->parent) && !isset($_SESSION['edit']);
-    if (isset($_POST["phoneTab"])){
-    
-      plugin::save_object();
-
-      /* Save checkbox */
-      $tmp = preg_replace("/[^a-z]/i","",$this->goFonDeliveryMode);
-      if($this->acl_is_writeable("goFonDeliveryMode",$SkipWrite)){
-        if(isset($_POST['fon_to_mail']) && !preg_match("/M/",$this->goFonDeliveryMode)){
-          $tmp .= "M";
-        }elseif(!isset($_POST['fon_to_mail']) && preg_match("/M/",$this->goFonDeliveryMode)){
-          $tmp  = preg_replace ("/M/","",$tmp);
-        }
-      }
-      $this->goFonDeliveryMode= "[".$tmp."]";
-
-
-      /* Every macro in the select box are available */
-      if((isset($_POST['macro']))){
-        $this->macrostillavailable=true;
-      }
-
-      if(isset($_POST['macro']) && $_POST['macro'] != $this->macro){
-        $this->is_modified =true;
-      }
-
-      if(is_array($this->phoneNumbers)){
-        foreach($this->phoneNumbers as $telenumms) {
-          $nummsinorder[]=$telenumms; 
-        }
-      }else{
-        $nummsinorder=array("");
-      }
-
-
-      /* get all Postvars */
-      if(isset($this->macroarray[$this->macro])){
-
-        if($this->acl_is_writeable("goFonMarco",$SkipWrite)){
-          foreach($this->macroarray[$this->macro] as $key => $paras){
-
-            $backup = $this->macroarray[$this->macro][$key];
-
-            if(isset($_POST[$paras['var']])){
-              $this->macroarray[$this->macro][$key]['choosen'] = $_POST[$paras['var']];
-            }
-
-            /* Checkboxes are special, they are not Posted if they are not selected, so the won't be changed with the above code
-               We need this code below to read and save checkboxes correct
-             */
-
-            if(isset($_POST['post_success'])){
-              if($this->macroarray[$this->macro][$key]['type']=="bool"){
-                if(isset($_POST[$this->macroarray[$this->macro][$key]['var']])) {
-                  $this->macroarray[$this->macro][$key]['choosen']=$_POST[$paras['var']];
-                }else{
-                  $this->macroarray[$this->macro][$key]['choosen']=false;
-                }
-              }
-            }
-          }
-          if(count(array_diff($this->macroarray[$this->macro][$key],$backup))){
-            $this->modified = TRUE;
-          }
-        }
-      }
-    }
-  }
-
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    if(!count($this->goFonHomeServers)){
-      $message[] = _("There must be at least one server with an asterisk database to create a phone account.");
-    }
-
-    if(empty($this->goFonHomeServer)){
-      $message[] = _("Please select a valid goFonHomeServer.");
-    }
-
-    if((strlen($this->goFonVoicemailPIN)==0)||(strlen($this->goFonVoicemailPIN)>4)){
-      $message[]=(_("Voicemail PIN must be between 1-4 characters."));
-    }else{
-      if(preg_match("/[^0-9]/",$this->goFonVoicemailPIN)){
-        $message[]=(_("The specified Voicemail PIN contains invalid characters, only numeric values are allowed here."));
-      }
-    }
-
-    if(preg_match("/[^0-9a-z]/i",$this->goFonPIN)){
-      $message[]=(_("The specified phone PIN contains invalid characters, only aphanumeric values are allowed here."));
-    }
-
-    if ($this->initially_was_account != $this->is_account || $this->is_modified){
-      if(!$this->generate_mysql_entension_entries()){
-        $message[] = $this->generate_error;
-      }
-    }
-
-    /* We need at least one phone number */
-    if (count($this->phoneNumbers) == 0){
-      $message[]= sprintf(_("You need to specify at least one phone number!"));
-    }
-
-    /* check for ! in any parameter setting*/
-    if(isset($this->macroarray[$this->macro])){
-      foreach($this->macroarray[$this->macro] as $val){
-        if((strstr($val['choosen'],"!"))||(strstr($val['choosen'],"#"))){
-          $message[] = sprintf(_("The parameter %s contains invalid char. '!,#' is used as delimiter"),$val['name']);
-        }
-      }
-    }
-    return ($message);
-  }
-
-
-
-  function save()
-  {
-    plugin::save();
-
-    /* Force saving macro again 
-     * This ensures that 
-     *  - the macro is available on the destiantion server.
-     *  - the macro saved is up to date on the destination server.
-     */
-    if(!empty($this->macro) && $this->macro != "none")  {
-      $macro_tab= new macrotabs($this->config,$this->config->data['TABS']['MACROTABS'], $this->macro,"gofonmacro");
-      $macro_tab -> save();
-    }
-
-    /* Save arrays */
-    $tmp_numbers = array();
-    foreach ($this->phoneNumbers as $number){
-      $tmp_numbers[] = $number;
-    }
-
-    /* Save settings, or remove goFonMacro attribute*/
-    if($this->macro!="none"){    
-      $this->attrs['goFonMacro']=$this->macro;
-      if(isset($this->macroarray[$this->macro])){
-        foreach($this->macroarray[$this->macro] as $paras)  {
-          $this->attrs['goFonMacro'].="!".$paras['id']."#".$paras['choosen'];
-        }
-      }
-    }else{
-      $this->attrs['goFonMacro']=array();
-    }
-    unset($this->attrs['macro'])  ;
-
-    $this->attrs['goFonForwarding']=array();
-
-    if ($this->initially_was_account != $this->is_account || $this->is_modified){
-      $str = $this->generate_mysql_entension_entries(true);
-      if(empty($str)){
-        print_red($str);
-      }
-    }
-
-    if($this->attrs['goFonMacro']==""){
-      $this->attrs['goFonMacro']=array();
-    }
-
-    unset($this->attrs['cn']);
-
-    /* Write back to ldap */
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd($this->dn);
-    $this->cleanup();
-    
-    /* Force saving numbers, else it will be overwriten by user account. */
-    $this->attrs['telephoneNumber'] =$tmp_numbers;
-    $ldap->modify ($this->attrs); 
-
-    /* Log last action */
-    if($this->initially_was_account){
-      new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }else{
-      new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }
-
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/phone account 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",array("uid" => $this->uid));
-      }
-    } else {
-      $this->handle_post_events("add",array("uid" => $this->uid));
-    }
-
-  }
-
-
-  function adapt_from_template($dn)
-  {
-    plugin::adapt_from_template($dn);
-
-    /* Assemble phone numbers */
-    if (isset($this->attrs['telephoneNumber'])){
-      for ($i= 0; $i<$this->attrs['telephoneNumber']['count']; $i++){
-        $number= $this->attrs['telephoneNumber'][$i];
-        $this->phoneNumbers[$number]= $number;
-      }
-    }
-  }
-
-
-  function remove_from_parent()
-  {
-    if(!$this->initially_was_account) return;
-
-    foreach($this->attributes as $key=>$val){
-      if(in_array($val,array("uid","cn"))){
-        unset($this->attributes[$key]);
-        unset($this->$val);
-      }
-    }
-    if(count($this->goFonHomeServers) && !empty($this->init_HomeServer) && is_callable("mysql_pconnect")){
-
-      // Get Configuration for initial Mysql database Server
-      $a_SETUP = $this->goFonHomeServers[$this->init_HomeServer];
-      $s_parameter  ="";
-
-      // Connect to DB server
-      $r_con =  @mysql_pconnect($a_SETUP['SERVER'],$a_SETUP['LOGIN'],$a_SETUP['PASSWORD']);
-
-      // Check if we are  connected correctly
-      if(!$r_con){
-        print_red(sprintf(_("The MySQL Server '%s' isn't reachable as user '%s', check GOsa log for mysql error."),
-                    $a_SETUP['SERVER'],$a_SETUP['LOGIN']));
-        new log("debug","gofonreport/".get_class($this),"",array(),@mysql_error());
-        return false;
-      }
-
-      // Select database for Extensions
-      $db  =  @mysql_select_db($a_SETUP['DB'],$r_con);
-
-      // Test if we have the database selected correctly
-      if(!$db){
-        print_red(sprintf(_("Can't select database %s on %s."),$a_SETUP['DB'],$a_SETUP['SERVER']));
-        new log("debug","gofonreport/".get_class($this),"",array(),@mysql_error());
-        return false;
-      }
-
-      $SQL="";
-
-      /* If deletion starts from userslist, cn uid are not set */
-      if((isset($this->parent->by_object['user']->uid))&&(!empty($this->parent->by_object['user']->uid))){
-        $this->uid = $this->parent->by_object['user']->uid;
-      }
-
-      if((isset($this->parent->by_object['user']->cn))&&(!empty($this->parent->by_object['user']->cn))){
-        $this->cn  = $this->parent->by_object['user']->cn;
-      }
-
-      $first_num = false;
-      // Delete old entries
-      foreach($this->a_old_telenums as $s_telenums){
-        if(!$first_num){
-          $first_num = $s_telenums;
-        }
-        $SQL[] = "DELETE FROM ".$a_SETUP['EXT_TABLE']." WHERE exten='".$s_telenums."';\n";
-      }
-
-      $SQL[] = "DELETE FROM ".$a_SETUP['VOICE_TABLE']." WHERE customer_id='".$first_num."';";
-      $SQL[] = "DELETE FROM ".$a_SETUP['EXT_TABLE']." WHERE exten='".$this->uid."';\n";
-      $SQL[] = "DELETE FROM ".$a_SETUP['SIP_TABLE']." WHERE name='".$this->uid."';\n";
-
-      foreach($SQL as $query){
-        @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query, "Database query");
-        if(!@mysql_query($query,$r_con)){
-          print_red(_("Stop".mysql_error()));
-          return false;
-        }
-      }
-    }else{
-      print_red(_("Can't remove phone account, the mysql extension is not present in php configuration."));
-      return false;
-    }
-
-    /* unset macro attr, it will cause an error */
-    $tmp = array_flip($this->attributes);
-    unset($tmp['macro']);
-    $this->attributes=array_flip($tmp);
-
-    /* Cancel if there's nothing to do here */
-    if (!$this->initially_was_account){
-      return;
-    }
-
-    plugin::remove_from_parent();
-
-    /* Just keep one phone number */
-    if (count($this->telephoneNumber) && $this->telephoneNumber != ""){
-      $this->attrs['telephoneNumber']= $this->telephoneNumber;
-    } else {
-      $this->attrs['telephoneNumber']= array();
-    }
-
-
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(&(objectClass=goFonQueue)(member=*))", array("member"));
-    while($attr = $ldap->fetch()){
-      if(in_array($this->dn,$attr['member'])){
-        $new =new ogrouptabs($this->config, $this->config->data['TABS']['OGROUPTABS'],$attr['dn']);
-        unset($new->by_object['ogroup']->memberList[$this->dn]);
-        unset($new->by_object['ogroup']->member[$this->dn]);
-        $new->save();
-        print_red(sprintf(_("Removed user '%s' from phone queue '%s'."),$this->uid,$new->by_object['ogroup']->cn));
-      }
-    }
-    $ldap->cd($this->dn);
-    $this->cleanup();
-    $ldap->modify ($this->attrs); 
-
-    new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/phone account with dn '%s' failed."),$this->dn));
-
-    /* Optionally execute a command after we're done */
-    @mysql_close($r_con);
-    $this->handle_post_events('remove',array("uid"=> $this->uid));
-  }
-
-
-
-  /* This function checks if the given phonenumbers are available or already in use*/
-  function is_number_used()
-  {
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(|(objectClass=goFonAccount)(objectClass=goFonQueue)(objectClass=goFonConference))", array("telephoneNumber","cn","uid"));
-    while($attrs = $ldap->fetch()) {
-      unset($attrs['telephoneNumber']['count']);
-      foreach($attrs['telephoneNumber'] as $tele){
-        if(!isset($attrs['cn'][0])) $attrs['cn'][0]=$attrs['dn'];
-        if(!isset($attrs['uid'][0])) $attrs['uid'][0]=$attrs['dn'];
-        $numbers[$tele]=$attrs;
-      }
-    }
-
-    foreach($this->phoneNumbers as $num){
-      if(!isset($this->cn)) $this->cn = "";
-
-      if((isset($numbers[$num]))&&(($numbers[$num]['uid'][0]!=$this->uid))){
-        if(isset($numbers[$num]['uid'][0])){
-          return sprintf(_("The specified telephonenumber '%s' is already assigned to '%s'."),$num,$numbers[$num]['uid'][0]);
-        }else{
-          return sprintf(_("The specified telephonenumber '%s' is already assigned to '%s'."),$num,$numbers[$num]['cn'][0]);
-        }
-      }
-    }
-  }
-
-
-  /* Create phoneAccount part of copy & paste dialog */
-  function getCopyDialog()
-  { 
-    if(!$this->is_account) return("");
-    $smarty = get_smarty();
-    if (!count($this->phoneNumbers)){
-      $smarty->assign ("phoneNumbers", array(""));
-    } else {
-      $smarty->assign ("phoneNumbers", $this->phoneNumbers);
-    }
-
-    $smarty->assign("goFonVoicemailPIN",$this->goFonVoicemailPIN);
-    $smarty->assign("goFonPIN",$this->goFonPIN);
-
-    $display= $smarty->fetch(get_template_path('paste_generic.tpl', TRUE, dirname(__FILE__)));
-    $ret =array();
-    $ret['string'] = $display;
-    $ret['status'] = "";
-    return($ret);
-  }
-
-  /* Save posts from copy & paste dialog dialog  */
-  function saveCopyDialog()
-  {
-    if(!$this->is_account) return;
-    $this->execute();
-    if(isset($_POST['goFonVoicemailPIN'])) {
-      $this->goFonVoicemailPIN = $_POST['goFonVoicemailPIN'];
-    }
-    if(isset($_POST['goFonPIN'])){
-      $this->goFonPIN = $_POST['goFonPIN'];
-    }
-  }
-
-
-  function allow_remove()
-  {
-    /* Check if previously selected server is still available */
-    if($this->initially_was_account && !isset($this->goFonHomeServers[$this->goFonHomeServer])){
-      return sprintf(_("The previously selected asterisk home server (%s) is no longer available. Remove aborted."),preg_replace("/,/",", ",$this->goFonHomeServer));
-    }
-  }
-
-  /* Return plugin informations for acl handling */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"     => _("Phone"),
-          "plDescription"   => _("Phone account settings"),
-          "plSelfModify"    => TRUE,
-          "plDepends"       => array("user"),
-          "plPriority"      => 7,                                 // Position in tabs
-          "plSection"       => "personal",                        // This belongs to personal
-          "plCategory"      => array("gofonreport" => array("description" => _("GOfon reports"),
-              "objectClass" => "")),
-
-          "plOptions"       => array(),
-
-          "plProvidedAcls"  => array(
-            "telephoneNumber"     => _("Telephone number"),
-            "goFonHomeServer"     => _("Home server"),
-            "goFonMacro"          => _("Macro settings"),
-            "goFonHardware"       => _("Phone hardware"),
-            "goFonPIN"            => _("Telephone pin"),
-            "goFonVoicemailPIN"   => _("Voicemail pin"))
-          ));
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/gofon/phoneaccount/generic.tpl b/plugins/gofon/phoneaccount/generic.tpl
deleted file mode 100644 (file)
index f034afe..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-<table summary="{t}Phone numbers{/t}" style="width:100%">
- <tr>
-  <td style="vertical-align:top; border-right:1px solid #A0A0A0; width:50%">
-   <h2>
-    <img class="center" alt="" align="middle" src="images/banana.png" />
-    &nbsp;{t}Phone numbers{/t}
-   </h2>
-{render acl=$telephoneNumberACL}
-   <select style="width:100%;" name="phonenumber_list[]" size=7 multiple>
-    {html_options options=$phoneNumbers}
-    <option disabled>&nbsp;</option>
-   </select>
-{/render}
-   <br>
-{render acl=$telephoneNumberACL}
-   <input name="phonenumber" size=20 align=middle maxlength=60 value="">
-{/render}
-{render acl=$telephoneNumberACL}
-   <input type="submit" value="{t}Add{/t}" name="add_phonenumber">&nbsp;
-{/render}
-{render acl=$telephoneNumberACL}
-      <input type="submit" value="{t}Delete{/t}" name="delete_phonenumber">
-{/render}
-  </td>
-  <td style="vertical-align:top; width:50%;">
-   <table summary="" style="width:100%" border=0>
- <tr>
-
-  <td style="vertical-align:top;">
-   <h2><img class="center" alt="" align="middle" src="images/hardware.png" />&nbsp;{t}Telephone hardware{/t}</h2>
-
-      <table summary="{t}Telephone{/t}" border=0>
-       <tr>
-        <td>{t}Telephone{/t}</td>
-        <td>{$hardware_list}</td>
-       </tr>
-       <tr>
-        <td>{t}Home server{/t}{$must}
-        </td>
-        <td>
-{render acl=$goFonHomeServerACL}
-         <select name='goFonHomeServer' title='{t}Select the accounts home server{/t}'>
-          {html_options options=$goFonHomeServers selected=$goFonHomeServer}
-         </select>
-{/render}
-        </td>
-      </tr>
-      <tr>
-       <td>
-        <label for="goFonVoicemailPIN">{t}Voicemail PIN{/t}{$must}</label>
-       </td>
-       <td>
-{render acl=$goFonVoicemailPINACL}
-        <input type="password" id="goFonVoicemailPIN" name="goFonVoicemailPIN" value="{$goFonVoicemailPIN}">
-{/render}
-      </td>
-      </tr>
-      <tr>
-       <td>
-        <label for="goFonPIN">{t}Phone PIN{/t}{$must}</label>
-       </td>
-       <td>
-{render acl=$goFonPINACL}
-        <input type="password" id="goFonPIN" name="goFonPIN" value="{$goFonPIN}">
-{/render}
-      </td>
-      </tr>
-      </table>
-     </td>
-    </tr>
-   </table>
-  </td>
-
- </tr>
- <tr>
- <td style="vertical-align:top; border-top:1px solid #A0A0A0; width:50%" colspan="2">&nbsp;</td>
- </tr>
- <tr style="vertical-align:top; border-top:1px solid #A0A0A0;">
- <td colspan=2 style="vertical-align:top;width:50%">
-  <h2>
-   <img class="center" alt="" src="images/select_macro.png" align="middle" />
-   &nbsp;{t}Phone macro{/t}
-  </h2>
-  <table summary="{t}Phone macro{/t}">
-   <tr>
-    <td colspan=2>
-{render acl=$goFonMacroACL}
-     <select name="macro" onchange="document.mainform.submit()">
-      {html_options options=$macros selected=$macro}
-      <option disabled>&nbsp;</option>
-     </select>
-{/render}
-     {if $javascript eq 'false'}
-{render acl=$goFonMacroACL}
-      <input type="submit" name="refresh" value="{t}Refresh{/t}">
-{/render}
-     {/if}
-    </td>
-   </tr>
-  </table>
-  <br>
-  {$macrotab}
- </td>
- </tr>
-</table>
-<input type="hidden" name="phoneTab" value="phoneTab">
-
-
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('phonenumber');
-  -->
-</script>
diff --git a/plugins/gofon/phoneaccount/main.inc b/plugins/gofon/phoneaccount/main.inc
deleted file mode 100644 (file)
index 683057a..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-<?php
-/*
-  This code is part of GOsa (https://gosa.gonicus.de)
-  Copyright (C) 2004  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
-*/
-
-$display       = "";
-$lock_msg      = "";
-if (!$remove_lock){
-       /* Reset requested? */
-       if (isset($_POST['edit_cancel']) ||
-               (isset($_GET['reset']) && $_GET['reset'] == 1)){
-
-               del_lock ($ui->dn);
-               sess_del ('edit');
-               sess_del ('phoneAccount');
-       }
-
-       /* Create phoneAccount object on demand */
-       if (!isset($_SESSION['phoneAccount']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
-               $_SESSION['phoneAccount']= new phoneAccount ($config, $ui->dn);
-               $_SESSION['phoneAccount']->set_acl_base($ui->dn);
-               $_SESSION['phoneAccount']->set_acl_category("users");
-       }
-       $phoneAccount= $_SESSION['phoneAccount'];
-
-       /* save changes back to object */
-       if (isset ($_SESSION['edit'])){
-               $phoneAccount->save_object ();
-       }
-
-       /* Enter edit mode? */
-       if (isset($_POST['edit'])){
-
-               /* Check locking */
-               if (($username= get_lock($ui->dn)) != ""){
-                       $_SESSION['back_plugin']= $plug;
-                       $_SESSION['LOCK_VARS_TO_USE'] = array("/^edit$/","/^plug$/");
-                       $lock_msg =  gen_locked_message ($username, $ui->dn);
-
-               }else{
-
-                       /* Lock the current entry */
-                       add_lock ($ui->dn, $ui->dn);
-                       $_SESSION['dn']= $ui->dn;
-                       $_SESSION['edit']= TRUE;
-               }
-
-       }
-
-       /* save changes to LDAP and disable edit mode */
-       if (isset($_POST['edit_finish'])){
-
-               /* Perform checks */
-               $message= $phoneAccount->check ();
-
-               /* No errors, save object */
-               if (count ($message) == 0){
-                       $phoneAccount->save ();
-
-                       del_lock ($ui->dn);
-                       sess_del ('edit');
-
-                       /* Write back to session */
-                       $_SESSION['phoneAccount']= $phoneAccount;
-               } else {
-                       /* Errors found, show message */
-                       show_errors ($message);
-               }
-       }
-
-       /* Execute formular */
-       if($lock_msg){
-               $display.= $lock_msg;
-       }else{
-               $display.= $phoneAccount->execute ();
-       }
-
-       /* Store changes  in session */
-       if (isset ($_SESSION['edit'])){
-               $_SESSION['phoneAccount']= $phoneAccount;
-       }
-
-       $info= "";
-       if ($phoneAccount->is_account && empty($lock_msg)){
-               $display.= "<p class=\"plugbottom\">";
-
-               /* Are we in edit mode? */
-               if (isset($_SESSION['edit'])){
-                       $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
-                       $display.= "&nbsp;";
-                       $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
-                       $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".$ui->dn."&nbsp;";
-               } else {
-                       $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/openlock.png')."\"> ".$ui->dn."&nbsp;";
-
-                       if(preg_match("/w/",$ui->get_permissions($ui->dn,"users/phoneAccount"))){
-                               $info.= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/lamp.png')."\">"._("Click the 'Edit' button below to change informations in this dialog");
-                               $display.= "<input type=submit name=\"edit\" value=\""._("Edit")."\">\n";
-                       }
-                       $display.= "<input type=\"hidden\" name=\"ignore\">\n";
-               }
-               $display.= "</p>\n";
-               $display.= "<input type=\"hidden\" name=\"ignore\">\n";
-       }
-
-       /* Page header*/
-       $display= print_header(get_template_path('images/phone.png'), _("Phone settings"), $info).$display;
-
-}
-?>
diff --git a/plugins/gofon/phoneaccount/paste_generic.tpl b/plugins/gofon/phoneaccount/paste_generic.tpl
deleted file mode 100644 (file)
index d643e9f..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-<h2>{t}Phone settings{/t}</h2>
-<table summary="{t}Phone numbers{/t}" style="width:100%" cellspacing=0>
- <tr>
-  <td style="vertical-align:top; border-right:1px solid #A0A0A0; width:50%">
-   <h2>
-    <img class="center" alt="" align="middle" src="images/banana.png" />&nbsp;{t}Phone numbers{/t}
-   </h2>
-  </td>
- </tr>
- <tr>
-  <td style="vertical-align:top; border-right:1px solid #A0A0A0; width:50%">
-   <select style="width:100%;" name="phonenumber_list[]" size=7 multiple>
-    {html_options options=$phoneNumbers}
-     <option disabled>&nbsp; </option>
-   </select>
-   <br>
-   <input name="phonenumber" size=20 align=middle maxlength=60 value="">
-   <input type="submit" value="{t}Add{/t}" name="add_phonenumber"> 
-   <input type="submit" value="{t}Delete{/t}" name="delete_phonenumber">
-  </td>
-  <td style="vertical-align:top; width:50%;">
-   <table summary="" style="width:100%" border=0>
-    <tr>
-     <td style="vertical-align:top;">
-      <h2> 
-       <img class="center" alt="" align="middle" src="images/hardware.png" />
-       &nbsp;{t}Telephone hardware{/t}
-      </h2>
-      <table summary="{t}Telephone{/t}" border=0>
-       <tr>
-        <td>
-         <label for="goFonVoicemailPIN">{t}Voicemail PIN{/t}{$must}</label>
-        </td>
-        <td>
-         <input type="password" id="goFonVoicemailPIN" name="goFonVoicemailPI" value="{$goFonVoicemailPIN}">
-        </td>
-       </tr>
-       <tr>
-        <td>
-         <label for="goFonPIN">{t}Phone PIN{/t}{$must}</label>
-        </td>
-        <td>
-         <input type="password" id="goFonPIN" name="goFonPIN" value="{$goFonPIN}">
-        </td>
-       </tr>
-      </table>
-     </td>
-    </tr>
-   </table>
-  </td>
- </tr>
-</table>
-<input type="hidden" name="phoneTab" value="phoneTab">
-<br>
-<br>
diff --git a/plugins/personal/connectivity/class_connectivity.inc b/plugins/personal/connectivity/class_connectivity.inc
deleted file mode 100644 (file)
index 70cfd87..0000000
+++ /dev/null
@@ -1,190 +0,0 @@
-<?php
-/*! \brief   connectivity plugin
-  \author  Cajus Pollmeier <pollmeier@gonicus.de>
-  \version 2.30
-  \date    29.03.2005
-
-  This class provides the functionality to read and write all attributes
-  relevant for connectivity settings from/to the LDAP. It does syntax checking
-  and displays the formulars required.
- */
-
-class connectivity extends plugin
-{
-  /* Definitions */
-  var $plHeadline= "Connectivity";
-  var $plDescription= "This does something";
-
-  /* attribute list for save action */
-  var $attributes= array();
-  var $objectclasses= array();
-
-  var $ignore_account= TRUE;
-  var $plugin= array();
-  var $plugin_name= array();
-  var $CopyPasteVars = array("plugin","plugin_name");
-
-
-  function connectivity (&$config, $dn= NULL,$parent =NULL)
-  {
-    /* Preseed permissions */
-    $this->dn= $dn;
-    $ui= get_userinfo();
-
-    /* Load accounts */
-    foreach ($config->data['TABS']['CONNECTIVITY'] as $plug){
-      $name= $plug['CLASS'];
-      $this->plugin_name[]= $name;
-      $this->plugin[$name]= new $name($config, $dn,$parent);
-
-      /* Acl base && category configuration, 
-          these settings will be overloaded in main.inc, 
-          if we are editing ourself */
-      $this->plugin[$name]-> set_acl_category("users");
-      $this->plugin[$name]-> set_acl_base($this->dn);
-    }
-  }
-
-  function execute()
-  {
-       /* Call parent execute */
-       plugin::execute();
-
-    $display= "";
-
-    /* Prepare templating */
-    $smarty= get_smarty();
-
-    /* Do we represent a valid account? */
-    if ($this->parent === NULL){
-      $enabled= true;
-      foreach ($this->plugin_name as $name){
-        if ($this->plugin[$name]->is_account){
-          $enabled= true;
-          break;
-        }
-      }
-      if (!$enabled){
-        $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\">&nbsp;<b>".
-          _("This account has no connectivity extensions.")."</b>";
-        $display.= back_to_main();
-        return ($display);
-      }
-    }
-
-    /* Remove checkboxes in single edit mode */
-    if ($this->parent !== NULL){
-      foreach ($this->plugin_name as $name){
-        $this->plugin[$name]->parent= $this->parent;
-      }
-    }
-
-    /* Execude  objects */
-    $is_first= true;
-
-    $ReadOnly = (!isset($this->parent) || !$this->parent) && !isset($_SESSION['edit']);
-
-    foreach ($this->plugin_name as $name){
-      $this->plugin[$name]->ReadOnly = $ReadOnly;
-      if (!$is_first){
-        $display.= '<p class="seperator">&nbsp;</p>';
-      } else {
-        $is_first= false;
-      }
-      $display.= $this->plugin[$name]->execute();
-    }
-
-    /* Mark me as connectivity tab */
-    $display.= "<input type='hidden' name='connectivityTab'>";
-
-    return($display);
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    if (isset($_POST['connectivityTab'])){
-      foreach ($this->plugin_name as $name){
-        $this->plugin[$name]->save_object();
-      }
-    }
-  }
-
-  function check()
-  {
-    $message= plugin::check();
-
-    foreach ($this->plugin_name as $name){
-      $tmp= $this->plugin[$name]->check();
-
-      $message= array_merge($message, $tmp);
-    }
-
-    return ($message);
-  }
-
-  function set_acl_category($cat)
-  {
-    plugin::set_acl_category($cat);
-    foreach ($this->plugin_name as $name){
-      $this->plugin[$name]->set_acl_category( $cat);
-    }
-  }
-
-  function set_acl_base($base)
-  {
-    plugin::set_acl_base($base);
-    foreach ($this->plugin_name as $name){
-      $this->plugin[$name]->set_acl_base( $base);
-    }
-  }
-
-  /* Save to LDAP */
-  function save()
-  {
-    /* Save objects */
-    foreach ($this->plugin_name as $name){
-      $this->plugin[$name]->dn= $this->dn;
-      
-      if ($this->plugin[$name]->is_account){
-        $this->plugin[$name]->save();
-      } else {
-        $this->plugin[$name]->remove_from_parent();
-      }
-    }
-  }
-
-  function remove_from_parent()
-  {
-    /* Remove objects */
-    foreach ($this->plugin_name as $name){
-      $this->plugin[$name]->dn= $this->dn;
-      $this->plugin[$name]->remove_from_parent();
-    }
-  }
-
-  function adapt_from_template($dn)
-  {
-    /* Adapt objects */
-    foreach ($this->plugin_name as $name){
-      $this->plugin[$name]->dn= $this->dn;
-      $this->plugin[$name]->adapt_from_template($dn);
-    }
-  }
-
-  /* Prepare the connectivity obj 
-   */
-  function PrepareForCopyPaste($obj)
-  { 
-    $tmp = $this->plugin;
-    plugin::PrepareForCopyPaste($obj);
-    $this->plugin = $tmp;
-    foreach( $this->plugin as $key => $plug){
-      $this->plugin[$key]->PrepareForCopyPaste($obj);
-    }
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/personal/connectivity/class_intranetAccount.inc b/plugins/personal/connectivity/class_intranetAccount.inc
deleted file mode 100644 (file)
index c2b9573..0000000
+++ /dev/null
@@ -1,213 +0,0 @@
-<?php
-
-
-
-/*!
-  \author  Harald Falk <hf@doellken-weimar.de>
-  \version 1.00
-  \date    1.07.2005
-
-  \brief   Enables Apache authentification for Intranet through openldap with .htaccess files   
- */
-
-class intranetAccount extends plugin
-{
-  /*! Definitions */
-  var $plHeadline= "Intranet";
-  /*! Definitions */
-  var $plDescription= "This does something";
-
-  /* attribute list for save action */
-  var $attributes= array();
-  /* ObjectClasses list for save action */
-  var $objectclasses= array("gosaIntranetAccount");
-  var $ReadOnly = false;  
-
-  var $uid ="";
-
-  var $view_logged = FALSE;
-
-  /*! \brief Konstructor  
-
-    \param $config     The Config Object used to initialise plugin
-    \param $dn                 The DN of the currently edited entry    
-    \author  Harald Falk <hf@doellken-weimar.de>
-    \version 1.00
-    \date    1.07.2005
-   */
-  function intranetAccount (&$config, $dn= NULL, $parent=NULL)
-  {
-    plugin::plugin ($config, $dn,$parent);
-
-    /* Setting uid to default */
-    if(isset($this->attrs['uid'][0])){
-      $this->uid = $this->attrs['uid'][0];
-    }
-  }
-
-  /*!
-    \brief General execution 
-    \author  Harald Falk <hf@doellken-weimar.de>
-    \version 1.00
-    \date    1.07.2005
-
-    Load smarty Template and assign needed smarty vars
-   */
-
-
-  function execute()
-  {
-    /* Call parent execute */
-    // plugin::execute();
-
-    /* Log view */
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","users/".get_class($this),$this->dn);
-    }
-
-    $display= "";
-
-    $smarty= get_smarty();
-
-    if ($this->is_account){
-      $smarty->assign("intranetState", "checked");
-      $smarty->assign("wstate", "");
-    } else {
-      $smarty->assign("wstate", "disabled");
-      $smarty->assign("intranetState", "");
-    }
-
-    //! Ever assign vars to smarty in both cases, to avoid php errors (missing variable aso. ) 
-    if ($this->parent !== NULL){
-      $smarty->assign("tabbed", 1);
-    }else{
-      $smarty->assign("tabbed", 0);    
-    }
-
-
-    $smarty->assign('gosaIntranetACL', " disabled ");
-    if((!$this->ReadOnly) && (    ($this->is_account && $this->acl_is_removeable()) 
-                               || (!$this->is_account && $this->acl_is_createable()))){
-      $smarty->assign('gosaIntranetACL', "");
-    }
-
-    $display.= $smarty->fetch (get_template_path('intranet.tpl', TRUE, dirname(__FILE__)));
-    return ($display);
-  }
-
-  /*! 
-    \brief Delete ext from User
-    \author  Harald Falk <hf@doellken-weimar.de>
-    \version 1.00
-    \date    1.07.2005
-    Handles deletion of this object
-   */
-  function remove_from_parent()
-  {
-    if($this->acl_is_removeable() && $this->initially_was_account){ 
-      plugin::remove_from_parent();
-      $ldap= $this->config->get_ldap_link();
-
-      $ldap->cd($this->dn);
-      @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
-          $this->attributes, "Save");
-      $this->cleanup();
-      $ldap->modify ($this->attrs); 
-
-      /* Log last action */
-      new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-
-      show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/intranet account with dn '%s' failed."),$this->dn));
-
-      /* Optionally execute a command after we're done */
-      $this->postremove(array("uid"=>$this->uid));
-    }
-  }
-
-
-  /*!
-    \brief handles Post data 
-    \author  Harald Falk <hf@doellken-weimar.de>
-    \version 1.00
-    \date    1.07.2005
-    Save data to object 
-   */
-  function save_object()
-  {
-    /* Do we need to flip is_account state? */
-    if (isset($_POST['connectivityTab'])){
-      if (isset($_POST['intranet'])){
-        if (!$this->is_account && $_POST['intranet'] == "B"){
-          if($this->acl_is_createable()){
-            $this->is_account= TRUE;
-          }
-        }
-      } else {
-        if($this->acl_is_removeable()){
-          $this->is_account= FALSE;
-        }
-      }
-    }
-
-    plugin::save_object();
-    if (isset($_POST["INTRANETStatus"])){
-      $this->INTRANETStatus = "disabled";
-    } else {
-      $this->INTRANETStatus = "enabled";
-    }
-  }
-
-
-  /*! \brief Handles LDAP saves 
-    \author  Harald Falk <hf@doellken-weimar.de>
-    \version 1.00
-    \date    1.07.2005
-    Save objectClass for User in LDAP 
-
-   */
-  function save()
-  {
-      plugin::save();
-
-      /* Write back to ldap */
-      $ldap= $this->config->get_ldap_link();
-      $ldap->cd($this->dn);
-      $this->cleanup();
-      $ldap->modify ($this->attrs); 
-
-      /* Log last action */
-      if($this->initially_was_account){
-        new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-      }else{
-        new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-      }
-
-      show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/intranet account with dn '%s' failed."),$this->dn));
-
-      /* Optionally execute a command after we're done */
-      $this->postcreate(array("uid" => $this->uid));
-  }
-
-
-  /* Return plugin informations for acl handling */ 
-  static function plInfo()
-  {
-    return (array(     
-          "plShortName"     => _("Intranet"),
-          "plDepends"       => array("user"),
-          "plPriority"      => 25,                                 // Position in tabs
-          "plSection"     => array("personal" => _("My account")),
-          "plCategory"    => array("users"),
-          "plOptions"       => array(),
-
-          "plDescription"       => _("Intranet account settings")."&nbsp;:&nbsp;<u>"._("Connectivity addon")."</u>",
-          "plSelfModify"        => TRUE,
-
-          "plProvidedAcls"  => array()
-          ));
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/personal/connectivity/class_kolabAccount.inc b/plugins/personal/connectivity/class_kolabAccount.inc
deleted file mode 100644 (file)
index c72977d..0000000
+++ /dev/null
@@ -1,486 +0,0 @@
-<?php
-class kolabAccount extends plugin
-{
-  /* Definitions */
-  var $plHeadline       = "Kolab";
-  var $plDescription    = "This does something";
-
-  /* Kolab attributes */
-  var $kolabInvitationPolicy  = array();
-  var $kolabFreeBusyFuture    = 60;
-  var $unrestrictedMailSize   = 0;
-  var $calFBURL               = "";
-  var $kolabDelegate          = array();
-
-  /* attribute list for save action */
-  var $attributes     = array("kolabFreeBusyFuture", "unrestrictedMailSize", "calFBURL","kolabDelegate","kolabInvitationPolicy");
-  var $objectclasses  = array("kolabInetOrgPerson");
-
-  /* Helper */
-  var $imapping= array();
-  var $mail_Account   = false;
-  var $ReadOnly = false;
-  var $view_logged = FALSE;
-  var $uid = "";
-
-  function kolabAccount (&$config, $dn= NULL,$parent = NULL)
-  {
-    plugin::plugin ($config, $dn, $parent);
-
-    /* Setting uid to default */
-    if(isset($this->attrs['uid'][0])){
-      $this->uid = $this->attrs['uid'][0];
-    }
-
-    /* Pull arrays */
-    foreach(array("kolabDelegate", "kolabInvitationPolicy") as $attr){
-      if (isset($this->attrs["$attr"]["count"])){
-        $tmp = array();
-        for ($i= 0; $i<$this->attrs["$attr"]["count"]; $i++){
-          $tmp[]=$this->attrs["$attr"][$i];
-        }
-        $this->$attr = $tmp;
-      }
-    }
-
-    /* If this one is empty, preset with ACT_MANUAL for anonymous users */
-    if (count ($this->kolabInvitationPolicy) == 0){
-       $this->kolabInvitationPolicy= array("ACT_MANUAL");
-    }
-
-    /* Check is account state */
-    $this->is_account = false;
-    if(count($this->kolabDelegate)){
-      $this->is_account = true;
-    }
-    foreach(array("calFBURL","unrestrictedMailSize") as $attr){
-      if(!empty($this->$attr)){
-        $this->is_account = true;
-      }
-    } 
-
-    /* Transfer account states for this union */
-    if (isset($this->parent->by_object['mailAccount']) && $this->parent->by_object['mailAccount']->is_account){
-      $this->mail_Account = true;
-     }elseif( isset($this->attrs) && isset($this->attrs['kolabHomeServer'])){
-       $this->mail_Account= true;
-     }else{
-       $this->is_account  = false;
-      $this->mail_Account = false;
-    }
-  }
-
-
-  function execute()
-  {
-         /* Call parent execute */
-       plugin::execute();
-
-    /* Log view */
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","users/".get_class($this),$this->dn);
-    }
-
-    /* Show tab dialog headers */
-    $display= "";
-
-    /* Show main page */
-    $smarty= get_smarty();
-
-    /* Load attributes */
-    foreach($this->attributes as $val){
-      $smarty->assign("$val", $this->$val);
-    }
-
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $acl => $description){
-      $smarty->assign($acl."ACL",$this->getacl($acl,$this->ReadOnly));
-      $smarty->assign($acl."_W", $this->acl_is_writeable($acl,$this->ReadOnly));
-    }
-    $smarty->assign("is_account" ,  $this->is_account); 
-
-    if($this->ReadOnly){
-      $smarty->assign("is_removeable",false); 
-      $smarty->assign("is_createable",false); 
-    }else{
-      $smarty->assign("is_removeable",$this->acl_is_removeable()); 
-      $smarty->assign("is_createable",$this->acl_is_createable()); 
-    }
-
-    /* Check for invitation action */
-    $nr= 0;
-    while (isset($_POST["policy$nr"])){
-      if (isset($_POST["add$nr"])){
-        $this->kolabInvitationPolicy[]= ": ACT_MANUAL";
-      }
-      if (isset($_POST["remove$nr"])){
-        $new= array();
-        foreach ($this->kolabInvitationPolicy as $entry){
-          if (!preg_match("/^".$this->imapping[$nr].":/", $entry)){
-            $new[]= $entry;
-          }
-        }
-        $this->kolabInvitationPolicy= $new;
-      }
-      $nr++;
-    }
-
-    /* Unify addresses */
-    $new= array();
-    foreach($this->kolabInvitationPolicy as $value){
-      $address= preg_replace('/^([^:]+:).*$/', '\1', $value);
-      $new[$address]= $value;
-    }
-    $this->kolabInvitationPolicy= array();
-    foreach($new as $value){
-      $this->kolabInvitationPolicy[]= $value;
-    }
-
-    /* Add delegation */
-    if (isset($_POST['add_delegation'])){
-      if ($_POST['delegate_address'] != ""){
-
-        /* Valid email address specified? */
-        $address= $_POST['delegate_address'];
-        $valid= FALSE;
-        if (!is_email($address)){
-          if (!is_email($address, TRUE)){
-              print_red (_("You're trying to add an invalid email address to the list of delegations."));
-          }
-        } else {
-
-          $ldap= $this->config->get_ldap_link();
-          $ldap->cd ($this->config->current['BASE']);
-          $ldap->search('(mail='.$address.')',array("mail"));
-          if ($ldap->count() == 0){
-            print_red (_("The mail address you're trying to add is no primary mail address of an existing user."));
-          } else {
-            $valid= TRUE;
-          }
-        }
-
-        if ($valid){
-          /* Add it */
-          if ($this->acl_is_writeable("kolabDelegate")){
-            $this->addDelegate ($address);
-            $this->is_modified= TRUE;
-          }
-
-        }
-      }
-    }
-
-    /* Delete forward email addresses */
-    if ((isset($_POST['delete_delegation'])) && (isset($_POST['delegate_list']))){
-      if (count($_POST['delegate_list']) && $this->acl_is_writeable("kolabDelegate")){
-        $this->delDelegate ($_POST['delegate_list']);
-      }
-    }
-
-    /* Assemble policies */
-    $policies= array( 'ACT_ALWAYS_ACCEPT'       => _("Always accept"),
-                      'ACT_ALWAYS_REJECT'       => _("Always reject"),
-                      'ACT_REJECT_IF_CONFLICTS' => _("Reject if conflicts"),
-                      'ACT_MANUAL_IF_CONFLICTS' => _("Manual if conflicts"),
-                      'ACT_MANUAL'              => _("Manual"));
-    $smarty->assign('policies', $policies);
-
-    /* Adjust checkbox */
-    if ($this->unrestrictedMailSize){
-      $smarty->assign('unrestrictedMailSizeState', "checked");
-    } else {
-      $smarty->assign('unrestrictedMailSizeState', "");
-    }
-
-    /* Transfer delegation list */
-    if (!count($this->kolabDelegate)){
-      /* Smarty will produce <option value=""></option> and tidy don't like that, so tell smarty to create no option (array();)*/
-      $smarty->assign("kolabDelegate", array());
-    } else {
-      $smarty->assign("kolabDelegate", $this->kolabDelegate);
-    }
-
-    $smarty->assign("mail_account",$this->mail_Account);
-
-    /* Create InvitationPolicy table */
-    $invitation= "";
-    $this->imapping= array();
-    $nr= 0;
-    $changeState  = "";
-    foreach ($this->kolabInvitationPolicy as $entry){
-
-      if($this->acl_is_writeable("kolabInvitationPolicy")){
-        $changeState .= "changeState('address".$nr."'); \n changeState('policy".$nr."'); \n
-          changeState('add".$nr."'); \n changeState('remove".$nr."'); \n";
-      }
-
-      if(!$this->acl_is_writeable("kolabInvitationPolicy")){
-        $dis = " disabled ";
-      }else{
-        if($this->is_account){
-          $dis = " ";
-        }else{
-          $dis = " disabled ";
-        }
-      }
-      $invitation.= "<tr><td>";
-
-      if(!$this->acl_is_readable("kolabInvitationPolicy"))    {
-      }
-
-      /* The default entry does not have colons... */
-      if (!preg_match('/:/', $entry)){
-        $invitation.= _("Anonymous");
-        $name= "";
-        $mode= $entry;
-      } else {
-        $name= preg_replace('/:.*$/', '', $entry);
-        $mode= preg_replace('/^[^:]*: */', '', $entry);
-
-        if(!$this->acl_is_readable("kolabInvitationPolicy")){
-          $name='';
-        }
-        $invitation.= "<input name=\"address$nr\" size=16 maxlength=60  value=\"$name\" id='address".$nr."' ".$dis.">";
-      }
-      $invitation.= "</td>";
-
-      /* Add mode switch */
-      $invitation.= "<td><select size=\"1\" name=\"policy$nr\" id='policy".$nr."' ".$dis.">";
-      foreach($policies as $key => $value){
-        if ($key == $mode){
-          $invitation.= "<option value=\"$key\" selected>$value</option>";
-        } else {
-          $invitation.= "<option value=\"$key\">$value</option>";
-        }
-      }
-      
-      /* Assign buttons */
-      $button= "";
-      if ($nr == count($this->kolabInvitationPolicy)-1){
-        $button= "<input type=submit name=\"add$nr\" value=\""._("Add")."\" id='add".$nr."' ".$dis.">";
-      }
-      if ($nr != 0) {
-        $button.= "<input type=submit name=\"remove$nr\" value=\""._("Remove")."\" id='remove".$nr."' ".$dis.">";
-      }
-      
-      $invitation.= "</select>&nbsp;$button</td></tr>\n";
-      $this->imapping[$nr]= $name;
-      $nr++;
-    }
-    $smarty->assign("invitation", $invitation);
-    $smarty->assign("changeState", $changeState);
-    $smarty->assign("kolabState",$this->is_account);
-    $display.= $smarty->fetch (get_template_path('kolab.tpl', TRUE, dirname(__FILE__)));
-
-
-    return ($display);
-  }
-
-  function remove_from_parent()
-  {
-    if(!$this->initially_was_account){
-      return;
-    }
-  
-    /* Optionally execute a command after we're done */
-    plugin::remove_from_parent();
-    
-    if(!in_array("kolabInetOrgPerson",$this->attrs['objectClass'])){
-      $this->attrs['objectClass'][] = "kolabInetOrgPerson";
-    }
-
-    $ldap = $this->config->get_ldap_linK(); 
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->cd ($this->dn);
-    $ldap->modify($this->attrs);
-
-    /* Log last action */
-    new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-
-    $this->handle_post_events('remove',array("uid" => $this->uid));
-    show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/kolab account with dn '%s' failed."),$this->dn));
-  }
-
-
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    /* FBFuture is in days... */
-    if ($this->kolabFreeBusyFuture != "" && !preg_match('/^[0-9]+$/', $this->kolabFreeBusyFuture)){
-      $message[]= _("The value specified as Free Busy future needs to be an integer.");
-    }
-
-    /* Check for URL scheme... */
-    if(!empty($this->calFBURL) && !preg_match("/http+(s)*:\/\//",$this->calFBURL)){
-      $message[]= _("The value specified as Free Busy Information URL is invalid.");
-    }
-
-    /* Check invitation policy for existing mail addresses */
-    foreach($this->kolabInvitationPolicy as $policy){
-      
-      /* Ignore anonymous string */
-      if (!preg_match('/:/', $policy)){
-        continue;
-      }
-      
-      $address= preg_replace('/^([^:]+).*$/', '\1', $policy);
-      if (!is_email($address)){
-        if (!is_email($address, TRUE)){
-          $message[]= sprintf(_("The invitation policy entry for address '%s' is not valid."), $address);
-        }
-      } else {
-
-        $ldap= $this->config->get_ldap_link();
-        $ldap->cd ($this->config->current['BASE']);
-        $ldap->search('(mail='.$address.')',array("mail"));
-        if ($ldap->count() == 0){
-          $message[]= sprintf(_("There's no mail user with address '%s' for your invitation policy!"), $address);
-        } else {
-          $valid= TRUE;
-        }
-      }
-    }
-
-    return ($message);
-  }
-
-  /* Save data to object */
-  function save_object()
-  {
-    /* Do we need to flip is_account state? */
-    if (isset($_POST['connectivityTab'])){
-
-      if(isset($_POST["kolabState"])){
-        if($this->acl_is_createable()){
-          $this->is_account = true;
-        }
-      }else{
-        if($this->acl_is_removeable()){
-          $this->is_account = false;
-        }
-      }
-      
-      if ($this->acl_is_writeable("unrestrictedMailSize")){
-        if (isset($_POST['unrestrictedMailSize']) && $_POST['unrestrictedMailSize'] == 1){
-          $this->unrestrictedMailSize= 1;
-        } else {
-          $this->unrestrictedMailSize= 0;
-        }
-      }
-    }
-
-    plugin::save_object();
-
-    /* Save changes done in invitation policies */
-    if($this->acl_is_writeable("kolabInvitationPolicy")){
-      $nr= 0;
-      $this->kolabInvitationPolicy= array();
-      while (isset($_POST["policy$nr"])){
-
-        /* Anonymous? */
-        if (!isset($_POST["address$nr"])){
-          $this->kolabInvitationPolicy[]= $_POST["policy$nr"];
-        } else {
-          $this->kolabInvitationPolicy[]= $_POST["address$nr"].": ".$_POST["policy$nr"];
-        }
-
-        $nr++;
-      }
-
-      /* If this one is empty, preset with ACT_MANUAL for anonymous users */
-      if (count ($this->kolabInvitationPolicy) == 0){
-        $this->kolabInvitationPolicy= array("ACT_MANUAL");
-      }
-    }
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    /* Check mailmethod before doing something useful */
-    plugin::save();
-
-    /* Transfer arrays */
-    $this->attrs['kolabDelegate']= $this->kolabDelegate;
-    $this->attrs['kolabInvitationPolicy']= $this->kolabInvitationPolicy;
-
-    /* unrestrictedMailSize is boolean */
-    if($this->attrs['unrestrictedMailSize']){
-      $this->attrs['unrestrictedMailSize'] = "TRUE";
-    }else{
-      $this->attrs['unrestrictedMailSize'] = "FALSE";
-    }
-  
-    /* Write back to ldap */
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd($this->dn);
-    $this->cleanup();
-    $ldap->modify ($this->attrs); 
-
-    /* Log last action */
-    if($this->initially_was_account){
-      new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }else{
-      new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }
-
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/kolab account 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",array("uid" => $this->uid));
-      }
-    } else {
-      $this->handle_post_events("add",array("uid" => $this->uid));
-    }
-  }
-
-
-  /* Add entry to delegation list */
-  function addDelegate($address)
-  {
-    $this->kolabDelegate[]= $address;
-    $this->kolabDelegate= array_unique ($this->kolabDelegate);
-
-    sort ($this->kolabDelegate);
-    reset ($this->kolabDelegate);
-    $this->is_modified= TRUE;
-  }
-
-  function delDelegate($addresses)
-  {
-    $this->kolabDelegate= array_remove_entries ($addresses, $this->kolabDelegate);
-    $this->is_modified= TRUE;
-  }
-
-
-  /* Return plugin informations for acl handling  */
-  static function plInfo()
-  {
-    return (array(     
-          "plShortName"     => _("Kolab"),
-          "plDescription"   => _("Kolab account settings")."&nbsp;:&nbsp;<u>"._("Connectivity addon")."</u>",
-          "plSelfModify"    => TRUE,
-          "plDepends"       => array("user"),
-          "plPriority"      => 20,                                 // Position in tabs
-          "plSection"     => array("personal" => _("My account")),
-          "plCategory"    => array("users"),
-          "plOptions"       => array(),
-
-          "plProvidedAcls"  => array(
-            "kolabFreeBusyFuture"   => _("Free busy future"),
-            "unrestrictedMailSize"  => _("Mail size restriction"),
-            "calFBURL"              => _("Free busy information"),
-            "kolabDelegate"         => _("Delegations"),
-            "kolabInvitationPolicy" => _("Invitation policy"))
-          ));
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/personal/connectivity/class_opengwAccount.inc b/plugins/personal/connectivity/class_opengwAccount.inc
deleted file mode 100644 (file)
index ff96e45..0000000
+++ /dev/null
@@ -1,356 +0,0 @@
-<?php
-
-class opengwAccount extends plugin
-{
-       /* Definitions */
-       var $plHeadline       = "Opengroupware account";
-       var $plDescription    = "This does something";
-
-       /* attribute list for save action */
-       var $attributes       = array();
-       var $objectclasses    = array();
-
-  var $SetPassword   = false;
-
-       /* Attribute mapping opengroupware->ldap  */
-       var $attrsToUse    = array( "salutation"  =>"vocation",
-                       "name"        =>"sn",
-                       "firstname"   =>"givenName",
-                       "login"       =>"uid",
-                       "degree"      =>"academicTitle",
-                       "birthday"    =>"dateOfBirth",
-                       "sex"         =>"gender",
-                       "street"      =>"street",
-                       "zip"         =>"postalCode",
-                       "value_string"=>"mail",
-                       "number"      =>"telephoneNumber"
-                       );
-
-       var $serverCon            =  false;
-       var $handle               = NULL;
-       var $is_account           = false;
-       var $initialy_was_account = false;
-  var $OGWPassword          = "";
-  var $ReadOnly = false;
-  var $view_logged = FALSE;  
-  var $uid = "";
-
-       function opengwAccount (&$config, $dn= NULL)
-       {
-               plugin::plugin ($config, $dn);
-
-    /* Setting uid to default */
-    if(isset($this->attrs['uid'][0])){
-      $this->uid = $this->attrs['uid'][0];
-    }
-
-               $this->info=array();
-
-               /* is no account and was no account */
-               $this->initialy_was_account = false;
-               $this->is_account           = false;
-
-               /* Get configurations */
-    if($this->config->search("opengwAccount", 'USERNAME',array('tabs'))){
-      $atr = array();
-      $atr['LOGIN']    =         $this->config->search("opengwAccount", 'USERNAME',array('tabs'));
-      $atr['PASSWORD']=        $this->config->search("opengwAccount", 'PASSWORD',array('tabs'));
-      $atr['SERVER']   =       $this->config->search("opengwAccount", 'DATAHOST',array('tabs'));
-      $atr['DB']               =         $this->config->search("opengwAccount", 'DATABASE',array('tabs'));
-      $this->serverCon = $atr;
-    }elseif(isset($this->config->data['SERVERS']['OPENGROUPWARE'])){
-      $this->serverCon  = $this->config->data['SERVERS']['OPENGROUPWARE'];
-    }else{
-      $this->serverCon = array();
-    }
-
-    /* check if datebase funktions are available, and if database configurations are available */ 
-               if(is_callable("pg_connect") && count($this->serverCon)){
-
-                       $this->handle     = new ogw($this->serverCon['LOGIN'],$this->serverCon['PASSWORD'],$this->serverCon['SERVER'],$this->serverCon['DB']);
-
-                       /* Check if current configuration allows database connection */
-                       if($this->handle->connected){
-
-                               /* Set login name, to check if this is_account */
-                               if(isset($this->attrs['uid'][0])){
-                                       $this->handle->info['login'] = $this->attrs['uid'][0];
-                               }else{
-                                       $this->handle->info['login'] = ""; 
-                               }
-
-                               /* If this is account get data from database first */
-                               if($this->handle->CheckExistence()){
-                                       $this->info = $this->handle->GetInfos($this->attrs['uid'][0]);
-
-                                       /* This is an account */
-                                       $this->initialy_was_account = true;
-                                       $this->is_account= true;
-                               }else{
-                                       /* this is no account */ 
-                                       $this->initialy_was_account = false;
-                                       $this->is_account= false;
-
-                                       /* Selectable in GOsa */
-                                       $this->info['template_user_id']   = 0;
-                                       $this->info['is_locked']          = 0;
-                                       $this->info['LocationTeamID']     = 0;
-                                       $this->info['TeamIDis']           = array();
-                               }
-
-                               /* Set settings from ldap */
-                               foreach($this->attrsToUse as $name=>$attr){
-                                       if(isset($this->attrs[$attr][0])){
-                                               $this->info[$name] = $this->attrs[$attr][0];
-                                       }else{
-                                               $this->info[$name] = false;
-                                       }
-                               } 
-
-                               /* Description is displayed as 'Nickname' */
-                               $this->info['description']          = $this->info['login'];
-
-                               if($this->info['sex'] == "F"){
-                                       $this->info['sex']                = "female";
-                               }else{
-                                       $this->info['sex']                = "male";
-                               }
-
-                       }
-
-                       /* Transmit data back to ogw handle */
-                       $this->handle->SetInfos($this->info);
-               }
-       }
-
-       function execute()
-       {
-    /* Log view */
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","users/".get_class($this),$this->dn);
-    }
-
-               /* Show tab dialog headers */
-               $display= "";
-               $smarty= get_smarty();
-
-    $smarty->assign("serverCon",count($this->serverCon));
-    $smarty->assign("validTeams","");
-    $smarty->assign("is_account", " ");
-    $smarty->assign("OGWstate"," disabled ");
-    $smarty->assign("validLocationTeam",array("&nbsp;"));
-    $smarty->assign("validLocationTeams",array("&nbsp;"));
-    $smarty->assign("LocationTeam",0);
-    $smarty->assign("validTemplateUser",array("&nbsp;"));
-    $smarty->assign("validTemplateUsers",array("&nbsp;"));
-    $smarty->assign("TemplateUser",0);
-    $smarty->assign("is_lockedCHK", "  ");
-    $smarty->assign("is_locked", "  ");
-               /* set default values */
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $acl => $desc){
-      $smarty->assign($acl."ACL",$this->getacl($acl,$this->ReadOnly));
-    } 
-
-    if((!$this->ReadOnly)&&(($this->is_account && $this->acl_is_removeable()) || (!$this->is_account && $this->acl_is_createable()))) {
-      $smarty->assign('opengwAccountACL', "");
-    }else{
-      $smarty->assign('opengwAccountACL', " disabled ");
-    }
-
-    if(count($this->serverCon))
-
-               /* Check database extension */    
-               if(!is_callable("pg_connect") && count($this->serverCon)){
-                       print_red(_("OpenGroupware: Your configuration is missing a postgresql extension. Can't perform any database queries."));
-               }elseif(count($this->serverCon)){
-
-                       /* Check if config exists */
-                       if($this->config->search("opengwAccount", 'DATABASE',array('tabs'))){
-                               print_red(_("OpenGroupware: Missing database configuration for opengroupware. Can't get or set any informations."));
-                       }else{
-
-                               /* Create handle */
-                               $this->handle     = new ogw($this->serverCon['LOGIN'],$this->serverCon['PASSWORD'],$this->serverCon['SERVER'],$this->serverCon['DB']);
-
-                               /* Check if we are successfully connected to db */
-                               if(!$this->handle->connected){
-                                       print_red(_("OpenGroupware: Can't connect to specified database. Please check given configuration twice."));
-                               }else{
-
-                                       /* Assign LocationTeams */
-                                       $tmp = array(""=>"none");
-                                       foreach($this->handle->validLocationTeam as $id){
-                                               $tmp[$id['company_id']] = $id['description']; 
-                                       }
-                                       $smarty->assign("validLocationTeam",$tmp);
-                                       $smarty->assign("validLocationTeams",array_flip($tmp));
-                                       $smarty->assign("LocationTeam",$this->info['LocationTeamID']);
-
-                                       /* Assign TemplateUsers*/
-                                       $tmp = array();
-                                       foreach($this->handle->validTemplateUser as $id){
-                                               $tmp[$id['company_id']] = $id['name']; 
-                                       }
-                                       $smarty->assign("validTemplateUser",$tmp);
-                                       $smarty->assign("validTemplateUsers",array_flip($tmp));
-                                       $smarty->assign("TemplateUser",$this->info['template_user_id']);
-
-                                       /* Create Team membership */ 
-                                       $str = "";
-                                       if(($this->is_account)==""){
-                                               $dis = "";
-                                       }else{
-                                               $dis = " disabled ";
-                                       }
-
-          if($this->acl_is_readable("Teams")){
-            foreach($this->handle->validTeams as $id){
-              if(in_array($id['company_id'],$this->info['TeamIDis'])){
-                $str .= "<input ".$dis." type='checkbox' value='".$id['company_id']."' 
-                  checked name='team_".base64_encode($id['description'])."'>".$id['description']."<br>";
-              }else{
-                $str .= "<input ".$dis." type='checkbox' value='".$id['company_id']."' 
-                  name='team_".base64_encode($id['description'])."'>".$id['description']."<br>";
-              }
-            }
-          }
-                                       $smarty->assign("validTeams",$str);
-
-                                       /* Assign ogw checkbox */
-                                       if($this->is_account){
-                                               $smarty->assign("OGWstate","");
-                                               $smarty->assign("is_account", " checked ");
-                                       }else{
-                                               $smarty->assign("is_account", " ");
-                                               $smarty->assign("OGWstate"," disabled ");
-                                       }
-
-                                       /* Assign lock status */
-                                       if($this->info['is_locked']){
-                                               $smarty->assign("is_lockedCHK", " checked ");
-                                       }else{
-                                               $smarty->assign("is_lockedCHK", "  ");
-                                       }
-                                       $smarty->assign("is_locked", $this->info['is_locked']);
-
-                               } 
-                       }
-    }
-               $display.= $smarty->fetch (get_template_path('opengw.tpl', TRUE, dirname(__FILE__)));
-               return ($display);
-       }
-
-       function remove_from_parent()
-       {
-               /* remove database entries */
-               if($this->initialy_was_account){
-                       $this->handle = new ogw($this->serverCon['LOGIN'],$this->serverCon['PASSWORD'],$this->serverCon['SERVER'],$this->serverCon['DB']);
-                       $this->handle->SetInfos($this->info);
-                       $this->handle->Perform("REMOVE");
-
-      new log("remove","users/".get_class($this),$this->dn);
-               }
-       }
-
-
-       /* Save data to object */
-       function save_object()
-       {
-               /* get post data */
-               if($this->is_account){
-
-      /* Get selected team chkboxes */
-      $this->info['TeamIDis'] = array();
-      if($this->acl_is_writeable("Teams")) {
-        foreach($_POST as $name => $value ){
-          if(preg_match("/team_/i",$name)){
-            if(!in_array($value,$this->info['TeamIDis'])){
-              $this->info['TeamIDis'][]=$value;
-            }
-          }
-        }
-      }
-
-
-                       /* Get location Team*/
-                       if(isset($_POST['LocationTeam']) && $this->acl_is_writeable("LocationTeam")){
-                               $this->info['LocationTeamID'] = $_POST['LocationTeam'];
-                       }
-
-                       /* Get template user */
-                       if(isset($_POST['TemplateUser']) && $this->acl_is_writeable("TemplateUser") ){
-                               $this->info['template_user_id'] = $_POST['TemplateUser'];
-                       }
-
-      /* get lock status */
-      if($this->acl_is_writeable("Locked")){
-        if(isset($_POST['is_locked'])){
-          $this->info['is_locked'] = $_POST['is_locked'];
-        }else{
-          $this->info['is_locked'] = 0;
-        }
-      }
-               }
-
-               /* change account status */
-               if(isset($_POST['is_account'])){
-      if($this->acl_is_createable()){
-        $this->is_account = $_POST['is_account'];
-      }
-    }else{
-      if($this->acl_is_removeable()){
-        $this->is_account = false;//$_POST['is_account'];
-      }
-               }
-       }
-
-
-       /* Save to LDAP */
-       function save()
-       {
-               /* Save data */ 
-               $this->handle = new ogw($this->serverCon['LOGIN'],$this->serverCon['PASSWORD'],$this->serverCon['SERVER'],$this->serverCon['DB']);
-               $this->handle->SetInfos($this->info);
-               $this->handle->checkInfos();
-               if($this->initialy_was_account){
-                       $this->handle->Perform("EDIT");
-      new log("modify","users/".get_class($this),$this->dn);
-               }else{
-                       $this->handle->Perform("ADD");
-      new log("create","users/".get_class($this),$this->dn);
-               }
-       }
-
-  
-  function PrepareForCopyPaste($src){
-    // Nothing to do, because this object can't be copied ... yet
-  }
-
-
- /* Return plugin informations for acl handling 
-      #FIXME This is only an enable/disable checkbox for this account, there is possibly a better solution available later */  
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"     => _("Opengroupware"),
-          "plDescription"   => _("Open groupware account settings")."&nbsp;:&nbsp;<u>"._("Connectivity addon")."</u>",
-          "plSelfModify"    => TRUE,
-          "plDepends"       => array("user"),
-          "plPriority"      => 26,                                 // Position in tabs
-          "plSection"     => array("personal" => _("My account")),
-          "plCategory"    => array("users"),
-          "plOptions"       => array(),
-
-          "plProvidedAcls"  => array(
-            "LocationTeam"  => _("Location team"),
-            "TemplateUser"  => _("Template user"),
-            "Locked"        => _("Locked"),
-            "Teams"         => _("Teams"))
-          ));
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/personal/connectivity/class_oxchangeAccount.inc b/plugins/personal/connectivity/class_oxchangeAccount.inc
deleted file mode 100644 (file)
index ce4288f..0000000
+++ /dev/null
@@ -1,981 +0,0 @@
-<?php
-/*
-  This code is part of GOsa (https://gosa.gonicus.de)
-  Copyright (C) 2005 Alejandro Escanero Blanco
-
-  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 oxchangeAccount extends plugin
-{
-  /* Definitions */
-  var $plHeadline= "Open-Xchange";
-  var $plDescription= "This does something";
-
-  /* GW attributes */
-  var $OXAppointmentDays="500";
-  var $OXTaskDays="5";
-  var $OXTimeZone="GMT";
-  var $mailEnabled="OK";
-  var $dnModeValue = "";
-  var $view_logged = FALSE;
-
-  /* attribute list for save action */
-  var $attributes= array("OXAppointmentDays", "OXTaskDays", "OXTimeZone","mailEnabled");
-  var $objectclasses= array("OXUserObject");
-  var $ReadOnly =false;
-  var $oxconf = array();
-  var $timezones=array(
-      "Africa/Abidjan",
-      "Africa/Accra",
-      "Africa/Addis_Ababa",
-      "Africa/Algiers",
-      "Africa/Asmera",
-      "Africa/Bamako",
-      "Africa/Bangui",
-      "Africa/Banjul",
-      "Africa/Bissau",
-      "Africa/Blantyre",
-      "Africa/Brazzaville",
-      "Africa/Bujumbura",
-      "Africa/Cairo",
-      "Africa/Casablanca",
-      "Africa/Ceuta",
-      "Africa/Conakry",
-      "Africa/Dakar",
-      "Africa/Dar_es_Salaam",
-      "Africa/Djibouti",
-      "Africa/Douala",
-      "Africa/El_Aaiun",
-      "Africa/Freetown",
-      "Africa/Gaborone",
-      "Africa/Harare",
-      "Africa/Johannesburg",
-      "Africa/Kampala",
-      "Africa/Khartoum",
-      "Africa/Kigali",
-      "Africa/Kinshasa",
-      "Africa/Lagos",
-      "Africa/Libreville",
-      "Africa/Lome",
-      "Africa/Luanda",
-      "Africa/Lubumbashi",
-      "Africa/Lusaka",
-      "Africa/Malabo",
-      "Africa/Maputo",
-      "Africa/Maseru",
-      "Africa/Mbabane",
-      "Africa/Mogadishu",
-      "Africa/Monrovia",
-      "Africa/Nairobi",
-      "Africa/Ndjamena",
-      "Africa/Niamey",
-      "Africa/Nouakchott",
-      "Africa/Ouagadougou",
-      "Africa/Porto-Novo",
-      "Africa/Sao_Tome",
-      "Africa/Timbuktu",
-      "Africa/Tripoli",
-      "Africa/Tunis",
-      "Africa/Windhoek",
-      "America/Adak",
-      "America/Anchorage",
-      "America/Anguilla",
-      "America/Antigua",
-      "America/Araguaina",
-      "America/Aruba",
-      "America/Asuncion",
-      "America/Atka",
-      "America/Barbados",
-      "America/Belem",
-      "America/Belize",
-      "America/Boa_Vista",
-      "America/Bogota",
-      "America/Boise",
-      "America/Buenos_Aires",
-      "America/Cambridge_Bay",
-      "America/Cancun",
-      "America/Caracas",
-      "America/Catamarca",
-      "America/Cayenne",
-      "America/Cayman",
-      "America/Chicago",
-      "America/Chihuahua",
-      "America/Cordoba",
-      "America/Costa_Rica",
-      "America/Cuiaba",
-      "America/Curacao",
-      "America/Danmarkshavn",
-      "America/Dawson",
-      "America/Dawson_Creek",
-      "America/Denver",
-      "America/Detroit",
-      "America/Dominica",
-      "America/Edmonton",
-      "America/Eirunepe",
-      "America/El_Salvador",
-      "America/Ensenada",
-      "America/Fortaleza",
-      "America/Fort_Wayne",
-      "America/Glace_Bay",
-      "America/Godthab",
-      "America/Goose_Bay",
-      "America/Grand_Turk",
-      "America/Grenada",
-      "America/Guadeloupe",
-      "America/Guatemala",
-      "America/Guayaquil",
-      "America/Guyana",
-      "America/Halifax",
-      "America/Havana",
-      "America/Hermosillo",
-      "America/Indiana",
-      "America/Indiana/Indianapolis",
-      "America/Indiana/Knox",
-      "America/Indiana/Marengo",
-      "America/Indiana/Vevay",
-      "America/Indianapolis",
-      "America/Inuvik",
-      "America/Iqaluit",
-      "America/Jamaica",
-      "America/Jujuy",
-      "America/Juneau",
-      "America/Kentucky",
-      "America/Kentucky/Louisville",
-      "America/Kentucky/Monticello",
-      "America/Knox_IN",
-      "America/La_Paz",
-      "America/Lima",
-      "America/Los_Angeles",
-      "America/Louisville",
-      "America/Maceio",
-      "America/Managua",
-      "America/Manaus",
-      "America/Martinique",
-      "America/Mazatlan",
-      "America/Mendoza",
-      "America/Menominee",
-      "America/Merida",
-      "America/Mexico_City",
-      "America/Miquelon",
-      "America/Monterrey",
-      "America/Montevideo",
-      "America/Montreal",
-      "America/Montserrat",
-      "America/Nassau",
-      "America/New_York",
-      "America/Nipigon",
-      "America/Nome",
-      "America/Noronha",
-      "America/North_Dakota",
-      "America/North_Dakota/Center",
-      "America/Panama",
-      "America/Pangnirtung",
-      "America/Paramaribo",
-      "America/Phoenix",
-      "America/Port-au-Prince",
-      "America/Porto_Acre",
-      "America/Porto_Velho",
-      "America/Port_of_Spain",
-      "America/Puerto_Rico",
-      "America/Rainy_River",
-      "America/Rankin_Inlet",
-      "America/Recife",
-      "America/Regina",
-      "America/Rio_Branco",
-      "America/Rosario",
-      "America/Santiago",
-      "America/Santo_Domingo",
-      "America/Sao_Paulo",
-      "America/Scoresbysund",
-      "America/Shiprock",
-      "America/St_Johns",
-      "America/St_Kitts",
-      "America/St_Lucia",
-      "America/St_Thomas",
-      "America/St_Vincent",
-      "America/Swift_Current",
-      "America/Tegucigalpa",
-      "America/Thule",
-      "America/Thunder_Bay",
-      "America/Tijuana",
-      "America/Tortola",
-      "America/Vancouver",
-      "America/Virgin",
-      "America/Whitehorse",
-      "America/Winnipeg",
-      "America/Yakutat",
-      "America/Yellowknife",
-      "Antarctica/Casey",
-      "Antarctica/Davis",
-      "Antarctica/DumontDUrville",
-      "Antarctica/Mawson",
-      "Antarctica/McMurdo",
-      "Antarctica/Palmer",
-      "Antarctica/South_Pole",
-      "Antarctica/Syowa",
-      "Antarctica/Vostok",
-      "Arctic/Longyearbyen",
-      "Asia/Aden",
-      "Asia/Almaty",
-      "Asia/Amman",
-      "Asia/Anadyr",
-      "Asia/Aqtau",
-      "Asia/Aqtobe",
-      "Asia/Ashgabat",
-      "Asia/Ashkhabad",
-      "Asia/Baghdad",
-      "Asia/Bahrain",
-      "Asia/Baku",
-      "Asia/Bangkok",
-      "Asia/Beirut",
-      "Asia/Bishkek",
-      "Asia/Brunei",
-      "Asia/Calcutta",
-      "Asia/Choibalsan",
-      "Asia/Chongqing",
-      "Asia/Chungking",
-      "Asia/Colombo",
-      "Asia/Dacca",
-      "Asia/Damascus",
-      "Asia/Dhaka",
-      "Asia/Dili",
-      "Asia/Dubai",
-      "Asia/Dushanbe",
-      "Asia/Gaza",
-      "Asia/Harbin",
-      "Asia/Hong_Kong",
-      "Asia/Hovd",
-      "Asia/Irkutsk",
-      "Asia/Istanbul",
-      "Asia/Jakarta",
-      "Asia/Jayapura",
-      "Asia/Jerusalem",
-      "Asia/Kabul",
-      "Asia/Kamchatka",
-      "Asia/Karachi",
-      "Asia/Kashgar",
-      "Asia/Katmandu",
-      "Asia/Krasnoyarsk",
-      "Asia/Kuala_Lumpur",
-      "Asia/Kuching",
-      "Asia/Kuwait",
-      "Asia/Macao",
-      "Asia/Macau",
-      "Asia/Magadan",
-      "Asia/Manila",
-      "Asia/Muscat",
-      "Asia/Nicosia",
-      "Asia/Novosibirsk",
-      "Asia/Omsk",
-      "Asia/Oral",
-      "Asia/Phnom_Penh",
-      "Asia/Pontianak",
-      "Asia/Pyongyang",
-      "Asia/Qatar",
-      "Asia/Qyzylorda",
-      "Asia/Rangoon",
-      "Asia/Riyadh",
-      "Asia/Riyadh87",
-      "Asia/Riyadh88",
-      "Asia/Riyadh89",
-      "Asia/Saigon",
-      "Asia/Sakhalin",
-      "Asia/Samarkand",
-      "Asia/Seoul",
-      "Asia/Shanghai",
-      "Asia/Singapore",
-      "Asia/Taipei",
-      "Asia/Tashkent",
-      "Asia/Tbilisi",
-      "Asia/Tehran",
-      "Asia/Tel_Aviv",
-      "Asia/Thimbu",
-      "Asia/Thimphu",
-      "Asia/Tokyo",
-      "Asia/Ujung_Pandang",
-      "Asia/Ulaanbaatar",
-      "Asia/Ulan_Bator",
-      "Asia/Urumqi",
-      "Asia/Vientiane",
-      "Asia/Vladivostok",
-      "Asia/Yakutsk",
-      "Asia/Yekaterinburg",
-      "Asia/Yerevan",
-      "Atlantic/Azores",
-      "Atlantic/Bermuda",
-      "Atlantic/Canary",
-      "Atlantic/Cape_Verde",
-      "Atlantic/Faeroe",
-      "Atlantic/Jan_Mayen",
-      "Atlantic/Madeira",
-      "Atlantic/Reykjavik",
-      "Atlantic/South_Georgia",
-      "Atlantic/Stanley",
-      "Atlantic/St_Helena",
-      "Australia/ACT",
-      "Australia/Adelaide",
-      "Australia/Brisbane",
-      "Australia/Broken_Hill",
-      "Australia/Canberra",
-      "Australia/Darwin",
-      "Australia/Hobart",
-      "Australia/LHI",
-      "Australia/Lindeman",
-      "Australia/Lord_Howe",
-      "Australia/Melbourne",
-      "Australia/North",
-      "Australia/NSW",
-      "Australia/Perth",
-      "Australia/Queensland",
-      "Australia/South",
-      "Australia/Sydney",
-      "Australia/Tasmania",
-      "Australia/Victoria",
-      "Australia/West",
-      "Australia/Yancowinna",
-      "Brazil/Acre",
-      "Brazil/DeNoronha",
-      "Brazil/East",
-      "Brazil/West",
-      "Canada/Atlantic",
-      "Canada/Central",
-      "Canada/East-Saskatchewan",
-      "Canada/Eastern",
-      "Canada/Mountain",
-      "Canada/Newfoundland",
-      "Canada/Pacific",
-      "Canada/Saskatchewan",
-      "Canada/Yukon",
-      "CET",
-      "Chile/Continental",
-      "Chile/EasterIsland",
-      "CST6CDT",
-      "Cuba",
-      "EET",
-      "Egypt",
-      "Eire",
-      "EST",
-      "EST5EDT",
-      "Etc/GMT",
-      "Etc/GMT+0",
-      "Etc/GMT+1",
-      "Etc/GMT+10",
-      "Etc/GMT+11",
-      "Etc/GMT+12",
-      "Etc/GMT+2",
-      "Etc/GMT+3",
-      "Etc/GMT+4",
-      "Etc/GMT+5",
-      "Etc/GMT+6",
-      "Etc/GMT+7",
-      "Etc/GMT+8",
-      "Etc/GMT+9",
-      "Etc/GMT-0",
-      "Etc/GMT-1",
-      "Etc/GMT-10",
-      "Etc/GMT-11",
-      "Etc/GMT-12",
-      "Etc/GMT-13",
-      "Etc/GMT-14",
-      "Etc/GMT-2",
-      "Etc/GMT-3",
-      "Etc/GMT-4",
-      "Etc/GMT-5",
-      "Etc/GMT-6",
-      "Etc/GMT-7",
-      "Etc/GMT-8",
-      "Etc/GMT-9",
-      "Etc/GMT0",
-      "Etc/Greenwich",
-      "Etc/UCT",
-      "Etc/Universal",
-      "Etc/UTC",
-      "Etc/Zulu",
-      "Europe/Amsterdam",
-      "Europe/Andorra",
-      "Europe/Athens",
-      "Europe/Belfast",
-      "Europe/Belgrade",
-      "Europe/Berlin",
-      "Europe/Bratislava",
-      "Europe/Brussels",
-      "Europe/Bucharest",
-      "Europe/Budapest",
-      "Europe/Chisinau",
-      "Europe/Copenhagen",
-      "Europe/Dublin",
-      "Europe/Gibraltar",
-      "Europe/Helsinki",
-      "Europe/Istanbul",
-      "Europe/Kaliningrad",
-      "Europe/Kiev",
-      "Europe/Lisbon",
-      "Europe/Ljubljana",
-      "Europe/London",
-      "Europe/Luxembourg",
-      "Europe/Madrid",
-      "Europe/Malta",
-      "Europe/Minsk",
-      "Europe/Monaco",
-      "Europe/Moscow",
-      "Europe/Nicosia",
-      "Europe/Oslo",
-      "Europe/Paris",
-      "Europe/Prague",
-      "Europe/Riga",
-      "Europe/Rome",
-      "Europe/Samara",
-      "Europe/San_Marino",
-      "Europe/Sarajevo",
-      "Europe/Simferopol",
-      "Europe/Skopje",
-      "Europe/Sofia",
-      "Europe/Stockholm",
-      "Europe/Tallinn",
-      "Europe/Tirane",
-      "Europe/Tiraspol",
-      "Europe/Uzhgorod",
-      "Europe/Vaduz",
-      "Europe/Vatican",
-      "Europe/Vienna",
-      "Europe/Vilnius",
-      "Europe/Warsaw",
-      "Europe/Zagreb",
-      "Europe/Zaporozhye",
-      "Europe/Zurich",
-      "Factory",
-      "GB",
-      "GB-Eire",
-      "GMT",
-      "GMT+0",
-      "GMT-0",
-      "GMT0",
-      "Greenwich",
-      "Hongkong",
-      "HST",
-      "Iceland",
-      "Indian/Antananarivo",
-      "Indian/Chagos",
-      "Indian/Christmas",
-      "Indian/Cocos",
-      "Indian/Comoro",
-      "Indian/Kerguelen",
-      "Indian/Mahe",
-      "Indian/Maldives",
-      "Indian/Mauritius",
-      "Indian/Mayotte",
-      "Indian/Reunion",
-      "Iran",
-      "Israel",
-      "Jamaica",
-      "Japan",
-      "Kwajalein",
-      "Libya",
-      "MET",
-      "Mexico/BajaNorte",
-      "Mexico/BajaSur",
-      "Mexico/General",
-      "Mideast/Riyadh87",
-      "Mideast/Riyadh88",
-      "Mideast/Riyadh89",
-      "MST",
-      "MST7MDT",
-      "Navajo",
-      "NZ",
-      "NZ-CHAT",
-      "Pacific/Apia",
-      "Pacific/Auckland",
-      "Pacific/Chatham",
-      "Pacific/Easter",
-      "Pacific/Efate",
-      "Pacific/Enderbury",
-      "Pacific/Fakaofo",
-      "Pacific/Fiji",
-      "Pacific/Funafuti",
-      "Pacific/Galapagos",
-      "Pacific/Gambier",
-      "Pacific/Guadalcanal",
-      "Pacific/Guam",
-      "Pacific/Honolulu",
-      "Pacific/Johnston",
-      "Pacific/Kiritimati",
-      "Pacific/Kosrae",
-      "Pacific/Kwajalein",
-      "Pacific/Majuro",
-      "Pacific/Marquesas",
-      "Pacific/Midway",
-      "Pacific/Nauru",
-      "Pacific/Niue",
-      "Pacific/Norfolk",
-      "Pacific/Noumea",
-      "Pacific/Pago_Pago",
-      "Pacific/Palau",
-      "Pacific/Pitcairn",
-      "Pacific/Ponape",
-      "Pacific/Port_Moresby",
-      "Pacific/Rarotonga",
-      "Pacific/Saipan",
-      "Pacific/Samoa",
-      "Pacific/Tahiti",
-      "Pacific/Tarawa",
-      "Pacific/Tongatapu",
-      "Pacific/Truk",
-      "Pacific/Wake",
-      "Pacific/Wallis",
-      "Pacific/Yap",
-      "Poland",
-      "Portugal",
-      "PRC",
-      "PST8PDT",
-      "ROC",
-      "ROK",
-      "Singapore",
-      "SystemV/AST4",
-      "SystemV/AST4ADT",
-      "SystemV/CST6",
-      "SystemV/CST6CDT",
-      "SystemV/EST5",
-      "SystemV/EST5EDT",
-      "SystemV/HST10",
-      "SystemV/MST7",
-      "SystemV/MST7MDT",
-      "SystemV/PST8",
-      "SystemV/PST8PDT",
-      "SystemV/YST9",
-      "SystemV/YST9YDT",
-      "Turkey",
-      "UCT",
-      "Universal",
-      "US/Alaska",
-      "US/Aleutian",
-      "US/Arizona",
-      "US/Central",
-      "US/East-Indiana",
-      "US/Eastern",
-      "US/Hawaii",
-      "US/Indiana-Starke",
-      "US/Michigan",
-      "US/Mountain",
-      "US/Pacific",
-      "US/Samoa",
-      "UTC",
-      "W-SU",
-      "WET",
-      "Zulu"
-        );
-
-  var $dnmode= "";
-  var $uid ="";
-
-  function oxchangeAccount (&$config, $dn= NULL)
-  {
-    plugin::plugin ($config, $dn);
-    for ($i=0;$i<count($this->config->data['TABS']['CONNECTIVITY']);$i++){
-      if($this->config->data['TABS']['CONNECTIVITY'][$i]['CLASS']=='oxchangeAccount') {
-        $this->oxconf=$this->config->data['TABS']['CONNECTIVITY'][$i];
-        break;
-      }
-    }
-
-    /* Setting uid to default */
-    if(isset($this->attrs['uid'][0])){
-      $this->uid = $this->attrs['uid'][0];
-    }
-
-    $this->dnmode= $this->config->current['DNMODE'];
-    if(isset($this->attrs[$this->dnmode][0])){
-      $this->dnModeValue = $this->attrs[$this->dnmode][0];
-    }
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    //plugin::execute();
-
-    /* Log view */
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","users/".get_class($this),$this->dn);
-    }
-
-    $display="";
-
-    /* Show main page */
-    $smarty= get_smarty();
-
-    if (function_exists("pg_connect")){
-      $smarty->assign("pg", true);
-    }else{
-      $smarty->assign("pg", false);
-    }
-
-    /* Load attributes */
-    foreach($this->attributes as $val){
-      $smarty->assign("$val", $this->$val);
-    }
-    if ($this->is_account){
-      $smarty->assign("oxchangeState", "checked");
-      $smarty->assign("oxState", "");
-    } else {
-      $smarty->assign("oxchangeState", "");
-      $smarty->assign("oxState", "disabled");
-    }
-
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $key => $desc){
-      $smarty->assign($key."ACL",$this->getacl($key,$this->ReadOnly));
-      $smarty->assign($key."_W",$this->acl_is_writeable($key));
-    }
-
-    if((!$this->ReadOnly) && (($this->is_account && $this->acl_is_removeable()) || (!$this->is_account && $this->acl_is_createable())) ){
-      $smarty->assign('oxchangeAccountACL', "");
-    }else{
-      $smarty->assign('oxchangeAccountACL', " disabled ");
-    }
-
-    $smarty->assign("timezones", $this->timezones);
-
-
-    if ($this->parent !== NULL){
-      $smarty->assign("tabbed", 1);
-    }else{
-      $smarty->assign("tabbed", 0);
-       }
-
-       /* Trying to open a Postgresql Database Server */
-       if (function_exists("pg_connect")){
-               if(isset($this->oxconf["PGUSER"]) and isset($this->oxconf["PGHOST"]) and isset($this->oxconf["PGDBNAME"]) and isset($this->oxconf["PGPASSWD"])){
-                       $pgcon =  @pg_connect("host=".$this->oxconf["PGHOST"]." user=".$this->oxconf["PGUSER"]." password=".$this->oxconf["PGPASSWD"]." dbname=".$this->oxconf["PGDBNAME"]);
-                       if (! $pgcon){
-                               $smarty->assign("pg", false);
-                       }
-               }else{
-                       $smarty->assign("pg", false);
-               }
-       }else{
-               $smarty->assign("pg", false);
-       }
-
-    $display.= $smarty->fetch (get_template_path('oxchange.tpl', TRUE, dirname(__FILE__)));
-    return ($display);
-  }
-
-  function remove_from_parent()
-  {
-    if(!$this->acl_is_removeable())  return;
-    $this->attrs[$this->dnmode][0] = $this->dnModeValue;
-    $sqldeluser=array(
-        "delete from prg_notes where (user_right like '".$this->attrs[$this->dnmode][0]."') and (group_right like 's')",
-        "delete from prg_documents_read where (user_right like '".$this->attrs[$this->dnmode][0]."')",
-        "delete from prg_documents_mod where (user_right like '".$this->attrs[$this->dnmode][0]."')",
-        "delete from prg_docufolders_read where (user_right like '".$this->attrs[$this->dnmode][0]."')",
-        "delete from prg_docufolders_mod where (user_right like '".$this->attrs[$this->dnmode][0]."')",
-        "delete from prg_date_rights where (user_right like '".$this->attrs[$this->dnmode][0]."')",
-        "delete from prg_date_notification where (member_uid like '".$this->attrs[$this->dnmode][0]."')",
-        "delete from prg_dates_members where (member_uid like '".$this->attrs[$this->dnmode][0]."')",
-        "delete from prg_knowledge_read where (user_right like '".$this->attrs[$this->dnmode][0]."')",
-        "delete from prg_knowledge_mod where (user_right like '".$this->attrs[$this->dnmode][0]."')",
-        "delete from prg_knowledge_folder_read where (user_right like '".$this->attrs[$this->dnmode][0]."')",
-        "delete from prg_knowledge_folder_mod where (user_right like '".$this->attrs[$this->dnmode][0]."')",
-        "delete from prg_pin_board_read where (user_right like '".$this->attrs[$this->dnmode][0]."')",
-        "delete from prg_pin_board_mod where (user_right like '".$this->attrs[$this->dnmode][0]."')",
-        "delete from prg_bookmarks_read where (user_right like '".$this->attrs[$this->dnmode][0]."')",
-        "delete from prg_bookmarks_mod where (user_right like '".$this->attrs[$this->dnmode][0]."')",
-        "delete from prg_bookmarks_folder_read where (user_right like '".$this->attrs[$this->dnmode][0]."')",
-        "delete from prg_bookmarks_folder_mod where (user_right like '".$this->attrs[$this->dnmode][0]."')",
-        "delete from prg_tasks_rights where (user_right like '".$this->attrs[$this->dnmode][0]."')",
-        "delete from prg_tasks_notification where (member_uid like '".$this->attrs[$this->dnmode][0]."')",
-        "delete from prg_tasks_members where (member_uid like '".$this->attrs[$this->dnmode][0]."')",
-        "delete from prg_projects_rights where (user_right like '".$this->attrs[$this->dnmode][0]."')",
-        "delete from prg_projects_notification where (member_uid like '".$this->attrs[$this->dnmode][0]."')",
-        "delete        from prg_projects_members where (member_uid like '".$this->attrs[$this->dnmode][0]."')",
-        "delete from oxfolder_permissions where (entity like '".$this->attrs[$this->dnmode][0]."') AND ((role = 256) OR (role = 1024))",
-        "delete from oxfolder_standardfolders where owner like '".$this->attrs[$this->dnmode][0]."'",
-        "delete from prg_forum_read where user_right = '".$this->attrs[$this->dnmode][0]."'",
-        "delete from prg_forum_mod where user_right = '".$this->attrs[$this->dnmode][0]."'",
-        "delete from prg_forum_abo where user_right = '".$this->attrs[$this->dnmode][0]."'",
-        "delete from prg_forum_seen where username = '".$this->attrs[$this->dnmode][0]."'",
-        "delete from sys_holiday where (userid like '".$this->attrs[$this->dnmode][0]."')",
-        "delete from usr_holiday where (userid like '".$this->attrs[$this->dnmode][0]."')");
-
-    /* Trying to open a Postgresql Database Server */
-    if (function_exists("pg_connect")){
-      if(isset($this->oxconf["PGUSER"]) and 
-                isset($this->oxconf["PGHOST"]) and 
-            isset($this->oxconf["PGDBNAME"]) and 
-         isset($this->oxconf["PGPASSWD"])){
-        $pgcon = @pg_connect("host=".$this->oxconf["PGHOST"]." user=".$this->oxconf["PGUSER"]." password=".$this->oxconf["PGPASSWD"]." dbname=".$this->oxconf["PGDBNAME"]);
-        if (! $pgcon){
-          print_red(_("Connectivity")."&nbsp;"._("Openexchange")."&nbsp;:"._("Couldn't connect to postgresql database!"));
-          return;
-        }
-      }else{
-        print_red(_("Connectivity")."&nbsp;"._("Openexchange")."&nbsp;:"._("Needed parameters for openexchange connectivity plugin are missing!"));
-        return;
-      }
-    }else{
-      print_red(_("Connectivity")."&nbsp;"._("Openexchange")."&nbsp;:"._("PHP4 module for postgresql database is missing!"));
-      return;
-    }
-
-    plugin::remove_from_parent();
-    $ldap= $this->config->get_ldap_link();
-
-    if($ldap->dn_exists("ou=addr,".$this->dn)){
-       $ldap->rmdir_recursive("ou=addr,".$this->dn);
-                       show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/oxchange addressbook account with dn '%s' failed."),$this->dn));
-    }
-
-    $ldap->cd($this->dn);
-    @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
-        $this->attributes, "Save");
-    $this->cleanup();
-    $ldap->modify ($this->attrs); 
-
-    new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-
-               show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/oxchange addressbook account with dn '%s' failed."),$this->dn));
-
-    /* Optionally execute a command after we're done */
-    $this->postremove(array("uid" => $this->uid));
-
-    /* Finally remove data from postgresql server */
-    foreach ($sqldeluser as $sqls){
-       @pg_exec($pgcon,$sqls);
-    }
-    pg_close();
-  }
-
-  /* Save data to object */
-  function save_object()
-  {
-    /* Do we need to flip is_account state? */
-    if (isset($_POST['connectivityTab'])){
-      if (isset($_POST['oxchange'])){
-        if (!$this->is_account && $_POST['oxchange'] == "B") {
-          if($this->acl_is_createable()){
-            $this->is_account= TRUE;
-          }
-        }
-      } else {
-        if($this->acl_is_removeable()){
-          $this->is_account= FALSE;
-        }
-      }
-    }
-
-    /* Get objects */
-    foreach(array("OXTimeZone","OXTaskDays","OXAppointmentDays") as $name) {
-      if($this->acl_is_writeable($name) && isset($_POST[$name])){
-        $this->$name = $_POST[$name];
-      } 
-    }
-  
-//    plugin::save_object();
-    if (isset($_POST["oxchangeStatus"])){
-      $this->oxchangeStatus = "disabled";
-    } else {
-      $this->oxchangeStatus = "enabled";
-    }
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-
-    $needupdate=TRUE;
-    $istemplate=FALSE;
-
-
-/*      print "<pre>".print_r($this->attrs, true)."</pre>";*/
-
-
-    /*First at all, we must check if this is new or is updated */
-    /*Also check is we have a template, if is a template, is a new user */
-    if (isset($this->attrs['objectClass'])){
-      foreach ($this->attrs['objectClass'] as $object){
-        if($object=="OXUserObject") $needupdate=FALSE;
-       if($object=="gosaUserTemplate") $istemplate=TRUE;
-      }
-    }
-
-    $uidarray=array();
-    preg_match("/^(\w+(?=\=))=((\w|\s|\.)+(?=\,)),.*/",$this->dn,$uidarray);
-    $uid=$uidarray[2];
-    if (trim($uid) == "") {
-      print_red(_("The Open-Xchange accountname is empty and thus invalid! Check to make sure that you are not using any strange characters in the loginname."));
-      return;
-    }
-       
-    if ($istemplate) $needupdate=TRUE;
-
-    if($needupdate){
-      /* Trying to open a Postgresql Database Server */
-      if (function_exists("pg_connect")){
-        if(isset($this->oxconf["PGUSER"]) and isset($this->oxconf["PGHOST"]) and isset($this->oxconf["PGDBNAME"]) and isset($this->oxconf["PGPASSWD"])){
-          $pgcon =  @pg_connect("host=".$this->oxconf["PGHOST"]." user=".$this->oxconf["PGUSER"]." password=".$this->oxconf["PGPASSWD"]." dbname=".$this->oxconf["PGDBNAME"]);
-          if (! $pgcon){
-            print_red(_("Couldn't connect to postgresql database!"));
-            return;
-          }
-        }else{
-          print_red(_("Needed parameters for openexchange connectivity plugin are missing!"));
-          return;
-        }
-      }else{
-        print_red(_("PHP4 module for postgresql database is missing!"));
-        return;
-      }
-    }
-
-    plugin::save();
-
-    /* Write back to ldap */
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd($this->dn);
-    $this->cleanup();
-    $ldap->modify ($this->attrs); 
-
-    if($this->initially_was_account){
-      new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }else{
-      new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }
-
-               show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/oxchange account with dn '%s' failed."),$this->dn));
-
-    /* Optionally execute a command after we're done */
-    $this->postcreate(array("uid" => $this->uid));
-
-    if($needupdate){
-      $ldap->create_missing_trees("ou=addr,".$this->dn);
-                       show_ldap_error($ldap->get_error(), sprintf(_("Creating of user/oxchange account with dn '%s' failed."),$this->dn));
-      /* Finally save data to postgresql server */
-      pg_set_client_encoding ("UNICODE");
-      $nv = "SELECT nextval ('serial_id')";
-      $ot = "insert into oxfolder_tree (fuid, parent, fname, module, type, owner, creator, creating_date, created_from, changing_date, changed_from) VALUES (%d, 1, '%s', '%s', 'private', '%s', '%s', 'now', 'System', 'now', 'System')";
-      $op = "INSERT INTO oxfolder_permissions (puid, pid, role, entity, sealed, fp, orp, owp, odp) VALUES (%d, %d, 32768,  '%s', 0, 128, 128, 128, 128)";
-      $os = "insert into oxfolder_standardfolders (owner,module_calendar,module_contact,module_task) VALUES ('%s',%d,%d,%d)";
-      $ugr= "INSERT INTO usr_general_rights SELECT creating_date, created_from, changing_date, changed_from,text('%s'),  addr_u, addr_r, addr_d, cont_u, cont_r, cont_d, data_u, data_r, data_d, serie_u, serie_r, serie_d, task_u, task_r, task_d,  refer, proj_u, proj_r, proj_d, dfolder_u, dfolder_r, dfolder_d, doc_u, doc_r, doc_d, knowl_u, knowl_r, knowl_d, bfolder_u,  bfolder_r, bfolder_d, bookm_u, bookm_r, bookm_d, pin_u, pin_r, pin_d, forum_n, fentrie_n, setup, pin_public, internal,  int_groups, kfolder_u, kfolder_r, kfolder_d, webmail FROM sys_gen_rights_template WHERE login LIKE 'default_template'";
-
-      $error = FALSE;
-      $res=@pg_exec($pgcon,$nv); 
-
-      if(!$res){
-        $error = TRUE;
-      }else{
-        $calendarid=pg_fetch_row($res); 
-        pg_freeresult($res);
-
-        $q=sprintf($ot,$calendarid[0],'My Appointments','calendar',$uid,$uid);
-        @pg_exec($pgcon,$q);
-      }
-
-      $res=@pg_exec($pgcon,$nv); 
-
-      if(!$res){
-        $error = TRUE;
-      }else{
-        $nid=pg_fetch_row($res); 
-        pg_freeresult($res);
-
-        $q=sprintf($op,$nid[0],$calendarid[0],$uid);
-        @pg_exec($pgcon,$q);
-      }
-
-      $res=@pg_exec($pgcon,$nv); 
-      if(!$res){
-        $error = TRUE;
-      }else{
-        $contactsid=pg_fetch_row($res); 
-        pg_freeresult($res);
-
-        $q=sprintf($ot,$contactsid[0],'My Contacts','contact',$uid,$uid);
-        @pg_exec($pgcon,$q);
-      }
-
-      $res=@pg_exec($pgcon,$nv); 
-      if(!$res){
-        $error = TRUE;
-      }else{
-        $nid=pg_fetch_row($res); 
-        pg_freeresult($res);
-
-        $q=sprintf($op,$nid[0],$contactsid[0],$uid);
-        @pg_exec($pgcon,$q);
-      }
-
-      $res=@pg_exec($pgcon,$nv); 
-      if(!$res){
-        $error = TRUE;
-      }else{
-        $tasksid=pg_fetch_row($res); 
-        pg_freeresult($res);
-
-        $q=sprintf($ot,$tasksid[0],'My Tasks','task',$uid,$uid);
-        @pg_exec($pgcon,$q);
-      }
-
-      $res=@pg_exec($pgcon,$nv); 
-      if(!$res){
-        $error = TRUE;
-      }else{
-        $nid=pg_fetch_row($res); 
-        pg_freeresult($res);
-
-        $q=sprintf($op,$nid[0],$tasksid[0],$uid);
-        @pg_exec($pgcon,$q);
-      
-        $q=sprintf($os,$uid,$calendarid[0],$contactsid[0],$tasksid[0]);
-        @pg_exec($pgcon,$q);
-      
-        $q=sprintf($ugr,$uid);
-        @pg_exec($pgcon,$q);
-      }
-    
-      @pg_close($pgcon);
-
-      if($error){
-        print_red(_("Something went wrong while saving oxchange account. Please check the error log file."));
-      }
-    }
-  }
-
-
-  /* Return plugin informations for acl handling */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"     => _("Open xchange"),
-          "plDescription"   => _("Open xchange account settings")."&nbsp;:&nbsp;<u>"._("Connectivity addon")."</u>",
-          "plSelfModify"    => TRUE,
-          "plDepends"       => array("user"),
-          "plPriority"      => 27,                                 // Position in tabs
-          "plSection"     => array("personal" => _("My account")),
-          "plCategory"    => array("users"),
-          "plOptions"       => array(),
-
-          "plProvidedAcls"  => array(
-            "OXAppointmentDays" => _("OXAppointmentDays"),
-            "OXTaskDays"           => _("OXTaskDays"),
-            "OXTimeZone"           => _("OXTimeZone"))
-          ));
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/personal/connectivity/class_phpgwAccount.inc b/plugins/personal/connectivity/class_phpgwAccount.inc
deleted file mode 100644 (file)
index 7c5cf6e..0000000
+++ /dev/null
@@ -1,172 +0,0 @@
-<?php
-class phpgwAccount extends plugin
-{
-  /* Definitions */
-  var $plHeadline= "PHPGroupware";
-  var $plDescription= "This does something";
-
-  /* GW attributes */
-  var $phpgwAccountExpires= "-1";
-  var $phpgwAccountStatus= "A";
-  var $phpgwAccountType= "u";
-
-  /* attribute list for save action */
-  var $attributes= array("phpgwAccountExpires", "phpgwAccountStatus", "phpgwAccountType");
-  var $objectclasses= array("phpgwAccount");
-  var $ReadOnly = false;
-
-  var $uid  = "";
-  var $view_logged = FALSE;
-
-  function phpgwAccount (&$config, $dn= NULL)
-  {
-    plugin::plugin ($config, $dn);
-
-    /* Setting uid to default */
-    if(isset($this->attrs['uid'][0])){
-      $this->uid = $this->attrs['uid'][0];
-    }
-  }
-
-  function execute()
-  {
-       /* Call parent execute */
-//     plugin::execute();
-    /* Log view */
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","users/".get_class($this),$this->dn);
-    }
-    /* Show tab dialog headers */
-    $display= "";
-
-    /* Show main page */
-    $smarty= get_smarty();
-
-    /* Load attributes */
-    foreach($this->attributes as $val){
-      $smarty->assign("$val", $this->$val);
-    }
-    if ($this->is_account){
-      $smarty->assign("phpgwState", "checked");
-    } else {
-      $smarty->assign("phpgwState", "");
-    }
-
-    if((!$this->ReadOnly)&&(($this->is_account && $this->acl_is_removeable()) || (!$this->is_account && $this->acl_is_createable()))) {
-      $smarty->assign('phpgwAccountACL', "");
-    }else{
-      $smarty->assign('phpgwAccountACL', " disabled ");
-    }
-
-    $display.= $smarty->fetch (get_template_path('phpgw.tpl', TRUE, dirname(__FILE__)));
-    return ($display);
-  }
-
-  function remove_from_parent()
-  {
-    if($this->acl_is_removeable()){
-      /* Cancel if there's nothing to do here */
-      if (!$this->initially_was_account){
-        return;
-      }
-
-      plugin::remove_from_parent();
-      $ldap= $this->config->get_ldap_link();
-
-      $ldap->cd($this->dn);
-      @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
-          $this->attributes, "Save");
-      $this->cleanup();
-      $ldap->modify ($this->attrs); 
-
-      show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/PHPgw account with dn '%s' failed."),$this->dn));
-
-      new log("remove","users/".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',array("uid" => $this->uid));
-    }
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    /* Do we need to flip is_account state? */
-    if (isset($_POST['connectivityTab'])){
-      if (isset($_POST['phpgw'])){
-        if (!$this->is_account && $_POST['phpgw'] == "B"){
-          if($this->acl_is_createable()){
-            $this->is_account= TRUE;
-          }
-        }
-      } else {
-        if($this->acl_is_removeable()){
-          $this->is_account= FALSE;
-        }
-      }
-    }
-
-    plugin::save_object();
-    if (isset($_POST["phpgwStatus"])){
-      $this->phpgwStatus = "disabled";
-    } else {
-      $this->phpgwStatus = "enabled";
-    }
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    plugin::save();
-
-    /* Write back to ldap */
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd($this->dn);
-    $this->cleanup();
-    $ldap->modify ($this->attrs); 
-
-    if($this->initially_was_account){
-      new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }else{
-      new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }
-
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/PHPgw account 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",array("uid" => $this->uid));
-      }
-    } else {
-      $this->handle_post_events("add",array("uid" => $this->uid));
-    }
-
-  }
-
-
-  /* Return plugin informations for acl handling */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"     => _("PHP GW"),
-          "plDescription"   => _("PHP GW account settings")."&nbsp;:&nbsp;<u>"._("Connectivity addon")."</u>",
-          "plSelfModify"    => TRUE,
-          "plDepends"       => array("user"),
-          "plPriority"      => 24,                                 // Position in tabs
-          "plSection"     => array("personal" => _("My account")),
-          "plCategory"    => array("users"),
-          "plOptions"       => array(),
-
-          "plProvidedAcls"  => array()
-          ));
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/personal/connectivity/class_phpscheduleitAccount.inc b/plugins/personal/connectivity/class_phpscheduleitAccount.inc
deleted file mode 100644 (file)
index 41454ea..0000000
+++ /dev/null
@@ -1,175 +0,0 @@
-<?php
-
-/*
-  This code is part of GOsa (https://gosa.gonicus.de)
-  Copyright (C) 2005 Guillaume Delecourt
-  Copuright (C) 2005 Benoit Mortier
-
-  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 phpscheduleitAccount extends plugin
-{
-  /* Definitions */
-  var $plHeadline= "PHPscheduleit";
-  var $plDescription= "This does something";
-
-  /* attribute list for save action */
-  var $attributes= array();
-  var $objectclasses= array("phpscheduleitAccount");
-  var $ReadOnly =false;
-  var $view_logged = FALSE;
-
-  function phpscheduleitAccount (&$config, $dn= NULL)
-  {
-    plugin::plugin ($config, $dn);
-  }
-
-  function execute()
-  {
-    /* Log view */
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","users/".get_class($this),$this->dn);
-    }
-
-    /* Show tab dialog headers */
-    $display= "";
-
-    /* Show main page */
-    $smarty= get_smarty();
-
-    if ($this->is_account){
-      $smarty->assign("phpscheduleitState", "checked");
-    } else {
-      $smarty->assign("phpscheduleitState", "");
-      $smarty->assign("wstate", "disabled");
-    }
-
-    if((!$this->ReadOnly) && (($this->is_account && $this->acl_is_removeable()) || (!$this->is_account && $this->acl_is_createable()))) {
-      $smarty->assign('gosaphpscheduleitACL', "");
-    }else{
-      $smarty->assign('gosaphpscheduleitACL', " disabled ");
-    }
-
-    $display.= $smarty->fetch (get_template_path('phpscheduleit.tpl', TRUE, dirname(__FILE__)));
-    return ($display);
-  }
-
-  function remove_from_parent()
-  {
-    /* Cancel if there's nothing to do here */
-    if ($this->acl_is_removeable()){
-
-      plugin::remove_from_parent();
-      $ldap= $this->config->get_ldap_link();
-
-      $ldap->cd($this->dn);
-      @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
-          $this->attributes, "Save");
-      $this->cleanup();
-      $ldap->modify ($this->attrs); 
-      show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/PHPscheduleit account with dn '%s' failed."),$this->dn));
-
-      if($this->is_account){
-        new log("remove","users/".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',array("uid" => $this->uid));
-    }
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    /* Do we need to flip is_account state? */
-    if (isset($_POST['connectivityTab'])){
-      if (isset($_POST['phpscheduleit'])){
-        if (!$this->is_account && $_POST['phpscheduleit'] == "B"){
-          if($this->acl_is_createable()) {
-            $this->is_account= TRUE;
-          }
-        }
-      } else {
-        if($this->acl_is_removeable()){
-          $this->is_account= FALSE;
-        }
-      }
-    }
-
-    plugin::save_object();
-    if (isset($_POST["phpscheduleitStatus"])){
-      $this->pptpStatus = "disabled";
-    } else {
-      $this->pptpStatus = "enabled";
-    }
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    plugin::save();
-
-    /* Write back to ldap */
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd($this->dn);
-    $this->cleanup();
-    $ldap->modify ($this->attrs); 
-
-    if($this->initially_was_account){
-      new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }else{
-      new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }
-
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/PHPscheduleit account 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",array("uid" => $this->uid));
-      }
-    } else {
-      $this->handle_post_events("add",array("uid" => $this->uid));
-    }
-
-  }
-
-
-  /* Return plugin informations for acl handling 
-      #FIXME This is only an enable/disable checkbox for this account, there is possibly a better solution available later */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"     => _("PHP Schedule it"),
-          "plDescription"   => _("PHP Schedule it settings")."&nbsp;:&nbsp;<u>"._("Connectivity addon")."</u>",
-          "plSelfModify"    => TRUE,
-          "plDepends"       => array("user"),
-          "plPriority"      => 29,                                 // Position in tabs
-          "plSection"     => array("personal" => _("My account")),
-          "plCategory"    => array("users"),
-
-          "plOptions"       => array(),
-
-          "plProvidedAcls"  => array()
-          ));
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/personal/connectivity/class_pptpAccount.inc b/plugins/personal/connectivity/class_pptpAccount.inc
deleted file mode 100644 (file)
index 0c8c659..0000000
+++ /dev/null
@@ -1,188 +0,0 @@
-<?php
-
-/*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2005 Guillaume Delecourt
-   Copyright (C) 2005 Benoit Mortier
-
-   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 pptpAccount extends plugin
-{
-  /* Definitions */
-  var $plHeadline= "PPTP";
-  var $plDescription= "This does something";
-
-  /* attribute list for save action */
-  var $attributes= array();
-  var $objectclasses= array("pptpServerAccount");
-
-  var $ReadOnly = false;
-  var $view_logged = FALSE;
-  var $uid ="";
-
-  function pptpAccount (&$config, $dn= NULL)
-  {
-    plugin::plugin ($config, $dn);
-    
-    /* Setting uid to default */
-    if(isset($this->attrs['uid'][0])){
-      $this->uid = $this->attrs['uid'][0];
-    }
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    // plugin::execute();
-
-    /* Log view */
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","users/".get_class($this),$this->dn);
-    }
-
-    /* Show tab dialog headers */
-    $display= "";
-
-    /* Show main page */
-    $smarty= get_smarty();
-
-    if ($this->is_account){
-      $smarty->assign("pptpState", "checked");
-    } else {
-      $smarty->assign("pptpState", "");
-      $smarty->assign("wstate", "disabled");
-    }
-
-    if((!$this->ReadOnly) && (($this->is_account && $this->acl_is_removeable()) || (!$this->is_account && $this->acl_is_createable()))) {
-      $smarty->assign('gosapptpACL', "");
-    }else{
-      $smarty->assign('gosapptpACL', " disabled ");
-    }
-
-    $display.= $smarty->fetch (get_template_path('pptp.tpl', TRUE, dirname(__FILE__)));
-    return ($display);
-  }
-
-  function remove_from_parent()
-  {
-    if($this->acl_is_removeable()){
-      /* Cancel if there's nothing to do here */
-      if (!$this->initially_was_account){
-        return;
-      }
-
-      plugin::remove_from_parent();
-      $ldap= $this->config->get_ldap_link();
-
-      $ldap->cd($this->dn);
-      @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
-          $this->attributes, "Save");
-      $this->cleanup();
-      $ldap->modify ($this->attrs); 
-
-      /* Log last action */
-      new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-
-      show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/PPTP account with dn '%s' failed."),$this->dn));
-
-      /* Optionally execute a command after we're done */
-      $this->handle_post_events('remove',array("uid" => $this->uid));
-    }
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    /* Do we need to flip is_account state? */
-    if (isset($_POST['connectivityTab'])){
-      if (isset($_POST['pptp'])){
-        if (!$this->is_account && $_POST['pptp'] == "B"){
-          if($this->acl_is_createable()){
-            $this->is_account= TRUE;
-          }
-        }
-      } else {
-        if($this->acl_is_removeable()){
-          $this->is_account= FALSE;
-        }
-      }
-    }
-
-    plugin::save_object();
-    if (isset($_POST["pptpStatus"])){
-      $this->pptpStatus = "disabled";
-    } else {
-      $this->pptpStatus = "enabled";
-    }
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    if($this->acl_is_createable()){
-      plugin::save();
-
-      /* Write back to ldap */
-      $ldap= $this->config->get_ldap_link();
-      $ldap->cd($this->dn);
-      $this->cleanup();
-      $ldap->modify ($this->attrs); 
-
-      /* Log last action */
-      if($this->initially_was_account){
-        new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-      }else{
-        new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-      }
-
-      show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/PPTP account 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",array("uid" => $this->uid));
-        }
-      } else {
-        $this->handle_post_events("add",array("uid" => $this->uid));
-      }
-    }
-  }
-
-
-  /* Return plugin informations for acl handling */ 
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"     => _("PPTP"),
-          "plDescription"   => _("PPTP account")."&nbsp;:&nbsp;<u>"._("Connectivity addon")."</u>",
-          "plSelfModify"    => TRUE,
-          "plDepends"       => array("user"),
-          "plPriority"      => 28,                                 // Position in tabs
-          "plSection"     => array("personal" => _("My account")),
-          "plCategory"    => array("users"),
-          "plOptions"       => array(),
-
-          "plProvidedAcls"  => array()
-          ));
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/personal/connectivity/class_proxyAccount.inc b/plugins/personal/connectivity/class_proxyAccount.inc
deleted file mode 100644 (file)
index 455bb53..0000000
+++ /dev/null
@@ -1,325 +0,0 @@
-<?php
-class proxyAccount extends plugin
-{
-  /* Definitions */
-  var $plHeadline= "Proxy";
-  var $plDescription= "This does something";
-
-  /* Proxy attributes */
-  var $gosaProxyAcctFlags= "[N    ]";
-  var $gosaProxyID= "";
-  var $gosaProxyWorkingStart= 420;
-  var $gosaProxyWorkingStop= 1020;
-  var $gosaProxyQuota= "5g";
-  var $gosaProxyQuotaPeriod= "m";
-
-  /* attribute list for save action */
-  var $attributes= array(   "gosaProxyID", "gosaProxyAcctFlags", "gosaProxyWorkingStart",
-                            "gosaProxyWorkingStop", "gosaProxyQuota", "gosaProxyQuotaPeriod");
-
-  var $objectclasses= array("gosaProxyAccount");
-  var $ReadOnly = false;
-
-  var $uid = "";
-  var $view_logged = FALSE;
-
-  function proxyAccount (&$config, $dn= NULL)
-  {
-    plugin::plugin ($config, $dn);
-    
-    /* Setting uid to default */
-    if(isset($this->attrs['uid'][0])){
-      $this->uid = $this->attrs['uid'][0];
-    }
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* Log view */
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","users/".get_class($this),$this->dn);
-    }
-
-    $display= "";
-
-    /* Prepare templating */
-    $smarty= get_smarty();
-
-    $smarty->assign('proxyAccountACL', " disabled ");
-    
-    if((!$this->ReadOnly)&& (($this->is_account && $this->acl_is_removeable()) || (!$this->is_account && $this->acl_is_createable()))){
-      $smarty->assign('proxyAccountACL', "");
-    }
-
-    /* Assign radio boxes */
-    foreach (array("F", "T", "B", "N") as $val){
-
-      if (is_integer(strpos($this->gosaProxyAcctFlags, "$val"))) {
-        $smarty->assign("filter$val", "checked");
-
-        /* Add state variables for on-the-fly state-changing of checkboxes */
-        $smarty->assign($val."state", "");
-        
-      } else {
-        $smarty->assign("filter$val", "");
-
-        /* Same as above */
-        if($_SESSION['js']==1){
-          $smarty->assign($val."state", "disabled");
-        }else{
-          $smarty->assign($val."state", "");
-        }
-      }
-    }
-
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $acl => $desc){
-      $smarty->assign($acl."ACL",$this->getacl($acl,$this->ReadOnly));
-      $smarty->assign($acl."_W",$this->acl_is_writeable($acl,$this->ReadOnly));
-    }
-
-    /* Assign working time */
-    $smarty->assign("starthour", (int)($this->gosaProxyWorkingStart / 60));
-    $smarty->assign("startminute", (int)($this->gosaProxyWorkingStart % 60));
-    $smarty->assign("stophour", (int)($this->gosaProxyWorkingStop / 60));
-    $smarty->assign("stopminute", (int)($this->gosaProxyWorkingStop % 60));
-    $hours= array();
-    for($i=0; $i<24; $i++){
-      $hours[]= sprintf("%02d",$i);
-    }
-    $smarty->assign("hours", $hours);
-    $smarty->assign("minutes", array("00","15","30","45"));
-
-    /* Assign quota values */
-    $smarty->assign("quota_unit", array("k" => _("KB"), "m" => _("MB"), "g" => _("GB")));
-    $smarty->assign("quota_time", array("h" => _("hour"), "d" => _("day"), "w" => _("week"), "m" => _("month")));
-    $smarty->assign("gosaProxyQuotaPeriod", $this->gosaProxyQuotaPeriod);
-    $smarty->assign("quota_size", preg_replace("/[a-z]$/i", "", $this->gosaProxyQuota));
-    $smarty->assign("quota_u", preg_replace("/^[0-9]+/", "", $this->gosaProxyQuota));
-    if ($this->is_account){
-      $smarty->assign("proxyState", "checked");
-    } else {
-      $smarty->assign("proxyState", "");
-    }
-
-    /* Prepare correct state */
-    if (!$this->is_account){
-      $smarty->assign("pstate", "disabled");
-    } else {
-      $smarty->assign("pstate", "");
-    }
-
-    $changeA = "";
-  
-    $ProxyWorkingStateChange ="\n";
-    if($this->acl_is_writeable("gosaProxyFlagT")){
-      $changeA .= "changeState('filterT');\n";
-
-      $ProxyWorkingStateChange.=  "changeState('startHour'); \n";
-      $ProxyWorkingStateChange.=  "changeState('startMinute'); \n";
-      $ProxyWorkingStateChange.=  "changeState('stopHour'); \n";
-      $ProxyWorkingStateChange.=  "changeState('stopMinute'); \n";
-    }
-
-    if(preg_match("/F/",$this->gosaProxyAcctFlags)){
-      $changeA .= $ProxyWorkingStateChange;
-    }
-  
-    $smarty->assign("ProxyWorkingStateChange",$ProxyWorkingStateChange);
-
-    $changeB = "";
-    if($this->acl_is_writeable("gosaProxyFlagB")){
-      $changeA .= "changeState('filterB');";
-      $changeB = 
-        "changeSubselectState('filterB', 'quota_size');
-         changeSubselectState('filterB', 'quota_unit');
-         changeSubselectState('filterB', 'gosaProxyQuotaPeriod');";
-    }
-
-    $smarty->assign("changeB",$changeB);
-    $smarty->assign("changeA",$changeA);
-
-    /* Show main page */
-    $display.= $smarty->fetch(get_template_path('proxy.tpl', TRUE, dirname(__FILE__)));
-    return($display);
-  }
-
-  function remove_from_parent()
-  {
-    if($this->acl_is_removeable() && $this->initially_was_account){   
-
-      plugin::remove_from_parent();
-
-      $ldap= $this->config->get_ldap_link();
-      @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
-          $this->attributes, "Save");
-      $ldap->cd($this->dn);
-      $this->cleanup();
-      $ldap->modify ($this->attrs); 
-
-      /* Log last action */
-      new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-
-      show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/proxy account with dn '%s' failed."),$this->dn));
-
-      /* Optionally execute a command after we're done */
-      $this->handle_post_events("remove",array("uid" => $this->uid));
-    }
-  }
-
-  /* Check values */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-    
-    /* We've got only one value to check for positive integer or emtpy field */
-    if ($this->is_account){
-      if($this->acl_is_writeable("gosaProxyQuota")){
-        if (isset($_POST["quota_size"])){
-          if ($_POST["quota_size"] == "gosaProxyQuota"){
-            $message[]= _("Numerical value for Quota Setting is empty.");
-          }elseif ($_POST["quota_size"] <= 0){
-            $message[]= _("Numerical value for Quota Setting is not valid.");
-          }
-        }
-      }
-    }
-
-    return $message;
-  }
-
-  /* Save data to object */
-  function save_object()
-  {
-    /* Do we need to flip is_account state? */
-    if (isset($_POST['connectivityTab'])){
-      if (isset($_POST['proxy'])){
-        if (!$this->is_account && $_POST['proxy'] == "B"){
-          if($this->acl_is_createable()){
-            $this->is_account= TRUE;
-          }
-        }
-      } else {
-        if($this->acl_is_removeable()){
-          $this->is_account= FALSE;
-        }
-      }
-    }
-
-    /* Save flag value */
-    if ($this->is_account){
-
-      $flags= "";
-      $acl= "";
-      foreach(array("F", "T", "B") as $key){
-        if($this->acl_is_writeable("gosaProxyFlag".$key)){
-  
-          /* Add acl */
-          if (isset($_POST["filter$key"])){
-            $flags.= $key;
-          }
-        }else{
-          
-          /* Keep all flags that can't be written*/
-          if(preg_match("/".$key."/",$this->gosaProxyAcctFlags)){
-            $flags .=$key;
-          }
-        }
-      }
-      if ("[$flags]" != $this->gosaProxyAcctFlags){
-        $this->is_modified= TRUE;
-      }
-      $this->gosaProxyAcctFlags= "[$flags]";
-
-      /* Save time values */
-      if ($this->acl_is_writeable("gosaProxyFlagT")){
-        if(isset($_POST['startMinute'])){
-          $old= $this->gosaProxyWorkingStart;
-          $this->gosaProxyWorkingStart= $_POST["startHour"] * 60 + $_POST["startMinute"];
-          $this->is_modified= ($old != $this->gosaProxyWorkingStart)?TRUE:$this->is_modified;
-        }
-
-        if (isset($_POST['stopMinute'])){
-          $old= $this->gosaProxyWorkingStop;
-          $this->gosaProxyWorkingStop = $_POST["stopHour"]  * 60 + $_POST["stopMinute"];
-          $this->is_modified= ($old != $this->gosaProxyWorkingStop)?TRUE:$this->is_modified;
-        }
-      }
-
-      /* Save quota values */
-      if ($this->acl_is_writeable("gosaProxyFlagB")){
-        if(isset($_POST["quota_size"]) && isset($_POST["quota_unit"])){
-          $this->gosaProxyQuota= $_POST["quota_size"].$_POST["quota_unit"];
-        }
-      }
-  
-      /*Save quota period */
-      if($this->acl_is_writeable("gosaProxyFlagB")){
-        if(isset($_POST["gosaProxyQuotaPeriod"])){
-          $this->gosaProxyQuotaPeriod = $_POST["gosaProxyQuotaPeriod"];
-        }
-      }
-    }
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    plugin::save();
-
-    /* Write back to ldap */
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd($this->dn);
-    $this->cleanup();
-    $ldap->modify ($this->attrs); 
-
-    /* Log last action */
-    if($this->initially_was_account){
-      new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }else{
-      new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }
-
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/proxy account 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",array("uid" => $this->uid));
-      }
-    } else {
-      $this->handle_post_events("add",array("uid" => $this->uid));
-    }
-
-  }
-
-  /* Return plugin informations for acl handling 
-      #FIME There possibly some attributes that can be combined to one acl. */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"     => _("Proxy"),
-          "plDescription"   => _("Proxy account")."&nbsp;:&nbsp;<u>"._("Connectivity addon")."</u>",
-          "plSelfModify"    => TRUE,
-          "plDepends"       => array("user"),
-          "plPriority"      => 21,                                 // Position in tabs
-          "plSection"     => array("personal" => _("My account")),
-          "plCategory"    => array("users"),
-          "plOptions"       => array(),
-
-          "plProvidedAcls"  => array(
-            "gosaProxyFlagF"       => _("Filter unwanted content"), 
-            "gosaProxyFlagT"       => _("Limit proxy access"),
-            "gosaProxyFlagB"       => _("Restrict proxy usage by quota"))
-          ));
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/personal/connectivity/class_pureftpdAccount.inc b/plugins/personal/connectivity/class_pureftpdAccount.inc
deleted file mode 100644 (file)
index 68de2e8..0000000
+++ /dev/null
@@ -1,256 +0,0 @@
-<?php
-
-class pureftpdAccount extends plugin
-{
-  /* Definitions */
-  var $plHeadline= "FTP";
-  var $plDescription= "This does something";
-
-  /* FTP attributes */
-  var $FTPQuotaFiles = 0;
-  var $FTPQuotaMBytes = 0;
-  var $FTPUploadRatio = 0;
-  var $FTPDownloadRatio = 0;
-  var $FTPUploadBandwidth = 0;
-  var $FTPDownloadBandwidth = 0;
-  var $FTPStatus = "enabled";
-  var $FTPuid = "";
-  var $FTPgid = "";
-
-  var $uid = "";
-
-  /* attribute list for save action */
-  var $attributes= array("FTPQuotaFiles","FTPQuotaMBytes","FTPUploadRatio","FTPDownloadRatio",
-      "FTPUploadBandwidth","FTPDownloadBandwidth","FTPStatus","FTPuid","FTPgid");
-  var $objectclasses= array("PureFTPdUser");
-  var $ReadOnly;
-  var $view_logged = FALSE;
-
-  function pureftpdAccount (&$config, $dn= NULL, $parent= NULL)
-  {
-    plugin::plugin ($config, $dn, $parent);
-    
-    /* Setting uid to default */
-    if(isset($this->attrs['uid'][0])){
-      $this->uid = $this->attrs['uid'][0];
-    }
-  }
-
-  function execute()
-  {
-    /* Log view */
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","users/".get_class($this),$this->dn);
-    }
-
-    /* Show tab dialog headers */
-    $display= "";
-
-    /* Show main page */
-    $smarty= get_smarty();
-
-    /* Load attributes */
-    foreach($this->attributes as $val){
-      $smarty->assign("$val", $this->$val);
-    }
-
-
-    $tmp = $this->plInfo();
-    $changeState = "";
-    foreach($tmp['plProvidedAcls'] as $key => $desc){
-      $smarty->assign($key."ACL", $this->getacl($key,$this->ReadOnly));
-      $smarty->assign($key."_W", $this->acl_is_writeable($key,$this->ReadOnly));
-  
-      if($this->acl_is_writeable($key)){
-        $changeState.= " changeState('".$key."'); \n";
-      }
-    }
-    $smarty->assign("changeState",$changeState);
-
-
-    $smarty->assign("fstate", "");
-    if ($this->is_account){
-      $smarty->assign("pureftpdState", "checked");
-      $smarty->assign("fstate", "");
-    } else {
-      $smarty->assign("pureftpdState", "");
-      if($_SESSION['js']==1){
-        if($this->acl!="#none#")
-        $smarty->assign("fstate", "disabled");
-      }else{
-        $smarty->assign("fstate", "");
-      }
-    }
-    $smarty->assign("use_FTPStatus", ($this->FTPStatus == "disabled") ? "checked" : "");
-    
-    if((!$this->ReadOnly)&&(($this->is_account && $this->acl_is_removeable()) || (!$this->is_account && $this->acl_is_createable())) ){
-      $smarty->assign('pureftpdACL', "");
-    }else{
-      $smarty->assign('pureftpdACL', " disabled ");
-    }
-
-    $display.= $smarty->fetch (get_template_path('pureftpd.tpl', TRUE, dirname(__FILE__)));
-    return ($display);
-  }
-
-  function remove_from_parent()
-  {
-    /* Cancel if there's nothing to do here */
-    if ((!$this->initially_was_account) || (!$this->acl_is_removeable())){
-      return;
-    }
-
-    plugin::remove_from_parent();
-    $ldap= $this->config->get_ldap_link();
-
-    $ldap->cd($this->dn);
-    @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
-        $this->attributes, "Save");
-    $this->cleanup();
-    $ldap->modify ($this->attrs); 
-
-    /* Log last action */
-    new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-  
-    show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/pureftpd account with dn '%s' failed."),$this->dn));
-
-    /* Optionally execute a command after we're done */
-    $this->handle_post_events('remove',array("uid" => $this->uid));
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    /* Do we need to flip is_account state? */
-    if (isset($_POST['connectivityTab'])){
-      if (isset($_POST['pureftpd'])){
-        if (!$this->is_account && $_POST['pureftpd'] == "B"){
-          $this->is_account= TRUE;
-        }
-      } else {
-        $this->is_account= FALSE;
-      }
-
-      plugin::save_object();
-
-      $old= $this->FTPStatus;
-      if (isset($_POST["FTPStatus"])){
-        $this->FTPStatus = "disabled";
-      } else {
-        $this->FTPStatus = "enabled";
-      }
-      $this->is_modified= ($old != $this->FTPStatus)?TRUE:$this->is_modified;
-
-      /* Ensure that these vars are numeric. Values starting with 0 like '0123' cause ldap errors */
-      foreach(array("FTPQuotaFiles","FTPQuotaMBytes","FTPUploadRatio","FTPDownloadRatio","FTPUploadBandwidth","FTPDownloadBandwidth") as $testVar){
-        $this->$testVar = (int) ($this->$testVar);
-      }
-    
-
-    }
-  }
-
-
-  /* Check values */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    /* Check for positive integer values */
-    if ($this->is_account){
-
-      if($this->acl_is_writeable("FTPUploadBandwidth") && !is_id($this->FTPUploadBandwidth)){
-        $message[]= _("Value specified as 'Upload bandwidth' is not valid.");
-      }
-      if($this->acl_is_writeable("FTPDownloadBandwidth") && !is_id($this->FTPDownloadBandwidth)){
-        $message[]= _("Value specified as 'Download bandwidth' is not valid.");
-      }
-
-      if($this->acl_is_writeable("FTPQuotaFiles") && !is_id($this->FTPQuotaFiles)){
-        $message[]= _("Value specified as 'Quota files' is not valid.");
-      }
-      if($this->acl_is_writeable("FTPQuotaMBytes") && !is_id($this->FTPQuotaMBytes)){
-        $message[]= _("Value specified as 'Quota size' is not valid.");
-      }
-      if($this->acl_is_writeable("FTPUploadRatio") && !is_id($this->FTPUploadRatio)){
-        $message[]= _("Value specified as 'Upload ratio' is not valid.");
-      }
-      if($this->acl_is_writeable("FTPDownloadRatio") && !is_id($this->FTPDownloadRatio)){
-        $message[]= _("Value specified as 'Download ratio' is not valid.");
-      }
-    }
-
-    return $message;
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    plugin::save();
-
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $key => $desc){
-      if(!$this->acl_is_writeable($key)){
-        unset($this->attrs[$key]);
-      }
-    }
-
-    /* Write back to ldap */
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd($this->dn);
-    $this->cleanup();
-    $ldap->modify ($this->attrs); 
-    
-    /* Log last action */
-    if($this->initially_was_account){
-      new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }else{
-      new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }
-
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/pureftpd account 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",array("uid" => $this->uid));
-      }
-    } else {
-      $this->handle_post_events("add",array("uid" => $this->uid));
-    }
-
-  }
-
-
-  /* Return plugin informations for acl handling
-  #FIME There possibly some attributes that can be combined to one acl. */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"     => _("Ftp"),
-          "plDescription"   => _("Pure ftp account")."&nbsp;:&nbsp;<u>"._("Connectivity addon")."</u>",
-          "plSelfModify"    => TRUE,
-          "plDepends"       => array("user"),
-          "plPriority"      => 22,                                 // Position in tabs
-          "plSection"     => array("personal" => _("My account")),
-          "plCategory"    => array("users"),
-          "plOptions"       => array(),
-
-          "plProvidedAcls"  => array(
-            "FTPQuotaFiles"         => _("Quota files"),
-            "FTPUploadRatio"        => _("Upload ratio"),
-            "FTPQuotaMBytes"        => _("Quota MBytes"),
-            "FTPDownloadRatio"      => _("Download ratio"),
-            "FTPUploadBandwidth"    => _("Upload bandwith"),
-            "FTPDownloadBandwidth"  => _("Download bandwith"),
-            "FTPStatus"             => _("Status"))
-          ));
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/personal/connectivity/class_webdavAccount.inc b/plugins/personal/connectivity/class_webdavAccount.inc
deleted file mode 100644 (file)
index 59fdb60..0000000
+++ /dev/null
@@ -1,171 +0,0 @@
-<?php
-
-class webdavAccount extends plugin
-{
-  /* Definitions */
-  var $plHeadline= "WebDAV";
-  var $plDescription= "This does something";
-
-  /* attribute list for save action */
-  var $attributes= array();
-  var $objectclasses= array("gosaWebdavAccount");
-  var $ReadOnly = false;
-  var $view_logged = FALSE;
-  var $uid ="";
-
-  function webdavAccount (&$config, $dn= NULL)
-  {
-    plugin::plugin ($config, $dn);
-    
-    /* Setting uid to default */
-    if(isset($this->attrs['uid'][0])){
-      $this->uid = $this->attrs['uid'][0];
-    }
-  }
-
-  function execute()
-  {
-       /* Call parent execute */
-//     plugin::execute();
-
-    /* Log view */
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","users/".get_class($this),$this->dn);
-    }
-
-    /* Show tab dialog headers */
-    $display= "";
-
-    /* Show main page */
-    $smarty= get_smarty();
-
-    if ($this->is_account){
-      $smarty->assign("webdavState", "checked");
-    } else {
-      $smarty->assign("webdavState", "");
-      $smarty->assign("wstate", "disabled");
-    }
-
-    if ($this->parent !== NULL){
-      $smarty->assign("tabbed", 1);
-    }
-
-    if((!$this->ReadOnly) && (($this->is_account && $this->acl_is_removeable()) || (!$this->is_account && $this->acl_is_createable()))) {
-      $smarty->assign('webdavAccountACL', "");
-    }else{
-      $smarty->assign('webdavAccountACL', " disabled ");
-    }
-
-    $display.= $smarty->fetch (get_template_path('webdav.tpl', TRUE, dirname(__FILE__)));
-    return ($display);
-  }
-
-  function remove_from_parent()
-  {
-    if($this->acl_is_createable() || $this->is_account){
-      /* Cancel if there's nothing to do here */
-      if (!$this->initially_was_account){
-        return;
-      }
-
-      plugin::remove_from_parent();
-      $ldap= $this->config->get_ldap_link();
-
-      $ldap->cd($this->dn);
-      @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
-          $this->attributes, "Save");
-      $this->cleanup();
-      $ldap->modify ($this->attrs); 
-
-      /* Log last action */
-      new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-
-      show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/webDAV account with dn '%s' failed."),$this->dn));
-
-      /* Optionally execute a command after we're done */
-      $this->handle_post_events('remove',array("uid" => $this->uid));
-    }
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    /* Do we need to flip is_account state? */
-    if (isset($_POST['connectivityTab'])){
-      if (isset($_POST['webdav'])){
-        if (!$this->is_account && $_POST['webdav'] == "B"){
-          if($this->acl_is_createable()){
-            $this->is_account= TRUE;
-          }
-        }
-      } else {
-        if($this->acl_is_removeable()){
-          $this->is_account= FALSE;
-        }
-      }
-    }
-
-    plugin::save_object();
-    if (isset($_POST["WEBDAVStatus"])){
-      $this->WEBDAVStatus = "disabled";
-    } else {
-      $this->WEBDAVStatus = "enabled";
-    }
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    if($this->acl_is_createable()){
-      plugin::save();
-
-      /* Write back to ldap */
-      $ldap= $this->config->get_ldap_link();
-      $ldap->cd($this->dn);
-      $this->cleanup();
-      $ldap->modify ($this->attrs); 
-
-      /* Log last action */
-      if($this->initially_was_account){
-        new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-      }else{
-        new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-      }
-
-      show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/webDAV account 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",array("uid" => $this->uid));
-        }
-      } else {
-        $this->handle_post_events("add",array("uid" => $this->uid));
-      }
-    }
-  }
-
-  /* Return plugin informations for acl handling
-      #FIXME This is only an enable/disable checkbox for this account, there is possibly a better solution available later */
-  static function plInfo()
-  {
-    return (array(  
-          "plShortName"     => _("WebDAV"),
-          "plDescription"   => _("WebDAV account")."&nbsp;:&nbsp;<u>"._("Connectivity addon")."</u>",
-          "plSelfModify"    => TRUE,
-          "plDepends"       => array("user"),
-          "plPriority"      => 23,                                 // Position in tabs
-          "plSection"     => array("personal" => _("My account")),
-          "plCategory"    => array("users"),
-          "plOptions"       => array(),
-
-          "plProvidedAcls"  => array()
-          ));
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/personal/connectivity/glpi.tpl b/plugins/personal/connectivity/glpi.tpl
deleted file mode 100644 (file)
index 245b903..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<h2>{if $tabbed eq 1}<input type="checkbox" name="glpi" value="B" {$glpiState} {$glpiACL}>{/if}{t}GLPI account{/t}</h2>
diff --git a/plugins/personal/connectivity/intranet.tpl b/plugins/personal/connectivity/intranet.tpl
deleted file mode 100644 (file)
index f768285..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-<h2>
-       <input type="checkbox" name="intranet" value="B" {$intranetState} {$gosaIntranetACL}>
-       {t}Intranet account{/t}
-</h2>
diff --git a/plugins/personal/connectivity/kolab.tpl b/plugins/personal/connectivity/kolab.tpl
deleted file mode 100644 (file)
index 8b7bd6e..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-
-{if !$mail_account}
-       <h2>{t}Kolab account{/t}</h2>
-       {t}The kolab account is currently disabled. It's features can be adjusted if you add a mail account.{/t}
-{else}
-
-
-
-<input type="checkbox" id="kolabState" name="kolabState" value="1" {if $kolabState} checked {/if} 
-       {if (!$is_account && $is_createable) || ($is_account && $is_removeable)}
-       {else}
-               disabled        
-       {/if}
-       onClick="
-       {if $kolabDelegate_W}
-       changeState('delegate_list');
-       changeState('delegate_address');
-       changeState('add_delegation');
-       changeState('delete_delegation');
-       {/if}
-       {if $unrestrictedMailSize_W}
-       changeState('unrestrictedMailSize');
-       {/if}
-       {if $calFBURL_W}
-       changeState('calFBURL');
-       {/if}
-       {if $kolabFreeBusyFuture_W}
-       changeState('kolabFreeBusyFuture');
-       {/if}
-       {if $kolabInvitationPolicy_W}
-       {$changeState}
-       {/if}">
-
-
-<b>{t}Kolab account{/t}</b>
-<br>
-<br>
-<table summary="" style="width:100%">
- <tr>
-  <td style="width:50%; vertical-align:top;">
-   <b><LABEL for="delegate_list">{t}Delegations{/t}</LABEL></b><br>
-{render acl=$kolabDelegateACL}
-   <select id="delegate_list" style="width:350px; height:100px;" name="delegate_list[]" size=15 multiple  {if !$kolabState}disabled{/if} >
-    {html_options values=$kolabDelegate output=$kolabDelegate}
-       <option disabled>&nbsp;</option>
-   </select>
-{/render}
-   <br>
-{render acl=$kolabDelegateACL}
-   <input name="delegate_address" size=30 align=middle maxlength=60 {if !$kolabState} disabled {/if} value="" id="delegate_address">
-{/render}
-{render acl=$kolabDelegateACL}
-   <input type=submit value="{t}Add{/t}" name="add_delegation" {if !$kolabState} disabled {/if} id="add_delegation">&nbsp;
-{/render}
-{render acl=$kolabDelegateACL}
-   <input type=submit value="{t}Delete{/t}" name="delete_delegation" {if !$kolabState} disabled {/if} id="delete_delegation">
-{/render}
-   <p>
-    <b>{t}Mail size{/t}</b><br>
-{render acl=$unrestrictedMailSizeACL}
-     &nbsp;<input type="checkbox" id='unrestrictedMailSize' name="unrestrictedMailSize" value="1" {if !$kolabState} disabled {/if}
-       {$unrestrictedMailSizeState}> {t}No mail size restriction for this account{/t}
-{/render}
-    </p>
-  </td>
-  <td rowspan=2 style="border-left:1px solid #A0A0A0">
-   &nbsp;
-  </td>
-  <td style="vertical-align:top;">
-
- <b>{t}Free Busy information{/t}</b><br>
- <table summary="">
-  <tr>
-   <td><LABEL for="calFBURL">{t}URL{/t}</LABEL></td>
-   <td>
-{render acl=$calFBURLACL}
-   <input id="calFBURL" name="calFBURL" size=30 maxlength=60 value="{$calFBURL}" {if !$kolabState} disabled {/if}>
-{/render}
-   </td>
-  </tr>
-  <tr>
-  <td><LABEL for="kolabFreeBusyFuture">{t}Future{/t}</LABEL></td>
-  <td>
-{render acl=$kolabFreeBusyFutureACL}
-   <input id="kolabFreeBusyFuture" name="kolabFreeBusyFuture" size=5 maxlength=6 {if !$kolabState} disabled {/if} value="{$kolabFreeBusyFuture}"> 
-       {t}days{/t}
-{/render}
-   </td>
-  </tr>
- </table>
-
-
- <b>{t}Invitation policy{/t}</b><br>
-{render acl=$kolabInvitationPolicyACL}
- <table summary="">
-   {$invitation}
- </table>
-{/render}
-
-  </td>
- </tr>
-</table>
-
-{/if}
diff --git a/plugins/personal/connectivity/main.inc b/plugins/personal/connectivity/main.inc
deleted file mode 100644 (file)
index 14472f2..0000000
+++ /dev/null
@@ -1,124 +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
- */
-
-if (!$remove_lock){
-  /* Reset requested? */
-  if (isset($_POST['edit_cancel']) ||
-      (isset($_GET['reset']) && $_GET['reset'] == 1)){
-
-    del_lock ($ui->dn);
-    sess_del ('edit');
-    sess_del ('connectivity');
-  }
-
-  /* Create connectivity object on demand */
-  if (!isset($_SESSION['connectivity']) || (isset($_GET['reset']) &&
-      $_GET['reset'] == 1)){
-    $_SESSION['connectivity']= new connectivity ($config, $ui->dn);
-    $_SESSION['connectivity']->enable_CSN_check();
-    $_SESSION['connectivity']->set_acl_base($ui->dn);
-    $_SESSION['connectivity']->set_acl_category("users");
-
-    /* Adjust acl's to mode */
-    foreach ($_SESSION['connectivity']->plugin_name as $name){
-      $_SESSION['connectivity']->plugin[$name]->set_acl_category( "users");
-      $_SESSION['connectivity']->plugin[$name]->set_acl_base($ui->dn);
-    }
-  }
-  $connectivity= $_SESSION['connectivity'];
-
-  /* save changes back to object */
-  if (isset ($_SESSION['edit'])){
-    $connectivity->save_object ();
-  }
-
-  /* Enter edit mode? */
-  if (isset($_POST['edit'])){
-
-    /* Check locking */
-    if ((($username= get_lock($ui->dn)) != "") && (!isset($_SESSION['edit']))){
-      $_SESSION['back_plugin']= $plug;
-      gen_locked_message ($username, $ui->dn);
-      exit ();
-    }
-
-
-    /* Lock the current entry */
-    add_lock ($ui->dn, $ui->dn);
-    $_SESSION['dn']= $ui->dn;
-    $_SESSION['edit']= TRUE;
-  }
-
-  /* save changes to LDAP and disable edit mode */
-  if (isset($_POST['edit_finish'])){
-
-    /* Perform checks */
-    $message= $connectivity->check ();
-
-    /* No errors, save object */
-    if (count ($message) == 0){
-      $connectivity->save ();
-      del_lock ($ui->dn);
-      sess_del ('edit');
-
-      /* Remove from session */
-      sess_del ('connectivity');
-    } else {
-      /* Errors found, show message */
-      show_errors ($message);
-    }
-  }
-
-  /* Execute formular */
-  $display= $connectivity->execute ();
-
-  /* Store changes  in session */
-  if (isset ($_SESSION['edit'])){
-    $_SESSION['connectivity']= $connectivity;
-  }
-
-  $info= "";
-
-  $display.="<div align='right'>";
-  if (isset($_SESSION['edit'])){
-    $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
-    $display.= "&nbsp;";
-    $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
-    $info= "<img class=\"center\" alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png').
-      "\"> ".$ui->dn."&nbsp;";
-  } else {
-    $info= "<img class=\"center\" alt=\"\" align=\"middle\" src=\"".get_template_path('images/openlock.png').
-      "\"> ".$ui->dn."&nbsp;";
-
-    $info.= "<img class=\"center\" alt=\"\" align=\"middle\" src=\"".get_template_path('images/lamp.png').
-      "\">"._("Click the 'Edit' button below to change informations in this dialog");
-    $display.= "<input type=submit name=\"edit\" value=\""._("Edit")."\">\n";
-    $display.= "<input type=\"hidden\" name=\"ignore\">\n";
-  }
-  $display.="</div>";
-
-  /* Page header*/
-  $display= print_header(get_template_path('images/proxy.png'),
-      _("Connectivity"), $info).$display;
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/personal/connectivity/opengw.tpl b/plugins/personal/connectivity/opengw.tpl
deleted file mode 100644 (file)
index 5687417..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-<h2><input type="checkbox" value="1" name="is_account" {$is_account} {$opengwAccountACL} onClick="document.mainform.submit();">&nbsp;{t}Opengroupware{/t}</h2>
-<table width="100%" summary="">
-       <tr>
-               <td width="50%">
-                       <table summary="">
-                               <tr>
-                                       <td>
-                                               {t}Location team{/t} &nbsp;
-                                       </td>
-                                       <td>
-{render acl=$LocationTeamACL}
-                                               <select size="1" id="LocationTeam" name="LocationTeam"
-                                                       {if $OGWstate!=""} disabled {/if}>
-                                                       {html_options values=$validLocationTeams output=$validLocationTeam selected=$LocationTeam}
-                                               </select>
-{/render}
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>
-                                               {t}Template user{/t} &nbsp;
-                                       </td>
-                                       <td>
-{render acl=$TemplateUserACL}
-                                               <select size="1" id="TemplateUser" name="TemplateUser" {if $OGWstate!=""} disabled {/if}>
-                                                       {html_options values=$validTemplateUsers output=$validTemplateUser selected=$TemplateUser}
-                                               </select>
-{/render}
-                                       </td>
-                               </tr>   
-                               <tr>
-                                       <td valign="top">
-                                               {t}Locked{/t} &nbsp; 
-                                       </td>
-                                       <td valign="top">
-{render acl=$LockedACL}
-                                               <input type="checkbox" value="1" name="is_locked" {$is_lockedCHK}  
-                                                  {if $OGWstate!=""} disabled {/if}>
-{/render}
-                                       </td>
-                               </tr>
-                       </table>
-               </td>
-               <td valign="top" style="border-left: 1px solid rgb(160, 160, 160);">
-                       <table summary="">
-                               <tr>
-                                       <td valign="top">
-                                               {t}Teams{/t} &nbsp; 
-                                       </td>
-                                       <td valign="top">
-{render acl=$TeamsACL}
-                                               {$validTeams}   
-{/render}
-                                       </td>
-                               </tr>
-                       </table>
-               </td>
-       </tr>
-</table>
diff --git a/plugins/personal/connectivity/oxchange.tpl b/plugins/personal/connectivity/oxchange.tpl
deleted file mode 100644 (file)
index 2bd2049..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-{if !$pg}
-<h2>{t}Open-Xchange Account{/t} - {t}disabled, no Postgresql support detected. Or the specified database can't be reached{/t}</h2>
-{else}
-<h2>
-<input type="checkbox" name="oxchange" value="B" 
-       {$oxchangeState} {$oxchangeAccountACL} 
-       onCLick="       
-       {if $OXAppointmentDays_W} 
-               changeState('OXAppointmentDays');
-       {/if}
-       {if $OXTaskDays_W} 
-               changeState('OXTaskDays');
-       {/if}
-       {if $OXTimeZone_W} 
-               changeState('OXTimeZone'); 
-       {/if}
-       ">
-{t}Open-Xchange account{/t}</h2>
-
-
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=0 border=0>
-
- <!-- Headline container -->
- <tr>
-   <td style="width:50%; vertical-align:top;">
-     <table summary="" style="margin-left:4px;">
-       <tr>
-         <td colspan=2 style="vertical-align:top;">
-           <b>{t}Remember{/t}</b>
-         </td>
-       </tr>
-       <tr>
-         <td><LABEL for="OXAppointmentDays">{t}Appointment Days{/t}</LABEL></td>
-        <td>
-
-{render acl=$OXAppointmentDaysACL}     
-<input name="OXAppointmentDays" id="OXAppointmentDays" size=7 maxlength=7 value="{$OXAppointmentDays}" {$oxState} >
-{/render}
-        {t}days{/t}</td>
-       </tr>
-       <tr>
-         <td><LABEL for="OXTaskDays">{t}Task Days{/t}</LABEL></td>
-        <td>
-
-{render acl=$OXTaskDaysACL}    
-<input name="OXTaskDays" id="OXTaskDays" size=7 maxlength=7 value="{$OXTaskDays}" {$oxState} >
-{/render}
-
-        {t}days{/t}
-       </td>
-       </tr>
-     </table>
-   </td>
-   <td rowspan=2 style="border-left:1px solid #A0A0A0">
-     &nbsp;
-   </td>
-   <td style="vertical-align:top;">
-     <table summary="">
-       <tr>
-         <td colspan=2 style="vertical-align:top;">
-           <b>{t}User Information{/t}</b>
-         </td>
-       </tr>
-       <tr>
-         <td><LABEL for="OXTimeZone">{t}User Timezone{/t}</LABEL></td>
-        <td>
-
-{render acl=$OXTimeZoneACL}    
-<select size="1" name="OXTimeZone" id="OXTimeZone" {$oxState} > 
- {html_options values=$timezones output=$timezones selected=$OXTimeZone}
- </select>
-{/render}
-
-        </td>
-       </tr>
-       <tr>
-         <td></td>
-        <td></td>
-       </tr>
-     </table>
-   </td>
- </tr>
-</table>
-{/if}
diff --git a/plugins/personal/connectivity/phpgw.tpl b/plugins/personal/connectivity/phpgw.tpl
deleted file mode 100644 (file)
index 299da67..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-<h2>
-       <input type="checkbox" name="phpgw" value="B" {$phpgwState} {$phpgwAccountACL}>
-       {t}PHPGroupware account{/t}
-</h2>
diff --git a/plugins/personal/connectivity/phpscheduleit.tpl b/plugins/personal/connectivity/phpscheduleit.tpl
deleted file mode 100644 (file)
index 7e5510c..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-<h2>
-       <input type="checkbox" name="phpscheduleit" value="B" {$phpscheduleitState} {$gosaphpscheduleitACL}>
-       {t}PHPscheduleit account{/t}
-</h2>
diff --git a/plugins/personal/connectivity/pptp.tpl b/plugins/personal/connectivity/pptp.tpl
deleted file mode 100644 (file)
index 15d28a7..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-<h2>
-       <input type="checkbox" name="pptp" value="B" {$pptpState} {$gosapptpACL}>
-       {t}PPTP account{/t}
-</h2>
diff --git a/plugins/personal/connectivity/proxy.tpl b/plugins/personal/connectivity/proxy.tpl
deleted file mode 100644 (file)
index 5178237..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-<h2>
- <input type="checkbox" id="proxy" name="proxy" value="B" {$proxyState} {$proxyAccountACL} 
-   onClick="
-
-{if $gosaProxyFlagF_W}
-    changeState('filterF');
-{/if}
-
-{if $gosaProxyFlagT_W}
-       changeState('filterT'); 
-       changeTripleSelectState('proxy', 'filterT', 'startHour'); 
-       changeTripleSelectState('proxy', 'filterT', 'startMinute'); 
-       changeTripleSelectState('proxy', 'filterT', 'stopMinute'); 
-       changeTripleSelectState('proxy', 'filterT', 'stopHour'); 
-{/if}
-{if $gosaProxyFlagB_W}
-       changeState('filterB'); 
-       changeTripleSelectState('proxy', 'filterB', 'quota_unit'); 
-       changeTripleSelectState('proxy', 'filterB', 'quota_size');
-       changeTripleSelectState('proxy', 'filterB', 'gosaProxyQuotaPeriod');
-{/if}
-   ">
- {t}Proxy account{/t}</h2>
-
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=0 border=0>
- <tr>
-   <td>
-    <table summary="" border=0 width="100%" cellpadding=0>
-    <tr><td colspan=2>
-
-{render acl=$gosaProxyFlagFACL}
-    <input type="checkbox" name="filterF" id="filterF" value="F" {$filterF} {$pstate} >
-{/render}
-    {t}Filter unwanted content (i.e. pornographic or violence related){/t}
-    </td></tr>
-     <tr>
-      <td width="50%">
-
-{render acl=$gosaProxyFlagTACL}
-    <input type="checkbox" name="filterT" id="filterT" value="T" {$filterT} {$pstate}  onClick="javascript:
- {$ProxyWorkingStateChange}">
-{/render}
-
-    <LABEL for="startHour">{t}Limit proxy access to working time{/t}</LABEL>
-    <br>
-    <table summary="" style="margin-left:20px;">
-     <tr>
-      <td>
-
-{render acl=$gosaProxyFlagTACL}
-        <select size="1" id="startHour" name="startHour" {if $Tstate!="" || $pstate!=""} disabled {/if}  >
-         {html_options values=$hours output=$hours selected=$starthour}
-        </select>
-{/render}
-        &nbsp;:&nbsp;
-{render acl=$gosaProxyFlagTACL}
-        <select size="1" id="startMinute" name="startMinute" {if $Tstate!="" || $pstate!=""} disabled {/if}  >
-         {html_options values=$minutes output=$minutes selected=$startminute}
-        </select>
-{/render}
-        &nbsp;-&nbsp;
-{render acl=$gosaProxyFlagTACL}
-        <select size="1" id="stopHour" name="stopHour" {if $Tstate!="" || $pstate!=""} disabled {/if} >
-   {html_options values=$hours output=$hours selected=$stophour}
-        </select>
-{/render}
-        &nbsp;:&nbsp;
-{render acl=$gosaProxyFlagTACL}
-        <select size="1" id="stopMinute" name="stopMinute" {if $Tstate!="" || $pstate!=""} disabled {/if}>
-         {html_options values=$minutes output=$minutes selected=$stopminute}
-        </select>
-{/render}
-      </td>
-     </tr>
-    </table>
-      </td>
-   <td rowspan=2 style="border-left:1px solid #A0A0A0">
-     &nbsp;
-   </td>
-      <td>
-{render acl=$gosaProxyFlagBACL}
-    <input type="checkbox" id="filterB" name="filterB" value="B" {$filterB} {if $pstate=="disabled"} disabled {/if} onClick="{$changeB}">
-{/render}
-    <LABEL for="quota_size">{t}Restrict proxy usage by quota{/t}</LABEL>
-    <br>
-    <table summary="" style="margin-left:20px;">
-     <tr>
-      <td>
-{render acl=$gosaProxyFlagBACL}
-       <input name="quota_size" id="quota_size" size=7 maxlength=10 value="{$quota_size}" {if $Tstate!="" || $pstate!=""} disabled {/if} >
-{/render}
-       &nbsp;
-{render acl=$gosaProxyFlagBACL}
-       <select size="1" name="quota_unit" id="quota_unit" {if $Tstate!="" || $pstate!=""} disabled {/if} >
-       {html_options options=$quota_unit selected=$quota_u}
-       </select>
-{/render}
-    
-       <LABEL for="gosaProxyQuotaPeriod">{t}per{/t}</LABEL>
-{render acl=$gosaProxyFlagBACL}
-       <select size="1" name="gosaProxyQuotaPeriod" id="gosaProxyQuotaPeriod" {if $Tstate!="" || $pstate!=""} disabled {/if} >
-        {html_options options=$quota_time selected=$gosaProxyQuotaPeriod}
-       </select>
-{/render}
-      </td>
-     </tr>
-    </table>
-   </td>
-   </tr>
-   </table>
-  </td>
- </tr>
-</table>
-
diff --git a/plugins/personal/connectivity/pureftpd.tpl b/plugins/personal/connectivity/pureftpd.tpl
deleted file mode 100644 (file)
index 714ef78..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-<h2>
-       <input type="checkbox" name="pureftpd" value="B" {$pureftpdState} {$pureftpdACL} 
-               onclick="{$changeState}" >
-       {t}FTP account{/t}
-</h2>
-
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=0 border=0>
-
- <!-- Headline container -->
- <tr>
-   <td style="width:50%; vertical-align:top;">
-     <table summary="" style="margin-left:4px;">
-       <tr>
-         <td colspan=2 style="vertical-align:top;">
-           <b>{t}Bandwidth{/t}</b>
-         </td>
-       </tr>
-       <tr>
-         <td>{t}Upload bandwidth{/t}</td>
-        <td>
-{render acl=$FTPUploadBandwidthACL}
-<input name="FTPUploadBandwidth" id="FTPUploadBandwidth" size=7 maxlength=7 value="{$FTPUploadBandwidth}" {$fstate} >
-{/render}
-        {t}kb/s{/t}</td>
-       </tr>
-       <tr>
-         <td>{t}Download bandwidth{/t}</td>
-        <td>
-{render acl=$FTPDownloadBandwidthACL}
-<input name="FTPDownloadBandwidth" id="FTPDownloadBandwidth" size=7 maxlength=7 value="{$FTPDownloadBandwidth}" {$fstate} >
-{/render}
-        {t}kb/s{/t}</td>
-       </tr>
-     </table>
-   </td>
-   <td rowspan=2 style="border-left:1px solid #A0A0A0">
-     &nbsp;
-   </td>
-   <td>
-     <table summary="">
-       <tr>
-         <td colspan=2 style="vertical-align:top;">
-           <b>{t}Quota{/t}</b>
-         </td>
-       </tr>
-       <tr>
-         <td>{t}Files{/t}</td>
-        <td>
-{render acl=$FTPQuotaFilesACL}
-<input name="FTPQuotaFiles" id="FTPQuotaFiles" size=7 maxlength=10 value="{$FTPQuotaFiles}" {$fstate} >
-{/render}
-       </td>
-       </tr>
-       <tr>
-         <td>{t}Size{/t}</td>
-        <td>
-{render acl=$FTPQuotaMBytesACL}
-<input name="FTPQuotaMBytes" id="FTPQuotaMBytes" size=7 maxlength=10 value="{$FTPQuotaMBytes}" {$fstate} > 
-{/render}
-       {t}MB{/t}
-       </td>
-       </tr>
-     </table>
-   </td>
- </tr>
- <tr>
-   <td>
-     <table summary="" style="margin-left:4px;">
-       <tr>
-         <td colspan=2 style="vertical-align:top;">
-           <b>{t}Ratio{/t}</b>
-         </td>
-       </tr>
-       <tr>
-         <td>{t}Uploaded / downloaded files{/t}</td>
-        <td>
-
-{render acl=$FTPUploadRatioACL}
-<input name="FTPUploadRatio" id="FTPUploadRatio" size=5 maxlength=20 value="{$FTPUploadRatio}" {$fstate} >
-{/render}
-        / 
-{render acl=$FTPDownloadRatioACL}
-<input name="FTPDownloadRatio" id="FTPDownloadRatio" size=5 maxlength=20 value="{$FTPDownloadRatio}" {$fstate} >
-{/render}
-       </td>
-       </tr>
-     </table>
-   </td>
-   <td>
-     <table summary="">
-       <tr>
-         <td colspan=2 style="vertical-align:top;">
-           <b>{t}Miscellaneous{/t}</b>
-         </td>
-       <tr>
-         <td>
-{render acl=$FTPStatusACL}
-<input type=checkbox name="FTPStatus" id="FTPStatus" value="disabled" {$use_FTPStatus} title="{t}Check to disable FTP Access{/t}" {$fstate} >
-{/render}
-{t}Temporary disable FTP access{/t}</td>
-       </tr>
-     </table>
-   </td>
- </tr>
-</table>
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('FTPUploadBandwidth');
-  -->
-</script>
diff --git a/plugins/personal/connectivity/webdav.tpl b/plugins/personal/connectivity/webdav.tpl
deleted file mode 100644 (file)
index ecd567c..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-<h2>
-       <input type="checkbox" name="webdav" value="B" {$webdavState} {$webdavAccountACL}>
-       {t}WebDAV account{/t}
-</h2>
diff --git a/plugins/personal/environment/class_environment.inc b/plugins/personal/environment/class_environment.inc
deleted file mode 100644 (file)
index 3d5de28..0000000
+++ /dev/null
@@ -1,1367 +0,0 @@
-<?php
-
-class environment 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 $plHeadline           = "Environment";
-  var $plDescription        = "This does something";
-  var $dialog               = false;    // Indicates that we are currently editing in an seperate dialog
-  
-  var $in_dialog            = false;
-  var $uid                  = "";
-
-  var $is_group             = false;
-  var $view_logged = FALSE;
-  
-  /* Attribute definition
-   */
-
-  /* profile management */
-  var $useProfile         = false;  // Specifies if we want to use a Server 
-  var $gotoProfileServer  = "";     // Specifies the selected profile server
-  var $gotoProfileServers = array();// Specifies all available and selectable servers
-  var $gotoProfileFlags   = "";     // Flags enabled  ? only used to set ACL and save 
-  var $gotoProfileFlagC  = "";     // Flag is set to C if we have the profile caching fucntion enabled 
-  
-  var $gotoXResolution    = "auto";     // The selected resolution eg: 1024x768
-  var $gotoXResolutions   = array();// Contains all available resolutions for this account
-  var $gotoProfileFlagL  = "";     // Flag is set to L to enable runtime resolution change 
-  var $gotoProfileQuota   = "";     // User Quota Settings
-
-  /* Logon script section*/
-  var $gotoLogonScripts   = array();// Contains all available Logon Scripts  
-  var $gotoLogonScript    = "";     // The selected Logon Script
-
-  /* Printer */
-  var $gotoPrinter        = array();// All available Printer, with their configurations
-  var $gotoPrinterSel     = "";     //  The selected Printer
-  var $gosaDefaultPrinter = "";     // Default printer
-
-  /* Share */
-  var $gotoShares         = array();// Current Share Options
-  var $gotoShare          = "";     // currently selected Share Option
-  var $gotoShareSelections= array();// Available Shares for this account in Listbox format
-  var $gotoAvailableShares= array();// Available Shares for this account
-
-  /* Kiosk profile */
-  var $kiosk_enabled      = FALSE;
-  var $gotoKioskProfile   = "";     // The selected Kiosk Profile
-  var $gotoKioskProfile_Server    = "";     // The selected Kiosk Profile
-  var $gotoKioskProfile_Profile   = "";     // The selected Kiosk Profile
-  var $gotoKioskProfiles  = array();// All available Kiosk profiles
-
-  /* Hotplug Devices */
-  var $gotoHotplugDevice  = array();     // Selected hotplug
-  var $gotoHotplugDevices = array();// Already configured hotplug devices 
-  var $gotoHotplugDeviceDN= array();
-
-  var $NewAddedPrinters   = array();
-  var $NewDeletedPrinters = array();
-
-  /* general settings */
-  // Sets the attributes which will kept on page reload, which will be saved, ...
-
-  var $CopyPasteVars      = array("gotoHotplugDevices","gotoAvailableShares","gotoShareSelections","gotoPrinterSel","gotoProfileFlagL","gotoXResolutions","gotoProfileFlagC","gotoProfileServers","useProfile","is_group","in_dialog","OrigCn","gotoKioskProfile_Server","gotoKioskProfile_Profile");
-
-  var $attributes         = array("uid","gotoProfileServer","gotoProfileFlags","gotoHotplugDeviceDN",
-      "gotoXResolution","gotoProfileQuota",
-      "gotoLogonScripts","gotoLogonScript",
-      "gotoPrinter", "gosaDefaultPrinter",
-      "gotoShares","gotoShare",
-      "gotoKioskProfile");
-  var $objectclasses      = array("gotoEnvironment"); // Specifies the objectClass which contains the attributes edited here 
-  var $cn;
-  var $OrigCn;
-  var $add_del_printer_member_was_called = false;
-
-  function environment (&$config, $dn= NULL)
-  {
-    plugin::plugin ($config, $dn);
-
-    /* Setting uid to default */
-    if(isset($this->attrs['uid'][0])){
-      $this->uid = $this->attrs['uid'][0];
-    }
-
-    /* Check : Are we currently editing a group or user dialog */
-    if((isset($this->attrs['cn'][0]))&&(!isset($this->attrs['uid'][0]))){
-      $suffix="Group";
-      $this->uid          = $this->attrs['cn'][0];
-      $this->attrs['uid'] = $this->attrs['cn'][0];
-      $this->OrigCn = $this->attrs['cn'][0];
-    }else{
-      $suffix="User";
-    }
-
-    /* Get all Printer assignments */
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(&(objectClass=gotoPrinter)(goto".$suffix."Printer=".$this->uid."))",array("*"));
-    while($printer = $ldap->fetch()){
-      $this->gotoPrinter[$printer['cn'][0]]=$printer;
-      $this->gotoPrinter[$printer['cn'][0]]['mode']="user";
-    }
-    $ldap->search("(&(objectClass=gotoPrinter)(goto".$suffix."AdminPrinter=".$this->uid."))",array("*"));
-    while($printer = $ldap->fetch()){
-      $this->gotoPrinter[$printer['cn'][0]]=$printer;
-      $this->gotoPrinter[$printer['cn'][0]]['mode']="admin";
-    }
-
-
-    /* Prepare hotplugs */
-    if(isset($this->attrs['gotoHotplugDeviceDN']) && is_array($this->attrs['gotoHotplugDeviceDN'])){
-      $ldap = $this->config->get_ldap_link();
-      $ldap->cd($this->config->current['BASE']);
-      for($i = 0 ; $i < $this->attrs['gotoHotplugDeviceDN']['count'] ; $i ++){
-        $ldap->cat($this->attrs['gotoHotplugDeviceDN'][$i]);
-        if($ldap->count()){
-          $attrs = $ldap->fetch(); 
-
-          if(isset($attrs['gotoHotplugDevice'][0])){
-            $tmp      = preg_split("/\|/",$attrs['gotoHotplugDevice'][0]);
-            $tmp2     = array();
-            $tmp2['name']         = $attrs['cn'][0];
-            $tmp2['description']  = $tmp[0];
-            $tmp2['id']           = $tmp[1];
-            $tmp2['produkt']      = $tmp[2];
-            $tmp2['vendor']       = $tmp[3];
-            $tmp2['dn']           = $attrs['dn'];
-            $this->gotoHotplugDevices[] = $tmp2; 
-          }
-        }else{
-          print_red(sprintf(_("The selected hotplug device %s is no longer available, it will be removed when you save this account."),$this->attrs['gotoHotplugDeviceDN'][$i]));
-        }
-      }
-    }
-
-    /* prepare LogonScripts */
-    if((isset($this->attrs['gotoLogonScript']))&&(is_array($this->attrs['gotoLogonScript']))){
-      unset($this->attrs['gotoLogonScript']['count']);
-      foreach($this->attrs['gotoLogonScript'] as $device){
-        $tmp = $tmp2 = array();
-        $tmp = split("\|",$device);
-        $tmp2['LogonName']        = $tmp[0]; 
-        $tmp2['LogonPriority']    = $tmp[2]; 
-        if(preg_match("/O/i",$tmp[1])){
-          $tmp2['LogonOverload'] = "O";
-        }else{
-          $tmp2['LogonOverload'] = "";
-        }
-        if(preg_match("/L/i",$tmp[1])){
-          $tmp2['LogonLast'] = "L";
-        }else{
-          $tmp2['LogonLast'] = "";
-        }
-        $tmp2['LogonData']        = base64_decode($tmp[3]); 
-        $tmp2['LogonDescription'] = $tmp[4];
-        $this->gotoLogonScripts[$tmp[0]]=$tmp2;
-      }
-    }
-
-    /* Prepare Shares */
-    if((isset($this->attrs['gotoShare']))&&(is_array($this->attrs['gotoShare']))){
-      unset($this->attrs['gotoShare']['count']);
-      foreach($this->attrs['gotoShare'] as $share){
-        $tmp = $tmp2 = array();
-        $tmp = split("\|",$share);
-        $tmp2['server']      =$tmp[0];
-        $tmp2['name']        =$tmp[1];
-
-        /* Decode base64 if needed */
-        if (!preg_match('%/%', $tmp[2])){
-          $tmp2['mountPoint']  =base64_decode($tmp[2]);
-        } else {
-          $tmp2['mountPoint']  =$tmp[2];
-        }
-
-        if(isset($tmp[3])){
-          $tmp2['PwdHash']  =$tmp[3];
-        }else{
-          $tmp2['PwdHash']  ="";
-        }
-        if(isset($tmp[4])){
-          $tmp2['Username']  =$tmp[4];
-        }else{
-          $tmp2['Username']  ="";
-        }
-        $this->gotoShares[$tmp[1]."|".$tmp[0]]=$tmp2;
-      }
-    }
-
-    for($i = 0 ; $i < strlen($this->gotoProfileFlags) ; $i ++){
-      $chr = $this->gotoProfileFlags[$i];
-      $name = "gotoProfileFlag".$chr;
-      $this->$name=$chr;
-    }
-
-    if((!empty($this->gotoProfileServer))||($this->gotoProfileFlagC=="C")){
-      $this->useProfile = true;
-    }else{
-      $this->useProfile = false;
-    }
-
-    /* Set resolutions */
-    $this->gotoXResolutions = array("auto"=>_("auto"),
-                                    "640x480"   =>  "640x480",
-                                    "800x600"   =>  "800x600",
-                                    "1024x768"  =>  "1024x768",
-                                    "1152x864"  =>  "1152x864",
-                                    "1280x768"  =>  "1280x768",
-                                    "1280x1024" =>  "1280x1024");
-
-    if(isset($this->config->data['MAIN']['RESOLUTION_HOOK'])){
-      $file = $this->config->data['MAIN']['RESOLUTION_HOOK'];
-
-      if(is_readable($file)){
-        $str = file_get_contents($file);
-        $lines = split("\n",$str);
-        foreach($lines as $line){
-          $line = trim($line);
-          if(!empty($line)){
-            $this->gotoXResolutions[$line]=$line;
-          }
-        }
-        //natcasesort($this->gotoXResolutions);
-      }else{
-        print_red(sprintf(_("You have specified an external resolution hook which can't be read, please check the permission of the file '%s'."),$file));
-      }
-    }
-
-    $this->gotoProfileServers= $config->getShareServerList() ;
-    $this->gotoShareSelections= $config->getShareList(true);
-    $this->gotoAvailableShares= $config->getShareList(false);  
-
-    $this->update_kiosk_profiles();
-  
-    $this->gotoKioskProfile= preg_replace("/^.*\//i","",$this->gotoKioskProfile);
-  }
-
-
-  function update_kiosk_profiles()
-  { 
-    $tmp1  = array("none" => array(_("disabled")));
-    $tmp2  = array("none" => _("disabled"));
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(&(objectClass=goEnvironmentServer)(gotoKioskProfile=*)(cn=*))",array("cn","gotoKioskProfile"));
-    $cnt = 0;
-    while($attrs = $ldap->fetch()){
-      for($i = 0 ; $i < $attrs['gotoKioskProfile']['count'] ; $i ++){
-        $name = preg_replace("/^.*kiosk\//","",$attrs['gotoKioskProfile'][$i]);
-        $tmp1[$attrs['cn'][0]][] = $name;
-      }
-      $tmp2[$attrs['cn'][0]]= $attrs['cn'][0];
-      $cnt ++;
-    }
-
-    if($cnt && $this->config->search("environment","kioskpath",array('menu','tabs'))){
-      $this->kiosk_enabled = TRUE;
-    }
-
-    $this->gotoKioskProfiles['BY_SERVER'] = $tmp1;
-    $this->gotoKioskProfiles['SERVERS']   = $tmp2;
-  
-    $this->gotoKioskProfile_Server = preg_replace("/^.*:\/\/([^\/]*).*$/","\\1",$this->gotoKioskProfile);
-    $this->gotoKioskProfile_Profile= preg_replace("/^.*\//","",$this->gotoKioskProfile);
-
-    $error = false;
-    if(!in_array($this->gotoKioskProfile_Server, $this->gotoKioskProfiles['SERVERS'])){
-      $this->gotoKioskProfile_Server = key($this->gotoKioskProfiles['SERVERS']);
-      $error = true;
-    }
-    if(!in_array($this->gotoKioskProfile_Profile, $this->gotoKioskProfiles['BY_SERVER'][$this->gotoKioskProfile_Server])){
-      $this->gotoKioskProfile_Profile = $this->gotoKioskProfiles['BY_SERVER'][$this->gotoKioskProfile_Server][0];
-      $error = true;
-    }
-    if($error && !empty($this->gotoKioskProfile)){
-      print_red(sprintf(_("The selected kiosk profile wasn't available anymore. The current profile is now 'none'."),
-            $this->gotoKioskProfile_Server,$this->gotoKioskProfile_Profile));
-    }
-  }
-
-
-  /* Detect type of edited object (user|group)*/
-  function detect_grouptype()
-  {
-    if((!isset($this->parent))&&(!$this->is_account)){
-      $this->is_group     = false;
-    }elseif((isset($this->parent))&&(!isset($this->parent->by_object['posixAccount']))){
-      $this->is_group     = true;
-    }else{
-      $this->is_group     = false;
-    }
-  }
-
-
-  function execute()
-  {
-
-    /* Call parent execute */
-    plugin::execute();
-    /* Log view */
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      if(isset($this->parent->by_object['user']) || (isset($this->attrs['objectClass']) &&in_array("gosaAccount",$this->attrs['objectClass']))){
-        new log("view","users/".get_class($this),$this->dn);
-      }else{
-        new log("view","groups/".get_class($this),$this->dn);
-      }
-    }
-
-    /* Are we editing from MyAccount and not editing a user */
-    $WriteOnly = (!isset($this->parent)|| !$this->parent) && !isset($_SESSION['edit']);
-
-    /* Check profile server */
-    if($this->acl_is_writeable("gotoProfileServer",$WriteOnly)){
-      if(!empty($this->gotoProfileServer) && !isset($this->gotoProfileServers[$this->gotoProfileServer])){
-        if(count($this->gotoProfileServers)){
-
-          /* Get First Profile */
-          $new = key($this->gotoProfileServers);
-
-          /* Another profile server found */
-          print_red(sprintf(_("Your selected profile server '%s' is no longer available. Setting profile server to '%s'."),
-                $this->gotoProfileServer,$new));
-        }else{
-
-          /* No other profile servers found */
-          print_red(sprintf(_("Your selected profile server '%s' is no longer available. Profile server configuration is resetted."),
-                $this->gotoProfileServer));
-          $this->gotoProfileServer = "";
-        }
-      }
-    }    
-
-    $this->detect_grouptype();
-
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-    $smarty->assign("kiosk_enabled",$this->kiosk_enabled);
-    $display= "";
-
-    $smarty->assign("is_group",$this->is_group);
-
-    /* Prepare all variables for smarty */
-    foreach($this->attributes as $s_attr){
-      /* Set value*/
-      $smarty->assign($s_attr,$this->$s_attr);
-
-      /* Set checkbox state*/
-      if(empty($this->$s_attr)){
-        $smarty->assign($s_attr."CHK","");
-      }else{
-        $smarty->assign($s_attr."CHK"," checked ");
-      }
-
-      /* Prepare ACL settings*/
-      $smarty->assign($s_attr."ACL",$this->getacl($s_attr,$WriteOnly));
-    }
-
-    /* Is accout enabled | are we editing from usermenu or admin menu 
-       All these tab management is done here
-     */
-
-
-    /* Working from Usermenu an the Account is currently disbled
-     * this->parent :  is only set if we are working in a list of tabs
-     * is_account   :  is only true if the needed objectClass is given
-     */
-    if((!isset($this->parent))&&(!$this->is_account)){
-      /* We are currently editing this tab from usermenu, but this account is not enabled */
-      $smarty->assign("is_account",$this->is_account);
-      /* Load template */
-      $display .= $smarty->fetch(get_template_path('environment.tpl', TRUE));
-      /* Avoid the "You are currently editing ...." message when you leave this tab */
-      $display .= back_to_main(); 
-      /* Display our message to the user */
-      return $display;
-
-
-      /* We are currently editing from group tabs, because 
-       * $this->parent is set
-       * posixAccount is not set, so we are not in usertabs.
-       */
-    }elseif((isset($this->parent))&&(!isset($this->parent->by_object['posixAccount']))){
-      $smarty->assign("is_account","true");
-      $this->uid          = $this->cn;
-      $this->attrs['uid'] = $this->cn;
-
-      /* Change state if needed */
-      if (isset($_POST['modify_state'])){
-        if(($this->acl_is_createable() && !$this->is_account) || 
-            ($this->acl_is_removeable() &&  $this->is_account)){
-          $this->is_account= !$this->is_account;
-        }
-      }
-      /* Group Dialog with enabled environment options */
-      if ($this->is_account){
-        $display= $this->show_enable_header(_("Remove environment extension"),
-            _("Environment extension enabled. You can disable it by clicking below."));
-      } else {
-
-        /* Environment is disabled 
-           If theres is no posixAccount enabled, you won't be able to enable 
-           environment extensions
-         */
-        if((isset($this->parent->by_object['group']))||(isset($this->attrs['objectClass']))&&((in_array("posixAccount",$this->attrs['objectClass'])))){
-          // 4. There is a PosixAccount
-          $display= $this->show_enable_header(_("Add environment extension"),
-              _("Environment extension disabled. You can enable it by clicking below."));
-          return $display;
-        }else{
-          // 4. There is no PosixAccount
-          $display= $this->show_enable_header(_("Add environment extension"),
-              _("Environment extension disabled. You have to setup a posix account before you can enable this feature."));
-          return $display;
-        }
-      }
-    }else{
-      /* Editing from Usermenu 
-       *  Tell smarty that this accoutn is enabled 
-       */
-      $smarty->assign("is_account","true");
-
-      /* Change state if needed */
-      if (isset($_POST['modify_state'])){
-        if(($this->acl_is_createable() && !$this->is_account) || 
-            ($this->acl_is_removeable() &&  $this->is_account)){
-          $this->is_account= !$this->is_account;
-        }
-      }
-
-      if(isset($this->parent)){
-
-        // 3. Account enabled . Editing from adminmenu
-        if ($this->is_account){
-          $display= $this->show_disable_header(_("Remove environment extension"),
-              _("Environment extension enabled. You can disable it by clicking below."));
-        } else {
-
-          if($this->parent->by_object['posixAccount']->is_account==true){
-            // 4. There is a PosixAccount
-            $display= $this->show_disable_header(_("Add environment extension"),
-                _("Environment extension disabled. You can enable it by clicking below."));
-            return $display;
-          }else{
-            // 4. There is a PosixAccount
-            $display= $this->show_disable_header(_("Add environment extension"),
-                _("Environment extension disabled. You have to setup a posix account before you can enable this feature."),TRUE,TRUE);
-            return $display;
-          }
-        }
-      }
-    }
-    /* Account is Account : is_accounbt=true.
-     * Else we won't reach this. 
-     */
-
-    /* Prepare all variables for smarty */
-    foreach($this->attributes as $s_attr){
-      /* Set value*/
-      $smarty->assign($s_attr,$this->$s_attr);
-
-      /* Set checkbox state*/
-      if(empty($this->$s_attr)){
-        $smarty->assign($s_attr."CHK","");
-      }else{
-        $smarty->assign($s_attr."CHK"," checked ");
-      }
-
-      /* Prepare ACL settings*/
-      $smarty->assign($s_attr."ACL",$this->getacl($s_attr,$WriteOnly));
-    }
-
-    foreach(array("gotoHotplugDevice","gotoProfileFlagC","gotoProfileFlagL") as $s_attr){
-      $smarty->assign($s_attr."ACL",$this->getacl($s_attr,$WriteOnly));
-    }
-
-    if($WriteOnly) {
-      $smarty->assign("gotoPrinterACL","r");
-    }else{
-      $smarty->assign("gotoPrinterACL","rw");
-    }
-
-    if(empty($this->useProfile)){
-      $smarty->assign("useProfileCHK","");
-      $smarty->assign("gotoProfileServerACL" , preg_replace("/w/","",$this->getacl("gotoProfileServer",$WriteOnly)));
-      $smarty->assign("gotoProfileQuotaACL" , preg_replace("/w/","",$this->getacl("gotoProfileQuota",$WriteOnly)));
-      $smarty->assign("gotoProfileFlagCACL" , preg_replace("/w/","",$this->getacl("gotoProfileFlagC",$WriteOnly)));
-    }else{
-      $smarty->assign("useProfileCHK"," checked ");
-    }
-    
-    $smarty->assign("gotoProfileServerWriteable", $this->acl_is_writeable("gotoProfileServer",$WriteOnly));
-    $smarty->assign("gotoProfileACL", $this->getacl("gotoProfileServer",$WriteOnly).$this->getacl("gotoProfileQuota",$WriteOnly));
-
-    /* HANDLE Profile Settings here 
-     * Assign available Quota and resolution settings
-     * Get all available profile server
-     * Get cache checkbox
-     * Assign this all to Smarty 
-     */
-
-    if(empty($this->gotoProfileFlagL)){
-      $smarty->assign("gotoProfileFlagLCHK"," ");
-    }else{
-      $smarty->assign("gotoProfileFlagLCHK"," checked ");
-    }
-
-    if(empty($this->gotoProfileFlagC)){
-      $smarty->assign("gotoProfileFlagCCHK"," ");
-    }else{
-      $smarty->assign("gotoProfileFlagCCHK"," checked ");
-    }
-
-
-    $smarty->assign("gotoXResolutions"    , $this->gotoXResolutions);
-    $smarty->assign("gotoXResolutionKeys" , array_flip($this->gotoXResolutions));
-
-    $smarty->assign("gotoProfileServers",$this->gotoProfileServers);
-    if(!is_array($this->gotoProfileServers)){
-      $this->gotoProfileServers =array();
-    }
-    $smarty->assign("gotoProfileServerKeys",array_flip($this->gotoProfileServers));
-
-    /* Handle kiosk profiles*/
-    $smarty->assign("kiosk_servers" , $this->gotoKioskProfiles['SERVERS']);
-    $smarty->assign("kiosk_server" ,  $this->gotoKioskProfile_Server);
-    $smarty->assign("kiosk_profiles" , $this->gotoKioskProfiles['BY_SERVER'][$this->gotoKioskProfile_Server]);
-    $smarty->assign("kiosk_profile" ,  $this->gotoKioskProfile_Profile);
-  
-
-    /* Logonscript Management
-     * Get available LogonScripts (possibly grey out (or mark) these script that are defined for the group) 
-     * Perform add Delete edit Posts 
-     */
-
-    /* Dialog Save */
-    if(isset($_POST['LogonSave'])){
-
-      if(!$this->acl_is_writeable("gotoLogonScript")){
-        print_red(_("You are not allowed to write Logon scripts."));
-        unset($this->dialog);
-        $this->dialog=FALSE;
-        $this->is_dialog=false;
-      }else{
-        $this->dialog->save_object();
-        if(count($this->dialog->check())!=0){
-          foreach($this->dialog->check() as $msg){
-            print_red($msg);
-          }
-        }else{
-          $tmp = $this->dialog->save();
-          unset($this->dialog);
-          $this->dialog=FALSE;
-          $this->is_dialog=false;
-          $this->gotoLogonScripts[$tmp['LogonName']]=$tmp; 
-        }
-      }
-    }
-    
-
-    /* Dialog Quit without saving */
-    if(isset($_POST['LogonCancel'])){
-      $this->is_dialog= false;
-      unset($this->dialog);
-      $this->dialog= FALSE;
-    }
-
-    /* Check Edit Del New Posts for a selected LogonScript */ 
-    if($this->acl_is_writeable("gotoLogonScript") && 
-        (isset($_POST['gotoLogonScriptNew'])) || isset($_POST['gotoLogonScriptEdit']) ||isset($_POST['gotoLogonScriptDel'])){
-
-      /* New Logon Script: Open an edit dialog, we don't need a $_POST['gotoLogonScript'] here.
-       * In this case we create a new Logon Script.
-       */
-      if(isset($_POST['gotoLogonScriptNew'])){
-        $this->is_dialog = true;
-        $this->dialog = new logonManagementDialog($this->config,$this->dn);
-      }
-
-      /* If we receive a Delete request and there is a Script selected in the selectbox, delete this one.
-       * We only can delete if there is an entry selected.
-       */
-      if((isset($_POST['gotoLogonScriptDel']))&&(isset($_POST['gotoLogonScript']))){
-        unset($this->gotoLogonScripts[$_POST['gotoLogonScript']]);
-      }
-
-      /* In this case we want to edit an existing entry, we open a new Dialog to allow editing.
-       * There must be an entry selected to perform edit request.
-       */
-      if((isset($_POST['gotoLogonScriptEdit']))&&(isset($_POST['gotoLogonScript']))){
-        $is_entry = $this->gotoLogonScripts[$_POST['gotoLogonScript']];
-        $this->is_dialog = true;
-        $this->dialog = new logonManagementDialog($this->config,$this->dn,$is_entry);
-      }
-    }
-
-    /* Append List to smarty*/
-    $ls = $this->printOutLogonScripts();
-    $smarty->assign("gotoLogonScripts",  $ls);
-    $smarty->assign("gotoLogonScriptKeys",array_flip($ls));
-    $smarty->assign("gotoLogonScriptKeysCnt",count($ls));
-
-    /* In this section server shares will be defined 
-     * A user can select one of the given shares and a mount point
-     *  and attach this combination to his setup.
-     */
-
-    $smarty->assign("gotoShareSelections",    $this->gotoShareSelections);
-    if(!is_array($this->gotoShareSelections)){
-      print $this->gotoShareSelections;
-      $this->gotoShareSelections = array();
-    }
-    $smarty->assign("gotoShareSelectionKeys", array_flip($this->gotoShareSelections));
-
-    /* if $_POST['gotoShareAdd'] is set, we will try to add a new entry 
-     * This entry will be, a combination of mountPoint and sharedefinitions 
-     */
-    if(isset($_POST['gotoShareAdd']) && $this->acl_is_writeable("gotoShare")){
-
-      /* We assign a share to this user, if we don't know where to mount the share */
-      if(!isset($_POST['gotoShareSelection']) || get_post('gotoShareSelection') == ""){
-        print_red(_("You must select a valid share."));
-      }elseif((!isset($_POST['gotoShareMountPoint']))||(empty($_POST['gotoShareMountPoint']))||(preg_match("/[\|]/i",$_POST['gotoShareMountPoint']))){
-        print_red(_("You must specify a valid mount point."));
-      }elseif(preg_match('/ /', $_POST['gotoShareMountPoint'])){
-        print_red(_("Spaces are not allowed in the mount path!"));
-      }elseif(!(
-            preg_match("/^\//",$_POST['gotoShareMountPoint'])  ||
-            preg_match("/^~/",$_POST['gotoShareMountPoint']) ||
-            preg_match("/^\$HOME/",$_POST['gotoShareMountPoint']) ||
-            preg_match("/^.HOME/",$_POST['gotoShareMountPoint']) ||
-            preg_match("/^\$USER/",$_POST['gotoShareMountPoint']) ||
-            preg_match("/^.USER/",$_POST['gotoShareMountPoint']) ||
-            preg_match("/^%/",$_POST['gotoShareMountPoint'])
-            )
-          ){
-        print_red(_("You must specify a valid mount point.")); 
-      }else{
-        $a_share = $this->gotoAvailableShares[$_POST['gotoShareSelection']];
-        $s_mount = $_POST['gotoShareMountPoint'];
-        $s_user  = $_POST['ShareUser'];
-        /* Preparing the new assignment */ 
-        $this->gotoShares[$a_share['name']."|".$a_share['server']]=$a_share;
-        $this->gotoShares[$a_share['name']."|".$a_share['server']]['Username']=$s_user;
-        $this->gotoShares[$a_share['name']."|".$a_share['server']]['PwdHash']="";
-        $this->gotoShares[$a_share['name']."|".$a_share['server']]['mountPoint']=$s_mount;
-      }
-    }  
-
-    /* if the Post  gotoShareDel is set, someone asked GOsa to delete the selected entry (if there is one selected)
-     * If there is no defined share selected, we will abort the deletion without any message 
-     */
-    $once = true;
-    if($this->acl_is_writeable("gotoShare")){
-      foreach($_POST as $name => $value){
-        if((preg_match("/^gotoShareDel_/",$name)) && ($once)){
-          $once = false;  
-          $key  = preg_replace("/^gotoShareDel_/","",$name);
-          $key  = preg_replace("/_+[xy]$/","",$key);
-          $key  = base64_decode($key);
-          if(isset($this->gotoShares[$key])) {
-            unset($this->gotoShares[$key]);
-          }
-
-          /* Remove corresponding password entry, too. This is a workaround
-             to get rid of old-style entries. */
-          $key= preg_replace("/\|/", "|!", $key);
-          if(isset($this->gotoShares[$key])) {
-            unset($this->gotoShares[$key]);
-          }
-        }
-        if((preg_match("/^gotoShareResetPwd_/",$name)) && ($once)){
-          $once = false;
-          $key  = preg_replace("/^gotoShareResetPwd_/","",$name);
-          $key  = preg_replace("/_+[xy]$/","",$key);
-          $key  = base64_decode($key);
-          $this->gotoShares[$key]['PwdHash'] = "";
-          if(preg_match("/^!/",$this->gotoShares[$key]['server'])){
-            unset($this->gotoShares[$key]);
-          }
-        }
-      }
-    }
-    $divlistShares = new divSelectBox("gotoShares");
-    $divlistShares->SetHeight(100);
-
-
-    $tmp = array();
-    if($this->acl_is_readable("gotoShares")){
-      $tmp = $this->printOutAssignedShares();
-    }
-
-    
-    foreach($tmp as $key => $value){
-      $img = "";
-
-      /* Skip apssword only entries */
-      if( empty($this->gotoShares[$key]['server']) && 
-          empty($this->gotoShares[$key]['name']) &&
-          empty($this->gotoShares[$key]['mountPoint']) &&
-          empty($this->gotoShares[$key]['Username'])){
-        continue;
-      } 
-
-      /* Check if entry starts with an ! */
-      if(preg_match("/^!/",$this->gotoShares[$key]['server'])){
-
-        /* If we are currently editing groups environment, skip those ! entries */ 
-        if($this->is_group) continue;
-
-        /* Create pwd reset images */
-        if($this->gotoShares[$key]['PwdHash'] != ""){
-          $img.= "<input type='image' name='gotoShareResetPwd_".base64_encode($key)." 'src='images/list_reset_password.png' alt='"._("Reset password hash")."' 
-            title='"._("Reset password hash")."'>";
-        }
-        $field1 = array("string" => "<font style=\"color:#C0C0C0\">".$value."</font>" );
-        $field2 = array("string" => $img   , "attach" => "style='border-right:0px;'");
-      }else{
-
-        /* Create pwd reset img && delete image */
-        if($this->gotoShares[$key]['PwdHash'] != ""){
-          $img.= "<input type='image' name='gotoShareResetPwd_".base64_encode($key)." 'src='images/list_reset_password.png' alt='"._("Reset password hash")."' 
-            title='"._("Reset password hash")."'>";
-          $img.= "&nbsp;";
-        }
-        $img.= "<input type='image' name='gotoShareDel_".base64_encode($key)." 'src='images/edittrash.png' alt='"._("Delete")."' 
-          title='"._("Delete share entry")."'>";
-        $field1 = array("string" => $value);
-        $field2 = array("string" => $img   , "attach" => "style='border-right:0px;'");
-      }
-      $divlistShares->AddEntry(array($field1,$field2));
-    }
-    $smarty->assign("divlistShares",$divlistShares->DrawList());
-
-    /* Hotplug devices will be handled here 
-     * There are 3 possible methods for this feature
-     * Create a new Hotplug, A Dialog will open where you can specify some hotplug information
-     * Delete will erase an entry, the entry must be selcted in the ListBox first
-     * Editing an entry will open a dialog where the informations about the selcted entry can be changed
-     */
-
-    /* We have to delete the selected hotplug from the list*/
-    if((isset($_POST['gotoHotplugDeviceDel']))&&(isset($_POST['gotoHotplugDevice_post'])) && $this->acl_is_writeable("gotoHotplugDevice")){
-      if($this->acl_is_writeable("gotoHotplugDevice")){
-        foreach($_POST['gotoHotplugDevice_post'] as $name){
-          unset($this->gotoHotplugDevices[$name]);
-        }
-      }
-    }
-
-    /* There are already defined hotplugs from other users we could use */
-    if(isset($_POST['gotoHotplugDeviceUse']) && $this->acl_is_writeable("gotoHotplugDevice")){
-      $tmp  =array();
-      foreach($this->gotoHotplugDevices as $plugs){
-        $tmp[] = $plugs['name'];
-      }
-      $this->dialog = new hotplugDialog($this->config,$tmp);
-      $this->is_dialog = true;
-    }
-
-    /* Dialog Aborted */
-    if(isset($_POST['HotPlugCancel'])){
-      unset($this->dialog);
-      $this->dialog= FALSE;
-      $this->is_dialog = false;
-    }
-
-    /* Dialod saved */
-    if(isset($_POST['HotPlugSave'])){
-
-      $this->dialog->save_object();
-      if(count($this->dialog->check())!=0){
-        foreach($this->dialog->check() as $msg){
-          print_red($msg);
-        }
-      }else{
-        $this->dialog->save_object();
-        $a_tmp = $this->dialog->save();
-
-        if(is_array($a_tmp)){
-          foreach($a_tmp as $name => $hotplug){
-            $this->gotoHotplugDevices[$name]= $hotplug; 
-          }
-        }
-        unset($this->dialog);
-        $this->dialog= FALSE;
-        $this->is_dialog = false;
-      }
-    }
-    $smarty->assign("gotoHotplugDevices",$this->printOutHotPlugDevices());
-    $smarty->assign("gotoHotplugDeviceKeys",array_flip($this->printOutHotPlugDevices()));
-
-    /* Printer Assignment will managed below 
-     * A printer can be assigned in two different ways and two different types
-     * There are 2 types of users assigned to a printer : user and admin
-     * They only differ in the member attribute they will be assigned to. user: gotoUserPrinter admin: gotoadminPrinter
-     * The different types of assigning a user are : 1 assigning a user to a printer 2. assigning a group to a printer
-     */ 
-
-    /* First handle Add Post. Open a dialog that allows us to select a printer or two */ 
-    if(isset($_POST['gotoPrinterAdd'])){
-
-      $this->is_dialog=true;
-      $this->dialog = new selectPrinterDialog($this->config,$this->dn,$this->gotoPrinter);
-    }
-
-    if(isset($_POST['PrinterCancel'])){
-      $this->is_dialog=false;
-      unset($this->dialog);
-      $this->dialog=FALSE;
-    }
-
-    if(isset($_POST['PrinterSave'])){
-      if(count($this->dialog->check())!=0){
-        $tmp = $this->dialog->check();
-        foreach($tmp as $msg){
-          print_red($msg);
-        } 
-      }else{
-        $this->dialog->save_object();
-        $tmp = $this->dialog->save();
-        $tmp2= $this->dialog->getPrinter(true);
-
-        foreach($tmp as $pname){
-          $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$tmp2[$pname]['dn'],"printer");
-          $printerObj->set_acl_base($tmp2[$pname]['dn']);
-
-          $type = false;
-
-          if($this->is_group){
-            if($this->dn == "new"){  
-              $type = "AddGroup";
-            }elseif(isset($this->NewDeletedPrinters[$pname])){
-              $type = "AddGroup";
-            }elseif($printerObj->by_object['printgeneric']->AddMember("AddGroup",$this->dn)){
-              $type = "AddGroup";
-            }
-          }else{
-            if(isset($this->NewDeletedPrinters[$pname])){
-              $type = "AddUser";
-            }elseif($printerObj->by_object['printgeneric']->AddMember("AddUser",$this->dn)){
-              $type = "AddUser";
-            }
-          }
-
-          if($type){
-            $this->gotoPrinter[$pname]=$tmp2[$pname];
-            $this->gotoPrinter[$pname]['mode']="user";
-            $this->add_del_printer_member_was_called = true;
-
-            $this->NewAddedPrinters[$pname] = $pname;
-            if(isset($this->NewDeletedPrinters[$pname])){
-              unset($this->NewDeletedPrinters[$pname]);
-            }
-          }
-        }
-
-        $this->is_dialog=false;
-        unset($this->dialog);
-        $this->dialog   =FALSE;
-      }
-    }
-
-    if((isset($_POST['gotoPrinterDel']))&&(isset($_POST['gotoPrinterSel']))&&(!empty($_POST['gotoPrinterSel']))){
-      $printer = $_POST['gotoPrinterSel'];
-      foreach($printer as $pname){
-
-        $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$this->gotoPrinter[$pname]['dn'],"printer");
-        $printerObj->set_acl_base($this->gotoPrinter[$pname]['dn']);
-
-        $type = false;
-        if($this->is_group){
-          if(isset($this->NewAddedPrinters[$pname])){
-            $type = "Group";
-          }elseif($printerObj->by_object['printgeneric']->DelMember("AddGroup",$this->cn)){
-            $type = "Group";
-          }
-        }else{
-          if(isset($this->NewAddedPrinters[$pname])){
-            $type = "User";
-          }elseif($printerObj->by_object['printgeneric']->DelMember("AddUser",$this->uid)){
-            $type = "User";
-          }
-        }
-        if($type){
-          $this->add_del_printer_member_was_called = true;
-          unset($this->gotoPrinter[$pname]);
-
-          $this->NewDeletedPrinters[$pname] = $pname;
-          if(isset($this->NewAddedPrinters[$pname])){
-            UNSET($this->NewAddedPrinters[$pname]);
-          }
-        }
-      }
-    }
-
-    if((isset($_POST['gotoPrinterEdit']))&&(isset($_POST['gotoPrinterSel']))&&(!empty($_POST['gotoPrinterSel']))){
-      $printers = $_POST['gotoPrinterSel'];
-      $this->add_del_printer_member_was_called = true;
-      foreach($printers as $printer){
-        if($this->gotoPrinter[$printer]['mode']=="user"){
-          $this->gotoPrinter[$printer]['mode']="admin";
-        }else{
-          $this->gotoPrinter[$printer]['mode']="user";
-        }
-      }
-    }
-
-    if((isset($_POST['gotoPrinterDefault']))&&(isset($_POST['gotoPrinterSel']))&&(!empty($_POST['gotoPrinterSel']))){
-      if($this->is_group){
-        print_red(_("GOsa default printer flag is not allowed within groups."));
-      }else{
-        if ($this->gosaDefaultPrinter == $_POST['gotoPrinterSel'][0]){
-          $this->gosaDefaultPrinter= "";
-        } else {
-          $this->gosaDefaultPrinter= $_POST['gotoPrinterSel'][0];
-        }
-      }
-    }
-
-    $smarty->assign("gotoPrinter",$this->printOutPrinterDevices());
-    $smarty->assign("gotoPrinterKeys",array_flip($this->printOutPrinterDevices()));
-
-    /* General behavior */
-    if(is_object($this->dialog)){
-      $this->dialog->save_object();
-      $disp =$this->dialog->execute();
-      return($disp);
-    }
-
-    /* Als smarty vars are set. Get smarty template and generate output */
-    $display.= $smarty->fetch(get_template_path('environment.tpl', TRUE,dirname(__FILE__)));
-    return($display);
-  }
-
-  function remove_from_parent()
-  {
-    /* only if it was an account*/
-    if (!$this->initially_was_account){
-      return;
-    }
-
-    /* include global link_info */
-    $ldap= $this->config->get_ldap_link();
-
-    /* Remove and write to LDAP */
-    plugin::remove_from_parent();
-
-    /* Don't save our template variables */
-    $skip = array("uid","gotoLogonScripts","gotoPrinter","gotoShares","gotoHotplugDevices" );
-
-    /* Skip all these attributes */
-    foreach($skip as $del){
-      unset($this->attrs[$del]);
-    }
-
-    @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,$this->attributes, "Save");
-
-    $ldap->cd($this->dn);
-    $this->cleanup();
-    $ldap->modify ($this->attrs); 
-
-    if($this->is_group){
-      new log("remove","groups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }else{
-      new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }
-
-    show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/environment account with dn '%s' failed."),$this->dn));
-
-    /* Optionally execute a command after we're done */
-    $this->handle_post_events("remove",array("uid" => $this->uid));
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    /* Get all Posted vars 
-     * Setup checkboxes 
-     */
-    $WriteOnly = (!isset($this->parent)|| !$this->parent) && !isset($_SESSION['edit']);
-    if(isset($_POST['iamposted'])){
-
-      $PACL =  $this->getacl("gotoProfileServer",$WriteOnly).$this->getacl("gotoProfileQuota",$WriteOnly);
-
-      if(isset($_POST['kiosk_server'])){
-        $tmp = $_POST['kiosk_server'];
-        if(isset($this->gotoKioskProfiles['SERVERS'][$tmp])){
-          $this->gotoKioskProfile_Server = $_POST['kiosk_server'];
-        }
-      }
-      if(isset($_POST['kiosk_profile'])){
-        $tmp = $_POST['kiosk_profile'];
-        if(in_array($tmp,$this->gotoKioskProfiles['BY_SERVER'][$this->gotoKioskProfile_Server])){
-          $this->gotoKioskProfile_Profile = $_POST['kiosk_profile'];
-        }
-      }
-
-      if(preg_match("/w/",$PACL)){
-        if(isset($_POST['useProfile'])){
-          $this->useProfile = true;
-        }else{
-          $this->useProfile = false;
-        }
-      }
-
-      if($this->acl_is_writeable("gotoProfileFlagC")){
-        if(isset($_POST['gotoProfileFlagC'])){
-          $this->gotoProfileFlagC = $_POST['gotoProfileFlagC'];
-        }else{
-          $this->gotoProfileFlagC = false;
-        }
-      }
-
-      if($this->acl_is_writeable("gotoProfileFlagL")){
-        if(isset($_POST['gotoProfileFlagL'])){
-          $this->gotoProfileFlagL = $_POST['gotoProfileFlagL'];
-        }else{
-          $this->gotoProfileFlagL = false;
-        }
-      }
-
-      plugin::save_object();
-      foreach($this->attributes as $s_attr){
-        if((!isset($_POST[$s_attr])) || 
-            in_array($s_attr,array("gosaDefaultPrinter","gotoShares","gotoHotplugDevices","gotoPrinter","gotoLogonScripts","uid"))) continue;
-        if(!$this->acl_is_writeable($s_attr)){
-          continue;
-        }else{ 
-          if(isset($_POST[$s_attr])){
-            $this->$s_attr = $_POST[$s_attr];
-          }else{
-            $this->$s_attr = false;
-          }
-        }
-      }
-    }
-  }
-
-
-  /* Check supplied data */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    $this->detect_grouptype();
-
-    if(preg_match("/[^0-9]/",$this->gotoProfileQuota)) {
-      $message[]=_("Please set a valid profile quota size.");
-    } 
-    if(!isset($this->attrs['objectClass'])){
-      $this->attrs['objectClass']=array();
-    } 
-    if(!$this->is_group){
-      if((!((in_array("posixAccount",$this->attrs['objectClass']))||($this->parent->by_object['posixAccount']->is_account==true)))&&(!$this->is_group)){
-        $message[]=(_("You need to setup a valid posix extension in order to enable evironment features."));  
-      }
-    }
-    return ($message);
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    /* If group was renamed, all printer settings get lost
-     */ 
-    /* only save changed variables ....*/
-    if ($this->gotoKioskProfile_Server != "none"){
-      if(preg_match("/https/i",$_SERVER['HTTP_REFERER'])){
-        $method="https://".$this->gotoKioskProfile_Server."/kiosk/".$this->gotoKioskProfile_Profile;
-      }else{
-        $method="http://".$this->gotoKioskProfile_Server."/kiosk/".$this->gotoKioskProfile_Profile;
-      }
-      $this->gotoKioskProfile= $method;
-    }else{
-      $this->gotoKioskProfile= array();
-    }
-
-    plugin::save();
-    $ldap= $this->config->get_ldap_link();
-
-    $realyUsedAttrs= array();
-
-    /* Save already used objectClasses */
-    $ocs        = $this->attrs['objectClass'];
-    unset($ocs['count']);
-    $this->attrs = array();
-    $this->attrs['objectClass']= gosa_array_merge($ocs,$this->objectclasses);
-
-    /* 1. Search all printers that have our uid/cn as member 
-     * 2. Delete this uid/cn from every single entry and save it again.
-     * 2.1 There are different types of members: Users / Groups, this will be defined in $suffix
-     * 2.2 And each type has two modes, Admin (e.g. 'gotoUserAdminPrinter') and Normal 
-     */
-    
-    $this->detect_grouptype();
-
-    if($this->add_del_printer_member_was_called){
-
-      $types = array( "gotoUserPrinter"       => "AddUser",
-          "gotoGroupPrinter"      => "AddGroup",
-          "gotoUserAdminPrinter"  => "AddAdminUser",
-          "gotoGroupAdminPrinter" => "AddAdminGroup");
-
-      if($this->is_group){
-        $s_suffix = "Group";
-        $useVar   = "cn";
-      }else{
-        $useVar   = "uid";
-        $s_suffix = "User";
-      }
-
-      /* Remove old entries */
-      $ldap->search("(&(objectClass=gotoPrinter)(goto".$s_suffix."Printer=".$this->$useVar."))",array("*"));
-      while($attr = $ldap->fetch()){
-        $printerObj = NULL;
-        $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$attr['dn'],"printer");
-        $printerObj->set_acl_base($attr['dn']);
-        $printerObj->by_object['printgeneric']->DelMember($types["goto".$s_suffix."Printer"],$this->$useVar);
-        $printerObj->by_object['printgeneric']->save();
-      }
-
-      $ldap->search("(&(objectClass=gotoPrinter)(goto".$s_suffix."AdminPrinter=".$this->$useVar."))",array("*"));
-      while($attr = $ldap->fetch()){
-        $printerObj = NULL;
-        $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$attr['dn'],"printer");
-        $printerObj->set_acl_base($attr['dn']);
-        $printerObj->by_object['printgeneric']->DelMember($types["goto".$s_suffix."AdminPrinter"],$this->$useVar);
-        $printerObj->by_object['printgeneric']->save();
-      }
-
-      foreach($this->gotoPrinter as $printer){
-        $printerObj = NULL;
-        $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$printer['dn'],"printer");
-        $printerObj->set_acl_base($printer['dn']);
-
-
-        if($printer['mode'] == "admin") {
-          $attribute = "goto".$s_suffix."AdminPrinter";
-        }else{
-          $attribute = "goto".$s_suffix."Printer";
-        }
-
-        $printerObj->by_object['printgeneric']->AddMember($types[$attribute],$this->dn);
-        $printerObj->by_object['printgeneric']->save();
-      }
-    }    
-
-    /* Prepare HotPlug devices */
-    $this->attrs['gotoHotplugDeviceDN'] = array();
-    foreach($this->gotoHotplugDevices as $name => $device){
-      $this->attrs['gotoHotplugDeviceDN'][]= $device['dn'];
-    }
-
-    /* Prepare LogonScripts */
-    $this->attrs['gotoLogonScript'] = array();
-    foreach($this->gotoLogonScripts as $name => $script){
-      $this->attrs['gotoLogonScript'][] =   $script['LogonName']."|".
-        $script['LogonOverload'].$script['LogonLast']."|".
-        $script['LogonPriority']."|".
-        base64_encode($script['LogonData'])."|".
-        $script['LogonDescription'];
-    }
-
-    /* Prepare Shares */
-    $this->attrs['gotoShare']=array();
-    foreach($this->gotoShares as $name => $share){
-      $mntp= $share['mountPoint'];
-      if (!preg_match('=^[a-z0-9+\._/%-]+$=i', $mntp)){
-        $mntp= base64_encode($mntp);
-      }
-      $this->attrs['gotoShare'][] =$share['server']."|".$share['name']."|".$mntp."|".$share['PwdHash']."|".$share['Username'];
-    }
-
-
-    if($this->gotoXResolution == "auto") $this->gotoXResolution ="";
-    $saveThis = array("gotoProfileQuota","gotoXResolution","gotoProfileServer","gotoKioskProfile","gosaDefaultPrinter");
-
-    foreach($saveThis as $tosave){
-      if(!empty($this->$tosave)){
-        $this->attrs[$tosave]=$this->$tosave;
-      }else{
-        $this->attrs[$tosave]=array();
-      }
-    }
-
-    /* Prepare Flags */
-    $this->attrs['gotoProfileFlags'] = array($this->gotoProfileFlagC.$this->gotoProfileFlagL);
-    if(empty($this->attrs['gotoProfileFlags'][0])){
-      $this->attrs['gotoProfileFlags']=array();
-    }
-
-    if($this->useProfile == false){
-      $this->attrs['gotoProfileFlags'] = preg_replace("/C/i","",$this->attrs['gotoProfileFlags']);
-      $this->attrs['gotoProfileServer']= array(); 
-    }
-
-    $ldap->cat ($this->dn, array('dn'));
-    if ($ldap->fetch()){
-      $mode= "modify";
-    } else {
-      $mode= "add";
-      $ldap->cd($this->config->current['BASE']);
-      $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
-    }
-
-    $ldap->cd($this->dn);
-    $this->cleanup();
-    $ldap->$mode($this->attrs);
-  
-    $cat = "users";
-    if($this->is_group){
-      $cat = "groups";
-    }
-
-    /* Log last action */ 
-    if($this->initially_was_account){
-      new log("modify",$cat."/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }else{
-      new log("create",$cat."/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }
-
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/environment account with dn '%s' failed."),$this->dn));
-    $this->handle_post_events($mode,array("uid"=>$this->uid));
-  }
-
-  /* Generate ListBox frindly output for the defined shares 
-   * Possibly Add or remove an attribute here, 
-   */
-  function printOutAssignedShares()
-  {
-    $a_return = array();
-    if(is_array($this->gotoShares)){
-      foreach($this->gotoShares as $share){
-        if(preg_match("/^!/",$share['server'])){
-          $a_return[$share['name']."|".$share['server']]= preg_replace("/^!/","",$share['server'])."://".$share['name']." - "._("group share"); 
-        }else{
-          $a_return[$share['name']."|".$share['server']]= $share['server']."://".$share['name']." on ".$share['mountPoint']." as ".$share['Username'];
-        }
-      }
-      natcasesort($a_return);
-    }
-    return($a_return);
-  }
-
-  /* Generate ListBox frindly output for the definedhotplugs 
-   * Possibly Add or remove an attribute here,
-   */
-  function printOutHotPlugDevices()
-  {
-    $a_return= array();
-    if(is_array($this->gotoHotplugDevices)){
-      foreach($this->gotoHotplugDevices as $key=>$device){
-        $a_return[$key] = $device['name']." - ".$device['id'];
-      }
-    }
-    return($a_return);
-  }
-
-  /* Generates ListBox frienly output of used printer devices 
-   * Append ' - admin' if printer is used in admin mode
-   */
-  function printOutPrinterDevices()
-  {
-    $a_return = array();
-    
-    if($this->acl_is_readable("gotoPrinter")){
-
-      if(is_array($this->gotoPrinter)){
-        foreach($this->gotoPrinter as $printer){
-          if($printer['mode'] == "admin"){
-            $a_return[$printer['cn'][0]]= $printer['cn'][0]." - "._("Administrator");
-          }else{
-            $a_return[$printer['cn'][0]]= $printer['cn'][0]; 
-          }
-          if ($printer['cn'][0] == $this->gosaDefaultPrinter){
-            $a_return[$printer['cn'][0]].=" - "._("Default printer");
-          }
-        }
-      }
-    }
-    return($a_return);
-  }
-
-
-  function PrepareForCopyPaste($source)
-  {
-    plugin::PrepareForCopyPaste($source);
-
-    $class= get_class($this);
-    $o_source = new $class($this->config,$source['dn']);
-    foreach($this->CopyPasteVars as $attr){
-      $this->$attr = $o_source->$attr;  
-    }
-  }
-
-
-  function saveCopyDialog()
-  {
-    if(isset($_POST['cn'])){
-      $this->cn = $_POST['cn'];
-      $this->uid = $_POST['cn'];
-    }
-  }
-
-
-  /* Generates ListBox frienly output of used logonscripts 
-   */
-  function printOutLogonScripts()
-  {
-    $a_return = array();
-    if(is_array($this->gotoLogonScripts)){
-      foreach($this->gotoLogonScripts as $script){
-        $a_return[$script['LogonName']]= $script['LogonPriority']." - ".$script['LogonName']; 
-      }
-    }
-    return($a_return);
-  }
-
-
-  /* Return plugin informations for acl handling 
-#FIXME these ACLs should work for groups too */ 
-  static function plInfo()
-  {
-    return (array("plShortName"     => _("Environment"),
-          "plDescription"   => _("Environment settings"),         // Description
-          "plSelfModify"    => TRUE,                              
-          "plDepends"       => array("user", "posixAccount"),     // This plugin depends on 
-          "plPriority"      => 3,                                 // Position in tabs 
-          "plSection"     => array("personal" => _("My account")),
-          "plCategory"    => array("users",
-                                   "groups"),
-          "plOptions"       => array("resolution_hook" => array("type" => "string",
-              "description" => _("Command to extend the list of possible screen resolutions"))),
-
-          "plProvidedAcls"  => array(
-
-            "gotoProfileFlagL"    => _("Resolution changeable during session") ,
-            "gotoProfileFlagC"    => _("Cache profile localy") ,
-
-            "gotoProfileQuota"    => _("Profile quota") ,
-            "gotoProfileServer"   => _("Profile server") ,
-
-            "gotoXResolution"     => _("Resolution") ,
-            "gotoKioskProfile"    => _("Kiosk profile") ,
-
-            "gosaDefaultPrinter"  => _("Default printer") ,
-            "gotoLogonScript"     => _("Logon script") ,
-            "gotoHotplugDevice"   => _("Hotplug devices"),
-            "gotoShare"           => _("Shares"))
-            ));
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/personal/environment/class_hotplugDialog.inc b/plugins/personal/environment/class_hotplugDialog.inc
deleted file mode 100644 (file)
index 0dd418e..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-<?php
-
-class hotplugDialog 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 $hotplugDevices           = ""; 
-  var $hotplugDeviceList        = array(); 
-  var $regex                    = "*";
-  var $depselect                = "/";
-  var $deplist                  = "/";
-  var $skipThese                = array();
-
-  function hotplugDialog (&$config,$skipThese = array())
-  {
-    $this->skipThese  = $skipThese;
-    $this->config     = $config;
-    $this->depselect  = $_SESSION['CurrentMainBase'];
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-    $display= "";
-
-    if(isset($_POST['dialogissubmitted'])){
-      $this->regex=$_POST['regexHot'];
-      $this->depselect = $_POST['depselectHot'];
-    }
-
-    if((isset($_GET['search']))&&(!empty($_GET['search']))){
-      $this->regex=$_GET['search']."*";
-      $this->regex=preg_replace("/\*\*/","*",$this->regex);
-    }
-
-    $this->deplist=$this->config->idepartments;
-
-    $this->hotplugDevices = $this->getHotplugs();
-    $smarty->assign("regexHot"    ,$this->regex);
-    $smarty->assign("deplistHot"  ,$this->deplist);
-    $smarty->assign("depselectHot",$this->depselect);
-    $smarty->assign("apply", apply_filter());
-    $smarty->assign("alphabet", generate_alphabet());
-    $smarty->assign("search_image", get_template_path('images/search.png'));
-    $smarty->assign("tree_image", get_template_path('images/tree.png'));
-    $smarty->assign("launchimage", get_template_path('images/small_filter.png'));
-    $smarty->assign("deplist", $this->config->idepartments);
-
-
-    $smarty->assign("hotplugDevices",$this->hotplugDevices);
-    $smarty->assign("hotplugDeviceKeys",array_flip($this->hotplugDevices));
-    $display.= $smarty->fetch(get_template_path('hotplugDialog.tpl', TRUE,dirname(__FILE__)));
-    return($display);
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    $entries = array();
-    foreach($_POST['hotplugName'] as $name){
-      $entries[$name] = $this->hotplugDeviceList[$name];
-    }
-    return $entries;
-  }
-
-  function getHotplugs()
-  {
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd("ou=devices,".$this->depselect);
-    $ldap->search("(&(objectClass=gotoDevice)(|(cn=".$this->regex.")(description=".$this->regex.")))",array("gotoHotplugDevice","cn","dn")); 
-
-    $a_return = array();  
-    $this->hotplugDeviceList = array();
-    while($attr = $ldap->fetch()){
-
-      if(isset($attr['gotoHotplugDevice'][0])){
-
-        $hot_plug = $attr['gotoHotplugDevice'][0];
-        $tmp      = preg_split("/\|/",$hot_plug);
-        $tmp2     = array();
-          
-        if(in_array($attr['cn'][0],$this->skipThese)){
-          continue;
-        }
-
-        $tmp2['name']         = $attr['cn'][0];
-        $tmp2['description']  = $tmp[0];
-        $tmp2['id']           = $tmp[1];
-        $tmp2['produkt']      = $tmp[2];
-        $tmp2['vendor']       = $tmp[3];
-        $tmp2['dn']           = $attr['dn'];
-
-        $a_return[$attr['cn'][0]]= $attr['cn'][0]." [".$tmp[0]."] ".$tmp[1];
-
-        $this->hotplugDeviceList[$attr['cn'][0]]=$tmp2;
-      }
-    }
-    return($a_return);
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/personal/environment/class_logonManagementDialog.inc b/plugins/personal/environment/class_logonManagementDialog.inc
deleted file mode 100644 (file)
index f125ad0..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-<?php
-class logonManagementDialog 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("LogonName","LogonPriority","LogonLast","LogonOverload","LogonData","LogonDescription");
-  var $objectclasses        = array("whatever");
-  var $use_existing         = false;  
-
-  var $LogonName        ="";  // Name for the LogonScript
-  var $LogonPriority    ="";  // Priority defines the order in which the scripts will be processed 
-  var $LogonLast        ="";  // Is this script marked as the last, all following scripts will be skipped
-  var $LogonOverload    ="";  // If Overload is activated this script is overlaodable by a group script with same prio
-  var $LogonData        ="";  // The script itself
-  var $LogonDescription ="";
-    
-  var $nameIsEditable = true;
-
-  var $real_LogonName = "";
-
-  function logonManagementDialog (&$config, $dn= NULL,$data=false)
-  {
-    plugin::plugin ($config, $dn);
-    
-    if($data){
-      $this->LogonName        = $data['LogonName'];
-      $this->LogonPriority    = $data['LogonPriority'];
-      $this->LogonOverload    = $data['LogonOverload'];
-      $this->LogonLast        = $data['LogonLast'];
-      $this->LogonData        = $data['LogonData'];
-      $this->LogonDescription = $data['LogonDescription'];
-      $this->nameIsEditable   = false;
-      $this->real_LogonName   = $data['LogonName'];
-    }
-  }
-
-  function execute()
-  {
-       /* Call parent execute */
-       plugin::execute();
-
-    $smarty= get_smarty();
-    $display= "";
-
-    if((isset($_POST['StartImport']))&&(isset($_FILES['importFile']))){
-      $this->LogonData = file_get_contents($_FILES['importFile']['tmp_name']);
-      @unlink($_FILES['importFile']['tmp_name']);
-    }
-
-    foreach($this->attributes as $attr){
-      $smarty->assign($attr,$this->$attr);
-      if($this->$attr){
-        $smarty->assign($attr."CHK"," checked ");
-      }else{
-        $smarty->assign($attr."CHK","");
-      }
-    }
-    $prios=array(1,2,3,4,5,6,7,8,9,10);
-    $smarty->assign("LogonPrioritys",$prios);
-    $smarty->assign("LogonPriorityKeys",$prios);
-
-    if(!$this->nameIsEditable){
-      $smarty->assign("LogonNameACL"," disabled ");
-    }else{
-      $smarty->assign("LogonNameACL","");
-    }
-  
-
-    $display.= $smarty->fetch(get_template_path('logonManagement.tpl', TRUE,dirname(__FILE__)));
-    return($display);
-  }
-
-  function save_object()
-  {
-    if(isset($_POST['dialogissubmitted'])){
-      foreach($this->attributes as $attr){
-
-        if(!$this->nameIsEditable && $attr == 'LogonName'){
-          continue;
-        }
-        if(isset($_POST[$attr])){
-          $this->$attr = stripslashes($_POST[$attr]); 
-        }
-      }
-
-      foreach(array("LogonLast","LogonOverload") as $checkBoxes){
-        if(isset($_POST[$checkBoxes])){
-          $this->$checkBoxes = stripslashes($_POST[$checkBoxes]);
-        }else{
-          $this->$checkBoxes = "";
-        }
-
-      }
-    }
-  }
-
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-  
-    if(preg_match("/[^a-zA-Z]/",$this->LogonName)){
-      $message[] = _("Specified name should only consist of upper-/lowercase characters.");
-    }
-
-    if(empty($this->LogonName)){
-      $message[] = _("Please specify a valid script name.");
-    }
-
-    if(preg_match("/[^a-z0-9,\.-;:_\(\)!\? ]/i",$this->LogonDescription)){
-      $message[] = _("Specified description contains invalid characters.");
-    }
-
-    return $message;
-  }
-
-
-  function save()
-  {
-    $a_return= array();
-    foreach($this->attributes as $attr){
-      $a_return[$attr]=$this->$attr;
-    }  
-
-    if(!$this->nameIsEditable){
-      $a_return['LogonName']=$this->real_LogonName;
-    }
-
-    return($a_return); 
-  }
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/personal/environment/class_selectPrinterDialog.inc b/plugins/personal/environment/class_selectPrinterDialog.inc
deleted file mode 100644 (file)
index fea177b..0000000
+++ /dev/null
@@ -1,169 +0,0 @@
-<?php
-
-class selectPrinterDialog 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 $AlreadyAssigned      = array();  
-  var $regex                = "*";
-  var $depselect            = "/";
-  var $deplist              = array("/");
-  var $module               = array("printer");
-  var $ui                   = NULL;
-  var $subtreesearch        = FALSE;
-
-  function selectPrinterDialog (&$config, $dn= NULL,$alreadyused=array() )
-  {
-    $this->AlreadyAssigned = $alreadyused;
-    plugin::plugin ($config, $dn);
-
-    /* Get all departments within this subtree */
-    $base = $this->config->current['BASE'];
-
-    /* Add base */
-    $tmp = array();
-    $tmp[] = array("dn"=>$this->config->current['BASE']);
-    $tmp=  array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
-                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
-
-    $deps = array();
-    foreach($tmp as $tm){
-      $deps[$tm['dn']] = $tm['dn'];
-    }
-
-
-    /* Load possible departments */
-    $ui= get_userinfo();
-    $this->ui = $ui;
-    $tdeps= $ui->get_module_departments("users");
-    $ids = $this->config->idepartments;
-    $first = "";
-    $found = FALSE;
-    $res = array();
-    foreach($ids as $dep => $name){
-      if(isset($deps[$dep]) && in_array_ics($dep, $tdeps)){
-        $res[$dep] = $ids[$dep]; //$tdeps[$dep];
-      }
-    }
-    $this->deplist = $res;
-    $this->depselect = key($res);
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-    $display= "";
-
-    if(isset($_POST['dialogissubmitted'])){
-      foreach(array('regexPrinter' => 'regex','depselectPrinter'=>'depselect') as $attr => $name){
-        if(isset($_POST[$attr])){
-          $this->$name      =$_POST[$attr];
-        }
-      }
-    }
-
-    if(isset($_POST['subtrees'])){
-      $this->subtreesearch= TRUE;
-    } else {
-      $this->subtreesearch= FALSE;
-    }
-
-    if((isset($_GET['search']))&&(!empty($_GET['search']))){
-      $this->regex=$_GET['search']."*";
-      $this->regex=preg_replace("/\*\*/","*",$this->regex);
-    }
-
-    $smarty->assign("regexPrinter"    ,$this->regex);
-    $smarty->assign("deplistPrinter"  ,$this->deplist);
-    $smarty->assign("depselectPrinter",$this->depselect);
-    $smarty->assign("gotoPrinters",$this->getPrinter());
-    $smarty->assign("gotoPrinterKeys",array_flip($this->getPrinter()));
-    $smarty->assign("apply", apply_filter());
-    $smarty->assign("alphabet", generate_alphabet());
-    $smarty->assign("subtrees", $this->subtreesearch?"checked":"");
-    $smarty->assign("search_image", get_template_path('images/search.png'));
-    $smarty->assign("tree_image", get_template_path('images/tree.png'));
-    $smarty->assign("infoimage", get_template_path('images/info.png'));
-    $smarty->assign("launchimage", get_template_path('images/small_filter.png'));
-    $smarty->assign("deplist", $this->config->idepartments);
-
-    $display.= $smarty->fetch(get_template_path('selectPrinterDialog.tpl', TRUE,dirname(__FILE__)));
-    return($display);
-  }
-
-  function check(){
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    if(empty($_POST['gotoPrinter'])){
-      $message[] = _("Please select a printer or press cancel.");
-    }
-    return $message;
-  }
-
-  /* Save to LDAP */
-  function save()
-  {
-    return($_POST['gotoPrinter']);
-  }
-
-  /* This function generates the Printerlist
-   * All printers are returned that match regex and and depselect
-   */
-  function getPrinter($detailed = false)
-  {
-    $a_return=array();
-
-
-    $filter = "(&(objectClass=gotoPrinter)(cn=".$this->regex."))";
-    $module = $this->module;
-    $base   = $this->depselect;
-    $attrs  = array("cn","description");
-    if ($this->subtreesearch){
-      $res    = get_list($filter,$module,$base,$attrs, GL_SIZELIMIT, GL_SUBSEARCH);
-    } else {
-      $base= "ou=printers,ou=systems,".$base;
-      $res    = get_list($filter,$module,$base,$attrs, GL_SIZELIMIT);
-    }
-
-    foreach($res as $printer)  {
-
-      $acl = $this->ui->get_permissions($printer['dn'],"printer/printgeneric","gotoUserPrinter");
-
-      if(!preg_match("/w/",$acl)){
-        continue;
-      }
-
-      if(isset($this->AlreadyAssigned[$printer['cn'][0]])) continue;
-
-      if($detailed ==true){
-        $a_return[$printer['cn'][0]] = $printer;
-      }else{
-        if(isset($printer['description'][0])){
-          $a_return[$printer['cn'][0]] = $printer['cn'][0]." - ".$printer['description'][0];  
-        }else{
-          $a_return[$printer['cn'][0]] = $printer['cn'][0];  
-        }
-      }
-    }
-    return($a_return);
-  }
-}
-
-
-
-
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/personal/environment/environment.tpl b/plugins/personal/environment/environment.tpl
deleted file mode 100644 (file)
index ba6c356..0000000
+++ /dev/null
@@ -1,294 +0,0 @@
-{if $is_account ne 'true'}
- <img alt="" class="center" src="images/stop.png" align="middle">
- {t}The environment extension is currently disabled.{/t}
-{else}
-
-
-<input type="hidden" name="iamposted" value="1">
-
-<h2> 
- <img class="center" alt="" src="images/fai_profile.png" align="middle" /> 
- {t}Profiles{/t}
-</h2>
-
-<table summary="{t}Environment managment settings{/t}" width="100%">
- <tr>
-  <td style="width:50%;border-right:1px solid #B0B0B0;vertical-align:top;">
-   <table summary="{t}Profile managment{/t}">
-    <tr>
-     <td style="vertical-align:top">
-{render acl=$gotoProfileACL}
-      <input class="center" type="checkbox" value="1" {$useProfileCHK} name="useProfile" id="useProfile" onclick="changeState('gotoProfileServer');changeState('gotoProfileFlagC');changeState('gotoProfileQuota');">
-{/render}
-     </td>
-     <td style="vertical-align:middle;">
-      <label for="useProfile">{t}Use profile managment{/t}</label>
-     </td>
-    </tr>
-    <tr>
-     <td>&nbsp;
-     </td>
-     <td>
-      <table summary="{t}Profile server managment{/t}">
-       <tr>
-        <td> 
-         <label for="gotoProfileServer">{t}Profil path{/t}</label>
-        </td>
-        <td>
-{render acl=$gotoProfileServerACL}
-
-{if $gotoProfileServerWriteable}
-         <select id="gotoProfileServer" name="gotoProfileServer">
-          {html_options values=$gotoProfileServerKeys output=$gotoProfileServers selected=$gotoProfileServer}
-          <option disabled>&nbsp;</option>
-         </select>
-{else}
-         <select id="gotoProfileServer" name="gotoProfileServer">
-          {html_options values=$gotoProfileServer output=$gotoProfileServer selected=$gotoProfileServer}
-          <option disabled>&nbsp;</option>
-         </select>
-{/if}
-{/render}
-        </td>
-       </tr>
-       <tr>
-        <td>
-         <label for="gotoProfileQuota">{t}Profil quota{/t}</label> 
-         <br>
-         <br>
-        </td>
-        <td>
-{render acl=$gotoProfileQuotaACL}
-         <input type="text" name="gotoProfileQuota" value="{$gotoProfileQuota}" size="6" id="gotoProfileQuota">{t}MB{/t}
-{/render}
-         <br>
-         <br>
-        </td>
-       </tr>
-       <tr>
-        <td colspan=2> 
-{render acl=$gotoProfileFlagCACL}
-         <input class="center" type="checkbox" name="gotoProfileFlagC" value="C" {$gotoProfileFlagCCHK} id="gotoProfileFlagC">&nbsp;
-{/render}
-         <label for="gotoProfileFlagC">{t}Cache profile localy{/t}</label>
-        </td>
-       </tr>
-      </table>
-     </td>
-    </tr>
-   </table>
-  </td>
-  <td style="vertical-align:top">
-
-  <table summary="{t}Kiosk profile settings{/t}">
-{if $kiosk_enabled }
-    <tr>
-     <td colwidth=2>
-      <label for="kiosk_server">{t}Kiosk profile{/t}</label>
-     </td>
-    </tr>
-    <tr>
-     <td>
-      {t}Server{/t}
-      <select name='kiosk_server' id="kiosk_server" onChange='document.mainform.submit();'>
-       {html_options options=$kiosk_servers selected=$kiosk_server}
-      </select>
-     </td>
-     <td>
-      {if $kiosk_server != "none"}
-      {t}Profile{/t}
-      <select name='kiosk_profile'>
-       {html_options values=$kiosk_profiles output=$kiosk_profiles selected=$kiosk_profile}
-      </select>
-      {else}
-        &nbsp;
-      {/if}
-     </td>
-    </tr>
- {else}
-       <tr>
-               <td>
-                       <label for="dummy1">{t}Kiosk profile{/t}</label>
-               </td>
-               <td>
-                       <select name="dummy1" disabled id="dummy1"><option disabled>&nbsp;</option></select>
-                       <input type="button" disabled name="dummy2" value="{t}Manage{/t}">
-               </td>
-       </tr>
-{/if}
-    <tr>
-     <td colspan=2>
-      <br>
-{render acl=$gotoProfileFlagLACL}
-      <input type="checkbox" name="gotoProfileFlagL" id="gotoProfileFlagL" value="L" {$gotoProfileFlagLCHK}>
-{/render}
-      <label for="gotoProfileFlagL">{t}Resolution changeable during session{/t}</label>
-     </td>
-    </tr>
-    <tr>
-     <td>
-      <label for="gotoXResolution">{t}Resolution{/t}</label>
-     </td>
-     <td>
-{render acl=$gotoXResolutionACL}
-      <select name="gotoXResolution" id="gotoXResolution">
-       {html_options values=$gotoXResolutionKeys output=$gotoXResolutions selected=$gotoXResolution}
-      <option disabled>&nbsp;</option>
-      </select>
-{/render}
-     </td>
-    </tr>
-   </table> 
-
-
-
-
-
-
-  </td>
- </tr>
-</table>
-
-<p class="seperator">&nbsp;</p>
-
-<table summary="{t}Environment managment settings{/t}" width="100%">
- <tr>
-  <td style="width:50%;border-right:1px solid #B0B0B0">
-   <h2>
-    <img class="center" alt="" src="images/fai_partitionTable.png" align="middle" />&nbsp;
-    <label for="gotoShare">{t}Shares{/t}</label>
-   </h2>
-   <table summary="" style="width:100%">
-    <tr>
-     <td>
-       
-{render acl=$gotoShareACL}
-      {$divlistShares}
-{/render}
-{render acl=$gotoShareACL}
-      <input type="text" size=15 name="ShareUser" value="%u" title="{t}User used to connect to the share{/t}">@
-{/render}
-{render acl=$gotoShareACL}
-      <select name="gotoShareSelection" title="{t}Select a share{/t}">
-       {html_options values=$gotoShareSelectionKeys output=$gotoShareSelections}
-       <option disabled>&nbsp;</option>
-      </select>
-{/render}
-      :
-{render acl=$gotoShareACL}
-      <input type="text" size=15 name="gotoShareMountPoint" value="%H/Netzlaufwerke/%L/%S"
-      title="{t}Mount path{/t}">
-{/render}
-{render acl=$gotoShareACL}
-      <input type="submit" name="gotoShareAdd" value="{t}Add{/t}"> 
-{/render}
-      <!--   <input type="submit" name="gotoShareDel" value="{t}Remove{/t}"> -->
-     </td>
-    </tr>
-   </table>
-  </td>
-  <td style="vertical-align:top">
-   <h2>
-    <img class="center" alt="" src="images/fai_script.png" align="middle" />&nbsp;
-    <label for="gotoLogonScript">{t}Logon scripts{/t}</label>
-   </h2>
-   <table summary="{t}Logon script management{/t}" style="width:100%">
-    <tr>
-     <td>
-{render acl=$gotoLogonScriptACL}
-      <select style="width:100%;" name="gotoLogonScript" multiple size=5 id="gotoLogonScript">
-       {html_options values=$gotoLogonScriptKeys output=$gotoLogonScripts }
-       <option disabled>&nbsp;</option>
-      </select>
-{/render}
-
-      <br>
-{render acl=$gotoLogonScriptACL}
-      <input type="submit" name="gotoLogonScriptNew" value="{t}Add{/t}">
-{/render}
-{render acl=$gotoLogonScriptACL}
-      <input type="submit" name="gotoLogonScriptEdit"  value="{t}Edit{/t}" {if $gotoLogonScriptKeysCnt ==0} disabled {/if}>
-{/render}
-{render acl=$gotoLogonScriptACL}
-      <input type="submit" name="gotoLogonScriptDel"  value="{t}Delete{/t}" {if $gotoLogonScriptKeysCnt ==0} disabled {/if}>
-{/render}
-     </td>
-    </tr>
-   </table> 
-  </td>
- </tr>
-</table>
-
-<p class="seperator">&nbsp;</p>
-
-<table summary="{t}Environment managment settings{/t}" width="100%">
- <tr>
-  <td style="border-right:1px solid #B0B0B0; width:50%; vertical-align:top">
-   <h2>
-    <img alt="" src="images/hotplug.png" align="middle" class="center" />&nbsp;
-    <label for="gotoHotplugDevice_post">{t}Hotplug devices{/t}</label>
-   </h2> 
-   <table style="width:100%" summary="{t}Hotplug device settings{/t}">
-    <tr>
-     <td>
-{render acl=$gotoHotplugDeviceACL}
-      <select name="gotoHotplugDevice_post[]" size=5  style="width:100%;" id="gotoHotplugDevice_post" multiple>
-       {html_options values=$gotoHotplugDeviceKeys output=$gotoHotplugDevices}
-       <option disabled>&nbsp;</option>
-      </select>
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td>
-{render acl=$gotoHotplugDeviceACL}
-      <input type="submit" name="gotoHotplugDeviceUse" value="{t}Add{/t}">
-{/render}
-{render acl=$gotoHotplugDeviceACL}
-      <input type="submit" name="gotoHotplugDeviceDel" value="{t}Delete{/t}"
-      {if !$gotoHotplugDevices} disabled {/if}>
-{/render}
-     </td>
-    </tr>
-   </table>
-  </td>
-  <td>
-   <h2>
-    <img alt="" src="images/select_printer.png" align="middle" class="center" />&nbsp;
-    <label for="gotoPrinter">{t}Printer{/t}</label>
-   </h2>
-   <table style="width:100%" summary="{t}Printer settings{/t}">
-    <tr>
-     <td>
-{render acl=$gotoPrinterACL}
-      <select style="width:100%;" name="gotoPrinterSel[]" multiple size=5 id="gotoPrinter">
-       {html_options values=$gotoPrinterKeys output=$gotoPrinter}
-       <option disabled>&nbsp;</option>
-      </select>
-{/render}
-      <br>
-{render acl=$gotoPrinterACL}
-      <input type="submit"  name="gotoPrinterAdd"     value="{t}Add{/t}">
-{/render}
-{render acl=$gotoPrinterACL}
-      <input type="submit" name="gotoPrinterDel"     value="{t}Delete{/t}" {if !$gotoPrinter } disabled {/if}>
-{/render}
-{render acl=$gotoPrinterACL}
-      <input type="submit" name="gotoPrinterEdit"    value="{t}Toggle admin{/t}" {if !$gotoPrinter } disabled {/if}>
-{/render}
-{render acl=$gosaDefaultPrinterACL}
-      <input type="submit" name="gotoPrinterDefault"    value="{t}Toggle default{/t}" {if !$gotoPrinter | $is_group} disabled {/if}>
-{/render}
-     </td>
-    </tr>
-   </table>
-  </td>
- </tr>
-</table>
-<script language="JavaScript" type="text/javascript">
-<!-- // First input field on page
-focus_field('useProfile');
--->
-</script>
-{/if}
-
diff --git a/plugins/personal/environment/hotplugDialog.tpl b/plugins/personal/environment/hotplugDialog.tpl
deleted file mode 100644 (file)
index 868e72b..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-<h2><img class="center" alt="" src="images/hotplug.png" align="middle">&nbsp;{t}Add hotplug devices{/t}</h2>
-
-    <input type="hidden" name="dialogissubmitted" value="1">
-
-       <table summary="{t}Hotplug management{/t}" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4 cellspacing=2>
-        <tr>
-            <td width="50%" style="vertical-align:top;">
-                               <div class="contentboxh" style="height:20px;">
-                               <p class="contentboxh" style="font-size:12px">
-                                       <b><LABEL for="hotplugName">{t}Select hotplug device to add{/t}</LABEL></b>
-                               </p>
-                               </div>
-                               <div class="contentboxb">
-                               <p class="contentboxb" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-                                               <select style="width:600px;height:450px" size=20 name="hotplugName[]" id="hotplugName" multiple>
-                                                       {html_options values=$hotplugDeviceKeys output=$hotplugDevices}
-                                               <option disabled>&nbsp;</option>
-                                               </select><br>
-                                       </p>
-                               </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]">{t}Filters{/t}</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>
-                            <img class="center" alt="" src="{$tree_image}" align=middle>&nbsp;
-                            <select name="depselectHot" size=1 onChange="mainform.submit()" title="{t}Choose the department the search will be based    on{/t}">
-                              {html_options options=$deplistHot selected=$depselectHot}
-                            </select>
-                        </td>
-                    </tr>
-                </table>
-                        <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-                            <tr>
-                                <td>
-                                    <LABEL for='filter'><img class="center" alt="Search" src="{$search_image}" align="middle" title="{t}Display users matching{/t}">
-                                    </LABEL>
-                                </td>
-                                <td width="99%">
-                                    <input id='filter' style='width:99%' type='text' name='regexHot' maxlength='20' value='{$regexHot}'
-                                            title='{t}Regular expression for        matching hotplugs{/t}' onChange="mainform.submit()">
-                                </td>
-                            </tr>
-                        </table>
-                    {$apply}
-                </div>
-            </td>
-
-
-               </tr>
-       </table>
-
-    <p class="seperator">&nbsp;</p>
-
-    <p align="right">
-    <input type="submit" name="HotPlugSave"     value="{t}Add{/t}">
-    <input type="submit" name="HotPlugCancel"   value="{t}Cancel{/t}">
-    </p>
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('hotplugName');
-  -->
-</script>
diff --git a/plugins/personal/environment/logonManagement.tpl b/plugins/personal/environment/logonManagement.tpl
deleted file mode 100644 (file)
index 746be6f..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-<h2><img class="center" alt="" src="images/fai_script.png" align="middle">&nbsp;{t}Logon script management{/t}</h2>
-
-    <input type="hidden" name="dialogissubmitted" value="1">
-
-    <table summary="{t}Logon script management{/t}" width="100%">
-       <tr>
-                       <td width="50%" style="vertical-align:top;border-right:1px solid #B0B0B0">
-                                       <table summary="{t}Logon script settings{/t}">
-                                               <tr>
-                                                       <td><LABEL for="LogonName">{t}Skript name{/t}</LABEL>
-                                                       </td>
-                                                       <td>
-                                                               <input type="text" size=20 value="{$LogonName}" name="LogonName" {$LogonNameACL} id="LogonName">
-                                                       </td>
-                                               </tr>
-                                               <tr>
-                                                       <td><LABEL for="LogonDescription">{t}Description{/t}</LABEL>
-                                                       </td>
-                                                       <td>
-                                                               <input type="text" size=40 value="{$LogonDescription}" name="LogonDescription" id="LogonDescription"> 
-                                                       </td>
-                                               </tr>
-                                               <tr>
-                                                       <td><LABEL for="LogonPriority">{t}Priority{/t}</LABEL>
-                                                       </td><td>
-                                               <select name="LogonPriority" id="LogonPriority">
-                                                       {html_options values=$LogonPriorityKeys output=$LogonPrioritys}
-                                               </select>
-                                                       </td>
-                                               </tr>
-                                       </table>
-                       </td>
-                       <td style="vertical-align:top">
-                                       <table summary="{t}Logon script flags{/t}">
-                                               <tr>
-                                                       <td>
-                                                               <input type="checkbox" value="L" name="LogonLast" {$LogonLastCHK} id="LogonLast">
-                                                       <LABEL for="LogonLast">{t}Last script{/t}</LABEL>
-                                                       </td>
-                                               </tr>
-                                               <tr>
-                                                       <td>
-                                                               <input type="checkbox" value="O" name="LogonOverload" {$LogonOverloadCHK} id="LogonOverload">
-                                                               <LABEL for="LogonOverload">{t}Script can be replaced by user{/t}</LABEL>
-                                                       </td>
-                                               </tr>
-                                       </table>
-                       </td>
-               </tr>
-       </table>
-       <p class="seperator">&nbsp;</p>
-       <table width="100%" summary="">
-               <tr>
-                       <td colspan="2">
-                       <h2><img class="center" alt="" src="images/fai_script.png" align="middle">&nbsp;{t}Script{/t}</h2>
-                                       <table width="100%" summary="{t}Logon script{/t}">
-                                               <tr>
-                                                       <td>
-                                                               <textarea style="width:100%;height:400px;" name="LogonData">{$LogonData}</textarea>
-                                                       </td>
-                                               </tr>
-                                               <tr>
-                                                       <td>
-                                                               <input type="file" name="importFile" id="importFile">
-                                                               <input type="submit" value="{t}Import{/t}" name="StartImport" >
-                                                       </td>
-                                               </tr>
-                                       </table>
-                       </td>
-               </tr>
-       </table>        
-
-       <p class="seperator">&nbsp;</p>
-    <p align="right">
-    <input type="submit" name="LogonSave"     value="{t}Apply{/t}">
-    <input type="submit" name="LogonCancel"   value="{t}Cancel{/t}">
-    </p>
-
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('LogonName');
-  -->
-</script>
-
diff --git a/plugins/personal/environment/main.inc b/plugins/personal/environment/main.inc
deleted file mode 100644 (file)
index 6b5d936..0000000
+++ /dev/null
@@ -1,125 +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
- */
-$lock_msg = "";
-if (!$remove_lock){
-  /* Reset requested? */
-  if (isset($_POST['edit_cancel']) || 
-      (isset($_GET['reset']) && $_GET['reset'] == 1)){
-#    del_lock ($ui->dn);
-    sess_del ('edit');
-    sess_del ('environment');
-  }
-
-  /* Create mail object on demand */
-  if (!isset($_SESSION['environment']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
-    $_SESSION['environment']= new environment ($config, $ui->dn);
-    $_SESSION['environment']->enable_CSN_check();
-    $_SESSION['environment']->set_acl_category('users');
-    $_SESSION['environment']->set_acl_base($ui->dn);
-  }
-  $environment= $_SESSION['environment'];
-
-  /* save changes back to object */
-  if (isset($_SESSION['edit'])){
-    $environment->save_object ();
-  }
-
-  /* Enter edit mode? */
-  if (isset($_POST['edit'])){
-  
-   /* Check locking */
-    if (($username= get_lock($ui->dn)) != ""){
-      $_SESSION['back_plugin']= $plug;
-      $_SESSION['LOCK_VARS_TO_USE'] = array("/^edit$/","/^plug$/");
-      $lock_msg =  gen_locked_message ($username, $ui->dn);
-
-    }else{
-
-      /* Lock the current entry */
-      add_lock ($ui->dn, $ui->dn);
-      $_SESSION['dn']= $ui->dn;
-      $_SESSION['edit']= TRUE;
-    }
-  }
-
-  /* save changes to LDAP and disable edit mode */
-  if (isset($_POST['edit_finish'])){
-
-    /* Perform checks */
-    $message= $environment->check ();
-
-    /* No errors, save object */
-    if (count ($message) == 0){
-      $environment->save ();
-      del_lock ($ui->dn);
-      sess_del ('edit');
-
-      /* Remove object */
-      sess_del ('environment');
-    } else {
-      /* Errors found, show message */
-      show_errors ($message);
-    }
-  }
-
-  /* Execute formular */
-  if($lock_msg){
-    $display = $lock_msg;
-  }else{
-    $display = $environment->execute();
-  }
-
-  /* Store changes  in session */
-  if (isset ($_SESSION['edit'])){
-    $_SESSION['environment']= $environment;
-  }
-
-  $info= "";
-  /* Show page footer depending on the mode */
-  if (!$environment->in_dialog && $environment->is_account  && empty($lock_msg)){
-    $display.= "<p class=\"plugbottom\">";
-
-    /* Are we in edit mode? */
-    if ((isset($_SESSION['edit']))&&($environment->dialog===NULL)){
-      $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
-      $display.= "&nbsp;";
-      $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
-      $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png').
-             "\"> ".$ui->dn."&nbsp;";
-    } else {
-      $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/openlock.png').
-        "\"> ".$ui->dn."&nbsp;";
-      if(preg_match("/w/",$ui->get_permissions($ui->dn,"users/environment"))){
-        $info.= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/lamp.png').
-          "\"> "._("Click the 'Edit' button below to change informations in this dialog");
-        $display.= "<input type=submit name=\"edit\" value=\""._("Edit")."\">\n";
-      }
-      $display.= "<input type=\"hidden\" name=\"ignore\">\n";
-    }
-    $display.= "</p>\n";
-  }
-
-  /* Page header*/
-  $display= print_header(get_template_path('images/email.png'), _("User environment settings"), $info).$display;
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/personal/environment/selectPrinterDialog.tpl b/plugins/personal/environment/selectPrinterDialog.tpl
deleted file mode 100644 (file)
index f07674d..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-<h2><img class="center" alt="" src="images/select_printer.png" align="middle">&nbsp;{t}Add printer devcies{/t}</h2>
-
-    <input type="hidden" name="dialogissubmitted" value="1">
-
-       <table summary="{t}Select printer to add{/t}" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
-        <tr>
-            <td width="50%">
-                               <div class="contentboxh" style="height:20px;">
-                               <p class="contentboxh" style="font-size:12px">
-                                       <b><LABEL for="gotoPrinter">{t}Select printer to add{/t}</LABEL></b>
-                               </p>
-                               </div>
-                               <div class="contentboxb">
-                               <p class="contentboxb" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-                               <select style="width:600px;height:450px" size=20 name="gotoPrinter[]" id="gotoPrinter" multiple>
-                               {html_options values=$gotoPrinterKeys output=$gotoPrinters}
-                               <option disabled>&nbsp;</option>
-                                        </select><br>
-                                       </p>
-                               </div>
-            </td>
-            <td valign="top">
-                               <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;background-color:#F8F8F8">
-                               {$alphabet}
-                               </table>
-                               <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-                                       <tr>
-                                               <td>
-                                                       <img class="center" alt="" src="{$tree_image}" align=middle>&nbsp;
-                                                       <select name="depselectPrinter" size=1 onChange="mainform.submit()" title="{t}Choose the department the search will be based on{/t}">
-                                                         {html_options options=$deplistPrinter selected=$depselectPrinter}
-                                                       </select>
-                                               </td>
-                                       </tr>
-                               </table>
-                               <table summary="" style="width:100%;border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-                               <tr><td>
-                               <input type=checkbox name="subtrees" value="1" {$subtrees} onClick="mainform.submit()" title="{t}Select to search within subtrees{/t}">{t}Search in subtrees{/t}
-                               </tr></td>
-                               </table>
-                                       <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-                                                       <tr>
-                                                               <td>
-                                                                       <LABEL for='filter'><img class="center" alt="Search" src="{$search_image}" align="middle" title="{t}Display printers matching{/t}">
-                                                                       </LABEL>
-                                                               </td>
-                                                       <td width="99%">
-                                                                       <input id='filter' style='width:99%' type='text' name='regexPrinter' maxlength='20' value='{$regexPrinter}' 
-                                                                                       title='{t}Regular expression for matching printer names{/t}' onChange="mainform.submit()">
-                                                               </td>
-                                                       </tr>
-                                               </table>
-                                       {$apply}
-                               </div>
-               </td>
-       </tr>
-    </table>
-
-    <p class="seperator">&nbsp;</p>
-    <p align="right">
-    <input type="submit" name="PrinterSave"     value="{t}Add{/t}">
-    <input type="submit" name="PrinterCancel"   value="{t}Cancel{/t}">
-    </p>
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('gotoPrinter');
-  -->
-</script>
diff --git a/plugins/personal/generic/class_user.inc b/plugins/personal/generic/class_user.inc
deleted file mode 100644 (file)
index 57414ef..0000000
+++ /dev/null
@@ -1,1572 +0,0 @@
-<?php
-/*!
-  \brief   user plugin
-  \author  Cajus Pollmeier <pollmeier@gonicus.de>
-  \version 2.00
-  \date    24.07.2003
-
-  This class provides the functionality to read and write all attributes
-  relevant for person, organizationalPerson, inetOrgPerson and gosaAccount
-  from/to the LDAP. It does syntax checking and displays the formulars required.
- */
-
-class user extends plugin
-{
-  /* Definitions */
-  var $plHeadline= "Generic";
-  var $plDescription= "This does something";
-
-  /* CLI vars */
-  var $cli_summary= "Handling of GOsa's user base object";
-  var $cli_description= "Some longer text\nfor help";
-  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* Plugin specific values */
-  var $base= "";
-  var $orig_base= "";
-  var $cn= "";
-  var $new_dn= "";
-  var $personalTitle= "";
-  var $academicTitle= "";
-  var $homePostalAddress= "";
-  var $homePhone= "";
-  var $labeledURI= "";
-  var $o= "";
-  var $ou= "";
-  var $departmentNumber= "";
-  var $employeeNumber= "";
-  var $employeeType= "";
-  var $roomNumber= "";
-  var $telephoneNumber= "";
-  var $facsimileTelephoneNumber= "";
-  var $mobile= "";
-  var $pager= "";
-  var $l= "";
-  var $st= "";
-  var $postalAddress= "";
-  var $dateOfBirth;
-  var $use_dob= "0";
-  var $gender="0";
-  var $preferredLanguage="0";
-
-  var $jpegPhoto= "*removed*";
-  var $photoData= "";
-  var $old_jpegPhoto= "";
-  var $old_photoData= "";
-  var $cert_dialog= FALSE;
-  var $picture_dialog= FALSE;
-  var $pwObject= NULL;
-
-  var $userPKCS12= "";
-  var $userSMIMECertificate= "";
-  var $userCertificate= "";
-  var $certificateSerialNumber= "";
-  var $old_certificateSerialNumber= "";
-  var $old_userPKCS12= "";
-  var $old_userSMIMECertificate= "";
-  var $old_userCertificate= "";
-
-  var $gouvernmentOrganizationalUnit= "";
-  var $houseIdentifier= "";
-  var $street= "";
-  var $postalCode= "";
-  var $vocation= "";
-  var $ivbbLastDeliveryCollective= "";
-  var $gouvernmentOrganizationalPersonLocality= "";
-  var $gouvernmentOrganizationalUnitDescription= "";
-  var $gouvernmentOrganizationalUnitSubjectArea= "";
-  var $functionalTitle= "";
-  var $role= "";
-  var $publicVisible= "";
-
-  var $orig_dn;
-  var $dialog;
-
-  /* variables to trigger password changes */
-  var $pw_storage= "crypt";
-  var $last_pw_storage= "unset";
-  var $had_userCertificate= FALSE;
-
-  var $view_logged = FALSE;
-
-  /* attribute list for save action */
-  var $attributes= array("sn", "givenName", "uid", "personalTitle", "academicTitle",
-      "homePostalAddress", "homePhone", "labeledURI", "ou", "o", "dateOfBirth", "gender","preferredLanguage",
-      "departmentNumber", "employeeNumber", "employeeType", "l", "st","jpegPhoto",
-      "roomNumber", "telephoneNumber", "mobile", "pager", "cn", "userPKCS12",
-      "postalAddress", "facsimileTelephoneNumber", "userSMIMECertificate");
-
-  var $objectclasses= array("top", "person", "organizationalPerson", "inetOrgPerson",
-      "gosaAccount");
-
-  /* attributes that are part of the government mode */
-  var $govattrs= array("gouvernmentOrganizationalUnit", "houseIdentifier", "vocation",
-      "ivbbLastDeliveryCollective", "gouvernmentOrganizationalPersonLocality",
-      "gouvernmentOrganizationalUnitDescription","gouvernmentOrganizationalUnitSubjectArea",
-      "functionalTitle", "certificateSerialNumber", "publicVisible", "street", "role",
-      "postalCode");
-
-  var $multiple_support = TRUE;
-
-  /* constructor, if 'dn' is set, the node loads the given
-     'dn' from LDAP */
-  function user (&$config, $dn= NULL)
-  {
-    $this->config= $config;
-    /* Configuration is fine, allways */
-    if ($this->config->current['GOVERNMENTMODE']){
-      $this->attributes=array_merge($this->attributes,$this->govattrs);
-    }
-
-    /* Load base attributes */
-    plugin::plugin ($config, $dn);
-
-    $this->orig_dn  = $this->dn;
-    $this->new_dn   = $dn;
-
-    if ($this->config->current['GOVERNMENTMODE']){
-      /* Fix public visible attribute if unset */
-      if (!isset($this->attrs['publicVisible'])){
-        $this->publicVisible == "nein";
-      }
-    }
-
-    /* Load government mode attributes */
-    if ($this->config->current['GOVERNMENTMODE']){
-      /* Copy all attributs */
-      foreach ($this->govattrs as $val){
-        if (isset($this->attrs["$val"][0])){
-          $this->$val= $this->attrs["$val"][0];
-        }
-      }
-    }
-
-    /* Create me for new accounts */
-    if ($dn == "new"){
-      $this->is_account= TRUE;
-    }
-
-    /* Make hash default to md5 if not set in config */
-    if (!isset($this->config->current['HASH'])){
-      $hash= "md5";
-    } else {
-      $hash= $this->config->current['HASH'];
-    }
-
-    /* Load data from LDAP? */
-    if ($dn !== NULL){
-
-      /* Do base conversation */
-      if ($this->dn == "new"){
-        $ui= get_userinfo();
-        $this->base= dn2base($ui->dn);
-      } else {
-        $this->base= dn2base($dn);
-      }
-
-      /* get password storage type */
-      if (isset ($this->attrs['userPassword'][0])){
-       /* Initialize local array */
-       $matches= array();
-        if (preg_match ("/^{([^}]+)}(.+)/", $this->attrs['userPassword'][0], $matches)){
-          $this->pw_storage= strtolower($matches[1]);
-        } else {
-          if ($this->attrs['userPassword'][0] != ""){
-            $this->pw_storage= "clear";
-          } else {
-            $this->pw_storage= $hash;
-          }
-        }
-      } else {
-        /* Preset with vaule from configuration */
-        $this->pw_storage= $hash;
-      }
-
-      /* Load extra attributes: certificate and picture */
-      $this->load_cert();
-      $this->load_picture();
-      if ($this->userCertificate != ""){
-        $this->had_userCertificate= TRUE;
-      }
-    }
-
-    /* Reset password storage indicator, used by password_change_needed() */
-    if ($dn == "new"){
-      $this->last_pw_storage= "unset";
-    } else {
-      $this->last_pw_storage= $this->pw_storage;
-    }
-
-    /* Generate dateOfBirth entry */
-    if (isset ($this->attrs['dateOfBirth'])){
-      /* This entry is ISO 8601 conform */
-      list($year, $month, $day)= split("-", $this->attrs['dateOfBirth'][0], 3);
-    
-      $this->dateOfBirth=array( 'mon'=> $month,"mday"=> $day,"year"=> $year);
-      $this->use_dob= "1";
-    } else {
-      $this->use_dob= "0";
-    }
-
-    /* Put gender attribute to upper case */
-    if (isset ($this->attrs['gender'])){
-      $this->gender= strtoupper($this->attrs['gender'][0]);
-    }
-    $this->orig_base = $this->base;
-  }
-
-
-
-
-  /* execute generates the html output for this node */
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* Log view */
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","users/".get_class($this),$this->dn);
-    }
-
-    $smarty= get_smarty();
-
-    /* Fill calendar */
-    if ($this->dateOfBirth == "0"){
-      $date= getdate();
-    } else {
-      if(is_array($this->dateOfBirth)){
-        $date = $this->dateOfBirth;
-  
-        // Trigger on dates like 1985-04-01, getdate only understands timestamps
-      } else if (!empty($this->dateOfBirth) && !is_numeric($this->dateOfBirth)){
-        $date= getdate(strtotime($this->dateOfBirth));
-
-      } else {
-        $date = getdate($this->dateOfBirth);
-      }
-    }
-
-    $days= array();
-    for($d= 1; $d<32; $d++){
-      $days[$d]= $d;
-    }
-    $years= array();
-
-    if(($date['year']-100)<1901){
-      $start = 1901;
-    }else{
-      $start = $date['year']-100;
-    }
-
-    $end = $start +100;
-    
-    for($y= $start; $y<=$end; $y++){
-      $years[]= $y;
-    }
-    $years['-']= "-&nbsp;";
-    $months= array(_("January"), _("February"), _("March"), _("April"),
-        _("May"), _("June"), _("July"), _("August"), _("September"),
-        _("October"), _("November"), _("December"), '-' => '-&nbsp;');
-    $smarty->assign("day", $date["mday"]);
-    $smarty->assign("days", $days);
-    $smarty->assign("months", $months);
-    $smarty->assign("month", $date["mon"]-1);
-    $smarty->assign("years", $years);
-    $smarty->assign("year", $date["year"]);
-
-    /* Assign sex */
-    $sex= array(0 => "&nbsp;", "F" => _("female"), "M" => _("male"));
-    $smarty->assign("gender_list", $sex);
-    $language= array_merge(array(0 => "&nbsp;") ,get_languages(TRUE));
-    $smarty->assign("preferredLanguage_list", $language);
-
-    /* Get random number for pictures */
-    srand((double)microtime()*1000000); 
-    $smarty->assign("rand", rand(0, 10000));
-
-
-    /* Do we represent a valid gosaAccount? */
-    if (!$this->is_account){
-      echo "<img alt=\"\" src=\"images/stop.png\" align=\"middle\">&nbsp;<b>".
-        _("This account has no valid GOsa extensions.")."</b>";
-      return;
-    }
-
-    /* Base select dialog */
-    $once = true;
-    foreach($_POST as $name => $value){
-      if(preg_match("/^chooseBase/",$name) && $once){
-        $once = false;
-        $this->dialog = new baseSelectDialog($this->config,$this,$this->allowedBasesToMoveTo());
-        $this->dialog->setCurrentBase($this->base);
-      }
-    }
-
-    /* Password configure dialog handling */
-    if(is_object($this->pwObject) && $this->pwObject->display){
-      $output= $this->pwObject->configure();
-      if ($output != ""){
-        $this->dialog= TRUE;
-        return $output;
-      }
-      $this->dialog= false;
-    }
-
-    /* Dialog handling */
-    if(is_object($this->dialog)){
-      /* Must be called before save_object */
-      $this->dialog->save_object();
-   
-      if($this->dialog->isClosed()){
-        $this->dialog = false;
-      }elseif($this->dialog->isSelected()){
-
-        /* check if selected base is allowed to move to / create a new object */
-        $tmp = $this->get_allowed_bases();
-        if(isset($tmp[$this->dialog->isSelected()])){
-          $this->base = $this->dialog->isSelected();
-        }
-        $this->dialog= false;
-      }else{
-        return($this->dialog->execute());
-      }
-    }
-
-    /* Want password method editing? */
-    if ($this->acl_is_writeable("userPassword")){
-      if (isset($_POST['edit_pw_method'])){
-        if (!is_object($this->pwObject) || $this->pw_storage != $this->pwObject->get_hash_name()){
-          $temp= passwordMethod::get_available_methods();
-          $this->pwObject= new $temp[$this->pw_storage]($this->config,$this->dn);
-        }
-        $this->pwObject->display = TRUE;
-        $this->dialog= TRUE;
-        return ($this->pwObject->configure());
-      }
-    }
-
-    /* Want picture edit dialog? */
-    if($this->acl_is_writeable("userPicture")) {
-      if (isset($_POST['edit_picture'])){
-        /* Save values for later recovery, in case some presses
-           the cancel button. */
-        $this->old_jpegPhoto= $this->jpegPhoto;
-        $this->old_photoData= $this->photoData;
-        $this->picture_dialog= TRUE;
-        $this->dialog= TRUE;
-      }
-    }
-
-    /* Remove picture? */
-    if($this->acl_is_writeable("userPicture",(!is_object($this->parent) && !isset($_SESSION['edit']))) ){
-      if (isset($_POST['picture_remove'])){
-        $this->set_picture ();
-        $this->jpegPhoto= "*removed*";
-        $this->is_modified= TRUE;
-        return($smarty->fetch (get_template_path('generic_picture.tpl', TRUE, dirname(__FILE__))));
-      }
-    }
-
-    /* Save picture */
-    if (isset($_POST['picture_edit_finish'])){
-
-      /* Check for clean upload */
-      if ($_FILES['picture_file']['name'] != ""){
-        if (!is_uploaded_file($_FILES['picture_file']['tmp_name'])) {
-          print_red(_("The specified file has not been uploaded via HTTP POST! Aborted."));
-        }else{
-          /* Activate new picture */
-          $this->set_picture($_FILES['picture_file']['tmp_name']);
-        }
-      }
-      $this->picture_dialog= FALSE;
-      $this->dialog= FALSE;
-      $this->is_modified= TRUE;
-    }
-
-
-    /* Cancel picture */
-    if (isset($_POST['picture_edit_cancel'])){
-
-      /* Restore values */
-      $this->jpegPhoto= $this->old_jpegPhoto;
-      $this->photoData= $this->old_photoData;
-
-      /* Update picture */
-      $_SESSION['binary']= $this->photoData;
-      $_SESSION['binarytype']= "image/jpeg";
-      $this->picture_dialog= FALSE;
-      $this->dialog= FALSE;
-    }
-
-    /* Toggle dateOfBirth information */
-    if (isset($_POST['set_dob'])){
-      $this->use_dob= ($this->use_dob == "0")?"1":"0";
-    }
-
-
-    /* Want certificate= */
-    if ((isset($_POST['edit_cert'])) && $this->acl_is_readable("Certificate")){
-
-      /* Save original values for later reconstruction */
-      foreach (array("certificateSerialNumber", "userCertificate",
-            "userSMIMECertificate", "userPKCS12") as $val){
-
-        $oval= "old_$val";
-        $this->$oval= $this->$val;
-      }
-
-      $this->cert_dialog= TRUE;
-      $this->dialog= TRUE;
-    }
-
-
-    /* Cancel certificate dialog */
-    if (isset($_POST['cert_edit_cancel'])){
-
-      /* Restore original values in case of 'cancel' */
-      foreach (array("certificateSerialNumber", "userCertificate",
-            "userSMIMECertificate", "userPKCS12") as $val){
-
-        $oval= "old_$val";
-        $this->$val= $this->$oval;
-      }
-      $this->cert_dialog= FALSE;
-      $this->dialog= FALSE;
-    }
-
-
-    /* Remove certificate? */
-    if($this->acl_is_writeable("Certificate",(!is_object($this->parent) && !isset($_SESSION['edit'])))){ 
-      foreach (array ("userCertificate", "userSMIMECertificate", "userPKCS12") as $val){
-        if (isset($_POST["remove_$val"])){
-
-          /* Reset specified cert*/
-          $this->$val= "";
-          $this->is_modified= TRUE;
-        }
-      }
-    }
-
-    /* Upload new cert and close dialog? */    
-    if($this->acl_is_writeable("Certificate",(!is_object($this->parent) && !isset($_SESSION['edit'])))){ 
-      if (isset($_POST['cert_edit_finish'])){
-
-        /* for all certificates do */
-        foreach (array ("userCertificate", "userSMIMECertificate", "userPKCS12")
-            as $val){
-
-          /* Check for clean upload */
-          if (array_key_exists($val."_file", $_FILES) &&
-              array_key_exists('name', $_FILES[$val."_file"]) &&
-              $_FILES[$val."_file"]['name'] != "" &&
-              is_uploaded_file($_FILES[$val."_file"]['tmp_name'])) {
-            $this->set_cert("$val", $_FILES[$val."_file"]['tmp_name']);
-          }
-        }
-
-        /* Save serial number */
-        if (isset($_POST["certificateSerialNumber"]) &&
-            $_POST["certificateSerialNumber"] != ""){
-
-          if (!is_id($_POST["certificateSerialNumber"])){
-            print_red (_("Please enter a valid serial number"));
-
-            foreach(array("userCertificate", "userSMIMECertificate", "userPKCS12") as $cert){
-              if ($this->$cert != ""){
-                $smarty->assign("$cert"."_state", "true");
-              } else {
-                $smarty->assign("$cert"."_state", "");
-              }
-            }
-            return ($smarty->fetch (get_template_path('generic_certs.tpl', TRUE, dirname(__FILE__))));
-          }
-
-          $this->certificateSerialNumber= $_POST["certificateSerialNumber"];
-          $this->is_modified= TRUE;
-        }
-
-        $this->cert_dialog= FALSE;
-        $this->dialog= FALSE;
-      }
-    }
-    /* Display picture dialog */
-    if ($this->picture_dialog){
-      return($smarty->fetch (get_template_path('generic_picture.tpl', TRUE, dirname(__FILE__))));
-    }
-
-    /* Display cert dialog */
-    if ($this->cert_dialog){
-      $smarty->assign("CertificateACL",$this->getacl("Certificate",(!is_object($this->parent) && !isset($_SESSION['edit']))));
-      $smarty->assign("Certificate_readable",$this->acl_is_readable("Certificate"));
-
-      foreach(array("userCertificate", "userSMIMECertificate", "userPKCS12") as $cert){
-        if ($this->$cert != ""){
-          /* import certificate */
-          $certificate = new certificate;
-          $certificate->import($this->$cert);
-      
-          /* Read out data*/
-          $timeto   = $certificate->getvalidto_date();
-          $timefrom = $certificate->getvalidfrom_date();
-         
-          
-          /* Additional info if start end time is '0' */
-          $add_str_info = "";
-          if($timeto == 0 && $timefrom == 0){
-            $add_str_info = "<br><i>"._("(Some types of certificates are currently not supported and may be displayed as 'invalid'.)")."</i>";
-          }
-
-          $str = "<table summary=\"\" border=0>
-                    <tr>
-                      <td style='vertical-align:top'>CN</td>
-                      <td>".preg_replace("/ /", "&nbsp;", $certificate->getname())."</td>
-                    </tr>
-                  </table><br>".
-
-                  sprintf(_("Certificate is valid from %s to %s and is currently %s."),
-                        "<b>".date('d M Y',$timefrom)."</b>",
-                        "<b>".date('d M Y',$timeto)."</b>",
-                        $certificate->isvalid()?"<b><font style='color:green'>"._("valid")."</font></b>":
-                                                "<b><font style='color:red'>"._("invalid")."</font></b>").$add_str_info;
-
-          $smarty->assign($cert."info",$str);
-          $smarty->assign($cert."_state","true");
-        } else {
-          $smarty->assign($cert."info", "<i>"._("No certificate installed")."</i>");
-          $smarty->assign($cert."_state","");
-        }
-      }
-      $smarty->assign("governmentmode", "false");
-      return($smarty->fetch (get_template_path('generic_certs.tpl', TRUE, dirname(__FILE__))));
-    }
-
-    /* Prepare password hashes */
-    if ($this->pw_storage == ""){
-      $this->pw_storage= $this->config->current['HASH'];
-    }
-
-    $temp= passwordMethod::get_available_methods();
-    $is_configurable= FALSE;
-    $hashes = $temp['name'];
-    if(isset($temp[$this->pw_storage])){
-      $test= new $temp[$this->pw_storage]($this->config);
-      $is_configurable= $test->is_configurable();
-    }else{
-      new msg_dialog(_("Password method"),_("The selected password method is no longer available."),WARNING_DIALOG);
-    }
-    
-    /* Load attributes and acl's */
-    $ui =get_userinfo();
-    foreach($this->attributes as $val){
-      $smarty->assign("$val", $this->$val);
-      if(in_array($val,$this->multi_boxes)){
-        $smarty->assign("use_".$val,TRUE);
-      }else{
-        $smarty->assign("use_".$val,FALSE);
-      }
-    }
-    foreach(array("base","pw_storage","edit_picture") as $val){
-      if(in_array($val,$this->multi_boxes)){
-        $smarty->assign("use_".$val,TRUE);
-      }else{
-        $smarty->assign("use_".$val,FALSE);
-      }
-    }
-
-    /* Set acls */
-    $tmp = $this->plinfo();
-    foreach($tmp['plProvidedAcls'] as $val => $translation){
-      $smarty->assign("$val"."ACL", $this->getacl($val,(!is_object($this->parent) && !isset($_SESSION['edit']))));
-    }
-
-    $smarty->assign("pwmode", $hashes);
-    $smarty->assign("pwmode_select", $this->pw_storage);
-    $smarty->assign("pw_configurable", $is_configurable);
-    $smarty->assign("passwordStorageACL", $this->getacl("userPassword",(!is_object($this->parent) && !isset($_SESSION['edit']))));
-    $smarty->assign("base_select",      $this->base);
-    $smarty->assign("CertificatesACL",  $this->getacl("Certificate",(!is_object($this->parent) && !isset($_SESSION['edit']))));
-    $smarty->assign("userPictureACL",   $this->getacl("userPicture",(!is_object($this->parent) && !isset($_SESSION['edit']))));
-    $smarty->assign("userPicture_is_readable",   $this->acl_is_readable("userPicture",(!is_object($this->parent) && !isset($_SESSION['edit']))));
-
-    /* Create base acls */
-    $tmp = @$this->allowedBasesToMoveTo();
-    $smarty->assign("bases", $tmp);
-
-    /* Save government mode attributes */
-    if (isset($this->config->current['GOVERNMENTMODE']) &&
-        preg_match('/true/i', $this->config->current['GOVERNMENTMODE'])){
-      $smarty->assign("governmentmode", "true");
-      $ivbbmodes= array("nein", "ivbv", "testa", "ivbv,testa", "internet",
-          "internet,ivbv", "internet,testa", "internet,ivbv,testa");
-      $smarty->assign("ivbbmodes", $ivbbmodes);
-      foreach ($this->govattrs as $val){
-        $smarty->assign("$val", $this->$val);
-        $smarty->assign("$val"."ACL", $this->getacl($val,(!is_object($this->parent) && !isset($_SESSION['edit']))));
-      }
-    } else {
-      $smarty->assign("governmentmode", "false");
-    }
-
-    /* Special mode for uid */
-    $uidACL= $this->getacl("uid",(!is_object($this->parent) && !isset($_SESSION['edit'])));
-    if (isset ($this->dn)){
-      if ($this->dn != "new"){
-        $uidACL= preg_replace("/w/","",$uidACL);
-      }
-    }  else {
-      $uidACL= preg_replace("/w/","",$uidACL);
-    }
-    
-    $smarty->assign("uidACL", $uidACL);
-    $smarty->assign("is_template", $this->is_template);
-    $smarty->assign("use_dob", $this->use_dob);
-
-    if (isset($this->parent)){
-      if (isset($this->parent->by_object['phoneAccount']) &&
-          $this->parent->by_object['phoneAccount']->is_account){
-        $smarty->assign("has_phoneaccount", "true");
-      } else {
-        $smarty->assign("has_phoneaccount", "false");
-      }
-    } else {
-      $smarty->assign("has_phoneaccount", "false");
-    }
-    $smarty->assign("multiple_support" , $this->multiple_support_active);
-    return($smarty->fetch (get_template_path('generic.tpl', TRUE, dirname(__FILE__))));
-  }
-
-
-  /* remove object from parent */
-  function remove_from_parent()
-  {
-    /* Remove password extension */
-    $temp= passwordMethod::get_available_methods();
-    $this->pwObject= new $temp[$this->pw_storage]($this->config,$this->dn);
-    $this->pwObject->remove_from_parent();
-
-    /* Remove user */
-    $ldap= $this->config->get_ldap_link();
-    $ldap->rmdir ($this->dn);
-    show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/generic account with dn '%s' failed."),$this->dn));
-  
-    new log("remove","users/".get_class($this),$this->dn,$this->attributes,$ldap->get_error());
-  
-    /* Delete references to groups */
-    $ldap->cd ($this->config->current['BASE']);
-    $ldap->search ("(&(objectClass=posixGroup)(memberUid=".$this->uid."))", array("uid"));
-    while ($ldap->fetch()){
-      $g= new group($this->config, $ldap->getDN());
-      $g->removeUser($this->uid);
-      $g->save ();
-    }
-
-    /* Delete references to object groups */
-    $ldap->cd ($this->config->current['BASE']);
-    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
-    while ($ldap->fetch()){
-      $og= new ogroup($this->config, $ldap->getDN());
-      unset($og->member[$this->dn]);
-      $og->save ();
-    }
-
-    /* If needed, let the password method do some cleanup */
-    $tmp = new passwordMethod($_SESSION['config']);
-    $available = $tmp->get_available_methods();
-    if (in_array_ics($this->pw_storage, $available['name'])){
-      $test= new $available[$this->pw_storage]($this->config);
-      $test->attrs= $this->attrs;
-      $test->dn= $this->dn;
-      $test->remove_from_parent();
-    }
-
-    /* Remove ACL dependencies too */
-    $tmp = new acl($this->config,$this->parent,$this->dn);
-    $tmp->remove_acl();
-
-    /* Optionally execute a command after we're done */
-    $this->handle_post_events("remove",array("uid" => $this->uid));
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    if(isset($_POST['generic']) || isset($_POST['multiple_user_posted'])){
-
-      /* Make a backup of the current selected base */
-      $base_tmp = $this->base;
-
-      /* Parents save function */
-      plugin::save_object ();
-
-      /* Save government mode attributes */
-      if ($this->config->current['GOVERNMENTMODE']){
-        foreach ($this->govattrs as $val){
-          if ($this->acl_is_writeable($val,(!is_object($this->parent) && !isset($_SESSION['edit']))) && isset($_POST["$val"])){
-            $data= stripcslashes($_POST["$val"]);
-            if ($data != $this->$val){
-              $this->is_modified= TRUE;
-            }
-            $this->$val= $data;
-          }
-        }
-      }
-
-      /* In template mode, the uid is autogenerated... */
-      if ($this->is_template){
-        $this->uid= strtolower($this->sn);
-        $this->givenName= $this->sn;
-      }
-
-      /* Save base and pw_storage, since these are no LDAP attributes */
-      if (isset($_POST['base'])){
-
-        $tmp = $this->get_allowed_bases();
-        if(isset($tmp[$_POST['base']])){
-          $base= validate($_POST['base']);
-          if ($base != $this->base){
-            $this->is_modified= TRUE;
-          }
-          $this->base= $base;
-        }else{
-          $this->base = $base_tmp;
-          print_red(sprintf(_("You are not allowed to move this object to '%s'."),LDAP::fix($_POST['base'])));
-          $this->set_acl_base('dummy,'.$this->base);
-        }
-      }
-
-      /* Get pw_storage mode */
-      if (isset($_POST['pw_storage'])){
-        foreach(array("pw_storage") as $val){
-          if(isset($_POST[$val])){
-            $data= validate($_POST[$val]);
-            if ($data != $this->$val){
-              $this->is_modified= TRUE;
-            }
-            $this->$val= $data;
-          }
-        }
-      }
-
-      $this->set_acl_base('dummy,'.$this->base);
-    }
-  }
-
-  function rebind($ldap, $referral)
-  {
-    $credentials= LDAP::get_credentials($referral, $this->config->current['REFERRAL']);
-    if (ldap_bind($ldap, $credentials['ADMIN'], $credentials['PASSWORD'])) {
-      $this->error = "Success";
-      $this->hascon=true;
-      $this->reconnect= true;
-      return (0);
-    } else {
-      $this->error = "Could not bind to " . $credentials['ADMIN'];
-      return NULL;
-    }
-  }
-
-  
-  /* Save data to LDAP, depending on is_account we save or delete */
-  function save()
-  {
-    /* Only force save of changes .... 
-       If this attributes aren't changed, avoid saving.
-     */
-    if($this->gender=="0") $this->gender ="";
-    if($this->preferredLanguage=="0") $this->preferredLanguage ="";
-
-    /* First use parents methods to do some basic fillup in $this->attrs */
-    plugin::save ();
-
-    if ($this->use_dob == "1"){
-      /* If it is an array, the generic page has never been loaded - so there's no difference. Using an array would cause an error btw. */
-      if(!is_array($this->attrs['dateOfBirth'])) {
-        $this->attrs['dateOfBirth'] = date("Y-m-d", $this->dateOfBirth);
-      }
-    }
-
-    /* Remove additional objectClasses */
-    $tmp= array();
-    foreach ($this->attrs['objectClass'] as $key => $set){
-      $found= false;
-      foreach (array("ivbbentry", "gosaUserTemplate") as $val){
-        if (preg_match ("/^$set$/i", $val)){
-          $found= true;
-          break;
-        }
-      }
-      if (!$found){
-        $tmp[]= $set;
-      }
-    }
-
-    /* Replace the objectClass array. This is done because of the
-       separation into government and normal mode. */
-    $this->attrs['objectClass']= $tmp;
-
-    /* Add objectClasss for template mode? */
-    if ($this->is_template){
-      $this->attrs['objectClass'][]= "gosaUserTemplate";
-    }
-
-    /* Hard coded government mode? */
-    if ($this->config->current['GOVERNMENTMODE'] != 'false'){
-      $this->attrs['objectClass'][]= "ivbbentry";
-
-      /* Copy standard attributes */
-      foreach ($this->govattrs as $val){
-        if ($this->$val != ""){
-          $this->attrs["$val"]= $this->$val;
-        } elseif (!$this->is_new) {
-          $this->attrs["$val"]= array();
-        }
-      }
-
-      /* Remove attribute if set to "nein" */
-      if ($this->publicVisible == "nein"){
-        $this->attrs['publicVisible']= array();
-        if($this->is_new){
-          unset($this->attrs['publicVisible']);
-        }else{
-          $this->attrs['publicVisible']=array();
-        }
-
-      }
-
-    }
-
-    /* Special handling for attribute userCertificate needed */
-    if ($this->userCertificate != ""){
-      $this->attrs["userCertificate;binary"]= $this->userCertificate;
-      $remove_userCertificate= false;
-    } else {
-      $remove_userCertificate= true;
-    }
-
-    /* Special handling for dateOfBirth value */
-    if ($this->use_dob != "1"){
-      if ($this->is_new) {
-        unset($this->attrs["dateOfBirth"]);
-      } else {
-        $this->attrs["dateOfBirth"]= array();
-      }
-    }
-    if (!$this->gender){
-      if ($this->is_new) {
-        unset($this->attrs["gender"]);
-      } else {
-        $this->attrs["gender"]= array();
-      }
-    }
-    if (!$this->preferredLanguage){
-      if ($this->is_new) {
-        unset($this->attrs["preferredLanguage"]);
-      } else {
-        $this->attrs["preferredLanguage"]= array();
-      }
-    }
-
-    /* Special handling for attribute jpegPhote needed, scale image via
-       image magick to 147x200 pixels and inject resulting data. */
-    if ($this->jpegPhoto == "*removed*"){
-    
-      /* Reset attribute to avoid writing *removed* as value */    
-      $this->attrs["jpegPhoto"] = array();
-
-    } else {
-
-      /* Fallback if there's no image magick inside PHP */
-      if (!function_exists("imagick_blob2image")){
-        /* Get temporary file name for conversation */
-        $fname = tempnam ("/tmp", "GOsa");
-  
-        /* Open file and write out photoData */
-        $fp = fopen ($fname, "w");
-        fwrite ($fp, $this->photoData);
-        fclose ($fp);
-
-        /* Build conversation query. Filename is generated automatically, so
-           we do not need any special security checks. Exec command and save
-           output. For PHP safe mode, you'll need a configuration which respects
-           image magick as executable... */
-        $query= "convert -size 147x200 $fname -resize 147x200 +profile \"*\" -";
-        @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__,
-            $query, "Execute");
-  
-        /* Read data written by convert */
-        $output= "";
-        $sh= popen($query, 'r');
-        while (!feof($sh)){
-          $output.= fread($sh, 4096);
-        }
-        pclose($sh);
-
-        unlink($fname);
-
-        /* Save attribute */
-        $this->attrs["jpegPhoto"] = $output;
-
-      } else {
-
-        /* Load the new uploaded Photo */
-        if(!$handle  =  imagick_blob2image($this->photoData))  {
-          new log("debug","users/".get_class($this),$this->dn,array(),"Could not access uploaded image");
-        }
-
-        /* Resizing image to 147x200 and blur */
-        if(!imagick_resize($handle,147,200,IMAGICK_FILTER_GAUSSIAN,0)){
-          new log("debug","users/".get_class($this),$this->dn,array(),"Could not resize uploaded image");
-        }
-
-        /* Converting image to JPEG */
-        if(!imagick_convert($handle,"JPEG")) {
-          new log("debug","users/".get_class($this),$this->dn,array(),"Could not convert uploaded image to jepg");
-        }
-
-        /* Creating binary Code for the Image */
-        if(!$dump = imagick_image2blob($handle)){
-          new log("debug","users/".get_class($this),$this->dn,array(),"Could not create new user image");
-        }
-
-        /* Sending Image */
-        $output=  $dump;
-
-        /* Save attribute */
-        $this->attrs["jpegPhoto"] = $output;
-      }
-
-    }
-
-    /* This only gets called when user is renaming himself */
-    $ldap= $this->config->get_ldap_link();
-    if ($this->dn != $this->new_dn){
-
-      /* Write entry on new 'dn' */
-      $this->update_acls($this->dn,$this->new_dn);
-      $this->move($this->dn, $this->new_dn);
-
-      /* Happen to use the new one */
-      change_ui_dn($this->dn, $this->new_dn);
-      $this->dn= $this->new_dn;
-    }
-
-
-    /* Save data. Using 'modify' implies that the entry is already present, use 'add' for
-       new entries. So do a check first... */
-    $ldap->cat ($this->dn, array('dn'));
-    if ($ldap->fetch()){
-      $mode= "modify";
-    } else {
-      $mode= "add";
-      $ldap->cd($this->config->current['BASE']);
-      $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
-    }
-
-    /* Set password to some junk stuff in case of templates */
-    if ($this->is_template){
-      $this->attrs['userPassword']= '{crypt}N0T$3T4N0W';
-    }
-
-    @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
-        $this->attributes, "Save via $mode");
-
-    /* Finally write data with selected 'mode' */
-    $this->cleanup();
-
-    if(isset($this->attrs['preferredLanguage'])){
-      $_SESSION['ui']->language = $this->preferredLanguage;
-      $_SESSION['Last_init_lang'] = "update";
-    }
-
-    $ldap->cd ($this->dn);
-    $ldap->$mode ($this->attrs);
-    if (show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/generic account with dn '%s' failed."),$this->dn))){
-      return (1);
-    }
-
-    /* Remove ACL dependencies too */
-    if($this->dn != $this->orig_dn && $this->orig_dn != "new"){
-      $tmp = new acl($this->config,$this->parent,$this->dn);
-      $tmp->update_acl_membership($this->orig_dn,$this->dn);
-    }
-
-    if($mode == "modify"){
-      new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }else{
-      new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }
-
-    /* Remove cert? 
-       For some reason, the 'ldap' class doesn't want to remove binary entries, so I need
-       to work around myself. */
-    if ($remove_userCertificate == true && !$this->is_new && $this->had_userCertificate){
-
-      /* Reset array, assemble new, this should be reworked */
-      $this->attrs= array();
-      $this->attrs['userCertificate;binary']= array();
-
-      /* Prepare connection */
-      if (!($ds = ldap_connect($this->config->current['SERVER']))) {
-        die ("Could not connect to LDAP server");
-      }
-      ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
-      if (function_exists("ldap_set_rebind_proc") && isset($this->config->current['RECURSIVE']) && $this->config->current['RECURSIVE'] == "true") {
-        ldap_set_option($this->cid, LDAP_OPT_REFERRALS, 1);
-        ldap_set_rebind_proc($ds, array(&$this, "rebind"));
-      }
-      if(isset($config->current['TLS']) && $config->current['TLS'] == "true"){
-        ldap_start_tls($ds);
-      }
-      if (!($res = @ldap_bind($ds, $this->config->current['ADMIN'],
-              $this->config->current['PASSWORD']))) {
-        die ("Could not bind to LDAP");
-      }
-
-      /* Modify using attrs */
-      ldap_mod_del($ds,$this->dn,$this->attrs);
-      ldap_close($ds);
-    }
-
-    /* If needed, let the password method do some cleanup */
-    if ($this->pw_storage != $this->last_pw_storage){
-      $tmp = new passwordMethod($_SESSION['config']);
-      $available = $tmp->get_available_methods();
-      if (in_array_ics($this->last_pw_storage, $available['name'])){
-        $test= new $available[$this->last_pw_storage]($this->config,$this->dn);
-        $test->attrs= $this->attrs;
-        $test->remove_from_parent();
-      }
-    }
-
-    /* Maybe the current password method want's to do some changes... */
-    if (is_object($this->pwObject)){
-      $this->pwObject->save($this->dn);
-    }
-
-    /* Optionally execute a command after we're done */
-    if ($mode == "add"){
-      $this->handle_post_events("add", array("uid" => $this->uid));
-    } elseif ($this->is_modified){
-      $this->handle_post_events("modify", array("uid" => $this->uid));
-    }
-
-    /* Fix tagging if needed */
-    $this->handle_object_tagging();
-
-    return (0);
-  }
-
-  
-  function update_new_dn()
-  {
-    $pt= "";
-    if(isset($this->config->current['INCLUDE_PERSONAL_TITLE']) && preg_match("/true/i",$this->config->current['INCLUDE_PERSONAL_TITLE'])){
-      if(!empty($this->personalTitle)){
-        $pt = $this->personalTitle." ";
-      }
-    }
-    $this->cn= $pt.$this->givenName." ".$this->sn;
-
-    /* Permissions for that base? */
-    if (isset($this->config->current['DNMODE']) && $this->config->current['DNMODE'] == "uid"){
-      $this->new_dn= 'uid='.$this->uid.','.get_people_ou().$this->base;
-    } else {
-      /* Don't touch dn, if cn hasn't changed */
-      if (isset($this->saved_attributes['cn']) && $this->saved_attributes['cn'] == $this->cn &&
-          $this->orig_base == $this->base ){
-        $this->new_dn= $this->dn;
-      } else {
-        $this->new_dn= $this->create_unique_dn('cn', get_people_ou().$this->base);
-      }
-    }
-  }
-  
-
-  /* Check formular input */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    $this->update_new_dn();
-
-    /* Set the new acl base */
-    if($this->dn == "new") {
-      $this->set_acl_base($this->base);
-    }
-
-    /* UID already used? */
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(uid=$this->uid)", array("uid"));
-    $ldap->fetch();
-    if ($ldap->count() != 0 && $this->dn == 'new'){
-      $message[]= _("There's already a person with this 'Login' in the database.");
-    }
-
-    /* In template mode, the uid and givenName are autogenerated... */
-    if (!$this->is_template){
-      if ($this->sn == ""){
-        $message[]= _("The required field 'Name' is not set.");
-      }
-      if ($this->givenName == ""){
-        $message[]= _("The required field 'Given name' is not set.");
-      }
-      if ($this->uid == ""){
-        $message[]= _("The required field 'Login' is not set.");
-      }
-      if (!(isset($this->config->current['DNMODE']) && $this->config->current['DNMODE'] == "uid")){
-        $ldap->cat($this->new_dn);
-        if ($ldap->count() != 0 && $this->dn != $this->new_dn && $this->dn == 'new'){
-          $message[]= _("There's already a person with this 'Name'/'Given name' combination in the database.");
-        }
-      }
-    }
-
-    /* Check for valid input */
-    if ($this->is_modified && !is_uid($this->uid)){
-      $message[]= _("The field 'Login' contains invalid characters. Lowercase, numbers and dashes are allowed.");
-    }
-    if (!is_url($this->labeledURI)){
-      $message[]= _("The field 'Homepage' contains an invalid URL definition.");
-    }
-    if (preg_match ("/[\\\\]/", $this->sn)){
-      $message[]= _("The field 'Name' contains invalid characters.");
-    }
-    if (preg_match ("/[\\\\]/", $this->givenName)){
-      $message[]= _("The field 'Given name' contains invalid characters.");
-    }
-
-    /* Check phone numbers */
-    if (!is_phone_nr($this->telephoneNumber)){
-      $message[]= _("The field 'Phone' contains an invalid phone number.");
-    }
-    if (!is_phone_nr($this->facsimileTelephoneNumber)){
-      $message[]= _("The field 'Fax' contains an invalid phone number.");
-    }
-    if (!is_phone_nr($this->mobile)){
-      $message[]= _("The field 'Mobile' contains an invalid phone number.");
-    }
-    if (!is_phone_nr($this->pager)){
-      $message[]= _("The field 'Pager' contains an invalid phone number.");
-    }
-
-    /* Check for reserved characers */
-    if (preg_match ('/[,+"?\'()=<>;]/', $this->givenName)){
-      $message[]= _("The field 'Given name' contains invalid characters.");
-  }
-  if (preg_match ('/[,+"?\'()=<>;]/', $this->sn)){
-    $message[]= _("The field 'Name' contains invalid characters.");
-  }
-
-  return $message;
-  }
-
-
-  /* Indicate whether a password change is needed or not */
-  function password_change_needed()
-  {
-    if(in_array("pw_storage",$this->multi_boxes)){
-      return(TRUE);
-    }
-    return($this->pw_storage != $this->last_pw_storage);
-  }
-
-
-  /* Load a jpegPhoto from LDAP, this is going to be simplified later on */
-  function load_picture()
-  {
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd ($this->dn);
-    $data = $ldap->get_attribute($this->dn,"jpegPhoto");
-
-    if((!$data) || ($data == "*removed*")){ 
-
-      /* In case we don't get an entry, load a default picture */
-      $this->set_picture ();//"./images/default.jpg");
-      $this->jpegPhoto= "*removed*";
-    }else{
-
-      /* Set picture */
-      $this->photoData= $data;
-      $_SESSION['binary']= $this->photoData;
-      $_SESSION['binarytype']= "image/jpeg";
-      $this->jpegPhoto= "";
-    }
-  }
-
-
-  /* Load a certificate from LDAP, this is going to be simplified later on */
-  function load_cert()
-  {
-    $ds= ldap_connect($this->config->current['SERVER']);
-    ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
-    if (function_exists("ldap_set_rebind_proc") && isset($this->config->current['RECURSIVE']) && $this->config->current['RECURSIVE'] == "true") {
-      ldap_set_option($this->cid, LDAP_OPT_REFERRALS, 1);
-      ldap_set_rebind_proc($ds, array(&$this, "rebind"));
-    }
-    if(isset($this->config->current['TLS']) &&
-        $this->config->current['TLS'] == "true"){
-
-      ldap_start_tls($ds);
-    }
-
-    $r= ldap_bind($ds);
-    $sr= @ldap_read($ds, $this->dn, "userCertificate=*", array("userCertificate"));
-
-    if ($sr) {
-      $ei= @ldap_first_entry($ds, $sr);
-      
-      if ($ei) {
-        if (!$info = @ldap_get_values_len($ds, $ei, "userCertificate;binary")){
-          $this->userCertificate= "";
-        } else {
-          $this->userCertificate= $info[0];
-        }
-      }
-    } else {
-      $this->userCertificate= "";
-    }
-
-    ldap_unbind($ds);
-  }
-
-
-  /* Load picture from file to object */
-  function set_picture($filename ="")
-  {
-    if (!is_file($filename) || $filename =="" ){
-      $filename= "./images/default.jpg";
-      $this->jpegPhoto= "*removed*";
-    }
-
-    $fd = fopen ($filename, "rb");
-    $this->photoData= fread ($fd, filesize ($filename));
-    $_SESSION['binary']= $this->photoData;
-    $_SESSION['binarytype']= "image/jpeg";
-    $this->jpegPhoto= "";
-
-    fclose ($fd);
-  }
-
-
-  /* Load certificate from file to object */
-  function set_cert($cert, $filename)
-  {
-    if(!$thsi->acl_is_writeable("Certificate",(!is_object($this->parent) && !isset($_SESSION['edit'])))) return;
-    $fd = fopen ($filename, "rb");
-    if (filesize($filename)>0) {
-      $this->$cert= fread ($fd, filesize ($filename));
-      fclose ($fd);
-      $this->is_modified= TRUE;
-    } else {
-      print_red(_("Could not open specified certificate!"));
-    }
-  }
-
-  /* Adapt from given 'dn' */
-  function adapt_from_template($dn)
-  {
-    plugin::adapt_from_template($dn);
-
-    /* Get base */
-    $this->base= preg_replace('/^[^,]+,'.get_people_ou().'/i', '', $dn);
-
-    if ($this->config->current['GOVERNMENTMODE']){
-
-      /* Walk through govattrs */
-      foreach ($this->govattrs as $val){
-
-        if (isset($this->attrs["$val"][0])){
-
-          /* If attribute is set, replace dynamic parts: 
-             %sn, %givenName and %uid. Fill these in our local variables. */
-          $value= $this->attrs["$val"][0];
-
-          foreach (array("sn", "givenName", "uid") as $repl){
-            if (preg_match("/%$repl/i", $value)){
-              $value= preg_replace ("/%$repl/i",
-                  $this->parent->$repl, $value);
-            }
-          }
-          $this->$val= $value;
-        }
-      }
-    }
-
-    /* Get back uid/sn/givenName */
-    if ($this->parent !== NULL){
-      $this->uid= $this->parent->uid;
-      $this->sn= $this->parent->sn;
-      $this->givenName= $this->parent->givenName;
-    }
-  }
-
-  /* This avoids that users move themselves out of their rights. 
-   */
-  function allowedBasesToMoveTo()
-  {
-    /* Get bases */
-    $bases  = $this->get_allowed_bases();
-    return($bases);
-  } 
-
-
-  function getCopyDialog()
-  {
-    $str = "";
-
-    $_SESSION['binary'] = $this->photoData; 
-    $_SESSION['binarytype']= "image/jpeg";
-
-    /* Get random number for pictures */
-    srand((double)microtime()*1000000); 
-    $rand = rand(0, 10000);
-
-    $smarty = get_smarty();
-
-    $smarty->assign("passwordTodo","clear");
-
-    if(isset($_POST['passwordTodo'])){
-      $smarty->assign("passwordTodo",$_POST['passwordTodo']);
-    }
-
-    $smarty->assign("sn",       $this->sn);
-    $smarty->assign("givenName",$this->givenName);
-    $smarty->assign("uid",      $this->uid);
-    $smarty->assign("rand",     $rand);
-    $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE,dirname(__FILE__)));
-
-
-    $ret = array();
-    $ret['string'] = $str;
-    $ret['status'] = "";  
-    return($ret);
-  }
-
-  function saveCopyDialog()
-  {
-    /* Set_acl_base */
-    $this->set_acl_base("cn=dummy,".get_people_ou().$this->base);
-
-    if((isset($_FILES['picture_file']['tmp_name'])) && ($_FILES['picture_file']['size'] > 0)){
-      $this->set_picture($_FILES['picture_file']['tmp_name']);
-    }
-
-    /* Remove picture? */
-    if (isset($_POST['picture_remove'])){
-      $this->jpegPhoto= "*removed*";
-      $this->set_picture ("./images/default.jpg");
-      $this->is_modified= TRUE;
-    }
-
-    $attrs = array("uid","givenName","sn");
-    foreach($attrs as $attr){
-      if(isset($_POST[$attr])){
-        $this->$attr = $_POST[$attr];
-      }
-    } 
-  }
-
-
-  function PrepareForCopyPaste($source)
-  {
-    plugin::PrepareForCopyPaste($source);
-
-    /* Reset certificate information addepted from source user
-       to avoid setting the same user certificate for the destination user. */
-    $this->userPKCS12= "";
-    $this->userSMIMECertificate= "";
-    $this->userCertificate= "";
-    $this->certificateSerialNumber= "";
-    $this->old_certificateSerialNumber= "";
-    $this->old_userPKCS12= "";
-    $this->old_userSMIMECertificate= "";
-    $this->old_userCertificate= "";
-  }
-
-
-  static function plInfo()
-  {
-  
-    $govattrs= array(
-        "gouvernmentOrganizationalUnit"             =>  _("Unit"), 
-        "houseIdentifier"                           =>  _("House identifier"), 
-        "vocation"                                  =>  _("Vocation"),
-        "ivbbLastDeliveryCollective"                =>  _("Last delivery"), 
-        "gouvernmentOrganizationalPersonLocality"   =>  _("Person locality"),
-        "gouvernmentOrganizationalUnitDescription"  =>  _("Unit description"),
-        "gouvernmentOrganizationalUnitSubjectArea"  =>  _("Subject area"),
-        "functionalTitle"                           =>  _("Functional title"),
-        "certificateSerialNumber"                   =>  _("Certificate serial number"),
-        "publicVisible"                             =>  _("Public visible"),
-        "street"                                    =>  _("Street"),
-        "role"                                      =>  _("Role"),
-        "postalCode"                                =>  _("Postal code"));
-
-    $ret = array(
-        "plShortName" => _("Generic"),
-        "plDescription" => _("Generic user settings"),
-        "plSelfModify"  => TRUE,
-        "plDepends"     => array(),
-        "plPriority"    => 1,
-        "plSection"     => array("personal" => _("My account")),
-        "plCategory"    => array("users" => array("description" => _("Users"),
-                                                  "objectClass" => "gosaAccount")),
-
-        "plProvidedAcls" => array(
-          "base"              => _("Base"), 
-          "userPassword"      => _("User password"), 
-          "sn"                => _("Surename"),
-          "givenName"         => _("Given name"),
-          "uid"               => _("User identification"),
-          "personalTitle"     => _("Personal title"),
-          "academicTitle"     => _("Academic title"),
-          "homePostalAddress" => _("Home postal address"),
-          "homePhone"         => _("Home phone number"),
-          "labeledURI"        => _("Homepage"),
-          "o"                 => _("Organization"),
-          "ou"                => _("Department"),
-          "dateOfBirth"       => _("Date of birth"),
-          "gender"            => _("Gender"),
-          "preferredLanguage" => _("Preferred language"),
-          "departmentNumber"  => _("Department number"),
-          "employeeNumber"    => _("Employee number"),
-          "employeeType"      => _("Employee type"),
-          "l"                 => _("Location"),
-          "st"                => _("State"),
-          "userPicture"       => _("User picture"),
-          "roomNumber"        => _("Room number"),
-          "telephoneNumber"   => _("Telefon number"),
-          "mobile"            => _("Mobile number"),
-          "pager"             => _("Pager number"),
-          "Certificate"        => _("User certificates"),
-
-          "postalAddress"                => _("Postal address"),
-          "facsimileTelephoneNumber"     => _("Fax number"))
-        );
-
-    /* Append government attributes if required */
-      global $config;
-    if (isset($config->current['GOVERNMENTMODE']) &&  preg_match('/true/i', $config->current['GOVERNMENTMODE'])){
-      foreach($govattrs as $attr => $desc){
-        $ret["plProvidedAcls"][$attr] = $desc;
-      }
-    }
-    return($ret);
-  }
-
-  function get_multi_edit_values()
-  {
-    $ret = plugin::get_multi_edit_values();
-    if(in_array("pw_storage",$this->multi_boxes)){
-      $ret['pw_storage'] = $this->pw_storage;
-    }
-    if(in_array("edit_picture",$this->multi_boxes)){
-      $ret['jpegPhoto'] = $this->jpegPhoto;
-      $ret['photoData'] = $this->photoData;
-      $ret['old_jpegPhoto'] = $this->old_jpegPhoto;
-      $ret['old_photoData'] = $this->old_photoData;
-    }
-    if(isset($ret['dateOfBirth'])){
-      unset($ret['dateOfBirth']);
-    }
-    if(isset($ret['cn'])){
-      unset($ret['cn']);
-    }
-    $ret['is_modified'] = $this->is_modified;
-    if(in_array("base",$this->multi_boxes)){
-      $ret['orig_base']="Changed_by_Multi_Plug";
-      $ret['base']=$this->base;
-    }
-    return($ret); 
-  }
-
-
-  function multiple_save_object()
-  {
-    plugin::multiple_save_object();
-
-    /* Get pw_storage mode */
-    if (isset($_POST['pw_storage'])){
-      foreach(array("pw_storage") as $val){
-        if(isset($_POST[$val])){
-          $data= validate(get_post($val));
-          if ($data != $this->$val){
-            $this->is_modified= TRUE;
-          }
-          $this->$val= $data;
-        }
-      }
-    }
-    if(isset($_POST['base'])){
-      $this->base = get_post('base');
-    }
-
-    if(isset($_POST['user_mulitple_edit'])){
-      foreach(array("base","pw_storage","edit_picture") as $val){
-        if(isset($_POST["use_".$val])){
-          $this->multi_boxes[] = $val;
-        }
-      }
-    }
-  }
-
-  
-  function multiple_check()
-  {
-    /* Call check() to set new_dn correctly ... */
-    $message = plugin::multiple_check();
-
-    /* Set the new acl base */
-    if($this->dn == "new") {
-      $this->set_acl_base($this->base);
-    }
-    if (!is_url($this->labeledURI) && in_array("labeledURI",$this->multi_boxes)){
-      $message[]= _("The field 'Homepage' contains an invalid URL definition.");
-    }
-    if (preg_match ("/[\\\\]/", $this->sn) && in_array("sn",$this->multi_boxes)){
-      $message[]= _("The field 'Name' contains invalid characters.");
-    }
-    if (preg_match ("/[\\\\]/", $this->givenName) && in_array("givenName",$this->multi_boxes)){
-      $message[]= _("The field 'Given name' contains invalid characters.");
-    }
-    if (!is_phone_nr($this->telephoneNumber) && in_array("telephoneNumber",$this->multi_boxes)){
-      $message[]= _("The field 'Phone' contains an invalid phone number.");
-    }
-    if (!is_phone_nr($this->facsimileTelephoneNumber) &&  in_array("facsimileTelephoneNumber",$this->multi_boxes)){
-      $message[]= _("The field 'Fax' contains an invalid phone number.");
-    }
-    if (!is_phone_nr($this->mobile) && in_array("mobile",$this->multi_boxes)){
-      $message[]= _("The field 'Mobile' contains an invalid phone number.");
-    }
-    if (!is_phone_nr($this->pager) && in_array("pager",$this->multi_boxes)){
-      $message[]= _("The field 'Pager' contains an invalid phone number.");
-    }
-    if (preg_match ('/[,+"?\'()=<>;]/', $this->givenName) && in_array("givenName",$this->multi_boxes)){
-      $message[]= _("The field 'Given name' contains invalid characters.");
-    }
-    if (preg_match ('/[,+"?\'()=<>;]/', $this->sn) && in_array("sn",$this->multi_boxes)){
-      $message[]= _("The field 'Name' contains invalid characters.");
-    }
-    return($message);
-  }
-
-
-
-  function multiple_execute()
-  {
-    return($this->execute());
-  }
-
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/personal/generic/generic.tpl b/plugins/personal/generic/generic.tpl
deleted file mode 100644 (file)
index 1127e94..0000000
+++ /dev/null
@@ -1,568 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding="4" border="0">
-
- <!-- Headline container -->
- <tr>
-  <td colspan="4">
-   <h2><img alt="" align="middle" src="images/head.png" class="center"> {t}Personal information{/t}</h2>
-  </td>
- </tr>
-
- <!-- Base 1 container -->
- <tr>
-
-  <!-- Image container -->
-       <!-- Image container -->
-       <td style="vertical-align:top">
-         <table>
-          <tr>
-               <td width="147" height="200" bgcolor="gray">
-               {if !$userPicture_is_readable}
-                       <img class='center' border="0" width="100%" src="images/default.jpg" alt="{t}Personal picture{/t}">
-               {else}
-                       <img class='center' border="0" width="100%" src="getbin.php?rand={$rand}" alt="{t}Personal picture{/t}">
-               {/if}
-               </td>
-          </tr>
-          <tr>
-               <td>
-{render acl=$userPictureACL checkbox=$multiple_support checked=$use_edit_picture}
-                       <input style='vertical-align:top;' type="submit" name="edit_picture" value="{t}Change picture{/t}...">
-{/render}
-               </td>
-          </tr>
-         </table>
-       </td>
-       <!--
-       Old image container, with incorrect image scaling.
-  <td style="vertical-align:top">
-   <img align="bottom" border="1" width="145" height="200" src="getbin.php?rand={$rand}" alt="{t}Personal picture{/t}">
-   <br>
-   <input type="submit" name="edit_picture" value="{t}Change picture{/t}...">
-  </td>
-       -->
-
-  <!-- Name, ... -->
-  <td style="vertical-align:top;">
-   <table summary=""> 
-    {if $is_template ne "true"}
-    <tr>
-     <td><label for="sn">{t}Last name{/t}{$must}</label></td>
-     <td>
-{if $multiple_support}
-        <input id="sn" name="dummy2" size=25 maxlength=60 value="{t}Multiple edit{/t}" disabled>
-{else}
-{render acl=$snACL}
-        <input id="sn" name="sn" size=25 maxlength=60 value="{$sn}">
-{/render}
-{/if}
-        </td>
-    </tr>
-    {else}
-    <tr>
-     <td><label for="sn">{t}Template name{/t}{$must}</label></td>
-     <td>{render acl=$snACL}<input id="sn" name="sn" size=25 maxlength=60 value="{$sn}">{/render}</td>
-    </tr>
-    {/if}
-
-    {if $is_template ne "true"}
-    <tr>
-     <td><label for="givenName">{t}First name{/t}{$must}</label></td>
-     <td>
-
-{if $multiple_support}
-        <input id="givenName" name="dummy3" size=25 maxlength=60 value="{t}Multiple edit{/t}" disabled>
-{else}
-{render acl=$givenNameACL}
-        <input id="givenName" name="givenName" size=25 maxlength=60 value="{$givenName}">
-{/render}
-{/if}
-        </td>
-    </tr>
-    <tr>
-     <td><label for="uid">{t}Login{/t}{$must}</label></td>
-     <td>
-               {if !$multiple_support}
-{render acl=$uidACL}
-                       <input id="uid" name="uid" size=25 maxlength=60  value="{$uid}">
-{/render}
-               {else}
-                       <input id="uid" name="dummy1" size=25 maxlength=60  value="{t}Multiple edit{/t}" disabled>
-               {/if}
-        </td>
-    </tr>
-    {/if}
-      
-    <tr>
-     <td>
-      <div style="height:10px;"></div>
-      <label for="personalTitle">{t}Personal title{/t}</label>
-     </td>
-     <td>
-      <div style="height:10px;"></div>
-{render acl=$personalTitleACL checkbox=$multiple_support checked=$use_personalTitle}
-               <input id="personalTitle" name="personalTitle" size=25 maxlength=60 value="{$personalTitle}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><label for="academicTitle">{t}Academic title{/t}</label></td>
-     <td>
-{render acl=$academicTitleACL checkbox=$multiple_support checked=$use_academicTitle}
-             <input id="academicTitle" name="academicTitle" size=25 maxlength=60 value="{$academicTitle}">
-{/render}
-     </td>
-    </tr>
-{if !$multiple_support}
-    <tr>
-     <td>
-      <div style="height:10px;"></div>
-      <label for="day">{t}Date of birth{/t}</label>
-     </td>
-     <td>
-      <div style="height:10px;"></div>
-{render acl=$dateOfBirthACL}
-             {if $use_dob eq 1}
-             <select id="day" name=day onChange="createResult(this.form,this.form.dateOfBirth);"> 
-              {html_options values=$days output=$days selected=$day}
-             </select>
-             <select name=month onChange="populate(this.form,this.form.dateOfBirth);" >
-              {html_options options=$months selected=$month}
-             </select>
-             <select name=year onChange="populate(this.form,this.form.dateOfBirth);" >
-              {html_options values=$years output=$years selected=$year}
-             </select>
-             <input type="hidden" name="dateOfBirth" value="{$dateOfBirth}">
-             <input type="submit" name="set_dob" value="-" >
-             {else}
-             <input type="submit" name="set_dob" value="{t}Set{/t}" >
-             {/if}
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td>
-      <label for="gender">{t}Sex{/t}</label>
-     </td>
-     <td>
-{render acl=$genderACL}
-             <select size="1" id="gender" name="gender">
-              {html_options options=$gender_list selected=$gender}
-             </select>
-{/render}
-     </td>
-    </tr>
-{/if}
-    <tr>
-     <td>
-      <label for="preferredLanguage">{t}Preferred langage{/t}</label>
-     </td>
-     <td>
-{render acl=$preferredLanguageACL checkbox=$multiple_support checked=$use_preferredLanguage}
-             <select size="1" id="preferredLanguage" name="preferredLanguage">
-              {html_options options=$preferredLanguage_list selected=$preferredLanguage}
-             </select>
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td>
-      <div style="height:10px;"></div>
-      <label for="base">{t}Base{/t}</label>
-     </td>
-     <td>
-      <div style="height:10px;"></div>
-{render acl=$baseACL checkbox=$multiple_support checked=$use_base}
-               <select id="base" size="1" name="base" title="{t}Choose subtree to place user in{/t}">
-                       {html_options options=$bases selected=$base_select}
-               </select>
-{/render}
-{render acl=$baseACL disable_picture='images/folder_gray.png'}
-               <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
-{/render}
-     </td>
-    </tr>
-   </table>
-  </td>
-  <td style="border-left:1px solid #A0A0A0">
-   &nbsp;
-  </td>
-  <td style="vertical-align:top;">
-
-   <!-- Address, ... -->
-   <table summary="" style="width:100%"> 
-    <tr>
-     <td style="vertical-align:top;"><label for="homePostalAddress">{t}Address{/t}</label></td>
-      <td>
-{render acl=$homePostalAddressACL checkbox=$multiple_support checked=$use_homePostalAddress}
-            <textarea id="homePostalAddress" name="homePostalAddress" rows="3" style="width:100%">{$homePostalAddress}</textarea>
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><label for="homePhone">{t}Private phone{/t}</label>
-     </td><td>
-{render acl=$homePhoneACL checkbox=$multiple_support checked=$use_homePhone}
-            <input id="homePhone" name="homePhone" size=25 maxlength=60 value="{$homePhone}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><label for="labeledURI">{t}Homepage{/t}</label></td>
-     <td>
-{render acl=$labeledURIACL checkbox=$multiple_support checked=$use_labeledURI}
-               <input id="labeledURI" name="labeledURI" size=25 maxlength=60 value="{$labeledURI}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td colspan=2>
-      <div style="height:20px;"></div>
-     </td>
-    </tr>
-    <tr>
-     <td><label for="pw_storage">{t}Password storage{/t}</label></td>
-     <td>
-{render acl=$passwordStorageACL checkbox=$multiple_support checked=$use_pw_storage}
-             <select size="1" id="pw_storage" name="pw_storage" onchange='document.mainform.submit()'>
-              {html_options values=$pwmode output=$pwmode selected=$pwmode_select}
-             </select>
-       {if $pw_configurable eq "true"}
-             &nbsp; <input id="edit_pw_method" type="submit" name="edit_pw_method" value="{t}Configure{/t}...">
-       {/if}
-{/render}
-     </td>
-    </tr>
-
-    {if $is_template ne "true" && !$multiple_support}
-    <tr>
-     <td><label for="edit_cert">{t}Certificates{/t}</label></td>
-     <td>
-{render acl=$CertificatesACL mode=read_active}
-               <input id="edit_cert" type="submit" name="edit_cert" value="{t}Edit certificates{/t}...">
-{/render}
-     </td>
-    </tr>
-    {/if}
-
-   </table>
-  </td>
- </tr>
-</table>
-
-<p class="seperator">&nbsp;</p>
-
-<table summary="" class="line" style="width:100%; vertical-align:top; text-align:left;" cellpadding="4" border="0">
-
- <!-- Headline container -->
- <tr>
-  <td colspan="3">
-   <h2><img alt="" align="middle" src="images/house.png" class="center">&nbsp;{t}Organizational information{/t}</h2>
-  </td>
- </tr>
-
- <!-- Base 2 container -->
- <tr>
-
-  {if $governmentmode ne "true"}
-  <!-- Company, ... -->
-  <td style="vertical-align:top;">
-   <table summary=""> 
-    <tr>
-     <td><label for="o">{t}Organization{/t}</label></td>
-     <td>      
-{render acl=$oACL checkbox=$multiple_support checked=$use_o}
-               <input id="o" name="o" size=22 maxlength=60 value="{$o}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><label for="ou">{t}Department{/t}</label></td>
-     <td>
-{render acl=$ouACL checkbox=$multiple_support checked=$use_ou}
-               <input id="ou" name="ou" size=22 maxlength=60 value="{$ou}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><label for="departmentNumber">{t}Department No.{/t}</label></td>
-     <td>
-{render acl=$departmentNumberACL checkbox=$multiple_support checked=$use_departmentNumber}
-             <input id="departmentNumber" name="departmentNumber" size=22 maxlength=60 value="{$departmentNumber}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><label for="employeeNumber">{t}Employee No.{/t}</label></td>
-     <td>
-{render acl=$employeeNumberACL checkbox=$multiple_support checked=$use_employeeNumber}
-               <input id="employeeNumber" name="employeeNumber" size=22 maxlength=60 value="{$employeeNumber}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><label for="employeeType">{t}Employee type{/t}</label></td>
-     <td>
-{render acl=$employeeTypeACL checkbox=$multiple_support checked=$use_employeeType}
-               <input id="employeeType" name="employeeType" size=22 maxlength=60 value="{$employeeType}">
-{/render}
-     </td>
-    </tr>
-   </table>
-  </td>
-   
-  <td style="border-left:1px solid #A0A0A0">
-   &nbsp;
-  </td>
-
-  <!-- Phone, ... -->
-  <td style="vertical-align:top;">
-   <table summary=""> 
-    <tr>
-     <td><label for="roomNumber">{t}Room No.{/t}</label></td>
-     <td>
-{render acl=$roomNumberACL checkbox=$multiple_support checked=$use_roomNumber}
-               <input id="roomNumber" name="roomNumber" size=22 maxlength=60 value="{$roomNumber}">
-{/render}
-     </td>
-    </tr>
-    {if $has_phoneaccount ne "true"}
-    <tr>
-     <td><label for="telephoneNumber">{t}Phone{/t}</label></td>
-     <td>
-{render acl=$telephoneNumberACL checkbox=$multiple_support checked=$use_telephoneNumber}
-               <input id="telephoneNumber" name="telephoneNumber" size=22 maxlength=60 value="{$telephoneNumber}">
-{/render}
-     </td>
-    </tr>
-    {/if}
-    <tr>
-     <td><label for="mobile">{t}Mobile{/t}</label></td>
-     <td>
-{render acl=$mobileACL checkbox=$multiple_support checked=$use_mobile}
-               <input id="mobile" name="mobile" size=22 maxlength=60 value="{$mobile}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><label for="pager">{t}Pager{/t}</label></td>
-     <td>
-{render acl=$pagerACL checkbox=$multiple_support checked=$use_pager}
-               <input id="pager" name="pager" size=22 maxlength=60 value="{$pager}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><label for="facsimileTelephoneNumber">{t}Fax{/t}</label></td>
-     <td>
-{render acl=$facsimileTelephoneNumberACL checkbox=$multiple_support checked=$use_facsimileTelephoneNumber}
-               <input id="facsimileTelephoneNumber" name="facsimileTelephoneNumber" size=22 maxlength=60 value="{$facsimileTelephoneNumber}">
-{/render}
-     </td>
-    </tr>
-   </table>
-  </td>
-
-  <td style="border-left:1px solid #A0A0A0">
-   &nbsp;
-  </td>
-
-  <!-- Location, ... -->
-  <td style="vertical-align:top;">
-   <table summary="" style="width:100%"> 
-    <tr>
-     <td><label for="l">{t}Location{/t}</label></td>
-     <td>
-{render acl=$lACL checkbox=$multiple_support checked=$use_l}
-               <input id="l" name="l" size=22 maxlength=60 value="{$l}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><label for="st">{t}State{/t}</label></td>
-     <td>
-{render acl=$stACL checkbox=$multiple_support checked=$use_st}
-               <input id="st" name="st" size=22 maxlength=60 value="{$st}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td style="vertical-align:top;"><label for="postalAddress">{t}Address{/t}</label></td>
-     <td>
-{render acl=$postalAddressACL checkbox=$multiple_support checked=$use_postalAddress}
-               <textarea id="postalAddress" name="postalAddress" rows=3 style="width:100%">{$postalAddress}</textarea>
-{/render}
-     </td>
-    </tr>
-   </table>
-  </td>
-
-  {else} 
-
-  <!-- Beschreibung, ... -->
-  <td style="vertical-align:top;border-right:1px solid #b0b0b0">
-   <table summary=""> 
-    <tr>
-     <td><label for="vocation">{t}Vocation{/t}</label></td>
-     <td>
-{render acl=$vocationACL checkbox=$multiple_support checked=$use_vocation}
-               <input id="vocation" name="vocation" size=22 maxlength=60 value="{$vocation}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><label for="gouvernmentOrganizationalUnitDescription">{t}Unit description{/t}</label></td>
-     <td>
-{render acl=$gouvernmentOrganizationalUnitDescriptionACL checkbox=$multiple_support checked=$use_gouvernmentOrganizationalUnitDescription}
-               <input id="gouvernmentOrganizationalUnitDescription" name="gouvernmentOrganizationalUnitDescription" size=22 maxlength=60
-               value="{$gouvernmentOrganizationalUnitDescription}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><label for="gouvernmentOrganizationalUnitSubjectArea">{t}Subject area{/t}</label></td>
-     <td>
-{render acl=$gouvernmentOrganizationalUnitSubjectAreaACL checkbox=$multiple_support checked=$use_gouvernmentOrganizationalUnitSubjectArea}
-               <input id="gouvernmentOrganizationalUnitSubjectArea" name="gouvernmentOrganizationalUnitSubjectArea" size=22 maxlength=60
-               value="{$gouvernmentOrganizationalUnitSubjectArea}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><label for="functionalTitle">{t}Functional title{/t}</label></td>
-     <td>
-{render acl=$functionalTitleACL checkbox=$multiple_support checked=$use_functionalTitle}
-               <input name="functionalTitle" id="functionalTitle"  size=22 maxlength=60
-               value="{$functionalTitle}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><label for="role">{t}Role{/t}</label></td>
-     <td>
-{render acl=$roleACL checkbox=$multiple_support checked=$use_role}
-               <input id="role" name="role" size=22 maxlength=60 value="{$role}">
-{/render}
-     </td>
-    </tr>
-   </table>
-  </td>
-  
-  <!-- Phone, ... -->
-  <td style="vertical-align:top;border-right:1px solid #b0b0b0">
-   <table summary=""> 
-    <tr>
-     <td><label for="gouvernmentOrganizationalPersonLocality">{t}Person locality{/t}</label></td>
-     <td>
-{render acl=$gouvernmentOrganizationalPersonLocalityACL checkbox=$multiple_support checked=$use_gouvernmentOrganizationalPersonLocality}
-               <input id="gouvernmentOrganizationalPersonLocality" name="gouvernmentOrganizationalPersonLocality" size=22 maxlength=60
-                value="{$gouvernmentOrganizationalPersonLocality}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><label for="gouvernmentOrganizationalUnit">{t}Unit{/t}</label></td>
-     <td>
-{render acl=$gouvernmentOrganizationalUnitACL checkbox=$multiple_support checked=$use_gouvernmentOrganizationalUnit}
-               <input id="gouvernmentOrganizationalUnit" name="gouvernmentOrganizationalUnit" size=22 maxlength=60 
-               value="{$gouvernmentOrganizationalUnit}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><label for="street">{t}Street{/t}</label></td>
-     <td>
-{render acl=$streetACL checkbox=$multiple_support checked=$use_street}
-               <input name="street" id="street" size=22 maxlength=60 value="{$street}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><label for="postalCode">{t}Postal code{/t}</label></td>
-     <td> 
-{render acl=$postalCodeACL checkbox=$multiple_support checked=$use_postalCode}
-               <input name="postalCode" id="postalCode" size=22 maxlength=60 value="{$postalCode}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><label for="houseIdentifier">{t}House identifier{/t}</label></td>
-     <td>
-{render acl=$houseIdentifierACL checkbox=$multiple_support checked=$use_houseIdentifier}
-               <input id="houseIdentifier" name="houseIdentifier" size=22 maxlength=60
-               value="{$houseIdentifier}">
-{/render}
-     </td>
-    </tr>
-   </table>
-  </td>
-
-  <!-- Location, ... -->
-  <td style="vertical-align:top;">
-   <table summary=""> 
-    <tr>
-     <td><label for="roomNumber">{t}Room No.{/t}</label></td>
-     <td>
-{render acl=$roomNumberACL checkbox=$multiple_support checked=$use_roomNumber}
-               <input id="roomNumber" name="roomNumber" size=22 maxlength=60 value="{$roomNumber}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><label for="telephoneNumber">{t}Phone{/t}</label></td>
-     <td>
-{render acl=$telephoneNumberACL checkbox=$multiple_support checked=$use_telephoneNumber}
-             {if $has_phoneaccount ne "true"}
-                       <input id="telephoneNumber" name="telephoneNumber" size=22 maxlength=60 value="{$telephoneNumber}">
-             {else}
-                       <i>{t}Please use the phone tab{/t}</i>
-             {/if}
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><label for="facsimileTelephoneNumber">{t}Fax{/t}</label></td>
-     <td>
-{render acl=$facsimileTelephoneNumberACL checkbox=$multiple_support checked=$use_facsimileTelephoneNumber}
-               <input id="facsimileTelephoneNumber" name="facsimileTelephoneNumber" size=22 maxlength=60 
-                value="{$facsimileTelephoneNumber}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><label for="ivbbLastDeliveryCollective">{t}Last delivery{/t}</label></td>
-     <td>
-{render acl=$ivbbLastDeliveryCollectiveACL checkbox=$multiple_support checked=$use_ivbbLastDeliveryCollective}
-               <input name="ivbbLastDeliveryCollective" size=22 maxlength=60 id="ivbbLastDeliveryCollective" 
-               value="{$ivbbLastDeliveryCollective}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><label for="publicVisible">{t}Public visible{/t}</label></td>
-     <td>
-{render acl=$publicVisibleACL checkbox=$multiple_support checked=$use_publicVisible}
-             <select size="1" id="publicVisible" name="publicVisible">
-              {html_options values=$ivbbmodes output=$ivbbmodes selected=$publicVisible}
-             </select>
-{/render}
-     </td>
-    </tr>
-   </table>
-  </td>
- {/if} 
- </tr>
-</table>
-
-{if $multiple_support}
-       <input type="hidden" name="user_mulitple_edit" value="1">
-{/if}
-<input type=hidden name="generic">
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('sn');
-       if (document.mainform.yearSel != "")
-                               populate(document.mainform,document.mainform.dateOfBirth);
-  -->
-</script>
diff --git a/plugins/personal/generic/generic_certs.tpl b/plugins/personal/generic/generic_certs.tpl
deleted file mode 100644 (file)
index 0b5e759..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-<input type="hidden" name="MAX_FILE_SIZE" value="2000000">
- <!-- Headline container -->
-<h2><img alt="" class="center" align="middle" src="images/certs.png"> {t}Certificates{/t}</h2>
-
-<table summary="" style="vertical-align:top; text-align:left;border-top: 1px solid rgb(176,176,176);" width="100%" cellpadding=4 border=0>
- <tr>
-   <td width="12%" style="vertical-align:top">
-      {t}Standard certificate{/t}
-   </td>
-  
-   <td style="vertical-align:top">
-        <LABEL for="userCertificate_file">{if $Certificate_readable}{$userCertificateinfo}{/if}</LABEL>
-        </td>
-        <td style="vertical-align:top;text-align:right">
-        {if $userCertificate_state ne "true"}
-       {render acl=$CertificateACL}
-     <input id="userCertificate_file" name="userCertificate_file" type="file" size="20" maxlength="255" accept="text/*.*">
-       {/render}
-     {else}
-       {render acl=$CertificateACL}
-     <input type=submit name="remove_userCertificate" value="{t}Remove{/t}">
-       {/render}
-     {/if}
-   </td>
- </tr>
- </table>
-
-<br>
-
- <table summary="" style="vertical-align:top; text-align:left;border-top: 1px solid rgb(176,176,176);" width="100%" cellpadding=4 border=0>
- <tr>
-   <td width="12%" style="vertical-align:top">
-      {t}S/MIME certificate{/t} 
-   </td>
-   <td style="vertical-align:top">
-     <LABEL for="userSMIMECertificate_file">{if $Certificate_readable}{$userSMIMECertificateinfo}{/if}</LABEL>
-   </td>
-   <td style="vertical-align:top;text-align:right">
-        {if $userSMIMECertificate_state ne "true"}
-       {render acl=$CertificateACL}
-     <input id="userSMIMECertificate_file" name="userSMIMECertificate_file" type="file" size="20" maxlength="255" accept="text/*.*">
-       {/render}
-     {else}
-       {render acl=$CertificateACL}
-     <input type=submit name="remove_userSMIMECertificate" value="{t}Remove{/t}">
-       {/render}
-        {/if}
-   </td>
- </tr>
- </table>
-
-<br>
-
-<table summary="" style="vertical-align:top; text-align:left;border-top: 1px solid rgb(176,176,176);" width="100%" cellpadding=4 border=0> 
- <tr>
-   <td width="12%" style="vertical-align:top">
-      {t}PKCS12 certificate{/t} 
-   </td>
-   <td style="vertical-align:top">
-     <LABEL for="userPKCS12_file">{if $Certificate_readable}{$userPKCS12info}{/if}</LABEL>
-   </td>
-   <td style="vertical-align:top;text-align:right">
-        {if $userPKCS12_state ne "true"}
-       {render acl=$CertificateACL}
-     <input id="userPKCS12_file" name="userPKCS12_file" type="file" size="20" maxlength="255" accept="text/*.*">
-       {/render}
-        {else}
-       {render acl=$CertificateACL}
-     <input type=submit name="remove_userPKCS12" value="{t}Remove{/t}">
-       {/render}
-        {/if}
-   </td>
- </tr>
- {if $governmentmode eq "true"}
- <tr>
-   <td>
-     <LABEL for="certificateSerialNumber">{t}Certificate serial number{/t}</LABEL>
-   </td>
-   <td>
-       {render acl=$CertificateACL}
-     <input id="certificateSerialNumber" name="certificateSerialNumber" size=10 maxlength=20 value="{$certificateSerialNumber}">
-       {/render}
-   </td>
- </tr>
- {/if}
-</table>
-
-<p class="plugbottom">
-       {render acl=$CertificateACL}
-  <input type=submit name="cert_edit_finish" value="{t}Save{/t}">
-       {/render}
-  &nbsp;
-  <input type=submit name="cert_edit_cancel" value="{t}Cancel{/t}">
-</p>
-
diff --git a/plugins/personal/generic/generic_picture.tpl b/plugins/personal/generic/generic_picture.tpl
deleted file mode 100644 (file)
index 0e2b06c..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4 border=0>
- <!-- Headline container -->
- <tr>
-   <td colspan=2>
-     <h2><img alt="" class="center" align="middle" src="images/head.png"> {t}Personal picture{/t}</h2>
-   </td>
- </tr>
- <!-- Base container -->
- <tr>
- <!-- Image container -->
-  <td>
-   <table>
-    <tr>
-     <td width="147" height="200" bgcolor="gray">
-      <img class="center" border="0" width="100%" src="getbin.php?rand={$rand}" alt="{t}Personal picture{/t}">
-     </td>
-    </tr>
-   </table>
-  </td>
-       </tr>
-       <tr>
-   <!-- Name, ... -->
-   <td style="vertical-align:bottom; width:100%;">
-     <input type="hidden" name="MAX_FILE_SIZE" value="2000000">
-     <input id="picture_file" name="picture_file" type="file" size="20" maxlength="255" accept="image/*.jpg">
-     &nbsp;
-     <input type=submit name="picture_remove" value="{t}Remove picture{/t}">
-   </td>
- </tr>
-</table>
-<br>
-<p class="plugbottom">
-  <input type=submit name="picture_edit_finish" value="{t}Save{/t}">
-  &nbsp;
-  <input type=submit name="picture_edit_cancel" value="{t}Cancel{/t}">
-</p>
-
diff --git a/plugins/personal/generic/main.inc b/plugins/personal/generic/main.inc
deleted file mode 100644 (file)
index e35ee1e..0000000
+++ /dev/null
@@ -1,198 +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
- */
-
-
-/* Preset display */
-$display  = "";
-$lock_msg = "";
-if (!$remove_lock){
-  /* Reset requested? */
-  if (isset($_POST['edit_cancel']) || isset($_POST['password_cancel']) || 
-      (isset($_GET['reset']) && $_GET['reset'] == 1)){
-    del_lock ($ui->dn);
-    sess_del ('edit');
-    sess_del ('user');
-  }
-
-  /* Create user object on demand */
-  if (!isset($_SESSION['user']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
-    $_SESSION['user']= new user ($config, $ui->dn);
-    $_SESSION['user']->enable_CSN_check();
-    $_SESSION['user']->set_acl_base($ui->dn);
-    $_SESSION['user']->set_acl_category("users");
-  }
-  $user= $_SESSION['user'];
-
-  /* save changes back to object */
-  if (isset ($_SESSION['edit'])){
-    $user->save_object ();
-  }
-
-  /* Enter edit mode? */
-  if ((isset($_POST['edit'])) && (!isset( $_SESSION['edit'])) &&preg_match("/w/",$ui->get_permissions($ui->dn,"users/user"))){
-
-    /* Check locking */
-    if (($username= get_lock($ui->dn)) != ""){
-      $_SESSION['back_plugin']= $plug;
-      $_SESSION['LOCK_VARS_TO_USE'] = array("/^edit$/","/^plug$/");
-      $lock_msg =  gen_locked_message ($username, $ui->dn);
-  
-    }else{
-
-      /* Lock the current entry */
-      add_lock ($ui->dn, $ui->dn);
-      $_SESSION['dn']= $ui->dn;
-      $_SESSION['edit']= TRUE;
-    }
-  }
-
-  /* Perform password change */
-  if (isset($_POST['password_finish'])){
-
-    /* For security reasons, check if user is allowed to set password again */
-    if ($user->acl_is_writeable("userPassword") || $user->acl_is_createable()){
-
-      /* Check input and feed errors into 'message' */
-      $message= array();
-
-      /* Sanity checks... */
-      if ($_POST['new_password'] != $_POST['repeated_password']){
-
-        /* Matching passwords in new and repeated? */
-        $message[]= _("The passwords you've entered as 'New password' and 'Repeated new password' do not match.");
-      } else {
-
-        /* Empty password is not permitted by default. */
-        if ($_POST['new_password'] == ""){
-          $message[]= _("The password you've entered as 'New password' is empty.");
-        }
-      }
-
-      /* Errors, or change password? */
-      if (count($message) != 0){
-
-        /* Show error message and continue editing */
-        show_errors ($message);
-        $display.= $smarty->fetch(get_template_path('password.tpl', TRUE));
-        return ($display);
-      }
-      change_password ($user->dn, $_POST['new_password'], 0, $user->pw_storage);
-      new log("modify","users/password","",array(),"Password has been changed");
-
-    } else {
-
-      /* Missing permissions, show message */
-      print_red (_("You are not allowed to set your password!"));
-    }
-
-    del_lock ($ui->dn);
-    sess_del ('user');
-  }
-
-  /* save changes to LDAP and disable edit mode */
-  if (isset($_POST['edit_finish'])){
-
-    /* Perform checks */
-    $message= $user->check ();
-
-    /* No errors, save object */
-    if (count ($message) == 0){
-      $user->save ();
-      del_lock ($ui->dn);
-      sess_del ('edit');
-
-      /* Need to reset the password? */
-      if($user->password_change_needed()){
-        /* Save object */
-        $_SESSION['user']= $user;
-
-        $display.= $smarty->fetch(get_template_path('password.tpl', TRUE));
-        return ($display);
-      } else {
-       sess_del ('user');
-      }
-
-    } else {
-      /* Errors found, show message */
-      show_errors ($message);
-    }
-  }
-
-  /* Execute formular */
-  if($lock_msg){
-    $display.= $lock_msg;
-  }else{
-    $display.= $user->execute ();
-  }
-
-  /* Store changes  in session */
-  if (isset ($_SESSION['edit'])){
-    $_SESSION['user']= $user;
-  }
-
-  $info = "";
-
-  /* Show page footer depending on the mode */
-  if (!$user->cert_dialog && !$user->picture_dialog && !$user->dialog && $user->is_account && empty($lock_msg)){
-    $display.= "<p class=\"plugbottom\">";
-
-    /* Are we in edit mode? */
-    if (isset($_SESSION['edit'])){
-      $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
-      $display.= "&nbsp;";
-      $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
-
-      $info= "<img class=\"center\" alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png').
-             "\"> ".$ui->dn."&nbsp;";
-    } else {
-      /* 'viewid' may be set by i.e. the phonelist plugin. This
-         means that we want to go back... */
-      if (isset ($viewid)){
-        $str= _("Back");
-        $fn = "back";
-      } else {
-        $str= _("Edit");
-        $fn = "edit";
-        $info= "<img class=\"center\" alt=\"\" align=\"middle\" src=\"".get_template_path('images/openlock.png').
-               "\"> ".$ui->dn."&nbsp;";
-      }
-
-      /* Only display edit button if there is at least one attribute editable */
-      if(preg_match("/w/",$ui->get_permissions($ui->dn,"users/user"))){
-        if ($fn == "edit"){
-          $info.= "<img class=\"center\" alt=\"\" align=\"middle\" src=\"".get_template_path('images/lamp.png')."\"> ".
-            _("Click the 'Edit' button below to change informations in this dialog");
-          $display.= "<input type=submit name=\"$fn\" value=\"$str\">\n";
-        }
-      }
-
-      $display.= "<input type=\"hidden\" name=\"ignore\">\n";
-    }
-    $display.= "</p>\n";
-  }
-
-  /* Page header*/
-  $display= print_header(get_template_path('images/personal.png'),
-                         _("Generic user information"), $info).$display;
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/personal/generic/multiple_generic.tpl b/plugins/personal/generic/multiple_generic.tpl
deleted file mode 100644 (file)
index d6f4f03..0000000
+++ /dev/null
@@ -1,482 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding="4" border="0">
- <tr>
-  <td colspan="4">
-    <img alt="" align="middle" src="images/head.png" class="center">
-       <h2>{t}Personal information{/t}</h2>
-  </td>
- </tr>
- <tr>
-  <td style="vertical-align:top">
-   <table>
-    <tr>
-     <td width="147" height="200" bgcolor="gray">
-      <img class='center' border="0" width="100%" src="images/default.jpg" alt="{t}Personal picture{/t}">
-     </td>
-    </tr>
-   </table>
-  </td>
-  <td style="vertical-align:top;">
-   <table>
-    <tr>
-     <td>
-      <label for="academicTitle">
-      {t}Academic title{/t}</label>
-     </td>
-     <td>
-       <input type="checkbox" name="use_academicTitle" value="1" {if $use_academicTitle} checked {/if}>
-      <input id="academicTitle" name="academicTitle" size=25 maxlength=60 value="{$academicTitle}">
-     </td>
-    </tr>
-    <tr>
-     <td>
-      <label for="preferredLanguage">
-      {t}Preferred langage{/t}</label>
-     </td>
-     <td>
-       <input type="checkbox" name="use_preferredLanguage" value="1" {if $use_preferredLanguage} checked {/if}>
-      <select size="1" id="preferredLanguage" name="preferredLanguage">
-       {html_options options=$preferredLanguage_list selected=$preferredLanguage}
-      </select>
-     </td>
-    </tr>
-    <tr>
-     <td>
-      <div style="height:10px;">
-      </div>
-      <label for="base">
-      {t}Base{/t}</label>
-     </td>
-     <td>
-      <div style="height:10px;">
-      </div>
-       <input type="checkbox" name="use_base" value="1" {if $use_base} checked {/if}>
-      <select id="base" size="1" name="base" title="{t}Choose subtree to place user in{/t}">
-       {html_options options=$bases selected=$base_select}
-      </select>
-      <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
-     </td>
-    </tr>
-   </table>
-  </td>
-  <td style="vertical-align:top;">
-   <!-- Address, ... -->
-   <table summary="" style="width:100%">
-    <tr>
-     <td style="vertical-align:top;">
-      <label for="homePostalAddress">
-      {t}Address{/t}</label>
-     </td>
-     <td>
-       <input type="checkbox" name="use_homePostalAddress" value="1" {if $use_homePostalAddress} checked {/if}>
-      <textarea id="homePostalAddress" name="homePostalAddress" rows="3" style="width:100%">
-      {$homePostalAddress}</textarea>
-     </td>
-    </tr>
-    <tr>
-     <td>
-      <label for="homePhone">
-      {t}Private phone{/t}</label>
-     </td>
-     <td>
-       <input type="checkbox" name="use_homePhone" value="1" {if $use_homePhone} checked {/if}>
-      <input id="homePhone" name="homePhone" size=25 maxlength=60 value="{$homePhone}">
-     </td>
-    </tr>
-    <tr>
-     <td>
-      <label for="labeledURI">
-      {t}Homepage{/t}</label>
-     </td>
-     <td>
-       <input type="checkbox" name="use_labeledURI" value="1" {if $use_labeledURI} checked {/if}>
-      <input id="labeledURI" name="labeledURI" size=25 maxlength=60 value="{$labeledURI}">
-     </td>
-    </tr>
-    <tr>
-     <td colspan=2>
-      <div style="height:20px;">
-      </div>
-     </td>
-    </tr>
-<!--
-    <tr>
-     <td>
-      <label for="pw_storage">
-      {t}Password storage{/t}</label>
-     </td>
-     <td>
-       <input type="checkbox" name="use_pw_storage" value="1" {if $use_pw_storage} checked {/if}>
-      <select size="1" id="pw_storage" name="pw_storage" onchange='document.mainform.submit()'>
-       {html_options values=$pwmode output=$pwmode selected=$pwmode_select}
-      </select>
-     </td>
-    </tr>
-    <tr>
-     <td>
-      <label for="edit_cert">
-      {t}Certificates{/t}</label>
-     </td>
-     <td>
-       <input type="checkbox" name="use_edit_cert" value="1" {if $use_edit_cert} checked {/if}>
-      <input id="edit_cert" type="submit" name="edit_cert" value="{t}Edit certificates{/t}...">
-     </td>
-    </tr>
--->
-   </table>
-  </td>
- </tr>
-</table>
-<p class="seperator">
-&nbsp;</p>
-<table summary="" class="line" style="width:100%; vertical-align:top; text-align:left;" cellpadding="4" border="0">
- <!-- Headline container -->
- <tr>
-  <td colspan="3">
-   <h2>
-    <img alt="" align="middle" src="images/house.png" class="center">
-   &nbsp;{t}Organizational information{/t}</h2>
-  </td>
- </tr>
- <!-- Base 2 container -->
- <tr>
-  {if $governmentmode ne "true"}
-  <!-- Company, ... -->
-  <td style="vertical-align:top;">
-   <table summary="">
-    <tr>
-     <td>
-      <label for="o">
-      {t}Organization{/t}</label>
-     </td>
-     <td>
-       <input type="checkbox" name="use_o" value="1" {if $use_o} checked {/if}>
-      <input id="o" name="o" size=22 maxlength=60 value="{$o}">
-     </td>
-    </tr>
-    <tr>
-     <td>
-      <label for="ou">
-      {t}Department{/t}</label>
-     </td>
-     <td>
-       <input type="checkbox" name="use_ou" value="1" {if $use_ou} checked {/if}>
-      <input id="ou" name="ou" size=22 maxlength=60 value="{$ou}">
-     </td>
-    </tr>
-    <tr>
-     <td>
-      <label for="departmentNumber">
-      {t}Department No.{/t}</label>
-     </td>
-     <td>
-       <input type="checkbox" name="use_departmentNumber" value="1" {if $use_departmentNumber} checked {/if}>
-      <input id="departmentNumber" name="departmentNumber" size=22 maxlength=60 value="{$departmentNumber}">
-     </td>
-    </tr>
-    <tr>
-     <td>
-      <label for="employeeNumber">
-      {t}Employee No.{/t}</label>
-     </td>
-     <td>
-       <input type="checkbox" name="use_employeeNumber" value="1" {if $use_employeeNumber} checked {/if}>
-      <input id="employeeNumber" name="employeeNumber" size=22 maxlength=60 value="{$employeeNumber}">
-     </td>
-    </tr>
-    <tr>
-     <td>
-      <label for="employeeType">
-      {t}Employee type{/t}</label>
-     </td>
-     <td>
-       <input type="checkbox" name="use_employeeType" value="1" {if $use_employeeType} checked {/if}>
-      <input id="employeeType" name="employeeType" size=22 maxlength=60 value="{$employeeType}">
-     </td>
-    </tr>
-   </table>
-  </td>
-  <td style="border-left:1px solid #A0A0A0">
-   &nbsp;
-  </td>
-  <!-- Phone, ... -->
-  <td style="vertical-align:top;">
-   <table summary="">
-    <tr>
-     <td>
-      <label for="roomNumber">
-      {t}Room No.{/t}</label>
-     </td>
-     <td>
-       <input type="checkbox" name="use_roomNumber" value="1" {if $use_roomNumber} checked {/if}>
-      <input id="roomNumber" name="roomNumber" size=22 maxlength=60 value="{$roomNumber}">
-     </td>
-    </tr>
-    <tr>
-     <td>
-      <label for="telephoneNumber">
-      {t}Phone{/t}</label>
-     </td>
-     <td>
-       <input type="checkbox" name="use_telephoneNumber" value="1" {if $use_telephoneNumber} checked {/if}>
-      <input id="telephoneNumber" name="telephoneNumber" size=22 maxlength=60 value="{$telephoneNumber}">
-     </td>
-    </tr>
-    <tr>
-     <td>
-      <label for="mobile">
-      {t}Mobile{/t}</label>
-     </td>
-     <td>
-       <input type="checkbox" name="use_mobile" value="1" {if $use_mobile} checked {/if}>
-      <input id="mobile" name="mobile" size=22 maxlength=60 value="{$mobile}">
-     </td>
-    </tr>
-    <tr>
-     <td>
-      <label for="pager">
-      {t}Pager{/t}</label>
-     </td>
-     <td>
-       <input type="checkbox" name="use_pager" value="1" {if $use_pager} checked {/if}>
-      <input id="pager" name="pager" size=22 maxlength=60 value="{$pager}">
-     </td>
-    </tr>
-    <tr>
-     <td>
-      <label for="facsimileTelephoneNumber">
-      {t}Fax{/t}</label>
-     </td>
-     <td>
-       <input type="checkbox" name="use_facsimileTelephoneNumber" value="1" {if $use_facsimileTelephoneNumber} checked {/if}>
-      <input id="facsimileTelephoneNumber" name="facsimileTelephoneNumber" size=22 maxlength=60 value="{$facsimileTelephoneNumber}">
-     </td>
-    </tr>
-   </table>
-  </td>
-  <td style="border-left:1px solid #A0A0A0">
-   &nbsp;
-  </td>
-  <!-- Location, ... -->
-  <td style="vertical-align:top;">
-   <table summary="" style="width:100%">
-    <tr>
-     <td>
-      <label for="l">
-      {t}Location{/t}</label>
-     </td>
-     <td>
-       <input type="checkbox" name="use_l" value="1" {if $use_l} checked {/if}>
-      <input id="l" name="l" size=22 maxlength=60 value="{$l}">
-     </td>
-    </tr>
-    <tr>
-     <td>
-      <label for="st">
-      {t}State{/t}</label>
-     </td>
-     <td>
-       <input type="checkbox" name="use_st" value="1" {if $use_st} checked {/if}>
-      <input id="st" name="st" size=22 maxlength=60 value="{$st}">
-     </td>
-    </tr>
-    <tr>
-     <td style="vertical-align:top;">
-      <label for="postalAddress">
-      {t}Address{/t}</label>
-     </td>
-     <td>
-       <input type="checkbox" name="use_postalAddress" value="1" {if $use_postalAddress} checked {/if}>
-      <textarea id="postalAddress" name="postalAddress" rows=3 style="width:100%">
-      {$postalAddress}</textarea>
-     </td>
-    </tr>
-   </table>
-  </td>
-  {else} 
-  <!-- Beschreibung, ... -->
-  <td style="vertical-align:top;border-right:1px solid #b0b0b0">
-   <table summary="">
-    <tr>
-     <td>
-      <label for="vocation">
-      {t}Vocation{/t}</label>
-     </td>
-     <td>
-       <input type="checkbox" name="use_vocation" value="1" {if $use_vocation} checked {/if}>
-      <input id="vocation" name="vocation" size=22 maxlength=60 value="{$vocation}">
-     </td>
-    </tr>
-    <tr>
-     <td>
-      <label for="gouvernmentOrganizationalUnitDescription">
-      {t}Unit description{/t}</label>
-     </td>
-     <td>
-       <input type="checkbox" name="use_gouvernmentOrganizationalUnitDescription" value="1" {if $use_gouvernmentOrganizationalUnitDescription} checked {/if}>
-      <input id="gouvernmentOrganizationalUnitDescription" name="gouvernmentOrganizationalUnitDescription" size=22 maxlength=60
-      value="{$gouvernmentOrganizationalUnitDescription}">
-     </td>
-    </tr>
-    <tr>
-     <td>
-      <label for="gouvernmentOrganizationalUnitSubjectArea">
-      {t}Subject area{/t}</label>
-     </td>
-     <td>
-       <input type="checkbox" name="use_gouvernmentOrganizationalUnitSubjectArea" value="1" {if $use_gouvernmentOrganizationalUnitSubjectArea} checked {/if}>
-      <input id="gouvernmentOrganizationalUnitSubjectArea" name="gouvernmentOrganizationalUnitSubjectArea" size=22 maxlength=60
-      value="{$gouvernmentOrganizationalUnitSubjectArea}">
-     </td>
-    </tr>
-    <tr>
-     <td>
-      <label for="functionalTitle">
-      {t}Functional title{/t}</label>
-     </td>
-     <td>
-       <input type="checkbox" name="use_functionalTitle" value="1" {if $use_functionalTitle} checked {/if}>
-      <input name="functionalTitle" id="functionalTitle"  size=22 maxlength=60
-      value="{$functionalTitle}">
-     </td>
-    </tr>
-    <tr>
-     <td>
-      <label for="role">
-      {t}Role{/t}</label>
-     </td>
-     <td>
-       <input type="checkbox" name="use_role" value="1" {if $use_role} checked {/if}>
-      <input id="role" name="role" size=22 maxlength=60 value="{$role}">
-     </td>
-    </tr>
-   </table>
-  </td>
-  <!-- Phone, ... -->
-  <td style="vertical-align:top;border-right:1px solid #b0b0b0">
-   <table summary="">
-    <tr>
-     <td>
-      <label for="gouvernmentOrganizationalPersonLocality">
-      {t}Person locality{/t}</label>
-     </td>
-     <td>
-       <input type="checkbox" name="use_gouvernmentOrganizationalPersonLocality" value="1" {if $use_gouvernmentOrganizationalPersonLocality} checked {/if}>
-      <input id="gouvernmentOrganizationalPersonLocality" name="gouvernmentOrganizationalPersonLocality" size=22 maxlength=60
-      value="{$gouvernmentOrganizationalPersonLocality}">
-     </td>
-    </tr>
-    <tr>
-     <td>
-      <label for="gouvernmentOrganizationalUnit">
-      {t}Unit{/t}</label>
-     </td>
-     <td>
-       <input type="checkbox" name="use_gouvernmentOrganizationalUnit" value="1" {if $use_gouvernmentOrganizationalUnit} checked {/if}>
-      <input id="gouvernmentOrganizationalUnit" name="gouvernmentOrganizationalUnit" size=22 maxlength=60 
-      value="{$gouvernmentOrganizationalUnit}">
-     </td>
-    </tr>
-    <tr>
-     <td>
-      <label for="street">
-      {t}Street{/t}</label>
-     </td>
-     <td>
-       <input type="checkbox" name="use_street" value="1" {if $use_street} checked {/if}>
-      <input name="street" id="street" size=22 maxlength=60 value="{$street}">
-     </td>
-    </tr>
-    <tr>
-     <td>
-      <label for="postalCode">
-      {t}Postal code{/t}</label>
-     </td>
-     <td>
-       <input type="checkbox" name="use_postalCode" value="1" {if $use_postalCode} checked {/if}>
-      <input name="postalCode" id="postalCode" size=22 maxlength=60 value="{$postalCode}">
-     </td>
-    </tr>
-    <tr>
-     <td>
-      <label for="houseIdentifier">
-      {t}House identifier{/t}</label>
-     </td>
-     <td>
-       <input type="checkbox" name="use_houseIdentifier" value="1" {if $use_houseIdentifier} checked {/if}>
-      <input id="houseIdentifier" name="houseIdentifier" size=22 maxlength=60
-      value="{$houseIdentifier}">
-     </td>
-    </tr>
-   </table>
-  </td>
-  <!-- Location, ... -->
-  <td style="vertical-align:top;">
-   <table summary="">
-    <tr>
-     <td>
-      <label for="roomNumber">
-      {t}Room No.{/t}</label>
-     </td>
-     <td>
-       <input type="checkbox" name="use_roomNumber" value="1" {if $use_roomNumber} checked {/if}>
-      <input id="roomNumber" name="roomNumber" size=22 maxlength=60 value="{$roomNumber}">
-     </td>
-    </tr>
-    <tr>
-     <td>
-      <label for="telephoneNumber">
-      {t}Phone{/t}</label>
-     </td>
-     <td>
-       <input type="checkbox" name="use_telephoneNumber" value="1" {if $use_telephoneNumber} checked {/if}>
-      <input id="telephoneNumber" name="telephoneNumber" size=22 maxlength=60 value="{$telephoneNumber}">
-     </td>
-    </tr>
-    <tr>
-     <td>
-      <label for="facsimileTelephoneNumber">
-      {t}Fax{/t}</label>
-     </td>
-     <td>
-       <input type="checkbox" name="use_facsimileTelephoneNumber" value="1" {if $use_facsimileTelephoneNumber} checked {/if}>
-      <input id="facsimileTelephoneNumber" name="facsimileTelephoneNumber" size=22 maxlength=60 
-      value="{$facsimileTelephoneNumber}">
-     </td>
-    </tr>
-    <tr>
-     <td>
-      <label for="ivbbLastDeliveryCollective">
-      {t}Last delivery{/t}</label>
-     </td>
-     <td>
-       <input type="checkbox" name="use_ivbbLastDeliveryCollective" value="1" {if $use_ivbbLastDeliveryCollective} checked {/if}>
-      <input name="ivbbLastDeliveryCollective" size=22 maxlength=60 id="ivbbLastDeliveryCollective" 
-      value="{$ivbbLastDeliveryCollective}">
-     </td>
-    </tr>
-    <tr>
-     <td>
-      <label for="publicVisible">
-      {t}Public visible{/t}</label>
-     </td>
-     <td>
-       <input type="checkbox" name="use_publicVisible" value="1" {if $use_publicVisible} checked {/if}>
-      <select size="1" id="publicVisible" name="publicVisible">
-       {html_options values=$ivbbmodes output=$ivbbmodes selected=$publicVisible}
-      </select>
-     </td>
-    </tr>
-   </table>
-  </td>
-  {/if} 
- </tr>
-</table>
-<input type=hidden name="multiple_user_posted" value="1">
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-<!-- // First input field on page
-focus_field('academicTitle');
-if (document.mainform.yearSel != "")
-populate(document.mainform,document.mainform.dateOfBirth);
--->
-</script>
diff --git a/plugins/personal/generic/password.tpl b/plugins/personal/generic/password.tpl
deleted file mode 100644 (file)
index 3d26511..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<p>
- {t}You have changed the method your password is stored in the ldap database. For that reason you've to enter your password at this point again. GOsa will then encode it with the selected method.{/t}
-</p>
-
-<table summary="" style="vertical-align:top; text-align:left;" cellpadding=4 border=0>
-  <tr>
-    <td><b><LABEL for="new_password">{t}New password{/t}</LABEL></b></td>
-    <td><input id="new_password" type="password" name="new_password" size="30" maxlength="40" onFocus="nextfield= 'repeated_password';"></td>
-  </tr>
-  <tr>
-    <td><b><LABEL for="repeated_password">{t}Repeat new password{/t}</LABEL></b></td>
-    <td><input id="repeated_password" type="password" name="repeated_password" size="30" maxlength="40" onFocus="nextfiled= 'password_finish'"></td>
-  </tr>
-</table>
-<br>
-<p class="plugbottom">
-  <input type=submit name="password_finish" value="{t}Set password{/t}">
-  &nbsp;
-  <input type=submit name="password_cancel" value="{t}Cancel{/t}">
-</p>
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       nextfield= "new_password";
-       focus_field('new_password');
-  -->
-</script>
diff --git a/plugins/personal/generic/paste_generic.tpl b/plugins/personal/generic/paste_generic.tpl
deleted file mode 100644 (file)
index 0fc1608..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-<h2>{t}User settings{/t}</h2>
-<table width="100%">
-  <tr>
-       <td style="vertical-align:top; border-right:1px solid #AAA; width:50%">
-         <table>
-               <tr>
-                 <td><label for="sn">{t}Last name{/t}</label></td>
-                 <td><input id="sn" name="sn" size=25 maxlength=60  value="{$sn}"></td>
-               </tr>
-               <tr>
-                 <td><label for="givenName">{t}First name{/t}</label></td>
-                 <td><input id="givenName" name="givenName" size=25 maxlength=60 value="{$givenName}"></td>
-               </tr>
-               <tr>
-                 <td><label for="uid">{t}Login{/t}</label></td>
-                 <td><input id="uid" name="uid" size=25 maxlength=60 value="{$uid}"></td>
-               </tr>
-               <tr>
-                       <td style='vertical-align:top;'>
-                               {t}Password{/t}
-                       </td>
-                       <td>
-                               <input type="radio" {if $passwordTodo=="clear"} checked{/if} name="passwordTodo" value="clear">{t}Clear password{/t}<br>
-                               <input type="radio" {if $passwordTodo=="new"}   checked{/if} name="passwordTodo" value="new">{t}Set new password{/t}
-                       </td>
-               </tr>
-         </table>
-       </td>
-       <td style="vertical-align:top ">
-         <table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4 border=0>
-               <tr>
-               <!-- Image container -->
-                 <td colspan="2">
-                       <table>
-                         <tr>
-                               <td width="147" height="200" bgcolor="gray">
-                                 <img align="middle" border="0" width="100%" src="getbin.php?rand={$rand}" alt="{t}Personal picture{/t}">
-                               </td>
-                         </tr>
-                       </table>
-                 </td>
-               </tr>
-               <tr>
-                 <!-- Name, ... -->
-                 <td style="vertical-align:top;">
-                       <input type="hidden" name="MAX_FILE_SIZE" value="2000000">
-                        {t}User picture{/t}
-                 </td>
-                 <td>
-                       <input id="picture_file" name="picture_file" type="file" size="20" maxlength="255" accept="image/*.jpg">
-                       &nbsp;
-                       <input type=submit name="picture_remove" value="{t}Remove picture{/t}">
-                 </td>
-               </tr>
-         </table>
-       </td>
-  </tr>
-</table>
-<br>
diff --git a/plugins/personal/mail/class_mailAccount.inc b/plugins/personal/mail/class_mailAccount.inc
deleted file mode 100644 (file)
index 4b6a7b9..0000000
+++ /dev/null
@@ -1,1208 +0,0 @@
-<?php
-/*! \brief   mail plugin
-  \author  Cajus Pollmeier <pollmeier@gonicus.de>
-  \version 2.00
-  \date    24.07.2003
-
-  This class provides the functionality to read and write all attributes
-  relevant for gosaMailAccounts from/to the LDAP. It does syntax checking
-  and displays the formulars required.
- */
-
-class mailAccount extends plugin
-{
-  /* Definitions */
-  var $plHeadline         = "Mail";
-  var $plDescription      = "This does something";
-  var $method             = "mailMethod";
-
-  /* CLI vars */
-  var $gosaVacationStart                  = 0;
-  var $gosaVacationStop                   = 0;
-  var $view_logged = FALSE;
-
-  /* plugin specific values */
-  var $mail                               = "";
-  var $gosaMailAlternateAddress           = array();
-  var $gosaMailForwardingAddress          = array();
-  var $gosaMailDeliveryMode               = "[L        ]";
-  var $gosaMailServer                     = "";
-  var $gosaMailQuota                      = "";
-  var $gosaMailMaxSize                    = "";
-  var $gosaVacationMessage                = "";
-  var $gosaSpamSortLevel                  = "";
-  var $gosaSpamMailbox                    = "";
-
-  var $quotaUsage                         = 0;
-  var $forward_dialog                     = FALSE;
-  var $folder_prefix                      = "";
-  var $mailboxList                        = array("INBOX");
-  var $default_permissions                = "none";
-  var $member_permissions                 = "post";
-  var $members                            = array();
-  var $admins                             = array();
-  var $vacations                          = array();
-  var $perms                              = array(  "lrs"       => "read", 
-                                                    "lrsp"      => "post", 
-                                                    "lrsip"     => "append",
-                                                    "lrswipcd"  => "write", 
-                                                    "lrswipcda" => "all" );
-
-  /* attribute list for save action */
-  var $attributes= array("mail", "gosaMailServer", "gosaMailQuota", "gosaMailMaxSize","gosaMailForwardingAddress",
-      "gosaMailDeliveryMode", "gosaSpamSortLevel", "gosaSpamMailbox","gosaMailAlternateAddress","gosaVacationStart","gosaVacationStop",
-      "gosaVacationMessage", "gosaMailAlternateAddress", "gosaMailForwardingAddress");
-  var $objectclasses= array("gosaMailAccount");
-  var $uid              = "";
-
-  var $sieve_management = NULL;
-
-  /* constructor, if 'dn' is set, the node loads the given
-     'dn' from LDAP */
-  function mailAccount (&$config, $dn= NULL)
-  {
-    global $class_mapping;
-
-    /* Load bases attributes */
-    plugin::plugin($config, $dn);
-
-    /* Set uid */
-    if(isset($this->attrs['uid'])){
-      $this->uid = $this->attrs['uid'][0];
-    }
-    if(is_array($this->gosaMailServer) && isset($this->gosaMailServer[0])){
-      $this->gosaMailServer = $this->gosaMailServer[0];
-    }
-
-    /* Save initial account state */
-    $this->initially_was_account= $this->is_account;
-
-    /*  Set mailMethod to the one defined in gosa.conf */
-    if (isset($this->config->current['MAILMETHOD'])){
-      $method= $this->config->current['MAILMETHOD'];
-
-      $cls = get_correct_class_name("mailMethod$method");
-      if ($cls && class_exists($cls)){
-        $this->method= $cls;
-      } else {
-        print_red(sprintf(_("There is no mail method '%s' specified in your gosa.conf available."), $method));
-      }
-    }
-
-    
-    /* Create the account prefix  user. user/ 
-       Preset folder prefix. Will change it later to respect
-       altnamespace. */
-    if (isset($this->config->current['CYRUSUNIXSTYLE']) && $this->config->current['CYRUSUNIXSTYLE'] == "true"){
-      $this->folder_prefix= "user/";
-    }elseif (isset($this->config->data['MAIN']['CYRUSUNIXSTYLE']) && $this->config->data['MAIN']['CYRUSUNIXSTYLE'] == "true"){
-      $this->folder_prefix= "user/";
-    } else {
-      $this->folder_prefix= "user.";
-    }
-    
-    /* This is not a new account, parse additional attributes */
-    if (($dn !== NULL) && ($dn != "new") && $this->is_account){
-
-      /* Load attributes containing arrays */
-      foreach (array("gosaMailAlternateAddress", "gosaMailForwardingAddress") as $val){
-        $this->$val= array();
-        if (isset($this->attrs["$val"]["count"])){
-          for ($i= 0; $i<$this->attrs["$val"]["count"]; $i++){
-            array_push($this->$val, $this->attrs["$val"][$i]);
-          }
-        }
-      }
-
-
-      /* Only do IMAP actions if gosaMailServer attribute is set */
-      if (isset ($this->attrs["gosaMailServer"][0])){
-
-        $method = new $this->method($this->config);
-        $id     = $method->uattrib;
-
-        /* Adapt attributes if needed */
-        $method->fixAttributesOnLoad($this);
-
-        /* FixAttributesOnLoad possibly creates an array out of gosaMailServer.
-            If the mail tab wasn't opened once before saving, the account can't be saved */
-        if(is_array($this->gosaMailServer)){
-          $this->gosaMailServer = $this->gosaMailServer[0];
-        }
-
-        if ($method->connect($this->attrs["gosaMailServer"][0])){
-
-          /* Update quota values */
-          $quota= $method->getQuota($this->folder_prefix.$this->$id);
-         
-          if($quota){
-            if ($quota['gosaMailQuota'] == 2147483647){
-              $this->quotaUsage     = "";
-              $this->gosaMailQuota  = "";
-            } else {
-              $this->quotaUsage     = $quota['quotaUsage'];
-              $this->gosaMailQuota  = $quota['gosaMailQuota'];
-            }
-          }else{
-            $this->quotaUsage     = "";
-            $this->gosaMailQuota  = "";
-//            print_red(sprintf(_("Can't get quota information for '%s'."),$this->folder_prefix.$this->$id));
-          }
-
-          /* Get mailboxes / folder like INBOX ..*/
-          $this->mailboxList= $method->getMailboxList($this->folder_prefix.$this->$id,$this->$id);
-          
-          $method->disconnect();
-        }else{
-          /* Could not connect to ldap.
-           */
-          if (isset($this->attrs['gosaMailQuota'][0])){
-            $this->gosaMailQuota = $this->attrs['gosaMailQuota'][0];
-          }
-        }
-      }
-    }
-
-    /* Fill vacation array */
-    $this->vacation= array();
-    if (isset($this->config->current['VACATIONDIR'])){
-      $dir= $this->config->current['VACATIONDIR'];
-      if (is_dir($dir) && is_readable($dir)){
-
-        /* Look for files and build the vacation array */
-        $dh= opendir($dir);
-        while ($file = readdir($dh)){
-          $description= $this->parse_vacation("$dir/$file");
-          if ($description != ""){
-            $this->vacation["$dir/$file"]= $description;
-          }
-        }
-        closedir($dh);
-      }
-    }
-
-    /* Create sieve management class */
-    $method = new $this->method($this->config);
-    $id     = $method->uattrib;
-    $this->sieve_management = new sieveManagement($this->config,$this->dn,$this,$id);
-
-    /* Get global filter config */
-    if (!is_global("mailfilter")){
-      $ui= get_userinfo();
-      $base= get_base_from_people($ui->dn);
-      $mailfilter= array( "depselect"       => $base,
-          "muser"            => "",
-          "regex"           => "*");
-      register_global("mailfilter", $mailfilter);
-    }
-  }
-
-
-  function parse_vacation($file)
-  {
-    $desc= "";
-
-    if (is_file($file)){
-      $fh = fopen($file, "r");
-      $line= fgets($fh, 256);
-
-      if (!preg_match('/^DESC:/', $line)){
-        print_red (_("No DESC tag in vacation file:")." $file");
-        return $desc;
-      }
-      fclose ($fh);
-
-      $desc= trim(preg_replace('/^DESC:\s*/', '', $line));
-    }
-
-    return $desc;
-  }
-
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* Log view */
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","users/".get_class($this),$this->dn);
-    }
-
-    /* Initialise vars */
-
-    /* Load templating engine */
-    $smarty= get_smarty();
-    $display= "";
-
-    /* Get available mailserver */
-    $mailserver= array();
-    foreach ($this->config->data['SERVERS']['IMAP'] as $key => $val){
-      $mailserver[]= $key;
-    }
-
-    /* 
-     * Sieve Management 
-     */
-    if(isset($_POST['sieveManagement']) 
-        && preg_match("/C/",$this->gosaMailDeliveryMode)
-        && $this->acl_is_writeable("sieveManagement")) {
-
-      $this->dialog = $this->sieve_management;
-    }
-   
-    /* Cancel sieve edit */
-    if(isset($_POST['sieve_cancel'])){
-      $this->dialog = FALSE;
-    }
-    /* Save sieve changes */
-    if(isset($_POST['sieve_finish'])){
-      $this->sieve_management = $this->dialog;
-      $this->dialog = FALSE;
-    }
-    if(is_object($this->dialog)){
-      $this->dialog->save_object();
-      return($this->dialog->execute());
-    } 
-
-
-    /* Handle account state */
-    /* 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;
-      }
-    }
-
-    /* Do we represent a valid account? */
-    if (!$this->is_account && $this->parent === NULL){
-      $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\">&nbsp;<b>".
-        _("This account has no mail extensions.")."</b>";
-
-      $display.= back_to_main();
-      return ($display);
-    }
-
-    /* Show tab dialog headers */
-    if ($this->parent !== NULL){
-      if ($this->is_account){
-        if($this->accountDelegationsConfigured()){
-          $display= $this->show_disable_header(_("Remove mail account"),
-              _("This account can't be removed while there are delegations configured. Remove those delegations first."),TRUE,TRUE);
-        }else{
-          $display= $this->show_disable_header(_("Remove mail account"),
-              _("This account has mail features enabled. You can disable them by clicking below."));
-        }
-      } else {
-        $display= $this->show_enable_header(_("Create mail account"), _("This account has mail features disabled. You can enable them by clicking below."));
-        return ($display);
-      }
-    }
-
-
-    /* Forwarder  subdialog */
-
-    /* Trigger forward add dialog? */
-    if (isset($_POST['add_local_forwarder'])){
-      $this->forward_dialog= TRUE;
-      $this->dialog= TRUE;
-    }
-
-    /* Cancel forward add dialog? */
-    if (isset($_POST['add_locals_cancel'])){
-      $this->forward_dialog= FALSE;
-      $this->dialog= FALSE;
-    }
-
-    /* Finished adding of locals? */
-    if (isset($_POST['add_locals_finish'])){
-
-      /* Check if we are able to write gosaMailForwardingAddress */
-      if($this->acl_is_writeable("gosaMailForwardingAddress")){
-
-        /* Walk through list of forwarders, ignore own addresses */
-        foreach ($_POST['local_list'] as $val){
-          if (!in_array ($val, $this->gosaMailAlternateAddress) &&
-              $val != $this->mail){
-
-            $this->addForwarder($val);
-            $this->is_modified= TRUE;
-          }
-        }
-      }
-      $this->forward_dialog= FALSE;
-      $this->dialog= FALSE;
-    }
-
-    /* Add forward email addresses */
-    if (isset($_POST['add_forwarder'])){
-      if ($_POST['forward_address'] != ""){
-
-        /* Valid email address specified? */
-        $address= $_POST['forward_address'];
-        $valid= FALSE;
-        if (!is_email($address)){
-          if (!is_email($address, TRUE)){
-            if ($this->is_template){
-              $valid= TRUE;
-            } else {
-              print_red (_("You're trying to add an invalid email address to the list of forwarders."));
-            }
-          }
-        } elseif ($address == $this->mail
-            || in_array($address, $this->gosaMailAlternateAddress)) {
-
-          print_red (_("Adding your one of your own addresses to the forwarders makes no sense."));
-
-        } else {
-          $valid= TRUE;
-        }
-
-        if ($valid){
-
-          /* Add it, if we are able to write gosaMailForwardingAddress */
-          if($this->acl_is_writeable("gosaMailForwardingAddress")){
-            $this->addForwarder ($address);
-            $this->is_modified= TRUE;
-          }
-        }
-      }
-    }
-
-    /* Delete forward email addresses */
-    if (isset($_POST['delete_forwarder'])){
-      $this->delForwarder ($_POST['forwarder_list']);
-    }
-
-
-    /* Add alternate email addresses */
-    if (isset($_POST['add_alternate'])){
-
-      $valid= FALSE;
-      if (!is_email($_POST['alternate_address'])){
-        if ($this->is_template){
-          if (!(is_email($_POST['alternate_address'], TRUE))){
-            print_red (_("You're trying to add an invalid email address to the list of alternate addresses."));
-          } else {
-            $valid= TRUE;
-          }
-        } else {
-          print_red (_("You're trying to add an invalid email address to the list of alternate addresses."));
-        }
-
-      } else {
-        $valid= TRUE;
-      }
-
-      if ($valid && ($user= $this->addAlternate ($_POST['alternate_address'])) != ""){
-        $ui= get_userinfo();
-        if ($user != $ui->username){
-          print_red (_("The address you're trying to add is already used by user")." '$user'.");
-        }
-      }
-    }
-
-    /* Delete alternate email addresses */
-    if (isset($_POST['delete_alternate']) && isset($_POST['alternates_list'])){
-      $this->delAlternate ($_POST['alternates_list']);
-    }
-
-  
-    /* Vacation message */
-  
-    /* Import vacation message? */
-    if (isset($_POST["import_vacation"]) && isset($this->vacation[$_POST["vacation_template"]])){
-      $contents= "";
-      $lines= file($_POST["vacation_template"]);
-      foreach ($lines as $line){
-        if (!preg_match('/^DESC:/', $line)){
-          $contents.= $line;
-        }
-      }
-
-      /* Replace attributes */
-      $attrs= $this->parent->by_object['user']->attributes;
-      foreach ($attrs as $val){
-        
-        if(preg_match("/dateOfBirth/",$val)){
-          if($this->parent->by_object['user']->use_dob){
-            $contents= preg_replace("/%$val/",date("Y-d-m",$this->parent->by_object['user']->dateOfBirth),$contents);
-          }
-        }else {
-          $contents= preg_replace("/%$val/",
-              $this->parent->by_object['user']->$val, $contents);
-        }
-        
-        /* Replace vacation start and end time */
-        if(preg_match("/%start/",$contents)){
-          $contents = preg_replace("/%start/",date("d.m.Y",$this->gosaVacationStart),$contents);
-        }
-        if(preg_match("/%end/",$contents)){
-          $contents = preg_replace("/%end/",date("d.m.Y",$this->gosaVacationStop),$contents);
-        }
-      }
-
-      /* Save message */
-      $this->gosaVacationMessage= htmlspecialchars($contents);
-    }
-
-  
-    /* Display forward dialog if requested above */
-
-    /* Show forward add dialog */
-    if ($this->forward_dialog){
-      $ldap= $this->config->get_ldap_link();
-
-      /* Save data */
-      $mailfilter= get_global("mailfilter");
-      foreach( array("depselect", "muser", "regex") as $type){
-        if (isset($_POST[$type])){
-          $mailfilter[$type]= $_POST[$type];
-        }
-      }
-      if (isset($_GET['search'])){
-        $s= mb_substr($_GET['search'], 0, 1, "UTF8")."*";
-        if ($s == "**"){
-          $s= "*";
-        }
-        $mailfilter['regex']= $s;
-      }
-      register_global("mailfilter", $mailfilter);
-
-      /* Get actual list */
-      $mailusers= array ();
-      if ($mailfilter['regex'] != '*' && $mailfilter['regex'] != ""){
-        $regex= $mailfilter['regex'];
-        $filter= "(|(mail=$regex)(gosaMailAlternateAddress=$regex))";
-      } else {
-        $filter= "";
-      }
-      if ($mailfilter['muser'] != ""){
-        $user= $mailfilter['muser'];
-        $filter= "$filter(|(uid=$user)(cn=$user)(givenName=$user)(sn=$user))";
-      }
-
-      /* Add already present people to the filter */
-      $exclude= "";
-      foreach ($this->gosaMailForwardingAddress as $mail){
-        $exclude.= "(mail=$mail)";
-      }
-      if ($exclude != ""){
-        $filter.= "(!(|$exclude))";
-      }
-
-      $res= get_list("(&(objectClass=gosaMailAccount)$filter)", "users", $mailfilter['depselect'], 
-                     array("sn", "mail", "givenName"), GL_SIZELIMIT | GL_SUBSEARCH);
-      $ldap->cd($mailfilter['depselect']);
-      $ldap->search ("(&(objectClass=gosaMailAccount)$filter)", array("sn", "mail", "givenName"));
-      error_reporting (0);
-      while ($attrs= $ldap->fetch()){
-        if(preg_match('/%/', $attrs['mail'][0])){
-          continue;
-        }
-        $name= $this->make_name($attrs);
-        $mailusers[$attrs['mail'][0]]= $name."&lt;".
-          $attrs['mail'][0]."&gt;";
-      }
-      error_reporting (E_ALL | E_STRICT);
-      natcasesort ($mailusers);
-      reset ($mailusers);
-
-      /* Show dialog */
-      $smarty->assign("search_image", get_template_path('images/search.png'));
-      $smarty->assign("usearch_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.png'));
-      $smarty->assign("launchimage", get_template_path('images/small_filter.png'));
-      $smarty->assign("mailusers", $mailusers);
-      if (isset($_POST['depselect'])){
-        $smarty->assign("depselect", $_POST['depselect']);
-      }
-      $smarty->assign("deplist", $this->config->idepartments);
-      $smarty->assign("apply", apply_filter());
-      $smarty->assign("alphabet", generate_alphabet());
-      $smarty->assign("hint", print_sizelimit_warning());
-      foreach( array("depselect", "muser", "regex") as $type){
-        $smarty->assign("$type", $mailfilter[$type]);
-      }
-      $smarty->assign("hint", print_sizelimit_warning());
-
-      $display.= $smarty->fetch (get_template_path('mail_locals.tpl', TRUE, dirname(__FILE__)));
-      return ($display);
-    }
-
-    /* Display mail account tab */
-
-    $smarty->assign("mailServers", $mailserver);
-    $SkipWrite = (!isset($this->parent) || !$this->parent) && !isset($_SESSION['edit']);
-
-    $tmp  = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $transl){
-      $smarty->assign("$name"."ACL", $this->getacl($name,$SkipWrite));
-    }
-
-    foreach(array("gosaMailServer", "gosaMailQuota", "perms", "mail",
-          "gosaMailAlternateAddress", "gosaMailForwardingAddress",
-          "gosaVacationMessage", "gosaMailDeliveryMode", "gosaVacationStart",
-          "gosaVacationStop", "gosaMailMaxSize", "gosaSpamSortLevel", "gosaSpamMailbox") as $val){
-      $smarty->assign("$val", $this->$val);
-    }
-
-    if (is_numeric($this->gosaMailQuota) && $this->gosaMailQuota != 0){
-      $smarty->assign("quotausage", progressbar(round(($this->quotaUsage * 100)/ $this->gosaMailQuota),100,15,true));
-      $smarty->assign("quotadefined", "true");
-    } else {
-      $smarty->assign("quotadefined", "false");
-    }
-
-    /* Disable mail field if needed */
-    $method= new $this->method($this->config);
-    if ($method->uattrib == "mail" && $this->initially_was_account){
-      $smarty->assign("mailACL", preg_replace("/w/","",$this->getacl("mail",$SkipWrite)));
-    }
-
-    /* Disable/Enable range select, but do not disable them twice 
-     *  if they are already diabled by "use own sieve script"
-     */
-    if (preg_match('/V/', $this->gosaMailDeliveryMode) || preg_match("/C/",$this->gosaMailDeliveryMode)){
-      $smarty->assign('rangeEnabled', "");
-    } else {
-      $smarty->assign('rangeEnabled', "disabled");
-    }
-
-    if (!preg_match("/L/", $this->gosaMailDeliveryMode)) {
-      $smarty->assign("only_local", "checked");
-    } else {
-      $smarty->assign("only_local", "");
-    }
-
-    $types = array(
-          "V"=>"use_vacation",
-          "S"=>"use_spam_filter",
-          "R"=>"use_mailsize_limit",
-          "I"=>"drop_own_mails",
-          "C"=>"own_script");
-
-    /* Fill checkboxes */
-    foreach($types as $option => $varname){
-      if (preg_match("/".$option."/", $this->gosaMailDeliveryMode)) {
-        $smarty->assign($varname, "checked");
-      } else {
-        $smarty->assign($varname, "");
-      }
-    }
-   
-    /* Display mail account tab */
-    if($this->gosaVacationStart ==0){
-      $date= getdate(time());
-    }else{
-      $date= getdate($this->gosaVacationStart);
-    }
-    $days= array();
-    for($d= 1; $d<32; $d++){
-      $days[$d]= $d;
-    }
-    $years= array();
-    for($y= $date['year']-10; $y<$date['year']+10; $y++){
-      $years[]= $y;
-    }
-    $months= array(_("January"), _("February"), _("March"), _("April"),
-        _("May"), _("June"), _("July"), _("August"), _("September"),
-        _("October"), _("November"), _("December"));
-    $smarty->assign("start_day", $date["mday"]);
-    $smarty->assign("days", $days);
-    $smarty->assign("months", $months);
-    $smarty->assign("start_month", $date["mon"]-1);
-    $smarty->assign("years", $years);
-    $smarty->assign("start_year", $date["year"]);
-
-    if($this->gosaVacationStop ==0){
-      $date= getdate(time());
-      $date["mday"]++;
-    }else{
-      $date= getdate($this->gosaVacationStop);
-    }
-    $smarty->assign("end_day", $date["mday"]);
-    $smarty->assign("end_month", $date["mon"]-1);
-    $smarty->assign("end_year", $date["year"]);
-
-
-    /* Have vacation templates? */
-    $smarty->assign("template", "");
-    if (count($this->vacation)){
-      $smarty->assign("show_templates", "true");
-      $smarty->assign("vacationtemplates", $this->vacation);
-      if (isset($_POST['vacation_template'])){
-        $smarty->assign("template", $_POST['vacation_template']);
-      }
-    } else {
-      $smarty->assign("show_templates", "false");
-    }
-
-    /* Fill spam selector */
-    $spamlevel= array();
-    for ($i= 0; $i<21; $i++){
-      $spamlevel[]= $i;
-    }
-    $smarty->assign("spamlevel", $spamlevel);
-    $smarty->assign("spambox", $this->mailboxList);
-
-    $display.= $smarty->fetch (get_template_path('generic.tpl', TRUE, dirname(__FILE__)));
-    return ($display);
-  }
-
-
-  /* remove object from parent */
-  function remove_from_parent()
-  {
-    /* Cancel if there's nothing to do here */
-    if (!$this->initially_was_account){
-      return;
-    }
-    
-    /* include global link_info */
-    $ldap= $this->config->get_ldap_link();
-
-    /* Remove and write to LDAP */
-    plugin::remove_from_parent();
-
-    /* Zero arrays */
-    $this->attrs['gosaMailAlternateAddress']= array();
-    $this->attrs['gosaMailForwardingAddress']= array();
-
-    /* Adapt attributes if needed */
-    $method= new $this->method($this->config);
-    $method->fixAttributesOnRemove($this);
-
-    @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,$this->attributes, "Save");
-    $ldap->cd($this->dn);
-    $this->cleanup();
-
-    $ldap->modify ($this->attrs); 
-
-    /* Add "view" to logging class */ 
-    new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-
-    show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/mail account with dn '%s' failed."),$this->dn));
-
-    /* Connect to IMAP server for account deletion */
-    if ($this->gosaMailServer != ""){
-      $method= new $this->method($this->config);
-      $id= $method->uattrib;
-      if ($method->connect($this->gosaMailServer)){
-
-        /* Remove account from IMAP server */
-        $method->deleteMailbox($this->folder_prefix.$this->$id);
-        $method->disconnect();
-      }
-    }
-
-    /* Update shared folder membership, ACL may need to be updated */
-    $this->updateSharedFolder(); 
-
-    /* Optionally execute a command after we're done */
-    $this->handle_post_events("remove",array("uid" => $this->uid));
-  }
-
-  
-  /* check if we have some delegations configured, those delegations must be removed first */
-  function accountDelegationsConfigured()
-  { 
-    /* We are in administrational edit mode.
-        Check tab configurations directly */
-    if(isset($this->attrs)){
-      $checkArray  = array("kolabInvitationPolicy","unrestrictedMailSize", "calFBURL","kolabDelegate","kolabFreeBusyFuture");
-      foreach($checkArray as $index){
-        if(isset($this->attrs[$index])){
-           return(true);
-        }
-      }
-    }
-    return(false); 
-  }
-
-  /* Save data to object */
-  function save_object()
-  {
-    if (isset($_POST['mailTab'])){
-
-      /* Save ldap attributes */
-      plugin::save_object();
-
-
-      if(isset($_POST['own_script'])){
-
-        if(!preg_match("/C/",$this->gosaMailDeliveryMode)){
-          $str= preg_replace("/[\[\]]/","",$this->gosaMailDeliveryMode);
-          $this->gosaMailDeliveryMode = "[".$str."C]";
-        }
-
-      }else{
-
-        /* Assemble mail delivery mode
-           The mode field in ldap consists of values between braces, this must
-           be called when 'mail' is set, because checkboxes may not be set when
-           we're in some other dialog.
-
-          Example for gosaMailDeliveryMode [LR        ]
-          L: Local delivery
-          R: Reject when exceeding mailsize limit
-          S: Use spam filter
-          V: Use vacation message
-          C: Use custm sieve script
-          I: Only insider delivery */
-
-        $tmp= preg_replace("/[^a-z]/i","",$this->gosaMailDeliveryMode);
-
-
-        /* Handle delivery flags */
-        if($this->acl_is_writeable("gosaMailDeliveryModeL")){
-          if(!preg_match("/L/",$tmp) && !isset($_POST['only_local'])){
-            $tmp.="L";
-          }elseif(preg_match("/L/",$tmp) && isset($_POST['only_local'])){
-            $tmp = preg_replace("/L/","",$tmp);
-          }
-        }
-
-        $opts = array(     
-            "R"   => "use_mailsize_limit",
-            "S"   => "use_spam_filter",
-            "V"   => "use_vacation",
-            "C"   => "own_script",
-            "I"   => "drop_own_mails");
-
-        foreach($opts as $flag => $post){
-          if($this->acl_is_writeable("gosaMailDeliveryMode".$flag)){
-            if(!preg_match("/".$flag."/",$tmp) && isset($_POST[$post])){
-              $tmp.= $flag;
-            }elseif(preg_match("/".$flag."/",$tmp) && !isset($_POST[$post])){
-              $tmp = preg_replace("/".$flag."/","",$tmp);
-            }
-          }
-        }
-
-        $tmp= "[$tmp]";
-        if ($this->gosaMailDeliveryMode != $tmp){
-          $this->is_modified= TRUE;
-        }
-        $this->gosaMailDeliveryMode= $tmp;
-      }
-    }
-
-  }
-
-
-  /* Save data to LDAP, depending on is_account we save or delete */
-  function save()
-  {
-    $ldap= $this->config->get_ldap_link();
-
-    /* Call parents save to prepare $this->attrs */
-    plugin::save();
-
-    /* Save arrays */
-    $this->attrs['gosaMailAlternateAddress']= $this->gosaMailAlternateAddress;
-    $this->attrs['gosaMailForwardingAddress']= $this->gosaMailForwardingAddress;
-
-    /* Adapt attributes if needed */
-    $method= new $this->method($this->config);
-    $id= $method->uattrib;
-
-    $method->fixAttributesOnStore($this);
-
-    /* Remove Mailquota if = "" or "0"  */
-    if((isset($this->attrs['gosaMailQuota']))&&(!$this->attrs['gosaMailQuota'])) {
-      $this->attrs['gosaMailQuota']=0;
-    }
-
-    if(empty($this->attrs['gosaSpamMailbox'])){
-      unset($this->attrs['gosaSpamMailbox']);
-    }
-
-    $this->attrs['mail'] = strtolower($this->attrs['mail']); 
-
-        /* Remove attributes - if not needed */
-    if (!preg_match('/V/', $this->gosaMailDeliveryMode)){
-      unset($this->attrs['gosaVacationStart']);
-      unset($this->attrs['gosaVacationStop']);
-    }
-
-
-    /* Remove attributes - if not needed */
-    if (!preg_match('/V/', $this->gosaMailDeliveryMode)){
-      unset($this->attrs['gosaVacationStart']);
-      unset($this->attrs['gosaVacationStop']);
-    }
-
-    /* Save data to LDAP */
-    $ldap->cd($this->dn);
-    $this->cleanup();
-    $ldap->modify ($this->attrs); 
-
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/mail account with dn '%s' failed."),$this->dn));
-
-    /* Log last action */ 
-    if($this->initially_was_account){
-      new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }else{
-      new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }
-
-    /* Only do IMAP actions if we are not a template */
-    if (!$this->is_template){
-
-      if ($method->connect($this->gosaMailServer)){
-        $method->updateMailbox($this->folder_prefix.$this->$id);
-        
-        $method->setQuota($this->folder_prefix.$this->$id, $this->gosaMailQuota);
-        $method->disconnect();
-
-        /* Ensure that this is an existing account */
-        if(1==1 || $this->initially_was_account){
-
-          /* Write sieve information only if not in C mode */
-          if (!is_integer(strpos($this->gosaMailDeliveryMode, "C"))){
-            $method->configureFilter($this->$id,
-                $this->gosaMailDeliveryMode,
-                $this->mail,
-                $this->gosaMailAlternateAddress,
-                $this->gosaMailMaxSize,
-                $this->gosaSpamMailbox,
-                $this->gosaSpamSortLevel,
-                $this->gosaVacationMessage);
-            $this->is_modified = TRUE;
-          }else{
-            $this->sieve_management->save();
-          }
-        }
-      }
-    }
-
-    /* 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", array("uid" => $this->uid));
-      }
-    } else {
-      $this->handle_post_events("add", array("uid" => $this->uid));
-    }
-
-    $this->updateSharedFolder();
-  }
-
-
-  /* Check formular input */
-  function check()
-  {
-    if(!$this->is_account) return(array());
-
-    $ldap= $this->config->get_ldap_link();
-
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    if(empty($this->gosaMailServer)){
-      $message[]= _("There is no valid mailserver specified, please add one in the system setup.");
-    }
-
-    /* must: mail */
-    if ($this->mail == ""){
-      $message[]= _("The required field 'Primary address' is not set.");
-    }
-    if ($this->is_template){
-      if (!is_email($this->mail, TRUE)){
-        $message[]= _("Please enter a valid email address in 'Primary address' field.");
-      }
-    } else {
-      if (!is_email($this->mail)){
-        $message[]= _("Please enter a valid email address in 'Primary address' field.");
-      }
-    }
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search ("(&(!(objectClass=gosaUserTemplate))(objectClass=gosaMailAccount)(|(mail=".$this->mail.")(gosaMailAlternateAddress=".$this->mail."))(!(uid=".$this->uid."))(!(cn=".$this->uid.")))", array("uid"));
-    if ($ldap->count() != 0){
-      $message[]= _("The primary address you've entered is already in use.");
-    }
-
-    /* Check quota */
-    if ($this->gosaMailQuota != '' && $this->acl_is_writeable("gosaMailQuota")){
-      if (!is_numeric($this->gosaMailQuota)) {
-        $message[]= _("Value in 'Quota size' is not valid.");
-      } else {
-        $this->gosaMailQuota= (int) $this->gosaMailQuota;
-      }
-    }
-
-    /* Check rejectsize for integer */
-    if ($this->gosaMailMaxSize != '' && $this->acl_is_writeable("gosaMailMaxSize")){
-      if (!is_numeric($this->gosaMailMaxSize)){
-        $message[]= _("Please specify a vaild mail size for mails to be rejected.");
-      } else {
-        $this->gosaMailMaxSize= (int) $this->gosaMailMaxSize;
-      }
-    }
-
-    /* Need gosaMailMaxSize if use_mailsize_limit is checked */
-    if (is_integer(strpos($this->gosaMailDeliveryMode, "R")) && 
-        $this->gosaMailMaxSize == ""){
-
-      $message[]= _("You need to set the maximum mail size in order to reject anything.");
-    }
-
-    if((preg_match("/S/", $this->gosaMailDeliveryMode))&&(empty($this->gosaSpamMailbox))) {
-      $message[]= _("You specified Spam settings, but there is no Folder specified.");
-    }
-
-    if (preg_match('/V/', $this->gosaMailDeliveryMode) && $this->gosaVacationStart > $this->gosaVacationStop){
-      $message[]= _("Time interval to show vacation message is not valid.");
-    }
-
-    return ($message);
-  }
-
-
-  /* Adapt from template, using 'dn' */
-  function adapt_from_template($dn)
-  {
-    plugin::adapt_from_template($dn);
-
-    foreach (array("gosaMailAlternateAddress", "gosaMailForwardingAddress") as $val){
-      $this->$val= array();
-      if (isset($this->attrs["$val"]["count"])){
-        for ($i= 0; $i<$this->attrs["$val"]["count"]; $i++){
-          $value= $this->attrs["$val"][$i];
-          foreach (array("sn", "givenName", "uid") as $repl){
-            if (preg_match("/%$repl/i", $value)){
-              $value= preg_replace ("/%$repl/i", $this->parent->$repl, $value);
-            }
-          }
-          array_push($this->$val, strtolower(rewrite($value)));
-        }
-      }
-    }
-    $this->mail= strtolower(rewrite($this->mail));
-  }
-
-
-  /* Add entry to forwarder list */
-  function addForwarder($address)
-  {
-    if($this->acl_is_writeable("gosaMailForwardingAddress")){
-      $this->gosaMailForwardingAddress[]= $address;
-      $this->gosaMailForwardingAddress= array_unique ($this->gosaMailForwardingAddress);
-      sort ($this->gosaMailForwardingAddress);
-      reset ($this->gosaMailForwardingAddress);
-      $this->is_modified= TRUE;
-    }else{
-      print_red(_("You are not allowed to write mail forwarding."));
-    }
-  }
-
-
-  /* Remove list of addresses from forwarder list */
-  function delForwarder($addresses)
-  {
-    if($this->acl_is_writeable("gosaMailForwardingAddress")){
-      $this->gosaMailForwardingAddress= array_remove_entries ($addresses, $this->gosaMailForwardingAddress);
-      $this->is_modified= TRUE;
-    }else{
-      print_red(_("You are not allowed to write mail forwarding."));
-    }
-  }
-
-
-  /* Add given mail address to the list of alternate adresses , 
-     check if this mal address is used, skip adding in this case */
-  function addAlternate($address)
-  {
-    if($this->acl_is_writeable("gosaMailAlternateAddress")){
-      $ldap= $this->config->get_ldap_link();
-      $address= strtolower($address);
-
-      /* Is this address already assigned in LDAP? */
-      $ldap->cd ($this->config->current['BASE']);
-      $ldap->search ("(&(objectClass=gosaMailAccount)(|(mail=$address)"."(gosaMailAlternateAddress=$address)))", array("uid"));
-      $ldap->search ("(&(!(objectClass=gosaUserTemplate))(objectClass=gosaMailAccount)(|(mail=$address)"."(gosaMailAlternateAddress=$address)))", array("uid"));
-
-      if ($ldap->count() > 0){
-        $attrs= $ldap->fetch ();
-        return ($attrs["uid"][0]);
-      }
-
-      /* Add to list of alternates */
-      if (!in_array($address, $this->gosaMailAlternateAddress)){
-        $this->gosaMailAlternateAddress[]= $address;
-        $this->is_modified= TRUE;
-      }
-
-      sort ($this->gosaMailAlternateAddress);
-      reset ($this->gosaMailAlternateAddress);
-      return ("");
-    }else{
-      print_red(_("You are not allowed to write mail alternate address."));
-    }
-  }
-
-
-  function delAlternate($addresses)
-  {
-    if($this->acl_is_writeable("gosaMailAlternateAddress")){
-      $this->gosaMailAlternateAddress= array_remove_entries ($addresses,$this->gosaMailAlternateAddress);
-      $this->is_modified= TRUE;
-    }else{
-      print_red(_("You are not allowed to write mail alternate address."));
-    }
-  }
-
-  function make_name($attrs)
-  {
-    $name= "";
-    if (isset($attrs['sn'][0])){
-      $name= $attrs['sn'][0];
-    }
-    if (isset($attrs['givenName'][0])){
-      if ($name != ""){
-        $name.= ", ".$attrs['givenName'][0];
-      } else {
-        $name.= $attrs['givenName'][0];
-      }
-    }
-    if ($name != ""){
-      $name.= " ";
-    }
-
-    return ($name);
-  }
-
-  
-  /* Create the mail part for the copy & paste dialog */
-  function getCopyDialog()
-  {
-    if(!$this->is_account) return("");
-    $smarty = get_smarty();
-    $smarty->assign("mail",$this->mail); 
-    $smarty->assign("gosaMailAlternateAddress",$this->gosaMailAlternateAddress);
-    $smarty->assign("gosaMailForwardingAddress",$this->gosaMailForwardingAddress);
-    $str = $smarty->fetch(get_template_path("copypaste.tpl",TRUE, dirname(__FILE__)));
-
-    $ret = array();
-    $ret['status'] = "";
-    $ret['string'] = $str;
-    return($ret);
-  }
-
-  function saveCopyDialog()
-  {
-    if(!$this->is_account) return;  
-
-    /* Execute to save mailAlternateAddress && gosaMailForwardingAddress */
-    $this->execute();
-    
-    if(isset($_POST['mail'])){
-      $this->mail = $_POST['mail'];
-    }
-
-  }
-
-  function allow_remove()
-  {
-    if (isset($this->config->current['MAILMETHOD'])){
-      $method= $this->config->current['MAILMETHOD'];
-      if(preg_match("/olab/i",$method)){
-        $ldap = $this->config->get_ldap_link();
-        $ldap->cd($this->config->current['BASE']);
-        $ldap->cat($this->dn);
-        if($ldap->count()){
-          $attrs = $ldap->fetch();
-          if(isset($attrs['kolabDeleteFlag'])){ 
-            return(_("Waiting for kolab to remove mail properties."));
-          }elseif(in_array("gosaMailAccount",$attrs['objectClass'])){
-            return(_("Please remove the mail account first, to allow kolab to call its remove methods."));
-          }
-        }
-      }
-    }
-  }
-
-   
-  function PrepareForCopyPaste($source)
-  {
-    plugin::PrepareForCopyPaste($source);
-
-    /* Reset alternate mail addresses */
-    $this->gosaMailAlternateAddress = array();    
-   }
-
-
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"     => _("Mail"),
-          "plDescription"   => _("Mail settings"),
-          "plSelfModify"    => TRUE,
-          "plDepends"       => array("user"),                     // This plugin depends on
-          "plPriority"      => 4,                                 // Position in tabs
-          "plSection"     => array("personal" => _("My account")),
-          "plCategory"    => array("users"),
-          "plOptions"       => array(),
-  
-          "plProvidedAcls"  => array(
-            "mail"                      =>  _("Mail address"),
-            "gosaMailServer"            =>  _("Mail server"),
-            "gosaMailQuota"             =>  _("Quota size"),
-
-            "gosaMailDeliveryModeV"     =>  _("Add vacation information"),  // This is flag of gosaMailDeliveryMode
-            "gosaVacationMessage"       =>  _("Vacation message"),
-
-            "gosaMailDeliveryModeS"     =>  _("Use spam filter"),           // This is flag of gosaMailDeliveryMode
-            "gosaSpamSortLevel"         =>  _("Spam level"),
-            "gosaSpamMailbox"           =>  _("Spam mail box"),
-
-            "sieveManagement"           =>  _("Sieve management"),
-
-            "gosaMailDeliveryModeR"     =>  _("Reject due to mailsize"),    // This is flag of gosaMailDeliveryMode
-            "gosaMailMaxSize"           =>  _("Mail max size"),
-
-            "gosaMailForwardingAddress" =>  _("Forwarding address"),
-            "gosaMailDeliveryModeL"     =>  _("Local delivery"),            // This is flag of gosaMailDeliveryMode
-            "gosaMailDeliveryModeI"     =>  _("No delivery to own mailbox "),     // This is flag of gosaMailDeliveryMode
-            "gosaMailAlternateAddress"  =>  _("Mail alternative addresses"),
-
-            "gosaMailForwardingAddress" =>  _("Forwarding address"),
-            "gosaMailDeliveryModeC"     =>  _("Use custom sieve script"))   // This is flag of gosaMailDeliveryMode
-        ));
-  }
-
-  /* Upated shared folder ACLs 
-   */
-  function updateSharedFolder()
-  {
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(&(objectClass=posixGroup)(objectClass=gosaMailAccount)(memberUid=".$this->uid."))",array('dn','cn'));
-    if(class_exists("grouptabs")){
-      while($attrs = $ldap->fetch()){
-        $tmp = new grouptabs($this->config, $this->config->data['TABS']['GROUPTABS'], $attrs['dn']);
-        if(isset($tmp->by_object['mailgroup'])){
-          $tmp->by_object['mailgroup']->members= $tmp->by_object['group']->memberUid;
-          if(!$this->is_account){
-            $tmp->by_object['mailgroup']->removeUserAcl($this->uid);
-            $tmp->by_object['mailgroup']->removeUserAcl($this->mail);
-          }
-          $tmp->by_object['mailgroup']->save();
-        }
-      }
-    } 
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/personal/mail/copypaste.tpl b/plugins/personal/mail/copypaste.tpl
deleted file mode 100644 (file)
index 56ec107..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-<h2>{t}Mail settings{/t}</h2>
-<table style='width:100%;' cellspacing=0>
-       <tr>
-               <td style='width:50%;vertical-align:top; border-right:1px solid #AAA'>
-                       <table style="width:100%;">
-                               <tr>
-                                       <td><label for="mail">{t}Primary address{/t}</label>{$must}</td>
-                                       <td><input id="mail" name="mail" size=35 maxlength=65 value="{$mail}"></td>
-                               </tr>
-                               <tr>
-                                       <td colspan="2">
-                                               <p style="margin-bottom:0px;">
-                                                       <b><label for="forwarder_list">{t}Forward messages to{/t}</label></b>
-                                               </p>
-                                       </td>
-                               </tr>
-                       </table>
-               </td>
-               <td style="vertical-align:bottom;border-left:1px solid #A0A0A0">
-                       <table style="width:100%;">
-                               <tr>
-                                       <td style="vertical-align:top;">
-                                               <h2>
-                                                       <img class="center" alt="" align="middle" src="images/alternatemail.png" />
-                                                       <label for="alternates_list">{t}Alternative addresses{/t}</label>
-                                               </h2>
-                                       </td>
-                               </tr>
-                       </table>
-               </td>
-       </tr>
-       <tr>
-               <td>
-                       <table style='width:100%;'>
-                               <tr>
-                                       <td colspan="2">
-                                               <select id="gosaMailForwardingAddress" style="width:100%; height:100px;" name="forwarder_list[]" size=15 multiple >
-                                                               {html_options values=$gosaMailForwardingAddress output=$gosaMailForwardingAddress}
-                                                               <option disabled>&nbsp;</option>
-                                               </select>
-                                               <br>
-                                           <input name="forward_address" size=20 align="middle" maxlength=65   value="">
-                                           <input type="submit" value="{t}Add{/t}" name="add_forwarder"        >&nbsp;
-                                           <input type="submit" value="{t}Add local{/t}" name="add_local_forwarder"    >&nbsp;
-                                           <input type="submit" value="{t}Delete{/t}" name="delete_forwarder"  >
-                                       </td>
-                               </tr>
-                       </table>
-               </td>
-               <td style="vertical-align:bottom;border-left:1px solid #A0A0A0">
-                       <table style='width:100%;'>
-                               <tr>
-                                       <td colspan="2" >
-                                               <select id="alternates_list" style="width:100%;height:100px;" name="alternates_list[]" size="15"
-                                                        multiple title="{t}List of alternative mail addresses{/t}"> 
-                                                               {html_options values=$gosaMailAlternateAddress output=$gosaMailAlternateAddress}
-                                                               <option disabled>&nbsp;</option>
-                                               </select>
-                                               <br/>
-                                               <input name="alternate_address" size="30" align="middle" maxlength="65" value="">
-                                               <input type=submit value="{t}Add{/t}" name="add_alternate">
-                                               <input type=submit value="{t}Delete{/t}" name="delete_alternate">
-                                       </td>
-                               </tr>
-                       </table>
-               </td>           
-       </tr>
-</table>
-<br>
-<br>
diff --git a/plugins/personal/mail/generic.tpl b/plugins/personal/mail/generic.tpl
deleted file mode 100644 (file)
index 785fd44..0000000
+++ /dev/null
@@ -1,314 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding="0" border="0">
- <tr>
-  <td style="width:50%; vertical-align:top;">
-
-   <h2><img class="center" alt="" align="middle" src="images/rightarrow.png" />&nbsp;{t}Generic{/t}</h2>
-   <table summary="">
-    <tr>
-     <td><label for="mail">{t}Primary address{/t}</label>{$must}</td>
-     <td>
-{render acl=$mailACL}
-       <input id="mail" name="mail" size=35 maxlength=65 value="{$mail}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><label for="gosaMailServer">{t}Server{/t}</label></td>
-     <td>
-{render acl=$gosaMailServerACL}
-      <select size="1" id="gosaMailServer" name="gosaMailServer" title="{t}Specify the mail server where the user will be hosted on{/t}">
-       {html_options values=$mailServers output=$mailServers selected=$gosaMailServer}
-       <option disabled>&nbsp;</option>
-      </select>
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td>
-      <br>
-      {t}Quota usage{/t}
-     </td>
-     <td>
-      <br>
-      {if $quotadefined eq "true"}
-       {$quotausage}
-      {else}
-      {t}not defined{/t}
-      {/if}
-     </td>
-    </tr>
-    <tr>
-     <td><label for="gosaMailQuota">{t}Quota size{/t}</label></td>
-     <td>
-{render acl=$gosaMailQuotaACL}
-      <input id="gosaMailQuota" name="gosaMailQuota" size="6" align="middle" maxlength="60" 
-               value="{$gosaMailQuota}"> MB
-{/render}
-     </td>
-    </tr>
-       </table>
-  </td>
-
-
-  <td style="border-left:1px solid #A0A0A0;vertical-align:top;">
-       &nbsp;
-  </td>
-       <td>    
-   <h2><img class="center" alt="" align="middle" src="images/alternatemail.png" /><label for="alternates_list"> {t}Alternative addresses{/t}</label></h2>
-{render acl=$gosaMailAlternateAddressACL}
-   <select id="alternates_list" style="width:100%;height:100px;" name="alternates_list[]" size="15" multiple 
-       title="{t}List of alternative mail addresses{/t}">
-       {html_options values=$gosaMailAlternateAddress output=$gosaMailAlternateAddress}
-       <option disabled>&nbsp;</option>
-{/render}
-   </select>
-   <br />
-{render acl=$gosaMailAlternateAddressACL}
-   <input name="alternate_address" size="30" align="middle" maxlength="65" value="">
-{/render}
-{render acl=$gosaMailAlternateAddressACL}
-   <input type=submit value="{t}Add{/t}" name="add_alternate">
-{/render}
-{render acl=$gosaMailAlternateAddressACL}
-   <input type=submit value="{t}Delete{/t}" name="delete_alternate">
-{/render}
-  </td>
- </tr>
-</table>
-<!-- SIEVE -->
-<p class="seperator">&nbsp;</p>
-<h2><img class="center" alt="" align="middle" src="images/envelope.png" />&nbsp;{t}Mail options{/t}</h2>
-<table summary="" style="vertical-align:top; text-align:left;" cellpadding=4 border=0>
- <tr>
-  <td>
-{render acl=$gosaMailDeliveryModeCACL}
-   <input type=checkbox name="own_script" value="1" {$own_script} 
-               onClick="       
-                       changeState('sieveManagement');
-                       changeState('drop_own_mails');
-                       changeState('use_vacation');
-                       changeState('use_spam_filter');
-                       changeState('use_mailsize_limit');
-                       changeState('import_vacation');
-                       changeState('vacation_template');
-//                     changeState('forward_address');
-//                     changeState('add_forwarder');
-//                     changeState('add_local_forwarder');
-//                     changeState('delete_forwarder');
-                       changeState('only_local');
-                       changeState('gosaVacationMessage');
-                       changeState('gosaSpamSortLevel');
-                       changeState('gosaSpamMailbox');
-                       changeState('gosaMailMaxSize');
-                       changeStates();
-
-               "
-
-> {t}Use custom sieve script{/t} <b>({t}disables all Mail options!{/t})</b>
-{/render}
-  </td>
- </tr>
- <tr>
-  <td>
-{render acl=$sieveManagementACL}       
-   <input {if $own_script == ""} disabled {/if} id='sieveManagement' type='submit' name='sieveManagement' value='{t}Sieve Management{/t}'>
-{/render}
-  </td>
- </tr>
-</table>
-
-
-<p class="seperator">&nbsp;</p>
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4 border=0>
- <tr style="padding-bottom:0px;">
-  <td style="width:50%">
-{render acl=$gosaMailDeliveryModeIACL}
-   <input {if $own_script != ""} disabled {/if} id='drop_own_mails' type=checkbox name="drop_own_mails" value="1" {$drop_own_mails} title="{t}Select if you want to forward mails without getting own copies of them{/t}"> {t}No delivery to own mailbox{/t}
-{/render}
-
-<br>
-{render acl=$gosaMailDeliveryModeVACL}
- <input type=checkbox name="use_vacation" value="1" {$use_vacation} id="use_vacation" {if $own_script != ""} disabled {/if}
-    title="{t}Select to automatically response with the vacation message defined below{/t}"
-onclick="changeState('day'); changeState('month'); changeState('year'); changeState('sday'); changeState('smonth'); changeState('syear');
-"> {t}Activate vacation message{/t}
-{/render}
-
-   <br>
-
-    <table>
-         <tr>
-          <td>
-    {t}from{/t}
-          </td>
-          <td>
-{render acl=$gosaVacationMessageACL}
-    <select {if $own_script != ""} disabled {/if} name=day id="day" onChange="createResult(this.form,this.form.gosaVacationStart);" {$rangeEnabled}>
-        {html_options values=$days output=$days selected=$start_day}
-    </select>
-{/render}
-{render acl=$gosaVacationMessageACL}
-    <select  {if $own_script != ""} disabled {/if} name=month id="month" onChange="populate(this.form,this.form.gosaVacationStart);" {$rangeEnabled}>
-        {html_options options=$months selected=$start_month}
-    </select>
-{/render}
-{render acl=$gosaVacationMessageACL}
-    <select  {if $own_script != ""} disabled {/if} name=year id="year" onChange="populate(this.form,this.form.gosaVacationStart);" {$rangeEnabled}>
-        {html_options values=$years output=$years selected=$start_year}
-    </select>
-{/render}
-    <input type="hidden" name="gosaVacationStart" value="{$gosaVacationStart}">
-          </td>
-         </tr>
-         <tr>
-          <td>
-    {t}till{/t}
-          </td>
-          <td>
-{render acl=$gosaVacationMessageACL}
-    <select  {if $own_script != ""} disabled {/if} name=sday id="sday" onChange="createResult2(this.form,this.form.gosaVacationStop);" {$rangeEnabled}>
-        {html_options values=$days output=$days selected=$end_day}
-    </select>
-{/render}
-{render acl=$gosaVacationMessageACL}
-    <select  {if $own_script != ""} disabled {/if} name=smonth id="smonth" onChange="populate2(this.form,this.form.gosaVacationStop);" {$rangeEnabled}>
-        {html_options options=$months selected=$end_month}
-    </select>
-{/render}
-{render acl=$gosaVacationMessageACL}
-    <select {if $own_script != ""} disabled {/if}  name=syear id="syear" onChange="populate2(this.form,this.form.gosaVacationStop);" {$rangeEnabled}>
-        {html_options values=$years output=$years selected=$end_year}
-    </select>
-{/render}
-    <input type="hidden" name="gosaVacationStop" value="{$gosaVacationStop}">
-          </td>
-         </tr>
-        </table>
-
-
-   <td rowspan=2 style="border-left:1px solid #A0A0A0">
-   &nbsp;
-  </td>
-  <td style="vertical-align:top;">
-{render acl=$gosaMailDeliveryModeSACL}
-   <input {if $own_script != ""} disabled {/if} id='use_spam_filter' type=checkbox name="use_spam_filter" value="1" {$use_spam_filter} title="{t}Select if you want to filter this mails through spamassassin{/t}">
-{/render}
- <label for="gosaSpamSortLevel">{t}Move mails tagged with spam level greater than{/t}</label>
-       
-{render acl=$gosaSpamSortLevelACL}
-   <select {if $own_script != ""} disabled {/if} id="gosaSpamSortLevel" size="1" name="gosaSpamSortLevel" title="{t}Choose spam level - smaller values are more sensitive{/t}">
-        {html_options values=$spamlevel output=$spamlevel selected=$gosaSpamSortLevel}
-   </select>
-{/render}
-   <label for="gosaSpamMailbox">{t}to folder{/t}</label>
-{render acl=$gosaSpamMailboxACL}
-   <select {if $own_script != ""} disabled {/if} size="1" id="gosaSpamMailbox" name="gosaSpamMailbox">
-               {html_options values=$spambox output=$spambox selected=$gosaSpamMailbox}
-                       <option disabled>&nbsp;</option>
-   </select>
-{/render}
-   <br>
-{render acl=$gosaMailDeliveryModeRACL}
-   <input {if $own_script != ""} disabled {/if} id='use_mailsize_limit' type=checkbox name="use_mailsize_limit" value="1" {$use_mailsize_limit} >
-{/render}
-       <label for="gosaMailMaxSize">{t}Reject mails bigger than{/t}</label> 
-{render acl=$gosaMailMaxSizeACL}
-   <input {if $own_script != ""} disabled {/if} id="gosaMailMaxSize" name="gosaMailMaxSize" size="6" align="middle" maxlength="30" value="{$gosaMailMaxSize}"> {t}MB{/t}
-{/render}
-  </td>
- </tr>
- <tr>
-  <td style="vertical-align:top; width:45%">
-   <p style="margin-bottom:0px;">
-    <b><label for="gosaVacationMessage">{t}Vacation message{/t}</label></b>
-   </p>
-{render acl=$gosaVacationMessageACL}
-   <textarea {if $own_script != ""} disabled {/if} id="gosaVacationMessage" style="width:99%; height:100px;" name="gosaVacationMessage" rows="4" cols="512">{$gosaVacationMessage}</textarea>
-{/render}
-   <br>
-
-   {if $show_templates eq "true"}
-{render acl=$gosaVacationMessageACL}
-   <select id='vacation_template' name="vacation_template" {if $own_script != ""} disabled {/if}>
-               {html_options options=$vacationtemplates selected=$template}
-               <option disabled>&nbsp;</option>
-   </select>
-{/render}
-{render acl=$gosaVacationMessageACL}
-   <input {if $own_script != ""} disabled {/if} id='import_vacation' type="submit" value="{t}Import{/t}" name="import_vacation">
-{/render}
-   {/if}
-  </td>
-  <td>
-   <p style="margin-bottom:0px;">
-    <b><label for="forwarder_list">{t}Forward messages to{/t}</label></b>
-   </p>
-{render acl=$gosaMailForwardingAddressACL}
-   <select id="gosaMailForwardingAddress" style="width:100%; height:100px;" name="forwarder_list[]" size=15 multiple>
-                       {html_options values=$gosaMailForwardingAddress output=$gosaMailForwardingAddress selected=$template}        
-                       <option disabled>&nbsp;</option>
-   </select>
-{/render}
-   <br>
-{render acl=$gosaMailForwardingAddressACL}
-   <input id='forward_address' name="forward_address" size=20 align="middle" maxlength=65 value="">
-{/render}
-{render acl=$gosaMailForwardingAddressACL}
-   <input id='add_forwarder' type="submit" value="{t}Add{/t}" name="add_forwarder" >&nbsp;
-{/render}
-{render acl=$gosaMailForwardingAddressACL}
-   <input id='add_local_forwarder' type="submit" value="{t}Add local{/t}" name="add_local_forwarder" >&nbsp;
-{/render}
-{render acl=$gosaMailForwardingAddressACL}
-   <input id='delete_forwarder' type="submit" value="{t}Delete{/t}" name="delete_forwarder">
-{/render}
-  </td>
- </tr>
-</table>
-<p class="seperator">&nbsp;</p>
-
-<h2><img class="center" alt="" align="middle" src="images/false.png" />&nbsp;{t}Advanced mail options{/t}</h2>
-
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding="4" border="0">
- <tr>
-  <td>
-{render acl=$gosaMailDeliveryModeLACL}
-   <input {if $own_script != ""} disabled {/if} id='only_local' type=checkbox name="only_local" value="1" {$only_local} title="{t}Select if user can only send and receive inside his own domain{/t}">
-{/render}
-   {t}User is only allowed to send and receive local mails{/t}
-  </td>
- </tr>
-</table>
-
-<input type="hidden" name="mailTab" value="mailTab">
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-
-       {literal}
-       function changeStates()
-       {
-
-               if(document.getElementById('use_vacation').checked){
-                       changeState('day');
-                       changeState('month');
-                       changeState('year');
-                       changeState('sday');
-                       changeState('smonth');
-                       changeState('syear');
-               }else{
-                       changeSubselectState('use_vacation','day');
-                       changeSubselectState('use_vacation','month');
-                       changeSubselectState('use_vacation','year');
-                       changeSubselectState('use_vacation','sday');
-                       changeSubselectState('use_vacation','smonth');
-                       changeSubselectState('use_vacation','syear');
-               }
-       }
-
-       {/literal}
-
-<!-- // First input field on page
-       focus_field('mail');
-  -->
-</script>
diff --git a/plugins/personal/mail/mail_locals.tpl b/plugins/personal/mail/mail_locals.tpl
deleted file mode 100644 (file)
index d277ceb..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
-  <tr>
-    <td style="vertical-align:top;width:600px">
-      <div class="contentboxh" style="height:20px;">
-        <p class="contentboxh" style="font-size:12px">
-          <b>
-            <LABEL for="local_list">{t}Select addresses to add{/t}</LABEL> 
-            {$hint}
-          </b>
-          <br>
-        </p>
-      </div>
-      <div class="contentboxb">
-        <p class="contentboxb" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-          <select id="local_list" style="width:600px; margin-top:4px; height:450px;" name="local_list[]" size="15" multiple>
-                 {html_options options=$mailusers}
-          </select>
-        </p>
-      </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" style="background-color:#F8F8F8">
-        <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>
-              <LABEL for="depselect">{t}Select department{/t}</LABEL>
-              <img alt="" src="{$tree_image}" align=middle>&nbsp;
-              <select id="depselect" name="depselect" size=1 onChange="mainform.submit()" 
-                title="{t}Choose the department the search will be based on{/t}">
-                      {html_options options=$deplist selected=$depselect}
-                  </select>
-            </td>
-          </tr>
-        </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">
-            </td>
-            <td>
-              <input type='text' name='regex' maxlength='20' style="width:99%" value='{$regex}' 
-                title='{t}Regular expression for matching addresses{/t}' onChange="mainform.submit()">
-            </td>
-          </tr>
-        </table>
-
-        <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-          <tr>
-            <td style="width:18px;">
-              <img src="{$usearch_image}" align=middle alt="{t}Display addresses of user{/t}">
-            </td>
-            <td>
-              <input type='text' name='muser' maxlength='20' style="width:99%" value='{$muser}' 
-                title='{t}User name of which addresses are shown{/t}' onChange="mainform.submit()">
-            </td>
-          </tr>
-        </table>
-        {$apply}
-      </div>
-    </td>
-  </tr>
-</table>
-
-<p class="plugbottom">
-  <input type=submit name="add_locals_finish" value="{t}Add{/t}">
-  &nbsp;
-  <input type=submit name="add_locals_cancel" value="{t}Cancel{/t}">
-</p>
-<!-- 
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
--->
diff --git a/plugins/personal/mail/main.inc b/plugins/personal/mail/main.inc
deleted file mode 100644 (file)
index dda8cd7..0000000
+++ /dev/null
@@ -1,130 +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
- */
-
-$lock_msg ="";
-$display  =""; 
-if (!$remove_lock){
-  /* Reset requested? */
-  if (isset($_POST['edit_cancel']) || 
-      (isset($_GET['reset']) && $_GET['reset'] == 1)){
-    del_lock ($ui->dn);
-    sess_del ('edit');
-    sess_del ('mailAccount');
-  }
-
-  /* Create mail object on demand */
-  if (!isset($_SESSION['mailAccount']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
-    $_SESSION['mailAccount']= new mailAccount ($config, $ui->dn);
-    $_SESSION['mailAccount']->enable_CSN_check();
-    $_SESSION['mailAccount']->set_acl_base($ui->dn);
-    $_SESSION['mailAccount']->set_acl_category("users");
-  }
-  $mailAccount= $_SESSION['mailAccount'];
-
-  /* save changes back to object */
-  if (isset ($_SESSION['edit'])){
-    $mailAccount->save_object ();
-  }
-
-  /* Enter edit mode? */
-  if (isset($_POST['edit']) && preg_match("/w/",$ui->get_permissions($ui->dn,"users/mailAccount"))){
-
-    /* Check locking */
-    if (($username= get_lock($ui->dn)) != ""){
-      $_SESSION['back_plugin']= $plug;
-      $_SESSION['LOCK_VARS_TO_USE'] = array("/^edit$/","/^plug$/");
-      $lock_msg =  gen_locked_message ($username, $ui->dn);
-
-    }else{
-
-      /* Lock the current entry */
-      add_lock ($ui->dn, $ui->dn);
-      $_SESSION['dn']= $ui->dn;
-      $_SESSION['edit']= TRUE;
-    }
-  }
-
-  /* save changes to LDAP and disable edit mode */
-  if (isset($_POST['edit_finish'])){
-
-    /* Perform checks */
-    $message= $mailAccount->check ();
-
-    /* No errors, save object */
-    if (count ($message) == 0){
-      $mailAccount->save ();
-      del_lock ($ui->dn);
-      sess_del ('edit');
-
-      /* Remove object */
-      sess_del ('mailAccount');
-    } else {
-      /* Errors found, show message */
-      show_errors ($message);
-    }
-  }
-
-  /* Execute formular */
-  if($lock_msg){
-    $display.= $lock_msg;
-  }else{
-    $display.= $mailAccount->execute ();
-  }
-
-  /* Store changes  in session */
-  if (isset ($_SESSION['edit'])){
-    $_SESSION['mailAccount']= $mailAccount;
-  }
-
-  $info= "";
-  /* Show page footer depending on the mode */
-  if (!$mailAccount->forward_dialog && $mailAccount->is_account && empty($lock_msg)){
-    $display.= "<p class=\"plugbottom\">";
-
-    /* Are we in edit mode? */
-    if (isset($_SESSION['edit'])){
-      $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
-      $display.= "&nbsp;";
-      $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
-      $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png').
-             "\"> ".$ui->dn."&nbsp;";
-    } else {
-      $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/openlock.png').
-             "\"> ".$ui->dn."&nbsp;";
-      
-        $info.= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/lamp.png').
-            "\"> "._("Click the 'Edit' button below to change informations in this dialog");
-
-        if(preg_match("/w/",$ui->get_permissions($ui->dn,"users/mailAccount"))){
-          $display.= "<input type=submit name=\"edit\" value=\""._("Edit")."\">\n";
-        }
-
-      $display.= "<input type=\"hidden\" name=\"ignore\">\n";
-    }
-    $display.= "</p>\n";
-  }
-
-  /* Page header*/
-  $display= print_header(get_template_path('images/email.png'), _("User mail settings"), $info).$display;
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/personal/mail/sieve-discard.txt b/plugins/personal/mail/sieve-discard.txt
deleted file mode 100644 (file)
index 8ac4db6..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-# Do not deliver to own mailbox
-discard;
-
diff --git a/plugins/personal/mail/sieve-header.txt b/plugins/personal/mail/sieve-header.txt
deleted file mode 100644 (file)
index 5222282..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-###GOSA
-require ["fileinto", "reject", "vacation"];
-
diff --git a/plugins/personal/mail/sieve-mailsize.txt b/plugins/personal/mail/sieve-mailsize.txt
deleted file mode 100644 (file)
index de639c2..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#  Reject mails with bigger size
-if size :over {$maxsize}M{
-        reject text:
-Dear sender,
-
-the mail you sent to our mailsystem has been rejected due
-to a user configured maximum mail size ($maxsize MB).
-
-Either ask the user to remove the sizelimit, or send smaller pieces.
-
-Thank you,
- the mailserver
-.
-        ;
-        discard;
-}
-
diff --git a/plugins/personal/mail/sieve-spam.txt b/plugins/personal/mail/sieve-spam.txt
deleted file mode 100644 (file)
index 63392d0..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-# Sort mails with higher spam level
-if header :contains "X-Spam-Level" "$spamlevel" {
-  fileinto "$spambox";
-}
-
diff --git a/plugins/personal/mail/sieve-vacation.txt b/plugins/personal/mail/sieve-vacation.txt
deleted file mode 100644 (file)
index 3aed3a9..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-# Vacation message
-vacation :addresses [$addrlist]
-"$vacmsg" ;
-
diff --git a/plugins/personal/nagios/class_nagiosAccount.inc b/plugins/personal/nagios/class_nagiosAccount.inc
deleted file mode 100644 (file)
index 41b2de3..0000000
+++ /dev/null
@@ -1,313 +0,0 @@
-<?php
-
-/*! \brief   mail plugin
-  \author  Guillame Delecourt <guillaume@opensides.be>
-  \author  Benoit Mortier <benoit.mortier@opensides.be>
-  \author  Vincent Seynhaeve <vincent@opensides.be>  
-  \version 1.00
-  \date    25.09.2005
-
-  This class provides the functionality to read and write all attributes
-  relevant for nagiosAccount from/to the LDAP. It does syntax checking
-  and displays the formulars required.
- */
-
-class nagiosAccount extends plugin
-{
-  /* Definitions */
-  var $plHeadline= "Nagios";
-  var $plDescription= "This does something";
-
-  /* CLI vars */
-  var $cli_summary= "Manage users nagios account";
-  var $cli_description= "Manage Account and autorization\nfor Nagios";
-  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* plugin specific values */
-  var $NagiosAlias  = "";
-  var $NagiosPager  = "";
-  var $NagiosMail   = "";
-
-  var $HostNotificationOptions      = "";
-  var $HostNotificationPeriod       = "";
-  var $ServiceNotificationPeriod    = "";
-  var $ServiceNotitificationPeriod  = "";
-  var $HostNotificationCommands     = "";
-  var $ServiceNotificationCommands  = "";
-  var $HostNotitificationOptions    = "";
-  var $ServiceNotificationOptions   = "";
-
-  var $AuthorizedAllHosts                 = "unchecked";
-  var $AuthorizedAllServices              = "unchecked";
-  var $AuthorizedSystemCommands           = "unchecked";
-  var $AuthorizedAllHostCommands          = "unchecked";
-  var $AuthorizedAllServiceCommands       = "unchecked";
-  var $AuthorizedConfigurationInformation = "unchecked";
-  var $AuthorizedSystemInformation        = "unchecked";
-
-  /* attribute list for save action */
-
-  var $attributes= array("NagiosAlias", "NagiosPager", "NagiosMail", "HostNotificationPeriod",
-      "ServiceNotificationPeriod", "HostNotificationCommands", "ServiceNotificationCommands",
-      "HostNotificationOptions", "ServiceNotificationOptions", "AuthorizedAllHosts", "AuthorizedAllServices",
-      "AuthorizedSystemCommands", "AuthorizedAllHostCommands", "AuthorizedAllServiceCommands",
-      "AuthorizedConfigurationInformation", "AuthorizedSystemInformation");
-
-  var $is_chk_box = array("AuthorizedAllHosts","AuthorizedAllServices","AuthorizedSystemCommands",
-      "AuthorizedAllHostCommands","AuthorizedAllServiceCommands",
-      "AuthorizedConfigurationInformation","AuthorizedSystemInformation");
-
-  var $objectclasses= array("nagiosContact","nagiosAuth");
-
-  var $uid = "";
-  var $view_logged = FALSE;
-
-  /* constructor, if 'dn' is set, the node loads the given
-     'dn' from LDAP */
-  function nagiosAccount (&$config, $dn= NULL)
-  {
-    /* Configuration is fine, allways */
-    $this->config= $config;
-
-    plugin::plugin ($config, $dn);
-
-    /* Setting uid to default */
-    if(isset($this->attrs['uid'][0])){
-      $this->uid = $this->attrs['uid'][0];
-    }
-
-    /* Save initial account state */  
-    $this->initially_was_account= $this->is_account;
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* Log view */
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","users/".get_class($this),$this->dn);
-    }
-
-    /* Load templating engine */
-    $smarty= get_smarty();
-    $display= "";
-
-    /* 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;
-      }
-    }    
-
-    /* Do we represent a valid account? */
-    if (!$this->is_account && $this->parent === NULL){
-      $display= "<img alt=\"\"src=\"images/stop.png\" align=\"middle\">&nbsp;<b>".
-        _("This account has no nagios extensions.")."</b>";
-
-      $display.= back_to_main();
-      return ($display);
-    }
-
-    /* Show tab dialog headers */
-    if ($this->parent !== NULL){
-      if ($this->is_account){
-        $display= $this->show_disable_header(_("Remove nagios account"),
-            _("This account has nagios features enabled. You can disable them by clicking below."));
-      } else {
-        $display= $this->show_enable_header(_("Create nagios account"), _("This account has nagios features disabled. You can enable them by clicking below."));
-        return($display);
-      }
-    }
-
-    /* Assign acls */
-    $tmp = $this->plInfo();
-    $SkipWrite = (!isset($this->parent) || !$this->parent) && !isset($_SESSION['edit']);
-    foreach($tmp['plProvidedAcls'] as $acl => $desc){
-      $smarty->assign($acl."ACL",$this->getacl($acl,$SkipWrite));
-    }
-
-    /* Assign attributes an ACL to smarty */
-    foreach($this->attributes as $val) { 
-      $smarty->assign("$val", $this->$val);
-      if(in_array($val,$this->is_chk_box)){
-        if($this->$val == "checked"){
-          $smarty->assign($val."CHK", " checked ");
-        }else{
-          $smarty->assign($val."CHK", "");
-        }
-      }
-    }
-    $smarty->assign('ServiceNotificationOptionsValues'  ,array("d,u,r,v"=>"d,u,r,v" ,"d,u,r"=>"d,u,r" ,"d,u"=>"d,u"));
-    $smarty->assign('HostNotificationOptionsValues'     ,array("w,u,c,r"=>"w,u,c,r" ,"w,u,c"=>"w,u,c" ,"c,w"=>"c,w"));
-    $smarty->assign('ServiceNotificationPeriodValues'   ,array("24x7"=>"24x7" ,"24x5"=>"24x5" ,"8x5"=>"8x5"));
-    $smarty->assign('HostNotificationPeriodValues'      ,array("24x7"=>"24x7" ,"24x5"=>"24x5" ,"8x5"=>"8x5"));
-    $display.= $smarty->fetch (get_template_path('nagios.tpl', TRUE, dirname(__FILE__)));
-    return ($display);
-  }
-
-  /* Save to LDAP */
-  function save()
-  {
-    $ldap= $this->config->get_ldap_link();
-
-    /* Call parents save to prepare $this->attrs */
-    plugin::save();
-
-    /* Adapt attributes if needed */
-    //$method= new $this->method($this->config);
-    //$id= $method->uattrib;
-    //$method->fixAttributesOnStore($this);
-
-    /* Write back to ldap */
-    $ldap->cd($this->dn);
-    $this->cleanup();
-    $ldap->modify ($this->attrs); 
-
-    /* Log last action */
-    if($this->initially_was_account){
-      new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }else{
-      new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }
-
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/nagios account 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",array("uid" => $this->uid));
-      }
-    } else {
-      $this->handle_post_events("add", array("uid" => $this->uid));
-    }
-  }
-
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    $ldap= $this->config->get_ldap_link();
-    /* must: mail */
-    if ($this->NagiosAlias == ""){
-      $message[]= _("The required field 'NagiosAlias' is not set.");
-    }
-    if ($this->NagiosMail == ""){
-      $message[]= _("The required field 'NagiosMail' is not set.");
-    }
-    if ($this->is_template){
-      if (!is_email($this->NagiosMail, TRUE)){
-        $message[]= _("Please enter a valid email address in 'NagiosMail' field.");
-      }
-    } else {
-      if (!is_email($this->NagiosMail)){
-        $message[]= _("Please enter a valid email address in 'NagiosMail' field.");
-      }
-    }
-    return($message);
-  }
-
-
-  /* Use Save_object for every Post handling */
-  function save_object()
-  {
-    if (isset($_POST['nagiosTab'])){
-      /* Save ldap attributes */
-      plugin::save_object();
-
-      /* Specialhandling for checkboxes */
-      foreach($this->is_chk_box as $val){
-        if($this->acl_is_writeable($val)){
-          if(isset($_POST[$val])){
-            $this->$val = "checked";
-          }else{
-            $this->$val = "unchecked";
-          }
-        }
-      }
-    }
-  }
-
-  function remove_from_parent()
-  {
-    /* Cancel if there's nothing to do here */
-    if (!$this->initially_was_account){
-      return;
-    }
-
-    /* include global link_info */
-    $ldap= $this->config->get_ldap_link();
-
-    /* Remove and write to LDAP */
-    plugin::remove_from_parent();
-
-    /* Adapt attributes if needed */
-    //     $method= new $this->method($this->config);
-    //     $method->fixAttributesOnRemove($this);
-
-    @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
-        $this->attributes, "Save");
-    $ldap->cd($this->dn);
-    $this->cleanup();
-    $ldap->modify ($this->attrs); 
-
-    new log("view","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-
-    show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/nagios account with dn '%s' failed."),$this->dn));
-
-    /* remove the entry from LDAP */
-    unset ($this->attrs['uid']);
-
-    /* Optionally execute a command after we're done */
-    $this->handle_post_events('remove',array("uid" => $this->uid));
-  }
-
-
-
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"     => _("Nagios"),
-          "plDescription"   => _("Nagios account settings"),
-          "plSelfModify"    => TRUE,
-          "plDepends"       => array("user"),
-          "plPriority"      => 8,                                 // Position in tabs
-          "plSection"     => array("personal" => _("My account")),
-          "plCategory"    => array("users"),
-          "plOptions"       => array(),
-
-          "plProvidedAcls"  => array(
-
-            "NagiosAlias"                       =>  _("Alias"),
-            "NagiosPager"                       =>  _("Pager number"),
-            "NagiosMail"                        =>  _("Mail address"),
-
-            "HostNotificationCommands"          =>  _("Host notification commands"),
-            "HostNotificationOptions"           =>  _("Host notification options"),
-            "HostNotificationPeriod"            =>  _("Host notification period"),
-
-            "ServiceNotificationCommands"       =>  _("Service notification commands"),
-            "ServiceNotificationOptions"        =>  _("Service notification options"),
-            "ServiceNotificationPeriod"         =>  _("Service notification period"),
-
-            "AuthorizedAllHosts"                =>  _("View all hosts"),
-            "AuthorizedAllServices"             =>  _("View all services"),
-
-            "AuthorizedSystemCommands"          =>  _("Trigger system commands"),
-            "AuthorizedAllHostCommands"         =>  _("Trigger all host commands"),
-            "AuthorizedAllServiceCommands"      =>  _("Trigger all service commands"),
-
-            "AuthorizedConfigurationInformation"=>  _("View configuration information"),
-            "AuthorizedSystemInformation"       =>  _("View system informations"))
-      ));
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-
-?>
diff --git a/plugins/personal/nagios/main.inc b/plugins/personal/nagios/main.inc
deleted file mode 100644 (file)
index c6a61b3..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-<?php
-/*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2005  Benoit Mortier
-
-   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
- */
-
-$display    = "";
-$lock_msg   = "";
-
-if (!$remove_lock){
-  /* Reset requested? */
-  if (isset($_POST['edit_cancel']) || 
-      (isset($_GET['reset']) && $_GET['reset'] == 1)){
-    del_lock ($ui->dn);
-    sess_del ('edit');
-    sess_del ('nagiosAccount');
-  }
-
-  /* Create mail object on demand */
-  if (!isset($_SESSION['nagiosAccount']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
-    $_SESSION['nagiosAccount']= new nagiosAccount ($config, $ui->dn);
-    $_SESSION['nagiosAccount']->enable_CSN_check();
-    $_SESSION['nagiosAccount']->set_acl_base($ui->dn);
-    $_SESSION['nagiosAccount']->set_acl_category("users");
-  }
-  $nagiosAccount= $_SESSION['nagiosAccount'];
-
-  /* save changes back to object */
-  if (isset ($_SESSION['edit'])){
-    $nagiosAccount->save_object ();
-  }
-
-  /* Enter edit mode? */
-  if (isset($_POST['edit'])){
-
-    /* Check locking */
-    if (($username= get_lock($ui->dn)) != ""){
-      $_SESSION['back_plugin']= $plug;
-      $_SESSION['LOCK_VARS_TO_USE'] = array("/^edit$/","/^plug$/");
-      $lock_msg =  gen_locked_message ($username, $ui->dn);
-
-    }else{
-
-      /* Lock the current entry */
-      add_lock ($ui->dn, $ui->dn);
-      $_SESSION['dn']= $ui->dn;
-      $_SESSION['edit']= TRUE;
-    }
-  }
-
-  /* save changes to LDAP and disable edit mode */
-  if (isset($_POST['edit_finish'])){
-
-    /* Perform checks */
-    $message= $nagiosAccount->check ();
-
-    /* No errors, save object */
-    if (count ($message) == 0){
-      $nagiosAccount->save ();
-      del_lock ($ui->dn);
-      sess_del ('edit');
-
-      /* Remove object */
-      sess_del ('nagiosAccount');
-    } else {
-      /* Errors found, show message */
-      show_errors ($message);
-    }
-  }
-
-  /* Execute formular */
-  if($lock_msg){
-    $display.= $lock_msg;
-  }else{
-    $display.= $nagiosAccount->execute ();
-  }
-
-  /* Store changes  in session */
-  if (isset ($_SESSION['edit'])){
-    $_SESSION['nagiosAccount']= $nagiosAccount;
-  }
-
-  $info= "";
-  /* Show page footer depending on the mode */
-  if ($nagiosAccount->is_account && empty($lock_msg)){
-    $display.= "<p class=\"plugbottom\">";
-
-    /* Are we in edit mode? */
-    if (isset($_SESSION['edit'])){
-      $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
-      $display.= "&nbsp;";
-      $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
-      $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png').
-             "\"> ".$ui->dn."&nbsp;";
-    } else {
-      $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/openlock.png').
-             "\"> ".$ui->dn."&nbsp;";
-
-      if(preg_match("/w/",$ui->get_permissions($ui->dn,"users/nagiosAccount"))){
-        $info.= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/lamp.png').
-          "\"> "._("Click the 'Edit' button below to change informations in this dialog");
-        $display.= "<input type=submit name=\"edit\" value=\""._("Edit")."\">\n";
-      }
-      $display.= "<input type=\"hidden\" name=\"ignore\">\n";
-    }
-    $display.= "</p>\n";
-  }
-
-  /* Page header*/
-  $display= print_header(get_template_path('images/monitoring.png'), _("Nagios settings"), $info).$display;
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/personal/nagios/nagios.tpl b/plugins/personal/nagios/nagios.tpl
deleted file mode 100644 (file)
index e77529a..0000000
+++ /dev/null
@@ -1,192 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding="0" border="0">
- <tr>
-  <td style="width:50%; vertical-align:top;">
-   <h2>
-    <img class="center" alt="" align="middle" src="images/rightarrow.png" />&nbsp;{t}Nagios Account{/t}</h2>
-   <table summary="">
-    <tr>
-     <td><label for="NagiosAlias">{t}Alias{/t}</label>{$must}</td>
-     <td>
-{render acl=$NagiosAliasACL}
-      <input id="NagiosAlias" name="NagiosAlias" size=25 maxlength=65 value="{$NagiosAlias}">
-{/render}
-     </td>
-    </tr>
-
-    <tr>
-     <td><label for="NagiosMail">{t}Mail address{/t}</label>{$must}</td>
-     <td>
-{render acl=$NagiosMailACL}
-      <input id="NagiosMail" name="NagiosMail" size=25 maxlength=65 value="{$NagiosMail}">
-{/render}
-     </td>
-    </tr>
-
-    <tr>
-     <td>
-      <label for="HostNotificationPeriod">{t}Host notification period{/t}</label>{$must}
-     </td>
-     <td>
-{render acl=$HostNotificationPeriodACL}
-      <select name="HostNotificationPeriod" id="HostNotificationPeriod">
-       {html_options options=$HostNotificationPeriodValues values=$HostNotificationPeriodValues selected=$HostNotificationPeriod }
-      </select>
-{/render}
-     </td>
-    </tr>
-
-    <tr>
-     <td>
-      <label for="ServiceNotificationPeriod">{t}Service notification period{/t}</label>{$must}
-     </td>
-     <td>
-{render acl=$ServiceNotificationPeriodACL}
-      <select name="ServiceNotificationPeriod" id="ServiceNotificationPeriod">
-       {html_options options=$ServiceNotificationPeriodValues values=$ServiceNotificationPeriodValues selected=$ServiceNotificationPeriod}
-      </select>
-{/render}
-     </td>
-    </tr>
-
-    <tr>
-     <td>
-      <label for="ServiceNotificationOptions">{t}Service notification options{/t}</label>{$must}
-     </td>
-     <td>
-{render acl=$ServiceNotificationOptionsACL}
-      <select name="ServiceNotificationOptions" id="ServiceNotificationOptions">
-       {html_options options=$ServiceNotificationOptionsValues values=$ServiceNotificationOptionsValues selected=$ServiceNotificationOptions}
-      </select>
-{/render}
-     </td>
-    </tr>
-
-    <tr>
-     <td>
-      <label for="HostNotificationOptions">{t}Host notification options{/t}</label>{$must}
-     </td>
-     <td>
-{render acl=$HostNotificationOptionsACL}
-      <select name="HostNotificationOptions" id="HostNotificationOptions">
-       {html_options options=$HostNotificationOptionsValues values=$HostNotificationOptionsValues selected=$HostNotificationOptions }
-      </select>
-{/render}
-     </td>
-    </tr>
-
-    <tr>
-     <td>
-      <label for="NagiosPager">{t}Pager{/t}</label>
-     </td>
-     <td>
-{render acl=$NagiosPagerACL}
-      <input id="NagiosPager" name="NagiosPager" size=25 maxlength=65 value="{$NagiosPager}">
-{/render}
-     </td>
-    </tr>
-
-    <tr>
-     <td>
-      <label for="ServiceNotificationCommands">{t}Service notification commands{/t}</label>
-     </td>
-     <td>
-{render acl=$ServiceNotificationCommandsACL}
-      <input id="ServiceNotificationCommands" disabled name="ServiceNotificationCommands" size=25 maxlength=65  value="{$ServiceNotificationCommands}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td>
-      <label for="HostNotificationCommands">{t}Host notification commands{/t}</label>
-     </td>
-     <td>
-{render acl=$HostNotificationCommandsACL}
-      <input id="HostNotificationCommands" disabled name="HostNotificationCommands" size=25 maxlength=65  value="{$HostNotificationCommands}">
-{/render}
-     </td>
-    </tr>
-   </table>
-  </td>
-  <td style="border-left:1px solid #A0A0A0">
-   &nbsp;
-  </td>
-  <td style="width:100%; vertical-align:top;">
-   <h2> 
-    <img class="center" alt="" align="middle" src="images/rightarrow.png" />&nbsp;{t}Nagios authentification{/t}
-   </h2>
-   <table summary="">
-    <tr>
-     <td>
-{render acl=$AuthorizedSystemInformationACL}
-      <input type="checkbox" name="AuthorizedSystemInformation" value="1" {$AuthorizedSystemInformationCHK}>{t}view system informations{/t}
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td>
-{render acl=$AuthorizedConfigurationInformationACL}
-      <input type="checkbox" name="AuthorizedConfigurationInformation" value="1" 
-       {$AuthorizedConfigurationInformationCHK}>{t}view configuration information{/t}
-{/render}
-     </td>
-    </tr>
-       
-    <tr>
-     <td>
-{render acl=$AuthorizedSystemCommandsACL}
-      <input type="checkbox" name="AuthorizedSystemCommands" value="1" 
-       {$AuthorizedSystemCommandsCHK}>{t}trigger system commands{/t}
-{/render}
-     </td>
-    </tr>
-       
-    <tr>
-     <td>
-{render acl=$AuthorizedAllServicesACL}
-      <input type="checkbox" name="AuthorizedAllServices" value="1" 
-       {$AuthorizedAllServicesCHK}>{t}view all services{/t}
-{/render}
-     </td>
-    </tr>
-       
-    <tr>
-     <td>
-{render acl=$AuthorizedAllHostsACL}
-      <input type="checkbox" name="AuthorizedAllHosts" value="1" 
-       {$AuthorizedAllHostsCHK}>{t}view all hosts{/t}
-{/render}
-     </td> 
-    </tr>
-       
-    <tr>
-     <td>
-{render acl=$AuthorizedAllServiceCommandsACL}
-      <input type="checkbox" name="AuthorizedAllServiceCommands" value="1" 
-       {$AuthorizedAllServiceCommandsCHK}>{t}trigger all service commands{/t}
-{/render}
-     </td>
-    </tr>
-       
-    <tr>
-     <td>
-{render acl=$AuthorizedAllHostCommandsACL}
-      <input type="checkbox" name="AuthorizedAllHostCommands" value="1" 
-       {$AuthorizedAllHostCommandsCHK}>{t}trigger all host commands{/t}
-{/render}
-     </td>
-    </tr>
-   </table>
-  </td>
- </tr>
-</table>
-
-<input type="hidden" name="nagiosTab" value="nagiosTab">
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('NagiosAlias');
-  -->
-</script>
-
diff --git a/plugins/personal/netatalk/class_netatalk.inc b/plugins/personal/netatalk/class_netatalk.inc
deleted file mode 100644 (file)
index 3693fda..0000000
+++ /dev/null
@@ -1,387 +0,0 @@
-<?php
-/*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2006  Gina Haeussge <osd@foosel.net>
-   Copyright (C) 2006  Bernd Zeimetz <bernd@zeimetz.de>
-
-   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
- */
-
-/*! \brief   netatalk plugin
-  \author  Gina Haeussge <osd@foosel.net>
-  \author  Bernd Zeimetz <bernd@zeimetz.de>
-  \version 0.1
-  \date    21.3.2006
-
-  This class provides the functionality to read and write all attributes
-  relevant for netatalk from/to the LDAP. It does syntax checking
-  and displays the formulars required.
- */
-
-class netatalk extends plugin {
-
-  /* Definitions */
-  var $plHeadline = "Netatalk";
-  var $plDescription = "Manage netatalk account";
-
-  /* CLI vars */
-  var $cli_summary = "Manage netatalk account";
-  var $cli_description = "Manage Account \nfor netatalk";
-  var $cli_parameters = array ("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-  var $view_logged = FALSE;
-
-  /* Plugin specific values */
-  var $apple_user_homepath_raw   = "";
-  var $apple_user_homeurl_raw     = "";
-  var $apple_user_homeurl_xml     = "";
-  var $apple_user_homeurl       = "";
-  var $apple_user_homeDirectory   = "";
-  var $apple_user_share       = "";
-  var $shares             = array();
-  var $shares_settings        = array();
-  var $selectedshare        = "";
-  var $mountDirectory         = "/Network/Servers";
-
-  /* Attributes to save to LDAP */
-  var $attributes = array ("apple-user-homeurl", "apple-user-homeDirectory");
-  var $CopyPasteVars= array("apple_user_homeurl", "apple_user_homeDirectory","apple_user_share","shares_settings","apple_user_homepath_raw",
-      "apple_user_homeurl_raw","apple_user_homeurl_xml","apple_user_homeurl","selectedshare","mountDirectory");
-
-  /* Attributes to use in smarty template */
-  var $smarty_attributes = array ("apple_user_homepath_raw", "shares", "selectedshare");
-
-  /* Attributes to save from $_POST */
-  var $post_attributes = array ("apple_user_share", "apple_user_homepath_raw");
-
-  /* Objectclasses */
-  var $objectclasses = array ("apple-user");
-
-  /* Checkboxes */
-  var $is_chk_box = array ();
-
-  var $uid ="";  
-
-  /* The constructor just saves a copy of the config. You may add what ever you need. */
-  function netatalk(&$config, $dn = NULL) {
-
-    /* Include config object */
-    $this->config = $config;
-    plugin::plugin($config, $dn);
-
-    /* set user id */    
-    if(isset($this->attrs['uid'])){
-      $this->uid = $this->attrs['uid'][0];
-    }
-
-    /* Copy needed attributes */
-    foreach($this->attributes as $val) {
-      if (isset($this->attrs["$val"][0])) {
-        $name = str_replace('-', '_', $val);
-        $this->$name = $this->attrs["$val"][0];
-      }
-    }
-
-    if (strlen($this->apple_user_homeDirectory) >0) {
-      $this->apple_user_homepath_raw = substr($this->apple_user_homeDirectory, strrpos($this->apple_user_homeDirectory, '/') + 1 );
-    }
-
-    /* get share list an set default values */
-    $this->get_netatalk_shares(); 
-    $this->apple_user_share = $this->selectedshare;
-
-    /* Save initial account state */
-    $this->initially_was_account = $this->is_account;
-  }
-
-
-
-  /* Get netatalk shares */
-  function get_netatalk_shares()
-  {
-    /* Get netatalk shares */
-    $this->shares = array();
-    $ldap = $this->config->get_ldap_link();
-
-    if($this->dn === "new" || $this->dn === NULL) {
-      $base = $_SESSION['CurrentMainBase'];
-    } else {
-      $base = preg_replace("/^[^,]+,".normalizePreg(get_people_ou())."/","",$this->dn);
-    }
-
-    $ldap->cd($base);
-    $ldap->search ("(&(objectClass=mount)(|(mountType=url)(mountType=nfs))(cn=*))");
-
-    while ($attrs = $ldap->fetch()){
-      $tmp  = split(":", $attrs["cn"][0]);
-      $host = trim($tmp[0]);
-      $dir  = trim($tmp[1]);
-      $mountType = trim($attrs["mountType"][0]);
-      if ($mountType == "url") {
-        $mountTypeReal = "netatalk";
-      } else {
-        $mountTypeReal = $mountType;
-      } 
-      $share = $attrs["cn"][0]. " (" . $mountTypeReal . ")";
-      $this->shares[$share] = $share;
-      $this->shares_settings[$share]["mountType"]=$mountType;
-      $this->shares_settings[$share]["dir"]=$dir;
-      $this->shares_settings[$share]["host"]=$host;
-
-      $oldShare=substr($this->apple_user_homeDirectory, 0, strrpos($this->apple_user_homeDirectory, '/'));
-      $newShare=($this->mountDirectory . "/". $host . $dir );
-      if (strcmp($oldShare, $newShare)==0) {
-        $this->selectedshare = $share;
-      }
-    }
-    asort($this->shares);
-  }
-
-
-  /* Execute the plugin, produce the output. */
-  function execute() 
-  {
-    plugin :: execute();
-
-    /* Log view */
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","users/".get_class($this),$this->dn);
-    }
-
-    /* Use the smarty templating engine here... */
-    $smarty = get_smarty();
-    $display = "";
-
-    /* Do we need to flip is_account state? */
-    if (isset ($_POST['modify_state'])) {
-      $this->is_account = !$this->is_account;
-    }
-
-    /* Do we represent a valid account? */
-    if (!$this->is_account && $this->parent === NULL) {
-      $display = "<img alt=\"\"src=\"images/stop.png\" align=\"middle\">&nbsp;<b>"._("This account has no netatalk extensions.")."</b>";
-
-      $display .= back_to_main();
-      return ($display);
-    }
-
-    /* Show tab dialog headers */
-    if ($this->parent !== NULL) {
-      if ($this->is_account) {
-        $display = $this->show_disable_header(_("Remove netatalk account"), _("This account has netatalk features enabled. You can disable them by clicking below."));
-      } else {
-        $errmsg="";
-        $obj = $this->parent->by_object['posixAccount'];
-        if  (!($obj->is_account) ) {
-          $errmsg.="Posix features are needed for netatalk accounts, enable them first. ";
-        }
-        if (count($this->shares)== 0) {
-          $errmsg.="At least one share with netatalk or NFS mount entry needed.";
-        }
-        if($errmsg==""){
-          $display = $this->show_enable_header(_("Create netatalk account"), _("This account has netatalk features disabled. You can enable them by clicking below."));
-        } else {
-          $display = $this->show_enable_header(_("Create netatalk account"), _($errmsg), TRUE);
-        }
-        return ($display);
-      }
-    }
-
-    /* Assign attributes and ACL to smarty */
-    $SkipWrite = (!isset($this->parent) || !$this->parent) && !isset($_SESSION['edit']);
-    $smarty->assign("netatalkShareACL", $this->getacl("netatalkShare",$SkipWrite));
-    $smarty->assign("netatalkUserHomepathACL", $this->getacl("netatalkUserHomepath",$SkipWrite));
-
-    foreach ($this->smarty_attributes as $val) {
-      $smarty->assign("$val", $this-> $val);
-      if (in_array($val, $this->is_chk_box)) {
-        if ($this-> $val == "checked") {
-          $smarty->assign($val."CHK", " checked ");
-        } else {
-          $smarty->assign($val."CHK", "");
-        }
-      }
-    }
-
-    /* Let smarty fetch and process the page. */
-    $display .= ($smarty->fetch(get_template_path('netatalk.tpl', TRUE, dirname(__FILE__))));
-    return ($display);
-  }
-
-
-  /* Check if we have correct data */
-  function check() {
-    $message = array ();
-
-    if (strlen($this->apple_user_share) == 0) {
-      $message[] = _("You must select a share to use.");
-    }
-
-    return ($message);
-  }
-
-  /* Save to LDAP */
-  function save() {
-    /* remove a / at the end of the homepath, we neither need it there nor
-     * do we want to check for it later.
-     */
-    if(substr($this->apple_user_homepath_raw, -1, 1) === '/') {
-      $this->apple_user_homepath_raw=substr($this->apple_user_homepath_raw, 0, -1);
-    }
-
-    $mountType=$this->shares_settings[$this->apple_user_share]["mountType"];
-    $dir=$this->shares_settings[$this->apple_user_share]["dir"];
-    $host=$this->shares_settings[$this->apple_user_share]["host"];
-
-    /* Convert raw data to wished format */
-    if ($this->is_account) {
-      if($mountType=="url") {
-        $this->apple_user_homeurl_xml = '<home_dir><url>afp://'.$host.$dir . '</url><path>'.$this->apple_user_homepath_raw.'</path></home_dir>';
-        $this->apple_user_homeurl = base64_encode($this->apple_user_homeurl_xml);
-      } else {
-        $this->apple_user_homeurl = "";
-      }
-      $this->apple_user_homeDirectory = $this->mountDirectory . '/' . $host .$dir . '/' . $this->apple_user_homepath_raw;
-    } else {
-      $this->apple_user_homeurl = "";
-      $this->apple_user_homeDirectory = "";
-    }
-
-    $ldap = $this->config->get_ldap_link();
-
-    /* Reset array of used attributes, because plugin::save() 
-       will not work with '-' in attributes names 
-       after calling save restore attributes array */
-    $attributes = $this->attributes;
-    $this->attributes = array();
-    plugin :: save();
-    $this->attributes = $attributes;
-
-    /* Do attribute conversion */
-    foreach ($this->attributes as $val) {
-      $name = str_replace('-', '_', $val);
-      if ($this->$name != "") {
-        $this->attrs[$val] = $this->$name;
-      } else {
-        $this->attrs[$val] = array();
-      }
-      unset ($this->attrs[$name]);
-    }
-
-    /* Write back to ldap */
-    $ldap->cd($this->dn);
-    $this->cleanup();
-    $ldap->modify($this->attrs);
-
-    if($this->initially_was_account){
-      new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }else{
-      new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }
-
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/netatalk account 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",array("uid" => $this->uid));
-      }
-    } else {
-      $this->handle_post_events("add",array("uid" => $this->uid));
-    }
-  }
-
-  /* Use Save_object for every Post handling */
-  function save_object() {
-    if (isset ($_POST['netatalkTab'])) {
-      /* Save ldap attributes */
-      plugin :: save_object();
-
-      foreach($this->post_attributes as $val) {
-        if (isset ($_POST[$val])) {
-          $this->$val = $_POST[$val];
-        } else {
-          $this->$val = "";
-        }
-      }
-
-      /* Specialhandling for checkboxes */
-      foreach ($this->is_chk_box as $val) {
-        if (isset ($_POST[$val])) {
-          $this-> $val = "checked";
-        } else {
-          $this-> $val = "unchecked";
-        }
-      }
-
-      $this->apple_user_homeurl_raw = 'afp://' . $this->apple_user_share;
-    }
-  }
-
-  function remove_from_parent() {
-    /* Cancel if there's nothing to do here */
-    if (!$this->initially_was_account) {
-      return;
-    }
-
-    /* include global link_info */
-    $ldap = $this->config->get_ldap_link();
-
-    /* Remove and write to LDAP */
-    plugin :: remove_from_parent();
-
-    /* Adapt attributes if needed */
-    //     $method= new $this->method($this->config);
-    //     $method->fixAttributesOnRemove($this);
-
-    @ DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->attributes, "Save");
-    $ldap->cd($this->dn);
-    $this->cleanup();
-    $ldap->modify($this->attrs);
-
-    new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-
-    show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/netatalk account with dn '%s' failed."),$this->dn));
-
-    /* remove the entry from LDAP */
-    unset ($this->attrs['uid']);
-
-    /* Optionally execute a command after we're done */
-    $this->handle_post_events('remove', array("uid" => $this->uid));
-  }
-
-
-  /* Return plugin informations for acl handling*/
-  static function plInfo()
-  {
-    return (array(
-          "plDescription"     => _("Netatalk"),
-          "plSelfModify"      => TRUE,
-          "plDepends"         => array("user"),
-          "plPriority"        => 6,
-          "plSection"     => array("personal" => _("My account")),
-          "plCategory"    => array("users"),
-          "plOptions"         => array(),
-
-          "plProvidedAcls"  => array(
-            "netatalkUserHomepath"   =>  _("User home path"),
-            "netatalkShare"          =>  _("Share"))
-          ));
-  }
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/personal/netatalk/main.inc b/plugins/personal/netatalk/main.inc
deleted file mode 100644 (file)
index e1a62c9..0000000
+++ /dev/null
@@ -1,117 +0,0 @@
-<?php
-/*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2006  Gina Haeussge <osd@foosel.net>
-   Copyright (C) 2006  Bernd Zeimetz <bernd@zeimetz.de>
-
-   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
- */
-
-if (!$remove_lock) {
-  /* Reset requested? */
-  if (isset ($_POST['edit_cancel']) || (isset ($_GET['reset']) && $_GET['reset'] == 1)) {
-    del_lock($ui->dn);
-    sess_del('edit');
-    sess_del('netatalk');
-  }
-
-  /* Create netatalk object on demand */
-  if (!isset ($_SESSION['netatalk']) || (isset ($_GET['reset']) && $_GET['reset'] == 1)) {
-    $_SESSION['netatalk'] = new netatalk($config, $ui->dn);
-    $_SESSION['netatalk']->enable_CSN_check();
-    $_SESSION['netatalk']->set_acl_base($ui->dn);
-    $_SESSION['netatalk']->set_acl_category("users");
-  }
-  $netatalk = $_SESSION['netatalk'];
-
-  /* save changes back to object */
-  if (isset ($_SESSION['edit'])) {
-    $netatalk->save_object();
-  }
-
-  /* Enter edit mode? */
-  if (isset ($_POST['edit'])) {
-
-    /* Check locking */
-    if (($username = get_lock($ui->dn)) != "") {
-      $_SESSION['back_plugin'] = $plug;
-      gen_locked_message($username, $ui->dn);
-      exit ();
-    }
-
-    /* Lock the current entry */
-    add_lock($ui->dn, $ui->dn);
-    $_SESSION['dn'] = $ui->dn;
-    $_SESSION['edit'] = TRUE;
-  }
-
-  /* save changes to LDAP and disable edit mode */
-  if (isset ($_POST['edit_finish'])) {
-
-    /* Perform checks */
-    $message = $netatalk->check();
-
-    /* No errors, save object */
-    if (count($message) == 0) {
-      $netatalk->save();
-      del_lock($ui->dn);
-      sess_del('edit');
-
-      /* Remove object */
-      sess_del('netatalk');
-    } else {
-      /* Errors found, show message */
-      show_errors($message);
-    }
-  }
-
-  /* Execute formular */
-  $display = $netatalk->execute();
-
-  /* Store changes  in session */
-  if (isset ($_SESSION['edit'])) {
-    $_SESSION['netatalk'] = $netatalk;
-  }
-
-  $info = "";
-  /* Show page footer depending on the mode */
-  if ($netatalk->is_account) {
-    $display .= "<p class=\"plugbottom\">";
-
-    /* Are we in edit mode? */
-    if (isset ($_SESSION['edit'])) {
-      $display .= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
-      $display .= "&nbsp;";
-      $display .= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
-      $info = "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".$ui->dn."&nbsp;";
-    } else {
-      $info = "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/openlock.png')."\"> ".$ui->dn."&nbsp;";
-      if(preg_match("/w/",$ui->get_permissions($ui->dn,"users/netatalk"))){
-        $info .= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/lamp.png')."\"> "._("Click the 'Edit' button below to change informations in this dialog");
-        $display .= "<input type=submit name=\"edit\" value=\""._("Edit")."\">\n";
-      }
-
-      $display .= "<input type=\"hidden\" name=\"ignore\">\n";
-    }
-    $display .= "</p>\n";
-  }
-
-  /* Page header*/
-  $display = print_header(get_template_path('images/netatalk.png'), _("Netatalk settings"), $info).$display;
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/personal/netatalk/netatalk.tpl b/plugins/personal/netatalk/netatalk.tpl
deleted file mode 100644 (file)
index c5bcc8e..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-<table summary="">
-<tr>
-       <td>
-               <label for="apple_user_share">{t}Share{/t}</label>
-       </td>
-       <td>
-
-{render acl=$netatalkShareACL}
-               <select name="apple_user_share" id="apple_user_share">
-                       {html_options options=$shares selected=$selectedshare}
-               </select>
-{/render}
-       </td>
-<tr>
-       <td>
-               <label for="apple_user_homepath_raw">{t}Path{/t}</label>
-       </td>
-       <td>
-{render acl=$netatalkUserHomepathACL}
-               <input name="apple_user_homepath_raw" id="apple_user_homepath_raw" type="text" value="{$apple_user_homepath_raw}" size="25" maxlength="65"/>
-{/render}
-       </td>
-</tr>
-</table>
-
-<input type="hidden" name="netatalkTab" value="netatalkTab">
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('apple_user_homeurl_raw');
-  -->
-</script>
diff --git a/plugins/personal/password/changed.tpl b/plugins/personal/password/changed.tpl
deleted file mode 100644 (file)
index 16db300..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-
-<p>
- <b>{t}You've successfully changed your password. Remember to change all programms configured to use it as well.{/t}</b>
-</p>
-
-<br>
-
-<p class="plugbottom">
-  <input type=submit name="password_back" value="{t}Back{/t}">
-</p>
-
-<input type="hidden" name="ignore">
diff --git a/plugins/personal/password/class_password.inc b/plugins/personal/password/class_password.inc
deleted file mode 100644 (file)
index f9d5ac4..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-<?php
-/*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2007 Fabian Hickert
-
-   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 password extends plugin
-{
-  /* Definitions */
-  var $plHeadline     = "Password";
-  var $plDescription  = "This does something";
-
-  function password(&$config, $dn= NULL, $parent= NULL)
-  {
-    plugin::plugin($config, $dn, $parent);
-  }
-
-
-  function execute()
-  {
-    plugin::execute();
-    $smarty = get_smarty();
-    $ui = get_userinfo();
-
-    /* Get acls */
-    $password_ACLS = $ui->get_permissions($ui->dn,"users/password");
-    $smarty->assign("ChangeACL" ,  $password_ACLS);
-    $smarty->assign("NotAllowed" , !preg_match("/w/i",$password_ACLS));
-
-    /* Display expiration template */
-    if((isset($this->config->data['MAIN']['ACCOUNT_EXPIRATION'])) &&
-        preg_match('/true/i', $this->config->data['MAIN']['ACCOUNT_EXPIRATION'])){
-      $expired= ldap_expired_account($this->config, $ui->dn, $ui->username);
-      if($expired == 4){
-        return($smarty->fetch(get_template_path("nochange.tpl", TRUE)));
-      }
-    }
-
-    /* Pwd change requested */
-    if (isset($_POST['password_finish'])){
-
-      /* Should we check different characters in new password */
-      $check_differ = isset($this->config->data['MAIN']['PWDIFFER']);
-      $differ       = @$this->config->data['MAIN']['PWDIFFER'];
-
-      /* Enable length check ? */
-      $check_length = isset($this->config->data['MAIN']['PWMINLEN']);
-      $length       = @$this->config->data['MAIN']['PWMINLEN'];
-
-      /* Call external password quality hook ?*/
-      $check_hook   = isset($this->config->data['MAIN']['EXTERNALPWDHOOK']);
-      $hook         = @$this->config->data['MAIN']['EXTERNALPWDHOOK']." ".$ui->username." ".$_POST['current_password']." ".$_POST['new_password'];
-      if($check_hook){
-        exec($hook,$resarr);
-        $check_hook_output = "";
-        if(count($resarr) > 0) {
-          $check_hook_output= join('\n', $resarr);
-        }
-      }
-
-      /* Check given values */    
-      if(!isset($_POST['current_password']) || empty($_POST['current_password'])){
-        msg_dialog::display(_("User password"),
-                            _("You need to specify your current password in order to proceed."),WARNING_DIALOG);
-      }elseif ($_POST['new_password'] != $_POST['repeated_password']){
-        msg_dialog::display(_("User password"),
-                            _("The passwords you've entered as 'New password' and 'Repeated new password' do not match."),WARNING_DIALOG);
-      } elseif ($_POST['new_password'] == ""){
-        msg_dialog::display(_("User password"),
-                            _("The password you've entered as 'New password' is empty."),WARNING_DIALOG);
-      }elseif($check_differ && (substr($_POST['current_password'], 0, $differ) == substr($_POST['new_password'], 0, $differ))){
-        msg_dialog::display(_("User password"),
-                            _("The password used as new and current are too similar."),WARNING_DIALOG);
-      }elseif($check_length && (strlen($_POST['new_password']) < $length)){
-        msg_dialog::display(_("User password"),
-                            _("The password used as new is to short."),WARNING_DIALOG);
-      }elseif($check_hook && $check_hook_output != ""){
-        msg_dialog::display(_("User password"),
-                    sprintf(_("External password changer reported a problem: %s."),$check_hook_output),WARNING_DIALOG);
-      }else{
-
-        /* Try to connect via current password */
-        $tldap = new LDAP(
-            $ui->dn, 
-            $_POST['current_password'],
-            $this->config->current['SERVER'],
-            isset($this->config->current['RECURSIVE'])  && preg_match("/true/i",$this->config->current['RECURSIVE']),
-            isset($this->config->current['TLS'])        && preg_match("/true/i",$this->config->current['TLS']));
-
-        /* connection Successfull ? */
-        if ($tldap->error != "Success"){
-          msg_dialog::display(_("User password"),
-                              _("The password you've entered as your current password doesn't match the real one."),WARNING_DIALOG);
-        }else{
-
-          /* Check GOsa permissions */
-          if (!preg_match("/w/i",$password_ACLS)){
-            msg_dialog::display(_("User password"),
-                                _("You have no permissions to change your password."),WARNING_DIALOG);
-          }else{
-            change_password ($ui->dn, $_POST['new_password']);
-            gosa_log ("User/password has been changed");
-            $ui->password= $_POST['new_password'];
-            $_SESSION['ui']= $ui;
-#$this->handle_post_events("modify",array("userPassword" => $_POST['new_password']));
-            return($smarty->fetch(get_template_path("changed.tpl", TRUE)));
-          }
-        }
-      }
-    }
-    return($smarty->fetch(get_template_path("password.tpl", TRUE)));
-  } 
-
-  function remove_from_parent()
-  {
-    $this->handle_post_events("remove");
-  }
-
-  function save()
-  {
-  }
-
-  static function plInfo()
-  {
-    return (array(
-          "plDescription"     => _("User password"),
-          "plSelfModify"      => TRUE,
-          "plDepends"         => array("user"),
-          "plPriority"        => 10,
-          "plSection"     => array("personal" => _("My account")),
-          "plCategory"    => array("users"),
-          "plOptions"         => array(),
-
-          "plProvidedAcls"  => array())
-        );
-  }
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/personal/password/main.inc b/plugins/personal/password/main.inc
deleted file mode 100644 (file)
index b8135bc..0000000
+++ /dev/null
@@ -1,51 +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
- */
-
-/* Clear display */
-$display= "";
-
-if (!$remove_lock){
-
-  /* Reset requested? */
-  if (isset($_POST['edit_cancel']) ||
-      (isset($_GET['reset']) && $_GET['reset'] == 1)){
-
-    del_lock ($ui->dn);
-    sess_del ('edit');
-    sess_del ('password');
-  }
-
-  /* Create password object on demand */
-  if (!isset($_SESSION['password']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
-    $_SESSION['password']= new password ($config, $ui->dn);
-  }
-  $password= $_SESSION['password'];
-
-  /* Execute formular */
-  $display.= $password->execute ();
-
-  /* Page header*/
-  $display= print_header(get_template_path('images/password.png'),
-                         _("Password settings"), "").$display;
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/personal/password/nochange.tpl b/plugins/personal/password/nochange.tpl
deleted file mode 100644 (file)
index d7164f6..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<div class="plugtop">
-  <img class="center" alt="" src="images/error.png" align="middle">{t}Password change not allowed{/t}>
-</div>
-
-<p>
- <b>{t}You are not allowed to change your password at this time{/t}</b>
-</p>
-
-<br>
-
-<input type="hidden" name="ignore">
diff --git a/plugins/personal/password/password.tpl b/plugins/personal/password/password.tpl
deleted file mode 100644 (file)
index 0787b70..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-<p>
-  {t}To change your personal password use the fields below. The changes take effect immediately. Please memorize the new password, because you wouldn't be able to login without it.{/t}
-</p>
-
-<p>
-  {t}Changing the password affects your authentification on mail, proxy, samba and unix services.{/t}
-</p>
-
-<table summary="" style="vertical-align:top; text-align:left;" cellpadding=4 border=0>
-  <tr>
-    <td><b><LABEL for="current_password">{t}Current password{/t}</LABEL></b></td>
-    <td><input id="current_password" type="password" name="current_password" size="30" maxlength="40"
-               onFocus="nextfield= 'new_password';"></td>
-  </tr>
-  <tr>
-    <td><b><LABEL for="new_password">{t}New password{/t}</LABEL></b></td>
-    <td><input id="new_password" type="password" name="new_password" size="30" maxlength="40"
-               onFocus="nextfield= 'repeated_password';"></td>
-  </tr>
-  <tr>
-    <td><b><LABEL for="repeated_password">{t}Repeat new password{/t}</LABEL></b></td>
-    <td><input id="repeated_password" type="password" name="repeated_password" size="30" maxlength="40"
-               onFocus="nextfield= 'password_finish';"></td>
-  </tr>
-</table>
-
-<br>
-
-<p class="plugbottom">
-  <input type=submit name="password_finish" value="{t}Set password{/t}">
-  &nbsp;
-  <input type=reset id="password_cancel" name="password_cancel" value="{t}Clear fields{/t}">
-</p>
-
-<input type="hidden" name="ignore">
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-  nextfield= 'current_password';
-       focus_field('current_password');
-  -->
-</script>
-
diff --git a/plugins/personal/posix/class_posixAccount.inc b/plugins/personal/posix/class_posixAccount.inc
deleted file mode 100644 (file)
index e1a5412..0000000
+++ /dev/null
@@ -1,1433 +0,0 @@
-<?php
-/*!
-  \brief   posixAccount plugin
-  \author  Cajus Pollmeier <pollmeier@gonicus.de>
-  \version 2.00
-  \date    24.07.2003
-
-  This class provides the functionality to read and write all attributes
-  relevant for posixAccounts and shadowAccounts from/to the LDAP. It
-  does syntax checking and displays the formulars required.
- */
-
-class posixAccount extends plugin
-{
-  /* Definitions */
-  var $plHeadline= "UNIX";
-  var $plDescription= "This does something";
-
-  /* CLI vars */
-  var $cli_summary= "Manage users posix account";
-  var $cli_description= "Some longer text\nfor help";
-  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* Plugin specific values */
-  var $homeDirectory= "";
-  var $loginShell= "/bin/bash";
-  var $uidNumber= "";
-  var $gidNumber= "";
-  var $gecos= "";
-  var $shadowMin= "0";
-  var $shadowMax= "0";
-  var $shadowWarning= "0";
-  var $shadowLastChange= "0";
-  var $shadowInactive= "0";
-  var $shadowExpire= "0";
-  var $gosaDefaultPrinter= "";
-  var $accessTo= array();
-  var $trustModel= "";
-
-  var $glist=array();
-  var $status= "";
-  var $loginShellList= array();
-  var $groupMembership= array();
-  var $savedGroupMembership= array();
-  var $savedUidNumber= "";
-  var $savedGidNumber= "";
-  var $use_shadowMin= "0";
-  var $use_shadowMax= "0";
-  var $use_shadowWarning= "0";
-  var $use_shadowInactive= "0";
-  var $use_shadowExpire= "0";
-  var $mustchangepassword= "0";
-  var $force_ids= 0;
-  var $group_dialog= FALSE;
-  var $show_ws_dialog= FALSE;
-  var $secondaryGroups= array();
-  var $primaryGroup= 0;
-  var $was_trust_account= FALSE;
-  var $memberGroup = array();
-  var $grouplist  = array();
-  var $ui         = array();
-
-  var $GroupRegex       = "*";
-  var $GroupUserRegex   = "*";
-  var $SubSearch        = false;
-
-  var $view_logged = FALSE;
-
-  /* attribute list for save action */
-  var $CopyPasteVars  = 
-      array("grouplist","groupMembership","use_shadowMin",
-      "use_shadowMax","use_shadowWarning","use_shadowInactive","use_shadowExpire",
-      "must_change_password","printerList","grouplist","savedGidNumber","savedUidNumber");
-
-  var $attributes     = array("homeDirectory", "loginShell", "uidNumber", "gidNumber", "gecos",
-      "shadowMin", "shadowMax", "shadowWarning", "shadowInactive", "shadowLastChange",
-      "shadowExpire", "gosaDefaultPrinter", "uid","accessTo","trustModel");
-
-  var $objectclasses= array("posixAccount", "shadowAccount");
-
-  var $uid= "";
-  var $multiple_support = TRUE;
-
-  /* constructor, if 'dn' is set, the node loads the given
-     'dn' from LDAP */
-  function posixAccount (&$config, $dn= NULL)
-  {
-    /* Configuration is fine, allways */
-    $this->config= $config;
-
-    /* Load bases attributes */
-    plugin::plugin($config, $dn);
-
-    /* Setting uid to default */
-    if(isset($this->attrs['uid'][0])){
-      $this->uid = $this->attrs['uid'][0];
-    }
-
-    $ldap= $this->config->get_ldap_link();
-
-    if ($dn !== NULL){
-
-      /* Correct is_account. shadowAccount is not required. */
-      if (isset($this->attrs['objectClass']) &&
-          in_array ('posixAccount', $this->attrs['objectClass'])){
-
-        $this->is_account= TRUE;
-      }
-
-      /* Is this account a trustAccount? */
-      if ($this->is_account && isset($this->attrs['trustModel'])){
-        $this->trustModel= $this->attrs['trustModel'][0];
-        $this->was_trust_account= TRUE;
-      } else {
-        $this->was_trust_account= FALSE;
-        $this->trustModel= "";
-      }
-
-      $this->accessTo = array(); 
-      if ($this->is_account && isset($this->attrs['accessTo'])){
-        for ($i= 0; $i<$this->attrs['accessTo']['count']; $i++){
-          $tmp= $this->attrs['accessTo'][$i];
-          $this->accessTo[$tmp]= $tmp;
-        }
-      }
-      $this->initially_was_account= $this->is_account;
-
-      /* Fill group */
-      $this->primaryGroup= $this->gidNumber;
-
-      /* Generate status text */
-      $current= date("U");
-
-      $current= floor($current / 60 /60 / 24);
-
-      if (($current >= $this->shadowExpire) && $this->shadowExpire){
-        $this->status= _("expired");
-        if (($current - $this->shadowExpire) < $this->shadowInactive){
-          $this->status.= ", "._("grace time active");
-        }
-      } elseif (($this->shadowLastChange + $this->shadowMin) >= $current){
-        $this->status= _("active, password not changable");
-      } elseif (($this->shadowLastChange + $this->shadowMax) >= $current){
-        $this->status= _("active, password expired");
-      } else {
-        $this->status= _("active");
-      }
-
-      /* Get group membership */
-      $ldap->cd($this->config->current['BASE']);
-      $ldap->search("(&(objectClass=posixGroup)(memberUid=".$this->uid."))", array("cn", "description"));
-
-      while ($this->attrs= $ldap->fetch()){
-        if (!isset($this->attrs["description"][0])){
-          $entry= $this->attrs["cn"][0];
-        } else {
-          $dsc= preg_replace ('/^Group of user/', _("Group of user"), $this->attrs["description"][0]);
-          $entry= $this->attrs["cn"][0]." [$dsc]";
-        }
-        $this->groupMembership[$ldap->getDN()]= $entry;
-      }
-      asort($this->groupMembership);
-      reset($this->groupMembership);
-      $this->savedGroupMembership= $this->groupMembership;
-      $this->savedUidNumber= $this->uidNumber;
-      $this->savedGidNumber= $this->gidNumber;
-    }
-
-    /* Adjust shadow checkboxes */
-    foreach (array("shadowMin", "shadowMax", "shadowWarning", "shadowInactive",
-          "shadowExpire") as $val){
-
-      if ($this->$val != 0){
-        $oval= "use_".$val;
-        $this->$oval= "1";
-      }
-    }
-
-    /* Convert to seconds */
-    $this->shadowExpire= $this->convertToSeconds($this->shadowExpire);
-
-    /* Generate shell list from CONFIG_DIR./shells */
-    if (file_exists(CONFIG_DIR.'/shells')){
-      $shells = file (CONFIG_DIR.'/shells');
-      foreach ($shells as $line){
-        if (!preg_match ("/^#/", $line)){
-          $this->loginShellList[]= trim($line);
-        }
-      }
-    } else {
-      if ($this->loginShell == ""){
-        $this->loginShellList[]= _("unconfigured");
-      }
-    }
-
-    /* Insert possibly missing loginShell */
-    if ($this->loginShell != "" && !in_array($this->loginShell, $this->loginShellList)){
-      $this->loginShellList[]= $this->loginShell;
-    }
-
-    /* Generate group list */
-    $this->ui = get_userinfo(); 
-    $this->secondaryGroups[]= "- "._("automatic")." -";
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(objectClass=posixGroup)", array("cn", "gidNumber"));
-    while($attrs = $ldap->fetch()){
-      $this->secondaryGroups[$attrs['gidNumber'][0]]= $attrs['cn'][0];
-    }
-    asort ($this->secondaryGroups);
-
-    /* Get global filter config */
-    if (!is_global("sysfilter")){
-      $ui= get_userinfo();
-      $base= get_base_from_people($ui->dn);
-      $sysfilter= array( "depselect"       => $base,
-          "regex"           => "*");
-      register_global("sysfilter", $sysfilter);
-    }
-    $this->ui = get_userinfo();
-  }
-
-
-  /* execute generates the html output for this node */
-  function execute($isCopyPaste = false)
-  {
-    /* Call parent execute */
-    plugin::execute();
-    $display= "";
-
-    /* Log view */
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","users/".get_class($this),$this->dn);
-    }
-
-    /* Department has changed? */
-    if(isset($_POST['depselect'])){
-      $_SESSION['CurrentMainBase']= validate($_POST['depselect']);
-    }
-
-    if($this->multiple_support_active){
-      $this->is_account = TRUE;
-    }
-
-    if(!$isCopyPaste && ! $this->multiple_support_active){
-
-      /* 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;
-        }
-      }
-
-      /* Do we represent a valid posixAccount? */
-      if (!$this->is_account && $this->parent === NULL ){
-        $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\">&nbsp;<b>".
-          _("This account has no unix extensions.")."</b>";
-        $display.= back_to_main();
-        return ($display);
-      }
-
-
-      /* Show tab dialog headers */
-      if ($this->parent !== NULL){
-        if ($this->is_account){
-          if (isset($this->parent->by_object['sambaAccount'])){
-            $obj= $this->parent->by_object['sambaAccount'];
-          }
-          if (isset($obj) && $obj->is_account == TRUE &&
-              ((isset($this->parent->by_object['sambaAccount']))&&($this->parent->by_object['sambaAccount']->is_account))
-              ||(isset($this->parent->by_object['environment'] ))&&($this->parent->by_object['environment'] ->is_account)){
-
-            /* Samba3 dependency on posix accounts are enabled
-               in the moment, because I need to rely on unique
-               uidNumbers. There'll be a better solution later
-               on. */
-            $display= $this->show_disable_header(_("Remove posix account"),
-                _("This account has unix features enabled. To disable them, you'll need to remove the samba / environment account first."), TRUE);
-          } else {
-            $display= $this->show_disable_header(_("Remove posix account"),
-                _("This account has posix features enabled. You can disable them by clicking below."));
-          }
-        } else {
-          $display= $this->show_enable_header(_("Create posix account"),
-              _("This account has posix features disabled. You can enable them by clicking below."));
-          return($display);
-        }
-      }
-    }
-    /* Trigger group edit? */
-    if (isset($_POST['edit_groupmembership'])){
-      $this->group_dialog= TRUE;
-      $this->dialog= TRUE;
-    }
-
-    /* Cancel group edit? */
-    if (isset($_POST['add_groups_cancel']) ||
-        isset($_POST['add_groups_finish'])){
-      $this->group_dialog= FALSE;
-      $this->dialog= FALSE;
-    }
-
-    /* Add selected groups */
-    if (isset($_POST['add_groups_finish']) && isset($_POST['groups']) &&
-        count($_POST['groups'])){
-
-      $this->addGroup ($_POST['groups']);
-    }
-
-    /* Delete selected groups */
-    if (isset($_POST['delete_groupmembership']) && 
-        isset($_POST['group_list']) && count($_POST['group_list'])){
-
-      $this->delGroup ($_POST['group_list']);
-    }
-
-    /* Add user workstation? */
-    if (isset($_POST["add_ws"])){
-      $this->show_ws_dialog= TRUE;
-      $this->dialog= TRUE;
-    }
-
-    /* Add user workstation? */
-    if (isset($_POST["add_ws_finish"]) && isset($_POST['wslist'])){
-      foreach($_POST['wslist'] as $ws){
-        $this->accessTo[$ws]= $ws;
-      }
-      ksort($this->accessTo);
-      $this->is_modified= TRUE;
-    }
-
-    /* Remove user workstations? */
-    if (isset($_POST["delete_ws"]) && isset($_POST['workstation_list'])){
-      foreach($_POST['workstation_list'] as $name){
-        unset ($this->accessTo[$name]);
-      }
-      $this->is_modified= TRUE;
-    }
-
-    /* Add user workstation finished? */
-    if (isset($_POST["add_ws_finish"]) || isset($_POST["add_ws_cancel"])){
-      $this->show_ws_dialog= FALSE;
-      $this->dialog= FALSE;
-    }
-
-    /* Templates now! */
-    $smarty= get_smarty();
-
-    /* Show ws dialog */
-    if ($this->show_ws_dialog){
-      /* Save data */
-      $sysfilter= get_global("sysfilter");
-      foreach( array("depselect", "regex") as $type){
-        if (isset($_POST[$type])){
-          $sysfilter[$type]= $_POST[$type];
-        }
-      }
-      if (isset($_GET['search'])){
-        $s= mb_substr($_GET['search'], 0, 1, "UTF8")."*";
-        if ($s == "**"){
-          $s= "*";
-        }
-        $sysfilter['regex']= $s;
-      }
-      register_global("sysfilter", $sysfilter);
-
-      /* Get workstation list */
-      $exclude= "";
-      foreach($this->accessTo as $ws){
-        $exclude.= "(cn=$ws)";
-      }
-      if ($exclude != ""){
-        $exclude= "(!(|$exclude))";
-      }
-      $regex= $sysfilter['regex'];
-      $filter= "(&(|(objectClass=goServer)(objectClass=gotoWorkstation)(objectClass=gotoTerminal))$exclude(cn=*)(cn=$regex))";
-      $res= get_list($filter, "groups", $sysfilter['depselect'], array("cn"), GL_SUBSEARCH | GL_SIZELIMIT);
-      $wslist= array();
-      foreach ($res as $attrs){
-        $wslist[]= preg_replace('/\$/', '', $attrs['cn'][0]);
-      }
-      asort($wslist);
-      $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("deplist", $this->config->idepartments);
-      $smarty->assign("alphabet", generate_alphabet());
-      foreach( array("depselect", "regex") as $type){
-        $smarty->assign("$type", $sysfilter[$type]);
-      }
-      $smarty->assign("hint", print_sizelimit_warning());
-      $smarty->assign("wslist", $wslist);
-      $smarty->assign("apply", apply_filter());
-      $display= $smarty->fetch (get_template_path('trust_machines.tpl', TRUE, dirname(__FILE__)));
-      return ($display);
-    }
-
-    /* Manage group add dialog */
-    if ($this->group_dialog){
-
-      /* Get global filter config */
-      $this->reload();
-
-      /* remove already assigned groups */
-      $glist= array();
-      foreach ($this->grouplist as $key => $value){
-        if (!isset($this->groupMembership[$key]) && obj_is_writable($key,"groups/group","memberUid")){
-          $glist[$key]= $value;
-        }
-      }
-
-      if($this->SubSearch){
-        $smarty->assign("SubSearchCHK"," checked ");
-      }else{
-        $smarty->assign("SubSearchCHK","");
-      }
-
-      $smarty->assign("regex",$this->GroupRegex);
-      $smarty->assign("guser",$this->GroupUserRegex);
-      $smarty->assign("groups", $glist);
-      $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("deplist", $this->config->idepartments);
-      $smarty->assign("alphabet", generate_alphabet());
-      $smarty->assign("depselect",$_SESSION['CurrentMainBase']);
-      $smarty->assign("hint", print_sizelimit_warning());
-
-      $smarty->assign("apply", apply_filter());
-      $display.= $smarty->fetch (get_template_path('posix_groups.tpl', TRUE, dirname(__FILE__)));
-      return ($display);
-    }
-
-    /* Show main page */
-    $smarty= get_smarty();
-
-    /* In 'MyAccount' mode, we must remove write acls if we are not in editing mode. */ 
-    $SkipWrite = (!isset($this->parent) || !$this->parent) && !isset($_SESSION['edit']);
-
-    /* Depending on pwmode, currently hardcoded because there are no other methods */
-    if ( 1 == 1 ){
-      $smarty->assign("pwmode", dirname(__FILE__)."/posix_shadow");
-
-      $shadowMinACL     =  $this->getacl("shadowMin",$SkipWrite);
-      $smarty->assign("shadowmins", sprintf(_("Password can't be changed up to %s days after last change"), 
-                                              "<input name=\"shadowMin\" size=3 maxlength=4 value=\"".$this->shadowMin."\">"));
-
-      $shadowMaxACL     =  $this->getacl("shadowMax",$SkipWrite);
-      $smarty->assign("shadowmaxs", sprintf(_("Password must be changed after %s days"), 
-                                              "<input name=\"shadowMax\" size=3 maxlength=4 value=\"".$this->shadowMax."\">"));
-
-      $shadowInactiveACL=  $this->getacl("shadowInactive",$SkipWrite);
-      $smarty->assign("shadowinactives", sprintf(_("Disable account after %s days of inactivity after password expiery"), 
-                                              "<input name=\"shadowInactive\" size=3 maxlength=4 value=\"".$this->shadowInactive."\">"));
-
-      $shadowWarningACL =  $this->getacl("shadowWarning",$SkipWrite);
-      $smarty->assign("shadowwarnings", sprintf(_("Warn user %s days before password expiery"), 
-                                              "<input name=\"shadowWarning\" size=3 maxlength=4 value=\"".$this->shadowWarning."\">"));
-
-      foreach( array("use_shadowMin", "use_shadowMax",
-                     "use_shadowExpire", "use_shadowInactive","use_shadowWarning") as $val){
-        if ($this->$val == 1){
-          $smarty->assign("$val", "checked");
-        } else {
-          $smarty->assign("$val", "");
-        }
-        $smarty->assign("$val"."ACL", $this->getacl($val,$SkipWrite));
-      }
-
-      if($this->mustchangepassword){
-        $smarty->assign("mustchangepassword", "checked");
-      } else {
-        $smarty->assign("mustchangepassword", "");
-      }
-      $smarty->assign("mustchangepasswordACL", $this->getacl("mustchangepassword",$SkipWrite));
-    }
-
-    /* Fill calendar */
-    /* If this $this->shadowExpire is empty 
-        use current date as base for calculating selectbox values.
-       (This attribute is empty if this is a new user )*/ 
-    if(empty($this->shadowExpire)){
-      $date= getdate(time());
-    }else{
-      $date= getdate($this->shadowExpire);
-    }
-    $days= array();
-    for($d= 1; $d<32; $d++){
-      $days[$d]= $d;
-    }
-    $years= array();
-    for($y= $date['year']-10; $y<$date['year']+10; $y++){
-      $years[]= $y;
-    }
-    $months= array(_("January"), _("February"), _("March"), _("April"),
-        _("May"), _("June"), _("July"), _("August"), _("September"),
-        _("October"), _("November"), _("December"));
-    $smarty->assign("day", $date["mday"]);
-    $smarty->assign("days", $days);
-    $smarty->assign("months", $months);
-    $smarty->assign("month", $date["mon"]-1);
-    $smarty->assign("years", $years);
-    $smarty->assign("year", $date["year"]);
-
-    /* Fill arrays */
-    $smarty->assign("shells", $this->loginShellList);
-    $smarty->assign("secondaryGroups", $this->secondaryGroups);
-    $smarty->assign("primaryGroup", $this->primaryGroup);
-    if (!count($this->groupMembership)){
-      $smarty->assign("groupMembership", array("&nbsp;"));
-    } else {
-      $smarty->assign("groupMembership", $this->groupMembership);
-    }
-    if (count($this->groupMembership) > 16){
-      $smarty->assign("groups", "too_many_for_nfs");
-    } else {
-      $smarty->assign("groups", "");
-    }
-
-    /* Avoid "Undefined index: forceMode" */
-    $smarty->assign("forceMode", "");
-
-    /* Checkboxes */
-    if ($this->force_ids == 1){
-      $smarty->assign("force_ids", "checked");
-      if ($_SESSION['js']){
-        $smarty->assign("forceMode", "");
-      }
-    } else {
-      if ($_SESSION['js']){
-        $smarty->assign("forceMode", "disabled");
-      }
-      $smarty->assign("force_ids", "");
-    }
-
-    
-
-    $smarty->assign("force_idsACL", $this->getacl("uidNumber",$SkipWrite).$this->getacl("gidNumber",$SkipWrite));
-
-    foreach(array("primaryGroup") as $val){
-      if(in_array($val,$this->multi_boxes)){
-        $smarty->assign("use_".$val,TRUE);
-      }else{
-        $smarty->assign("use_".$val,FALSE);
-      }
-    }
-
-
-    /* Load attributes and acl's */
-    foreach($this->attributes as $val){
-      if(in_array($val,$this->multi_boxes)){
-        $smarty->assign("use_".$val,TRUE);
-      }else{
-        $smarty->assign("use_".$val,FALSE);
-      }
-
-      if(($_SESSION["js"])&&(($val=="uidNumber")||($val=="gidNumber")))
-      {
-        $smarty->assign("$val"."ACL",$this->getacl($val,$SkipWrite));
-        $smarty->assign("$val", $this->$val);
-        continue;
-      }
-      $smarty->assign("$val", $this->$val);
-      $smarty->assign("$val"."ACL", $this->getacl($val,$SkipWrite));
-    }
-    if($SkipWrite){
-      $smarty->assign("groupMembershipACL","r");
-    }else{
-      $smarty->assign("groupMembershipACL","rw");
-    }
-    $smarty->assign("status", $this->status);
-
-    /* Work on trust modes */
-    $smarty->assign("trusthide", " disabled ");
-    $smarty->assign("trustmodeACL",  $this->getacl("trustModel",$SkipWrite));
-    if ($this->trustModel == "fullaccess"){
-      $trustmode= 1;
-      // pervent double disable tag in html code, this will disturb our clean w3c html
-      $smarty->assign("trustmode",  $this->getacl("trustModel",$SkipWrite));
-
-    } elseif ($this->trustModel == "byhost"){
-      $trustmode= 2;
-      $smarty->assign("trusthide", "");
-    } else {
-      // pervent double disable tag in html code, this will disturb our clean w3c html
-      $smarty->assign("trustmode",  $this->getacl("trustModel",$SkipWrite));
-      $trustmode= 0;
-    }
-    $smarty->assign("trustmode", $trustmode);
-    $smarty->assign("trustmodes", array( 0 => _("disabled"), 1 => _("full access"),
-          2 => _("allow access to these hosts")));
-
-
-
-    if((count($this->accessTo))==0)
-      $smarty->assign("emptyArrAccess",true);
-    else
-      $smarty->assign("emptyArrAccess",false);
-
-
-
-    $smarty->assign("workstations", $this->accessTo);
-
-    $smarty->assign("apply", apply_filter());
-    $smarty->assign("multiple_support" , $this->multiple_support_active);
-    $display.= $smarty->fetch (get_template_path('generic.tpl', TRUE, dirname(__FILE__)));
-    return($display);
-  }
-
-
-  /* remove object from parent */
-  function remove_from_parent()
-  {
-    /* Cancel if there's nothing to do here */
-    if ((!$this->initially_was_account) || (!$this->acl_is_removeable())){
-      return;
-    }
-
-    /* include global link_info */
-    $ldap= $this->config->get_ldap_link();
-
-    /* Remove and write to LDAP */
-    plugin::remove_from_parent();
-
-    /* Zero out array */
-    $this->attrs['gosaHostACL']= array();
-
-    /* Keep uid, because we need it for authentification! */
-    unset($this->attrs['uid']);
-    unset($this->attrs['trustModel']);
-
-    @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
-        $this->attributes, "Save");
-    $ldap->cd($this->dn);
-    $this->cleanup();
-    $ldap->modify ($this->attrs); 
-
-    new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-
-    show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/posix account with dn '%s' failed."),$this->dn));
-
-    /* Delete group only if cn is uid and there are no other
-       members inside */
-    $ldap->cd ($this->config->current['BASE']);
-    $ldap->search ("(&(objectClass=posixGroup)(gidNumber=".$this->gidNumber."))", array("cn", "memberUid"));
-    if ($ldap->count() != 0){
-      $attrs= $ldap->fetch();
-      if ($attrs['cn'][0] == $this->uid &&
-          !isset($this->attrs['memberUid'])){
-
-        $ldap->rmDir($ldap->getDN());
-      }
-    }
-
-    /* Optionally execute a command after we're done */
-    $this->handle_post_events("remove",array("uid" => $this->uid));
-  }
-
-
-  function save_object()
-  {
-    if (isset($_POST['posixTab'])){
-      /* Save values to object */
-      plugin::save_object();
-
-
-      /* Save force GID checkbox */
-      if($this->acl_is_writeable("gidNumber") || $this->acl_is_writeable("uidNumber")){
-        if (isset ($_POST['force_ids'])){
-          $data= 1;
-        } else {
-          $data= 0;
-        }
-        if ($this->force_ids != $data){
-          $this->is_modified= TRUE;
-        }
-        $this->force_ids= $data;
-      }
-
-      /*Save primary group settings */
-      if($this->acl_is_writeable("primaryGroup") && isset($_POST['primaryGroup'])){
-        $data= $_POST['primaryGroup'];
-        if ($this->primaryGroup != $data){
-          $this->is_modified= TRUE;
-        }
-        $this->primaryGroup= $_POST['primaryGroup'];
-      }
-
-      foreach(array("shadowMin","shadowMax","shadowExpire","shadowInactive","shadowWarning","mustchangepassword") as $var) {
-        if($this->acl_is_writeable($var)){
-          $use_var = "use_".$var;
-          if(isset($_POST['use_'.$var])){
-            $this->$use_var  = true;
-            $this->$var      = $_POST[$var];
-          }else{
-            $this->$use_var  = false;
-            $this->$var      = 0;
-          }
-        }
-      }
-
-      /* Trust mode - special handling */
-      if($this->acl_is_writeable("trustModel")){
-        if (isset($_POST['trustmode'])){
-          $saved= $this->trustModel;
-          if ($_POST['trustmode'] == "1"){
-            $this->trustModel= "fullaccess";
-          } elseif ($_POST['trustmode'] == "2"){
-            $this->trustModel= "byhost";
-          } else {
-            $this->trustModel= "";
-          }
-          if ($this->trustModel != $saved){
-            $this->is_modified= TRUE;
-          }
-        }
-      }
-    }
-
-    /* Get regex from alphabet */
-    if(isset($_GET['search'])){
-      $this->GroupRegex = $_GET['search']."*";
-    }
-
-    /* Check checkboxes and regexes */
-    if(isset($_POST["PosixGroupDialogPosted"])){
-
-      if(isset($_POST['SubSearch']) && ($_POST['SubSearch'])){
-        $this->SubSearch = true;
-      }else{
-        $this->SubSearch = false;
-      }
-      if(isset($_POST['guser'])){
-        $this->GroupUserRegex = $_POST['guser'];
-      }
-      if(isset($_POST['regex'])){
-        $this->GroupRegex = $_POST['regex'];
-      }
-    }
-    $this->GroupRegex = preg_replace("/\*\**/","*",$this->GroupRegex);
-    $this->GroupUserRegex = preg_replace("/\*\**/","*",$this->GroupUserRegex);
-  }
-
-
-  /* Save data to LDAP, depending on is_account we save or delete */
-  function save()
-  {
-
-    /* include global link_info */
-    $ldap= $this->config->get_ldap_link();
-
-    /* Adapt shadow values */
-    if (!$this->use_shadowExpire){
-      $this->shadowExpire= "0";
-    } else {
-      /* Transform seconds to days here */
-      $this->shadowExpire= (int)($this->shadowExpire / (60 * 60 * 24)) ;
-    }
-    if (!$this->use_shadowMax){
-      $this->shadowMax= "0";
-    }
-    if ($this->mustchangepassword){
-      $this->shadowLastChange= (int)(date("U") / 86400) - $this->shadowMax - 1;
-    } else {
-      $this->shadowLastChange= (int)(date("U") / 86400);
-    }
-    if (!$this->use_shadowWarning){
-      $this->shadowWarning= "0";
-    }
-
-    /* Check what to do with ID's */
-    if ($this->force_ids == 0){
-
-      /* Use id's that are already set */
-      if ($this->savedUidNumber != ""){
-        $this->uidNumber= $this->savedUidNumber;
-        $this->gidNumber= $this->savedGidNumber;
-      } else {
-
-        /* Calculate new id's. We need to place a lock before calling get_next_id
-           to get real unique values. */
-        $wait= 10;
-        while (get_lock("uidnumber") != ""){
-          sleep (1);
-
-          /* Oups - timed out */
-          if ($wait-- == 0){
-            print_red (_("Failed: overriding lock"));
-            break;
-          }
-        }
-
-        add_lock ("uidnumber", "gosa");
-        $this->uidNumber= $this->get_next_id("uidNumber", $this->dn);
-        if ($this->savedGidNumber != ""){
-          $this->gidNumber= $this->savedGidNumber;
-        } else {
-          $this->gidNumber= $this->get_next_id("gidNumber", $this->dn);
-        }
-      }
-
-      if ($this->primaryGroup != 0){
-        $this->gidNumber= $this->primaryGroup;
-      }
-    }
-
-    if ($this->use_shadowMin != "1" ) {
-      $this->shadowMin = "";
-    }
-
-    if (($this->use_shadowMax != "1") && ($this->mustchangepassword != "1")) {
-      $this->shadowMax = "";
-    }
-
-    if ($this->use_shadowWarning != "1" ) {
-      $this->shadowWarning = "";
-    }
-
-    if ($this->use_shadowInactive != "1" ) {
-      $this->shadowInactive = "";
-    }
-
-    if ($this->use_shadowExpire != "1" ) {
-      $this->shadowExpire = "";
-    }
-
-    /* Fill gecos */
-    if (isset($this->parent) && $this->parent !== NULL){
-      $this->gecos= rewrite($this->parent->by_object['user']->cn);
-      if (!preg_match('/^[a-z0-9 -]+$/i', $this->gecos)){
-        $this->gecos= "";
-      }
-    }
-
-    foreach(array("shadowMin","shadowMax","shadowWarning","shadowInactive","shadowExpire") as $attr){
-      $this->$attr = (int) $this->$attr;
-    }
-    /* Call parents save to prepare $this->attrs */
-    plugin::save();
-
-    /* Trust accounts */
-    $objectclasses= array();
-    foreach ($this->attrs['objectClass'] as $key => $class){
-      if (preg_match('/trustAccount/i', $class)){
-        continue;
-      }
-      $objectclasses[]= $this->attrs['objectClass'][$key];
-    }
-    $this->attrs['objectClass']= $objectclasses;
-    if ($this->trustModel != ""){
-      $this->attrs['objectClass'][]= "trustAccount";
-      $this->attrs['trustModel']= $this->trustModel;
-      $this->attrs['accessTo']= array();
-      if ($this->trustModel == "byhost"){
-        foreach ($this->accessTo as $host){
-          $this->attrs['accessTo'][]= $host;
-        }
-      }
-    } else {
-      if ($this->was_trust_account){
-        $this->attrs['accessTo']= array();
-        $this->attrs['trustModel']= array();
-      }
-    }
-
-    if(empty($this->attrs['gosaDefaultPrinter'])){
-      $thid->attrs['gosaDefaultPrinter']=array();
-    }
-
-
-    /* Save data to LDAP */
-    $ldap->cd($this->dn);
-    $this->cleanup();
-    unset($this->attrs['uid']);
-    $ldap->modify ($this->attrs); 
-
-    /* Log last action */ 
-    if($this->initially_was_account){
-      new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }else{
-      new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }
-
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/posix account with dn '%s' failed."),$this->dn));
-
-    /* Remove lock needed for unique id generation */
-    del_lock ("uidnumber");
-
-    /* Posix accounts have group interrelationship, 
-       take care about these here if this is a new user without forced gidNumber. */
-    if ($this->force_ids == 0 && $this->primaryGroup == 0 && !$this->initially_was_account){
-      $ldap->cd($this->config->current['BASE']);
-      $ldap->search("(&(objectClass=posixGroup)(gidNumber=".$this->gidNumber."))", array("cn"));
-
-      /* Create group if it doesn't exist */
-      if ($ldap->count() == 0){
-        $groupdn= preg_replace ('/^'.$this->config->current['DNMODE'].'=[^,]+,'.get_people_ou().'/i', 'cn='.$this->uid.','.get_groups_ou(), $this->dn);
-
-        $g= new group($this->config, $groupdn);
-        $g->cn= $this->uid;
-        $g->force_gid= 1;
-        $g->gidNumber= $this->gidNumber;
-        $g->description= "Group of user ".$this->givenName." ".$this->sn;
-        $g->save ();
-      }
-    }
-
-    /* Take care about groupMembership values: add to groups */
-    foreach ($this->groupMembership as $key => $value){
-      if (!isset($this->savedGroupMembership[$key])){
-        $g= new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], $key,"groups");
-        $g->set_acl_base($key);
-        $g->by_object['group']->addUser($this->uid);
-        $g->save();
-      }
-    }
-
-    /* Remove from groups not listed in groupMembership */
-    foreach ($this->savedGroupMembership as $key => $value){
-      if (!isset($this->groupMembership[$key])){
-        $g= new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], $key,"groups");
-        $g->set_acl_base($key);
-        $g->by_object['group']->removeUser ($this->uid);
-        $g->save();
-      }
-    }
-
-    /* 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",array("uid" => $this->uid));
-      }
-    } else {
-      $this->handle_post_events("add" ,array("uid"=> $this->uid));
-    }
-  }
-
-  /* Check formular input */
-  function check()
-  {
-    /* Include global link_info */
-    $ldap= $this->config->get_ldap_link();
-
-    /* Append groups as memberGroup: to check hook 
-     */
-    $tmp_attributes  = $this->attributes;    
-    $this->attributes[] = "memberGroup";
-    $this->memberGroup = array();
-    foreach($this->groupMembership as $dn => $name){
-      $this->memberGroup[] = $name;
-    }
-
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-    $this->attributes = $tmp_attributes;
-
-    /* must: homeDirectory */
-    if ($this->homeDirectory == ""){
-      $message[]= _("The required field 'Home directory' is not set.");
-    }
-    if (!is_path($this->homeDirectory)){
-      $message[]= _("Please enter a valid path in 'Home directory' field.");
-    }
-
-    /* Check ID's if they are forced by user */
-    if ($this->force_ids == "1"){
-
-      /* Valid uid/gid? */
-      if (!is_id($this->uidNumber)){
-        $message[]= _("Value specified as 'UID' is not valid.");
-      } else {
-        if ($this->uidNumber < $this->config->current['MINID']){
-          $message[]= _("Value specified as 'UID' is too small.");
-        }
-      }
-      if (!is_id($this->gidNumber)){
-        $message[]= _("Value specified as 'GID' is not valid.");
-      } else {
-        if ($this->gidNumber < $this->config->current['MINID']){
-          $message[]= _("Value specified as 'GID' is too small.");
-        }
-      }
-    }
-
-    /* Check shadow settings, well I like spaghetties... */
-    if ($this->use_shadowMin){
-      if (!is_id($this->shadowMin)){
-        $message[]= _("Value specified as 'shadowMin' is not valid.");
-      }
-    }
-    if ($this->use_shadowMax){
-      if (!is_id($this->shadowMax)){
-        $message[]= _("Value specified as 'shadowMax' is not valid.");
-      }
-    }
-    if ($this->use_shadowWarning){
-      if (!is_id($this->shadowWarning)){
-        $message[]= _("Value specified as 'shadowWarning' is not valid.");
-      }
-      if (!$this->use_shadowMax){
-        $message[]= _("'shadowWarning' without 'shadowMax' makes no sense.");
-      }
-      if ($this->shadowWarning > $this->shadowMax){
-        $message[]= _("Value specified as 'shadowWarning' should be smaller than 'shadowMax'.");
-      }
-      if ($this->use_shadowMin && $this->shadowWarning < $this->shadowMin){
-        $message[]= _("Value specified as 'shadowWarning' should be greater than 'shadowMin'.");
-      }
-    }
-    if ($this->use_shadowInactive){
-      if (!is_id($this->shadowInactive)){
-        $message[]= _("Value specified as 'shadowInactive' is not valid.");
-      }
-      if (!$this->use_shadowMax){
-        $message[]= _("'shadowInactive' without 'shadowMax' makes no sense.");
-      }
-    }
-    if ($this->use_shadowMin && $this->use_shadowMax){
-      if ($this->shadowMin > $this->shadowMax){
-        $message[]= _("Value specified as 'shadowMin' should be smaller than 'shadowMax'.");
-      }
-    }
-
-    //  if(empty($this->gosaDefaultPrinter)){
-    //    $message[]= _("You need to specify a valid default printer.");
-    //  }
-
-    return ($message);
-  }
-
-  function addGroup ($groups)
-  {
-    /* include global link_info */
-    $ldap= $this->config->get_ldap_link();
-
-    /* Walk through groups and add the descriptive entry if not exists */
-    foreach ($groups as $value){
-      if (!array_key_exists($value, $this->groupMembership)){
-        $ldap->cat($value, array('cn', 'description', 'dn'));
-        $attrs= $ldap->fetch();
-        error_reporting (0);
-        if (!isset($attrs['description'][0])){
-          $entry= $attrs["cn"][0];
-        } else {
-          $dsc= preg_replace ('/^Group of user/', _("Group of user"), $attrs["description"][0]);
-          $entry= $attrs["cn"][0]." [$dsc]";
-        }
-        error_reporting (E_ALL | E_STRICT);
-
-        if(obj_is_writable($attrs['dn'],"groups/group","memberUid")){
-          $this->groupMembership[$attrs['dn']]= $entry;
-        }
-      }
-    }
-
-    /* Sort groups */
-    asort ($this->groupMembership);
-    reset ($this->groupMembership);
-  }
-
-
-  /* Del posix user from some groups */
-  function delGroup ($groups)
-  {
-    $dest= array();
-    foreach($groups as $dn_to_del){
-      if(isset($this->groupMembership[$dn_to_del]) && obj_is_writable($dn_to_del,"groups/group","memberUid")){
-        unset($this->groupMembership[$dn_to_del]);
-      }
-    }
-  }
-
-
-  /* Adapt from template, using 'dn' */
-  function adapt_from_template($dn)
-  {
-    /* Include global link_info */
-    $ldap= $this->config->get_ldap_link();
-
-    plugin::adapt_from_template($dn);
-    $template= $this->attrs['uid'][0];
-
-    /* Adapt group membership */
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(&(objectClass=posixGroup)(memberUid=".$this->attrs["uid"][0]."))", array("description", "cn"));
-
-    while ($this->attrs= $ldap->fetch()){
-      if (!isset($this->attrs["description"][0])){
-        $entry= $this->attrs["cn"][0];
-      } else {
-        $entry= $this->attrs["cn"][0]." [".$this->attrs["description"][0]."]";
-      }
-      $this->groupMembership[$ldap->getDN()]= $entry;
-    }
-
-    /* Fix primary group settings */
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(&(objectClass=posixGroup)(cn=$template)(gidNumber=".$this->gidNumber."))", array("cn"));
-    if ($ldap->count() != 1){
-      $this->primaryGroup= $this->gidNumber;
-    }
-
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(&(objectClass=gosaUserTemplate)(uid=".$template.")(accessTo=*))", array("cn","accessTo"));
-    while($attr = $ldap->fetch()){
-      $tmp = $attr['accessTo'];
-      unset ($tmp['count']);
-      $this->accessTo = $tmp;  
-    }
-
-    /* Adjust shadow checkboxes */
-    foreach (array("shadowMin", "shadowMax", "shadowWarning", "shadowInactive") as $val){
-      if ($this->$val != 0){
-        $oval= "use_".$val;
-        $this->$oval= "1";
-      }
-    }
-
-    /* FIXME: NEED review of this section */
-    /* Need to check shadowExpire separately */
-
-    /* 
-     * If shadowExpire is not enabled in the template, it's a UNIX timestamp - so don't convert it to seconds.
-     * The check is a hack - if difference between timestamp generated above and here is max 1 day.
-     */
-    if(abs($this->shadowExpire - time())>86400) {
-      $this->shadowExpire= $this->convertToSeconds($this->shadowExpire);
-    }
-    
-    /* Only enable checkbox, if shadowExpire is in the future */
-    if($this->shadowExpire > time()) {
-      $this->use_shadowExpire= "1";
-    }
-  }
-
-  function convertToSeconds($val)
-  {
-    if ($val != 0){
-      $val*= 60 * 60 * 24;
-    } else {
-      $date= getdate();
-      $val= floor($date[0] / (60*60*24)) * 60 * 60 * 24;
-    }
-    return($val);
-  }
-
-
-  function get_next_id($attrib, $dn)
-  {
-    $ids= array();
-    $ldap= $this->config->get_ldap_link();
-
-    $ldap->cd ($this->config->current['BASE']);
-    if (preg_match('/gidNumber/i', $attrib)){
-      $oc= "posixGroup";
-    } else {
-      $oc= "posixAccount";
-    }
-    $ldap->search ("(&(objectClass=$oc)($attrib=*))", array("$attrib"));
-
-    /* Get list of ids */
-    while ($attrs= $ldap->fetch()){
-      $ids[]= (int)$attrs["$attrib"][0];
-    }
-
-    /* Add the nobody id */
-    $ids[]= 65534;
-
-    /* get the ranges */
-    $tmp = array('0'=> 1000); 
-    if (preg_match('/posixAccount/', $oc) && isset($this->config->current['UIDBASE'])) {
-      $tmp= split('-',$this->config->current['UIDBASE']);
-    } elseif(isset($this->config->current['GIDBASE'])){
-      $tmp= split('-',$this->config->current['GIDBASE']);
-    }
-
-    /* Set hwm to max if not set - for backward compatibility */
-    $lwm= $tmp[0];
-    if (isset($tmp[1])){
-      $hwm= $tmp[1];
-    } else {
-      $hwm= pow(2,32);
-    }
-
-    /* Find out next free id near to UID_BASE */
-    if (!isset($this->config->current['BASE_HOOK'])){
-      $base= $lwm;
-    } else {
-      /* Call base hook */
-      $base= get_base_from_hook($dn, $attrib);
-    }
-    for ($id= $base; $id++; $id < pow(2,32)){
-      if (!in_array($id, $ids)){
-        return ($id);
-      }
-    }
-
-    /* Should not happen */
-    if ($id == $hwm){
-      print_red(_("Too many users, can't allocate a free ID!"));
-      exit;
-    }
-
-  }
-
-  function reload()
-  {
-    /* Set base for all searches */
-    $base     = $_SESSION['CurrentMainBase'];
-    $base     = $base;
-    $ldap     = $this->config->get_ldap_link();    
-    $attrs    =  array("cn", "description", "gidNumber");
-    $Flags    = GL_SIZELIMIT;
-
-    /* Get groups */
-    if ($this->GroupUserRegex == '*'){
-      $filter = "(&(objectClass=posixGroup)(cn=".$this->GroupRegex."))";
-    } else {
-      $filter= "(&(objectClass=posixGroup)(cn=".$this->GroupRegex.")(memberUid=".$this->GroupUserRegex."))";
-    }
-    if($this->SubSearch){
-      $Flags |= GL_SUBSEARCH;
-    }else{
-      $base = get_groups_ou().$base;
-    }
-
-    $res= get_list($filter, "groups", $base,$attrs, $Flags);
-  
-    /* check sizelimit */
-    if (preg_match("/size limit/i", $ldap->error)){
-      $_SESSION['limit_exceeded']= TRUE;
-    }
-
-    /* Create a list of users */
-    $this->grouplist = array();
-    foreach ($res as $value){
-      $this->grouplist[$value['gidNumber'][0]]= $value;
-    }
-
-    $tmp=array();
-    foreach($this->grouplist as $tkey => $val ){
-      $tmp[strtolower($val['cn'][0]).$val['cn'][0]]=$val;
-    }
-
-    /* Sort index */
-    ksort($tmp);
-
-    /* Recreate index array[dn]=cn[description]*/
-    $this->grouplist=array();
-    foreach($tmp as $val){
-      if(isset($val['description'])){
-        $this->grouplist[$val['dn']]=$val['cn'][0]."&nbsp;[".$val['description'][0]."]";
-      }else{
-        $this->grouplist[$val['dn']]=$val['cn'][0];
-      }
-    }
-
-    reset ($this->grouplist);
-  }
-
-
-  /* Get posts from copy & paste dialog */ 
-  function saveCopyDialog()
-  {
-    if(isset($_POST['homeDirectory'])){
-      $this->homeDirectory = $_POST['homeDirectory'];
-      if (isset ($_POST['force_ids'])){
-        $data= 1;
-        $this->gidNumber = $_POST['gidNumber'];
-        $this->uidNumber = $_POST['uidNumber'];
-      } else {
-        $data= 0;
-      }
-      if ($this->force_ids != $data){
-        $this->is_modified= TRUE;
-      }
-      $this->force_ids= $data;
-    }
-  }
-
-  /* Create the posix dialog part for copy & paste */
-  function getCopyDialog()
-  {
-    /* Skip dialog creation if this is not a valid account*/
-    if(!$this->is_account) return("");
-    if ($this->force_ids == 1){
-      $force_ids = "checked";
-      if ($_SESSION['js']){
-        $forceMode = "";
-      }
-    } else {
-      if ($_SESSION['js']){
-        if($this->acl != "#none#")
-          $forceMode ="disabled";
-      }
-      $force_ids = "";
-    }
-
-    $sta = "";
-
-    /* Open group add dialog */
-    if(isset($_POST['edit_groupmembership'])){
-      $this->group_dialog = TRUE;
-      $sta = "SubDialog";
-    }
-
-    /* If the group-add dialog is closed, call execute 
-       to ensure that the membership is updatd */
-    if(isset($_POST['add_groups_finish']) || isset($_POST['add_groups_cancel'])){
-      $this->execute();
-      $this->group_dialog =FALSE;
-    }
-
-    if($this->group_dialog){
-      $str = $this->execute(true);
-      $ret = array();
-      $ret['string'] = $str;
-      $ret['status'] = $sta;
-      return($ret);
-    }
-
-    /* If a group member should be deleted, simply call execute */
-    if(isset($_POST['delete_groupmembership'])){
-      $this->execute();
-    }
-
-    /* Assigned informations to smarty */
-    $smarty = get_smarty();
-    $smarty->assign("homeDirectory",$this->homeDirectory);
-    $smarty->assign("uidNumber",$this->uidNumber);
-    $smarty->assign("gidNumber",$this->gidNumber);
-    $smarty->assign("forceMode",$forceMode);
-    $smarty->assign("force_ids",$force_ids);
-    if (!count($this->groupMembership)){
-      $smarty->assign("groupMembership", array("&nbsp;"));
-    } else {
-      $smarty->assign("groupMembership", $this->groupMembership);
-    }
-
-    /* Display wars message if there are more than 16 group members */
-    if (count($this->groupMembership) > 16){
-      $smarty->assign("groups", "too_many_for_nfs");
-    } else {
-      $smarty->assign("groups", "");
-    }
-    $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE,dirname(__FILE__)));
-
-    $ret = array();
-    $ret['string'] = $str;
-    $ret['status'] = $sta;
-    return($ret);
-  }
-
-
-  function PrepareForCopyPaste($source)
-  {
-    plugin::PrepareForCopyPaste($source);
-
-    /* Avoid using the same gid/uid number as source user */
-    $this->savedUidNumber = $this->get_next_id("gidNumber", $this->dn);
-    $this->savedGidNumber = $this->get_next_id("uidNumber", $this->dn);
-  }
-
-
-  function multiple_execute()
-  {
-    return($this->execute());
-  }
-
-
-  static function plInfo()
-  {
-    return (array(
-          "plDescription"     => _("POSIX account"),
-          "plSelfModify"      => TRUE,
-          "plDepends"         => array("user"),
-          "plPriority"        => 2,
-          "plSection"         => array("personal" => _("My account")),
-          "plCategory"        => array("users"),
-          "plOptions"         => array(),
-
-          "plProvidedAcls"  => array(
-
-            "homeDirectory"       =>  _("Home directory"), 
-            "loginShell"          =>  _("Shell"),
-            "uidNumber"           =>  _("User ID"),
-            "gidNumber"           =>  _("Group ID"),
-
-            "mustchangepassword"=>  _("Force password change on login"),
-            "shadowMin"           =>  _("Shadow min"),
-            "shadowMax"           =>  _("Shadow max"),
-            "shadowWarning"       =>  _("Shadow warning"),
-            "shadowInactive"      =>  _("Shadow inactive"),
-            "shadowExpire"        =>  _("Shadow expire"),
-            "trustModel"          =>  _("System trust model")))
-            );
-  }
-
-  function get_multi_edit_values()
-  {
-    $ret = plugin::get_multi_edit_values();
-    return($ret);
-  }
-
-
-  function multiple_save_object()
-  {
-    if(isset($_POST['posix_mulitple_edit'])){
-      plugin::multiple_save_object();
-      foreach(array("primaryGroup") as $val){
-        if(isset($_POST["use_".$val])){
-          $this->multi_boxes[] = $val;
-        }
-      }
-
-      /* Save primary group settings */
-      if($this->acl_is_writeable("primaryGroup") && isset($_POST['primaryGroup'])){
-        $data= $_POST['primaryGroup'];
-        if ($this->primaryGroup != $data){
-          $this->is_modified= TRUE;
-        }
-        $this->primaryGroup= $_POST['primaryGroup'];
-      }
-    }
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/personal/posix/generic.tpl b/plugins/personal/posix/generic.tpl
deleted file mode 100644 (file)
index c9dc98d..0000000
+++ /dev/null
@@ -1,156 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=0 border=0>
- <tr>
-  <td style="width:50%; vertical-align:top;">
-   <h2><img class="center" alt="" align="middle" src="images/rightarrow.png" /> {t}Generic{/t}</h2>
-   <table summary="">
-    <tr>
-     <td><label for="homeDirectory">{t}Home directory{/t}</label>{$must}</td>
-     <td>
-{render acl=$homeDirectoryACL checkbox=$multiple_support checked=$use_homeDirectory}
-      <input id="homeDirectory" name="homeDirectory" size=40 maxlength=120 value="{$homeDirectory}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><label for="loginShell">{t}Shell{/t}</label></td>
-     <td>
-{render acl=$loginShellACL checkbox=$multiple_support checked=$use_loginShell}
-      <select id="loginShell" size="1" name="loginShell">
-       {html_options values=$shells output=$shells selected=$loginShell}
-      </select> 
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><label for="">{t}Primary group{/t}</label></td>
-     <td>
-{render acl=$gidNumberACL checkbox=$multiple_support checked=$use_primaryGroup}
-      <select id="primaryGroup" size="1" name="primaryGroup">
-       {html_options options=$secondaryGroups selected=$primaryGroup}
-      </select> 
-{/render}
-     </td>
-    </tr>
-{if !$multiple_support}
-    <tr>
-     <td>{t}Status{/t}</td>
-     <td>{$status}</td>
-    </tr>
-{/if}
-   </table>
-
-{if !$multiple_support}
-
-   <table summary="">
-    <tr>
-     <td>
-{render acl=$force_idsACL}
-      <input id="force_ids" type=checkbox name="force_ids" value="1" {$force_ids} onclick="changeState('uidNumber'); changeState('gidNumber');">
-{/render}
-                                       </td>
-                                       <td>
-      <label for="force_ids">{t}Force UID/GID{/t}</label>
-     </td>
-                                       <td style="width:20px;"></td>
-                                       <td>
-                                               <label for="uidNumber">{t}UID{/t}</label>
-                                       </td>
-                                       <td>
-{render acl=$uidNumberACL}
-                                               <input id="uidNumber" name="uidNumber" size=9 maxlength=9 {$forceMode} value="{$uidNumber}">
-{/render}
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td colspan="3"></td>
-                                       <td>
-                                               <label for="gidNumber">{t}GID{/t}</label>
-                                       </td>
-     <td>
-{render acl=$gidNumberACL}
-                                               <input id="gidNumber" name="gidNumber" size=9 maxlength=9 {$forceMode} value="{$gidNumber}">
-{/render}
-                                       </td>
-                               </tr>
-   </table>
-{/if}
-  </td>
-  <td style="border-left:1px solid #A0A0A0">
-    &nbsp;
-  </td>
-  <td style="vertical-align:top;">
-   <h2><img alt="" class="center" align="middle" src="images/members.png" /> {t}Group membership{/t}</h2>
-   {if $groups eq "too_many_for_nfs"}
-    <b style="color:red">{t}(Warning: more than 16 groups are not supported by NFS!){/t}</b>
-    <br>
-   {/if}
-{render acl=$groupMembershipACL}
-   <select style="width:100%; height:130px;" name="group_list[]" size=16 multiple >
-{if !$multiple_support}
-    {html_options options=$groupMembership}
-{else}
-
-       
-{/if}
-   </select>
-{/render}
-   <br>
-{render acl=$groupMembershipACL}
-   <input type=submit value="{t}Add{/t}" name="edit_groupmembership" >&nbsp;
-{/render}
-{render acl=$groupMembershipACL}
-   <input type=submit value="{t}Delete{/t}" name="delete_groupmembership" >
-{/render}
-  </td>
- </tr>
-</table>
-
-<p class="seperator">&nbsp;</p>
-
-<table summary="" style="width:100% ; vertical-align:top; text-align:left;" cellpadding=0 border=0>
- <tr>
-  <td style='width:50%;vertical-align:top'>
-   <h2><img alt="" class="center" align="middle" src="images/terminal_small.png" /> {t}Account{/t}</h2>
-   {include file="$pwmode.tpl"}
-  </td>
-  <td style="border-left:1px solid #A0A0A0">
-    &nbsp;
-  </td>
-  <td style="vertical-align:top;">
-   <h2><img alt="" class="center" align="middle" src="images/closedlock.png" /> {t}System trust{/t}</h2>
-    {t}Trust mode{/t}&nbsp;
-{render acl=$trustmodeACL}
-       <select name="trustmode" id="trustmode" size=1 onchange="changeSelectState('trustmode', 'wslist'); changeSelectState('trustmode', 'add_ws'); changeSelectState('trustmode', 'del_ws');">
-      {html_options options=$trustmodes selected=$trustmode}
-    </select>
-{/render}
-{render acl=$trustmodeACL}
-   <select style="width:100%" id="wslist" name="workstation_list[]" size=8 multiple {$trusthide}>
-    {html_options values=$workstations output=$workstations}
-       {if $emptyArrAccess}
-               <option disabled>&nbsp;</option>
-       {/if}
-   </select>
-{/render}
-   <br>
-{render acl=$trustmodeACL}
-   <input type="submit" id="add_ws" value="{t}Add{/t}" name="add_ws" {$trusthide}>&nbsp;
-{/render}
-{render acl=$trustmodeACL}
-   <input type="submit" id="del_ws" value="{t}Delete{/t}" name="delete_ws" {$trusthide}>
-{/render}
-  </td>
- </tr>
-</table>
-{if $multiple_support}
-       <input type="hidden" name="posix_mulitple_edit" value="1">
-{/if}
-
-<input type="hidden" name="posixTab" value="posixTab">
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('homeDirectory');
-  -->
-</script>
diff --git a/plugins/personal/posix/main.inc b/plugins/personal/posix/main.inc
deleted file mode 100644 (file)
index 31994ef..0000000
+++ /dev/null
@@ -1,133 +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
- */
-
-/* Clear display */
-$display  = "";
-$lock_msg = "";
-if (!$remove_lock){
-
-  /* Reset requested? */
-  if (isset($_POST['edit_cancel']) ||  (isset($_GET['reset']) && $_GET['reset'] == 1)){
-    del_lock ($ui->dn);
-    sess_del ('edit');
-    sess_del ('posixAccount');
-  }
-
-  /* Create posixAccount object on demand */
-  if (!isset($_SESSION['posixAccount']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
-    $_SESSION['posixAccount']= new posixAccount ($config, $ui->dn);
-    $_SESSION['posixAccount']->enable_CSN_check();
-    $_SESSION['posixAccount']->set_acl_base($ui->dn);
-    $_SESSION['posixAccount']->set_acl_category("users");
-  }
-  $posixAccount= $_SESSION['posixAccount'];
-
-  /* save changes back to object */
-  if (isset ($_SESSION['edit'])){
-    $posixAccount->save_object ();
-  }
-
-  /* Enter edit mode? */
-  if ((isset($_POST['edit'])) && (!isset($_SESSION['edit']))){
-    
-    /* Check locking */
-    if (($username= get_lock($ui->dn)) != ""){
-      $_SESSION['back_plugin']= $plug;
-      $_SESSION['LOCK_VARS_TO_USE'] = array("/^edit$/","/^plug$/");
-      $lock_msg =  gen_locked_message ($username, $ui->dn);
-
-    }else{
-
-      /* Lock the current entry */
-      add_lock ($ui->dn, $ui->dn);
-      $_SESSION['dn']= $ui->dn;
-      $_SESSION['edit']= TRUE;
-    }
-  }
-
-  /* save changes to LDAP and disable edit mode */
-  $info= "";
-  if (isset($_POST['edit_finish'])){
-
-    /* Perform checks */
-    $message= $posixAccount->check ();
-
-    /* No errors, save object */
-    if (count ($message) == 0){
-      $posixAccount->save ();
-      del_lock ($ui->dn);
-      sess_del ('edit');
-
-      /* Remove from session */
-      sess_del ('posixAccount');
-    } else {
-      /* Errors found, show message */
-      show_errors ($message);
-    }
-  }
-
-  /* Execute formular */
-  if($lock_msg){
-    $display = $lock_msg;
-  }else{
-    $display.= $posixAccount->execute ();
-  }
-
-  /* Store changes  in session */
-  if (isset ($_SESSION['edit'])){
-    $_SESSION['posixAccount']= $posixAccount;
-  }
-
-  /* Show page footer depending on the mode */
-  if (!$posixAccount->group_dialog && !$posixAccount->show_ws_dialog && $posixAccount->is_account && empty($lock_msg)){
-
-    $display.= "<p class=\"plugbottom\">";
-
-    /* Are we in edit mode? */
-    if (isset($_SESSION['edit'])){
-      $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
-      $display.= "&nbsp;";
-      $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
-      $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png').
-             "\"> ".$ui->dn."&nbsp;";
-    } else {
-      $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/openlock.png').
-             "\"> ".$ui->dn."&nbsp;";
-
-      /* Only display edit button if there is at least one attribute editable */
-      if(preg_match("/w/",$ui->get_permissions($ui->dn,"users/posixAccount"))){
-        $info.= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/lamp.png')."\"> ".
-          _("Click the 'Edit' button below to change informations in this dialog");
-
-        $display.= "<input type=submit name=\"edit\" value=\""._("Edit")."\">\n";
-      }
-      $display.= "<input type=\"hidden\" name=\"ignore\">\n";
-    }
-    $display.= "</p>\n";
-  }
-
-  /* Page header*/
-  $display= print_header(get_template_path('images/posix.png'),
-                         _("Unix settings"), $info).$display;
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/personal/posix/paste_generic.tpl b/plugins/personal/posix/paste_generic.tpl
deleted file mode 100644 (file)
index b08feb5..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-<table width='100%'>
-       <tr>
-               <td style='vertical-align:top;'>
-                       <h2>{t}Posix settings{/t}</h2>
-                       <table>
-                               <tr>
-                                       <td>
-                                               <label for="homeDirectory">{t}Home directory{/t}</label>
-                                       </td>
-                                       <td>
-                                               <input id="homeDirectory" name="homeDirectory" size=40 maxlength=120 value="{$homeDirectory}">
-                                       </td>
-                               </tr>
-                       </table>
-                       <table style='width:100%;'>
-                               <tr>
-                                       <td>
-                                               <input id="force_ids" type=checkbox name="force_ids" value="1"  {$force_ids}
-                                                                onclick="changeState('uidNumber');changeState('gidNumber');">
-                                       </td>
-                                       <td>
-                                               <label for="force_ids">
-                                               {t}Force UID/GID{/t}
-                                               </label>
-                                       </td>
-                                       <td>&nbsp;</td>
-                                       <td>
-                                               <label for="uidNumber">{t}UID{/t}</label>
-                                       </td>
-                                       <td>
-                                               <input id="uidNumber" name="uidNumber" size=9 maxlength=9 {$forceMode} value="{$uidNumber}">
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td colspan="3">&nbsp;</td>
-                                       <td>
-                                               <label for="gidNumber">{t}GID{/t}</label>
-                                       </td>
-                                       <td>
-                                               <input id="gidNumber" name="gidNumber" size=9 maxlength=9 {$forceMode} value="{$gidNumber}">
-                                       </td>
-                               </tr>
-                       </table>
-                       <table width="50%">
-                               <tr>
-                                       <td style="vertical-align:top;" colspan="4">
-                                               <h2><img alt="" class="center" align="middle" src="images/members.png" /> {t}Group membership{/t}</h2>
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td style="vertical-align:top;" colspan="4">
-                                               
-                                               {if $groups eq "too_many_for_nfs"}
-                                                       <b style="color:red">{t}(Warning: more than 16 groups are not supported by NFS!){/t}</b>
-                                                       <br>
-                                               {/if}
-                                               <select style="width:100%; height:130px;" name="group_list[]" size=16 multiple>
-                                                       {html_options options=$groupMembership}
-                                               </select>
-                                               <br>
-                                               <input type=submit value="{t}Add{/t}" name="edit_groupmembership">&nbsp;
-                                               <input type=submit value="{t}Delete{/t}" name="delete_groupmembership">
-                                       </td>
-                               </tr>
-                       </table>
-               </td>
-       </tr>
-</table>
-<br>
-<br>
diff --git a/plugins/personal/posix/posix_groups.tpl b/plugins/personal/posix/posix_groups.tpl
deleted file mode 100644 (file)
index 841d8a8..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
-       <tr>
-               <td style="vertical-align:top;">
-                       <div class="contentboxh" style="height:20px;">
-                       <p class="contentboxh" style="font-size:12px">
-                               <b>{t}Select groups to add{/t} {$hint}</b>
-                               </p>
-                       </div>
-                       <div class="contentboxb" style="">
-                       <p class="contentboxb" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-                                       <select style="width:100%; height:430px; margin-top:4px;" name="groups[]" size="15" multiple>
-                                               {html_options options=$groups}
-                                       </select>
-                               <input type=hidden name="edit_helper">
-                       </p>
-                       </div>
-               </td>
-               <td style="vertical-align:top; width:400px;">
-                       <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" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-                       <table summary="" style="width:100%;">
-                               {$alphabet}
-                       </table>
-
-                               <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-                                       <tr>
-                                               <td width="50%">
-                                                       <img alt="" src="{$tree_image}" align=middle>&nbsp;{t}Display groups of department{/t}
-                                               </td>
-                                               <td>
-                                                       <select name="depselect" size=1 onChange="mainform.submit()" title="{t}Choose the department the search will be based on{/t}">
-                                                         {html_options options=$deplist selected=$depselect}
-                                                       </select>
-                                               </td>
-                                       </tr>
-                               </table>
-                               <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-                                       <tr>
-                                               <td width="50%">
-                                                       <img alt="" src="{$search_image}" align=middle>&nbsp;{t}Display groups matching{/t}
-                                               </td>
-                                               <td>
-                                                       <input type='text' name='regex' maxlength='20' value='{$regex}' 
-                                                               title='{t}Regular expression for matching group names{/t}' onChange="mainform.submit()">
-                                               </td>
-                                       </tr>
-                               </table>
-                               <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-                                       <tr>
-                                               <td width="50%">
-                                                       <img alt="" src="{$search_image}" align=middle>&nbsp;{t}Display groups of user{/t}
-                                               </td>
-                                               <td>
-                                                       <input type='text' name='guser' maxlength='20' value='{$guser}' 
-                                                               title='{t}User name of which groups are shown{/t}' onChange="mainform.submit()">
-                                               </td>
-                                       </tr>
-                               </table>
-                               <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-                    <tr>
-                                               <td>
-                                                       <input type="checkbox" name="SubSearch" value="1" {$SubSearchCHK}
-                                                               onClick="mainform.submit();">
-                                                       {t}Search in subtrees{/t}
-                                               </td>
-                                       </tr>
-                </table>
-                          {$apply}
-                       </div>
-               </td>
-       </tr>
-</table>
-<input type="hidden" value="1" name="PosixGroupDialogPosted">
-<p class="plugbottom">
-  <input type=submit name="add_groups_finish" value="{t}Add{/t}">
-  &nbsp;
-  <input type=submit name="add_groups_cancel" value="{t}Cancel{/t}">
-</p>
-
diff --git a/plugins/personal/posix/posix_shadow.tpl b/plugins/personal/posix/posix_shadow.tpl
deleted file mode 100644 (file)
index bd7862c..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=0 border=0>
- <tr>
-  <td style="width:50%; vertical-align:top;">
-
-<!-- must_change_password  -->
-{render acl=$mustchangepasswordACL}
-   <input type=checkbox name="mustchangepassword" value="1" {$mustchangepassword}>
-{/render}
-   {t}User must change password on first login{/t}
-   <br>
-
-<!-- shadowMin -->
-{render acl=$shadowMinACL}
-   <input type=checkbox name="use_shadowMin" value="1" {$use_shadowMin}>
-{/render}
-{render acl=$shadowMinACL}
-   {$shadowmins}
-{/render}
-   <br>
-
-<!-- use_shadowMax -->
-{render acl=$shadowMaxACL}
-   <input type=checkbox name="use_shadowMax" value="1" {$use_shadowMax}>
-{/render}
-{render acl=$shadowMaxACL}
-   {$shadowmaxs}
-{/render}
-   <br>
-
-<!-- use_shadowExpire -->
-{render acl=$shadowExpireACL}
-   <input type=checkbox name="use_shadowExpire" value="1" {$use_shadowExpire}>
-{/render}
-   {t}Password expires on{/t}
-{render acl=$shadowExpireACL}
-   <select name=day onChange="createResult(this.form,this.form.shadowExpire);">
-    {html_options values=$days output=$days selected=$day}
-   </select>
-{/render}
-{render acl=$shadowExpireACL}
-   <select name=month onChange="populate(this.form,this.form.shadowExpire);">
-    {html_options options=$months selected=$month}
-   </select>
-{/render}
-{render acl=$shadowExpireACL}
-   <select name=year onChange="populate(this.form,this.form.shadowExpire);">
-    {html_options values=$years output=$years selected=$year}
-   </select>
-   <input type="hidden" name="shadowExpire" value="{$shadowExpire}">
-{/render}
-   <br>
-
-<!-- shadowInactive -->
-{render acl=$shadowInactiveACL}
-   <input type=checkbox name="use_shadowInactive" value="1" {$use_shadowInactive}>
-{/render}
-{render acl=$shadowInactiveACL}
-   {$shadowinactives}
-{/render}
-   <br>
-
-<!-- use_shadowWarning -->
-{render acl=$shadowWarningACL}
-   <input type=checkbox name="use_shadowWarning" value="1" {$use_shadowWarning}>
-{/render}
-{render acl=$shadowWarningACL}
-   {$shadowwarnings}
-{/render}
-  </td>
- </tr>
-</table>
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!--
-  // Populate expiery dialog
-  populate(document.mainform,document.mainform.shadowExpire);
-  -->
-</script>
diff --git a/plugins/personal/posix/trust_machines.tpl b/plugins/personal/posix/trust_machines.tpl
deleted file mode 100644 (file)
index 3550fcf..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
-<tr>
-  <td style="vertical-align:top;">
-   <div class="contentboxh" style="height:20px;">
-    <p class="contentboxh" style="font-size:12px">
-     <b>{t}Select systems to add{/t} {$hint}</b><br>
-    </p>
-   </div>
-   <div class="contentboxb">
-    <p class="contentboxb" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-     <select style="width:600px; margin-top:4px; height:450px;" name="wslist[]" size="15" multiple>
-       {html_options values=$wslist output=$wslist}
-     </select>
-    </p>
-   </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" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-     <table summary="" style="width:100%;">
-      {$alphabet}
-     </table>
-    <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8"><tr><td width="50%"><img alt="" src="{$tree_image}" align=middle>&nbsp;{t}Display systems of department{/t}</td>
-    <td><select name="depselect" size=1 onChange="mainform.submit()" title="{t}Choose the department the search will be based on{/t}">
-      {html_options options=$deplist selected=$depselect}
-    </select></td></tr></table>
-    <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8"><tr><td width="50%"><img alt="" src="{$search_image}" align=middle>&nbsp;{t}Display systems matching{/t}</td>
-    <td><input type='text' name='regex' maxlength='20' value='{$regex}' title='{t}Regular expression for matching addresses{/t}' onChange="mainform.submit()"></td></tr></table>
-   {$apply}
-   </div>
-  </td>
-</tr>
-</table>
-
-<p class="plugbottom">
-  <input type=submit name="add_ws_finish" value="{t}Add{/t}">
-  &nbsp;
-  <input type=submit name="add_ws_cancel" value="{t}Cancel{/t}">
-</p>
diff --git a/plugins/personal/samba/class_sambaAccount.inc b/plugins/personal/samba/class_sambaAccount.inc
deleted file mode 100644 (file)
index bd71c8f..0000000
+++ /dev/null
@@ -1,1142 +0,0 @@
-<?php
-/*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2004-2005 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 sambaAccount extends plugin
-{
-  /* Definitions */
-  var $plHeadline= "Samba";
-  var $plDescription= "This does something";
-  var $view_logged = FALSE;
-
-  /* CLI vars */
-  var $cli_summary= "Manage users samba account";
-  var $cli_description= "Some longer text\nfor help";
-  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* Switch for Samba version */
-  var $samba3= FALSE;
-  var $uidNumber= 65535;
-  var $gidNumber= 65535;
-
-  /* Samba 2 attributes */
-  var $pwdLastSet= "0";
-  var $logonTime= "0";
-  var $logoffTime= "2147483647";
-  var $kickoffTime= "2147483647";
-  var $pwdCanChange= "0";
-  var $pwdMustChange= "0";
-  var $password_expires= 0;
-  var $acctFlags= "[UX        ]";
-  var $smbHome= "";
-  var $homeDrive= "";
-  var $scriptPath= "";
-  var $profilePath= "";
-  var $rid= "";
-  var $primaryGroupID= "";
-
-  /* Samba 3 attributes */
-  var $SID= "";
-  var $ridBase= 0;
-  var $sambaSID= "";
-  var $sambaPwdLastSet= "0";
-  var $sambaLogonTime= "0";
-  var $sambaLogoffTime= "2147483647";
-  var $sambaKickoffTime= "2147483647";
-  var $sambaPwdCanChange= "";
-  var $sambaPwdMustChange= "0";
-  var $sambaAcctFlags= "[UX        ]";
-  var $sambaHomePath= "";
-  var $sambaHomeDrive= "";
-  var $sambaLogonScript= "";
-  var $sambaProfilePath= "";
-  var $sambaPrimaryGroupSID= "";
-  var $sambaDomainName= "";
-  var $sambaUserWorkstations= "";
-  var $sambaBadPasswordCount= "";
-  var $sambaBadPasswordTime= "";
-  var $sambaPasswordHistory= "";
-  var $sambaLogonHours= "";
-  var $orig_sambaDomainName= "";
-  var $sambaMungedDial= "";
-  var $mungedObject;
-
-  /* Helper */
-  var $show_ws_dialog= FALSE;
-  var $logon_time_set= 0;
-  var $logoff_time_set= 0;
-  var $kickoff_time_set= 0;
-
-  /* attribute list for save action */
-  var $ctxattributes= array();
-  var $attributes= array();
-  var $objectclasses= array();
-  
-  var $uid= "";
-  var $CopyPasteVars = array("kickoff_time_set","logoff_time_set","logon_time_set","mungedObject","orig_sambaDomainName");
-
-  function sambaAccount (&$config, $dn= NULL)
-  {
-    /* Load attributes depending on the samba version */
-    $this->samba3= ($config->current['SAMBAVERSION'] == 3);
-
-    if ($this->samba3){
-      $this->attributes= array ("sambaSID", "sambaPwdLastSet", "sambaLogonTime",
-          "sambaLogoffTime", "sambaKickoffTime", "sambaPwdCanChange",
-          "sambaPwdMustChange", "sambaAcctFlags", "uid", "sambaMungedDial",
-          "sambaHomePath", "sambaHomeDrive", "sambaLogonScript",
-          "sambaProfilePath", "sambaPrimaryGroupSID", "sambaDomainName",
-          "sambaUserWorkstations", "sambaPasswordHistory",
-          "sambaLogonHours", "sambaBadPasswordTime",
-          "sambaBadPasswordCount");
-      $this->objectclasses= array ("sambaSamAccount");
-      $this->mungedObject= new sambaMungedDial;
-      $this->ctxattributes= $this->mungedObject->ctxattributes;
-    } else {
-      $this->attributes= array ("pwdLastSet", "logonTime", "logoffTime", "kickoffTime",
-          "pwdCanChange", "pwdMustChange", "acctFlags", "profilePath", "uid",
-          "smbHome", "homeDrive", "scriptPath", "rid", "primaryGroupID");
-      $this->objectclasses= array ("sambaAccount");
-    }
-
-    plugin::plugin ($config, $dn);
-
-    /* Setting uid to default */
-    if(isset($this->attrs['uid'][0])){
-      $this->uid = $this->attrs['uid'][0];
-    }
-
-    /* Get samba Domain in case of samba 3 */
-    if ($this->samba3 && $this->sambaSID != ""){
-      $this->SID= preg_replace ("/-[^-]+$/", "", $this->sambaSID);
-      $ldap= $this->config->get_ldap_link();
-      $ldap->cd($this->config->current['BASE']);
-      $ldap->search ("(&(objectClass=sambaDomain)(sambaSID=$this->SID))",array("sambaAlgorithmicRidBase","sambaDomainName"));
-      if ($ldap->count() != 0){
-        $attrs= $ldap->fetch();
-        $this->ridBase= $attrs['sambaAlgorithmicRidBase'][0];
-        if ($this->sambaDomainName == ""){
-          $this->sambaDomainName= $attrs['sambaDomainName'][0];
-        }
-      } else {
-        if ($this->sambaDomainName == ""){
-          $this->sambaDomainName= "DEFAULT";
-        }
-        $this->ridBase= $this->config->current['RIDBASE'];
-        $this->SID= $this->config->current['SID'];
-      }
-
-      /* Save in order to compare later on */
-      $this->orig_sambaDomainName= $this->sambaDomainName;
-    }
-
-    /* Fill mungedDial field */
-    if ($this->samba3 && isset($this->attrs['sambaMungedDial'])){
-      $this->mungedObject->load($this->sambaMungedDial);
-    }
-
-    /* Password expiery */
-    if(isset($this->attrs['sambaPwdMustChange']) &&
-        $this->attrs['sambaPwdMustChange'][0] != 0){
-      $this->password_expires= 1;
-    }
-
-    if(isset($this->attrs['sambaLogonTime']) && ! (
-        $this->attrs['sambaLogonTime'][0] == 0 ||
-        $this->attrs['sambaLogonTime'][0] == 2147483647
-      )){
-      $this->logon_time_set= 1;
-    }
-    if(isset($this->attrs['sambaLogoffTime']) && ! (
-        $this->attrs['sambaLogoffTime'][0] == 0 ||
-        $this->attrs['sambaLogoffTime'][0] == 2147483647
-      )){
-      $this->logoff_time_set= 1;
-    }
-    
-    /* Account expiery */
-    if(isset($this->attrs['sambaKickoffTime']) && ! (
-        $this->attrs['sambaKickoffTime'][0] == 0 ||
-        $this->attrs['sambaKickoffTime'][0] == 2147483647
-      )){
-      $this->kickoff_time_set= 1;
-    }
-
-    /* Get global filter config */
-    if (!is_global("sambafilter")){
-      $ui= get_userinfo();
-      $base= get_base_from_people($ui->dn);
-      $sambafilter= array( "depselect" => $base, "regex" => "*");
-      register_global("sambafilter", $sambafilter);
-    }
-
-    /* Save initial account state */
-    $this->initially_was_account= $this->is_account;
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* Log view */
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","users/".get_class($this),$this->dn);
-    }
-
-    /* Do we need to flip is_account state? */
-    if (isset($_POST['modify_state'])){
-      $this->is_account= !$this->is_account;
-    }
-    /* Do we represent a valid account? */
-    if (!$this->is_account && $this->parent === NULL){
-      $display= "<img alt=\"\"src=\"images/stop.png\" align=\"middle\">&nbsp;<b>".
-        _("This account has no samba extensions.")."</b>";
-      $display.= back_to_main();
-      return ($display);
-    }
-
-    /* Show tab dialog headers */
-    $display= "";
-    if ($this->parent !== NULL){
-      if ($this->is_account){
-        $display= $this->show_disable_header(_("Remove samba account"),
-            _("This account has samba features enabled. You can disable them by clicking below."));
-      } else {
-        $obj= $this->parent->by_object['posixAccount'];
-
-        /* Samba3 dependency on posix accounts are enabled
-           in the moment, because I need to rely on unique
-           uidNumbers. There'll be a better solution later
-           on. */
-        if ($obj->is_account){
-
-          $display= $this->show_enable_header(_("Create samba account"),
-              _("This account has samba features disabled. You can enable them by clicking below."));
-        } else {
-          $display= $this->show_enable_header(_("Create samba account"),
-              _("This account has samba features disabled. Posix features are needed for samba accounts, enable them first."), TRUE);
-        }
-        return ($display);
-      }
-    }
-
-    $SkipWrite = (!isset($this->parent) || !$this->parent) && !isset($_SESSION['edit']);
-
-    /* Open Samaba Logong hours dialog */
-    if(isset($_POST['SetSambaLogonHours']) && $this->samba3 && $this->acl_is_writeable("sambaLogonHours")){
-      $this->dialog = new sambaLogonHours($this->config,$this->dn,$this->sambaLogonHours);
-    }
-
-    /* Cancel dialog */
-    if(isset($_POST['cancel_logonHours'])){
-      $this->dialog = FALSE;
-    }
-
-    /* Save selected logon hours */
-    if(isset($_POST['save_logonHours'])){
-      $this->dialog->save_object();
-      if($this->acl_is_writeable("sambaLogonHours")){
-        $this->sambaLogonHours = $this->dialog->save();
-      }
-      $this->dialog = FALSE;
-    }
-
-    /* Display dialog */
-    if((isset($this->dialog)) && (is_object($this->dialog))){
-      $this->dialog->save_object();
-      return($this->dialog->execute());
-    }
-
-
-    /* Prepare templating */
-    $smarty= get_smarty();
-
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $var => $rest){
-      $smarty->assign($var."ACL",$this->getacl($var,$SkipWrite));
-    }
-
-    if ($this->sambaPwdMustChange=="0"){
-      $date= getdate();
-    } else {
-      $date= getdate($this->sambaPwdMustChange);
-    }
-
-    if ($this->sambaLogonTime=="2147483647" || $this->sambaLogonTime=="0"){
-      $sambaLogonTime_date= getdate();
-    } else {
-      $sambaLogonTime_date= getdate($this->sambaLogonTime);
-    }
-    
-    if ($this->sambaLogoffTime=="2147483647" || $this->sambaLogoffTime=="0"){
-      $sambaLogoffTime_date= getdate();
-    } else {
-      $sambaLogoffTime_date= getdate($this->sambaLogoffTime);
-    }
-    
-    if ($this->sambaKickoffTime=="2147483647" || $this->sambaKickoffTime=="0"){
-      $sambaKickoffTime_date= getdate();
-    } else {
-      $sambaKickoffTime_date= getdate($this->sambaKickoffTime);
-    }
-
-    /* Remove user workstations? */
-    if (isset($_POST["delete_ws"]) && isset($_POST['workstation_list'])){
-
-      if($this->acl_is_writeable("sambaUserWorkstations",$SkipWrite)){
-
-        $tmp= $this->sambaUserWorkstations;
-        foreach($_POST['workstation_list'] as $name){
-          $tmp= preg_replace("/$name/", '', $tmp);
-          $this->is_modified= TRUE;
-        }
-        $tmp= preg_replace('/,+/', ',', $tmp);
-        $this->sambaUserWorkstations= trim($tmp, ',');
-      }
-    }
-
-    /* Add user workstation? */
-    if (isset($_POST["add_ws"])){
-      if($this->acl_is_writeable("sambaUserWorkstations",$SkipWrite)){
-        $this->show_ws_dialog= TRUE;
-        $this->dialog= TRUE;
-      }
-    }
-
-    /* Add user workstation finished? */
-    if (isset($_POST["add_ws_finish"]) || isset($_POST["add_ws_cancel"])){
-      $this->show_ws_dialog= FALSE;
-      $this->dialog= FALSE;
-    }
-
-    /* Add user workstation? */
-    if (isset($_POST["add_ws_finish"]) && isset($_POST['wslist'])){
-      $tmp= $this->sambaUserWorkstations;
-      foreach($_POST['wslist'] as $ws){
-        $tmp.= ",$ws";
-      }
-      $tmp= preg_replace('/,+/', ',', $tmp);
-      $this->sambaUserWorkstations= trim($tmp, ',');
-      $this->is_modified= TRUE;
-    }
-
-    /* Show ws dialog */
-    if ($this->show_ws_dialog){
-
-      /* Save data */
-      $sambafilter= get_global("sambafilter");
-      foreach( array("depselect", "regex") as $type){
-        if (isset($_POST[$type])){
-          $sambafilter[$type]= $_POST[$type];
-        }
-      }
-      if (isset($_GET['search'])){
-        $s= mb_substr($_GET['search'], 0, 1, "UTF8")."*";
-        if ($s == "**"){
-          $s= "*";
-        }
-        $sambafilter['regex']= $s;
-      }
-      register_global("sambafilter", $sambafilter);
-
-      /* Get workstation list */
-      $exclude= "";
-      foreach(split(',', $this->sambaUserWorkstations) as $ws){
-        $exclude.= "(cn=$ws$)";
-      }
-      if ($exclude != ""){
-        $exclude= "(!(|$exclude))";
-      }
-      $regex= $sambafilter['regex'];
-      $filter= "(&(objectClass=sambaSAMAccount)$exclude(uid=*$)(|(uid=$regex)(cn=$regex)))";
-      $res= get_list($filter, "winworkstation", $sambafilter['depselect'], array("uid"), GL_SUBSEARCH | GL_SIZELIMIT);
-        
-      $wslist= array();
-      foreach ($res as $attrs){
-        $wslist[]= preg_replace('/\$/', '', $attrs['uid'][0]);
-      }
-      asort($wslist);
-
-      $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("deplist", $this->config->idepartments);
-      $smarty->assign("alphabet", generate_alphabet());
-      foreach( array("depselect", "regex") as $type){
-        $smarty->assign("$type", $sambafilter[$type]);
-      }
-      $smarty->assign("hint", print_sizelimit_warning());
-      $smarty->assign("wslist", $wslist);
-      $smarty->assign("apply", apply_filter());
-      $display= $smarty->fetch (get_template_path('samba3_workstations.tpl', TRUE,
-                                dirname(__FILE__)));
-      return ($display);
-    }
-
-    /* Fill calendar */
-    $days= array();
-    for($d= 1; $d<32; $d++){
-      $days[]= $d;
-    }
-    $years= array();
-    for($y= $date['year']-4; $y<$date['year']+4; $y++){
-      $years[]= $y;
-    }
-    $months= array(_("January"), _("February"), _("March"), _("April"),
-        _("May"), _("June"), _("July"), _("August"), _("September"),
-        _("October"), _("November"), _("December"));
-    $smarty->assign("day", $date["mday"]);
-    $smarty->assign("days", $days);
-    $smarty->assign("months", $months);
-    $smarty->assign("month", $date["mon"]-1);
-    $smarty->assign("years", $years);
-    $smarty->assign("year", $date["year"]);
-    
-    $sambaLogonTime_days= array();
-    for($d= 1; $d<32; $d++){
-      $sambaLogonTime_days[]= $d;
-    }
-    $sambaLogonTime_years= array();
-    for($y= $date['year']-4; $y<$date['year']+4; $y++){
-      $sambaLogonTime_years[]= $y;
-    }
-    $sambaLogonTime_months= array(_("January"), _("February"), _("March"), _("April"),
-        _("May"), _("June"), _("July"), _("August"), _("September"),
-        _("October"), _("November"), _("December"));
-    $smarty->assign("sambaLogonTime_day", $sambaLogonTime_date["mday"]);
-    $smarty->assign("sambaLogonTime_days", $sambaLogonTime_days);
-    $smarty->assign("sambaLogonTime_months", $sambaLogonTime_months);
-    $smarty->assign("sambaLogonTime_month", $sambaLogonTime_date["mon"]-1);
-    $smarty->assign("sambaLogonTime_years", $sambaLogonTime_years);
-    $smarty->assign("sambaLogonTime_year", $sambaLogonTime_date["year"]);
-    
-    $sambaLogoffTime_days= array();
-    for($d= 1; $d<32; $d++){
-      $sambaLogoffTime_days[]= $d;
-    }
-    $sambaLogoffTime_years= array();
-    for($y= $date['year']-4; $y<$date['year']+4; $y++){
-      $sambaLogoffTime_years[]= $y;
-    }
-    $sambaLogoffTime_months= array(_("January"), _("February"), _("March"), _("April"),
-        _("May"), _("June"), _("July"), _("August"), _("September"),
-        _("October"), _("November"), _("December"));
-    $smarty->assign("sambaLogoffTime_day", $sambaLogoffTime_date["mday"]);
-    $smarty->assign("sambaLogoffTime_days", $sambaLogoffTime_days);
-    $smarty->assign("sambaLogoffTime_months", $sambaLogoffTime_months);
-    $smarty->assign("sambaLogoffTime_month", $sambaLogoffTime_date["mon"]-1);
-    $smarty->assign("sambaLogoffTime_years", $sambaLogoffTime_years);
-    $smarty->assign("sambaLogoffTime_year", $sambaLogoffTime_date["year"]);
-    
-    $sambaKickoffTime_days= array();
-    for($d= 1; $d<32; $d++){
-      $sambaKickoffTime_days[]= $d;
-    }
-    $sambaKickoffTime_years= array();
-    for($y= $date['year']-4; $y<$date['year']+4; $y++){
-      $sambaKickoffTime_years[]= $y;
-    }
-    $sambaKickoffTime_months= array(_("January"), _("February"), _("March"), _("April"),
-        _("May"), _("June"), _("July"), _("August"), _("September"),
-        _("October"), _("November"), _("December"));
-    //$smarty->assign("sambaKickoffTime_day", $sambaKickoffTime_date["mday"]-1);
-    $smarty->assign("sambaKickoffTime_day", $sambaKickoffTime_date["mday"]); // hickert
-    $smarty->assign("sambaKickoffTime_days", $sambaKickoffTime_days);
-    $smarty->assign("sambaKickoffTime_months", $sambaKickoffTime_months);
-    $smarty->assign("sambaKickoffTime_month", $sambaKickoffTime_date["mon"]-1);
-    $smarty->assign("sambaKickoffTime_years", $sambaKickoffTime_years);
-    $smarty->assign("sambaKickoffTime_year", $sambaKickoffTime_date["year"]);
-     
-    /* Fill boxes */
-    if ($this->samba3){
-      $domains= array();
-      foreach($this->config->data['SERVERS']['SAMBA'] as $name => $content){
-        $domains[]= $name;
-      }
-      $smarty->assign("domains", $domains);
-    }
-    $letters= array();
-    for ($i= 68; $i<91; $i++){
-      $letters[]= chr($i).":";
-    }
-    $smarty->assign("drives", $letters);
-
-    /* Fill terminal server settings */
-    if ($this->samba3){
-      foreach ($this->ctxattributes as $attr){
-        /* Fill common attributes */
-        if (isset($this->mungedObject->ctx[$attr])){
-          $smarty->assign("$attr", $this->mungedObject->ctx[$attr]);
-          // Set field  to blank if value is 0
-          if(in_array($attr, array("CtxMaxConnectionTime", "CtxMaxDisconnectionTime", "CtxMaxIdleTime"))) {
-            if($this->mungedObject->ctx[$attr] == 0) {
-              $smarty->assign("$attr", "");
-            }
-          }
-        } else {
-          $smarty->assign("$attr", "");
-        }
-      }
-
-      /* Assign enum values for preset items */
-      $shadowModeVals= array( "0" => _("disabled"),
-          "1" => _("input on, notify on"),
-          "2" => _("input on, notify off"),
-          "3" => _("input off, notify on"),
-          "4" => _("input off, nofify off"));
-
-      $brokenConnModeVals= array(      "0" => _("disconnect"),
-          "1" => _("reset"));
-
-      $reConnModeVals= array( "0" => _("from any client"),
-          "1" => _("from previous client only"));
-
-      /* Fill preset items */
-      $smarty->assign("shadow", $shadowModeVals);
-      $smarty->assign("brokenconn", $brokenConnModeVals);
-      $smarty->assign("reconn", $reConnModeVals);
-
-      /* Fill preset items with values */
-      $smarty->assign("shadowmode", $this->mungedObject->getShadow());
-      $smarty->assign("brokenconnmode", $this->mungedObject->getBrokenConn());
-      $smarty->assign("reconnmode", $this->mungedObject->getReConn());
-
-      if($_SESSION['js']){
-        /* Set form elements to disabled/enable state */
-        $smarty->assign("tsloginstate", $this->mungedObject->getTsLogin()?"":"disabled");
-
-        $smarty->assign("inheritstate", "");
-        if($this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite)){
-          $smarty->assign("inheritstate", $this->mungedObject->getInheritMode()?"disabled":"");
-        }
-  
-
-  
-      }else{
-        $smarty->assign("tsloginstate", "");
-        $smarty->assign("inheritstate", "");
-      }      
-
-      /* Set checkboxes to checked or unchecked state */
-      $smarty->assign("tslogin", $this->mungedObject->getTsLogin()?"checked":"");
-      $smarty->assign("inherit", $this->mungedObject->getInheritMode()?"checked":"");
-      $smarty->assign("connectclientdrives",
-                      $this->mungedObject->getConnectClientDrives()?"checked":"");
-      $smarty->assign("connectclientprinters",
-                      $this->mungedObject->getConnectClientPrinters()?"checked":"");
-      $smarty->assign("defaultprinter",
-                      $this->mungedObject->getDefaultPrinter()?"checked":"");
-      $smarty->assign("CtxMaxConnectionTimeF",
-                      $this->mungedObject->getCtxMaxConnectionTimeF()?"checked":"");
-      $smarty->assign("CtxMaxDisconnectionTimeF",
-                      $this->mungedObject->getCtxMaxDisconnectionTimeF()?"checked":"");
-      $smarty->assign("CtxMaxIdleTimeF",
-                      $this->mungedObject->getCtxMaxIdleTimeF()?"checked":"");
-
-      /* Fill sambaUserWorkstations */
-      $ws= split(",", $this->sambaUserWorkstations);
-      sort($ws);
-      
-      /* Tidy checks for empty option, and smarty will produce one if array[0]="" */
-      if(($ws[0]=="")&&(count($ws)==1)) $ws=array();
-
-
-      $smarty->assign("workstations", $ws);
-    }
-
-    /* Variables */
-    foreach($this->attributes as $val){
-      $smarty->assign("$val", $this->$val);
-    }
-
-    /* 'sambaAcctFlags' checkboxes */
-    /* Check for 'lock-account'-flag: 'D' or 'L' */
-    if (is_integer(strpos($this->sambaAcctFlags, "D")) ||
-        is_integer(strpos($this->sambaAcctFlags, "L"))) {
-        $smarty->assign("flagsD", "checked");
-    } else {
-        $smarty->assign("flagsD", "");
-    }
-    
-    /* Check for no_password_required flag 'N' */
-    if (is_integer(strpos($this->sambaAcctFlags, "N"))) {
-        $smarty->assign("flagsN", "checked");
-    } else {
-        $smarty->assign("flagsN", "");
-    }
-
-    if($this->samba3){
-      if ($this->sambaPwdCanChange=="1"){
-        $smarty->assign("flagsP", "checked");
-      } else {
-        $smarty->assign("flagsP", "");
-      }
-    }else{
-      if ($this->pwdCanChange=="1"){
-        $smarty->assign("flagsP", "checked");
-      } else {
-        $smarty->assign("flagsP", "");
-      }
-    }
-
-    if ($this->password_expires=="1"){
-      $smarty->assign("flagsC", "checked");
-    } else {
-      $smarty->assign("flagsC", "");
-    }
-    if ($this->logon_time_set=="1"){
-      $smarty->assign("flagsT", "checked");
-    } else {
-      $smarty->assign("flagsT", "");
-    }
-    if ($this->logoff_time_set=="1"){
-      $smarty->assign("flagsO", "checked");
-    } else {
-      $smarty->assign("flagsO", "");
-    }
-    if ($this->kickoff_time_set=="1"){
-      $smarty->assign("flagsK", "checked");
-    } else {
-      $smarty->assign("flagsK", "");
-    }
-   
-
-    /* In case of javascript, disable some fields on demand */
-    if ($this->samba3){
-      foreach($this->mungedObject->getOnDemandFlags() as $key => $value) {
-        $smarty->assign("$key", "$value");
-      }
-    }
-
-    /* Show main page */
-    if ($this->samba3){
-      $display.= $smarty->fetch (get_template_path('samba3.tpl', TRUE, dirname(__FILE__)));
-    } else {
-      $display.= $smarty->fetch (get_template_path('samba2.tpl', TRUE, dirname(__FILE__)));
-    }
-
-    return ($display);
-  }
-
-  function remove_from_parent()
-  {
-    /* Cancel if there's nothing to do here */
-   if (!$this->initially_was_account){
-     return;
-   }
-    
-    /* include global link_info */
-    $ldap= $this->config->get_ldap_link();
-
-    plugin::remove_from_parent();
-
-    /* Keep uid attribute for gosaAccount */
-    unset($this->attrs['uid']);
-    unset($this->attrs['uidNumber']);
-    unset($this->attrs['gidNumber']);
-
-    /* Remove objectClass for sambaIdmapEntry */
-    $tmp= array();
-    for ($i= 0; $i<count($this->attrs["objectClass"]); $i++){
-      if ($this->attrs['objectClass'][$i] != 'sambaIdmapEntry'){
-        $tmp[]= $this->attrs['objectClass'][$i];
-      }
-    }
-    $this->attrs['objectClass']= $tmp;
-
-    @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
-        $this->attributes, "Save");
-    $ldap->cd($this->dn);
-    $this->cleanup();
-    $ldap->modify ($this->attrs); 
-
-    new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-
-    show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/samba account with dn '%s' failed."),$this->dn));
-
-    /* Optionally execute a command after we're done */
-    $this->handle_post_events("remove", array("uid" => $this->uid));
-  }
-
-
-  /* Check for input problems */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    if ($this->samba3){
-
-      /* Strings */
-      foreach (array( "sambaHomePath" => _("Home directory"),
-            "sambaProfilePath" => _("Profile path")) as $key => $val){
-        if (!$this->mungedObject->is_samba_path($this->$key)){
-          $message[]= sprintf(_("The value specified as '%s' contains invalid characters!"), $val);
-        }
-      }
-
-      /* Numeric values */
-      foreach (array(  "CtxMaxConnectionTime" => _("Connection"),
-            "CtxMaxDisconnectionTime" => _("Disconnection"),
-            "CtxMaxIdleTime" => _("IDLE")) as $key => $val){
-
-        if (isset($this->mungedObject->ctx[$key]) && !is_id($this->mungedObject->ctx[$key]) && $val != 0){
-          $message[]= sprintf(_("The timeout property '%s' is checked and contains invalid or no characters!"), $val);
-        }
-      }
-
-      /* Too many workstations? Windows usrmgr only supports eight */
-      if (substr_count($this->sambaUserWorkstations, ",") >= 8){
-        $message[]= _("The windows user manager only allows eight clients. You've specified more than eight.");
-      }
-    }
-
-    return ($message);
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-
-    $SkipWrite = (!isset($this->parent) || !$this->parent) && !isset($_SESSION['edit']);
-
-    /* We only care if we are on the sambaTab... */
-    if (isset($_POST['sambaTab'])){
-      plugin::save_object();
-
-      /* Take care about access options */
-      if ($this->acl_is_writeable("sambaAcctFlagsL",$SkipWrite) || ($this->acl_is_writeable("sambaAcctFlagsN",$SkipWrite))){
-        if ($this->samba3){
-          $attrname= "sambaPwdCanChange";
-        } else {
-          $attrname= "pwdCanChange";
-        }
-        if (isset($_POST["allow_pwchange"]) && $_POST["allow_pwchange"] == 1){
-          $tmp= 1;
-        } else {
-          $tmp= 0;
-        }
-        if ($this->$attrname != $tmp){
-          $this->is_modified= TRUE;
-        }
-        $this->pwdCanChange= $tmp;
-        $this->sambaPwdCanChange= $tmp;
-      }
-      $tmp= "UX";
-      if (isset($_POST["no_password_required"])){
-        if ($_POST["no_password_required"] == 1){
-          $tmp.= "N";
-        }
-      }
-      if (isset($_POST["password_expires"])){
-        if ($_POST["password_expires"] == 1){
-          $this->password_expires= 1;
-        }
-      } else {
-        $this->password_expires= 0;
-      }
-      if (isset($_POST["temporary_disable"])){
-        if ($_POST["temporary_disable"] == 1){
-          if (is_integer(strpos($this->sambaAcctFlags, "L"))) {
-            $tmp.= "L";
-          } else {
-            $tmp.= "D";
-          }
-        }
-      }
-      if (isset($_POST["logon_time_set"])){
-        if ($_POST["logon_time_set"] == 1){
-          $this->logon_time_set= 1;
-        }
-      } else {
-        $this->logon_time_set= 0;
-      }
-      if (isset($_POST["logoff_time_set"])){
-        if ($_POST["logoff_time_set"] == 1){
-          $this->logoff_time_set= 1;
-        }
-      } else {
-        $this->logoff_time_set= 0;
-      }
-      if (isset($_POST["kickoff_time_set"])){
-        if ($_POST["kickoff_time_set"] == 1){
-          $this->kickoff_time_set= 1;
-        }
-      } else {
-        $this->kickoff_time_set= 0;
-      }
-      
-      $fill= "";
-      for ($i= strlen($tmp); $i<12; $i++){
-        $fill.= " ";
-      }
-
-      $tmp= "[$tmp$fill]";
-
-      /* Only save if acl's are set */
-      if ($this->acl_is_writeable("sambaAcctFlagsL",$SkipWrite) || ($this->acl_is_writeable("sambaAcctFlagsN",$SkipWrite))){
-        if ($this->samba3){
-          $attrname= "sambaAcctFlags";
-        } else {
-          $attrname= "acctFlags";
-        }
-        if ($this->$attrname != $tmp){
-          $this->is_modified= TRUE;
-        }
-        $this->$attrname= $tmp;
-      }
-
-      /* Save sambaDomain attribute */
-      if ($this->acl_is_writeable("sambaDomainName",$SkipWrite) && $this->samba3 && isset ($_POST['sambaDomainName'],$SkipWrite)){
-        $this->sambaDomainName= validate($_POST['sambaDomainName']);
-      }
-
-      /* Save CTX values */
-      if ($this->samba3){
-
-        /* Save obvious values */
-        foreach($this->ctxattributes as $val){
-          if (isset($_POST[$val]) && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite)){
-            if (get_magic_quotes_gpc()) {
-              $this->mungedObject->ctx[$val]= stripcslashes(validate($_POST[$val]));
-            } else {
-              $this->mungedObject->ctx[$val]= validate($_POST[$val]);
-            }
-          }
-        }
-
-        /* Save checkbox states. */
-        $this->mungedObject->setTsLogin(!isset($_POST['tslogin'])
-                        && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite));
-        // Need to do some index checking to avoid messages like "index ... not found"
-        if(isset($_POST['brokenconn'])) {
-          $this->mungedObject->setBrokenConn($_POST['brokenconn'] == '1'
-                        && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite));
-        }
-        if(isset($_POST['reconn'])) {
-          $this->mungedObject->setReConn($_POST['reconn'] == '1'
-                        && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite));
-        }
-        $this->mungedObject->setInheritMode(isset($_POST['inherit'])
-                        && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite));
-        $this->mungedObject->setCtxMaxConnectionTimeF(!isset($_POST['CtxMaxConnectionTimeF'])
-                        && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite));
-        $this->mungedObject->setCtxMaxDisconnectionTimeF(
-                        !isset($_POST['CtxMaxDisconnectionTimeF']) 
-                        && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite));
-        $this->mungedObject->setCtxMaxIdleTimeF(!isset($_POST['CtxMaxIdleTimeF'])
-                        && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite));
-        $this->mungedObject->setConnectClientDrives(isset($_POST['connectclientdrives'])
-                        && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite));
-        $this->mungedObject->setConnectClientPrinters(isset($_POST['connectclientprinters'])  
-                        && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite));
-        $this->mungedObject->setDefaultPrinter(isset($_POST['defaultprinter'])
-                        && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite));
-
-        /* Save combo boxes. Takes two values */
-        if(isset($_POST['reconn'])) {
-          $this->mungedObject->setShadow(isset($_POST['shadow']) && $this->acl_is_writeable("AllowLoginOnTerminalServer",$SkipWrite),$_POST['shadow']);
-        }
-
-        /* Check for changes */
-        if ($this->sambaMungedDial != $this->mungedObject->getMunged()){
-          $this->is_modified= TRUE;
-        }
-      }
-    }
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    /* Load uid and gid of this 'dn' */
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cat($this->dn, array('uidNumber', 'gidNumber'));
-    $tmp= $ldap->fetch();
-    $this->uidNumber= $tmp['uidNumber'][0];
-    $this->gidNumber= $tmp['gidNumber'][0];
-
-    plugin::save();
-
-    /* Remove objectClass for sambaIdmapEntry */
-    $tmp= array();
-    for ($i= 0; $i<count($this->attrs["objectClass"]); $i++){
-      if ($this->attrs['objectClass'][$i] != 'sambaIdmapEntry'){
-        $tmp[]= $this->attrs['objectClass'][$i];
-      }
-    }
-    $this->attrs['objectClass']= $tmp;
-
-    /* Generate rid / primaryGroupId */
-    if ($this->samba3){
-      if (!isset($this->config->data['SERVERS']['SAMBA'][$this->sambaDomainName]['SID'])){
-        print_red (_("Warning: This account has an undefined samba SID assigned. The problem can not be fixed by GOsa!"));
-      } else {
-        $this->SID= $this->config->data['SERVERS']['SAMBA'][$this->sambaDomainName]['SID'];
-        $this->ridBase= $this->config->data['SERVERS']['SAMBA'][$this->sambaDomainName]['RIDBASE'];
-      }
-
-      /* Need to generate a new uniqe uid/gid combination? */
-      if ($this->sambaSID == "" || $this->orig_sambaDomainName != $this->sambaDomainName){
-        $uidNumber= $this->uidNumber;
-        while(TRUE){
-          $sid= $this->SID."-".($uidNumber*2 + $this->ridBase);
-          $ldap->cd($this->config->current['BASE']);
-          $ldap->search("(sambaSID=$sid)", array("sambaSID"));
-          if ($ldap->count() == 0){
-            break;
-          }
-          $uidNumber++;
-        }
-        $this->attrs['sambaSID']= $sid;
-
-        /* Check for users primary group */
-        $ldap->cd($this->config->current['BASE']);
-        $ldap->search("(&(objectClass=posixGroup)(gidNumber=".$this->gidNumber."))", array("cn"));
-        if ($ldap->count() != 1){
-          print_red(_("Warning: Can't identify users primary group - no conversion to a samba group possible!"));
-        } else {
-          $attrs= $ldap->fetch();
-          $g= new group($this->config, $ldap->getDN());
-          if ($g->sambaSID == ""){
-            $g->sambaDomainName= $this->sambaDomainName;
-            $g->smbgroup= TRUE;
-            $g->save ();
-          }
-          $this->attrs['sambaPrimaryGroupSID']= $g->sambaSID;
-        }
-      }
-
-      if ($this->sambaHomeDrive == ""){
-        $this->attrs["sambaHomeDrive"]= array();
-      }
-
-      /* Generate munged dial value */
-      $this->attrs["sambaMungedDial"]= $this->mungedObject->getMunged();
-
-      /* User wants me to fake the idMappings? This is useful for
-         making winbind resolve the user names in a reasonable amount
-         of time in combination with larger databases. */
-      if (isset($this->config->current['SAMBAIDMAPPING']) &&
-          preg_match('/true/i', $this->config->current['SAMBAIDMAPPING'])){
-        $this->attrs['objectClass'][]= "sambaIdmapEntry";
-      }
-
-
-      /* Password expiery */
-      if ($this->password_expires == "1"){
-        $this->attrs['sambaPwdMustChange']= $this->sambaPwdMustChange;
-      } else {
-        $this->attrs['sambaPwdMustChange']= array();
-      }
-      /* Make sure not to save zero in sambaPwdLastset */
-      if ($this->sambaPwdLastSet != "0"){
-        $this->attrs['sambaPwdLastSet']= $this->sambaPwdLastSet;
-      } else {
-        $this->attrs['sambaPwdLastSet']= array();
-      }
-      /* Account expiery */
-      if ($this->logon_time_set == "1"){
-        $this->attrs['sambaLogonTime']= $this->sambaLogonTime;
-      } else {
-        $this->attrs['sambaLogonTime']= array();
-      }
-      if ($this->logoff_time_set == "1"){
-        $this->attrs['sambaLogoffTime']= $this->sambaLogoffTime;
-      } else {
-        $this->attrs['sambaLogoffTime']= array();
-      }
-      if ($this->kickoff_time_set == "1"){
-        # Add one day in unixtime format to be compatible with usrmgr
-        //$this->attrs['sambaKickoffTime']= $this->sambaKickoffTime + 86400; 
-        $this->attrs['sambaKickoffTime']= $this->sambaKickoffTime; //hickert 
-      } else {
-        $this->attrs['sambaKickoffTime']= array();
-      }
-    } else {
-    /* Not samba3 */
-      $this->attrs['rid']= $this->uidNumber*2 + 1000;
-      $this->attrs['primaryGroupID']= $this->gidNumber*2 +1001;
-
-      if ($this->homeDrive == ""){
-        $this->attrs["homeDrive"]= array();
-      }
-
-      /* Password expiery */
-      if ($this->password_expires == "1"){
-        $this->attrs['pwdMustChange']= $this->pwdMustChange;
-      } else {
-        $this->attrs['pwdMustChange']= 2147483647;
-      }
-      /* Make sure not to save zero in pwdLastset */
-      if ($this->pwdLastSet != "0"){
-        $this->attrs['pwdLastSet']= $this->pwdLastSet;
-      } else {
-        $this->attrs['pwdLastSet']= array();
-      }
-      /* Account expiery */
-      if ($this->logon_time_set == "1"){
-        $this->attrs['logonTime']= $this->logonTime;
-      } else {
-        $this->attrs['logonTime']= array();
-      }
-      if ($this->logoff_time_set == "1"){
-        $this->attrs['logoffTime']= $this->logoffTime;
-      } else {
-        $this->attrs['logoffTime']= array();
-      }
-      if ($this->kickoff_time_set == "1"){
-        # Add one day in unixtime format to be compatible with usrmgr
-        $this->attrs['kickoffTime']= $this->kickoffTime + 86400;
-      } else {
-        $this->attrs['kickoffTime']= array();
-      }
-    }
-
-    /* Write back to ldap */
-    $ldap->cd($this->dn);
-    $this->cleanup();
-    $ldap->modify ($this->attrs); 
-
-    if($this->initially_was_account){
-      new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }else{
-      new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }
-
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/samba account 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", array("uid" => $this->uid));
-      }
-    } else {
-      $this->handle_post_events("add", array("uid" => $this->uid));
-    }
-  }
-
-
-  /* Force password set, if this account doesn't have any samba passwords  */
-  function password_change_needed()
-  {
-    if(!$this->initially_was_account && $this->is_account){
-      $ldap = $this->config->get_ldap_link();
-      $ldap->cat($this->dn,array("sambaLMPassword","sambaNTPassword"));
-      $attrs = $ldap->fetch();
-      if(!isset($attrs['sambaLMPassword']) || !isset($attrs['sambaNTPassword'])){
-        return(TRUE);
-      }
-    }
-    return(FALSE);
-  }
-
-
-  function adapt_from_template($dn)
-  {
-    plugin::adapt_from_template($dn);
-    $this->sambaSID= "";
-    $this->sambaPrimaryGroupSID= "";
-
-      /* Fill mungedDial field */
-    if ($this->samba3 && isset($this->attrs['sambaMungedDial'])){
-      $this->mungedObject->load($this->sambaMungedDial);
-    }
-
-    /* Password expiery */
-    if(isset($this->attrs['sambaPwdMustChange']) &&
-        $this->attrs['sambaPwdMustChange'][0] != 0){
-      $this->password_expires= 1;
-    }
-
-    if(isset($this->attrs['sambaLogonTime']) && ! (
-        $this->attrs['sambaLogonTime'][0] == 0 ||
-        $this->attrs['sambaLogonTime'][0] == 2147483647
-      )){
-      $this->logon_time_set= 1;
-    }
-    if(isset($this->attrs['sambaLogoffTime']) && ! (
-        $this->attrs['sambaLogoffTime'][0] == 0 ||
-        $this->attrs['sambaLogoffTime'][0] == 2147483647
-      )){
-      $this->logoff_time_set= 1;
-    }
-
-    /* Account expiery */
-    if(isset($this->attrs['sambaKickoffTime']) && ! (
-        $this->attrs['sambaKickoffTime'][0] == 0 ||
-        $this->attrs['sambaKickoffTime'][0] == 2147483647
-      )){
-      $this->kickoff_time_set= 1;
-    }
-
-    /* Get global filter config */
-    if (!is_global("sambafilter")){
-      $ui= get_userinfo();
-      $base= get_base_from_people($ui->dn);
-      $sambafilter= array( "depselect" => $base, "regex" => "*");
-      register_global("sambafilter", $sambafilter);
-    }
-  }
-
-  
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"     => _("Samba"),
-          "plDescription"   => _("Samba settings"),
-          "plSelfModify"    => TRUE,
-          "plDepends"       => array("user"),
-          "plPriority"      => 5,
-          "plSection"     => array("personal" => _("My account")),
-          "plCategory"    => array("users"),
-          "plOptions"       => array(),
-
-          "plProvidedAcls"  => array(
-            "AllowLoginOnTerminalServer"  => _("Allow login on terminal server"),
-            "InheritClientConfig"         => _("Inherit client config"),
-
-            "sambaPwdCanChange"     => _("Allow user to change password") ,
-            "sambaAcctFlagsN"            => _("Login from windows client requires no password"),
-            "sambaAcctFlagsL"            => _("Lock samba account"),
-
-
-            "sambaKickoffTime"      => _("Account expires") ,
-            "sambaPwdMustChange"    => _("Password expires") ,
-
-            "sambaLogonTime"        => _("Limit Logon Time") ,
-            "sambaLogoffTime"       => _("Limit Logoff Time") ,
-            "sambaLogonHours"       => _("Logon hours") ,
-
-            "sambaHomePath"         => _("Generic home directory") ,
-            "sambaHomeDrive"        => _("Generic samba home drive") ,
-            "sambaLogonScript"      => _("Generic script path") ,
-            "sambaProfilePath"      => _("Generic profile path") ,
-            "sambaDomainName"       => _("Domain") ,
-            "sambaUserWorkstations" => _("Allow connection from")))
-              );
-  }    
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/personal/samba/class_sambaLogonHours.inc b/plugins/personal/samba/class_sambaLogonHours.inc
deleted file mode 100644 (file)
index 95de60d..0000000
+++ /dev/null
@@ -1,148 +0,0 @@
-<?php
-
-class sambaLogonHours extends plugin
-{
-
-  var $sambaLogonHours = "";
-  var $Matrix          = array();
-  var $timezone        = 0; 
-  var $config;
-
-  function sambaLogonHours (&$config, $dn, $slh)
-  {
-    plugin::plugin($config,$dn);
-    $this->sambaLogonHours = $slh;
-
-    /* Get default timezone */
-    $zone = get_default_timezone();
-    $this->timezone = $zone['value'];
-
-    /* Convert to bin */
-    $tmp = '';
-    for($i = 0 ; $i < strlen($slh) ; $i ++){
-      $tmp .= str_pad(base_convert($slh[$i],16,2),4,'0',STR_PAD_LEFT);
-    }
-    $slh = $tmp;
-
-    /* Set to default if value is empty or seams to be broken */
-    if(strlen($slh) != 168){
-      $slh = str_pad('',168 , "1");
-    }
-
-    /* Rework string, because it was stored in little endian */
-    $new = '';
-    for($i = 0 ; $i < 21 ; $i ++ ){
-      $part         = strrev(substr($slh, $i * 8, 8));
-      $byte['hi']   = substr($part,0,4);
-      $byte['low']  = substr($part,4,4);
-      $new .= $byte['hi'].$byte['low'];
-    }
-
-    /* Shift string to match given timezone settings */
-    $shift_by = (168 + $this->timezone) % 168;
-    for($i = 0 ; $i < $shift_by; $i ++){
-      $new = $new[167].$new;
-      $new = substr($new,0,168);
-    }
-
-    /* Create matrix */ 
-    $this->Matrix = array();
-    for($day = 0 ; $day < 7 ; $day ++ ){
-      for($hour  = 0 ; $hour < 24 ; $hour ++){
-        $bitpos  = ($day * 24 + $hour) % 168;
-        $this->Matrix[$day][$hour] = $new[$bitpos]; 
-      }
-    }
-  }
-
-  function execute()
-  {
-
-    $week_days = array();
-    $week_days[0]= _("Sunday");
-    $week_days[1]= _("Monday");
-    $week_days[2]= _("Tuesday");
-    $week_days[3]= _("Wednesday");
-    $week_days[4]= _("Thursday");
-    $week_days[5]= _("Friday");
-    $week_days[6]= _("Saturday");
-
-    $hours = array();
-    for($i = 0 ; $i <24 ; $i++ ){
-      $hours[$i] = $i ;
-    }
-    $ui =get_userinfo();
-
-    $smarty = get_smarty();
-    $smarty->assign("sambaLogonHoursACL",$ui->get_permissions($this->acl_base,"user/generic","sambaLogonHours"));
-    $smarty->assign("Matrix",$this->Matrix);
-    $smarty->assign("Days"  ,$week_days);
-    $smarty->assign("Hours" ,$hours);
-    return($smarty->fetch(get_template_path("sambaLogonHours.tpl",TRUE,dirname(__FILE__))));
-  }
-
-  function save_object()
-  {
-    /* Get userinfo */
-    $ui = get_userinfo();
-  
-    /* Check if dialog was opened and if there were any changes */
-    if(isset($_POST['sambaLogonHoursPosted']) && preg_match("/w/i",$ui->get_permissions($this->acl_base,"user/generic","sambaLogonHours"))){
-      foreach($this->Matrix as $day_key => $days){
-        foreach($days as $hour_key => $hour){
-          if(isset($_POST['day_'.$day_key.'_'.$hour_key])){
-            $this->Matrix[$day_key][$hour_key] = 1;
-          }else{
-            $this->Matrix[$day_key][$hour_key] = 0;
-          }
-        }
-      }
-    }
-  }
-  
-  function save()
-  {
-
-    /* Convert Matrix to Hex */
-    $slh = "";
-    foreach($this->Matrix as $day_key => $days){
-      foreach($days as $hour_key => $hour){
-        $slh .= $hour;
-      }
-    }
-
-    /* Shift string to match given timezone settings */
-    $shift_by = (168 + ($this->timezone*(-1))) % 168;
-    for($i = 0 ; $i < $shift_by; $i ++){
-      $slh = $slh[167].$slh;
-      $slh = substr($slh,0,168);
-    }
-    /* Rework string, because it was stored in little endian */
-    $new = '';
-    for($i = 0 ; $i < 21 ; $i ++ ){
-      $part         = strrev(substr($slh, $i * 8, 8));
-      $byte['hi']   = substr($part,0,4);
-      $byte['low']  = substr($part,4,4);
-      $new .= $byte['hi'].$byte['low'];
-    }
-
-    /* Convert to bin */
-    $tmp = '';
-    for($i = 0 ; $i < 21 ; $i ++){
-      $tmp .= str_pad(base_convert(substr($new,$i*8,8),2,16),2,'0',STR_PAD_LEFT);
-    }
-
-    /* Create uppercase HEX chars */
-    $ret = strtoupper( $tmp);
-    
-    /* All hours and days selected */
-    if(substr_count($ret,'F') == 42){
-      $ret = "";
-    }
-
-    return($ret);
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/personal/samba/main.inc b/plugins/personal/samba/main.inc
deleted file mode 100644 (file)
index 0c198dc..0000000
+++ /dev/null
@@ -1,130 +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
- */
-
-$display  = "";
-$lock_msg = "";
-if (!$remove_lock){
-  /* Reset requested? */
-  if (isset($_POST['edit_cancel']) ||
-      (isset($_GET['reset']) && $_GET['reset'] == 1)){
-
-    del_lock ($ui->dn);
-    sess_del ('edit');
-    sess_del ('sambaAccount');
-  }
-
-  /* Create sambaAccount object on demand */
-  if (!isset($_SESSION['sambaAccount']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
-    $_SESSION['sambaAccount']= new sambaAccount ($config, $ui->dn);
-    $_SESSION['sambaAccount']->enable_CSN_check();
-    $_SESSION['sambaAccount']->set_acl_base($ui->dn);
-    $_SESSION['sambaAccount']->set_acl_category("users");
-  }
-  $sambaAccount= $_SESSION['sambaAccount'];
-
-  /* save changes back to object */
-  if (isset ($_SESSION['edit'])){
-    $sambaAccount->save_object ();
-  }
-
-  /* Enter edit mode? */
-  if (isset($_POST['edit'])){
-
-    /* Check locking */
-    if (($username= get_lock($ui->dn)) != ""){
-      $_SESSION['back_plugin']= $plug;
-      $_SESSION['LOCK_VARS_TO_USE'] = array("/^edit$/","/^plug$/");
-      $lock_msg =  gen_locked_message ($username, $ui->dn);
-
-    }else{
-
-      /* Lock the current entry */
-      add_lock ($ui->dn, $ui->dn);
-      $_SESSION['dn']= $ui->dn;
-      $_SESSION['edit']= TRUE;
-    }
-  }
-
-  /* save changes to LDAP and disable edit mode */
-  if (isset($_POST['edit_finish'])){
-
-    /* Perform checks */
-    $message= $sambaAccount->check ();
-
-    /* No errors, save object */
-    if (count ($message) == 0){
-      $sambaAccount->save ();
-      del_lock ($ui->dn);
-      sess_del ('edit');
-
-      /* Remove from session */
-      sess_del ('sambaAccount');
-    } else {
-      /* Errors found, show message */
-      show_errors ($message);
-    }
-  }
-
-  /* Execute formular */
-  if($lock_msg){
-    $display.= $lock_msg;
-  }else{
-    $display.= $sambaAccount->execute ();
-  }
-
-  /* Store changes  in session */
-  if (isset ($_SESSION['edit'])){
-    $_SESSION['sambaAccount']= $sambaAccount;
-  }
-
-  $info= "";
-  if (($sambaAccount->is_account) && (!$sambaAccount->show_ws_dialog) && empty($lock_msg)){
-    $display.= "<p class=\"plugbottom\">";
-
-    /* Are we in edit mode? */
-    if (isset($_SESSION['edit'])){
-      $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
-      $display.= "&nbsp;";
-      $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
-      $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png').
-             "\"> ".$ui->dn."&nbsp;";
-    } else {
-      $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/openlock.png').
-             "\"> ".$ui->dn."&nbsp;";
-
-      if(preg_match("/w/",$ui->get_permissions($ui->dn,"users/sambaAccount"))){
-
-        $info.= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/lamp.png')."\"> ".
-                _("Click the 'Edit' button below to change informations in this dialog");
-        $display.= "<input type=submit name=\"edit\" value=\""._("Edit")."\">\n";
-      }
-      $display.= "<input type=\"hidden\" name=\"ignore\">\n";
-    }
-    $display.= "</p>\n";
-  }
-
-  /* Page header*/
-  $display= print_header(get_template_path('images/samba.png'), _("Samba settings"),
-                         $info).$display;
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/personal/samba/samba2.tpl b/plugins/personal/samba/samba2.tpl
deleted file mode 100644 (file)
index 11b28d8..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding="0" border="0">
-
- <!-- Headline container -->
- <tr>
-  <td colspan="2" style="width:50%; vertical-align:top;">
-   <h2><p class="center"><img class="center" alt="" align="middle" src="images/rightarrow.png" />&nbsp;{t}Generic{/t}</p></h2>
-  </td>
- </tr>
- <tr>
-  <td style="vertical-align:top;">
-   <table summary="">
-    <tr>
-     <td><label for="smbHome">{t}Samba home{/t}</label></td>
-     <td>
-
-{render acl=$smbHomeACL}
-      <input id="smbHome" name="smbHome" size=30 maxlength=60 value="{$smbHome}">
-{/render}
-
-{render acl=$smbDriveACL}
-      <select size="1" name="homeDrive">
-       <option disabled>&nbsp;</option>
-       {html_options values=$drives output=$drives selected=$homeDrive}
-      </select>
-{/render}
-
-     </td>
-    </tr>
-   </table>
-  </td>
-  <td style="border-left:1px solid #A0A0A0">
-    &nbsp;
-  </td>
-  <td style="vertical-align:top;">
-   <table summary="">
-    <tr>
-     <td><label for="scriptPath">{t}Script path{/t}</label></td>
-     <td>
-{render acl=$scriptPathACL}
-      <input id="scriptPath" name="scriptPath" size=35 maxlength=60 value="{$scriptPath}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><label for="profilePath">{t}Profile path{/t}</label></td>
-     <td>
-{render acl=$profilePathACL}
-      <input id="profilePath" name="profilePath" size=35 maxlength=60 value="{$profilePath}">
-{/render}
-     </td>
-    </tr>
-   </table>
-  </td>
- </tr>
-</table>
-
-<p class="seperator">&nbsp;</p>
-
-<h2><p class="center"><img class="center" alt="" align="middle" src="images/certs.png" />&nbsp;{t}Access options{/t}</p></h2>
-
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding="4" border="0">
- <tr>
-  <td style="width:50%;">
-{render acl=$allow_pwchangeACL}
-   <input id="allow_pwchange" type=checkbox name="allow_pwchange" value="1" {$flagsP}>
-{/render}
-   <label for="allow_pwchange">{t}Allow user to change password from client{/t}</label>
-   <br>
-{render acl=$no_password_requiredACL}
-   <input id="no_password_required" type=checkbox name="no_password_required" value="1" {$flagsN}>
-{/render}
-   <label for="no_password_required">{t}Login from windows client requires no password{/t}</label>
-   <br>
-{render acl=$temporary_disableACL}
-   <input id="temporary_disable" type=checkbox name="temporary_disable" value="1" {$flagsD}>
-{/render}
-   <label for="temporary_disable">{t}Temporary disable samba account{/t}</label>
-   <br>
-  </td>
-  <td style="border-left:1px solid #A0A0A0">
-   &nbsp;
-  </td>
-  <td style="vertical-align:top; width:50%">
-{render acl=$password_expiresACL}
-   <input type=checkbox name="password_expires" value="1" {$flagsC}>
-{/render}
-   <label for="day">{t}Password expires on{/t}</label>
-{render acl=$sambaPwdMustChangeACL}
-   <select id="day" name=day onChange="createResult(this.form,this.form.sambaPwdMustChange);">
-    {html_options values=$days output=$days selected=$day}
-   </select>
-{/render}
-{render acl=$sambaPwdMustChangeACL}
-   <select name=month onChange="populate(this.form,this.form.sambaPwdMustChange);">
-    {html_options options=$months selected=$month}
-   </select>
-{/render}
-{render acl=$sambaPwdMustChangeACL}
-   <select name=year onChange="populate(this.form,this.form.sambaPwdMustChange);">
-    {html_options values=$years output=$years selected=$year}
-   </select>
-{/render}
-   <input type="hidden" name="sambaPwdMustChange" value="{$sambaPwdMustChange}">
-  </td>
- </tr>
-</table>
-
-<input type="hidden" name="sambaTab" value="sambaTab">
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- 
-  // Populate expiery dialog
-  populate(document.mainform,document.mainform.sambaPwdMustChange);
-  -->
-</script>
diff --git a/plugins/personal/samba/samba3.tpl b/plugins/personal/samba/samba3.tpl
deleted file mode 100644 (file)
index 251cf53..0000000
+++ /dev/null
@@ -1,434 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding="0" border="0">
-
- <!-- Headline container -->
- <tr>
-  <td colspan="2" style="width:50%; vertical-align:top;">
-   <h2><img class="center" alt="" align="middle" src="images/rightarrow.png"/>&nbsp;{t}Generic{/t}</h2>
-  </td>
- </tr>
- <tr>
-  <td style="vertical-align:top;">
-   <table summary="">
-    <tr>
-     <td><label for="sambaHomePath">{t}Home directory{/t}</label></td>
-     <td>
-{render acl=$sambaHomePathACL}
-      <input id="sambaHomePath" name="sambaHomePath" size=30 maxlength=60 value="{$sambaHomePath}">
-{/render}
-{render acl=$sambaHomeDriveACL}
-      <select size="1" name="sambaHomeDrive">
-       <option disabled>&nbsp;</option>
-       {html_options values=$drives output=$drives selected=$sambaHomeDrive}
-      </select>
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><label for="sambaDomainName">{t}Domain{/t}</label></td>
-     <td>
-{render acl=$sambaDomainNameACL}
-      <select id="sambaDomainName" size="1" name="sambaDomainName">
-       {html_options values=$domains output=$domains selected=$sambaDomainName}
-      </select>
-{/render}
-     </td>
-    </tr>
-   </table>
-  </td>
-  <td style="border-left:1px solid #A0A0A0">
-   &nbsp;
-  </td>
-  <td style="vertical-align:top;">
-   <table summary="">
-    <tr>
-     <td><label for="">{t}Script path{/t}</label></td>
-     <td>
-{render acl=$sambaLogonScriptACL}
-      <input id="sambaLogonScript" name="sambaLogonScript" size=35 maxlength=60 value="{$sambaLogonScript}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><label for="">{t}Profile path{/t}</label></td>
-     <td>
-{render acl=$sambaProfilePathACL}
-      <input id="sambaProfilePath" name="sambaProfilePath" size=35 maxlength=60 value="{$sambaProfilePath}">
-{/render}
-     </td>
-    </tr>
-   </table>
-  </td>
- </tr>
-</table>
-
-<p class="seperator">&nbsp;</p>
-
-<h2><img class="center" alt="" align="middle" src="images/display.png" />&nbsp;{t}Terminal Server{/t}</h2>
-
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=0 border=0>
- <tr>
-  <td style="vertical-align:top;width:50%">
-{render acl=$AllowLoginOnTerminalServerACL}
-   <input type=checkbox name="tslogin" id="tslogin" value="1" {$tslogin}
-       onclick="
-               changeState('CtxWFHomeDir');
-               changeState('CtxWFHomeDirDrive');
-               changeState('CtxWFProfilePath');
-               changeState('inherit');                 
-               changeTripleSelectState_2nd_neg('tslogin','inherit','CtxInitialProgram');
-               changeTripleSelectState_2nd_neg('tslogin','inherit','CtxWorkDirectory');
-               changeState('CtxMaxConnectionTimeF');
-               changeState('CtxMaxDisconnectionTimeF');
-               changeState('CtxMaxIdleTimeF');
-               changeTripleSelectState('tslogin','CtxMaxConnectionTimeF','CtxMaxConnectionTime');
-               changeTripleSelectState('tslogin','CtxMaxDisconnectionTimeF','CtxMaxDisconnectionTime');
-               changeTripleSelectState('tslogin','CtxMaxIdleTimeF','CtxMaxIdleTime');
-               changeState('connectclientdrives');
-               changeState('connectclientprinters');
-               changeState('defaultprinter');
-               changeState('shadow');
-               changeState('brokenconn');
-               changeState('reconn');
-       ">
-{/render}
-   <i>{t}Allow login on terminal server{/t}</i>
-   <table summary="">
-    <tr>
-     <td><label for="CtxWFHomeDir">{t}Home directory{/t}</label></td>
-     <td>
-{render acl=$AllowLoginOnTerminalServerACL}
-      <input id="CtxWFHomeDir" name="CtxWFHomeDir" size=30 maxlength=60 value="{$CtxWFHomeDir}" {$tsloginstate}>
-{/render}
-{render acl=$AllowLoginOnTerminalServerACL}
-      <select size="1" id="CtxWFHomeDirDrive" name="CtxWFHomeDirDrive"  {$tsloginstate}>
-       <option disabled>&nbsp;</option>
-       {html_options values=$drives output=$drives selected=$CtxWFHomeDirDrive}
-      </select>
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><label for="CtxWFProfilePath">{t}Profile path{/t}</label></td>
-     <td>
-{render acl=$AllowLoginOnTerminalServerACL}
-      <input id="CtxWFProfilePath" name="CtxWFProfilePath" size=35 maxlength=60 value="{$CtxWFProfilePath}" {$tsloginstate}>
-{/render}
-     </td>
-    </tr>
-   </table>
-  </td>
-  <td style="border-left:1px solid #A0A0A0">
-   &nbsp;
-  </td>
-  <td style="vertical-align:top;">
-{render acl=$AllowLoginOnTerminalServerACL}
-   <input type=checkbox id="inherit" name="inherit" {if $inheritstate} checked {/if}
-       onClick="changeState('CtxInitialProgram');
-                changeState('CtxWorkDirectory');"
-       
-       > 
-{/render}
-   <i>{t}Inherit client config{/t}</i>
-   <table summary="">
-    <tr>
-     <td><label for="CtxInitialProgram">{t}Initial program{/t}</label></td>
-     <td>
-{render acl=$AllowLoginOnTerminalServerACL}
-      <input id="CtxInitialProgram" name="CtxInitialProgram" size=35 maxlength=60 value="{$CtxInitialProgram}" {$inheritstate}>
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><label for="CtxWorkDirectory">{t}Working directory{/t}</label></td>
-     <td>
-{render acl=$AllowLoginOnTerminalServerACL}
-      <input id="CtxWorkDirectory" name="CtxWorkDirectory" size=35 maxlength=60        value='{$CtxWorkDirectory}' {$inheritstate}>
-{/render}
-     </td>
-    </tr>
-   </table>
-  </td>
- </tr>
-</table>
-
-<p class="seperator">&nbsp;</p>
-
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=0 border=0>
- <tr>
-  <td style="vertical-align:top;">
-   <i>{t}Timeout settings (in minutes){/t}</i>
-   <table summary="">
-    <tr>
-     <td>
-{render acl=$AllowLoginOnTerminalServerACL}
-      <input           id="CtxMaxConnectionTimeF"      type=checkbox                   name="CtxMaxConnectionTimeF" 
-                       value="1"                       {$CtxMaxConnectionTimeF}        
-                       onclick="changeState('CtxMaxConnectionTime')" {$tsloginstate}>
-{/render}
-
-      <label for="CtxMaxConnectionTimeF">{t}Connection{/t}</label>
-     </td>
-     <td>
-{render acl=$AllowLoginOnTerminalServerACL}
-      <input name="CtxMaxConnectionTime" id="CtxMaxConnectionTime" size=5 maxlength=5 value="{$CtxMaxConnectionTime}" {$tsloginstate}
-                       { if !$CtxMaxConnectionTimeF } disabled  {/if}>
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td>
-{render acl=$AllowLoginOnTerminalServerACL}
-      <input id="CtxMaxDisconnectionTimeF" type=checkbox name="CtxMaxDisconnectionTimeF" value="1" {$CtxMaxDisconnectionTimeF} onclick="changeState('CtxMaxDisconnectionTime')" {$tsloginstate}>
-{/render}
-      <label for="CtxMaxDisconnectionTimeF">{t}Disconnection{/t}</label>
-     </td>
-     <td>
-{render acl=$AllowLoginOnTerminalServerACL}
-      <input name="CtxMaxDisconnectionTime" id="CtxMaxDisconnectionTime" size=5 maxlength=5 value="{$CtxMaxDisconnectionTime}" {$tsloginstate}
-                       { if !$CtxMaxDisconnectionTimeF } disabled  {/if}>
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td>
-{render acl=$AllowLoginOnTerminalServerACL}
-      <input id="CtxMaxIdleTimeF" type=checkbox name="CtxMaxIdleTimeF" value="1" {$CtxMaxIdleTimeF} onclick="changeState('CtxMaxIdleTime')" {$tsloginstate}>
-{/render}
-      <label for="CtxMaxIdleTimeF">{t}IDLE{/t}</label>
-     </td>
-     <td>
-{render acl=$AllowLoginOnTerminalServerACL}
-      <input name="CtxMaxIdleTime" id="CtxMaxIdleTime" size=5 maxlength=5 value="{$CtxMaxIdleTime}" {$tsloginstate}
-                       { if !$CtxMaxIdleTimeF } disabled  {/if}>
-{/render}
-     </td>
-    </tr>
-   </table>
-  </td>
-  <td style="border-left:1px solid #A0A0A0">
-   &nbsp;
-  </td>
-  <td style="vertical-align:top;">
-
-   <i>{t}Client devices{/t}</i>
-   <table summary="">
-    <tr>
-     <td>
-{render acl=$AllowLoginOnTerminalServerACL}
-      <input id="connectclientdrives" type=checkbox name="connectclientdrives" value="1" {$connectclientdrives} {$tsloginstate}>
-{/render}
-      <label for="connectclientdrives">{t}Connect client drives at logon{/t}</label>
-     </td>
-    </tr>
-    <tr>
-     <td>
-{render acl=$AllowLoginOnTerminalServerACL}
-      <input id="connectclientprinters" type=checkbox name="connectclientprinters" value="1" {$connectclientprinters}{$tsloginstate}>
-{/render}
-      <label for="connectclientprinters">{t}Connect client printers at logon{/t}</label>
-     </td>
-    </tr>
-    <tr>
-     <td>
-{render acl=$AllowLoginOnTerminalServerACL}
-      <input id="defaultprinter" type=checkbox name="defaultprinter" value="1" {$defaultprinter}>
-{/render}
-      <label for="defaultprinter">{t}Default to main client printer{/t}</label>
-     </td>
-    </tr>
-   </table>
-
-  </td>
-  <td style="border-left:1px solid #A0A0A0">
-   &nbsp;
-  </td>
-  <td style="vertical-align:top;width:50%">
-   <i>{t}Miscellaneous{/t}</i>
-   <table summary="">
-    <tr>
-     <td>
-      <label for="shadow">{t}Shadowing{/t}</label>
-     </td>
-     <td>
-{render acl=$AllowLoginOnTerminalServerACL}
-      <select id="shadow" size="1" name="shadow" >
-       {html_options options=$shadow selected=$shadowmode}
-      </select>
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><label for="brokenconn">{t}On broken or timed out{/t}</label></td>
-     <td>
-{render acl=$AllowLoginOnTerminalServerACL}
-      <select id="brokenconn" size="1" name="brokenconn">
-       {html_options options=$brokenconn selected=$brokenconnmode}
-      </select>
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><label for="reconn">{t}Reconnect if disconnected{/t}</label></td>
-     <td>
-{render acl=$AllowLoginOnTerminalServerACL}
-      <select id="reconn" size="1" name="reconn">
-       {html_options options=$reconn selected=$reconnmode}
-      </select>
-{/render}
-     </td>
-    </tr>
-   </table>
-
-  </td>
- </tr>
-</table>
-
-<p class="seperator">&nbsp;</p>
-
-<h2><img class="center" alt="" align="middle" src="images/certs.png" />&nbsp;{t}Access options{/t}</h2>
-
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4 border=0>
- <tr>
-  <td style="width:50%; vertical-align:top;">
-{render acl=$sambaPwdCanChangeACL}
-   <input id="allow_pwchange" type=checkbox name="allow_pwchange" value="1" {$flagsP}>
-{/render}
-   <label for="allow_pwchange">{t}Allow user to change password from client{/t}</label>
-   <br>
-{render acl=$sambaAcctFlagsNACL}
-   <input id="no_password_required" type=checkbox name="no_password_required" value="1" {$flagsN}>
-{/render}
-   <label for="no_password_required">{t}Login from windows client requires no password{/t}</label>
-   <br>
-{render acl=$sambaAcctFlagsLACL}
-   <input id="temporary_disable" type=checkbox name="temporary_disable" value="1" {$flagsD}>
-{/render}
-   <label for="temporary_disable">{t}Lock samba account{/t}</label>
-   <br>
-{render acl=$sambaPwdMustChangeACL}
-   <input id="password_expires" type=checkbox name="password_expires" value="1" {$flagsC}>
-{/render}
-   <label for="password_expires">{t}Password expires on{/t}</label>
-{render acl=$sambaPwdMustChangeACL}
-   <select name=day onChange="createResult(this.form,this.form.sambaPwdMustChange);">
-    {html_options values=$days output=$days selected=$day}
-   </select>
-{/render}
-{render acl=$sambaPwdMustChangeACL}
-   <select name=month onChange="populate(this.form,this.form.sambaPwdMustChange);">
-    {html_options options=$months selected=$month}
-   </select>
-{/render}
-{render acl=$sambaPwdMustChangeACL}
-   <select name=year onChange="populate(this.form,this.form.sambaPwdMustChange);">
-    {html_options values=$years output=$years selected=$year}
-   </select>
-{/render}
-   <br>
-{render acl=$sambaLogonTimeACL}
-   <input id="logon_time_set" type=checkbox name="logon_time_set" value="1" {$flagsT}>
-{/render}
-   <label for="logon_time_set">{t}Limit Logon Time{/t}</label>
-{render acl=$sambaLogonTimeACL}
-   <select name=sambaLogonTime_day onChange="createResult_sambaLogonTime(this.form,this.form.sambaLogonTime);">
-   {html_options values=$sambaLogonTime_days output=$sambaLogonTime_days selected=$sambaLogonTime_day}
-   </select>
-{/render}
-{render acl=$sambaLogonTimeACL}
-   <select name=sambaLogonTime_month onChange="populate_sambaLogonTime(this.form,this.form.sambaLogonTime);">
-   {html_options options=$sambaLogonTime_months output=$sambaLogonTime_months selected=$sambaLogonTime_month}
-   </select>
-{/render}
-{render acl=$sambaLogonTimeACL}
-   <select name=sambaLogonTime_year onChange="populate_sambaLogonTime(this.form,this.form.sambaLogonTime);">
-   {html_options values=$sambaLogonTime_years output=$sambaLogonTime_years selected=$sambaLogonTime_year}
-   </select>
-{/render}
-   <br>
-{render acl=$sambaLogoffTimeACL}
-   <input id="logoff_time_set" type=checkbox name="logoff_time_set" value="1" {$flagsO}>
-{/render}
-   <label for="logoff_time_set">{t}Limit Logoff Time{/t}</label>
-{render acl=$sambaLogoffTimeACL}
-   <select name=sambaLogoffTime_day onChange="createResult_sambaLogoffTime(this.form,this.form.sambaLogoffTime);">
-   {html_options values=$sambaLogoffTime_days output=$sambaLogoffTime_days selected=$sambaLogoffTime_day}
-   </select>
-{/render}
-{render acl=$sambaLogoffTimeACL}
-   <select name=sambaLogoffTime_month onChange="populate_sambaLogoffTime(this.form,this.form.sambaLogoffTime);">
-   {html_options options=$sambaLogoffTime_months output=$sambaLogoffTime_months selected=$sambaLogoffTime_month}
-   </select>
-{/render}
-{render acl=$sambaLogoffTimeACL}
-   <select name=sambaLogoffTime_year onChange="populate_sambaLogoffTime(this.form,this.form.sambaLogoffTime);">
-   {html_options values=$sambaLogoffTime_years output=$sambaLogoffTime_years selected=$sambaLogoffTime_year}
-   </select>
-{/render}
-   <br>
-   
-{render acl=$sambaKickoffTimeACL}
-   <input id="kickoff_time_set" type=checkbox name="kickoff_time_set" value="1" {$flagsK}>
-{/render}
-   <label for="kickoff_time_set">{t}Account expires after{/t}</label>
-{render acl=$sambaKickoffTimeACL}
-   <select name=sambaKickoffTime_day onChange="createResult_sambaKickoffTime(this.form,this.form.sambaKickoffTime);">
-   {html_options values=$sambaKickoffTime_days output=$sambaKickoffTime_days selected=$sambaKickoffTime_day}
-   </select>
-{/render}
-{render acl=$sambaKickoffTimeACL}
-   <select name=sambaKickoffTime_month onChange="populate_sambaKickoffTime(this.form,this.form.sambaKickoffTime);">
-   {html_options options=$sambaKickoffTime_months output=$sambaKickoffTime_months selected=$sambaKickoffTime_month}
-   </select>
-{/render}
-{render acl=$sambaKickoffTimeACL}
-   <select name=sambaKickoffTime_year onChange="populate_sambaKickoffTime(this.form,this.form.sambaKickoffTime);">
-   {html_options values=$sambaKickoffTime_years output=$sambaKickoffTime_years selected=$sambaKickoffTime_year}
-   </select>
-{/render}
-   <br>
-   <input type="hidden" name="sambaPwdMustChange" value="{$sambaPwdMustChange}">
-   <input type="hidden" name="sambaLogonTime" value="{$sambaLogonTime}">
-   <input type="hidden" name="sambaLogoffTime" value="{$sambaLogoffTime}">
-   <input type="hidden" name="sambaKickoffTime" value="{$sambaKickoffTime}">
-<br>
-{render acl=$sambaLogonHoursACL mode=read_active}
-   {t}Samba logon times{/t}&nbsp;<input type='submit' name='SetSambaLogonHours' value='{t}Edit settings...{/t}'>
-{/render}
-
-  </td>        
-  <td style="border-left:1px solid #A0A0A0">
-   &nbsp;
-  </td>
-  <td style="vertical-align:top;">
-   <label for="workstation_list">{t}Allow connection from these workstations only{/t}</label>
-   <br>
-{render acl=$sambaUserWorkstationsACL}
-   <select id="workstation_list" style="width:100%;" name="workstation_list[]" size=10 multiple>
-    {html_options values=$workstations output=$workstations}
-   </select>
-{/render}
-   <br>
-{render acl=$sambaUserWorkstationsACL}
-   <input type="submit" value="{t}Add{/t}" name="add_ws">
-{/render}
-{render acl=$sambaUserWorkstationsACL}
-   <input type="submit" value="{t}Delete{/t}" name="delete_ws">
-{/render}
-  </td>
- </tr>
-</table>
-
-<input type="hidden" name="sambaTab" value="sambaTab">
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- 
-  // Populate expiery dialog
-  populate(document.mainform,document.mainform.sambaPwdMustChange);
-
-  // Populate samba Time dialogs
-  populate_sambaLogonTime(document.mainform,document.mainform.sambaLogonTime);
-  populate_sambaLogoffTime(document.mainform,document.mainform.sambaLogoffTime);
-  populate_sambaKickoffTime(document.mainform,document.mainform.sambaKickoffTime);
-  -->
-</script>
diff --git a/plugins/personal/samba/samba3_workstations.tpl b/plugins/personal/samba/samba3_workstations.tpl
deleted file mode 100644 (file)
index f2ecfcc..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding="4">
-<tr>
-  <td style="vertical-align:top;width:600px">
-   <div class="contentboxh" style="height:20px;">
-    <p class="contentboxh" style="font-size:12px">
-     <b><label for="wslist">{t}Select workstations to add{/t}</label> {$hint}</b><br />
-    </p>
-   </div>
-   <div class="contentboxb">
-    <p class="contentboxb" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-     <select id="wslist" style="width:600px; margin-top:4px; height:450px;" name="wslist[]" size="15" multiple>
-       {html_options values=$wslist output=$wslist}
-     </select>
-    </p>
-   </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><img class="center" alt="{t}Display workstations of department{/t}" src="{$tree_image}" align="middle">&nbsp;
-    <select name="depselect" size=1 onChange="mainform.submit()" title="{t}Choose the department the search will be based on{/t}">
-      {html_options options=$deplist selected=$depselect}
-    </select></td></tr></table>
-    <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8"><tr><td width="18"><img class="center" alt="" src="{$search_image}" align="middle">&nbsp;</td>
-    <td><input type='text' name='regex' maxlength='20' style="width:99%" value='{$regex}' title='{t}Regular expression for matching addresses{/t}' onChange="mainform.submit()"></td></tr></table>
-   {$apply}
-   </div>
-  </td>
-</tr>
-</table>
-
-<p class="plugbottom">
-  <input type=submit name="add_ws_finish" value="{t}Add{/t}">
-  &nbsp;
-  <input type=submit name="add_ws_cancel" value="{t}Cancel{/t}">
-</p>
diff --git a/plugins/personal/samba/sambaLogonHours.tpl b/plugins/personal/samba/sambaLogonHours.tpl
deleted file mode 100644 (file)
index 1eb7306..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-
-<!-- Javacript function used to switch a complete row or col of selected hours -->
-<script language="javascript" type="text/javascript">
-  {literal}
-  var $regex = new Array();
-  function toggle_chk($reg)
-  {
-    if(!$regex[$reg]){
-      $regex[$reg] =1;
-    }
-    $regex[$reg] *= -1;
-    if($regex[$reg] == 1){
-      chk_set_all($reg,true);
-    }else{
-      chk_set_all($reg,false);
-    }
-  }
-  {/literal}
-</script>
-
-<h1>{t}Specify the hours this user is allowed to log in{/t}</h1>
-<br>
-
-<table cellspacing=0 cellpadding=0 style='border: solid 1px #B0B0B0; background-color: #EEEEEE; width :100%;' >
-  <tr>
-    <td>&nbsp;</td>
-    <td colspan=24 style='text-align:center;height:24px;border-bottom: solid 1px #B0B0B0;'><b>{t}Hour{/t}</b></td>
-  </tr>
-  <tr>
-    <td style='text-align: left;' class='list0'>&nbsp;</td>
-    {foreach from=$Hours item=hours key=key_hours}
-      {if (($hours)%2) == 0 }
-        <td style="text-align:center;height: 22px; background-color: rgb(226, 226, 226); ">
-      {else}
-        <td style="text-align:center;height: 22px; background-color: rgb(245, 245, 245); border-right: solid 1px #B0B0B0;">
-      {/if}
-      {$hours}
-    </td>
-    {/foreach}
-  </tr>
-
-  <!-- Add toggle buttons for hours -->
-  <tr>
-    <td style='text-align: left;' class='list0'>
-      &nbsp;
-    </td>
-    {foreach from=$Hours item=hours key=key_hours}
-      {if (($hours)%2) == 0 }
-        <td style="text-align:center; height: 22px; background-color: rgb(226, 226, 226); text-align: right;">
-      {else}
-        <td style="text-align:center; height: 22px; background-color: rgb(245, 245, 245); border-right: solid 1px #B0B0B0; text-align: right;">
-      {/if}
-
-{render acl=$sambaLogonHoursACL}
-      <input type='button' onClick="toggle_chk('^day_[0-9]*_{$hours}$');" value='+/-' style='width:100%;'>
-{/render}
-    </td>
-    {/foreach}
-    <td>
-
-{render acl=$sambaLogonHoursACL}
-      <input type='button' onClick="toggle_chk('^day_[0-9]*_[0-9]*$');" value='+/-' style='width:100%;'>
-{/render}
-    </td>
-  </tr>
-
-  <!-- Add Entries -->
-{foreach from=$Matrix item=days key=key_day}
-  <tr>
-    <td class='list0'>
-      <b>{$Days[$key_day]}</b>
-    </td>
-    {foreach from=$days item=hours key=key_hour}
-      {if (($key_hour)%2) == 0 }
-        <td style="text-align:center;height: 22px; background-color: rgb(226, 226, 226); ">
-      {else}
-        <td style="text-align:center;height: 22px; background-color: rgb(245, 245, 245); border-right: solid 1px;">
-      {/if}
-        {if $Matrix[$key_day].$key_hour}
-{render acl=$sambaLogonHoursACL}
-          <input id='day_{$key_day}_{$key_hour}' type='checkbox' name='day_{$key_day}_{$key_hour}' checked >
-{/render}
-        {else}
-{render acl=$sambaLogonHoursACL}
-          <input id='day_{$key_day}_{$key_hour}' type='checkbox' name='day_{$key_day}_{$key_hour}' >
-{/render}
-        {/if}
-      </td>
-    {/foreach}
-
-    <!-- Add toggle button for days -->
-    <td>  
-{render acl=$sambaLogonHoursACL}
-      <input type='button' onClick="toggle_chk('^day_{$key_day}_[0-9]*$')" value='+/-'  style='padding:0px;margin:0px;'>
-{/render}
-    </td>
-  </tr>
-{/foreach}
-</table>
-<br>
-<input type='hidden' name='sambaLogonHoursPosted' value='1'> 
-<br>
-<p class="plugbottom">
-  <input type=submit name="save_logonHours" value="{t}Apply{/t}">
-  &nbsp;
-  <input type=submit name="cancel_logonHours" value="{t}Cancel{/t}">
-</p>
-
-<!--  
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: 
--->
diff --git a/plugins/personal/scalix/class_scalixAccount.inc b/plugins/personal/scalix/class_scalixAccount.inc
deleted file mode 100644 (file)
index 2d85f0d..0000000
+++ /dev/null
@@ -1,509 +0,0 @@
-<?php
-/*! \brief   scalix plugin
-  \author  Jörn Dreyer <gosa.jfd@butonic.de>,
-           based on work by Cajus Pollmeier <pollmeier@gonicus.de>
-  \version 0.01
-  \date    20.10.2006
-
-  This class provides the functionality to read and write all attributes
-  relevant for scalixAccounts from/to the LDAP. It does syntax checking
-  and displays the formulars required.
- */
-
-class scalixAccount extends plugin
-{
-  /* Definitions */
-  var $plHeadline   = "Scalix";
-  var $plDescription= "This does something";
-
-  /* plugin specific values - scalixUserClass */
-  /* MUST */
-  var $scalixScalixObject= TRUE; //TRUE or FALSE
-  var $scalixMailnode= "";
-  /* INDIRECT MUST, scalix will complain if no email was specified */
-  
-  /* MAY */
-  var $scalixAdministrator= FALSE;
-  var $scalixMailboxAdministrator = FALSE;
-  var $scalixServerLanguage= "";
-  var $scalixEmailAddress= array();
-  var $scalixLimitMailboxSize= "";
-  var $scalixLimitOutboundMail= FALSE;
-  var $scalixLimitInboundMail= FALSE;
-  var $scalixLimitNotifyUser= FALSE;
-  var $scalixHideUserEntry= FALSE;
-  var $scalixMailboxClass= "";
-
-  var $uid  ="";
-  var $default_permissions= "none";
-  var $member_permissions= "post";
-  var $members= array();
-  var $admins= array();
-  var $vacations= array();
-  var $perms= array(  "lrs"       => "read", 
-                      "lrsp"      => "post", 
-                      "lrsip"     => "append",
-                      "lrswipcd"  => "write", 
-                      "lrswipcda" => "all" );
-
-  /* attribute list for save action */
-  var $attributes           = array("scalixMailnode", "scalixServerLanguage", "scalixLimitMailboxSize", "scalixMailboxClass");
-  var $fakeBooleanAttributes= array("scalixAdministrator", "scalixMailboxAdministrator", "scalixLimitOutboundMail",
-                                    "scalixLimitInboundMail", "scalixLimitNotifyUser", "scalixHideUserEntry");
-  var $objectclasses        = array("scalixUserClass");
-
-
-  /* constructor, if 'dn' is set, the node loads the given
-     'dn' from LDAP */
-  function scalixAccount (&$config, $dn= NULL)
-  {
-    /* dn shouldn't be NULL */
-    if($dn === NULL){
-      trigger_error("Initialising scalixAccount without valid dn.");
-    }
-
-    /* Load bases attributes */
-    plugin::plugin($config, $dn);
-
-    /* Load attributes */
-    if ($dn != "new"){
-
-      /* Set user id */
-      if(isset($this->attrs['uid'][0])){
-        $this->uid = $this->attrs['uid'][0];
-      }
-       
-      foreach ($this->fakeBooleanAttributes as $val){
-        if (isset($this->attrs["$val"][0])&&$this->attrs["$val"][0]=="TRUE"){
-          $this->$val = TRUE;
-        } else {
-          $this->$val = FALSE;
-        }
-      }
-
-      /* Load attributes containing arrays */
-      foreach (array("scalixEmailAddress") as $val){
-        if (isset($this->attrs["$val"]["count"])){
-          for ($i= 0; $i<$this->attrs["$val"]["count"]; $i++){
-            array_push($this->$val, $this->attrs["$val"][$i]);
-          }
-        }
-      }
-    }
-
-    /* Save initial account state */
-    $this->initially_was_account= $this->is_account;
-  }
-
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* Load templating engine */
-    $smarty= get_smarty();
-    $display= "";
-
-    /* Do we need to flip is_account state? */
-    if (isset($_POST['modify_state'])){
-      $this->is_account= !$this->is_account;
-    }
-
-    /* Show main page */
-    $mailboxClasses = array("", "LIMITED", "FULL");
-    $serverLanguages= array("", "GERMAN", "ENGLISH");
-
-    /* Do we represent a valid account? */
-    if (!$this->is_account && $this->parent === NULL){
-      $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\">&nbsp;<b>".
-        _("This account has no scalix extensions.")."</b>";
-
-      $display.= back_to_main();
-      return ($display);
-    }
-
-    /* Show tab dialog headers */
-    if ($this->parent !== NULL){
-      if ($this->is_account){
-        $display= $this->show_disable_header(_("Remove scalix account"),
-            _("This account has scalix synchronization enabled. You can disable it by clicking below."));
-      } else {
-        $display= $this->show_enable_header(_("Create scalix account"), _("This account has scalix synchronization disabled. You can enable it by clicking below."));
-        return ($display);
-      }
-    }
-
-    /* Trigger forward add dialog? */
-    if (isset($_POST['add_local_forwarder'])){
-      $this->forward_dialog= TRUE;
-      $this->dialog= TRUE;
-    }
-
-    /* Cancel forward add dialog? */
-    if (isset($_POST['add_locals_cancel'])){
-      $this->forward_dialog= FALSE;
-      $this->dialog= FALSE;
-    }
-
-
-    $smarty->assign("mailboxClasses", $mailboxClasses);
-    $smarty->assign("serverLanguages", $serverLanguages);
-    foreach(array("perms", "scalixScalixObject", "scalixMailnode", "scalixAdministrator", "scalixMailboxAdministrator",
-      "scalixServerLanguage", "scalixLimitMailboxSize", "scalixLimitOutboundMail", "scalixEmailAddress",
-      "scalixLimitInboundMail", "scalixLimitNotifyUser", "scalixHideUserEntry", "scalixMailboxClass") as $val){
-
-      $smarty->assign("$val", $this->$val);
-      $smarty->assign("$val"."ACL", $this->getacl($val));
-    }
-
-    /* Fill checkboxes */
-    if ($this->scalixAdministrator) {
-      $smarty->assign("scalixAdministrator", "checked");
-    } else {
-      $smarty->assign("scalixAdministrator", "");
-    }
-    if ($this->scalixMailboxAdministrator) {
-      $smarty->assign("scalixMailboxAdministrator", "checked");
-    } else {
-      $smarty->assign("scalixMailboxAdministrator", "");
-    }
-    if ($this->scalixLimitOutboundMail) {
-      $smarty->assign("scalixLimitOutboundMail", "checked");
-    } else {
-      $smarty->assign("scalixLimitOutboundMail", "");
-    }
-    if ($this->scalixLimitInboundMail) {
-      $smarty->assign("scalixLimitInboundMail", "checked");
-    } else {
-      $smarty->assign("scalixLimitInboundMail", "");
-    }
-    if ($this->scalixLimitNotifyUser) {
-      $smarty->assign("scalixLimitNotifyUser", "checked");
-    } else {
-      $smarty->assign("scalixLimitNotifyUser", "");
-    }
-    if ($this->scalixHideUserEntry) {
-      $smarty->assign("scalixHideUserEntry", "checked");
-    } else {
-      $smarty->assign("scalixHideUserEntry", "");
-    }
-
-    $display.= $smarty->fetch (get_template_path('generic.tpl', TRUE, dirname(__FILE__)));
-    return ($display);
-  }
-
-
-  /* remove object from parent */
-  function remove_from_parent()
-  {
-    /* Cancel if there's nothing to do here */
-    if (!$this->initially_was_account){
-      return;
-    }
-    
-    /* include global link_info */
-    $ldap= $this->config->get_ldap_link();
-
-    /* Remove and write to LDAP */
-    plugin::remove_from_parent();
-
-    /* Zero arrays */
-    $this->attrs['scalixEmailAddress']= array();
-
-    /* Unset fake boolean attributes from entry */
-    foreach ($this->fakeBooleanAttributes as $val){
-      $this->attrs["$val"]= array();
-    }
-
-    /*unset scalixScalixObject*/
-    $this->attrs['scalixScalixObject']=array();
-
-    @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,$this->attributes, "Save");
-    $ldap->cd($this->dn);
-    $ldap->modify($this->attrs);
-    show_ldap_error($ldap->get_error());
-
-    /* Optionally execute a command after we're done */
-    $this->handle_post_events("remove");
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    if (isset($_POST['scalixTab'])){
-
-      /* Save ldap attributes */
-      plugin::save_object();
-
-      /* Save fakeBooleanAttributes*/
-      foreach ($this->fakeBooleanAttributes as $val){
-        if ($this->acl_is_writeable($val)) {
-          if( isset ($_POST["$val"])) {
-            $data = TRUE;
-          } else {
-            $data = FALSE;
-          }
-          if ($this->$val != $data){
-            $this->is_modified= TRUE;
-          }
-
-          $this->$val= $data;
-        }
-      }
-    }
-  }
-
-
-  /* Save data to LDAP, depending on is_account we save or delete */
-  function save()
-  {
-    $ldap= $this->config->get_ldap_link();
-
-    /* Call parents save to prepare $this->attrs */
-    plugin::save();
-
-    /* Save arrays */
-    $this->attrs['scalixEmailAddress']= $this->scalixEmailAddress;    
-    
-    /* Save boolean vars ... the scalix schema expects them as strings */
-    $this->attrs['scalixScalixObject'] = $this->scalixScalixObject?"TRUE":"FALSE";
-    $this->attrs['scalixAdministrator'] = $this->scalixAdministrator?"TRUE":"FALSE";
-    $this->attrs['scalixMailboxAdministrator'] = $this->scalixMailboxAdministrator?"TRUE":"FALSE";
-    $this->attrs['scalixLimitOutboundMail'] = $this->scalixLimitOutboundMail?"TRUE":"FALSE";
-    $this->attrs['scalixLimitInboundMail'] = $this->scalixLimitInboundMail?"TRUE":"FALSE";
-    $this->attrs['scalixLimitNotifyUser'] = $this->scalixLimitNotifyUser?"TRUE":"FALSE";
-    $this->attrs['scalixHideUserEntry'] = $this->scalixHideUserEntry?"TRUE":"FALSE";
-
-    /* Remove Mailquota if = "" */
-    if((isset($this->attrs['scalixLimitMailboxSize']))&&($this->attrs['scalixLimitMailboxSize']=="")) {
-      $this->attrs['scalixLimitMailboxSize']=array();
-    }
-
-    /* Save data to LDAP */
-    $ldap->cd($this->dn);
-    $ldap->modify($this->attrs);
-    show_ldap_error($ldap->get_error());
-
-    /* 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");
-    }
-
-  }
-
-  /* Check formular input */
-  function check()
-  {
-    $ldap= $this->config->get_ldap_link();
-
-    $message= array();
-
-    if(empty($this->scalixMailnode)){
-      $message[]= _("There is no scalix mailnode specified.");
-    }
-    if(empty($this->scalixScalixObject)){
-      $message[]= _("scalixScalixObject must be set!");
-    }
-
-    $ldap->cd($this->config->current['BASE']);
-    foreach($this->scalixEmailAddress as $k => $mail) {        
-      $ldap->search ("(&(!(objectClass=gosaUserTemplate))(objectClass=scalixUserClass)(scalixEmailAddress=".
-        $mail.")(!(uid=".$this->uid."))(!(cn=".$this->uid.")))", array("uid"));
-  
-      if ($ldap->count() != 0){
-        $message[]= _("The email address '$mail' you've entered is already in use.");
-      }
-    }
-
-    /* Check quota */
-    if ($this->scalixLimitMailboxSize != '' && $this->acl_is_writeable("scalixLimitMailboxSize")){
-      if (!is_numeric($this->scalixLimitMailboxSize)) {
-        $message[]= _("Value in 'Limit Mailbox size' is not valid.");
-      } else {
-        $this->scalixLimitMailboxSize= (int) $this->scalixLimitMailboxSize;
-      }
-    }
-
-    return ($message);
-  }
-
-  /* Adapt from template, using 'dn' */
-  function adapt_from_template($dn)
-  {
-    plugin::adapt_from_template($dn);
-
-    foreach (array("scalixEmailAddress") as $val){
-      $this->$val= array();
-      if (isset($this->attrs["$val"]["count"])){
-        for ($i= 0; $i<$this->attrs["$val"]["count"]; $i++){
-          $value= $this->attrs["$val"][$i];
-          foreach (array("sn", "givenName", "uid") as $repl){
-            if (preg_match("/%$repl/i", $value)){
-              $value= preg_replace ("/%$repl/i", $this->parent->$repl, $value);
-            }
-          }
-          array_push($this->$val, strtolower(rewrite($value)));
-        }
-      }
-    }
-    $this->mail= strtolower(rewrite($this->mail));
-  }
-
-  function addEmail($address)
-  {
-    $ldap= $this->config->get_ldap_link();
-
-    $address= strtolower($address);
-
-    /* Is this address already assigned in LDAP? */
-    $ldap->cd ($this->config->current['BASE']);
-    $ldap->search ("(&(objectClass=scalixUserClass)(|(scalixEmailAddress=$address)".
-        "(scalixEmailAddress=$address)))", array("uid"));
-
-    if ($ldap->count() > 0){
-      $attrs= $ldap->fetch ();
-      return ($attrs["uid"][0]);
-    }
-
-    /* Add to list of alternates */
-    if (!in_array($address, $this->scalixEmailAddress)){
-      $this->scalixEmailAddress[]= $address;
-      $this->is_modified= TRUE;
-    }
-
-    //sort ($this->scalixEmailAddress); //scalix makes the first email the destination, all others can receive
-    reset ($this->scalixEmailAddress);
-
-    return ("");
-  }
-
-
-  function delEmail($addresses)
-  {
-    $this->scalixEmailAddress= array_remove_entries ($addresses, $this->scalixEmailAddress);
-    $this->is_modified= TRUE;
-  }
-
-
-  static function plInfo()
-  {
-    return (array(
-          "plDescription"     => _("Scalix account"),
-          "plSelfModify"      => TRUE,
-          "plDepends"         => array("user"),
-          "plPriority"        => 2,
-          "plSection"         => array("personal" => _("My account")),
-          "plCategory"        => array("users"),
-          "plOptions"         => array(),
-
-          "plProvidedAcls"  => array(
-
-            "scalixMailnode"            => _("Scalix Mail node"),
-            "scalixMailboxClass"        => _("Mailbox class"),
-            "scalixServerLanguage"      => _("Server language"),
-            "scalixAdministrator"       => _("Administrator"),
-            "scalixMailboxAdministrator"=> _("Mailbox administrator"),
-            "scalixHideUserEntry"       => _("Hide user entry in Scalix"),
-            "scalixLimitMailboxSize"    => _("Mailbox size limitations"),
-            "scalixLimitOutboundMail"   => _("Limit outbound"),
-            "scalixLimitInboundMail"    => _("Limit inbound"),
-            "scalixLimitNotifyUser"     => _("Notify user"),
-            "scalixEmailAddress"        => _("Scalix email addresses"))
-
-            ));
-  }
-
-
-  function saveCopyDialog()
-  {
-    if (isset($_POST['scalixTab'])){
-
-      /* Add email addresses */
-      if (isset($_POST['add_email'])){
-
-        /* Check write access */
-#        if(!$this->acl_is_writeable("scalixEmailAddress")){
-#          print_red(_("You are not allowed to modify alternate addresses"));
-#        }else{
-
-          /* Check if given value is not empty */
-          if ($_POST['email_address'] != ""){
-            $valid= FALSE;
-
-            /* Valid mail address */
-            if( ($this->is_template && !is_email($_POST['email_address'], TRUE)) || 
-                (!$this->is_template && !is_email($_POST['email_address'])) ){
-              print_red (_("You're trying to add an invalid email address to the list of alternate addresses."));
-            }else{
-              $valid = TRUE;
-            }
-
-            /* Mail address already in use ? */
-            if ($valid && ($user= $this->addEmail ($_POST['email_address'])) != ""){
-              $ui= get_userinfo();
-              if ($user != $ui->username){
-                print_red (_("The address you're trying to add is already used by user")." '$user'.");
-              }
-            }
-#          }
-        }
-      }
-  
-      /* Delete email addresses */
-      if (isset($_POST['delete_email']) && isset ($_POST['emails_list'])){
-#        if(!$this->acl_is_writeable("scalixEmailAddress")){
-#          print_red(_("You are not allowed to modify alternate addresses"));
-#        }else{
-          if (count($_POST['emails_list'])){
-            $this->delEmail ($_POST['emails_list']);
-#          }
-        }
-      }
-    }
-  }
-
-
-  function PrepareForCopyPaste($source)
-  {
-    plugin::PrepareForCopyPaste($source);
-    foreach ($this->fakeBooleanAttributes as $val){
-      if (isset($source["$val"][0])&&$source["$val"][0]=="TRUE"){
-        $this->$val = TRUE;
-      } else {
-        $this->$val = FALSE;
-      }
-    }
-
-    /* Load attributes containing arrays */
-    foreach (array("scalixEmailAddress") as $val){
-      if (isset($source["$val"]["count"])){
-        for ($i= 0; $i<$source["$val"]["count"]; $i++){
-          array_push($this->$val, $source["$val"][$i]);
-        }
-      }
-    }
-  }
-
-
-  /* Create the posix dialog part for copy & paste */
-  function getCopyDialog()
-  {
-    $smarty = get_smarty(); 
-    $smarty->assign("scalixEmailAddress",$this->scalixEmailAddress);
-    $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE,dirname(__FILE__)));    
-    $ret = array();
-    $ret['string'] = $str;
-    $ret['status'] = "";
-    return($ret);
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:rulere
-?>
diff --git a/plugins/personal/scalix/generic.tpl b/plugins/personal/scalix/generic.tpl
deleted file mode 100644 (file)
index 669d2ea..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding="0" border="0">
- <tr>
-  <td style="width:50%; vertical-align:top;">
-   <h2><img class="center" alt="" align="middle" src="images/rightarrow.png" />&nbsp;{t}Generic{/t}</h2>
-   <table summary="">
-    <tr>
-     <td><label for="scalixMailnode">{t}Scalix mailnode{/t}</label>{$must}</td>
-     <td>
-{render acl=$scalixMailnodeACL}
-               <input id="scalixMailnode" name="scalixMailnode" size=35 maxlength=65 value="{$scalixMailnode}">
-{/render}
-        </td>
-    </tr>
-    <tr>
-     <td><label for="scalixMailboxClass">{t}Salix mailbox class{/t}</label></td>
-     <td>
-{render acl=$scalixMailboxClassACL}
-      <select size="1" id="scalixMailboxClass" name="scalixMailboxClass"  
-                       title="{t}Limited users con not make use of the group calendar functionality in Scalix{/t}">
-                   {html_options values=$mailboxClasses output=$mailboxClasses selected=$scalixMailboxClass}
-      </select>
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><label for="scalixServerLanguage">{t}Scalix server language{/t}</label></td>
-     <td>
-{render acl=$scalixServerLanguageACL}
-      <select size="1" id="scalixServerLanguage" name="scalixServerLanguage" 
-                       title="{t}Message catalog language for client.{/t}">
-                   {html_options values=$serverLanguages output=$serverLanguages selected=$scalixServerLanguage}
-      </select>
-{/render}
-     </td>
-    </tr>
-   </table>
-   
-   <p class="seperator">&nbsp;</p>
-   
-   <table summary="">
-    <tr>
-     <td>
-{render acl=$scalixAdministratorACL}
-         <input type=checkbox name="scalixAdministrator" value="1" {$scalixAdministrator}
-          title="{t}Select for admin capability.{/t}"> {t}Scalix Administrator{/t}
-{/render}
-         <br>
-{render acl=$scalixMailboxAdministratorACL}
-         <input type=checkbox name="scalixMailboxAdministrator" value="1" {$scalixMailboxAdministrator}
-          title="{t}Select for mailbox admin capability.{/t}"> {t}Scalix Mailbox Administrator{/t}
-{/render}
-         <br>
-{render acl=$scalixHideUserEntryACL}
-         <input type=checkbox name="scalixHideUserEntry" value="1" {$scalixHideUserEntry}
-          title="{t}Hide user entry from addressbook.{/t}"> {t}Hide this user entry in Scalix{/t}
-{/render}
-         <br>
-   </table>
-   
-   <p class="seperator">&nbsp;</p>
-   
-   <table summary="">
-    <tr>
-     <td><label for="scalixLimitMailboxSize">{t}Limit mailbox size{/t}</label></td>
-     <td>
-{render acl=$scalixLimitMailboxSizeACL}
-               <input id="scalixLimitMailboxSize" name="scalixLimitMailboxSize" size=5 maxlength=10 value="{$scalixLimitMailboxSize}">&nbsp;{t}MB{/t}
-{/render}
-        </td>
-    </tr>
-    <tr>
-     <td >
-{render acl=$scalixLimitOutboundMailACL}
-         <input type=checkbox name="scalixLimitOutboundMail" value="1" {$scalixLimitOutboundMail}
-          title="{t}As sanction on mailbox quota overuse, stop user from sending mail.{/t}"> {t}Limit Outbound Mail{/t}
-{/render}
-         <br>
-{render acl=$scalixLimitInboundMailACL}
-         <input type=checkbox name="scalixLimitInboundMail" value="1" {$scalixLimitInboundMail}
-          title="{t}As sanction on mailbox quota overuse, stop user from receiving mail.{/t}"> {t}Limit Inbound Mail{/t}
-{/render}
-         <br>
-{render acl=$scalixLimitNotifyUserACL}
-         <input type=checkbox name="scalixLimitNotifyUser" value="1" {$scalixLimitNotifyUser}
-          title="{t}As sanction on mailbox quota overuse, notify the user by eMail.{/t}"> {t}Notify User{/t}
-{/render}
-         <br>
-     </td>
-    </tr>
-   </table>
-  </td>
-
-  <td style="border-left:1px solid #A0A0A0">
-   &nbsp;
-  </td>
-
-  <td style="vertical-align:top;">
-   <h2><img class="center" alt="" align="middle" src="images/envelope.png" /><label for="emails_list"> {t}Scalix email addresses{/t}</label></h2>
-{render acl=$scalixEmailAddressACL}
-   <select id="emails_list" style="width:100%;height:100px;" name="emails_list[]" size="15"
-                multiple title="{t}List of scalix email addresses{/t}" >
-            {html_options values=$scalixEmailAddress output=$scalixEmailAddress}
-                       <option disabled>&nbsp;</option>
-   </select>
-{/render}
-   <br />
-{render acl=$scalixEmailAddressACL}
-   <input name="email_address" size="30" align="middle" maxlength="65" value="">
-{/render}
-{render acl=$scalixEmailAddressACL}
-   <input type=submit value="{t}Add{/t}" name="add_email">&nbsp;
-{/render}
-{render acl=$scalixEmailAddressACL}
-   <input type=submit value="{t}Delete{/t}" name="delete_email">
-{/render}
-  </td>
- </tr>
-</table>
-
-<input type="hidden" name="scalixTab" value="scalixTab">
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('scalixMailnode');
-  -->
-</script>
diff --git a/plugins/personal/scalix/main.inc b/plugins/personal/scalix/main.inc
deleted file mode 100644 (file)
index 0d2558a..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-<?php
-/*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2006  Jörn Dreyer, based on work by
-                       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
- */
-
-if (!$remove_lock){
-  /* Reset requested? */
-  if (isset($_POST['edit_cancel']) || 
-      (isset($_GET['reset']) && $_GET['reset'] == 1)){
-    del_lock ($ui->dn);
-    sess_del ('edit');
-    sess_del ('scalixAccount');
-  }
-
-  /* Create mail object on demand */
-  if (!isset($_SESSION['scalixAccount']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
-    $_SESSION['scalixAccount']= new scalixAccount ($config, $ui->dn);
-    $_SESSION['scalixAccount']->enable_CSN_check();
-    $_SESSION['scalixAccount']->set_acl_base($ui->dn);
-    $_SESSION['scalixAccount']->set_acl_category("users");
-  }
-  $scalixAccount= $_SESSION['scalixAccount'];
-
-  /* save changes back to object */
-  if (isset ($_SESSION['edit'])){
-    $scalixAccount->save_object ();
-  }
-
-  /* Enter edit mode? */
-  if (isset($_POST['edit'])){
-
-    /* Check locking */
-    if (($username= get_lock($ui->dn)) != ""){
-      $_SESSION['back_plugin']= $plug;
-      $_SESSION['LOCK_VARS_TO_USE'] = array("/^edit$/","/^plug$/");
-      $lock_msg =  gen_locked_message ($username, $ui->dn);
-
-    }else{
-
-      /* Lock the current entry */
-      add_lock ($ui->dn, $ui->dn);
-      $_SESSION['dn']= $ui->dn;
-      $_SESSION['edit']= TRUE;
-    }
-  }
-
-  /* save changes to LDAP and disable edit mode */
-  if (isset($_POST['edit_finish'])){
-
-    /* Perform checks */
-    $message= $scalixAccount->check ();
-
-    /* No errors, save object */
-    if (count ($message) == 0){
-      $scalixAccount->save ();
-      gosa_log ("User/scalix object'".$ui->dn."' has been saved");
-      $scalixAccount->acl= "#none#";
-      del_lock ($ui->dn);
-      sess_del ('edit');
-
-      /* Remove object */
-      sess_del ('scalixAccount');
-    } else {
-      /* Errors found, show message */
-      show_errors ($message);
-    }
-  }
-
-  /* Execute formular */
-  $display= $scalixAccount->execute ();
-
-  /* Store changes  in session */
-  if (isset ($_SESSION['edit'])){
-    $_SESSION['scalixAccount']= $scalixAccount;
-  }
-
- /* Show page footer depending on the mode */
-  if ($scalixAccount->is_account){
-
-    $display.= "<p class=\"plugbottom\">";
-
-    /* Are we in edit mode? */
-    if (isset($_SESSION['edit'])){
-      $display.= "<input type=submit name=\"edit_finish\" value=\""._("Save")."\">\n";
-      $display.= "&nbsp;";
-      $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
-      $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png').
-             "\"> ".$ui->dn."&nbsp;";
-    } else {
-      $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/openlock.png').
-             "\"> ".$ui->dn."&nbsp;";
-
-      if(preg_match("/w/",$ui->get_permissions($ui->dn,"users/scalix"))){
-        $info.= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/lamp.png')."\"> ".
-                _("Click the 'Edit' button below to change informations in this dialog");
-
-        $display.= "<input type=submit name=\"edit\" value=\""._("Edit")."\">\n";
-      }
-      $display.= "<input type=\"hidden\" name=\"ignore\">\n";
-    }
-    $display.= "</p>\n";
-  }
-
-
-  $info= "";
-
-  /* Page header*/
-  $display= print_header(get_template_path('images/scalix.png'), _("Scalix settings"), $info).$display;
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/personal/scalix/paste_generic.tpl b/plugins/personal/scalix/paste_generic.tpl
deleted file mode 100644 (file)
index 4bdf489..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-<table>
-       <tr>
-  <td style="vertical-align:top;">
-   <h2><img class="center" alt="" align="middle" src="images/envelope.png" /><label for="emails_list"> {t}Scalix email addresses{/t}</label></h2>
-   <select id="emails_list" style="width:100%;height:100px;" name="emails_list[]" size="15"
-                multiple title="{t}List of scalix email addresses{/t}" >
-            {html_options values=$scalixEmailAddress output=$scalixEmailAddress}
-                       <option disabled>&nbsp;</option>
-   </select>
-   <br />
-   <input name="email_address" size="30" align="middle" maxlength="65" value="">
-   <input type=submit value="{t}Add{/t}" name="add_email">&nbsp;
-   <input type=submit value="{t}Delete{/t}" name="delete_email">
-  </td>
- </tr>
-</table>
-
-<input type="hidden" name="scalixTab" value="scalixTab">
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-  document.mainform.scalixMailnode.focus();
-  -->
-</script>
diff --git a/setup/class_setup.inc b/setup/class_setup.inc
deleted file mode 100644 (file)
index 753751c..0000000
+++ /dev/null
@@ -1,306 +0,0 @@
-<?php
-/*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2007 Fabian Hickert
-
-   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
-*/
-
-
-require_once("class_setupStep.inc");
-
-
-class setup 
-{
-  var $i_steps  = 9;  // Number of setup steps 
-  var $i_current= 1;  // Current step
-  var $i_last   = 1;  // Last setup step;
-  var $o_steps  = array(); 
-  var $captured_values = array();
-
-  function setup()
-  {
-    $i = 1; 
-    $this->o_steps[$i++] = new Step_Welcome();
-    $this->o_steps[$i++] = new Step_Language();
-    $this->o_steps[$i++] = new Step_Checks();
-    $this->o_steps[$i++] = new Step_License();
-    $this->o_steps[$i++] = new Step_Ldap();
-    $this->o_steps[$i++] = new Step_Schema();
-    $this->o_steps[$i++] = new Step_Config1();
-    $this->o_steps[$i++] = new Step_Config2();
-    $this->o_steps[$i++] = new Step_Config3();
-    $this->o_steps[$i++] = new Step_Migrate();
-    $this->o_steps[$i++] = new Step_Feedback();
-    $this->o_steps[$i++] = new Step_Finish();
-    $this->i_steps = $i-1;
-
-    /* Ensure that setup is not reachable if gosa.conf (CONFIG_FILE) */
-    if(file_exists(CONFIG_DIR."/".CONFIG_FILE)){
-      session_destroy();
-      header("Location: index.php")    ;
-      exit();
-    }
-    
-    foreach($this->o_steps as $key => $step){
-      $this->o_steps[$key]->parent = &$this;
-    }
-  }
-
-  function execute()
-  {
-    /* Display phpinfo() dialog when $_GET['info'] is set,
-     *  but only do this, if user is allowed to use the setup.
-     * If setupStep_Welcome is_completed, we are allowed to view those infos-
-     */
-    if(isset($_GET['info']) &&  preg_match("/Step_Welcome/i",get_class($this->o_steps[1])) && $this->o_steps[1]->is_completed()){
-      phpinfo();
-      exit();
-    }
-
-    /* display step error msgs */
-    $msgs = $this->o_steps[$this->i_current]->check();
-    foreach($msgs as $msg){
-      print_red($msg);
-    }
-
-    $this->o_steps[$this->i_last]->set_active(FALSE);
-    $this->o_steps[$this->i_current]->set_active();
-    $content = $this->o_steps[$this->i_current]->execute();
-    return($content);
-  }
-
-
-  /* Save posted attributes  */
-  function save_object()
-  {
-    /* Call save_object for current setup step */
-    $this->o_steps[$this->i_current] -> save_object();
-
-    /* Get attributes from setup step */
-    $tmp = $this->o_steps[$this->i_current]->get_attributes();
-    foreach($tmp as $name => $value){
-      $this->captured_values[$name] = $value;
-    }
-
-    /* Set parent */
-    foreach($this->o_steps as $key => $value){
-      $this->o_steps[$key]->parent = $this;
-    }
-
-    /* Check if image button requests next page */
-    foreach($_POST as $name => $value){
-      if(preg_match("/^next_(x|y)/",$name)){
-        $_POST['next'] = TRUE;
-      }
-      if(preg_match("/^last_(x|y)/",$name)){
-        $_POST['last'] = TRUE;
-      }
-    }
-
-    /* Check if step was selected */
-    if(isset($_GET['step']) || isset($_POST['next']) || isset($_POST['last'])){
-
-      /* check if current setup step is completed now 
-          and activate the next step if possible */
-      for($i = 1 ; $i <= $this->i_steps ; $i ++ ){
-        if($this->o_steps[$i]->is_completed()){
-          if(isset($this->o_steps[($i+1)])){
-            $this->o_steps[($i+1)]->set_enabled();
-          }
-        }else{
-          $this->disable_steps_from($i+1);
-        }
-      }
-    }
-    /* Disable all following steps, if one step isn't compelted right now .*/
-    for($i = 1 ; $i <= $this->i_steps ; $i ++ ){
-      if($this->o_steps[$i]->is_completed()){
-      }else{
-        $this->disable_steps_from($i+1);
-      }
-    }
-    $step = -1;
-
-    if(isset($_POST['setup_goto_step'])){
-      $step= $_POST['setup_goto_step'];
-    }
-
-    if(isset($_GET['step'])){
-      $step = $_GET['step'];
-    }elseif(isset($_POST['next'])){
-      $step = $this->i_current + 1;
-    }elseif(isset($_POST['last'])){
-      $step = $this->i_current - 1;
-    }
-  
-    $once = true;
-    foreach($_POST as $name => $value){
-      if(preg_match("/^step_[0-9]*$/",$name) && $once ){
-        $step = preg_replace("/^step_/","",$name);
-      }
-    }
-
-    if($this->selectable_step($step)){
-      $this->i_last    = $this->i_current;
-      $this->i_current = $step;
-    }
-  }
-
-
-  function disable_steps_from($start)
-  {
-    $found = false;
-    foreach($this->o_steps as $key => $step){
-      if($key == $start){
-        $found = true;
-      }
-
-      if($found){ 
-        $this->o_steps[$key]->set_enabled(false);
-        $this->o_steps[$key]->set_completed(false);
-      }
-    }
-  }
-
-
-  /* Create navigation menu */
-  function get_navigation_html()
-  {
-    $str = "";
-    foreach($this->o_steps as $key => $step){
-
-      $step -> update_strings();
-
-      $s_title    = $step -> get_title();
-      $s_info     = $step -> get_small_info();
-      $b_active   = $step -> is_active();
-      $b_enabled  = $step -> is_enabled();
-      $b_completed= $step -> is_completed();
-
-      if($b_completed){
-        $s = "<img src='images/true.png' alt='"._("Completed")."' class='center'>&nbsp;"; 
-      }else{
-        $s = "<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
-      }
-
-      if($_SESSION['js']){
-
-        $str .="<div >";
-    
-        if($b_enabled){
-          if($b_active){
-            $str .= "<div class='navigation_element_active'>";
-            $str .= "<div class='navigation_title_active'>".$s.$s_title."</div>";
-            $str .= "<div class='navigation_info'>".$s_info."</div>";
-            $str .= "</div>";
-          }else{
-            $str .= "<div class='navigation_element'>";
-            $str .= "<div onClick='document.mainform.setup_goto_step.value=\"$key\";document.mainform.submit();'
-              class='navigation_title_inactive'>".$s.$s_title."</div>";
-            $str .= "</div>";
-          }
-        }else{
-          $str .= "<div class='navigation_element'>";
-          $str .= "<div class='navigation_title_disabled'>".$s.$s_title."</div>";
-          $str .= "</div>";
-        }
-        $str .= "</div>" ;
-      }else{
-        $str .="<div >";
-        if($b_enabled){
-          if($b_active){
-            $str .= "<div class='navigation_element_active'>";
-            $str .= "<input style='text-align: left; color: #00008F; font-weight: bold; width:100%;' 
-                        type='button' value='".$s_title."' name='step_".$key."'>";
-            $str .= "</div>";
-          }else{
-            $str .= "<div class='navigation_element'>";
-            $str .= "<input style='text-align: left; color: #00008F; font-weight: bold; width:100%;' 
-                        type='submit' value='".$s_title."' name='step_".$key."'>";
-            $str .= "</div>";
-          }
-        }else{
-          $str .= "<div class='navigation_element'>";
-          $str .= "<div class='navigation_title_disabled'>".$s_title."</div>";
-          $str .= "</div>";
-        }
-        $str .= "</div>" ;
-      }
-    }
-    return($str);
-  }
-
-  
-
-  function get_bottom_html()
-  {
-    /* Skip adding forward/backward button,   
-     *  if the currently opened step is a sub dialog 
-     */
-    if($this->o_steps[$this->i_current]->dialog){
-      $str ="";
-    }else{
-      $str ="<p class='seperator' style='margin-bottom:10px;'>&nbsp;</p>";
-      $str.="   <div style='text-align:right;float:top;'>";
-      if(isset($this->o_steps[$this->i_current -1]) && $this->o_steps[$this->i_current -1]->is_enabled()){
-        $str .= "<input type='submit' name='last' value='"._("Back")."'>";
-      }else{
-        $str .= "<input type='button' name='last' value='"._("Back")."' disabled>";
-      }
-      $str.= "&nbsp;";
-        $str .= "<input type='submit' name='next' value='"._("Continue")."'>";
-      $str .="</div>";
-    }
-    return($str);
-  }
-
-  
-  /* Create header entry */
-  function get_header_html()
-  {
-    $str=   $this->o_steps[$this->i_current]->print_header();
-    return ($str);
-  }
-
-
-  /* Check if the given step id is valid and selectable */
-  function selectable_step($id)
-  {
-    if(isset($this->o_steps[$id]) && $this->o_steps[$id]->is_enabled()){
-      return(true);
-    }
-    return(false);
-  }
-
-  function step_name_to_id($name)
-  {
-    foreach($this->o_steps as $id => $class){
-      if(get_class($class) == $name){
-        return($id);
-      }
-    }
-    return(0);
-  }
-  
-}
-
-
-
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/setup/class_setupStep.inc b/setup/class_setupStep.inc
deleted file mode 100644 (file)
index 5364187..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-<?php
-
-/*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2007 Fabian Hickert
-
-   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 setup_step extends plugin
-{
-  var $s_title      = "Still undefined";
-  var $s_title_long = "This is a still undefined long title";
-  var $s_info       = "This info is still undefined. This setup step detect the type of your ldap. This is a basic requirement for gosa.";
-  var $is_active    = false;
-  var $is_enabled   = false;
-  var $is_completed = false;
-
-  var $header_image = "images/personal.png";
-
-  var $attributes   = array();
-  var $parent       = NULL;
-  var $dialog       = FALSE;
-  
-  function setup_step()
-  {
-  }
-
-  function execute()
-  { 
-  }
-
-  function save_object()
-  {
-    /* Do not call plugin::save_object. This causes acl trouble  */
-  }
-
-  function get_title()
-  { 
-    return($this->s_title);
-  }
-
-  function get_long_title()
-  { 
-    return($this->s_title_long);
-  }
-
-  function get_small_info()
-  { 
-    return($this->s_info);
-  }
-  
-  function is_active()
-  {
-    return($this->is_active);
-  }
-
-  function is_enabled()
-  {
-    return($this->is_enabled);
-  }
-
-  function is_completed()
-  {
-    return($this->is_completed);
-  }
-
-  function set_active($value = TRUE)
-  {
-    if($value){ 
-      $this->is_active = TRUE;  
-    }else{
-      $this->is_active = FALSE;  
-    }
-  }
-
-  function set_enabled($value = TRUE)
-  {
-    if($value){ 
-      $this->is_enabled = TRUE;  
-    }else{
-      $this->is_enabled = FALSE;  
-    }
-  }
-
-  function set_completed($value = TRUE)
-  {
-    if($value){ 
-      $this->is_completed = TRUE;  
-    }else{
-      $this->is_completed = FALSE;  
-    }
-  }
-
-  /* Return attributes handled by this setup step */
-  function get_attributes()
-  {
-    $tmp = array();
-    foreach($this->attributes as $attr){
-      $tmp[$attr] = $this->$attr;
-    }
-    return($tmp);
-  }
-
-  function print_header()
-  {
-    $image= get_template_path($this->header_image);
-    $display= "<div style='padding:3px;'>";
-    $display.= "  <p class=\"center\" style=\"margin:0px 0px 0px 5px;padding:0px;font-size:24px;font-weight:bold;\"><img class=\"center\" src=\"$image\" align=\"middle\" alt=\"*\">&nbsp;".$this->s_title_long."</p>\n";
-    $display.= "</div>\n";
-
-    return($display);
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/setup/class_setupStep_Checks.inc b/setup/class_setupStep_Checks.inc
deleted file mode 100644 (file)
index 99e34dd..0000000
+++ /dev/null
@@ -1,312 +0,0 @@
-<?php
-
-/*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2007 Fabian Hickert
-
-   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 Step_Checks extends setup_step
-{
-  var $basic_checks = array();
-  var $config_checks= array();
-  var $is_writeable = array();
-  var $header_image = "images/system.png";
-
-  function Step_Checks()
-  {
-    $this->update_strings();
-  }
-
-  function update_strings()
-  {
-    $this->s_title      = _("Installation check");
-    $this->s_title_long = _("Installation check");
-    $this->s_info       = _("Basic checks for PHP version and required extensions.");
-  }
-  
-  
-  /* Execute and display template */ 
-  function execute()
-  {
-    $this->run_checks();
-    $smarty = get_smarty();
-    $smarty->assign("basic"       ,$this->basic_checks);
-    $smarty->assign("config"      ,$this->config_checks);
-    $smarty->assign("is_writeable",$this->is_writeable);
-    return($smarty->fetch(get_template_path("setup_checks.tpl",TRUE,dirname(__FILE__))));
-  }
-
-
-  /* Execute all checks */ 
-  function run_checks()
-  {
-    $this->basic_checks = array();
-    $this->config_checks = array();
-    $this->is_writeable = array();
-    /* PHP version check */
-    $N = _("Checking PHP version"); 
-    $D = sprintf(_("PHP must be of version %s or above."), "5.2.0");
-    $S = _("GOsa requires functionality that is not available (or buggy) in older PHP versions. Please update to a supported version.");
-    $R = $this->check_php_version();
-    $M = TRUE;
-    $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
-
-    /* Checking imap extension */
-    $N = _("Checking for LDAP support");
-    $D = _("This is the main extension used by GOsa and therefore really required.");
-    $S = _("The ldap extension (php5-ldap) is required to communicate with your LDAP server.");
-    $R = is_callable("ldap_bind");
-    $M = TRUE;
-    $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
-
-    /* Check for gettext support */
-    $N = _("Checking for gettext support");
-    $D = _("Gettext support is required for internationalization.");
-    $S = _("Please make sure that the extension is activated.");
-    $R = is_callable("bindtextdomain");
-    $M = TRUE;
-    $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
-
-    /* Checing for iconv */
-    $N = _("Checking for iconv support");
-    $D = _("This module is used by GOsa to convert samba munged dial informations and is therefore required. ");
-    $S = _("Please make sure that the extension is activated.");
-    $R = is_callable("iconv");
-    $M = TRUE;
-    $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
-
-    /* Check for installed mhash module */
-    $N = _("Checking for mhash support");
-    $D = _("You'll need this module to make use of SSHA encryption");
-    $S = _("The mhash module for PHP 5 is not available.Please install php5-mhash.");
-    $R = is_callable("mhash");
-    $M = FALSE;
-    $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
-
-    /* Is imap module available */
-    $N = _("Checking for IMAP support");
-    $D = _("The IMAP module is needed to communicate with the IMAP server. GOsa retrieves status information, creates and deletes mail users, etc.");
-    $S = _("This module is used to communicate with your mail server. Please install php5-imap.");
-    $R = is_callable("imap_open");
-    $M = TRUE;
-    $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
-
-    /* Check getacl in imap module */
-    $N = _("Checking for getacl in IMAP implementation");
-    $D = _("The getacl support is needed to handle shared folder permissions. Old IMAP extensions are not capable of reading acl's. You need a recent PHP version to use this feature.");
-    $S = $D;
-    $R = is_callable("imap_getacl");
-    $M = TRUE;
-    $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
-
-    /* Mysql module loaded ? */
-    $N = _("Checking for MySQL support");
-    $D = _("MySQL support is needed to communicate with several supported databases.");
-    $S = _("This module is required to communicate with database servers (GOfax, asterisk, GLPI, etc.). Please install php5-mysql");
-    $R = is_callable("mysql_query");
-    $M = TRUE;
-    $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
-
-    /* Checking for kadm5 module */
-    $N = _("Checking for kadm5 support");
-    $D = _("Managing users in kerberos requires the kadm5 module which is downloadable via PEAR network.");
-    $S = _("This module is required to manage user in kerberos, it is downloadable via PEAR network");
-    $R = is_callable("kadm5_init_with_password");
-    $M = FALSE;
-    $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
-
-    /* Snmp module available ? */
-    $N = _("Checking for SNMP support");
-    $D = _("The simple network management protocol is needed to get status information from clients.");
-    $S = _("This module is required for client monitoring. Please install php5-snmp.");
-    $R = is_callable("snmpget");
-    $M = FALSE;
-    $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
-
-    /* Checking for Cups module */
-    $N = _("Checking for CUPS support");
-    $D = _("In order to read available printers via the IPP protocol instead of printcap files, you've to install the CUPS module.");
-    $S = $D; 
-    $R = is_callable("cups_get_dest_list");
-    $M = FALSE;
-    $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
-
-    /* Checking for F ping utility */
-    $query= "LC_ALL=C LANG=C fping -v 2>&1";
-    $output= shell_exec ($query);
-    $N = _("Checking for fping utility");
-    $D = _("The fping utility is used if you've got a thin client based terminal environment.");
-    $S = _("The fping utility is only used in thin client based terminal environment.");
-    $R = preg_match("/^fping:/", $output);
-    $M = FALSE;
-    $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
-
-    /* Checking generate LM/NT password hashes */
-    $query= "mkntpwd 2>&1";
-    $output= shell_exec ($query);
-    $have_mkntpwd= preg_match("/^Usage: mkntpwd /", $output);
-    if (!$have_mkntpwd){
-      $query= 'LC_ALL=C LANG=C perl -MCrypt::SmbHash -e "print join(q[:], ntlmgen $ARGV[0]), $/;" &>/dev/null';
-      system ($query, $ret);
-      $have_mkntpwd |= ($ret == 0);
-    }
-
-    $N = _("SAMBA password hash generation");
-    $D = _("In order to use SAMBA 2/3 passwords, you've to install additional packages to generate password hashes.");
-    $S = _("In order to use SAMBA 2/3 you've to install additional perl libraries. Take a look at mkntpasswd.");
-    $R = $have_mkntpwd;
-    $M = TRUE;
-    $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
-
-
-    /* PHP Configuration checks 
-     */
-
-    /* Register_globals off */
-    $N = "register_globals = <b>"._("Off")."</b>";
-    $D = _("register_globals is a PHP mechanism to register all global variables to be accessible from scripts without changing the scope. This may be a security risk.");
-    $S = _("Search for 'register_globals' in your php.ini and switch it to 'Off'.");
-    $R = ini_get("register_globals") == 0;
-    $M = FALSE;
-    $this->config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
-
-
-    /* session lifetime set to >=86400 seconds ? */
-    $N = "session.gc_maxlifetime &gt;= <b>86400</b>";
-    $D = _("PHP uses this value for the garbage collector to delete old sessions.")." ".
-         _("Setting this value to one day will prevent loosing session and cookies before they really timeout.");
-    $S = _("Search for 'session.gc_maxlifetime' in your php.ini and set it to 86400 or higher.");
-    $R = ini_get("session.gc_maxlifetime") >= 86400;
-    $M = FALSE;
-    $this->config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
-
-    /* Session auto start must be turned off */
-    $session_auto_start = ini_get('session.auto_start');
-    $N = "session.auto_start = <b>"._("Off")."</b>";
-    $D = _("In Order to use GOsa without any trouble, the session.auto_register option in your php.ini should be set to 'Off'.");
-    $S = _("Search for 'session.auto_start' in your php.ini and set it to 'Off'.");
-    $R = !$session_auto_start['local_value'];
-    $M = TRUE;
-    $this->config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
-
-    /* Check if memory limit is set to 32 or > */
-    $N = "memory_limit &gt;= <b>32</b>";
-    $D = _("GOsa needs at least 32MB of memory. Setting it below this limit may cause errors that are not reproducable! Increase it for larger setups.");
-    $S = _("Search for 'memory_limit' in your php.ini and set it to '32M' or higher.");
-    $R = ini_get('memory_limit') >= 32 ;
-    $M = TRUE;
-    $this->config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
-
-    /* Implicit Flush disabled can increase performance */
-    $N = "implicit_flush = <b>"._("Off")."</b>";
-    $D = _("This option influences the PHP output handling. Turn this Option off, to increase performance.");
-    $S = _("Search for 'implicit_flush' in your php.ini and set it to 'Off'."); 
-    $R = !ini_get('implicit_flush');
-    $M = FALSE;
-    $this->config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
-
-    /* Check if execution time is set to 30 */
-    $N = "max_execution_time &gt;= <b>30</b>";
-    $D = _("The Execution time should be at least 30 seconds.");
-    $S = _("Search for 'max_execution_time' in your php.ini and set it to '30' or higher.");
-    $R = ini_get("max_execution_time") >= 30 ;
-    $M = TRUE;
-    $this->config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
-
-    /* Expose php should be set to off */
-    $N = "expose_php = <b>"._("Off")."</b>";
-    $D = _("Increase the server security by setting expose_php to 'off'. PHP won't send any information about the server you are running in this case.");
-    $S = _("Search for 'expose_php' in your php.ini and set if to 'Off'.");
-    $R = !ini_get("expose_php");
-    $M = FALSE;
-    $this->config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
-
-    /* Automatic quoting must be turned on */
-    $N = "magic_quotes_gpc = <b>"._("On")."</b>";
-    $D = _("Increase your server security by setting magic_quotes_gpc to 'on'. PHP will escape all quotes in strings in this case."); 
-    $S = _("Search for 'magic_quotes_gpc' in your php.ini and set it to 'On'."); 
-    $R = ini_get('magic_quotes_gpc'); 
-    $M = TRUE;
-    $this->config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
-
-    /* Emulating old stuff? */
-    $N = "zend.ze1_compatibility_mode = <b>"._("Off")."</b>";
-    $D = _("Increase your server performance by setting magic_quotes_gpc to 'off'."); 
-    $S = _("Search for 'zend.ze1_compatibility_mode' in your php.ini and set it to 'Off'."); 
-    $R = !ini_get('zend.ze1_compatibility_mode'); 
-    $M = FALSE;
-    $this->config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
-
-
-    /* Configuration file  
-     */
-
-    /* Check if we can create a config file.*/
-    $N = _("Configuration writeable");
-    $D = _("The configuration file can't be written");
-    $S = sprintf(_("GOsa reads its configuration from a file located in (%s/%s). The setup can write the configuration directly if it is writeable."),CONFIG_DIR,CONFIG_FILE); 
-    $R =    ( file_exists(CONFIG_DIR."/".CONFIG_FILE) && is_writeable(CONFIG_DIR."/".CONFIG_FILE)) // is there a config file ? 
-        ||  (!file_exists(CONFIG_DIR."/".CONFIG_FILE) && is_writeable(CONFIG_DIR));  // There is non, but can we create a file there ?
-    $M = FALSE;
-    $this->is_writeable[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
-
-    /* If we have writeaccess to the config dir, check if there is already a config file */
-#    if($R){
-#
-#      /* check if there is already a config file. */
-#      $N = _("No old configuration file.");
-#      $D = "";//_("");
-#      $S = _("If there is already a configuration file, this file will be overwritten when GOsa setup finishes. Please move your old config file away.");
-#      $R =  !file_exists(CONFIG_DIR."/".CONFIG_FILE);
-#      $M = FALSE;
-#      $this->is_writeable[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
-#    }
-  }
-
-  function save_object()
-  {
-     /* If everything is fine, set this step to completed
-     *  and allow switching to next setup step
-     */
-    $failed = false;
-    foreach(array("basic_checks","config_checks","is_writeable") as $type){
-      foreach($this->$type as $obj){
-
-        if($obj['MUST'] && !$obj['RESULT']){
-          $failed = true;
-          break;
-        }
-      }
-    }
-    $this->is_completed = !$failed;
-  }
-
-  /* Check if current PHP version is compatible 
-      with the current version of GOsa */
-  function check_php_version()
-  {
-    return(version_compare(phpversion(),"5.2.0",">=")); 
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/setup/class_setupStep_Config1.inc b/setup/class_setupStep_Config1.inc
deleted file mode 100644 (file)
index 1087b6a..0000000
+++ /dev/null
@@ -1,245 +0,0 @@
-<?php
-
-/*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2007 Fabian Hickert
-
-   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 Step_Config1 extends setup_step
-{
-
-  var $peopleou   = "ou=people";
-  var $groupou    =  "ou=groups";
-  var $peopledn   = "cn";
-  var $uidbase    = 1000;
-  var $krbsasl    = FALSE;
-  var $strict     = TRUE;
-  var $compressed = TRUE;
-
-  var $header_image = "images/ldapserver.png";
-  var $account_expiration  =FALSE;
-  var $base_hook         = ""; 
-  var $base_hook_active  = FALSE; 
-
-  var $encryption = "crypt";
-  var $theme      = "default"; 
-
-  var $include_personal_title = FALSE;
-
-  var $pwd_rules  = array("pwminlen" => 6, 
-                          "pwminlen_active" => FALSE,
-                          "pwdiffer" => 5,
-                          "pwdiffer_active" => FALSE,
-                          "externalpwdhook" => "",
-                          "externalpwdhook_active" => FALSE);
-
-  var $id_settings = array(       "idgen"         => "{%sn}-{%givenName[2-4]}",
-                                  "idgen_active"  => FALSE,
-                                  "minid"         => "100",
-                                  "minid_active"  => FALSE);
-
-  var $crypt_methods  = array();
-
-  var $attributes = array("compressed","peopleou","groupou","peopledn","uidbase","encryption","theme","krbsasl",
-                          "base_hook","base_hook_active","account_expiration","strict","include_personal_title");
-
-  function Step_Config1()
-  {
-    $this->update_strings();
-
-    $tmp = @passwordMethod::get_available_methods();
-    foreach($tmp['name'] as $name){
-      $this->crypt_methods[$name] = $name;
-    }
-  }
-
-
-  function update_strings()
-  {
-    $this->s_title      = _("GOsa settings 1/3");
-    $this->s_title_long = _("GOsa settings 1/3");
-    $this->s_info       = _("GOsa generic settings");
-  }
-
-  
-  function execute()
-  {
-    $smarty = get_smarty();
-    $smarty->assign("peopledns",array("uid","cn"));
-    $smarty->assign("id_settings",$this->id_settings);
-    $smarty->assign("crypt_methods",$this->crypt_methods);
-    $smarty->assign("themes",$this->get_themes());
-    $smarty->assign("pwd_rules",$this->pwd_rules);
-    $smarty->assign("bool",array(FALSE => _("No"), TRUE => _("Yes")));
-    foreach($this->attributes as $attr){
-      $smarty->assign($attr,$this->$attr);
-    }
-
-    /* !!! Attention strict is inverse. If you change this, 
-     *  don't forget to change save_object too 
-     */
-    $smarty->assign("strict",!$this->strict);
-    return($smarty -> fetch (get_template_path("../setup/setup_config1.tpl")));
-  }
-
-
-  function get_themes()
-  {
-    $dir = opendir( "../ihtml/themes/");
-    $themes = array();
-    while (($file = readdir($dir)) !== false){
-      if(is_dir("../ihtml/themes/".$file) && !preg_match("/^\./",$file)){
-        $themes[$file] = $file;
-      }      
-    }
-    return($themes);
-  }
-
-  function check()
-  {
-    $message = array();
-
-    if(isset($this->id_settings['minid_active']) && !is_numeric($this->id_settings['minid'])){
-      $message[] = sprintf(_("The specified value for '%s' must be a numeric value"),_("GID / UID min id"));
-    }
-
-    if(preg_match("/,$/",$this->peopleou)){
-      $message[] =sprintf(_("Don't add a trailing comma to '%s'."),_("People storage ou"));
-    }
-
-    if(preg_match("/,$/",$this->groupou)){
-      $message[] =sprintf(_("Don't add a trailing comma to '%s'."),_("Group storage ou"));
-    }
-
-    if(!is_numeric($this->uidbase)){
-      $message[] = _("Uid base must be numeric");
-    }
-
-    if(($this->pwd_rules['pwminlen_active']) && !is_numeric($this->pwd_rules['pwminlen'])){
-      $message[] = _("The given password minimum length is not numeric.");
-    }
-    if(($this->pwd_rules['pwdiffer_active']) && !is_numeric($this->pwd_rules['pwdiffer'])){
-      $message[] = _("The given password differ value is not numeric.");
-    }
-    return($message);
-  }
-
-  function save_object()
-  {
-    if(isset($_POST['step5_posted'])){
-
-      /* Get attributes */
-      foreach($this->attributes as $attr){
-        if(isset($_POST[$attr])){
-          $this->$attr = validate(get_post($attr));
-        }
-      }
-
-      /* !!! Attention strict is inverse. If you change this, 
-       *  don't forget to change the smarty assignment too 
-       */
-      if(isset($_POST['strict'])){
-        if($_POST['strict']){
-          $this->strict = FALSE;
-        }else{
-          $this->strict = TRUE;
-        }
-      }
-
-      if(isset($_POST['minid_active'])){
-        $this->id_settings['minid_active'] = TRUE;
-        if(isset($_POST['minid'])){
-          $this->id_settings['minid'] = get_post('minid');
-        }
-      }else{
-        $this->id_settings['minid_active'] = FALSE;
-      }
-
-      /* Generic settings */
-      if(isset($_POST['idgen_active'])){
-        $this->id_settings['idgen_active'] = TRUE;
-        if(isset($_POST['idgen'])){
-          $this->id_settings['idgen'] = get_post('idgen');
-        }
-      }else{
-        $this->id_settings['idgen_active'] = FALSE;
-      }
-
-      /* Get password settings */ 
-      if(isset($_POST['pwdiffer_active'])){
-        $this->pwd_rules['pwdiffer_active'] = TRUE;
-        if(isset($_POST['pwdiffer'])){
-          $this->pwd_rules['pwdiffer'] = get_post('pwdiffer');
-        }
-      }else{
-        $this->pwd_rules['pwdiffer_active'] = FALSE;
-      }
-
-      /* Get password minimum length posts */
-      if(isset($_POST['pwminlen_active'])){
-        $this->pwd_rules['pwminlen_active'] = TRUE;
-        if(isset($_POST['pwminlen'])){
-          $this->pwd_rules['pwminlen'] = get_post('pwminlen');
-        }
-      }else{
-        $this->pwd_rules['pwminlen_active'] = FALSE;
-      }
-
-      /* External pwd settings */
-      if(isset($_POST['externalpwdhook_active'])){
-        $this->pwd_rules['externalpwdhook_active'] = TRUE;
-        if(isset($_POST['externalpwdhook'])){
-          $this->pwd_rules['externalpwdhook'] = get_post('externalpwdhook');
-        }
-      }else{
-        $this->pwd_rules['externalpwdhook_active'] = FALSE;
-      }
-
-      /* base hook settings */
-      if(isset($_POST['base_hook_active'])){
-        $this->pwd_rules['base_hook_active'] = TRUE;
-        if(isset($_POST['base_hook'])){
-          $this->pwd_rules['base_hook'] = get_post('base_hook');
-        }
-      }else{
-        $this->pwd_rules['base_hook_active'] = FALSE;
-      }
-    }
-
-    $tmp = $this->check(); 
-    if(count($tmp) == 0){
-      $this->is_completed = TRUE;
-    }else{
-      $this->is_completed = FALSE;
-    }
-  }// if tempalte posted 
-
-
-  /* Attributes that are interesting for configuration generation */
-  function get_attributes()
-  {
-    $tmp = setup_step::get_attributes();
-    foreach(array("pwd_rules","id_settings") as $attr){
-      $tmp[$attr]= $this->$attr;
-    }
-    return($tmp);
-  }
-}// CLass
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/setup/class_setupStep_Config2.inc b/setup/class_setupStep_Config2.inc
deleted file mode 100644 (file)
index e6b96b1..0000000
+++ /dev/null
@@ -1,312 +0,0 @@
-<?php
-
-/*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2007 Fabian Hickert
-
-   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 Step_Config2 extends setup_step
-{
-  var $governmentmode = FALSE;
-  var $sambaidmapping = FALSE;
-  var $header_image = "images/ldapserver.png";
-
-  var $cyrusunixstyle = FALSE;
-  var $mail       = "none";
-  var $mail_methods   = array();
-  var $mail_settings = array("vacationdir"        => "/etc/gosa/vacation",
-                             "vacationdir_active" => FALSE);
-
-  var $generic_settings  = array( "enableCopyPaste" => false,
-                                  "enableDNS"      => false,
-                                  "enableDHCP"      => false,
-                                  "wws_ou"        => "ou=winstations",
-                                  "wws_ou_active" => FALSE,
-                                  "snapshot_active"     => FALSE,
-                                  "snapshot_base"       => "ou=snapshots,%base%",
-                                  "snapshot_user"       => "%admin%",
-                                  "snapshot_password"   => "",
-                                  "snapshot_server"     => "%connection%");
-
-  var $samba_settings    = array( "samba_sid"        => "0-815-4711",
-                                  "samba_sid_active" => FALSE,
-                                  "samba_rid"        => 1000,
-                                  "smbhash"          => 'SMBHASH',
-                                  "samba_rid_active" => FALSE); 
-
-  var $sambaDomain_found    = FALSE;
-  var $use_netatalk         = FALSE;
-  var $enableFAI_management = FALSE;
-  var $enableMimeType       = FALSE;
-
-  var $timezone       = "Europe/Berlin";
-  var $timezones      = array();
-
-  var $attributes = array("governmentmode","sambaidmapping","cyrusunixstyle","mail","use_netatalk","enableFAI_management","timezone","enableMimeType");
-  var $called = FALSE;
-
-  function Step_Config2()
-  {
-    $this->update_strings();
-    $tmp = $this->get_available_mail_classes();
-    foreach($tmp['name'] as $name){
-      $this->mail_methods[$name] = $name;
-    }
-
-    /* Look for samba password generation method */
-    if(file_exists("/usr/bin/mkntpasswd")){
-      $pwdhash  = "/usr/bin/mkntpasswd";
-    } elseif (preg_match("/^Usage: mkntpwd /", shell_exec ("mkntpwd 2>&1"))){
-      $pwdhash= "mkntpwd";
-    } else {
-      $pwdhash= 'perl -MCrypt::SmbHash -e "print join(q[:], ntlmgen \$ARGV[0]), $/;"';
-    }
-
-    $this->timezones = _get_tz_zones();
-    $this->samba_settings['smbhash'] = $pwdhash;
-  }
-
-  function update_strings()
-  {
-    $this->s_title      = _("GOsa settings 2/3");
-    $this->s_title_long = _("GOsa settings 2/3");
-    $this->s_info       = _("Customize special parameters");
-  }
-
-  function execute()
-  {
-    /* On first call check for rid/sid base */
-    $cv = $this->parent->captured_values;
-    $ldap = new LDAP($cv['admin'],
-        $cv['password'],
-        $cv['connection'],
-        FALSE,
-        $cv['tls']);
-
-    $ldap->cd($cv['base']);
-    $ldap->search("(objectClass=sambaDomain)",array("dn"));
-    if($ldap->count()){
-      $this->sambaDomain_found =TRUE;
-    }else{
-      $this->sambaDomain_found =FALSE;
-    }
-
-    if(!$this->called){
-      if(!$this->sambaDomain_found){
-        $this->samba_settings['samba_sid_active'] = TRUE;
-        $this->samba_settings['samba_rid_active'] = TRUE;
-      }
-  
-      /* Check if we can enable netatalk plugin */
-      $tmp = $ldap->get_objectclasses();
-      if(is_array($tmp) && isset($tmp['apple-user'])) {
-        $this->use_netatalk = TRUE;
-      }
-
-      /* Check the FAI schema is used */
-      if(is_array($tmp) && isset($tmp['FAIclass'])){
-#        $this->enableFAI_management = TRUE;
-      }
-
-      /* Check the MimeType schema is used */
-      if(is_array($tmp) && isset($tmp['gotoMimeType'])){
-        $this->enableMimeType = TRUE;
-      }
-
-      if(is_array($tmp) && isset($tmp['dhcpClass'])){
-        $this->generic_settings['enableDHCP'] = TRUE;
-      }
-
-      if(is_array($tmp) && isset($tmp['dNSZone'])){
-        $this->generic_settings['enableDNS'] = TRUE;
-      }
-
-      $this->called = TRUE;
-    }
-
-    /* Update snapshot values, with already collected values */
-    foreach($this->generic_settings as $key => $value){
-      foreach(array("snapshot_base","snapshot_user","snapshot_server") as $attr){
-        foreach($this->parent->captured_values as $replace_name => $replace_value){
-          if(is_string($replace_value))  {
-            $this->generic_settings[$attr] = preg_replace("/%".$replace_name."%/",$replace_value,$this->generic_settings[$attr]);
-          }
-        }
-      }
-    }
-
-    $smarty = get_smarty();
-    $smarty->assign("sambaDomain_found",$this->sambaDomain_found);
-    $smarty->assign("generic_settings",$this->generic_settings);
-    $smarty->assign("mail_settings",$this->mail_settings);
-    $smarty->assign("mail_methods",$this->mail_methods);
-    $smarty->assign("samba_settings",$this->samba_settings);
-    $smarty->assign("bool",array(FALSE => _("No"), TRUE => _("Yes")));
-        foreach($this->attributes as $attr){
-      $smarty->assign($attr,$this->$attr);
-    }
-    $smarty->assign("timezone"     ,$this->timezone);
-    $smarty->assign("timezones"    ,$this->timezones);
-    return($smarty -> fetch (get_template_path("../setup/setup_config2.tpl")));
-  }
-
-  function save_object()
-  {
-    if(isset($_POST['step6_posted'])){
-
-      if(isset($_POST['timezone']) && isset($this->timezones['TIMEZONES'][$_POST['timezone']])){
-        $this->timezone = $_POST['timezone'];
-      }
-
-      /* Get attributes */
-      foreach($this->attributes as $attr){
-        if(isset($_POST[$attr])){
-          $this->$attr = validate(get_post($attr));
-        }
-      }
-
-      /* Mail settings */
-      if(isset($_POST['vacationdir_active'])){
-        $this->mail_settings['vacationdir_active'] = TRUE;
-        if(isset($_POST['vacationdir'])){
-          $this->mail_settings['vacationdir'] = get_post('vacationdir');
-        }
-      }else{
-        $this->mail_settings['vacationdir_active'] = FALSE;
-      }
-
-      if(isset($_POST['enableCopyPaste'])){
-        $this->generic_settings['enableCopyPaste'] = get_post('enableCopyPaste');
-      }
-      if(isset($_POST['enableDNS'])){
-        $this->generic_settings['enableDNS'] = get_post('enableDNS');
-      }
-      if(isset($_POST['enableDHCP'])){
-        $this->generic_settings['enableDHCP'] = get_post('enableDHCP');
-      }
-
-      if(isset($_POST['wws_ou_active'])){
-        $this->generic_settings['wws_ou_active'] = TRUE;
-        if(isset($_POST['wws_ou'])){
-          $this->generic_settings['wws_ou'] = get_post('wws_ou');
-        }
-      }else{
-        $this->generic_settings['wws_ou_active'] = FALSE;
-      }
-
-      if(isset($_POST['snapshot_active'])){
-        $this->generic_settings['snapshot_active'] = TRUE;
-        if(isset($_POST['snapshot_base'])){
-          $this->generic_settings['snapshot_base'] = get_post('snapshot_base');
-        }
-        if(isset($_POST['snapshot_user'])){
-          $this->generic_settings['snapshot_user'] = get_post('snapshot_user');
-        }
-        if(isset($_POST['snapshot_password'])){
-          $this->generic_settings['snapshot_password'] = get_post('snapshot_password');
-        }
-        if(isset($_POST['snapshot_server'])){
-          $this->generic_settings['snapshot_server'] = get_post('snapshot_server');
-        }
-      }else{
-        $this->generic_settings['snapshot_active'] = FALSE;
-      }
-
-      /* Samba settings */
-      if(isset($_POST['samba_sid_active'])){
-        $this->samba_settings['samba_sid_active'] = TRUE;
-        if(isset($_POST['samba_sid'])){
-          $this->samba_settings['samba_sid'] = get_post('samba_sid');
-        }
-      }else{
-        $this->samba_settings['samba_sid_active'] = FALSE;
-      }
-      if(isset($_POST['samba_rid_active'])){
-        $this->samba_settings['samba_rid_active'] = TRUE;
-        if(isset($_POST['samba_rid'])){
-          $this->samba_settings['samba_rid'] = get_post('samba_rid');
-        }
-      }else{
-        $this->samba_settings['samba_rid_active'] = FALSE;
-      }
-      if(isset($_POST['smbhash'])){
-        $this->samba_settings['smbhash'] = get_post('smbhash');
-      }
-
-      if(!$this->sambaDomain_found){
-        $this->samba_settings['samba_sid_active'] = TRUE;
-        $this->samba_settings['samba_rid_active'] = TRUE;
-      }
-    }
-
-    $tmp = $this->check();
-    if(count($tmp) == 0){
-      $this->is_completed = TRUE;
-    }else{
-      $this->is_completed = FALSE;
-    }
-  }
-
-
-  function check()
-  {
-    $message = array();
-    return($message);
-  }
-  
-
-  /* Attributes that are interesting for configuration generation */
-  function get_attributes()
-  {
-    $tmp = setup_step::get_attributes();
-    foreach(array("samba_settings","generic_settings","mail_settings") as $attr){
-      $tmp[$attr]= $this->$attr;
-    }
-    return($tmp);
-  }
-
-/* Returns the classnames auf the mail classes */
-  function get_available_mail_classes()
-  {
-    $dir = opendir( "../include");
-    $methods = array();
-    $suffix = "class_mail-methods-";
-    $lensuf = strlen($suffix);
-    $prefix = ".inc";
-    $lenpre = strlen($prefix);
-    $i = 0;
-    while (($file = readdir($dir)) !== false){
-
-      if(stristr($file,$suffix)) {
-        $lenfile = strlen($file);
-        $methods['name'][$i] = substr($file,$lensuf,($lenfile-$lensuf)-$lenpre);
-        $methods['file'][$i] = $file;
-        $methods[$i]['file'] = $file;
-        $methods[$i]['name'] = substr($file,$lensuf,($lenfile-$lensuf)-$lenpre);
-        $i++;
-      }
-    }
-    return($methods);
-  }
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/setup/class_setupStep_Config3.inc b/setup/class_setupStep_Config3.inc
deleted file mode 100644 (file)
index eaa5368..0000000
+++ /dev/null
@@ -1,229 +0,0 @@
-<?php
-
-/*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2007 Fabian Hickert
-
-   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 Step_Config3 extends setup_step
-{
-  var $header_image= "images/ldapserver.png";
-
-  var $errorlvl   = TRUE;
-
-  var $login_attributes = array("uid"       => "uid", 
-                                "mail"      => "mail",
-                                "uid,mail"  => "both");
-  var $optional = array(
-              "login_attribute" => "uid",
-              "strict_units" => false,
-              "list_summary" => false,
-              "forceglobals" => true,
-              "forcessl" => false,
-              "ldapstats" => false,
-              "warnssl" => true,
-              "user_filter_cookie" => true,
-              "ppd_path" => "/var/spool/ppd/",
-              "ppd_path_active" => FALSE,
-              "compile" =>  "/var/spool/gosa",
-              "snmpcommunity" =>  "goto",
-              "debuglevel" => 0,
-              "session_lifetime" => 7200,
-              "max_ldap_query_time" => "5.0",
-              "max_ldap_query_time_active" => FALSE,
-
-              "mailQueueScriptPath" => "/usr/bin/sudo /usr/local/sbin/mailqueue %action %id %server",
-              "mailQueueScriptPath_active" => FALSE,
-
-              "auto_network_hook" => "/usr/bin/net-resolver.sh",
-              "auto_network_hook_active" => FALSE,
-
-              "notifydir" => "",
-              "notifydir_active" => FALSE,
-
-              "uniq_identifier" => "entryCSN",
-              "uniq_identifier_active" => TRUE,
-
-              "kioskpath" => "/var/spool/kiosk",
-              "kioskpath_active" => FALSE,
-
-              "gotomasses_file"   => "/etc/gosa/gotomasses",
-              "gotomasses_active" => FALSE,
-
-              "noprimarygroup"  => FALSE);
-
-  var $attributes = array("errorlvl");
-
-  function Step_Config3()
-  {
-    $this->update_strings();
-  }
-
-
-  function update_strings()
-  {
-    $this->s_title      = _("GOsa settings 3/3");
-    $this->s_title_long = _("GOsa settings 3/3");
-    $this->s_info       = _("Tweak some GOsa core behaviour");
-  }
-  
-
-  function execute()
-  {
-    $smarty = get_smarty();
-    $smarty->assign("bool",array(FALSE => _("No"), TRUE => _("Yes")));
-    $smarty->assign("uniq_identifiers",array( "entryCNS" => "entryCSN",
-                                              "contextCSN"=>"contextCSN" ));
-    $smarty->assign("optional", $this->optional);
-    foreach($this->attributes as $attr){
-      $smarty->assign($attr,$this->$attr);
-    }
-    $smarty->assign("login_attributes",$this->login_attributes);
-    return($smarty -> fetch (get_template_path("../setup/setup_config3.tpl")));
-  }
-
-
-  function save_object()
-  {
-    if(isset($_POST['step6a_posted'])){
-
-      /* Get attributes */
-      foreach($this->attributes as $attr){
-        if(isset($_POST[$attr])){
-          $this->$attr = validate(get_post($attr));
-        }
-      }
-      
-      foreach(array("login_attribute","list_summary","strict_units","snmpcommunity","noprimarygroup","forceglobals","forcessl","ldapstats","user_filter_cookie","warnssl","compile","debuglevel","session_lifetime") as $name){
-        if(isset($_POST[$name])){
-          $this->optional[$name] = get_post($name);
-        }
-      } 
-
-      if(isset($_POST['ppd_path_active'])){
-        $this->optional['ppd_path_active'] = TRUE;
-        if(isset($_POST['ppd_path'])){
-          $this->optional['ppd_path'] = get_post('ppd_path');
-        }
-      }else{
-        $this->optional['ppd_path_active'] = FALSE;
-      }
-
-      if(isset($_POST['max_ldap_query_time_active'])){
-        $this->optional['max_ldap_query_time_active'] = TRUE;
-        if(isset($_POST['max_ldap_query_time'])){
-          $this->optional['max_ldap_query_time'] = get_post('max_ldap_query_time');
-        }
-      }else{
-        $this->optional['max_ldap_query_time_active'] = FALSE;
-      }
-
-      if(isset($_POST['mailQueueScriptPath_active'])){
-        $this->optional['mailQueueScriptPath_active'] = TRUE;
-        if(isset($_POST['mailQueueScriptPath'])){
-          $this->optional['mailQueueScriptPath'] = get_post('mailQueueScriptPath');
-        }
-      }else{
-        $this->optional['mailQueueScriptPath_active'] = FALSE;
-      }
-
-      if(isset($_POST['kioskpath_active'])){
-        $this->optional['kioskpath_active'] = TRUE;
-        if(isset($_POST['kioskpath'])){
-          $this->optional['kioskpath'] = get_post('kioskpath');
-        }
-      }else{
-        $this->optional['kioskpath_active'] = FALSE;
-      }
-
-      if(isset($_POST['gotomasses_active'])){
-        $this->optional['gotomasses_active'] = TRUE;
-        if(isset($_POST['gotomasses_file'])){
-          $this->optional['gotomasses_file'] = get_post('gotomasses_file');
-        }
-      }else{
-        $this->optional['gotomasses_active'] = FALSE;
-      }
-
-      if(isset($_POST['auto_network_hook_active'])){
-        $this->optional['auto_network_hook_active'] = TRUE;
-        if(isset($_POST['auto_network_hook'])){
-          $this->optional['auto_network_hook'] = get_post('auto_network_hook');
-        }
-      }else{
-        $this->optional['auto_network_hook_active'] = FALSE;
-      }
-
-      if(isset($_POST['notifydir_active'])){
-        $this->optional['notifydir_active'] = TRUE;
-        if(isset($_POST['notifydir'])){
-          $this->optional['notifydir'] = get_post('notifydir');
-        }
-      }else{
-        $this->optional['notifydir_active'] = FALSE;
-      }
-
-      if(isset($_POST['uniq_identifier_active'])){
-        $this->optional['uniq_identifier_active'] = TRUE;
-        if(isset($_POST['uniq_identifier'])){
-          $this->optional['uniq_identifier'] = get_post('uniq_identifier');
-        }
-      }else{
-        $this->optional['uniq_identifier_active'] = FALSE;
-      }
-    }
-
-    $tmp = $this->check();
-    if(count($tmp) == 0){
-      $this->is_completed = TRUE;
-    }else{
-      $this->is_completed = FALSE;
-    }
-  }
-
-
-  function check()
-  {
-    $message = array();
-
-    if(!is_numeric( $this->optional['session_lifetime'])){
-      $message[] = _("Session lifetime must be a numeric value.");
-    }
-
-    if(!is_numeric( $this->optional['max_ldap_query_time'])){
-      $message[] = _("Maximal ldap query time must be a numeric value. ");
-    }
-  
-    return($message);
-  }
-  
-
-  /* Attributes that are interesting for configuration generation */
-  function get_attributes()
-  {
-    $tmp = setup_step::get_attributes();
-    foreach(array("optional") as $attr){
-      $tmp[$attr]= $this->$attr;
-    }
-    return($tmp);
-  }
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/setup/class_setupStep_Feedback.inc b/setup/class_setupStep_Feedback.inc
deleted file mode 100644 (file)
index fbcfb4c..0000000
+++ /dev/null
@@ -1,274 +0,0 @@
-<?php
-
-/*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2007 Fabian Hickert
-
-   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 Step_Feedback  extends setup_step
-{
-  var $languages      = array();
-  var $header_image   = "images/welcome.png";
-
-  var $organization       = "";
-  var $eMail              = "";
-  var $name               = "";
-  var $subscribe          = FALSE;
-  var $use_gosa_announce  = FALSE;
-
-  var $feedback_url         = "http://oss.gonicus.de/gosa-feedback/";
-  var $get_started          = TRUE;
-  var $problems_encountered = "";
-  
-  var $first_use            = TRUE;
-  var $use_since            = "";
-
-  var $distribution         = "";
-  var $web_server           = "";
-  var $php_version          = "";
-
-  var $ldap_server          = "";
-  var $object_count         = "";
-    
-  var $want_to_see_next     = "";
-
-  var $features_used        = array();  
-  var $initialized          = FALSE; 
-
-  var $attributes = array("organization","eMail","name","subscribe","use_gosa_announce","get_started","problems_encountered","features_used",
-                          "first_use","use_since","distribution","web_server","php_version","ldap_server","object_count","want_to_see_next");
-  
-
-  function Step_Feedback()
-  {
-    $this->is_enabled     = TRUE;
-    $this->is_active      = TRUE;
-    $this->update_strings(); 
-  }
-
-
-  function init()
-  {
-    $cv = $this->parent->captured_values;
-
-    /* Initialize values */
-    $this->use_since      = date("Y");
-    $this->organization   = preg_replace("/^[^=]*+=(.*),.*$/","\\1",$cv['base']);
-    $this->distribution   = "";
-    $this->web_server     = $_SERVER['SERVER_SOFTWARE'];
-    $this->php_version    = PHP_VERSION;
-
-    /* On first call check for rid/sid base */
-    $cv = $this->parent->captured_values;
-    $ldap = new LDAP($cv['admin'],
-        $cv['password'],
-        $cv['connection'],
-        FALSE,
-        $cv['tls']);
-    $ldap->cd($cv['base']);
-    $ldap->search("(objectClass=*)",array("dn"));
-    $this->object_count=$ldap->count();
-
-    /* Preselect used features */
-    $oc = $ldap->get_objectclasses();
-    $this->features_used                = array();
-    $this->features_used['posix']       = array("USED" => isset($oc['posixAccount']) , 
-                                                "NAME" => _("UNIX accounts/groups"));
-    $this->features_used['samba']       = array("USED" => isset($oc['sambaSamAccount']) || isset($oc['sambaAccount']) , 
-                                                "NAME" => _("Samba management"));
-    $this->features_used['mail']        = array("USED" => $cv['mail']  != "none", 
-                                                "NAME" => _("Mailsystem management"));
-    $this->features_used['fax']         = array("USED" => isset($oc['goFaxAccount']) , 
-                                                "NAME" => _("FAX system administration"));
-    $this->features_used['asterisk']    = array("USED" => isset($oc['goFonAccount']), 
-                                                "NAME" => _("Asterisk administration"));
-    $this->features_used['inventory']   = array("USED" => isset($oc['glpiAccount']) , 
-                                                "NAME" => _("System inventory"));
-    $this->features_used['system']      = array("USED" => FALSE , 
-                                                "NAME" => _("System-/Configmanagement"));
-    $this->features_used['addressbook'] = array("USED" => FALSE , 
-                                                "NAME" => _("Addressbook"));
-  }
-
-
-  function update_strings()
-  {
-    $this->s_title      = _("Notification and feedback");
-    $this->s_info       = _("Get notifications or send feedback");
-    $this->s_title_long = _("Notification and feedback");
-  }
-
-  
-  function execute()
-  {
-    if(!$this->initialized){
-      $this->initialized = TRUE;
-      $this->init();
-    }
-
-    $additional_info ="";
-
-    if(isset($_POST['send_feedback'])){
-
-      $msgs = $this->check_feedback();
-      if(count($msgs)){
-        foreach($msgs as $msg){
-          print_red($msg);
-        }
-      }else{
-        $str = $this->create_serialise_data_string(); 
-        $feedback_url = $this->feedback_url."?data=".base64_encode($str);
-
-        $ret = @fopen($feedback_url,"r");
-
-        if(!$ret){
-          print_red(sprintf(_("Could not connect to feedback server (%s). There is possibly no connection to the internet."),$this->feedback_url));
-        }else{
-          $ret_value="";
-          while($ret && !feof($ret)){
-            $ret_value.= fgets($ret,256);
-          }
-          if(!preg_match("/successful/i",$ret_value)){
-            print_red(_("Error while sending your feedback. The service is possible temporary unavailable"));
-          }else{
-            $additional_info = "<font color='green'>"._("Feedback sucessfully send")."</font>";
-          }
-        }
-        @fclose($ret);
-      }
-    }
-
-    $years = array();
-    for($i = date("Y") ; $i >= 2001; $i--){
-      $years[$i] = $i;
-    }
-
-    $this->is_completed=TRUE;
-    $smarty = get_smarty();
-
-    foreach($this->attributes as $attr){
-      $smarty->assign($attr, $this->$attr);
-    }
-    $smarty->assign("years",$years);
-    $smarty->assign("features_used",$this->features_used);
-    $smarty->assign("additional_info",$additional_info);
-    $smarty->assign ("must", "<font class=\"must\">*</font>");
-    return($smarty->fetch(get_template_path("setup_feedback.tpl",TRUE,dirname(__FILE__))));
-  }
-
-
-  function check_feedback()
-  {
-    $msgs = array();
-    if(!is_email($this->eMail) || empty($this->eMail)){
-      $msgs[] = _("Please specify a valid email address.");
-    }
-
-    if(!$this->subscribe && !$this->use_gosa_announce){
-      $msgs[] = _("You should have enabled at least one option, to subscribe or send your feedback.");
-    }
-
-    return($msgs);
-  }
-  
-
-  function save_object()
-  {
-    if(isset($_POST['step_feedback'])){
-      foreach($this->attributes as $attr){
-        if(isset($_POST[$attr])){
-          $this->$attr = get_post($attr);
-        }
-      }
-
-      if(isset($_POST['subscribe'])){
-        $this->subscribe = TRUE;
-      }else{
-        $this->subscribe = FALSE;
-      }
-
-      if(isset($_POST['use_gosa_announce'])){
-        $this->use_gosa_announce = TRUE;
-      }else{
-        $this->use_gosa_announce = FALSE;
-      }
-    
-      foreach($this->features_used as $key => $data){
-        if(isset($_POST['feature_'.$key])){
-          $this->features_used[$key]['USED'] = TRUE;
-        }else{
-          $this->features_used[$key]['USED'] = FALSE;
-        }
-      }
-    }
-  }
-
-
-  function create_serialise_data_string()
-  {
-    $str = "#FEEDBACK ".date("H:i:s d:m:Y");
-    if($this->subscribe){
-
-      $str.= "\n\nSubscribe";
-      $str .= "\nOrganization: ".$this->organization; 
-      $str .= "\nName: ".$this->name;
-      $str .= "\neMail: ".$this->eMail;
-    }
-  
-    if($this->use_gosa_announce){
-
-      $str.= "\n\nFeedback";    
-  
-      if($this->get_started) {
-        $str .= "\nGet started: TRUE";
-      }else{
-        $str .= "\nGet started: FALSE";
-      }
-      $str .= "\nProblems : ".($this->problems_encountered);
-
-      if($this->first_use){
-        $str .= "\nFirst use: TRUE";
-      }else{
-        $str .= "\nFirst use: FALSE";
-      }
-      $str .= "\nUsing GOsa since: ".$this->use_since;
-
-      $str .="\nDistribution: ".$this->distribution;
-      $str .="\nWeb Server: ".$this->web_server;
-      $str .="\nPHP_Version: ".$this->php_version;
-      $str .="\nLDAP Server: ".$this->ldap_server;
-      $str .="\nObject count: ".$this->object_count;
-      $str .="\nMissing features: ".($this->want_to_see_next);
-    }
-
-    $str .= "\n\nFeatures used";
-    foreach($this->features_used as $name => $data){
-      $str.="\n".$name.": ";
-      if($data['USED']){
-        $str .= "TRUE";
-      }else{
-        $str .= "FALSE";
-      }
-    }
-
-    return($str);  
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/setup/class_setupStep_Finish.inc b/setup/class_setupStep_Finish.inc
deleted file mode 100644 (file)
index 3898c55..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-<?php
-
-/*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2007 Fabian Hickert
-
-   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 Step_Finish extends setup_step
-{
-  var $gosa_conf_contrib   = "/gosa.conf";
-  var $cfg_file_written = FALSE;
-  var $header_image= 'images/ldapserver.png';
-
-  function Step_Finish()
-  {
-    $this->update_strings();
-  }
-
-  
-  function update_strings()
-  {
-    $this->s_title      = _("Finish");
-    $this->s_info       = _("Write configuration file");
-    $this->s_title_long = _("Finish - write the configuration file");
-  }
-
-
-  function get_conf_data()
-  {
-    $smarty = get_smarty();
-    $smarty->assign("cv",$this->parent->captured_values);
-    $str =  $smarty->fetch(CONFIG_TEMPLATE_DIR.$this->gosa_conf_contrib);
-    return($str);
-  }  
-
-
-  function execute()
-  {
-
-    $info= posix_getgrgid(posix_getgid());
-    $webgroup = $info['name'];
-      
-    
-    /* Check if there is currently an active gosa.conf 
-     */
-    $exists = file_exists(CONFIG_DIR."/".CONFIG_FILE); 
-
-    /* Redirect to GOsa login, if : 
-     *   - gosa.conf exists
-     *   - Permisssion are set correctly 
-     */ 
-    if(isset($_POST['next']) && $exists && !$this->is_world_readable(CONFIG_DIR."/".CONFIG_FILE)){
-      session_destroy();
-      header("Location: index.php");
-      exit();
-    }
-
-    /* Downlaod config */
-    if(isset($_POST['getconf'])){
-
-      header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
-      header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
-      header("Cache-Control: no-cache");
-      header("Pragma: no-cache");
-      header("Cache-Control: post-check=0, pre-check=0");
-      header("Content-type: text/plain");
-     
-      if (preg_match('/MSIE 5.5/', $_SERVER['HTTP_USER_AGENT']) ||
-          preg_match('/MSIE 6.0/', $_SERVER['HTTP_USER_AGENT'])){
-        header('Content-Disposition: filename="'.CONFIG_FILE.'"');
-      } else {
-        header('Content-Disposition: attachment; filename="'.CONFIG_FILE.'"');
-      }
-
-      $str = $this->get_conf_data();
-      $str = preg_replace("/\n[ ]*\n/","",$str);
-
-      echo $this->get_conf_data();
-      exit();
-    }
-   
-    $err_msg= "";
-    
-    if($exists && $this->is_world_readable(CONFIG_DIR."/".CONFIG_FILE)){
-      $err_msg = _("Your configuration file is currently world readable. Please updated the file permissions!");
-    }elseif(!$exists){
-      $err_msg = _("The configuration is currently not readable or it does not exists.");
-    }
-
-    $smarty = get_smarty();
-    $smarty->assign("err_msg",$err_msg);
-    $smarty->assign("webgroup", $webgroup);
-    $smarty->assign("CONFIG_DIR",CONFIG_DIR);
-    $smarty->assign("CONFIG_FILE" , CONFIG_FILE);
-
-    $smarty->assign("msg2", sprintf(_("After downloading and placing the file under %s, please make sure that the user the webserver is running with is able to read %s, while other users shouldn't. You may want to execute these commands to achieve this requirement:"),CONFIG_DIR,CONFIG_FILE));
-
-    $smarty->assign("cv",$this->parent->captured_values);
-    return($smarty -> fetch (get_template_path("../setup/setup_finish.tpl")));
-  }
-
-
-  /* check if given file is world readable */
-  function is_world_readable($file)
-  {
-    clearstatcache();
-    $p = fileperms($file);
-    $w_r = (decbin($p & 4) == TRUE);
-    return($w_r);
-  }
-
-
-  function save_object()
-  {
-    if(isset($_POST['step8_posted'])){
-
-      /* Get attributes */
-      foreach($this->attributes as $attr){
-        if(isset($_POST[$attr])){
-          $this->$attr = validate($_POST[$attr]);
-        }
-      }
-    }
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/setup/class_setupStep_Language.inc b/setup/class_setupStep_Language.inc
deleted file mode 100644 (file)
index e1b5e72..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-<?php
-
-/*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2007 Fabian Hickert
-
-   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 Step_Language extends setup_step
-{
-  var $lang_selected  = "";       /* Language selected from select box  */
-  var $lang           = "en_EN";  /* Detected language */
-  var $languages      = array();
-  var $attributes     = array("lang","lang_selected");
-  var $header_image   = "images/locale.png";
-
-  function Step_Language()
-  {
-    $this->lang           = get_browser_language();
-    $this->lang_selected  = "";
-    $this->update_strings(); 
-  }
-
-  function update_strings()
-  {
-    $this->s_title      = _("Language setup");
-    $this->s_title_long = _("Language setup");
-    $this->s_info       = _("This step allows you to select your preferred language.");
-  }
-  
-  function execute()
-  {
-    $this->languages = array_merge(array(""      => _("Automatic")),get_languages(TRUE));
-    asort($this->languages);
-    $smarty = get_smarty();
-    $smarty->assign("languages",    $this->languages);
-    $smarty->assign("lang",         $this->lang);
-    $smarty->assign("lang_selected",$this->lang_selected);
-    return($smarty->fetch(get_template_path("setup_language.tpl",TRUE,dirname(__FILE__))));
-  }
-
-  function save_object()
-  {
-    if((isset($_POST['lang_selected'])) && isset($this->languages[$_POST['lang_selected']])) {
-      $this->lang_selected = $_POST['lang_selected'];
-      $this->is_completed = TRUE;
-
-      if($this->lang_selected != ""){
-        $_SESSION['lang'] = $this->lang_selected;
-      }else{
-        $_SESSION['lang'] = $this->lang;
-      }
-    }
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/setup/class_setupStep_Ldap.inc b/setup/class_setupStep_Ldap.inc
deleted file mode 100644 (file)
index 9b5f670..0000000
+++ /dev/null
@@ -1,208 +0,0 @@
-<?php
-
-/*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2007 Fabian Hickert
-
-   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 Step_Ldap extends setup_step
-{
-  var $connection = "ldap://localhost:389";
-  var $location   = "default";
-  var $admin      = "";
-  var $password   = "";
-  var $base       = "";
-  var $append_base_to_admin_dn = FALSE;
-  var $admin_given = "";
-
-  var $connect_id = FALSE;
-  var $bind_id    = FALSE;
-
-  var $resolve_filter = "*";
-  var $resolve_user   = FALSE;
-  var $tls            = FALSE;
-
-  var $rfc2307bis             = FALSE;
-  var $attributes = array("connection","location","admin","password","base","admin_given","append_base_to_admin_dn","tls","rfc2307bis");
-
-  var $header_image= "images/proxy.png";
-
-  function Step_Ldap()
-  {
-    $this->update_strings();
-  }
-
-  
-  function update_strings()
-  {
-    $this->s_title      = _("LDAP setup");
-    $this->s_title_long = _("LDAP connection setup");
-    $this->s_info       = _("This dialog performs the basic configuration of the LDAP connectivity for GOsa.");
-  }
-  
-  
-  function execute()
-  {
-    $smarty = get_smarty();
-    foreach($this->attributes as $attr){
-      $smarty->assign($attr,$this->$attr);
-    }
-
-    /* Assign connection status */
-    $smarty->assign("connection_status",$this->get_connection_status());
-
-    /* Handle namingContext detection */
-    $attr = @LDAP::get_naming_contexts($this->connection);
-    unset($attr['count']);
-    $smarty->assign("namingContexts",$attr);
-    $smarty->assign("namingContextsCount",count($attr));
-    $smarty->assign("bool",array(FALSE => _("No"), TRUE => _("Yes")));
-
-    /* Addign resolved users */
-    $smarty->assign("resolve_user",$this->resolve_user);
-    if($this->resolve_user){
-      $tmp = $this->resolve_user();
-      $smarty->assign("resolved_users",$tmp);
-      $smarty->assign("resolved_users_count",count($tmp));
-      $smarty->assign("resolve_filter",$this->resolve_filter);
-    }
-
-    $base_to_append = $this->base;
-    if(strlen($base_to_append) > 20){
-      $base_to_append = substr($base_to_append,0,17)."...";
-    }
-    $smarty->assign("base_to_append",$base_to_append);
-    return($smarty -> fetch (get_template_path("../setup/setup_ldap.tpl")));
-  }
-
-  function get_connection_status()
-  {
-    $this->connect_id = FALSE;
-    $this->bind_id    = FALSE;
-
-    @ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7);
-    $this->connect_id = @ldap_connect($this->connection);
-      
-    @ldap_set_option($this->connect_id, LDAP_OPT_PROTOCOL_VERSION, 3);
-    $this->bind_id = @ldap_bind($this->connect_id, $this->admin, $this->password);
-    
-    if(!$this->bind_id){
-      $str = sprintf(_("Anonymous bind failed on server '%s'."),$this->connection); 
-      if(!empty($this->admin)){
-        $str = sprintf(_("Bind as user '%s' failed on server '%s'."),$this->admin,$this->connection);
-      }      
-      return("<font color='red'>".$str."</font>");
-    }else{
-      if(empty($this->admin)){
-        $str = sprintf(_("Anonymous bind on server '%s' succeeded."), $this->connection);
-        return("<font color='blue'>".$str."</font> <font color='red'>"._("Please specify user and password.")."</font>");
-      }else{
-        $str = sprintf(_("Bind as user '%s' on server '%s' succeeded."),$this->admin,$this->connection);
-        return("<font color='green'>".$str."</font>");
-      }      
-    }
-  }
-
-  
-  function resolve_user()
-  {
-    $filter  = $this->resolve_filter;
-    $ldap = new LDAP("","",$this->connection);
-    $ldap->cd($this->base);
-    $ldap->search("(&(objectClass=person)(|(uid=".$filter.")(cn=".$filter.")))");
-    $tmp = array();
-    while($attrs = $ldap->fetch()){
-      $tmp[base64_encode($attrs['dn'])]= @LDAP::fix($attrs['dn']);
-      natcasesort($tmp);
-    }
-    return($tmp);
-  }   
-
-
-  function save_object()
-  {
-    $reset = FALSE;
-    foreach($this->attributes as $attr){
-      if(isset($_POST[$attr])){
-        if(in_array($attr,array("base","connection")) && $this->$attr != get_post($attr)){
-          $reset = TRUE;
-        }
-        $this->$attr = get_post($attr);
-      }
-    }
-
-    if($reset){
-      $this->parent->disable_steps_from(($this->parent->step_name_to_id(get_class($this))) +1);
-      $attr = @LDAP::get_naming_contexts($this->connection);
-      if(is_array($attr) && !in_array(get_post("base"),$attr)){
-        if(isset($attr[0])){
-          $this->base = $attr[0];
-        }
-      }
-    }
-
-    if(isset($_POST['resolve_user_x'])){
-      $this->resolve_user = !$this->resolve_user;
-    }
-    if(isset($_POST['resolve_user'])){
-      $this->resolve_user = !$this->resolve_user;
-    }
-  
-    /* Hide backward forward button*/
-    $this->dialog = $this->resolve_user;
-    if(isset($_POST['resolve_filter'])){
-      $this->resolve_filter = get_post('resolve_filter');
-    }
-
-    if(isset($_POST['use_selected_user'])){
-
-      if(isset($_POST['admin_to_use'])){
-        $this->admin = base64_decode(get_post('admin_to_use'));
-        $this->resolve_user = false;
-      }
-    }
-
-    if(isset($_POST['append_base_to_admin_dn'])){
-      $this->append_base_to_admin_dn = TRUE;
-    }else{
-      $this->append_base_to_admin_dn = FALSE;
-    }
-    if($this->append_base_to_admin_dn){
-      $base = $this->base;      
-      if(!preg_match("/,$/",$this->admin_given)){
-        $base = ",".$base;
-      }
-      $this->admin = $this->admin_given.$base;
-    }else{
-      $this->admin = $this->admin_given;
-    }
-
-    $this->get_connection_status();
-    if($this->bind_id && !empty($this->admin) && !empty($this->base)){
-      $this->is_completed =TRUE;
-    }else{
-      $this->is_completed =FALSE;
-    }
-
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/setup/class_setupStep_License.inc b/setup/class_setupStep_License.inc
deleted file mode 100644 (file)
index d46768c..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-<?php
-
-/*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2007 Fabian Hickert
-
-   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 Step_License extends setup_step
-{
-  var $license_found  = false;
-  var $License        = "";
-  var $header_image   = "images/ldif.png";
-  var $accepted       = FALSE;
-  var $attributes     = array("accepted");
-  
-
-  function Step_License()
-  {
-    $this->update_strings();
-  }
-
-  
-  function load_license()
-  {
-    if(!file_exists("../setup/license.txt")){
-      $this->License = "<font color='red'>License not found. Setup stops here.</font>";
-      $this->license_found = false;
-    }else{
-      $fp = fopen("../setup/license.txt","r");
-      $this->License = "";
-      while (!feof($fp)){
-        $this->License .= fread($fp, 255);
-      }
-      $this->license_found = true;
-    }
-  }
-
-
-  function update_strings()
-  {
-    $this->s_title      = _("License");
-    $this->s_title_long = _("License");
-    $this->s_info       = _("Terms and conditions for usage");
-  }
-
-  function execute()
-  {
-    $this->load_license();
-
-    $smarty = get_smarty();
-    $smarty -> assign("License",nl2br($this->License));
-    $smarty -> assign("license_found",$this->license_found);
-    $smarty -> assign("accepted",$this->accepted);
-
-    return($smarty -> fetch (get_template_path("../setup/setup_license.tpl")));
-  }
-
-  
-  function save_object()
-  {
-    if(isset($_POST['step_license'])){
-      if(isset($_POST['accepted'])){
-        $this->accepted = TRUE;
-      }else{
-        $this->accepted = FALSE;
-      }
-    } 
-  
-    if($this->license_found && $this->accepted){
-      $this->is_completed = true;
-    }else{
-      $this->is_completed = false;
-    }
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/setup/class_setupStep_Migrate.inc b/setup/class_setupStep_Migrate.inc
deleted file mode 100644 (file)
index 5dcd8e6..0000000
+++ /dev/null
@@ -1,1946 +0,0 @@
-<?php
-
-/*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2007 Fabian Hickert
-
-   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
- */
-
-
-
-/****************
- * FUNCTIONS 
-
-Step_Migrate                - Constructor.
-update_strings              - Used to update the displayed step informations.
-initialize_checks           - Initialize migration steps.
-check_ldap_permissions      - Check if the used admin account has full access to the ldap database.
-check_gosaAccounts          - Check if there are users without the required objectClasses.
-migrate_gosaAccounts        - Migrate selected users to GOsa user accounts.
-check_organizationalUnits   - Check if there are departments, that are not visible for GOsa
-migrate_organizationalUnits - Migrate selected departments 
-check_administrativeAccount - Check if there is at least one acl entry available                  
-checkBase                   - Check if there is a root object available 
-
-get_user_list               - Get list of available users
-get_group_list              - Get list of groups
-  
-create_admin                
-create_admin_user           
-
-execute                     - Generate html output of this plugin
-save_object                 - Save posts 
-array_to_ldif               - Create ldif output of an ldap result array 
- ****************/
-
-
-
-class Step_Migrate extends setup_step
-{
-  var $languages      = array();
-  var $attributes     = array();
-  var $header_image   = "images/monitoring.png";
-  var $checks         = array();
-
-  /* Department migration attributes */
-  var $dep_migration_dialog = FALSE;
-  var $deps_to_migrate      = array();
-  var $show_details         = FALSE;
-
-  /* Department migration attributes */
-  var $users_migration_dialog= FALSE;
-  var $users_to_migrate      = array();
-
-  /* Create Acl attributes */
-  var $acl_create_dialog  = FALSE;
-  var $acl_create_selected= ""; // Currently selected element, that should receive admin rights 
-  var $acl_create_changes = ""; // Contains ldif information about changes 
-  var $acl_create_confirmed= FALSE;
-
-  /* Checks initialised ? */
-  var $checks_initialised = FALSE;
-
-  /* Users outside to people ou */
-  var $outside_users        = array();
-  var $outside_users_dialog = FALSE;
-
-  /* Users outside to groups ou */
-  var $outside_groups        = array();
-  var $outside_groups_dialog = FALSE;
-
-  /* Win-Workstations outside to reserved ou */
-  var $outside_winstations        = array();
-  var $outside_winstations_dialog = FALSE;
-
-  /* check for multiple use of same uidNumber */
-  var $check_uidNumbers        = array();
-  var $check_uidNumbers_dialog = FALSE;
-
-  /* check for multiple use of same gidNumber */
-  var $check_gidNumbers        = array();
-  var $check_gidNumbers_dialog = FALSE;
-
-
-  function Step_Migrate()
-  {
-    $this->update_strings(); 
-  }
-
-  function update_strings()
-  {
-    $this->s_title      = _("LDAP inspection");
-    $this->s_title_long = _("LDAP inspection");
-    $this->s_info       = _("Analyze your current LDAP for GOsa compatibility");
-  }
-
-  function initialize_checks()
-  {
-    $this->checks = array();
-    $this->checks['root']['TITLE']     = _("Checking for root object");
-    $this->checks['root']['STATUS']    = FALSE;
-    $this->checks['root']['STATUS_MSG']= "";
-    $this->checks['root']['ERROR_MSG'] = "";
-    $this->checkBase();
-
-    $this->checks['permissions']['TITLE']     = _("Checking permissions on LDAP database");
-    $this->checks['permissions']['STATUS']    = FALSE;
-    $this->checks['permissions']['STATUS_MSG']= "";
-    $this->checks['permissions']['ERROR_MSG'] = "";
-    $this->check_ldap_permissions();
-
-    $this->checks['deps_visible']['TITLE']     = _("Checking for invisible deparmtments");
-    $this->checks['deps_visible']['STATUS']    = FALSE;
-    $this->checks['deps_visible']['STATUS_MSG']= "";
-    $this->checks['deps_visible']['ERROR_MSG'] = "";
-    $this->check_organizationalUnits();
-
-    $this->checks['users_visible']['TITLE']     = _("Checking for invisible users");
-    $this->checks['users_visible']['STATUS']    = FALSE;
-    $this->checks['users_visible']['STATUS_MSG']= "";
-    $this->checks['users_visible']['ERROR_MSG'] = "";
-    $this->check_gosaAccounts();
-
-    $this->checks['acls']['TITLE']     = _("Checking for super administrator");
-    $this->checks['acls']['STATUS']    = FALSE;
-    $this->checks['acls']['STATUS_MSG']= "";
-    $this->checks['acls']['ERROR_MSG'] = "";
-    $this->check_administrativeAccount();
-
-    $this->checks['outside_users']['TITLE']     = _("Checking for users outside the people tree");
-    $this->checks['outside_users']['STATUS']    = FALSE;
-    $this->checks['outside_users']['STATUS_MSG']= "";
-    $this->checks['outside_users']['ERROR_MSG'] = "";
-    $this->search_outside_users();
-    
-    $this->checks['outside_groups']['TITLE']     = _("Checking for groups outside the groups tree");
-    $this->checks['outside_groups']['STATUS']    = FALSE;
-    $this->checks['outside_groups']['STATUS_MSG']= "";
-    $this->checks['outside_groups']['ERROR_MSG'] = "";
-    $this->search_outside_groups();
-
-    $this->checks['outside_winstations']['TITLE']     = _("Checking for windows workstations outside the winstation tree");
-    $this->checks['outside_winstations']['STATUS']    = FALSE;
-    $this->checks['outside_winstations']['STATUS_MSG']= "";
-    $this->checks['outside_winstations']['ERROR_MSG'] = "";
-    $this->search_outside_winstations();
-
-    $this->checks['uidNumber_usage']['TITLE']     = _("Checking for duplicate uid numbers");
-    $this->checks['uidNumber_usage']['STATUS']    = FALSE;
-    $this->checks['uidNumber_usage']['STATUS_MSG']= "";
-    $this->checks['uidNumber_usage']['ERROR_MSG'] = "";
-    $this->check_uidNumber();
-    
-    $this->checks['gidNumber_usage']['TITLE']     = _("Checking for duplicate gid numbers");
-    $this->checks['gidNumber_usage']['STATUS']    = FALSE;
-    $this->checks['gidNumber_usage']['STATUS_MSG']= "";
-    $this->checks['gidNumber_usage']['ERROR_MSG'] = "";
-    $this->check_gidNumber();
-  }
-
-
-  /* Check if there are uidNumbers which are used more than once. 
-   */
-  function check_uidNumber()
-  {
-    $cv = $this->parent->captured_values;
-    $ldap = new LDAP($cv['admin'],
-        $cv['password'],
-        $cv['connection'],
-        FALSE,
-        $cv['tls']);
-
-    $ldap->cd($cv['base']);
-    $res = $ldap->search("uidNumber=*",array("dn","uidNumber"));
-    if(!$res){
-      $this->checks['uidNumber_usage']['STATUS']    = FALSE;
-      $this->checks['uidNumber_usage']['STATUS_MSG']= _("LDAP query failed");
-      $this->checks['uidNumber_usage']['ERROR_MSG'] = _("Possibly the 'root object' is missing.");
-      return(false);
-    }
-
-    $this->check_uidNumbers= array(); 
-    $tmp = array();
-    while($attrs = $ldap->fetch()){
-      $tmp[$attrs['uidNumber'][0]][] = $attrs;
-    }
-
-    foreach($tmp as $id => $entries){
-      if(count($entries) > 1){
-        foreach($entries as $entry){
-          $this->check_uidNumbers[base64_encode($entry['dn'])] = $entry;
-        }
-      }
-    }
-
-    if($this->check_uidNumbers){
-      $this->checks['uidNumber_usage']['STATUS']    = FALSE;
-      $this->checks['uidNumber_usage']['STATUS_MSG']= "<font style='color:#F0A500'>"._("Warning")."</font>";
-      $this->checks['uidNumber_usage']['ERROR_MSG'] =
-        sprintf(_("Found %s duplicate values for attribute 'uidNumber'."),count($this->check_uidNumbers));
-      return(false);
-    }else{
-      $this->checks['uidNumber_usage']['STATUS']    = TRUE;
-      $this->checks['uidNumber_usage']['STATUS_MSG']= _("Ok");
-      $this->checks['uidNumber_usage']['ERROR_MSG'] = "";
-      return(TRUE);
-    }
-  }
-
-  
-  /* Check if there are duplicated gidNumbers present in ldap
-   */
-  function check_gidNumber()
-  {
-    $cv = $this->parent->captured_values;
-    $ldap = new LDAP($cv['admin'],
-        $cv['password'],
-        $cv['connection'],
-        FALSE,
-        $cv['tls']);
-
-    $ldap->cd($cv['base']);
-    $res = $ldap->search("(&(objectClass=posixGroup)(gidNumber=*))",array("dn","gidNumber"));
-    if(!$res){
-      $this->checks['gidNumber_usage']['STATUS']    = FALSE;
-      $this->checks['gidNumber_usage']['STATUS_MSG']= _("LDAP query failed");
-      $this->checks['gidNumber_usage']['ERROR_MSG'] = _("Possibly the 'root object' is missing.");
-      return(false);
-    }
-
-    $this->check_gidNumbers= array(); 
-    $tmp = array();
-    while($attrs = $ldap->fetch()){
-      $tmp[$attrs['gidNumber'][0]][] = $attrs;
-    }
-
-    foreach($tmp as $id => $entries){
-      if(count($entries) > 1){
-        foreach($entries as $entry){
-          $this->check_gidNumbers[base64_encode($entry['dn'])] = $entry;
-        }
-      }
-    }
-
-    if($this->check_gidNumbers){
-      $this->checks['gidNumber_usage']['STATUS']    = FALSE;
-      $this->checks['gidNumber_usage']['STATUS_MSG']= "<font style='color:#F0A500'>"._("Warning")."</font>";
-      $this->checks['gidNumber_usage']['ERROR_MSG'] =
-        sprintf(_("Found %s duplicate values for attribute 'gidNumber'."),count($this->check_gidNumbers));
-      return(false);
-    }else{
-      $this->checks['gidNumber_usage']['STATUS']    = TRUE;
-      $this->checks['gidNumber_usage']['STATUS_MSG']= _("Ok");
-      $this->checks['gidNumber_usage']['ERROR_MSG'] = "";
-      return(TRUE);
-    }
-  }
-
-
-  /* Search for winstations outside the winstation ou 
-   */
-  function search_outside_winstations()
-  {
-    $cv = $this->parent->captured_values;
-    $ldap = new LDAP($cv['admin'],
-        $cv['password'],
-        $cv['connection'],
-        FALSE,
-        $cv['tls']);
-
-    /* Get winstation ou */
-    if($cv['generic_settings']['wws_ou_active']) {
-      $winstation_ou = $cv['generic_settings']['ws_ou'];
-    }else{
-      $winstation_ou = "ou=winstations";
-    }
-
-    if($cv['samba_version'] == 3){
-      $oc = "sambaSamAccount";
-    }else{
-      $oc = "sambaAccount";
-    }
-    $ldap->cd($cv['base']);
-    $res = $ldap->search("(&(objectClass=".$oc.")(uid=*$))",array("dn","sambaSID"));
-    if(!$res){
-      $this->checks['outside_winstations']['STATUS']    = FALSE;
-      $this->checks['outside_winstations']['STATUS_MSG']= _("LDAP query failed");
-      $this->checks['outside_winstations']['ERROR_MSG'] = _("Possibly the 'root object' is missing.");
-      return(false);
-    }
-
-    $this->outside_winstations = array();
-    while($attrs = $ldap->fetch()){
-      if((!preg_match("/^[^,]+,".normalizePreg($winstation_ou)."/",$attrs['dn'])) && !preg_match("/,dc=addressbook,/",$attrs['dn'])){
-        $attrs['selected'] = FALSE;
-        $attrs['ldif']     = "";
-        $this->outside_winstations[base64_encode($attrs['dn'])] = $attrs;
-      }
-    }
-
-    if(count($this->outside_winstations)){
-      $this->checks['outside_winstations']['STATUS']    = FALSE;
-      $this->checks['outside_winstations']['STATUS_MSG']= _("Failed");
-      $this->checks['outside_winstations']['ERROR_MSG'] = 
-        sprintf(_("Found %s winstations outside the predefined winstation department ou '%s'."),count($this->outside_winstations),$winstation_ou);
-      $this->checks['outside_winstations']['ERROR_MSG'].= "<input type='submit' name='outside_winstations_dialog' value='"._("Migrate")."...'>";
-      return(false);
-    }else{
-      $this->checks['outside_winstations']['STATUS']    = TRUE;
-      $this->checks['outside_winstations']['STATUS_MSG']= _("Ok");
-      $this->checks['outside_winstations']['ERROR_MSG'] = "";
-      return(TRUE);
-    }
-  }
-
-
-  /* Search for groups outside the group ou 
-   */
-  function search_outside_groups()
-  {
-    $cv = $this->parent->captured_values;
-    $ldap = new LDAP($cv['admin'],
-        $cv['password'],
-        $cv['connection'],
-        FALSE,
-        $cv['tls']);
-
-    $group_ou = $cv['groupou'];
-    $ldap->cd($cv['base']);
-
-    /***********
-     * Get all gosaDepartments to be able to
-     *  validate correct ldap tree position of every single user
-     ***********/
-    $valid_deps = array();
-    $valid_deps['/'] = $cv['base'];
-    $ldap->search("(&(objectClass=gosaDepartment)(ou=*))",array("dn","ou"));
-    while($attrs = $ldap->fetch()){
-      $valid_deps[] = $attrs['dn'];
-    }
-
-    /***********
-     * Get all groups
-     ***********/
-    $res = $ldap->search("(objectClass=posixGroup)",array("dn"));
-    if(!$res){
-      $this->checks['outside_groups']['STATUS']    = FALSE;
-      $this->checks['outside_groups']['STATUS_MSG']= _("LDAP query failed");
-      $this->checks['outside_groups']['ERROR_MSG'] = _("Possibly the 'root object' is missing.");
-      return(false);
-    }
-
-    $this->outside_groups = array();
-    while($attrs = $ldap->fetch()){
-      $group_db_base = preg_replace("/^[^,]+,".normalizePreg($group_ou)."+,/i","",$attrs['dn']);
-
-      /* Check if entry is not an addressbook only user
-       *  and verify that he is in a valid department
-       */
-      if( !preg_match("/".normalizePreg("dc=addressbook,")."/",$group_db_base) &&
-          !in_array($group_db_base,$valid_deps)
-        ){
-        $attrs['selected'] = FALSE;
-        $attrs['ldif']     = "";
-        $this->outside_groups[base64_encode($attrs['dn'])] = $attrs;
-      }
-    }
-
-    if(count($this->outside_groups)){
-      $this->checks['outside_groups']['STATUS']    = FALSE;
-      $this->checks['outside_groups']['STATUS_MSG']= "<font style='color:#F0A500'>"._("Warning")."</font>";
-      $this->checks['outside_groups']['ERROR_MSG'] =
-        sprintf(_("Found %s groups outside the configured tree '%s'."),count($this->outside_groups),$group_ou);
-      $this->checks['outside_groups']['ERROR_MSG'].= "&nbsp;<input type='submit' name='outside_groups_dialog' value='"._("Move")."...'>";
-      return(false);
-    }else{
-      $this->checks['outside_groups']['STATUS']    = TRUE;
-      $this->checks['outside_groups']['STATUS_MSG']= _("Ok");
-      $this->checks['outside_groups']['ERROR_MSG'] = "";
-      return(TRUE);
-    }
-  }
-
- /* Search for users outside the people ou
-   */
-  function search_outside_users()
-  {
-    $cv = $this->parent->captured_values;
-    $ldap = new LDAP($cv['admin'],
-        $cv['password'],
-        $cv['connection'],
-        FALSE,
-        $cv['tls']);
-
-    $ldap->cd($cv['base']);
-
-
-    /***********
-     * Get all gosaDepartments to be able to
-     *  validate correct ldap tree position of every single user
-     ***********/
-    $valid_deps = array();
-    $valid_deps['/'] = $cv['base'];
-    $ldap->search("(&(objectClass=gosaDepartment)(ou=*))",array("dn","ou"));
-    while($attrs = $ldap->fetch()){
-      $valid_deps[] = $attrs['dn'];
-    }
-
-    /***********
-     * Search for all users
-     ***********/
-    $res = $ldap->search("(&(objectClass=gosaAccount)(!(uid=*$)))",array("dn"));
-    if(!$res){
-      $this->checks['outside_users']['STATUS']    = FALSE;
-      $this->checks['outside_users']['STATUS_MSG']= _("LDAP query failed");
-      $this->checks['outside_users']['ERROR_MSG'] = _("Possibly the 'root object' is missing.");
-      return(false);
-    }
-
-    /***********
-     * Check if returned users are within a valid GOsa deparmtment. (peopleou,gosaDepartment,base)
-     ***********/
-    $this->outside_users = array();
-    $people_ou = trim($cv['peopleou']);
-    if(!empty($people_ou)){
-      $people_ou = $people_ou.",";
-    }
-
-    while($attrs = $ldap->fetch()){
-      $people_db_base = preg_replace("/^[^,]+,".normalizePreg($people_ou)."/i","",$attrs['dn']);
-
-      /* Check if entry is not an addressbook only user
-       *  and verify that he is in a valid department
-       */
-      if( !preg_match("/".normalizePreg("dc=addressbook,")."/",$people_db_base) &&
-          !in_array($people_db_base,$valid_deps)
-         ){
-        $attrs['selected'] = FALSE;
-        $attrs['ldif']     = "";
-        $this->outside_users[base64_encode($attrs['dn'])] = $attrs;
-      }
-    }
-
-    if(count($this->outside_users)){
-      $this->checks['outside_users']['STATUS']    = FALSE;
-      $this->checks['outside_users']['STATUS_MSG']= "<font style='color:#F0A500'>"._("Warning")."</font>";
-      $this->checks['outside_users']['ERROR_MSG'] =
-        sprintf(_("Found %s user(s) outside the configured tree '%s'."),count($this->outside_users),$people_ou);
-      $this->checks['outside_users']['ERROR_MSG'].= "<input type='submit' name='outside_users_dialog' value='"._("Move")."...'>";
-      return(false);
-    }else{
-      $this->checks['outside_users']['STATUS']    = TRUE;
-      $this->checks['outside_users']['STATUS_MSG']= _("Ok");
-      $this->checks['outside_users']['ERROR_MSG'] = "";
-      return(TRUE);
-    }
-  }
-
-
-  /* Check ldap accessibility 
-   * Create and remove a dummy object, 
-   *  to ensure that we have the necessary permissions
-   */
-  function check_ldap_permissions()
-  {
-    $cv = $this->parent->captured_values;
-    $ldap = new LDAP($cv['admin'],
-        $cv['password'],
-        $cv['connection'],
-        FALSE,
-        $cv['tls']);
-
-    /* Create dummy entry 
-     */
-    $name     = "GOsa_setup_text_entry_".session_id().rand(0,999999);
-    $dn       = "ou=".$name.",".$cv['base'];
-    $testEntry= array();
-    $testEntry['objectClass'][]= "top";
-    $testEntry['objectClass'][]= "organizationalUnit";
-    $testEntry['objectClass'][]= "gosaDepartment";
-    $testEntry['description']= "Created by GOsa setup, this object can be removed.";
-    $testEntry['ou']  = $name;
-
-    /* check if simple ldap cat will be successful 
-     */
-    $res = $ldap->cat($cv['base']);  
-    if(!$res){
-      $this->checks['permissions']['STATUS']    = FALSE;
-      $this->checks['permissions']['STATUS_MSG']= _("LDAP query failed");
-      $this->checks['permissions']['ERROR_MSG'] = _("Possibly the 'root object' is missing.");
-      return(false);
-    }
-  
-    /* Try to create dummy object 
-     */ 
-    $ldap->cd ($dn);
-    $ldap->create_missing_trees($dn);
-    $res = $ldap->add($testEntry);
-    $ldap->cat($dn);
-    if(!$ldap->count()){
-      new log("view","setup/".get_class($this),$dn,array(),$ldap->get_error());
-
-      $this->checks['permissions']['STATUS']    = FALSE;
-      $this->checks['permissions']['STATUS_MSG']= _("Failed");
-      $this->checks['permissions']['ERROR_MSG'] = 
-        sprintf(_("The specified user '%s' does not have full access to your ldap database."),$cv['admin']);
-      return(false);
-    }
-
-    /* Try to remove created entry 
-     */
-    $res = $ldap->rmDir($dn);
-    $ldap->cat($dn);
-    if($ldap->count()){
-      new log("view","setup/".get_class($this),$dn,array(),$ldap->get_error());
-      $this->checks['permissions']['STATUS']    = FALSE;
-      $this->checks['permissions']['STATUS_MSG']= _("Failed");
-      $this->checks['permissions']['ERROR_MSG'] = 
-        sprintf(_("The specified user '%s' does not have full access to your ldap database."),$cv['admin']);
-      return(false);
-    }
-
-    /* Create & remove of dummy object was successful */
-    $this->checks['permissions']['STATUS']    = TRUE;
-    $this->checks['permissions']['STATUS_MSG']= _("Ok");
-    $this->checks['permissions']['ERROR_MSG'] = "";
-    return(true);
-  } 
-
-
-  /* Check if there are users which will 
-   *  be invisible for GOsa 
-   */
-  function check_gosaAccounts()
-  {
-    /* Remember old list of ivisible users, to be able to set 
-     *  the 'html checked' status for the checkboxes again 
-     */
-    $cnt_ok = 0;
-    $old    = $this->users_to_migrate;
-    $this->users_to_migrate = array();
-
-    /* Get collected configuration settings */
-    $cv = $this->parent->captured_values;
-
-    /* Establish ldap connection */
-    $ldap = new LDAP($cv['admin'],
-        $cv['password'],
-        $cv['connection'],
-        FALSE,
-        $cv['tls']);
-
-    /* Get all invisible users 
-     */
-    $ldap->cd($cv['base']); 
-    $res =$ldap->search("(&(|(objectClass=posixAccount)(&(objectClass=inetOrgPerson)(objectClass=organizationalPerson)))(!(objectClass=gosaAccount))(uid=*))",array("sn","givenName","cn","uid"));
-    while($attrs = $ldap->fetch()){
-      if(!preg_match("/,dc=addressbook,/",$attrs['dn'])){
-        $attrs['checked'] = FALSE;
-        $attrs['before']  = "";
-        $attrs['after']   = "";
-
-        /* Set objects to selected, that were selected before reload */
-        if(isset($old[base64_encode($attrs['dn'])])){
-          $attrs['checked'] = $old[base64_encode($attrs['dn'])]['checked'];
-        }
-        $this->users_to_migrate[base64_encode($attrs['dn'])] = $attrs;
-      }
-    }
-
-    /* No invisible */
-    if(!$res){
-      $this->checks['users_visible']['STATUS']    = FALSE;
-      $this->checks['users_visible']['STATUS_MSG']= _("LDAP query failed");
-      $this->checks['users_visible']['ERROR_MSG'] = _("Possibly the 'root object' is missing.");
-    }elseif(count($this->users_to_migrate) == 0){
-      $this->checks['users_visible']['STATUS']    = TRUE;
-      $this->checks['users_visible']['STATUS_MSG']= _("Ok");
-      $this->checks['users_visible']['ERROR_MSG'] = "";
-    }else{
-      $this->checks['users_visible']['STATUS']    = FALSE;
-      $this->checks['users_visible']['STATUS_MSG']= "<font style='color:#F0A500'>"._("Warning")."</font>";
-      $this->checks['users_visible']['ERROR_MSG'] = sprintf(_("Found %s user(s) that will not be visible in GOsa."), 
-          count($this->users_to_migrate));
-      $this->checks['users_visible']['ERROR_MSG'] .= "<input type='submit' name='users_visible_migrate' value='"._("Migrate")."...'>";
-    }
-  }
-
-
-  /* Start user account migration 
-   */  
-  function migrate_gosaAccounts($only_ldif = FALSE)
-  {
-    $this->show_details= $only_ldif;
-
-    /* Get collected configuration settings */
-    $cv = $this->parent->captured_values;
-
-    /* Establish ldap connection */
-    $ldap = new LDAP($cv['admin'],
-        $cv['password'],
-        $cv['connection'],
-        FALSE,
-        $cv['tls']);
-
-    /* Add gosaAccount objectClass to the selected users  
-     */
-    foreach($this->users_to_migrate as $key => $dep){
-      if($dep['checked']){
-
-        /* Get old objectClasses */
-        $ldap->cat($dep['dn'],array("objectClass"));
-        $attrs      = $ldap->fetch();
-
-        /* Create new objectClass array */
-        $new_attrs  = array();
-        $new_attrs['objectClass']= array("gosaAccount","inetOrgPerson","organizationalPerson");
-        for($i = 0 ; $i < $attrs['objectClass']['count']; $i ++ ){
-          if(!in_array_ics($attrs['objectClass'][$i], $new_attrs['objectClass'])){
-            $new_attrs['objectClass'][]   = $attrs['objectClass'][$i];
-          }
-        }
-
-        /* Set info attributes for current object, 
-         *  or write changes to the ldap database 
-         */
-        if($only_ldif){
-          $this->users_to_migrate[$key]['before'] = $this->array_to_ldif($attrs);
-          $this->users_to_migrate[$key]['after']  = $this->array_to_ldif($new_attrs);
-        }else{
-          $ldap->cd($attrs['dn']);
-          if(!$ldap->modify($new_attrs)){
-            print_red(sprintf(_("Failed to migrate the department '%s' into GOsa, error message is as follows '%s'."),$attrs['dn'],$ldap->get_error()));
-            return(false);
-          }
-        }
-      }
-    }
-    return(TRUE);
-  }
-
-
-  /* Check if there are invisible organizational Units 
-   */
-  function check_organizationalUnits()
-  {
-    $cnt_ok = 0;
-    $old = $this->deps_to_migrate;
-    $this->deps_to_migrate = array();
-
-    /* Get collected configuration settings */
-    $cv = $this->parent->captured_values;
-
-    /* Establish ldap connection */
-    $ldap = new LDAP($cv['admin'],
-        $cv['password'],
-        $cv['connection'],
-        FALSE,
-        $cv['tls']);
-
-    /* Skip GOsa internal departments */
-    $skip_dns = array("/".$cv['peopleou']."/","/".$cv['groupou']."/","/^ou=people,/","/^ou=groups,/",
-        "/(,|)ou=configs,/","/(,|)ou=systems,/",
-        "/(,|)ou=apps,/","/(,|)ou=mime,/","/(,|)ou=devices/","/^ou=aclroles,/","/^ou=incoming,/",
-        "/ou=snapshots,/","/(,|)dc=addressbook,/","/^(,|)ou=machineaccounts,/",
-        "/(,|)ou=winstations,/");
-
-    /* Get all invisible departments */
-    $ldap->cd($cv['base']); 
-    $res = $ldap->search("(&(objectClass=organizationalUnit)(!(objectClass=gosaDepartment)))",array("ou","description","dn"));
-    while($attrs = $ldap->fetch()){
-      $attrs['checked'] = FALSE;
-      $attrs['before']  = "";
-      $attrs['after']   = "";
-
-      /* Set objects to selected, that were selected before reload */
-      if(isset($old[base64_encode($attrs['dn'])])){
-        $attrs['checked'] = $old[base64_encode($attrs['dn'])]['checked'];
-      }
-      $this->deps_to_migrate[base64_encode($attrs['dn'])] = $attrs;
-    }
-
-    /* Filter returned list of departments and ensure that 
-     *  GOsa internal departments will not be listed 
-     */
-    foreach($this->deps_to_migrate as $key => $attrs){
-      $dn = $attrs['dn'];
-      $skip = false;;
-      foreach($skip_dns as $skip_dn){
-        if(preg_match($skip_dn,$dn)){
-          $skip = true;
-        }
-      }
-      if($skip){
-        unset($this->deps_to_migrate[$key]);
-      }
-    }
-
-    /* If we have no invisible departments found  
-     *  tell the user that everything is ok 
-     */
-    if(!$res){
-      $this->checks['deps_visible']['STATUS']    = FALSE;
-      $this->checks['deps_visible']['STATUS_MSG']= _("LDAP query failed");
-      $this->checks['deps_visible']['ERROR_MSG'] = _("Possibly the 'root object' is missing.");
-    }elseif(count($this->deps_to_migrate) == 0 ){
-      $this->checks['deps_visible']['STATUS']    = TRUE;
-      $this->checks['deps_visible']['STATUS_MSG']= _("Ok");
-      $this->checks['deps_visible']['ERROR_MSG'] = "";
-    }else{
-      $this->checks['deps_visible']['STATUS']    = TRUE;
-      $this->checks['deps_visible']['STATUS_MSG']= '<font style="color:#FFA500">'._("Warning").'</font>';
-      $this->checks['deps_visible']['ERROR_MSG'] = sprintf(_("Found %s department(s) that will not be visible in GOsa."),count($this->deps_to_migrate));
-      $this->checks['deps_visible']['ERROR_MSG'] .= "&nbsp;<input type='submit' name='deps_visible_migrate' value='"._("Migrate")."...'>";
-    }
-  }
-
-
-
-  /* Start deparmtment migration */  
-  function migrate_organizationalUnits($only_ldif = FALSE)
-  {
-    $this->show_details= $only_ldif;
-
-    /* Get collected configuration settings */
-    $cv = $this->parent->captured_values;
-
-    /* Establish ldap connection */
-    $ldap = new LDAP($cv['admin'],
-        $cv['password'],
-        $cv['connection'],
-        FALSE,
-        $cv['tls']);
-
-    /* Add gosaDepartment objectClass to each selected entry 
-     */
-    foreach($this->deps_to_migrate as $key => $dep){
-      if($dep['checked']){
-
-        /* Get current objectClasses */
-        $ldap->cat($dep['dn'],array("objectClass","description"));
-        $attrs      = $ldap->fetch();
-
-        /* Create new objectClass attribute including gosaDepartment*/
-        $new_attrs  = array();
-        for($i = 0 ; $i < $attrs['objectClass']['count']; $i ++ ){
-          $new_attrs['objectClass'][]   = $attrs['objectClass'][$i];
-        }
-        $new_attrs['objectClass'][] = "gosaDepartment";
-
-        /* Append description it is missing */
-        if(!isset($attrs['description'])){
-          $new_attrs['description'][] = "GOsa department";
-        }
-
-        /* Depending on the parameter >only_diff< we save the changes as ldif
-         *  or we write our changes directly to the ldap database
-         */
-        if($only_ldif){
-          $this->deps_to_migrate[$key]['before'] = $this->array_to_ldif($attrs);
-          $this->deps_to_migrate[$key]['after']  = $this->array_to_ldif($new_attrs);
-        }else{
-          $ldap->cd($attrs['dn']);
-          if(!$ldap->modify($new_attrs)){
-            print_red(sprintf(_("Failed to migrate the department '%s' into GOsa, error message is as follows '%s'."),$attrs['dn'],$ldap->get_error()));
-            return(false);
-          }
-        }
-      }
-    }
-    return(TRUE);
-  }
-
-
-  /* Check Acls if there is at least one object with acls defined 
-   */
-  function check_administrativeAccount()
-  {
-    /* Establish ldap connection */
-    $cv = $this->parent->captured_values;
-    $ldap = new LDAP($cv['admin'],
-        $cv['password'],
-        $cv['connection'],
-        FALSE,
-        $cv['tls']);
-
-    /* Search for gosaAcls */ 
-    $ldap->cd($cv['base']);
-    $res = $ldap->cat($cv['base']);
-    
-    if(!$res){
-      $this->checks['acls']['STATUS']    = FALSE;
-      $this->checks['acls']['STATUS_MSG']= _("LDAP query failed");
-      $this->checks['acls']['ERROR_MSG'] = _("Possibly the 'root object' is missing.");
-    }else{
-      $found = false;
-      $username = "";
-      $attrs = $ldap->fetch();
-      if(isset($attrs['gosaAclEntry'])){
-        $acls = $attrs['gosaAclEntry'];
-        for($i = 0 ; $i < $acls['count'] ; $i++){
-          $acl = $acls[$i];
-          $tmp = split(":",$acl);
-          if($tmp[1] == "psub"){
-            $members = split(",",$tmp[2]);
-            foreach($members as $member){
-              $member = base64_decode($member);
-
-              /* Check if acl owner is a valid GOsa user account */
-              $ldap->cat($member,array("objectClass","uid","cn"));
-              $ret = $ldap->fetch();
-
-              if(isset($ret['objectClass']) && in_array("posixGroup",$ret['objectClass'])){
-                $found = TRUE;
-                $username .= "ACL-Group:&nbsp;".$ret['cn'][0]."<br>";
-              }elseif(isset($ret['objectClass']) && in_array("gosaAccount",$ret['objectClass']) &&
-                  in_array("organizationalPerson",$ret['objectClass']) &&
-                  in_array("inetOrgPerson",$ret['objectClass'])){
-                $found = TRUE;
-                $username .= "ACL:&nbsp;".$ret['uid'][0]."<br>";
-              }
-            }
-          }elseif($tmp[1] == "role"){
-
-            /* Check if acl owner is a valid GOsa user account */
-            $ldap->cat(base64_decode($tmp[2]),array("gosaAclTemplate"));
-            $ret = $ldap->fetch();
-
-            if(isset($ret['gosaAclTemplate'])){
-              $cnt = $ret['gosaAclTemplate']['count'];
-              for($e = 0 ; $e < $cnt ; $e++){
-
-                $a_str = $ret['gosaAclTemplate'][$e];
-                if(preg_match("/^[0-9]*:psub:/",$a_str) && preg_match("/:all;cmdrw$/",$a_str)){
-
-                  $members = split(",",$tmp[3]);
-                  foreach($members as $member){
-                    $member = base64_decode($member);
-
-                    /* Check if acl owner is a valid GOsa user account */
-                    $ldap->cat($member,array("objectClass","uid"));
-                    $ret = $ldap->fetch();
-  
-                    if(isset($ret['objectClass']) && in_array("gosaAccount",$ret['objectClass']) &&
-                        in_array("organizationalPerson",$ret['objectClass']) &&
-                        in_array("inetOrgPerson",$ret['objectClass'])){
-                      $found = TRUE;
-                      $username .= "ACL Role:&nbsp;".$ret['uid'][0]."<br>";
-                    }
-                  }
-                }
-              }
-            }
-          }
-        }
-      }
-
-      # For debugging
-      #echo $username;
-
-      if($found){
-        $this->checks['acls']['STATUS']    = TRUE;
-        $this->checks['acls']['STATUS_MSG']= _("Ok");
-        $this->checks['acls']['ERROR_MSG'] = "";
-      }else{
-        $this->checks['acls']['STATUS']    = FALSE;
-        $this->checks['acls']['STATUS_MSG']= _("Failed");
-        $this->checks['acls']['ERROR_MSG']= _("There is no GOsa administrator account inside your LDAP.")."&nbsp;";
-        $this->checks['acls']['ERROR_MSG'].= "<input type='submit' name='create_acls' value='"._("Create")."'>";
-      }
-    }
-    return($ldap->count()>=1);
-  }
-
-
-
-  function create_admin($only_ldif = FALSE)
-  {
-    /* Reset '' */
-    $this->acl_create_changes="";
-
-    /* Object that should receive admin acls */
-    $dn = $this->acl_create_selected;
-
-    /* Get collected configuration settings */
-    $cv = $this->parent->captured_values;
-
-    /* Establish ldap connection */
-    $ldap = new LDAP($cv['admin'],
-        $cv['password'],
-        $cv['connection'],
-        FALSE,
-        $cv['tls']);
-
-    /* Get current base attributes */
-    $ldap->cd($cv['base']);
-    $ldap->cat($cv['base'],array("dn","objectClass","gosaAclEntry"));
-    $attrs = $ldap->fetch();
-
-    /* Add acls for the selcted user to the base */
-    $attrs_new['objectClass'] = array("gosaACL");
-
-    for($i = 0; $i < $attrs['objectClass']['count']; $i ++){
-      if(!in_array_ics($attrs['objectClass'][$i],$attrs_new['objectClass'])){
-        $attrs_new['objectClass'][] = $attrs['objectClass'][$i];
-      }
-    }
-
-    $acl = "0:psub:".base64_encode($dn).":all;cmdrw";    
-    $attrs_new['gosaAclEntry'][] = $acl;
-    if(isset($attrs['gosaAclEntry'])){
-      for($i = 0 ; $i < $attrs['gosaAclEntry']['count']; $i ++){
-          
-        $prio = preg_replace("/[:].*$/","",$attrs['gosaAclEntry'][$i]);
-        $rest = preg_replace("/^[^:]/","",$attrs['gosaAclEntry'][$i]);
-        $data = ($prio+1).$rest;
-        $attrs_new['gosaAclEntry'][] = $data;
-      }
-    }
-
-    if($only_ldif){
-      $this->acl_create_changes ="\n".($ldap->fix($cv['base']))."\n";
-      $this->acl_create_changes.=$this->array_to_ldif($attrs)."\n";
-      $this->acl_create_changes.="\n".($ldap->fix($cv['base']))."\n";
-      $this->acl_create_changes.=$this->array_to_ldif($attrs_new);
-    }else{
-   
-      $ldap->cd($cv['base']);
-      if(!$ldap->modify($attrs_new)){
-        print_red(sprintf(_("Adding acls for user '%s' failed, ldap says '%s'."),$dn,$ldap->get_error()));
-        return(FALSE);
-      }else{
-        return(TRUE);
-      }
-    }
-  }
-  
-  function create_admin_user()
-  {
-    $pw1 = $pw2 = "";
-    $uid = "";
-  
-    if(isset($_POST['new_user_uid'])){
-      $uid = $_POST['new_user_uid'];
-    }
-    if(isset($_POST['new_user_password'])){
-      $pw1 = $_POST['new_user_password'];
-    }
-    if(isset($_POST['new_user_password2'])){
-      $pw2 = $_POST['new_user_password2'];
-    }
-  
-    if(empty($pw1) || empty($pw2) | ($pw1 != $pw2)){
-      print_red(_("Specified passwords are empty or not equal."));
-      return false;
-    }
-    if(!is_uid($uid) || empty($uid)){
-      print_red(_("Please specify a valid uid."));
-      return false;
-    }
-    
-
-    /* Establish ldap connection */
-    $cv = $this->parent->captured_values;
-    $ldap = new LDAP($cv['admin'],
-        $cv['password'],
-        $cv['connection'],
-        FALSE,
-        $cv['tls']);
-
-    /* Get current base attributes */
-    $ldap->cd($cv['base']);
-  
-    $people_ou = trim($cv['peopleou']);
-    if(!empty($people_ou)){
-      $people_ou = trim($people_ou).",";
-    }
-
-    if($cv['peopledn'] == "cn"){
-      $dn = "cn=System Administrator,".$people_ou.$cv['base'];
-    }else{
-      $dn = "uid=".$uid.",".$people_ou.$cv['base'];
-    }
-
-    $methods = @passwordMethod::get_available_methods();
-    $p_m = $methods[$cv['encryption']];
-    $p_c = new $p_m(array());
-    $hash = $p_c->generate_hash($pw2);
-
-    $new_user=array();
-    $new_user['objectClass']= array("top","person","gosaAccount","organizationalPerson","inetOrgPerson");
-    $new_user['givenName']  = "System";
-    $new_user['sn']  = "Administrator";
-    $new_user['cn']  = "System Administrator";
-    $new_user['uid'] = $uid;
-    $new_user['userPassword'] = $hash;
-   
-    $ldap->cd($cv['base']);
-  
-    $ldap->cat($dn,array("dn"));
-    if($ldap->count()){
-      print_red(sprintf(_("Could not add administrative user, there is already an object with the same dn '%s' in your ldap database."),$dn));
-      return(FALSE);  
-    }
-
-    $ldap->create_missing_trees(preg_replace("/^[^,]+,/","",$dn));
-    $ldap->cd($dn);  
-    $res = $ldap->add($new_user);
-    $this->acl_create_selected = $dn;
-    $this->create_admin();
-    
-    if(!$res){
-      print_red($ldap->get_error());
-      return(FALSE);
-    }
-  
-    $this->acl_create_dialog=FALSE;        
-    $this->check_administrativeAccount();
-    return(TRUE);
-  }
-
-  function migrate_outside_winstations($perform = FALSE)
-  {
-    /* Establish ldap connection */
-    $cv = $this->parent->captured_values;
-    $ldap = new LDAP($cv['admin'],
-        $cv['password'],
-        $cv['connection'],
-        FALSE,
-        $cv['tls']);
-
-    $ldap->cd($cv['base']);
-
-    /* Check if there was a destination department posted */
-    if(isset($_POST['move_winstation_to'])){
-      $destination_dep = $_POST['move_winstation_to'];
-    }else{
-      print_red(_("Couldn't move users to specified department."));
-      return(false);
-    }
-    foreach($this->outside_winstations as $b_dn => $data){
-      $this->outside_winstations[$b_dn]['ldif'] ="";
-      if($data['selected']){
-        $dn = base64_decode($b_dn);
-        $d_dn = preg_replace("/,.*$/",",".base64_decode($destination_dep),$dn);
-        if(!$perform){
-          $this->outside_winstations[$b_dn]['ldif'] = _("Winstation will be moved from").":<br>\t".($ldap->fix($dn))."<br>"._("to").":<br>\t".($ldap->fix($d_dn));
-
-
-          /* Check if there are references to this object */
-          $ldap->search("(&(member=".$dn.")(|(objectClass=gosaGroupOfNames)(objectClass=groupOfNames)))",array('dn'));
-          $refs = "";
-          while($attrs = $ldap->fetch()){
-            $ref_dn = $attrs['dn'];
-            $refs .= "<br />\t".$ref_dn;
-          } 
-          if(!empty($refs)){ 
-            $this->outside_winstations[$b_dn]['ldif'] .= "<br /><br /><i>"._("Updating following references too").":</i>".$refs;
-          }
-
-        }else{
-          $this->move($dn,$d_dn);
-        }
-      }
-    }
-  }
-  
-
-  function migrate_outside_groups($perform = FALSE)
-  {
-    /* Establish ldap connection */
-    $cv = $this->parent->captured_values;
-    $ldap = new LDAP($cv['admin'],
-        $cv['password'],
-        $cv['connection'],
-        FALSE,
-        $cv['tls']);
-
-    $ldap->cd($cv['base']);
-
-    /* Check if there was a destination department posted */
-    if(isset($_POST['move_group_to'])){
-      $destination_dep = $_POST['move_group_to'];
-    }else{
-      print_red(_("Couldn't move users to specified department."));
-      return(false);
-    }
-    foreach($this->outside_groups as $b_dn => $data){
-      $this->outside_groups[$b_dn]['ldif'] ="";
-      if($data['selected']){
-        $dn = base64_decode($b_dn);
-        $d_dn = preg_replace("/,.*$/",",".base64_decode($destination_dep),$dn);
-        if(!$perform){
-
-          $this->outside_groups[$b_dn]['ldif'] = _("Group will be moved from").":<br>\t".($ldap->fix($dn))."<br>"._("to").":<br>\t".($ldap->fix($d_dn));
-
-          /* Check if there are references to this object */
-          $ldap->search("(&(member=".$dn.")(|(objectClass=gosaGroupOfNames)(objectClass=groupOfNames)))",array('dn'));
-          $refs = "";
-          while($attrs = $ldap->fetch()){
-            $ref_dn = $attrs['dn'];
-            $refs .= "<br />\t".$ref_dn;
-          } 
-          if(!empty($refs)){ 
-            $this->outside_groups[$b_dn]['ldif'] .= "<br /><br /><i>"._("Updating following references too").":</i>".$refs;
-          }
-
-        }else{
-          $this->move($dn,$d_dn);
-        }
-      }
-    }
-  }
-  
-
-  function migrate_outside_users($perform = FALSE)
-  {
-    /* Establish ldap connection */
-    $cv = $this->parent->captured_values;
-    $ldap = new LDAP($cv['admin'],
-        $cv['password'],
-        $cv['connection'],
-        FALSE,
-        $cv['tls']);
-
-    $ldap->cd($cv['base']);
-
-    /* Check if there was a destination department posted */
-    if(isset($_POST['move_user_to'])){
-      $destination_dep = $_POST['move_user_to'];
-    }else{
-      print_red(_("Couldn't move users to specified department."));
-      return(false);
-    }
-      
-    foreach($this->outside_users as $b_dn => $data){
-      $this->outside_users[$b_dn]['ldif'] ="";
-      if($data['selected']){
-        $dn = base64_decode($b_dn);
-        $d_dn = preg_replace("/,.*$/",",".base64_decode($destination_dep),$dn);
-        if(!$perform){
-          $this->outside_users[$b_dn]['ldif'] = _("User will be moved from").":<br>\t".($ldap->fix($dn))."<br>"._("to").":<br>\t".($ldap->fix($d_dn));
-
-          /* Check if there are references to this object */
-          $ldap->search("(&(member=".$dn.")(|(objectClass=gosaGroupOfNames)(objectClass=groupOfNames)))",array('dn'));
-          $refs = "";
-          while($attrs = $ldap->fetch()){
-            $ref_dn = $attrs['dn'];
-            $refs .= "<br />\t".$ref_dn;
-          } 
-          if(!empty($refs)){ 
-            $this->outside_users[$b_dn]['ldif'] .= "<br /><br /><i>"._("The following references will be updated").":</i>".$refs;
-          }
-
-        }else{
-          $this->move($dn,$d_dn);
-        }
-      }
-    }
-  }
-  
-
-  function execute()
-  {
-    /* Initialise checks if this is the first call */
-    if(!$this->checks_initialised || isset($_POST['reload'])){
-      $this->initialize_checks();
-      $this->checks_initialised = TRUE;
-    }
-
-    /*************
-     * Winstations outside the group ou 
-     *************/
-    
-    if(isset($_POST['outside_winstations_dialog_cancel'])){
-      $this->outside_winstations_dialog = FALSE;
-      $this->dialog = FALSE;
-      $this->show_details = FALSE;
-    }
-   
-    if(isset($_POST['outside_winstations_dialog_whats_done'])){
-      $this->migrate_outside_winstations(FALSE);
-    }
-    if(isset($_POST['outside_winstations_dialog_perform'])){
-      $this->migrate_outside_winstations(TRUE);
-      $this->search_outside_winstations();
-      $this->dialog = FALSE;
-      $this->show_details = FALSE;
-      $this->outside_winstations_dialog = FALSE;
-    }
-
-    if(isset($_POST['outside_winstations_dialog'])){
-      $this->outside_winstations_dialog = TRUE;
-      $this->dialog = TRUE;
-    }
-    
-    if($this->outside_winstations_dialog){
-
-      /* Fix displayed dn syntax */ 
-      $tmp = $this->outside_winstations;
-      foreach($tmp as $key => $data){
-        $tmp[$key]['dn'] = @LDAP::fix($data['dn']);
-      }
-
-      $smarty = get_smarty();
-      $smarty->assign("ous",$this->get_all_winstation_ous());
-      $smarty->assign("method","outside_winstations");
-      $smarty->assign("outside_winstations",$tmp);
-      return($smarty->fetch(get_template_path("setup_migrate.tpl",TRUE,dirname(__FILE__))));
-    }
-    /*************
-     * Groups outside the group ou 
-     *************/
-    
-    if(isset($_POST['outside_groups_dialog_cancel'])){
-      $this->outside_groups_dialog = FALSE;
-      $this->show_details = FALSE;
-      $this->dialog = FALSE;
-    }
-   
-    if(isset($_POST['outside_groups_dialog_whats_done'])){
-      $this->show_details= TRUE;
-      $this->migrate_outside_groups(FALSE);
-    }
-    if(isset($_POST['outside_groups_dialog_refresh'])){
-      $this->show_details= FALSE;
-    }
-
-    if(isset($_POST['outside_groups_dialog_perform'])){
-      $this->migrate_outside_groups(TRUE);
-      $this->dialog = FALSE;
-      $this->show_details = FALSE;
-      $this->outside_groups_dialog = FALSE;
-      $this->initialize_checks();
-    }
-
-    if(isset($_POST['outside_groups_dialog'])){
-      $this->outside_groups_dialog = TRUE;
-      $this->dialog = TRUE;
-    }
-    
-    if($this->outside_groups_dialog){
-
-      /* Fix displayed dn syntax */ 
-      $tmp = $this->outside_groups;
-      foreach($tmp as $key => $data){
-        $tmp[$key]['dn'] = @LDAP::fix($data['dn']);
-      }
-
-      $smarty = get_smarty();
-      $smarty->assign("ous",$this->get_all_group_ous());
-      $smarty->assign("method","outside_groups");
-      $smarty->assign("outside_groups",$tmp);
-      $smarty->assign("group_details", $this->show_details);
-      return($smarty->fetch(get_template_path("setup_migrate.tpl",TRUE,dirname(__FILE__))));
-    }
-    /*************
-     * User outside the people ou 
-     *************/
-    
-    if(isset($_POST['outside_users_dialog_cancel'])){
-      $this->outside_users_dialog = FALSE;
-      $this->dialog = FALSE;
-      $this->show_details = FALSE;
-    }
-   
-    if(isset($_POST['outside_users_dialog_whats_done'])){
-      $this->show_details= TRUE;
-      $this->migrate_outside_users(FALSE);
-    }
-    if(isset($_POST['outside_users_dialog_perform'])){
-      $this->migrate_outside_users(TRUE);
-      $this->initialize_checks();
-      $this->dialog = FALSE;
-      $this->show_details = FALSE;
-      $this->outside_users_dialog = FALSE;
-    }
-
-    if (isset($_POST['outside_users_dialog_refresh'])){
-      $this->show_details= FALSE;
-    }
-
-    if(isset($_POST['outside_users_dialog'])){
-      $this->outside_users_dialog = TRUE;
-      $this->dialog = TRUE;
-    }
-    
-    if($this->outside_users_dialog){
-
-      /* Fix displayed dn syntax */ 
-      $tmp = $this->outside_users;
-      foreach($tmp as $key => $data){
-        $tmp[$key]['dn'] = @LDAP::fix($data['dn']);
-      }
-
-      $smarty = get_smarty();
-      $smarty->assign("ous",$this->get_all_people_ous());
-      $smarty->assign("method","outside_users");
-      $smarty->assign("outside_users",$tmp);
-      $smarty->assign("user_details", $this->show_details);
-      return($smarty->fetch(get_template_path("setup_migrate.tpl",TRUE,dirname(__FILE__))));
-    }
-    /*************
-     * Root object check  
-     *************/
-  
-    if(isset($_POST['retry_root_create'])){
-
-      $state = $this->checks['root']['STATUS'];
-      $this->checkBase(FALSE);
-      if($state != $this->checks['root']['STATUS']){
-        $this->initialize_checks();
-      }
-    }
-    /*************
-     * User Migration handling 
-     *************/
-
-    if(isset($_POST['retry_acls'])){
-      $this->check_administrativeAccount();
-    }
-
-    if(isset($_POST['create_acls'])){
-      $this->acl_create_dialog = TRUE;
-      $this->dialog = TRUE;
-    }
-  
-    if(isset($_POST['create_acls_cancel'])){
-      $this->acl_create_dialog = FALSE;
-      $this->dialog = FALSE;
-      $this->show_details = FALSE;
-    }
-
-#    if(isset($_POST['create_acls_create_confirmed'])){
-#      if($this->create_admin()){
-#        $this->acl_create_dialog = FALSE;
-#        $this->dialog = FALSE;
-#      $this->show_details = FALSE;
-#        $this->initialize_checks();
-#      }
-#    }
-
-    if(isset($_POST['create_acls_create'])){
-      $this->create_admin(TRUE);
-    }
-
-    if(isset($_POST['create_admin_user'])){
-      if($this->create_admin_user()){
-        $this->dialog = FALSE;
-      $this->show_details = FALSE;
-      }
-    }
-
-    if($this->acl_create_dialog){
-      $smarty = get_smarty();
-  
-      $uid = "admin";
-      if(isset($_POST['new_user_uid'])){
-        $uid = $_POST['new_user_uid'];
-      }
-
-      $smarty->assign("new_user_uid",$uid);
-      $smarty->assign("new_user_password",@$_POST['new_user_password']);
-      $smarty->assign("new_user_password2",@$_POST['new_user_password2']);
-      $smarty->assign("method","create_acls");
-      $smarty->assign("acl_create_selected",$this->acl_create_selected);
-      $smarty->assign("what_will_be_done_now",$this->acl_create_changes);
-      return($smarty->fetch(get_template_path("setup_migrate.tpl",TRUE,dirname(__FILE__))));
-    }
-
-    /*************
-     * User Migration handling 
-     *************/
-
-    /* Refresh list of deparments */
-    if(isset($_POST['users_visible_migrate_refresh'])){
-      $this->check_gosaAccounts();
-    }
-
-    /* Open migration dialog */
-    if(isset($_POST['users_visible_migrate'])){
-      $this->show_details= FALSE;
-      $this->users_migration_dialog = TRUE;
-      $this->dialog =TRUE;
-    }
-
-    /* Close migration dialog */
-    if(isset($_POST['users_visible_migrate_close'])){
-      $this->users_migration_dialog = FALSE;
-      $this->dialog =FALSE;
-      $this->show_details = FALSE;
-    }
-
-    /* Start migration */
-    if(isset($_POST['users_visible_migrate_migrate'])){
-      if($this->migrate_gosaAccounts()){
-        $this->initialize_checks();
-        $this->dialog = FALSE;
-        $this->show_details = FALSE;
-        $this->users_migration_dialog = FALSE;
-      }
-    }
-
-    /* Start migration */
-    if(isset($_POST['users_visible_migrate_whatsdone'])){
-      $this->migrate_gosaAccounts(TRUE);
-    }
-
-    /* Display migration dialog */
-    if($this->users_migration_dialog){
-
-      /* Fix displayed dn syntax */ 
-      $tmp = $this->users_to_migrate;
-      foreach($tmp as $key => $data){
-        $tmp[$key]['dn'] = @LDAP::fix($data['dn']);
-      }
-
-      $smarty = get_smarty();
-      $smarty->assign("users_to_migrate",$tmp);
-      $smarty->assign("method","migrate_users");
-      $smarty->assign("user_details", $this->show_details);
-      return($smarty->fetch(get_template_path("setup_migrate.tpl",TRUE,dirname(__FILE__))));
-    }
-
-
-    /*************
-     * Department Migration handling 
-     *************/
-
-    /* Refresh list of deparments */
-    if(isset($_POST['deps_visible_migrate_refresh'])){
-      $this->check_organizationalUnits();
-      $this->show_details= FALSE;
-    }
-
-    /* Open migration dialog */
-    if(isset($_POST['deps_visible_migrate'])){
-      $this->dep_migration_dialog = TRUE;
-      $this->dialog =TRUE;
-    }
-
-    /* Close migration dialog */
-    if(isset($_POST['deps_visible_migrate_close'])){
-      $this->dep_migration_dialog = FALSE;
-      $this->dialog =FALSE;
-      $this->show_details = FALSE;
-    }
-
-    /* Start migration */
-    if(isset($_POST['deps_visible_migrate_migrate'])){
-      if($this->migrate_organizationalUnits()){
-        $this->show_details= FALSE;
-        $this->check_organizationalUnits();
-        $this->dialog = FALSE;
-        $this->dep_migration_dialog = FALSE;
-      }
-    }
-
-    /* Start migration */
-    if(isset($_POST['deps_visible_migrate_whatsdone'])){
-      $this->migrate_organizationalUnits(TRUE);
-    }
-
-    /* Display migration dialog */
-    if($this->dep_migration_dialog){
-      $smarty = get_smarty();
-   
-      /* Fix displayed dn syntax */ 
-      $tmp = $this->deps_to_migrate;
-      foreach($tmp as $key => $data){
-        $tmp[$key]['dn'] = @LDAP::fix($data['dn']);
-      }
-
-      $smarty->assign("deps_to_migrate",$tmp);
-      $smarty->assign("method","migrate_deps");
-      $smarty->assign("deps_details", $this->show_details);
-      return($smarty->fetch(get_template_path("setup_migrate.tpl",TRUE,dirname(__FILE__))));
-    }
-
-    $smarty = get_smarty();
-    $smarty->assign("checks",$this->checks);
-    $smarty->assign("method","default");
-    return($smarty->fetch(get_template_path("setup_migrate.tpl",TRUE,dirname(__FILE__))));
-  }
-
-
-  function save_object()
-  {
-    $this->is_completed= TRUE;
-
-    /* Capture all selected winstations from outside_winstations_dialog */
-    if($this->outside_winstations_dialog){
-      foreach($this->outside_winstations as $dn => $data){
-        if(isset($_POST['select_winstation_'.$dn])){
-          $this->outside_winstations[$dn]['selected'] = TRUE;
-        }else{
-          $this->outside_winstations[$dn]['selected'] = FALSE;
-        }
-      }
-    }
-
-    /* Capture all selected groups from outside_groups_dialog */
-    if($this->outside_groups_dialog){
-      foreach($this->outside_groups as $dn => $data){
-        if(isset($_POST['select_group_'.$dn])){
-          $this->outside_groups[$dn]['selected'] = TRUE;
-        }else{
-          $this->outside_groups[$dn]['selected'] = FALSE;
-        }
-      }
-    }
-
-    /* Capture all selected users from outside_users_dialog */
-    if($this->outside_users_dialog){
-      foreach($this->outside_users as $dn => $data){
-        if(isset($_POST['select_user_'.$dn])){
-          $this->outside_users[$dn]['selected'] = TRUE;
-        }else{
-          $this->outside_users[$dn]['selected'] = FALSE;
-        }
-      }
-    }
-
-    /* Get "create acl" dialog posts */
-    if($this->acl_create_dialog){
-
-      if(isset($_POST['create_acls_create_abort'])){
-        $this->acl_create_selected = "";
-      }
-    }
-
-    /* Get selected departments */
-    if($this->dep_migration_dialog){
-      foreach($this->deps_to_migrate as $id => $data){
-        if(isset($_POST['migrate_'.$id])){
-          $this->deps_to_migrate[$id]['checked'] = TRUE;
-        }else{
-          $this->deps_to_migrate[$id]['checked'] = FALSE;
-        }
-      }
-    }
-
-    /* Get selected users */
-    if($this->users_migration_dialog){
-      foreach($this->users_to_migrate as $id => $data){
-        if(isset($_POST['migrate_'.$id])){
-          $this->users_to_migrate[$id]['checked'] = TRUE;
-        }else{
-          $this->users_to_migrate[$id]['checked'] = FALSE;
-        }
-      }
-    }
-  }
-
-
-  /* Check if the root object exists.
-   * If the parameter just_check is true, then just check if the 
-   *  root object is missing and update the info messages.
-   * If the Parameter is false, try to create a new root object.
-   */
-  function checkBase($just_check = TRUE)
-  {
-    /* Get collected setup informations */
-    $cv = $this->parent->captured_values;
-
-    /* Establish ldap connection */
-    $ldap = new LDAP($cv['admin'],
-        $cv['password'],
-        $cv['connection'],
-        FALSE,
-        $cv['tls']);
-
-    /* Check if root object exists */
-    $ldap->cd($cv['base']);
-    $res = $ldap->search("(objectClass=*)");
-    $err = ldap_errno($ldap->cid); 
-
-    if( !$res || 
-        $err == 0x20 ||  # LDAP_NO_SUCH_OBJECT
-        $err == 0x40) {  # LDAP_NAMING_VIOLATION
-
-      /* Root object doesn't exists 
-       */
-      if($just_check){
-        $this->checks['root']['STATUS']    = FALSE;
-        $this->checks['root']['STATUS_MSG']= _("Failed");
-        $this->checks['root']['ERROR_MSG'] =  _("The LDAP root object is missing. It is required to use your LDAP service.").'&nbsp;';
-        $this->checks['root']['ERROR_MSG'].=  "<input type='submit' name='retry_root_create' value='"._("Try to create root object")."'>";
-        return(FALSE);
-      }else{
-
-        /* Add root object */ 
-        $ldap->cd($cv['base']);
-        $res = $ldap->create_missing_trees($cv['base']);
-
-        /* If adding failed, tell the user */
-        if(!$res){
-          $this->checks['root']['STATUS']    = FALSE;
-          $this->checks['root']['STATUS_MSG']= _("Failed");
-          $this->checks['root']['ERROR_MSG'] = _("Root object couldn't be created, you should try it on your own.");
-          $this->checks['root']['ERROR_MSG'].= "&nbsp;<input type='submit' name='retry_root_create' value='"._("Try to create root object")."'>";
-          return($res);;
-        }
-      }
-    }
-
-    /* Create & remove of dummy object was successful */
-    $this->checks['root']['STATUS']    = TRUE;
-    $this->checks['root']['STATUS_MSG']= _("Ok");
-  }
-
-
-  /* Return ldif information for a 
-   * given attribute array 
-   */
-  function array_to_ldif($atts)
-  {
-    $ret = "";
-    unset($atts['count']);
-    unset($atts['dn']);
-    foreach($atts as $name => $value){
-      if(is_numeric($name)) {
-        continue;
-      }
-      if(is_array($value)){
-        unset($value['count']);
-        foreach($value as $a_val){
-          $ret .= $name.": ". $a_val."\n";
-        }
-      }else{
-        $ret .= $name.": ". $value."\n";
-      }
-    }
-    return(preg_replace("/\n$/","",$ret));
-  }
-
-
-  function get_user_list()
-  {
-    /* Get collected configuration settings */
-    $cv = $this->parent->captured_values;
-
-    /* Establish ldap connection */
-    $ldap = new LDAP($cv['admin'],
-        $cv['password'],
-        $cv['connection'],
-        FALSE,
-        $cv['tls']);
-    
-    $ldap->cd($cv['base']);
-    $ldap->search("(objectClass=gosaAccount)",array("dn"));
-  
-    $tmp = array();
-    while($attrs = $ldap->fetch()){
-      $tmp[base64_encode($attrs['dn'])] = @LDAP::fix($attrs['dn']);
-    }
-    return($tmp);
-  }
-
-
- function get_all_people_ous()
-  {
-    /* Get collected configuration settings */
-    $cv = $this->parent->captured_values;
-    $people_ou = trim($cv['peopleou']);
-
-    /* Establish ldap connection */
-    $ldap = new LDAP($cv['admin'],
-        $cv['password'],
-        $cv['connection'],
-        FALSE,
-        $cv['tls']);
-
-
-    /*****************
-     * If people ou is NOT empty
-     * search for for all objects matching the given container
-     *****************/
-    if(!empty($people_ou)){
-      $ldap->search("(".$people_ou.")",array("dn"));
-
-      /* Create people ou if there is currently none */
-      if($ldap->count() == 0 ){
-        $add_dn = $cv['peopleou'].",".$cv['base'];
-        $naming_attr = preg_replace("/=.*$/","",$add_dn);
-        $naming_value = preg_replace("/^[^=]*+=([^,]*).*$/","\\1",$add_dn);
-        $add = array();
-        $add['objectClass'] = array("organizationalUnit");
-        $add[$naming_attr] = $naming_value;
-        $ldap->cd($cv['base']);
-        $ldap->create_missing_trees(preg_replace("/^[^,]+,/","",$add_dn));
-        $ldap->cd($add_dn);
-        $ldap->add($add);
-      }
-
-      /* Create result */
-      $ldap->search("(".$cv['peopleou'].")",array("dn"));
-      $tmp = array();
-      while($attrs= $ldap->fetch()){
-        if(!preg_match("/ou=snapshots,/",$attrs['dn'])){
-          $tmp[base64_encode($attrs['dn'])] = $ldap->fix($attrs['dn']);
-        }
-      }
-    } else{
-
-      /************
-       * If people ou is empty
-       * Get all valid gosaDepartments
-       ************/
-      $ldap->cd($cv['base']);
-      $tmp = array();
-      $ldap->search("(&(objectClass=gosaDepartment)(ou=*))",array("dn"));
-      $tmp[base64_encode($cv['base'])] = $ldap->fix($cv['base']);
-      while($attrs = $ldap->fetch()){
-        $tmp[base64_encode($attrs['dn'])] = $ldap->fix($attrs['dn']);;
-      }
-    }
-    return($tmp);
-  }
-
-
-  function get_all_winstation_ous()
-  {
-    /* Get collected configuration settings */
-    $cv = $this->parent->captured_values;
-
-    /* Establish ldap connection */
-    $ldap = new LDAP($cv['admin'],
-        $cv['password'],
-        $cv['connection'],
-        FALSE,
-        $cv['tls']);
-
-    /* Get winstation ou */
-    if($cv['generic_settings']['wws_ou_active']) {
-      $winstation_ou = $cv['generic_settings']['ws_ou'];
-    }else{
-      $winstation_ou = "ou=winstations";
-    }
-
-    $ldap->cd($cv['base']);
-    $ldap->search("(".$winstation_ou.")",array("dn"));
-  
-    if($ldap->count() == 0 ){
-      $add_dn = $winstation_ou.",ou=systems,".$cv['base'];
-      $naming_attr = preg_replace("/=.*$/","",$add_dn);
-      $naming_value = preg_replace("/^[^=]*+=([^,]*).*$/","\\1",$add_dn);
-      $add = array();
-      $add['objectClass'] = array("organizationalUnit");
-      $add[$naming_attr] = $naming_value;
-
-      $ldap->cd($cv['base']);
-      $ldap->create_missing_trees(preg_replace("/^[^,]+,/","",$add_dn));
-      $ldap->cd($add_dn);
-      $ldap->add($add);
-    }
-
-    $ldap->search("(".$winstation_ou.")",array("dn"));
-    $tmp = array();
-    while($attrs= $ldap->fetch()){
-      if(!preg_match("/ou=snapshots,/",$attrs['dn'])){
-        $tmp[base64_encode($attrs['dn'])] = $ldap->fix($attrs['dn']);
-      }
-    }
-    return($tmp); 
-  }
-
-
- function get_all_group_ous()
-  {
-    /* Get collected configuration settings */
-    $cv = $this->parent->captured_values;
-
-    /* Establish ldap connection */
-    $ldap = new LDAP($cv['admin'],
-        $cv['password'],
-        $cv['connection'],
-        FALSE,
-        $cv['tls']);
-
-    $group_ou = trim($cv['groupou']);
-    if(!empty($group_ou)){
-      $group_ou = trim($group_ou);
-    }
-
-    /************
-     * If group ou is NOT empty
-     * Get all valid group ous, create one if necessary
-     ************/
-    $ldap->cd($cv['base']);
-    if(!empty($group_ou)){
-      $ldap->search("(".$group_ou.")",array("dn"));
-      if($ldap->count() == 0 ){
-        $add_dn = $group_ou.$cv['base'];
-        $naming_attr = preg_replace("/=.*$/","",$add_dn);
-        $naming_value = preg_replace("/^[^=]*+=([^,]*).*$/","\\1",$add_dn);
-        $add = array();
-        $add['objectClass'] = array("organizationalUnit");
-        $add[$naming_attr] = $naming_value;
-
-        $ldap->cd($cv['base']);
-        $ldap->create_missing_trees(preg_replace("/^[^,]+,/","",$add_dn));
-        $ldap->cd($add_dn);
-        $ldap->add($add);
-      }
-      $ldap->search("(".$group_ou.")",array("dn"));
-      $tmp = array();
-      while($attrs= $ldap->fetch()){
-        if(!preg_match("/ou=snapshots,/",$attrs['dn'])){
-          $tmp[base64_encode($attrs['dn'])] = $ldap->fix($attrs['dn']);
-        }
-      }
-    }else{
-      /************
-       * If group ou is empty
-       * Get all valid gosaDepartments
-       ************/
-      $ldap->cd($cv['base']);
-      $tmp = array();
-      $ldap->search("(&(objectClass=gosaDepartment)(ou=*))",array("dn"));
-      $tmp[base64_encode($cv['base'])] = $ldap->fix($cv['base']);
-      while($attrs = $ldap->fetch()){
-        $tmp[base64_encode($attrs['dn'])] = $ldap->fix($attrs['dn']);;
-      }
-    }
-    return($tmp);
-  }
-
-
-  function get_group_list()
-  {
-    /* Get collected configuration settings */
-    $cv = $this->parent->captured_values;
-
-    /* Establish ldap connection */
-    $ldap = new LDAP($cv['admin'],
-        $cv['password'],
-        $cv['connection'],
-        FALSE,
-        $cv['tls']);
-    
-    $ldap->cd($cv['base']);
-    $ldap->search("(objectClass=posixGroup)",array("dn"));
-  
-    $tmp = array();
-    while($attrs = $ldap->fetch()){
-      $tmp[base64_encode($attrs['dn'])] = @LDAP::fix($attrs['dn']);
-    }
-    return($tmp);
-  }
-
-
-  function move($source,$destination)
-  {
-    /* Get collected configuration settings */
-    $cv = $this->parent->captured_values;
-
-    /* Establish ldap connection */
-    $ldap = new LDAP($cv['admin'],
-        $cv['password'],
-        $cv['connection'],
-        FALSE,
-        $cv['tls']);
-
-     /* Update object references in gosaGroupOfNames */
-    $ogs_to_fix = array();
-    $ldap->cd($cv['base']);
-    $ldap->search('(&(objectClass=gosaGroupOfNames)(member='.@LDAP::fix($source).'))', array('cn','member'));
-    while ($attrs= $ldap->fetch()){
-      $dn = $attrs['dn'];
-      $attrs = $this->cleanup_array($attrs);
-      $member_new = array($destination);
-      foreach($attrs['member'] as $member){
-        if($member != $source){
-          $member_new[] = $member;
-        }
-      }
-      $attrs['member'] = $member_new;
-      $ogs_to_fix[$dn] = $attrs;
-    }
-
-    /* Copy source to destination dn */
-    $ldap->cat($source);
-    $new_data = $this->cleanup_array($ldap->fetch());
-    $ldap->cd($destination);
-    $res = $ldap->add($new_data);
-
-    /* Display warning if copy failed */
-    if(!$res){
-      print_red(_("Failed to copy '%s' to '%s'. LDAP says '%s'."),$source,$destination,$ldap->get_error());
-    }else{
-      $res = $ldap->rmDir($source);
-      show_ldap_error($ldap->get_error(),_("Something went wrong while copying dns."));
-
-      /* Object is copied, so update its references */
-      foreach($ogs_to_fix as $dn => $data){
-        $ldap->cd($dn);
-        $ldap->modify($data);
-      }
-    }
-  }
-
-  
-  /* Cleanup ldap result to be able to write it be to ldap */
-  function cleanup_array($attrs)
-  {
-    foreach($attrs as $key => $value) {
-      if(is_numeric($key) || in_array($key,array("count","dn"))){
-        unset($attrs[$key]);
-      }
-      if(is_array($value) && isset($value['count'])){
-        unset($attrs[$key]['count']);
-      }
-    }
-    return($attrs);
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/setup/class_setupStep_Schema.inc b/setup/class_setupStep_Schema.inc
deleted file mode 100644 (file)
index 2008128..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-<?php
-
-/*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2007 Fabian Hickert
-
-   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 Step_Schema extends setup_step
-{
-  var $checked = array();
-  var $not_checked = array();
-  var $schema_readable  = FALSE;
-  var $attributes       = array("enable_schema_check","samba_version");
-  var $enable_schema_check = TRUE;
-  var $samba_version       = 3;
-
-  function Step_Schema()
-  {
-    $this->update_strings();
-  }
-
-  
-  function update_strings()
-  {
-    $this->s_title      = _("LDAP schema check");
-    $this->s_title_long = _("LDAP schema check");
-    $this->s_info       = _("Perform test on your current LDAP schema");
-  }
-
-  
-  function execute()
-  {
-    $this->check_schema();
-    $failed_checks = 0 ; 
-    foreach($this->checked as $val) {
-      if(!$val['STATUS']){
-        $failed_checks ++;
-      }
-    }
-
-    if($failed_checks == 0){
-      $this->is_completed = TRUE;
-    }else{
-      $this->is_completed = TRUE;
-    }
-
-    $smarty = get_smarty();
-    $smarty->assign("bool",array(FALSE => _("No"), TRUE => _("Yes")));
-    $smarty->assign("schema_readable",$this->schema_readable);
-    $smarty->assign("enable_schema_check",$this->enable_schema_check);
-    $smarty->assign("checks",$this->checked);
-    $smarty->assign("not_checked",$this->not_checked);
-    $smarty->assign("failed_checks",$failed_checks);
-    return($smarty -> fetch (get_template_path("../setup/setup_schema.tpl")));
-  }
-
-  function save_object()
-  {
-    if(isset($_POST['step7_posted'])){
-
-      /* Get attributes */
-      foreach($this->attributes as $attr){
-        if(isset($_POST[$attr])){
-          $this->$attr = validate($_POST[$attr]);
-        }
-      }
-    }
-  }
-
-  function check_schema()
-  {
-    $cfg = $this->parent->captured_values;
-    $rfc2307bis = $cfg['rfc2307bis'];
-    $this->checked = check_schema($cfg,$rfc2307bis);
-
-    /* Get objectclasses */
-    $ldap = new LDAP($cfg['admin'],$cfg['password'],$cfg['connection'] ,FALSE,$cfg['tls']);
-    $objectclasses = $ldap->get_objectclasses();
-    if(count($objectclasses) == 0){
-      print_red(_("Can't get schema information from server. No schema check possible!"));
-    }
-
-    /* Which samba version do we use? */
-    if(isset($objectclasses['sambaSamAccount'])){
-      $this->samba_version = 3;
-    } elseif(isset($objectclasses['sambaAccount'])) {
-      $this->samba_version = 2;
-    }else{
-      $this->samba_version = 0;
-    }
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/setup/class_setupStep_Welcome.inc b/setup/class_setupStep_Welcome.inc
deleted file mode 100644 (file)
index f030f31..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-<?php
-
-/*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2007 Fabian Hickert
-
-   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 Step_Welcome  extends setup_step
-{
-  var $languages      = array();
-  var $attributes     = array();
-  var $header_image   = "images/welcome.png";
-
-  function Step_Welcome()
-  {
-    $this->is_enabled     = TRUE;
-    $this->is_active      = TRUE;
-    $this->update_strings(); 
-  }
-
-  function update_strings()
-  {
-    $this->s_title      = _("Welcome");
-    $this->s_info       = _("The welcome message");
-    $this->s_title_long = _("Welcome to GOsa setup wizard");
-  }
-  
-  function execute()
-  {
-    $smarty = get_smarty();
-    $smarty->assign('auth_id', session_id());
-    return($smarty->fetch(get_template_path("setup_welcome.tpl",TRUE,dirname(__FILE__))));
-  }
-
-  function save_object()
-  {
-    $id = "";
-    
-    /* Get auth ID from file */
-    if (file_exists('/tmp/gosa.auth') && is_readable('/tmp/gosa.auth')){
-      $contents= file('/tmp/gosa.auth');
-      $id= chop($contents[0]);
-    }
-
-    /* Continue if we've the correct ID */
-    if ($id == session_id()){
-      $this->is_completed = true;
-    } else {
-      $this->is_completed = false;
-    }
-
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/setup/license.txt b/setup/license.txt
deleted file mode 100644 (file)
index 9140f02..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-Table of Contents
-
-    * GNU GENERAL PUBLIC LICENSE
-          o Preamble
-          o TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-          o How to Apply These Terms to Your New Programs
-
-GNU GENERAL PUBLIC LICENSE
-
-Version 2, June 1991
-
-Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
-
-Everyone is permitted to copy and distribute verbatim copies
-of this license document, but changing it is not allowed.
-
-Preamble
-
-The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too.
-
-When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.
-
-To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.
-
-For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
-
-We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.
-
-Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.
-
-Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.
-
-The precise terms and conditions for copying, distribution and modification follow.
-TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.
-
-1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
-
-2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
-
-    * a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
-    * b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
-    * c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
-
-3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:
-
-    * a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
-    * b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
-    * c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
-
-If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.
-
-4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
-
-5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.
-
-6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.
-
-7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
-
-This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
-
-8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
-
-9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.
-
-10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
-
-NO WARRANTY
-
-11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-END OF TERMS AND CONDITIONS
-How to Apply These Terms to Your New Programs
-
-If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
-
-To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
-
-one line to give the program's name and an idea of what it does.
-Copyright (C) yyyy  name of author
-
-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.
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this when it starts in an interactive mode:
-
-Gnomovision version 69, Copyright (C) year name of author
-Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
-type `show w'.  This is free software, and you are welcome
-to redistribute it under certain conditions; type `show c'
-for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names:
-
-Yoyodyne, Inc., hereby disclaims all copyright
-interest in the program `Gnomovision'
-(which makes passes at compilers) written
-by James Hacker.
-
-signature of Ty Coon, 1 April 1989
-Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License.
-
-Linking Joomla! statically or dynamically with other modules is making a combined work based on Joomla!. Thus, the terms and conditions of the GNU General Public License cover the whole combination.
-
-In addition, as a special exception, the copyright holders of Joomla! give you permission to combine Joomla! with free software programs or libraries that are released under the GNU LGPL and with independent modules that communicate with Joomla! solely through the Joomla! extension interface. You may copy and distribute such a system following the terms of the GNU GPL for Joomla! and the licenses of the other code concerned, provided that you include the source code of that other code when and as the GNU GPL requires distribution of source code.
-
-Note that people who make modified versions of Joomla! are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU General Public License gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
diff --git a/setup/main.inc b/setup/main.inc
deleted file mode 100644 (file)
index bce41ef..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-/*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2007 Fabian Hickert
-
-   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
- */
-
-/* Create a new setup class if necessary  */
-if (!isset($_SESSION['setup']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
-  $_SESSION['setup']= new setup ();
-}
-$setup= $_SESSION['setup'];
-
-/* Execute formular */
-$setup->save_object();
-$display= $setup->execute();
-
-/* Store changes  in session */
-$_SESSION['setup']= $setup;
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/setup/setup.tpl b/setup/setup.tpl
deleted file mode 100644 (file)
index 3bb21f7..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-<div style='background-color: #009900;'>
-{$php_errors}
-sadffasdsdfa
-</div>
diff --git a/setup/setup_checks.tpl b/setup/setup_checks.tpl
deleted file mode 100644 (file)
index 90275fc..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-<!-- 
-       Div container with PHP module checks 
--->
-<div style='float:left;width:50%;'> 
-
-       <!-- Set content styles -->     
-       <div class='default' style='margin:10px;'>
-               <!-- Beginning PHP module check output -->
-               <h2 class='step2_container_title'>{t}PHP module and extension checks{/t}</h2>
-               <!-- {cycle reset=true values="#F0F0F0, #FFF"} -->
-               {foreach from=$basic item=val key=key}
-                       <!-- Entry {$key} -->           
-                       {if $basic[$key].SOLUTION != "" && !$basic[$key].RESULT}
-               
-                               <!-- Add ability to display info popup -->      
-                               <div class='step2_entry_container_info' style='background-color:{cycle values="#F0F0F0, #FFF"}'>
-                       {else}
-
-                               <!-- Normal entry everything is fine -->
-                               <div class='step2_entry_container' style='background-color:{cycle values="#F0F0F0, #FFF"}'>     
-                       {/if}
-                       
-                       <div class='step2_entry_name'>{$basic[$key].NAME}</div>
-                       <div class='step2_entry_status'>
-
-                       {if $basic[$key].RESULT}
-                               <div class='step2_successful'>{t}Ok{/t}</div>
-                       {else}
-                               {if $basic[$key].MUST}
-                                       <div class='step2_failed'>{t}Error{/t}</div>
-                               {else}
-                                       <div class='step2_warning'>{t}Warning{/t}</div>
-                               {/if}
-                               {if $basic[$key].SOLUTION != ""}
-       
-                               <!-- Inforamtion popup -->
-                               <div class='solution_visible' id='sol_{$key}'>
-                                       {if $basic[$key].MUST}
-                                               <div class='step2_failed_text' style="background-image: url('images/small_error.png')">
-                                               {$basic[$key].SOLUTION}
-                                               <b>{t}GOsa will NOT run without fixing this.{/t}</b>
-                                       {else}
-                                               <div class="step2_warning_text" style="background-image: url('images/small_warning.png')">
-                                               {$basic[$key].SOLUTION}
-                                               <b>{t}GOsa will run without fixing this.{/t}</b>
-                                       {/if}
-                                       </div>
-                               </div>
-                               {/if}
-                       {/if}
-                               </div>
-                       </div>
-               {/foreach}
-       </div>
-</div>
-
-
-<!-- 
-       Div container with PHP config checks 
--->
-<div style='width:50%; float:left;'>
-
-       <!-- Set content styles -->     
-       <div class='default' style='margin:10px;'>
-
-               <!-- Beginning PHP config check output -->
-               <h2 class='step2_container_title'>{t}PHP setup configuration{/t} (<a style='text-decoration:underline' href='?info' target='_blank'>{t}show information{/t})</a></h2>
-
-               <!-- {cycle reset=true values="#F0F0F0, #FFF"} -->
-               {foreach from=$config item=val key=key}
-
-                       <!-- Entry {$key} -->
-            {if $config[$key].SOLUTION != "" && !$config[$key].RESULT}
-
-                <!-- Add ability to display info popup -->
-                <div class='step2_entry_container_info' style='background-color:{cycle values="#FFF, #F0F0F0"}'>
-            {else}
-
-                <!-- Normal entry everything is fine -->
-                <div class='step2_entry_container' style='background-color:{cycle values="#FFF, #F0F0F0"}'>
-            {/if}
-
-
-                       <div class='step2_entry_name'>{$config[$key].NAME}</div>
-                       <div class='step2_entry_status'>
-                       {if $config[$key].RESULT}
-                               <div class='step2_successful'>{t}Ok{/t}</div>
-                       {else}
-
-                               {if $config[$key].MUST}
-                                       <div class='step2_failed'>{t}Error{/t}</div>
-                               {else}
-                                       <div class='step2_warning'>{t}Warning{/t}</div>
-                               {/if}
-
-                               {if $config[$key].SOLUTION != ""}
-       
-                               <!-- Inforamtion popup -->
-                               <div class='solution_visible' id='sol_config_{$key}'>
-                                       {if $config[$key].MUST}
-                                               <div class='step2_failed_text' style="background-image: url('images/small_error.png')">
-                                               {$config[$key].SOLUTION}
-                                               <b>{t}GOsa will NOT run without fixing this.{/t}</b>
-                                       {else}
-                                               <div class='step2_warning_text' style="background-image: url('images/small_warning.png')">
-                                               {$config[$key].SOLUTION}
-                                               <b>{t}GOsa will run without fixing this.{/t}</b>
-                                       {/if}
-                                       </div>
-                               </div>
-                               {/if}
-                       {/if}
-                       </div>
-                       </div>
-               {/foreach}
-
-
-       </div>
-</div>
-
-<div style="clear:both"></div>
-
diff --git a/setup/setup_config1.tpl b/setup/setup_config1.tpl
deleted file mode 100644 (file)
index d041ae3..0000000
+++ /dev/null
@@ -1,225 +0,0 @@
-<div class='default'>
-    <p><b>{t}Look and feel{/t}</b></p>
-
-    <div class='step4_container'>
-        <div class='step4_name'>
-            {t}Theme{/t}
-        </div>
-        <div class='step4_value'>
-            <select name="theme">
-                {html_options options=$themes selected=$theme}
-            </select>
-        </div>
-    </div>
-
-    <p><b>{t}Apache{/t}</b></p>
-
-    <div class='step4_container'>
-        <div class='step4_name'>
-            {t}Compress output send to browser{/t}
-        </div>
-        <div class='step4_value'>
-            <select name="compressed">
-                {html_options options=$bool selected=$compressed}
-            </select>
-        </div>
-    </div>
-    <p><b>{t}People and group storage{/t}</b></p>
-    <div class='step4_container'>
-        <div class='step4_name'>
-            {t}People DN attribute{/t}
-        </div>
-        <div class='step4_value'>
-            <select size="1" name="peopledn">
-                {html_options values=$peopledns output=$peopledns selected=$peopledn}
-            </select>
-        </div>
-    </div>
-
-       <div class='step4_container'>
-        <div class='step4_name'>
-            {t}People storage subtree{/t}
-        </div>
-        <div class='step4_value'>
-            <input type='text' name='peopleou' maxlength='40' size='40' value='{$peopleou}'>
-        </div>
-    </div>
-
-       <div class='step4_container'>
-        <div class='step4_name'>
-            {t}Group storage subtree{/t}
-        </div>
-        <div class='step4_value'>
-            <input type='text' name='groupou' maxlength='40' size='40' value='{$groupou}'>
-        </div>
-    </div>
-
-       <div class='step4_container'>
-        <div class='step4_name'>
-            {t}Include personal title in user DN{/t}
-        </div>
-        <div class='step4_value'>
-            <select name="include_personal_title" size="1" title="">
-            {html_options options=$bool selected=$include_personal_title}
-            </select>
-        </div>
-    </div>
-
-       <div class='step4_container'>
-        <div class='step4_name'>
-            {t}Relaxed naming policies{/t}
-        </div>
-        <div class='step4_value'>
-            <select name="strict" size="1" title="">
-            {html_options options=$bool selected=$strict}
-            </select>
-        </div>
-    </div>
-
-       <div class='step4_container'>
-        <div class='step4_name'>
-            {t}Automatic uids{/t}
-        </div>
-        <div class='step4_value'>
-            {if $id_settings.idgen_active == FALSE}
-                <input type='checkbox' value='1' name='idgen_active'
-                    onClick='changeState("idgen");'>
-                <input size='20' id='idgen' name='idgen' type='text' value='{$id_settings.idgen}' disabled>
-            {else}
-                <input type='checkbox' value='1' name='idgen_active' checked>
-                <input size='20' id='idgen' name='idgen' type='text' value='{$id_settings.idgen}'  >
-            {/if}
-        </div>
-    </div>
-
-       <div class='step4_container'>
-        <div class='step4_name'>
-            {t}GID / UID min id{/t}
-        </div>
-        <div class='step4_value'>
-            {if $id_settings.minid_active == FALSE}
-                <input type='checkbox' value='1' name='minid_active'
-                    onClick='changeState("minid");'>
-                <input size='10' id='minid' name='minid' type='text' value='{$id_settings.minid}' disabled>
-            {else}
-                <input type='checkbox' value='1' name='minid_active' checked>
-                <input size='10' id='minid' name='minid' type='text' value='{$id_settings.minid}'  >
-            {/if}
-        </div>
-    </div>
-
-    <div class='step4_container' style="margin-bottom:5px;">
-        <div class='step4_name'>
-            {t}Number base for people/groups{/t}
-        </div>
-        <div class='step4_value'>
-            <input type='text' name='uidbase' maxlength='20' size='10' value='{$uidbase}'>
-        </div>
-     </div>
-    <div class='step4_container' style="margin-bottom:5px;">
-        <div class='step4_name'>
-                {t}Hook for number base{/t}
-       </div>
-        <div class='step4_value'>
-            {if $base_hook_active == FALSE}
-                <input type='checkbox' value='1' name='base_hook_active'
-                    onClick='changeState("base_hook");'>
-                <input id='base_hook' name='base_hook' size=40 type='text' value='{$base_hook}'      disabled>
-            {else}
-                <input type='checkbox' value='1' name='base_hook_active' checked>
-                <input id='base_hook' name='base_hook' size=40 type='text' value='{$base_hook}'  >
-            {/if}
-     </div>
-        </div>
-    </div>
-
-    <p><b>{t}Password settings{/t}</b></p>
-
-    <div class='step4_container'>
-        <div class='step4_name'>
-            {t}Password encryption algorithm{/t}
-        </div>
-        <div class='step4_value'>
-            <select name="encryption" size="1" title="">
-                {html_options options=$crypt_methods selected=$encryption}
-            </select>
-        </div>
-    </div>
-
-    <div class='step4_container' style='height:4em;'>
-        <div class='step4_name' style='height:4em;'>
-            {t}Password restrictions{/t}
-        </div>
-        <div class='step4_value' style='height:4em;'>
-
-                       {if $pwd_rules.pwminlen_active == FALSE}
-                               <input type='checkbox' value='1' name='pwminlen_active'
-                                       onClick='changeState("pwminlen");'>
-                                       {t}Password minimum length{/t}
-                               <input id='pwminlen' name='pwminlen' type='text' value='{$pwd_rules.pwminlen}' size=3 disabled>
-                       {else}
-                               <input type='checkbox' value='1' name='pwminlen_active' checked>
-                               {t}Password minimum length{/t}
-                               <input id='pwminlen' name='pwminlen' type='text' value='{$pwd_rules.pwminlen}' size=3 >
-                       {/if}
-                       <br>
-                       {if $pwd_rules.pwdiffer_active == FALSE}
-                               <input type='checkbox' value='1' name='pwdiffer_active' 
-                                       onClick='changeState("pwdiffer");'>
-                               {t}Different characters from old password{/t}
-                               <input id='pwdiffer' name='pwdiffer' type='text' value='{$pwd_rules.pwdiffer}' size=3 disabled>
-                       {else}
-                               <input type='checkbox' value='1' name='pwdiffer_active' checked>
-                               {t}Different characters from old password{/t}
-                               <input id='pwdiffer' name='pwdiffer' type='text' value='{$pwd_rules.pwdiffer}' size=3 >
-                       {/if}
-       
-        </div>
-    </div>
-
-    <div class='step4_container'>
-        <div class='step4_name'>
-                {t}Password change hook{/t}
-        </div>
-        <div class='step4_value'>
-            {if $pwd_rules.externalpwdhook_active == FALSE}
-                <input type='checkbox' value='1' name='externalpwdhook_active'
-                    onClick='changeState("externalpwdhook");'>
-                <input size=40 id='externalpwdhook' name='externalpwdhook' type='text' value='{$pwd_rules.externalpwdhook}' disabled>
-            {else}
-                <input type='checkbox' value='1' name='externalpwdhook_active' checked>
-                <input size=40 id='externalpwdhook' name='externalpwdhook' type='text' value='{$pwd_rules.externalpwdhook}'  >
-            {/if}
-        </div>
-    </div>
-
-    <div class='step4_container'>
-        <div class='step4_name'>
-            {t}Use SASL for kerberos{/t}
-        </div>
-        <div class='step4_value'>
-            <select name="krbsasl" size="1" title="">
-            {html_options options=$bool selected=$krbsasl}
-            </select>
-        </div>
-    </div>
-
-    <div class='step4_container'>
-        <div class='step4_name'>
-            {t}Use account expiration{/t}
-        </div>
-        <div class='step4_value'>
-            <select name="account_expiration" size="1" title="">
-            {html_options options=$bool selected=$account_expiration}
-            </select>
-        </div>
-    </div>
-
-
-<input type='hidden' value='1' name='step5_posted'>
-<!--
-         {t}GOsa supports several encryption types for your passwords. Normally this is adjustable via user templates, but you can specify a default method to be used here, too.{/t}
-         {t}GOsa always acts as admin and manages access rights internally. This is a workaround till OpenLDAP's in directory ACI's are    fully implemented. For this to work, we need the admin DN and the corresponding password.{/t}
-         {t}Some basic LDAP parameters are tunable and affect the locations where GOsa saves people and groups, including the way accounts get created. Check the values below if the fit your needs.{/t}
-         {t}GOsa has modular support for several mail methods. These methods provide interfaces to users mailboxes and general handling    for quotas. You can choose the dummy plugin to leave all your mail settings untouched.{/t}-->
-
diff --git a/setup/setup_config2.tpl b/setup/setup_config2.tpl
deleted file mode 100644 (file)
index 80c5cf6..0000000
+++ /dev/null
@@ -1,323 +0,0 @@
-<div class='default' style='margin:12px; '>  
-    <p><b>{t}Samba settings{/t}</b></p>
-
-    <div class='step4_container'>
-        <div class='step4_name'>
-            {t}Samba hash generator{/t}
-        </div>
-        <div class='step4_value'>
-                <input size=40 id='smbhash' name='smbhash' type='text' value='{$samba_settings.smbhash}'  >
-        </div>
-    </div>
-
-    <div class='step4_container'>
-        <div class='step4_name'>
-            {t}Samba SID{/t}
-        </div>
-        <div class='step4_value'>
-            {if $samba_settings.samba_sid_active == FALSE}
-                <input type='checkbox' value='1' name='samba_sid_active'
-                    onClick='changeState("samba_sid");'>
-                <input size=20 id='samba_sid' name='samba_sid' type='text' value='{$samba_settings.samba_sid}' disabled>
-            {else}
-                <input type='checkbox' value='1' name='samba_sid_active' checked {if !$sambaDomain_found} disabled {/if}>
-                <input size=20 id='samba_sid' name='samba_sid' type='text' value='{$samba_settings.samba_sid}'  >
-            {/if}
-        </div>
-    </div>
-
-    <div class='step4_container'>
-        <div class='step4_name'>
-            {t}RID base{/t}
-        </div>
-        <div class='step4_value'>
-            {if $samba_settings.samba_rid_active == FALSE}
-                <input type='checkbox' value='1' name='samba_rid_active'
-                    onClick='changeState("samba_rid");'>
-                <input size=20 id='samba_rid' name='samba_rid' type='text' value='{$samba_settings.samba_rid}' disabled>
-            {else}
-                <input type='checkbox' value='1' name='samba_rid_active' checked {if !$sambaDomain_found} disabled {/if}>
-                <input size=20 id='samba_rid' name='samba_rid' type='text' value='{$samba_settings.samba_rid}'  >
-            {/if}
-        </div>
-    </div>
-    <div class='step4_container'>
-        <div class='step4_name'>
-            {t}Workstation container{/t}
-        </div>
-        <div class='step4_value'>
-            {if $generic_settings.wws_ou_active == FALSE}
-                <input type='checkbox' value='1' name='wws_ou_active'
-                    onClick='changeState("wws_ou");'>
-                <input size=40 id='wws_ou' name='wws_ou' type='text' value='{$generic_settings.wws_ou}' disabled>
-            {else}
-                <input type='checkbox' value='1' name='wws_ou_active' checked>
-                <input size=40 id='wws_ou' name='wws_ou' type='text' value='{$generic_settings.wws_ou}'  >
-            {/if}
-        </div>
-    </div>
-    <div class='step4_container'>
-        <div class='step4_name'>
-            {t}Samba SID mapping{/t}
-        </div>
-        <div class='step4_value'>
-            <select name="sambaidmapping" size="1" title="">
-                       {html_options options=$bool selected=$sambaidmapping}
-            </select>
-        </div>
-    </div>
-       <div class='step4_container'>
-        <div class='step4_name'>
-            {t}Timezone{/t}
-        </div>
-        <div class='step4_value'>
-            <select name='timezone' title='{t}Please your preferred timezone here{/t}' style="width:100%">
-               {foreach from=$timezones.TIMEZONES item=val key=key}
-            {if $key == $timezone}
-                {if isset($timezones.DST_ZONES.$key)}
-                    <option selected value="{$key}">{$key} (DST)</option>
-                {else}
-                    <option selected value="{$key}">{$key} (GMT)</option>
-                {/if}
-            {else}
-                {if isset($timezones.DST_ZONES.$key)}
-                    <option value="{$key}">{$key} (DST)</option>
-                {else}
-                    <option value="{$key}">{$key} (GMT)</option>
-                {/if}
-            {/if}
-        {/foreach}
-
-            </select>
-        </div>
-    </div>
-
-
-    <p><b>{t}Additional GOsa settings{/t}</b></p>
-
-       <div class='step4_container'>
-        <div class='step4_name'>
-            {t}Enable Copy & Paste{/t}
-        </div>
-        <div class='step4_value'>
-
-            <select name="enableCopyPaste" size="1" title="">
-                {html_options options=$bool selected=$generic_settings.enableCopyPaste}
-            </select>
-        </div>
-    </div>
-
-       <div class='step4_container'>
-        <div class='step4_name'>
-            {t}Enable DNS extension{/t}
-        </div>
-        <div class='step4_value'>
-
-            <select name="enableDNS" size="1" title="">
-                {html_options options=$bool selected=$generic_settings.enableDNS}
-            </select>
-        </div>
-    </div>
-
-       <div class='step4_container'>
-        <div class='step4_name'>
-            {t}Enable DHCP extension{/t}
-        </div>
-        <div class='step4_value'>
-
-            <select name="enableDHCP" size="1" title="">
-                {html_options options=$bool selected=$generic_settings.enableDHCP}
-            </select>
-        </div>
-    </div>
-
-       <div class='step4_container'>
-        <div class='step4_name'>
-            {t}Enable mime type management{/t}
-        </div>
-        <div class='step4_value'>
-
-            <select name="enableMimeType" size="1" title="">
-                {html_options options=$bool selected=$enableMimeType}
-            </select>
-        </div>
-    </div>
-
-       <div class='step4_container'>
-        <div class='step4_name'>
-            {t}Enable FAI release management{/t}
-        </div>
-        <div class='step4_value'>
-
-            <select name="enableFAI_management" size="1" title="">
-                {html_options options=$bool selected=$enableFAI_management}
-            </select>
-        </div>
-    </div>
-
-       <div class='step4_container'>
-        <div class='step4_name'>
-            {t}Enable user netatalk plugin{/t}
-        </div>
-        <div class='step4_value'>
-            <select name="use_netatalk" size="1" title="">
-                {html_options options=$bool selected=$use_netatalk}
-            </select>
-        </div>
-    </div>
-
-    <div class='step4_container'>
-        <div class='step4_name'>
-            {t}Government mode{/t}
-        </div>
-        <div class='step4_value'>
-            <select name="governmentmode" size="1" title="">
-                       {html_options options=$bool selected=$governmentmode}
-                       </select>
-        </div>
-    </div>
-
-    <p><b>{t}Mail settings{/t}</b></p>
-
-    <div class='step4_container'>
-        <div class='step4_name'>
-            {t}Mail method{/t}
-        </div>
-        <div class='step4_value'>
-            <select name="mail" size="1" title="">
-                <option  value="disabled">{t}disabled{/t}</option>
-                {html_options options=$mail_methods selected=$mail}
-            </select>
-        </div>
-        <div class='step4_status'>
-        </div>
-    </div>
-
-    <div class='step4_container'>
-        <div class='step4_name'>
-            {t}Vacation templates{/t}
-        </div>
-        <div class='step4_value'>
-            {if $mail_settings.vacationdir_active == FALSE}
-                <input type='checkbox' value='1' name='vacationdir_active'
-                    onClick='changeState("vacationdir");'>
-                <input size=40 id='vacationdir' name='vacationdir' type='text' value='{$mail_settings.vacationdir}' disabled>
-            {else}
-                <input type='checkbox' value='1' name='vacationdir_active' checked>
-                <input size=40 id='vacationdir' name='vacationdir' type='text' value='{$mail_settings.vacationdir}'  >
-            {/if}
-        </div>
-    </div>
-
-    <div class='step4_container'>
-        <div class='step4_name'>
-            {t}Use Cyrus UNIX style{/t}
-        </div>
-        <div class='step4_value'>
-            <select name="cyrusunixstyle" size="1" title="">
-            {html_options options=$bool selected=$cyrusunixstyle}
-            </select>
-        </div>
-    </div>
-
-
-        <p><b>{t}Snapshots / Undo{/t}</b></p>
-            {if $generic_settings.snapshot_active == FALSE}
-        <div class='step4_container'>
-         <div class='step4_name'>
-                <input type='checkbox' value='1' name='snapshot_active'
-                    onClick='
-                                                                changeState("snapshot_base");
-                                                                changeState("snapshot_server");
-                                                                changeState("snapshot_user");
-                                                                changeState("snapshot_password");'>{t}Enable snapshots{/t}
-         </div>
-        </div>
-        <div style='margin-left:10px;'>
-        <div class='step4_container'>
-         <div class='step4_name'>
-                {t}Snapshot base{/t}
-         </div>
-         <div class='step4_value'>
-                <input style='width:220' id='snapshot_base' name='snapshot_base'
-                                        type='text' value='{$generic_settings.snapshot_base}' disabled>
-         </div>
-        </div>
-        <div class='step4_container'>
-         <div class='step4_name'>
-                    {t}Server{/t}
-         </div>
-         <div class='step4_value'>
-                                <input style='width:220' id='snapshot_server' name='snapshot_server'
-                                        type='text' value='{$generic_settings.snapshot_server}' disabled>
-        </div>
-        </div>
-        <div class='step4_container'>
-         <div class='step4_name'>
-                        {t}User{/t}
-         </div>
-         <div class='step4_value'>
-                                <input style='width:220' id='snapshot_user' name='snapshot_user'
-                                        type='text' value='{$generic_settings.snapshot_user}' disabled>
-        </div>
-        </div>
-        <div class='step4_container'>
-         <div class='step4_name'>
-                        {t}Password{/t}
-         </div>
-         <div class='step4_value'>
-                                <input style='width:220' id='snapshot_password' name='snapshot_password'
-                                        type='password' value='{$generic_settings.snapshot_password}' disabled>
-        </div>
-        </div>
-        </div>
-
-            {else}
-        <div class='step4_container'>
-         <div class='step4_name'>
-                <input type='checkbox' value='1' name='snapshot_active' checked>{t}Enable snapshots{/t}
-        </div>
-        </div>
-        <div style='margin-left:10px;'>
-        <div class='step4_container'>
-         <div class='step4_name'>
-                    {t}Snapshot base{/t}
-        </div>
-         <div class='step4_value'>
-           <input style='width:220' id='snapshot_base' name='snapshot_base'
-                                        type='text' value='{$generic_settings.snapshot_base}'>
-        </div>
-        </div>
-        <div class='step4_container'>
-         <div class='step4_name'>
-                        {t}Server{/t}
-        </div>
-         <div class='step4_value'>
-                                <input style='width:220' id='snapshot_server' name='snapshot_server'
-                                        type='text' value='{$generic_settings.snapshot_server}'>
-        </div>
-        </div>
-        <div class='step4_container'>
-         <div class='step4_name'>
-                    {t}User{/t}
-        </div>
-         <div class='step4_value'>
-                                <input style='width:220' id='snapshot_user' name='snapshot_user'
-                                        type='text' value='{$generic_settings.snapshot_user}'>
-        </div>
-        </div>
-        <div class='step4_container'>
-         <div class='step4_name'>
-                        {t}Password{/t}
-        </div>
-         <div class='step4_value'>
-                                <input style='width:220;' id='snapshot_password' name='snapshot_password'
-                                        type='password' value='{$generic_settings.snapshot_password}'>
-        </div>
-        </div>
-        </div>
-            {/if}
-</div>
-
-<input type='hidden' value='1' name='step6_posted'>
-<div style="clear:both"></div>
diff --git a/setup/setup_config3.tpl b/setup/setup_config3.tpl
deleted file mode 100644 (file)
index a3d2a55..0000000
+++ /dev/null
@@ -1,324 +0,0 @@
-<div class='default' style='margin:12px; '>
-     <p><b>{t}GOsa core settings{/t}</b></p>
-
-    <div class='step4_container'>
-        <div class='step4_name'>
-            {t}Disable primary group filter{/t}
-        </div>
-        <div class='step4_value'>
-       
-            <select name="noprimarygroup" size="1" title="">
-               {html_options options=$bool selected=$optional.noprimarygroup}
-            </select>
-        </div>
-    </div>
-
-    <div class='step4_container'>
-        <div class='step4_name'>
-            {t}Display summary in listings{/t}
-        </div>
-        <div class='step4_value'>
-       
-            <select name="list_summary" size="1" title="">
-               {html_options options=$bool selected=$optional.list_summary}
-            </select>
-        </div>
-    </div>
-
-    <div class='step4_container'>
-        <div class='step4_name'>
-            {t}Honour administrative units{/t}
-        </div>
-        <div class='step4_value'>
-       
-            <select name="strict_units" size="1" title="">
-               {html_options options=$bool selected=$optional.strict_units}
-            </select>
-        </div>
-    </div>
-
-    <div class='step4_container'>
-        <div class='step4_name'>
-            {t}Smarty compile directory{/t}
-        </div>
-        <div class='step4_value'>
-                       <input size=40 id='compile' name='compile' 
-                               type='text' value='{$optional.compile}'>
-        </div>
-    </div>
-    <div class='step4_container'>
-        <div class='step4_name'>
-            {t}SNMP community{/t}
-        </div>
-        <div class='step4_value'>
-                       <input size=40 id='compile' name='snmpcommunity' 
-                               type='text' value='{$optional.snmpcommunity}'>
-        </div>
-    </div>
-    <div class='step4_container'>
-        <div class='step4_name'>
-            {t}Path for PPD storage{/t}
-        </div>
-        <div class='step4_value'>
-            {if $optional.ppd_path_active == FALSE}
-                <input type='checkbox' value='1' name='ppd_path_active'
-                    onClick='changeState("ppd_path");'>
-                <input size=40 id='ppd_path' name='ppd_path' type='text' value='{$optional.ppd_path}' disabled>
-            {else}
-                <input type='checkbox' value='1' name='ppd_path_active' checked
-                                       onClick='changeState("ppd_path");'>
-                <input size=40 id='ppd_path' name='ppd_path' type='text' value='{$optional.ppd_path}'  >
-            {/if}
-        </div>
-    </div>
-
-    <div class='step4_container'>
-        <div class='step4_name'>
-            {t}Path for kiosk profile storage{/t}
-        </div>
-        <div class='step4_value'>
-            {if $optional.kioskpath_active == FALSE}
-                <input type='checkbox' value='1' name='kioskpath_active'
-                    onClick='changeState("kioskpath");'>
-                <input size=40 id='kioskpath' name='kioskpath' 
-                                       type='text' value='{$optional.kioskpath}' disabled>
-            {else}
-                <input type='checkbox' value='1' name='kioskpath_active' checked
-                                       onClick='changeState("kioskpath");'>
-                <input size=40 id='kioskpath' name='kioskpath' 
-                                       type='text' value='{$optional.kioskpath}'  >
-            {/if}
-        </div>
-    </div>
-
-    <div class='step4_container'>
-        <div class='step4_name'>
-            {t}Enable system deployment{/t}
-        </div>
-        <div class='step4_value'>
-            {if $optional.gotomasses_active == FALSE}
-                <input type='checkbox' value='1' name='gotomasses_active'
-                    onClick='changeState("gotomasses_file");'>
-                <input size=40 id='gotomasses_file' name='gotomasses_file' 
-                                       type='text' value='{$optional.gotomasses_file}' disabled>
-            {else}
-                <input type='checkbox' value='1' name='gotomasses_active' checked
-                                       onClick='changeState("gotomasses_file");'>
-                <input size=40 id='gotomasses_file' name='gotomasses_file' 
-                                       type='text' value='{$optional.gotomasses_file}'  >
-            {/if}
-        </div>
-    </div>
-
-
-    <div class='step4_container'>
-        <div class='step4_name'>
-            {t}Network resolv hook{/t}
-        </div>
-        <div class='step4_value'>
-            {if $optional.auto_network_hook_active == FALSE}
-                <input type='checkbox' value='1' name='auto_network_hook_active'
-                    onClick='changeState("auto_network_hook");'>
-                <input size=40 id='auto_network_hook' name='auto_network_hook' 
-                                       type='text' value='{$optional.auto_network_hook}' disabled>
-            {else}
-                <input type='checkbox' value='1' name='auto_network_hook_active' checked
-                                       onClick='changeState("auto_network_hook");'>
-                <input size=40 id='auto_network_hook' name='auto_network_hook' type='text' 
-                                       value='{$optional.auto_network_hook}'  >
-            {/if}
-        </div>
-    </div>
-
-    <div class='step4_container'>
-        <div class='step4_name'>
-            {t}Mail queue script{/t}
-        </div>
-        <div class='step4_value'>
-            {if $optional.mailQueueScriptPath_active == FALSE}
-                <input type='checkbox' value='1' name='mailQueueScriptPath_active'
-                    onClick='changeState("mailQueueScriptPath");'>
-                <input size=40 id='mailQueueScriptPath' name='mailQueueScriptPath' 
-                                       type='text' value='{$optional.mailQueueScriptPath}' disabled>
-            {else}
-                <input type='checkbox' value='1' name='mailQueueScriptPath_active' checked 
-                                       onClick='changeState("mailQueueScriptPath");'>
-                <input size=40 id='mailQueueScriptPath' name='mailQueueScriptPath' type='text' 
-                                       value='{$optional.mailQueueScriptPath}'  >
-            {/if}
-        </div>
-    </div>
-
-    <div class='step4_container'>
-        <div class='step4_name'>
-            {t}Notification script{/t}
-        </div>
-        <div class='step4_value'>
-            {if $optional.notifydir_active == FALSE}
-                <input type='checkbox' value='1' name='notifydir_active'
-                    onClick='changeState("notifydir");'>
-                <input size=40 id='notifydir' name='notifydir' 
-                                       type='text' value='{$optional.notifydir}' disabled>
-            {else}
-                <input type='checkbox' value='1' name='notifydir_active' checked 
-                                       onClick='changeState("notifydir");'>
-                <input size=40 id='notifydir' name='notifydir' 
-                                       type='text' value='{$optional.notifydir}'  >
-            {/if}
-        </div>
-    </div>
-
-    <div class='step4_container'>
-        <div class='step4_name'>
-            {t}Enable edit locking{/t}
-        </div>
-        <div class='step4_value'>
-            {if $optional.uniq_identifier_active == FALSE}
-                <input type='checkbox' value='1' name='uniq_identifier_active'
-                    onClick='changeState("uniq_identifier");'>
-                               <select name="uniq_identifier" id="uniq_identifier" disabled>
-                                       {html_options options=$uniq_identifiers selected=$optional.uniq_identifier}
-                               </select>
-            {else}
-                <input type='checkbox' value='1' name='uniq_identifier_active' checked
-                                       onClick='changeState("uniq_identifier");'>
-                               <select name="uniq_identifier" id="uniq_identifier" >
-                                       {html_options options=$uniq_identifiers selected=$optional.uniq_identifier}
-                               </select>
-            {/if}
-        </div>
-    </div>
-
-    <p><b>{t}Login and session{/t}</b></p>
-    <div class='step4_container'>
-        <div class='step4_name'>
-            {t}Login attribute{/t}
-        </div>
-        <div class='step4_value'>
-            <select name="login_attribute" size="1" title="">
-               {html_options options=$login_attributes selected=$optional.login_attribute}
-            </select>
-        </div>
-    </div>
-
-    <div class='step4_container'>
-        <div class='step4_name'>
-            {t}Enforce register_globals to be deactivated{/t}
-        </div>
-        <div class='step4_value'>
-       
-            <select name="forceglobals" size="1" title="">
-               {html_options options=$bool selected=$optional.forceglobals}
-            </select>
-        </div>
-    </div>
-
-    <div class='step4_container'>
-        <div class='step4_name'>
-            {t}Enforce encrypted connections{/t}
-        </div>
-        <div class='step4_value'>
-       
-            <select name="forcessl" size="1" title="">
-               {html_options options=$bool selected=$optional.forcessl}
-            </select>
-        </div>
-    </div>
-
-    <div class='step4_container'>
-        <div class='step4_name'>
-            {t}Warn if session is not encrypted{/t}
-        </div>
-        <div class='step4_value'>
-       
-            <select name="warnssl" size="1" title="">
-               {html_options options=$bool selected=$optional.warnssl}
-            </select>
-        </div>
-    </div>
-
-    <div class='step4_container'>
-        <div class='step4_name'>
-            {t}Remember dialog filter settings{/t}
-        </div>
-        <div class='step4_value'>
-       
-            <select name="user_filter_cookie" size="1" title="">
-               {html_options options=$bool selected=$optional.user_filter_cookie}
-            </select>
-        </div>
-    </div>
-
-    <div class='step4_container'>
-        <div class='step4_name'>
-            {t}Session lifetime{/t}
-        </div>
-        <div class='step4_value'>
-                       <input size=10 id='session_lifetime' name='session_lifetime' 
-                               type='text' value='{$optional.session_lifetime}'>
-        </div>
-    </div>
-
-    <p><b>{t}Debugging{/t}</b></p>
-       
-    <div class='step4_container'>
-        <div class='step4_name'>
-            {t}Show PHP errors{/t}
-        </div>
-        <div class='step4_value'>
-            <select name="errorlvl" size="1" title="">
-            {html_options options=$bool selected=$errorlvl}
-            </select>
-        </div>
-    </div>
-
-
-    <div class='step4_container'>
-        <div class='step4_name'>
-            {t}Maximum LDAP query time{/t}
-        </div>
-        <div class='step4_value'>
-            {if $optional.max_ldap_query_time_active == FALSE}
-                <input type='checkbox' value='1' name='max_ldap_query_time_active'
-                    onClick='changeState("max_ldap_query_time");'>
-                <input size=10 id='max_ldap_query_time' name='max_ldap_query_time' 
-                                       type='text' value='{$optional.max_ldap_query_time}' disabled>
-            {else}
-                <input type='checkbox' value='1' name='max_ldap_query_time_active' checked>
-                <input size=10 id='max_ldap_query_time' name='max_ldap_query_time' 
-                                       type='text' value='{$optional.max_ldap_query_time}'  >
-            {/if}
-        </div>
-    </div>
-
-    <div class='step4_container'>
-        <div class='step4_name'>
-            {t}Log LDAP statistics{/t}
-        </div>
-        <div class='step4_value'>
-       
-            <select name="ldapstats" size="1" title="">
-               {html_options options=$bool selected=$optional.ldapstats}
-            </select>
-        </div>
-    </div>
-
-    <div class='step4_container'>
-        <div class='step4_name'>
-            {t}Debug level{/t}
-        </div>
-        <div class='step4_value'>
-                       <select name='debuglevel'>
-                               {if $optional.debuglevel == 0}
-                                       <option value='0' selected>0 {t}Disabled{/t}</option>
-                                       <option value='1'>1 {t}Enabled{/t}</option>
-                               {else}
-                                       <option value='0'>0 {t}Disabled{/t}</option>
-                                       <option value='1' selected>1 {t}Enabled{/t}</option>
-                               {/if}
-                       </select>               
-        </div>
-    </div>
-</div>
-
-<input type='hidden' value='1' name='step6a_posted'>
diff --git a/setup/setup_feedback.tpl b/setup/setup_feedback.tpl
deleted file mode 100644 (file)
index 20fae54..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-<div class='default' style='margin:12px; '>  
-
-       <h2>{$additional_info}</h2>
-
-       <h2>
-               <input {if $subscribe} checked {/if} type='checkbox' name='subscribe' value='1' class='center'>&nbsp;{t}Subscribe to the gosa-announce mailinglist{/t}
-       </h2>
-       <p>
-       {t}When checking this option, GOsa will try to connect http://oss.gonicus.de in order to subscribe you to the gosa-announce mailing list. You've to confirm this by mail.{/t}
-       </p>
-       <table> 
-               <tr>
-                       <td>
-                               {t}Organization{/t}
-                       </td>
-                       <td>
-                               <input name='organization' type='text' value='{$organization}' style='width:300px;'>
-                       </td>
-               </tr>
-               <tr>
-                       <td>
-                               {t}Name{/t}
-                       </td>
-                       <td>
-                               <input name='name' type='text' value='{$name}' style='width:300px;'>
-                       </td>
-               </tr>
-               <tr>
-                       <td>
-                               {t}Mail address{/t}{$must}
-                       </td>
-                       <td>
-                               <input name='eMail' type='text' value='{$eMail}' style='width:300px;'>  
-                       </td>
-               </tr>
-       </table>
-
-
-       <p>&nbsp;</p>
-       <h2>
-               <input {if $use_gosa_announce} checked {/if} type='checkbox' name='use_gosa_announce' value='1' class='center'>&nbsp;{t}Send feedback to the GOsa project team{/t}
-       </h2>
-       <p>
-       {t}When checking this option, GOsa will try to connect http://oss.gonicus.de in order to submit your form anonymously.{/t}
-       </p>
-       <b>{t}Generic{/t}</b>
-       <table> 
-               <tr>
-                       <td style='vertical-align:top'>
-                               {t}Did the setup procedure help you to get started?{/t}   
-                       </td>
-                       <td>
-                               <input {if $get_started} checked {/if} type='radio' name='get_started' value='1'>{t}Yes{/t}
-                               <br>
-                               <input {if !$get_started} checked {/if} type='radio' name='get_started' value='0'>{t}No{/t}
-                       </td>
-               </tr>
-               <tr>
-                       <td style='vertical-align:top'>
-                               {t}If not, what problems did you encounter{/t}:
-                       </td>
-                       <td>
-                               <textarea name='problems_encountered' rows='4' cols='50' style='width:100%'>{$problems_encountered}</textarea>
-                       </td>
-               </tr>
-               <tr>
-                       <td style='vertical-align:top'>
-                               {t}Is this the first time you use GOsa?{/t}
-                       </td>
-                       <td>
-                               <input {if $first_use} checked {/if} type='radio' name='first_use' value='1'>{t}Yes{/t}
-                               <br>
-                               <input {if !$first_use} checked {/if} type='radio' name='first_use' value='0'>{t}No{/t},
-                               {t}I use it since{/t}
-                               <select name='use_since' title='{t}Select the year since when you are using GOsa{/t}'> 
-                                       {html_options options=$years}
-                               </select>
-                       </td>   
-               </tr>
-               <tr>
-                       <td style='vertical-align:top'>
-                               {t}What operating system / distribution do you use?{/t}
-                       </td>
-                       <td>
-                               <input type='text' name='distribution' size=50 value='{$distribution}'>
-                       </td>
-               </tr>
-               <tr>
-                       <td style='vertical-align:top'>
-                               {t}What web server do you use?{/t}
-                       </td>
-                       <td>
-                               <input type='text' size=50 name='web_server' value='{$web_server}'>
-                       </td>
-               </tr>
-               <tr>
-                       <td style='vertical-align:top'>
-                               {t}What PHP version do you use?{/t}
-                       </td>
-                       <td>
-                               <input type='text' size=50 name='php_version' value='{$php_version}'>
-                       </td>
-               </tr>
-       </table>
-
-       <br><b>{t}LDAP{/t}</b>
-       <table>
-               <tr>
-                       <td style='vertical-align:top'>
-                       {t}What kind of LDAP server(s) do you use?{/t}
-                       </td>
-                       <td><input type='text' name='ldap_server' size=50 value='{$ldap_server}'>
-                       </td>
-               </tr>
-               <tr>
-                       <td>{t}How many objects are in your LDAP?{/t}
-                       </td>
-                       <td><input type='text' name='object_count' size=50 value='{$object_count}'>
-                       </td>
-               </tr>
-       </table>
-
-       <br><b>{t}Features{/t}</b>
-       <table>
-               <tr>
-                       <td style='vertical-align:top'>{t}What features of GOsa do you use?{/t}
-                       </td>
-                       <td>
-                               {foreach from=$features_used item=data key=key}
-                                       <input type='checkbox' name='feature_{$key}' {if $data.USED} checked {/if}>
-                                       {$data.NAME}<br>
-                               {/foreach}
-                       </td>
-               </tr>
-               <tr>
-                       <td style="vertical-align:top">{t}What features do you want to see in future versions of GOsa?{/t}
-                       </td>
-                       <td><textarea name='want_to_see_next' cols=50 rows=3>{$want_to_see_next}</textarea>
-                       </td>
-               </tr>
-       </table>
-</div>
-<input type='submit' name='send_feedback' value='{t}Send feedback{/t}'>
-<input type='hidden' name='step_feedback' value='1'>
diff --git a/setup/setup_finish.tpl b/setup/setup_finish.tpl
deleted file mode 100644 (file)
index 87b6732..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<div class='default'>
-       <p>
-               <b>{t}Create your configuration file{/t}</b>
-       </p>
-       <p>     
-               {$msg2}
-       </p>
-       <tt>
-       chown root.{$webgroup} {$CONFIG_DIR}/{$CONFIG_FILE}<br>
-       chmod 640 {$CONFIG_DIR}/{$CONFIG_FILE}
-       </tt>
-       <p>     
-               <input type='submit' name='getconf' value='{t}Download configuration{/t}'>
-       </p>
-               {if $err_msg != ""}
-                       <p class="seperator">&nbsp;</p>
-                       <br>
-                       {t}Status: {/t}
-                       <a style='color:red ; font-weight:bold '>{$err_msg}</a>
-               {/if}
-
-</div>
-<input type='hidden' value='1' name='step8_posted'>
diff --git a/setup/setup_frame.tpl b/setup/setup_frame.tpl
deleted file mode 100644 (file)
index 7da5205..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-<body class='setup_body'>
-{$php_errors}
-<form action='setup.php' name='mainform' method='post' enctype='multipart/form-data'>
-       {$msg_dialogs}
-<input id='focus' name='focus' type='image' src='images/empty.png' style='width:0px; height:0px;' >
-<div class='setup_dialog'>
-       <div class='setup_header'>
-               <div style="float:left;"><img src='themes/default/images/go_logo.png' class='center' alt='GOsa'></div>
-               <div style="padding-top:8px;text-align:right;height:28px">{$version}</div>
-       </div>
-       <div class='setup_menu'>
-               <b>{t}GOsa setup wizard{/t}</b>
-       </div>
-
-       <div style="padding:10px;background-color:white;">
-
-               <div class='setup_navigation'>
-                       <div style='padding:4px'>
-                               <img src='images/fai.png' class='center' alt='{t}Installation{/t}'>&nbsp;&nbsp;<font style="font-size:24px;">{t}Steps{/t}</font>
-                       </div>
-                       {$navigation}           
-               </div>
-       
-               <div class='setup_contents'>
-                       <div style='border-bottom:1px dashed #AAAAAA'>
-                               {$errors}
-                               {$header}
-                       </div>
-                       <div style='padding-left:12px;'>
-                               {$contents}
-                               {$bottom}
-                               <br>
-                       </div>
-               </div>
-               <div style="clear:both">        </div>
-       </div>
-</div>
-
-
-<input type='hidden' name='setup_goto_step' value=''>
-</form>
-
-<script type='javascript'>
-       document.getElementById('focus').focus();
-</script>
-</body>
-</html>
diff --git a/setup/setup_language.tpl b/setup/setup_language.tpl
deleted file mode 100644 (file)
index 6d1b30b..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<div>
-       <div class='default'>
-               <p><b>{t}Please select the preferred language{/t}</b></p>
-               <p>
-               {t}At this point, you can select the site wide default language. Choosing 'automatic' will use the language requested by the browser. This setting can be overriden per user.{/t}
-               </p>
-       </div>
-       <div class='default' style='padding-right:10px; margin-bottom:20px;'>
-               <select name='lang_selected' title='{t}Please your preferred language here{/t}' size=20 style="width:100%">
-               {html_options options=$languages selected=$lang_selected}
-               </select>
-       </div>
-</div>
diff --git a/setup/setup_ldap.tpl b/setup/setup_ldap.tpl
deleted file mode 100644 (file)
index b1ef46e..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-<div class='default' style="width:100%; margin-right:20px;">
-
-       {if $resolve_user}
-
-       <div style='float:left; width:99%; margin-bottom:20px;'>
-               <p>
-               <b>{t}Please choose the LDAP user to be used by GOsa{/t}</b>
-               </p>
-               <select name='admin_to_use' size=20 style="width:100%; margin-bottom:10px;">                            
-                       {html_options options=$resolved_users selected=$admin}
-               </select>
-               <input type='text' value='{$resolve_filter}' name='resolve_filter'>
-               <input type='submit' value='{t}Search{/t}' name='resolve_search'>
-               <p class='seperator' style='margin-bottom:10px;'>&nbsp;</p>
-               <div style='text-align:right'>
-               <input type='submit' value='{t}Apply{/t}' name='use_selected_user'>
-               <input type='submit' value='{t}Cancel{/t}' name='resolve_user'>
-               </div>
-       </div>          
-       
-       <div style="clear:both;"></div>
-
-       {else}
-       <p>
-       <b>{t}LDAP connection{/t}</b>
-       </p>
-       <div class='step4_container'>
-               <div class='step4_name'>
-                       {t}Location name{/t}
-               </div>
-               <div class='step4_value'>
-                       <input type='text' name='location' maxlength='80' size='40' value='{$location}'>
-               </div>
-       </div>
-       <div class='step4_container'>
-               <div class='step4_name'>
-                       <div style='vertical-align:middle;height:100%;'>{t}Connection URL{/t}</div>
-               </div>
-               <div class='step4_value'>
-                       <input type='text' name='connection' maxlength='80' size='40' value='{$connection}'>
-               </div>
-       </div>
-        <div class='step4_container'>
-          <div class='step4_name'>
-            {t}TLS connection{/t}
-          </div>
-          <div class='step4_value'>
-            <select name="tls" size="1" title="">
-                       {html_options options=$bool selected=$tls}
-            </select>
-          </div>
-        </div>
-       <div class='step4_container'>
-               <div class='step4_name'> 
-                       {t}Base{/t}
-               </div>
-               <div class='step4_value'>
-                       {if $namingContextsCount >= 1}
-                               <select name='base'>            
-                                       {html_options values=$namingContexts output=$namingContexts selected=$base}
-                               </select>
-                       {else}
-                               <input type='text' name='base' maxlength='80' size='40' value='{$base}'>
-                       {/if}
-                       <input type='image' class='center' src='images/list_reload.png' title='{t}Reload{/t}' name='reload' alt='{t}Reload{/t}'>
-               </div>
-       </div>
-       <p style="margin-top:20px">
-       <b>{t}Authentication{/t}</b>
-       </p>
-       <div class='step4_container'>
-               <div class='step4_name'> 
-                       {t}Admin DN{/t}
-               </div>
-               <div class='step4_value'>
-                       <input type='text' name='admin_given' maxlength='160' size='40' value='{$admin_given}'>
-                       {if $append_base_to_admin_dn},{$base_to_append}{/if}
-                       <input type='image' class='center' src='images/folder.png' title='{t}Select user{/t}' name='resolve_user' alt='{t}Select user{/t}'>
-               </div>
-       </div>
-
-       <div class='step4_container'>
-               <div class='step4_name'> 
-               </div>
-               <div class='step4_value'>
-                       <input onClick='document.mainform.submit();' {if $append_base_to_admin_dn} checked {/if} type='checkbox' name='append_base_to_admin_dn' value='1'>&nbsp;{t}Automatically append LDAP base to admin DN{/t}
-               </div>
-       </div>
-
-
-       <div class='step4_container'>
-               <div class='step4_name'>
-                       {t}Admin password{/t}
-               </div>
-               <div class='step4_value'>
-                       <input type='password' name='password' maxlength='20' size='20' value='{$password}'>
-               </div>
-       </div>
-
-       <p style="margin-top:20px">
-       <b>{t}Schema based settings{/t}</b>
-       </p>
-           <div class='step4_container'>
-               <div class='step4_name'>
-                   {t}Use rfc2307bis compliant groups{/t}
-               </div>
-               <div class='step4_value'>
-                   <select name="rfc2307bis" size="1" title="">
-                   {html_options options=$bool selected=$rfc2307bis}
-                   </select>
-               </div>
-           </div>
-       {/if}
-
-       {if ! $resolve_user}
-       <p style="margin-top:20px">
-       <b>{t}Current status{/t}</b>
-       </p>
-    <div class='step4_container' style='height:45px;'>
-        <div class='step4_name' style='height:45px;'>
-            {t}Information{/t}
-        </div>
-        <div class='step4_value' style='height:45px;'>
-                       {$connection_status}
-        </div>
-    </div>
-       {/if}
-
-</div>
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('location');
-  -->
-</script>
-
diff --git a/setup/setup_license.tpl b/setup/setup_license.tpl
deleted file mode 100644 (file)
index 47e7937..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<div style='float:left'>
-       <div class='default' style='margin:10px; border:1px solid #A0A0A0'>
-               <div style='height:450px;padding:5px;overflow:auto; '>
-                       {$License}
-               </div>
-       </div>  
-       <div style='width:95%; text-align: right'>
-               <input {if $accepted} checked {/if} type='checkbox' name='accepted' class="center">{t}I have read the license and accept it{/t}
-       </div>
-</div>
-<input type='hidden' name='step_license' value='1'>
diff --git a/setup/setup_migrate.tpl b/setup/setup_migrate.tpl
deleted file mode 100644 (file)
index a165216..0000000
+++ /dev/null
@@ -1,364 +0,0 @@
-<div>
-    <div class='default'>
-
-       {if $method == "default"}
-                       <p>{t}During the LDAP inspection, we're going to check for several common pitfalls that may occur when migration to GOsa base LDAP administration. You may want to fix the problems below, in order to provide smooth services.{/t}
-                       </p>
-
-                       {foreach from=$checks item=val key=key}
-                               <div style='width:98%; padding:4px; background-color:{cycle values="#F0F0F0, #FFF"}'>
-
-                       {if $checks.$key.ERROR_MSG}
-                                <!-- Add ability to display info popup -->
-                                <div class='step2_entry_container_info'>
-                        {else}
-                                <!-- Normal entry everything is fine -->
-                                <div class='step2_entry_container'>
-                        {/if}
-                               <div class='step2_entry_name'><b>{$checks.$key.TITLE}</b></div>
-                               <div class='step2_entry_status'>
-                               {if $checks.$key.STATUS}
-                                       <div class='step2_successful'>{$checks.$key.STATUS_MSG}</div>
-                               {else}
-                                       <div class='step2_failed'>{$checks.$key.STATUS_MSG}</div>
-                               {/if}
-                               </div>
-                                       {if $checks.$key.ERROR_MSG}
-                                               {$checks.$key.ERROR_MSG}
-                                       {/if}
-                               </div>
-                               </div>
-                       {/foreach}
-               <br>
-               <input type='submit' name='reload' value='{t}Check again{/t}'>
-
-               {elseif $method == "outside_winstations"}
-
-                       <h2>{t}Move windows workstations into a valid windows workstation department{/t}</h2>
-
-                       {t}This dialog allows you to move the displayed windows workstations into a valid department{/t}
-                       <br>
-                       {t}Be careful with this tool, there may be references pointing to this workstations that can't be migrated.{/t}
-                       <br>
-                       <br>    
-
-                       {foreach from=$outside_winstations item=val key=key}
-                               {if $outside_winstations.$key.selected}
-                                       <input id='select_winstation_{$key}' type='checkbox' name='select_winstation_{$key}' checked>
-                               {else}
-                                       <input id='select_winstation_{$key}' type='checkbox' name='select_winstation_{$key}'>
-                               {/if}
-
-                               &nbsp;{$outside_winstations.$key.dn}
-                               {if $outside_winstations.$key.ldif != ""}
-                    <div class="step2_entry_container_info" id="sol_8">
-                                               <div style='padding-left:20px;'>
-                                                       <pre>
-                                                               {$outside_winstations.$key.ldif}
-                                                       </pre>
-                                               </div>
-                                       </div>
-                               {/if}
-                               <br>
-                       {/foreach}
-                       <input type='checkbox' id='toggle_calue' onClick="toggle_all_('^select_winstation_','toggle_calue')">
-                       {t}Select all{/t}
-                       <p>
-                       <b>{t}Move selected windows workstations into the following GOsa department{/t} : </b>
-                       <select name='move_winstation_to'>
-                               {html_options options=$ous}
-                       </select>
-                       <br>
-                       <input type='submit' name='outside_winstations_dialog_perform' value='{t}Move selected workstations{/t}'>
-                       <input type='submit' name='outside_winstations_dialog_whats_done' value='{t}What will be done here{/t}'>
-                       </p>
-                               
-
-                       <p class='seperator'>&nbsp;</p> 
-                       <div style='width:100%; text-align:right; padding:5px;'>
-                               <input type='submit' name='outside_winstations_dialog_cancel' value='{t}Close{/t}'>
-                       </div>
-               
-
-               {elseif $method == "outside_groups"}
-
-                       <h2>{t}Move groups into configured group tree{/t}</h2>
-
-                        <p>
-                        {t}This dialog allows moving a couple of groups to the configured group tree. Doing this may straighten your LDAP service.{/t}
-                        </p>
-                        <p style='color:red'>
-                        {t}Be careful with this option! There may be references pointing to these groups. The GOsa setup can't migrate references, so you may want to cancel the migration in this case in this case.{/t}
-                        </p>
-                       <p>
-                       {t}Move selected groups into this group tree{/t}: 
-                       <select name='move_group_to'>
-                               {html_options options=$ous}
-                       </select>
-                       </p>
-
-                       {foreach from=$outside_groups item=val key=key}
-                               {if $outside_groups.$key.selected}
-                                       <input id='select_group_{$key}' type='checkbox' name='select_group_{$key}' checked>
-                               {else}
-                                       <input id='select_group_{$key}' type='checkbox' name='select_group_{$key}'>
-                               {/if}
-
-                               &nbsp;{$outside_groups.$key.dn}
-                               {if $outside_groups.$key.ldif != "" && $group_details}
-                      <div class="step2_entry_container_info" id="sol_8">
-<div style='padding-left:20px;'>
-<pre>
-{$outside_groups.$key.ldif}
-</pre>
-</div>
-</div>
-                               {/if}
-                               <br>
-                       {/foreach}
-
-                       <input type='checkbox' id='toggle_calue' onClick="toggle_all_('^select_group_','toggle_calue')">
-                       {t}Select all{/t}
-                       <br>
-                       <p>
-                        {if $group_details}
-                        <input type='submit' name='outside_groups_dialog_refresh' value='{t}Hide changes{/t}'>
-                        {else}
-                        <input type='submit' name='outside_groups_dialog_whats_done' value='{t}Show changes{/t}'>
-                        {/if}
-                       </p>
-
-                       <p class='seperator'>&nbsp;</p> 
-                       <div style='width:99%; text-align:right; padding:5px;'>
-                               <input type='submit' name='outside_groups_dialog_perform' value='{t}Apply{/t}'>
-                               &nbsp;
-                               <input type='submit' name='outside_groups_dialog_cancel' value='{t}Cancel{/t}'>
-                       </div>
-               
-               {elseif $method == "outside_users"}
-
-                       <h2>{t}Move users into configured user tree{/t}</h2>
-                       <p>
-                       {t}This dialog allows moving a couple of users to the configured user tree. Doing this may straighten your LDAP service.{/t}
-                       </p>
-                       <p style='color:red'>
-                       {t}Be careful with this option! There may be references pointing to these users. The GOsa setup can't migrate references, so you may want to cancel the migration in this case.{/t}
-                       </p>    
-                       <p>
-                       {t}Move selected users into this people tree{/t}: 
-                       <select name='move_user_to'>
-                               {html_options options=$ous}
-                       </select>
-                       </p>
-                       {foreach from=$outside_users item=val key=key}
-                               {if $outside_users.$key.selected}
-                                       <input id='select_user_{$key}' type='checkbox' name='select_user_{$key}' checked>
-                               {else}
-                                       <input id='select_user_{$key}' type='checkbox' name='select_user_{$key}'>
-                               {/if}
-
-                               &nbsp;{$outside_users.$key.dn}
-                               {if $outside_users.$key.ldif != "" && $user_details}
-                      <div class="step2_entry_container_info" id="sol_8">
-<div style='padding-left:20px;'>
-<pre>
-{$outside_users.$key.ldif}
-</pre>
-</div>
-</div>
-                               {/if}
-                               <br>
-                       {/foreach}
-                       <input type='checkbox' id='toggle_calue' onClick="toggle_all_('^select_user_','toggle_calue')">
-                       {t}Select all{/t}
-                       <br>
-
-                       {if $user_details}
-                       <input type='submit' name='outside_users_dialog_refresh' value='{t}Hide changes{/t}'>
-                        {else}
-                       <input type='submit' name='outside_users_dialog_whats_done' value='{t}Show changes{/t}'>
-                       {/if}
-
-                       <p class='seperator'>&nbsp;</p> 
-                       <div style='width:99%; text-align:right; padding:5px;'>
-                               <input type='submit' name='outside_users_dialog_perform' value='{t}Apply{/t}'>
-                               &nbsp;
-                               <input type='submit' name='outside_users_dialog_cancel' value='{t}Cancel{/t}'>
-                       </div>
-               
-
-               {elseif $method == "create_acls"}
-
-               {if $acl_create_selected != "" && $what_will_be_done_now!=""}
-                       <div>
-<pre>
-{$what_will_be_done_now}
-</pre>
-                       </div>          
-                       <input type='submit' name='create_acls_create_confirmed' value='{t}Next{/t}'>
-                       <input type='submit' name='create_acls_create_abort' value='{t}Abort{/t}'>
-               {else}
-                       <h2>{t}Create a new GOsa administrator account{/t}</h2>
-       
-                       <p>
-                       {t}This dialog will automatically add a new super administrator to your LDAP tree.{/t}
-                       </p>
-                       <table>
-                               <tr>
-                                       <td>
-                                               {t}Name{/t}:&nbsp;
-                                       </td>
-                                       <td>
-                                               <i>System administrator</i>
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>
-                                               {t}User ID{/t}:&nbsp;
-                                       </td>
-                                       <td>
-                                               <input type='text' value='{$new_user_uid}' name='new_user_uid'><br>
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>
-                                               {t}Password{/t}:&nbsp;
-                                       </td>
-                                       <td>
-                                               <input type='password' value='{$new_user_password}' name='new_user_password'><br>
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>
-                                               {t}Password (again){/t}:&nbsp;
-                                       </td>
-                                       <td>
-                                               <input type='password' value='{$new_user_password2}' name='new_user_password2'><br>
-                                       </td>
-                               </tr>
-                       </table>
-       
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('new_user_password');
-  -->
-</script>
-
-                       <p class='seperator'>&nbsp;</p> 
-                       <div style='width:99%; text-align:right; padding:5px;'>
-                               <input type='submit' name='create_admin_user' value='{t}Apply{/t}'>     
-                               <input type='submit' name='create_acls_cancel' value='{t}Cancel{/t}'>
-                       </div>
-                       {/if}   
-               {elseif $method == "migrate_deps"}
-       
-                       <h2>Department migration</h2>
-
-                       <p>{t}The listed departments are currenlty invisble in the GOsa user interface. If you want to change this for a couple of entries, select them and use the migrate button below.{/t}</p>
-                       <p>{t}If you want to know what will be done when migrating the selected entries, use the 'Show changes' button to see the LDIF.{/t}</p>
-                                       
-                       {foreach from=$deps_to_migrate item=val key=key}
-
-                               {if $deps_to_migrate.$key.checked}
-                                       <input id='migrate_{$key}' type='checkbox' name='migrate_{$key}' checked>
-                                       {$deps_to_migrate.$key.dn}
-                                       {if $deps_to_migrate.$key.after != ""}
-                                               <div class="step2_entry_container_info" id="sol_8">
-
-{t}Current{/t}
-<div style='padding-left:20px;'>
-<pre>
-dn: {$deps_to_migrate.$key.dn}
-{$deps_to_migrate.$key.before}
-</pre>
-</div>
-{t}After migration{/t}
-<div style='padding-left:20px;'>
-<pre>
-dn: {$deps_to_migrate.$key.dn}
-{$deps_to_migrate.$key.after}
-</pre>
-</div>
-                                               </div>
-                                       {/if}
-                               {else}
-                                       <input id='migrate_{$key}' type='checkbox' name='migrate_{$key}'>
-                                       {$deps_to_migrate.$key.dn}
-                               {/if}
-                               
-                       <br>
-                       {/foreach}
-                       <input type='checkbox' id='toggle_calue' onClick="toggle_all_('^migrate_','toggle_calue')">
-                       {t}Select all{/t}
-                       <br>
-
-                       {if $deps_details}
-                       <input type='submit' name='deps_visible_migrate_refresh' value='{t}Hide changes{/t}'>
-                       {else}
-                       <input type='submit' name='deps_visible_migrate_whatsdone' value='{t}Show changes{/t}'>
-                       {/if}
-
-                       <p class='seperator'>&nbsp;</p> 
-
-                       <div style='width:99%; text-align:right; padding:5px;'>
-                               <input type='submit' name='deps_visible_migrate_migrate' value='{t}Apply{/t}'>
-                               &nbsp;
-                               <input type='submit' name='deps_visible_migrate_close' value='{t}Cancel{/t}'>
-                       </div>
-               {elseif $method == "migrate_users"}
-       
-                       <h2>User migration</h2>
-
-                       <p>{t}The listed users are currenlty invisble in the GOsa user interface. If you want to change this for a couple of users, just select them and use the 'Migrate' button below.{/t}</p>
-                       <p>{t}If you want to know what will be done when migrating the selected entries, use the 'Show changes' button to see the LDIF.{/t}</p>
-                       {foreach from=$users_to_migrate item=val key=key}
-
-                               {if $users_to_migrate.$key.checked}
-                                       <input type='checkbox' name='migrate_{$key}' checked id='migrate_{$key}'>
-                                       {$users_to_migrate.$key.dn}
-                                       {if $users_to_migrate.$key.after != ""}
-                                               <div class="step2_entry_container_info" id="sol_8">
-
-{t}Current{/t}
-<div style='padding-left:20px;'>
-<pre>
-dn: {$users_to_migrate.$key.dn}
-{$users_to_migrate.$key.before}
-</pre>
-</div>
-{t}After migration{/t}
-<div style='padding-left:20px;'>
-<pre>
-dn: {$users_to_migrate.$key.dn}
-{$users_to_migrate.$key.after}
-</pre>
-</div>
-                                               </div>
-                                       {/if}
-                               {else}
-                                       <input type='checkbox' name='migrate_{$key}' id='migrate_{$key}'>
-                                       {$users_to_migrate.$key.dn}
-                               {/if}
-                               <br>
-                       {/foreach}
-                       <input type='checkbox' id='toggle_calue' onClick="toggle_all_('^migrate_','toggle_calue')">
-                       {t}Select all{/t}
-                       <br>
-
-                       {if $user_details}
-                       <input type='submit' name='users_visible_migrate_refresh' value='{t}Hide changes{/t}'>
-                       {else}
-                       <input type='submit' name='users_visible_migrate_whatsdone' value='{t}Show changes{/t}'>
-                       {/if}
-
-                       <p class='seperator'>&nbsp;</p> 
-
-                       <div style='width:99%; text-align:right; padding-top:5px;'>
-                               <input type='submit' name='users_visible_migrate_migrate' value='{t}Apply{/t}'>
-                               &nbsp;
-                               <input type='submit' name='users_visible_migrate_close' value='{t}Cancel{/t}'>
-                       </div>
-       {/if}
-    </div>
-</div>
diff --git a/setup/setup_schema.tpl b/setup/setup_schema.tpl
deleted file mode 100644 (file)
index e56538b..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-<div class='default'>
-    <p>
-     <b>{t}Schema specific settings{/t}</b>
-    </p>
-    <div class='step4_container'>
-        <div class='step4_name' style='width:30%'>
-            {t}Enable schema validation when logging in{/t}
-        </div>
-        <div class='step4_value'>
-                       <select name='enable_schema_check'>
-                               {html_options options=$bool selected=$enable_schema_check}
-            </select>
-        </div>
-    </div>
-    <p>
-     <b>{t}Check status{/t}</b>
-    </p>
-       <div>
-               {if $failed_checks == 0}
-                       <font style="color:green">{t}Schema check succeeded{/t}</font>
-               {else}
-                       <img src='images/small_warning.png' class='center'>
-                               <font style="color:red">{t}Schema check failed{/t}</font>
-               {/if}
-       </div>
-       <div style="margin-left:20px;">
-               {foreach from=$checks item=val key=key}
-                               {if !$checks[$key].STATUS}
-                               <br>
-                                       {if $checks[$key].IS_MUST_HAVE}
-                                               <font color='red'>{$checks[$key].MSG}</font>
-                                       {else}
-                                               {$checks[$key].MSG}
-                                       {/if}
-                               <br>
-                               {/if}
-               {/foreach}
-       </div>
-</div>
-<input type='hidden' value='1' name='step7_posted'>
diff --git a/setup/setup_welcome.tpl b/setup/setup_welcome.tpl
deleted file mode 100644 (file)
index e6f76c7..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-<div>
-    <div class='default'>
-       <p>
-       {t}This seems to be the first time you start GOsa - we didn't find any configuration right now. This simple wizard intends to help you while setting it up.{/t}
-       </p>
-       
-       <p style='border-top:1px solid #AAAAAA; padding-top:10px;'>
-       <b>{t}What will the wizard do for you?{/t}</b>
-       </p>
-       <ul>
-        <li>{t}Create a basic, single site configuration{/t}</li>
-        <li>{t}Tries to find problems within your PHP and LDAP setup{/t}</li>
-        <li>{t}Let you choose from a set of basic and advanced configuration switches{/t}</li>
-        <li>{t}Guided migration of existing LDAP trees{/t}</li>
-       </ul>
-       <p>
-       <b>{t}What will the wizard NOT do for you?{/t}</b>
-       </p>
-       <ul>
-        <li>{t}Find every possible configuration error{/t}</li>
-        <li>{t}Migrate every possible LDAP setup - create backup dumps!{/t}</li>
-       </ul>
-
-       <p style='border-top:1px solid #AAAAAA; padding-top:10px;'>
-       <b>{t}To continue...{/t}</b>
-       </p>
-       <p>
-       {t}For security reasons you need to authenticate for the installation by creating the file '/tmp/gosa.auth', containing the current session ID on the servers local filesystem. This can be done by executing the following command:{/t}
-       </p>
-       <tt>
-       echo -n <b>{$auth_id}</b> &gt; /tmp/gosa.auth
-       </tt>
-       <p>
-       {t}Click the 'Continue' button when you've finished.{/t}
-       </p>
-     </div>
-</div>