X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-plugins%2Fsudo%2Fadmin%2Fsudo%2Fclass_divListSudo.inc;h=a47b6f629424b478c16676c93df01b82732ac081;hb=013ec8918aa88efd0a9fa346714a36a60b5913a7;hp=58936de8904f0d5871f9b62233a2ecaac1e24c36;hpb=2b995de12607d97bbbfd3591599f2174ca0295ad;p=gosa.git diff --git a/gosa-plugins/sudo/admin/sudo/class_divListSudo.inc b/gosa-plugins/sudo/admin/sudo/class_divListSudo.inc index 58936de89..a47b6f629 100644 --- a/gosa-plugins/sudo/admin/sudo/class_divListSudo.inc +++ b/gosa-plugins/sudo/admin/sudo/class_divListSudo.inc @@ -20,23 +20,26 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/*! \brief The sudo management class. + This class lists all configured sudo roles. + */ class divListSudo extends MultiSelectWindow { - - /* Current base */ - var $selectedBase = ""; - var $departments = array(); - /* Regex */ - var $Regex = "*"; - var $UserRegex = "*"; + public $Regex = "*"; + public $UserRegex = "*"; /* Subsearch checkbox */ - var $SubSearch = FALSE; + public $SubSearch = FALSE; + protected $parent ; + public $ui ; - var $parent ; - var $ui ; + /*! \brief Initialize this class + @param Object $config The GOsa configuration object. + @param Object $parent The parent class. + */ function divListSudo (&$config, &$parent) { MultiSelectWindow::MultiSelectWindow($config, "sudo", "sudo"); @@ -57,10 +60,16 @@ class divListSudo extends MultiSelectWindow $this->EnableSaveButton (false); /* Dynamic action col, depending on snapshot icons */ - $action_col_size = 80; + $action_col_size = 54; + if($this->parent->snapshotEnabled()){ + $action_col_size += 32; + } + if($this->parent->CopyPasteHandler){ + $action_col_size += 20; + } /* Toggle all selected / deselected */ - $chk = ""; /* set Page header */ @@ -74,43 +83,55 @@ class divListSudo extends MultiSelectWindow $this->AddRegex ("Regex" , _("Regular expression for matching role names") , "*" , true); $this->AddRegex ("UserRegex", _("Regular expression for matching role member names"), - "*" , FALSE,"images/search_user.png"); + "*" , FALSE,"images/lists/search-user.png"); } + /*! \brief Generate the list header. + */ function GenHeader() { /* Prepare departments, which are shown in the listbox on top of the listbox */ $base = sudo::get_sudoers_ou($this->config); - $acl = $this->ui->get_category_permissions($base,"sudo"); + $acl = $this->ui->get_permissions($base,"sudo/sudo"); + $acl_all= $this->ui->get_category_permissions($base,"sudo"); /* Add default header */ - $listhead = MultiSelectWindow::get_default_header(); + $listhead = MultiSelectWindow::get_default_header(false); /* Create Layers menu */ $s = ".|"._("Actions")."|\n"; - $s .= "..|". + $s .= "..|". " "._("Create")."|\n"; /* Append create options */ if(preg_match("/c/",$acl)) { - $s.= "...| "._("Role")."|new_role|\n"; + $s.= "...| "._("Role")."|new_role|\n"; + $s.= "...| "._("Default")."|new_default|\n"; } /* Append multiple remove */ - if(preg_match("/d/",$acl)){ + if(preg_match("/r/",$acl)){ $s.= "..|---|\n"; - $s.= "..|". + $s.= "..|". " "._("Remove")."|"."del_role|\n"; } + /* Add Copy & Paste header */ + $s .= $this->parent->get_copypaste_header($this->selectedBase,$this->module); + + /* Add snapshot icons */ + $s .= $this->parent->get_snapshot_header($this->selectedBase,$this->module); + $this->SetDropDownHeaderMenu($s); $this->SetListHeader($listhead); } + /*! \brief Prepare the plguin to list a set of objects + */ function execute() { $this->ClearElementsList(); @@ -118,29 +139,43 @@ class divListSudo extends MultiSelectWindow } + /*! \brief Create a list of all objects that should be displayed + @param Array $list The list of sudo roles, passed from the sudoManagement class. + */ function setEntries($list) { /* Prepare links */ $editlink = "%s"; - $userimg = "Sudo"; + $userimg = "Sudo"; $ui = get_userinfo(); - $action_col_size = 80; + $action_col_size = 54; + if($this->parent->snapshotEnabled()){ + $action_col_size += 32; + } + if($this->parent->CopyPasteHandler){ + $action_col_size += 20; + } // Test Every Entry and generate divlist Array foreach($list as $key => $val){ /* Create action icons - copy & paste icons */ $acl = $ui->get_permissions($val['dn'],"sudo/sudo"); + $acl_all= $this->ui->get_category_permissions($val['dn'],"sudo"); + + /* Add copy & cut functionality */ + $actions = $this->parent->get_copypaste_action($val['dn'],"sudo","sudo",TRUE,FALSE); - /* Add edit icon */ - $actions = ""; $actions.= ""; + src='images/lists/edit.png' alt='".msgPool::editButton()."' name='sudo_edit_%KEY%' title='"._("Edit this entry")."'>"; + + /* Add snapshot icon */ + $actions.= $this->parent->get_snapshot_action($val['dn'],$this->module); if(preg_match("/d/",$acl)){ $actions.= ""; + src='images/lists/trash.png' alt='".msgPool::delButton()."' name='sudo_del_%KEY%' title='"._("Delete this entry")."'>"; } $title = "title='".preg_replace('/ /', ' ', @LDAP::fix($val['dn']))."'"; @@ -152,6 +187,22 @@ class divListSudo extends MultiSelectWindow } $display = $val['cn'][0].$desc; + + /* Highlight defaults entry */ + if(preg_match("/^defaults$/i",$val['cn'][0])){ + $display = "$display"; + } + + /* Cutted objects should be displayed in light grey */ + if($this->parent->CopyPasteHandler){ + foreach($this->parent->CopyPasteHandler->queue as $queue_key => $queue_data){ + if($queue_data['dn'] == $val['dn']) { + $display = "".$display.""; + break; + } + } + } + $field1 = array("string" => "" , "attach" => "style='width:20px;'"); $field2 = array("string" => sprintf($userimg,$val['dn']), @@ -167,16 +218,21 @@ class divListSudo extends MultiSelectWindow /* Create summary string for list footer */ $num = count($list); $num_str = _("Number of listed roles"); - $str = "".$num_str." ".$num." "; $this->set_List_Bottom_Info($str); } + + /*! \brief Save this plugin. In this case nothing will be saved + */ function Save() { MultiSelectWindow :: Save(); } + /*! \brief Save all relevant HTML inputs for this plugin. + */ function save_object() { /* Save automatic created POSTs like regex, checkboxes */