From 170a819482a2d27dae997b83c5f30313f64edc1a Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 28 Dec 2012 15:33:36 +0530 Subject: [PATCH 1/5] fixes in set_route for null --- public/js/wn/router.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/js/wn/router.js b/public/js/wn/router.js index 77f9496c92..e74d6d1b1f 100644 --- a/public/js/wn/router.js +++ b/public/js/wn/router.js @@ -72,7 +72,7 @@ wn.get_route_str = function(route) { } wn.set_route = function() { - route = $.map(arguments, function(a) { return encodeURIComponent(a) }).join('/'); + route = $.map(arguments, function(a) { return a ? encodeURIComponent(a) : null; }).join('/'); window.location.hash = route; // Set favicon (app.js) From 25aebc90c2b79f6056e0143da7d66d53b1a9d0eb Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 28 Dec 2012 15:36:16 +0530 Subject: [PATCH 2/5] removed print options from new report --- public/js/wn/views/grid_report.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/public/js/wn/views/grid_report.js b/public/js/wn/views/grid_report.js index 9b8b9da3e7..5037bac9a6 100644 --- a/public/js/wn/views/grid_report.js +++ b/public/js/wn/views/grid_report.js @@ -268,7 +268,7 @@ wn.views.GridReport = Class.extend({ if (col.formatter==me.currency_formatter) { item[col.id] = 0; } - }); + }); }, refresh: function() { @@ -302,11 +302,10 @@ wn.views.GridReport = Class.extend({ // print / export $('
\ - \ - Print \ - | \ - Export \ + \ + \ + Export \
').appendTo(this.wrapper); this.wrapper.find(".grid-report-export").click(function() { return me.export(); }); From 872d32f6bbd924c82fc6492e25fc44ae4ff48047 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 28 Dec 2012 15:37:00 +0530 Subject: [PATCH 3/5] option for join query in data dumping for report --- webnotes/widgets/report_dump.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/webnotes/widgets/report_dump.py b/webnotes/widgets/report_dump.py index af67faadcc..c0d4394643 100644 --- a/webnotes/widgets/report_dump.py +++ b/webnotes/widgets/report_dump.py @@ -41,11 +41,12 @@ def get_data(): conditions += " where " + " and ".join(args["conditions"]) if args.get("order_by"): order_by = " order by " + args["order_by"] + table = args.get("from") or ("`tab%s`" % d) out[d] = {} start = datetime.datetime.now() - out[d]["data"] = [list(t) for t in webnotes.conn.sql("""select %s from `tab%s` %s %s""" % (",".join(args["columns"]), - d, conditions, order_by))] + out[d]["data"] = [list(t) for t in webnotes.conn.sql("""select %s from %s %s %s""" \ + % (",".join(args["columns"]), table, conditions, order_by))] out[d]["time"] = str(datetime.datetime.now() - start) out[d]["columns"] = map(lambda c: c.split(" as ")[-1], args["columns"]) From d7663ea789c40e7dc65bdf097d14c6d36ef6d0b5 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 28 Dec 2012 16:46:16 +0530 Subject: [PATCH 4/5] commonified code to set intro and footnote, removed print option from grid reports --- public/js/legacy/widgets/form/form.js | 26 +++--------------------- public/js/wn/misc/utils.js | 29 ++++++++++++++++++++++++++- public/js/wn/views/grid_report.js | 1 - 3 files changed, 31 insertions(+), 25 deletions(-) diff --git a/public/js/legacy/widgets/form/form.js b/public/js/legacy/widgets/form/form.js index 9cc7a61b31..41f72f8ba2 100644 --- a/public/js/legacy/widgets/form/form.js +++ b/public/js/legacy/widgets/form/form.js @@ -306,31 +306,11 @@ _f.Frm.prototype.setup_footer = function() { } _f.Frm.prototype.set_intro = function(txt) { - if(!this.intro_area) { - this.intro_area = $('
') - .insertBefore(this.page_layout.body.firstChild); - } - if(txt) { - if(txt.search(/

/)==-1) txt = '

' + txt + '

'; - this.intro_area.html(txt); - } else { - this.intro_area.remove(); - this.intro_area = null; - } + wn.utils.set_intro(this, this.page_layout.body, txt); } _f.Frm.prototype.set_footnote = function(txt) { - if(!this.footnote_area) { - this.footnote_area = $('
') - .insertAfter(this.page_layout.body.lastChild); - } - if(txt) { - if(txt.search(/

/)==-1) txt = '

' + txt + '

'; - this.footnote_area.html(txt); - } else { - this.footnote_area.remove(); - this.footnote_area = null; - } + wn.utils.set_footnote(this, this.page_layout.body, txt); } @@ -343,7 +323,7 @@ _f.Frm.prototype.setup_fields_std = function() { this.layout.addrow(); // default section break if(fl[0].fieldtype!="Column Break") {// without column too var c = this.layout.addcell(); - $y(c.wrapper, {padding: '8px'}); + $y(c.wrapper, {padding: '8px'}); } } diff --git a/public/js/wn/misc/utils.js b/public/js/wn/misc/utils.js index 1e3b479bb1..545094e48f 100644 --- a/public/js/wn/misc/utils.js +++ b/public/js/wn/misc/utils.js @@ -40,5 +40,32 @@ wn.utils = { } else { return list; } - } + }, + set_intro: function(me, wrapper, txt) { + if(!me.intro_area) { + me.intro_area = $('
') + .insertBefore(wrapper.firstChild); + } + if(txt) { + if(txt.search(/

/)==-1) txt = '

' + txt + '

'; + me.intro_area.html(txt); + } else { + me.intro_area.remove(); + me.intro_area = null; + } + }, + set_footnote: function(me, wrapper, txt) { + if(!me.footnote_area) { + me.footnote_area = $('
') + .insertAfter(wrapper.lastChild); + } + + if(txt) { + if(txt.search(/

/)==-1) txt = '

' + txt + '

'; + me.footnote_area.html(txt); + } else { + me.footnote_area.remove(); + me.footnote_area = null; + } + }, } \ No newline at end of file diff --git a/public/js/wn/views/grid_report.js b/public/js/wn/views/grid_report.js index 5037bac9a6..b05ec906a1 100644 --- a/public/js/wn/views/grid_report.js +++ b/public/js/wn/views/grid_report.js @@ -309,7 +309,6 @@ wn.views.GridReport = Class.extend({
').appendTo(this.wrapper); this.wrapper.find(".grid-report-export").click(function() { return me.export(); }); - this.wrapper.find(".grid-report-print").click(function() { msgprint("Coming Soon"); return false; }); // grid wrapper this.grid_wrapper = $("