This commit is contained in:
Rushabh Mehta 2014-02-14 17:28:01 +05:30
parent cc0095be9a
commit 482e55ec33
25 changed files with 64 additions and 44 deletions

View file

@ -416,6 +416,7 @@ def get_hooks(hook=None, app_name=None):
def load_app_hooks(app_name=None):
hooks = {}
for app in [app_name] if app_name else get_installed_apps():
if app=="webnotes": app="frappe"
for item in get_file_items(get_pymodule_path(app, "hooks.txt")):
key, value = item.split("=", 1)
key, value = key.strip(), value.strip()
@ -441,7 +442,8 @@ def setup_module_map():
if not local.app_modules:
local.module_app, local.app_modules = {}, {}
for app in get_all_apps(True):
for app in get_all_apps(True):
if app=="webnotes": app="frappe"
local.app_modules.setdefault(app, [])
for module in get_module_list(app):
local.module_app[module] = app

View file

@ -28,9 +28,9 @@ def main():
if not fn in site_arg_optional:
if not parsed_args.get("site") and os.path.exists("currentsite.txt"):
with open("currentsite.txt", "r") as sitefile:
site = sitefile.read()
else:
site = parsed_args.get("site")
parsed_args["site"] = sitefile.read()
site = parsed_args.get("site")
if not site:
print "Site argument required"

View file

@ -45,7 +45,7 @@ frappe.pages['permission-manager'].onload = function(wrapper) {
"<li>"+frappe._("If 'Restricted' is checked, the owner is always allowed based on Role.")+"</li>"+
"<li>"+frappe._("Once you have set this, the users will only be able access documents where the link (e.g Company) exists.")+"</li>"+
"<li>"+frappe._("Apart from System Manager, roles with Restrict permission can restrict other users for that Document Type")+"</li></ol><hr>\
<p>"+frappe._("If these instructions where not helpful, please add in your suggestions at <a href='https://github.com/frappe/frappe.ramework/issues'>GitHub Issues</a>")+"</p>\
<p>"+frappe._("If these instructions where not helpful, please add in your suggestions at <a href='https://github.com/frappe/frappe/issues'>GitHub Issues</a>")+"</p>\
</tr></td>\
</table>");
wrapper.permission_engine = new frappe.PermissionEngine(wrapper);

View file

@ -29,6 +29,9 @@ def run_all():
def get_all_patches():
patches = []
for app in frappe.get_installed_apps():
# 3-to-4 fix
if app=="webnotes":
app="frappe"
patches.extend(frappe.get_file_items(frappe.get_pymodule_path(app, "patches.txt")))
return patches

View file

@ -10,4 +10,5 @@ frappe.patches.4_0.remove_index_sitemap
frappe.patches.4_0.add_delete_permission
frappe.patches.4_0.move_match_to_restricted
frappe.patches.4_0.set_todo_checked_as_closed
frappe.patches.4_0.website_sitemap_hierarchy
frappe.patches.4_0.website_sitemap_hierarchy
frappe.patches.4_0.webnotes_to_frappe

View file

@ -2,4 +2,7 @@ import frappe
def execute():
frappe.reload_doc("core", "doctype", "todo")
frappe.conn.sql("""update tabToDo set status = if(ifnull(checked,0)=0, 'Open', 'Closed')""")
try:
frappe.conn.sql("""update tabToDo set status = if(ifnull(checked,0)=0, 'Open', 'Closed')""")
except:
pass

View file

@ -0,0 +1,9 @@
import frappe, json
def execute():
installed = frappe.get_installed_apps()
if "webnotes" in installed:
installed.remove("webnotes")
installed = ["frappe"] + installed
frappe.conn.set_global("installed_apps", json.dumps(installed))
frappe.clear_cache()

View file

