diff --git a/share/server/core/classes/ViewMapAddModify.php b/share/server/core/classes/ViewMapAddModify.php index 694de1c6e..8772a4afa 100644 --- a/share/server/core/classes/ViewMapAddModify.php +++ b/share/server/core/classes/ViewMapAddModify.php @@ -190,7 +190,7 @@ private function handleAddModify() { } private function getAttr($default_value, $attr, $must, $only_inherited = false) { - $update = !is_action(); + $update = !is_action() && is_update(); // update is true during view repaint // only_inherited is true when only asking for inherited value $val = ''; @@ -207,7 +207,7 @@ private function getAttr($default_value, $attr, $must, $only_inherited = false) // the shown values $val = $this->MAPCFG->getSourceParam($attr, true, true); - } elseif(($this->mode == 'view_params' || !$only_inherited) && $this->object_id !== null + } elseif(!$update && ($this->mode == 'view_params' || !$only_inherited) && $this->object_id !== null && $this->MAPCFG->getValue($this->object_id, $attr, true) !== false) { // Get the value set in this object if there is some set $val = $this->MAPCFG->getValue($this->object_id, $attr, true); @@ -215,7 +215,7 @@ private function getAttr($default_value, $attr, $must, $only_inherited = false) if($this->mode == 'view_params') $isInherited = true; - } elseif(!$only_inherited && $this->clone_id !== null && $attr !== 'object_id' + } elseif(!$update && !$only_inherited && $this->clone_id !== null && $attr !== 'object_id' && $this->MAPCFG->getValue($this->clone_id, $attr, true) !== false) { // Get the value set in the object to be cloned if there is some set // But don't try this when running in "update" mode @@ -313,7 +313,7 @@ private function drawField($propname, $prop, $properties) { // Add a checkbox to toggle the usage of an attribute. But only add it for // non-must attributes. if (!$prop['must'] && $fieldType != 'readonly') { - checkbox('toggle_'.$propname, $isInherited === false, '', 'toggle_option(\''.$propname.'\');'); + checkbox('toggle_'.$propname, $isInherited === false, '', 'toggle_option(\''.$propname.'\');'.$onChange); } echo ''; diff --git a/share/server/core/functions/html.php b/share/server/core/functions/html.php index b194d6bf9..73f130ca4 100644 --- a/share/server/core/functions/html.php +++ b/share/server/core/functions/html.php @@ -92,6 +92,10 @@ function is_action() { return (submitted() || (bool)get('_action')) && post('_update', '0') == '0'; } +function is_update() { + return post('_update', '0') == '1'; +} + function js($code) { echo ''.N; } @@ -134,6 +138,7 @@ function form_start($name, $target, $type = 'POST', $multipart = false) { } function form_end($keep_context=true) { + global $form_name; if ($keep_context) hidden_vars(); echo ''.N;