diff --git a/gosa-plugins/goto/admin/systems/goto/class_workstationStartup.inc b/gosa-plugins/goto/admin/systems/goto/class_workstationStartup.inc
index 4b3164c40fb27f7d8860505b0f7930d793f33135..ea4db08a490e13d67b80f8cc1c65ac5ff10d370c 100644 (file)
{
/* Check if FAI is active */
$tmp= $config->search("faiManagement", "CLASS",array('menu','tabs'));
- if(!empty($tmp)){
+ if(!empty($tmp) && class_available("faiManagement")){
$this->fai_activated = TRUE;
}else{
$this->attributes = array("gotoLdapServer", "gotoBootKernel", "gotoKernelParameters", "gotoShare");
plugin::plugin ($config, $dn, $parent);
/* Check for si daemon */
- $this->si_active = isset($this->config->current['GOSA_SI']) && !empty($this->config->current['GOSA_SI']);
+ $this->si_active = $this->config->get_cfg_value("gosaSupportURI") != "";
/* Check object group membership */
if(!isset($this->parent->by_object['ogroup'])){
$this->gotoLdapServers[] = preg_replace("/^[0-9]*:/","",$value);
}
}
+ natcasesort($this->gotoLdapServerList);
+
if(!count($this->gotoLdapServers) && $this->member_of_ogroup){
$this->gotoLdap_inherit = TRUE;
}
}
$this->FAIdebianMirror = "auto";
$this->FAIrelease = key($this->cache['SERVERS'][$this->FAIdebianMirror]);
- $this->cache =array();
+ $this->cache['CLASSES'] = array();
$this->update_fai_cache();
-
}
/* Check if the current mirror is available
msg_dialog::display(_("Error"), sprintf(_("FAI release '%s' is not available on mirror '%s' - setting to release '%s'!"), $this->FAIrelease, $this->FAIdebianMirror,$new_release), ERROR_DIALOG);
}
$this->FAIrelease = $new_release;
- $this->cache =array();
+ $this->cache['CLASSES'] = array();
$this->update_fai_cache();
}
}
-
-# /* 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";
-# }
}
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/small-error.png\" align=middle> <b>".
/* Add module */
if (isset ($_POST['add_module'])){
- if ($_POST['module'] != "" && $this->acl_is_writeable("gotoModule")){
+ if ($_POST['module'] != "" && $this->acl_is_writeable("gotoModules")){
$this->add_list ($this->gotoModules, $_POST['module']);
}
}
/* Delete module */
if (isset ($_POST['delete_module'])){
- if (count($_POST['modules_list']) && $this->acl_is_writeable("gotoModule")){
+ if (count($_POST['modules_list']) && $this->acl_is_writeable("gotoModules")){
$this->del_list ($this->gotoModules, $_POST['modules_list']);
}
}
}
if((isset($this->FAIclassInfo[$_POST['FAIclassesSel']]['FAIpartitionTable']))&&($found>0)){
- msg_dialog(_("Error"), _("There is already a profile containing a partition table in your configuration!") , ERROR_DIALOG);
+ msg_dialog::display(_("Error"), _("There is already a profile containing a partition table in your configuration!") , ERROR_DIALOG);
}else{
$this->FAIclass[$_POST['FAIclassesSel']]=$_POST['FAIclassesSel'];
}
/* 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"))) {
+ if((isset($_POST['gotoShareAdd'])) && isset($_POST['gotoShareSelection']) && ($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']))){
- msg_dialog(_("Error"), msgPool::required(_("Mount point")), ERROR_DIALOG);
+ msg_dialog::display(_("Error"), msgPool::required(_("Mount point")), ERROR_DIALOG);
}else{
- if(count($this->gotoAvailableShares)){
+
+ if(isset($this->gotoAvailableShares[$_POST['gotoShareSelection']])){
$a_share = $this->gotoAvailableShares[$_POST['gotoShareSelection']];
$s_mount = $_POST['gotoShareMountPoint'];
/* Preparing the new assignment */
$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($this->acl_is_writeable("gotoLdapServer") &&
+ !$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)){
}
/* Move ldap servers up and down */
- if(!$this->gotoLdap_inherit){
+ if(!$this->gotoLdap_inherit && $this->acl_is_writeable("gotoLdapServer")){
foreach($_POST as $name => $value){
if(preg_match("/sort_ldap_up_/",$name)){
$id = preg_replace("/^sort_ldap_up_([0-9]*)_(x|y)$/","\\1",$name);
}
/* Add Entries */
- foreach($this->gotoLdapServers as $key => $server){
- /* Announce missing entries */
- if(!in_array($server,$this->gotoLdapServerList)){
- $server = $server." <font style='color:red'>(missing)</font>";
- }
+ if($this->acl_is_readable("gotoLdapServer")){
- /* Convert old style entry */
- if (!preg_match('%:ldap://%', $server)){
- $server= "ldap://".preg_replace('/^([^:]+):/', '\1/', $server);
+ foreach($this->gotoLdapServers as $key => $server){
- /* Beautify new style entries */
+ /* Announce missing entries */
+ if(!in_array($server,$this->gotoLdapServerList)){
+ $server = $server." <font style='color:red'>(missing)</font>";
+ }
+
+ /* Convert old style entry */
+ if (!preg_match('%:ldaps?://%', $server)){
+ $server= "ldap://".preg_replace('/^([^:]+):/', '\1/', $server);
+
+ /* Beautify new style entries */
} else {
$server= preg_replace("/^[^:]+:/", "", $server);
}
"<input class='center' type='image' src='images/lists/sort-down.png' name='sort_ldap_down_".$key."'> ".
"<input class='center' type='image' src='images/lists/trash.png' name='gotoLdapRemove_".$key."'>",
"attach" => "style='text-align:right;width:40px;border-right:0px;'")));
+ }
}
if($this->gotoLdap_inherit){
if(!in_array($entry,$this->gotoLdapServers)){
/* Convert old style entry */
- if (!preg_match('%:ldap://%', $entry)){
+ if (!preg_match('%:ldap[s]*://%', $entry)){
$entry= "ldap://".preg_replace('/^([^:]+):/', '\1/', $entry);
/* Beautify new style entries */
}elseif(isset($this->parent->by_object['servgeneric'])){
$this->objectclasses = array("GOhard","gotoWorkstationTemplate");
}else{
- print "Object Type Configuration : unknown";
+ msg_dialog::display(_("Fatal error"),
+ "Object Type Configuration is unknown. Please contact the GOsa developers.",
+ FATAL_ERROR_DIALOG);
exit();
}
$ldap= $this->config->get_ldap_link();
/* Strip relevant part from dn, keep trailing ',' */
- $tmp= preg_replace("/^cn=[^,]+,".get_ou('terminalou')."/i", "", $this->dn);
+ $tmp= preg_replace("/^cn=[^,]+,".get_ou('terminalRDN')."/i", "", $this->dn);
$tmp= preg_replace("/".$this->config->current['BASE']."$/i", "", $tmp);
/* Walk from top to base and try to load default values for
while (TRUE){
$tmp= preg_replace ("/^[^,]+,/", "", $tmp);
- $ldap->cat("cn=default,".get_ou('terminalou').$tmp.
+ $ldap->cat("cn=default,".get_ou('terminalRDN').$tmp.
$this->config->current['BASE'], array('gotoTerminalPath'));
$attrs= $ldap->fetch();
if (isset($attrs['gotoTerminalPath'])){
$this->attrs['FAIclass'] = array();
$this->attrs['FAIdebianMirror'] = array();
}
- }
+ }else{
+ /* Don't touch FAI objects if something went wrong with the si daemon.
+ */
+ if(isset($this->attrs['FAIclass'])) unset($this->attrs['FAIclass']);
+ if(isset($this->attrs['FAIdebianMirror'])) unset($this->attrs['FAIdebianMirror']);
+ }
/* prepare share settings */
$tmp = array();
*/
if($force || !isset($this->cache['SERVERS'])){
- /* Only add inherit option, if we are part in an object group
- */
- if($this->member_of_ogroup){
- $this->cache['SERVERS']['inherited']=array();
- }
-
$o_queue = new gosaSupportDaemon();
- $tmp = $o_queue->FAI_get_server();
+ $tmp = $o_queue->FAI_get_server();
if($o_queue->is_error()){
msg_dialog::display(_("Service infrastructure"),msgPool::siError($o_queue->get_error()),ERROR_DIALOG);
$this->si_fai_action_failed = TRUE;
return;
}else{
foreach($tmp as $entry){
- $rel = $entry['RELEASE'];
+ $rel = $entry['FAI_RELEASE'];
$this->cache['SERVERS']['auto'][$rel] = $rel;
$this->cache['SERVERS'][$entry['SERVER']][$rel] = $rel;
+ uksort($this->cache['SERVERS']['auto'], 'strnatcasecmp');
+ uksort($this->cache['SERVERS'][$entry['SERVER']], 'strnatcasecmp');
}
}
}
+ /* Ensure that our selection is valid, else we get several PHP warnings
+ if there is no FAI configuration at all.
+ */
+ if(!isset($this->cache['SERVERS'][$this->FAIdebianMirror])){
+ $this->cache['SERVERS'][$this->FAIdebianMirror][''] ='';
+ }
+
/* Build up arrays, without checks */
if(!$first_call){
$release = $this->FAIrelease;
}
- if($force || !isset($this->cache['CLASSES'][$release])){
+ if($force || !isset($this->cache['CLASSES'][$release]) && $release != ""){
/* Get the list of available servers and their releases.
*/
}
}
}
+ uksort($this->cache['SERVERS'], 'strnatcasecmp');
+
+ /* Only add inherit option, if we are part in an object group
+ */
+ if($this->member_of_ogroup){
+ $this->cache['SERVERS'] = array_merge(array('inherited' => array()),$this->cache['SERVERS']);
+ }
}
/* Get list of available kernel for this release
*/
+ if(!isset($this->cache['KERNELS'])) $this->cache['KERNELS'] = array();
+
if($force || !isset($this->cache['KERNELS'][$release])){
$o_queue = new gosaSupportDaemon();
$tmp = $o_queue->FAI_get_kernels($release);
if(empty($kernel)) continue;
$this->cache['KERNELS'][$release][$kernel]=$kernel;
}
+ ksort($this->cache['KERNELS'][$release]);
}
- ksort($this->cache['KERNELS'][$release]);
}
function get_invalid_classes($classes)
{
$this->update_fai_cache();
- if($this->FAIdebianMirror == "inherited"){
+ if($this->FAIdebianMirror == "inherited" && isset($this->cache['CLASSES'][$this->InheritedFAIrelease])){
$release_classes = $this->cache['CLASSES'][$this->InheritedFAIrelease];
- }else{
+ }elseif(isset($this->cache['CLASSES'][$this->FAIrelease])){
$release_classes = $this->cache['CLASSES'][$this->FAIrelease];
+ }else{
+ $release_classes = array();
}
{
$this->update_fai_cache();
- if($this->FAIdebianMirror == "inherited"){
+ if($this->FAIdebianMirror == "inherited" && isset($this->cache['CLASSES'][$this->InheritedFAIrelease])){
$classes = $this->cache['CLASSES'][$this->InheritedFAIrelease];
- }else{
+ }elseif(isset($this->cache['CLASSES'][$this->FAIrelease])){
$classes = $this->cache['CLASSES'][$this->FAIrelease];
+ }else{
+ $classes = array();
}
$Abbr ="";
function GetHookElements()
{
$ret = array();
- $cmd= $this->config->search("servrepository", "REPOSITORY_HOOK",array('tabs'));
+ $cmd= $this->config->search("servrepository", "repositoryBranchHook",array('tabs'));
if(!empty($cmd)){
$res = shell_exec($cmd);
$res2 = trim($res);
if((!$res)){
- msg_dialog(_("Configuration error"), msgPool::cmdexecfailed("REPOSITORY_HOOK", $cmd), ERROR_DIALOG);
+ msg_dialog::display(_("Configuration error"), msgPool::cmdexecfailed("repositoryBranchHook", $cmd), ERROR_DIALOG);
}elseif(empty($res2)){
- msg_dialog(_("Configuration error"), _("REPOSITORY_HOOK returned no result!"), ERROR_DIALOG);
+ msg_dialog::display(_("Configuration error"), _("repositoryBranchHook returned no result!"), ERROR_DIALOG);
}else{
$tmp = split("\n",$res);
foreach($tmp as $line){