Commit e2bd260b authored by Côme Bernigaud's avatar Côme Bernigaud Committed by Benoit Mortier
Browse files

Fixes #3145 Missing class OPSIServerAttribute

parent 40909cf8
<?php
/*
This code is part of FusionDirectory (http://www.fusiondirectory.org/)
Copyright (C) 2013 FusionDirectory
Copyright (C) 2014 FusionDirectory
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
......@@ -18,21 +18,37 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
class SubmittingOPSIServerAttribute extends OPSIServerAttribute
class OPSIServerAttribute extends SelectAttribute
{
function __construct ($label, $description, $ldapName, $required = FALSE, $acl = "")
function setParent (&$plugin)
{
parent::__construct($label, $description, $ldapName, $required, array(), "", NULL, $acl);
$this->setSubmitForm(TRUE);
parent::setParent($plugin);
if (is_object($this->plugin)) {
$this->updateChoices();
}
}
function setValue($value)
function updateChoices()
{
$v = $this->getValue();
parent::setValue($value);
if (is_object($this->plugin) && ($v != $this->getValue())) {
$this->plugin->server_changed();
$ldap = $this->plugin->config->get_ldap_link();
$ldap->cd($this->plugin->config->current['BASE']);
$ldap->search('(objectClass=opsiServer)', array('cn'));
$serversdn = array();
$serverslabel = array();
while ($attrs = $ldap->fetch()) {
$serversdn[] = $attrs['dn'];
$serverslabel[] = $attrs['cn'][0];
}
$this->setChoices($serversdn, $serverslabel);
}
}
class SubmittingOPSIServerAttribute extends OPSIServerAttribute
{
function __construct ($label, $description, $ldapName, $required = FALSE, $acl = "")
{
parent::__construct($label, $description, $ldapName, $required, array(), "", NULL, $acl);
$this->setSubmitForm('server_changed');
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment