Merge branch 'master' into navupdate

Conflicts:
	version.num
This commit is contained in:
Anand Doshi
2012-02-27 13:21:48 +05:30
5 changed files with 408 additions and 380 deletions

View File

@@ -1,4 +1,8 @@
<div class="layout_wrapper"> <div class="layout_wrapper">
<div id="pe_header"></div> <div id="pe_header"></div>
<div id="perm_engine_div" style="margin: 16px;"></div> <div id="perm_engine_div" style="margin: 16px;"></div>
<div id="submittable_warning" class='help-box' style='display: None'>
One of the Roles has <b>Submit</b> permission.
You will have to <b>Cancel</b> and then <b>Amend</b> a submitted Document for making changes.
</div>
</div> </div>

View File

@@ -146,8 +146,11 @@ pscript.PermEngine.prototype.get_permissions = function() {
$c_obj('Permission Control','get_permissions',sel_val(me.type_select), function(r,rt) { $c_obj('Permission Control','get_permissions',sel_val(me.type_select), function(r,rt) {
// Get permissions // Get permissions
if(r.message.perms.length)me.get_results(r.message); if(r.message.perms.length) {
me.get_results(r.message);
}
else me.body.innerHTML = '<div style = "color : red; margin:8px 0px;">No Records Found</div>' else me.body.innerHTML = '<div style = "color : red; margin:8px 0px;">No Records Found</div>'
pscript.show_submittable();
}); });
} }
@@ -200,6 +203,9 @@ pscript.PermEngine.prototype.get_results = function(r){
var val = perms[l][$td(permt,0,m+2).fieldname]; var val = perms[l][$td(permt,0,m+2).fieldname];
if(val == 1) chk.checked = 1; if(val == 1) chk.checked = 1;
else chk.checked = 0; else chk.checked = 0;
if(m==3) { chk.onclick = pscript.show_submittable }
chk.doctype = doctype; chk.doctype = doctype;
chk.permlevel = perms[l].permlevel; chk.perm_type = col_labels[m+2].toLowerCase(); chk.role = perms[l].role; chk.permlevel = perms[l].permlevel; chk.perm_type = col_labels[m+2].toLowerCase(); chk.role = perms[l].role;
pscript.all_checkboxes.push(chk); pscript.all_checkboxes.push(chk);
@@ -210,6 +216,24 @@ pscript.PermEngine.prototype.get_results = function(r){
me.add_match_select(r, perms, permt, doctype); me.add_match_select(r, perms, permt, doctype);
} }
// Show submittable warning
pscript.show_submittable = function() {
var submittable = 0;
for(i in pscript.all_checkboxes) {
c = pscript.all_checkboxes[i];
if(c.perm_type=='submit' && c.checked) {
submittable = 1;
break;
}
}
if(submittable) {
$('#submittable_warning').toggle(true);
} else {
$('#submittable_warning').toggle(false);
}
}
// render selects for match // render selects for match
// -------------------------------------------- // --------------------------------------------

View File

@@ -353,7 +353,7 @@ function add_sel_options(s,list,sel_val,o_style){if(s.custom_select){s.set_optio
function empty_select(s){if(s.custom_select){s.empty();return;} function empty_select(s){if(s.custom_select){s.empty();return;}
if(s.inp)s=s.inp;if(s){var tmplen=s.length;for(var i=0;i<tmplen;i++)s.options[0]=null;}} if(s.inp)s=s.inp;if(s){var tmplen=s.length;for(var i=0;i<tmplen;i++)s.options[0]=null;}}
function sel_val(s){if(s.custom_select){return s.inp.value?s.inp.value:'';} function sel_val(s){if(s.custom_select){return s.inp.value?s.inp.value:'';}
if(s.inp)s=s.inp;try{if(s.selectedIndex<s.options.length)return s.options[s.selectedIndex].value;else return'';}catch(err){return'';}} if(s.inp)s=s.inp;try{if(s.selectedIndex<s.options.length)return s.options[s.selectedIndex].value;else return'';}catch(err){return'';}}
function add_sel_options(s,list,sel_val,o_style){if(s.custom_select){s.set_options(list) function add_sel_options(s,list,sel_val,o_style){if(s.custom_select){s.set_options(list)
if(sel_val)s.inp.value=sel_val;return;} if(sel_val)s.inp.value=sel_val;return;}
if(s.inp)s=s.inp;for(var i=0,len=list.length;i<len;i++){var o=new Option(list[i],list[i],false,(list[i]==sel_val?true:false));if(o_style)$y(o,o_style);s.options[s.options.length]=o;}} if(s.inp)s=s.inp;for(var i=0,len=list.length;i<len;i++){var o=new Option(list[i],list[i],false,(list[i]==sel_val?true:false));if(o_style)$y(o,o_style);s.options[s.options.length]=o;}}

View File

@@ -279,7 +279,7 @@ function add_sel_options(s,list,sel_val,o_style){if(s.custom_select){s.set_optio
if(sel_val)s.inp.value=sel_val;return;} if(sel_val)s.inp.value=sel_val;return;}
if(s.inp)s=s.inp;for(var i=0,len=list.length;i<len;i++){var o=new Option(list[i],list[i],false,(list[i]==sel_val?true:false));if(o_style)$y(o,o_style);s.options[s.options.length]=o;}} if(s.inp)s=s.inp;for(var i=0,len=list.length;i<len;i++){var o=new Option(list[i],list[i],false,(list[i]==sel_val?true:false));if(o_style)$y(o,o_style);s.options[s.options.length]=o;}}
function cint(v,def){v=v+'';v=lstrip(v,['0']);v=parseInt(v);if(isNaN(v))v=def?def:0;return v;} function cint(v,def){v=v+'';v=lstrip(v,['0']);v=parseInt(v);if(isNaN(v))v=def?def:0;return v;}
function validate_email(id){if(strip(id).search("[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?")==-1)return 0;else return 1;} function validate_email(id){if(strip(id.toLowerCase()).search("[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?")==-1)return 0;else return 1;}
function validate_spl_chars(txt){if(txt.search(/^[a-zA-Z0-9_\- ]*$/)==-1)return 1;else return 0;} function validate_spl_chars(txt){if(txt.search(/^[a-zA-Z0-9_\- ]*$/)==-1)return 1;else return 0;}
function d2h(d){return cint(d).toString(16);} function d2h(d){return cint(d).toString(16);}
function h2d(h){return parseInt(h,16);} function h2d(h){return parseInt(h,16);}