-  return devedit_reload({command => 'show', file => $dir});
- }
- else
- {
-  return error($config->{'errors'}->{'edit_failed'},$dir,{FILE => $virtual});
+   $tpl->fillin('ERROR',$config->{'errors'}->{'edit_file_changed'});
+
+   $tpl->fillin('FILE',encode_html($virtual));
+   $tpl->fillin('FILE_URL',escape($virtual));
+   $tpl->fillin('DIR',encode_html($dir));
+   $tpl->fillin('DIR_URL',escape($dir));
+   $tpl->fillin('URL',equal_url($config->{'httproot'},$virtual));
+   $tpl->fillin('SCRIPT',$script);
+   $tpl->fillin('MD5SUM',$md5file);
+   $tpl->fillin('CONTENT',encode_html($content));
+
+   $tpl->parse_if_block('error',1);
+
+   my $data = header(-type => 'text/html');
+   $data   .= $tpl->get_template;
+
+   $output  = \$data;
+  }
+  else
+  {
+   if($md5data ne $md5file)
+   {
+    seek(FILE,0,0);
+    truncate(FILE,0);
+
+    print FILE $content;
+   }
+
+   $output = devedit_reload({command => 'show', file => $dir});
+  }
+
+  close(FILE);
+
+  return $output;