diff --git a/gosa-plugins/goto/personal/environment/class_environment.inc b/gosa-plugins/goto/personal/environment/class_environment.inc
index b72ced3ce70b2584673ccef8f447eb45cba48c2d..237de00d999dc04883004984baf6ce0ed6ba3fde 100644 (file)
/* attribute list for save action */
var $ignore_account = FALSE;
- var $plHeadline = "Environment";
+ var $plHeadline = "Desktop";
var $plDescription = "This does something";
var $dialog = false; // Indicates that we are currently editing in an seperate dialog
/* general settings */
// Sets the attributes which will kept on page reload, which will be saved, ...
- var $CopyPasteVars = array("gotoHotplugDevices","gotoAvailableShares","gotoShareSelections","gotoPrinterSel","gotoProfileFlagL","gotoXResolutions","gotoProfileFlagC","gotoProfileServers","useProfile","is_group","in_dialog","OrigCn","gotoKioskProfile_Server","gotoKioskProfile_Profile");
+ var $CopyPasteVars = array("gotoHotplugDevices","gotoAvailableShares","gotoShareSelections","gotoPrinterSel","gotoProfileFlagL","gotoXResolutions","gotoProfileFlagC","gotoProfileServers","useProfile","is_group","in_dialog","OrigCn","gotoKioskProfile_Server","gotoKioskProfile_Profile", "gotoLogonScripts","gotoLogonScript","gotoShare","gotoShares");
var $attributes = array("uid","gotoProfileServer","gotoProfileFlags","gotoHotplugDeviceDN",
"gotoXResolution","gotoProfileQuota",
- "gotoLogonScripts","gotoLogonScript",
+ "gotoLogonScript","gotoLogonScripts","gotoHotplugDevices",
"gotoPrinter", "gosaDefaultPrinter",
- "gotoShares","gotoShare",
+ "gotoShare",
"gotoKioskProfile");
var $objectclasses = array("gotoEnvironment"); // Specifies the objectClass which contains the attributes edited here
var $cn;
var $multiple_support =TRUE;
var $use_gotoPrinter;
+ var $shareList = NULL;
+
function environment (&$config, $dn= NULL)
{
"1280x768" => "1280x768",
"1280x1024" => "1280x1024");
- if($this->config->get_cfg_value("resolutions") != ""){
- $file = $this->config->get_cfg_value("resolutions");
+ if($this->config->get_cfg_value("core","resolutions") != ""){
+ $file = $this->config->get_cfg_value("core","resolutions");
if(is_readable($file)){
$str = file_get_contents($file);
}
}
$this->update_kiosk_profiles();
+
+ // Prepare lists
+ $this->shareList = new sortableListing();
+ $this->shareList->setDeleteable(false);
+ $this->shareList->setEditable(false);
+ $this->shareList->setWidth("100%");
+ $this->shareList->setHeight("120px");
+ $this->shareList->setHeader(array(_("Server"),_("Share name"),_("Mount point"),
+ _("User"), _("Type"), _("Action")));
+ $this->shareList->setDefaultSortColumn(1);
}
}
}
- if($cnt && $this->config->search("environment","kioskpath",array('menu','tabs'))){
+ $tmp = $this->config->get_cfg_value("environment","kioskPath");
+ if($cnt && !empty($tmp)){
$this->kiosk_enabled = TRUE;
}
}
}
- /* Are we editing from MyAccount and not editing a user */
- $WriteOnly = (!isset($this->parent)|| !$this->parent) && !session::is_set('edit');
-
/* Check profile server */
- if($this->acl_is_writeable("gotoProfileServer",$WriteOnly)){
+ if($this->acl_is_writeable("gotoProfileServer")){
if(!empty($this->gotoProfileServer) && !isset($this->gotoProfileServers[$this->gotoProfileServer])){
}else{
$smarty->assign($s_attr."CHK"," checked ");
}
+ }
- /* Prepare ACL settings*/
- $smarty->assign($s_attr."ACL",$this->getacl($s_attr,$WriteOnly));
+ $tmp = $this->plInfo();
+ foreach($tmp['plProvidedAcls'] as $val => $desc){
+ $smarty->assign("$val"."ACL", $this->getacl($val));
}
/* Is accout enabled | are we editing from usermenu or admin menu
}
/* Group Dialog with enabled environment options */
if ($this->is_account){
- $display= $this->show_enable_header(msgPool::removeFeaturesButton(_("Environment")),
- msgPool::featuresEnabled(_("Environment")));
+ $display= $this->show_disable_header(msgPool::removeFeaturesButton(_("Desktop")),
+ msgPool::featuresEnabled(_("Desktop")));
} else {
/* Environment is disabled
environment extensions
*/
if((isset($this->parent->by_object['group']))||(isset($this->attrs['objectClass']))&&((in_array("posixAccount",$this->attrs['objectClass'])))){
- $display= $this->show_enable_header(msgPool::addFeaturesButton(_("Environment")),
- msgPool::featuresDisabled(_("Environment")));
+ $display= $this->show_enable_header(msgPool::addFeaturesButton(_("Desktop")),
+ msgPool::featuresDisabled(_("Desktop")));
return $display;
}elseif((isset($this->parent->by_object['ogroup']))){
- $display= $this->show_enable_header(msgPool::addFeaturesButton(_("Environment")),
- msgPool::featuresDisabled(_("Environment")));
+ $display= $this->show_enable_header(msgPool::addFeaturesButton(_("Desktop")),
+ msgPool::featuresDisabled(_("Desktop")));
return $display;
}else{
- $display= $this->show_enable_header(msgPool::addFeaturesButton(_("Environment")),
- msgPool::featuresDisabled(_("Environment"), _("POSIX")), TRUE);
+ $display= $this->show_enable_header(msgPool::addFeaturesButton(_("Desktop")),
+ msgPool::featuresDisabled(_("Desktop"), _("POSIX")), TRUE);
return $display;
}
}
// 3. Account enabled . Editing from adminmenu
if ($this->is_account){
- $display= $this->show_enable_header(msgPool::removeFeaturesButton(_("Environment")),
- msgPool::featuresEnabled(_("Environment")));
+ $display= $this->show_disable_header(msgPool::removeFeaturesButton(_("Desktop")),
+ msgPool::featuresEnabled(_("Desktop")));
} else {
if($this->parent->by_object['posixAccount']->is_account==true){
- $display= $this->show_enable_header(msgPool::addFeaturesButton(_("Environment")),
- msgPool::featuresDisabled(_("Environment")));
+ $display= $this->show_enable_header(msgPool::addFeaturesButton(_("Desktop")),
+ msgPool::featuresDisabled(_("Desktop")));
return $display;
}else{
- $display= $this->show_enable_header(msgPool::addFeaturesButton(_("Environment")),
- msgPool::featuresDisabled(_("Environment"), _("POSIX")), TRUE);
+ $display= $this->show_enable_header(msgPool::addFeaturesButton(_("Desktop")),
+ msgPool::featuresDisabled(_("Desktop"), _("POSIX")), TRUE);
return $display;
}
}
}else{
$smarty->assign($s_attr."CHK"," checked ");
}
+ }
- /* Prepare ACL settings*/
- $smarty->assign($s_attr."ACL",$this->getacl($s_attr,$WriteOnly));
+ $tmp = $this->plInfo();
+ foreach($tmp['plProvidedAcls'] as $val => $desc){
+ $smarty->assign("$val"."ACL", $this->getacl($val));
}
- foreach(array("gotoHotplugDevice","gotoProfileFlagC","gotoProfileFlagL") as $s_attr){
- $smarty->assign($s_attr."ACL",$this->getacl($s_attr,$WriteOnly));
+ foreach(array("gotoProfileFlagC","gotoProfileFlagL") as $s_attr){
+ $smarty->assign($s_attr."ACL",$this->getacl($s_attr));
}
- if($WriteOnly) {
+ if($this->read_only) {
$smarty->assign("gotoPrinterACL","r");
}else{
$smarty->assign("gotoPrinterACL","rw");
$smarty->assign("useProfile",$this->useProfile);
if(empty($this->useProfile) && !$this->multiple_support_active){
$smarty->assign("useProfileCHK","");
- $smarty->assign("gotoProfileServerACL" , preg_replace("/w/","",$this->getacl("gotoProfileServer",$WriteOnly)));
- $smarty->assign("gotoProfileQuotaACL" , preg_replace("/w/","",$this->getacl("gotoProfileQuota",$WriteOnly)));
- $smarty->assign("gotoProfileFlagCACL" , preg_replace("/w/","",$this->getacl("gotoProfileFlagC",$WriteOnly)));
+ $smarty->assign("gotoProfileServerACL" , preg_replace("/w/","",$this->getacl("gotoProfileServer")));
+ $smarty->assign("gotoProfileQuotaACL" , preg_replace("/w/","",$this->getacl("gotoProfileQuota")));
+ $smarty->assign("gotoProfileFlagCACL" , preg_replace("/w/","",$this->getacl("gotoProfileFlagC")));
}else{
$smarty->assign("useProfileCHK"," checked ");
}
- $smarty->assign("gotoProfileServerWriteable", $this->acl_is_writeable("gotoProfileServer",$WriteOnly));
- $smarty->assign("gotoProfileACL", $this->getacl("gotoProfileServer",$WriteOnly).$this->getacl("gotoProfileQuota",$WriteOnly));
+ $smarty->assign("gotoProfileServerWriteable", $this->acl_is_writeable("gotoProfileServer"));
+ $smarty->assign("gotoProfileACL", $this->getacl("gotoProfileServer").$this->getacl("gotoProfileQuota"));
/* HANDLE Profile Settings here
* Assign available Quota and resolution settings
if((preg_match("/^gotoShareDel_/",$name)) && ($once)){
$once = false;
$key = preg_replace("/^gotoShareDel_/","",$name);
- $key = preg_replace("/_+[xy]$/","",$key);
- $key = base64_decode($key);
+ $key = postDecode($key);
if(isset($this->gotoShares[$key])) {
unset($this->gotoShares[$key]);
}
if((preg_match("/^gotoShareResetPwd_/",$name)) && ($once)){
$once = false;
$key = preg_replace("/^gotoShareResetPwd_/","",$name);
- $key = preg_replace("/_+[xy]$/","",$key);
- $key = base64_decode($key);
+ $key = postDecode($key);
$this->gotoShares[$key]['PwdHash'] = "";
if(preg_match("/^!/",$this->gotoShares[$key]['server'])){
unset($this->gotoShares[$key]);
}
}
}
- $divlistShares = new divSelectBox("gotoShares");
- $divlistShares->SetHeight(100);
-
- $tmp = array();
- if($this->acl_is_readable("gotoShare")){
- $tmp = $this->printOutAssignedShares();
- }
-
-
- foreach($tmp as $key => $value){
+ // Build up share list
+ $data = $lData = array();
+ foreach($this->gotoShares as $key => $entry){
$img = "";
- /* Skip apssword only entries */
- if( empty($this->gotoShares[$key]['server']) &&
- empty($this->gotoShares[$key]['name']) &&
- empty($this->gotoShares[$key]['mountPoint']) &&
- empty($this->gotoShares[$key]['Username'])){
+ // Skip password only entries
+ if( empty($entry['server']) && empty($entry['name']) &&
+ empty($entry['mountPoint']) && empty($entry['Username'])){
continue;
}
+ // While editing mutlipe users at once we've to seperate
+ // entries used by all users and those used by only some.
$color = "";
if($this->multiple_support_active){
- if($this->gotoShares[$key]['UsedByAllUsers']){
+ if($entry['UsedByAllUsers']){
$value .= " (<b>"._("Used by all users")."</b>)";
}else{
$color = "color: #999999;";
}
}
- /* Check if entry starts with an ! */
+ // Create password reset image button
+ if($entry['PwdHash'] != ""){
+ $img.=
+ image('plugins/goto/images/list_reset_password.png',
+ 'gotoShareResetPwd_'.postEncode($key),
+ _("Reset password hash"));
+ }
+
+ // Build up list entries - Handle entries starting with '!' here.
+ $data[$key]=$key;
if(preg_match("/^!/",$this->gotoShares[$key]['server'])){
- /* If we are currently editing groups environment, skip those ! entries */
+ // If we are currently editing groups environment, skip those ! entries */
if($this->is_group) continue;
- /* Create pwd reset images */
- if($this->gotoShares[$key]['PwdHash'] != ""){
- $img.= "<input type='image' name='gotoShareResetPwd_".base64_encode($key)."
- 'src='plugins/goto/images/list_reset_password.png' alt='"._("Reset password hash")."'
- title='"._("Reset password hash")."'>";
- }
- $field1 = array("string" => "<font style=\"color:#C0C0C0\">".$value."</font>" , "attach" => "style='".$color."'");
- $field2 = array("string" => $img , "attach" => "style='border-right:0px;'");
+ $lData[$key] = array('data' => array(
+ $entry['server']."://",
+ $entry['name'],
+ "",
+ "",
+ image("plugins/groups/images/select_group.png","",_("Group share")),
+ $img));
}else{
- /* Create pwd reset img && delete image */
- if($this->gotoShares[$key]['PwdHash'] != ""){
- $img.= "<input type='image' name='gotoShareResetPwd_".base64_encode($key)."
- 'src='plugins/goto/images/list_reset_password.png' alt='"._("Reset password hash")."'
- title='"._("Reset password hash")."'>";
- $img.= " ";
- }
- $img.= "<input type='image' name='gotoShareDel_".base64_encode($key)." 'src='images/lists/trash.png' alt='".msgPool::delButton()."'
- title='"._("Delete share entry")."'>";
- $field1 = array("string" => $value , "attach" => "style='".$color."'");
- $field2 = array("string" => $img , "attach" => "style='border-right:0px;'");
+ $img.= image('images/lists/trash.png',"gotoShareDel_".postEncode($key),msgPool::delButton());
+ $lData[$key] = array('data' => array(
+ $entry['server']."://",
+ $entry['name'],
+ $entry['mountPoint'],
+ $entry['Username'],
+ image("plugins/users/images/select_user.png","",_("User share")),
+ $img));
}
- $divlistShares->AddEntry(array($field1,$field2));
}
- $smarty->assign("divlistShares",$divlistShares->DrawList());
+ $this->shareList->setListData($data,$lData);
+ $this->shareList->update();
+ $this->shareList->setAcl($this->getacl("gotoShare"));
+ $smarty->assign("shareList",$this->shareList->render());
/* Hotplug devices will be handled here
* There are 3 possible methods for this feature
*/
/* We have to delete the selected hotplug from the list*/
- if((isset($_POST['gotoHotplugDeviceDel']))&&(isset($_POST['gotoHotplugDevice_post'])) && $this->acl_is_writeable("gotoHotplugDevice")){
- if($this->acl_is_writeable("gotoHotplugDevice")){
+ if((isset($_POST['gotoHotplugDeviceDel']))&&(isset($_POST['gotoHotplugDevice_post'])) && $this->acl_is_writeable("gotoHotplugDeviceDN")){
+ if($this->acl_is_writeable("gotoHotplugDeviceDN")){
foreach($_POST['gotoHotplugDevice_post'] as $name){
unset($this->gotoHotplugDevices[$name]);
}
}
/* There are already defined hotplugs from other users we could use */
- if(isset($_POST['gotoHotplugDeviceUse']) && $this->acl_is_writeable("gotoHotplugDevice")){
+ if(isset($_POST['gotoHotplugDeviceUse']) && $this->acl_is_writeable("gotoHotplugDeviceDN")){
$tmp =array();
foreach($this->gotoHotplugDevices as $plugs){
$tmp[] = $plugs['name'];
}
- $this->dialog = new hotplugDialog($this->config,$tmp);
+ $this->dialog = new hotplugSelect($this->config, get_userinfo());
$this->is_dialog = true;
}
/* Dialog Aborted */
- if(isset($_POST['HotPlugCancel'])){
- unset($this->dialog);
+ if(isset($_POST['hotplugSelect_cancel'])){
$this->dialog= FALSE;
$this->is_dialog = false;
}
/* Dialod saved */
- if(isset($_POST['HotPlugSave'])){
-
- $this->dialog->save_object();
- if(count($this->dialog->check())!=0){
- foreach($this->dialog->check() as $msg){
- msg_dialog::display(_("Error"), $msg, ERROR_DIALOG);
- }
- }else{
- $this->dialog->save_object();
- $a_tmp = $this->dialog->save();
-
- if(is_array($a_tmp)){
- foreach($a_tmp as $name => $hotplug){
- if($this->multiple_support_active){
- $hotplug['UsedByAllUsers'] = TRUE;
- }
- $this->gotoHotplugDevices[$name]= $hotplug;
- }
+ if(isset($_POST['hotplugSelect_save'])){
+
+ $res = $this->dialog->save();
+ foreach($res as $hotplug){
+ $name = $hotplug['cn'][0];
+ $entry['dn'] = $hotplug['dn'];
+
+ /* Set class values */
+ $tmp = preg_split("/\|/",$hotplug['gotoHotplugDevice'][0]);
+ $entry['name'] = $hotplug['cn'][0];
+ $entry['description'] = $tmp[0];
+ $entry['id'] = $tmp[1];
+ $entry['produkt'] = $tmp[2];
+ $entry['vendor'] = $tmp[3];
+ if($this->multiple_support_active){
+ $entry['UsedByAllUsers'] = TRUE;
}
- unset($this->dialog);
- $this->dialog= FALSE;
- $this->is_dialog = false;
+ $this->gotoHotplugDevices[$name]= $entry;
}
+ $this->dialog= FALSE;
+ $this->is_dialog = false;
+ }
+
+ if($this->dialog instanceOf hotplugSelect){
+
+ // Build up blocklist
+ session::set('filterBlacklist', array('cn' => array_keys($this->gotoHotplugDevices)));
+ return($this->dialog->execute());
}
if($this->multiple_support_active){
/* First handle Add Post. Open a dialog that allows us to select a printer or two */
if(isset($_POST['gotoPrinterAdd'])){
-
+ $this->dialog = new printerSelect($this->config,get_userinfo());
$this->is_dialog=true;
- $this->dialog = new selectPrinterDialog($this->config,$this->dn,$this->gotoPrinter);
}
- if(isset($_POST['PrinterCancel'])){
+ if(isset($_POST['printerSelect_cancel']) && $this->dialog instanceOf printerSelect){
$this->is_dialog=false;
- unset($this->dialog);
$this->dialog=FALSE;
}
- if(isset($_POST['PrinterSave'])){
- if(count($this->dialog->check())!=0){
- $tmp = $this->dialog->check();
- foreach($tmp as $msg){
- msg_dialog::display(_("Error"), $msg, ERROR_DIALOG);
- }
- }else{
- $this->dialog->save_object();
- $tmp = $this->dialog->save();
- $tmp2= $this->dialog->getPrinter(true);
+ if(isset($_POST['printerSelect_save']) && $this->dialog instanceOf printerSelect){
+
+ $res = $this->dialog->save();
+ foreach($res as $printer){
- foreach($tmp as $pname){
- $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$tmp2[$pname]['dn'],"printer");
- $printerObj->set_acl_base($tmp2[$pname]['dn']);
+ $pname = $printer['cn'][0];
+ $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'], $printer['dn'],"printer");
+ $printerObj->set_acl_base($printer['dn']);
$type = false;
+
if($this->is_group){
if($this->dn == "new"){
$type = "AddGroup";
$type = "AddUser";
}elseif(isset($this->NewDeletedPrinters[$pname])){
$type = "AddUser";
+ }elseif($this->dn == "new"){
+ $type = "AddUser";
}elseif($printerObj->by_object['printgeneric']->AddMember("AddUser",$this->dn)){
$type = "AddUser";
}
}
if($type){
- $this->gotoPrinter[$pname]=$tmp2[$pname];
+ $this->gotoPrinter[$pname]=$printer;
$this->gotoPrinter[$pname]['mode']="user";
$this->add_del_printer_member_was_called = true;
$this->is_dialog=false;
unset($this->dialog);
$this->dialog =FALSE;
- }
}
+ // Display printer selection dialog
+ if($this->dialog instanceOf printerSelect){
+
+ // Build up blocklist
+ session::set('filterBlacklist',array('cn' => array_keys($this->gotoPrinter)));
+ return($this->dialog->execute());
+ }
+
+
if((isset($_POST['gotoPrinterDel']))&&(isset($_POST['gotoPrinterSel']))&&(!empty($_POST['gotoPrinterSel']))){
$printer = $_POST['gotoPrinterSel'];
foreach($printer as $pname){
/* Get all Posted vars
* Setup checkboxes
*/
- $WriteOnly = (!isset($this->parent)|| !$this->parent) && !session::is_set('edit');
if(isset($_POST['iamposted'])){
- $PACL = $this->getacl("gotoProfileServer",$WriteOnly).$this->getacl("gotoProfileQuota",$WriteOnly);
+ $PACL = $this->getacl("gotoProfileServer").$this->getacl("gotoProfileQuota");
if(isset($_POST['kiosk_server'])){
$tmp = $_POST['kiosk_server'];
plugin::save_object();
foreach($this->attributes as $s_attr){
if((!isset($_POST[$s_attr])) ||
- in_array($s_attr,array("gosaDefaultPrinter","gotoShares","gotoHotplugDevices","gotoPrinter","gotoLogonScripts","uid"))) continue;
+ in_array($s_attr,array("gosaDefaultPrinter","gotoShare","gotoHotplugDevices","gotoPrinter","gotoLogonScripts","uid"))) continue;
if(!$this->acl_is_writeable($s_attr)){
continue;
}else{
$this->handle_post_events($mode,array("uid"=>$this->uid));
}
- /* Generate ListBox frindly output for the defined shares
- * Possibly Add or remove an attribute here,
- */
- function printOutAssignedShares()
- {
- $a_return = array();
- if(is_array($this->gotoShares)){
- foreach($this->gotoShares as $share){
- if(preg_match("/^!/",$share['server'])){
- $a_return[$share['name']."|".$share['server']]= preg_replace("/^!/","",$share['server'])."://".$share['name']." - "._("group share");
- }else{
- $a_return[$share['name']."|".$share['server']]= $share['server']."://".$share['name']." on ".$share['mountPoint']." as ".$share['Username'];
- }
- }
- natcasesort($a_return);
- }
- return($a_return);
- }
/* Generate ListBox frindly output for the definedhotplugs
* Possibly Add or remove an attribute here,
#FIXME these ACLs should work for groups too */
static function plInfo()
{
- return (array("plShortName" => _("Environment"),
- "plDescription" => _("Environment settings"), // Description
+ return (array("plShortName" => _("Desktop"),
+ "plDescription" => _("Desktop settings"), // Description
"plSelfModify" => TRUE,
"plDepends" => array("user", "posixAccount"), // This plugin depends on
"plPriority" => 3, // Position in tabs
"plProvidedAcls" => array(
+ "gotoPrinter" => _("Printer") ,
"gotoProfileServer" => _("Profile server") ,
+ "gosaDefaultPrinter" => _("Default printer"),
"gotoProfileQuota" => _("Profile quota") ,
"gotoProfileFlagC" => _("Cache profile localy") ,
- "gotoShare" => _("Shares"),
- "gotoHotplugDevice" => _("Hotplug devices"),
+ "gotoShare" => _("Shares"),
+ "gotoHotplugDeviceDN" => _("Hotplug devices"),
"gotoKioskProfile" => _("Kiosk profile") ,
"gotoProfileFlagL" => _("Resolution changeable during session") ,
"gotoXResolution" => _("Resolution") ,