Merge branch 'shf_rename' of github.com:webnotes/wnframework into shf_rename

This commit is contained in:
Nabin Hait 2012-05-23 11:35:16 +05:30
commit 3bb84c68de
6 changed files with 19 additions and 5 deletions

View file

@ -176,6 +176,9 @@ header .container {
header .container, .content {
width: 1100px;
}
div#body_div {
min-height: 600px;
}
}
div.no_script {

4
js/core.min.js vendored
View file

@ -148,6 +148,8 @@ this.prepare_opts();$.extend(this,this.opts);$(this.parent).html(repl('\
<div class="show_filters well">\
<div class="filter_area"></div>\
<div>\
<button class="btn btn-small btn-info search-btn">\
<i class="icon-refresh icon-white"></i> Search</button>\
<button class="btn btn-small add-filter-btn">\
<i class="icon-plus"></i> Add Filter</button>\
</div>\
@ -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);})

View file

@ -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() {

View file

@ -87,6 +87,8 @@ wn.ui.Listing = Class.extend({
<div class="show_filters well">\
<div class="filter_area"></div>\
<div>\
<button class="btn btn-small btn-info search-btn">\
<i class="icon-refresh icon-white"></i> Search</button>\
<button class="btn btn-small add-filter-btn">\
<i class="icon-plus"></i> Add Filter</button>\
</div>\
@ -165,6 +167,7 @@ wn.ui.Listing = Class.extend({
this.add_button('Refresh', function() {
me.run();
}, 'icon-refresh');
}
// new

View file

@ -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);
}
}

View file

@ -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)))