define([ "../../widgets/TabbedBrowser", "../classes/categories", "../classes/questions", "../classes/topics", "dojo/_base/array", "dojo/_base/declare", "dojo/_base/lang" ], function(TabbedBrowser, categories, questions, topics, array, declare, lang) { return declare([TabbedBrowser],{ tabPosition: 'left-h', include: null, dndType: "question", getCategories: function(){ var opts = {}; if ( this.include ) { opts[this.include] = true; } return categories.query(opts); }, getCategoryName: function(category){ return category.name; }, getCategoryCount: function(category){ return category.count; }, getTopics: function(category) { var opts = {category:category.name}; if ( this.include ) { opts[this.include] = true; } return topics.query(opts); }, getTopicName: function(topic){ return topic.name; }, getTopicCount: function(topic){ return topic.count; }, getItems: function(category,topic) { var opts = {category:category.name,topic:topic.name}; if ( this.include ) { opts[this.include] = true; } return questions.query(opts); }, getItemName: function(item) { var title = '['+item.code+']'+item.title; if ( !this.include && !item.publicationDate ) { title += ' (*)'; } return title; }, areItemsEqual: function(i1,i2) { return questions.getId(i1) === questions.getId(i2); } }); });