- 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',encode_html(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 = ($cgi->param('continue'))
+ ? devedit_reload({command => 'beginedit', file => $virtual})
+ : devedit_reload({command => 'show', file => $dir});
+ }
+
+ close(FILE);
+
+ return $output;