From: erickson Date: Mon, 9 Feb 2009 17:56:19 +0000 (+0000) Subject: teach the IDL about the existence of pkey sequences X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=14e18b4958e7bfee4292d6deb5437fd801eade9e;p=Evergreen.git teach the IDL about the existence of pkey sequences git-svn-id: svn://svn.open-ils.org/ILS/trunk@12117 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/web/js/dojo/fieldmapper/IDL.js b/Open-ILS/web/js/dojo/fieldmapper/IDL.js index 3a0a3f4fd9..69a1c78ebb 100644 --- a/Open-ILS/web/js/dojo/fieldmapper/IDL.js +++ b/Open-ILS/web/js/dojo/fieldmapper/IDL.js @@ -50,7 +50,8 @@ if(!dojo._hasResource["fieldmapper.IDL"]) { label : node.getAttributeNS(this.NS_REPORTS, 'label'), restrict_primary : node.getAttributeNS(this.NS_PERSIST, 'restrict_primary'), virtual : (node.getAttributeNS(this.NS_PERSIST, 'virtual') == 'true'), - pkey : fields.getAttributeNS(this.NS_PERSIST, 'primary') + pkey : fields.getAttributeNS(this.NS_PERSIST, 'primary'), + pkey_sequence : fields.getAttributeNS(this.NS_PERSIST, 'sequence') }; var permacrud = node.getElementsByTagName('permacrud')[0]; diff --git a/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js b/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js index 478ba4be14..c7ce46ad3f 100644 --- a/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js +++ b/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js @@ -25,11 +25,16 @@ if(!dojo._hasResource['openils.widget.AutoFieldWidget']) { for(var k in args) this[k] = args[k]; + console.log(this.fmClass + ' : ' + this.fmObject + ' : ' + this.idlField); + // find the field description in the IDL if not provided + if(this.fmObject) + this.fmClass = this.fmObject.classname; + this.fmIDL = fieldmapper.IDL.fmclasses[this.fmClass]; + if(!this.idlField) { - if(this.fmObject) - this.fmClass = this.fmObject.classname; - var fields = fieldmapper.IDL.fmclasses[this.fmClass].fields; + this.fmIDL = fieldmapper.IDL.fmclasses[this.fmClass]; + var fields = this.fmIDL.fields; for(var f in fields) if(fields[f].name == this.fmField) this.idlField = fields[f]; @@ -166,6 +171,8 @@ if(!dojo._hasResource['openils.widget.AutoFieldWidget']) { _widgetLoaded : function(value) { if(this.widgetValue != null) this.widget.attr('value', this.widgetValue); + if(this.idlField.name == this.fmIDL.pkey && this.fmIDL.pkey_sequence) + this.widget.attr('disabled', true); if(this.onload) this.onload(this.widget, self); }, diff --git a/Open-ILS/web/js/dojo/openils/widget/EditPane.js b/Open-ILS/web/js/dojo/openils/widget/EditPane.js index 731069ac2e..b6e2384d12 100644 --- a/Open-ILS/web/js/dojo/openils/widget/EditPane.js +++ b/Open-ILS/web/js/dojo/openils/widget/EditPane.js @@ -57,6 +57,7 @@ if(!dojo._hasResource['openils.widget.EditPane']) { var widget = new openils.widget.AutoFieldWidget({ idlField : field, fmObject : this.fmObject, + fmClass : this.fmClass, parentNode : valSpan, orgLimitPerms : this.limitPerms }); @@ -133,7 +134,7 @@ if(!dojo._hasResource['openils.widget.EditPane']) { this.fmObject = new fieldmapper[this.fmClass](); for(var idx in fields) this.fmObject[fields[idx]](this.getFieldValue(fields[idx])); - if(this.mode == 'create') + if(this.mode == 'create' && this.fmIDL.pkey_sequence) this.fmObject[fieldmapper[this.fmClass].Identifier](null); pcrud[this.mode](this.fmObject, opts); }