AddCheckBox */
var $parent ;
var $ui ;
function divListSystemService ($config,$parent)
{
MultiSelectWindow::MultiSelectWindow($config,"SystemService", "server");
$this->parent = $parent;
$this->ui = get_userinfo();
$this->EnableJSLeaveMsg(TRUE);
/* Set list strings */
$this->SetTitle(_("Installed services"));
$this->SetSummary(_("Installed services"));
/* Result page will look like a headpage */
$this->SetInformation(_("Add, remove and configure the properties of system services here."));
/* Disable buttonsm */
$this->EnableCloseButton(false);
$this->EnableSaveButton (false);
/* set Page header */
$this->AddHeader(array("string"=>" ","attach"=>"style='width:20px;'"));
$this->AddHeader(array("string"=>_("Name")));
$this->AddHeader(array("string"=>_("Actions"),"attach"=>"style='width:100px;border-right:0px;'"));
$this->HideFilterPart();
}
function GenHeader()
{
/* Prepare departments,
which are shown in the listbox on top of the listbox
*/
$listhead = "
".
" ".
" ".
" ".
" ".
" ".
"
";
$this->SetListHeader($listhead);
}
function execute()
{
$this->ClearElementsList();
$this->GenHeader();
}
function setEntries($list)
{
$tmp = array();
foreach($list as $name => $entry){
$tmp[$name] = $entry['Message'];
}
natcasesort($tmp);
$tmp2 = array();
foreach($tmp as $name => $value){
$tmp2[$name] = $list[$name];
}
$ui = get_userinfo();
foreach($tmp2 as $name => $entry){
switch($entry['Status']){
case '' : $str =" ";break;
case SERVICE_STOPPED : $str =""; break;
case SERVICE_STARTED : $str =""; break;
case SERVICE_RESTARTED : $str =""; break;
default: $str= "";
}
/* Get acls */
$acl = $ui->get_permissions($this->parent->dn,"server/".$name);
if(preg_match("/w/i",$acl) && !preg_match("/r/i",$acl)){
continue;
}
$WasAccount = $this->parent->plugins[$name] -> initially_was_account;
$plug = $_GET['plug'];
$link = "".$entry['Message']."";
$field1 = array("string" => $str ,"attach" => "style='width:20px;'");
$field2 = array("string" => $link);
$actions ="";
if($entry['AllowStart'] && $WasAccount){
$actions .= " ";
}else{
$actions .= " ";
}
if($entry['AllowStart'] && $WasAccount){
$actions .= " ";
}else{
$actions .= " ";
}
if($entry['AllowStart'] && $WasAccount){
$actions .= " ";
}else{
$actions .= " ";
}
/* Check if edit is enabled and allowed for current service */
if($entry['AllowEdit'] && preg_match("/(r|w)/i",$acl)){
$actions .= " ";
}else{
$actions .= " ";
}
/* Check if remove is enabled and allowed for current service */
if($entry['AllowRemove'] && preg_match("/d/i",$acl)){
$actions .= " ";
}else{
$actions .= " ";
}
$field3 = array("string" => $actions ,"attach" => "style='width:100px;border-right:0px;'");
$this->AddElement(array($field1,$field2,$field3));
}
}
function Save()
{
MultiSelectWindow :: Save();
}
function save_object()
{
/* Save automatic created POSTs like regex, checkboxes */
MultiSelectWindow :: save_object();
}
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
?>