diff --git a/plugins/admin/applications/class_divListApplication.inc b/plugins/admin/applications/class_divListApplication.inc
index 4f4b3c79b73a324e9277a4a44159d1fe16ea4388..204a9a7dd66040d46ef2a3bd1a40dd3cf079f097 100755 (executable)
function divListApplication ($config,$parent)
{
- MultiSelectWindow::MultiSelectWindow($config,"Application");
-
+ MultiSelectWindow::MultiSelectWindow($config,"Application", "application");
+
+ $this->selectedRelease = "ou=apps,".$_SESSION['CurrentMainBase'];
+
$this->parent = $parent;
$this->ui = get_userinfo();
$this->EnableSaveButton (false);
/* set Page header */
+ $action_col_size = 70;
+ if($this->parent->snapshotEnabled()){
+ $action_col_size += 38;
+ }
+
$this->AddHeader(array("string" => " ", "attach" => "style='text-align:center;width:20px;'"));
$this->AddHeader(array("string" => _("Application name")." / "._("Department"), "attach" => "style=''"));
- $this->AddHeader(array("string" => _("Actions"), "attach" => "style='width:80px;border-right:0px;text-align:right;'"));
+ $this->AddHeader(array("string" => _("Actions"), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'"));
/* Add SubSearch checkbox */
$this->AddCheckBox("SubSearch", _("Select to search within subtrees"), _("Ignore subtrees"), false);
/* Create listhead, it will be shown on top of the divlist.
* It provides general navigation and object creation
*/
+ $ui = get_userinfo();
+ $acl = $ui->get_permissions("cn=dummy,".$this->selectedBase,"application/application");
$listhead = "<div style='background:#F0F0F9;padding:5px;'>".
" <input class='center' type='image' src='images/list_root.png' align='middle' ".
- "title='"._("Go to root department")."' name='dep_root' alt='"._("Root")."'> ".
+ "title='"._("Go to root department")."' name='dep_root' alt='"._("Root")."'> ".
" <input class='center' type='image' align='middle' src='images/list_back.png' ".
- "title='"._("Go up one department")."' alt='"._("Up")."' name='dep_back'> ".
+ "title='"._("Go up one department")."' alt='"._("Up")."' name='dep_back'> ".
" <input class='center' type='image' align='middle' src='images/list_home.png' ".
- "title='"._("Go to users department")."' alt='"._("Home")."' name='dep_home'> ".
+ "title='"._("Go to users department")."' alt='"._("Home")."' name='dep_home'> ".
" <input class='center' type='image' src='images/list_reload.png' align='middle' ".
- "title='"._("Reload list")."' name='submit_department' alt='"._("Submit")."'> ".
- " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'> ".
- " <input class='center' type='image' align='middle' src='images/list_new_app.png' alt='"._("new").
- "' title='"._("Create new application")."' name='appl_new'> ".
- $Copy_Paste.
+ "title='"._("Reload list")."' name='submit_department' alt='"._("Submit")."'> ".
+ " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'> ";
+ $listhead .= $this->get_snapshot_header($this->selectedBase);
+
+ if(preg_match("/c/",$acl)){
+ $listhead .= " <input class='center' type='image' align='middle' src='images/list_new_app.png' alt='"._("new")."'
+ title='"._("Create new application")."' name='appl_new'> ";
+ }
+
+ $listhead.= $Copy_Paste.
" <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'> ".
_("Base")." <select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
" <input class='center' type='image' src='images/list_submit.png' align='middle'
$applimg = "<img class='center' src='images/select_application.png' alt='A' title='"._("Application")."'>";
$empty = "<img class='center' src='images/empty.png' style='width:16px;height:16px;' alt=''>";
-
- /* Create action icons */
- $actions = "";
- if($this->parent->CopyPasteHandler){
- $actions.= "<input class='center' type='image'
- src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'> ";
- $actions.= "<input class='center' type='image'
- src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'> ";
+ /* set Page header */
+ $action_col_size = 70;
+ if($this->parent->snapshotEnabled()){
+ $action_col_size += 38;
}
- $actions.= "<input class='center' type='image'
- src='images/edit.png' alt='"._("edit")."' name='appl_edit_%KEY%' title='"._("Edit this entry")."'>";
- $actions.= "<input class='center' type='image'
- src='images/edittrash.png' alt='"._("delete")."' name='appl_del_%KEY%' title='"._("Delete this entry")."'>";
-
/********************
Attach objects
********************/
-
+
+ $ui = get_userinfo();
foreach($list as $key => $val){
- $title = "title='dn: ".@LDAP::fix($val['dn'])."'";
+
+ $acl = $ui->get_permissions($val['dn'],"application/application");
+
+ /* Create action icons */
+ $actions= "";
+
+
+ /* Add Copy & Paste icon */
+ if($this->parent->CopyPasteHandler){
+
+ /* Only add cut icon, if we are allowed to move this user */
+ if(preg_match("/m/",$acl)){
+ $actions.= "<input class='center' type='image'
+ src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'> ";
+ }else{
+ $actions.= "<img src='images/empty.png' alt=' '>";
+ }
+
+ /* Copy is allowed everytime */
+ $actions.= "<input class='center' type='image'
+ src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'> ";
+ }
+
+ /* Add edit icon */
+ $actions.= "<input class='center' type='image'
+ src='images/edit.png' alt='"._("edit")."' name='appl_edit_%KEY%' title='"._("Edit this entry")."'>";
+ $actions.= $this->GetSnapShotActions($val['dn']);
+
+ /* If we are allowed to remove the application account, display remove icon */
+ if(preg_match("/d/",$acl)){
+ $actions.= "<input class='center' type='image'
+ src='images/edittrash.png' alt='"._("delete")."' name='appl_del_%KEY%' title='"._("Delete this entry")."'>";
+ }else{
+ $actions.= "<img src='images/empty.png' alt=' '>";
+ }
+
+ $title = "title='".preg_replace('/ /', ' ', @LDAP::fix($val['dn']))."'";
if(!isset($val['description'][0])){
$desc = "";
}
$field1 = array("string" => sprintf($applimg,$val['dn']), "attach" => "style='text-align:center;width:20px;'");
$field2 = array("string" => sprintf($editlink,$key,($val['cn']['0'].$desc)), "attach" => "style='' ".$title);
- $field3 = array("string" => preg_replace("/%KEY%/", $key, $actions), "attach" => "style='width:80px;border-right:0px;text-align:right;'");
+ $field3 = array("string" => preg_replace("/%KEY%/", $key, $actions), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'");
$this->AddElement(array($field1,$field2,$field3));
}
}