Merge branch 'devel' of dev.sourcefabric.org:airtime into devel

This commit is contained in:
Martin Konecny 2012-09-10 17:43:40 -04:00
commit e275e286cb
4 changed files with 112 additions and 1 deletions

View File

@ -0,0 +1,108 @@
Before you overwrite dataTables.columnFilter.js, note that we have changed a few lines
in this file.
Running a diff between the original column filter plugin (dataTables.columnFilter_orig.js) and
our modified one (dataTables.columnFilter.js):
denise@denise-DX4860:~/airtime/airtime_mvc/public/js/datatables/plugin$ diff -u dataTables.columnFilter_orig.js dataTables.columnFilter.js
--- dataTables.columnFilter_orig.js 2012-09-10 14:26:30.041095663 -0400
+++ dataTables.columnFilter.js 2012-09-10 17:04:21.017464447 -0400
@@ -103,7 +103,8 @@
label = label.replace(/(^\s*)|(\s*$)/g, "");
var currentFilter = oTable.fnSettings().aoPreSearchCols[i].sSearch;
var search_init = 'search_init ';
- var inputvalue = label;
+ //var inputvalue = label;
+ var inputvalue = '';
if (currentFilter != '' && currentFilter != '^') {
if (bIsNumber && currentFilter.charAt(0) == '^')
inputvalue = currentFilter.substr(1); //ignore trailing ^
@@ -133,29 +134,32 @@
});
} else {
input.keyup(function () {
- if (oTable.fnSettings().oFeatures.bServerSide && iFilterLength != 0) {
- //If filter length is set in the server-side processing mode
- //Check has the user entered at least iFilterLength new characters
-
- var currentFilter = oTable.fnSettings().aoPreSearchCols[index].sSearch;
- var iLastFilterLength = $(this).data("dt-iLastFilterLength");
- if (typeof iLastFilterLength == "undefined")
- iLastFilterLength = 0;
- var iCurrentFilterLength = this.value.length;
- if (Math.abs(iCurrentFilterLength - iLastFilterLength) < iFilterLength
- //&& currentFilter.length == 0 //Why this?
- ) {
- //Cancel the filtering
- return;
- }
- else {
- //Remember the current filter length
- $(this).data("dt-iLastFilterLength", iCurrentFilterLength);
+ var advSearchFields = $("div#advanced_search").children(':visible');
+ if(validateAdvancedSearch(advSearchFields)){
+ if (oTable.fnSettings().oFeatures.bServerSide && iFilterLength != 0) {
+ //If filter length is set in the server-side processing mode
+ //Check has the user entered at least iFilterLength new characters
+
+ var currentFilter = oTable.fnSettings().aoPreSearchCols[index].sSearch;
+ var iLastFilterLength = $(this).data("dt-iLastFilterLength");
+ if (typeof iLastFilterLength == "undefined")
+ iLastFilterLength = 0;
+ var iCurrentFilterLength = this.value.length;
+ if (Math.abs(iCurrentFilterLength - iLastFilterLength) < iFilterLength
+ //&& currentFilter.length == 0 //Why this?
+ ) {
+ //Cancel the filtering
+ return;
+ }
+ else {
+ //Remember the current filter length
+ $(this).data("dt-iLastFilterLength", iCurrentFilterLength);
+ }
}
+ /* Filter on the column (the index) of this element */
+ oTable.fnFilter(this.value, _fnColumnIndex(index), regex, smart); //Issue 37
+ fnOnFiltered();
}
- /* Filter on the column (the index) of this element */
- oTable.fnFilter(this.value, _fnColumnIndex(index), regex, smart); //Issue 37
- fnOnFiltered();
});
}
@@ -168,7 +172,8 @@
input.blur(function () {
if (this.value == "") {
$(this).addClass("search_init");
- this.value = asInitVals[index];
+ //this.value = asInitVals[index];
+ this.value = "";
}
});
}
@@ -228,14 +233,16 @@
$('#' + sFromId + ',#' + sToId, th).keyup(function () {
-
- var iMin = document.getElementById(sFromId).value * 1;
- var iMax = document.getElementById(sToId).value * 1;
- if (iMin != 0 && iMax != 0 && iMin > iMax)
- return;
-
- oTable.fnDraw();
- fnOnFiltered();
+ var advSearchFields = $("div#advanced_search").children(':visible');
+ if(validateAdvancedSearch(advSearchFields)){
+ var iMin = document.getElementById(sFromId).value * 1;
+ var iMax = document.getElementById(sToId).value * 1;
+ if (iMin != 0 && iMax != 0 && iMin > iMax)
+ return;
+
+ oTable.fnDraw();
+ fnOnFiltered();
+ }
});

View File

@ -477,6 +477,7 @@ class AirtimeApiClient():
def list_all_db_files(self, dir_id, all_files=True):
logger = self.logger
try:
all_files = u"1" if all_files else u"0"
url = self.construct_url("list_all_db_files")
url = url.replace("%%dir_id%%", dir_id)
url = url.replace("%%all%%", all_files)

View File

@ -54,6 +54,7 @@ class AirtimeNotifier(Loggable):
message.ack()
self.logger.info("Received md from RabbitMQ: %s" % str(body))
m = json.loads(message.body)
if 'directory' in m: m['directory'] = normpath(m['directory'])
self.handler.message(m)
class AirtimeMessageReceiver(Loggable):
@ -119,6 +120,7 @@ class AirtimeMessageReceiver(Loggable):
% md_path, e)
def new_watch(self, msg):
msg['directory'] = normpath(msg['directory'])
self.logger.info("Creating watch for directory: '%s'" %
msg['directory'])
if not os.path.exists(msg['directory']):

View File

@ -296,7 +296,7 @@ def organized_path(old_path, root_path, orig_md):
filepath = None
ext = extension(old_path)
def default_f(dictionary, key):
if key in dictionary: return len(dictionary[key]) == 0
if key in dictionary: return len(str(dictionary[key])) == 0
else: return True
# We set some metadata elements to a default "unknown" value because we use
# these fields to create a path hence they cannot be empty Here "normal"