Merge branch 'master' into edge

This commit is contained in:
Anand Doshi 2013-04-01 19:19:30 +05:30
commit c7300a679a
10 changed files with 122 additions and 13 deletions

View file

@ -42,7 +42,6 @@ CREATE TABLE `tabDocField` (
`in_list_view` int(1) DEFAULT NULL,
`no_column` int(1) DEFAULT NULL,
`read_only` int(1) DEFAULT NULL,
`print_width` varchar(180) DEFAULT NULL,
PRIMARY KEY (`name`),
KEY `parent` (`parent`),
KEY `label` (`label`),

View file

View file

@ -0,0 +1,51 @@
wn.pages['update-manager'].onload = function(wrapper) {
wn.ui.make_app_page({
parent: wrapper,
title: 'Update This Application',
single_column: true
});
wrapper.update_this_app = new wn.UpdateThisApp(wrapper);
};
wn.UpdateThisApp = Class.extend({
init: function(wrapper) {
this.wrapper = wrapper;
this.body = $(this.wrapper).find(".layout-main");
this.wrapper.appframe.add_home_breadcrumb();
this.wrapper.appframe.add_module_breadcrumb("Setup");
this.wrapper.appframe.add_breadcrumb("icon-magnet");
this.make();
},
make: function() {
var me = this;
if(wn.boot && wn.boot.expires_on) {
wn.utils.set_intro(this.wrapper, $("<div></div>").appendTo(this.body),
wn._('This feature is only applicable to self hosted instances'));
} else {
this.wrapper.appframe.add_button(wn._("Get Latest Updates"),
function() { me.update_this_app(this); }, "icon-rss");
this.wrapper.update_output = $('<pre class="well update-output"></pre>')
.appendTo(this.body.append("<div></div>"));
this.wrapper.update_output.text(wn._('Click on "Get Latest Updates"'));
}
},
update_this_app: function(btn) {
var me = this;
wn.call({
module: "core",
page: "update_manager",
method: "update_this_app",
callback: function(r) {
me.wrapper.update_output.text(r.message);
},
btn: btn,
});
},
});

View file

@ -0,0 +1,17 @@
# For license information, please see license.txt
from __future__ import unicode_literals
import webnotes
from webnotes import _
@webnotes.whitelist(allow_roles=["System Manager", "Administrator"])
def update_this_app():
import conf
if hasattr(conf, "expires_on"):
return _("This feature is only applicable to self hosted instances")
from webnotes.utils import execute_in_shell, cstr, get_base_path
err, out = execute_in_shell("cd %s && exec ssh-agent lib/wnf.py --update origin master" % \
(get_base_path(),))
return "\n".join(filter(None, [cstr(err), cstr(out)]))

View file

@ -0,0 +1,36 @@
[
{
"creation": "2013-04-01 11:07:42",
"docstatus": 0,
"modified": "2013-04-01 11:07:42",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doctype": "Page",
"module": "Core",
"name": "__common__",
"page_name": "update-manager",
"standard": "Yes",
"title": "Update This Application"
},
{
"doctype": "Page Role",
"name": "__common__",
"parent": "update-manager",
"parentfield": "roles",
"parenttype": "Page"
},
{
"doctype": "Page",
"name": "update-manager"
},
{
"doctype": "Page Role",
"role": "System Manager"
},
{
"doctype": "Page Role",
"role": "Administrator"
}
]

View file

@ -27,7 +27,7 @@ $.extend(wn.model, {
if(doclist._kl)
doclist = wn.model.expand(doclist);
if(doclist && sync_in==locals)
if(doclist && doclist.length && sync_in==locals)
wn.model.clear_doclist(doclist[0].doctype, doclist[0].name)
$.each(doclist, function(i, d) {

View file

@ -83,28 +83,32 @@ wn.ui.AppFrame = Class.extend({
new_doc(doctype);
}
}
}]
}];
if(!locals.DocType[doctype].issingle) {
views.push({
icon: "icon-list",
route: "List/" + doctype,
type: "list"
});
};
}
if(locals.DocType[doctype].__calendar_js) {
views.push({
icon: "icon-calendar",
route: "Calendar/" + doctype,
type: "calendar"
})
});
}
if(wn.model.can_get_report(doctype)) {
views.push({
icon: "icon-table",
route: "Report2/" + doctype,
type: "report"
})
});
}
this.set_views(views, active_view);
},

View file

@ -182,7 +182,7 @@ def get_db_password(db_name):
whitelisted = []
guest_methods = []
def whitelist(allow_guest=False, allow_roles=[]):
def whitelist(allow_guest=False, allow_roles=None):
"""
decorator for whitelisting a function

View file

@ -258,7 +258,6 @@ class CookieManager:
webnotes.cookies[b'sid'] = webnotes.session['sid'].encode('utf-8')
webnotes.cookies[b'sid'][b'expires'] = expires.encode('utf-8')
webnotes.cookies[b'sid'][b'path'] = b'/'
def set_remember_me(self):
from webnotes.utils import cint

View file

@ -593,15 +593,18 @@ def getchildren(name, childtype, field='', parenttype='', from_doctype=0, prefix
import webnotes
from webnotes.model.doclist import DocList
tmp = ''
condition = ""
values = []
if field:
tmp = ' and parentfield="%s" ' % field
condition += ' and parentfield=%s '
values.append(field)
if parenttype:
tmp = ' and parenttype="%s" ' % parenttype
condition += ' and parenttype=%s '
values.append(parenttype)
dataset = webnotes.conn.sql("select * from `%s%s` where parent='%s' %s order by idx" \
% (prefix, childtype, name, tmp))
dataset = webnotes.conn.sql("""select * from `%s%s` where parent=%s %s order by idx""" \
% (prefix, childtype, "%s", condition), tuple([name]+values))
desc = webnotes.conn.get_description()
l = DocList()