From e390b9be15a05a1b0fc46da0fc7381be3d37ec92 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 18 May 2012 11:48:18 +0530 Subject: [PATCH 1/4] added search button in filters --- js/core.min.js | 4 +++- js/wn/ui/filters.js | 4 +++- js/wn/ui/listing.js | 3 +++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/js/core.min.js b/js/core.min.js index e8b6500088..fdf02ad2bd 100644 --- a/js/core.min.js +++ b/js/core.min.js @@ -148,6 +148,8 @@ this.prepare_opts();$.extend(this,this.opts);$(this.parent).html(repl('\
\
\
\ + \ \
\ @@ -194,7 +196,7 @@ if(this.onrun)this.onrun();if(this.callback)this.callback(r);},render_list:funct /* * lib/js/wn/ui/filters.js */ -wn.ui.FilterList=Class.extend({init:function(opts){wn.require('lib/js/legacy/widgets/form/fields.js');$.extend(this,opts);this.filters=[];this.$w=this.$parent;this.set_events();},set_events:function(){var me=this;this.$w.find('.add-filter-btn').bind('click',function(){me.add_filter();});},show_filters:function(){this.$w.find('.show_filters').toggle();if(!this.filters.length) +wn.ui.FilterList=Class.extend({init:function(opts){wn.require('lib/js/legacy/widgets/form/fields.js');$.extend(this,opts);this.filters=[];this.$w=this.$parent;this.set_events();},set_events:function(){var me=this;this.$w.find('.add-filter-btn').bind('click',function(){me.add_filter();});this.$w.find('.search-btn').bind('click',function(){me.listobj.run();});},show_filters:function(){this.$w.find('.show_filters').toggle();if(!this.filters.length) this.add_filter();},add_filter:function(fieldname,condition,value){this.filters.push(new wn.ui.Filter({flist:this,fieldname:fieldname,condition:condition,value:value}));if(fieldname){this.$w.find('.show_filters').toggle(true);}},get_filters:function(){var values=[];$.each(this.filters,function(i,f){if(f.field) values.push(f.get_value());}) return values;},update_filters:function(){var fl=[];$.each(this.filters,function(i,f){if(f.field)fl.push(f);}) diff --git a/js/wn/ui/filters.js b/js/wn/ui/filters.js index df35e5d0f4..79825f6c89 100644 --- a/js/wn/ui/filters.js +++ b/js/wn/ui/filters.js @@ -34,7 +34,9 @@ wn.ui.FilterList = Class.extend({ this.$w.find('.add-filter-btn').bind('click', function() { me.add_filter(); }); - + this.$w.find('.search-btn').bind('click', function() { + me.listobj.run(); + }); }, show_filters: function() { diff --git a/js/wn/ui/listing.js b/js/wn/ui/listing.js index 11de8b1215..fcd28f24ae 100644 --- a/js/wn/ui/listing.js +++ b/js/wn/ui/listing.js @@ -87,6 +87,8 @@ wn.ui.Listing = Class.extend({
\
\
\ + \ \
\ @@ -165,6 +167,7 @@ wn.ui.Listing = Class.extend({ this.add_button('Refresh', function() { me.run(); }, 'icon-refresh'); + } // new From 730309483c1c02e43bc0c8d7ed4538e1f682891f Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 18 May 2012 17:38:40 +0530 Subject: [PATCH 2/4] do not allow changing of doctype and module of standard print formats --- py/core/doctype/print_format/print_format.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/py/core/doctype/print_format/print_format.js b/py/core/doctype/print_format/print_format.js index c3544405c5..31f6ad6069 100644 --- a/py/core/doctype/print_format/print_format.js +++ b/py/core/doctype/print_format/print_format.js @@ -1,5 +1,7 @@ cur_frm.cscript.refresh = function(doc, dt, dn) { if (doc.standard == 'Yes') { set_field_permlevel('html', 1); + set_field_permlevel('doc_type', 1); + set_field_permlevel('module', 1); } } \ No newline at end of file From 3ee7495d94397aabadb211539488db68a6db5fc0 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 21 May 2012 13:13:15 +0530 Subject: [PATCH 3/4] change session cache storage as json --- py/webnotes/session_cache.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/py/webnotes/session_cache.py b/py/webnotes/session_cache.py index e317efb720..6c1ef9b3e1 100644 --- a/py/webnotes/session_cache.py +++ b/py/webnotes/session_cache.py @@ -75,11 +75,12 @@ def get(): return bootinfo def load(country): - """load from cache""" + """load from cache""" + import json try: sd = webnotes.conn.sql("select cache from __SessionCache where user='%s' %s" % (webnotes.session['user'], (country and (" and country='%s'" % country) or ''))) if sd: - return eval(sd[0][0]) + return json.loads(sd[0][0]) else: return None except Exception, e: @@ -90,6 +91,7 @@ def load(country): def add_to_cache(bootinfo, country): """add to cache""" + import json import webnotes.model.utils if bootinfo.get('docs'): @@ -102,4 +104,4 @@ def add_to_cache(bootinfo, country): # make new webnotes.conn.sql("""insert into `__SessionCache` (user, country, cache) VALUES (%s, %s, %s)""", \ - (webnotes.session['user'], country, str(bootinfo))) + (webnotes.session['user'], country, json.dumps(bootinfo))) From 4c469b1914d9a08ddbf9b4ab5abfb9e24c52c389 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 21 May 2012 18:41:15 +0530 Subject: [PATCH 4/4] increased length of body-div to accomodate larger screen size --- css/legacy/body.css | 3 +++ 1 file changed, 3 insertions(+) diff --git a/css/legacy/body.css b/css/legacy/body.css index 774b523005..4c4c7b35ec 100644 --- a/css/legacy/body.css +++ b/css/legacy/body.css @@ -176,6 +176,9 @@ header .container { header .container, .content { width: 1100px; } + div#body_div { + min-height: 600px; + } } div.no_script {