index 43b087e56f4ba6f06b627da01777c3287490ff62..42783ab3662382fb50359698ed31fe324baa4cc3 100644 (file)
$this->Result = array();
$_SESSION['faiSummaryTab']['UniqueID'] = 0;
$tmp = $this->getBranches();
-
+
+
/* Get classes & release name
There are 2 different tabs which use the summary tab
faiProfile / Workstations */
}elseif(isset($this->parent->by_name['workstartup'])){
$this->Classes = $this->parent->by_object['workstartup']->FAIclass;
$this->Release = $this->parent->by_object['workstartup']->FAIrelease;
+
+ /* Append workstation class && LAST */
+ if(isset($this->parent->by_object['workgeneric']->cn)){
+ $this->Classes[] = $this->parent->by_object['workgeneric']->cn;
+ }
+
$tmp = array_flip($tmp);
if(!isset($tmp[$this->Release])) {
$this->Release = "";
}
}
+ $this->Classes[] = "LAST";
+
/* Set all available releases */
$this->Releases = array_flip($this->getBranches());
$this->usedClasses = array();
function save_object()
{
$once = true;
+
+ if(isset($_GET['expand']) && isset($_GET['id'])){
+ if(isset($this->Result[$_GET['id']])){
+ $this->Result[$_GET['id']]['Open'] =true ;
+ }
+ }
+
+ if(isset($_GET['compress']) && isset($_GET['id'])){
+ if(isset($this->Result[$_GET['id']])){
+ unset($this->Result[$_GET['id']]['Open']);
+ }
+ }
+
foreach($_POST as $name => $value ){
/* check for open tag request */
$ret = array("main"=>"/");
$ldap = $this->config->get_ldap_link();
$ldap->cd($this->config->current['BASE']);
- if(!$base){
- $base= "ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase'];
- }
- $ldap->cd($base);
- $ldap->ls("(objectClass=FAIbranch)",$base);
+ $ldap->search("(objectClass=FAIbranch)",array("dn","cn","ou"));
while($attrs = $ldap->fetch()){
if((isset($attrs['ou']))&&($attrs['dn']!=$base)){
- $ret[$attrs['dn']]= $prefix.$attrs['ou'][0];
- $ret = array_merge($ret,$this->getBranches($attrs['dn'],"".$prefix.$attrs['ou'][0]."/"));
+ $name = convert_department_dn(preg_replace("/,ou=fai,.*$/","",$attrs['dn']));
+ $ret[$attrs['dn']] = $name;
+ $ret = array_merge($ret,$this->getBranches($attrs['dn'],$prefix.$attrs['ou'][0]."/"));
}
}
return($ret);
if(isset($_GET['show'])){
$ldap = $this->config->get_ldap_link();
- $ldap->cat(base64_decode($_GET['id']));
+ $ldap->cat(base64_decode($_GET['id']), array('FAIscript', 'FAIhook', 'FAItemplate'));
$attrs = $ldap->fetch();
if($_GET['type'] == "FAIscript"){
$str = $attrs['FAIscript'][0];
function createSummary($data)
{
/* Don't generate any output, if there is no result */
- $str ="<table style='width:100%;background:#F5F5F5;'> ";
+ $str ="<table cellspacing=0 cellpadding=2 style='width:100%;background:#F5F5F5;'> ";
if(!count($this->Result)){
$str.="<tr><td>";
$str.= (_("This object has no FAI classes assigned."));
foreach($data as $key => $entry){
$image = "<img src='".$this->objs[$key]['Image']."' class='center' alt='".$this->objs[$key]['Name']."' border=0>";
-
- $str.="<tr><td>";
if(!isset($entry['Open'])){
- $str .= "<input type='image' class='center' src='images/expand.png' name='open_".$key."'> ";
+ $str .= "<tr><td colspan=2>
+ <a href='?plug=".$_GET['plug']."&expand&id=".$key."'>
+ <img border=0 class='center' src='images/expand.png' alt='"._("Open")."'> ";
$str .= $image." ";
- $str .= "<b>".$this->objs[$key]['Name']."</b>";
+ $str .= "<b>".$this->objs[$key]['Name']."</b></b></td></tr>";
}else{
- $str .= "<input type='image' class='center' src='images/sort_down.png' name='close_".$key."'> ";
+ $str .= "<tr><td colspan=2>
+ <a href='?plug=".$_GET['plug']."&compress&id=".$key."'>
+ <img border=0 class='center' src='images/sort_down.png' alt='"._("Close")."'> ";
$str .= $image." ";
- $str .= "<b>".$this->objs[$key]['Name']."</b>";
+ $str .= "<b>".$this->objs[$key]['Name']."</b></a></td></tr>";
/* Display FAItemplate FAIhook FAIscript entries */
if(in_array($key,array("FAItemplate","FAIhook","FAIscript"))){
+ $nums = array();
+
if($key == "FAIscript"){
- krsort($entry['Entries']);
foreach($entry['Entries'] as $scripts){
- ksort($scripts);
foreach($scripts as $script){
- $script['cn'][0] = "(".$script['FAIpriority'][0].") ".$script['cn'][0];
- $tmp[$script['cn'][0]] = $script;
+
+ if(!isset($nums[$script['cn'][0]])){
+ $nums[$script['cn'][0]]= 0;
+ }
+ $nums[$script['cn'][0]] ++;
+
+ $tmp[$script['FAIpriority'][0].$script['cn'][0].$script['CLASS']] = $script;
}
}
+ krsort($tmp);;
+
+ $entry['Entries'] = $tmp;
+ }else{
+ $tmp = array();
+ foreach($entry['Entries'] as $script){
+ $tmp[$script['cn'][0].$script['CLASS']] = $script;
+ if(!isset($nums[$script['cn'][0]])){
+ $nums[$script['cn'][0]]= 0;
+ }
+ $nums[$script['cn'][0]] ++;
+ }
+ ksort($tmp);
$entry['Entries'] = $tmp;
}
foreach($entry['Entries'] as $cn => $data){
- $str .="<td></tr><tr><td style='padding-left:20px;'>";
- $str .= "<a target='_blank'href='?plug=".$_GET['plug']."&show&type=".$key."&id=".base64_encode($data['dn'])."'>";
- $str .= $image." ".$data['cn'][0];
+
+ if(isset($nums[$data['cn'][0]]) && ($nums[$data['cn'][0]] > 1)){
+ $str .="<tr style='background: #EE3434;'><td style='padding-left:20px;'>";
+ }else{
+ $str .="<tr><td style='padding-left:20px;'>";
+ }
+
+ $str .= "<a target='_blank' href='?plug=".$_GET['plug']."&show&type=".$key."&id=".base64_encode($data['dn'])."'>";
+ $str .= $image." ";
+ if(isset($data['FAIpriority'][0])){
+ $str .= "(".$data['FAIpriority'][0].")";
+ }
+
+ $str .= " ".$data['cn'][0];
if(isset($data['description'][0])){
$str .= " [".$data['description'][0]."]";
}
- $str .="</a>";
+ $str .= "</a>";
+ $str .= "</td><td><i>".$data['CLASS']."</i>";
+ $str .= "</td></tr>";
}
}
/* Create variable entries */
if(in_array($key,array("FAIvariable"))) {
foreach($entry['Entries'] as $cn => $data){
- $str .="<td></tr><tr><td style='padding-left:20px;'>";
+ $str .="<tr><td style='padding-left:20px;'>";
$str .= $image." ".$data['cn'][0];
if(isset($data['description'][0])){
$str .= " [".$data['description'][0]."] ";
}
- $str .=" = '".$data['FAIvariableContent'][0]."'";
+ /* Only display FAIvariableContent if description dosn't contain [*] */
+ if(isset($data['description'][0]) && !preg_match("#\[\*\]#",$data['description'][0])){
+ $str .=" = '".$data['FAIvariableContent'][0]."'";
+ }
+ $str .= "</td><td><i>".$data['CLASS']."</i>";
+ $str .="</td></tr>";
}
}
/* Create packagelist entries */
if(in_array($key,array("FAIpackageList"))) {
ksort($entry['Entries']);
- foreach($entry['Entries'] as $cn => $data){
- $str .="<td></tr><tr><td style='padding-left:20px;'>";
- $str .= $image." ".$data;
+ foreach($entry['Entries'] as $data){
+ $str .="<tr><td style='padding-left:20px;'>";
+ $str .= $image." ".$data['cn'][0];
+ $str .= "</td><td><i>".$data['CLASS']."</i>";
+ $str .= "</td></tr>";;
}
}
/* Create partition table entries */
if(in_array($key,array("FAIpartitionTable"))) {
foreach($entry['Entries'] as $cn => $data){
- $str .="<td></tr><tr><td style='padding-left:20px;'>";
+ $str .= "<tr><td style='padding-left:20px;'>";
$str .= $image." ".$data['name'];
+ $str .= "</td><td><i>".$data['CLASS']."</i>";
+ $str .= "</td></tr>";
ksort($data['partitions']);
- $str .= "<table cellspacing=1 style='background:#FFFFFF;'>
- <tr style='background-color:#BBBBBB;'>
- <td>"._("No.")."</td>
- <td>"._("Name")."</td>
- <td>"._("FS options")."</td>
- <td>"._("Mount options")."</td>
- <td>"._("Size in MB")."</td>
- <td>"._("Mount point")."</td>
- <td>"._("Type")."</td>
+
+ $str .= "<tr><td colspan=2 style='padding-left:20px;'>";
+ $str .= "<table cellspacing=0 cellpadding=2 style='background:#FFFFFF;border:1px solid #B0B0B0'>
+ <tr style='background-color:#DBDBDB;'>
+ <td class='tbhead'>"._("No.")."</td>
+ <td class='tbhead'>"._("Name")."</td>
+ <td class='tbhead'>"._("FS options")."</td>
+ <td class='tbhead'>"._("Mount options")."</td>
+ <td class='tbhead'>"._("Size in MB")."</td>
+ <td class='tbhead'>"._("Mount point")."</td>
+ <td class='tbrhead'>"._("Type")."</td>
</tr>";
$i = 0;
if($i%2 == 1){
$c = " class='rowxp1'";
- $d = " class='list1' style='border:0px;'";
+ $d = " class='list1'";
}else{
$c = " class='rowxp0'";
- $d = " class='list0' style='border:0px;'";
+ $d = " class='list0'";
}
$str.="<tr $c style='height:10px;'>
<td $d>".$part['FAIfsOptions'][0]."</td>
<td $d>".$part['FAIpartitionSize'][0]."</td>
<td $d>".$part['FAImountPoint'][0]."</td>
- <td $d>".$part['FAIpartitionType'][0]."</td>
+ <td $d style='border:none'>".$part['FAIpartitionType'][0]."</td>
</tr>";
}
$str .="</table>";
}
}
}
- $str.="</td></tr>" ;
}
$str .="</table>";
return($str);
$ldap->cd($data['dn']);
$ldap->search("(objectClass=FAIscriptEntry)",array("cn","description","FAIpriority"));
while($attrs = $ldap->fetch()){
- $current[$attrs['FAIpriority'][0]][$attrs['cn'][0]] = $attrs;
+ $attrs['CLASS'] = $data['cn'][0];
+ $current[$attrs['FAIpriority'][0]][] = $attrs;
}
$this->Result['FAIscript']['Entries'] = $current ;
}
/* Create an array which is sortable by priority */
while($attrs = $ldap->fetch()){
+ $attrs['CLASS'] = $data['cn'][0];
+ $disks[$attrs['cn'][0]]= $attrs;
if(isset($attrs['description'][0])){
$disks[$attrs['cn'][0]]['name'] = $attrs['cn'][0]." [".$attrs['description'][0]."]";
}else{
if(!isset($attrs['FAIfsOptions'][0])){
$attrs['FAIfsOptions'][0] = "";
}
+ $attrs['CLASS'] = $data['cn'][0];
$disks[$key]['partitions'][$attrs['cn'][0]] = $attrs;
}
}
$ldap->cd($data['dn']);
$ldap->search("(objectClass=FAItemplateEntry)",array("cn","description"));
while($attrs = $ldap->fetch()){
- $current[$attrs['cn'][0]] = $attrs;
+ $attrs['CLASS'] = $data['cn'][0];
+ $current[] = $attrs;
}
$this->Result['FAItemplate']['Entries'] = $current ;
}
if(isset($data['FAIpackage'])){
unset($data['FAIpackage']['count']);
foreach($data['FAIpackage'] as $pkg){
- $current[$pkg] = $pkg;
+ $attrs['CLASS'] = $data['cn'][0];
+ $attrs['cn'][0] = $pkg;
+ $current[$pkg] = $attrs;
}
}
$this->Result['FAIpackageList']['Entries'] = $current ;
$ldap->cd($data['dn']);
$ldap->search("(objectClass=FAIvariableEntry)",array("cn","description","FAIvariableContent"));
while($attrs = $ldap->fetch()){
- $current[$attrs['cn'][0]] = $attrs;
+ $attrs['CLASS'] = $data['cn'][0];
+ $current[] = $attrs;
}
$this->Result['FAIvariable']['Entries'] = $current ;
}
$ldap->cd($data['dn']);
$ldap->search("(objectClass=FAIhookEntry)",array("cn","description"));
while($attrs = $ldap->fetch()){
+ $attrs['CLASS'] = $data['cn'][0];
$current[$attrs['cn'][0]] = $attrs;
}
$this->Result['FAIhook']['Entries'] = $current ;