[open-ils-commits] r9396 - in trunk/Open-ILS/web/js/dojo/openils: .
widget
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Apr 21 13:30:42 EDT 2008
Author: erickson
Date: 2008-04-21 12:51:44 -0400 (Mon, 21 Apr 2008)
New Revision: 9396
Added:
trunk/Open-ILS/web/js/dojo/openils/widget/
trunk/Open-ILS/web/js/dojo/openils/widget/OrgUnitFilteringSelect.js
Log:
added widget directory and new org unit filtering select widget
Added: trunk/Open-ILS/web/js/dojo/openils/widget/OrgUnitFilteringSelect.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/widget/OrgUnitFilteringSelect.js (rev 0)
+++ trunk/Open-ILS/web/js/dojo/openils/widget/OrgUnitFilteringSelect.js 2008-04-21 16:51:44 UTC (rev 9396)
@@ -0,0 +1,33 @@
+if(!dojo._hasResource["openils.widget.OrgUnitFilteringSelect"]){
+dojo._hasResource["openils.widget.OrgUnitFilteringSelect"] = true;
+dojo.require("dijit.form.FilteringSelect");
+dojo.require("fieldmapper.OrgUtils");
+dojo.provide("openils.widget.OrgUnitFilteringSelect");
+
+/**
+ * This widget provides a FilteringSelect for Org Units. In particular,
+ * it indents displayed name ('shortname', by default) based on the orgs depth
+ * to imitate a tree.
+ */
+
+/* TODO add org sorting to ensure proper render order */
+
+dojo.declare(
+ "openils.widget.OrgUnitFilteringSelect", [dijit.form.FilteringSelect],
+ {
+ _getMenuLabelFromItem : function(item) {
+ var type = this.store.getValue(item, 'ou_type');
+ var depth = fieldmapper.aout.findOrgType(type).depth();
+ var lpad = depth*6; /* CSS instead? */
+
+ return {
+ html: true,
+ label: '<div style="padding-left:'+lpad+'px;">' +
+ this.store.getValue(item, this.labelAttr || 'shortname') +
+ '</div>'
+ }
+ }
+ }
+);
+
+}
More information about the open-ils-commits
mailing list