Code

Updated faiPackage lists.
[gosa.git] / gosa-plugins / fai / admin / fai / class_faiPackage.inc
1 <?php
3 class faiPackage extends plugin
4 {
5   /* attribute list for save action */
6   var $ignore_account   = TRUE;
8   /* Attributes for this Object */
9   var $attributes       = array("cn","description","FAIpackage","FAIdebianRelease","FAIdebianSection", "FAIinstallMethod");
11   /* ObjectClasses for this Object*/
12   var $objectclasses    = array("top","FAIclass","FAIpackageList","FAIrepository");
14   /* Class name of the Ldap ObjectClass for the Sub Object */
15   var $subClass         = "";
16   var $subClasses       = array("top","FAIclass","FAIscriptEntry");
18   /* Class name of the php class which allows us to edit a Sub Object */
19   var $subClassName     = "";      
21   /* Attributes to initialise for each subObject */
22   var $subAttributes    = array("cn","description"); 
23   var $sub64coded       = array();
25   var $ConfiguredPackages = array();
27   /* Specific attributes */
28   var $cn               = "";       // The class name for this object
29   var $description      = "";       // The description for this set of partitions
30   var $is_dialog        = false;    // specifies which buttons will be shown to save or abort
31   var $SubObjects       = array();  // All leafobjects of this object
33   var $FAIdebianRelease          = ""; // The selected release
34   var $FAIdebianSection          = array(); // selected section
35   var $FAIinstallMethod          = "aptitude"; // hard coded
37   var $sections         = array();  // All section types
39   var $list             = NULL;
41   var $usedPackages     = array();
42   var $buffer           = NULL; 
43   var $newDialogShown   =false;
45   var $FAIstate         = "";
46   var $view_logged      = FALSE;
47   var $base;
48   var $FAIpackage ;
50   var $FAIinstallMethods  = array( "install", "ninstall", "remove", 
51       "dselect-upgrade", "taskinst", "taskrm",
52       "hold", "clean", "aptitude", "aptitude-r",
53       "pending", "dpkgc" );
56   function faiPackage (&$config, $dn= NULL)
57   {
58     /* Load Attributes */
59     plugin::plugin ($config, $dn);
61     /* If "dn==new" we try to create a new entry
62      * Else we must read all objects from ldap which belong to this entry.
63      * First read SubObjects from ldap ... and then the partition definitions for the SubObjects.
64      */
65     if($dn != "new"){
66       $this->dn =$dn;
68       /* Get FAIstate */
69       if(isset($this->attrs['FAIstate'][0])){
70         $this->FAIstate = $this->attrs['FAIstate'][0];
71       }
73       /* Check if there are already some packages in this list 
74        */
75       $this->usedPackages = array();
76       if(isset($this->attrs['FAIpackage'])){
77         unset($this->attrs['FAIpackage']['count']);
78         foreach($this->attrs['FAIpackage'] as $pkg){
79           $name = preg_replace("/^\-/","",$pkg);
80           $this->usedPackages[$name] = $pkg;
81         }
82         ksort($this->usedPackages);
83       }  
85       /* Fetch all package configurations from ldap 
86        */
87       $PackageFilter = "";
88       foreach($this->usedPackages as $name => $value){
89         $PackageFilter .= "(FAIpackage=".$name.")";
90       }
91       $PackageFilter = "(&(objectClass=FAIdebconfInfo)(|".$PackageFilter."))";
93       /* Search for configuration objects */ 
94       $ldap = $this->config->get_ldap_link();
95       $ldap->cd($this->dn);
96       $ldap->search($PackageFilter,array("FAIvariable","FAIvariableType",
97             "FAIvariableContent","FAIpackage","FAIdebianSection","FAIstate"));
99       /* Walk through configurations and append them to our list of ConfiguredPackages 
100        */
101       while($attr = $ldap->fetch()){
103         /* Skip objects, that are tagged as removed */
104         if(isset($object['FAIstate'][0])){
105           if(preg_match("/removed$/",$attr['FAIstate'][0])){
106             continue;
107           }
108         }
110         $tmp =array(); 
111         $tmp['Name']  = $attr['FAIvariable'][0];
112         $tmp['Type']  = $attr['FAIvariableType'][0];
114         if (isset($attr['FAIvariableContent'][0])){
115           if(!in_array($attr['FAIvariableType'],array("multiselect"))){
116             $tmp['Value'] = $attr['FAIvariableContent'][0];
117           }else{
118             $content = array();        
119             unset($attr['FAIvariableContent']['count']);
120             foreach($attr['FAIvariableContent'] as $attr){
121               $tmp['Value'][] = $attr;
122             }
123           }
124           $this->ConfiguredPackages[$attr['FAIpackage'][0]][$attr['FAIvariable'][0]]=$tmp;
125         }
126       }
128       $this->FAIdebianSection = array();
129       if(isset($this->attrs['FAIdebianSection'])){
130         for($i = 0 ; $i < $this->attrs['FAIdebianSection']['count'] ; $i++ ){ 
131           $sec = $this->attrs['FAIdebianSection'][$i];
132           $this->FAIdebianSection[$sec]=$sec;
133         }
134       }
135       $this->FAIpackage = array();
137     } // ENDE  dn != new  
139     $methods = array();
140     foreach($this->FAIinstallMethods as $method){
141       $methods[$method] = $method;
142     }
143     $this->FAIinstallMethods = $methods;
145     /* Check if we exist already - no need to ask for revisions, etc. then */
146     if ($this->dn != "new"){
147       $this->newDialogShown= true;
148     }
149     $this->is_new = FALSE;
150     if($this->dn == "new"){
151       $this->is_new =TRUE;
152     }
154     /* Generate package list */
155     $this->list= $this->genPkgs(TRUE);
156   }
159   function execute()
160   {
161     /* Call parent execute */
162     plugin::execute();
164     if($this->is_account && !$this->view_logged){
165       $this->view_logged = TRUE;
166       new log("view","fai/".get_class($this),$this->dn);
167     }
169     /* Fill templating stuff */
170     $smarty= get_smarty();
171     $display= "";
173     /******
174      * Initialize a new Package List with release and section name
175      ******/
176     
177     if(!$this->is_account){
179       /* Assemble release name */
180       $release = $this->parent->parent->fai_release;
181       $tmp= preg_replace('/[,]*'.normalizePreg(get_ou('faiou')).'.*$/', '', $release);
182       $tmp= preg_replace('/ou=/', '', $tmp);
183       $rev= array_reverse(split(',', $tmp));
184       $this->FAIdebianRelease= "/";
185       foreach ($rev as $part){
186         $this->FAIdebianRelease.= "/$part";
187       }
188       $this->FAIdebianRelease= preg_replace('#^[/]*#', '', $this->FAIdebianRelease);
190       /* Assemble sections */
191       $repos= $this->getServerInfos();
192       if(isset($repos[$this->FAIdebianRelease])){
193         $this->FAIdebianSection= $repos[$this->FAIdebianRelease];
194         $this->FAIdebianSection= array_unique($this->FAIdebianSection);
195       }
197       /* Assign Repository settings*/ 
198       $this->is_account     = true;
199     }
200   
202     /******
203      * Add 
204      ******/
206     /* + was pressed to open the package dialog */
207     if(isset($_POST['Addpkg']) && $this->acl_is_writeable("FAIpackage")){
208       $this->dialog = new faiPackageEntry($this->config, $this->FAIdebianRelease,$this->usedPackages);
209       $this->is_dialog =true;
210     }
212     /* Check image Posts 
213      */
214     foreach($_POST as $name => $value){
216       /******
217        * Mark as removed  
218        ******/
219       
220       if(!preg_match('/^freeze/', $this->FAIstate) && preg_match("/^removal_package_/",$name)){
221         $id = @base64_decode(preg_replace("/^removal_package_(.*)_[xy]*$/","\\1",$name));
222         if(isset($this->usedPackages[$id])){
223           $pkg = $this->usedPackages[$id]; 
224           if (preg_match('/^-/', $pkg)){
225             $pkg= preg_replace('/^-/', '', $pkg);
226           } else {
227             $pkg= preg_replace('/^/', '-', $pkg);
228           }
229           $this->usedPackages[$id] = $pkg;
230         }
231         break;
232       }
234       /******
235        * Delete Pkgs   
236        ******/
237       if(!preg_match('/^freeze/', $this->FAIstate) && preg_match("/^remove_package_/",$name)){
238         $id = @base64_decode(preg_replace("/^remove_package_(.*)_[xy]*$/","\\1",$name));
239         if(isset($this->usedPackages[$id])){
240           unset($this->usedPackages[$id]);
241         }
242         break;
243       }
245       /******
246        * Configure Pkgs   
247        ******/
248       if(!preg_match('/^freeze/', $this->FAIstate) && preg_match("/^configure_package_/",$name)){
249         $pkg = @base64_decode(preg_replace("/^configure_package_(.*)_[xy]*$/","\\1",$name));
250          
251         if(isset($this->usedPackages[$pkg])){
253           /* Configuration dialog open*/
254           $pkg_config = array();
255           if(isset($this->ConfiguredPackages[$pkg])){
256             $pkg_config = $this->ConfiguredPackages[$pkg];
257           }
258           $this->dialog = new faiPackageConfiguration($this->config, $this->dn,$pkg, $this->FAIdebianRelease , $pkg_config);
259           $this->is_dialog =true;
260         }
261         break;
262       }
263     }
265     /* Abort package selection dialog */ 
266     if(isset($_POST['CancelSubObject'])){
267       $this->dialog = false;
268       $this->is_dialog=false;
269     }
271     /* attach new packages */
272     if(isset($_POST['SaveSubObject'])) {
273       if(!preg_match("/^freeze/", $this->FAIstate)){
274         $this->dialog->save_object();
275         if(count($this->dialog->check())){
276           foreach($this->dialog->check() as $msgs){
277             msg_dialog::display(_("Error"), $msgs, ERROR_DIALOG);
278           }
279         }else{
280           $use = $this->dialog->save();
281           $this->usedPackages = $use;
282           $this->dialog = false;
283           $this->is_dialog=false;
284           ksort($this->usedPackages);
286           /* Generate package list */
287           $this->list= $this->genPkgs(TRUE);
288         }
289       }else{
290         $this->dialog = false;
291         $this->is_dialog=false;
292       }
293     }
295     /* Save Configuration */
296     if(isset($_POST['SaveObjectConfig'])){
297       if(!preg_match("/^freeze/", $this->FAIstate)){
298         $this->ConfiguredPackages= array_merge($this->ConfiguredPackages,$this->dialog->save());
299       }
300       $this->dialog = false;
301       $this->is_dialog=false;
302     }
304     /* cancel configuration */     
305     if(isset($_POST['CancelObjectConfig'])){
306       $this->dialog = false;
307       $this->is_dialog=false;
308     }
310     /* Display dialog */ 
311     if($this->is_dialog){
312       $this->dialog->save_object();
313       return $this->dialog->execute();
314     }
317     /******
318      * Display UI / HTML / smarty 
319      ******/
321     /* Create divlist to display a list of all currently used packages
322      */
323     $divlist = new divSelectBox("faiPackages");
325     ksort($this->usedPackages);
326     if(is_array($this->usedPackages)){
327       foreach($this->usedPackages as $usedName => $name){
329         /* Append message if package is configured */
330         $configured = "<img src='images/empty.png' alt=' '  class='center'>";
331         if(isset($this->ConfiguredPackages[$usedName])){
332           $configured = "<img src='images/package_configure.png' alt='"._("Configured")."'
333                       title='"._("Configured")."' class='center'>";
334         }
336         /* Adapt used name if we're marked for removal */
337         $removal = "<img src='images/empty.png' alt=' '  class='center'>";
338         if (preg_match('/^-/', $name)){
339           $removal = "<img src='images/negate.png' alt='"._("Package marked for removal")."'
340                       title='"._("Package marked for removal")."' class='center'>";
341         }
343         /* Get Version */
344         $version = "&nbsp;";
345         if(isset($this->list[$usedName]['VERSION'])){
346           $version = $this->list[$usedName]['VERSION'];
347         }
348     
349         /* Get description */
350         $description = "&nbsp;";
351         if(isset($this->list[$usedName]['DESCRIPTION'])){
352           $description = base64_decode($this->list[$usedName]['DESCRIPTION']);
353         }
354  
355         if(!preg_match('/^freeze/', $this->FAIstate) && $this->acl_is_writeable("FAIpackage")){
356           $actions = "<input type='image' class='center' title='"._("Mark package for removal")."' 
357             src='images/negate.png' name='removal_package_".base64_encode($usedName)."' >";
358         }
359         if(!preg_match('/^freeze/', $this->FAIstate) && $this->acl_is_writeable("FAIdebconfInfo")){
360           $actions.= "&nbsp;<input type='image' class='center' title='"._("Configure this package")."' 
361             src='images/package_configure.png' name='configure_package_".base64_encode($usedName)."' >";
362         }
363         if(!preg_match('/^freeze/', $this->FAIstate) && $this->acl_is_writeable("FAIpackage")){
364           $actions.= "&nbsp;<input type='image' class='center' title='"._("Remove this package")."' 
365             src='images/lists/trash.png' name='remove_package_".base64_encode($usedName)."' >";
366         }
368         $field1 = array("string" => $configured."&nbsp;".$removal,"attach" => "style='width:40px;'");
369         $field2 = array("string" => $usedName ,"attach" => "style='width:200px;'");
370         $field3 = array("string" => $version);
371         $field4 = array("string" => $description);
372         $field5 = array("string" => $actions ,"attach" => "style='width:60px; border-right:0px;'");
373         $divlist->AddEntry(array($field1,$field2,$field3,$field4,$field5));
374       }
375     }
377     /* Assign variables */
378     foreach($this->attributes as $attrs){
379       $smarty->assign($attrs,$this->$attrs);
380     }
381     $smarty->assign( "FAIinstallMethods", $this->FAIinstallMethods );
383     /* Assign section to smarty */
384     $strsec = "";
385     foreach($this->FAIdebianSection as $sec){
386       $strsec .= $sec." ";
387     }
389     $tmp = $this->plInfo();
390     foreach($tmp['plProvidedAcls'] as $name => $translated){
391       $smarty->assign($name."ACL",$this->getacl($name,preg_match("/freeze/",$this->FAIstate)));
392     }
394     $smarty->assign("divlist",$divlist->DrawList());
395     $smarty->assign("release" ,$this->FAIdebianRelease);
396     $smarty->assign("sections",$this->sections);
397     $smarty->assign("section" ,$strsec);
398     $display.= $smarty->fetch(get_template_path('faiPackage.tpl', TRUE));
399     return($display);
400   }
403   /*! \brief  Removes this packageList from the ldap database 
404    */
405   function remove_from_parent()
406   {
407     $ldap = $this->config->get_ldap_link();
408     $ldap->cd ($this->dn);
409     $release = $this->parent->parent->fai_release;
410     $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $release, $this->dn);
411     FAI::prepare_to_save_FAI_object($use_dn,array(),true);
412     new log("remove","fai/".get_class($this),$use_dn,$this->attributes);
413     foreach($this->ConfiguredPackages as $pkgname => $attrs){
414       foreach($attrs as $name => $attr){
415         $pkgdn =  "FAIvariable=".$name.",".$this->dn;
416         $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $release, $pkgdn);
417         FAI::prepare_to_save_FAI_object($use_dn,array(),true);
418       }
419     }
420     $this->handle_post_events("remove");
421   }
424   /*! \brief  Collect all relevant POST vars for this plugin 
425    */
426   function save_object()
427   {
428     if(preg_match("/^freeze/", $this->FAIstate)) return;
429     plugin::save_object();
430   }
433   /*! \brief  Check given inputs for this package list
434       @return Array Containing all error messages, or an empty array if no error occured
435    */
436   function check()
437   {
438     /* Call common method to give check the hook */
439     $message= plugin::check();
441     if(count($this->usedPackages)==0){
442       $message[]= _("Please select a least one package!");
443     }
445     if((empty($this->FAIdebianRelease))||(empty($this->FAIdebianSection))){
446       $message[]=_("Please choose a valid release/section combination for your repository setup!");
447     }
449     /* Ensure that we do not overwrite an allready existing entry 
450      */
451     if($this->is_new){
452       $release = $this->parent->parent->fai_release;
453       $new_dn= 'cn='.$this->cn.",".get_ou('faipackageou').get_ou('faiou').$release;
454       $res = faiManagement::check_class_name("FAIpackageList",$this->cn,$new_dn);
455       if(isset($res[$this->cn])){
456         $message[] = msgPool::duplicated(_("Name"));
457       }
458     }
459     return ($message);
460   }
463   /*! \brief  Reload the list of cached packages.
464       @return Returns the currently cached list of packages. 
465    */
466   function genPkgs($force = false)
467   {
468     if(!count($this->buffer) || $force){
469       $q = new gosaSupportDaemon();
470       $attrs = array("distribution", "package","version", "section", "description", "timestamp");
472       $packages = array_keys($this->usedPackages);
474       $ret = $q->FAI_get_packages($this->FAIdebianRelease,$attrs,$packages);
475       if($q->is_error()){
476         msg_dialog::display(_("Service infrastructure"),msgPool::siError($q->get_error()),ERROR_DIALOG);
477       }else{
478         foreach($ret as $attr){
479           $this->buffer[$attr['PACKAGE']] = $attr;
480         }
481       }
482     }
483     return $this->buffer;
484   }
487   /*! \brief Save packages and their configuration to ldap 
488    */
489   function save()
490   {
492     /* Assemble release name */
493     if($this->FAIdebianRelease == "ClearFromCopyPaste"){
495       $current_release  = $this->parent->parent->fai_release;
496       $tmp= preg_replace('/,'.normalizePreg(get_ou('faiou')).'.*$/', '', $current_release);
497       $tmp= preg_replace('/ou=/', '', $tmp);
498       $rev= array_reverse(split(',', $tmp));
499       $this->FAIdebianRelease= "";
500       foreach ($rev as $part){
501         $this->FAIdebianRelease.= "/$part";
502       }
503       $this->FAIdebianRelease= preg_replace('#^/#', '', $this->FAIdebianRelease);
504     }
506     plugin::save();
508     $ldap = $this->config->get_ldap_link();
510     $this->attrs['FAIpackage'] = array();
511     foreach($this->usedPackages as $pkg){
512       $this->attrs['FAIpackage'][] = $pkg;
513     } 
515     $this->attrs['FAIdebianSection'] = array();
516     foreach($this->FAIdebianSection as $sec){
517       $this->attrs['FAIdebianSection'][] = $sec;
518     }
520     FAI::prepare_to_save_FAI_object($this->dn,$this->attrs);
521     
522     if($this->initially_was_account){
523       new log("modify","fai/".get_class($this),$this->dn,$this->attributes);
524     }else{
525       new log("create","fai/".get_class($this),$this->dn,$this->attributes);
526     }
528     $ldap->cd($this->dn);
530     /* Save Package configurations */
531     foreach($this->ConfiguredPackages as $pkgname => $attrs){
532       foreach($attrs as $name => $attr){
533       
534         $pkgattrs = array();
536         foreach($attr as $n=>$v){
537           if(empty($v)) $v = array();
538         }
540         /* Set attributes */
541         $pkgattrs['objectClass'][]        = "FAIdebconfInfo";
543         $pkgattrs['FAIpackage']           = $pkgname;
544         $pkgattrs['FAIvariable']          = $name;
545         $pkgattrs['FAIvariableType']      = $attr['Type'];
546         $pkgattrs['FAIvariableContent']   = $attr['Value'];
547         $pkgdn =  "FAIvariable=".$name.",".$this->dn;
549         /* Tag object */
550         $this->tag_attrs($pkgattrs, $pkgdn, $this->gosaUnitTag);
552         if(in_array($pkgattrs['FAIvariableType'],array("boolean","multiselect","password","select","string","text"))){
554           if($pkgattrs['FAIvariableType'] == "text" && $pkgattrs['FAIvariableContent'] == ""){
555             gosa_log("Skipped saving FAIvariable '$name' empty string can't be saved.");
556           }else{
557             FAI::prepare_to_save_FAI_object($pkgdn,$pkgattrs);
558           }
559         }
560       }
561     }
562   }
565   /*! \brief  Return plugin informations for acl handling 
566       @return Array ACL infos of this plugin.
567    */ 
568   static function plInfo()
569   {
570     return (array( 
571           "plShortName" => _("Package"),
572           "plDescription" => _("FAI Package list"),
573           "plSelfModify"  => FALSE,
574           "plDepends"     => array(),
575           "plPriority"    => 28,
576           "plSection"     => array("administration"),
577           "plCategory"    => array("fai"),
578           "plProvidedAcls" => array(
579             "cn"                => _("Name"),
580             "description"       => _("Description"),
581             "FAIpackage"        => _("Packages"),
582             "FAIdebianSection"  => _("Section")."&nbsp;("._("Readonly").")",
583             "FAIinstallMethod"  => _("Install Method"),
584             "FAIdebconfInfo"    => _("Package configuration"),
585             "FAIdebianRelease"  => _("Release")."&nbsp;("._("Readonly").")")
586           ));
587   }
590   /*! \brief prepares this plugin to be inserted after it was copied or cut.
591       @param Array  All attributes from the source object. 
592    */
593   function PrepareForCopyPaste($source)
594   {
595     plugin::PrepareForCopyPaste($source);
597     if(isset($source['FAIstate'][0])){
598       $this->FAIstate = $source['FAIstate'][0];
599     }
601     $this->FAIdebianRelease = "ClearFromCopyPaste";
603     if(isset($source['FAIpackage'])){
604       unset($source['FAIpackage']['count']);
605       foreach($source['FAIpackage'] as $pkg){
606         $this->usedPackages[$pkg] = $pkg;
607       }
608       ksort($this->usedPackages);
609     }else{
610       $this->usedPackages = array();
611     }
613     if((isset($source['FAIdebianSection']))&&(is_array($source['FAIdebianSection']))){
614       $this->FAIdebianSection = array();
615       for($i = 0 ; $i < $source['FAIdebianSection']['count'] ; $i ++){
616         $this->FAIdebianSection[$source['FAIdebianSection'][$i]]=$source['FAIdebianSection'][$i];
617       }
618     }
620     /* Create one filter with all package names, 
621        instead of calling $ldap->search for every single package 
622      */
623     $PackageFilter = "";
624     foreach($this->usedPackages as $name){
625       $PackageFilter .= "(FAIpackage=".$name.")";
626     }
627     $PackageFilter = "(&(objectClass=FAIdebconfInfo)(|".$PackageFilter."))";
629     /* Search for configuration objects */ 
630     $ldap = $this->config->get_ldap_link();
631     $ldap->cd($source['dn']);
632     $ldap->search($PackageFilter,array("FAIvariable","FAIvariableType","FAIvariableContent","FAIpackage","FAIdebianSection","FAIstate"));
634     /* Walk through configurations and append them to our list of ConfiguredPackages */
635     while($attr = $ldap->fetch()){
637       /* Skip objects, that are tagged as removed */
638       if(isset($object['FAIstate'][0])){
639         if(preg_match("/removed$/",$attr['FAIstate'][0])){
640           continue;
641         }
642       }
644       $tmp =array(); 
645       $tmp['Name']  = $attr['FAIvariable'][0];
646       $tmp['Type']  = $attr['FAIvariableType'][0];
648       if (isset($attr['FAIvariableContent'][0])){
649         if(!in_array($attr['FAIvariableType'],array("multiselect"))){
650           $tmp['Value'] = $attr['FAIvariableContent'][0];
651         }else{
652           $content = array();        
653           unset($attr['FAIvariableContent']['count']);
654           foreach($attr['FAIvariableContent'] as $attr){
655             $tmp['Value'][] = $attr;
656           }
657         }
658         $this->ConfiguredPackages[$attr['FAIpackage'][0]][$attr['FAIvariable'][0]]=$tmp;
659       }
660     }
661   }
664   /*! \brief  Returns a list of all configured servers with repositories.
665       @return Array  All repository server 
666    */
667   function getServerInfos()
668   {
669     $ret = array();
670     $ldap = $this->config->get_ldap_link();
671     $ldap->cd($this->config->current['BASE']);
672     $ldap->search("(objectClass=FAIrepositoryServer)",array("*"));
673     while($attrs = $ldap->fetch()){
674       if(isset($attrs['FAIrepository'])){
675         for($i =0 ; $i < $attrs['FAIrepository']['count']; $i++){
676           $obj = $attrs['FAIrepository'][$i];
677           $tmp = split("\|",$obj);
678           if(count($tmp)==4){
679             foreach(split(",",$tmp[3]) as $sec){
680               if(!empty($sec)){
681                 $ret[$tmp[2]][] =  $sec;
682               }
683             }
684           }
685         }
686       }
687     }
688     return($ret);
689   }
692   /*! \brief  Used for copy & paste.
693     Returns a HTML input mask, which allows to change the cn of this entry.
694     @param  Array   Array containing current status && a HTML template.
695    */
696   function getCopyDialog()
697   {
698     $vars = array("cn");
699     $smarty = get_smarty();
700     $smarty->assign("cn", htmlentities($this->cn));
701     $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE));
702     $ret = array();
703     $ret['string'] = $str;
704     $ret['status'] = "";
705     return($ret);
706   }
709   /*! \brief  Used for copy & paste.
710     Some entries must be renamed to avaoid duplicate entries.
711    */
712   function saveCopyDialog()
713   {
714     if(isset($_POST['cn'])){
715       $this->cn = get_post('cn');
716     }
717   }
720 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
721 ?>