X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-plugins%2Fgoto%2Fadmin%2Fsystems%2Fgoto%2FDevice%2Fclass_InstallRecipe.inc;h=b0c3fb068483f447ee6d6e89fa978442a52613b1;hb=242f3de63a7274c3db9a63c30b17ec84e6dbeb9d;hp=d556e0f40bffb5631ddc2729c7f7418d337764af;hpb=44d89ca4e566763bcf014d12b15bdf9f7e4e9a25;p=gosa.git diff --git a/gosa-plugins/goto/admin/systems/goto/Device/class_InstallRecipe.inc b/gosa-plugins/goto/admin/systems/goto/Device/class_InstallRecipe.inc index d556e0f40..b0c3fb068 100644 --- a/gosa-plugins/goto/admin/systems/goto/Device/class_InstallRecipe.inc +++ b/gosa-plugins/goto/admin/systems/goto/Device/class_InstallRecipe.inc @@ -3,49 +3,107 @@ class InstallRecipe extends plugin { public $member = array(); - public $ksTemplate = ""; - public $ksKeyboardlayout = ""; - public $ksSystemLocale = ""; - public $ksTimezone = ""; - public $ksTimeUTC = ""; - public $ksNTPServer = ""; - public $ksMirror = ""; - public $ksMirrorTorrent = ""; - public $ksRootEnabled = ""; - public $ksRootPasswordHash = ""; - public $ksKernelPackage = ""; - public $ksPartitionTable = ""; + public $kickstartTemplateDN = ""; + public $kickstartKeyboardlayout = ""; + public $kickstartSystemLocale = ""; + public $kickstartTimezone = ""; + public $kickstartTimeUTC = ""; + public $kickstartNTPServer = ""; + public $kickstartMirrorDN = ""; + public $kickstartRootEnabled = ""; + public $kickstartRootPasswordHash = ""; + public $kickstartKernelPackage = ""; + public $kickstartPartitionTable = ""; public $objectclasses = array('installRecipe'); - public $attributes = array("member","ksTemplate","ksKeyboardlayout","ksSystemLocale", - "ksTimezone","ksTimeUTC","ksNTPServer","ksMirror","ksMirrorTorrent", - "ksRootEnabled","ksRootPasswordHash","ksKernelPackage","ksPartitionTable"); + public $attributes = array("member","kickstartTemplateDN","kickstartKeyboardlayout","kickstartSystemLocale", + "kickstartTimezone","kickstartTimeUTC","kickstartNTPServer","kickstartMirrorDN", + "kickstartRootEnabled","kickstartRootPasswordHash","kickstartKernelPackage","kickstartPartitionTable"); function __construct(&$config, $dn) { plugin::plugin($config, $dn); + + // Preset some values for new accounts + if(!$this->is_account){ + + // Preset the device timezone + $tz = timezone::get_default_timezone(); + $this->kickstartTimezone = $tz['name']; + } + + // Prepare list of timezones + $tmp = timezone::_get_tz_zones(); + $list = array(); + foreach($tmp['TIMEZONES'] as $name => $offset){ + if($offset >= 0){ + $list[$name] = $name." ( + ".sprintf("%0.2f",$offset/(60*60))." "._("hours").")"; + }else{ + $offset = $offset * -1; + $list[$name] = $name." ( - ".sprintf("%0.2f",($offset/(60*60)))." "._("hours").")"; + } + } + uksort($list, 'strnatcasecmp'); + $this->timezones = $list; + + // Prepare member list + $this->memberList= new sortableListing($this->member); + $this->memberList->setDeleteable(true); + $this->memberList->setColspecs(array('*')); + $this->memberList->setWidth("100%"); + $this->memberList->setHeight("70px"); + + } function execute() { plugin::execute(); $smarty = get_smarty(); + $smarty->assign('timezones', $this->timezones); foreach($this->attributes as $attr){ $smarty->assign($attr, $this->$attr); } + + // Fill and render the member list widget + $this->memberList->setListData($this->member); + $this->memberList->update(); + $this->memberList->setAcl($this->getacl('member')); + $smarty->assign('memberList', $this->memberList->render()); return($smarty->fetch(get_template_path('goto/Device/InstallRecipe.tpl', TRUE))); } + + function save_object() + { + plugin::save_object(); + $this->kickstartRootEnabled = isset($_POST['kickstartRootEnabled']); + + // Update the member list widget. + $this->memberList->save_object(); + $this->member = $this->memberList->getMaintainedData(); + if(isset($_POST['member']) && isset($_POST['addMember'])){ + $member= get_post('member'); + $this->member[] = $member; + } + } + function save() { plugin::save(); + $this->cleanup(); $ldap=$this->config->get_ldap_link(); $ldap->cd($this->config->current['BASE']); $ldap->cd($this->dn); $ldap->modify($this->attrs); - echo $ldap->get_error(); + new log("modify","Device/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + if (!$ldap->success()){ + msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_MOD, get_class())); + }else{ + $this->handle_post_events("modify"); + } } static function plInfo() @@ -57,21 +115,20 @@ class InstallRecipe extends plugin "plDepends" => array(), "plPriority" => 1, "plSection" => array("administration"), - "plCategory" => array("registeredDevice"), + "plCategory" => array("Device"), "plProvidedAcls" => array( "member" => _("Member"), - "ksTemplate" => _("Template"), - "ksKeyboardlayout" => _("Keyboard layout"), - "ksSystemLocale" => _("System locale"), - "ksTimezone" => _("Timezone"), - "ksTimeUTC" => _("Time"), - "ksNTPServer" => _("NTP-Server"), - "ksMirror" => _("Kickstart mirror"), - "ksMirrorTorrent" => _("Kickstart torrent mirror"), - "ksRootEnabled" => _("Root login enabled"), - "ksRootPasswordHash" => _("Root password hash"), - "ksKernelPackage" => _("Kernal package"), - "ksPartitionTable" => _("Partition table") + "kickstartTemplateDN" => _("Template"), + "kickstartKeyboardlayout" => _("Keyboard layout"), + "kickstartSystemLocale" => _("System locale"), + "kickstartTimezone" => _("Timezone"), + "kickstartTimeUTC" => _("Time"), + "kickstartNTPServer" => _("NTP-Server"), + "kickstartMirrorDN" => _("Kickstart mirror"), + "kickstartRootEnabled" => _("Root login enabled"), + "kickstartRootPasswordHash" => _("Root password hash"), + "kickstartKernelPackage" => _("Kernal package"), + "kickstartPartitionTable" => _("Partition table") ) ) );