diff --git a/plugins/personal/environment/class_environment.inc b/plugins/personal/environment/class_environment.inc
index 8e0943def79ff622a171e2f7e3b2fae3594da9ae..c42b2ad25eafb075c7c754b6b20ab8f66cd4d0ef 100644 (file)
var $gotoLogonScript = ""; // The selected Logon Script
/* Printer */
- var $gotoPrinters = array();// All available Printer
- var $gotoPrinter = ""; // The selected Printer
+ var $gotoPrinter = array();// All available Printer, with their configurations
+ var $gotoPrinterSel = ""; // The selected Printer
/* Share */
var $gotoShares = array();// Current Share Options
var $attributes = array("uid","gotoProfileServer","gotoProfileFlags",
"gotoXResolution","gotoProfileQuota",
"gotoLogonScripts","gotoLogonScript",
- "gotoPrinters",
+ "gotoPrinter",
"gotoShares","gotoShare",
"gotoKioskProfile","gotoKioskProfiles",
"gotoHotplugDevices");
plugin::plugin ($config, $dn);
-
+ /* Check : Are we currently editing a group or user dialog */
if((isset($this->attrs['cn'][0]))&&(!isset($this->attrs['uid'][0]))){
$suffix="Group";
$this->uid = $this->attrs['cn'][0];
$suffix="User";
}
+ $this->gotoKioskProfile= preg_replace("/^.*\//i","",$this->gotoKioskProfile);
+
/* Get all Printer assignments */
$ldap = $this->config->get_ldap_link();
$ldap->cd($this->config->current['BASE']);
$ldap->search("(&(objectClass=gotoPrinter)(goto".$suffix."Printer=".$this->uid."))",array("*"));
while($printer = $ldap->fetch()){
- $this->gotoPrinters[$printer['cn'][0]]=$printer;
- $this->gotoPrinters[$printer['cn'][0]]['mode']="user";
+ $this->gotoPrinter[$printer['cn'][0]]=$printer;
+ $this->gotoPrinter[$printer['cn'][0]]['mode']="user";
}
$ldap->search("(&(objectClass=gotoPrinter)(goto".$suffix."AdminPrinter=".$this->uid."))",array("*"));
while($printer = $ldap->fetch()){
- $this->gotoPrinters[$printer['cn'][0]]=$printer;
- $this->gotoPrinters[$printer['cn'][0]]['mode']="admin";
+ $this->gotoPrinter[$printer['cn'][0]]=$printer;
+ $this->gotoPrinter[$printer['cn'][0]]['mode']="admin";
}
/* prepare hotplugs */
$tmp2['server'] =$tmp[0];
$tmp2['name'] =$tmp[1];
$tmp2['mountPoint'] =$tmp[2];
+ if(isset($tmp[3])){
+ $tmp2['OtherStuff'] =$tmp[3];
+ }else{
+ $tmp2['OtherStuff'] ="";
+ }
$this->gotoShares[$tmp[1]."|".$tmp[0]]=$tmp2;
}
}
function execute()
{
- /* Fill templating stuff */
- $smarty= get_smarty();
- $display= "";
- /* Is accout enabled | are we editing from usermenu or admin menu
- All these tab management is done here
- */
+ /* Call parent execute */
+ plugin::execute();
+
+ /* Fill templating stuff */
+ $smarty= get_smarty();
+ $display= "";
+
+ /* Prepare all variables for smarty */
+ foreach($this->attributes as $s_attr){
+ /* Set value*/
+ $smarty->assign($s_attr,$this->$s_attr);
+
+ /* Set checkbox state*/
+ if(empty($this->$s_attr)){
+ $smarty->assign($s_attr."CHK","");
+ }else{
+ $smarty->assign($s_attr."CHK"," checked ");
+ }
- /* Working from Usermenu an the Account is currently disbled
+ /* Prepare ACL settings*/
+ if(chkacl($this->acl,$s_attr)=="") {
+ $smarty->assign($s_attr."ACL","");
+ }else{
+ $smarty->assign($s_attr."ACL"," disabled ");
+ }
+
+ }
+
+ /* Is accout enabled | are we editing from usermenu or admin menu
+ All these tab management is done here
+ */
+
+ /* Working from Usermenu an the Account is currently disbled
* this->parent : is only set if we are working in a list of tabs
* is_account : is only true if the needed objectClass is given
*/
}
- foreach(array("gotoHotplugDevice","gotoPrinter") as $s_attr){
+ foreach(array("gotoHotplugDevice","gotoPrinterSel") as $s_attr){
if(chkacl($this->acl,$s_attr)=="") {
$smarty->assign($s_attr."ACL","");
}else{
}
}
+ $smarty->assign("useProfileACL","");
if($this->acl != "#none#"){
$smarty->assign("useProfileACL","");
}else{
$smarty->assign("gotoProfileFlag_CACL"," disabled ");
+ $smarty->assign("useProfileACL","disabled");
$smarty->assign("gotoProfileServer"," disabled ");
}
* Open management if post is transmitted
*/
- /* Open Management Dialog */
- if(isset($_POST['KioskManagementDialog'])){
- $this->dialog = new kioskManagementDialog($this->config,$this->dn,$this->newKioskProfiles);
- $this->dialog->parent= $this;
- $this->is_dialog = true;
- }
-
/* Save */
if(isset($_POST['KioskClose'])){
$this->newKioskProfiles = array_merge($this->newKioskProfiles,$this->dialog->save());
$tmp = new kioskManagementDialog($this->config,$this->dn);
$list = $tmp->getKioskProfiles($this->newKioskProfiles);
+ /* Reassign help class */
+ $_SESSION['current_class_for_help'] = get_class($this);
+
+ /* Open Management Dialog */
+ if(isset($_POST['KioskManagementDialog'])){
+ $this->dialog = new kioskManagementDialog($this->config,$this->dn,$this->newKioskProfiles);
+ $this->dialog->parent= $this;
+ $this->is_dialog = true;
+ }
+
$smarty->assign("gotoKioskProfiles",$list);
$smarty->assign("gotoKioskProfileKeys",array_flip($list));
/* We assign a share to this user, if we don't know where to mount the share */
if((!isset($_POST['gotoShareMountPoint']))||(empty($_POST['gotoShareMountPoint']))||(preg_match("/[\|]/i",$_POST['gotoShareMountPoint']))){
print_red(_("You must specify a valid mount point."));
+ }elseif($_POST['gotoShareMountPoint'][0] !="/" ){
+ print_red(_("You must specify a valid mount point."));
}else{
$a_share = $this->gotoAvailableShares[$_POST['gotoShareSelection']];
$s_mount = $_POST['gotoShareMountPoint'];
/* Preparing the new assignment */
$this->gotoShares[$a_share['name']]=$a_share;
+ $this->gotoShares[$a_share['name']]['OtherStuff']="";
$this->gotoShares[$a_share['name']]['mountPoint']=$s_mount;
}
}
$this->dialog->save_object();
$tmp = $this->dialog->save();
$tmp2= $this->dialog->getPrinter(true);
- $this->gotoPrinters[$tmp]=$tmp2[$tmp];
- $this->gotoPrinters[$tmp]['mode']="user";
+ $this->gotoPrinter[$tmp]=$tmp2[$tmp];
+ $this->gotoPrinter[$tmp]['mode']="user";
$this->is_dialog=false;
unset($this->dialog);
$this->dialog =NULL;
}
}
- if((isset($_POST['gotoPrinterDel']))&&(isset($_POST['gotoPrinter']))&&(!empty($_POST['gotoPrinter']))){
- $printer = $_POST['gotoPrinter'];
- unset($this->gotoPrinters[$printer]);
+ if((isset($_POST['gotoPrinterDel']))&&(isset($_POST['gotoPrinterSel']))&&(!empty($_POST['gotoPrinterSel']))){
+ $printer = $_POST['gotoPrinterSel'];
+ unset($this->gotoPrinter[$printer]);
}
- if((isset($_POST['gotoPrinterEdit']))&&(isset($_POST['gotoPrinter']))&&(!empty($_POST['gotoPrinter']))){
- $printer = $_POST['gotoPrinter'];
- if($this->gotoPrinters[$printer]['mode']=="user"){
- $this->gotoPrinters[$printer]['mode']="admin";
+ if((isset($_POST['gotoPrinterEdit']))&&(isset($_POST['gotoPrinterSel']))&&(!empty($_POST['gotoPrinterSel']))){
+ $printer = $_POST['gotoPrinterSel'];
+ if($this->gotoPrinter[$printer]['mode']=="user"){
+ $this->gotoPrinter[$printer]['mode']="admin";
}else{
- $this->gotoPrinters[$printer]['mode']="user";
+ $this->gotoPrinter[$printer]['mode']="user";
}
}
- $smarty->assign("gotoPrinters",$this->printOutPrinterDevices());
+ $smarty->assign("gotoPrinter",$this->printOutPrinterDevices());
$smarty->assign("gotoPrinterKeys",array_flip($this->printOutPrinterDevices()));
/* General behavior */
/* Don't save our template variables */
$skip = array("uid",
- "gotoLogonScripts","gotoPrinters","gotoShares","gotoKioskProfiles","gotoHotplugDevices",
- "gotoPrinter");
+ "gotoLogonScripts","gotoPrinter","gotoShares","gotoKioskProfiles","gotoHotplugDevices" );
/* Skip all these attributes */
foreach($skip as $del){
unset($this->attrs[$del]);
plugin::save_object();
foreach($this->attributes as $s_attr){
- if(in_array($s_attr,array("gotoShares","gotoHotplugDevices","gotoPrinters","gotoLogonScripts","uid"))) continue;
+ if(in_array($s_attr,array("gotoShares","gotoHotplugDevices","gotoPrinter","gotoLogonScripts","uid"))) continue;
if(isset($_POST[$s_attr])){
$this->$s_attr = $_POST[$s_attr];
}else{
/* Save usersettings to Printer */
if(chkacl($this->acl,"gotoPrinter")!=""){
- $this->gotoPrinters = array();
+ $this->gotoPrinter = array();
}
if($this->is_group){
}
-
- /* Deleted printer settings wasn't deleted from ldap ...
+ /* 1. Search all printers that have our uid/cn as member
+ * 2. Delete this uid/cn from every single entry and save it again.
+ * 2.1 There are different types of members: Users / Groups, this will be defined in $suffix
+ * 2.2 And each type has two modes, Admin (e.g. 'gotoUserAdminPrinter') and Normal
*/
- //if(count($this->gotoPrinters)==0){
- if(1==1){
- $ldap->search("(&(objectClass=gotoPrinter)(|(goto".$s_suffix."Printer=".$this->uid.")(goto".$s_suffix."AdminPrinter=".$this->uid.")))",array("*"));
- while($attr = $ldap->fetch()){
- if(isset($attr['goto'.$s_suffix.'Printer'])) {
- foreach($attr['goto'.$s_suffix.'Printer'] as $key => $user){
- if($this->uid==$user){
- unset($attr['goto'.$s_suffix.'Printer'][$key]);
- }
- }
- }
+ $ldap->search("(&(objectClass=gotoPrinter)(|(goto".$s_suffix."Printer=".$this->uid.")(goto".$s_suffix."AdminPrinter=".$this->uid.")))",array("*"));
+ while($attr = $ldap->fetch()){
- if(isset($attr['goto'.$s_suffix.'AdminPrinter'])){
- foreach($attr['goto'.$s_suffix.'AdminPrinter'] as $key => $user){
- if($this->uid==$user){
- unset($attr['goto'.$s_suffix.'AdminPrinter'][$key]);
- }
- }
- }
+ /* Walk trough all printers and check if our user id used, if so remove it.
+ * Later we will insert our uid at the right place.
+ */
- $attrs_used = array();
- foreach($attr as $key=>$val){
- if((!is_numeric($key))&&($key!="count")){
- if(is_array($val)&&isset($val['count'])){
- unset($val['count']);
- }
- $attrs_used[$key]=$val;
+ /* Remove normal entries (User)*/
+ if(isset($attr['goto'.$s_suffix.'Printer'])) {
+ foreach($attr['goto'.$s_suffix.'Printer'] as $key => $user){
+ if($this->uid==$user){
+ unset($attr['goto'.$s_suffix.'Printer'][$key]);
}
- }
- $attr= $attrs_used;
- $tmp =array();
-
- if(isset($attr['goto'.$s_suffix.'AdminPrinter'])){
- foreach($attr['goto'.$s_suffix.'AdminPrinter'] as $print){
- $tmp[]=$print;
+ }
+ }
+
+ /* Remove administrational entries (Admin)*/
+ if(isset($attr['goto'.$s_suffix.'AdminPrinter'])){
+ foreach($attr['goto'.$s_suffix.'AdminPrinter'] as $key => $user){
+ if($this->uid==$user){
+ unset($attr['goto'.$s_suffix.'AdminPrinter'][$key]);
}
- }
- $attr['goto'.$s_suffix.'AdminPrinter'] = $tmp;
+ }
+ }
- $tmp =array();
-
- if(isset($attr['goto'.$s_suffix.'Printer'])){
- foreach($attr['goto'.$s_suffix.'Printer'] as $print){
- $tmp[]=$print;
+ /* Extract useable tags, to be able to save all changes
+ */
+ $attrs_used = array();
+ foreach($attr as $key=>$val){
+
+ /* If index is numeric, skip it ...*/
+ if((!is_numeric($key))&&($key!="count")){
+
+ /* If entry contains 'count' remove it */
+ if(is_array($val)&&isset($val['count'])){
+ unset($val['count']);
}
+ $attrs_used[$key]=$val;
}
- $attr['goto'.$s_suffix.'Printer'] = $tmp;
+ }
+ /* the result of cleaning the entry is
+ * to be able to directly save this again,
+ * if all changes are made
+ */
+ $attr= $attrs_used;
- if(isset($attr['GOTOADMINPRINTER'])){
- unset($attr['GOTOADMINPRINTER']);
- }
+#fix : Id don't know why such an entry was set ...
+ if(isset($attr['GOTOADMINPRINTER'])){
+ unset($attr['GOTOADMINPRINTER']);
+ }
- $ldap->cd($attr['dn']);
- unset($attr['dn']);
- $ldap->modify($attr);
- if($ldap->get_error()!="Success"){
- print_red(_("Error while writing printer")." : ".$ldap->get_error());
- }
+ /* Save changes */
+ $ldap->cd($attr['dn']);
+ unset($attr['dn']);
+ $ldap->modify($attr);
+ if($ldap->get_error()!="Success"){
+ print_red(_("Error while writing printer")." : ".$ldap->get_error());
}
- }
+ }
- foreach($this->gotoPrinters as $printer) {
+ /* All printers are cleaned, (our cn/uid removed)
+ * now we must add our uid / cn
+ * to the new configured printers.
+ */
+ foreach($this->gotoPrinter as $printer) {
$ldap->cd($printer['dn']);
$ldap->cat($printer['dn']);
$attrs= $ldap->fetch();
$attrs_used[$key]=$val;
}
}
-
+ /* $attrs contains all values
+ * we need, to save the entry lateron
+ */
$attrs= $attrs_used;
- /* Filter entries */
-
+ /* Depending on the type (User/Admin)
+ * switch these attributes, that makes it easier
+ */
if($printer['mode'] == "user"){
$attribute = "goto".$s_suffix."Printer";
$attribute2 = "goto".$s_suffix."AdminPrinter";
$printer[$attribute2]=array();
}else{
if(in_array($this->uid,$printer[$attribute2])){
- $tmp = array_flip($attrs[$attribute2]);
+ $tmp = array_flip($printer[$attribute2]);
unset($tmp[$this->uid]);
$attrs[$attribute2]=array_flip($tmp);
}
}
}
- $tmp =array();
- if(isset($attrs['goto'.$s_suffix.'AdminPrinter'])){
- foreach($attrs['goto'.$s_suffix.'AdminPrinter'] as $print){
- $tmp[]=$print;
- }
- }
- $attrs['goto'.$s_suffix.'AdminPrinter'] = $tmp;
-
- $tmp =array();
- if(isset($attrs['goto'.$s_suffix.'Printer'])){
- foreach($attrs['goto'.$s_suffix.'Printer'] as $print){
- $tmp[]=$print;
- }
- }
- $attrs['goto'.$s_suffix.'Printer'] = $tmp;
-
$ldap->cd($attrs['dn']);
unset($attrs['dn']);
$ldap->modify($attrs);
/* Prepare Shares */
$this->attrs['gotoShare']=array();
foreach($this->gotoShares as $name => $share){
- $this->attrs['gotoShare'][] =$share['server']."|".$share['name']."|".$share['mountPoint'];
+ $this->attrs['gotoShare'][] =$share['server']."|".$share['name']."|".$share['mountPoint']."|".$share['OtherStuff'];
}
if(!empty($this->gotoKioskProfile)){
- $this->attrs['gotoKioskProfile']= $this->gotoKioskProfile;
+ if(preg_match("/https/i",$_SERVER['HTTP_REFERER'])){
+ $method="https://";
+ }else{
+ $method="http://";
+ }
+
+ $str = $method.str_replace("//","/",$_SERVER['SERVER_NAME']."/kiosk/");
+ $this->attrs['gotoKioskProfile']= $str.$this->gotoKioskProfile;
}else{
$this->attrs['gotoKioskProfile']= array();
}
- $saveThis = array("gotoKioskProfile","gotoProfileQuota","gotoXResolution","gotoProfileServer");
+ $saveThis = array("gotoProfileQuota","gotoXResolution","gotoProfileServer");
foreach($saveThis as $tosave){
if(!empty($this->$tosave)){
$a_return = array();
if(is_array($this->gotoShares)){
foreach($this->gotoShares as $share){
- $a_return[$share['name']."|".$share['server']]= $share['name']." [".$share['server']."]";
+ $a_return[$share['name']."|".$share['server']]= $share['server']."://".$share['name']." on ".$share['mountPoint'];
}
}
return($a_return);
function printOutPrinterDevices()
{
$a_return = array();
- if(is_array($this->gotoPrinters)){
- foreach($this->gotoPrinters as $printer){
+ if(is_array($this->gotoPrinter)){
+ foreach($this->gotoPrinter as $printer){
if($printer['mode'] == "admin"){
$a_return[$printer['cn'][0]]= $printer['cn'][0]." - "._("Admin");
}else{