diff --git a/gosa-plugins/goto/admin/systems/services/kiosk/class_goKioskService.inc b/gosa-plugins/goto/admin/systems/services/kiosk/class_goKioskService.inc
index f804633f1e0e90b390da8c96698903513dc32e51..ca1410f82acb18f8a48b09ea405b633421cf4fd0 100644 (file)
/* Load list of profiles and check if they still exists */
if ($this->baseDir == ""){
- print_red(_("There is no KIOSKPATH defined in your gosa.conf. Can't manage kiosk profiles!"));
+ msg_dialog::display(_("Configuration error"), msgPool::cmdnotfound("KIOSKPATH",_("Kiosk profile service")), ERROR_DIALOG);
}else{
$this->gotoKioskProfiles = array();
if(isset($this->attrs['gotoKioskProfile']) && is_array($this->attrs['gotoKioskProfile'])){
$ldap = $this->config->get_ldap_link();
$ldap->cd($this->config->current['BASE']);
$ldap->search("(&(objectClass=gotoEnvironment)(gotoKioskProfile=*/".$this->cn."/*))",array("cn"));
- $str ="";
- $cnt = 3;
- while($cnt && $attrs = $ldap->fetch()){
- $str .= $attrs['cn'][0].", ";
- $cnt --;
- }
- $str = preg_replace("/, $/","",$str);
- if($cnt != 3){
- print_red(sprintf(_("Can not remove kiosk profile service, it is currently in use by following user(s) : %s."),$str));
+ if ($ldap->count() != 0){
+ $obj= array();
+ while($attrs = $ldap->fetch()){
+ $obj[$ldap->getDN()]= $attrs['cn'][0];
+ }
+ msg_dialog::display(_("Error"), msgPool::stillInUse(_("Kiosk profile service"), msgPool::buildList($obj)), ERROR_DIALOG);
}else{
goService::remove_from_parent();
}
'exists' => TRUE);
$this->gotoKioskProfiles[] = $tmp;
}
- if(!is_writeable($this->baseDir)){
- print_red(sprintf(_("Can't save new kiosk profiles, possibly permission denied for folder: '%s'."),$this->baseDir));
- }
}
$only_once = true;
$ldap = $this->config->get_ldap_link();
$ldap->cd($this->config->current['BASE']);
$ldap->search("(&(objectClass=gotoEnvironment)(gotoKioskProfile=*".$name.")",array("cn","uid","gotoKioskProfile"));
- $used_by = "";
- $cnt = 3;
- while(($attrs = $ldap->fetch()) && ($cnt)){
- $cnt --;
- $check = preg_replace("/^.*\//i","",$attrs['gotoKioskProfile'][0]);
- if($check == $name){
- $used_by .= $attrs['cn'][0].", ";
+
+ if ($ldap->count() != 0){
+
+ $obj= array();
+ $found= false;
+ while(($attrs = $ldap->fetch()) && ($cnt)){
+ $check = preg_replace("/^.*\//i","",$attrs['gotoKioskProfile'][0]);
+ if($check == $name){
+ $obj[$ldap->getDN()]= $attrs['cn'][0];
+ $found= true;
+ }
+ }
+
+ if ($found){
+ msg_dialog::display(_("Error"), msgPool::stillInUse(_("Kiosk profile"), msgPool::buildList($obj)), ERROR_DIALOG);
}
- }
- $used_by = preg_replace("/, $/","",$used_by);
- if(!empty($used_by)){
- print_red(sprintf(_("Can't remove kioks profile, it is still in use by the following objects '%s'."),$used_by));
}else{
if($this->gotoKioskProfiles[$id]['initial']){
$res = @unlink($filename);
if(!$res){
if(!is_writeable($filename)){
- print_red(sprintf(_("Can't delete '%s'. Error was: permission denied."), $filename));
+ msg_dialog::display(_("Error"), msgPool::cannotDeleteFile($filename), ERROR_DIALOG);
}
if(!file_exists($filename)){
- print_red(sprintf(_("Can't delete '%s'. Error was: file doesn't exist."), $filename));
+ msg_dialog::display(_("Error"), msgPool::fileDoesNotExist($filename), ERROR_DIALOG);
}
}
unset($this->gotoKioskProfiles[$id]);
foreach($this->gotoKioskProfiles as $key => $val ){
$divlist->AddEntry(array(
array("string"=>"<a href='?plug=".$_GET['plug']."&getkiosk=".$val['name']."'>".$val['name']."</a>"),
- array("string"=>"<input type='image' src='images/edittrash.png'
+ array("string"=>"<input type='image' src='images/lists/trash.png'
class='center' alt='delete' name='delkiosk_".$key."'>" ,
"attach"=>" style='border-right: 0px;width:24px; text-align:center;' ")
));
$path = $this->baseDir."/".$profile['name'];
$fp = @fopen($path,"w");
if(!$fp){
- print_red(_("Can't save new kiosk profiles, possibly permission denied for folder")." : ",$path);
+ msg_dialog::display(_("Error"), msgPool::cannotWriteFile($path), ERROR_DIALOG);
}else{
fwrite($fp,$contents,strlen($contents));
$this->attrs['gotoKioskProfile'][] = $method.$profile['name'];