diff --git a/plugins/admin/applications/class_applicationGeneric.inc b/plugins/admin/applications/class_applicationGeneric.inc
index 7dd82fdc8b18a7e3969d656d6ce66564bb63105e..0918b0f031cf82a4d098f4af11b6e6eea0b153f1 100644 (file)
}
- function generateTempalte(){
- $str= "# This code is part of GOsa (https://gosa.gonicus.de)\n".
- "#\n".
- "# This program is free software; you can redistribute it and/or modify\n".
- "# it under the terms of the GNU General Public License as published by\n".
- "# the Free Software Foundation; either version 2 of the License, or\n".
- "# (at your option) any later version.\n".
- "#\n";
-
- $names = $this->parent->by_object['applicationParameters']->option_name;
- $values = $this->parent->by_object['applicationParameters']->option_value;
+ function generateTemplate(){
+ $str= "# This code is part of GOsa (https://gosa.gonicus.de)\n#\n";
+
+ $values = array();
+ $names = array();
+ if($this->parent->by_object['applicationParameters']->is_account){
+ $names = $this->parent->by_object['applicationParameters']->option_name;
+ $values = $this->parent->by_object['applicationParameters']->option_value;
+ }
if (count($names)){
$str .="# This plugin handles these environment variables:\n";
foreach($names as $index => $name){
// Fix length
- if (strlen($name) < 35){
- $name= sprintf("%.35s", $name);
+ for($i = strlen($name) ; $i < 30 ; $i++){
+ $name= $name." ";
}
- if(isset($values[$index])){
- $str.= "# ".$name."\t\t(e.g. ".$values[$index].")\n";
+ if((isset($values[$index]))&&(!empty($values[$index]))){
+ $str.= "# ".$name."\t(e.g. '".$values[$index]."')\n";
}else{
- $str.= "# ".$name."\n";
+ $str.= "# ".$name."\t("._("no example").")\n";
}
}
$str .= "#\n".
function execute()
{
+ /* Call parent execute */
+ plugin::execute();
+
+ $smarty= get_smarty();
+
/* Do we represent a valid group? */
if (!$this->is_account && $this->parent == NULL){
$display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\"> <b>".
return ($display);
}
- if(isset($_POST['ScriptTemplate'])){
- $head = $this->generateTempalte();
- $scr = $this->gotoLogonScript;
-
- if(preg_match("/### END HEADER ###/",$scr)){
- $pos = strrpos($scr,"### END HEADER ###");
- $pos = $pos + strlen("### END HEADER ###");
- $scr=substr($scr,$pos,(strlen($scr)));
- }
-
- $this->gotoLogonScript = $head.$scr;
- }
+ $head = $this->generateTemplate();
+ $this->gotoLogonScript= $this->generateTemplate().preg_replace('/.*### END HEADER ###/s', '', $this->gotoLogonScript);
if((isset($_POST['upLoad']))&&(isset($_FILES['ScriptFile']))){
$str = file_get_contents($_FILES['ScriptFile']['tmp_name']);
}
/* Fill templating stuff */
- $smarty= get_smarty();
$smarty->assign("cn", $this->cn);
$smarty->assign("bases", $this->config->idepartments);
if ($this->dn == "new"){
$smarty->assign("rand", rand(0, 10000));
/* Variables */
- foreach(array("description", "gosaApplicationExecute", "gosaApplicationName") as $val){
+ foreach(array("description", "gosaApplicationExecute", "gosaApplicationName","cn") as $val){
$smarty->assign($val, $this->$val);
$smarty->assign($val."ACL", chkacl($this->acl, $val));
}
/* Checkboxes */
foreach (array("G" => "exec_for_groupmembers", "O" => "overwrite_config",
+ "L" => "place_on_kicker",
"D" => "place_on_desktop", "M" => "place_in_startmenu") as $key => $val){
if (preg_match("/$key/", $this->gosaApplicationFlags)){
$smarty->assign("$val", "checked");
if (isset($_POST['place_on_desktop']) && $_POST['place_on_desktop'] == 1){
$flag.= "D";
}
+ if (isset($_POST['place_on_kicker']) && $_POST['place_on_kicker'] == 1){
+ $flag.= "L";
+ }
if (isset($_POST['place_in_startmenu']) && $_POST['place_in_startmenu'] == 1){
$flag.= "M";
}
/* Check for existing application */
$ldap= $this->config->get_ldap_link();
$ldap->cd($this->config->current["BASE"]);
- $ldap->search("(&(objectClass=gosaApplication)(cn=$this->cn))");
+ $ldap->search("(&(objectClass=gosaApplication)(cn=$this->cn))",array("cn"));
$ldap->fetch();
if ($ldap->count() != 0 && $this->dn == "new"){
$message[]= _("There's already an application with this 'Name'.");