]> git.wh0rd.org Git - tt-rss.git/commitdiff
fix testing in create filter dialog, woops
authorAndrew Dolgov <noreply@fakecake.org>
Wed, 9 Sep 2015 19:13:43 +0000 (22:13 +0300)
committerAndrew Dolgov <noreply@fakecake.org>
Wed, 9 Sep 2015 19:13:43 +0000 (22:13 +0300)
js/functions.js [changed mode: 0644->0755]
js/prefs.js

old mode 100644 (file)
new mode 100755 (executable)
index 8e56949..2e9e544
@@ -1051,6 +1051,100 @@ function addFilterAction(replaceNode, actionStr) {
        }
 }
 
+function editFilterTest(query) {
+       try {
+
+               if (dijit.byId("filterTestDlg"))
+                       dijit.byId("filterTestDlg").destroyRecursive();
+
+               var test_dlg = new dijit.Dialog({
+                       id: "filterTestDlg",
+                       title: "Test Filter",
+                       style: "width: 600px",
+                       results: 0,
+                       limit: 100,
+                       max_offset: 10000,
+                       getTestResults: function(query, offset) {
+                               var updquery = query + "&offset=" + offset + "&limit=" + test_dlg.limit;
+
+                               console.log("getTestResults:" + offset);
+
+                               new Ajax.Request("backend.php", {
+                                       parameters: updquery,
+                                       onComplete: function (transport) {
+                                               try {
+                                                       var result = JSON.parse(transport.responseText);
+
+                                                       if (result && dijit.byId("filterTestDlg") && dijit.byId("filterTestDlg").open) {
+                                                               test_dlg.results += result.size();
+
+                                                               console.log("got results:" + result.size());
+
+                                                               $("prefFilterProgressMsg").innerHTML = __("Looking for articles (%d processed, %f found)...")
+                                                                       .replace("%f", test_dlg.results)
+                                                                       .replace("%d", offset);
+
+                                                               console.log(offset + " " + test_dlg.max_offset);
+
+                                                               for (var i = 0; i < result.size(); i++) {
+                                                                       var tmp = new Element("table");
+                                                                       tmp.innerHTML = result[i];
+                                                                       dojo.parser.parse(tmp);
+
+                                                                       $("prefFilterTestResultList").innerHTML += tmp.innerHTML;
+                                                               }
+
+                                                               if (test_dlg.results < 30 && offset < test_dlg.max_offset) {
+
+                                                                       // get the next batch
+                                                                       window.setTimeout(function () {
+                                                                               test_dlg.getTestResults(query, offset + test_dlg.limit);
+                                                                       }, 0);
+
+                                                               } else {
+                                                                       // all done
+
+                                                                       Element.hide("prefFilterLoadingIndicator");
+
+                                                                       if (test_dlg.results == 0) {
+                                                                               $("prefFilterTestResultList").innerHTML = "<tr><td align='center'>No recent articles matching this filter have been found.</td></tr>";
+                                                                               $("prefFilterProgressMsg").innerHTML = "Articles matching this filter:";
+                                                                       } else {
+                                                                               $("prefFilterProgressMsg").innerHTML = __("Found %d articles matching this filter:")
+                                                                                       .replace("%d", test_dlg.results);
+                                                                       }
+
+                                                               }
+
+                                                       } else if (!result) {
+                                                               console.log("getTestResults: can't parse results object");
+
+                                                               Element.hide("prefFilterLoadingIndicator");
+
+                                                               notify_error("Error while trying to get filter test results.");
+
+                                                       } else {
+                                                               console.log("getTestResults: dialog closed, bailing out.");
+                                                       }
+                                               } catch (e) {
+                                                       exception_error("editFilterTest/inner", e);
+                                               }
+
+                                       } });
+                       },
+                       href: query});
+
+               dojo.connect(test_dlg, "onLoad", null, function(e) {
+                       test_dlg.getTestResults(query, 0);
+               });
+
+               test_dlg.show();
+
+       } catch (e) {
+               exception_error("editFilterTest", e);
+       }
+}
+
 function quickAddFilter() {
        try {
                var query = "";
@@ -1077,16 +1171,7 @@ function quickAddFilter() {
                        test: function() {
                                var query = "backend.php?" + dojo.formToQuery("filter_new_form") + "&savemode=test";
 
-                               if (dijit.byId("filterTestDlg"))
-                                       dijit.byId("filterTestDlg").destroyRecursive();
-
-                               var test_dlg = new dijit.Dialog({
-                                       id: "filterTestDlg",
-                                       title: "Test Filter",
-                                       style: "width: 600px",
-                                       href: query});
-
-                               test_dlg.show();
+                               editFilterTest(query);
                        },
                        selectRules: function(select) {
                                $$("#filterDlg_Matches input[type=checkbox]").each(function(e) {
index ac6ac20662c740f5a36fdf154aec83d6c3fd21c4..ddcdbe351696ccf9033964e56ca27aa393c2cbb7 100755 (executable)
@@ -131,100 +131,6 @@ function editUser(id, event) {
 
 }
 
-function editFilterTest(query) {
-       try {
-
-               if (dijit.byId("filterTestDlg"))
-                       dijit.byId("filterTestDlg").destroyRecursive();
-
-               var test_dlg = new dijit.Dialog({
-                       id: "filterTestDlg",
-                       title: "Test Filter",
-                       style: "width: 600px",
-                       results: 0,
-                       limit: 100,
-                       max_offset: 10000,
-                       getTestResults: function(query, offset) {
-                               var updquery = query + "&offset=" + offset + "&limit=" + test_dlg.limit;
-
-                               console.log("getTestResults:" + offset);
-
-                               new Ajax.Request("backend.php", {
-                                       parameters: updquery,
-                                       onComplete: function (transport) {
-                                               try {
-                                                       var result = JSON.parse(transport.responseText);
-
-                                                       if (result && dijit.byId("filterTestDlg") && dijit.byId("filterTestDlg").open) {
-                                                               test_dlg.results += result.size();
-
-                                                               console.log("got results:" + result.size());
-
-                                                               $("prefFilterProgressMsg").innerHTML = __("Looking for articles (%d processed, %f found)...")
-                                                                       .replace("%f", test_dlg.results)
-                                                                       .replace("%d", offset);
-
-                                                               console.log(offset + " " + test_dlg.max_offset);
-
-                                                               for (var i = 0; i < result.size(); i++) {
-                                                                       var tmp = new Element("table");
-                                                                       tmp.innerHTML = result[i];
-                                                                       dojo.parser.parse(tmp);
-
-                                                                       $("prefFilterTestResultList").innerHTML += tmp.innerHTML;
-                                                               }
-
-                                                               if (test_dlg.results < 30 && offset < test_dlg.max_offset) {
-
-                                                                       // get the next batch
-                                                                       window.setTimeout(function () {
-                                                                               test_dlg.getTestResults(query, offset + test_dlg.limit);
-                                                                       }, 0);
-
-                                                               } else {
-                                                                       // all done
-
-                                                                       Element.hide("prefFilterLoadingIndicator");
-
-                                                                       if (test_dlg.results == 0) {
-                                                                               $("prefFilterTestResultList").innerHTML = "<tr><td align='center'>No recent articles matching this filter have been found.</td></tr>";
-                                                                               $("prefFilterProgressMsg").innerHTML = "Articles matching this filter:";
-                                                                       } else {
-                                                                               $("prefFilterProgressMsg").innerHTML = __("Found %d articles matching this filter:")
-                                                                                       .replace("%d", test_dlg.results);
-                                                                       }
-
-                                                               }
-
-                                                       } else if (!result) {
-                                                               console.log("getTestResults: can't parse results object");
-
-                                                               Element.hide("prefFilterLoadingIndicator");
-
-                                                               notify_error("Error while trying to get filter test results.");
-
-                                                       } else {
-                                                               console.log("getTestResults: dialog closed, bailing out.");
-                                                       }
-                                               } catch (e) {
-                                                       exception_error("editFilterTest/inner", e);
-                                               }
-
-                                       } });
-                       },
-                       href: query});
-
-               dojo.connect(test_dlg, "onLoad", null, function(e) {
-                       test_dlg.getTestResults(query, 0);
-               });
-
-               test_dlg.show();
-
-       } catch (e) {
-               exception_error("editFilterTest", e);
-       }
-}
-
 function editFilter(id) {
        try {