Files in the right-hand list are now sorted case-insensitively.
When uploading a file, you can now select which Unix user it gets uploaded as.
Added Module Config options for the default unzip mode and default user to upload as.
+---- Changes since 1.360 ----
+Added a Module Config option to specify file extensions to treat as HTML, rather than always using only .html and .htm.
// Use text editor for HTML
boolean force_text;
+ // File extensions to consider as HTML
+ String htmlexts[];
+
public void init()
{
setLayout(new BorderLayout());
String force_text_str = getParameter("force_text");
if (force_text_str != null && force_text_str.equals("1"))
force_text = true;
+ String htmlexts_str = getParameter("htmlexts");
+ if (htmlexts_str == null || htmlexts_str.equals(""))
+ htmlexts_str = ".htm .html";
+ htmlexts = DFSAdminExport.split(htmlexts_str);
// download language strings
String l[] = get_text("lang.cgi");
new ErrorWindow(text("top_efile"));
else if (f.type == 0 || f.type > 4)
new ErrorWindow(text("edit_enormal"));
- else if ((f.path.toLowerCase().endsWith(".htm") ||
- f.path.toLowerCase().endsWith(".html")) &&
- !force_text) {
+ else if (is_html_filename(f.path) && !force_text) {
// Open HTML editor
try {
JSObject win = JSObject.getWindow(this);
}
}
+ boolean is_html_filename(String path)
+ {
+ for(int i=0; i<htmlexts.length; i++)
+ if (path.toLowerCase().endsWith(htmlexts[i]))
+ return true;
+ return false;
+ }
+
boolean under_root_dir(String p, String roots[])
{
boolean can = false;
this.root = root;
}
- String[] split(String s)
+ static String[] split(String s)
{
StringTokenizer stok = new StringTokenizer(s, " ");
String rv[] = new String[stok.countTokens()];
force_text=Editor for HTML files,1,1-Text editor,0-HTML editor
defzip=Default archive mode for uploads,1,2-Extract and delete,1-Extract,0-Do nothing
defuser=Default user for uploads,10,root-root,*-Same as directory,Other user
+htmlexts=File extensions to edit as HTML,3,Default (.htm and .html)
&ReadParse();
# Work out editing mode
-if ($in{'text'} || $in{'file'} && $in{'file'} !~ /\.(htm|html|shtml)$/i) {
+if ($in{'text'} || $in{'file'} && !&is_html_file($in{'file'})) {
$text_mode = 1;
}
&popup_footer();
-
+sub is_html_file
+{
+local ($file) = @_;
+local @exts = split(/\s+/, $userconfig{'htmlexts'} || $config{'htmlexts'});
+@exts = ( ".htm", ".html", ".shtml" ) if (!@exts);
+foreach my $e (@exts) {
+ return 1 if ($file =~ /\Q$e\E$/i);
+ }
+return 0;
+}