@@ -20,6 +20,24 @@ h1, h2, h3, h4, h5 { | |||
body { | |||
font-family: "Helvetica Neue", Helvetica, "Helvetica Neue", sans-serif; | |||
font-size: 13px; | |||
background-color: #eee; | |||
} | |||
footer { | |||
background: #b7b7b7; /* Old browsers */ | |||
background: -moz-linear-gradient(top, #b7b7b7 0%, #eeeeee 36%); /* FF3.6+ */ | |||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#b7b7b7), color-stop(36%,#eeeeee)); /* Chrome,Safari4+ */ | |||
background: -webkit-linear-gradient(top, #b7b7b7 0%,#eeeeee 36%); /* Chrome10+,Safari5.1+ */ | |||
background: -o-linear-gradient(top, #b7b7b7 0%,#eeeeee 36%); /* Opera 11.10+ */ | |||
background: -ms-linear-gradient(top, #b7b7b7 0%,#eeeeee 36%); /* IE10+ */ | |||
background: linear-gradient(top, #b7b7b7 0%,#eeeeee 36%); /* W3C */ | |||
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#b7b7b7', endColorstr='#eeeeee',GradientType=0 ); /* IE6-9 */ | |||
border-top: 1px solid #999; | |||
text-align: center; | |||
color: inherit; | |||
padding: 10px; | |||
font-size: 12px; | |||
line-height: 1.7; | |||
} | |||
span, div, td, input, textarea, button, select { | |||
@@ -125,10 +143,10 @@ div.comment { color: #444; } | |||
} | |||
div#body_div { | |||
display: none; | |||
padding-right: 7px; | |||
padding-top: 70px; | |||
padding-bottom: 50px; | |||
min-height: 400px; | |||
} | |||
.content { | |||
@@ -33,17 +33,30 @@ var l=items.length;for(var i=0;i<l;i++){var src=items[i];wn.assets.execute(src); | |||
/* | |||
* lib/js/wn/dom.js | |||
*/ | |||
wn.provide('wn.dom');wn.dom.by_id=function(id){return document.getElementById(id);} | |||
wn.dom.eval=function(txt){if(!txt)return;var el=document.createElement('script');el.appendChild(document.createTextNode(txt));document.getElementsByTagName('head')[0].appendChild(el);} | |||
wn.dom.set_style=function(txt){if(!txt)return;var se=document.createElement('style');se.type="text/css";if(se.styleSheet){se.styleSheet.cssText=txt;}else{se.appendChild(document.createTextNode(txt));} | |||
document.getElementsByTagName('head')[0].appendChild(se);} | |||
wn.dom.add=function(parent,newtag,className,cs,innerHTML,onclick){if(parent&&parent.substr)parent=wn.dom.by_id(parent);var c=document.createElement(newtag);if(parent) | |||
wn.provide('wn.dom');wn.dom={by_id:function(id){return document.getElementById(id);},eval:function(txt){if(!txt)return;var el=document.createElement('script');el.appendChild(document.createTextNode(txt));document.getElementsByTagName('head')[0].appendChild(el);},set_style:function(txt){if(!txt)return;var se=document.createElement('style');se.type="text/css";if(se.styleSheet){se.styleSheet.cssText=txt;}else{se.appendChild(document.createTextNode(txt));} | |||
document.getElementsByTagName('head')[0].appendChild(se);},add:function(parent,newtag,className,cs,innerHTML,onclick){if(parent&&parent.substr)parent=wn.dom.by_id(parent);var c=document.createElement(newtag);if(parent) | |||
parent.appendChild(c);if(className){if(newtag.toLowerCase()=='img') | |||
c.src=className | |||
else | |||
c.className=className;} | |||
if(cs)wn.dom.css(c,cs);if(innerHTML)c.innerHTML=innerHTML;if(onclick)c.onclick=onclick;return c;} | |||
wn.dom.css=function(ele,s){if(ele&&s){for(var i in s)ele.style[i]=s[i];};return ele;} | |||
if(cs)wn.dom.css(c,cs);if(innerHTML)c.innerHTML=innerHTML;if(onclick)c.onclick=onclick;return c;},css:function(ele,s){if(ele&&s){for(var i in s)ele.style[i]=s[i];};return ele;},placeholder:function(dim,letter){function getsinglecol(){return Math.min(Math.round(Math.random()*9)*Math.round(Math.random()*1)+3,9)} | |||
function getcol(){return''+getsinglecol()+getsinglecol()+getsinglecol();} | |||
args={width:Math.round(flt(dim)*0.7)+'px',height:Math.round(flt(dim)*0.7)+'px',padding:Math.round(flt(dim)*0.15)+'px','font-size':Math.round(flt(dim)*0.6)+'px',col1:getcol(),col2:getcol(),letter:letter.substr(0,1).toUpperCase()} | |||
return repl('<div style="\ | |||
height: %(height)s; \ | |||
width: %(width)s; \ | |||
font-size: %(font-size)s; \ | |||
color: #fff; \ | |||
text-align: center; \ | |||
padding: %(padding)s; \ | |||
background: -moz-linear-gradient(top, #%(col1)s 0%, #%(col2)s 99%); /* FF3.6+ */\ | |||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#%(col1)s), color-stop(99%,#%(col2)s)); /* Chrome,Safari4+ */\ | |||
background: -webkit-linear-gradient(top, #%(col1)s 0%,#%(col2)s 99%); /* Chrome10+,Safari5.1+ */\ | |||
background: -o-linear-gradient(top, #%(col1)s 0%,#%(col2)s 99%); /* Opera 11.10+ */\ | |||
background: -ms-linear-gradient(top, #%(col1)s 0%,#%(col2)s 99%); /* IE10+ */\ | |||
background: linear-gradient(top, #%(col1)s 0%,#%(col2)s 99%); /* W3C */\ | |||
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr=\'#%(col1)s\', endColorstr=\'#%(col2)s\',GradientType=0 ); /* IE6-9 */\ | |||
">%(letter)s</div>',args);}} | |||
wn.get_cookie=function(c){var t=""+document.cookie;var ind=t.indexOf(c);if(ind==-1||c=="")return"";var ind1=t.indexOf(';',ind);if(ind1==-1)ind1=t.length;return unescape(t.substring(ind+c.length+1,ind1));} | |||
wn.dom.set_box_shadow=function(ele,spread){$(ele).css('-moz-box-shadow','0px 0px '+spread+'px rgba(0,0,0,0.3);') | |||
$(ele).css('-webkit-box-shadow','0px 0px '+spread+'px rgba(0,0,0,0.3);') | |||
@@ -176,7 +189,7 @@ if(this.args) | |||
$.extend(args,this.args) | |||
if(this.get_args){$.extend(args,this.get_args(opts));} | |||
return args;},render_results:function(r){if(this.start==0)this.clear();this.$w.find('.btn-more').toggle(false);if(r.message)r.values=r.message;if(r.values&&r.values.length){this.data=this.data.concat(r.values);this.render_list(r.values);this.update_paging(r.values);}else{if(this.start==0){this.$w.find('.result').toggle(false);this.$w.find('.no-result').toggle(true);}} | |||
if(this.onrun)this.onrun();if(this.callback)this.callback(r);},render_list:function(values){var m=Math.min(values.length,this.page_length);for(var i=0;i<m;i++){this.render_row(this.add_row(),values[i],this,i);}},update_paging:function(values){if(values.length>=this.page_length){this.$w.find('.btn-more').toggle(true);this.start+=this.page_length;}},add_row:function(){return this.$w.find('.result-list').append('<div class="list-row">').find('.list-row:last').get(0);},refresh:function(){this.run();},add_limits:function(){this.query+=' LIMIT '+this.start+','+(this.page_length+1);}}); | |||
if(this.onrun)this.onrun();if(this.callback)this.callback(r);},render_list:function(values){var m=Math.min(values.length,this.page_length);for(var i=0;i<m;i++){this.render_row(this.add_row(),values[i],this,i);}},update_paging:function(values){if(values.length>=this.page_length){this.$w.find('.btn-more').toggle(true);this.start+=this.page_length;}},add_row:function(){return $('<div class="list-row">').appendTo(this.$w.find('.result-list')).get(0);},refresh:function(){this.run();},add_limits:function(){this.query+=' LIMIT '+this.start+','+(this.page_length+1);}}); | |||
/* | |||
* lib/js/wn/ui/filters.js | |||
*/ | |||
@@ -260,6 +260,7 @@ _f.Grid.prototype.set_cell_value = function(cell) { | |||
// and a grid cell is selected | |||
// deselect the cell | |||
$(document).bind('click', function(e) { | |||
var me = this; | |||
var is_target_toolbar = function() { | |||
return $(e.target).parents('.grid_tbarlinks').length; | |||
} | |||
@@ -270,7 +271,7 @@ $(document).bind('click', function(e) { | |||
// autosuggest openend | |||
//if(wn._autosugg_open) return true; | |||
return $(e.target).parents().get().indexOf(_f.cur_grid_cell)!=-1; | |||
} | |||
@@ -295,6 +296,8 @@ _f.Grid.prototype.cell_deselect = function() { | |||
} | |||
_f.Grid.prototype.cell_select = function(cell, ri, ci) { | |||
if(_f.cur_grid_cell==cell && cell.hc) return; | |||
if(ri!=null && ci!=null) | |||
cell = this.tab.rows[ri].cells[ci]; | |||
@@ -324,6 +327,7 @@ _f.Grid.prototype.add_template = function(cell) { | |||
cell.div.appendChild(hc.template.wrapper); | |||
hc.template.activate(cell.row.docname); | |||
hc.template.activated=1; | |||
cell.hc = hc; | |||
if(hc.template.input && hc.template.input.set_width) { | |||
hc.template.input.set_width($(cell).width()); | |||
@@ -350,8 +354,8 @@ _f.grid_refresh_date = function() { | |||
_f.grid_date_cell.grid.set_cell_value(_f.grid_date_cell); | |||
} | |||
_f.grid_refresh_field = function(temp, input) { | |||
if(input.value != _f.get_value(temp.doctype, temp.docname, temp.df.fieldname)) | |||
if(input.onchange)input.onchange(); | |||
if($(input).val() != _f.get_value(temp.doctype, temp.docname, temp.df.fieldname)) | |||
$(input).trigger('change'); | |||
} | |||
_f.Grid.prototype.remove_template = function(cell) { | |||
@@ -360,17 +364,13 @@ _f.Grid.prototype.remove_template = function(cell) { | |||
if(!hc.template)return; | |||
if(!hc.template.activated)return; | |||
if(hc.template.txt) { | |||
if(hc.template.df.fieldtype=='Date') { | |||
// for calendar popup. the value will come after this | |||
_f.grid_date_cell = cell; | |||
setTimeout('_f.grid_refresh_date()', 100); | |||
} | |||
if(hc.template.txt.value) | |||
_f.grid_refresh_field(hc.template, hc.template.txt); | |||
} else if(hc.template.input) { | |||
_f.grid_refresh_field(hc.template, hc.template.input); | |||
if(hc.template.df.fieldtype=='Date') { | |||
// for calendar popup. the value will come after this | |||
_f.grid_date_cell = cell; | |||
setTimeout('_f.grid_refresh_date()', 100); | |||
} else { | |||
var input = hc.template.txt || hc.template.input; | |||
_f.grid_refresh_field(hc.template, input) | |||
} | |||
if(hc.template && hc.template.wrapper.parentNode) | |||
@@ -64,8 +64,6 @@ wn.Application = Class.extend({ | |||
wn.container = new wn.views.Container(); | |||
wn.views.make_403(); | |||
wn.views.make_404(); | |||
$('#startup_div').toggle(false); | |||
$('#body_div').toggle(true); | |||
}, | |||
make_nav_bar: function() { | |||
// toolbar | |||
@@ -23,55 +23,84 @@ | |||
// add a new dom element | |||
wn.provide('wn.dom'); | |||
wn.dom.by_id = function(id) { | |||
return document.getElementById(id); | |||
} | |||
wn.dom.eval = function(txt) { | |||
if(!txt) return; | |||
var el = document.createElement('script'); | |||
el.appendChild(document.createTextNode(txt)); | |||
// execute the script globally | |||
document.getElementsByTagName('head')[0].appendChild(el); | |||
} | |||
wn.dom.set_style = function(txt) { | |||
if(!txt) return; | |||
var se = document.createElement('style'); | |||
se.type = "text/css"; | |||
if (se.styleSheet) { | |||
se.styleSheet.cssText = txt; | |||
} else { | |||
se.appendChild(document.createTextNode(txt)); | |||
} | |||
document.getElementsByTagName('head')[0].appendChild(se); | |||
} | |||
wn.dom = { | |||
by_id: function(id) { | |||
return document.getElementById(id); | |||
}, | |||
eval: function(txt) { | |||
if(!txt) return; | |||
var el = document.createElement('script'); | |||
el.appendChild(document.createTextNode(txt)); | |||
// execute the script globally | |||
document.getElementsByTagName('head')[0].appendChild(el); | |||
}, | |||
set_style: function(txt) { | |||
if(!txt) return; | |||
var se = document.createElement('style'); | |||
se.type = "text/css"; | |||
if (se.styleSheet) { | |||
se.styleSheet.cssText = txt; | |||
} else { | |||
se.appendChild(document.createTextNode(txt)); | |||
} | |||
document.getElementsByTagName('head')[0].appendChild(se); | |||
}, | |||
add: function(parent, newtag, className, cs, innerHTML, onclick) { | |||
if(parent && parent.substr)parent = wn.dom.by_id(parent); | |||
var c = document.createElement(newtag); | |||
if(parent) | |||
parent.appendChild(c); | |||
wn.dom.add = function(parent, newtag, className, cs, innerHTML, onclick) { | |||
if(parent && parent.substr)parent = wn.dom.by_id(parent); | |||
var c = document.createElement(newtag); | |||
if(parent) | |||
parent.appendChild(c); | |||
// if image, 3rd parameter is source | |||
if(className) { | |||
if(newtag.toLowerCase()=='img') | |||
c.src = className | |||
else | |||
c.className = className; | |||
// if image, 3rd parameter is source | |||
if(className) { | |||
if(newtag.toLowerCase()=='img') | |||
c.src = className | |||
else | |||
c.className = className; | |||
} | |||
if(cs) wn.dom.css(c,cs); | |||
if(innerHTML) c.innerHTML = innerHTML; | |||
if(onclick) c.onclick = onclick; | |||
return c; | |||
}, | |||
css: function(ele, s) { | |||
if(ele && s) { | |||
for(var i in s) ele.style[i]=s[i]; | |||
}; | |||
return ele; | |||
}, | |||
placeholder: function(dim, letter) { | |||
function getsinglecol() { | |||
return Math.min(Math.round(Math.random() * 9) * Math.round(Math.random() * 1) + 3, 9) | |||
} | |||
function getcol() { | |||
return '' + getsinglecol() + getsinglecol() + getsinglecol(); | |||
} | |||
args = { | |||
width: Math.round(flt(dim) * 0.7) + 'px', | |||
height: Math.round(flt(dim) * 0.7) + 'px', | |||
padding: Math.round(flt(dim) * 0.15) + 'px', | |||
'font-size': Math.round(flt(dim) * 0.6) + 'px', | |||
col1: getcol(), | |||
col2: getcol(), | |||
letter: letter.substr(0,1).toUpperCase() | |||
} | |||
return repl('<div style="\ | |||
height: %(height)s; \ | |||
width: %(width)s; \ | |||
font-size: %(font-size)s; \ | |||
color: #fff; \ | |||
text-align: center; \ | |||
padding: %(padding)s; \ | |||
background: -moz-linear-gradient(top, #%(col1)s 0%, #%(col2)s 99%); /* FF3.6+ */\ | |||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#%(col1)s), color-stop(99%,#%(col2)s)); /* Chrome,Safari4+ */\ | |||
background: -webkit-linear-gradient(top, #%(col1)s 0%,#%(col2)s 99%); /* Chrome10+,Safari5.1+ */\ | |||
background: -o-linear-gradient(top, #%(col1)s 0%,#%(col2)s 99%); /* Opera 11.10+ */\ | |||
background: -ms-linear-gradient(top, #%(col1)s 0%,#%(col2)s 99%); /* IE10+ */\ | |||
background: linear-gradient(top, #%(col1)s 0%,#%(col2)s 99%); /* W3C */\ | |||
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr=\'#%(col1)s\', endColorstr=\'#%(col2)s\',GradientType=0 ); /* IE6-9 */\ | |||
">%(letter)s</div>', args); | |||
} | |||
if(cs) wn.dom.css(c,cs); | |||
if(innerHTML) c.innerHTML = innerHTML; | |||
if(onclick) c.onclick = onclick; | |||
return c; | |||
} | |||
// add css to element | |||
wn.dom.css= function(ele, s) { | |||
if(ele && s) { | |||
for(var i in s) ele.style[i]=s[i]; | |||
}; | |||
return ele; | |||
} | |||
wn.get_cookie = function(c) { | |||
@@ -292,13 +292,12 @@ wn.ui.Listing = Class.extend({ | |||
} | |||
}, | |||
add_row: function() { | |||
return this.$w.find('.result-list').append('<div class="list-row">') | |||
.find('.list-row:last').get(0); | |||
return $('<div class="list-row">').appendTo(this.$w.find('.result-list')).get(0); | |||
}, | |||
refresh: function() { | |||
this.run(); | |||
}, | |||
add_limits: function() { | |||
this.query += ' LIMIT ' + this.start + ',' + (this.page_length+1); | |||
} | |||
} | |||
}); |
@@ -12,7 +12,7 @@ wn.ui.toolbar.NewDialog=wn.ui.toolbar.SelectorDialog.extend({init:function(){thi | |||
/* | |||
* lib/js/wn/ui/toolbar/search.js | |||
*/ | |||
wn.ui.toolbar.Search=wn.ui.toolbar.SelectorDialog.extend({init:function(){this._super({title:"Search",execute:function(val){selector.set_search(val);selector.show();},});this.set_values(profile.can_search.join(',').split(','));makeselector();}}); | |||
wn.ui.toolbar.Search=wn.ui.toolbar.SelectorDialog.extend({init:function(){this._super({title:"Search",execute:function(val){selector.set_search(val);selector.show();},});this.set_values(wn.boot.profile.can_search.join(',').split(','));makeselector();}}); | |||
/* | |||
* lib/js/wn/ui/toolbar/report.js | |||
*/ | |||
@@ -33,7 +33,7 @@ wn.ui.toolbar.Search = wn.ui.toolbar.SelectorDialog.extend({ | |||
}); | |||
// get new types | |||
this.set_values(profile.can_search.join(',').split(',')); | |||
this.set_values(wn.boot.profile.can_search.join(',').split(',')); | |||
// global search selector | |||
makeselector(); | |||
@@ -35,10 +35,6 @@ import webnotes | |||
body_html = """ | |||
<header></header> | |||
<div id="startup_div" style="padding: 8px; | |||
font-size: 12px; font-family: Arial !important; line-height: 1.6em;"> | |||
Loading... | |||
</div> | |||
<!-- Main Starts --> | |||
<div id="body_div"> | |||
</div> | |||
@@ -248,6 +248,7 @@ class Profile: | |||
self.can_create = d['can_create'] | |||
self.can_read = d['can_read'] | |||
self.can_write = d['can_write'] | |||
self.can_search = d['can_search'] | |||
self.can_get_report = d['can_get_report'] | |||
self.allow_modules = d['allow_modules'] | |||
self.all_read = d['all_read'] | |||