Commit 412358c7 authored by Côme Bernigaud's avatar Côme Bernigaud Committed by Benoit Mortier

Fixes: #2626 We should be able to create link to object edition easily

parent 8d1d82ee
......@@ -58,6 +58,7 @@ class dashboardNetwork extends simplePlugin
$servers[] = array(
'name' => $attrs['cn'][0],
'link' => objects::link($attrs['dn'], 'server', 'service_serviceDHCP', $attrs, FALSE),
'zones' => $zones
);
}
......@@ -81,7 +82,11 @@ class dashboardNetwork extends simplePlugin
if (preg_match("/^cn=/", $dn)) {
$cn = preg_replace("/^cn=([^,]+),.*$/", "$1", $dn);
if (!isset($servers[$dn])) {
$servers[$dn] = array('name' => $cn, 'zones' => array());
$servers[$dn] = array(
'name' => $cn,
'link' => objects::link($attrs['dn'], 'server', 'service_serviceDNS', $cn, FALSE),
'zones' => array()
);
}
$servers[$dn]['zones'][$attrs['zoneName'][0]] = $attrs['zoneName'][0];
} elseif (preg_match("/^zoneName=/", $dn)) {
......
......@@ -6,8 +6,8 @@
{foreach from=$attributes item=infos}
<ul>
{foreach from=$infos item=server}
<li style="list-style-image:url(plugins/systems/images/select_server.png)">
{$server.name}
<li style="list-style-image:url(plugins/systems/images/select_server.png)" id="server_{$server.name}">
{$server.link}
<ul>
{foreach from=$server.zones item=zone}
<li style="list-style:disc">
......
......@@ -99,12 +99,6 @@ class systemManagement extends management
$this->registerAction("new_$type", "newEntry");
}
foreach ($this->config->data['TABS']['SERVERSERVICE'] as $plug) {
if (class_available($plug['CLASS'])) {
$this->registerAction("edit_".$plug['CLASS'], "editEntry");
}
}
// Check if we are able to communicate with Argonaut server
if (class_available("supportDaemon")) {
$o = new supportDaemon();
......@@ -502,14 +496,23 @@ class systemManagement extends management
if ($str) {
return $str;
}
if (preg_match("/^edit_/", $action)) {
$service = preg_replace("/^edit_/", "", $action);
if (isset($this->tabObject->by_object['ServerService'])) {
$this->tabObject->current = 'ServerService';
$all = array('action' => 'edit', 'targets' => array($service));
$this->tabObject->by_object['ServerService']->editEntry($all['action'], $all['targets'], $all);
} else {
trigger_error("Unknown tab: ServerService");
if (isset($all['subaction'])) {
if (preg_match('/^tab_([a-zA-Z_]+)$/', $all['subaction'], $m)) {
$tab = $m[1];
if (isset($this->tabObject->by_object[$tab])) {
$this->tabObject->current = $tab;
} else {
trigger_error('Unknown tab: '.$tab);
}
} elseif (preg_match('/^service_([a-zA-Z_]+)$/', $all['subaction'], $m)) {
$service = $m[1];
if (isset($this->tabObject->by_object['ServerService'])) {
$this->tabObject->current = 'ServerService';
$all = array('action' => 'edit', 'targets' => array($service));
$this->tabObject->by_object['ServerService']->editEntry($all['action'], $all['targets'], $all);
} else {
trigger_error("Unknown tab: ServerService");
}
}
}
}
......@@ -981,6 +984,7 @@ class systemManagement extends management
$headpage = $this->getHeadpage();
$headpage->update();
$tD = $this->getObjectDefinitions();
$smarty = get_smarty();
foreach($tD as $name => $obj){
......@@ -988,7 +992,7 @@ class systemManagement extends management
}
$display = $headpage->render();
return($this->getHeader().$display);
return $this->getHeader().$display;
}
......@@ -1159,7 +1163,7 @@ class systemManagement extends management
if (isset($infos['plIcon'])) {
$services_imgs[] = "<input class='center' type='image' src='".$infos['plIcon']."' ".
"alt='".$infos['plShortName']."' title='".$infos['plShortName']."' ".
"name='listing_edit_".$class."_$row' style='padding:1px'/>";
"name='listing_edit_service_".$class."_$row' style='padding:1px'/>";
} else {
@DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $infos['plShortName']." ($class)", "No icon for");
}
......@@ -1179,15 +1183,16 @@ class systemManagement extends management
static function plInfo()
{
return array(
"plShortName" => _("Systems"),
"plDescription" => _("Systems Management"),
"plIcon" => "plugins/systems/images/icon.png",
"plSelfModify" => FALSE,
"plPriority" => 20,
"plSection" => "admin",
"plCategory" => array("terminal","workstation","server","phone","printer","component","winstation"),
"plProvidedAcls" => array()
'plShortName' => _('Systems'),
'plDescription' => _('Systems Management'),
'plIcon' => 'plugins/systems/images/icon.png',
'plSelfModify' => FALSE,
'plPriority' => 20,
'plSection' => 'admin',
'plCategory' => array('terminal','workstation','server','phone','printer','component','winstation'),
'plManages' => array('terminal','workstation','server','phone','printer','component','winstation'),
'plProvidedAcls' => array()
);
}
}
......
<?php
/*
This code is part of FusionDirectory (http://www.fusiondirectory.org/)
Copyright (C) 2003 Cajus Pollmeier
Copyright (C) 2011-2013 FusionDirectory
Copyright (C) 2013 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
......@@ -20,38 +18,5 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/* Remove locks created by this plugin */
if ($remove_lock){
if(session::is_set('systemManagement')){
$macl = session::get('systemManagement');
$macl->remove_lock();
}
}
/* Remove this plugin from session
*/
if ( $cleanup ){
session::un_set('systemManagement');
}else{
/* Reset requested? */
if (isset($_GET['reset']) && $_GET['reset'] == 1){
session::un_set ('systemManagement');
}
/* Create systemManagement object on demand */
if (!session::is_set('systemManagement')){
$systemManagement= new systemManagement ($config, $ui);
session::set('systemManagement',$systemManagement);
}
$systemManagement = session::get('systemManagement');
$display= $systemManagement->execute();
/* Show and save dialog */
session::set('systemManagement',$systemManagement);
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
simpleManagement::mainInc('systemManagement');
?>
Markdown is supported
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