diff --git a/interfaces/Config/templates/_inc_footer_uc.tmpl b/interfaces/Config/templates/_inc_footer_uc.tmpl index 82a0e44..8e3200a 100644 --- a/interfaces/Config/templates/_inc_footer_uc.tmpl +++ b/interfaces/Config/templates/_inc_footer_uc.tmpl @@ -12,6 +12,13 @@ diff --git a/interfaces/Config/templates/staticcfg/css/style.css b/interfaces/Config/templates/staticcfg/css/style.css index d74ab66..5fff7a5 100644 --- a/interfaces/Config/templates/staticcfg/css/style.css +++ b/interfaces/Config/templates/staticcfg/css/style.css @@ -408,6 +408,21 @@ textarea:hover, input[type="date"]:hover, input[type="datetime"]:hover, input[ty margin-right: 10px; top: 0; } +#filebrowser_modal .checkbox { + float: left; + margin: 8px 5px 0x; +} +#filebrowser_modal .checkbox input { + margin-top: 1px; +} +#filebrowser_modal .checkbox input+span { + opacity: 0.6; + font-weight: bold; +} +#filebrowser_modal .checkbox input:checked+span, +#filebrowser_modal .checkbox span:hover { + opacity: 1; +} /* Fix for shifting scrollbars when opening modals */ .modal-open[style="padding-right: 17px;"] .navbar-fixed-top { padding-right: 17px; diff --git a/interfaces/Config/templates/staticcfg/js/script.js b/interfaces/Config/templates/staticcfg/js/script.js index 02f64f2..3d24728 100644 --- a/interfaces/Config/templates/staticcfg/js/script.js +++ b/interfaces/Config/templates/staticcfg/js/script.js @@ -113,6 +113,12 @@ $('#filebrowser_modal').modal('hide'); return false; }) + + // Show hidden folders + $('#show_hidden_folders').off('change') + $('#show_hidden_folders').on('change', function() { + self.browse(self.currentBrowserPath , folderBrowseUrl); + }) // Use custom title instead of default and open modal $('#filebrowser_modal .modal-header h4').text(this.fileBrowserTitle); @@ -124,15 +130,15 @@ // Self-reference var self = this; - // Nothing changed - if (this.currentBrowserPath === path) return; - // Still loading if (this.currentRequest) this.currentRequest.abort(); + + // Show hidden folders on Linux? + var extraHidden = $('#show_hidden_folders').is(':checked') ? '&show_hidden_folders=1' : ''; // Get current folders this.currentBrowserPath = path; - this.currentRequest = $.getJSON(endpoint, { name: path }, function (data) { + this.currentRequest = $.getJSON(endpoint + extraHidden, { name: path }, function (data) { // Clean self.fileBrowserDialog.empty(); diff --git a/sabnzbd/api.py b/sabnzbd/api.py index 9b2fd69..30c320d 100644 --- a/sabnzbd/api.py +++ b/sabnzbd/api.py @@ -775,6 +775,7 @@ def _api_undefined(name, output, kwargs): def _api_browse(name, output, kwargs): """ Return tree of local path """ compact = kwargs.get('compact') + if compact and compact == '1': paths = [] name = platform_encode(kwargs.get('term', '')) @@ -782,7 +783,8 @@ def _api_browse(name, output, kwargs): return report(output, keyword='', data=paths) else: name = platform_encode(name) - paths = folders_at_path(name, True) + show_hidden = kwargs.get('show_hidden_folders') + paths = folders_at_path(name, True, show_hidden) return report(output, keyword='paths', data=paths) diff --git a/sabnzbd/utils/pathbrowser.py b/sabnzbd/utils/pathbrowser.py index 2208d02..4156d52 100644 --- a/sabnzbd/utils/pathbrowser.py +++ b/sabnzbd/utils/pathbrowser.py @@ -52,7 +52,7 @@ def get_win_drives(): bitmask >>= 1 return drives -def folders_at_path(path, include_parent = False): +def folders_at_path(path, include_parent = False, show_hidden = False): """ Returns a list of dictionaries with the folders contained at the given path Give the empty string as the path to list the contents of the root path under Unix this means "/", on Windows this will be a list of drive letters) @@ -90,8 +90,10 @@ def folders_at_path(path, include_parent = False): try: if NT: doit = (win32api.GetFileAttributes(fpath) & MASK) == TMASK and filename != 'PerfLogs' - else: + elif not show_hidden: doit = not filename.startswith('.') + else: + doit = True except: doit = False if doit: