Browse Source

bugfixes

version-14
Rushabh Mehta 11 years ago
parent
commit
482e55ec33
25 changed files with 64 additions and 44 deletions
  1. +3
    -1
      frappe/__init__.py
  2. +3
    -3
      frappe/cli.py
  3. +1
    -1
      frappe/core/page/permission_manager/permission_manager.js
  4. +3
    -0
      frappe/modules/patch_handler.py
  5. +2
    -1
      frappe/patches.txt
  6. +4
    -1
      frappe/patches/4_0/set_todo_checked_as_closed.py
  7. +9
    -0
      frappe/patches/4_0/webnotes_to_frappe.py
  8. +1
    -1
      frappe/public/js/frappe/app.js
  9. +1
    -1
      frappe/public/js/frappe/misc/number_format.js
  10. +2
    -2
      frappe/public/js/frappe/misc/pretty_date.js
  11. +2
    -1
      frappe/public/js/frappe/provide.js
  12. +5
    -5
      frappe/public/js/frappe/ui/editor.js
  13. +2
    -2
      frappe/public/js/frappe/ui/listing.js
  14. +3
    -3
      frappe/public/js/frappe/views/doclistview.js
  15. +1
    -1
      frappe/public/js/frappe/views/test_runner.js
  16. +4
    -4
      frappe/public/js/lib/jquery/jquery.min.js
  17. +3
    -3
      frappe/templates/generators/blog_post.html
  18. +3
    -3
      frappe/templates/generators/web_page.html
  19. +3
    -3
      frappe/templates/includes/comments.html
  20. +4
    -4
      frappe/templates/pages/update-password.html
  21. +1
    -1
      frappe/templates/website_group/edit_post.html
  22. +1
    -1
      frappe/templates/website_group/forum.html
  23. +1
    -1
      frappe/templates/website_group/post.html
  24. +1
    -0
      frappe/website/doctype/website_sitemap_config/website_sitemap_config.py
  25. +1
    -1
      frappe/website/js/website.js

+ 3
- 1
frappe/__init__.py View File

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


+ 3
- 3
frappe/cli.py View File

@@ -28,9 +28,9 @@ def main():
if not fn in site_arg_optional: if not fn in site_arg_optional:
if not parsed_args.get("site") and os.path.exists("currentsite.txt"): if not parsed_args.get("site") and os.path.exists("currentsite.txt"):
with open("currentsite.txt", "r") as sitefile: 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: if not site:
print "Site argument required" print "Site argument required"


+ 1
- 1
frappe/core/page/permission_manager/permission_manager.js 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._("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._("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>\ "<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>\ </tr></td>\
</table>"); </table>");
wrapper.permission_engine = new frappe.PermissionEngine(wrapper); wrapper.permission_engine = new frappe.PermissionEngine(wrapper);


+ 3
- 0
frappe/modules/patch_handler.py View File

@@ -29,6 +29,9 @@ def run_all():
def get_all_patches(): def get_all_patches():
patches = [] patches = []
for app in frappe.get_installed_apps(): 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"))) patches.extend(frappe.get_file_items(frappe.get_pymodule_path(app, "patches.txt")))
return patches return patches


+ 2
- 1
frappe/patches.txt View File

@@ -10,4 +10,5 @@ frappe.patches.4_0.remove_index_sitemap
frappe.patches.4_0.add_delete_permission frappe.patches.4_0.add_delete_permission
frappe.patches.4_0.move_match_to_restricted frappe.patches.4_0.move_match_to_restricted
frappe.patches.4_0.set_todo_checked_as_closed 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

+ 4
- 1
frappe/patches/4_0/set_todo_checked_as_closed.py View File

@@ -2,4 +2,7 @@ import frappe


def execute(): def execute():
frappe.reload_doc("core", "doctype", "todo") 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

+ 9
- 0
frappe/patches/4_0/webnotes_to_frappe.py 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()

+ 1
- 1
frappe/public/js/frappe/app.js View File

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


+ 1
- 1
frappe/public/js/frappe/misc/number_format.js View File

@@ -1,7 +1,7 @@
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
// MIT License. See license.txt // MIT License. See license.txt


