summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1a2cd81)
raw | patch | inline | side by side (parent: 1a2cd81)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 22 Sep 2009 11:01:21 +0000 (11:01 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 22 Sep 2009 11:01:21 +0000 (11:01 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14307 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/gosa-plugins/opsi/admin/opsiLicenses/class_divListLicenses.inc b/gosa-plugins/opsi/admin/opsiLicenses/class_divListLicenses.inc
index 89c88462ae4d5ae66eeb25d877e800a925527a5c..67657a641a39e8fe8af454595e65573f812ed9f7 100644 (file)
* This code is part of GOsa (http://www.gosa-project.org)
* Copyright (C) 2003-2008 GONICUS GmbH
*
- * ID: $$Id: class_divListRole.inc 12852 2008-10-31 16:19:40Z cajus $$
+ * ID: $$Id: class_divListLicense.inc 12852 2008-10-31 16:19:40Z cajus $$
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-class divListRole extends MultiSelectWindow
+class divListLicense extends MultiSelectWindow
{
// Current base
var $parent ;
var $ui ;
- function divListRole (&$config,$parent)
+ function divListLicense (&$config,$parent)
{
MultiSelectWindow::MultiSelectWindow($config, "Licenses", "licenses");
// Set Page col headers
$this->AddHeader(array("string" => $chk,"attach"=>"style='width:20px;'"));
$this->AddHeader(array("string" => " ", "attach" => "style='text-align:center;width:20px;'"));
- $this->AddHeader(array("string" => _("Role")." / "._("Department"), "attach" => "style=''"));
+ $this->AddHeader(array("string" => _("License")." / "._("Department"), "attach" => "style=''"));
$this->AddHeader(array("string" => _("Actions"),
"attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'"));
/* Add default header */
$listhead = MultiSelectWindow::get_default_header();
- /* Add department selector */
- $listhead .= _("Base")." <select name='CurrentMainBase'
- onChange='mainform.submit()' class='center'>$options</select>".
- " <input class='center' type='image' src='images/lists/submit.png' align='middle'
- title='"._("Submit department")."' name='submit_department' alt='"._("Submit")."'> ";
-
/* Create Layers menu */
$s = ".|"._("Actions")."|\n";
$s .= "..|<img src='images/lists/new.png' alt='' border='0' class='center'>".
" "._("Create")."|\n";
$s.= "...|<input class='center' type='image' src='plugins/licensemanagement/images/new.png' alt=''>".
- " "._("Role")."|license_new|\n";
+ " "._("License")."|license_new|\n";
}
/* Multiple options */
$s.= "..|<img src='images/lists/trash.png' alt='' border='0' class='center'>".
" "._("Remove")."|"."remove_multiple_licenses|\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);
}
foreach($list as $key => $val){
// Get object permissions
- $acl = $ui->get_permissions($val['dn'],"licenses/licenseGeneric");
- $acl_all= $ui->has_complete_category_acls($val['dn'],"licenses");
-
+ $acl = $ui->get_permissions($val['dn'],"opsi/licenseGeneric");
+ $acl_all= $ui->has_complete_category_acls($val['dn'],"opsi");
- // Add copy & cut functionality */
- $actions = $this->parent->get_copypaste_action($val['dn'],"ogroups","ogroup");
-
// Create edit and remove icon buttons
$actions.= "<input class='center' type='image'
src='images/lists/edit.png' alt='"._("edit")."'
name='license_edit_%KEY%' title='"._("Edit this entry")."'>";
-
- $actions.= $this->parent->get_snapshot_action($val['dn'],$this->module);
if(preg_match("/d/",$acl)){
$actions.= "<input class='center' type='image'
src='images/lists/trash.png' alt='"._("delete")."'
$desc = " - [ ".$val['description'][0]." ]";
}
- // Cutted entry are displayed in a light grey as indication.
- $display = $val['cn'][0].$desc;
- if($this->parent->CopyPasteHandler){
- foreach($this->parent->CopyPasteHandler->queue as $queue_key => $queue_data){
- if($queue_data['dn'] == $val['dn']) {
- $display = "<font color='#999999'>".$display."</font>";
- break;
- }
- }
- }
-
// Append the entry to the divlist
$field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."'
name='item_selected_".$key."'>" ,
"attach" => "style='width:20px;'");
$field1 = array("string" => "<img src='plugins/licensemanagement/images/license.png'
- alt='"._("Role")."' ".$title.">",
+ alt='"._("License")."' ".$title.">",
"attach" => "style='text-align:center;width: 20px;'");
$field2 = array("string" => sprintf($editlink,$key,$display),
"attach" => "style='' ".$title);
$this->AddElement(array($field0,$field1,$field2,$field4));
}
-
// Create the list summary
$num_deps=0;
if(!$this->SubSearch){
}
$num_objs = count($list);
$num_obj_str = _("Number of listed licenses");
- $num_dep_str = _("Number of listed departments");
$str = "<img class='center' src='plugins/licensemanagement/images/license.png'
title='".$num_obj_str."' alt='".$num_obj_str."'> ".$num_objs." ";
- $str.= "<img class='center' src='images/lists/folder.png'
- title='".$num_dep_str."' alt='".$num_dep_str."'> ".$num_deps." ";
$this->set_List_Bottom_Info($str);
}
}
diff --git a/gosa-plugins/opsi/admin/opsiLicenses/class_licenceGeneric.inc b/gosa-plugins/opsi/admin/opsiLicenses/class_licenceGeneric.inc
index e0b0857ea1bea5497b6eb9c9b9fda858478f49c5..41ced8d7645611eaab2cc580e7c12be5719567cf 100644 (file)
var $orig_base = "";
// The object classes written by this plugin
- var $objectclasses = array("top","organizationalRole");
+ var $objectclasses = array("top","organizationalLicense");
// The list of occupants ([dn])
var $licenseOccupant = array();
// Check if this name is uniq for licenses.
$ldap= $this->config->get_ldap_link();
$ldap->cd($this->config->current['BASE']);
- $ldap->search("(&(objectClass=organizationalRole)(cn=$this->cn))", array("cn"));
+ $ldap->search("(&(objectClass=organizationalLicense)(cn=$this->cn))", array("cn"));
$ldap->fetch();
if ($ldap->count() != 0 && ( $this->dn == 'new' || $this->cn != $this->orig_cn)){
$message[]= msgPool::duplicated(_("Name"));
{
return (array(
"plShortName" => _("Generic"),
- "plDescription" => _("Role generic"),
+ "plDescription" => _("License generic"),
"plSelfModify" => FALSE,
"plDepends" => array(),
"plPriority" => 1,
"plSection" => array("administration"),
"plCategory" => array("licenses" => array("description" => _("Licenses"),
- "objectClass" => "organizationalRole")),
+ "objectClass" => "organizationalLicense")),
"plProvidedAcls"=> array(
"cn" => _("Name"),
"description" => _("Description"),
diff --git a/gosa-plugins/opsi/admin/opsiLicenses/class_opsiLicenses.inc b/gosa-plugins/opsi/admin/opsiLicenses/class_opsiLicenses.inc
index 9c64ea68f9e5473aab68e32d5b5e528e92dac5e7..9112b1e3fbc7c7b7e405ef4a512fb6ea90fecbf9 100644 (file)
var $plHeadline= "Opsi";
var $plDescription= "Opsi licenses";
- // Copy and paste handler
- var $CopyPasteHandler = NULL;
-
// The headpage list handler.
var $DivListLicenses = NULL;
var $dns = array();
// Permission modules to use.
- var $acl_module = array("licenses");
-
- // Internal: Is truw while objects are pasted.
- var $start_pasting_copied_objects = FALSE;
+ var $acl_module = array("opsi");
-
// Construct and initialize the plugin
function __construct (&$config, $dn= NULL)
{
$this->config= &$config;
$this->ui= get_userinfo();
- // Copy & Paste enabled ?
- if ($this->config->get_cfg_value("copyPaste") == "true"){
- $this->CopyPasteHandler = new CopyPasteHandler($this->config);
- }
-
// Initialize the corresponding list class.
- $this->DivListLicenses = new divListRole($this->config,$this);
+ $this->DivListLicenses = new divListLicense($this->config,$this);
}
plugin::execute();
// Variables to restore after 'entry locked' warning was displayed
- session::set('LOCK_VARS_TO_USE',array('/^copy/','/^cut/','/^license_/','/^act/',
+ session::set('LOCK_VARS_TO_USE',array('/^license_/','/^act/',
'/^id/','/^menu_action/','/^item/'));
$smarty = get_smarty();
$s_action = "";
$s_entry = "";
foreach($_POST as $name => $value){
- if(preg_match("/^cut_/",$name)){
- $s_action = "cut";
- $s_entry = preg_replace("/^cut_([0-9]*)_.*$/","\\1",$name);
- break;
- }
- if(preg_match("/^copy_/",$name)){
- $s_action = "copy";
- $s_entry = preg_replace("/^copy_([0-9]*)_.*$/","\\1",$name);
- break;
- }
if(preg_match("/^license_edit_/",$name)){
$s_action = "edit";
$s_entry = preg_replace("/^license_edit_([0-9]*)_.*$/","\\1",$name);
// Get menu related posts
if(isset($_POST['menu_action'])) {
- if($_POST['menu_action'] == "editPaste"){
- $s_action = "editPaste";
- }elseif($_POST['menu_action'] == "license_new"){
- $s_action = "new";
- }elseif($_POST['menu_action'] == "remove_multiple_licenses"){
+ if($_POST['menu_action'] == "remove_multiple_licenses"){
$s_action = "remove_multiple";
}
}
- /***************
- * Copy & Paste handling
- ***************/
-
- /* Display the copy & paste dialog, if it is currently open */
- $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
- if($ret){
- return($ret);
- }
/***************
$disallowed = array();
foreach($ids as $id){
$dn = $this->licenses[$id]['dn'];
- $acl = $this->ui->get_permissions($dn, "licenses/licenseGeneric");
+ $acl = $this->ui->get_permissions($dn, "opsi/licenseGeneric");
if(preg_match("/d/",$acl)){
$this->dns[$id] = $dn;
}else{
msg_dialog::display(_("Permission"),msgPool::permDelete($disallowed),INFO_DIALOG);
}
-
if(count($this->dns)){
- if ($user= get_multiple_locks($this->dns)){
- return(gen_locked_message($user,$this->dns));
- }
- $dns_names = array();
- foreach($this->dns as $dn){
- $dns_names[] = LDAP::fix($dn);
- }
-
- /* Lock the current entry, so nobody will edit it during deletion */
- add_lock ($this->dns, $this->ui->dn);
-
- $smarty->assign("info", msgPool::deleteInfo($dns_names,_("Role")));
+ $smarty->assign("info", msgPool::deleteInfo($dns_names,_("License")));
$smarty->assign("multiple", true);
return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
}
/* Remove user by user and check acls before removeing them */
foreach($this->dns as $key => $dn){
- $acl = $this->ui->get_permissions($dn, "licenses/licenseGeneric");
+ $acl = $this->ui->get_permissions($dn, "opsi/licenseGeneric");
if (preg_match('/d/', $acl)){
/* Delete request is permitted, perform LDAP action */
/* Normally this shouldn't be reached, send some extra
logs to notify the administrator */
msg_dialog::display(_("Permission error"), msgPool::permDelete(), INFO_DIALOG);
- new log("security","licenses/".get_class($this),$dn,array(),"Tried to trick deletion.");
+ new log("security","opsi/".get_class($this),$dn,array(),"Tried to trick deletion.");
}
}
if($s_action == "new" && !$this->dialog instanceOf tabs){
$this->dialog = new licensetabs($this->config, $this->config->data['TABS']['LICENSETABS'], "new");
- $this->dialog->set_acl_base($this->DivListLicenses->selectedBase);
+ $this->dialog->set_acl_base($this->config->current['BASE']);
}
/***************
$entry = $this->licenses[$s_entry];
$this->dn = $entry['dn'];
- /* Check locking, save current plugin in 'back_plugin', so
- the dialog knows where to return. */
- if (($user= get_lock($this->dn)) != ""){
- return(gen_locked_message ($user, $this->dn,TRUE));
- }
-
- /* Lock the current entry, so everyone will get the above dialog */
- add_lock ($this->dn, $this->ui->dn);
-
/* Open the dialog */
$this->dialog = new licensetabs($this->config, $this->config->data['TABS']['LICENSETABS'],
- $entry['dn'], "licenses");
- $this->dialog->set_acl_base($this->dn);
+ $entry['dn'], "opsi");
+ $this->dialog->set_acl_base($this->config->current['BASE']);
set_object_info($this->dn);
}
}
* List handling
***************/
- // Check if there is a snapshot dialog open
- $base = $this->DivListLicenses->selectedBase;
- if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases(),$this)){
- return($str);
- }
-
// Display dialog with group list
$this->DivListLicenses->parent = $this;
$this->DivListLicenses->execute();
-
- // Add departments if subsearch is disabled
- if(!$this->DivListLicenses->SubSearch){
- $this->DivListLicenses->AddDepartments($this->DivListLicenses->selectedBase,3,1);
- }
$this->reload ();
$this->DivListLicenses->setEntries($this->licenses);
return($this->DivListLicenses->Draw());
// Search and fetch all matching license objects.
$this->licenses = array();
- $ldap = $this->config->get_ldap_link();
- $filter= "(&(objectClass=organizationalRole)(cn=$Regex))";
- $attrs = array("cn","description","objectClass");
-
- if($this->DivListLicenses->SubSearch){
- $res= get_sub_list($filter, "licenses",array(), $base, $attrs, GL_SIZELIMIT | GL_SUBSEARCH);
- }else{
- $res= get_sub_list($filter, "licenses",get_ou('licenseRDN'), get_ou('licenseRDN').$base, $attrs, GL_SIZELIMIT );
- }
-
- $tmp = array();
- foreach($res as $attrs){
- $tmp[$attrs['cn'][0].$attrs['dn']] = $attrs;
- }
-
- uksort($tmp, 'strnatcasecmp');
- $this->licenses = array_values($tmp);
}
}
}
-
- /* Return departments, that will be included within snapshot detection
- */
- function get_used_snapshot_bases()
- {
- return(array(get_ou('licenseRDN').$this->DivListLicenses->selectedBase));
- }
-
-
- function copyPasteHandling_from_queue($s_action,$s_entry)
- {
- /* Check if Copy & Paste is disabled */
- if(!is_object($this->CopyPasteHandler)){
- return("");
- }
-
- $ui = get_userinfo();
-
- /* Add a single entry to queue */
- if($s_action == "cut" || $s_action == "copy"){
-
- /* Cleanup object queue */
- $this->CopyPasteHandler->cleanup_queue();
- $dn = $this->licenses[$s_entry]['dn'];
- if($s_action == "copy" && $ui->is_copyable($dn,"licenses","licenseGeneric")){
- $this->CopyPasteHandler->add_to_queue($dn,$s_action,"licensetabs","LICENSETABS","licenses");
- }
- if($s_action == "cut" && $ui->is_cutable($dn,"licenses","licenseGeneric")){
- $this->CopyPasteHandler->add_to_queue($dn,$s_action,"licensetabs","LICENSETABS","licenses");
- }
- }
-
- /* Add entries to queue */
- if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
-
- /* Cleanup object queue */
- $this->CopyPasteHandler->cleanup_queue();
-
- /* Add new entries to CP queue */
- foreach($this->list_get_selected_items() as $id){
- $dn = $this->licenses[$id]['dn'];
-
- if($s_action == "copy_multiple" && $ui->is_copyable($dn,"licenses","licenseGeneric")){
- $this->CopyPasteHandler->add_to_queue($dn,"copy","licensetabs","LICENSETABS","licenses");
- }
- if($s_action == "cut_multiple" && $ui->is_cutable($dn,"licenses","licenseGeneric")){
- $this->CopyPasteHandler->add_to_queue($dn,"cut","licensetabs","LICENSETABS","licenses");
- }
- }
- }
-
- /* Start pasting entries */
- if($s_action == "editPaste"){
- $this->start_pasting_copied_objects = TRUE;
- }
-
- /* Return C&P dialog */
- if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
-
- /* Get dialog */
- $this->CopyPasteHandler->SetVar("base",$this->DivListLicenses->selectedBase);
- $data = $this->CopyPasteHandler->execute();
-
- /* Return dialog data */
- if(!empty($data)){
- return($data);
- }
- }
- /* Automatically disable status for pasting */
- if(!$this->CopyPasteHandler->entries_queued()){
- $this->start_pasting_copied_objects = FALSE;
- }
- return("");
- }
-
function save_object()
{
$this->DivListLicenses->save_object();
- if(is_object($this->CopyPasteHandler)){
- $this->CopyPasteHandler->save_object();
- }
}
}
diff --git a/gosa-plugins/opsi/admin/opsiLicenses/main.inc b/gosa-plugins/opsi/admin/opsiLicenses/main.inc
index 9ace47e5802b7aeb894d2e7bfbe0b5388c7a8793..f139c4fb3a55e4de8e5b2ffe3b4839323c05339b 100644 (file)
"<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/lists/locked.png')."\"> ".
LDAP::fix(get_object_info()));
} else {
- $display= print_header(get_template_path('plugins/licensemanagement/images/plugin.png'), _("Role management"));
+ $display= print_header(get_template_path('plugins/licensemanagement/images/plugin.png'), _("License management"));
}
$display.= $output;