summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f9bad6e)
raw | patch | inline | side by side (parent: f9bad6e)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 19 Apr 2010 12:18:49 +0000 (12:18 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 19 Apr 2010 12:18:49 +0000 (12:18 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@17689 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/fai/admin/fai/class_faiProfileEntry.inc | [deleted file] | patch | blob | history |
gosa-plugins/fai/admin/fai/faiProfileEntry.tpl | [deleted file] | patch | blob | history |
diff --git a/gosa-plugins/fai/admin/fai/class_faiProfileEntry.inc b/gosa-plugins/fai/admin/fai/class_faiProfileEntry.inc
+++ /dev/null
@@ -1,273 +0,0 @@
-<?php
-
-class faiProfileEntry extends plugin
-{
- /* attribute list for save action */
- var $ignore_account= TRUE;
- var $attributes = array();
- var $objectclasses= array();
-
- /* Array with available class names */
- var $FAIAllclasses = array();
- var $ui;
-
- function faiProfileEntry (&$config, $dn= NULL,$used=array(),$base)
- {
- plugin::plugin ($config, $dn);
-
- /* Search only in fai tree */
- $this->ui = get_userinfo();
-
- $filter = "(|(objectClass=FAIscript)(objectClass=FAItemplate)(objectClass=FAIhook)".
- "(objectClass=FAIvariable)(objectClass=FAIpartitionTable)(objectClass=FAIpackageList))";
-
- $FAI_objects = FAI::get_all_objects_for_given_base($base,$filter,true);
-
- /* Create array with categories to be able to sort different types of objects */
- $categories = array("FAIscript" => "faiScript",
- "FAItemplate" => "faiTemplate",
- "FAIhook" => "faiHook",
- "FAIvariable" => "faiVariable",
- "FAIpartitionTable" => "faiPartitionTable",
- "FAIpackageList" => "faiPackage");
-
- /* Read out all objects from fai tree */
- $ldap= $this->config->get_ldap_link();
- $ldap->cd($base);
- $sort=array();
- foreach($FAI_objects as $obj){
-
- $ldap->cat($obj['dn']);
- $attrs = $ldap->fetch();
-
- /* Only use objects which have cn set */
- if((isset($attrs['cn'][0]))&&(!in_array($attrs['cn'][0],$used))){
- foreach($categories as $cat => $acl){
- if(in_array($cat,$attrs['objectClass'])){
-
- $acl = $this->ui->get_permissions($attrs['dn'],"fai/".$acl);
-
- /* Append different types of objects */
- $this->FAIAllclasses[$attrs['cn'][0]]['objects'][$cat]=$cat;
-
- if(!isset($this->FAIAllclasses[$attrs['cn'][0]]['acl'])){
- $this->FAIAllclasses[$attrs['cn'][0]]['acl']="";
- }
- $this->FAIAllclasses[$attrs['cn'][0]]['acl'].=$acl;
-
- /* Set selected status to false */
- $this->FAIAllclasses[$attrs['cn'][0]]['status']=false;
-
- $sort[strtolower($attrs['cn'][0])] = $attrs['cn'][0];
- }
- }
- }
- }
-
-
- $tmp = array();
- ksort($sort);
- foreach($sort as $name){
- $tmp[$name] =$this->FAIAllclasses[$name];
- }
- $this->FAIAllclasses = array();
- $this->FAIAllclasses = $tmp;
-
- /* If no search filter is set, create one */
- if (!session::is_set("SUBfaifilter")){
- $SUBfaifilter= array("base" => get_ou('faiBaseRDN').session::get('CurrentMainBase'), "Sregex" => "*");
- $SUBfaifilter['SShowTemplates'] = true;
- $SUBfaifilter['SShowScripts'] = true;
- $SUBfaifilter['SShowHooks'] = true;
- $SUBfaifilter['SShowVariables'] = true;
- $SUBfaifilter['SShowPackages'] = true;
- $SUBfaifilter['SShowPartitions']= true;
- session::set("SUBfaifilter", $SUBfaifilter);
- }
- }
-
- function execute()
- {
- /* Call parent execute */
- plugin::execute();
-
- /* Fill templating stuff */
- $smarty = get_smarty();
- $display = "";
-
- $SUBfaifilter = session::get('SUBfaifilter');
-
- /* Get alphabet selection */
- if(isset($_GET['search'])){
- $SUBfaifilter['Sregex'] = strtolower($_GET['search'])."*";
- }
-
- /* If someone used the apply button, update searchfilter */
- if(isset($_POST['Sregex'])){
- foreach($SUBfaifilter as $key => $val){
- if(!isset($_POST[$key])){
- $SUBfaifilter[$key] = false;
- }else{
- $SUBfaifilter[$key] =$_POST[$key];
- }
- }
- $SUBfaifilter['Sregex']= $_POST['Sregex'];
- if(!strstr($SUBfaifilter['Sregex'],"*")){
- $SUBfaifilter['Sregex'] = $SUBfaifilter['Sregex']."*";
- }
- }
-
- /* Save current searchfilter in session*/
- session::set('SUBfaifilter',$SUBfaifilter);
-
- /* Check if we used a checkboxe from the list, to select dselect an entry */
- foreach($_POST as $name => $value){
- foreach($this->FAIAllclasses as $class => $obj){
- $bclass = base64_encode($class);
- if(isset($_POST["ON_PAGE_".$bclass])){
- if(isset($_POST['USE_'.$bclass])){
- $this->FAIAllclasses[$class]['status']=true;
- }else{
- $this->FAIAllclasses[$class]['status']=false;
- }
- }
- }
- }
-
- /* Create different picture for each object type */
- $objTypes['FAIhook'] = "<img src='plugins/fai/images/fai_hook.png' title='"._("Hook bundle")."' alt=''> ";
- $objTypes['FAItemplate'] = "<img src='plugins/fai/images/fai_template.png' title='"._("Template bundle")."' alt=''> ";
- $objTypes['FAIscript'] = "<img src='plugins/fai/images/fai_script.png' title='"._("Script bundle")."' alt=''> ";
- $objTypes['FAIvariable'] = "<img src='plugins/fai/images/fai_variable.png' title='"._("Variable bundle")."' alt=''> ";
- $objTypes['FAIpackageList'] = "<img src='plugins/fai/images/fai_packages.png' title='"._("Package bundle")."' alt=''> ";
- $objTypes['FAIpartitionTable'] = "<img src='plugins/fai/images/fai_partitionTable.png' title='"._("Partition table")."' alt=''> ";
-
- /* Magic quotes GPC, escapes every ' " \, to solve some security risks
- * If we post the escaped strings they will be escaped again
- */
- foreach($this->attributes as $attrs){
- if(get_magic_quotes_gpc()){
- $smarty->assign($attrs,stripslashes($this->$attrs));
- }else{
- $smarty->assign($attrs,($this->$attrs));
- }
- }
-
- /* Assign all filter attributes to smarty */
- foreach($SUBfaifilter as $key => $val){
- if(($key != "base")&&($key != "Sregex")){
- if($val){
- $smarty->assign($key."CHK", " checked ");
- }else{
- $smarty->assign($key."CHK", "");
- }
- }else{
- $smarty->assign($key,$val);
- }
- }
-
- /* Create a divlist to display all available class names with the depending object types */
- $divlist = new divlist("ProfileEntry");
- $divlist->SetPluginMode();
- $divlist->SetSummary(_("This list displays all assigned class names for this profile."));
- $divlist->SetEntriesPerPage(0);
- $divlist->SetHeader(array(array("string"=> _("Class name")),
- array("string"=> _("Objects"),"attach"=>"style='border-right:0px;'")));
-
- /* Action button allows us to delete an entry */
- $action = "<input type='hidden' name='ON_PAGE_%KEY%' value='1'>
- <input type='checkbox' name='USE_%KEY%' value='%KEY%' onClick='document.mainform.submit();' %CHECK%>";
-
- /* Check every single class name to match the current search filter */
- foreach($this->FAIAllclasses as $usedClass => $classes){
-
- /* Skip those entries that we are not allowed to read. */
- if(!preg_match("/r/",$classes['acl'])){
- continue;
- }
-
- $fi = str_replace("*",".*",$SUBfaifilter['Sregex']);
-
- $abort = true;
- if(!preg_match("/^".$fi."/i",$usedClass)){
- $abort = false;
- continue;
- }
- if((isset($classes['objects']['FAIscript']))&&($SUBfaifilter['SShowScripts'])){
- $abort = false;
- }
- if((isset($classes['objects']['FAItemplate']))&&($SUBfaifilter['SShowTemplates'])){
- $abort = false;
- }
- if((isset($classes['objects']['FAIhook']))&&($SUBfaifilter['SShowHooks'])){
- $abort = false;
- }
- if((isset($classes['objects']['FAIvariable']))&&($SUBfaifilter['SShowVariables'])){
- $abort = false;
- }
- if((isset($classes['objects']['FAIpartitionTable']))&&($SUBfaifilter['SShowPartitions'])){
- $abort = false;
- }
- if((isset($classes['objects']['FAIpackageList']))&&($SUBfaifilter['SShowPackages'])){
- $abort = false;
- }
-
- if(!$abort){
- $str = "";
- foreach($classes['objects'] as $class => $obj){
- $str.= $objTypes[$obj];
- }
-
- /* Is this entry selected */
- if($classes['status']==true){
- $action_check = preg_replace("/%CHECK%/"," checked ",$action);
- }else{
- $action_check = preg_replace("/%CHECK%/","",$action);
- }
-
- /* Append to list */
- $field1 = array("string"=> str_replace("%KEY%",base64_encode($usedClass),$action_check).$usedClass,"attach"=>"");
- $field2 = array("string"=> $str,"attach"=>"style='border-right:0px;'");
- $divlist->AddEntry(array($field1,$field2));
- }
- }
-
- $smarty->assign("faihead" , "");
- $smarty->assign("failist" , $divlist->DrawList());
- $smarty->assign("infoimage" , get_template_path('images/info_small.png'));
- $smarty->assign("launchimage" , get_template_path('images/lists/action.png'));
- $smarty->assign("alphabet" , generate_alphabet());
- $smarty->assign("apply" , apply_filter(TRUE));
- $smarty->assign("search_image" , get_template_path('images/lists/search.png'));
-
- $display.= $smarty->fetch(get_template_path('faiProfileEntry.tpl', TRUE));
- return($display);
- }
-
- /* Save data to object */
- function save_object()
- {
- }
-
- /* Check supplied data */
- function check()
- {
- /* Call common method to give check the hook */
- $message= plugin::check();
-
- return ($message);
- }
-
- function save()
- {
- $tmp = array();
- foreach($this->FAIAllclasses as $class => $obj){
- if($obj['status']==true){
- $tmp[$class]=$class;
- }
- }
- return($tmp);
- }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-plugins/fai/admin/fai/faiProfileEntry.tpl b/gosa-plugins/fai/admin/fai/faiProfileEntry.tpl
+++ /dev/null
@@ -1,94 +0,0 @@
-
-<table style='width:100%; ' summary="{t}FAI profile entry{/t}">
- <tr>
- <td style='width:600px'>
- <div class="contentboxh" style="height:20px">
- <p class="contentboxh" style="font-size:12px">{t}List of FAI objects (Fully Automatic Installation){/t}
- </p>
- </div>
- <div class="contentboxb">
- {$faihead}
- </div>
- <div style='height:4px;'>
- </div>
- <div class="contentboxb" style="border-top:1px solid #B0B0B0;">
- {$failist}
- <input type=hidden name="edit_helper">
- </div>
- </td>
- <td>
- <div class="contentboxh" style="height:20px;border-bottom:1px solid #B0B0B0">
- <p class="contentboxh" style="font-size:12px">
- {image path="
- {$infoimage}" align="right"}{t}Information{/t}
- </p>
- </div>
- <div class="contentboxb">
- <p class="contentboxb" style="border-color:#f0f0f0;">{t}This menu allows you to select FAI class names and to add them to the currently edited profile.{/t}
- </p>
- </div>
- <br>
- <div class="contentboxh" style="height:20px">
- <p class="contentboxh" style="font-size:12px">
- {image path="
- {$launchimage}" align="right"}{t}Filters{/t}
- </p>
- </div>
- <div class="contentboxb">
- <table style='width:100%;' summary="{t}Filter options{/t}">
- {$alphabet}
- </table>
- <table style='width:100%;' summary="{t}Filter options{/t}">
- <tr>
- <td>
- <input onClick='document.mainform.submit()' type="checkbox" name="SShowTemplates" {$SShowTemplatesCHK}>{t}Show only classes with templates{/t}
- </td>
- </tr>
- <tr>
- <td>
- <input onClick='document.mainform.submit()' type="checkbox" name="SShowScripts" {$SShowScriptsCHK}>{t}Show only classes with scripts{/t}
- </td>
- </tr>
- <tr>
- <td>
- <input onClick='document.mainform.submit()' type="checkbox" name="SShowHooks" {$SShowHooksCHK}>{t}Show only classes with hooks{/t}
- </td>
- </tr>
- <tr>
- <td>
- <input onClick='document.mainform.submit()' type="checkbox" name="SShowVariables" {$SShowVariablesCHK}>{t}Show only classes with variables{/t}
- </td>
- </tr>
- <tr>
- <td>
- <input onClick='document.mainform.submit()' type="checkbox" name="SShowPackages" {$SShowPackagesCHK}>{t}Show only classes with packages{/t}
- </td>
- </tr>
- <tr>
- <td>
- <input onClick='document.mainform.submit()' type="checkbox" name="SShowPartitions" {$SShowPartitionsCHK}>{t}Show only classes with partitions{/t}
- </td>
- </tr>
- </table>
- <table style='width:100%;' summary="{t}Filter options{/t}">
- <tr>
- <td>
- {image path="
- {$search_image}"}align=middle title='{t}Display objects matching{/t}'>
- </td>
- <td width="99%">
- <input type='text' name='Sregex' maxlength='20' style='width:99%' value='{$Sregex}' id='filter' title='{t}Regular expression for matching object names{/t}' >
- </td>
- </tr>
- </table>
- {$apply}
- </div>
- </td>
- </tr>
-</table>
-<div align="right" style="align:right;">
- <button type='submit' name='SaveSubObject'>
- {msgPool type=applyButton}</button>
- <button type='submit' name='CancelSubObject'>
- {msgPool type=cancelButton}</button>
-</div><!-- Place cursor -->
\ No newline at end of file