index 351e2112c7f993bde1e4d1933a57f94891c64cda..e7dae441a4c59574777d5c5b71015b61a7151a70 100644 (file)
var $orig_dn = "";
- var $dhcp_server_list = array();
+ 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)
{
$this->reload();
if (!count($this->dhcpSections)){
$this->is_account= FALSE;
+ $this->dhcp_server_list = $this->get_list_of_dhcp_servers();
}
-
- $this->dhcp_server_list = $this->get_list_of_dhcp_servers();
}
- function take_over_service()
- {
-
- }
-
-
function get_list_of_dhcp_servers()
{
- $ret = array();
+ $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){
}
- function get_dhcp_info_string($id)
- {
- $ret = "";
- $ldap = $this->config->get_ldap_link();
- $ldap->cd("cn=dhcp,".$this->dhcp_server_list['ENTRIES'][$id]['dn']);
- $ldap->search("(|(objectClass=dhcpSharedNetwork)(objectClass=dhcpSubnet)(objectClass=dhcpPool)(objectClass=dhcpGroup)(objectClass=dhcpHost))",array("dn","cn"));
- $ldap->search("(objectClass=*)",array("dn","cn"));
- while($attrs = $ldap->fetch()){
- $ret .= $attrs['dn']."\n";
- }
- return($ret);
- }
-
-
function execute()
{
/* Call parent execute */
/* 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'])){
if($this->take_over_id != -1){
$this->dialog = FALSE;
$id = $this->take_over_id;
- $info = $this->get_dhcp_info_string($id);
$smarty->assign("dns_take_over",TRUE);
- $smarty->assign("info",$info);
- $warning = sprintf(_("You are going to take over the dhcp setup from server '%s'."),$this->dhcp_server_list['ENTRIES'][$id]['cn'][0]);
- $warning2 = _("The take over will be startet when you save this system. To abort this action, use the cancel button below.");
- $smarty->assign("warning",$warning);
- $smarty->assign("warning2",$warning2);
+
+ $warning = sprintf(_("You are going to migrate the DHCP setup from server '%s'."),$this->dhcp_server_list['ENTRIES'][$id]['cn'][0]);
+ $warning.= _("The migration will be startet 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)));
}
$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 */