if(!window.frappe. frappe.= {};
if(!window.frappe) window.frappe = {};


function flt(v, decimals, number_format) { function flt(v, decimals, number_format) {
if(v==null || v=='')return 0; if(v==null || v=='')return 0;


+ 2
- 2
frappe/public/js/frappe/misc/pretty_date.js View File

@@ -26,14 +26,14 @@ function prettyDate(time){




var comment_when = function(datetime) { 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.provide("frappe.datetime");
frappe.datetime.comment_when = prettyDate; frappe.datetime.comment_when = prettyDate;
frappe.datetime.refresh_when = function() { frappe.datetime.refresh_when = function() {
if(jQuery) { if(jQuery) {
$(".frappe.timestamp").each(function() {
$(".frappe-timestamp").each(function() {
$(this).html(prettyDate($(this).attr("data-timestamp"))); $(this).html(prettyDate($(this).attr("data-timestamp")));
}) })
} }


+ 2
- 1
frappe/public/js/frappe/provide.js View File

@@ -2,7 +2,8 @@
// MIT License. See license.txt // MIT License. See license.txt


// provide a namespace // provide a namespace
if(!window.frappe.frappe.= {}
if(!window.frappe)
window.frappe = {};
frappe.provide = function(namespace) { frappe.provide = function(namespace) {
// docs: create a namespace // // docs: create a namespace //
var nsl = namespace.split('.'); var nsl = namespace.split('.');


+ 5
- 5
frappe/public/js/frappe/ui/editor.js View File

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


+ 2
- 2
frappe/public/js/frappe/ui/listing.js View File

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


+ 3
- 3
frappe/public/js/frappe/views/doclistview.js View File

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


+ 1
- 1
frappe/public/js/frappe/views/test_runner.js View File

@@ -15,7 +15,7 @@ frappe.standard_pages["test-runner"] = function() {
var route = frappe.get_route(); var route = frappe.get_route();
if(route.length < 2) { if(route.length < 2) {
msgprint("To run a test add the module name in the route after 'test-runner/'. \ 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; return;
} }




+ 4
- 4
frappe/public/js/lib/jquery/jquery.min.js
File diff suppressed because it is too large
View File


+ 3
- 3
frappe/templates/generators/blog_post.html View File

@@ -26,9 +26,9 @@
<script> <script>
$(function() { $(function() {
if(window.logged_in && getCookie("system_user")==="yes") { 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");
}); });
} }
}); });


+ 3
- 3
frappe/templates/generators/web_page.html View File

@@ -42,9 +42,9 @@
<script> <script>
$(function() { $(function() {
if(window.logged_in && getCookie("system_user")==="yes") { 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");
}); });
} }
}); });


+ 3
- 3
frappe/templates/includes/comments.html View File

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


+ 4
- 4
frappe/templates/pages/update-password.html View File

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


+ 1
- 1
frappe/templates/website_group/edit_post.html View File

@@ -1,7 +1,7 @@
{% include "templates/includes/post_editor.html" %} {% include "templates/includes/post_editor.html" %}


<script> <script>
wn.require("/assets/js/canvasResize.min.js");
frappe.require("/assets/js/canvasResize.min.js");
$(function() { $(function() {
website.bind_add_post(); website.bind_add_post();


+ 1
- 1
frappe/templates/website_group/forum.html View File

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


+ 1
- 1
frappe/templates/website_group/post.html View File

@@ -13,7 +13,7 @@
</div> </div>


<script> <script>
wn.require("/assets/js/canvasResize.min.js");
frappe.require("/assets/js/canvasResize.min.js");
$(function() { $(function() {
website.toggle_edit(true); website.toggle_edit(true);
website.toggle_upvote(); website.toggle_upvote();


+ 1
- 0
frappe/website/doctype/website_sitemap_config/website_sitemap_config.py View File

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


+ 1
- 1
frappe/website/js/website.js View File

@@ -3,7 +3,7 @@


frappe.provide("website"); frappe.provide("website");


$.extend(frappe. {
$.extend(frappe, {
_assets_loaded: [], _assets_loaded: [],
require: function(url) { require: function(url) {
if(frappe._assets_loaded.indexOf(url)!==-1) return; if(frappe._assets_loaded.indexOf(url)!==-1) return;


Loading…
Cancel
Save