//>>built
require({cache:{"url:app/ui/widgets/templates/SearchPane.html":'\x3cdiv\x3e\n\n  \x3cdiv class\x3d"search-form"\x3e\n    \x3cform data-dojo-attach-point\x3d"labelSearchForm" data-dojo-attach-event\x3d"onsubmit: _search"\x3e\n        \x3cdiv class\x3d"large-10 columns"\x3e\n          \x3cselect data-dojo-attach-point\x3d"conceptSchemeSelect"\x3e\n            \x3coption value\x3d"-1" selected disabled\x3eSelect thesaurus\x3c/option\x3e\n          \x3c/select\x3e\n        \x3c/div\x3e\n        \x3cdiv class\x3d"large-2 columns edit-scheme-button"\x3e\n          \x3cbutton type\x3d"button" class\x3d"button tiny" href\x3d"#/conceptscheme/edit" data-dojo-attach-point\x3d"editSchemeButton"\n                  data-dojo-attach-event\x3d"onClick: _editConceptScheme" disabled\x3eEdit\x3c/button\x3e\n        \x3c/div\x3e\n      \x3cdiv class\x3d"large-12 columns"\x3e\n        \x3cdiv class\x3d"placeholder-container"\x3e\n          \x3clabel for\x3d"labelfilter-${id}"\x3eFilter by label\x3c/label\x3e\n          \x3cinput id\x3d"labelfilter-${id}" data-dojo-attach-point\x3d"labelInput" type\x3d"text"/\x3e\n        \x3c/div\x3e\n      \x3c/div\x3e\n      \x3cdiv class\x3d"large-12 columns"\x3e\n        \x3cdiv class\x3d"placeholder-container"\x3e\n          \x3clabel for\x3d"typefilter-${id}"\x3eFilter by type\x3c/label\x3e\n          \x3cselect id\x3d"typefilter-${id}" data-dojo-attach-point\x3d"conceptTypeSelect"\x3e\n            \x3coption value\x3d"all"\x3eall types\x3c/option\x3e\n            \x3coption value\x3d"concept"\x3econcepts\x3c/option\x3e\n            \x3coption value\x3d"collection"\x3ecollections\x3c/option\x3e\n          \x3c/select\x3e\n        \x3c/div\x3e\n      \x3c/div\x3e\n      \x3cdiv class\x3d"large-12 columns"\x3e\n        \x3cdiv class\x3d"placeholder-container"\x3e\n          \x3clabel for\x3d"matchfilter-${id}"\x3eFilter by match\x3c/label\x3e\n          \x3cinput id\x3d"matchfilter-${id}" data-dojo-attach-point\x3d"matchInput" type\x3d"text" placeholder\x3d"e.g. http://vocab.getty.edu/aat/300005241"/\x3e\n        \x3c/div\x3e\n      \x3c/div\x3e\n      \x3cdiv class\x3d"text-center large-12 columns"\x3e\n        \x3cbutton href\x3d"#/search" class\x3d"button tiny search-button" data-dojo-attach-event\x3d"onClick: _search"\x3e\x3cspan class\x3d"ico ico-mglass"\x3e\x3c/span\x3e\x3c/button\x3e\n      \x3c/div\x3e\n    \x3c/form\x3e\n  \x3c/div\x3e\n\n  \x3cdiv class\x3d"search-results" data-dojo-attach-point\x3d"searchResultsNode"\x3e\n    \x3cdiv data-dojo-attach-point\x3d"gridNode"\x3e\x3c/div\x3e\n  \x3c/div\x3e\n\n  \x3cdiv class\x3d"search-footer-buttons text-center large-8 columns large-offset-2"\x3e\n    \x3cdiv class\x3d"large-4 columns"\x3e\n      \x3cbutton class\x3d"button tiny" href\x3d"#/concept/new" data-dojo-attach-event\x3d"onClick: _createConcept"\n              data-dojo-attach-point\x3d"addConceptButton" disabled\x3e+Add\x3c/button\x3e\n    \x3c/div\x3e\n    \x3cdiv class\x3d"large-4 columns"\x3e\n      \x3cbutton class\x3d"button tiny" href\x3d"#/concept/import" data-dojo-attach-event\x3d"onClick: _importConcept"\n              data-dojo-attach-point\x3d"importConceptButton" disabled\x3eImport\x3c/button\x3e\n    \x3c/div\x3e\n    \x3cdiv class\x3d"large-4 columns"\x3e\n      \x3ca class\x3d"button tiny" href\x3d"#/languages" data-dojo-attach-event\x3d"onClick: _editLanguages"\x3eLanguage\x3c/a\x3e\n    \x3c/div\x3e\n  \x3c/div\x3e\n\n\x3c/div\x3e'}});
define("app/ui/widgets/SearchPane","dojo/_base/declare dojo/_base/array dojo/_base/lang dojo/dom-class dijit/_WidgetBase dijit/_TemplatedMixin dojo/text!./templates/SearchPane.html dgrid/OnDemandGrid dgrid/Keyboard dgrid/Selection dijit/Menu dijit/MenuItem dijit/MenuSeparator dojo/dom-construct dojo/dom-attr dojo/topic dojo/on dojo/dom-style dojo/window ../../utils/DomUtils".split(" "),function(g,y,c,z,m,n,p,q,r,t,h,d,k,u,e,v,l,w,x,f){return g([m,n],{templateString:p,conceptSchemeList:null,baseClass:"search-pane",
appUi:null,_grid:null,_scheme:null,postCreate:function(){this.inherited(arguments)},startup:function(){this.inherited(arguments);this._fillConceptSchemeSelect(this.conceptSchemeList);this._createGrid(this.gridNode);this._grid.startup();this._calculateGridHeight();l(window,"resize",c.hitch(this,function(){this._calculateGridHeight()}))},init:function(a,b){this._scheme=a;this._grid.set("collection",b)},_createGrid:function(a){var b=this._grid=(new g([q,r,t]))({columns:{id:"ID",concept:{label:"Concept",
renderCell:function(a){return u.create("div",{"class":"slideMenuGridCell",innerHTML:"\x3ch3\x3e"+a.label+"\x3c/h3\x3e\x3cp\x3eTYPE: "+a.type+"\x3c/p\x3e\x3cp\x3eURI: "+a.uri+"\x3c/p\x3e"})}}},sort:{property:"label"},selectionMode:"single",cellNavigation:!1,loadingMessage:"Loading data...",noDataMessage:"No results found.",collection:null},a),d=this._createContextMenu(),e=this._createCollectionContextMenu();b.on(".dgrid-content .dgrid-row:click",c.hitch(this,function(a){(a=b.row(a))&&this._rowSelect(a)}));
b.on(".dgrid-row:contextmenu",c.hitch(this,function(a){a.preventDefault();var c=b.row(a).data.type;c&&"concept"===c?(d.selectedGridItem=b.row(a).data,d._scheduleOpen(this,null,{x:a.pageX,y:a.pageY})):(e.selectedGridItem=b.row(a).data,e._scheduleOpen(this,null,{x:a.pageX,y:a.pageY}))}))},_calculateGridHeight:function(){var a=x.getBox().h-30-60;w.set(this.searchResultsNode,"height",a-326-80+"px")},_rowSelect:function(a){this.emit("row-select",{data:a.data,scheme:this._scheme})},_rowDeSelect:function(a){this.emit("row-deselect",
{data:a.data,scheme:this._scheme})},_fillConceptSchemeSelect:function(a){f.addOptionsToSelect(this.conceptSchemeSelect,{data:a,idProperty:"id",labelProperty:"name"});this.own(l(this.conceptSchemeSelect,"change",c.hitch(this,function(){this.emit("scheme.changed",{schemeId:this.conceptSchemeSelect.value});e.set(this.addConceptButton,"disabled",!1);e.set(this.importConceptButton,"disabled",!1);e.set(this.editSchemeButton,"disabled",!1);this._search()})))},_createContextMenu:function(){var a=new h({}),
b=this;a.addChild(new d({label:"Add narrower concept",onClick:c.hitch(this,function(){b.emit("concept.addnarrower",{conceptId:a.selectedGridItem.id})})}));a.addChild(new d({label:"Add subordinate array",onClick:c.hitch(this,function(){b.emit("concept.addsubarray",{conceptId:a.selectedGridItem.id})})}));a.addChild(new d({label:"Edit",onClick:c.hitch(this,function(){b.emit("concept.edit",{conceptId:a.selectedGridItem.id})})}));a.addChild(new d({label:"Delete",onClick:c.hitch(this,function(){b.emit("concept.delete",
{conceptId:a.selectedGridItem.id})})}));a.addChild(new k);a.addChild(new d({label:"Add concept or collection",onClick:c.hitch(this,function(){b.emit("concept.create")})}));return a},_createCollectionContextMenu:function(){var a=new h({}),b=this;a.addChild(new d({label:"Add member",onClick:c.hitch(this,function(){b.emit("concept.addmember",{conceptId:a.selectedGridItem.id})})}));a.addChild(new d({label:"Edit",onClick:c.hitch(this,function(){b.emit("concept.edit",{conceptId:a.selectedGridItem.id})})}));
a.addChild(new d({label:"Delete",onClick:c.hitch(this,function(){b.emit("concept.delete",{conceptId:a.selectedGridItem.id})})}));a.addChild(new k);a.addChild(new d({label:"Add concept or collection",onClick:c.hitch(this,function(){b.emit("concept.create")})}));return a},_search:function(a){a?a.preventDefault():null;a=f.getSelectedOption(this.conceptSchemeSelect);this.matchInput.value=this.matchInput.value.trim();this.labelInput.value=this.labelInput.value.trim();if(-1==a)v.publish("dGrowl","You have to select a scheme.",
{title:"",sticky:!1,channel:"warn"});else{var b={type:f.getSelectedOption(this.conceptTypeSelect),label:this.labelInput.value,sort:"+label"};""!==this.matchInput.value&&(b.match=this.matchInput.value);b=this.appUi.conceptController.getConceptStore(a).filter(b);this.init(a,b);this.appUi._slideMenu._slideOpen()}},_resetSearchInputs:function(){this.labelSearchForm.reset()},_createConcept:function(a){a.preventDefault();this.appUi._createConcept(a)},_importConcept:function(a){a.preventDefault();this.appUi._importConcept(a)},
_editLanguages:function(a){a.preventDefault();this.appUi._editLanguages(a)},_editConceptScheme:function(a){a.preventDefault();this.appUi._editConceptScheme(a)}})});
//# sourceMappingURL=SearchPane.js.map