summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 48c4720)
raw | patch | inline | side by side (parent: 48c4720)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 28 Aug 2008 12:31:25 +0000 (12:31 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 28 Aug 2008 12:31:25 +0000 (12:31 +0000) |
-Allow edit of opsi products out of the FAI management
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12296 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12296 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/fai/admin/fai/class_divListFai.inc | patch | blob | history | |
gosa-plugins/fai/admin/fai/class_faiManagement.inc | patch | blob | history |
diff --git a/gosa-plugins/fai/admin/fai/class_divListFai.inc b/gosa-plugins/fai/admin/fai/class_divListFai.inc
index d019c57cc3c2aed2c90f88ecdd6ab4ae65b718bf..f31cd2920504a203b812ab400b56c1f727f378a0 100644 (file)
var $parent ;
var $ui ;
+ var $ShowOpsiLocal;
+ var $ShowOpsiNetboot;
+
function divListFai (&$config,$parent)
{
MultiSelectWindow::MultiSelectWindow($config, "Fai", "fai");
$this->AddHeader(array("string" => _("Class type"), "attach" => "style='width:200px;'"));
$this->AddHeader(array("string" => _("Actions"), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'"));
- $this->AddCheckBox("ShowProfiles" , sprintf(_("Display objects of type '%s'."),_("Profile")) ,_("Show profiles") ,true);
- $this->AddCheckBox("ShowTemplates" , sprintf(_("Display objects of type '%s'."),_("Variable")) ,_("Show templates") ,true);
- $this->AddCheckBox("ShowScripts" , sprintf(_("Display objects of type '%s'."),_("Script")) ,_("Show scripts") ,true);
- $this->AddCheckBox("ShowHooks" , sprintf(_("Display objects of type '%s'."),_("Hook")) ,_("Show hooks") ,true);
- $this->AddCheckBox("ShowVariables" , sprintf(_("Display objects of type '%s'."),_("Variable")) ,_("Show variables") ,true);
- $this->AddCheckBox("ShowPackages" , sprintf(_("Display objects of type '%s'."),_("Package")) ,_("Show packages") ,true);
- $this->AddCheckBox("ShowPartitions" , sprintf(_("Display objects of type '%s'."),_("Partition")),_("Show partitions") ,true);
+ $this->AddCheckBox("ShowProfiles" , sprintf(_("Display objects of type '%s'."),
+ _("Profile")) ,_("Show profiles") ,true);
+ $this->AddCheckBox("ShowTemplates" , sprintf(_("Display objects of type '%s'."),
+ _("Variable")) ,_("Show templates") ,true);
+ $this->AddCheckBox("ShowScripts" , sprintf(_("Display objects of type '%s'."),
+ _("Script")) ,_("Show scripts") ,true);
+ $this->AddCheckBox("ShowHooks" , sprintf(_("Display objects of type '%s'."),
+ _("Hook")) ,_("Show hooks") ,true);
+ $this->AddCheckBox("ShowVariables" , sprintf(_("Display objects of type '%s'."),
+ _("Variable")) ,_("Show variables") ,true);
+ $this->AddCheckBox("ShowPackages" , sprintf(_("Display objects of type '%s'."),
+ _("Package")) ,_("Show packages") ,true);
+ $this->AddCheckBox("ShowPartitions" , sprintf(_("Display objects of type '%s'."),
+ _("Partition")),_("Show partitions") ,true);
+
+ /* Add opsi checkboxes if opsi is enabled
+ */
+ if($this->parent->opsi instanceof opsi && $this->parent->opsi->enabled()){
+ $this->AddCheckBox("ShowOpsiNetboot" , sprintf(_("Display objects of type '%s'."),
+ _("Opsi netboot product")),_("Show opsi netboot pruducts") ,true);
+ $this->AddCheckBox("ShowOpsiLocal" , sprintf(_("Display objects of type '%s'."),
+ _("Opsi local product")),_("Show opsi locale pruducts") ,true);
+ }
/* Add SubSearch checkbox */
//$this->AddCheckBox(SEPERATOR);
/* Append create icons for each fai component */
$arr = array(
- array("plugins/fai/images/fai_new_partitionTable.png" , _("Partition table") ,"Create_partition" , _("PT") , "faiPartitionTable"),
- array("plugins/fai/images/fai_new_script.png" , _("Scripts") ,"Create_script" , _("S") , "faiScript"),
- array("plugins/fai/images/fai_new_hook.png" , _("Hooks") ,"Create_hook" , _("H") , "faiHook"),
- array("plugins/fai/images/fai_new_variable.png" , _("Variables") ,"Create_variable" , _("V") , "faiVariable"),
- array("plugins/fai/images/fai_new_template.png" , _("Templates ") ,"Create_template" , _("I") , "faiTemplate"),
- array("plugins/fai/images/fai_new_packages.png" , _("Package list") ,"Create_package" , _("PK") , "faiPackage"));
+ array("plugins/fai/images/fai_new_partitionTable.png" , _("Partition table") ,
+ "Create_partition" , _("PT") , "faiPartitionTable"),
+ array("plugins/fai/images/fai_new_script.png" , _("Scripts") ,
+ "Create_script" , _("S") , "faiScript"),
+ array("plugins/fai/images/fai_new_hook.png" , _("Hooks") ,
+ "Create_hook" , _("H") , "faiHook"),
+ array("plugins/fai/images/fai_new_variable.png" , _("Variables") ,
+ "Create_variable" , _("V") , "faiVariable"),
+ array("plugins/fai/images/fai_new_template.png" , _("Templates ") ,
+ "Create_template" , _("I") , "faiTemplate"),
+ array("plugins/fai/images/fai_new_packages.png" , _("Package list") ,
+ "Create_package" , _("PK") , "faiPackage"));
foreach($arr as $ar){
$acl = $ui->get_permissions($this->parent->fai_base,"fai/".$ar[4]);
Variable init
********************/
- $objects = array(
- "FAIpartitionTable" => array("IMG"=> "plugins/fai/images/fai_partitionTable.png", "NAME"=>_("Partition table"),"KZL"=> "PT", "VAR"=>"ShowPartitions"),
- "FAIpackageList" => array("IMG"=> "plugins/fai/images/fai_packages.png", "NAME"=>_("Package list") , "KZL"=> "PL", "VAR"=>"ShowPackages"),
- "FAIscript" => array("IMG"=> "plugins/fai/images/fai_script.png", "NAME"=>_("Scripts") , "KZL"=> "S", "VAR"=>"ShowScripts"),
- "FAIvariable" => array("IMG"=> "plugins/fai/images/fai_variable.png", "NAME"=>_("Variables") , "KZL"=> "V", "VAR"=>"ShowVariables"),
- "FAIhook" => array("IMG"=> "plugins/fai/images/fai_hook.png", "NAME"=>_("Hooks"), "KZL"=> "H", "VAR"=>"ShowHooks"),
- "FAIprofile" => array("IMG"=> "plugins/fai/images/fai_profile.png", "NAME"=>_("Profile") , "KZL"=> "P", "VAR"=>"ShowProfiles"),
- "FAItemplate" => array("IMG"=> "plugins/fai/images/fai_template.png", "NAME"=>_("Templates") , "KZL"=> "T", "VAR"=>"ShowTemplates"));
+ $objects = array(
+ "FAIpartitionTable" => array("IMG"=> "plugins/fai/images/fai_partitionTable.png",
+ "NAME"=>_("Partition table"),"KZL"=> "PT", "VAR"=>"ShowPartitions"),
+ "FAIpackageList" => array("IMG"=> "plugins/fai/images/fai_packages.png",
+ "NAME"=>_("Package list") , "KZL"=> "PL", "VAR"=>"ShowPackages"),
+ "FAIscript" => array("IMG"=> "plugins/fai/images/fai_script.png",
+ "NAME"=>_("Scripts") , "KZL"=> "S", "VAR"=>"ShowScripts"),
+ "FAIvariable" => array("IMG"=> "plugins/fai/images/fai_variable.png",
+ "NAME"=>_("Variables") , "KZL"=> "V", "VAR"=>"ShowVariables"),
+ "FAIhook" => array("IMG"=> "plugins/fai/images/fai_hook.png",
+ "NAME"=>_("Hooks"), "KZL"=> "H", "VAR"=>"ShowHooks"),
+ "FAIprofile" => array("IMG"=> "plugins/fai/images/fai_profile.png",
+ "NAME"=>_("Profile") , "KZL"=> "P", "VAR"=>"ShowProfiles"),
+ "FAItemplate" => array("IMG"=> "plugins/fai/images/fai_template.png",
+ "NAME"=>_("Templates") , "KZL"=> "T", "VAR"=>"ShowTemplates"),
+ "opsi_netboot" => array("IMG"=> "plugins/opsi/images/netboot_package.png",
+ "NAME"=>_("Opsi netboot package") , "KZL"=> "ON", "VAR"=>"ShowOpsiNetboot"),
+ "opsi_local" => array("IMG"=> "plugins/opsi/images/local_package.png",
+ "NAME"=>_("Opsi local package") , "KZL"=> "OL", "VAR"=>"ShowOpsiLocal"));
/* Dynamic action col, depending on snapshot icons */
$action ="";
$acl_all = $ui->has_complete_category_acls($this->parent->fai_base,$this->module);
- /* Add copy & cut functionality */
- $action.= $this->parent->get_copypaste_action($value['dn'],"fai",$value['class'],TRUE,FALSE);
-
- if(preg_match("/^freeze/", $value['FAIstate'])){
- $editlink ="<a href='?plug=".$_GET['plug']."&edit_freeze_entry=%KEY%' title='%TITLE%'>%NAME%</a>";
+ if(preg_match("/^opsi_/",$type)){
+ $editlink ="<a href='?plug=".$_GET['plug']."&edit_opsi_entry=%KEY%' title='%TITLE%'>%NAME%</a>";
$action.= "<input class='center' type='image' src='images/lists/edit.png' alt='"._("edit")."'
- name='entry_freeze_edit_%KEY%' title='"._("Edit class")."'>";
- $action.= "<img src='images/lists/locked.png' alt='F' class='center'>";
+ name='entry_opsi_edit_%KEY%' title='"._("Edit product")."'><img src='images/empty.png' alt=' ' class='center'>";
}else{
- $editlink ="<a href='?plug=".$_GET['plug']."&edit_entry=%KEY%' title='%TITLE%'>%NAME%</a>";
- $action.= "<input class='center' type='image' src='images/lists/edit.png' alt='"._("edit")."'
- name='entry_edit_%KEY%' title='"._("Edit class")."'>";
- if(preg_match("/d/",$value['acl'])){
- $action.= "<input class='center' type='image' src='images/lists/trash.png' alt='"._("delete")."'
- name='entry_delete_%KEY%' title='"._("Delete class")."'>";
+
+ /* Add copy & cut functionality */
+ $action.= $this->parent->get_copypaste_action($value['dn'],"fai",$value['class'],TRUE,FALSE);
+
+ if(preg_match("/^freeze/", $value['FAIstate'])){
+ $editlink ="<a href='?plug=".$_GET['plug']."&edit_freeze_entry=%KEY%' title='%TITLE%'>%NAME%</a>";
+ $action.= "<input class='center' type='image' src='images/lists/edit.png' alt='"._("edit")."'
+ name='entry_freeze_edit_%KEY%' title='"._("Edit class")."'>";
+ $action.= "<img src='images/lists/locked.png' alt='F' class='center'>";
+ }else{
+ $editlink ="<a href='?plug=".$_GET['plug']."&edit_entry=%KEY%' title='%TITLE%'>%NAME%</a>";
+ $action.= "<input class='center' type='image' src='images/lists/edit.png' alt='"._("edit")."'
+ name='entry_edit_%KEY%' title='"._("Edit class")."'>";
+ if(preg_match("/d/",$value['acl'])){
+ $action.= "<input class='center' type='image' src='images/lists/trash.png' alt='"._("delete")."'
+ name='entry_delete_%KEY%' title='"._("Delete class")."'>";
+ }
}
}
$edi = $editlink;
$acti = $action;
+ $display = "<div style='overflow:hidden; height:1em;'>".$display."</div>";
+
/* Create each field */
$field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
"attach" => "style='width:20px;'");
diff --git a/gosa-plugins/fai/admin/fai/class_faiManagement.inc b/gosa-plugins/fai/admin/fai/class_faiManagement.inc
index a80b4b93cd52b9c617ee2eef290e4418371257e5..84a47931cbc5c852629ed56e7e12679b4e3e8bbd 100644 (file)
var $acl_module = array("fai");
+ var $opsi = NULL;
+
/* construction/reconstruction
*/
function faiManagement (&$config, $ui)
$this->dn = "";
$this->config = $config;
$this->ui = $ui;
+
+ /* Check if the opsi plugin is installed.
+ */
+ if(class_available("opsi")){
+ $this->opsi = new opsi($this->config);;
+ }
/* Creat dialog object */
$this->DivListFai = new divListFai($this->config,$this);
"/^copy/" => "copy",
"/^remove_multiple_fai_objects/" => "del_multiple");
+ print_a($_POST);
+
foreach($_POST as $name => $value){
foreach($posts as $reg => $act ){
if(preg_match($reg,$name)){
$s_action = $act;
$s_entry = ltrim(preg_replace($reg,"",$name),"_");
$s_entry = preg_replace("/_.*$/","",$s_entry);
+ break;
}
}
if(preg_match("/^entry_edit_.*/",$name)){
$s_entry = preg_replace("/^entry_edit_/","",$name);
$s_entry = preg_replace("/_.*$/","",$s_entry);
- $s_action = "edit";
- }elseif(preg_match("/^entry_freeze_edit_.*/",$name)){
- $s_entry = preg_replace("/^entry_freeze_edit_/","",$name);
- $s_entry = preg_replace("/_.*$/","",$s_entry);
- $s_action = "edit";
+ $s_action = "edit";
+ break;
+ }elseif(preg_match("/^entry_freeze_edit_.*/",$name)){
+ $s_entry = preg_replace("/^entry_freeze_edit_/","",$name);
+ $s_entry = preg_replace("/_.*$/","",$s_entry);
+ $s_action = "edit";
$no_save = TRUE;
- }elseif(preg_match("/^entry_delete_.*/",$name)){
- $s_entry = preg_replace("/^entry_delete_/","",$name);
- $s_entry = preg_replace("/_.*$/","",$s_entry);
+ break;
+ }elseif(preg_match("/^entry_delete_.*/",$name)){
+ $s_entry = preg_replace("/^entry_delete_/","",$name);
+ $s_entry = preg_replace("/_.*$/","",$s_entry);
$s_action = "delete";
+ break;
+ }
+
+ /* Get posts from opsi onjects
+ */
+ if($this->opsi instanceof opsi && $this->opsi->enabled()){
+ if(preg_match("/^entry_opsi_edit_/",$name)){
+ $s_entry = preg_replace("/^entry_opsi_edit_([0-9]*).*$/","\\1",$name);
+ $s_action = "opsi_edit";
+ break;
+ }
}
}
+ /* Get posts from opsi objects
+ */
+ if($this->opsi instanceof opsi && $this->opsi->enabled() && isset($_GET['edit_opsi_entry'])){
+ $s_entry = $_GET['edit_opsi_entry'];
+ $s_action = "opsi_edit";
+ }
+
if(isset($_GET['edit_entry'])){
$s_entry = $_GET['edit_entry'];
$s_action = "edit";
}
+ /*******************
+ Opsi extension
+ *******************/
+
+ if($this->opsi instanceof opsi && $this->opsi->enabled()){
+ if($s_action == "opsi_edit"){
+ $name = $this->objects[$s_entry]['cn'];
+ $cfg = $this->opsi->get_product_properties($name);
+ $this->dialog = new opsi_product_config($this->config, $name,$cfg);
+ }
+ if($this->dialog instanceof opsi_product_config && isset($_POST['cancel_properties'])){
+ $this->dialog = NULL;
+ }
+ if($this->dialog instanceof opsi_product_config && isset($_POST['save_properties'])){
+ $this->dialog->save_object();
+ $name = $this->dialog->get_product();
+ $cfg = $this->dialog->get_cfg();
+ for($i = 0 ; $i < 10 ; $i ++){
+ $cfg["name$i"] = microtime(1);
+ }
+ $this->opsi->set_product_properties($name,$cfg);
+ $this->dialog = NULL;
+ }
+ if($this->dialog instanceof opsi_product_config){
+ $this->dialog->save_object();
+ return($this->dialog->execute());
+ }
+ }
+
+
/****************
Delete confirme dialog
****************/
}
}
+ /* Append opsi objects, if opsi is available and if we are on the fai_base
+ */
+ if($this->opsi instanceof opsi && $this->opsi->enabled()){
+
+ $err = FALSE;
+ if(!$err && $this->DivListFai->ShowOpsiNetboot){
+ $n_pro = $this->opsi->get_netboot_products();
+ $err |= $this->opsi->is_error();
+ foreach($n_pro as $name => $data){
+ $entry = array("cn" => $name,
+ "description" => $data['DESC'],
+ "type" => "opsi_netboot");
+ $this->objects[$name."_opsi_netboot"] = $entry;
+ }
+ }
+ if(!$err && $this->DivListFai->ShowOpsiLocal){
+ $l_pro = $this->opsi->get_local_products();
+ $err |= $this->opsi->is_error();
+ foreach($l_pro as $name => $data){
+ $entry = array("cn" => $name,
+ "description" => $data['DESC'],
+ "type" => "opsi_local");
+ $this->objects[$name."_opsi_local"] = $entry;
+ }
+ }
+ if($err){
+ msg_dialog::display(_("Error"),msgPool::siError($this->opsi->get_error()),ERROR_DIALOG);
+ }
+ }
+
ksort($this->objects);
reset ($this->objects);