9751bede44350996afa6ef6e3c5af90e66b4f9f5
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 $this->gotoLogonScripts = array("asdf"=>"one","aaaa"=>"two","121"=>"3");
243 $smarty->assign("gotoLogonScripts",$this->gotoLogonScripts);
244 $smarty->assign("gotoLogonScriptKeys",array_flip($this->gotoLogonScripts));
246 /* Check Edit Del New Posts for a selected LogonScript */
247 if(isset($_POST['gotoLogonScriptNew'])||isset($_POST['gotoLogonScriptEdit'])||isset($_POST['gotoLogonScriptDel'])){
249 /* New Logon Script: Open an edit dialog, we don't need a $_POST['gotoLogonScript'] here.
250 * In this case we create a new Logon Script.
251 */
252 if(isset($_POST['gotoLogonScriptNew'])){
253 print "Adding ".$is_entry;
254 }
256 /* If we receive a Delete request and there is a Script selected in the selectbox, delete this one.
257 * We only can delete if there is an entry selected.
258 */
259 if((isset($_POST['gotoLogonScriptDel']))&&(isset($_POST['gotoLogonScript']))){
260 $is_entry = $this->gotoLogonScripts[$_POST['gotoLogonScript']];
261 print "Deleting ".$is_entry;
262 }
264 /* In this case we want to edit an existing entry, we open a new Dialog to allow editing.
265 * There must be an entry selected to perform edit request.
266 */
267 if((isset($_POST['gotoLogonScriptEdit']))&&(isset($_POST['gotoLogonScript']))){
268 $is_entry = $this->gotoLogonScripts[$_POST['gotoLogonScript']];
269 print "Editing ".$is_entry;
270 }
271 }
273 /* In this section server shares will be defined
274 * A user can select one of the given shares and a mount point
275 * and attach this combination to his setup.
276 */
278 $this->gotoShareSelections = $this->getShareList(true);
279 $this->gotoAvailableShares = $this->getShareList(false);
281 $smarty->assign("gotoShareSelections", $this->gotoShareSelections);
282 $smarty->assign("gotoShareSelectionKeys", array_flip($this->gotoShareSelections));
284 /* if $_POST['gotoShareAdd'] is set, we will try to add a new entry
285 * This entry will be, a combination of mountPoint and sharedefinitions
286 */
287 if(isset($_POST['gotoShareAdd'])){
288 /* We assign a share to this user, if we don't know where to mount the share */
289 if((!isset($_POST['gotoShareMountPoint']))||(empty($_POST['gotoShareMountPoint']))){
290 print_red("You must specify a valid mount point.");
291 }else{
292 $a_share = $this->gotoAvailableShares[$_POST['gotoShareSelection']];
293 $s_mount = $_POST['gotoShareMountPoint'];
295 /* Preparing the new assignment */
296 $this->gotoShares[$a_share['name']]=$a_share;
297 $this->gotoShares[$a_share['name']]['mountPoint']=$s_mount;
298 }
299 }
301 /* if the Post gotoShareDel is set, someone asked GOsa to delete the selected entry (if there is one selected)
302 * If there is no defined share selected, we will abort the deletion without any message
303 */
304 if((isset($_POST['gotoShareDel']))&&(isset($_POST['gotoShare']))){
305 unset($this->gotoShares[$_POST['gotoShare']]);
306 }
308 $smarty->assign("gotoShares",$this->printOutAssignedShares());
309 $smarty->assign("gotoShareKeys",array_flip($this->printOutAssignedShares()));
311 /* Hotplug devices will be handled here
312 * There are 3 possible methods for this feature
313 * Create a new Hotplug, A Dialog will open where you can specify some hotplug information
314 * Delete will erase an entry, the entry must be selcted in the ListBox first
315 * Editing an entry will open a dialog where the informations about the selcted entry can be changed
316 */
318 /* If there is a new entry wanted, open a new entry by initilising the dialog */
319 if(isset($_POST['gotoHotplugDeviceNew'])){
320 $this->dialog = new hotplugDialog($this->config,$this->dn);
321 $this->is_dialog = true;
322 }
324 /* We have to delete the selected hotplug from the list*/
325 if((isset($_POST['gotoHotplugDeviceDel']))&&(isset($_POST['gotoHotplugDevice']))){
326 unset($this->gotoHotplugDevices[$_POST['gotoHotplugDevice']]);
327 }
329 /* There are already defined hotplugs from other users we could use */
330 if(isset($_POST['gotoHotplugDeviceUse'])){
331 $this->dialog = new hotplugDialog($this->config,$this->dn,true);
332 $this->is_dialog = true;
333 }
335 /* Dialog Aborted */
336 if(isset($_POST['HotPlugCancel'])){
337 unset($this->dialog);
338 $this->dialog= NULL;
339 $this->is_dialog = false;
340 }
342 /* Dialod saved */
343 if(isset($_POST['HotPlugSave'])){
344 $this->dialog->save_object();
345 if(count($this->dialog->check())!=0){
346 foreach($this->dialog->check() as $msg){
347 print_red($msg);
348 }
349 }else{
350 $this->dialog->save_object();
351 $a_tmp = $this->dialog->save();
352 if(is_array($a_tmp)){
353 $this->gotoHotplugDevices[$a_tmp['name']]= $a_tmp;
354 }
355 unset($this->dialog);
356 $this->dialog= NULL;
357 $this->is_dialog = false;
358 }
359 }
361 $smarty->assign("gotoHotplugDevices",$this->printOutHotPlugDevices());
362 $smarty->assign("gotoHotplugDeviceKeys",array_flip($this->printOutHotPlugDevices()));
364 /* Printer Assignment will managed below
365 * A printer can be assigned in two different ways and two different types
366 * There are 2 types of users assigned to a printer : user and admin
367 * They only differ in the member attribute they will be assigned to. user: gotoUserPrinter admin: gotoadminPrinter
368 * The different types of assigning a user are : 1 assigning a user to a printer 2. assigning a group to a printer
369 */
371 /* First handle Add Post. Open a dialog that allows us to select a printer or two */
372 if(isset($_POST['gotoPrinterAdd'])){
373 $this->is_dialog=true;
374 $this->dialog = new selectPrinterDialog($this->config,$this->dn);
375 }
377 if(isset($_POST['PrinterCancel'])){
378 $this->is_dialog=false;
379 unset($this->dialog);
380 $this->dialog=NULL;
381 }
383 if(isset($_POST['PrinterSave'])){
384 if(count($this->dialog->check())!=0){
385 $tmp = $this->dialog->check();
386 foreach($tmp as $msg){
387 print_red($msg);
388 }
389 }else{
390 $this->dialog->save_object();
391 $tmp = $this->dialog->save();
392 $tmp2= $this->dialog->getPrinter(true);
393 $this->gotoPrinters[$tmp]=$tmp2[$tmp];
394 $this->gotoPrinters[$tmp]['mode']="user";
395 $this->is_dialog=false;
396 unset($this->dialog);
397 $this->dialog =NULL;
398 }
399 }
401 if((isset($_POST['gotoPrinterDel']))&&(isset($_POST['gotoPrinter']))&&(!empty($_POST['gotoPrinter']))){
402 $printer = $_POST['gotoPrinter'];
403 unset($this->gotoPrinters[$printer]);
404 }
406 if((isset($_POST['gotoPrinterEdit']))&&(isset($_POST['gotoPrinter']))&&(!empty($_POST['gotoPrinter']))){
407 $printer = $_POST['gotoPrinter'];
408 if($this->gotoPrinters[$printer]['mode']=="user"){
409 $this->gotoPrinters[$printer]['mode']="admin";
410 }else{
411 $this->gotoPrinters[$printer]['mode']="user";
412 }
413 }
415 $smarty->assign("gotoPrinters",$this->printOutPrinterDevices());
416 $smarty->assign("gotoPrinterKeys",array_flip($this->printOutPrinterDevices()));
418 /* General behavior */
419 if((isset($this->dialog))&&($this->dialog!=NULL)&&(!empty($this->dialog))){
420 $this->dialog->save_object();
421 return ($this->dialog->execute());
422 }
424 /* Als smarty vars are set. Get smarty template and generate output */
425 $display.= $smarty->fetch(get_template_path('environment.tpl', TRUE,dirname(__FILE__)));
427 return($display);
428 }
430 function remove_from_parent()
431 {
432 /* only if it was an account*/
433 if (!$this->initially_was_account){
434 return;
435 }
437 /* include global link_info */
438 $ldap= $this->config->get_ldap_link();
440 /* Remove and write to LDAP */
441 plugin::remove_from_parent();
443 /* Don't save our template variables */
444 $skip = array("useProfile","uid","gotoProfileServers","gotoProfileFlag_C","gotoXResolutions","gotoProfileFlag_L",
445 "gotoLogonScripts","gotoPrinters","gotoShares","gotoShareSelections","gotoKioskProfiles","gotoHotplugDevices",
446 "gotoPrinter");
447 /* Skip all these attributes */
448 foreach($skip as $del){
449 unset($this->attrs[$del]);
450 }
452 @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,$this->attributes, "Save");
454 $ldap->cd($this->dn);
455 $ldap->modify($this->attrs);
457 show_ldap_error($ldap->get_error());
459 /* Optionally execute a command after we're done */
460 $this->handle_post_events("remove");
461 }
464 /* Save data to object */
465 function save_object()
466 {
467 /* Get all Posted vars
468 * Setup checkboxes
469 */
471 if(isset($_POST['iamposted'])){
472 plugin::save_object();
473 foreach($this->attributes as $s_attr){
474 if(in_array($s_attr,array("gotoShares","gotoHotplugDevices","gotoPrinters"))) continue;
475 if(isset($_POST[$s_attr])){
476 $this->$s_attr = $_POST[$s_attr];
477 }else{
478 $this->$s_attr = false;
479 }
480 }
481 }
482 }
485 /* Check supplied data */
486 function check()
487 {
488 $message= array();
489 return ($message);
490 }
493 /* Save to LDAP */
494 function save()
495 {
496 plugin::save();
497 $ldap= $this->config->get_ldap_link();
499 $realyUsedAttrs= array();
501 /* Save already used objectClasses */
502 $ocs = $this->attrs['objectClass'];
503 unset($ocs['count']);
504 $this->attrs = array();
505 $this->attrs['objectClass']= $ocs;
506 foreach($this->objectclasses as $objc){
507 if(!in_array($objc,$this->attrs['objectClass'])){
508 $this->attrs['objectClass'][]=$objc;
509 }
510 }
513 /* Save usersettings to Printer */
514 foreach($this->gotoPrinters as $printer) {
515 $ldap->cd($printer['dn']);
516 $ldap->cat($printer['dn']);
517 $attrs= $ldap->fetch();
518 $attrs_used = array();
519 foreach($attrs as $key=>$val){
520 if((!is_numeric($key))&&($key!="count")){
521 if(is_array($val)&&isset($val['count'])){
522 unset($val['count']);
523 }
524 $attrs_used[$key]=$val;
525 }
526 }
527 $attrs= $attrs_used;
529 /* Filter entries */
531 if($printer['mode'] == "user"){
532 $attribute = "gotoUserPrinter";
533 $attribute2 = "gotoAdminPrinter";
534 }else{
535 $attribute = "gotoAdminPrinter";
536 $attribute2 = "gotoUserPrinter";
537 }
539 /* If this user is already assigned to $attribute2
540 * delete user from $attribute2, to be albe to attach him to $attribute
541 * A user can't be admin and normal user for one printer
542 */
543 if(!isset($printer[$attribute2])){
544 $printer[$attribute2]=array();
545 }else{
546 if(in_array($this->uid,$printer[$attribute2])){
547 $tmp = array_flip($attrs[$attribute2]);
548 unset($tmp[$this->uid]);
549 $attrs[$attribute2]=$tmp;
550 }
551 /* If Last entry removed, clear attribute*/
552 if(empty($attrs[$attribute2])){
553 $attrs[$attribute2]=array();
554 }
555 }
557 /* Attach user to the $attribute, if he is'nt already attached
558 */
559 if(!isset($attrs[$attribute])){
560 $attrs[$attribute]=array($this->uid);
561 }else{
562 unset($attrs[$attribute]['count']);
563 if(!in_array($this->uid,$attrs[$attribute])){
564 $attrs[$attribute][]=$this->uid;
565 }
566 }
567 $ldap->cd($attrs['dn']);
568 unset($attrs['dn']);
569 $ldap->modify($attrs);
570 if($ldap->get_error()!="Success"){
571 print_red($ldap->get_error());
572 }
573 }
575 /* Prepare HotPlug devices */
576 $this->attrs['gotoHotplugDevice'] = array();
577 foreach($this->gotoHotplugDevices as $name => $device){
578 $this->attrs['gotoHotplugDevice'][] = $device['name']."|".$device['description']."|".$device['id'];
579 }
581 /* Prepare Shares */
582 $this->attrs['gotoShare']=array();
583 foreach($this->gotoShares as $name => $share){
584 $this->attrs['gotoShare'][] = $share['name']."|".$share['mountPoint'];
585 }
587 if(!empty($this->gotoKioskProfile)){
588 $this->attrs['gotoKioskProfile']= $this->gotoKioskProfile;
589 }else{
590 $this->attrs['gotoKioskProfile']= array();
591 }
593 $saveThis = array("gotoKioskProfile","gotoProfileQuota","gotoXResolution","gotoProfileServer");
595 foreach($saveThis as $tosave){
596 if(!empty($this->$tosave)){
597 $this->attrs[$tosave]=$this->$tosave;
598 }else{
599 $this->attrs[$tosave]=array();
600 }
601 }
603 /* Prepare Flags */
604 $this->attrs['gotoProfileFlags'] = array($this->gotoProfileFlag_C.$this->gotoProfileFlag_L);
605 if(empty($this->attrs['gotoProfileFlags'][0])){
606 $this->attrs['gotoProfileFlags']=array();
607 }
609 if($this->useProfile == false){
610 $this->attrs['gotoProfileFlags'] = preg_replace("/C/i","",$this->attrs['gotoProfileFlags']);
611 $this->attrs['gotoProfileServer']= array();
612 }
614 $ldap->cat ($this->dn);
615 if ($ldap->fetch()){
616 $mode= "modify";
617 } else {
618 $mode= "add";
619 $ldap->cd($this->config->current['BASE']);
620 $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
621 }
623 $ldap->cd($this->dn);
624 $ldap->$mode($this->attrs);
625 if($ldap->get_error()!="Success"){
626 print_red($ldap->get_error());
627 }
628 $this->handle_post_events($mode);
629 }
634 /* This function returns all available Shares defined in this ldap
635 * There are two ways to call this function, if listboxEntry is true
636 * only name and path are attached to the array, in it is false, the whole
637 * entry will be parsed an atached to the result.
638 */
639 function getShareList($listboxEntry = false)
640 {
641 $ldap= $this->config->get_ldap_link();
642 $a_res = $ldap->search("(objectClass=goShareServer)",array("goExportEntry"));
643 $return= array();
644 while($entry = $ldap->fetch($a_res)){
645 $shareAttrs = split("\|",$entry['goExportEntry'][0]);
646 if($listboxEntry) {
647 $return[$shareAttrs[0]] = $shareAttrs[0]." - ".$shareAttrs[3];
648 }else{
649 $return[$shareAttrs[0]]['name'] = $shareAttrs[0];
650 $return[$shareAttrs[0]]['description'] = $shareAttrs[1];
651 $return[$shareAttrs[0]]['type'] = $shareAttrs[2];
652 $return[$shareAttrs[0]]['charset'] = $shareAttrs[3];
653 $return[$shareAttrs[0]]['path'] = $shareAttrs[4];
654 $return[$shareAttrs[0]]['option'] = $shareAttrs[5];
655 }
656 }
657 return($return);
658 }
661 /* Generate ListBox frindly output for the defined shares
662 * Possibly Add or remove an attribute here,
663 */
664 function printOutAssignedShares()
665 {
666 $a_return = array();
667 if(is_array($this->gotoShares)){
668 foreach($this->gotoShares as $share){
669 $a_return[$share['name']]= $share['name']." ".$share['mountPoint'];
670 }
671 }
672 return($a_return);
673 }
675 /* Generate ListBox frindly output for the definedhotplugs
676 * Possibly Add or remove an attribute here,
677 */
678 function printOutHotPlugDevices()
679 {
680 $a_return= array();
681 if(is_array($this->gotoHotplugDevices)){
682 foreach($this->gotoHotplugDevices as $key=>$device){
683 $a_return[$key] = $device['name']." - ".$device['id'];
684 }
685 }
686 return($a_return);
687 }
689 /* Generates ListBox frienly output of used printer devices
690 * Append ' - admin' if printer is used in admin mode
691 */
692 function printOutPrinterDevices()
693 {
694 $a_return = array();
695 if(is_array($this->gotoPrinters)){
696 foreach($this->gotoPrinters as $printer){
697 if($printer['mode'] == "admin"){
698 $a_return[$printer['cn'][0]]= $printer['cn'][0]." - "._("Admin");
699 }else{
700 $a_return[$printer['cn'][0]]= $printer['cn'][0];
701 }
702 }
703 }
704 return($a_return);
705 }
711 }
716 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
717 ?>