diff --git a/gosa-plugins/goto/admin/applications/class_applicationParameters.inc b/gosa-plugins/goto/admin/applications/class_applicationParameters.inc
index 30c8ee3383b12fdb4360540b23eab452ad79c3f5..72ab48f878a10e7e965bce05972aab611a6f1720 100644 (file)
/* attribute list for save action */
var $attributes= array("gosaApplicationParameter");
- var $objectclasses= array();
-
- var $CopyPasteVars = array("option_name","option_value");
function applicationParameters (&$config, $dn= NULL, $parent= NULL)
{
plugin::execute();
/* Do we need to flip is_account state? */
- if (isset($_POST['modify_state'])){
- $this->is_account= !$this->is_account;
+ if(isset($_POST['modify_state'])){
+ if($this->is_account && $this->acl_is_removeable()){
+ $this->is_account= FALSE;
+ }elseif(!$this->is_account && $this->acl_is_createable()){
+ $this->is_account= TRUE;
+ }
}
/* Show tab dialog headers */
$display= "";
if ($this->parent !== NULL){
if ($this->is_account){
- $display= $this->show_disable_header(_("Remove options"),
- msgPool::featuresEnabled(_("parameter"));
+ $display= $this->show_disable_header(_("Remove options"),msgPool::featuresEnabled(_("parameter")));
} else {
- $display= $this->show_enable_header(_("Create options"),
- msgPool::featuresDisabled(_("parameter"));
+ $display= $this->show_enable_header(_("Create options"), msgPool::featuresDisabled(_("parameter")));
$this->parent->by_object['application']->generateTemplate();
return ($display);
}
}
- /* Add option to list */
- if (isset($_POST['add_option'])){
- $i= count($this->option_name);
- $this->option_name[$i]= "";
- $this->option_value[$i]= "";
- }
+ if($this->acl_is_writeable("gosaApplicationParameter")){
- /* Remove value from list */
- for ($i= 0; $i<count($this->option_name); $i++){
- if (isset($_POST["remove$i"])){
- $k= 0;
- $on= array();
- $ov= array();
- for ($j= 0; $j<count($this->option_name); $j++){
- if ($j != $i){
- $on[$k]= $this->option_name[$j];
- $ov[$k]= $this->option_value[$j];
- $k++;
+ /* Add option to list */
+ if (isset($_POST['add_option'])){
+ $i= count($this->option_name);
+ $this->option_name[$i]= "";
+ $this->option_value[$i]= "";
+ }
+
+ /* Remove value from list */
+ for ($i= 0; $i<count($this->option_name); $i++){
+ if (isset($_POST["remove$i"])){
+ $k= 0;
+ $on= array();
+ $ov= array();
+ for ($j= 0; $j<count($this->option_name); $j++){
+ if ($j != $i){
+ $on[$k]= $this->option_name[$j];
+ $ov[$k]= $this->option_value[$j];
+ $k++;
+ }
}
+ $this->option_name= $on;
+ $this->option_value= $ov;
+ break;
}
- $this->option_name= $on;
- $this->option_value= $ov;
- break;
}
}
$this->option_name[]= "";
$this->option_value[]= "";
}
+
$acl = $this->getacl("gosaApplicationParameter") ;
- $table= "<table summary=\"\"><tr><td>"._("Variable")."</td><td>"._("Default value")."</td><td></td></tr>";
+ $table= "<table summary=\""._("Application parameter")."\"><tr><td>"._("Variable")."</td><td>"._("Default value")."</td><td></td></tr>";
if (count ($this->option_name)){
for ($i= 0; $i < count($this->option_name); $i++){
$table.="<tr>".
" <td>".
- " <input name=\"option$i\" size=25 maxlength=50 value=\"".$name."\" ".$tag.">".
+ " <input type='text' name=\"option$i\" size=25 maxlength=50 value=\"".set_post($name)."\" ".$tag.">".
" </td>".
" <td>".
- " <input name=\"value$i\" size=60 maxlength=250 value=\"".$value."\" ".$tag.">".
+ " <input type='text' name=\"value$i\" size=60 maxlength=250 value=\"".set_post($value)."\" ".$tag.">".
" <br>".
" </td>".
" <td>".
- " <input type=\"submit\" name=\"remove$i\" value=\""._("Remove")."\" ".$tag.">".
+ " <button type=\"submit\" name=\"remove$i\" ".$tag.">".msgPool::delButton()."</button>".
" </td>".
"</tr>";
}
}
$table.= "</table>";
- $table.="<input type=\"submit\" name=\"add_option\" value=\""._("Add option")."\">";
+ $table.="<button type=\"submit\" name=\"add_option\" $tag >"._("Add option")."</button>";
/* Show main page */
$smarty= get_smarty();
/* Save data to object */
function save_object()
{
- if (isset($_POST['option0'])){
+ if (isset($_POST['option0']) && $this->acl_is_writeable("gosaApplicationParameter")){
for ($i= 0; $i<count($this->option_name); $i++){
- $this->option_name[$i]= $_POST["option$i"];
+ $this->option_name[$i]= get_post("option$i");
$this->option_value[$i]= "";
if ($_POST["value$i"] != ""){
- $this->option_value[$i]= $_POST["value$i"];
+ $this->option_value[$i]= get_post("value$i");
}
}
}
$this->handle_post_events('modify');
}
+
+ function PrepareForCopyPaste($source)
+ {
+ plugin::PrepareForCopyPaste($source);
+
+ $source_o = new applicationParameters($this->config,$source['dn']);
+ $this->option_name = $source_o->option_name;
+ $this->option_value = $source_o->option_value;
+
+ /* Set is_account state so that the save function is called properly */
+ $this->is_account = TRUE;
+ }
+
+
/* Return plugin informations for acl handling
#FIXME FAIscript seams to ununsed within this class... */
static function plInfo()