- 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',$virtual);
+ $tpl->fillin('DIR',$dir);
+ $tpl->fillin('URL',equal_url($config->{'httproot'},$virtual));
+ $tpl->fillin('SCRIPT',$script);
+ $tpl->fillin('MD5SUM',$md5file);
+ $tpl->fillin('CONTENT',encode_entities($content));
+
+ $tpl->parse_if_block('error',1);
+
+ my $data = header(-type => 'text/html');
+ $data .= $tpl->get_template;
+
+ $output = \$data;
+ }
+ else
+ {
+ # The file was saved successfully!
+
+ if($md5data ne $md5file)
+ {
+ seek(FILE,0,0);
+ truncate(FILE,0);
+
+ print FILE $content;
+ }
+
+ $output = devedit_reload({command => 'show', file => $dir});
+
+ #return error($config->{'errors'}->{'edit_failed'},$dir,{FILE => $virtual});
+ }
+
+ close(FILE);
+
+ return $output;