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 287ed9e36a45a6fc36168300502cce8c48f3ac37..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();
}
$smarty= get_smarty();
$display= "";
+ /* Download kiosk profile
+ */
+ if(isset($_GET['getkiosk'])){
+ $id = $_GET['getkiosk'];
+ foreach($this->gotoKioskProfiles as $profile){
+ if($profile['name'] == $id){
+ $name = $this->baseDir."/".$id;
+ if(file_exists($name)){
+ $content = file_get_contents($name);
+ send_binary_content($content,$id);
+ }
+ }
+ }
+ }
+
+
/* Add new kiosk profile
* in profile directory ($this->baseDir);
*/
'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]);
$divlist -> SetHeight (300);
foreach($this->gotoKioskProfiles as $key => $val ){
$divlist->AddEntry(array(
- array("string"=>"<a target='_blank' href='getkiosk.php?id=".$val['name']."'>".$val['name']."</a>"),
- array("string"=>"<input type='image' src='images/edittrash.png'
+ array("string"=>"<a href='?plug=".$_GET['plug']."&getkiosk=".$val['name']."'>".$val['name']."</a>"),
+ 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;' ")
));
return($smarty->fetch(get_template_path("goKioskService.tpl",TRUE,dirname(__FILE__))));
}
+
+
function getListEntry()
{
$fields = goService::getListEntry();
$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'];
$ldap->cd($this->config->current['BASE']);
$ldap->cd($this->dn);
$ldap->modify($this->attrs);
- show_ldap_error($ldap->get_error(),_("Wohl kaum"));
+ if (!$ldap->success()){
+ msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_MOD, get_class()));
+ }
}