@@ -459,15 +459,8 @@ _f.Frm.prototype.refresh_header = function() { | |||||
set_title(this.meta.issingle ? this.doctype : this.docname); | set_title(this.meta.issingle ? this.doctype : this.docname); | ||||
} | } | ||||
// form title | |||||
//this.page_layout.main_head.innerHTML = '<h2>'+this.docname+'</h2>'; | |||||
// show / hide buttons | // show / hide buttons | ||||
if(this.frm_head)this.frm_head.refresh(); | |||||
// add to recent | |||||
if(wn.ui.toolbar.recent) | |||||
wn.ui.toolbar.recent.add(this.doctype, this.docname, 1); | |||||
if(this.frm_head)this.frm_head.refresh(); | |||||
} | } | ||||
_f.Frm.prototype.check_doc_perm = function() { | _f.Frm.prototype.check_doc_perm = function() { | ||||
@@ -42,7 +42,11 @@ _f.FrmHeader = Class.extend({ | |||||
this.appframe.add_breadcrumb("icon-file"); | this.appframe.add_breadcrumb("icon-file"); | ||||
}, | }, | ||||
refresh: function() { | refresh: function() { | ||||
this.appframe.set_title(this.frm.docname); | |||||
var title = this.frm.docname; | |||||
if(title.length > 30) { | |||||
title = title.substr(0,30) + "..."; | |||||
} | |||||
this.appframe.set_title(title, this.frm.docname); | |||||
this.refresh_labels(); | this.refresh_labels(); | ||||
this.refresh_toolbar(); | this.refresh_toolbar(); | ||||
this.refresh_timestamps(); | this.refresh_timestamps(); | ||||
@@ -65,16 +65,11 @@ $.extend(wn.user, { | |||||
} | } | ||||
}, | }, | ||||
get_desktop_items: function() { | get_desktop_items: function() { | ||||
// get user sequence preference | |||||
var user_list = wn.user.get_default("_desktop_items"); | var user_list = wn.user.get_default("_desktop_items"); | ||||
if(user_list && user_list.length) | if(user_list && user_list.length) | ||||
var modules_list = user_list; | var modules_list = user_list; | ||||
else | |||||
try { | |||||
var modules_list = JSON.parse(wn.boot.modules_list); | |||||
} catch(e) { | |||||
// ? | |||||
} | |||||
if(modules_list) { | if(modules_list) { | ||||
// add missing modules - they will be hidden anyways by the view | // add missing modules - they will be hidden anyways by the view | ||||
$.each(wn.modules, function(m, data) { | $.each(wn.modules, function(m, data) { | ||||
@@ -83,7 +78,20 @@ $.extend(wn.user, { | |||||
} | } | ||||
}); | }); | ||||
} else | } else | ||||
// all modules | |||||
modules_list = keys(wn.modules); | modules_list = keys(wn.modules); | ||||
// filter hidden modules | |||||
if(wn.boot.modules_list) { | |||||
var allowed_list = JSON.parse(wn.boot.modules_list); | |||||
if(modules_list) { | |||||
var modules_list = $.map(modules_list, function(m) { | |||||
if(allowed_list.indexOf(m)!=-1) return m; else return null; | |||||
}); | |||||
} else { | |||||
var modules_list = allowed_list; | |||||
} | |||||
} | |||||
return modules_list; | return modules_list; | ||||
}, | }, | ||||
is_report_manager: function() { | is_report_manager: function() { | ||||
@@ -25,10 +25,11 @@ wn.ui.AppFrame = Class.extend({ | |||||
title: function(txt) { | title: function(txt) { | ||||
this.set_title(txt); | this.set_title(txt); | ||||
}, | }, | ||||
set_title: function(txt) { | |||||
set_title: function(txt, full_text) { | |||||
if(this.set_document_title) | if(this.set_document_title) | ||||
document.title = txt; | document.title = txt; | ||||
this.$titlebar.find(".appframe-title").html(txt); | |||||
this.$titlebar.find(".appframe-title").html(txt) | |||||
.attr("title", full_text || txt); | |||||
}, | }, | ||||
clear_breadcrumbs: function() { | clear_breadcrumbs: function() { | ||||
this.$w.find(".appframe-breadcrumb").empty(); | this.$w.find(".appframe-breadcrumb").empty(); | ||||
@@ -58,20 +58,4 @@ wn.views.Container = Class.extend({ | |||||
scroll(0,0); | scroll(0,0); | ||||
return this.page; | return this.page; | ||||
} | } | ||||
}); | |||||
wn.views.add_module_btn = function(parent, module) { | |||||
$(parent).append( | |||||
repl('<span class="label" style="margin-right: 8px; cursor: pointer;"\ | |||||
onclick="wn.set_route(\'%(module_small)s-home\')">\ | |||||
<i class="icon-home icon-white"></i> %(module)s Home\ | |||||
</span>', {module: module, module_small: module.toLowerCase()})); | |||||
} | |||||
wn.views.add_list_btn = function(parent, doctype) { | |||||
$(parent).append( | |||||
repl('<span class="label" style="margin-right: 8px; cursor: pointer;"\ | |||||
onclick="wn.set_route(\'List\', \'%(doctype)s\')">\ | |||||
<i class="icon-list icon-white"></i> %(doctype)s List\ | |||||
</span>', {doctype: doctype})); | |||||
} | |||||
}); |
@@ -239,7 +239,7 @@ def check_if_doc_is_linked(dt, dn): | |||||
# this condition ensures that it allows deletion when child table field references parent | # this condition ensures that it allows deletion when child table field references parent | ||||
item = sql("select name, parent, parenttype from `tab%s` where `%s`='%s' and docstatus!=2 and (ifnull(parent, '')='' or `%s`!=`parent`) \ | item = sql("select name, parent, parenttype from `tab%s` where `%s`='%s' and docstatus!=2 and (ifnull(parent, '')='' or `%s`!=`parent`) \ | ||||
limit 1" % (link_dt, link_field, dn, link_field), debug=1) | |||||
limit 1" % (link_dt, link_field, dn, link_field)) | |||||
except Exception, e: | except Exception, e: | ||||
if e.args[0]==1146: pass | if e.args[0]==1146: pass | ||||