@ -173,7 +173,7 @@ frappe.Application = Class.extend({
make_nav_bar: function() {
// toolbar
if(frappe.boot) {
frappe.container.frappe.oolbar = new frappe.ui.toolbar.Toolbar();
frappe.container.frappe_toolbar = new frappe.ui.toolbar.Toolbar();
}
},
logout: function() {

View file

@ -1,7 +1,7 @@
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
// MIT License. See license.txt
if(!window.frappe. frappe.= {};
if(!window.frappe) window.frappe = {};
function flt(v, decimals, number_format) {
if(v==null || v=='')return 0;

View file

@ -26,14 +26,14 @@ function prettyDate(time){
var comment_when = function(datetime) {
return '<span class="frappe.timestamp" data-timestamp="'+datetime+'">' + prettyDate(datetime) + '</span>';
return '<span class="frappe-timestamp" data-timestamp="'+datetime+'">' + prettyDate(datetime) + '</span>';
};
frappe.provide("frappe.datetime");
frappe.datetime.comment_when = prettyDate;
frappe.datetime.refresh_when = function() {
if(jQuery) {
$(".frappe.timestamp").each(function() {
$(".frappe-timestamp").each(function() {
$(this).html(prettyDate($(this).attr("data-timestamp")));
})
}

View file

@ -2,7 +2,8 @@
// MIT License. See license.txt
// provide a namespace
if(!window.frappe.frappe.= {}
if(!window.frappe)
window.frappe = {};
frappe.provide = function(namespace) {
// docs: create a namespace //
var nsl = namespace.split('.');

View file

@ -15,7 +15,7 @@ bsEditor = Class.extend({
this.setup_fixed_toolbar();
} else if(this.options.parent) {
this.wrapper = $("<div></div>").appendTo(this.options.parent);
this.setup_editor($("<div class='frappe.editor'></div>").appendTo(this.wrapper));
this.setup_editor($("<div class='frappe-list'></div>").appendTo(this.wrapper));
this.setup_inline_toolbar();
this.editor.css(this.options.inline_editor_style);
this.set_editing();
@ -223,8 +223,8 @@ bsEditorToolbar = Class.extend({
make: function(parent) {
if(!parent)
parent = $("body");
if(!parent.find(".frappe.editor-toolbar").length) {
this.toolbar = $('<div class="frappe.editor-toolbar frappe.ignore-click">\
if(!parent.find(".frappe-list-toolbar").length) {
this.toolbar = $('<div class="frappe-list-toolbar frappe-ignore-click">\
<div class="btn-toolbar" data-role="editor-toolbar" style="margin-bottom: 7px;">\
<div class="btn-group form-group">\
<a class="btn btn-default btn-small dropdown-toggle" data-toggle="dropdown" \
@ -438,7 +438,7 @@ bsHTMLEditor = Class.extend({
style="height: 400px; width: 100%; font-family: Monaco, \'Courier New\', monospace; font-size: 11px">\
</textarea><br>\
<button class="btn btn-primary" style="margin-top: 7px;">Save</button>');
this.modal.addClass("frappe.ignore-click");
this.modal.addClass("frappe-ignore-click");
this.modal.find(".btn-primary").on("click", function() {
var html = me.modal.find("textarea").val();
$.each(me.editor.dataurls, function(key, val) {
@ -480,7 +480,7 @@ bsLinkEditor = Class.extend({
</div>\
<button class="btn btn-primary" style="margin-top: 7px;">Insert</button>');
this.modal.addClass("frappe.ignore-click");
this.modal.addClass("frappe-ignore-click");
this.modal.find(".btn-primary").on("click", function() {
me.toolbar.restore_selection();
var url = me.modal.find("input[type=text]").val();

View file

@ -61,7 +61,7 @@ frappe.ui.Listing = Class.extend({
$.extend(this, this.opts);
$(this.parent).html(repl('\
<div class="frappe.ist">\
<div class="frappe-list">\
<h3 class="title hide">%(title)s</h3>\
\
<div class="list-filters" style="display: none;">\
@ -99,7 +99,7 @@ frappe.ui.Listing = Class.extend({
</p>\
</div>\
', this.opts));
this.$w = $(this.parent).find('.frappe.ist');
this.$w = $(this.parent).find('.frappe-list');
this.set_events();
if(this.appframe) {

View file

@ -53,7 +53,7 @@ frappe.views.DocListView = frappe.ui.Listing.extend({
this.page.doclistview = this;
this.$page = $(this.page).css({"min-height": "400px"});
$('<div class="frappe.ist-area" style="margin-bottom: 25px;">\
$('<div class="frappe-list-area" style="margin-bottom: 25px;">\
<div class="help">'+frappe._('Loading')+'...</div></div>')
.appendTo(this.$page.find(".layout-main-section"));
@ -83,7 +83,7 @@ frappe.views.DocListView = frappe.ui.Listing.extend({
setup: function() {
this.can_delete = frappe.model.can_delete(this.doctype);
this.meta = locals.DocType[this.doctype];
this.$page.find('.frappe.ist-area').empty(),
this.$page.find('.frappe-list-area').empty(),
this.setup_listview();
this.setup_docstatus_filter();
this.init_list(false);
@ -153,7 +153,7 @@ frappe.views.DocListView = frappe.ui.Listing.extend({
},
setup_listview: function() {
this.listview = frappe.views.get_listview(this.doctype, this);
this.wrapper = this.$page.find('.frappe.ist-area');
this.wrapper = this.$page.find('.frappe-list-area');
this.page_length = 20;
this.allow_delete = true;
},

View file

@ -15,7 +15,7 @@ frappe.standard_pages["test-runner"] = function() {
var route = frappe.get_route();
if(route.length < 2) {
msgprint("To run a test add the module name in the route after 'test-runner/'. \
For example, #test-runner/lib/js/frappe.test_app.js");
For example, #test-runner/lib/js/frappe/test_app.js");
return;
}

File diff suppressed because one or more lines are too long

View file

@ -26,9 +26,9 @@
<script>
$(function() {
if(window.logged_in && getCookie("system_user")==="yes") {
wn.has_permission("Blog Post", "{{ name }}", "write", function(r) {
wn.require("assets/frappe/js/wn/website/editable.js");
wn.make_editable($('[itemprop="articleBody"]'), "Blog Post", "{{ name }}", "content");
frappe.has_permission("Blog Post", "{{ name }}", "write", function(r) {
frappe.require("assets/frappe/js/frappe/website/editable.js");
frappe.make_editable($('[itemprop="articleBody"]'), "Blog Post", "{{ name }}", "content");
});
}
});

View file

@ -42,9 +42,9 @@
<script>
$(function() {
if(window.logged_in && getCookie("system_user")==="yes") {
wn.has_permission("Web Page", "{{ docname }}", "write", function(r) {
wn.require("assets/frappe/js/wn/website/editable.js");
wn.make_editable($(".web-page-content"), "Web Page", "{{ docname }}", "main_section");
frappe.has_permission("Web Page", "{{ docname }}", "write", function(r) {
frappe.require("assets/frappe/js/frappe/website/editable.js");
frappe.make_editable($(".web-page-content"), "Web Page", "{{ docname }}", "main_section");
});
}
});

View file

@ -58,11 +58,11 @@ $(document).ready(function() {
}
if(!args.comment_by_fullname || !args.comment_by || !args.comment) {
wn.msgprint("All fields are necessary to submit the comment.")
frappe.msgprint("All fields are necessary to submit the comment.")
return false;
}
wn.call({
frappe.call({
btn: this,
type: "POST",
method: "frappe.templates.includes.comments.add_comment",
@ -70,7 +70,7 @@ $(document).ready(function() {
callback: function(r) {
if(r.exc) {
if(r._server_messages)
wn.msgprint(r._server_messages);
frappe.msgprint(r._server_messages);
} else {
$(r.message).appendTo("#comment-list");
$(".no-comment, .add-comment").toggle(false);

View file

@ -46,15 +46,15 @@ $(document).ready(function() {
}
if(!args.old_password && !args.key) {
wn.msgprint("Old Password Required.");
frappe.msgprint("Old Password Required.");
return;
}
if(!args.new_password) {
wn.msgprint("New Password Required.")
frappe.msgprint("New Password Required.")
return;
}
wn.call({
frappe.call({
type: "POST",
method: "frappe.core.doctype.profile.profile.update_password",
btn: $("#update"),
@ -62,7 +62,7 @@ $(document).ready(function() {
callback: function(r) {
if(r.message) {
$("input").val("");
var dialog = wn.msgprint(r.message);
var dialog = frappe.msgprint(r.message);
dialog.on("hide.bs.modal", function() {
window.location.href = "login";
});

View file

@ -1,7 +1,7 @@
{% include "templates/includes/post_editor.html" %}
<script>
wn.require("/assets/js/canvasResize.min.js");
frappe.require("/assets/js/canvasResize.min.js");
$(function() {
website.bind_add_post();

View file

@ -9,7 +9,7 @@
<script>
$(function() {
if($(".post").length===20) {
wn.setup_pagination();
frappe.setup_pagination();
}
{% if group.group_type == "Forum" -%}

View file

@ -13,7 +13,7 @@
</div>
<script>
wn.require("/assets/js/canvasResize.min.js");
frappe.require("/assets/js/canvasResize.min.js");
$(function() {
website.toggle_edit(true);
website.toggle_upvote();

View file

@ -43,6 +43,7 @@ def rebuild_website_sitemap_config():
frappe.conn.sql("""delete from `tabWebsite Sitemap Config`""")
for app in frappe.get_installed_apps():
if app=="webnotes": app="frappe"
build_website_sitemap_config(app)
cleanup_sitemap()

View file

@ -3,7 +3,7 @@
frappe.provide("website");
$.extend(frappe. {
$.extend(frappe, {
_assets_loaded: [],
require: function(url) {
if(frappe._assets_loaded.indexOf(url)!==-1) return;