@@ -0,0 +1,51 @@ | |||||
wn.pages['update-this-app'].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("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("Click - Get Latest Updates"); | |||||
} | |||||
}, | |||||
update_this_app: function(btn) { | |||||
var me = this; | |||||
wn.call({ | |||||
module: "core", | |||||
page: "update_this_app", | |||||
method: "update_this_app", | |||||
callback: function(r) { | |||||
me.wrapper.update_output.text(r.message); | |||||
}, | |||||
btn: btn, | |||||
}); | |||||
}, | |||||
}); |
@@ -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)])) |
@@ -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-this-app", | |||||
"standard": "Yes", | |||||
"title": "Update This Application" | |||||
}, | |||||
{ | |||||
"doctype": "Page Role", | |||||
"name": "__common__", | |||||
"parent": "update-this-app", | |||||
"parentfield": "roles", | |||||
"parenttype": "Page" | |||||
}, | |||||
{ | |||||
"doctype": "Page", | |||||
"name": "update-this-app" | |||||
}, | |||||
{ | |||||
"doctype": "Page Role", | |||||
"role": "System Manager" | |||||
}, | |||||
{ | |||||
"doctype": "Page Role", | |||||
"role": "Administrator" | |||||
} | |||||
] |
@@ -83,28 +83,32 @@ wn.ui.AppFrame = Class.extend({ | |||||
new_doc(doctype); | new_doc(doctype); | ||||
} | } | ||||
} | } | ||||
}] | |||||
}]; | |||||
if(!locals.DocType[doctype].issingle) { | if(!locals.DocType[doctype].issingle) { | ||||
views.push({ | views.push({ | ||||
icon: "icon-list", | icon: "icon-list", | ||||
route: "List/" + doctype, | route: "List/" + doctype, | ||||
type: "list" | type: "list" | ||||
}); | }); | ||||
}; | |||||
} | |||||
if(locals.DocType[doctype].__calendar_js) { | if(locals.DocType[doctype].__calendar_js) { | ||||
views.push({ | views.push({ | ||||
icon: "icon-calendar", | icon: "icon-calendar", | ||||
route: "Calendar/" + doctype, | route: "Calendar/" + doctype, | ||||
type: "calendar" | type: "calendar" | ||||
}) | |||||
}); | |||||
} | } | ||||
if(wn.model.can_get_report(doctype)) { | if(wn.model.can_get_report(doctype)) { | ||||
views.push({ | views.push({ | ||||
icon: "icon-table", | icon: "icon-table", | ||||
route: "Report2/" + doctype, | route: "Report2/" + doctype, | ||||
type: "report" | type: "report" | ||||
}) | |||||
}); | |||||
} | } | ||||
this.set_views(views, active_view); | this.set_views(views, active_view); | ||||
}, | }, | ||||
@@ -182,7 +182,7 @@ def get_db_password(db_name): | |||||
whitelisted = [] | whitelisted = [] | ||||
guest_methods = [] | guest_methods = [] | ||||
def whitelist(allow_guest=False, allow_roles=[]): | |||||
def whitelist(allow_guest=False, allow_roles=None): | |||||
""" | """ | ||||
decorator for whitelisting a function | decorator for whitelisting a function | ||||