d0b694cff2058e0a40eba29cb767bcafec344e70
1 <?php
3 class environment extends plugin
4 {
5 /* CLI vars */
6 var $cli_summary = "Manage server basic objects";
7 var $cli_description = "Some longer text\nfor help";
8 var $cli_parameters = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
10 /* attribute list for save action */
11 var $ignore_account = FALSE;
12 var $plHeadline = "Environment";
13 var $plDescription = "This does something";
14 var $dialog = false; // Indicates that we are currently editing in an seperate dialog
16 /* Attribute definition
17 */
19 /* profile management */
20 var $useProfile = false; // Specifies if we want to use a Server
21 var $gotoProfileServer = ""; // Specifies the selected profile server
22 var $gotoProfileServers = array();// Specifies all available and selectable servers
23 var $gotoProfileFlags = ""; // Flags enabled ? only used to set ACL and save
24 var $gotoProfileFlag_C = ""; // Flag is set to C if we have the profile caching fucntion enabled
26 var $gotoXResolution = ""; // The selected resolution eg: 1024x768
27 var $gotoXResolutions = array();// Contains all available resolutions for this account
28 var $gotoProfileFlag_L = ""; // Flag is set to L to enable runtime resolution change
29 var $gotoProfileQuota = ""; // User Quota Settings
31 /* Logon script section*/
32 var $gotoLogonScripts = array();// Contains all available Logon Scripts
33 var $gotoLogonScript = ""; // The selected Logon Script
35 /* Printer */
36 var $gotoPrinters = array();// All available Printer
37 var $gotoPrinter = ""; // The selected Printer
39 /* Share */
40 var $gotoShares = array();// Currently Share Option
41 var $gotoShare = ""; // currently selected Share Option
42 var $gotoShareSelections= array();// Available Shares for this account in Listbox format
43 var $gotoAvailableShares= array();// Available Shares for this account
45 /* Kiosk profile */
46 var $gotoKioskProfile = ""; // The selected Kiosk Profile
47 var $gotoKioskProfiles = array();// All available Kiosk profiles
49 /* Hotplug Devices */
50 var $gotoHotplugDevice = ""; // Selected hotplug
51 var $gotoHotplugDevices = array();// Already configured hotplug devices
54 /* general settings */
55 // Sets the attributes which will kept on page reload, which will be saved, ...
56 var $attributes = array("uid","useProfile","gotoProfileServer","gotoProfileServers","gotoProfileFlags","gotoProfileFlag_C",
57 "gotoXResolution","gotoXResolutions","gotoProfileFlag_L","gotoProfileQuota",
58 "gotoLogonScripts","gotoLogonScript",
59 "gotoPrinters","gotoPrinter",
60 "gotoShares","gotoShare","gotoShareSelections",
61 "gotoKioskProfile","gotoKioskProfiles",
62 "gotoHotplugDevice","gotoHotplugDevices");
63 var $objectclasses = array("gotoEnvironment"); // Specifies the objectClass which contains the attributes edited here
65 function environment ($config, $dn= NULL)
66 {
67 plugin::plugin ($config, $dn);
69 /* Get all Printer assignments */
70 $ldap = $this->config->get_ldap_link();
71 $ldap->cd($this->config->current['BASE']);
72 $ldap->search("(&(objectClass=gotoPrinter)(gotoUserPrinter=".$this->uid."))",array("*"));
73 while($printer = $ldap->fetch()){
74 $this->gotoPrinters[$printer['cn'][0]]=$printer;
75 $this->gotoPrinters[$printer['cn'][0]]['mode']="user";
76 }
77 $ldap->search("(&(objectClass=gotoPrinter)(gotoAdminPrinter=".$this->uid."))",array("*"));
78 while($printer = $ldap->fetch()){
79 $this->gotoPrinters[$printer['cn'][0]]=$printer;
80 $this->gotoPrinters[$printer['cn'][0]]['mode']="admin";
81 }
83 /* prepare hotplugs */
84 if((isset($this->attrs['gotoHotplugDevice']))&&(is_array($this->attrs['gotoHotplugDevice']))){
85 unset($this->attrs['gotoHotplugDevice']['count']);
86 foreach($this->attrs['gotoHotplugDevice'] as $device){
87 $tmp = $tmp2 = array();
88 $tmp = split("\|",$device);
89 $tmp2['name'] = $tmp[0];
90 $tmp2['description'] = $tmp[1];
91 $tmp2['id'] = $tmp[2];
92 $this->gotoHotplugDevices[$tmp[0]]=$tmp2;
93 }
94 }
96 /* Prepare Shares */
97 if((isset($this->attrs['gotoShare']))&&(is_array($this->attrs['gotoShare']))){
98 unset($this->attrs['gotoShare']['count']);
99 foreach($this->attrs['gotoShare'] as $share){
100 $tmp = $tmp2 = array();
101 $tmp = split("\|",$share);
102 $tmp2['name'] =$tmp[0];
103 $tmp2['mountPoint']=$tmp[1];
104 $this->gotoShares[$tmp[0]]=$tmp2;
105 }
106 }
108 for($i = 0 ; $i < strlen($this->gotoProfileFlags) ; $i ++){
109 $chr = $this->gotoProfileFlags[$i];
110 $name = "gotoProfileFlag_".$chr;
111 $this->$name=$chr;
112 }
114 if((!empty($this->gotoProfileServer))||($this->gotoProfileFlag_C=="C")){
115 $this->useProfile = true;
116 }else{
117 $this->useProfile = false;
118 }
120 }
122 function execute()
123 {
124 /* Fill templating stuff */
125 $smarty= get_smarty();
126 $display= "";
127 /* Is accout enabled | are we editing from usermenu or admin menu
128 All these tab management is done here
129 */
131 // 1. Account disabled . Editing from usermenu
132 if((!isset($this->parent))&&(!$this->is_account)){
133 /* We are currently editing this tab from usermenu, but htis account is not enabled */
134 $smarty->assign("is_account",$this->is_account);
135 /* Load template */
136 $display .= $smarty->fetch(get_template_path('environment.tpl', TRUE));
137 /* Avoid the "You are currently editing ...." message when you leave this tab */
138 $display .= back_to_main();
139 /* Display our message to the user */
140 return $display;
142 // Account is enabled
143 }else{
144 /* Tell smarty that this accoutn is enabled */
145 $smarty->assign("is_account","true");
147 /* Do we need to flip is_account state? */
148 if (isset($_POST['modify_state'])){
149 $this->is_account= !$this->is_account;
150 }
151 if(!isset($this->parent)){
152 // 3. ? Account Enabled . Editing from usermenu
154 }else{
155 // 3. Account enabled . Editing from adminmenu
156 if ($this->is_account){
157 $display= $this->show_header(_("Remove environment extension"),
158 _("This server has environment extension enabled. You can disable it by clicking below."));
159 } else {
160 // 4. Account disabled . Editing from adminmenu
161 $display= $this->show_header(_("Add environment extension"),
162 _("This server has environment extension disabled. You can enable it by clicking below."));
163 return $display;
164 }
165 }
166 }
167 /* Account is Account : is_accounbt=true.
168 * Else we won't reach this.
169 */
171 /* Prepare all variables for smarty */
172 foreach($this->attributes as $s_attr){
173 /* Set value*/
174 $smarty->assign($s_attr,$this->$s_attr);
176 /* Set checkbox state*/
177 if(empty($this->$s_attr)){
178 $smarty->assign($s_attr."CHK","");
179 }else{
180 $smarty->assign($s_attr."CHK"," checked ");
181 }
183 /* Prepare ACL settings*/
184 if(chkacl($this->acl,$s_attr)=="") {
185 $smarty->assign($s_attr."ACL","");
186 }else{
187 $smarty->assign($s_attr."ACL"," disabled ");
188 }
190 }
192 /* HANDLE Profile Settings here
193 * Assign available Quota and resolution settings
194 * Get all available profile server
195 * Get cache checkbox
196 * Assign this all to Smarty
197 */
199 if(empty($this->useProfile)){
200 $smarty->assign("gotoProfileACL","disabled");
201 $smarty->assign("useProfileCHK","");
202 }else{
203 $smarty->assign("gotoProfileACL","");
204 $smarty->assign("useProfileCHK"," checked ");
205 }
207 $this->gotoXResolutions = array("640x480","800x600","1024x768","1280x768","1280x1024");
208 $this->gotoProfileServers = array("none","none1");
210 $smarty->assign("gotoXResolutions",$this->gotoXResolutions);
211 $smarty->assign("gotoProfileServers",$this->gotoProfileServers);
213 /* Handle kiosk profiles
214 * Read available from filesystem
215 * Open management if post is transmitted
216 */
217 $tmp = new kioskManagementDialog($this->config,$this->dn);
218 $list = $tmp->getKioskProfiles();
220 $smarty->assign("gotoKioskProfiles",$list);
221 $smarty->assign("gotoKioskProfileKeys",array_flip($list));
223 /* Open Management Dialog */
224 if(isset($_POST['KioskManagementDialog'])){
225 $this->dialog = new kioskManagementDialog($this->config,$this->dn);
226 $this->is_dialog = true;
227 }
229 /* Save */
230 if(isset($_POST['KioskClose'])){
231 unset($this->dialog);
232 $this->dialog=NULL;
233 $this->is_dialog = false;
234 }
236 /* Logonscript Management
237 * Get available LogonScripts (possibly grey out (or mark) these script that are defined for the group)
238 * Perform add Delete edit Posts
239 */
241 /* Dialog Save */
242 if(isset($_POST['LogonSave'])){
243 $this->dialog->save_object();
244 if(count($this->dialog->check())!=0){
245 foreach($this->dialog->check() as $msg){
246 print_red($msg);
247 }
248 }else{
249 $tmp = $this->dialog->save();
250 unset($this->dialog);
251 $this->dialog=NULL;
252 $this->is_dialog=false;
253 $this->gotoLogonScripts[$tmp['LogonName']]=$tmp;
254 }
255 }
257 /* Dialog Quit without saving */
258 if(isset($_POST['LogonCancel'])){
259 $this->is_dialog= false;
260 unset($this->dialog);
261 $this->dialog= NULL;
262 }
264 /* Check Edit Del New Posts for a selected LogonScript */
265 if(isset($_POST['gotoLogonScriptNew'])||isset($_POST['gotoLogonScriptEdit'])||isset($_POST['gotoLogonScriptDel'])){
267 /* New Logon Script: Open an edit dialog, we don't need a $_POST['gotoLogonScript'] here.
268 * In this case we create a new Logon Script.
269 */
270 if(isset($_POST['gotoLogonScriptNew'])){
271 $this->is_dialog = true;
272 $this->dialog = new logonManagementDialog($this->config,$this->dn);
273 }
275 /* If we receive a Delete request and there is a Script selected in the selectbox, delete this one.
276 * We only can delete if there is an entry selected.
277 */
278 if((isset($_POST['gotoLogonScriptDel']))&&(isset($_POST['gotoLogonScript']))){
279 $is_entry = $this->gotoLogonScripts[$_POST['gotoLogonScript']];
280 print "Deleting ".$is_entry;
281 }
283 /* In this case we want to edit an existing entry, we open a new Dialog to allow editing.
284 * There must be an entry selected to perform edit request.
285 */
286 if((isset($_POST['gotoLogonScriptEdit']))&&(isset($_POST['gotoLogonScript']))){
287 $is_entry = $this->gotoLogonScripts[$_POST['gotoLogonScript']];
288 $this->is_dialog = true;
289 $this->dialog = new logonManagementDialog($this->config,$this->dn,$is_entry);
290 }
291 }
293 /* Append List to smarty*/
294 $smarty->assign("gotoLogonScripts", $this->printOutLogonScripts());
295 $smarty->assign("gotoLogonScriptKeys",array_flip($this->printOutLogonScripts()));
297 /* In this section server shares will be defined
298 * A user can select one of the given shares and a mount point
299 * and attach this combination to his setup.
300 */
302 $this->gotoShareSelections = $this->getShareList(true);
303 $this->gotoAvailableShares = $this->getShareList(false);
305 $smarty->assign("gotoShareSelections", $this->gotoShareSelections);
306 $smarty->assign("gotoShareSelectionKeys", array_flip($this->gotoShareSelections));
308 /* if $_POST['gotoShareAdd'] is set, we will try to add a new entry
309 * This entry will be, a combination of mountPoint and sharedefinitions
310 */
311 if(isset($_POST['gotoShareAdd'])){
312 /* We assign a share to this user, if we don't know where to mount the share */
313 if((!isset($_POST['gotoShareMountPoint']))||(empty($_POST['gotoShareMountPoint']))){
314 print_red("You must specify a valid mount point.");
315 }else{
316 $a_share = $this->gotoAvailableShares[$_POST['gotoShareSelection']];
317 $s_mount = $_POST['gotoShareMountPoint'];
319 /* Preparing the new assignment */
320 $this->gotoShares[$a_share['name']]=$a_share;
321 $this->gotoShares[$a_share['name']]['mountPoint']=$s_mount;
322 }
323 }
325 /* if the Post gotoShareDel is set, someone asked GOsa to delete the selected entry (if there is one selected)
326 * If there is no defined share selected, we will abort the deletion without any message
327 */
328 if((isset($_POST['gotoShareDel']))&&(isset($_POST['gotoShare']))){
329 unset($this->gotoShares[$_POST['gotoShare']]);
330 }
332 $smarty->assign("gotoShares",$this->printOutAssignedShares());
333 $smarty->assign("gotoShareKeys",array_flip($this->printOutAssignedShares()));
335 /* Hotplug devices will be handled here
336 * There are 3 possible methods for this feature
337 * Create a new Hotplug, A Dialog will open where you can specify some hotplug information
338 * Delete will erase an entry, the entry must be selcted in the ListBox first
339 * Editing an entry will open a dialog where the informations about the selcted entry can be changed
340 */
342 /* If there is a new entry wanted, open a new entry by initilising the dialog */
343 if(isset($_POST['gotoHotplugDeviceNew'])){
344 $this->dialog = new hotplugDialog($this->config,$this->dn);
345 $this->is_dialog = true;
346 }
348 /* We have to delete the selected hotplug from the list*/
349 if((isset($_POST['gotoHotplugDeviceDel']))&&(isset($_POST['gotoHotplugDevice']))){
350 unset($this->gotoHotplugDevices[$_POST['gotoHotplugDevice']]);
351 }
353 /* There are already defined hotplugs from other users we could use */
354 if(isset($_POST['gotoHotplugDeviceUse'])){
355 $this->dialog = new hotplugDialog($this->config,$this->dn,true);
356 $this->is_dialog = true;
357 }
359 /* Dialog Aborted */
360 if(isset($_POST['HotPlugCancel'])){
361 unset($this->dialog);
362 $this->dialog= NULL;
363 $this->is_dialog = false;
364 }
366 /* Dialod saved */
367 if(isset($_POST['HotPlugSave'])){
368 $this->dialog->save_object();
369 if(count($this->dialog->check())!=0){
370 foreach($this->dialog->check() as $msg){
371 print_red($msg);
372 }
373 }else{
374 $this->dialog->save_object();
375 $a_tmp = $this->dialog->save();
376 if(is_array($a_tmp)){
377 $this->gotoHotplugDevices[$a_tmp['name']]= $a_tmp;
378 }
379 unset($this->dialog);
380 $this->dialog= NULL;
381 $this->is_dialog = false;
382 }
383 }
385 $smarty->assign("gotoHotplugDevices",$this->printOutHotPlugDevices());
386 $smarty->assign("gotoHotplugDeviceKeys",array_flip($this->printOutHotPlugDevices()));
388 /* Printer Assignment will managed below
389 * A printer can be assigned in two different ways and two different types
390 * There are 2 types of users assigned to a printer : user and admin
391 * They only differ in the member attribute they will be assigned to. user: gotoUserPrinter admin: gotoadminPrinter
392 * The different types of assigning a user are : 1 assigning a user to a printer 2. assigning a group to a printer
393 */
395 /* First handle Add Post. Open a dialog that allows us to select a printer or two */
396 if(isset($_POST['gotoPrinterAdd'])){
397 $this->is_dialog=true;
398 $this->dialog = new selectPrinterDialog($this->config,$this->dn);
399 }
401 if(isset($_POST['PrinterCancel'])){
402 $this->is_dialog=false;
403 unset($this->dialog);
404 $this->dialog=NULL;
405 }
407 if(isset($_POST['PrinterSave'])){
408 if(count($this->dialog->check())!=0){
409 $tmp = $this->dialog->check();
410 foreach($tmp as $msg){
411 print_red($msg);
412 }
413 }else{
414 $this->dialog->save_object();
415 $tmp = $this->dialog->save();
416 $tmp2= $this->dialog->getPrinter(true);
417 $this->gotoPrinters[$tmp]=$tmp2[$tmp];
418 $this->gotoPrinters[$tmp]['mode']="user";
419 $this->is_dialog=false;
420 unset($this->dialog);
421 $this->dialog =NULL;
422 }
423 }
425 if((isset($_POST['gotoPrinterDel']))&&(isset($_POST['gotoPrinter']))&&(!empty($_POST['gotoPrinter']))){
426 $printer = $_POST['gotoPrinter'];
427 unset($this->gotoPrinters[$printer]);
428 }
430 if((isset($_POST['gotoPrinterEdit']))&&(isset($_POST['gotoPrinter']))&&(!empty($_POST['gotoPrinter']))){
431 $printer = $_POST['gotoPrinter'];
432 if($this->gotoPrinters[$printer]['mode']=="user"){
433 $this->gotoPrinters[$printer]['mode']="admin";
434 }else{
435 $this->gotoPrinters[$printer]['mode']="user";
436 }
437 }
439 $smarty->assign("gotoPrinters",$this->printOutPrinterDevices());
440 $smarty->assign("gotoPrinterKeys",array_flip($this->printOutPrinterDevices()));
442 /* General behavior */
443 if((isset($this->dialog))&&($this->dialog!=NULL)&&(!empty($this->dialog))){
444 $this->dialog->save_object();
445 return ($this->dialog->execute());
446 }
448 /* Als smarty vars are set. Get smarty template and generate output */
449 $display.= $smarty->fetch(get_template_path('environment.tpl', TRUE,dirname(__FILE__)));
451 return($display);
452 }
454 function remove_from_parent()
455 {
456 /* only if it was an account*/
457 if (!$this->initially_was_account){
458 return;
459 }
461 /* include global link_info */
462 $ldap= $this->config->get_ldap_link();
464 /* Remove and write to LDAP */
465 plugin::remove_from_parent();
467 /* Don't save our template variables */
468 $skip = array("useProfile","uid","gotoProfileServers","gotoProfileFlag_C","gotoXResolutions","gotoProfileFlag_L",
469 "gotoLogonScripts","gotoPrinters","gotoShares","gotoShareSelections","gotoKioskProfiles","gotoHotplugDevices",
470 "gotoPrinter");
471 /* Skip all these attributes */
472 foreach($skip as $del){
473 unset($this->attrs[$del]);
474 }
476 @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,$this->attributes, "Save");
478 $ldap->cd($this->dn);
479 $ldap->modify($this->attrs);
481 show_ldap_error($ldap->get_error());
483 /* Optionally execute a command after we're done */
484 $this->handle_post_events("remove");
485 }
488 /* Save data to object */
489 function save_object()
490 {
491 /* Get all Posted vars
492 * Setup checkboxes
493 */
495 if(isset($_POST['iamposted'])){
496 plugin::save_object();
497 foreach($this->attributes as $s_attr){
498 if(in_array($s_attr,array("gotoShares","gotoHotplugDevices","gotoPrinters","gotoLogonScripts"))) continue;
499 if(isset($_POST[$s_attr])){
500 $this->$s_attr = $_POST[$s_attr];
501 }else{
502 $this->$s_attr = false;
503 }
504 }
505 }
506 }
509 /* Check supplied data */
510 function check()
511 {
512 $message= array();
513 return ($message);
514 }
517 /* Save to LDAP */
518 function save()
519 {
520 plugin::save();
521 $ldap= $this->config->get_ldap_link();
523 $realyUsedAttrs= array();
525 /* Save already used objectClasses */
526 $ocs = $this->attrs['objectClass'];
527 unset($ocs['count']);
528 $this->attrs = array();
529 $this->attrs['objectClass']= $ocs;
530 foreach($this->objectclasses as $objc){
531 if(!in_array($objc,$this->attrs['objectClass'])){
532 $this->attrs['objectClass'][]=$objc;
533 }
534 }
537 /* Save usersettings to Printer */
538 foreach($this->gotoPrinters as $printer) {
539 $ldap->cd($printer['dn']);
540 $ldap->cat($printer['dn']);
541 $attrs= $ldap->fetch();
542 $attrs_used = array();
543 foreach($attrs as $key=>$val){
544 if((!is_numeric($key))&&($key!="count")){
545 if(is_array($val)&&isset($val['count'])){
546 unset($val['count']);
547 }
548 $attrs_used[$key]=$val;
549 }
550 }
551 $attrs= $attrs_used;
553 /* Filter entries */
555 if($printer['mode'] == "user"){
556 $attribute = "gotoUserPrinter";
557 $attribute2 = "gotoAdminPrinter";
558 }else{
559 $attribute = "gotoAdminPrinter";
560 $attribute2 = "gotoUserPrinter";
561 }
563 /* If this user is already assigned to $attribute2
564 * delete user from $attribute2, to be albe to attach him to $attribute
565 * A user can't be admin and normal user for one printer
566 */
567 if(!isset($printer[$attribute2])){
568 $printer[$attribute2]=array();
569 }else{
570 if(in_array($this->uid,$printer[$attribute2])){
571 $tmp = array_flip($attrs[$attribute2]);
572 unset($tmp[$this->uid]);
573 $attrs[$attribute2]=$tmp;
574 }
575 /* If Last entry removed, clear attribute*/
576 if(empty($attrs[$attribute2])){
577 $attrs[$attribute2]=array();
578 }
579 }
581 /* Attach user to the $attribute, if he is'nt already attached
582 */
583 if(!isset($attrs[$attribute])){
584 $attrs[$attribute]=array($this->uid);
585 }else{
586 unset($attrs[$attribute]['count']);
587 if(!in_array($this->uid,$attrs[$attribute])){
588 $attrs[$attribute][]=$this->uid;
589 }
590 }
591 $ldap->cd($attrs['dn']);
592 unset($attrs['dn']);
593 $ldap->modify($attrs);
594 if($ldap->get_error()!="Success"){
595 print_red($ldap->get_error());
596 }
597 }
599 /* Prepare HotPlug devices */
600 $this->attrs['gotoHotplugDevice'] = array();
601 foreach($this->gotoHotplugDevices as $name => $device){
602 $this->attrs['gotoHotplugDevice'][] = $device['name']."|".$device['description']."|".$device['id'];
603 }
605 /* Prepare Shares */
606 $this->attrs['gotoShare']=array();
607 foreach($this->gotoShares as $name => $share){
608 $this->attrs['gotoShare'][] = $share['name']."|".$share['mountPoint'];
609 }
611 if(!empty($this->gotoKioskProfile)){
612 $this->attrs['gotoKioskProfile']= $this->gotoKioskProfile;
613 }else{
614 $this->attrs['gotoKioskProfile']= array();
615 }
617 $saveThis = array("gotoKioskProfile","gotoProfileQuota","gotoXResolution","gotoProfileServer");
619 foreach($saveThis as $tosave){
620 if(!empty($this->$tosave)){
621 $this->attrs[$tosave]=$this->$tosave;
622 }else{
623 $this->attrs[$tosave]=array();
624 }
625 }
627 /* Prepare Flags */
628 $this->attrs['gotoProfileFlags'] = array($this->gotoProfileFlag_C.$this->gotoProfileFlag_L);
629 if(empty($this->attrs['gotoProfileFlags'][0])){
630 $this->attrs['gotoProfileFlags']=array();
631 }
633 if($this->useProfile == false){
634 $this->attrs['gotoProfileFlags'] = preg_replace("/C/i","",$this->attrs['gotoProfileFlags']);
635 $this->attrs['gotoProfileServer']= array();
636 }
638 $ldap->cat ($this->dn);
639 if ($ldap->fetch()){
640 $mode= "modify";
641 } else {
642 $mode= "add";
643 $ldap->cd($this->config->current['BASE']);
644 $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
645 }
647 $ldap->cd($this->dn);
648 $ldap->$mode($this->attrs);
649 if($ldap->get_error()!="Success"){
650 print_red($ldap->get_error());
651 }
652 $this->handle_post_events($mode);
653 }
658 /* This function returns all available Shares defined in this ldap
659 * There are two ways to call this function, if listboxEntry is true
660 * only name and path are attached to the array, in it is false, the whole
661 * entry will be parsed an atached to the result.
662 */
663 function getShareList($listboxEntry = false)
664 {
665 $ldap= $this->config->get_ldap_link();
666 $a_res = $ldap->search("(objectClass=goShareServer)",array("goExportEntry"));
667 $return= array();
668 while($entry = $ldap->fetch($a_res)){
669 $shareAttrs = split("\|",$entry['goExportEntry'][0]);
670 if($listboxEntry) {
671 $return[$shareAttrs[0]] = $shareAttrs[0]." - ".$shareAttrs[3];
672 }else{
673 $return[$shareAttrs[0]]['name'] = $shareAttrs[0];
674 $return[$shareAttrs[0]]['description'] = $shareAttrs[1];
675 $return[$shareAttrs[0]]['type'] = $shareAttrs[2];
676 $return[$shareAttrs[0]]['charset'] = $shareAttrs[3];
677 $return[$shareAttrs[0]]['path'] = $shareAttrs[4];
678 $return[$shareAttrs[0]]['option'] = $shareAttrs[5];
679 }
680 }
681 return($return);
682 }
685 /* Generate ListBox frindly output for the defined shares
686 * Possibly Add or remove an attribute here,
687 */
688 function printOutAssignedShares()
689 {
690 $a_return = array();
691 if(is_array($this->gotoShares)){
692 foreach($this->gotoShares as $share){
693 $a_return[$share['name']]= $share['name']." ".$share['mountPoint'];
694 }
695 }
696 return($a_return);
697 }
699 /* Generate ListBox frindly output for the definedhotplugs
700 * Possibly Add or remove an attribute here,
701 */
702 function printOutHotPlugDevices()
703 {
704 $a_return= array();
705 if(is_array($this->gotoHotplugDevices)){
706 foreach($this->gotoHotplugDevices as $key=>$device){
707 $a_return[$key] = $device['name']." - ".$device['id'];
708 }
709 }
710 return($a_return);
711 }
713 /* Generates ListBox frienly output of used printer devices
714 * Append ' - admin' if printer is used in admin mode
715 */
716 function printOutPrinterDevices()
717 {
718 $a_return = array();
719 if(is_array($this->gotoPrinters)){
720 foreach($this->gotoPrinters as $printer){
721 if($printer['mode'] == "admin"){
722 $a_return[$printer['cn'][0]]= $printer['cn'][0]." - "._("Admin");
723 }else{
724 $a_return[$printer['cn'][0]]= $printer['cn'][0];
725 }
726 }
727 }
728 return($a_return);
729 }
731 /* Generates ListBox frienly output of used logonscripts
732 */
733 function printOutLogonScripts()
734 {
735 print_a($this->gotoLogonScripts);
736 $a_return = array();
737 if(is_array($this->gotoLogonScripts)){
738 foreach($this->gotoLogonScripts as $script){
739 $a_return[$script['LogonName']]= $script['LogonName'];
740 }
741 }
742 return($a_return);
743 }
744 }
749 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
750 ?>