diff --git a/trunk/gosa-plugins/goto/admin/systems/goto/class_workstationStartup.inc b/trunk/gosa-plugins/goto/admin/systems/goto/class_workstationStartup.inc
index be9ffcc4704c21c627cde9d00ce98079769513bd..58fc74ed2abb701be2b1b1a58d21a7d72ac0cb6c 100644 (file)
var $gotoLdap_inherit = FALSE;
/* Generic terminal attributes */
- var $bootmode = "G";
var $gotoBootKernel = "default-inherited";
var $gotoKernelParameters = "";
var $gotoLdapServer = "default-inherited";
/* attribute list for save action */
var $attributes = array("gotoLdapServer", "gotoBootKernel", "gotoKernelParameters",
- "FAIclass", "FAIstatus", "gotoShare","FAIdebianMirror", "FAIrelease");
+ "FAIclass", "FAIstate", "FAIstatus", "gotoShare","FAIdebianMirror", "FAIrelease");
var $objectclasses = array("GOhard", "FAIobject");
/* Share */
var $FAIclass = array(); // The currently selected classes
var $FAIrelease = "";
var $FAIdebianMirror = "auto";
+ var $FAIstate = "";
var $si_active = FALSE;
var $si_fai_action_failed = FALSE;
}// END FAI output generation
$smarty->assign("FAIScriptlist",$div->DrawList());
- /* Radio button group */
- if (preg_match("/G/", $this->bootmode)) {
- $smarty->assign("graphicalbootup", "checked");
- } else {
- $smarty->assign("graphicalbootup", "");
- }
- if (preg_match("/T/", $this->bootmode)) {
- $smarty->assign("textbootup", "checked");
- } else {
- $smarty->assign("textbootup", "");
- }
- if (preg_match("/D/", $this->bootmode)) {
- $smarty->assign("debugbootup", "checked");
- } else {
- $smarty->assign("debugbootup", "");
- }
-
/* Show main page */
$smarty->assign("gotoKernelParameters",$this->gotoKernelParameters);
return($smarty->fetch (get_template_path('workstationStartup.tpl', TRUE,dirname(__FILE__))));
function remove_from_parent()
{
+ /* Cancel if there's nothing to do here */
+ if ((!$this->acl_is_removeable())){
+ return;
+ }
+
+ /* Remove and write to LDAP */
+ plugin::remove_from_parent();
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cd($this->dn);
+ $this->cleanup();
+ $this->attrs['gotoModules'] = array();
+ $ldap->modify($this->attrs);
$this->handle_post_events("remove");
new log("remove","workstation/".get_class($this),$this->dn);
}
}else{
$this->gotoLdap_inherit = FALSE;
}
-
- /* Save group radio buttons */
- if ($this->acl_is_writeable("bootmode") && isset($_POST["bootmode"])){
- $this->bootmode= $_POST["bootmode"];
- }
}
}
}
}
- if ($this->gotoKernelParameters == "") {
- /* Add semi automatic values if empty */
- // 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;
- }
- }
-
plugin::save();
unset( $this->attrs['FAIrelease'] );
}
}
- if ($this->attrs['gotoBootKernel'] == "default-inherited"){
+ if ($this->gotoBootKernel == "default-inherited"){
$this->attrs['gotoBootKernel']= array();
}
function PrepareForCopyPaste($source)
{
plugin::PrepareForCopyPaste($source);
+
$source_o = new workstartup ($this->config, $source['dn']);
foreach(array("FAIclass","gotoModules", "gotoAutoFs", "gotoFilesystem",
- "gotoKernelParameters","gotoShares") as $attr){
+ "FAIstate", "FAIrelease", "gotoKernelParameters","gotoShares",
+ "gotoLdapServers", "gotoLdap_inherit") as $attr){
$this->$attr = $source_o->$attr;
}
+ if (isset($source['FAIstate'])) {
+ $this->attrs['FAIstate'] = $source['FAIstate'];
+ }
}
));
}
+ /* Function to find bad classes */
+ function update_bad_classes($release)
+ {
+
+ if(!isset($this->cache['BAD_CLASSES'][$release])) {
+ /* Find "bad" classes */
+ $ui = get_userinfo();
+ $ldap = $this->config->get_ldap_link();
+
+ /* Convert release name to a valid ldap uri component */
+ $release_components = split('/', $release);
+ $release_components = array_reverse($release_components);
+ for($i=0;$i<sizeof($release_components);$i++) {
+ $release_components[$i] = "ou=" . $release_components[$i];
+ }
+ $release_dn_part = join(',', $release_components);
+
+ /* Limit the base to the release in the faiBase */
+ $base = sprintf("%s,%s%s", $release_dn_part, get_ou('faiBaseRDN'), $this->config->current['BASE']);
+
+ /* Build a list of all fai classes, that don't have the unittag of the user
+ * and are not freezed or removed. The classes will be filtered by this
+ * list. Its needed to specify each objectClass (FAIpackageList etc.) because
+ * FAIClass would match sub-objects, too, which would lead to an array that
+ * is much bigger then needed */
+ $filter = sprintf('(&(|(objectClass=FAItemplate)(objectClass=FAIpackageList)(objectClass=FAIprofile)(objectClass=FAIscript)(objectClass=FAIpartitionTable)(objectClass=FAIHook)(objectClass=FAIvariable)(objectClass=FAItemplate))(&(!(gosaUnitTag=%s))(&(!(FAIstate=*removed*))(!(FAIstate=*freeze*)))))', $ui->gosaUnitTag);
+ $ldap->cd($base);
+ $ldap->search(sprintf("$filter", $ui->gosaUnitTag));
+
+ $this->cache['BAD_CLASSES'][$release] = array();
+ while ($entry = $ldap->fetch()) {
+ $classname = $entry['cn'][0];
+ if (!in_array($classname, $this->cache['BAD_CLASSES'][$release])) {
+ array_push($this->cache['BAD_CLASSES'][$release], $classname);
+ }
+ }
+ }
+ }
/* Updates release dns
* and reads all classes for the current release,
return;
}else{
+ $base = $this->config->current['BASE'];
+ $ldap = $this->config->get_ldap_link();
foreach($servers as $server){
- if ($this->attrs['gosaUnitTag'][0] != $server['TAG']) {
+ /* Dont show servers that have a different unittag as the user*/
+ $ui = get_userinfo();
+ if ($ui->gosaUnitTag != $server['TAG']) {
continue;
}
}else{
foreach($classes as $class){
$classname = $class['CLASS'];
- var_dump($class);
+ $this->update_bad_classes($release);
+ if(isset($this->cache['BAD_CLASSES'][$release])){
+ /* Skip classes that are in the array of bad classes */
+ if (in_array($classname, $this->cache['BAD_CLASSES'][$release])) {
+ continue;
+ }
+ }
if (!isset($this->cache['CLASSES'][$release][$classname])) {
$this->cache['CLASSES'][$release][$classname] = array();
}
# everything looks fine if the type in this position
# doesn't exist in that class
for ($i=0; $i<6; $i++) {
- $result[$i] = "<img src='images/empty.png' width='17'>";
+ $result[$i] = "<img src='images/empty.png' width='17'> ";
}
}
foreach($classes[$class_name] as $type) {
$index = $type['index'];
if ($image) {
- $string = "<img src='".$type['img']."' width='17' alt='".$type['desc']."'> ";
+ $string = "<img src='".$type['img']."' width='17' title='".$type['desc']."'> ";
}
else {
$string = $type['Abbr'];
function analyse_fai_object($attr)
{
$result = array();
- $result['desc'] = 'Placeholder';
switch($attr['TYPE']){
case 'FAIpartitionTable':
$result["Type"]= 'FAIpartitionTable';
$result["Abbr"]= 'Pt';
$result["img"]= 'plugins/fai/images/fai_partitionTable.png';
- $result["desc"] = "_('Partition table')";
+ $result["desc"] = _('Partition table');
$result["index"]= 0;
break;
case 'FAIpackageList':
$result["Type"]= 'FAIpackageList';
$result["Abbr"]= 'Pl';
$result["img"] = 'plugins/fai/images/fai_packages.png';
- $result["desc"] = "_('Package list')";
+ $result["desc"] = _('Package list');
$result["index"] = 1;
break;
case 'FAIscript':
$result["Type"]= 'FAIscript';
$result["Abbr"]= 'S';
$result["img"]= 'plugins/fai/images/fai_script.png';
- $result["desc"] = "_('Script')";
+ $result["desc"] = _('Scripts');
$result["index"] = 2;
break;
case 'FAIvariable':
$result["Type"]= 'FAIvariable';
$result["Abbr"]= 'V';
$result["img"]= 'plugins/fai/images/fai_variable.png';
- $result["desc"] = "_('Variables')";
+ $result["desc"] = _('Variables');
$result["index"]= 3;
break;
case 'FAIhook':
$result["Type"]= 'FAIhook';
$result["Abbr"]= 'H';
$result["img"]= 'plugins/fai/images/fai_hook.png';
- $result["desc"] = "_('Hooks')";
+ $result["desc"] = _('Hooks');
$result["index"]= 4;
break;
case 'FAIprofile':
$result["Type"]= 'FAIprofile';
$result["Abbr"]= 'P';
$result["img"]= 'plugins/fai/images/fai_profile.png';
+ $result["desc"]= _('Profile');
$result["index"] = 5;
break;
case 'FAItemplate':
$result["Type"]= 'FAItemplate';
$result["Abbr"]= 'T';
$result["img"] = 'plugins/fai/images/fai_template.png';
+ $result["desc"]= _('Templates');
$result["index"] = 6;
break;
default: trigger_error("Unknown FAI object type!");;