Merge branch 'responsive' of git://github.com/webnotes/wnframework into responsive
This commit is contained in:
commit
70f0a5d735
26 changed files with 318 additions and 874 deletions
|
|
@ -20,7 +20,6 @@
|
|||
"lib/public/css/legacy/fields.css",
|
||||
"lib/public/css/legacy/dialog.css",
|
||||
"lib/public/css/legacy/tabs.css",
|
||||
"lib/public/css/legacy/sidebar.css",
|
||||
"lib/public/css/ui/common.css",
|
||||
"lib/public/css/views/tree_grid.css",
|
||||
]
|
||||
|
|
@ -110,7 +109,6 @@
|
|||
"lib/public/js/legacy/widgets/layout.js",
|
||||
"lib/public/js/legacy/widgets/export_query.js",
|
||||
"lib/public/js/legacy/wn/page_layout.js",
|
||||
"lib/public/js/legacy/wn/widgets/page_sidebar.js",
|
||||
|
||||
"lib/public/js/wn/ui/toolbar/selector_dialog.js",
|
||||
"lib/public/js/wn/ui/toolbar/new.js",
|
||||
|
|
@ -124,7 +122,6 @@
|
|||
"lib/public/js/legacy/widgets/form/form.js",
|
||||
"lib/public/js/legacy/widgets/form/print_format.js",
|
||||
"lib/public/js/legacy/widgets/form/clientscriptAPI.js",
|
||||
"lib/public/js/legacy/wn/widgets/form/sidebar.js",
|
||||
|
||||
"lib/public/js/wn/form/toolbar.js",
|
||||
"lib/public/js/wn/form/layout.js",
|
||||
|
|
|
|||
153
public/css/bootstrap.css
vendored
153
public/css/bootstrap.css
vendored
|
|
@ -325,9 +325,13 @@ a:focus {
|
|||
}
|
||||
|
||||
img {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.img-responsive {
|
||||
display: inline-block;
|
||||
height: auto;
|
||||
max-width: 100%;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.img-rounded {
|
||||
|
|
@ -1482,6 +1486,11 @@ input[type="checkbox"]:focus {
|
|||
outline-offset: -2px;
|
||||
}
|
||||
|
||||
input[type="number"]::-webkit-outer-spin-button,
|
||||
input[type="number"]::-webkit-inner-spin-button {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
input:-moz-placeholder,
|
||||
textarea:-moz-placeholder {
|
||||
color: #999999;
|
||||
|
|
@ -1601,6 +1610,7 @@ input[type="color"].input-small {
|
|||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.has-warning .help-block,
|
||||
.has-warning .control-label {
|
||||
color: #c09853;
|
||||
}
|
||||
|
|
@ -1624,6 +1634,7 @@ input[type="color"].input-small {
|
|||
border-color: #c09853;
|
||||
}
|
||||
|
||||
.has-error .help-block,
|
||||
.has-error .control-label {
|
||||
color: #b94a48;
|
||||
}
|
||||
|
|
@ -1647,6 +1658,7 @@ input[type="color"].input-small {
|
|||
border-color: #b94a48;
|
||||
}
|
||||
|
||||
.has-success .help-block,
|
||||
.has-success .control-label {
|
||||
color: #468847;
|
||||
}
|
||||
|
|
@ -2322,6 +2334,11 @@ input[type="button"].btn-block {
|
|||
border-bottom-left-radius: 4px;
|
||||
}
|
||||
|
||||
.list-group-item > .badge {
|
||||
float: right;
|
||||
margin-right: -15px;
|
||||
}
|
||||
|
||||
.list-group-item-heading {
|
||||
margin-top: 0;
|
||||
margin-bottom: 5px;
|
||||
|
|
@ -2361,16 +2378,6 @@ a.list-group-item.active .list-group-item-text {
|
|||
color: #e1edf7;
|
||||
}
|
||||
|
||||
.list-group-item > .badge,
|
||||
.list-group-item > .glyphicon-chevron-right {
|
||||
float: right;
|
||||
margin-right: -15px;
|
||||
}
|
||||
|
||||
.list-group-item > .glyphicon + .badge {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.panel {
|
||||
padding: 15px;
|
||||
margin-bottom: 20px;
|
||||
|
|
@ -3206,11 +3213,6 @@ button.close {
|
|||
padding-left: 8px;
|
||||
}
|
||||
|
||||
.btn-group > .btn-mini + .dropdown-toggle {
|
||||
padding-right: 5px;
|
||||
padding-left: 5px;
|
||||
}
|
||||
|
||||
.btn-group > .btn-large + .dropdown-toggle {
|
||||
padding-right: 12px;
|
||||
padding-left: 12px;
|
||||
|
|
@ -3304,6 +3306,7 @@ button.close {
|
|||
|
||||
.pagination {
|
||||
display: inline-block;
|
||||
padding-left: 0;
|
||||
margin: 20px 0;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
|
@ -3395,6 +3398,7 @@ button.close {
|
|||
}
|
||||
|
||||
.pager {
|
||||
padding-left: 0;
|
||||
margin: 20px 0;
|
||||
text-align: center;
|
||||
list-style: none;
|
||||
|
|
@ -3962,8 +3966,11 @@ button.close {
|
|||
display: block;
|
||||
}
|
||||
|
||||
.thumbnail > img,
|
||||
.img-thumbnail {
|
||||
display: inline-block;
|
||||
height: auto;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
a.thumbnail:hover,
|
||||
|
|
@ -3972,8 +3979,6 @@ a.thumbnail:focus {
|
|||
}
|
||||
|
||||
.thumbnail > img {
|
||||
display: block;
|
||||
max-width: 100%;
|
||||
margin-right: auto;
|
||||
margin-left: auto;
|
||||
}
|
||||
|
|
@ -4015,7 +4020,7 @@ a.thumbnail:focus {
|
|||
}
|
||||
|
||||
.media-list {
|
||||
margin-left: 0;
|
||||
padding-left: 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
|
|
@ -4108,10 +4113,6 @@ a.badge:focus {
|
|||
top: -1px;
|
||||
}
|
||||
|
||||
.btn-mini .badge {
|
||||
top: 0;
|
||||
}
|
||||
|
||||
a.list-group-item.active > .badge,
|
||||
.nav-pills > .active > a > .badge {
|
||||
color: #428bca;
|
||||
|
|
@ -4279,9 +4280,6 @@ a.list-group-item.active > .badge,
|
|||
.accordion-heading .accordion-toggle {
|
||||
display: block;
|
||||
padding: 8px 15px;
|
||||
}
|
||||
|
||||
.accordion-toggle {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
|
|
@ -4311,7 +4309,9 @@ a.list-group-item.active > .badge,
|
|||
|
||||
.carousel-inner > .item > img,
|
||||
.carousel-inner > .item > a > img {
|
||||
display: block;
|
||||
display: inline-block;
|
||||
height: auto;
|
||||
max-width: 100%;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
|
|
@ -4418,24 +4418,26 @@ a.list-group-item.active > .badge,
|
|||
z-index: 15;
|
||||
width: 100px;
|
||||
padding-left: 0;
|
||||
margin: 0 0 0 -50px;
|
||||
margin-left: -50px;
|
||||
text-align: center;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.carousel-indicators li {
|
||||
display: inline-block;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
margin-right: 0;
|
||||
margin-left: 0;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
margin: 1px;
|
||||
text-indent: -999px;
|
||||
cursor: pointer;
|
||||
border: 1px solid #fff;
|
||||
border-radius: 5px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.carousel-indicators .active {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
margin: 0;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
|
|
@ -4574,14 +4576,41 @@ td.visible-sm {
|
|||
display: none !important;
|
||||
}
|
||||
|
||||
tr.visible-md {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
th.visible-md,
|
||||
td.visible-md {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.visible-lg {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
tr.visible-lg {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
th.visible-lg,
|
||||
td.visible-lg {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.hidden-sm {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
tr.hidden-sm {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
th.hidden-sm,
|
||||
td.hidden-sm {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.hidden-md {
|
||||
display: block !important;
|
||||
}
|
||||
|
|
@ -4612,6 +4641,13 @@ td.hidden-lg {
|
|||
.visible-sm {
|
||||
display: none !important;
|
||||
}
|
||||
tr.visible-sm {
|
||||
display: none !important;
|
||||
}
|
||||
th.visible-sm,
|
||||
td.visible-sm {
|
||||
display: none !important;
|
||||
}
|
||||
.visible-md {
|
||||
display: block !important;
|
||||
}
|
||||
|
|
@ -4625,6 +4661,13 @@ td.hidden-lg {
|
|||
.visible-lg {
|
||||
display: none !important;
|
||||
}
|
||||
tr.visible-lg {
|
||||
display: none !important;
|
||||
}
|
||||
th.visible-lg,
|
||||
td.visible-lg {
|
||||
display: none !important;
|
||||
}
|
||||
.hidden-sm {
|
||||
display: block !important;
|
||||
}
|
||||
|
|
@ -4638,6 +4681,13 @@ td.hidden-lg {
|
|||
.hidden-md {
|
||||
display: none !important;
|
||||
}
|
||||
tr.hidden-md {
|
||||
display: none !important;
|
||||
}
|
||||
th.hidden-md,
|
||||
td.hidden-md {
|
||||
display: none !important;
|
||||
}
|
||||
.hidden-lg {
|
||||
display: block !important;
|
||||
}
|
||||
|
|
@ -4654,9 +4704,23 @@ td.hidden-lg {
|
|||
.visible-sm {
|
||||
display: none !important;
|
||||
}
|
||||
tr.visible-sm {
|
||||
display: none !important;
|
||||
}
|
||||
th.visible-sm,
|
||||
td.visible-sm {
|
||||
display: none !important;
|
||||
}
|
||||
.visible-md {
|
||||
display: none !important;
|
||||
}
|
||||
tr.visible-md {
|
||||
display: none !important;
|
||||
}
|
||||
th.visible-md,
|
||||
td.visible-md {
|
||||
display: none !important;
|
||||
}
|
||||
.visible-lg {
|
||||
display: block !important;
|
||||
}
|
||||
|
|
@ -4690,12 +4754,28 @@ td.hidden-lg {
|
|||
.hidden-lg {
|
||||
display: none !important;
|
||||
}
|
||||
tr.hidden-lg {
|
||||
display: none !important;
|
||||
}
|
||||
th.hidden-lg,
|
||||
td.hidden-lg {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
.visible-print {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
tr.visible-print {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
th.visible-print,
|
||||
td.visible-print {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
@media print {
|
||||
.visible-print {
|
||||
display: block !important;
|
||||
|
|
@ -4710,4 +4790,11 @@ td.hidden-lg {
|
|||
.hidden-print {
|
||||
display: none !important;
|
||||
}
|
||||
tr.hidden-print {
|
||||
display: none !important;
|
||||
}
|
||||
th.hidden-print,
|
||||
td.hidden-print {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,32 +0,0 @@
|
|||
div.psidebar {
|
||||
}
|
||||
|
||||
div.psidebar div.head {
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
color: #555;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
div.section {
|
||||
margin-bottom: 15px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
div.section div.section-head {
|
||||
padding: 5px 0px;
|
||||
font-size: 109%;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
div.section div.section-body {
|
||||
|
||||
}
|
||||
|
||||
div.section div.section-item {
|
||||
margin-bottom: 7px;
|
||||
}
|
||||
|
||||
div.section div.section-item, div.section .section-link {
|
||||
color: #666;
|
||||
}
|
||||
|
|
@ -47,21 +47,33 @@ a {
|
|||
|
||||
/* module */
|
||||
|
||||
.module-top .alert {
|
||||
.alert-badge {
|
||||
padding-right: 15px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.module-top a, .module-top a:hover {
|
||||
.alert-badge a, .alert-badge a:hover {
|
||||
color: black;
|
||||
font-size: 120%;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.module-top .badge {
|
||||
.alert-badge .badge {
|
||||
margin-top: 3px;
|
||||
}
|
||||
|
||||
.form-headline {
|
||||
margin-bottom: 10px;
|
||||
font-size: 130%;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.form-dashboard {
|
||||
display: none;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
/* module */
|
||||
|
||||
.module-item-progress {
|
||||
margin-bottom: 10px;
|
||||
height: 17px;
|
||||
|
|
@ -384,4 +396,35 @@ textarea[data-fieldtype="Small Text"] {
|
|||
.hidden-sm-inline {
|
||||
display: inline;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* buttons */
|
||||
.btn-default {
|
||||
color: #ffffff;
|
||||
background-color: #a7a9aa;
|
||||
border-color: #a7a9aa;
|
||||
}
|
||||
|
||||
.btn-default:hover,
|
||||
.btn-default:focus,
|
||||
.btn-default:active,
|
||||
.btn-default.active {
|
||||
background-color: #9a9c9d;
|
||||
border-color: #8d9091;
|
||||
}
|
||||
|
||||
.btn-default.disabled:hover,
|
||||
.btn-default[disabled]:hover,
|
||||
fieldset[disabled] .btn-default:hover,
|
||||
.btn-default.disabled:focus,
|
||||
.btn-default[disabled]:focus,
|
||||
fieldset[disabled] .btn-default:focus,
|
||||
.btn-default.disabled:active,
|
||||
.btn-default[disabled]:active,
|
||||
fieldset[disabled] .btn-default:active,
|
||||
.btn-default.disabled.active,
|
||||
.btn-default[disabled].active,
|
||||
fieldset[disabled] .btn-default.active {
|
||||
background-color: #a7a9aa;
|
||||
border-color: #a7a9aa;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ import webnotes.auth
|
|||
|
||||
def init():
|
||||
webnotes.handler.get_cgi_fields()
|
||||
|
||||
# init request
|
||||
try:
|
||||
webnotes.http_request = webnotes.auth.HTTPRequest()
|
||||
|
|
|
|||
|
|
@ -339,16 +339,6 @@ _f.Frm.prototype.refresh_print_layout = function() {
|
|||
_p.build(this.$print_view_select.val(), print_callback, false, true, true);
|
||||
}
|
||||
|
||||
|
||||
_f.Frm.prototype.show_the_frm = function() {
|
||||
// show the dialog
|
||||
if(this.meta.in_dialog && !this.parent.dialog.display) {
|
||||
if(!this.meta.istable)
|
||||
this.parent.table_form = false;
|
||||
this.parent.dialog.show();
|
||||
}
|
||||
}
|
||||
|
||||
_f.Frm.prototype.set_print_heading = function(txt) {
|
||||
this.pformat[cur_frm.docname] = txt;
|
||||
}
|
||||
|
|
@ -579,9 +569,6 @@ _f.Frm.prototype.refresh_dependency = function() {
|
|||
}
|
||||
}
|
||||
|
||||
// setnewdoc is called when a record is loaded for the first time
|
||||
// ======================================================================================
|
||||
|
||||
_f.Frm.prototype.setnewdoc = function(docname) {
|
||||
// moved this call to refresh function
|
||||
// this.check_doctype_conflict(docname);
|
||||
|
|
@ -601,7 +588,7 @@ _f.Frm.prototype.setnewdoc = function(docname) {
|
|||
this.script_manager.trigger("onload");
|
||||
|
||||
this.last_view_is_edit[docname] = 1;
|
||||
if(cint(this.meta.read_only_onload)) this.last_view_is_edit[docname] = 0;
|
||||
//if(cint(this.meta.read_only_onload)) this.last_view_is_edit[docname] = 0;
|
||||
|
||||
this.opendocs[docname] = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,285 +0,0 @@
|
|||
// Copyright (c) 2012 Web Notes Technologies Pvt Ltd (http://erpnext.com)
|
||||
//
|
||||
// MIT License (MIT)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
// OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
// =================================================
|
||||
//
|
||||
// Tag Globals
|
||||
//
|
||||
_tags = {
|
||||
dialog: null,
|
||||
color_map: {},
|
||||
all_tags: [],
|
||||
colors: {'Default':'#add8e6'}
|
||||
//color_list: ['Default'] // for sequence
|
||||
}
|
||||
|
||||
//
|
||||
// Tag List
|
||||
//
|
||||
TagList = function(parent, start_list, dt, dn, static, onclick) {
|
||||
this.start_list = start_list ? start_list : [];
|
||||
this.tag_list = [];
|
||||
this.dt = dt;
|
||||
this.onclick = onclick;
|
||||
this.dn = dn;
|
||||
this.static;
|
||||
this.parent = parent;
|
||||
this.make_body();
|
||||
}
|
||||
|
||||
TagList.prototype.make = function(parent) {
|
||||
for(var i=0; i<this.start_list.length; i++) {
|
||||
if(this.start_list[i])
|
||||
new SingleTag({
|
||||
parent: this.body,
|
||||
label: this.start_list[i],
|
||||
dt: this.dt,
|
||||
dn: this.dn,
|
||||
fieldname: '_user_tags',
|
||||
static: this.static,
|
||||
taglist: this,
|
||||
onclick: this.onclick
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
TagList.prototype.make_body = function() {
|
||||
var div = $a(this.parent, 'span', '', {margin:'3px 0px', padding:'3px 0px'});
|
||||
this.body = $a(div, 'span', '', {marginRight:'4px'});
|
||||
this.add_tag_area = $a(div, 'span');
|
||||
this.make_add_tag();
|
||||
this.make();
|
||||
}
|
||||
|
||||
// render a new tag
|
||||
TagList.prototype.add_tag = function(label, static, fieldname, color) {
|
||||
if(!label) return;
|
||||
if(in_list(this.tag_list, label)) return; // no double tags
|
||||
var tag = new SingleTag({
|
||||
parent: this.body,
|
||||
label: label,
|
||||
dt: this.dt,
|
||||
dn: this.dn,
|
||||
fieldname: fieldname,
|
||||
static: static,
|
||||
taglist: this,
|
||||
color: color,
|
||||
onclick: this.onclick
|
||||
});
|
||||
}
|
||||
|
||||
// add -tag area
|
||||
TagList.prototype.make_add_tag = function() {
|
||||
var me = this;
|
||||
this.add_tag_span = $a(this.add_tag_area, 'span', '',
|
||||
{color:'#888', textDecoration:'underline', cursor:'pointer',marginLeft:'4px',fontSize:'11px'});
|
||||
this.add_tag_span.innerHTML = 'Add tag';
|
||||
this.add_tag_span.onclick = function() { me.new_tag(); }
|
||||
}
|
||||
|
||||
// new tag dialog
|
||||
TagList.prototype.make_tag_dialog = function() {
|
||||
var me = this;
|
||||
|
||||
var d = new wn.ui.Dialog({
|
||||
title: 'Add a tag',
|
||||
width: 400,
|
||||
fields: [
|
||||
{fieldtype:'Link', fieldname:'tag', label:'Tag', options:'Tag',
|
||||
reqd:1, description:'Max chars (20)', no_buttons:1},
|
||||
{fieldtype:'Button', fieldname: 'add', label:'Add'}
|
||||
]
|
||||
})
|
||||
|
||||
$(d.fields_dict.tag.input).attr('maxlength', 20);
|
||||
d.fields_dict.add.input.onclick = function() { me.save_tag(d); }
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
|
||||
// check if tag text is okay
|
||||
TagList.prototype.is_text_okay = function(val) {
|
||||
if(!val) {
|
||||
msgprint(wn._("Please type something"));
|
||||
return;
|
||||
}
|
||||
if(!validate_spl_chars(val)) {
|
||||
msgprint(wn._("Special charaters, spaces, commas etc not allowed in tags"));
|
||||
return;
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
||||
// add to local
|
||||
TagList.prototype.add_to_locals = function(tag) {
|
||||
if(locals[this.dt] && locals[this.dt][this.dn]) {
|
||||
var doc = locals[this.dt][this.dn];
|
||||
|
||||
if(!doc._user_tags) {
|
||||
doc._user_tags = ''
|
||||
}
|
||||
var tl = doc._user_tags.split(',')
|
||||
tl.push(tag)
|
||||
doc._user_tags = tl.join(',');
|
||||
}
|
||||
}
|
||||
|
||||
// remove from local
|
||||
TagList.prototype.remove_from_locals = function(tag) {
|
||||
if(locals[this.dt] && locals[this.dt][this.dn]) {
|
||||
var doc = locals[this.dt][this.dn];
|
||||
|
||||
var tl = doc._user_tags.split(',');
|
||||
var new_tl = [];
|
||||
for(var i=0; i<tl.length; i++) {
|
||||
if(tl[i]!=tag) new_tl.push(tl[i]);
|
||||
}
|
||||
doc._user_tags = new_tl.join(',');
|
||||
}
|
||||
}
|
||||
|
||||
// save the tag
|
||||
TagList.prototype.save_tag = function(d) {
|
||||
var val = d.get_values();
|
||||
if(val) val = val.tag;
|
||||
|
||||
var me = this;
|
||||
|
||||
if(!this.is_text_okay(val)) return;
|
||||
|
||||
var callback = function(r,rt) {
|
||||
var d = me.dialog;
|
||||
// hide the dialog
|
||||
d.fields_dict.add.input.done_working();
|
||||
d.fields_dict.tag.input.set_input('');
|
||||
d.hide();
|
||||
|
||||
// add in locals
|
||||
me.add_to_locals(val)
|
||||
|
||||
if(!r.message) return;
|
||||
me.add_tag(r.message, 0, '_user_tags');
|
||||
|
||||
}
|
||||
me.dialog.fields_dict.add.input.set_working();
|
||||
$c('webnotes.widgets.tags.add_tag',{'dt': me.dt, 'dn': me.dn, 'tag':val, 'color':'na'}, callback);
|
||||
}
|
||||
|
||||
// create a new tag
|
||||
TagList.prototype.new_tag = function() {
|
||||
var me = this;
|
||||
|
||||
if(!this.dialog) {
|
||||
this.dialog = this.make_tag_dialog();
|
||||
}
|
||||
this.dialog.show();
|
||||
}
|
||||
|
||||
// refresh tags
|
||||
TagList.prototype.refresh_tags = function() {
|
||||
}
|
||||
|
||||
//
|
||||
// SingleTag
|
||||
// parameters {parent, label, dt, dn, fieldname, static, taglist, color}
|
||||
//
|
||||
function SingleTag(opts) {
|
||||
$.extend(this, opts);
|
||||
|
||||
if(!this.color) this.color = '#add8e6';
|
||||
|
||||
if(this.taglist && !in_list(this.taglist.tag_list, this.label))
|
||||
this.taglist.tag_list.push(this.label);
|
||||
|
||||
this.make_body(this.parent);
|
||||
}
|
||||
|
||||
// make body
|
||||
SingleTag.prototype.make_body = function(parent) {
|
||||
var me = this;
|
||||
// tag area
|
||||
this.body = $a(parent,'span','',{padding:'2px 4px', backgroundColor: this.color,
|
||||
color:'#226', marginRight:'4px'});
|
||||
$br(this.body,'3px');
|
||||
|
||||
if(this.onclick) $y(this.body, {cursor:'pointer'});
|
||||
|
||||
// hover
|
||||
$(this.body).hover(function() {
|
||||
$(this).css('opacity', 0.6);
|
||||
} ,function() {
|
||||
$(this).css('opacity', 1);
|
||||
});
|
||||
|
||||
// label
|
||||
this.make_label();
|
||||
|
||||
// remove btn
|
||||
if(!this.static) this.make_remove_btn();
|
||||
|
||||
// add to all tags
|
||||
_tags.all_tags.push(this);
|
||||
}
|
||||
|
||||
// remove btn
|
||||
SingleTag.prototype.make_remove_btn = function() {
|
||||
var me = this;
|
||||
var span = $a(this.body,'span');
|
||||
span.innerHTML += ' |';
|
||||
|
||||
var span = $a(this.body,'span','',{cursor:'pointer'});
|
||||
span.innerHTML = ' x'
|
||||
span.onclick = function() { me.remove(me); }
|
||||
}
|
||||
|
||||
// label
|
||||
SingleTag.prototype.make_label = function() {
|
||||
var me = this;
|
||||
this.label_span = $a(this.body,'span', 'social', null, this.label);
|
||||
this.label_span.onclick = function() { if(me.onclick) me.onclick(me); }
|
||||
}
|
||||
|
||||
// remove
|
||||
SingleTag.prototype.remove_tag_body = function() {
|
||||
// clear tag
|
||||
$dh(this.body);
|
||||
|
||||
// remove from tag_list
|
||||
var nl=[];
|
||||
for(var i in this.tag_list)
|
||||
if(this.tag_list[i]!=this.label)
|
||||
nl.push(this.tag_list[i]);
|
||||
if(this.taglist)
|
||||
this.taglist.tag_list = nl;
|
||||
}
|
||||
|
||||
// remove
|
||||
SingleTag.prototype.remove = function() {
|
||||
var me = this;
|
||||
var callback = function(r,rt) {
|
||||
me.remove_tag_body()
|
||||
me.taglist.remove_from_locals(me.label);
|
||||
}
|
||||
$c('webnotes.widgets.tags.remove_tag', {'dt':me.dt, 'dn':me.dn, 'tag':me.label}, callback)
|
||||
$bg(me.body,'#DDD');
|
||||
}
|
||||
|
|
@ -1,210 +0,0 @@
|
|||
// Copyright (c) 2012 Web Notes Technologies Pvt Ltd (http://erpnext.com)
|
||||
//
|
||||
// MIT License (MIT)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
// OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
// Tree
|
||||
// ---------------------------------
|
||||
|
||||
function Tree(parent, width, do_animate) {
|
||||
this.width = width;
|
||||
this.nodes = {};
|
||||
this.allnodes = {};
|
||||
this.cur_node;
|
||||
this.is_root = 1;
|
||||
this.do_animate = do_animate;
|
||||
var me = this;
|
||||
this.exp_img = 'lib/images/icons/plus.gif';
|
||||
this.col_img = 'lib/images/icons/minus.gif';
|
||||
|
||||
this.body = $a(parent, 'div');
|
||||
if(width)$w(this.body, width);
|
||||
|
||||
this.addNode = function(parent, id, imagesrc, onclick, onexpand, opts, label) {
|
||||
var t = new TreeNode(me, parent, id, imagesrc, onclick, onexpand, opts, label);
|
||||
|
||||
if(!parent) {
|
||||
me.nodes[id]=t; // add to roots
|
||||
} else {
|
||||
parent.nodes[id]=t; // add to the node
|
||||
}
|
||||
me.allnodes[id] = t;
|
||||
|
||||
// note: this will only be for groups
|
||||
if(onexpand)
|
||||
t.create_expimage();
|
||||
t.expanded_once = 0;
|
||||
|
||||
return t;
|
||||
|
||||
}
|
||||
var me = this;
|
||||
this.collapseall = function() {
|
||||
for(n in me.allnodes) {
|
||||
me.allnodes[n].collapse();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function TreeNode(tree, parent, id, imagesrc, onclick, onexpand, opts, label) {
|
||||
var me = this;
|
||||
if(!parent) parent = tree;
|
||||
this.parent = parent;
|
||||
this.nodes = {};
|
||||
this.onclick = onclick;
|
||||
this.onexpand = onexpand;
|
||||
this.text = label ? label : id;
|
||||
this.tree = tree;
|
||||
|
||||
if(opts)
|
||||
this.opts = opts;
|
||||
else
|
||||
this.opts = {
|
||||
show_exp_img:1
|
||||
,show_icon:1
|
||||
,label_style:{padding:'2px', cursor: 'pointer', fontSize:'11px'}
|
||||
,onselect_style:{fontWeight: 'bold'}
|
||||
,ondeselect_style:{fontWeight: 'normal'}
|
||||
} // only useful for 1st node in the tree
|
||||
|
||||
var tc = 1;
|
||||
if(this.opts.show_exp_img) tc+=1;
|
||||
|
||||
if(!this.parent.tab) {
|
||||
this.parent.tab = make_table(this.parent.body, 2, tc, '100%');
|
||||
$y(this.parent.tab,{tableLayout:'fixed',borderCollapse: 'collapse'});
|
||||
} else {
|
||||
this.parent.tab.append_row(); this.parent.tab.append_row();
|
||||
}
|
||||
|
||||
var mytab = this.parent.tab;
|
||||
|
||||
// expand / collapse
|
||||
if(this.opts.show_exp_img) {
|
||||
this.exp_cell=$td(mytab,mytab.rows.length-2, 0);
|
||||
$y(this.exp_cell, {cursor:'pointer', textAlign:'center', verticalAlign:'middle',width:'20px'});
|
||||
this.exp_cell.innerHTML = ' ';
|
||||
} else {
|
||||
// pass
|
||||
}
|
||||
this.create_expimage = function() {
|
||||
if(!me.opts.show_exp_img) return; // no expand image
|
||||
if(!me.expimage) {
|
||||
me.exp_cell.innerHTML='';
|
||||
me.expimage = $a(me.exp_cell, 'img');
|
||||
me.expimage.src = me.exp_img ? me.exp_img : me.tree.exp_img;
|
||||
me.expimage.onclick = me.toggle;
|
||||
}
|
||||
}
|
||||
|
||||
// label
|
||||
this.label = $a($td(mytab, mytab.rows.length-2, tc-1), 'div');
|
||||
$y(this.label, this.opts.label_style);
|
||||
|
||||
// image
|
||||
if(this.opts.show_icon) { // for second row, where children will come icon to be included
|
||||
var t2 = make_table($a(this.label,'div'), 1, 2, '100%', ['20px',null]);
|
||||
$y(t2,{borderCollapse:'collapse'});
|
||||
this.img_cell = $td(t2, 0, 0);
|
||||
$y(this.img_cell, {cursor:'pointer',verticalAlign:'middle',width:'20px'});
|
||||
if(!imagesrc) imagesrc = "lib/images/icons/folder.gif";
|
||||
this.usrimg = $a(this.img_cell, 'img');
|
||||
this.usrimg.src = imagesrc;
|
||||
|
||||
this.label = $td(t2, 0, 1);
|
||||
$y(this.label,{verticalAlign:'middle'});
|
||||
}
|
||||
|
||||
this.loading_div = $a($td(mytab, mytab.rows.length-1, this.opts.show_exp_img ? 1 : 0), "div", "comment", {fontSize:'11px'});
|
||||
$dh(this.loading_div);
|
||||
this.loading_div.innerHTML = 'Loading...';
|
||||
|
||||
this.body = $a($td(mytab, mytab.rows.length-1, this.opts.show_exp_img ? 1 : 0), "div", '', {overflow:'hidden', display:'none'});
|
||||
|
||||
this.select = function() {
|
||||
me.show_selected();
|
||||
if(me.onclick)me.onclick(me);
|
||||
}
|
||||
|
||||
this.show_selected = function() {
|
||||
if(me.tree.cur_node)me.tree.cur_node.deselect();
|
||||
if(me.opts.onselect_style) $y(me.label,me.opts.onselect_style)
|
||||
//me.label.style.fontWeight = 'bold';
|
||||
me.tree.cur_node = me;
|
||||
}
|
||||
|
||||
this.deselect = function() {
|
||||
if(me.opts.ondeselect_style) $y(me.label,me.opts.ondeselect_style)
|
||||
//me.label.style.fontWeight = 'normal';
|
||||
me.tree.cur_node=null
|
||||
}
|
||||
|
||||
this.expanded = 0;
|
||||
this.toggle = function() {
|
||||
if(me.expanded)
|
||||
me.collapse();
|
||||
else
|
||||
me.expand();
|
||||
}
|
||||
this.collapse = function() {
|
||||
me.expanded = 0;
|
||||
$(me.body).slideUp();
|
||||
me.expimage.src = me.exp_img ? me.exp_img : me.tree.exp_img;
|
||||
}
|
||||
this.expand = function() {
|
||||
if(me.onexpand && !me.expanded_once){
|
||||
me.onexpand(me);
|
||||
if(!me.tree.do_animate) me.show_expanded(); // else to be called from expand (for animation)
|
||||
} else {
|
||||
me.show_expanded();
|
||||
}
|
||||
me.expanded = 1;
|
||||
me.expanded_once = 1;
|
||||
me.expimage.src = me.col_img ? me.col_img : me.tree.col_img;
|
||||
}
|
||||
this.show_expanded = function() {
|
||||
if(me.tree.do_animate && (!keys(me.nodes).length)) return; // no children
|
||||
$(me.body).slideDown();
|
||||
}
|
||||
|
||||
this.setlabel = function(l) {
|
||||
me.label.value = l;
|
||||
me.label.innerHTML = l;
|
||||
}
|
||||
|
||||
this.setlabel(this.text);
|
||||
|
||||
this.setcolor = function(c) {
|
||||
this.backColor = c;
|
||||
if(cur_node!=this)
|
||||
$bg(this.body,this.backColor);
|
||||
}
|
||||
|
||||
this.label.onclick= function(e) { me.select(); }
|
||||
this.label.ondblclick = function(e) { me.select(); if(me.ondblclick)me.ondblclick(me); }
|
||||
|
||||
this.clear_child_nodes = function() {
|
||||
if(this.tab){
|
||||
this.tab.parentNode.removeChild(this.tab);
|
||||
delete this.tab;
|
||||
}
|
||||
this.expanded_once = 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,88 +0,0 @@
|
|||
// Copyright (c) 2012 Web Notes Technologies Pvt Ltd (http://erpnext.com)
|
||||
//
|
||||
// MIT License (MIT)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
// OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
wn.widgets.form.sidebar = { Sidebar: function(form) {
|
||||
var me = this;
|
||||
this.form = form;
|
||||
this.opts = {
|
||||
sections: [
|
||||
|
||||
{
|
||||
title: wn._('Assign'),
|
||||
render: function(wrapper) {
|
||||
me.form.assign_to = new wn.ui.form.AssignTo({
|
||||
parent: $(wrapper),
|
||||
frm: me.form
|
||||
});
|
||||
me.form.assign_to.refresh();
|
||||
},
|
||||
display: function() { return !me.form.doc.__islocal }
|
||||
},
|
||||
|
||||
{
|
||||
title: wn._('Attachments'),
|
||||
render: function(wrapper) {
|
||||
me.form.attachments = new wn.ui.form.Attachments({
|
||||
parent: $(wrapper),
|
||||
frm:me.form
|
||||
});
|
||||
me.form.attachments.refresh();
|
||||
},
|
||||
display: function() { return me.form.meta.allow_attach }
|
||||
},
|
||||
|
||||
{
|
||||
title: wn._('Comments'),
|
||||
render: function(wrapper) {
|
||||
new wn.widgets.form.sidebar.Comments(wrapper, me, me.form.doctype, me.form.docname);
|
||||
},
|
||||
display: function() {
|
||||
$(cur_frm.body).find(".latest-comment").toggle(false);
|
||||
return !me.form.doc.__islocal;
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
title: wn._('Tags'),
|
||||
render: function(wrapper) {
|
||||
me.form.taglist = new TagList(wrapper,
|
||||
me.form.doc._user_tags ? me.form.doc._user_tags.split(',') : [],
|
||||
me.form.doctype, me.form.docname, 0,
|
||||
function() { });
|
||||
},
|
||||
display: function() { return !me.form.doc.__islocal }
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
this.refresh = function() {
|
||||
var parent = this.form.sidebar_area;
|
||||
if(!this.sidebar) {
|
||||
//$y(parent, {paddingTop:'37px'})
|
||||
this.sidebar = new wn.widgets.PageSidebar(parent, this.opts);
|
||||
} else {
|
||||
this.sidebar.refresh();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}}
|
||||
|
|
@ -1,151 +0,0 @@
|
|||
// Copyright (c) 2012 Web Notes Technologies Pvt Ltd (http://erpnext.com)
|
||||
//
|
||||
// MIT License (MIT)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
// OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
// opts = { 'title': 'My Sidebar',
|
||||
// 'sections': [
|
||||
// {'title': 'Actions',
|
||||
// 'items': [{type: , label:, onclick function / string to eval], ]
|
||||
// 'render': function (optional)
|
||||
// }
|
||||
//
|
||||
// item types = link, button, html, inpu
|
||||
|
||||
|
||||
//
|
||||
// Page Sidebar
|
||||
//
|
||||
wn.widgets.PageSidebar = function(parent, opts) {
|
||||
this.opts = opts
|
||||
this.sections = {}
|
||||
this.wrapper = $a(parent, 'div', 'psidebar')
|
||||
|
||||
// refresh sidebar - make head and sections
|
||||
this.refresh = function() {
|
||||
this.wrapper.innerHTML = ''
|
||||
if(this.opts.title)
|
||||
this.make_head();
|
||||
for(var i=0; i<this.opts.sections.length; i++) {
|
||||
var section = this.opts.sections[i];
|
||||
|
||||
if((section.display && section.display()) || !section.display) {
|
||||
|
||||
this.sections[section.title]
|
||||
= new wn.widgets.PageSidebarSection(this, section);
|
||||
}
|
||||
}
|
||||
if(this.opts.onrefresh) { this.opts.onrefresh(this) }
|
||||
}
|
||||
|
||||
this.make_head = function() {
|
||||
this.head = $a(this.wrapper, 'div', 'head', '', this.opts.title);
|
||||
}
|
||||
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
//
|
||||
// Sidebar Section
|
||||
//
|
||||
wn.widgets.PageSidebarSection = function(sidebar, opts) {
|
||||
this.items = [];
|
||||
this.sidebar = sidebar;
|
||||
this.wrapper = $a(sidebar.wrapper, 'div', 'section');
|
||||
this.head = $a(this.wrapper, 'div', 'section-head', '', opts.title);
|
||||
this.body = $a(this.wrapper, 'div', 'section-body');
|
||||
$br(this.wrapper, '5px');
|
||||
this.opts = opts;
|
||||
|
||||
|
||||
// make items
|
||||
this.make_items = function() {
|
||||
for(var i=0; i<this.opts.items.length; i++) {
|
||||
|
||||
var item = this.opts.items[i];
|
||||
if((item.display && item.display()) || !item.display) {
|
||||
|
||||
var div = $a(this.body, 'div', 'section-item small');
|
||||
this.make_one_item(item, div);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
this.make_one_item = function(item, div) {
|
||||
if (item.type.toLowerCase()=='link')
|
||||
this.items[item.label] = new wn.widgets.PageSidebarLink(this, item, div);
|
||||
|
||||
else if (item.type.toLowerCase()=='button')
|
||||
this.items[item.label] = new wn.widgets.PageSidebarButton(this, this.opts.items[i], div);
|
||||
|
||||
//else if (item.type=='Input')
|
||||
// new wn.widgets.PageSidebarInput(this, this.opts.items[i], div);
|
||||
|
||||
else if (item.type.toLowerCase()=='html')
|
||||
this.items[item.label] = new wn.widgets.PageSidebarHTML(this, this.opts.items[i], div);
|
||||
}
|
||||
|
||||
// image
|
||||
this.add_icon = function(parent, icon) {
|
||||
var img = $a(parent, 'i', icon, {display:'inline-block', width:'20px'});
|
||||
}
|
||||
|
||||
this.refresh = function() {
|
||||
this.body.innerHTML = '';
|
||||
if(this.opts.render) {
|
||||
this.opts.render(this.body); }
|
||||
else
|
||||
this.make_items();
|
||||
}
|
||||
this.refresh();
|
||||
}
|
||||
//
|
||||
// Elements
|
||||
//
|
||||
|
||||
// link
|
||||
wn.widgets.PageSidebarLink = function(section, opts, wrapper) {
|
||||
this.wrapper = wrapper;
|
||||
this.section = section;
|
||||
this.opts = opts;
|
||||
|
||||
var me = this;
|
||||
if(opts.icon) {
|
||||
section.add_icon(this.wrapper, opts.icon);
|
||||
}
|
||||
this.ln = $a(this.wrapper, 'span', 'link_type section-link', opts.style, opts.label);
|
||||
this.ln.onclick = function() { me.opts.onclick(me) };
|
||||
}
|
||||
|
||||
// button
|
||||
wn.widgets.PageSidebarButton = function(section, opts, wrapper) {
|
||||
this.wrapper = wrapper;
|
||||
this.section = section;
|
||||
this.opts = opts;
|
||||
|
||||
var me = this;
|
||||
this.btn = $btn(this.wrapper, opts.label, opts.onclick, opts.style, opts.color);
|
||||
}
|
||||
|
||||
// html
|
||||
wn.widgets.PageSidebarHTML = function(section, opts, wrapper) {
|
||||
wrapper.innerHTML = opts.content
|
||||
}
|
||||
2
public/js/lib/bootstrap.min.js
vendored
2
public/js/lib/bootstrap.min.js
vendored
File diff suppressed because one or more lines are too long
|
|
@ -1,5 +1,6 @@
|
|||
wn.ui.form.Layout = Class.extend({
|
||||
init: function(opts) {
|
||||
this.labelled_section_count = 0;
|
||||
this.ignore_types = ["Section Break", "Column Break"];
|
||||
$.extend(this, opts);
|
||||
this.make();
|
||||
|
|
@ -7,6 +8,7 @@ wn.ui.form.Layout = Class.extend({
|
|||
},
|
||||
make: function() {
|
||||
this.wrapper = $('<div class="form-layout">').appendTo(this.parent);
|
||||
this.dashboard = $('<div class="row form-dashboard">').appendTo(this.wrapper);
|
||||
this.fields = wn.meta.get_docfields(this.frm.doctype);
|
||||
this.setup_tabbing();
|
||||
},
|
||||
|
|
@ -67,14 +69,21 @@ wn.ui.form.Layout = Class.extend({
|
|||
if(this.section) {
|
||||
//$("<hr>").appendTo(this.wrapper);
|
||||
}
|
||||
this.section = $('<div class="row">').appendTo(this.wrapper);
|
||||
this.section = $('<div class="row">')
|
||||
.appendTo(this.wrapper);
|
||||
this.frm.sections.push(this.section);
|
||||
|
||||
var section = this.section[0];
|
||||
section.df = df;
|
||||
if(df) {
|
||||
if(df.label) {
|
||||
$('<h3 class="col col-lg-12">' + df.label + "</h3>").appendTo(this.section);
|
||||
this.labelled_section_count++;
|
||||
$('<h3 class="col col-lg-12">' + this.labelled_section_count
|
||||
+ ". " + df.label + "</h3>")
|
||||
.css({"font-weight": "bold", "margin-bottom": "15px"})
|
||||
.appendTo(this.section);
|
||||
if(this.frm.sections.length > 1)
|
||||
this.section.css({"margin-top": "15px", "border-top": "1px solid #eee"});
|
||||
}
|
||||
if(df.description) {
|
||||
$('<div class="col col-lg-12 small text-muted">' + df.description + '</div>').appendTo(this.section);
|
||||
|
|
@ -174,4 +183,38 @@ wn.ui.form.Layout = Class.extend({
|
|||
get_open_grid_row: function() {
|
||||
return $(".grid-row-open").data("grid_row");
|
||||
},
|
||||
|
||||
// dashboard
|
||||
clear_dashboard: function() {
|
||||
this.dashboard.empty();
|
||||
},
|
||||
add_doctype_badge: function(label, doctype, fieldname) {
|
||||
if(wn.model.can_read(doctype)) {
|
||||
this.add_badge(label, function() {
|
||||
wn.route_options = {};
|
||||
wn.route_options[fieldname] = cur_frm.doc.name;
|
||||
wn.set_route("List", doctype);
|
||||
}).attr("data-doctype", doctype);
|
||||
}
|
||||
},
|
||||
add_badge: function(label, onclick) {
|
||||
var badge = $(repl('<div class="col col-lg-4">\
|
||||
<div class="alert alert-badge">\
|
||||
<a class="badge-link">%(label)s</a>\
|
||||
<span class="badge pull-right">-</span>\
|
||||
</div></div>', {label:label}))
|
||||
.appendTo(this.dashboard)
|
||||
|
||||
badge.find(".badge-link").click(onclick);
|
||||
|
||||
return badge.find(".alert-badge");
|
||||
},
|
||||
set_badge_count: function(data) {
|
||||
var me = this;
|
||||
$.each(data, function(doctype, count) {
|
||||
$(me.dashboard)
|
||||
.find(".alert-badge[data-doctype='"+doctype+"'] .badge")
|
||||
.html(cint(count));
|
||||
});
|
||||
},
|
||||
})
|
||||
|
|
@ -63,8 +63,10 @@ wn.ui.form.Toolbar = Class.extend({
|
|||
attachments = keys(docinfo.attachments).length,
|
||||
assignments = docinfo.assignments.length;
|
||||
|
||||
var $li1 = this.appframe.add_infobar(comments + " " + (comments===1 ?
|
||||
wn._("Comment") : wn._("Comments")),
|
||||
var $li1 = this.appframe.add_infobar(
|
||||
(comments ? '<i class="icon-comments" style="font-size: 120%; color: orange"></i> ' : '')
|
||||
+ comments + " "
|
||||
+ (comments===1 ? wn._("Comment") : wn._("Comments")),
|
||||
function() {
|
||||
$('html, body').animate({
|
||||
scrollTop: $(me.frm.wrapper).find(".form-comments").offset().top
|
||||
|
|
@ -249,7 +251,9 @@ wn.ui.form.Toolbar = Class.extend({
|
|||
if(docstatus==0 && p[SUBMIT] && (!me.frm.doc.__islocal)
|
||||
&& (!me.frm.doc.__unsaved)) {
|
||||
this.appframe.add_button('Submit', function() {
|
||||
me.frm.savesubmit(this);}, 'icon-lock', true).addClass("btn-primary");
|
||||
me.frm.savesubmit(this);}, 'icon-lock', true)
|
||||
.removeClass("btn-default")
|
||||
.addClass("btn-primary");
|
||||
}
|
||||
else if(docstatus==0) {
|
||||
this.make_save_button();
|
||||
|
|
@ -269,7 +273,9 @@ wn.ui.form.Toolbar = Class.extend({
|
|||
return;
|
||||
var me = this;
|
||||
this.appframe.add_button('Save', function() {
|
||||
me.frm.save('Save', null, this);}, 'icon-save', true).addClass("btn-primary");
|
||||
me.frm.save('Save', null, this);}, 'icon-save', true)
|
||||
.removeClass("btn-default")
|
||||
.addClass("btn-primary");
|
||||
},
|
||||
add_update_button_on_dirty: function() {
|
||||
var me = this;
|
||||
|
|
@ -282,7 +288,9 @@ wn.ui.form.Toolbar = Class.extend({
|
|||
&& !me.appframe.$w.find(".action-update").length) {
|
||||
me.appframe.add_button("Update", function() {
|
||||
me.frm.save('Update', null, me);
|
||||
}, 'icon-save', true).addClass("btn-primary action-update");
|
||||
}, 'icon-save', true)
|
||||
.removeClass("btn-default")
|
||||
.addClass("btn-primary action-update");
|
||||
}
|
||||
})
|
||||
},
|
||||
|
|
|
|||
|
|
@ -19,12 +19,13 @@ wn.avatar = function(user, large, title) {
|
|||
var to_size = large ? 72 : 30;
|
||||
if(!title) title = wn.user_info(user).fullname;
|
||||
|
||||
return repl('<span class="avatar" title="%(title)s" style="width: %(len)s; \
|
||||
return repl('<span class="avatar %(small_or_large)s" title="%(title)s" style="width: %(len)s; \
|
||||
height: %(len)s; border-radius: %(len)s; overflow: hidden;">\
|
||||
<img src="%(image)s"></span>', {
|
||||
image: image,
|
||||
len: to_size + "px",
|
||||
title: title
|
||||
title: title,
|
||||
small_or_large: large ? "avatar-large" : "avatar-small"
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ wn.ui.AppFrame = Class.extend({
|
|||
.appendTo($right);
|
||||
|
||||
if(e.type==active_view) {
|
||||
btn.addClass("btn-info");
|
||||
btn.removeClass("btn-default").addClass("btn-info");
|
||||
}
|
||||
});
|
||||
},
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ wn.ui.Listing = Class.extend({
|
|||
// new
|
||||
if(this.new_doctype) {
|
||||
this.add_button(wn._('New') + ' ' + wn._(this.new_doctype), function() {
|
||||
(me.custom_new_doc || me.make_new_doc)(me.new_doctype);
|
||||
(me.custom_new_doc || me.make_new_doc).apply(me, [me.new_doctype]);
|
||||
}, 'icon-plus');
|
||||
}
|
||||
|
||||
|
|
@ -189,8 +189,18 @@ wn.ui.Listing = Class.extend({
|
|||
}
|
||||
},
|
||||
|
||||
make_new_doc: function(new_doctype) {
|
||||
new_doc(new_doctype);
|
||||
make_new_doc: function(doctype) {
|
||||
var me = this;
|
||||
wn.model.with_doctype(doctype, function() {
|
||||
var doc = wn.model.get_new_doc(doctype);
|
||||
if(me.filter_list) {
|
||||
$.each(me.filter_list.get_filters(), function(i, f) {
|
||||
if(f[0]===doctype && f[2]==="=")
|
||||
doc[f[1]]=f[3];
|
||||
})
|
||||
}
|
||||
wn.set_route("Form", doctype, doc.name);
|
||||
});
|
||||
},
|
||||
|
||||
make_filters: function() {
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ wn.views.DocListView = wn.ui.Listing.extend({
|
|||
// make_new_doc can be overridden so that default values can be prefilled
|
||||
// for example - communication list in customer
|
||||
$(this.wrapper).on("click", 'button[list_view_doc="'+me.doctype+'"]', function(){
|
||||
(me.listview.make_new_doc || me.make_new_doc)(me.doctype);
|
||||
(me.listview.make_new_doc || me.make_new_doc).apply(me, [me.doctype]);
|
||||
});
|
||||
|
||||
if((auto_run !== false) && (auto_run !== 0))
|
||||
|
|
@ -190,7 +190,7 @@ wn.views.DocListView = wn.ui.Listing.extend({
|
|||
|
||||
make_no_result: function() {
|
||||
var new_button = wn.boot.profile.can_create.indexOf(this.doctype)!=-1
|
||||
? ('<hr><p><button class="btn btn-default btn-info" \
|
||||
? ('<hr><p><button class="btn btn-primary" \
|
||||
list_view_doc="%(doctype)s">'+
|
||||
wn._('Make a new') + ' %(doctype_label)s</button></p>')
|
||||
: '';
|
||||
|
|
|
|||
|
|
@ -75,8 +75,10 @@ wn.views.moduleview.ModuleView = Class.extend({
|
|||
add_section: function(section) {
|
||||
section._title = wn._(section.title);
|
||||
if(section.top) {
|
||||
var module_top = $(this.wrapper).find(".module-top");
|
||||
var list_group = $('<div>')
|
||||
.appendTo($(this.wrapper).find(".module-top"));
|
||||
.appendTo(module_top);
|
||||
$('<div class="col col-lg-12"><hr /></div>').appendTo(module_top);
|
||||
} else {
|
||||
var list_group = $('<ul class="list-group">\
|
||||
<li class="list-group-item">\
|
||||
|
|
@ -95,16 +97,16 @@ wn.views.moduleview.ModuleView = Class.extend({
|
|||
if(item.count==null) item.count = "";
|
||||
if(section.top) {
|
||||
var $parent = $(repl('<div class="col col-lg-4">\
|
||||
<div class="alert"></div>\
|
||||
<div>\
|
||||
<div class="module-item-progress" data-doctype="%(doctype)s">\
|
||||
<div class="module-item-progress-total">\
|
||||
<div class="module-item-progress-open">\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>', {doctype:item.doctype}))
|
||||
<div class="alert alert-badge"></div>'
|
||||
// <div>\
|
||||
// <div class="module-item-progress" data-doctype="%(doctype)s">\
|
||||
// <div class="module-item-progress-total">\
|
||||
// <div class="module-item-progress-open">\
|
||||
// </div>\
|
||||
// </div>\
|
||||
// </div>\
|
||||
// </div>\
|
||||
+'</div>', {doctype:item.doctype}))
|
||||
.appendTo(section.list_group)
|
||||
.find(".alert");
|
||||
this.top_item_total[item.doctype] = 0;
|
||||
|
|
@ -129,6 +131,7 @@ wn.views.moduleview.ModuleView = Class.extend({
|
|||
}
|
||||
},
|
||||
set_top_item_count: function(doctype, count, open_count) {
|
||||
return;
|
||||
var me = this;
|
||||
if(this.top_item_total[doctype]!=null) {
|
||||
|
||||
|
|
|
|||
|
|
@ -95,6 +95,7 @@ login.show_login = function() {
|
|||
}
|
||||
|
||||
window.is_login = true;
|
||||
window.is_signup = false;
|
||||
}
|
||||
|
||||
login.show_sign_up = function() {
|
||||
|
|
|
|||
|
|
@ -416,6 +416,16 @@ def repsond_as_web_page(title, html):
|
|||
response['type'] = 'page'
|
||||
response['page_name'] = 'message.html'
|
||||
|
||||
def load_json(obj):
|
||||
if isinstance(obj, basestring):
|
||||
import json
|
||||
try:
|
||||
obj = json.loads(obj)
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
return obj
|
||||
|
||||
_config = None
|
||||
def get_config():
|
||||
global _config
|
||||
|
|
|
|||
|
|
@ -90,4 +90,6 @@ def set_default(key, value, parent=None):
|
|||
def make_width_property_setter():
|
||||
doclist = json.loads(webnotes.form_dict.doclist)
|
||||
if doclist[0]["doctype"]=="Property Setter" and doclist[0]["property"]=="width":
|
||||
webnotes.bean(doclist).save()
|
||||
bean = webnotes.bean(doclist)
|
||||
bean.ignore_permissions = True
|
||||
bean.insert()
|
||||
|
|
|
|||
|
|
@ -330,7 +330,11 @@ class Database:
|
|||
return self.get_values_from_table(fields, filters, doctype, as_dict, debug)
|
||||
except Exception, e:
|
||||
if ignore and e.args[0] in (1146, 1054):
|
||||
# table or column not found, return None
|
||||
return None
|
||||
elif (not ignore) and e.args[0]==1146:
|
||||
# table not found, look in singles
|
||||
pass
|
||||
else:
|
||||
raise e
|
||||
|
||||
|
|
@ -365,9 +369,16 @@ class Database:
|
|||
return r and [[i[1] for i in r]] or []
|
||||
|
||||
def get_values_from_table(self, fields, filters, doctype, as_dict, debug):
|
||||
fl = fields
|
||||
if fields!="*":
|
||||
fl = ("`" + "`, `".join(fields) + "`")
|
||||
fl = []
|
||||
if isinstance(fields, (list, tuple)):
|
||||
for f in fields:
|
||||
if "(" in f: # function
|
||||
fl.append(f)
|
||||
else:
|
||||
fl.append("`" + f + "`")
|
||||
fl = ", ".join(fields)
|
||||
else:
|
||||
fl = fields
|
||||
|
||||
conditions, filters = self.build_conditions(filters)
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,6 @@ class Bean:
|
|||
doclist += getchildren(doc.name, t[0], t[1], dt, prefix=prefix)
|
||||
|
||||
self.set_doclist(doclist)
|
||||
self.run_method("onload")
|
||||
|
||||
def __iter__(self):
|
||||
return self.doclist.__iter__()
|
||||
|
|
|
|||
|
|
@ -212,18 +212,19 @@ def check_if_doc_is_linked(dt, dn, method="Delete"):
|
|||
"""
|
||||
from webnotes.model.rename_doc import get_link_fields
|
||||
link_fields = get_link_fields(dt)
|
||||
link_fields = [[lf['parent'], lf['fieldname']] for lf in link_fields]
|
||||
link_fields = [[lf['parent'], lf['fieldname'], lf['issingle']] for lf in link_fields]
|
||||
|
||||
for link_dt, link_field in link_fields:
|
||||
item = webnotes.conn.get_value(link_dt, {link_field:dn}, ["name", "parent", "parenttype",
|
||||
"docstatus"], as_dict=True)
|
||||
for link_dt, link_field, issingle in link_fields:
|
||||
if not issingle:
|
||||
item = webnotes.conn.get_value(link_dt, {link_field:dn},
|
||||
["name", "parent", "parenttype", "docstatus"], as_dict=True)
|
||||
|
||||
if item and item.parent != dn and (method=="Delete" or
|
||||
(method=="Cancel" and item.docstatus==1)):
|
||||
webnotes.msgprint(method + " " + _("Error") + ":"+\
|
||||
("%s (%s) " % (dn, dt)) + _("is linked in") + (" %s (%s)") %
|
||||
(item.parent or item.name, item.parent and item.parenttype or link_dt),
|
||||
raise_exception=LinkExistsError)
|
||||
if item and item.parent != dn and (method=="Delete" or
|
||||
(method=="Cancel" and item.docstatus==1)):
|
||||
webnotes.msgprint(method + " " + _("Error") + ":"+\
|
||||
("%s (%s) " % (dn, dt)) + _("is linked in") + (" %s (%s)") %
|
||||
(item.parent or item.name, item.parent and item.parenttype or link_dt),
|
||||
raise_exception=LinkExistsError)
|
||||
|
||||
def set_default(doc, key):
|
||||
if not doc.is_default:
|
||||
|
|
|
|||
|
|
@ -45,7 +45,11 @@ def getdoc(doctype, name, user=None):
|
|||
return []
|
||||
|
||||
try:
|
||||
doclist = webnotes.bean(doctype, name).doclist
|
||||
bean = webnotes.bean(doctype, name)
|
||||
bean.run_method("onload")
|
||||
|
||||
doclist = bean.doclist
|
||||
|
||||
# add file list
|
||||
set_docinfo(doctype, name)
|
||||
|
||||
|
|
@ -54,7 +58,7 @@ def getdoc(doctype, name, user=None):
|
|||
webnotes.msgprint('Did not load.')
|
||||
raise e
|
||||
|
||||
if doclist and not name.startswith('_'):
|
||||
if bean and not name.startswith('_'):
|
||||
webnotes.user.update_recent(doctype, name)
|
||||
|
||||
webnotes.response['docs'] = doclist
|
||||
|
|
@ -113,4 +117,15 @@ def add_assignments(dt, dn):
|
|||
"name": dn
|
||||
})
|
||||
|
||||
return cl
|
||||
return cl
|
||||
|
||||
@webnotes.whitelist()
|
||||
def get_badge_info(doctypes, filters):
|
||||
filters = json.loads(filters)
|
||||
doctypes = json.loads(doctypes)
|
||||
filters["docstatus"] = ["!=", 2]
|
||||
out = {}
|
||||
for doctype in doctypes:
|
||||
out[doctype] = webnotes.conn.get_value(doctype, filters, "count(*)")
|
||||
|
||||
return out
|
||||
|
|
@ -27,13 +27,6 @@ def get_doctype_count_from_table(doctype):
|
|||
else:
|
||||
raise e
|
||||
return count
|
||||
|
||||
def get_doctype_count(doctype):
|
||||
count = webnotes.conn.get_global("item_count:" + doctype)
|
||||
if count is None:
|
||||
count = get_doctype_count_from_table(doctype)
|
||||
webnotes.conn.set_global("item_count:" + doctype, count)
|
||||
return count
|
||||
|
||||
def get_report_list(module):
|
||||
"""return list on new style reports for modules"""
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue