diff --git a/gosa-plugins/goto/admin/systems/goto/class_workstationStartup.inc b/gosa-plugins/goto/admin/systems/goto/class_workstationStartup.inc
index f8b151bebe47e93e90c7586ec96577f84a05a99b..f902a92e0608c4a8a6f759164175b8cf81f13f1b 100644 (file)
var $gotoLdap_inherit = FALSE;
/* Generic terminal attributes */
var $gotoLdap_inherit = FALSE;
/* Generic terminal attributes */
- var $bootmode = "G";
+ # This is disabled as long there is no possiblilty to set these parameters
+ #var $bootmode = "G";
+ var $bootmode = "";
var $gotoBootKernel = "default-inherited";
var $gotoKernelParameters = "";
var $gotoLdapServer = "default-inherited";
var $gotoBootKernel = "default-inherited";
var $gotoKernelParameters = "";
var $gotoLdapServer = "default-inherited";
var $gotoAvailableShares= array();// Available Shares for this account
/* Helper */
var $gotoAvailableShares= array();// Available Shares for this account
/* Helper */
- var $customParameters = "";
var $orig_dn = "";
var $ignore_account = TRUE;
/* FAI class selection */
var $FAIclass = array(); // The currently selected classes
var $orig_dn = "";
var $ignore_account = TRUE;
/* FAI class selection */
var $FAIclass = array(); // The currently selected classes
- var $FAIrelease = "";
- var $FAIdebianMirror = "auto";
+ var $FAIrelease = "";
+ var $FAIdebianMirror = "auto";
var $si_active = FALSE;
var $si_fai_action_failed = FALSE;
var $si_active = FALSE;
var $si_fai_action_failed = FALSE;
{
/* Check if FAI is active */
$tmp= $config->search("faiManagement", "CLASS",array('menu','tabs'));
{
/* 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");
$this->fai_activated = TRUE;
}else{
$this->attributes = array("gotoLdapServer", "gotoBootKernel", "gotoKernelParameters", "gotoShare");
plugin::plugin ($config, $dn, $parent);
/* Check for si daemon */
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'])){
/* Check object group membership */
if(!isset($this->parent->by_object['ogroup'])){
*/
$ldap = $this->config->get_ldap_link();
$ldap->cd($this->config->current['BASE']);
*/
$ldap = $this->config->get_ldap_link();
$ldap->cd($this->config->current['BASE']);
- foreach($this->config->data['SERVERS']['LDAP'] as $server) {
- $this->gotoLdapServerList[]= $server;
+ $ui = get_userinfo();
+ foreach($this->config->data['SERVERS']['LDAP'] as $dn => $data){
+ if($ui->get_category_permissions($data['dn'],"server",TRUE)){
+ for($i = 0; $i < $data['goLdapBase']['count']; $i ++){
+ $name = $data["cn"][0].":".$data["goLdapBase"][$i];
+ $this->gotoLdapServerList[]= $name;
+ }
+ }
}
/* Get list of assigned ldap servers
}
/* Get list of assigned ldap servers
foreach($this->attrs['gotoLdapServer'] as $value){
$this->gotoLdapServers[] = preg_replace("/^[0-9]*:/","",$value);
}
foreach($this->attrs['gotoLdapServer'] as $value){
$this->gotoLdapServers[] = preg_replace("/^[0-9]*:/","",$value);
}
- }
+ }
+ natcasesort($this->gotoLdapServerList);
+
if(!count($this->gotoLdapServers) && $this->member_of_ogroup){
$this->gotoLdap_inherit = TRUE;
}
if(!count($this->gotoLdapServers) && $this->member_of_ogroup){
$this->gotoLdap_inherit = TRUE;
}
*/
if($this->fai_activated) {
*/
if($this->fai_activated) {
- $this->update_fai_cache(TRUE);
-
/* Parse used FAIclasses (stored as string).
* The single classes are seperated by ' '.
* There is also the release type given, after first
/* Parse used FAIclasses (stored as string).
* The single classes are seperated by ' '.
* There is also the release type given, after first
*/
$this->FAIclass =array();
if(isset($this->attrs['FAIclass'][0])){
*/
$this->FAIclass =array();
if(isset($this->attrs['FAIclass'][0])){
- $tmp = split(" ",$this->attrs['FAIclass'][0]);
+ $tmp = explode(" ",$this->attrs['FAIclass'][0]);
$tmp2 =array();
foreach($tmp as $class){
$tmp2 =array();
foreach($tmp as $class){
$this->$val= array_unique($this->$val);
}
$this->$val= array_unique($this->$val);
}
- /* Parse Kernel Parameters to decide what boot mode is enabled */
- if (preg_match("/ splash=silent/", $this->gotoKernelParameters)){
- $this->bootmode= "G";
- } elseif (preg_match("/ debug/", $this->gotoKernelParameters)){
- $this->bootmode= "D";
- } elseif ($this->gotoKernelParameters == "") {
- $this->bootmode= "G";
- } else {
- $this->bootmode= "T";
- }
- if (preg_match("/ o /", $this->gotoKernelParameters)){
- $this->customParameters= preg_replace ("/^.* o /", "", $this->gotoKernelParameters);
- } else {
- $this->customParameters= "";
- }
-
/* Prepare Shares */
if((isset($this->attrs['gotoShare']))&&(is_array($this->attrs['gotoShare']))){
unset($this->attrs['gotoShare']['count']);
foreach($this->attrs['gotoShare'] as $share){
$tmp = $tmp2 = array();
/* Prepare Shares */
if((isset($this->attrs['gotoShare']))&&(is_array($this->attrs['gotoShare']))){
unset($this->attrs['gotoShare']['count']);
foreach($this->attrs['gotoShare'] as $share){
$tmp = $tmp2 = array();
- $tmp = split("\|",$share);
+ $tmp = explode("|",$share);
$tmp2['server'] =$tmp[0];
$tmp2['name'] =$tmp[1];
$tmp2['mountPoint'] =$tmp[2];
$tmp2['server'] =$tmp[0];
$tmp2['name'] =$tmp[1];
$tmp2['mountPoint'] =$tmp[2];
break;
case 'FAIclass':
break;
case 'FAIclass':
- $str = split(":",$attrs[$name][0]);
- $this->InheritedFAIclass = split("\ ",trim($str[0]));
+ $str = explode(":",$attrs[$name][0]);
+ $this->InheritedFAIclass = explode(" ",trim($str[0]));
$this->InheritedFAIrelease = trim($str[1]);
break;
$this->InheritedFAIrelease = trim($str[1]);
break;
}
}
}
}
+ $this->update_fai_cache();
if($this->fai_activated && !$this->si_fai_action_failed && $this->si_active){
if($this->fai_activated && !$this->si_fai_action_failed && $this->si_active){
}
$this->FAIdebianMirror = "auto";
$this->FAIrelease = key($this->cache['SERVERS'][$this->FAIdebianMirror]);
}
$this->FAIdebianMirror = "auto";
$this->FAIrelease = key($this->cache['SERVERS'][$this->FAIdebianMirror]);
- $this->cache =array();
+ $this->cache['CLASSES'] = array();
$this->update_fai_cache();
$this->update_fai_cache();
-
}
/* Check if the current mirror is available
}
/* 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;
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();
}
}
$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";
- }
+ // Prepare lists
+ $this->ldapList = new sortableListing(array(),array(), TRUE);
+ $this->ldapList->setDeleteable(true);
+ $this->ldapList->setEditable(false);
+ $this->ldapList->setWidth("100%");
+ $this->ldapList->setHeight("100px");
+ $this->ldapList->setHeader(array(_("LDAP server")));
+ $this->ldapList->setDefaultSortColumn(0);
}
}
new log("view","workstation/".get_class($this),$this->dn);
}
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){
/* Do we represent a valid terminal? */
if (!$this->is_account && $this->parent === NULL){
- $display= "<img alt=\"\" src=\"images/stop.png\" align=middle> <b>".
- msgPool::noValidExtension(_("workstation"))."</b>";
+ $display= image("images/small-error.png")."<b>".msgPool::noValidExtension(_("workstation"))."</b>";
return ($display);
}
/* Add module */
if (isset ($_POST['add_module'])){
return ($display);
}
/* 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'])){
$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']);
}
}
$this->del_list ($this->gotoModules, $_POST['modules_list']);
}
}
}
if((isset($this->FAIclassInfo[$_POST['FAIclassesSel']]['FAIpartitionTable']))&&($found>0)){
}
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'];
}
}else{
$this->FAIclass[$_POST['FAIclassesSel']]=$_POST['FAIclassesSel'];
}
}
if(($sort_type)&&(!$sort)){
}
if(($sort_type)&&(!$sort)){
- $value = base64_decode(preg_replace("/_.*$/i","",preg_replace("/".$sort_type."/i","",$name)));
+ $value = postDecode(preg_replace("/_.*$/i","",preg_replace("/".$sort_type."/i","",$name)));
$sort = true;
$last = -1;
$sort = true;
$last = -1;
}
if(preg_match("/fai_remove/i",$name)){
}
if(preg_match("/fai_remove/i",$name)){
- $value = base64_decode(preg_replace("/_.*$/i","",preg_replace("/fai_remove_/i","",$name)));
+ $value = postDecode(preg_replace("/fai_remove_/i","",$name));
unset($this->FAIclass[$value]);
}
}
unset($this->FAIclass[$value]);
}
}
/* if $_POST['gotoShareAdd'] is set, we will try to add a new entry
* This entry will be, a combination of mountPoint and sharedefinitions
*/
/* 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']))){
/* 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{
}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 */
$a_share = $this->gotoAvailableShares[$_POST['gotoShareSelection']];
$s_mount = $_POST['gotoShareMountPoint'];
/* Preparing the new assignment */
$smarty->assign("gotoShareKeys",array_flip($this->printOutAssignedShares()));
$smarty->assign("gotoBootKernels",$this->gotoBootKernels);
$smarty->assign("gotoShareKeys",array_flip($this->printOutAssignedShares()));
$smarty->assign("gotoBootKernels",$this->gotoBootKernels);
- /* Create divSelectBox for ldap server selection
- */
- $SelectBoxLdapServer = new divSelectBox("LdapServer");
- $SelectBoxLdapServer->SetHeight(130);
+ $this->ldapList->setAcl($this->getacl('gotoLdapServer'));
/* Add new ldap server to the list */
/* 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)){
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 */
}
/* Move ldap servers up and down */
- if(!$this->gotoLdap_inherit){
- foreach($_POST as $name => $value){
- if(preg_match("/sort_ldap_up_/",$name)){
- $id = preg_replace("/^sort_ldap_up_([0-9]*)_(x|y)$/","\\1",$name);
- $from = $id;
- $to = $id -1;
- $tmp = $this->array_switch_item($this->gotoLdapServers,$from,$to);
- if($tmp){
- $this->gotoLdapServers = $tmp;
- }
- break;
- }
- if(preg_match("/sort_ldap_down_/",$name)){
- $id = preg_replace("/^sort_ldap_down_([0-9]*)_(x|y)$/","\\1",$name);
- $from = $id;
- $to = $id +1;
- $tmp = $this->array_switch_item($this->gotoLdapServers,$from,$to);
- if($tmp){
- $this->gotoLdapServers = $tmp;
- }
- break;
- }
- if(preg_match("/gotoLdapRemove_/",$name)){
- $id = preg_replace("/^gotoLdapRemove_([0-9]*)_(x|y)$/","\\1",$name);
- $value = $this->gotoLdapServers[$id];
- $this->gotoLdapServers = array_remove_entries(array($value),$this->gotoLdapServers);
- break;
- }
- }
+ $this->ldapList->save_object();
+ $action = $this->ldapList->getAction();
+ if($action['action'] == 'reorder'){
+ $this->gotoLdapServers = array_values($this->ldapList->getMaintainedData());
}
}
-
+ if($action['action'] == 'delete'){
+ $id = $this->ldapList->getKey($action['targets'][0]);
+ $value = $this->gotoLdapServers[$id];
+ $this->gotoLdapServers = array_remove_entries(array($value),$this->gotoLdapServers);
+ }
+
/* Add Entries */
/* Add Entries */
+ $data = $lData = array();
foreach($this->gotoLdapServers as $key => $server){
foreach($this->gotoLdapServers as $key => $server){
- /* Announce missing entries */
- if(!in_array($server,$this->gotoLdapServerList)){
- $server = $server." <font style='color:red'>(missing)</font>";
- }
-
- /* Convert old style entry */
- if (!preg_match('%:ldap://%', $server)){
- $server= "ldap://".preg_replace('/^([^:]+):/', '\1/', $server);
+ $data[$key]=$server;
- /* Beautify new style entries */
- } else {
- $server= preg_replace("/^[^:]+:/", "", $server);
- }
+ /* Announce missing entries */
+ if(!in_array($server,$this->gotoLdapServerList)){
+ $server = $server." <font style='color:red'>(missing)</font>";
+ }
- $SelectBoxLdapServer->AddEntry(
- array(array("string" => $server),
- array("string" =>
- "<input class='center' type='image' src='images/sort_up.png' name='sort_ldap_up_".$key."'> ".
- "<input class='center' type='image' src='images/sort_down.png' name='sort_ldap_down_".$key."'> ".
- "<input class='center' type='image' src='images/edittrash.png' name='gotoLdapRemove_".$key."'>",
- "attach" => "style='text-align:right;width:40px;border-right:0px;'")));
- }
+ /* Convert old style entry */
+ if (!preg_match('%:ldaps?://%', $server)){
+ $server= "ldap://".preg_replace('/^([^:]+):/', '\1/', $server);
+ } else {
+ $server= preg_replace("/^[^:]+:/", "", $server);
+ $lData[$key] = array('data'=>array($server));
+ }
+ }
+ $this->ldapList->setListData($data,$lData);
+ $this->ldapList->update();
+ $smarty->assign("usePrototype", "true");
if($this->gotoLdap_inherit){
$smarty->assign("gotoLdapServerACL_inherit", preg_replace("/w/","",$this->getacl("gotoLdapServer")));;
if($this->gotoLdap_inherit){
$smarty->assign("gotoLdapServerACL_inherit", preg_replace("/w/","",$this->getacl("gotoLdapServer")));;
if(!in_array($entry,$this->gotoLdapServers)){
/* Convert old style entry */
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 */
$entry= "ldap://".preg_replace('/^([^:]+):/', '\1/', $entry);
/* Beautify new style entries */
$list[$key] = $entry;
}
}
$list[$key] = $entry;
}
}
- $smarty->assign("gotoLdapServers", $SelectBoxLdapServer->DrawList());
+ $smarty->assign("gotoLdapServers", $this->ldapList->render());
$smarty->assign("gotoLdapServerList", $list);
$smarty->assign("gotoLdap_inherit", $this->gotoLdap_inherit);
$smarty->assign("JS", session::get('js'));
$smarty->assign("gotoLdapServerList", $list);
$smarty->assign("gotoLdap_inherit", $this->gotoLdap_inherit);
$smarty->assign("JS", session::get('js'));
}
/* Values */
}
/* Values */
- foreach(array("gotoBootKernel", "customParameters", "gotoShare","FAIclasses","FAIclass","FAIdebianMirror","FAIrelease") as $val){
+ foreach(array("gotoBootKernel","gotoShare","FAIclasses","FAIclass","FAIdebianMirror","FAIrelease") as $val){
$smarty->assign($val, $this->$val);
}
$smarty->assign($val, $this->$val);
}
$this->update_fai_cache();
$smarty->assign("si_fai_action_failed",$this->si_fai_action_failed);
$smarty->assign("si_active",$this->si_active);
$this->update_fai_cache();
$smarty->assign("si_fai_action_failed",$this->si_fai_action_failed);
$smarty->assign("si_active",$this->si_active);
+
+ $div = new divSelectBox("WSFAIscriptClasses");
+ $div -> SetHeight("100");
if(!$this->si_fai_action_failed && $this->si_active && $this->fai_activated){
if(!$this->si_fai_action_failed && $this->si_active && $this->fai_activated){
$smarty->assign("FAIrelease" , $this->FAIrelease);
$smarty->assign("FAIclasses" , $this->selectable_classes());
$smarty->assign("FAIrelease" , $this->FAIrelease);
$smarty->assign("FAIclasses" , $this->selectable_classes());
+ /* Get classes for release from cache.
+ * Or build cache
+ */
+ if($this->FAIdebianMirror == "inherited"){
+ $release = $this->InheritedFAIrelease;
+ }else{
+ $release = $this->FAIrelease;
+ }
+
+ $smarty->assign("gotoBootKernels",$this->cache['KERNELS'][$release]);
$smarty->assign("InheritedFAIrelease",$this->InheritedFAIrelease);
$smarty->assign("InheritedFAIrelease",$this->InheritedFAIrelease);
- $div = new divSelectBox("WSFAIscriptClasses");
- $div -> SetHeight("110");
- $str_up = " <input type='image' src='images/sort_up.png' name='sort_up_%s' value='%s'>";
- $str_down = " <input type='image' src='images/sort_down.png' name='sort_down_%s' value='%s'>";
- $str_remove = " <input type='image' src='images/edittrash.png' name='fai_remove_%s' value='%s'>";
- $str_empty = " <img src='images/empty.png' alt=\"\" width='7'>";
+ $str_empty = image('images/empty.png');
+ if($this->acl_is_writeable("FAIclass")){
+ $str_up = image('images/lists/sort-up.png','sort_up_%s');
+ $str_down = image('images/lists/sort-down.png','sort_down_%s');
+ $str_remove = image('images/lists/trash.png','fai_remove_%s');
+ }else{
+ $str_up=$str_down=$str_remove=$str_empty;
+ }
/* Get classes */
if($this->FAIdebianMirror == "inherited"){
/* Get classes */
if($this->FAIdebianMirror == "inherited"){
/* Draw every single entry */
$i = 1;
/* Draw every single entry */
$i = 1;
- foreach($tmp as $class){
+ if($this->acl_is_readable("FAIclass")){
+ foreach($tmp as $class){
- /* Mark invalid classes. (Not in selected release)
- */
- $marker = "";
- if(in_array_ics($class,$invalid)){
- $marker = " <font color='red'>("._("Not available in current setup").")</font>";
- }
+ /* Mark invalid classes. (Not in selected release)
+ */
+ $marker = "";
+ if(in_array_ics($class,$invalid)){
+ $marker = " <font color='red'>("._("Not available in current setup").")</font>";
+ }
- /* Create up/down priority icons
- * Skip this, if we have inherited the FAI classes.
- */
- if($this->FAIdebianMirror == "inherited"){
- $str = "";
- }else{
- if($i==1){
- $str = $str_empty.$str_down.$str_remove;
- }elseif($i == count($this->FAIclass)){
- $str = $str_up.$str_empty.$str_remove;
+ /* Create up/down priority icons
+ * Skip this, if we have inherited the FAI classes.
+ */
+ if($this->FAIdebianMirror == "inherited"){
+ $str = "";
}else{
}else{
- $str = $str_up.$str_down.$str_remove;
+ if($i==1){
+ $str = $str_empty.$str_down.$str_remove;
+ }elseif($i == count($this->FAIclass)){
+ $str = $str_up.$str_empty.$str_remove;
+ }else{
+ $str = $str_up.$str_down.$str_remove;
+ }
}
}
- }
- $i ++ ;
-
- /* Get Description tag
- * There may be several FAI objects with the same class name,
- * use the description from FAIprofile, if possible.
- */
- $desc = "";
- if(isset($this->cache['CLASSES'][$this->FAIrelease][$class])){
- foreach($this->cache['CLASSES'][$this->FAIrelease][$class] as $types ){
- if(isset($types['Desc'])){
- $desc= $types['Desc'];
- if($types['Type'] == "FAIprofile"){
- break;
+ $i ++ ;
+
+ /* Get Description tag
+ * There may be several FAI objects with the same class name,
+ * use the description from FAIprofile, if possible.
+ */
+ $desc = "";
+
+ $objects = array(
+ "Pl" => array("IMG"=> "plugins/fai/images/fai_partitionTable.png"),
+ "Pt" => array("IMG"=> "plugins/fai/images/fai_packages.png"),
+ "S" => array("IMG"=> "plugins/fai/images/fai_script.png"),
+ "V" => array("IMG"=> "plugins/fai/images/fai_variable.png"),
+ "H" => array("IMG"=> "plugins/fai/images/fai_hook.png"),
+ "P" => array("IMG"=> "plugins/fai/images/fai_profile.png"),
+ "T" => array("IMG"=> "plugins/fai/images/fai_template.png"));
+
+ if(isset($this->cache['CLASSES'][$this->FAIrelease][$class])){
+ $desc ="";
+ foreach($this->cache['CLASSES'][$this->FAIrelease][$class] as $types ){
+ if(isset($types['Abbr'])){
+ $desc.= image($objects[$types['Abbr']]['IMG']);
+ if($types['Type'] == "FAIprofile"){
+ break;
+ }
}
}
}
}
}
}
- }
- if(!empty($desc)){
- $desc = " [".trim($desc)."]";
- }
-
- $div->AddEntry(array(
- array("string"=>$class.$desc.$marker),
- array("string"=>preg_replace("/\%s/",base64_encode($class),$str),"attach"=>"style='width:50px;border-right:none;'")
- ));
- }
- $smarty->assign("FAIScriptlist",$div->DrawList());
+ if(!empty($desc)){
+ $desc = " ".trim($desc)."";
+ }
+
+ $div->AddEntry(array(
+ array("string"=>$class.$marker),
+ array("string"=>$desc),
+ array("string"=>preg_replace("/\%s/",postEncode($class),$str),"attach"=>"style='width:60px;border-right:none;'")
+ ));
+ }
+ }// END FAI output generation
}// END FAI output generation
}// END FAI output generation
+ $smarty->assign("FAIScriptlist",$div->DrawList());
/* Radio button group */
if (preg_match("/G/", $this->bootmode)) {
/* Radio button group */
if (preg_match("/G/", $this->bootmode)) {
}
/* Show main page */
}
/* Show main page */
+ $smarty->assign("gotoKernelParameters",$this->gotoKernelParameters);
return($smarty->fetch (get_template_path('workstationStartup.tpl', TRUE,dirname(__FILE__))));
}
return($smarty->fetch (get_template_path('workstationStartup.tpl', TRUE,dirname(__FILE__))));
}
if ($this->acl_is_writeable("bootmode") && isset($_POST["bootmode"])){
$this->bootmode= $_POST["bootmode"];
}
if ($this->acl_is_writeable("bootmode") && isset($_POST["bootmode"])){
$this->bootmode= $_POST["bootmode"];
}
-
- /* Save kernel parameters */
- if ($this->acl_is_writeable("gotoKernelParameters") && isset($_POST["customParameters"])){
- $this->customParameters= $_POST["customParameters"];
- }
}
}
}
}
}elseif(isset($this->parent->by_object['servgeneric'])){
$this->objectclasses = array("GOhard","gotoWorkstationTemplate");
}else{
}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();
}
exit();
}
$ldap= $this->config->get_ldap_link();
/* Strip relevant part from dn, keep trailing ',' */
$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=[^,]+,".preg_quote(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
$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);
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->config->current['BASE'], array('gotoTerminalPath'));
$attrs= $ldap->fetch();
if (isset($attrs['gotoTerminalPath'])){
}
}
}
}
- /* Add semi automatic values */
- // FIXME: LDAP Server may not be set here...
- $this->gotoKernelParameters= "ldap=".base64_encode($this->gotoLdapServer);
-
- switch ($this->bootmode){
- case "D":
- $this->gotoKernelParameters.= " debug";
- break;
- case "G":
- $this->gotoKernelParameters.= " splash=silent";
- break;
- }
- if ($this->customParameters != ""){
- $this->gotoKernelParameters.= " o ".$this->customParameters;
- }
-
plugin::save();
unset( $this->attrs['FAIrelease'] );
plugin::save();
unset( $this->attrs['FAIrelease'] );
}
}
}
}
- /* Check if LDAP server has changed */
- $ldap_changed= false;
- if (isset($this->saved_attributes['gotoLdapServer'])){
- if (isset($this->attrs['gotoLdapServer']) && $this->attrs['gotoLdapServer'] != $this->saved_attributes['gotoLdapServer']){
- $ldap_changed= true;
- }
- } else {
- if (isset($this->attrs['gotoLdapServer'])){
- $ldap_changed= true;
- }
- }
-
- if (($this->attrs['gotoBootKernel'] == "default-inherited") || ($this->attrs['gotoBootKernel'] == "%default%")){
+ if ($this->attrs['gotoBootKernel'] == "default-inherited"){
$this->attrs['gotoBootKernel']= array();
}
$this->attrs['gotoBootKernel']= array();
}
$this->attrs['FAIclass'] = array();
$this->attrs['FAIdebianMirror'] = array();
}
$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();
foreach($this->gotoShares as $name => $settings){
/* prepare share settings */
$tmp = array();
foreach($this->gotoShares as $name => $settings){
- $tmp2= split("\|",$name);
+ $tmp2= explode("|",$name);
$name = $tmp2[0];
$tmp[] = $settings['server']."|".$name."|".$settings['mountPoint'];
}
$this->attrs['gotoShare']=$tmp;
$name = $tmp2[0];
$tmp[] = $settings['server']."|".$name."|".$settings['mountPoint'];
}
$this->attrs['gotoShare']=$tmp;
-
$this->cleanup();
$ldap->modify ($this->attrs);
new log("modify","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
$this->cleanup();
$ldap->modify ($this->attrs);
new log("modify","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
$this->handle_post_events("modify");
/* Check if LDAP server has changed */
$this->handle_post_events("modify");
/* Check if LDAP server has changed */
- if ($ldap_changed && class_available("DaemonEvent")){
+ if ((isset($this->attrs['gotoLdapServer']) && class_available("DaemonEvent")) || $this->gotoLdap_inherit){
$events = DaemonEvent::get_event_types(SYSTEM_EVENT | HIDDEN_EVENT);
$o_queue = new gosaSupportDaemon();
if(isset($events['TRIGGERED']['DaemonEvent_reload_ldap_config'])){
$events = DaemonEvent::get_event_types(SYSTEM_EVENT | HIDDEN_EVENT);
$o_queue = new gosaSupportDaemon();
if(isset($events['TRIGGERED']['DaemonEvent_reload_ldap_config'])){
if(!empty($mac)){
$macs[] = $mac;
}
if(!empty($mac)){
$macs[] = $mac;
}
+ }elseif(isset($this->parent->by_object['servgeneric']->netConfigDNS->macAddress)){
+
+ /* We are a server. Add current mac.
+ */
+ $mac = $this->parent->by_object['servgeneric']->netConfigDNS->macAddress;
+ if(!empty($mac)){
+ $macs[] = $mac;
+ }
}
/* Trigger event for all member objects
}
/* Trigger event for all member objects
plugin::PrepareForCopyPaste($source);
$source_o = new workstartup ($this->config, $source['dn']);
foreach(array("FAIclass","gotoModules", "gotoAutoFs", "gotoFilesystem",
plugin::PrepareForCopyPaste($source);
$source_o = new workstartup ($this->config, $source['dn']);
foreach(array("FAIclass","gotoModules", "gotoAutoFs", "gotoFilesystem",
- "gotoKernelParameters","gotoShares","customParameters") as $attr){
+ "gotoKernelParameters","gotoShares","gotoLdapServers","gotoLdapServerList",
+ "gotoLdap_inherit") as $attr){
$this->$attr = $source_o->$attr;
}
}
$this->$attr = $source_o->$attr;
}
}
"plProvidedAcls"=> array(
"gotoLdapServer" => _("Ldap server"),
"gotoBootKernel" => _("Boot kernel"),
"plProvidedAcls"=> array(
"gotoLdapServer" => _("Ldap server"),
"gotoBootKernel" => _("Boot kernel"),
+ "bootmode" => _("Boot mode"),
"gotoKernelParameters" => _("Kernel parameter"),
"gotoModules" => _("Kernel modules"),
"gotoKernelParameters" => _("Kernel parameter"),
"gotoModules" => _("Kernel modules"),
function update_fai_cache($first_call = FALSE)
{
$force = FALSE;
function update_fai_cache($first_call = FALSE)
{
$force = FALSE;
- $this->si_fai_action_failed = FALSE;
if(!$this->si_active) return;
$start = microtime(TRUE);
if(!$this->si_active) return;
$start = microtime(TRUE);
+ if($this->si_fai_action_failed && !isset($_POST['fai_si_retry'])) return;
+
+ $this->si_fai_action_failed = FALSE;
+
/* Get the list of available servers and their releases.
*/
if($force || !isset($this->cache['SERVERS'])){
/* Get the list of available servers and their releases.
*/
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();
$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;
$this->cache = array();
return;
}else{
if($o_queue->is_error()){
msg_dialog::display(_("Service infrastructure"),msgPool::siError($o_queue->get_error()),ERROR_DIALOG);
$this->si_fai_action_failed = TRUE;
$this->cache = array();
return;
}else{
+
foreach($tmp as $entry){
foreach($tmp as $entry){
- $rel = $entry['RELEASE'];
+ $rel = $entry['FAI_RELEASE'];
$this->cache['SERVERS']['auto'][$rel] = $rel;
$this->cache['SERVERS'][$entry['SERVER']][$rel] = $rel;
$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){
/* Build up arrays, without checks */
if(!$first_call){
/* Check if the selected release is available */
if($this->FAIdebianMirror != "inherited" && !isset($this->cache['SERVERS'][$this->FAIdebianMirror][$this->FAIrelease])){
/* Check if the selected release is available */
if($this->FAIdebianMirror != "inherited" && !isset($this->cache['SERVERS'][$this->FAIdebianMirror][$this->FAIrelease])){
- trigger_error("There was a problem with the selected FAIrelease. This release ('".$this->FAIrelease."') is not available");
+
+ if($this->FAIrelease != ""){
+ trigger_error("There was a problem with the selected FAIrelease. This release ('".$this->FAIrelease."') is not available");
+ }
$this->FAIrelease = key($this->cache['SERVERS'][$this->FAIdebianMirror]);
}
}
$this->FAIrelease = key($this->cache['SERVERS'][$this->FAIdebianMirror]);
}
}
$release = $this->FAIrelease;
}
$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.
*/
$o_queue = new gosaSupportDaemon();
$tmp = $o_queue->FAI_get_classes($release);
/* Get the list of available servers and their releases.
*/
$o_queue = new gosaSupportDaemon();
$tmp = $o_queue->FAI_get_classes($release);
+
$this->cache['CLASSES'][$release] = array();
if($o_queue->is_error()){
msg_dialog::display(_("Service infrastructure"),msgPool::siError($o_queue->get_error()),ERROR_DIALOG);
$this->cache['CLASSES'][$release] = array();
if($o_queue->is_error()){
msg_dialog::display(_("Service infrastructure"),msgPool::siError($o_queue->get_error()),ERROR_DIALOG);
}else{
foreach($tmp as $entry){
$class = $entry['CLASS'];
}else{
foreach($tmp as $entry){
$class = $entry['CLASS'];
- $this->cache['CLASSES'][$release][$class] = $this->analyse_fai_object($entry);
+ $this->cache['CLASSES'][$release][$class][] = $this->analyse_fai_object($entry);
}
}
}
}
*/
$lines= $this->GetHookElements();
foreach ($lines as $hline){
*/
$lines= $this->GetHookElements();
foreach ($lines as $hline){
- $entries= split(";", $hline);
+ $entries= explode(";", $hline);
$server = $entries['0'];
$url = $entries['1'];
if (!empty($url)){
/* Split releases */
if (isset($entries[2])){
$server = $entries['0'];
$url = $entries['1'];
if (!empty($url)){
/* Split releases */
if (isset($entries[2])){
- $releases= split(",", $entries[2]);
+ $releases= explode(",", $entries[2]);
foreach ($releases as $release_data){
$release_c = preg_replace('/:.*$/', '', $release_data);
foreach ($releases as $release_data){
$release_c = preg_replace('/:.*$/', '', $release_data);
- $sections_c = split(':', preg_replace('/^[^:]+:([^|]+)|.*$/', '\1', $release_data));
- $classes_c = split('\|', preg_replace('/^[^|]+\|(.*)$/', '\1', $release_data));
+ $sections_c = explode(':', preg_replace('/^[^:]+:([^|]+)|.*$/', '\1', $release_data));
+ $classes_c = explode('|', preg_replace('/^[^|]+\|(.*)$/', '\1', $release_data));
if($release_c == $release){
$this->cache['SERVERS'][$url][$release_c]=$release_c;
if($release_c == $release){
$this->cache['SERVERS'][$url][$release_c]=$release_c;
}
}
}
}
}
}
+ 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);
+ $this->cache['KERNELS'][$release] = array();
+ foreach($this->gotoBootKernels as $name => $default){
+ $this->cache['KERNELS'][$release][$name] = $default;
+ }
+ foreach($tmp as $kernel){
+ if(empty($kernel)) continue;
+ $this->cache['KERNELS'][$release][$kernel]=$kernel;
+ }
+ ksort($this->cache['KERNELS'][$release]);
}
}
-# echo sprintf("Took %.6f <br> ",microtime(1) - $start);
}
}
function get_invalid_classes($classes)
{
$this->update_fai_cache();
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];
$release_classes = $this->cache['CLASSES'][$this->InheritedFAIrelease];
- }else{
+ }elseif(isset($this->cache['CLASSES'][$this->FAIrelease])){
$release_classes = $this->cache['CLASSES'][$this->FAIrelease];
$release_classes = $this->cache['CLASSES'][$this->FAIrelease];
+ }else{
+ $release_classes = array();
}
}
{
$this->update_fai_cache();
{
$this->update_fai_cache();
- if($this->FAIdebianMirror == "inherited"){
+ if($this->FAIdebianMirror == "inherited" && isset($this->cache['CLASSES'][$this->InheritedFAIrelease])){
$classes = $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];
$classes = $this->cache['CLASSES'][$this->FAIrelease];
+ }else{
+ $classes = array();
}
$Abbr ="";
$ret= array();
foreach($classes as $class_name => $class_types){
if(!in_array($class_name,$this->FAIclass)){
}
$Abbr ="";
$ret= array();
foreach($classes as $class_name => $class_types){
if(!in_array($class_name,$this->FAIclass)){
+ $Abbr = "";
foreach($class_types as $type){
if(!preg_match("/".$type['Abbr']."/",$Abbr)){
$Abbr .= $type['Abbr']." ";
foreach($class_types as $type){
if(!preg_match("/".$type['Abbr']."/",$Abbr)){
$Abbr .= $type['Abbr']." ";
function GetHookElements()
{
$ret = array();
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)){
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)){
}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{
}else{
- $tmp = split("\n",$res);
+ $tmp = preg_split("/\n/",$res);
foreach($tmp as $line){
if(empty($line)) continue;
$ret[]= $line;
foreach($tmp as $line){
if(empty($line)) continue;
$ret[]= $line;
*/
function dn_to_release_name($dn)
{
*/
function dn_to_release_name($dn)
{
- $relevant = preg_replace("/,".normalizePreg(get_ou("faiou")).".*$/","",$dn);
- $parts = array_reverse(split("\,",$relevant));
+ $relevant = preg_replace("/,".preg_quote(get_ou("faiBaseRDN"), '/').".*$/i","",$dn);
+ $parts = array_reverse(explode(",",$relevant));
$str ="";
foreach($parts as $part){
$str .= preg_replace("/^ou=/","",$part)."/";
$str ="";
foreach($parts as $part){
$str .= preg_replace("/^ou=/","",$part)."/";