Przeglądaj źródła

Merge branch 'shf_rename' of github.com:webnotes/wnframework into shf_rename

version-14
Anand Doshi 13 lat temu
rodzic
commit
d91ad65ff1
10 zmienionych plików z 135 dodań i 81 usunięć
  1. +19
    -1
      css/legacy/body.css
  2. +21
    -8
      js/core.min.js
  3. +14
    -14
      js/legacy/widgets/form/grid.js
  4. +0
    -2
      js/wn/app.js
  5. +76
    -47
      js/wn/dom.js
  6. +2
    -3
      js/wn/ui/listing.js
  7. +1
    -1
      js/wn/ui/toolbar.min.js
  8. +1
    -1
      js/wn/ui/toolbar/search.js
  9. +0
    -4
      py/webnotes/cms/index.py
  10. +1
    -0
      py/webnotes/profile.py

+ 19
- 1
css/legacy/body.css Wyświetl plik

@@ -20,6 +20,24 @@ h1, h2, h3, h4, h5 {
body { body {
font-family: "Helvetica Neue", Helvetica, "Helvetica Neue", sans-serif; font-family: "Helvetica Neue", Helvetica, "Helvetica Neue", sans-serif;
font-size: 13px; 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 { span, div, td, input, textarea, button, select {
@@ -125,10 +143,10 @@ div.comment { color: #444; }
} }


div#body_div { div#body_div {
display: none;
padding-right: 7px; padding-right: 7px;
padding-top: 70px; padding-top: 70px;
padding-bottom: 50px; padding-bottom: 50px;
min-height: 400px;
} }


.content { .content {


+ 21
- 8
js/core.min.js Wyświetl plik

@@ -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 * 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') parent.appendChild(c);if(className){if(newtag.toLowerCase()=='img')
c.src=className c.src=className
else else
c.className=className;} 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.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);') 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);') $(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) $.extend(args,this.args)
if(this.get_args){$.extend(args,this.get_args(opts));} 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);}} 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 * lib/js/wn/ui/filters.js
*/ */


+ 14
- 14
js/legacy/widgets/form/grid.js Wyświetl plik

@@ -260,6 +260,7 @@ _f.Grid.prototype.set_cell_value = function(cell) {
// and a grid cell is selected // and a grid cell is selected
// deselect the cell // deselect the cell
$(document).bind('click', function(e) { $(document).bind('click', function(e) {
var me = this;
var is_target_toolbar = function() { var is_target_toolbar = function() {
return $(e.target).parents('.grid_tbarlinks').length; return $(e.target).parents('.grid_tbarlinks').length;
} }
@@ -270,7 +271,7 @@ $(document).bind('click', function(e) {
// autosuggest openend // autosuggest openend
//if(wn._autosugg_open) return true; //if(wn._autosugg_open) return true;
return $(e.target).parents().get().indexOf(_f.cur_grid_cell)!=-1; 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) { _f.Grid.prototype.cell_select = function(cell, ri, ci) {
if(_f.cur_grid_cell==cell && cell.hc) return;
if(ri!=null && ci!=null) if(ri!=null && ci!=null)
cell = this.tab.rows[ri].cells[ci]; cell = this.tab.rows[ri].cells[ci];


@@ -324,6 +327,7 @@ _f.Grid.prototype.add_template = function(cell) {
cell.div.appendChild(hc.template.wrapper); cell.div.appendChild(hc.template.wrapper);
hc.template.activate(cell.row.docname); hc.template.activate(cell.row.docname);
hc.template.activated=1; hc.template.activated=1;
cell.hc = hc;
if(hc.template.input && hc.template.input.set_width) { if(hc.template.input && hc.template.input.set_width) {
hc.template.input.set_width($(cell).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_date_cell.grid.set_cell_value(_f.grid_date_cell);
} }
_f.grid_refresh_field = function(temp, input) { _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) { _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)return;
if(!hc.template.activated)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) if(hc.template && hc.template.wrapper.parentNode)


+ 0
- 2
js/wn/app.js Wyświetl plik

@@ -64,8 +64,6 @@ wn.Application = Class.extend({
wn.container = new wn.views.Container(); wn.container = new wn.views.Container();
wn.views.make_403(); wn.views.make_403();
wn.views.make_404(); wn.views.make_404();
$('#startup_div').toggle(false);
$('#body_div').toggle(true);
}, },
make_nav_bar: function() { make_nav_bar: function() {
// toolbar // toolbar


+ 76
- 47
js/wn/dom.js Wyświetl plik

@@ -23,55 +23,84 @@
// add a new dom element // add a new dom element
wn.provide('wn.dom'); 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) { wn.get_cookie = function(c) {


+ 2
- 3
js/wn/ui/listing.js Wyświetl plik

@@ -292,13 +292,12 @@ wn.ui.Listing = Class.extend({
} }
}, },
add_row: function() { 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() { refresh: function() {
this.run(); this.run();
}, },
add_limits: function() { add_limits: function() {
this.query += ' LIMIT ' + this.start + ',' + (this.page_length+1); this.query += ' LIMIT ' + this.start + ',' + (this.page_length+1);
}
}
}); });

+ 1
- 1
js/wn/ui/toolbar.min.js Wyświetl plik

@@ -12,7 +12,7 @@ wn.ui.toolbar.NewDialog=wn.ui.toolbar.SelectorDialog.extend({init:function(){thi
/* /*
* lib/js/wn/ui/toolbar/search.js * 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 * lib/js/wn/ui/toolbar/report.js
*/ */


+ 1
- 1
js/wn/ui/toolbar/search.js Wyświetl plik

@@ -33,7 +33,7 @@ wn.ui.toolbar.Search = wn.ui.toolbar.SelectorDialog.extend({
}); });
// get new types // get new types
this.set_values(profile.can_search.join(',').split(','));
this.set_values(wn.boot.profile.can_search.join(',').split(','));
// global search selector // global search selector
makeselector(); makeselector();


+ 0
- 4
py/webnotes/cms/index.py Wyświetl plik

@@ -35,10 +35,6 @@ import webnotes


body_html = """ body_html = """
<header></header> <header></header>
<div id="startup_div" style="padding: 8px;
font-size: 12px; font-family: Arial !important; line-height: 1.6em;">
Loading...
</div>
<!-- Main Starts --> <!-- Main Starts -->
<div id="body_div"> <div id="body_div">
</div> </div>


+ 1
- 0
py/webnotes/profile.py Wyświetl plik

@@ -248,6 +248,7 @@ class Profile:
self.can_create = d['can_create'] self.can_create = d['can_create']
self.can_read = d['can_read'] self.can_read = d['can_read']
self.can_write = d['can_write'] self.can_write = d['can_write']
self.can_search = d['can_search']
self.can_get_report = d['can_get_report'] self.can_get_report = d['can_get_report']
self.allow_modules = d['allow_modules'] self.allow_modules = d['allow_modules']
self.all_read = d['all_read'] self.all_read = d['all_read']


Ładowanie…
Anuluj
Zapisz